statsig-js-lite
Advanced tools
Comparing version 1.0.0-beta.2 to 1.0.0-beta.4
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.statsig=n():t.statsig=n()}(this,()=>(()=>{"use strict";var e={825:(t,n)=>{function i(t,n,i,e,r,u,o){void 0===r&&(r=[]),void 0===u&&(u=""),void 0===o&&(o=null),this.t=null,this.value=JSON.parse(JSON.stringify(null!=n?n:{})),this.i=t,this.u=null!=i?i:"",this.o=r,this.h=u,this.l=e,this.t=o}Object.defineProperty(n,"v",{value:!0}),i.prototype.get=function(t,n,i){var e=this.getValue(t,n);if(null!=e){var r=Array.isArray(n)?"array":typeof n,u=Array.isArray(e)?"array":typeof e;if(i)return i(e)?e:(null!=(i=this.t)&&i.call(this,this,t,r,u),n);if(null==n||r==u)return e;null!=(i=this.t)&&i.call(this,this,t,r,u)}return n},i.prototype.getValue=function(t,n){return null==t?this.value:(null==n&&(n=null),null==this.value[t]?n:this.value[t])},n.default=i},742:function(t,f,n){var i=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(i,n){function e(t){try{u(c.next(t))}catch(t){n(t)}}function r(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?i(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(e,r)}u((c=c.apply(t,o||[])).next())})},h=this&&this.__generator||function(e,r){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(u)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},r=(Object.defineProperty(f,"v",{value:!0}),f.ExceptionEndpoint=void 0,n(187)),n=(f.ExceptionEndpoint="https://statsigapi.net/v1/sdk_exception",e.prototype.p=function(t){this.m=t},e.prototype.g=function(t,n){this.S(t,n,function(){})},e.prototype.S=function(n,t,i,e){var r=this;try{var u=t();return u instanceof Promise?u.catch(function(t){return r._(n,t,i,e)}):u}catch(t){return this._(n,t,i,e)}},e.prototype.O=function(o,s,c){var t=this;try{i(t,void 0,void 0,function(){var n,i,e,r,u;return h(this,function(t){switch(t.label){case 0:return"function"!=typeof c?[3,2]:[4,c()];case 1:return i=t.sent(),[3,3];case 2:i=null,t.label=3;case 3:return(n=i,u=null!=s?s:Error("[Statsig] Error was empty"),e=u instanceof Error,r=e?u.name:"No Name",this.T.has(r))?[2]:(this.T.add(r),e=e?u.stack:this.j(u),u=null!=(u=this.m)?u:{},r=JSON.stringify({tag:o,exception:r,info:e,statsigMetadata:u,extra:null!=n?n:{}}),[2,fetch(f.ExceptionEndpoint,{method:"POST",headers:{"STATSIG-API-KEY":this.N,"STATSIG-SDK-TYPE":String(u.sdkType),"STATSIG-SDK-VERSION":String(u.sdkVersion),"Content-Type":"application/json","Content-Length":"".concat(r.length)},body:r})])}})}).then(function(){}).catch(function(){})}catch(t){}},e.prototype._=function(t,n,i,e){if(n instanceof r.StatsigUninitializedError||n instanceof r.StatsigInvalidArgumentError)throw n;return console.error("[Statsig] An unexpected exception occurred.",n),this.O(t,n,e),i()},e.prototype.j=function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}},e);function e(t){this.T=new Set,this.N=t}f.default=n},187:function(t,n){var e,i,r=this&&this.__extends||(e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}))(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}),u=(Object.defineProperty(n,"v",{value:!0}),n.StatsigInvalidArgumentError=n.StatsigUninitializedError=void 0,i=Error,r(o,i),o);function o(t){t=i.call(this,null!=t?t:"Call and wait for initialize() to finish first.")||this;return Object.setPrototypeOf(t,o.prototype),t}n.StatsigUninitializedError=u;s=Error,r(c,s);var s,u=c;function c(t){t=s.call(this,t)||this;return Object.setPrototypeOf(t,c.prototype),t}n.StatsigInvalidArgumentError=u},857:(t,n)=>{function f(t,n,i,e,r,u,o,s,c){void 0===u&&(u=[]),void 0===o&&(o=[]),void 0===s&&(s=""),void 0===c&&(c=[]),this.I=r=void 0===r?null:r,this.i=t,this.M=JSON.parse(JSON.stringify(null!=n?n:{})),this.u=null!=i?i:"",this.l=e,this.o=u,this.P=o,this.h=s,this.D=c}Object.defineProperty(n,"v",{value:!0}),f.A=function(t,n,i,e,r,u,o,s,c){return new f(t,n,i,e,r=void 0===r?null:r,u=void 0===u?[]:u,o=void 0===o?[]:o,s=void 0===s?"":s,c=void 0===c?[]:c)},f.prototype.get=function(t,n,i){var e,r=this,u=this.M[t];return null==u?n:(e=function(){return r.G(t),u},i?i(u)?e():n:null==n||typeof u==typeof n&&Array.isArray(n)===Array.isArray(u)?e():n)},f.prototype.getValue=function(t,n){null==n&&(n=null);var i=this.M[t];return null!=i&&this.G(t),null!=i?i:n},f.prototype.G=function(t){var n;null!=(n=this.I)&&n.call(this,this,t)},n.default=f},820:function(t,n){var s=this&&this.__assign||function(){return(s=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)};Object.defineProperty(n,"v",{value:!0}),n.default=function(t,n,i,e,r,u){void 0===e&&(e=null),void 0===r&&(r=null);var o=n;return null!=o&&o.privateAttributes&&delete(o=s({},n)).privateAttributes,{time:Date.now(),eventName:t,statsigMetadata:i,user:o,value:e,metadata:r,secondaryExposures:u}}},888:(t,n)=>{Object.defineProperty(n,"v",{value:!0}),n.version=void 0,n.version="1.0.0-beta.2"},793:function(t,n,i){var e=this&&this.__assign||function(){return(e=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},r=this&&this.__createBinding||(Object.create?function(t,n,i,e){void 0===e&&(e=i);var r=Object.getOwnPropertyDescriptor(n,i);r&&("get"in r?n.v:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(t,e,r)}:function(t,n,i,e){t[e=void 0===e?i:e]=n[i]}),u=this&&this.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),o=this&&this.__importStar||function(t){if(t&&t.v)return t;var n={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&r(n,t,i);return u(n,t),n},s=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(i,n){function e(t){try{u(c.next(t))}catch(t){n(t)}}function r(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?i(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(e,r)}u((c=c.apply(t,o||[])).next())})},c=this&&this.__generator||function(e,r){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(u)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},f=this&&this.__importDefault||function(t){return t&&t.v?t:{default:t}},h=(Object.defineProperty(n,"v",{value:!0}),f(i(825))),a=f(i(742)),l=i(187),v=f(i(857)),d=f(i(578)),y=f(i(332)),w=f(i(69)),p=f(i(574)),m=o(i(567)),b=f(i(682)),g=i(28),S=f(i(820));function _(t,n,i){var o=this;if(this.k=!1,this.J=null,this.C=function(t,n,i){void 0===i&&(i=!1);var e="",r=t.P,u=t.D.includes(n);u&&(e=t.h,r=t.o),o.R.logLayerExposure(o.L.K,t.i,t.u,r,e,n,u,t.l,i)},!0!==(null==i?void 0:i.localMode)&&("string"!=typeof t||!t.startsWith("client-")))throw new l.StatsigInvalidArgumentError("Invalid key provided. You must use a Client SDK Key from the Statsig console to initialize the sdk");this.q=(0,g.now)(),this.V=new a.default(t),this.Y=!1,this.U=new p.default(i),b.default.disabled=this.U.disableLocalStorage,this.L=new d.default(t,this.B(null!=n?n:null),this.U.overrideStableID),this.F=new w.default(this.U,this.L,this.V),this.R=new y.default(this.U,this.L,this.F,this.V),this.W=new m.default(this.L,this.R.logConfigDefaultValueFallback,this.U.initializeValues),this.V.p(this.L.m),null!=this.U.initializeValues&&(this.Y=!0,this.k=!0,setTimeout(function(){return o.H()},20))}_.prototype.setInitializeValues=function(t){var n=this;this.V.S("setInitializeValues",function(){n.W.bootstrap(t),n.Y||(n.Y=!0,n.k=!0),n.R.sendSavedRequests()},function(){n.Y=!0,n.k=!0})},_.prototype.initializeAsync=function(){return s(this,void 0,void 0,function(){var n=this;return c(this,function(t){return[2,this.V.S("initializeAsync",function(){return s(n,void 0,void 0,function(){var n,i=this;return c(this,function(t){if(null==this.J){if(this.Y)return[2,Promise.resolve()];if(this.k=!0,this.U.localMode)return[2,Promise.resolve()];n=this.L.K,this.J=this.X(n,this.U.initTimeoutMs).then(function(){}).catch(function(t){return i.V.O("initializeAsync:fetchAndSaveValues",t),{success:!1,message:t.message}}).then(function(){}).finally(function(){return s(i,void 0,void 0,function(){return c(this,function(t){return this.J=null,this.Y=!0,this.H(),[2]})})})}return[2,this.J]})})},function(){return n.Y=!0,n.k=!0,Promise.resolve()})]})})},_.prototype.getEvaluationDetails=function(){var t=this;return this.V.S("getEvaluationDetails",function(){return t.W.getGlobalEvaluationDetails()},function(){return{time:Date.now(),reason:m.EvaluationReason.Error}})},_.prototype.checkGate=function(n){var i=this;return this.V.S("checkGate",function(){var t=i.Z(n);return i.$(n,t),!0===t.gate.value},function(){return!1})},_.prototype.getConfig=function(n){var i=this;return this.V.S("getConfig",function(){var t=i.tt(n);return i.nt(n,t),t},function(){return i.it(n)})},_.prototype.getExperiment=function(t){return this.getConfig(t)},_.prototype.getLayer=function(t){var n=this;return this.V.S("getLayer",function(){return n.et(n.C,t)},function(){return v.default.A(t,{},"",n.rt())})},_.prototype.logEvent=function(n,i,e){var r=this;void 0===i&&(i=null),void 0===e&&(e=null),this.V.g("logEvent",function(){if(!r.R||!r.L.N)throw new l.StatsigUninitializedError("Must initialize() before logging events.");var t;"string"==typeof n&&0!==n.length&&(t=(0,S.default)(n,r.L.K,r.L.m,i,e),r.R.log(t))})},_.prototype.updateUser=function(e){return s(this,void 0,void 0,function(){var n=this;return c(this,function(t){return[2,this.V.S("updateUser",function(){return s(n,void 0,void 0,function(){var n,i=this;return c(this,function(t){switch(t.label){case 0:if(this.initializeCalled())return this.L.K=this.B(e),this.W.updateUser(),this.R.resetDedupeKeys(),null==this.J?[3,2]:[4,this.J];throw new l.StatsigUninitializedError("Call initialize() first.");case 1:t.sent(),t.label=2;case 2:return this.U.localMode?[2,Promise.resolve(!0)]:(n=this.L.K,this.J=this.X(n).finally(function(){i.J=null}),[2,this.J.then(function(){return Promise.resolve(!0)}).catch(function(t){return Promise.resolve(!1)})])}})})},function(){return Promise.resolve(!1)})]})})},_.prototype.shutdown=function(){var t=this;this.V.g("shutdown",function(){t.R.shutdown()})},_.prototype.getStableID=function(){var t=this;return this.V.S("getStableID",function(){return t.L.m.stableID},function(){return""})},_.prototype.initializeCalled=function(){return this.k},_.prototype.H=function(){var t=this;this.V.g("delayedSetup",function(){t.L.saveStableID(),t.R.sendSavedRequests().then(function(){})})},_.prototype.B=function(t){var n={};try{n=JSON.parse(JSON.stringify(t))}catch(t){throw new l.StatsigInvalidArgumentError("User object must be convertable to JSON string.")}return n=null!=this.U.environment?e(e({},n),{statsigEnvironment:this.U.environment}):n},_.prototype.ut=function(){if(!this.W.isLoaded())throw new l.StatsigUninitializedError("Call and wait for initialize() to finish first.")},_.prototype.rt=function(){return{time:Date.now(),reason:m.EvaluationReason.Error}},_.prototype.X=function(r,i){return void 0===i&&(i=this.U.initTimeoutMs),s(this,void 0,void 0,function(){var n,e=this;return c(this,function(t){return n=this.W.getLastUpdateTime(r),[2,this.F.fetchValues(r,n,i).eventually(function(t){null!=t&&t.has_updates&&e.W.save(r,t,!1)}).then(function(i){return s(e,void 0,void 0,function(){var n=this;return c(this,function(t){return[2,this.V.g("fetchAndSaveValues",function(){return s(n,void 0,void 0,function(){return c(this,function(t){switch(t.label){case 0:return null!=i&&i.has_updates?[4,this.W.save(r,i)]:[3,2];case 1:return t.sent(),[3,3];case 2:null!=i&&i.is_no_content&&this.W.setEvaluationReason(m.EvaluationReason.NetworkNotModified),t.label=3;case 3:return[2]}})})})]})})})]})})},_.prototype.Z=function(t){if(this.ut(),"string"!=typeof t||0===t.length)throw new l.StatsigInvalidArgumentError("Must pass a valid string as the gateName.");return this.W.checkGate(t)},_.prototype.$=function(t,n){var i=!n,n=null!=n?n:this.Z(t),e=n.gate;this.R.logGateExposure(this.L.K,t,e.value,e.rule_id,e.secondary_exposures,n.evaluationDetails,i)},_.prototype.tt=function(t){if(this.ut(),"string"!=typeof t||0===t.length)throw new l.StatsigInvalidArgumentError("Must pass a valid string as the configName.");return this.W.getConfig(t)},_.prototype.nt=function(t,n){var i=!n,n=null!=n?n:this.tt(t);this.R.logConfigExposure(this.L.K,t,n.u,n.o,n.l,i)},_.prototype.et=function(t,n){if(this.ut(),"string"!=typeof n||0===n.length)throw new l.StatsigInvalidArgumentError("Must pass a valid string as the layerName.");return this.W.getLayer(t,n)},_.prototype.it=function(t){return new h.default(t,{},"",this.rt())},n.default=_},578:function(t,n,i){var e=this&&this.__importDefault||function(t){return t&&t.v?t:{default:t}},r=(Object.defineProperty(n,"v",{value:!0}),i(652)),u=i(898),o=e(i(682)),s=i(888);function c(t,n,i){this.ot="js-lite",this.N=t,this.K=n,this.st=s.version;t=null!=(n=null!=(t=i)?t:o.default.getItem(r.STATSIG_STABLE_ID_KEY))?n:this.ct();this.m={stableID:t,sdkType:this.ot,sdkVersion:this.st}}c.prototype.saveStableID=function(){null!=this.m.stableID&&o.default.setItem(r.STATSIG_STABLE_ID_KEY,this.m.stableID)},c.prototype.getUserCacheKey=function(){return(0,u.getUserCacheKey)(this.K)},c.prototype.ct=function(){for(var t="",n=0;n<32;n++){8!==n&&12!==n&&16!==n&&20!==n||(t+="-");var i=16*Math.random()|0;t+=12===n?"4":(16===n?3&i|8:i).toString(16)}return t},n.default=c},332:function(t,n,i){var u=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(i,n){function e(t){try{u(c.next(t))}catch(t){n(t)}}function r(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?i(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(e,r)}u((c=c.apply(t,o||[])).next())})},h=this&&this.__generator||function(e,r){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(u)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},e=this&&this.__importDefault||function(t){return t&&t.v?t:{default:t}},a=(Object.defineProperty(n,"v",{value:!0}),e(i(820))),l=i(69),v=i(652),d=e(i(682)),e="statsig::",o=e+"log_event_failed";function r(t,n,i,e){var r=this;this.ft=0,this.logConfigDefaultValueFallback=function(t,n,i){t=(0,a.default)("statsig::default_value_type_mismatch",t,r.L.m,n,i);r.log(t),r.ht.add(n)},this.U=t,this.L=n,this.F=i,this.V=e,this.lt=[],this.vt=null,this.ht=new Set,this.dt=[],this.yt={},this.ft=0,this.wt()}r.prototype.log=function(t){try{var n;this.U.disableCurrentPageLogging||"undefined"==typeof window||null==window||"object"!=typeof window.location||"string"!=typeof window.location.href||0<(null==(n=window.location.href.split(/[?#]/))?void 0:n.length)&&(t.statsigMetadata.currentPage=n[0])}catch(t){}this.lt.push(t),this.lt.length>=this.U.loggingBufferMaxSize&&this.flush()},r.prototype.resetDedupeKeys=function(){this.yt={}},r.prototype.logGateExposure=function(t,n,i,e,r,u,o){var s=n+String(i)+e+u.reason;this.bt(s)&&(s={gate:n,gateValue:String(i),ruleID:e,reason:u.reason,time:u.time},o&&(s.isManualExposure="true"),n=(0,a.default)("statsig::gate_exposure",t,this.L.m,null,s,r),this.log(n))},r.prototype.logConfigExposure=function(t,n,i,e,r,u){var o=n+i+r.reason;this.bt(o)&&(o={config:n,ruleID:i,reason:r.reason,time:r.time},u&&(o.isManualExposure="true"),n=(0,a.default)("statsig::config_exposure",t,this.L.m,null,o,e),this.log(n))},r.prototype.logLayerExposure=function(t,n,i,e,r,u,o,s,c){var f=[n,i,r,u,String(o),s.reason].join("|");this.bt(f)&&(f={config:n,ruleID:i,allocatedExperiment:r,parameterName:u,isExplicitParameter:String(o),reason:s.reason,time:s.time},c&&(f.isManualExposure="true"),n=(0,a.default)("statsig::layer_exposure",t,this.L.m,null,f,e),this.log(n))},r.prototype.shutdown=function(){this.vt&&(clearInterval(this.vt),this.vt=null),this.flush(!0)},r.prototype.flush=function(n){var i,e,r,t=this;void 0===n&&(n=!1),0!==this.lt.length&&(i=this.L.m,e=this.lt,this.lt=[],n&&!this.F.supportsKeepalive()&&"undefined"!=typeof navigator&&null!=navigator&&navigator.sendBeacon?this.F.sendLogBeacon({events:e,statsigMetadata:i})||(this.lt=e.concat(this.lt),0<this.lt.length&&(this.gt({events:this.lt,statsigMetadata:i,time:Date.now()}),this.lt=[]),this.St()):(r=this).F.postToEndpoint(l.StatsigEndpoint.Rgstr,{events:e,statsigMetadata:i},3,1e3,n).then(function(t){if(!t.ok)throw t}).catch(function(i){"function"==typeof i.text?i.text().then(function(n){t.V.O(o,i,function(){return u(t,void 0,void 0,function(){return h(this,function(t){return[2,{eventCount:e.length,error:n}]})})})}):t.V.O(o,i,function(){return u(t,void 0,void 0,function(){return h(this,function(t){return[2,{eventCount:e.length,error:i.message}]})})}),r._t(o,e)}).finally(function(){return u(t,void 0,void 0,function(){return h(this,function(t){switch(t.label){case 0:return n?(0<this.lt.length&&(this.gt({events:this.lt,statsigMetadata:i,time:Date.now()}),this.lt=[]),[4,r.St()]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})}))},r.prototype.sendSavedRequests=function(){return u(this,void 0,void 0,function(){var n,i,e,r,u,o,s,c,f=this;return h(this,function(t){if(i=!1,null==(n=d.default.getItem(v.STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY)))this.Ot();else{1024e3<n.length&&(i=!0),0;try{for(e=JSON.parse(n),r=function(n){null!=n&&n.events&&Array.isArray(n.events)&&u.F.postToEndpoint(l.StatsigEndpoint.Rgstr,n).then(function(t){if(!t.ok)throw Error(t.status+"")}).catch(function(t){i||f.gt(n)})},u=this,o=0,s=e;o<s.length;o++)c=s[o],r(c)}catch(t){}finally{this.Ot()}}return[2]})})},r.prototype.wt=function(){var t,n=this;"undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("blur",function(){return n.flush(!0)}),window.addEventListener("beforeunload",function(){return n.flush(!0)}),window.addEventListener("load",function(){setTimeout(function(){return n.flush()},100),setTimeout(function(){return n.flush()},1e3)})),"undefined"!=typeof document&&"function"==typeof document.addEventListener&&document.addEventListener("visibilitychange",function(){n.flush("visible"!==document.visibilityState)}),(this.U.ignoreWindowUndefined||"undefined"!=typeof window&&null!=window)&&!this.U.localMode&&((t=this).vt=setInterval(function(){t.flush()},this.U.loggingIntervalMillis),setTimeout(function(){return n.flush()},100),setTimeout(function(){return n.flush()},1e3))},r.prototype.bt=function(t){var n=this.yt[t],i=Date.now();if(null!=n&&i-6e5<=n)return!1;return this.yt[t]=i,!0},r.prototype.St=function(){return u(this,void 0,void 0,function(){var n;return h(this,function(t){if(0<this.dt.length){if(1024e3<(n=JSON.stringify(this.dt)).length)return this.Ot(),[2];d.default.setItem(v.STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY,n)}return[2]})})},r.prototype.gt=function(t){var n;t.time<Date.now()-432e6||100<this.dt.length||(n=t.events.length,1e3<this.ft+n)||(this.dt.push(t),this.ft+=n)},r.prototype.Ot=function(){d.default.removeItem(v.STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY)},r.prototype._t=function(t,n){this.ht.has(t)||(this.ht.add(t),this.dt.push({events:n,statsigMetadata:this.L.m,time:Date.now()}),this.St().then(function(){}))},n.default=r},69:function(t,n){var h,i,l=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(i,n){function e(t){try{u(c.next(t))}catch(t){n(t)}}function r(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?i(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(e,r)}u((c=c.apply(t,o||[])).next())})},v=this&&this.__generator||function(e,r){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(u)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}};Object.defineProperty(n,"v",{value:!0}),n.StatsigEndpoint=void 0,(i=h=n.StatsigEndpoint||(n.StatsigEndpoint={})).Initialize="initialize",i.Rgstr="rgstr",i.LogEventBeacon="log_event_beacon";function e(t,n,i){this.retryCodes={408:!0,500:!0,502:!0,503:!0,504:!0,522:!0,524:!0,599:!0},this.canUseKeepalive=!1,this.U=t,this.L=n,this.V=i,this.leakyBucket={},this.wt()}e.prototype.fetchValues=function(t,n,i){t={user:t,statsigMetadata:this.L.m,sinceTime:null!=n?n:void 0,hash:"djb2"};return this.Tt(h.Initialize,t,i,3)},e.prototype.sendLogBeacon=function(t){if(this.U.localMode)return!0;var n=new URL(this.U.eventLoggingApi+h.LogEventBeacon),i=(n.searchParams.append("k",this.L.N),t.clientTime=Date.now()+"",null);try{i=JSON.stringify(t)}catch(t){return!1}return navigator.sendBeacon(n.toString(),i)},e.prototype.postToEndpoint=function(u,o,s,c,f){return void 0===s&&(s=0),void 0===c&&(c=1e3),void 0===f&&(f=!1),l(this,void 0,void 0,function(){var i,n,e,r=this;return v(this,function(t){return this.U.localMode?[2,Promise.reject("no network requests in localMode")]:"function"!=typeof fetch?[2,Promise.reject("fetch is not defined")]:"undefined"!=typeof window||this.U.ignoreWindowUndefined?(e=[h.Initialize].includes(u)?this.U.api:this.U.eventLoggingApi,i=e+u,null!=(e=this.leakyBucket[i])&&30<=e?[2,Promise.reject(new Error("Request failed because you are making the same request too frequently."))]:(this.leakyBucket[i]=null==e?1:e+1,e=JSON.stringify(o),n=this.L.m,e={method:"POST",body:e,headers:{"Content-type":"application/json; charset=UTF-8","STATSIG-API-KEY":this.L.N,"STATSIG-CLIENT-TIME":Date.now()+"","STATSIG-SDK-TYPE":n.sdkType,"STATSIG-SDK-VERSION":n.sdkVersion}},this.canUseKeepalive&&f&&(e.keepalive=!0),[2,fetch(i,e).then(function(e){return l(r,void 0,void 0,function(){var n,i;return v(this,function(t){switch(t.label){case 0:return e.ok?204!==(n=e).status?[3,1]:(n.data={has_updates:!1,is_no_content:!0},[3,3]):[3,4];case 1:return[4,e.text()];case 2:i=t.sent(),n.data=JSON.parse(i),t.label=3;case 3:return[2,Promise.resolve(n)];case 4:return this.retryCodes[e.status]||(s=0),[4,e.text()];case 5:return i=t.sent(),[2,Promise.reject(new Error("".concat(e.status,": ").concat(i)))]}})})}).catch(function(t){return 0<s?new Promise(function(t,n){setTimeout(function(){r.leakyBucket[i]=Math.max(r.leakyBucket[i]-1,0),r.postToEndpoint(u,o,s-1,2*c,f).then(t).catch(n)},c)}):Promise.reject(t)}).finally(function(){r.leakyBucket[i]=Math.max(r.leakyBucket[i]-1,0)})])):[2,Promise.reject("window is not defined")]})})},e.prototype.supportsKeepalive=function(){return this.canUseKeepalive},e.prototype.wt=function(){if(!this.U.disableNetworkKeepalive)try{this.canUseKeepalive="keepalive"in new Request("")}catch(t){}},e.prototype.Tt=function(e,r,i,u,o){var n,s=this,c=(void 0===u&&(u=0),void 0===o&&(o=1e3),!1),t=null,f=null,h=[],a=(0!=(i=void 0===i?0:i)&&(t=new Promise(function(t,n){setTimeout(function(){c=!0,n(new Error("The initialization timeout of ".concat(i,"ms has been hit before the network request has completed.")))},i)})),this.postToEndpoint(e,r,u,o).then(function(n){var t,i;return n.ok?"object"!=typeof n.data?(t=new Error("Request to ".concat(e," received invalid response type. Expected 'object' but got '").concat(typeof n.data,"'")),s.V.O("postWithTimeoutInvalidRes",t,function(){return l(s,void 0,void 0,function(){return v(this,function(t){return[2,this.jt(e,r,u,o,n)]})})}),Promise.reject(t)):(i=n.data,s.V.S("postWithTimeout",function(){return l(s,void 0,void 0,function(){return v(this,function(t){return f=i,c&&(h.forEach(function(t){return t(i)}),h=[]),[2,Promise.resolve(i)]})})},function(){return Promise.resolve({})},function(){return l(s,void 0,void 0,function(){return v(this,function(t){return[2,this.jt(e,r,u,o,n)]})})})):Promise.reject(new Error("Request to ".concat(e," failed with status ").concat(n.status)))}).catch(function(t){return Promise.reject(t)})),t=t?Promise.race([a,t]):a;return t.eventually=(n=t,function(t){return c&&f?t(f):h.push(t),n}),t},e.prototype.jt=function(n,e,r,u,o){var s;return l(this,void 0,void 0,function(){var i;return v(this,function(t){try{return i={},(null!=(s=o.headers)?s:[]).forEach(function(t,n){i[n]=t}),[2,{responseInfo:{headers:i,status:o.status,statusText:o.statusText,type:o.type,url:o.url,redirected:o.redirected,bodySnippet:o.data?JSON.stringify(o.data).slice(0,500):null},requestInfo:{endpointName:n,bodySnippet:JSON.stringify(e).slice(0,500),retries:r,backoff:u}}]}catch(t){return[2,{statusText:"statsig::failed to extract extra data"}]}return[2]})})},n.default=e},574:(t,i)=>{Object.defineProperty(i,"v",{value:!0}),i.INIT_TIMEOUT_DEFAULT_MS=void 0;i.INIT_TIMEOUT_DEFAULT_MS=3e3,e.prototype.normalizeNumberInput=function(t,n){return null==t?n.default:Math.max(Math.min(t,n.max),n.min)};var n=e;function e(t){var n=null!=(n=(t=null==t?{}:t).api)?n:"https://featuregates.org/v1/",n=(this.api=n.endsWith("/")?n:n+"/",this.disableCurrentPageLogging=null!=(n=t.disableCurrentPageLogging)&&n,this.environment=null!=(n=t.environment)?n:null,this.loggingIntervalMillis=this.normalizeNumberInput(t.loggingIntervalMillis,{default:1e4,min:1e3,max:6e4}),this.loggingBufferMaxSize=this.normalizeNumberInput(t.loggingBufferMaxSize,{default:100,min:2,max:500}),this.disableNetworkKeepalive=null!=(n=t.disableNetworkKeepalive)&&n,this.overrideStableID=null!=(n=t.overrideStableID)?n:null,this.localMode=null!=(n=t.localMode)&&n,this.initTimeoutMs=t.initTimeoutMs&&0<=t.initTimeoutMs?t.initTimeoutMs:i.INIT_TIMEOUT_DEFAULT_MS,this.disableErrorLogging=null!=(n=t.disableErrorLogging)&&n,this.disableAutoMetricsLogging=null!=(n=t.disableAutoMetricsLogging)&&n,this.initializeValues=null!=(n=t.initializeValues)?n:null,null!=(n=null!=(n=t.eventLoggingApi)?n:t.api)?n:"https://events.statsigapi.net/v1/");this.eventLoggingApi=n.endsWith("/")?n:n+"/",this.disableLocalStorage=null!=(n=t.disableLocalStorage)&&n,this.ignoreWindowUndefined=null!=(n=null==t?void 0:t.ignoreWindowUndefined)&&n}i.default=n},567:function(t,n,i){var o,s=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(i,n){function e(t){try{u(c.next(t))}catch(t){n(t)}}function r(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?i(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(e,r)}u((c=c.apply(t,o||[])).next())})},c=this&&this.__generator||function(e,r){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(u)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},e=this&&this.__importDefault||function(t){return t&&t.v?t:{default:t}},r=(Object.defineProperty(n,"v",{value:!0}),n.EvaluationReason=void 0,e(i(825))),u=e(i(857)),f=e(i(477)),h=i(652),a=i(898),l=e(i(682));(e=o=n.EvaluationReason||(n.EvaluationReason={})).Network="Network",e.Bootstrap="Bootstrap",e.InvalidBootstrap="InvalidBootstrap",e.Cache="Cache",e.Unrecognized="Unrecognized",e.Uninitialized="Uninitialized",e.Error="Error",e.NetworkNotModified="NetworkNotModified";function v(t,n,i){this.L=t,this.t=n,this.Et=this.L.getUserCacheKey(),this.Nt={},this.It=this.Mt(),this.Pt=!1,this.xt=o.Uninitialized,i?this.bootstrap(i):this.Dt()}v.prototype.updateUser=function(){return this.Et=this.L.getUserCacheKey(),this.At()},v.prototype.bootstrap=function(t){var n,i,e,r=this.L.getUserCacheKey(),u=this.L.K,u=f.default.isValid(u,t)?o.Bootstrap:o.InvalidBootstrap;this.Pt=!0;try{this.It.feature_gates=null!=(n=t.feature_gates)?n:{},this.It.dynamic_configs=null!=(i=t.dynamic_configs)?i:{},this.It.layer_configs=null!=(e=t.layer_configs)?e:{},this.It.evaluation_time=Date.now(),this.It.time=Date.now(),this.Nt[r]=this.It,this.xt=u}catch(t){}},v.prototype.isLoaded=function(){return this.Pt},v.prototype.getLastUpdateTime=function(t){t=(0,a.getHashValue)(JSON.stringify(t));return this.It.user_hash==t?this.It.time:null},v.prototype.setEvaluationReason=function(t){this.xt=t},v.prototype.save=function(e,r,u){return void 0===u&&(u=!0),s(this,void 0,void 0,function(){var n,i;return c(this,function(t){switch(t.label){case 0:return i=(0,a.getUserCacheKey)(e),this.Gt(r,this.Nt,i,e,function(t){return t}),u&&(n=this.Nt[i])&&i&&i==this.Et&&(this.It=n,this.xt=o.Network),[4,(i=this).kt(this.Nt)];case 1:return i.Nt=t.sent(),[2]}})})},v.prototype.checkGate=function(t){var n=(0,a.getHashValue)(t),t={name:t,value:!1,rule_id:"",secondary_exposures:[]},i=null==(i=this.It)?void 0:i.feature_gates[n];return i&&(t=i),{evaluationDetails:this.Jt(null!=i),gate:t}},v.prototype.getConfig=function(t){var n,i,e=(0,a.getHashValue)(t);return null!=(null==(n=this.It)?void 0:n.dynamic_configs[e])?(n=null==(n=this.It)?void 0:n.dynamic_configs[e],i=this.Jt(!0),this.Ct(t,n,i)):(i=this.Jt(!1),new r.default(t,{},"",i))},v.prototype.getLayer=function(t,n){var i=this.Rt(n,"layer_configs"),e=this.Jt(null!=i);return u.default.A(n,null!=(n=null==i?void 0:i.value)?n:{},null!=(n=null==i?void 0:i.rule_id)?n:"",e,t,null==i?void 0:i.secondary_exposures,null==i?void 0:i.undelegated_secondary_exposures,null!=(n=null==i?void 0:i.allocated_experiment_name)?n:"",null==i?void 0:i.explicit_parameters)},v.prototype.getGlobalEvaluationDetails=function(){var t;return{reason:null!=(t=this.xt)?t:o.Uninitialized,time:null!=(t=this.It.evaluation_time)?t:0}},v.prototype.Dt=function(){this.zt(l.default.getItem(h.INTERNAL_STORE_KEY)),this.Pt=!0},v.prototype.zt=function(t){try{this.Nt=t?JSON.parse(t):this.Nt,this.At()}catch(t){this.Kt(h.INTERNAL_STORE_KEY)}},v.prototype.At=function(){var t=this.Nt[this.Et];return null==t?(this.Lt(),this.xt=o.Uninitialized,null):(this.It=t,this.xt=o.Cache,null!=(t=t.evaluation_time)?t:0)},v.prototype.Kt=function(t){l.default.removeItem(t)},v.prototype.Gt=function(t,n,i,e,r){var u;i&&(u=this.qt(t,i),t.has_updates&&t.time&&(t=(0,a.getHashValue)(JSON.stringify(e)),u.user_hash=t),n[i]=r(u,i))},v.prototype.Mt=function(){return{feature_gates:{},layer_configs:{},dynamic_configs:{},time:0,evaluation_time:0,has_updates:!1}},v.prototype.kt=function(i){return s(this,void 0,void 0,function(){var n;return c(this,function(t){return n=Object.entries(i).sort(function(t,n){var i,t=t[1],n=n[1];return null==t?1:null==n?-1:(null!=(i=null==n?void 0:n.evaluation_time)?i:null==n?void 0:n.time)-(null!=(i=null==t?void 0:t.evaluation_time)?i:null==t?void 0:t.time)}).slice(0,10),i=Object.fromEntries(n),l.default.setItem(h.INTERNAL_STORE_KEY,JSON.stringify(i)),[2,i]})})},v.prototype.Rt=function(t,n){var i,e=(0,a.getHashValue)(t);return null!=(i=null==(i=null==(i=this.It)?void 0:i[n])?void 0:i[e])?i:null==(i=null==(e=this.It)?void 0:e[n])?void 0:i[t]},v.prototype.Ct=function(t,n,i){return new r.default(t,null!=(t=null==n?void 0:n.value)?t:{},null!=(t=null==n?void 0:n.rule_id)?t:"",i,null==n?void 0:n.secondary_exposures,null!=(t=null==n?void 0:n.allocated_experiment_name)?t:"",this.Vt(this.L.K))},v.prototype.Jt=function(t,n){return t?{reason:this.xt,time:null!=(t=this.It.evaluation_time)?t:Date.now()}:{reason:null!=n?n:this.xt==o.Uninitialized?o.Uninitialized:o.Unrecognized,time:Date.now()}},v.prototype.Lt=function(){this.It=this.Mt()},v.prototype.qt=function(t,n){return{feature_gates:t.feature_gates,layer_configs:t.layer_configs,dynamic_configs:t.dynamic_configs,time:null==t.time||isNaN(t.time)?0:t.time,evaluation_time:Date.now()}},v.prototype.Vt=function(r){var u=this;return function(t,n,i,e){u.isLoaded()&&u.t(r,"Parameter ".concat(n," is a value of type ").concat(e,".\n Returning requested defaultValue type ").concat(i),{name:t.i,ruleID:t.u,parameter:n,defaultValueType:i,valueType:e})}},n.default=v},607:function(t,n,i){var o=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(i,n){function e(t){try{u(c.next(t))}catch(t){n(t)}}function r(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?i(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(e,r)}u((c=c.apply(t,o||[])).next())})},s=this&&this.__generator||function(e,r){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(u)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},e=this&&this.__importDefault||function(t){return t&&t.v?t:{default:t}},r=(Object.defineProperty(n,"v",{value:!0}),n.EvaluationReason=n.DynamicConfig=void 0,i(187)),c=e(i(793)),u=i(567),f=i(825),h=(Object.defineProperty(n,"DynamicConfig",{enumerable:!0,get:function(){return e(f).default}}),i(567));function a(){}Object.defineProperty(n,"EvaluationReason",{enumerable:!0,get:function(){return h.EvaluationReason}}),a.initialize=function(i,e,r){var u;return o(this,void 0,void 0,function(){var n;return s(this,function(t){return n=null!=(u=a.instance)?u:new c.default(i,e,r),a.instance||(a.instance=n),[2,n.initializeAsync()]})})},a.setInitializeValues=function(t){a.Yt().setInitializeValues(t)},a.checkGate=function(t){return a.Yt().checkGate(t)},a.getConfig=function(t){return a.Yt().getConfig(t)},a.getExperiment=function(t){return a.Yt().getConfig(t)},a.getLayer=function(t){return a.Yt().getLayer(t)},a.logEvent=function(t,n,i){return void 0===n&&(n=null),void 0===i&&(i=null),a.Yt().logEvent(t,n,i)},a.updateUser=function(t){return a.Yt().updateUser(t)},a.shutdown=function(){a.Yt().shutdown(),a.instance=null},a.getStableID=function(){return a.Yt().getStableID()},a.getEvaluationDetails=function(){var t;return null!=(t=null==(t=a.instance)?void 0:t.getEvaluationDetails())?t:{reason:u.EvaluationReason.Uninitialized,time:0}},a.initializeCalled=function(){return null!=a.instance&&a.instance.initializeCalled()},a.Yt=function(){if(a.instance)return a.instance;throw new r.StatsigUninitializedError},a.instance=null,n.default=a},477:function(t,n){var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)};function u(){}Object.defineProperty(n,"v",{value:!0}),u.isValid=function(t,n){try{var i,e,r=n.evaluated_keys;return r&&"object"==typeof r?(i=this.copyObject(r),e=null==t?null:this.copyObject(t),u.validate(i,e)&&u.validate(e,i)):!0}catch(t){}return!0},u.validate=function(t,n){if(null==t)return null==n;if(null==n)return!1;for(var i=0,e=Object.entries(t);i<e.length;i++){var r=e[i],u=r[0],r=r[1];if("stableID"!==u){if(typeof r!=typeof n[u])return!1;if("string"!=typeof r)return"object"==typeof r&&this.validate(r,n[u]);if(r!==n[u])return!1}}return!0},u.copyObject=function(t){var n;return null==t?null:(n={},null!=t&&t.userID&&(n.userID=null==t?void 0:t.userID),null!=t&&t.customIDs&&(delete(t=i({},t.customIDs)).stableID,0!==Object.keys(t).length)&&(n.customIDs=t),n)},n.default=u},652:(t,n)=>{Object.defineProperty(n,"v",{value:!0}),n.LOCAL_STORAGE_KEYS=n.STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY=n.STATSIG_STABLE_ID_KEY=n.INTERNAL_STORE_KEY=void 0,n.INTERNAL_STORE_KEY="STATSIG_STORE",n.STATSIG_STABLE_ID_KEY="STATSIG_STABLE_ID",n.STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY="STATSIG_LOGS",n.LOCAL_STORAGE_KEYS={INTERNAL_STORE_KEY:!0,STATSIG_STABLE_ID_KEY:!0,STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY:!0}},898:(t,n)=>{function s(t){for(var n=0,i=0;i<t.length;i++){n=(n<<5)-n+t.charCodeAt(i);n&=n}return String(n>>>0)}Object.defineProperty(n,"v",{value:!0}),n.getUserCacheKey=n.getHashValue=n.SimpleHash=void 0,n.SimpleHash=s,n.getHashValue=s,n.getUserCacheKey=function(t){var n="userID:".concat(String(null!=(i=null==t?void 0:t.userID)?i:"")),i=null==t?void 0:t.customIDs;if(null!=i)for(var e=0,r=Object.entries(i);e<r.length;e++){var u=r[e],o=u[0],u=u[1];n+=";".concat(o,":").concat(u)}return s(n)}},682:(t,n)=>{function i(){}Object.defineProperty(n,"v",{value:!0}),i.getItem=function(t){try{if(this.isStorageAccessible())return window.localStorage.getItem(t)}catch(t){}return null!=(t=this.fallbackSessionCache[t])?t:null},i.setItem=function(t,n){try{if(this.isStorageAccessible())return void window.localStorage.setItem(t,n)}catch(t){}this.fallbackSessionCache[t]=n},i.removeItem=function(t){try{if(this.isStorageAccessible())return void window.localStorage.removeItem(t)}catch(t){}delete this.fallbackSessionCache[t]},i.isStorageAccessible=function(t){void 0===t&&(t=!1),null==this.canAccessStorageAccessible&&(this.canAccessStorageAccessible="undefined"!=typeof Storage&&"undefined"!=typeof window&&null!=window&&null!=window.localStorage);var n=this.canAccessStorageAccessible;return(t||!this.disabled)&&n},i.disabled=!1,i.fallbackSessionCache={},i.canAccessStorageAccessible=null,n.default=i},28:(t,n)=>{function i(){return"undefined"!=typeof performance&&performance?0|performance.now():Date.now()}Object.defineProperty(n,"v",{value:!0}),n.difference=n.now=void 0,n.now=i,n.difference=function(t){return i()-t}}},r={};return function t(n){var i=r[n];return void 0===i&&(i=r[n]={exports:{}},e[n].call(i.exports,i,i.exports,t)),i.exports}(607).default})()); | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.statsig=n():t.statsig=n()}(this,()=>(()=>{"use strict";var e={825:(t,n)=>{function i(t,n,i,e,r,u,o){void 0===r&&(r=[]),void 0===u&&(u=""),void 0===o&&(o=null),this.t=null,this.value=JSON.parse(JSON.stringify(null!=n?n:{})),this.i=t,this.u=null!=i?i:"",this.o=r,this.h=u,this.l=e,this.t=o}Object.defineProperty(n,"v",{value:!0}),i.prototype.get=function(t,n,i){var e=this.getValue(t,n);if(null!=e){var r=Array.isArray(n)?"array":typeof n,u=Array.isArray(e)?"array":typeof e;if(i)return i(e)?e:(null!=(i=this.t)&&i.call(this,this,t,r,u),n);if(null==n||r==u)return e;null!=(i=this.t)&&i.call(this,this,t,r,u)}return n},i.prototype.getValue=function(t,n){return null==t?this.value:(null==n&&(n=null),null==this.value[t]?n:this.value[t])},n.default=i},742:function(t,f,n){var i=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(i,n){function e(t){try{u(c.next(t))}catch(t){n(t)}}function r(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?i(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(e,r)}u((c=c.apply(t,o||[])).next())})},h=this&&this.__generator||function(e,r){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(u)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},r=(Object.defineProperty(f,"v",{value:!0}),f.ExceptionEndpoint=void 0,n(187)),n=(f.ExceptionEndpoint="https://statsigapi.net/v1/sdk_exception",e.prototype.p=function(t){this.m=t},e.prototype.g=function(t,n){this.S(t,n,function(){})},e.prototype.S=function(n,t,i,e){var r=this;try{var u=t();return u instanceof Promise?u.catch(function(t){return r._(n,t,i,e)}):u}catch(t){return this._(n,t,i,e)}},e.prototype.O=function(o,s,c){var t=this;try{i(t,void 0,void 0,function(){var n,i,e,r,u;return h(this,function(t){switch(t.label){case 0:return"function"!=typeof c?[3,2]:[4,c()];case 1:return i=t.sent(),[3,3];case 2:i=null,t.label=3;case 3:return(n=i,u=null!=s?s:Error("[Statsig] Error was empty"),e=u instanceof Error,r=e?u.name:"No Name",this.T.has(r))?[2]:(this.T.add(r),e=e?u.stack:this.j(u),u=null!=(u=this.m)?u:{},r=JSON.stringify({tag:o,exception:r,info:e,statsigMetadata:u,extra:null!=n?n:{}}),[2,fetch(f.ExceptionEndpoint,{method:"POST",headers:{"STATSIG-API-KEY":this.N,"STATSIG-SDK-TYPE":String(u.sdkType),"STATSIG-SDK-VERSION":String(u.sdkVersion),"Content-Type":"application/json","Content-Length":"".concat(r.length)},body:r})])}})}).then(function(){}).catch(function(){})}catch(t){}},e.prototype._=function(t,n,i,e){if(n instanceof r.StatsigUninitializedError||n instanceof r.StatsigInvalidArgumentError)throw n;return console.error("[Statsig] An unexpected exception occurred.",n),this.O(t,n,e),i()},e.prototype.j=function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}},e);function e(t){this.T=new Set,this.N=t}f.default=n},187:function(t,n){var e,i,r=this&&this.__extends||(e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}))(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}),u=(Object.defineProperty(n,"v",{value:!0}),n.StatsigInvalidArgumentError=n.StatsigUninitializedError=void 0,i=Error,r(o,i),o);function o(t){t=i.call(this,null!=t?t:"Call and wait for initialize() to finish first.")||this;return Object.setPrototypeOf(t,o.prototype),t}n.StatsigUninitializedError=u;s=Error,r(c,s);var s,u=c;function c(t){t=s.call(this,t)||this;return Object.setPrototypeOf(t,c.prototype),t}n.StatsigInvalidArgumentError=u},857:(t,n)=>{function f(t,n,i,e,r,u,o,s,c){void 0===u&&(u=[]),void 0===o&&(o=[]),void 0===s&&(s=""),void 0===c&&(c=[]),this.I=r=void 0===r?null:r,this.i=t,this.M=JSON.parse(JSON.stringify(null!=n?n:{})),this.u=null!=i?i:"",this.l=e,this.o=u,this.P=o,this.h=s,this.D=c}Object.defineProperty(n,"v",{value:!0}),f.A=function(t,n,i,e,r,u,o,s,c){return new f(t,n,i,e,r=void 0===r?null:r,u=void 0===u?[]:u,o=void 0===o?[]:o,s=void 0===s?"":s,c=void 0===c?[]:c)},f.prototype.get=function(t,n,i){var e,r=this,u=this.M[t];return null==u?n:(e=function(){return r.G(t),u},i?i(u)?e():n:null==n||typeof u==typeof n&&Array.isArray(n)===Array.isArray(u)?e():n)},f.prototype.getValue=function(t,n){null==n&&(n=null);var i=this.M[t];return null!=i&&this.G(t),null!=i?i:n},f.prototype.G=function(t){var n;null!=(n=this.I)&&n.call(this,this,t)},n.default=f},820:function(t,n){var s=this&&this.__assign||function(){return(s=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)};Object.defineProperty(n,"v",{value:!0}),n.default=function(t,n,i,e,r,u){void 0===e&&(e=null),void 0===r&&(r=null);var o=n;return null!=o&&o.privateAttributes&&delete(o=s({},n)).privateAttributes,{time:Date.now(),eventName:t,statsigMetadata:i,user:o,value:e,metadata:r,secondaryExposures:u}}},888:(t,n)=>{Object.defineProperty(n,"v",{value:!0}),n.version=void 0,n.version="1.0.0-beta.4"},793:function(t,n,i){var e=this&&this.__assign||function(){return(e=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},r=this&&this.__createBinding||(Object.create?function(t,n,i,e){void 0===e&&(e=i);var r=Object.getOwnPropertyDescriptor(n,i);r&&("get"in r?n.v:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(t,e,r)}:function(t,n,i,e){t[e=void 0===e?i:e]=n[i]}),u=this&&this.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),o=this&&this.__importStar||function(t){if(t&&t.v)return t;var n={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&r(n,t,i);return u(n,t),n},s=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(i,n){function e(t){try{u(c.next(t))}catch(t){n(t)}}function r(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?i(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(e,r)}u((c=c.apply(t,o||[])).next())})},c=this&&this.__generator||function(e,r){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(u)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},f=this&&this.__importDefault||function(t){return t&&t.v?t:{default:t}},h=(Object.defineProperty(n,"v",{value:!0}),f(i(825))),a=f(i(742)),l=i(187),v=f(i(857)),d=f(i(578)),y=f(i(332)),w=f(i(69)),p=f(i(574)),m=o(i(567)),b=f(i(682)),g=i(28),S=f(i(820));function _(t,n,i){var o=this;if(this.k=!1,this.J=null,this.C=function(t,n,i){void 0===i&&(i=!1);var e="",r=t.P,u=t.D.includes(n);u&&(e=t.h,r=t.o),o.R.logLayerExposure(o.L.K,t.i,t.u,r,e,n,u,t.l,i)},!0!==(null==i?void 0:i.localMode)&&("string"!=typeof t||!t.startsWith("client-")))throw new l.StatsigInvalidArgumentError("Invalid key provided. You must use a Client SDK Key from the Statsig console to initialize the sdk");this.q=(0,g.now)(),this.V=new a.default(t),this.Y=!1,this.U=new p.default(i),b.default.disabled=this.U.disableLocalStorage,this.L=new d.default(t,this.B(null!=n?n:null),this.U.overrideStableID),this.F=new w.default(this.U,this.L,this.V),this.R=new y.default(this.U,this.L,this.F,this.V),this.W=new m.default(this.L,this.R.logConfigDefaultValueFallback,this.U.initializeValues),this.V.p(this.L.m),null!=this.U.initializeValues&&(this.Y=!0,this.k=!0,setTimeout(function(){return o.H()},20))}_.prototype.setInitializeValues=function(t){var n=this;this.V.S("setInitializeValues",function(){n.W.bootstrap(t),n.Y||(n.Y=!0,n.k=!0),n.R.sendSavedRequests()},function(){n.Y=!0,n.k=!0})},_.prototype.initializeAsync=function(){return s(this,void 0,void 0,function(){var n=this;return c(this,function(t){return[2,this.V.S("initializeAsync",function(){return s(n,void 0,void 0,function(){var n,i=this;return c(this,function(t){if(null==this.J){if(this.Y)return[2,Promise.resolve()];if(this.k=!0,this.U.localMode)return[2,Promise.resolve()];n=this.L.K,this.J=this.X(n,this.U.initTimeoutMs).then(function(){}).catch(function(t){return i.V.O("initializeAsync:fetchAndSaveValues",t),{success:!1,message:t.message}}).then(function(){}).finally(function(){return s(i,void 0,void 0,function(){return c(this,function(t){return this.J=null,this.Y=!0,this.H(),[2]})})})}return[2,this.J]})})},function(){return n.Y=!0,n.k=!0,Promise.resolve()})]})})},_.prototype.getEvaluationDetails=function(){var t=this;return this.V.S("getEvaluationDetails",function(){return t.W.getGlobalEvaluationDetails()},function(){return{time:Date.now(),reason:m.EvaluationReason.Error}})},_.prototype.checkGate=function(n){var i=this;return this.V.S("checkGate",function(){var t=i.Z(n);return i.$(n,t),!0===t.gate.value},function(){return!1})},_.prototype.getConfig=function(n){var i=this;return this.V.S("getConfig",function(){var t=i.tt(n);return i.nt(n,t),t},function(){return i.it(n)})},_.prototype.getExperiment=function(t){return this.getConfig(t)},_.prototype.getLayer=function(t){var n=this;return this.V.S("getLayer",function(){return n.et(n.C,t)},function(){return v.default.A(t,{},"",n.rt())})},_.prototype.logEvent=function(n,i,e){var r=this;void 0===i&&(i=null),void 0===e&&(e=null),this.V.g("logEvent",function(){if(!r.R||!r.L.N)throw new l.StatsigUninitializedError("Must initialize() before logging events.");var t;"string"==typeof n&&0!==n.length&&(t=(0,S.default)(n,r.L.K,r.L.m,i,e),r.R.log(t))})},_.prototype.updateUser=function(e){return s(this,void 0,void 0,function(){var n=this;return c(this,function(t){return[2,this.V.S("updateUser",function(){return s(n,void 0,void 0,function(){var n,i=this;return c(this,function(t){switch(t.label){case 0:if(this.initializeCalled())return this.L.K=this.B(e),this.W.updateUser(),this.R.resetDedupeKeys(),null==this.J?[3,2]:[4,this.J];throw new l.StatsigUninitializedError("Call initialize() first.");case 1:t.sent(),t.label=2;case 2:return this.U.localMode?[2,Promise.resolve(!0)]:(n=this.L.K,this.J=this.X(n).finally(function(){i.J=null}),[2,this.J.then(function(){return Promise.resolve(!0)}).catch(function(t){return Promise.resolve(!1)})])}})})},function(){return Promise.resolve(!1)})]})})},_.prototype.shutdown=function(){var t=this;this.V.g("shutdown",function(){t.R.shutdown()})},_.prototype.getStableID=function(){var t=this;return this.V.S("getStableID",function(){return t.L.m.stableID},function(){return""})},_.prototype.initializeCalled=function(){return this.k},_.prototype.H=function(){var t=this;this.V.g("delayedSetup",function(){t.L.saveStableID(),t.R.sendSavedRequests().then(function(){})})},_.prototype.B=function(t){var n={};try{n=JSON.parse(JSON.stringify(t))}catch(t){throw new l.StatsigInvalidArgumentError("User object must be convertable to JSON string.")}return n=null!=this.U.environment?e(e({},n),{statsigEnvironment:this.U.environment}):n},_.prototype.ut=function(){if(!this.W.isLoaded())throw new l.StatsigUninitializedError("Call and wait for initialize() to finish first.")},_.prototype.rt=function(){return{time:Date.now(),reason:m.EvaluationReason.Error}},_.prototype.X=function(r,i){return void 0===i&&(i=this.U.initTimeoutMs),s(this,void 0,void 0,function(){var n,e=this;return c(this,function(t){return n=this.W.getLastUpdateTime(r),[2,this.F.fetchValues(r,n,i).eventually(function(t){null!=t&&t.has_updates&&e.W.save(r,t,!1)}).then(function(i){return s(e,void 0,void 0,function(){var n=this;return c(this,function(t){return[2,this.V.g("fetchAndSaveValues",function(){return s(n,void 0,void 0,function(){return c(this,function(t){switch(t.label){case 0:return null!=i&&i.has_updates?[4,this.W.save(r,i)]:[3,2];case 1:return t.sent(),[3,3];case 2:null!=i&&i.is_no_content&&this.W.setEvaluationReason(m.EvaluationReason.NetworkNotModified),t.label=3;case 3:return[2]}})})})]})})})]})})},_.prototype.Z=function(t){if(this.ut(),"string"!=typeof t||0===t.length)throw new l.StatsigInvalidArgumentError("Must pass a valid string as the gateName.");return this.W.checkGate(t)},_.prototype.$=function(t,n){var i=!n,n=null!=n?n:this.Z(t),e=n.gate;this.R.logGateExposure(this.L.K,t,e.value,e.rule_id,e.secondary_exposures,n.evaluationDetails,i)},_.prototype.tt=function(t){if(this.ut(),"string"!=typeof t||0===t.length)throw new l.StatsigInvalidArgumentError("Must pass a valid string as the configName.");return this.W.getConfig(t)},_.prototype.nt=function(t,n){var i=!n,n=null!=n?n:this.tt(t);this.R.logConfigExposure(this.L.K,t,n.u,n.o,n.l,i)},_.prototype.et=function(t,n){if(this.ut(),"string"!=typeof n||0===n.length)throw new l.StatsigInvalidArgumentError("Must pass a valid string as the layerName.");return this.W.getLayer(t,n)},_.prototype.it=function(t){return new h.default(t,{},"",this.rt())},n.default=_},578:function(t,n,i){var e=this&&this.__importDefault||function(t){return t&&t.v?t:{default:t}},r=(Object.defineProperty(n,"v",{value:!0}),i(652)),u=i(898),o=e(i(682)),s=i(888);function c(t,n,i){this.ot="js-lite",this.N=t,this.K=n,this.st=s.version;t=null!=(n=null!=(t=i)?t:o.default.getItem(r.STATSIG_STABLE_ID_KEY))?n:this.ct();this.m={stableID:t,sdkType:this.ot,sdkVersion:this.st}}c.prototype.saveStableID=function(){null!=this.m.stableID&&o.default.setItem(r.STATSIG_STABLE_ID_KEY,this.m.stableID)},c.prototype.getUserCacheKey=function(){return(0,u.getUserCacheKey)(this.K)},c.prototype.ct=function(){for(var t="",n=0;n<32;n++){8!==n&&12!==n&&16!==n&&20!==n||(t+="-");var i=16*Math.random()|0;t+=12===n?"4":(16===n?3&i|8:i).toString(16)}return t},n.default=c},332:function(t,n,i){var u=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(i,n){function e(t){try{u(c.next(t))}catch(t){n(t)}}function r(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?i(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(e,r)}u((c=c.apply(t,o||[])).next())})},h=this&&this.__generator||function(e,r){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(u)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},e=this&&this.__importDefault||function(t){return t&&t.v?t:{default:t}},a=(Object.defineProperty(n,"v",{value:!0}),e(i(820))),l=i(69),v=i(652),d=e(i(682)),e="statsig::",o=e+"log_event_failed";function r(t,n,i,e){var r=this;this.ft=0,this.logConfigDefaultValueFallback=function(t,n,i){t=(0,a.default)("statsig::default_value_type_mismatch",t,r.L.m,n,i);r.log(t),r.ht.add(n)},this.U=t,this.L=n,this.F=i,this.V=e,this.lt=[],this.vt=null,this.ht=new Set,this.dt=[],this.yt={},this.ft=0,this.wt()}r.prototype.log=function(t){try{var n;this.U.disableCurrentPageLogging||"undefined"==typeof window||null==window||"object"!=typeof window.location||"string"!=typeof window.location.href||0<(null==(n=window.location.href.split(/[?#]/))?void 0:n.length)&&(t.statsigMetadata.currentPage=n[0])}catch(t){}this.lt.push(t),this.lt.length>=this.U.loggingBufferMaxSize&&this.flush()},r.prototype.resetDedupeKeys=function(){this.yt={}},r.prototype.logGateExposure=function(t,n,i,e,r,u,o){var s=n+String(i)+e+u.reason;this.bt(s)&&(s={gate:n,gateValue:String(i),ruleID:e,reason:u.reason,time:u.time},o&&(s.isManualExposure="true"),n=(0,a.default)("statsig::gate_exposure",t,this.L.m,null,s,r),this.log(n))},r.prototype.logConfigExposure=function(t,n,i,e,r,u){var o=n+i+r.reason;this.bt(o)&&(o={config:n,ruleID:i,reason:r.reason,time:r.time},u&&(o.isManualExposure="true"),n=(0,a.default)("statsig::config_exposure",t,this.L.m,null,o,e),this.log(n))},r.prototype.logLayerExposure=function(t,n,i,e,r,u,o,s,c){var f=[n,i,r,u,String(o),s.reason].join("|");this.bt(f)&&(f={config:n,ruleID:i,allocatedExperiment:r,parameterName:u,isExplicitParameter:String(o),reason:s.reason,time:s.time},c&&(f.isManualExposure="true"),n=(0,a.default)("statsig::layer_exposure",t,this.L.m,null,f,e),this.log(n))},r.prototype.shutdown=function(){this.vt&&(clearInterval(this.vt),this.vt=null),this.flush(!0)},r.prototype.flush=function(n){var i,e,r,t=this;void 0===n&&(n=!1),0!==this.lt.length&&(i=this.L.m,e=this.lt,this.lt=[],n&&!this.F.supportsKeepalive()&&"undefined"!=typeof navigator&&null!=navigator&&navigator.sendBeacon?this.F.sendLogBeacon({events:e,statsigMetadata:i})||(this.lt=e.concat(this.lt),0<this.lt.length&&(this.gt({events:this.lt,statsigMetadata:i,time:Date.now()}),this.lt=[]),this.St()):(r=this).F.postToEndpoint(l.StatsigEndpoint.Rgstr,{events:e,statsigMetadata:i},3,1e3,n).then(function(t){if(!t.ok)throw t}).catch(function(i){"function"==typeof i.text?i.text().then(function(n){t.V.O(o,i,function(){return u(t,void 0,void 0,function(){return h(this,function(t){return[2,{eventCount:e.length,error:n}]})})})}):t.V.O(o,i,function(){return u(t,void 0,void 0,function(){return h(this,function(t){return[2,{eventCount:e.length,error:i.message}]})})}),r._t(o,e)}).finally(function(){return u(t,void 0,void 0,function(){return h(this,function(t){switch(t.label){case 0:return n?(0<this.lt.length&&(this.gt({events:this.lt,statsigMetadata:i,time:Date.now()}),this.lt=[]),[4,r.St()]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})}))},r.prototype.sendSavedRequests=function(){return u(this,void 0,void 0,function(){var n,i,e,r,u,o,s,c,f=this;return h(this,function(t){if(i=!1,null==(n=d.default.getItem(v.STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY)))this.Ot();else{1024e3<n.length&&(i=!0),0;try{for(e=JSON.parse(n),r=function(n){null!=n&&n.events&&Array.isArray(n.events)&&u.F.postToEndpoint(l.StatsigEndpoint.Rgstr,n).then(function(t){if(!t.ok)throw Error(t.status+"")}).catch(function(t){i||f.gt(n)})},u=this,o=0,s=e;o<s.length;o++)c=s[o],r(c)}catch(t){}finally{this.Ot()}}return[2]})})},r.prototype.wt=function(){var t,n=this;"undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("blur",function(){return n.flush(!0)}),window.addEventListener("beforeunload",function(){return n.flush(!0)}),window.addEventListener("load",function(){setTimeout(function(){return n.flush()},100),setTimeout(function(){return n.flush()},1e3)})),"undefined"!=typeof document&&"function"==typeof document.addEventListener&&document.addEventListener("visibilitychange",function(){n.flush("visible"!==document.visibilityState)}),(this.U.ignoreWindowUndefined||"undefined"!=typeof window&&null!=window)&&!this.U.localMode&&((t=this).vt=setInterval(function(){t.flush()},this.U.loggingIntervalMillis),setTimeout(function(){return n.flush()},100),setTimeout(function(){return n.flush()},1e3))},r.prototype.bt=function(t){var n=this.yt[t],i=Date.now();if(null!=n&&i-6e5<=n)return!1;return this.yt[t]=i,!0},r.prototype.St=function(){return u(this,void 0,void 0,function(){var n;return h(this,function(t){if(0<this.dt.length){if(1024e3<(n=JSON.stringify(this.dt)).length)return this.Ot(),[2];d.default.setItem(v.STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY,n)}return[2]})})},r.prototype.gt=function(t){var n;t.time<Date.now()-432e6||100<this.dt.length||(n=t.events.length,1e3<this.ft+n)||(this.dt.push(t),this.ft+=n)},r.prototype.Ot=function(){d.default.removeItem(v.STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY)},r.prototype._t=function(t,n){this.ht.has(t)||(this.ht.add(t),this.dt.push({events:n,statsigMetadata:this.L.m,time:Date.now()}),this.St().then(function(){}))},n.default=r},69:function(t,n){var h,i,l=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(i,n){function e(t){try{u(c.next(t))}catch(t){n(t)}}function r(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?i(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(e,r)}u((c=c.apply(t,o||[])).next())})},v=this&&this.__generator||function(e,r){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(u)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}};Object.defineProperty(n,"v",{value:!0}),n.StatsigEndpoint=void 0,(i=h=n.StatsigEndpoint||(n.StatsigEndpoint={})).Initialize="initialize",i.Rgstr="rgstr",i.LogEventBeacon="log_event_beacon";function e(t,n,i){this.retryCodes={408:!0,500:!0,502:!0,503:!0,504:!0,522:!0,524:!0,599:!0},this.canUseKeepalive=!1,this.U=t,this.L=n,this.V=i,this.leakyBucket={},this.wt()}e.prototype.fetchValues=function(t,n,i){t={user:t,statsigMetadata:this.L.m,sinceTime:null!=n?n:void 0,hash:"djb2"};return this.Tt(h.Initialize,t,i,3)},e.prototype.sendLogBeacon=function(t){if(this.U.localMode)return!0;var n=new URL(this.U.eventLoggingApi+h.LogEventBeacon),i=(n.searchParams.append("k",this.L.N),t.clientTime=Date.now()+"",null);try{i=JSON.stringify(t)}catch(t){return!1}return navigator.sendBeacon(n.toString(),i)},e.prototype.postToEndpoint=function(u,o,s,c,f){return void 0===s&&(s=0),void 0===c&&(c=1e3),void 0===f&&(f=!1),l(this,void 0,void 0,function(){var i,n,e,r=this;return v(this,function(t){return this.U.localMode?[2,Promise.reject("no network requests in localMode")]:"function"!=typeof fetch?[2,Promise.reject("fetch is not defined")]:"undefined"!=typeof window||this.U.ignoreWindowUndefined?(e=[h.Initialize].includes(u)?this.U.api:this.U.eventLoggingApi,i=e+u,null!=(e=this.leakyBucket[i])&&30<=e?[2,Promise.reject(new Error("Request failed because you are making the same request too frequently."))]:(this.leakyBucket[i]=null==e?1:e+1,e=JSON.stringify(o),n=this.L.m,e={method:"POST",body:e,headers:{"Content-type":"application/json; charset=UTF-8","STATSIG-API-KEY":this.L.N,"STATSIG-CLIENT-TIME":Date.now()+"","STATSIG-SDK-TYPE":n.sdkType,"STATSIG-SDK-VERSION":n.sdkVersion}},this.canUseKeepalive&&f&&(e.keepalive=!0),[2,fetch(i,e).then(function(e){return l(r,void 0,void 0,function(){var n,i;return v(this,function(t){switch(t.label){case 0:return e.ok?204!==(n=e).status?[3,1]:(n.data={has_updates:!1,is_no_content:!0},[3,3]):[3,4];case 1:return[4,e.text()];case 2:i=t.sent(),n.data=JSON.parse(i),t.label=3;case 3:return[2,Promise.resolve(n)];case 4:return this.retryCodes[e.status]||(s=0),[4,e.text()];case 5:return i=t.sent(),[2,Promise.reject(new Error("".concat(e.status,": ").concat(i)))]}})})}).catch(function(t){return 0<s?new Promise(function(t,n){setTimeout(function(){r.leakyBucket[i]=Math.max(r.leakyBucket[i]-1,0),r.postToEndpoint(u,o,s-1,2*c,f).then(t).catch(n)},c)}):Promise.reject(t)}).finally(function(){r.leakyBucket[i]=Math.max(r.leakyBucket[i]-1,0)})])):[2,Promise.reject("window is not defined")]})})},e.prototype.supportsKeepalive=function(){return this.canUseKeepalive},e.prototype.wt=function(){if(!this.U.disableNetworkKeepalive)try{this.canUseKeepalive="keepalive"in new Request("")}catch(t){}},e.prototype.Tt=function(e,r,i,u,o){var n,s=this,c=(void 0===u&&(u=0),void 0===o&&(o=1e3),!1),t=null,f=null,h=[],a=(0!=(i=void 0===i?0:i)&&(t=new Promise(function(t,n){setTimeout(function(){c=!0,n(new Error("The initialization timeout of ".concat(i,"ms has been hit before the network request has completed.")))},i)})),this.postToEndpoint(e,r,u,o).then(function(n){var t,i;return n.ok?"object"!=typeof n.data?(t=new Error("Request to ".concat(e," received invalid response type. Expected 'object' but got '").concat(typeof n.data,"'")),s.V.O("postWithTimeoutInvalidRes",t,function(){return l(s,void 0,void 0,function(){return v(this,function(t){return[2,this.jt(e,r,u,o,n)]})})}),Promise.reject(t)):(i=n.data,s.V.S("postWithTimeout",function(){return l(s,void 0,void 0,function(){return v(this,function(t){return f=i,c&&(h.forEach(function(t){return t(i)}),h=[]),[2,Promise.resolve(i)]})})},function(){return Promise.resolve({})},function(){return l(s,void 0,void 0,function(){return v(this,function(t){return[2,this.jt(e,r,u,o,n)]})})})):Promise.reject(new Error("Request to ".concat(e," failed with status ").concat(n.status)))}).catch(function(t){return Promise.reject(t)})),t=t?Promise.race([a,t]):a;return t.eventually=(n=t,function(t){return c&&f?t(f):h.push(t),n}),t},e.prototype.jt=function(n,e,r,u,o){var s;return l(this,void 0,void 0,function(){var i;return v(this,function(t){try{return i={},(null!=(s=o.headers)?s:[]).forEach(function(t,n){i[n]=t}),[2,{responseInfo:{headers:i,status:o.status,statusText:o.statusText,type:o.type,url:o.url,redirected:o.redirected,bodySnippet:o.data?JSON.stringify(o.data).slice(0,500):null},requestInfo:{endpointName:n,bodySnippet:JSON.stringify(e).slice(0,500),retries:r,backoff:u}}]}catch(t){return[2,{statusText:"statsig::failed to extract extra data"}]}return[2]})})},n.default=e},574:(t,i)=>{Object.defineProperty(i,"v",{value:!0}),i.INIT_TIMEOUT_DEFAULT_MS=void 0;i.INIT_TIMEOUT_DEFAULT_MS=3e3,e.prototype.normalizeNumberInput=function(t,n){return null==t?n.default:Math.max(Math.min(t,n.max),n.min)};var n=e;function e(t){var n=null!=(n=(t=null==t?{}:t).api)?n:"https://featuregates.org/v1/",n=(this.api=n.endsWith("/")?n:n+"/",this.disableCurrentPageLogging=null!=(n=t.disableCurrentPageLogging)&&n,this.environment=null!=(n=t.environment)?n:null,this.loggingIntervalMillis=this.normalizeNumberInput(t.loggingIntervalMillis,{default:1e4,min:1e3,max:6e4}),this.loggingBufferMaxSize=this.normalizeNumberInput(t.loggingBufferMaxSize,{default:100,min:2,max:500}),this.disableNetworkKeepalive=null!=(n=t.disableNetworkKeepalive)&&n,this.overrideStableID=null!=(n=t.overrideStableID)?n:null,this.localMode=null!=(n=t.localMode)&&n,this.initTimeoutMs=t.initTimeoutMs&&0<=t.initTimeoutMs?t.initTimeoutMs:i.INIT_TIMEOUT_DEFAULT_MS,this.disableErrorLogging=null!=(n=t.disableErrorLogging)&&n,this.disableAutoMetricsLogging=null!=(n=t.disableAutoMetricsLogging)&&n,this.initializeValues=null!=(n=t.initializeValues)?n:null,null!=(n=null!=(n=t.eventLoggingApi)?n:t.api)?n:"https://events.statsigapi.net/v1/");this.eventLoggingApi=n.endsWith("/")?n:n+"/",this.disableLocalStorage=null!=(n=t.disableLocalStorage)&&n,this.ignoreWindowUndefined=null!=(n=null==t?void 0:t.ignoreWindowUndefined)&&n}i.default=n},567:function(t,n,i){var o,s=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(i,n){function e(t){try{u(c.next(t))}catch(t){n(t)}}function r(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?i(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(e,r)}u((c=c.apply(t,o||[])).next())})},c=this&&this.__generator||function(e,r){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(u)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},e=this&&this.__importDefault||function(t){return t&&t.v?t:{default:t}},r=(Object.defineProperty(n,"v",{value:!0}),n.EvaluationReason=void 0,e(i(825))),u=e(i(857)),f=e(i(477)),h=i(652),a=i(898),l=e(i(682));(e=o=n.EvaluationReason||(n.EvaluationReason={})).Network="Network",e.Bootstrap="Bootstrap",e.InvalidBootstrap="InvalidBootstrap",e.Cache="Cache",e.Unrecognized="Unrecognized",e.Uninitialized="Uninitialized",e.Error="Error",e.NetworkNotModified="NetworkNotModified";function v(t,n,i){this.L=t,this.t=n,this.Et=this.L.getUserCacheKey(),this.Nt={},this.It=this.Mt(),this.Pt=!1,this.xt=o.Uninitialized,i?this.bootstrap(i):this.Dt()}v.prototype.updateUser=function(){return this.Et=this.L.getUserCacheKey(),this.At()},v.prototype.bootstrap=function(t){var n,i,e,r=this.L.getUserCacheKey(),u=this.L.K,u=f.default.isValid(u,t)?o.Bootstrap:o.InvalidBootstrap;this.Pt=!0;try{this.It.feature_gates=null!=(n=t.feature_gates)?n:{},this.It.dynamic_configs=null!=(i=t.dynamic_configs)?i:{},this.It.layer_configs=null!=(e=t.layer_configs)?e:{},this.It.evaluation_time=Date.now(),this.It.time=Date.now(),this.Nt[r]=this.It,this.xt=u}catch(t){}},v.prototype.isLoaded=function(){return this.Pt},v.prototype.getLastUpdateTime=function(t){t=(0,a.getHashValue)(JSON.stringify(t));return this.It.user_hash==t?this.It.time:null},v.prototype.setEvaluationReason=function(t){this.xt=t},v.prototype.save=function(e,r,u){return void 0===u&&(u=!0),s(this,void 0,void 0,function(){var n,i;return c(this,function(t){switch(t.label){case 0:return i=(0,a.getUserCacheKey)(e),this.Gt(r,this.Nt,i,e,function(t){return t}),u&&(n=this.Nt[i])&&i&&i==this.Et&&(this.It=n,this.xt=o.Network),[4,(i=this).kt(this.Nt)];case 1:return i.Nt=t.sent(),[2]}})})},v.prototype.checkGate=function(t){var n=(0,a.getHashValue)(t),t={name:t,value:!1,rule_id:"",secondary_exposures:[]},i=null==(i=this.It)?void 0:i.feature_gates[n];return i&&(t=i),{evaluationDetails:this.Jt(null!=i),gate:t}},v.prototype.getConfig=function(t){var n,i,e=(0,a.getHashValue)(t);return null!=(null==(n=this.It)?void 0:n.dynamic_configs[e])?(n=null==(n=this.It)?void 0:n.dynamic_configs[e],i=this.Jt(!0),this.Ct(t,n,i)):(i=this.Jt(!1),new r.default(t,{},"",i))},v.prototype.getLayer=function(t,n){var i=this.Rt(n,"layer_configs"),e=this.Jt(null!=i);return u.default.A(n,null!=(n=null==i?void 0:i.value)?n:{},null!=(n=null==i?void 0:i.rule_id)?n:"",e,t,null==i?void 0:i.secondary_exposures,null==i?void 0:i.undelegated_secondary_exposures,null!=(n=null==i?void 0:i.allocated_experiment_name)?n:"",null==i?void 0:i.explicit_parameters)},v.prototype.getGlobalEvaluationDetails=function(){var t;return{reason:null!=(t=this.xt)?t:o.Uninitialized,time:null!=(t=this.It.evaluation_time)?t:0}},v.prototype.Dt=function(){this.zt(l.default.getItem(h.INTERNAL_STORE_KEY)),this.Pt=!0},v.prototype.zt=function(t){try{this.Nt=t?JSON.parse(t):this.Nt,this.At()}catch(t){this.Kt(h.INTERNAL_STORE_KEY)}},v.prototype.At=function(){var t=this.Nt[this.Et];return null==t?(this.Lt(),this.xt=o.Uninitialized,null):(this.It=t,this.xt=o.Cache,null!=(t=t.evaluation_time)?t:0)},v.prototype.Kt=function(t){l.default.removeItem(t)},v.prototype.Gt=function(t,n,i,e,r){var u;i&&(u=this.qt(t,i),t.has_updates&&t.time&&(t=(0,a.getHashValue)(JSON.stringify(e)),u.user_hash=t),n[i]=r(u,i))},v.prototype.Mt=function(){return{feature_gates:{},layer_configs:{},dynamic_configs:{},time:0,evaluation_time:0,has_updates:!1}},v.prototype.kt=function(i){return s(this,void 0,void 0,function(){var n;return c(this,function(t){return n=Object.entries(i).sort(function(t,n){var i,t=t[1],n=n[1];return null==t?1:null==n?-1:(null!=(i=null==n?void 0:n.evaluation_time)?i:null==n?void 0:n.time)-(null!=(i=null==t?void 0:t.evaluation_time)?i:null==t?void 0:t.time)}).slice(0,10),i=Object.fromEntries(n),l.default.setItem(h.INTERNAL_STORE_KEY,JSON.stringify(i)),[2,i]})})},v.prototype.Rt=function(t,n){var i,e=(0,a.getHashValue)(t);return null!=(i=null==(i=null==(i=this.It)?void 0:i[n])?void 0:i[e])?i:null==(i=null==(e=this.It)?void 0:e[n])?void 0:i[t]},v.prototype.Ct=function(t,n,i){return new r.default(t,null!=(t=null==n?void 0:n.value)?t:{},null!=(t=null==n?void 0:n.rule_id)?t:"",i,null==n?void 0:n.secondary_exposures,null!=(t=null==n?void 0:n.allocated_experiment_name)?t:"",this.Vt(this.L.K))},v.prototype.Jt=function(t,n){return t?{reason:this.xt,time:null!=(t=this.It.evaluation_time)?t:Date.now()}:{reason:null!=n?n:this.xt==o.Uninitialized?o.Uninitialized:o.Unrecognized,time:Date.now()}},v.prototype.Lt=function(){this.It=this.Mt()},v.prototype.qt=function(t,n){return{feature_gates:t.feature_gates,layer_configs:t.layer_configs,dynamic_configs:t.dynamic_configs,time:null==t.time||isNaN(t.time)?0:t.time,evaluation_time:Date.now()}},v.prototype.Vt=function(r){var u=this;return function(t,n,i,e){u.isLoaded()&&u.t(r,"Parameter ".concat(n," is a value of type ").concat(e,".\n Returning requested defaultValue type ").concat(i),{name:t.i,ruleID:t.u,parameter:n,defaultValueType:i,valueType:e})}},n.default=v},607:function(t,n,i){var o=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(i,n){function e(t){try{u(c.next(t))}catch(t){n(t)}}function r(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?i(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(e,r)}u((c=c.apply(t,o||[])).next())})},s=this&&this.__generator||function(e,r){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(u)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},e=this&&this.__importDefault||function(t){return t&&t.v?t:{default:t}},r=(Object.defineProperty(n,"v",{value:!0}),n.EvaluationReason=n.DynamicConfig=void 0,i(187)),c=e(i(793)),u=i(567),f=i(825),h=(Object.defineProperty(n,"DynamicConfig",{enumerable:!0,get:function(){return e(f).default}}),i(567));function a(){}Object.defineProperty(n,"EvaluationReason",{enumerable:!0,get:function(){return h.EvaluationReason}}),a.initialize=function(i,e,r){var u;return o(this,void 0,void 0,function(){var n;return s(this,function(t){return n=null!=(u=a.instance)?u:new c.default(i,e,r),a.instance||(a.instance=n),[2,n.initializeAsync()]})})},a.setInitializeValues=function(t){a.Yt().setInitializeValues(t)},a.checkGate=function(t){return a.Yt().checkGate(t)},a.getConfig=function(t){return a.Yt().getConfig(t)},a.getExperiment=function(t){return a.Yt().getConfig(t)},a.getLayer=function(t){return a.Yt().getLayer(t)},a.logEvent=function(t,n,i){return void 0===n&&(n=null),void 0===i&&(i=null),a.Yt().logEvent(t,n,i)},a.updateUser=function(t){return a.Yt().updateUser(t)},a.shutdown=function(){a.Yt().shutdown(),a.instance=null},a.getStableID=function(){return a.Yt().getStableID()},a.getEvaluationDetails=function(){var t;return null!=(t=null==(t=a.instance)?void 0:t.getEvaluationDetails())?t:{reason:u.EvaluationReason.Uninitialized,time:0}},a.initializeCalled=function(){return null!=a.instance&&a.instance.initializeCalled()},a.Yt=function(){if(a.instance)return a.instance;throw new r.StatsigUninitializedError},a.instance=null,n.default=a},477:function(t,n){var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)};function u(){}Object.defineProperty(n,"v",{value:!0}),u.isValid=function(t,n){try{var i,e,r=n.evaluated_keys;return r&&"object"==typeof r?(i=this.copyObject(r),e=null==t?null:this.copyObject(t),u.validate(i,e)&&u.validate(e,i)):!0}catch(t){}return!0},u.validate=function(t,n){if(null==t)return null==n;if(null==n)return!1;for(var i=0,e=Object.entries(t);i<e.length;i++){var r=e[i],u=r[0],r=r[1];if("stableID"!==u){if(typeof r!=typeof n[u])return!1;if("string"!=typeof r)return"object"==typeof r&&this.validate(r,n[u]);if(r!==n[u])return!1}}return!0},u.copyObject=function(t){var n;return null==t?null:(n={},null!=t&&t.userID&&(n.userID=null==t?void 0:t.userID),null!=t&&t.customIDs&&(delete(t=i({},t.customIDs)).stableID,0!==Object.keys(t).length)&&(n.customIDs=t),n)},n.default=u},652:(t,n)=>{Object.defineProperty(n,"v",{value:!0}),n.LOCAL_STORAGE_KEYS=n.STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY=n.STATSIG_STABLE_ID_KEY=n.INTERNAL_STORE_KEY=void 0,n.INTERNAL_STORE_KEY="STATSIG_STORE",n.STATSIG_STABLE_ID_KEY="STATSIG_STABLE_ID",n.STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY="STATSIG_LOGS",n.LOCAL_STORAGE_KEYS={INTERNAL_STORE_KEY:!0,STATSIG_STABLE_ID_KEY:!0,STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY:!0}},898:(t,n)=>{function s(t){for(var n=0,i=0;i<t.length;i++){n=(n<<5)-n+t.charCodeAt(i);n&=n}return String(n>>>0)}Object.defineProperty(n,"v",{value:!0}),n.getUserCacheKey=n.getHashValue=n.SimpleHash=void 0,n.SimpleHash=s,n.getHashValue=s,n.getUserCacheKey=function(t){var n="userID:".concat(String(null!=(i=null==t?void 0:t.userID)?i:"")),i=null==t?void 0:t.customIDs;if(null!=i)for(var e=0,r=Object.entries(i);e<r.length;e++){var u=r[e],o=u[0],u=u[1];n+=";".concat(o,":").concat(u)}return s(n)}},682:(t,n)=>{function i(){}Object.defineProperty(n,"v",{value:!0}),i.getItem=function(t){try{if(this.isStorageAccessible())return window.localStorage.getItem(t)}catch(t){}return null!=(t=this.fallbackSessionCache[t])?t:null},i.setItem=function(t,n){try{if(this.isStorageAccessible())return void window.localStorage.setItem(t,n)}catch(t){}this.fallbackSessionCache[t]=n},i.removeItem=function(t){try{if(this.isStorageAccessible())return void window.localStorage.removeItem(t)}catch(t){}delete this.fallbackSessionCache[t]},i.isStorageAccessible=function(t){void 0===t&&(t=!1),null==this.canAccessStorageAccessible&&(this.canAccessStorageAccessible="undefined"!=typeof Storage&&"undefined"!=typeof window&&null!=window&&null!=window.localStorage);var n=this.canAccessStorageAccessible;return(t||!this.disabled)&&n},i.disabled=!1,i.fallbackSessionCache={},i.canAccessStorageAccessible=null,n.default=i},28:(t,n)=>{function i(){return"undefined"!=typeof performance&&performance?0|performance.now():Date.now()}Object.defineProperty(n,"v",{value:!0}),n.difference=n.now=void 0,n.now=i,n.difference=function(t){return i()-t}}},r={};return function t(n){var i=r[n];return void 0===i&&(i=r[n]={exports:{}},e[n].call(i.exports,i,i.exports,t)),i.exports}(607).default})()); |
@@ -1,1 +0,1 @@ | ||
export declare const version = "1.0.0-beta.2"; | ||
export declare const version = "1.0.0-beta.4"; |
@@ -5,2 +5,2 @@ "use strict"; | ||
// Generated by genversion. | ||
exports.version = '1.0.0-beta.2'; | ||
exports.version = '1.0.0-beta.4'; |
{ | ||
"name": "statsig-js-lite", | ||
"version": "1.0.0-beta.2", | ||
"version": "1.0.0-beta.4", | ||
"description": "A slimmed version of the Statsig JavaScript client SDK for single user environments.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |