@statsig/sidecar 3.30.0 → 3.30.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.
- package/package.json +4 -4
- package/sidecar.min.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsig/sidecar",
|
|
3
|
-
"version": "3.30.
|
|
3
|
+
"version": "3.30.2",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"homepage": "https://github.com/statsig-io/js-client-monorepo",
|
|
6
6
|
"repository": {
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"webpack-cli": "^5.1.4"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@statsig/js-client": "3.30.
|
|
23
|
-
"@statsig/js-local-overrides": "3.30.
|
|
24
|
-
"@statsig/web-analytics": "3.30.
|
|
22
|
+
"@statsig/js-client": "3.30.2",
|
|
23
|
+
"@statsig/js-local-overrides": "3.30.2",
|
|
24
|
+
"@statsig/web-analytics": "3.30.2"
|
|
25
25
|
},
|
|
26
26
|
"jsdelivr": "./sidecar.min.js",
|
|
27
27
|
"type": "commonjs",
|
package/sidecar.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.StatsigSidecar=t():e.StatsigSidecar=t()}(this,(()=>(()=>{"use strict";var e={5050:(e,t,n)=>{var i,r,s;Object.defineProperty(t,"__esModule",{value:!0}),t._getInstance=t._getStatsigGlobalFlag=t._getStatsigGlobal=void 0;const o=n(7243);t._getStatsigGlobal=()=>{try{return"undefined"!=typeof __STATSIG__?__STATSIG__:d}catch(e){return d}},t._getStatsigGlobalFlag=e=>(0,t._getStatsigGlobal)()[e],t._getInstance=e=>{const n=(0,t._getStatsigGlobal)();return e?n.instances&&n.instances[e]:(n.instances&&Object.keys(n.instances).length>1&&o.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."),n.firstInstance)};const a="__STATSIG__",l="undefined"!=typeof window?window:{},u=void 0!==n.g?n.g:{},c="undefined"!=typeof globalThis?globalThis:{},d=null!==(s=null!==(r=null!==(i=l[a])&&void 0!==i?i:u[a])&&void 0!==r?r:c[a])&&void 0!==s?s:{instance:t._getInstance};l[a]=d,u[a]=d,c[a]=d},6448:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getStorageKey=t._getUserStorageKey=void 0;const i=n(5585);function r(e,t,n){var r;if(n)return n(e,t);const s=t&&t.customIDs?t.customIDs:{},o=[`uid:${null!==(r=null==t?void 0:t.userID)&&void 0!==r?r:""}`,`cids:${Object.keys(s).sort(((e,t)=>e.localeCompare(t))).map((e=>`${e}-${s[e]}`)).join(",")}`,`k:${e}`];return(0,i._DJB2)(o.join("|"))}t._getUserStorageKey=r,t._getStorageKey=function(e,t,n){return t?r(e,t,n):(0,i._DJB2)(`k:${e}`)}},2082:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},977:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t._makeDataAdapterResult=t.DataAdapterCore=void 0;const r=n(7243),s=n(5683),o=n(8001),a=n(1285),l=n(8532);function u(e,t,n,i){return{source:e,data:t,receivedAt:Date.now(),stableID:n,fullUserHash:(0,o._getFullUserHash)(i)}}t.DataAdapterCore=class{constructor(e,t){this._adapterName=e,this._cacheSuffix=t,this._options=null,this._sdkKey=null,this._cacheLimit=10,this._lastModifiedStoreKey=`statsig.last_modified_time.${t}`,this._inMemoryCache=new c}attach(e,t,n){this._sdkKey=e,this._options=t}getDataSync(e){const t=e&&(0,o._normalizeUser)(e,this._options),n=this._getCacheKey(t),i=this._inMemoryCache.get(n,t);if(i&&this._getIsCacheValueValid(i))return i;const r=this._loadFromCache(n);return r&&this._getIsCacheValueValid(r)?(this._inMemoryCache.add(n,r,this._cacheLimit),this._inMemoryCache.get(n,t)):null}setData(e,t){const n=t&&(0,o._normalizeUser)(t,this._options),i=this._getCacheKey(n);this._inMemoryCache.add(i,u("Bootstrap",e,null,n),this._cacheLimit)}_getIsCacheValueValid(e){return null==e.stableID||e.stableID===s.StableID.get(this._getSdkKey())}_getDataAsyncImpl(e,t,n){return i(this,void 0,void 0,(function*(){a.Storage.isReady()||(yield a.Storage.isReadyResolver());const i=null!=e?e:this.getDataSync(t),s=[this._fetchAndPrepFromNetwork(i,t,n)];return(null==n?void 0:n.timeoutMs)&&s.push(new Promise((e=>setTimeout(e,n.timeoutMs))).then((()=>(r.Log.debug("Fetching latest value timed out"),null)))),yield Promise.race(s)}))}_prefetchDataImpl(e,t){return i(this,void 0,void 0,(function*(){const n=e&&(0,o._normalizeUser)(e,this._options),i=this._getCacheKey(n),r=yield this._getDataAsyncImpl(null,n,t);r&&this._inMemoryCache.add(i,Object.assign(Object.assign({},r),{source:"Prefetch"}),this._cacheLimit)}))}_fetchAndPrepFromNetwork(e,t,n){return i(this,void 0,void 0,(function*(){var i;const o=null!==(i=null==e?void 0:e.data)&&void 0!==i?i:null,a=null!=e&&this._isCachedResultValidFor204(e,t),c=yield this._fetchFromNetwork(o,t,n,a);if(!c)return r.Log.debug("No response returned for latest value"),null;const d=(0,l._typedJsonParse)(c,"has_updates","Response"),g=this._getSdkKey(),_=s.StableID.get(g);let h=null;if(!0===(null==d?void 0:d.has_updates))h=u("Network",c,_,t);else{if(!o||!1!==(null==d?void 0:d.has_updates))return null;h=u("NetworkNotModified",o,_,t)}const v=this._getCacheKey(t);return this._inMemoryCache.add(v,h,this._cacheLimit),this._writeToCache(v,h),h}))}_getSdkKey(){return null!=this._sdkKey?this._sdkKey:(r.Log.error(`${this._adapterName} is not attached to a Client`),"")}_loadFromCache(e){var t;const n=null===(t=a.Storage.getItem)||void 0===t?void 0:t.call(a.Storage,e);if(null==n)return null;const i=(0,l._typedJsonParse)(n,"source","Cached Result");return i?Object.assign(Object.assign({},i),{source:"Cache"}):null}_writeToCache(e,t){const n=JSON.stringify(t);for(let t=0;t<8;t++)try{a.Storage.setItem(e,n);break}catch(t){if(!(t instanceof Error)||!t.toString().includes("QuotaExceededError")&&!t.toString().includes("QUOTA_EXCEEDED_ERR")||this._cacheLimit<=1)throw t;this._cacheLimit=Math.ceil(this._cacheLimit/2),this._runLocalStorageCacheEviction(e,this._cacheLimit-1)}this._runLocalStorageCacheEviction(e)}_runLocalStorageCacheEviction(e,t=this._cacheLimit){var n;const i=null!==(n=(0,a._getObjectFromStorage)(this._lastModifiedStoreKey))&&void 0!==n?n:{};i[e]=Date.now();const r=d(i,t);for(const e of r)delete i[e],a.Storage.removeItem(e);(0,a._setObjectInStorage)(this._lastModifiedStoreKey,i)}},t._makeDataAdapterResult=u;class c{constructor(){this._data={}}get(e,t){var n;const i=this._data[e],s=null==i?void 0:i.stableID,o=null===(n=null==t?void 0:t.customIDs)||void 0===n?void 0:n.stableID;return o&&s&&o!==s?(r.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):i}add(e,t,n){const i=d(this._data,n-1);for(const e of i)delete this._data[e];this._data[e]=t}merge(e){this._data=Object.assign(Object.assign({},this._data),e)}}function d(e,t){const n=Object.keys(e);return n.length<=t?[]:0===t?n:n.sort(((t,n)=>{const i=e[t],r=e[n];return"object"==typeof i&&"object"==typeof r?i.receivedAt-r.receivedAt:i-r})).slice(0,n.length-t)}},4001:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Diagnostics=void 0;const n=new Map,i="start",r="end";function s(e,t,n,i){return Object.assign({key:n,action:t,step:i,timestamp:Date.now()},e)}function o(e,t){var i;const r=null!==(i=n.get(e))&&void 0!==i?i:[];r.push(t),n.set(e,r)}function a(e,t){if(t in e)return e[t]}t.Diagnostics={_getMarkers:e=>n.get(e),_markInitOverallStart:e=>{o(e,s({},i,"overall"))},_markInitOverallEnd:(e,t,n)=>{o(e,s({success:t,error:t?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},r,"overall"))},_markInitNetworkReqStart:(e,t)=>{o(e,s(t,i,"initialize","network_request"))},_markInitNetworkReqEnd:(e,t)=>{o(e,s(t,r,"initialize","network_request"))},_markInitProcessStart:e=>{o(e,s({},i,"initialize","process"))},_markInitProcessEnd:(e,t)=>{o(e,s(t,r,"initialize","process"))},_clearMarkers:e=>{n.delete(e)},_formatError(e){if(e&&"object"==typeof e)return{code:a(e,"code"),name:a(e,"name"),message:a(e,"message")}},_getDiagnosticsData(e,n,i,r){var s;return{success:!0===(null==e?void 0:e.ok),statusCode:null==e?void 0:e.status,sdkRegion:null===(s=null==e?void 0:e.headers)||void 0===s?void 0:s.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:n,error:t.Diagnostics._formatError(r)}},_enqueueDiagnosticsEvent(e,n,i,r){const s=t.Diagnostics._getMarkers(i);if(null==s||s.length<=0)return-1;const o=s[s.length-1].timestamp-s[0].timestamp;t.Diagnostics._clearMarkers(i);const a=function(e,t){return{eventName:"statsig::diagnostics",user:e,value:null,metadata:t,time:Date.now()}}(e,{context:"initialize",markers:s.slice(),statsigOptions:r});return n.enqueue(a),o}}},6810:function(e,t){var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t._fetchTxtRecords=void 0;const i=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=["i","e","d"];t._fetchTxtRecords=function(e){return n(this,void 0,void 0,(function*(){const t=yield e("https://cloudflare-dns.com/dns-query",{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:i});if(!t.ok){const e=new Error("Failed to fetch TXT records from DNS");throw e.name="DnsTxtFetchError",e}const n=yield t.arrayBuffer();return function(e){const t=e.findIndex(((t,n)=>n<200&&"="===String.fromCharCode(t)&&r.includes(String.fromCharCode(e[n-1]))));if(-1===t){const e=new Error("Failed to parse TXT records from DNS");throw e.name="DnsTxtParseError",e}let n="";for(let i=t-1;i<e.length;i++)n+=String.fromCharCode(e[i]);return n.split(",")}(new Uint8Array(n))}))}},6012:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9233:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundary=t.EXCEPTION_ENDPOINT=void 0;const r=n(7243),s=n(7313),o=n(7787);t.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";const a="[Statsig] UnknownError";function l(e){return e instanceof Error?e:"string"==typeof e?new Error(e):new Error("An unknown error occurred.")}function u(e){if(!e)return{};const t={};return Object.keys(e).forEach((n=>{const i=n,r=e[i];switch(typeof r){case"number":case"bigint":case"boolean":t[String(i)]=r;break;case"string":r.length<50?t[String(i)]=r:t[String(i)]="set";break;case"object":"environment"===i?t.environment=r:"networkConfig"===i?t.networkConfig=r:t[String(i)]=null!=r?"set":"unset"}})),t}t.ErrorBoundary=class{constructor(e,t,n,i){this._sdkKey=e,this._options=t,this._emitter=n,this._lastSeenError=i,this._seen=new Set}wrap(e,t){try{const n=e;(function(e){const t=new Set;let n=Object.getPrototypeOf(e);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter((e=>"function"==typeof(null==n?void 0:n[e]))).forEach((e=>t.add(e))),n=Object.getPrototypeOf(n);return Array.from(t)})(n).forEach((i=>{const r=n[i];"$EB"in r||(n[i]=(...n)=>this._capture(t?`${t}:${i}`:i,(()=>r.apply(e,n))),n[i].$EB=!0)}))}catch(e){this._onError("eb:wrap",e)}}logError(e,t){this._onError(e,t)}getLastSeenErrorAndReset(){const e=this._lastSeenError;return this._lastSeenError=void 0,null!=e?e:null}attachErrorIfNoneExists(e){this._lastSeenError||(this._lastSeenError=l(e))}_capture(e,t){try{const n=t();return n&&n instanceof Promise?n.catch((t=>this._onError(e,t))):n}catch(t){return this._onError(e,t),null}}_onError(e,n){try{r.Log.warn(`Caught error in ${e}`,{error:n}),(()=>i(this,void 0,void 0,(function*(){var i,r,c,d,g,_,h;const v=n||Error(a),f=v instanceof Error,p=f?v.name:"No Name",m=l(v);if(this._lastSeenError=m,this._seen.has(p))return;if(this._seen.add(p),null===(r=null===(i=this._options)||void 0===i?void 0:i.networkConfig)||void 0===r?void 0:r.preventAllNetworkTraffic)return void(null===(c=this._emitter)||void 0===c||c.call(this,{name:"error",error:n,tag:e}));const y=s.SDKType._get(this._sdkKey),b=o.StatsigMetadataProvider.get(),S=f?v.stack:function(e){try{return JSON.stringify(e)}catch(e){return a}}(v),E=Object.assign({tag:e,exception:p,info:S,statsigOptions:u(this._options)},Object.assign(Object.assign({},b),{sdkType:y})),C=null!==(_=null===(g=null===(d=this._options)||void 0===d?void 0:d.networkConfig)||void 0===g?void 0:g.networkOverrideFunc)&&void 0!==_?_:fetch;yield C(t.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._sdkKey,"STATSIG-SDK-TYPE":String(y),"STATSIG-SDK-VERSION":String(b.sdkVersion),"Content-Type":"application/json"},body:JSON.stringify(E)}),null===(h=this._emitter)||void 0===h||h.call(this,{name:"error",error:n,tag:e})})))().then((()=>{})).catch((()=>{}))}catch(e){}}}},1645:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},638:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},4361:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.EventLogger=void 0;const r=n(6448),s=n(5585),o=n(7243),a=n(7245),l=n(831),u=n(2504),c=n(3911),d=n(1285),g=n(1932),_=n(9454),h={};class v{static _safeFlushAndForget(e){var t;null===(t=h[e])||void 0===t||t.flush().catch((()=>{}))}static _safeRetryFailedLogs(e){var t;null===(t=h[e])||void 0===t||t._retryFailedLogs()}constructor(e,t,n,i){var r,s;this._sdkKey=e,this._emitter=t,this._network=n,this._options=i,this._queue=[],this._lastExposureTimeMap={},this._nonExposedChecks={},this._hasRunQuickFlush=!1,this._creationTime=Date.now(),this._loggingEnabled=null!==(r=null==i?void 0:i.loggingEnabled)&&void 0!==r?r:!0===(null==i?void 0:i.disableLogging)?c.LoggingEnabledOption.disabled:c.LoggingEnabledOption.browserOnly,(null==i?void 0:i.loggingEnabled)&&void 0!==i.disableLogging&&o.Log.warn("Detected both loggingEnabled and disableLogging options. loggingEnabled takes precedence - please remove disableLogging."),this._maxQueueSize=null!==(s=null==i?void 0:i.loggingBufferMaxSize)&&void 0!==s?s:100;const l=null==i?void 0:i.networkConfig;this._logEventUrlConfig=new g.UrlConfiguration(a.Endpoint._rgstr,null==l?void 0:l.logEventUrl,null==l?void 0:l.api,null==l?void 0:l.logEventFallbackUrls)}setLogEventCompressionMode(e){this._network.setLogEventCompressionMode(e)}setLoggingEnabled(e){if("disabled"===this._loggingEnabled&&"disabled"!==e){const e=this._getStorageKey(),t=(0,d._getObjectFromStorage)(e);t&&this._queue.push(...t),d.Storage.removeItem(e)}this._loggingEnabled=e}enqueue(e){this._shouldLogEvent(e)&&(this._normalizeAndAppendEvent(e),this._quickFlushIfNeeded(),this._queue.length>this._maxQueueSize&&v._safeFlushAndForget(this._sdkKey))}incrementNonExposureCount(e){var t;const n=null!==(t=this._nonExposedChecks[e])&&void 0!==t?t:0;this._nonExposedChecks[e]=n+1}reset(){this.flush().catch((()=>{})),this._lastExposureTimeMap={}}start(){var e;const t=(0,l._isServerEnv)();t&&"always"!==(null===(e=this._options)||void 0===e?void 0:e.loggingEnabled)||(h[this._sdkKey]=this,t||(0,_._subscribeToVisiblityChanged)((e=>{"background"===e?v._safeFlushAndForget(this._sdkKey):"foreground"===e&&v._safeRetryFailedLogs(this._sdkKey)})),this._retryFailedLogs(),this._startBackgroundFlushInterval())}stop(){return i(this,void 0,void 0,(function*(){this._flushIntervalId&&(clearInterval(this._flushIntervalId),this._flushIntervalId=null),delete h[this._sdkKey],yield this.flush()}))}flush(){return i(this,void 0,void 0,(function*(){if(this._appendAndResetNonExposedChecks(),0===this._queue.length)return;const e=this._queue;this._queue=[],yield this._sendEvents(e)}))}_quickFlushIfNeeded(){this._hasRunQuickFlush||(this._hasRunQuickFlush=!0,Date.now()-this._creationTime>200||setTimeout((()=>v._safeFlushAndForget(this._sdkKey)),200))}_shouldLogEvent(e){var t;if("always"!==(null===(t=this._options)||void 0===t?void 0:t.loggingEnabled)&&(0,l._isServerEnv)())return!1;if(!(0,u._isExposureEvent)(e))return!0;const n=e.user?e.user:{statsigEnvironment:void 0},i=(0,r._getUserStorageKey)(this._sdkKey,n),s=e.metadata?e.metadata:{},o=[e.eventName,i,s.gate,s.config,s.ruleID,s.allocatedExperiment,s.parameterName,String(s.isExplicitParameter),s.reason].join("|"),a=this._lastExposureTimeMap[o],c=Date.now();return!(a&&c-a<6e5||(Object.keys(this._lastExposureTimeMap).length>1e3&&(this._lastExposureTimeMap={}),this._lastExposureTimeMap[o]=c,0))}_sendEvents(e){return i(this,void 0,void 0,(function*(){var t,n;if("disabled"===this._loggingEnabled)return this._saveFailedLogsToStorage(e),!1;try{const i=(0,_._isUnloading)()&&this._network.isBeaconSupported()&&null==(null===(n=null===(t=this._options)||void 0===t?void 0:t.networkConfig)||void 0===n?void 0:n.networkOverrideFunc);return this._emitter({name:"pre_logs_flushed",events:e}),(i?this._sendEventsViaBeacon(e):yield this._sendEventsViaPost(e)).success?(this._emitter({name:"logs_flushed",events:e}),!0):(o.Log.warn("Failed to flush events."),this._saveFailedLogsToStorage(e),!1)}catch(e){return o.Log.warn("Failed to flush events."),!1}}))}_sendEventsViaPost(e){return i(this,void 0,void 0,(function*(){var t;const n=yield this._network.post(this._getRequestData(e)),i=null!==(t=null==n?void 0:n.code)&&void 0!==t?t:-1;return{success:i>=200&&i<300}}))}_sendEventsViaBeacon(e){return{success:this._network.beacon(this._getRequestData(e))}}_getRequestData(e){return{sdkKey:this._sdkKey,data:{events:e},urlConfig:this._logEventUrlConfig,retries:3,isCompressable:!0,params:{[a.NetworkParam.EventCount]:String(e.length)},credentials:"same-origin"}}_saveFailedLogsToStorage(e){for(;e.length>500;)e.shift();const t=this._getStorageKey();try{const n=this._getFailedLogsFromStorage(t);(0,d._setObjectInStorage)(t,[...n,...e])}catch(e){o.Log.warn("Unable to save failed logs to storage")}}_getFailedLogsFromStorage(e){let t=[];try{const n=(0,d._getObjectFromStorage)(e);return Array.isArray(n)&&(t=n),t}catch(e){return[]}}_retryFailedLogs(){const e=this._getStorageKey();(()=>i(this,void 0,void 0,(function*(){d.Storage.isReady()||(yield d.Storage.isReadyResolver());const t=(0,d._getObjectFromStorage)(e);t&&(d.Storage.removeItem(e),yield this._sendEvents(t))})))().catch((()=>{o.Log.warn("Failed to flush stored logs")}))}_getStorageKey(){return`statsig.failed_logs.${(0,s._DJB2)(this._sdkKey)}`}_normalizeAndAppendEvent(e){e.user&&(e.user=Object.assign({},e.user),delete e.user.privateAttributes);const t={},n=this._getCurrentPageUrl();n&&(t.statsigMetadata={currentPage:n});const i=Object.assign(Object.assign({},e),t);o.Log.debug("Enqueued Event:",i),this._queue.push(i)}_appendAndResetNonExposedChecks(){0!==Object.keys(this._nonExposedChecks).length&&(this._normalizeAndAppendEvent({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this._nonExposedChecks)}}),this._nonExposedChecks={})}_getCurrentPageUrl(){var e;if(!1!==(null===(e=this._options)||void 0===e?void 0:e.includeCurrentPageUrlWithEvents))return(0,l._getCurrentPageUrlSafe)()}_startBackgroundFlushInterval(){var e,t;const n=null!==(t=null===(e=this._options)||void 0===e?void 0:e.loggingIntervalMs)&&void 0!==t?t:1e4,i=setInterval((()=>{const e=h[this._sdkKey];e&&e._flushIntervalId===i?v._safeFlushAndForget(this._sdkKey):clearInterval(i)}),n);this._flushIntervalId=i}}t.EventLogger=v},5585:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getSortedObject=t._DJB2Object=t._DJB2=void 0;const i=n(3357);t._DJB2=e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return String(t>>>0)},t._DJB2Object=(e,n)=>(0,t._DJB2)(JSON.stringify((0,t._getSortedObject)(e,n))),t._getSortedObject=(e,n)=>{if(null==e)return null;const r=Object.keys(e).sort(),s={};return r.forEach((r=>{const o=e[r];0!==n&&"object"===(0,i._typeOf)(o)?s[r]=(0,t._getSortedObject)(o,null!=n?n-1:n):s[r]=o})),s}},1368:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7243:(e,t)=>{function n(e){return e.unshift("[Statsig]"),e}Object.defineProperty(t,"__esModule",{value:!0}),t.Log=t.LogLevel=void 0,t.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class i{static info(...e){i.level>=t.LogLevel.Info&&console.info(" INFO ",...n(e))}static debug(...e){i.level>=t.LogLevel.Debug&&console.debug(" DEBUG ",...n(e))}static warn(...e){i.level>=t.LogLevel.Warn&&console.warn(" WARN ",...n(e))}static error(...e){i.level>=t.LogLevel.Error&&console.error(" ERROR ",...n(e))}}t.Log=i,i.level=t.LogLevel.Warn},7312:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createMemoKey=t.MemoPrefix=void 0,t.MemoPrefix={_gate:"g",_dynamicConfig:"c",_experiment:"e",_configList:"cl",_layer:"l",_paramStore:"p"};const n=new Set([]),i=new Set(["userPersistedValues"]);t.createMemoKey=function(e,t,r){let s=`${e}|${t}`;if(!r)return s;for(const e of Object.keys(r)){if(i.has(e))return;n.has(e)?s+=`|${e}=true`:s+=`|${e}=${r[e]}`}return s}},7245:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkParam=t.NetworkDefault=t.Endpoint=void 0,t.Endpoint={_initialize:"initialize",_rgstr:"rgstr",_download_config_specs:"download_config_specs"},t.NetworkDefault={[t.Endpoint._rgstr]:"https://prodregistryv2.org/v1",[t.Endpoint._initialize]:"https://featureassets.org/v1",[t.Endpoint._download_config_specs]:"https://api.statsigcdn.com/v1"},t.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},2336:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkCore=void 0,n(5050);const r=n(5050),s=n(4001),o=n(7243),a=n(7245),l=n(3351),u=n(1034),c=n(7313),d=n(831),g=n(9140),_=n(5683),h=n(5043),v=n(7787),f=n(3911),p=n(9454),m=new Set([408,500,502,503,504,522,524,599]);t.NetworkCore=class{constructor(e,t){this._emitter=t,this._errorBoundary=null,this._timeout=1e4,this._netConfig={},this._options={},this._leakyBucket={},this._lastUsedInitUrl=null,e&&(this._options=e),this._options.networkConfig&&(this._netConfig=this._options.networkConfig),this._netConfig.networkTimeoutMs&&(this._timeout=this._netConfig.networkTimeoutMs),this._fallbackResolver=new l.NetworkFallbackResolver(this._options),this.setLogEventCompressionMode(this._getLogEventCompressionMode(e))}setLogEventCompressionMode(e){this._options.logEventCompressionMode=e}setErrorBoundary(e){this._errorBoundary=e,this._errorBoundary.wrap(this),this._errorBoundary.wrap(this._fallbackResolver),this._fallbackResolver.setErrorBoundary(e)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){const e=this._lastUsedInitUrl;return this._lastUsedInitUrl=null,e}beacon(e){if(!y(e))return!1;const t=this._getInternalRequestArgs("POST",e),n=this._getPopulatedURL(t),i=navigator;return i.sendBeacon.bind(i)(n,t.body)}post(e){return i(this,void 0,void 0,(function*(){const t=this._getInternalRequestArgs("POST",e);return this._tryEncodeBody(t),yield this._tryToCompressBody(t),this._sendRequest(t)}))}get(e){const t=this._getInternalRequestArgs("GET",e);return this._sendRequest(t)}_sendRequest(e){return i(this,void 0,void 0,(function*(){var t,n,r,l;if(!y(e))return null;if(this._netConfig.preventAllNetworkTraffic)return null;const{method:u,body:c,retries:d,attempt:g}=e,_=e.urlConfig.endpoint;if(this._isRateLimited(_))return o.Log.warn(`Request to ${_} was blocked because you are making requests too frequently.`),null;const v=null!=g?g:1;let f=!1;const b=this._getPopulatedURL(e);let E=null;const C=(0,p._isUnloading)();try{const n={method:u,body:c,headers:Object.assign({},e.headers),priority:e.priority,keepalive:C};!function(e,t){e.urlConfig.endpoint===a.Endpoint._initialize&&s.Diagnostics._markInitNetworkReqStart(e.sdkKey,{attempt:t})}(e,v);const i=this._leakyBucket[_];i&&(i.lastRequestTime=Date.now(),this._leakyBucket[_]=i);const r=null!==(t=this._netConfig.networkOverrideFunc)&&void 0!==t?t:fetch;let o;if(E=yield Promise.race([r(b,n).finally((()=>clearTimeout(o))),new Promise(((e,t)=>{o=setTimeout((()=>{f=!0,t(new Error(`Timeout of ${this._timeout}ms expired.`))}),this._timeout)}))]),!E.ok){const e=yield E.text().catch((()=>"No Text")),t=new Error(`NetworkError: ${b} ${e}`);throw t.name="NetworkError",t}const l=yield E.text();return S(e,E,v,l),this._fallbackResolver.tryBumpExpiryTime(e.sdkKey,e.urlConfig),{body:l,code:E.status}}catch(t){const s=function(e){return"string"==typeof e?e:e instanceof Error?`${e.name}: ${e.message}`:"Unknown Error"}(t),a=(k=f,(null!=s?s:"").includes("Timeout")||k);if(S(e,E,v,"",t),(yield this._fallbackResolver.tryFetchUpdatedFallbackInfo(e.sdkKey,e.urlConfig,s,a))&&(e.fallbackUrl=this._fallbackResolver.getActiveFallbackUrl(e.sdkKey,e.urlConfig)),!d||v>d||!m.has(null!==(n=null==E?void 0:E.status)&&void 0!==n?n:500)){null===(r=this._emitter)||void 0===r||r.call(this,{name:"error",error:t,tag:h.ErrorTag.NetworkError,requestArgs:e});const n=`A networking error occurred during ${u} request to ${b}.`;return o.Log.error(n,s,t),null===(l=this._errorBoundary)||void 0===l||l.attachErrorIfNoneExists(n),null}return yield function(e){return i(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,Math.min(e*e*500,3e4))))}))}(v),this._sendRequest(Object.assign(Object.assign({},e),{retries:d,attempt:v+1}))}var k}))}_getLogEventCompressionMode(e){let t=null==e?void 0:e.logEventCompressionMode;return t||!0!==(null==e?void 0:e.disableCompression)||(t=f.LogEventCompressionMode.Disabled),t||(t=f.LogEventCompressionMode.Enabled),t}_isRateLimited(e){var t;const n=Date.now(),i=null!==(t=this._leakyBucket[e])&&void 0!==t?t:{count:0,lastRequestTime:n},r=n-i.lastRequestTime,s=Math.floor(.05*r);return i.count=Math.max(0,i.count-s),i.count>=50||(i.count+=1,i.lastRequestTime=n,this._leakyBucket[e]=i,!1)}_getPopulatedURL(e){var t;const n=null!==(t=e.fallbackUrl)&&void 0!==t?t:e.urlConfig.getUrl();e.urlConfig.endpoint!==a.Endpoint._initialize&&e.urlConfig.endpoint!==a.Endpoint._download_config_specs||(this._lastUsedInitUrl=n);const i=Object.assign({[a.NetworkParam.SdkKey]:e.sdkKey,[a.NetworkParam.SdkType]:c.SDKType._get(e.sdkKey),[a.NetworkParam.SdkVersion]:v.SDK_VERSION,[a.NetworkParam.Time]:String(Date.now()),[a.NetworkParam.SessionID]:g.SessionID.get(e.sdkKey)},e.params),r=Object.keys(i).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(i[e])}`)).join("&");return`${n}${r?`?${r}`:""}`}_tryEncodeBody(e){var t;const n=(0,d._getWindowSafe)(),i=e.body;if(e.isStatsigEncodable&&!this._options.disableStatsigEncoding&&"string"==typeof i&&null==(0,r._getStatsigGlobalFlag)("no-encode")&&(null==n?void 0:n.btoa))try{e.body=n.btoa(i).split("").reverse().join(""),e.params=Object.assign(Object.assign({},null!==(t=e.params)&&void 0!==t?t:{}),{[a.NetworkParam.StatsigEncoded]:"1"})}catch(t){o.Log.warn(`Request encoding failed for ${e.urlConfig.getUrl()}`,t)}}_tryToCompressBody(e){return i(this,void 0,void 0,(function*(){var t;const n=e.body;if("string"==typeof n&&function(e,t){if(!e.isCompressable)return!1;if(null!=(0,r._getStatsigGlobalFlag)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder)return!1;const n=null!=e.urlConfig.customUrl||null!=e.urlConfig.fallbackUrls,i=!0===u.SDKFlags.get(e.sdkKey,"enable_log_event_compression");switch(t.logEventCompressionMode){case f.LogEventCompressionMode.Disabled:return!1;case f.LogEventCompressionMode.Enabled:return!(n&&!i);case f.LogEventCompressionMode.Forced:return!0;default:return!1}}(e,this._options))try{const i=(new TextEncoder).encode(n),r=new CompressionStream("gzip"),s=r.writable.getWriter();s.write(i).catch(o.Log.error),s.close().catch(o.Log.error);const l=r.readable.getReader(),u=[];let c;for(;!(c=yield l.read()).done;)u.push(c.value);const d=u.reduce(((e,t)=>e+t.length),0),g=new Uint8Array(d);let _=0;for(const e of u)g.set(e,_),_+=e.length;e.body=g,e.params=Object.assign(Object.assign({},null!==(t=e.params)&&void 0!==t?t:{}),{[a.NetworkParam.IsGzipped]:"1"})}catch(t){o.Log.warn(`Request compression failed for ${e.urlConfig.getUrl()}`,t)}}))}_getInternalRequestArgs(e,t){const n=this._fallbackResolver.getActiveFallbackUrl(t.sdkKey,t.urlConfig),i=Object.assign(Object.assign({},t),{method:e,fallbackUrl:n});return"data"in t&&b(i,t.data),i}};const y=e=>!!e.sdkKey||(o.Log.warn("Unable to make request without an SDK key"),!1),b=(e,t)=>{const{sdkKey:n,fallbackUrl:i}=e,r=_.StableID.get(n),s=g.SessionID.get(n),o=c.SDKType._get(n);e.body=JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},v.StatsigMetadataProvider.get()),{stableID:r,sessionID:s,sdkType:o,fallbackUrl:i})}))};function S(e,t,n,i,r){e.urlConfig.endpoint===a.Endpoint._initialize&&s.Diagnostics._markInitNetworkReqEnd(e.sdkKey,s.Diagnostics._getDiagnosticsData(t,n,i,r))}},3351:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t._isDomainFailure=t.NetworkFallbackResolver=void 0;const r=n(6810),s=n(5585),o=n(7243),a=n(1285),l=6048e5;function u(e,t){var n;const i=null!==(n=null==e?void 0:e.toLowerCase())&&void 0!==n?n:"";return t||i.includes("uncaught exception")||i.includes("failed to fetch")||i.includes("networkerror when attempting to fetch resource")}function c(e){return`statsig.network_fallback.${(0,s._DJB2)(e)}`}function d(e,t){const n=c(e);t&&0!==Object.keys(t).length?a.Storage.setItem(n,JSON.stringify(t)):a.Storage.removeItem(n)}t.NetworkFallbackResolver=class{constructor(e){var t;this._fallbackInfo=null,this._errorBoundary=null,this._dnsQueryCooldowns={},this._networkOverrideFunc=null===(t=e.networkConfig)||void 0===t?void 0:t.networkOverrideFunc}setErrorBoundary(e){this._errorBoundary=e}tryBumpExpiryTime(e,t){var n;const i=null===(n=this._fallbackInfo)||void 0===n?void 0:n[t.endpoint];i&&(i.expiryTime=Date.now()+l,d(e,Object.assign(Object.assign({},this._fallbackInfo),{[t.endpoint]:i})))}getActiveFallbackUrl(e,t){var n,i;if(null!=t.customUrl&&null!=t.fallbackUrls)return null;let r=this._fallbackInfo;null==r&&(r=null!==(n=function(e){const t=c(e),n=a.Storage.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return o.Log.error("Failed to parse FallbackInfo"),null}}(e))&&void 0!==n?n:{},this._fallbackInfo=r);const s=r[t.endpoint];return!s||Date.now()>(null!==(i=s.expiryTime)&&void 0!==i?i:0)||t.getChecksum()!==s.urlConfigChecksum?(delete r[t.endpoint],this._fallbackInfo=r,d(e,this._fallbackInfo),null):s.url?s.url:null}tryFetchUpdatedFallbackInfo(e,t,n,r){return i(this,void 0,void 0,(function*(){var i,s;try{if(!u(n,r))return!1;const s=null==t.customUrl&&null==t.fallbackUrls?yield this._tryFetchFallbackUrlsFromNetwork(t):t.fallbackUrls,o=this._pickNewFallbackUrl(null===(i=this._fallbackInfo)||void 0===i?void 0:i[t.endpoint],s);return!!o&&(this._updateFallbackInfoWithNewUrl(e,t,o),!0)}catch(e){return null===(s=this._errorBoundary)||void 0===s||s.logError("tryFetchUpdatedFallbackInfo",e),!1}}))}_updateFallbackInfoWithNewUrl(e,t,n){var i,r,s;const o={urlConfigChecksum:t.getChecksum(),url:n,expiryTime:Date.now()+l,previous:[]},a=t.endpoint,u=null===(i=this._fallbackInfo)||void 0===i?void 0:i[a];u&&o.previous.push(...u.previous),o.previous.length>10&&(o.previous=[]);const c=null===(s=null===(r=this._fallbackInfo)||void 0===r?void 0:r[a])||void 0===s?void 0:s.url;null!=c&&o.previous.push(c),this._fallbackInfo=Object.assign(Object.assign({},this._fallbackInfo),{[a]:o}),d(e,this._fallbackInfo)}_tryFetchFallbackUrlsFromNetwork(e){return i(this,void 0,void 0,(function*(){var t;const n=this._dnsQueryCooldowns[e.endpoint];if(n&&Date.now()<n)return null;this._dnsQueryCooldowns[e.endpoint]=Date.now()+144e5;const i=[],s=yield(0,r._fetchTxtRecords)(null!==(t=this._networkOverrideFunc)&&void 0!==t?t:fetch),o=function(e){try{return new URL(e).pathname}catch(e){return null}}(e.defaultUrl);for(const t of s){if(!t.startsWith(e.endpointDnsKey+"="))continue;const n=t.split("=");if(n.length>1){let e=n[1];e.endsWith("/")&&(e=e.slice(0,-1)),i.push(`https://${e}${o}`)}}return i}))}_pickNewFallbackUrl(e,t){var n;if(null==t)return null;const i=new Set(null!==(n=null==e?void 0:e.previous)&&void 0!==n?n:[]),r=null==e?void 0:e.url;let s=null;for(const e of t){const t=e.endsWith("/")?e.slice(0,-1):e;if(!i.has(e)&&t!==r){s=t;break}}return s}},t._isDomainFailure=u},5462:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5546:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1034:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDKFlags=void 0;const n={};t.SDKFlags={setFlags:(e,t)=>{n[e]=t},get:(e,t)=>{var i,r;return null!==(r=null===(i=n[e])||void 0===i?void 0:i[t])&&void 0!==r&&r}}},7313:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDKType=void 0;const n={};let i;t.SDKType={_get:e=>{var t;return(null!==(t=n[e])&&void 0!==t?t:"js-mono")+(null!=i?i:"")},_setClientType(e,t){n[e]=t},_setBindingType(e){i&&"-react"!==i||(i="-"+e)}}},831:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getUnloadEvent=t._getCurrentPageUrlSafe=t._addDocumentEventListenerSafe=t._addWindowEventListenerSafe=t._isServerEnv=t._getDocumentSafe=t._getWindowSafe=void 0,t._getWindowSafe=()=>"undefined"!=typeof window?window:null,t._getDocumentSafe=()=>{var e;const n=(0,t._getWindowSafe)();return null!==(e=null==n?void 0:n.document)&&void 0!==e?e:null},t._isServerEnv=()=>{if(null!==(0,t._getDocumentSafe)())return!1;const e="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node;return"string"==typeof EdgeRuntime||e},t._addWindowEventListenerSafe=(e,n)=>{const i=(0,t._getWindowSafe)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(e,n)},t._addDocumentEventListenerSafe=(e,n)=>{const i=(0,t._getDocumentSafe)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(e,n)},t._getCurrentPageUrlSafe=()=>{var e;try{return null===(e=(0,t._getWindowSafe)())||void 0===e?void 0:e.location.href.split(/[?#]/)[0]}catch(e){return}},t._getUnloadEvent=()=>{const e=(0,t._getWindowSafe)();return e&&"onpagehide"in e?"pagehide":"beforeunload"}},9140:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigSession=t.SessionID=void 0;const i=n(5050),r=n(6448),s=n(7243),o=n(1285),a=n(7010),l=18e5,u=144e5,c={};function d(e,t){return setTimeout((()=>{var t;const n=null===(t=(0,i._getStatsigGlobal)())||void 0===t?void 0:t.instance(e);n&&n.$emt({name:"session_expired"})}),t)}function g(e){return`statsig.session_id.${(0,r._getStorageKey)(e)}`}t.SessionID={get:e=>t.StatsigSession.get(e).data.sessionID},t.StatsigSession={get:e=>(null==c[e]&&(c[e]=function(e){let t=function(e){const t=g(e);return(0,o._getObjectFromStorage)(t)}(e);const n=Date.now();return t||(t={sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n}),{data:t,sdkKey:e}}(e)),function(e){const t=Date.now(),n=e.data,i=e.sdkKey;if(function({lastUpdate:e}){return Date.now()-e>l}(n)||function({startTime:e}){return Date.now()-e>u}(n)){n.sessionID=(0,a.getUUID)(),n.startTime=t;const e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(i);e&&e.$emt({name:"session_expired"})}n.lastUpdate=t,function(e,t){const n=g(t);try{(0,o._setObjectInStorage)(n,e)}catch(e){s.Log.warn("Failed to save SessionID")}}(n,e.sdkKey),clearTimeout(e.idleTimeoutID),clearTimeout(e.ageTimeoutID);const r=t-n.startTime;return e.idleTimeoutID=d(i,l),e.ageTimeoutID=d(i,u-r),e}(c[e])),overrideInitialSessionID:(e,t)=>{c[t]=function(e,t){const n=Date.now();return{data:{sessionID:e,startTime:n,lastUpdate:n},sdkKey:t}}(e,t)}}},9133:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._fastApproxSizeOf=void 0,t._fastApproxSizeOf=(e,n)=>{let i=0;const r=Object.keys(e);for(let s=0;s<r.length;s++){const o=r[s],a=e[o];if(i+=o.length,i+="object"==typeof a&&null!==a?(0,t._fastApproxSizeOf)(a,n)+2:String(a).length+1,i>=n)return i}return i}},5683:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getCookieName=t.StableID=void 0;const i=n(6448),r=n(7243),s=n(831),o=n(1285),a=n(7010),l={},u={},c={};function d(e){return`statsig.stable_id.${(0,i._getStorageKey)(e)}`}function g(e,t){const n=d(t);try{(0,o._setObjectInStorage)(n,e)}catch(e){r.Log.warn("Failed to save StableID to storage")}}function _(e,t){if(!u[t]||null==(0,s._getDocumentSafe)())return;const n=new Date;n.setFullYear(n.getFullYear()+1),document.cookie=`${h(t)}=${encodeURIComponent(e)}; expires=${n.toUTCString()}; path=/`}function h(e){return`statsig.stable_id.${(0,i._getStorageKey)(e)}`}t.StableID={cookiesEnabled:!1,randomID:Math.random().toString(36),get:e=>{if(c[e])return null;if(null!=l[e])return l[e];let t=null;return t=function(e){if(!u[e]||null==(0,s._getDocumentSafe)())return null;const t=document.cookie.split(";");for(const n of t){const[t,i]=n.trim().split("=");if(t===h(e))return decodeURIComponent(i)}return null}(e),null!=t?(l[e]=t,g(t,e),t):(t=function(e){const t=d(e);return(0,o._getObjectFromStorage)(t)}(e),null==t&&(t=(0,a.getUUID)()),g(t,e),_(t,e),l[e]=t,t)},setOverride:(e,t)=>{l[t]=e,g(e,t),_(e,t)},_setCookiesEnabled:(e,t)=>{u[e]=t},_setDisabled:(e,t)=>{c[e]=t}},t.getCookieName=h},3524:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigClientBase=void 0,n(5050);const r=n(5050),s=n(9233),o=n(4361),a=n(7243),l=n(7312),u=n(831),c=n(9140),d=n(5683),g=n(3911),_=n(1285);t.StatsigClientBase=class{constructor(e,t,n,i){var l,g,h,v;this.loadingStatus="Uninitialized",this._initializePromise=null,this._listeners={};const f=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),(null==i?void 0:i.disableStorage)&&_.Storage._setDisabled(!0),(null==i?void 0:i.initialSessionID)&&c.StatsigSession.overrideInitialSessionID(i.initialSessionID,e),(null==i?void 0:i.storageProvider)&&_.Storage._setProvider(i.storageProvider),(null==i?void 0:i.enableCookies)&&d.StableID._setCookiesEnabled(e,i.enableCookies),(null==i?void 0:i.disableStableID)&&d.StableID._setDisabled(e,!0),this._sdkKey=e,this._options=null!=i?i:{},this._memoCache={},this.overrideAdapter=null!==(l=null==i?void 0:i.overrideAdapter)&&void 0!==l?l:null,this._logger=new o.EventLogger(e,f,n,i),this._errorBoundary=new s.ErrorBoundary(e,i,f),this._errorBoundary.wrap(this),this._errorBoundary.wrap(t),this._errorBoundary.wrap(this._logger),n.setErrorBoundary(this._errorBoundary),this.dataAdapter=t,this.dataAdapter.attach(e,i,n),this.storageProvider=_.Storage,null===(v=null===(h=null===(g=this.overrideAdapter)||void 0===g?void 0:g.loadFromStorage)||void 0===h?void 0:h.call(g))||void 0===v||v.catch((e=>this._errorBoundary.logError("OA::loadFromStorage",e))),this._primeReadyRipcord(),function(e,t){var n;if((0,u._isServerEnv)())return;const i=(0,r._getStatsigGlobal)(),s=null!==(n=i.instances)&&void 0!==n?n:{},o=t;null!=s[e]&&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[e]=o,i.firstInstance||(i.firstInstance=o),i.instances=s,__STATSIG__=i}(e,this)}updateRuntimeOptions(e){e.loggingEnabled?(this._options.loggingEnabled=e.loggingEnabled,this._logger.setLoggingEnabled(e.loggingEnabled)):null!=e.disableLogging&&(this._options.disableLogging=e.disableLogging,this._logger.setLoggingEnabled(e.disableLogging?"disabled":"browser-only")),null!=e.disableStorage&&(this._options.disableStorage=e.disableStorage,_.Storage._setDisabled(e.disableStorage)),null!=e.enableCookies&&(this._options.enableCookies=e.enableCookies,d.StableID._setCookiesEnabled(this._sdkKey,e.enableCookies)),e.logEventCompressionMode?this._logger.setLogEventCompressionMode(e.logEventCompressionMode):e.disableCompression&&this._logger.setLogEventCompressionMode(g.LogEventCompressionMode.Disabled)}flush(){return this._logger.flush()}shutdown(){return i(this,void 0,void 0,(function*(){this.$emt({name:"pre_shutdown"}),this._setStatus("Uninitialized",null),this._initializePromise=null,yield this._logger.stop()}))}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){if(this._listeners[e]){const n=this._listeners[e].indexOf(t);-1!==n&&this._listeners[e].splice(n,1)}}$on(e,t){t.__isInternal=!0,this.on(e,t)}$emt(e){var t;const n=t=>{try{t(e)}catch(n){if(!0===t.__isInternal)return void this._errorBoundary.logError(`__emit:${e.name}`,n);a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",e)}};this._listeners[e.name]&&this._listeners[e.name].forEach((e=>n(e))),null===(t=this._listeners["*"])||void 0===t||t.forEach(n)}_setStatus(e,t){this.loadingStatus=e,this._memoCache={},this.$emt({name:"values_updated",status:e,values:t})}_enqueueExposure(e,t,n){!0!==(null==n?void 0:n.disableExposureLog)?this._logger.enqueue(t):this._logger.incrementNonExposureCount(e)}_memoize(e,t){return(n,i)=>{if(this._options.disableEvaluationMemoization)return t(n,i);const r=(0,l.createMemoKey)(e,n,i);return r?(r in this._memoCache||(Object.keys(this._memoCache).length>=3e3&&(this._memoCache={}),this._memoCache[r]=t(n,i)),this._memoCache[r]):t(n,i)}}}},5043:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorTag=void 0,t.ErrorTag={NetworkError:"NetworkError"}},4967:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DataAdapterCachePrefix=void 0,t.DataAdapterCachePrefix="statsig.cached"},2504:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._createLayerParameterExposure=t._createConfigExposure=t._mapExposures=t._createGateExposure=t._isExposureEvent=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",r="statsig::layer_exposure",s=(e,t,n,i,r)=>(n.bootstrapMetadata&&(i.bootstrapMetadata=n.bootstrapMetadata),{eventName:e,user:t,value:null,metadata:a(n,i),secondaryExposures:r,time:Date.now()});function o(e,t){return e.map((e=>"string"==typeof e?(null!=t?t:{})[e]:e)).filter((e=>null!=e))}t._isExposureEvent=({eventName:e})=>e===i||e===n||e===r,t._createGateExposure=(e,t,n)=>{var r,a,l;const u={gate:t.name,gateValue:String(t.value),ruleID:t.ruleID};return null!=(null===(r=t.__evaluation)||void 0===r?void 0:r.version)&&(u.configVersion=t.__evaluation.version),s(i,e,t.details,u,o(null!==(l=null===(a=t.__evaluation)||void 0===a?void 0:a.secondary_exposures)&&void 0!==l?l:[],n))},t._mapExposures=o,t._createConfigExposure=(e,t,i)=>{var r,a,l,u;const c={config:t.name,ruleID:t.ruleID};return null!=(null===(r=t.__evaluation)||void 0===r?void 0:r.version)&&(c.configVersion=t.__evaluation.version),null!=(null===(a=t.__evaluation)||void 0===a?void 0:a.passed)&&(c.rulePassed=String(t.__evaluation.passed)),s(n,e,t.details,c,o(null!==(u=null===(l=t.__evaluation)||void 0===l?void 0:l.secondary_exposures)&&void 0!==u?u:[],i))},t._createLayerParameterExposure=(e,t,n,i)=>{var a,l,u,c,d,g,_;const h=t.__evaluation,v=!0===(null===(a=null==h?void 0:h.explicit_parameters)||void 0===a?void 0:a.includes(n));let f="",p=null!==(l=null==h?void 0:h.undelegated_secondary_exposures)&&void 0!==l?l:[];v&&(f=null!==(u=h.allocated_experiment_name)&&void 0!==u?u:"",p=null!==(c=h.secondary_exposures)&&void 0!==c?c:[]);const m=null===(d=t.__evaluation)||void 0===d?void 0:d.parameter_rule_ids,y={config:t.name,parameterName:n,ruleID:null!==(g=null==m?void 0:m[n])&&void 0!==g?g:t.ruleID,allocatedExperiment:f,isExplicitParameter:String(v)};return null!=(null===(_=t.__evaluation)||void 0===_?void 0:_.version)&&(y.configVersion=t.__evaluation.version),s(r,e,t.details,y,o(p,i))};const a=(e,t)=>(t.reason=e.reason,e.lcut&&(t.lcut=String(e.lcut)),e.receivedAt&&(t.receivedAt=String(e.receivedAt)),t)},7787:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigMetadataProvider=t.SDK_VERSION=void 0,t.SDK_VERSION="3.30.0";let n={sdkVersion:t.SDK_VERSION,sdkType:"js-mono"};t.StatsigMetadataProvider={get:()=>n,add:e=>{n=Object.assign(Object.assign({},n),e)}}},3911:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LoggingEnabledOption=t.LogEventCompressionMode=void 0,t.LogEventCompressionMode={Disabled:"d",Enabled:"e",Forced:"f"},t.LoggingEnabledOption={disabled:"disabled",browserOnly:"browser-only",always:"always"}},7289:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1406:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._makeTypedGet=t._mergeOverride=t._makeLayer=t._makeExperiment=t._makeDynamicConfig=t._makeFeatureGate=void 0;const i=n(7243),r=n(3357);function s(e,t,n,i){var r;return{name:e,details:t,ruleID:null!==(r=null==n?void 0:n.rule_id)&&void 0!==r?r:"",__evaluation:n,value:i}}function o(e,t,n){var i,r;const o=null!==(i=null==n?void 0:n.value)&&void 0!==i?i:{};return Object.assign(Object.assign({},s(e,t,n,o)),{idType:null!==(r=null==n?void 0:n.id_type)&&void 0!==r?r:null,get:a(e,null==n?void 0:n.value)})}function a(e,t,n){return(s,o)=>{var a;const l=null!==(a=null==t?void 0:t[s])&&void 0!==a?a:null;return null==l?null!=o?o:null:null==o||(0,r._isTypeMatch)(l,o)?(null==n||n(s),l):(i.Log.warn(`Parameter type mismatch. '${e}.${s}' was found to be type '${typeof l}' but fallback/return type is '${typeof o}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=o?o:null)}}t._makeFeatureGate=function(e,t,n){var i;return Object.assign(Object.assign({},s(e,t,n,!0===(null==n?void 0:n.value))),{idType:null!==(i=null==n?void 0:n.id_type)&&void 0!==i?i:null})},t._makeDynamicConfig=o,t._makeExperiment=function(e,t,n){var i;const r=o(e,t,n);return Object.assign(Object.assign({},r),{groupName:null!==(i=null==n?void 0:n.group_name)&&void 0!==i?i:null})},t._makeLayer=function(e,t,n,i){var r,o;return Object.assign(Object.assign({},s(e,t,n,void 0)),{get:a(e,null==n?void 0:n.value,i),groupName:null!==(r=null==n?void 0:n.group_name)&&void 0!==r?r:null,__value:null!==(o=null==n?void 0:n.value)&&void 0!==o?o:{}})},t._mergeOverride=function(e,t,n,i){return Object.assign(Object.assign(Object.assign({},e),t),{get:a(e.name,n,i)})},t._makeTypedGet=a},1033:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},8945:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UPDATE_DETAIL_ERROR_MESSAGES=t.createUpdateDetails=void 0,t.createUpdateDetails=(e,t,n,i,r,s)=>({duration:n,source:t,success:e,error:i,sourceUrl:r,warnings:s}),t.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."}},8001:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getFullUserHash=t._normalizeUser=void 0;const i=n(5585),r=n(7243);t._normalizeUser=function(e,t,n){try{const i=JSON.parse(JSON.stringify(e));return null!=t&&null!=t.environment?i.statsigEnvironment=t.environment:null!=n&&(i.statsigEnvironment={tier:n}),i}catch(e){return r.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},t._getFullUserHash=function(e){return e?(0,i._DJB2Object)(e):null}},1285:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._setObjectInStorage=t._getObjectFromStorage=t.Storage=void 0;const i=n(7243),r=n(831),s={},o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:e=>s[e]?s[e]:null,setItem:(e,t)=>{s[e]=t},removeItem:e=>{delete s[e]},getAllKeys:()=>Object.keys(s)};let a=null;try{const e=(0,r._getWindowSafe)();e&&e.localStorage&&"function"==typeof e.localStorage.getItem&&(a={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>e.localStorage.getItem(t),setItem:(t,n)=>e.localStorage.setItem(t,n),removeItem:t=>e.localStorage.removeItem(t),getAllKeys:()=>Object.keys(e.localStorage)})}catch(e){i.Log.warn("Failed to setup localStorageProvider.")}let l=null!=a?a:o,u=l;function c(e){try{return e()}catch(e){if(e instanceof Error&&"SecurityError"===e.name)return t.Storage._setProvider(o),null;throw e}}t.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:e=>c((()=>u.getItem(e))),setItem:(e,t)=>c((()=>u.setItem(e,t))),removeItem:e=>u.removeItem(e),getAllKeys:()=>u.getAllKeys(),_setProvider:e=>{l=e,u=e},_setDisabled:e=>{u=e?o:l}},t._getObjectFromStorage=function(e){const n=t.Storage.getItem(e);return JSON.parse(null!=n?n:"null")},t._setObjectInStorage=function(e,n){t.Storage.setItem(e,JSON.stringify(n))}},8532:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._typedJsonParse=void 0;const i=n(7243);t._typedJsonParse=function(e,t,n){try{const n=JSON.parse(e);if(n&&"object"==typeof n&&t in n)return n}catch(e){}return i.Log.error(`Failed to parse ${n}`),null}},3357:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._isTypeMatch=t._typeOf=void 0,t._typeOf=function(e){return Array.isArray(e)?"array":typeof e},t._isTypeMatch=function(e,t){const n=e=>Array.isArray(e)?"array":null===e?"null":typeof e;return n(e)===n(t)}},7010:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getUUID=void 0,t.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let e=(new Date).getTime(),t="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,(n=>{let i=16*Math.random();return e>0?(i=(e+i)%16|0,e=Math.floor(e/16)):(i=(t+i)%16|0,t=Math.floor(t/16)),("x"===n?i:7&i|8).toString(16)}))}},1932:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UrlConfiguration=void 0;const i=n(5585),r=n(7245),s={[r.Endpoint._initialize]:"i",[r.Endpoint._rgstr]:"e",[r.Endpoint._download_config_specs]:"d"};t.UrlConfiguration=class{constructor(e,t,n,i){this.customUrl=null,this.fallbackUrls=null,this.endpoint=e,this.endpointDnsKey=s[e],t&&(this.customUrl=t),!t&&n&&(this.customUrl=n.endsWith("/")?`${n}${e}`:`${n}/${e}`),i&&(this.fallbackUrls=i);const o=r.NetworkDefault[e];this.defaultUrl=`${o}/${e}`}getUrl(){var e;return null!==(e=this.customUrl)&&void 0!==e?e:this.defaultUrl}getChecksum(){var e;const t=(null!==(e=this.fallbackUrls)&&void 0!==e?e:[]).sort().join(",");return(0,i._DJB2)(this.customUrl+t)}}},9454:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._notifyVisibilityChanged=t._subscribeToVisiblityChanged=t._isUnloading=t._isCurrentlyVisible=void 0;const i=n(831),r="foreground",s="background",o=[];let a=r,l=!1;t._isCurrentlyVisible=()=>a===r,t._isUnloading=()=>l,t._subscribeToVisiblityChanged=e=>{o.unshift(e)},t._notifyVisibilityChanged=e=>{e!==a&&(a=e,o.forEach((t=>t(e))))},(0,i._addWindowEventListenerSafe)("focus",(()=>{l=!1,(0,t._notifyVisibilityChanged)(r)})),(0,i._addWindowEventListenerSafe)("blur",(()=>(0,t._notifyVisibilityChanged)(s))),(0,i._addDocumentEventListenerSafe)("visibilitychange",(()=>{(0,t._notifyVisibilityChanged)("visible"===document.visibilityState?r:s)})),(0,i._addWindowEventListenerSafe)((0,i._getUnloadEvent)(),(()=>{l=!0,(0,t._notifyVisibilityChanged)(s)}))},4485:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Storage=t.Log=t.EventLogger=t.Diagnostics=void 0,n(5050);const s=n(5050),o=n(4001);Object.defineProperty(t,"Diagnostics",{enumerable:!0,get:function(){return o.Diagnostics}});const a=n(4361);Object.defineProperty(t,"EventLogger",{enumerable:!0,get:function(){return a.EventLogger}});const l=n(7243);Object.defineProperty(t,"Log",{enumerable:!0,get:function(){return l.Log}});const u=n(7787),c=n(1285);Object.defineProperty(t,"Storage",{enumerable:!0,get:function(){return c.Storage}}),r(n(5050),t),r(n(6448),t),r(n(2082),t),r(n(977),t),r(n(4001),t),r(n(6012),t),r(n(9233),t),r(n(1645),t),r(n(638),t),r(n(5585),t),r(n(1368),t),r(n(7243),t),r(n(7312),t),r(n(7245),t),r(n(2336),t),r(n(5462),t),r(n(5546),t),r(n(831),t),r(n(7313),t),r(n(9140),t),r(n(9133),t),r(n(5683),t),r(n(3524),t),r(n(5043),t),r(n(4967),t),r(n(2504),t),r(n(7787),t),r(n(3911),t),r(n(7289),t),r(n(1406),t),r(n(1033),t),r(n(8001),t),r(n(1285),t),r(n(8532),t),r(n(3357),t),r(n(1932),t),r(n(7010),t),r(n(9454),t),r(n(8945),t),r(n(1034),t),Object.assign((0,s._getStatsigGlobal)(),{Log:l.Log,SDK_VERSION:u.SDK_VERSION})},4343:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._resolveDeltasResponse=void 0;const i=n(4485);function r(e,t){null==e||e.forEach((e=>{delete t[e]}))}t._resolveDeltasResponse=function(e,t){const n=(0,i._typedJsonParse)(t,"checksum","DeltasEvaluationResponse");if(!n)return{hadBadDeltaChecksum:!0};const s=function(e){const t=e;return r(e.deleted_gates,t.feature_gates),delete t.deleted_gates,r(e.deleted_configs,t.dynamic_configs),delete t.deleted_configs,r(e.deleted_layers,t.layer_configs),delete t.deleted_layers,t}(function(e,t){return Object.assign(Object.assign(Object.assign({},e),t),{feature_gates:Object.assign(Object.assign({},e.feature_gates),t.feature_gates),layer_configs:Object.assign(Object.assign({},e.layer_configs),t.layer_configs),dynamic_configs:Object.assign(Object.assign({},e.dynamic_configs),t.dynamic_configs)})}(e,n)),o=(0,i._DJB2Object)({feature_gates:s.feature_gates,dynamic_configs:s.dynamic_configs,layer_configs:s.layer_configs},2);return o===n.checksumV2?JSON.stringify(s):{hadBadDeltaChecksum:!0,badChecksum:o,badMergedConfigs:s,badFullResponse:n.deltas_full_response}}},4046:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const i=n(4485),r=n(2051),s=n(2920);t.default=class{constructor(e){this._sdkKey=e,this._rawValues=null,this._values=null,this._source="Uninitialized",this._lcut=0,this._receivedAt=0,this._bootstrapMetadata=null,this._warnings=new Set}reset(){this._values=null,this._rawValues=null,this._source="Loading",this._lcut=0,this._receivedAt=0,this._bootstrapMetadata=null,this._warnings.clear()}finalize(){this._values||(this._source="NoValues")}getValues(){return this._rawValues?(0,i._typedJsonParse)(this._rawValues,"has_updates","EvaluationStoreValues"):null}setValues(e,t){var n,o;if(!e)return!1;const a=(0,i._typedJsonParse)(e.data,"has_updates","EvaluationResponse");return null!=a&&(this._source=e.source,!0!==(null==a?void 0:a.has_updates)||(null!==(n=a.time)&&void 0!==n?n:0)<this._lcut||(this._rawValues=e.data,this._lcut=a.time,this._receivedAt=e.receivedAt,"init-v2"===a.response_format?this._values=new s.V2InitializeContainer(a):this._values=new r.V1InitializeContainer(a),this._bootstrapMetadata=this._extractBootstrapMetadata(e.source,a),e.source&&a.user&&this._setWarningState(t,a),i.SDKFlags.setFlags(this._sdkKey,null!==(o=a.sdk_flags)&&void 0!==o?o:{})),!0)}getWarnings(){if(0!==this._warnings.size)return Array.from(this._warnings)}getGate(e){const t=this._values?this._values.getGate(e):null;return this._getDetailedStoreResult(t)}getConfig(e){const t=this._values?this._values.getConfig(e):null;return this._getDetailedStoreResult(t)}getConfigList(){return this._values?this._values.getConfigList():[]}getLayer(e){const t=this._values?this._values.getLayer(e):null;return this._getDetailedStoreResult(t)}getParamStore(e){const t=this._values?this._values.getParamStore(e):null;return this._getDetailedStoreResult(t)}getSource(){return this._source}getExposureMapping(){var e;return null===(e=this._values)||void 0===e?void 0:e.getExposureMapping()}_extractBootstrapMetadata(e,t){if("Bootstrap"!==e)return null;const n={};return t.user&&(n.user=t.user),t.sdkInfo&&(n.generatorSDKInfo=t.sdkInfo),n.lcut=t.time,n}_getDetailedStoreResult(e){return{result:e,details:this._getDetails(null==e)}}_setWarningState(e,t){var n,r;const s=i.StableID.get(this._sdkKey);if((null===(n=e.customIDs)||void 0===n?void 0:n.stableID)===s||!(null===(r=e.customIDs)||void 0===r?void 0:r.stableID)&&!s){if("user"in t){const n=t.user,r=Object.assign(Object.assign({},e),{analyticsOnlyMetadata:void 0,privateAttributes:void 0});(0,i._getFullUserHash)(r)!==(0,i._getFullUserHash)(n)&&this._warnings.add("PartialUserMatch")}}else this._warnings.add("StableIDMismatch")}getCurrentSourceDetails(){if("Uninitialized"===this._source||"NoValues"===this._source)return{reason:this._source};const e={reason:this._source,lcut:this._lcut,receivedAt:this._receivedAt};return this._warnings.size>0&&(e.warnings=Array.from(this._warnings)),e}_getDetails(e){var t,n;const i=this.getCurrentSourceDetails();let r=i.reason;const s=null!==(t=i.warnings)&&void 0!==t?t:[];"Bootstrap"===this._source&&s.length>0&&(r+=s[0]),"Uninitialized"!==r&&"NoValues"!==r&&(r=`${r}:${e?"Unrecognized":"Recognized"}`);const o="Bootstrap"===this._source&&null!==(n=this._bootstrapMetadata)&&void 0!==n?n:void 0;return o&&(i.bootstrapMetadata=o),Object.assign(Object.assign({},i),{reason:r})}}},787:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(4485),s=n(4343);class o extends r.NetworkCore{constructor(e,t){super(e,t);const n=null==e?void 0:e.networkConfig;this._option=e,this._initializeUrlConfig=new r.UrlConfiguration(r.Endpoint._initialize,null==n?void 0:n.initializeUrl,null==n?void 0:n.api,null==n?void 0:n.initializeFallbackUrls)}fetchEvaluations(e,t,n,s,o){return i(this,void 0,void 0,(function*(){var i,a,l,u,c,d;const g=t?(0,r._typedJsonParse)(t,"has_updates","InitializeResponse"):null;let _={user:s,hash:null!==(l=null===(a=null===(i=this._option)||void 0===i?void 0:i.networkConfig)||void 0===a?void 0:a.initializeHashAlgorithm)&&void 0!==l?l:"djb2",deltasResponseRequested:!1,full_checksum:null};if(null==g?void 0:g.has_updates){const e=(null==g?void 0:g.hash_used)!==(null!==(d=null===(c=null===(u=this._option)||void 0===u?void 0:u.networkConfig)||void 0===c?void 0:c.initializeHashAlgorithm)&&void 0!==d?d:"djb2");_=Object.assign(Object.assign({},_),{sinceTime:o&&!e?g.time:0,previousDerivedFields:"derived_fields"in g&&o?g.derived_fields:{},deltasResponseRequested:!0,full_checksum:g.full_checksum,partialUserMatchSinceTime:e?0:g.time})}return this._fetchEvaluations(e,g,_,n)}))}_fetchEvaluations(e,t,n,r){return i(this,void 0,void 0,(function*(){var i,o;const a=yield this.post({sdkKey:e,urlConfig:this._initializeUrlConfig,data:n,retries:2,isStatsigEncodable:!0,priority:r});if(204===(null==a?void 0:a.code))return'{"has_updates": false}';if(200!==(null==a?void 0:a.code))return null!==(i=null==a?void 0:a.body)&&void 0!==i?i:null;if(!0!==(null==t?void 0:t.has_updates)||!0!==(null===(o=a.body)||void 0===o?void 0:o.includes('"is_delta":true'))||!0!==n.deltasResponseRequested)return a.body;const l=(0,s._resolveDeltasResponse)(t,a.body);return"string"==typeof l?l:this._fetchEvaluations(e,t,Object.assign(Object.assign(Object.assign({},n),l),{deltasResponseRequested:!1}),r)}))}}t.default=o},3824:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._makeParamStoreGetter=void 0;const i=n(4485),r={disableExposureLog:!0};function s(e){return null==e||!1===e.disableExposureLog}function o(e,t){return null!=t&&!(0,i._isTypeMatch)(e,t)}t._makeParamStoreGetter=function(e,t,n){return(a,l)=>{if(null==t)return l;const u=t[a];if(null==u||null!=l&&(0,i._typeOf)(l)!==u.param_type)return l;switch(u.ref_type){case"static":return function(e,t){return e.value}(u);case"gate":return function(e,t,n){return e.getFeatureGate(t.gate_name,s(n)?void 0:r).value?t.pass_value:t.fail_value}(e,u,n);case"dynamic_config":return function(e,t,n,i){const a=e.getDynamicConfig(t.config_name,s(i)?void 0:r).get(t.param_name);return o(a,n)?n:a}(e,u,l,n);case"experiment":return function(e,t,n,i){const a=e.getExperiment(t.experiment_name,s(i)?void 0:r).get(t.param_name);return o(a,n)?n:a}(e,u,l,n);case"layer":return function(e,t,n,i){const a=e.getLayer(t.layer_name,s(i)?void 0:r).get(t.param_name);return o(a,n)?n:a}(e,u,l,n);default:return l}}}},8533:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(4485),s=n(4046),o=n(787),a=n(3824),l=n(2004);class u extends r.StatsigClientBase{static instance(e){const t=(0,r._getStatsigGlobal)().instance(e);return t instanceof u?t:(r.Log.warn((0,r._isServerEnv)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new u(null!=e?e:"",{}))}constructor(e,t,n=null){var i,a;r.SDKType._setClientType(e,"javascript-client");const u=new o.default(n,(e=>{this.$emt(e)}));super(e,null!==(i=null==n?void 0:n.dataAdapter)&&void 0!==i?i:new l.StatsigEvaluationsDataAdapter,u,n),this._possibleFirstTouchMetadata={},this.getFeatureGate=this._memoize(r.MemoPrefix._gate,this._getFeatureGateImpl.bind(this)),this.getDynamicConfig=this._memoize(r.MemoPrefix._dynamicConfig,this._getDynamicConfigImpl.bind(this)),this.getExperiment=this._memoize(r.MemoPrefix._experiment,this._getExperimentImpl.bind(this)),this.getConfigList=this._memoize(r.MemoPrefix._configList,this._getConfigListImpl.bind(this)),this.getLayer=this._memoize(r.MemoPrefix._layer,this._getLayerImpl.bind(this)),this.getParameterStore=this._memoize(r.MemoPrefix._paramStore,this._getParameterStoreImpl.bind(this)),this._store=new s.default(e),this._network=u,this._user=this._configureUser(t,n),this._sdkInstanceID=(0,r.getUUID)();const c=null!==(a=null==n?void 0:n.plugins)&&void 0!==a?a:[];for(const e of c)e.bind(this)}initializeSync(e){var t;return"Uninitialized"!==this.loadingStatus?(0,r.createUpdateDetails)(!0,this._store.getSource(),-1,null,null,["MultipleInitializations",...null!==(t=this._store.getWarnings())&&void 0!==t?t:[]]):(this._logger.start(),this.updateUserSync(this._user,e))}initializeAsync(e){return i(this,void 0,void 0,(function*(){return this._initializePromise||(this._initializePromise=this._initializeAsyncImpl(e)),this._initializePromise}))}updateUserSync(e,t){const n=performance.now();try{return this._updateUserSyncImpl(e,t,n)}catch(e){const t=e instanceof Error?e:new Error(String(e));return this._createErrorUpdateDetails(t,n)}}_updateUserSyncImpl(e,t,n){var i;const s=[...null!==(i=this._store.getWarnings())&&void 0!==i?i:[]];this._resetForUser(e);const o=this.dataAdapter.getDataSync(this._user);null==o&&s.push("NoCachedValues"),this._store.setValues(o,this._user),this._finalizeUpdate(o);const a=null==t?void 0:t.disableBackgroundCacheRefresh;return!0===a||null==a&&"Bootstrap"===(null==o?void 0:o.source)||this._runPostUpdate(null!=o?o:null,this._user),(0,r.createUpdateDetails)(!0,this._store.getSource(),performance.now()-n,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),s)}updateUserAsync(e,t){return i(this,void 0,void 0,(function*(){const n=performance.now();try{return yield this._updateUserAsyncImpl(e,t)}catch(e){const t=e instanceof Error?e:new Error(String(e));return this._createErrorUpdateDetails(t,n)}}))}_updateUserAsyncImpl(e,t){return i(this,void 0,void 0,(function*(){this._resetForUser(e);const n=this._user;r.Diagnostics._markInitOverallStart(this._sdkKey);let i=this.dataAdapter.getDataSync(n);if(this._store.setValues(i,this._user),this._setStatus("Loading",i),i=yield this.dataAdapter.getDataAsync(i,n,t),n!==this._user)return(0,r.createUpdateDetails)(!1,this._store.getSource(),-1,new Error("User changed during update"),this._network.getLastUsedInitUrlAndReset());let s=!1;null!=i&&(r.Diagnostics._markInitProcessStart(this._sdkKey),s=this._store.setValues(i,this._user),r.Diagnostics._markInitProcessEnd(this._sdkKey,{success:s})),this._finalizeUpdate(i),s||(this._errorBoundary.attachErrorIfNoneExists(r.UPDATE_DETAIL_ERROR_MESSAGES.NO_NETWORK_DATA),this.$emt({name:"initialization_failure"})),r.Diagnostics._markInitOverallEnd(this._sdkKey,s,this._store.getCurrentSourceDetails());const o=r.Diagnostics._enqueueDiagnosticsEvent(this._user,this._logger,this._sdkKey,this._options);return(0,r.createUpdateDetails)(s,this._store.getSource(),o,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),this._store.getWarnings())}))}getContext(){return{sdkKey:this._sdkKey,options:this._options,values:this._store.getValues(),user:JSON.parse(JSON.stringify(this._user)),errorBoundary:this._errorBoundary,session:r.StatsigSession.get(this._sdkKey),stableID:r.StableID.get(this._sdkKey),sdkInstanceID:this._sdkInstanceID}}checkGate(e,t){return this.getFeatureGate(e,t).value}logEvent(e,t,n){const i="string"==typeof e?{eventName:e,value:t,metadata:n}:e;this.$emt({name:"log_event_called",event:i}),this._logger.enqueue(Object.assign(Object.assign({},i),{user:this._user,time:Date.now()}))}updateUserWithAnalyticsOnlyMetadata(e){this._user=this._configureUser(Object.assign(Object.assign({},this._user),{analyticsOnlyMetadata:e}),this._options)}_primeReadyRipcord(){this.$on("error",(()=>{"Loading"===this.loadingStatus&&this._finalizeUpdate(null)}))}_initializeAsyncImpl(e){return i(this,void 0,void 0,(function*(){return r.Storage.isReady()||(yield r.Storage.isReadyResolver()),this._logger.start(),this.updateUserAsync(this._user,e)}))}_createErrorUpdateDetails(e,t){var n;return(0,r.createUpdateDetails)(!1,this._store.getSource(),performance.now()-t,e,null,[...null!==(n=this._store.getWarnings())&&void 0!==n?n:[]])}_finalizeUpdate(e){this._store.finalize(),this._setStatus("Ready",e)}_runPostUpdate(e,t){this.dataAdapter.getDataAsync(e,t,{priority:"low"}).catch((e=>{r.Log.error("An error occurred after update.",e)}))}_resetForUser(e){this._logger.reset(),this._store.reset(),this._user=this._configureUser(e,this._options)}_configureUser(e,t){var n,i,s;const o=(0,r._normalizeUser)(e,t),a=null===(n=o.customIDs)||void 0===n?void 0:n.stableID;if(a){const e=null===(s=(i=this.storageProvider).isReadyResolver)||void 0===s?void 0:s.call(i);e?e.then((()=>r.StableID.setOverride(a,this._sdkKey)),(()=>r.StableID.setOverride(a,this._sdkKey))):r.StableID.setOverride(a,this._sdkKey)}return Object.keys(this._possibleFirstTouchMetadata).length>0&&(o.analyticsOnlyMetadata=Object.assign(Object.assign({},o.analyticsOnlyMetadata),this._possibleFirstTouchMetadata)),o}_getFeatureGateImpl(e,t){var n,i;const{result:s,details:o}=this._store.getGate(e),a=(0,r._makeFeatureGate)(e,o,s),l=null===(i=null===(n=this.overrideAdapter)||void 0===n?void 0:n.getGateOverride)||void 0===i?void 0:i.call(n,a,this._user,t),u=null!=l?l:a;return this._enqueueExposure(e,(0,r._createGateExposure)(this._user,u,this._store.getExposureMapping()),t),this.$emt({name:"gate_evaluation",gate:u}),u}_getDynamicConfigImpl(e,t){var n,i;const{result:s,details:o}=this._store.getConfig(e),a=(0,r._makeDynamicConfig)(e,o,s),l=null===(i=null===(n=this.overrideAdapter)||void 0===n?void 0:n.getDynamicConfigOverride)||void 0===i?void 0:i.call(n,a,this._user,t),u=null!=l?l:a;return this._enqueueExposure(e,(0,r._createConfigExposure)(this._user,u,this._store.getExposureMapping()),t),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:u}),u}_getExperimentImpl(e,t){var n,i,s,o;const{result:a,details:l}=this._store.getConfig(e),u=(0,r._makeExperiment)(e,l,a);null!=u.__evaluation&&(u.__evaluation.secondary_exposures=(0,r._mapExposures)(null!==(i=null===(n=u.__evaluation)||void 0===n?void 0:n.secondary_exposures)&&void 0!==i?i:[],this._store.getExposureMapping()));const c=null===(o=null===(s=this.overrideAdapter)||void 0===s?void 0:s.getExperimentOverride)||void 0===o?void 0:o.call(s,u,this._user,t),d=null!=c?c:u;return this._enqueueExposure(e,(0,r._createConfigExposure)(this._user,d,this._store.getExposureMapping()),t),this.$emt({name:"experiment_evaluation",experiment:d}),d}_getConfigListImpl(){return this._store.getConfigList()}_getLayerImpl(e,t){var n,i,s;const{result:o,details:a}=this._store.getLayer(e),l=(0,r._makeLayer)(e,a,o),u=null===(i=null===(n=this.overrideAdapter)||void 0===n?void 0:n.getLayerOverride)||void 0===i?void 0:i.call(n,l,this._user,t);(null==t?void 0:t.disableExposureLog)&&this._logger.incrementNonExposureCount(e);const c=(0,r._mergeOverride)(l,u,null!==(s=null==u?void 0:u.__value)&&void 0!==s?s:l.__value,(n=>{(null==t?void 0:t.disableExposureLog)||this._enqueueExposure(e,(0,r._createLayerParameterExposure)(this._user,c,n,this._store.getExposureMapping()),t)}));return this.$emt({name:"layer_evaluation",layer:c}),c}_getParameterStoreImpl(e,t){var n,i;const{result:r,details:s}=this._store.getParamStore(e);this._logger.incrementNonExposureCount(e);const o={name:e,details:s,__configuration:r,get:(0,a._makeParamStoreGetter)(this,r,t)},l=null===(i=null===(n=this.overrideAdapter)||void 0===n?void 0:n.getParamStoreOverride)||void 0===i?void 0:i.call(n,o,t);return null!=l&&(o.__configuration=l.config,o.details=l.details,o.get=(0,a._makeParamStoreGetter)(this,l.config,t)),o}}t.default=u},2004:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigEvaluationsDataAdapter=void 0;const r=n(4485),s=n(787);class o extends r.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this._network=null,this._options=null}attach(e,t,n){super.attach(e,t,n),null!==n&&n instanceof s.default?this._network=n:this._network=new s.default(null!=t?t:{})}getDataAsync(e,t,n){return this._getDataAsyncImpl(e,(0,r._normalizeUser)(t,this._options),n)}prefetchData(e,t){return this._prefetchDataImpl(e,t)}setData(e){const t=(0,r._typedJsonParse)(e,"has_updates","data");t&&"user"in t?super.setData(e,t.user):r.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(e,t){super.setData(e,t)}_fetchFromNetwork(e,t,n,r){return i(this,void 0,void 0,(function*(){var i;const s=yield null===(i=this._network)||void 0===i?void 0:i.fetchEvaluations(this._getSdkKey(),e,null==n?void 0:n.priority,t,r);return null!=s?s:null}))}_getCacheKey(e){var t;const n=(0,r._getStorageKey)(this._getSdkKey(),e,null===(t=this._options)||void 0===t?void 0:t.customUserCacheKeyFunc);return`${r.DataAdapterCachePrefix}.${this._cacheSuffix}.${n}`}_isCachedResultValidFor204(e,t){return null!=e.fullUserHash&&e.fullUserHash===(0,r._getFullUserHash)(t)}}t.StatsigEvaluationsDataAdapter=o},2051:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.V1InitializeContainer=void 0;const i=n(4485);t.V1InitializeContainer=class{constructor(e){this._values=e}getGate(e){return this._getResultFromLookup(this._values.feature_gates,e)}getConfig(e){return this._getResultFromLookup(this._values.dynamic_configs,e)}getLayer(e){return this._getResultFromLookup(this._values.layer_configs,e)}getParamStore(e){return this._getResultFromLookup(this._values.param_stores,e)}getConfigList(){return Object.keys(this._values.dynamic_configs)}getExposureMapping(){return this._values.exposures}_getResultFromLookup(e,t){var n,r;return e&&null!==(r=null!==(n=e[t])&&void 0!==n?n:e[(0,i._DJB2)(t)])&&void 0!==r?r:null}}},2920:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.V2InitializeContainer=void 0;const i=n(4485);t.V2InitializeContainer=class{constructor(e){this._values=e}getGate(e){var t,n,i;const r=this._getResultFromLookup(this._values.feature_gates,e);return r?{name:e,value:!0===r.v,rule_id:null!==(t=r.r)&&void 0!==t?t:"default",secondary_exposures:null!==(n=r.s)&&void 0!==n?n:[],id_type:null!==(i=r.i)&&void 0!==i?i:""}:null}getConfig(e){var t,n,i,r;const s=this._getResultFromLookup(this._values.dynamic_configs,e);return s?{name:e,value:null!==(t=this._values.values[s.v])&&void 0!==t?t:{},rule_id:s.r,secondary_exposures:null!==(n=s.s)&&void 0!==n?n:[],id_type:null!==(i=s.i)&&void 0!==i?i:"",is_user_in_experiment:!0===s.ue,passed:!0===s.p,group_name:null!==(r=s.gn)&&void 0!==r?r:void 0,is_experiment_active:!0===s.ea,group:s.r,is_device_based:"stableID"===s.i}:null}getLayer(e){var t,n,i,r,s,o;const a=this._getResultFromLookup(this._values.layer_configs,e);return a?{name:e,value:null!==(t=this._values.values[a.v])&&void 0!==t?t:{},rule_id:a.r,secondary_exposures:null!==(n=a.s)&&void 0!==n?n:[],is_user_in_experiment:!0===a.ue,group_name:null!==(i=a.gn)&&void 0!==i?i:void 0,is_experiment_active:!0===a.ea,group:a.r,is_device_based:"stableID"===a.i,allocated_experiment_name:null!==(r=a.ae)&&void 0!==r?r:"",explicit_parameters:null!==(s=a.ep)&&void 0!==s?s:[],undelegated_secondary_exposures:null!==(o=a.us)&&void 0!==o?o:[],parameter_rule_ids:a.pr}:null}getParamStore(e){return this._getResultFromLookup(this._values.param_stores,e)}getConfigList(){return Object.keys(this._values.dynamic_configs)}getExposureMapping(){return this._values.exposures}_getResultFromLookup(e,t){var n,r;return e&&null!==(r=null!==(n=e[t])&&void 0!==n?n:e[(0,i._DJB2)(t)])&&void 0!==r?r:null}}},2869:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigClient=void 0;const s=n(4485),o=n(8533);t.StatsigClient=o.default,r(n(4485),t);const a=Object.assign((0,s._getStatsigGlobal)(),{StatsigClient:o.default});t.default=a},2169:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.LocalOverrideAdapter=void 0;const r=n(4485),s="LocalOverride:Recognized";t.LocalOverrideAdapter=class{constructor(e){this._overrides={gate:{},dynamicConfig:{},experiment:{},layer:{},paramStore:{}},this._sdkKey=null!=e?e:null}_getLocalOverridesStorageKey(e){return`statsig.local-overrides.${(0,r._getStorageKey)(e)}`}loadFromStorage(){return i(this,void 0,void 0,(function*(){if(null==this._sdkKey)return;r.Storage.isReady()||(yield r.Storage.isReadyResolver());const e=this._getLocalOverridesStorageKey(this._sdkKey),t=r.Storage.getItem(e),n=t?(0,r._typedJsonParse)(t,"gate","LocalOverrideAdapter overrides"):null,i=this._hasInMemoryOverrides();var s,o;n&&(this._overrides=i?(s=n,o=this._overrides,{gate:Object.assign({},s.gate,o.gate),dynamicConfig:Object.assign({},s.dynamicConfig,o.dynamicConfig),experiment:Object.assign({},s.experiment,o.experiment),layer:Object.assign({},s.layer,o.layer),paramStore:Object.assign({},s.paramStore,o.paramStore)}):n),i&&this._saveOverridesToStorage()}))}_saveOverridesToStorage(){if(null==this._sdkKey||!r.Storage.isReady())return;const e=this._getLocalOverridesStorageKey(this._sdkKey);r.Storage.setItem(e,JSON.stringify(this._overrides))}overrideGate(e,t){this._overrides.gate[e]=t,this._overrides.gate[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}_warnIfStorageNotReady(){r.Storage.isReady()||r.Log.warn("Storage is not ready. Override removal may not persist.")}removeGateOverride(e){this._warnIfStorageNotReady(),delete this._overrides.gate[e],delete this._overrides.gate[(0,r._DJB2)(e)],this._saveOverridesToStorage()}getGateOverride(e,t){var n;const i=null!==(n=this._overrides.gate[e.name])&&void 0!==n?n:this._overrides.gate[(0,r._DJB2)(e.name)];return null==i?null:Object.assign(Object.assign({},e),{value:i,details:Object.assign(Object.assign({},e.details),{reason:s})})}overrideDynamicConfig(e,t){this._overrides.dynamicConfig[e]=t,this._overrides.dynamicConfig[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}removeDynamicConfigOverride(e){this._warnIfStorageNotReady(),delete this._overrides.dynamicConfig[e],delete this._overrides.dynamicConfig[(0,r._DJB2)(e)],this._saveOverridesToStorage()}getDynamicConfigOverride(e,t){return this._getConfigOverride(e,this._overrides.dynamicConfig)}overrideExperiment(e,t){this._overrides.experiment[e]=t,this._overrides.experiment[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}removeExperimentOverride(e){this._warnIfStorageNotReady(),delete this._overrides.experiment[e],delete this._overrides.experiment[(0,r._DJB2)(e)],this._saveOverridesToStorage()}getExperimentOverride(e,t){return this._getConfigOverride(e,this._overrides.experiment)}overrideLayer(e,t){this._overrides.layer[e]=t,this._overrides.layer[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}removeLayerOverride(e){this._warnIfStorageNotReady(),delete this._overrides.layer[e],delete this._overrides.layer[(0,r._DJB2)(e)],this._saveOverridesToStorage()}overrideParamStore(e,t){this._overrides.paramStore[e]=t,this._overrides.paramStore[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}removeParamStoreOverride(e){this._warnIfStorageNotReady(),delete this._overrides.paramStore[e],delete this._overrides.paramStore[(0,r._DJB2)(e)],this._saveOverridesToStorage()}getParamStoreOverride(e){var t;const n=null!==(t=this._overrides.paramStore[e.name])&&void 0!==t?t:this._overrides.paramStore[(0,r._DJB2)(e.name)];if(null==n)return null;const i=Object.assign({},e.__configuration||{});for(const[e,t]of Object.entries(n)){const n=this._inferParamType(t);i[e]={ref_type:"static",param_type:n,value:t}}return{config:i,details:Object.assign(Object.assign({},e.details),{reason:s})}}getAllOverrides(){return JSON.parse(JSON.stringify(this._overrides))}removeAllOverrides(){this._warnIfStorageNotReady(),this._overrides={gate:{},dynamicConfig:{},experiment:{},layer:{},paramStore:{}},this._saveOverridesToStorage()}getLayerOverride(e,t){var n;const i=null!==(n=this._overrides.layer[e.name])&&void 0!==n?n:this._overrides.layer[(0,r._DJB2)(e.name)];return null==i?null:Object.assign(Object.assign({},e),{__value:i,get:(0,r._makeTypedGet)(e.name,i),details:Object.assign(Object.assign({},e.details),{reason:s})})}_getConfigOverride(e,t){var n;const i=null!==(n=t[e.name])&&void 0!==n?n:t[(0,r._DJB2)(e.name)];return null==i?null:Object.assign(Object.assign({},e),{value:i,get:(0,r._makeTypedGet)(e.name,i),details:Object.assign(Object.assign({},e.details),{reason:s})})}_hasInMemoryOverrides(){return Object.keys(this._overrides.gate).length>0||Object.keys(this._overrides.dynamicConfig).length>0||Object.keys(this._overrides.experiment).length>0||Object.keys(this._overrides.layer).length>0||Object.keys(this._overrides.paramStore).length>0}_inferParamType(e){return"string"==typeof e?"string":"boolean"==typeof e?"boolean":"number"==typeof e?"number":Array.isArray(e)?"array":"object"}}},4239:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(2169),t)},156:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AutoCapture=t.runStatsigAutoCapture=t.StatsigAutoCapturePlugin=void 0;const i=n(4485),r=n(4702),s=n(4067),o=n(4886),a=n(9341),l=n(4373),u=n(6959),c=n(2735),d=n(6596),g=n(6499),_={submit:r.AutoCaptureEventName.FORM_SUBMIT,click:r.AutoCaptureEventName.CLICK,copy:r.AutoCaptureEventName.COPY,cut:r.AutoCaptureEventName.COPY};function h(e,t){var n;if((0,i._isServerEnv)())return null;const{sdkKey:r}=e.getContext();if(!(0,i._isServerEnv)()){const e=null!==(n=(0,i._getStatsigGlobal)().acInstances)&&void 0!==n?n:{};if(e[r])return e[r]}return new v(e,t)}t.StatsigAutoCapturePlugin=class{constructor(e){this._options=e,this.__plugin="auto-capture"}bind(e){h(e,this._options)}},t.runStatsigAutoCapture=h;class v{constructor(e,t){var n,r,c,d;this._client=e,this._disabledEvents={},this._previousLoggedPageViewUrl=null,this._hasLoggedPageViewEnd=!1,this._pageViewLogged=!1;const{sdkKey:g,errorBoundary:_,values:h}=e.getContext();this._options=t,this._disabledEvents=null!==(r=null===(n=null==h?void 0:h.auto_capture_settings)||void 0===n?void 0:n.disabled_events)&&void 0!==r?r:{},this._errorBoundary=_,this._errorBoundary.wrap(this,"autoCapture:"),this._client.$on("values_updated",(()=>{var e,t;const n=this._client.getContext().values;this._disabledEvents=null!==(t=null===(e=null==n?void 0:n.auto_capture_settings)||void 0===e?void 0:e.disabled_events)&&void 0!==t?t:this._disabledEvents})),this._engagementManager=new a.EngagementManager,this._rageClickManager=new l.default,this._webVitalsManager=new u.WebVitalsManager(this._enqueueAutoCapture.bind(this),_),this._deadClickManager=new o.default(this._enqueueAutoCapture.bind(this),_),this._consoleLogManager=new s.ConsoleLogManager(this._enqueueAutoCapture.bind(this),_,null!==(c=null==t?void 0:t.consoleLogAutoCaptureSettings)&&void 0!==c?c:{enabled:!1}),this._eventFilterFunc=null==t?void 0:t.eventFilterFunc;const v=(0,i._getDocumentSafe)();if(!(0,i._isServerEnv)()){__STATSIG__=(0,i._getStatsigGlobal)();const e=null!==(d=__STATSIG__.acInstances)&&void 0!==d?d:{};e[g]=this,__STATSIG__.acInstances=e}"loading"!==(null==v?void 0:v.readyState)?this._initialize():v.addEventListener("DOMContentLoaded",(()=>this._initialize()))}_addEventHandlers(){const e=(0,i._getWindowSafe)(),t=(0,i._getDocumentSafe)();if(!e||!t)return;const n=(e,t=!0)=>{var n;const r=e||(null===(n=(0,i._getWindowSafe)())||void 0===n?void 0:n.event);this._autoLogEvent(r),t&&this._engagementManager.bumpInactiveTimer(),"click"===r.type&&r instanceof MouseEvent&&this._rageClickManager.isRageClick(r.clientX,r.clientY,Date.now())&&this._logRageClick(r)};(0,c._registerEventHandler)(t,"click",(e=>n(e))),(0,c._registerEventHandler)(t,"submit",(e=>n(e))),(0,c._registerEventHandler)(t,"copy",(e=>n(e))),(0,c._registerEventHandler)(t,"cut",(e=>n(e))),(0,c._registerEventHandler)(e,"error",(e=>n(e,!1))),(0,c._registerEventHandler)(e,"pagehide",(()=>this._tryLogPageViewEnd())),(0,c._registerEventHandler)(e,"beforeunload",(()=>this._tryLogPageViewEnd()))}_addPageViewTracking(){const e=(0,i._getWindowSafe)(),t=(0,i._getDocumentSafe)();if(e&&t){if((0,c._registerEventHandler)(e,"popstate",(()=>this._tryLogPageView("popstate"))),e.history&&"function"==typeof Proxy&&"function"==typeof e.history.pushState)try{const t=e.history.pushState;e.history.pushState=new Proxy(t,{apply:(e,t,[n,i,r])=>{const s=e.apply(t,[n,i,r]);return this._tryLogPageView("pushstate"),s}})}catch(e){}if(e.history&&"function"==typeof Proxy&&"function"==typeof e.history.replaceState)try{const t=e.history.replaceState;e.history.replaceState=new Proxy(t,{apply:(e,t,[n,i,r])=>{const s=e.apply(t,[n,i,r]);return this._tryLogPageView("replacestate"),s}})}catch(e){}this._tryLogPageView()}}_autoLogEvent(e){var t,n,s,o;const a=null===(t=e.type)||void 0===t?void 0:t.toLowerCase();if("error"===a&&e instanceof ErrorEvent)return void this._logError(e);const l=(0,c._getTargetNode)(e);if(!l)return;const u=_[a];if(!u)return;const h=u===r.AutoCaptureEventName.COPY;if(!(0,c._shouldLogEvent)(e,l,h))return;const v={};if(h){const t=null===(s=null===(n=(0,i._getWindowSafe)())||void 0===n?void 0:n.getSelection())||void 0===s?void 0:s.toString();if(!t)return;(null===(o=this._options)||void 0===o?void 0:o.captureCopyText)&&(v.selectedText=(0,c._sanitizeString)(t));const r=e.type||"clipboard";v.clipType=r}const{value:f,metadata:p}=(0,d._gatherEventData)(l);p.isOutbound&&this._engagementManager.setMeaningfulEngagementOccurred(!0),Object.assign(v,p);const m=(0,g._gatherAllMetadata)((0,c._getSafeUrl)());this._enqueueAutoCapture(u,f,Object.assign(Object.assign({},m),v))}_initialize(){this._webVitalsManager.startTracking(),this._deadClickManager.startTracking(),this._consoleLogManager.startTracking(),this._engagementManager.startInactivityTracking((()=>this._tryLogPageViewEnd(!0))),this._addEventHandlers(),this._addPageViewTracking(),this._logSessionStart(),this._logPerformance()}_logError(e){const t=(null==e?void 0:e.error)||{};let n=t;if("object"==typeof t)try{n=JSON.stringify(t)}catch(e){n="function"==typeof(null==t?void 0:t.toString)?t.toString():"Unknown Error"}this._enqueueAutoCapture(r.AutoCaptureEventName.ERROR,e.message,{message:e.message,filename:e.filename,lineno:e.lineno,colno:e.colno,error_str:n})}_logSessionStart(){const e=this._getSessionFromClient();try{if(!this._isNewSession(e))return;this._enqueueAutoCapture(r.AutoCaptureEventName.SESSION_START,(0,c._getSanitizedPageUrl)(),Object.assign({sessionID:e.data.sessionID},(0,g._gatherAllMetadata)((0,c._getSafeUrl)())),{flushImmediately:!0})}catch(e){this._errorBoundary.logError("AC::logSession",e)}}_tryLogPageView(e){const t=(0,c._getSafeUrl)(),n=this._previousLoggedPageViewUrl;if(n&&t.pathname===n.pathname)return;this._engagementManager.setLastPageViewTime(Date.now()),this._hasLoggedPageViewEnd=!1;const i=(0,g._gatherAllMetadata)(t);e&&(i.navigation_type=e),this._previousLoggedPageViewUrl&&(i.last_page_view_url=this._previousLoggedPageViewUrl.href),this._pageViewLogged||(this._updateClientWithPossibleFirstTouchMetadata(),this._pageViewLogged=!0),this._enqueueAutoCapture(r.AutoCaptureEventName.PAGE_VIEW,(0,c._getSanitizedPageUrl)(),i,{flushImmediately:!0,addNewSessionMetadata:!0}),this._previousLoggedPageViewUrl=t,this._engagementManager.bumpInactiveTimer()}_tryLogPageViewEnd(e=!1){this._hasLoggedPageViewEnd||(this._hasLoggedPageViewEnd=!0,this._enqueueAutoCapture(r.AutoCaptureEventName.PAGE_VIEW_END,(0,c._getSanitizedPageUrl)(),Object.assign(Object.assign({},this._engagementManager.getPageViewEndMetadata()),{dueToInactivity:e}),{flushImmediately:!0}))}_logRageClick(e){if(!(0,c._shouldLogEvent)(e,e.target))return;const{value:t,metadata:n}=(0,d._gatherEventData)(e.target);this._enqueueAutoCapture(r.AutoCaptureEventName.RAGE_CLICK,t,Object.assign(Object.assign({x:e.clientX,y:e.clientY,timestamp:Date.now()},(0,g._gatherAllMetadata)((0,c._getSafeUrl)())),n))}_logPerformance(){const e=(0,i._getWindowSafe)();e&&e.performance&&void 0!==(null==e?void 0:e.performance)&&"function"==typeof e.performance.getEntriesByType&&"function"==typeof e.performance.getEntriesByName&&setTimeout((()=>{const t={},n=e.performance.getEntriesByType("navigation");if(n&&n.length>0&&n[0]instanceof PerformanceNavigationTiming){const e=n[0];t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize}const i=e.performance.getEntriesByName("first-contentful-paint");i&&i.length>0&&i[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=i[0].startTime),this._enqueueAutoCapture(r.AutoCaptureEventName.PERFORMANCE,(0,c._getSanitizedPageUrl)(),Object.assign(Object.assign({},t),(0,g._getNetworkInfo)()))}),1)}_enqueueAutoCapture(e,t,n,r){var s,o,a;if(!t)return;const l=e.slice(14);if(this._disabledEvents[e]||this._disabledEvents[l])return;const u=this._getSessionFromClient();try{const l=Object.assign({sessionID:u.data.sessionID,page_url:null!==(a=null===(o=null===(s=(0,i._getWindowSafe)())||void 0===s?void 0:s.location)||void 0===o?void 0:o.href)&&void 0!==a?a:""},n);(null==r?void 0:r.addNewSessionMetadata)&&(l.isNewSession=String(this._isNewSession(u)));const c={eventName:e,value:t,metadata:l};if(this._eventFilterFunc&&!this._eventFilterFunc(c))return;this._client.logEvent(c),(null==r?void 0:r.flushImmediately)&&this._flushImmediately()}catch(e){this._errorBoundary.logError("AC::enqueue",e)}}_updateClientWithPossibleFirstTouchMetadata(){const e=this._client;e._possibleFirstTouchMetadata=(0,g._getPossibleFirstTouchMetadata)((0,c._getSafeUrl)()),Object.keys(e._possibleFirstTouchMetadata).length>0&&(e._user=Object.assign(Object.assign({},e._user),{analyticsOnlyMetadata:Object.assign(Object.assign({},e._possibleFirstTouchMetadata),e._user.analyticsOnlyMetadata)}))}_flushImmediately(){this._client.flush().catch((e=>{i.Log.error(e)}))}_isNewSession(e){return Math.abs(e.data.startTime-Date.now())<1e3}_getSessionFromClient(){return this._client.getContext().session}static getAllMetadata(){return(0,g._gatherAllMetadata)((0,c._getSafeUrl)())}}t.AutoCapture=v},4702:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AutoCaptureEventName=void 0,t.AutoCaptureEventName={PAGE_VIEW:"auto_capture::page_view",PAGE_VIEW_END:"auto_capture::page_view_end",ERROR:"auto_capture::error",SESSION_START:"auto_capture::session_start",PERFORMANCE:"auto_capture::performance",FORM_SUBMIT:"auto_capture::form_submit",CLICK:"auto_capture::click",RAGE_CLICK:"auto_capture::rage_click",WEB_VITALS:"auto_capture::web_vitals",DEAD_CLICK:"auto_capture::dead_click",COPY:"auto_capture::copy",CONSOLE_LOG:"statsig::log_line"}},4067:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConsoleLogManager=void 0;const i=n(4485),r=n(4702),s=n(2735),o=n(7658),a=n(6499),l={trace:10,debug:20,log:30,info:30,warn:40,error:50};t.ConsoleLogManager=class{constructor(e,t,n){var i,r,s,o;this._enqueueFn=e,this._errorBoundary=t,this._options=n,this._restoreFns=[],this._isTracking=!1,this._logLevel="info",this.__source="js-auto-capture",this._logLevel=null!==(i=this._options.logLevel)&&void 0!==i?i:"info",this._maxKeys=null!==(r=this._options.maxKeys)&&void 0!==r?r:50,this._maxDepth=null!==(s=this._options.maxDepth)&&void 0!==s?s:10,this._maxStringLength=null!==(o=this._options.maxStringLength)&&void 0!==o?o:2500}startTracking(){try{if(this._isTracking||!this._options.enabled)return;if(!(0,i._getWindowSafe)())return;this._patchConsole(),this._isTracking=!0}catch(e){i.Log.error("Error starting console log tracking",e),this._errorBoundary.logError("autoCapture:ConsoleLogManager",e)}}stopTracking(){this._isTracking&&(this._restoreFns.forEach((e=>e())),this._restoreFns=[],this._isTracking=!1)}_patchConsole(){Object.entries(l).forEach((([e,t])=>{if(t<l[this._logLevel])return;if(!console[e])return;const n=console[e].bind(console);let i=!1;const r=(0,s.wrapFunctionWithRestore)(console,e,(t=>(...r)=>{if(t(...r),!i){i=!0;try{const t=r.map((e=>(0,o._safeStringify)(e,this._maxKeys,this._maxDepth,this._maxStringLength))),n=(0,o._getStackTrace)();this._enqueueConsoleLog(e,t,n)}catch(e){n("console observer error:",e,...r),this._errorBoundary.logError("autoCapture:ConsoleLogManager",e)}finally{i=!1}}}));this._restoreFns.push(r)}))}_enqueueConsoleLog(e,t,n){if(!this._shouldLog(t))return;const i=Object.assign({status:"log"===e?"info":e,log_level:e,payload:t,trace:n,timestamp:Date.now(),source:this.__source},(0,a._gatherAllMetadata)((0,s._getSafeUrl)()));this._enqueueFn(r.AutoCaptureEventName.CONSOLE_LOG,t.join(" "),i)}_shouldLog(e){for(const t of e)if(t.includes("[Statsig]"))return!1;return!this._options.sampleRate||"number"!=typeof this._options.sampleRate||this._options.sampleRate<=0||this._options.sampleRate>=1||Math.random()<this._options.sampleRate}}},4886:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DeadClickConfig=void 0;const i=n(4485),r=n(4702),s=n(2735),o=n(6596),a=n(6499);t.DeadClickConfig={CLICK_CHECK_TIMEOUT:1e3,SCROLL_DELAY_MS:100,SELECTION_CHANGE_DELAY_MS:100,MUTATION_DELAY_MS:2500,ABSOLUTE_DEAD_CLICK_TIMEOUT:2750},t.default=class{constructor(e,n){this._enqueueFn=e,this._errorBoundary=n,this._lastMutationTime=0,this._lastSelectionChangeTime=0,this._clicks=[],this._deadClickConfig=t.DeadClickConfig,this._handleScroll=(0,s.throttle)((()=>{const e=Date.now();this._clicks.forEach((t=>{t.scrollDelayMs||(t.scrollDelayMs=e-t.timestamp)}))}),50)}startTracking(){try{const e=(0,i._getWindowSafe)();if(!e)return;e.addEventListener("click",(e=>this._handleClick(e)),{capture:!0}),e.addEventListener("scroll",(()=>this._handleScroll()),{capture:!0,passive:!0}),e.addEventListener("selectionchange",(()=>this._handleSelectionChange())),this._setupMutationObserver()}catch(e){i.Log.error("Error starting dead click tracking",e),this._errorBoundary.logError("autoCapture:DeadClickManager",e)}}_handleClick(e){var t,n;const r=e.target;if(!r)return;const o={timestamp:Date.now(),eventTarget:r};s.interactiveElements.includes(null===(t=null==r?void 0:r.tagName)||void 0===t?void 0:t.toLowerCase())||this._clicks.push(o),this._clicks.length&&!this._clickCheckTimer&&(this._clickCheckTimer=null===(n=(0,i._getWindowSafe)())||void 0===n?void 0:n.setTimeout((()=>{this._checkForDeadClick()}),this._deadClickConfig.CLICK_CHECK_TIMEOUT))}_handleSelectionChange(){this._lastSelectionChangeTime=Date.now()}_setupMutationObserver(){const e=(0,i._getDocumentSafe)();e&&(this._observer=new MutationObserver((()=>{this._lastMutationTime=Date.now()})),this._observer.observe(e.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0}))}_checkForDeadClick(){var e;if(!this._clicks.length)return;clearTimeout(this._clickCheckTimer),this._clickCheckTimer=void 0;const t=this._clicks;this._clicks=[];for(const e of t){this._updateClickDelayMs(e);const t=null!=e.scrollDelayMs&&e.scrollDelayMs<this._deadClickConfig.SCROLL_DELAY_MS,n=null!=e.selectionChangeDelayMs&&e.selectionChangeDelayMs<this._deadClickConfig.SELECTION_CHANGE_DELAY_MS,i=null!=e.mutationDelayMs&&e.mutationDelayMs<this._deadClickConfig.MUTATION_DELAY_MS;if(t||n||i)continue;const r=null!=e.scrollDelayMs&&e.scrollDelayMs>this._deadClickConfig.SCROLL_DELAY_MS,s=null!=e.selectionChangeDelayMs&&e.selectionChangeDelayMs>this._deadClickConfig.SELECTION_CHANGE_DELAY_MS,o=null!=e.mutationDelayMs&&e.mutationDelayMs>this._deadClickConfig.MUTATION_DELAY_MS,a=null!=e.absoluteDelayMs&&e.absoluteDelayMs>this._deadClickConfig.ABSOLUTE_DEAD_CLICK_TIMEOUT;r||s||o||a?this._logDeadClick(e,{scrollTimeout:r,selectionChangeTimeout:s,mutationTimeout:o,absoluteTimeout:a}):null!=e.absoluteDelayMs&&e.absoluteDelayMs<this._deadClickConfig.ABSOLUTE_DEAD_CLICK_TIMEOUT&&this._clicks.push(e)}this._clicks.length&&!this._clickCheckTimer&&(this._clickCheckTimer=null===(e=(0,i._getWindowSafe)())||void 0===e?void 0:e.setTimeout((()=>{this._checkForDeadClick()}),this._deadClickConfig.CLICK_CHECK_TIMEOUT))}_logDeadClick(e,t){const{value:n,metadata:i}=(0,o._gatherEventData)(e.eventTarget);n&&this._enqueueFn(r.AutoCaptureEventName.DEAD_CLICK,n,Object.assign(Object.assign(Object.assign(Object.assign({},i),t),(0,a._gatherCommonMetadata)((0,s._getSafeUrl)())),{scrollDelayMs:e.scrollDelayMs,selectionChangeDelayMs:e.selectionChangeDelayMs,mutationDelayMs:e.mutationDelayMs,absoluteDelayMs:e.absoluteDelayMs}))}_updateClickDelayMs(e){!e.mutationDelayMs&&this._lastMutationTime>0&&e.timestamp<=this._lastMutationTime&&(e.mutationDelayMs=Date.now()-this._lastMutationTime),!e.selectionChangeDelayMs&&this._lastSelectionChangeTime>0&&e.timestamp<=this._lastSelectionChangeTime&&(e.selectionChangeDelayMs=Date.now()-this._lastSelectionChangeTime),e.absoluteDelayMs=Date.now()-e.timestamp}}},9341:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EngagementManager=void 0;const i=n(4485);t.EngagementManager=class{constructor(){this._lastScrollY=0,this._maxScrollY=0,this._lastScrollPercentage=0,this._maxScrollPercentage=0,this._lastPageViewTime=Date.now(),this._inactiveTimer=null,this._onInactivityCallback=null,this._meaningfulEngagementOccurred=!1,this._initializeScrollTracking()}_initializeScrollTracking(){const e=(0,i._getWindowSafe)();e&&(e.addEventListener("scroll",(()=>this._handleScroll())),e.addEventListener("scrollend",(()=>this._handleScroll())),e.addEventListener("resize",(()=>this._handleScroll())))}_handleScroll(){const e=(0,i._getWindowSafe)(),t=(0,i._getDocumentSafe)();if(!e||!t)return;const n=t.body.scrollHeight,r=e.scrollY||t.documentElement.scrollTop||0,s=e.innerHeight;this._lastScrollY=r,this._maxScrollY=Math.max(this._maxScrollY,r);const o=Math.min(100,Math.round((r+s)/n*100));this._lastScrollPercentage=o,this._maxScrollPercentage=Math.max(this._maxScrollPercentage,o),this.bumpInactiveTimer()}getScrollMetrics(){return{lastScrollY:this._lastScrollY,maxScrollY:this._maxScrollY,lastScrollPercentage:this._lastScrollPercentage,maxScrollPercentage:this._maxScrollPercentage,scrollDepth:this._maxScrollPercentage}}getPageViewLength(){return Date.now()-this._lastPageViewTime}setLastPageViewTime(e){this._lastPageViewTime=e}startInactivityTracking(e){this._onInactivityCallback=e}bumpInactiveTimer(){const e=(0,i._getWindowSafe)();e&&(this._inactiveTimer&&clearTimeout(this._inactiveTimer),this._inactiveTimer=e.setTimeout((()=>{this._onInactivityCallback&&this._onInactivityCallback()}),6e5))}setMeaningfulEngagementOccurred(e){this._meaningfulEngagementOccurred=e}getPageViewEndMetadata(){const e=Object.assign(Object.assign({},this.getScrollMetrics()),{pageViewLength:this.getPageViewLength(),meaningfulEngagementOccurred:this._meaningfulEngagementOccurred});return this.setMeaningfulEngagementOccurred(!1),e}}},4373:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this._clicks=[]}isRageClick(e,t,n){return this._clicks=this._clicks.filter((e=>n-e.timestamp<1e3)),this._clicks.length>0&&!(n=>{const i=e-n.x,r=t-n.y;return Math.abs(i)+Math.abs(r)<=30})(this._clicks[this._clicks.length-1])&&(this._clicks=[]),this._clicks.push({x:e,y:t,timestamp:n}),this._clicks.length>=3}}},6959:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WebVitalsManager=void 0;const i=n(5070),r=n(4485),s=n(4702),o=n(2735),a=["CLS","FCP","INP","LCP","TTFB"];t.WebVitalsManager=class{constructor(e,t){this._enqueueFn=e,this._errorBoundary=t,this._isInitialized=!1,this._metricEvent={url:(0,o._getSafeUrlString)(),sanitizedUrl:(0,o._getSanitizedPageUrl)(),metrics:[],firstMetricTimestamp:void 0}}startTracking(){var e,t;try{if(this._isInitialized)return;const n=null===(t=null===(e=(0,r._getWindowSafe)())||void 0===e?void 0:e.location)||void 0===t?void 0:t.protocol;if("https:"!==n&&"http:"!==n)return;(0,i.onCLS)((e=>this._handleMetric(e))),(0,i.onFCP)((e=>this._handleMetric(e))),(0,i.onINP)((e=>this._handleMetric(e))),(0,i.onLCP)((e=>this._handleMetric(e))),(0,i.onTTFB)((e=>this._handleMetric(e))),this._isInitialized=!0}catch(e){r.Log.error("Error starting web vitals tracking",e),this._errorBoundary.logError("autoCapture:WebVitalsManager",e)}}_handleMetric(e){if(void 0===this._metricEvent.firstMetricTimestamp&&(this._metricEvent.firstMetricTimestamp=Date.now()),void 0===e||void 0===(null==e?void 0:e.name))return;const t=(0,o._getSafeUrlString)();if(""===t)return;if(!a.includes(e.name))return;t!==this._metricEvent.url&&(this._enqueueWebVitalsAutoCaptureEvent(),this._metricEvent.url=t);const n=e;this._metricEvent.metrics.push({name:n.name,value:n.value,delta:n.delta,id:n.id}),this._metricEvent.metrics.length===a.length&&this._enqueueWebVitalsAutoCaptureEvent()}_enqueueWebVitalsAutoCaptureEvent(){if(""===this._metricEvent.url||0===this._metricEvent.metrics.length)return;const e={};this._metricEvent.metrics.forEach((t=>{const n=t.name.toLowerCase();e[`${n}_value`]=t.value,e[`${n}_delta`]=t.delta,e[`${n}_id`]=t.id})),this._enqueueFn(s.AutoCaptureEventName.WEB_VITALS,this._metricEvent.sanitizedUrl,Object.assign(Object.assign({},e),{first_metric_timestamp:this._metricEvent.firstMetricTimestamp})),this._metricEvent={url:(0,o._getSafeUrlString)(),sanitizedUrl:(0,o._getSanitizedPageUrl)(),metrics:[],firstMetricTimestamp:void 0}}}},4091:(e,t,n)=>{t.gX=void 0;const i=n(4485),r=n(156);Object.defineProperty(t,"gX",{enumerable:!0,get:function(){return r.runStatsigAutoCapture}});n(4702);Object.assign((0,i._getStatsigGlobal)(),{AutoCapture:r.AutoCapture,runStatsigAutoCapture:r.runStatsigAutoCapture,StatsigAutoCapturePlugin:r.StatsigAutoCapturePlugin})},2735:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.wrapFunctionWithRestore=t.throttle=t._sanitizeString=t._getAnchorNodeInHierarchy=t._getSafeTimezoneOffset=t._getSafeTimezone=t._getSafeNetworkInformation=t._registerEventHandler=t._getSanitizedPageUrl=t._getSafeUrlString=t._getSafeUrl=t._shouldLogEvent=t._getTargetNode=t._stripEmptyValues=t.interactiveElements=void 0;const i=n(4485),r=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),s=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$");function o(){var e,t,n;const r=null!==(n=null===(t=null===(e=(0,i._getWindowSafe)())||void 0===e?void 0:e.location)||void 0===t?void 0:t.href)&&void 0!==n?n:"";let s;try{s=new URL(r)}catch(e){s=new URL("error:")}return s}function a(e){if(!e)return null;let t=e;for(;t;){const e=t.tagName.toLowerCase();if(["body","document"].includes(e))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}return null}t.interactiveElements=["button","a","input","select","textarea","form","select","label"],t._stripEmptyValues=function(e){return Object.fromEntries(Object.entries(e).filter((([e,t])=>null!=t&&""!==t&&void 0!==t)))},t._getTargetNode=function(e){if(!e)return null;let t=e.target||e.srcElement;return t&&t instanceof Element?(3===t.nodeType&&(t=t.parentNode||null),t):null},t._shouldLogEvent=function(e,n,i=!1){if(!e||!n||1!==n.nodeType)return!1;const r=n.tagName.toLowerCase(),s=e.type.toLowerCase();if(n.classList.contains("statsig-no-capture"))return!1;if(i)return!0;switch(r){case"html":return!1;case"form":return["submit"].indexOf(s)>=0;case"input":case"select":case"textarea":return["change","click"].indexOf(s)>=0;default:if("click"===s){const e=window.getComputedStyle(n);if(e&&"pointer"===e.getPropertyValue("cursor"))return!0;if(t.interactiveElements.includes(r))return!0;if("true"===n.getAttribute("contenteditable"))return!0;if(a(n))return!0}return!1}},t._getSafeUrl=o,t._getSafeUrlString=function(){const e=o().toString();return e.startsWith("error:")?"":e},t._getSanitizedPageUrl=function(){return(0,i._getCurrentPageUrlSafe)()||""},t._registerEventHandler=function(e,t,n){e&&e.addEventListener&&e.addEventListener(t,n,!0)},t._getSafeNetworkInformation=function(){const e=(0,i._getWindowSafe)();if(!e||!e.navigator)return null;return e.navigator.connection||null},t._getSafeTimezone=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return null}},t._getSafeTimezoneOffset=function(){try{return(new Date).getTimezoneOffset()}catch(e){return null}},t._getAnchorNodeInHierarchy=a,t._sanitizeString=function(e){return e?e.replace(/<[^>]*>/g,"").trim().split(/(\s+)/).filter((e=>{return t=e,!r.test((t||"").replace(/[- ]/g,""))&&!s.test((t||"").replace(/[- ]/g,""));var t})).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255):null},t.throttle=function(e,t){let n=0;return function(...i){const r=Date.now();r-n>=t&&(n=r,e(...i))}},t.wrapFunctionWithRestore=function(e,t,n){const i=e[t];if("function"!=typeof i)return()=>{};try{const r=n(i);return Object.defineProperty(r,"__statsig_original__",{enumerable:!1,value:i}),e[t]=r,()=>{e[t]=i}}catch(e){return()=>{}}}},7658:(e,t)=>{function n(e,t){return e.length<=t?e:e.slice(0,t)+"..."}function i(e,t){return t<=0||"object"==typeof e&&null!==e&&Object.keys(e).some((n=>i(e[n],t-1)))}Object.defineProperty(t,"__esModule",{value:!0}),t._getStackTrace=t._safeStringify=void 0,t._safeStringify=function(e,t,r,s){try{return function(e,t,n){if(r=e,"[object Object]"===Object.prototype.toString.call(r)){if(Object.keys(e).length>t)return!0;if(i(e,n))return!0}var r;return"function"==typeof e}(e,t,r)?function(e,t){return n(e.toString(),t)}(e,s):n("string"==typeof e?e:"object"==typeof e&&null!==e?JSON.stringify(e):String(e),s)}catch(e){return n("[Unserializable]",s)}},t._getStackTrace=function(){var e,t;try{return null!==(t=null===(e=(new Error).stack)||void 0===e?void 0:e.split("\n").slice(2))&&void 0!==t?t:[]}catch(e){return[]}}},6596:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getMetadataFromElement=t._gatherCopyEventData=t._gatherEventData=void 0;const i=n(4485),r=n(2735),s=1e3;function o(e,t){return e?e.length>t?e.substring(0,t)+"...":e:null}function a(e){const t={};return t.class=(o(e.getAttribute("class"),s)||"").replace(/\s+/g," ").trim(),t.id=o(e.getAttribute("id"),s),t.ariaLabel=o(e.getAttribute("aria-label"),s),t.name=o(e.getAttribute("name"),s),t}function l(e){const t={},n=a(e);Object.assign(t,n);const i=Array.from(e.classList);return t.classList=i.length>0?i.slice(0,100):null,t.selector=function(e){if(!e)return"";if(!e.parentNode){const t=e.tagName.toLowerCase();if(e.id)return`#${e.id}`;let n=t;if(e.className&&"string"==typeof e.className){const t=e.className.trim().split(/\s+/);t.length>0&&""!==t[0]&&(n+="."+t.join("."))}return n}const t=[];let n=e,i=0;for(;n&&n.nodeType===Node.ELEMENT_NODE&&i<50;){const e=u(n);if(t.unshift(e),n.id)break;if(n=n.parentElement,n&&"body"===n.tagName.toLowerCase())break;i++}return t.join(" > ")}(e),t}function u(e){const t=e.tagName.toLowerCase();if(e.id)return`#${e.id}`;let n=t;if(e.className&&"string"==typeof e.className){const t=e.className.trim().split(/\s+/);t.length>0&&""!==t[0]&&(n+="."+t.join("."))}const i=e.parentElement;if(i&&i.children.length>1){let t=1,i=1,r=e.previousElementSibling;for(;r;)t++,r.tagName===e.tagName&&i++,r=r.previousElementSibling;n+=`:nth-child(${t})`,(i>1||function(e){let t=e.nextElementSibling;for(;t;){if(t.tagName===e.tagName)return!0;t=t.nextElementSibling}return!1}(e))&&(n+=`:nth-of-type(${i})`)}return n}t._gatherEventData=function(e){const t=(0,r._getSanitizedPageUrl)()||"",n=e.tagName.toLowerCase();if(function(e){return"input"===e.tagName.toLowerCase()&&["button","checkbox","submit","reset"].includes(e.getAttribute("type")||"")||"textarea"===e.tagName.toLowerCase()||"select"===e.tagName.toLowerCase()||"true"===e.getAttribute("contenteditable")}(e))return{value:t,metadata:a(e)};const i={};i.tagName=n;const s=l(e);Object.assign(i,s),"form"===n&&Object.assign(i,function(e){var t;const n={};return n.action=e.getAttribute("action"),n.method=null!==(t=e.getAttribute("method"))&&void 0!==t?t:"GET",n.formName=e.getAttribute("name"),n.formId=e.getAttribute("id"),n}(e)),"input"===n&&Object.assign(i,function(e){const t={};return t.content=e.value,t.inputName=e.getAttribute("name"),t}(e));const o=(0,r._getAnchorNodeInHierarchy)(e);return o&&Object.assign(i,function(e){const t={};return t.href=e.getAttribute("href"),t}(o)),("button"===n||o)&&Object.assign(i,function(e){const t={};t.content=(e.textContent||"").trim();const n=function(e){const t={};if(!e)return t;const n=null==e?void 0:e.dataset;if(!n)return t;for(const e in n)t[`data-${e}`]=n[e]||"";return t}(e);return Object.assign(t,n),t}(o||e)),function(e){var t;if(Array.isArray(e.classList)&&(null===(t=e.classList)||void 0===t?void 0:t.includes("statsig-ctr-capture")))return!0;const n=e.href;if(n)try{const e=(0,r._getSafeUrl)(),t=new URL(n);return e.host!==t.host}catch(e){return!1}return!1}(i)&&(i.isOutbound="true"),{value:t,metadata:i}},t._gatherCopyEventData=function(e){var t,n;const s=null===(n=null===(t=(0,i._getWindowSafe)())||void 0===t?void 0:t.getSelection())||void 0===n?void 0:n.toString(),o={};o.selectedText=(0,r._sanitizeString)(s);const a=e.type||"clipboard";return o.clipType=a,o},t._getMetadataFromElement=l},6499:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getPossibleFirstTouchMetadata=t._getNetworkInfo=t._gatherAllMetadata=t._gatherCommonMetadata=void 0;const i=n(4485),r=n(2735);function s(e){var t,n,s,a,l,u,c,d;const g=(0,i._getDocumentSafe)(),_=(0,i._getWindowSafe)();return(0,r._stripEmptyValues)(Object.assign({title:null==g?void 0:g.title,current_url:null===(t=null==_?void 0:_.location)||void 0===t?void 0:t.href,user_agent:(null===(n=null==_?void 0:_.navigator)||void 0===n?void 0:n.userAgent)&&(null===(a=null===(s=null==_?void 0:_.navigator)||void 0===s?void 0:s.userAgent)||void 0===a?void 0:a.length)>200?_.navigator.userAgent.substring(0,200):null===(l=null==_?void 0:_.navigator)||void 0===l?void 0:l.userAgent,locale:null===(u=null==_?void 0:_.navigator)||void 0===u?void 0:u.language,hostname:e.hostname,pathname:e.pathname,screen_width:null===(c=null==_?void 0:_.screen)||void 0===c?void 0:c.width,screen_height:null===(d=null==_?void 0:_.screen)||void 0===d?void 0:d.height,viewport_width:null==_?void 0:_.innerWidth,viewport_height:null==_?void 0:_.innerHeight,viewport:`${null==_?void 0:_.innerWidth}x${null==_?void 0:_.innerHeight}`,timestamp:Date.now(),timezone:(0,r._getSafeTimezone)(),timezone_offset:(0,r._getSafeTimezoneOffset)()},o()))}function o(){const e=(0,r._getSafeNetworkInformation)(),t={};return void 0!==(null==e?void 0:e.effectiveType)&&(t.effective_connection_type=e.effectiveType),void 0!==(null==e?void 0:e.rtt)&&(t.rtt_ms=e.rtt),void 0!==(null==e?void 0:e.downlink)&&(t.downlink_mbps=e.downlink,t.downlink_kbps=1e3*e.downlink),void 0!==(null==e?void 0:e.saveData)&&(t.save_data=e.saveData),t}function a(e){const t=(null==e?void 0:e.referrer)||"";if(!t)return{referrer:null,referrer_domain:null,referrer_path:null,searchEngine:"",searchQuery:""};try{const e=new URL(t),n=e.hostname,i=["google","bing","yahoo","duckduckgo","baidu"].find((e=>n.includes(e+".")))||"",r=e.searchParams.get("yahoo"===i?"p":"q")||"";return{referrer:t,referrer_domain:e.hostname,referrer_path:e.pathname,searchEngine:i,searchQuery:r}}catch(e){return{referrer:null,referrer_domain:null,referrer_path:null,searchEngine:"",searchQuery:""}}}function l(e){const t=e.searchParams,n={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","msclkid","dclid","fbclid","gad_source","gclid","gclsrc","wbraid","utm_id","irclid","igshid","_kx","li_fat_id","mc_cid","mc_eid","epik","qclid","rdt_cid","sccid","ttc","ttclid","ttc_id","twclid"].forEach((e=>{const i=t.get(e);i&&(n[e]=i)})),n}t._gatherCommonMetadata=s,t._gatherAllMetadata=function(e){const t=(0,i._getDocumentSafe)(),n=(0,i._getWindowSafe)();if(!t||!n)return{};const o=a(t),u=s(e),c=l(e),d={};return e.searchParams.forEach(((e,t)=>{d[t]=e})),Object.assign(Object.assign({},u),(0,r._stripEmptyValues)(Object.assign(Object.assign(Object.assign({},o),c),d)))},t._getNetworkInfo=o,t._getPossibleFirstTouchMetadata=function(e){const t=(0,i._getDocumentSafe)(),n=(0,i._getWindowSafe)();if(!t||!n)return{};const s=a(t),o=l(e),u=(0,r._stripEmptyValues)(Object.assign(Object.assign({},s),o)),c={};for(const[e,t]of Object.entries(u))c[`$s_${e}`]=t;return c}},5070:(e,t,n)=>{n.r(t),n.d(t,{CLSThresholds:()=>k,FCPThresholds:()=>E,INPThresholds:()=>A,LCPThresholds:()=>R,TTFBThresholds:()=>K,onCLS:()=>w,onFCP:()=>C,onINP:()=>U,onLCP:()=>F,onTTFB:()=>z});let i=-1;const r=e=>{addEventListener("pageshow",(t=>{t.persisted&&(i=t.timeStamp,e(t))}),!0)},s=(e,t,n,i)=>{let r,s;return o=>{t.value>=0&&(o||i)&&(s=t.value-(r??0),(s||void 0===r)&&(r=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},o=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},a=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},l=()=>{const e=a();return e?.activationStart??0},u=(e,t=-1)=>{const n=a();let r="navigate";return i>=0?r="back-forward-cache":n&&(document.prerendering||l()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},c=new WeakMap;function d(e,t){return c.get(e)||c.set(e,new t),c.get(e)}class g{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const _=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const i=new PerformanceObserver((e=>{Promise.resolve().then((()=>{t(e.getEntries())}))}));return i.observe({type:e,buffered:!0,...n}),i}}catch{}},h=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let v=-1;const f=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,p=e=>{"hidden"===document.visibilityState&&v>-1&&(v="visibilitychange"===e.type?e.timeStamp:0,y())},m=()=>{addEventListener("visibilitychange",p,!0),addEventListener("prerenderingchange",p,!0)},y=()=>{removeEventListener("visibilitychange",p,!0),removeEventListener("prerenderingchange",p,!0)},b=()=>{if(v<0){const e=l(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>"hidden"===t.name&&t.startTime>e))[0]?.startTime;v=t??f(),m(),r((()=>{setTimeout((()=>{v=f(),m()}))}))}return{get firstHiddenTime(){return v}}},S=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},E=[1800,3e3],C=(e,t={})=>{S((()=>{const n=b();let i,a=u("FCP");const c=_("paint",(e=>{for(const t of e)"first-contentful-paint"===t.name&&(c.disconnect(),t.startTime<n.firstHiddenTime&&(a.value=Math.max(t.startTime-l(),0),a.entries.push(t),i(!0)))}));c&&(i=s(e,a,E,t.reportAllChanges),r((n=>{a=u("FCP"),i=s(e,a,E,t.reportAllChanges),o((()=>{a.value=performance.now()-n.timeStamp,i(!0)}))})))}))},k=[.1,.25],w=(e,t={})=>{C(h((()=>{let n,i=u("CLS",0);const a=d(t,g),l=e=>{for(const t of e)a.h(t);a.i>i.value&&(i.value=a.i,i.entries=a.o,n())},c=_("layout-shift",l);c&&(n=s(e,i,k,t.reportAllChanges),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(l(c.takeRecords()),n(!0))})),r((()=>{a.i=0,i=u("CLS",0),n=s(e,i,k,t.reportAllChanges),o((()=>n()))})),setTimeout(n))})))};let O=0,D=1/0,I=0;const L=e=>{for(const t of e)t.interactionId&&(D=Math.min(D,t.interactionId),I=Math.max(I,t.interactionId),O=I?(I-D)/7+1:0)};let T;const M=()=>T?O:performance.interactionCount??0;let P=0;class j{u=[];l=new Map;m;v;p(){P=M(),this.u.length=0,this.l.clear()}P(){const e=Math.min(this.u.length-1,Math.floor((M()-P)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.T){if(n?e.duration>n.T?(n.entries=[e],n.T=e.duration):e.duration===n.T&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],T:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((e,t)=>t.T-e.T)),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.v?.(n)}}}const x=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=h(e),document.addEventListener("visibilitychange",e,{once:!0}),t((()=>{e(),document.removeEventListener("visibilitychange",e)})))},A=[200,500],U=(e,t={})=>{globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype&&S((()=>{"interactionCount"in performance||T||(T=_("event",L,{type:"event",buffered:!0,durationThreshold:0}));let n,i=u("INP");const o=d(t,j),a=e=>{x((()=>{for(const t of e)o.h(t);const t=o.P();t&&t.T!==i.value&&(i.value=t.T,i.entries=t.entries,n())}))},l=_("event",a,{durationThreshold:t.durationThreshold??40});n=s(e,i,A,t.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(a(l.takeRecords()),n(!0))})),r((()=>{o.p(),i=u("INP"),n=s(e,i,A,t.reportAllChanges)})))}))};class N{m;h(e){this.m?.(e)}}const R=[2500,4e3],F=(e,t={})=>{S((()=>{const n=b();let i,a=u("LCP");const c=d(t,N),g=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)c.h(t),t.startTime<n.firstHiddenTime&&(a.value=Math.max(t.startTime-l(),0),a.entries=[t],i())},v=_("largest-contentful-paint",g);if(v){i=s(e,a,R,t.reportAllChanges);const n=h((()=>{g(v.takeRecords()),v.disconnect(),i(!0)}));for(const e of["keydown","click","visibilitychange"])addEventListener(e,(()=>x(n)),{capture:!0,once:!0});r((n=>{a=u("LCP"),i=s(e,a,R,t.reportAllChanges),o((()=>{a.value=performance.now()-n.timeStamp,i(!0)}))}))}}))},K=[800,1800],B=e=>{document.prerendering?S((()=>B(e))):"complete"!==document.readyState?addEventListener("load",(()=>B(e)),!0):setTimeout(e)},z=(e,t={})=>{let n=u("TTFB"),i=s(e,n,K,t.reportAllChanges);B((()=>{const o=a();o&&(n.value=Math.max(o.responseStart-l(),0),n.entries=[o],i(!0),r((()=>{n=u("TTFB",0),i=s(e,n,K,t.reportAllChanges),i(!0)})))}))}}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i].call(s.exports,s,s.exports,n),s.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{default:()=>o});var e=n(2869),t=n(4239),r=n(4091);const s=window.StatsigSidecar||{_statsigInstance:null,_queuedEvents:[],_clientInitialized:!1,_redirKey:"_stsgnoredir",activateExperiment:function(e){this._getMatchingExperiments().includes(e)&&s._performExperiments([e])},findElementToObserve:function(e){for(;e;){try{const t=document.querySelector(e);if(t)return t}catch(e){}e=e.substring(0,e.lastIndexOf(">"))}return document.body},_flushQueuedEvents:function(){if(0===this._queuedEvents.length)return;if(!this._statsigInstance)return;const e=[...this._queuedEvents];this._queuedEvents=[],e.forEach((e=>{this._statsigInstance.logEvent(e.eventName,e.value,e.metadata)})),this._statsigInstance.flush&&this._statsigInstance.flush()},_getMatchingExperiments:function(){const e=[],t=this._statsigInstance.getConfigList();let n=window.location.href;try{const e=new URL(n);e.searchParams.has("overrideuser")&&e.searchParams.delete("overrideuser"),n=e.toString()}catch(e){}return t.forEach((t=>{const i=this._statsigInstance.getExperiment(t);i.value["!statsig_sidecar_directives"]&&this._isMatchingExperiment(n,i.value.sidecarURLFilters)&&e.push(i.name)})),e},getStatsigInstance:function(){return this._statsigInstance},_isMatchingExperiment:function(e,t){if(!t||0===t.length)return!0;for(const n of t)if("contains"===n.type){if(e.includes(n.value))return!0}else if("equals"===n.type){if(e===n.value)return!0}else if("regex"===n.type){if(RegExp(n.value).test(e))return!0}else if("path"===n.type&&new URL(e).pathname===n.value)return!0;return!1},_isIOS:function(){return/iPad|iPhone|iPod/.test(navigator?.userAgent??"")},logEvent:function(e,t,n){this._statsigInstance&&this._clientInitialized?(this._flushQueuedEvents(),this._statsigInstance.logEvent(e,t,n)):this._queuedEvents.push({eventName:e,value:t,metadata:n})},_observeMutation:function(e,t){new MutationObserver(((e,n)=>{setTimeout((()=>{t()}),0)})).observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0,characterDataOldValue:!1}),t()},_observePageChanges:function(e){const t=history.pushState,n=history.replaceState,i=()=>{s.runAllExperiments(e)};history.pushState=function(...e){t.apply(history,e),i()},history.replaceState=function(...e){n.apply(history,e),i()},window.addEventListener("hashchange",i),window.addEventListener("popstate",i)},_performAfterLoad:function(e){/complete|interactive|loaded/.test(document.readyState)?e():document.addEventListener("DOMContentLoaded",(()=>{e()}))},performAttributeChange:function(e,t,n,i=[]){e&&this.setupMutationObserver(e,(()=>{const r=document.querySelector(e);r&&r.getAttribute(t)!==n&&(r.setAttribute(t,n),i?.forEach((e=>{r.removeAttribute(e)})))}))},performContentChange:function(e,t){e&&this.setupMutationObserver(e,(()=>{const n=document.querySelector(e);n&&n.innerHTML!==t&&(n.innerHTML=t)}))},_performDirective:function(e){switch(console.log(e),e.type){case"content":this._performAfterLoad((()=>{this.performContentChange(e.selector,e.value)}));break;case"style":this._performAfterLoad((()=>{this.performStyleChange(e.selector,e.key,e.value)}));break;case"properties":this._performAfterLoad((()=>{e.metadata?.forEach((e=>{"style"===e.type?this.performStyleChange(e.selector,e.name,e.value):"attribute"===e.type&&this.performAttributeChange(e.selector,e.name,e.value)}))}));break;case"attribute":this._performAfterLoad((()=>{this.performAttributeChange(e.selector,e.key,e.value)}));break;case"image":this._performAfterLoad((()=>{this.performAttributeChange(e.selector,"src",e.value,["srcset"])}));break;case"reorder":this._performAfterLoad((()=>{this.performReorderElement(e.selector,e.operator,e.value)}));break;case"code":this.performInjectScript(e.value);break;case"inject-style":this.performInjectStyle(e.value);break;case"redirect":this.redirectPage(e.value)}},_performExperiments:function(e){Array.isArray(e)&&e.forEach((e=>{this._statsigInstance.getExperiment(e).get("!statsig_sidecar_directives",[]).forEach((e=>{try{this._performDirective(e)}catch(e){console.error("Failed to perform directive:",e)}}))}))},performInjectScript:function(e){const t=document.createElement("script");t.setAttribute("nonce",this.scriptNonce),t.nonce=this.scriptNonce,t.innerHTML=e,document.head.appendChild(t)},performInjectStyle:function(e){const t=document.createElement("style");t.innerHTML=e,document.head.appendChild(t)},performReorderElement:function(e,t,n){e&&this.setupMutationObserver(e,(()=>{const i=document.querySelector(e),r=document.querySelector(n);if(i&&r)switch(t){case"before":r.before(i);break;case"after":r.after(i);break;case"first":r.prepend(i);break;case"last":r.append(i)}}))},performStyleChange:function(e,t,n){e&&this.setupMutationObserver(e,(()=>{const i=document.querySelector(e);i&&i.style.setProperty(t,n)}))},processEvent:function(e){if(!e||!e.detail)return!1;const t=e.detail;return"inject-script"===t.name?(this.performInjectScript(t.value),!1):void 0},redirectPage:async function(e){if(this._flushQueuedEvents(),window&&window.location&&e&&window.location.href!=e)try{const t=new URL(window.location.href);if(t.searchParams.has(this._redirKey))return;const n=new URL(e,t);for(const e of t.searchParams.keys())n.searchParams.has(e)||n.searchParams.set(e,t.searchParams.get(e));n.searchParams.set(this._redirKey,"1"),this._isIOS()&&await this._statsigInstance.flush(),window.location.href=n.toString()}catch(t){window.location.href=e}},resetBody:function(){const e=document.getElementById("__sbpd");e&&e.parentElement.removeChild(e)},runAllExperiments:function(e=null){if(!e){const t=this._getMatchingExperiments();this._runPreExperimentScripts(t),e=t}if(e)try{this._performExperiments(e)}catch(e){console.error("Failed to perform experiments:",e)}this.resetBody(),window?.postExperimentCallback&&window.postExperimentCallback(this._statsigInstance,e)},_runPreExperimentScripts:function(e){e?.forEach((e=>{e.prerunScript&&"prestart"!==this._statsigInstance.getExperiment(e).ruleID&&this.performInjectScript(e.prerunScript)}))},setupMutationObserver:function(e,t){const n=this.findElementToObserve(e);n&&this._observeMutation(n,t)},setupStatsigSdk:async function(n,i,s,o,a){let l=null,u=null;try{const e=new URL(window.location.href);l=e.searchParams.get("overrideuser"),u=e.searchParams.get("overrideexp")}catch(e){console.error("Failed to update user:",e)}try{const c=window?.statsigUser??{};l&&(c.userID=l,c.customIDs=c.customIDs||{},c.customIDs.stableID=l);const d=window?.statsigOptions??{};if(d.disableLogging=!s,(o||a)&&(d.networkConfig={initializeUrl:o,logEventUrl:a}),u){const e=new t.LocalOverrideAdapter;d.overrideAdapter=e,e.overrideExperiment("sidecar",JSON.parse(u))}this._statsigInstance=new e.StatsigClient(n,c,d),await this._statsigInstance.initializeAsync(),(0,r.gX)(this._statsigInstance),this._clientInitialized=!0,this._flushQueuedEvents(),this._observePageChanges(i),this.runAllExperiments(i)}catch(e){console.error("Failed to initialize Statsig:",e)}this.resetBody()}};if(document.currentScript&&document.currentScript.src){const e=new URL(document.currentScript.src),t=e.searchParams.get("apikey"),n=e.searchParams.get("multiexpids"),i=e.searchParams.get("initializeurl"),r=e.searchParams.get("logeventurl"),o="0"!==e.searchParams.get("autostart"),a="0"!==e.searchParams.get("reduceflicker");if(s.scriptNonce=document.currentScript.nonce,t){a&&(document.write('<style id="__sbpd">body { display: none; }</style>\n'),setTimeout((()=>{s.resetBody()}),1e3));const e=n?n.split(","):null;s.setupStatsigSdk(t,e,o,i,r),document.addEventListener(`sidecar_${t}`,(e=>{s.processEvent(e),e.preventDefault()}))}}window.StatsigSidecar=s;const o=s})(),i})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.StatsigSidecar=t():e.StatsigSidecar=t()}(this,(()=>(()=>{"use strict";var e={5050:(e,t,n)=>{var i,r,s;Object.defineProperty(t,"__esModule",{value:!0}),t._getInstance=t._getStatsigGlobalFlag=t._getStatsigGlobal=void 0;const o=n(7243);t._getStatsigGlobal=()=>{try{return"undefined"!=typeof __STATSIG__?__STATSIG__:d}catch(e){return d}},t._getStatsigGlobalFlag=e=>(0,t._getStatsigGlobal)()[e],t._getInstance=e=>{const n=(0,t._getStatsigGlobal)();return e?n.instances&&n.instances[e]:(n.instances&&Object.keys(n.instances).length>1&&o.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."),n.firstInstance)};const a="__STATSIG__",l="undefined"!=typeof window?window:{},u=void 0!==n.g?n.g:{},c="undefined"!=typeof globalThis?globalThis:{},d=null!==(s=null!==(r=null!==(i=l[a])&&void 0!==i?i:u[a])&&void 0!==r?r:c[a])&&void 0!==s?s:{instance:t._getInstance};l[a]=d,u[a]=d,c[a]=d},6448:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getStorageKey=t._getUserStorageKey=void 0;const i=n(5585);function r(e,t,n){var r;if(n)return n(e,t);const s=t&&t.customIDs?t.customIDs:{},o=[`uid:${null!==(r=null==t?void 0:t.userID)&&void 0!==r?r:""}`,`cids:${Object.keys(s).sort(((e,t)=>e.localeCompare(t))).map((e=>`${e}-${s[e]}`)).join(",")}`,`k:${e}`];return(0,i._DJB2)(o.join("|"))}t._getUserStorageKey=r,t._getStorageKey=function(e,t,n){return t?r(e,t,n):(0,i._DJB2)(`k:${e}`)}},2082:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},977:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t._makeDataAdapterResult=t.DataAdapterCore=void 0;const r=n(7243),s=n(5683),o=n(8001),a=n(1285),l=n(8532);function u(e,t,n,i){return{source:e,data:t,receivedAt:Date.now(),stableID:n,fullUserHash:(0,o._getFullUserHash)(i)}}t.DataAdapterCore=class{constructor(e,t){this._adapterName=e,this._cacheSuffix=t,this._options=null,this._sdkKey=null,this._cacheLimit=10,this._lastModifiedStoreKey=`statsig.last_modified_time.${t}`,this._inMemoryCache=new c}attach(e,t,n){this._sdkKey=e,this._options=t}getDataSync(e){const t=e&&(0,o._normalizeUser)(e,this._options),n=this._getCacheKey(t),i=this._inMemoryCache.get(n,t);if(i&&this._getIsCacheValueValid(i))return i;const r=this._loadFromCache(n);return r&&this._getIsCacheValueValid(r)?(this._inMemoryCache.add(n,r,this._cacheLimit),this._inMemoryCache.get(n,t)):null}setData(e,t){const n=t&&(0,o._normalizeUser)(t,this._options),i=this._getCacheKey(n);this._inMemoryCache.add(i,u("Bootstrap",e,null,n),this._cacheLimit)}_getIsCacheValueValid(e){return null==e.stableID||e.stableID===s.StableID.get(this._getSdkKey())}_getDataAsyncImpl(e,t,n){return i(this,void 0,void 0,(function*(){a.Storage.isReady()||(yield a.Storage.isReadyResolver());const i=null!=e?e:this.getDataSync(t),s=[this._fetchAndPrepFromNetwork(i,t,n)];return(null==n?void 0:n.timeoutMs)&&s.push(new Promise((e=>setTimeout(e,n.timeoutMs))).then((()=>(r.Log.debug("Fetching latest value timed out"),null)))),yield Promise.race(s)}))}_prefetchDataImpl(e,t){return i(this,void 0,void 0,(function*(){const n=e&&(0,o._normalizeUser)(e,this._options),i=this._getCacheKey(n),r=yield this._getDataAsyncImpl(null,n,t);r&&this._inMemoryCache.add(i,Object.assign(Object.assign({},r),{source:"Prefetch"}),this._cacheLimit)}))}_fetchAndPrepFromNetwork(e,t,n){return i(this,void 0,void 0,(function*(){var i;const o=null!==(i=null==e?void 0:e.data)&&void 0!==i?i:null,a=null!=e&&this._isCachedResultValidFor204(e,t),c=yield this._fetchFromNetwork(o,t,n,a);if(!c)return r.Log.debug("No response returned for latest value"),null;const d=(0,l._typedJsonParse)(c,"has_updates","Response"),g=this._getSdkKey(),_=s.StableID.get(g);let h=null;if(!0===(null==d?void 0:d.has_updates))h=u("Network",c,_,t);else{if(!o||!1!==(null==d?void 0:d.has_updates))return null;h=u("NetworkNotModified",o,_,t)}const v=this._getCacheKey(t);return this._inMemoryCache.add(v,h,this._cacheLimit),this._writeToCache(v,h),h}))}_getSdkKey(){return null!=this._sdkKey?this._sdkKey:(r.Log.error(`${this._adapterName} is not attached to a Client`),"")}_loadFromCache(e){var t;const n=null===(t=a.Storage.getItem)||void 0===t?void 0:t.call(a.Storage,e);if(null==n)return null;const i=(0,l._typedJsonParse)(n,"source","Cached Result");return i?Object.assign(Object.assign({},i),{source:"Cache"}):null}_writeToCache(e,t){const n=JSON.stringify(t);for(let t=0;t<8;t++)try{a.Storage.setItem(e,n);break}catch(t){if(!(t instanceof Error)||!t.toString().includes("QuotaExceededError")&&!t.toString().includes("QUOTA_EXCEEDED_ERR")||this._cacheLimit<=1)throw t;this._cacheLimit=Math.ceil(this._cacheLimit/2),this._runLocalStorageCacheEviction(e,this._cacheLimit-1)}this._runLocalStorageCacheEviction(e)}_runLocalStorageCacheEviction(e,t=this._cacheLimit){var n;const i=null!==(n=(0,a._getObjectFromStorage)(this._lastModifiedStoreKey))&&void 0!==n?n:{};i[e]=Date.now();const r=d(i,t);for(const e of r)delete i[e],a.Storage.removeItem(e);(0,a._setObjectInStorage)(this._lastModifiedStoreKey,i)}},t._makeDataAdapterResult=u;class c{constructor(){this._data={}}get(e,t){var n;const i=this._data[e],s=null==i?void 0:i.stableID,o=null===(n=null==t?void 0:t.customIDs)||void 0===n?void 0:n.stableID;return o&&s&&o!==s?(r.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):i}add(e,t,n){const i=d(this._data,n-1);for(const e of i)delete this._data[e];this._data[e]=t}merge(e){this._data=Object.assign(Object.assign({},this._data),e)}}function d(e,t){const n=Object.keys(e);return n.length<=t?[]:0===t?n:n.sort(((t,n)=>{const i=e[t],r=e[n];return"object"==typeof i&&"object"==typeof r?i.receivedAt-r.receivedAt:i-r})).slice(0,n.length-t)}},4001:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Diagnostics=void 0;const n=new Map,i="start",r="end";function s(e,t,n,i){return Object.assign({key:n,action:t,step:i,timestamp:Date.now()},e)}function o(e,t){var i;const r=null!==(i=n.get(e))&&void 0!==i?i:[];r.push(t),n.set(e,r)}function a(e,t){if(t in e)return e[t]}t.Diagnostics={_getMarkers:e=>n.get(e),_markInitOverallStart:e=>{o(e,s({},i,"overall"))},_markInitOverallEnd:(e,t,n)=>{o(e,s({success:t,error:t?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:n},r,"overall"))},_markInitNetworkReqStart:(e,t)=>{o(e,s(t,i,"initialize","network_request"))},_markInitNetworkReqEnd:(e,t)=>{o(e,s(t,r,"initialize","network_request"))},_markInitProcessStart:e=>{o(e,s({},i,"initialize","process"))},_markInitProcessEnd:(e,t)=>{o(e,s(t,r,"initialize","process"))},_clearMarkers:e=>{n.delete(e)},_formatError(e){if(e&&"object"==typeof e)return{code:a(e,"code"),name:a(e,"name"),message:a(e,"message")}},_getDiagnosticsData(e,n,i,r){var s;return{success:!0===(null==e?void 0:e.ok),statusCode:null==e?void 0:e.status,sdkRegion:null===(s=null==e?void 0:e.headers)||void 0===s?void 0:s.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:n,error:t.Diagnostics._formatError(r)}},_enqueueDiagnosticsEvent(e,n,i,r){const s=t.Diagnostics._getMarkers(i);if(null==s||s.length<=0)return-1;const o=s[s.length-1].timestamp-s[0].timestamp;t.Diagnostics._clearMarkers(i);const a=function(e,t){return{eventName:"statsig::diagnostics",user:e,value:null,metadata:t,time:Date.now()}}(e,{context:"initialize",markers:s.slice(),statsigOptions:r});return n.enqueue(a),o}}},6810:function(e,t){var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t._fetchTxtRecords=void 0;const i=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=["i","e","d"];t._fetchTxtRecords=function(e){return n(this,void 0,void 0,(function*(){const t=yield e("https://cloudflare-dns.com/dns-query",{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:i});if(!t.ok){const e=new Error("Failed to fetch TXT records from DNS");throw e.name="DnsTxtFetchError",e}const n=yield t.arrayBuffer();return function(e){const t=e.findIndex(((t,n)=>n<200&&"="===String.fromCharCode(t)&&r.includes(String.fromCharCode(e[n-1]))));if(-1===t){const e=new Error("Failed to parse TXT records from DNS");throw e.name="DnsTxtParseError",e}let n="";for(let i=t-1;i<e.length;i++)n+=String.fromCharCode(e[i]);return n.split(",")}(new Uint8Array(n))}))}},6012:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9233:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundary=t.EXCEPTION_ENDPOINT=void 0;const r=n(7243),s=n(7313),o=n(7787);t.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";const a="[Statsig] UnknownError";function l(e){return e instanceof Error?e:"string"==typeof e?new Error(e):new Error("An unknown error occurred.")}function u(e){if(!e)return{};const t={};return Object.keys(e).forEach((n=>{const i=n,r=e[i];switch(typeof r){case"number":case"bigint":case"boolean":t[String(i)]=r;break;case"string":r.length<50?t[String(i)]=r:t[String(i)]="set";break;case"object":"environment"===i?t.environment=r:"networkConfig"===i?t.networkConfig=r:t[String(i)]=null!=r?"set":"unset"}})),t}t.ErrorBoundary=class{constructor(e,t,n,i){this._sdkKey=e,this._options=t,this._emitter=n,this._lastSeenError=i,this._seen=new Set}wrap(e,t){try{const n=e;(function(e){const t=new Set;let n=Object.getPrototypeOf(e);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter((e=>"function"==typeof(null==n?void 0:n[e]))).forEach((e=>t.add(e))),n=Object.getPrototypeOf(n);return Array.from(t)})(n).forEach((i=>{const r=n[i];"$EB"in r||(n[i]=(...n)=>this._capture(t?`${t}:${i}`:i,(()=>r.apply(e,n))),n[i].$EB=!0)}))}catch(e){this._onError("eb:wrap",e)}}logError(e,t){this._onError(e,t)}getLastSeenErrorAndReset(){const e=this._lastSeenError;return this._lastSeenError=void 0,null!=e?e:null}attachErrorIfNoneExists(e){this._lastSeenError||(this._lastSeenError=l(e))}_capture(e,t){try{const n=t();return n&&n instanceof Promise?n.catch((t=>this._onError(e,t))):n}catch(t){return this._onError(e,t),null}}_onError(e,n){try{r.Log.warn(`Caught error in ${e}`,{error:n}),(()=>i(this,void 0,void 0,(function*(){var i,r,c,d,g,_,h;const v=n||Error(a),f=v instanceof Error,p=f?v.name:"No Name",m=l(v);if(this._lastSeenError=m,this._seen.has(p))return;if(this._seen.add(p),null===(r=null===(i=this._options)||void 0===i?void 0:i.networkConfig)||void 0===r?void 0:r.preventAllNetworkTraffic)return void(null===(c=this._emitter)||void 0===c||c.call(this,{name:"error",error:n,tag:e}));const y=s.SDKType._get(this._sdkKey),b=o.StatsigMetadataProvider.get(),S=f?v.stack:function(e){try{return JSON.stringify(e)}catch(e){return a}}(v),E=Object.assign({tag:e,exception:p,info:S,statsigOptions:u(this._options)},Object.assign(Object.assign({},b),{sdkType:y})),C=null!==(_=null===(g=null===(d=this._options)||void 0===d?void 0:d.networkConfig)||void 0===g?void 0:g.networkOverrideFunc)&&void 0!==_?_:fetch;yield C(t.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._sdkKey,"STATSIG-SDK-TYPE":String(y),"STATSIG-SDK-VERSION":String(b.sdkVersion),"Content-Type":"application/json"},body:JSON.stringify(E)}),null===(h=this._emitter)||void 0===h||h.call(this,{name:"error",error:n,tag:e})})))().then((()=>{})).catch((()=>{}))}catch(e){}}}},1645:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},638:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},4361:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.EventLogger=void 0;const r=n(6448),s=n(5585),o=n(7243),a=n(7245),l=n(831),u=n(2504),c=n(3911),d=n(1285),g=n(1932),_=n(9454),h={};class v{static _safeFlushAndForget(e){var t;null===(t=h[e])||void 0===t||t.flush().catch((()=>{}))}static _safeRetryFailedLogs(e){var t;null===(t=h[e])||void 0===t||t._retryFailedLogs()}constructor(e,t,n,i){var r,s;this._sdkKey=e,this._emitter=t,this._network=n,this._options=i,this._queue=[],this._lastExposureTimeMap={},this._nonExposedChecks={},this._hasRunQuickFlush=!1,this._creationTime=Date.now(),this._loggingEnabled=null!==(r=null==i?void 0:i.loggingEnabled)&&void 0!==r?r:!0===(null==i?void 0:i.disableLogging)?c.LoggingEnabledOption.disabled:c.LoggingEnabledOption.browserOnly,(null==i?void 0:i.loggingEnabled)&&void 0!==i.disableLogging&&o.Log.warn("Detected both loggingEnabled and disableLogging options. loggingEnabled takes precedence - please remove disableLogging."),this._maxQueueSize=null!==(s=null==i?void 0:i.loggingBufferMaxSize)&&void 0!==s?s:100;const l=null==i?void 0:i.networkConfig;this._logEventUrlConfig=new g.UrlConfiguration(a.Endpoint._rgstr,null==l?void 0:l.logEventUrl,null==l?void 0:l.api,null==l?void 0:l.logEventFallbackUrls)}setLogEventCompressionMode(e){this._network.setLogEventCompressionMode(e)}setLoggingEnabled(e){if("disabled"===this._loggingEnabled&&"disabled"!==e){const e=this._getStorageKey(),t=(0,d._getObjectFromStorage)(e);t&&this._queue.push(...t),d.Storage.removeItem(e)}this._loggingEnabled=e}enqueue(e){this._shouldLogEvent(e)&&(this._normalizeAndAppendEvent(e),this._quickFlushIfNeeded(),this._queue.length>this._maxQueueSize&&v._safeFlushAndForget(this._sdkKey))}incrementNonExposureCount(e){var t;const n=null!==(t=this._nonExposedChecks[e])&&void 0!==t?t:0;this._nonExposedChecks[e]=n+1}reset(){this.flush().catch((()=>{})),this._lastExposureTimeMap={}}start(){var e;const t=(0,l._isServerEnv)();t&&"always"!==(null===(e=this._options)||void 0===e?void 0:e.loggingEnabled)||(h[this._sdkKey]=this,t||(0,_._subscribeToVisiblityChanged)((e=>{"background"===e?v._safeFlushAndForget(this._sdkKey):"foreground"===e&&v._safeRetryFailedLogs(this._sdkKey)})),this._retryFailedLogs(),this._startBackgroundFlushInterval())}stop(){return i(this,void 0,void 0,(function*(){this._flushIntervalId&&(clearInterval(this._flushIntervalId),this._flushIntervalId=null),delete h[this._sdkKey],yield this.flush()}))}flush(){return i(this,void 0,void 0,(function*(){if(this._appendAndResetNonExposedChecks(),0===this._queue.length)return;const e=this._queue;this._queue=[],yield this._sendEvents(e)}))}_quickFlushIfNeeded(){this._hasRunQuickFlush||(this._hasRunQuickFlush=!0,Date.now()-this._creationTime>200||setTimeout((()=>v._safeFlushAndForget(this._sdkKey)),200))}_shouldLogEvent(e){var t;if("always"!==(null===(t=this._options)||void 0===t?void 0:t.loggingEnabled)&&(0,l._isServerEnv)())return!1;if(!(0,u._isExposureEvent)(e))return!0;const n=e.user?e.user:{statsigEnvironment:void 0},i=(0,r._getUserStorageKey)(this._sdkKey,n),s=e.metadata?e.metadata:{},o=[e.eventName,i,s.gate,s.config,s.ruleID,s.allocatedExperiment,s.parameterName,String(s.isExplicitParameter),s.reason].join("|"),a=this._lastExposureTimeMap[o],c=Date.now();return!(a&&c-a<6e5||(Object.keys(this._lastExposureTimeMap).length>1e3&&(this._lastExposureTimeMap={}),this._lastExposureTimeMap[o]=c,0))}_sendEvents(e){return i(this,void 0,void 0,(function*(){var t,n;if("disabled"===this._loggingEnabled)return this._saveFailedLogsToStorage(e),!1;try{const i=(0,_._isUnloading)()&&this._network.isBeaconSupported()&&null==(null===(n=null===(t=this._options)||void 0===t?void 0:t.networkConfig)||void 0===n?void 0:n.networkOverrideFunc);return this._emitter({name:"pre_logs_flushed",events:e}),(i?this._sendEventsViaBeacon(e):yield this._sendEventsViaPost(e)).success?(this._emitter({name:"logs_flushed",events:e}),!0):(o.Log.warn("Failed to flush events."),this._saveFailedLogsToStorage(e),!1)}catch(e){return o.Log.warn("Failed to flush events."),!1}}))}_sendEventsViaPost(e){return i(this,void 0,void 0,(function*(){var t;const n=yield this._network.post(this._getRequestData(e)),i=null!==(t=null==n?void 0:n.code)&&void 0!==t?t:-1;return{success:i>=200&&i<300}}))}_sendEventsViaBeacon(e){return{success:this._network.beacon(this._getRequestData(e))}}_getRequestData(e){return{sdkKey:this._sdkKey,data:{events:e},urlConfig:this._logEventUrlConfig,retries:3,isCompressable:!0,params:{[a.NetworkParam.EventCount]:String(e.length)},credentials:"same-origin"}}_saveFailedLogsToStorage(e){for(;e.length>500;)e.shift();const t=this._getStorageKey();try{const n=this._getFailedLogsFromStorage(t);(0,d._setObjectInStorage)(t,[...n,...e])}catch(e){o.Log.warn("Unable to save failed logs to storage")}}_getFailedLogsFromStorage(e){let t=[];try{const n=(0,d._getObjectFromStorage)(e);return Array.isArray(n)&&(t=n),t}catch(e){return[]}}_retryFailedLogs(){const e=this._getStorageKey();(()=>i(this,void 0,void 0,(function*(){d.Storage.isReady()||(yield d.Storage.isReadyResolver());const t=(0,d._getObjectFromStorage)(e);t&&(d.Storage.removeItem(e),yield this._sendEvents(t))})))().catch((()=>{o.Log.warn("Failed to flush stored logs")}))}_getStorageKey(){return`statsig.failed_logs.${(0,s._DJB2)(this._sdkKey)}`}_normalizeAndAppendEvent(e){e.user&&(e.user=Object.assign({},e.user),delete e.user.privateAttributes);const t={},n=this._getCurrentPageUrl();n&&(t.statsigMetadata={currentPage:n});const i=Object.assign(Object.assign({},e),t);o.Log.debug("Enqueued Event:",i),this._queue.push(i)}_appendAndResetNonExposedChecks(){0!==Object.keys(this._nonExposedChecks).length&&(this._normalizeAndAppendEvent({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this._nonExposedChecks)}}),this._nonExposedChecks={})}_getCurrentPageUrl(){var e;if(!1!==(null===(e=this._options)||void 0===e?void 0:e.includeCurrentPageUrlWithEvents))return(0,l._getCurrentPageUrlSafe)()}_startBackgroundFlushInterval(){var e,t;const n=null!==(t=null===(e=this._options)||void 0===e?void 0:e.loggingIntervalMs)&&void 0!==t?t:1e4,i=setInterval((()=>{const e=h[this._sdkKey];e&&e._flushIntervalId===i?v._safeFlushAndForget(this._sdkKey):clearInterval(i)}),n);this._flushIntervalId=i}}t.EventLogger=v},5585:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getSortedObject=t._DJB2Object=t._DJB2=void 0;const i=n(3357);t._DJB2=e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return String(t>>>0)},t._DJB2Object=(e,n)=>(0,t._DJB2)(JSON.stringify((0,t._getSortedObject)(e,n))),t._getSortedObject=(e,n)=>{if(null==e)return null;const r=Object.keys(e).sort(),s={};return r.forEach((r=>{const o=e[r];0!==n&&"object"===(0,i._typeOf)(o)?s[r]=(0,t._getSortedObject)(o,null!=n?n-1:n):s[r]=o})),s}},1368:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7243:(e,t)=>{function n(e){return e.unshift("[Statsig]"),e}Object.defineProperty(t,"__esModule",{value:!0}),t.Log=t.LogLevel=void 0,t.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};class i{static info(...e){i.level>=t.LogLevel.Info&&console.info(" INFO ",...n(e))}static debug(...e){i.level>=t.LogLevel.Debug&&console.debug(" DEBUG ",...n(e))}static warn(...e){i.level>=t.LogLevel.Warn&&console.warn(" WARN ",...n(e))}static error(...e){i.level>=t.LogLevel.Error&&console.error(" ERROR ",...n(e))}}t.Log=i,i.level=t.LogLevel.Warn},7312:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createMemoKey=t.MemoPrefix=void 0,t.MemoPrefix={_gate:"g",_dynamicConfig:"c",_experiment:"e",_configList:"cl",_layer:"l",_paramStore:"p"};const n=new Set([]),i=new Set(["userPersistedValues"]);t.createMemoKey=function(e,t,r){let s=`${e}|${t}`;if(!r)return s;for(const e of Object.keys(r)){if(i.has(e))return;n.has(e)?s+=`|${e}=true`:s+=`|${e}=${r[e]}`}return s}},7245:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkParam=t.NetworkDefault=t.Endpoint=void 0,t.Endpoint={_initialize:"initialize",_rgstr:"rgstr",_download_config_specs:"download_config_specs"},t.NetworkDefault={[t.Endpoint._rgstr]:"https://prodregistryv2.org/v1",[t.Endpoint._initialize]:"https://featureassets.org/v1",[t.Endpoint._download_config_specs]:"https://api.statsigcdn.com/v1"},t.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}},2336:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkCore=void 0,n(5050);const r=n(5050),s=n(4001),o=n(7243),a=n(7245),l=n(3351),u=n(1034),c=n(7313),d=n(831),g=n(9140),_=n(5683),h=n(5043),v=n(7787),f=n(3911),p=n(9454),m=new Set([408,500,502,503,504,522,524,599]);t.NetworkCore=class{constructor(e,t){this._emitter=t,this._errorBoundary=null,this._timeout=1e4,this._netConfig={},this._options={},this._leakyBucket={},this._lastUsedInitUrl=null,e&&(this._options=e),this._options.networkConfig&&(this._netConfig=this._options.networkConfig),this._netConfig.networkTimeoutMs&&(this._timeout=this._netConfig.networkTimeoutMs),this._fallbackResolver=new l.NetworkFallbackResolver(this._options),this.setLogEventCompressionMode(this._getLogEventCompressionMode(e))}setLogEventCompressionMode(e){this._options.logEventCompressionMode=e}setErrorBoundary(e){this._errorBoundary=e,this._errorBoundary.wrap(this),this._errorBoundary.wrap(this._fallbackResolver),this._fallbackResolver.setErrorBoundary(e)}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon}getLastUsedInitUrlAndReset(){const e=this._lastUsedInitUrl;return this._lastUsedInitUrl=null,e}beacon(e){if(!y(e))return!1;const t=this._getInternalRequestArgs("POST",e),n=this._getPopulatedURL(t),i=navigator;return i.sendBeacon.bind(i)(n,t.body)}post(e){return i(this,void 0,void 0,(function*(){const t=this._getInternalRequestArgs("POST",e);return this._tryEncodeBody(t),yield this._tryToCompressBody(t),this._sendRequest(t)}))}get(e){const t=this._getInternalRequestArgs("GET",e);return this._sendRequest(t)}_sendRequest(e){return i(this,void 0,void 0,(function*(){var t,n,r,l;if(!y(e))return null;if(this._netConfig.preventAllNetworkTraffic)return null;const{method:u,body:c,retries:d,attempt:g}=e,_=e.urlConfig.endpoint;if(this._isRateLimited(_))return o.Log.warn(`Request to ${_} was blocked because you are making requests too frequently.`),null;const v=null!=g?g:1;let f=!1;const b=this._getPopulatedURL(e);let E=null;const C=(0,p._isUnloading)();try{const n={method:u,body:c,headers:Object.assign({},e.headers),priority:e.priority,keepalive:C};!function(e,t){e.urlConfig.endpoint===a.Endpoint._initialize&&s.Diagnostics._markInitNetworkReqStart(e.sdkKey,{attempt:t})}(e,v);const i=this._leakyBucket[_];i&&(i.lastRequestTime=Date.now(),this._leakyBucket[_]=i);const r=null!==(t=this._netConfig.networkOverrideFunc)&&void 0!==t?t:fetch;let o;if(E=yield Promise.race([r(b,n).finally((()=>clearTimeout(o))),new Promise(((e,t)=>{o=setTimeout((()=>{f=!0,t(new Error(`Timeout of ${this._timeout}ms expired.`))}),this._timeout)}))]),!E.ok){const e=yield E.text().catch((()=>"No Text")),t=new Error(`NetworkError: ${b} ${e}`);throw t.name="NetworkError",t}const l=yield E.text();return S(e,E,v,l),this._fallbackResolver.tryBumpExpiryTime(e.sdkKey,e.urlConfig),{body:l,code:E.status}}catch(t){const s=function(e){return"string"==typeof e?e:e instanceof Error?`${e.name}: ${e.message}`:"Unknown Error"}(t),a=(k=f,(null!=s?s:"").includes("Timeout")||k);if(S(e,E,v,"",t),(yield this._fallbackResolver.tryFetchUpdatedFallbackInfo(e.sdkKey,e.urlConfig,s,a))&&(e.fallbackUrl=this._fallbackResolver.getActiveFallbackUrl(e.sdkKey,e.urlConfig)),!d||v>d||!m.has(null!==(n=null==E?void 0:E.status)&&void 0!==n?n:500)){null===(r=this._emitter)||void 0===r||r.call(this,{name:"error",error:t,tag:h.ErrorTag.NetworkError,requestArgs:e});const n=`A networking error occurred during ${u} request to ${b}.`;return o.Log.error(n,s,t),null===(l=this._errorBoundary)||void 0===l||l.attachErrorIfNoneExists(n),null}return yield function(e){return i(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,Math.min(e*e*500,3e4))))}))}(v),this._sendRequest(Object.assign(Object.assign({},e),{retries:d,attempt:v+1}))}var k}))}_getLogEventCompressionMode(e){let t=null==e?void 0:e.logEventCompressionMode;return t||!0!==(null==e?void 0:e.disableCompression)||(t=f.LogEventCompressionMode.Disabled),t||(t=f.LogEventCompressionMode.Enabled),t}_isRateLimited(e){var t;const n=Date.now(),i=null!==(t=this._leakyBucket[e])&&void 0!==t?t:{count:0,lastRequestTime:n},r=n-i.lastRequestTime,s=Math.floor(.05*r);return i.count=Math.max(0,i.count-s),i.count>=50||(i.count+=1,i.lastRequestTime=n,this._leakyBucket[e]=i,!1)}_getPopulatedURL(e){var t;const n=null!==(t=e.fallbackUrl)&&void 0!==t?t:e.urlConfig.getUrl();e.urlConfig.endpoint!==a.Endpoint._initialize&&e.urlConfig.endpoint!==a.Endpoint._download_config_specs||(this._lastUsedInitUrl=n);const i=Object.assign({[a.NetworkParam.SdkKey]:e.sdkKey,[a.NetworkParam.SdkType]:c.SDKType._get(e.sdkKey),[a.NetworkParam.SdkVersion]:v.SDK_VERSION,[a.NetworkParam.Time]:String(Date.now()),[a.NetworkParam.SessionID]:g.SessionID.get(e.sdkKey)},e.params),r=Object.keys(i).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(i[e])}`)).join("&");return`${n}${r?`?${r}`:""}`}_tryEncodeBody(e){var t;const n=(0,d._getWindowSafe)(),i=e.body;if(e.isStatsigEncodable&&!this._options.disableStatsigEncoding&&"string"==typeof i&&null==(0,r._getStatsigGlobalFlag)("no-encode")&&(null==n?void 0:n.btoa))try{e.body=n.btoa(i).split("").reverse().join(""),e.params=Object.assign(Object.assign({},null!==(t=e.params)&&void 0!==t?t:{}),{[a.NetworkParam.StatsigEncoded]:"1"})}catch(t){o.Log.warn(`Request encoding failed for ${e.urlConfig.getUrl()}`,t)}}_tryToCompressBody(e){return i(this,void 0,void 0,(function*(){var t;const n=e.body;if("string"==typeof n&&function(e,t){if(!e.isCompressable)return!1;if(null!=(0,r._getStatsigGlobalFlag)("no-compress")||"undefined"==typeof CompressionStream||"undefined"==typeof TextEncoder)return!1;const n=null!=e.urlConfig.customUrl||null!=e.urlConfig.fallbackUrls,i=!0===u.SDKFlags.get(e.sdkKey,"enable_log_event_compression");switch(t.logEventCompressionMode){case f.LogEventCompressionMode.Disabled:return!1;case f.LogEventCompressionMode.Enabled:return!(n&&!i);case f.LogEventCompressionMode.Forced:return!0;default:return!1}}(e,this._options))try{const i=(new TextEncoder).encode(n),r=new CompressionStream("gzip"),s=r.writable.getWriter();s.write(i).catch(o.Log.error),s.close().catch(o.Log.error);const l=r.readable.getReader(),u=[];let c;for(;!(c=yield l.read()).done;)u.push(c.value);const d=u.reduce(((e,t)=>e+t.length),0),g=new Uint8Array(d);let _=0;for(const e of u)g.set(e,_),_+=e.length;e.body=g,e.params=Object.assign(Object.assign({},null!==(t=e.params)&&void 0!==t?t:{}),{[a.NetworkParam.IsGzipped]:"1"})}catch(t){o.Log.warn(`Request compression failed for ${e.urlConfig.getUrl()}`,t)}}))}_getInternalRequestArgs(e,t){const n=this._fallbackResolver.getActiveFallbackUrl(t.sdkKey,t.urlConfig),i=Object.assign(Object.assign({},t),{method:e,fallbackUrl:n});return"data"in t&&b(i,t.data),i}};const y=e=>!!e.sdkKey||(o.Log.warn("Unable to make request without an SDK key"),!1),b=(e,t)=>{const{sdkKey:n,fallbackUrl:i}=e,r=_.StableID.get(n),s=g.SessionID.get(n),o=c.SDKType._get(n);e.body=JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},v.StatsigMetadataProvider.get()),{stableID:r,sessionID:s,sdkType:o,fallbackUrl:i})}))};function S(e,t,n,i,r){e.urlConfig.endpoint===a.Endpoint._initialize&&s.Diagnostics._markInitNetworkReqEnd(e.sdkKey,s.Diagnostics._getDiagnosticsData(t,n,i,r))}},3351:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t._isDomainFailure=t.NetworkFallbackResolver=void 0;const r=n(6810),s=n(5585),o=n(7243),a=n(1285),l=6048e5;function u(e,t){var n;const i=null!==(n=null==e?void 0:e.toLowerCase())&&void 0!==n?n:"";return t||i.includes("uncaught exception")||i.includes("failed to fetch")||i.includes("networkerror when attempting to fetch resource")}function c(e){return`statsig.network_fallback.${(0,s._DJB2)(e)}`}function d(e,t){const n=c(e);t&&0!==Object.keys(t).length?a.Storage.setItem(n,JSON.stringify(t)):a.Storage.removeItem(n)}t.NetworkFallbackResolver=class{constructor(e){var t;this._fallbackInfo=null,this._errorBoundary=null,this._dnsQueryCooldowns={},this._networkOverrideFunc=null===(t=e.networkConfig)||void 0===t?void 0:t.networkOverrideFunc}setErrorBoundary(e){this._errorBoundary=e}tryBumpExpiryTime(e,t){var n;const i=null===(n=this._fallbackInfo)||void 0===n?void 0:n[t.endpoint];i&&(i.expiryTime=Date.now()+l,d(e,Object.assign(Object.assign({},this._fallbackInfo),{[t.endpoint]:i})))}getActiveFallbackUrl(e,t){var n,i;if(null!=t.customUrl&&null!=t.fallbackUrls)return null;let r=this._fallbackInfo;null==r&&(r=null!==(n=function(e){const t=c(e),n=a.Storage.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return o.Log.error("Failed to parse FallbackInfo"),null}}(e))&&void 0!==n?n:{},this._fallbackInfo=r);const s=r[t.endpoint];return!s||Date.now()>(null!==(i=s.expiryTime)&&void 0!==i?i:0)||t.getChecksum()!==s.urlConfigChecksum?(delete r[t.endpoint],this._fallbackInfo=r,d(e,this._fallbackInfo),null):s.url?s.url:null}tryFetchUpdatedFallbackInfo(e,t,n,r){return i(this,void 0,void 0,(function*(){var i,s;try{if(!u(n,r))return!1;const s=null==t.customUrl&&null==t.fallbackUrls?yield this._tryFetchFallbackUrlsFromNetwork(t):t.fallbackUrls,o=this._pickNewFallbackUrl(null===(i=this._fallbackInfo)||void 0===i?void 0:i[t.endpoint],s);return!!o&&(this._updateFallbackInfoWithNewUrl(e,t,o),!0)}catch(e){return null===(s=this._errorBoundary)||void 0===s||s.logError("tryFetchUpdatedFallbackInfo",e),!1}}))}_updateFallbackInfoWithNewUrl(e,t,n){var i,r,s;const o={urlConfigChecksum:t.getChecksum(),url:n,expiryTime:Date.now()+l,previous:[]},a=t.endpoint,u=null===(i=this._fallbackInfo)||void 0===i?void 0:i[a];u&&o.previous.push(...u.previous),o.previous.length>10&&(o.previous=[]);const c=null===(s=null===(r=this._fallbackInfo)||void 0===r?void 0:r[a])||void 0===s?void 0:s.url;null!=c&&o.previous.push(c),this._fallbackInfo=Object.assign(Object.assign({},this._fallbackInfo),{[a]:o}),d(e,this._fallbackInfo)}_tryFetchFallbackUrlsFromNetwork(e){return i(this,void 0,void 0,(function*(){var t;const n=this._dnsQueryCooldowns[e.endpoint];if(n&&Date.now()<n)return null;this._dnsQueryCooldowns[e.endpoint]=Date.now()+144e5;const i=[],s=yield(0,r._fetchTxtRecords)(null!==(t=this._networkOverrideFunc)&&void 0!==t?t:fetch),o=function(e){try{return new URL(e).pathname}catch(e){return null}}(e.defaultUrl);for(const t of s){if(!t.startsWith(e.endpointDnsKey+"="))continue;const n=t.split("=");if(n.length>1){let e=n[1];e.endsWith("/")&&(e=e.slice(0,-1)),i.push(`https://${e}${o}`)}}return i}))}_pickNewFallbackUrl(e,t){var n;if(null==t)return null;const i=new Set(null!==(n=null==e?void 0:e.previous)&&void 0!==n?n:[]),r=null==e?void 0:e.url;let s=null;for(const e of t){const t=e.endsWith("/")?e.slice(0,-1):e;if(!i.has(e)&&t!==r){s=t;break}}return s}},t._isDomainFailure=u},5462:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5546:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1034:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDKFlags=void 0;const n={};t.SDKFlags={setFlags:(e,t)=>{n[e]=t},get:(e,t)=>{var i,r;return null!==(r=null===(i=n[e])||void 0===i?void 0:i[t])&&void 0!==r&&r}}},7313:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDKType=void 0;const n={};let i;t.SDKType={_get:e=>{var t;return(null!==(t=n[e])&&void 0!==t?t:"js-mono")+(null!=i?i:"")},_setClientType(e,t){n[e]=t},_setBindingType(e){i&&"-react"!==i||(i="-"+e)}}},831:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getUnloadEvent=t._getCurrentPageUrlSafe=t._addDocumentEventListenerSafe=t._addWindowEventListenerSafe=t._isServerEnv=t._getDocumentSafe=t._getWindowSafe=void 0,t._getWindowSafe=()=>"undefined"!=typeof window?window:null,t._getDocumentSafe=()=>{var e;const n=(0,t._getWindowSafe)();return null!==(e=null==n?void 0:n.document)&&void 0!==e?e:null},t._isServerEnv=()=>{if(null!==(0,t._getDocumentSafe)())return!1;const e="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node;return"string"==typeof EdgeRuntime||e},t._addWindowEventListenerSafe=(e,n)=>{const i=(0,t._getWindowSafe)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(e,n)},t._addDocumentEventListenerSafe=(e,n)=>{const i=(0,t._getDocumentSafe)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(e,n)},t._getCurrentPageUrlSafe=()=>{var e;try{return null===(e=(0,t._getWindowSafe)())||void 0===e?void 0:e.location.href.split(/[?#]/)[0]}catch(e){return}},t._getUnloadEvent=()=>{const e=(0,t._getWindowSafe)();return e&&"onpagehide"in e?"pagehide":"beforeunload"}},9140:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigSession=t.SessionID=void 0;const i=n(5050),r=n(6448),s=n(7243),o=n(1285),a=n(7010),l=18e5,u=144e5,c={};function d(e,t){return setTimeout((()=>{var t;const n=null===(t=(0,i._getStatsigGlobal)())||void 0===t?void 0:t.instance(e);n&&n.$emt({name:"session_expired"})}),t)}function g(e){return`statsig.session_id.${(0,r._getStorageKey)(e)}`}t.SessionID={get:e=>t.StatsigSession.get(e).data.sessionID},t.StatsigSession={get:e=>(null==c[e]&&(c[e]=function(e){let t=function(e){const t=g(e);return(0,o._getObjectFromStorage)(t)}(e);const n=Date.now();return t||(t={sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n}),{data:t,sdkKey:e}}(e)),function(e){const t=Date.now(),n=e.data,i=e.sdkKey;if(function({lastUpdate:e}){return Date.now()-e>l}(n)||function({startTime:e}){return Date.now()-e>u}(n)){n.sessionID=(0,a.getUUID)(),n.startTime=t;const e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instance(i);e&&e.$emt({name:"session_expired"})}n.lastUpdate=t,function(e,t){const n=g(t);try{(0,o._setObjectInStorage)(n,e)}catch(e){s.Log.warn("Failed to save SessionID")}}(n,e.sdkKey),clearTimeout(e.idleTimeoutID),clearTimeout(e.ageTimeoutID);const r=t-n.startTime;return e.idleTimeoutID=d(i,l),e.ageTimeoutID=d(i,u-r),e}(c[e])),overrideInitialSessionID:(e,t)=>{c[t]=function(e,t){const n=Date.now();return{data:{sessionID:e,startTime:n,lastUpdate:n},sdkKey:t}}(e,t)}}},9133:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._fastApproxSizeOf=void 0,t._fastApproxSizeOf=(e,n)=>{let i=0;const r=Object.keys(e);for(let s=0;s<r.length;s++){const o=r[s],a=e[o];if(i+=o.length,i+="object"==typeof a&&null!==a?(0,t._fastApproxSizeOf)(a,n)+2:String(a).length+1,i>=n)return i}return i}},5683:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getCookieName=t.StableID=void 0;const i=n(6448),r=n(7243),s=n(831),o=n(1285),a=n(7010),l={},u={},c={};function d(e){return`statsig.stable_id.${(0,i._getStorageKey)(e)}`}function g(e,t){const n=d(t);try{(0,o._setObjectInStorage)(n,e)}catch(e){r.Log.warn("Failed to save StableID to storage")}}function _(e,t){if(!u[t]||null==(0,s._getDocumentSafe)())return;const n=new Date;n.setFullYear(n.getFullYear()+1),document.cookie=`${h(t)}=${encodeURIComponent(e)}; expires=${n.toUTCString()}; path=/`}function h(e){return`statsig.stable_id.${(0,i._getStorageKey)(e)}`}t.StableID={cookiesEnabled:!1,randomID:Math.random().toString(36),get:e=>{if(c[e])return null;if(null!=l[e])return l[e];let t=null;return t=function(e){if(!u[e]||null==(0,s._getDocumentSafe)())return null;const t=document.cookie.split(";");for(const n of t){const[t,i]=n.trim().split("=");if(t===h(e))return decodeURIComponent(i)}return null}(e),null!=t?(l[e]=t,g(t,e),t):(t=function(e){const t=d(e);return(0,o._getObjectFromStorage)(t)}(e),null==t&&(t=(0,a.getUUID)()),g(t,e),_(t,e),l[e]=t,t)},setOverride:(e,t)=>{l[t]=e,g(e,t),_(e,t)},_setCookiesEnabled:(e,t)=>{u[e]=t},_setDisabled:(e,t)=>{c[e]=t}},t.getCookieName=h},3524:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigClientBase=void 0,n(5050);const r=n(5050),s=n(9233),o=n(4361),a=n(7243),l=n(7312),u=n(831),c=n(9140),d=n(5683),g=n(3911),_=n(1285);t.StatsigClientBase=class{constructor(e,t,n,i){var l,g,h,v;this.loadingStatus="Uninitialized",this._initializePromise=null,this._listeners={};const f=this.$emt.bind(this);null!=(null==i?void 0:i.logLevel)&&(a.Log.level=i.logLevel),(null==i?void 0:i.disableStorage)&&_.Storage._setDisabled(!0),(null==i?void 0:i.initialSessionID)&&c.StatsigSession.overrideInitialSessionID(i.initialSessionID,e),(null==i?void 0:i.storageProvider)&&_.Storage._setProvider(i.storageProvider),(null==i?void 0:i.enableCookies)&&d.StableID._setCookiesEnabled(e,i.enableCookies),(null==i?void 0:i.disableStableID)&&d.StableID._setDisabled(e,!0),this._sdkKey=e,this._options=null!=i?i:{},this._memoCache={},this.overrideAdapter=null!==(l=null==i?void 0:i.overrideAdapter)&&void 0!==l?l:null,this._logger=new o.EventLogger(e,f,n,i),this._errorBoundary=new s.ErrorBoundary(e,i,f),this._errorBoundary.wrap(this),this._errorBoundary.wrap(t),this._errorBoundary.wrap(this._logger),n.setErrorBoundary(this._errorBoundary),this.dataAdapter=t,this.dataAdapter.attach(e,i,n),this.storageProvider=_.Storage,null===(v=null===(h=null===(g=this.overrideAdapter)||void 0===g?void 0:g.loadFromStorage)||void 0===h?void 0:h.call(g))||void 0===v||v.catch((e=>this._errorBoundary.logError("OA::loadFromStorage",e))),this._primeReadyRipcord(),function(e,t){var n;if((0,u._isServerEnv)())return;const i=(0,r._getStatsigGlobal)(),s=null!==(n=i.instances)&&void 0!==n?n:{},o=t;null!=s[e]&&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[e]=o,i.firstInstance||(i.firstInstance=o),i.instances=s,__STATSIG__=i}(e,this)}updateRuntimeOptions(e){e.loggingEnabled?(this._options.loggingEnabled=e.loggingEnabled,this._logger.setLoggingEnabled(e.loggingEnabled)):null!=e.disableLogging&&(this._options.disableLogging=e.disableLogging,this._logger.setLoggingEnabled(e.disableLogging?"disabled":"browser-only")),null!=e.disableStorage&&(this._options.disableStorage=e.disableStorage,_.Storage._setDisabled(e.disableStorage)),null!=e.enableCookies&&(this._options.enableCookies=e.enableCookies,d.StableID._setCookiesEnabled(this._sdkKey,e.enableCookies)),e.logEventCompressionMode?this._logger.setLogEventCompressionMode(e.logEventCompressionMode):e.disableCompression&&this._logger.setLogEventCompressionMode(g.LogEventCompressionMode.Disabled)}flush(){return this._logger.flush()}shutdown(){return i(this,void 0,void 0,(function*(){this.$emt({name:"pre_shutdown"}),this._setStatus("Uninitialized",null),this._initializePromise=null,yield this._logger.stop()}))}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){if(this._listeners[e]){const n=this._listeners[e].indexOf(t);-1!==n&&this._listeners[e].splice(n,1)}}$on(e,t){t.__isInternal=!0,this.on(e,t)}$emt(e){var t;const n=t=>{try{t(e)}catch(n){if(!0===t.__isInternal)return void this._errorBoundary.logError(`__emit:${e.name}`,n);a.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",e)}};this._listeners[e.name]&&this._listeners[e.name].forEach((e=>n(e))),null===(t=this._listeners["*"])||void 0===t||t.forEach(n)}_setStatus(e,t){this.loadingStatus=e,this._memoCache={},this.$emt({name:"values_updated",status:e,values:t})}_enqueueExposure(e,t,n){!0!==(null==n?void 0:n.disableExposureLog)?this._logger.enqueue(t):this._logger.incrementNonExposureCount(e)}_memoize(e,t){return(n,i)=>{if(this._options.disableEvaluationMemoization)return t(n,i);const r=(0,l.createMemoKey)(e,n,i);return r?(r in this._memoCache||(Object.keys(this._memoCache).length>=3e3&&(this._memoCache={}),this._memoCache[r]=t(n,i)),this._memoCache[r]):t(n,i)}}}},5043:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorTag=void 0,t.ErrorTag={NetworkError:"NetworkError"}},4967:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DataAdapterCachePrefix=void 0,t.DataAdapterCachePrefix="statsig.cached"},2504:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._createLayerParameterExposure=t._createConfigExposure=t._mapExposures=t._createGateExposure=t._isExposureEvent=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",r="statsig::layer_exposure",s=(e,t,n,i,r)=>(n.bootstrapMetadata&&(i.bootstrapMetadata=n.bootstrapMetadata),{eventName:e,user:t,value:null,metadata:a(n,i),secondaryExposures:r,time:Date.now()});function o(e,t){return e.map((e=>"string"==typeof e?(null!=t?t:{})[e]:e)).filter((e=>null!=e))}t._isExposureEvent=({eventName:e})=>e===i||e===n||e===r,t._createGateExposure=(e,t,n)=>{var r,a,l;const u={gate:t.name,gateValue:String(t.value),ruleID:t.ruleID};return null!=(null===(r=t.__evaluation)||void 0===r?void 0:r.version)&&(u.configVersion=t.__evaluation.version),s(i,e,t.details,u,o(null!==(l=null===(a=t.__evaluation)||void 0===a?void 0:a.secondary_exposures)&&void 0!==l?l:[],n))},t._mapExposures=o,t._createConfigExposure=(e,t,i)=>{var r,a,l,u;const c={config:t.name,ruleID:t.ruleID};return null!=(null===(r=t.__evaluation)||void 0===r?void 0:r.version)&&(c.configVersion=t.__evaluation.version),null!=(null===(a=t.__evaluation)||void 0===a?void 0:a.passed)&&(c.rulePassed=String(t.__evaluation.passed)),s(n,e,t.details,c,o(null!==(u=null===(l=t.__evaluation)||void 0===l?void 0:l.secondary_exposures)&&void 0!==u?u:[],i))},t._createLayerParameterExposure=(e,t,n,i)=>{var a,l,u,c,d,g,_;const h=t.__evaluation,v=!0===(null===(a=null==h?void 0:h.explicit_parameters)||void 0===a?void 0:a.includes(n));let f="",p=null!==(l=null==h?void 0:h.undelegated_secondary_exposures)&&void 0!==l?l:[];v&&(f=null!==(u=h.allocated_experiment_name)&&void 0!==u?u:"",p=null!==(c=h.secondary_exposures)&&void 0!==c?c:[]);const m=null===(d=t.__evaluation)||void 0===d?void 0:d.parameter_rule_ids,y={config:t.name,parameterName:n,ruleID:null!==(g=null==m?void 0:m[n])&&void 0!==g?g:t.ruleID,allocatedExperiment:f,isExplicitParameter:String(v)};return null!=(null===(_=t.__evaluation)||void 0===_?void 0:_.version)&&(y.configVersion=t.__evaluation.version),s(r,e,t.details,y,o(p,i))};const a=(e,t)=>(t.reason=e.reason,e.lcut&&(t.lcut=String(e.lcut)),e.receivedAt&&(t.receivedAt=String(e.receivedAt)),t)},7787:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigMetadataProvider=t.SDK_VERSION=void 0,t.SDK_VERSION="3.30.2";let n={sdkVersion:t.SDK_VERSION,sdkType:"js-mono"};t.StatsigMetadataProvider={get:()=>n,add:e=>{n=Object.assign(Object.assign({},n),e)}}},3911:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LoggingEnabledOption=t.LogEventCompressionMode=void 0,t.LogEventCompressionMode={Disabled:"d",Enabled:"e",Forced:"f"},t.LoggingEnabledOption={disabled:"disabled",browserOnly:"browser-only",always:"always"}},7289:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1406:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._makeTypedGet=t._mergeOverride=t._makeLayer=t._makeExperiment=t._makeDynamicConfig=t._makeFeatureGate=void 0;const i=n(7243),r=n(3357);function s(e,t,n,i){var r;return{name:e,details:t,ruleID:null!==(r=null==n?void 0:n.rule_id)&&void 0!==r?r:"",__evaluation:n,value:i}}function o(e,t,n){var i,r;const o=null!==(i=null==n?void 0:n.value)&&void 0!==i?i:{};return Object.assign(Object.assign({},s(e,t,n,o)),{idType:null!==(r=null==n?void 0:n.id_type)&&void 0!==r?r:null,get:a(e,null==n?void 0:n.value)})}function a(e,t,n){return(s,o)=>{var a;const l=null!==(a=null==t?void 0:t[s])&&void 0!==a?a:null;return null==l?null!=o?o:null:null==o||(0,r._isTypeMatch)(l,o)?(null==n||n(s),l):(i.Log.warn(`Parameter type mismatch. '${e}.${s}' was found to be type '${typeof l}' but fallback/return type is '${typeof o}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=o?o:null)}}t._makeFeatureGate=function(e,t,n){var i;return Object.assign(Object.assign({},s(e,t,n,!0===(null==n?void 0:n.value))),{idType:null!==(i=null==n?void 0:n.id_type)&&void 0!==i?i:null})},t._makeDynamicConfig=o,t._makeExperiment=function(e,t,n){var i;const r=o(e,t,n);return Object.assign(Object.assign({},r),{groupName:null!==(i=null==n?void 0:n.group_name)&&void 0!==i?i:null})},t._makeLayer=function(e,t,n,i){var r,o;return Object.assign(Object.assign({},s(e,t,n,void 0)),{get:a(e,null==n?void 0:n.value,i),groupName:null!==(r=null==n?void 0:n.group_name)&&void 0!==r?r:null,__value:null!==(o=null==n?void 0:n.value)&&void 0!==o?o:{}})},t._mergeOverride=function(e,t,n,i){return Object.assign(Object.assign(Object.assign({},e),t),{get:a(e.name,n,i)})},t._makeTypedGet=a},1033:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},8945:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UPDATE_DETAIL_ERROR_MESSAGES=t.createUpdateDetails=void 0,t.createUpdateDetails=(e,t,n,i,r,s)=>({duration:n,source:t,success:e,error:i,sourceUrl:r,warnings:s}),t.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."}},8001:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getFullUserHash=t._normalizeUser=void 0;const i=n(5585),r=n(7243);t._normalizeUser=function(e,t,n){try{const i=JSON.parse(JSON.stringify(e));return null!=t&&null!=t.environment?i.statsigEnvironment=t.environment:null!=n&&(i.statsigEnvironment={tier:n}),i}catch(e){return r.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},t._getFullUserHash=function(e){return e?(0,i._DJB2Object)(e):null}},1285:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._setObjectInStorage=t._getObjectFromStorage=t.Storage=void 0;const i=n(7243),r=n(831),s={},o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:e=>s[e]?s[e]:null,setItem:(e,t)=>{s[e]=t},removeItem:e=>{delete s[e]},getAllKeys:()=>Object.keys(s)};let a=null;try{const e=(0,r._getWindowSafe)();e&&e.localStorage&&"function"==typeof e.localStorage.getItem&&(a={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>e.localStorage.getItem(t),setItem:(t,n)=>e.localStorage.setItem(t,n),removeItem:t=>e.localStorage.removeItem(t),getAllKeys:()=>Object.keys(e.localStorage)})}catch(e){i.Log.warn("Failed to setup localStorageProvider.")}let l=null!=a?a:o,u=l;function c(e){try{return e()}catch(e){if(e instanceof Error&&"SecurityError"===e.name)return t.Storage._setProvider(o),null;throw e}}t.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:e=>c((()=>u.getItem(e))),setItem:(e,t)=>c((()=>u.setItem(e,t))),removeItem:e=>u.removeItem(e),getAllKeys:()=>u.getAllKeys(),_setProvider:e=>{l=e,u=e},_setDisabled:e=>{u=e?o:l}},t._getObjectFromStorage=function(e){const n=t.Storage.getItem(e);try{return JSON.parse(null!=n?n:"null")}catch(t){return i.Log.error(`Failed to parse value for key "${e}"`),null}},t._setObjectInStorage=function(e,n){t.Storage.setItem(e,JSON.stringify(n))}},8532:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._typedJsonParse=void 0;const i=n(7243);t._typedJsonParse=function(e,t,n){try{const n=JSON.parse(e);if(n&&"object"==typeof n&&t in n)return n}catch(e){}return i.Log.error(`Failed to parse ${n}`),null}},3357:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._isTypeMatch=t._typeOf=void 0,t._typeOf=function(e){return Array.isArray(e)?"array":typeof e},t._isTypeMatch=function(e,t){const n=e=>Array.isArray(e)?"array":null===e?"null":typeof e;return n(e)===n(t)}},7010:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getUUID=void 0,t.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let e=(new Date).getTime(),t="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,(n=>{let i=16*Math.random();return e>0?(i=(e+i)%16|0,e=Math.floor(e/16)):(i=(t+i)%16|0,t=Math.floor(t/16)),("x"===n?i:7&i|8).toString(16)}))}},1932:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UrlConfiguration=void 0;const i=n(5585),r=n(7245),s={[r.Endpoint._initialize]:"i",[r.Endpoint._rgstr]:"e",[r.Endpoint._download_config_specs]:"d"};t.UrlConfiguration=class{constructor(e,t,n,i){this.customUrl=null,this.fallbackUrls=null,this.endpoint=e,this.endpointDnsKey=s[e],t&&(this.customUrl=t),!t&&n&&(this.customUrl=n.endsWith("/")?`${n}${e}`:`${n}/${e}`),i&&(this.fallbackUrls=i);const o=r.NetworkDefault[e];this.defaultUrl=`${o}/${e}`}getUrl(){var e;return null!==(e=this.customUrl)&&void 0!==e?e:this.defaultUrl}getChecksum(){var e;const t=(null!==(e=this.fallbackUrls)&&void 0!==e?e:[]).sort().join(",");return(0,i._DJB2)(this.customUrl+t)}}},9454:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._notifyVisibilityChanged=t._subscribeToVisiblityChanged=t._isUnloading=t._isCurrentlyVisible=void 0;const i=n(831),r="foreground",s="background",o=[];let a=r,l=!1;t._isCurrentlyVisible=()=>a===r,t._isUnloading=()=>l,t._subscribeToVisiblityChanged=e=>{o.unshift(e)},t._notifyVisibilityChanged=e=>{e!==a&&(a=e,o.forEach((t=>t(e))))},(0,i._addWindowEventListenerSafe)("focus",(()=>{l=!1,(0,t._notifyVisibilityChanged)(r)})),(0,i._addWindowEventListenerSafe)("blur",(()=>(0,t._notifyVisibilityChanged)(s))),(0,i._addDocumentEventListenerSafe)("visibilitychange",(()=>{(0,t._notifyVisibilityChanged)("visible"===document.visibilityState?r:s)})),(0,i._addWindowEventListenerSafe)((0,i._getUnloadEvent)(),(()=>{l=!0,(0,t._notifyVisibilityChanged)(s)}))},4485:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Storage=t.Log=t.EventLogger=t.Diagnostics=void 0,n(5050);const s=n(5050),o=n(4001);Object.defineProperty(t,"Diagnostics",{enumerable:!0,get:function(){return o.Diagnostics}});const a=n(4361);Object.defineProperty(t,"EventLogger",{enumerable:!0,get:function(){return a.EventLogger}});const l=n(7243);Object.defineProperty(t,"Log",{enumerable:!0,get:function(){return l.Log}});const u=n(7787),c=n(1285);Object.defineProperty(t,"Storage",{enumerable:!0,get:function(){return c.Storage}}),r(n(5050),t),r(n(6448),t),r(n(2082),t),r(n(977),t),r(n(4001),t),r(n(6012),t),r(n(9233),t),r(n(1645),t),r(n(638),t),r(n(5585),t),r(n(1368),t),r(n(7243),t),r(n(7312),t),r(n(7245),t),r(n(2336),t),r(n(5462),t),r(n(5546),t),r(n(831),t),r(n(7313),t),r(n(9140),t),r(n(9133),t),r(n(5683),t),r(n(3524),t),r(n(5043),t),r(n(4967),t),r(n(2504),t),r(n(7787),t),r(n(3911),t),r(n(7289),t),r(n(1406),t),r(n(1033),t),r(n(8001),t),r(n(1285),t),r(n(8532),t),r(n(3357),t),r(n(1932),t),r(n(7010),t),r(n(9454),t),r(n(8945),t),r(n(1034),t),Object.assign((0,s._getStatsigGlobal)(),{Log:l.Log,SDK_VERSION:u.SDK_VERSION})},4343:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._resolveDeltasResponse=void 0;const i=n(4485);function r(e,t){null==e||e.forEach((e=>{delete t[e]}))}t._resolveDeltasResponse=function(e,t){const n=(0,i._typedJsonParse)(t,"checksum","DeltasEvaluationResponse");if(!n)return{hadBadDeltaChecksum:!0};const s=function(e){const t=e;return r(e.deleted_gates,t.feature_gates),delete t.deleted_gates,r(e.deleted_configs,t.dynamic_configs),delete t.deleted_configs,r(e.deleted_layers,t.layer_configs),delete t.deleted_layers,t}(function(e,t){return Object.assign(Object.assign(Object.assign({},e),t),{feature_gates:Object.assign(Object.assign({},e.feature_gates),t.feature_gates),layer_configs:Object.assign(Object.assign({},e.layer_configs),t.layer_configs),dynamic_configs:Object.assign(Object.assign({},e.dynamic_configs),t.dynamic_configs)})}(e,n)),o=(0,i._DJB2Object)({feature_gates:s.feature_gates,dynamic_configs:s.dynamic_configs,layer_configs:s.layer_configs},2);return o===n.checksumV2?JSON.stringify(s):{hadBadDeltaChecksum:!0,badChecksum:o,badMergedConfigs:s,badFullResponse:n.deltas_full_response}}},4046:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const i=n(4485),r=n(2051),s=n(2920);t.default=class{constructor(e){this._sdkKey=e,this._rawValues=null,this._values=null,this._source="Uninitialized",this._lcut=0,this._receivedAt=0,this._bootstrapMetadata=null,this._warnings=new Set}reset(){this._values=null,this._rawValues=null,this._source="Loading",this._lcut=0,this._receivedAt=0,this._bootstrapMetadata=null,this._warnings.clear()}finalize(){this._values||(this._source="NoValues")}getValues(){return this._rawValues?(0,i._typedJsonParse)(this._rawValues,"has_updates","EvaluationStoreValues"):null}setValues(e,t){var n,o;if(!e)return!1;const a=(0,i._typedJsonParse)(e.data,"has_updates","EvaluationResponse");return null!=a&&(this._source=e.source,!0!==(null==a?void 0:a.has_updates)||(null!==(n=a.time)&&void 0!==n?n:0)<this._lcut||(this._rawValues=e.data,this._lcut=a.time,this._receivedAt=e.receivedAt,"init-v2"===a.response_format?this._values=new s.V2InitializeContainer(a):this._values=new r.V1InitializeContainer(a),this._bootstrapMetadata=this._extractBootstrapMetadata(e.source,a),e.source&&a.user&&this._setWarningState(t,a),i.SDKFlags.setFlags(this._sdkKey,null!==(o=a.sdk_flags)&&void 0!==o?o:{})),!0)}getWarnings(){if(0!==this._warnings.size)return Array.from(this._warnings)}getGate(e){const t=this._values?this._values.getGate(e):null;return this._getDetailedStoreResult(t)}getConfig(e){const t=this._values?this._values.getConfig(e):null;return this._getDetailedStoreResult(t)}getConfigList(){return this._values?this._values.getConfigList():[]}getLayer(e){const t=this._values?this._values.getLayer(e):null;return this._getDetailedStoreResult(t)}getParamStore(e){const t=this._values?this._values.getParamStore(e):null;return this._getDetailedStoreResult(t)}getSource(){return this._source}getExposureMapping(){var e;return null===(e=this._values)||void 0===e?void 0:e.getExposureMapping()}_extractBootstrapMetadata(e,t){if("Bootstrap"!==e)return null;const n={};return t.user&&(n.user=t.user),t.sdkInfo&&(n.generatorSDKInfo=t.sdkInfo),n.lcut=t.time,n}_getDetailedStoreResult(e){return{result:e,details:this._getDetails(null==e)}}_setWarningState(e,t){var n,r;const s=i.StableID.get(this._sdkKey);if((null===(n=e.customIDs)||void 0===n?void 0:n.stableID)===s||!(null===(r=e.customIDs)||void 0===r?void 0:r.stableID)&&!s){if("user"in t){const n=t.user,r=Object.assign(Object.assign({},e),{analyticsOnlyMetadata:void 0,privateAttributes:void 0});(0,i._getFullUserHash)(r)!==(0,i._getFullUserHash)(n)&&this._warnings.add("PartialUserMatch")}}else this._warnings.add("StableIDMismatch")}getCurrentSourceDetails(){if("Uninitialized"===this._source||"NoValues"===this._source)return{reason:this._source};const e={reason:this._source,lcut:this._lcut,receivedAt:this._receivedAt};return this._warnings.size>0&&(e.warnings=Array.from(this._warnings)),e}_getDetails(e){var t,n;const i=this.getCurrentSourceDetails();let r=i.reason;const s=null!==(t=i.warnings)&&void 0!==t?t:[];"Bootstrap"===this._source&&s.length>0&&(r+=s[0]),"Uninitialized"!==r&&"NoValues"!==r&&(r=`${r}:${e?"Unrecognized":"Recognized"}`);const o="Bootstrap"===this._source&&null!==(n=this._bootstrapMetadata)&&void 0!==n?n:void 0;return o&&(i.bootstrapMetadata=o),Object.assign(Object.assign({},i),{reason:r})}}},787:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(4485),s=n(4343);class o extends r.NetworkCore{constructor(e,t){super(e,t);const n=null==e?void 0:e.networkConfig;this._option=e,this._initializeUrlConfig=new r.UrlConfiguration(r.Endpoint._initialize,null==n?void 0:n.initializeUrl,null==n?void 0:n.api,null==n?void 0:n.initializeFallbackUrls)}fetchEvaluations(e,t,n,s,o){return i(this,void 0,void 0,(function*(){var i,a,l,u,c,d;const g=t?(0,r._typedJsonParse)(t,"has_updates","InitializeResponse"):null;let _={user:s,hash:null!==(l=null===(a=null===(i=this._option)||void 0===i?void 0:i.networkConfig)||void 0===a?void 0:a.initializeHashAlgorithm)&&void 0!==l?l:"djb2",deltasResponseRequested:!1,full_checksum:null};if(null==g?void 0:g.has_updates){const e=(null==g?void 0:g.hash_used)!==(null!==(d=null===(c=null===(u=this._option)||void 0===u?void 0:u.networkConfig)||void 0===c?void 0:c.initializeHashAlgorithm)&&void 0!==d?d:"djb2");_=Object.assign(Object.assign({},_),{sinceTime:o&&!e?g.time:0,previousDerivedFields:"derived_fields"in g&&o?g.derived_fields:{},deltasResponseRequested:!0,full_checksum:g.full_checksum,partialUserMatchSinceTime:e?0:g.time})}return this._fetchEvaluations(e,g,_,n)}))}_fetchEvaluations(e,t,n,r){return i(this,void 0,void 0,(function*(){var i,o;const a=yield this.post({sdkKey:e,urlConfig:this._initializeUrlConfig,data:n,retries:2,isStatsigEncodable:!0,priority:r});if(204===(null==a?void 0:a.code))return'{"has_updates": false}';if(200!==(null==a?void 0:a.code))return null!==(i=null==a?void 0:a.body)&&void 0!==i?i:null;if(!0!==(null==t?void 0:t.has_updates)||!0!==(null===(o=a.body)||void 0===o?void 0:o.includes('"is_delta":true'))||!0!==n.deltasResponseRequested)return a.body;const l=(0,s._resolveDeltasResponse)(t,a.body);return"string"==typeof l?l:this._fetchEvaluations(e,t,Object.assign(Object.assign(Object.assign({},n),l),{deltasResponseRequested:!1}),r)}))}}t.default=o},3824:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._makeParamStoreGetter=void 0;const i=n(4485),r={disableExposureLog:!0};function s(e){return null==e||!1===e.disableExposureLog}function o(e,t){return null!=t&&!(0,i._isTypeMatch)(e,t)}t._makeParamStoreGetter=function(e,t,n){return(a,l)=>{if(null==t)return l;const u=t[a];if(null==u||null!=l&&(0,i._typeOf)(l)!==u.param_type)return l;switch(u.ref_type){case"static":return function(e,t){return e.value}(u);case"gate":return function(e,t,n){return e.getFeatureGate(t.gate_name,s(n)?void 0:r).value?t.pass_value:t.fail_value}(e,u,n);case"dynamic_config":return function(e,t,n,i){const a=e.getDynamicConfig(t.config_name,s(i)?void 0:r).get(t.param_name);return o(a,n)?n:a}(e,u,l,n);case"experiment":return function(e,t,n,i){const a=e.getExperiment(t.experiment_name,s(i)?void 0:r).get(t.param_name);return o(a,n)?n:a}(e,u,l,n);case"layer":return function(e,t,n,i){const a=e.getLayer(t.layer_name,s(i)?void 0:r).get(t.param_name);return o(a,n)?n:a}(e,u,l,n);default:return l}}}},8533:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(4485),s=n(4046),o=n(787),a=n(3824),l=n(2004);class u extends r.StatsigClientBase{static instance(e){const t=(0,r._getStatsigGlobal)().instance(e);return t instanceof u?t:(r.Log.warn((0,r._isServerEnv)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new u(null!=e?e:"",{}))}constructor(e,t,n=null){var i,a;r.SDKType._setClientType(e,"javascript-client");const u=new o.default(n,(e=>{this.$emt(e)}));super(e,null!==(i=null==n?void 0:n.dataAdapter)&&void 0!==i?i:new l.StatsigEvaluationsDataAdapter,u,n),this._possibleFirstTouchMetadata={},this.getFeatureGate=this._memoize(r.MemoPrefix._gate,this._getFeatureGateImpl.bind(this)),this.getDynamicConfig=this._memoize(r.MemoPrefix._dynamicConfig,this._getDynamicConfigImpl.bind(this)),this.getExperiment=this._memoize(r.MemoPrefix._experiment,this._getExperimentImpl.bind(this)),this.getConfigList=this._memoize(r.MemoPrefix._configList,this._getConfigListImpl.bind(this)),this.getLayer=this._memoize(r.MemoPrefix._layer,this._getLayerImpl.bind(this)),this.getParameterStore=this._memoize(r.MemoPrefix._paramStore,this._getParameterStoreImpl.bind(this)),this._store=new s.default(e),this._network=u,this._user=this._configureUser(t,n),this._sdkInstanceID=(0,r.getUUID)();const c=null!==(a=null==n?void 0:n.plugins)&&void 0!==a?a:[];for(const e of c)e.bind(this)}initializeSync(e){var t;return"Uninitialized"!==this.loadingStatus?(0,r.createUpdateDetails)(!0,this._store.getSource(),-1,null,null,["MultipleInitializations",...null!==(t=this._store.getWarnings())&&void 0!==t?t:[]]):(this._logger.start(),this.updateUserSync(this._user,e))}initializeAsync(e){return i(this,void 0,void 0,(function*(){return this._initializePromise||(this._initializePromise=this._initializeAsyncImpl(e)),this._initializePromise}))}updateUserSync(e,t){const n=performance.now();try{return this._updateUserSyncImpl(e,t,n)}catch(e){const t=e instanceof Error?e:new Error(String(e));return this._createErrorUpdateDetails(t,n)}}_updateUserSyncImpl(e,t,n){var i;const s=[...null!==(i=this._store.getWarnings())&&void 0!==i?i:[]];this._resetForUser(e);const o=this.dataAdapter.getDataSync(this._user);null==o&&s.push("NoCachedValues"),this._store.setValues(o,this._user),this._finalizeUpdate(o);const a=null==t?void 0:t.disableBackgroundCacheRefresh;return!0===a||null==a&&"Bootstrap"===(null==o?void 0:o.source)||this._runPostUpdate(null!=o?o:null,this._user),(0,r.createUpdateDetails)(!0,this._store.getSource(),performance.now()-n,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),s)}updateUserAsync(e,t){return i(this,void 0,void 0,(function*(){const n=performance.now();try{return yield this._updateUserAsyncImpl(e,t)}catch(e){const t=e instanceof Error?e:new Error(String(e));return this._createErrorUpdateDetails(t,n)}}))}_updateUserAsyncImpl(e,t){return i(this,void 0,void 0,(function*(){this._resetForUser(e);const n=this._user;r.Diagnostics._markInitOverallStart(this._sdkKey);let i=this.dataAdapter.getDataSync(n);if(this._store.setValues(i,this._user),this._setStatus("Loading",i),i=yield this.dataAdapter.getDataAsync(i,n,t),n!==this._user)return(0,r.createUpdateDetails)(!1,this._store.getSource(),-1,new Error("User changed during update"),this._network.getLastUsedInitUrlAndReset());let s=!1;null!=i&&(r.Diagnostics._markInitProcessStart(this._sdkKey),s=this._store.setValues(i,this._user),r.Diagnostics._markInitProcessEnd(this._sdkKey,{success:s})),this._finalizeUpdate(i),s||(this._errorBoundary.attachErrorIfNoneExists(r.UPDATE_DETAIL_ERROR_MESSAGES.NO_NETWORK_DATA),this.$emt({name:"initialization_failure"})),r.Diagnostics._markInitOverallEnd(this._sdkKey,s,this._store.getCurrentSourceDetails());const o=r.Diagnostics._enqueueDiagnosticsEvent(this._user,this._logger,this._sdkKey,this._options);return(0,r.createUpdateDetails)(s,this._store.getSource(),o,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),this._store.getWarnings())}))}getContext(){let e={};try{e=JSON.parse(JSON.stringify(this._user))}catch(e){r.Log.error("Failed to parse user")}return{sdkKey:this._sdkKey,options:this._options,values:this._store.getValues(),user:e,errorBoundary:this._errorBoundary,session:r.StatsigSession.get(this._sdkKey),stableID:r.StableID.get(this._sdkKey),sdkInstanceID:this._sdkInstanceID}}checkGate(e,t){return this.getFeatureGate(e,t).value}logEvent(e,t,n){const i="string"==typeof e?{eventName:e,value:t,metadata:n}:e;this.$emt({name:"log_event_called",event:i}),this._logger.enqueue(Object.assign(Object.assign({},i),{user:this._user,time:Date.now()}))}updateUserWithAnalyticsOnlyMetadata(e){this._user=this._configureUser(Object.assign(Object.assign({},this._user),{analyticsOnlyMetadata:e}),this._options)}_primeReadyRipcord(){this.$on("error",(()=>{"Loading"===this.loadingStatus&&this._finalizeUpdate(null)}))}_initializeAsyncImpl(e){return i(this,void 0,void 0,(function*(){return r.Storage.isReady()||(yield r.Storage.isReadyResolver()),this._logger.start(),this.updateUserAsync(this._user,e)}))}_createErrorUpdateDetails(e,t){var n;return(0,r.createUpdateDetails)(!1,this._store.getSource(),performance.now()-t,e,null,[...null!==(n=this._store.getWarnings())&&void 0!==n?n:[]])}_finalizeUpdate(e){this._store.finalize(),this._setStatus("Ready",e)}_runPostUpdate(e,t){this.dataAdapter.getDataAsync(e,t,{priority:"low"}).catch((e=>{r.Log.error("An error occurred after update.",e)}))}_resetForUser(e){this._logger.reset(),this._store.reset(),this._user=this._configureUser(e,this._options)}_configureUser(e,t){var n,i,s;const o=(0,r._normalizeUser)(e,t),a=null===(n=o.customIDs)||void 0===n?void 0:n.stableID;if(a){const e=null===(s=(i=this.storageProvider).isReadyResolver)||void 0===s?void 0:s.call(i);e?e.then((()=>r.StableID.setOverride(a,this._sdkKey)),(()=>r.StableID.setOverride(a,this._sdkKey))):r.StableID.setOverride(a,this._sdkKey)}return Object.keys(this._possibleFirstTouchMetadata).length>0&&(o.analyticsOnlyMetadata=Object.assign(Object.assign({},o.analyticsOnlyMetadata),this._possibleFirstTouchMetadata)),o}_getFeatureGateImpl(e,t){var n,i;const{result:s,details:o}=this._store.getGate(e),a=(0,r._makeFeatureGate)(e,o,s),l=null===(i=null===(n=this.overrideAdapter)||void 0===n?void 0:n.getGateOverride)||void 0===i?void 0:i.call(n,a,this._user,t),u=null!=l?l:a;return this._enqueueExposure(e,(0,r._createGateExposure)(this._user,u,this._store.getExposureMapping()),t),this.$emt({name:"gate_evaluation",gate:u}),u}_getDynamicConfigImpl(e,t){var n,i;const{result:s,details:o}=this._store.getConfig(e),a=(0,r._makeDynamicConfig)(e,o,s),l=null===(i=null===(n=this.overrideAdapter)||void 0===n?void 0:n.getDynamicConfigOverride)||void 0===i?void 0:i.call(n,a,this._user,t),u=null!=l?l:a;return this._enqueueExposure(e,(0,r._createConfigExposure)(this._user,u,this._store.getExposureMapping()),t),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:u}),u}_getExperimentImpl(e,t){var n,i,s,o;const{result:a,details:l}=this._store.getConfig(e),u=(0,r._makeExperiment)(e,l,a);null!=u.__evaluation&&(u.__evaluation.secondary_exposures=(0,r._mapExposures)(null!==(i=null===(n=u.__evaluation)||void 0===n?void 0:n.secondary_exposures)&&void 0!==i?i:[],this._store.getExposureMapping()));const c=null===(o=null===(s=this.overrideAdapter)||void 0===s?void 0:s.getExperimentOverride)||void 0===o?void 0:o.call(s,u,this._user,t),d=null!=c?c:u;return this._enqueueExposure(e,(0,r._createConfigExposure)(this._user,d,this._store.getExposureMapping()),t),this.$emt({name:"experiment_evaluation",experiment:d}),d}_getConfigListImpl(){return this._store.getConfigList()}_getLayerImpl(e,t){var n,i,s;const{result:o,details:a}=this._store.getLayer(e),l=(0,r._makeLayer)(e,a,o),u=null===(i=null===(n=this.overrideAdapter)||void 0===n?void 0:n.getLayerOverride)||void 0===i?void 0:i.call(n,l,this._user,t);(null==t?void 0:t.disableExposureLog)&&this._logger.incrementNonExposureCount(e);const c=(0,r._mergeOverride)(l,u,null!==(s=null==u?void 0:u.__value)&&void 0!==s?s:l.__value,(n=>{(null==t?void 0:t.disableExposureLog)||this._enqueueExposure(e,(0,r._createLayerParameterExposure)(this._user,c,n,this._store.getExposureMapping()),t)}));return this.$emt({name:"layer_evaluation",layer:c}),c}_getParameterStoreImpl(e,t){var n,i;const{result:r,details:s}=this._store.getParamStore(e);this._logger.incrementNonExposureCount(e);const o={name:e,details:s,__configuration:r,get:(0,a._makeParamStoreGetter)(this,r,t)},l=null===(i=null===(n=this.overrideAdapter)||void 0===n?void 0:n.getParamStoreOverride)||void 0===i?void 0:i.call(n,o,t);return null!=l&&(o.__configuration=l.config,o.details=l.details,o.get=(0,a._makeParamStoreGetter)(this,l.config,t)),o}}t.default=u},2004:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigEvaluationsDataAdapter=void 0;const r=n(4485),s=n(787);class o extends r.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this._network=null,this._options=null}attach(e,t,n){super.attach(e,t,n),null!==n&&n instanceof s.default?this._network=n:this._network=new s.default(null!=t?t:{})}getDataAsync(e,t,n){return this._getDataAsyncImpl(e,(0,r._normalizeUser)(t,this._options),n)}prefetchData(e,t){return this._prefetchDataImpl(e,t)}setData(e){const t=(0,r._typedJsonParse)(e,"has_updates","data");t&&"user"in t?super.setData(e,t.user):r.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(e,t){super.setData(e,t)}_fetchFromNetwork(e,t,n,r){return i(this,void 0,void 0,(function*(){var i;const s=yield null===(i=this._network)||void 0===i?void 0:i.fetchEvaluations(this._getSdkKey(),e,null==n?void 0:n.priority,t,r);return null!=s?s:null}))}_getCacheKey(e){var t;const n=(0,r._getStorageKey)(this._getSdkKey(),e,null===(t=this._options)||void 0===t?void 0:t.customUserCacheKeyFunc);return`${r.DataAdapterCachePrefix}.${this._cacheSuffix}.${n}`}_isCachedResultValidFor204(e,t){return null!=e.fullUserHash&&e.fullUserHash===(0,r._getFullUserHash)(t)}}t.StatsigEvaluationsDataAdapter=o},2051:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.V1InitializeContainer=void 0;const i=n(4485);t.V1InitializeContainer=class{constructor(e){this._values=e}getGate(e){return this._getResultFromLookup(this._values.feature_gates,e)}getConfig(e){return this._getResultFromLookup(this._values.dynamic_configs,e)}getLayer(e){return this._getResultFromLookup(this._values.layer_configs,e)}getParamStore(e){return this._getResultFromLookup(this._values.param_stores,e)}getConfigList(){return Object.keys(this._values.dynamic_configs)}getExposureMapping(){return this._values.exposures}_getResultFromLookup(e,t){var n,r;return e&&null!==(r=null!==(n=e[t])&&void 0!==n?n:e[(0,i._DJB2)(t)])&&void 0!==r?r:null}}},2920:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.V2InitializeContainer=void 0;const i=n(4485);t.V2InitializeContainer=class{constructor(e){this._values=e}getGate(e){var t,n,i;const r=this._getResultFromLookup(this._values.feature_gates,e);return r?{name:e,value:!0===r.v,rule_id:null!==(t=r.r)&&void 0!==t?t:"default",secondary_exposures:null!==(n=r.s)&&void 0!==n?n:[],id_type:null!==(i=r.i)&&void 0!==i?i:""}:null}getConfig(e){var t,n,i,r;const s=this._getResultFromLookup(this._values.dynamic_configs,e);return s?{name:e,value:null!==(t=this._values.values[s.v])&&void 0!==t?t:{},rule_id:s.r,secondary_exposures:null!==(n=s.s)&&void 0!==n?n:[],id_type:null!==(i=s.i)&&void 0!==i?i:"",is_user_in_experiment:!0===s.ue,passed:!0===s.p,group_name:null!==(r=s.gn)&&void 0!==r?r:void 0,is_experiment_active:!0===s.ea,group:s.r,is_device_based:"stableID"===s.i}:null}getLayer(e){var t,n,i,r,s,o;const a=this._getResultFromLookup(this._values.layer_configs,e);return a?{name:e,value:null!==(t=this._values.values[a.v])&&void 0!==t?t:{},rule_id:a.r,secondary_exposures:null!==(n=a.s)&&void 0!==n?n:[],is_user_in_experiment:!0===a.ue,group_name:null!==(i=a.gn)&&void 0!==i?i:void 0,is_experiment_active:!0===a.ea,group:a.r,is_device_based:"stableID"===a.i,allocated_experiment_name:null!==(r=a.ae)&&void 0!==r?r:"",explicit_parameters:null!==(s=a.ep)&&void 0!==s?s:[],undelegated_secondary_exposures:null!==(o=a.us)&&void 0!==o?o:[],parameter_rule_ids:a.pr}:null}getParamStore(e){return this._getResultFromLookup(this._values.param_stores,e)}getConfigList(){return Object.keys(this._values.dynamic_configs)}getExposureMapping(){return this._values.exposures}_getResultFromLookup(e,t){var n,r;return e&&null!==(r=null!==(n=e[t])&&void 0!==n?n:e[(0,i._DJB2)(t)])&&void 0!==r?r:null}}},2869:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigClient=void 0;const s=n(4485),o=n(8533);t.StatsigClient=o.default,r(n(4485),t);const a=Object.assign((0,s._getStatsigGlobal)(),{StatsigClient:o.default});t.default=a},2169:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.LocalOverrideAdapter=void 0;const r=n(4485),s="LocalOverride:Recognized";t.LocalOverrideAdapter=class{constructor(e){this._overrides={gate:{},dynamicConfig:{},experiment:{},layer:{},paramStore:{}},this._sdkKey=null!=e?e:null}_getLocalOverridesStorageKey(e){return`statsig.local-overrides.${(0,r._getStorageKey)(e)}`}loadFromStorage(){return i(this,void 0,void 0,(function*(){if(null==this._sdkKey)return;r.Storage.isReady()||(yield r.Storage.isReadyResolver());const e=this._getLocalOverridesStorageKey(this._sdkKey),t=r.Storage.getItem(e),n=t?(0,r._typedJsonParse)(t,"gate","LocalOverrideAdapter overrides"):null,i=this._hasInMemoryOverrides();var s,o;n&&(this._overrides=i?(s=n,o=this._overrides,{gate:Object.assign({},s.gate,o.gate),dynamicConfig:Object.assign({},s.dynamicConfig,o.dynamicConfig),experiment:Object.assign({},s.experiment,o.experiment),layer:Object.assign({},s.layer,o.layer),paramStore:Object.assign({},s.paramStore,o.paramStore)}):n),i&&this._saveOverridesToStorage()}))}_saveOverridesToStorage(){if(null==this._sdkKey||!r.Storage.isReady())return;const e=this._getLocalOverridesStorageKey(this._sdkKey);r.Storage.setItem(e,JSON.stringify(this._overrides))}overrideGate(e,t){this._overrides.gate[e]=t,this._overrides.gate[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}_warnIfStorageNotReady(){r.Storage.isReady()||r.Log.warn("Storage is not ready. Override removal may not persist.")}removeGateOverride(e){this._warnIfStorageNotReady(),delete this._overrides.gate[e],delete this._overrides.gate[(0,r._DJB2)(e)],this._saveOverridesToStorage()}getGateOverride(e,t){var n;const i=null!==(n=this._overrides.gate[e.name])&&void 0!==n?n:this._overrides.gate[(0,r._DJB2)(e.name)];return null==i?null:Object.assign(Object.assign({},e),{value:i,details:Object.assign(Object.assign({},e.details),{reason:s})})}overrideDynamicConfig(e,t){this._overrides.dynamicConfig[e]=t,this._overrides.dynamicConfig[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}removeDynamicConfigOverride(e){this._warnIfStorageNotReady(),delete this._overrides.dynamicConfig[e],delete this._overrides.dynamicConfig[(0,r._DJB2)(e)],this._saveOverridesToStorage()}getDynamicConfigOverride(e,t){return this._getConfigOverride(e,this._overrides.dynamicConfig)}overrideExperiment(e,t){this._overrides.experiment[e]=t,this._overrides.experiment[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}removeExperimentOverride(e){this._warnIfStorageNotReady(),delete this._overrides.experiment[e],delete this._overrides.experiment[(0,r._DJB2)(e)],this._saveOverridesToStorage()}getExperimentOverride(e,t){return this._getConfigOverride(e,this._overrides.experiment)}overrideLayer(e,t){this._overrides.layer[e]=t,this._overrides.layer[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}removeLayerOverride(e){this._warnIfStorageNotReady(),delete this._overrides.layer[e],delete this._overrides.layer[(0,r._DJB2)(e)],this._saveOverridesToStorage()}overrideParamStore(e,t){this._overrides.paramStore[e]=t,this._overrides.paramStore[(0,r._DJB2)(e)]=t,this._saveOverridesToStorage()}removeParamStoreOverride(e){this._warnIfStorageNotReady(),delete this._overrides.paramStore[e],delete this._overrides.paramStore[(0,r._DJB2)(e)],this._saveOverridesToStorage()}getParamStoreOverride(e){var t;const n=null!==(t=this._overrides.paramStore[e.name])&&void 0!==t?t:this._overrides.paramStore[(0,r._DJB2)(e.name)];if(null==n)return null;const i=Object.assign({},e.__configuration||{});for(const[e,t]of Object.entries(n)){const n=this._inferParamType(t);i[e]={ref_type:"static",param_type:n,value:t}}return{config:i,details:Object.assign(Object.assign({},e.details),{reason:s})}}getAllOverrides(){var e;return null!==(e=(0,r._typedJsonParse)(JSON.stringify(this._overrides),"gate","OverrideStore"))&&void 0!==e?e:{gate:{},dynamicConfig:{},experiment:{},layer:{},paramStore:{}}}removeAllOverrides(){this._warnIfStorageNotReady(),this._overrides={gate:{},dynamicConfig:{},experiment:{},layer:{},paramStore:{}},this._saveOverridesToStorage()}getLayerOverride(e,t){var n;const i=null!==(n=this._overrides.layer[e.name])&&void 0!==n?n:this._overrides.layer[(0,r._DJB2)(e.name)];return null==i?null:Object.assign(Object.assign({},e),{__value:i,get:(0,r._makeTypedGet)(e.name,i),details:Object.assign(Object.assign({},e.details),{reason:s})})}_getConfigOverride(e,t){var n;const i=null!==(n=t[e.name])&&void 0!==n?n:t[(0,r._DJB2)(e.name)];return null==i?null:Object.assign(Object.assign({},e),{value:i,get:(0,r._makeTypedGet)(e.name,i),details:Object.assign(Object.assign({},e.details),{reason:s})})}_hasInMemoryOverrides(){return Object.keys(this._overrides.gate).length>0||Object.keys(this._overrides.dynamicConfig).length>0||Object.keys(this._overrides.experiment).length>0||Object.keys(this._overrides.layer).length>0||Object.keys(this._overrides.paramStore).length>0}_inferParamType(e){return"string"==typeof e?"string":"boolean"==typeof e?"boolean":"number"==typeof e?"number":Array.isArray(e)?"array":"object"}}},4239:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(2169),t)},156:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AutoCapture=t.runStatsigAutoCapture=t.StatsigAutoCapturePlugin=void 0;const i=n(4485),r=n(4702),s=n(4067),o=n(4886),a=n(9341),l=n(4373),u=n(6959),c=n(2735),d=n(6596),g=n(6499),_={submit:r.AutoCaptureEventName.FORM_SUBMIT,click:r.AutoCaptureEventName.CLICK,copy:r.AutoCaptureEventName.COPY,cut:r.AutoCaptureEventName.COPY};function h(e,t){var n;if((0,i._isServerEnv)())return null;const{sdkKey:r}=e.getContext();if(!(0,i._isServerEnv)()){const e=null!==(n=(0,i._getStatsigGlobal)().acInstances)&&void 0!==n?n:{};if(e[r])return e[r]}return new v(e,t)}t.StatsigAutoCapturePlugin=class{constructor(e){this._options=e,this.__plugin="auto-capture"}bind(e){h(e,this._options)}},t.runStatsigAutoCapture=h;class v{constructor(e,t){var n,r,c,d;this._client=e,this._disabledEvents={},this._previousLoggedPageViewUrl=null,this._hasLoggedPageViewEnd=!1,this._pageViewLogged=!1;const{sdkKey:g,errorBoundary:_,values:h}=e.getContext();this._options=t,this._disabledEvents=null!==(r=null===(n=null==h?void 0:h.auto_capture_settings)||void 0===n?void 0:n.disabled_events)&&void 0!==r?r:{},this._errorBoundary=_,this._errorBoundary.wrap(this,"autoCapture:"),this._client.$on("values_updated",(()=>{var e,t;const n=this._client.getContext().values;this._disabledEvents=null!==(t=null===(e=null==n?void 0:n.auto_capture_settings)||void 0===e?void 0:e.disabled_events)&&void 0!==t?t:this._disabledEvents})),this._engagementManager=new a.EngagementManager,this._rageClickManager=new l.default,this._webVitalsManager=new u.WebVitalsManager(this._enqueueAutoCapture.bind(this),_),this._deadClickManager=new o.default(this._enqueueAutoCapture.bind(this),_),this._consoleLogManager=new s.ConsoleLogManager(this._enqueueAutoCapture.bind(this),_,null!==(c=null==t?void 0:t.consoleLogAutoCaptureSettings)&&void 0!==c?c:{enabled:!1}),this._eventFilterFunc=null==t?void 0:t.eventFilterFunc;const v=(0,i._getDocumentSafe)();if(!(0,i._isServerEnv)()){__STATSIG__=(0,i._getStatsigGlobal)();const e=null!==(d=__STATSIG__.acInstances)&&void 0!==d?d:{};e[g]=this,__STATSIG__.acInstances=e}"loading"!==(null==v?void 0:v.readyState)?this._initialize():v.addEventListener("DOMContentLoaded",(()=>this._initialize()))}_addEventHandlers(){const e=(0,i._getWindowSafe)(),t=(0,i._getDocumentSafe)();if(!e||!t)return;const n=(e,t=!0)=>{var n;const r=e||(null===(n=(0,i._getWindowSafe)())||void 0===n?void 0:n.event);this._autoLogEvent(r),t&&this._engagementManager.bumpInactiveTimer(),"click"===r.type&&r instanceof MouseEvent&&this._rageClickManager.isRageClick(r.clientX,r.clientY,Date.now())&&this._logRageClick(r)};(0,c._registerEventHandler)(t,"click",(e=>n(e))),(0,c._registerEventHandler)(t,"submit",(e=>n(e))),(0,c._registerEventHandler)(t,"copy",(e=>n(e))),(0,c._registerEventHandler)(t,"cut",(e=>n(e))),(0,c._registerEventHandler)(e,"error",(e=>n(e,!1))),(0,c._registerEventHandler)(e,"pagehide",(()=>this._tryLogPageViewEnd())),(0,c._registerEventHandler)(e,"beforeunload",(()=>this._tryLogPageViewEnd()))}_addPageViewTracking(){const e=(0,i._getWindowSafe)(),t=(0,i._getDocumentSafe)();if(e&&t){if((0,c._registerEventHandler)(e,"popstate",(()=>this._tryLogPageView("popstate"))),e.history&&"function"==typeof Proxy&&"function"==typeof e.history.pushState)try{const t=e.history.pushState;e.history.pushState=new Proxy(t,{apply:(e,t,[n,i,r])=>{const s=e.apply(t,[n,i,r]);return this._tryLogPageView("pushstate"),s}})}catch(e){}if(e.history&&"function"==typeof Proxy&&"function"==typeof e.history.replaceState)try{const t=e.history.replaceState;e.history.replaceState=new Proxy(t,{apply:(e,t,[n,i,r])=>{const s=e.apply(t,[n,i,r]);return this._tryLogPageView("replacestate"),s}})}catch(e){}this._tryLogPageView()}}_autoLogEvent(e){var t,n,s,o;const a=null===(t=e.type)||void 0===t?void 0:t.toLowerCase();if("error"===a&&e instanceof ErrorEvent)return void this._logError(e);const l=(0,c._getTargetNode)(e);if(!l)return;const u=_[a];if(!u)return;const h=u===r.AutoCaptureEventName.COPY;if(!(0,c._shouldLogEvent)(e,l,h))return;const v={};if(h){const t=null===(s=null===(n=(0,i._getWindowSafe)())||void 0===n?void 0:n.getSelection())||void 0===s?void 0:s.toString();if(!t)return;(null===(o=this._options)||void 0===o?void 0:o.captureCopyText)&&(v.selectedText=(0,c._sanitizeString)(t));const r=e.type||"clipboard";v.clipType=r}const{value:f,metadata:p}=(0,d._gatherEventData)(l);p.isOutbound&&this._engagementManager.setMeaningfulEngagementOccurred(!0),Object.assign(v,p);const m=(0,g._gatherAllMetadata)((0,c._getSafeUrl)());this._enqueueAutoCapture(u,f,Object.assign(Object.assign({},m),v))}_initialize(){this._webVitalsManager.startTracking(),this._deadClickManager.startTracking(),this._consoleLogManager.startTracking(),this._engagementManager.startInactivityTracking((()=>this._tryLogPageViewEnd(!0))),this._addEventHandlers(),this._addPageViewTracking(),this._logSessionStart(),this._logPerformance()}_logError(e){const t=(null==e?void 0:e.error)||{};let n=t;if("object"==typeof t)try{n=JSON.stringify(t)}catch(e){n="function"==typeof(null==t?void 0:t.toString)?t.toString():"Unknown Error"}this._enqueueAutoCapture(r.AutoCaptureEventName.ERROR,e.message,{message:e.message,filename:e.filename,lineno:e.lineno,colno:e.colno,error_str:n})}_logSessionStart(){const e=this._getSessionFromClient();try{if(!this._isNewSession(e))return;this._enqueueAutoCapture(r.AutoCaptureEventName.SESSION_START,(0,c._getSanitizedPageUrl)(),Object.assign({sessionID:e.data.sessionID},(0,g._gatherAllMetadata)((0,c._getSafeUrl)())),{flushImmediately:!0})}catch(e){this._errorBoundary.logError("AC::logSession",e)}}_tryLogPageView(e){const t=(0,c._getSafeUrl)(),n=this._previousLoggedPageViewUrl;if(n&&t.pathname===n.pathname)return;this._engagementManager.setLastPageViewTime(Date.now()),this._hasLoggedPageViewEnd=!1;const i=(0,g._gatherAllMetadata)(t);e&&(i.navigation_type=e),this._previousLoggedPageViewUrl&&(i.last_page_view_url=this._previousLoggedPageViewUrl.href),this._pageViewLogged||(this._updateClientWithPossibleFirstTouchMetadata(),this._pageViewLogged=!0),this._enqueueAutoCapture(r.AutoCaptureEventName.PAGE_VIEW,(0,c._getSanitizedPageUrl)(),i,{flushImmediately:!0,addNewSessionMetadata:!0}),this._previousLoggedPageViewUrl=t,this._engagementManager.bumpInactiveTimer()}_tryLogPageViewEnd(e=!1){this._hasLoggedPageViewEnd||(this._hasLoggedPageViewEnd=!0,this._enqueueAutoCapture(r.AutoCaptureEventName.PAGE_VIEW_END,(0,c._getSanitizedPageUrl)(),Object.assign(Object.assign({},this._engagementManager.getPageViewEndMetadata()),{dueToInactivity:e}),{flushImmediately:!0}))}_logRageClick(e){if(!(0,c._shouldLogEvent)(e,e.target))return;const{value:t,metadata:n}=(0,d._gatherEventData)(e.target);this._enqueueAutoCapture(r.AutoCaptureEventName.RAGE_CLICK,t,Object.assign(Object.assign({x:e.clientX,y:e.clientY,timestamp:Date.now()},(0,g._gatherAllMetadata)((0,c._getSafeUrl)())),n))}_logPerformance(){const e=(0,i._getWindowSafe)();e&&e.performance&&void 0!==(null==e?void 0:e.performance)&&"function"==typeof e.performance.getEntriesByType&&"function"==typeof e.performance.getEntriesByName&&setTimeout((()=>{const t={},n=e.performance.getEntriesByType("navigation");if(n&&n.length>0&&n[0]instanceof PerformanceNavigationTiming){const e=n[0];t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize}const i=e.performance.getEntriesByName("first-contentful-paint");i&&i.length>0&&i[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=i[0].startTime),this._enqueueAutoCapture(r.AutoCaptureEventName.PERFORMANCE,(0,c._getSanitizedPageUrl)(),Object.assign(Object.assign({},t),(0,g._getNetworkInfo)()))}),1)}_enqueueAutoCapture(e,t,n,r){var s,o,a;if(!t)return;const l=e.slice(14);if(this._disabledEvents[e]||this._disabledEvents[l])return;const u=this._getSessionFromClient();try{const l=Object.assign({sessionID:u.data.sessionID,page_url:null!==(a=null===(o=null===(s=(0,i._getWindowSafe)())||void 0===s?void 0:s.location)||void 0===o?void 0:o.href)&&void 0!==a?a:""},n);(null==r?void 0:r.addNewSessionMetadata)&&(l.isNewSession=String(this._isNewSession(u)));const c={eventName:e,value:t,metadata:l};if(this._eventFilterFunc&&!this._eventFilterFunc(c))return;this._client.logEvent(c),(null==r?void 0:r.flushImmediately)&&this._flushImmediately()}catch(e){this._errorBoundary.logError("AC::enqueue",e)}}_updateClientWithPossibleFirstTouchMetadata(){const e=this._client;e._possibleFirstTouchMetadata=(0,g._getPossibleFirstTouchMetadata)((0,c._getSafeUrl)()),Object.keys(e._possibleFirstTouchMetadata).length>0&&(e._user=Object.assign(Object.assign({},e._user),{analyticsOnlyMetadata:Object.assign(Object.assign({},e._possibleFirstTouchMetadata),e._user.analyticsOnlyMetadata)}))}_flushImmediately(){this._client.flush().catch((e=>{i.Log.error(e)}))}_isNewSession(e){return Math.abs(e.data.startTime-Date.now())<1e3}_getSessionFromClient(){return this._client.getContext().session}static getAllMetadata(){return(0,g._gatherAllMetadata)((0,c._getSafeUrl)())}}t.AutoCapture=v},4702:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AutoCaptureEventName=void 0,t.AutoCaptureEventName={PAGE_VIEW:"auto_capture::page_view",PAGE_VIEW_END:"auto_capture::page_view_end",ERROR:"auto_capture::error",SESSION_START:"auto_capture::session_start",PERFORMANCE:"auto_capture::performance",FORM_SUBMIT:"auto_capture::form_submit",CLICK:"auto_capture::click",RAGE_CLICK:"auto_capture::rage_click",WEB_VITALS:"auto_capture::web_vitals",DEAD_CLICK:"auto_capture::dead_click",COPY:"auto_capture::copy",CONSOLE_LOG:"statsig::log_line"}},4067:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConsoleLogManager=void 0;const i=n(4485),r=n(4702),s=n(2735),o=n(7658),a=n(6499),l={trace:10,debug:20,log:30,info:30,warn:40,error:50};t.ConsoleLogManager=class{constructor(e,t,n){var i,r,s,o;this._enqueueFn=e,this._errorBoundary=t,this._options=n,this._restoreFns=[],this._isTracking=!1,this._logLevel="info",this.__source="js-auto-capture",this._logLevel=null!==(i=this._options.logLevel)&&void 0!==i?i:"info",this._maxKeys=null!==(r=this._options.maxKeys)&&void 0!==r?r:50,this._maxDepth=null!==(s=this._options.maxDepth)&&void 0!==s?s:10,this._maxStringLength=null!==(o=this._options.maxStringLength)&&void 0!==o?o:2500}startTracking(){try{if(this._isTracking||!this._options.enabled)return;if(!(0,i._getWindowSafe)())return;this._patchConsole(),this._isTracking=!0}catch(e){i.Log.error("Error starting console log tracking",e),this._errorBoundary.logError("autoCapture:ConsoleLogManager",e)}}stopTracking(){this._isTracking&&(this._restoreFns.forEach((e=>e())),this._restoreFns=[],this._isTracking=!1)}_patchConsole(){Object.entries(l).forEach((([e,t])=>{if(t<l[this._logLevel])return;if(!console[e])return;const n=console[e].bind(console);let i=!1;const r=(0,s.wrapFunctionWithRestore)(console,e,(t=>(...r)=>{if(t(...r),!i){i=!0;try{const t=r.map((e=>(0,o._safeStringify)(e,this._maxKeys,this._maxDepth,this._maxStringLength))),n=(0,o._getStackTrace)();this._enqueueConsoleLog(e,t,n)}catch(e){n("console observer error:",e,...r),this._errorBoundary.logError("autoCapture:ConsoleLogManager",e)}finally{i=!1}}}));this._restoreFns.push(r)}))}_enqueueConsoleLog(e,t,n){if(!this._shouldLog(t))return;const i=Object.assign({status:"log"===e?"info":e,log_level:e,payload:t,trace:n,timestamp:Date.now(),source:this.__source},(0,a._gatherAllMetadata)((0,s._getSafeUrl)()));this._enqueueFn(r.AutoCaptureEventName.CONSOLE_LOG,t.join(" "),i)}_shouldLog(e){for(const t of e)if(t.includes("[Statsig]"))return!1;return!this._options.sampleRate||"number"!=typeof this._options.sampleRate||this._options.sampleRate<=0||this._options.sampleRate>=1||Math.random()<this._options.sampleRate}}},4886:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DeadClickConfig=void 0;const i=n(4485),r=n(4702),s=n(2735),o=n(6596),a=n(6499);t.DeadClickConfig={CLICK_CHECK_TIMEOUT:1e3,SCROLL_DELAY_MS:100,SELECTION_CHANGE_DELAY_MS:100,MUTATION_DELAY_MS:2500,ABSOLUTE_DEAD_CLICK_TIMEOUT:2750},t.default=class{constructor(e,n){this._enqueueFn=e,this._errorBoundary=n,this._lastMutationTime=0,this._lastSelectionChangeTime=0,this._clicks=[],this._deadClickConfig=t.DeadClickConfig,this._handleScroll=(0,s.throttle)((()=>{const e=Date.now();this._clicks.forEach((t=>{t.scrollDelayMs||(t.scrollDelayMs=e-t.timestamp)}))}),50)}startTracking(){try{const e=(0,i._getWindowSafe)();if(!e)return;e.addEventListener("click",(e=>this._handleClick(e)),{capture:!0}),e.addEventListener("scroll",(()=>this._handleScroll()),{capture:!0,passive:!0}),e.addEventListener("selectionchange",(()=>this._handleSelectionChange())),this._setupMutationObserver()}catch(e){i.Log.error("Error starting dead click tracking",e),this._errorBoundary.logError("autoCapture:DeadClickManager",e)}}_handleClick(e){var t,n;const r=e.target;if(!r)return;const o={timestamp:Date.now(),eventTarget:r};s.interactiveElements.includes(null===(t=null==r?void 0:r.tagName)||void 0===t?void 0:t.toLowerCase())||this._clicks.push(o),this._clicks.length&&!this._clickCheckTimer&&(this._clickCheckTimer=null===(n=(0,i._getWindowSafe)())||void 0===n?void 0:n.setTimeout((()=>{this._checkForDeadClick()}),this._deadClickConfig.CLICK_CHECK_TIMEOUT))}_handleSelectionChange(){this._lastSelectionChangeTime=Date.now()}_setupMutationObserver(){const e=(0,i._getDocumentSafe)();e&&(this._observer=new MutationObserver((()=>{this._lastMutationTime=Date.now()})),this._observer.observe(e.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0}))}_checkForDeadClick(){var e;if(!this._clicks.length)return;clearTimeout(this._clickCheckTimer),this._clickCheckTimer=void 0;const t=this._clicks;this._clicks=[];for(const e of t){this._updateClickDelayMs(e);const t=null!=e.scrollDelayMs&&e.scrollDelayMs<this._deadClickConfig.SCROLL_DELAY_MS,n=null!=e.selectionChangeDelayMs&&e.selectionChangeDelayMs<this._deadClickConfig.SELECTION_CHANGE_DELAY_MS,i=null!=e.mutationDelayMs&&e.mutationDelayMs<this._deadClickConfig.MUTATION_DELAY_MS;if(t||n||i)continue;const r=null!=e.scrollDelayMs&&e.scrollDelayMs>this._deadClickConfig.SCROLL_DELAY_MS,s=null!=e.selectionChangeDelayMs&&e.selectionChangeDelayMs>this._deadClickConfig.SELECTION_CHANGE_DELAY_MS,o=null!=e.mutationDelayMs&&e.mutationDelayMs>this._deadClickConfig.MUTATION_DELAY_MS,a=null!=e.absoluteDelayMs&&e.absoluteDelayMs>this._deadClickConfig.ABSOLUTE_DEAD_CLICK_TIMEOUT;r||s||o||a?this._logDeadClick(e,{scrollTimeout:r,selectionChangeTimeout:s,mutationTimeout:o,absoluteTimeout:a}):null!=e.absoluteDelayMs&&e.absoluteDelayMs<this._deadClickConfig.ABSOLUTE_DEAD_CLICK_TIMEOUT&&this._clicks.push(e)}this._clicks.length&&!this._clickCheckTimer&&(this._clickCheckTimer=null===(e=(0,i._getWindowSafe)())||void 0===e?void 0:e.setTimeout((()=>{this._checkForDeadClick()}),this._deadClickConfig.CLICK_CHECK_TIMEOUT))}_logDeadClick(e,t){const{value:n,metadata:i}=(0,o._gatherEventData)(e.eventTarget);n&&this._enqueueFn(r.AutoCaptureEventName.DEAD_CLICK,n,Object.assign(Object.assign(Object.assign(Object.assign({},i),t),(0,a._gatherCommonMetadata)((0,s._getSafeUrl)())),{scrollDelayMs:e.scrollDelayMs,selectionChangeDelayMs:e.selectionChangeDelayMs,mutationDelayMs:e.mutationDelayMs,absoluteDelayMs:e.absoluteDelayMs}))}_updateClickDelayMs(e){!e.mutationDelayMs&&this._lastMutationTime>0&&e.timestamp<=this._lastMutationTime&&(e.mutationDelayMs=Date.now()-this._lastMutationTime),!e.selectionChangeDelayMs&&this._lastSelectionChangeTime>0&&e.timestamp<=this._lastSelectionChangeTime&&(e.selectionChangeDelayMs=Date.now()-this._lastSelectionChangeTime),e.absoluteDelayMs=Date.now()-e.timestamp}}},9341:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EngagementManager=void 0;const i=n(4485);t.EngagementManager=class{constructor(){this._lastScrollY=0,this._maxScrollY=0,this._lastScrollPercentage=0,this._maxScrollPercentage=0,this._lastPageViewTime=Date.now(),this._inactiveTimer=null,this._onInactivityCallback=null,this._meaningfulEngagementOccurred=!1,this._initializeScrollTracking()}_initializeScrollTracking(){const e=(0,i._getWindowSafe)();e&&(e.addEventListener("scroll",(()=>this._handleScroll())),e.addEventListener("scrollend",(()=>this._handleScroll())),e.addEventListener("resize",(()=>this._handleScroll())))}_handleScroll(){const e=(0,i._getWindowSafe)(),t=(0,i._getDocumentSafe)();if(!e||!t)return;const n=t.body.scrollHeight,r=e.scrollY||t.documentElement.scrollTop||0,s=e.innerHeight;this._lastScrollY=r,this._maxScrollY=Math.max(this._maxScrollY,r);const o=Math.min(100,Math.round((r+s)/n*100));this._lastScrollPercentage=o,this._maxScrollPercentage=Math.max(this._maxScrollPercentage,o),this.bumpInactiveTimer()}getScrollMetrics(){return{lastScrollY:this._lastScrollY,maxScrollY:this._maxScrollY,lastScrollPercentage:this._lastScrollPercentage,maxScrollPercentage:this._maxScrollPercentage,scrollDepth:this._maxScrollPercentage}}getPageViewLength(){return Date.now()-this._lastPageViewTime}setLastPageViewTime(e){this._lastPageViewTime=e}startInactivityTracking(e){this._onInactivityCallback=e}bumpInactiveTimer(){const e=(0,i._getWindowSafe)();e&&(this._inactiveTimer&&clearTimeout(this._inactiveTimer),this._inactiveTimer=e.setTimeout((()=>{this._onInactivityCallback&&this._onInactivityCallback()}),6e5))}setMeaningfulEngagementOccurred(e){this._meaningfulEngagementOccurred=e}getPageViewEndMetadata(){const e=Object.assign(Object.assign({},this.getScrollMetrics()),{pageViewLength:this.getPageViewLength(),meaningfulEngagementOccurred:this._meaningfulEngagementOccurred});return this.setMeaningfulEngagementOccurred(!1),e}}},4373:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this._clicks=[]}isRageClick(e,t,n){return this._clicks=this._clicks.filter((e=>n-e.timestamp<1e3)),this._clicks.length>0&&!(n=>{const i=e-n.x,r=t-n.y;return Math.abs(i)+Math.abs(r)<=30})(this._clicks[this._clicks.length-1])&&(this._clicks=[]),this._clicks.push({x:e,y:t,timestamp:n}),this._clicks.length>=3}}},6959:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WebVitalsManager=void 0;const i=n(5070),r=n(4485),s=n(4702),o=n(2735),a=["CLS","FCP","INP","LCP","TTFB"];t.WebVitalsManager=class{constructor(e,t){this._enqueueFn=e,this._errorBoundary=t,this._isInitialized=!1,this._metricEvent={url:(0,o._getSafeUrlString)(),sanitizedUrl:(0,o._getSanitizedPageUrl)(),metrics:[],firstMetricTimestamp:void 0}}startTracking(){var e,t;try{if(this._isInitialized)return;const n=null===(t=null===(e=(0,r._getWindowSafe)())||void 0===e?void 0:e.location)||void 0===t?void 0:t.protocol;if("https:"!==n&&"http:"!==n)return;(0,i.onCLS)((e=>this._handleMetric(e))),(0,i.onFCP)((e=>this._handleMetric(e))),(0,i.onINP)((e=>this._handleMetric(e))),(0,i.onLCP)((e=>this._handleMetric(e))),(0,i.onTTFB)((e=>this._handleMetric(e))),this._isInitialized=!0}catch(e){r.Log.error("Error starting web vitals tracking",e),this._errorBoundary.logError("autoCapture:WebVitalsManager",e)}}_handleMetric(e){if(void 0===this._metricEvent.firstMetricTimestamp&&(this._metricEvent.firstMetricTimestamp=Date.now()),void 0===e||void 0===(null==e?void 0:e.name))return;const t=(0,o._getSafeUrlString)();if(""===t)return;if(!a.includes(e.name))return;t!==this._metricEvent.url&&(this._enqueueWebVitalsAutoCaptureEvent(),this._metricEvent.url=t);const n=e;this._metricEvent.metrics.push({name:n.name,value:n.value,delta:n.delta,id:n.id}),this._metricEvent.metrics.length===a.length&&this._enqueueWebVitalsAutoCaptureEvent()}_enqueueWebVitalsAutoCaptureEvent(){if(""===this._metricEvent.url||0===this._metricEvent.metrics.length)return;const e={};this._metricEvent.metrics.forEach((t=>{const n=t.name.toLowerCase();e[`${n}_value`]=t.value,e[`${n}_delta`]=t.delta,e[`${n}_id`]=t.id})),this._enqueueFn(s.AutoCaptureEventName.WEB_VITALS,this._metricEvent.sanitizedUrl,Object.assign(Object.assign({},e),{first_metric_timestamp:this._metricEvent.firstMetricTimestamp})),this._metricEvent={url:(0,o._getSafeUrlString)(),sanitizedUrl:(0,o._getSanitizedPageUrl)(),metrics:[],firstMetricTimestamp:void 0}}}},4091:(e,t,n)=>{t.gX=void 0;const i=n(4485),r=n(156);Object.defineProperty(t,"gX",{enumerable:!0,get:function(){return r.runStatsigAutoCapture}});n(4702);Object.assign((0,i._getStatsigGlobal)(),{AutoCapture:r.AutoCapture,runStatsigAutoCapture:r.runStatsigAutoCapture,StatsigAutoCapturePlugin:r.StatsigAutoCapturePlugin})},2735:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.wrapFunctionWithRestore=t.throttle=t._sanitizeString=t._getAnchorNodeInHierarchy=t._getSafeTimezoneOffset=t._getSafeTimezone=t._getSafeNetworkInformation=t._registerEventHandler=t._getSanitizedPageUrl=t._getSafeUrlString=t._getSafeUrl=t._shouldLogEvent=t._getTargetNode=t._stripEmptyValues=t.interactiveElements=void 0;const i=n(4485),r=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),s=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$");function o(){var e,t,n;const r=null!==(n=null===(t=null===(e=(0,i._getWindowSafe)())||void 0===e?void 0:e.location)||void 0===t?void 0:t.href)&&void 0!==n?n:"";let s;try{s=new URL(r)}catch(e){s=new URL("error:")}return s}function a(e){if(!e)return null;let t=e;for(;t;){const e=t.tagName.toLowerCase();if(["body","document"].includes(e))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}return null}t.interactiveElements=["button","a","input","select","textarea","form","select","label"],t._stripEmptyValues=function(e){return Object.fromEntries(Object.entries(e).filter((([e,t])=>null!=t&&""!==t&&void 0!==t)))},t._getTargetNode=function(e){if(!e)return null;let t=e.target||e.srcElement;return t&&t instanceof Element?(3===t.nodeType&&(t=t.parentNode||null),t):null},t._shouldLogEvent=function(e,n,i=!1){if(!e||!n||1!==n.nodeType)return!1;const r=n.tagName.toLowerCase(),s=e.type.toLowerCase();if(n.classList.contains("statsig-no-capture"))return!1;if(i)return!0;switch(r){case"html":return!1;case"form":return["submit"].indexOf(s)>=0;case"input":case"select":case"textarea":return["change","click"].indexOf(s)>=0;default:if("click"===s){const e=window.getComputedStyle(n);if(e&&"pointer"===e.getPropertyValue("cursor"))return!0;if(t.interactiveElements.includes(r))return!0;if("true"===n.getAttribute("contenteditable"))return!0;if(a(n))return!0}return!1}},t._getSafeUrl=o,t._getSafeUrlString=function(){const e=o().toString();return e.startsWith("error:")?"":e},t._getSanitizedPageUrl=function(){return(0,i._getCurrentPageUrlSafe)()||""},t._registerEventHandler=function(e,t,n){e&&e.addEventListener&&e.addEventListener(t,n,!0)},t._getSafeNetworkInformation=function(){const e=(0,i._getWindowSafe)();if(!e||!e.navigator)return null;return e.navigator.connection||null},t._getSafeTimezone=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return null}},t._getSafeTimezoneOffset=function(){try{return(new Date).getTimezoneOffset()}catch(e){return null}},t._getAnchorNodeInHierarchy=a,t._sanitizeString=function(e){return e?e.replace(/<[^>]*>/g,"").trim().split(/(\s+)/).filter((e=>{return t=e,!r.test((t||"").replace(/[- ]/g,""))&&!s.test((t||"").replace(/[- ]/g,""));var t})).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255):null},t.throttle=function(e,t){let n=0;return function(...i){const r=Date.now();r-n>=t&&(n=r,e(...i))}},t.wrapFunctionWithRestore=function(e,t,n){const i=e[t];if("function"!=typeof i)return()=>{};try{const r=n(i);return Object.defineProperty(r,"__statsig_original__",{enumerable:!1,value:i}),e[t]=r,()=>{e[t]=i}}catch(e){return()=>{}}}},7658:(e,t)=>{function n(e,t){return e.length<=t?e:e.slice(0,t)+"..."}function i(e,t){return t<=0||"object"==typeof e&&null!==e&&Object.keys(e).some((n=>i(e[n],t-1)))}Object.defineProperty(t,"__esModule",{value:!0}),t._getStackTrace=t._safeStringify=void 0,t._safeStringify=function(e,t,r,s){try{return function(e,t,n){if(r=e,"[object Object]"===Object.prototype.toString.call(r)){if(Object.keys(e).length>t)return!0;if(i(e,n))return!0}var r;return"function"==typeof e}(e,t,r)?function(e,t){return n(e.toString(),t)}(e,s):n("string"==typeof e?e:"object"==typeof e&&null!==e?JSON.stringify(e):String(e),s)}catch(e){return n("[Unserializable]",s)}},t._getStackTrace=function(){var e,t;try{return null!==(t=null===(e=(new Error).stack)||void 0===e?void 0:e.split("\n").slice(2))&&void 0!==t?t:[]}catch(e){return[]}}},6596:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getMetadataFromElement=t._gatherCopyEventData=t._gatherEventData=void 0;const i=n(4485),r=n(2735),s=1e3;function o(e,t){return e?e.length>t?e.substring(0,t)+"...":e:null}function a(e){const t={};return t.class=(o(e.getAttribute("class"),s)||"").replace(/\s+/g," ").trim(),t.id=o(e.getAttribute("id"),s),t.ariaLabel=o(e.getAttribute("aria-label"),s),t.name=o(e.getAttribute("name"),s),t}function l(e){const t={},n=a(e);Object.assign(t,n);const i=Array.from(e.classList);return t.classList=i.length>0?i.slice(0,100):null,t.selector=function(e){if(!e)return"";if(!e.parentNode){const t=e.tagName.toLowerCase();if(e.id)return`#${e.id}`;let n=t;if(e.className&&"string"==typeof e.className){const t=e.className.trim().split(/\s+/);t.length>0&&""!==t[0]&&(n+="."+t.join("."))}return n}const t=[];let n=e,i=0;for(;n&&n.nodeType===Node.ELEMENT_NODE&&i<50;){const e=u(n);if(t.unshift(e),n.id)break;if(n=n.parentElement,n&&"body"===n.tagName.toLowerCase())break;i++}return t.join(" > ")}(e),t}function u(e){const t=e.tagName.toLowerCase();if(e.id)return`#${e.id}`;let n=t;if(e.className&&"string"==typeof e.className){const t=e.className.trim().split(/\s+/);t.length>0&&""!==t[0]&&(n+="."+t.join("."))}const i=e.parentElement;if(i&&i.children.length>1){let t=1,i=1,r=e.previousElementSibling;for(;r;)t++,r.tagName===e.tagName&&i++,r=r.previousElementSibling;n+=`:nth-child(${t})`,(i>1||function(e){let t=e.nextElementSibling;for(;t;){if(t.tagName===e.tagName)return!0;t=t.nextElementSibling}return!1}(e))&&(n+=`:nth-of-type(${i})`)}return n}t._gatherEventData=function(e){const t=(0,r._getSanitizedPageUrl)()||"",n=e.tagName.toLowerCase();if(function(e){return"input"===e.tagName.toLowerCase()&&["button","checkbox","submit","reset"].includes(e.getAttribute("type")||"")||"textarea"===e.tagName.toLowerCase()||"select"===e.tagName.toLowerCase()||"true"===e.getAttribute("contenteditable")}(e))return{value:t,metadata:a(e)};const i={};i.tagName=n;const s=l(e);Object.assign(i,s),"form"===n&&Object.assign(i,function(e){var t;const n={};return n.action=e.getAttribute("action"),n.method=null!==(t=e.getAttribute("method"))&&void 0!==t?t:"GET",n.formName=e.getAttribute("name"),n.formId=e.getAttribute("id"),n}(e)),"input"===n&&Object.assign(i,function(e){const t={};return t.content=e.value,t.inputName=e.getAttribute("name"),t}(e));const o=(0,r._getAnchorNodeInHierarchy)(e);return o&&Object.assign(i,function(e){const t={};return t.href=e.getAttribute("href"),t}(o)),("button"===n||o)&&Object.assign(i,function(e){const t={};t.content=(e.textContent||"").trim();const n=function(e){const t={};if(!e)return t;const n=null==e?void 0:e.dataset;if(!n)return t;for(const e in n)t[`data-${e}`]=n[e]||"";return t}(e);return Object.assign(t,n),t}(o||e)),function(e){var t;if(Array.isArray(e.classList)&&(null===(t=e.classList)||void 0===t?void 0:t.includes("statsig-ctr-capture")))return!0;const n=e.href;if(n)try{const e=(0,r._getSafeUrl)(),t=new URL(n);return e.host!==t.host}catch(e){return!1}return!1}(i)&&(i.isOutbound="true"),{value:t,metadata:i}},t._gatherCopyEventData=function(e){var t,n;const s=null===(n=null===(t=(0,i._getWindowSafe)())||void 0===t?void 0:t.getSelection())||void 0===n?void 0:n.toString(),o={};o.selectedText=(0,r._sanitizeString)(s);const a=e.type||"clipboard";return o.clipType=a,o},t._getMetadataFromElement=l},6499:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getPossibleFirstTouchMetadata=t._getNetworkInfo=t._gatherAllMetadata=t._gatherCommonMetadata=void 0;const i=n(4485),r=n(2735);function s(e){var t,n,s,a,l,u,c,d;const g=(0,i._getDocumentSafe)(),_=(0,i._getWindowSafe)();return(0,r._stripEmptyValues)(Object.assign({title:null==g?void 0:g.title,current_url:null===(t=null==_?void 0:_.location)||void 0===t?void 0:t.href,user_agent:(null===(n=null==_?void 0:_.navigator)||void 0===n?void 0:n.userAgent)&&(null===(a=null===(s=null==_?void 0:_.navigator)||void 0===s?void 0:s.userAgent)||void 0===a?void 0:a.length)>200?_.navigator.userAgent.substring(0,200):null===(l=null==_?void 0:_.navigator)||void 0===l?void 0:l.userAgent,locale:null===(u=null==_?void 0:_.navigator)||void 0===u?void 0:u.language,hostname:e.hostname,pathname:e.pathname,screen_width:null===(c=null==_?void 0:_.screen)||void 0===c?void 0:c.width,screen_height:null===(d=null==_?void 0:_.screen)||void 0===d?void 0:d.height,viewport_width:null==_?void 0:_.innerWidth,viewport_height:null==_?void 0:_.innerHeight,viewport:`${null==_?void 0:_.innerWidth}x${null==_?void 0:_.innerHeight}`,timestamp:Date.now(),timezone:(0,r._getSafeTimezone)(),timezone_offset:(0,r._getSafeTimezoneOffset)()},o()))}function o(){const e=(0,r._getSafeNetworkInformation)(),t={};return void 0!==(null==e?void 0:e.effectiveType)&&(t.effective_connection_type=e.effectiveType),void 0!==(null==e?void 0:e.rtt)&&(t.rtt_ms=e.rtt),void 0!==(null==e?void 0:e.downlink)&&(t.downlink_mbps=e.downlink,t.downlink_kbps=1e3*e.downlink),void 0!==(null==e?void 0:e.saveData)&&(t.save_data=e.saveData),t}function a(e){const t=(null==e?void 0:e.referrer)||"";if(!t)return{referrer:null,referrer_domain:null,referrer_path:null,searchEngine:"",searchQuery:""};try{const e=new URL(t),n=e.hostname,i=["google","bing","yahoo","duckduckgo","baidu"].find((e=>n.includes(e+".")))||"",r=e.searchParams.get("yahoo"===i?"p":"q")||"";return{referrer:t,referrer_domain:e.hostname,referrer_path:e.pathname,searchEngine:i,searchQuery:r}}catch(e){return{referrer:null,referrer_domain:null,referrer_path:null,searchEngine:"",searchQuery:""}}}function l(e){const t=e.searchParams,n={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content","msclkid","dclid","fbclid","gad_source","gclid","gclsrc","wbraid","utm_id","irclid","igshid","_kx","li_fat_id","mc_cid","mc_eid","epik","qclid","rdt_cid","sccid","ttc","ttclid","ttc_id","twclid"].forEach((e=>{const i=t.get(e);i&&(n[e]=i)})),n}t._gatherCommonMetadata=s,t._gatherAllMetadata=function(e){const t=(0,i._getDocumentSafe)(),n=(0,i._getWindowSafe)();if(!t||!n)return{};const o=a(t),u=s(e),c=l(e),d={};return e.searchParams.forEach(((e,t)=>{d[t]=e})),Object.assign(Object.assign({},u),(0,r._stripEmptyValues)(Object.assign(Object.assign(Object.assign({},o),c),d)))},t._getNetworkInfo=o,t._getPossibleFirstTouchMetadata=function(e){const t=(0,i._getDocumentSafe)(),n=(0,i._getWindowSafe)();if(!t||!n)return{};const s=a(t),o=l(e),u=(0,r._stripEmptyValues)(Object.assign(Object.assign({},s),o)),c={};for(const[e,t]of Object.entries(u))c[`$s_${e}`]=t;return c}},5070:(e,t,n)=>{n.r(t),n.d(t,{CLSThresholds:()=>k,FCPThresholds:()=>E,INPThresholds:()=>A,LCPThresholds:()=>R,TTFBThresholds:()=>K,onCLS:()=>w,onFCP:()=>C,onINP:()=>U,onLCP:()=>F,onTTFB:()=>z});let i=-1;const r=e=>{addEventListener("pageshow",(t=>{t.persisted&&(i=t.timeStamp,e(t))}),!0)},s=(e,t,n,i)=>{let r,s;return o=>{t.value>=0&&(o||i)&&(s=t.value-(r??0),(s||void 0===r)&&(r=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},o=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},a=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},l=()=>{const e=a();return e?.activationStart??0},u=(e,t=-1)=>{const n=a();let r="navigate";return i>=0?r="back-forward-cache":n&&(document.prerendering||l()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},c=new WeakMap;function d(e,t){return c.get(e)||c.set(e,new t),c.get(e)}class g{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const _=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const i=new PerformanceObserver((e=>{Promise.resolve().then((()=>{t(e.getEntries())}))}));return i.observe({type:e,buffered:!0,...n}),i}}catch{}},h=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let v=-1;const f=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,p=e=>{"hidden"===document.visibilityState&&v>-1&&(v="visibilitychange"===e.type?e.timeStamp:0,y())},m=()=>{addEventListener("visibilitychange",p,!0),addEventListener("prerenderingchange",p,!0)},y=()=>{removeEventListener("visibilitychange",p,!0),removeEventListener("prerenderingchange",p,!0)},b=()=>{if(v<0){const e=l(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>"hidden"===t.name&&t.startTime>e))[0]?.startTime;v=t??f(),m(),r((()=>{setTimeout((()=>{v=f(),m()}))}))}return{get firstHiddenTime(){return v}}},S=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},E=[1800,3e3],C=(e,t={})=>{S((()=>{const n=b();let i,a=u("FCP");const c=_("paint",(e=>{for(const t of e)"first-contentful-paint"===t.name&&(c.disconnect(),t.startTime<n.firstHiddenTime&&(a.value=Math.max(t.startTime-l(),0),a.entries.push(t),i(!0)))}));c&&(i=s(e,a,E,t.reportAllChanges),r((n=>{a=u("FCP"),i=s(e,a,E,t.reportAllChanges),o((()=>{a.value=performance.now()-n.timeStamp,i(!0)}))})))}))},k=[.1,.25],w=(e,t={})=>{C(h((()=>{let n,i=u("CLS",0);const a=d(t,g),l=e=>{for(const t of e)a.h(t);a.i>i.value&&(i.value=a.i,i.entries=a.o,n())},c=_("layout-shift",l);c&&(n=s(e,i,k,t.reportAllChanges),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(l(c.takeRecords()),n(!0))})),r((()=>{a.i=0,i=u("CLS",0),n=s(e,i,k,t.reportAllChanges),o((()=>n()))})),setTimeout(n))})))};let O=0,D=1/0,I=0;const L=e=>{for(const t of e)t.interactionId&&(D=Math.min(D,t.interactionId),I=Math.max(I,t.interactionId),O=I?(I-D)/7+1:0)};let T;const M=()=>T?O:performance.interactionCount??0;let P=0;class j{u=[];l=new Map;m;v;p(){P=M(),this.u.length=0,this.l.clear()}P(){const e=Math.min(this.u.length-1,Math.floor((M()-P)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.T){if(n?e.duration>n.T?(n.entries=[e],n.T=e.duration):e.duration===n.T&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],T:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((e,t)=>t.T-e.T)),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.v?.(n)}}}const x=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=h(e),document.addEventListener("visibilitychange",e,{once:!0}),t((()=>{e(),document.removeEventListener("visibilitychange",e)})))},A=[200,500],U=(e,t={})=>{globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype&&S((()=>{"interactionCount"in performance||T||(T=_("event",L,{type:"event",buffered:!0,durationThreshold:0}));let n,i=u("INP");const o=d(t,j),a=e=>{x((()=>{for(const t of e)o.h(t);const t=o.P();t&&t.T!==i.value&&(i.value=t.T,i.entries=t.entries,n())}))},l=_("event",a,{durationThreshold:t.durationThreshold??40});n=s(e,i,A,t.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(a(l.takeRecords()),n(!0))})),r((()=>{o.p(),i=u("INP"),n=s(e,i,A,t.reportAllChanges)})))}))};class N{m;h(e){this.m?.(e)}}const R=[2500,4e3],F=(e,t={})=>{S((()=>{const n=b();let i,a=u("LCP");const c=d(t,N),g=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)c.h(t),t.startTime<n.firstHiddenTime&&(a.value=Math.max(t.startTime-l(),0),a.entries=[t],i())},v=_("largest-contentful-paint",g);if(v){i=s(e,a,R,t.reportAllChanges);const n=h((()=>{g(v.takeRecords()),v.disconnect(),i(!0)}));for(const e of["keydown","click","visibilitychange"])addEventListener(e,(()=>x(n)),{capture:!0,once:!0});r((n=>{a=u("LCP"),i=s(e,a,R,t.reportAllChanges),o((()=>{a.value=performance.now()-n.timeStamp,i(!0)}))}))}}))},K=[800,1800],B=e=>{document.prerendering?S((()=>B(e))):"complete"!==document.readyState?addEventListener("load",(()=>B(e)),!0):setTimeout(e)},z=(e,t={})=>{let n=u("TTFB"),i=s(e,n,K,t.reportAllChanges);B((()=>{const o=a();o&&(n.value=Math.max(o.responseStart-l(),0),n.entries=[o],i(!0),r((()=>{n=u("TTFB",0),i=s(e,n,K,t.reportAllChanges),i(!0)})))}))}}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i].call(s.exports,s,s.exports,n),s.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{default:()=>o});var e=n(2869),t=n(4239),r=n(4091);const s=window.StatsigSidecar||{_statsigInstance:null,_queuedEvents:[],_clientInitialized:!1,_redirKey:"_stsgnoredir",activateExperiment:function(e){this._getMatchingExperiments().includes(e)&&s._performExperiments([e])},findElementToObserve:function(e){for(;e;){try{const t=document.querySelector(e);if(t)return t}catch(e){}e=e.substring(0,e.lastIndexOf(">"))}return document.body},_flushQueuedEvents:function(){if(0===this._queuedEvents.length)return;if(!this._statsigInstance)return;const e=[...this._queuedEvents];this._queuedEvents=[],e.forEach((e=>{this._statsigInstance.logEvent(e.eventName,e.value,e.metadata)})),this._statsigInstance.flush&&this._statsigInstance.flush()},_getMatchingExperiments:function(){const e=[],t=this._statsigInstance.getConfigList();let n=window.location.href;try{const e=new URL(n);e.searchParams.has("overrideuser")&&e.searchParams.delete("overrideuser"),n=e.toString()}catch(e){}return t.forEach((t=>{const i=this._statsigInstance.getExperiment(t);i.value["!statsig_sidecar_directives"]&&this._isMatchingExperiment(n,i.value.sidecarURLFilters)&&e.push(i.name)})),e},getStatsigInstance:function(){return this._statsigInstance},_isMatchingExperiment:function(e,t){if(!t||0===t.length)return!0;for(const n of t)if("contains"===n.type){if(e.includes(n.value))return!0}else if("equals"===n.type){if(e===n.value)return!0}else if("regex"===n.type){if(RegExp(n.value).test(e))return!0}else if("path"===n.type&&new URL(e).pathname===n.value)return!0;return!1},_isIOS:function(){return/iPad|iPhone|iPod/.test(navigator?.userAgent??"")},logEvent:function(e,t,n){this._statsigInstance&&this._clientInitialized?(this._flushQueuedEvents(),this._statsigInstance.logEvent(e,t,n)):this._queuedEvents.push({eventName:e,value:t,metadata:n})},_observeMutation:function(e,t){new MutationObserver(((e,n)=>{setTimeout((()=>{t()}),0)})).observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0,characterDataOldValue:!1}),t()},_observePageChanges:function(e){const t=history.pushState,n=history.replaceState,i=()=>{s.runAllExperiments(e)};history.pushState=function(...e){t.apply(history,e),i()},history.replaceState=function(...e){n.apply(history,e),i()},window.addEventListener("hashchange",i),window.addEventListener("popstate",i)},_performAfterLoad:function(e){/complete|interactive|loaded/.test(document.readyState)?e():document.addEventListener("DOMContentLoaded",(()=>{e()}))},performAttributeChange:function(e,t,n,i=[]){e&&this.setupMutationObserver(e,(()=>{const r=document.querySelector(e);r&&r.getAttribute(t)!==n&&(r.setAttribute(t,n),i?.forEach((e=>{r.removeAttribute(e)})))}))},performContentChange:function(e,t){e&&this.setupMutationObserver(e,(()=>{const n=document.querySelector(e);n&&n.innerHTML!==t&&(n.innerHTML=t)}))},_performDirective:function(e){switch(console.log(e),e.type){case"content":this._performAfterLoad((()=>{this.performContentChange(e.selector,e.value)}));break;case"style":this._performAfterLoad((()=>{this.performStyleChange(e.selector,e.key,e.value)}));break;case"properties":this._performAfterLoad((()=>{e.metadata?.forEach((e=>{"style"===e.type?this.performStyleChange(e.selector,e.name,e.value):"attribute"===e.type&&this.performAttributeChange(e.selector,e.name,e.value)}))}));break;case"attribute":this._performAfterLoad((()=>{this.performAttributeChange(e.selector,e.key,e.value)}));break;case"image":this._performAfterLoad((()=>{this.performAttributeChange(e.selector,"src",e.value,["srcset"])}));break;case"reorder":this._performAfterLoad((()=>{this.performReorderElement(e.selector,e.operator,e.value)}));break;case"code":this.performInjectScript(e.value);break;case"inject-style":this.performInjectStyle(e.value);break;case"redirect":this.redirectPage(e.value)}},_performExperiments:function(e){Array.isArray(e)&&e.forEach((e=>{this._statsigInstance.getExperiment(e).get("!statsig_sidecar_directives",[]).forEach((e=>{try{this._performDirective(e)}catch(e){console.error("Failed to perform directive:",e)}}))}))},performInjectScript:function(e){const t=document.createElement("script");t.setAttribute("nonce",this.scriptNonce),t.nonce=this.scriptNonce,t.innerHTML=e,document.head.appendChild(t)},performInjectStyle:function(e){const t=document.createElement("style");t.innerHTML=e,document.head.appendChild(t)},performReorderElement:function(e,t,n){e&&this.setupMutationObserver(e,(()=>{const i=document.querySelector(e),r=document.querySelector(n);if(i&&r)switch(t){case"before":r.before(i);break;case"after":r.after(i);break;case"first":r.prepend(i);break;case"last":r.append(i)}}))},performStyleChange:function(e,t,n){e&&this.setupMutationObserver(e,(()=>{const i=document.querySelector(e);i&&i.style.setProperty(t,n)}))},processEvent:function(e){if(!e||!e.detail)return!1;const t=e.detail;return"inject-script"===t.name?(this.performInjectScript(t.value),!1):void 0},redirectPage:async function(e){if(this._flushQueuedEvents(),window&&window.location&&e&&window.location.href!=e)try{const t=new URL(window.location.href);if(t.searchParams.has(this._redirKey))return;const n=new URL(e,t);for(const e of t.searchParams.keys())n.searchParams.has(e)||n.searchParams.set(e,t.searchParams.get(e));n.searchParams.set(this._redirKey,"1"),this._isIOS()&&await this._statsigInstance.flush(),window.location.href=n.toString()}catch(t){window.location.href=e}},resetBody:function(){const e=document.getElementById("__sbpd");e&&e.parentElement.removeChild(e)},runAllExperiments:function(e=null){if(!e){const t=this._getMatchingExperiments();this._runPreExperimentScripts(t),e=t}if(e)try{this._performExperiments(e)}catch(e){console.error("Failed to perform experiments:",e)}this.resetBody(),window?.postExperimentCallback&&window.postExperimentCallback(this._statsigInstance,e)},_runPreExperimentScripts:function(e){e?.forEach((e=>{e.prerunScript&&"prestart"!==this._statsigInstance.getExperiment(e).ruleID&&this.performInjectScript(e.prerunScript)}))},setupMutationObserver:function(e,t){const n=this.findElementToObserve(e);n&&this._observeMutation(n,t)},setupStatsigSdk:async function(n,i,s,o,a){let l=null,u=null;try{const e=new URL(window.location.href);l=e.searchParams.get("overrideuser"),u=e.searchParams.get("overrideexp")}catch(e){console.error("Failed to update user:",e)}try{const c=window?.statsigUser??{};l&&(c.userID=l,c.customIDs=c.customIDs||{},c.customIDs.stableID=l);const d=window?.statsigOptions??{};if(d.disableLogging=!s,(o||a)&&(d.networkConfig={initializeUrl:o,logEventUrl:a}),u){const e=new t.LocalOverrideAdapter;d.overrideAdapter=e,e.overrideExperiment("sidecar",JSON.parse(u))}this._statsigInstance=new e.StatsigClient(n,c,d),await this._statsigInstance.initializeAsync(),(0,r.gX)(this._statsigInstance),this._clientInitialized=!0,this._flushQueuedEvents(),this._observePageChanges(i),this.runAllExperiments(i)}catch(e){console.error("Failed to initialize Statsig:",e)}this.resetBody()}};if(document.currentScript&&document.currentScript.src){const e=new URL(document.currentScript.src),t=e.searchParams.get("apikey"),n=e.searchParams.get("multiexpids"),i=e.searchParams.get("initializeurl"),r=e.searchParams.get("logeventurl"),o="0"!==e.searchParams.get("autostart"),a="0"!==e.searchParams.get("reduceflicker");if(s.scriptNonce=document.currentScript.nonce,t){a&&(document.write('<style id="__sbpd">body { display: none; }</style>\n'),setTimeout((()=>{s.resetBody()}),1e3));const e=n?n.split(","):null;s.setupStatsigSdk(t,e,o,i,r),document.addEventListener(`sidecar_${t}`,(e=>{s.processEvent(e),e.preventDefault()}))}}window.StatsigSidecar=s;const o=s})(),i})()));
|