@statsig/js-client
Advanced tools
Comparing version 3.11.1 to 3.12.0
@@ -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 $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 i={1845:(t,i,e)=>{var n;$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.l=void 0;const s=e(7512);i.l=()=>__STATSIG__||u,i.i=t=>(0,i.l)()[t];i.t=t=>{var e=(0,i.l)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var r="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=l[r])?n:e[r])?n:o[r])?n:{instance:i.t};l[r]=u,e[r]=u,o[r]=u},2137:(t,e,i)=>{$Q(e),e.o=e.u=void 0;const s=i(1406);function n(t,e,i){if(i)return i(t,e);const n=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(i=null==e?void 0:e.userID)?i:""),"cids:"+Object.keys(n).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+n[t]).join(","),"k:"+t];return(0,s.h)(e.join("|"))}e.u=n,e.o=function(t,e,i){return e?n(t,e,i):(0,s.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const u=i(7512),a=i(9122),r=i(8578),l=i(4534),c=i(3401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,r.v)(n)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.p=e,this.m=null,this.O=null,this.j="statsig.last_modified_time."+e,this.S=new n}attach(t,e){this.O=t,this.m=e}getDataSync(t){var t=t&&(0,r.T)(t,this.m),e=this.k(t),i=this.S.get(e,t);return i||((i=this.I(e))?(this.S.add(e,i),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,r.T)(e,this.m),i=this.k(e);this.S.add(i,h("Bootstrap",t,null,e))}D(e,i,n){return s(this,void 0,void 0,function*(){l.Storage.isReady()||(yield l.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.M(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}A(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.T)(i,this.m),e=this.k(t),t=yield this.D(null,t,n);t&&this.S.add(e,$P($P({},t),{source:"Prefetch"}))})}M(r,l,o){return s(this,void 0,void 0,function*(){let t=null;r&&this.N(r,l)&&(t=r.data);var e=yield this.R(t,l,o);if(!e)return u.Log.debug("No response returned for latest value"),null;var i=(0,c.P)(e,"has_updates","Response"),n=this.C(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,l);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,l)}e=this.k(l);return this.S.add(e,s),this.U(e,s),s})}C(){return null!=this.O?this.O:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}U(t,e){l.Storage.setItem(t,JSON.stringify(e)),this.F(t)}F(t){var e=null!=(e=(0,l.G)(this.j))?e:{},t=(e[t]=Date.now(),o(e,10));t&&(delete e[t],l.Storage.removeItem(t)),(0,l.L)(this.j,e)}};class n{constructor(){this.K={}}get(t,e){var t=this.K[t],i=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&i&&e!==i?(u.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=o(this.K,9);i&&delete this.K[i],this.K[t]=e}merge(t){this.K=$P($P({},this.K),t)}}function o(s,t){var e=Object.keys(s);return e.length<=t?null:e.reduce((t,e)=>{var i=s[t],n=s[e];return"object"==typeof i&&"object"==typeof n?n.receivedAt<i.receivedAt?e:t:n<i?e:t})}},8962:(t,l)=>{$Q2(l,"__esModule",{value:!0}),l.Diagnostics=void 0;const n=new Map,i="start";function s(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function r(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}l.Diagnostics={q:t=>n.get(t),B:t=>{r(t,s({},i,"overall"))},V:(t,e,i)=>{r(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},J:(t,e)=>{r(t,s(e,i,"initialize","network_request"))},$:(t,e)=>{r(t,s(e,"end","initialize","network_request"))},W:t=>{r(t,s({},i,"initialize","process"))},H:(t,e)=>{r(t,s(e,"end","initialize","process"))},Y:t=>{n.delete(t)},X(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Z(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:l.Diagnostics.X(n)}},tt(t,e,i,n){var s,r=l.Diagnostics.q(i);return null==r||r.length<=0?-1:(s=r[r.length-1].timestamp-r[0].timestamp,l.Diagnostics.Y(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:r.slice(),statsigOptions:n}),e.enqueue(i),s)}}},8809:function(t,e){var i=this&&this.__awaiter||$A();$Q(e),e.et=void 0;const s=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),r="https://cloudflare-dns.com/dns-query",l=["i","e","d"],o=200;e.et=function(e){return i(this,void 0,void 0,function*(){var i=yield e(r,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:s});if(i.ok){var t,i=yield i.arrayBuffer(),i=new Uint8Array(i);{var n=i,i=n.findIndex((t,e)=>e<o&&"="===String.fromCharCode(t)&&l.includes(String.fromCharCode(n[e-1])));if(-1===i)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=i-1;t<n.length;t++)e+=String.fromCharCode(n[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},3539:(t,e)=>{$Q(e)},5542:function(t,o,e){var i=this&&this.__awaiter||$A();$Q2(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const n=e(7512),u=e(5902),a=e(8e3),c=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");function h(t){return t instanceof Error?t:"string"==typeof t?new Error(t):new Error("An unknown error occurred.")}o.ErrorBoundary=class{constructor(t,e,i,n){this.O=t,this.m=e,this.nt=i,this.qn=n,this.it=new Set}wrap(n){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.rt(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.st("eb:wrap",t)}}logError(t,e){this.st(t,e)}getLastSeenErrorAndReset(){var t=this.qn;return this.qn=void 0,null!=t?t:null}attachErrorIfNoneExists(t){this.qn||(this.qn=h(t))}rt(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.st(e,t)):i}catch(t){return this.st(e,t),null}}st(r,l){try{n.Log.warn("Caught error in "+r,{error:l});i(this,void 0,void 0,function*(){var t,e=l||Error(c),i=e instanceof Error,n=i?e.name:"No Name",s=h(e);this.qn=s,this.it.has(n)||(this.it.add(n),null!=(s=null==(s=this.m)?void 0:s.networkConfig)&&s.preventAllNetworkTraffic?null!=(s=this.nt)&&s.call(this,{name:"error",error:l,tag:r}):(s=u.SDKType.lt(this.O),t=a.StatsigMetadataProvider.get(),i=i?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(e),e=JSON.stringify($P({tag:r,exception:n,info:i},$P($P({},t),{sdkType:s}))),yield(null!=(n=null==(i=null==(n=this.m)?void 0:n.networkConfig)?void 0:i.networkOverrideFunc)?n:fetch)(o.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.O,"STATSIG-SDK-TYPE":String(s),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=(i=this.nt)&&i.call(this,{name:"error",error:l,tag:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(2137),r=i(1406),l=i(7512),o=i(7410),u=i(6830),a=i(1637),c=i(4534),h=i(1881),d=i(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static ot(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static ut(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.O=t,this.nt=e,this.ht=i,this.m=n,this.dt=[],this.vt={},this.ft={},this._t=!1,this.gt=Date.now(),this.bt=!0===(null==n?void 0:n.disableLogging),this.yt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:100;e=null==n?void 0:n.networkConfig;this.Ot=new h.UrlConfiguration(o.Endpoint.jt,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}setLoggingDisabled(t){this.bt=t}enqueue(t){this.St(t)&&(this.wt(t),this.Tt(),this.dt.length>this.yt)&&_.ot(this.O)}incrementNonExposureCount(t){var e=null!=(e=this.ft[t])?e:0;this.ft[t]=e+1}reset(){this.vt={}}start(){(0,u.kt)()||(v[this.O]=this,(0,d.It)(t=>{"background"===t?_.ot(this.O):"foreground"===t&&_.ut(this.O)}),this.ct(f.Startup),this.Dt())}stop(){return n(this,void 0,void 0,function*(){this.Et&&(clearInterval(this.Et),this.Et=null),delete v[this.O],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.Mt(),0!==this.dt.length&&(t=this.dt,this.dt=[],yield this.At(t))})}Tt(){this._t||(this._t=!0,200<Date.now()-this.gt)||setTimeout(()=>_.ot(this.O),200)}St(t){if((0,u.kt)())return!1;if((0,a.xt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.u)(this.O,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID,i.allocatedExperiment,i.parameterName,String(i.isExplicitParameter),i.reason].join("|"),e=this.vt[t],i=Date.now();if(e&&i-e<6e5)return!1;1e3<Object.keys(this.vt).length&&(this.vt={}),this.vt[t]=i}return!0}At(t){var e,i;return n(this,void 0,void 0,function*(){if(this.bt)return this.Nt(t),!1;try{return((0,d.Rt)()&&this.ht.isBeaconSupported()&&null==(null==(i=null==(e=this.m)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.Pt(t):yield this.Ct(t)).success?(this.nt({name:"logs_flushed",events:t}),!0):(l.Log.warn("Failed to flush events."),this.Nt(t),!1)}catch(t){return l.Log.warn("Failed to flush events."),!1}})}Ct(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.ht.post(this.Ut(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}Pt(t){return n(this,void 0,void 0,function*(){return{success:yield this.ht.beacon(this.Ut(t))}})}Ut(t){return{sdkKey:this.O,data:{events:t},urlConfig:this.Ot,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(t.length)}}}Nt(t){for(;1e3<t.length;)t.shift();var e=this.o();try{(0,c.L)(e,t)}catch(t){l.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.o();n(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.G)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.At(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{l.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,r.h)(this.O)}wt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.Ft(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));l.Log.debug("Enqueued Event:",i),this.dt.push(i)}Mt(){0!==Object.keys(this.ft).length&&(this.wt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.ft)}}),this.ft={})}Ft(){var t;if(!1!==(null==(t=this.m)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.Gt)()}Dt(){var t=null!=(t=null==(t=this.m)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{var t=v[this.O];t&&t.Et===e?_.ot(this.O):clearInterval(e)},t);this.Et=e}}e.EventLogger=_},1406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.Lt=r.Kt=r.h=void 0;const l=e(6634);r.h=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},r.Kt=(t,e)=>(0,r.h)(JSON.stringify((0,r.Lt)(t,e)));r.Lt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const s={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,l.zt)(e)?s[t]=e:s[t]=(0,r.Lt)(e,null!=n?n-1:n)}),s}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...t){this.level>=e.LogLevel.Info&&console.info(" INFO ",...i(t))}static debug(...t){this.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){this.level>=e.LogLevel.Warn&&console.warn(" WARN ",...i(t))}static error(...t){this.level>=e.LogLevel.Error&&console.error(" ERROR ",...i(t))}}(e.Log=n).level=e.LogLevel.Warn},7787:(t,e)=>{$Q(e),e.createMemoKey=e.MemoPrefix=void 0,e.MemoPrefix={Kn:"g",Ln:"c",Vn:"e",$n:"l",Bn:"p"};const r=new Set([]),l=new Set(["userPersistedValues"]);e.createMemoKey=function(t,e,i){let n=t+"|"+e;if(i)for(const s of Object.keys(i)){if(l.has(s))return;r.has(s)?n+=`|${s}=true`:n+=`|${s}=`+i[s]}return n}},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=e.Endpoint=void 0,e.Endpoint={qt:"initialize",jt:"rgstr",Bt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.jt]:"https://prodregistryv2.org/v1",[e.Endpoint.qt]:"https://featureassets.org/v1",[e.Endpoint.Bt]:"https://api.statsigcdn.com/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,i){var j=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const l=i(1845),S=i(8962),w=i(7512),k=i(7410),n=i(308),o=i(5902),u=i(6830),a=i(4143),c=i(9122),T=i(2636),h=i(8e3),D=i(2397),I=500,E=3e4;const x=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.nt=e,this.$t=null,this.Vt=1e4,this.Jt={},this.m={},this.Oi={},this.Jn=null,t&&(this.m=t),this.m.networkConfig&&(this.Jt=this.m.networkConfig),this.Jt.networkTimeoutMs&&(this.Vt=this.Jt.networkTimeoutMs),this.Wt=new n.NetworkFallbackResolver(this.m)}setErrorBoundary(t){this.$t=t,this.$t.wrap(this),this.$t.wrap(this.Wt),this.Wt.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){var t=this.Jn;return this.Jn=null,t}beacon(n){return j(this,void 0,void 0,function*(){var t,e,i;return!!M(n)&&(e=this.Ht("POST",n),t=yield this.Yt(e,n.data),e=yield this.Xt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return j(this,void 0,void 0,function*(){var t=this.Ht("POST",e);return t.body=yield this.Yt(t,e.data),e.isStatsigEncodable&&(t.body=this.Qt(t,t.body)),this.Zt(t)})}get(t){t=this.Ht("GET",t);return this.Zt(t)}Zt(p){var y,m,O;return j(this,void 0,void 0,function*(){if(!M(p))return null;if(this.Jt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:s}=p,t=p.urlConfig.endpoint;if(this.Si(t))return w.Log.warn(`Request to ${t} was blocked because you are making requests too frequently.`),null;s=null!=s?s:1;const r="undefined"!=typeof AbortController?new AbortController:null;var l=setTimeout(()=>{null!==r&&void 0!==r&&r.abort(`Timeout of ${this.Vt}ms expired.`)},this.Vt),o=yield this.Xt(p);let u=null;var a=(0,D.Rt)();try{var c,h,d,v={method:e,body:i,headers:$P({},p.headers),signal:null===r||void 0===r?void 0:r.signal,priority:p.priority,keepalive:a},f=(g=s,(b=p).urlConfig.endpoint===k.Endpoint.qt&&S.Diagnostics.J(b.sdkKey,{attempt:g}),this.Oi[t]),_=(f&&(f.lastRequestTime=Date.now(),this.Oi[t]=f),null!=(y=this.Jt.networkOverrideFunc)?y:fetch);if(u=yield _(o,v),clearTimeout(l),u.ok)return d=yield u.text(),N(p,u,s,d),this.Wt.tryBumpExpiryTime(p.sdkKey,p.urlConfig),{body:d,code:u.status};throw c=yield u.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${o} `+c)).name="NetworkError",h}catch(t){var g,i=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"}(r,t),a=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(r),b=(N(p,u,s,"",t),yield this.Wt.tryFetchUpdatedFallbackInfo(p.sdkKey,p.urlConfig,i,a));return(b&&(p.fallbackUrl=this.Wt.getActiveFallbackUrl(p.sdkKey,p.urlConfig)),!n||n<s||!x.has(null!=(m=null===u||void 0===u?void 0:u.status)?m:500))?(null!=(m=this.nt)&&m.call(this,{name:"error",error:t,tag:T.ErrorTag.NetworkError,requestArgs:p}),g=`A networking error occurred during ${e} request to ${o}.`,w.Log.error(g,i,t),null!=(O=this.$t)&&O.attachErrorIfNoneExists(g),null):(yield function(e){return j(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(I*(e*e),E)))})}(s),this.Zt($P($P({},p),{retries:n,attempt:s+1})))}})}Si(t){var e=Date.now(),i=null!=(i=this.Oi[t])?i:{count:0,lastRequestTime:e},n=e-i.lastRequestTime,n=Math.floor(.05*n);return i.count=Math.max(0,i.count-n),50<=i.count||(i.count+=1,i.lastRequestTime=e,this.Oi[t]=i,!1)}Xt(n){var s;return j(this,void 0,void 0,function*(){var t=null!=(s=n.fallbackUrl)?s:n.urlConfig.getUrl();n.urlConfig.endpoint!==k.Endpoint.qt&&n.urlConfig.endpoint!==k.Endpoint.Bt||(this.Jn=t);const e=$P({[k.NetworkParam.SdkKey]:n.sdkKey,[k.NetworkParam.SdkType]:o.SDKType.lt(n.sdkKey),[k.NetworkParam.SdkVersion]:h.SDK_VERSION,[k.NetworkParam.Time]:String(Date.now()),[k.NetworkParam.SessionID]:a.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Yt(s,r){return j(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=s,i=c.StableID.get(t),n=a.SessionID.get(t),t=o.SDKType.lt(t);return JSON.stringify($P($P({},r),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Qt(e,i){var t,n,s=(0,u.te)();if(this.m.disableStatsigEncoding||null!=(0,l.i)("no-encode")||null==s||!s.btoa)return i;try{var r=null!=(t=s.btoa(i).split("").reverse().join(""))?t:i;return e.params=$P($P({},null!=(n=e.params)?n:{}),{[k.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return w.Log.warn("Request encoding failed for "+e.urlConfig.getUrl()),i}}Ht(t,e){var i=this.Wt.getActiveFallbackUrl(e.sdkKey,e.urlConfig);return $P($P({},e),{method:t,fallbackUrl:i})}};const M=t=>!!t.sdkKey||(w.Log.warn("Unable to make request without an SDK key"),!1);function N(t,e,i,n,s){t.urlConfig.endpoint===k.Endpoint.qt&&S.Diagnostics.$(t.sdkKey,S.Diagnostics.Z(e,i,n,s))}},308:function(t,e,i){var u=this&&this.__awaiter||$A();$Q(e),e.ee=e.NetworkFallbackResolver=void 0;const o=i(8809),n=i(1406),r=i(7512),l=i(4534);function a(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function c(t){return"statsig.network_fallback."+(0,n.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.ne=null,this.$t=null,this.ie={},this.re=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.$t=t}tryBumpExpiryTime(t,e){var i=null==(i=this.ne)?void 0:i[e.endpoint];i&&(i.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ne),{[e.endpoint]:i})))}getActiveFallbackUrl(t,e){var i;let n=this.ne;null==n&&(n=null!=(s=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return r.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.ne=n);var s=n[e.endpoint];return!s||Date.now()>(null!=(i=s.expiryTime)?i:0)?(delete n[e.endpoint],this.ne=n,h(t,this.ne),null):s.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(i,n,s,r){var l,o;return u(this,void 0,void 0,function*(){try{var t,e;return a(s,r)?(t=null==n.customUrl&&null==n.fallbackUrls?yield this.se(n):n.fallbackUrls,!!(e=this.le(null==(l=this.ne)?void 0:l[n.endpoint],t))&&(this.oe(i,n.endpoint,e),!0)):!1}catch(t){return null!=(o=this.$t)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}oe(t,e,i){var i={url:i,expiryTime:Date.now()+6048e5,previous:[]},n=null==(n=this.ne)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.ne)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.ne=$P($P({},this.ne),{[e]:i}),h(t,this.ne)}se(r){var l;return u(this,void 0,void 0,function*(){var t=this.ie[r.endpoint];if(t&&Date.now()<t)return null;this.ie[r.endpoint]=Date.now()+144e5;var e=[],t=yield(0,o.et)(null!=(l=this.re)?l:fetch),i=d(r.defaultUrl);for(const s of t)if(s.startsWith(r.endpointDnsKey+"=")){var n=s.split("=");if(1<n.length){let t=n[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+i)}}return e})}le(t,e){var i;if(null==e)return null;var n=new Set(null!=(i=null==t?void 0:t.previous)?i:[]),s=null==t?void 0:t.url;let r=null;for(const o of e){var l=o.endsWith("/")?o.slice(0,-1):o;if(!n.has(o)&&l!==s){r=l;break}}return r}},e.ee=a},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},3091:(t,e)=>{$Q(e),e.SDKFlags=void 0;const i={};e.SDKFlags={setFlags:(t,e)=>{i[t]=e},get:(t,e)=>{return null!=(t=null==(t=i[t])?void 0:t[e])&&t}}},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={lt:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},ue(t,e){i[t]=e},ae(t){n&&"-react"!==n||(n="-"+t)}}},6830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.Gt=n.ce=n.he=n.kt=n.de=n.te=void 0;n.te=()=>"undefined"!=typeof window?window:null,n.de=()=>{var t=(0,n.te)();return null!=(t=null==t?void 0:t.document)?t:null},n.kt=()=>{var t;return null===(0,n.de)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.he=(t,e)=>{var i=(0,n.te)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.ce=(t,e)=>{var i=(0,n.de)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.Gt=()=>{var t;try{return null==(t=(0,n.te)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(2137),r=i(7512),l=i(4534),o=i(8023),u=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,n.o)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,l.G)(t)}(t);var i=Date.now();e=e||{sessionID:(0,o.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>u}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,o.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,l.L)(s,n)}catch(t){r.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=h(i,u),t.ageTimeoutID=h(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},9122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(2137),s=i(7512),r=i(4534),l=i(8023),o={};function u(t){return"statsig.stable_id."+(0,n.o)(t)}function a(t,e){e=u(e);try{(0,r.L)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==o[e]){let t=function(t){t=u(t);return(0,r.G)(t)}(e);null==t&&a(t=(0,l.getUUID)(),e),o[e]=t}return o[e]},setOverride:(t,e)=>{a(o[e]=t,e)}}},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const l=i(1845),o=i(5542),u=i(7770),a=i(7512),r=i(7787),c=i(6830),h=i(4143),d=i(4534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.ve=null,this.fe={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage._e(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.ge(n.storageProvider),this.O=t,this.m=null!=n?n:{},this.ji={},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.pe=new u.EventLogger(t,r,i,n),this.$t=new o.ErrorBoundary(t,n,r),this.$t.wrap(this),this.$t.wrap(e),this.$t.wrap(this.pe),i.setErrorBoundary(this.$t),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=d.Storage,this.be(),s=t,r=this,(0,c.kt)()||(i=(0,l.l)(),e=null!=(e=i.instances)?e:{},r=r,null!=e[s]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[s]=r,i.firstInstance||(i.firstInstance=r),i.instances=e,__STATSIG__=i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.m.disableLogging=t.disableLogging,this.pe.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.m.disableStorage=t.disableStorage,d.Storage._e(t.disableStorage))}flush(){return this.pe.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.me("Uninitialized",null),this.ve=null,yield this.pe.stop()})}on(t,e){this.fe[t]||(this.fe[t]=[]),this.fe[t].push(e)}off(t,e){this.fe[t]&&-1!==(e=this.fe[t].indexOf(e))&&this.fe[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.$t.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.fe[i.name]&&this.fe[i.name].forEach(t=>e(t)),null!=(t=this.fe["*"])&&t.forEach(e)}me(t,e){this.loadingStatus=t,this.ji={},this.$emt({name:"values_updated",status:t,values:e})}ye(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.pe.incrementNonExposureCount(t):this.pe.enqueue(e)}wi(n,s){return(t,e)=>{var i;return!this.m.disableEvaluationMemoization&&(i=(0,r.createMemoKey)(n,t,e))?(i in this.ji||(3e3<=Object.keys(this.ji).length&&(this.ji={}),this.ji[i]=s(t,e)),this.ji[i]):s(t,e)}}}},2636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Oe=e.je=e.Se=e.xt=void 0;const s="statsig::config_exposure",r="statsig::gate_exposure",u="statsig::layer_exposure",a=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:l(i,n),secondaryExposures:s,time:Date.now()});e.xt=({eventName:t})=>t===r||t===s||t===u,e.Se=(t,e)=>{var i,n={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),a(r,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])},e.je=(t,e)=>{var i,n={config:e.name,ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),null!=(null==(i=e.__evaluation)?void 0:i.passed)&&(n.rulePassed=String(e.__evaluation.passed)),a(s,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])};e.Oe=(t,e,i)=>{var n=e.__evaluation,s=!0===(null==(s=null==n?void 0:n.explicit_parameters)?void 0:s.includes(i));let r="",l=null!=(o=null==n?void 0:n.undelegated_secondary_exposures)?o:[];s&&(r=null!=(o=n.allocated_experiment_name)?o:"",l=n.secondary_exposures);var o={config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(s)};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(o.configVersion=e.__evaluation.version),a(u,t,e.details,o,l)};const l=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.11.1";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e)},1098:(t,e)=>{$Q(e)},2059:(t,e,i)=>{$Q(e),e.we=e.Te=e.ke=e.Ie=e.De=e.Ee=void 0;const l=i(7512),o=i(6634),s="default";function r(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function n(t,e,i){var n=null!=(n=null==i?void 0:i.value)?n:{};return $P($P({},r(t,e,i,n)),{get:u(t,null==i?void 0:i.value)})}function u(n,s,r){return(t,e)=>{var i=null!=(i=null==s?void 0:s[t])?i:null;return null==i?null!=e?e:null:null==e||(0,o.Me)(i,e)?(null!=r&&r(t),i):(l.Log.warn(`Parameter type mismatch. '${n}.${t}' was found to be type '${typeof i}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.Ee=function(t,e,i){return r(t,e,i,!0===(null==i?void 0:i.value))},e.De=n,e.Ie=function(t,e,i){return t=n(t,e,i),$P($P({},t),{groupName:null!=(e=null==i?void 0:i.group_name)?e:null})},e.ke=function(t,e,i,n){return $P($P({},r(t,e,i,void 0)),{get:u(t,null==i?void 0:i.value,n),groupName:null!=(e=null==i?void 0:i.group_name)?e:null,__value:null!=(t=null==i?void 0:i.value)?t:{}})},e.Te=function(t,e,i,n){return $P($P($P({},t),e),{get:u(t.name,i,n)})},e.we=u},1812:(t,e)=>{$Q(e)},3932:(t,e)=>{$Q(e),e.UPDATE_DETAIL_ERROR_MESSAGES=e.createUpdateDetails=void 0;e.createUpdateDetails=(t,e,i,n,s,r)=>({duration:i,source:e,success:t,error:n,sourceUrl:s,warnings:r}),e.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}},8578:(t,e,i)=>{$Q(e),e.v=e.T=void 0;const n=i(1406),s=i(7512);e.T=function(t,e,i){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment?n.statsigEnvironment=e.environment:null!=i&&(n.statsigEnvironment={tier:i}),n}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Kt)(t):null}},4534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.L=i.G=i.Storage=void 0;var n=e(7512),e=e(6830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let l=null;try{const a=(0,e.te)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(l={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let o=null!==l&&void 0!==l?l:r,u=o;i.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:t=>{var e=()=>u.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.ge(r),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),ge:t=>{o=t,u=t},_e:t=>{u=t?r:o}},i.G=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.L=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,i)=>{$Q(e),e.P=void 0;const s=i(7512);e.P=function(t,e,i){try{var n=JSON.parse(t);return"object"==typeof n&&0 in n,n}catch(t){}return s.Log.error("Failed to parse "+i),null}},6634:(t,e)=>{$Q(e),e.Me=e.zt=void 0,e.zt=function(t){return Array.isArray(t)?"array":typeof t},e.Me=function(t,e){var i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(e)}},8023:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="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<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},1881:(t,e,i)=>{$Q(e),e.UrlConfiguration=void 0;const s=i(7410),r={[s.Endpoint.qt]:"i",[s.Endpoint.jt]:"e",[s.Endpoint.Bt]:"d"};e.UrlConfiguration=class{constructor(t,e,i,n){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=r[t],e&&(this.customUrl=e),!e&&i&&(this.customUrl=i.endsWith("/")?""+i+t:i+"/"+t),n&&(this.fallbackUrls=n);e=s.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},2397:(t,e,i)=>{$Q(e),e.Ae=e.It=e.Rt=e.xe=void 0;i=i(6830);const n="foreground",s="background",r=[];let l=n,o=!1;e.xe=()=>l===n,e.Rt=()=>o,e.It=t=>{r.unshift(t)};e.Ae=e=>{e!==l&&(l=e,r.forEach(t=>t(e)))},(0,i.he)("focus",()=>{(o=!1,e.Ae)(n)}),(0,i.he)("blur",()=>(0,e.Ae)(s)),(0,i.he)("beforeunload",()=>{o=!0,(0,e.Ae)(s)}),(0,i.ce)("visibilitychange",()=>{(0,e.Ae)("visible"===document.visibilityState?n:s)})},6914:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),e.Storage=e.Log=e.EventLogger=e.Diagnostics=void 0,i(1845);const r=i(8962),l=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(7770)),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return l.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return o.Log}});var u=i(8e3);const a=i(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),s(i(1845),e),s(i(2137),e),s(i(6427),e),s(i(694),e),s(i(8962),e),s(i(3539),e),s(i(5542),e),s(i(2922),e),s(i(2417),e),s(i(1406),e),s(i(1333),e),s(i(7512),e),s(i(7787),e),s(i(7410),e),s(i(7023),e),s(i(1405),e),s(i(1361),e),s(i(6830),e),s(i(5902),e),s(i(4143),e),s(i(9122),e),s(i(1375),e),s(i(2636),e),s(i(3206),e),s(i(1637),e),s(i(8e3),e),s(i(586),e),s(i(1098),e),s(i(2059),e),s(i(1812),e),s(i(8578),e),s(i(4534),e),s(i(3401),e),s(i(6634),e),s(i(1881),e),s(i(8023),e),s(i(2397),e),s(i(3932),e),s(i(3091),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.Log,SDK_VERSION:u.SDK_VERSION})},9296:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),s(i(2018),e),e.default=__STATSIG__},7262:(t,e,i)=>{$Q(e),e.Ne=void 0;const n=i(6914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.Ne=function(t,e){var i;return(e=(0,n.P)(e,"checksum","DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),s((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.Kt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,i)=>{$Q(e);const s=i(6914);e.default=class{constructor(t){this.O=t,this.Re=null,this.Pe=null,this.Ce="Uninitialized",this.Ue=0,this.Fe=0,this.Ge=null,this.Le=new Set}reset(){this.Pe=null,this.Re=null,this.Ce="Loading",this.Ue=0,this.Fe=0,this.Ge=null}finalize(){this.Pe||(this.Ce="NoValues")}getValues(){return this.Re?(0,s.P)(this.Re,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.P)(t.data,"has_updates","EvaluationResponse"))&&(this.Ce=t.source,!0===(null==i?void 0:i.has_updates)&&(this.Re=t.data,this.Ue=i.time,this.Fe=t.receivedAt,this.Pe=i,this.Ge=this.Ke(t.source,i),t.source&&i.user&&this.ze(e,i),i.sdk_flags?s.SDKFlags.setFlags(this.O,i.sdk_flags):s.SDKFlags.setFlags(this.O,{})),!0)}getWarnings(){if(0!==this.Le.size)return Array.from(this.Le)}getGate(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.param_stores,t)}getSource(){return this.Ce}Ke(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}qe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Be(null==i)}}ze(t,e){var i,n=s.StableID.get(this.O);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.Le.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.Le.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.Ce||"NoValues"===this.Ce?{reason:this.Ce}:(t={reason:this.Ce,lcut:this.Ue,receivedAt:this.Fe},0<this.Le.size&&(t.warnings=Array.from(this.Le)),t)}Be(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.Ce&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.Ce&&null!=(n=this.Ge)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},8448:function(t,e,i){var l=this&&this.__awaiter||$A();$Q(e);const o=i(6914),u=i(7262);class n extends o.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Ve=new o.UrlConfiguration(o.Endpoint.qt,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(i,n,s,r){return l(this,void 0,void 0,function*(){var t=n?(0,o.P)(n,"has_updates","InitializeResponse"):null;let e={user:r,hash:"djb2",deltasResponseRequested:!1,full_checksum:null};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0,full_checksum:t.full_checksum})),this.Je(i,t,e,s)})}Je(e,i,n,s){var r;return l(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,urlConfig:this.Ve,data:n,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!=(r=null==t?void 0:t.body)?r:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,u.Ne)(i,t.body))?t:this.Je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},3583:(t,e,i)=>{$Q(e),e.$e=void 0;const g=i(6914),b={disableExposureLog:!0};function p(t){return null==t||!1===t.disableExposureLog}function y(t,e){return null!=e&&!(0,g.Me)(t,e)}e.$e=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,l,o,u,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.zt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,p(_)?void 0:b).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,u=e,a=_,y(c=(o=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&o.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,o=_,y(l=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(o)&&c.getExperiment(u.experiment_name),l);case"layer":return l=d,n=e,s=_,y(r=(i=v).getLayer(l.layer_name,b).get(l.param_name),n)?n:(p(s)&&i.getLayer(l.layer_name).get(l.param_name),r);default:return e}}}},8198:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e);const l=i(6914),o=i(4845),u=i(8448),s=i(3583),a=i(4131);class n extends l.StatsigClientBase{static instance(t){var e=(0,l.l)().instance(t);return e instanceof n?e:(l.Log.warn((0,l.kt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){l.SDKType.ue(t,"javascript-client");var n,s=new u.default(i,t=>{this.$emt(t)}),t=(super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,s,i),this.getFeatureGate=this.wi(l.MemoPrefix.Kn,this.Ti.bind(this)),this.getDynamicConfig=this.wi(l.MemoPrefix.Ln,this.Ii.bind(this)),this.getExperiment=this.wi(l.MemoPrefix.Vn,this.ki.bind(this)),this.getLayer=this.wi(l.MemoPrefix.$n,this.Di.bind(this)),this.getParameterStore=this.wi(l.MemoPrefix.Bn,this.Ri.bind(this)),this.We=new o.default(t),this.ht=s,this.He=this.xi(e,i),null!=(n=null==i?void 0:i.plugins)?n:[]);for(const r of t)r.bind(this)}initializeSync(t){var e;return"Uninitialized"!==this.loadingStatus?(0,l.createUpdateDetails)(!0,this.We.getSource(),-1,null,null,["MultipleInitializations",...null!=(e=this.We.getWarnings())?e:[]]):(this.pe.start(),this.updateUserSync(this.He,t))}initializeAsync(t){return r(this,void 0,void 0,function*(){return this.ve||(this.ve=this.Ye(t)),this.ve})}updateUserSync(t,e){var i=performance.now(),n=[...null!=(n=this.We.getWarnings())?n:[]],t=(this.Xe(t),this.dataAdapter.getDataSync(this.He)),e=(null==t&&n.push("NoCachedValues"),this.We.setValues(t,this.He),this.Qe(t),null==e?void 0:e.disableBackgroundCacheRefresh);return!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.Ze(null!=t?t:null,this.He),(0,l.createUpdateDetails)(!0,this.We.getSource(),performance.now()-i,this.$t.getLastSeenErrorAndReset(),this.ht.getLastUsedInitUrlAndReset(),n)}updateUserAsync(n,s){return r(this,void 0,void 0,function*(){this.Xe(n);var t=this.He,e=(l.Diagnostics.B(this.O),this.dataAdapter.getDataSync(t));if(this.We.setValues(e,this.He),this.me("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,s),t!==this.He)return(0,l.createUpdateDetails)(!1,this.We.getSource(),-1,new Error("User changed during update"),this.ht.getLastUsedInitUrlAndReset());let i=!1;null!=e&&(l.Diagnostics.W(this.O),i=this.We.setValues(e,this.He),l.Diagnostics.H(this.O,{success:i})),this.Qe(e),i||(this.$t.attachErrorIfNoneExists(l.UPDATE_DETAIL_ERROR_MESSAGES.NO_NETWORK_DATA),this.$emt({name:"initialization_failure"})),l.Diagnostics.V(this.O,i,this.We.getCurrentSourceDetails());t=l.Diagnostics.tt(this.He,this.pe,this.O,this.m);return(0,l.createUpdateDetails)(i,this.We.getSource(),t,this.$t.getLastSeenErrorAndReset(),this.ht.getLastUsedInitUrlAndReset(),this.We.getWarnings())})}getContext(){return{sdkKey:this.O,options:this.m,values:this.We.getValues(),user:JSON.parse(JSON.stringify(this.He)),errorBoundary:this.$t,session:l.StatsigSession.get(this.O),stableID:l.StableID.get(this.O)}}checkGate(t,e){return this.getFeatureGate(t,e).value}logEvent(t,e,i){this.pe.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.He,time:Date.now()}))}be(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Qe(null)})}Ye(t){return r(this,void 0,void 0,function*(){return l.Storage.isReady()||(yield l.Storage.isReadyResolver()),this.pe.start(),this.updateUserAsync(this.He,t)})}Qe(t){this.We.finalize(),this.me("Ready",t)}Ze(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{l.Log.error("An error occurred after update.",t)})}Xe(t){this.pe.reset(),this.We.reset(),this.He=this.xi(t,this.m)}xi(t,e){t=(0,l.T)(t,e),e=null==(e=t.customIDs)?void 0:e.stableID;return e&&l.StableID.setOverride(e,this.O),t}Ti(t,e){var{result:i,details:n}=this.We.getGate(t),n=(0,l.Ee)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.Se)(this.He,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}Ii(t,e){var{result:i,details:n}=this.We.getConfig(t),n=(0,l.De)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.je)(this.He,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}ki(t,e){var{result:i,details:n}=this.We.getConfig(t),n=(0,l.Ie)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.je)(this.He,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}Di(e,i){var{result:t,details:n}=this.We.getLayer(e),n=(0,l.ke)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.He,i);null!=i&&i.disableExposureLog&&this.pe.incrementNonExposureCount(e);const r=(0,l.Te)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{null!=i&&i.disableExposureLog||this.ye(e,(0,l.Oe)(this.He,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}Ri(t,e){var{result:i,details:n}=this.We.getParamStore(t);return this.pe.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,s.$e)(this,i,e)}}}e.default=n},4131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(6914),s=i(8448);class l extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.ht=null,this.m=null}attach(t,e){super.attach(t,e),this.ht=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.D(t,(0,n.T)(e,this.m),i)}prefetchData(t,e){return this.A(t,e)}setData(t){var e=(0,n.P)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,e){super.setData(t,e)}R(e,i,n){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.ht)?void 0:s.fetchEvaluations(this.C(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}k(t){t=(0,n.o)(this.C(),t,null==(t=this.m)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.p}.`+t}N(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=l},2018:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.StatsigClient=void 0,i(8198));e.StatsigClient=r.default,s(i(6914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:r.default}),e.default=__STATSIG__}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[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(9296).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 i={1845:(t,i,e)=>{var n;$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.l=void 0;const s=e(7512);i.l=()=>__STATSIG__||u,i.i=t=>(0,i.l)()[t];i.t=t=>{var e=(0,i.l)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var r="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=l[r])?n:e[r])?n:o[r])?n:{instance:i.t};l[r]=u,e[r]=u,o[r]=u},2137:(t,e,i)=>{$Q(e),e.o=e.u=void 0;const s=i(1406);function n(t,e,i){if(i)return i(t,e);const n=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(i=null==e?void 0:e.userID)?i:""),"cids:"+Object.keys(n).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+n[t]).join(","),"k:"+t];return(0,s.h)(e.join("|"))}e.u=n,e.o=function(t,e,i){return e?n(t,e,i):(0,s.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.Wn=e.DataAdapterCore=void 0;const u=i(7512),a=i(9122),r=i(8578),l=i(4534),c=i(3401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,r.v)(n)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.p=e,this.m=null,this.O=null,this.j="statsig.last_modified_time."+e,this.S=new n}attach(t,e){this.O=t,this.m=e}getDataSync(t){var t=t&&(0,r.T)(t,this.m),e=this.k(t),i=this.S.get(e,t);return i||((i=this.I(e))?(this.S.add(e,i),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,r.T)(e,this.m),i=this.k(e);this.S.add(i,h("Bootstrap",t,null,e))}D(e,i,n){return s(this,void 0,void 0,function*(){l.Storage.isReady()||(yield l.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.M(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}A(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.T)(i,this.m),e=this.k(t),t=yield this.D(null,t,n);t&&this.S.add(e,$P($P({},t),{source:"Prefetch"}))})}M(r,l,o){return s(this,void 0,void 0,function*(){let t=null;r&&this.N(r,l)&&(t=r.data);var e=yield this.R(t,l,o);if(!e)return u.Log.debug("No response returned for latest value"),null;var i=(0,c.P)(e,"has_updates","Response"),n=this.C(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,l);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,l)}e=this.k(l);return this.S.add(e,s),this.U(e,s),s})}C(){return null!=this.O?this.O:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}U(t,e){l.Storage.setItem(t,JSON.stringify(e)),this.F(t)}F(t){var e=null!=(e=(0,l.G)(this.j))?e:{},t=(e[t]=Date.now(),o(e,10));t&&(delete e[t],l.Storage.removeItem(t)),(0,l.L)(this.j,e)}},e.Wn=h;class n{constructor(){this.K={}}get(t,e){var t=this.K[t],i=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&i&&e!==i?(u.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=o(this.K,9);i&&delete this.K[i],this.K[t]=e}merge(t){this.K=$P($P({},this.K),t)}}function o(s,t){var e=Object.keys(s);return e.length<=t?null:e.reduce((t,e)=>{var i=s[t],n=s[e];return"object"==typeof i&&"object"==typeof n?n.receivedAt<i.receivedAt?e:t:n<i?e:t})}},8962:(t,l)=>{$Q2(l,"__esModule",{value:!0}),l.Diagnostics=void 0;const n=new Map,i="start";function s(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function r(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}l.Diagnostics={q:t=>n.get(t),B:t=>{r(t,s({},i,"overall"))},V:(t,e,i)=>{r(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},J:(t,e)=>{r(t,s(e,i,"initialize","network_request"))},$:(t,e)=>{r(t,s(e,"end","initialize","network_request"))},W:t=>{r(t,s({},i,"initialize","process"))},H:(t,e)=>{r(t,s(e,"end","initialize","process"))},Y:t=>{n.delete(t)},X(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Z(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:l.Diagnostics.X(n)}},tt(t,e,i,n){var s,r=l.Diagnostics.q(i);return null==r||r.length<=0?-1:(s=r[r.length-1].timestamp-r[0].timestamp,l.Diagnostics.Y(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:r.slice(),statsigOptions:n}),e.enqueue(i),s)}}},8809:function(t,e){var i=this&&this.__awaiter||$A();$Q(e),e.et=void 0;const s=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),r="https://cloudflare-dns.com/dns-query",l=["i","e","d"],o=200;e.et=function(e){return i(this,void 0,void 0,function*(){var i=yield e(r,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:s});if(i.ok){var t,i=yield i.arrayBuffer(),i=new Uint8Array(i);{var n=i,i=n.findIndex((t,e)=>e<o&&"="===String.fromCharCode(t)&&l.includes(String.fromCharCode(n[e-1])));if(-1===i)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=i-1;t<n.length;t++)e+=String.fromCharCode(n[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},3539:(t,e)=>{$Q(e)},5542:function(t,o,e){var i=this&&this.__awaiter||$A();$Q2(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const n=e(7512),u=e(5902),a=e(8e3),c=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");function h(t){return t instanceof Error?t:"string"==typeof t?new Error(t):new Error("An unknown error occurred.")}o.ErrorBoundary=class{constructor(t,e,i,n){this.O=t,this.m=e,this.nt=i,this.qn=n,this.it=new Set}wrap(n){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.rt(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.st("eb:wrap",t)}}logError(t,e){this.st(t,e)}getLastSeenErrorAndReset(){var t=this.qn;return this.qn=void 0,null!=t?t:null}attachErrorIfNoneExists(t){this.qn||(this.qn=h(t))}rt(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.st(e,t)):i}catch(t){return this.st(e,t),null}}st(r,l){try{n.Log.warn("Caught error in "+r,{error:l});i(this,void 0,void 0,function*(){var t,e=l||Error(c),i=e instanceof Error,n=i?e.name:"No Name",s=h(e);this.qn=s,this.it.has(n)||(this.it.add(n),null!=(s=null==(s=this.m)?void 0:s.networkConfig)&&s.preventAllNetworkTraffic?null!=(s=this.nt)&&s.call(this,{name:"error",error:l,tag:r}):(s=u.SDKType.lt(this.O),t=a.StatsigMetadataProvider.get(),i=i?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(e),e=JSON.stringify($P({tag:r,exception:n,info:i},$P($P({},t),{sdkType:s}))),yield(null!=(n=null==(i=null==(n=this.m)?void 0:n.networkConfig)?void 0:i.networkOverrideFunc)?n:fetch)(o.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.O,"STATSIG-SDK-TYPE":String(s),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=(i=this.nt)&&i.call(this,{name:"error",error:l,tag:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const n=i(2137),s=i(1406),l=i(7512),o=i(7410),u=i(6830),a=i(1637),c=i(4534),h=i(1881),d=i(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static ot(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static ut(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.O=t,this.nt=e,this.ht=i,this.m=n,this.dt=[],this.vt={},this.ft={},this._t=!1,this.gt=Date.now(),this.bt=!0===(null==n?void 0:n.disableLogging),this.yt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:100;e=null==n?void 0:n.networkConfig;this.Ot=new h.UrlConfiguration(o.Endpoint.jt,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}setLoggingDisabled(t){this.bt=t}enqueue(t){this.St(t)&&(this.wt(t),this.Tt(),this.dt.length>this.yt)&&_.ot(this.O)}incrementNonExposureCount(t){var e=null!=(e=this.ft[t])?e:0;this.ft[t]=e+1}reset(){this.vt={}}start(){(0,u.kt)()||(v[this.O]=this,(0,d.It)(t=>{"background"===t?_.ot(this.O):"foreground"===t&&_.ut(this.O)}),this.ct(f.Startup),this.Dt())}stop(){return r(this,void 0,void 0,function*(){this.Et&&(clearInterval(this.Et),this.Et=null),delete v[this.O],yield this.flush()})}flush(){return r(this,void 0,void 0,function*(){var t;this.Mt(),0!==this.dt.length&&(t=this.dt,this.dt=[],yield this.At(t))})}Tt(){this._t||(this._t=!0,200<Date.now()-this.gt)||setTimeout(()=>_.ot(this.O),200)}St(t){if((0,u.kt)())return!1;if((0,a.xt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,n.u)(this.O,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID,i.allocatedExperiment,i.parameterName,String(i.isExplicitParameter),i.reason].join("|"),e=this.vt[t],i=Date.now();if(e&&i-e<6e5)return!1;1e3<Object.keys(this.vt).length&&(this.vt={}),this.vt[t]=i}return!0}At(i){var n,s;return r(this,void 0,void 0,function*(){if(this.bt)return this.Nt(i),!1;try{var t=(0,d.Rt)()&&this.ht.isBeaconSupported()&&null==(null==(s=null==(n=this.m)?void 0:n.networkConfig)?void 0:s.networkOverrideFunc),e=(this.nt({name:"pre_logs_flushed",events:i}),t?yield this.Pt(i):yield this.Ct(i));return e.success?(this.nt({name:"logs_flushed",events:i}),!0):(l.Log.warn("Failed to flush events."),this.Nt(i),!1)}catch(t){return l.Log.warn("Failed to flush events."),!1}})}Ct(e){var i;return r(this,void 0,void 0,function*(){var t=yield this.ht.post(this.Ut(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}Pt(t){return r(this,void 0,void 0,function*(){return{success:yield this.ht.beacon(this.Ut(t))}})}Ut(t){return{sdkKey:this.O,data:{events:t},urlConfig:this.Ot,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(t.length)}}}Nt(t){for(;500<t.length;)t.shift();var e=this.o();try{(0,c.L)(e,t)}catch(t){l.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.o();r(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.G)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.At(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{l.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,s.h)(this.O)}wt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.Ft(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));l.Log.debug("Enqueued Event:",i),this.dt.push(i)}Mt(){0!==Object.keys(this.ft).length&&(this.wt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.ft)}}),this.ft={})}Ft(){var t;if(!1!==(null==(t=this.m)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.Gt)()}Dt(){var t=null!=(t=null==(t=this.m)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{var t=v[this.O];t&&t.Et===e?_.ot(this.O):clearInterval(e)},t);this.Et=e}}e.EventLogger=_},1406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.Lt=r.Kt=r.h=void 0;const l=e(6634);r.h=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},r.Kt=(t,e)=>(0,r.h)(JSON.stringify((0,r.Lt)(t,e)));r.Lt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const s={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,l.zt)(e)?s[t]=e:s[t]=(0,r.Lt)(e,null!=n?n-1:n)}),s}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...t){n.level>=e.LogLevel.Info&&console.info(" INFO ",...i(t))}static debug(...t){n.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){n.level>=e.LogLevel.Warn&&console.warn(" WARN ",...i(t))}static error(...t){n.level>=e.LogLevel.Error&&console.error(" ERROR ",...i(t))}}(e.Log=n).level=e.LogLevel.Warn},7787:(t,e)=>{$Q(e),e.createMemoKey=e.MemoPrefix=void 0,e.MemoPrefix={Kn:"g",Ln:"c",Vn:"e",$n:"l",Bn:"p"};const r=new Set([]),l=new Set(["userPersistedValues"]);e.createMemoKey=function(t,e,i){let n=t+"|"+e;if(i)for(const s of Object.keys(i)){if(l.has(s))return;r.has(s)?n+=`|${s}=true`:n+=`|${s}=`+i[s]}return n}},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=e.Endpoint=void 0,e.Endpoint={qt:"initialize",jt:"rgstr",Bt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.jt]:"https://prodregistryv2.org/v1",[e.Endpoint.qt]:"https://featureassets.org/v1",[e.Endpoint.Bt]:"https://api.statsigcdn.com/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,i){var j=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const l=i(1845),S=i(8962),w=i(7512),k=i(7410),n=i(308),o=i(5902),u=i(6830),a=i(4143),c=i(9122),T=i(2636),h=i(8e3),D=i(2397),I=500,E=3e4;const x=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.nt=e,this.$t=null,this.Vt=1e4,this.Jt={},this.m={},this.Oi={},this.Jn=null,t&&(this.m=t),this.m.networkConfig&&(this.Jt=this.m.networkConfig),this.Jt.networkTimeoutMs&&(this.Vt=this.Jt.networkTimeoutMs),this.Wt=new n.NetworkFallbackResolver(this.m)}setErrorBoundary(t){this.$t=t,this.$t.wrap(this),this.$t.wrap(this.Wt),this.Wt.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){var t=this.Jn;return this.Jn=null,t}beacon(n){return j(this,void 0,void 0,function*(){var t,e,i;return!!M(n)&&(e=this.Ht("POST",n),t=yield this.Yt(e,n.data),e=yield this.Xt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return j(this,void 0,void 0,function*(){var t=this.Ht("POST",e);return t.body=yield this.Yt(t,e.data),e.isStatsigEncodable&&(t.body=this.Qt(t,t.body)),this.Zt(t)})}get(t){t=this.Ht("GET",t);return this.Zt(t)}Zt(p){var y,m,O;return j(this,void 0,void 0,function*(){if(!M(p))return null;if(this.Jt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:s}=p,t=p.urlConfig.endpoint;if(this.Si(t))return w.Log.warn(`Request to ${t} was blocked because you are making requests too frequently.`),null;s=null!=s?s:1;const r="undefined"!=typeof AbortController?new AbortController:null;var l=setTimeout(()=>{null!==r&&void 0!==r&&r.abort(`Timeout of ${this.Vt}ms expired.`)},this.Vt),o=yield this.Xt(p);let u=null;var a=(0,D.Rt)();try{var c,h,d,v={method:e,body:i,headers:$P({},p.headers),signal:null===r||void 0===r?void 0:r.signal,priority:p.priority,keepalive:a},f=(g=s,(b=p).urlConfig.endpoint===k.Endpoint.qt&&S.Diagnostics.J(b.sdkKey,{attempt:g}),this.Oi[t]),_=(f&&(f.lastRequestTime=Date.now(),this.Oi[t]=f),null!=(y=this.Jt.networkOverrideFunc)?y:fetch);if(u=yield _(o,v),clearTimeout(l),u.ok)return d=yield u.text(),N(p,u,s,d),this.Wt.tryBumpExpiryTime(p.sdkKey,p.urlConfig),{body:d,code:u.status};throw c=yield u.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${o} `+c)).name="NetworkError",h}catch(t){var g,i=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"}(r,t),a=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(r),b=(N(p,u,s,"",t),yield this.Wt.tryFetchUpdatedFallbackInfo(p.sdkKey,p.urlConfig,i,a));return(b&&(p.fallbackUrl=this.Wt.getActiveFallbackUrl(p.sdkKey,p.urlConfig)),!n||n<s||!x.has(null!=(m=null===u||void 0===u?void 0:u.status)?m:500))?(null!=(m=this.nt)&&m.call(this,{name:"error",error:t,tag:T.ErrorTag.NetworkError,requestArgs:p}),g=`A networking error occurred during ${e} request to ${o}.`,w.Log.error(g,i,t),null!=(O=this.$t)&&O.attachErrorIfNoneExists(g),null):(yield function(e){return j(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(I*(e*e),E)))})}(s),this.Zt($P($P({},p),{retries:n,attempt:s+1})))}})}Si(t){var e=Date.now(),i=null!=(i=this.Oi[t])?i:{count:0,lastRequestTime:e},n=e-i.lastRequestTime,n=Math.floor(.05*n);return i.count=Math.max(0,i.count-n),50<=i.count||(i.count+=1,i.lastRequestTime=e,this.Oi[t]=i,!1)}Xt(n){var s;return j(this,void 0,void 0,function*(){var t=null!=(s=n.fallbackUrl)?s:n.urlConfig.getUrl();n.urlConfig.endpoint!==k.Endpoint.qt&&n.urlConfig.endpoint!==k.Endpoint.Bt||(this.Jn=t);const e=$P({[k.NetworkParam.SdkKey]:n.sdkKey,[k.NetworkParam.SdkType]:o.SDKType.lt(n.sdkKey),[k.NetworkParam.SdkVersion]:h.SDK_VERSION,[k.NetworkParam.Time]:String(Date.now()),[k.NetworkParam.SessionID]:a.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Yt(s,r){return j(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=s,i=c.StableID.get(t),n=a.SessionID.get(t),t=o.SDKType.lt(t);return JSON.stringify($P($P({},r),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Qt(e,i){var t,n,s=(0,u.te)();if(this.m.disableStatsigEncoding||null!=(0,l.i)("no-encode")||null==s||!s.btoa)return i;try{var r=null!=(t=s.btoa(i).split("").reverse().join(""))?t:i;return e.params=$P($P({},null!=(n=e.params)?n:{}),{[k.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return w.Log.warn("Request encoding failed for "+e.urlConfig.getUrl()),i}}Ht(t,e){var i=this.Wt.getActiveFallbackUrl(e.sdkKey,e.urlConfig);return $P($P({},e),{method:t,fallbackUrl:i})}};const M=t=>!!t.sdkKey||(w.Log.warn("Unable to make request without an SDK key"),!1);function N(t,e,i,n,s){t.urlConfig.endpoint===k.Endpoint.qt&&S.Diagnostics.$(t.sdkKey,S.Diagnostics.Z(e,i,n,s))}},308:function(t,e,i){var u=this&&this.__awaiter||$A();$Q(e),e.ee=e.NetworkFallbackResolver=void 0;const o=i(8809),n=i(1406),r=i(7512),l=i(4534);function a(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function c(t){return"statsig.network_fallback."+(0,n.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.ne=null,this.$t=null,this.ie={},this.re=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.$t=t}tryBumpExpiryTime(t,e){var i=null==(i=this.ne)?void 0:i[e.endpoint];i&&(i.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ne),{[e.endpoint]:i})))}getActiveFallbackUrl(t,e){var i;let n=this.ne;null==n&&(n=null!=(s=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return r.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.ne=n);var s=n[e.endpoint];return!s||Date.now()>(null!=(i=s.expiryTime)?i:0)?(delete n[e.endpoint],this.ne=n,h(t,this.ne),null):s.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(i,n,s,r){var l,o;return u(this,void 0,void 0,function*(){try{var t,e;return a(s,r)?(t=null==n.customUrl&&null==n.fallbackUrls?yield this.se(n):n.fallbackUrls,!!(e=this.le(null==(l=this.ne)?void 0:l[n.endpoint],t))&&(this.oe(i,n.endpoint,e),!0)):!1}catch(t){return null!=(o=this.$t)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}oe(t,e,i){var i={url:i,expiryTime:Date.now()+6048e5,previous:[]},n=null==(n=this.ne)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.ne)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.ne=$P($P({},this.ne),{[e]:i}),h(t,this.ne)}se(r){var l;return u(this,void 0,void 0,function*(){var t=this.ie[r.endpoint];if(t&&Date.now()<t)return null;this.ie[r.endpoint]=Date.now()+144e5;var e=[],t=yield(0,o.et)(null!=(l=this.re)?l:fetch),i=d(r.defaultUrl);for(const s of t)if(s.startsWith(r.endpointDnsKey+"=")){var n=s.split("=");if(1<n.length){let t=n[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+i)}}return e})}le(t,e){var i;if(null==e)return null;var n=new Set(null!=(i=null==t?void 0:t.previous)?i:[]),s=null==t?void 0:t.url;let r=null;for(const o of e){var l=o.endsWith("/")?o.slice(0,-1):o;if(!n.has(o)&&l!==s){r=l;break}}return r}},e.ee=a},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},3091:(t,e)=>{$Q(e),e.SDKFlags=void 0;const i={};e.SDKFlags={setFlags:(t,e)=>{i[t]=e},get:(t,e)=>{return null!=(t=null==(t=i[t])?void 0:t[e])&&t}}},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={lt:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},ue(t,e){i[t]=e},ae(t){n&&"-react"!==n||(n="-"+t)}}},6830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.Gt=n.ce=n.he=n.kt=n.de=n.te=void 0;n.te=()=>"undefined"!=typeof window?window:null,n.de=()=>{var t=(0,n.te)();return null!=(t=null==t?void 0:t.document)?t:null},n.kt=()=>{var t;return null===(0,n.de)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.he=(t,e)=>{var i=(0,n.te)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.ce=(t,e)=>{var i=(0,n.de)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.Gt=()=>{var t;try{return null==(t=(0,n.te)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(2137),r=i(7512),l=i(4534),o=i(8023),u=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,n.o)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,l.G)(t)}(t);var i=Date.now();e=e||{sessionID:(0,o.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>u}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,o.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,l.L)(s,n)}catch(t){r.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=h(i,u),t.ageTimeoutID=h(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},9122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(2137),s=i(7512),r=i(4534),l=i(8023),o={};function u(t){return"statsig.stable_id."+(0,n.o)(t)}function a(t,e){e=u(e);try{(0,r.L)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==o[e]){let t=function(t){t=u(t);return(0,r.G)(t)}(e);null==t&&a(t=(0,l.getUUID)(),e),o[e]=t}return o[e]},setOverride:(t,e)=>{a(o[e]=t,e)}}},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const l=i(1845),o=i(5542),u=i(7770),a=i(7512),r=i(7787),c=i(6830),h=i(4143),d=i(4534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.ve=null,this.fe={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage._e(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.ge(n.storageProvider),this.O=t,this.m=null!=n?n:{},this.ji={},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.pe=new u.EventLogger(t,r,i,n),this.$t=new o.ErrorBoundary(t,n,r),this.$t.wrap(this),this.$t.wrap(e),this.$t.wrap(this.pe),i.setErrorBoundary(this.$t),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=d.Storage,this.be(),s=t,r=this,(0,c.kt)()||(i=(0,l.l)(),e=null!=(e=i.instances)?e:{},r=r,null!=e[s]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[s]=r,i.firstInstance||(i.firstInstance=r),i.instances=e,__STATSIG__=i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.m.disableLogging=t.disableLogging,this.pe.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.m.disableStorage=t.disableStorage,d.Storage._e(t.disableStorage))}flush(){return this.pe.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.me("Uninitialized",null),this.ve=null,yield this.pe.stop()})}on(t,e){this.fe[t]||(this.fe[t]=[]),this.fe[t].push(e)}off(t,e){this.fe[t]&&-1!==(e=this.fe[t].indexOf(e))&&this.fe[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.$t.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.fe[i.name]&&this.fe[i.name].forEach(t=>e(t)),null!=(t=this.fe["*"])&&t.forEach(e)}me(t,e){this.loadingStatus=t,this.ji={},this.$emt({name:"values_updated",status:t,values:e})}ye(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.pe.incrementNonExposureCount(t):this.pe.enqueue(e)}wi(n,s){return(t,e)=>{var i;return!this.m.disableEvaluationMemoization&&(i=(0,r.createMemoKey)(n,t,e))?(i in this.ji||(3e3<=Object.keys(this.ji).length&&(this.ji={}),this.ji[i]=s(t,e)),this.ji[i]):s(t,e)}}}},2636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Oe=e.je=e.Se=e.xt=void 0;const s="statsig::config_exposure",r="statsig::gate_exposure",u="statsig::layer_exposure",a=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:l(i,n),secondaryExposures:s,time:Date.now()});e.xt=({eventName:t})=>t===r||t===s||t===u,e.Se=(t,e)=>{var i,n={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),a(r,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])},e.je=(t,e)=>{var i,n={config:e.name,ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),null!=(null==(i=e.__evaluation)?void 0:i.passed)&&(n.rulePassed=String(e.__evaluation.passed)),a(s,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])};e.Oe=(t,e,i)=>{var n=e.__evaluation,s=!0===(null==(s=null==n?void 0:n.explicit_parameters)?void 0:s.includes(i));let r="",l=null!=(o=null==n?void 0:n.undelegated_secondary_exposures)?o:[];s&&(r=null!=(o=n.allocated_experiment_name)?o:"",l=n.secondary_exposures);var o={config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(s)};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(o.configVersion=e.__evaluation.version),a(u,t,e.details,o,l)};const l=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.12.0";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e)},1098:(t,e)=>{$Q(e)},2059:(t,e,i)=>{$Q(e),e.we=e.Te=e.ke=e.Ie=e.De=e.Ee=void 0;const l=i(7512),o=i(6634),s="default";function r(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function n(t,e,i){var n=null!=(n=null==i?void 0:i.value)?n:{};return $P($P({},r(t,e,i,n)),{get:u(t,null==i?void 0:i.value)})}function u(n,s,r){return(t,e)=>{var i=null!=(i=null==s?void 0:s[t])?i:null;return null==i?null!=e?e:null:null==e||(0,o.Me)(i,e)?(null!=r&&r(t),i):(l.Log.warn(`Parameter type mismatch. '${n}.${t}' was found to be type '${typeof i}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.Ee=function(t,e,i){return r(t,e,i,!0===(null==i?void 0:i.value))},e.De=n,e.Ie=function(t,e,i){return t=n(t,e,i),$P($P({},t),{groupName:null!=(e=null==i?void 0:i.group_name)?e:null})},e.ke=function(t,e,i,n){return $P($P({},r(t,e,i,void 0)),{get:u(t,null==i?void 0:i.value,n),groupName:null!=(e=null==i?void 0:i.group_name)?e:null,__value:null!=(t=null==i?void 0:i.value)?t:{}})},e.Te=function(t,e,i,n){return $P($P($P({},t),e),{get:u(t.name,i,n)})},e.we=u},1812:(t,e)=>{$Q(e)},3932:(t,e)=>{$Q(e),e.UPDATE_DETAIL_ERROR_MESSAGES=e.createUpdateDetails=void 0;e.createUpdateDetails=(t,e,i,n,s,r)=>({duration:i,source:e,success:t,error:n,sourceUrl:s,warnings:r}),e.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}},8578:(t,e,i)=>{$Q(e),e.v=e.T=void 0;const n=i(1406),s=i(7512);e.T=function(t,e,i){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment?n.statsigEnvironment=e.environment:null!=i&&(n.statsigEnvironment={tier:i}),n}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Kt)(t):null}},4534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.L=i.G=i.Storage=void 0;var n=e(7512),e=e(6830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let l=null;try{const a=(0,e.te)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(l={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let o=null!==l&&void 0!==l?l:r,u=o;i.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:t=>{var e=()=>u.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.ge(r),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),ge:t=>{o=t,u=t},_e:t=>{u=t?r:o}},i.G=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.L=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,i)=>{$Q(e),e.P=void 0;const s=i(7512);e.P=function(t,e,i){try{var n=JSON.parse(t);if(n&&"object"==typeof n&&e in n)return n}catch(t){}return s.Log.error("Failed to parse "+i),null}},6634:(t,e)=>{$Q(e),e.Me=e.zt=void 0,e.zt=function(t){return Array.isArray(t)?"array":typeof t},e.Me=function(t,e){var i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(e)}},8023:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="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<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},1881:(t,e,i)=>{$Q(e),e.UrlConfiguration=void 0;const s=i(7410),r={[s.Endpoint.qt]:"i",[s.Endpoint.jt]:"e",[s.Endpoint.Bt]:"d"};e.UrlConfiguration=class{constructor(t,e,i,n){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=r[t],e&&(this.customUrl=e),!e&&i&&(this.customUrl=i.endsWith("/")?""+i+t:i+"/"+t),n&&(this.fallbackUrls=n);e=s.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},2397:(t,e,i)=>{$Q(e),e.Ae=e.It=e.Rt=e.xe=void 0;i=i(6830);const n="foreground",s="background",r=[];let l=n,o=!1;e.xe=()=>l===n,e.Rt=()=>o,e.It=t=>{r.unshift(t)};e.Ae=e=>{e!==l&&(l=e,r.forEach(t=>t(e)))},(0,i.he)("focus",()=>{(o=!1,e.Ae)(n)}),(0,i.he)("blur",()=>(0,e.Ae)(s)),(0,i.he)("beforeunload",()=>{o=!0,(0,e.Ae)(s)}),(0,i.ce)("visibilitychange",()=>{(0,e.Ae)("visible"===document.visibilityState?n:s)})},6914:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),e.Storage=e.Log=e.EventLogger=e.Diagnostics=void 0,i(1845);const r=i(8962),l=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(7770)),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return l.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return o.Log}});var u=i(8e3);const a=i(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),s(i(1845),e),s(i(2137),e),s(i(6427),e),s(i(694),e),s(i(8962),e),s(i(3539),e),s(i(5542),e),s(i(2922),e),s(i(2417),e),s(i(1406),e),s(i(1333),e),s(i(7512),e),s(i(7787),e),s(i(7410),e),s(i(7023),e),s(i(1405),e),s(i(1361),e),s(i(6830),e),s(i(5902),e),s(i(4143),e),s(i(9122),e),s(i(1375),e),s(i(2636),e),s(i(3206),e),s(i(1637),e),s(i(8e3),e),s(i(586),e),s(i(1098),e),s(i(2059),e),s(i(1812),e),s(i(8578),e),s(i(4534),e),s(i(3401),e),s(i(6634),e),s(i(1881),e),s(i(8023),e),s(i(2397),e),s(i(3932),e),s(i(3091),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.Log,SDK_VERSION:u.SDK_VERSION})},9296:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),s(i(2018),e),e.default=__STATSIG__},7262:(t,e,i)=>{$Q(e),e.Ne=void 0;const n=i(6914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.Ne=function(t,e){var i;return(e=(0,n.P)(e,"checksum","DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),s((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.Kt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,i)=>{$Q(e);const s=i(6914);e.default=class{constructor(t){this.O=t,this.Re=null,this.Pe=null,this.Ce="Uninitialized",this.Ue=0,this.Fe=0,this.Ge=null,this.Le=new Set}reset(){this.Pe=null,this.Re=null,this.Ce="Loading",this.Ue=0,this.Fe=0,this.Ge=null}finalize(){this.Pe||(this.Ce="NoValues")}getValues(){return this.Re?(0,s.P)(this.Re,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.P)(t.data,"has_updates","EvaluationResponse"))&&(this.Ce=t.source,!0===(null==i?void 0:i.has_updates)&&(this.Re=t.data,this.Ue=i.time,this.Fe=t.receivedAt,this.Pe=i,this.Ge=this.Ke(t.source,i),t.source&&i.user&&this.ze(e,i),i.sdk_flags?s.SDKFlags.setFlags(this.O,i.sdk_flags):s.SDKFlags.setFlags(this.O,{})),!0)}getWarnings(){if(0!==this.Le.size)return Array.from(this.Le)}getGate(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.param_stores,t)}getSource(){return this.Ce}Ke(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}qe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Be(null==i)}}ze(t,e){var i,n=s.StableID.get(this.O);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.Le.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.Le.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.Ce||"NoValues"===this.Ce?{reason:this.Ce}:(t={reason:this.Ce,lcut:this.Ue,receivedAt:this.Fe},0<this.Le.size&&(t.warnings=Array.from(this.Le)),t)}Be(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.Ce&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.Ce&&null!=(n=this.Ge)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},8448:function(t,e,i){var l=this&&this.__awaiter||$A();$Q(e);const o=i(6914),u=i(7262);class n extends o.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Ve=new o.UrlConfiguration(o.Endpoint.qt,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(i,n,s,r){return l(this,void 0,void 0,function*(){var t=n?(0,o.P)(n,"has_updates","InitializeResponse"):null;let e={user:r,hash:"djb2",deltasResponseRequested:!1,full_checksum:null};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0,full_checksum:t.full_checksum})),this.Je(i,t,e,s)})}Je(e,i,n,s){var r;return l(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,urlConfig:this.Ve,data:n,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!=(r=null==t?void 0:t.body)?r:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,u.Ne)(i,t.body))?t:this.Je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},3583:(t,e,i)=>{$Q(e),e.$e=void 0;const g=i(6914),b={disableExposureLog:!0};function p(t){return null==t||!1===t.disableExposureLog}function y(t,e){return null!=e&&!(0,g.Me)(t,e)}e.$e=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,l,o,u,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.zt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,p(_)?void 0:b).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,u=e,a=_,y(c=(o=v).getDynamicConfig(h.config_name,b).get(h.param_name),u)?u:(p(a)&&o.getDynamicConfig(h.config_name),c);case"experiment":return u=d,a=e,o=_,y(l=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(o)&&c.getExperiment(u.experiment_name),l);case"layer":return l=d,n=e,s=_,y(r=(i=v).getLayer(l.layer_name,b).get(l.param_name),n)?n:(p(s)&&i.getLayer(l.layer_name).get(l.param_name),r);default:return e}}}},8198:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e);const l=i(6914),o=i(4845),u=i(8448),s=i(3583),a=i(4131);class n extends l.StatsigClientBase{static instance(t){var e=(0,l.l)().instance(t);return e instanceof n?e:(l.Log.warn((0,l.kt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){l.SDKType.ue(t,"javascript-client");var n,s=new u.default(i,t=>{this.$emt(t)}),t=(super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,s,i),this.getFeatureGate=this.wi(l.MemoPrefix.Kn,this.Ti.bind(this)),this.getDynamicConfig=this.wi(l.MemoPrefix.Ln,this.Ii.bind(this)),this.getExperiment=this.wi(l.MemoPrefix.Vn,this.ki.bind(this)),this.getLayer=this.wi(l.MemoPrefix.$n,this.Di.bind(this)),this.getParameterStore=this.wi(l.MemoPrefix.Bn,this.Ri.bind(this)),this.We=new o.default(t),this.ht=s,this.He=this.xi(e,i),null!=(n=null==i?void 0:i.plugins)?n:[]);for(const r of t)r.bind(this)}initializeSync(t){var e;return"Uninitialized"!==this.loadingStatus?(0,l.createUpdateDetails)(!0,this.We.getSource(),-1,null,null,["MultipleInitializations",...null!=(e=this.We.getWarnings())?e:[]]):(this.pe.start(),this.updateUserSync(this.He,t))}initializeAsync(t){return r(this,void 0,void 0,function*(){return this.ve||(this.ve=this.Ye(t)),this.ve})}updateUserSync(t,e){var i=performance.now(),n=[...null!=(n=this.We.getWarnings())?n:[]],t=(this.Xe(t),this.dataAdapter.getDataSync(this.He)),e=(null==t&&n.push("NoCachedValues"),this.We.setValues(t,this.He),this.Qe(t),null==e?void 0:e.disableBackgroundCacheRefresh);return!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.Ze(null!=t?t:null,this.He),(0,l.createUpdateDetails)(!0,this.We.getSource(),performance.now()-i,this.$t.getLastSeenErrorAndReset(),this.ht.getLastUsedInitUrlAndReset(),n)}updateUserAsync(n,s){return r(this,void 0,void 0,function*(){this.Xe(n);var t=this.He,e=(l.Diagnostics.B(this.O),this.dataAdapter.getDataSync(t));if(this.We.setValues(e,this.He),this.me("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,s),t!==this.He)return(0,l.createUpdateDetails)(!1,this.We.getSource(),-1,new Error("User changed during update"),this.ht.getLastUsedInitUrlAndReset());let i=!1;null!=e&&(l.Diagnostics.W(this.O),i=this.We.setValues(e,this.He),l.Diagnostics.H(this.O,{success:i})),this.Qe(e),i||(this.$t.attachErrorIfNoneExists(l.UPDATE_DETAIL_ERROR_MESSAGES.NO_NETWORK_DATA),this.$emt({name:"initialization_failure"})),l.Diagnostics.V(this.O,i,this.We.getCurrentSourceDetails());t=l.Diagnostics.tt(this.He,this.pe,this.O,this.m);return(0,l.createUpdateDetails)(i,this.We.getSource(),t,this.$t.getLastSeenErrorAndReset(),this.ht.getLastUsedInitUrlAndReset(),this.We.getWarnings())})}getContext(){return{sdkKey:this.O,options:this.m,values:this.We.getValues(),user:JSON.parse(JSON.stringify(this.He)),errorBoundary:this.$t,session:l.StatsigSession.get(this.O),stableID:l.StableID.get(this.O)}}checkGate(t,e){return this.getFeatureGate(t,e).value}logEvent(t,e,i){this.pe.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.He,time:Date.now()}))}be(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Qe(null)})}Ye(t){return r(this,void 0,void 0,function*(){return l.Storage.isReady()||(yield l.Storage.isReadyResolver()),this.pe.start(),this.updateUserAsync(this.He,t)})}Qe(t){this.We.finalize(),this.me("Ready",t)}Ze(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{l.Log.error("An error occurred after update.",t)})}Xe(t){this.pe.reset(),this.We.reset(),this.He=this.xi(t,this.m)}xi(t,e){t=(0,l.T)(t,e),e=null==(e=t.customIDs)?void 0:e.stableID;return e&&l.StableID.setOverride(e,this.O),t}Ti(t,e){var{result:i,details:n}=this.We.getGate(t),n=(0,l.Ee)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.Se)(this.He,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}Ii(t,e){var{result:i,details:n}=this.We.getConfig(t),n=(0,l.De)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.je)(this.He,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}ki(t,e){var{result:i,details:n}=this.We.getConfig(t),n=(0,l.Ie)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.He,e),i=null!=s?s:n;return this.ye(t,(0,l.je)(this.He,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}Di(e,i){var{result:t,details:n}=this.We.getLayer(e),n=(0,l.ke)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.He,i);null!=i&&i.disableExposureLog&&this.pe.incrementNonExposureCount(e);const r=(0,l.Te)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{null!=i&&i.disableExposureLog||this.ye(e,(0,l.Oe)(this.He,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}Ri(t,e){var{result:i,details:n}=this.We.getParamStore(t);return this.pe.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,s.$e)(this,i,e)}}}e.default=n},4131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(6914),s=i(8448);class l extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.ht=null,this.m=null}attach(t,e){super.attach(t,e),this.ht=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.D(t,(0,n.T)(e,this.m),i)}prefetchData(t,e){return this.A(t,e)}setData(t){var e=(0,n.P)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,e){super.setData(t,e)}R(e,i,n){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.ht)?void 0:s.fetchEvaluations(this.C(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}k(t){t=(0,n.o)(this.C(),t,null==(t=this.m)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.p}.`+t}N(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=l},2018:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.StatsigClient=void 0,i(8198));e.StatsigClient=r.default,s(i(6914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:r.default}),e.default=__STATSIG__}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[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(9296).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 $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 i={1845:(t,i,e)=>{var n;$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.l=void 0;const r=e(7512);i.l=()=>__STATSIG__||o,i.i=t=>(0,i.l)()[t];i.t=t=>{var e=(0,i.l)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&r.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var s="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},u="undefined"!=typeof globalThis?globalThis:{};const o=null!=(n=null!=(n=null!=(n=l[s])?n:e[s])?n:u[s])?n:{instance:i.t};l[s]=o,e[s]=o,u[s]=o},2137:(t,e,i)=>{$Q(e),e.o=e.u=void 0;const r=i(1406);function n(t,e,i){if(i)return i(t,e);const n=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(i=null==e?void 0:e.userID)?i:""),"cids:"+Object.keys(n).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+n[t]).join(","),"k:"+t];return(0,r.h)(e.join("|"))}e.u=n,e.o=function(t,e,i){return e?n(t,e,i):(0,r.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const o=i(7512),a=i(9122),s=i(8578),l=i(4534),c=i(3401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,s.v)(n)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.p=e,this.m=null,this.O=null,this.j="statsig.last_modified_time."+e,this.S=new n}attach(t,e){this.O=t,this.m=e}getDataSync(t){var t=t&&(0,s.T)(t,this.m),e=this.k(t),i=this.S.get(e,t);return i||((i=this.I(e))?(this.S.add(e,i),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,s.T)(e,this.m),i=this.k(e);this.S.add(i,h("Bootstrap",t,null,e))}D(e,i,n){return r(this,void 0,void 0,function*(){l.Storage.isReady()||(yield l.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.M(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(o.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}A(i,n){return r(this,void 0,void 0,function*(){var t=i&&(0,s.T)(i,this.m),e=this.k(t),t=yield this.D(null,t,n);t&&this.S.add(e,$P($P({},t),{source:"Prefetch"}))})}M(s,l,u){return r(this,void 0,void 0,function*(){let t=null;s&&this.N(s,l)&&(t=s.data);var e=yield this.R(t,l,u);if(!e)return o.Log.debug("No response returned for latest value"),null;var i=(0,c.P)(e,"has_updates","Response"),n=this.C(),n=a.StableID.get(n);let r=null;if(!0===(null==i?void 0:i.has_updates))r=h("Network",e,n,l);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;r=h("NetworkNotModified",t,n,l)}e=this.k(l);return this.S.add(e,r),this.U(e,r),r})}C(){return null!=this.O?this.O:(o.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}U(t,e){l.Storage.setItem(t,JSON.stringify(e)),this.F(t)}F(t){var e=null!=(e=(0,l.G)(this.j))?e:{},t=(e[t]=Date.now(),u(e,10));t&&(delete e[t],l.Storage.removeItem(t)),(0,l.L)(this.j,e)}};class n{constructor(){this.K={}}get(t,e){var t=this.K[t],i=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&i&&e!==i?(o.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=u(this.K,9);i&&delete this.K[i],this.K[t]=e}merge(t){this.K=$P($P({},this.K),t)}}function u(r,t){var e=Object.keys(r);return e.length<=t?null:e.reduce((t,e)=>{var i=r[t],n=r[e];return"object"==typeof i&&"object"==typeof n?n.receivedAt<i.receivedAt?e:t:n<i?e:t})}},8962:(t,l)=>{$Q2(l,"__esModule",{value:!0}),l.Diagnostics=void 0;const n=new Map,i="start";function r(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function s(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}l.Diagnostics={q:t=>n.get(t),B:t=>{s(t,r({},i,"overall"))},V:(t,e,i)=>{s(t,r({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},J:(t,e)=>{s(t,r(e,i,"initialize","network_request"))},$:(t,e)=>{s(t,r(e,"end","initialize","network_request"))},W:t=>{s(t,r({},i,"initialize","process"))},H:(t,e)=>{s(t,r(e,"end","initialize","process"))},Y:t=>{n.delete(t)},X(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Z(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:l.Diagnostics.X(n)}},tt(t,e,i,n){var r,s=l.Diagnostics.q(i);return null==s||s.length<=0?-1:(r=s[s.length-1].timestamp-s[0].timestamp,l.Diagnostics.Y(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:s.slice(),statsigOptions:n}),e.enqueue(i),r)}}},8809:function(t,e){var i=this&&this.__awaiter||$A();$Q(e),e.et=void 0;const r=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),s="https://cloudflare-dns.com/dns-query",l=["i","e","d"],u=200;e.et=function(e){return i(this,void 0,void 0,function*(){var i=yield e(s,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:r});if(i.ok){var t,i=yield i.arrayBuffer(),i=new Uint8Array(i);{var n=i,i=n.findIndex((t,e)=>e<u&&"="===String.fromCharCode(t)&&l.includes(String.fromCharCode(n[e-1])));if(-1===i)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=i-1;t<n.length;t++)e+=String.fromCharCode(n[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},3539:(t,e)=>{$Q(e)},5542:function(t,u,e){var i=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const n=e(7512),o=e(5902),a=e(8e3),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");function h(t){return t instanceof Error?t:"string"==typeof t?new Error(t):new Error("An unknown error occurred.")}u.ErrorBoundary=class{constructor(t,e,i,n){this.O=t,this.m=e,this.nt=i,this.qn=n,this.it=new Set}wrap(n){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.rt(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.st("eb:wrap",t)}}logError(t,e){this.st(t,e)}getLastSeenErrorAndReset(){var t=this.qn;return this.qn=void 0,null!=t?t:null}attachErrorIfNoneExists(t){this.qn||(this.qn=h(t))}rt(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.st(e,t)):i}catch(t){return this.st(e,t),null}}st(s,l){try{n.Log.warn("Caught error in "+s,{error:l});i(this,void 0,void 0,function*(){var t,e=l||Error(c),i=e instanceof Error,n=i?e.name:"No Name",r=h(e);this.qn=r,this.it.has(n)||(this.it.add(n),null!=(r=null==(r=this.m)?void 0:r.networkConfig)&&r.preventAllNetworkTraffic?null!=(r=this.nt)&&r.call(this,{name:"error",error:l,tag:s}):(r=o.SDKType.lt(this.O),t=a.StatsigMetadataProvider.get(),i=i?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(e),e=JSON.stringify($P({tag:s,exception:n,info:i},$P($P({},t),{sdkType:r}))),yield(null!=(n=null==(i=null==(n=this.m)?void 0:n.networkConfig)?void 0:i.networkOverrideFunc)?n:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.O,"STATSIG-SDK-TYPE":String(r),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=(i=this.nt)&&i.call(this,{name:"error",error:l,tag:s})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=i(2137),s=i(1406),l=i(7512),u=i(7410),o=i(6830),a=i(1637),c=i(4534),h=i(1881),d=i(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static ot(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static ut(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.O=t,this.nt=e,this.ht=i,this.m=n,this.dt=[],this.vt={},this.ft={},this._t=!1,this.gt=Date.now(),this.bt=!0===(null==n?void 0:n.disableLogging),this.yt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:100;e=null==n?void 0:n.networkConfig;this.Ot=new h.UrlConfiguration(u.Endpoint.jt,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}setLoggingDisabled(t){this.bt=t}enqueue(t){this.St(t)&&(this.wt(t),this.Tt(),this.dt.length>this.yt)&&_.ot(this.O)}incrementNonExposureCount(t){var e=null!=(e=this.ft[t])?e:0;this.ft[t]=e+1}reset(){this.vt={}}start(){(0,o.kt)()||(v[this.O]=this,(0,d.It)(t=>{"background"===t?_.ot(this.O):"foreground"===t&&_.ut(this.O)}),this.ct(f.Startup),this.Dt())}stop(){return n(this,void 0,void 0,function*(){this.Et&&(clearInterval(this.Et),this.Et=null),delete v[this.O],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.Mt(),0!==this.dt.length&&(t=this.dt,this.dt=[],yield this.At(t))})}Tt(){this._t||(this._t=!0,200<Date.now()-this.gt)||setTimeout(()=>_.ot(this.O),200)}St(t){if((0,o.kt)())return!1;if((0,a.xt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,r.u)(this.O,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID,i.allocatedExperiment,i.parameterName,String(i.isExplicitParameter),i.reason].join("|"),e=this.vt[t],i=Date.now();if(e&&i-e<6e5)return!1;1e3<Object.keys(this.vt).length&&(this.vt={}),this.vt[t]=i}return!0}At(t){var e,i;return n(this,void 0,void 0,function*(){if(this.bt)return this.Nt(t),!1;try{return((0,d.Rt)()&&this.ht.isBeaconSupported()&&null==(null==(i=null==(e=this.m)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.Pt(t):yield this.Ct(t)).success?(this.nt({name:"logs_flushed",events:t}),!0):(l.Log.warn("Failed to flush events."),this.Nt(t),!1)}catch(t){return l.Log.warn("Failed to flush events."),!1}})}Ct(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.ht.post(this.Ut(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}Pt(t){return n(this,void 0,void 0,function*(){return{success:yield this.ht.beacon(this.Ut(t))}})}Ut(t){return{sdkKey:this.O,data:{events:t},urlConfig:this.Ot,retries:3,isCompressable:!0,params:{[u.NetworkParam.EventCount]:String(t.length)}}}Nt(t){for(;1e3<t.length;)t.shift();var e=this.o();try{(0,c.L)(e,t)}catch(t){l.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.o();n(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.G)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.At(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{l.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,s.h)(this.O)}wt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.Ft(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));l.Log.debug("Enqueued Event:",i),this.dt.push(i)}Mt(){0!==Object.keys(this.ft).length&&(this.wt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.ft)}}),this.ft={})}Ft(){var t;if(!1!==(null==(t=this.m)?void 0:t.includeCurrentPageUrlWithEvents))return(0,o.Gt)()}Dt(){var t=null!=(t=null==(t=this.m)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{var t=v[this.O];t&&t.Et===e?_.ot(this.O):clearInterval(e)},t);this.Et=e}}e.EventLogger=_},1406:(t,s,e)=>{$Q2(s,"__esModule",{value:!0}),s.Lt=s.Kt=s.h=void 0;const l=e(6634);s.h=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},s.Kt=(t,e)=>(0,s.h)(JSON.stringify((0,s.Lt)(t,e)));s.Lt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const r={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,l.zt)(e)?r[t]=e:r[t]=(0,s.Lt)(e,null!=n?n-1:n)}),r}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...t){this.level>=e.LogLevel.Info&&console.info(" INFO ",...i(t))}static debug(...t){this.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){this.level>=e.LogLevel.Warn&&console.warn(" WARN ",...i(t))}static error(...t){this.level>=e.LogLevel.Error&&console.error(" ERROR ",...i(t))}}(e.Log=n).level=e.LogLevel.Warn},7787:(t,e)=>{$Q(e),e.createMemoKey=e.MemoPrefix=void 0,e.MemoPrefix={Kn:"g",Ln:"c",Vn:"e",$n:"l",Bn:"p"};const s=new Set([]),l=new Set(["userPersistedValues"]);e.createMemoKey=function(t,e,i){let n=t+"|"+e;if(i)for(const r of Object.keys(i)){if(l.has(r))return;s.has(r)?n+=`|${r}=true`:n+=`|${r}=`+i[r]}return n}},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=e.Endpoint=void 0,e.Endpoint={qt:"initialize",jt:"rgstr",Bt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.jt]:"https://prodregistryv2.org/v1",[e.Endpoint.qt]:"https://featureassets.org/v1",[e.Endpoint.Bt]:"https://api.statsigcdn.com/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,i){var j=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const l=i(1845),S=i(8962),w=i(7512),T=i(7410),n=i(308),u=i(5902),o=i(6830),a=i(4143),c=i(9122),k=i(2636),h=i(8e3),I=i(2397),E=500,D=3e4;const M=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.nt=e,this.$t=null,this.Vt=1e4,this.Jt={},this.m={},this.Oi={},this.Jn=null,t&&(this.m=t),this.m.networkConfig&&(this.Jt=this.m.networkConfig),this.Jt.networkTimeoutMs&&(this.Vt=this.Jt.networkTimeoutMs),this.Wt=new n.NetworkFallbackResolver(this.m)}setErrorBoundary(t){this.$t=t,this.$t.wrap(this),this.$t.wrap(this.Wt),this.Wt.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){var t=this.Jn;return this.Jn=null,t}beacon(n){return j(this,void 0,void 0,function*(){var t,e,i;return!!A(n)&&(e=this.Ht("POST",n),t=yield this.Yt(e,n.data),e=yield this.Xt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return j(this,void 0,void 0,function*(){var t=this.Ht("POST",e);return t.body=yield this.Yt(t,e.data),e.isStatsigEncodable&&(t.body=this.Qt(t,t.body)),this.Zt(t)})}get(t){t=this.Ht("GET",t);return this.Zt(t)}Zt(m){var b,y,O;return j(this,void 0,void 0,function*(){if(!A(m))return null;if(this.Jt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:r}=m,t=m.urlConfig.endpoint;if(this.Si(t))return w.Log.warn(`Request to ${t} was blocked because you are making requests too frequently.`),null;r=null!=r?r:1;const s="undefined"!=typeof AbortController?new AbortController:null;var l=setTimeout(()=>{null!==s&&void 0!==s&&s.abort(`Timeout of ${this.Vt}ms expired.`)},this.Vt),u=yield this.Xt(m);let o=null;var a=(0,I.Rt)();try{var c,h,d,v={method:e,body:i,headers:$P({},m.headers),signal:null===s||void 0===s?void 0:s.signal,priority:m.priority,keepalive:a},f=(g=r,(p=m).urlConfig.endpoint===T.Endpoint.qt&&S.Diagnostics.J(p.sdkKey,{attempt:g}),this.Oi[t]),_=(f&&(f.lastRequestTime=Date.now(),this.Oi[t]=f),null!=(b=this.Jt.networkOverrideFunc)?b:fetch);if(o=yield _(u,v),clearTimeout(l),o.ok)return d=yield o.text(),x(m,o,r,d),this.Wt.tryBumpExpiryTime(m.sdkKey,m.urlConfig),{body:d,code:o.status};throw c=yield o.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${u} `+c)).name="NetworkError",h}catch(t){var g,i=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),a=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(s),p=(x(m,o,r,"",t),yield this.Wt.tryFetchUpdatedFallbackInfo(m.sdkKey,m.urlConfig,i,a));return(p&&(m.fallbackUrl=this.Wt.getActiveFallbackUrl(m.sdkKey,m.urlConfig)),!n||n<r||!M.has(null!=(y=null===o||void 0===o?void 0:o.status)?y:500))?(null!=(y=this.nt)&&y.call(this,{name:"error",error:t,tag:k.ErrorTag.NetworkError,requestArgs:m}),g=`A networking error occurred during ${e} request to ${u}.`,w.Log.error(g,i,t),null!=(O=this.$t)&&O.attachErrorIfNoneExists(g),null):(yield function(e){return j(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(E*(e*e),D)))})}(r),this.Zt($P($P({},m),{retries:n,attempt:r+1})))}})}Si(t){var e=Date.now(),i=null!=(i=this.Oi[t])?i:{count:0,lastRequestTime:e},n=e-i.lastRequestTime,n=Math.floor(.05*n);return i.count=Math.max(0,i.count-n),50<=i.count||(i.count+=1,i.lastRequestTime=e,this.Oi[t]=i,!1)}Xt(n){var r;return j(this,void 0,void 0,function*(){var t=null!=(r=n.fallbackUrl)?r:n.urlConfig.getUrl();n.urlConfig.endpoint!==T.Endpoint.qt&&n.urlConfig.endpoint!==T.Endpoint.Bt||(this.Jn=t);const e=$P({[T.NetworkParam.SdkKey]:n.sdkKey,[T.NetworkParam.SdkType]:u.SDKType.lt(n.sdkKey),[T.NetworkParam.SdkVersion]:h.SDK_VERSION,[T.NetworkParam.Time]:String(Date.now()),[T.NetworkParam.SessionID]:a.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Yt(r,s){return j(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=r,i=c.StableID.get(t),n=a.SessionID.get(t),t=u.SDKType.lt(t);return JSON.stringify($P($P({},s),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Qt(e,i){var t,n,r=(0,o.te)();if(this.m.disableStatsigEncoding||null!=(0,l.i)("no-encode")||null==r||!r.btoa)return i;try{var s=null!=(t=r.btoa(i).split("").reverse().join(""))?t:i;return e.params=$P($P({},null!=(n=e.params)?n:{}),{[T.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return w.Log.warn("Request encoding failed for "+e.urlConfig.getUrl()),i}}Ht(t,e){var i=this.Wt.getActiveFallbackUrl(e.sdkKey,e.urlConfig);return $P($P({},e),{method:t,fallbackUrl:i})}};const A=t=>!!t.sdkKey||(w.Log.warn("Unable to make request without an SDK key"),!1);function x(t,e,i,n,r){t.urlConfig.endpoint===T.Endpoint.qt&&S.Diagnostics.$(t.sdkKey,S.Diagnostics.Z(e,i,n,r))}},308:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.ee=e.NetworkFallbackResolver=void 0;const u=i(8809),n=i(1406),s=i(7512),l=i(4534);function a(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function c(t){return"statsig.network_fallback."+(0,n.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.ne=null,this.$t=null,this.ie={},this.re=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.$t=t}tryBumpExpiryTime(t,e){var i=null==(i=this.ne)?void 0:i[e.endpoint];i&&(i.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ne),{[e.endpoint]:i})))}getActiveFallbackUrl(t,e){var i;let n=this.ne;null==n&&(n=null!=(r=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return s.Log.error("Failed to parse FallbackInfo"),null}}(t))?r:{},this.ne=n);var r=n[e.endpoint];return!r||Date.now()>(null!=(i=r.expiryTime)?i:0)?(delete n[e.endpoint],this.ne=n,h(t,this.ne),null):r.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(i,n,r,s){var l,u;return o(this,void 0,void 0,function*(){try{var t,e;return a(r,s)?(t=null==n.customUrl&&null==n.fallbackUrls?yield this.se(n):n.fallbackUrls,!!(e=this.le(null==(l=this.ne)?void 0:l[n.endpoint],t))&&(this.oe(i,n.endpoint,e),!0)):!1}catch(t){return null!=(u=this.$t)&&u.logError("tryFetchUpdatedFallbackInfo",t),!1}})}oe(t,e,i){var i={url:i,expiryTime:Date.now()+6048e5,previous:[]},n=null==(n=this.ne)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.ne)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.ne=$P($P({},this.ne),{[e]:i}),h(t,this.ne)}se(s){var l;return o(this,void 0,void 0,function*(){var t=this.ie[s.endpoint];if(t&&Date.now()<t)return null;this.ie[s.endpoint]=Date.now()+144e5;var e=[],t=yield(0,u.et)(null!=(l=this.re)?l:fetch),i=d(s.defaultUrl);for(const r of t)if(r.startsWith(s.endpointDnsKey+"=")){var n=r.split("=");if(1<n.length){let t=n[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+i)}}return e})}le(t,e){var i;if(null==e)return null;var n=new Set(null!=(i=null==t?void 0:t.previous)?i:[]),r=null==t?void 0:t.url;let s=null;for(const u of e){var l=u.endsWith("/")?u.slice(0,-1):u;if(!n.has(u)&&l!==r){s=l;break}}return s}},e.ee=a},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},3091:(t,e)=>{$Q(e),e.SDKFlags=void 0;const i={};e.SDKFlags={setFlags:(t,e)=>{i[t]=e},get:(t,e)=>{return null!=(t=null==(t=i[t])?void 0:t[e])&&t}}},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={lt:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},ue(t,e){i[t]=e},ae(t){n&&"-react"!==n||(n="-"+t)}}},6830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.Gt=n.ce=n.he=n.kt=n.de=n.te=void 0;n.te=()=>"undefined"!=typeof window?window:null,n.de=()=>{var t=(0,n.te)();return null!=(t=null==t?void 0:t.document)?t:null},n.kt=()=>{var t;return null===(0,n.de)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.he=(t,e)=>{var i=(0,n.te)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.ce=(t,e)=>{var i=(0,n.de)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.Gt=()=>{var t;try{return null==(t=(0,n.te)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(2137),s=i(7512),l=i(4534),u=i(8023),o=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,n.o)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,l.G)(t)}(t);var i=Date.now();e=e||{sessionID:(0,u.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>o}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,u.getUUID)(),i.startTime=e),i.lastUpdate=e,i),r=t.sdkKey;r=d(r);try{(0,l.L)(r,n)}catch(t){s.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=h(i,o),t.ageTimeoutID=h(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},9122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(2137),r=i(7512),s=i(4534),l=i(8023),u={};function o(t){return"statsig.stable_id."+(0,n.o)(t)}function a(t,e){e=o(e);try{(0,s.L)(e,t)}catch(t){r.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==u[e]){let t=function(t){t=o(t);return(0,s.G)(t)}(e);null==t&&a(t=(0,l.getUUID)(),e),u[e]=t}return u[e]},setOverride:(t,e)=>{a(u[e]=t,e)}}},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const l=i(1845),u=i(5542),o=i(7770),a=i(7512),s=i(7787),c=i(6830),h=i(4143),d=i(4534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.ve=null,this.fe={};var r,s=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage._e(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.ge(n.storageProvider),this.O=t,this.m=null!=n?n:{},this.ji={},this.overrideAdapter=null!=(r=null==n?void 0:n.overrideAdapter)?r:null,this.pe=new o.EventLogger(t,s,i,n),this.$t=new u.ErrorBoundary(t,n,s),this.$t.wrap(this),this.$t.wrap(e),this.$t.wrap(this.pe),i.setErrorBoundary(this.$t),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=d.Storage,this.be(),r=t,s=this,(0,c.kt)()||(i=(0,l.l)(),e=null!=(e=i.instances)?e:{},s=s,null!=e[r]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[r]=s,i.firstInstance||(i.firstInstance=s),i.instances=e,__STATSIG__=i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.m.disableLogging=t.disableLogging,this.pe.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.m.disableStorage=t.disableStorage,d.Storage._e(t.disableStorage))}flush(){return this.pe.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.me("Uninitialized",null),this.ve=null,yield this.pe.stop()})}on(t,e){this.fe[t]||(this.fe[t]=[]),this.fe[t].push(e)}off(t,e){this.fe[t]&&-1!==(e=this.fe[t].indexOf(e))&&this.fe[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.$t.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.fe[i.name]&&this.fe[i.name].forEach(t=>e(t)),null!=(t=this.fe["*"])&&t.forEach(e)}me(t,e){this.loadingStatus=t,this.ji={},this.$emt({name:"values_updated",status:t,values:e})}ye(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.pe.incrementNonExposureCount(t):this.pe.enqueue(e)}wi(n,r){return(t,e)=>{var i;return!this.m.disableEvaluationMemoization&&(i=(0,s.createMemoKey)(n,t,e))?(i in this.ji||(3e3<=Object.keys(this.ji).length&&(this.ji={}),this.ji[i]=r(t,e)),this.ji[i]):r(t,e)}}}},2636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Oe=e.je=e.Se=e.xt=void 0;const r="statsig::config_exposure",s="statsig::gate_exposure",o="statsig::layer_exposure",a=(t,e,i,n,r)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:l(i,n),secondaryExposures:r,time:Date.now()});e.xt=({eventName:t})=>t===s||t===r||t===o,e.Se=(t,e)=>{var i,n={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),a(s,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])},e.je=(t,e)=>{var i,n={config:e.name,ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),null!=(null==(i=e.__evaluation)?void 0:i.passed)&&(n.rulePassed=String(e.__evaluation.passed)),a(r,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])};e.Oe=(t,e,i)=>{var n=e.__evaluation,r=!0===(null==(r=null==n?void 0:n.explicit_parameters)?void 0:r.includes(i));let s="",l=null!=(u=null==n?void 0:n.undelegated_secondary_exposures)?u:[];r&&(s=null!=(u=n.allocated_experiment_name)?u:"",l=n.secondary_exposures);var u={config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:s,isExplicitParameter:String(r)};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(u.configVersion=e.__evaluation.version),a(o,t,e.details,u,l)};const l=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.11.1";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e)},1098:(t,e)=>{$Q(e)},2059:(t,e,i)=>{$Q(e),e.we=e.Te=e.ke=e.Ie=e.De=e.Ee=void 0;const l=i(7512),u=i(6634),r="default";function s(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:r,__evaluation:i,value:n}}function n(t,e,i){var n=null!=(n=null==i?void 0:i.value)?n:{};return $P($P({},s(t,e,i,n)),{get:o(t,null==i?void 0:i.value)})}function o(n,r,s){return(t,e)=>{var i=null!=(i=null==r?void 0:r[t])?i:null;return null==i?null!=e?e:null:null==e||(0,u.Me)(i,e)?(null!=s&&s(t),i):(l.Log.warn(`Parameter type mismatch. '${n}.${t}' was found to be type '${typeof i}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.Ee=function(t,e,i){return s(t,e,i,!0===(null==i?void 0:i.value))},e.De=n,e.Ie=function(t,e,i){return t=n(t,e,i),$P($P({},t),{groupName:null!=(e=null==i?void 0:i.group_name)?e:null})},e.ke=function(t,e,i,n){return $P($P({},s(t,e,i,void 0)),{get:o(t,null==i?void 0:i.value,n),groupName:null!=(e=null==i?void 0:i.group_name)?e:null,__value:null!=(t=null==i?void 0:i.value)?t:{}})},e.Te=function(t,e,i,n){return $P($P($P({},t),e),{get:o(t.name,i,n)})},e.we=o},1812:(t,e)=>{$Q(e)},3932:(t,e)=>{$Q(e),e.UPDATE_DETAIL_ERROR_MESSAGES=e.createUpdateDetails=void 0;e.createUpdateDetails=(t,e,i,n,r,s)=>({duration:i,source:e,success:t,error:n,sourceUrl:r,warnings:s}),e.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}},8578:(t,e,i)=>{$Q(e),e.v=e.T=void 0;const n=i(1406),r=i(7512);e.T=function(t,e,i){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment?n.statsigEnvironment=e.environment:null!=i&&(n.statsigEnvironment={tier:i}),n}catch(t){return r.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Kt)(t):null}},4534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.L=i.G=i.Storage=void 0;var n=e(7512),e=e(6830);const r={},s={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>r[t]||null,setItem:(t,e)=>{r[t]=e},removeItem:t=>{delete r[t]},getAllKeys:()=>Object.keys(r)};let l=null;try{const a=(0,e.te)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(l={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==l&&void 0!==l?l:s,o=u;i.Storage={isReady:()=>o.isReady(),isReadyResolver:()=>o.isReadyResolver(),getProviderName:()=>o.getProviderName(),getItem:t=>{var e=()=>o.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.ge(s),null;throw t}},setItem:(t,e)=>o.setItem(t,e),removeItem:t=>o.removeItem(t),getAllKeys:()=>o.getAllKeys(),ge:t=>{u=t,o=t},_e:t=>{o=t?s:u}},i.G=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.L=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,i)=>{$Q(e),e.P=void 0;const r=i(7512);e.P=function(t,e,i){try{var n=JSON.parse(t);return"object"==typeof n&&0 in n,n}catch(t){}return r.Log.error("Failed to parse "+i),null}},6634:(t,e)=>{$Q(e),e.Me=e.zt=void 0,e.zt=function(t){return Array.isArray(t)?"array":typeof t},e.Me=function(t,e){var i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(e)}},8023:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="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<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},1881:(t,e,i)=>{$Q(e),e.UrlConfiguration=void 0;const r=i(7410),s={[r.Endpoint.qt]:"i",[r.Endpoint.jt]:"e",[r.Endpoint.Bt]:"d"};e.UrlConfiguration=class{constructor(t,e,i,n){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=s[t],e&&(this.customUrl=e),!e&&i&&(this.customUrl=i.endsWith("/")?""+i+t:i+"/"+t),n&&(this.fallbackUrls=n);e=r.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},2397:(t,e,i)=>{$Q(e),e.Ae=e.It=e.Rt=e.xe=void 0;i=i(6830);const n="foreground",r="background",s=[];let l=n,u=!1;e.xe=()=>l===n,e.Rt=()=>u,e.It=t=>{s.unshift(t)};e.Ae=e=>{e!==l&&(l=e,s.forEach(t=>t(e)))},(0,i.he)("focus",()=>{(u=!1,e.Ae)(n)}),(0,i.he)("blur",()=>(0,e.Ae)(r)),(0,i.he)("beforeunload",()=>{u=!0,(0,e.Ae)(r)}),(0,i.ce)("visibilitychange",()=>{(0,e.Ae)("visible"===document.visibilityState?n:r)})},6914:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(e,i);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,r)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),r=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),e.Storage=e.Log=e.EventLogger=e.Diagnostics=void 0,i(1845);const s=i(8962),l=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return s.Diagnostics}}),i(7770)),u=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return l.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return u.Log}});var o=i(8e3);const a=i(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),r(i(1845),e),r(i(2137),e),r(i(6427),e),r(i(694),e),r(i(8962),e),r(i(3539),e),r(i(5542),e),r(i(2922),e),r(i(2417),e),r(i(1406),e),r(i(1333),e),r(i(7512),e),r(i(7787),e),r(i(7410),e),r(i(7023),e),r(i(1405),e),r(i(1361),e),r(i(6830),e),r(i(5902),e),r(i(4143),e),r(i(9122),e),r(i(1375),e),r(i(2636),e),r(i(3206),e),r(i(1637),e),r(i(8e3),e),r(i(586),e),r(i(1098),e),r(i(2059),e),r(i(1812),e),r(i(8578),e),r(i(4534),e),r(i(3401),e),r(i(6634),e),r(i(1881),e),r(i(8023),e),r(i(2397),e),r(i(3932),e),r(i(3091),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:u.Log,SDK_VERSION:o.SDK_VERSION})},2016:(t,e,i)=>{$Q(e),e.AutoInit=void 0;const p=i(6914),m=i(2018);function b(t,e){var i;return null!=(i=e.get(t))?i:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,i,n,r;try{var s=(0,p.te)(),l=(0,p.de)();if(s&&l&&l.currentScript){var u=l.currentScript.getAttribute("src"),o=null==(t=s.location)?void 0:t.href;if(u&&o){var a=new URL(u,o).searchParams,c=null!=(i=b("sdkKey",a))?i:b("apiKey",a);if(c){var h={},d=b("proxy",a),v=(d&&(h.networkConfig={api:d}),null==(n=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:n[c]);let t=null;if(t=v instanceof m.StatsigClient?v:t)e({sdkKey:c,client:t});else{var f=l.currentScript.dataset;const _=function(t,e){if(t)if(t in e&&"function"==typeof e[t])return e[t];return null}(null!=(r=f.onstatsiginit)?r:f.onStatsigInit,s),g=new m.StatsigClient(c,function(){var t=(0,p.te)();if(!t)return{};let e=t.statsigUser||{};var i=(e="object"!=typeof e?{}:e).custom||{},n=e.customIDs||{};return $P($P({},e),{customIDs:$P({},n),custom:$P($P({},i),{useragent:t.navigator.userAgent,page_url:(0,p.Gt)()||"",language:null==(n=t.navigator)?void 0:n.language})})}(),h);g.initializeAsync().then(()=>{_&&_(g)}).catch(t=>{p.Log.error(t)}),e({sdkKey:c,client:g})}}}}}catch(t){p.Log.error("AutoInit failed",t)}}}},7262:(t,e,i)=>{$Q(e),e.Ne=void 0;const n=i(6914);function r(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.Ne=function(t,e){var i;return(e=(0,n.P)(e,"checksum","DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),r((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,r(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,r(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.Kt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,i)=>{$Q(e);const r=i(6914);e.default=class{constructor(t){this.O=t,this.Re=null,this.Pe=null,this.Ce="Uninitialized",this.Ue=0,this.Fe=0,this.Ge=null,this.Le=new Set}reset(){this.Pe=null,this.Re=null,this.Ce="Loading",this.Ue=0,this.Fe=0,this.Ge=null}finalize(){this.Pe||(this.Ce="NoValues")}getValues(){return this.Re?(0,r.P)(this.Re,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,r.P)(t.data,"has_updates","EvaluationResponse"))&&(this.Ce=t.source,!0===(null==i?void 0:i.has_updates)&&(this.Re=t.data,this.Ue=i.time,this.Fe=t.receivedAt,this.Pe=i,this.Ge=this.Ke(t.source,i),t.source&&i.user&&this.ze(e,i),i.sdk_flags?r.SDKFlags.setFlags(this.O,i.sdk_flags):r.SDKFlags.setFlags(this.O,{})),!0)}getWarnings(){if(0!==this.Le.size)return Array.from(this.Le)}getGate(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.param_stores,t)}getSource(){return this.Ce}Ke(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}qe(t,e){let i=null;return{result:i=t?t[e]||t[(0,r.h)(e)]:i,details:this.Be(null==i)}}ze(t,e){var i,n=r.StableID.get(this.O);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.Le.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,r.v)(t)!==(0,r.v)(i))&&this.Le.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.Ce||"NoValues"===this.Ce?{reason:this.Ce}:(t={reason:this.Ce,lcut:this.Ue,receivedAt:this.Fe},0<this.Le.size&&(t.warnings=Array.from(this.Le)),t)}Be(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.Ce&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.Ce&&null!=(n=this.Ge)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},8448:function(t,e,i){var l=this&&this.__awaiter||$A();$Q(e);const u=i(6914),o=i(7262);class n extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Ve=new u.UrlConfiguration(u.Endpoint.qt,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(i,n,r,s){return l(this,void 0,void 0,function*(){var t=n?(0,u.P)(n,"has_updates","InitializeResponse"):null;let e={user:s,hash:"djb2",deltasResponseRequested:!1,full_checksum:null};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0,full_checksum:t.full_checksum})),this.Je(i,t,e,r)})}Je(e,i,n,r){var s;return l(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,urlConfig:this.Ve,data:n,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!=(s=null==t?void 0:t.body)?s:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(s=t.body)?void 0:s.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,o.Ne)(i,t.body))?t:this.Je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),r)})}}e.default=n},3583:(t,e,i)=>{$Q(e),e.$e=void 0;const g=i(6914),p={disableExposureLog:!0};function m(t){return null==t||!1===t.disableExposureLog}function b(t,e){return null!=e&&!(0,g.Me)(t,e)}e.$e=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,r,s,l,u,o,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.zt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,m(_)?void 0:p).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,o=e,a=_,b(c=(u=v).getDynamicConfig(h.config_name,p).get(h.param_name),o)?o:(m(a)&&u.getDynamicConfig(h.config_name),c);case"experiment":return o=d,a=e,u=_,b(l=(c=v).getExperiment(o.experiment_name,p).get(o.param_name),a)?a:(m(u)&&c.getExperiment(o.experiment_name),l);case"layer":return l=d,n=e,r=_,b(s=(i=v).getLayer(l.layer_name,p).get(l.param_name),n)?n:(m(r)&&i.getLayer(l.layer_name).get(l.param_name),s);default:return e}}}},8198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const l=i(6914),u=i(4845),o=i(8448),r=i(3583),a=i(4131);class n extends l.StatsigClientBase{static instance(t){var e=(0,l.l)().instance(t);return e instanceof n?e:(l.Log.warn((0,l.kt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){l.SDKType.ue(t,"javascript-client");var n,r=new o.default(i,t=>{this.$emt(t)}),t=(super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,r,i),this.getFeatureGate=this.wi(l.MemoPrefix.Kn,this.Ti.bind(this)),this.getDynamicConfig=this.wi(l.MemoPrefix.Ln,this.Ii.bind(this)),this.getExperiment=this.wi(l.MemoPrefix.Vn,this.ki.bind(this)),this.getLayer=this.wi(l.MemoPrefix.$n,this.Di.bind(this)),this.getParameterStore=this.wi(l.MemoPrefix.Bn,this.Ri.bind(this)),this.We=new u.default(t),this.ht=r,this.He=this.xi(e,i),null!=(n=null==i?void 0:i.plugins)?n:[]);for(const s of t)s.bind(this)}initializeSync(t){var e;return"Uninitialized"!==this.loadingStatus?(0,l.createUpdateDetails)(!0,this.We.getSource(),-1,null,null,["MultipleInitializations",...null!=(e=this.We.getWarnings())?e:[]]):(this.pe.start(),this.updateUserSync(this.He,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.ve||(this.ve=this.Ye(t)),this.ve})}updateUserSync(t,e){var i=performance.now(),n=[...null!=(n=this.We.getWarnings())?n:[]],t=(this.Xe(t),this.dataAdapter.getDataSync(this.He)),e=(null==t&&n.push("NoCachedValues"),this.We.setValues(t,this.He),this.Qe(t),null==e?void 0:e.disableBackgroundCacheRefresh);return!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.Ze(null!=t?t:null,this.He),(0,l.createUpdateDetails)(!0,this.We.getSource(),performance.now()-i,this.$t.getLastSeenErrorAndReset(),this.ht.getLastUsedInitUrlAndReset(),n)}updateUserAsync(n,r){return s(this,void 0,void 0,function*(){this.Xe(n);var t=this.He,e=(l.Diagnostics.B(this.O),this.dataAdapter.getDataSync(t));if(this.We.setValues(e,this.He),this.me("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,r),t!==this.He)return(0,l.createUpdateDetails)(!1,this.We.getSource(),-1,new Error("User changed during update"),this.ht.getLastUsedInitUrlAndReset());let i=!1;null!=e&&(l.Diagnostics.W(this.O),i=this.We.setValues(e,this.He),l.Diagnostics.H(this.O,{success:i})),this.Qe(e),i||(this.$t.attachErrorIfNoneExists(l.UPDATE_DETAIL_ERROR_MESSAGES.NO_NETWORK_DATA),this.$emt({name:"initialization_failure"})),l.Diagnostics.V(this.O,i,this.We.getCurrentSourceDetails());t=l.Diagnostics.tt(this.He,this.pe,this.O,this.m);return(0,l.createUpdateDetails)(i,this.We.getSource(),t,this.$t.getLastSeenErrorAndReset(),this.ht.getLastUsedInitUrlAndReset(),this.We.getWarnings())})}getContext(){return{sdkKey:this.O,options:this.m,values:this.We.getValues(),user:JSON.parse(JSON.stringify(this.He)),errorBoundary:this.$t,session:l.StatsigSession.get(this.O),stableID:l.StableID.get(this.O)}}checkGate(t,e){return this.getFeatureGate(t,e).value}logEvent(t,e,i){this.pe.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.He,time:Date.now()}))}be(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Qe(null)})}Ye(t){return s(this,void 0,void 0,function*(){return l.Storage.isReady()||(yield l.Storage.isReadyResolver()),this.pe.start(),this.updateUserAsync(this.He,t)})}Qe(t){this.We.finalize(),this.me("Ready",t)}Ze(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{l.Log.error("An error occurred after update.",t)})}Xe(t){this.pe.reset(),this.We.reset(),this.He=this.xi(t,this.m)}xi(t,e){t=(0,l.T)(t,e),e=null==(e=t.customIDs)?void 0:e.stableID;return e&&l.StableID.setOverride(e,this.O),t}Ti(t,e){var{result:i,details:n}=this.We.getGate(t),n=(0,l.Ee)(t,n,i),r=null==(r=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:r.call(i,n,this.He,e),i=null!=r?r:n;return this.ye(t,(0,l.Se)(this.He,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}Ii(t,e){var{result:i,details:n}=this.We.getConfig(t),n=(0,l.De)(t,n,i),r=null==(r=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:r.call(i,n,this.He,e),i=null!=r?r:n;return this.ye(t,(0,l.je)(this.He,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}ki(t,e){var{result:i,details:n}=this.We.getConfig(t),n=(0,l.Ie)(t,n,i),r=null==(r=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:r.call(i,n,this.He,e),i=null!=r?r:n;return this.ye(t,(0,l.je)(this.He,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}Di(e,i){var{result:t,details:n}=this.We.getLayer(e),n=(0,l.ke)(e,n,t),r=null==(r=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:r.call(t,n,this.He,i);null!=i&&i.disableExposureLog&&this.pe.incrementNonExposureCount(e);const s=(0,l.Te)(n,r,null!=(t=null==r?void 0:r.__value)?t:n.__value,t=>{null!=i&&i.disableExposureLog||this.ye(e,(0,l.Oe)(this.He,s,t),i)});return this.$emt({name:"layer_evaluation",layer:s}),s}Ri(t,e){var{result:i,details:n}=this.We.getParamStore(t);return this.pe.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,r.$e)(this,i,e)}}}e.default=n},4131:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(6914),r=i(8448);class l extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.ht=null,this.m=null}attach(t,e){super.attach(t,e),this.ht=new r.default(null!=e?e:{})}getDataAsync(t,e,i){return this.D(t,(0,n.T)(e,this.m),i)}prefetchData(t,e){return this.A(t,e)}setData(t){var e=(0,n.P)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,e){super.setData(t,e)}R(e,i,n){var r;return s(this,void 0,void 0,function*(){var t=yield null==(r=this.ht)?void 0:r.fetchEvaluations(this.C(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}k(t){t=(0,n.o)(this.C(),t,null==(t=this.m)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.p}.`+t}N(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=l},2018:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(e,i);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,r)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),r=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},s=($Q(e),e.StatsigClient=void 0,i(8198));e.StatsigClient=s.default,r(i(6914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:s.default}),e.default=__STATSIG__},4535:(t,e,i)=>{$Q(e),e.AutoCapture=e.runStatsigAutoCapture=e.StatsigAutoCapturePlugin=void 0;const c=i(6914),n=i(5423),r=i(6325),s=i(6901),l={submit:n.AutoCaptureEventName.FORM_SUBMIT,click:n.AutoCaptureEventName.CLICK};function u(t,e){return new o(t,e)}e.StatsigAutoCapturePlugin=class{constructor(t){this.m=t,this.__plugin="auto-capture"}bind(t){u(t,this.m)}},e.runStatsigAutoCapture=u;class o{constructor(t,e){this.tn=t,this.en=Date.now(),this.nn=0,this.rn={},this.sn=null,this.Ei=!1,this.Ai=null;var{sdkKey:t,errorBoundary:i,values:n}=t.getContext(),n=(this.rn=null!=(n=null==(n=null==n?void 0:n.auto_capture_settings)?void 0:n.disabled_events)?n:{},this.$t=i,this.$t.wrap(this),this.ln=null==e?void 0:e.eventFilterFunc,(0,c.de)());(0,c.kt)()||((e=null!=(i=(__STATSIG__=(0,c.l)()).acInstances)?i:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.qt()):this.qt()}un(){const i=(0,c.te)();var t=(0,c.de)();if(i&&t){const e=(t,e=!0)=>{this.an(t||i.event),e&&this.Ni()};(0,r.cn)(t,"click",t=>e(t)),(0,r.cn)(t,"submit",t=>e(t)),(0,r.cn)(i,"error",t=>e(t,!1)),(0,r.cn)(i,"pagehide",()=>this.Mi()),(0,r.cn)(i,"beforeunload",()=>this.Mi()),(0,r.cn)(i,"scroll",()=>this.dn())}}vn(){var t=(0,c.te)(),e=(0,c.de)();t&&e&&((0,r.cn)(t,"popstate",()=>this.fn()),window.history.pushState=new Proxy(window.history.pushState,{apply:(t,e,[i,n,r])=>{t.apply(e,[i,n,r]),this.fn()}}),this.fn())}an(t){var e,i=null==(i=t.type)?void 0:i.toLowerCase();"error"===i&&t instanceof ErrorEvent?this._n(t):(e=(0,r.gn)(t))&&(0,r.St)(t,e)&&(t=l[i])&&({value:i,metadata:e}=(0,r.pn)(e),this.bn(t,i,e))}Ni(){var t=(0,c.te)();t&&(this.Ai&&clearTimeout(this.Ai),this.Ai=t.setTimeout(()=>{this.Mi(!0)},6e5))}qt(){this.un(),this.vn(),this.mn(),this.yn()}_n(t){var e=(null==t?void 0:t.error)||{};let i=e;if("object"==typeof e)try{i=JSON.stringify(e)}catch(t){i="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.bn(n.AutoCaptureEventName.ERROR,t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:i})}mn(){var t=this.On();try{this.jn(t)&&this.bn(n.AutoCaptureEventName.SESSION_START,(0,r.Sn)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}catch(t){this.$t.logError("AC::logSession",t)}}fn(){var t=(0,r.wn)(),e=this.sn;e&&t.href===e.href||(this.sn=t,e=(this.Ei=!1,s.Tn)(t),this.bn(n.AutoCaptureEventName.PAGE_VIEW,(0,r.Sn)(),e,{flushImmediately:!0,addNewSessionMetadata:!0}),this.Ni())}Mi(t=!1){this.Ei||(this.Ei=!0,this.bn(n.AutoCaptureEventName.PAGE_VIEW_END,(0,r.Sn)(),{scrollDepth:this.nn,pageViewLength:Date.now()-this.en,dueToInactivity:t},{flushImmediately:!0}))}yn(){const i=(0,c.te)();void 0!==(null===i||void 0===i?void 0:i.performance)&&"function"==typeof i.performance.getEntriesByType&&"function"==typeof i.performance.getEntriesByName&&setTimeout(()=>{var t={},e=i.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),i.performance.getEntriesByName("first-contentful-paint")),e=(e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),(0,r.kn)());e&&(t.effective_connection_type=e.effectiveType,t.rtt_ms=e.rtt,t.downlink_kbps=e.downlink,t.save_data=e.saveData),this.bn(n.AutoCaptureEventName.PERFORMANCE,(0,r.Sn)(),t)},1)}bn(t,e,i,n){var r,s,l,u=t.slice("auto_capture::".length);if(!this.rn[t]&&!this.rn[u]){u=this.On();try{var o=$P({sessionID:u.data.sessionID,page_url:null!=(l=null==(s=null==(r=(0,c.te)())?void 0:r.location)?void 0:s.href)?l:""},i),a=(null!=n&&n.addNewSessionMetadata&&(o.isNewSession=String(this.jn(u))),{eventName:t,value:e,metadata:o});this.ln&&!this.ln(a)||(this.tn.logEvent(a),null!=n&&n.flushImmediately&&this.tn.flush().catch(t=>{c.Log.error(t)}))}catch(t){this.$t.logError("AC::enqueue",t)}}}dn(){var t=null!=(t=null==(t=(0,c.de)())?void 0:t.body.scrollHeight)?t:1,e=(0,c.te)(),i=null!=(i=null==e?void 0:e.scrollY)?i:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.nn=Math.max(this.nn,Math.min(100,Math.round((i+e)/t*100))),this.Ni()}jn(t){return Math.abs(t.data.startTime-Date.now())<1e3}On(){return this.tn.getContext().session}}e.AutoCapture=o},5423:(t,e)=>{$Q(e),e.AutoCaptureEventName=void 0,e.AutoCaptureEventName={PAGE_VIEW:"auto_capture::page_view",PAGE_VIEW_END:"auto_capture::page_view_end",ERROR:"auto_capture::error",SESSION_START:"auto_capture::session_start",PERFORMANCE:"auto_capture::performance",FORM_SUBMIT:"auto_capture::form_submit",CLICK:"auto_capture::click"}},6325:(t,e,i)=>{$Q(e),e.kn=e.cn=e.Sn=e.wn=e.St=e.gn=e.pn=e.In=void 0;const s=i(6914);function l(t){var e={};if(t){var i=null==t?void 0:t.dataset;if(i)for(const n in i)e["data-"+n]=i[n]||""}return e}function u(e){if(e){let t=e;for(;t;){var i=t.tagName.toLowerCase();if(["body","document"].includes(i))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.In=l,e.pn=function(t){var e=t.tagName.toLowerCase(),i={},n=(0,s.Gt)()||"",r=("form"===(i.tagName=e)&&(i.action=t.getAttribute("action"),i.method=null!=(r=t.getAttribute("method"))?r:"GET",i.formName=t.getAttribute("name"),i.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(i.content=t.value,i.inputName=t.getAttribute("name")),u(t));return r&&(i.href=r.getAttribute("href")),"button"!==e&&!r||(i.content=(t.textContent||"").trim(),e=l(r||t),$P(i,e)),{value:n,metadata:i}},e.gn=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.St=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var i=e.tagName.toLowerCase(),n=t.type.toLowerCase();switch(i){case"html":return!1;case"form":return"submit"===n;case"input":case"select":case"textarea":return["change"].includes(n);default:if("click"===n){if("button"===i)return!0;if(u(e))return!0}return!1}},e.wn=function(){var t=null!=(t=null==(t=null==(t=(0,s.te)())?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.Sn=function(){return(0,s.Gt)()||""},e.cn=function(t,e,i){t&&t.addEventListener&&t.addEventListener(e,i,!0)},e.kn=function(){var t=(0,s.te)();return t&&t.navigator&&t.navigator.connection||null}},1964:(t,e,i)=>{$Q(e),e.StatsigAutoCapturePlugin=e.runStatsigAutoCapture=e.AutoCapture=e.AutoCaptureEventName=void 0;const n=i(4535);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return n.AutoCapture}}),$Q2(e,"StatsigAutoCapturePlugin",{enumerable:!0,get:function(){return n.StatsigAutoCapturePlugin}}),$Q2(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return n.runStatsigAutoCapture}});var r=i(5423);$Q2(e,"AutoCaptureEventName",{enumerable:!0,get:function(){return r.AutoCaptureEventName}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:n.AutoCapture,runStatsigAutoCapture:n.runStatsigAutoCapture,StatsigAutoCapturePlugin:n.StatsigAutoCapturePlugin}),e.default=__STATSIG__},6901:(t,e,i)=>{$Q(e),e.Tn=void 0;const a=i(6914);e.Tn=function(t){var e=(0,a.de)(),i=(0,a.te)();if(!e||!i)return{};var n=null==i?void 0:i.navigator,r=(null==e?void 0:e.referrer)||"";let s=new URL("empty:");if(r)try{s=new URL(r||"empty:")}catch(t){}u=s,l=function(t){const e=t.hostname,i=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return i||""}(u),u=u.searchParams.get("yahoo"===l?"p":"q")||"";var l={searchEngine:l,searchQuery:u},u=function(t){const i=t.searchParams,n={};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=i.get(t);e&&(n[t]=e)}),n}(t);const o={};return t.searchParams.forEach((t,e)=>{o[e]=t}),$P($P($P($P({},l),u),o),{title:(null==e?void 0:e.title)||"",locale:(null==n?void 0:n.language)||"unknown",hostname:t.hostname||"unknown",pathname:t.pathname||"unknown",referrer:r,screen_width:(null==(l=null==i?void 0:i.screen)?void 0:l.width)||"unknown",screen_height:(null==(u=null==i?void 0:i.screen)?void 0:u.height)||"unknown",viewport_width:(null==i?void 0:i.innerWidth)||"unknown",viewport_height:(null==i?void 0:i.innerHeight)||"unknown"})}}},n={};function r(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[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 l=r(1964);var s=r(2016);e.default=__STATSIG__,s.AutoInit.attempt(({client:t})=>{new l.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 i={1845:(t,i,e)=>{var n;$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.l=void 0;const r=e(7512);i.l=()=>__STATSIG__||o,i.i=t=>(0,i.l)()[t];i.t=t=>{var e=(0,i.l)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&r.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var s="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},u="undefined"!=typeof globalThis?globalThis:{};const o=null!=(n=null!=(n=null!=(n=l[s])?n:e[s])?n:u[s])?n:{instance:i.t};l[s]=o,e[s]=o,u[s]=o},2137:(t,e,i)=>{$Q(e),e.o=e.u=void 0;const r=i(1406);function n(t,e,i){if(i)return i(t,e);const n=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(i=null==e?void 0:e.userID)?i:""),"cids:"+Object.keys(n).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+n[t]).join(","),"k:"+t];return(0,r.h)(e.join("|"))}e.u=n,e.o=function(t,e,i){return e?n(t,e,i):(0,r.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.Wn=e.DataAdapterCore=void 0;const o=i(7512),a=i(9122),s=i(8578),l=i(4534),c=i(3401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,s.v)(n)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.p=e,this.m=null,this.O=null,this.j="statsig.last_modified_time."+e,this.S=new n}attach(t,e){this.O=t,this.m=e}getDataSync(t){var t=t&&(0,s.T)(t,this.m),e=this.k(t),i=this.S.get(e,t);return i||((i=this.I(e))?(this.S.add(e,i),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,s.T)(e,this.m),i=this.k(e);this.S.add(i,h("Bootstrap",t,null,e))}D(e,i,n){return r(this,void 0,void 0,function*(){l.Storage.isReady()||(yield l.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.M(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(o.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}A(i,n){return r(this,void 0,void 0,function*(){var t=i&&(0,s.T)(i,this.m),e=this.k(t),t=yield this.D(null,t,n);t&&this.S.add(e,$P($P({},t),{source:"Prefetch"}))})}M(s,l,u){return r(this,void 0,void 0,function*(){let t=null;s&&this.N(s,l)&&(t=s.data);var e=yield this.R(t,l,u);if(!e)return o.Log.debug("No response returned for latest value"),null;var i=(0,c.P)(e,"has_updates","Response"),n=this.C(),n=a.StableID.get(n);let r=null;if(!0===(null==i?void 0:i.has_updates))r=h("Network",e,n,l);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;r=h("NetworkNotModified",t,n,l)}e=this.k(l);return this.S.add(e,r),this.U(e,r),r})}C(){return null!=this.O?this.O:(o.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}U(t,e){l.Storage.setItem(t,JSON.stringify(e)),this.F(t)}F(t){var e=null!=(e=(0,l.G)(this.j))?e:{},t=(e[t]=Date.now(),u(e,10));t&&(delete e[t],l.Storage.removeItem(t)),(0,l.L)(this.j,e)}},e.Wn=h;class n{constructor(){this.K={}}get(t,e){var t=this.K[t],i=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&i&&e!==i?(o.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=u(this.K,9);i&&delete this.K[i],this.K[t]=e}merge(t){this.K=$P($P({},this.K),t)}}function u(r,t){var e=Object.keys(r);return e.length<=t?null:e.reduce((t,e)=>{var i=r[t],n=r[e];return"object"==typeof i&&"object"==typeof n?n.receivedAt<i.receivedAt?e:t:n<i?e:t})}},8962:(t,l)=>{$Q2(l,"__esModule",{value:!0}),l.Diagnostics=void 0;const n=new Map,i="start";function r(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function s(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}l.Diagnostics={q:t=>n.get(t),B:t=>{s(t,r({},i,"overall"))},V:(t,e,i)=>{s(t,r({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},J:(t,e)=>{s(t,r(e,i,"initialize","network_request"))},$:(t,e)=>{s(t,r(e,"end","initialize","network_request"))},W:t=>{s(t,r({},i,"initialize","process"))},H:(t,e)=>{s(t,r(e,"end","initialize","process"))},Y:t=>{n.delete(t)},X(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Z(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:l.Diagnostics.X(n)}},tt(t,e,i,n){var r,s=l.Diagnostics.q(i);return null==s||s.length<=0?-1:(r=s[s.length-1].timestamp-s[0].timestamp,l.Diagnostics.Y(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:s.slice(),statsigOptions:n}),e.enqueue(i),r)}}},8809:function(t,e){var i=this&&this.__awaiter||$A();$Q(e),e.et=void 0;const r=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),s="https://cloudflare-dns.com/dns-query",l=["i","e","d"],u=200;e.et=function(e){return i(this,void 0,void 0,function*(){var i=yield e(s,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:r});if(i.ok){var t,i=yield i.arrayBuffer(),i=new Uint8Array(i);{var n=i,i=n.findIndex((t,e)=>e<u&&"="===String.fromCharCode(t)&&l.includes(String.fromCharCode(n[e-1])));if(-1===i)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=i-1;t<n.length;t++)e+=String.fromCharCode(n[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},3539:(t,e)=>{$Q(e)},5542:function(t,u,e){var i=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const n=e(7512),o=e(5902),a=e(8e3),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");function h(t){return t instanceof Error?t:"string"==typeof t?new Error(t):new Error("An unknown error occurred.")}u.ErrorBoundary=class{constructor(t,e,i,n){this.O=t,this.m=e,this.nt=i,this.qn=n,this.it=new Set}wrap(n){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.rt(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.st("eb:wrap",t)}}logError(t,e){this.st(t,e)}getLastSeenErrorAndReset(){var t=this.qn;return this.qn=void 0,null!=t?t:null}attachErrorIfNoneExists(t){this.qn||(this.qn=h(t))}rt(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.st(e,t)):i}catch(t){return this.st(e,t),null}}st(s,l){try{n.Log.warn("Caught error in "+s,{error:l});i(this,void 0,void 0,function*(){var t,e=l||Error(c),i=e instanceof Error,n=i?e.name:"No Name",r=h(e);this.qn=r,this.it.has(n)||(this.it.add(n),null!=(r=null==(r=this.m)?void 0:r.networkConfig)&&r.preventAllNetworkTraffic?null!=(r=this.nt)&&r.call(this,{name:"error",error:l,tag:s}):(r=o.SDKType.lt(this.O),t=a.StatsigMetadataProvider.get(),i=i?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(e),e=JSON.stringify($P({tag:s,exception:n,info:i},$P($P({},t),{sdkType:r}))),yield(null!=(n=null==(i=null==(n=this.m)?void 0:n.networkConfig)?void 0:i.networkOverrideFunc)?n:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.O,"STATSIG-SDK-TYPE":String(r),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=(i=this.nt)&&i.call(this,{name:"error",error:l,tag:s})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const n=i(2137),r=i(1406),l=i(7512),u=i(7410),o=i(6830),a=i(1637),c=i(4534),h=i(1881),d=i(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static ot(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static ut(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.O=t,this.nt=e,this.ht=i,this.m=n,this.dt=[],this.vt={},this.ft={},this._t=!1,this.gt=Date.now(),this.bt=!0===(null==n?void 0:n.disableLogging),this.yt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:100;e=null==n?void 0:n.networkConfig;this.Ot=new h.UrlConfiguration(u.Endpoint.jt,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}setLoggingDisabled(t){this.bt=t}enqueue(t){this.St(t)&&(this.wt(t),this.Tt(),this.dt.length>this.yt)&&_.ot(this.O)}incrementNonExposureCount(t){var e=null!=(e=this.ft[t])?e:0;this.ft[t]=e+1}reset(){this.vt={}}start(){(0,o.kt)()||(v[this.O]=this,(0,d.It)(t=>{"background"===t?_.ot(this.O):"foreground"===t&&_.ut(this.O)}),this.ct(f.Startup),this.Dt())}stop(){return s(this,void 0,void 0,function*(){this.Et&&(clearInterval(this.Et),this.Et=null),delete v[this.O],yield this.flush()})}flush(){return s(this,void 0,void 0,function*(){var t;this.Mt(),0!==this.dt.length&&(t=this.dt,this.dt=[],yield this.At(t))})}Tt(){this._t||(this._t=!0,200<Date.now()-this.gt)||setTimeout(()=>_.ot(this.O),200)}St(t){if((0,o.kt)())return!1;if((0,a.xt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,n.u)(this.O,e),i=t.metadata||{},t=[t.eventName,e,i.gate,i.config,i.ruleID,i.allocatedExperiment,i.parameterName,String(i.isExplicitParameter),i.reason].join("|"),e=this.vt[t],i=Date.now();if(e&&i-e<6e5)return!1;1e3<Object.keys(this.vt).length&&(this.vt={}),this.vt[t]=i}return!0}At(i){var n,r;return s(this,void 0,void 0,function*(){if(this.bt)return this.Nt(i),!1;try{var t=(0,d.Rt)()&&this.ht.isBeaconSupported()&&null==(null==(r=null==(n=this.m)?void 0:n.networkConfig)?void 0:r.networkOverrideFunc),e=(this.nt({name:"pre_logs_flushed",events:i}),t?yield this.Pt(i):yield this.Ct(i));return e.success?(this.nt({name:"logs_flushed",events:i}),!0):(l.Log.warn("Failed to flush events."),this.Nt(i),!1)}catch(t){return l.Log.warn("Failed to flush events."),!1}})}Ct(e){var i;return s(this,void 0,void 0,function*(){var t=yield this.ht.post(this.Ut(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}Pt(t){return s(this,void 0,void 0,function*(){return{success:yield this.ht.beacon(this.Ut(t))}})}Ut(t){return{sdkKey:this.O,data:{events:t},urlConfig:this.Ot,retries:3,isCompressable:!0,params:{[u.NetworkParam.EventCount]:String(t.length)}}}Nt(t){for(;500<t.length;)t.shift();var e=this.o();try{(0,c.L)(e,t)}catch(t){l.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.o();s(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.G)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.At(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{l.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,r.h)(this.O)}wt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.Ft(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));l.Log.debug("Enqueued Event:",i),this.dt.push(i)}Mt(){0!==Object.keys(this.ft).length&&(this.wt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.ft)}}),this.ft={})}Ft(){var t;if(!1!==(null==(t=this.m)?void 0:t.includeCurrentPageUrlWithEvents))return(0,o.Gt)()}Dt(){var t=null!=(t=null==(t=this.m)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{var t=v[this.O];t&&t.Et===e?_.ot(this.O):clearInterval(e)},t);this.Et=e}}e.EventLogger=_},1406:(t,s,e)=>{$Q2(s,"__esModule",{value:!0}),s.Lt=s.Kt=s.h=void 0;const l=e(6634);s.h=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},s.Kt=(t,e)=>(0,s.h)(JSON.stringify((0,s.Lt)(t,e)));s.Lt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const r={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,l.zt)(e)?r[t]=e:r[t]=(0,s.Lt)(e,null!=n?n-1:n)}),r}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...t){n.level>=e.LogLevel.Info&&console.info(" INFO ",...i(t))}static debug(...t){n.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){n.level>=e.LogLevel.Warn&&console.warn(" WARN ",...i(t))}static error(...t){n.level>=e.LogLevel.Error&&console.error(" ERROR ",...i(t))}}(e.Log=n).level=e.LogLevel.Warn},7787:(t,e)=>{$Q(e),e.createMemoKey=e.MemoPrefix=void 0,e.MemoPrefix={Kn:"g",Ln:"c",Vn:"e",$n:"l",Bn:"p"};const s=new Set([]),l=new Set(["userPersistedValues"]);e.createMemoKey=function(t,e,i){let n=t+"|"+e;if(i)for(const r of Object.keys(i)){if(l.has(r))return;s.has(r)?n+=`|${r}=true`:n+=`|${r}=`+i[r]}return n}},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=e.Endpoint=void 0,e.Endpoint={qt:"initialize",jt:"rgstr",Bt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.jt]:"https://prodregistryv2.org/v1",[e.Endpoint.qt]:"https://featureassets.org/v1",[e.Endpoint.Bt]:"https://api.statsigcdn.com/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,i){var j=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const l=i(1845),S=i(8962),w=i(7512),T=i(7410),n=i(308),u=i(5902),o=i(6830),a=i(4143),c=i(9122),k=i(2636),h=i(8e3),I=i(2397),E=500,D=3e4;const M=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.nt=e,this.$t=null,this.Vt=1e4,this.Jt={},this.m={},this.Oi={},this.Jn=null,t&&(this.m=t),this.m.networkConfig&&(this.Jt=this.m.networkConfig),this.Jt.networkTimeoutMs&&(this.Vt=this.Jt.networkTimeoutMs),this.Wt=new n.NetworkFallbackResolver(this.m)}setErrorBoundary(t){this.$t=t,this.$t.wrap(this),this.$t.wrap(this.Wt),this.Wt.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){var t=this.Jn;return this.Jn=null,t}beacon(n){return j(this,void 0,void 0,function*(){var t,e,i;return!!A(n)&&(e=this.Ht("POST",n),t=yield this.Yt(e,n.data),e=yield this.Xt(e),(i=navigator).sendBeacon.bind(i)(e,t))})}post(e){return j(this,void 0,void 0,function*(){var t=this.Ht("POST",e);return t.body=yield this.Yt(t,e.data),e.isStatsigEncodable&&(t.body=this.Qt(t,t.body)),this.Zt(t)})}get(t){t=this.Ht("GET",t);return this.Zt(t)}Zt(m){var b,y,O;return j(this,void 0,void 0,function*(){if(!A(m))return null;if(this.Jt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:r}=m,t=m.urlConfig.endpoint;if(this.Si(t))return w.Log.warn(`Request to ${t} was blocked because you are making requests too frequently.`),null;r=null!=r?r:1;const s="undefined"!=typeof AbortController?new AbortController:null;var l=setTimeout(()=>{null!==s&&void 0!==s&&s.abort(`Timeout of ${this.Vt}ms expired.`)},this.Vt),u=yield this.Xt(m);let o=null;var a=(0,I.Rt)();try{var c,h,d,v={method:e,body:i,headers:$P({},m.headers),signal:null===s||void 0===s?void 0:s.signal,priority:m.priority,keepalive:a},f=(g=r,(p=m).urlConfig.endpoint===T.Endpoint.qt&&S.Diagnostics.J(p.sdkKey,{attempt:g}),this.Oi[t]),_=(f&&(f.lastRequestTime=Date.now(),this.Oi[t]=f),null!=(b=this.Jt.networkOverrideFunc)?b:fetch);if(o=yield _(u,v),clearTimeout(l),o.ok)return d=yield o.text(),x(m,o,r,d),this.Wt.tryBumpExpiryTime(m.sdkKey,m.urlConfig),{body:d,code:o.status};throw c=yield o.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${u} `+c)).name="NetworkError",h}catch(t){var g,i=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),a=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(s),p=(x(m,o,r,"",t),yield this.Wt.tryFetchUpdatedFallbackInfo(m.sdkKey,m.urlConfig,i,a));return(p&&(m.fallbackUrl=this.Wt.getActiveFallbackUrl(m.sdkKey,m.urlConfig)),!n||n<r||!M.has(null!=(y=null===o||void 0===o?void 0:o.status)?y:500))?(null!=(y=this.nt)&&y.call(this,{name:"error",error:t,tag:k.ErrorTag.NetworkError,requestArgs:m}),g=`A networking error occurred during ${e} request to ${u}.`,w.Log.error(g,i,t),null!=(O=this.$t)&&O.attachErrorIfNoneExists(g),null):(yield function(e){return j(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(E*(e*e),D)))})}(r),this.Zt($P($P({},m),{retries:n,attempt:r+1})))}})}Si(t){var e=Date.now(),i=null!=(i=this.Oi[t])?i:{count:0,lastRequestTime:e},n=e-i.lastRequestTime,n=Math.floor(.05*n);return i.count=Math.max(0,i.count-n),50<=i.count||(i.count+=1,i.lastRequestTime=e,this.Oi[t]=i,!1)}Xt(n){var r;return j(this,void 0,void 0,function*(){var t=null!=(r=n.fallbackUrl)?r:n.urlConfig.getUrl();n.urlConfig.endpoint!==T.Endpoint.qt&&n.urlConfig.endpoint!==T.Endpoint.Bt||(this.Jn=t);const e=$P({[T.NetworkParam.SdkKey]:n.sdkKey,[T.NetworkParam.SdkType]:u.SDKType.lt(n.sdkKey),[T.NetworkParam.SdkVersion]:h.SDK_VERSION,[T.NetworkParam.Time]:String(Date.now()),[T.NetworkParam.SessionID]:a.SessionID.get(n.sdkKey)},n.params);var i=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(i?"?"+i:"")})}Yt(r,s){return j(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=r,i=c.StableID.get(t),n=a.SessionID.get(t),t=u.SDKType.lt(t);return JSON.stringify($P($P({},s),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:t,fallbackUrl:e})}))})}Qt(e,i){var t,n,r=(0,o.te)();if(this.m.disableStatsigEncoding||null!=(0,l.i)("no-encode")||null==r||!r.btoa)return i;try{var s=null!=(t=r.btoa(i).split("").reverse().join(""))?t:i;return e.params=$P($P({},null!=(n=e.params)?n:{}),{[T.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return w.Log.warn("Request encoding failed for "+e.urlConfig.getUrl()),i}}Ht(t,e){var i=this.Wt.getActiveFallbackUrl(e.sdkKey,e.urlConfig);return $P($P({},e),{method:t,fallbackUrl:i})}};const A=t=>!!t.sdkKey||(w.Log.warn("Unable to make request without an SDK key"),!1);function x(t,e,i,n,r){t.urlConfig.endpoint===T.Endpoint.qt&&S.Diagnostics.$(t.sdkKey,S.Diagnostics.Z(e,i,n,r))}},308:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.ee=e.NetworkFallbackResolver=void 0;const u=i(8809),n=i(1406),s=i(7512),l=i(4534);function a(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function c(t){return"statsig.network_fallback."+(0,n.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?l.Storage.setItem(t,JSON.stringify(e)):l.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.ne=null,this.$t=null,this.ie={},this.re=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.$t=t}tryBumpExpiryTime(t,e){var i=null==(i=this.ne)?void 0:i[e.endpoint];i&&(i.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ne),{[e.endpoint]:i})))}getActiveFallbackUrl(t,e){var i;let n=this.ne;null==n&&(n=null!=(r=function(t){t=c(t),t=l.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return s.Log.error("Failed to parse FallbackInfo"),null}}(t))?r:{},this.ne=n);var r=n[e.endpoint];return!r||Date.now()>(null!=(i=r.expiryTime)?i:0)?(delete n[e.endpoint],this.ne=n,h(t,this.ne),null):r.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(i,n,r,s){var l,u;return o(this,void 0,void 0,function*(){try{var t,e;return a(r,s)?(t=null==n.customUrl&&null==n.fallbackUrls?yield this.se(n):n.fallbackUrls,!!(e=this.le(null==(l=this.ne)?void 0:l[n.endpoint],t))&&(this.oe(i,n.endpoint,e),!0)):!1}catch(t){return null!=(u=this.$t)&&u.logError("tryFetchUpdatedFallbackInfo",t),!1}})}oe(t,e,i){var i={url:i,expiryTime:Date.now()+6048e5,previous:[]},n=null==(n=this.ne)?void 0:n[e],n=(n&&i.previous.push(...n.previous),10<i.previous.length&&(i.previous=[]),null==(n=null==(n=this.ne)?void 0:n[e])?void 0:n.url);null!=n&&i.previous.push(n),this.ne=$P($P({},this.ne),{[e]:i}),h(t,this.ne)}se(s){var l;return o(this,void 0,void 0,function*(){var t=this.ie[s.endpoint];if(t&&Date.now()<t)return null;this.ie[s.endpoint]=Date.now()+144e5;var e=[],t=yield(0,u.et)(null!=(l=this.re)?l:fetch),i=d(s.defaultUrl);for(const r of t)if(r.startsWith(s.endpointDnsKey+"=")){var n=r.split("=");if(1<n.length){let t=n[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+i)}}return e})}le(t,e){var i;if(null==e)return null;var n=new Set(null!=(i=null==t?void 0:t.previous)?i:[]),r=null==t?void 0:t.url;let s=null;for(const u of e){var l=u.endsWith("/")?u.slice(0,-1):u;if(!n.has(u)&&l!==r){s=l;break}}return s}},e.ee=a},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},3091:(t,e)=>{$Q(e),e.SDKFlags=void 0;const i={};e.SDKFlags={setFlags:(t,e)=>{i[t]=e},get:(t,e)=>{return null!=(t=null==(t=i[t])?void 0:t[e])&&t}}},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={lt:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},ue(t,e){i[t]=e},ae(t){n&&"-react"!==n||(n="-"+t)}}},6830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.Gt=n.ce=n.he=n.kt=n.de=n.te=void 0;n.te=()=>"undefined"!=typeof window?window:null,n.de=()=>{var t=(0,n.te)();return null!=(t=null==t?void 0:t.document)?t:null},n.kt=()=>{var t;return null===(0,n.de)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.he=(t,e)=>{var i=(0,n.te)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.ce=(t,e)=>{var i=(0,n.de)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.Gt=()=>{var t;try{return null==(t=(0,n.te)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(2137),s=i(7512),l=i(4534),u=i(8023),o=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,n.o)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,l.G)(t)}(t);var i=Date.now();e=e||{sessionID:(0,u.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>o}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,u.getUUID)(),i.startTime=e),i.lastUpdate=e,i),r=t.sdkKey;r=d(r);try{(0,l.L)(r,n)}catch(t){s.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=h(i,o),t.ageTimeoutID=h(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},9122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(2137),r=i(7512),s=i(4534),l=i(8023),u={};function o(t){return"statsig.stable_id."+(0,n.o)(t)}function a(t,e){e=o(e);try{(0,s.L)(e,t)}catch(t){r.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==u[e]){let t=function(t){t=o(t);return(0,s.G)(t)}(e);null==t&&a(t=(0,l.getUUID)(),e),u[e]=t}return u[e]},setOverride:(t,e)=>{a(u[e]=t,e)}}},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const l=i(1845),u=i(5542),o=i(7770),a=i(7512),s=i(7787),c=i(6830),h=i(4143),d=i(4534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.ve=null,this.fe={};var r,s=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage._e(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.ge(n.storageProvider),this.O=t,this.m=null!=n?n:{},this.ji={},this.overrideAdapter=null!=(r=null==n?void 0:n.overrideAdapter)?r:null,this.pe=new o.EventLogger(t,s,i,n),this.$t=new u.ErrorBoundary(t,n,s),this.$t.wrap(this),this.$t.wrap(e),this.$t.wrap(this.pe),i.setErrorBoundary(this.$t),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=d.Storage,this.be(),r=t,s=this,(0,c.kt)()||(i=(0,l.l)(),e=null!=(e=i.instances)?e:{},s=s,null!=e[r]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[r]=s,i.firstInstance||(i.firstInstance=s),i.instances=e,__STATSIG__=i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.m.disableLogging=t.disableLogging,this.pe.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.m.disableStorage=t.disableStorage,d.Storage._e(t.disableStorage))}flush(){return this.pe.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.me("Uninitialized",null),this.ve=null,yield this.pe.stop()})}on(t,e){this.fe[t]||(this.fe[t]=[]),this.fe[t].push(e)}off(t,e){this.fe[t]&&-1!==(e=this.fe[t].indexOf(e))&&this.fe[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.$t.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.fe[i.name]&&this.fe[i.name].forEach(t=>e(t)),null!=(t=this.fe["*"])&&t.forEach(e)}me(t,e){this.loadingStatus=t,this.ji={},this.$emt({name:"values_updated",status:t,values:e})}ye(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.pe.incrementNonExposureCount(t):this.pe.enqueue(e)}wi(n,r){return(t,e)=>{var i;return!this.m.disableEvaluationMemoization&&(i=(0,s.createMemoKey)(n,t,e))?(i in this.ji||(3e3<=Object.keys(this.ji).length&&(this.ji={}),this.ji[i]=r(t,e)),this.ji[i]):r(t,e)}}}},2636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Oe=e.je=e.Se=e.xt=void 0;const r="statsig::config_exposure",s="statsig::gate_exposure",o="statsig::layer_exposure",a=(t,e,i,n,r)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:l(i,n),secondaryExposures:r,time:Date.now()});e.xt=({eventName:t})=>t===s||t===r||t===o,e.Se=(t,e)=>{var i,n={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),a(s,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])},e.je=(t,e)=>{var i,n={config:e.name,ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(n.configVersion=e.__evaluation.version),null!=(null==(i=e.__evaluation)?void 0:i.passed)&&(n.rulePassed=String(e.__evaluation.passed)),a(r,t,e.details,n,null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[])};e.Oe=(t,e,i)=>{var n=e.__evaluation,r=!0===(null==(r=null==n?void 0:n.explicit_parameters)?void 0:r.includes(i));let s="",l=null!=(u=null==n?void 0:n.undelegated_secondary_exposures)?u:[];r&&(s=null!=(u=n.allocated_experiment_name)?u:"",l=n.secondary_exposures);var u={config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:s,isExplicitParameter:String(r)};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(u.configVersion=e.__evaluation.version),a(o,t,e.details,u,l)};const l=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.12.0";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e)},1098:(t,e)=>{$Q(e)},2059:(t,e,i)=>{$Q(e),e.we=e.Te=e.ke=e.Ie=e.De=e.Ee=void 0;const l=i(7512),u=i(6634),r="default";function s(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:r,__evaluation:i,value:n}}function n(t,e,i){var n=null!=(n=null==i?void 0:i.value)?n:{};return $P($P({},s(t,e,i,n)),{get:o(t,null==i?void 0:i.value)})}function o(n,r,s){return(t,e)=>{var i=null!=(i=null==r?void 0:r[t])?i:null;return null==i?null!=e?e:null:null==e||(0,u.Me)(i,e)?(null!=s&&s(t),i):(l.Log.warn(`Parameter type mismatch. '${n}.${t}' was found to be type '${typeof i}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.Ee=function(t,e,i){return s(t,e,i,!0===(null==i?void 0:i.value))},e.De=n,e.Ie=function(t,e,i){return t=n(t,e,i),$P($P({},t),{groupName:null!=(e=null==i?void 0:i.group_name)?e:null})},e.ke=function(t,e,i,n){return $P($P({},s(t,e,i,void 0)),{get:o(t,null==i?void 0:i.value,n),groupName:null!=(e=null==i?void 0:i.group_name)?e:null,__value:null!=(t=null==i?void 0:i.value)?t:{}})},e.Te=function(t,e,i,n){return $P($P($P({},t),e),{get:o(t.name,i,n)})},e.we=o},1812:(t,e)=>{$Q(e)},3932:(t,e)=>{$Q(e),e.UPDATE_DETAIL_ERROR_MESSAGES=e.createUpdateDetails=void 0;e.createUpdateDetails=(t,e,i,n,r,s)=>({duration:i,source:e,success:t,error:n,sourceUrl:r,warnings:s}),e.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}},8578:(t,e,i)=>{$Q(e),e.v=e.T=void 0;const n=i(1406),r=i(7512);e.T=function(t,e,i){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment?n.statsigEnvironment=e.environment:null!=i&&(n.statsigEnvironment={tier:i}),n}catch(t){return r.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Kt)(t):null}},4534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.L=i.G=i.Storage=void 0;var n=e(7512),e=e(6830);const r={},s={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>r[t]||null,setItem:(t,e)=>{r[t]=e},removeItem:t=>{delete r[t]},getAllKeys:()=>Object.keys(r)};let l=null;try{const a=(0,e.te)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(l={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==l&&void 0!==l?l:s,o=u;i.Storage={isReady:()=>o.isReady(),isReadyResolver:()=>o.isReadyResolver(),getProviderName:()=>o.getProviderName(),getItem:t=>{var e=()=>o.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.ge(s),null;throw t}},setItem:(t,e)=>o.setItem(t,e),removeItem:t=>o.removeItem(t),getAllKeys:()=>o.getAllKeys(),ge:t=>{u=t,o=t},_e:t=>{o=t?s:u}},i.G=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.L=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,i)=>{$Q(e),e.P=void 0;const r=i(7512);e.P=function(t,e,i){try{var n=JSON.parse(t);if(n&&"object"==typeof n&&e in n)return n}catch(t){}return r.Log.error("Failed to parse "+i),null}},6634:(t,e)=>{$Q(e),e.Me=e.zt=void 0,e.zt=function(t){return Array.isArray(t)?"array":typeof t},e.Me=function(t,e){var i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(e)}},8023:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="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<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},1881:(t,e,i)=>{$Q(e),e.UrlConfiguration=void 0;const r=i(7410),s={[r.Endpoint.qt]:"i",[r.Endpoint.jt]:"e",[r.Endpoint.Bt]:"d"};e.UrlConfiguration=class{constructor(t,e,i,n){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=s[t],e&&(this.customUrl=e),!e&&i&&(this.customUrl=i.endsWith("/")?""+i+t:i+"/"+t),n&&(this.fallbackUrls=n);e=r.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},2397:(t,e,i)=>{$Q(e),e.Ae=e.It=e.Rt=e.xe=void 0;i=i(6830);const n="foreground",r="background",s=[];let l=n,u=!1;e.xe=()=>l===n,e.Rt=()=>u,e.It=t=>{s.unshift(t)};e.Ae=e=>{e!==l&&(l=e,s.forEach(t=>t(e)))},(0,i.he)("focus",()=>{(u=!1,e.Ae)(n)}),(0,i.he)("blur",()=>(0,e.Ae)(r)),(0,i.he)("beforeunload",()=>{u=!0,(0,e.Ae)(r)}),(0,i.ce)("visibilitychange",()=>{(0,e.Ae)("visible"===document.visibilityState?n:r)})},6914:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(e,i);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,r)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),r=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),e.Storage=e.Log=e.EventLogger=e.Diagnostics=void 0,i(1845);const s=i(8962),l=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return s.Diagnostics}}),i(7770)),u=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return l.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return u.Log}});var o=i(8e3);const a=i(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),r(i(1845),e),r(i(2137),e),r(i(6427),e),r(i(694),e),r(i(8962),e),r(i(3539),e),r(i(5542),e),r(i(2922),e),r(i(2417),e),r(i(1406),e),r(i(1333),e),r(i(7512),e),r(i(7787),e),r(i(7410),e),r(i(7023),e),r(i(1405),e),r(i(1361),e),r(i(6830),e),r(i(5902),e),r(i(4143),e),r(i(9122),e),r(i(1375),e),r(i(2636),e),r(i(3206),e),r(i(1637),e),r(i(8e3),e),r(i(586),e),r(i(1098),e),r(i(2059),e),r(i(1812),e),r(i(8578),e),r(i(4534),e),r(i(3401),e),r(i(6634),e),r(i(1881),e),r(i(8023),e),r(i(2397),e),r(i(3932),e),r(i(3091),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:u.Log,SDK_VERSION:o.SDK_VERSION})},2016:(t,e,i)=>{$Q(e),e.AutoInit=void 0;const p=i(6914),m=i(2018);function b(t,e){var i;return null!=(i=e.get(t))?i:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,i,n,r;try{var s=(0,p.te)(),l=(0,p.de)();if(s&&l&&l.currentScript){var u=l.currentScript.getAttribute("src"),o=null==(t=s.location)?void 0:t.href;if(u&&o){var a=new URL(u,o).searchParams,c=null!=(i=b("sdkKey",a))?i:b("apiKey",a);if(c){var h={},d=b("proxy",a),v=(d&&(h.networkConfig={api:d}),null==(n=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:n[c]);let t=null;if(t=v instanceof m.StatsigClient?v:t)e({sdkKey:c,client:t});else{var f=l.currentScript.dataset;const _=function(t,e){if(t)if(t in e&&"function"==typeof e[t])return e[t];return null}(null!=(r=f.onstatsiginit)?r:f.onStatsigInit,s),g=new m.StatsigClient(c,function(){var t=(0,p.te)();if(!t)return{};let e=t.statsigUser||{};var i=(e="object"!=typeof e?{}:e).custom||{},n=e.customIDs||{};return $P($P({},e),{customIDs:$P({},n),custom:$P($P({},i),{useragent:t.navigator.userAgent,page_url:(0,p.Gt)()||"",language:null==(n=t.navigator)?void 0:n.language})})}(),h);g.initializeAsync().then(()=>{_&&_(g)}).catch(t=>{p.Log.error(t)}),e({sdkKey:c,client:g})}}}}}catch(t){p.Log.error("AutoInit failed",t)}}}},7262:(t,e,i)=>{$Q(e),e.Ne=void 0;const n=i(6914);function r(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.Ne=function(t,e){var i;return(e=(0,n.P)(e,"checksum","DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),r((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,r(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,r(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.Kt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,i)=>{$Q(e);const r=i(6914);e.default=class{constructor(t){this.O=t,this.Re=null,this.Pe=null,this.Ce="Uninitialized",this.Ue=0,this.Fe=0,this.Ge=null,this.Le=new Set}reset(){this.Pe=null,this.Re=null,this.Ce="Loading",this.Ue=0,this.Fe=0,this.Ge=null}finalize(){this.Pe||(this.Ce="NoValues")}getValues(){return this.Re?(0,r.P)(this.Re,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,r.P)(t.data,"has_updates","EvaluationResponse"))&&(this.Ce=t.source,!0===(null==i?void 0:i.has_updates)&&(this.Re=t.data,this.Ue=i.time,this.Fe=t.receivedAt,this.Pe=i,this.Ge=this.Ke(t.source,i),t.source&&i.user&&this.ze(e,i),i.sdk_flags?r.SDKFlags.setFlags(this.O,i.sdk_flags):r.SDKFlags.setFlags(this.O,{})),!0)}getWarnings(){if(0!==this.Le.size)return Array.from(this.Le)}getGate(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.qe(null==(e=this.Pe)?void 0:e.param_stores,t)}getSource(){return this.Ce}Ke(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}qe(t,e){let i=null;return{result:i=t?t[e]||t[(0,r.h)(e)]:i,details:this.Be(null==i)}}ze(t,e){var i,n=r.StableID.get(this.O);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.Le.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,r.v)(t)!==(0,r.v)(i))&&this.Le.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.Ce||"NoValues"===this.Ce?{reason:this.Ce}:(t={reason:this.Ce,lcut:this.Ue,receivedAt:this.Fe},0<this.Le.size&&(t.warnings=Array.from(this.Le)),t)}Be(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.Ce&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.Ce&&null!=(n=this.Ge)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},8448:function(t,e,i){var l=this&&this.__awaiter||$A();$Q(e);const u=i(6914),o=i(7262);class n extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Ve=new u.UrlConfiguration(u.Endpoint.qt,null==e?void 0:e.initializeUrl,null==e?void 0:e.api,null==e?void 0:e.initializeFallbackUrls)}fetchEvaluations(i,n,r,s){return l(this,void 0,void 0,function*(){var t=n?(0,u.P)(n,"has_updates","InitializeResponse"):null;let e={user:s,hash:"djb2",deltasResponseRequested:!1,full_checksum:null};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0,full_checksum:t.full_checksum})),this.Je(i,t,e,r)})}Je(e,i,n,r){var s;return l(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,urlConfig:this.Ve,data:n,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!=(s=null==t?void 0:t.body)?s:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(s=t.body)?void 0:s.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,o.Ne)(i,t.body))?t:this.Je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),r)})}}e.default=n},3583:(t,e,i)=>{$Q(e),e.$e=void 0;const g=i(6914),p={disableExposureLog:!0};function m(t){return null==t||!1===t.disableExposureLog}function b(t,e){return null!=e&&!(0,g.Me)(t,e)}e.$e=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,r,s,l,u,o,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.zt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,m(_)?void 0:p).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,o=e,a=_,b(c=(u=v).getDynamicConfig(h.config_name,p).get(h.param_name),o)?o:(m(a)&&u.getDynamicConfig(h.config_name),c);case"experiment":return o=d,a=e,u=_,b(l=(c=v).getExperiment(o.experiment_name,p).get(o.param_name),a)?a:(m(u)&&c.getExperiment(o.experiment_name),l);case"layer":return l=d,n=e,r=_,b(s=(i=v).getLayer(l.layer_name,p).get(l.param_name),n)?n:(m(r)&&i.getLayer(l.layer_name).get(l.param_name),s);default:return e}}}},8198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const l=i(6914),u=i(4845),o=i(8448),r=i(3583),a=i(4131);class n extends l.StatsigClientBase{static instance(t){var e=(0,l.l)().instance(t);return e instanceof n?e:(l.Log.warn((0,l.kt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){l.SDKType.ue(t,"javascript-client");var n,r=new o.default(i,t=>{this.$emt(t)}),t=(super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,r,i),this.getFeatureGate=this.wi(l.MemoPrefix.Kn,this.Ti.bind(this)),this.getDynamicConfig=this.wi(l.MemoPrefix.Ln,this.Ii.bind(this)),this.getExperiment=this.wi(l.MemoPrefix.Vn,this.ki.bind(this)),this.getLayer=this.wi(l.MemoPrefix.$n,this.Di.bind(this)),this.getParameterStore=this.wi(l.MemoPrefix.Bn,this.Ri.bind(this)),this.We=new u.default(t),this.ht=r,this.He=this.xi(e,i),null!=(n=null==i?void 0:i.plugins)?n:[]);for(const s of t)s.bind(this)}initializeSync(t){var e;return"Uninitialized"!==this.loadingStatus?(0,l.createUpdateDetails)(!0,this.We.getSource(),-1,null,null,["MultipleInitializations",...null!=(e=this.We.getWarnings())?e:[]]):(this.pe.start(),this.updateUserSync(this.He,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.ve||(this.ve=this.Ye(t)),this.ve})}updateUserSync(t,e){var i=performance.now(),n=[...null!=(n=this.We.getWarnings())?n:[]],t=(this.Xe(t),this.dataAdapter.getDataSync(this.He)),e=(null==t&&n.push("NoCachedValues"),this.We.setValues(t,this.He),this.Qe(t),null==e?void 0:e.disableBackgroundCacheRefresh);return!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.Ze(null!=t?t:null,this.He),(0,l.createUpdateDetails)(!0,this.We.getSource(),performance.now()-i,this.$t.getLastSeenErrorAndReset(),this.ht.getLastUsedInitUrlAndReset(),n)}updateUserAsync(n,r){return s(this,void 0,void 0,function*(){this.Xe(n);var t=this.He,e=(l.Diagnostics.B(this.O),this.dataAdapter.getDataSync(t));if(this.We.setValues(e,this.He),this.me("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,r),t!==this.He)return(0,l.createUpdateDetails)(!1,this.We.getSource(),-1,new Error("User changed during update"),this.ht.getLastUsedInitUrlAndReset());let i=!1;null!=e&&(l.Diagnostics.W(this.O),i=this.We.setValues(e,this.He),l.Diagnostics.H(this.O,{success:i})),this.Qe(e),i||(this.$t.attachErrorIfNoneExists(l.UPDATE_DETAIL_ERROR_MESSAGES.NO_NETWORK_DATA),this.$emt({name:"initialization_failure"})),l.Diagnostics.V(this.O,i,this.We.getCurrentSourceDetails());t=l.Diagnostics.tt(this.He,this.pe,this.O,this.m);return(0,l.createUpdateDetails)(i,this.We.getSource(),t,this.$t.getLastSeenErrorAndReset(),this.ht.getLastUsedInitUrlAndReset(),this.We.getWarnings())})}getContext(){return{sdkKey:this.O,options:this.m,values:this.We.getValues(),user:JSON.parse(JSON.stringify(this.He)),errorBoundary:this.$t,session:l.StatsigSession.get(this.O),stableID:l.StableID.get(this.O)}}checkGate(t,e){return this.getFeatureGate(t,e).value}logEvent(t,e,i){this.pe.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.He,time:Date.now()}))}be(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Qe(null)})}Ye(t){return s(this,void 0,void 0,function*(){return l.Storage.isReady()||(yield l.Storage.isReadyResolver()),this.pe.start(),this.updateUserAsync(this.He,t)})}Qe(t){this.We.finalize(),this.me("Ready",t)}Ze(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{l.Log.error("An error occurred after update.",t)})}Xe(t){this.pe.reset(),this.We.reset(),this.He=this.xi(t,this.m)}xi(t,e){t=(0,l.T)(t,e),e=null==(e=t.customIDs)?void 0:e.stableID;return e&&l.StableID.setOverride(e,this.O),t}Ti(t,e){var{result:i,details:n}=this.We.getGate(t),n=(0,l.Ee)(t,n,i),r=null==(r=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:r.call(i,n,this.He,e),i=null!=r?r:n;return this.ye(t,(0,l.Se)(this.He,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}Ii(t,e){var{result:i,details:n}=this.We.getConfig(t),n=(0,l.De)(t,n,i),r=null==(r=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:r.call(i,n,this.He,e),i=null!=r?r:n;return this.ye(t,(0,l.je)(this.He,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}ki(t,e){var{result:i,details:n}=this.We.getConfig(t),n=(0,l.Ie)(t,n,i),r=null==(r=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:r.call(i,n,this.He,e),i=null!=r?r:n;return this.ye(t,(0,l.je)(this.He,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}Di(e,i){var{result:t,details:n}=this.We.getLayer(e),n=(0,l.ke)(e,n,t),r=null==(r=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:r.call(t,n,this.He,i);null!=i&&i.disableExposureLog&&this.pe.incrementNonExposureCount(e);const s=(0,l.Te)(n,r,null!=(t=null==r?void 0:r.__value)?t:n.__value,t=>{null!=i&&i.disableExposureLog||this.ye(e,(0,l.Oe)(this.He,s,t),i)});return this.$emt({name:"layer_evaluation",layer:s}),s}Ri(t,e){var{result:i,details:n}=this.We.getParamStore(t);return this.pe.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,r.$e)(this,i,e)}}}e.default=n},4131:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(6914),r=i(8448);class l extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.ht=null,this.m=null}attach(t,e){super.attach(t,e),this.ht=new r.default(null!=e?e:{})}getDataAsync(t,e,i){return this.D(t,(0,n.T)(e,this.m),i)}prefetchData(t,e){return this.A(t,e)}setData(t){var e=(0,n.P)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,e){super.setData(t,e)}R(e,i,n){var r;return s(this,void 0,void 0,function*(){var t=yield null==(r=this.ht)?void 0:r.fetchEvaluations(this.C(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}k(t){t=(0,n.o)(this.C(),t,null==(t=this.m)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.p}.`+t}N(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=l},2018:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(e,i);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,r)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),r=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},s=($Q(e),e.StatsigClient=void 0,i(8198));e.StatsigClient=s.default,r(i(6914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:s.default}),e.default=__STATSIG__},4535:(t,e,i)=>{$Q(e),e.AutoCapture=e.runStatsigAutoCapture=e.StatsigAutoCapturePlugin=void 0;const c=i(6914),n=i(5423),r=i(6325),s=i(6901),l={submit:n.AutoCaptureEventName.FORM_SUBMIT,click:n.AutoCaptureEventName.CLICK};function u(t,e){return new o(t,e)}e.StatsigAutoCapturePlugin=class{constructor(t){this.m=t,this.__plugin="auto-capture"}bind(t){u(t,this.m)}},e.runStatsigAutoCapture=u;class o{constructor(t,e){this.tn=t,this.en=Date.now(),this.nn=0,this.rn={},this.sn=null,this.Ei=!1,this.Ai=null;var{sdkKey:t,errorBoundary:i,values:n}=t.getContext(),n=(this.rn=null!=(n=null==(n=null==n?void 0:n.auto_capture_settings)?void 0:n.disabled_events)?n:{},this.$t=i,this.$t.wrap(this),this.ln=null==e?void 0:e.eventFilterFunc,(0,c.de)());(0,c.kt)()||((e=null!=(i=(__STATSIG__=(0,c.l)()).acInstances)?i:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.qt()):this.qt()}un(){const i=(0,c.te)();var t=(0,c.de)();if(i&&t){const e=(t,e=!0)=>{this.an(t||i.event),e&&this.Ni()};(0,r.cn)(t,"click",t=>e(t)),(0,r.cn)(t,"submit",t=>e(t)),(0,r.cn)(i,"error",t=>e(t,!1)),(0,r.cn)(i,"pagehide",()=>this.Mi()),(0,r.cn)(i,"beforeunload",()=>this.Mi()),(0,r.cn)(i,"scroll",()=>this.dn())}}vn(){var t=(0,c.te)(),e=(0,c.de)();t&&e&&((0,r.cn)(t,"popstate",()=>this.fn()),window.history.pushState=new Proxy(window.history.pushState,{apply:(t,e,[i,n,r])=>{t.apply(e,[i,n,r]),this.fn()}}),this.fn())}an(t){var e,i=null==(i=t.type)?void 0:i.toLowerCase();"error"===i&&t instanceof ErrorEvent?this._n(t):(e=(0,r.gn)(t))&&(0,r.St)(t,e)&&(t=l[i])&&({value:i,metadata:e}=(0,r.pn)(e),this.bn(t,i,e))}Ni(){var t=(0,c.te)();t&&(this.Ai&&clearTimeout(this.Ai),this.Ai=t.setTimeout(()=>{this.Mi(!0)},6e5))}qt(){this.un(),this.vn(),this.mn(),this.yn()}_n(t){var e=(null==t?void 0:t.error)||{};let i=e;if("object"==typeof e)try{i=JSON.stringify(e)}catch(t){i="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.bn(n.AutoCaptureEventName.ERROR,t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:i})}mn(){var t=this.On();try{this.jn(t)&&this.bn(n.AutoCaptureEventName.SESSION_START,(0,r.Sn)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}catch(t){this.$t.logError("AC::logSession",t)}}fn(){var t=(0,r.wn)(),e=this.sn;e&&t.href===e.href||(this.sn=t,e=(this.Ei=!1,s.Tn)(t),this.bn(n.AutoCaptureEventName.PAGE_VIEW,(0,r.Sn)(),e,{flushImmediately:!0,addNewSessionMetadata:!0}),this.Ni())}Mi(t=!1){this.Ei||(this.Ei=!0,this.bn(n.AutoCaptureEventName.PAGE_VIEW_END,(0,r.Sn)(),{scrollDepth:this.nn,pageViewLength:Date.now()-this.en,dueToInactivity:t},{flushImmediately:!0}))}yn(){const i=(0,c.te)();void 0!==(null===i||void 0===i?void 0:i.performance)&&"function"==typeof i.performance.getEntriesByType&&"function"==typeof i.performance.getEntriesByName&&setTimeout(()=>{var t={},e=i.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),i.performance.getEntriesByName("first-contentful-paint")),e=(e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),(0,r.kn)());e&&(t.effective_connection_type=e.effectiveType,t.rtt_ms=e.rtt,t.downlink_kbps=e.downlink,t.save_data=e.saveData),this.bn(n.AutoCaptureEventName.PERFORMANCE,(0,r.Sn)(),t)},1)}bn(t,e,i,n){var r,s,l,u=t.slice("auto_capture::".length);if(!this.rn[t]&&!this.rn[u]){u=this.On();try{var o=$P({sessionID:u.data.sessionID,page_url:null!=(l=null==(s=null==(r=(0,c.te)())?void 0:r.location)?void 0:s.href)?l:""},i),a=(null!=n&&n.addNewSessionMetadata&&(o.isNewSession=String(this.jn(u))),{eventName:t,value:e,metadata:o});this.ln&&!this.ln(a)||(this.tn.logEvent(a),null!=n&&n.flushImmediately&&this.tn.flush().catch(t=>{c.Log.error(t)}))}catch(t){this.$t.logError("AC::enqueue",t)}}}dn(){var t=null!=(t=null==(t=(0,c.de)())?void 0:t.body.scrollHeight)?t:1,e=(0,c.te)(),i=null!=(i=null==e?void 0:e.scrollY)?i:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.nn=Math.max(this.nn,Math.min(100,Math.round((i+e)/t*100))),this.Ni()}jn(t){return Math.abs(t.data.startTime-Date.now())<1e3}On(){return this.tn.getContext().session}}e.AutoCapture=o},5423:(t,e)=>{$Q(e),e.AutoCaptureEventName=void 0,e.AutoCaptureEventName={PAGE_VIEW:"auto_capture::page_view",PAGE_VIEW_END:"auto_capture::page_view_end",ERROR:"auto_capture::error",SESSION_START:"auto_capture::session_start",PERFORMANCE:"auto_capture::performance",FORM_SUBMIT:"auto_capture::form_submit",CLICK:"auto_capture::click"}},6325:(t,e,i)=>{$Q(e),e.kn=e.cn=e.Sn=e.wn=e.St=e.gn=e.pn=e.In=void 0;const s=i(6914);function l(t){var e={};if(t){var i=null==t?void 0:t.dataset;if(i)for(const n in i)e["data-"+n]=i[n]||""}return e}function u(e){if(e){let t=e;for(;t;){var i=t.tagName.toLowerCase();if(["body","document"].includes(i))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.In=l,e.pn=function(t){var e=t.tagName.toLowerCase(),i={},n=(0,s.Gt)()||"",r=("form"===(i.tagName=e)&&(i.action=t.getAttribute("action"),i.method=null!=(r=t.getAttribute("method"))?r:"GET",i.formName=t.getAttribute("name"),i.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(i.content=t.value,i.inputName=t.getAttribute("name")),u(t));return r&&(i.href=r.getAttribute("href")),"button"!==e&&!r||(i.content=(t.textContent||"").trim(),e=l(r||t),$P(i,e)),{value:n,metadata:i}},e.gn=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.St=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var i=e.tagName.toLowerCase(),n=t.type.toLowerCase();switch(i){case"html":return!1;case"form":return"submit"===n;case"input":case"select":case"textarea":return["change"].includes(n);default:if("click"===n){if("button"===i)return!0;if(u(e))return!0}return!1}},e.wn=function(){var t=null!=(t=null==(t=null==(t=(0,s.te)())?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.Sn=function(){return(0,s.Gt)()||""},e.cn=function(t,e,i){t&&t.addEventListener&&t.addEventListener(e,i,!0)},e.kn=function(){var t=(0,s.te)();return t&&t.navigator&&t.navigator.connection||null}},1964:(t,e,i)=>{$Q(e),e.StatsigAutoCapturePlugin=e.runStatsigAutoCapture=e.AutoCapture=e.AutoCaptureEventName=void 0;const n=i(4535);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return n.AutoCapture}}),$Q2(e,"StatsigAutoCapturePlugin",{enumerable:!0,get:function(){return n.StatsigAutoCapturePlugin}}),$Q2(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return n.runStatsigAutoCapture}});var r=i(5423);$Q2(e,"AutoCaptureEventName",{enumerable:!0,get:function(){return r.AutoCaptureEventName}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:n.AutoCapture,runStatsigAutoCapture:n.runStatsigAutoCapture,StatsigAutoCapturePlugin:n.StatsigAutoCapturePlugin}),e.default=__STATSIG__},6901:(t,e,i)=>{$Q(e),e.Tn=void 0;const a=i(6914);e.Tn=function(t){var e=(0,a.de)(),i=(0,a.te)();if(!e||!i)return{};var n=null==i?void 0:i.navigator,r=(null==e?void 0:e.referrer)||"";let s=new URL("empty:");if(r)try{s=new URL(r||"empty:")}catch(t){}u=s,l=function(t){const e=t.hostname,i=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return i||""}(u),u=u.searchParams.get("yahoo"===l?"p":"q")||"";var l={searchEngine:l,searchQuery:u},u=function(t){const i=t.searchParams,n={};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=i.get(t);e&&(n[t]=e)}),n}(t);const o={};return t.searchParams.forEach((t,e)=>{o[e]=t}),$P($P($P($P({},l),u),o),{title:(null==e?void 0:e.title)||"",locale:(null==n?void 0:n.language)||"unknown",hostname:t.hostname||"unknown",pathname:t.pathname||"unknown",referrer:r,screen_width:(null==(l=null==i?void 0:i.screen)?void 0:l.width)||"unknown",screen_height:(null==(u=null==i?void 0:i.screen)?void 0:u.height)||"unknown",viewport_width:(null==i?void 0:i.innerWidth)||"unknown",viewport_height:(null==i?void 0:i.innerHeight)||"unknown"})}}},n={};function r(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[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 l=r(1964);var s=r(2016);e.default=__STATSIG__,s.AutoInit.attempt(({client:t})=>{new l.AutoCapture(t)})}return t.default})()); |
{ | ||
"name": "@statsig/js-client", | ||
"version": "3.11.1", | ||
"version": "3.12.0", | ||
"dependencies": { | ||
"@statsig/client-core": "3.11.1" | ||
"@statsig/client-core": "3.12.0" | ||
}, | ||
@@ -7,0 +7,0 @@ "jsdelivr": "./build/statsig-js-client.min.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
422508
+ Added@statsig/client-core@3.12.0(transitive)
- Removed@statsig/client-core@3.11.1(transitive)
Updated@statsig/client-core@3.12.0