@statsig/js-on-device-eval-client 3.30.2-beta.1 → 3.30.2-beta.2
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
|
-
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())})});!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 n={1845:(t,n,e)=>{var i;$Q2(n,"__esModule",{value:!0}),n.t=n.i=n.l=void 0;const s=e(7512);n.l=()=>{try{return"undefined"!=typeof __STATSIG__?__STATSIG__:o}catch(t){return o}},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&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var r="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},u="undefined"!=typeof globalThis?globalThis:{};const o=null!=(i=null!=(i=null!=(i=l[r])?i:e[r])?i:u[r])?i:{instance:n.t};l[r]=o,e[r]=o,u[r]=o},7463:(t,e,n)=>{$Q(e),e.BatchQueue=void 0;const s=n(1956),i=n(4309);e.BatchQueue=class{constructor(t=i.EventRetryConstants.DEFAULT_BATCH_SIZE){this.Ci=[],this.Fi=t}batchSize(){return this.Fi}requeueBatch(t){return this.Ai(t)}hasFullBatch(){return this.Ci.some(t=>t.events.length>=this.Fi)}takeNextBatch(){var t;return null!=(t=this.Ci.shift())?t:null}takeAllBatches(){var t=this.Ci;return this.Ci=[],t}createBatches(t){let e=0,n=0;for(;e<t.length;){var i=t.slice(e,e+this.Fi);n+=this.Ai(new s.EventBatch(i)),e+=this.Fi}return n}Ai(t){this.Ci.push(t);let e=0;for(;this.Ci.length>i.EventRetryConstants.MAX_PENDING_BATCHES;){var n=this.Ci.shift();n&&(e+=n.events.length)}return e}}},2137:(t,e,n)=>{$Q(e),e.o=e.u=void 0;const s=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,s.h)(e.join("|"))}e.u=i,e.o=function(t,e,n){return e?i(t,e,n):(0,s.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.v=e.DataAdapterCore=void 0;const o=n(7512),a=n(9122),r=n(8578),l=n(4534),c=n(3401);function h(t,e,n,i){return{source:t,data:e,receivedAt:Date.now(),stableID:n,fullUserHash:(0,r._)(i)}}e.DataAdapterCore=class{constructor(t,e){this.p=t,this.m=e,this.O=null,this.j=null,this.gn=10,this.S="statsig.last_modified_time."+e,this.k=new i}attach(t,e,n){this.j=t,this.O=e}getDataSync(t){var t=t&&(0,r.D)(t,this.O),e=this.I(t),n=this.k.get(e,t);return n&&this.M(n)?n:(n=this.T(e))&&this.M(n)?(this.k.add(e,n,this.gn),this.k.get(e,t)):null}setData(t,e){var e=e&&(0,r.D)(e,this.O),n=this.I(e);this.k.add(n,h("Bootstrap",t,null,e),this.gn)}M(t){return null==t.stableID||t.stableID===a.StableID.get(this.N())}C(e,n,i){return s(this,void 0,void 0,function*(){l.Storage.isReady()||(yield l.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(n),t=[this.R(t,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(o.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}U(n,i){return s(this,void 0,void 0,function*(){var t=n&&(0,r.D)(n,this.O),e=this.I(t),t=yield this.C(null,t,i);t&&this.k.add(e,$P($P({},t),{source:"Prefetch"}),this.gn)})}R(r,l,u){return s(this,void 0,void 0,function*(){var t=null!=(t=null==r?void 0:r.data)?t:null,e=null!=r&&this.A(r,l),e=yield this.F(t,l,u,e);if(!e)return o.Log.debug("No response returned for latest value"),null;var n=(0,c.P)(e,"has_updates","Response"),i=this.N(),i=a.StableID.get(i);let s=null;if(!0===(null==n?void 0:n.has_updates))s=h("Network",e,i,l);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;s=h("NetworkNotModified",t,i,l)}e=this.I(l);return this.k.add(e,s,this.gn),this.L(e,s),s})}N(){return null!=this.j?this.j:(o.Log.error(this.p+" is not attached to a Client"),"")}T(t){var e=null==(e=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}L(e,t){var n=JSON.stringify(t);for(let t=0;t<8;t++)try{l.Storage.setItem(e,n);break}catch(t){if(!(t instanceof Error)||!t.toString().includes("QuotaExceededError")&&!t.toString().includes("QUOTA_EXCEEDED_ERR")||this.gn<=1)throw t;this.gn=Math.ceil(this.gn/2),this.q(e,this.gn-1)}this.q(e)}q(t,e=this.gn){var n=null!=(i=(0,l.K)(this.S))?i:{},i=(n[t]=Date.now(),u(n,e));for(const s of i)delete n[s],l.Storage.removeItem(s);(0,l.B)(this.S,n)}},e.v=h;class i{constructor(){this.$={}}get(t,e){var t=this.$[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?(o.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e,n){for(const i of u(this.$,n-1))delete this.$[i];this.$[t]=e}merge(t){this.$=$P($P({},this.$),t)}}function u(n,t){var e=Object.keys(n);return e.length<=t?[]:0===t?e:e.sort((t,e)=>{t=n[t],e=n[e];return"object"==typeof t&&"object"==typeof e?t.receivedAt-e.receivedAt:t-e}).slice(0,e.length-t)}},8962:(t,l)=>{$Q2(l,"__esModule",{value:!0}),l.Diagnostics=void 0;const i=new Map,n="start";function s(t,e,n,i){return $P({key:n,action:e,step:i,timestamp:Date.now()},t)}function r(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]}l.Diagnostics={V:t=>i.get(t),G:t=>{r(t,s({},n,"overall"))},J:(t,e,n)=>{r(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},"end","overall"))},W:(t,e)=>{r(t,s(e,n,"initialize","network_request"))},Y:(t,e)=>{r(t,s(e,"end","initialize","network_request"))},X:t=>{r(t,s({},n,"initialize","process"))},H:(t,e)=>{r(t,s(e,"end","initialize","process"))},Z:t=>{i.delete(t)},tt(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},et(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:l.Diagnostics.tt(i)}},it(t,e,n,i){var s,r=l.Diagnostics.V(n);return null==r||r.length<=0?-1:(s=r[r.length-1].timestamp-r[0].timestamp,l.Diagnostics.Z(n),n=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:r.slice(),statsigOptions:i}),e.enqueue(n),s)}}},8809:function(t,e){var n=this&&this.__awaiter||$A();$Q(e),e.nt=void 0;const s=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),r="https://cloudflare-dns.com/dns-query",l=["i","e","d"],u=200;e.nt=function(e){return n(this,void 0,void 0,function*(){var n=yield e(r,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:s});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)&&l.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,a,e){var n=this&&this.__awaiter||$A();$Q2(a,"__esModule",{value:!0}),a.ErrorBoundary=a.EXCEPTION_ENDPOINT=void 0;const i=e(7512),c=e(5902),h=e(8e3),d=(a.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");function v(t){return t instanceof Error?t:"string"==typeof t?new Error(t):new Error("An unknown error occurred.")}a.ErrorBoundary=class{constructor(t,e,n,i){this.j=t,this.O=e,this.st=n,this.rt=i,this.lt=new Set}wrap(i,s){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.ot(s?s+":"+e:e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.ut("eb:wrap",t)}}logError(t,e){this.ut(t,e)}logDroppedEvents(t,e,n){const i={eventCount:String(t)};n&&Object.entries(n).forEach(([t,e])=>{i[t]=String(e)}),this.ut("statsig::log_event_dropped_event_count",new Error(e),!0,i)}logEventRequestFailure(t,e,n,i){t={eventCount:String(t),flushType:n,statusCode:String(i)};this.ut("statsig::log_event_failed",new Error(e),!0,t)}getLastSeenErrorAndReset(){var t=this.rt;return this.rt=void 0,null!=t?t:null}attachErrorIfNoneExists(t){this.rt||(this.rt=v(t))}ot(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.ut(e,t)):n}catch(t){return this.ut(e,t),null}}ut(r,l,u=!1,o){try{i.Log.warn("Caught error in "+r,{error:l});n(this,void 0,void 0,function*(){var t,e=l||Error(d),n=e instanceof Error,i=n?e.name:"No Name",s=v(e);this.rt=s,!u&&this.lt.has(i)||(this.lt.add(i),null!=(s=null==(s=this.O)?void 0:s.networkConfig)&&s.preventAllNetworkTraffic?null!=(s=this.st)&&s.call(this,{name:"error",error:l,tag:r}):(s=c.SDKType.ct(this.j),t=h.StatsigMetadataProvider.get(),n=n?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return d}}(e),e=$P({tag:r,exception:i,info:n,extra:o,statsigOptions:function(i){if(!i)return{};const s={};return Object.keys(i).forEach(t=>{var e=t,n=i[e];switch(typeof n){case"number":case"bigint":case"boolean":s[String(e)]=n;break;case"string":n.length<50?s[String(e)]=n:s[String(e)]="set";break;case"object":"environment"===e?s.environment=n:"networkConfig"===e?s.networkConfig=n:s[String(e)]=null!=n?"set":"unset"}}),s}(this.O)},$P($P({},t),{sdkType:s})),yield(null!=(i=null==(n=null==(i=this.O)?void 0:i.networkConfig)?void 0:n.networkOverrideFunc)?i:fetch)(a.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.j,"STATSIG-SDK-TYPE":String(s),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:JSON.stringify(e)}),null!=(n=this.st)&&n.call(this,{name:"error",error:l,tag:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},1956:(t,e)=>{$Q(e),e.EventBatch=void 0;e.EventBatch=class{constructor(t){this.attempts=0,this.createdAt=Date.now(),this.events=t}incrementAttempts(){this.attempts++}}},7770:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=n(7463),s=n(2137),l=n(4309),u=n(4312),o=n(1406),a=n(7512),c=n(7410),h=n(1228),d=n(6830),v=n(1637),f=n(586),_=n(4534),g=n(1881),p=n(2397),b={};class y{static ht(t){null!=(t=b[t])&&t.flush().catch(()=>{})}constructor(t,e,n,i,s){this.j=t,this.st=e,this.ft=n,this.O=i,this.te=s,this._t={},this.bt={},this.Ni=!1,this.Ri=null,this.jt=null!=(t=null==i?void 0:i.loggingEnabled)?t:!0===(null==i?void 0:i.disableLogging)?f.LoggingEnabledOption.disabled:f.LoggingEnabledOption.browserOnly,null!=i&&i.loggingEnabled&&void 0!==i.disableLogging&&a.Log.warn("Detected both loggingEnabled and disableLogging options. loggingEnabled takes precedence - please remove disableLogging.");e=null==i?void 0:i.networkConfig,this.wt=new g.UrlConfiguration(c.Endpoint.kt,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls),s=null!=(n=null==i?void 0:i.loggingBufferMaxSize)?n:l.EventRetryConstants.DEFAULT_BATCH_SIZE;this.Ui=new h.PendingEvents(s),this.Pi=new r.BatchQueue(s),this.Li=new u.FlushCoordinator(this.Pi,this.Ui,()=>this.appendAndResetNonExposedChecks(),this.j,this.ft,this.st,this.wt,this.O,this.jt,this.te)}setLogEventCompressionMode(t){this.Li.setLogEventCompressionMode(t)}setLoggingEnabled(t){var e="disabled"===this.jt,n="disabled"!==t;this.jt=t,this.Li.setLoggingEnabled(t),e&&n&&(t=this.Bi(),a.Log.debug(`Loaded ${t.length} stored event(s) from storage`),0<t.length)&&(t.forEach(t=>{this.Li.addEvent(t)}),this.flush().catch(t=>{a.Log.warn("Failed to flush events after enabling logging:",t)}))}enqueue(t){this.Et(t)&&(t=this.zi(t),"disabled"===this.jt?this.qi(t):(this.Li.addEvent(t),this.Li.checkQuickFlush()))}incrementNonExposureCount(t){var e=null!=(e=this.bt[t])?e:0;this.bt[t]=e+1}reset(){this.flush().catch(()=>{}),this._t={}}start(){var t,e=(0,d.Mt)();e&&"always"!==(null==(t=this.O)?void 0:t.loggingEnabled)||(b[this.j]=this,e||(0,p.xt)(t=>{"background"===t?y.ht(this.j):"foreground"===t&&this.Li.startScheduledFlushCycle()}),this.Li.loadAndRetryShutdownFailedEvents().catch(t=>{a.Log.warn("Failed to load failed shutdown events:",t)}),this.Li.startScheduledFlushCycle())}stop(){return i(this,void 0,void 0,function*(){this.Ni=!0,yield this.Li.processShutdown(),delete b[this.j]})}flush(){return i(this,void 0,void 0,function*(){return this.Li.processManualFlush()})}appendAndResetNonExposedChecks(){var t;0!==Object.keys(this.bt).length&&(t=this.zi({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.bt)}}),this.Li.addEvent(t),this.bt={})}Et(t){if("always"!==(null==(e=this.O)?void 0:e.loggingEnabled)&&(0,d.Mt)())return!1;if((0,v.Ut)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.u)(this.j,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._t[t],n=Date.now();if(e&&n-e<6e5)return!1;1e3<Object.keys(this._t).length&&(this._t={}),this._t[t]=n}return!0}qt(){var t;if(!1!==(null==(t=this.O)?void 0:t.includeCurrentPageUrlWithEvents))return(0,d.Kt)()}o(){return this.Ri||(this.Ri="statsig.pending_events."+(0,o.h)(this.j)),this.Ri}qi(e){var n=this.o();try{let t=this.$i(n);t.push(e),t.length>l.EventRetryConstants.MAX_LOCAL_STORAGE&&(t=t.slice(-l.EventRetryConstants.MAX_LOCAL_STORAGE)),(0,_.B)(n,t)}catch(t){a.Log.warn("Unable to save events to storage")}}$i(t){try{var e=(0,_.K)(t);return Array.isArray(e)?e:[]}catch(t){return[]}}Bi(){var t=this.o(),e=this.$i(t);return 0<e.length&&_.Storage.removeItem(t),e}zi(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.qt();return n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e)}}e.EventLogger=y},4309:(t,e)=>{$Q(e),e.EventRetryConstants=void 0,e.EventRetryConstants={MAX_RETRY_ATTEMPTS:5,DEFAULT_BATCH_SIZE:100,MAX_PENDING_BATCHES:10,TICK_INTERVAL_MS:1e3,QUICK_FLUSH_WINDOW_MS:200,MAX_LOCAL_STORAGE:500,get MAX_QUEUED_EVENTS(){return this.DEFAULT_BATCH_SIZE*this.MAX_PENDING_BATCHES}}},6351:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventSender=void 0;const r=n(7512),s=n(7410),l=n(2397);e.EventSender=class{constructor(t,e,n,i,s,r){this.j=t,this.ft=e,this.st=n,this.O=s,this.wt=i,this.jt=r}setLogEventCompressionMode(t){this.ft.setLogEventCompressionMode(t)}setLoggingEnabled(t){this.jt=t}sendBatch(s){return i(this,void 0,void 0,function*(){var t,e;try{var n=(0,l.Ft)()&&this.ft.isBeaconSupported()&&null==(null==(e=null==(t=this.O)?void 0:t.networkConfig)?void 0:e.networkOverrideFunc),i=(this.st({name:"pre_logs_flushed",events:s.events}),n?this.Pt(s):yield this.Lt(s));return i.success?(this.st({name:"logs_flushed",events:s.events}),i):{success:!1,statusCode:-1}}catch(t){return r.Log.warn("Failed to send batch:",t),{success:!1,statusCode:-1}}})}Lt(e){return i(this,void 0,void 0,function*(){var t=yield this.ft.post(this.zt(e)),t=null!=(t=null==t?void 0:t.code)?t:-1;return{success:200<=t&&t<300,statusCode:t}})}Pt(t){t=this.ft.beacon(this.zt(t));return{success:t,statusCode:t?200:-1}}zt(t){return{sdkKey:this.j,data:{events:t.events},urlConfig:this.wt,retries:3,isCompressable:!0,params:{[s.NetworkParam.EventCount]:String(t.events.length)},headers:{"statsig-event-count":String(t.events.length),"statsig-retry-count":String(t.attempts)},credentials:"same-origin"}}}},4312:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.FlushCoordinator=void 0;const s=n(4309),c=n(6351),h=n(8153),r=n(323),l=n(1406),u=n(7512),o=n(7023),a=n(4534);e.FlushCoordinator=class{constructor(t,e,n,i,s,r,l,u,o,a){this.Ki=null,this.Gi=null,this.yt=!1,this.Vi=null,this.Ot=Date.now(),this.Ri=null,this.Ji=new h.FlushInterval,this.Pi=t,this.Ui=e,this.Wi=n,this.te=a,this.j=i,this.Qi=new c.EventSender(i,s,r,l,u,o)}setLoggingEnabled(t){this.Qi.setLoggingEnabled(t)}setLogEventCompressionMode(t){this.Qi.setLogEventCompressionMode(t)}startScheduledFlushCycle(){this.Xi()}stopScheduledFlushCycle(){this.Hi()}addEvent(t){this.Ui.addToPendingEventsQueue(t),this.Ui.hasEventsForFullBatch()&&this.processLimitFlush()}processManualFlush(){return i(this,void 0,void 0,function*(){return this.Vi&&(yield this.Vi),this.Vi=this.Yi(r.FlushType.Manual).finally(()=>{this.Vi=null,this.Xi()}),this.Vi})}processShutdown(){return i(this,void 0,void 0,function*(){return this.Vi&&(yield this.Vi),this.Vi=this.Yi(r.FlushType.Shutdown).catch(t=>{u.Log.error("Error during shutdown flush: "+t)}).finally(()=>{this.Vi=null}),this.Vi})}Yi(e){return i(this,void 0,void 0,function*(){this.Hi();try{this.Zi(e);var t=this.Pi.takeAllBatches();0!==t.length&&(yield Promise.all(t.map(t=>this.Mn(t,e))))}finally{this.Xi()}})}checkQuickFlush(){this.yt||Date.now()-this.Ot>s.EventRetryConstants.QUICK_FLUSH_WINDOW_MS||(this.yt=!0,setTimeout(()=>{this.processManualFlush().catch(t=>{u.Log.warn("Quick flush failed:",t)})},s.EventRetryConstants.QUICK_FLUSH_WINDOW_MS))}Tn(){if(this.Vi)this.Xi();else{var e=this.containsAtLeastOneFullBatch(),t=this.Ji.hasReachedMaxInterval();if(e||t){this.Ji.markFlushAttempt();let t;t=e?r.FlushType.ScheduledFullBatch:r.FlushType.ScheduledMaxTime,this.Vi=this.In(t).then(()=>{}).catch(t=>{u.Log.error("Error during scheduled flush:",t)}).finally(()=>{this.Vi=null,this.Xi()})}else this.Xi()}}processLimitFlush(){!this.Ji.hasCompletelyRecoveredFromBackoff()||this.Vi||(this.Vi=this.Cn().catch(t=>{u.Log.error("Error during limit flush",t)}).finally(()=>{this.Vi=null,this.Xi()}))}Cn(){return i(this,void 0,void 0,function*(){const t=yield this.In(r.FlushType.Limit);if(t)for(;this.Ji.hasCompletelyRecoveredFromBackoff()&&this.containsAtLeastOneFullBatch();){const t=yield this.In(r.FlushType.Limit);if(!t)break}})}Xi(){this.Hi();var t=Math.max(0,this.Ji.getTimeUntilNextFlush()),t=(this.Ki=setTimeout(()=>{this.Ki=null,this.Tn()},t),Math.max(0,this.Ji.getTimeTillMaxInterval()));this.Gi=setTimeout(()=>{this.Gi=null,this.Tn()},t)}Hi(){null!==this.Ki&&(clearTimeout(this.Ki),this.Ki=null),null!==this.Gi&&(clearTimeout(this.Gi),this.Gi=null)}In(e){return i(this,void 0,void 0,function*(){this.Zi(e);var t=this.Pi.takeNextBatch();return!!t&&this.Mn(t,e)})}Mn(e,n){return i(this,void 0,void 0,function*(){var t=yield this.Qi.sendBatch(e);return t.success?(this.Ji.adjustForSuccess(),!0):(this.Ji.adjustForFailure(),this.Fn(e,n,t.statusCode),!1)})}Zi(t){this.Wi();var e=this.convertPendingEventsToBatches();0<e&&(u.Log.warn(`Dropped ${e} events`),this.te.logDroppedEvents(e,"Batch queue limit reached",{loggingInterval:this.Ji.getCurrentIntervalMs(),batchSize:this.Pi.batchSize(),maxPendingBatches:s.EventRetryConstants.MAX_PENDING_BATCHES,flushType:t}))}containsAtLeastOneFullBatch(){return this.Ui.hasEventsForFullBatch()||this.Pi.hasFullBatch()}convertPendingEventsToBatches(){var t;return this.Ui.isEmpty()?0:(t=this.Ui.takeAll(),this.Pi.createBatches(t))}Fn(t,e,n){var i;e===r.FlushType.Shutdown?(u.Log.warn(e+" flush failed during shutdown. "+t.events.length+" event(s) will be saved to storage for retry in next session."),this.An(t.events),this.te.logEventRequestFailure(t.events.length,"flush failed during shutdown - saved to storage",e,n)):o.RETRYABLE_CODES.has(n)?t.attempts>=s.EventRetryConstants.MAX_RETRY_ATTEMPTS?(u.Log.warn(`${e} flush failed after ${t.attempts} attempt(s). `+t.events.length+" event(s) will be dropped."),this.te.logEventRequestFailure(t.events.length,"max retry attempts exceeded",e,n)):(t.incrementAttempts(),0<(i=this.Pi.requeueBatch(t))&&(u.Log.warn(`Failed to requeue batch : dropped ${i} events due to full queue`),this.te.logDroppedEvents(i,"Batch queue limit reached",{loggingInterval:this.Ji.getCurrentIntervalMs(),batchSize:this.Pi.batchSize(),maxPendingBatches:s.EventRetryConstants.MAX_PENDING_BATCHES,flushType:e}))):(u.Log.warn(`${e} flush failed after ${t.attempts} attempt(s). `+t.events.length+" event(s) will be dropped. Non-retryable error: "+n),this.te.logEventRequestFailure(t.events.length,"non-retryable error",e,n))}loadAndRetryShutdownFailedEvents(){return i(this,void 0,void 0,function*(){var t=this.o();try{var e=this.Nn(t);0!==e.length&&(u.Log.debug(`Loading ${e.length} failed shutdown event(s) from storage for retry`),a.Storage.removeItem(t),e.forEach(t=>{this.addEvent(t)}),yield this.processManualFlush())}catch(t){u.Log.warn("Failed to load and retry failed shutdown events:",t)}})}o(){return this.Ri||(this.Ri="statsig.failed_shutdown_events."+(0,l.h)(this.j)),this.Ri}An(e){var n=this.o();try{let t=[...this.Nn(n),...e];t.length>s.EventRetryConstants.MAX_LOCAL_STORAGE&&(t=t.slice(-s.EventRetryConstants.MAX_LOCAL_STORAGE)),(0,a.B)(n,t),u.Log.debug(`Saved ${e.length} failed shutdown event(s) to storage (total stored: ${t.length})`)}catch(t){u.Log.warn("Unable to save failed shutdown events to storage:",t)}}Nn(t){try{var e=(0,a.K)(t);return Array.isArray(e)?e:[]}catch(t){return[]}}}},8153:(t,e)=>{$Q(e),e.FlushInterval=void 0;e.FlushInterval=class{constructor(){this.Rn=1e3,this.Un=Date.now()}getCurrentIntervalMs(){return this.Rn}markFlushAttempt(){this.Un=Date.now()}getTimeSinceLastAttempt(){return Date.now()-this.Un}hasReachedMaxInterval(){return 6e4<=this.getTimeSinceLastAttempt()}getTimeTillMaxInterval(){return 6e4-this.getTimeSinceLastAttempt()}hasCompletelyRecoveredFromBackoff(){return this.Rn<=1e3}adjustForSuccess(){var t=this.Rn;1e3!==t&&(this.Rn=Math.max(1e3,Math.floor(t/2)))}adjustForFailure(){var t=this.Rn;this.Rn=Math.min(6e4,2*t)}getTimeUntilNextFlush(){return this.getCurrentIntervalMs()-this.getTimeSinceLastAttempt()}}},323:(t,e)=>{$Q(e),e.FlushType=void 0,e.FlushType={ScheduledMaxTime:"scheduled:max_time",ScheduledFullBatch:"scheduled:full_batch",Limit:"limit",Manual:"manual",Shutdown:"shutdown"}},1406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.Bt=r.$t=r.h=void 0;const l=e(6634);r.h=e=>{let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)},r.$t=(t,e)=>(0,r.h)(JSON.stringify((0,r.Bt)(t,e)));r.Bt=(n,i)=>{if(null==n)return null;var t=Object.keys(n).sort();const s={};return t.forEach(t=>{var e=n[t];0===i||"object"!==(0,l.Vt)(e)?s[t]=e:s[t]=(0,r.Bt)(e,null!=i?i-1:i)}),s}},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={Gt:"g",Jt:"c",Wt:"e",Yt:"cl",Xt:"l",Ht:"p"};const r=new Set([]),l=new Set(["userPersistedValues"]);e.createMemoKey=function(t,e,n){let i=t+"|"+e;if(n)for(const s of Object.keys(n)){if(l.has(s))return;r.has(s)?i+=`|${s}=true`:i+=`|${s}=`+n[s]}return i}},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=e.Endpoint=void 0,e.Endpoint={Qt:"initialize",kt:"rgstr",Zt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.kt]:"https://prodregistryv2.org/v1",[e.Endpoint.Qt]:"https://featureassets.org/v1",[e.Endpoint.Zt]:"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,y,e){var m=this&&this.__awaiter||$A();$Q2(y,"__esModule",{value:!0}),y.NetworkCore=y.RETRYABLE_CODES=void 0,e(1845);const v=e(1845),O=e(8962),j=e(7512),S=e(7410),n=e(308),f=e(3091),l=e(5902),s=e(6830),u=e(4143),o=e(9122),w=e(2636),a=e(8e3),_=e(586),E=e(2397),x=500,k=3e4;y.RETRYABLE_CODES=new Set([408,500,502,503,504,522,524,599]);y.NetworkCore=class{constructor(t,e){this.st=e,this.te=null,this.ee=1e4,this.ie={},this.O={},this.ne={},this.se=null,t&&(this.O=t),this.O.networkConfig&&(this.ie=this.O.networkConfig),this.ie.networkTimeoutMs&&(this.ee=this.ie.networkTimeoutMs),this.re=new n.NetworkFallbackResolver(this.O),this.setLogEventCompressionMode(this.le(t))}setLogEventCompressionMode(t){this.O.logEventCompressionMode=t}setErrorBoundary(t){this.te=t,this.te.wrap(this),this.te.wrap(this.re),this.re.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){var t=this.se;return this.se=null,t}beacon(t){var e,n;return!!M(t)&&(t=this.oe("POST",t),e=this.ue(t),(n=navigator).sendBeacon.bind(n)(e,t.body))}post(e){return m(this,void 0,void 0,function*(){var t=this.oe("POST",e);return this.ae(t),yield this.ce(t),this.he(t)})}get(t){t=this.oe("GET",t);return this.he(t)}he(b){return m(this,void 0,void 0,function*(){var e;if(!M(b))return null;if(this.ie.preventAllNetworkTraffic)return null;var{method:i,body:s,retries:n,attempt:r}=b,l=b.urlConfig.endpoint;if(this.de(l))return j.Log.warn(`Request to ${l} was blocked because you are making requests too frequently.`),null;r=null!=r?r:1;let u=!1;var o=this.ue(b);let a=null;var c,h=(0,E.Ft)();try{var t,d,v,f={method:i,body:s,headers:$P({},b.headers),priority:b.priority,keepalive:h},_=(c=r,(p=b).urlConfig.endpoint===S.Endpoint.Qt&&O.Diagnostics.W(p.sdkKey,{attempt:c}),this.ne[l]),g=(_&&(_.lastRequestTime=Date.now(),this.ne[l]=_),null!=(e=this.ie.networkOverrideFunc)?e:fetch);let n;if((a=yield Promise.race([g(o,f).finally(()=>clearTimeout(n)),new Promise((t,e)=>{n=setTimeout(()=>{u=!0,e(new Error(`Timeout of ${this.ee}ms expired.`))},this.ee)})])).ok)return v=yield a.text(),D(b,a,r,v),this.re.tryBumpExpiryTime(b.sdkKey,b.urlConfig),{body:v,code:a.status};throw t=yield a.text().catch(()=>"No Text"),(d=new Error(`NetworkError: ${o} `+t)).name="NetworkError",d}catch(t){var s=function(t){if("string"==typeof t)return t;if(t instanceof Error)return t.name+": "+t.message;return"Unknown Error"}(t),h=function(t,e){t=t.includes("Timeout");return t||e}(null!=s?s:"",u),p=(D(b,a,r,"",t),yield this.re.tryFetchUpdatedFallbackInfo(b.sdkKey,b.urlConfig,s,h));return(p&&(b.fallbackUrl=this.re.getActiveFallbackUrl(b.sdkKey,b.urlConfig)),!n||n<r||!y.RETRYABLE_CODES.has(null!=(c=null===a||void 0===a?void 0:a.status)?c:500))?(null!=(l=this.st)&&l.call(this,{name:"error",error:t,tag:w.ErrorTag.NetworkError,requestArgs:b}),_=`A networking error occurred during ${i} request to ${o}.`,j.Log.error(_,s,t),null!=(e=this.te)&&e.attachErrorIfNoneExists(_),null):(yield function(e){return m(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(x*(e*e),k)))})}(r),this.he($P($P({},b),{retries:n,attempt:r+1})))}})}le(t){let e=null==t?void 0:t.logEventCompressionMode;return e=(e=e||!0!==(null==t?void 0:t.disableCompression)?e:_.LogEventCompressionMode.Disabled)||_.LogEventCompressionMode.Enabled}de(t){var e=Date.now(),n=null!=(n=this.ne[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.ne[t]=n,!1)}ue(t){var e=null!=(e=t.fallbackUrl)?e:t.urlConfig.getUrl();t.urlConfig.endpoint!==S.Endpoint.Qt&&t.urlConfig.endpoint!==S.Endpoint.Zt||(this.se=e);const n=$P({[S.NetworkParam.SdkKey]:t.sdkKey,[S.NetworkParam.SdkType]:l.SDKType.ct(t.sdkKey),[S.NetworkParam.SdkVersion]:a.SDK_VERSION,[S.NetworkParam.Time]:String(Date.now()),[S.NetworkParam.SessionID]:u.SessionID.get(t.sdkKey)},t.params);t=Object.keys(n).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(n[t])).join("&");return e+(t?"?"+t:"")}ae(e){var t,n=(0,s.ve)(),i=e.body;if(e.isStatsigEncodable&&!this.O.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:{}),{[S.NetworkParam.StatsigEncoded]:"1"})}catch(t){j.Log.warn("Request encoding failed for "+e.urlConfig.getUrl(),t)}}ce(d){return m(this,void 0,void 0,function*(){var e,n=d.body;if("string"==typeof n&&function(t,e){if(!t.isCompressable)return;if(null!=(0,v.i)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder)return;var n=null!=t.urlConfig.customUrl||null!=t.urlConfig.fallbackUrls,i=!0===f.SDKFlags.get(t.sdkKey,"enable_log_event_compression");switch(e.logEventCompressionMode){case _.LogEventCompressionMode.Disabled:return;case _.LogEventCompressionMode.Enabled:return n&&!i?void 0:1;case _.LogEventCompressionMode.Forced:return 1;default:return}}(d,this.O))try{for(var i,s=(new TextEncoder).encode(n),r=new CompressionStream("gzip"),l=r.writable.getWriter(),u=(l.write(s).catch(j.Log.error),l.close().catch(j.Log.error),r.readable.getReader()),o=[];!(i=yield u.read()).done;)o.push(i.value);var a=o.reduce((t,e)=>t+e.length,0),c=new Uint8Array(a);let t=0;for(const h of o)c.set(h,t),t+=h.length;d.body=c,d.params=$P($P({},null!=(e=d.params)?e:{}),{[S.NetworkParam.IsGzipped]:"1"})}catch(t){j.Log.warn("Request compression failed for "+d.urlConfig.getUrl(),t)}})}oe(t,e){var n=this.re.getActiveFallbackUrl(e.sdkKey,e.urlConfig),t=$P($P({},e),{method:t,fallbackUrl:n});return"data"in e&&i(t,e.data),t}};const M=t=>!!t.sdkKey||(j.Log.warn("Unable to make request without an SDK key"),!1),i=(t,e)=>{var{sdkKey:n,fallbackUrl:i}=t,s=o.StableID.get(n),r=u.SessionID.get(n),n=l.SDKType.ct(n);t.body=JSON.stringify($P($P({},e),{statsigMetadata:$P($P({},a.StatsigMetadataProvider.get()),{stableID:s,sessionID:r,sdkType:n,fallbackUrl:i})}))};function D(t,e,n,i,s){t.urlConfig.endpoint===S.Endpoint.Qt&&O.Diagnostics.Y(t.sdkKey,O.Diagnostics.et(e,n,i,s))}},308:function(t,e,n){var u=this&&this.__awaiter||$A();$Q(e),e.fe=e.NetworkFallbackResolver=void 0;const l=n(8809),i=n(1406),r=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)}e.NetworkFallbackResolver=class{constructor(t){this.ge=null,this.te=null,this._e={},this.pe=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.te=t}tryBumpExpiryTime(t,e){var n=null==(n=this.ge)?void 0:n[e.endpoint];n&&(n.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ge),{[e.endpoint]:n})))}getActiveFallbackUrl(t,e){var n;if(null!=e.customUrl&&null!=e.fallbackUrls)return null;let i=this.ge;null==i&&(i=null!=(s=function(t){t=c(t),t=o.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return r.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.ge=i);var s=i[e.endpoint];return!s||Date.now()>(null!=(n=s.expiryTime)?n:0)||e.getChecksum()!==s.urlConfigChecksum?(delete i[e.endpoint],this.ge=i,h(t,this.ge),null):s.url||null}tryFetchUpdatedFallbackInfo(i,s,r,l){return u(this,void 0,void 0,function*(){var e,t,n;try{return a(r,l)?(t=null==s.customUrl&&null==s.fallbackUrls?yield this.be(s):s.fallbackUrls,!!(n=this.ye(null==(e=this.ge)?void 0:e[s.endpoint],t))&&(this.me(i,s,n),!0)):!1}catch(t){return null!=(e=this.te)&&e.logError("tryFetchUpdatedFallbackInfo",t),!1}})}me(t,e,n){var n={urlConfigChecksum:e.getChecksum(),url:n,expiryTime:Date.now()+6048e5,previous:[]},e=e.endpoint,i=null==(i=this.ge)?void 0:i[e],i=(i&&n.previous.push(...i.previous),10<n.previous.length&&(n.previous=[]),null==(i=null==(i=this.ge)?void 0:i[e])?void 0:i.url);null!=i&&n.previous.push(i),this.ge=$P($P({},this.ge),{[e]:n}),h(t,this.ge)}be(r){return u(this,void 0,void 0,function*(){var t=this._e[r.endpoint];if(t&&Date.now()<t)return null;this._e[r.endpoint]=Date.now()+144e5;var e=[],t=yield(0,l.nt)(null!=(t=this.pe)?t:fetch),n=function(t){try{return new URL(t).pathname}catch(t){return null}}(r.defaultUrl);for(const s of t)if(s.startsWith(r.endpointDnsKey+"=")){var i=s.split("=");if(1<i.length){let t=i[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+n)}}return e})}ye(t,e){var n;if(null==e)return null;var i=new Set(null!=(n=null==t?void 0:t.previous)?n:[]),s=null==t?void 0:t.url;let r=null;for(const u of e){var l=u.endsWith("/")?u.slice(0,-1):u;if(!i.has(u)&&l!==s){r=l;break}}return r}},e.fe=a},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},1228:(t,e,n)=>{$Q(e),e.PendingEvents=void 0;const i=n(7512);e.PendingEvents=class{constructor(t){this.Ui=[],this.Fi=t}addToPendingEventsQueue(t){this.Ui.push(t),i.Log.debug("Enqueued Event:",t)}hasEventsForFullBatch(){return this.Ui.length>=this.Fi}takeAll(){var t=this.Ui;return this.Ui=[],t}isEmpty(){return 0===this.Ui.length}}},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={ct:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},Oe(t,e){n[t]=e},je(t){i&&"-react"!==i||(i="-"+t)}}},6830:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.Se=i.Kt=i.we=i.ke=i.Mt=i.Ee=i.ve=void 0;i.ve=()=>"undefined"!=typeof window?window:null,i.Ee=()=>{var t=(0,i.ve)();return null!=(t=null==t?void 0:t.document)?t:null},i.Mt=()=>{var t;return null===(0,i.Ee)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},i.ke=(t,e)=>{var n=(0,i.ve)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.we=(t,e)=>{var n=(0,i.Ee)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.Kt=()=>{var t;try{return null==(t=(0,i.ve)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}};i.Se=()=>{var t=(0,i.ve)();return t&&"onpagehide"in t?"pagehide":"beforeunload"}},4143:(t,e,n)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(1845),s=n(2137),u=n(7512),o=n(4534),a=n(8023),c=18e5,h=144e5,d={};function v(e,t){return setTimeout(()=>{var t=null==(t=(0,i.l)())?void 0:t.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,s.o)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==d[t]&&(d[t]=function(t){let e=function(t){t=f(t);return(0,o.K)(t)}(t);var n=Date.now();e=e||{sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n};return{data:e,sdkKey:t}}(t));var t=d[t],e=Date.now(),n=t.data,i=t.sdkKey,s=((function({lastUpdate:t}){return Date.now()-t>c}(n)||function({startTime:t}){return Date.now()-t>h}(n))&&(n.sessionID=(0,a.getUUID)(),n.startTime=e,l=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(i))&&l.$emt({name:"session_expired"}),n.lastUpdate=e,n),r=t.sdkKey;r=f(r);try{(0,o.B)(r,s)}catch(t){u.Log.warn("Failed to save SessionID")}clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID);var l=e-n.startTime;return t.idleTimeoutID=v(i,c),t.ageTimeoutID=v(i,h-l),t},overrideInitialSessionID:(t,e)=>{var n;d[e]=(t=t,e=e,n=Date.now(),{data:{sessionID:t,startTime:n,lastUpdate:n},sdkKey:e})}}},2176:(t,u)=>{$Q2(u,"__esModule",{value:!0}),u.De=void 0;u.De=(e,n)=>{let i=0;var s=Object.keys(e);for(let t=0;t<s.length;t++){var r=s[t],l=e[r];if((i=(i+=r.length)+("object"==typeof l&&null!==l?(0,u.De)(l,n)+2:String(l).length+1))>=n)return i}return i}},9122:(t,e,n)=>{$Q(e),e.getCookieName=e.StableID=void 0;const i=n(2137),s=n(7512),r=n(6830),l=n(4534),u=n(8023),o={},a={},c={};function h(t){return"statsig.stable_id."+(0,i.o)(t)}function d(t,e){e=h(e);try{(0,l.B)(e,t)}catch(t){s.Log.warn("Failed to save StableID to storage")}}function v(t,e){var n;a[e]&&null!=(0,r.Ee)()&&((n=new Date).setFullYear(n.getFullYear()+1),document.cookie=`${f(e)}=${encodeURIComponent(t)}; expires=${n.toUTCString()}; path=/`)}function f(t){return"statsig.stable_id."+(0,i.o)(t)}e.StableID={cookiesEnabled:!1,randomID:Math.random().toString(36),get:t=>{if(c[t])return null;if(null!=o[t])return o[t];let e=null;return null!=(e=function(t){if(a[t]&&null!=(0,r.Ee)())for(const i of document.cookie.split(";")){var[e,n]=i.trim().split("=");if(e===f(t))return decodeURIComponent(n)}return null}(t))?d(o[t]=e,t):(d(e=null==(e=function(t){t=h(t);return(0,l.K)(t)}(t))?(0,u.getUUID)():e,t),v(e,t),o[t]=e),e},setOverride:(t,e)=>{d(o[e]=t,e),v(t,e)},Ie:(t,e)=>{a[t]=e},Me:(t,e)=>{c[t]=e}},e.getCookieName=f},1375:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(1845);const l=n(1845),u=n(5542),o=n(7770),a=n(7512),r=n(7787),c=n(6830),h=n(4143),d=n(9122),s=n(586),v=n(4534);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.xe=null,this.Te={};var s,r=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&v.Storage.Me(!0),null!=i&&i.initialSessionID&&h.StatsigSession.overrideInitialSessionID(i.initialSessionID,t),null!=i&&i.storageProvider&&v.Storage.Ne(i.storageProvider),null!=i&&i.enableCookies&&d.StableID.Ie(t,i.enableCookies),null!=i&&i.disableStableID&&d.StableID.Me(t,!0),this.j=t,this.O=null!=i?i:{},this.Ce={},this.overrideAdapter=null!=(s=null==i?void 0:i.overrideAdapter)?s:null,this.te=new u.ErrorBoundary(t,i,r),this.Re=new o.EventLogger(t,r,n,i,this.te),this.te.wrap(this),this.te.wrap(e),this.te.wrap(this.Re),n.setErrorBoundary(this.te),this.dataAdapter=e,this.dataAdapter.attach(t,i,n),this.storageProvider=v.Storage,null!=(e=null==(r=null==(s=this.overrideAdapter)?void 0:s.loadFromStorage)?void 0:r.call(s))&&e.catch(t=>this.te.logError("OA::loadFromStorage",t)),this.Ue(),i=t,n=this,(0,c.Mt)()||(r=(0,l.l)(),s=null!=(s=r.instances)?s:{},n=n,null!=s[i]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),s[i]=n,r.firstInstance||(r.firstInstance=n),r.instances=s,__STATSIG__=r)}updateRuntimeOptions(t){t.loggingEnabled?(this.O.loggingEnabled=t.loggingEnabled,this.Re.setLoggingEnabled(t.loggingEnabled)):null!=t.disableLogging&&(this.O.disableLogging=t.disableLogging,this.Re.setLoggingEnabled(t.disableLogging?"disabled":"browser-only")),null!=t.disableStorage&&(this.O.disableStorage=t.disableStorage,v.Storage.Me(t.disableStorage)),null!=t.enableCookies&&(this.O.enableCookies=t.enableCookies,d.StableID.Ie(this.j,t.enableCookies)),t.logEventCompressionMode?this.Re.setLogEventCompressionMode(t.logEventCompressionMode):t.disableCompression&&this.Re.setLogEventCompressionMode(s.LogEventCompressionMode.Disabled)}flush(){return this.Re.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.Ae("Uninitialized",null),this.xe=null,yield this.Re.stop()})}on(t,e){this.Te[t]||(this.Te[t]=[]),this.Te[t].push(e)}off(t,e){this.Te[t]&&-1!==(e=this.Te[t].indexOf(e))&&this.Te[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.te.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Te[n.name]&&this.Te[n.name].forEach(t=>e(t)),null!=(t=this.Te["*"])&&t.forEach(e)}Ae(t,e){this.loadingStatus=t,this.Ce={},this.$emt({name:"values_updated",status:t,values:e})}Fe(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Re.incrementNonExposureCount(t):this.Re.enqueue(e)}Pe(i,s){return(t,e)=>{var n;return!this.O.disableEvaluationMemoization&&(n=(0,r.createMemoKey)(i,t,e))?(n in this.Ce||(3e3<=Object.keys(this.Ce).length&&(this.Ce={}),this.Ce[n]=s(t,e)),this.Ce[n]):s(t,e)}}}},2636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Le=e.ze=e.qe=e.Ke=e.Ut=void 0;const r="statsig::config_exposure",l="statsig::gate_exposure",a="statsig::layer_exposure",c=(t,e,n,i,s)=>(n.bootstrapMetadata&&(i.bootstrapMetadata=n.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:u(n,i),secondaryExposures:s,time:Date.now()});e.Ut=({eventName:t})=>t===l||t===r||t===a;function h(t,e){return t.map(t=>"string"==typeof t?(null!=e?e:{})[t]:t).filter(t=>null!=t)}e.Ke=(t,e,n)=>{var i,s={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(s.configVersion=e.__evaluation.version),c(l,t,e.details,s,h(null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[],n))},e.qe=h;e.ze=(t,e,n)=>{var i,s={config:e.name,ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(s.configVersion=e.__evaluation.version),null!=(null==(i=e.__evaluation)?void 0:i.passed)&&(s.rulePassed=String(e.__evaluation.passed)),c(r,t,e.details,s,h(null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[],n))};e.Le=(t,e,n,i)=>{var s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(n));let l="",u=null!=(o=null==s?void 0:s.undelegated_secondary_exposures)?o:[];r&&(l=null!=(o=s.allocated_experiment_name)?o:"",u=null!=(o=s.secondary_exposures)?o:[]);var o=null==(s=e.__evaluation)?void 0:s.parameter_rule_ids,o={config:e.name,parameterName:n,ruleID:null!=(s=null==o?void 0:o[n])?s:e.ruleID,allocatedExperiment:l,isExplicitParameter:String(r)};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(o.configVersion=e.__evaluation.version),c(a,t,e.details,o,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.30.2-beta.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),e.LoggingEnabledOption=e.LogEventCompressionMode=void 0,e.LogEventCompressionMode={Disabled:"d",Enabled:"e",Forced:"f"},e.LoggingEnabledOption={disabled:"disabled",browserOnly:"browser-only",always:"always"}},1098:(t,e)=>{$Q(e)},2059:(t,e,n)=>{$Q(e),e.Be=e.$e=e.Ve=e.Ge=e.Je=e.We=void 0;const l=n(7512),u=n(6634);function s(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:"",__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)),{idType:null!=(e=null==n?void 0:n.id_type)?e:null,get:r(t,null==n?void 0:n.value)})}function r(i,s,r){return(t,e)=>{var n=null!=(n=null==s?void 0:s[t])?n:null;return null==n?null!=e?e:null:null==e||(0,u.Ye)(n,e)?(null!=r&&r(t),n):(l.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.We=function(t,e,n){return $P($P({},s(t,e,n,!0===(null==n?void 0:n.value))),{idType:null!=(t=null==n?void 0:n.id_type)?t:null})},e.Je=i,e.Ge=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.Ve=function(t,e,n,i){return $P($P({},s(t,e,n,void 0)),{get:r(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.$e=function(t,e,n,i){return $P($P($P({},t),e),{get:r(t.name,n,i)})},e.Be=r},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,s,r)=>({duration:n,source:e,success:t,error:i,sourceUrl:s,warnings:r}),e.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}},8578:(t,e,n)=>{$Q(e),e._=e.D=void 0;const i=n(1406),s=n(7512);e.D=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 s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e._=function(t){return t?(0,i.$t)(t):null}},4534:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.B=n.K=n.Storage=void 0;const i=e(7512);e=e(6830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let l=null;try{const c=(0,e.ve)();c&&c.localStorage&&"function"==typeof c.localStorage.getItem&&(l={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>c.localStorage.getItem(t),setItem:(t,e)=>c.localStorage.setItem(t,e),removeItem:t=>c.localStorage.removeItem(t),getAllKeys:()=>Object.keys(c.localStorage)})}catch(t){i.Log.warn("Failed to setup localStorageProvider.")}let u=null!==l&&void 0!==l?l:r,o=u;function a(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.Ne(r),null;throw t}}n.Storage={isReady:()=>o.isReady(),isReadyResolver:()=>o.isReadyResolver(),getProviderName:()=>o.getProviderName(),getItem:t=>a(()=>o.getItem(t)),setItem:(t,e)=>a(()=>o.setItem(t,e)),removeItem:t=>o.removeItem(t),getAllKeys:()=>o.getAllKeys(),Ne:t=>{u=t,o=t},Me:t=>{o=t?r:u}},n.K=function(e){var t=n.Storage.getItem(e);try{return JSON.parse(null!=t?t:"null")}catch(t){return i.Log.error(`Failed to parse value for key "${e}"`),null}},n.B=function(t,e){n.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,n)=>{$Q(e),e.P=void 0;const s=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 s.Log.error("Failed to parse "+n),null}},6634:(t,e)=>{$Q(e),e.Ye=e.Vt=void 0,e.Vt=function(t){return Array.isArray(t)?"array":typeof t},e.Ye=function(t,e){var n=t=>Array.isArray(t)?"array":null===t?"null":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 i=n(1406),s=n(7410),r={[s.Endpoint.Qt]:"i",[s.Endpoint.kt]:"e",[s.Endpoint.Zt]:"d"};e.UrlConfiguration=class{constructor(t,e,n,i){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=r[t],e&&(this.customUrl=e),!e&&n&&(this.customUrl=n.endsWith("/")?""+n+t:n+"/"+t),i&&(this.fallbackUrls=i);e=s.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}getChecksum(){var t=(null!=(t=this.fallbackUrls)?t:[]).sort().join(",");return(0,i.h)(this.customUrl+t)}}},2397:(t,e,n)=>{$Q(e),e.Xe=e.xt=e.Ft=e.He=void 0;n=n(6830);const i="foreground",s="background",r=[];let l=i,u=!1;e.He=()=>l===i,e.Ft=()=>u,e.xt=t=>{r.unshift(t)};e.Xe=e=>{e!==l&&(l=e,r.forEach(t=>t(e)))},(0,n.ke)("focus",()=>{(u=!1,e.Xe)(i)}),(0,n.ke)("blur",()=>(0,e.Xe)(s)),(0,n.we)("visibilitychange",()=>{(0,e.Xe)("visible"===document.visibilityState?i:s)}),(0,n.ke)((0,n.Se)(),()=>{u=!0,(0,e.Xe)(s)})},6914:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)},r=($Q(e),e.Storage=e.Log=e.EventLogger=e.Diagnostics=void 0,n(1845),n(1845));const l=n(8962),u=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return l.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 a=n(8e3);const c=n(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return c.Storage}}),s(n(1845),e),s(n(2137),e),s(n(6427),e),s(n(694),e),s(n(8962),e),s(n(3539),e),s(n(5542),e),s(n(2922),e),s(n(2417),e),s(n(1406),e),s(n(1333),e),s(n(7512),e),s(n(7787),e),s(n(7410),e),s(n(7023),e),s(n(1405),e),s(n(1361),e),s(n(6830),e),s(n(5902),e),s(n(4143),e),s(n(2176),e),s(n(9122),e),s(n(1375),e),s(n(2636),e),s(n(3206),e),s(n(1637),e),s(n(8e3),e),s(n(586),e),s(n(1098),e),s(n(2059),e),s(n(1812),e),s(n(8578),e),s(n(4534),e),s(n(3401),e),s(n(6634),e),s(n(1881),e),s(n(8023),e),s(n(2397),e),s(n(3932),e),s(n(3091),e),$P((0,r.l)(),{Log:o.Log,SDK_VERSION:a.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 s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},r=($Q(e),r(n(600)));s(n(600),e),e.default=r.default},1241:(t,e,n)=>{$Q(e),e.GCIRFormatter=void 0;const h=n(6914),d=n(3260);e.GCIRFormatter=class{constructor(t,e,n){this.en=t,this.Oi=e,this.O=n}getClientInitializeResponse(t,e){var t=(0,h.D)(t,this.O,this.Oi.getDefaultEnvironment()),n=null!=(n=null==e?void 0:e.hash)?n:"djb2";let i=null,s=null;var r=null==e?void 0:e.clientSDKKey,l=null!=(l=null==(l=this.Oi.getValues())?void 0:l.sdk_keys_to_app_ids)?l:{},u=null!=(u=null==(u=this.Oi.getValues())?void 0:u.hashed_sdk_keys_to_app_ids)?u:{},o=null!=(o=null==(o=this.Oi.getValues())?void 0:o.hashed_sdk_keys_to_entities)?o:{},a=(r&&(a=(0,d.hashString)(r,"djb2"),i=null!=(u=u[a])?u:null,s=null!=(u=o[a])?u:null,null==i)&&(i=null!=(o=l[r])?o:null),this.bn(t,e,i,s,n)),u=this.yn(t,e,i,s,n),l=this.mn(t,e,i,n),r={};t.userID&&(r.userID=t.userID),t.customIDs&&0<Object.keys(t.customIDs).length&&(r.customIDs=t.customIDs);let c=void 0;t.privateAttributes&&0<Object.keys(t.privateAttributes).length&&(c=(0,d.hashPrivateAttributes)(t.privateAttributes));o=$P({},t),delete o.privateAttributes,this.jn(o),e=this.On(i,n),t={feature_gates:a,dynamic_configs:u,layer_configs:l,param_stores:e,sdkParams:{},has_updates:!0,generator:"js-on-device-eval-client",sdkInfo:{sdkType:"js-on-device-eval-client",sdkVersion:"1.0.0"},time:this.Oi.getLastUpdateTime(),evaluated_keys:r,hash_used:n,user:o};return e&&0<Object.keys(e).length&&(t.param_stores=e),void 0!==c&&(t.pa_hash=c),t}bn(t,e,n,i,s){var r,l,u={};for(const o of this.Oi.getAllSpecs("gate"))"segment"===o.entity||"holdout"===o.entity||null!=i&&!i.gates.includes(o.name)||null!=n&&!(null!=(r=o.targetAppIDs)?r:[]).includes(n)||(r=this.wn(o,t),u[(l=this.Sn(o.name,r,o,null!=s?s:"djb2")).name]=l);return u}yn(t,e,n,i,s){var r={};for(const c of this.Oi.getAllSpecs("config"))if((null==i||i.configs.includes(c.name))&&(null==n||(null!=(o=c.targetAppIDs)?o:[]).includes(n))){var l,u,o=this.wn(c,t),a=this.Sn(c.name,o,c,null!=s?s:"djb2");if("dynamic_config"===c.entity&&(a.passed=o.bool_value),"dynamic_config"!==c.entity&&"autotune"!==c.entity&&(a.is_user_in_experiment=o.is_experiment_group,a.is_experiment_active=!0===c.isActive,c.hasSharedParams)){a.is_in_layer=!0,a.explicit_parameters=c.explicitParameters||[];const h=this.kn(c.name);h&&(l=this.Oi.getAllSpecs("layer").find(t=>t.name===h))&&(l=l.defaultValue||{},u=a.value||{},a.value=$P($P({},l),u))}r[a.name]=a}return r}mn(t,e,n,i){var s={};for(const o of this.Oi.getAllSpecs("layer"))if(null==n||(null!=(u=o.targetAppIDs)?u:[]).includes(n)){const a=this.wn(o,t);var r,l,u=this.Sn(o.name,a,o,null!=i?i:"djb2");u.explicit_parameters=null!=(r=o.explicitParameters)?r:[],a.allocated_experiment_name?(r=this.Oi.getAllSpecs("config").find(t=>t.name===a.allocated_experiment_name))&&((l=this.wn(r,t)).group_name&&(u.group_name=l.group_name),u.allocated_experiment_name=(0,d.hashString)(a.allocated_experiment_name,null!=i?i:"djb2"),u.is_experiment_active=!0===r.isActive,u.is_user_in_experiment=l.is_experiment_group,u.explicit_parameters=r.explicitParameters||[],l.undelegated_secondary_exposures)&&(u.undelegated_secondary_exposures=this.xn(l.undelegated_secondary_exposures,null!=i?i:"djb2")):u.undelegated_secondary_exposures=this.xn(a.undelegated_secondary_exposures||[],null!=i?i:"djb2"),s[u.name]=u}return s}Sn(t,e,n,i){var s="feature_gate"===n.entity?e.bool_value:!e.unsupported&&e.json_value||{},t={name:(0,d.hashString)(t,i),value:s,rule_id:e.rule_id||"default",secondary_exposures:this.xn(e.secondary_exposures||[],i),id_type:null==n?void 0:n.idType};return e.group_name&&(t.group_name=e.group_name),"feature_gate"!==n.entity&&(t.group=e.group_name||"",t.is_device_based=!1,"dynamic_config"!==n.entity&&"autotune"!==n.entity&&"layer"!==n.entity&&(t.is_experiment_active=n.isActive,t.is_user_in_experiment=e.is_experiment_group),t.passed=e.bool_value),t}wn(t,e){return this.en.evaluateSpec(t,e)}On(t,e){var n=null==(n=this.Oi.getValues())?void 0:n.param_stores;if(n){var i,s,r={};for([i,s]of Object.entries(n))if(!t||s.targetAppIDs&&s.targetAppIDs.includes(t)){var l,u,o={};for([l,u]of Object.entries(s.parameters||{})){var a=$P({},u);a.gate_name&&(a.gate_name=(0,d.hashString)(a.gate_name,e)),a.config_name&&(a.config_name=(0,d.hashString)(a.config_name,e)),a.layer_name&&(a.layer_name=(0,d.hashString)(a.layer_name,e)),a.experiment_name&&(a.experiment_name=(0,d.hashString)(a.experiment_name,e)),o[l]=a}r[(0,d.hashString)(i,e)]=o}return 0<Object.keys(r).length?r:void 0}}xn(t,e){return"none"===e?t:t.map(t=>$P($P({},t),{gate:(0,d.hashString)(t.gate,e)}))}jn(t){for(const e in t)void 0===t[e]?delete t[e]:"object"!=typeof t[e]||null===t[e]||Array.isArray(t[e])||this.jn(t[e])}kn(t){var e=this.Oi.getValues();if(null!=e&&e.layers)for(var[n,i]of Object.entries(e.layers))if(i.includes(t))return n;return null}}},3260:(t,e,n)=>{$Q(e),e.hashPrivateAttributes=e.hashString=void 0;const s=n(6914),i=n(5680),r=n(5680);e.hashString=(t,e)=>{return"none"===e?t:"djb2"===e?(0,s.h)(t):"sha256"===e?(e=(0,i.SHA256)(t).arrayBuffer(),r.Base64.encodeArrayBuffer(e)):t};e.hashPrivateAttributes=t=>{let e=0;for(const i in t){var n;Object.prototype.hasOwnProperty.call(t,i)&&(n=t[i],n=i+":"+(null==n?"":String(n)),n=parseInt((0,s.h)(n),10),e=e+n&4294967295)}return e.toString()}},8494:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e);const s=n(6914);class r extends s.NetworkCore{constructor(t=null){super(t);t=null==t?void 0:t.networkConfig;this.tn=new s.UrlConfiguration(s.Endpoint.Zt,null==t?void 0:t.downloadConfigSpecsUrl,null==t?void 0:t.api,null==t?void 0:t.downloadConfigSpecsFallbackUrls)}fetchConfigSpecs(e,n){return i(this,void 0,void 0,function*(){var t=yield this.get({sdkKey:e,urlConfig:this.tn,priority:n});return null!=(t=null==t?void 0:t.body)?t:null})}}e.default=r},6217:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e);const u=n(6914),s=n(3066),r=n(1241),l=n(8494),o=n(2660);class a extends u.StatsigClientBase{static instance(t){var e=(0,u.l)().instance(t);return e instanceof a?e:(u.Log.warn((0,u.Mt)()?"StatsigOnDeviceEvalClient.instance is not supported in server environments":"Unable to find StatsigOnDeviceEvalClient instance"),new a(null!=t?t:""))}constructor(t,e=null){u.SDKType.Oe(t,"js-on-device-eval-client");var n=new l.default(e);super(t,null!=(t=null==e?void 0:e.dataAdapter)?t:new o.StatsigSpecsDataAdapter,n,e),this.ft=n,this.Oi=new s.SpecStore,this.en=new s.Evaluator(this.Oi),this.wi=(0,u.getUUID)(),this.En=new r.GCIRFormatter(this.en,this.Oi,this.O)}initializeSync(t){return"Uninitialized"!==this.loadingStatus?{success:!0,duration:0,source:this.Oi.getSource(),sourceUrl:null,error:null}:(this.Re.start(),this.updateSync(t))}initializeAsync(t){return i(this,void 0,void 0,function*(){return this.xe||(this.xe=this.ki(t)),this.xe})}updateSync(t){var e=performance.now(),n=(this.Oi.reset(),this.dataAdapter.getDataSync());return this.Oi.setValuesFromDataAdapter(n),this.Oi.finalize(),this.Ae("Ready",n),null!=t&&t.disableBackgroundCacheRefresh||this.xi(n),(0,u.createUpdateDetails)(!0,this.Oi.getSource(),performance.now()-e,this.te.getLastSeenErrorAndReset(),this.ft.getLastUsedInitUrlAndReset())}updateAsync(n){return i(this,void 0,void 0,function*(){var t=performance.now(),e=(this.Oi.reset(),this.Ae("Loading",null),this.dataAdapter.getDataSync());return this.Oi.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,n),this.Oi.setValuesFromDataAdapter(e),this.Oi.finalize(),this.Ae("Ready",e),(0,u.createUpdateDetails)(!0,this.Oi.getSource(),performance.now()-t,this.te.getLastSeenErrorAndReset(),this.ft.getLastUsedInitUrlAndReset())})}getContext(){return{sdkKey:this.j,options:this.O,values:this.Oi.getValues(),errorBoundary:this.te,session:u.StatsigSession.get(this.j),stableID:u.StableID.get(this.j),sdkInstanceID:this.wi}}checkGate(t,e,n){return this.getFeatureGate(t,e,n).value}getFeatureGate(t,e,n){var e=this.D(e),{evaluation:i,details:s}=this.en.evaluateGate(t,e),s=(0,u.We)(t,s,i),r=null==(r=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:r.call(i,s,e,n),i=null!=r?r:s;return this.Fe(t,(0,u.Ke)(e,i),n),this.$emt({name:"gate_evaluation",gate:s}),i}getDynamicConfig(t,e,n){var e=this.D(e),{evaluation:i,details:s}=this.en.evaluateConfig(t,e),s=(0,u.Je)(t,s,i),r=null==(r=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:r.call(i,s,e,n),i=null!=r?r:s;return this.Fe(t,(0,u.ze)(e,i),n),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e,n){var e=this.D(e),{evaluation:i,details:s}=this.en.evaluateConfig(t,e),s=(0,u.Ge)(t,s,i),r=null==(r=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:r.call(i,s,e,n),i=null!=r?r:s;return this.Fe(t,(0,u.ze)(e,i),n),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,t,n){const i=this.D(t);var{evaluation:t,details:s}=this.en.evaluateLayer(e,i),s=(0,u.Ve)(e,s,t),r=null==(r=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:r.call(t,s,i,n);const l=null!=r?r:s;return l.get=(0,u.Be)(l.name,l.__value,t=>{this.Fe(e,(0,u.Le)(i,l,t),n)}),this.$emt({name:"layer_evaluation",layer:l}),l}logEvent(t,e,n,i){this.Re.enqueue($P($P({},"string"==typeof t?{eventName:t,value:n,metadata:i}:t),{user:this.D(e),time:Date.now()}))}Ue(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Mi(null)})}ki(t){return i(this,void 0,void 0,function*(){return u.Storage.isReady()||(yield u.Storage.isReadyResolver()),this.Re.start(),this.updateAsync(t)})}Mi(t){this.Oi.finalize(),this.Ae("Ready",t)}D(t){return(0,u.D)(t,this.O,this.Oi.getDefaultEnvironment())}xi(t){this.dataAdapter.getDataAsync(t,{priority:"low"}).catch(t=>{u.Log.error("An error occurred after update.",t)})}getClientInitializeResponse(t,e){return"Ready"!==this.loadingStatus?null:this.En.getClientInitializeResponse(t,e)}}e.default=a},2660:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigSpecsDataAdapter=void 0;const s=n(6914),r=n(8494);class l extends s.DataAdapterCore{constructor(){super("SpecsDataAdapter","specs"),this.ft=null}attach(t,e,n){super.attach(t,e,n),null!==n&&n instanceof r.default?this.ft=n:this.ft=new r.default(null!=e?e:{})}getDataAsync(t,e){return this.C(t,void 0,e)}prefetchData(t){return this.U(void 0,t)}F(t,e,n){return i(this,void 0,void 0,function*(){var t;return null!=(t=yield null==(t=this.ft)?void 0:t.fetchConfigSpecs(this.N(),null==n?void 0:n.priority))?t:null})}I(){var t=(0,s.o)(this.N());return`${s.DataAdapterCachePrefix}.${this.m}.`+t}A(t,e){return 0<t.data.length}}e.StatsigSpecsDataAdapter=l},600:(t,e,n)=>{$Q(e),e.StatsigSpecsDataAdapter=e.StatsigOnDeviceEvalClient=void 0;var i=n(6914),s=n(6217);e.StatsigOnDeviceEvalClient=s.default;const r=n(2660);$Q2(e,"StatsigSpecsDataAdapter",{enumerable:!0,get:function(){return r.StatsigSpecsDataAdapter}});n=$P((0,i.l)(),{StatsigSpecsDataAdapter:r.StatsigSpecsDataAdapter,StatsigOnDeviceEvalClient:s.default});e.default=n},6535:(t,e)=>{function u(t){return t.setUTCHours(0,0,0,0),t.getTime()}function o(t){var e=Number(t);return isNaN(e)?(t=new Date(String(t)),isNaN(t.getTime())?null:t):e<1e10?new Date(1e3*e):new Date(e)}$Q(e),e.default={compareNumbers(t,e,n){if(null==t||null==e)return!1;var i=Number(t),s=Number(e);if(isNaN(i)||isNaN(s))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},s=((t,e)=>{var n=t.split(".").map(t=>parseInt(t)),i=e.split(".").map(t=>parseInt(t));let s=0;for(;s<Math.max(n.length,i.length);){var r=s<n.length?n[s]:0,l=s<i.length?i[s]:0;if(r<l)return-1;if(l<r)return 1;s++}return 0})(i(t),i(e));switch(n){case"version_gt":return 0<s;case"version_gte":return 0<=s;case"version_lt":return s<0;case"version_lte":return s<=0;case"version_eq":return 0===s;case"version_neq":return 0!==s;default:return!1}},compareStringInArray(s,t,r){if(!Array.isArray(t))return!1;const l="any_case_sensitive"!==r&&"none_case_sensitive"!==r;var e=-1!==t.findIndex(t=>{var e=String(s),t=String(t),n=l?e.toLowerCase():e,i=l?t.toLowerCase():t;switch(r){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(r){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(t,e,n){if(null==t||null==e)return!1;try{var i=o(t),s=o(e);if(null===i||null===s)return!1;var r=i.getTime(),l=s.getTime();switch(n){case"before":return r<l;case"after":return l<r;case"on":return u(i)===u(s);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 c(t){return null!=t&&"object"==typeof t}e.Evaluator=class{constructor(t){this.Oi=t}evaluateGate(t,e){var{spec:t,details:n}=this.nn("gate",t);return t?(e=this.evaluateSpec(t,e),t=(0,d.resultToGateEval)(t,e),this.sn(e,n),{evaluation:t,details:n}):{evaluation:null,details:n}}evaluateConfig(t,e){var{spec:t,details:n}=this.nn("config",t);return t?(e=this.evaluateSpec(t,e),t=(0,d.resultToConfigEval)(t,e),this.sn(e,n),{evaluation:t,details:n}):{evaluation:null,details:n}}evaluateLayer(t,e){var n,{spec:t,details:i}=this.nn("layer",t);return t?(n=null!=(n=null==(e=this.evaluateSpec(t,e))?void 0:e.allocated_experiment_name)?n:"",n=this.Oi.getSpecAndSourceInfo("config",n).spec,t=(0,d.resultToLayerEval)(t,n,e),this.sn(e,i),{evaluation:t,details:i}):{evaluation:null,details:i}}sn(t,e){t.unsupported&&(e.reason="Unsupported")}getParamStoreConfig(t){var t=this.Oi.getParamStoreAndSourceInfo(t),e=this.ln(t);return{config:null!=(t=t.paramStoreConfig)?t:null,details:e}}evaluateSpec(t,e){var n=c(t.defaultValue)?t.defaultValue:void 0;if(!t.enabled)return(0,d.makeEvalResult)({json_value:n,rule_id:"disabled"});var i=[],s={};for(const o of t.rules){var r,l=this.un(o,e);if(l.unsupported)return l;for(const a of l.secondary_exposures){var u=`${a.gate}|${a.gateValue}|`+a.ruleID;s[u]||(s[u]=!0,i.push(a))}if(l.bool_value)return this.an(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:l.rule_id,bool_value:r,json_value:r?l.json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,is_experiment_group:l.is_experiment_group,group_name:l.group_name}))}return(0,d.makeEvalResult)({json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,rule_id:"default"})}nn(t,e){t=this.Oi.getSpecAndSourceInfo(t,e);return{details:this.ln(t),spec:t.spec}}ln(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}}un(t,e){var n=[];let i=!0;for(const r of t.conditions){var s=this.cn(r,e);if(s.unsupported)return s;n.push(...s.secondary_exposures),s.bool_value||(i=!1)}return(0,d.makeEvalResult)({rule_id:t.id,bool_value:i,json_value:c(t.returnValue)?t.returnValue:void 0,secondary_exposures:n,is_experiment_group:!0===t.isExperimentGroup,group_name:t.groupName})}cn(t,e){let n=null,i=!1;var s=t.field,r=t.targetValue,l=t.idType,u=t.type;switch(u){case"public":return(0,d.makeEvalResult)({bool_value:!0});case"pass_gate":case"fail_gate":var o=String(r),o=this.hn(o,e);return(0,d.makeEvalResult)({bool_value:"fail_gate"===u?!o.bool_value:o.bool_value,secondary_exposures:o.secondary_exposures});case"multi_pass_gate":case"multi_fail_gate":return this.dn(r,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,s);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,s);break;case"current_time":n=Date.now();break;case"user_bucket":o=f(String(null!=(o=null==(o=t.additionalValues)?void 0:o.salt)?o:"")+"."+(null!=(o=v(e,l))?o:""));n=Number(o%BigInt(1e3));break;case"unit_id":n=v(e,l);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,r,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,r,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,r,c);break;case"str_matches":i=h.default.compareStringWithRegEx(n,r);break;case"before":case"after":case"on":i=h.default.compareTime(n,r,c);break;case"eq":i=n==r;break;case"neq":i=n!=r;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(r)?i=!!Array.isArray(n)&&(a=h.default.arrayHasValue(n,r),"array_contains_any"===c?a:!a):i=!1;break;case"array_contains_all":case"not_array_contains_all":Array.isArray(r)?i=!!Array.isArray(n)&&(a=h.default.arrayHasAllValues(n,r),"array_contains_all"===c?a:!a):i=!1}return(0,d.makeEvalResult)({bool_value:i})}an(t,e,n){if(!t)return null;var i=this.Oi.getSpecAndSourceInfo("config",t)["spec"];if(!i)return null;var e=this.evaluateSpec(i,e),s={},r=[];for(const u of n.concat(e.secondary_exposures)){var l=`${u.gate}|${u.gateValue}|`+u.ruleID;s[l]||(s[l]=!0,r.push(u))}return(0,d.makeEvalResult)($P($P({},e),{allocated_experiment_name:t,explicit_parameters:i.explicitParameters,secondary_exposures:r,undelegated_secondary_exposures:n}))}hn(t,e){var n=[];let i=!1;var s=this.Oi.getSpecAndSourceInfo("gate",t)["spec"];if(s){s=this.evaluateSpec(s,e);if(s.unsupported)return s;i=s.bool_value,n.push(...s.secondary_exposures),t.startsWith("segment:")||n.push({gate:t,gateValue:String(i),ruleID:s.rule_id})}return(0,d.makeEvalResult)({bool_value:i,secondary_exposures:n})}dn(t,e,n){if(!Array.isArray(t))return(0,d.makeEvalResult)({unsupported:!0});var i="multi_pass_gate"===e,s=[];let r=!1;for(const u of t){if("string"!=typeof u)return(0,d.makeEvalResult)({unsupported:!0});var l=this.hn(u,n);if(l.unsupported)return l;if(s.push(...l.secondary_exposures),i?!0===l.bool_value:!1===l.bool_value){r=!0;break}}return(0,d.makeEvalResult)({bool_value:r,secondary_exposures:s})}}},8313:(t,e,n)=>{$Q(e),e.SpecStore=void 0;const i=n(6914);function s(t){return(0,i.P)(t,"has_updates","DownloadConfigSpecsResponse")}e.SpecStore=class{constructor(){this.Ze=null,this.ti=null,this.ei="Uninitialized",this.ii=0,this.ni=0,this.vn=null}getValues(){return this.Ze?s(this.Ze):null}getSource(){return this.ei}getDefaultEnvironment(){return this.vn}setValuesFromDataAdapter(t){var e,n;!t||!0!==(null==(n=s(t.data))?void 0:n.has_updates)||(null!=(e=n.time)?e:0)<this.ii||(this.ii=n.time,this.ni=t.receivedAt,this.ei=t.source,this.ti=n,this.Ze=t.data,this.vn=null!=(e=n.default_environment)?e:null)}reset(){this.ti=null,this.Ze=null,this.ei="Loading"}finalize(){this.ti||(this.ei="NoValues")}getSpecAndSourceInfo(t,e){var t=this.fn(t);return{spec:null!=(t=null==t?void 0:t.find(t=>t.name===e))?t:null,source:this.ei,lcut:this.ii,receivedAt:this.ni}}getParamStoreAndSourceInfo(t){var e=null==(e=this.ti)?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.ei,lcut:this.ii,receivedAt:this.ni}}fn(t){var e;switch(t){case"gate":return null==(e=this.ti)?void 0:e.feature_gates;case"config":return null==(e=this.ti)?void 0:e.dynamic_configs;case"layer":return null==(e=this.ti)?void 0:e.layer_configs}}getAllSpecs(t){return this.fn(t)||[]}getLastUpdateTime(){return this.ii}}},3066:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),s(n(5007),e),s(n(5079),e),s(n(8313),e)},725:(t,e)=>{$Q(e),e.Base64=void 0;const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.Base64=class{static encodeArrayBuffer(t){let e="";var n=new Uint8Array(t),i=n.byteLength;for(let t=0;t<i;t++)e+=String.fromCharCode(n[t]);return this.Dn(e)}static Dn(t){let e="";var n,i,s,r;let l,u,o=0;for(;o<t.length;)r=t.charCodeAt(o++),n=t.charCodeAt(o++),i=t.charCodeAt(o++),s=r>>2,r=(3&r)<<4|n>>4,l=(15&n)<<2|i>>6,u=63&i,isNaN(n)?l=u=64:isNaN(i)&&(u=64),e=e+a.charAt(s)+a.charAt(r)+a.charAt(l)+a.charAt(u);return e}}},5680:(t,e,n)=>{$Q(e),e.Base64=e.SHA256=void 0;const i=n(725),s=($Q2(e,"Base64",{enumerable:!0,get:function(){return i.Base64}}),n(7485));$Q2(e,"SHA256",{enumerable:!0,get:function(){return s.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],l=[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 s=n.length,r=this.blocks;t<s;){for(this.hashed&&(this.hashed=!1,r[0]=this.block,r[16]=r[1]=r[2]=r[3]=r[4]=r[5]=r[6]=r[7]=r[8]=r[9]=r[10]=r[11]=r[12]=r[13]=r[14]=r[15]=0),e=this.start;t<s&&e<64;++t)(i=n.charCodeAt(t))<128?r[e>>2]|=i<<l[3&e++]:(i<2048?r[e>>2]|=(192|i>>6)<<l[3&e++]:(i<55296||57344<=i?r[e>>2]|=(224|i>>12)<<l[3&e++]:(i=65536+((1023&i)<<10|1023&n.charCodeAt(++t)),r[e>>2]|=(240|i>>18)<<l[3&e++],r[e>>2]|=(128|i>>12&63)<<l[3&e++]),r[e>>2]|=(128|i>>6&63)<<l[3&e++]),r[e>>2]|=(128|63&i)<<l[3&e++]);this.lastByteIndex=e,this.bytes+=e-this.start,64<=e?(this.block=r[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,s=this.h3,r=this.h4,l=this.h5,u=this.h6,o=this.h7,a,c,h,d,v,f,_,g,p,b,y;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(y=n&i,a=0;a<64;a+=4)this.first?(g=704751109,v=t[0]-210244248,o=v-1521486534<<0,s=v+143694565<<0,this.first=!1):(c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),h=(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7),g=e&n,d=g^e&i^y,_=r&l^~r&u,v=o+h+_+m[a]+t[a],f=c+d,o=s+v<<0,s=v+f<<0),c=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),h=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),p=s&e,d=p^s&n^g,_=o&r^~o&l,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),b=i&s,d=b^i&e^p,_=u&o^~u&r,v=l+h+_+m[a+2]+t[a+2],f=c+d,l=n+v<<0,n=v+f<<0,c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),h=(l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7),y=n&i,d=y^n&s^b,_=l&u^~l&o,v=r+h+_+m[a+3]+t[a+3],f=c+d,r=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+s<<0,this.h4=this.h4+r<<0,this.h5=this.h5+l<<0,this.h6=this.h6+u<<0,this.h7=this.h7+o<<0}arrayBuffer(){return this._n().buffer}dataView(){return this._n().dataView}_n(){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 s(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,s)),e.exports}return s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s(9638).default})());
|
|
1
|
+
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())})});!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 n={1845:(t,n,e)=>{var i;$Q2(n,"__esModule",{value:!0}),n.t=n.i=n.l=void 0;const s=e(7512);n.l=()=>{try{return"undefined"!=typeof __STATSIG__?__STATSIG__:o}catch(t){return o}},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&&s.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),e.firstInstance)};var r="__STATSIG__",l="undefined"!=typeof window?window:{},e=void 0!==e.g?e.g:{},u="undefined"!=typeof globalThis?globalThis:{};const o=null!=(i=null!=(i=null!=(i=l[r])?i:e[r])?i:u[r])?i:{instance:n.t};l[r]=o,e[r]=o,u[r]=o},7463:(t,e,n)=>{$Q(e),e.BatchQueue=void 0;const s=n(1956),i=n(4309);e.BatchQueue=class{constructor(t=i.EventRetryConstants.DEFAULT_BATCH_SIZE){this.Mn=[],this.Tn=t}batchSize(){return this.Tn}requeueBatch(t){return this.In(t)}hasFullBatch(){return this.Mn.some(t=>t.events.length>=this.Tn)}takeNextBatch(){var t;return null!=(t=this.Mn.shift())?t:null}takeAllBatches(){var t=this.Mn;return this.Mn=[],t}createBatches(t){let e=0,n=0;for(;e<t.length;){var i=t.slice(e,e+this.Tn);n+=this.In(new s.EventBatch(i)),e+=this.Tn}return n}In(t){this.Mn.push(t);let e=0;for(;this.Mn.length>i.EventRetryConstants.MAX_PENDING_BATCHES;){var n=this.Mn.shift();n&&(e+=n.events.length)}return e}}},2137:(t,e,n)=>{$Q(e),e.o=e.u=void 0;const s=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,s.h)(e.join("|"))}e.u=i,e.o=function(t,e,n){return e?i(t,e,n):(0,s.h)("k:"+t)}},6427:(t,e)=>{$Q(e)},694:function(t,e,n){var s=this&&this.__awaiter||$A();$Q(e),e.v=e.DataAdapterCore=void 0;const o=n(7512),a=n(9122),r=n(8578),l=n(4534),c=n(3401);function h(t,e,n,i){return{source:t,data:e,receivedAt:Date.now(),stableID:n,fullUserHash:(0,r._)(i)}}e.DataAdapterCore=class{constructor(t,e){this.p=t,this.m=e,this.O=null,this.j=null,this.gn=10,this.S="statsig.last_modified_time."+e,this.k=new i}attach(t,e,n){this.j=t,this.O=e}getDataSync(t){var t=t&&(0,r.D)(t,this.O),e=this.I(t),n=this.k.get(e,t);return n&&this.M(n)?n:(n=this.T(e))&&this.M(n)?(this.k.add(e,n,this.gn),this.k.get(e,t)):null}setData(t,e){var e=e&&(0,r.D)(e,this.O),n=this.I(e);this.k.add(n,h("Bootstrap",t,null,e),this.gn)}M(t){return null==t.stableID||t.stableID===a.StableID.get(this.N())}C(e,n,i){return s(this,void 0,void 0,function*(){l.Storage.isReady()||(yield l.Storage.isReadyResolver());var t=null!=e?e:this.getDataSync(n),t=[this.R(t,n,i)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(o.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}U(n,i){return s(this,void 0,void 0,function*(){var t=n&&(0,r.D)(n,this.O),e=this.I(t),t=yield this.C(null,t,i);t&&this.k.add(e,$P($P({},t),{source:"Prefetch"}),this.gn)})}R(r,l,u){return s(this,void 0,void 0,function*(){var t=null!=(t=null==r?void 0:r.data)?t:null,e=null!=r&&this.A(r,l),e=yield this.F(t,l,u,e);if(!e)return o.Log.debug("No response returned for latest value"),null;var n=(0,c.P)(e,"has_updates","Response"),i=this.N(),i=a.StableID.get(i);let s=null;if(!0===(null==n?void 0:n.has_updates))s=h("Network",e,i,l);else{if(!t||!1!==(null==n?void 0:n.has_updates))return null;s=h("NetworkNotModified",t,i,l)}e=this.I(l);return this.k.add(e,s,this.gn),this.L(e,s),s})}N(){return null!=this.j?this.j:(o.Log.error(this.p+" is not attached to a Client"),"")}T(t){var e=null==(e=l.Storage.getItem)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.P)(e,"source","Cached Result"))?$P($P({},t),{source:"Cache"}):null}L(e,t){var n=JSON.stringify(t);for(let t=0;t<8;t++)try{l.Storage.setItem(e,n);break}catch(t){if(!(t instanceof Error)||!t.toString().includes("QuotaExceededError")&&!t.toString().includes("QUOTA_EXCEEDED_ERR")||this.gn<=1)throw t;this.gn=Math.ceil(this.gn/2),this.q(e,this.gn-1)}this.q(e)}q(t,e=this.gn){var n=null!=(i=(0,l.K)(this.S))?i:{},i=(n[t]=Date.now(),u(n,e));for(const s of i)delete n[s],l.Storage.removeItem(s);(0,l.B)(this.S,n)}},e.v=h;class i{constructor(){this.$={}}get(t,e){var t=this.$[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?(o.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):t}add(t,e,n){for(const i of u(this.$,n-1))delete this.$[i];this.$[t]=e}merge(t){this.$=$P($P({},this.$),t)}}function u(n,t){var e=Object.keys(n);return e.length<=t?[]:0===t?e:e.sort((t,e)=>{t=n[t],e=n[e];return"object"==typeof t&&"object"==typeof e?t.receivedAt-e.receivedAt:t-e}).slice(0,e.length-t)}},8962:(t,l)=>{$Q2(l,"__esModule",{value:!0}),l.Diagnostics=void 0;const i=new Map,n="start";function s(t,e,n,i){return $P({key:n,action:e,step:i,timestamp:Date.now()},t)}function r(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]}l.Diagnostics={V:t=>i.get(t),G:t=>{r(t,s({},n,"overall"))},J:(t,e,n)=>{r(t,s({success:e,error:e?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},"end","overall"))},W:(t,e)=>{r(t,s(e,n,"initialize","network_request"))},Y:(t,e)=>{r(t,s(e,"end","initialize","network_request"))},X:t=>{r(t,s({},n,"initialize","process"))},H:(t,e)=>{r(t,s(e,"end","initialize","process"))},Z:t=>{i.delete(t)},tt(t){if(t&&"object"==typeof t)return{code:e(t,"code"),name:e(t,"name"),message:e(t,"message")}},et(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:l.Diagnostics.tt(i)}},it(t,e,n,i){var s,r=l.Diagnostics.V(n);return null==r||r.length<=0?-1:(s=r[r.length-1].timestamp-r[0].timestamp,l.Diagnostics.Z(n),n=function(t,e){t={eventName:"statsig::diagnostics",user:t,value:null,metadata:e,time:Date.now()};return t}(t,{context:"initialize",markers:r.slice(),statsigOptions:i}),e.enqueue(n),s)}}},8809:function(t,e){var n=this&&this.__awaiter||$A();$Q(e),e.nt=void 0;const s=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),r="https://cloudflare-dns.com/dns-query",l=["i","e","d"],u=200;e.nt=function(e){return n(this,void 0,void 0,function*(){var n=yield e(r,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:s});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)&&l.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,a,e){var n=this&&this.__awaiter||$A();$Q2(a,"__esModule",{value:!0}),a.ErrorBoundary=a.EXCEPTION_ENDPOINT=void 0;const i=e(7512),c=e(5902),h=e(8e3),d=(a.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception","[Statsig] UnknownError");function v(t){return t instanceof Error?t:"string"==typeof t?new Error(t):new Error("An unknown error occurred.")}a.ErrorBoundary=class{constructor(t,e,n,i){this.j=t,this.O=e,this.st=n,this.rt=i,this.lt=new Set}wrap(i,s){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.ot(s?s+":"+e:e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.ut("eb:wrap",t)}}logError(t,e){this.ut(t,e)}logDroppedEvents(t,e,n){const i={eventCount:String(t)};n&&Object.entries(n).forEach(([t,e])=>{i[t]=String(e)}),this.ut("statsig::log_event_dropped_event_count",new Error(e),!0,i)}logEventRequestFailure(t,e,n,i){t={eventCount:String(t),flushType:n,statusCode:String(i)};this.ut("statsig::log_event_failed",new Error(e),!0,t)}getLastSeenErrorAndReset(){var t=this.rt;return this.rt=void 0,null!=t?t:null}attachErrorIfNoneExists(t){this.rt||(this.rt=v(t))}ot(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.ut(e,t)):n}catch(t){return this.ut(e,t),null}}ut(r,l,u=!1,o){try{i.Log.warn("Caught error in "+r,{error:l});n(this,void 0,void 0,function*(){var t,e=l||Error(d),n=e instanceof Error,i=n?e.name:"No Name",s=v(e);this.rt=s,!u&&this.lt.has(i)||(this.lt.add(i),null!=(s=null==(s=this.O)?void 0:s.networkConfig)&&s.preventAllNetworkTraffic?null!=(s=this.st)&&s.call(this,{name:"error",error:l,tag:r}):(s=c.SDKType.ct(this.j),t=h.StatsigMetadataProvider.get(),n=n?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return d}}(e),e=$P({tag:r,exception:i,info:n,extra:o,statsigOptions:function(i){if(!i)return{};const s={};return Object.keys(i).forEach(t=>{var e=t,n=i[e];switch(typeof n){case"number":case"bigint":case"boolean":s[String(e)]=n;break;case"string":n.length<50?s[String(e)]=n:s[String(e)]="set";break;case"object":"environment"===e?s.environment=n:"networkConfig"===e?s.networkConfig=n:s[String(e)]=null!=n?"set":"unset"}}),s}(this.O)},$P($P({},t),{sdkType:s})),yield(null!=(i=null==(n=null==(i=this.O)?void 0:i.networkConfig)?void 0:n.networkOverrideFunc)?i:fetch)(a.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.j,"STATSIG-SDK-TYPE":String(s),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:JSON.stringify(e)}),null!=(n=this.st)&&n.call(this,{name:"error",error:l,tag:r})))}).then(()=>{}).catch(()=>{})}catch(t){}}}},2922:(t,e)=>{$Q(e)},2417:(t,e)=>{$Q(e)},1956:(t,e)=>{$Q(e),e.EventBatch=void 0;e.EventBatch=class{constructor(t){this.attempts=0,this.createdAt=Date.now(),this.events=t}incrementAttempts(){this.attempts++}}},7770:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventLogger=void 0;const r=n(7463),s=n(2137),l=n(4309),u=n(4312),o=n(1406),a=n(7512),c=n(7410),h=n(1228),d=n(6830),v=n(1637),f=n(586),_=n(4534),g=n(1881),p=n(2397),b={};class y{static ht(t){null!=(t=b[t])&&t.flush().catch(()=>{})}constructor(t,e,n,i,s){this.j=t,this.st=e,this.ft=n,this.O=i,this.te=s,this._t={},this.bt={},this.An=!1,this.Nn=null,this.jt=null!=(t=null==i?void 0:i.loggingEnabled)?t:!0===(null==i?void 0:i.disableLogging)?f.LoggingEnabledOption.disabled:f.LoggingEnabledOption.browserOnly,null!=i&&i.loggingEnabled&&void 0!==i.disableLogging&&a.Log.warn("Detected both loggingEnabled and disableLogging options. loggingEnabled takes precedence - please remove disableLogging.");e=null==i?void 0:i.networkConfig,this.wt=new g.UrlConfiguration(c.Endpoint.kt,null==e?void 0:e.logEventUrl,null==e?void 0:e.api,null==e?void 0:e.logEventFallbackUrls),s=null!=(n=null==i?void 0:i.loggingBufferMaxSize)?n:l.EventRetryConstants.DEFAULT_BATCH_SIZE;this.Fn=new h.PendingEvents(s),this.Cn=new r.BatchQueue(s),this.Rn=new u.FlushCoordinator(this.Cn,this.Fn,()=>this.appendAndResetNonExposedChecks(),this.j,this.ft,this.st,this.wt,this.O,this.jt,this.te)}setLogEventCompressionMode(t){this.Rn.setLogEventCompressionMode(t)}setLoggingEnabled(t){var e="disabled"===this.jt,n="disabled"!==t;this.jt=t,this.Rn.setLoggingEnabled(t),e&&n&&(t=this.Un(),a.Log.debug(`Loaded ${t.length} stored event(s) from storage`),0<t.length)&&(t.forEach(t=>{this.Rn.addEvent(t)}),this.flush().catch(t=>{a.Log.warn("Failed to flush events after enabling logging:",t)}))}enqueue(t){this.Et(t)&&(t=this.Pn(t),"disabled"===this.jt?this.Ln(t):(this.Rn.addEvent(t),this.Rn.checkQuickFlush()))}incrementNonExposureCount(t){var e=null!=(e=this.bt[t])?e:0;this.bt[t]=e+1}reset(){this.flush().catch(()=>{}),this._t={}}start(){var t,e=(0,d.Mt)();e&&"always"!==(null==(t=this.O)?void 0:t.loggingEnabled)||(b[this.j]=this,e||(0,p.xt)(t=>{"background"===t?y.ht(this.j):"foreground"===t&&this.Rn.startScheduledFlushCycle()}),this.Rn.loadAndRetryShutdownFailedEvents().catch(t=>{a.Log.warn("Failed to load failed shutdown events:",t)}),this.Rn.startScheduledFlushCycle())}stop(){return i(this,void 0,void 0,function*(){this.An=!0,yield this.Rn.processShutdown(),delete b[this.j]})}flush(){return i(this,void 0,void 0,function*(){return this.Rn.processManualFlush()})}appendAndResetNonExposedChecks(){var t;0!==Object.keys(this.bt).length&&(t=this.Pn({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.bt)}}),this.Rn.addEvent(t),this.bt={})}Et(t){if("always"!==(null==(e=this.O)?void 0:e.loggingEnabled)&&(0,d.Mt)())return!1;if((0,v.Ut)(t)){var e=t.user||{statsigEnvironment:void 0},e=(0,s.u)(this.j,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._t[t],n=Date.now();if(e&&n-e<6e5)return!1;1e3<Object.keys(this._t).length&&(this._t={}),this._t[t]=n}return!0}qt(){var t;if(!1!==(null==(t=this.O)?void 0:t.includeCurrentPageUrlWithEvents))return(0,d.Kt)()}o(){return this.Nn||(this.Nn="statsig.pending_events."+(0,o.h)(this.j)),this.Nn}Ln(e){var n=this.o();try{let t=this.Bn(n);t.push(e),t.length>l.EventRetryConstants.MAX_LOCAL_STORAGE&&(t=t.slice(-l.EventRetryConstants.MAX_LOCAL_STORAGE)),(0,_.B)(n,t)}catch(t){a.Log.warn("Unable to save events to storage")}}Bn(t){try{var e=(0,_.K)(t);return Array.isArray(e)?e:[]}catch(t){return[]}}Un(){var t=this.o(),e=this.Bn(t);return 0<e.length&&_.Storage.removeItem(t),e}Pn(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.qt();return n&&(e.statsigMetadata={currentPage:n}),$P($P({},t),e)}}e.EventLogger=y},4309:(t,e)=>{$Q(e),e.EventRetryConstants=void 0,e.EventRetryConstants={MAX_RETRY_ATTEMPTS:5,DEFAULT_BATCH_SIZE:100,MAX_PENDING_BATCHES:30,TICK_INTERVAL_MS:1e3,QUICK_FLUSH_WINDOW_MS:200,MAX_LOCAL_STORAGE:500,get MAX_QUEUED_EVENTS(){return this.DEFAULT_BATCH_SIZE*this.MAX_PENDING_BATCHES}}},6351:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.EventSender=void 0;const r=n(7512),s=n(7410),l=n(2397);e.EventSender=class{constructor(t,e,n,i,s,r){this.j=t,this.ft=e,this.st=n,this.O=s,this.wt=i,this.jt=r}setLogEventCompressionMode(t){this.ft.setLogEventCompressionMode(t)}setLoggingEnabled(t){this.jt=t}sendBatch(s){return i(this,void 0,void 0,function*(){var t,e;try{var n=(0,l.Ft)()&&this.ft.isBeaconSupported()&&null==(null==(e=null==(t=this.O)?void 0:t.networkConfig)?void 0:e.networkOverrideFunc),i=(this.st({name:"pre_logs_flushed",events:s.events}),n?this.Pt(s):yield this.Lt(s));return i.success?(this.st({name:"logs_flushed",events:s.events}),i):{success:!1,statusCode:-1}}catch(t){return r.Log.warn("Failed to send batch:",t),{success:!1,statusCode:-1}}})}Lt(e){return i(this,void 0,void 0,function*(){var t=yield this.ft.post(this.zt(e)),t=null!=(t=null==t?void 0:t.code)?t:-1;return{success:200<=t&&t<300,statusCode:t}})}Pt(t){t=this.ft.beacon(this.zt(t));return{success:t,statusCode:t?200:-1}}zt(t){return{sdkKey:this.j,data:{events:t.events},urlConfig:this.wt,retries:3,isCompressable:!0,params:{[s.NetworkParam.EventCount]:String(t.events.length)},headers:{"statsig-event-count":String(t.events.length),"statsig-retry-count":String(t.attempts)},credentials:"same-origin"}}}},4312:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.FlushCoordinator=void 0;const s=n(4309),c=n(6351),h=n(8153),r=n(323),l=n(1406),u=n(7512),o=n(7023),a=n(4534);e.FlushCoordinator=class{constructor(t,e,n,i,s,r,l,u,o,a){this.qn=null,this.zn=null,this.yt=!1,this.$n=null,this.Ot=Date.now(),this.Nn=null,this.Kn=new h.FlushInterval,this.Cn=t,this.Fn=e,this.Vn=n,this.te=a,this.j=i,this.Gn=new c.EventSender(i,s,r,l,u,o)}setLoggingEnabled(t){this.Gn.setLoggingEnabled(t)}setLogEventCompressionMode(t){this.Gn.setLogEventCompressionMode(t)}startScheduledFlushCycle(){this.Jn()}stopScheduledFlushCycle(){this.Qn()}addEvent(t){this.Fn.addToPendingEventsQueue(t),this.Fn.hasEventsForFullBatch()&&this.processLimitFlush()}processManualFlush(){return i(this,void 0,void 0,function*(){return this.$n&&(yield this.$n),this.$n=this.Hn(r.FlushType.Manual).finally(()=>{this.$n=null,this.Jn()}),this.$n})}processShutdown(){return i(this,void 0,void 0,function*(){return this.$n&&(yield this.$n),this.$n=this.Hn(r.FlushType.Shutdown).catch(t=>{u.Log.error("Error during shutdown flush: "+t)}).finally(()=>{this.$n=null}),this.$n})}Hn(e){return i(this,void 0,void 0,function*(){this.Qn();try{this.Wn(e);var t=this.Cn.takeAllBatches();0!==t.length&&(yield Promise.all(t.map(t=>this.Xn(t,e))))}finally{this.Jn()}})}checkQuickFlush(){this.yt||Date.now()-this.Ot>s.EventRetryConstants.QUICK_FLUSH_WINDOW_MS||(this.yt=!0,setTimeout(()=>{this.processManualFlush().catch(t=>{u.Log.warn("Quick flush failed:",t)})},s.EventRetryConstants.QUICK_FLUSH_WINDOW_MS))}Yn(){if(this.$n)this.Jn();else{var e=this.containsAtLeastOneFullBatch(),t=this.Kn.hasReachedMaxInterval();if(e||t){this.Kn.markFlushAttempt();let t;t=e?r.FlushType.ScheduledFullBatch:r.FlushType.ScheduledMaxTime,this.$n=this.Zn(t).then(()=>{}).catch(t=>{u.Log.error("Error during scheduled flush:",t)}).finally(()=>{this.$n=null,this.Jn()})}else this.Jn()}}processLimitFlush(){!this.Kn.hasCompletelyRecoveredFromBackoff()||this.$n||(this.$n=this.Ai().catch(t=>{u.Log.error("Error during limit flush",t)}).finally(()=>{this.$n=null,this.Jn()}))}Ai(){return i(this,void 0,void 0,function*(){const t=yield this.Zn(r.FlushType.Limit);if(t)for(;this.Kn.hasCompletelyRecoveredFromBackoff()&&this.containsAtLeastOneFullBatch();){const t=yield this.Zn(r.FlushType.Limit);if(!t)break}})}Jn(){this.Qn();var t=Math.max(0,this.Kn.getTimeUntilNextFlush()),t=(this.qn=setTimeout(()=>{this.qn=null,this.Yn()},t),Math.max(0,this.Kn.getTimeTillMaxInterval()));this.zn=setTimeout(()=>{this.zn=null,this.Yn()},t)}Qn(){null!==this.qn&&(clearTimeout(this.qn),this.qn=null),null!==this.zn&&(clearTimeout(this.zn),this.zn=null)}Zn(e){return i(this,void 0,void 0,function*(){this.Wn(e);var t=this.Cn.takeNextBatch();return!!t&&this.Xn(t,e)})}Xn(e,n){return i(this,void 0,void 0,function*(){var t=yield this.Gn.sendBatch(e);return t.success?(this.Kn.adjustForSuccess(),!0):(this.Kn.adjustForFailure(),this.Ni(e,n,t.statusCode),!1)})}Wn(t){this.Vn();var e=this.convertPendingEventsToBatches();0<e&&(u.Log.warn(`Dropped ${e} events`),this.te.logDroppedEvents(e,"Batch queue limit reached",{loggingInterval:this.Kn.getCurrentIntervalMs(),batchSize:this.Cn.batchSize(),maxPendingBatches:s.EventRetryConstants.MAX_PENDING_BATCHES,flushType:t}))}containsAtLeastOneFullBatch(){return this.Fn.hasEventsForFullBatch()||this.Cn.hasFullBatch()}convertPendingEventsToBatches(){var t;return this.Fn.isEmpty()?0:(t=this.Fn.takeAll(),this.Cn.createBatches(t))}Ni(t,e,n){var i;e===r.FlushType.Shutdown?(u.Log.warn(e+" flush failed during shutdown. "+t.events.length+" event(s) will be saved to storage for retry in next session."),this.Fi(t.events),this.te.logEventRequestFailure(t.events.length,"flush failed during shutdown - saved to storage",e,n)):o.RETRYABLE_CODES.has(n)?t.attempts>=s.EventRetryConstants.MAX_RETRY_ATTEMPTS?(u.Log.warn(`${e} flush failed after ${t.attempts} attempt(s). `+t.events.length+" event(s) will be dropped."),this.te.logEventRequestFailure(t.events.length,"max retry attempts exceeded",e,n)):(t.incrementAttempts(),0<(i=this.Cn.requeueBatch(t))&&(u.Log.warn(`Failed to requeue batch : dropped ${i} events due to full queue`),this.te.logDroppedEvents(i,"Batch queue limit reached",{loggingInterval:this.Kn.getCurrentIntervalMs(),batchSize:this.Cn.batchSize(),maxPendingBatches:s.EventRetryConstants.MAX_PENDING_BATCHES,flushType:e}))):(u.Log.warn(`${e} flush failed after ${t.attempts} attempt(s). `+t.events.length+" event(s) will be dropped. Non-retryable error: "+n),this.te.logEventRequestFailure(t.events.length,"non-retryable error",e,n))}loadAndRetryShutdownFailedEvents(){return i(this,void 0,void 0,function*(){var t=this.o();try{var e=this.Ci(t);0!==e.length&&(u.Log.debug(`Loading ${e.length} failed shutdown event(s) from storage for retry`),a.Storage.removeItem(t),e.forEach(t=>{this.addEvent(t)}),yield this.processManualFlush())}catch(t){u.Log.warn("Failed to load and retry failed shutdown events:",t)}})}o(){return this.Nn||(this.Nn="statsig.failed_shutdown_events."+(0,l.h)(this.j)),this.Nn}Fi(e){var n=this.o();try{let t=[...this.Ci(n),...e];t.length>s.EventRetryConstants.MAX_LOCAL_STORAGE&&(t=t.slice(-s.EventRetryConstants.MAX_LOCAL_STORAGE)),(0,a.B)(n,t),u.Log.debug(`Saved ${e.length} failed shutdown event(s) to storage (total stored: ${t.length})`)}catch(t){u.Log.warn("Unable to save failed shutdown events to storage:",t)}}Ci(t){try{var e=(0,a.K)(t);return Array.isArray(e)?e:[]}catch(t){return[]}}}},8153:(t,e)=>{$Q(e),e.FlushInterval=void 0;e.FlushInterval=class{constructor(){this.Ri=1e3,this.Ui=Date.now()}getCurrentIntervalMs(){return this.Ri}markFlushAttempt(){this.Ui=Date.now()}getTimeSinceLastAttempt(){return Date.now()-this.Ui}hasReachedMaxInterval(){return 6e4<=this.getTimeSinceLastAttempt()}getTimeTillMaxInterval(){return 6e4-this.getTimeSinceLastAttempt()}hasCompletelyRecoveredFromBackoff(){return this.Ri<=1e3}adjustForSuccess(){var t=this.Ri;1e3!==t&&(this.Ri=Math.max(1e3,Math.floor(t/2)))}adjustForFailure(){var t=this.Ri;this.Ri=Math.min(6e4,2*t)}getTimeUntilNextFlush(){return this.getCurrentIntervalMs()-this.getTimeSinceLastAttempt()}}},323:(t,e)=>{$Q(e),e.FlushType=void 0,e.FlushType={ScheduledMaxTime:"scheduled:max_time",ScheduledFullBatch:"scheduled:full_batch",Limit:"limit",Manual:"manual",Shutdown:"shutdown"}},1406:(t,r,e)=>{$Q2(r,"__esModule",{value:!0}),r.Bt=r.$t=r.h=void 0;const l=e(6634);r.h=e=>{let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)},r.$t=(t,e)=>(0,r.h)(JSON.stringify((0,r.Bt)(t,e)));r.Bt=(n,i)=>{if(null==n)return null;var t=Object.keys(n).sort();const s={};return t.forEach(t=>{var e=n[t];0===i||"object"!==(0,l.Vt)(e)?s[t]=e:s[t]=(0,r.Bt)(e,null!=i?i-1:i)}),s}},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={Gt:"g",Jt:"c",Wt:"e",Yt:"cl",Xt:"l",Ht:"p"};const r=new Set([]),l=new Set(["userPersistedValues"]);e.createMemoKey=function(t,e,n){let i=t+"|"+e;if(n)for(const s of Object.keys(n)){if(l.has(s))return;r.has(s)?i+=`|${s}=true`:i+=`|${s}=`+n[s]}return i}},7410:(t,e)=>{$Q(e),e.NetworkParam=e.NetworkDefault=e.Endpoint=void 0,e.Endpoint={Qt:"initialize",kt:"rgstr",Zt:"download_config_specs"},e.NetworkDefault={[e.Endpoint.kt]:"https://prodregistryv2.org/v1",[e.Endpoint.Qt]:"https://featureassets.org/v1",[e.Endpoint.Zt]:"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,y,e){var m=this&&this.__awaiter||$A();$Q2(y,"__esModule",{value:!0}),y.NetworkCore=y.RETRYABLE_CODES=void 0,e(1845);const v=e(1845),O=e(8962),j=e(7512),S=e(7410),n=e(308),f=e(3091),l=e(5902),s=e(6830),u=e(4143),o=e(9122),w=e(2636),a=e(8e3),_=e(586),E=e(2397),x=500,k=3e4;y.RETRYABLE_CODES=new Set([408,500,502,503,504,522,524,599]);y.NetworkCore=class{constructor(t,e){this.st=e,this.te=null,this.ee=1e4,this.ie={},this.O={},this.ne={},this.se=null,t&&(this.O=t),this.O.networkConfig&&(this.ie=this.O.networkConfig),this.ie.networkTimeoutMs&&(this.ee=this.ie.networkTimeoutMs),this.re=new n.NetworkFallbackResolver(this.O),this.setLogEventCompressionMode(this.le(t))}setLogEventCompressionMode(t){this.O.logEventCompressionMode=t}setErrorBoundary(t){this.te=t,this.te.wrap(this),this.te.wrap(this.re),this.re.setErrorBoundary(t)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){var t=this.se;return this.se=null,t}beacon(t){var e,n;return!!M(t)&&(t=this.oe("POST",t),e=this.ue(t),(n=navigator).sendBeacon.bind(n)(e,t.body))}post(e){return m(this,void 0,void 0,function*(){var t=this.oe("POST",e);return this.ae(t),yield this.ce(t),this.he(t)})}get(t){t=this.oe("GET",t);return this.he(t)}he(b){return m(this,void 0,void 0,function*(){var e;if(!M(b))return null;if(this.ie.preventAllNetworkTraffic)return null;var{method:i,body:s,retries:n,attempt:r}=b,l=b.urlConfig.endpoint;if(this.de(l))return j.Log.warn(`Request to ${l} was blocked because you are making requests too frequently.`),null;r=null!=r?r:1;let u=!1;var o=this.ue(b);let a=null;var c,h=(0,E.Ft)();try{var t,d,v,f={method:i,body:s,headers:$P({},b.headers),priority:b.priority,keepalive:h},_=(c=r,(p=b).urlConfig.endpoint===S.Endpoint.Qt&&O.Diagnostics.W(p.sdkKey,{attempt:c}),this.ne[l]),g=(_&&(_.lastRequestTime=Date.now(),this.ne[l]=_),null!=(e=this.ie.networkOverrideFunc)?e:fetch);let n;if((a=yield Promise.race([g(o,f).finally(()=>clearTimeout(n)),new Promise((t,e)=>{n=setTimeout(()=>{u=!0,e(new Error(`Timeout of ${this.ee}ms expired.`))},this.ee)})])).ok)return v=yield a.text(),D(b,a,r,v),this.re.tryBumpExpiryTime(b.sdkKey,b.urlConfig),{body:v,code:a.status};throw t=yield a.text().catch(()=>"No Text"),(d=new Error(`NetworkError: ${o} `+t)).name="NetworkError",d}catch(t){var s=function(t){if("string"==typeof t)return t;if(t instanceof Error)return t.name+": "+t.message;return"Unknown Error"}(t),h=function(t,e){t=t.includes("Timeout");return t||e}(null!=s?s:"",u),p=(D(b,a,r,"",t),yield this.re.tryFetchUpdatedFallbackInfo(b.sdkKey,b.urlConfig,s,h));return(p&&(b.fallbackUrl=this.re.getActiveFallbackUrl(b.sdkKey,b.urlConfig)),!n||n<r||!y.RETRYABLE_CODES.has(null!=(c=null===a||void 0===a?void 0:a.status)?c:500))?(null!=(l=this.st)&&l.call(this,{name:"error",error:t,tag:w.ErrorTag.NetworkError,requestArgs:b}),_=`A networking error occurred during ${i} request to ${o}.`,j.Log.error(_,s,t),null!=(e=this.te)&&e.attachErrorIfNoneExists(_),null):(yield function(e){return m(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(x*(e*e),k)))})}(r),this.he($P($P({},b),{retries:n,attempt:r+1})))}})}le(t){let e=null==t?void 0:t.logEventCompressionMode;return e=(e=e||!0!==(null==t?void 0:t.disableCompression)?e:_.LogEventCompressionMode.Disabled)||_.LogEventCompressionMode.Enabled}de(t){var e=Date.now(),n=null!=(n=this.ne[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.ne[t]=n,!1)}ue(t){var e=null!=(e=t.fallbackUrl)?e:t.urlConfig.getUrl();t.urlConfig.endpoint!==S.Endpoint.Qt&&t.urlConfig.endpoint!==S.Endpoint.Zt||(this.se=e);const n=$P({[S.NetworkParam.SdkKey]:t.sdkKey,[S.NetworkParam.SdkType]:l.SDKType.ct(t.sdkKey),[S.NetworkParam.SdkVersion]:a.SDK_VERSION,[S.NetworkParam.Time]:String(Date.now()),[S.NetworkParam.SessionID]:u.SessionID.get(t.sdkKey)},t.params);t=Object.keys(n).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(n[t])).join("&");return e+(t?"?"+t:"")}ae(e){var t,n=(0,s.ve)(),i=e.body;if(e.isStatsigEncodable&&!this.O.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:{}),{[S.NetworkParam.StatsigEncoded]:"1"})}catch(t){j.Log.warn("Request encoding failed for "+e.urlConfig.getUrl(),t)}}ce(d){return m(this,void 0,void 0,function*(){var e,n=d.body;if("string"==typeof n&&function(t,e){if(!t.isCompressable)return;if(null!=(0,v.i)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder)return;var n=null!=t.urlConfig.customUrl||null!=t.urlConfig.fallbackUrls,i=!0===f.SDKFlags.get(t.sdkKey,"enable_log_event_compression");switch(e.logEventCompressionMode){case _.LogEventCompressionMode.Disabled:return;case _.LogEventCompressionMode.Enabled:return n&&!i?void 0:1;case _.LogEventCompressionMode.Forced:return 1;default:return}}(d,this.O))try{for(var i,s=(new TextEncoder).encode(n),r=new CompressionStream("gzip"),l=r.writable.getWriter(),u=(l.write(s).catch(j.Log.error),l.close().catch(j.Log.error),r.readable.getReader()),o=[];!(i=yield u.read()).done;)o.push(i.value);var a=o.reduce((t,e)=>t+e.length,0),c=new Uint8Array(a);let t=0;for(const h of o)c.set(h,t),t+=h.length;d.body=c,d.params=$P($P({},null!=(e=d.params)?e:{}),{[S.NetworkParam.IsGzipped]:"1"})}catch(t){j.Log.warn("Request compression failed for "+d.urlConfig.getUrl(),t)}})}oe(t,e){var n=this.re.getActiveFallbackUrl(e.sdkKey,e.urlConfig),t=$P($P({},e),{method:t,fallbackUrl:n});return"data"in e&&i(t,e.data),t}};const M=t=>!!t.sdkKey||(j.Log.warn("Unable to make request without an SDK key"),!1),i=(t,e)=>{var{sdkKey:n,fallbackUrl:i}=t,s=o.StableID.get(n),r=u.SessionID.get(n),n=l.SDKType.ct(n);t.body=JSON.stringify($P($P({},e),{statsigMetadata:$P($P({},a.StatsigMetadataProvider.get()),{stableID:s,sessionID:r,sdkType:n,fallbackUrl:i})}))};function D(t,e,n,i,s){t.urlConfig.endpoint===S.Endpoint.Qt&&O.Diagnostics.Y(t.sdkKey,O.Diagnostics.et(e,n,i,s))}},308:function(t,e,n){var u=this&&this.__awaiter||$A();$Q(e),e.fe=e.NetworkFallbackResolver=void 0;const l=n(8809),i=n(1406),r=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)}e.NetworkFallbackResolver=class{constructor(t){this.ge=null,this.te=null,this._e={},this.pe=null==(t=t.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(t){this.te=t}tryBumpExpiryTime(t,e){var n=null==(n=this.ge)?void 0:n[e.endpoint];n&&(n.expiryTime=Date.now()+6048e5,h(t,$P($P({},this.ge),{[e.endpoint]:n})))}getActiveFallbackUrl(t,e){var n;if(null!=e.customUrl&&null!=e.fallbackUrls)return null;let i=this.ge;null==i&&(i=null!=(s=function(t){t=c(t),t=o.Storage.getItem(t);if(!t)return null;try{return JSON.parse(t)}catch(t){return r.Log.error("Failed to parse FallbackInfo"),null}}(t))?s:{},this.ge=i);var s=i[e.endpoint];return!s||Date.now()>(null!=(n=s.expiryTime)?n:0)||e.getChecksum()!==s.urlConfigChecksum?(delete i[e.endpoint],this.ge=i,h(t,this.ge),null):s.url||null}tryFetchUpdatedFallbackInfo(i,s,r,l){return u(this,void 0,void 0,function*(){var e,t,n;try{return a(r,l)?(t=null==s.customUrl&&null==s.fallbackUrls?yield this.be(s):s.fallbackUrls,!!(n=this.ye(null==(e=this.ge)?void 0:e[s.endpoint],t))&&(this.me(i,s,n),!0)):!1}catch(t){return null!=(e=this.te)&&e.logError("tryFetchUpdatedFallbackInfo",t),!1}})}me(t,e,n){var n={urlConfigChecksum:e.getChecksum(),url:n,expiryTime:Date.now()+6048e5,previous:[]},e=e.endpoint,i=null==(i=this.ge)?void 0:i[e],i=(i&&n.previous.push(...i.previous),10<n.previous.length&&(n.previous=[]),null==(i=null==(i=this.ge)?void 0:i[e])?void 0:i.url);null!=i&&n.previous.push(i),this.ge=$P($P({},this.ge),{[e]:n}),h(t,this.ge)}be(r){return u(this,void 0,void 0,function*(){var t=this._e[r.endpoint];if(t&&Date.now()<t)return null;this._e[r.endpoint]=Date.now()+144e5;var e=[],t=yield(0,l.nt)(null!=(t=this.pe)?t:fetch),n=function(t){try{return new URL(t).pathname}catch(t){return null}}(r.defaultUrl);for(const s of t)if(s.startsWith(r.endpointDnsKey+"=")){var i=s.split("=");if(1<i.length){let t=i[1];t.endsWith("/")&&(t=t.slice(0,-1)),e.push("https://"+t+n)}}return e})}ye(t,e){var n;if(null==e)return null;var i=new Set(null!=(n=null==t?void 0:t.previous)?n:[]),s=null==t?void 0:t.url;let r=null;for(const u of e){var l=u.endsWith("/")?u.slice(0,-1):u;if(!i.has(u)&&l!==s){r=l;break}}return r}},e.fe=a},1405:(t,e)=>{$Q(e)},1361:(t,e)=>{$Q(e)},1228:(t,e,n)=>{$Q(e),e.PendingEvents=void 0;const i=n(7512);e.PendingEvents=class{constructor(t){this.Fn=[],this.Tn=t}addToPendingEventsQueue(t){this.Fn.push(t),i.Log.debug("Enqueued Event:",t)}hasEventsForFullBatch(){return this.Fn.length>=this.Tn}takeAll(){var t=this.Fn;return this.Fn=[],t}isEmpty(){return 0===this.Fn.length}}},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={ct:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},Oe(t,e){n[t]=e},je(t){i&&"-react"!==i||(i="-"+t)}}},6830:(t,i)=>{$Q2(i,"__esModule",{value:!0}),i.Se=i.Kt=i.we=i.ke=i.Mt=i.Ee=i.ve=void 0;i.ve=()=>"undefined"!=typeof window?window:null,i.Ee=()=>{var t=(0,i.ve)();return null!=(t=null==t?void 0:t.document)?t:null},i.Mt=()=>{var t;return null===(0,i.Ee)()&&(t="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,"string"==typeof EdgeRuntime||t)},i.ke=(t,e)=>{var n=(0,i.ve)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.we=(t,e)=>{var n=(0,i.Ee)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.Kt=()=>{var t;try{return null==(t=(0,i.ve)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}};i.Se=()=>{var t=(0,i.ve)();return t&&"onpagehide"in t?"pagehide":"beforeunload"}},4143:(t,e,n)=>{$Q(e),e.StatsigSession=e.SessionID=void 0;const i=n(1845),s=n(2137),u=n(7512),o=n(4534),a=n(8023),c=18e5,h=144e5,d={};function v(e,t){return setTimeout(()=>{var t=null==(t=(0,i.l)())?void 0:t.instance(e);t&&t.$emt({name:"session_expired"})},t)}function f(t){return"statsig.session_id."+(0,s.o)(t)}e.SessionID={get:t=>e.StatsigSession.get(t).data.sessionID},e.StatsigSession={get:t=>{null==d[t]&&(d[t]=function(t){let e=function(t){t=f(t);return(0,o.K)(t)}(t);var n=Date.now();e=e||{sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n};return{data:e,sdkKey:t}}(t));var t=d[t],e=Date.now(),n=t.data,i=t.sdkKey,s=((function({lastUpdate:t}){return Date.now()-t>c}(n)||function({startTime:t}){return Date.now()-t>h}(n))&&(n.sessionID=(0,a.getUUID)(),n.startTime=e,l=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(i))&&l.$emt({name:"session_expired"}),n.lastUpdate=e,n),r=t.sdkKey;r=f(r);try{(0,o.B)(r,s)}catch(t){u.Log.warn("Failed to save SessionID")}clearTimeout(t.idleTimeoutID),clearTimeout(t.ageTimeoutID);var l=e-n.startTime;return t.idleTimeoutID=v(i,c),t.ageTimeoutID=v(i,h-l),t},overrideInitialSessionID:(t,e)=>{var n;d[e]=(t=t,e=e,n=Date.now(),{data:{sessionID:t,startTime:n,lastUpdate:n},sdkKey:e})}}},2176:(t,u)=>{$Q2(u,"__esModule",{value:!0}),u.De=void 0;u.De=(e,n)=>{let i=0;var s=Object.keys(e);for(let t=0;t<s.length;t++){var r=s[t],l=e[r];if((i=(i+=r.length)+("object"==typeof l&&null!==l?(0,u.De)(l,n)+2:String(l).length+1))>=n)return i}return i}},9122:(t,e,n)=>{$Q(e),e.getCookieName=e.StableID=void 0;const i=n(2137),s=n(7512),r=n(6830),l=n(4534),u=n(8023),o={},a={},c={};function h(t){return"statsig.stable_id."+(0,i.o)(t)}function d(t,e){e=h(e);try{(0,l.B)(e,t)}catch(t){s.Log.warn("Failed to save StableID to storage")}}function v(t,e){var n;a[e]&&null!=(0,r.Ee)()&&((n=new Date).setFullYear(n.getFullYear()+1),document.cookie=`${f(e)}=${encodeURIComponent(t)}; expires=${n.toUTCString()}; path=/`)}function f(t){return"statsig.stable_id."+(0,i.o)(t)}e.StableID={cookiesEnabled:!1,randomID:Math.random().toString(36),get:t=>{if(c[t])return null;if(null!=o[t])return o[t];let e=null;return null!=(e=function(t){if(a[t]&&null!=(0,r.Ee)())for(const i of document.cookie.split(";")){var[e,n]=i.trim().split("=");if(e===f(t))return decodeURIComponent(n)}return null}(t))?d(o[t]=e,t):(d(e=null==(e=function(t){t=h(t);return(0,l.K)(t)}(t))?(0,u.getUUID)():e,t),v(e,t),o[t]=e),e},setOverride:(t,e)=>{d(o[e]=t,e),v(t,e)},Ie:(t,e)=>{a[t]=e},Me:(t,e)=>{c[t]=e}},e.getCookieName=f},1375:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigClientBase=void 0,n(1845);const l=n(1845),u=n(5542),o=n(7770),a=n(7512),r=n(7787),c=n(6830),h=n(4143),d=n(9122),s=n(586),v=n(4534);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.xe=null,this.Te={};var s,r=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),null!=i&&i.disableStorage&&v.Storage.Me(!0),null!=i&&i.initialSessionID&&h.StatsigSession.overrideInitialSessionID(i.initialSessionID,t),null!=i&&i.storageProvider&&v.Storage.Ne(i.storageProvider),null!=i&&i.enableCookies&&d.StableID.Ie(t,i.enableCookies),null!=i&&i.disableStableID&&d.StableID.Me(t,!0),this.j=t,this.O=null!=i?i:{},this.Ce={},this.overrideAdapter=null!=(s=null==i?void 0:i.overrideAdapter)?s:null,this.te=new u.ErrorBoundary(t,i,r),this.Re=new o.EventLogger(t,r,n,i,this.te),this.te.wrap(this),this.te.wrap(e),this.te.wrap(this.Re),n.setErrorBoundary(this.te),this.dataAdapter=e,this.dataAdapter.attach(t,i,n),this.storageProvider=v.Storage,null!=(e=null==(r=null==(s=this.overrideAdapter)?void 0:s.loadFromStorage)?void 0:r.call(s))&&e.catch(t=>this.te.logError("OA::loadFromStorage",t)),this.Ue(),i=t,n=this,(0,c.Mt)()||(r=(0,l.l)(),s=null!=(s=r.instances)?s:{},n=n,null!=s[i]&&a.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),s[i]=n,r.firstInstance||(r.firstInstance=n),r.instances=s,__STATSIG__=r)}updateRuntimeOptions(t){t.loggingEnabled?(this.O.loggingEnabled=t.loggingEnabled,this.Re.setLoggingEnabled(t.loggingEnabled)):null!=t.disableLogging&&(this.O.disableLogging=t.disableLogging,this.Re.setLoggingEnabled(t.disableLogging?"disabled":"browser-only")),null!=t.disableStorage&&(this.O.disableStorage=t.disableStorage,v.Storage.Me(t.disableStorage)),null!=t.enableCookies&&(this.O.enableCookies=t.enableCookies,d.StableID.Ie(this.j,t.enableCookies)),t.logEventCompressionMode?this.Re.setLogEventCompressionMode(t.logEventCompressionMode):t.disableCompression&&this.Re.setLogEventCompressionMode(s.LogEventCompressionMode.Disabled)}flush(){return this.Re.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this.Ae("Uninitialized",null),this.xe=null,yield this.Re.stop()})}on(t,e){this.Te[t]||(this.Te[t]=[]),this.Te[t].push(e)}off(t,e){this.Te[t]&&-1!==(e=this.Te[t].indexOf(e))&&this.Te[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.te.logError("__emit:"+n.name,t):a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Te[n.name]&&this.Te[n.name].forEach(t=>e(t)),null!=(t=this.Te["*"])&&t.forEach(e)}Ae(t,e){this.loadingStatus=t,this.Ce={},this.$emt({name:"values_updated",status:t,values:e})}Fe(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Re.incrementNonExposureCount(t):this.Re.enqueue(e)}Pe(i,s){return(t,e)=>{var n;return!this.O.disableEvaluationMemoization&&(n=(0,r.createMemoKey)(i,t,e))?(n in this.Ce||(3e3<=Object.keys(this.Ce).length&&(this.Ce={}),this.Ce[n]=s(t,e)),this.Ce[n]):s(t,e)}}}},2636:(t,e)=>{$Q(e),e.ErrorTag=void 0,e.ErrorTag={NetworkError:"NetworkError"}},3206:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1637:(t,e)=>{$Q(e),e.Le=e.ze=e.qe=e.Ke=e.Ut=void 0;const r="statsig::config_exposure",l="statsig::gate_exposure",a="statsig::layer_exposure",c=(t,e,n,i,s)=>(n.bootstrapMetadata&&(i.bootstrapMetadata=n.bootstrapMetadata),{eventName:t,user:e,value:null,metadata:u(n,i),secondaryExposures:s,time:Date.now()});e.Ut=({eventName:t})=>t===l||t===r||t===a;function h(t,e){return t.map(t=>"string"==typeof t?(null!=e?e:{})[t]:t).filter(t=>null!=t)}e.Ke=(t,e,n)=>{var i,s={gate:e.name,gateValue:String(e.value),ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(s.configVersion=e.__evaluation.version),c(l,t,e.details,s,h(null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[],n))},e.qe=h;e.ze=(t,e,n)=>{var i,s={config:e.name,ruleID:e.ruleID};return null!=(null==(i=e.__evaluation)?void 0:i.version)&&(s.configVersion=e.__evaluation.version),null!=(null==(i=e.__evaluation)?void 0:i.passed)&&(s.rulePassed=String(e.__evaluation.passed)),c(r,t,e.details,s,h(null!=(t=null==(i=e.__evaluation)?void 0:i.secondary_exposures)?t:[],n))};e.Le=(t,e,n,i)=>{var s=e.__evaluation,r=!0===(null==(r=null==s?void 0:s.explicit_parameters)?void 0:r.includes(n));let l="",u=null!=(o=null==s?void 0:s.undelegated_secondary_exposures)?o:[];r&&(l=null!=(o=s.allocated_experiment_name)?o:"",u=null!=(o=s.secondary_exposures)?o:[]);var o=null==(s=e.__evaluation)?void 0:s.parameter_rule_ids,o={config:e.name,parameterName:n,ruleID:null!=(s=null==o?void 0:o[n])?s:e.ruleID,allocatedExperiment:l,isExplicitParameter:String(r)};return null!=(null==(n=e.__evaluation)?void 0:n.version)&&(o.configVersion=e.__evaluation.version),c(a,t,e.details,o,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.30.2-beta.2";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),e.LoggingEnabledOption=e.LogEventCompressionMode=void 0,e.LogEventCompressionMode={Disabled:"d",Enabled:"e",Forced:"f"},e.LoggingEnabledOption={disabled:"disabled",browserOnly:"browser-only",always:"always"}},1098:(t,e)=>{$Q(e)},2059:(t,e,n)=>{$Q(e),e.Be=e.$e=e.Ve=e.Ge=e.Je=e.We=void 0;const l=n(7512),u=n(6634);function s(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:"",__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)),{idType:null!=(e=null==n?void 0:n.id_type)?e:null,get:r(t,null==n?void 0:n.value)})}function r(i,s,r){return(t,e)=>{var n=null!=(n=null==s?void 0:s[t])?n:null;return null==n?null!=e?e:null:null==e||(0,u.Ye)(n,e)?(null!=r&&r(t),n):(l.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.We=function(t,e,n){return $P($P({},s(t,e,n,!0===(null==n?void 0:n.value))),{idType:null!=(t=null==n?void 0:n.id_type)?t:null})},e.Je=i,e.Ge=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.Ve=function(t,e,n,i){return $P($P({},s(t,e,n,void 0)),{get:r(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.$e=function(t,e,n,i){return $P($P($P({},t),e),{get:r(t.name,n,i)})},e.Be=r},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,s,r)=>({duration:n,source:e,success:t,error:i,sourceUrl:s,warnings:r}),e.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}},8578:(t,e,n)=>{$Q(e),e._=e.D=void 0;const i=n(1406),s=n(7512);e.D=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 s.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},e._=function(t){return t?(0,i.$t)(t):null}},4534:(t,n,e)=>{$Q2(n,"__esModule",{value:!0}),n.B=n.K=n.Storage=void 0;const i=e(7512);e=e(6830);const s={},r={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:t=>s[t]||null,setItem:(t,e)=>{s[t]=e},removeItem:t=>{delete s[t]},getAllKeys:()=>Object.keys(s)};let l=null;try{const c=(0,e.ve)();c&&c.localStorage&&"function"==typeof c.localStorage.getItem&&(l={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>c.localStorage.getItem(t),setItem:(t,e)=>c.localStorage.setItem(t,e),removeItem:t=>c.localStorage.removeItem(t),getAllKeys:()=>Object.keys(c.localStorage)})}catch(t){i.Log.warn("Failed to setup localStorageProvider.")}let u=null!==l&&void 0!==l?l:r,o=u;function a(t){try{return t()}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return n.Storage.Ne(r),null;throw t}}n.Storage={isReady:()=>o.isReady(),isReadyResolver:()=>o.isReadyResolver(),getProviderName:()=>o.getProviderName(),getItem:t=>a(()=>o.getItem(t)),setItem:(t,e)=>a(()=>o.setItem(t,e)),removeItem:t=>o.removeItem(t),getAllKeys:()=>o.getAllKeys(),Ne:t=>{u=t,o=t},Me:t=>{o=t?r:u}},n.K=function(e){var t=n.Storage.getItem(e);try{return JSON.parse(null!=t?t:"null")}catch(t){return i.Log.error(`Failed to parse value for key "${e}"`),null}},n.B=function(t,e){n.Storage.setItem(t,JSON.stringify(e))}},3401:(t,e,n)=>{$Q(e),e.P=void 0;const s=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 s.Log.error("Failed to parse "+n),null}},6634:(t,e)=>{$Q(e),e.Ye=e.Vt=void 0,e.Vt=function(t){return Array.isArray(t)?"array":typeof t},e.Ye=function(t,e){var n=t=>Array.isArray(t)?"array":null===t?"null":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 i=n(1406),s=n(7410),r={[s.Endpoint.Qt]:"i",[s.Endpoint.kt]:"e",[s.Endpoint.Zt]:"d"};e.UrlConfiguration=class{constructor(t,e,n,i){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=r[t],e&&(this.customUrl=e),!e&&n&&(this.customUrl=n.endsWith("/")?""+n+t:n+"/"+t),i&&(this.fallbackUrls=i);e=s.NetworkDefault[t];this.defaultUrl=e+"/"+t}getUrl(){var t;return null!=(t=this.customUrl)?t:this.defaultUrl}getChecksum(){var t=(null!=(t=this.fallbackUrls)?t:[]).sort().join(",");return(0,i.h)(this.customUrl+t)}}},2397:(t,e,n)=>{$Q(e),e.Xe=e.xt=e.Ft=e.He=void 0;n=n(6830);const i="foreground",s="background",r=[];let l=i,u=!1;e.He=()=>l===i,e.Ft=()=>u,e.xt=t=>{r.unshift(t)};e.Xe=e=>{e!==l&&(l=e,r.forEach(t=>t(e)))},(0,n.ke)("focus",()=>{(u=!1,e.Xe)(i)}),(0,n.ke)("blur",()=>(0,e.Xe)(s)),(0,n.we)("visibilitychange",()=>{(0,e.Xe)("visible"===document.visibilityState?i:s)}),(0,n.ke)((0,n.Se)(),()=>{u=!0,(0,e.Xe)(s)})},6914:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)},r=($Q(e),e.Storage=e.Log=e.EventLogger=e.Diagnostics=void 0,n(1845),n(1845));const l=n(8962),u=($Q2(e,"Diagnostics",{enumerable:!0,get:function(){return l.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 a=n(8e3);const c=n(4534);$Q2(e,"Storage",{enumerable:!0,get:function(){return c.Storage}}),s(n(1845),e),s(n(2137),e),s(n(6427),e),s(n(694),e),s(n(8962),e),s(n(3539),e),s(n(5542),e),s(n(2922),e),s(n(2417),e),s(n(1406),e),s(n(1333),e),s(n(7512),e),s(n(7787),e),s(n(7410),e),s(n(7023),e),s(n(1405),e),s(n(1361),e),s(n(6830),e),s(n(5902),e),s(n(4143),e),s(n(2176),e),s(n(9122),e),s(n(1375),e),s(n(2636),e),s(n(3206),e),s(n(1637),e),s(n(8e3),e),s(n(586),e),s(n(1098),e),s(n(2059),e),s(n(1812),e),s(n(8578),e),s(n(4534),e),s(n(3401),e),s(n(6634),e),s(n(1881),e),s(n(8023),e),s(n(2397),e),s(n(3932),e),s(n(3091),e),$P((0,r.l)(),{Log:o.Log,SDK_VERSION:a.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 s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},r=($Q(e),r(n(600)));s(n(600),e),e.default=r.default},1241:(t,e,n)=>{$Q(e),e.GCIRFormatter=void 0;const h=n(6914),d=n(3260);e.GCIRFormatter=class{constructor(t,e,n){this.en=t,this.Oi=e,this.O=n}getClientInitializeResponse(t,e){var t=(0,h.D)(t,this.O,this.Oi.getDefaultEnvironment()),n=null!=(n=null==e?void 0:e.hash)?n:"djb2";let i=null,s=null;var r=null==e?void 0:e.clientSDKKey,l=null!=(l=null==(l=this.Oi.getValues())?void 0:l.sdk_keys_to_app_ids)?l:{},u=null!=(u=null==(u=this.Oi.getValues())?void 0:u.hashed_sdk_keys_to_app_ids)?u:{},o=null!=(o=null==(o=this.Oi.getValues())?void 0:o.hashed_sdk_keys_to_entities)?o:{},a=(r&&(a=(0,d.hashString)(r,"djb2"),i=null!=(u=u[a])?u:null,s=null!=(u=o[a])?u:null,null==i)&&(i=null!=(o=l[r])?o:null),this.bn(t,e,i,s,n)),u=this.yn(t,e,i,s,n),l=this.mn(t,e,i,n),r={};t.userID&&(r.userID=t.userID),t.customIDs&&0<Object.keys(t.customIDs).length&&(r.customIDs=t.customIDs);let c=void 0;t.privateAttributes&&0<Object.keys(t.privateAttributes).length&&(c=(0,d.hashPrivateAttributes)(t.privateAttributes));o=$P({},t),delete o.privateAttributes,this.jn(o),e=this.On(i,n),t={feature_gates:a,dynamic_configs:u,layer_configs:l,param_stores:e,sdkParams:{},has_updates:!0,generator:"js-on-device-eval-client",sdkInfo:{sdkType:"js-on-device-eval-client",sdkVersion:"1.0.0"},time:this.Oi.getLastUpdateTime(),evaluated_keys:r,hash_used:n,user:o};return e&&0<Object.keys(e).length&&(t.param_stores=e),void 0!==c&&(t.pa_hash=c),t}bn(t,e,n,i,s){var r,l,u={};for(const o of this.Oi.getAllSpecs("gate"))"segment"===o.entity||"holdout"===o.entity||null!=i&&!i.gates.includes(o.name)||null!=n&&!(null!=(r=o.targetAppIDs)?r:[]).includes(n)||(r=this.wn(o,t),u[(l=this.Sn(o.name,r,o,null!=s?s:"djb2")).name]=l);return u}yn(t,e,n,i,s){var r={};for(const c of this.Oi.getAllSpecs("config"))if((null==i||i.configs.includes(c.name))&&(null==n||(null!=(o=c.targetAppIDs)?o:[]).includes(n))){var l,u,o=this.wn(c,t),a=this.Sn(c.name,o,c,null!=s?s:"djb2");if("dynamic_config"===c.entity&&(a.passed=o.bool_value),"dynamic_config"!==c.entity&&"autotune"!==c.entity&&(a.is_user_in_experiment=o.is_experiment_group,a.is_experiment_active=!0===c.isActive,c.hasSharedParams)){a.is_in_layer=!0,a.explicit_parameters=c.explicitParameters||[];const h=this.kn(c.name);h&&(l=this.Oi.getAllSpecs("layer").find(t=>t.name===h))&&(l=l.defaultValue||{},u=a.value||{},a.value=$P($P({},l),u))}r[a.name]=a}return r}mn(t,e,n,i){var s={};for(const o of this.Oi.getAllSpecs("layer"))if(null==n||(null!=(u=o.targetAppIDs)?u:[]).includes(n)){const a=this.wn(o,t);var r,l,u=this.Sn(o.name,a,o,null!=i?i:"djb2");u.explicit_parameters=null!=(r=o.explicitParameters)?r:[],a.allocated_experiment_name?(r=this.Oi.getAllSpecs("config").find(t=>t.name===a.allocated_experiment_name))&&((l=this.wn(r,t)).group_name&&(u.group_name=l.group_name),u.allocated_experiment_name=(0,d.hashString)(a.allocated_experiment_name,null!=i?i:"djb2"),u.is_experiment_active=!0===r.isActive,u.is_user_in_experiment=l.is_experiment_group,u.explicit_parameters=r.explicitParameters||[],l.undelegated_secondary_exposures)&&(u.undelegated_secondary_exposures=this.xn(l.undelegated_secondary_exposures,null!=i?i:"djb2")):u.undelegated_secondary_exposures=this.xn(a.undelegated_secondary_exposures||[],null!=i?i:"djb2"),s[u.name]=u}return s}Sn(t,e,n,i){var s="feature_gate"===n.entity?e.bool_value:!e.unsupported&&e.json_value||{},t={name:(0,d.hashString)(t,i),value:s,rule_id:e.rule_id||"default",secondary_exposures:this.xn(e.secondary_exposures||[],i),id_type:null==n?void 0:n.idType};return e.group_name&&(t.group_name=e.group_name),"feature_gate"!==n.entity&&(t.group=e.group_name||"",t.is_device_based=!1,"dynamic_config"!==n.entity&&"autotune"!==n.entity&&"layer"!==n.entity&&(t.is_experiment_active=n.isActive,t.is_user_in_experiment=e.is_experiment_group),t.passed=e.bool_value),t}wn(t,e){return this.en.evaluateSpec(t,e)}On(t,e){var n=null==(n=this.Oi.getValues())?void 0:n.param_stores;if(n){var i,s,r={};for([i,s]of Object.entries(n))if(!t||s.targetAppIDs&&s.targetAppIDs.includes(t)){var l,u,o={};for([l,u]of Object.entries(s.parameters||{})){var a=$P({},u);a.gate_name&&(a.gate_name=(0,d.hashString)(a.gate_name,e)),a.config_name&&(a.config_name=(0,d.hashString)(a.config_name,e)),a.layer_name&&(a.layer_name=(0,d.hashString)(a.layer_name,e)),a.experiment_name&&(a.experiment_name=(0,d.hashString)(a.experiment_name,e)),o[l]=a}r[(0,d.hashString)(i,e)]=o}return 0<Object.keys(r).length?r:void 0}}xn(t,e){return"none"===e?t:t.map(t=>$P($P({},t),{gate:(0,d.hashString)(t.gate,e)}))}jn(t){for(const e in t)void 0===t[e]?delete t[e]:"object"!=typeof t[e]||null===t[e]||Array.isArray(t[e])||this.jn(t[e])}kn(t){var e=this.Oi.getValues();if(null!=e&&e.layers)for(var[n,i]of Object.entries(e.layers))if(i.includes(t))return n;return null}}},3260:(t,e,n)=>{$Q(e),e.hashPrivateAttributes=e.hashString=void 0;const s=n(6914),i=n(5680),r=n(5680);e.hashString=(t,e)=>{return"none"===e?t:"djb2"===e?(0,s.h)(t):"sha256"===e?(e=(0,i.SHA256)(t).arrayBuffer(),r.Base64.encodeArrayBuffer(e)):t};e.hashPrivateAttributes=t=>{let e=0;for(const i in t){var n;Object.prototype.hasOwnProperty.call(t,i)&&(n=t[i],n=i+":"+(null==n?"":String(n)),n=parseInt((0,s.h)(n),10),e=e+n&4294967295)}return e.toString()}},8494:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e);const s=n(6914);class r extends s.NetworkCore{constructor(t=null){super(t);t=null==t?void 0:t.networkConfig;this.tn=new s.UrlConfiguration(s.Endpoint.Zt,null==t?void 0:t.downloadConfigSpecsUrl,null==t?void 0:t.api,null==t?void 0:t.downloadConfigSpecsFallbackUrls)}fetchConfigSpecs(e,n){return i(this,void 0,void 0,function*(){var t=yield this.get({sdkKey:e,urlConfig:this.tn,priority:n});return null!=(t=null==t?void 0:t.body)?t:null})}}e.default=r},6217:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e);const u=n(6914),s=n(3066),r=n(1241),l=n(8494),o=n(2660);class a extends u.StatsigClientBase{static instance(t){var e=(0,u.l)().instance(t);return e instanceof a?e:(u.Log.warn((0,u.Mt)()?"StatsigOnDeviceEvalClient.instance is not supported in server environments":"Unable to find StatsigOnDeviceEvalClient instance"),new a(null!=t?t:""))}constructor(t,e=null){u.SDKType.Oe(t,"js-on-device-eval-client");var n=new l.default(e);super(t,null!=(t=null==e?void 0:e.dataAdapter)?t:new o.StatsigSpecsDataAdapter,n,e),this.ft=n,this.Oi=new s.SpecStore,this.en=new s.Evaluator(this.Oi),this.wi=(0,u.getUUID)(),this.En=new r.GCIRFormatter(this.en,this.Oi,this.O)}initializeSync(t){return"Uninitialized"!==this.loadingStatus?{success:!0,duration:0,source:this.Oi.getSource(),sourceUrl:null,error:null}:(this.Re.start(),this.updateSync(t))}initializeAsync(t){return i(this,void 0,void 0,function*(){return this.xe||(this.xe=this.ki(t)),this.xe})}updateSync(t){var e=performance.now(),n=(this.Oi.reset(),this.dataAdapter.getDataSync());return this.Oi.setValuesFromDataAdapter(n),this.Oi.finalize(),this.Ae("Ready",n),null!=t&&t.disableBackgroundCacheRefresh||this.xi(n),(0,u.createUpdateDetails)(!0,this.Oi.getSource(),performance.now()-e,this.te.getLastSeenErrorAndReset(),this.ft.getLastUsedInitUrlAndReset())}updateAsync(n){return i(this,void 0,void 0,function*(){var t=performance.now(),e=(this.Oi.reset(),this.Ae("Loading",null),this.dataAdapter.getDataSync());return this.Oi.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,n),this.Oi.setValuesFromDataAdapter(e),this.Oi.finalize(),this.Ae("Ready",e),(0,u.createUpdateDetails)(!0,this.Oi.getSource(),performance.now()-t,this.te.getLastSeenErrorAndReset(),this.ft.getLastUsedInitUrlAndReset())})}getContext(){return{sdkKey:this.j,options:this.O,values:this.Oi.getValues(),errorBoundary:this.te,session:u.StatsigSession.get(this.j),stableID:u.StableID.get(this.j),sdkInstanceID:this.wi}}checkGate(t,e,n){return this.getFeatureGate(t,e,n).value}getFeatureGate(t,e,n){var e=this.D(e),{evaluation:i,details:s}=this.en.evaluateGate(t,e),s=(0,u.We)(t,s,i),r=null==(r=null==(i=this.overrideAdapter)?void 0:i.getGateOverride)?void 0:r.call(i,s,e,n),i=null!=r?r:s;return this.Fe(t,(0,u.Ke)(e,i),n),this.$emt({name:"gate_evaluation",gate:s}),i}getDynamicConfig(t,e,n){var e=this.D(e),{evaluation:i,details:s}=this.en.evaluateConfig(t,e),s=(0,u.Je)(t,s,i),r=null==(r=null==(i=this.overrideAdapter)?void 0:i.getDynamicConfigOverride)?void 0:r.call(i,s,e,n),i=null!=r?r:s;return this.Fe(t,(0,u.ze)(e,i),n),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:i}),i}getExperiment(t,e,n){var e=this.D(e),{evaluation:i,details:s}=this.en.evaluateConfig(t,e),s=(0,u.Ge)(t,s,i),r=null==(r=null==(i=this.overrideAdapter)?void 0:i.getExperimentOverride)?void 0:r.call(i,s,e,n),i=null!=r?r:s;return this.Fe(t,(0,u.ze)(e,i),n),this.$emt({name:"experiment_evaluation",experiment:i}),i}getLayer(e,t,n){const i=this.D(t);var{evaluation:t,details:s}=this.en.evaluateLayer(e,i),s=(0,u.Ve)(e,s,t),r=null==(r=null==(t=this.overrideAdapter)?void 0:t.getLayerOverride)?void 0:r.call(t,s,i,n);const l=null!=r?r:s;return l.get=(0,u.Be)(l.name,l.__value,t=>{this.Fe(e,(0,u.Le)(i,l,t),n)}),this.$emt({name:"layer_evaluation",layer:l}),l}logEvent(t,e,n,i){this.Re.enqueue($P($P({},"string"==typeof t?{eventName:t,value:n,metadata:i}:t),{user:this.D(e),time:Date.now()}))}Ue(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this.Mi(null)})}ki(t){return i(this,void 0,void 0,function*(){return u.Storage.isReady()||(yield u.Storage.isReadyResolver()),this.Re.start(),this.updateAsync(t)})}Mi(t){this.Oi.finalize(),this.Ae("Ready",t)}D(t){return(0,u.D)(t,this.O,this.Oi.getDefaultEnvironment())}xi(t){this.dataAdapter.getDataAsync(t,{priority:"low"}).catch(t=>{u.Log.error("An error occurred after update.",t)})}getClientInitializeResponse(t,e){return"Ready"!==this.loadingStatus?null:this.En.getClientInitializeResponse(t,e)}}e.default=a},2660:function(t,e,n){var i=this&&this.__awaiter||$A();$Q(e),e.StatsigSpecsDataAdapter=void 0;const s=n(6914),r=n(8494);class l extends s.DataAdapterCore{constructor(){super("SpecsDataAdapter","specs"),this.ft=null}attach(t,e,n){super.attach(t,e,n),null!==n&&n instanceof r.default?this.ft=n:this.ft=new r.default(null!=e?e:{})}getDataAsync(t,e){return this.C(t,void 0,e)}prefetchData(t){return this.U(void 0,t)}F(t,e,n){return i(this,void 0,void 0,function*(){var t;return null!=(t=yield null==(t=this.ft)?void 0:t.fetchConfigSpecs(this.N(),null==n?void 0:n.priority))?t:null})}I(){var t=(0,s.o)(this.N());return`${s.DataAdapterCachePrefix}.${this.m}.`+t}A(t,e){return 0<t.data.length}}e.StatsigSpecsDataAdapter=l},600:(t,e,n)=>{$Q(e),e.StatsigSpecsDataAdapter=e.StatsigOnDeviceEvalClient=void 0;var i=n(6914),s=n(6217);e.StatsigOnDeviceEvalClient=s.default;const r=n(2660);$Q2(e,"StatsigSpecsDataAdapter",{enumerable:!0,get:function(){return r.StatsigSpecsDataAdapter}});n=$P((0,i.l)(),{StatsigSpecsDataAdapter:r.StatsigSpecsDataAdapter,StatsigOnDeviceEvalClient:s.default});e.default=n},6535:(t,e)=>{function u(t){return t.setUTCHours(0,0,0,0),t.getTime()}function o(t){var e=Number(t);return isNaN(e)?(t=new Date(String(t)),isNaN(t.getTime())?null:t):e<1e10?new Date(1e3*e):new Date(e)}$Q(e),e.default={compareNumbers(t,e,n){if(null==t||null==e)return!1;var i=Number(t),s=Number(e);if(isNaN(i)||isNaN(s))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},s=((t,e)=>{var n=t.split(".").map(t=>parseInt(t)),i=e.split(".").map(t=>parseInt(t));let s=0;for(;s<Math.max(n.length,i.length);){var r=s<n.length?n[s]:0,l=s<i.length?i[s]:0;if(r<l)return-1;if(l<r)return 1;s++}return 0})(i(t),i(e));switch(n){case"version_gt":return 0<s;case"version_gte":return 0<=s;case"version_lt":return s<0;case"version_lte":return s<=0;case"version_eq":return 0===s;case"version_neq":return 0!==s;default:return!1}},compareStringInArray(s,t,r){if(!Array.isArray(t))return!1;const l="any_case_sensitive"!==r&&"none_case_sensitive"!==r;var e=-1!==t.findIndex(t=>{var e=String(s),t=String(t),n=l?e.toLowerCase():e,i=l?t.toLowerCase():t;switch(r){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(r){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(t,e,n){if(null==t||null==e)return!1;try{var i=o(t),s=o(e);if(null===i||null===s)return!1;var r=i.getTime(),l=s.getTime();switch(n){case"before":return r<l;case"after":return l<r;case"on":return u(i)===u(s);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 c(t){return null!=t&&"object"==typeof t}e.Evaluator=class{constructor(t){this.Oi=t}evaluateGate(t,e){var{spec:t,details:n}=this.nn("gate",t);return t?(e=this.evaluateSpec(t,e),t=(0,d.resultToGateEval)(t,e),this.sn(e,n),{evaluation:t,details:n}):{evaluation:null,details:n}}evaluateConfig(t,e){var{spec:t,details:n}=this.nn("config",t);return t?(e=this.evaluateSpec(t,e),t=(0,d.resultToConfigEval)(t,e),this.sn(e,n),{evaluation:t,details:n}):{evaluation:null,details:n}}evaluateLayer(t,e){var n,{spec:t,details:i}=this.nn("layer",t);return t?(n=null!=(n=null==(e=this.evaluateSpec(t,e))?void 0:e.allocated_experiment_name)?n:"",n=this.Oi.getSpecAndSourceInfo("config",n).spec,t=(0,d.resultToLayerEval)(t,n,e),this.sn(e,i),{evaluation:t,details:i}):{evaluation:null,details:i}}sn(t,e){t.unsupported&&(e.reason="Unsupported")}getParamStoreConfig(t){var t=this.Oi.getParamStoreAndSourceInfo(t),e=this.ln(t);return{config:null!=(t=t.paramStoreConfig)?t:null,details:e}}evaluateSpec(t,e){var n=c(t.defaultValue)?t.defaultValue:void 0;if(!t.enabled)return(0,d.makeEvalResult)({json_value:n,rule_id:"disabled"});var i=[],s={};for(const o of t.rules){var r,l=this.un(o,e);if(l.unsupported)return l;for(const a of l.secondary_exposures){var u=`${a.gate}|${a.gateValue}|`+a.ruleID;s[u]||(s[u]=!0,i.push(a))}if(l.bool_value)return this.an(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:l.rule_id,bool_value:r,json_value:r?l.json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,is_experiment_group:l.is_experiment_group,group_name:l.group_name}))}return(0,d.makeEvalResult)({json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,rule_id:"default"})}nn(t,e){t=this.Oi.getSpecAndSourceInfo(t,e);return{details:this.ln(t),spec:t.spec}}ln(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}}un(t,e){var n=[];let i=!0;for(const r of t.conditions){var s=this.cn(r,e);if(s.unsupported)return s;n.push(...s.secondary_exposures),s.bool_value||(i=!1)}return(0,d.makeEvalResult)({rule_id:t.id,bool_value:i,json_value:c(t.returnValue)?t.returnValue:void 0,secondary_exposures:n,is_experiment_group:!0===t.isExperimentGroup,group_name:t.groupName})}cn(t,e){let n=null,i=!1;var s=t.field,r=t.targetValue,l=t.idType,u=t.type;switch(u){case"public":return(0,d.makeEvalResult)({bool_value:!0});case"pass_gate":case"fail_gate":var o=String(r),o=this.hn(o,e);return(0,d.makeEvalResult)({bool_value:"fail_gate"===u?!o.bool_value:o.bool_value,secondary_exposures:o.secondary_exposures});case"multi_pass_gate":case"multi_fail_gate":return this.dn(r,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,s);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,s);break;case"current_time":n=Date.now();break;case"user_bucket":o=f(String(null!=(o=null==(o=t.additionalValues)?void 0:o.salt)?o:"")+"."+(null!=(o=v(e,l))?o:""));n=Number(o%BigInt(1e3));break;case"unit_id":n=v(e,l);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,r,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,r,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,r,c);break;case"str_matches":i=h.default.compareStringWithRegEx(n,r);break;case"before":case"after":case"on":i=h.default.compareTime(n,r,c);break;case"eq":i=n==r;break;case"neq":i=n!=r;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(r)?i=!!Array.isArray(n)&&(a=h.default.arrayHasValue(n,r),"array_contains_any"===c?a:!a):i=!1;break;case"array_contains_all":case"not_array_contains_all":Array.isArray(r)?i=!!Array.isArray(n)&&(a=h.default.arrayHasAllValues(n,r),"array_contains_all"===c?a:!a):i=!1}return(0,d.makeEvalResult)({bool_value:i})}an(t,e,n){if(!t)return null;var i=this.Oi.getSpecAndSourceInfo("config",t)["spec"];if(!i)return null;var e=this.evaluateSpec(i,e),s={},r=[];for(const u of n.concat(e.secondary_exposures)){var l=`${u.gate}|${u.gateValue}|`+u.ruleID;s[l]||(s[l]=!0,r.push(u))}return(0,d.makeEvalResult)($P($P({},e),{allocated_experiment_name:t,explicit_parameters:i.explicitParameters,secondary_exposures:r,undelegated_secondary_exposures:n}))}hn(t,e){var n=[];let i=!1;var s=this.Oi.getSpecAndSourceInfo("gate",t)["spec"];if(s){s=this.evaluateSpec(s,e);if(s.unsupported)return s;i=s.bool_value,n.push(...s.secondary_exposures),t.startsWith("segment:")||n.push({gate:t,gateValue:String(i),ruleID:s.rule_id})}return(0,d.makeEvalResult)({bool_value:i,secondary_exposures:n})}dn(t,e,n){if(!Array.isArray(t))return(0,d.makeEvalResult)({unsupported:!0});var i="multi_pass_gate"===e,s=[];let r=!1;for(const u of t){if("string"!=typeof u)return(0,d.makeEvalResult)({unsupported:!0});var l=this.hn(u,n);if(l.unsupported)return l;if(s.push(...l.secondary_exposures),i?!0===l.bool_value:!1===l.bool_value){r=!0;break}}return(0,d.makeEvalResult)({bool_value:r,secondary_exposures:s})}}},8313:(t,e,n)=>{$Q(e),e.SpecStore=void 0;const i=n(6914);function s(t){return(0,i.P)(t,"has_updates","DownloadConfigSpecsResponse")}e.SpecStore=class{constructor(){this.Ze=null,this.ti=null,this.ei="Uninitialized",this.ii=0,this.ni=0,this.vn=null}getValues(){return this.Ze?s(this.Ze):null}getSource(){return this.ei}getDefaultEnvironment(){return this.vn}setValuesFromDataAdapter(t){var e,n;!t||!0!==(null==(n=s(t.data))?void 0:n.has_updates)||(null!=(e=n.time)?e:0)<this.ii||(this.ii=n.time,this.ni=t.receivedAt,this.ei=t.source,this.ti=n,this.Ze=t.data,this.vn=null!=(e=n.default_environment)?e:null)}reset(){this.ti=null,this.Ze=null,this.ei="Loading"}finalize(){this.ti||(this.ei="NoValues")}getSpecAndSourceInfo(t,e){var t=this.fn(t);return{spec:null!=(t=null==t?void 0:t.find(t=>t.name===e))?t:null,source:this.ei,lcut:this.ii,receivedAt:this.ni}}getParamStoreAndSourceInfo(t){var e=null==(e=this.ti)?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.ei,lcut:this.ii,receivedAt:this.ni}}fn(t){var e;switch(t){case"gate":return null==(e=this.ti)?void 0:e.feature_gates;case"config":return null==(e=this.ti)?void 0:e.dynamic_configs;case"layer":return null==(e=this.ti)?void 0:e.layer_configs}}getAllSpecs(t){return this.fn(t)||[]}getLastUpdateTime(){return this.ii}}},3066:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),$Q2(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),s(n(5007),e),s(n(5079),e),s(n(8313),e)},725:(t,e)=>{$Q(e),e.Base64=void 0;const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.Base64=class{static encodeArrayBuffer(t){let e="";var n=new Uint8Array(t),i=n.byteLength;for(let t=0;t<i;t++)e+=String.fromCharCode(n[t]);return this.Dn(e)}static Dn(t){let e="";var n,i,s,r;let l,u,o=0;for(;o<t.length;)r=t.charCodeAt(o++),n=t.charCodeAt(o++),i=t.charCodeAt(o++),s=r>>2,r=(3&r)<<4|n>>4,l=(15&n)<<2|i>>6,u=63&i,isNaN(n)?l=u=64:isNaN(i)&&(u=64),e=e+a.charAt(s)+a.charAt(r)+a.charAt(l)+a.charAt(u);return e}}},5680:(t,e,n)=>{$Q(e),e.Base64=e.SHA256=void 0;const i=n(725),s=($Q2(e,"Base64",{enumerable:!0,get:function(){return i.Base64}}),n(7485));$Q2(e,"SHA256",{enumerable:!0,get:function(){return s.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],l=[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 s=n.length,r=this.blocks;t<s;){for(this.hashed&&(this.hashed=!1,r[0]=this.block,r[16]=r[1]=r[2]=r[3]=r[4]=r[5]=r[6]=r[7]=r[8]=r[9]=r[10]=r[11]=r[12]=r[13]=r[14]=r[15]=0),e=this.start;t<s&&e<64;++t)(i=n.charCodeAt(t))<128?r[e>>2]|=i<<l[3&e++]:(i<2048?r[e>>2]|=(192|i>>6)<<l[3&e++]:(i<55296||57344<=i?r[e>>2]|=(224|i>>12)<<l[3&e++]:(i=65536+((1023&i)<<10|1023&n.charCodeAt(++t)),r[e>>2]|=(240|i>>18)<<l[3&e++],r[e>>2]|=(128|i>>12&63)<<l[3&e++]),r[e>>2]|=(128|i>>6&63)<<l[3&e++]),r[e>>2]|=(128|63&i)<<l[3&e++]);this.lastByteIndex=e,this.bytes+=e-this.start,64<=e?(this.block=r[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,s=this.h3,r=this.h4,l=this.h5,u=this.h6,o=this.h7,a,c,h,d,v,f,_,g,p,b,y;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(y=n&i,a=0;a<64;a+=4)this.first?(g=704751109,v=t[0]-210244248,o=v-1521486534<<0,s=v+143694565<<0,this.first=!1):(c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),h=(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7),g=e&n,d=g^e&i^y,_=r&l^~r&u,v=o+h+_+m[a]+t[a],f=c+d,o=s+v<<0,s=v+f<<0),c=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),h=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),p=s&e,d=p^s&n^g,_=o&r^~o&l,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),b=i&s,d=b^i&e^p,_=u&o^~u&r,v=l+h+_+m[a+2]+t[a+2],f=c+d,l=n+v<<0,n=v+f<<0,c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),h=(l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7),y=n&i,d=y^n&s^b,_=l&u^~l&o,v=r+h+_+m[a+3]+t[a+3],f=c+d,r=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+s<<0,this.h4=this.h4+r<<0,this.h5=this.h5+l<<0,this.h6=this.h6+u<<0,this.h7=this.h7+o<<0}arrayBuffer(){return this._n().buffer}dataView(){return this._n().dataView}_n(){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 s(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,s)),e.exports}return s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s(9638).default})());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsig/js-on-device-eval-client",
|
|
3
|
-
"version": "3.30.2-beta.
|
|
3
|
+
"version": "3.30.2-beta.2",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"homepage": "https://github.com/statsig-io/js-client-monorepo",
|
|
6
6
|
"repository": {
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
"directory": "packages/js-on-device-eval-client"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@statsig/client-core": "3.30.2-beta.
|
|
13
|
-
"@statsig/on-device-eval-core": "3.30.2-beta.
|
|
14
|
-
"@statsig/sha256": "3.30.2-beta.
|
|
12
|
+
"@statsig/client-core": "3.30.2-beta.2",
|
|
13
|
+
"@statsig/on-device-eval-core": "3.30.2-beta.2",
|
|
14
|
+
"@statsig/sha256": "3.30.2-beta.2"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@statsig/js-local-overrides": "3.30.2-beta.
|
|
17
|
+
"@statsig/js-local-overrides": "3.30.2-beta.2"
|
|
18
18
|
},
|
|
19
19
|
"jsdelivr": "./build/statsig-js-on-device-eval-client.min.js",
|
|
20
20
|
"type": "commonjs",
|