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

@statsig/js-client

Package Overview
Dependencies
Maintainers
4
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@statsig/js-client - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

2

build/statsig-js-client.min.js

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $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={496:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.o=void 0,i.o=()=>__STATSIG__||u,i.i=t=>(0,i.o)()[t];i.t=t=>{var e=(0,i.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var n,s="__STATSIG__",r="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=r[s])?n:e[s])?n:o[s])?n:{instance:i.t};r[s]=u,e[s]=u,o[s]=u},707:(t,e,i)=>{$Q(e),e.u=e.l=void 0;const s=i(832);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.l=n,e.u=function(t,e,i){return e?n(t,e,i):(0,s.h)("k:"+t)}},856:(t,e)=>{$Q(e)},320:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=i(780),a=i(604),r=i(296),o=i(444),c=i(412);function d(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.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new n}attach(t,e){this.S=t,this.p=e}getDataSync(t){var e=this.T(t),i=this.j.get(e,t);return i||((i=this.I(e))?(this.j.add(e,i),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,r.A)(e,null==(e=this.p)?void 0:e.environment),i=this.T(e);this.j.add(i,d("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.j.merge(t)}M(e,i,n){return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(i),t=[this.k(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}D(i,n){return s(this,void 0,void 0,function*(){var t=this.T(i),e=yield this.M(null,i,n);e&&this.j.add(t,$P($P({},e),{source:"Prefetch"}))})}k(r,o,u){return s(this,void 0,void 0,function*(){let t=null;r&&this.R(r,o)&&(t=r.data);var e=yield this.N(t,o,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var i=(0,c.C)(e,"has_updates","Response"),n=this.P(),n=yield a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=d("Network",e,n,o);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=d("NetworkNotModified",t,n,o)}e=this.T(o);return this.j.add(e,s),yield this.G(e,s),s})}P(){return null!=this.S?this.S:(l.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.U)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){return s(this,void 0,void 0,function*(){yield o.Storage.L(t,JSON.stringify(e)),yield this.K(t)})}K(i){var n;return s(this,void 0,void 0,function*(){var t=null!=(n=yield(0,o.F)(this.O))?n:{},e=(t[i]=Date.now(),u(t,10));e&&(delete t[e],yield o.Storage.q(e)),yield(0,o.J)(this.O,t)})}};class n{constructor(){this.V={}}get(t,e){var t=this.V[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?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=u(this.V,9);i&&delete this.V[i],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function u(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})}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var i=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const n=e(780),l=e(360),a=e(972),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,i){this.S=t,this.p=e,this.B=i,this.$=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.H(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.W(e,t)):i}catch(t){return this.W(e,t),null}}W(r,o){try{n.Log.warn("Caught error in "+r,{error:o});i(this,void 0,void 0,function*(){var t,e,i=o||Error(c),n=i instanceof Error,s=n?i.name:"No Name";this.$.has(s)||(this.$.add(s),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o}):(t=l.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),n=n?i.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(i),i=JSON.stringify($P({tag:r,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(n=null==(s=this.p)?void 0:s.networkConfig)?void 0:n.networkOverrideFunc)?s:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(n=this.B)&&n.call(this,{name:"error",error:o})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(832),r=i(780),o=i(716),u=i(48),l=i(876),a=i(444),c=i(84),d=i(100),h={},v=t=>{null!=(t=h[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,i,n){this.S=e,this.B=t,this.X=i,this.p=n,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),(h[e]=this).st=!0===(null==n?void 0:n.disableLogging),this.rt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;i=null==n?void 0:n.networkConfig;this.ot=(0,c.ut)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",o.NetworkDefault.eventsApi),(0,d.lt)(t=>{"background"===t&&v(e)}),this.ct(),this.ht()}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this._t(),this.Z.length>this.rt)&&v(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}shutdown(){return n(this,void 0,void 0,function*(){this.ft&&(clearInterval(this.ft),this.ft=null),yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;if(this.gt(),0!==this.Z.length)return t=this.Z,this.Z=[],this.bt(t)})}_t(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>v(this.S),200)}dt(t){if((0,l.yt)(t)){var e=t.user||{},i=t.metadata||{},t=[t.eventName,e.userID,i.gate,i.config,i.ruleID].join("|"),e=this.tt[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=i}return!0}bt(t){var e,i;return n(this,void 0,void 0,function*(){if(this.st)this.St(t);else try{(!(0,d.Ot)()&&this.X.isBeaconSupported()&&null==(null==(i=null==(e=this.p)?void 0:e.networkConfig)?void 0:i.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?this.B({name:"logs_flushed",events:t}):this.St(t)}catch(t){r.Log.warn("Failed to flush events.")}})}Tt(e){var i;return n(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(i=null==t?void 0:t.code)?i:-1;return{success:200<=t&&t<300}})}jt(t){return n(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();(0,a.J)(e,t).catch(()=>{r.Log.warn("Unable to save failed logs to storage")})}ct(){const e=this.u();n(this,void 0,void 0,function*(){var t=yield(0,a.F)(e);t&&(yield a.Storage.q(e),yield this.bt(t))}).catch(()=>{r.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,s.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.It(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));r.Log.debug("Enqueued Event:",i),this.Z.push(i)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.At)()}ht(){if((0,u.Mt)()){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{h[this.S].ft!==e?clearInterval(e):v(this.S)},t);this.ft=e}}}},832:(t,e)=>{$Q(e),e.xt=e.h=void 0;e.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)};e.xt=t=>(0,e.h)(JSON.stringify(s(t)));const s=i=>{if(null==i)return null;var t=Object.keys(i).sort();const n={};return t.forEach(t=>{let e=i[t];!Array.isArray(e)&&e instanceof Object&&(e=s(e)),n[t]=e}),n}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function i(t){return t.unshift("[Statsig]"),t}var n,s;$Q(e),e.Log=e.LogLevel=void 0,(s=n||(e.LogLevel=n={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class r{static info(...t){this.level>=n.Info&&console.info(...i(t))}static debug(...t){this.level>=n.Debug&&console.debug(...i(t))}static warn(...t){this.level>=n.Warn&&console.warn(...i(t))}static error(...t){this.level>=n.Error&&console.error(...i(t))}}(e.Log=r).level=n.Error},716:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},188:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(496);const o=i(496),_=i(280),y=i(780),u=i(716),l=i(360),a=i(48),c=i(612),d=i(604),h=i(972),b=i(100);e.NetworkCore=class{constructor(t,e){this.B=e,this.kt=1e4,this.Dt={},this.p={},t&&(this.p=t),this.p.networkConfig&&(this.Dt=this.p.networkConfig),this.Dt.networkTimeoutMs&&(this.kt=this.Dt.networkTimeoutMs)}post(e){return r(this,void 0,void 0,function*(){let t=yield this.Et(e);return e.isStatsigEncodable&&(t=this.Rt(e,t)),this.Nt($P({method:"POST",body:t},e))})}get(t){return this.Nt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(n){return r(this,void 0,void 0,function*(){var t,e,i;return!!g(n)&&(t=yield this.Et(n),e=yield this.Ct(n),(i=navigator).sendBeacon.bind(i)(e,t))})}Nt(h){var v,f;return r(this,void 0,void 0,function*(){if(!g(h))return null;if(this.Dt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n}=h;const s="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>null===s||void 0===s?void 0:s.abort(`Timeout of ${this.kt}ms expired.`),this.kt),r=yield this.Ct(h),o=null,u=(0,b.Pt)();try{var l,a,c,d={method:e,body:i,headers:$P({},h.headers),signal:null===s||void 0===s?void 0:s.signal,priority:h.priority,keepalive:u},o=yield(null!=(v=this.Dt.networkOverrideFunc)?v:fetch)(r,d);if(clearTimeout(t),o.ok)return c=yield o.text(),_.Diagnostics.mark(),{body:c,code:o.status};throw l=yield o.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${r} `+l)).name="NetworkError",a}catch(t){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);return _.Diagnostics.mark(),!n||n<=0?(null!=(f=this.B)&&f.call(this,{name:"error",error:t}),y.Log.error(`A networking error occured during ${e} request to ${r}.`,i,t),null):this.Nt($P($P({},h),{retries:n-1}))}})}Ct(i){return r(this,void 0,void 0,function*(){const e=$P({[u.NetworkParam.SdkKey]:i.sdkKey,[u.NetworkParam.SdkType]:l.SDKType.Y(i.sdkKey),[u.NetworkParam.SdkVersion]:h.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:yield c.SessionID.get(i.sdkKey)},i.params);var t=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return i.url+(t?"?"+t:"")})}Et(s){return r(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=yield d.StableID.get(e),n=yield c.SessionID.get(e),e=l.SDKType.Y(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:e})}))})}Rt(t,e){var i,n,s=(0,a.Gt)();if(!t.isStatsigEncodable||this.p.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==s||!s.btoa)return e;try{var r=null!=(i=s.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(n=t.params)?n:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return y.Log.warn("/initialize request encoding failed"),e}}};const g=t=>!!t.sdkKey||(y.Log.warn("Unable to make request without an SDK key"),!1)},264:(t,e)=>{$Q(e)},648:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={Y:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},Ut(t,e){i[t]=e},Lt(t){n&&"-react"!==n||(n="-"+t)}}},48:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.At=n.Kt=n.Ft=n.Mt=n.qt=n.Gt=void 0;n.Gt=()=>"undefined"!=typeof window?window:null,n.qt=()=>{var t=(0,n.Gt)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>null!=(0,n.qt)(),n.Ft=(t,e)=>{var i=(0,n.Gt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.Kt=(t,e)=>{var i=(0,n.qt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.At=()=>{var t;try{return null==(t=(0,n.Gt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(707),u=i(780),l=i(444),a=i(556),c=18e5,d=144e5,h={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,n.u)(t)}e.SessionID={get:t=>o(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:r=>o(void 0,void 0,void 0,function*(){null==h[r]&&(h[r]=function(i){return o(this,void 0,void 0,function*(){let t=yield function(t){t=f(t);return(0,l.F)(t)}(i);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:i}})}(r));var t=yield h[r],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>c}(i)||function({startTime:t}){return Date.now()-t>d}(i))&&(i.sessionID=(0,a.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;return s=f(s),(0,l.J)(s,n).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=v(i,c),t.ageTimeoutID=v(i,d-e),t}),overrideInitialSessionID:(t,e)=>{var i;h[e]=(t=t,e=e,i=Date.now(),Promise.resolve({data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e}))}}},604:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StableID=void 0;const s=i(707),r=i(780),o=i(444),u=i(556),l={};function a(t){return"statsig.stable_id."+(0,s.u)(t)}function c(t,e){e=a(e);(0,o.J)(e,t).catch(()=>{r.Log.warn("Failed to save StableID")})}e.StableID={get:e=>n(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,o.F)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(496);const o=i(496),u=i(512),l=i(728),a=i(780),c=i(48),d=i(612),h=i(444);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.zt={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&h.Storage.Jt(!0),null!=n&&n.initialSessionID&&d.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),this.S=t,this.p=null!=n?n:{},this.Vt=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Bt=new l.EventLogger(t,r,i,n),this.$t=new u.ErrorBoundary(t,n,r),this.$t.wrap(this),this.$t.wrap(i),this.$t.wrap(e),this.$t.wrap(this.Bt),(0,c.Mt)()&&(null!=(i=null!=(r=(s=(0,o.o)()).instances)?r:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),i[t]=this,s.lastInstance=this,s.instances=i,__STATSIG__=s),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.Ht()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Bt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,h.Storage.Jt(t.disableStorage))}flush(){return this.Bt.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Bt.shutdown()})}on(t,e){this.zt[t]||(this.zt[t]=[]),this.zt[t].push(e)}off(t,e){this.zt[t]&&-1!==(e=this.zt[t].indexOf(e))&&this.zt[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.zt[i.name]&&this.zt[i.name].forEach(t=>e(t)),null!=(t=this.zt["*"])&&t.forEach(e)}Wt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Yt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Bt.incrementNonExposureCount(t):this.Bt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.Qt=e.Xt=e.Zt=e.yt=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",l=(t,e,i,n,s)=>({eventName:t,user:e,value:null,metadata:r(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===n||t===i,e.Zt=(t,e)=>{return l(n,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.Xt=(t,e)=>{return l(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Qt=(t,e,i)=>{var n,s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(i));let o="",u=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return r&&(o=null!=(n=s.allocated_experiment_name)?n:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(r)},u)};const r=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="1.3.0";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.te=e.ee=e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const 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(null==i?void 0:i.value)})}function o(t,e){var i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(e)}function u(n,s){return(t,e)=>{var i=null!=(i=null==n?void 0:n[t])?i:null;return null!=i&&(null==e||o(i,e))?(null!=s&&s(t),i):null!=e?e:null}}e.ue=function(t,e,i){return r(t,e,i,!0===(null==i?void 0:i.value))},e.oe=n,e.re=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.se=function(t,e,i,n){return $P($P({},r(t,e,i,void 0)),{get:u(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.ne=function(t,e,i,n){return $P($P($P({},t),e),{get:u(i,n)})},e.ie=function(t){return Array.isArray(t)?"array":typeof t},e.ee=o,e.te=u},136:(t,e)=>{$Q(e)},296:(t,e,i)=>{$Q(e),e.v=e.A=void 0;const n=i(832),s=i(780);e.A=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&(i.statsigEnvironment=e),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{}}},e.v=function(t){return t?(0,n.xt)(t):null}},444:function(t,i,e){var n=this&&this.__awaiter||$A(),s=($Q2(i,"__esModule",{value:!0}),i.J=i.F=i.Storage=void 0,e(780)),e=e(48);const r={},o=t=>Promise.resolve(t),u={le:()=>"InMemory",U:t=>r[t]||null,ae:t=>o(r[t]||null),L:(t,e)=>(r[t]=e,o()),q:t=>(delete r[t],o()),ce:()=>o(Object.keys(r))};let l=null;try{const h=(0,e.Gt)();h&&h.localStorage&&"function"==typeof h.localStorage.getItem&&(l={le:()=>"LocalStorage",U:t=>h.localStorage.getItem(t),ae:t=>o(h.localStorage.getItem(t)),L:(t,e)=>(h.localStorage.setItem(t,e),o()),q:t=>(h.localStorage.removeItem(t),o()),ce:()=>o(Object.keys(h.localStorage))})}catch(t){s.Log.warn("Failed to setup localStorageProvider.")}let a=null!==l&&void 0!==l?l:u,c=a;function d(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.he(u),null;throw t}}i.Storage={le:()=>c.le(),ae:t=>n(void 0,void 0,void 0,function*(){return d(()=>c.ae(t))}),U:t=>d(()=>c.U?c.U(t):null),L:(t,e)=>c.L(t,e),q:t=>c.q(t),ce:()=>c.ce(),he:t=>{a=t,c=t},Jt:t=>{c=t?u:a}},i.F=function(e){return n(this,void 0,void 0,function*(){var t=yield i.Storage.ae(e);return JSON.parse(null!=t?t:"null")})},i.J=function(t,e){return n(this,void 0,void 0,function*(){yield i.Storage.L(t,JSON.stringify(e))})}},412:(t,e,i)=>{$Q(e),e.C=void 0;const s=i(780);e.C=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}},556:(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)})}},84:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},539:(t,e)=>{$Q(e)},100:(t,e,i)=>{$Q(e),e.de=e.lt=e.Pt=e.Ot=void 0;i=i(48);const n="foreground",s="background",r=[];let o=n,u=!1;e.Ot=()=>o===n,e.Pt=()=>u,e.lt=t=>{r.unshift(t)};e.de=e=>{e!==o&&(o=e,r.forEach(t=>t(e)))},(0,i.Ft)("focus",()=>{(u=!1,e.de)(n)}),(0,i.Ft)("blur",()=>(0,e.de)(s)),(0,i.Ft)("beforeunload",()=>{u=!0,(0,e.de)(s)}),(0,i.Kt)("visibilitychange",()=>{(0,e.de)("visible"===document.visibilityState?n:s)})},464: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.Log=e.Storage=e.EventLogger=void 0,i(496);const r=i(728),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return r.EventLogger}}),i(780));$Q2(e,"Log",{enumerable:!0,get:function(){return o.Log}});var u=i(972);const l=i(444);$Q2(e,"Storage",{enumerable:!0,get:function(){return l.Storage}}),s(i(496),e),s(i(707),e),s(i(856),e),s(i(320),e),s(i(184),e),s(i(512),e),s(i(500),e),s(i(788),e),s(i(832),e),s(i(664),e),s(i(780),e),s(i(188),e),s(i(716),e),s(i(264),e),s(i(648),e),s(i(48),e),s(i(360),e),s(i(612),e),s(i(604),e),s(i(688),e),s(i(808),e),s(i(283),e),s(i(876),e),s(i(972),e),s(i(384),e),s(i(396),e),s(i(136),e),s(i(296),e),s(i(444),e),s(i(412),e),s(i(84),e),s(i(539),e),s(i(556),e),s(i(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.Log,SDK_VERSION:u.SDK_VERSION})},696: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(208),e),e.default=__STATSIG__},96:(t,e,i)=>{$Q(e),e.ve=void 0;const n=i(464);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.ve=function(t,e){var i;return(e=(0,n.C)(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.xt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs}))===e.checksum?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},536:(t,e,i)=>{$Q(e);const n=i(464);e.default=class{constructor(){this._e=null,this.fe=null,this.ge="Uninitialized",this.be=0,this.ye=0}reset(){this.fe=null,this._e=null,this.ge="Loading",this.be=0,this.ye=0}finalize(){this.fe||(this.ge="NoValues")}getValues(){return this._e?(0,n.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;t&&!0===(null==(e=(0,n.C)(t.data,"has_updates","EvaluationResponse"))?void 0:e.has_updates)&&(this._e=t.data,this.be=e.time,this.ye=t.receivedAt,this.ge=t.source,this.fe=e)}getGate(t){var e;return this.me(null==(e=this.fe)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.me(null==(e=this.fe)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.me(null==(e=this.fe)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.me(null==(e=this.fe)?void 0:e.param_stores,t)}me(t,e){let i=null;return{result:i=t?t[e]||t[(0,n.h)(e)]:i,details:this.pe(null==i)}}pe(t){return"Uninitialized"===this.ge||"NoValues"===this.ge?{reason:this.ge}:{reason:this.ge+":"+(t?"Unrecognized":"Recognized"),lcut:this.be,receivedAt:this.ye}}}},400:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e);const u=i(464),l=i(96);class n extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Se=(0,u.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s,r){return o(this,void 0,void 0,function*(){var t=n?(0,u.C)(n,"has_updates","InitializeResponse"):null;let e={user:r,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.Oe(i,t,e,s)})}Oe(e,i,n,s){var r;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Se,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'))?t.body:"string"==typeof(t=(0,l.ve)(i,t.body))?t:this.Oe(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},340:(t,e,i)=>{$Q(e),e.je=void 0;const y=i(464),b={disableExposureLog:!0};function g(t){return null==t||!1===t.disableExposureLog}function p(t,e){return null!=e&&!(0,y.ee)(t,e)}e.je=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,o,u,l,a,c,d,h=f[t];if(null==h||null!=e&&(0,y.ie)(e)!==h.param_type)return e;switch(h.ref_type){case"static":return h.value;case"gate":return d=h,v.getFeatureGate(d.gate_name,g(_)?void 0:b).value?d.pass_value:d.fail_value;case"dynamic_config":return d=h,l=e,a=_,p(c=(u=v).getDynamicConfig(d.config_name,b).get(d.param_name),l)?l:(g(a)&&u.getDynamicConfig(d.config_name),c);case"experiment":return l=h,a=e,u=_,p(o=(c=v).getExperiment(l.experiment_name,b).get(l.param_name),a)?a:(g(u)&&c.getExperiment(l.experiment_name),o);case"layer":return o=h,n=e,s=_,p(r=(i=v).getLayer(o.layer_name,b).get(o.param_name),n)?n:(g(s)&&i.getLayer(o.layer_name).get(o.param_name),r);default:return e}}}},520:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const o=i(464),r=i(536),u=i(400),l=i(340),a=i(364);class n extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof n?e:(o.Log.warn((0,o.Mt)()?"Unable to find StatsigClient instance":"StatsigClient.instance is not supported in server environments"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){o.SDKType.Ut(t,"javascript-client");var n=new u.default(i,t=>{this.$emt(t)});super(t,null!=(t=null==i?void 0:i.dataAdapter)?t:new a.StatsigEvaluationsDataAdapter,n,i),this.Te=new r.default,this.we=e}initializeSync(){this.updateUserSync(this.we)}initializeAsync(t){return this.updateUserAsync(this.we,t)}updateUserSync(t){this.Ie(t);t=this.dataAdapter.getDataSync(this.we);this.Te.setValues(t),this.Ae(t),this.Me(null!=t?t:null,this.we)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Ie(i);var t=this.we,e=this.dataAdapter.getDataSync(t);this.Wt("Loading",e),this.Te.setValues(e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.we&&(this.Te.setValues(e),this.Ae(e))})}getContext(){return{sdkKey:this.S,options:this.p,values:this.Te.getValues(),user:JSON.parse(JSON.stringify(this.we)),errorBoundary:this.$t}}getAsyncContext(){return s(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield o.StatsigSession.get(this.S),stableID:yield o.StableID.get(this.S)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.Te.getGate(t),n=(0,o.ue)(t,n,i),s=null==(s=null==(i=this.Vt)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.we,e),i=null!=s?s:n;return this.Yt(t,(0,o.Zt)(this.we,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.Te.getConfig(t),n=(0,o.oe)(t,n,i),s=null==(s=null==(i=this.Vt)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.we,e),i=null!=s?s:n;return this.Yt(t,(0,o.Xt)(this.we,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e){var{result:i,details:n}=this.Te.getConfig(t),n=(0,o.re)(t,n,i),s=null==(s=null==(i=this.Vt)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.we,e),i=null!=s?s:n;return this.Yt(t,(0,o.Xt)(this.we,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.Te.getLayer(e),n=(0,o.se)(e,n,t),s=null==(s=null==(t=this.Vt)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.we,i);const r=(0,o.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Yt(e,(0,o.Qt)(this.we,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}getParameterStore(t,e){var{result:i,details:n}=this.Te.getParamStore(t);return this.Bt.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,l.je)(this,i,e)}}logEvent(t,e,i){this.Bt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.we,time:Date.now()}))}Ht(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Ae(null)})}Ae(t){this.Te.finalize(),this.Wt("Ready",t)}Me(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ie(t){this.Bt.reset(),this.Te.reset(),this.we=(0,o.A)(t,this.p.environment);t=null==(t=this.we.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=n},364:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(464),s=i(400);class o extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new s.default(null!=e?e:{})}getDataAsync(t,e,i){return this.M(t,e,i)}prefetchData(t,e){return this.D(t,e)}setData(t){var e=(0,n.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):n.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}N(e,i,n){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.X)?void 0:s.fetchEvaluations(this.P(),e,null==n?void 0:n.priority,i);return null!=t?t:null})}T(t){t=(0,n.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,n.v)(e)}}e.StatsigEvaluationsDataAdapter=o},208:(t,e,i)=>{$Q(e),e.StatsigClient=void 0;i=i(520);e.StatsigClient=i.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:i.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(696).default})());
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((t,r,u,l)=>{return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})});var n={845:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.t=n.i=n.o=void 0,n.o=()=>__STATSIG__||u,n.i=t=>(0,n.o)()[t];n.t=t=>{var e=(0,n.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var i,s="__STATSIG__",r="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=r[s])?i:e[s])?i:o[s])?i:{instance:n.t};r[s]=u,e[s]=u,o[s]=u},137:(t,e,n)=>{$Q(e),e.u=e.l=void 0;const s=n(406);function i(t,e,n){if(n)return n(t,e);const i=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(n=null==e?void 0:e.userID)?n:""),"cids:"+Object.keys(i).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+i[t]).join(","),"k:"+t];return(0,s.h)(e.join("|"))}e.l=i,e.u=function(t,e,n){return e?i(t,e,n):(0,s.h)("k:"+t)}},427:(t,e)=>{$Q(e)},694:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=n(512),a=n(122),r=n(578),o=n(534),c=n(401);function d(t,e,n,i){return{source:t,data:e,receivedAt:Date.now(),stableID:n,fullUserHash:(0,r.v)(i)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new i}attach(t,e){this.S=t,this.p=e}getDataSync(t){var e=this.T(t),n=this.j.get(e,t);return n||((n=this.I(e))?(this.j.add(e,n),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,r.A)(e,null==(e=this.p)?void 0:e.environment),n=this.T(e);this.j.add(n,d("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.j.merge(t)}M(e,n,i){return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.D(t,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(n,i){return s(this,void 0,void 0,function*(){var t=this.T(n),e=yield this.M(null,n,i);e&&this.j.add(t,$P($P({},e),{source:"Prefetch"}))})}D(r,o,u){return s(this,void 0,void 0,function*(){let t=null;r&&this.R(r,o)&&(t=r.data);var e=yield this.N(t,o,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var n=(0,c.C)(e,"has_updates","Response"),i=this.P(),i=yield a.StableID.get(i);let s=null;if(!0===(null==n?void 0:n.has_updates))s=d("Network",e,i,o);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;s=d("NetworkNotModified",t,i,o)}e=this.T(o);return this.j.add(e,s),yield this.G(e,s),s})}P(){return null!=this.S?this.S:(l.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.U)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){return s(this,void 0,void 0,function*(){yield o.Storage.L(t,JSON.stringify(e)),yield this.K(t)})}K(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,o.F)(this.O))?i:{},e=(t[n]=Date.now(),u(t,10));e&&(delete t[e],yield o.Storage.q(e)),yield(0,o.J)(this.O,t)})}};class i{constructor(){this.V={}}get(t,e){var t=this.V[t],n=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&n&&e!==n?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var n=u(this.V,9);n&&delete this.V[n],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function u(s,t){var e=Object.keys(s);return e.length<=t?null:e.reduce((t,e)=>{var n=s[t],i=s[e];return"object"==typeof n&&"object"==typeof i?i.receivedAt<n.receivedAt?e:t:i<n?e:t})}},962:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},539:(t,e)=>{$Q(e)},542:function(t,u,e){var n=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(512),l=e(902),a=e(0),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,n){this.S=t,this.p=e,this.B=n,this.$=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.H(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.W(e,t)):n}catch(t){return this.W(e,t),null}}W(r,o){try{i.Log.warn("Caught error in "+r,{error:o});n(this,void 0,void 0,function*(){var t,e,n=o||Error(c),i=n instanceof Error,s=i?n.name:"No Name";this.$.has(s)||(this.$.add(s),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o}):(t=l.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(n),n=JSON.stringify($P({tag:r,exception:s,info:i},$P($P({},e),{sdkType:t}))),yield(null!=(s=null==(i=null==(s=this.p)?void 0:s.networkConfig)?void 0:i.networkOverrideFunc)?s:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.B)&&i.call(this,{name:"error",error:o})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},922:(t,e)=>{$Q(e)},417:(t,e)=>{$Q(e)},770:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=n(406),r=n(512),o=n(410),u=n(830),l=n(637),a=n(534),c=n(638),d=n(397),h={},v=t=>{null!=(t=h[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this.S=e,this.B=t,this.X=n,this.p=i,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),(h[e]=this).st=!0===(null==i?void 0:i.disableLogging),this.rt=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null==i?void 0:i.networkConfig;this.ot=(0,c.ut)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",o.NetworkDefault.eventsApi),(0,d.lt)(t=>{"background"===t&&v(e)}),this.ct(),this.ht()}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&v(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}shutdown(){return i(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;if(this.gt(),0!==this.Z.length)return t=this.Z,this.Z=[],this.bt(t)})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>v(this.S),200)}dt(t){if((0,l.yt)(t)){var e=t.user||{},n=t.metadata||{},t=[t.eventName,e.userID,n.gate,n.config,n.ruleID].join("|"),e=this.tt[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=n}return!0}bt(t){var e,n;return i(this,void 0,void 0,function*(){if(this.st)this.St(t);else try{(!(0,d.Ot)()&&this.X.isBeaconSupported()&&null==(null==(n=null==(e=this.p)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?this.B({name:"logs_flushed",events:t}):this.St(t)}catch(t){r.Log.warn("Failed to flush events.")}})}Tt(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}jt(t){return i(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();(0,a.J)(e,t).catch(()=>{r.Log.warn("Unable to save failed logs to storage")})}ct(){const e=this.u();i(this,void 0,void 0,function*(){var t=yield(0,a.F)(e);t&&(yield a.Storage.q(e),yield this.bt(t))}).catch(()=>{r.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,s.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.It(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));r.Log.debug("Enqueued Event:",n),this.Z.push(n)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.At)()}ht(){if(!(0,u.Mt)()){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{h[this.S]._t!==e?clearInterval(e):v(this.S)},t);this._t=e}}}},406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.xt=r.Dt=r.h=void 0;const o=e(634);r.h=e=>{let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)},r.Dt=(t,e)=>(0,r.h)(JSON.stringify((0,r.xt)(t,e)));r.xt=(n,i)=>{if(null==n)return null;var t=Object.keys(n).sort();const s={};return t.forEach(t=>{var e=n[t];0===i||"object"!==(0,o.kt)(e)?s[t]=e:s[t]=(0,r.xt)(e,null!=i?i-1:i)}),s}},333:(t,e)=>{$Q(e)},512:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,s;$Q(e),e.Log=e.LogLevel=void 0,(s=i||(e.LogLevel=i={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class r{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=r).level=i.Error},410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},404:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(845);const o=n(845),_=n(962),g=n(512),u=n(410),l=n(902),a=n(830),c=n(143),d=n(122),h=n(0),y=n(397);e.NetworkCore=class{constructor(t,e){this.B=e,this.Et=1e4,this.Rt={},this.p={},t&&(this.p=t),this.p.networkConfig&&(this.Rt=this.p.networkConfig),this.Rt.networkTimeoutMs&&(this.Et=this.Rt.networkTimeoutMs)}post(e){return r(this,void 0,void 0,function*(){let t=yield this.Nt(e);return e.isStatsigEncodable&&(t=this.Ct(e,t)),this.Pt($P({method:"POST",body:t},e))})}get(t){return this.Pt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(i){return r(this,void 0,void 0,function*(){var t,e,n;return!!b(i)&&(t=yield this.Nt(i),e=yield this.Gt(i),(n=navigator).sendBeacon.bind(n)(e,t))})}Pt(h){var v,f;return r(this,void 0,void 0,function*(){if(!b(h))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i}=h;const s="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>null===s||void 0===s?void 0:s.abort(`Timeout of ${this.Et}ms expired.`),this.Et),r=yield this.Gt(h),o=null,u=(0,y.Ut)();try{var l,a,c,d={method:e,body:n,headers:$P({},h.headers),signal:null===s||void 0===s?void 0:s.signal,priority:h.priority,keepalive:u},o=yield(null!=(v=this.Rt.networkOverrideFunc)?v:fetch)(r,d);if(clearTimeout(t),o.ok)return c=yield o.text(),_.Diagnostics.mark(),{body:c,code:o.status};throw l=yield o.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${r} `+l)).name="NetworkError",a}catch(t){n=function(t,e){if(null!=t&&t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return"Unknown Error"}(s,t);return _.Diagnostics.mark(),!i||i<=0?(null!=(f=this.B)&&f.call(this,{name:"error",error:t}),g.Log.error(`A networking error occured during ${e} request to ${r}.`,n,t),null):this.Pt($P($P({},h),{retries:i-1}))}})}Gt(n){return r(this,void 0,void 0,function*(){const e=$P({[u.NetworkParam.SdkKey]:n.sdkKey,[u.NetworkParam.SdkType]:l.SDKType.Y(n.sdkKey),[u.NetworkParam.SdkVersion]:h.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:yield c.SessionID.get(n.sdkKey)},n.params);var t=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return n.url+(t?"?"+t:"")})}Nt(s){return r(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,n=yield d.StableID.get(e),i=yield c.SessionID.get(e),e=l.SDKType.Y(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}Ct(t,e){var n,i,s=(0,a.Lt)();if(!t.isStatsigEncodable||this.p.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==s||!s.btoa)return e;try{var r=null!=(n=s.btoa(e).split("").reverse().join(""))?n:e;return t.params=$P($P({},null!=(i=t.params)?i:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return g.Log.warn("/initialize request encoding failed"),e}}};const b=t=>!!t.sdkKey||(g.Log.warn("Unable to make request without an SDK key"),!1)},405:(t,e)=>{$Q(e)},361:(t,e)=>{$Q(e)},902:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={Y:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},Kt(t,e){n[t]=e},Ft(t){i&&"-react"!==i||(i="-"+t)}}},830:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.At=i.qt=i.zt=i.Mt=i.Jt=i.Lt=void 0;i.Lt=()=>"undefined"!=typeof window?window:null,i.Jt=()=>{var t=(0,i.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Mt=()=>{var t;return null===(0,i.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},i.zt=(t,e)=>{var n=(0,i.Lt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.qt=(t,e)=>{var n=(0,i.Jt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.At=()=>{var t;try{return null==(t=(0,i.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},143:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(137),u=n(512),l=n(534),a=n(23),c=18e5,d=144e5,h={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,i.u)(t)}e.SessionID={get:t=>o(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:r=>o(void 0,void 0,void 0,function*(){null==h[r]&&(h[r]=function(n){return o(this,void 0,void 0,function*(){let t=yield function(t){t=f(t);return(0,l.F)(t)}(n);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:n}})}(r));var t=yield h[r],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>c}(n)||function({startTime:t}){return Date.now()-t>d}(n))&&(n.sessionID=(0,a.getUUID)(),n.startTime=e),n.lastUpdate=e,n),s=t.sdkKey;return s=f(s),(0,l.J)(s,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=v(n,c),t.ageTimeoutID=v(n,d-e),t}),overrideInitialSessionID:(t,e)=>{var n;h[e]=(t=t,e=e,n=Date.now(),Promise.resolve({data:{sessionID:t,startTime:n,lastUpdate:n},sdkKey:e}))}}},122:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StableID=void 0;const s=n(137),r=n(512),o=n(534),u=n(23),l={};function a(t){return"statsig.stable_id."+(0,s.u)(t)}function c(t,e){e=a(e);(0,o.J)(e,t).catch(()=>{r.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,o.F)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},375:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(845);const o=n(845),u=n(542),l=n(770),a=n(512),c=n(830),d=n(143),h=n(534);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Vt={};var s,r=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&h.Storage.Bt(!0),null!=i&&i.initialSessionID&&d.StatsigSession.overrideInitialSessionID(i.initialSessionID,t),this.S=t,this.p=null!=i?i:{},this.$t=null!=(s=null==i?void 0:i.overrideAdapter)?s:null,this.Ht=new l.EventLogger(t,r,n,i),this.Wt=new u.ErrorBoundary(t,i,r),this.Wt.wrap(this),this.Wt.wrap(n),this.Wt.wrap(e),this.Wt.wrap(this.Ht),(0,c.Mt)()||(null!=(n=null!=(r=(s=(0,o.o)()).instances)?r:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),n[t]=this,s.lastInstance=this,s.instances=n,__STATSIG__=s),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.Yt()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,h.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Ht.shutdown()})}on(t,e){this.Vt[t]||(this.Vt[t]=[]),this.Vt[t].push(e)}off(t,e){this.Vt[t]&&-1!==(e=this.Vt[t].indexOf(e))&&this.Vt[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Vt[n.name]&&this.Vt[n.name].forEach(t=>e(t)),null!=(t=this.Vt["*"])&&t.forEach(e)}Qt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Xt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},636:(t,e)=>{$Q(e)},206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,s)=>({eventName:t,user:e,value:null,metadata:r(n,i),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===i||t===n,e.ee=(t,e)=>{return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.te=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Zt=(t,e,n)=>{var i,s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(n));let o="",u=null!=(i=null==s?void 0:s.undelegated_secondary_exposures)?i:[];return r&&(o=null!=(i=s.allocated_experiment_name)?i:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(r)},u)};const r=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},0:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="1.3.1";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},586:(t,e)=>{$Q(e)},59:(t,e,n)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const r=n(634),s="default";function o(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:s,__evaluation:n,value:i}}function i(t,e,n){var i=null!=(i=null==n?void 0:n.value)?i:{};return $P($P({},o(t,e,n,i)),{get:u(null==n?void 0:n.value)})}function u(i,s){return(t,e)=>{var n=null!=(n=null==i?void 0:i[t])?n:null;return null!=n&&(null==e||(0,r.le)(n,e))?(null!=s&&s(t),n):null!=e?e:null}}e.ue=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.oe=i,e.re=function(t,e,n){return t=i(t,e,n),$P($P({},t),{groupName:null!=(e=null==n?void 0:n.group_name)?e:null})},e.se=function(t,e,n,i){return $P($P({},o(t,e,n,void 0)),{get:u(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.ne=function(t,e,n,i){return $P($P($P({},t),e),{get:u(n,i)})},e.ie=u},812:(t,e)=>{$Q(e)},578:(t,e,n)=>{$Q(e),e.v=e.A=void 0;const i=n(406),s=n(512);e.A=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){return s.Log.error("Failed to JSON.stringify user"),{}}},e.v=function(t){return t?(0,i.Dt)(t):null}},534:function(t,n,e){var i=this&&this.__awaiter||$A(),s=($Q2(n,"__esModule",{value:!0}),n.J=n.F=n.Storage=void 0,e(512)),e=e(830);const r={},o=t=>Promise.resolve(t),u={ae:()=>"InMemory",U:t=>r[t]||null,ce:t=>o(r[t]||null),L:(t,e)=>(r[t]=e,o()),q:t=>(delete r[t],o()),he:()=>o(Object.keys(r))};let l=null;try{const h=(0,e.Lt)();h&&h.localStorage&&"function"==typeof h.localStorage.getItem&&(l={ae:()=>"LocalStorage",U:t=>h.localStorage.getItem(t),ce:t=>o(h.localStorage.getItem(t)),L:(t,e)=>(h.localStorage.setItem(t,e),o()),q:t=>(h.localStorage.removeItem(t),o()),he:()=>o(Object.keys(h.localStorage))})}catch(t){s.Log.warn("Failed to setup localStorageProvider.")}let a=null!==l&&void 0!==l?l:u,c=a;function d(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.de(u),null;throw t}}n.Storage={ae:()=>c.ae(),ce:t=>i(void 0,void 0,void 0,function*(){return d(()=>c.ce(t))}),U:t=>d(()=>c.U?c.U(t):null),L:(t,e)=>c.L(t,e),q:t=>c.q(t),he:()=>c.he(),de:t=>{a=t,c=t},Bt:t=>{c=t?u:a}},n.F=function(e){return i(this,void 0,void 0,function*(){var t=yield n.Storage.ce(e);return JSON.parse(null!=t?t:"null")})},n.J=function(t,e){return i(this,void 0,void 0,function*(){yield n.Storage.L(t,JSON.stringify(e))})}},401:(t,e,n)=>{$Q(e),e.C=void 0;const s=n(512);e.C=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return s.Log.error("Failed to parse "+n),null}},634:(t,e)=>{$Q(e),e.le=e.kt=void 0,e.kt=function(t){return Array.isArray(t)?"array":typeof t},e.le=function(t,e){var n=t=>Array.isArray(t)?"array":typeof t;return n(t)===n(e)}},23:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},397:(t,e,n)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;n=n(830);const i="foreground",s="background",r=[];let o=i,u=!1;e.Ot=()=>o===i,e.Ut=()=>u,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==o&&(o=e,r.forEach(t=>t(e)))},(0,n.zt)("focus",()=>{(u=!1,e.ve)(i)}),(0,n.zt)("blur",()=>(0,e.ve)(s)),(0,n.zt)("beforeunload",()=>{u=!0,(0,e.ve)(s)}),(0,n.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?i:s)})},914:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,n(845);const r=n(770),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return r.EventLogger}}),n(512));$Q2(e,"Log",{enumerable:!0,get:function(){return o.Log}});var u=n(0);const l=n(534);$Q2(e,"Storage",{enumerable:!0,get:function(){return l.Storage}}),s(n(845),e),s(n(137),e),s(n(427),e),s(n(694),e),s(n(539),e),s(n(542),e),s(n(922),e),s(n(417),e),s(n(406),e),s(n(333),e),s(n(512),e),s(n(404),e),s(n(410),e),s(n(405),e),s(n(361),e),s(n(830),e),s(n(902),e),s(n(143),e),s(n(122),e),s(n(375),e),s(n(636),e),s(n(206),e),s(n(637),e),s(n(0),e),s(n(586),e),s(n(59),e),s(n(812),e),s(n(578),e),s(n(534),e),s(n(401),e),s(n(634),e),s(n(638),e),s(n(23),e),s(n(397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.Log,SDK_VERSION:u.SDK_VERSION})},296:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),s(n(18),e),e.default=__STATSIG__},262:(t,e,n)=>{$Q(e),e.fe=void 0;const i=n(914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=function(t,e){var n;return(e=(0,i.C)(e,"checksum","DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),n.dynamic_configs)}),s((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.Dt)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs},2))===e.checksumV2?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},226:(t,e,n)=>{$Q(e);const i=n(914);e.default=class{constructor(){this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,i.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;t&&!0===(null==(e=(0,i.C)(t.data,"has_updates","EvaluationResponse"))?void 0:e.has_updates)&&(this._e=t.data,this.ye=e.time,this.me=t.receivedAt,this.be=t.source,this.ge=e)}getGate(t){var e;return this.pe(null==(e=this.ge)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.pe(null==(e=this.ge)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.pe(null==(e=this.ge)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.pe(null==(e=this.ge)?void 0:e.param_stores,t)}pe(t,e){let n=null;return{result:n=t?t[e]||t[(0,i.h)(e)]:n,details:this.Se(null==n)}}Se(t){return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:{reason:this.be+":"+(t?"Unrecognized":"Recognized"),lcut:this.ye,receivedAt:this.me}}}},448:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e);const u=n(914),l=n(262);class i extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,u.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(n,i,s,r){return o(this,void 0,void 0,function*(){var t=i?(0,u.C)(i,"has_updates","InitializeResponse"):null;let e={user:r,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.je(n,t,e,s)})}je(e,n,i,s){var r;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:i,retries:2,isStatsigEncodable:!0,priority:s});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(r=null==t?void 0:t.body)?r:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==i.deltasResponseRequested?t.body:"string"==typeof(t=(0,l.fe)(n,t.body))?t:this.je(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}),s)})}}e.default=i},583:(t,e,n)=>{$Q(e),e.Te=void 0;const g=n(914),y={disableExposureLog:!0};function b(t){return null==t||!1===t.disableExposureLog}function p(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var n,i,s,r,o,u,l,a,c,d,h=f[t];if(null==h||null!=e&&(0,g.kt)(e)!==h.param_type)return e;switch(h.ref_type){case"static":return h.value;case"gate":return d=h,v.getFeatureGate(d.gate_name,b(_)?void 0:y).value?d.pass_value:d.fail_value;case"dynamic_config":return d=h,l=e,a=_,p(c=(u=v).getDynamicConfig(d.config_name,y).get(d.param_name),l)?l:(b(a)&&u.getDynamicConfig(d.config_name),c);case"experiment":return l=h,a=e,u=_,p(o=(c=v).getExperiment(l.experiment_name,y).get(l.param_name),a)?a:(b(u)&&c.getExperiment(l.experiment_name),o);case"layer":return o=h,i=e,s=_,p(r=(n=v).getLayer(o.layer_name,y).get(o.param_name),i)?i:(b(s)&&n.getLayer(o.layer_name).get(o.param_name),r);default:return e}}}},198:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e);const o=n(914),r=n(226),u=n(448),l=n(583),a=n(131);class i extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof i?e:(o.Log.warn((0,o.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){o.SDKType.Kt(t,"javascript-client");var i=new u.default(n,t=>{this.$emt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new a.StatsigEvaluationsDataAdapter,i,n),this.we=new r.default,this.Ie=e}initializeSync(){this.updateUserSync(this.Ie)}initializeAsync(t){return this.updateUserAsync(this.Ie,t)}updateUserSync(t){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie);this.we.setValues(t),this.Me(t),this.xe(null!=t?t:null,this.Ie)}updateUserAsync(n,i){return s(this,void 0,void 0,function*(){this.Ae(n);var t=this.Ie,e=this.dataAdapter.getDataSync(t);this.Qt("Loading",e),this.we.setValues(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.Ie&&(this.we.setValues(e),this.Me(e))})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt}}getAsyncContext(){return s(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield o.StatsigSession.get(this.S),stableID:yield o.StableID.get(this.S)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:n,details:i}=this.we.getGate(t),i=(0,o.ue)(t,i,n),s=null==(s=null==(n=this.$t)?void 0:n.getGateOverride)?void 0:s.call(n,i,this.Ie,e),n=null!=s?s:i;return this.Xt(t,(0,o.ee)(this.Ie,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){var{result:n,details:i}=this.we.getConfig(t),i=(0,o.oe)(t,i,n),s=null==(s=null==(n=this.$t)?void 0:n.getDynamicConfigOverride)?void 0:s.call(n,i,this.Ie,e),n=null!=s?s:i;return this.Xt(t,(0,o.te)(this.Ie,n),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:n}),n}getExperiment(t,e){var{result:n,details:i}=this.we.getConfig(t),i=(0,o.re)(t,i,n),s=null==(s=null==(n=this.$t)?void 0:n.getExperimentOverride)?void 0:s.call(n,i,this.Ie,e),n=null!=s?s:i;return this.Xt(t,(0,o.te)(this.Ie,n),e),this.$emt({name:"experiment_evaluation",experiment:n}),n}getLayer(e,n){var{result:t,details:i}=this.we.getLayer(e),i=(0,o.se)(e,i,t),s=null==(s=null==(t=this.$t)?void 0:t.getLayerOverride)?void 0:s.call(t,i,this.Ie,n);const r=(0,o.ne)(i,s,null!=(t=null==s?void 0:s.__value)?t:i.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,r,t),n)});return this.$emt({name:"layer_evaluation",layer:r}),r}getParameterStore(t,e){var{result:n,details:i}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:i,__configuration:n,get:(0,l.Te)(this,n,e)}}logEvent(t,e,n){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Me(t){this.we.finalize(),this.Qt("Ready",t)}xe(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,o.A)(t,this.p.environment);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=i},131:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const i=n(914),s=n(448);class o extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new s.default(null!=e?e:{})}getDataAsync(t,e,n){return this.M(t,e,n)}prefetchData(t,e){return this.k(t,e)}setData(t){var e=(0,i.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):i.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}N(e,n,i){var s;return r(this,void 0,void 0,function*(){var t=yield null==(s=this.X)?void 0:s.fetchEvaluations(this.P(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}T(t){t=(0,i.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,i.v)(e)}}e.StatsigEvaluationsDataAdapter=o},18:(t,e,n)=>{$Q(e),e.StatsigClient=void 0;n=n(198);e.StatsigClient=n.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:n.default}),e.default=__STATSIG__}},i={};function s(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,s)),e.exports}return s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s(296).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 n={496:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.t=n.i=n.o=void 0,n.o=()=>__STATSIG__||u,n.i=t=>(0,n.o)()[t];n.t=t=>{var e=(0,n.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var i,r="__STATSIG__",s="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=s[r])?i:e[r])?i:o[r])?i:{instance:n.t};s[r]=u,e[r]=u,o[r]=u},707:(t,e,n)=>{$Q(e),e.u=e.l=void 0;const r=n(832);function i(t,e,n){if(n)return n(t,e);const i=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(n=null==e?void 0:e.userID)?n:""),"cids:"+Object.keys(i).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+i[t]).join(","),"k:"+t];return(0,r.h)(e.join("|"))}e.l=i,e.u=function(t,e,n){return e?i(t,e,n):(0,r.h)("k:"+t)}},856:(t,e)=>{$Q(e)},320:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=n(780),a=n(604),s=n(296),o=n(444),c=n(412);function d(t,e,n,i){return{source:t,data:e,receivedAt:Date.now(),stableID:n,fullUserHash:(0,s.v)(i)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new i}attach(t,e){this.S=t,this.p=e}getDataSync(t){var e=this.T(t),n=this.j.get(e,t);return n||((n=this.I(e))?(this.j.add(e,n),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,s.A)(e,null==(e=this.p)?void 0:e.environment),n=this.T(e);this.j.add(n,d("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.j.merge(t)}M(e,n,i){return r(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.k(t,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}D(n,i){return r(this,void 0,void 0,function*(){var t=this.T(n),e=yield this.M(null,n,i);e&&this.j.add(t,$P($P({},e),{source:"Prefetch"}))})}k(s,o,u){return r(this,void 0,void 0,function*(){let t=null;s&&this.R(s,o)&&(t=s.data);var e=yield this.N(t,o,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var n=(0,c.C)(e,"has_updates","Response"),i=this.P(),i=yield a.StableID.get(i);let r=null;if(!0===(null==n?void 0:n.has_updates))r=d("Network",e,i,o);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;r=d("NetworkNotModified",t,i,o)}e=this.T(o);return this.j.add(e,r),yield this.G(e,r),r})}P(){return null!=this.S?this.S:(l.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.U)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){return r(this,void 0,void 0,function*(){yield o.Storage.L(t,JSON.stringify(e)),yield this.K(t)})}K(n){var i;return r(this,void 0,void 0,function*(){var t=null!=(i=yield(0,o.F)(this.O))?i:{},e=(t[n]=Date.now(),u(t,10));e&&(delete t[e],yield o.Storage.q(e)),yield(0,o.J)(this.O,t)})}};class i{constructor(){this.V={}}get(t,e){var t=this.V[t],n=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&n&&e!==n?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var n=u(this.V,9);n&&delete this.V[n],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function u(r,t){var e=Object.keys(r);return e.length<=t?null:e.reduce((t,e)=>{var n=r[t],i=r[e];return"object"==typeof n&&"object"==typeof i?i.receivedAt<n.receivedAt?e:t:i<n?e:t})}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var n=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(360),a=e(972),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,n){this.S=t,this.p=e,this.B=n,this.$=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.H(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.W(e,t)):n}catch(t){return this.W(e,t),null}}W(s,o){try{i.Log.warn("Caught error in "+s,{error:o});n(this,void 0,void 0,function*(){var t,e,n=o||Error(c),i=n instanceof Error,r=i?n.name:"No Name";this.$.has(r)||(this.$.add(r),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o}):(t=l.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(n),n=JSON.stringify($P({tag:s,exception:r,info:i},$P($P({},e),{sdkType:t}))),yield(null!=(r=null==(i=null==(r=this.p)?void 0:r.networkConfig)?void 0:i.networkOverrideFunc)?r:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.B)&&i.call(this,{name:"error",error:o})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=n(832),s=n(780),o=n(716),u=n(48),l=n(876),a=n(444),c=n(84),d=n(100),h={},v=t=>{null!=(t=h[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this.S=e,this.B=t,this.X=n,this.p=i,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),(h[e]=this).st=!0===(null==i?void 0:i.disableLogging),this.rt=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null==i?void 0:i.networkConfig;this.ot=(0,c.ut)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",o.NetworkDefault.eventsApi),(0,d.lt)(t=>{"background"===t&&v(e)}),this.ct(),this.ht()}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this._t(),this.Z.length>this.rt)&&v(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}shutdown(){return i(this,void 0,void 0,function*(){this.ft&&(clearInterval(this.ft),this.ft=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;if(this.gt(),0!==this.Z.length)return t=this.Z,this.Z=[],this.bt(t)})}_t(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>v(this.S),200)}dt(t){if((0,l.yt)(t)){var e=t.user||{},n=t.metadata||{},t=[t.eventName,e.userID,n.gate,n.config,n.ruleID].join("|"),e=this.tt[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=n}return!0}bt(t){var e,n;return i(this,void 0,void 0,function*(){if(this.st)this.St(t);else try{(!(0,d.Ot)()&&this.X.isBeaconSupported()&&null==(null==(n=null==(e=this.p)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?this.B({name:"logs_flushed",events:t}):this.St(t)}catch(t){s.Log.warn("Failed to flush events.")}})}Tt(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}jt(t){return i(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();(0,a.J)(e,t).catch(()=>{s.Log.warn("Unable to save failed logs to storage")})}ct(){const e=this.u();i(this,void 0,void 0,function*(){var t=yield(0,a.F)(e);t&&(yield a.Storage.q(e),yield this.bt(t))}).catch(()=>{s.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,r.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.It(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));s.Log.debug("Enqueued Event:",n),this.Z.push(n)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.At)()}ht(){if((0,u.Mt)()){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{h[this.S].ft!==e?clearInterval(e):v(this.S)},t);this.ft=e}}}},832:(t,e)=>{$Q(e),e.xt=e.h=void 0;e.h=e=>{let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)};e.xt=t=>(0,e.h)(JSON.stringify(r(t)));const r=n=>{if(null==n)return null;var t=Object.keys(n).sort();const i={};return t.forEach(t=>{let e=n[t];!Array.isArray(e)&&e instanceof Object&&(e=r(e)),i[t]=e}),i}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,r;$Q(e),e.Log=e.LogLevel=void 0,(r=i||(e.LogLevel=i={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Info=3]="Info",r[r.Debug=4]="Debug";class s{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=s).level=i.Error},716:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},188:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(496);const o=n(496),_=n(280),g=n(780),u=n(716),l=n(360),a=n(48),c=n(612),d=n(604),h=n(972),b=n(100);e.NetworkCore=class{constructor(t,e){this.B=e,this.kt=1e4,this.Dt={},this.p={},t&&(this.p=t),this.p.networkConfig&&(this.Dt=this.p.networkConfig),this.Dt.networkTimeoutMs&&(this.kt=this.Dt.networkTimeoutMs)}post(e){return s(this,void 0,void 0,function*(){let t=yield this.Et(e);return e.isStatsigEncodable&&(t=this.Rt(e,t)),this.Nt($P({method:"POST",body:t},e))})}get(t){return this.Nt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(i){return s(this,void 0,void 0,function*(){var t,e,n;return!!y(i)&&(t=yield this.Et(i),e=yield this.Ct(i),(n=navigator).sendBeacon.bind(n)(e,t))})}Nt(h){var v,f;return s(this,void 0,void 0,function*(){if(!y(h))return null;if(this.Dt.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i}=h;const r="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>null===r||void 0===r?void 0:r.abort(`Timeout of ${this.kt}ms expired.`),this.kt),s=yield this.Ct(h),o=null,u=(0,b.Pt)();try{var l,a,c,d={method:e,body:n,headers:$P({},h.headers),signal:null===r||void 0===r?void 0:r.signal,priority:h.priority,keepalive:u},o=yield(null!=(v=this.Dt.networkOverrideFunc)?v:fetch)(s,d);if(clearTimeout(t),o.ok)return c=yield o.text(),_.Diagnostics.mark(),{body:c,code:o.status};throw l=yield o.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${s} `+l)).name="NetworkError",a}catch(t){n=function(t,e){if(null!=t&&t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return"Unknown Error"}(r,t);return _.Diagnostics.mark(),!i||i<=0?(null!=(f=this.B)&&f.call(this,{name:"error",error:t}),g.Log.error(`A networking error occured during ${e} request to ${s}.`,n,t),null):this.Nt($P($P({},h),{retries:i-1}))}})}Ct(n){return s(this,void 0,void 0,function*(){const e=$P({[u.NetworkParam.SdkKey]:n.sdkKey,[u.NetworkParam.SdkType]:l.SDKType.Y(n.sdkKey),[u.NetworkParam.SdkVersion]:h.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:yield c.SessionID.get(n.sdkKey)},n.params);var t=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return n.url+(t?"?"+t:"")})}Et(r){return s(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=r,n=yield d.StableID.get(e),i=yield c.SessionID.get(e),e=l.SDKType.Y(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}Rt(t,e){var n,i,r=(0,a.Gt)();if(!t.isStatsigEncodable||this.p.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==r||!r.btoa)return e;try{var s=null!=(n=r.btoa(e).split("").reverse().join(""))?n:e;return t.params=$P($P({},null!=(i=t.params)?i:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return g.Log.warn("/initialize request encoding failed"),e}}};const y=t=>!!t.sdkKey||(g.Log.warn("Unable to make request without an SDK key"),!1)},264:(t,e)=>{$Q(e)},648:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={Y:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},Ut(t,e){n[t]=e},Lt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.At=i.Kt=i.Ft=i.Mt=i.qt=i.Gt=void 0;i.Gt=()=>"undefined"!=typeof window?window:null,i.qt=()=>{var t=(0,i.Gt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Mt=()=>null!=(0,i.qt)(),i.Ft=(t,e)=>{var n=(0,i.Gt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.Kt=(t,e)=>{var n=(0,i.qt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.At=()=>{var t;try{return null==(t=(0,i.Gt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(707),u=n(780),l=n(444),a=n(556),c=18e5,d=144e5,h={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,i.u)(t)}e.SessionID={get:t=>o(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:s=>o(void 0,void 0,void 0,function*(){null==h[s]&&(h[s]=function(n){return o(this,void 0,void 0,function*(){let t=yield function(t){t=f(t);return(0,l.F)(t)}(n);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:n}})}(s));var t=yield h[s],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>c}(n)||function({startTime:t}){return Date.now()-t>d}(n))&&(n.sessionID=(0,a.getUUID)(),n.startTime=e),n.lastUpdate=e,n),r=t.sdkKey;return r=f(r),(0,l.J)(r,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=v(n,c),t.ageTimeoutID=v(n,d-e),t}),overrideInitialSessionID:(t,e)=>{var n;h[e]=(t=t,e=e,n=Date.now(),Promise.resolve({data:{sessionID:t,startTime:n,lastUpdate:n},sdkKey:e}))}}},604:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StableID=void 0;const r=n(707),s=n(780),o=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,r.u)(t)}function c(t,e){e=a(e);(0,o.J)(e,t).catch(()=>{s.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,o.F)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(496);const o=n(496),u=n(512),l=n(728),a=n(780),c=n(48),d=n(612),h=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.zt={};var r,s=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&h.Storage.Jt(!0),null!=i&&i.initialSessionID&&d.StatsigSession.overrideInitialSessionID(i.initialSessionID,t),this.S=t,this.p=null!=i?i:{},this.Vt=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.Bt=new l.EventLogger(t,s,n,i),this.$t=new u.ErrorBoundary(t,i,s),this.$t.wrap(this),this.$t.wrap(n),this.$t.wrap(e),this.$t.wrap(this.Bt),(0,c.Mt)()&&(null!=(n=null!=(s=(r=(0,o.o)()).instances)?s:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),n[t]=this,r.lastInstance=this,r.instances=n,__STATSIG__=r),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.Ht()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Bt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,h.Storage.Jt(t.disableStorage))}flush(){return this.Bt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Bt.shutdown()})}on(t,e){this.zt[t]||(this.zt[t]=[]),this.zt[t].push(e)}off(t,e){this.zt[t]&&-1!==(e=this.zt[t].indexOf(e))&&this.zt[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.$t.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.zt[n.name]&&this.zt[n.name].forEach(t=>e(t)),null!=(t=this.zt["*"])&&t.forEach(e)}Wt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Yt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Bt.incrementNonExposureCount(t):this.Bt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.Qt=e.Xt=e.Zt=e.yt=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,r)=>({eventName:t,user:e,value:null,metadata:s(n,i),secondaryExposures:r,time:Date.now()});e.yt=({eventName:t})=>t===i||t===n,e.Zt=(t,e)=>{return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.Xt=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Qt=(t,e,n)=>{var i,r=e.__evaluation,s=!0===(null==(s=null==r?void 0:r.explicit_parameters)?void 0:s.includes(n));let o="",u=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return s&&(o=null!=(i=r.allocated_experiment_name)?i:"",u=r.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(s)},u)};const s=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="1.3.0";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.te=e.ee=e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const r="default";function s(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,__evaluation:n,value:i}}function i(t,e,n){var i=null!=(i=null==n?void 0:n.value)?i:{};return $P($P({},s(t,e,n,i)),{get:u(null==n?void 0:n.value)})}function o(t,e){var n=t=>Array.isArray(t)?"array":typeof t;return n(t)===n(e)}function u(i,r){return(t,e)=>{var n=null!=(n=null==i?void 0:i[t])?n:null;return null!=n&&(null==e||o(n,e))?(null!=r&&r(t),n):null!=e?e:null}}e.ue=function(t,e,n){return s(t,e,n,!0===(null==n?void 0:n.value))},e.oe=i,e.re=function(t,e,n){return t=i(t,e,n),$P($P({},t),{groupName:null!=(e=null==n?void 0:n.group_name)?e:null})},e.se=function(t,e,n,i){return $P($P({},s(t,e,n,void 0)),{get:u(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.ne=function(t,e,n,i){return $P($P($P({},t),e),{get:u(n,i)})},e.ie=function(t){return Array.isArray(t)?"array":typeof t},e.ee=o,e.te=u},136:(t,e)=>{$Q(e)},296:(t,e,n)=>{$Q(e),e.v=e.A=void 0;const i=n(832),r=n(780);e.A=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){return r.Log.error("Failed to JSON.stringify user"),{}}},e.v=function(t){return t?(0,i.xt)(t):null}},444:function(t,n,e){var i=this&&this.__awaiter||$A(),r=($Q2(n,"__esModule",{value:!0}),n.J=n.F=n.Storage=void 0,e(780)),e=e(48);const s={},o=t=>Promise.resolve(t),u={le:()=>"InMemory",U:t=>s[t]||null,ae:t=>o(s[t]||null),L:(t,e)=>(s[t]=e,o()),q:t=>(delete s[t],o()),ce:()=>o(Object.keys(s))};let l=null;try{const h=(0,e.Gt)();h&&h.localStorage&&"function"==typeof h.localStorage.getItem&&(l={le:()=>"LocalStorage",U:t=>h.localStorage.getItem(t),ae:t=>o(h.localStorage.getItem(t)),L:(t,e)=>(h.localStorage.setItem(t,e),o()),q:t=>(h.localStorage.removeItem(t),o()),ce:()=>o(Object.keys(h.localStorage))})}catch(t){r.Log.warn("Failed to setup localStorageProvider.")}let a=null!==l&&void 0!==l?l:u,c=a;function d(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.he(u),null;throw t}}n.Storage={le:()=>c.le(),ae:t=>i(void 0,void 0,void 0,function*(){return d(()=>c.ae(t))}),U:t=>d(()=>c.U?c.U(t):null),L:(t,e)=>c.L(t,e),q:t=>c.q(t),ce:()=>c.ce(),he:t=>{a=t,c=t},Jt:t=>{c=t?u:a}},n.F=function(e){return i(this,void 0,void 0,function*(){var t=yield n.Storage.ae(e);return JSON.parse(null!=t?t:"null")})},n.J=function(t,e){return i(this,void 0,void 0,function*(){yield n.Storage.L(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),e.C=void 0;const r=n(780);e.C=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return r.Log.error("Failed to parse "+n),null}},556:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.de=e.lt=e.Pt=e.Ot=void 0;n=n(48);const i="foreground",r="background",s=[];let o=i,u=!1;e.Ot=()=>o===i,e.Pt=()=>u,e.lt=t=>{s.unshift(t)};e.de=e=>{e!==o&&(o=e,s.forEach(t=>t(e)))},(0,n.Ft)("focus",()=>{(u=!1,e.de)(i)}),(0,n.Ft)("blur",()=>(0,e.de)(r)),(0,n.Ft)("beforeunload",()=>{u=!0,(0,e.de)(r)}),(0,n.Kt)("visibilitychange",()=>{(0,e.de)("visible"===document.visibilityState?i:r)})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,n(496);const s=n(728),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return s.EventLogger}}),n(780));$Q2(e,"Log",{enumerable:!0,get:function(){return o.Log}});var u=n(972);const l=n(444);$Q2(e,"Storage",{enumerable:!0,get:function(){return l.Storage}}),r(n(496),e),r(n(707),e),r(n(856),e),r(n(320),e),r(n(184),e),r(n(512),e),r(n(500),e),r(n(788),e),r(n(832),e),r(n(664),e),r(n(780),e),r(n(188),e),r(n(716),e),r(n(264),e),r(n(648),e),r(n(48),e),r(n(360),e),r(n(612),e),r(n(604),e),r(n(688),e),r(n(808),e),r(n(283),e),r(n(876),e),r(n(972),e),r(n(384),e),r(n(396),e),r(n(136),e),r(n(296),e),r(n(444),e),r(n(412),e),r(n(84),e),r(n(539),e),r(n(556),e),r(n(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.Log,SDK_VERSION:u.SDK_VERSION})},920:(t,e,n)=>{$Q(e),e.AutoInit=void 0;const d=n(464),h=n(208);function v(t,e){var n;return null!=(n=e.get(t))?n:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,n,i;try{var r=(0,d.Gt)(),s=(0,d.qt)();if(r&&s&&s.currentScript){var o=s.currentScript.getAttribute("src"),u=null==(t=r.location)?void 0:t.href;if(o&&u){var l=new URL(o,u).searchParams,a=null!=(n=v("sdkKey",l))?n:v("apiKey",l);if(a){var c=null==(i=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:i[a];let t=null;(t=c instanceof h.StatsigClient?c:t)||(t=new h.StatsigClient(a,function(){var t=(0,d.Gt)();if(!t)return{};let e=t.statsigUser||{};var n=(e="object"!=typeof e?{}:e).custom||{},i=e.customIDs||{};return $P($P({},e),{customIDs:$P({},i),custom:$P($P({},n),{useragent:t.navigator.userAgent,page_url:(0,d.At)()||"",language:null==(i=t.navigator)?void 0:i.language})})}())).initializeAsync().catch(t=>{d.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){d.Log.error("AutoInit failed",t)}}}},96:(t,e,n)=>{$Q(e),e.ve=void 0;const i=n(464);function r(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.ve=function(t,e){var n;return(e=(0,i.C)(e,"checksum","DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),n.dynamic_configs)}),r((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,r(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,r(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.xt)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs}))===e.checksum?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},156:(t,e,n)=>{$Q(e);const i=n(464);e.default=class{constructor(){this._e=null,this.fe=null,this.ge="Uninitialized",this.be=0,this.ye=0}reset(){this.fe=null,this._e=null,this.ge="Loading",this.be=0,this.ye=0}finalize(){this.fe||(this.ge="NoValues")}getValues(){return this._e?(0,i.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;t&&!0===(null==(e=(0,i.C)(t.data,"has_updates","EvaluationResponse"))?void 0:e.has_updates)&&(this._e=t.data,this.be=e.time,this.ye=t.receivedAt,this.ge=t.source,this.fe=e)}getGate(t){var e;return this.me(null==(e=this.fe)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.me(null==(e=this.fe)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.me(null==(e=this.fe)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.me(null==(e=this.fe)?void 0:e.param_stores,t)}me(t,e){let n=null;return{result:n=t?t[e]||t[(0,i.h)(e)]:n,details:this.pe(null==n)}}pe(t){return"Uninitialized"===this.ge||"NoValues"===this.ge?{reason:this.ge}:{reason:this.ge+":"+(t?"Unrecognized":"Recognized"),lcut:this.be,receivedAt:this.ye}}}},400:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e);const u=n(464),l=n(96);class i extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Se=(0,u.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(n,i,r,s){return o(this,void 0,void 0,function*(){var t=i?(0,u.C)(i,"has_updates","InitializeResponse"):null;let e={user:s,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.Oe(n,t,e,r)})}Oe(e,n,i,r){var s;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Se,data:i,retries:2,isStatsigEncodable:!0,priority:r});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(s=null==t?void 0:t.body)?s:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(s=t.body)?void 0:s.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,l.ve)(n,t.body))?t:this.Oe(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}),r)})}}e.default=i},340:(t,e,n)=>{$Q(e),e.je=void 0;const g=n(464),b={disableExposureLog:!0};function y(t){return null==t||!1===t.disableExposureLog}function m(t,e){return null!=e&&!(0,g.ee)(t,e)}e.je=function(v,f,_){return(t,e)=>{if(null==f)return e;var n,i,r,s,o,u,l,a,c,d,h=f[t];if(null==h||null!=e&&(0,g.ie)(e)!==h.param_type)return e;switch(h.ref_type){case"static":return h.value;case"gate":return d=h,v.getFeatureGate(d.gate_name,y(_)?void 0:b).value?d.pass_value:d.fail_value;case"dynamic_config":return d=h,l=e,a=_,m(c=(u=v).getDynamicConfig(d.config_name,b).get(d.param_name),l)?l:(y(a)&&u.getDynamicConfig(d.config_name),c);case"experiment":return l=h,a=e,u=_,m(o=(c=v).getExperiment(l.experiment_name,b).get(l.param_name),a)?a:(y(u)&&c.getExperiment(l.experiment_name),o);case"layer":return o=h,i=e,r=_,m(s=(n=v).getLayer(o.layer_name,b).get(o.param_name),i)?i:(y(r)&&n.getLayer(o.layer_name).get(o.param_name),s);default:return e}}}},520:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const o=n(464),s=n(156),u=n(400),l=n(340),a=n(364);class i extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof i?e:(o.Log.warn((0,o.Mt)()?"Unable to find StatsigClient instance":"StatsigClient.instance is not supported in server environments"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){o.SDKType.Ut(t,"javascript-client");var i=new u.default(n,t=>{this.$emt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new a.StatsigEvaluationsDataAdapter,i,n),this.Te=new s.default,this.we=e}initializeSync(){this.updateUserSync(this.we)}initializeAsync(t){return this.updateUserAsync(this.we,t)}updateUserSync(t){this.Ie(t);t=this.dataAdapter.getDataSync(this.we);this.Te.setValues(t),this.Ae(t),this.Me(null!=t?t:null,this.we)}updateUserAsync(n,i){return r(this,void 0,void 0,function*(){this.Ie(n);var t=this.we,e=this.dataAdapter.getDataSync(t);this.Wt("Loading",e),this.Te.setValues(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.we&&(this.Te.setValues(e),this.Ae(e))})}getContext(){return{sdkKey:this.S,options:this.p,values:this.Te.getValues(),user:JSON.parse(JSON.stringify(this.we)),errorBoundary:this.$t}}getAsyncContext(){return r(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield o.StatsigSession.get(this.S),stableID:yield o.StableID.get(this.S)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:n,details:i}=this.Te.getGate(t),i=(0,o.ue)(t,i,n),r=null==(r=null==(n=this.Vt)?void 0:n.getGateOverride)?void 0:r.call(n,i,this.we,e),n=null!=r?r:i;return this.Yt(t,(0,o.Zt)(this.we,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){var{result:n,details:i}=this.Te.getConfig(t),i=(0,o.oe)(t,i,n),r=null==(r=null==(n=this.Vt)?void 0:n.getDynamicConfigOverride)?void 0:r.call(n,i,this.we,e),n=null!=r?r:i;return this.Yt(t,(0,o.Xt)(this.we,n),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:n}),n}getExperiment(t,e){var{result:n,details:i}=this.Te.getConfig(t),i=(0,o.re)(t,i,n),r=null==(r=null==(n=this.Vt)?void 0:n.getExperimentOverride)?void 0:r.call(n,i,this.we,e),n=null!=r?r:i;return this.Yt(t,(0,o.Xt)(this.we,n),e),this.$emt({name:"experiment_evaluation",experiment:n}),n}getLayer(e,n){var{result:t,details:i}=this.Te.getLayer(e),i=(0,o.se)(e,i,t),r=null==(r=null==(t=this.Vt)?void 0:t.getLayerOverride)?void 0:r.call(t,i,this.we,n);const s=(0,o.ne)(i,r,null!=(t=null==r?void 0:r.__value)?t:i.__value,t=>{this.Yt(e,(0,o.Qt)(this.we,s,t),n)});return this.$emt({name:"layer_evaluation",layer:s}),s}getParameterStore(t,e){var{result:n,details:i}=this.Te.getParamStore(t);return this.Bt.incrementNonExposureCount(t),{name:t,details:i,__configuration:n,get:(0,l.je)(this,n,e)}}logEvent(t,e,n){this.Bt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.we,time:Date.now()}))}Ht(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Ae(null)})}Ae(t){this.Te.finalize(),this.Wt("Ready",t)}Me(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ie(t){this.Bt.reset(),this.Te.reset(),this.we=(0,o.A)(t,this.p.environment);t=null==(t=this.we.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=i},364:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const i=n(464),r=n(400);class o extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new r.default(null!=e?e:{})}getDataAsync(t,e,n){return this.M(t,e,n)}prefetchData(t,e){return this.D(t,e)}setData(t){var e=(0,i.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):i.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}N(e,n,i){var r;return s(this,void 0,void 0,function*(){var t=yield null==(r=this.X)?void 0:r.fetchEvaluations(this.P(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}T(t){t=(0,i.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,i.v)(e)}}e.StatsigEvaluationsDataAdapter=o},208:(t,e,n)=>{$Q(e),e.StatsigClient=void 0;n=n(520);e.StatsigClient=n.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:n.default}),e.default=__STATSIG__},536:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const o=n(464),r=n(76),s=n(724);e.runStatsigAutoCapture=function(t){return new u(t)};class u{constructor(t){this.xe=t,this.He=Date.now(),this.We=0;var e,{sdkKey:t,errorBoundary:n}=t.getContext(),n=(this.$t=n,this.$t.wrap(this),(0,o.qt)());(0,o.Mt)()&&((e=null!=(e=(__STATSIG__=(0,o.o)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.Ye()):this.Ye()}Qe(){const e=(0,o.Gt)();var t,n=(0,o.qt)();e&&n&&(t=t=>{this.Xe(t||e.event)},(0,r.Ze)(n,"click",t),(0,r.Ze)(n,"submit",t),(0,r.Ze)(e,"error",t),(0,r.Ze)(e,"beforeunload",()=>this.ti()),(0,r.Ze)(e,"scroll",()=>this.ei()))}Xe(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.ii(t):(e=(0,r.ni)(t))&&(0,r.dt)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,r.si)(e),this.ri(n,t,e))}Ye(){this.Qe(),this.oi(),this.ui(),this.li()}ii(t){var e=(null==t?void 0:t.error)||{};let n=e;if("object"==typeof e)try{n=JSON.stringify(e)}catch(t){n="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.ri("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}oi(){this.ai().then(t=>{this.ci(t)&&this.ri("session_start",(0,r.hi)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}).catch(t=>{this.$t.logError("AC::logSession",t)})}ui(){setTimeout(()=>{var t=(0,r.di)(),t=(0,s.vi)(t);this.ri("page_view",(0,r.hi)(),t,{flushImmediately:!0,addNewSessionMetadata:!0})},1)}li(){const n=(0,o.Gt)();void 0!==(null===n||void 0===n?void 0:n.performance)&&"function"==typeof n.performance.getEntriesByType&&"function"==typeof n.performance.getEntriesByName&&setTimeout(()=>{var t={},e=n.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),n.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.ri("performance",(0,r.hi)(),t)},1)}ti(){this.ri("page_view_end",(0,r.hi)(),{scrollDepth:this.We,pageViewLength:Date.now()-this.He},{flushImmediately:!0})}ri(n,i,r,s){this.ai().then(t=>{var e=$P({sessionID:t.data.sessionID,page_url:null!=(e=null==(e=null==(e=(0,o.Gt)())?void 0:e.location)?void 0:e.href)?e:""},r),t=(null!=s&&s.addNewSessionMetadata&&(e.isNewSession=String(this.ci(t))),{eventName:"auto_capture::"+n,value:i,metadata:e});this.xe.logEvent(t),null!=s&&s.flushImmediately&&this.xe.flush().catch(t=>{o.Log.error(t)})}).catch(t=>{this.$t.logError("AC::enqueue",t)})}ei(){var t=null!=(t=null==(t=(0,o.qt)())?void 0:t.body.scrollHeight)?t:1,e=(0,o.Gt)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.We=Math.max(this.We,Math.min(100,Math.round((n+e)/t*100)))}ci(t){return Math.abs(t.data.startTime-Date.now())<1e3}ai(){return i(this,void 0,void 0,function*(){return(yield this.xe.getAsyncContext()).session})}}e.AutoCapture=u},76:(t,e,n)=>{$Q(e),e.Ze=e.hi=e.di=e.dt=e.ni=e.si=void 0;const s=n(464);function o(e){if(e){let t=e;for(;t;){var n=t.tagName.toLowerCase();if(["body","document"].includes(n))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.si=function(t){var e=t.tagName.toLowerCase(),n={},i=(0,s.At)()||"",r=("form"===(n.tagName=e)&&(n.action=t.getAttribute("action"),n.method=null!=(r=t.getAttribute("method"))?r:"GET",n.formName=t.getAttribute("name"),n.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(n.content=t.value,n.inputName=t.getAttribute("name")),o(t));return r&&(n.href=r.getAttribute("href")),"button"!==e&&!r||(n.content=(t.textContent||"").trim()),{value:i,metadata:n}},e.ni=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.dt=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var n=e.tagName.toLowerCase(),i=t.type.toLowerCase();switch(n){case"html":return!1;case"form":return"submit"===i;case"input":case"select":case"textarea":return["change"].includes(i);default:if("click"===i){if("button"===n)return!0;if(o(e))return!0}return!1}},e.di=function(){var t=null!=(t=null==(t=null==(t=(0,s.Gt)())?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.hi=function(){return(0,s.At)()||""},e.Ze=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},824:(t,e,n)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(536);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),$Q2(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return i.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture,runStatsigAutoCapture:i.runStatsigAutoCapture}),e.default=__STATSIG__},724:(t,e,n)=>{$Q(e),e.vi=void 0;const a=n(464);e.vi=function(t){var e=(0,a.qt)(),n=(0,a.Gt)();if(!e||!n)return{};var i=null==n?void 0:n.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,o=function(t){const e=t.hostname,n=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return n||""}(u),u=u.searchParams.get("yahoo"===o?"p":"q")||"";var o={searchEngine:o,searchQuery:u},u=function(t){const n=t.searchParams,i={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","gclsrc","dclid","fbclid","msclkid","mc_eid","mc_cid","twclid","li_fat_id","igshid","utm_id","ttc","ttclid","ttc_id"].forEach(t=>{var e=n.get(t);e&&(i[t]=e)}),i}(t);const l={};return t.searchParams.forEach((t,e)=>{l[e]=t}),$P($P($P($P({},o),u),l),{title:(null==e?void 0:e.title)||"",locale:(null==i?void 0:i.language)||"unknown",referrer:r,screen_width:(null==(t=null==n?void 0:n.screen)?void 0:t.width)||"unknown",screen_height:(null==(o=null==n?void 0:n.screen)?void 0:o.height)||"unknown",viewport_width:(null==n?void 0:n.innerWidth)||"unknown",viewport_height:(null==n?void 0:n.innerHeight)||"unknown"})}}},i={};function r(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,r)),e.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var t={};{var e=t;const o=r(824);var s=r(920);e.default=__STATSIG__,s.AutoInit.attempt(({client:t})=>{new o.AutoCapture(t)})}return t.default})());
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((t,r,u,l)=>{return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})});var n={845:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.t=n.i=n.o=void 0,n.o=()=>__STATSIG__||u,n.i=t=>(0,n.o)()[t];n.t=t=>{var e=(0,n.o)();return t?e.instances&&e.instances[t]:e.lastInstance};var i,r="__STATSIG__",s="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=s[r])?i:e[r])?i:o[r])?i:{instance:n.t};s[r]=u,e[r]=u,o[r]=u},137:(t,e,n)=>{$Q(e),e.u=e.l=void 0;const r=n(406);function i(t,e,n){if(n)return n(t,e);const i=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(n=null==e?void 0:e.userID)?n:""),"cids:"+Object.keys(i).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+i[t]).join(","),"k:"+t];return(0,r.h)(e.join("|"))}e.l=i,e.u=function(t,e,n){return e?i(t,e,n):(0,r.h)("k:"+t)}},427:(t,e)=>{$Q(e)},694:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=n(512),a=n(122),s=n(578),o=n(534),c=n(401);function d(t,e,n,i){return{source:t,data:e,receivedAt:Date.now(),stableID:n,fullUserHash:(0,s.v)(i)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.m=e,this.p=null,this.S=null,this.O="statsig.last_modified_time."+e,this.j=new i}attach(t,e){this.S=t,this.p=e}getDataSync(t){var e=this.T(t),n=this.j.get(e,t);return n||((n=this.I(e))?(this.j.add(e,n),this.j.get(e,t)):null)}setData(t,e){var e=e&&(0,s.A)(e,null==(e=this.p)?void 0:e.environment),n=this.T(e);this.j.add(n,d("Bootstrap",t,null,e))}__primeInMemoryCache(t){this.j.merge(t)}M(e,n,i){return r(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.D(t,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(n,i){return r(this,void 0,void 0,function*(){var t=this.T(n),e=yield this.M(null,n,i);e&&this.j.add(t,$P($P({},e),{source:"Prefetch"}))})}D(s,o,u){return r(this,void 0,void 0,function*(){let t=null;s&&this.R(s,o)&&(t=s.data);var e=yield this.N(t,o,u);if(!e)return l.Log.debug("No response returned for latest value"),null;var n=(0,c.C)(e,"has_updates","Response"),i=this.P(),i=yield a.StableID.get(i);let r=null;if(!0===(null==n?void 0:n.has_updates))r=d("Network",e,i,o);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;r=d("NetworkNotModified",t,i,o)}e=this.T(o);return this.j.add(e,r),yield this.G(e,r),r})}P(){return null!=this.S?this.S:(l.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.U)?void 0:e.call(o.Storage,t);return null!=e&&(t=(0,c.C)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}G(t,e){return r(this,void 0,void 0,function*(){yield o.Storage.L(t,JSON.stringify(e)),yield this.K(t)})}K(n){var i;return r(this,void 0,void 0,function*(){var t=null!=(i=yield(0,o.F)(this.O))?i:{},e=(t[n]=Date.now(),u(t,10));e&&(delete t[e],yield o.Storage.q(e)),yield(0,o.J)(this.O,t)})}};class i{constructor(){this.V={}}get(t,e){var t=this.V[t],n=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&n&&e!==n?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var n=u(this.V,9);n&&delete this.V[n],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function u(r,t){var e=Object.keys(r);return e.length<=t?null:e.reduce((t,e)=>{var n=r[t],i=r[e];return"object"==typeof n&&"object"==typeof i?i.receivedAt<n.receivedAt?e:t:i<n?e:t})}},962:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},539:(t,e)=>{$Q(e)},542:function(t,u,e){var n=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(512),l=e(902),a=e(0),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");u.ErrorBoundary=class{constructor(t,e,n){this.S=t,this.p=e,this.B=n,this.$=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.H(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.W("eb:wrap",t)}}logError(t,e){this.W(t,e)}H(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.W(e,t)):n}catch(t){return this.W(e,t),null}}W(s,o){try{i.Log.warn("Caught error in "+s,{error:o});n(this,void 0,void 0,function*(){var t,e,n=o||Error(c),i=n instanceof Error,r=i?n.name:"No Name";this.$.has(r)||(this.$.add(r),null!=(t=null==(t=this.p)?void 0:t.networkConfig)&&t.preventAllNetworkTraffic?null!=(t=this.B)&&t.call(this,{name:"error",error:o}):(t=l.SDKType.Y(this.S),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(n),n=JSON.stringify($P({tag:s,exception:r,info:i},$P($P({},e),{sdkType:t}))),yield(null!=(r=null==(i=null==(r=this.p)?void 0:r.networkConfig)?void 0:i.networkOverrideFunc)?r:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.S,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(i=this.B)&&i.call(this,{name:"error",error:o})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},922:(t,e)=>{$Q(e)},417:(t,e)=>{$Q(e)},770:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=n(406),s=n(512),o=n(410),u=n(830),l=n(637),a=n(534),c=n(638),d=n(397),h={},v=t=>{null!=(t=h[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this.S=e,this.B=t,this.X=n,this.p=i,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),(h[e]=this).st=!0===(null==i?void 0:i.disableLogging),this.rt=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null==i?void 0:i.networkConfig;this.ot=(0,c.ut)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",o.NetworkDefault.eventsApi),(0,d.lt)(t=>{"background"===t&&v(e)}),this.ct(),this.ht()}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&v(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}shutdown(){return i(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;if(this.gt(),0!==this.Z.length)return t=this.Z,this.Z=[],this.bt(t)})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>v(this.S),200)}dt(t){if((0,l.yt)(t)){var e=t.user||{},n=t.metadata||{},t=[t.eventName,e.userID,n.gate,n.config,n.ruleID].join("|"),e=this.tt[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.tt).length&&(this.tt={}),this.tt[t]=n}return!0}bt(t){var e,n;return i(this,void 0,void 0,function*(){if(this.st)this.St(t);else try{(!(0,d.Ot)()&&this.X.isBeaconSupported()&&null==(null==(n=null==(e=this.p)?void 0:e.networkConfig)?void 0:n.networkOverrideFunc)?yield this.jt(t):yield this.Tt(t)).success?this.B({name:"logs_flushed",events:t}):this.St(t)}catch(t){s.Log.warn("Failed to flush events.")}})}Tt(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.X.post(this.wt(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}jt(t){return i(this,void 0,void 0,function*(){return{success:yield this.X.beacon(this.wt(t))}})}wt(t){return{sdkKey:this.S,data:{events:t},url:this.ot,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();(0,a.J)(e,t).catch(()=>{s.Log.warn("Unable to save failed logs to storage")})}ct(){const e=this.u();i(this,void 0,void 0,function*(){var t=yield(0,a.F)(e);t&&(yield a.Storage.q(e),yield this.bt(t))}).catch(()=>{s.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,r.h)(this.S)}vt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.It(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));s.Log.debug("Enqueued Event:",n),this.Z.push(n)}gt(){0!==Object.keys(this.et).length&&(this.vt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.et)}}),this.et={})}It(){var t;if(!1!==(null==(t=this.p)?void 0:t.includeCurrentPageUrlWithEvents))return(0,u.At)()}ht(){if(!(0,u.Mt)()){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{h[this.S]._t!==e?clearInterval(e):v(this.S)},t);this._t=e}}}},406:(t,s,e)=>{$Q2(s,"__esModule",{value:!0}),s.xt=s.Dt=s.h=void 0;const o=e(634);s.h=e=>{let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)},s.Dt=(t,e)=>(0,s.h)(JSON.stringify((0,s.xt)(t,e)));s.xt=(n,i)=>{if(null==n)return null;var t=Object.keys(n).sort();const r={};return t.forEach(t=>{var e=n[t];0===i||"object"!==(0,o.kt)(e)?r[t]=e:r[t]=(0,s.xt)(e,null!=i?i-1:i)}),r}},333:(t,e)=>{$Q(e)},512:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,r;$Q(e),e.Log=e.LogLevel=void 0,(r=i||(e.LogLevel=i={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Info=3]="Info",r[r.Debug=4]="Debug";class s{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=s).level=i.Error},410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://prodregistryv2.org/v1",initializeApi:"https://featureassets.org/v1",specsApi:"https://assetsconfigcdn.org/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},404:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(845);const o=n(845),_=n(962),g=n(512),u=n(410),l=n(902),a=n(830),c=n(143),d=n(122),h=n(0),y=n(397);e.NetworkCore=class{constructor(t,e){this.B=e,this.Et=1e4,this.Rt={},this.p={},t&&(this.p=t),this.p.networkConfig&&(this.Rt=this.p.networkConfig),this.Rt.networkTimeoutMs&&(this.Et=this.Rt.networkTimeoutMs)}post(e){return s(this,void 0,void 0,function*(){let t=yield this.Nt(e);return e.isStatsigEncodable&&(t=this.Ct(e,t)),this.Pt($P({method:"POST",body:t},e))})}get(t){return this.Pt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}beacon(i){return s(this,void 0,void 0,function*(){var t,e,n;return!!b(i)&&(t=yield this.Nt(i),e=yield this.Gt(i),(n=navigator).sendBeacon.bind(n)(e,t))})}Pt(h){var v,f;return s(this,void 0,void 0,function*(){if(!b(h))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i}=h;const r="undefined"!=typeof AbortController?new AbortController:null;var t=setTimeout(()=>null===r||void 0===r?void 0:r.abort(`Timeout of ${this.Et}ms expired.`),this.Et),s=yield this.Gt(h),o=null,u=(0,y.Ut)();try{var l,a,c,d={method:e,body:n,headers:$P({},h.headers),signal:null===r||void 0===r?void 0:r.signal,priority:h.priority,keepalive:u},o=yield(null!=(v=this.Rt.networkOverrideFunc)?v:fetch)(s,d);if(clearTimeout(t),o.ok)return c=yield o.text(),_.Diagnostics.mark(),{body:c,code:o.status};throw l=yield o.text().catch(()=>"No Text"),(a=new Error(`NetworkError: ${s} `+l)).name="NetworkError",a}catch(t){n=function(t,e){if(null!=t&&t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return"Unknown Error"}(r,t);return _.Diagnostics.mark(),!i||i<=0?(null!=(f=this.B)&&f.call(this,{name:"error",error:t}),g.Log.error(`A networking error occured during ${e} request to ${s}.`,n,t),null):this.Pt($P($P({},h),{retries:i-1}))}})}Gt(n){return s(this,void 0,void 0,function*(){const e=$P({[u.NetworkParam.SdkKey]:n.sdkKey,[u.NetworkParam.SdkType]:l.SDKType.Y(n.sdkKey),[u.NetworkParam.SdkVersion]:h.SDK_VERSION,[u.NetworkParam.Time]:String(Date.now()),[u.NetworkParam.SessionID]:yield c.SessionID.get(n.sdkKey)},n.params);var t=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return n.url+(t?"?"+t:"")})}Nt(r){return s(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=r,n=yield d.StableID.get(e),i=yield c.SessionID.get(e),e=l.SDKType.Y(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}Ct(t,e){var n,i,r=(0,a.Lt)();if(!t.isStatsigEncodable||this.p.disableStatsigEncoding||null!=(0,o.i)("no-encode")||null==r||!r.btoa)return e;try{var s=null!=(n=r.btoa(e).split("").reverse().join(""))?n:e;return t.params=$P($P({},null!=(i=t.params)?i:{}),{[u.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return g.Log.warn("/initialize request encoding failed"),e}}};const b=t=>!!t.sdkKey||(g.Log.warn("Unable to make request without an SDK key"),!1)},405:(t,e)=>{$Q(e)},361:(t,e)=>{$Q(e)},902:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={Y:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},Kt(t,e){n[t]=e},Ft(t){i&&"-react"!==i||(i="-"+t)}}},830:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.At=i.qt=i.zt=i.Mt=i.Jt=i.Lt=void 0;i.Lt=()=>"undefined"!=typeof window?window:null,i.Jt=()=>{var t=(0,i.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Mt=()=>{var t;return null===(0,i.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},i.zt=(t,e)=>{var n=(0,i.Lt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.qt=(t,e)=>{var n=(0,i.Jt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.At=()=>{var t;try{return null==(t=(0,i.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},143:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(137),u=n(512),l=n(534),a=n(23),c=18e5,d=144e5,h={};function v(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,i.u)(t)}e.SessionID={get:t=>o(void 0,void 0,void 0,function*(){return e.StatsigSession.get(t).then(t=>t.data.sessionID)})},e.StatsigSession={get:s=>o(void 0,void 0,void 0,function*(){null==h[s]&&(h[s]=function(n){return o(this,void 0,void 0,function*(){let t=yield function(t){t=f(t);return(0,l.F)(t)}(n);var e=Date.now();return{data:t=t||{sessionID:(0,a.getUUID)(),startTime:e,lastUpdate:e},sdkKey:n}})}(s));var t=yield h[s],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>c}(n)||function({startTime:t}){return Date.now()-t>d}(n))&&(n.sessionID=(0,a.getUUID)(),n.startTime=e),n.lastUpdate=e,n),r=t.sdkKey;return r=f(r),(0,l.J)(r,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=v(n,c),t.ageTimeoutID=v(n,d-e),t}),overrideInitialSessionID:(t,e)=>{var n;h[e]=(t=t,e=e,n=Date.now(),Promise.resolve({data:{sessionID:t,startTime:n,lastUpdate:n},sdkKey:e}))}}},122:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StableID=void 0;const r=n(137),s=n(512),o=n(534),u=n(23),l={};function a(t){return"statsig.stable_id."+(0,r.u)(t)}function c(t,e){e=a(e);(0,o.J)(e,t).catch(()=>{s.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,o.F)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},375:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(845);const o=n(845),u=n(542),l=n(770),a=n(512),c=n(830),d=n(143),h=n(534);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Vt={};var r,s=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&h.Storage.Bt(!0),null!=i&&i.initialSessionID&&d.StatsigSession.overrideInitialSessionID(i.initialSessionID,t),this.S=t,this.p=null!=i?i:{},this.$t=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.Ht=new l.EventLogger(t,s,n,i),this.Wt=new u.ErrorBoundary(t,i,s),this.Wt.wrap(this),this.Wt.wrap(n),this.Wt.wrap(e),this.Wt.wrap(this.Ht),(0,c.Mt)()||(null!=(n=null!=(s=(r=(0,o.o)()).instances)?s:{})[t]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),n[t]=this,r.lastInstance=this,r.instances=n,__STATSIG__=r),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.Yt()}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,h.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Ht.shutdown()})}on(t,e){this.Vt[t]||(this.Vt[t]=[]),this.Vt[t].push(e)}off(t,e){this.Vt[t]&&-1!==(e=this.Vt[t].indexOf(e))&&this.Vt[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Vt[n.name]&&this.Vt[n.name].forEach(t=>e(t)),null!=(t=this.Vt["*"])&&t.forEach(e)}Qt(t,e){this.loadingStatus=t,this.$emt({name:"values_updated",status:t,values:e})}Xt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},636:(t,e)=>{$Q(e)},206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,r)=>({eventName:t,user:e,value:null,metadata:s(n,i),secondaryExposures:r,time:Date.now()});e.yt=({eventName:t})=>t===i||t===n,e.ee=(t,e)=>{return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.te=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Zt=(t,e,n)=>{var i,r=e.__evaluation,s=!0===(null==(s=null==r?void 0:r.explicit_parameters)?void 0:s.includes(n));let o="",u=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return s&&(o=null!=(i=r.allocated_experiment_name)?i:"",u=r.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(s)},u)};const s=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},0:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="1.3.1";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},586:(t,e)=>{$Q(e)},59:(t,e,n)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const s=n(634),r="default";function o(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,__evaluation:n,value:i}}function i(t,e,n){var i=null!=(i=null==n?void 0:n.value)?i:{};return $P($P({},o(t,e,n,i)),{get:u(null==n?void 0:n.value)})}function u(i,r){return(t,e)=>{var n=null!=(n=null==i?void 0:i[t])?n:null;return null!=n&&(null==e||(0,s.le)(n,e))?(null!=r&&r(t),n):null!=e?e:null}}e.ue=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.oe=i,e.re=function(t,e,n){return t=i(t,e,n),$P($P({},t),{groupName:null!=(e=null==n?void 0:n.group_name)?e:null})},e.se=function(t,e,n,i){return $P($P({},o(t,e,n,void 0)),{get:u(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.ne=function(t,e,n,i){return $P($P($P({},t),e),{get:u(n,i)})},e.ie=u},812:(t,e)=>{$Q(e)},578:(t,e,n)=>{$Q(e),e.v=e.A=void 0;const i=n(406),r=n(512);e.A=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){return r.Log.error("Failed to JSON.stringify user"),{}}},e.v=function(t){return t?(0,i.Dt)(t):null}},534:function(t,n,e){var i=this&&this.__awaiter||$A(),r=($Q2(n,"__esModule",{value:!0}),n.J=n.F=n.Storage=void 0,e(512)),e=e(830);const s={},o=t=>Promise.resolve(t),u={ae:()=>"InMemory",U:t=>s[t]||null,ce:t=>o(s[t]||null),L:(t,e)=>(s[t]=e,o()),q:t=>(delete s[t],o()),he:()=>o(Object.keys(s))};let l=null;try{const h=(0,e.Lt)();h&&h.localStorage&&"function"==typeof h.localStorage.getItem&&(l={ae:()=>"LocalStorage",U:t=>h.localStorage.getItem(t),ce:t=>o(h.localStorage.getItem(t)),L:(t,e)=>(h.localStorage.setItem(t,e),o()),q:t=>(h.localStorage.removeItem(t),o()),he:()=>o(Object.keys(h.localStorage))})}catch(t){r.Log.warn("Failed to setup localStorageProvider.")}let a=null!==l&&void 0!==l?l:u,c=a;function d(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.de(u),null;throw t}}n.Storage={ae:()=>c.ae(),ce:t=>i(void 0,void 0,void 0,function*(){return d(()=>c.ce(t))}),U:t=>d(()=>c.U?c.U(t):null),L:(t,e)=>c.L(t,e),q:t=>c.q(t),he:()=>c.he(),de:t=>{a=t,c=t},Bt:t=>{c=t?u:a}},n.F=function(e){return i(this,void 0,void 0,function*(){var t=yield n.Storage.ce(e);return JSON.parse(null!=t?t:"null")})},n.J=function(t,e){return i(this,void 0,void 0,function*(){yield n.Storage.L(t,JSON.stringify(e))})}},401:(t,e,n)=>{$Q(e),e.C=void 0;const r=n(512);e.C=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return r.Log.error("Failed to parse "+n),null}},634:(t,e)=>{$Q(e),e.le=e.kt=void 0,e.kt=function(t){return Array.isArray(t)?"array":typeof t},e.le=function(t,e){var n=t=>Array.isArray(t)?"array":typeof t;return n(t)===n(e)}},23:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},397:(t,e,n)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;n=n(830);const i="foreground",r="background",s=[];let o=i,u=!1;e.Ot=()=>o===i,e.Ut=()=>u,e.lt=t=>{s.unshift(t)};e.ve=e=>{e!==o&&(o=e,s.forEach(t=>t(e)))},(0,n.zt)("focus",()=>{(u=!1,e.ve)(i)}),(0,n.zt)("blur",()=>(0,e.ve)(r)),(0,n.zt)("beforeunload",()=>{u=!0,(0,e.ve)(r)}),(0,n.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?i:r)})},914:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,n(845);const s=n(770),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return s.EventLogger}}),n(512));$Q2(e,"Log",{enumerable:!0,get:function(){return o.Log}});var u=n(0);const l=n(534);$Q2(e,"Storage",{enumerable:!0,get:function(){return l.Storage}}),r(n(845),e),r(n(137),e),r(n(427),e),r(n(694),e),r(n(539),e),r(n(542),e),r(n(922),e),r(n(417),e),r(n(406),e),r(n(333),e),r(n(512),e),r(n(404),e),r(n(410),e),r(n(405),e),r(n(361),e),r(n(830),e),r(n(902),e),r(n(143),e),r(n(122),e),r(n(375),e),r(n(636),e),r(n(206),e),r(n(637),e),r(n(0),e),r(n(586),e),r(n(59),e),r(n(812),e),r(n(578),e),r(n(534),e),r(n(401),e),r(n(634),e),r(n(638),e),r(n(23),e),r(n(397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.Log,SDK_VERSION:u.SDK_VERSION})},16:(t,e,n)=>{$Q(e),e.AutoInit=void 0;const d=n(914),h=n(18);function v(t,e){var n;return null!=(n=e.get(t))?n:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,n,i;try{var r=(0,d.Lt)(),s=(0,d.Jt)();if(r&&s&&s.currentScript){var o=s.currentScript.getAttribute("src"),u=null==(t=r.location)?void 0:t.href;if(o&&u){var l=new URL(o,u).searchParams,a=null!=(n=v("sdkKey",l))?n:v("apiKey",l);if(a){var c=null==(i=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:i[a];let t=null;(t=c instanceof h.StatsigClient?c:t)||(t=new h.StatsigClient(a,function(){var t=(0,d.Lt)();if(!t)return{};let e=t.statsigUser||{};var n=(e="object"!=typeof e?{}:e).custom||{},i=e.customIDs||{};return $P($P({},e),{customIDs:$P({},i),custom:$P($P({},n),{useragent:t.navigator.userAgent,page_url:(0,d.At)()||"",language:null==(i=t.navigator)?void 0:i.language})})}())).initializeAsync().catch(t=>{d.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){d.Log.error("AutoInit failed",t)}}}},262:(t,e,n)=>{$Q(e),e.fe=void 0;const i=n(914);function r(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=function(t,e){var n;return(e=(0,i.C)(e,"checksum","DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),n.dynamic_configs)}),r((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,r(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,r(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.Dt)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs},2))===e.checksumV2?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},226:(t,e,n)=>{$Q(e);const i=n(914);e.default=class{constructor(){this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,i.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t){var e;t&&!0===(null==(e=(0,i.C)(t.data,"has_updates","EvaluationResponse"))?void 0:e.has_updates)&&(this._e=t.data,this.ye=e.time,this.me=t.receivedAt,this.be=t.source,this.ge=e)}getGate(t){var e;return this.pe(null==(e=this.ge)?void 0:e.feature_gates,t)}getConfig(t){var e;return this.pe(null==(e=this.ge)?void 0:e.dynamic_configs,t)}getLayer(t){var e;return this.pe(null==(e=this.ge)?void 0:e.layer_configs,t)}getParamStore(t){var e;return this.pe(null==(e=this.ge)?void 0:e.param_stores,t)}pe(t,e){let n=null;return{result:n=t?t[e]||t[(0,i.h)(e)]:n,details:this.Se(null==n)}}Se(t){return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:{reason:this.be+":"+(t?"Unrecognized":"Recognized"),lcut:this.ye,receivedAt:this.me}}}},448:function(t,e,n){var o=this&&this.__awaiter||$A();$Q(e);const u=n(914),l=n(262);class i extends u.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,u.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",u.NetworkDefault.initializeApi)}fetchEvaluations(n,i,r,s){return o(this,void 0,void 0,function*(){var t=i?(0,u.C)(i,"has_updates","InitializeResponse"):null;let e={user:s,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.je(n,t,e,r)})}je(e,n,i,r){var s;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:i,retries:2,isStatsigEncodable:!0,priority:r});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(s=null==t?void 0:t.body)?s:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(s=t.body)?void 0:s.includes('"is_delta":true'))||!0!==i.deltasResponseRequested?t.body:"string"==typeof(t=(0,l.fe)(n,t.body))?t:this.je(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}),r)})}}e.default=i},583:(t,e,n)=>{$Q(e),e.Te=void 0;const g=n(914),y={disableExposureLog:!0};function b(t){return null==t||!1===t.disableExposureLog}function m(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var n,i,r,s,o,u,l,a,c,d,h=f[t];if(null==h||null!=e&&(0,g.kt)(e)!==h.param_type)return e;switch(h.ref_type){case"static":return h.value;case"gate":return d=h,v.getFeatureGate(d.gate_name,b(_)?void 0:y).value?d.pass_value:d.fail_value;case"dynamic_config":return d=h,l=e,a=_,m(c=(u=v).getDynamicConfig(d.config_name,y).get(d.param_name),l)?l:(b(a)&&u.getDynamicConfig(d.config_name),c);case"experiment":return l=h,a=e,u=_,m(o=(c=v).getExperiment(l.experiment_name,y).get(l.param_name),a)?a:(b(u)&&c.getExperiment(l.experiment_name),o);case"layer":return o=h,i=e,r=_,m(s=(n=v).getLayer(o.layer_name,y).get(o.param_name),i)?i:(b(r)&&n.getLayer(o.layer_name).get(o.param_name),s);default:return e}}}},198:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const o=n(914),s=n(226),u=n(448),l=n(583),a=n(131);class i extends o.StatsigClientBase{static instance(t){var e=(0,o.o)().instance(t);return e instanceof i?e:(o.Log.warn((0,o.Mt)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){o.SDKType.Kt(t,"javascript-client");var i=new u.default(n,t=>{this.$emt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new a.StatsigEvaluationsDataAdapter,i,n),this.we=new s.default,this.Ie=e}initializeSync(){this.updateUserSync(this.Ie)}initializeAsync(t){return this.updateUserAsync(this.Ie,t)}updateUserSync(t){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie);this.we.setValues(t),this.Me(t),this.xe(null!=t?t:null,this.Ie)}updateUserAsync(n,i){return r(this,void 0,void 0,function*(){this.Ae(n);var t=this.Ie,e=this.dataAdapter.getDataSync(t);this.Qt("Loading",e),this.we.setValues(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.Ie&&(this.we.setValues(e),this.Me(e))})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt}}getAsyncContext(){return r(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{session:yield o.StatsigSession.get(this.S),stableID:yield o.StableID.get(this.S)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:n,details:i}=this.we.getGate(t),i=(0,o.ue)(t,i,n),r=null==(r=null==(n=this.$t)?void 0:n.getGateOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.ee)(this.Ie,n),e),this.$emt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){var{result:n,details:i}=this.we.getConfig(t),i=(0,o.oe)(t,i,n),r=null==(r=null==(n=this.$t)?void 0:n.getDynamicConfigOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.te)(this.Ie,n),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:n}),n}getExperiment(t,e){var{result:n,details:i}=this.we.getConfig(t),i=(0,o.re)(t,i,n),r=null==(r=null==(n=this.$t)?void 0:n.getExperimentOverride)?void 0:r.call(n,i,this.Ie,e),n=null!=r?r:i;return this.Xt(t,(0,o.te)(this.Ie,n),e),this.$emt({name:"experiment_evaluation",experiment:n}),n}getLayer(e,n){var{result:t,details:i}=this.we.getLayer(e),i=(0,o.se)(e,i,t),r=null==(r=null==(t=this.$t)?void 0:t.getLayerOverride)?void 0:r.call(t,i,this.Ie,n);const s=(0,o.ne)(i,r,null!=(t=null==r?void 0:r.__value)?t:i.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,s,t),n)});return this.$emt({name:"layer_evaluation",layer:s}),s}getParameterStore(t,e){var{result:n,details:i}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:i,__configuration:n,get:(0,l.Te)(this,n,e)}}logEvent(t,e,n){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Me(t){this.we.finalize(),this.Qt("Ready",t)}xe(t,e){this.dataAdapter.getDataAsync(t,e,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}Ae(t){this.Ht.reset(),this.we.reset(),this.Ie=(0,o.A)(t,this.p.environment);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=i},131:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const i=n(914),r=n(448);class o extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.X=null,this.p=null}attach(t,e){super.attach(t,e),this.X=new r.default(null!=e?e:{})}getDataAsync(t,e,n){return this.M(t,e,n)}prefetchData(t,e){return this.k(t,e)}setData(t){var e=(0,i.C)(t,"has_updates","data");e&&"user"in e?super.setData(t,e.user):i.Log.error("StatsigUser not found")}setDataLegacy(t,e){super.setData(t,e)}N(e,n,i){var r;return s(this,void 0,void 0,function*(){var t=yield null==(r=this.X)?void 0:r.fetchEvaluations(this.P(),e,null==i?void 0:i.priority,n);return null!=t?t:null})}T(t){t=(0,i.u)(this.P(),t,null==(t=this.p)?void 0:t.customUserCacheKeyFunc);return`${i.DataAdapterCachePrefix}.${this.m}.`+t}R(t,e){return null!=t.fullUserHash&&t.fullUserHash===(0,i.v)(e)}}e.StatsigEvaluationsDataAdapter=o},18:(t,e,n)=>{$Q(e),e.StatsigClient=void 0;n=n(198);e.StatsigClient=n.default,__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:n.default}),e.default=__STATSIG__},535:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const o=n(914),r=n(325),s=n(901);e.runStatsigAutoCapture=function(t){return new u(t)};class u{constructor(t){this.De=t,this.We=Date.now(),this.Ye=0;var e,{sdkKey:t,errorBoundary:n}=t.getContext(),n=(this.Wt=n,this.Wt.wrap(this),(0,o.Jt)());(0,o.Mt)()||((e=null!=(e=(__STATSIG__=(0,o.o)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.Qe()):this.Qe()}Xe(){const e=(0,o.Lt)();var t,n=(0,o.Jt)();e&&n&&(t=t=>{this.Ze(t||e.event)},(0,r.ti)(n,"click",t),(0,r.ti)(n,"submit",t),(0,r.ti)(e,"error",t),(0,r.ti)(e,"beforeunload",()=>this.ei()),(0,r.ti)(e,"scroll",()=>this.ii()))}Ze(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.ni(t):(e=(0,r.si)(t))&&(0,r.dt)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,r.ri)(e),this.oi(n,t,e))}Qe(){this.Xe(),this.ui(),this.li(),this.ai()}ni(t){var e=(null==t?void 0:t.error)||{};let n=e;if("object"==typeof e)try{n=JSON.stringify(e)}catch(t){n="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.oi("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}ui(){this.ci().then(t=>{this.hi(t)&&this.oi("session_start",(0,r.di)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}).catch(t=>{this.Wt.logError("AC::logSession",t)})}li(){setTimeout(()=>{var t=(0,r.vi)(),t=(0,s.fi)(t);this.oi("page_view",(0,r.di)(),t,{flushImmediately:!0,addNewSessionMetadata:!0})},1)}ai(){const n=(0,o.Lt)();void 0!==(null===n||void 0===n?void 0:n.performance)&&"function"==typeof n.performance.getEntriesByType&&"function"==typeof n.performance.getEntriesByName&&setTimeout(()=>{var t={},e=n.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),n.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.oi("performance",(0,r.di)(),t)},1)}ei(){this.oi("page_view_end",(0,r.di)(),{scrollDepth:this.Ye,pageViewLength:Date.now()-this.We},{flushImmediately:!0})}oi(n,i,r,s){this.ci().then(t=>{var e=$P({sessionID:t.data.sessionID,page_url:null!=(e=null==(e=null==(e=(0,o.Lt)())?void 0:e.location)?void 0:e.href)?e:""},r),t=(null!=s&&s.addNewSessionMetadata&&(e.isNewSession=String(this.hi(t))),{eventName:"auto_capture::"+n,value:i,metadata:e});this.De.logEvent(t),null!=s&&s.flushImmediately&&this.De.flush().catch(t=>{o.Log.error(t)})}).catch(t=>{this.Wt.logError("AC::enqueue",t)})}ii(){var t=null!=(t=null==(t=(0,o.Jt)())?void 0:t.body.scrollHeight)?t:1,e=(0,o.Lt)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ye=Math.max(this.Ye,Math.min(100,Math.round((n+e)/t*100)))}hi(t){return Math.abs(t.data.startTime-Date.now())<1e3}ci(){return i(this,void 0,void 0,function*(){return(yield this.De.getAsyncContext()).session})}}e.AutoCapture=u},325:(t,e,n)=>{$Q(e),e.ti=e.di=e.vi=e.dt=e.si=e.ri=void 0;const s=n(914);function o(e){if(e){let t=e;for(;t;){var n=t.tagName.toLowerCase();if(["body","document"].includes(n))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.ri=function(t){var e=t.tagName.toLowerCase(),n={},i=(0,s.At)()||"",r=("form"===(n.tagName=e)&&(n.action=t.getAttribute("action"),n.method=null!=(r=t.getAttribute("method"))?r:"GET",n.formName=t.getAttribute("name"),n.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(n.content=t.value,n.inputName=t.getAttribute("name")),o(t));return r&&(n.href=r.getAttribute("href")),"button"!==e&&!r||(n.content=(t.textContent||"").trim()),{value:i,metadata:n}},e.si=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.dt=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var n=e.tagName.toLowerCase(),i=t.type.toLowerCase();switch(n){case"html":return!1;case"form":return"submit"===i;case"input":case"select":case"textarea":return["change"].includes(i);default:if("click"===i){if("button"===n)return!0;if(o(e))return!0}return!1}},e.vi=function(){var t=null!=(t=null==(t=null==(t=(0,s.Lt)())?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.di=function(){return(0,s.At)()||""},e.ti=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},964:(t,e,n)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(535);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),$Q2(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return i.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture,runStatsigAutoCapture:i.runStatsigAutoCapture}),e.default=__STATSIG__},901:(t,e,n)=>{$Q(e),e.fi=void 0;const a=n(914);e.fi=function(t){var e=(0,a.Jt)(),n=(0,a.Lt)();if(!e||!n)return{};var i=null==n?void 0:n.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,o=function(t){const e=t.hostname,n=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return n||""}(u),u=u.searchParams.get("yahoo"===o?"p":"q")||"";var o={searchEngine:o,searchQuery:u},u=function(t){const n=t.searchParams,i={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","gclsrc","dclid","fbclid","msclkid","mc_eid","mc_cid","twclid","li_fat_id","igshid","utm_id","ttc","ttclid","ttc_id"].forEach(t=>{var e=n.get(t);e&&(i[t]=e)}),i}(t);const l={};return t.searchParams.forEach((t,e)=>{l[e]=t}),$P($P($P($P({},o),u),l),{title:(null==e?void 0:e.title)||"",locale:(null==i?void 0:i.language)||"unknown",referrer:r,screen_width:(null==(t=null==n?void 0:n.screen)?void 0:t.width)||"unknown",screen_height:(null==(o=null==n?void 0:n.screen)?void 0:o.height)||"unknown",viewport_width:(null==n?void 0:n.innerWidth)||"unknown",viewport_height:(null==n?void 0:n.innerHeight)||"unknown"})}}},i={};function r(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,r)),e.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var t={};{var e=t;const o=r(964);var s=r(16);e.default=__STATSIG__,s.AutoInit.attempt(({client:t})=>{new o.AutoCapture(t)})}return t.default})());
{
"name": "@statsig/js-client",
"version": "1.3.0",
"version": "1.3.1",
"dependencies": {
"@statsig/client-core": "1.3.0"
"@statsig/client-core": "1.3.1"
},

@@ -11,2 +11,2 @@ "jsdelivr": "./build/statsig-js-client.min.js",

"typings": "./src/index.d.ts"
}
}

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

const client_core_1 = require("@statsig/client-core");
const MAX_DELTAS_SORT_DEPTH = 2;
function _resolveDeltasResponse(cache, deltasString) {

@@ -19,4 +20,4 @@ const deltas = (0, client_core_1._typedJsonParse)(deltasString, 'checksum', 'DeltasEvaluationResponse');

layer_configs: resolved.layer_configs,
});
const isMatch = actualChecksum === deltas.checksum;
}, MAX_DELTAS_SORT_DEPTH);
const isMatch = actualChecksum === deltas.checksumV2;
if (!isMatch) {

@@ -23,0 +24,0 @@ return {

@@ -54,3 +54,4 @@ "use strict";

if ((cache === null || cache === void 0 ? void 0 : cache.has_updates) !== true ||
((_b = response.body) === null || _b === void 0 ? void 0 : _b.includes('"is_delta":true')) !== true) {
((_b = response.body) === null || _b === void 0 ? void 0 : _b.includes('"is_delta":true')) !== true ||
data.deltasResponseRequested !== true) {
return response.body;

@@ -57,0 +58,0 @@ }

@@ -31,5 +31,5 @@ "use strict";

}
client_core_1.Log.warn((0, client_core_1._isBrowserEnv)()
? 'Unable to find StatsigClient instance'
: 'StatsigClient.instance is not supported in server environments');
client_core_1.Log.warn((0, client_core_1._isServerEnv)()
? 'StatsigClient.instance is not supported in server environments'
: 'Unable to find StatsigClient instance');
return new StatsigClient(sdkKey !== null && sdkKey !== void 0 ? sdkKey : '', {});

@@ -36,0 +36,0 @@ }

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc