@statsig/js-client
Advanced tools
Comparing version 0.0.1-beta.41 to 0.0.1-beta.42
@@ -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 $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,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},707:(t,e,n)=>{$Q(e),e.o=e.u=void 0;const i=n(832);function o(t,e,n){return n?n(t,e):(e=["uid:"+(null!=(n=null==e?void 0:e.userID)?n:""),"cids:"+Object.entries(null!=(n=null==e?void 0:e.customIDs)?n:{}).sort(([t],[e])=>t.localeCompare(e)).map(([t,e])=>t+"-"+e).join(","),"k:"+t],(0,i.DJB2)(e.join("|")))}e.u=o,e.o=function(t,e,n){return e?o(t,e,n):(0,i.DJB2)("k:"+t)}},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(296),o=n(444),l=n(412);e.DataAdapterCore=class{constructor(t,e){this.l=t,this.h=e,this.v=null,this._=null,this.S={},this.p="statsig.last_modified_time."+e}attach(t,e){this._=t,this.v=e}getDataSync(t){var t=this.m(t),e=this.S[t];return e||((e=this.O(t))?(this.j(t,e),this.S[t]):null)}setData(t,e){e=e&&(0,i.T)(e,null==(e=this.v)?void 0:e.environment),e=this.m(e);this.j(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.S=$P($P({},this.S),t)}I(e,n,i){var o;return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.A(null!=(o=null==t?void 0:t.data)?o: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)})}M(n,i){return s(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.I(null,n,i);e&&this.j(t,$P($P({},e),{source:"Prefetch"}))})}A(i,o,r){return s(this,void 0,void 0,function*(){var t=yield this.D(i,o,r);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(o),this.j(t,n),yield this.k(t,n),n):null})}G(){return null!=this._?this._:(u.Log.error(this.l+" is not attached to a Client"),"")}j(t,e){var n=Object.entries(this.S);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.S[n]),this.S[t]=e}O(t){var e=null==(e=o.Storage.N)?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}k(t,e){return s(this,void 0,void 0,function*(){yield o.Storage.C(t,JSON.stringify(e)),yield this.R(t)})}R(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,o.P)(this.p))?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.F(e[0])),yield(0,o.U)(this.p,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._=t,this.v=e,this.K=n,this.L=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.q("eb:wrap",t)}}capture(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.q(e,t)):n}catch(t){return this.q(e,t),null}}logError(t,e){this.q(t,e)}q(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.L.has(o)||(this.L.add(o),null!=(t=null==(t=this.v)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.K)&&t.call(this,{name:"error",error:s}):(t=l.SDKType.J(this._),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(null!=(o=null==(i=null==(o=this.v)?void 0:o.networkConfig)?void 0:i.networkOverrideFunc)?o:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.K)&&i.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 o=n(832),r=n(780),s=n(716),u=n(48),l=n(876),a=n(444),c=n(84),d=n(100),h={},v=t=>{null!=(t=h[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this._=e,this.K=t,this.V=n,this.v=i,this.B=[],this.$={},this.H={},this.W=!1,this.Y=Date.now(),(h[e]=this).X=!0===(null==i?void 0:i.disableLogging),this.Z=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;t=null!=(n=null==i?void 0:i.loggingIntervalMs)?n:1e4;const o=setInterval(()=>{h[e].tt!==o?clearInterval(o):v(e)},t);this.tt=o;n=null==i?void 0:i.networkConfig;this.et=(0,c.it)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",s.NetworkDefault.eventsApi),this.nt=(0,c.it)(null==n?void 0:n.logEventBeaconUrl,null==n?void 0:n.api,"/log_event_beacon",s.NetworkDefault.eventsApi),(0,d.st)(t=>{"background"===t&&v(e)}),this.rt()}setLoggingDisabled(t){this.X=t}enqueue(t){this.ot(t)&&(this.ut(t),this.lt(),this.B.length>this.Z)&&v(this._)}incrementNonExposureCount(t){var e=null!=(e=this.H[t])?e:0;this.H[t]=e+1}reset(){this.$={}}shutdown(){return i(this,void 0,void 0,function*(){this.tt&&(clearInterval(this.tt),this.tt=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.ct(),0!==this.B.length&&(t=this.B,this.B=[],yield this.dt(t))})}lt(){this.W||(this.W=!0,200<Date.now()-this.Y)||setTimeout(()=>v(this._),200)}ot(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.$[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.$).length&&(this.$={}),this.$[t]=n}return!0}dt(t){var e,n;return i(this,void 0,void 0,function*(){if(this.X)this.vt(t);else try{(!(0,d._t)()&&this.V.isBeaconSupported()&&null==(null==(n=null==(e=this.v)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.ft(t):yield this.gt(t)).success?this.K({name:"logs_flushed",events:t}):this.vt(t)}catch(t){r.Log.warn("Failed to flush events.")}})}gt(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.V.post({sdkKey:this._,data:{events:e},url:this.et,retries:3,params:{[s.NetworkParam.EventCount]:String(e.length)}}),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.V.beacon({sdkKey:this._,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.o();(0,a.U)(e,t).catch(()=>{r.Log.warn("Unable to save failed logs to storage")})}rt(){const e=this.o();i(this,void 0,void 0,function*(){var t=yield(0,a.P)(e);t&&(yield a.Storage.F(e),yield this.dt(t))}).catch(()=>{r.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,o.DJB2)(this._)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.bt();n&&(e.statsigMetadata={currentPage:n}),this.B.push($P($P({},t),e))}ct(){0!==Object.keys(this.H).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.H)}}),this.H={})}bt(){var t;if(!1!==(null==(t=this.v)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.yt)()}}},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||$A();$Q(e),e.NetworkCore=void 0,n(496);const b=n(280),y=n(780),u=n(716),r=n(360),l=n(48),s=n(612),a=n(604),c=n(972),p=n(100);e.NetworkCore=class{constructor(t,e){this.v=t,this.K=e,this.St=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.Ot(e);return this.jt($P({method:"POST",body:this.Tt(e,t)},e))})}get(t){return this.jt($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!!O(n)&&(t=yield this.wt(n),e=yield this.Ot(n),navigator.sendBeacon(t,e))})}jt(h){var v,f,_,g;return i(this,void 0,void 0,function*(){if(!O(h))return null;if(null!=(g=null==(g=this.v)?void 0:g.networkConfig)&&g.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i}=h;const o=new AbortController;var t=setTimeout(()=>o.abort(`Timeout of ${this.St}ms expired.`),this.St),r=yield this.wt(h),s=null,u=(0,p.ti)();try{var l,a,c,d={method:e,body:n,headers:$P({},h.headers),signal:o.signal,priority:h.priority,keepalive:u},s=yield(null!=(_=null==(f=null==(v=this.v)?void 0:v.networkConfig)?void 0:f.networkOverrideFunc)?_:fetch)(r,d);if(clearTimeout(t),s.ok)return c=yield s.text(),b.Diagnostics.mark(),{body:c,code:s.status};throw l=yield s.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${r} `+l)).name="NetworkError",a}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"Unknown Error"}(o,t);return b.Diagnostics.mark(),!i||i<=0?(null!=(g=this.K)&&g.call(this,{name:"error",error:t}),y.Log.error(`A networking error occured during ${e} request to ${r}.`,n,t),null):this.jt($P($P({},h),{retries:i-1}))}})}wt(e){return i(this,void 0,void 0,function*(){var t=$P({[u.NetworkParam.SdkKey]:e.sdkKey,[u.NetworkParam.SdkType]:r.SDKType.J(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:"")})}Ot(o){return i(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=o,n=yield a.StableID.get(e),i=yield s.SessionID.get(e),e=r.SDKType.J(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},c.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}Tt(t,e){var n,i,o,r=(0,l.It)();if(null==r||!r.btoa||null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(n=this.v)&&n.disableStatsigEncoding||!t.isStatsigEncodable)return e;try{var s=null!=(i=r.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(o=t.params)?o:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return y.Log.warn("/initialize request encoding failed"),e}}};const O=t=>!!t.sdkKey||(y.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={J:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},Mt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.yt=i.xt=i.Dt=i.Et=i.kt=i.It=void 0;i.It=()=>"undefined"!=typeof window?window:null,i.kt=()=>{var t=(0,i.It)();return null!=(t=null==t?void 0:t.document)?t:null},i.Et=()=>null!=(0,i.kt)(),i.Dt=(t,e)=>{var n=(0,i.It)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.xt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.yt=()=>{var t;try{return null==(t=(0,i.It)())?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(707),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 f(t){return"statsig.session_id."+(0,i.o)(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=f(t);return(0,l.P)(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=f(o),(0,l.U)(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||$A();$Q(e),e.StableID=void 0;const o=n(707),r=n(780),s=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,o.o)(t)}function c(t,e){e=a(e);(0,s.U)(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.P)(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 s=n(496),u=n(512),l=n(728),a=n(780),c=n(48),d=n(604),h=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Gt={};var o,r=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&h.Storage.Nt(!0),null!=i&&i.overrideStableID&&d.StableID.setOverride(i.overrideStableID,t),this.Ct=new u.ErrorBoundary(t,i,r),this.Ct.wrap(this),this.Ct.wrap(n),this.Ct.wrap(e),this._=t,this.v=null!=i?i:{},this.Rt=null!=(o=null==i?void 0:i.overrideAdapter)?o:null,this.Pt=new l.EventLogger(t,r,n,i),(0,c.Et)()&&(null!=(n=null!=(r=(o=(0,s.i)()).instances)?r:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),n[t]=this,o.lastInstance=this,o.instances=n,__STATSIG__=o),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.Ft()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.v.disableLogging=t.disableLogging,this.Pt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.v.disableStorage=t.disableStorage,h.Storage.Nt(t.disableStorage))}flush(){return this.Pt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Pt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[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.Ct.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Gt[n.name]&&this.Gt[n.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Kt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Pt.incrementNonExposureCount(t):this.Pt.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.Lt=e.qt=e.Jt=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.Jt=(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.qt=(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.Lt=(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.41";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.Vt=e.zt=e.Bt=e.$t=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.$t=function(t,e,n){return r(t,e,n,!0===(null==n?void 0:n.value))},e.Bt=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.zt=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.Vt=function(t,e,n,i){return $P($P($P({},t),e),{get:s(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e)=>{$Q(e),e.getUnitIDFromUser=e.T=void 0,e.T=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.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,n,e){var i,o=this&&this.__awaiter||$A(),r=(Object.defineProperty(n,"__esModule",{value:!0}),n.U=n.P=n.Storage=void 0,e(780)),e=e(48);const s={},u=t=>Promise.resolve(t),l={Ht:()=>"InMemory",N(t){return null!=(t=s[t])?t:null},Wt(t){return u(null!=(t=s[t])?t:null)},C(t,e){return s[t]=e,u()},F(t){return delete s[t],u()},Yt(){return u(Object.keys(s))}};let a=null;try{const v=(0,e.It)();"function"==typeof(null==(i=null===v||void 0===v?void 0:v.localStorage)?void 0:i.getItem)&&(a={Ht:()=>"LocalStorage",N(t){return v.localStorage.getItem(t)},Wt(t){return u(v.localStorage.getItem(t))},C(t,e){return v.localStorage.setItem(t,e),u()},F(t){return v.localStorage.removeItem(t),u()},Yt(){var t=Object.keys(v.localStorage);return u(t)}})}catch(t){r.Log.warn("Failed to setup localStorageProvider.")}let c=null!==a&&void 0!==a?a:l,d=c;function h(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.Qt(l),null;throw t}}n.Storage={Ht:()=>d.Ht(),Wt:t=>o(void 0,void 0,void 0,function*(){return h(()=>d.Wt(t))}),N:e=>h(()=>{var t;return null!=(t=null==(t=d.N)?void 0:t.call(d,e))?t:null}),C:(t,e)=>d.C(t,e),F:t=>d.F(t),Yt:()=>d.Yt(),Qt:t=>{c=t,d=t},Nt:t=>{d=t?l:c}},n.P=function(e){return o(this,void 0,void 0,function*(){var t=yield n.Storage.Wt(e);return JSON.parse(null!=t?t:"null")})},n.U=function(t,e){return o(this,void 0,void 0,function*(){yield n.Storage.C(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.it=void 0,e.it=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.Xt=e.st=e.ti=e._t=void 0;n=n(48);const i="foreground",o="background",r=[];let s=i,u=!1;e._t=()=>s===i,e.ti=()=>u,e.st=t=>{r.unshift(t)};e.Xt=e=>{e!==s&&(s=e,r.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>{(u=!1,e.Xt)(i)}),(0,n.Dt)("blur",()=>(0,e.Xt)(o)),(0,n.Dt)("beforeunload",()=>{u=!0,(0,e.Xt)(o)}),(0,n.xt)("visibilitychange",()=>{(0,e.Xt)("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(707),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})},696: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),o(n(208),e),e.default=__STATSIG__},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}}},536:(t,e,n)=>{$Q(e);const i=n(464);e.default=class{constructor(){this.Zt=null,this.te=null,this.ee="Uninitialized",this.ie=0,this.ne=0}getValues(){return this.Zt?(0,i.typedJsonParse)(this.Zt,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.te=null,this.Zt=null,this.ee="Loading",this.ie=0,this.ne=0}finalize(){this.te||(this.ee="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.Zt=t.data,this.ie=e.time,this.ne=t.receivedAt,this.ee=t.source,this.te=e)}getGate(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.feature_gates[t])?e:null;return this.se(t)}getConfig(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.dynamic_configs[t])?e:null;return this.se(t)}getLayer(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.layer_configs[t])?e:null;return this.se(t)}se(t){return{evaluation:t,details:this.re(null==t)}}re(t){return"Uninitialized"===this.ee||"NoValues"===this.ee?{reason:this.ee}:{reason:this.ee+":"+(t?"Unrecognized":"Recognized"),lcut:this.ie,receivedAt:this.ne}}}},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.oe=(0,u.it)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(n,i,o,r){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:r,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.ue(n,t,e,o)})}ue(e,n,i,o){var r;return s(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.oe,data:i,retries:2,isStatsigEncodable:!0,priority:o});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(r=null==t?void 0:t.body)?r:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,l.resolveDeltasResponse)(n,t.body))?t:this.ue(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}),o)})}}e.default=i},520:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e);const s=n(464),r=n(536),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((0,s.Et)()?"Unable to find StatsigClient instance":"StatsigClient.instance is not supported in server environments"),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.le=new r.default,this.ae=e}initializeSync(){this.updateUserSync(this.ae)}initializeAsync(t){return this.updateUserAsync(this.ae,t)}updateUserSync(t){this.ce(t);t=this.dataAdapter.getDataSync(this.ae);this.le.setValuesFromDataAdapter(t),this.de(t),this.he(null!=t?t:null,this.ae)}updateUserAsync(n,i){return o(this,void 0,void 0,function*(){this.ce(n);var t=this.ae,e=this.dataAdapter.getDataSync(t);this.Ut("Loading",e),this.le.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.ae&&(this.le.setValuesFromDataAdapter(e),this.de(e))})}getContext(){return{sdkKey:this._,options:this.v,values:this.le.getValues(),user:JSON.parse(JSON.stringify(this.ae)),errorBoundary:this.Ct}}getAsyncContext(){return o(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield s.StatsigSession.get(this._),stableID:yield s.StableID.get(this._)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,s.DJB2)(t),{evaluation:n,details:i}=this.le.getGate(n),i=(0,s.$t)(t,i,n),o=null==(o=null==(n=this.Rt)?void 0:n.getGateOverride)?void 0:o.call(n,i,this.ae,e),n=null!=o?o:i;return this.Kt(t,(0,s.Jt)(this.ae,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.ve("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.ve("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.le.getLayer(t),i=(0,s.zt)(e,i,t),o=null==(o=null==(t=this.Rt)?void 0:t.getLayerOverride)?void 0:o.call(t,i,this.ae,n);const r=(0,s.Vt)(i,o,null!=(t=null==o?void 0:o.__value)?t:i.__value,t=>{this.Kt(e,(0,s.Lt)(this.ae,r,t),n)});return this.$emt({name:"layer_evaluation",layer:r}),r}logEvent(t,e,n){this.Pt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.ae,time:Date.now()}))}Ft(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.de(null)})}de(t){this.le.finalize(),this.Ut("Ready",t)}he(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{s.Log.error("An error occurred after update.",t)})}ce(t){this.Pt.reset(),this.le.reset(),this.ae=(0,s.T)(t,this.v.environment)}ve(t,e,n){var i=(0,s.DJB2)(e),{evaluation:i,details:o}=this.le.getConfig(i),o=(0,s.Bt)(e,o,i),i="experiment"===t?null==(t=null==(i=this.Rt)?void 0:i.getExperimentOverride)?void 0:t.call(i,o,this.ae,n):null==(i=null==(t=this.Rt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,o,this.ae,n),t=null!=i?i:o;return this.Kt(e,(0,s.qt)(this.ae,t),n),t}}e.default=i},364:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const i=n(464),o=n(400);class s extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.V=null,this.v=null}attach(t,e){super.attach(t,e),this.V=new o.default(null!=e?e:{})}getDataAsync(t,e,n){return this.I(t,e,n)}prefetchData(t,e){return this.M(t,e)}D(e,n,i){var o;return r(this,void 0,void 0,function*(){var t=yield null==(o=this.V)?void 0:o.fetchEvaluations(this.G(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}m(t){t=(0,i.o)(this.G(),t,null==(t=this.v)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.h}.`+t}}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__}},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}return o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o(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 $Q2=(a,b,c)=>Object.defineProperty(a,b,c);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,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.t=n.i=void 0,n.i=()=>__STATSIG__||u;n.t=t=>{var e=(0,n.i)();return t?e.instances&&e.instances[t]:e.lastInstance};var i,s="__STATSIG__",o="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},r="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=o[s])?i:e[s])?i:r[s])?i:{instance:n.t};o[s]=u,e[s]=u,r[s]=u},707:(t,e,n)=>{$Q(e),e.o=e.u=void 0;const i=n(832);function s(t,e,n){return n?n(t,e):(e=["uid:"+(null!=(n=null==e?void 0:e.userID)?n:""),"cids:"+Object.entries(null!=(n=null==e?void 0:e.customIDs)?n:{}).sort(([t],[e])=>t.localeCompare(e)).map(([t,e])=>t+"-"+e).join(","),"k:"+t],(0,i.oi)(e.join("|")))}e.u=s,e.o=function(t,e,n){return e?s(t,e,n):(0,i.oi)("k:"+t)}},856:(t,e)=>{$Q(e)},320:function(t,e,n){var u=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=n(780),a=n(604),i=n(296),s=n(444),c=n(412);function d(t,e,n){return{source:t,data:e,receivedAt:Date.now(),stableID:n}}e.DataAdapterCore=class{constructor(t,e){this.l=t,this.h=e,this.v=null,this._=null,this.p="statsig.last_modified_time."+e,this.S=new o}attach(t,e){this._=t,this.v=e}getDataSync(t){var e=this.m(t),n=this.S.get(e,t);return n||((n=this.O(e))?(this.S.add(e,n),this.S.get(e,t)):null)}setData(t,e){e=e&&(0,i.T)(e,null==(e=this.v)?void 0:e.environment),e=this.m(e);this.S.add(e,d("Bootstrap",t,null))}__primeInMemoryCache(t){this.S.merge(t)}I(e,n,i){var s;return u(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.A(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(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}M(n,i){return u(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.I(null,n,i);e&&this.S.add(t,$P($P({},e),{source:"Prefetch"}))})}A(s,o,r){return u(this,void 0,void 0,function*(){var t=yield this.D(s,o,r);if(!t)return l.Log.debug("No response returned for latest value"),null;var e=(0,c.ui)(t,"has_updates","Initialize Response"),n=this.G(),n=yield a.StableID.get(n);let i=null;if(!0===(null==e?void 0:e.has_updates))i=d("Network",t,n);else{if(!s||!1!==(null==e?void 0:e.has_updates))return null;i=d("NetworkNotModified",s,n)}t=this.m(o);return this.S.add(t,i),yield this.k(t,i),i})}G(){return null!=this._?this._:(l.Log.error(this.l+" is not attached to a Client"),"")}O(t){var e=null==(e=s.Storage.N)?void 0:e.call(s.Storage,t);return null!=e&&(t=(0,c.ui)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}k(t,e){return u(this,void 0,void 0,function*(){yield s.Storage.C(t,JSON.stringify(e)),yield this.R(t)})}R(n){var i;return u(this,void 0,void 0,function*(){var t=null!=(i=yield(0,s.P)(this.p))?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 s.Storage.F(e[0])),yield(0,s.U)(this.p,t)})}};class o{constructor(){this.ii={}}get(t,e){var t=this.ii[t],n=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&n&&e!==n?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var n=Object.entries(this.ii);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.ii[n]),this.ii[t]=e}merge(t){this.ii=$P($P({},this.ii),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();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(360),a=e(972),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,n){this._=t,this.v=e,this.K=n,this.L=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.ci(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.q("eb:wrap",t)}}logError(t,e){this.q(t,e)}ci(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.q(e,t)):n}catch(t){return this.q(e,t),null}}q(o,r){try{i.Log.warn("Caught error in "+o,{error:r});n(this,void 0,void 0,function*(){var t,e,n=r||Error(c),i=n instanceof Error,s=i?n.name:"No Name";this.L.has(s)||(this.L.add(s),null!=(t=null==(t=this.v)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.K)&&t.call(this,{name:"error",error:r}):(t=l.SDKType.J(this._),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(n),n=JSON.stringify($P({tag:o,exception:s,info:i},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(i=null==(s=this.v)?void 0:s.networkConfig)?void 0:i.networkOverrideFunc)?s:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.K)&&i.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(84),d=n(100),h={},v=t=>{null!=(t=h[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this._=e,this.K=t,this.V=n,this.v=i,this.B=[],this.$={},this.H={},this.W=!1,this.Y=Date.now(),(h[e]=this).X=!0===(null==i?void 0:i.disableLogging),this.Z=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null==i?void 0:i.networkConfig;this.et=(0,c.it)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",r.NetworkDefault.eventsApi),(0,d.st)(t=>{"background"===t&&v(e)}),this.rt(),this.ni()}setLoggingDisabled(t){this.X=t}enqueue(t){this.ot(t)&&(this.ut(t),this.lt(),this.B.length>this.Z)&&v(this._)}incrementNonExposureCount(t){var e=null!=(e=this.H[t])?e:0;this.H[t]=e+1}reset(){this.$={}}shutdown(){return i(this,void 0,void 0,function*(){this.tt&&(clearInterval(this.tt),this.tt=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;if(this.ct(),0!==this.B.length)return t=this.B,this.B=[],this.dt(t)})}lt(){this.W||(this.W=!0,200<Date.now()-this.Y)||setTimeout(()=>v(this._),200)}ot(t){if((0,l.ht)(t)){var e=t.user||{},n=t.metadata||{},t=[t.eventName,e.userID,n.gate,n.config,n.ruleID].join("|"),e=this.$[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.$).length&&(this.$={}),this.$[t]=n}return!0}dt(t){var e,n;return i(this,void 0,void 0,function*(){if(this.X)this.vt(t);else try{(!(0,d._t)()&&this.V.isBeaconSupported()&&null==(null==(n=null==(e=this.v)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.ft(t):yield this.gt(t)).success?this.K({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.V.post(this.si(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.V.beacon(this.si(t))}})}si(t){return{sdkKey:this._,data:{events:t},url:this.et,retries:3,isCompressable:!0,params:{[r.NetworkParam.EventCount]:String(t.length)}}}vt(t){for(;500<t.length;)t.shift();var e=this.o();(0,a.U)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}rt(){const e=this.o();i(this,void 0,void 0,function*(){var t=yield(0,a.P)(e);t&&(yield a.Storage.F(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,s.oi)(this._)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.bt(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));o.Log.debug("Enqueued Event:",n),this.B.push(n)}ct(){0!==Object.keys(this.H).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.H)}}),this.H={})}bt(){var t;if(!1!==(null==(t=this.v)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.yt)()}ni(){if((0,u.Et)()){var t=null!=(t=null==(t=this.v)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{h[this._].tt!==e?clearInterval(e):v(this._)},t);this.tt=e}}}},832:(t,e)=>{$Q(e),e.li=e.oi=void 0;e.oi=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.li=t=>(0,e.oi)(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",IsGzipped:"gz"}},188:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(496);const b=n(280),y=n(780),u=n(716),o=n(360),l=n(48),a=n(612),c=n(604),d=n(972),g=n(100);e.NetworkCore=class{constructor(t,e){this.v=t,this.K=e,this.ri=null!=(e=null==t?void 0:t.networkConfig)?e:null,this.St=null!=(e=null==(t=this.ri)?void 0:t.networkTimeoutMs)?e:1e4}post(e){return r(this,void 0,void 0,function*(){let t=yield this.Ot(e);return e.isStatsigEncodable?t=this.Tt(e,t):e.isCompressable&&(t=yield i(e,t)),this.jt($P({method:"POST",body:t},e))})}get(t){return this.jt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return r(this,void 0,void 0,function*(){var t,e;return!!p(n)&&(t=yield this.Ot(n),t=yield i(n,t),e=yield this.wt(n),navigator.sendBeacon(e,t))})}jt(h){var v,f,_;return r(this,void 0,void 0,function*(){if(!p(h))return null;if(null!=(_=this.ri)&&_.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i}=h;const s="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>null===s||void 0===s?void 0:s.abort(`Timeout of ${this.St}ms expired.`),this.St),o=yield this.wt(h),r=null,u=(0,g.ti)();try{var l,a,c,d={method:e,body:n,headers:$P({},h.headers),signal:null===s||void 0===s?void 0:s.signal,priority:h.priority,keepalive:u},r=yield(null!=(f=null==(v=this.ri)?void 0:v.networkOverrideFunc)?f:fetch)(o,d);if(clearTimeout(t),r.ok)return c=yield r.text(),b.Diagnostics.mark(),{body:c,code:r.status};throw l=yield r.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${o} `+l)).name="NetworkError",a}catch(t){n=function(t,e){if(null!=t&&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"Unknown Error"}(s,t);return b.Diagnostics.mark(),!i||i<=0?(null!=(_=this.K)&&_.call(this,{name:"error",error:t}),y.Log.error(`A networking error occured during ${e} request to ${o}.`,n,t),null):this.jt($P($P({},h),{retries:i-1}))}})}wt(e){return r(this,void 0,void 0,function*(){var t=$P({[u.NetworkParam.SdkKey]:e.sdkKey,[u.NetworkParam.SdkType]:o.SDKType.J(e.sdkKey),[u.NetworkParam.SdkVersion]:d.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:yield a.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}Ot(s){return r(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,n=yield c.StableID.get(e),i=yield a.SessionID.get(e),e=o.SDKType.J(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}Tt(t,e){var n,i,s,o=(0,l.It)();if(null==o||!o.btoa||null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(n=this.v)&&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 y.Log.warn("/initialize request encoding failed"),e}}};const p=t=>!!t.sdkKey||(y.Log.warn("Unable to make request without an SDK key"),!1);function i(i,s){var o;return r(this,void 0,void 0,function*(){var t,e,n;return i.isCompressable&&"undefined"!=typeof CompressionStream&&"undefined"!=typeof TextEncoder&&null==(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-compress"])?(t=(new TextEncoder).encode(s),(n=(e=new CompressionStream("gzip")).writable.getWriter()).write(t).catch(y.Log.error),n.close().catch(y.Log.error),i.params=$P($P({},null!=(o=i.params)?o:{}),{[u.NetworkParam.IsGzipped]:"1"}),yield new Response(e.readable).arrayBuffer()):s})}},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={J:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},Mt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.yt=i.xt=i.Dt=i.Et=i.kt=i.It=void 0;i.It=()=>"undefined"!=typeof window?window:null,i.kt=()=>{var t=(0,i.It)();return null!=(t=null==t?void 0:t.document)?t:null},i.Et=()=>null!=(0,i.kt)(),i.Dt=(t,e)=>{var n=(0,i.It)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.xt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.yt=()=>{var t;try{return null==(t=(0,i.It)())?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(707),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 f(t){return"statsig.session_id."+(0,i.o)(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=f(t);return(0,l.P)(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=f(s),(0,l.U)(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(707),o=n(780),r=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,s.o)(t)}function c(t,e){e=a(e);(0,r.U)(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.P)(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 r=n(496),u=n(512),l=n(728),a=n(780),c=n(48),d=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Gt={};var s,o=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&d.Storage.Nt(!0),this._=t,this.v=null!=i?i:{},this.Rt=null!=(s=null==i?void 0:i.overrideAdapter)?s:null,this.Pt=new l.EventLogger(t,o,n,i),this.Ct=new u.ErrorBoundary(t,i,o),this.Ct.wrap(this),this.Ct.wrap(n),this.Ct.wrap(e),this.Ct.wrap(this.Pt),(0,c.Et)()&&(null!=(n=null!=(o=(s=(0,r.i)()).instances)?o:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),n[t]=this,s.lastInstance=this,s.instances=n,__STATSIG__=s),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.Ft()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.v.disableLogging=t.disableLogging,this.Pt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.v.disableStorage=t.disableStorage,d.Storage.Nt(t.disableStorage))}flush(){return this.Pt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Pt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[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.Ct.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Gt[n.name]&&this.Gt[n.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Kt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Pt.incrementNonExposureCount(t):this.Pt.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.Lt=e.qt=e.Jt=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.Jt=(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.qt=(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.Lt=(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.42";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.Vt=e.zt=e.Bt=e.$t=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.$t=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.Bt=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.zt=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.Vt=function(t,e,n,i){return $P($P($P({},t),e),{get:r(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e)=>{$Q(e),e.getUnitIDFromUser=e.T=void 0,e.T=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.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,n,e){var i=this&&this.__awaiter||$A(),s=($Q2(n,"__esModule",{value:!0}),n.U=n.P=n.Storage=void 0,e(780)),e=e(48);const o={},r=t=>Promise.resolve(t),u={Ht:()=>"InMemory",N:t=>o[t]||null,Wt:t=>r(o[t]||null),C:(t,e)=>(o[t]=e,r()),F:t=>(delete o[t],r()),Yt:()=>r(Object.keys(o))};let l=null;try{const h=(0,e.It)();h&&h.localStorage&&"function"==typeof h.localStorage.getItem&&(l={Ht:()=>"LocalStorage",N:t=>h.localStorage.getItem(t),Wt:t=>r(h.localStorage.getItem(t)),C:(t,e)=>(h.localStorage.setItem(t,e),r()),F:t=>(h.localStorage.removeItem(t),r()),Yt:()=>r(Object.keys(h.localStorage))})}catch(t){s.Log.warn("Failed to setup localStorageProvider.")}let a=null!==l&&void 0!==l?l:u,c=a;function d(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.Qt(u),null;throw t}}n.Storage={Ht:()=>c.Ht(),Wt:t=>i(void 0,void 0,void 0,function*(){return d(()=>c.Wt(t))}),N:t=>d(()=>c.N?c.N(t):null),C:(t,e)=>c.C(t,e),F:t=>c.F(t),Yt:()=>c.Yt(),Qt:t=>{a=t,c=t},Nt:t=>{c=t?u:a}},n.P=function(e){return i(this,void 0,void 0,function*(){var t=yield n.Storage.Wt(e);return JSON.parse(null!=t?t:"null")})},n.U=function(t,e){return i(this,void 0,void 0,function*(){yield n.Storage.C(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),e.ui=void 0;const s=n(780);e.ui=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return s.Log.error("Failed to parse "+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.it=void 0,e.it=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.Xt=e.st=e.ti=e._t=void 0;n=n(48);const i="foreground",s="background",o=[];let r=i,u=!1;e._t=()=>r===i,e.ti=()=>u,e.st=t=>{o.unshift(t)};e.Xt=e=>{e!==r&&(r=e,o.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>{(u=!1,e.Xt)(i)}),(0,n.Dt)("blur",()=>(0,e.Xt)(s)),(0,n.Dt)("beforeunload",()=>{u=!0,(0,e.Xt)(s)}),(0,n.xt)("visibilitychange",()=>{(0,e.Xt)("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]}}),$Q2(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=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),n(780));$Q2(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=n(972);const l=n(444);$Q2(e,"Storage",{enumerable:!0,get:function(){return l.Storage}}),s(n(496),e),s(n(707),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__:{}),{Log:r.Log,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]}}),$Q2(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.ai=void 0;const i=n(464);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.ai=function(t,e){var n;return(e=(0,i.ui)(e,"checksum","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.li)({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.Zt=null,this.te=null,this.ee="Uninitialized",this.ie=0,this.ne=0}reset(){this.te=null,this.Zt=null,this.ee="Loading",this.ie=0,this.ne=0}finalize(){this.te||(this.ee="NoValues")}getValues(){return this.Zt?(0,i.ui)(this.Zt,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;t&&!0===(null==(e=(0,i.ui)(t.data,"has_updates","EvaluationResponse"))?void 0:e.has_updates)&&(this.Zt=t.data,this.ie=e.time,this.ne=t.receivedAt,this.ee=t.source,this.te=e)}getGate(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.feature_gates[t])?e:null;return this.se(t)}getConfig(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.dynamic_configs[t])?e:null;return this.se(t)}getLayer(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.layer_configs[t])?e:null;return this.se(t)}se(t){return{evaluation:t,details:this.re(null==t)}}re(t){return"Uninitialized"===this.ee||"NoValues"===this.ee?{reason:this.ee}:{reason:this.ee+":"+(t?"Unrecognized":"Recognized"),lcut:this.ie,receivedAt:this.ne}}}},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.oe=(0,u.it)(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.ui)(i,"has_updates","InitializeResponse"):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.ue(n,t,e,s)})}ue(e,n,i,s){var o;return r(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.oe,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.ai)(n,t.body))?t:this.ue(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((0,r.Et)()?"Unable to find StatsigClient instance":"StatsigClient.instance is not supported in server environments"),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.le=new o.default,this.ae=e}initializeSync(){this.updateUserSync(this.ae)}initializeAsync(t){return this.updateUserAsync(this.ae,t)}updateUserSync(t){this.ce(t);t=this.dataAdapter.getDataSync(this.ae);this.le.setValues(t),this.de(t),this.he(null!=t?t:null,this.ae)}updateUserAsync(n,i){return s(this,void 0,void 0,function*(){this.ce(n);var t=this.ae,e=this.dataAdapter.getDataSync(t);this.Ut("Loading",e),this.le.setValues(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.ae&&(this.le.setValues(e),this.de(e))})}getContext(){return{sdkKey:this._,options:this.v,values:this.le.getValues(),user:JSON.parse(JSON.stringify(this.ae)),errorBoundary:this.Ct}}getAsyncContext(){return s(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield r.StatsigSession.get(this._),stableID:yield r.StableID.get(this._)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,r.oi)(t),{evaluation:n,details:i}=this.le.getGate(n),i=(0,r.$t)(t,i,n),s=null==(s=null==(n=this.Rt)?void 0:n.getGateOverride)?void 0:s.call(n,i,this.ae,e),n=null!=s?s:i;return this.Kt(t,(0,r.Jt)(this.ae,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.ve("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.ve("experiment",t,e);return this.$emt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n){var t=(0,r.oi)(e),{evaluation:t,details:i}=this.le.getLayer(t),i=(0,r.zt)(e,i,t),s=null==(s=null==(t=this.Rt)?void 0:t.getLayerOverride)?void 0:s.call(t,i,this.ae,n);const o=(0,r.Vt)(i,s,null!=(t=null==s?void 0:s.__value)?t:i.__value,t=>{this.Kt(e,(0,r.Lt)(this.ae,o,t),n)});return this.$emt({name:"layer_evaluation",layer:o}),o}logEvent(t,e,n){this.Pt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.ae,time:Date.now()}))}Ft(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.de(null)})}de(t){this.le.finalize(),this.Ut("Ready",t)}he(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{r.Log.error("An error occurred after update.",t)})}ce(t){this.Pt.reset(),this.le.reset(),this.ae=(0,r.T)(t,this.v.environment);t=null==(t=this.ae.customIDs)?void 0:t.stableID;t&&r.StableID.setOverride(t,this._)}ve(t,e,n){var i=(0,r.oi)(e),{evaluation:i,details:s}=this.le.getConfig(i),s=(0,r.Bt)(e,s,i),i="experiment"===t?null==(t=null==(i=this.Rt)?void 0:i.getExperimentOverride)?void 0:t.call(i,s,this.ae,n):null==(i=null==(t=this.Rt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,s,this.ae,n),t=null!=i?i:s;return this.Kt(e,(0,r.qt)(this.ae,t),n),t}}e.default=i},364:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const i=n(464),s=n(400);class r extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.V=null,this.v=null}attach(t,e){super.attach(t,e),this.V=new s.default(null!=e?e:{})}getDataAsync(t,e,n){return this.I(t,e,n)}prefetchData(t,e){return this.M(t,e)}D(e,n,i){var s;return o(this,void 0,void 0,function*(){var t=yield null==(s=this.V)?void 0:s.fetchEvaluations(this.G(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}m(t){t=(0,i.o)(this.G(),t,null==(t=this.v)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.h}.`+t}}e.StatsigEvaluationsDataAdapter=r},208:(t,e,n)=>{$Q(e),e.StatsigClient=void 0;n=n(520);e.StatsigClient=n.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:n.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 $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},707:(t,e,n)=>{$Q(e),e.o=e.u=void 0;const i=n(832);function r(t,e,n){return n?n(t,e):(e=["uid:"+(null!=(n=null==e?void 0:e.userID)?n:""),"cids:"+Object.entries(null!=(n=null==e?void 0:e.customIDs)?n:{}).sort(([t],[e])=>t.localeCompare(e)).map(([t,e])=>t+"-"+e).join(","),"k:"+t],(0,i.DJB2)(e.join("|")))}e.u=r,e.o=function(t,e,n){return e?r(t,e,n):(0,i.DJB2)("k:"+t)}},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(296),r=n(444),l=n(412);e.DataAdapterCore=class{constructor(t,e){this.l=t,this.h=e,this.v=null,this._=null,this.S={},this.p="statsig.last_modified_time."+e}attach(t,e){this._=t,this.v=e}getDataSync(t){var t=this.m(t),e=this.S[t];return e||((e=this.O(t))?(this.j(t,e),this.S[t]):null)}setData(t,e){e=e&&(0,i.T)(e,null==(e=this.v)?void 0:e.environment),e=this.m(e);this.j(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.S=$P($P({},this.S),t)}I(e,n,i){var r;return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.A(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)})}M(n,i){return s(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.I(null,n,i);e&&this.j(t,$P($P({},e),{source:"Prefetch"}))})}A(i,r,o){return s(this,void 0,void 0,function*(){var t=yield this.D(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.j(t,n),yield this.k(t,n),n):null})}G(){return null!=this._?this._:(u.Log.error(this.l+" is not attached to a Client"),"")}j(t,e){var n=Object.entries(this.S);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.S[n]),this.S[t]=e}O(t){var e=null==(e=r.Storage.N)?void 0:e.call(r.Storage,t);return null!=e&&(t=(0,l.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}k(t,e){return s(this,void 0,void 0,function*(){yield r.Storage.C(t,JSON.stringify(e)),yield this.R(t)})}R(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,r.P)(this.p))?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 r.Storage.F(e[0])),yield(0,r.U)(this.p,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._=t,this.v=e,this.K=n,this.L=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.q("eb:wrap",t)}}capture(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.q(e,t)):n}catch(t){return this.q(e,t),null}}logError(t,e){this.q(t,e)}q(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.L.has(r)||(this.L.add(r),null!=(t=null==(t=this.v)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.K)&&t.call(this,{name:"error",error:s}):(t=l.SDKType.J(this._),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(null!=(r=null==(i=null==(r=this.v)?void 0:r.networkConfig)?void 0:i.networkOverrideFunc)?r:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.K)&&i.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(84),d=n(100),h={},v=t=>{null!=(t=h[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this._=e,this.K=t,this.V=n,this.v=i,this.B=[],this.$={},this.H={},this.W=!1,this.Y=Date.now(),(h[e]=this).X=!0===(null==i?void 0:i.disableLogging),this.Z=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;t=null!=(n=null==i?void 0:i.loggingIntervalMs)?n:1e4;const r=setInterval(()=>{h[e].tt!==r?clearInterval(r):v(e)},t);this.tt=r;n=null==i?void 0:i.networkConfig;this.et=(0,c.it)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",s.NetworkDefault.eventsApi),this.nt=(0,c.it)(null==n?void 0:n.logEventBeaconUrl,null==n?void 0:n.api,"/log_event_beacon",s.NetworkDefault.eventsApi),(0,d.st)(t=>{"background"===t&&v(e)}),this.rt()}setLoggingDisabled(t){this.X=t}enqueue(t){this.ot(t)&&(this.ut(t),this.lt(),this.B.length>this.Z)&&v(this._)}incrementNonExposureCount(t){var e=null!=(e=this.H[t])?e:0;this.H[t]=e+1}reset(){this.$={}}shutdown(){return i(this,void 0,void 0,function*(){this.tt&&(clearInterval(this.tt),this.tt=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.ct(),0!==this.B.length&&(t=this.B,this.B=[],yield this.dt(t))})}lt(){this.W||(this.W=!0,200<Date.now()-this.Y)||setTimeout(()=>v(this._),200)}ot(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.$[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.$).length&&(this.$={}),this.$[t]=n}return!0}dt(t){var e,n;return i(this,void 0,void 0,function*(){if(this.X)this.vt(t);else try{(!(0,d._t)()&&this.V.isBeaconSupported()&&null==(null==(n=null==(e=this.v)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.ft(t):yield this.gt(t)).success?this.K({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.V.post({sdkKey:this._,data:{events:e},url:this.et,retries:3,params:{[s.NetworkParam.EventCount]:String(e.length)}}),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.V.beacon({sdkKey:this._,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.o();(0,a.U)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}rt(){const e=this.o();i(this,void 0,void 0,function*(){var t=yield(0,a.P)(e);t&&(yield a.Storage.F(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,r.DJB2)(this._)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.bt();n&&(e.statsigMetadata={currentPage:n}),this.B.push($P($P({},t),e))}ct(){0!==Object.keys(this.H).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.H)}}),this.H={})}bt(){var t;if(!1!==(null==(t=this.v)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.yt)()}}},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 y=n(280),b=n(780),u=n(716),o=n(360),l=n(48),s=n(612),a=n(604),c=n(972),p=n(100);e.NetworkCore=class{constructor(t,e){this.v=t,this.K=e,this.St=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.Ot(e);return this.jt($P({method:"POST",body:this.Tt(e,t)},e))})}get(t){return this.jt($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!!m(n)&&(t=yield this.wt(n),e=yield this.Ot(n),navigator.sendBeacon(t,e))})}jt(h){var v,_,f,g;return i(this,void 0,void 0,function*(){if(!m(h))return null;if(null!=(g=null==(g=this.v)?void 0:g.networkConfig)&&g.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i}=h;const r=new AbortController;var t=setTimeout(()=>r.abort(`Timeout of ${this.St}ms expired.`),this.St),o=yield this.wt(h),s=null,u=(0,p.ti)();try{var l,a,c,d={method:e,body:n,headers:$P({},h.headers),signal:r.signal,priority:h.priority,keepalive:u},s=yield(null!=(f=null==(_=null==(v=this.v)?void 0:v.networkConfig)?void 0:_.networkOverrideFunc)?f:fetch)(o,d);if(clearTimeout(t),s.ok)return c=yield s.text(),y.Diagnostics.mark(),{body:c,code:s.status};throw l=yield s.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${o} `+l)).name="NetworkError",a}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"Unknown Error"}(r,t);return y.Diagnostics.mark(),!i||i<=0?(null!=(g=this.K)&&g.call(this,{name:"error",error:t}),b.Log.error(`A networking error occured during ${e} request to ${o}.`,n,t),null):this.jt($P($P({},h),{retries:i-1}))}})}wt(e){return i(this,void 0,void 0,function*(){var t=$P({[u.NetworkParam.SdkKey]:e.sdkKey,[u.NetworkParam.SdkType]:o.SDKType.J(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:"")})}Ot(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.J(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},c.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}Tt(t,e){var n,i,r,o=(0,l.It)();if(null==o||!o.btoa||null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(n=this.v)&&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 b.Log.warn("/initialize request encoding failed"),e}}};const m=t=>!!t.sdkKey||(b.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={J:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},Mt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.yt=i.xt=i.Dt=i.Et=i.kt=i.It=void 0;i.It=()=>"undefined"!=typeof window?window:null,i.kt=()=>{var t=(0,i.It)();return null!=(t=null==t?void 0:t.document)?t:null},i.Et=()=>null!=(0,i.kt)(),i.Dt=(t,e)=>{var n=(0,i.It)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.xt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.yt=()=>{var t;try{return null==(t=(0,i.It)())?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(707),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.o)(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.P)(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.U)(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(707),o=n(780),s=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,r.o)(t)}function c(t,e){e=a(e);(0,s.U)(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.P)(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 s=n(496),u=n(512),l=n(728),a=n(780),c=n(48),d=n(604),h=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Gt={};var r,o=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&h.Storage.Nt(!0),null!=i&&i.overrideStableID&&d.StableID.setOverride(i.overrideStableID,t),this.Ct=new u.ErrorBoundary(t,i,o),this.Ct.wrap(this),this.Ct.wrap(n),this.Ct.wrap(e),this._=t,this.v=null!=i?i:{},this.Rt=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.Pt=new l.EventLogger(t,o,n,i),(0,c.Et)()&&(null!=(n=null!=(o=(r=(0,s.i)()).instances)?o:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),n[t]=this,r.lastInstance=this,r.instances=n,__STATSIG__=r),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.Ft()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.v.disableLogging=t.disableLogging,this.Pt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.v.disableStorage=t.disableStorage,h.Storage.Nt(t.disableStorage))}flush(){return this.Pt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Pt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[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.Ct.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Gt[n.name]&&this.Gt[n.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Kt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Pt.incrementNonExposureCount(t):this.Pt.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.Lt=e.qt=e.Jt=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.Jt=(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.qt=(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.Lt=(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.41";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.Vt=e.zt=e.Bt=e.$t=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.$t=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.Bt=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.zt=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.Vt=function(t,e,n,i){return $P($P($P({},t),e),{get:s(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e)=>{$Q(e),e.getUnitIDFromUser=e.T=void 0,e.T=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.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,n,e){var i,r=this&&this.__awaiter||$A(),o=(Object.defineProperty(n,"__esModule",{value:!0}),n.U=n.P=n.Storage=void 0,e(780)),e=e(48);const s={},u=t=>Promise.resolve(t),l={Ht:()=>"InMemory",N(t){return null!=(t=s[t])?t:null},Wt(t){return u(null!=(t=s[t])?t:null)},C(t,e){return s[t]=e,u()},F(t){return delete s[t],u()},Yt(){return u(Object.keys(s))}};let a=null;try{const v=(0,e.It)();"function"==typeof(null==(i=null===v||void 0===v?void 0:v.localStorage)?void 0:i.getItem)&&(a={Ht:()=>"LocalStorage",N(t){return v.localStorage.getItem(t)},Wt(t){return u(v.localStorage.getItem(t))},C(t,e){return v.localStorage.setItem(t,e),u()},F(t){return v.localStorage.removeItem(t),u()},Yt(){var t=Object.keys(v.localStorage);return u(t)}})}catch(t){o.Log.warn("Failed to setup localStorageProvider.")}let c=null!==a&&void 0!==a?a:l,d=c;function h(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.Qt(l),null;throw t}}n.Storage={Ht:()=>d.Ht(),Wt:t=>r(void 0,void 0,void 0,function*(){return h(()=>d.Wt(t))}),N:e=>h(()=>{var t;return null!=(t=null==(t=d.N)?void 0:t.call(d,e))?t:null}),C:(t,e)=>d.C(t,e),F:t=>d.F(t),Yt:()=>d.Yt(),Qt:t=>{c=t,d=t},Nt:t=>{d=t?l:c}},n.P=function(e){return r(this,void 0,void 0,function*(){var t=yield n.Storage.Wt(e);return JSON.parse(null!=t?t:"null")})},n.U=function(t,e){return r(this,void 0,void 0,function*(){yield n.Storage.C(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.it=void 0,e.it=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.Xt=e.st=e.ti=e._t=void 0;n=n(48);const i="foreground",r="background",o=[];let s=i,u=!1;e._t=()=>s===i,e.ti=()=>u,e.st=t=>{o.unshift(t)};e.Xt=e=>{e!==s&&(s=e,o.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>{(u=!1,e.Xt)(i)}),(0,n.Dt)("blur",()=>(0,e.Xt)(r)),(0,n.Dt)("beforeunload",()=>{u=!0,(0,e.Xt)(r)}),(0,n.xt)("visibilitychange",()=>{(0,e.Xt)("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(707),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.It)(),o=(0,d.kt)();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.Zt=null,this.te=null,this.ee="Uninitialized",this.ie=0,this.ne=0}getValues(){return this.Zt?(0,i.typedJsonParse)(this.Zt,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.te=null,this.Zt=null,this.ee="Loading",this.ie=0,this.ne=0}finalize(){this.te||(this.ee="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.Zt=t.data,this.ie=e.time,this.ne=t.receivedAt,this.ee=t.source,this.te=e)}getGate(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.feature_gates[t])?e:null;return this.se(t)}getConfig(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.dynamic_configs[t])?e:null;return this.se(t)}getLayer(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.layer_configs[t])?e:null;return this.se(t)}se(t){return{evaluation:t,details:this.re(null==t)}}re(t){return"Uninitialized"===this.ee||"NoValues"===this.ee?{reason:this.ee}:{reason:this.ee+":"+(t?"Unrecognized":"Recognized"),lcut:this.ie,receivedAt:this.ne}}}},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.oe=(0,u.it)(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.ue(n,t,e,r)})}ue(e,n,i,r){var o;return s(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.oe,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.ue(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((0,s.Et)()?"Unable to find StatsigClient instance":"StatsigClient.instance is not supported in server environments"),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.le=new o.default,this.ae=e}initializeSync(){this.updateUserSync(this.ae)}initializeAsync(t){return this.updateUserAsync(this.ae,t)}updateUserSync(t){this.ce(t);t=this.dataAdapter.getDataSync(this.ae);this.le.setValuesFromDataAdapter(t),this.de(t),this.he(null!=t?t:null,this.ae)}updateUserAsync(n,i){return r(this,void 0,void 0,function*(){this.ce(n);var t=this.ae,e=this.dataAdapter.getDataSync(t);this.Ut("Loading",e),this.le.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.ae&&(this.le.setValuesFromDataAdapter(e),this.de(e))})}getContext(){return{sdkKey:this._,options:this.v,values:this.le.getValues(),user:JSON.parse(JSON.stringify(this.ae)),errorBoundary:this.Ct}}getAsyncContext(){return r(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield s.StatsigSession.get(this._),stableID:yield s.StableID.get(this._)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,s.DJB2)(t),{evaluation:n,details:i}=this.le.getGate(n),i=(0,s.$t)(t,i,n),r=null==(r=null==(n=this.Rt)?void 0:n.getGateOverride)?void 0:r.call(n,i,this.ae,e),n=null!=r?r:i;return this.Kt(t,(0,s.Jt)(this.ae,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.ve("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.ve("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.le.getLayer(t),i=(0,s.zt)(e,i,t),r=null==(r=null==(t=this.Rt)?void 0:t.getLayerOverride)?void 0:r.call(t,i,this.ae,n);const o=(0,s.Vt)(i,r,null!=(t=null==r?void 0:r.__value)?t:i.__value,t=>{this.Kt(e,(0,s.Lt)(this.ae,o,t),n)});return this.$emt({name:"layer_evaluation",layer:o}),o}logEvent(t,e,n){this.Pt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.ae,time:Date.now()}))}Ft(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.de(null)})}de(t){this.le.finalize(),this.Ut("Ready",t)}he(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{s.Log.error("An error occurred after update.",t)})}ce(t){this.Pt.reset(),this.le.reset(),this.ae=(0,s.T)(t,this.v.environment)}ve(t,e,n){var i=(0,s.DJB2)(e),{evaluation:i,details:r}=this.le.getConfig(i),r=(0,s.Bt)(e,r,i),i="experiment"===t?null==(t=null==(i=this.Rt)?void 0:i.getExperimentOverride)?void 0:t.call(i,r,this.ae,n):null==(i=null==(t=this.Rt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,r,this.ae,n),t=null!=i?i:r;return this.Kt(e,(0,s.qt)(this.ae,t),n),t}}e.default=i},364:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const i=n(464),r=n(400);class s extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.V=null,this.v=null}attach(t,e){super.attach(t,e),this.V=new r.default(null!=e?e:{})}getDataAsync(t,e,n){return this.I(t,e,n)}prefetchData(t,e){return this.M(t,e)}D(e,n,i){var r;return o(this,void 0,void 0,function*(){var t=yield null==(r=this.V)?void 0:r.fetchEvaluations(this.G(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}m(t){t=(0,i.o)(this.G(),t,null==(t=this.v)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.h}.`+t}}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._e=t,this.Ge=Date.now(),this.Ne=0;var e,{sdkKey:t,errorBoundary:n}=t.getContext(),n=(this.Ct=n,this.Ct.wrap(this),(0,s.kt)());(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.Ce()):this.Ce()}Re(){const e=(0,s.It)();var t,n=(0,s.kt)();e&&n&&(t=t=>{this.Pe(t||e.event)},(0,r.Fe)(n,"click",t),(0,r.Fe)(n,"submit",t),(0,r.Fe)(e,"error",t),(0,r.Fe)(e,"beforeunload",()=>this.Ue()),(0,r.Fe)(e,"scroll",()=>this.Ke()))}Pe(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.Le(t):(e=(0,r.qe)(t))&&(0,r.ot)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,r.Je)(e),this.Ve(n,t,e))}Ce(){this.Re(),this.ze(),this.Be()}Le(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.Ve("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}ze(){setTimeout(()=>{var t,e=(0,r.$e)();this.Ve("page_view",(0,r.He)(),{title:null==(t=(0,s.kt)())?void 0:t.title,queryParams:Object.fromEntries(e.searchParams),referrer:(null==(t=(0,s.kt)())?void 0:t.referrer)||""},{flushImmediately:!0,addNewSessionMetadata:!0})},1)}Be(){const n=(0,s.It)();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.Ve("performance",(0,r.He)(),t)},1)}Ue(){this.Ve("page_view_end",(0,r.He)(),{scrollDepth:this.Ne,pageViewLength:Date.now()-this.Ge},{flushImmediately:!0})}Ve(n,i,r,o){this.We().then(t=>{var e=$P({sessionID:t.data.sessionID,page_url:null!=(e=null==(e=null==(e=(0,s.It)())?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._e.logEvent(t),null!=o&&o.flushImmediately&&this._e.flush().catch(t=>{s.Log.error(t)})}).catch(t=>{this.Ct.logError("AC::enqueue",t)})}Ke(){var t=null!=(t=null==(t=(0,s.kt)())?void 0:t.body.scrollHeight)?t:1,e=(0,s.It)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ne=Math.max(this.Ne,Math.min(100,Math.round((n+e)/t*100)))}We(){return i(this,void 0,void 0,function*(){return(yield this._e.getAsyncContext()).session})}}e.AutoCapture=o},76:(t,e,n)=>{$Q(e),e.Fe=e.He=e.$e=e.ot=e.qe=e.Je=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.Je=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.qe=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.ot=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.$e=function(){var t=null!=(t=null==(t=null==(t=(0,i.It)())?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.He=function(){return(0,i.yt)()||""},e.Fe=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})()); | ||
!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 $Q2=(a,b,c)=>Object.defineProperty(a,b,c);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,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.t=n.i=void 0,n.i=()=>__STATSIG__||u;n.t=t=>{var e=(0,n.i)();return t?e.instances&&e.instances[t]:e.lastInstance};var i,o="__STATSIG__",r="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},s="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=r[o])?i:e[o])?i:s[o])?i:{instance:n.t};r[o]=u,e[o]=u,s[o]=u},707:(t,e,n)=>{$Q(e),e.o=e.u=void 0;const i=n(832);function o(t,e,n){return n?n(t,e):(e=["uid:"+(null!=(n=null==e?void 0:e.userID)?n:""),"cids:"+Object.entries(null!=(n=null==e?void 0:e.customIDs)?n:{}).sort(([t],[e])=>t.localeCompare(e)).map(([t,e])=>t+"-"+e).join(","),"k:"+t],(0,i.oi)(e.join("|")))}e.u=o,e.o=function(t,e,n){return e?o(t,e,n):(0,i.oi)("k:"+t)}},856:(t,e)=>{$Q(e)},320:function(t,e,n){var u=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=n(780),a=n(604),i=n(296),o=n(444),c=n(412);function d(t,e,n){return{source:t,data:e,receivedAt:Date.now(),stableID:n}}e.DataAdapterCore=class{constructor(t,e){this.l=t,this.h=e,this.v=null,this._=null,this.p="statsig.last_modified_time."+e,this.S=new r}attach(t,e){this._=t,this.v=e}getDataSync(t){var e=this.m(t),n=this.S.get(e,t);return n||((n=this.O(e))?(this.S.add(e,n),this.S.get(e,t)):null)}setData(t,e){e=e&&(0,i.T)(e,null==(e=this.v)?void 0:e.environment),e=this.m(e);this.S.add(e,d("Bootstrap",t,null))}__primeInMemoryCache(t){this.S.merge(t)}I(e,n,i){var o;return u(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.A(null!=(o=null==t?void 0:t.data)?o:null,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}M(n,i){return u(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.I(null,n,i);e&&this.S.add(t,$P($P({},e),{source:"Prefetch"}))})}A(o,r,s){return u(this,void 0,void 0,function*(){var t=yield this.D(o,r,s);if(!t)return l.Log.debug("No response returned for latest value"),null;var e=(0,c.ui)(t,"has_updates","Initialize Response"),n=this.G(),n=yield a.StableID.get(n);let i=null;if(!0===(null==e?void 0:e.has_updates))i=d("Network",t,n);else{if(!o||!1!==(null==e?void 0:e.has_updates))return null;i=d("NetworkNotModified",o,n)}t=this.m(r);return this.S.add(t,i),yield this.k(t,i),i})}G(){return null!=this._?this._:(l.Log.error(this.l+" is not attached to a Client"),"")}O(t){var e=null==(e=o.Storage.N)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.ui)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}k(t,e){return u(this,void 0,void 0,function*(){yield o.Storage.C(t,JSON.stringify(e)),yield this.R(t)})}R(n){var i;return u(this,void 0,void 0,function*(){var t=null!=(i=yield(0,o.P)(this.p))?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.F(e[0])),yield(0,o.U)(this.p,t)})}};class r{constructor(){this.ii={}}get(t,e){var t=this.ii[t],n=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&n&&e!==n?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var n=Object.entries(this.ii);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.ii[n]),this.ii[t]=e}merge(t){this.ii=$P($P({},this.ii),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();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(360),a=e(972),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,n){this._=t,this.v=e,this.K=n,this.L=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.ci(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.q("eb:wrap",t)}}logError(t,e){this.q(t,e)}ci(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.q(e,t)):n}catch(t){return this.q(e,t),null}}q(r,s){try{i.Log.warn("Caught error in "+r,{error:s});n(this,void 0,void 0,function*(){var t,e,n=s||Error(c),i=n instanceof Error,o=i?n.name:"No Name";this.L.has(o)||(this.L.add(o),null!=(t=null==(t=this.v)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.K)&&t.call(this,{name:"error",error:s}):(t=l.SDKType.J(this._),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(n),n=JSON.stringify($P({tag:r,exception:o,info:i},$P($P({},e),{sdkType:t}))),yield(null!=(o=null==(i=null==(o=this.v)?void 0:o.networkConfig)?void 0:i.networkOverrideFunc)?o:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.K)&&i.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 o=n(832),r=n(780),s=n(716),u=n(48),l=n(876),a=n(444),c=n(84),d=n(100),h={},v=t=>{null!=(t=h[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this._=e,this.K=t,this.V=n,this.v=i,this.B=[],this.$={},this.H={},this.W=!1,this.Y=Date.now(),(h[e]=this).X=!0===(null==i?void 0:i.disableLogging),this.Z=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null==i?void 0:i.networkConfig;this.et=(0,c.it)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",s.NetworkDefault.eventsApi),(0,d.st)(t=>{"background"===t&&v(e)}),this.rt(),this.ni()}setLoggingDisabled(t){this.X=t}enqueue(t){this.ot(t)&&(this.ut(t),this.lt(),this.B.length>this.Z)&&v(this._)}incrementNonExposureCount(t){var e=null!=(e=this.H[t])?e:0;this.H[t]=e+1}reset(){this.$={}}shutdown(){return i(this,void 0,void 0,function*(){this.tt&&(clearInterval(this.tt),this.tt=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;if(this.ct(),0!==this.B.length)return t=this.B,this.B=[],this.dt(t)})}lt(){this.W||(this.W=!0,200<Date.now()-this.Y)||setTimeout(()=>v(this._),200)}ot(t){if((0,l.ht)(t)){var e=t.user||{},n=t.metadata||{},t=[t.eventName,e.userID,n.gate,n.config,n.ruleID].join("|"),e=this.$[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.$).length&&(this.$={}),this.$[t]=n}return!0}dt(t){var e,n;return i(this,void 0,void 0,function*(){if(this.X)this.vt(t);else try{(!(0,d._t)()&&this.V.isBeaconSupported()&&null==(null==(n=null==(e=this.v)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.ft(t):yield this.gt(t)).success?this.K({name:"logs_flushed",events:t}):this.vt(t)}catch(t){r.Log.warn("Failed to flush events.")}})}gt(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.V.post(this.si(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.V.beacon(this.si(t))}})}si(t){return{sdkKey:this._,data:{events:t},url:this.et,retries:3,isCompressable:!0,params:{[s.NetworkParam.EventCount]:String(t.length)}}}vt(t){for(;500<t.length;)t.shift();var e=this.o();(0,a.U)(e,t).catch(()=>{r.Log.warn("Unable to save failed logs to storage")})}rt(){const e=this.o();i(this,void 0,void 0,function*(){var t=yield(0,a.P)(e);t&&(yield a.Storage.F(e),yield this.dt(t))}).catch(()=>{r.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,o.oi)(this._)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.bt(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));r.Log.debug("Enqueued Event:",n),this.B.push(n)}ct(){0!==Object.keys(this.H).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.H)}}),this.H={})}bt(){var t;if(!1!==(null==(t=this.v)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.yt)()}ni(){if((0,u.Et)()){var t=null!=(t=null==(t=this.v)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{h[this._].tt!==e?clearInterval(e):v(this._)},t);this.tt=e}}}},832:(t,e)=>{$Q(e),e.li=e.oi=void 0;e.oi=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.li=t=>(0,e.oi)(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",IsGzipped:"gz"}},188:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(496);const g=n(280),b=n(780),u=n(716),r=n(360),l=n(48),a=n(612),c=n(604),d=n(972),y=n(100);e.NetworkCore=class{constructor(t,e){this.v=t,this.K=e,this.ri=null!=(e=null==t?void 0:t.networkConfig)?e:null,this.St=null!=(e=null==(t=this.ri)?void 0:t.networkTimeoutMs)?e:1e4}post(e){return s(this,void 0,void 0,function*(){let t=yield this.Ot(e);return e.isStatsigEncodable?t=this.Tt(e,t):e.isCompressable&&(t=yield i(e,t)),this.jt($P({method:"POST",body:t},e))})}get(t){return this.jt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return s(this,void 0,void 0,function*(){var t,e;return!!m(n)&&(t=yield this.Ot(n),t=yield i(n,t),e=yield this.wt(n),navigator.sendBeacon(e,t))})}jt(h){var v,f,_;return s(this,void 0,void 0,function*(){if(!m(h))return null;if(null!=(_=this.ri)&&_.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i}=h;const o="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>null===o||void 0===o?void 0:o.abort(`Timeout of ${this.St}ms expired.`),this.St),r=yield this.wt(h),s=null,u=(0,y.ti)();try{var l,a,c,d={method:e,body:n,headers:$P({},h.headers),signal:null===o||void 0===o?void 0:o.signal,priority:h.priority,keepalive:u},s=yield(null!=(f=null==(v=this.ri)?void 0:v.networkOverrideFunc)?f:fetch)(r,d);if(clearTimeout(t),s.ok)return c=yield s.text(),g.Diagnostics.mark(),{body:c,code:s.status};throw l=yield s.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${r} `+l)).name="NetworkError",a}catch(t){n=function(t,e){if(null!=t&&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"Unknown Error"}(o,t);return g.Diagnostics.mark(),!i||i<=0?(null!=(_=this.K)&&_.call(this,{name:"error",error:t}),b.Log.error(`A networking error occured during ${e} request to ${r}.`,n,t),null):this.jt($P($P({},h),{retries:i-1}))}})}wt(e){return s(this,void 0,void 0,function*(){var t=$P({[u.NetworkParam.SdkKey]:e.sdkKey,[u.NetworkParam.SdkType]:r.SDKType.J(e.sdkKey),[u.NetworkParam.SdkVersion]:d.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:yield a.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}Ot(o){return s(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=o,n=yield c.StableID.get(e),i=yield a.SessionID.get(e),e=r.SDKType.J(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}Tt(t,e){var n,i,o,r=(0,l.It)();if(null==r||!r.btoa||null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(n=this.v)&&n.disableStatsigEncoding||!t.isStatsigEncodable)return e;try{var s=null!=(i=r.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(o=t.params)?o:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return b.Log.warn("/initialize request encoding failed"),e}}};const m=t=>!!t.sdkKey||(b.Log.warn("Unable to make request without an SDK key"),!1);function i(i,o){var r;return s(this,void 0,void 0,function*(){var t,e,n;return i.isCompressable&&"undefined"!=typeof CompressionStream&&"undefined"!=typeof TextEncoder&&null==(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-compress"])?(t=(new TextEncoder).encode(o),(n=(e=new CompressionStream("gzip")).writable.getWriter()).write(t).catch(b.Log.error),n.close().catch(b.Log.error),i.params=$P($P({},null!=(r=i.params)?r:{}),{[u.NetworkParam.IsGzipped]:"1"}),yield new Response(e.readable).arrayBuffer()):o})}},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={J:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},Mt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.yt=i.xt=i.Dt=i.Et=i.kt=i.It=void 0;i.It=()=>"undefined"!=typeof window?window:null,i.kt=()=>{var t=(0,i.It)();return null!=(t=null==t?void 0:t.document)?t:null},i.Et=()=>null!=(0,i.kt)(),i.Dt=(t,e)=>{var n=(0,i.It)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.xt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.yt=()=>{var t;try{return null==(t=(0,i.It)())?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(707),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 f(t){return"statsig.session_id."+(0,i.o)(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=f(t);return(0,l.P)(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=f(o),(0,l.U)(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||$A();$Q(e),e.StableID=void 0;const o=n(707),r=n(780),s=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,o.o)(t)}function c(t,e){e=a(e);(0,s.U)(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.P)(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 s=n(496),u=n(512),l=n(728),a=n(780),c=n(48),d=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Gt={};var o,r=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&d.Storage.Nt(!0),this._=t,this.v=null!=i?i:{},this.Rt=null!=(o=null==i?void 0:i.overrideAdapter)?o:null,this.Pt=new l.EventLogger(t,r,n,i),this.Ct=new u.ErrorBoundary(t,i,r),this.Ct.wrap(this),this.Ct.wrap(n),this.Ct.wrap(e),this.Ct.wrap(this.Pt),(0,c.Et)()&&(null!=(n=null!=(r=(o=(0,s.i)()).instances)?r:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),n[t]=this,o.lastInstance=this,o.instances=n,__STATSIG__=o),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.Ft()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.v.disableLogging=t.disableLogging,this.Pt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.v.disableStorage=t.disableStorage,d.Storage.Nt(t.disableStorage))}flush(){return this.Pt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Pt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[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.Ct.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Gt[n.name]&&this.Gt[n.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Kt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Pt.incrementNonExposureCount(t):this.Pt.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.Lt=e.qt=e.Jt=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.Jt=(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.qt=(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.Lt=(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.42";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.Vt=e.zt=e.Bt=e.$t=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.$t=function(t,e,n){return r(t,e,n,!0===(null==n?void 0:n.value))},e.Bt=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.zt=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.Vt=function(t,e,n,i){return $P($P($P({},t),e),{get:s(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e)=>{$Q(e),e.getUnitIDFromUser=e.T=void 0,e.T=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.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,n,e){var i=this&&this.__awaiter||$A(),o=($Q2(n,"__esModule",{value:!0}),n.U=n.P=n.Storage=void 0,e(780)),e=e(48);const r={},s=t=>Promise.resolve(t),u={Ht:()=>"InMemory",N:t=>r[t]||null,Wt:t=>s(r[t]||null),C:(t,e)=>(r[t]=e,s()),F:t=>(delete r[t],s()),Yt:()=>s(Object.keys(r))};let l=null;try{const h=(0,e.It)();h&&h.localStorage&&"function"==typeof h.localStorage.getItem&&(l={Ht:()=>"LocalStorage",N:t=>h.localStorage.getItem(t),Wt:t=>s(h.localStorage.getItem(t)),C:(t,e)=>(h.localStorage.setItem(t,e),s()),F:t=>(h.localStorage.removeItem(t),s()),Yt:()=>s(Object.keys(h.localStorage))})}catch(t){o.Log.warn("Failed to setup localStorageProvider.")}let a=null!==l&&void 0!==l?l:u,c=a;function d(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.Qt(u),null;throw t}}n.Storage={Ht:()=>c.Ht(),Wt:t=>i(void 0,void 0,void 0,function*(){return d(()=>c.Wt(t))}),N:t=>d(()=>c.N?c.N(t):null),C:(t,e)=>c.C(t,e),F:t=>c.F(t),Yt:()=>c.Yt(),Qt:t=>{a=t,c=t},Nt:t=>{c=t?u:a}},n.P=function(e){return i(this,void 0,void 0,function*(){var t=yield n.Storage.Wt(e);return JSON.parse(null!=t?t:"null")})},n.U=function(t,e){return i(this,void 0,void 0,function*(){yield n.Storage.C(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),e.ui=void 0;const o=n(780);e.ui=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return o.Log.error("Failed to parse "+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.it=void 0,e.it=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.Xt=e.st=e.ti=e._t=void 0;n=n(48);const i="foreground",o="background",r=[];let s=i,u=!1;e._t=()=>s===i,e.ti=()=>u,e.st=t=>{r.unshift(t)};e.Xt=e=>{e!==s&&(s=e,r.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>{(u=!1,e.Xt)(i)}),(0,n.Dt)("blur",()=>(0,e.Xt)(o)),(0,n.Dt)("beforeunload",()=>{u=!0,(0,e.Xt)(o)}),(0,n.xt)("visibilitychange",()=>{(0,e.Xt)("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]}}),$Q2(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=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return r.EventLogger}}),n(780));$Q2(e,"Log",{enumerable:!0,get:function(){return s.Log}});var u=n(972);const l=n(444);$Q2(e,"Storage",{enumerable:!0,get:function(){return l.Storage}}),o(n(496),e),o(n(707),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__:{}),{Log:s.Log,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.It)(),r=(0,d.kt)();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.ai=void 0;const i=n(464);function o(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.ai=function(t,e){var n;return(e=(0,i.ui)(e,"checksum","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.li)({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.Zt=null,this.te=null,this.ee="Uninitialized",this.ie=0,this.ne=0}reset(){this.te=null,this.Zt=null,this.ee="Loading",this.ie=0,this.ne=0}finalize(){this.te||(this.ee="NoValues")}getValues(){return this.Zt?(0,i.ui)(this.Zt,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;t&&!0===(null==(e=(0,i.ui)(t.data,"has_updates","EvaluationResponse"))?void 0:e.has_updates)&&(this.Zt=t.data,this.ie=e.time,this.ne=t.receivedAt,this.ee=t.source,this.te=e)}getGate(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.feature_gates[t])?e:null;return this.se(t)}getConfig(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.dynamic_configs[t])?e:null;return this.se(t)}getLayer(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.layer_configs[t])?e:null;return this.se(t)}se(t){return{evaluation:t,details:this.re(null==t)}}re(t){return"Uninitialized"===this.ee||"NoValues"===this.ee?{reason:this.ee}:{reason:this.ee+":"+(t?"Unrecognized":"Recognized"),lcut:this.ie,receivedAt:this.ne}}}},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.oe=(0,u.it)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(n,i,o,r){return s(this,void 0,void 0,function*(){var t=i?(0,u.ui)(i,"has_updates","InitializeResponse"):null;let e={user:r,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.ue(n,t,e,o)})}ue(e,n,i,o){var r;return s(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.oe,data:i,retries:2,isStatsigEncodable:!0,priority:o});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(r=null==t?void 0:t.body)?r:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,l.ai)(n,t.body))?t:this.ue(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}),o)})}}e.default=i},520:function(t,e,n){var o=this&&this.__awaiter||$A();$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((0,s.Et)()?"Unable to find StatsigClient instance":"StatsigClient.instance is not supported in server environments"),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.le=new r.default,this.ae=e}initializeSync(){this.updateUserSync(this.ae)}initializeAsync(t){return this.updateUserAsync(this.ae,t)}updateUserSync(t){this.ce(t);t=this.dataAdapter.getDataSync(this.ae);this.le.setValues(t),this.de(t),this.he(null!=t?t:null,this.ae)}updateUserAsync(n,i){return o(this,void 0,void 0,function*(){this.ce(n);var t=this.ae,e=this.dataAdapter.getDataSync(t);this.Ut("Loading",e),this.le.setValues(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.ae&&(this.le.setValues(e),this.de(e))})}getContext(){return{sdkKey:this._,options:this.v,values:this.le.getValues(),user:JSON.parse(JSON.stringify(this.ae)),errorBoundary:this.Ct}}getAsyncContext(){return o(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield s.StatsigSession.get(this._),stableID:yield s.StableID.get(this._)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,s.oi)(t),{evaluation:n,details:i}=this.le.getGate(n),i=(0,s.$t)(t,i,n),o=null==(o=null==(n=this.Rt)?void 0:n.getGateOverride)?void 0:o.call(n,i,this.ae,e),n=null!=o?o:i;return this.Kt(t,(0,s.Jt)(this.ae,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.ve("dynamic_config",t,e);return this.$emt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.ve("experiment",t,e);return this.$emt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n){var t=(0,s.oi)(e),{evaluation:t,details:i}=this.le.getLayer(t),i=(0,s.zt)(e,i,t),o=null==(o=null==(t=this.Rt)?void 0:t.getLayerOverride)?void 0:o.call(t,i,this.ae,n);const r=(0,s.Vt)(i,o,null!=(t=null==o?void 0:o.__value)?t:i.__value,t=>{this.Kt(e,(0,s.Lt)(this.ae,r,t),n)});return this.$emt({name:"layer_evaluation",layer:r}),r}logEvent(t,e,n){this.Pt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.ae,time:Date.now()}))}Ft(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.de(null)})}de(t){this.le.finalize(),this.Ut("Ready",t)}he(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{s.Log.error("An error occurred after update.",t)})}ce(t){this.Pt.reset(),this.le.reset(),this.ae=(0,s.T)(t,this.v.environment);t=null==(t=this.ae.customIDs)?void 0:t.stableID;t&&s.StableID.setOverride(t,this._)}ve(t,e,n){var i=(0,s.oi)(e),{evaluation:i,details:o}=this.le.getConfig(i),o=(0,s.Bt)(e,o,i),i="experiment"===t?null==(t=null==(i=this.Rt)?void 0:i.getExperimentOverride)?void 0:t.call(i,o,this.ae,n):null==(i=null==(t=this.Rt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,o,this.ae,n),t=null!=i?i:o;return this.Kt(e,(0,s.qt)(this.ae,t),n),t}}e.default=i},364:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const i=n(464),o=n(400);class s extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.V=null,this.v=null}attach(t,e){super.attach(t,e),this.V=new o.default(null!=e?e:{})}getDataAsync(t,e,n){return this.I(t,e,n)}prefetchData(t,e){return this.M(t,e)}D(e,n,i){var o;return r(this,void 0,void 0,function*(){var t=yield null==(o=this.V)?void 0:o.fetchEvaluations(this.G(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}m(t){t=(0,i.o)(this.G(),t,null==(t=this.v)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.h}.`+t}}e.StatsigEvaluationsDataAdapter=s},208:(t,e,n)=>{$Q(e),e.StatsigClient=void 0;n=n(520);e.StatsigClient=n.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:n.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),o=n(76),r=n(724);e.runStatsigAutoCapture=function(t){return new u(t)};class u{constructor(t){this._e=t,this.Ge=Date.now(),this.Ne=0;var e,{sdkKey:t,errorBoundary:n}=t.getContext(),n=(this.Ct=n,this.Ct.wrap(this),(0,s.kt)());(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.Ce()):this.Ce()}Re(){const e=(0,s.It)();var t,n=(0,s.kt)();e&&n&&(t=t=>{this.Pe(t||e.event)},(0,o.Fe)(n,"click",t),(0,o.Fe)(n,"submit",t),(0,o.Fe)(e,"error",t),(0,o.Fe)(e,"beforeunload",()=>this.Ue()),(0,o.Fe)(e,"scroll",()=>this.Ke()))}Pe(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.Le(t):(e=(0,o.qe)(t))&&(0,o.ot)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,o.Je)(e),this.Ve(n,t,e))}Ce(){this.Re(),this.ze(),this.Be()}Le(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.Ve("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}ze(){setTimeout(()=>{var t=(0,o.$e)(),t=(0,r.cn)(t);this.Ve("page_view",(0,o.He)(),t,{flushImmediately:!0,addNewSessionMetadata:!0})},1)}Be(){const n=(0,s.It)();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.Ve("performance",(0,o.He)(),t)},1)}Ue(){this.Ve("page_view_end",(0,o.He)(),{scrollDepth:this.Ne,pageViewLength:Date.now()-this.Ge},{flushImmediately:!0})}Ve(n,i,o,r){this.We().then(t=>{var e=$P({sessionID:t.data.sessionID,page_url:null!=(e=null==(e=null==(e=(0,s.It)())?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._e.logEvent(t),null!=r&&r.flushImmediately&&this._e.flush().catch(t=>{s.Log.error(t)})}).catch(t=>{this.Ct.logError("AC::enqueue",t)})}Ke(){var t=null!=(t=null==(t=(0,s.kt)())?void 0:t.body.scrollHeight)?t:1,e=(0,s.It)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ne=Math.max(this.Ne,Math.min(100,Math.round((n+e)/t*100)))}We(){return i(this,void 0,void 0,function*(){return(yield this._e.getAsyncContext()).session})}}e.AutoCapture=u},76:(t,e,n)=>{$Q(e),e.Fe=e.He=e.$e=e.ot=e.qe=e.Je=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.Je=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.qe=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.ot=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.$e=function(){var t=null!=(t=null==(t=null==(t=(0,i.It)())?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.He=function(){return(0,i.yt)()||""},e.Fe=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);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),$Q2(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__},724:(t,e,n)=>{$Q(e),e.cn=void 0;const a=n(464);e.cn=function(t){var e=(0,a.kt)(),n=(0,a.It)();if(!e||!n)return{};var i=null==n?void 0:n.navigator,o=(null==e?void 0:e.referrer)||"";let r=new URL("empty:");if(o)try{r=new URL(o||"empty:")}catch(t){}u=r,s=function(t){const e=t.hostname,n=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return n||""}(u),u=u.searchParams.get("yahoo"===s?"p":"q")||"";var s={searchEngine:s,searchQuery:u},u=function(t){const n=t.searchParams,i={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","gclsrc","dclid","fbclid","msclkid","mc_eid","mc_cid","twclid","li_fat_id","igshid","utm_id","ttc","ttclid","ttc_id"].forEach(t=>{var e=n.get(t);e&&(i[t]=e)}),i}(t);const l={};return t.searchParams.forEach((t,e)=>{l[e]=t}),$P($P($P($P({},s),u),l),{title:(null==e?void 0:e.title)||"",locale:(null==i?void 0:i.language)||"unknown",referrer:o,screen_width:(null==(t=null==n?void 0:n.screen)?void 0:t.width)||"unknown",screen_height:(null==(s=null==n?void 0:n.screen)?void 0:s.height)||"unknown",viewport_width:(null==n?void 0:n.innerWidth)||"unknown",viewport_height:(null==n?void 0:n.innerHeight)||"unknown"})}}},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})()); |
{ | ||
"name": "@statsig/js-client", | ||
"version": "0.0.1-beta.41", | ||
"version": "0.0.1-beta.42", | ||
"dependencies": { | ||
"@statsig/client-core": "0.0.1-beta.41" | ||
"@statsig/client-core": "0.0.1-beta.42" | ||
}, | ||
@@ -7,0 +7,0 @@ "jsdelivr": "./build/statsig-js-client.min.js", |
@@ -9,3 +9,3 @@ import { InitializeResponseWithUpdates } from '@statsig/client-core'; | ||
type DeltasResult = string | DeltasFailureInfo | null; | ||
export declare function resolveDeltasResponse(cache: InitializeResponseWithUpdates, deltasString: string): DeltasResult; | ||
export declare function _resolveDeltasResponse(cache: InitializeResponseWithUpdates, deltasString: string): DeltasResult; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resolveDeltasResponse = void 0; | ||
exports._resolveDeltasResponse = void 0; | ||
const client_core_1 = require("@statsig/client-core"); | ||
function resolveDeltasResponse(cache, deltasString) { | ||
const deltas = (0, client_core_1.typedJsonParse)(deltasString, 'checksum', 'Failed to parse DeltasEvaluationResponse'); | ||
function _resolveDeltasResponse(cache, deltasString) { | ||
const deltas = (0, client_core_1._typedJsonParse)(deltasString, 'checksum', 'DeltasEvaluationResponse'); | ||
if (!deltas) { | ||
@@ -14,3 +14,3 @@ return { | ||
const resolved = _handleDeletedEntries(merged); | ||
const actualChecksum = (0, client_core_1.DJB2Object)({ | ||
const actualChecksum = (0, client_core_1._DJB2Object)({ | ||
feature_gates: resolved.feature_gates, | ||
@@ -31,3 +31,3 @@ dynamic_configs: resolved.dynamic_configs, | ||
} | ||
exports.resolveDeltasResponse = resolveDeltasResponse; | ||
exports._resolveDeltasResponse = _resolveDeltasResponse; | ||
function _mergeDeltasIntoCache(cache, deltas) { | ||
@@ -34,0 +34,0 @@ return Object.assign(Object.assign(Object.assign({}, cache), deltas), { feature_gates: Object.assign(Object.assign({}, cache.feature_gates), deltas.feature_gates), layer_configs: Object.assign(Object.assign({}, cache.layer_configs), deltas.layer_configs), dynamic_configs: Object.assign(Object.assign({}, cache.dynamic_configs), deltas.dynamic_configs) }); |
@@ -8,6 +8,6 @@ import { DataAdapterResult, DetailedEvaluation, DynamicConfigEvaluation, GateEvaluation, InitializeResponseWithUpdates, LayerEvaluation } from '@statsig/client-core'; | ||
private _receivedAt; | ||
getValues(): InitializeResponseWithUpdates | null; | ||
reset(): void; | ||
finalize(): void; | ||
setValuesFromDataAdapter(result: DataAdapterResult | null): void; | ||
getValues(): InitializeResponseWithUpdates | null; | ||
setValues(result: DataAdapterResult | null): void; | ||
getGate(name: string): DetailedEvaluation<GateEvaluation>; | ||
@@ -14,0 +14,0 @@ getConfig(name: string): DetailedEvaluation<DynamicConfigEvaluation>; |
@@ -12,7 +12,2 @@ "use strict"; | ||
} | ||
getValues() { | ||
return this._rawValues | ||
? (0, client_core_1.typedJsonParse)(this._rawValues, 'has_updates', 'Failed to parse EvaluationStoreValues') | ||
: null; | ||
} | ||
reset() { | ||
@@ -31,7 +26,12 @@ this._values = null; | ||
} | ||
setValuesFromDataAdapter(result) { | ||
getValues() { | ||
return this._rawValues | ||
? (0, client_core_1._typedJsonParse)(this._rawValues, 'has_updates', 'EvaluationStoreValues') | ||
: null; | ||
} | ||
setValues(result) { | ||
if (!result) { | ||
return; | ||
} | ||
const values = (0, client_core_1.typedJsonParse)(result.data, 'has_updates', 'Failed to parse EvaluationResponse'); | ||
const values = (0, client_core_1._typedJsonParse)(result.data, 'has_updates', 'EvaluationResponse'); | ||
if ((values === null || values === void 0 ? void 0 : values.has_updates) !== true) { | ||
@@ -38,0 +38,0 @@ return; |
import { StatsigGlobal } from '@statsig/client-core'; | ||
import StatsigClient from './StatsigClient'; | ||
import { StatsigEvaluationsDataAdapter } from './StatsigEvaluationsDataAdapter'; | ||
import type { StatsigOptions } from './StatsigOptions'; | ||
export type { StatsigEnvironment, StatsigEvent, StatsigUser, InitializeResponse, } from '@statsig/client-core'; | ||
export { StatsigEvaluationsDataAdapter, StatsigClient, StatsigOptions }; | ||
export { StatsigClient, StatsigOptions }; | ||
declare const _default: StatsigGlobal; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.StatsigClient = exports.StatsigEvaluationsDataAdapter = void 0; | ||
exports.StatsigClient = void 0; | ||
const StatsigClient_1 = require("./StatsigClient"); | ||
exports.StatsigClient = StatsigClient_1.default; | ||
const StatsigEvaluationsDataAdapter_1 = require("./StatsigEvaluationsDataAdapter"); | ||
Object.defineProperty(exports, "StatsigEvaluationsDataAdapter", { enumerable: true, get: function () { return StatsigEvaluationsDataAdapter_1.StatsigEvaluationsDataAdapter; } }); | ||
__STATSIG__ = Object.assign(Object.assign({}, (__STATSIG__ !== null && __STATSIG__ !== void 0 ? __STATSIG__ : {})), { StatsigEvaluationsDataAdapter: StatsigEvaluationsDataAdapter_1.StatsigEvaluationsDataAdapter, | ||
StatsigClient: StatsigClient_1.default }); | ||
__STATSIG__ = Object.assign(Object.assign({}, (__STATSIG__ !== null && __STATSIG__ !== void 0 ? __STATSIG__ : {})), { StatsigClient: StatsigClient_1.default }); | ||
exports.default = __STATSIG__; |
@@ -23,3 +23,3 @@ "use strict"; | ||
const cache = current | ||
? (0, client_core_1.typedJsonParse)(current, 'has_updates', 'Failed to parse cached EvaluationResponse') | ||
? (0, client_core_1._typedJsonParse)(current, 'has_updates', 'InitializeResponse') | ||
: null; | ||
@@ -58,3 +58,3 @@ let data = { | ||
} | ||
const result = (0, EvaluationResponseDeltas_1.resolveDeltasResponse)(cache, response.body); | ||
const result = (0, EvaluationResponseDeltas_1._resolveDeltasResponse)(cache, response.body); | ||
if (typeof result === 'string') { | ||
@@ -61,0 +61,0 @@ return result; |
@@ -86,3 +86,3 @@ "use strict"; | ||
const result = this.dataAdapter.getDataSync(this._user); | ||
this._store.setValuesFromDataAdapter(result); | ||
this._store.setValues(result); | ||
this._finalizeUpdate(result); | ||
@@ -108,3 +108,3 @@ this._runPostUpdate(result !== null && result !== void 0 ? result : null, this._user); | ||
this._setStatus('Loading', result); | ||
this._store.setValuesFromDataAdapter(result); | ||
this._store.setValues(result); | ||
result = yield this.dataAdapter.getDataAsync(result, initiator, options); | ||
@@ -115,3 +115,3 @@ // ensure the user hasn't changed while we were waiting | ||
} | ||
this._store.setValuesFromDataAdapter(result); | ||
this._store.setValues(result); | ||
this._finalizeUpdate(result); | ||
@@ -165,3 +165,3 @@ }); | ||
var _a, _b; | ||
const hash = (0, client_core_1.DJB2)(name); | ||
const hash = (0, client_core_1._DJB2)(name); | ||
const { evaluation, details } = this._store.getGate(hash); | ||
@@ -208,3 +208,3 @@ const gate = (0, client_core_1._makeFeatureGate)(name, details, evaluation); | ||
var _a, _b, _c; | ||
const hash = (0, client_core_1.DJB2)(name); | ||
const hash = (0, client_core_1._DJB2)(name); | ||
const { evaluation, details } = this._store.getLayer(hash); | ||
@@ -253,9 +253,14 @@ const layer = (0, client_core_1._makeLayer)(name, details, evaluation); | ||
_resetForUser(user) { | ||
var _a; | ||
this._logger.reset(); | ||
this._store.reset(); | ||
this._user = (0, client_core_1._normalizeUser)(user, this._options.environment); | ||
const stableIdOverride = (_a = this._user.customIDs) === null || _a === void 0 ? void 0 : _a.stableID; | ||
if (stableIdOverride) { | ||
client_core_1.StableID.setOverride(stableIdOverride, this._sdkKey); | ||
} | ||
} | ||
_getConfigImpl(kind, name, options) { | ||
var _a, _b, _c, _d; | ||
const hash = (0, client_core_1.DJB2)(name); | ||
const hash = (0, client_core_1._DJB2)(name); | ||
const { evaluation, details } = this._store.getConfig(hash); | ||
@@ -262,0 +267,0 @@ const config = (0, client_core_1._makeDynamicConfig)(name, details, evaluation); |
Sorry, the diff of this file is too big to display
225545
997
+ Added@statsig/client-core@0.0.1-beta.42(transitive)
- Removed@statsig/client-core@0.0.1-beta.41(transitive)