@statsig/js-client
Advanced tools
Comparing version 3.1.0 to 3.2.0-beta.1
@@ -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={845:(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},137:(t,e,i)=>{$Q(e),e.u=e.l=void 0;const s=i(406);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)}},427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=i(512),a=i(122),r=i(578),o=i(534),c=i(401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,r.v)(n)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.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 t=t&&(0,r.A)(t,this.p),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,this.p),i=this.T(e);this.j.add(i,h("Bootstrap",t,null,e))}M(e,i,n){return s(this,void 0,void 0,function*(){o.Storage.isReady()||(yield o.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.D(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)})}k(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.A)(i,this.p),e=this.T(t),t=yield this.M(null,t,n);t&&this.j.add(e,$P($P({},t),{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 i=(0,c.C)(e,"has_updates","Response"),n=this.P(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,o);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,o)}e=this.T(o);return this.j.add(e,s),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.getItem)?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){o.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,o.F)(this.O))?e:{},t=(e[t]=Date.now(),u(e,10));t&&(delete e[t],o.Storage.removeItem(t)),(0,o.J)(this.O,e)}};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})}},962:(t,r)=>{$Q2(r,"__esModule",{value:!0}),r.Diagnostics=void 0;const n=new Map,i="start";function s(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function o(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}r.Diagnostics={_n:t=>n.get(t),gn:t=>{o(t,s({},i,"overall"))},mn:(t,e,i)=>{o(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},bn:(t,e)=>{o(t,s(e,i,"initialize","network_request"))},pn:(t,e)=>{o(t,s(e,"end","initialize","network_request"))},yn:t=>{o(t,s({},i,"initialize","process"))},On:(t,e)=>{o(t,s(e,"end","initialize","process"))},jn:t=>{n.delete(t)},Sn(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},wn(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:r.Diagnostics.Sn(n)}},Tn(t,e,i,n){var s=r.Diagnostics._n(i);null==s||s.length<=0||(r.Diagnostics.jn(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:s.slice(),statsigOptions:n}),e.enqueue(i))}}},539:(t,e)=>{$Q(e)},542: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(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,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){}}}},922:(t,e)=>{$Q(e)},417:(t,e)=>{$Q(e)},770:function(t,e,i){var n,s=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=i(137),o=i(406),u=i(512),l=i(410),a=i(830),c=i(637),h=i(534),d=i(638),v=i(397),f={};(i=n=n||{})[i.Startup=0]="Startup",i[i.GainedFocus=1]="GainedFocus";class _{static wi(t){null!=(t=f[t])&&t.flush().catch(()=>{})}static Ti(t){null!=(t=f[t])&&t.ct(n.GainedFocus)}constructor(t,e,i,n){this.S=t,this.B=e,this.X=i,this.p=n,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==n?void 0:n.disableLogging),this.rt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.ot=(0,d.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",l.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&_.wi(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,a.Mt)()||(f[this.S]=this,(0,v.lt)(t=>{"background"===t?_.wi(this.S):"foreground"===t&&_.Ti(this.S)}),this.ct(n.Startup),this.ht())}stop(){return s(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),yield this.flush()})}flush(){return s(this,void 0,void 0,function*(){var t;this.gt(),0!==this.Z.length&&(t=this.Z,this.Z=[],yield this.bt(t))})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>_.wi(this.S),200)}dt(t){if((0,a.Mt)())return!1;if((0,c.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,r.l)(this.S,e),i=t.metadata||{},t=[t.eventName,e,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 s(this,void 0,void 0,function*(){if(this.st)return this.St(t),!1;try{return(!(0,v.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}),!0):(u.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return u.Log.warn("Failed to flush events."),!1}})}Tt(e){var i;return s(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 s(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:{[l.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,h.J)(e,t)}catch(t){u.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.u();s(this,void 0,void 0,function*(){h.Storage.isReady()||(yield h.Storage.isReadyResolver());var t=(0,h.F)(i);t&&(e===n.Startup&&h.Storage.removeItem(i),yield this.bt(t))&&e===n.GainedFocus&&h.Storage.removeItem(i)}).catch(()=>{u.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,o.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));u.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,a.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{f[this.S]._t!==e?clearInterval(e):_.wi(this.S)},t);this._t=e}}e.EventLogger=_},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 i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},r.Dt=(t,e)=>(0,r.h)(JSON.stringify((0,r.xt)(t,e)));r.xt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const s={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,o.kt)(e)?s[t]=e:s[t]=(0,r.xt)(e,null!=n?n-1:n)}),s}},333:(t,e)=>{$Q(e)},512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}var n,s;(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(" INFO ",...i(t))}static debug(...t){this.level>=n.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){this.level>=n.Warn&&console.warn(" WARN ",...i(t))}static error(...t){this.level>=n.Error&&console.error(" ERROR ",...i(t))}}(e.Log=r).level=n.Warn},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,i){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(845);const o=i(845),b=i(962),p=i(512),u=i(410),l=i(902),a=i(830),c=i(143),h=i(122),d=i(0),y=i(397),m=new Set([408,500,502,503,504,522,524,599]);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(n){return r(this,void 0,void 0,function*(){var t,e,i;return!!O(n)&&(t=yield this.Nt(n),e=yield this.Gt(n),(i=navigator).sendBeacon.bind(i)(e,t))})}Pt(f){var _,g;return r(this,void 0,void 0,function*(){if(!O(f))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:s}=f,s=null!=s?s:1;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),o=yield this.Gt(f);let u=null;var l=(0,y.Ut)();try{var a,c,h,d={method:e,body:i,headers:$P({},f.headers),signal:null===r||void 0===r?void 0:r.signal,priority:f.priority,keepalive:l},v=(f.isInitialize&&b.Diagnostics.bn(f.sdkKey,{attempt:s}),null!=(_=this.Rt.networkOverrideFunc)?_:fetch);if(u=yield v(o,d),clearTimeout(t),u.ok)return h=yield u.text(),f.isInitialize&&b.Diagnostics.pn(f.sdkKey,b.Diagnostics.wn(u,s,h)),{body:h,code:u.status};throw a=yield u.text().catch(()=>"No Text"),(c=new Error(`NetworkError: ${o} `+a)).name="NetworkError",c}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"}(r,t);return f.isInitialize&&b.Diagnostics.pn(f.sdkKey,b.Diagnostics.wn(u,s,"",t)),!n||n<s||!m.has(null!=(g=null===u||void 0===u?void 0:u.status)?g:500)?(null!=(g=this.B)&&g.call(this,{name:"error",error:t}),p.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.Pt($P($P({},f),{retries:n,attempt:s+1}))}})}Gt(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]:d.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:"")})}Nt(s){return r(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=h.StableID.get(e),n=c.SessionID.get(e),e=l.SDKType.Y(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:e})}))})}Ct(t,e){var i,n,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!=(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 p.Log.warn("/initialize request encoding failed"),e}}};const O=t=>!!t.sdkKey||(p.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 i={};let n;e.SDKType={Y:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},Kt(t,e){i[t]=e},Ft(t){n&&"-react"!==n||(n="-"+t)}}},830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.At=n.qt=n.zt=n.Mt=n.Jt=n.Lt=void 0;n.Lt=()=>"undefined"!=typeof window?window:null,n.Jt=()=>{var t=(0,n.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>{var t;return null===(0,n.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.zt=(t,e)=>{var i=(0,n.Lt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.qt=(t,e)=>{var i=(0,n.Jt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.At=()=>{var t;try{return null==(t=(0,n.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(137),r=i(512),o=i(534),u=i(23),l=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,n.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,u.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>l}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,u.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,o.J)(s,n)}catch(t){r.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=h(i,l),t.ageTimeoutID=h(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(137),s=i(512),r=i(534),o=i(23),u={};function l(t){return"statsig.stable_id."+(0,n.u)(t)}function a(t,e){e=l(e);try{(0,r.J)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==u[e]){let t=function(t){t=l(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),u[e]=t}return u[e]},setOverride:(t,e)=>{a(u[e]=t,e)}}},375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(845);const o=i(845),u=i(542),l=i(770),a=i(512),c=i(830),h=i(143),d=i(534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.Vt={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage.Bt(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.de(n.storageProvider),this.S=t,this.p=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Ht=new l.EventLogger(t,r,i,n),this.Wt=new u.ErrorBoundary(t,n,r),this.Wt.wrap(this),this.Wt.wrap(i),this.Wt.wrap(e),this.Wt.wrap(this.Ht),(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.storageProvider=d.Storage,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,d.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Ht.stop()})}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(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Vt[i.name]&&this.Vt[i.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,i){!0===(null==i?void 0:i.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 i="statsig::config_exposure",n="statsig::gate_exposure",l=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:r(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===n||t===i,e.ee=(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.te=(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.Zt=(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)},0:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.1.0";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e)},59:(t,e,i)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const r=i(634),s="default";function o(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({},o(t,e,i,n)),{get:u(null==i?void 0:i.value)})}function u(n,s){return(t,e)=>{var i=null!=(i=null==n?void 0:n[t])?i:null;return null!=i&&(null==e||(0,r.le)(i,e))?(null!=s&&s(t),i):null!=e?e:null}}e.ue=function(t,e,i){return o(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({},o(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=u},812:(t,e)=>{$Q(e)},578:(t,e,i)=>{$Q(e),e.v=e.A=void 0;const n=i(406),s=i(512);e.A=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(i.statsigEnvironment=e.environment),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Dt)(t):null}},534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.J=i.F=i.Storage=void 0;var n=e(512),e=e(830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==o&&void 0!==o?o:r,l=u;i.Storage={isReady:()=>l.isReady(),isReadyResolver:()=>l.isReadyResolver(),getProviderName:()=>l.getProviderName(),getItem:t=>{var e=()=>l.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.de(r),null;throw t}},setItem:(t,e)=>l.setItem(t,e),removeItem:t=>l.removeItem(t),getAllKeys:()=>l.getAllKeys(),de:t=>{u=t,l=t},Bt:t=>{l=t?r:u}},i.F=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.J=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},401:(t,e,i)=>{$Q(e),e.C=void 0;const s=i(512);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}},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 i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(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 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)})}},638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},397:(t,e,i)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;i=i(830);const n="foreground",s="background",r=[];let o=n,u=!1;e.Ot=()=>o===n,e.Ut=()=>u,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==o&&(o=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(u=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{u=!0,(0,e.ve)(s)}),(0,i.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?n:s)})},914: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.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,i(845);const r=i(962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(770)),u=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(512));$Q2(e,"Log",{enumerable:!0,get:function(){return u.Log}});var l=i(0);const a=i(534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),s(i(845),e),s(i(137),e),s(i(427),e),s(i(694),e),s(i(962),e),s(i(539),e),s(i(542),e),s(i(922),e),s(i(417),e),s(i(406),e),s(i(333),e),s(i(512),e),s(i(404),e),s(i(410),e),s(i(405),e),s(i(361),e),s(i(830),e),s(i(902),e),s(i(143),e),s(i(122),e),s(i(375),e),s(i(636),e),s(i(206),e),s(i(637),e),s(i(0),e),s(i(586),e),s(i(59),e),s(i(812),e),s(i(578),e),s(i(534),e),s(i(401),e),s(i(634),e),s(i(638),e),s(i(23),e),s(i(397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:u.Log,SDK_VERSION:l.SDK_VERSION})},296: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(18),e),e.default=__STATSIG__},262:(t,e,i)=>{$Q(e),e.fe=void 0;const n=i(914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=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.Dt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},226:(t,e,i)=>{$Q(e);const s=i(914);e.default=class{constructor(t){this.S=t,this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0,this.bi=null,this.mi=new Set}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0,this.bi=null}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,s.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==i?void 0:i.has_updates)&&(this._e=t.data,this.ye=i.time,this.me=t.receivedAt,this.ge=i,this.bi=this.pi(t.source,i),t.source)&&i.user&&this.yi(e,i),!0)}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)}pi(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}pe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Se(null==i)}}yi(t,e){var i,n=s.StableID.get(this.S);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.mi.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.mi.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:(t={reason:this.be,lcut:this.ye,receivedAt:this.me},0<this.mi.size&&(t.warnings=Array.from(this.mi)),t)}Se(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.be&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.be&&null!=(n=this.bi)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},448:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e);const u=i(914),l=i(262);class n 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(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.je(i,t,e,s)})}je(e,i,n,s){var r;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:n,retries:2,isStatsigEncodable:!0,priority:s,isInitialize:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(r=null==t?void 0:t.body)?r:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,l.fe)(i,t.body))?t:this.je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},583:(t,e,i)=>{$Q(e),e.Te=void 0;const g=i(914),b={disableExposureLog:!0};function p(t){return null==t||!1===t.disableExposureLog}function y(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,o,u,l,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.kt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,p(_)?void 0:b).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,l=e,a=_,y(c=(u=v).getDynamicConfig(h.config_name,b).get(h.param_name),l)?l:(p(a)&&u.getDynamicConfig(h.config_name),c);case"experiment":return l=d,a=e,u=_,y(o=(c=v).getExperiment(l.experiment_name,b).get(l.param_name),a)?a:(p(u)&&c.getExperiment(l.experiment_name),o);case"layer":return o=d,n=e,s=_,y(r=(i=v).getLayer(o.layer_name,b).get(o.param_name),n)?n:(p(s)&&i.getLayer(o.layer_name).get(o.param_name),r);default:return e}}}},198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const o=i(914),r=i(226),u=i(448),l=i(583),a=i(131);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)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){o.SDKType.Kt(t,"javascript-client");var n,s=new u.default(i,t=>{this.$emt(t)});super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,s,i),this.xn=null,this.we=new r.default(t),this.Ie=(0,o.A)(e,i)}initializeSync(t){"Uninitialized"===this.loadingStatus&&(this.Ht.start(),this.updateUserSync(this.Ie,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.xn||(this.xn=this.Dn(t)),this.xn})}updateUserSync(t,e){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie),this.we.setValues(t,this.Ie),this.Me(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.xe(null!=t?t:null,this.Ie)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Ae(i);var t=this.Ie,e=(o.Diagnostics.gn(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e,this.Ie),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),o.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),o.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.Tn(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.we.getGate(t),n=(0,o.ue)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.ee)(this.Ie,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.oe)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.re)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.we.getLayer(e),n=(0,o.se)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.Ie,i);const r=(0,o.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}getParameterStore(t,e){var{result:i,details:n}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,l.Te)(this,i,e)}}logEvent(t,e,i){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Dn(t){return s(this,void 0,void 0,function*(){return o.Storage.isReady()||(yield o.Storage.isReadyResolver()),this.Ht.start(),this.updateUserAsync(this.Ie,t)})}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);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=n},131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(914),s=i(448);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,(0,n.A)(e,this.p),i)}prefetchData(t,e){return this.k(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. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}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},18:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.StatsigClient=void 0,i(198));e.StatsigClient=r.default,s(i(914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:r.default}),e.default=__STATSIG__}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[t].call(e.exports,e,e.exports,s)),e.exports}return s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s(296).default})()); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((t,r,u,l)=>{return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})});var i={845:(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},137:(t,e,i)=>{$Q(e),e.u=e.l=void 0;const s=i(406);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)}},427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=i(512),a=i(122),r=i(578),o=i(534),c=i(401);function h(t,e,i,n){return{source:t,data:e,receivedAt:Date.now(),stableID:i,fullUserHash:(0,r.v)(n)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.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 t=t&&(0,r.A)(t,this.p),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,this.p),i=this.T(e);this.j.add(i,h("Bootstrap",t,null,e))}M(e,i,n){return s(this,void 0,void 0,function*(){o.Storage.isReady()||(yield o.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.D(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)})}k(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.A)(i,this.p),e=this.T(t),t=yield this.M(null,t,n);t&&this.j.add(e,$P($P({},t),{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 i=(0,c.C)(e,"has_updates","Response"),n=this.P(),n=a.StableID.get(n);let s=null;if(!0===(null==i?void 0:i.has_updates))s=h("Network",e,n,o);else{if(!t||!1!==(null==i?void 0:i.has_updates))return null;s=h("NetworkNotModified",t,n,o)}e=this.T(o);return this.j.add(e,s),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.getItem)?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){o.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,o.F)(this.O))?e:{},t=(e[t]=Date.now(),u(e,10));t&&(delete e[t],o.Storage.removeItem(t)),(0,o.J)(this.O,e)}};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})}},962:(t,r)=>{$Q2(r,"__esModule",{value:!0}),r.Diagnostics=void 0;const n=new Map,i="start";function s(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function o(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}r.Diagnostics={_n:t=>n.get(t),gn:t=>{o(t,s({},i,"overall"))},mn:(t,e,i)=>{o(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},bn:(t,e)=>{o(t,s(e,i,"initialize","network_request"))},pn:(t,e)=>{o(t,s(e,"end","initialize","network_request"))},yn:t=>{o(t,s({},i,"initialize","process"))},On:(t,e)=>{o(t,s(e,"end","initialize","process"))},jn:t=>{n.delete(t)},Sn(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},wn(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:r.Diagnostics.Sn(n)}},Tn(t,e,i,n){var s=r.Diagnostics._n(i);null==s||s.length<=0||(r.Diagnostics.jn(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:s.slice(),statsigOptions:n}),e.enqueue(i))}}},539:(t,e)=>{$Q(e)},542: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(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,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){}}}},922:(t,e)=>{$Q(e)},417:(t,e)=>{$Q(e)},770:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(137),r=i(406),o=i(512),u=i(410),l=i(830),a=i(637),c=i(534),h=i(638),d=i(397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static wi(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static Ti(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.S=t,this.B=e,this.X=i,this.p=n,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==n?void 0:n.disableLogging),this.rt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.ot=(0,h.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",u.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&_.wi(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,l.Mt)()||(v[this.S]=this,(0,d.lt)(t=>{"background"===t?_.wi(this.S):"foreground"===t&&_.Ti(this.S)}),this.ct(f.Startup),this.ht())}stop(){return n(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),delete v[this.S],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.gt(),0!==this.Z.length&&(t=this.Z,this.Z=[],yield this.bt(t))})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>_.wi(this.S),200)}dt(t){if((0,l.Mt)())return!1;if((0,a.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.l)(this.S,e),i=t.metadata||{},t=[t.eventName,e,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)return this.St(t),!1;try{return(!(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}),!0):(o.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return o.Log.warn("Failed to flush events."),!1}})}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:{[u.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,c.J)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.u();n(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.F)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.bt(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{o.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={},i=this.It(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));o.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,l.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.S]._t!==e?clearInterval(e):_.wi(this.S)},t);this._t=e}}e.EventLogger=_},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 i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},r.Dt=(t,e)=>(0,r.h)(JSON.stringify((0,r.xt)(t,e)));r.xt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const s={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,o.kt)(e)?s[t]=e:s[t]=(0,r.xt)(e,null!=n?n-1:n)}),s}},333:(t,e)=>{$Q(e)},512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...t){this.level>=e.LogLevel.Info&&console.info(" INFO ",...i(t))}static debug(...t){this.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){this.level>=e.LogLevel.Warn&&console.warn(" WARN ",...i(t))}static error(...t){this.level>=e.LogLevel.Error&&console.error(" ERROR ",...i(t))}}(e.Log=n).level=e.LogLevel.Warn},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,i){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(845);const o=i(845),b=i(962),p=i(512),u=i(410),l=i(902),a=i(830),c=i(143),h=i(122),d=i(0),y=i(397),m=new Set([408,500,502,503,504,522,524,599]);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(n){return r(this,void 0,void 0,function*(){var t,e,i;return!!O(n)&&(t=yield this.Nt(n),e=yield this.Gt(n),(i=navigator).sendBeacon.bind(i)(e,t))})}Pt(f){var _,g;return r(this,void 0,void 0,function*(){if(!O(f))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:s}=f,s=null!=s?s:1;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),o=yield this.Gt(f);let u=null;var l=(0,y.Ut)();try{var a,c,h,d={method:e,body:i,headers:$P({},f.headers),signal:null===r||void 0===r?void 0:r.signal,priority:f.priority,keepalive:l},v=(f.isInitialize&&b.Diagnostics.bn(f.sdkKey,{attempt:s}),null!=(_=this.Rt.networkOverrideFunc)?_:fetch);if(u=yield v(o,d),clearTimeout(t),u.ok)return h=yield u.text(),f.isInitialize&&b.Diagnostics.pn(f.sdkKey,b.Diagnostics.wn(u,s,h)),{body:h,code:u.status};throw a=yield u.text().catch(()=>"No Text"),(c=new Error(`NetworkError: ${o} `+a)).name="NetworkError",c}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"}(r,t);return f.isInitialize&&b.Diagnostics.pn(f.sdkKey,b.Diagnostics.wn(u,s,"",t)),!n||n<s||!m.has(null!=(g=null===u||void 0===u?void 0:u.status)?g:500)?(null!=(g=this.B)&&g.call(this,{name:"error",error:t}),p.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.Pt($P($P({},f),{retries:n,attempt:s+1}))}})}Gt(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]:d.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:"")})}Nt(s){return r(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=h.StableID.get(e),n=c.SessionID.get(e),e=l.SDKType.Y(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},d.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:e})}))})}Ct(t,e){var i,n,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!=(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 p.Log.warn("/initialize request encoding failed"),e}}};const O=t=>!!t.sdkKey||(p.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 i={};let n;e.SDKType={Y:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},Kt(t,e){i[t]=e},Ft(t){n&&"-react"!==n||(n="-"+t)}}},830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.At=n.qt=n.zt=n.Mt=n.Jt=n.Lt=void 0;n.Lt=()=>"undefined"!=typeof window?window:null,n.Jt=()=>{var t=(0,n.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>{var t;return null===(0,n.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.zt=(t,e)=>{var i=(0,n.Lt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.qt=(t,e)=>{var i=(0,n.Jt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.At=()=>{var t;try{return null==(t=(0,n.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(137),r=i(512),o=i(534),u=i(23),l=18e5,a=144e5,c={};function h(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function d(t){return"statsig.session_id."+(0,n.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,u.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>l}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,u.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=d(s);try{(0,o.J)(s,n)}catch(t){r.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=h(i,l),t.ageTimeoutID=h(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(137),s=i(512),r=i(534),o=i(23),u={};function l(t){return"statsig.stable_id."+(0,n.u)(t)}function a(t,e){e=l(e);try{(0,r.J)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==u[e]){let t=function(t){t=l(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),u[e]=t}return u[e]},setOverride:(t,e)=>{a(u[e]=t,e)}}},375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(845);const o=i(845),u=i(542),l=i(770),a=i(512),c=i(830),h=i(143),d=i(534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.xn=null,this.Vt={};var s,r=this.$emt.bind(this);null!=(null==n?void 0:n.logLevel)&&(a.Log.level=n.logLevel),null!=n&&n.disableStorage&&d.Storage.Bt(!0),null!=n&&n.initialSessionID&&h.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&d.Storage.de(n.storageProvider),this.S=t,this.p=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Ht=new l.EventLogger(t,r,i,n),this.Wt=new u.ErrorBoundary(t,n,r),this.Wt.wrap(this),this.Wt.wrap(i),this.Wt.wrap(e),this.Wt.wrap(this.Ht),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=d.Storage,this.Yt(),s=t,r=this,(0,c.Mt)()||(i=(0,o.o)(),e=null!=(e=i.instances)?e:{},r=r,null!=e[s]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[s]=r,i.lastInstance=r,i.instances=e,__STATSIG__=i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.p.disableLogging=t.disableLogging,this.Ht.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.p.disableStorage=t.disableStorage,d.Storage.Bt(t.disableStorage))}flush(){return this.Ht.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.Qt("Uninitialized",null),this.xn=null,yield this.Ht.stop()})}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(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Vt[i.name]&&this.Vt[i.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,i){!0===(null==i?void 0:i.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 i="statsig::config_exposure",n="statsig::gate_exposure",l=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:r(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===n||t===i,e.ee=(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.te=(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.Zt=(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)},0:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.2.0-beta.1";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e)},98:(t,e)=>{$Q(e)},59:(t,e,i)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const r=i(634),s="default";function o(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({},o(t,e,i,n)),{get:u(null==i?void 0:i.value)})}function u(n,s){return(t,e)=>{var i=null!=(i=null==n?void 0:n[t])?i:null;return null!=i&&(null==e||(0,r.le)(i,e))?(null!=s&&s(t),i):null!=e?e:null}}e.ue=function(t,e,i){return o(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({},o(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=u},812:(t,e)=>{$Q(e)},578:(t,e,i)=>{$Q(e),e.v=e.A=void 0;const n=i(406),s=i(512);e.A=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(i.statsigEnvironment=e.environment),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Dt)(t):null}},534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.J=i.F=i.Storage=void 0;var n=e(512),e=e(830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==o&&void 0!==o?o:r,l=u;i.Storage={isReady:()=>l.isReady(),isReadyResolver:()=>l.isReadyResolver(),getProviderName:()=>l.getProviderName(),getItem:t=>{var e=()=>l.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.de(r),null;throw t}},setItem:(t,e)=>l.setItem(t,e),removeItem:t=>l.removeItem(t),getAllKeys:()=>l.getAllKeys(),de:t=>{u=t,l=t},Bt:t=>{l=t?r:u}},i.F=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.J=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},401:(t,e,i)=>{$Q(e),e.C=void 0;const s=i(512);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}},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 i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(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 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)})}},638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},397:(t,e,i)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;i=i(830);const n="foreground",s="background",r=[];let o=n,u=!1;e.Ot=()=>o===n,e.Ut=()=>u,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==o&&(o=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(u=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{u=!0,(0,e.ve)(s)}),(0,i.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?n:s)})},914: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.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,i(845);const r=i(962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(770)),u=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(512));$Q2(e,"Log",{enumerable:!0,get:function(){return u.Log}});var l=i(0);const a=i(534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),s(i(845),e),s(i(137),e),s(i(427),e),s(i(694),e),s(i(962),e),s(i(539),e),s(i(542),e),s(i(922),e),s(i(417),e),s(i(406),e),s(i(333),e),s(i(512),e),s(i(404),e),s(i(410),e),s(i(405),e),s(i(361),e),s(i(830),e),s(i(902),e),s(i(143),e),s(i(122),e),s(i(375),e),s(i(636),e),s(i(206),e),s(i(637),e),s(i(0),e),s(i(586),e),s(i(59),e),s(i(812),e),s(i(578),e),s(i(98),e),s(i(534),e),s(i(401),e),s(i(634),e),s(i(638),e),s(i(23),e),s(i(397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:u.Log,SDK_VERSION:l.SDK_VERSION})},296: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(18),e),e.default=__STATSIG__},262:(t,e,i)=>{$Q(e),e.fe=void 0;const n=i(914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=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.Dt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},226:(t,e,i)=>{$Q(e);const s=i(914);e.default=class{constructor(t){this.S=t,this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0,this.bi=null,this.mi=new Set}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0,this.bi=null}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,s.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==i?void 0:i.has_updates)&&(this._e=t.data,this.ye=i.time,this.me=t.receivedAt,this.ge=i,this.bi=this.pi(t.source,i),t.source)&&i.user&&this.yi(e,i),!0)}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)}pi(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}pe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Se(null==i)}}yi(t,e){var i,n=s.StableID.get(this.S);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.mi.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.mi.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:(t={reason:this.be,lcut:this.ye,receivedAt:this.me},0<this.mi.size&&(t.warnings=Array.from(this.mi)),t)}Se(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.be&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.be&&null!=(n=this.bi)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},448:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e);const u=i(914),l=i(262);class n 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(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.je(i,t,e,s)})}je(e,i,n,s){var r;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:n,retries:2,isStatsigEncodable:!0,priority:s,isInitialize:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(r=null==t?void 0:t.body)?r:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,l.fe)(i,t.body))?t:this.je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},583:(t,e,i)=>{$Q(e),e.Te=void 0;const g=i(914),b={disableExposureLog:!0};function p(t){return null==t||!1===t.disableExposureLog}function y(t,e){return null!=e&&!(0,g.le)(t,e)}e.Te=function(v,f,_){return(t,e)=>{if(null==f)return e;var i,n,s,r,o,u,l,a,c,h,d=f[t];if(null==d||null!=e&&(0,g.kt)(e)!==d.param_type)return e;switch(d.ref_type){case"static":return d.value;case"gate":return h=d,v.getFeatureGate(h.gate_name,p(_)?void 0:b).value?h.pass_value:h.fail_value;case"dynamic_config":return h=d,l=e,a=_,y(c=(u=v).getDynamicConfig(h.config_name,b).get(h.param_name),l)?l:(p(a)&&u.getDynamicConfig(h.config_name),c);case"experiment":return l=d,a=e,u=_,y(o=(c=v).getExperiment(l.experiment_name,b).get(l.param_name),a)?a:(p(u)&&c.getExperiment(l.experiment_name),o);case"layer":return o=d,n=e,s=_,y(r=(i=v).getLayer(o.layer_name,b).get(o.param_name),n)?n:(p(s)&&i.getLayer(o.layer_name).get(o.param_name),r);default:return e}}}},198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const o=i(914),u=i(226),l=i(448),r=i(583),a=i(131);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)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){o.SDKType.Kt(t,"javascript-client");var n,s=new l.default(i,t=>{this.$emt(t)}),s=(super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,s,i),this.we=new u.default(t),this.Ie=(0,o.A)(e,i),null!=(n=null==i?void 0:i.plugins)?n:[]);for(const r of s)r.bind(this)}initializeSync(t){"Uninitialized"===this.loadingStatus&&(this.Ht.start(),this.updateUserSync(this.Ie,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.xn||(this.xn=this.Dn(t)),this.xn})}updateUserSync(t,e){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie),this.we.setValues(t,this.Ie),this.Me(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.xe(null!=t?t:null,this.Ie)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Ae(i);var t=this.Ie,e=(o.Diagnostics.gn(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e,this.Ie),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),o.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),o.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.Tn(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.we.getGate(t),n=(0,o.ue)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.ee)(this.Ie,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.oe)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.re)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.we.getLayer(e),n=(0,o.se)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.Ie,i);const r=(0,o.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}getParameterStore(t,e){var{result:i,details:n}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,r.Te)(this,i,e)}}logEvent(t,e,i){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Dn(t){return s(this,void 0,void 0,function*(){return o.Storage.isReady()||(yield o.Storage.isReadyResolver()),this.Ht.start(),this.updateUserAsync(this.Ie,t)})}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);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=n},131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(914),s=i(448);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,(0,n.A)(e,this.p),i)}prefetchData(t,e){return this.k(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. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}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},18:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.StatsigClient=void 0,i(198));e.StatsigClient=r.default,s(i(914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:r.default}),e.default=__STATSIG__}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[t].call(e.exports,e,e.exports,s)),e.exports}return s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s(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 i={845:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.t=i.i=i.o=void 0,i.o=()=>__STATSIG__||l,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 l=null!=(n=null!=(n=null!=(n=r[s])?n:e[s])?n:o[s])?n:{instance:i.t};r[s]=l,e[s]=l,o[s]=l},137:(t,e,i)=>{$Q(e),e.u=e.l=void 0;const s=i(406);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)}},427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const u=i(512),a=i(122),r=i(578),o=i(534),c=i(401);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 t=t&&(0,r.A)(t,this.p),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,this.p),i=this.T(e);this.j.add(i,d("Bootstrap",t,null,e))}M(e,i,n){return s(this,void 0,void 0,function*(){o.Storage.isReady()||(yield o.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.D(t,i,n)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}k(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.A)(i,this.p),e=this.T(t),t=yield this.M(null,t,n);t&&this.j.add(e,$P($P({},t),{source:"Prefetch"}))})}D(r,o,l){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,l);if(!e)return u.Log.debug("No response returned for latest value"),null;var i=(0,c.C)(e,"has_updates","Response"),n=this.P(),n=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),this.G(e,s),s})}P(){return null!=this.S?this.S:(u.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=o.Storage.getItem)?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){o.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,o.F)(this.O))?e:{},t=(e[t]=Date.now(),l(e,10));t&&(delete e[t],o.Storage.removeItem(t)),(0,o.J)(this.O,e)}};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?(u.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var i=l(this.V,9);i&&delete this.V[i],this.V[t]=e}merge(t){this.V=$P($P({},this.V),t)}}function l(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})}},962:(t,r)=>{$Q2(r,"__esModule",{value:!0}),r.Diagnostics=void 0;const n=new Map,i="start";function s(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function o(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}r.Diagnostics={_n:t=>n.get(t),gn:t=>{o(t,s({},i,"overall"))},mn:(t,e,i)=>{o(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},bn:(t,e)=>{o(t,s(e,i,"initialize","network_request"))},pn:(t,e)=>{o(t,s(e,"end","initialize","network_request"))},yn:t=>{o(t,s({},i,"initialize","process"))},On:(t,e)=>{o(t,s(e,"end","initialize","process"))},jn:t=>{n.delete(t)},Sn(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},wn(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:r.Diagnostics.Sn(n)}},Tn(t,e,i,n){var s=r.Diagnostics._n(i);null==s||s.length<=0||(r.Diagnostics.jn(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:s.slice(),statsigOptions:n}),e.enqueue(i))}}},539:(t,e)=>{$Q(e)},542:function(t,l,e){var i=this&&this.__awaiter||$A();$Q2(l,"__esModule",{value:!0}),l.ErrorBoundary=l.EXCEPTION_ENDPOINT=void 0;const n=e(512),u=e(902),a=e(0),c=(l.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");l.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=u.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)(l.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){}}}},922:(t,e)=>{$Q(e)},417:(t,e)=>{$Q(e)},770:function(t,e,i){var n,s=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=i(137),o=i(406),l=i(512),u=i(410),a=i(830),c=i(637),d=i(534),h=i(638),v=i(397),f={};(i=n=n||{})[i.Startup=0]="Startup",i[i.GainedFocus=1]="GainedFocus";class _{static wi(t){null!=(t=f[t])&&t.flush().catch(()=>{})}static Ti(t){null!=(t=f[t])&&t.ct(n.GainedFocus)}constructor(t,e,i,n){this.S=t,this.B=e,this.X=i,this.p=n,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==n?void 0:n.disableLogging),this.rt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.ot=(0,h.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",u.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&_.wi(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,a.Mt)()||(f[this.S]=this,(0,v.lt)(t=>{"background"===t?_.wi(this.S):"foreground"===t&&_.Ti(this.S)}),this.ct(n.Startup),this.ht())}stop(){return s(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),yield this.flush()})}flush(){return s(this,void 0,void 0,function*(){var t;this.gt(),0!==this.Z.length&&(t=this.Z,this.Z=[],yield this.bt(t))})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>_.wi(this.S),200)}dt(t){if((0,a.Mt)())return!1;if((0,c.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,r.l)(this.S,e),i=t.metadata||{},t=[t.eventName,e,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 s(this,void 0,void 0,function*(){if(this.st)return this.St(t),!1;try{return(!(0,v.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}),!0):(l.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return l.Log.warn("Failed to flush events."),!1}})}Tt(e){var i;return s(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 s(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:{[u.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,d.J)(e,t)}catch(t){l.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.u();s(this,void 0,void 0,function*(){d.Storage.isReady()||(yield d.Storage.isReadyResolver());var t=(0,d.F)(i);t&&(e===n.Startup&&d.Storage.removeItem(i),yield this.bt(t))&&e===n.GainedFocus&&d.Storage.removeItem(i)}).catch(()=>{l.Log.warn("Failed to flush stored logs")})}u(){return"statsig.failed_logs."+(0,o.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));l.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,a.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{f[this.S]._t!==e?clearInterval(e):_.wi(this.S)},t);this._t=e}}e.EventLogger=_},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 i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},r.Dt=(t,e)=>(0,r.h)(JSON.stringify((0,r.xt)(t,e)));r.xt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const s={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,o.kt)(e)?s[t]=e:s[t]=(0,r.xt)(e,null!=n?n-1:n)}),s}},333:(t,e)=>{$Q(e)},512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}var n,s;(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(" INFO ",...i(t))}static debug(...t){this.level>=n.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){this.level>=n.Warn&&console.warn(" WARN ",...i(t))}static error(...t){this.level>=n.Error&&console.error(" ERROR ",...i(t))}}(e.Log=r).level=n.Warn},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,i){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(845);const o=i(845),b=i(962),p=i(512),l=i(410),u=i(902),a=i(830),c=i(143),d=i(122),h=i(0),m=i(397),y=new Set([408,500,502,503,504,522,524,599]);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(n){return r(this,void 0,void 0,function*(){var t,e,i;return!!O(n)&&(t=yield this.Nt(n),e=yield this.Gt(n),(i=navigator).sendBeacon.bind(i)(e,t))})}Pt(f){var _,g;return r(this,void 0,void 0,function*(){if(!O(f))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:s}=f,s=null!=s?s:1;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),o=yield this.Gt(f);let l=null;var u=(0,m.Ut)();try{var a,c,d,h={method:e,body:i,headers:$P({},f.headers),signal:null===r||void 0===r?void 0:r.signal,priority:f.priority,keepalive:u},v=(f.isInitialize&&b.Diagnostics.bn(f.sdkKey,{attempt:s}),null!=(_=this.Rt.networkOverrideFunc)?_:fetch);if(l=yield v(o,h),clearTimeout(t),l.ok)return d=yield l.text(),f.isInitialize&&b.Diagnostics.pn(f.sdkKey,b.Diagnostics.wn(l,s,d)),{body:d,code:l.status};throw a=yield l.text().catch(()=>"No Text"),(c=new Error(`NetworkError: ${o} `+a)).name="NetworkError",c}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"}(r,t);return f.isInitialize&&b.Diagnostics.pn(f.sdkKey,b.Diagnostics.wn(l,s,"",t)),!n||n<s||!y.has(null!=(g=null===l||void 0===l?void 0:l.status)?g:500)?(null!=(g=this.B)&&g.call(this,{name:"error",error:t}),p.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.Pt($P($P({},f),{retries:n,attempt:s+1}))}})}Gt(i){return r(this,void 0,void 0,function*(){const e=$P({[l.NetworkParam.SdkKey]:i.sdkKey,[l.NetworkParam.SdkType]:u.SDKType.Y(i.sdkKey),[l.NetworkParam.SdkVersion]:h.SDK_VERSION,[l.NetworkParam.Time]:String(Date.now()),[l.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:"")})}Nt(s){return r(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=d.StableID.get(e),n=c.SessionID.get(e),e=u.SDKType.Y(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:e})}))})}Ct(t,e){var i,n,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!=(i=s.btoa(e).split("").reverse().join(""))?i:e;return t.params=$P($P({},null!=(n=t.params)?n:{}),{[l.NetworkParam.StatsigEncoded]:"1"}),r}catch(t){return p.Log.warn("/initialize request encoding failed"),e}}};const O=t=>!!t.sdkKey||(p.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 i={};let n;e.SDKType={Y:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},Kt(t,e){i[t]=e},Ft(t){n&&"-react"!==n||(n="-"+t)}}},830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.At=n.qt=n.zt=n.Mt=n.Jt=n.Lt=void 0;n.Lt=()=>"undefined"!=typeof window?window:null,n.Jt=()=>{var t=(0,n.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>{var t;return null===(0,n.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.zt=(t,e)=>{var i=(0,n.Lt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.qt=(t,e)=>{var i=(0,n.Jt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.At=()=>{var t;try{return null==(t=(0,n.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(137),r=i(512),o=i(534),l=i(23),u=18e5,a=144e5,c={};function d(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function h(t){return"statsig.session_id."+(0,n.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=h(t);return(0,o.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,l.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>u}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,l.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=h(s);try{(0,o.J)(s,n)}catch(t){r.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=d(i,u),t.ageTimeoutID=d(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(137),s=i(512),r=i(534),o=i(23),l={};function u(t){return"statsig.stable_id."+(0,n.u)(t)}function a(t,e){e=u(e);try{(0,r.J)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==l[e]){let t=function(t){t=u(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),l[e]=t}return l[e]},setOverride:(t,e)=>{a(l[e]=t,e)}}},375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(845);const o=i(845),l=i(542),u=i(770),a=i(512),c=i(830),d=i(143),h=i(534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.Vt={};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.Bt(!0),null!=n&&n.initialSessionID&&d.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&h.Storage.de(n.storageProvider),this.S=t,this.p=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Ht=new u.EventLogger(t,r,i,n),this.Wt=new l.ErrorBoundary(t,n,r),this.Wt.wrap(this),this.Wt.wrap(i),this.Wt.wrap(e),this.Wt.wrap(this.Ht),(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.storageProvider=h.Storage,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 n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),yield this.Ht.stop()})}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(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Vt[i.name]&&this.Vt[i.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,i){!0===(null==i?void 0:i.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 i="statsig::config_exposure",n="statsig::gate_exposure",u=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:r(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===n||t===i,e.ee=(t,e)=>{return u(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.te=(t,e)=>{return u(i,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,i)=>{var n,s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(i));let o="",l=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return r&&(o=null!=(n=s.allocated_experiment_name)?n:"",l=s.secondary_exposures),u("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(r)},l)};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="3.1.0";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e)},59:(t,e,i)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const r=i(634),s="default";function o(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({},o(t,e,i,n)),{get:l(null==i?void 0:i.value)})}function l(n,s){return(t,e)=>{var i=null!=(i=null==n?void 0:n[t])?i:null;return null!=i&&(null==e||(0,r.le)(i,e))?(null!=s&&s(t),i):null!=e?e:null}}e.ue=function(t,e,i){return o(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({},o(t,e,i,void 0)),{get:l(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:l(i,n)})},e.ie=l},812:(t,e)=>{$Q(e)},578:(t,e,i)=>{$Q(e),e.v=e.A=void 0;const n=i(406),s=i(512);e.A=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(i.statsigEnvironment=e.environment),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Dt)(t):null}},534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.J=i.F=i.Storage=void 0;var n=e(512),e=e(830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let l=null!==o&&void 0!==o?o:r,u=l;i.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:t=>{var e=()=>u.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.de(r),null;throw t}},setItem:(t,e)=>u.setItem(t,e),removeItem:t=>u.removeItem(t),getAllKeys:()=>u.getAllKeys(),de:t=>{l=t,u=t},Bt:t=>{u=t?r:l}},i.F=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.J=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},401:(t,e,i)=>{$Q(e),e.C=void 0;const s=i(512);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}},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 i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(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 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)})}},638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},397:(t,e,i)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;i=i(830);const n="foreground",s="background",r=[];let o=n,l=!1;e.Ot=()=>o===n,e.Ut=()=>l,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==o&&(o=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(l=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{l=!0,(0,e.ve)(s)}),(0,i.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?n:s)})},914: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.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,i(845);const r=i(962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(770)),l=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(512));$Q2(e,"Log",{enumerable:!0,get:function(){return l.Log}});var u=i(0);const a=i(534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),s(i(845),e),s(i(137),e),s(i(427),e),s(i(694),e),s(i(962),e),s(i(539),e),s(i(542),e),s(i(922),e),s(i(417),e),s(i(406),e),s(i(333),e),s(i(512),e),s(i(404),e),s(i(410),e),s(i(405),e),s(i(361),e),s(i(830),e),s(i(902),e),s(i(143),e),s(i(122),e),s(i(375),e),s(i(636),e),s(i(206),e),s(i(637),e),s(i(0),e),s(i(586),e),s(i(59),e),s(i(812),e),s(i(578),e),s(i(534),e),s(i(401),e),s(i(634),e),s(i(638),e),s(i(23),e),s(i(397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:l.Log,SDK_VERSION:u.SDK_VERSION})},16:(t,e,i)=>{$Q(e),e.AutoInit=void 0;const v=i(914),f=i(18);function _(t,e){var i;return null!=(i=e.get(t))?i:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,i,n;try{var s=(0,v.Lt)(),r=(0,v.Jt)();if(s&&r&&r.currentScript){var o=r.currentScript.getAttribute("src"),l=null==(t=s.location)?void 0:t.href;if(o&&l){var u=new URL(o,l).searchParams,a=null!=(i=_("sdkKey",u))?i:_("apiKey",u);if(a){var c={},d=_("proxy",u),h=(d&&(c.networkConfig={api:d}),null==(n=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:n[a]);let t=null;(t=h instanceof f.StatsigClient?h:t)||(t=new f.StatsigClient(a,function(){var t=(0,v.Lt)();if(!t)return{};let e=t.statsigUser||{};var i=(e="object"!=typeof e?{}:e).custom||{},n=e.customIDs||{};return $P($P({},e),{customIDs:$P({},n),custom:$P($P({},i),{useragent:t.navigator.userAgent,page_url:(0,v.At)()||"",language:null==(n=t.navigator)?void 0:n.language})})}(),c)).initializeAsync().catch(t=>{v.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){v.Log.error("AutoInit failed",t)}}}},262:(t,e,i)=>{$Q(e),e.fe=void 0;const n=i(914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=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.Dt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},226:(t,e,i)=>{$Q(e);const s=i(914);e.default=class{constructor(t){this.S=t,this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0,this.bi=null,this.mi=new Set}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0,this.bi=null}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,s.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==i?void 0:i.has_updates)&&(this._e=t.data,this.ye=i.time,this.me=t.receivedAt,this.ge=i,this.bi=this.pi(t.source,i),t.source)&&i.user&&this.yi(e,i),!0)}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)}pi(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}pe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Se(null==i)}}yi(t,e){var i,n=s.StableID.get(this.S);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.mi.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.mi.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:(t={reason:this.be,lcut:this.ye,receivedAt:this.me},0<this.mi.size&&(t.warnings=Array.from(this.mi)),t)}Se(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.be&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.be&&null!=(n=this.bi)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},448:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e);const l=i(914),u=i(262);class n extends l.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.Oe=(0,l.ut)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",l.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s,r){return o(this,void 0,void 0,function*(){var t=n?(0,l.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.je(i,t,e,s)})}je(e,i,n,s){var r;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:n,retries:2,isStatsigEncodable:!0,priority:s,isInitialize:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(r=null==t?void 0:t.body)?r:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,u.fe)(i,t.body))?t:this.je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},583:(t,e,i)=>{$Q(e),e.Te=void 0;const g=i(914),b={disableExposureLog:!0};function p(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 i,n,s,r,o,l,u,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,p(_)?void 0:b).value?d.pass_value:d.fail_value;case"dynamic_config":return d=h,u=e,a=_,m(c=(l=v).getDynamicConfig(d.config_name,b).get(d.param_name),u)?u:(p(a)&&l.getDynamicConfig(d.config_name),c);case"experiment":return u=h,a=e,l=_,m(o=(c=v).getExperiment(u.experiment_name,b).get(u.param_name),a)?a:(p(l)&&c.getExperiment(u.experiment_name),o);case"layer":return o=h,n=e,s=_,m(r=(i=v).getLayer(o.layer_name,b).get(o.param_name),n)?n:(p(s)&&i.getLayer(o.layer_name).get(o.param_name),r);default:return e}}}},198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const o=i(914),r=i(226),l=i(448),u=i(583),a=i(131);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)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){o.SDKType.Kt(t,"javascript-client");var n,s=new l.default(i,t=>{this.$emt(t)});super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,s,i),this.xn=null,this.we=new r.default(t),this.Ie=(0,o.A)(e,i)}initializeSync(t){"Uninitialized"===this.loadingStatus&&(this.Ht.start(),this.updateUserSync(this.Ie,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.xn||(this.xn=this.Dn(t)),this.xn})}updateUserSync(t,e){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie),this.we.setValues(t,this.Ie),this.Me(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.xe(null!=t?t:null,this.Ie)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Ae(i);var t=this.Ie,e=(o.Diagnostics.gn(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e,this.Ie),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),o.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),o.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.Tn(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.we.getGate(t),n=(0,o.ue)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.ee)(this.Ie,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.oe)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.re)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.we.getLayer(e),n=(0,o.se)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.Ie,i);const r=(0,o.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}getParameterStore(t,e){var{result:i,details:n}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,u.Te)(this,i,e)}}logEvent(t,e,i){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Dn(t){return s(this,void 0,void 0,function*(){return o.Storage.isReady()||(yield o.Storage.isReadyResolver()),this.Ht.start(),this.updateUserAsync(this.Ie,t)})}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);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=n},131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(914),s=i(448);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,(0,n.A)(e,this.p),i)}prefetchData(t,e){return this.k(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. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}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},18:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.StatsigClient=void 0,i(198));e.StatsigClient=r.default,s(i(914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:r.default}),e.default=__STATSIG__},535:(t,e,i)=>{$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const c=i(914),n=i(325),s=i(901);e.runStatsigAutoCapture=function(t){return new r(t)};class r{constructor(t){this.De=t,this.We=Date.now(),this.Ye=0,this.In={},this.Si=null;var{sdkKey:t,errorBoundary:e,values:i}=t.getContext(),i=(this.In=null!=(i=null==(i=null==i?void 0:i.auto_capture_settings)?void 0:i.disabled_events)?i:{},this.Wt=e,this.Wt.wrap(this),(0,c.Jt)());(0,c.Mt)()||((e=null!=(e=(__STATSIG__=(0,c.o)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==i?void 0:i.readyState)?i.addEventListener("DOMContentLoaded",()=>this.Qe()):this.Qe()}Xe(){const e=(0,c.Lt)();var t,i=(0,c.Jt)();e&&i&&(t=t=>{this.Ze(t||e.event)},(0,n.ti)(i,"click",t),(0,n.ti)(i,"submit",t),(0,n.ti)(e,"error",t),(0,n.ti)(e,"beforeunload",()=>this.ei()),(0,n.ti)(e,"scroll",()=>this.ii()))}Oi(){var t=(0,c.Lt)(),e=(0,c.Jt)();t&&e&&((0,n.ti)(t,"popstate",()=>this.ji()),window.history.pushState=new Proxy(window.history.pushState,{apply:(t,e,[i,n,s])=>{t.apply(e,[i,n,s]),this.ji()}}),this.ji())}Ze(t){var e;let i=null==(e=t.type)?void 0:e.toLowerCase();"error"===i&&t instanceof ErrorEvent?this.ni(t):(e=(0,n.si)(t))&&(0,n.dt)(t,e)&&("submit"===i&&(i="form_submit"),{value:t,metadata:e}=(0,n.ri)(e),this.oi(i,t,e))}Qe(){this.Xe(),this.Oi(),this.ui(),this.ai()}ni(t){var e=(null==t?void 0:t.error)||{};let i=e;if("object"==typeof e)try{i=JSON.stringify(e)}catch(t){i="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.oi("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:i})}ui(){var t=this.ci();try{this.hi(t)&&this.oi("session_start",(0,n.di)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}catch(t){this.Wt.logError("AC::logSession",t)}}ji(){var t=(0,n.vi)(),e=this.Si;e&&t.href===e.href||(this.Si=t,e=(0,s.fi)(t),this.oi("page_view",(0,n.di)(),e,{flushImmediately:!0,addNewSessionMetadata:!0}))}ai(){const i=(0,c.Lt)();void 0!==(null===i||void 0===i?void 0:i.performance)&&"function"==typeof i.performance.getEntriesByType&&"function"==typeof i.performance.getEntriesByName&&setTimeout(()=>{var t={},e=i.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),i.performance.getEntriesByName("first-contentful-paint")),e=(e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),(0,n.gi)());e&&(t.effective_connection_type=e.effectiveType,t.rtt_ms=e.rtt,t.downlink_kbps=e.downlink,t.save_data=e.saveData),this.oi("performance",(0,n.di)(),t)},1)}ei(){this.oi("page_view_end",(0,n.di)(),{scrollDepth:this.Ye,pageViewLength:Date.now()-this.We},{flushImmediately:!0})}oi(t,e,i,n){var s,r,o;if(!this.In[t]){var l=this.ci();try{var u=$P({sessionID:l.data.sessionID,page_url:null!=(o=null==(r=null==(s=(0,c.Lt)())?void 0:s.location)?void 0:r.href)?o:""},i),a=(null!=n&&n.addNewSessionMetadata&&(u.isNewSession=String(this.hi(l))),{eventName:"auto_capture::"+t,value:e,metadata:u});this.De.logEvent(a),null!=n&&n.flushImmediately&&this.De.flush().catch(t=>{c.Log.error(t)})}catch(t){this.Wt.logError("AC::enqueue",t)}}}ii(){var t=null!=(t=null==(t=(0,c.Jt)())?void 0:t.body.scrollHeight)?t:1,e=(0,c.Lt)(),i=null!=(i=null==e?void 0:e.scrollY)?i:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ye=Math.max(this.Ye,Math.min(100,Math.round((i+e)/t*100)))}hi(t){return Math.abs(t.data.startTime-Date.now())<1e3}ci(){return this.De.getContext().session}}e.AutoCapture=r},325:(t,e,i)=>{$Q(e),e.gi=e.ti=e.di=e.vi=e.dt=e.si=e.ri=e.fn=void 0;const r=i(914);function o(t){var e={};if(t){var i=null==t?void 0:t.dataset;if(i)for(const n in i)e["data-"+n]=i[n]||""}return e}function l(e){if(e){let t=e;for(;t;){var i=t.tagName.toLowerCase();if(["body","document"].includes(i))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.fn=o,e.ri=function(t){var e=t.tagName.toLowerCase(),i={},n=(0,r.At)()||"",s=("form"===(i.tagName=e)&&(i.action=t.getAttribute("action"),i.method=null!=(s=t.getAttribute("method"))?s:"GET",i.formName=t.getAttribute("name"),i.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(i.content=t.value,i.inputName=t.getAttribute("name")),l(t));return s&&(i.href=s.getAttribute("href")),"button"!==e&&!s||(i.content=(t.textContent||"").trim(),e=o(s||t),$P(i,e)),{value:n,metadata:i}},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 i=e.tagName.toLowerCase(),n=t.type.toLowerCase();switch(i){case"html":return!1;case"form":return"submit"===n;case"input":case"select":case"textarea":return["change"].includes(n);default:if("click"===n){if("button"===i)return!0;if(l(e))return!0}return!1}},e.vi=function(){var t=null!=(t=null==(t=null==(t=(0,r.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,r.At)()||""},e.ti=function(t,e,i){t&&t.addEventListener&&t.addEventListener(e,i,!0)},e.gi=function(){var t=(0,r.Lt)();return t&&t.navigator&&t.navigator.connection||null}},964:(t,e,i)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const n=i(535);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return n.AutoCapture}}),$Q2(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return n.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:n.AutoCapture,runStatsigAutoCapture:n.runStatsigAutoCapture}),e.default=__STATSIG__},901:(t,e,i)=>{$Q(e),e.fi=void 0;const a=i(914);e.fi=function(t){var e=(0,a.Jt)(),i=(0,a.Lt)();if(!e||!i)return{};var n=null==i?void 0:i.navigator,s=(null==e?void 0:e.referrer)||"";let r=new URL("empty:");if(s)try{r=new URL(s||"empty:")}catch(t){}l=r,o=function(t){const e=t.hostname,i=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return i||""}(l),l=l.searchParams.get("yahoo"===o?"p":"q")||"";var o={searchEngine:o,searchQuery:l},l=function(t){const i=t.searchParams,n={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","gclsrc","dclid","fbclid","msclkid","mc_eid","mc_cid","twclid","li_fat_id","igshid","utm_id","ttc","ttclid","ttc_id"].forEach(t=>{var e=i.get(t);e&&(n[t]=e)}),n}(t);const u={};return t.searchParams.forEach((t,e)=>{u[e]=t}),$P($P($P($P({},o),l),u),{title:(null==e?void 0:e.title)||"",locale:(null==n?void 0:n.language)||"unknown",hostname:t.hostname||"unknown",pathname:t.pathname||"unknown",referrer:s,screen_width:(null==(o=null==i?void 0:i.screen)?void 0:o.width)||"unknown",screen_height:(null==(l=null==i?void 0:i.screen)?void 0:l.height)||"unknown",viewport_width:(null==i?void 0:i.innerWidth)||"unknown",viewport_height:(null==i?void 0:i.innerHeight)||"unknown"})}}},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}s.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=s(964);var r=s(16);e.default=__STATSIG__,r.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 i={1845:(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},2137:(t,e,i)=>{$Q(e),e.u=e.l=void 0;const s=i(1406);function n(t,e,i){if(i)return i(t,e);const n=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(i=null==e?void 0:e.userID)?i:""),"cids:"+Object.keys(n).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+n[t]).join(","),"k:"+t];return(0,s.h)(e.join("|"))}e.l=n,e.u=function(t,e,i){return e?n(t,e,i):(0,s.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e),e.DataAdapterCore=void 0;const l=i(7512),a=i(9122),r=i(8578),o=i(4534),c=i(3401);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 t=t&&(0,r.A)(t,this.p),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,this.p),i=this.T(e);this.j.add(i,d("Bootstrap",t,null,e))}M(e,i,n){return s(this,void 0,void 0,function*(){o.Storage.isReady()||(yield o.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(i),t=[this.D(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)})}k(i,n){return s(this,void 0,void 0,function*(){var t=i&&(0,r.A)(i,this.p),e=this.T(t),t=yield this.M(null,t,n);t&&this.j.add(e,$P($P({},t),{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 i=(0,c.C)(e,"has_updates","Response"),n=this.P(),n=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),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.getItem)?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){o.Storage.setItem(t,JSON.stringify(e)),this.K(t)}K(t){var e=null!=(e=(0,o.F)(this.O))?e:{},t=(e[t]=Date.now(),u(e,10));t&&(delete e[t],o.Storage.removeItem(t)),(0,o.J)(this.O,e)}};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})}},8962:(t,r)=>{$Q2(r,"__esModule",{value:!0}),r.Diagnostics=void 0;const n=new Map,i="start";function s(t,e,i,n){return $P({key:i,action:e,step:n,timestamp:Date.now()},t)}function o(t,e){var i=null!=(i=n.get(t))?i:[];i.push(e),n.set(t,i)}function e(t,e){if(e in t)return t[e]}r.Diagnostics={_n:t=>n.get(t),gn:t=>{o(t,s({},i,"overall"))},mn:(t,e,i)=>{o(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:i},"end","overall"))},bn:(t,e)=>{o(t,s(e,i,"initialize","network_request"))},pn:(t,e)=>{o(t,s(e,"end","initialize","network_request"))},yn:t=>{o(t,s({},i,"initialize","process"))},On:(t,e)=>{o(t,s(e,"end","initialize","process"))},jn:t=>{n.delete(t)},Sn(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},wn(t,e,i,n){return{success:!0===(null==t?void 0:t.ok),statusCode:null==t?void 0:t.status,sdkRegion:null==(t=null==t?void 0:t.headers)?void 0:t.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:e,error:r.Diagnostics.Sn(n)}},Tn(t,e,i,n){var s=r.Diagnostics._n(i);null==s||s.length<=0||(r.Diagnostics.jn(i),i=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:s.slice(),statsigOptions:n}),e.enqueue(i))}}},3539:(t,e)=>{$Q(e)},5542:function(t,u,e){var i=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const n=e(7512),l=e(5902),a=e(8e3),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){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const s=i(2137),r=i(1406),o=i(7512),u=i(7410),l=i(6830),a=i(1637),c=i(4534),d=i(9638),h=i(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static wi(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static Ti(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,i,n){this.S=t,this.B=e,this.X=i,this.p=n,this.Z=[],this.tt={},this.et={},this.it=!1,this.nt=Date.now(),this.st=!0===(null==n?void 0:n.disableLogging),this.rt=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;e=null==n?void 0:n.networkConfig;this.ot=(0,d.ut)(null==e?void 0:e.logEventUrl,null==e?void 0:e.api,"/rgstr",u.NetworkDefault.eventsApi)}setLoggingDisabled(t){this.st=t}enqueue(t){this.dt(t)&&(this.vt(t),this.ft(),this.Z.length>this.rt)&&_.wi(this.S)}incrementNonExposureCount(t){var e=null!=(e=this.et[t])?e:0;this.et[t]=e+1}reset(){this.tt={}}start(){(0,l.Mt)()||(v[this.S]=this,(0,h.lt)(t=>{"background"===t?_.wi(this.S):"foreground"===t&&_.Ti(this.S)}),this.ct(f.Startup),this.ht())}stop(){return n(this,void 0,void 0,function*(){this._t&&(clearInterval(this._t),this._t=null),delete v[this.S],yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.gt(),0!==this.Z.length&&(t=this.Z,this.Z=[],yield this.bt(t))})}ft(){this.it||(this.it=!0,200<Date.now()-this.nt)||setTimeout(()=>_.wi(this.S),200)}dt(t){if((0,l.Mt)())return!1;if((0,a.yt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.l)(this.S,e),i=t.metadata||{},t=[t.eventName,e,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)return this.St(t),!1;try{return(!(0,h.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}),!0):(o.Log.warn("Failed to flush events."),this.St(t),!1)}catch(t){return o.Log.warn("Failed to flush events."),!1}})}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:{[u.NetworkParam.EventCount]:String(t.length)}}}St(t){for(;500<t.length;)t.shift();var e=this.u();try{(0,c.J)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(e){const i=this.u();n(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.F)(i);t&&(e===f.Startup&&c.Storage.removeItem(i),yield this.bt(t))&&e===f.GainedFocus&&c.Storage.removeItem(i)}).catch(()=>{o.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={},i=this.It(),i=(i&&(e.statsigMetadata={currentPage:i}),$P($P({},t),e));o.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,l.At)()}ht(){var t=null!=(t=null==(t=this.p)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{v[this.S]._t!==e?clearInterval(e):_.wi(this.S)},t);this._t=e}}e.EventLogger=_},1406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.xt=r.Dt=r.h=void 0;const o=e(6634);r.h=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)},r.Dt=(t,e)=>(0,r.h)(JSON.stringify((0,r.xt)(t,e)));r.xt=(i,n)=>{if(null==i)return null;var t=Object.keys(i).sort();const s={};return t.forEach(t=>{var e=i[t];0===n||"object"!==(0,o.kt)(e)?s[t]=e:s[t]=(0,r.xt)(e,null!=n?n-1:n)}),s}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function i(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class n{static info(...t){this.level>=e.LogLevel.Info&&console.info(" INFO ",...i(t))}static debug(...t){this.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...i(t))}static warn(...t){this.level>=e.LogLevel.Warn&&console.warn(" WARN ",...i(t))}static error(...t){this.level>=e.LogLevel.Error&&console.error(" ERROR ",...i(t))}}(e.Log=n).level=e.LogLevel.Warn},7410:(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"}},7023:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,i(1845);const o=i(1845),b=i(8962),p=i(7512),u=i(7410),l=i(5902),a=i(6830),c=i(4143),d=i(9122),h=i(8e3),m=i(2397),y=new Set([408,500,502,503,504,522,524,599]);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(n){return r(this,void 0,void 0,function*(){var t,e,i;return!!O(n)&&(t=yield this.Nt(n),e=yield this.Gt(n),(i=navigator).sendBeacon.bind(i)(e,t))})}Pt(f){var _,g;return r(this,void 0,void 0,function*(){if(!O(f))return null;if(this.Rt.preventAllNetworkTraffic)return null;var{method:e,body:i,retries:n,attempt:s}=f,s=null!=s?s:1;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),o=yield this.Gt(f);let u=null;var l=(0,m.Ut)();try{var a,c,d,h={method:e,body:i,headers:$P({},f.headers),signal:null===r||void 0===r?void 0:r.signal,priority:f.priority,keepalive:l},v=(f.isInitialize&&b.Diagnostics.bn(f.sdkKey,{attempt:s}),null!=(_=this.Rt.networkOverrideFunc)?_:fetch);if(u=yield v(o,h),clearTimeout(t),u.ok)return d=yield u.text(),f.isInitialize&&b.Diagnostics.pn(f.sdkKey,b.Diagnostics.wn(u,s,d)),{body:d,code:u.status};throw a=yield u.text().catch(()=>"No Text"),(c=new Error(`NetworkError: ${o} `+a)).name="NetworkError",c}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"}(r,t);return f.isInitialize&&b.Diagnostics.pn(f.sdkKey,b.Diagnostics.wn(u,s,"",t)),!n||n<s||!y.has(null!=(g=null===u||void 0===u?void 0:u.status)?g:500)?(null!=(g=this.B)&&g.call(this,{name:"error",error:t}),p.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.Pt($P($P({},f),{retries:n,attempt:s+1}))}})}Gt(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:"")})}Nt(s){return r(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=d.StableID.get(e),n=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})}))})}Ct(t,e){var i,n,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!=(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 p.Log.warn("/initialize request encoding failed"),e}}};const O=t=>!!t.sdkKey||(p.Log.warn("Unable to make request without an SDK key"),!1)},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},5902:(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:"")},Kt(t,e){i[t]=e},Ft(t){n&&"-react"!==n||(n="-"+t)}}},6830:(t,n)=>{$Q2(n,"__esModule",{value:!0}),n.At=n.qt=n.zt=n.Mt=n.Jt=n.Lt=void 0;n.Lt=()=>"undefined"!=typeof window?window:null,n.Jt=()=>{var t=(0,n.Lt)();return null!=(t=null==t?void 0:t.document)?t:null},n.Mt=()=>{var t;return null===(0,n.Jt)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},n.zt=(t,e)=>{var i=(0,n.Lt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.qt=(t,e)=>{var i=(0,n.Jt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.At=()=>{var t;try{return null==(t=(0,n.Lt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,i)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const n=i(2137),r=i(7512),o=i(4534),u=i(8023),l=18e5,a=144e5,c={};function d(e,t){return setTimeout(()=>{var t=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function h(t){return"statsig.session_id."+(0,n.u)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=h(t);return(0,o.F)(t)}(t);var i=Date.now();e=e||{sessionID:(0,u.getUUID)(),startTime:i,lastUpdate:i};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),i=t.data,n=((function({lastUpdate:t}){return Date.now()-t>l}(i)||function({startTime:t}){return Date.now()-t>a}(i))&&(i.sessionID=(0,u.getUUID)(),i.startTime=e),i.lastUpdate=e,i),s=t.sdkKey;s=h(s);try{(0,o.J)(s,n)}catch(t){r.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=i.startTime,i=t.sdkKey,t.idleTimeoutID=d(i,l),t.ageTimeoutID=d(i,a-e),t},overrideInitialSessionID:(t,e)=>{var i;c[e]=(t=t,e=e,i=Date.now(),{data:{sessionID:t,startTime:i,lastUpdate:i},sdkKey:e})}}},9122:(t,e,i)=>{$Q(e),e.StableID=void 0;const n=i(2137),s=i(7512),r=i(4534),o=i(8023),u={};function l(t){return"statsig.stable_id."+(0,n.u)(t)}function a(t,e){e=l(e);try{(0,r.J)(e,t)}catch(t){s.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==u[e]){let t=function(t){t=l(t);return(0,r.F)(t)}(e);null==t&&a(t=(0,o.getUUID)(),e),u[e]=t}return u[e]},setOverride:(t,e)=>{a(u[e]=t,e)}}},1375:function(t,e,i){var n=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,i(1845);const o=i(1845),u=i(5542),l=i(7770),a=i(7512),c=i(6830),d=i(4143),h=i(4534);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.xn=null,this.Vt={};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.Bt(!0),null!=n&&n.initialSessionID&&d.StatsigSession.overrideInitialSessionID(n.initialSessionID,t),null!=n&&n.storageProvider&&h.Storage.de(n.storageProvider),this.S=t,this.p=null!=n?n:{},this.overrideAdapter=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Ht=new l.EventLogger(t,r,i,n),this.Wt=new u.ErrorBoundary(t,n,r),this.Wt.wrap(this),this.Wt.wrap(i),this.Wt.wrap(e),this.Wt.wrap(this.Ht),this.dataAdapter=e,this.dataAdapter.attach(t,n),this.storageProvider=h.Storage,this.Yt(),s=t,r=this,(0,c.Mt)()||(i=(0,o.o)(),e=null!=(e=i.instances)?e:{},r=r,null!=e[s]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[s]=r,i.lastInstance=r,i.instances=e,__STATSIG__=i)}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 n(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.Qt("Uninitialized",null),this.xn=null,yield this.Ht.stop()})}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(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.Wt.logError("__emit:"+i.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Vt[i.name]&&this.Vt[i.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,i){!0===(null==i?void 0:i.disableExposureLog)?this.Ht.incrementNonExposureCount(t):this.Ht.enqueue(e)}}},2636:(t,e)=>{$Q(e)},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Zt=e.te=e.ee=e.yt=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",l=(t,e,i,n,s)=>(i.bootstrapMetadata&&(n.bootstrapMetadata=i.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:r(i,n),secondaryExposures:s,time:Date.now()});e.yt=({eventName:t})=>t===n||t===i,e.ee=(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.te=(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.Zt=(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)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.2.0-beta.1";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},586:(t,e)=>{$Q(e)},1098:(t,e)=>{$Q(e)},2059:(t,e,i)=>{$Q(e),e.ie=e.ne=e.se=e.re=e.oe=e.ue=void 0;const r=i(6634),s="default";function o(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({},o(t,e,i,n)),{get:u(null==i?void 0:i.value)})}function u(n,s){return(t,e)=>{var i=null!=(i=null==n?void 0:n[t])?i:null;return null!=i&&(null==e||(0,r.le)(i,e))?(null!=s&&s(t),i):null!=e?e:null}}e.ue=function(t,e,i){return o(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({},o(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=u},1812:(t,e)=>{$Q(e)},8578:(t,e,i)=>{$Q(e),e.v=e.A=void 0;const n=i(1406),s=i(7512);e.A=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment&&(i.statsigEnvironment=e.environment),i}catch(t){return s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,n.Dt)(t):null}},4534:(t,i,e)=>{$Q2(i,"__esModule",{value:!0}),i.J=i.F=i.Storage=void 0;var n=e(7512),e=e(6830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let o=null;try{const a=(0,e.Lt)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>a.localStorage.getItem(t),setItem:(t,e)=>a.localStorage.setItem(t,e),removeItem:t=>a.localStorage.removeItem(t),getAllKeys:()=>Object.keys(a.localStorage)})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==o&&void 0!==o?o:r,l=u;i.Storage={isReady:()=>l.isReady(),isReadyResolver:()=>l.isReadyResolver(),getProviderName:()=>l.getProviderName(),getItem:t=>{var e=()=>l.getItem(t);try{return e()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return i.Storage.de(r),null;throw t}},setItem:(t,e)=>l.setItem(t,e),removeItem:t=>l.removeItem(t),getAllKeys:()=>l.getAllKeys(),de:t=>{u=t,l=t},Bt:t=>{l=t?r:u}},i.F=function(t){return t=i.Storage.getItem(t),JSON.parse(null!=t?t:"null")},i.J=function(t,e){i.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,i)=>{$Q(e),e.C=void 0;const s=i(7512);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}},6634:(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 i=t=>Array.isArray(t)?"array":typeof t;return i(t)===i(e)}},8023:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},9638:(t,e)=>{$Q(e),e.ut=void 0,e.ut=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},2397:(t,e,i)=>{$Q(e),e.ve=e.lt=e.Ut=e.Ot=void 0;i=i(6830);const n="foreground",s="background",r=[];let o=n,u=!1;e.Ot=()=>o===n,e.Ut=()=>u,e.lt=t=>{r.unshift(t)};e.ve=e=>{e!==o&&(o=e,r.forEach(t=>t(e)))},(0,i.zt)("focus",()=>{(u=!1,e.ve)(n)}),(0,i.zt)("blur",()=>(0,e.ve)(s)),(0,i.zt)("beforeunload",()=>{u=!0,(0,e.ve)(s)}),(0,i.qt)("visibilitychange",()=>{(0,e.ve)("visible"===document.visibilityState?n:s)})},6914:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),e.Diagnostics=e.Log=e.Storage=e.EventLogger=void 0,i(1845);const r=i(8962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return r.Diagnostics}}),i(7770)),u=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return u.Log}});var l=i(8e3);const a=i(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),s(i(1845),e),s(i(2137),e),s(i(6427),e),s(i(694),e),s(i(8962),e),s(i(3539),e),s(i(5542),e),s(i(2922),e),s(i(2417),e),s(i(1406),e),s(i(1333),e),s(i(7512),e),s(i(7023),e),s(i(7410),e),s(i(1405),e),s(i(1361),e),s(i(6830),e),s(i(5902),e),s(i(4143),e),s(i(9122),e),s(i(1375),e),s(i(2636),e),s(i(3206),e),s(i(1637),e),s(i(8e3),e),s(i(586),e),s(i(2059),e),s(i(1812),e),s(i(8578),e),s(i(1098),e),s(i(4534),e),s(i(3401),e),s(i(6634),e),s(i(9638),e),s(i(8023),e),s(i(2397),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:u.Log,SDK_VERSION:l.SDK_VERSION})},2016:(t,e,i)=>{$Q(e),e.AutoInit=void 0;const v=i(6914),f=i(2018);function _(t,e){var i;return null!=(i=e.get(t))?i:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,i,n;try{var s=(0,v.Lt)(),r=(0,v.Jt)();if(s&&r&&r.currentScript){var o=r.currentScript.getAttribute("src"),u=null==(t=s.location)?void 0:t.href;if(o&&u){var l=new URL(o,u).searchParams,a=null!=(i=_("sdkKey",l))?i:_("apiKey",l);if(a){var c={},d=_("proxy",l),h=(d&&(c.networkConfig={api:d}),null==(n=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:n[a]);let t=null;(t=h instanceof f.StatsigClient?h:t)||(t=new f.StatsigClient(a,function(){var t=(0,v.Lt)();if(!t)return{};let e=t.statsigUser||{};var i=(e="object"!=typeof e?{}:e).custom||{},n=e.customIDs||{};return $P($P({},e),{customIDs:$P({},n),custom:$P($P({},i),{useragent:t.navigator.userAgent,page_url:(0,v.At)()||"",language:null==(n=t.navigator)?void 0:n.language})})}(),c)).initializeAsync().catch(t=>{v.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){v.Log.error("AutoInit failed",t)}}}},7262:(t,e,i)=>{$Q(e),e.fe=void 0;const n=i(6914);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.fe=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.Dt)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs},2))===e.checksumV2?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},4845:(t,e,i)=>{$Q(e);const s=i(6914);e.default=class{constructor(t){this.S=t,this._e=null,this.ge=null,this.be="Uninitialized",this.ye=0,this.me=0,this.bi=null,this.mi=new Set}reset(){this.ge=null,this._e=null,this.be="Loading",this.ye=0,this.me=0,this.bi=null}finalize(){this.ge||(this.be="NoValues")}getValues(){return this._e?(0,s.C)(this._e,"has_updates","EvaluationStoreValues"):null}setValues(t,e){var i;return!!t&&null!=(i=(0,s.C)(t.data,"has_updates","EvaluationResponse"))&&(this.be=t.source,!0===(null==i?void 0:i.has_updates)&&(this._e=t.data,this.ye=i.time,this.me=t.receivedAt,this.ge=i,this.bi=this.pi(t.source,i),t.source)&&i.user&&this.yi(e,i),!0)}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)}pi(t,e){return"Bootstrap"!==t?null:(t={},e.user&&(t.user=e.user),e.sdkInfo&&(t.generatorSDKInfo=e.sdkInfo),t.lcut=e.time,t)}pe(t,e){let i=null;return{result:i=t?t[e]||t[(0,s.h)(e)]:i,details:this.Se(null==i)}}yi(t,e){var i,n=s.StableID.get(this.S);(null==(i=t.customIDs)?void 0:i.stableID)!==n?this.mi.add("StableIDMismatch"):"user"in e&&(i=e.user,(0,s.v)(t)!==(0,s.v)(i))&&this.mi.add("PartialUserMatch")}getCurrentSourceDetails(){var t;return"Uninitialized"===this.be||"NoValues"===this.be?{reason:this.be}:(t={reason:this.be,lcut:this.ye,receivedAt:this.me},0<this.mi.size&&(t.warnings=Array.from(this.mi)),t)}Se(t){var e=this.getCurrentSourceDetails();let i=e.reason;var n=null!=(n=e.warnings)?n:[],t=("Bootstrap"===this.be&&0<n.length&&(i+=n[0]),"Uninitialized"!==i&&"NoValues"!==i&&(i=i+":"+(t?"Unrecognized":"Recognized")),"Bootstrap"===this.be&&null!=(n=this.bi)?n:void 0);return t&&(e.bootstrapMetadata=t),$P($P({},e),{reason:i})}}},8448:function(t,e,i){var o=this&&this.__awaiter||$A();$Q(e);const u=i(6914),l=i(7262);class n 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(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.je(i,t,e,s)})}je(e,i,n,s){var r;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Oe,data:n,retries:2,isStatsigEncodable:!0,priority:s,isInitialize:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(r=null==t?void 0:t.body)?r:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(r=t.body)?void 0:r.includes('"is_delta":true'))||!0!==n.deltasResponseRequested?t.body:"string"==typeof(t=(0,l.fe)(i,t.body))?t:this.je(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}),s)})}}e.default=n},3583:(t,e,i)=>{$Q(e),e.Te=void 0;const g=i(6914),b={disableExposureLog:!0};function p(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 i,n,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,p(_)?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:(p(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:(p(u)&&c.getExperiment(l.experiment_name),o);case"layer":return o=h,n=e,s=_,m(r=(i=v).getLayer(o.layer_name,b).get(o.param_name),n)?n:(p(s)&&i.getLayer(o.layer_name).get(o.param_name),r);default:return e}}}},8198:function(t,e,i){var s=this&&this.__awaiter||$A();$Q(e);const o=i(6914),u=i(4845),l=i(8448),r=i(3583),a=i(4131);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)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){o.SDKType.Kt(t,"javascript-client");var n,s=new l.default(i,t=>{this.$emt(t)}),s=(super(t,null!=(n=null==i?void 0:i.dataAdapter)?n:new a.StatsigEvaluationsDataAdapter,s,i),this.we=new u.default(t),this.Ie=(0,o.A)(e,i),null!=(n=null==i?void 0:i.plugins)?n:[]);for(const r of s)r.bind(this)}initializeSync(t){"Uninitialized"===this.loadingStatus&&(this.Ht.start(),this.updateUserSync(this.Ie,t))}initializeAsync(t){return s(this,void 0,void 0,function*(){return this.xn||(this.xn=this.Dn(t)),this.xn})}updateUserSync(t,e){this.Ae(t);t=this.dataAdapter.getDataSync(this.Ie),this.we.setValues(t,this.Ie),this.Me(t),e=null==e?void 0:e.disableBackgroundCacheRefresh;!0===e||null==e&&"Bootstrap"===(null==t?void 0:t.source)||this.xe(null!=t?t:null,this.Ie)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.Ae(i);var t=this.Ie,e=(o.Diagnostics.gn(this.S),this.dataAdapter.getDataSync(t));if(this.we.setValues(e,this.Ie),this.Qt("Loading",e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.Ie){let t=!1;null!=e&&(o.Diagnostics.yn(this.S),t=this.we.setValues(e,this.Ie),o.Diagnostics.On(this.S,{success:t})),this.Me(e),t||this.$emt({name:"initialization_failure"}),o.Diagnostics.mn(this.S,t,this.we.getCurrentSourceDetails()),o.Diagnostics.Tn(this.Ie,this.Ht,this.S,this.p)}})}getContext(){return{sdkKey:this.S,options:this.p,values:this.we.getValues(),user:JSON.parse(JSON.stringify(this.Ie)),errorBoundary:this.Wt,session:o.StatsigSession.get(this.S),stableID:o.StableID.get(this.S)}}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var{result:i,details:n}=this.we.getGate(t),n=(0,o.ue)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.ee)(this.Ie,i),e),this.$emt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.oe)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e){var{result:i,details:n}=this.we.getConfig(t),n=(0,o.re)(t,n,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,n,this.Ie,e),i=null!=s?s:n;return this.Xt(t,(0,o.te)(this.Ie,i),e),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,i){var{result:t,details:n}=this.we.getLayer(e),n=(0,o.se)(e,n,t),s=null==(s=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.Ie,i);const r=(0,o.ne)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Xt(e,(0,o.Zt)(this.Ie,r,t),i)});return this.$emt({name:"layer_evaluation",layer:r}),r}getParameterStore(t,e){var{result:i,details:n}=this.we.getParamStore(t);return this.Ht.incrementNonExposureCount(t),{name:t,details:n,__configuration:i,get:(0,r.Te)(this,i,e)}}logEvent(t,e,i){this.Ht.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.Ie,time:Date.now()}))}Yt(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Me(null)})}Dn(t){return s(this,void 0,void 0,function*(){return o.Storage.isReady()||(yield o.Storage.isReadyResolver()),this.Ht.start(),this.updateUserAsync(this.Ie,t)})}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);t=null==(t=this.Ie.customIDs)?void 0:t.stableID;t&&o.StableID.setOverride(t,this.S)}}e.default=n},4131:function(t,e,i){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigEvaluationsDataAdapter=void 0;const n=i(6914),s=i(8448);class 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,(0,n.A)(e,this.p),i)}prefetchData(t,e){return this.k(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. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}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},2018:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),$Q2(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)},r=($Q(e),e.StatsigClient=void 0,i(8198));e.StatsigClient=r.default,s(i(6914),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigClient:r.default}),e.default=__STATSIG__},4535:(t,e,i)=>{$Q(e),e.AutoCapture=e.runStatsigAutoCapture=e.StatsigAutoCapturePlugin=void 0;const c=i(6914),n=i(6325),s=i(6901);function r(t){return new o(t)}e.StatsigAutoCapturePlugin=class{constructor(){this.__plugin="auto-capture"}bind(t){r(t)}},e.runStatsigAutoCapture=r;class o{constructor(t){this.De=t,this.We=Date.now(),this.Ye=0,this.In={},this.Si=null;var{sdkKey:t,errorBoundary:e,values:i}=t.getContext(),i=(this.In=null!=(i=null==(i=null==i?void 0:i.auto_capture_settings)?void 0:i.disabled_events)?i:{},this.Wt=e,this.Wt.wrap(this),(0,c.Jt)());(0,c.Mt)()||((e=null!=(e=(__STATSIG__=(0,c.o)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==i?void 0:i.readyState)?i.addEventListener("DOMContentLoaded",()=>this.Qe()):this.Qe()}Xe(){const e=(0,c.Lt)();var t,i=(0,c.Jt)();e&&i&&(t=t=>{this.Ze(t||e.event)},(0,n.ti)(i,"click",t),(0,n.ti)(i,"submit",t),(0,n.ti)(e,"error",t),(0,n.ti)(e,"beforeunload",()=>this.ei()),(0,n.ti)(e,"scroll",()=>this.ii()))}Oi(){var t=(0,c.Lt)(),e=(0,c.Jt)();t&&e&&((0,n.ti)(t,"popstate",()=>this.ji()),window.history.pushState=new Proxy(window.history.pushState,{apply:(t,e,[i,n,s])=>{t.apply(e,[i,n,s]),this.ji()}}),this.ji())}Ze(t){var e;let i=null==(e=t.type)?void 0:e.toLowerCase();"error"===i&&t instanceof ErrorEvent?this.ni(t):(e=(0,n.si)(t))&&(0,n.dt)(t,e)&&("submit"===i&&(i="form_submit"),{value:t,metadata:e}=(0,n.ri)(e),this.oi(i,t,e))}Qe(){this.Xe(),this.Oi(),this.ui(),this.ai()}ni(t){var e=(null==t?void 0:t.error)||{};let i=e;if("object"==typeof e)try{i=JSON.stringify(e)}catch(t){i="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.oi("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:i})}ui(){var t=this.ci();try{this.hi(t)&&this.oi("session_start",(0,n.di)(),{sessionID:t.data.sessionID},{flushImmediately:!0})}catch(t){this.Wt.logError("AC::logSession",t)}}ji(){var t=(0,n.vi)(),e=this.Si;e&&t.href===e.href||(this.Si=t,e=(0,s.fi)(t),this.oi("page_view",(0,n.di)(),e,{flushImmediately:!0,addNewSessionMetadata:!0}))}ai(){const i=(0,c.Lt)();void 0!==(null===i||void 0===i?void 0:i.performance)&&"function"==typeof i.performance.getEntriesByType&&"function"==typeof i.performance.getEntriesByName&&setTimeout(()=>{var t={},e=i.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),i.performance.getEntriesByName("first-contentful-paint")),e=(e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),(0,n.gi)());e&&(t.effective_connection_type=e.effectiveType,t.rtt_ms=e.rtt,t.downlink_kbps=e.downlink,t.save_data=e.saveData),this.oi("performance",(0,n.di)(),t)},1)}ei(){this.oi("page_view_end",(0,n.di)(),{scrollDepth:this.Ye,pageViewLength:Date.now()-this.We},{flushImmediately:!0})}oi(t,e,i,n){var s,r,o;if(!this.In[t]){var u=this.ci();try{var l=$P({sessionID:u.data.sessionID,page_url:null!=(o=null==(r=null==(s=(0,c.Lt)())?void 0:s.location)?void 0:r.href)?o:""},i),a=(null!=n&&n.addNewSessionMetadata&&(l.isNewSession=String(this.hi(u))),{eventName:"auto_capture::"+t,value:e,metadata:l});this.De.logEvent(a),null!=n&&n.flushImmediately&&this.De.flush().catch(t=>{c.Log.error(t)})}catch(t){this.Wt.logError("AC::enqueue",t)}}}ii(){var t=null!=(t=null==(t=(0,c.Jt)())?void 0:t.body.scrollHeight)?t:1,e=(0,c.Lt)(),i=null!=(i=null==e?void 0:e.scrollY)?i:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ye=Math.max(this.Ye,Math.min(100,Math.round((i+e)/t*100)))}hi(t){return Math.abs(t.data.startTime-Date.now())<1e3}ci(){return this.De.getContext().session}}e.AutoCapture=o},6325:(t,e,i)=>{$Q(e),e.gi=e.ti=e.di=e.vi=e.dt=e.si=e.ri=e.fn=void 0;const r=i(6914);function o(t){var e={};if(t){var i=null==t?void 0:t.dataset;if(i)for(const n in i)e["data-"+n]=i[n]||""}return e}function u(e){if(e){let t=e;for(;t;){var i=t.tagName.toLowerCase();if(["body","document"].includes(i))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.fn=o,e.ri=function(t){var e=t.tagName.toLowerCase(),i={},n=(0,r.At)()||"",s=("form"===(i.tagName=e)&&(i.action=t.getAttribute("action"),i.method=null!=(s=t.getAttribute("method"))?s:"GET",i.formName=t.getAttribute("name"),i.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(i.content=t.value,i.inputName=t.getAttribute("name")),u(t));return s&&(i.href=s.getAttribute("href")),"button"!==e&&!s||(i.content=(t.textContent||"").trim(),e=o(s||t),$P(i,e)),{value:n,metadata:i}},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 i=e.tagName.toLowerCase(),n=t.type.toLowerCase();switch(i){case"html":return!1;case"form":return"submit"===n;case"input":case"select":case"textarea":return["change"].includes(n);default:if("click"===n){if("button"===i)return!0;if(u(e))return!0}return!1}},e.vi=function(){var t=null!=(t=null==(t=null==(t=(0,r.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,r.At)()||""},e.ti=function(t,e,i){t&&t.addEventListener&&t.addEventListener(e,i,!0)},e.gi=function(){var t=(0,r.Lt)();return t&&t.navigator&&t.navigator.connection||null}},1964:(t,e,i)=>{$Q(e),e.StatsigAutoCapturePlugin=e.runStatsigAutoCapture=e.AutoCapture=void 0;const n=i(4535);$Q2(e,"AutoCapture",{enumerable:!0,get:function(){return n.AutoCapture}}),$Q2(e,"StatsigAutoCapturePlugin",{enumerable:!0,get:function(){return n.StatsigAutoCapturePlugin}}),$Q2(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return n.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:n.AutoCapture,runStatsigAutoCapture:n.runStatsigAutoCapture,StatsigAutoCapturePlugin:n.StatsigAutoCapturePlugin}),e.default=__STATSIG__},6901:(t,e,i)=>{$Q(e),e.fi=void 0;const a=i(6914);e.fi=function(t){var e=(0,a.Jt)(),i=(0,a.Lt)();if(!e||!i)return{};var n=null==i?void 0:i.navigator,s=(null==e?void 0:e.referrer)||"";let r=new URL("empty:");if(s)try{r=new URL(s||"empty:")}catch(t){}u=r,o=function(t){const e=t.hostname,i=["google","bing","yahoo","duckduckgo","baidu"].find(t=>e.includes(t+"."));return i||""}(u),u=u.searchParams.get("yahoo"===o?"p":"q")||"";var o={searchEngine:o,searchQuery:u},u=function(t){const i=t.searchParams,n={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","gclsrc","dclid","fbclid","msclkid","mc_eid","mc_cid","twclid","li_fat_id","igshid","utm_id","ttc","ttclid","ttc_id"].forEach(t=>{var e=i.get(t);e&&(n[t]=e)}),n}(t);const 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==n?void 0:n.language)||"unknown",hostname:t.hostname||"unknown",pathname:t.pathname||"unknown",referrer:s,screen_width:(null==(o=null==i?void 0:i.screen)?void 0:o.width)||"unknown",screen_height:(null==(u=null==i?void 0:i.screen)?void 0:u.height)||"unknown",viewport_width:(null==i?void 0:i.innerWidth)||"unknown",viewport_height:(null==i?void 0:i.innerHeight)||"unknown"})}}},n={};function 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}s.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=s(1964);var r=s(2016);e.default=__STATSIG__,r.AutoInit.attempt(({client:t})=>{new o.AutoCapture(t)})}return t.default})()); |
{ | ||
"name": "@statsig/js-client", | ||
"version": "3.1.0", | ||
"version": "3.2.0-beta.1", | ||
"dependencies": { | ||
"@statsig/client-core": "3.1.0" | ||
"@statsig/client-core": "3.2.0-beta.1" | ||
}, | ||
@@ -7,0 +7,0 @@ "jsdelivr": "./build/statsig-js-client.min.js", |
@@ -5,5 +5,6 @@ import { StatsigGlobal } from '@statsig/client-core'; | ||
export * from '@statsig/client-core'; | ||
export type { StatsigEnvironment, StatsigEvent, StatsigUser, InitializeResponse, } from '@statsig/client-core'; | ||
export { StatsigClient, StatsigOptions }; | ||
export type { StatsigEnvironment, StatsigEvent, StatsigUser, InitializeResponse, StatsigPlugin, } from '@statsig/client-core'; | ||
export type { StatsigOptions }; | ||
export { StatsigClient }; | ||
declare const _default: StatsigGlobal; | ||
export default _default; |
@@ -8,3 +8,2 @@ import { DataAdapterAsyncOptions, DataAdapterSyncOptions, DynamicConfig, DynamicConfigEvaluationOptions, EvaluationsDataAdapter, Experiment, ExperimentEvaluationOptions, FeatureGate, FeatureGateEvaluationOptions, Layer, LayerEvaluationOptions, ParameterStore, ParameterStoreEvaluationOptions, PrecomputedEvaluationsContext, PrecomputedEvaluationsInterface, StatsigClientBase, StatsigEvent, StatsigUser } from '@statsig/client-core'; | ||
private _user; | ||
private _initializePromise; | ||
/** | ||
@@ -11,0 +10,0 @@ * Retrieves an instance of the StatsigClient based on the provided SDK key. |
@@ -44,3 +44,3 @@ "use strict"; | ||
constructor(sdkKey, user, options = null) { | ||
var _a; | ||
var _a, _b; | ||
client_core_1.SDKType._setClientType(sdkKey, 'javascript-client'); | ||
@@ -51,5 +51,8 @@ const network = new Network_1.default(options, (e) => { | ||
super(sdkKey, (_a = options === null || options === void 0 ? void 0 : options.dataAdapter) !== null && _a !== void 0 ? _a : new StatsigEvaluationsDataAdapter_1.StatsigEvaluationsDataAdapter(), network, options); | ||
this._initializePromise = null; | ||
this._store = new EvaluationStore_1.default(sdkKey); | ||
this._user = (0, client_core_1._normalizeUser)(user, options); | ||
const plugins = (_b = options === null || options === void 0 ? void 0 : options.plugins) !== null && _b !== void 0 ? _b : []; | ||
for (const plugin of plugins) { | ||
plugin.bind(this); | ||
} | ||
} | ||
@@ -56,0 +59,0 @@ /** |
@@ -1,2 +0,3 @@ | ||
import { CustomCacheKeyGenerator, EvaluationsDataAdapter, Flatten, NetworkConfigCommon, StatsigOptionsCommon } from '@statsig/client-core'; | ||
import { CustomCacheKeyGenerator, EvaluationsDataAdapter, Flatten, NetworkConfigCommon, StatsigOptionsCommon, StatsigPlugin } from '@statsig/client-core'; | ||
import StatsigClient from './StatsigClient'; | ||
type UrlOverrideOptions = Flatten<NetworkConfigCommon & { | ||
@@ -26,3 +27,7 @@ /** | ||
customUserCacheKeyFunc?: CustomCacheKeyGenerator; | ||
/** | ||
* Register various plugins to run along with your StatsigClient (eg SessionReplay or AutoCapture) | ||
*/ | ||
plugins?: StatsigPlugin<StatsigClient>[]; | ||
}>; | ||
export {}; |
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
258198
1234
3
+ Added@statsig/client-core@3.2.0-beta.1(transitive)
- Removed@statsig/client-core@3.1.0(transitive)