New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@statsig/js-client

Package Overview
Dependencies
Maintainers
4
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@statsig/js-client - npm Package Compare versions

Comparing version 0.0.1-beta.38 to 0.0.1-beta.39

2

build/statsig-js-client.min.js

@@ -1,1 +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.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $P = (a,b) => Object.assign(a,b);var n={496:(t,e,n)=>{$Q(e),e.t=e.i=void 0,e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:u;e.t=t=>{var e;return t?null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t]:null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.lastInstance};var i,s="__STATSIG__",o="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},r="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=o[s])?i:n[s])?i:r[s])?i:{instance:e.t};o[s]=u,n[s]=u,r[s]=u},856:(t,e)=>{$Q(e)},320:function(t,e,n){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.DataAdapterCore=void 0;const i=n(512),r=n(780),s=n(283),u=n(296),l=n(444),a=n(412);e.DataAdapterCore=class{constructor(t,e){this.o=t,this.u=e,this.l=null,this.h=null,this.v={},this._="statsig.last_modified_time."+e}attach(t,e){this.h=t,this.l=new i.ErrorBoundary(t)}getDataSync(t){var t=this.m(t),e=this.v[t];return e||((e=this.p(t))?(this.S(t,e),this.v[t]):null)}setData(t,e){e=this.m(e);this.S(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.v=$P($P({},this.v),t)}O(e,n,i){var s;return o(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.j(null!=(s=null==t?void 0:t.data)?s:null,n)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(r.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}T(n,i){return o(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.O(null,n,i);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}j(i,s){return o(this,void 0,void 0,function*(){var t=yield this.I(i,s);if(!t)return r.Log.debug("No response returned for latest value"),null;var e=(0,a.typedJsonParse)(t,"has_updates","Failure while attempting to persist latest value");let n=null;return!0===(null==e?void 0:e.has_updates)?n={source:"Network",data:t,receivedAt:Date.now()}:i&&!1===(null==e?void 0:e.has_updates)&&(n={source:"NetworkNotModified",data:i,receivedAt:Date.now()}),n?(t=this.m(s),this.S(t,n),yield this.A(t,n),n):null})}M(){return null!=this.h?this.h:(r.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,u.getUserStorageKey)(this.M(),t);return`${s.DataAdapterCachePrefix}.${this.u}.`+t}S(t,e){var n=Object.entries(this.v);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.v[n]),this.v[t]=e}p(t){var e=null==(e=l.Storage.D)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,a.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}A(t,e){return o(this,void 0,void 0,function*(){yield l.Storage.P(t,JSON.stringify(e)),yield this.k(t)})}k(n){var i;return o(this,void 0,void 0,function*(){var t=null!=(i=yield(0,l.N)(this._))?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.C(e[0])),yield(0,l.G)(this._,t)})}}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(360),a=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t,e){this.h=t,this.F=e,this.R=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(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)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.capture(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.U("eb:wrap",t)}}capture(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.U(e,t)):n}catch(t){return this.U(e,t),null}}logError(t,e){this.U(t,e)}U(o,r){try{i.Log.warn("Caught error in "+o,{error:r});n(this,void 0,void 0,function*(){var t,e,n=null!=r?r:Error("[Statsig] Error was empty"),i=n instanceof Error,s=i?n.name:"No Name";this.R.has(s)||(this.R.add(s),t=l.SDKType.K(this.h),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(n),n=JSON.stringify($P({tag:o,exception:s,info:i},$P($P({},e),{sdkType:t}))),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.h,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(s=this.F)&&s.call(this,{name:"error",error:r}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.EventLogger=void 0;const s=n(832),o=n(780),r=n(716),u=n(48),l=n(876),a=n(444),c=n(412),d=n(84),h=n(100),v={},_=t=>{null!=(t=v[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this.h=e,this.F=t,this.L=n,this.J=i,this.V=[],this.q={},this.B={},this.$=!1,this.H=Date.now(),(v[e]=this).Y=!0===(null==i?void 0:i.disableLogging),this.W=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;t=null!=(n=null==i?void 0:i.loggingIntervalMs)?n:1e4;const s=setInterval(()=>{v[e]?_(e):clearInterval(s)},t);this.X=s;n=null==i?void 0:i.networkConfig;this.tt=(0,d.et)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",r.NetworkDefault.eventsApi),this.nt=(0,d.et)(null==n?void 0:n.logEventBeaconUrl,null==n?void 0:n.api,"/log_event_beacon",r.NetworkDefault.eventsApi),(0,h.it)(t=>{"background"===t&&_(e)}),this.st()}setLoggingDisabled(t){this.Y=t}enqueue(t){this.rt(t)&&(this.ut(t),this.lt(),this.V.length>this.W)&&_(this.h)}incrementNonExposureCount(t){var e=null!=(e=this.B[t])?e:0;this.B[t]=e+1}reset(){this.q={}}shutdown(){return i(this,void 0,void 0,function*(){this.X&&(clearInterval(this.X),this.X=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.ct(),0!==this.V.length&&(t=this.V,this.V=[],yield this.dt(t))})}lt(){this.$||(this.$=!0,200<Date.now()-this.H)||setTimeout(()=>_(this.h),200)}rt(t){if((0,l.ht)(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.q[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.q).length&&(this.q={}),this.q[t]=n}return!0}dt(t){return i(this,void 0,void 0,function*(){if(this.Y)this.vt(t);else try{(!(0,h._t)()&&this.L.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.F({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){return i(this,void 0,void 0,function*(){var t=yield this.L.post({sdkKey:this.h,data:{events:e},url:this.tt,retries:3,params:{[r.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,c.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.L.beacon({sdkKey:this.h,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,a.G)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}st(){const e=this.bt();i(this,void 0,void 0,function*(){var t=yield(0,a.N)(e);t&&(yield a.Storage.C(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}bt(){return"statsig.failed_logs."+(0,s.DJB2)(this.h)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.yt();n&&(e.statsigMetadata={currentPage:n}),this.V.push($P($P({},t),e))}ct(){0!==Object.keys(this.B).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.B)}}),this.B={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.St)()}}},832:(t,e)=>{$Q(e),e.DJB2Object=e.DJB2=void 0;e.DJB2=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)};e.DJB2Object=t=>(0,e.DJB2)(JSON.stringify(s(t)));const s=n=>{if(null==n)return null;var t=Object.keys(n).sort();const i={};return t.forEach(t=>{let e=n[t];e instanceof Object&&(e=s(e)),i[t]=e}),i}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,s;$Q(e),e.Log=e.LogLevel=void 0,(s=i||(e.LogLevel=i={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class o{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=o).level=i.Error},716:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se"}},188:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.NetworkCore=void 0,n(496);const h=n(280),v=n(780),s=n(716),o=n(360),r=n(612),u=n(604),l=n(972);e.NetworkCore=class{constructor(t,e){this.J=t,this.F=e,this.Ot=null!=(t=null==(e=null==t?void 0:t.networkConfig)?void 0:e.networkTimeoutMs)?t:1e4}post(e){return i(this,void 0,void 0,function*(){var t=yield this.jt(e);return this.Tt($P({method:"POST",body:this.wt(e,t)},e))})}get(t){return this.Tt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return i(this,void 0,void 0,function*(){var t,e;return!!_(n)&&(t=yield this.It(n),e=yield this.jt(n),navigator.sendBeacon(t,e))})}Tt(c){var d;return i(this,void 0,void 0,function*(){if(!_(c))return null;var{method:e,body:n,retries:i}=c;const s=new AbortController;var t=setTimeout(()=>s.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),o=yield this.It(c),r=null;try{var u,l,a,r=yield fetch(o,{method:e,body:n,headers:$P({},c.headers),signal:s.signal});if(clearTimeout(t),r.ok)return a=yield r.text(),h.Diagnostics.mark(),{body:a,code:r.status};throw u=yield r.text().catch(()=>"No Text"),(l=new Error(`Failed to fetch: ${o} `+u)).name="NetworkError",l}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}(s,t);return h.Diagnostics.mark(),!i||i<=0?(null!=(d=this.F)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${o}.`,n,t),null):this.Tt($P($P({},c),{retries:i-1}))}})}It(e){return i(this,void 0,void 0,function*(){var t=$P({[s.NetworkParam.SdkKey]:e.sdkKey,[s.NetworkParam.SdkType]:o.SDKType.K(e.sdkKey),[s.NetworkParam.SdkVersion]:l.SDK_VERSION,[s.NetworkParam.Time]:String(Date.now()),[s.NetworkParam.SessionID]:yield r.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}jt(s){return i(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,n=yield u.StableID.get(e),i=yield r.SessionID.get(e),e=o.SDKType.K(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},l.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}wt(t,e){var n;return!(null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(n=this.J)&&n.disableStatsigEncoding)&&t.isStatsigEncodable&&"undefined"!=typeof window&&window.btoa&&(t.params=$P($P({},null!=(n=t.params)?n:{}),{[s.NetworkParam.StatsigEncoded]:"1"}),null!=(t=window.btoa(e).split("").reverse().join("")))?t:e}};const _=t=>!!t.sdkKey||(v.Log.warn("Unable to make request without an SDK key"),!1)},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={K:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},xt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.St=i.Mt=i.Dt=i.Et=i.Pt=i.kt=void 0;i.kt=()=>"undefined"!=typeof window?window:null,i.Pt=()=>{var t=(0,i.kt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Et=()=>null!=(0,i.Pt)(),i.Dt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.Mt=(t,e)=>{var n=(0,i.Pt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.St=()=>{var t;try{return null==(t=(0,i.kt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,e,n){var r=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(832),u=n(780),l=n(444),a=n(556),c=18e5,d=144e5,h={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function _(t){return"statsig.session_id."+(0,i.DJB2)(t)}e.SessionID={get:t=>r(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:o=>r(void 0,void 0,void 0,function*(){null==h[o]&&(h[o]=function(n){return r(this,void 0,void 0,function*(){let t=yield function(t){t=_(t);return(0,l.N)(t)}(n);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:n}})}(o));var t=yield h[o],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>c}(n)||function({startTime:t}){return Date.now()-t>d}(n))&&(n.sessionID=(0,a.getUUID)(),n.startTime=e),n.lastUpdate=e,n),s=t.sdkKey;return s=_(s),(0,l.G)(s,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=v(n,c),t.ageTimeoutID=v(n,d-e),t})}},604:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.StableID=void 0;const s=n(832),o=n(780),r=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,s.DJB2)(t)}function c(t,e){e=a(e);(0,r.G)(e,t).catch(()=>{o.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,r.N)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.StatsigClientBase=void 0,n(496);const l=n(496),a=n(512),c=n(728),d=n(780),h=n(48),v=n(604),_=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Ft={};var s,o=this.$emt.bind(this),r=(0,l.i)(),u=null!=(u=r.instances)?u:{};null!=i&&i.logLevel&&(d.Log.level=null==i?void 0:i.logLevel),null!=i&&i.disableStorage&&_.Storage.Ut(!0),null!=i&&i.overrideStableID&&v.StableID.setOverride(i.overrideStableID,t),this.l=new a.ErrorBoundary(t,o),this.l.wrap(this),this.l.wrap(n),this.l.wrap(e),this.h=t,this.J=null!=i?i:{},this.Kt=null!=(s=null==i?void 0:i.overrideAdapter)?s:null,this.Lt=new c.EventLogger(t,o,n,i),null!=u[t]&&(0,h.Et)()&&d.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),u[t]=this,r.lastInstance=this,r.instances=u,__STATSIG__=r,this.dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Lt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,_.Storage.Ut(t.disableStorage))}flush(){return this.Lt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Lt.shutdown()})}on(t,e){this.Ft[t]||(this.Ft[t]=[]),this.Ft[t].push(e)}off(t,e){this.Ft[t]&&-1!==(e=this.Ft[t].indexOf(e))&&this.Ft[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.l.logError("__emit:"+n.name,t):d.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Ft[n.name]&&this.Ft[n.name].forEach(t=>e(t)),null!=(t=this.Ft["*"])&&t.forEach(e)}Jt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Vt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Lt.incrementNonExposureCount(t):this.Lt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.qt=e.zt=e.Bt=e.ht=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,s)=>({eventName:t,user:e,value:null,metadata:o(n,i),secondaryExposures:s,time:Date.now()});e.ht=({eventName:t})=>t===i||t===n,e.Bt=(t,e)=>{return l(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.zt=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.qt=(t,e,n)=>{var i,s=e.__evaluation,o=!0===(null==(o=null==s?void 0:s.explicit_parameters)?void 0:o.includes(n));let r="",u=null!=(i=null==s?void 0:s.undelegated_secondary_exposures)?i:[];return o&&(r=null!=(i=s.allocated_experiment_name)?i:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(o)},u)};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.38";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.$t=e.Ht=e.Yt=e.Wt=void 0;const s="default";function o(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:s,__evaluation:n,value:i}}function r(o,r){return(t,e)=>{var n,i,s=null!=(s=null==o?void 0:o[t])?s:null;return null==s||null!=e&&(n=e,(i=t=>Array.isArray(t)?"array":typeof t)(s)!==i(n))?null!=e?e:null:(null!=r&&r(t),s)}}e.Wt=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.Yt=function(t,e,n){return $P($P({},o(t,e,n,null!=(t=null==n?void 0:n.value)?t:{})),{groupName:null,get:r(null==n?void 0:n.value)})},e.Ht=function(t,e,n,i){return $P($P({},o(t,e,n,void 0)),{get:r(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.$t=function(t,e,n,i){return $P($P($P({},t),e),{get:r(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e,n)=>{$Q(e),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,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})},n=($Q(e),e.G=e.N=e.Storage=void 0,n(780));const s={},o={Qt:()=>"InMemory",D(t){return null!=(t=s[t])?t:null},Xt(t){return Promise.resolve(null!=(t=s[t])?t:null)},P(t,e){return s[t]=e,Promise.resolve()},C(t){return delete s[t],Promise.resolve()},Zt(){return Promise.resolve(Object.keys(s))}};let r=null;try{"undefined"!=typeof window&&"localStorage"in window&&(r={Qt:()=>"LocalStorage",D(t){return localStorage.getItem(t)},Xt(t){return Promise.resolve(localStorage.getItem(t))},P(t,e){return localStorage.setItem(t,e),Promise.resolve()},C(t){return localStorage.removeItem(t),Promise.resolve()},Zt(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==r&&void 0!==r?r:o,l=u;e.Storage={Qt:()=>l.Qt(),Xt:t=>l.Xt(t),P:(t,e)=>l.P(t,e),C:t=>l.C(t),Zt:()=>l.Zt(),D:t=>{var e;return null!=(e=null==(e=l.D)?void 0:e.call(l,t))?e:null},te:t=>{u=t,l=t},Ut:t=>{l=t?o:u}},e.N=function(e){return i(this,void 0,void 0,function*(){var t=yield l.Xt(e);return JSON.parse(null!=t?t:"null")})},e.G=function(t,e){return i(this,void 0,void 0,function*(){yield l.P(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),e.typedJsonParse=void 0;const s=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 s.Log.error(n),null}},556:(t,e)=>{$Q(e),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)=>{$Q(e),e.et=void 0,e.et=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.ee=e.it=e._t=void 0;n=n(48);const i="foreground",s="background",o=[];let r=i;e._t=()=>r===i,e.it=t=>{o.unshift(t)};e.ee=e=>{e!==r&&(r=e,o.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>(0,e.ee)(i)),(0,n.Dt)("blur",()=>(0,e.ee)(s)),(0,n.Dt)("beforeunload",()=>(0,e.ee)(s)),(0,n.Mt)("visibilitychange",()=>{(0,e.ee)("visible"===document.visibilityState?i:s)})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,n(496);const o=n(728),r=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),n(780));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=n(972);const l=n(444);Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return l.Storage}});var a=n(556);s(n(496),e),s(n(856),e),s(n(320),e),s(n(184),e),s(n(512),e),s(n(500),e),s(n(788),e),s(n(832),e),s(n(664),e),s(n(780),e),s(n(188),e),s(n(716),e),s(n(264),e),s(n(48),e),s(n(360),e),s(n(612),e),s(n(604),e),s(n(688),e),s(n(808),e),s(n(283),e),s(n(876),e),s(n(972),e),s(n(384),e),s(n(396),e),s(n(136),e),s(n(296),e),s(n(444),e),s(n(412),e),s(n(84),e),s(n(539),e),s(n(556),e),s(n(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:o.EventLogger,Log:r.Log,getUUID:a.getUUID,Storage:l.Storage,SDK_VERSION:u.SDK_VERSION})},696:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),s(n(208),e),e.default=__STATSIG__},96:(t,e,n)=>{$Q(e),e.resolveDeltasResponse=void 0;const i=n(464);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.resolveDeltasResponse=function(t,e){var n;return(e=(0,i.typedJsonParse)(e,"checksum","Failed to parse DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),n.dynamic_configs)}),s((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.DJB2Object)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs}))===e.checksum?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},536:(t,e,n)=>{$Q(e);const i=n(464);e.default=class{constructor(){this.ne=null,this.ie=null,this.oe="Uninitialized",this.se=0,this.re=0}getValues(){return this.ne?(0,i.typedJsonParse)(this.ne,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.ie=null,this.ne=null,this.oe="Loading",this.se=0,this.re=0}finalize(){this.ie||(this.oe="NoValues")}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,i.typedJsonParse)(t.data,"has_updates","Failed to parse EvaluationResponse"))?void 0:e.has_updates)&&(this.ne=t.data,this.se=e.time,this.re=t.receivedAt,this.oe=t.source,this.ie=e)}getGate(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.feature_gates[t])?e:null;return this.ue(t)}getConfig(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.dynamic_configs[t])?e:null;return this.ue(t)}getLayer(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.layer_configs[t])?e:null;return this.ue(t)}ue(t){return{evaluation:t,details:this.le(null==t)}}le(t){return"Uninitialized"===this.oe||"NoValues"===this.oe?{reason:this.oe}:{reason:this.oe+":"+(t?"Unrecognized":"Recognized"),lcut:this.se,receivedAt:this.re}}}},400:function(t,e,n){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e);const r=n(464),u=n(96);class i extends r.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.ae=(0,r.et)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",r.NetworkDefault.initializeApi)}fetchEvaluations(n,i,s){return o(this,void 0,void 0,function*(){var t=i?(0,r.typedJsonParse)(i,"has_updates","Failed to parse cached EvaluationResponse"):null;let e={user:s,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.ce(n,t,e)})}ce(e,n,i){var s;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.ae,data:i,retries:2,isStatsigEncodable:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(s=null==t?void 0:t.body)?s:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(s=t.body)?void 0:s.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,u.resolveDeltasResponse)(n,t.body))?t:this.ce(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}))})}}e.default=i},520:function(t,e,n){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e);const r=n(464),o=n(536),u=n(400),l=n(364);class i extends r.StatsigClientBase{static instance(t){var e=(0,r.i)().instance(t);return e instanceof i?e:(r.Log.warn("Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){r.SDKType.At(t,"javascript-client");var i=new u.default(n,t=>{this.$emt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,i,n),this.de=new o.default,this.he=e}initializeSync(){this.updateUserSync(this.he)}initializeAsync(t){return this.updateUserAsync(this.he,t)}updateUserSync(t){this.ve(t);t=this.dataAdapter.getDataSync(this.he);this.de.setValuesFromDataAdapter(t),this.de.finalize(),this.Jt("Ready",t),this._e(null!=t?t:null,this.he)}updateUserAsync(n,i){return s(this,void 0,void 0,function*(){this.ve(n);var t=this.he,e=this.dataAdapter.getDataSync(t);this.Jt("Loading",e),this.de.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.he&&this.de.setValuesFromDataAdapter(e),this.de.finalize(),this.Jt("Ready",e)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.de.getValues(),user:JSON.parse(JSON.stringify(this.he)),errorBoundary:this.l}}getAsyncContext(){return s(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield r.StatsigSession.get(this.h),stableID:yield r.StableID.get(this.h)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,r.DJB2)(t),{evaluation:n,details:i}=this.de.getGate(n),i=(0,r.Wt)(t,i,n),s=null==(s=null==(n=this.Kt)?void 0:n.getGateOverride)?void 0:s.call(n,i,this.he,e),n=null!=s?s:i;return this.Vt(t,(0,r.Bt)(this.he,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.fe("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.fe("experiment",t,e);return this.$emt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n){var t=(0,r.DJB2)(e),{evaluation:t,details:i}=this.de.getLayer(t),i=(0,r.Ht)(e,i,t),s=null==(s=null==(t=this.Kt)?void 0:t.getLayerOverride)?void 0:s.call(t,i,this.he,n);const o=(0,r.$t)(i,s,null!=(t=null==s?void 0:s.__value)?t:i.__value,t=>{this.Vt(e,(0,r.qt)(this.he,o,t),n)});return this.$emt({name:"layer_evaluation",layer:o}),o}logEvent(t,e,n){this.Lt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.he,time:Date.now()}))}_e(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{r.Log.error("An error occurred after update.",t)})}ve(t){this.Lt.reset(),this.de.reset(),this.he=(0,r.normalizeUser)(t,this.J.environment)}fe(t,e,n){var i=(0,r.DJB2)(e),{evaluation:i,details:s}=this.de.getConfig(i),s=(0,r.Yt)(e,s,i),i="experiment"===t?null==(t=null==(i=this.Kt)?void 0:i.getExperimentOverride)?void 0:t.call(i,s,this.he,n):null==(i=null==(t=this.Kt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,s,this.he,n),t=null!=i?i:s;return this.Vt(e,(0,r.zt)(this.he,t),n),t}}e.default=i},364:function(t,e,n){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})},i=($Q(e),e.StatsigEvaluationsDataAdapter=void 0,n(464));const o=n(400);class r extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.L=null}attach(t,e){super.attach(t,e),this.L=new o.default(null!=e?e:{})}getDataAsync(t,e,n){return this.O(t,e,n)}prefetchData(t,e){return this.T(t,e)}I(e,n){var i;return s(this,void 0,void 0,function*(){var t=yield null==(i=this.L)?void 0:i.fetchEvaluations(this.M(),e,n);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=r},208:(t,e,n)=>{$Q(e),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var i=n(520);e.StatsigClient=i.default;const s=n(364);Object.defineProperty(e,"StatsigEvaluationsDataAdapter",{enumerable:!0,get:function(){return s.StatsigEvaluationsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:s.StatsigEvaluationsDataAdapter,StatsigClient:i.default}),e.default=__STATSIG__}},i={};function s(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,s)),e.exports}return s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s(696).default})());
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $P=(a,b)=>Object.assign(a,b);var $A=()=>((t,r,u,l)=>{return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.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,o)}s((l=l.apply(t,r||[])).next())})});var n={496:(t,e,n)=>{$Q(e),e.t=e.i=void 0,e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:u;e.t=t=>{var e;return t?null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t]:null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.lastInstance};var i,s="__STATSIG__",o="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},r="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=o[s])?i:n[s])?i:r[s])?i:{instance:e.t};o[s]=u,n[s]=u,r[s]=u},856:(t,e)=>{$Q(e)},320:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const u=n(780),i=n(283),s=n(296),o=n(444),l=n(412);e.DataAdapterCore=class{constructor(t,e){this.o=t,this.u=e,this.h=null,this.v={},this._="statsig.last_modified_time."+e}attach(t,e){this.h=t}getDataSync(t){var t=this.m(t),e=this.v[t];return e||((e=this.p(t))?(this.S(t,e),this.v[t]):null)}setData(t,e){e=this.m(e);this.S(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.v=$P($P({},this.v),t)}O(e,n,i){var s;return r(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.en(null!=(s=null==t?void 0:t.data)?s:null,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}T(n,i){return r(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.O(null,n,i);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}en(i,s,o){return r(this,void 0,void 0,function*(){var t=yield this.I(i,s,o);if(!t)return u.Log.debug("No response returned for latest value"),null;var e=(0,l.typedJsonParse)(t,"has_updates","Failure while attempting to persist latest value");let n=null;return!0===(null==e?void 0:e.has_updates)?n={source:"Network",data:t,receivedAt:Date.now()}:i&&!1===(null==e?void 0:e.has_updates)&&(n={source:"NetworkNotModified",data:i,receivedAt:Date.now()}),n?(t=this.m(s),this.S(t,n),yield this.A(t,n),n):null})}M(){return null!=this.h?this.h:(u.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,s.getUserStorageKey)(this.M(),t);return`${i.DataAdapterCachePrefix}.${this.u}.`+t}S(t,e){var n=Object.entries(this.v);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.v[n]),this.v[t]=e}p(t){var e=null==(e=o.Storage.D)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,l.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}A(t,e){return r(this,void 0,void 0,function*(){yield o.Storage.P(t,JSON.stringify(e)),yield this.k(t)})}k(n){var i;return r(this,void 0,void 0,function*(){var t=null!=(i=yield(0,o.N)(this._))?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 o.Storage.C(e[0])),yield(0,o.G)(this._,t)})}}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var n=this&&this.__awaiter||$A();Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(360),a=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t,e,n){this.h=t,this.J=e,this.F=n,this.R=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(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)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.capture(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.U("eb:wrap",t)}}capture(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.U(e,t)):n}catch(t){return this.U(e,t),null}}logError(t,e){this.U(t,e)}U(o,r){try{i.Log.warn("Caught error in "+o,{error:r});n(this,void 0,void 0,function*(){var t,e,n=null!=r?r:Error("[Statsig] Error was empty"),i=n instanceof Error,s=i?n.name:"No Name";this.R.has(s)||(this.R.add(s),null!=(t=null==(t=this.J)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.F)&&t.call(this,{name:"error",error:r}):(t=l.SDKType.K(this.h),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(n),n=JSON.stringify($P({tag:o,exception:s,info:i},$P($P({},e),{sdkType:t}))),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.h,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(s=this.F)&&s.call(this,{name:"error",error:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=n(832),o=n(780),r=n(716),u=n(48),l=n(876),a=n(444),c=n(412),d=n(84),h=n(100),v={},_=t=>{null!=(t=v[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this.h=e,this.F=t,this.L=n,this.J=i,this.V=[],this.q={},this.B={},this.$=!1,this.H=Date.now(),(v[e]=this).Y=!0===(null==i?void 0:i.disableLogging),this.W=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;t=null!=(n=null==i?void 0:i.loggingIntervalMs)?n:1e4;const s=setInterval(()=>{v[e]?_(e):clearInterval(s)},t);this.X=s;n=null==i?void 0:i.networkConfig;this.tt=(0,d.et)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",r.NetworkDefault.eventsApi),this.nt=(0,d.et)(null==n?void 0:n.logEventBeaconUrl,null==n?void 0:n.api,"/log_event_beacon",r.NetworkDefault.eventsApi),(0,h.it)(t=>{"background"===t&&_(e)}),this.st()}setLoggingDisabled(t){this.Y=t}enqueue(t){this.rt(t)&&(this.ut(t),this.lt(),this.V.length>this.W)&&_(this.h)}incrementNonExposureCount(t){var e=null!=(e=this.B[t])?e:0;this.B[t]=e+1}reset(){this.q={}}shutdown(){return i(this,void 0,void 0,function*(){this.X&&(clearInterval(this.X),this.X=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.ct(),0!==this.V.length&&(t=this.V,this.V=[],yield this.dt(t))})}lt(){this.$||(this.$=!0,200<Date.now()-this.H)||setTimeout(()=>_(this.h),200)}rt(t){if((0,l.ht)(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.q[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.q).length&&(this.q={}),this.q[t]=n}return!0}dt(t){return i(this,void 0,void 0,function*(){if(this.Y)this.vt(t);else try{(!(0,h._t)()&&this.L.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.F({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){return i(this,void 0,void 0,function*(){var t=yield this.L.post({sdkKey:this.h,data:{events:e},url:this.tt,retries:3,params:{[r.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,c.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.L.beacon({sdkKey:this.h,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,a.G)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}st(){const e=this.bt();i(this,void 0,void 0,function*(){var t=yield(0,a.N)(e);t&&(yield a.Storage.C(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}bt(){return"statsig.failed_logs."+(0,s.DJB2)(this.h)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.yt();n&&(e.statsigMetadata={currentPage:n}),this.V.push($P($P({},t),e))}ct(){0!==Object.keys(this.B).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.B)}}),this.B={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.St)()}}},832:(t,e)=>{$Q(e),e.DJB2Object=e.DJB2=void 0;e.DJB2=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)};e.DJB2Object=t=>(0,e.DJB2)(JSON.stringify(s(t)));const s=n=>{if(null==n)return null;var t=Object.keys(n).sort();const i={};return t.forEach(t=>{let e=n[t];e instanceof Object&&(e=s(e)),i[t]=e}),i}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,s;$Q(e),e.Log=e.LogLevel=void 0,(s=i||(e.LogLevel=i={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class o{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=o).level=i.Error},716:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se"}},188:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(496);const v=n(280),_=n(780),u=n(716),o=n(360),l=n(48),r=n(612),a=n(604),c=n(972);e.NetworkCore=class{constructor(t,e){this.J=t,this.F=e,this.Ot=null!=(t=null==(e=null==t?void 0:t.networkConfig)?void 0:e.networkTimeoutMs)?t:1e4}post(e){return i(this,void 0,void 0,function*(){var t=yield this.jt(e);return this.Tt($P({method:"POST",body:this.wt(e,t)},e))})}get(t){return this.Tt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return i(this,void 0,void 0,function*(){var t,e;return!!f(n)&&(t=yield this.It(n),e=yield this.jt(n),navigator.sendBeacon(t,e))})}Tt(d){var h;return i(this,void 0,void 0,function*(){if(!f(d))return null;if(null!=(h=null==(h=this.J)?void 0:h.networkConfig)&&h.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i}=d;const s=new AbortController;var t=setTimeout(()=>s.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),o=yield this.It(d),r=null;try{var u,l,a,c={method:e,body:n,headers:$P({},d.headers),signal:s.signal,priority:d.priority},r=yield fetch(o,c);if(clearTimeout(t),r.ok)return a=yield r.text(),v.Diagnostics.mark(),{body:a,code:r.status};throw u=yield r.text().catch(()=>"No Text"),(l=new Error(`Failed to fetch: ${o} `+u)).name="NetworkError",l}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}(s,t);return v.Diagnostics.mark(),!i||i<=0?(null!=(h=this.F)&&h.call(this,{name:"error",error:t}),_.Log.error(`A networking error occured during ${e} request to ${o}.`,n,t),null):this.Tt($P($P({},d),{retries:i-1}))}})}It(e){return i(this,void 0,void 0,function*(){var t=$P({[u.NetworkParam.SdkKey]:e.sdkKey,[u.NetworkParam.SdkType]:o.SDKType.K(e.sdkKey),[u.NetworkParam.SdkVersion]:c.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:yield r.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}jt(s){return i(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,n=yield a.StableID.get(e),i=yield r.SessionID.get(e),e=o.SDKType.K(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},c.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}wt(t,e){var n,i,s,o=(0,l.kt)();if(null==o||!o.btoa||null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(n=this.J)&&n.disableStatsigEncoding||!t.isStatsigEncodable)return e;try{var r=null!=(i=o.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(s=t.params)?s:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return _.Log.warn("/initialize request encoding failed"),e}}};const f=t=>!!t.sdkKey||(_.Log.warn("Unable to make request without an SDK key"),!1)},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={K:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},xt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.St=i.Mt=i.Dt=i.Et=i.Pt=i.kt=void 0;i.kt=()=>"undefined"!=typeof window?window:null,i.Pt=()=>{var t=(0,i.kt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Et=()=>null!=(0,i.Pt)(),i.Dt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.Mt=(t,e)=>{var n=(0,i.Pt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.St=()=>{var t;try{return null==(t=(0,i.kt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(832),u=n(780),l=n(444),a=n(556),c=18e5,d=144e5,h={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function _(t){return"statsig.session_id."+(0,i.DJB2)(t)}e.SessionID={get:t=>r(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:o=>r(void 0,void 0,void 0,function*(){null==h[o]&&(h[o]=function(n){return r(this,void 0,void 0,function*(){let t=yield function(t){t=_(t);return(0,l.N)(t)}(n);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:n}})}(o));var t=yield h[o],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>c}(n)||function({startTime:t}){return Date.now()-t>d}(n))&&(n.sessionID=(0,a.getUUID)(),n.startTime=e),n.lastUpdate=e,n),s=t.sdkKey;return s=_(s),(0,l.G)(s,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=v(n,c),t.ageTimeoutID=v(n,d-e),t})}},604:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StableID=void 0;const s=n(832),o=n(780),r=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,s.DJB2)(t)}function c(t,e){e=a(e);(0,r.G)(e,t).catch(()=>{o.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,r.N)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(496);const l=n(496),a=n(512),c=n(728),d=n(780),h=n(48),v=n(604),_=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Ft={};var s,o=this.$emt.bind(this),r=(0,l.i)(),u=null!=(u=r.instances)?u:{};null!=i&&i.logLevel&&(d.Log.level=null==i?void 0:i.logLevel),null!=i&&i.disableStorage&&_.Storage.Ut(!0),null!=i&&i.overrideStableID&&v.StableID.setOverride(i.overrideStableID,t),this.l=new a.ErrorBoundary(t,i,o),this.l.wrap(this),this.l.wrap(n),this.l.wrap(e),this.h=t,this.J=null!=i?i:{},this.Kt=null!=(s=null==i?void 0:i.overrideAdapter)?s:null,this.Lt=new c.EventLogger(t,o,n,i),null!=u[t]&&(0,h.Et)()&&d.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),u[t]=this,r.lastInstance=this,r.instances=u,__STATSIG__=r,this.dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Lt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,_.Storage.Ut(t.disableStorage))}flush(){return this.Lt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Lt.shutdown()})}on(t,e){this.Ft[t]||(this.Ft[t]=[]),this.Ft[t].push(e)}off(t,e){this.Ft[t]&&-1!==(e=this.Ft[t].indexOf(e))&&this.Ft[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.l.logError("__emit:"+n.name,t):d.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Ft[n.name]&&this.Ft[n.name].forEach(t=>e(t)),null!=(t=this.Ft["*"])&&t.forEach(e)}Jt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Vt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Lt.incrementNonExposureCount(t):this.Lt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.qt=e.zt=e.Bt=e.ht=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,s)=>({eventName:t,user:e,value:null,metadata:o(n,i),secondaryExposures:s,time:Date.now()});e.ht=({eventName:t})=>t===i||t===n,e.Bt=(t,e)=>{return l(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.zt=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.qt=(t,e,n)=>{var i,s=e.__evaluation,o=!0===(null==(o=null==s?void 0:s.explicit_parameters)?void 0:o.includes(n));let r="",u=null!=(i=null==s?void 0:s.undelegated_secondary_exposures)?i:[];return o&&(r=null!=(i=s.allocated_experiment_name)?i:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(o)},u)};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.39";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.$t=e.Ht=e.Yt=e.Wt=void 0;const s="default";function o(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:s,__evaluation:n,value:i}}function r(o,r){return(t,e)=>{var n,i,s=null!=(s=null==o?void 0:o[t])?s:null;return null==s||null!=e&&(n=e,(i=t=>Array.isArray(t)?"array":typeof t)(s)!==i(n))?null!=e?e:null:(null!=r&&r(t),s)}}e.Wt=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.Yt=function(t,e,n){return $P($P({},o(t,e,n,null!=(t=null==n?void 0:n.value)?t:{})),{groupName:null,get:r(null==n?void 0:n.value)})},e.Ht=function(t,e,n,i){return $P($P({},o(t,e,n,void 0)),{get:r(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.$t=function(t,e,n,i){return $P($P($P({},t),e),{get:r(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e,n)=>{$Q(e),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||$A(),n=($Q(e),e.G=e.N=e.Storage=void 0,n(780));const s={},o=t=>Promise.resolve(t),r={Qt:()=>"InMemory",D(t){return null!=(t=s[t])?t:null},Xt(t){return o(null!=(t=s[t])?t:null)},P(t,e){return s[t]=e,o()},C(t){return delete s[t],o()},Zt(){return o(Object.keys(s))}};let u=null;try{"undefined"!=typeof window&&"localStorage"in window&&(u={Qt:()=>"LocalStorage",D(t){return localStorage.getItem(t)},Xt(t){return o(localStorage.getItem(t))},P(t,e){return localStorage.setItem(t,e),o()},C(t){return localStorage.removeItem(t),o()},Zt(){var t=Object.keys(localStorage);return o(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let l=null!==u&&void 0!==u?u:r,a=l;e.Storage={Qt:()=>a.Qt(),Xt:t=>a.Xt(t),P:(t,e)=>a.P(t,e),C:t=>a.C(t),Zt:()=>a.Zt(),D:t=>{var e;return null!=(e=null==(e=a.D)?void 0:e.call(a,t))?e:null},te:t=>{l=t,a=t},Ut:t=>{a=t?r:l}},e.N=function(e){return i(this,void 0,void 0,function*(){var t=yield a.Xt(e);return JSON.parse(null!=t?t:"null")})},e.G=function(t,e){return i(this,void 0,void 0,function*(){yield a.P(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),e.typedJsonParse=void 0;const s=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 s.Log.error(n),null}},556:(t,e)=>{$Q(e),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)=>{$Q(e),e.et=void 0,e.et=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.ee=e.it=e._t=void 0;n=n(48);const i="foreground",s="background",o=[];let r=i;e._t=()=>r===i,e.it=t=>{o.unshift(t)};e.ee=e=>{e!==r&&(r=e,o.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>(0,e.ee)(i)),(0,n.Dt)("blur",()=>(0,e.ee)(s)),(0,n.Dt)("beforeunload",()=>(0,e.ee)(s)),(0,n.Mt)("visibilitychange",()=>{(0,e.ee)("visible"===document.visibilityState?i:s)})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,n(496);const o=n(728),r=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),n(780));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=n(972);const l=n(444);Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return l.Storage}});var a=n(556);s(n(496),e),s(n(856),e),s(n(320),e),s(n(184),e),s(n(512),e),s(n(500),e),s(n(788),e),s(n(832),e),s(n(664),e),s(n(780),e),s(n(188),e),s(n(716),e),s(n(264),e),s(n(48),e),s(n(360),e),s(n(612),e),s(n(604),e),s(n(688),e),s(n(808),e),s(n(283),e),s(n(876),e),s(n(972),e),s(n(384),e),s(n(396),e),s(n(136),e),s(n(296),e),s(n(444),e),s(n(412),e),s(n(84),e),s(n(539),e),s(n(556),e),s(n(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:o.EventLogger,Log:r.Log,getUUID:a.getUUID,Storage:l.Storage,SDK_VERSION:u.SDK_VERSION})},696:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),s(n(208),e),e.default=__STATSIG__},96:(t,e,n)=>{$Q(e),e.resolveDeltasResponse=void 0;const i=n(464);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.resolveDeltasResponse=function(t,e){var n;return(e=(0,i.typedJsonParse)(e,"checksum","Failed to parse DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),n.dynamic_configs)}),s((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.DJB2Object)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs}))===e.checksum?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},536:(t,e,n)=>{$Q(e);const i=n(464);e.default=class{constructor(){this.ne=null,this.ie=null,this.oe="Uninitialized",this.se=0,this.re=0}getValues(){return this.ne?(0,i.typedJsonParse)(this.ne,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.ie=null,this.ne=null,this.oe="Loading",this.se=0,this.re=0}finalize(){this.ie||(this.oe="NoValues")}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,i.typedJsonParse)(t.data,"has_updates","Failed to parse EvaluationResponse"))?void 0:e.has_updates)&&(this.ne=t.data,this.se=e.time,this.re=t.receivedAt,this.oe=t.source,this.ie=e)}getGate(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.feature_gates[t])?e:null;return this.ue(t)}getConfig(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.dynamic_configs[t])?e:null;return this.ue(t)}getLayer(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.layer_configs[t])?e:null;return this.ue(t)}ue(t){return{evaluation:t,details:this.le(null==t)}}le(t){return"Uninitialized"===this.oe||"NoValues"===this.oe?{reason:this.oe}:{reason:this.oe+":"+(t?"Unrecognized":"Recognized"),lcut:this.se,receivedAt:this.re}}}},400:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const u=n(464),l=n(96);class i extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.ae=(0,u.et)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(n,i,s,o){return r(this,void 0,void 0,function*(){var t=i?(0,u.typedJsonParse)(i,"has_updates","Failed to parse cached EvaluationResponse"):null;let e={user:o,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.ce(n,t,e,s)})}ce(e,n,i,s){var o;return r(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.ae,data:i,retries:2,isStatsigEncodable:!0,priority:s});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(o=null==t?void 0:t.body)?o:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(o=t.body)?void 0:o.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,l.resolveDeltasResponse)(n,t.body))?t:this.ce(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}),s)})}}e.default=i},520:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e);const r=n(464),o=n(536),u=n(400),l=n(364);class i extends r.StatsigClientBase{static instance(t){var e=(0,r.i)().instance(t);return e instanceof i?e:(r.Log.warn("Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){r.SDKType.At(t,"javascript-client");var i=new u.default(n,t=>{this.$emt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,i,n),this.de=new o.default,this.he=e}initializeSync(){this.updateUserSync(this.he)}initializeAsync(t){return this.updateUserAsync(this.he,t)}updateUserSync(t){this.ve(t);t=this.dataAdapter.getDataSync(this.he);this.de.setValuesFromDataAdapter(t),this.de.finalize(),this.Jt("Ready",t),this._e(null!=t?t:null,this.he)}updateUserAsync(n,i){return s(this,void 0,void 0,function*(){this.ve(n);var t=this.he,e=this.dataAdapter.getDataSync(t);this.Jt("Loading",e),this.de.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.he&&this.de.setValuesFromDataAdapter(e),this.de.finalize(),this.Jt("Ready",e)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.de.getValues(),user:JSON.parse(JSON.stringify(this.he)),errorBoundary:this.l}}getAsyncContext(){return s(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield r.StatsigSession.get(this.h),stableID:yield r.StableID.get(this.h)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,r.DJB2)(t),{evaluation:n,details:i}=this.de.getGate(n),i=(0,r.Wt)(t,i,n),s=null==(s=null==(n=this.Kt)?void 0:n.getGateOverride)?void 0:s.call(n,i,this.he,e),n=null!=s?s:i;return this.Vt(t,(0,r.Bt)(this.he,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.fe("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.fe("experiment",t,e);return this.$emt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n){var t=(0,r.DJB2)(e),{evaluation:t,details:i}=this.de.getLayer(t),i=(0,r.Ht)(e,i,t),s=null==(s=null==(t=this.Kt)?void 0:t.getLayerOverride)?void 0:s.call(t,i,this.he,n);const o=(0,r.$t)(i,s,null!=(t=null==s?void 0:s.__value)?t:i.__value,t=>{this.Vt(e,(0,r.qt)(this.he,o,t),n)});return this.$emt({name:"layer_evaluation",layer:o}),o}logEvent(t,e,n){this.Lt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.he,time:Date.now()}))}_e(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{r.Log.error("An error occurred after update.",t)})}ve(t){this.Lt.reset(),this.de.reset(),this.he=(0,r.normalizeUser)(t,this.J.environment)}fe(t,e,n){var i=(0,r.DJB2)(e),{evaluation:i,details:s}=this.de.getConfig(i),s=(0,r.Yt)(e,s,i),i="experiment"===t?null==(t=null==(i=this.Kt)?void 0:i.getExperimentOverride)?void 0:t.call(i,s,this.he,n):null==(i=null==(t=this.Kt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,s,this.he,n),t=null!=i?i:s;return this.Vt(e,(0,r.zt)(this.he,t),n),t}}e.default=i},364:function(t,e,n){var o=this&&this.__awaiter||$A(),i=($Q(e),e.StatsigEvaluationsDataAdapter=void 0,n(464));const s=n(400);class r extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.L=null}attach(t,e){super.attach(t,e),this.L=new s.default(null!=e?e:{})}getDataAsync(t,e,n){return this.O(t,e,n)}prefetchData(t,e){return this.T(t,e)}I(e,n,i){var s;return o(this,void 0,void 0,function*(){var t=yield null==(s=this.L)?void 0:s.fetchEvaluations(this.M(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=r},208:(t,e,n)=>{$Q(e),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var i=n(520);e.StatsigClient=i.default;const s=n(364);Object.defineProperty(e,"StatsigEvaluationsDataAdapter",{enumerable:!0,get:function(){return s.StatsigEvaluationsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:s.StatsigEvaluationsDataAdapter,StatsigClient:i.default}),e.default=__STATSIG__}},i={};function s(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,s)),e.exports}return s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s(696).default})());

@@ -1,1 +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.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $P = (a,b) => Object.assign(a,b);var n={496:(t,e,n)=>{$Q(e),e.t=e.i=void 0,e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:u;e.t=t=>{var e;return t?null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t]:null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.lastInstance};var i,o="__STATSIG__",r="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},s="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=r[o])?i:n[o])?i:s[o])?i:{instance:e.t};r[o]=u,n[o]=u,s[o]=u},856:(t,e)=>{$Q(e)},320:function(t,e,n){var r=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};$Q(e),e.DataAdapterCore=void 0;const i=n(512),s=n(780),o=n(283),u=n(296),l=n(444),a=n(412);e.DataAdapterCore=class{constructor(t,e){this.o=t,this.u=e,this.l=null,this.h=null,this.v={},this._="statsig.last_modified_time."+e}attach(t,e){this.h=t,this.l=new i.ErrorBoundary(t)}getDataSync(t){var t=this.m(t),e=this.v[t];return e||((e=this.p(t))?(this.S(t,e),this.v[t]):null)}setData(t,e){e=this.m(e);this.S(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.v=$P($P({},this.v),t)}O(e,n,i){var o;return r(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.j(null!=(o=null==t?void 0:t.data)?o:null,n)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(s.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}T(n,i){return r(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.O(null,n,i);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}j(i,o){return r(this,void 0,void 0,function*(){var t=yield this.I(i,o);if(!t)return s.Log.debug("No response returned for latest value"),null;var e=(0,a.typedJsonParse)(t,"has_updates","Failure while attempting to persist latest value");let n=null;return!0===(null==e?void 0:e.has_updates)?n={source:"Network",data:t,receivedAt:Date.now()}:i&&!1===(null==e?void 0:e.has_updates)&&(n={source:"NetworkNotModified",data:i,receivedAt:Date.now()}),n?(t=this.m(o),this.S(t,n),yield this.A(t,n),n):null})}M(){return null!=this.h?this.h:(s.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,u.getUserStorageKey)(this.M(),t);return`${o.DataAdapterCachePrefix}.${this.u}.`+t}S(t,e){var n=Object.entries(this.v);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.v[n]),this.v[t]=e}p(t){var e=null==(e=l.Storage.D)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,a.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}A(t,e){return r(this,void 0,void 0,function*(){yield l.Storage.P(t,JSON.stringify(e)),yield this.k(t)})}k(n){var i;return r(this,void 0,void 0,function*(){var t=null!=(i=yield(0,l.N)(this._))?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.C(e[0])),yield(0,l.G)(this._,t)})}}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var n=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(360),a=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t,e){this.h=t,this.F=e,this.R=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(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)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.capture(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.U("eb:wrap",t)}}capture(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.U(e,t)):n}catch(t){return this.U(e,t),null}}logError(t,e){this.U(t,e)}U(r,s){try{i.Log.warn("Caught error in "+r,{error:s});n(this,void 0,void 0,function*(){var t,e,n=null!=s?s:Error("[Statsig] Error was empty"),i=n instanceof Error,o=i?n.name:"No Name";this.R.has(o)||(this.R.add(o),t=l.SDKType.K(this.h),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(n),n=JSON.stringify($P({tag:r,exception:o,info:i},$P($P({},e),{sdkType:t}))),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.h,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(o=this.F)&&o.call(this,{name:"error",error:s}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,n){var i=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};$Q(e),e.EventLogger=void 0;const o=n(832),r=n(780),s=n(716),u=n(48),l=n(876),a=n(444),c=n(412),d=n(84),h=n(100),v={},_=t=>{null!=(t=v[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this.h=e,this.F=t,this.L=n,this.J=i,this.V=[],this.q={},this.B={},this.$=!1,this.H=Date.now(),(v[e]=this).Y=!0===(null==i?void 0:i.disableLogging),this.W=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;t=null!=(n=null==i?void 0:i.loggingIntervalMs)?n:1e4;const o=setInterval(()=>{v[e]?_(e):clearInterval(o)},t);this.X=o;n=null==i?void 0:i.networkConfig;this.tt=(0,d.et)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",s.NetworkDefault.eventsApi),this.nt=(0,d.et)(null==n?void 0:n.logEventBeaconUrl,null==n?void 0:n.api,"/log_event_beacon",s.NetworkDefault.eventsApi),(0,h.it)(t=>{"background"===t&&_(e)}),this.st()}setLoggingDisabled(t){this.Y=t}enqueue(t){this.rt(t)&&(this.ut(t),this.lt(),this.V.length>this.W)&&_(this.h)}incrementNonExposureCount(t){var e=null!=(e=this.B[t])?e:0;this.B[t]=e+1}reset(){this.q={}}shutdown(){return i(this,void 0,void 0,function*(){this.X&&(clearInterval(this.X),this.X=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.ct(),0!==this.V.length&&(t=this.V,this.V=[],yield this.dt(t))})}lt(){this.$||(this.$=!0,200<Date.now()-this.H)||setTimeout(()=>_(this.h),200)}rt(t){if((0,l.ht)(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.q[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.q).length&&(this.q={}),this.q[t]=n}return!0}dt(t){return i(this,void 0,void 0,function*(){if(this.Y)this.vt(t);else try{(!(0,h._t)()&&this.L.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.F({name:"logs_flushed",events:t}):this.vt(t)}catch(t){r.Log.warn("Failed to flush events.")}})}gt(e){return i(this,void 0,void 0,function*(){var t=yield this.L.post({sdkKey:this.h,data:{events:e},url:this.tt,retries:3,params:{[s.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,c.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.L.beacon({sdkKey:this.h,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,a.G)(e,t).catch(()=>{r.Log.warn("Unable to save failed logs to storage")})}st(){const e=this.bt();i(this,void 0,void 0,function*(){var t=yield(0,a.N)(e);t&&(yield a.Storage.C(e),yield this.dt(t))}).catch(()=>{r.Log.warn("Failed to flush stored logs")})}bt(){return"statsig.failed_logs."+(0,o.DJB2)(this.h)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.yt();n&&(e.statsigMetadata={currentPage:n}),this.V.push($P($P({},t),e))}ct(){0!==Object.keys(this.B).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.B)}}),this.B={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.St)()}}},832:(t,e)=>{$Q(e),e.DJB2Object=e.DJB2=void 0;e.DJB2=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)};e.DJB2Object=t=>(0,e.DJB2)(JSON.stringify(o(t)));const o=n=>{if(null==n)return null;var t=Object.keys(n).sort();const i={};return t.forEach(t=>{let e=n[t];e instanceof Object&&(e=o(e)),i[t]=e}),i}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,o;$Q(e),e.Log=e.LogLevel=void 0,(o=i||(e.LogLevel=i={}))[o.None=0]="None",o[o.Error=1]="Error",o[o.Warn=2]="Warn",o[o.Info=3]="Info",o[o.Debug=4]="Debug";class r{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=r).level=i.Error},716:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se"}},188:function(t,e,n){var i=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};$Q(e),e.NetworkCore=void 0,n(496);const h=n(280),v=n(780),o=n(716),r=n(360),s=n(612),u=n(604),l=n(972);e.NetworkCore=class{constructor(t,e){this.J=t,this.F=e,this.Ot=null!=(t=null==(e=null==t?void 0:t.networkConfig)?void 0:e.networkTimeoutMs)?t:1e4}post(e){return i(this,void 0,void 0,function*(){var t=yield this.jt(e);return this.Tt($P({method:"POST",body:this.wt(e,t)},e))})}get(t){return this.Tt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return i(this,void 0,void 0,function*(){var t,e;return!!_(n)&&(t=yield this.It(n),e=yield this.jt(n),navigator.sendBeacon(t,e))})}Tt(c){var d;return i(this,void 0,void 0,function*(){if(!_(c))return null;var{method:e,body:n,retries:i}=c;const o=new AbortController;var t=setTimeout(()=>o.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),r=yield this.It(c),s=null;try{var u,l,a,s=yield fetch(r,{method:e,body:n,headers:$P({},c.headers),signal:o.signal});if(clearTimeout(t),s.ok)return a=yield s.text(),h.Diagnostics.mark(),{body:a,code:s.status};throw u=yield s.text().catch(()=>"No Text"),(l=new Error(`Failed to fetch: ${r} `+u)).name="NetworkError",l}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}(o,t);return h.Diagnostics.mark(),!i||i<=0?(null!=(d=this.F)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${r}.`,n,t),null):this.Tt($P($P({},c),{retries:i-1}))}})}It(e){return i(this,void 0,void 0,function*(){var t=$P({[o.NetworkParam.SdkKey]:e.sdkKey,[o.NetworkParam.SdkType]:r.SDKType.K(e.sdkKey),[o.NetworkParam.SdkVersion]:l.SDK_VERSION,[o.NetworkParam.Time]:String(Date.now()),[o.NetworkParam.SessionID]:yield s.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}jt(o){return i(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=o,n=yield u.StableID.get(e),i=yield s.SessionID.get(e),e=r.SDKType.K(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},l.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}wt(t,e){var n;return!(null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(n=this.J)&&n.disableStatsigEncoding)&&t.isStatsigEncodable&&"undefined"!=typeof window&&window.btoa&&(t.params=$P($P({},null!=(n=t.params)?n:{}),{[o.NetworkParam.StatsigEncoded]:"1"}),null!=(t=window.btoa(e).split("").reverse().join("")))?t:e}};const _=t=>!!t.sdkKey||(v.Log.warn("Unable to make request without an SDK key"),!1)},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={K:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},xt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.St=i.Mt=i.Dt=i.Et=i.Pt=i.kt=void 0;i.kt=()=>"undefined"!=typeof window?window:null,i.Pt=()=>{var t=(0,i.kt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Et=()=>null!=(0,i.Pt)(),i.Dt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.Mt=(t,e)=>{var n=(0,i.Pt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.St=()=>{var t;try{return null==(t=(0,i.kt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,e,n){var s=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(832),u=n(780),l=n(444),a=n(556),c=18e5,d=144e5,h={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function _(t){return"statsig.session_id."+(0,i.DJB2)(t)}e.SessionID={get:t=>s(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:r=>s(void 0,void 0,void 0,function*(){null==h[r]&&(h[r]=function(n){return s(this,void 0,void 0,function*(){let t=yield function(t){t=_(t);return(0,l.N)(t)}(n);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:n}})}(r));var t=yield h[r],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>c}(n)||function({startTime:t}){return Date.now()-t>d}(n))&&(n.sessionID=(0,a.getUUID)(),n.startTime=e),n.lastUpdate=e,n),o=t.sdkKey;return o=_(o),(0,l.G)(o,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=v(n,c),t.ageTimeoutID=v(n,d-e),t})}},604:function(t,e,n){var i=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};$Q(e),e.StableID=void 0;const o=n(832),r=n(780),s=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,o.DJB2)(t)}function c(t,e){e=a(e);(0,s.G)(e,t).catch(()=>{r.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,s.N)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};$Q(e),e.StatsigClientBase=void 0,n(496);const l=n(496),a=n(512),c=n(728),d=n(780),h=n(48),v=n(604),_=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Ft={};var o,r=this.$emt.bind(this),s=(0,l.i)(),u=null!=(u=s.instances)?u:{};null!=i&&i.logLevel&&(d.Log.level=null==i?void 0:i.logLevel),null!=i&&i.disableStorage&&_.Storage.Ut(!0),null!=i&&i.overrideStableID&&v.StableID.setOverride(i.overrideStableID,t),this.l=new a.ErrorBoundary(t,r),this.l.wrap(this),this.l.wrap(n),this.l.wrap(e),this.h=t,this.J=null!=i?i:{},this.Kt=null!=(o=null==i?void 0:i.overrideAdapter)?o:null,this.Lt=new c.EventLogger(t,r,n,i),null!=u[t]&&(0,h.Et)()&&d.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),u[t]=this,s.lastInstance=this,s.instances=u,__STATSIG__=s,this.dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Lt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,_.Storage.Ut(t.disableStorage))}flush(){return this.Lt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Lt.shutdown()})}on(t,e){this.Ft[t]||(this.Ft[t]=[]),this.Ft[t].push(e)}off(t,e){this.Ft[t]&&-1!==(e=this.Ft[t].indexOf(e))&&this.Ft[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.l.logError("__emit:"+n.name,t):d.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Ft[n.name]&&this.Ft[n.name].forEach(t=>e(t)),null!=(t=this.Ft["*"])&&t.forEach(e)}Jt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Vt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Lt.incrementNonExposureCount(t):this.Lt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.qt=e.zt=e.Bt=e.ht=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,o)=>({eventName:t,user:e,value:null,metadata:r(n,i),secondaryExposures:o,time:Date.now()});e.ht=({eventName:t})=>t===i||t===n,e.Bt=(t,e)=>{return l(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.zt=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.qt=(t,e,n)=>{var i,o=e.__evaluation,r=!0===(null==(r=null==o?void 0:o.explicit_parameters)?void 0:r.includes(n));let s="",u=null!=(i=null==o?void 0:o.undelegated_secondary_exposures)?i:[];return r&&(s=null!=(i=o.allocated_experiment_name)?i:"",u=o.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:s,isExplicitParameter:String(r)},u)};const r=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.38";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.$t=e.Ht=e.Yt=e.Wt=void 0;const o="default";function r(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:o,__evaluation:n,value:i}}function s(r,s){return(t,e)=>{var n,i,o=null!=(o=null==r?void 0:r[t])?o:null;return null==o||null!=e&&(n=e,(i=t=>Array.isArray(t)?"array":typeof t)(o)!==i(n))?null!=e?e:null:(null!=s&&s(t),o)}}e.Wt=function(t,e,n){return r(t,e,n,!0===(null==n?void 0:n.value))},e.Yt=function(t,e,n){return $P($P({},r(t,e,n,null!=(t=null==n?void 0:n.value)?t:{})),{groupName:null,get:s(null==n?void 0:n.value)})},e.Ht=function(t,e,n,i){return $P($P({},r(t,e,n,void 0)),{get:s(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.$t=function(t,e,n,i){return $P($P($P({},t),e),{get:s(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e,n)=>{$Q(e),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,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})},n=($Q(e),e.G=e.N=e.Storage=void 0,n(780));const o={},r={Qt:()=>"InMemory",D(t){return null!=(t=o[t])?t:null},Xt(t){return Promise.resolve(null!=(t=o[t])?t:null)},P(t,e){return o[t]=e,Promise.resolve()},C(t){return delete o[t],Promise.resolve()},Zt(){return Promise.resolve(Object.keys(o))}};let s=null;try{"undefined"!=typeof window&&"localStorage"in window&&(s={Qt:()=>"LocalStorage",D(t){return localStorage.getItem(t)},Xt(t){return Promise.resolve(localStorage.getItem(t))},P(t,e){return localStorage.setItem(t,e),Promise.resolve()},C(t){return localStorage.removeItem(t),Promise.resolve()},Zt(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==s&&void 0!==s?s:r,l=u;e.Storage={Qt:()=>l.Qt(),Xt:t=>l.Xt(t),P:(t,e)=>l.P(t,e),C:t=>l.C(t),Zt:()=>l.Zt(),D:t=>{var e;return null!=(e=null==(e=l.D)?void 0:e.call(l,t))?e:null},te:t=>{u=t,l=t},Ut:t=>{l=t?r:u}},e.N=function(e){return i(this,void 0,void 0,function*(){var t=yield l.Xt(e);return JSON.parse(null!=t?t:"null")})},e.G=function(t,e){return i(this,void 0,void 0,function*(){yield l.P(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),e.typedJsonParse=void 0;const o=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 o.Log.error(n),null}},556:(t,e)=>{$Q(e),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)=>{$Q(e),e.et=void 0,e.et=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.ee=e.it=e._t=void 0;n=n(48);const i="foreground",o="background",r=[];let s=i;e._t=()=>s===i,e.it=t=>{r.unshift(t)};e.ee=e=>{e!==s&&(s=e,r.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>(0,e.ee)(i)),(0,n.Dt)("blur",()=>(0,e.ee)(o)),(0,n.Dt)("beforeunload",()=>(0,e.ee)(o)),(0,n.Mt)("visibilitychange",()=>{(0,e.ee)("visible"===document.visibilityState?i:o)})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&("get"in o?e.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,o)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,n(496);const r=n(728),s=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return r.EventLogger}}),n(780));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return s.Log}});var u=n(972);const l=n(444);Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return l.Storage}});var a=n(556);o(n(496),e),o(n(856),e),o(n(320),e),o(n(184),e),o(n(512),e),o(n(500),e),o(n(788),e),o(n(832),e),o(n(664),e),o(n(780),e),o(n(188),e),o(n(716),e),o(n(264),e),o(n(48),e),o(n(360),e),o(n(612),e),o(n(604),e),o(n(688),e),o(n(808),e),o(n(283),e),o(n(876),e),o(n(972),e),o(n(384),e),o(n(396),e),o(n(136),e),o(n(296),e),o(n(444),e),o(n(412),e),o(n(84),e),o(n(539),e),o(n(556),e),o(n(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:r.EventLogger,Log:s.Log,getUUID:a.getUUID,Storage:l.Storage,SDK_VERSION:u.SDK_VERSION})},920:(t,e,n)=>{$Q(e),e.AutoInit=void 0;const d=n(464),h=n(208);function v(t,e){var n;return null!=(n=e.get(t))?n:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,n,i;try{var o=(0,d.kt)(),r=(0,d.Pt)();if(o&&r&&r.currentScript){var s=r.currentScript.getAttribute("src"),u=null==(t=o.location)?void 0:t.href;if(s&&u){var l=new URL(s,u).searchParams,a=null!=(n=v("sdkKey",l))?n:v("apiKey",l);if(a){var c=null==(i=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:i[a];let t=null;(t=c instanceof h.StatsigClient?c:t)||(t=new h.StatsigClient(a,{})).initializeAsync().catch(t=>{d.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){d.Log.error("AutoInit failed",t)}}}},96:(t,e,n)=>{$Q(e),e.resolveDeltasResponse=void 0;const i=n(464);function o(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.resolveDeltasResponse=function(t,e){var n;return(e=(0,i.typedJsonParse)(e,"checksum","Failed to parse DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),n.dynamic_configs)}),o((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,o(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,o(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.DJB2Object)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs}))===e.checksum?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},156:(t,e,n)=>{$Q(e);const i=n(464);e.default=class{constructor(){this.ne=null,this.ie=null,this.oe="Uninitialized",this.se=0,this.re=0}getValues(){return this.ne?(0,i.typedJsonParse)(this.ne,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.ie=null,this.ne=null,this.oe="Loading",this.se=0,this.re=0}finalize(){this.ie||(this.oe="NoValues")}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,i.typedJsonParse)(t.data,"has_updates","Failed to parse EvaluationResponse"))?void 0:e.has_updates)&&(this.ne=t.data,this.se=e.time,this.re=t.receivedAt,this.oe=t.source,this.ie=e)}getGate(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.feature_gates[t])?e:null;return this.ue(t)}getConfig(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.dynamic_configs[t])?e:null;return this.ue(t)}getLayer(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.layer_configs[t])?e:null;return this.ue(t)}ue(t){return{evaluation:t,details:this.le(null==t)}}le(t){return"Uninitialized"===this.oe||"NoValues"===this.oe?{reason:this.oe}:{reason:this.oe+":"+(t?"Unrecognized":"Recognized"),lcut:this.se,receivedAt:this.re}}}},400:function(t,e,n){var r=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};$Q(e);const s=n(464),u=n(96);class i extends s.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.ae=(0,s.et)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",s.NetworkDefault.initializeApi)}fetchEvaluations(n,i,o){return r(this,void 0,void 0,function*(){var t=i?(0,s.typedJsonParse)(i,"has_updates","Failed to parse cached EvaluationResponse"):null;let e={user:o,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.ce(n,t,e)})}ce(e,n,i){var o;return r(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.ae,data:i,retries:2,isStatsigEncodable:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(o=null==t?void 0:t.body)?o:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(o=t.body)?void 0:o.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,u.resolveDeltasResponse)(n,t.body))?t:this.ce(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}))})}}e.default=i},520:function(t,e,n){var o=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};$Q(e);const s=n(464),r=n(156),u=n(400),l=n(364);class i extends s.StatsigClientBase{static instance(t){var e=(0,s.i)().instance(t);return e instanceof i?e:(s.Log.warn("Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){s.SDKType.At(t,"javascript-client");var i=new u.default(n,t=>{this.$emt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,i,n),this.de=new r.default,this.he=e}initializeSync(){this.updateUserSync(this.he)}initializeAsync(t){return this.updateUserAsync(this.he,t)}updateUserSync(t){this.ve(t);t=this.dataAdapter.getDataSync(this.he);this.de.setValuesFromDataAdapter(t),this.de.finalize(),this.Jt("Ready",t),this._e(null!=t?t:null,this.he)}updateUserAsync(n,i){return o(this,void 0,void 0,function*(){this.ve(n);var t=this.he,e=this.dataAdapter.getDataSync(t);this.Jt("Loading",e),this.de.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.he&&this.de.setValuesFromDataAdapter(e),this.de.finalize(),this.Jt("Ready",e)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.de.getValues(),user:JSON.parse(JSON.stringify(this.he)),errorBoundary:this.l}}getAsyncContext(){return o(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield s.StatsigSession.get(this.h),stableID:yield s.StableID.get(this.h)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,s.DJB2)(t),{evaluation:n,details:i}=this.de.getGate(n),i=(0,s.Wt)(t,i,n),o=null==(o=null==(n=this.Kt)?void 0:n.getGateOverride)?void 0:o.call(n,i,this.he,e),n=null!=o?o:i;return this.Vt(t,(0,s.Bt)(this.he,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.fe("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.fe("experiment",t,e);return this.$emt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n){var t=(0,s.DJB2)(e),{evaluation:t,details:i}=this.de.getLayer(t),i=(0,s.Ht)(e,i,t),o=null==(o=null==(t=this.Kt)?void 0:t.getLayerOverride)?void 0:o.call(t,i,this.he,n);const r=(0,s.$t)(i,o,null!=(t=null==o?void 0:o.__value)?t:i.__value,t=>{this.Vt(e,(0,s.qt)(this.he,r,t),n)});return this.$emt({name:"layer_evaluation",layer:r}),r}logEvent(t,e,n){this.Lt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.he,time:Date.now()}))}_e(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{s.Log.error("An error occurred after update.",t)})}ve(t){this.Lt.reset(),this.de.reset(),this.he=(0,s.normalizeUser)(t,this.J.environment)}fe(t,e,n){var i=(0,s.DJB2)(e),{evaluation:i,details:o}=this.de.getConfig(i),o=(0,s.Yt)(e,o,i),i="experiment"===t?null==(t=null==(i=this.Kt)?void 0:i.getExperimentOverride)?void 0:t.call(i,o,this.he,n):null==(i=null==(t=this.Kt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,o,this.he,n),t=null!=i?i:o;return this.Vt(e,(0,s.zt)(this.he,t),n),t}}e.default=i},364:function(t,e,n){var o=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})},i=($Q(e),e.StatsigEvaluationsDataAdapter=void 0,n(464));const r=n(400);class s extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.L=null}attach(t,e){super.attach(t,e),this.L=new r.default(null!=e?e:{})}getDataAsync(t,e,n){return this.O(t,e,n)}prefetchData(t,e){return this.T(t,e)}I(e,n){var i;return o(this,void 0,void 0,function*(){var t=yield null==(i=this.L)?void 0:i.fetchEvaluations(this.M(),e,n);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=s},208:(t,e,n)=>{$Q(e),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var i=n(520);e.StatsigClient=i.default;const o=n(364);Object.defineProperty(e,"StatsigEvaluationsDataAdapter",{enumerable:!0,get:function(){return o.StatsigEvaluationsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:o.StatsigEvaluationsDataAdapter,StatsigClient:i.default}),e.default=__STATSIG__},536:function(t,e,n){var i=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const s=n(464),o=n(76);e.runStatsigAutoCapture=function(t){new r(t)};class r{constructor(t){this.ge=t,this.be=Date.now(),this.me=0;var e,{sdkKey:t,errorBoundary:n}=t.getContext(),n=(this.l=n,this.l.wrap(this),(0,s.Pt)());(0,s.Et)()&&((e=null!=(e=(__STATSIG__=(0,s.i)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.ye()):this.ye()}pe(){const e=(0,s.kt)();var t,n=(0,s.Pt)();e&&n&&(t=t=>{this.Se(t||e.event)},(0,o.Oe)(n,"click",t),(0,o.Oe)(n,"submit",t),(0,o.Oe)(e,"error",t),(0,o.Oe)(e,"beforeunload",()=>this.je()),(0,o.Oe)(e,"scroll",()=>this.Te()))}Se(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.we(t):(e=(0,o.Ie)(t))&&(0,o.rt)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,o.Ae)(e),this.xe(n,t,e))}ye(){this.pe(),this.Me(),this.De()}we(t){var e=(null==t?void 0:t.error)||{};let n=e;if("object"==typeof e)try{n=JSON.stringify(e)}catch(t){n="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.xe("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}Me(){setTimeout(()=>{var t,e=(0,o.Ee)();this.xe("page_view",(0,o.ke)(),{title:null==(t=(0,s.Pt)())?void 0:t.title,queryParams:Object.fromEntries(e.searchParams)},{flushImmediately:!0,addNewSessionMetadata:!0})},1)}De(){const n=(0,s.kt)();void 0!==(null===n||void 0===n?void 0:n.performance)&&"function"==typeof n.performance.getEntriesByType&&"function"==typeof n.performance.getEntriesByName&&setTimeout(()=>{var t={},e=n.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),n.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.xe("performance",(0,o.ke)(),t)},1)}je(){this.xe("page_view_end",(0,o.ke)(),{scrollDepth:this.me,pageViewLength:Date.now()-this.be},{flushImmediately:!0})}xe(n,i,o,r){this.tn().then(t=>{var e=$P({sessionID:t.data.sessionID,page_url:null!=(e=null==(e=null==(e=(0,s.kt)())?void 0:e.location)?void 0:e.href)?e:""},o),t=(null!=r&&r.addNewSessionMetadata&&(e.isNewSession=String(Math.abs(t.data.startTime-Date.now())<1e3)),{eventName:"auto_capture::"+n,value:i,metadata:e});this.ge.logEvent(t),null!=r&&r.flushImmediately&&this.ge.flush().catch(t=>{s.Log.error(t)})}).catch(t=>{this.l.logError("AC::enqueue",t)})}Te(){var t=null!=(t=null==(t=(0,s.Pt)())?void 0:t.body.scrollHeight)?t:1,e=(0,s.kt)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.me=Math.max(this.me,Math.min(100,Math.round((n+e)/t*100)))}tn(){return i(this,void 0,void 0,function*(){return(yield this.ge.getAsyncContext()).session})}}e.AutoCapture=r},76:(t,e,n)=>{$Q(e),e.Oe=e.ke=e.Ee=e.rt=e.Ie=e.Ae=void 0;const i=n(464);function r(e){if(e){let t=e;for(;t;){var n=t.tagName.toLowerCase();if(["body","document"].includes(n))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.Ae=function(t){var e=t.tagName.toLowerCase(),n={},i=e,o=("form"===e&&(n.action=t.getAttribute("action"),n.method=null!=(o=t.getAttribute("method"))?o:"GET",n.formName=t.getAttribute("name"),n.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(n.content=t.value,n.inputName=t.getAttribute("name")),"button"===e&&(n.content=(t.textContent||"").trim()),r(t));return o&&(n.href=o.getAttribute("href")),{value:i,metadata:n}},e.Ie=function(t){if(!t)return null;let e=t.target||t.srcElement;return e&&e instanceof Element?e=3===e.nodeType?e.parentNode||null:e:null},e.rt=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var n=e.tagName.toLowerCase(),i=t.type.toLowerCase();switch(n){case"html":return!1;case"form":return"submit"===i;case"input":case"select":case"textarea":return["change"].includes(i);default:if("click"===i){if("button"===n)return!0;if(r(e))return!0}return!1}},e.Ee=function(){var t=null!=(t=null==(t=null==(t=(0,i.kt)())?void 0:t.location)?void 0:t.href)?t:"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.ke=function(){return(0,i.St)()||""},e.Oe=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},824:(t,e,n)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(536);Object.defineProperty(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),Object.defineProperty(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return i.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture,runStatsigAutoCapture:i.runStatsigAutoCapture}),e.default=__STATSIG__}},i={};function o(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,o)),e.exports}o.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;const s=o(824);var r=o(920);e.default=__STATSIG__,r.AutoInit.attempt(({client:t})=>{new s.AutoCapture(t)})}return t.default})());
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $P=(a,b)=>Object.assign(a,b);var $A=()=>((t,r,u,l)=>{return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.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,o)}s((l=l.apply(t,r||[])).next())})});var n={496:(t,e,n)=>{$Q(e),e.t=e.i=void 0,e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:u;e.t=t=>{var e;return t?null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t]:null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.lastInstance};var i,r="__STATSIG__",o="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},s="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=o[r])?i:n[r])?i:s[r])?i:{instance:e.t};o[r]=u,n[r]=u,s[r]=u},856:(t,e)=>{$Q(e)},320:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const u=n(780),i=n(283),r=n(296),o=n(444),l=n(412);e.DataAdapterCore=class{constructor(t,e){this.o=t,this.u=e,this.h=null,this.v={},this._="statsig.last_modified_time."+e}attach(t,e){this.h=t}getDataSync(t){var t=this.m(t),e=this.v[t];return e||((e=this.p(t))?(this.S(t,e),this.v[t]):null)}setData(t,e){e=this.m(e);this.S(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.v=$P($P({},this.v),t)}O(e,n,i){var r;return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.en(null!=(r=null==t?void 0:t.data)?r:null,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}T(n,i){return s(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.O(null,n,i);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}en(i,r,o){return s(this,void 0,void 0,function*(){var t=yield this.I(i,r,o);if(!t)return u.Log.debug("No response returned for latest value"),null;var e=(0,l.typedJsonParse)(t,"has_updates","Failure while attempting to persist latest value");let n=null;return!0===(null==e?void 0:e.has_updates)?n={source:"Network",data:t,receivedAt:Date.now()}:i&&!1===(null==e?void 0:e.has_updates)&&(n={source:"NetworkNotModified",data:i,receivedAt:Date.now()}),n?(t=this.m(r),this.S(t,n),yield this.A(t,n),n):null})}M(){return null!=this.h?this.h:(u.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,r.getUserStorageKey)(this.M(),t);return`${i.DataAdapterCachePrefix}.${this.u}.`+t}S(t,e){var n=Object.entries(this.v);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.v[n]),this.v[t]=e}p(t){var e=null==(e=o.Storage.D)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,l.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}A(t,e){return s(this,void 0,void 0,function*(){yield o.Storage.P(t,JSON.stringify(e)),yield this.k(t)})}k(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,o.N)(this._))?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 o.Storage.C(e[0])),yield(0,o.G)(this._,t)})}}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var n=this&&this.__awaiter||$A();Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(360),a=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t,e,n){this.h=t,this.J=e,this.F=n,this.R=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(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)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.capture(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.U("eb:wrap",t)}}capture(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.U(e,t)):n}catch(t){return this.U(e,t),null}}logError(t,e){this.U(t,e)}U(o,s){try{i.Log.warn("Caught error in "+o,{error:s});n(this,void 0,void 0,function*(){var t,e,n=null!=s?s:Error("[Statsig] Error was empty"),i=n instanceof Error,r=i?n.name:"No Name";this.R.has(r)||(this.R.add(r),null!=(t=null==(t=this.J)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.F)&&t.call(this,{name:"error",error:s}):(t=l.SDKType.K(this.h),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(n),n=JSON.stringify($P({tag:o,exception:r,info:i},$P($P({},e),{sdkType:t}))),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.h,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(r=this.F)&&r.call(this,{name:"error",error:s})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=n(832),o=n(780),s=n(716),u=n(48),l=n(876),a=n(444),c=n(412),d=n(84),h=n(100),v={},_=t=>{null!=(t=v[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this.h=e,this.F=t,this.L=n,this.J=i,this.V=[],this.q={},this.B={},this.$=!1,this.H=Date.now(),(v[e]=this).Y=!0===(null==i?void 0:i.disableLogging),this.W=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;t=null!=(n=null==i?void 0:i.loggingIntervalMs)?n:1e4;const r=setInterval(()=>{v[e]?_(e):clearInterval(r)},t);this.X=r;n=null==i?void 0:i.networkConfig;this.tt=(0,d.et)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",s.NetworkDefault.eventsApi),this.nt=(0,d.et)(null==n?void 0:n.logEventBeaconUrl,null==n?void 0:n.api,"/log_event_beacon",s.NetworkDefault.eventsApi),(0,h.it)(t=>{"background"===t&&_(e)}),this.st()}setLoggingDisabled(t){this.Y=t}enqueue(t){this.rt(t)&&(this.ut(t),this.lt(),this.V.length>this.W)&&_(this.h)}incrementNonExposureCount(t){var e=null!=(e=this.B[t])?e:0;this.B[t]=e+1}reset(){this.q={}}shutdown(){return i(this,void 0,void 0,function*(){this.X&&(clearInterval(this.X),this.X=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.ct(),0!==this.V.length&&(t=this.V,this.V=[],yield this.dt(t))})}lt(){this.$||(this.$=!0,200<Date.now()-this.H)||setTimeout(()=>_(this.h),200)}rt(t){if((0,l.ht)(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.q[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.q).length&&(this.q={}),this.q[t]=n}return!0}dt(t){return i(this,void 0,void 0,function*(){if(this.Y)this.vt(t);else try{(!(0,h._t)()&&this.L.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.F({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){return i(this,void 0,void 0,function*(){var t=yield this.L.post({sdkKey:this.h,data:{events:e},url:this.tt,retries:3,params:{[s.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,c.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.L.beacon({sdkKey:this.h,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,a.G)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}st(){const e=this.bt();i(this,void 0,void 0,function*(){var t=yield(0,a.N)(e);t&&(yield a.Storage.C(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}bt(){return"statsig.failed_logs."+(0,r.DJB2)(this.h)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.yt();n&&(e.statsigMetadata={currentPage:n}),this.V.push($P($P({},t),e))}ct(){0!==Object.keys(this.B).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.B)}}),this.B={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.St)()}}},832:(t,e)=>{$Q(e),e.DJB2Object=e.DJB2=void 0;e.DJB2=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)};e.DJB2Object=t=>(0,e.DJB2)(JSON.stringify(r(t)));const r=n=>{if(null==n)return null;var t=Object.keys(n).sort();const i={};return t.forEach(t=>{let e=n[t];e instanceof Object&&(e=r(e)),i[t]=e}),i}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,r;$Q(e),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 o{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=o).level=i.Error},716:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se"}},188:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(496);const v=n(280),_=n(780),u=n(716),o=n(360),l=n(48),s=n(612),a=n(604),c=n(972);e.NetworkCore=class{constructor(t,e){this.J=t,this.F=e,this.Ot=null!=(t=null==(e=null==t?void 0:t.networkConfig)?void 0:e.networkTimeoutMs)?t:1e4}post(e){return i(this,void 0,void 0,function*(){var t=yield this.jt(e);return this.Tt($P({method:"POST",body:this.wt(e,t)},e))})}get(t){return this.Tt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return i(this,void 0,void 0,function*(){var t,e;return!!f(n)&&(t=yield this.It(n),e=yield this.jt(n),navigator.sendBeacon(t,e))})}Tt(d){var h;return i(this,void 0,void 0,function*(){if(!f(d))return null;if(null!=(h=null==(h=this.J)?void 0:h.networkConfig)&&h.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i}=d;const r=new AbortController;var t=setTimeout(()=>r.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),o=yield this.It(d),s=null;try{var u,l,a,c={method:e,body:n,headers:$P({},d.headers),signal:r.signal,priority:d.priority},s=yield fetch(o,c);if(clearTimeout(t),s.ok)return a=yield s.text(),v.Diagnostics.mark(),{body:a,code:s.status};throw u=yield s.text().catch(()=>"No Text"),(l=new Error(`Failed to fetch: ${o} `+u)).name="NetworkError",l}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 v.Diagnostics.mark(),!i||i<=0?(null!=(h=this.F)&&h.call(this,{name:"error",error:t}),_.Log.error(`A networking error occured during ${e} request to ${o}.`,n,t),null):this.Tt($P($P({},d),{retries:i-1}))}})}It(e){return i(this,void 0,void 0,function*(){var t=$P({[u.NetworkParam.SdkKey]:e.sdkKey,[u.NetworkParam.SdkType]:o.SDKType.K(e.sdkKey),[u.NetworkParam.SdkVersion]:c.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:yield s.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}jt(r){return i(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=r,n=yield a.StableID.get(e),i=yield s.SessionID.get(e),e=o.SDKType.K(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},c.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}wt(t,e){var n,i,r,o=(0,l.kt)();if(null==o||!o.btoa||null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(n=this.J)&&n.disableStatsigEncoding||!t.isStatsigEncodable)return e;try{var s=null!=(i=o.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(r=t.params)?r:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return _.Log.warn("/initialize request encoding failed"),e}}};const f=t=>!!t.sdkKey||(_.Log.warn("Unable to make request without an SDK key"),!1)},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={K:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},xt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.St=i.Mt=i.Dt=i.Et=i.Pt=i.kt=void 0;i.kt=()=>"undefined"!=typeof window?window:null,i.Pt=()=>{var t=(0,i.kt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Et=()=>null!=(0,i.Pt)(),i.Dt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.Mt=(t,e)=>{var n=(0,i.Pt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.St=()=>{var t;try{return null==(t=(0,i.kt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(832),u=n(780),l=n(444),a=n(556),c=18e5,d=144e5,h={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function _(t){return"statsig.session_id."+(0,i.DJB2)(t)}e.SessionID={get:t=>s(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:o=>s(void 0,void 0,void 0,function*(){null==h[o]&&(h[o]=function(n){return s(this,void 0,void 0,function*(){let t=yield function(t){t=_(t);return(0,l.N)(t)}(n);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:n}})}(o));var t=yield h[o],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>c}(n)||function({startTime:t}){return Date.now()-t>d}(n))&&(n.sessionID=(0,a.getUUID)(),n.startTime=e),n.lastUpdate=e,n),r=t.sdkKey;return r=_(r),(0,l.G)(r,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=v(n,c),t.ageTimeoutID=v(n,d-e),t})}},604:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StableID=void 0;const r=n(832),o=n(780),s=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,r.DJB2)(t)}function c(t,e){e=a(e);(0,s.G)(e,t).catch(()=>{o.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,s.N)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(496);const l=n(496),a=n(512),c=n(728),d=n(780),h=n(48),v=n(604),_=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Ft={};var r,o=this.$emt.bind(this),s=(0,l.i)(),u=null!=(u=s.instances)?u:{};null!=i&&i.logLevel&&(d.Log.level=null==i?void 0:i.logLevel),null!=i&&i.disableStorage&&_.Storage.Ut(!0),null!=i&&i.overrideStableID&&v.StableID.setOverride(i.overrideStableID,t),this.l=new a.ErrorBoundary(t,i,o),this.l.wrap(this),this.l.wrap(n),this.l.wrap(e),this.h=t,this.J=null!=i?i:{},this.Kt=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.Lt=new c.EventLogger(t,o,n,i),null!=u[t]&&(0,h.Et)()&&d.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),u[t]=this,s.lastInstance=this,s.instances=u,__STATSIG__=s,this.dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Lt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,_.Storage.Ut(t.disableStorage))}flush(){return this.Lt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Lt.shutdown()})}on(t,e){this.Ft[t]||(this.Ft[t]=[]),this.Ft[t].push(e)}off(t,e){this.Ft[t]&&-1!==(e=this.Ft[t].indexOf(e))&&this.Ft[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.l.logError("__emit:"+n.name,t):d.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Ft[n.name]&&this.Ft[n.name].forEach(t=>e(t)),null!=(t=this.Ft["*"])&&t.forEach(e)}Jt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Vt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Lt.incrementNonExposureCount(t):this.Lt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.qt=e.zt=e.Bt=e.ht=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,r)=>({eventName:t,user:e,value:null,metadata:o(n,i),secondaryExposures:r,time:Date.now()});e.ht=({eventName:t})=>t===i||t===n,e.Bt=(t,e)=>{return l(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.zt=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.qt=(t,e,n)=>{var i,r=e.__evaluation,o=!0===(null==(o=null==r?void 0:r.explicit_parameters)?void 0:o.includes(n));let s="",u=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return o&&(s=null!=(i=r.allocated_experiment_name)?i:"",u=r.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:s,isExplicitParameter:String(o)},u)};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.39";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.$t=e.Ht=e.Yt=e.Wt=void 0;const r="default";function o(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,__evaluation:n,value:i}}function s(o,s){return(t,e)=>{var n,i,r=null!=(r=null==o?void 0:o[t])?r:null;return null==r||null!=e&&(n=e,(i=t=>Array.isArray(t)?"array":typeof t)(r)!==i(n))?null!=e?e:null:(null!=s&&s(t),r)}}e.Wt=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.Yt=function(t,e,n){return $P($P({},o(t,e,n,null!=(t=null==n?void 0:n.value)?t:{})),{groupName:null,get:s(null==n?void 0:n.value)})},e.Ht=function(t,e,n,i){return $P($P({},o(t,e,n,void 0)),{get:s(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.$t=function(t,e,n,i){return $P($P($P({},t),e),{get:s(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e,n)=>{$Q(e),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||$A(),n=($Q(e),e.G=e.N=e.Storage=void 0,n(780));const r={},o=t=>Promise.resolve(t),s={Qt:()=>"InMemory",D(t){return null!=(t=r[t])?t:null},Xt(t){return o(null!=(t=r[t])?t:null)},P(t,e){return r[t]=e,o()},C(t){return delete r[t],o()},Zt(){return o(Object.keys(r))}};let u=null;try{"undefined"!=typeof window&&"localStorage"in window&&(u={Qt:()=>"LocalStorage",D(t){return localStorage.getItem(t)},Xt(t){return o(localStorage.getItem(t))},P(t,e){return localStorage.setItem(t,e),o()},C(t){return localStorage.removeItem(t),o()},Zt(){var t=Object.keys(localStorage);return o(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let l=null!==u&&void 0!==u?u:s,a=l;e.Storage={Qt:()=>a.Qt(),Xt:t=>a.Xt(t),P:(t,e)=>a.P(t,e),C:t=>a.C(t),Zt:()=>a.Zt(),D:t=>{var e;return null!=(e=null==(e=a.D)?void 0:e.call(a,t))?e:null},te:t=>{l=t,a=t},Ut:t=>{a=t?s:l}},e.N=function(e){return i(this,void 0,void 0,function*(){var t=yield a.Xt(e);return JSON.parse(null!=t?t:"null")})},e.G=function(t,e){return i(this,void 0,void 0,function*(){yield a.P(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),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)=>{$Q(e),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)=>{$Q(e),e.et=void 0,e.et=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.ee=e.it=e._t=void 0;n=n(48);const i="foreground",r="background",o=[];let s=i;e._t=()=>s===i,e.it=t=>{o.unshift(t)};e.ee=e=>{e!==s&&(s=e,o.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>(0,e.ee)(i)),(0,n.Dt)("blur",()=>(0,e.ee)(r)),(0,n.Dt)("beforeunload",()=>(0,e.ee)(r)),(0,n.Mt)("visibilitychange",()=>{(0,e.ee)("visible"===document.visibilityState?i:r)})},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)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,n(496);const o=n(728),s=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),n(780));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return s.Log}});var u=n(972);const l=n(444);Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return l.Storage}});var a=n(556);r(n(496),e),r(n(856),e),r(n(320),e),r(n(184),e),r(n(512),e),r(n(500),e),r(n(788),e),r(n(832),e),r(n(664),e),r(n(780),e),r(n(188),e),r(n(716),e),r(n(264),e),r(n(48),e),r(n(360),e),r(n(612),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(396),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(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:o.EventLogger,Log:s.Log,getUUID:a.getUUID,Storage:l.Storage,SDK_VERSION:u.SDK_VERSION})},920:(t,e,n)=>{$Q(e),e.AutoInit=void 0;const d=n(464),h=n(208);function v(t,e){var n;return null!=(n=e.get(t))?n:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,n,i;try{var r=(0,d.kt)(),o=(0,d.Pt)();if(r&&o&&o.currentScript){var s=o.currentScript.getAttribute("src"),u=null==(t=r.location)?void 0:t.href;if(s&&u){var l=new URL(s,u).searchParams,a=null!=(n=v("sdkKey",l))?n:v("apiKey",l);if(a){var c=null==(i=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:i[a];let t=null;(t=c instanceof h.StatsigClient?c:t)||(t=new h.StatsigClient(a,{})).initializeAsync().catch(t=>{d.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){d.Log.error("AutoInit failed",t)}}}},96:(t,e,n)=>{$Q(e),e.resolveDeltasResponse=void 0;const i=n(464);function r(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.resolveDeltasResponse=function(t,e){var n;return(e=(0,i.typedJsonParse)(e,"checksum","Failed to parse DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),n.dynamic_configs)}),r((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,r(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,r(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.DJB2Object)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs}))===e.checksum?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},156:(t,e,n)=>{$Q(e);const i=n(464);e.default=class{constructor(){this.ne=null,this.ie=null,this.oe="Uninitialized",this.se=0,this.re=0}getValues(){return this.ne?(0,i.typedJsonParse)(this.ne,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.ie=null,this.ne=null,this.oe="Loading",this.se=0,this.re=0}finalize(){this.ie||(this.oe="NoValues")}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,i.typedJsonParse)(t.data,"has_updates","Failed to parse EvaluationResponse"))?void 0:e.has_updates)&&(this.ne=t.data,this.se=e.time,this.re=t.receivedAt,this.oe=t.source,this.ie=e)}getGate(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.feature_gates[t])?e:null;return this.ue(t)}getConfig(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.dynamic_configs[t])?e:null;return this.ue(t)}getLayer(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.layer_configs[t])?e:null;return this.ue(t)}ue(t){return{evaluation:t,details:this.le(null==t)}}le(t){return"Uninitialized"===this.oe||"NoValues"===this.oe?{reason:this.oe}:{reason:this.oe+":"+(t?"Unrecognized":"Recognized"),lcut:this.se,receivedAt:this.re}}}},400:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e);const u=n(464),l=n(96);class i extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.ae=(0,u.et)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(n,i,r,o){return s(this,void 0,void 0,function*(){var t=i?(0,u.typedJsonParse)(i,"has_updates","Failed to parse cached EvaluationResponse"):null;let e={user:o,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.ce(n,t,e,r)})}ce(e,n,i,r){var o;return s(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.ae,data:i,retries:2,isStatsigEncodable:!0,priority:r});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(o=null==t?void 0:t.body)?o:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(o=t.body)?void 0:o.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,l.resolveDeltasResponse)(n,t.body))?t:this.ce(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}),r)})}}e.default=i},520:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const s=n(464),o=n(156),u=n(400),l=n(364);class i extends s.StatsigClientBase{static instance(t){var e=(0,s.i)().instance(t);return e instanceof i?e:(s.Log.warn("Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){s.SDKType.At(t,"javascript-client");var i=new u.default(n,t=>{this.$emt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,i,n),this.de=new o.default,this.he=e}initializeSync(){this.updateUserSync(this.he)}initializeAsync(t){return this.updateUserAsync(this.he,t)}updateUserSync(t){this.ve(t);t=this.dataAdapter.getDataSync(this.he);this.de.setValuesFromDataAdapter(t),this.de.finalize(),this.Jt("Ready",t),this._e(null!=t?t:null,this.he)}updateUserAsync(n,i){return r(this,void 0,void 0,function*(){this.ve(n);var t=this.he,e=this.dataAdapter.getDataSync(t);this.Jt("Loading",e),this.de.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.he&&this.de.setValuesFromDataAdapter(e),this.de.finalize(),this.Jt("Ready",e)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.de.getValues(),user:JSON.parse(JSON.stringify(this.he)),errorBoundary:this.l}}getAsyncContext(){return r(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield s.StatsigSession.get(this.h),stableID:yield s.StableID.get(this.h)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,s.DJB2)(t),{evaluation:n,details:i}=this.de.getGate(n),i=(0,s.Wt)(t,i,n),r=null==(r=null==(n=this.Kt)?void 0:n.getGateOverride)?void 0:r.call(n,i,this.he,e),n=null!=r?r:i;return this.Vt(t,(0,s.Bt)(this.he,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.fe("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.fe("experiment",t,e);return this.$emt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n){var t=(0,s.DJB2)(e),{evaluation:t,details:i}=this.de.getLayer(t),i=(0,s.Ht)(e,i,t),r=null==(r=null==(t=this.Kt)?void 0:t.getLayerOverride)?void 0:r.call(t,i,this.he,n);const o=(0,s.$t)(i,r,null!=(t=null==r?void 0:r.__value)?t:i.__value,t=>{this.Vt(e,(0,s.qt)(this.he,o,t),n)});return this.$emt({name:"layer_evaluation",layer:o}),o}logEvent(t,e,n){this.Lt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.he,time:Date.now()}))}_e(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{s.Log.error("An error occurred after update.",t)})}ve(t){this.Lt.reset(),this.de.reset(),this.he=(0,s.normalizeUser)(t,this.J.environment)}fe(t,e,n){var i=(0,s.DJB2)(e),{evaluation:i,details:r}=this.de.getConfig(i),r=(0,s.Yt)(e,r,i),i="experiment"===t?null==(t=null==(i=this.Kt)?void 0:i.getExperimentOverride)?void 0:t.call(i,r,this.he,n):null==(i=null==(t=this.Kt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,r,this.he,n),t=null!=i?i:r;return this.Vt(e,(0,s.zt)(this.he,t),n),t}}e.default=i},364:function(t,e,n){var o=this&&this.__awaiter||$A(),i=($Q(e),e.StatsigEvaluationsDataAdapter=void 0,n(464));const r=n(400);class s extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.L=null}attach(t,e){super.attach(t,e),this.L=new r.default(null!=e?e:{})}getDataAsync(t,e,n){return this.O(t,e,n)}prefetchData(t,e){return this.T(t,e)}I(e,n,i){var r;return o(this,void 0,void 0,function*(){var t=yield null==(r=this.L)?void 0:r.fetchEvaluations(this.M(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=s},208:(t,e,n)=>{$Q(e),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var i=n(520);e.StatsigClient=i.default;const r=n(364);Object.defineProperty(e,"StatsigEvaluationsDataAdapter",{enumerable:!0,get:function(){return r.StatsigEvaluationsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:r.StatsigEvaluationsDataAdapter,StatsigClient:i.default}),e.default=__STATSIG__},536:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const s=n(464),r=n(76);e.runStatsigAutoCapture=function(t){new o(t)};class o{constructor(t){this.ge=t,this.be=Date.now(),this.me=0;var e,{sdkKey:t,errorBoundary:n}=t.getContext(),n=(this.l=n,this.l.wrap(this),(0,s.Pt)());(0,s.Et)()&&((e=null!=(e=(__STATSIG__=(0,s.i)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.ye()):this.ye()}pe(){const e=(0,s.kt)();var t,n=(0,s.Pt)();e&&n&&(t=t=>{this.Se(t||e.event)},(0,r.Oe)(n,"click",t),(0,r.Oe)(n,"submit",t),(0,r.Oe)(e,"error",t),(0,r.Oe)(e,"beforeunload",()=>this.je()),(0,r.Oe)(e,"scroll",()=>this.Te()))}Se(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.we(t):(e=(0,r.Ie)(t))&&(0,r.rt)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,r.Ae)(e),this.xe(n,t,e))}ye(){this.pe(),this.Me(),this.De()}we(t){var e=(null==t?void 0:t.error)||{};let n=e;if("object"==typeof e)try{n=JSON.stringify(e)}catch(t){n="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.xe("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}Me(){setTimeout(()=>{var t,e=(0,r.Ee)();this.xe("page_view",(0,r.ke)(),{title:null==(t=(0,s.Pt)())?void 0:t.title,queryParams:Object.fromEntries(e.searchParams)},{flushImmediately:!0,addNewSessionMetadata:!0})},1)}De(){const n=(0,s.kt)();void 0!==(null===n||void 0===n?void 0:n.performance)&&"function"==typeof n.performance.getEntriesByType&&"function"==typeof n.performance.getEntriesByName&&setTimeout(()=>{var t={},e=n.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),n.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.xe("performance",(0,r.ke)(),t)},1)}je(){this.xe("page_view_end",(0,r.ke)(),{scrollDepth:this.me,pageViewLength:Date.now()-this.be},{flushImmediately:!0})}xe(n,i,r,o){this.tn().then(t=>{var e=$P({sessionID:t.data.sessionID,page_url:null!=(e=null==(e=null==(e=(0,s.kt)())?void 0:e.location)?void 0:e.href)?e:""},r),t=(null!=o&&o.addNewSessionMetadata&&(e.isNewSession=String(Math.abs(t.data.startTime-Date.now())<1e3)),{eventName:"auto_capture::"+n,value:i,metadata:e});this.ge.logEvent(t),null!=o&&o.flushImmediately&&this.ge.flush().catch(t=>{s.Log.error(t)})}).catch(t=>{this.l.logError("AC::enqueue",t)})}Te(){var t=null!=(t=null==(t=(0,s.Pt)())?void 0:t.body.scrollHeight)?t:1,e=(0,s.kt)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.me=Math.max(this.me,Math.min(100,Math.round((n+e)/t*100)))}tn(){return i(this,void 0,void 0,function*(){return(yield this.ge.getAsyncContext()).session})}}e.AutoCapture=o},76:(t,e,n)=>{$Q(e),e.Oe=e.ke=e.Ee=e.rt=e.Ie=e.Ae=void 0;const i=n(464);function o(e){if(e){let t=e;for(;t;){var n=t.tagName.toLowerCase();if(["body","document"].includes(n))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.Ae=function(t){var e=t.tagName.toLowerCase(),n={},i=e,r=("form"===e&&(n.action=t.getAttribute("action"),n.method=null!=(r=t.getAttribute("method"))?r:"GET",n.formName=t.getAttribute("name"),n.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(n.content=t.value,n.inputName=t.getAttribute("name")),"button"===e&&(n.content=(t.textContent||"").trim()),o(t));return r&&(n.href=r.getAttribute("href")),{value:i,metadata:n}},e.Ie=function(t){if(!t)return null;let e=t.target||t.srcElement;return e&&e instanceof Element?e=3===e.nodeType?e.parentNode||null:e:null},e.rt=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var n=e.tagName.toLowerCase(),i=t.type.toLowerCase();switch(n){case"html":return!1;case"form":return"submit"===i;case"input":case"select":case"textarea":return["change"].includes(i);default:if("click"===i){if("button"===n)return!0;if(o(e))return!0}return!1}},e.Ee=function(){var t=null!=(t=null==(t=null==(t=(0,i.kt)())?void 0:t.location)?void 0:t.href)?t:"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.ke=function(){return(0,i.St)()||""},e.Oe=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},824:(t,e,n)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(536);Object.defineProperty(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),Object.defineProperty(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return i.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture,runStatsigAutoCapture:i.runStatsigAutoCapture}),e.default=__STATSIG__}},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;const s=r(824);var o=r(920);e.default=__STATSIG__,o.AutoInit.attempt(({client:t})=>{new s.AutoCapture(t)})}return t.default})());
{
"name": "@statsig/js-client",
"version": "0.0.1-beta.38",
"version": "0.0.1-beta.39",
"dependencies": {
"@statsig/client-core": "0.0.1-beta.38"
"@statsig/client-core": "0.0.1-beta.39"
},

@@ -7,0 +7,0 @@ "jsdelivr": "./build/statsig-js-client.min.js",

@@ -1,2 +0,2 @@

import { NetworkCore, StatsigClientEmitEventFunc, StatsigUser } from '@statsig/client-core';
import { NetworkCore, NetworkPriority, StatsigClientEmitEventFunc, StatsigUser } from '@statsig/client-core';
import { StatsigOptions } from './StatsigOptions';

@@ -6,4 +6,4 @@ export default class StatsigNetwork extends NetworkCore {

constructor(options: StatsigOptions | null, emitter?: StatsigClientEmitEventFunc);
fetchEvaluations(sdkKey: string, current: string | null, user?: StatsigUser): Promise<string | null>;
fetchEvaluations(sdkKey: string, current: string | null, priority?: NetworkPriority, user?: StatsigUser): Promise<string | null>;
private _fetchEvaluations;
}

@@ -20,3 +20,3 @@ "use strict";

}
fetchEvaluations(sdkKey, current, user) {
fetchEvaluations(sdkKey, current, priority, user) {
return __awaiter(this, void 0, void 0, function* () {

@@ -34,6 +34,6 @@ const cache = current

}
return this._fetchEvaluations(sdkKey, cache, data);
return this._fetchEvaluations(sdkKey, cache, data, priority);
});
}
_fetchEvaluations(sdkKey, cache, data) {
_fetchEvaluations(sdkKey, cache, data, priority) {
var _a, _b;

@@ -47,2 +47,3 @@ return __awaiter(this, void 0, void 0, function* () {

isStatsigEncodable: true,
priority,
});

@@ -64,3 +65,3 @@ if ((response === null || response === void 0 ? void 0 : response.code) === 204) {

// retry without deltas
return this._fetchEvaluations(sdkKey, cache, Object.assign(Object.assign(Object.assign({}, data), result), { deltasResponseRequested: false }));
return this._fetchEvaluations(sdkKey, cache, Object.assign(Object.assign(Object.assign({}, data), result), { deltasResponseRequested: false }), priority);
});

@@ -67,0 +68,0 @@ }

@@ -231,3 +231,5 @@ "use strict";

_runPostUpdate(current, user) {
this.dataAdapter.getDataAsync(current, user).catch((err) => {
this.dataAdapter
.getDataAsync(current, user, { priority: 'low' })
.catch((err) => {
client_core_1.Log.error('An error occurred after update.', err);

@@ -234,0 +236,0 @@ });

@@ -8,3 +8,3 @@ import { AnyStatsigOptions, DataAdapterAsyncOptions, DataAdapterCore, DataAdapterResult, EvaluationsDataAdapter, StatsigUser } from '@statsig/client-core';

prefetchData(user: StatsigUser, options?: DataAdapterAsyncOptions): Promise<void>;
protected _fetchFromNetwork(current: string | null, user?: StatsigUser): Promise<string | null>;
protected _fetchFromNetwork(current: string | null, user?: StatsigUser, options?: DataAdapterAsyncOptions): Promise<string | null>;
}

@@ -30,6 +30,6 @@ "use strict";

}
_fetchFromNetwork(current, user) {
_fetchFromNetwork(current, user, options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const result = yield ((_a = this._network) === null || _a === void 0 ? void 0 : _a.fetchEvaluations(this._getSdkKey(), current, user));
const result = yield ((_a = this._network) === null || _a === void 0 ? void 0 : _a.fetchEvaluations(this._getSdkKey(), current, options === null || options === void 0 ? void 0 : options.priority, user));
return result !== null && result !== void 0 ? result : null;

@@ -36,0 +36,0 @@ });

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc