UNPKG

@eppo/visual_editor_snippet

Version:

Eppo Visual Editor Snippet for client-side feature flag management

1 lines 161 kB
(()=>{var e={135:(e,t,r)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.LocalStorageAssignmentShim=void 0;const i=r(1552);class s{constructor(e){if(this.size=this.getCache().size,this[n]=this.getCache()[Symbol.toStringTag],!(0,i.hasWindowLocalStorage)())throw new Error("LocalStorage is not available");const t=e?`-${e}`:"";this.localStorageKey=`eppo-assignment${t}`}clear(){this.getCache().clear()}delete(e){return this.getCache().delete(e)}forEach(e,t){this.getCache().forEach(e,t)}entries(){return this.getCache().entries()}keys(){return this.getCache().keys()}values(){return this.getCache().values()}[Symbol.iterator](){return this.getCache()[Symbol.iterator]()}has(e){return this.getCache().has(e)}get(e){var t;return null!==(t=this.getCache().get(e))&&void 0!==t?t:void 0}set(e,t){return this.setCache(this.getCache().set(e,t))}getCache(){const e=window.localStorage.getItem(this.localStorageKey);return e?new Map(JSON.parse(e)):new Map}setCache(e){return window.localStorage.setItem(this.localStorageKey,JSON.stringify(Array.from(e.entries()))),this}}t.LocalStorageAssignmentShim=s,n=Symbol.toStringTag},136:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2975),i=r(9721);class s{constructor(e){this.name=e,this.eventKeys=[],this.localStorageKey=`eventQueue:${this.name}`,this.loadStateFromLocalStorage()}splice(e){const t=Array.from({length:e},(()=>this.shift()));return(0,i.takeWhile)(t,(e=>void 0!==e))}isEmpty(){return 0===this.length}get length(){return this.eventKeys.length}push(e){const t=this.generateEventKey(e),r=JSON.stringify(e);localStorage.setItem(t,r),this.eventKeys.push(t),this.saveStateToLocalStorage()}*[Symbol.iterator](){for(const e of this.eventKeys){const t=localStorage.getItem(e);t&&(yield JSON.parse(t))}}shift(){if(0===this.eventKeys.length)return;const e=this.eventKeys.shift();if(!e)throw new Error("Unexpected undefined event key");const t=localStorage.getItem(e);return t?(localStorage.removeItem(e),this.saveStateToLocalStorage(),JSON.parse(t)):void 0}loadStateFromLocalStorage(){const e=localStorage.getItem(this.localStorageKey);if(e)try{this.eventKeys=JSON.parse(e)}catch(e){n.applicationLogger.error(`Failed to parse event queue ${this.name} state. Initializing empty queue.`),this.eventKeys=[]}}saveStateToLocalStorage(){const e=JSON.stringify(this.eventKeys);localStorage.setItem(this.localStorageKey,e)}generateEventKey(e){const t=this.hashEvent(e);return`eventQueue:${this.name}:${t}`}hashEvent(e){const t=JSON.stringify(e);let r=0;for(let e=0;e<t.length;e++)r=(r<<5)-r+t.charCodeAt(e),r|=0;return r.toString(36)}}t.default=s},182:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=t.validate=t.v7=t.v6ToV1=t.v6=t.v5=t.v4=t.v3=t.v1ToV6=t.v1=t.stringify=t.parse=t.NIL=t.MAX=void 0;var n=r(2196);Object.defineProperty(t,"MAX",{enumerable:!0,get:function(){return n.default}});var i=r(3465);Object.defineProperty(t,"NIL",{enumerable:!0,get:function(){return i.default}});var s=r(1797);Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return s.default}});var o=r(6011);Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.default}});var a=r(1425);Object.defineProperty(t,"v1",{enumerable:!0,get:function(){return a.default}});var l=r(6568);Object.defineProperty(t,"v1ToV6",{enumerable:!0,get:function(){return l.default}});var c=r(591);Object.defineProperty(t,"v3",{enumerable:!0,get:function(){return c.default}});var u=r(8286);Object.defineProperty(t,"v4",{enumerable:!0,get:function(){return u.default}});var g=r(4557);Object.defineProperty(t,"v5",{enumerable:!0,get:function(){return g.default}});var d=r(6356);Object.defineProperty(t,"v6",{enumerable:!0,get:function(){return d.default}});var h=r(268);Object.defineProperty(t,"v6ToV1",{enumerable:!0,get:function(){return h.default}});var f=r(4299);Object.defineProperty(t,"v7",{enumerable:!0,get:function(){return f.default}});var p=r(9746);Object.defineProperty(t,"validate",{enumerable:!0,get:function(){return p.default}});var m=r(2770);Object.defineProperty(t,"version",{enumerable:!0,get:function(){return m.default}})},204:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OverrideValidator=t.sendValidationRequest=void 0;const n=r(1902);t.sendValidationRequest=async e=>{const t=await fetch("https://eppo.cloud/api/flag-overrides/v1/validate-key",{method:"POST",body:JSON.stringify({key:e}),headers:{"Content-Type":"application/json"}});if(200!==t.status)throw new Error(`Unable to authorize key: ${t.statusText}`)},t.OverrideValidator=class{constructor(){this.validKeyCache=new n.TLRUCache(100,18e6)}parseOverridePayload(e){try{const t=JSON.parse(e);return this.validateParsedOverridePayload(t),t}catch(e){throw new Error(`Unable to parse overridePayload: ${e?.message??"unknown error"}`)}}validateParsedOverridePayload(e){if("object"!=typeof e)throw new Error("Expected object, but received "+typeof e);const t=Object.keys(e);if(!t.includes("browserExtensionKey"))throw new Error("Missing required field: 'browserExtensionKey'");if(!t.includes("overrides"))throw new Error("Missing required field: 'overrides'");if("string"!=typeof e.browserExtensionKey)throw new Error("Invalid type for 'browserExtensionKey'. Expected string, but received "+typeof e.browserExtensionKey);if("object"!=typeof e.overrides)throw new Error(`Invalid type for 'overrides'. Expected object, but received ${typeof e.overrides}.`)}async validateKey(e){if("true"===this.validKeyCache.get(e))return!0;await(0,t.sendValidationRequest)(e),this.validKeyCache.set(e,"true")}}},268:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1797),i=r(6011);t.default=function(e){const t=(r="string"==typeof e?(0,n.default)(e):e,Uint8Array.of((15&r[3])<<4|r[4]>>4&15,(15&r[4])<<4|(240&r[5])>>4,(15&r[5])<<4|15&r[6],r[7],(15&r[1])<<4|(240&r[2])>>4,(15&r[2])<<4|(240&r[3])>>4,16|(240&r[0])>>4,(15&r[0])<<4|(240&r[1])>>4,r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15]));var r;return"string"==typeof e?(0,i.unsafeStringify)(t):t}},299:e=>{"use strict";e.exports=JSON.parse('{"name":"@eppo/js-client-sdk","version":"3.13.1","description":"Eppo SDK for client-side JavaScript applications","main":"dist/index.js","files":["/dist","/src","!*.spec.ts"],"types":"dist/index.d.ts","scripts":{"lint":"eslint \'**/*.ts\' --cache","lint:fix":"eslint --fix \'**/*.ts\' --cache","lint:fix-pre-commit":"eslint -c .eslintrc.pre-commit.js --fix \'**/*.ts\' --no-eslintrc --cache","prepare":"make prepare","pre-commit":"lint-staged && tsc && yarn docs","typecheck":"tsc","test":"yarn test:unit","test:unit":"NODE_ENV=test jest \'.*\\\\.spec\\\\.ts\'","docs":"api-documenter markdown -i ./temp -o ./docs"},"jsdelivr":"dist/eppo-sdk.js","repository":{"type":"git","url":"git+https://github.com/Eppo-exp/js-client-sdk.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/Eppo-exp/js-client-sdk/issues"},"homepage":"https://github.com/Eppo-exp/js-client-sdk#readme","devDependencies":{"@microsoft/api-documenter":"^7.26.3","@microsoft/api-extractor":"^7.48.1","@types/chrome":"^0.0.268","@types/jest":"^29.5.11","@types/spark-md5":"^3.0.5","@typescript-eslint/eslint-plugin":"^5.13.0","@typescript-eslint/parser":"^5.13.0","eslint":"^8.17.0","eslint-config-prettier":"^9.1.0","eslint-import-resolver-typescript":"^3.6.3","eslint-plugin-import":"^2.25.4","eslint-plugin-prettier":"^5.2.1","eslint-plugin-promise":"^7.2.1","husky":"^9.1.7","jest":"^29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^15.4.1","prettier":"^3.4.2","terser-webpack-plugin":"^5.3.3","testdouble":"^3.20.2","ts-jest":"^29.1.1","ts-loader":"^9.3.1","ts-node":"^10.9.2","typescript":"^4.7.4","webpack":"^5.73.0","webpack-cli":"^6.0.1"},"dependencies":{"@eppo/js-client-sdk-common":"4.13.2"},"packageManager":"yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"}')},318:(e,t)=>{"use strict";function r(e){return Boolean("object"==typeof e&&e&&"numericAttributes"in e&&"categoricalAttributes"in e)}function n(e){const t={numericAttributes:{},categoricalAttributes:{}};return Object.entries(e).forEach((([e,r])=>{"number"==typeof r?t.numericAttributes[e]=r:t.categoricalAttributes[e]=r})),t}Object.defineProperty(t,"__esModule",{value:!0}),t.isInstanceOfContextualAttributes=r,t.ensureNonContextualSubjectAttributes=function(e){let t;if(r(e)){const r=e;t={...r.numericAttributes,...r.categoricalAttributes}}else t=e;return t},t.ensureContextualSubjectAttributes=function(e){return r(e)?e:n(e)},t.deduceAttributeContext=n,t.ensureActionsWithContextualAttributes=function(e){let t={};return Array.isArray(e)?e.forEach((e=>{t[e]={numericAttributes:{},categoricalAttributes:{}}})):Object.values(e).every(r)?t=e:Object.entries(e).forEach((([e,r])=>{t[e]=n(r)})),t}},338:(e,t)=>{"use strict";function r(e){return 14+(e+64>>>9<<4)+1}function n(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function i(e,t,r,i,s,o){return n((a=n(n(t,e),n(i,o)))<<(l=s)|a>>>32-l,r);var a,l}function s(e,t,r,n,s,o,a){return i(t&r|~t&n,e,t,s,o,a)}function o(e,t,r,n,s,o,a){return i(t&n|r&~n,e,t,s,o,a)}function a(e,t,r,n,s,o,a){return i(t^r^n,e,t,s,o,a)}function l(e,t,r,n,s,o,a){return i(r^(t|~n),e,t,s,o,a)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(e){const t=new Uint8Array(4*e.length);for(let r=0;r<4*e.length;r++)t[r]=e[r>>2]>>>r%4*8&255;return t}(function(e,t){const i=new Uint32Array(r(t)).fill(0);i.set(e),i[t>>5]|=128<<t%32,i[i.length-1]=t,e=i;let c=1732584193,u=-271733879,g=-1732584194,d=271733878;for(let t=0;t<e.length;t+=16){const r=c,i=u,h=g,f=d;c=s(c,u,g,d,e[t],7,-680876936),d=s(d,c,u,g,e[t+1],12,-389564586),g=s(g,d,c,u,e[t+2],17,606105819),u=s(u,g,d,c,e[t+3],22,-1044525330),c=s(c,u,g,d,e[t+4],7,-176418897),d=s(d,c,u,g,e[t+5],12,1200080426),g=s(g,d,c,u,e[t+6],17,-1473231341),u=s(u,g,d,c,e[t+7],22,-45705983),c=s(c,u,g,d,e[t+8],7,1770035416),d=s(d,c,u,g,e[t+9],12,-1958414417),g=s(g,d,c,u,e[t+10],17,-42063),u=s(u,g,d,c,e[t+11],22,-1990404162),c=s(c,u,g,d,e[t+12],7,1804603682),d=s(d,c,u,g,e[t+13],12,-40341101),g=s(g,d,c,u,e[t+14],17,-1502002290),u=s(u,g,d,c,e[t+15],22,1236535329),c=o(c,u,g,d,e[t+1],5,-165796510),d=o(d,c,u,g,e[t+6],9,-1069501632),g=o(g,d,c,u,e[t+11],14,643717713),u=o(u,g,d,c,e[t],20,-373897302),c=o(c,u,g,d,e[t+5],5,-701558691),d=o(d,c,u,g,e[t+10],9,38016083),g=o(g,d,c,u,e[t+15],14,-660478335),u=o(u,g,d,c,e[t+4],20,-405537848),c=o(c,u,g,d,e[t+9],5,568446438),d=o(d,c,u,g,e[t+14],9,-1019803690),g=o(g,d,c,u,e[t+3],14,-187363961),u=o(u,g,d,c,e[t+8],20,1163531501),c=o(c,u,g,d,e[t+13],5,-1444681467),d=o(d,c,u,g,e[t+2],9,-51403784),g=o(g,d,c,u,e[t+7],14,1735328473),u=o(u,g,d,c,e[t+12],20,-1926607734),c=a(c,u,g,d,e[t+5],4,-378558),d=a(d,c,u,g,e[t+8],11,-2022574463),g=a(g,d,c,u,e[t+11],16,1839030562),u=a(u,g,d,c,e[t+14],23,-35309556),c=a(c,u,g,d,e[t+1],4,-1530992060),d=a(d,c,u,g,e[t+4],11,1272893353),g=a(g,d,c,u,e[t+7],16,-155497632),u=a(u,g,d,c,e[t+10],23,-1094730640),c=a(c,u,g,d,e[t+13],4,681279174),d=a(d,c,u,g,e[t],11,-358537222),g=a(g,d,c,u,e[t+3],16,-722521979),u=a(u,g,d,c,e[t+6],23,76029189),c=a(c,u,g,d,e[t+9],4,-640364487),d=a(d,c,u,g,e[t+12],11,-421815835),g=a(g,d,c,u,e[t+15],16,530742520),u=a(u,g,d,c,e[t+2],23,-995338651),c=l(c,u,g,d,e[t],6,-198630844),d=l(d,c,u,g,e[t+7],10,1126891415),g=l(g,d,c,u,e[t+14],15,-1416354905),u=l(u,g,d,c,e[t+5],21,-57434055),c=l(c,u,g,d,e[t+12],6,1700485571),d=l(d,c,u,g,e[t+3],10,-1894986606),g=l(g,d,c,u,e[t+10],15,-1051523),u=l(u,g,d,c,e[t+1],21,-2054922799),c=l(c,u,g,d,e[t+8],6,1873313359),d=l(d,c,u,g,e[t+15],10,-30611744),g=l(g,d,c,u,e[t+6],15,-1560198380),u=l(u,g,d,c,e[t+13],21,1309151649),c=l(c,u,g,d,e[t+4],6,-145523070),d=l(d,c,u,g,e[t+11],10,-1120210379),g=l(g,d,c,u,e[t+2],15,718787259),u=l(u,g,d,c,e[t+9],21,-343485551),c=n(c,r),u=n(u,i),g=n(g,h),d=n(d,f)}return Uint32Array.of(c,u,g,d)}(function(e){if(0===e.length)return new Uint32Array;const t=new Uint32Array(r(8*e.length)).fill(0);for(let r=0;r<e.length;r++)t[r>>2]|=(255&e[r])<<r%4*8;return t}(e),8*e.length))}},375:(e,t,r)=>{const n=r(4605),i=r(3708);e.exports=(e,t,r)=>{let s=null,o=null,a=null;try{a=new i(t,r)}catch(e){return null}return e.forEach((e=>{a.test(e)&&(s&&-1!==o.compare(e)||(s=e,o=new n(s,r)))})),s}},391:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{attachContext(e,t){}dispatch(e){}}},591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=void 0;const n=r(338),i=r(2988);var s=r(2988);function o(e,t,r,s){return(0,i.default)(48,n.default,e,t,r,s)}Object.defineProperty(t,"DNS",{enumerable:!0,get:function(){return s.DNS}}),Object.defineProperty(t,"URL",{enumerable:!0,get:function(){return s.URL}}),o.DNS=i.DNS,o.URL=i.URL,t.default=o},653:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HybridConfigurationStore=void 0;const n=r(4742);t.HybridConfigurationStore=class{constructor(e,t){this.servingStore=e,this.persistentStore=t,this.environment=null,this.configFetchedAt=null,this.configPublishedAt=null,this.format=null}async init(){if(!this.persistentStore)return;this.persistentStore.isInitialized()||n.logger.warn(`${n.loggerPrefix} Persistent store is not initialized from remote configuration. Serving assignments that may be stale.`);const e=await this.persistentStore.entries();this.servingStore.setEntries(e)}isInitialized(){return this.servingStore.isInitialized()&&(this.persistentStore?.isInitialized()??!0)}async isExpired(){return await(this.persistentStore?.isExpired())??!0}get(e){return this.servingStore.isInitialized()||n.logger.warn(`${n.loggerPrefix} getting a value from a ServingStore that is not initialized.`),this.servingStore.get(e)}entries(){return this.servingStore.entries()}getKeys(){return this.servingStore.getKeys()}async setEntries(e){return this.persistentStore&&await this.persistentStore.setEntries(e),this.servingStore.setEntries(e),!0}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}getConfigFetchedAt(){return this.configFetchedAt}setConfigFetchedAt(e){this.configFetchedAt=e}getConfigPublishedAt(){return this.configPublishedAt}setConfigPublishedAt(e){this.configPublishedAt=e}getFormat(){return this.format}setFormat(e){this.format=e}}},664:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TLRUInMemoryAssignmentCache=void 0;const n=r(6882),i=r(7989),s=r(1902);class o extends i.AbstractAssignmentCache{constructor(e,t=n.DEFAULT_TLRU_TTL_MS){super(new s.TLRUCache(e,t))}}t.TLRUInMemoryAssignmentCache=o},793:e=>{"use strict";function t(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}e.exports=function(e,r,n){var i=n&&n.stringify||t;if("object"==typeof e&&null!==e){var s=r.length+1;if(1===s)return e;var o=new Array(s);o[0]=i(e);for(var a=1;a<s;a++)o[a]=i(r[a]);return o.join(" ")}if("string"!=typeof e)return e;var l=r.length;if(0===l)return e;for(var c="",u=0,g=-1,d=e&&e.length||0,h=0;h<d;){if(37===e.charCodeAt(h)&&h+1<d){switch(g=g>-1?g:0,e.charCodeAt(h+1)){case 100:case 102:if(u>=l)break;if(null==r[u])break;g<h&&(c+=e.slice(g,h)),c+=Number(r[u]),g=h+2,h++;break;case 105:if(u>=l)break;if(null==r[u])break;g<h&&(c+=e.slice(g,h)),c+=Math.floor(Number(r[u])),g=h+2,h++;break;case 79:case 111:case 106:if(u>=l)break;if(void 0===r[u])break;g<h&&(c+=e.slice(g,h));var f=typeof r[u];if("string"===f){c+="'"+r[u]+"'",g=h+2,h++;break}if("function"===f){c+=r[u].name||"<anonymous>",g=h+2,h++;break}c+=i(r[u]),g=h+2,h++;break;case 115:if(u>=l)break;g<h&&(c+=e.slice(g,h)),c+=String(r[u]),g=h+2,h++;break;case 37:g<h&&(c+=e.slice(g,h)),c+="%",g=h+2,h++,u--}++u}++h}return-1===g?e:(g<d&&(c+=e.slice(g)),c)}},802:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.storage=e}async has(e){return!!await this.get(e)}async get(e){var t;const r=await this.storage.get(e);return null!==(t=null==r?void 0:r[e])&&void 0!==t?t:void 0}async entries(){return await this.storage.get(null)}async set(e,t){await this.storage.set({[e]:t})}}},831:e=>{const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},922:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8127),i="v0/i";t.default=class{decodeEventIngestionUrl(e){const t=e.split(".")[1];if(!t)return null;const r=n.Base64.decode(t),s=new URLSearchParams(r).get("eh");if(!s)return null;const o=s.endsWith("/")?`${s}${i}`:`${s}/${i}`;return o.startsWith("http://")||o.startsWith("https://")?o:`https://${o}`}}},962:(e,t,r)=>{const n=r(5822);e.exports=(e,t,r)=>n(e,t,">",r)},1103:(e,t,r)=>{const n=r(9043);e.exports=(e,t,r)=>n(e,t,r)<=0},1112:(e,t,r)=>{const n=r(9043);e.exports=(e,t,r)=>0===n(e,t,r)},1147:(e,t,r)=>{const n=r(4605);e.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}},1265:(e,t,r)=>{"use strict";t.ge=t.LR=void 0;const n=r(2975),i=r(7043),s=r(4035),o=r(3983),a=r(1552),l=r(1684),c=r(136),u=r(3142);r(2975),r(6814);const g=(0,a.configurationStorageFactory)({forceMemoryOnly:!0}),d=(0,a.precomputedFlagsStorageFactory)();(0,a.precomputedBanditStoreFactory)();t.LR={attachContext:()=>{},dispatch:()=>{}};class h extends n.EppoClient{constructor(){super(...arguments),this.initialized=!1}getStringAssignment(e,t,r,n){return this.ensureInitialized(),super.getStringAssignment(e,t,r,n)}getStringAssignmentDetails(e,t,r,n){return this.ensureInitialized(),super.getStringAssignmentDetails(e,t,r,n)}getBoolAssignment(e,t,r,n){return this.getBooleanAssignment(e,t,r,n)}getBooleanAssignment(e,t,r,n){return this.ensureInitialized(),super.getBooleanAssignment(e,t,r,n)}getBooleanAssignmentDetails(e,t,r,n){return this.ensureInitialized(),super.getBooleanAssignmentDetails(e,t,r,n)}getIntegerAssignment(e,t,r,n){return this.ensureInitialized(),super.getIntegerAssignment(e,t,r,n)}getIntegerAssignmentDetails(e,t,r,n){return this.ensureInitialized(),super.getIntegerAssignmentDetails(e,t,r,n)}getNumericAssignment(e,t,r,n){return this.ensureInitialized(),super.getNumericAssignment(e,t,r,n)}getNumericAssignmentDetails(e,t,r,n){return this.ensureInitialized(),super.getNumericAssignmentDetails(e,t,r,n)}getJSONAssignment(e,t,r,n){return this.ensureInitialized(),super.getJSONAssignment(e,t,r,n)}getJSONAssignmentDetails(e,t,r,n){return this.ensureInitialized(),super.getJSONAssignmentDetails(e,t,r,n)}getBanditAction(e,t,r,n,i){return this.ensureInitialized(),super.getBanditAction(e,t,r,n,i)}getBanditActionDetails(e,t,r,n,i){return this.ensureInitialized(),super.getBanditActionDetails(e,t,r,n,i)}getExperimentContainerEntry(e,t,r){return this.ensureInitialized(),super.getExperimentContainerEntry(e,t,r)}ensureInitialized(){this.initialized||n.applicationLogger.warn("Eppo SDK assignment requested before init() completed")}async init(e){var r;let g;n.validation.validateNotBlank(e.apiKey,"API key required");const{apiKey:d,persistentStore:h,baseUrl:f,maxCacheAgeSeconds:p,updateOnFetch:m,requestTimeoutMs:E,numInitialRequestRetries:y,numPollRequestRetries:v,pollingIntervalMs:b,pollAfterSuccessfulInitialization:S=!1,pollAfterFailedInitialization:A=!1,skipInitialRequest:O=!1,eventIngestionConfig:C,enableOverrides:I=!1}=e;try{this.stopPolling(),this.setAssignmentLogger(e.assignmentLogger),e.banditLogger&&this.setBanditLogger(e.banditLogger),this.setIsObfuscated(!0);const r=function(e){return e.replace(/\W/g,"").substring(0,8)}(d),T=(0,a.configurationStorageFactory)({maxAgeSeconds:p,servingStoreUpdateStrategy:m,persistentStore:h,hasChromeStorage:(0,a.hasChromeStorage)(),hasWindowLocalStorage:(0,a.hasWindowLocalStorage)()},{chromeStorage:(0,a.chromeStorageIfAvailable)(),windowLocalStorage:(0,a.localStorageIfAvailable)(),storageKeySuffix:r});if(this.setIsObfuscated(!0),T.setFormat(n.FormatEnum.CLIENT),this.setFlagConfigurationStore(T),I){const t=(0,a.overrideStorageFactory)({hasWindowLocalStorage:(0,a.hasWindowLocalStorage)()},{windowLocalStorage:(0,a.localStorageIfAvailable)(),storageKey:e.overridesStorageKey});this.setOverrideStore(t)}else this.unsetOverrideStore();const w=(0,i.assignmentCacheFactory)({chromeStorage:(0,a.chromeStorageIfAvailable)(),storageKeySuffix:r});w instanceof s.default&&await w.init(),this.useCustomAssignmentCache(w);const _={apiKey:d,sdkName:u.sdkName,sdkVersion:u.sdkVersion,baseUrl:f,requestTimeoutMs:E,numInitialRequestRetries:y,numPollRequestRetries:v,pollAfterSuccessfulInitialization:S,pollAfterFailedInitialization:A,pollingIntervalMs:b,throwOnFailedInitialization:!0,skipInitialPoll:O};let N,L;this.setConfigurationRequestParameters(_),this.setEventDispatcher(function(e,r={}){const{batchSize:i=1e3,deliveryIntervalMs:s=1e4,disabled:o=!1,maxQueueSize:u=1e4,maxRetries:g=3,maxRetryDelayMs:d=3e4,retryIntervalMs:h=5e3}=r;if(o)return t.LR;const f=(0,a.hasWindowLocalStorage)()?new c.default("events"):new n.BoundedEventQueue("events",[],u),p="undefined"!=typeof window?new l.default:{isOffline:()=>!1,onNetworkStatusChange:()=>{}};return(0,n.newDefaultEventDispatcher)(f,p,e,i,{deliveryIntervalMs:s,retryIntervalMs:h,maxRetryDelayMs:d,maxRetries:g})}(d,C));const R=T.init().then((async()=>{if(!T.getKeys().length)return n.applicationLogger.warn("Eppo SDK cached configuration is empty"),N=new Error("Configuration store was empty"),o.ConfigLoaderStatus.DID_NOT_PRODUCE;const t=await T.isExpired();return t&&!e.useExpiredCache?(n.applicationLogger.warn("Eppo SDK set not to use expired cached configuration"),N=new Error("Configuration store was expired"),o.ConfigLoaderStatus.DID_NOT_PRODUCE):(t&&e.useExpiredCache&&n.applicationLogger.warn("Eppo SDK config.useExpiredCache is true; using expired cache"),o.ConfigLoaderStatus.COMPLETED)})).catch((e=>(n.applicationLogger.warn("Eppo SDK encountered an error initializing from the configuration store",e),N=e,o.ConfigLoaderStatus.FAILED))).then((e=>({source:o.ConfigSource.CONFIG_STORE,result:e}))),P=this.fetchFlagConfigurations().then((()=>T.isInitialized()?o.ConfigLoaderStatus.COMPLETED:o.ConfigLoaderStatus.DID_NOT_PRODUCE)).catch((e=>(n.applicationLogger.warn("Eppo SDK encountered an error initializing from fetching",e),L=e,o.ConfigLoaderStatus.FAILED))).then((e=>({source:o.ConfigSource.FETCH,result:e}))),M=[R];let D;e.skipInitialRequest||M.push(P);const{source:F,result:j}=await Promise.race(M);if(j===o.ConfigLoaderStatus.COMPLETED)D=F;else{const e=F===o.ConfigSource.FETCH?R:P;D=await e.then((e=>{const{source:t,result:r}=e;return r===o.ConfigLoaderStatus.COMPLETED?t:o.ConfigSource.NONE}))}D===o.ConfigSource.NONE&&(g=L||N||new Error("Eppo SDK: No configuration source produced a valid configuration")),n.applicationLogger.debug("Initialization source",D)}catch(e){g=e instanceof Error?e:new Error(String(e))}if(g&&(n.applicationLogger.warn("Eppo SDK was unable to initialize with a configuration, assignment calls will return the default value and not be logged"+(e.pollAfterFailedInitialization?" until an experiment configuration is successfully retrieved":"")),null===(r=e.throwOnFailedInitialization)||void 0===r||r))throw g;return this.initialized=!0,this}offlineInit(e){var t,r,s;const o=null!==(t=e.isObfuscated)&&void 0!==t&&t,l=null===(r=e.throwOnFailedInitialization)||void 0===r||r,c=null!==(s=e.enableOverrides)&&void 0!==s&&s;try{const t=(0,a.configurationStorageFactory)({forceMemoryOnly:!0});if(t.setFormat(o?n.FormatEnum.CLIENT:n.FormatEnum.SERVER),t.setEntries(e.flagsConfiguration).catch((e=>n.applicationLogger.warn("Error setting flags for memory-only configuration store",e))),this.setFlagConfigurationStore(t),c){const t=(0,a.overrideStorageFactory)({hasWindowLocalStorage:(0,a.hasWindowLocalStorage)()},{windowLocalStorage:(0,a.localStorageIfAvailable)(),storageKey:e.overridesStorageKey});this.setOverrideStore(t)}else this.unsetOverrideStore();this.setIsObfuscated(o),e.assignmentLogger&&this.setAssignmentLogger(e.assignmentLogger),e.banditLogger&&this.setBanditLogger(e.banditLogger);const r="offline",s=(0,i.assignmentCacheFactory)({storageKeySuffix:r,forceMemoryOnly:!0});this.useCustomAssignmentCache(s)}catch(e){if(n.applicationLogger.warn("Eppo SDK encountered an error initializing, assignment calls will return the default value and not be logged"),l)throw e}this.initialized=!0}}h.instance=new h({flagConfigurationStore:g,isObfuscated:!0}),h.initialized=!1,t.ge=function(e){const t=h.instance;return t.offlineInit(e),h.initialized=!0,t};class f extends n.EppoPrecomputedClient{getStringAssignment(e,t){return f.getAssignmentInitializationCheck(),super.getStringAssignment(e,t)}getBooleanAssignment(e,t){return f.getAssignmentInitializationCheck(),super.getBooleanAssignment(e,t)}getIntegerAssignment(e,t){return f.getAssignmentInitializationCheck(),super.getIntegerAssignment(e,t)}getNumericAssignment(e,t){return f.getAssignmentInitializationCheck(),super.getNumericAssignment(e,t)}getJSONAssignment(e,t){return f.getAssignmentInitializationCheck(),super.getJSONAssignment(e,t)}getBanditAction(e,t){return f.getAssignmentInitializationCheck(),super.getBanditAction(e,t)}static getAssignmentInitializationCheck(){h.initialized||n.applicationLogger.warn("Eppo SDK assignment requested before init() completed")}}f.instance=new f({precomputedFlagStore:d,subject:{subjectKey:"",subjectAttributes:{}}}),f.initialized=!1},1291:(e,t,r)=>{const n=r(9043);e.exports=(e,t,r)=>n(t,e,r)},1425:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateV1State=void 0;const n=r(2291),i=r(6011),s={};function o(e,t,r){return e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=r.slice(10,16),e.node[0]|=1,e.clockseq=16383&(r[8]<<8|r[9])),e.msecs=t,e}function a(e,t,r,n,i,s,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(s){if(o<0||o+16>s.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`)}else s=new Uint8Array(16),o=0;t??=Date.now(),r??=0,n??=16383&(e[8]<<8|e[9]),i??=e.slice(10,16);const a=(1e4*(268435455&(t+=122192928e5))+r)%4294967296;s[o++]=a>>>24&255,s[o++]=a>>>16&255,s[o++]=a>>>8&255,s[o++]=255&a;const l=t/4294967296*1e4&268435455;s[o++]=l>>>8&255,s[o++]=255&l,s[o++]=l>>>24&15|16,s[o++]=l>>>16&255,s[o++]=n>>>8|128,s[o++]=255&n;for(let e=0;e<6;++e)s[o++]=i[e];return s}t.updateV1State=o,t.default=function(e,t,r){let l;const c=e?._v6??!1;if(e){const t=Object.keys(e);1===t.length&&"_v6"===t[0]&&(e=void 0)}if(e)l=a(e.random??e.rng?.()??(0,n.default)(),e.msecs,e.nsecs,e.clockseq,e.node,t,r);else{const e=Date.now(),i=(0,n.default)();o(s,e,i),l=a(i,s.msecs,s.nsecs,c?void 0:s.clockseq,c?void 0:s.node,t,r)}return t??(0,i.unsafeStringify)(l)}},1461:e=>{"use strict";e.exports=JSON.parse('{"name":"@eppo/js-client-sdk-common","version":"4.13.2","description":"Common library for Eppo JavaScript SDKs (web, react native, and node)","main":"dist/index.js","files":["/dist","/src","!*.spec.ts"],"types":"./dist/index.d.ts","engines":{"node":">=18.x"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"lint":"eslint \'**/*.{ts,tsx}\' --cache","lint:fix":"eslint --fix \'**/*.{ts,tsx}\' --cache","lint:fix-pre-commit":"eslint -c .eslintrc.pre-commit.js --fix \'**/*.{ts,tsx}\' --no-eslintrc --cache","prepare":"make prepare","pre-commit":"lint-staged && tsc","typecheck":"tsc","test":"yarn test:unit","test:unit":"NODE_ENV=test jest \'.*\\\\.spec\\\\.ts\'","obfuscate-mock-ufc":"ts-node test/writeObfuscatedMockUFC"},"jsdelivr":"dist/eppo-sdk.js","repository":{"type":"git","url":"git+https://github.com/Eppo-exp/js-client-sdk-common.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/Eppo-exp/js-client-sdk-common/issues"},"homepage":"https://github.com/Eppo-exp/js-client-sdk-common#readme","devDependencies":{"@types/jest":"^29.5.11","@types/js-base64":"^3.3.1","@types/lodash":"^4.17.5","@types/semver":"^7.5.6","@types/spark-md5":"^3.0.5","@types/uuid":"^10.0.0","@typescript-eslint/eslint-plugin":"^5.13.0","@typescript-eslint/parser":"^5.13.0","eslint":"^8.17.0","eslint-config-prettier":"^10.0.1","eslint-import-resolver-typescript":"^3.7.0","eslint-plugin-import":"^2.25.4","eslint-plugin-prettier":"5.2.3","eslint-plugin-promise":"^7.2.1","eslint-plugin-unused-imports":"^4.1.4","jest":"^29.7.0","jest-environment-jsdom":"^29.7.0","lodash":"^4.17.21","prettier":"^3.4.2","prettier-eslint":"^16.3.0","terser-webpack-plugin":"^5.3.3","testdouble":"^3.20.1","ts-jest":"^29.1.1","ts-loader":"^9.3.1","ts-node":"^10.9.1","typescript":"^5.7.2","webpack":"^5.73.0","webpack-cli":"^6.0.1"},"dependencies":{"buffer":"npm:@eppo/buffer@6.2.0","js-base64":"^3.7.7","pino":"^9.5.0","semver":"^7.5.4","spark-md5":"^3.0.2","uuid":"^11.0.5"},"packageManager":"yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"}')},1479:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2975);t.default=class{constructor(){this.store=new Map,this.cache=new n.NonExpiringInMemoryAssignmentCache(this.store)}set(e){this.cache.set(e)}has(e){return this.cache.has(e)}setEntries(e){const{store:t}=this;e.forEach((([e,r])=>t.set(e,r)))}getEntries(){return Promise.resolve(Array.from(this.cache.entries()))}}},1552:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.localStorageIfAvailable=t.hasWindowLocalStorage=t.chromeStorageIfAvailable=t.hasChromeStorage=t.overrideStorageFactory=t.configurationStorageFactory=t.precomputedBanditStoreFactory=t.precomputedFlagsStorageFactory=void 0;const n=r(2975),i=r(802),s=r(6814),o=r(2557),a=r(7309),l=r(4406),c=r(7029);function u(){return"undefined"!=typeof chrome&&!!chrome.storage}function g(){try{return"undefined"!=typeof window&&!!window.localStorage}catch(e){return!1}}t.precomputedFlagsStorageFactory=function(){return new n.MemoryOnlyConfigurationStore},t.precomputedBanditStoreFactory=function(){return new n.MemoryOnlyConfigurationStore},t.configurationStorageFactory=function({maxAgeSeconds:e=0,servingStoreUpdateStrategy:t="always",hasChromeStorage:r=!1,hasWindowLocalStorage:l=!1,persistentStore:u,forceMemoryOnly:g=!1},{chromeStorage:d,windowLocalStorage:h,storageKeySuffix:f}={}){if(g)return new n.MemoryOnlyConfigurationStore;if(u)return new o.IsolatableHybridConfigurationStore(new n.MemoryStore,u,t);if(r&&d){const r=new s.ChromeStorageEngine(new i.default(d),null!=f?f:"");return new o.IsolatableHybridConfigurationStore(new n.MemoryStore,new c.StringValuedAsyncStore(r,e),t)}if(l&&h){const r=new a.LocalStorageEngine(h,null!=f?f:"");return new o.IsolatableHybridConfigurationStore(new n.MemoryStore,new c.StringValuedAsyncStore(r,e),t)}return new n.MemoryOnlyConfigurationStore},t.overrideStorageFactory=function({hasWindowLocalStorage:e=!1,forceMemoryOnly:t=!1},{windowLocalStorage:r,storageKey:i=l.OVERRIDES_KEY}={}){const s=new n.MemoryStore;if(!t&&e&&r){const e=r.getItem(i);if(e){const t=JSON.parse(e);s.setEntries(t)}}return s},t.hasChromeStorage=u,t.chromeStorageIfAvailable=function(){return u()?chrome.storage.local:void 0},t.hasWindowLocalStorage=g,t.localStorageIfAvailable=function(){return g()?window.localStorage:void 0}},1565:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t){this.eventQueue=e,this.batchSize=Math.max(100,Math.min(1e4,t))}nextBatch(){return this.eventQueue.splice(this.batchSize)}push(...e){this.eventQueue.push(...e)}isEmpty(){return this.eventQueue.isEmpty()}}},1650:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeFlag=function(e){return{...e,variations:s(e.variations,e.variationType),allocations:e.allocations.map(a)}},t.decodeVariations=s,t.decodeValue=o,t.decodeAllocation=a,t.decodeSplit=l,t.decodeShard=c,t.decodeObject=u,t.decodeObjectTo=g,t.decodePrecomputedFlag=function(e){return{...e,allocationKey:(0,i.decodeBase64)(e.allocationKey??""),variationKey:(0,i.decodeBase64)(e.variationKey??""),variationValue:o(e.variationValue,e.variationType),extraLogging:u(e.extraLogging??{})}},t.decodePrecomputedBandit=function(e){return{...e,banditKey:(0,i.decodeBase64)(e.banditKey),action:(0,i.decodeBase64)(e.action),modelVersion:(0,i.decodeBase64)(e.modelVersion),actionNumericAttributes:g(e.actionNumericAttributes??{},(e=>+e)),actionCategoricalAttributes:u(e.actionCategoricalAttributes??{})}};const n=r(4619),i=r(6092);function s(e,t){return Object.fromEntries(Object.entries(e).map((([,e])=>{const r=(0,i.decodeBase64)(e.key);return[r,{key:r,value:o(e.value,t)}]})))}function o(e,t){switch(t){case n.VariationType.INTEGER:case n.VariationType.NUMERIC:return Number((0,i.decodeBase64)(e));case n.VariationType.BOOLEAN:return"true"===(0,i.decodeBase64)(e);default:return(0,i.decodeBase64)(e)}}function a(e){return{...e,key:(0,i.decodeBase64)(e.key),splits:e.splits.map(l),startAt:e.startAt?new Date((0,i.decodeBase64)(e.startAt)).toISOString():void 0,endAt:e.endAt?new Date((0,i.decodeBase64)(e.endAt)).toISOString():void 0}}function l(e){return{extraLogging:e.extraLogging?u(e.extraLogging):void 0,variationKey:(0,i.decodeBase64)(e.variationKey),shards:e.shards.map(c)}}function c(e){return{...e,salt:(0,i.decodeBase64)(e.salt)}}function u(e){return g(e,(e=>e))}function g(e,t){return Object.fromEntries(Object.entries(e).map((([e,r])=>[(0,i.decodeBase64)(e),t((0,i.decodeBase64)(r))])))}},1684:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){if(this.listeners=[],this.debounceTimer=null,"undefined"==typeof window)throw new Error("BrowserNetworkStatusListener can only be used in a browser environment");this._isOffline="boolean"==typeof navigator.onLine&&!navigator.onLine,window.addEventListener("offline",(()=>this.notifyListeners(!0))),window.addEventListener("online",(()=>this.notifyListeners(!1)))}isOffline(){return this._isOffline}onNetworkStatusChange(e){this.listeners.push(e)}removeNetworkStatusChange(e){const t=this.listeners.indexOf(e);-1!==t&&this.listeners.splice(t,1)}notifyListeners(e){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>{this._isOffline=e,[...this.listeners].forEach((t=>t(e)))}),200)}}},1721:(e,t,r)=>{var n=r(5606);const i="object"==typeof n&&n.env&&n.env.NODE_DEBUG&&/\bsemver\b/i.test(n.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=i},1726:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LocalStorageAssignmentCache=void 0;const n=r(2975),i=r(135);class s extends n.AbstractAssignmentCache{constructor(e){super(new i.LocalStorageAssignmentShim(e))}setEntries(e){e.forEach((([e,t])=>{e&&t&&this.delegate.set(e,t)}))}getEntries(){return Promise.resolve(Array.from(this.entries()))}}t.LocalStorageAssignmentCache=s},1797:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(9746);t.default=function(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)}},1902:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TLRUCache=void 0;const n=r(3040);class i extends n.LRUCache{constructor(e,t){super(e),this.maxSize=e,this.ttl=t,this.cacheEntriesTTLRegistry=new Map}getCacheEntryEvictionTime(){return new Date(Date.now()+this.ttl)}clearCacheEntryEvictionTimeIfExists(e){this.cacheEntriesTTLRegistry.has(e)&&this.cacheEntriesTTLRegistry.delete(e)}isCacheEntryValid(e){const t=new Date(Date.now()),r=this.cacheEntriesTTLRegistry.get(e);return void 0!==r&&t<r}setCacheEntryEvictionTime(e){this.cacheEntriesTTLRegistry.set(e,this.getCacheEntryEvictionTime())}resetCacheEntryEvictionTime(e){this.clearCacheEntryEvictionTimeIfExists(e),this.setCacheEntryEvictionTime(e)}evictExpiredCacheEntries(){let e;for(e of this.cache.keys()){if(this.isCacheEntryValid(e))break;this.delete(e)}}entries(){return this.evictExpiredCacheEntries(),super.entries()}keys(){return this.evictExpiredCacheEntries(),super.keys()}values(){return this.evictExpiredCacheEntries(),super.values()}delete(e){return this.clearCacheEntryEvictionTimeIfExists(e),super.delete(e)}has(e){return this.isCacheEntryValid(e)?this.cache.has(e):(this.delete(e),!1)}get(e){if(!this.isCacheEntryValid(e))return void this.delete(e);const t=super.get(e);return void 0!==t&&this.resetCacheEntryEvictionTime(e),t}set(e,t){const r=super.set(e,t);return this.resetCacheEntryEvictionTime(e),r}}t.TLRUCache=i},1948:(e,t,r)=>{const n=r(1112),i=r(2180),s=r(3033),o=r(6330),a=r(7686),l=r(1103);e.exports=(e,t,r,c)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return n(e,r,c);case"!=":return i(e,r,c);case">":return s(e,r,c);case">=":return o(e,r,c);case"<":return a(e,r,c);case"<=":return l(e,r,c);default:throw new TypeError(`Invalid operator: ${t}`)}}},2034:(e,t,r)=>{const n=r(4605);e.exports=(e,t,r)=>{const i=new n(e,r),s=new n(t,r);return i.compare(s)||i.compareBuild(s)}},2091:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StoreBackedConfiguration=void 0;const n=r(3720),i=r(6882);t.StoreBackedConfiguration=class{constructor(e,t,r){this.flagConfigurationStore=e,this.banditVariationConfigurationStore=t,this.banditModelConfigurationStore=r}async hydrateConfigurationStores(e,t,r){const i=await(0,n.hydrateConfigurationStore)(this.flagConfigurationStore,e),s=[];return this.banditVariationConfigurationStore&&t&&s.push((0,n.hydrateConfigurationStore)(this.banditVariationConfigurationStore,t)),this.banditModelConfigurationStore&&r&&s.push((0,n.hydrateConfigurationStore)(this.banditModelConfigurationStore,r)),await Promise.all(s),i}getBandit(e){return this.banditModelConfigurationStore?.get(e)??null}getFlagVariationBandit(e,t){const r=this.banditVariationConfigurationStore?.get(e),n=r?.find((e=>e.variationValue===t))?.key;return n?this.getBandit(n):null}getFlag(e){return this.flagConfigurationStore.get(e)??null}getFlagConfigDetails(){return{configFetchedAt:this.flagConfigurationStore.getConfigFetchedAt()??"",configPublishedAt:this.flagConfigurationStore.getConfigPublishedAt()??"",configEnvironment:this.flagConfigurationStore.getEnvironment()??{name:""},configFormat:this.flagConfigurationStore.getFormat()??""}}getFlagBanditVariations(e){return this.banditVariationConfigurationStore?.get(e)??[]}getFlagKeys(){return this.flagConfigurationStore.getKeys()}getFlags(){return this.flagConfigurationStore.entries()}isObfuscated(){return i.OBFUSCATED_FORMATS.includes(this.getFlagConfigDetails().configFormat??"SERVER")}isInitialized(){return this.flagConfigurationStore.isInitialized()&&(!this.banditVariationConfigurationStore||this.banditVariationConfigurationStore.isInitialized())&&(!this.banditModelConfigurationStore||this.banditModelConfigurationStore.isInitialized())}getBandits(){return this.banditModelConfigurationStore?.entries()??{}}getBanditVariations(){return this.banditVariationConfigurationStore?.entries()??{}}}},2094:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LRUInMemoryAssignmentCache=void 0;const n=r(7989),i=r(3040);class s extends n.AbstractAssignmentCache{constructor(e){super(new i.LRUCache(e))}}t.LRUInMemoryAssignmentCache=s},2156:(e,t,r)=>{const n=r(1147);e.exports=(e,t)=>{const r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}},2180:(e,t,r)=>{const n=r(9043);e.exports=(e,t,r)=>0!==n(e,t,r)},2196:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default="ffffffff-ffff-ffff-ffff-ffffffffffff"},2291:(e,t)=>{"use strict";let r;Object.defineProperty(t,"__esModule",{value:!0});const n=new Uint8Array(16);t.default=function(){if(!r){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");r=crypto.getRandomValues.bind(crypto)}return r(n)}},2381:(e,t,r)=>{const n=r(1147);e.exports=(e,t)=>{const r=n(e,null,!0),i=n(t,null,!0),s=r.compare(i);if(0===s)return null;const o=s>0,a=o?r:i,l=o?i:r,c=!!a.prerelease.length;if(l.prerelease.length&&!c){if(!l.patch&&!l.minor)return"major";if(0===l.compareMain(a))return l.minor&&!l.patch?"minor":"patch"}const u=c?"pre":"";return r.major!==i.major?u+"major":r.minor!==i.minor?u+"minor":r.patch!==i.patch?u+"patch":"prerelease"}},2415:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2975),i=r(802);t.default=class{constructor(e){this.storage=new i.default(e)}set(e){this.storage.set((0,n.assignmentCacheKeyToString)(e),(0,n.assignmentCacheValueToString)(e))}has(e){throw new Error("This should never be called for ChromeStorageAssignmentCache, use getEntries() instead.")}async getEntries(){const e=await this.storage.entries();return Object.entries(e).map((([e,t])=>[e,t]))}}},2557:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IsolatableHybridConfigurationStore=void 0;const n=r(2975);class i extends n.HybridConfigurationStore{constructor(e,t,r="always"){super(e,t),this.servingStoreUpdateStrategy=r}async setEntries(e){var t;this.persistentStore&&await this.persistentStore.setEntries(e);const r=!this.persistentStore||await this.persistentStore.isExpired(),n=!(null===(t=this.servingStore.getKeys())||void 0===t?void 0:t.length),i="always"===this.servingStoreUpdateStrategy||r&&"expired"===this.servingStoreUpdateStrategy||r&&n;return i&&this.servingStore.setEntries(e),i}}t.IsolatableHybridConfigurationStore=i},2770:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(9746);t.default=function(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}},2787:(e,t,r)=>{const n=r(3708);e.exports=(e,t)=>{try{return new n(e,t).range||"*"}catch(e){return null}}},2802:(e,t,r)=>{const n=r(1147);e.exports=(e,t)=>{const r=n(e,t);return r?r.version:null}},2829:(e,t)=>{"use strict";function r(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function n(e,t){return e<<t|e>>>32-t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520],s=new Uint8Array(e.length+1);s.set(e),s[e.length]=128;const o=(e=s).length/4+2,a=Math.ceil(o/16),l=new Array(a);for(let t=0;t<a;++t){const r=new Uint32Array(16);for(let n=0;n<16;++n)r[n]=e[64*t+4*n]<<24|e[64*t+4*n+1]<<16|e[64*t+4*n+2]<<8|e[64*t+4*n+3];l[t]=r}l[a-1][14]=8*(e.length-1)/Math.pow(2,32),l[a-1][14]=Math.floor(l[a-1][14]),l[a-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<a;++e){const s=new Uint32Array(80);for(let t=0;t<16;++t)s[t]=l[e][t];for(let e=16;e<80;++e)s[e]=n(s[e-3]^s[e-8]^s[e-14]^s[e-16],1);let o=i[0],a=i[1],c=i[2],u=i[3],g=i[4];for(let e=0;e<80;++e){const i=Math.floor(e/20),l=n(o,5)+r(i,a,c,u)+g+t[i]+s[e]>>>0;g=u,u=c,c=n(a,30)>>>0,a=o,o=l}i[0]=i[0]+o>>>0,i[1]=i[1]+a>>>0,i[2]=i[2]+c>>>0,i[3]=i[3]+u>>>0,i[4]=i[4]+g>>>0}return Uint8Array.of(i[0]>>24,i[0]>>16,i[0]>>8,i[0],i[1]>>24,i[1]>>16,i[1]>>8,i[1],i[2]>>24,i[2]>>16,i[2]>>8,i[2],i[3]>>24,i[3]>>16,i[3]>>8,i[3],i[4]>>24,i[4]>>16,i[4]>>8,i[4])}},2975:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildStorageKeySuffix=t.decodePrecomputedFlag=t.DefaultEventDispatcher=t.BatchEventProcessor=t.newDefaultEventDispatcher=t.DEFAULT_EVENT_DISPATCHER_BATCH_SIZE=t.DEFAULT_EVENT_DISPATCHER_CONFIG=t.BoundedEventQueue=t.FormatEnum=t.VariationType=t.assignmentCacheValueToString=t.assignmentCacheKeyToString=t.LRUInMemoryAssignmentCache=t.NonExpiringInMemoryAssignmentCache=t.MemoryOnlyConfigurationStore=t.HybridConfigurationStore=t.MemoryStore=t.EppoPrecomputedClient=t.validation=t.HttpClient=t.FlagConfigRequestor=t.ApiEndpoints=t.constants=t.EppoClient=t.EppoAssignmentLogger=t.AbstractAssignmentCache=t.applicationLogger=t.loggerPrefix=void 0;const n=r(4620);t.ApiEndpoints=n.default;const i=r(4742);Object.defineProperty(t,"applicationLogger",{enumerable:!0,get:function(){return i.logger}}),Object.defineProperty(t,"loggerPrefix",{enumerable:!0,get:function(){return i.loggerPrefix}});const s=r(7989);Object.defineProperty(t,"AbstractAssignmentCache",{enumerable:!0,get:function(){return s.AbstractAssignmentCache}}),Object.defineProperty(t,"assignmentCacheKeyToString",{enumerable:!0,get:function(){return s.assignmentCacheKeyToString}}),Object.defineProperty(t,"assignmentCacheValueToString",{enumerable:!0,get:function(){return s.assignmentCacheValueToString}});const o=r(2094);Object.defineProperty(t,"LRUInMemoryAssignmentCache",{enumerable:!0,get:function(){return o.LRUInMemoryAssignmentCache}});const a=r(9851);Object.defineProperty(t,"NonExpiringInMemoryAssignmentCache",{enumerable:!0,get:function(){return a.NonExpiringInMemoryAssignmentCache}});const l=r(8475);t.EppoClient=l.default;const c=r(3650);t.EppoPrecomputedClient=c.default;const u=r(4224);t.FlagConfigRequestor=u.default;const g=r(653);Object.defineProperty(t,"HybridConfigurationStore",{enumerable:!0,get:function(){return g.HybridConfigurationStore}});const d=r(9864);Object.defineProperty(t,"MemoryStore",{enumerable:!0,get:function(){return d.MemoryStore}}),Object.defineProperty(t,"MemoryOnlyConfigurationStore",{enumerable:!0,get:function(){return d.MemoryOnlyConfigurationStore}});const h=r(6882);t.constants=h;const f=r(1650);Object.defineProperty(t,"decodePrecomputedFlag",{enumerable:!0,get:function(){return f.decodePrecomputedFlag}});const p=r(9182);Object.defineProperty(t,"EppoAssignmentLogger",{enumerable:!0,get:function(){return p.EppoAssignmentLogger}});const m=r(1565);t.BatchEventProcessor=m.default;const E=r(6615);Object.defineProperty(t,"BoundedEventQueue",{enumerable:!0,get:function(){return E.BoundedEventQueue}});const y=r(5299);t.DefaultEventDispatcher=y.default,Object.defineProperty(t,"DEFAULT_EVENT_DISPATCHER_CONFIG",{enumerable:!0,get:function(){return y.DEFAULT_EVENT_DISPATCHER_CONFIG}}),Object.defineProperty(t,"DEFAULT_EVENT_DISPATCHER_BATCH_SIZE",{enumerable:!0,get:function(){return y.DEFAULT_EVENT_DISPATCHER_BATCH_SIZE}}),Object.defineProperty(t,"newDefaultEventDispatcher",{enumerable:!0,get:function(){return y.newDefaultEventDispatcher}});const v=r(7059);t.HttpClient=v.default;const b=r(4619);Object.defineProperty(t,"VariationType",{enumerable:!0,get:function(){return b.VariationType}}),Object.defineProperty(t,"FormatEnum",{enumerable:!0,get:function(){return b.FormatEnum}});const S=r(6092);Object.defineProperty(t,"buildStorageKeySuffix",{enumerable:!0,get:function(){return S.buildStorageKeySuffix}});const A=r(4388);t.validation=A},2988:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=t.stringToBytes=void 0;const n=r(1797),i=r(6011);function s(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}t.stringToBytes=s,t.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",t.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",t.default=function(e,t,r,o,a,l){const c="string"==typeof r?s(r):r,u="string"==typeof o?(0,n.default)(o):o;if("string"==typeof o&&(o=(0,n.default)(o)),16!==o?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let g=new Uint8Array(16+c.length);if(g.set(u),g.set(c,u.length),g=t(g),g[6]=15&g[6]|e,g[8]=63&g[8]|128,a){l=l||0;for(let e=0;e<16;++e)a[l+e]=g[e];return a}return(0,i.unsafeStringify)(g)}},3033:(e,t,r)=>{const n=r(9043);e.exports=(e,t,r)=>n(e,t,r)>0},3040:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LRUCache=void 0;class r{constructor(e){this.capacity=e,this.cache=new Map,this.size=this.cache.size}[(Symbol.toStringTag,Symbol.iterator)](){return this.cache[Symbol.iterator]()}forEach(e,t){this.cache.forEach(e,t)}entries(){return this.cache.entries()}clear(){this.cache.clear()}delete(e){return this.cache.delete(e)}keys(){return this.cache.keys()}values(){return this.cache.values()}has(e){return this.cache.has(e)}get(e){if(!this.has(e))return;const t=this.cache.get(e);return void 0!==t&&(this.delete(e),this.cache.set(e,t)),t}set(e,t){if(0===this.capacity)return this;if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){const e=this.cache.keys().next().value;e&&this.delete(e)}return this.cache.set(e,t),this}}t.LRUCache=r},3142:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sdkName=t.sdkVersion=void 0;const n=r(299);t.sdkVersion=n.version,t.sdkName="js-client-sdk"},3454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(4742);t.default=class{constructor(e,t){this.sdkKey=e,this.ingestionUrl=t}async deliver(e,t){try{n.logger.info(`[EventDispatcher] Delivering batch of ${e.length} events to ${this.ingestionUrl}...`);const r=await fetch(this.ingestionUrl,{method:"POST",headers:{"Content-Type":"application/json","x-eppo-token":this.sdkKey},body:JSON.stringify({eppo_events:e,context:t})});return r.ok?await this.parseFailedEvents(r,e):{failedEvents:e}}catch(t){return n.logger.warn("Failed to upload event batch",t),{failedEvents:e}}}async parseFailedEvents(e,t){n.logger.info("[EventDispatcher] Batch delivered successfully.");const r=await e.json(),i=new Set(r?.failed_events||[]);return i.size>0?(n.logger.warn(`[EventDispatcher] ${i.size}/${t.length} events failed ingestion.`),{failedEvents:t.filter((({uui