@statsig/js-on-device-eval-client 3.12.0 → 3.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((t,r,u,l)=>{return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})});var n={1845:(t,n,e)=>{var i;$Q2(n,"__esModule",{value:!0}),n.t=n.i=n.l=void 0;const r=e(7512);n.l=()=>__STATSIG__||l,n.i=t=>(0,n.l)()[t];n.t=t=>{var e=(0,n.l)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&r.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var s="__STATSIG__",u="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},o="undefined"!=typeof globalThis?globalThis:{};const l=null!=(i=null!=(i=null!=(i=u[s])?i:e[s])?i:o[s])?i:{instance:n.t};u[s]=l,e[s]=l,o[s]=l},2137:(t,e,n)=>{$Q(e),e.o=e.u=void 0;const r=n(1406);function i(t,e,n){if(n)return n(t,e);const i=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(n=null==e?void 0:e.userID)?n:""),"cids:"+Object.keys(i).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+i[t]).join(","),"k:"+t];return(0,r.h)(e.join("|"))}e.u=i,e.o=function(t,e,n){return e?i(t,e,n):(0,r.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.Wn=e.DataAdapterCore=void 0;const l=n(7512),a=n(9122),s=n(8578),u=n(4534),c=n(3401);function h(t,e,n,i){return{source:t,data:e,receivedAt:Date.now(),stableID:n,fullUserHash:(0,s.v)(i)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.p=e,this.m=null,this.O=null,this.j="statsig.last_modified_time."+e,this.S=new i}attach(t,e){this.O=t,this.m=e}getDataSync(t){var t=t&&(0,s.T)(t,this.m),e=this.k(t),n=this.S.get(e,t);return n||((n=this.I(e))?(this.S.add(e,n),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,s.T)(e,this.m),n=this.k(e);this.S.add(n,h("Bootstrap",t,null,e))}D(e,n,i){return r(this,void 0,void 0,function*(){u.Storage.isReady()||(yield u.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(n),t=[this.M(t,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(l.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}A(n,i){return r(this,void 0,void 0,function*(){var t=n&&(0,s.T)(n,this.m),e=this.k(t),t=yield this.D(null,t,i);t&&this.S.add(e,$P($P({},t),{source:"Prefetch"}))})}M(s,u,o){return r(this,void 0,void 0,function*(){let t=null;s&&this.N(s,u)&&(t=s.data);var e=yield this.R(t,u,o);if(!e)return l.Log.debug("No response returned for latest value"),null;var n=(0,c.P)(e,"has_updates","Response"),i=this.C(),i=a.StableID.get(i);let r=null;if(!0===(null==n?void 0:n.has_updates))r=h("Network",e,i,u);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;r=h("NetworkNotModified",t,i,u)}e=this.k(u);return this.S.add(e,r),this.U(e,r),r})}C(){return null!=this.O?this.O:(l.Log.error(this._+" is not attached to a Client"),"")}I(t){var e=null==(e=u.Storage.getItem)?void 0:e.call(u.Storage,t);return null!=e&&(t=(0,c.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}U(t,e){u.Storage.setItem(t,JSON.stringify(e)),this.F(t)}F(t){var e=null!=(e=(0,u.G)(this.j))?e:{},t=(e[t]=Date.now(),o(e,10));t&&(delete e[t],u.Storage.removeItem(t)),(0,u.L)(this.j,e)}},e.Wn=h;class i{constructor(){this.K={}}get(t,e){var t=this.K[t],n=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&n&&e!==n?(l.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var n=o(this.K,9);n&&delete this.K[n],this.K[t]=e}merge(t){this.K=$P($P({},this.K),t)}}function o(r,t){var e=Object.keys(r);return e.length<=t?null:e.reduce((t,e)=>{var n=r[t],i=r[e];return"object"==typeof n&&"object"==typeof i?i.receivedAt<n.receivedAt?e:t:i<n?e:t})}},8962:(t,u)=>{$Q2(u,"__esModule",{value:!0}),u.Diagnostics=void 0;const i=new Map,n="start";function r(t,e,n,i){return $P({key:n,action:e,step:i,timestamp:Date.now()},t)}function s(t,e){var n=null!=(n=i.get(t))?n:[];n.push(e),i.set(t,n)}function e(t,e){if(e in t)return t[e]}u.Diagnostics={q:t=>i.get(t),B:t=>{s(t,r({},n,"overall"))},V:(t,e,n)=>{s(t,r({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},"end","overall"))},J:(t,e)=>{s(t,r(e,n,"initialize","network_request"))},$:(t,e)=>{s(t,r(e,"end","initialize","network_request"))},W:t=>{s(t,r({},n,"initialize","process"))},H:(t,e)=>{s(t,r(e,"end","initialize","process"))},Y:t=>{i.delete(t)},X(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Z(t,e,n,i){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===n.includes('"is_delta":true')||void 0,attempt:e,error:u.Diagnostics.X(i)}},tt(t,e,n,i){var r,s=u.Diagnostics.q(n);return null==s||s.length<=0?-1:(r=s[s.length-1].timestamp-s[0].timestamp,u.Diagnostics.Y(n),n=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:i}),e.enqueue(n),r)}}},8809:function(t,e){var n=this&&this.__awaiter||$A();$Q(e),e.et=void 0;const r=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),s="https://cloudflare-dns.com/dns-query",u=["i","e","d"],o=200;e.et=function(e){return n(this,void 0,void 0,function*(){var n=yield e(s,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:r});if(n.ok){var t,n=yield n.arrayBuffer(),n=new Uint8Array(n);{var i=n,n=i.findIndex((t,e)=>e<o&&"="===String.fromCharCode(t)&&u.includes(String.fromCharCode(i[e-1])));if(-1===n)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=n-1;t<i.length;t++)e+=String.fromCharCode(i[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},3539:(t,e)=>{$Q(e)},5542:function(t,o,e){var n=this&&this.__awaiter||$A();$Q2(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const i=e(7512),l=e(5902),a=e(8e3),c=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");function h(t){return t instanceof Error?t:"string"==typeof t?new Error(t):new Error("An unknown error occurred.")}o.ErrorBoundary=class{constructor(t,e,n,i){this.O=t,this.m=e,this.nt=n,this.qn=i,this.it=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.rt(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.st("eb:wrap",t)}}logError(t,e){this.st(t,e)}getLastSeenErrorAndReset(){var t=this.qn;return this.qn=void 0,null!=t?t:null}attachErrorIfNoneExists(t){this.qn||(this.qn=h(t))}rt(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.st(e,t)):n}catch(t){return this.st(e,t),null}}st(s,u){try{i.Log.warn("Caught error in "+s,{error:u});n(this,void 0,void 0,function*(){var t,e=u||Error(c),n=e instanceof Error,i=n?e.name:"No Name",r=h(e);this.qn=r,this.it.has(i)||(this.it.add(i),null!=(r=null==(r=this.m)?void 0:r.networkConfig)&&r.preventAllNetworkTraffic?null!=(r=this.nt)&&r.call(this,{name:"error",error:u,tag:s}):(r=l.SDKType.lt(this.O),t=a.StatsigMetadataProvider.get(),n=n?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(e),e=JSON.stringify($P({tag:s,exception:i,info:n},$P($P({},t),{sdkType:r}))),yield(null!=(i=null==(n=null==(i=this.m)?void 0:i.networkConfig)?void 0:n.networkOverrideFunc)?i:fetch)(o.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.O,"STATSIG-SDK-TYPE":String(r),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=(n=this.nt)&&n.call(this,{name:"error",error:u,tag:s})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const i=n(2137),r=n(1406),u=n(7512),o=n(7410),l=n(6830),a=n(1637),c=n(4534),h=n(1881),d=n(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static ot(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static ut(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,n,i){this.O=t,this.nt=e,this.ht=n,this.m=i,this.dt=[],this.vt={},this.ft={},this._t=!1,this.gt=Date.now(),this.bt=!0===(null==i?void 0:i.disableLogging),this.yt=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:100;e=null==i?void 0:i.networkConfig;this.Ot=new h.UrlConfiguration(o.Endpoint.jt,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}setLoggingDisabled(t){this.bt=t}enqueue(t){this.St(t)&&(this.wt(t),this.Tt(),this.dt.length>this.yt)&&_.ot(this.O)}incrementNonExposureCount(t){var e=null!=(e=this.ft[t])?e:0;this.ft[t]=e+1}reset(){this.vt={}}start(){(0,l.kt)()||(v[this.O]=this,(0,d.It)(t=>{"background"===t?_.ot(this.O):"foreground"===t&&_.ut(this.O)}),this.ct(f.Startup),this.Dt())}stop(){return s(this,void 0,void 0,function*(){this.Et&&(clearInterval(this.Et),this.Et=null),delete v[this.O],yield this.flush()})}flush(){return s(this,void 0,void 0,function*(){var t;this.Mt(),0!==this.dt.length&&(t=this.dt,this.dt=[],yield this.At(t))})}Tt(){this._t||(this._t=!0,200<Date.now()-this.gt)||setTimeout(()=>_.ot(this.O),200)}St(t){if((0,l.kt)())return!1;if((0,a.xt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,i.u)(this.O,e),n=t.metadata||{},t=[t.eventName,e,n.gate,n.config,n.ruleID,n.allocatedExperiment,n.parameterName,String(n.isExplicitParameter),n.reason].join("|"),e=this.vt[t],n=Date.now();if(e&&n-e<6e5)return!1;1e3<Object.keys(this.vt).length&&(this.vt={}),this.vt[t]=n}return!0}At(n){var i,r;return s(this,void 0,void 0,function*(){if(this.bt)return this.Nt(n),!1;try{var t=(0,d.Rt)()&&this.ht.isBeaconSupported()&&null==(null==(r=null==(i=this.m)?void 0:i.networkConfig)?void 0:r.networkOverrideFunc),e=(this.nt({name:"pre_logs_flushed",events:n}),t?yield this.Pt(n):yield this.Ct(n));return e.success?(this.nt({name:"logs_flushed",events:n}),!0):(u.Log.warn("Failed to flush events."),this.Nt(n),!1)}catch(t){return u.Log.warn("Failed to flush events."),!1}})}Ct(e){var n;return s(this,void 0,void 0,function*(){var t=yield this.ht.post(this.Ut(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}Pt(t){return s(this,void 0,void 0,function*(){return{success:yield this.ht.beacon(this.Ut(t))}})}Ut(t){return{sdkKey:this.O,data:{events:t},urlConfig:this.Ot,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(t.length)}}}Nt(t){for(;500<t.length;)t.shift();var e=this.o();try{(0,c.L)(e,t)}catch(t){u.Log.warn("Unable to save failed logs to storage")}}ct(e){const n=this.o();s(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.G)(n);t&&(e===f.Startup&&c.Storage.removeItem(n),yield this.At(t))&&e===f.GainedFocus&&c.Storage.removeItem(n)}).catch(()=>{u.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,r.h)(this.O)}wt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.Ft(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));u.Log.debug("Enqueued Event:",n),this.dt.push(n)}Mt(){0!==Object.keys(this.ft).length&&(this.wt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.ft)}}),this.ft={})}Ft(){var t;if(!1!==(null==(t=this.m)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.Gt)()}Dt(){var t=null!=(t=null==(t=this.m)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{var t=v[this.O];t&&t.Et===e?_.ot(this.O):clearInterval(e)},t);this.Et=e}}e.EventLogger=_},1406:(t,s,e)=>{$Q2(s,"__esModule",{value:!0}),s.Lt=s.Kt=s.h=void 0;const u=e(6634);s.h=e=>{let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)},s.Kt=(t,e)=>(0,s.h)(JSON.stringify((0,s.Lt)(t,e)));s.Lt=(n,i)=>{if(null==n)return null;var t=Object.keys(n).sort();const r={};return t.forEach(t=>{var e=n[t];0===i||"object"!==(0,u.zt)(e)?r[t]=e:r[t]=(0,s.Lt)(e,null!=i?i-1:i)}),r}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function n(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class i{static info(...t){i.level>=e.LogLevel.Info&&console.info(" INFO ",...n(t))}static debug(...t){i.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...n(t))}static warn(...t){i.level>=e.LogLevel.Warn&&console.warn(" WARN ",...n(t))}static error(...t){i.level>=e.LogLevel.Error&&console.error(" ERROR ",...n(t))}}(e.Log=i).level=e.LogLevel.Warn},7787:(t,e)=>{$Q(e),e.createMemoKey=e.MemoPrefix=void 0,e.MemoPrefix={Kn:"g",Ln:"c",Vn:"e",$n:"l",Bn:"p"};const s=new Set([]),u=new Set(["userPersistedValues"]);e.createMemoKey=function(t,e,n){let i=t+"|"+e;if(n)for(const r of Object.keys(n)){if(u.has(r))return;s.has(r)?i+=`|${r}=true`:i+=`|${r}=`+n[r]}return i}},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=e.Endpoint=void 0,e.Endpoint={qt:"initialize",jt:"rgstr",Bt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.jt]:"https://prodregistryv2.org/v1",[e.Endpoint.qt]:"https://featureassets.org/v1",[e.Endpoint.Bt]:"https://api.statsigcdn.com/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,n){var j=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(1845);const u=n(1845),S=n(8962),w=n(7512),k=n(7410),i=n(308),o=n(5902),l=n(6830),a=n(4143),c=n(9122),x=n(2636),h=n(8e3),D=n(2397),T=500,I=3e4;const N=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.nt=e,this.$t=null,this.Vt=1e4,this.Jt={},this.m={},this.Oi={},this.Jn=null,t&&(this.m=t),this.m.networkConfig&&(this.Jt=this.m.networkConfig),this.Jt.networkTimeoutMs&&(this.Vt=this.Jt.networkTimeoutMs),this.Wt=new i.NetworkFallbackResolver(this.m)}setErrorBoundary(t){this.$t=t,this.$t.wrap(this),this.$t.wrap(this.Wt),this.Wt.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){var t=this.Jn;return this.Jn=null,t}beacon(i){return j(this,void 0,void 0,function*(){var t,e,n;return!!E(i)&&(e=this.Ht("POST",i),t=yield this.Yt(e,i.data),e=yield this.Xt(e),(n=navigator).sendBeacon.bind(n)(e,t))})}post(e){return j(this,void 0,void 0,function*(){var t=this.Ht("POST",e);return t.body=yield this.Yt(t,e.data),e.isStatsigEncodable&&(t.body=this.Qt(t,t.body)),this.Zt(t)})}get(t){t=this.Ht("GET",t);return this.Zt(t)}Zt(y){var b,m,O;return j(this,void 0,void 0,function*(){if(!E(y))return null;if(this.Jt.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i,attempt:r}=y,t=y.urlConfig.endpoint;if(this.Si(t))return w.Log.warn(`Request to ${t} was blocked because you are making requests too frequently.`),null;r=null!=r?r:1;const s="undefined"!=typeof AbortController?new AbortController:null;var u=setTimeout(()=>{null!==s&&void 0!==s&&s.abort(`Timeout of ${this.Vt}ms expired.`)},this.Vt),o=yield this.Xt(y);let l=null;var a=(0,D.Rt)();try{var c,h,d,v={method:e,body:n,headers:$P({},y.headers),signal:null===s||void 0===s?void 0:s.signal,priority:y.priority,keepalive:a},f=(p=r,(g=y).urlConfig.endpoint===k.Endpoint.qt&&S.Diagnostics.J(g.sdkKey,{attempt:p}),this.Oi[t]),_=(f&&(f.lastRequestTime=Date.now(),this.Oi[t]=f),null!=(b=this.Jt.networkOverrideFunc)?b:fetch);if(l=yield _(o,v),clearTimeout(u),l.ok)return d=yield l.text(),A(y,l,r,d),this.Wt.tryBumpExpiryTime(y.sdkKey,y.urlConfig),{body:d,code:l.status};throw c=yield l.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${o} `+c)).name="NetworkError",h}catch(t){var p,n=function(t,e){if(null!=t&&t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return"Unknown Error"}(s,t),a=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(s),g=(A(y,l,r,"",t),yield this.Wt.tryFetchUpdatedFallbackInfo(y.sdkKey,y.urlConfig,n,a));return(g&&(y.fallbackUrl=this.Wt.getActiveFallbackUrl(y.sdkKey,y.urlConfig)),!i||i<r||!N.has(null!=(m=null===l||void 0===l?void 0:l.status)?m:500))?(null!=(m=this.nt)&&m.call(this,{name:"error",error:t,tag:x.ErrorTag.NetworkError,requestArgs:y}),p=`A networking error occurred during ${e} request to ${o}.`,w.Log.error(p,n,t),null!=(O=this.$t)&&O.attachErrorIfNoneExists(p),null):(yield function(e){return j(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(T*(e*e),I)))})}(r),this.Zt($P($P({},y),{retries:i,attempt:r+1})))}})}Si(t){var e=Date.now(),n=null!=(n=this.Oi[t])?n:{count:0,lastRequestTime:e},i=e-n.lastRequestTime,i=Math.floor(.05*i);return n.count=Math.max(0,n.count-i),50<=n.count||(n.count+=1,n.lastRequestTime=e,this.Oi[t]=n,!1)}Xt(i){var r;return j(this,void 0,void 0,function*(){var t=null!=(r=i.fallbackUrl)?r:i.urlConfig.getUrl();i.urlConfig.endpoint!==k.Endpoint.qt&&i.urlConfig.endpoint!==k.Endpoint.Bt||(this.Jn=t);const e=$P({[k.NetworkParam.SdkKey]:i.sdkKey,[k.NetworkParam.SdkType]:o.SDKType.lt(i.sdkKey),[k.NetworkParam.SdkVersion]:h.SDK_VERSION,[k.NetworkParam.Time]:String(Date.now()),[k.NetworkParam.SessionID]:a.SessionID.get(i.sdkKey)},i.params);var n=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(n?"?"+n:"")})}Yt(r,s){return j(this,void 0,void 0,function*(){var{sdkKey:t,fallbackUrl:e}=r,n=c.StableID.get(t),i=a.SessionID.get(t),t=o.SDKType.lt(t);return JSON.stringify($P($P({},s),{statsigMetadata:$P($P({},h.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:t,fallbackUrl:e})}))})}Qt(e,n){var t,i,r=(0,l.te)();if(this.m.disableStatsigEncoding||null!=(0,u.i)("no-encode")||null==r||!r.btoa)return n;try{var s=null!=(t=r.btoa(n).split("").reverse().join(""))?t:n;return e.params=$P($P({},null!=(i=e.params)?i:{}),{[k.NetworkParam.StatsigEncoded]:"1"}),s}catch(t){return w.Log.warn("Request encoding failed for "+e.urlConfig.getUrl()),n}}Ht(t,e){var n=this.Wt.getActiveFallbackUrl(e.sdkKey,e.urlConfig);return $P($P({},e),{method:t,fallbackUrl:n})}};const E=t=>!!t.sdkKey||(w.Log.warn("Unable to make request without an SDK key"),!1);function A(t,e,n,i,r){t.urlConfig.endpoint===k.Endpoint.qt&&S.Diagnostics.$(t.sdkKey,S.Diagnostics.Z(e,n,i,r))}},308:function(t,e,n){var l=this&&this.__awaiter||$A();$Q(e),e.ee=e.NetworkFallbackResolver=void 0;const o=n(8809),i=n(1406),s=n(7512),u=n(4534);function a(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function c(t){return"statsig.network_fallback."+(0,i.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?u.Storage.setItem(t,JSON.stringify(e)):u.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.ne=null,this.$t=null,this.ie={},this.re=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.$t=t}tryBumpExpiryTime(t,e){var n=null==(n=this.ne)?void 0:n[e.endpoint];n&&(n.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ne),{[e.endpoint]:n})))}getActiveFallbackUrl(t,e){var n;let i=this.ne;null==i&&(i=null!=(r=function(t){t=c(t),t=u.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return s.Log.error("Failed to parse FallbackInfo"),null}}(t))?r:{},this.ne=i);var r=i[e.endpoint];return!r||Date.now()>(null!=(n=r.expiryTime)?n:0)?(delete i[e.endpoint],this.ne=i,h(t,this.ne),null):r.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(n,i,r,s){var u,o;return l(this,void 0,void 0,function*(){try{var t,e;return a(r,s)?(t=null==i.customUrl&&null==i.fallbackUrls?yield this.se(i):i.fallbackUrls,!!(e=this.le(null==(u=this.ne)?void 0:u[i.endpoint],t))&&(this.oe(n,i.endpoint,e),!0)):!1}catch(t){return null!=(o=this.$t)&&o.logError("tryFetchUpdatedFallbackInfo",t),!1}})}oe(t,e,n){var n={url:n,expiryTime:Date.now()+6048e5,previous:[]},i=null==(i=this.ne)?void 0:i[e],i=(i&&n.previous.push(...i.previous),10<n.previous.length&&(n.previous=[]),null==(i=null==(i=this.ne)?void 0:i[e])?void 0:i.url);null!=i&&n.previous.push(i),this.ne=$P($P({},this.ne),{[e]:n}),h(t,this.ne)}se(s){var u;return l(this,void 0,void 0,function*(){var t=this.ie[s.endpoint];if(t&&Date.now()<t)return null;this.ie[s.endpoint]=Date.now()+144e5;var e=[],t=yield(0,o.et)(null!=(u=this.re)?u:fetch),n=d(s.defaultUrl);for(const r of t)if(r.startsWith(s.endpointDnsKey+"=")){var i=r.split("=");if(1<i.length){let t=i[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+n)}}return e})}le(t,e){var n;if(null==e)return null;var i=new Set(null!=(n=null==t?void 0:t.previous)?n:[]),r=null==t?void 0:t.url;let s=null;for(const o of e){var u=o.endsWith("/")?o.slice(0,-1):o;if(!i.has(o)&&u!==r){s=u;break}}return s}},e.ee=a},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},3091:(t,e)=>{$Q(e),e.SDKFlags=void 0;const n={};e.SDKFlags={setFlags:(t,e)=>{n[t]=e},get:(t,e)=>{return null!=(t=null==(t=n[t])?void 0:t[e])&&t}}},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={lt:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},ue(t,e){n[t]=e},ae(t){i&&"-react"!==i||(i="-"+t)}}},6830:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.Gt=i.ce=i.he=i.kt=i.de=i.te=void 0;i.te=()=>"undefined"!=typeof window?window:null,i.de=()=>{var t=(0,i.te)();return null!=(t=null==t?void 0:t.document)?t:null},i.kt=()=>{var t;return null===(0,i.de)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},i.he=(t,e)=>{var n=(0,i.te)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.ce=(t,e)=>{var n=(0,i.de)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.Gt=()=>{var t;try{return null==(t=(0,i.te)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,n)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(2137),s=n(7512),u=n(4534),o=n(8023),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,i.o)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,u.G)(t)}(t);var n=Date.now();e=e||{sessionID:(0,o.getUUID)(),startTime:n,lastUpdate:n};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>l}(n)||function({startTime:t}){return Date.now()-t>a}(n))&&(n.sessionID=(0,o.getUUID)(),n.startTime=e),n.lastUpdate=e,n),r=t.sdkKey;r=d(r);try{(0,u.L)(r,i)}catch(t){s.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=h(n,l),t.ageTimeoutID=h(n,a-e),t},overrideInitialSessionID:(t,e)=>{var n;c[e]=(t=t,e=e,n=Date.now(),{data:{sessionID:t,startTime:n,lastUpdate:n},sdkKey:e})}}},9122:(t,e,n)=>{$Q(e),e.StableID=void 0;const i=n(2137),r=n(7512),s=n(4534),u=n(8023),o={};function l(t){return"statsig.stable_id."+(0,i.o)(t)}function a(t,e){e=l(e);try{(0,s.L)(e,t)}catch(t){r.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==o[e]){let t=function(t){t=l(t);return(0,s.G)(t)}(e);null==t&&a(t=(0,u.getUUID)(),e),o[e]=t}return o[e]},setOverride:(t,e)=>{a(o[e]=t,e)}}},1375:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(1845);const u=n(1845),o=n(5542),l=n(7770),a=n(7512),s=n(7787),c=n(6830),h=n(4143),d=n(4534);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.ve=null,this.fe={};var r,s=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&d.Storage._e(!0),null!=i&&i.initialSessionID&&h.StatsigSession.overrideInitialSessionID(i.initialSessionID,t),null!=i&&i.storageProvider&&d.Storage.ge(i.storageProvider),this.O=t,this.m=null!=i?i:{},this.ji={},this.overrideAdapter=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.pe=new l.EventLogger(t,s,n,i),this.$t=new o.ErrorBoundary(t,i,s),this.$t.wrap(this),this.$t.wrap(e),this.$t.wrap(this.pe),n.setErrorBoundary(this.$t),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.storageProvider=d.Storage,this.be(),r=t,s=this,(0,c.kt)()||(n=(0,u.l)(),e=null!=(e=n.instances)?e:{},s=s,null!=e[r]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[r]=s,n.firstInstance||(n.firstInstance=s),n.instances=e,__STATSIG__=n)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.m.disableLogging=t.disableLogging,this.pe.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.m.disableStorage=t.disableStorage,d.Storage._e(t.disableStorage))}flush(){return this.pe.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.me("Uninitialized",null),this.ve=null,yield this.pe.stop()})}on(t,e){this.fe[t]||(this.fe[t]=[]),this.fe[t].push(e)}off(t,e){this.fe[t]&&-1!==(e=this.fe[t].indexOf(e))&&this.fe[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.$t.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.fe[n.name]&&this.fe[n.name].forEach(t=>e(t)),null!=(t=this.fe["*"])&&t.forEach(e)}me(t,e){this.loadingStatus=t,this.ji={},this.$emt({name:"values_updated",status:t,values:e})}ye(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.pe.incrementNonExposureCount(t):this.pe.enqueue(e)}wi(i,r){return(t,e)=>{var n;return!this.m.disableEvaluationMemoization&&(n=(0,s.createMemoKey)(i,t,e))?(n in this.ji||(3e3<=Object.keys(this.ji).length&&(this.ji={}),this.ji[n]=r(t,e)),this.ji[n]):r(t,e)}}}},2636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Oe=e.je=e.Se=e.xt=void 0;const r="statsig::config_exposure",s="statsig::gate_exposure",l="statsig::layer_exposure",a=(t,e,n,i,r)=>(n.bootstrapMetadata&&(i.bootstrapMetadata=n.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:u(n,i),secondaryExposures:r,time:Date.now()});e.xt=({eventName:t})=>t===s||t===r||t===l,e.Se=(t,e)=>{var n,i={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(i.configVersion=e.__evaluation.version),a(s,t,e.details,i,null!=(t=null==(n=e.__evaluation)?void 0:n.secondary_exposures)?t:[])},e.je=(t,e)=>{var n,i={config:e.name,ruleID:e.ruleID};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(i.configVersion=e.__evaluation.version),null!=(null==(n=e.__evaluation)?void 0:n.passed)&&(i.rulePassed=String(e.__evaluation.passed)),a(r,t,e.details,i,null!=(t=null==(n=e.__evaluation)?void 0:n.secondary_exposures)?t:[])};e.Oe=(t,e,n)=>{var i=e.__evaluation,r=!0===(null==(r=null==i?void 0:i.explicit_parameters)?void 0:r.includes(n));let s="",u=null!=(o=null==i?void 0:i.undelegated_secondary_exposures)?o:[];r&&(s=null!=(o=i.allocated_experiment_name)?o:"",u=i.secondary_exposures);var o={config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:s,isExplicitParameter:String(r)};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(o.configVersion=e.__evaluation.version),a(l,t,e.details,o,u)};const u=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.12.0";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},586:(t,e)=>{$Q(e)},1098:(t,e)=>{$Q(e)},2059:(t,e,n)=>{$Q(e),e.we=e.Te=e.ke=e.Ie=e.De=e.Ee=void 0;const u=n(7512),o=n(6634),r="default";function s(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,__evaluation:n,value:i}}function i(t,e,n){var i=null!=(i=null==n?void 0:n.value)?i:{};return $P($P({},s(t,e,n,i)),{get:l(t,null==n?void 0:n.value)})}function l(i,r,s){return(t,e)=>{var n=null!=(n=null==r?void 0:r[t])?n:null;return null==n?null!=e?e:null:null==e||(0,o.Me)(n,e)?(null!=s&&s(t),n):(u.Log.warn(`Parameter type mismatch. '${i}.${t}' was found to be type '${typeof n}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.Ee=function(t,e,n){return s(t,e,n,!0===(null==n?void 0:n.value))},e.De=i,e.Ie=function(t,e,n){return t=i(t,e,n),$P($P({},t),{groupName:null!=(e=null==n?void 0:n.group_name)?e:null})},e.ke=function(t,e,n,i){return $P($P({},s(t,e,n,void 0)),{get:l(t,null==n?void 0:n.value,i),groupName:null!=(e=null==n?void 0:n.group_name)?e:null,__value:null!=(t=null==n?void 0:n.value)?t:{}})},e.Te=function(t,e,n,i){return $P($P($P({},t),e),{get:l(t.name,n,i)})},e.we=l},1812:(t,e)=>{$Q(e)},3932:(t,e)=>{$Q(e),e.UPDATE_DETAIL_ERROR_MESSAGES=e.createUpdateDetails=void 0;e.createUpdateDetails=(t,e,n,i,r,s)=>({duration:n,source:e,success:t,error:i,sourceUrl:r,warnings:s}),e.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}},8578:(t,e,n)=>{$Q(e),e.v=e.T=void 0;const i=n(1406),r=n(7512);e.T=function(t,e,n){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment?i.statsigEnvironment=e.environment:null!=n&&(i.statsigEnvironment={tier:n}),i}catch(t){return r.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,i.Kt)(t):null}},4534:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.L=n.G=n.Storage=void 0;var i=e(7512),e=e(6830);const r={},s={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>r[t]||null,setItem:(t,e)=>{r[t]=e},removeItem:t=>{delete r[t]},getAllKeys:()=>Object.keys(r)};let u=null;try{const a=(0,e.te)();a&&a.localStorage&&"function"==typeof a.localStorage.getItem&&(u={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){i.Log.warn("Failed to setup localStorageProvider.")}let o=null!==u&&void 0!==u?u:s,l=o;n.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 n.Storage.ge(s),null;throw t}},setItem:(t,e)=>l.setItem(t,e),removeItem:t=>l.removeItem(t),getAllKeys:()=>l.getAllKeys(),ge:t=>{o=t,l=t},_e:t=>{l=t?s:o}},n.G=function(t){return t=n.Storage.getItem(t),JSON.parse(null!=t?t:"null")},n.L=function(t,e){n.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,n)=>{$Q(e),e.P=void 0;const r=n(7512);e.P=function(t,e,n){try{var i=JSON.parse(t);if(i&&"object"==typeof i&&e in i)return i}catch(t){}return r.Log.error("Failed to parse "+n),null}},6634:(t,e)=>{$Q(e),e.Me=e.zt=void 0,e.zt=function(t){return Array.isArray(t)?"array":typeof t},e.Me=function(t,e){var n=t=>Array.isArray(t)?"array":typeof t;return n(t)===n(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 n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},1881:(t,e,n)=>{$Q(e),e.UrlConfiguration=void 0;const r=n(7410),s={[r.Endpoint.qt]:"i",[r.Endpoint.jt]:"e",[r.Endpoint.Bt]:"d"};e.UrlConfiguration=class{constructor(t,e,n,i){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=s[t],e&&(this.customUrl=e),!e&&n&&(this.customUrl=n.endsWith("/")?""+n+t:n+"/"+t),i&&(this.fallbackUrls=i);e=r.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},2397:(t,e,n)=>{$Q(e),e.Ae=e.It=e.Rt=e.xe=void 0;n=n(6830);const i="foreground",r="background",s=[];let u=i,o=!1;e.xe=()=>u===i,e.Rt=()=>o,e.It=t=>{s.unshift(t)};e.Ae=e=>{e!==u&&(u=e,s.forEach(t=>t(e)))},(0,n.he)("focus",()=>{(o=!1,e.Ae)(i)}),(0,n.he)("blur",()=>(0,e.Ae)(r)),(0,n.he)("beforeunload",()=>{o=!0,(0,e.Ae)(r)}),(0,n.ce)("visibilitychange",()=>{(0,e.Ae)("visible"===document.visibilityState?i:r)})},6914:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),e.Storage=e.Log=e.EventLogger=e.Diagnostics=void 0,n(1845);const s=n(8962),u=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return s.Diagnostics}}),n(7770)),o=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return u.EventLogger}}),n(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return o.Log}});var l=n(8e3);const a=n(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),r(n(1845),e),r(n(2137),e),r(n(6427),e),r(n(694),e),r(n(8962),e),r(n(3539),e),r(n(5542),e),r(n(2922),e),r(n(2417),e),r(n(1406),e),r(n(1333),e),r(n(7512),e),r(n(7787),e),r(n(7410),e),r(n(7023),e),r(n(1405),e),r(n(1361),e),r(n(6830),e),r(n(5902),e),r(n(4143),e),r(n(9122),e),r(n(1375),e),r(n(2636),e),r(n(3206),e),r(n(1637),e),r(n(8e3),e),r(n(586),e),r(n(1098),e),r(n(2059),e),r(n(1812),e),r(n(8578),e),r(n(4534),e),r(n(3401),e),r(n(6634),e),r(n(1881),e),r(n(8023),e),r(n(2397),e),r(n(3932),e),r(n(3091),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:o.Log,SDK_VERSION:l.SDK_VERSION})},9638:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),r(n(600),e),e.default=__STATSIG__},8494:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const i=n(6914);class s extends i.NetworkCore{constructor(t=null){super(t);t=null==t?void 0:t.networkConfig;this.Pn=new i.UrlConfiguration(i.Endpoint.Bt,null==t?void 0:t.downloadConfigSpecsUrl,null==t?void 0:t.api,null==t?void 0:t.downloadConfigSpecsFallbackUrls)}fetchConfigSpecs(e,n){var i;return r(this,void 0,void 0,function*(){var t=yield this.get({sdkKey:e,urlConfig:this.Pn,priority:n});return null!=(i=null==t?void 0:t.body)?i:null})}}e.default=s},6217:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e);const u=n(6914),r=n(3066),s=n(8494),o=n(2660);class l extends u.StatsigClientBase{static instance(t){var e=(0,u.l)().instance(t);return e instanceof l?e:(u.Log.warn((0,u.kt)()?"StatsigOnDeviceEvalClient.instance is not supported in server environments":"Unable to find StatsigOnDeviceEvalClient instance"),new l(null!=t?t:""))}constructor(t,e=null){u.SDKType.ue(t,"js-on-device-eval-client");var n=new s.default(e);super(t,null!=(t=null==e?void 0:e.dataAdapter)?t:new o.StatsigSpecsDataAdapter,n,e),this.ht=n,this.We=new r.SpecStore,this.Un=new r.Evaluator(this.We)}initializeSync(t){return"Uninitialized"!==this.loadingStatus?{success:!0,duration:0,source:this.We.getSource(),sourceUrl:null,error:null}:(this.pe.start(),this.updateSync(t))}initializeAsync(t){return i(this,void 0,void 0,function*(){return this.ve||(this.ve=this.Ye(t)),this.ve})}updateSync(t){var e=performance.now(),n=(this.We.reset(),this.dataAdapter.getDataSync());return this.We.setValuesFromDataAdapter(n),this.We.finalize(),this.me("Ready",n),null!=t&&t.disableBackgroundCacheRefresh||this.Ze(n),(0,u.createUpdateDetails)(!0,this.We.getSource(),performance.now()-e,this.$t.getLastSeenErrorAndReset(),this.ht.getLastUsedInitUrlAndReset())}updateAsync(n){return i(this,void 0,void 0,function*(){var t=performance.now(),e=(this.We.reset(),this.me("Loading",null),this.dataAdapter.getDataSync());return this.We.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,n),this.We.setValuesFromDataAdapter(e),this.We.finalize(),this.me("Ready",e),(0,u.createUpdateDetails)(!0,this.We.getSource(),performance.now()-t,this.$t.getLastSeenErrorAndReset(),this.ht.getLastUsedInitUrlAndReset())})}getContext(){return{sdkKey:this.O,options:this.m,values:this.We.getValues(),errorBoundary:this.$t,session:u.StatsigSession.get(this.O),stableID:u.StableID.get(this.O)}}checkGate(t,e,n){return this.getFeatureGate(t,e,n).value}getFeatureGate(t,e,n){var e=this.T(e),{evaluation:i,details:r}=this.Un.evaluateGate(t,e),r=(0,u.Ee)(t,r,i);return this.ye(t,(0,u.Se)(e,r),n),this.$emt({name:"gate_evaluation",gate:r}),r}getDynamicConfig(t,e,n){var e=this.T(e),{evaluation:i,details:r}=this.Un.evaluateConfig(t,e),r=(0,u.De)(t,r,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,r,e,n),i=null!=s?s:r;return this.ye(t,(0,u.je)(e,i),n),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e,n){var e=this.T(e),{evaluation:i,details:r}=this.Un.evaluateConfig(t,e),r=(0,u.Ie)(t,r,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,r,e,n),i=null!=s?s:r;return this.ye(t,(0,u.je)(e,i),n),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,t,n){const i=this.T(t);var{evaluation:t,details:r}=this.Un.evaluateLayer(e,i);const s=(0,u.ke)(e,r,t,t=>{this.ye(e,(0,u.Oe)(i,s,t),n)});return this.$emt({name:"layer_evaluation",layer:s}),s}logEvent(t,e,n,i){this.pe.enqueue($P($P({},"string"==typeof t?{eventName:t,value:n,metadata:i}:t),{user:this.T(e),time:Date.now()}))}be(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Qe(null)})}Ye(t){return i(this,void 0,void 0,function*(){return u.Storage.isReady()||(yield u.Storage.isReadyResolver()),this.pe.start(),this.updateAsync(t)})}Qe(t){this.We.finalize(),this.me("Ready",t)}T(t){return(0,u.T)(t,this.m,this.We.getDefaultEnvironment())}Ze(t){this.dataAdapter.getDataAsync(t,{priority:"low"}).catch(t=>{u.Log.error("An error occurred after update.",t)})}}e.default=l},2660:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigSpecsDataAdapter=void 0;const i=n(6914),s=n(8494);class u extends i.DataAdapterCore{constructor(){super("SpecsDataAdapter","specs"),this.ht=null}attach(t,e){super.attach(t,e),this.ht=new s.default(null!=e?e:{})}getDataAsync(t,e){return this.D(t,void 0,e)}prefetchData(t){return this.A(void 0,t)}R(t,e,n){var i;return r(this,void 0,void 0,function*(){return null!=(i=yield null==(i=this.ht)?void 0:i.fetchConfigSpecs(this.C(),null==n?void 0:n.priority))?i:null})}k(){var t=(0,i.o)(this.C());return`${i.DataAdapterCachePrefix}.${this.p}.`+t}N(t,e){return 0<t.data.length}}e.StatsigSpecsDataAdapter=u},600:(t,e,n)=>{$Q(e),e.StatsigSpecsDataAdapter=e.StatsigOnDeviceEvalClient=void 0;var i=n(6217);e.StatsigOnDeviceEvalClient=i.default;const r=n(2660);$Q2(e,"StatsigSpecsDataAdapter",{enumerable:!0,get:function(){return r.StatsigSpecsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigSpecsDataAdapter:r.StatsigSpecsDataAdapter,StatsigOnDeviceEvalClient:i.default}),e.default=__STATSIG__},6535:(t,e)=>{function o(t){return t.setUTCHours(0,0,0,0),t.getTime()}$Q(e),e.default={compareNumbers(t,e,n){if(null==t||null==e)return!1;var i=Number(t),r=Number(e);if(isNaN(i)||isNaN(r))return!1;switch(n){case"gt":return e<t;case"gte":return e<=t;case"lt":return t<e;case"lte":return t<=e;default:return!1}},compareVersions(t,e,n){if(null==t||null==e)return!1;var t=String(t),e=String(e),i=t=>{var e=t.indexOf("-");return-1!==e?t.substring(0,e):t},r=((t,e)=>{var n=t.split(".").map(t=>parseInt(t)),i=e.split(".").map(t=>parseInt(t));let r=0;for(;r<Math.max(n.length,i.length);){var s=r<n.length?n[r]:0,u=r<i.length?i[r]:0;if(s<u)return-1;if(u<s)return 1;r++}return 0})(i(t),i(e));switch(n){case"version_gt":return 0<r;case"version_gte":return 0<=r;case"version_lt":return r<0;case"version_lte":return r<=0;case"version_eq":return 0===r;case"version_neq":return 0!==r;default:return!1}},compareStringInArray(r,t,s){if(!Array.isArray(t))return!1;const u="any_case_sensitive"!==s&&"none_case_sensitive"!==s;var e=-1!==t.findIndex(t=>{var e=String(r),t=String(t),n=u?e.toLowerCase():e,i=u?t.toLowerCase():t;switch(s){case"any":case"none":case"any_case_sensitive":case"none_case_sensitive":return n===i;case"str_starts_with_any":return n.startsWith(i);case"str_ends_with_any":return n.endsWith(i);case"str_contains_any":case"str_contains_none":return n.includes(i);default:return!1}});switch(s){case"none":case"none_case_sensitive":case"str_contains_none":return!e;default:return e}},compareStringWithRegEx(t,e){try{var n=String(t);if(n.length<1e3)return new RegExp(String(e)).test(n)}catch(t){}return!1},compareTime(n,i,r){if(null==n||null==i)return!1;try{let t=new Date(String(n)),e=(isNaN(t.getTime())&&(t=new Date(Number(n))),new Date(String(i)));isNaN(e.getTime())&&(e=new Date(Number(i)));var s=t.getTime(),u=e.getTime();if(isNaN(s)||isNaN(u))return!1;switch(r){case"before":return s<u;case"after":return u<s;case"on":return o(t)===o(e);default:return!1}}catch(t){return!1}},arrayHasValue(t,e){var n=new Set(t);for(let t=0;t<e.length;t++)if(n.has(e[t])||n.has(parseFloat(e[t])))return!0;return!1},arrayHasAllValues(t,e){var n=new Set(t);for(let t=0;t<e.length;t++)if(!n.has(e[t])&&!n.has(parseFloat(e[t])))return!1;return!0}}},5079:(t,e)=>{$Q(e),e.resultToLayerEval=e.resultToConfigEval=e.resultToGateEval=e.makeEvalResult=void 0,e.makeEvalResult=function(t){return $P($P({},{unsupported:!1,bool_value:!1,rule_id:"",secondary_exposures:[],json_value:{},explicit_parameters:null,allocated_experiment_name:null,is_experiment_group:!1,group_name:null,undelegated_secondary_exposures:void 0}),t)},e.resultToGateEval=function(t,e){return{name:t.name,id_type:t.idType,rule_id:e.rule_id,value:e.bool_value,secondary_exposures:e.secondary_exposures,version:null==(e=t.version)?void 0:e.toString()}},e.resultToConfigEval=function(t,e){var n;return{name:t.name,id_type:t.idType,rule_id:e.rule_id,value:e.json_value,secondary_exposures:e.secondary_exposures,group:null!=(n=e.group_name)?n:"",group_name:null!=(n=e.group_name)?n:void 0,is_device_based:!1,is_experiment_active:t.isActive,is_user_in_experiment:e.is_experiment_group,version:null==(n=t.version)?void 0:n.toString(),passed:e.bool_value}},e.resultToLayerEval=function(t,e,n){var i;return{name:t.name,rule_id:n.rule_id,value:n.json_value,secondary_exposures:n.secondary_exposures,undelegated_secondary_exposures:n.undelegated_secondary_exposures,allocated_experiment_name:null!=(i=n.allocated_experiment_name)?i:"",explicit_parameters:null!=(i=n.explicit_parameters)?i:[],group:null!=(i=n.group_name)?i:"",group_name:null!=(i=n.group_name)?i:void 0,is_device_based:!1,is_experiment_active:null==e?void 0:e.isActive,is_user_in_experiment:n.is_experiment_group,version:null==(i=t.version)?void 0:i.toString()}}},5007:(t,e,n)=>{$Q(e),e.Evaluator=void 0;const i=n(5680),h=n(6535),d=n(5079);function v(t,e){var n;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(n=null==(n=t.customIDs)?void 0:n[e])?n:null==(n=null==t?void 0:t.customIDs)?void 0:n[e.toLowerCase()]:t.userID}function f(t){return(0,i.SHA256)(t).dataView().getBigUint64(0,!1)}function o(t){return null!=t&&"object"==typeof t}e.Evaluator=class{constructor(t){this.We=t}evaluateGate(t,e){var{spec:t,details:n}=this.xn("gate",t);return t?{evaluation:(0,d.resultToGateEval)(t,this.Dn(t,e)),details:n}:{evaluation:null,details:n}}evaluateConfig(t,e){var{spec:t,details:n}=this.xn("config",t);return t?{evaluation:(0,d.resultToConfigEval)(t,this.Dn(t,e)),details:n}:{evaluation:null,details:n}}evaluateLayer(t,e){var n,{spec:t,details:i}=this.xn("layer",t);return t?(n=null!=(n=null==(e=this.Dn(t,e))?void 0:e.allocated_experiment_name)?n:"",n=this.We.getSpecAndSourceInfo("config",n).spec,{evaluation:(0,d.resultToLayerEval)(t,n,e),details:i}):{evaluation:null,details:i}}xn(t,e){t=this.We.getSpecAndSourceInfo(t,e);return{details:this.Nn(t),spec:t.spec}}Nn(t){var{source:t,spec:e,lcut:n,receivedAt:i}=t;return"Uninitialized"===t||"NoValues"===t?{reason:t}:{reason:t+":"+(null==e?"Unrecognized":"Recognized"),lcut:n,receivedAt:i}}Dn(t,e){var n=o(t.defaultValue)?t.defaultValue:void 0;if(!t.enabled)return(0,d.makeEvalResult)({json_value:n,rule_id:"disabled"});var i=[];for(const u of t.rules){var r,s=this.En(u,e);if(s.unsupported)return s;if(i.push(...s.secondary_exposures),s.bool_value)return this.Mn(u.configDelegate,e,i)||(r=function(t,e,n){if(100===t.passPercentage)return!0;if(0===t.passPercentage)return!1;e=f(n.salt+"."+(null!=(n=t.salt)?n:t.id)+"."+(null!=(n=v(e,t.idType))?n:""));return Number(e%BigInt(1e4))<100*t.passPercentage}(u,e,t),(0,d.makeEvalResult)({rule_id:s.rule_id,bool_value:r,json_value:r?s.json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,is_experiment_group:s.is_experiment_group,group_name:s.group_name}))}return(0,d.makeEvalResult)({json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,rule_id:"default"})}En(t,e){var n=[];let i=!0;for(const s of t.conditions){var r=this.An(s,e);if(r.unsupported)return r;n.push(...r.secondary_exposures),r.bool_value||(i=!1)}return(0,d.makeEvalResult)({rule_id:t.id,bool_value:i,json_value:o(t.returnValue)?t.returnValue:void 0,secondary_exposures:n,is_experiment_group:!0===t.isExperimentGroup,group_name:t.groupName})}An(t,e){let n=null,i=!1;var r=t.field,s=t.targetValue,u=t.idType,o=t.type;switch(o){case"public":return(0,d.makeEvalResult)({bool_value:!0});case"pass_gate":case"fail_gate":var l=String(s),l=this.Fn(l,e);return(0,d.makeEvalResult)({bool_value:"fail_gate"===o?!l.bool_value:l.bool_value,secondary_exposures:l.secondary_exposures});case"multi_pass_gate":case"multi_fail_gate":return this.Rn(s,o,e);case"user_field":case"ip_based":case"ua_based":n=function(t,e){var n;if(null==e||"object"!=typeof t||null==t)return null;var i=t;return null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=i[e])?n:i[e.toLowerCase()])?n:null==(i=null==t?void 0:t.custom)?void 0:i[e])?n:null==(i=null==t?void 0:t.custom)?void 0:i[e.toLowerCase()])?n:null==(i=null==t?void 0:t.privateAttributes)?void 0:i[e])?n:null==(i=null==t?void 0:t.privateAttributes)?void 0:i[e.toLowerCase()]}(e,r);break;case"environment_field":n=function(t,e){if(null==e)return null;t=t.statsigEnvironment;if(null!=t){const n=e.toLowerCase(),i=Object.keys(t).find(t=>t.toLowerCase()===n);return void 0!==i?t[i]:void 0}}(e,r);break;case"current_time":n=Date.now();break;case"user_bucket":l=f(String(null!=(l=null==(l=t.additionalValues)?void 0:l.salt)?l:"")+"."+(null!=(l=v(e,u))?l:""));n=Number(l%BigInt(1e3));break;case"unit_id":n=v(e,u);break;default:return(0,d.makeEvalResult)({unsupported:!0})}var a,c=t.operator;switch(c){case"gt":case"gte":case"lt":case"lte":i=h.default.compareNumbers(n,s,c);break;case"version_gt":case"version_gte":case"version_lt":case"version_lte":case"version_eq":case"version_neq":i=h.default.compareVersions(n,s,c);break;case"any":case"none":case"str_starts_with_any":case"str_ends_with_any":case"str_contains_any":case"str_contains_none":case"any_case_sensitive":case"none_case_sensitive":i=h.default.compareStringInArray(n,s,c);break;case"str_matches":i=h.default.compareStringWithRegEx(n,s);break;case"before":case"after":case"on":i=h.default.compareTime(n,s,c);break;case"eq":i=n==s;break;case"neq":i=n!=s;break;case"in_segment_list":case"not_in_segment_list":return(0,d.makeEvalResult)({unsupported:!0});case"array_contains_any":case"array_contains_none":Array.isArray(s)?i=!!Array.isArray(n)&&(a=h.default.arrayHasValue(n,s),"array_contains_any"===c?a:!a):i=!1;break;case"array_contains_all":case"not_array_contains_all":Array.isArray(s)?i=!!Array.isArray(n)&&(a=h.default.arrayHasAllValues(n,s),"array_contains_all"===c?a:!a):i=!1}return(0,d.makeEvalResult)({bool_value:i})}Mn(t,e,n){var i;return t&&(i=this.We.getSpecAndSourceInfo("config",t).spec,i)?(e=this.Dn(i,e),(0,d.makeEvalResult)($P($P({},e),{allocated_experiment_name:t,explicit_parameters:i.explicitParameters,secondary_exposures:n.concat(e.secondary_exposures),undelegated_secondary_exposures:n}))):null}Fn(t,e){var n=[];let i=!1;var r=this.We.getSpecAndSourceInfo("gate",t)["spec"];if(r){r=this.Dn(r,e);if(r.unsupported)return r;i=r.bool_value,n.push(...r.secondary_exposures),n.push({gate:t,gateValue:String(i),ruleID:r.rule_id})}return(0,d.makeEvalResult)({bool_value:i,secondary_exposures:n})}Rn(t,e,n){if(!Array.isArray(t))return(0,d.makeEvalResult)({unsupported:!0});var i="multi_pass_gate"===e,r=[];let s=!1;for(const o of t){if("string"!=typeof o)return(0,d.makeEvalResult)({unsupported:!0});var u=this.Fn(o,n);if(u.unsupported)return u;if(r.push(...u.secondary_exposures),i?!0===u.bool_value:!1===u.bool_value){s=!0;break}}return(0,d.makeEvalResult)({bool_value:s,secondary_exposures:r})}}},8313:(t,e,n)=>{$Q(e),e.SpecStore=void 0;const i=n(6914);function r(t){return(0,i.P)(t,"has_updates","DownloadConfigSpecsResponse")}e.SpecStore=class{constructor(){this.Re=null,this.Pe=null,this.Ce="Uninitialized",this.Ue=0,this.Fe=0,this.zn=null}getValues(){return this.Re?r(this.Re):null}getSource(){return this.Ce}getDefaultEnvironment(){return this.zn}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=r(t.data))?void 0:e.has_updates)&&(this.Ue=e.time,this.Fe=t.receivedAt,this.Ce=t.source,this.Pe=e,this.Re=t.data,this.zn=null!=(t=e.default_environment)?t:null)}reset(){this.Pe=null,this.Re=null,this.Ce="Loading"}finalize(){this.Pe||(this.Ce="NoValues")}getSpecAndSourceInfo(t,e){var t=this.Cn(t);return{spec:null!=(t=null==t?void 0:t.find(t=>t.name===e))?t:null,source:this.Ce,lcut:this.Ue,receivedAt:this.Fe}}Cn(t){var e;switch(t){case"gate":return null==(e=this.Pe)?void 0:e.feature_gates;case"config":return null==(e=this.Pe)?void 0:e.dynamic_configs;case"layer":return null==(e=this.Pe)?void 0:e.layer_configs}}}},3066:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),r(n(5007),e),r(n(8313),e)},5680:(t,e,n)=>{$Q(e),e.SHA256=void 0;const i=n(7485);$Q2(e,"SHA256",{enumerable:!0,get:function(){return i.SHA256}})},7485:(t,e)=>{$Q(e),e.SHA256=void 0,e.SHA256=function(t){return(new i).update(t)};const n=[-2147483648,8388608,32768,128],u=[24,16,8,0],m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];class i{constructor(){this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.lastByteIndex=-1}update(n){if(!this.finalized){if("string"!=typeof n)throw new Error('Must be of type "string"');var i;let t=0,e;for(var r=n.length,s=this.blocks;t<r;){for(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),e=this.start;t<r&&e<64;++t)(i=n.charCodeAt(t))<128?s[e>>2]|=i<<u[3&e++]:(i<2048?s[e>>2]|=(192|i>>6)<<u[3&e++]:(i<55296||57344<=i?s[e>>2]|=(224|i>>12)<<u[3&e++]:(i=65536+((1023&i)<<10|1023&n.charCodeAt(++t)),s[e>>2]|=(240|i>>18)<<u[3&e++],s[e>>2]|=(128|i>>12&63)<<u[3&e++]),s[e>>2]|=(128|i>>6&63)<<u[3&e++]),s[e>>2]|=(128|63&i)<<u[3&e++]);this.lastByteIndex=e,this.bytes+=e-this.start,64<=e?(this.block=s[16],this.start=e-64,this.hash(),this.hashed=!0):this.start=e}4294967295<this.bytes&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296)}return this}finalize(){var t,e;this.finalized||(this.finalized=!0,t=this.blocks,e=this.lastByteIndex,t[16]=this.block,t[e>>2]|=n[3&e],this.block=t[16],56<=e&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash())}hash(){var t=this.blocks;let e=this.h0,n=this.h1,i=this.h2,r=this.h3,s=this.h4,u=this.h5,o=this.h6,l=this.h7,a,c,h,d,v,f,_,p,g,y,b;for(a=16;a<64;++a)v=t[a-15],c=(v>>>7|v<<25)^(v>>>18|v<<14)^v>>>3,v=t[a-2],h=(v>>>17|v<<15)^(v>>>19|v<<13)^v>>>10,t[a]=t[a-16]+c+t[a-7]+h<<0;for(b=n&i,a=0;a<64;a+=4)this.first?(p=704751109,v=t[0]-210244248,l=v-1521486534<<0,r=v+143694565<<0,this.first=!1):(c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),h=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),p=e&n,d=p^e&i^b,_=s&u^~s&o,v=l+h+_+m[a]+t[a],f=c+d,l=r+v<<0,r=v+f<<0),c=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),h=(l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7),g=r&e,d=g^r&n^p,_=l&s^~l&u,v=o+h+_+m[a+1]+t[a+1],f=c+d,o=i+v<<0,i=v+f<<0,c=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),h=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),y=i&r,d=y^i&e^g,_=o&l^~o&s,v=u+h+_+m[a+2]+t[a+2],f=c+d,u=n+v<<0,n=v+f<<0,c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),h=(u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7),b=n&i,d=b^n&r^y,_=u&o^~u&l,v=s+h+_+m[a+3]+t[a+3],f=c+d,s=e+v<<0,e=v+f<<0;this.h0=this.h0+e<<0,this.h1=this.h1+n<<0,this.h2=this.h2+i<<0,this.h3=this.h3+r<<0,this.h4=this.h4+s<<0,this.h5=this.h5+u<<0,this.h6=this.h6+o<<0,this.h7=this.h7+l<<0}arrayBuffer(){return this.Gn().buffer}dataView(){return this.Gn().dataView}Gn(){this.finalize();var t=new ArrayBuffer(32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),e.setUint32(28,this.h7),{dataView:e,buffer:t}}}}},i={};function r(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,r)),e.exports}return r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r(9638).default})());
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $Q2=(a,b,c)=>Object.defineProperty(a,b,c);var $P=(a,b)=>Object.assign(a,b);var $A=()=>((t,r,u,l)=>{return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})});var n={1845:(t,n,e)=>{var i;$Q2(n,"__esModule",{value:!0}),n.t=n.i=n.l=void 0;const r=e(7512);n.l=()=>__STATSIG__||l,n.i=t=>(0,n.l)()[t];n.t=t=>{var e=(0,n.l)();return t?e.instances&&e.instances[t]:(e.instances&&1<Object.keys(e.instances).length&&r.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var s="__STATSIG__",o="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},u="undefined"!=typeof globalThis?globalThis:{};const l=null!=(i=null!=(i=null!=(i=o[s])?i:e[s])?i:u[s])?i:{instance:n.t};o[s]=l,e[s]=l,u[s]=l},2137:(t,e,n)=>{$Q(e),e.o=e.u=void 0;const r=n(1406);function i(t,e,n){if(n)return n(t,e);const i=e&&e.customIDs?e.customIDs:{};e=["uid:"+(null!=(n=null==e?void 0:e.userID)?n:""),"cids:"+Object.keys(i).sort((t,e)=>t.localeCompare(e)).map(t=>t+"-"+i[t]).join(","),"k:"+t];return(0,r.h)(e.join("|"))}e.u=i,e.o=function(t,e,n){return e?i(t,e,n):(0,r.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.Wn=e.DataAdapterCore=void 0;const a=n(7512),c=n(9122),s=n(8578),o=n(4534),h=n(3401);function d(t,e,n,i){return{source:t,data:e,receivedAt:Date.now(),stableID:n,fullUserHash:(0,s.v)(i)}}e.DataAdapterCore=class{constructor(t,e){this._=t,this.p=e,this.m=null,this.O=null,this.j="statsig.last_modified_time."+e,this.S=new i}attach(t,e){this.O=t,this.m=e}getDataSync(t){var t=t&&(0,s.T)(t,this.m),e=this.k(t),n=this.S.get(e,t);return n||((n=this.I(e))?(this.S.add(e,n),this.S.get(e,t)):null)}setData(t,e){var e=e&&(0,s.T)(e,this.m),n=this.k(e);this.S.add(n,d("Bootstrap",t,null,e))}D(e,n,i){return r(this,void 0,void 0,function*(){o.Storage.isReady()||(yield o.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(n),t=[this.M(t,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(a.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}A(n,i){return r(this,void 0,void 0,function*(){var t=n&&(0,s.T)(n,this.m),e=this.k(t),t=yield this.D(null,t,i);t&&this.S.add(e,$P($P({},t),{source:"Prefetch"}))})}M(s,o,u){var l;return r(this,void 0,void 0,function*(){var t=null!=(l=null==s?void 0:s.data)?l:null,e=null!=s&&this.N(s,o),e=yield this.R(t,o,u,e);if(!e)return a.Log.debug("No response returned for latest value"),null;var n=(0,h.P)(e,"has_updates","Response"),i=this.C(),i=c.StableID.get(i);let r=null;if(!0===(null==n?void 0:n.has_updates))r=d("Network",e,i,o);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;r=d("NetworkNotModified",t,i,o)}e=this.k(o);return this.S.add(e,r),this.U(e,r),r})}C(){return null!=this.O?this.O:(a.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,h.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}U(t,e){o.Storage.setItem(t,JSON.stringify(e)),this.F(t)}F(t){var e=null!=(e=(0,o.G)(this.j))?e:{},t=(e[t]=Date.now(),u(e,10));t&&(delete e[t],o.Storage.removeItem(t)),(0,o.L)(this.j,e)}},e.Wn=d;class i{constructor(){this.K={}}get(t,e){var t=this.K[t],n=null==t?void 0:t.stableID,e=null==(e=null==e?void 0:e.customIDs)?void 0:e.stableID;return e&&n&&e!==n?(a.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e){var n=u(this.K,9);n&&delete this.K[n],this.K[t]=e}merge(t){this.K=$P($P({},this.K),t)}}function u(r,t){var e=Object.keys(r);return e.length<=t?null:e.reduce((t,e)=>{var n=r[t],i=r[e];return"object"==typeof n&&"object"==typeof i?i.receivedAt<n.receivedAt?e:t:i<n?e:t})}},8962:(t,o)=>{$Q2(o,"__esModule",{value:!0}),o.Diagnostics=void 0;const i=new Map,n="start";function r(t,e,n,i){return $P({key:n,action:e,step:i,timestamp:Date.now()},t)}function s(t,e){var n=null!=(n=i.get(t))?n:[];n.push(e),i.set(t,n)}function e(t,e){if(e in t)return t[e]}o.Diagnostics={q:t=>i.get(t),B:t=>{s(t,r({},n,"overall"))},V:(t,e,n)=>{s(t,r({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},"end","overall"))},J:(t,e)=>{s(t,r(e,n,"initialize","network_request"))},$:(t,e)=>{s(t,r(e,"end","initialize","network_request"))},W:t=>{s(t,r({},n,"initialize","process"))},H:(t,e)=>{s(t,r(e,"end","initialize","process"))},Y:t=>{i.delete(t)},X(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},Z(t,e,n,i){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===n.includes('"is_delta":true')||void 0,attempt:e,error:o.Diagnostics.X(i)}},tt(t,e,n,i){var r,s=o.Diagnostics.q(n);return null==s||s.length<=0?-1:(r=s[s.length-1].timestamp-s[0].timestamp,o.Diagnostics.Y(n),n=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:i}),e.enqueue(n),r)}}},8809:function(t,e){var n=this&&this.__awaiter||$A();$Q(e),e.et=void 0;const r=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),s="https://cloudflare-dns.com/dns-query",o=["i","e","d"],u=200;e.et=function(e){return n(this,void 0,void 0,function*(){var n=yield e(s,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:r});if(n.ok){var t,n=yield n.arrayBuffer(),n=new Uint8Array(n);{var i=n,n=i.findIndex((t,e)=>e<u&&"="===String.fromCharCode(t)&&o.includes(String.fromCharCode(i[e-1])));if(-1===n)throw(t=new Error("Failed to parse TXT records from DNS")).name="DnsTxtParseError",t;let e="";for(let t=n-1;t<i.length;t++)e+=String.fromCharCode(i[t]);return e.split(",")}}throw(t=new Error("Failed to fetch TXT records from DNS")).name="DnsTxtFetchError",t})}},3539:(t,e)=>{$Q(e)},5542:function(t,u,e){var n=this&&this.__awaiter||$A();$Q2(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(7512),l=e(5902),a=e(8e3),c=(u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");function h(t){return t instanceof Error?t:"string"==typeof t?new Error(t):new Error("An unknown error occurred.")}u.ErrorBoundary=class{constructor(t,e,n,i){this.O=t,this.m=e,this.nt=n,this.qn=i,this.it=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.rt(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.st("eb:wrap",t)}}logError(t,e){this.st(t,e)}getLastSeenErrorAndReset(){var t=this.qn;return this.qn=void 0,null!=t?t:null}attachErrorIfNoneExists(t){this.qn||(this.qn=h(t))}rt(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.st(e,t)):n}catch(t){return this.st(e,t),null}}st(s,o){try{i.Log.warn("Caught error in "+s,{error:o});n(this,void 0,void 0,function*(){var t,e=o||Error(c),n=e instanceof Error,i=n?e.name:"No Name",r=h(e);this.qn=r,this.it.has(i)||(this.it.add(i),null!=(r=null==(r=this.m)?void 0:r.networkConfig)&&r.preventAllNetworkTraffic?null!=(r=this.nt)&&r.call(this,{name:"error",error:o,tag:s}):(r=l.SDKType.lt(this.O),t=a.StatsigMetadataProvider.get(),n=n?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return c}}(e),e=JSON.stringify($P({tag:s,exception:i,info:n},$P($P({},t),{sdkType:r}))),yield(null!=(i=null==(n=null==(i=this.m)?void 0:i.networkConfig)?void 0:n.networkOverrideFunc)?i:fetch)(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.O,"STATSIG-SDK-TYPE":String(r),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=(n=this.nt)&&n.call(this,{name:"error",error:o,tag:s})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},7770:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const i=n(2137),r=n(1406),o=n(7512),u=n(7410),l=n(6830),a=n(1637),c=n(4534),h=n(1881),d=n(2397),v={},f={Startup:"startup",GainedFocus:"gained_focus"};class _{static ot(t){null!=(t=v[t])&&t.flush().catch(()=>{})}static ut(t){null!=(t=v[t])&&t.ct(f.GainedFocus)}constructor(t,e,n,i){this.O=t,this.nt=e,this.ht=n,this.m=i,this.dt=[],this.vt={},this.ft={},this._t=!1,this.gt=Date.now(),this.bt=!0===(null==i?void 0:i.disableLogging),this.yt=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:100;e=null==i?void 0:i.networkConfig;this.Ot=new h.UrlConfiguration(u.Endpoint.jt,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls)}setLoggingDisabled(t){this.bt=t}enqueue(t){this.St(t)&&(this.wt(t),this.Tt(),this.dt.length>this.yt)&&_.ot(this.O)}incrementNonExposureCount(t){var e=null!=(e=this.ft[t])?e:0;this.ft[t]=e+1}reset(){this.vt={}}start(){(0,l.kt)()||(v[this.O]=this,(0,d.It)(t=>{"background"===t?_.ot(this.O):"foreground"===t&&_.ut(this.O)}),this.ct(f.Startup),this.Dt())}stop(){return s(this,void 0,void 0,function*(){this.Et&&(clearInterval(this.Et),this.Et=null),delete v[this.O],yield this.flush()})}flush(){return s(this,void 0,void 0,function*(){var t;this.Mt(),0!==this.dt.length&&(t=this.dt,this.dt=[],yield this.At(t))})}Tt(){this._t||(this._t=!0,200<Date.now()-this.gt)||setTimeout(()=>_.ot(this.O),200)}St(t){if((0,l.kt)())return!1;if((0,a.xt)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,i.u)(this.O,e),n=t.metadata||{},t=[t.eventName,e,n.gate,n.config,n.ruleID,n.allocatedExperiment,n.parameterName,String(n.isExplicitParameter),n.reason].join("|"),e=this.vt[t],n=Date.now();if(e&&n-e<6e5)return!1;1e3<Object.keys(this.vt).length&&(this.vt={}),this.vt[t]=n}return!0}At(n){var i,r;return s(this,void 0,void 0,function*(){if(this.bt)return this.Nt(n),!1;try{var t=(0,d.Rt)()&&this.ht.isBeaconSupported()&&null==(null==(r=null==(i=this.m)?void 0:i.networkConfig)?void 0:r.networkOverrideFunc),e=(this.nt({name:"pre_logs_flushed",events:n}),t?yield this.Pt(n):yield this.Ct(n));return e.success?(this.nt({name:"logs_flushed",events:n}),!0):(o.Log.warn("Failed to flush events."),this.Nt(n),!1)}catch(t){return o.Log.warn("Failed to flush events."),!1}})}Ct(e){var n;return s(this,void 0,void 0,function*(){var t=yield this.ht.post(this.Ut(e)),t=null!=(n=null==t?void 0:t.code)?n:-1;return{success:200<=t&&t<300}})}Pt(t){return s(this,void 0,void 0,function*(){return{success:yield this.ht.beacon(this.Ut(t))}})}Ut(t){return{sdkKey:this.O,data:{events:t},urlConfig:this.Ot,retries:3,isCompressable:!0,params:{[u.NetworkParam.EventCount]:String(t.length)}}}Nt(t){for(;500<t.length;)t.shift();var e=this.o();try{(0,c.L)(e,t)}catch(t){o.Log.warn("Unable to save failed logs to storage")}}ct(e){const n=this.o();s(this,void 0,void 0,function*(){c.Storage.isReady()||(yield c.Storage.isReadyResolver());var t=(0,c.G)(n);t&&(e===f.Startup&&c.Storage.removeItem(n),yield this.At(t))&&e===f.GainedFocus&&c.Storage.removeItem(n)}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}o(){return"statsig.failed_logs."+(0,r.h)(this.O)}wt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.Ft(),n=(n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e));o.Log.debug("Enqueued Event:",n),this.dt.push(n)}Mt(){0!==Object.keys(this.ft).length&&(this.wt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.ft)}}),this.ft={})}Ft(){var t;if(!1!==(null==(t=this.m)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.Gt)()}Dt(){var t=null!=(t=null==(t=this.m)?void 0:t.loggingIntervalMs)?t:1e4;const e=setInterval(()=>{var t=v[this.O];t&&t.Et===e?_.ot(this.O):clearInterval(e)},t);this.Et=e}}e.EventLogger=_},1406:(t,s,e)=>{$Q2(s,"__esModule",{value:!0}),s.Lt=s.Kt=s.h=void 0;const o=e(6634);s.h=e=>{let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)},s.Kt=(t,e)=>(0,s.h)(JSON.stringify((0,s.Lt)(t,e)));s.Lt=(n,i)=>{if(null==n)return null;var t=Object.keys(n).sort();const r={};return t.forEach(t=>{var e=n[t];0===i||"object"!==(0,o.zt)(e)?r[t]=e:r[t]=(0,s.Lt)(e,null!=i?i-1:i)}),r}},1333:(t,e)=>{$Q(e)},7512:(t,e)=>{$Q(e),e.Log=e.LogLevel=void 0;function n(t){return t.unshift("[Statsig]"),t}e.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class i{static info(...t){i.level>=e.LogLevel.Info&&console.info(" INFO ",...n(t))}static debug(...t){i.level>=e.LogLevel.Debug&&console.debug(" DEBUG ",...n(t))}static warn(...t){i.level>=e.LogLevel.Warn&&console.warn(" WARN ",...n(t))}static error(...t){i.level>=e.LogLevel.Error&&console.error(" ERROR ",...n(t))}}(e.Log=i).level=e.LogLevel.Warn},7787:(t,e)=>{$Q(e),e.createMemoKey=e.MemoPrefix=void 0,e.MemoPrefix={Kn:"g",Ln:"c",Vn:"e",$n:"l",Bn:"p"};const s=new Set([]),o=new Set(["userPersistedValues"]);e.createMemoKey=function(t,e,n){let i=t+"|"+e;if(n)for(const r of Object.keys(n)){if(o.has(r))return;s.has(r)?i+=`|${r}=true`:i+=`|${r}=`+n[r]}return i}},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=e.Endpoint=void 0,e.Endpoint={qt:"initialize",jt:"rgstr",Bt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.jt]:"https://prodregistryv2.org/v1",[e.Endpoint.qt]:"https://featureassets.org/v1",[e.Endpoint.Bt]:"https://api.statsigcdn.com/v1"},e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},7023:function(t,e,n){var j=this&&this.__awaiter||$A();$Q(e),e.NetworkCore=void 0,n(1845);const v=n(1845),S=n(8962),w=n(7512),x=n(7410),i=n(308),f=n(3091),o=n(5902),r=n(6830),u=n(4143),l=n(9122),k=n(2636),a=n(8e3),D=n(2397),T=500,I=3e4;const N=new Set([408,500,502,503,504,522,524,599]);e.NetworkCore=class{constructor(t,e){this.nt=e,this.$t=null,this.Vt=1e4,this.Jt={},this.m={},this.Oi={},this.Jn=null,t&&(this.m=t),this.m.networkConfig&&(this.Jt=this.m.networkConfig),this.Jt.networkTimeoutMs&&(this.Vt=this.Jt.networkTimeoutMs),this.Wt=new i.NetworkFallbackResolver(this.m)}setErrorBoundary(t){this.$t=t,this.$t.wrap(this),this.$t.wrap(this.Wt),this.Wt.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){var t=this.Jn;return this.Jn=null,t}beacon(i){return j(this,void 0,void 0,function*(){var t,e,n;return!!E(i)&&(t=this.Ht("POST",i),yield this.Ci(t),e=yield this.Xt(t),(n=navigator).sendBeacon.bind(n)(e,t.body))})}post(e){return j(this,void 0,void 0,function*(){var t=this.Ht("POST",e);return this.Pi(t),yield this.Ci(t),this.Zt(t)})}get(t){t=this.Ht("GET",t);return this.Zt(t)}Zt(y){var b,m,O;return j(this,void 0,void 0,function*(){if(!E(y))return null;if(this.Jt.preventAllNetworkTraffic)return null;var{method:e,body:n,retries:i,attempt:r}=y,t=y.urlConfig.endpoint;if(this.Si(t))return w.Log.warn(`Request to ${t} was blocked because you are making requests too frequently.`),null;r=null!=r?r:1;const s="undefined"!=typeof AbortController?new AbortController:null;var o=setTimeout(()=>{null!==s&&void 0!==s&&s.abort(`Timeout of ${this.Vt}ms expired.`)},this.Vt),u=yield this.Xt(y);let l=null;var a=(0,D.Rt)();try{var c,h,d,v={method:e,body:n,headers:$P({},y.headers),signal:null===s||void 0===s?void 0:s.signal,priority:y.priority,keepalive:a},f=(p=r,(g=y).urlConfig.endpoint===x.Endpoint.qt&&S.Diagnostics.J(g.sdkKey,{attempt:p}),this.Oi[t]),_=(f&&(f.lastRequestTime=Date.now(),this.Oi[t]=f),null!=(b=this.Jt.networkOverrideFunc)?b:fetch);if(l=yield _(u,v),clearTimeout(o),l.ok)return d=yield l.text(),A(y,l,r,d),this.Wt.tryBumpExpiryTime(y.sdkKey,y.urlConfig),{body:d,code:l.status};throw c=yield l.text().catch(()=>"No Text"),(h=new Error(`NetworkError: ${u} `+c)).name="NetworkError",h}catch(t){var p,n=function(t,e){if(null!=t&&t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return"Unknown Error"}(s,t),a=function(t){t=(null==t?void 0:t.signal.aborted)&&"string"==typeof t.signal.reason&&t.signal.reason.includes("Timeout");return t||!1}(s),g=(A(y,l,r,"",t),yield this.Wt.tryFetchUpdatedFallbackInfo(y.sdkKey,y.urlConfig,n,a));return(g&&(y.fallbackUrl=this.Wt.getActiveFallbackUrl(y.sdkKey,y.urlConfig)),!i||i<r||!N.has(null!=(m=null===l||void 0===l?void 0:l.status)?m:500))?(null!=(m=this.nt)&&m.call(this,{name:"error",error:t,tag:k.ErrorTag.NetworkError,requestArgs:y}),p=`A networking error occurred during ${e} request to ${u}.`,w.Log.error(p,n,t),null!=(O=this.$t)&&O.attachErrorIfNoneExists(p),null):(yield function(e){return j(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(T*(e*e),I)))})}(r),this.Zt($P($P({},y),{retries:i,attempt:r+1})))}})}Si(t){var e=Date.now(),n=null!=(n=this.Oi[t])?n:{count:0,lastRequestTime:e},i=e-n.lastRequestTime,i=Math.floor(.05*i);return n.count=Math.max(0,n.count-i),50<=n.count||(n.count+=1,n.lastRequestTime=e,this.Oi[t]=n,!1)}Xt(i){var r;return j(this,void 0,void 0,function*(){var t=null!=(r=i.fallbackUrl)?r:i.urlConfig.getUrl();i.urlConfig.endpoint!==x.Endpoint.qt&&i.urlConfig.endpoint!==x.Endpoint.Bt||(this.Jn=t);const e=$P({[x.NetworkParam.SdkKey]:i.sdkKey,[x.NetworkParam.SdkType]:o.SDKType.lt(i.sdkKey),[x.NetworkParam.SdkVersion]:a.SDK_VERSION,[x.NetworkParam.Time]:String(Date.now()),[x.NetworkParam.SessionID]:u.SessionID.get(i.sdkKey)},i.params);var n=Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&");return t+(n?"?"+n:"")})}Pi(e){var t,n=(0,r.te)(),i=e.body;if(e.isStatsigEncodable&&!this.m.disableStatsigEncoding&&"string"==typeof i&&null==(0,v.i)("no-encode")&&null!=n&&n.btoa)try{e.body=n.btoa(i).split("").reverse().join(""),e.params=$P($P({},null!=(t=e.params)?t:{}),{[x.NetworkParam.StatsigEncoded]:"1"})}catch(t){w.Log.warn("Request encoding failed for "+e.urlConfig.getUrl(),t)}}Ci(h){var d;return j(this,void 0,void 0,function*(){var e=h.body;if(h.isCompressable&&!this.m.disableCompression&&"string"==typeof e&&!0===f.SDKFlags.get(h.sdkKey,"enable_log_event_compression")&&null==(0,v.i)("no-compress")&&"undefined"!=typeof CompressionStream&&"undefined"!=typeof TextEncoder)try{for(var n,i=(new TextEncoder).encode(e),r=new CompressionStream("gzip"),s=r.writable.getWriter(),o=(s.write(i).catch(w.Log.error),s.close().catch(w.Log.error),r.readable.getReader()),u=[];!(n=yield o.read()).done;)u.push(n.value);var l=u.reduce((t,e)=>t+e.length,0),a=new Uint8Array(l);let t=0;for(const c of u)a.set(c,t),t+=c.length;h.body=a,h.params=$P($P({},null!=(d=h.params)?d:{}),{[x.NetworkParam.IsGzipped]:"1"})}catch(t){w.Log.warn("Request compression failed for "+h.urlConfig.getUrl(),t)}})}Ht(t,e){var n=this.Wt.getActiveFallbackUrl(e.sdkKey,e.urlConfig),t=$P($P({},e),{method:t,fallbackUrl:n});return"data"in e&&s(t,e.data),t}};const E=t=>!!t.sdkKey||(w.Log.warn("Unable to make request without an SDK key"),!1),s=(t,e)=>{var{sdkKey:n,fallbackUrl:i}=t,r=l.StableID.get(n),s=u.SessionID.get(n),n=o.SDKType.lt(n);t.body=JSON.stringify($P($P({},e),{statsigMetadata:$P($P({},a.StatsigMetadataProvider.get()),{stableID:r,sessionID:s,sdkType:n,fallbackUrl:i})}))};function A(t,e,n,i,r){t.urlConfig.endpoint===x.Endpoint.qt&&S.Diagnostics.$(t.sdkKey,S.Diagnostics.Z(e,n,i,r))}},308:function(t,e,n){var l=this&&this.__awaiter||$A();$Q(e),e.ee=e.NetworkFallbackResolver=void 0;const u=n(8809),i=n(1406),s=n(7512),o=n(4534);function a(t,e){t=null!=(t=null==t?void 0:t.toLowerCase())?t:"";return e||t.includes("uncaught exception")||t.includes("failed to fetch")||t.includes("networkerror when attempting to fetch resource")}function c(t){return"statsig.network_fallback."+(0,i.h)(t)}function h(t,e){t=c(t);e&&0!==Object.keys(e).length?o.Storage.setItem(t,JSON.stringify(e)):o.Storage.removeItem(t)}function d(t){try{return new URL(t).pathname}catch(t){return null}}e.NetworkFallbackResolver=class{constructor(t){this.ne=null,this.$t=null,this.ie={},this.re=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.$t=t}tryBumpExpiryTime(t,e){var n=null==(n=this.ne)?void 0:n[e.endpoint];n&&(n.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ne),{[e.endpoint]:n})))}getActiveFallbackUrl(t,e){var n;let i=this.ne;null==i&&(i=null!=(r=function(t){t=c(t),t=o.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return s.Log.error("Failed to parse FallbackInfo"),null}}(t))?r:{},this.ne=i);var r=i[e.endpoint];return!r||Date.now()>(null!=(n=r.expiryTime)?n:0)?(delete i[e.endpoint],this.ne=i,h(t,this.ne),null):r.url||null}getFallbackFromProvided(t){var e=d(t);return e?t.replace(e,""):null}tryFetchUpdatedFallbackInfo(n,i,r,s){var o,u;return l(this,void 0,void 0,function*(){try{var t,e;return a(r,s)?(t=null==i.customUrl&&null==i.fallbackUrls?yield this.se(i):i.fallbackUrls,!!(e=this.le(null==(o=this.ne)?void 0:o[i.endpoint],t))&&(this.oe(n,i.endpoint,e),!0)):!1}catch(t){return null!=(u=this.$t)&&u.logError("tryFetchUpdatedFallbackInfo",t),!1}})}oe(t,e,n){var n={url:n,expiryTime:Date.now()+6048e5,previous:[]},i=null==(i=this.ne)?void 0:i[e],i=(i&&n.previous.push(...i.previous),10<n.previous.length&&(n.previous=[]),null==(i=null==(i=this.ne)?void 0:i[e])?void 0:i.url);null!=i&&n.previous.push(i),this.ne=$P($P({},this.ne),{[e]:n}),h(t,this.ne)}se(s){var o;return l(this,void 0,void 0,function*(){var t=this.ie[s.endpoint];if(t&&Date.now()<t)return null;this.ie[s.endpoint]=Date.now()+144e5;var e=[],t=yield(0,u.et)(null!=(o=this.re)?o:fetch),n=d(s.defaultUrl);for(const r of t)if(r.startsWith(s.endpointDnsKey+"=")){var i=r.split("=");if(1<i.length){let t=i[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+n)}}return e})}le(t,e){var n;if(null==e)return null;var i=new Set(null!=(n=null==t?void 0:t.previous)?n:[]),r=null==t?void 0:t.url;let s=null;for(const u of e){var o=u.endsWith("/")?u.slice(0,-1):u;if(!i.has(u)&&o!==r){s=o;break}}return s}},e.ee=a},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},3091:(t,e)=>{$Q(e),e.SDKFlags=void 0;const n={};e.SDKFlags={setFlags:(t,e)=>{n[t]=e},get:(t,e)=>{return null!=(t=null==(t=n[t])?void 0:t[e])&&t}}},5902:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={lt:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},ue(t,e){n[t]=e},ae(t){i&&"-react"!==i||(i="-"+t)}}},6830:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.Gt=i.ce=i.he=i.kt=i.de=i.te=void 0;i.te=()=>"undefined"!=typeof window?window:null,i.de=()=>{var t=(0,i.te)();return null!=(t=null==t?void 0:t.document)?t:null},i.kt=()=>{var t;return null===(0,i.de)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},i.he=(t,e)=>{var n=(0,i.te)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.ce=(t,e)=>{var n=(0,i.de)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.Gt=()=>{var t;try{return null==(t=(0,i.te)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},4143:(t,e,n)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(2137),s=n(7512),o=n(4534),u=n(8023),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,i.o)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==c[t]&&(c[t]=function(t){let e=function(t){t=d(t);return(0,o.G)(t)}(t);var n=Date.now();e=e||{sessionID:(0,u.getUUID)(),startTime:n,lastUpdate:n};return{data:e,sdkKey:t}}(t));var t=c[t],e=Date.now(),n=t.data,i=((function({lastUpdate:t}){return Date.now()-t>l}(n)||function({startTime:t}){return Date.now()-t>a}(n))&&(n.sessionID=(0,u.getUUID)(),n.startTime=e),n.lastUpdate=e,n),r=t.sdkKey;r=d(r);try{(0,o.L)(r,i)}catch(t){s.Log.warn("Failed to save SessionID")}return clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID),e-=n.startTime,n=t.sdkKey,t.idleTimeoutID=h(n,l),t.ageTimeoutID=h(n,a-e),t},overrideInitialSessionID:(t,e)=>{var n;c[e]=(t=t,e=e,n=Date.now(),{data:{sessionID:t,startTime:n,lastUpdate:n},sdkKey:e})}}},9122:(t,e,n)=>{$Q(e),e.StableID=void 0;const i=n(2137),r=n(7512),s=n(4534),o=n(8023),u={};function l(t){return"statsig.stable_id."+(0,i.o)(t)}function a(t,e){e=l(e);try{(0,s.L)(e,t)}catch(t){r.Log.warn("Failed to save StableID")}}e.StableID={get:e=>{if(null==u[e]){let t=function(t){t=l(t);return(0,s.G)(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,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(1845);const o=n(1845),u=n(5542),l=n(7770),a=n(7512),s=n(7787),c=n(6830),h=n(4143),d=n(4534);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.ve=null,this.fe={};var r,s=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&d.Storage._e(!0),null!=i&&i.initialSessionID&&h.StatsigSession.overrideInitialSessionID(i.initialSessionID,t),null!=i&&i.storageProvider&&d.Storage.ge(i.storageProvider),this.O=t,this.m=null!=i?i:{},this.ji={},this.overrideAdapter=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.pe=new l.EventLogger(t,s,n,i),this.$t=new u.ErrorBoundary(t,i,s),this.$t.wrap(this),this.$t.wrap(e),this.$t.wrap(this.pe),n.setErrorBoundary(this.$t),this.dataAdapter=e,this.dataAdapter.attach(t,i),this.storageProvider=d.Storage,this.be(),r=t,s=this,(0,c.kt)()||(n=(0,o.l)(),e=null!=(e=n.instances)?e:{},s=s,null!=e[r]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),e[r]=s,n.firstInstance||(n.firstInstance=s),n.instances=e,__STATSIG__=n)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.m.disableLogging=t.disableLogging,this.pe.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.m.disableStorage=t.disableStorage,d.Storage._e(t.disableStorage))}flush(){return this.pe.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.me("Uninitialized",null),this.ve=null,yield this.pe.stop()})}on(t,e){this.fe[t]||(this.fe[t]=[]),this.fe[t].push(e)}off(t,e){this.fe[t]&&-1!==(e=this.fe[t].indexOf(e))&&this.fe[t].splice(e,1)}$on(t,e){e.__isInternal=!0,this.on(t,e)}$emt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.$t.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.fe[n.name]&&this.fe[n.name].forEach(t=>e(t)),null!=(t=this.fe["*"])&&t.forEach(e)}me(t,e){this.loadingStatus=t,this.ji={},this.$emt({name:"values_updated",status:t,values:e})}ye(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.pe.incrementNonExposureCount(t):this.pe.enqueue(e)}wi(i,r){return(t,e)=>{var n;return!this.m.disableEvaluationMemoization&&(n=(0,s.createMemoKey)(i,t,e))?(n in this.ji||(3e3<=Object.keys(this.ji).length&&(this.ji={}),this.ji[n]=r(t,e)),this.ji[n]):r(t,e)}}}},2636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Oe=e.je=e.Ui=e.Se=e.xt=void 0;const s="statsig::config_exposure",o="statsig::gate_exposure",a="statsig::layer_exposure",c=(t,e,n,i,r)=>(n.bootstrapMetadata&&(i.bootstrapMetadata=n.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:u(n,i),secondaryExposures:r,time:Date.now()});e.xt=({eventName:t})=>t===o||t===s||t===a;function h(t,e){return t.map(t=>"string"==typeof t?(null!=e?e:{})[t]:t).filter(t=>null!=t)}e.Se=(t,e,n)=>{var i,r={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(r.configVersion=e.__evaluation.version),c(o,t,e.details,r,h(null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[],n))},e.Ui=h;e.je=(t,e,n)=>{var i,r={config:e.name,ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(r.configVersion=e.__evaluation.version),null!=(null==(i=e.__evaluation)?void 0:i.passed)&&(r.rulePassed=String(e.__evaluation.passed)),c(s,t,e.details,r,h(null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[],n))};e.Oe=(t,e,n,i)=>{var r=e.__evaluation,s=!0===(null==(s=null==r?void 0:r.explicit_parameters)?void 0:s.includes(n));let o="",u=null!=(l=null==r?void 0:r.undelegated_secondary_exposures)?l:[];s&&(o=null!=(l=r.allocated_experiment_name)?l:"",u=r.secondary_exposures);var l={config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(s)};return null!=(null==(r=e.__evaluation)?void 0:r.version)&&(l.configVersion=e.__evaluation.version),c(a,t,e.details,l,h(u,i))};const u=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},8e3:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="3.12.1";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},586:(t,e)=>{$Q(e)},1098:(t,e)=>{$Q(e)},2059:(t,e,n)=>{$Q(e),e.we=e.Te=e.ke=e.Ie=e.De=e.Ee=void 0;const o=n(7512),u=n(6634),r="default";function s(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,__evaluation:n,value:i}}function i(t,e,n){var i=null!=(i=null==n?void 0:n.value)?i:{};return $P($P({},s(t,e,n,i)),{get:l(t,null==n?void 0:n.value)})}function l(i,r,s){return(t,e)=>{var n=null!=(n=null==r?void 0:r[t])?n:null;return null==n?null!=e?e:null:null==e||(0,u.Me)(n,e)?(null!=s&&s(t),n):(o.Log.warn(`Parameter type mismatch. '${i}.${t}' was found to be type '${typeof n}' but fallback/return type is '${typeof e}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=e?e:null)}}e.Ee=function(t,e,n){return s(t,e,n,!0===(null==n?void 0:n.value))},e.De=i,e.Ie=function(t,e,n){return t=i(t,e,n),$P($P({},t),{groupName:null!=(e=null==n?void 0:n.group_name)?e:null})},e.ke=function(t,e,n,i){return $P($P({},s(t,e,n,void 0)),{get:l(t,null==n?void 0:n.value,i),groupName:null!=(e=null==n?void 0:n.group_name)?e:null,__value:null!=(t=null==n?void 0:n.value)?t:{}})},e.Te=function(t,e,n,i){return $P($P($P({},t),e),{get:l(t.name,n,i)})},e.we=l},1812:(t,e)=>{$Q(e)},3932:(t,e)=>{$Q(e),e.UPDATE_DETAIL_ERROR_MESSAGES=e.createUpdateDetails=void 0;e.createUpdateDetails=(t,e,n,i,r,s)=>({duration:n,source:e,success:t,error:i,sourceUrl:r,warnings:s}),e.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}},8578:(t,e,n)=>{$Q(e),e.v=e.T=void 0;const i=n(1406),r=n(7512);e.T=function(t,e,n){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&null!=e.environment?i.statsigEnvironment=e.environment:null!=n&&(i.statsigEnvironment={tier:n}),i}catch(t){return r.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e.v=function(t){return t?(0,i.Kt)(t):null}},4534:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.L=n.G=n.Storage=void 0;var i=e(7512),e=e(6830);const r={},s={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>r[t]||null,setItem:(t,e)=>{r[t]=e},removeItem:t=>{delete r[t]},getAllKeys:()=>Object.keys(r)};let o=null;try{const a=(0,e.te)();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){i.Log.warn("Failed to setup localStorageProvider.")}let u=null!==o&&void 0!==o?o:s,l=u;n.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 n.Storage.ge(s),null;throw t}},setItem:(t,e)=>l.setItem(t,e),removeItem:t=>l.removeItem(t),getAllKeys:()=>l.getAllKeys(),ge:t=>{u=t,l=t},_e:t=>{l=t?s:u}},n.G=function(t){return t=n.Storage.getItem(t),JSON.parse(null!=t?t:"null")},n.L=function(t,e){n.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,n)=>{$Q(e),e.P=void 0;const r=n(7512);e.P=function(t,e,n){try{var i=JSON.parse(t);if(i&&"object"==typeof i&&e in i)return i}catch(t){}return r.Log.error("Failed to parse "+n),null}},6634:(t,e)=>{$Q(e),e.Me=e.zt=void 0,e.zt=function(t){return Array.isArray(t)?"array":typeof t},e.Me=function(t,e){var n=t=>Array.isArray(t)?"array":typeof t;return n(t)===n(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 n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},1881:(t,e,n)=>{$Q(e),e.UrlConfiguration=void 0;const r=n(7410),s={[r.Endpoint.qt]:"i",[r.Endpoint.jt]:"e",[r.Endpoint.Bt]:"d"};e.UrlConfiguration=class{constructor(t,e,n,i){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=s[t],e&&(this.customUrl=e),!e&&n&&(this.customUrl=n.endsWith("/")?""+n+t:n+"/"+t),i&&(this.fallbackUrls=i);e=r.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}}},2397:(t,e,n)=>{$Q(e),e.Ae=e.It=e.Rt=e.xe=void 0;n=n(6830);const i="foreground",r="background",s=[];let o=i,u=!1;e.xe=()=>o===i,e.Rt=()=>u,e.It=t=>{s.unshift(t)};e.Ae=e=>{e!==o&&(o=e,s.forEach(t=>t(e)))},(0,n.he)("focus",()=>{(u=!1,e.Ae)(i)}),(0,n.he)("blur",()=>(0,e.Ae)(r)),(0,n.he)("beforeunload",()=>{u=!0,(0,e.Ae)(r)}),(0,n.ce)("visibilitychange",()=>{(0,e.Ae)("visible"===document.visibilityState?i:r)})},6914:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),e.Storage=e.Log=e.EventLogger=e.Diagnostics=void 0,n(1845);const s=n(8962),o=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return s.Diagnostics}}),n(7770)),u=($Q2(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),n(7512));$Q2(e,"Log",{enumerable:!0,get:function(){return u.Log}});var l=n(8e3);const a=n(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return a.Storage}}),r(n(1845),e),r(n(2137),e),r(n(6427),e),r(n(694),e),r(n(8962),e),r(n(3539),e),r(n(5542),e),r(n(2922),e),r(n(2417),e),r(n(1406),e),r(n(1333),e),r(n(7512),e),r(n(7787),e),r(n(7410),e),r(n(7023),e),r(n(1405),e),r(n(1361),e),r(n(6830),e),r(n(5902),e),r(n(4143),e),r(n(9122),e),r(n(1375),e),r(n(2636),e),r(n(3206),e),r(n(1637),e),r(n(8e3),e),r(n(586),e),r(n(1098),e),r(n(2059),e),r(n(1812),e),r(n(8578),e),r(n(4534),e),r(n(3401),e),r(n(6634),e),r(n(1881),e),r(n(8023),e),r(n(2397),e),r(n(3932),e),r(n(3091),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{Log:u.Log,SDK_VERSION:l.SDK_VERSION})},9638:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),r(n(600),e),e.default=__STATSIG__},8494:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e);const i=n(6914);class s extends i.NetworkCore{constructor(t=null){super(t);t=null==t?void 0:t.networkConfig;this.Pn=new i.UrlConfiguration(i.Endpoint.Bt,null==t?void 0:t.downloadConfigSpecsUrl,null==t?void 0:t.api,null==t?void 0:t.downloadConfigSpecsFallbackUrls)}fetchConfigSpecs(e,n){var i;return r(this,void 0,void 0,function*(){var t=yield this.get({sdkKey:e,urlConfig:this.Pn,priority:n});return null!=(i=null==t?void 0:t.body)?i:null})}}e.default=s},6217:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e);const o=n(6914),r=n(3066),s=n(8494),u=n(2660);class l extends o.StatsigClientBase{static instance(t){var e=(0,o.l)().instance(t);return e instanceof l?e:(o.Log.warn((0,o.kt)()?"StatsigOnDeviceEvalClient.instance is not supported in server environments":"Unable to find StatsigOnDeviceEvalClient instance"),new l(null!=t?t:""))}constructor(t,e=null){o.SDKType.ue(t,"js-on-device-eval-client");var n=new s.default(e);super(t,null!=(t=null==e?void 0:e.dataAdapter)?t:new u.StatsigSpecsDataAdapter,n,e),this.ht=n,this.We=new r.SpecStore,this.Un=new r.Evaluator(this.We)}initializeSync(t){return"Uninitialized"!==this.loadingStatus?{success:!0,duration:0,source:this.We.getSource(),sourceUrl:null,error:null}:(this.pe.start(),this.updateSync(t))}initializeAsync(t){return i(this,void 0,void 0,function*(){return this.ve||(this.ve=this.Ye(t)),this.ve})}updateSync(t){var e=performance.now(),n=(this.We.reset(),this.dataAdapter.getDataSync());return this.We.setValuesFromDataAdapter(n),this.We.finalize(),this.me("Ready",n),null!=t&&t.disableBackgroundCacheRefresh||this.Ze(n),(0,o.createUpdateDetails)(!0,this.We.getSource(),performance.now()-e,this.$t.getLastSeenErrorAndReset(),this.ht.getLastUsedInitUrlAndReset())}updateAsync(n){return i(this,void 0,void 0,function*(){var t=performance.now(),e=(this.We.reset(),this.me("Loading",null),this.dataAdapter.getDataSync());return this.We.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,n),this.We.setValuesFromDataAdapter(e),this.We.finalize(),this.me("Ready",e),(0,o.createUpdateDetails)(!0,this.We.getSource(),performance.now()-t,this.$t.getLastSeenErrorAndReset(),this.ht.getLastUsedInitUrlAndReset())})}getContext(){return{sdkKey:this.O,options:this.m,values:this.We.getValues(),errorBoundary:this.$t,session:o.StatsigSession.get(this.O),stableID:o.StableID.get(this.O)}}checkGate(t,e,n){return this.getFeatureGate(t,e,n).value}getFeatureGate(t,e,n){var e=this.T(e),{evaluation:i,details:r}=this.Un.evaluateGate(t,e),r=(0,o.Ee)(t,r,i);return this.ye(t,(0,o.Se)(e,r),n),this.$emt({name:"gate_evaluation",gate:r}),r}getDynamicConfig(t,e,n){var e=this.T(e),{evaluation:i,details:r}=this.Un.evaluateConfig(t,e),r=(0,o.De)(t,r,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:s.call(i,r,e,n),i=null!=s?s:r;return this.ye(t,(0,o.je)(e,i),n),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e,n){var e=this.T(e),{evaluation:i,details:r}=this.Un.evaluateConfig(t,e),r=(0,o.Ie)(t,r,i),s=null==(s=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:s.call(i,r,e,n),i=null!=s?s:r;return this.ye(t,(0,o.je)(e,i),n),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,t,n){const i=this.T(t);var{evaluation:t,details:r}=this.Un.evaluateLayer(e,i);const s=(0,o.ke)(e,r,t,t=>{this.ye(e,(0,o.Oe)(i,s,t),n)});return this.$emt({name:"layer_evaluation",layer:s}),s}logEvent(t,e,n,i){this.pe.enqueue($P($P({},"string"==typeof t?{eventName:t,value:n,metadata:i}:t),{user:this.T(e),time:Date.now()}))}be(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Qe(null)})}Ye(t){return i(this,void 0,void 0,function*(){return o.Storage.isReady()||(yield o.Storage.isReadyResolver()),this.pe.start(),this.updateAsync(t)})}Qe(t){this.We.finalize(),this.me("Ready",t)}T(t){return(0,o.T)(t,this.m,this.We.getDefaultEnvironment())}Ze(t){this.dataAdapter.getDataAsync(t,{priority:"low"}).catch(t=>{o.Log.error("An error occurred after update.",t)})}}e.default=l},2660:function(t,e,n){var r=this&&this.__awaiter||$A();$Q(e),e.StatsigSpecsDataAdapter=void 0;const i=n(6914),s=n(8494);class o extends i.DataAdapterCore{constructor(){super("SpecsDataAdapter","specs"),this.ht=null}attach(t,e){super.attach(t,e),this.ht=new s.default(null!=e?e:{})}getDataAsync(t,e){return this.D(t,void 0,e)}prefetchData(t){return this.A(void 0,t)}R(t,e,n){var i;return r(this,void 0,void 0,function*(){return null!=(i=yield null==(i=this.ht)?void 0:i.fetchConfigSpecs(this.C(),null==n?void 0:n.priority))?i:null})}k(){var t=(0,i.o)(this.C());return`${i.DataAdapterCachePrefix}.${this.p}.`+t}N(t,e){return 0<t.data.length}}e.StatsigSpecsDataAdapter=o},600:(t,e,n)=>{$Q(e),e.StatsigSpecsDataAdapter=e.StatsigOnDeviceEvalClient=void 0;var i=n(6217);e.StatsigOnDeviceEvalClient=i.default;const r=n(2660);$Q2(e,"StatsigSpecsDataAdapter",{enumerable:!0,get:function(){return r.StatsigSpecsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigSpecsDataAdapter:r.StatsigSpecsDataAdapter,StatsigOnDeviceEvalClient:i.default}),e.default=__STATSIG__},6535:(t,e)=>{function u(t){return t.setUTCHours(0,0,0,0),t.getTime()}$Q(e),e.default={compareNumbers(t,e,n){if(null==t||null==e)return!1;var i=Number(t),r=Number(e);if(isNaN(i)||isNaN(r))return!1;switch(n){case"gt":return e<t;case"gte":return e<=t;case"lt":return t<e;case"lte":return t<=e;default:return!1}},compareVersions(t,e,n){if(null==t||null==e)return!1;var t=String(t),e=String(e),i=t=>{var e=t.indexOf("-");return-1!==e?t.substring(0,e):t},r=((t,e)=>{var n=t.split(".").map(t=>parseInt(t)),i=e.split(".").map(t=>parseInt(t));let r=0;for(;r<Math.max(n.length,i.length);){var s=r<n.length?n[r]:0,o=r<i.length?i[r]:0;if(s<o)return-1;if(o<s)return 1;r++}return 0})(i(t),i(e));switch(n){case"version_gt":return 0<r;case"version_gte":return 0<=r;case"version_lt":return r<0;case"version_lte":return r<=0;case"version_eq":return 0===r;case"version_neq":return 0!==r;default:return!1}},compareStringInArray(r,t,s){if(!Array.isArray(t))return!1;const o="any_case_sensitive"!==s&&"none_case_sensitive"!==s;var e=-1!==t.findIndex(t=>{var e=String(r),t=String(t),n=o?e.toLowerCase():e,i=o?t.toLowerCase():t;switch(s){case"any":case"none":case"any_case_sensitive":case"none_case_sensitive":return n===i;case"str_starts_with_any":return n.startsWith(i);case"str_ends_with_any":return n.endsWith(i);case"str_contains_any":case"str_contains_none":return n.includes(i);default:return!1}});switch(s){case"none":case"none_case_sensitive":case"str_contains_none":return!e;default:return e}},compareStringWithRegEx(t,e){try{var n=String(t);if(n.length<1e3)return new RegExp(String(e)).test(n)}catch(t){}return!1},compareTime(n,i,r){if(null==n||null==i)return!1;try{let t=new Date(String(n)),e=(isNaN(t.getTime())&&(t=new Date(Number(n))),new Date(String(i)));isNaN(e.getTime())&&(e=new Date(Number(i)));var s=t.getTime(),o=e.getTime();if(isNaN(s)||isNaN(o))return!1;switch(r){case"before":return s<o;case"after":return o<s;case"on":return u(t)===u(e);default:return!1}}catch(t){return!1}},arrayHasValue(t,e){var n=new Set(t);for(let t=0;t<e.length;t++)if(n.has(e[t])||n.has(parseFloat(e[t])))return!0;return!1},arrayHasAllValues(t,e){var n=new Set(t);for(let t=0;t<e.length;t++)if(!n.has(e[t])&&!n.has(parseFloat(e[t])))return!1;return!0}}},5079:(t,e)=>{$Q(e),e.resultToLayerEval=e.resultToConfigEval=e.resultToGateEval=e.makeEvalResult=void 0,e.makeEvalResult=function(t){return $P($P({},{unsupported:!1,bool_value:!1,rule_id:"",secondary_exposures:[],json_value:{},explicit_parameters:null,allocated_experiment_name:null,is_experiment_group:!1,group_name:null,undelegated_secondary_exposures:void 0}),t)},e.resultToGateEval=function(t,e){return{name:t.name,id_type:t.idType,rule_id:e.rule_id,value:e.bool_value,secondary_exposures:e.secondary_exposures,version:null==(e=t.version)?void 0:e.toString()}},e.resultToConfigEval=function(t,e){var n;return{name:t.name,id_type:t.idType,rule_id:e.rule_id,value:e.json_value,secondary_exposures:e.secondary_exposures,group:null!=(n=e.group_name)?n:"",group_name:null!=(n=e.group_name)?n:void 0,is_device_based:!1,is_experiment_active:t.isActive,is_user_in_experiment:e.is_experiment_group,version:null==(n=t.version)?void 0:n.toString(),passed:e.bool_value}},e.resultToLayerEval=function(t,e,n){var i;return{name:t.name,rule_id:n.rule_id,value:n.json_value,secondary_exposures:n.secondary_exposures,undelegated_secondary_exposures:n.undelegated_secondary_exposures,allocated_experiment_name:null!=(i=n.allocated_experiment_name)?i:"",explicit_parameters:null!=(i=n.explicit_parameters)?i:[],group:null!=(i=n.group_name)?i:"",group_name:null!=(i=n.group_name)?i:void 0,is_device_based:!1,is_experiment_active:null==e?void 0:e.isActive,is_user_in_experiment:n.is_experiment_group,version:null==(i=t.version)?void 0:i.toString()}}},5007:(t,e,n)=>{$Q(e),e.Evaluator=void 0;const i=n(5680),h=n(6535),d=n(5079);function v(t,e){var n;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(n=null==(n=t.customIDs)?void 0:n[e])?n:null==(n=null==t?void 0:t.customIDs)?void 0:n[e.toLowerCase()]:t.userID}function f(t){return(0,i.SHA256)(t).dataView().getBigUint64(0,!1)}function u(t){return null!=t&&"object"==typeof t}e.Evaluator=class{constructor(t){this.We=t}evaluateGate(t,e){var{spec:t,details:n}=this.xn("gate",t);return t?{evaluation:(0,d.resultToGateEval)(t,this.Dn(t,e)),details:n}:{evaluation:null,details:n}}evaluateConfig(t,e){var{spec:t,details:n}=this.xn("config",t);return t?{evaluation:(0,d.resultToConfigEval)(t,this.Dn(t,e)),details:n}:{evaluation:null,details:n}}evaluateLayer(t,e){var n,{spec:t,details:i}=this.xn("layer",t);return t?(n=null!=(n=null==(e=this.Dn(t,e))?void 0:e.allocated_experiment_name)?n:"",n=this.We.getSpecAndSourceInfo("config",n).spec,{evaluation:(0,d.resultToLayerEval)(t,n,e),details:i}):{evaluation:null,details:i}}getParamStoreConfig(t){var t=this.We.getParamStoreAndSourceInfo(t),e=this.Nn(t);return{config:null!=(t=t.paramStoreConfig)?t:null,details:e}}xn(t,e){t=this.We.getSpecAndSourceInfo(t,e);return{details:this.Nn(t),spec:t.spec}}Nn(t){var{source:e,lcut:n,receivedAt:i}=t;return"Uninitialized"===e||"NoValues"===e?{reason:e}:{reason:e+":"+(null==("spec"in t?t.spec:t.paramStoreConfig)?"Unrecognized":"Recognized"),lcut:n,receivedAt:i}}Dn(t,e){var n=u(t.defaultValue)?t.defaultValue:void 0;if(!t.enabled)return(0,d.makeEvalResult)({json_value:n,rule_id:"disabled"});var i=[];for(const o of t.rules){var r,s=this.En(o,e);if(s.unsupported)return s;if(i.push(...s.secondary_exposures),s.bool_value)return this.Mn(o.configDelegate,e,i)||(r=function(t,e,n){if(100===t.passPercentage)return!0;if(0===t.passPercentage)return!1;e=f(n.salt+"."+(null!=(n=t.salt)?n:t.id)+"."+(null!=(n=v(e,t.idType))?n:""));return Number(e%BigInt(1e4))<100*t.passPercentage}(o,e,t),(0,d.makeEvalResult)({rule_id:s.rule_id,bool_value:r,json_value:r?s.json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,is_experiment_group:s.is_experiment_group,group_name:s.group_name}))}return(0,d.makeEvalResult)({json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,rule_id:"default"})}En(t,e){var n=[];let i=!0;for(const s of t.conditions){var r=this.An(s,e);if(r.unsupported)return r;n.push(...r.secondary_exposures),r.bool_value||(i=!1)}return(0,d.makeEvalResult)({rule_id:t.id,bool_value:i,json_value:u(t.returnValue)?t.returnValue:void 0,secondary_exposures:n,is_experiment_group:!0===t.isExperimentGroup,group_name:t.groupName})}An(t,e){let n=null,i=!1;var r=t.field,s=t.targetValue,o=t.idType,u=t.type;switch(u){case"public":return(0,d.makeEvalResult)({bool_value:!0});case"pass_gate":case"fail_gate":var l=String(s),l=this.Fn(l,e);return(0,d.makeEvalResult)({bool_value:"fail_gate"===u?!l.bool_value:l.bool_value,secondary_exposures:l.secondary_exposures});case"multi_pass_gate":case"multi_fail_gate":return this.Rn(s,u,e);case"user_field":case"ip_based":case"ua_based":n=function(t,e){var n;if(null==e||"object"!=typeof t||null==t)return null;var i=t;return null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=i[e])?n:i[e.toLowerCase()])?n:null==(i=null==t?void 0:t.custom)?void 0:i[e])?n:null==(i=null==t?void 0:t.custom)?void 0:i[e.toLowerCase()])?n:null==(i=null==t?void 0:t.privateAttributes)?void 0:i[e])?n:null==(i=null==t?void 0:t.privateAttributes)?void 0:i[e.toLowerCase()]}(e,r);break;case"environment_field":n=function(t,e){if(null==e)return null;t=t.statsigEnvironment;if(null!=t){const n=e.toLowerCase(),i=Object.keys(t).find(t=>t.toLowerCase()===n);return void 0!==i?t[i]:void 0}}(e,r);break;case"current_time":n=Date.now();break;case"user_bucket":l=f(String(null!=(l=null==(l=t.additionalValues)?void 0:l.salt)?l:"")+"."+(null!=(l=v(e,o))?l:""));n=Number(l%BigInt(1e3));break;case"unit_id":n=v(e,o);break;default:return(0,d.makeEvalResult)({unsupported:!0})}var a,c=t.operator;switch(c){case"gt":case"gte":case"lt":case"lte":i=h.default.compareNumbers(n,s,c);break;case"version_gt":case"version_gte":case"version_lt":case"version_lte":case"version_eq":case"version_neq":i=h.default.compareVersions(n,s,c);break;case"any":case"none":case"str_starts_with_any":case"str_ends_with_any":case"str_contains_any":case"str_contains_none":case"any_case_sensitive":case"none_case_sensitive":i=h.default.compareStringInArray(n,s,c);break;case"str_matches":i=h.default.compareStringWithRegEx(n,s);break;case"before":case"after":case"on":i=h.default.compareTime(n,s,c);break;case"eq":i=n==s;break;case"neq":i=n!=s;break;case"in_segment_list":case"not_in_segment_list":return(0,d.makeEvalResult)({unsupported:!0});case"array_contains_any":case"array_contains_none":Array.isArray(s)?i=!!Array.isArray(n)&&(a=h.default.arrayHasValue(n,s),"array_contains_any"===c?a:!a):i=!1;break;case"array_contains_all":case"not_array_contains_all":Array.isArray(s)?i=!!Array.isArray(n)&&(a=h.default.arrayHasAllValues(n,s),"array_contains_all"===c?a:!a):i=!1}return(0,d.makeEvalResult)({bool_value:i})}Mn(t,e,n){var i;return t&&(i=this.We.getSpecAndSourceInfo("config",t).spec,i)?(e=this.Dn(i,e),(0,d.makeEvalResult)($P($P({},e),{allocated_experiment_name:t,explicit_parameters:i.explicitParameters,secondary_exposures:n.concat(e.secondary_exposures),undelegated_secondary_exposures:n}))):null}Fn(t,e){var n=[];let i=!1;var r=this.We.getSpecAndSourceInfo("gate",t)["spec"];if(r){r=this.Dn(r,e);if(r.unsupported)return r;i=r.bool_value,n.push(...r.secondary_exposures),n.push({gate:t,gateValue:String(i),ruleID:r.rule_id})}return(0,d.makeEvalResult)({bool_value:i,secondary_exposures:n})}Rn(t,e,n){if(!Array.isArray(t))return(0,d.makeEvalResult)({unsupported:!0});var i="multi_pass_gate"===e,r=[];let s=!1;for(const u of t){if("string"!=typeof u)return(0,d.makeEvalResult)({unsupported:!0});var o=this.Fn(u,n);if(o.unsupported)return o;if(r.push(...o.secondary_exposures),i?!0===o.bool_value:!1===o.bool_value){s=!0;break}}return(0,d.makeEvalResult)({bool_value:s,secondary_exposures:r})}}},8313:(t,e,n)=>{$Q(e),e.SpecStore=void 0;const i=n(6914);function r(t){return(0,i.P)(t,"has_updates","DownloadConfigSpecsResponse")}e.SpecStore=class{constructor(){this.Re=null,this.Pe=null,this.Ce="Uninitialized",this.Ue=0,this.Fe=0,this.zn=null}getValues(){return this.Re?r(this.Re):null}getSource(){return this.Ce}getDefaultEnvironment(){return this.zn}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=r(t.data))?void 0:e.has_updates)&&(this.Ue=e.time,this.Fe=t.receivedAt,this.Ce=t.source,this.Pe=e,this.Re=t.data,this.zn=null!=(t=e.default_environment)?t:null)}reset(){this.Pe=null,this.Re=null,this.Ce="Loading"}finalize(){this.Pe||(this.Ce="NoValues")}getSpecAndSourceInfo(t,e){var t=this.Cn(t);return{spec:null!=(t=null==t?void 0:t.find(t=>t.name===e))?t:null,source:this.Ce,lcut:this.Ue,receivedAt:this.Fe}}getParamStoreAndSourceInfo(t){var e=null==(e=this.Pe)?void 0:e.param_stores;return{paramStoreConfig:null!=(t=null==(e=null==e?void 0:e[t])?void 0:e.parameters)?t:null,source:this.Ce,lcut:this.Ue,receivedAt:this.Fe}}Cn(t){var e;switch(t){case"gate":return null==(e=this.Pe)?void 0:e.feature_gates;case"config":return null==(e=this.Pe)?void 0:e.dynamic_configs;case"layer":return null==(e=this.Pe)?void 0:e.layer_configs}}}},3066:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),r(n(5007),e),r(n(8313),e)},5680:(t,e,n)=>{$Q(e),e.SHA256=void 0;const i=n(7485);$Q2(e,"SHA256",{enumerable:!0,get:function(){return i.SHA256}})},7485:(t,e)=>{$Q(e),e.SHA256=void 0,e.SHA256=function(t){return(new i).update(t)};const n=[-2147483648,8388608,32768,128],o=[24,16,8,0],m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];class i{constructor(){this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.lastByteIndex=-1}update(n){if(!this.finalized){if("string"!=typeof n)throw new Error('Must be of type "string"');var i;let t=0,e;for(var r=n.length,s=this.blocks;t<r;){for(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),e=this.start;t<r&&e<64;++t)(i=n.charCodeAt(t))<128?s[e>>2]|=i<<o[3&e++]:(i<2048?s[e>>2]|=(192|i>>6)<<o[3&e++]:(i<55296||57344<=i?s[e>>2]|=(224|i>>12)<<o[3&e++]:(i=65536+((1023&i)<<10|1023&n.charCodeAt(++t)),s[e>>2]|=(240|i>>18)<<o[3&e++],s[e>>2]|=(128|i>>12&63)<<o[3&e++]),s[e>>2]|=(128|i>>6&63)<<o[3&e++]),s[e>>2]|=(128|63&i)<<o[3&e++]);this.lastByteIndex=e,this.bytes+=e-this.start,64<=e?(this.block=s[16],this.start=e-64,this.hash(),this.hashed=!0):this.start=e}4294967295<this.bytes&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296)}return this}finalize(){var t,e;this.finalized||(this.finalized=!0,t=this.blocks,e=this.lastByteIndex,t[16]=this.block,t[e>>2]|=n[3&e],this.block=t[16],56<=e&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash())}hash(){var t=this.blocks;let e=this.h0,n=this.h1,i=this.h2,r=this.h3,s=this.h4,o=this.h5,u=this.h6,l=this.h7,a,c,h,d,v,f,_,p,g,y,b;for(a=16;a<64;++a)v=t[a-15],c=(v>>>7|v<<25)^(v>>>18|v<<14)^v>>>3,v=t[a-2],h=(v>>>17|v<<15)^(v>>>19|v<<13)^v>>>10,t[a]=t[a-16]+c+t[a-7]+h<<0;for(b=n&i,a=0;a<64;a+=4)this.first?(p=704751109,v=t[0]-210244248,l=v-1521486534<<0,r=v+143694565<<0,this.first=!1):(c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),h=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),p=e&n,d=p^e&i^b,_=s&o^~s&u,v=l+h+_+m[a]+t[a],f=c+d,l=r+v<<0,r=v+f<<0),c=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),h=(l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7),g=r&e,d=g^r&n^p,_=l&s^~l&o,v=u+h+_+m[a+1]+t[a+1],f=c+d,u=i+v<<0,i=v+f<<0,c=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),h=(u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7),y=i&r,d=y^i&e^g,_=u&l^~u&s,v=o+h+_+m[a+2]+t[a+2],f=c+d,o=n+v<<0,n=v+f<<0,c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),h=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),b=n&i,d=b^n&r^y,_=o&u^~o&l,v=s+h+_+m[a+3]+t[a+3],f=c+d,s=e+v<<0,e=v+f<<0;this.h0=this.h0+e<<0,this.h1=this.h1+n<<0,this.h2=this.h2+i<<0,this.h3=this.h3+r<<0,this.h4=this.h4+s<<0,this.h5=this.h5+o<<0,this.h6=this.h6+u<<0,this.h7=this.h7+l<<0}arrayBuffer(){return this.Gn().buffer}dataView(){return this.Gn().dataView}Gn(){this.finalize();var t=new ArrayBuffer(32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),e.setUint32(28,this.h7),{dataView:e,buffer:t}}}}},i={};function r(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,r)),e.exports}return r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r(9638).default})());
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsig/js-on-device-eval-client",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.1",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@statsig/client-core": "3.12.
|
|
6
|
-
"@statsig/on-device-eval-core": "3.12.
|
|
5
|
+
"@statsig/client-core": "3.12.1",
|
|
6
|
+
"@statsig/on-device-eval-core": "3.12.1"
|
|
7
7
|
},
|
|
8
8
|
"jsdelivr": "./build/statsig-js-on-device-eval-client.min.js",
|
|
9
9
|
"type": "commonjs",
|