Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

launchdarkly-js-sdk-common

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

launchdarkly-js-sdk-common - npm Package Compare versions

Comparing version 3.7.0 to 3.8.0

2

dist/ldclient-common.cjs.js

@@ -1,2 +0,2 @@

"use strict";function ownKeys(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function _objectSpread2(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function createCustomError(e){function t(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=t}return(t.prototype=new Error).name=e,t.prototype.constructor=t}Object.defineProperty(exports,"__esModule",{value:!0});var LDUnexpectedResponseError=createCustomError("LaunchDarklyUnexpectedResponseError"),LDInvalidEnvironmentIdError=createCustomError("LaunchDarklyInvalidEnvironmentIdError"),LDInvalidUserError=createCustomError("LaunchDarklyInvalidUserError"),LDInvalidEventKeyError=createCustomError("LaunchDarklyInvalidEventKeyError"),LDInvalidArgumentError=createCustomError("LaunchDarklyInvalidArgumentError"),LDFlagFetchError=createCustomError("LaunchDarklyFlagFetchError"),LDInvalidDataError=createCustomError("LaunchDarklyInvalidDataError");function isHttpErrorRecoverable(e){return!(400<=e&&e<500)||(400===e||408===e||429===e)}for(var errors=Object.freeze({__proto__:null,LDUnexpectedResponseError:LDUnexpectedResponseError,LDInvalidEnvironmentIdError:LDInvalidEnvironmentIdError,LDInvalidUserError:LDInvalidUserError,LDInvalidEventKeyError:LDInvalidEventKeyError,LDInvalidArgumentError:LDInvalidArgumentError,LDFlagFetchError:LDFlagFetchError,LDInvalidDataError:LDInvalidDataError,isHttpErrorRecoverable:isHttpErrorRecoverable}),fromByteArray_1=fromByteArray,lookup=[],revLookup=[],code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;function tripletToBase64(e){return lookup[e>>18&63]+lookup[e>>12&63]+lookup[e>>6&63]+lookup[63&e]}function encodeChunk(e,t,n){for(var r,o=[],i=t;i<n;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(tripletToBase64(r));return o.join("")}function fromByteArray(e){for(var t,n=e.length,r=n%3,o=[],i=16383,a=0,s=n-r;a<s;a+=i)o.push(encodeChunk(e,a,s<a+i?s:a+i));return 1==r?(t=e[n-1],o.push(lookup[t>>2]+lookup[t<<4&63]+"==")):2==r&&(t=(e[n-2]<<8)+e[n-1],o.push(lookup[t>>10]+lookup[t>>4&63]+lookup[t<<2&63]+"=")),o.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;var isArray=Array.isArray,keyList=Object.keys,hasProp=Object.prototype.hasOwnProperty,fastDeepEqual=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){var r,o,i=isArray(t),a=isArray(n);if(i&&a){if((s=t.length)!=n.length)return!1;for(r=s;0!=r--;)if(!e(t[r],n[r]))return!1}else{if(i!=a)return!1;i=t instanceof Date,a=n instanceof Date;if(i!=a)return!1;if(i&&a)return t.getTime()==n.getTime();i=t instanceof RegExp,a=n instanceof RegExp;if(i!=a)return!1;if(i&&a)return t.toString()==n.toString();var s,u=keyList(t);if((s=u.length)!==keyList(n).length)return!1;for(r=s;0!=r--;)if(!hasProp.call(n,u[r]))return!1;for(r=s;0!=r--;)if(!e(t[o=u[r]],n[o]))return!1}return!0}return t!=t&&n!=n},userAttrsToStringify=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function appendUrlPath(e,t){return(e.endsWith("/")?e.substring(0,e.length-1):e)+(t.startsWith("/")?"":"/")+t}function btoa(e){e=unescape(encodeURIComponent(e));return fromByteArray_1(stringToBytes(e))}function stringToBytes(e){for(var t=[],n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t}function base64URLEncode(e){return btoa(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function clone(e){return JSON.parse(JSON.stringify(e))}function deepEquals(e,t){return fastDeepEqual(e,t)}function onNextTick(e){setTimeout(e,0)}function wrapPromiseCallback(e,t){e=e.then(function(e){return t&&setTimeout(function(){t(null,e)},0),e},function(e){if(!t)return Promise.reject(e);setTimeout(function(){t(e,null)},0)});return t?void 0:e}function transformValuesToVersionedValues(e){var t,n={};for(t in e)objectHasOwnProperty(e,t)&&(n[t]={value:e[t],version:0});return n}function transformVersionedValuesToValues(e){var t,n={};for(t in e)objectHasOwnProperty(e,t)&&(n[t]=e[t].value);return n}function chunkUserEventsForUrl(e,t){for(var n,r=t.slice(0),o=[],i=e;0<r.length;){for(n=[];0<i;){var a=r.shift();if(!a)break;(i-=base64URLEncode(JSON.stringify(a)).length)<0&&0<n.length?r.unshift(a):n.push(a)}i=e,o.push(n)}return o}function getLDUserAgentString(e){var t=e.version||"3.7.0";return e.userAgent+"/"+t}function extend(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce(function(e,t){return _objectSpread2(_objectSpread2({},e),t)},{})}function objectHasOwnProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function sanitizeUser(e){if(!e)return e;var t,n;for(n in userAttrsToStringify){var r=userAttrsToStringify[n],o=e[r];void 0!==o&&"string"!=typeof o&&((t=t||_objectSpread2({},e))[r]=String(o))}return t||e}var utils=Object.freeze({__proto__:null,appendUrlPath:appendUrlPath,btoa:btoa,base64URLEncode:base64URLEncode,clone:clone,deepEquals:deepEquals,onNextTick:onNextTick,wrapPromiseCallback:wrapPromiseCallback,transformValuesToVersionedValues:transformValuesToVersionedValues,transformVersionedValuesToValues:transformVersionedValuesToValues,chunkUserEventsForUrl:chunkUserEventsForUrl,getLDUserAgentString:getLDUserAgentString,extend:extend,objectHasOwnProperty:objectHasOwnProperty,sanitizeUser:sanitizeUser});function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}for(var rngBrowser=createCommonjsModule(function(e){var t,n,r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);r?(t=new Uint8Array(16),e.exports=function(){return r(t),t}):(n=new Array(16),e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n})}),byteToHex=[],i$1=0;i$1<256;++i$1)byteToHex[i$1]=(i$1+256).toString(16).substr(1);function bytesToUuid(e,t){var t=t||0,n=byteToHex;return[n[e[t++]],n[e[t++]],n[e[t++]],n[e[t++]],"-",n[e[t++]],n[e[t++]],"-",n[e[t++]],n[e[t++]],"-",n[e[t++]],n[e[t++]],"-",n[e[t++]],n[e[t++]],n[e[t++]],n[e[t++]],n[e[t++]],n[e[+t]]].join("")}var _nodeId,_clockseq,bytesToUuid_1=bytesToUuid,_lastMSecs=0,_lastNSecs=0;function v1(e,t,n){var r=t&&n||0,o=t||[],i=(e=e||{}).node||_nodeId,n=void 0!==e.clockseq?e.clockseq:_clockseq,a=(null!=i&&null!=n||(a=rngBrowser(),null==i&&(i=_nodeId=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==n&&(n=_clockseq=16383&(a[6]<<8|a[7]))),void 0!==e.msecs?e.msecs:(new Date).getTime()),s=void 0!==e.nsecs?e.nsecs:_lastNSecs+1,u=a-_lastMSecs+(s-_lastNSecs)/1e4;if(u<0&&void 0===e.clockseq&&(n=n+1&16383),1e4<=(s=(u<0||_lastMSecs<a)&&void 0===e.nsecs?0:s))throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=a,_clockseq=n;u=(1e4*(268435455&(a+=122192928e5))+(_lastNSecs=s))%4294967296,o[r++]=u>>>24&255,o[r++]=u>>>16&255,o[r++]=u>>>8&255,o[r++]=255&u,e=a/4294967296*1e4&268435455;o[r++]=e>>>8&255,o[r++]=255&e,o[r++]=e>>>24&15|16,o[r++]=e>>>16&255,o[r++]=n>>>8|128,o[r++]=255&n;for(var c=0;c<6;++c)o[r+c]=i[c];return t||bytesToUuid_1(o)}var v1_1=v1,logLevels=["debug","info","warn","error","none"];function commonBasicLogger(e,s){if(e&&e.destination&&"function"!=typeof e.destination)throw new Error("destination for basicLogger was set to a non-function");function t(t){return function(e){console&&console[t]&&console[t].call(console,e)}}var u=e&&e.destination?[e.destination,e.destination,e.destination,e.destination]:[t("log"),t("info"),t("warn"),t("error")],c=!(!e||!e.destination),l=e&&void 0!==e.prefix&&null!==e.prefix?e.prefix:"[LaunchDarkly] ",n=1;if(e&&e.level)for(var r=0;r<logLevels.length;r++)logLevels[r]===e.level&&(n=r);for(var o={},i=function(e){var i,a=logLevels[e];"none"!==a&&(e<n?o[a]=function(){}:(i=e,o[a]=function(){var e=i,t=a,n=arguments;if(!(n.length<1)){var r=c?t+": "+l:l,o=1!==n.length&&s?((o=_toConsumableArray(n))[0]=r+o[0],s.apply(void 0,_toConsumableArray(o))):r+n[0];try{u[e](o)}catch(e){console&&console.log&&console.log("[LaunchDarkly] Configured logger's "+t+" method threw an exception: "+e)}}}))},a=0;a<logLevels.length;a++)i(a);return o}function validateLogger(t){logLevels.forEach(function(e){if("none"!==e&&(!t[e]||"function"!=typeof t[e]))throw new Error("Provided logger instance must support logger."+e+"(...) method")})}function createConsoleLogger(e,t){return commonBasicLogger({level:e,prefix:t})}function errorString(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var clientInitialized=function(){return"LaunchDarkly client initialized"},docLink=" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initializing-the-client for instructions on SDK initialization.",clientNotReady=function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded=function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},eventWithoutUser=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"},invalidContentType=function(e){return'Expected application/json content type but got "'+e+'"'},invalidKey=function(){return"Event key must be a string"},localStorageUnavailable=function(e){return"local storage is unavailable: "+errorString(e)},networkError=function(e){return"network error"+(e?" ("+e+")":"")},unknownCustomEventKey=function(e){return'Custom event "'+e+'" does not exist'},environmentNotFound=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+docLink},environmentNotSpecified=function(){return"No environment/client-side ID was specified."+docLink},errorFetchingFlags=function(e){return"Error fetching flag settings: "+errorString(e)},userNotSpecified=function(){return"No user specified."+docLink},invalidUser=function(){return"Invalid user specified."+docLink},invalidData=function(){return"Invalid data received from LaunchDarkly; connection may have been interrupted"},bootstrapOldFormat=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+docLink},bootstrapInvalid=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},deprecated=function(e,t){return t?'"'+e+'" is deprecated, please use "'+t+'"':'"'+e+'" is deprecated'},httpErrorMessage=function(e,t,n){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+t+" - "+(isHttpErrorRecoverable(e)?n:"giving up permanently")},httpUnavailable=function(){return"Cannot make HTTP requests in this environment."+docLink},identifyDisabled=function(){return"identify() has no effect here; it must be called on the main client instance"},streamClosing=function(){return"Closing stream connection"},streamConnecting=function(e){return"Opening stream connection to "+e},streamError=function(e,t){return"Error on stream connection: "+errorString(e)+", will continue retrying every "+t+" milliseconds."},unknownOption=function(e){return'Ignoring unknown config option "'+e+'"'},wrongOptionType=function(e,t,n){return'Config option "'+e+'" should be of type '+t+", got "+n+", using default value"},wrongOptionTypeBoolean=function(e,t){return'Config option "'+e+'" should be a boolean, got '+t+", converting to boolean"},optionBelowMinimum=function(e,t,n){return'Config option "'+e+'" was set to '+t+", changing to minimum value of "+n},debugPolling=function(e){return"polling for feature flags at "+e},debugStreamPing=function(){return"received ping message from stream"},debugStreamPut=function(){return"received streaming update for all flags"},debugStreamPatch=function(e){return'received streaming update for flag "'+e+'"'},debugStreamPatchIgnored=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},debugStreamDelete=function(e){return'received streaming deletion for flag "'+e+'"'},debugStreamDeleteIgnored=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},debugEnqueueingEvent=function(e){return'enqueueing "'+e+'" event'},debugPostingEvents=function(e){return"sending "+e+" events"},debugPostingDiagnosticEvent=function(e){return"sending diagnostic event ("+e.kind+")"},invalidTagValue=function(e){return'Config option "'.concat(e,'" must only contain letters, numbers, ., _ or -.')},messages=Object.freeze({__proto__:null,clientInitialized:clientInitialized,clientNotReady:clientNotReady,eventCapacityExceeded:eventCapacityExceeded,eventWithoutUser:eventWithoutUser,invalidContentType:invalidContentType,invalidKey:invalidKey,localStorageUnavailable:localStorageUnavailable,networkError:networkError,unknownCustomEventKey:unknownCustomEventKey,environmentNotFound:environmentNotFound,environmentNotSpecified:environmentNotSpecified,errorFetchingFlags:errorFetchingFlags,userNotSpecified:userNotSpecified,invalidUser:invalidUser,invalidData:invalidData,bootstrapOldFormat:bootstrapOldFormat,bootstrapInvalid:bootstrapInvalid,deprecated:deprecated,httpErrorMessage:httpErrorMessage,httpUnavailable:httpUnavailable,identifyDisabled:identifyDisabled,streamClosing:streamClosing,streamConnecting:streamConnecting,streamError:streamError,unknownOption:unknownOption,wrongOptionType:wrongOptionType,wrongOptionTypeBoolean:wrongOptionTypeBoolean,optionBelowMinimum:optionBelowMinimum,debugPolling:debugPolling,debugStreamPing:debugStreamPing,debugStreamPut:debugStreamPut,debugStreamPatch:debugStreamPatch,debugStreamPatchIgnored:debugStreamPatchIgnored,debugStreamDelete:debugStreamDelete,debugStreamDeleteIgnored:debugStreamDeleteIgnored,debugEnqueueingEvent:debugEnqueueingEvent,debugPostingEvents:debugPostingEvents,debugPostingDiagnosticEvent:debugPostingDiagnosticEvent,invalidTagValue:invalidTagValue}),baseOptionDefs={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},requestHeaderTransform:{type:"function"},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},diagnosticRecordingInterval:{default:9e5,minimum:2e3},diagnosticOptOut:{default:!1},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"},autoAliasingOptOut:{default:!1},application:{validator:applicationConfigValidator}},allowedTagCharacters=/^(\w|\.|-)+$/;function validateTagValue(e,t,n,r){if("string"==typeof n&&n.match(allowedTagCharacters))return n;r.warn(invalidTagValue(e))}function applicationConfigValidator(e,t,n,r){var o={};return n.id&&(o.id=validateTagValue("".concat(e,".id"),t,n.id,r)),n.version&&(o.version=validateTagValue("".concat(e,".version"),t,n.version,r)),o}function validate(e,t,n,a){var s=extend({logger:{default:a}},baseOptionDefs,n),r={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null,allowFrequentDuplicateEvents:void 0};function u(e){onNextTick(function(){t&&t.maybeReportError(new LDInvalidArgumentError(e))})}var o,i,c,l,n=extend({},e||{});function d(e){return null===e?"any":void 0!==e?Array.isArray(e)?"array":"boolean"===(e=_typeof(e))||"string"===e||"number"===e||"function"===e?e:"object":void 0}return o=n,Object.keys(r).forEach(function(e){var t;void 0!==o[e]&&(t=r[e],a&&a.warn(deprecated(e,t)),t&&(void 0===o[t]&&(o[t]=o[e]),delete o[e]))}),i=extend({},n),Object.keys(s).forEach(function(e){void 0!==i[e]&&null!==i[e]||(i[e]=s[e]&&s[e].default)}),l=extend({},c=n=i),Object.keys(c).forEach(function(e){var t,n,r,o,i=c[e];null!=i&&(void 0===(t=s[e])?u(unknownOption(e)):(n=t.type||d(t.default),(r=t.validator)?void 0!==(r=r(e,c,c[e],a))?l[e]=r:delete l[e]:"any"!==n&&(r=n.split("|"),o=d(i),r.indexOf(o)<0?"boolean"===n?(l[e]=!!i,u(wrongOptionTypeBoolean(e,o))):(u(wrongOptionType(e,n,o)),l[e]=t.default):"number"===o&&void 0!==t.minimum&&i<t.minimum&&(u(optionBelowMinimum(e,i,t.minimum)),l[e]=t.minimum))))}),validateLogger((n=l).logger),n}function getTags(e){var t={};return e&&(e.application&&void 0!==e.application.id&&null!==e.application.id&&(t["application-id"]=[e.application.id]),e.application&&void 0!==e.application.version&&null!==e.application.id&&(t["application-version"]=[e.application.version])),t}var configuration=Object.freeze({__proto__:null,baseOptionDefs:baseOptionDefs,validate:validate,getTags:getTags});function getLDHeaders(e,t){var n;return t&&!t.sendLDHeaders?{}:(e={"X-LaunchDarkly-User-Agent":getLDUserAgentString(e)},t&&t.wrapperName&&(e["X-LaunchDarkly-Wrapper"]=t.wrapperVersion?t.wrapperName+"/"+t.wrapperVersion:t.wrapperName),n=getTags(t),(t=Object.keys(n)).length&&(e["x-launchdarkly-tags"]=t.sort().flatMap(function(t){return Array.isArray(n[t])?n[t].sort().map(function(e){return"".concat(t,"/").concat(e)}):["".concat(t,"/").concat(n[t])]}).join(" ")),e)}function transformHeaders(e,t){return t&&t.requestHeaderTransform?t.requestHeaderTransform(_objectSpread2({},e)):e}var MAX_URL_LENGTH=2e3;function EventSender(s,e,u){var c="/a/"+e+".gif",l=extend({"Content-Type":"application/json"},getLDHeaders(s,u)),d=s.httpFallbackPing,f={};return f.sendChunk=function(e,t,r,n){var o=JSON.stringify(e),i=r?null:v1_1();function a(n){var e=r?l:extend({},l,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":i});return s.httpRequest("POST",t,transformHeaders(e,u),o).promise.then(function(e){var t;if(e)return 400<=e.status&&isHttpErrorRecoverable(e.status)&&n?a(!1):(t={status:(e=e).status},(e=e.header("date"))&&(e=Date.parse(e))&&(t.serverTime=e),t)}).catch(function(){return n?a(!1):Promise.reject()})}return n?a(!0).catch(function(){}):(d&&d(t+c+"?d="+base64URLEncode(o)),Promise.resolve())},f.sendEvents=function(e,t,n){if(!s.httpRequest)return Promise.resolve();for(var r=s.httpAllowsPost(),o=r?[e]:chunkUserEventsForUrl(MAX_URL_LENGTH-t.length,e),i=[],a=0;a<o.length;a++)i.push(f.sendChunk(o[a],t,n,r));return Promise.all(i)},f}function EventSummarizer(){var e={},a=0,s=0,u={};return e.summarizeEvent=function(e){var t,n;"feature"===e.kind&&(t=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),(n=u[t])?n.count=n.count+1:u[t]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===a||e.creationDate<a)&&(a=e.creationDate),e.creationDate>s&&(s=e.creationDate))},e.getSummary=function(){var e,t={},n=!0;for(e in u){var r=u[e],o=t[r.key],i=(o||(o={default:r.default,counters:[]},t[r.key]=o),{value:r.value,count:r.count});void 0!==r.variation&&null!==r.variation&&(i.variation=r.variation),r.version?i.version=r.version:i.unknown=!0,o.counters.push(i),n=!1}return n?null:{startDate:a,endDate:s,features:t}},e.clearSummary=function(){s=a=0,u={}},e}function UserFilter(e){var t={},a=e.allAttributesPrivate,s=e.privateAttributeNames||[],u={key:!0,custom:!0,anonymous:!0},c={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0};return t.filterUser=function(e){var t,o,n,r,i;return e?(t=e.privateAttributeNames||[],o=function(e){return!u[e]&&(a||-1!==t.indexOf(e)||-1!==s.indexOf(e))},n=(r=(i=function(n,r){return Object.keys(n).reduce(function(e,t){return r(t)&&(o(t)?e[1][t]=!0:e[0][t]=n[t]),e},[{},{}])})(e,function(e){return c[e]}))[0],r=r[1],e.custom&&(i=i(e.custom,function(){return 1}),n.custom=i[0],r=extend({},r,i[1])),(e=Object.keys(r)).length&&(e.sort(),n.privateAttrs=e),n):null},t}function EventProcessor(e,t,n){var r,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:null,a={},s=(5<arguments.length&&void 0!==arguments[5]?arguments[5]:null)||EventSender(e,n,t),u=appendUrlPath(t.eventsUrl,"/events/bulk/"+n),c=EventSummarizer(),l=UserFilter(t),d=t.inlineUsersInEvents,f=t.samplingInterval,v=t.eventCapacity,g=t.flushInterval,p=t.logger,m=[],y=0,h=!1,b=!1;function E(){return 0===f||0===Math.floor(Math.random()*f)}function k(e){m.length<v?(m.push(e),b=!1):(b||(b=!0,p.warn(eventCapacityExceeded())),o&&o.incrementDroppedEvents())}return a.enqueue=function(e){var t,n,r;h||(t=r=!1,c.summarizeEvent(e),"feature"===e.kind?E()&&(r=!!e.trackEvents,t=!!(n=e).debugEventsUntilDate&&(n.debugEventsUntilDate>y&&n.debugEventsUntilDate>(new Date).getTime())):r=E(),r&&k((r=extend({},n=e),"alias"!==n.kind&&(d||"identify"===n.kind?r.user=l.filterUser(n.user):(r.userKey=n.user.key,delete r.user),"feature"===n.kind&&(delete r.trackEvents,delete r.debugEventsUntilDate)),r)),t&&((r=extend({},e,{kind:"debug"})).user=l.filterUser(r.user),delete r.trackEvents,delete r.debugEventsUntilDate,k(r)))},a.flush=function(){var e,t;return h||(e=m,t=c.getSummary(),c.clearSummary(),t&&(t.kind="summary",e.push(t)),o&&o.setEventsInLastBatch(e.length),0===e.length)?Promise.resolve():(m=[],p.debug(debugPostingEvents(e.length)),s.sendEvents(e,u).then(function(e){e&&(e.serverTime&&(y=e.serverTime),isHttpErrorRecoverable(e.status)||(h=!0),400<=e.status&&onNextTick(function(){i.maybeReportError(new LDUnexpectedResponseError(httpErrorMessage(e.status,"event posting","some events were dropped")))}))}))},a.start=function(){r=setTimeout(function e(){a.flush(),r=setTimeout(e,g)},g)},a.stop=function(){clearTimeout(r)},a}function EventEmitter(t){var e={},o={};return e.on=function(e,t,n){o[e]=o[e]||[],o[e]=o[e].concat({handler:t,context:n})},e.off=function(e,t,n){if(o[e])for(var r=0;r<o[e].length;r++)o[e][r].handler===t&&o[e][r].context===n&&(o[e]=o[e].slice(0,r).concat(o[e].slice(r+1)))},e.emit=function(e){if(o[e])for(var t=o[e].slice(0),n=0;n<t.length;n++)t[n].handler.apply(t[n].context,Array.prototype.slice.call(arguments,1))},e.getEvents=function(){return Object.keys(o)},e.getEventListenerCount=function(e){return o[e]?o[e].length:0},e.maybeReportError=function(e){e&&(o["error"]?this.emit("error",e):(t||console).error(e.message))},e}var readyEvent="ready",successEvent="initialized",failureEvent="failed";function InitializationStateTracker(o){var t=!1,n=!1,r=null,e=null,i=new Promise(function(t){o.on(readyEvent,function e(){o.off(readyEvent,e),t()})}).catch(function(){});return{getInitializationPromise:function(){if(!e){if(t)return Promise.resolve();if(n)return Promise.reject(r);e=new Promise(function(t,n){function r(e){o.off(failureEvent,r),n(e)}o.on(successEvent,function e(){o.off(successEvent,e),t()}),o.on(failureEvent,r)})}return e},getReadyPromise:function(){return i},signalSuccess:function(){t||n||(t=!0,o.emit(successEvent),o.emit(readyEvent))},signalFailure:function(e){t||n||(n=!0,r=e,o.emit(failureEvent,e),o.emit(readyEvent)),o.maybeReportError(e)}}}var InitializationState=InitializationStateTracker;function PersistentFlagStore(t,n,r,o){var i={};function a(){var e="",t=o.getUser();return t&&(e=r||btoa(JSON.stringify(t))),"ld:"+n+":"+e}return i.loadFlags=function(){return t.get(a()).then(function(e){if(null==e)return null;try{var t,n=JSON.parse(e);return n&&(void 0===(t=n.$schema)||t<1?n=transformValuesToVersionedValues(n):delete n.$schema),n}catch(e){return i.clearFlags().then(function(){return null})}})},i.saveFlags=function(e){e=extend({},e,{$schema:1});return t.set(a(),JSON.stringify(e))},i.clearFlags=function(){return t.clear(a())},i}function PersistentStorage(r,t){function o(e){n||(n=!0,t.warn(localStorageUnavailable(e)))}var e={},n=!1;return e.isEnabled=function(){return!!r},e.get=function(e){return new Promise(function(t){r?r.get(e).then(t).catch(function(e){o(e),t(void 0)}):t(void 0)})},e.set=function(e,n){return new Promise(function(t){r?r.set(e,n).then(function(){return t(!0)}).catch(function(e){o(e),t(!1)}):t(!1)})},e.clear=function(e){return new Promise(function(t){r?r.clear(e).then(function(){return t(!0)}).catch(function(e){o(e),t(!1)}):t(!1)})},e}var streamReadTimeoutMillis=3e5;function Stream(o,i,a,t){var s,u=i.streamUrl,c=i.logger,e={},l=appendUrlPath(u,"/eval/"+a),d=i.useReport,f=i.evaluationReasons,n=i.streamReconnectDelay,v=getLDHeaders(o,i),g=!1,p=null,m=null,y=null,h=null,b=null;function E(e){g||(c.warn(streamError(e,n)),g=!0),S(!1),D(),k(n)}function k(e){m||(e?m=setTimeout(r,e):r())}function r(){m=null;var e,t="",n={headers:v,readTimeoutMillis:streamReadTimeoutMillis};if(o.eventSourceFactory){for(var r in null!=h&&(t="h="+h),d?o.eventSourceAllowsReport?(e=l,n.method="REPORT",n.headers["Content-Type"]="application/json",n.body=JSON.stringify(y)):(e=appendUrlPath(u,"/ping/"+a),t=""):e=l+"/"+base64URLEncode(JSON.stringify(y)),n.headers=transformHeaders(n.headers,i),e=e+((t=f?t+(t?"&":"")+"withReasons=true":t)?"?":"")+t,D(),c.info(streamConnecting(e)),s=(new Date).getTime(),p=o.eventSourceFactory(e,n),b)objectHasOwnProperty(b,r)&&p.addEventListener(r,b[r]);p.onerror=E}}function D(){p&&(c.info(streamClosing()),p.close(),p=null)}function S(e){s&&t&&t.recordStreamInit(s,!e,(new Date).getTime()-s),s=null}return e.connect=function(e,t,n){y=e,h=t,b={};for(var r in n||{})!function(t){b[t]=function(e){S(!(g=!1)),n[t]&&n[t](e)}}(r);k()},e.disconnect=function(){clearTimeout(m),m=null,D()},e.isConnected=function(){return!!(p&&o.eventSourceIsActive&&o.eventSourceIsActive(p))},e}function promiseCoalescer(n){var r,o,i,a,e={addPromise:function(t,e){r=t,o&&o(),o=e,t.then(function(e){r===t&&(i(e),n&&n())},function(e){r===t&&(a(e),n&&n())})}};return e.resultPromise=new Promise(function(e,t){i=e,a=t}),e}var jsonContentType="application/json";function getResponseError(e){return 404===e.status?new LDInvalidEnvironmentIdError(environmentNotFound()):new LDFlagFetchError(errorFetchingFlags(e.statusText||String(e.status)))}function Requestor(a,s,i){var u=s.baseUrl,c=s.useReport,l=s.evaluationReasons,d=s.logger,e={},f={};function v(e,t){var n,r,o,i;return a.httpRequest?(i=t?"REPORT":"GET",n=getLDHeaders(a,s),t&&(n["Content-Type"]=jsonContentType),(r=f[e])||(r=promiseCoalescer(function(){delete f[e]}),f[e]=r),i=(o=a.httpRequest(i,e,transformHeaders(n,s),t)).promise.then(function(e){var t;return 200===e.status?e.header("content-type")&&e.header("content-type").substring(0,jsonContentType.length)===jsonContentType?JSON.parse(e.body):(t=invalidContentType(e.header("content-type")||""),Promise.reject(new LDFlagFetchError(t))):Promise.reject(getResponseError(e))},function(e){return Promise.reject(new LDFlagFetchError(networkError(e)))}),r.addPromise(i,function(){o.cancel&&o.cancel()}),r.resultPromise):new Promise(function(e,t){t(new LDFlagFetchError(httpUnavailable()))})}return e.fetchJSON=function(e){return v(appendUrlPath(u,e),null)},e.fetchFlagSettings=function(e,t){var n,r,o="";return c?(n=[u,"/sdk/evalx/",i,"/user"].join(""),r=JSON.stringify(e)):(e=base64URLEncode(JSON.stringify(e)),n=[u,"/sdk/evalx/",i,"/users/",e].join("")),t&&(o="h="+t),d.debug(debugPolling(n=n+((o=l?o+(o?"&":"")+"withReasons=true":o)?"?":"")+o)),v(n,r)},e}function Identity(e,n){var r,t={setUser:function(e){var t=r&&clone(r);(r=sanitizeUser(e))&&n&&n(clone(r),t)},getUser:function(){return r?clone(r):null}};return e&&t.setUser(e),t}var ldUserIdKey="ld:$anonUserId";function UserValidator(n){var e={};return e.validateUser=function(e){var t;return e?null!==(t=clone(e)).key&&void 0!==t.key?(t.key=t.key.toString(),Promise.resolve(t)):t.anonymous?n.get(ldUserIdKey).then(function(e){return e?(t.key=e,t):(e=v1_1(),t.key=e,n.set(ldUserIdKey,e).then(function(){return t}))}):Promise.reject(new LDInvalidUserError(invalidUser())):Promise.reject(new LDInvalidUserError(userNotSpecified()))},e}var baseOptionDefs$1=configuration.baseOptionDefs,appendUrlPath$1=utils.appendUrlPath;function DiagnosticId(e){var t={diagnosticId:v1_1()};return e&&(t.sdkKeySuffix=6<e.length?e.substring(e.length-6):e),t}function DiagnosticsAccumulator(e){var t,n,r,o;function i(e){t=e,r=n=0,o=[]}return i(e),{getProps:function(){return{dataSinceDate:t,droppedEvents:n,eventsInLastBatch:r,streamInits:o}},setProps:function(e){t=e.dataSinceDate,n=e.droppedEvents||0,r=e.eventsInLastBatch||0,o=e.streamInits||[]},incrementDroppedEvents:function(){n++},setEventsInLastBatch:function(e){r=e},recordStreamInit:function(e,t,n){o.push({timestamp:e,failed:t,durationMillis:n})},reset:i}}function DiagnosticsManager(t,r,e,n,o,i,a){var s,u,c=!!t.diagnosticUseCombinedEvent,l="ld:"+o+":$diagnostics",d=appendUrlPath$1(i.eventsUrl,"/events/diagnostic/"+o),f=i.diagnosticRecordingInterval,v=e,g=!!i.streaming,o={};function p(){return{sdk:function(){var e=_objectSpread2({},t.diagnosticSdkData);i.wrapperName&&(e.wrapperName=i.wrapperName);i.wrapperVersion&&(e.wrapperVersion=i.wrapperVersion);return e}(),configuration:{customBaseURI:i.baseUrl!==baseOptionDefs$1.baseUrl.default,customStreamURI:i.streamUrl!==baseOptionDefs$1.streamUrl.default,customEventsURI:i.eventsUrl!==baseOptionDefs$1.eventsUrl.default,eventsCapacity:i.eventCapacity,eventsFlushIntervalMillis:i.flushInterval,reconnectTimeMillis:i.streamReconnectDelay,streamingDisabled:!g,allAttributesPrivate:!!i.allAttributesPrivate,inlineUsersInEvents:!!i.inlineUsersInEvents,diagnosticRecordingIntervalMillis:i.diagnosticRecordingInterval,usingSecureMode:!!i.hash,bootstrapMode:!!i.bootstrap,fetchGoalsDisabled:!i.fetchGoals,sendEventsOnlyForVariation:!!i.sendEventsOnlyForVariation,autoAliasingOptOut:!!i.autoAliasingOptOut},platform:t.diagnosticPlatformData}}function m(e){i.logger&&i.logger.debug(messages.debugPostingDiagnosticEvent(e)),n.sendEvents(e,d,!0).then(function(){}).catch(function(){})}function y(){var e,t;m((t=(new Date).getTime(),e=_objectSpread2({kind:c?"diagnostic-combined":"diagnostic",id:a,creationDate:t},v.getProps()),c&&(e=_objectSpread2(_objectSpread2({},e),p())),v.reset(t),e)),u=setTimeout(y,f),s=(new Date).getTime(),c&&r.isEnabled()&&(t=_objectSpread2({},v.getProps()),r.set(l,JSON.stringify(t)))}return o.start=function(){var n;c?(n=function(e){var t;e?(e=(s||0)+f)<=(t=(new Date).getTime())?y():u=setTimeout(y,e-t):0===Math.floor(4*Math.random())?y():u=setTimeout(y,f)},r.isEnabled()?r.get(l).then(function(e){if(e)try{var t=JSON.parse(e);v.setProps(t),s=t.dataSinceDate}catch(e){}n(!0)}).catch(function(){n(!1)}):n(!1)):(m(_objectSpread2({kind:"diagnostic-init",id:a,creationDate:v.getProps().dataSinceDate},p())),u=setTimeout(y,f))},o.stop=function(){u&&clearTimeout(u)},o.setStreaming=function(e){g=e},o}var diagnosticEvents={DiagnosticId:DiagnosticId,DiagnosticsAccumulator:DiagnosticsAccumulator,DiagnosticsManager:DiagnosticsManager},diagnosticEvents_1=diagnosticEvents.DiagnosticId,diagnosticEvents_2=diagnosticEvents.DiagnosticsAccumulator,diagnosticEvents_3=diagnosticEvents.DiagnosticsManager,changeEvent="change",internalChangeEvent="internal-change";function initialize(A,x,e,o,t){var n,i,r,a,N,s,u,c=function(){if(e&&e.logger)return e.logger;return t&&t.logger&&t.logger.default||createConsoleLogger("warn")}(),l=EventEmitter(c),d=InitializationState(l),f=validate(e,l,t,c),v=f.sendEvents,g=A,p=f.hash,m=PersistentStorage(o.localStorage,c),V=EventSender(o,g,f),y=f.sendEvents&&!f.diagnosticOptOut,h=y?diagnosticEvents_1(g):null,b=y?diagnosticEvents_2((new Date).getTime()):null,E=y?diagnosticEvents_3(o,m,b,V,g,f,h):null,q=Stream(o,f,g,b),k=f.eventProcessor||EventProcessor(o,f,g,b,l,V),D=Requestor(o,f,g),S={},w=f.streaming,M=!1,P=!1,U=!0,T=f.stateProvider,L=Identity(null,function(e,t){(function(e){T||e&&I({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})})(e),!f.autoAliasingOptOut&&t&&t.anonymous&&e&&!e.anonymous&&K(e,t)}),H=UserValidator(m),O=m.isEnabled()?new PersistentFlagStore(m,g,p,L,c):null;function I(e){if(g&&!(T&&T.enqueueEvent&&T.enqueueEvent(e))){if("alias"!==e.kind){if(!e.user)return void(U&&(c.warn(eventWithoutUser()),U=!1));U=!1}!v||P||o.isDoNotTrack()||(c.debug(debugEnqueueingEvent(e.kind)),k.enqueue(e))}}function z(e,t,n,r){var o=L.getUser(),i=new Date,n={kind:"feature",key:e,user:o,value:t?t.value:null,variation:t?t.variationIndex:null,default:n,creationDate:i.getTime()},i=(o&&o.anonymous&&(n.contextKind=j(o)),S[e]);i&&(n.version=i.flagVersion||i.version,n.trackEvents=i.trackEvents,n.debugEventsUntilDate=i.debugEventsUntilDate),(r||i&&i.trackReason)&&t&&(n.reason=t.reason),I(n)}function C(e,t,n,r){var o,i;return S&&objectHasOwnProperty(S,e)&&S[e]&&!S[e].deleted?(i=_(o=S[e]),null!==o.value&&void 0!==o.value||(i.value=t)):i={value:t,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}},n&&z(e,i,t,r),i}function _(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function j(e){return e.anonymous?"anonymousUser":"user"}function K(e,t){T||e&&t&&I({kind:"alias",key:e.key,contextKind:j(e),previousKey:t.key,previousContextKind:j(t),creationDate:(new Date).getTime()})}function B(){var o;i=!0,L.getUser()&&(o=function(e){try{return JSON.parse(e)}catch(e){l.maybeReportError(new LDInvalidDataError(invalidData()))}},q.connect(L.getUser(),p,{ping:function(){c.debug(debugStreamPing());var t=L.getUser();D.fetchFlagSettings(t,p).then(function(e){deepEquals(t,L.getUser())&&F(e||{})}).catch(function(e){l.maybeReportError(new LDFlagFetchError(errorFetchingFlags(e)))})},put:function(e){e=o(e.data);e&&(c.debug(debugStreamPut()),F(e))},patch:function(e){var t,n,r,e=o(e.data);e&&(!(t=S[e.key])||!t.version||!e.version||t.version<e.version?(c.debug(debugStreamPatch(e.key)),n={},delete(r=extend({},e)).key,r=_(S[e.key]=r),n[e.key]=t?{previous:t.value,current:r}:{current:r},J(n)):c.debug(debugStreamPatchIgnored(e.key)))},delete:function(e){var t,e=o(e.data);e&&(!S[e.key]||S[e.key].version<e.version?(c.debug(debugStreamDelete(e.key)),t={},S[e.key]&&!S[e.key].deleted&&(t[e.key]={previous:S[e.key].value}),S[e.key]={version:e.version,deleted:!0},J(t)):c.debug(debugStreamDeleteIgnored(e.key)))}}))}function $(){i&&(q.disconnect(),i=!1)}function F(e){var t,n,r={};if(!e)return Promise.resolve();for(t in S)objectHasOwnProperty(S,t)&&S[t]&&(e[t]&&!deepEquals(e[t].value,S[t].value)?r[t]={previous:S[t].value,current:_(e[t])}:e[t]&&!e[t].deleted||(r[t]={previous:S[t].value}));for(n in e)objectHasOwnProperty(e,n)&&e[n]&&(!S[n]||S[n].deleted)&&(r[n]={current:_(e[n])});return S=_objectSpread2({},e),J(r).catch(function(){})}function J(o){var i,e=Object.keys(o);return 0<e.length&&(i={},e.forEach(function(e){var t=o[e].current,n=t?t.value:void 0,r=o[e].previous;l.emit(changeEvent+":"+e,n,r),i[e]=t?{current:n,previous:r}:{previous:r}}),l.emit(changeEvent,i),l.emit(internalChangeEvent,S),f.sendEventsOnlyForVariation||T||e.forEach(function(e){z(e,o[e].current)})),n&&O?O.saveFlags(S):Promise.resolve()}function W(){var e=w||r&&void 0===w;e&&!i?B():!e&&i&&$(),E&&E.setStreaming(e)}function G(e){return e===changeEvent||e.substr(0,changeEvent.length+1)===changeEvent+":"}function X(e){g=e.environment,L.setUser(e.user),S=_objectSpread2({},e.flags),onNextTick(R)}function R(){c.info(clientInitialized()),M=!0,W(),d.signalSuccess()}function Q(e){d.signalFailure(e)}return"string"==typeof f.bootstrap&&"LOCALSTORAGE"===f.bootstrap.toUpperCase()&&(O?n=!0:c.warn(localStorageUnavailable())),"object"===_typeof(f.bootstrap)&&(a=f.bootstrap,y=Object.keys(a),!(s=a[N="$flagsState"])&&y.length&&c.warn(bootstrapOldFormat()),!1===a.$valid&&c.warn(bootstrapInvalid()),u={},y.forEach(function(e){var t;e!==N&&"$valid"!==e&&(t={value:a[e]},s&&s[e]?t=extend(t,s[e]):t.version=0,u[e]=t)}),S=u),T?((h=T.getInitialState())?X(h):T.on("init",X),T.on("update",function(e){e.user&&L.setUser(e.user);e.flags&&F(e.flags)})):(A?H.validateUser(x).then(function(e){return L.setUser(e),"object"===_typeof(f.bootstrap)?R():n?O.loadFlags().then(function(e){return null==e?(S={},D.fetchFlagSettings(L.getUser(),p).then(function(e){return F(e||{})}).then(R).catch(function(e){Q(new LDFlagFetchError(errorFetchingFlags(e)))})):(S=e,onNextTick(R),D.fetchFlagSettings(L.getUser(),p).then(F).catch(function(e){return l.maybeReportError(e)}))}):D.fetchFlagSettings(L.getUser(),p).then(function(e){S=e||{},R()}).catch(function(e){S={},Q(e)})}):Promise.reject(new LDInvalidEnvironmentIdError(environmentNotSpecified()))).catch(Q),{client:{waitForInitialization:function(){return d.getInitializationPromise()},waitUntilReady:function(){return d.getReadyPromise()},identify:function(e,r,t){return P?wrapPromiseCallback(Promise.resolve({}),t):T?(c.warn(identifyDisabled()),wrapPromiseCallback(Promise.resolve(transformVersionedValuesToValues(S)),t)):wrapPromiseCallback((n&&O?O.clearFlags():Promise.resolve()).then(function(){return H.validateUser(e)}).then(function(n){return D.fetchFlagSettings(n,r).then(function(e){var t=transformVersionedValuesToValues(e);return L.setUser(n),p=r,e?F(e).then(function(){return t}):t})}).then(function(e){return i&&B(),e}).catch(function(e){return l.maybeReportError(e),Promise.reject(e)}),t)},getUser:function(){return L.getUser()},variation:function(e,t){return C(e,t,!0,!1).value},variationDetail:function(e,t){return C(e,t,!0,!0)},track:function(e,t,n){var r;"string"!=typeof e?l.maybeReportError(new LDInvalidEventKeyError(unknownCustomEventKey(e))):(o.customEventFilter&&!o.customEventFilter(e)&&c.warn(unknownCustomEventKey(e)),r={kind:"custom",key:e,user:e=L.getUser(),url:o.getCurrentUrl(),creationDate:(new Date).getTime()},e&&e.anonymous&&(r.contextKind=j(e)),null!=t&&(r.data=t),null!=n&&(r.metricValue=n),I(r))},alias:K,on:function(e,t,n){G(e)?(r=!0,M&&W(),l.on(e,t,n)):l.on.apply(l,arguments)},off:function(e){var t;l.off.apply(l,arguments),G(e)&&(t=!1,l.getEvents().forEach(function(e){G(e)&&0<l.getEventListenerCount(e)&&(t=!0)}),t||(r=!1,i&&void 0===w&&$()))},setStreaming:function(e){(e=null===e?void 0:e)!==w&&(w=e,W())},flush:function(e){return wrapPromiseCallback(v?k.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(S)for(var t in S)objectHasOwnProperty(S,t)&&!S[t].deleted&&(e[t]=C(t,null,!f.sendEventsOnlyForVariation).value);return e},close:function(e){var t;return P?wrapPromiseCallback(Promise.resolve(),e):(t=function(){P=!0,S={}},wrapPromiseCallback(Promise.resolve().then(function(){if($(),E&&E.stop(),v)return k.stop(),k.flush()}).then(t).catch(t),e))}},options:f,emitter:l,ident:L,logger:c,requestor:D,start:function(){v&&(E&&E.start(),k.start())},enqueueEvent:I,getFlagsInternal:function(){return S},getEnvironmentId:function(){return g},internalChangeEventName:internalChangeEvent}}var version="3.7.0";exports.commonBasicLogger=commonBasicLogger,exports.createConsoleLogger=createConsoleLogger,exports.errors=errors,exports.initialize=initialize,exports.messages=messages,exports.utils=utils,exports.version=version;
"use strict";function ownKeys(n,e){var t,r=Object.keys(n);return Object.getOwnPropertySymbols&&(t=Object.getOwnPropertySymbols(n),e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),r.push.apply(r,t)),r}function _objectSpread2(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(t),!0).forEach(function(e){_defineProperty(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function _slicedToArray(e,n){return _arrayWithHoles(e)||_iterableToArrayLimit(e,n)||_unsupportedIterableToArray(e,n)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterableToArrayLimit(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,a=[],i=!0,s=!1;try{for(t=t.call(e);!(i=(r=t.next()).done)&&(a.push(r.value),!n||a.length!==n);i=!0);}catch(e){s=!0,o=e}finally{try{i||null==t.return||t.return()}finally{if(s)throw o}}return a}}function _unsupportedIterableToArray(e,n){var t;if(e)return"string"==typeof e?_arrayLikeToArray(e,n):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,n):void 0}function _arrayLikeToArray(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function createCustomError(e){function n(e,n){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=n}return(n.prototype=new Error).name=e,n.prototype.constructor=n}Object.defineProperty(exports,"__esModule",{value:!0});var LDUnexpectedResponseError=createCustomError("LaunchDarklyUnexpectedResponseError"),LDInvalidEnvironmentIdError=createCustomError("LaunchDarklyInvalidEnvironmentIdError"),LDInvalidUserError=createCustomError("LaunchDarklyInvalidUserError"),LDInvalidEventKeyError=createCustomError("LaunchDarklyInvalidEventKeyError"),LDInvalidArgumentError=createCustomError("LaunchDarklyInvalidArgumentError"),LDFlagFetchError=createCustomError("LaunchDarklyFlagFetchError"),LDInvalidDataError=createCustomError("LaunchDarklyInvalidDataError");function isHttpErrorRecoverable(e){return!(400<=e&&e<500)||(400===e||408===e||429===e)}for(var errors=Object.freeze({__proto__:null,LDUnexpectedResponseError:LDUnexpectedResponseError,LDInvalidEnvironmentIdError:LDInvalidEnvironmentIdError,LDInvalidUserError:LDInvalidUserError,LDInvalidEventKeyError:LDInvalidEventKeyError,LDInvalidArgumentError:LDInvalidArgumentError,LDFlagFetchError:LDFlagFetchError,LDInvalidDataError:LDInvalidDataError,isHttpErrorRecoverable:isHttpErrorRecoverable}),fromByteArray_1=fromByteArray,lookup=[],revLookup=[],code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;function tripletToBase64(e){return lookup[e>>18&63]+lookup[e>>12&63]+lookup[e>>6&63]+lookup[63&e]}function encodeChunk(e,n,t){for(var r,o=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(tripletToBase64(r));return o.join("")}function fromByteArray(e){for(var n,t=e.length,r=t%3,o=[],a=0,i=t-r;a<i;a+=16383)o.push(encodeChunk(e,a,i<a+16383?i:a+16383));return 1==r?(n=e[t-1],o.push(lookup[n>>2]+lookup[n<<4&63]+"==")):2==r&&(n=(e[t-2]<<8)+e[t-1],o.push(lookup[n>>10]+lookup[n>>4&63]+lookup[n<<2&63]+"=")),o.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;var isArray=Array.isArray,keyList=Object.keys,hasProp=Object.prototype.hasOwnProperty,fastDeepEqual=function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,o,a=isArray(n),i=isArray(t);if(a&&i){if((s=n.length)!=t.length)return!1;for(r=s;0!=r--;)if(!e(n[r],t[r]))return!1}else{if(a!=i)return!1;a=n instanceof Date,i=t instanceof Date;if(a!=i)return!1;if(a&&i)return n.getTime()==t.getTime();a=n instanceof RegExp,i=t instanceof RegExp;if(a!=i)return!1;if(a&&i)return n.toString()==t.toString();var s,u=keyList(n);if((s=u.length)!==keyList(t).length)return!1;for(r=s;0!=r--;)if(!hasProp.call(t,u[r]))return!1;for(r=s;0!=r--;)if(!e(n[o=u[r]],t[o]))return!1}return!0}return n!=n&&t!=t},userAttrsToStringify=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function appendUrlPath(e,n){return(e.endsWith("/")?e.substring(0,e.length-1):e)+(n.startsWith("/")?"":"/")+n}function btoa(e){e=unescape(encodeURIComponent(e));return fromByteArray_1(stringToBytes(e))}function stringToBytes(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}function base64URLEncode(e){return btoa(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function clone(e){return JSON.parse(JSON.stringify(e))}function deepEquals(e,n){return fastDeepEqual(e,n)}function onNextTick(e){setTimeout(e,0)}function wrapPromiseCallback(e,n){e=e.then(function(e){return n&&setTimeout(function(){n(null,e)},0),e},function(e){if(!n)return Promise.reject(e);setTimeout(function(){n(e,null)},0)});return n?void 0:e}function transformValuesToVersionedValues(e){var n,t={};for(n in e)objectHasOwnProperty(e,n)&&(t[n]={value:e[n],version:0});return t}function transformVersionedValuesToValues(e){var n,t={};for(n in e)objectHasOwnProperty(e,n)&&(t[n]=e[n].value);return t}function chunkUserEventsForUrl(e,n){for(var t,r=n.slice(0),o=[],a=e;0<r.length;){for(t=[];0<a;){var i=r.shift();if(!i)break;(a-=base64URLEncode(JSON.stringify(i)).length)<0&&0<t.length?r.unshift(i):t.push(i)}a=e,o.push(t)}return o}function getLDUserAgentString(e){var n=e.version||"3.8.0";return e.userAgent+"/"+n}function extend(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.reduce(function(e,n){return _objectSpread2(_objectSpread2({},e),n)},{})}function objectHasOwnProperty(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function sanitizeUser(e){if(!e)return e;var n,t;for(t in userAttrsToStringify){var r=userAttrsToStringify[t],o=e[r];void 0!==o&&"string"!=typeof o&&((n=n||_objectSpread2({},e))[r]=String(o))}return n||e}var utils=Object.freeze({__proto__:null,appendUrlPath:appendUrlPath,btoa:btoa,base64URLEncode:base64URLEncode,clone:clone,deepEquals:deepEquals,onNextTick:onNextTick,wrapPromiseCallback:wrapPromiseCallback,transformValuesToVersionedValues:transformValuesToVersionedValues,transformVersionedValuesToValues:transformVersionedValuesToValues,chunkUserEventsForUrl:chunkUserEventsForUrl,getLDUserAgentString:getLDUserAgentString,extend:extend,objectHasOwnProperty:objectHasOwnProperty,sanitizeUser:sanitizeUser});function createCommonjsModule(e,n){return e(n={exports:{}},n.exports),n.exports}for(var rngBrowser=createCommonjsModule(function(e){var n,t,r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);r?(n=new Uint8Array(16),e.exports=function(){return r(n),n}):(t=new Array(16),e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),t[n]=e>>>((3&n)<<3)&255;return t})}),byteToHex=[],i$1=0;i$1<256;++i$1)byteToHex[i$1]=(i$1+256).toString(16).substr(1);function bytesToUuid(e,n){var n=n||0,t=byteToHex;return[t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[+n]]].join("")}var _nodeId,_clockseq,bytesToUuid_1=bytesToUuid,_lastMSecs=0,_lastNSecs=0;function v1(e,n,t){var r=n&&t||0,o=n||[],a=(e=e||{}).node||_nodeId,t=void 0!==e.clockseq?e.clockseq:_clockseq,i=(null!=a&&null!=t||(i=rngBrowser(),null==a&&(a=_nodeId=[1|i[0],i[1],i[2],i[3],i[4],i[5]]),null==t&&(t=_clockseq=16383&(i[6]<<8|i[7]))),void 0!==e.msecs?e.msecs:(new Date).getTime()),s=void 0!==e.nsecs?e.nsecs:_lastNSecs+1,u=i-_lastMSecs+(s-_lastNSecs)/1e4;if(u<0&&void 0===e.clockseq&&(t=t+1&16383),1e4<=(s=(u<0||_lastMSecs<i)&&void 0===e.nsecs?0:s))throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=i,_clockseq=t;u=(1e4*(268435455&(i+=122192928e5))+(_lastNSecs=s))%4294967296,o[r++]=u>>>24&255,o[r++]=u>>>16&255,o[r++]=u>>>8&255,o[r++]=255&u,e=i/4294967296*1e4&268435455;o[r++]=e>>>8&255,o[r++]=255&e,o[r++]=e>>>24&15|16,o[r++]=e>>>16&255,o[r++]=t>>>8|128,o[r++]=255&t;for(var c=0;c<6;++c)o[r+c]=a[c];return n||bytesToUuid_1(o)}var v1_1=v1,logLevels=["debug","info","warn","error","none"];function commonBasicLogger(e,s){if(e&&e.destination&&"function"!=typeof e.destination)throw new Error("destination for basicLogger was set to a non-function");function n(n){return function(e){console&&console[n]&&console[n].call(console,e)}}var u=e&&e.destination?[e.destination,e.destination,e.destination,e.destination]:[n("log"),n("info"),n("warn"),n("error")],c=!(!e||!e.destination),l=e&&void 0!==e.prefix&&null!==e.prefix?e.prefix:"[LaunchDarkly] ",t=1;if(e&&e.level)for(var r=0;r<logLevels.length;r++)logLevels[r]===e.level&&(t=r);for(var o={},a=function(e){var a,i=logLevels[e];"none"!==i&&(e<t?o[i]=function(){}:(a=e,o[i]=function(){var e=a,n=i,t=arguments;if(!(t.length<1)){var r=c?n+": "+l:l,o=1!==t.length&&s?((o=_toConsumableArray(t))[0]=r+o[0],s.apply(void 0,_toConsumableArray(o))):r+t[0];try{u[e](o)}catch(e){console&&console.log&&console.log("[LaunchDarkly] Configured logger's "+n+" method threw an exception: "+e)}}}))},i=0;i<logLevels.length;i++)a(i);return o}function validateLogger(n){logLevels.forEach(function(e){if("none"!==e&&(!n[e]||"function"!=typeof n[e]))throw new Error("Provided logger instance must support logger."+e+"(...) method")})}function createConsoleLogger(e,n){return commonBasicLogger({level:e,prefix:n})}function errorString(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var clientInitialized=function(){return"LaunchDarkly client initialized"},docLink=" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initializing-the-client for instructions on SDK initialization.",clientNotReady=function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded=function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},eventWithoutUser=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"},invalidContentType=function(e){return'Expected application/json content type but got "'+e+'"'},invalidKey=function(){return"Event key must be a string"},localStorageUnavailable=function(e){return"local storage is unavailable: "+errorString(e)},networkError=function(e){return"network error"+(e?" ("+e+")":"")},unknownCustomEventKey=function(e){return'Custom event "'+e+'" does not exist'},environmentNotFound=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+docLink},environmentNotSpecified=function(){return"No environment/client-side ID was specified."+docLink},errorFetchingFlags=function(e){return"Error fetching flag settings: "+errorString(e)},userNotSpecified=function(){return"No user specified."+docLink},invalidUser=function(){return"Invalid user specified."+docLink},invalidData=function(){return"Invalid data received from LaunchDarkly; connection may have been interrupted"},bootstrapOldFormat=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+docLink},bootstrapInvalid=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},deprecated=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},httpErrorMessage=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(isHttpErrorRecoverable(e)?t:"giving up permanently")},httpUnavailable=function(){return"Cannot make HTTP requests in this environment."+docLink},identifyDisabled=function(){return"identify() has no effect here; it must be called on the main client instance"},streamClosing=function(){return"Closing stream connection"},streamConnecting=function(e){return"Opening stream connection to "+e},streamError=function(e,n){return"Error on stream connection: "+errorString(e)+", will continue retrying every "+n+" milliseconds."},unknownOption=function(e){return'Ignoring unknown config option "'+e+'"'},wrongOptionType=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},wrongOptionTypeBoolean=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},optionBelowMinimum=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},debugPolling=function(e){return"polling for feature flags at "+e},debugStreamPing=function(){return"received ping message from stream"},debugStreamPut=function(){return"received streaming update for all flags"},debugStreamPatch=function(e){return'received streaming update for flag "'+e+'"'},debugStreamPatchIgnored=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},debugStreamDelete=function(e){return'received streaming deletion for flag "'+e+'"'},debugStreamDeleteIgnored=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},debugEnqueueingEvent=function(e){return'enqueueing "'+e+'" event'},debugPostingEvents=function(e){return"sending "+e+" events"},debugPostingDiagnosticEvent=function(e){return"sending diagnostic event ("+e.kind+")"},invalidTagValue=function(e){return'Config option "'.concat(e,'" must only contain letters, numbers, ., _ or -.')},invalidInspector=function(e,n){return'an inspector: "'.concat(n,'" of an invalid type (').concat(e,") was configured")},inspectorMethodError=function(e,n){return'an inspector: "'.concat(n,'" of type: "').concat(e,'" generated an exception')},tagValueTooLong=function(e){return'Value of "'.concat(e,'" was longer than 64 characters and was discarded.')},messages=Object.freeze({__proto__:null,clientInitialized:clientInitialized,clientNotReady:clientNotReady,eventCapacityExceeded:eventCapacityExceeded,eventWithoutUser:eventWithoutUser,invalidContentType:invalidContentType,invalidKey:invalidKey,localStorageUnavailable:localStorageUnavailable,networkError:networkError,unknownCustomEventKey:unknownCustomEventKey,environmentNotFound:environmentNotFound,environmentNotSpecified:environmentNotSpecified,errorFetchingFlags:errorFetchingFlags,userNotSpecified:userNotSpecified,invalidUser:invalidUser,invalidData:invalidData,bootstrapOldFormat:bootstrapOldFormat,bootstrapInvalid:bootstrapInvalid,deprecated:deprecated,httpErrorMessage:httpErrorMessage,httpUnavailable:httpUnavailable,identifyDisabled:identifyDisabled,streamClosing:streamClosing,streamConnecting:streamConnecting,streamError:streamError,unknownOption:unknownOption,wrongOptionType:wrongOptionType,wrongOptionTypeBoolean:wrongOptionTypeBoolean,optionBelowMinimum:optionBelowMinimum,debugPolling:debugPolling,debugStreamPing:debugStreamPing,debugStreamPut:debugStreamPut,debugStreamPatch:debugStreamPatch,debugStreamPatchIgnored:debugStreamPatchIgnored,debugStreamDelete:debugStreamDelete,debugStreamDeleteIgnored:debugStreamDeleteIgnored,debugEnqueueingEvent:debugEnqueueingEvent,debugPostingEvents:debugPostingEvents,debugPostingDiagnosticEvent:debugPostingDiagnosticEvent,invalidTagValue:invalidTagValue,invalidInspector:invalidInspector,inspectorMethodError:inspectorMethodError,tagValueTooLong:tagValueTooLong}),baseOptionDefs={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},requestHeaderTransform:{type:"function"},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},diagnosticRecordingInterval:{default:9e5,minimum:2e3},diagnosticOptOut:{default:!1},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"},autoAliasingOptOut:{default:!1},application:{validator:applicationConfigValidator},inspectors:{default:[]}},allowedTagCharacters=/^(\w|\.|-)+$/;function validateTagValue(e,n,t){if("string"==typeof n&&n.match(allowedTagCharacters)){if(!(64<n.length))return n;t.warn(tagValueTooLong(e))}else t.warn(invalidTagValue(e))}function applicationConfigValidator(e,n,t){var r={};return n.id&&(r.id=validateTagValue("".concat(e,".id"),n.id,t)),n.version&&(r.version=validateTagValue("".concat(e,".version"),n.version,t)),r}function validate(e,n,t,i){var s=extend({logger:{default:i}},baseOptionDefs,t),r={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null,allowFrequentDuplicateEvents:void 0};function u(e){onNextTick(function(){n&&n.maybeReportError(new LDInvalidArgumentError(e))})}var o,a,c,l,t=extend({},e||{});function d(e){return null===e?"any":void 0!==e?Array.isArray(e)?"array":"boolean"===(e=_typeof(e))||"string"===e||"number"===e||"function"===e?e:"object":void 0}return o=t,Object.keys(r).forEach(function(e){var n;void 0!==o[e]&&(n=r[e],i&&i.warn(deprecated(e,n)),n&&(void 0===o[n]&&(o[n]=o[e]),delete o[e]))}),a=extend({},t),Object.keys(s).forEach(function(e){void 0!==a[e]&&null!==a[e]||(a[e]=s[e]&&s[e].default)}),l=extend({},c=t=a),Object.keys(c).forEach(function(e){var n,t,r,o,a=c[e];null!=a&&(void 0===(n=s[e])?u(unknownOption(e)):(t=n.type||d(n.default),(r=n.validator)?void 0!==(r=r(e,c[e],i))?l[e]=r:delete l[e]:"any"!==t&&(r=t.split("|"),o=d(a),r.indexOf(o)<0?"boolean"===t?(l[e]=!!a,u(wrongOptionTypeBoolean(e,o))):(u(wrongOptionType(e,t,o)),l[e]=n.default):"number"===o&&void 0!==n.minimum&&a<n.minimum&&(u(optionBelowMinimum(e,a,n.minimum)),l[e]=n.minimum))))}),validateLogger((t=l).logger),t}function getTags(e){var n={};return e&&(e.application&&void 0!==e.application.id&&null!==e.application.id&&(n["application-id"]=[e.application.id]),e.application&&void 0!==e.application.version&&null!==e.application.id&&(n["application-version"]=[e.application.version])),n}var configuration=Object.freeze({__proto__:null,baseOptionDefs:baseOptionDefs,validate:validate,getTags:getTags});function getLDHeaders(e,n){var t;return n&&!n.sendLDHeaders?{}:(e={"X-LaunchDarkly-User-Agent":getLDUserAgentString(e)},n&&n.wrapperName&&(e["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t=getTags(n),(n=Object.keys(t)).length&&(e["x-launchdarkly-tags"]=n.sort().flatMap(function(n){return Array.isArray(t[n])?t[n].sort().map(function(e){return"".concat(n,"/").concat(e)}):["".concat(n,"/").concat(t[n])]}).join(" ")),e)}function transformHeaders(e,n){return n&&n.requestHeaderTransform?n.requestHeaderTransform(_objectSpread2({},e)):e}var MAX_URL_LENGTH=2e3;function EventSender(s,e,u){var c="/a/"+e+".gif",l=extend({"Content-Type":"application/json"},getLDHeaders(s,u)),d=s.httpFallbackPing,f={};return f.sendChunk=function(e,n,r,t){var o=JSON.stringify(e),a=r?null:v1_1();function i(t){var e=r?l:extend({},l,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":a});return s.httpRequest("POST",n,transformHeaders(e,u),o).promise.then(function(e){var n;if(e)return 400<=e.status&&isHttpErrorRecoverable(e.status)&&t?i(!1):(n={status:(e=e).status},(e=(e=e.header("date"))&&Date.parse(e))&&(n.serverTime=e),n)}).catch(function(){return t?i(!1):Promise.reject()})}return t?i(!0).catch(function(){}):(d&&d(n+c+"?d="+base64URLEncode(o)),Promise.resolve())},f.sendEvents=function(e,n,t){if(!s.httpRequest)return Promise.resolve();for(var r=s.httpAllowsPost(),o=r?[e]:chunkUserEventsForUrl(MAX_URL_LENGTH-n.length,e),a=[],i=0;i<o.length;i++)a.push(f.sendChunk(o[i],n,t,r));return Promise.all(a)},f}function EventSummarizer(){var e={},i=0,s=0,u={};return e.summarizeEvent=function(e){var n,t;"feature"===e.kind&&(n=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),(t=u[n])?t.count=t.count+1:u[n]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===i||e.creationDate<i)&&(i=e.creationDate),e.creationDate>s&&(s=e.creationDate))},e.getSummary=function(){var e,n={},t=!0;for(e in u){var r=u[e],o=n[r.key],a=(o||(o={default:r.default,counters:[]},n[r.key]=o),{value:r.value,count:r.count});void 0!==r.variation&&null!==r.variation&&(a.variation=r.variation),r.version?a.version=r.version:a.unknown=!0,o.counters.push(a),t=!1}return t?null:{startDate:i,endDate:s,features:n}},e.clearSummary=function(){s=i=0,u={}},e}function UserFilter(e){var n={},i=e.allAttributesPrivate,s=e.privateAttributeNames||[],u={key:!0,custom:!0,anonymous:!0},c={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0};return n.filterUser=function(e){var n,o,t,r,a;return e?(n=e.privateAttributeNames||[],o=function(e){return!u[e]&&(i||-1!==n.indexOf(e)||-1!==s.indexOf(e))},t=(r=(a=function(t,r){return Object.keys(t).reduce(function(e,n){return r(n)&&(o(n)?e[1][n]=!0:e[0][n]=t[n]),e},[{},{}])})(e,function(e){return c[e]}))[0],r=r[1],e.custom&&(a=a(e.custom,function(){return 1}),t.custom=a[0],r=extend({},r,a[1])),(e=Object.keys(r)).length&&(e.sort(),t.privateAttrs=e),t):null},n}function EventProcessor(e,n,t){var r,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:null,i={},s=(5<arguments.length&&void 0!==arguments[5]?arguments[5]:null)||EventSender(e,t,n),u=appendUrlPath(n.eventsUrl,"/events/bulk/"+t),c=EventSummarizer(),l=UserFilter(n),d=n.inlineUsersInEvents,f=n.samplingInterval,g=n.eventCapacity,v=n.flushInterval,p=n.logger,m=[],y=0,h=!1,b=!1;function E(){return 0===f||0===Math.floor(Math.random()*f)}function k(e){m.length<g?(m.push(e),b=!1):(b||(b=!0,p.warn(eventCapacityExceeded())),o&&o.incrementDroppedEvents())}return i.enqueue=function(e){var n,t,r;h||(n=r=!1,c.summarizeEvent(e),"feature"===e.kind?E()&&(r=!!e.trackEvents,n=!!(t=e).debugEventsUntilDate&&(t.debugEventsUntilDate>y&&t.debugEventsUntilDate>(new Date).getTime())):r=E(),r&&k((r=extend({},t=e),"alias"!==t.kind&&(d||"identify"===t.kind?r.user=l.filterUser(t.user):(r.userKey=t.user.key,delete r.user),"feature"===t.kind&&(delete r.trackEvents,delete r.debugEventsUntilDate)),r)),n&&((r=extend({},e,{kind:"debug"})).user=l.filterUser(r.user),delete r.trackEvents,delete r.debugEventsUntilDate,k(r)))},i.flush=function(){var e,n;return h||(e=m,n=c.getSummary(),c.clearSummary(),n&&(n.kind="summary",e.push(n)),o&&o.setEventsInLastBatch(e.length),0===e.length)?Promise.resolve():(m=[],p.debug(debugPostingEvents(e.length)),s.sendEvents(e,u).then(function(e){e&&(e.serverTime&&(y=e.serverTime),isHttpErrorRecoverable(e.status)||(h=!0),400<=e.status&&onNextTick(function(){a.maybeReportError(new LDUnexpectedResponseError(httpErrorMessage(e.status,"event posting","some events were dropped")))}))}))},i.start=function(){r=setTimeout(function e(){i.flush(),r=setTimeout(e,v)},v)},i.stop=function(){clearTimeout(r)},i}function EventEmitter(n){var e={},o={};return e.on=function(e,n,t){o[e]=o[e]||[],o[e]=o[e].concat({handler:n,context:t})},e.off=function(e,n,t){if(o[e])for(var r=0;r<o[e].length;r++)o[e][r].handler===n&&o[e][r].context===t&&(o[e]=o[e].slice(0,r).concat(o[e].slice(r+1)))},e.emit=function(e){if(o[e])for(var n=o[e].slice(0),t=0;t<n.length;t++)n[t].handler.apply(n[t].context,Array.prototype.slice.call(arguments,1))},e.getEvents=function(){return Object.keys(o)},e.getEventListenerCount=function(e){return o[e]?o[e].length:0},e.maybeReportError=function(e){e&&(o["error"]?this.emit("error",e):(n||console).error(e.message))},e}var readyEvent="ready",successEvent="initialized",failureEvent="failed";function InitializationStateTracker(o){var n=!1,t=!1,r=null,e=null,a=new Promise(function(n){o.on(readyEvent,function e(){o.off(readyEvent,e),n()})}).catch(function(){});return{getInitializationPromise:function(){if(!e){if(n)return Promise.resolve();if(t)return Promise.reject(r);e=new Promise(function(n,t){function r(e){o.off(failureEvent,r),t(e)}o.on(successEvent,function e(){o.off(successEvent,e),n()}),o.on(failureEvent,r)})}return e},getReadyPromise:function(){return a},signalSuccess:function(){n||t||(n=!0,o.emit(successEvent),o.emit(readyEvent))},signalFailure:function(e){n||t||(t=!0,r=e,o.emit(failureEvent,e),o.emit(readyEvent)),o.maybeReportError(e)}}}var InitializationState=InitializationStateTracker;function PersistentFlagStore(n,t,r,o){var a={};function i(){var e="",n=o.getUser();return n&&(e=r||btoa(JSON.stringify(n))),"ld:"+t+":"+e}return a.loadFlags=function(){return n.get(i()).then(function(e){if(null==e)return null;try{var n,t=JSON.parse(e);return t&&(void 0===(n=t.$schema)||n<1?t=transformValuesToVersionedValues(t):delete t.$schema),t}catch(e){return a.clearFlags().then(function(){return null})}})},a.saveFlags=function(e){e=extend({},e,{$schema:1});return n.set(i(),JSON.stringify(e))},a.clearFlags=function(){return n.clear(i())},a}function PersistentStorage(r,n){function o(e){t||(t=!0,n.warn(localStorageUnavailable(e)))}var e={},t=!1;return e.isEnabled=function(){return!!r},e.get=function(e){return new Promise(function(n){r?r.get(e).then(n).catch(function(e){o(e),n(void 0)}):n(void 0)})},e.set=function(e,t){return new Promise(function(n){r?r.set(e,t).then(function(){return n(!0)}).catch(function(e){o(e),n(!1)}):n(!1)})},e.clear=function(e){return new Promise(function(n){r?r.clear(e).then(function(){return n(!0)}).catch(function(e){o(e),n(!1)}):n(!1)})},e}var streamReadTimeoutMillis=3e5;function Stream(o,a,i,n){var s,u=a.streamUrl,c=a.logger,e={},l=appendUrlPath(u,"/eval/"+i),d=a.useReport,f=a.evaluationReasons,t=a.streamReconnectDelay,g=getLDHeaders(o,a),v=!1,p=null,m=null,y=null,h=null,b=null;function E(e){v||(c.warn(streamError(e,t)),v=!0),w(!1),D(),k(t)}function k(e){m||(e?m=setTimeout(r,e):r())}function r(){m=null;var e,n="",t={headers:g,readTimeoutMillis:streamReadTimeoutMillis};if(o.eventSourceFactory){for(var r in null!=h&&(n="h="+h),d?o.eventSourceAllowsReport?(e=l,t.method="REPORT",t.headers["Content-Type"]="application/json",t.body=JSON.stringify(y)):(e=appendUrlPath(u,"/ping/"+i),n=""):e=l+"/"+base64URLEncode(JSON.stringify(y)),t.headers=transformHeaders(t.headers,a),e=e+((n=f?n+(n?"&":"")+"withReasons=true":n)?"?":"")+n,D(),c.info(streamConnecting(e)),s=(new Date).getTime(),p=o.eventSourceFactory(e,t),b)objectHasOwnProperty(b,r)&&p.addEventListener(r,b[r]);p.onerror=E}}function D(){p&&(c.info(streamClosing()),p.close(),p=null)}function w(e){s&&n&&n.recordStreamInit(s,!e,(new Date).getTime()-s),s=null}return e.connect=function(e,n,t){y=e,h=n,b={};for(var r in t||{})!function(n){b[n]=function(e){w(!(v=!1)),t[n]&&t[n](e)}}(r);k()},e.disconnect=function(){clearTimeout(m),m=null,D()},e.isConnected=function(){return!!(p&&o.eventSourceIsActive&&o.eventSourceIsActive(p))},e}function promiseCoalescer(t){var r,o,a,i,e={addPromise:function(n,e){r=n,o&&o(),o=e,n.then(function(e){r===n&&(a(e),t&&t())},function(e){r===n&&(i(e),t&&t())})}};return e.resultPromise=new Promise(function(e,n){a=e,i=n}),e}var jsonContentType="application/json";function getResponseError(e){return 404===e.status?new LDInvalidEnvironmentIdError(environmentNotFound()):new LDFlagFetchError(errorFetchingFlags(e.statusText||String(e.status)))}function Requestor(i,s,a){var u=s.baseUrl,c=s.useReport,l=s.evaluationReasons,d=s.logger,e={},f={};function g(e,n){var t,r,o,a;return i.httpRequest?(a=n?"REPORT":"GET",t=getLDHeaders(i,s),n&&(t["Content-Type"]=jsonContentType),(r=f[e])||(r=promiseCoalescer(function(){delete f[e]}),f[e]=r),a=(o=i.httpRequest(a,e,transformHeaders(t,s),n)).promise.then(function(e){var n;return 200===e.status?e.header("content-type")&&e.header("content-type").substring(0,jsonContentType.length)===jsonContentType?JSON.parse(e.body):(n=invalidContentType(e.header("content-type")||""),Promise.reject(new LDFlagFetchError(n))):Promise.reject(getResponseError(e))},function(e){return Promise.reject(new LDFlagFetchError(networkError(e)))}),r.addPromise(a,function(){o.cancel&&o.cancel()}),r.resultPromise):new Promise(function(e,n){n(new LDFlagFetchError(httpUnavailable()))})}return e.fetchJSON=function(e){return g(appendUrlPath(u,e),null)},e.fetchFlagSettings=function(e,n){var t,r,o="";return c?(t=[u,"/sdk/evalx/",a,"/user"].join(""),r=JSON.stringify(e)):(e=base64URLEncode(JSON.stringify(e)),t=[u,"/sdk/evalx/",a,"/users/",e].join("")),n&&(o="h="+n),d.debug(debugPolling(t=t+((o=l?o+(o?"&":"")+"withReasons=true":o)?"?":"")+o)),g(t,r)},e}function Identity(e,t){var r,n={setUser:function(e){var n=r&&clone(r);(r=sanitizeUser(e))&&t&&t(clone(r),n)},getUser:function(){return r?clone(r):null}};return e&&n.setUser(e),n}var ldUserIdKey="ld:$anonUserId";function UserValidator(t){var e={};return e.validateUser=function(e){var n;return e?null!==(n=clone(e)).key&&void 0!==n.key?(n.key=n.key.toString(),Promise.resolve(n)):n.anonymous?t.get(ldUserIdKey).then(function(e){return e?(n.key=e,n):(e=v1_1(),n.key=e,t.set(ldUserIdKey,e).then(function(){return n}))}):Promise.reject(new LDInvalidUserError(invalidUser())):Promise.reject(new LDInvalidUserError(userNotSpecified()))},e}var baseOptionDefs$1=configuration.baseOptionDefs,appendUrlPath$1=utils.appendUrlPath;function DiagnosticId(e){var n={diagnosticId:v1_1()};return e&&(n.sdkKeySuffix=6<e.length?e.substring(e.length-6):e),n}function DiagnosticsAccumulator(e){var n,t,r,o;function a(e){n=e,r=t=0,o=[]}return a(e),{getProps:function(){return{dataSinceDate:n,droppedEvents:t,eventsInLastBatch:r,streamInits:o}},setProps:function(e){n=e.dataSinceDate,t=e.droppedEvents||0,r=e.eventsInLastBatch||0,o=e.streamInits||[]},incrementDroppedEvents:function(){t++},setEventsInLastBatch:function(e){r=e},recordStreamInit:function(e,n,t){o.push({timestamp:e,failed:n,durationMillis:t})},reset:a}}function DiagnosticsManager(n,r,e,t,o,a,i){var s,u,c=!!n.diagnosticUseCombinedEvent,l="ld:"+o+":$diagnostics",d=appendUrlPath$1(a.eventsUrl,"/events/diagnostic/"+o),f=a.diagnosticRecordingInterval,g=e,v=!!a.streaming,o={};function p(){return{sdk:function(){var e=_objectSpread2({},n.diagnosticSdkData);a.wrapperName&&(e.wrapperName=a.wrapperName);a.wrapperVersion&&(e.wrapperVersion=a.wrapperVersion);return e}(),configuration:{customBaseURI:a.baseUrl!==baseOptionDefs$1.baseUrl.default,customStreamURI:a.streamUrl!==baseOptionDefs$1.streamUrl.default,customEventsURI:a.eventsUrl!==baseOptionDefs$1.eventsUrl.default,eventsCapacity:a.eventCapacity,eventsFlushIntervalMillis:a.flushInterval,reconnectTimeMillis:a.streamReconnectDelay,streamingDisabled:!v,allAttributesPrivate:!!a.allAttributesPrivate,inlineUsersInEvents:!!a.inlineUsersInEvents,diagnosticRecordingIntervalMillis:a.diagnosticRecordingInterval,usingSecureMode:!!a.hash,bootstrapMode:!!a.bootstrap,fetchGoalsDisabled:!a.fetchGoals,sendEventsOnlyForVariation:!!a.sendEventsOnlyForVariation,autoAliasingOptOut:!!a.autoAliasingOptOut},platform:n.diagnosticPlatformData}}function m(e){a.logger&&a.logger.debug(messages.debugPostingDiagnosticEvent(e)),t.sendEvents(e,d,!0).then(function(){}).catch(function(){})}function y(){var e,n;m((n=(new Date).getTime(),e=_objectSpread2({kind:c?"diagnostic-combined":"diagnostic",id:i,creationDate:n},g.getProps()),c&&(e=_objectSpread2(_objectSpread2({},e),p())),g.reset(n),e)),u=setTimeout(y,f),s=(new Date).getTime(),c&&r.isEnabled()&&(n=_objectSpread2({},g.getProps()),r.set(l,JSON.stringify(n)))}return o.start=function(){var t;c?(t=function(e){var n;e?(e=(s||0)+f)<=(n=(new Date).getTime())?y():u=setTimeout(y,e-n):0===Math.floor(4*Math.random())?y():u=setTimeout(y,f)},r.isEnabled()?r.get(l).then(function(e){if(e)try{var n=JSON.parse(e);g.setProps(n),s=n.dataSinceDate}catch(e){}t(!0)}).catch(function(){t(!1)}):t(!1)):(m(_objectSpread2({kind:"diagnostic-init",id:i,creationDate:g.getProps().dataSinceDate},p())),u=setTimeout(y,f))},o.stop=function(){u&&clearTimeout(u)},o.setStreaming=function(e){v=e},o}var diagnosticEvents={DiagnosticId:DiagnosticId,DiagnosticsAccumulator:DiagnosticsAccumulator,DiagnosticsManager:DiagnosticsManager},diagnosticEvents_1=diagnosticEvents.DiagnosticId,diagnosticEvents_2=diagnosticEvents.DiagnosticsAccumulator,diagnosticEvents_3=diagnosticEvents.DiagnosticsManager;function SafeInspector(e,n){var t=!1,r={type:e.type,name:e.name,method:function(){try{e.method.apply(e,arguments)}catch(e){t||(t=!0,n.warn(inspectorMethodError(r.type,r.name)))}}};return r}var InspectorTypes={flagUsed:"flag-used",flagDetailsChanged:"flag-details-changed",flagDetailChanged:"flag-detail-changed",clientIdentityChanged:"client-identity-changed"};function InspectorManager(e,n){var t,r={},o=(_defineProperty(t={},InspectorTypes.flagUsed,[]),_defineProperty(t,InspectorTypes.flagDetailsChanged,[]),_defineProperty(t,InspectorTypes.flagDetailChanged,[]),_defineProperty(t,InspectorTypes.clientIdentityChanged,[]),t);return(null==e?void 0:e.map(function(e){return SafeInspector(e,n)})).forEach(function(e){Object.prototype.hasOwnProperty.call(o,e.type)?o[e.type].push(e):n.warn(invalidInspector(e.type,e.name))}),r.hasListeners=function(e){return null==(e=o[e])?void 0:e.length},r.onFlagUsed=function(n,t,r){o[InspectorTypes.flagUsed].length&&onNextTick(function(){o[InspectorTypes.flagUsed].forEach(function(e){return e.method(n,t,r)})})},r.onFlags=function(n){o[InspectorTypes.flagDetailsChanged].length&&onNextTick(function(){o[InspectorTypes.flagDetailsChanged].forEach(function(e){return e.method(n)})})},r.onFlagChanged=function(n,t){o[InspectorTypes.flagDetailChanged].length&&onNextTick(function(){console.log("what?"),o[InspectorTypes.flagDetailChanged].forEach(function(e){return e.method(n,t)})})},r.onIdentityChanged=function(n){o[InspectorTypes.clientIdentityChanged].length&&onNextTick(function(){o[InspectorTypes.clientIdentityChanged].forEach(function(e){return e.method(n)})})},r}Object.freeze(InspectorTypes);var changeEvent="change",internalChangeEvent="internal-change";function initialize(R,x,e,o,n){var t,i,r,a,N,s,u,c=function(){if(e&&e.logger)return e.logger;return n&&n.logger&&n.logger.default||createConsoleLogger("warn")}(),l=EventEmitter(c),d=InitializationState(l),f=validate(e,l,n,c),g=InspectorManager(f.inspectors,c),v=f.sendEvents,p=R,m=f.hash,y=PersistentStorage(o.localStorage,c),V=EventSender(o,p,f),h=f.sendEvents&&!f.diagnosticOptOut,b=h?diagnosticEvents_1(p):null,E=h?diagnosticEvents_2((new Date).getTime()):null,k=h?diagnosticEvents_3(o,y,E,V,p,f,b):null,M=Stream(o,f,p,E),D=f.eventProcessor||EventProcessor(o,f,p,E,l,V),w=Requestor(o,f,p),S={},I=f.streaming,H=!1,T=!1,P=!0,U=f.stateProvider,L=Identity(null,function(e,n){(function(e){U||e&&C({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})})(e),!f.autoAliasingOptOut&&n&&n.anonymous&&e&&!e.anonymous&&W(e,n);z()}),q=UserValidator(y),O=y.isEnabled()?new PersistentFlagStore(y,p,m,L,c):null;function C(e){if(p&&!(U&&U.enqueueEvent&&U.enqueueEvent(e))){if("alias"!==e.kind){if(!e.user)return void(P&&(c.warn(eventWithoutUser()),P=!1));P=!1}!v||T||o.isDoNotTrack()||(c.debug(debugEnqueueingEvent(e.kind)),D.enqueue(e))}}function z(){g.hasListeners(InspectorTypes.clientIdentityChanged)&&g.onIdentityChanged(L.getUser())}function K(e,n){g.hasListeners(InspectorTypes.flagDetailChanged)&&g.onFlagChanged(e.key,_(n))}function B(){g.hasListeners(InspectorTypes.flagDetailsChanged)&&g.onFlags(Object.entries(S).map(function(e){e=_slicedToArray(e,2);return{key:e[0],detail:_(e[1])}}).reduce(function(e,n){return e[n.key]=n.detail,e},{}))}function $(e,n,t,r){var o=L.getUser(),a=new Date,t={kind:"feature",key:e,user:o,value:n?n.value:null,variation:n?n.variationIndex:null,default:t,creationDate:a.getTime()},a=(o&&o.anonymous&&(t.contextKind=j(o)),S[e]);a&&(t.version=a.flagVersion||a.version,t.trackEvents=a.trackEvents,t.debugEventsUntilDate=a.debugEventsUntilDate),(r||a&&a.trackReason)&&n&&(t.reason=n.reason),C(t)}function J(e,n,t,r,o){var a,i;return S&&objectHasOwnProperty(S,e)&&S[e]&&!S[e].deleted?(i=_(a=S[e]),null!==a.value&&void 0!==a.value||(i.value=n)):i={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}},t&&$(e,i,n,r),o||z(),i}function _(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function j(e){return e.anonymous?"anonymousUser":"user"}function W(e,n){U||e&&n&&C({kind:"alias",key:e.key,contextKind:j(e),previousKey:n.key,previousContextKind:j(n),creationDate:(new Date).getTime()})}function G(){var a;i=!0,L.getUser()&&(a=function(e){try{return JSON.parse(e)}catch(e){l.maybeReportError(new LDInvalidDataError(invalidData()))}},M.connect(L.getUser(),m,{ping:function(){c.debug(debugStreamPing());var n=L.getUser();w.fetchFlagSettings(n,m).then(function(e){deepEquals(n,L.getUser())&&A(e||{})}).catch(function(e){l.maybeReportError(new LDFlagFetchError(errorFetchingFlags(e)))})},put:function(e){e=a(e.data);e&&(c.debug(debugStreamPut()),A(e))},patch:function(e){var n,t,r,o,e=a(e.data);e&&(!(n=S[e.key])||!n.version||!e.version||n.version<e.version?(c.debug(debugStreamPatch(e.key)),t={},delete(r=extend({},e)).key,o=_(S[e.key]=r),t[e.key]=n?{previous:n.value,current:o}:{current:o},Q(t),K(e,r)):c.debug(debugStreamPatchIgnored(e.key)))},delete:function(e){var n,e=a(e.data);e&&(!S[e.key]||S[e.key].version<e.version?(c.debug(debugStreamDelete(e.key)),n={},S[e.key]&&!S[e.key].deleted&&(n[e.key]={previous:S[e.key].value}),S[e.key]={version:e.version,deleted:!0},K(e,S[e.key]),Q(n)):c.debug(debugStreamDeleteIgnored(e.key)))}}))}function X(){i&&(M.disconnect(),i=!1)}function A(e){var n,t,r={};if(!e)return Promise.resolve();for(n in S)objectHasOwnProperty(S,n)&&S[n]&&(e[n]&&!deepEquals(e[n].value,S[n].value)?r[n]={previous:S[n].value,current:_(e[n])}:e[n]&&!e[n].deleted||(r[n]={previous:S[n].value}));for(t in e)objectHasOwnProperty(e,t)&&e[t]&&(!S[t]||S[t].deleted)&&(r[t]={current:_(e[t])});return S=_objectSpread2({},e),B(),Q(r).catch(function(){})}function Q(o){var a,e=Object.keys(o);return 0<e.length&&(a={},e.forEach(function(e){var n=o[e].current,t=n?n.value:void 0,r=o[e].previous;l.emit(changeEvent+":"+e,t,r),a[e]=n?{current:t,previous:r}:{previous:r}}),l.emit(changeEvent,a),l.emit(internalChangeEvent,S),f.sendEventsOnlyForVariation||U||e.forEach(function(e){$(e,o[e].current)})),t&&O?O.saveFlags(S):Promise.resolve()}function Y(){var e=I||r&&void 0===I;e&&!i?G():!e&&i&&X(),k&&k.setStreaming(e)}function Z(e){return e===changeEvent||e.substr(0,changeEvent.length+1)===changeEvent+":"}function ee(e){p=e.environment,L.setUser(e.user),S=_objectSpread2({},e.flags),onNextTick(F)}function F(){c.info(clientInitialized()),H=!0,Y(),d.signalSuccess()}function ne(e){d.signalFailure(e)}return"string"==typeof f.bootstrap&&"LOCALSTORAGE"===f.bootstrap.toUpperCase()&&(O?t=!0:c.warn(localStorageUnavailable())),"object"===_typeof(f.bootstrap)&&(a=f.bootstrap,h=Object.keys(a),!(s=a[N="$flagsState"])&&h.length&&c.warn(bootstrapOldFormat()),!1===a.$valid&&c.warn(bootstrapInvalid()),u={},h.forEach(function(e){var n;e!==N&&"$valid"!==e&&(n={value:a[e]},s&&s[e]?n=extend(n,s[e]):n.version=0,u[e]=n)}),S=u),U?((b=U.getInitialState())?ee(b):U.on("init",ee),U.on("update",function(e){e.user&&L.setUser(e.user);e.flags&&A(e.flags)})):(R?q.validateUser(x).then(function(e){return L.setUser(e),"object"===_typeof(f.bootstrap)?F():t?O.loadFlags().then(function(e){return null==e?(S={},w.fetchFlagSettings(L.getUser(),m).then(function(e){return A(e||{})}).then(F).catch(function(e){ne(new LDFlagFetchError(errorFetchingFlags(e)))})):(S=e,onNextTick(F),w.fetchFlagSettings(L.getUser(),m).then(A).catch(function(e){return l.maybeReportError(e)}))}):w.fetchFlagSettings(L.getUser(),m).then(function(e){S=e||{},B(),F()}).catch(function(e){S={},ne(e)})}):Promise.reject(new LDInvalidEnvironmentIdError(environmentNotSpecified()))).catch(ne),{client:{waitForInitialization:function(){return d.getInitializationPromise()},waitUntilReady:function(){return d.getReadyPromise()},identify:function(e,r,n){return T?wrapPromiseCallback(Promise.resolve({}),n):U?(c.warn(identifyDisabled()),wrapPromiseCallback(Promise.resolve(transformVersionedValuesToValues(S)),n)):wrapPromiseCallback((t&&O?O.clearFlags():Promise.resolve()).then(function(){return q.validateUser(e)}).then(function(t){return w.fetchFlagSettings(t,r).then(function(e){var n=transformVersionedValuesToValues(e);return L.setUser(t),m=r,e?A(e).then(function(){return n}):n})}).then(function(e){return i&&G(),e}).catch(function(e){return l.maybeReportError(e),Promise.reject(e)}),n)},getUser:function(){return L.getUser()},variation:function(e,n){return J(e,n,!0,!1,!1).value},variationDetail:function(e,n){return J(e,n,!0,!0,!1)},track:function(e,n,t){var r;"string"!=typeof e?l.maybeReportError(new LDInvalidEventKeyError(unknownCustomEventKey(e))):(o.customEventFilter&&!o.customEventFilter(e)&&c.warn(unknownCustomEventKey(e)),r={kind:"custom",key:e,user:e=L.getUser(),url:o.getCurrentUrl(),creationDate:(new Date).getTime()},e&&e.anonymous&&(r.contextKind=j(e)),null!=n&&(r.data=n),null!=t&&(r.metricValue=t),C(r))},alias:W,on:function(e,n,t){Z(e)?(r=!0,H&&Y(),l.on(e,n,t)):l.on.apply(l,arguments)},off:function(e){var n;l.off.apply(l,arguments),Z(e)&&(n=!1,l.getEvents().forEach(function(e){Z(e)&&0<l.getEventListenerCount(e)&&(n=!0)}),n||(r=!1,i&&void 0===I&&X()))},setStreaming:function(e){(e=null===e?void 0:e)!==I&&(I=e,Y())},flush:function(e){return wrapPromiseCallback(v?D.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(S)for(var n in S)objectHasOwnProperty(S,n)&&!S[n].deleted&&(e[n]=J(n,null,!f.sendEventsOnlyForVariation,!1,!0).value);return e},close:function(e){var n;return T?wrapPromiseCallback(Promise.resolve(),e):(n=function(){T=!0,S={}},wrapPromiseCallback(Promise.resolve().then(function(){if(X(),k&&k.stop(),v)return D.stop(),D.flush()}).then(n).catch(n),e))}},options:f,emitter:l,ident:L,logger:c,requestor:w,start:function(){v&&(k&&k.start(),D.start())},enqueueEvent:C,getFlagsInternal:function(){return S},getEnvironmentId:function(){return p},internalChangeEventName:internalChangeEvent}}var version="3.8.0";exports.commonBasicLogger=commonBasicLogger,exports.createConsoleLogger=createConsoleLogger,exports.errors=errors,exports.initialize=initialize,exports.messages=messages,exports.utils=utils,exports.version=version;
//# sourceMappingURL=ldclient-common.cjs.js.map

@@ -1,2 +0,2 @@

function e(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function n(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?e(Object(i),!0).forEach((function(e){r(n,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"==typeof e)return o(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return o(e,n)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function a(e){function n(e,n){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=n}return n.prototype=new Error,n.prototype.name=e,n.prototype.constructor=n,n}var u=a("LaunchDarklyUnexpectedResponseError"),s=a("LaunchDarklyInvalidEnvironmentIdError"),c=a("LaunchDarklyInvalidUserError"),l=a("LaunchDarklyInvalidEventKeyError"),f=a("LaunchDarklyInvalidArgumentError"),v=a("LaunchDarklyFlagFetchError"),d=a("LaunchDarklyInvalidDataError");function g(e){return!(e>=400&&e<500)||(400===e||408===e||429===e)}for(var p=Object.freeze({__proto__:null,LDUnexpectedResponseError:u,LDInvalidEnvironmentIdError:s,LDInvalidUserError:c,LDInvalidEventKeyError:l,LDInvalidArgumentError:f,LDFlagFetchError:v,LDInvalidDataError:d,isHttpErrorRecoverable:g}),m=function(e){for(var n,t=e.length,r=t%3,i=[],o=0,a=t-r;o<a;o+=16383)i.push(w(e,o,o+16383>a?a:o+16383));1===r?(n=e[t-1],i.push(y[n>>2]+y[n<<4&63]+"==")):2===r&&(n=(e[t-2]<<8)+e[t-1],i.push(y[n>>10]+y[n>>4&63]+y[n<<2&63]+"="));return i.join("")},y=[],h=[],b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=0,E=b.length;k<E;++k)y[k]=b[k],h[b.charCodeAt(k)]=k;function w(e,n,t){for(var r,i,o=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(y[(i=r)>>18&63]+y[i>>12&63]+y[i>>6&63]+y[63&i]);return o.join("")}h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63;var D=Array.isArray,O=Object.keys,P=Object.prototype.hasOwnProperty,S=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function U(e,n){return(e.endsWith("/")?e.substring(0,e.length-1):e)+(n.startsWith("/")?"":"/")+n}function I(e){var n=unescape(encodeURIComponent(e));return m(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(n))}function j(e){return I(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function T(e){return JSON.parse(JSON.stringify(e))}function R(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,i,o,a=D(n),u=D(t);if(a&&u){if((i=n.length)!=t.length)return!1;for(r=i;0!=r--;)if(!e(n[r],t[r]))return!1;return!0}if(a!=u)return!1;var s=n instanceof Date,c=t instanceof Date;if(s!=c)return!1;if(s&&c)return n.getTime()==t.getTime();var l=n instanceof RegExp,f=t instanceof RegExp;if(l!=f)return!1;if(l&&f)return n.toString()==t.toString();var v=O(n);if((i=v.length)!==O(t).length)return!1;for(r=i;0!=r--;)if(!P.call(t,v[r]))return!1;for(r=i;0!=r--;)if(!e(n[o=v[r]],t[o]))return!1;return!0}return n!=n&&t!=t}(e,n)}function A(e){setTimeout(e,0)}function L(e,n){var t=e.then((function(e){return n&&setTimeout((function(){n(null,e)}),0),e}),(function(e){if(!n)return Promise.reject(e);setTimeout((function(){n(e,null)}),0)}));return n?void 0:t}function C(e){var n={};for(var t in e)q(e,t)&&(n[t]={value:e[t],version:0});return n}function N(e){var n={};for(var t in e)q(e,t)&&(n[t]=e[t].value);return n}function F(e,n){for(var t,r=n.slice(0),i=[],o=e;r.length>0;){for(t=[];o>0;){var a=r.shift();if(!a)break;(o-=j(JSON.stringify(a)).length)<0&&t.length>0?r.unshift(a):t.push(a)}o=e,i.push(t)}return i}function x(e){var n=e.version||"3.7.0";return e.userAgent+"/"+n}function V(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce((function(e,t){return n(n({},e),t)}),{})}function q(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function _(e){if(!e)return e;var t;for(var r in S){var i=S[r],o=e[i];void 0!==o&&"string"!=typeof o&&((t=t||n({},e))[i]=String(o))}return t||e}var z=Object.freeze({__proto__:null,appendUrlPath:U,btoa:I,base64URLEncode:j,clone:T,deepEquals:R,onNextTick:A,wrapPromiseCallback:L,transformValuesToVersionedValues:C,transformVersionedValuesToValues:N,chunkUserEventsForUrl:F,getLDUserAgentString:x,extend:V,objectHasOwnProperty:q,sanitizeUser:_});for(var J=function(e,n){return e(n={exports:{}},n.exports),n.exports}((function(e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var t=new Uint8Array(16);e.exports=function(){return n(t),t}}else{var r=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),r[n]=e>>>((3&n)<<3)&255;return r}}})),M=[],K=0;K<256;++K)M[K]=(K+256).toString(16).substr(1);var $,B,H=function(e,n){var t=n||0,r=M;return[r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]]].join("")},G=0,W=0;var X=function(e,n,t){var r=n&&t||0,i=n||[],o=(e=e||{}).node||$,a=void 0!==e.clockseq?e.clockseq:B;if(null==o||null==a){var u=J();null==o&&(o=$=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=B=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:W+1,l=s-G+(c-W)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||s>G)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");G=s,W=c,B=a;var f=(1e4*(268435455&(s+=122192928e5))+c)%4294967296;i[r++]=f>>>24&255,i[r++]=f>>>16&255,i[r++]=f>>>8&255,i[r++]=255&f;var v=s/4294967296*1e4&268435455;i[r++]=v>>>8&255,i[r++]=255&v,i[r++]=v>>>24&15|16,i[r++]=v>>>16&255,i[r++]=a>>>8|128,i[r++]=255&a;for(var d=0;d<6;++d)i[r+d]=o[d];return n||H(i)},Q=["debug","info","warn","error","none"];function Y(e,n){if(e&&e.destination&&"function"!=typeof e.destination)throw new Error("destination for basicLogger was set to a non-function");function t(e){return function(n){console&&console[e]&&console[e].call(console,n)}}var r=e&&e.destination?[e.destination,e.destination,e.destination,e.destination]:[t("log"),t("info"),t("warn"),t("error")],o=!(!e||!e.destination),a=e&&void 0!==e.prefix&&null!==e.prefix?e.prefix:"[LaunchDarkly] ",u=1;if(e&&e.level)for(var s=0;s<Q.length;s++)Q[s]===e.level&&(u=s);function c(e,t,u){if(!(u.length<1)){var s,c=o?t+": "+a:a;if(1!==u.length&&n){var l=i(u);l[0]=c+l[0],s=n.apply(void 0,i(l))}else s=c+u[0];try{r[e](s)}catch(e){console&&console.log&&console.log("[LaunchDarkly] Configured logger's "+t+" method threw an exception: "+e)}}}for(var l={},f=function(e){var n=Q[e];if("none"!==n)if(e<u)l[n]=function(){};else{var t=e;l[n]=function(){c(t,n,arguments)}}},v=0;v<Q.length;v++)f(v);return l}function Z(e,n){return Y({level:e,prefix:n})}function ee(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var ne=function(){return"LaunchDarkly client initialized"},te=" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initializing-the-client for instructions on SDK initialization.",re=function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},ie=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"},oe=function(e){return'Expected application/json content type but got "'+e+'"'},ae=function(e){return"local storage is unavailable: "+ee(e)},ue=function(e){return"network error"+(e?" ("+e+")":"")},se=function(e){return'Custom event "'+e+'" does not exist'},ce=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+te},le=function(){return"No environment/client-side ID was specified."+te},fe=function(e){return"Error fetching flag settings: "+ee(e)},ve=function(){return"No user specified."+te},de=function(){return"Invalid user specified."+te},ge=function(){return"Invalid data received from LaunchDarkly; connection may have been interrupted"},pe=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+te},me=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},ye=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},he=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(g(e)?t:"giving up permanently")},be=function(){return"Cannot make HTTP requests in this environment."+te},ke=function(){return"identify() has no effect here; it must be called on the main client instance"},Ee=function(){return"Closing stream connection"},we=function(e){return"Opening stream connection to "+e},De=function(e,n){return"Error on stream connection: "+ee(e)+", will continue retrying every "+n+" milliseconds."},Oe=function(e){return'Ignoring unknown config option "'+e+'"'},Pe=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},Se=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},Ue=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},Ie=function(e){return"polling for feature flags at "+e},je=function(){return"received ping message from stream"},Te=function(){return"received streaming update for all flags"},Re=function(e){return'received streaming update for flag "'+e+'"'},Ae=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},Le=function(e){return'received streaming deletion for flag "'+e+'"'},Ce=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},Ne=function(e){return'enqueueing "'+e+'" event'},Fe=function(e){return"sending "+e+" events"},xe=function(e){return'Config option "'.concat(e,'" must only contain letters, numbers, ., _ or -.')},Ve=Object.freeze({__proto__:null,clientInitialized:ne,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded:re,eventWithoutUser:ie,invalidContentType:oe,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:ae,networkError:ue,unknownCustomEventKey:se,environmentNotFound:ce,environmentNotSpecified:le,errorFetchingFlags:fe,userNotSpecified:ve,invalidUser:de,invalidData:ge,bootstrapOldFormat:pe,bootstrapInvalid:me,deprecated:ye,httpErrorMessage:he,httpUnavailable:be,identifyDisabled:ke,streamClosing:Ee,streamConnecting:we,streamError:De,unknownOption:Oe,wrongOptionType:Pe,wrongOptionTypeBoolean:Se,optionBelowMinimum:Ue,debugPolling:Ie,debugStreamPing:je,debugStreamPut:Te,debugStreamPatch:Re,debugStreamPatchIgnored:Ae,debugStreamDelete:Le,debugStreamDeleteIgnored:Ce,debugEnqueueingEvent:Ne,debugPostingEvents:Fe,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"},invalidTagValue:xe}),qe={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},requestHeaderTransform:{type:"function"},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},diagnosticRecordingInterval:{default:9e5,minimum:2e3},diagnosticOptOut:{default:!1},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"},autoAliasingOptOut:{default:!1},application:{validator:function(e,n,t,r){var i={};t.id&&(i.id=ze("".concat(e,".id"),n,t.id,r));t.version&&(i.version=ze("".concat(e,".version"),n,t.version,r));return i}}},_e=/^(\w|\.|-)+$/;function ze(e,n,t,r){if("string"==typeof t&&t.match(_e))return t;r.warn(xe(e))}function Je(e,n,r,i){var o=V({logger:{default:i}},qe,r),a={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null,allowFrequentDuplicateEvents:void 0};function u(e){A((function(){n&&n.maybeReportError(new f(e))}))}var s=V({},e||{});return function(e){var n=e;Object.keys(a).forEach((function(e){if(void 0!==n[e]){var t=a[e];i&&i.warn(ye(e,t)),t&&(void 0===n[t]&&(n[t]=n[e]),delete n[e])}}))}(s),function(e){Q.forEach((function(n){if("none"!==n&&(!e[n]||"function"!=typeof e[n]))throw new Error("Provided logger instance must support logger."+n+"(...) method")}))}((s=function(e){var n=V({},e),r=function(e){if(null===e)return"any";if(void 0!==e){if(Array.isArray(e))return"array";var n=t(e);return"boolean"===n||"string"===n||"number"===n||"function"===n?n:"object"}};return Object.keys(e).forEach((function(t){var a=e[t];if(null!=a){var s=o[t];if(void 0===s)u(Oe(t));else{var c=s.type||r(s.default),l=s.validator;if(l){var f=l(t,e,e[t],i);void 0!==f?n[t]=f:delete n[t]}else if("any"!==c){var v=c.split("|"),d=r(a);v.indexOf(d)<0?"boolean"===c?(n[t]=!!a,u(Se(t,d))):(u(Pe(t,c,d)),n[t]=s.default):"number"===d&&void 0!==s.minimum&&a<s.minimum&&(u(Ue(t,a,s.minimum)),n[t]=s.minimum)}}}})),n}(s=function(e){var n=V({},e);return Object.keys(o).forEach((function(e){void 0!==n[e]&&null!==n[e]||(n[e]=o[e]&&o[e].default)})),n}(s))).logger),s}function Me(e){var n={};return e&&(e.application&&void 0!==e.application.id&&null!==e.application.id&&(n["application-id"]=[e.application.id]),e.application&&void 0!==e.application.version&&null!==e.application.id&&(n["application-version"]=[e.application.version])),n}function Ke(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":x(e)};n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName);var r=Me(n),i=Object.keys(r);return i.length&&(t["x-launchdarkly-tags"]=i.sort().flatMap((function(e){return Array.isArray(r[e])?r[e].sort().map((function(n){return"".concat(e,"/").concat(n)})):["".concat(e,"/").concat(r[e])]})).join(" ")),t}function $e(e,t){return t&&t.requestHeaderTransform?t.requestHeaderTransform(n({},e)):e}function Be(e,n,t){var r="/a/"+n+".gif",i=V({"Content-Type":"application/json"},Ke(e,t)),o=e.httpFallbackPing,a={};return a.sendChunk=function(n,a,u,s){var c=JSON.stringify(n),l=u?null:X();return s?function n(r){var o=u?i:V({},i,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":l});return e.httpRequest("POST",a,$e(o,t),c).promise.then((function(e){if(e)return e.status>=400&&g(e.status)&&r?n(!1):function(e){var n={status:e.status},t=e.header("date");if(t){var r=Date.parse(t);r&&(n.serverTime=r)}return n}(e)})).catch((function(){return r?n(!1):Promise.reject()}))}(!0).catch((function(){})):(o&&o(a+r+"?d="+j(c)),Promise.resolve())},a.sendEvents=function(n,t,r){if(!e.httpRequest)return Promise.resolve();var i,o=e.httpAllowsPost();i=o?[n]:F(2e3-t.length,n);for(var u=[],s=0;s<i.length;s++)u.push(a.sendChunk(i[s],t,r,o));return Promise.all(u)},a}function He(){var e={},n=0,t=0,r={};return e.summarizeEvent=function(e){if("feature"===e.kind){var i=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),o=r[i];o?o.count=o.count+1:r[i]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===n||e.creationDate<n)&&(n=e.creationDate),e.creationDate>t&&(t=e.creationDate)}},e.getSummary=function(){var e={},i=!0;for(var o in r){var a=r[o],u=e[a.key];u||(u={default:a.default,counters:[]},e[a.key]=u);var s={value:a.value,count:a.count};void 0!==a.variation&&null!==a.variation&&(s.variation=a.variation),a.version?s.version=a.version:s.unknown=!0,u.counters.push(s),i=!1}return i?null:{startDate:n,endDate:t,features:e}},e.clearSummary=function(){n=0,t=0,r={}},e}function Ge(e){var n={},t=e.allAttributesPrivate,r=e.privateAttributeNames||[],i={key:!0,custom:!0,anonymous:!0},o={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0};return n.filterUser=function(e){if(!e)return null;var n=e.privateAttributeNames||[],a=function(e,o){return Object.keys(e).reduce((function(a,u){var s=a;return o(u)&&(!function(e){return!i[e]&&(t||-1!==n.indexOf(e)||-1!==r.indexOf(e))}(u)?s[0][u]=e[u]:s[1][u]=!0),s}),[{},{}])},u=a(e,(function(e){return o[e]})),s=u[0],c=u[1];if(e.custom){var l=a(e.custom,(function(){return!0}));s.custom=l[0],c=V({},c,l[1])}var f=Object.keys(c);return f.length&&(f.sort(),s.privateAttrs=f),s},n}function We(e){var n={},t={};return n.on=function(e,n,r){t[e]=t[e]||[],t[e]=t[e].concat({handler:n,context:r})},n.off=function(e,n,r){if(t[e])for(var i=0;i<t[e].length;i++)t[e][i].handler===n&&t[e][i].context===r&&(t[e]=t[e].slice(0,i).concat(t[e].slice(i+1)))},n.emit=function(e){if(t[e])for(var n=t[e].slice(0),r=0;r<n.length;r++)n[r].handler.apply(n[r].context,Array.prototype.slice.call(arguments,1))},n.getEvents=function(){return Object.keys(t)},n.getEventListenerCount=function(e){return t[e]?t[e].length:0},n.maybeReportError=function(n){n&&(t["error"]?this.emit("error",n):(e||console).error(n.message))},n}var Xe=function(e){var n=!1,t=!1,r=null,i=null,o=new Promise((function(n){e.on("ready",(function t(){e.off("ready",t),n()}))})).catch((function(){}));return{getInitializationPromise:function(){return i||(n?Promise.resolve():t?Promise.reject(r):i=new Promise((function(n,t){e.on("initialized",(function t(){e.off("initialized",t),n()})),e.on("failed",(function n(r){e.off("failed",n),t(r)}))})))},getReadyPromise:function(){return o},signalSuccess:function(){n||t||(n=!0,e.emit("initialized"),e.emit("ready"))},signalFailure:function(i){n||t||(t=!0,r=i,e.emit("failed",i),e.emit("ready")),e.maybeReportError(i)}}};function Qe(e,n,t,r){var i={};function o(){var e="",i=r.getUser();return i&&(e=t||I(JSON.stringify(i))),"ld:"+n+":"+e}return i.loadFlags=function(){return e.get(o()).then((function(e){if(null==e)return null;try{var n=JSON.parse(e);if(n){var t=n.$schema;void 0===t||t<1?n=C(n):delete n.$schema}return n}catch(e){return i.clearFlags().then((function(){return null}))}}))},i.saveFlags=function(n){var t=V({},n,{$schema:1});return e.set(o(),JSON.stringify(t))},i.clearFlags=function(){return e.clear(o())},i}function Ye(e,n,t,r){var i,o=n.streamUrl,a=n.logger,u={},s=U(o,"/eval/"+t),c=n.useReport,l=n.evaluationReasons,f=n.streamReconnectDelay,v=Ke(e,n),d=!1,g=null,p=null,m=null,y=null,h=null;function b(e){d||(a.warn(De(e,f)),d=!0),D(!1),w(),k(f)}function k(e){p||(e?p=setTimeout(E,e):E())}function E(){var r;p=null;var u="",f={headers:v,readTimeoutMillis:3e5};if(e.eventSourceFactory){for(var d in null!=y&&(u="h="+y),c?e.eventSourceAllowsReport?(r=s,f.method="REPORT",f.headers["Content-Type"]="application/json",f.body=JSON.stringify(m)):(r=U(o,"/ping/"+t),u=""):r=s+"/"+j(JSON.stringify(m)),f.headers=$e(f.headers,n),l&&(u=u+(u?"&":"")+"withReasons=true"),r=r+(u?"?":"")+u,w(),a.info(we(r)),i=(new Date).getTime(),g=e.eventSourceFactory(r,f),h)q(h,d)&&g.addEventListener(d,h[d]);g.onerror=b}}function w(){g&&(a.info("Closing stream connection"),g.close(),g=null)}function D(e){i&&r&&r.recordStreamInit(i,!e,(new Date).getTime()-i),i=null}return u.connect=function(e,n,t){m=e,y=n,h={};var r=function(e){h[e]=function(n){d=!1,D(!0),t[e]&&t[e](n)}};for(var i in t||{})r(i);k()},u.disconnect=function(){clearTimeout(p),p=null,w()},u.isConnected=function(){return!!(g&&e.eventSourceIsActive&&e.eventSourceIsActive(g))},u}function Ze(e,n,t){var r=n.baseUrl,i=n.useReport,o=n.evaluationReasons,a=n.logger,u={},c={};function l(t,r){if(!e.httpRequest)return new Promise((function(e,n){n(new v(be()))}));var i=r?"REPORT":"GET",o=Ke(e,n);r&&(o["Content-Type"]="application/json");var a=c[t];a||(a=function(e){var n,t,r,i,o={addPromise:function(o,a){n=o,t&&t(),t=a,o.then((function(t){n===o&&(r(t),e&&e())}),(function(t){n===o&&(i(t),e&&e())}))}};return o.resultPromise=new Promise((function(e,n){r=e,i=n})),o}((function(){delete c[t]})),c[t]=a);var u=e.httpRequest(i,t,$e(o,n),r),l=u.promise.then((function(e){if(200===e.status){if(e.header("content-type")&&"application/json"===e.header("content-type").substring(0,"application/json".length))return JSON.parse(e.body);var n=oe(e.header("content-type")||"");return Promise.reject(new v(n))}return Promise.reject(function(e){return 404===e.status?new s(ce()):new v(fe(e.statusText||String(e.status)))}(e))}),(function(e){return Promise.reject(new v(ue(e)))}));return a.addPromise(l,(function(){u.cancel&&u.cancel()})),a.resultPromise}return u.fetchJSON=function(e){return l(U(r,e),null)},u.fetchFlagSettings=function(e,n){var u,s,c,f="";return i?(s=[r,"/sdk/evalx/",t,"/user"].join(""),c=JSON.stringify(e)):(u=j(JSON.stringify(e)),s=[r,"/sdk/evalx/",t,"/users/",u].join("")),n&&(f="h="+n),o&&(f=f+(f?"&":"")+"withReasons=true"),s=s+(f?"?":"")+f,a.debug(Ie(s)),l(s,c)},u}function en(e){var n={};return n.validateUser=function(n){if(!n)return Promise.reject(new c(ve()));var t=T(n);return null!==t.key&&void 0!==t.key?(t.key=t.key.toString(),Promise.resolve(t)):t.anonymous?e.get("ld:$anonUserId").then((function(n){if(n)return t.key=n,t;var r=X();return t.key=r,function(n){return e.set("ld:$anonUserId",n)}(r).then((function(){return t}))})):Promise.reject(new c(de()))},n}var nn=Object.freeze({__proto__:null,baseOptionDefs:qe,validate:Je,getTags:Me}).baseOptionDefs,tn=z.appendUrlPath;var rn=function(e){var n={diagnosticId:X()};return e&&(n.sdkKeySuffix=e.length>6?e.substring(e.length-6):e),n},on=function(e){var n,t,r,i;function o(e){n=e,t=0,r=0,i=[]}return o(e),{getProps:function(){return{dataSinceDate:n,droppedEvents:t,eventsInLastBatch:r,streamInits:i}},setProps:function(e){n=e.dataSinceDate,t=e.droppedEvents||0,r=e.eventsInLastBatch||0,i=e.streamInits||[]},incrementDroppedEvents:function(){t++},setEventsInLastBatch:function(e){r=e},recordStreamInit:function(e,n,t){var r={timestamp:e,failed:n,durationMillis:t};i.push(r)},reset:o}},an=function(e,t,r,i,o,a,u){var s,c,l=!!e.diagnosticUseCombinedEvent,f="ld:"+o+":$diagnostics",v=tn(a.eventsUrl,"/events/diagnostic/"+o),d=a.diagnosticRecordingInterval,g=r,p=!!a.streaming,m={};function y(){return{sdk:k(),configuration:(n={customBaseURI:a.baseUrl!==nn.baseUrl.default,customStreamURI:a.streamUrl!==nn.streamUrl.default,customEventsURI:a.eventsUrl!==nn.eventsUrl.default,eventsCapacity:a.eventCapacity,eventsFlushIntervalMillis:a.flushInterval,reconnectTimeMillis:a.streamReconnectDelay,streamingDisabled:!p,allAttributesPrivate:!!a.allAttributesPrivate,inlineUsersInEvents:!!a.inlineUsersInEvents,diagnosticRecordingIntervalMillis:a.diagnosticRecordingInterval,usingSecureMode:!!a.hash,bootstrapMode:!!a.bootstrap,fetchGoalsDisabled:!a.fetchGoals,sendEventsOnlyForVariation:!!a.sendEventsOnlyForVariation,autoAliasingOptOut:!!a.autoAliasingOptOut},n),platform:e.diagnosticPlatformData};var n}function h(e){a.logger&&a.logger.debug(Ve.debugPostingDiagnosticEvent(e)),i.sendEvents(e,v,!0).then((function(){})).catch((function(){}))}function b(){var e,r;h((e=(new Date).getTime(),r=n({kind:l?"diagnostic-combined":"diagnostic",id:u,creationDate:e},g.getProps()),l&&(r=n(n({},r),y())),g.reset(e),r)),c=setTimeout(b,d),s=(new Date).getTime(),l&&function(){if(t.isEnabled()){var e=n({},g.getProps());t.set(f,JSON.stringify(e))}}()}function k(){var t=n({},e.diagnosticSdkData);return a.wrapperName&&(t.wrapperName=a.wrapperName),a.wrapperVersion&&(t.wrapperVersion=a.wrapperVersion),t}return m.start=function(){l?function(e){if(!t.isEnabled())return e(!1);t.get(f).then((function(n){if(n)try{var t=JSON.parse(n);g.setProps(t),s=t.dataSinceDate}catch(e){}e(!0)})).catch((function(){e(!1)}))}((function(e){if(e){var n=(s||0)+d,t=(new Date).getTime();t>=n?b():c=setTimeout(b,n-t)}else 0===Math.floor(4*Math.random())?b():c=setTimeout(b,d)})):(h(n({kind:"diagnostic-init",id:u,creationDate:g.getProps().dataSinceDate},y())),c=setTimeout(b,d))},m.stop=function(){c&&clearTimeout(c)},m.setStreaming=function(e){p=e},m};function un(e,r,i,o,a){var c,f,p,m=function(){if(i&&i.logger)return i.logger;return a&&a.logger&&a.logger.default||Z("warn")}(),y=We(m),h=Xe(y),b=Je(i,y,a,m),k=b.sendEvents,E=e,w=b.hash,D=function(e,n){var t={},r=!1,i=function(e){r||(r=!0,n.warn(ae(e)))};return t.isEnabled=function(){return!!e},t.get=function(n){return new Promise((function(t){e?e.get(n).then(t).catch((function(e){i(e),t(void 0)})):t(void 0)}))},t.set=function(n,t){return new Promise((function(r){e?e.set(n,t).then((function(){return r(!0)})).catch((function(e){i(e),r(!1)})):r(!1)}))},t.clear=function(n){return new Promise((function(t){e?e.clear(n).then((function(){return t(!0)})).catch((function(e){i(e),t(!1)})):t(!1)}))},t}(o.localStorage,m),O=Be(o,E,b),P=b.sendEvents&&!b.diagnosticOptOut,S=P?rn(E):null,I=P?on((new Date).getTime()):null,j=P?an(o,D,I,O,E,b,S):null,C=Ye(o,b,E,I),F=b.eventProcessor||function(e,n,t){var r,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s={},c=a||Be(e,t,n),l=U(n.eventsUrl,"/events/bulk/"+t),f=He(),v=Ge(n),d=n.inlineUsersInEvents,p=n.samplingInterval,m=n.eventCapacity,y=n.flushInterval,h=n.logger,b=[],k=0,E=!1,w=!1;function D(){return 0===p||0===Math.floor(Math.random()*p)}function O(e){return!!e.debugEventsUntilDate&&(e.debugEventsUntilDate>k&&e.debugEventsUntilDate>(new Date).getTime())}function P(e){var n=V({},e);return"alias"===e.kind||(d||"identify"===e.kind?n.user=v.filterUser(e.user):(n.userKey=e.user.key,delete n.user),"feature"===e.kind&&(delete n.trackEvents,delete n.debugEventsUntilDate)),n}function S(e){b.length<m?(b.push(e),w=!1):(w||(w=!0,h.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),i&&i.incrementDroppedEvents())}return s.enqueue=function(e){if(!E){var n=!1,t=!1;if(f.summarizeEvent(e),"feature"===e.kind?D()&&(n=!!e.trackEvents,t=O(e)):n=D(),n&&S(P(e)),t){var r=V({},e,{kind:"debug"});r.user=v.filterUser(r.user),delete r.trackEvents,delete r.debugEventsUntilDate,S(r)}}},s.flush=function(){if(E)return Promise.resolve();var e=b,n=f.getSummary();return f.clearSummary(),n&&(n.kind="summary",e.push(n)),i&&i.setEventsInLastBatch(e.length),0===e.length?Promise.resolve():(b=[],h.debug(Fe(e.length)),c.sendEvents(e,l).then((function(e){e&&(e.serverTime&&(k=e.serverTime),g(e.status)||(E=!0),e.status>=400&&A((function(){o.maybeReportError(new u(he(e.status,"event posting","some events were dropped")))})))})))},s.start=function(){r=setTimeout((function e(){s.flush(),r=setTimeout(e,y)}),y)},s.stop=function(){clearTimeout(r)},s}(o,b,E,I,y,O),x=Ze(o,b,E),z={},J=b.streaming,M=!1,K=!1,$=!0,B=b.stateProvider,H=function(e,n){var t,r={};return r.setUser=function(e){var r=t&&T(t);(t=_(e))&&n&&n(T(t),r)},r.getUser=function(){return t?T(t):null},e&&r.setUser(e),r}(null,(function(e,n){(function(e){if(B)return;e&&X({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})})(e),!b.autoAliasingOptOut&&n&&n.anonymous&&e&&!e.anonymous&&te(e,n)})),G=en(D),W=D.isEnabled()?new Qe(D,E,w,H,m):null;function X(e){if(E&&!(B&&B.enqueueEvent&&B.enqueueEvent(e))){if("alias"!==e.kind){if(!e.user)return void($&&(m.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"),$=!1));$=!1}!k||K||o.isDoNotTrack()||(m.debug(Ne(e.kind)),F.enqueue(e))}}function Q(e,n,t,r){var i=H.getUser(),o=new Date,a={kind:"feature",key:e,user:i,value:n?n.value:null,variation:n?n.variationIndex:null,default:t,creationDate:o.getTime()};i&&i.anonymous&&(a.contextKind=ne(i));var u=z[e];u&&(a.version=u.flagVersion?u.flagVersion:u.version,a.trackEvents=u.trackEvents,a.debugEventsUntilDate=u.debugEventsUntilDate),(r||u&&u.trackReason)&&n&&(a.reason=n.reason),X(a)}function Y(e,n,t,r){var i;if(z&&q(z,e)&&z[e]&&!z[e].deleted){var o=z[e];i=ee(o),null!==o.value&&void 0!==o.value||(i.value=n)}else i={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&Q(e,i,n,r),i}function ee(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function ne(e){return e.anonymous?"anonymousUser":"user"}function te(e,n){B||e&&n&&X({kind:"alias",key:e.key,contextKind:ne(e),previousKey:n.key,previousContextKind:ne(n),creationDate:(new Date).getTime()})}function re(){if(f=!0,H.getUser()){var e=function(e){try{return JSON.parse(e)}catch(e){return void y.maybeReportError(new d("Invalid data received from LaunchDarkly; connection may have been interrupted"))}};C.connect(H.getUser(),w,{ping:function(){m.debug("received ping message from stream");var e=H.getUser();x.fetchFlagSettings(e,w).then((function(n){R(e,H.getUser())&&oe(n||{})})).catch((function(e){y.maybeReportError(new v(fe(e)))}))},put:function(n){var t=e(n.data);t&&(m.debug("received streaming update for all flags"),oe(t))},patch:function(n){var t=e(n.data);if(t){var r=z[t.key];if(!r||!r.version||!t.version||r.version<t.version){m.debug(Re(t.key));var i={},o=V({},t);delete o.key,z[t.key]=o;var a=ee(o);i[t.key]=r?{previous:r.value,current:a}:{current:a},ue(i)}else m.debug(Ae(t.key))}},delete:function(n){var t=e(n.data);if(t)if(!z[t.key]||z[t.key].version<t.version){m.debug(Le(t.key));var r={};z[t.key]&&!z[t.key].deleted&&(r[t.key]={previous:z[t.key].value}),z[t.key]={version:t.version,deleted:!0},ue(r)}else m.debug(Ce(t.key))}})}}function ie(){f&&(C.disconnect(),f=!1)}function oe(e){var t={};if(!e)return Promise.resolve();for(var r in z)q(z,r)&&z[r]&&(e[r]&&!R(e[r].value,z[r].value)?t[r]={previous:z[r].value,current:ee(e[r])}:e[r]&&!e[r].deleted||(t[r]={previous:z[r].value}));for(var i in e)q(e,i)&&e[i]&&(!z[i]||z[i].deleted)&&(t[i]={current:ee(e[i])});return z=n({},e),ue(t).catch((function(){}))}function ue(e){var n=Object.keys(e);if(n.length>0){var t={};n.forEach((function(n){var r=e[n].current,i=r?r.value:void 0,o=e[n].previous;y.emit("change:"+n,i,o),t[n]=r?{current:i,previous:o}:{previous:o}})),y.emit("change",t),y.emit("internal-change",z),b.sendEventsOnlyForVariation||B||n.forEach((function(n){Q(n,e[n].current)}))}return c&&W?W.saveFlags(z):Promise.resolve()}function ce(){var e=J||p&&void 0===J;e&&!f?re():!e&&f&&ie(),j&&j.setStreaming(e)}function ve(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}if("string"==typeof b.bootstrap&&"LOCALSTORAGE"===b.bootstrap.toUpperCase()&&(W?c=!0:m.warn(ae())),"object"===t(b.bootstrap)&&(z=function(e){var n=Object.keys(e),t=e.$flagsState;!t&&n.length&&m.warn(pe()),!1===e.$valid&&m.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var r={};return n.forEach((function(n){if("$flagsState"!==n&&"$valid"!==n){var i={value:e[n]};t&&t[n]?i=V(i,t[n]):i.version=0,r[n]=i}})),r}(b.bootstrap)),B){var de=B.getInitialState();de?ge(de):B.on("init",ge),B.on("update",(function(e){e.user&&H.setUser(e.user);e.flags&&oe(e.flags)}))}else(function(){if(!e)return Promise.reject(new s(le()));return G.validateUser(r).then((function(e){return H.setUser(e),"object"===t(b.bootstrap)?me():c?W.loadFlags().then((function(e){return null==e?(z={},x.fetchFlagSettings(H.getUser(),w).then((function(e){return oe(e||{})})).then(me).catch((function(e){ye(new v(fe(e)))}))):(z=e,A(me),x.fetchFlagSettings(H.getUser(),w).then((function(e){return oe(e)})).catch((function(e){return y.maybeReportError(e)})))})):x.fetchFlagSettings(H.getUser(),w).then((function(e){z=e||{},me()})).catch((function(e){z={},ye(e)}))}))})().catch(ye);function ge(e){E=e.environment,H.setUser(e.user),z=n({},e.flags),A(me)}function me(){m.info("LaunchDarkly client initialized"),M=!0,ce(),h.signalSuccess()}function ye(e){h.signalFailure(e)}return{client:{waitForInitialization:function(){return h.getInitializationPromise()},waitUntilReady:function(){return h.getReadyPromise()},identify:function(e,n,t){return K?L(Promise.resolve({}),t):B?(m.warn("identify() has no effect here; it must be called on the main client instance"),L(Promise.resolve(N(z)),t)):L((c&&W?W.clearFlags():Promise.resolve()).then((function(){return G.validateUser(e)})).then((function(e){return x.fetchFlagSettings(e,n).then((function(t){var r=N(t);return H.setUser(e),w=n,t?oe(t).then((function(){return r})):r}))})).then((function(e){return f&&re(),e})).catch((function(e){return y.maybeReportError(e),Promise.reject(e)})),t)},getUser:function(){return H.getUser()},variation:function(e,n){return Y(e,n,!0,!1).value},variationDetail:function(e,n){return Y(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){o.customEventFilter&&!o.customEventFilter(e)&&m.warn(se(e));var r=H.getUser(),i={kind:"custom",key:e,user:r,url:o.getCurrentUrl(),creationDate:(new Date).getTime()};r&&r.anonymous&&(i.contextKind=ne(r)),null!=n&&(i.data=n),null!=t&&(i.metricValue=t),X(i)}else y.maybeReportError(new l(se(e)))},alias:te,on:function(e,n,t){ve(e)?(p=!0,M&&ce(),y.on(e,n,t)):y.on.apply(y,arguments)},off:function(e){if(y.off.apply(y,arguments),ve(e)){var n=!1;y.getEvents().forEach((function(e){ve(e)&&y.getEventListenerCount(e)>0&&(n=!0)})),n||(p=!1,f&&void 0===J&&ie())}},setStreaming:function(e){var n=null===e?void 0:e;n!==J&&(J=n,ce())},flush:function(e){return L(k?F.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!z)return e;for(var n in z)q(z,n)&&!z[n].deleted&&(e[n]=Y(n,null,!b.sendEventsOnlyForVariation).value);return e},close:function(e){if(K)return L(Promise.resolve(),e);var n=function(){K=!0,z={}};return L(Promise.resolve().then((function(){if(ie(),j&&j.stop(),k)return F.stop(),F.flush()})).then(n).catch(n),e)}},options:b,emitter:y,ident:H,logger:m,requestor:x,start:function(){k&&(j&&j.start(),F.start())},enqueueEvent:X,getFlagsInternal:function(){return z},getEnvironmentId:function(){return E},internalChangeEventName:"internal-change"}}var sn="3.7.0";export{Y as commonBasicLogger,Z as createConsoleLogger,p as errors,un as initialize,Ve as messages,z as utils,sn as version};
function e(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function n(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?e(Object(i),!0).forEach((function(e){r(n,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==t)return;var r,i,o=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(o.push(r.value),!n||o.length!==n);a=!0);}catch(e){u=!0,i=e}finally{try{a||null==t.return||t.return()}finally{if(u)throw i}}return o}(e,n)||a(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,n){if(e){if("string"==typeof e)return u(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(e,n):void 0}}function u(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function c(e){function n(e,n){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=n}return n.prototype=new Error,n.prototype.name=e,n.prototype.constructor=n,n}var s=c("LaunchDarklyUnexpectedResponseError"),l=c("LaunchDarklyInvalidEnvironmentIdError"),f=c("LaunchDarklyInvalidUserError"),d=c("LaunchDarklyInvalidEventKeyError"),v=c("LaunchDarklyInvalidArgumentError"),g=c("LaunchDarklyFlagFetchError"),p=c("LaunchDarklyInvalidDataError");function m(e){return!(e>=400&&e<500)||(400===e||408===e||429===e)}for(var h=Object.freeze({__proto__:null,LDUnexpectedResponseError:s,LDInvalidEnvironmentIdError:l,LDInvalidUserError:f,LDInvalidEventKeyError:d,LDInvalidArgumentError:v,LDFlagFetchError:g,LDInvalidDataError:p,isHttpErrorRecoverable:m}),y=function(e){for(var n,t=e.length,r=t%3,i=[],o=0,a=t-r;o<a;o+=16383)i.push(O(e,o,o+16383>a?a:o+16383));1===r?(n=e[t-1],i.push(b[n>>2]+b[n<<4&63]+"==")):2===r&&(n=(e[t-2]<<8)+e[t-1],i.push(b[n>>10]+b[n>>4&63]+b[n<<2&63]+"="));return i.join("")},b=[],k=[],E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=0,D=E.length;w<D;++w)b[w]=E[w],k[E.charCodeAt(w)]=w;function O(e,n,t){for(var r,i,o=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(b[(i=r)>>18&63]+b[i>>12&63]+b[i>>6&63]+b[63&i]);return o.join("")}k["-".charCodeAt(0)]=62,k["_".charCodeAt(0)]=63;var S=Array.isArray,P=Object.keys,U=Object.prototype.hasOwnProperty,I=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function j(e,n){return(e.endsWith("/")?e.substring(0,e.length-1):e)+(n.startsWith("/")?"":"/")+n}function C(e){var n=unescape(encodeURIComponent(e));return y(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(n))}function T(e){return C(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function R(e){return JSON.parse(JSON.stringify(e))}function L(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,i,o,a=S(n),u=S(t);if(a&&u){if((i=n.length)!=t.length)return!1;for(r=i;0!=r--;)if(!e(n[r],t[r]))return!1;return!0}if(a!=u)return!1;var c=n instanceof Date,s=t instanceof Date;if(c!=s)return!1;if(c&&s)return n.getTime()==t.getTime();var l=n instanceof RegExp,f=t instanceof RegExp;if(l!=f)return!1;if(l&&f)return n.toString()==t.toString();var d=P(n);if((i=d.length)!==P(t).length)return!1;for(r=i;0!=r--;)if(!U.call(t,d[r]))return!1;for(r=i;0!=r--;)if(!e(n[o=d[r]],t[o]))return!1;return!0}return n!=n&&t!=t}(e,n)}function A(e){setTimeout(e,0)}function F(e,n){var t=e.then((function(e){return n&&setTimeout((function(){n(null,e)}),0),e}),(function(e){if(!n)return Promise.reject(e);setTimeout((function(){n(e,null)}),0)}));return n?void 0:t}function N(e){var n={};for(var t in e)z(e,t)&&(n[t]={value:e[t],version:0});return n}function x(e){var n={};for(var t in e)z(e,t)&&(n[t]=e[t].value);return n}function V(e,n){for(var t,r=n.slice(0),i=[],o=e;r.length>0;){for(t=[];o>0;){var a=r.shift();if(!a)break;(o-=T(JSON.stringify(a)).length)<0&&t.length>0?r.unshift(a):t.push(a)}o=e,i.push(t)}return i}function q(e){var n=e.version||"3.8.0";return e.userAgent+"/"+n}function _(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce((function(e,t){return n(n({},e),t)}),{})}function z(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function M(e){if(!e)return e;var t;for(var r in I){var i=I[r],o=e[i];void 0!==o&&"string"!=typeof o&&((t=t||n({},e))[i]=String(o))}return t||e}var J=Object.freeze({__proto__:null,appendUrlPath:j,btoa:C,base64URLEncode:T,clone:R,deepEquals:L,onNextTick:A,wrapPromiseCallback:F,transformValuesToVersionedValues:N,transformVersionedValuesToValues:x,chunkUserEventsForUrl:V,getLDUserAgentString:q,extend:_,objectHasOwnProperty:z,sanitizeUser:M});for(var K=function(e,n){return e(n={exports:{}},n.exports),n.exports}((function(e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var t=new Uint8Array(16);e.exports=function(){return n(t),t}}else{var r=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),r[n]=e>>>((3&n)<<3)&255;return r}}})),$=[],B=0;B<256;++B)$[B]=(B+256).toString(16).substr(1);var H,G,W=function(e,n){var t=n||0,r=$;return[r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]]].join("")},X=0,Q=0;var Y=function(e,n,t){var r=n&&t||0,i=n||[],o=(e=e||{}).node||H,a=void 0!==e.clockseq?e.clockseq:G;if(null==o||null==a){var u=K();null==o&&(o=H=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=G=16383&(u[6]<<8|u[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),s=void 0!==e.nsecs?e.nsecs:Q+1,l=c-X+(s-Q)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||c>X)&&void 0===e.nsecs&&(s=0),s>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");X=c,Q=s,G=a;var f=(1e4*(268435455&(c+=122192928e5))+s)%4294967296;i[r++]=f>>>24&255,i[r++]=f>>>16&255,i[r++]=f>>>8&255,i[r++]=255&f;var d=c/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=255&d,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=a>>>8|128,i[r++]=255&a;for(var v=0;v<6;++v)i[r+v]=o[v];return n||W(i)},Z=["debug","info","warn","error","none"];function ee(e,n){if(e&&e.destination&&"function"!=typeof e.destination)throw new Error("destination for basicLogger was set to a non-function");function t(e){return function(n){console&&console[e]&&console[e].call(console,n)}}var r=e&&e.destination?[e.destination,e.destination,e.destination,e.destination]:[t("log"),t("info"),t("warn"),t("error")],i=!(!e||!e.destination),a=e&&void 0!==e.prefix&&null!==e.prefix?e.prefix:"[LaunchDarkly] ",u=1;if(e&&e.level)for(var c=0;c<Z.length;c++)Z[c]===e.level&&(u=c);function s(e,t,u){if(!(u.length<1)){var c,s=i?t+": "+a:a;if(1!==u.length&&n){var l=o(u);l[0]=s+l[0],c=n.apply(void 0,o(l))}else c=s+u[0];try{r[e](c)}catch(e){console&&console.log&&console.log("[LaunchDarkly] Configured logger's "+t+" method threw an exception: "+e)}}}for(var l={},f=function(e){var n=Z[e];if("none"!==n)if(e<u)l[n]=function(){};else{var t=e;l[n]=function(){s(t,n,arguments)}}},d=0;d<Z.length;d++)f(d);return l}function ne(e,n){return ee({level:e,prefix:n})}function te(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var re=function(){return"LaunchDarkly client initialized"},ie=" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initializing-the-client for instructions on SDK initialization.",oe=function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},ae=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"},ue=function(e){return'Expected application/json content type but got "'+e+'"'},ce=function(e){return"local storage is unavailable: "+te(e)},se=function(e){return"network error"+(e?" ("+e+")":"")},le=function(e){return'Custom event "'+e+'" does not exist'},fe=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+ie},de=function(){return"No environment/client-side ID was specified."+ie},ve=function(e){return"Error fetching flag settings: "+te(e)},ge=function(){return"No user specified."+ie},pe=function(){return"Invalid user specified."+ie},me=function(){return"Invalid data received from LaunchDarkly; connection may have been interrupted"},he=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+ie},ye=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},be=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},ke=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(m(e)?t:"giving up permanently")},Ee=function(){return"Cannot make HTTP requests in this environment."+ie},we=function(){return"identify() has no effect here; it must be called on the main client instance"},De=function(){return"Closing stream connection"},Oe=function(e){return"Opening stream connection to "+e},Se=function(e,n){return"Error on stream connection: "+te(e)+", will continue retrying every "+n+" milliseconds."},Pe=function(e){return'Ignoring unknown config option "'+e+'"'},Ue=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},Ie=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},je=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},Ce=function(e){return"polling for feature flags at "+e},Te=function(){return"received ping message from stream"},Re=function(){return"received streaming update for all flags"},Le=function(e){return'received streaming update for flag "'+e+'"'},Ae=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},Fe=function(e){return'received streaming deletion for flag "'+e+'"'},Ne=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},xe=function(e){return'enqueueing "'+e+'" event'},Ve=function(e){return"sending "+e+" events"},qe=function(e){return'Config option "'.concat(e,'" must only contain letters, numbers, ., _ or -.')},_e=function(e,n){return'an inspector: "'.concat(n,'" of an invalid type (').concat(e,") was configured")},ze=function(e,n){return'an inspector: "'.concat(n,'" of type: "').concat(e,'" generated an exception')},Me=function(e){return'Value of "'.concat(e,'" was longer than 64 characters and was discarded.')},Je=Object.freeze({__proto__:null,clientInitialized:re,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded:oe,eventWithoutUser:ae,invalidContentType:ue,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:ce,networkError:se,unknownCustomEventKey:le,environmentNotFound:fe,environmentNotSpecified:de,errorFetchingFlags:ve,userNotSpecified:ge,invalidUser:pe,invalidData:me,bootstrapOldFormat:he,bootstrapInvalid:ye,deprecated:be,httpErrorMessage:ke,httpUnavailable:Ee,identifyDisabled:we,streamClosing:De,streamConnecting:Oe,streamError:Se,unknownOption:Pe,wrongOptionType:Ue,wrongOptionTypeBoolean:Ie,optionBelowMinimum:je,debugPolling:Ce,debugStreamPing:Te,debugStreamPut:Re,debugStreamPatch:Le,debugStreamPatchIgnored:Ae,debugStreamDelete:Fe,debugStreamDeleteIgnored:Ne,debugEnqueueingEvent:xe,debugPostingEvents:Ve,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"},invalidTagValue:qe,invalidInspector:_e,inspectorMethodError:ze,tagValueTooLong:Me}),Ke={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},requestHeaderTransform:{type:"function"},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},diagnosticRecordingInterval:{default:9e5,minimum:2e3},diagnosticOptOut:{default:!1},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"},autoAliasingOptOut:{default:!1},application:{validator:function(e,n,t){var r={};n.id&&(r.id=Be("".concat(e,".id"),n.id,t));n.version&&(r.version=Be("".concat(e,".version"),n.version,t));return r}},inspectors:{default:[]}},$e=/^(\w|\.|-)+$/;function Be(e,n,t){if("string"==typeof n&&n.match($e)){if(!(n.length>64))return n;t.warn(Me(e))}else t.warn(qe(e))}function He(e,n,r,i){var o=_({logger:{default:i}},Ke,r),a={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null,allowFrequentDuplicateEvents:void 0};function u(e){A((function(){n&&n.maybeReportError(new v(e))}))}var c=_({},e||{});return function(e){var n=e;Object.keys(a).forEach((function(e){if(void 0!==n[e]){var t=a[e];i&&i.warn(be(e,t)),t&&(void 0===n[t]&&(n[t]=n[e]),delete n[e])}}))}(c),function(e){Z.forEach((function(n){if("none"!==n&&(!e[n]||"function"!=typeof e[n]))throw new Error("Provided logger instance must support logger."+n+"(...) method")}))}((c=function(e){var n=_({},e),r=function(e){if(null===e)return"any";if(void 0!==e){if(Array.isArray(e))return"array";var n=t(e);return"boolean"===n||"string"===n||"number"===n||"function"===n?n:"object"}};return Object.keys(e).forEach((function(t){var a=e[t];if(null!=a){var c=o[t];if(void 0===c)u(Pe(t));else{var s=c.type||r(c.default),l=c.validator;if(l){var f=l(t,e[t],i);void 0!==f?n[t]=f:delete n[t]}else if("any"!==s){var d=s.split("|"),v=r(a);d.indexOf(v)<0?"boolean"===s?(n[t]=!!a,u(Ie(t,v))):(u(Ue(t,s,v)),n[t]=c.default):"number"===v&&void 0!==c.minimum&&a<c.minimum&&(u(je(t,a,c.minimum)),n[t]=c.minimum)}}}})),n}(c=function(e){var n=_({},e);return Object.keys(o).forEach((function(e){void 0!==n[e]&&null!==n[e]||(n[e]=o[e]&&o[e].default)})),n}(c))).logger),c}function Ge(e){var n={};return e&&(e.application&&void 0!==e.application.id&&null!==e.application.id&&(n["application-id"]=[e.application.id]),e.application&&void 0!==e.application.version&&null!==e.application.id&&(n["application-version"]=[e.application.version])),n}function We(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":q(e)};n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName);var r=Ge(n),i=Object.keys(r);return i.length&&(t["x-launchdarkly-tags"]=i.sort().flatMap((function(e){return Array.isArray(r[e])?r[e].sort().map((function(n){return"".concat(e,"/").concat(n)})):["".concat(e,"/").concat(r[e])]})).join(" ")),t}function Xe(e,t){return t&&t.requestHeaderTransform?t.requestHeaderTransform(n({},e)):e}function Qe(e,n,t){var r="/a/"+n+".gif",i=_({"Content-Type":"application/json"},We(e,t)),o=e.httpFallbackPing,a={};return a.sendChunk=function(n,a,u,c){var s=JSON.stringify(n),l=u?null:Y();return c?function n(r){var o=u?i:_({},i,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":l});return e.httpRequest("POST",a,Xe(o,t),s).promise.then((function(e){if(e)return e.status>=400&&m(e.status)&&r?n(!1):function(e){var n={status:e.status},t=e.header("date");if(t){var r=Date.parse(t);r&&(n.serverTime=r)}return n}(e)})).catch((function(){return r?n(!1):Promise.reject()}))}(!0).catch((function(){})):(o&&o(a+r+"?d="+T(s)),Promise.resolve())},a.sendEvents=function(n,t,r){if(!e.httpRequest)return Promise.resolve();var i,o=e.httpAllowsPost();i=o?[n]:V(2e3-t.length,n);for(var u=[],c=0;c<i.length;c++)u.push(a.sendChunk(i[c],t,r,o));return Promise.all(u)},a}function Ye(){var e={},n=0,t=0,r={};return e.summarizeEvent=function(e){if("feature"===e.kind){var i=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),o=r[i];o?o.count=o.count+1:r[i]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===n||e.creationDate<n)&&(n=e.creationDate),e.creationDate>t&&(t=e.creationDate)}},e.getSummary=function(){var e={},i=!0;for(var o in r){var a=r[o],u=e[a.key];u||(u={default:a.default,counters:[]},e[a.key]=u);var c={value:a.value,count:a.count};void 0!==a.variation&&null!==a.variation&&(c.variation=a.variation),a.version?c.version=a.version:c.unknown=!0,u.counters.push(c),i=!1}return i?null:{startDate:n,endDate:t,features:e}},e.clearSummary=function(){n=0,t=0,r={}},e}function Ze(e){var n={},t=e.allAttributesPrivate,r=e.privateAttributeNames||[],i={key:!0,custom:!0,anonymous:!0},o={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0};return n.filterUser=function(e){if(!e)return null;var n=e.privateAttributeNames||[],a=function(e,o){return Object.keys(e).reduce((function(a,u){var c=a;return o(u)&&(!function(e){return!i[e]&&(t||-1!==n.indexOf(e)||-1!==r.indexOf(e))}(u)?c[0][u]=e[u]:c[1][u]=!0),c}),[{},{}])},u=a(e,(function(e){return o[e]})),c=u[0],s=u[1];if(e.custom){var l=a(e.custom,(function(){return!0}));c.custom=l[0],s=_({},s,l[1])}var f=Object.keys(s);return f.length&&(f.sort(),c.privateAttrs=f),c},n}function en(e){var n={},t={};return n.on=function(e,n,r){t[e]=t[e]||[],t[e]=t[e].concat({handler:n,context:r})},n.off=function(e,n,r){if(t[e])for(var i=0;i<t[e].length;i++)t[e][i].handler===n&&t[e][i].context===r&&(t[e]=t[e].slice(0,i).concat(t[e].slice(i+1)))},n.emit=function(e){if(t[e])for(var n=t[e].slice(0),r=0;r<n.length;r++)n[r].handler.apply(n[r].context,Array.prototype.slice.call(arguments,1))},n.getEvents=function(){return Object.keys(t)},n.getEventListenerCount=function(e){return t[e]?t[e].length:0},n.maybeReportError=function(n){n&&(t["error"]?this.emit("error",n):(e||console).error(n.message))},n}var nn=function(e){var n=!1,t=!1,r=null,i=null,o=new Promise((function(n){e.on("ready",(function t(){e.off("ready",t),n()}))})).catch((function(){}));return{getInitializationPromise:function(){return i||(n?Promise.resolve():t?Promise.reject(r):i=new Promise((function(n,t){e.on("initialized",(function t(){e.off("initialized",t),n()})),e.on("failed",(function n(r){e.off("failed",n),t(r)}))})))},getReadyPromise:function(){return o},signalSuccess:function(){n||t||(n=!0,e.emit("initialized"),e.emit("ready"))},signalFailure:function(i){n||t||(t=!0,r=i,e.emit("failed",i),e.emit("ready")),e.maybeReportError(i)}}};function tn(e,n,t,r){var i={};function o(){var e="",i=r.getUser();return i&&(e=t||C(JSON.stringify(i))),"ld:"+n+":"+e}return i.loadFlags=function(){return e.get(o()).then((function(e){if(null==e)return null;try{var n=JSON.parse(e);if(n){var t=n.$schema;void 0===t||t<1?n=N(n):delete n.$schema}return n}catch(e){return i.clearFlags().then((function(){return null}))}}))},i.saveFlags=function(n){var t=_({},n,{$schema:1});return e.set(o(),JSON.stringify(t))},i.clearFlags=function(){return e.clear(o())},i}function rn(e,n,t,r){var i,o=n.streamUrl,a=n.logger,u={},c=j(o,"/eval/"+t),s=n.useReport,l=n.evaluationReasons,f=n.streamReconnectDelay,d=We(e,n),v=!1,g=null,p=null,m=null,h=null,y=null;function b(e){v||(a.warn(Se(e,f)),v=!0),D(!1),w(),k(f)}function k(e){p||(e?p=setTimeout(E,e):E())}function E(){var r;p=null;var u="",f={headers:d,readTimeoutMillis:3e5};if(e.eventSourceFactory){for(var v in null!=h&&(u="h="+h),s?e.eventSourceAllowsReport?(r=c,f.method="REPORT",f.headers["Content-Type"]="application/json",f.body=JSON.stringify(m)):(r=j(o,"/ping/"+t),u=""):r=c+"/"+T(JSON.stringify(m)),f.headers=Xe(f.headers,n),l&&(u=u+(u?"&":"")+"withReasons=true"),r=r+(u?"?":"")+u,w(),a.info(Oe(r)),i=(new Date).getTime(),g=e.eventSourceFactory(r,f),y)z(y,v)&&g.addEventListener(v,y[v]);g.onerror=b}}function w(){g&&(a.info("Closing stream connection"),g.close(),g=null)}function D(e){i&&r&&r.recordStreamInit(i,!e,(new Date).getTime()-i),i=null}return u.connect=function(e,n,t){m=e,h=n,y={};var r=function(e){y[e]=function(n){v=!1,D(!0),t[e]&&t[e](n)}};for(var i in t||{})r(i);k()},u.disconnect=function(){clearTimeout(p),p=null,w()},u.isConnected=function(){return!!(g&&e.eventSourceIsActive&&e.eventSourceIsActive(g))},u}function on(e,n,t){var r=n.baseUrl,i=n.useReport,o=n.evaluationReasons,a=n.logger,u={},c={};function s(t,r){if(!e.httpRequest)return new Promise((function(e,n){n(new g(Ee()))}));var i=r?"REPORT":"GET",o=We(e,n);r&&(o["Content-Type"]="application/json");var a=c[t];a||(a=function(e){var n,t,r,i,o={addPromise:function(o,a){n=o,t&&t(),t=a,o.then((function(t){n===o&&(r(t),e&&e())}),(function(t){n===o&&(i(t),e&&e())}))}};return o.resultPromise=new Promise((function(e,n){r=e,i=n})),o}((function(){delete c[t]})),c[t]=a);var u=e.httpRequest(i,t,Xe(o,n),r),s=u.promise.then((function(e){if(200===e.status){if(e.header("content-type")&&"application/json"===e.header("content-type").substring(0,"application/json".length))return JSON.parse(e.body);var n=ue(e.header("content-type")||"");return Promise.reject(new g(n))}return Promise.reject(function(e){return 404===e.status?new l(fe()):new g(ve(e.statusText||String(e.status)))}(e))}),(function(e){return Promise.reject(new g(se(e)))}));return a.addPromise(s,(function(){u.cancel&&u.cancel()})),a.resultPromise}return u.fetchJSON=function(e){return s(j(r,e),null)},u.fetchFlagSettings=function(e,n){var u,c,l,f="";return i?(c=[r,"/sdk/evalx/",t,"/user"].join(""),l=JSON.stringify(e)):(u=T(JSON.stringify(e)),c=[r,"/sdk/evalx/",t,"/users/",u].join("")),n&&(f="h="+n),o&&(f=f+(f?"&":"")+"withReasons=true"),c=c+(f?"?":"")+f,a.debug(Ce(c)),s(c,l)},u}function an(e){var n={};return n.validateUser=function(n){if(!n)return Promise.reject(new f(ge()));var t=R(n);return null!==t.key&&void 0!==t.key?(t.key=t.key.toString(),Promise.resolve(t)):t.anonymous?e.get("ld:$anonUserId").then((function(n){if(n)return t.key=n,t;var r=Y();return t.key=r,function(n){return e.set("ld:$anonUserId",n)}(r).then((function(){return t}))})):Promise.reject(new f(pe()))},n}var un=Object.freeze({__proto__:null,baseOptionDefs:Ke,validate:He,getTags:Ge}).baseOptionDefs,cn=J.appendUrlPath;var sn=function(e){var n={diagnosticId:Y()};return e&&(n.sdkKeySuffix=e.length>6?e.substring(e.length-6):e),n},ln=function(e){var n,t,r,i;function o(e){n=e,t=0,r=0,i=[]}return o(e),{getProps:function(){return{dataSinceDate:n,droppedEvents:t,eventsInLastBatch:r,streamInits:i}},setProps:function(e){n=e.dataSinceDate,t=e.droppedEvents||0,r=e.eventsInLastBatch||0,i=e.streamInits||[]},incrementDroppedEvents:function(){t++},setEventsInLastBatch:function(e){r=e},recordStreamInit:function(e,n,t){var r={timestamp:e,failed:n,durationMillis:t};i.push(r)},reset:o}},fn=function(e,t,r,i,o,a,u){var c,s,l=!!e.diagnosticUseCombinedEvent,f="ld:"+o+":$diagnostics",d=cn(a.eventsUrl,"/events/diagnostic/"+o),v=a.diagnosticRecordingInterval,g=r,p=!!a.streaming,m={};function h(){return{sdk:k(),configuration:(n={customBaseURI:a.baseUrl!==un.baseUrl.default,customStreamURI:a.streamUrl!==un.streamUrl.default,customEventsURI:a.eventsUrl!==un.eventsUrl.default,eventsCapacity:a.eventCapacity,eventsFlushIntervalMillis:a.flushInterval,reconnectTimeMillis:a.streamReconnectDelay,streamingDisabled:!p,allAttributesPrivate:!!a.allAttributesPrivate,inlineUsersInEvents:!!a.inlineUsersInEvents,diagnosticRecordingIntervalMillis:a.diagnosticRecordingInterval,usingSecureMode:!!a.hash,bootstrapMode:!!a.bootstrap,fetchGoalsDisabled:!a.fetchGoals,sendEventsOnlyForVariation:!!a.sendEventsOnlyForVariation,autoAliasingOptOut:!!a.autoAliasingOptOut},n),platform:e.diagnosticPlatformData};var n}function y(e){a.logger&&a.logger.debug(Je.debugPostingDiagnosticEvent(e)),i.sendEvents(e,d,!0).then((function(){})).catch((function(){}))}function b(){var e,r;y((e=(new Date).getTime(),r=n({kind:l?"diagnostic-combined":"diagnostic",id:u,creationDate:e},g.getProps()),l&&(r=n(n({},r),h())),g.reset(e),r)),s=setTimeout(b,v),c=(new Date).getTime(),l&&function(){if(t.isEnabled()){var e=n({},g.getProps());t.set(f,JSON.stringify(e))}}()}function k(){var t=n({},e.diagnosticSdkData);return a.wrapperName&&(t.wrapperName=a.wrapperName),a.wrapperVersion&&(t.wrapperVersion=a.wrapperVersion),t}return m.start=function(){l?function(e){if(!t.isEnabled())return e(!1);t.get(f).then((function(n){if(n)try{var t=JSON.parse(n);g.setProps(t),c=t.dataSinceDate}catch(e){}e(!0)})).catch((function(){e(!1)}))}((function(e){if(e){var n=(c||0)+v,t=(new Date).getTime();t>=n?b():s=setTimeout(b,n-t)}else 0===Math.floor(4*Math.random())?b():s=setTimeout(b,v)})):(y(n({kind:"diagnostic-init",id:u,creationDate:g.getProps().dataSinceDate},h())),s=setTimeout(b,v))},m.stop=function(){s&&clearTimeout(s)},m.setStreaming=function(e){p=e},m};var dn={flagUsed:"flag-used",flagDetailsChanged:"flag-details-changed",flagDetailChanged:"flag-detail-changed",clientIdentityChanged:"client-identity-changed"};function vn(e,n){var t,i={},o=(r(t={},dn.flagUsed,[]),r(t,dn.flagDetailsChanged,[]),r(t,dn.flagDetailChanged,[]),r(t,dn.clientIdentityChanged,[]),t);return(null==e?void 0:e.map((function(e){return function(e,n){var t=!1,r={type:e.type,name:e.name,method:function(){try{e.method.apply(e,arguments)}catch(e){t||(t=!0,n.warn(ze(r.type,r.name)))}}};return r}(e,n)}))).forEach((function(e){Object.prototype.hasOwnProperty.call(o,e.type)?o[e.type].push(e):n.warn(_e(e.type,e.name))})),i.hasListeners=function(e){var n;return null===(n=o[e])||void 0===n?void 0:n.length},i.onFlagUsed=function(e,n,t){o[dn.flagUsed].length&&A((function(){o[dn.flagUsed].forEach((function(r){return r.method(e,n,t)}))}))},i.onFlags=function(e){o[dn.flagDetailsChanged].length&&A((function(){o[dn.flagDetailsChanged].forEach((function(n){return n.method(e)}))}))},i.onFlagChanged=function(e,n){o[dn.flagDetailChanged].length&&A((function(){console.log("what?"),o[dn.flagDetailChanged].forEach((function(t){return t.method(e,n)}))}))},i.onIdentityChanged=function(e){o[dn.clientIdentityChanged].length&&A((function(){o[dn.clientIdentityChanged].forEach((function(n){return n.method(e)}))}))},i}Object.freeze(dn);function gn(e,r,o,a,u){var c,f,v,h=function(){if(o&&o.logger)return o.logger;return u&&u.logger&&u.logger.default||ne("warn")}(),y=en(h),b=nn(y),k=He(o,y,u,h),E=vn(k.inspectors,h),w=k.sendEvents,D=e,O=k.hash,S=function(e,n){var t={},r=!1,i=function(e){r||(r=!0,n.warn(ce(e)))};return t.isEnabled=function(){return!!e},t.get=function(n){return new Promise((function(t){e?e.get(n).then(t).catch((function(e){i(e),t(void 0)})):t(void 0)}))},t.set=function(n,t){return new Promise((function(r){e?e.set(n,t).then((function(){return r(!0)})).catch((function(e){i(e),r(!1)})):r(!1)}))},t.clear=function(n){return new Promise((function(t){e?e.clear(n).then((function(){return t(!0)})).catch((function(e){i(e),t(!1)})):t(!1)}))},t}(a.localStorage,h),P=Qe(a,D,k),U=k.sendEvents&&!k.diagnosticOptOut,I=U?sn(D):null,C=U?ln((new Date).getTime()):null,T=U?fn(a,S,C,P,D,k,I):null,N=rn(a,k,D,C),V=k.eventProcessor||function(e,n,t){var r,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u={},c=a||Qe(e,t,n),l=j(n.eventsUrl,"/events/bulk/"+t),f=Ye(),d=Ze(n),v=n.inlineUsersInEvents,g=n.samplingInterval,p=n.eventCapacity,h=n.flushInterval,y=n.logger,b=[],k=0,E=!1,w=!1;function D(){return 0===g||0===Math.floor(Math.random()*g)}function O(e){return!!e.debugEventsUntilDate&&(e.debugEventsUntilDate>k&&e.debugEventsUntilDate>(new Date).getTime())}function S(e){var n=_({},e);return"alias"===e.kind||(v||"identify"===e.kind?n.user=d.filterUser(e.user):(n.userKey=e.user.key,delete n.user),"feature"===e.kind&&(delete n.trackEvents,delete n.debugEventsUntilDate)),n}function P(e){b.length<p?(b.push(e),w=!1):(w||(w=!0,y.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),i&&i.incrementDroppedEvents())}return u.enqueue=function(e){if(!E){var n=!1,t=!1;if(f.summarizeEvent(e),"feature"===e.kind?D()&&(n=!!e.trackEvents,t=O(e)):n=D(),n&&P(S(e)),t){var r=_({},e,{kind:"debug"});r.user=d.filterUser(r.user),delete r.trackEvents,delete r.debugEventsUntilDate,P(r)}}},u.flush=function(){if(E)return Promise.resolve();var e=b,n=f.getSummary();return f.clearSummary(),n&&(n.kind="summary",e.push(n)),i&&i.setEventsInLastBatch(e.length),0===e.length?Promise.resolve():(b=[],y.debug(Ve(e.length)),c.sendEvents(e,l).then((function(e){e&&(e.serverTime&&(k=e.serverTime),m(e.status)||(E=!0),e.status>=400&&A((function(){o.maybeReportError(new s(ke(e.status,"event posting","some events were dropped")))})))})))},u.start=function(){r=setTimeout((function e(){u.flush(),r=setTimeout(e,h)}),h)},u.stop=function(){clearTimeout(r)},u}(a,k,D,C,y,P),q=on(a,k,D),J={},K=k.streaming,$=!1,B=!1,H=!0,G=k.stateProvider,W=function(e,n){var t,r={};return r.setUser=function(e){var r=t&&R(t);(t=M(e))&&n&&n(R(t),r)},r.getUser=function(){return t?R(t):null},e&&r.setUser(e),r}(null,(function(e,n){(function(e){if(G)return;e&&Y({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})})(e),!k.autoAliasingOptOut&&n&&n.anonymous&&e&&!e.anonymous&&ue(e,n);Z()})),X=an(S),Q=S.isEnabled()?new tn(S,D,O,W,h):null;function Y(e){if(D&&!(G&&G.enqueueEvent&&G.enqueueEvent(e))){if("alias"!==e.kind){if(!e.user)return void(H&&(h.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"),H=!1));H=!1}!w||B||a.isDoNotTrack()||(h.debug(xe(e.kind)),V.enqueue(e))}}function Z(){E.hasListeners(dn.clientIdentityChanged)&&E.onIdentityChanged(W.getUser())}function ee(e,n){E.hasListeners(dn.flagDetailChanged)&&E.onFlagChanged(e.key,oe(n))}function te(){E.hasListeners(dn.flagDetailsChanged)&&E.onFlags(Object.entries(J).map((function(e){var n=i(e,2);return{key:n[0],detail:oe(n[1])}})).reduce((function(e,n){return e[n.key]=n.detail,e}),{}))}function re(e,n,t,r){var i=W.getUser(),o=new Date,a={kind:"feature",key:e,user:i,value:n?n.value:null,variation:n?n.variationIndex:null,default:t,creationDate:o.getTime()};i&&i.anonymous&&(a.contextKind=ae(i));var u=J[e];u&&(a.version=u.flagVersion?u.flagVersion:u.version,a.trackEvents=u.trackEvents,a.debugEventsUntilDate=u.debugEventsUntilDate),(r||u&&u.trackReason)&&n&&(a.reason=n.reason),Y(a)}function ie(e,n,t,r,i){var o;if(J&&z(J,e)&&J[e]&&!J[e].deleted){var a=J[e];o=oe(a),null!==a.value&&void 0!==a.value||(o.value=n)}else o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&re(e,o,n,r),i||Z(),o}function oe(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function ae(e){return e.anonymous?"anonymousUser":"user"}function ue(e,n){G||e&&n&&Y({kind:"alias",key:e.key,contextKind:ae(e),previousKey:n.key,previousContextKind:ae(n),creationDate:(new Date).getTime()})}function se(){if(f=!0,W.getUser()){var e=function(e){try{return JSON.parse(e)}catch(e){return void y.maybeReportError(new p("Invalid data received from LaunchDarkly; connection may have been interrupted"))}};N.connect(W.getUser(),O,{ping:function(){h.debug("received ping message from stream");var e=W.getUser();q.fetchFlagSettings(e,O).then((function(n){L(e,W.getUser())&&ge(n||{})})).catch((function(e){y.maybeReportError(new g(ve(e)))}))},put:function(n){var t=e(n.data);t&&(h.debug("received streaming update for all flags"),ge(t))},patch:function(n){var t=e(n.data);if(t){var r=J[t.key];if(!r||!r.version||!t.version||r.version<t.version){h.debug(Le(t.key));var i={},o=_({},t);delete o.key,J[t.key]=o;var a=oe(o);i[t.key]=r?{previous:r.value,current:a}:{current:a},pe(i),ee(t,o)}else h.debug(Ae(t.key))}},delete:function(n){var t=e(n.data);if(t)if(!J[t.key]||J[t.key].version<t.version){h.debug(Fe(t.key));var r={};J[t.key]&&!J[t.key].deleted&&(r[t.key]={previous:J[t.key].value}),J[t.key]={version:t.version,deleted:!0},ee(t,J[t.key]),pe(r)}else h.debug(Ne(t.key))}})}}function fe(){f&&(N.disconnect(),f=!1)}function ge(e){var t={};if(!e)return Promise.resolve();for(var r in J)z(J,r)&&J[r]&&(e[r]&&!L(e[r].value,J[r].value)?t[r]={previous:J[r].value,current:oe(e[r])}:e[r]&&!e[r].deleted||(t[r]={previous:J[r].value}));for(var i in e)z(e,i)&&e[i]&&(!J[i]||J[i].deleted)&&(t[i]={current:oe(e[i])});return J=n({},e),te(),pe(t).catch((function(){}))}function pe(e){var n=Object.keys(e);if(n.length>0){var t={};n.forEach((function(n){var r=e[n].current,i=r?r.value:void 0,o=e[n].previous;y.emit("change:"+n,i,o),t[n]=r?{current:i,previous:o}:{previous:o}})),y.emit("change",t),y.emit("internal-change",J),k.sendEventsOnlyForVariation||G||n.forEach((function(n){re(n,e[n].current)}))}return c&&Q?Q.saveFlags(J):Promise.resolve()}function me(){var e=K||v&&void 0===K;e&&!f?se():!e&&f&&fe(),T&&T.setStreaming(e)}function ye(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}if("string"==typeof k.bootstrap&&"LOCALSTORAGE"===k.bootstrap.toUpperCase()&&(Q?c=!0:h.warn(ce())),"object"===t(k.bootstrap)&&(J=function(e){var n=Object.keys(e),t=e.$flagsState;!t&&n.length&&h.warn(he()),!1===e.$valid&&h.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var r={};return n.forEach((function(n){if("$flagsState"!==n&&"$valid"!==n){var i={value:e[n]};t&&t[n]?i=_(i,t[n]):i.version=0,r[n]=i}})),r}(k.bootstrap)),G){var be=G.getInitialState();be?Ee(be):G.on("init",Ee),G.on("update",(function(e){e.user&&W.setUser(e.user);e.flags&&ge(e.flags)}))}else(function(){if(!e)return Promise.reject(new l(de()));return X.validateUser(r).then((function(e){return W.setUser(e),"object"===t(k.bootstrap)?we():c?Q.loadFlags().then((function(e){return null==e?(J={},q.fetchFlagSettings(W.getUser(),O).then((function(e){return ge(e||{})})).then(we).catch((function(e){De(new g(ve(e)))}))):(J=e,A(we),q.fetchFlagSettings(W.getUser(),O).then((function(e){return ge(e)})).catch((function(e){return y.maybeReportError(e)})))})):q.fetchFlagSettings(W.getUser(),O).then((function(e){J=e||{},te(),we()})).catch((function(e){J={},De(e)}))}))})().catch(De);function Ee(e){D=e.environment,W.setUser(e.user),J=n({},e.flags),A(we)}function we(){h.info("LaunchDarkly client initialized"),$=!0,me(),b.signalSuccess()}function De(e){b.signalFailure(e)}return{client:{waitForInitialization:function(){return b.getInitializationPromise()},waitUntilReady:function(){return b.getReadyPromise()},identify:function(e,n,t){return B?F(Promise.resolve({}),t):G?(h.warn("identify() has no effect here; it must be called on the main client instance"),F(Promise.resolve(x(J)),t)):F((c&&Q?Q.clearFlags():Promise.resolve()).then((function(){return X.validateUser(e)})).then((function(e){return q.fetchFlagSettings(e,n).then((function(t){var r=x(t);return W.setUser(e),O=n,t?ge(t).then((function(){return r})):r}))})).then((function(e){return f&&se(),e})).catch((function(e){return y.maybeReportError(e),Promise.reject(e)})),t)},getUser:function(){return W.getUser()},variation:function(e,n){return ie(e,n,!0,!1,!1).value},variationDetail:function(e,n){return ie(e,n,!0,!0,!1)},track:function(e,n,t){if("string"==typeof e){a.customEventFilter&&!a.customEventFilter(e)&&h.warn(le(e));var r=W.getUser(),i={kind:"custom",key:e,user:r,url:a.getCurrentUrl(),creationDate:(new Date).getTime()};r&&r.anonymous&&(i.contextKind=ae(r)),null!=n&&(i.data=n),null!=t&&(i.metricValue=t),Y(i)}else y.maybeReportError(new d(le(e)))},alias:ue,on:function(e,n,t){ye(e)?(v=!0,$&&me(),y.on(e,n,t)):y.on.apply(y,arguments)},off:function(e){if(y.off.apply(y,arguments),ye(e)){var n=!1;y.getEvents().forEach((function(e){ye(e)&&y.getEventListenerCount(e)>0&&(n=!0)})),n||(v=!1,f&&void 0===K&&fe())}},setStreaming:function(e){var n=null===e?void 0:e;n!==K&&(K=n,me())},flush:function(e){return F(w?V.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!J)return e;for(var n in J)z(J,n)&&!J[n].deleted&&(e[n]=ie(n,null,!k.sendEventsOnlyForVariation,!1,!0).value);return e},close:function(e){if(B)return F(Promise.resolve(),e);var n=function(){B=!0,J={}};return F(Promise.resolve().then((function(){if(fe(),T&&T.stop(),w)return V.stop(),V.flush()})).then(n).catch(n),e)}},options:k,emitter:y,ident:W,logger:h,requestor:q,start:function(){w&&(T&&T.start(),V.start())},enqueueEvent:Y,getFlagsInternal:function(){return J},getEnvironmentId:function(){return D},internalChangeEventName:"internal-change"}}var pn="3.8.0";export{ee as commonBasicLogger,ne as createConsoleLogger,h as errors,gn as initialize,Je as messages,J as utils,pn as version};
//# sourceMappingURL=ldclient-common.es.js.map

@@ -1,2 +0,2 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self)["LDClient-Common"]={})}(this,function(e){"use strict";function h(n,e){var t,r=Object.keys(n);return Object.getOwnPropertySymbols&&(t=Object.getOwnPropertySymbols(n),e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),r.push.apply(r,t)),r}function ee(r){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?h(Object(i),!0).forEach(function(e){var n,t;n=r,t=i[e=e],e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):h(Object(i)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))})}return r}function ne(e){return(ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function b(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){var t;if(e)return"string"==typeof e?r(e,n):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?r(e,n):void 0}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function n(e){function n(e,n){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=n}return(n.prototype=new Error).name=e,n.prototype.constructor=n}var L=n("LaunchDarklyUnexpectedResponseError"),te=n("LaunchDarklyInvalidEnvironmentIdError"),i=n("LaunchDarklyInvalidUserError"),pe=n("LaunchDarklyInvalidEventKeyError"),k=n("LaunchDarklyInvalidArgumentError"),re=n("LaunchDarklyFlagFetchError"),me=n("LaunchDarklyInvalidDataError");function A(e){return!(400<=e&&e<500)||(400===e||408===e||429===e)}for(var E=Object.freeze({__proto__:null,LDUnexpectedResponseError:L,LDInvalidEnvironmentIdError:te,LDInvalidUserError:i,LDInvalidEventKeyError:pe,LDInvalidArgumentError:k,LDFlagFetchError:re,LDInvalidDataError:me,isHttpErrorRecoverable:A}),w=function(e){for(var n,t=e.length,r=t%3,i=[],o=0,a=t-r;o<a;o+=16383)i.push(function(e,n,t){for(var r,i=[],o=n;o<t;o+=3)r=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(function(e){return u[e>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}(r));return i.join("")}(e,o,a<o+16383?a:o+16383));1==r?(n=e[t-1],i.push(u[n>>2]+u[n<<4&63]+"==")):2==r&&(n=(e[t-2]<<8)+e[t-1],i.push(u[n>>10]+u[n>>4&63]+u[n<<2&63]+"="));return i.join("")},u=[],t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,D=t.length;o<D;++o)u[o]=t[o],t.charCodeAt(o),o;"-".charCodeAt(0),"_".charCodeAt(0);function s(e,n){if(e===n)return!0;if(e&&n&&"object"==typeof e&&"object"==typeof n){var t,r,i=P(e),o=P(n);if(i&&o){if((a=e.length)!=n.length)return!1;for(t=a;0!=t--;)if(!s(e[t],n[t]))return!1}else{if(i!=o)return!1;i=e instanceof Date,o=n instanceof Date;if(i!=o)return!1;if(i&&o)return e.getTime()==n.getTime();i=e instanceof RegExp,o=n instanceof RegExp;if(i!=o)return!1;if(i&&o)return e.toString()==n.toString();var a,u=S(e);if((a=u.length)!==S(n).length)return!1;for(t=a;0!=t--;)if(!U.call(n,u[t]))return!1;for(t=a;0!=t--;)if(!s(e[r=u[t]],n[r]))return!1}return!0}return e!=e&&n!=n}var P=Array.isArray,S=Object.keys,U=Object.prototype.hasOwnProperty,I=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function C(e,n){return(e.endsWith("/")?e.substring(0,e.length-1):e)+(n.startsWith("/")?"":"/")+n}function c(e){e=unescape(encodeURIComponent(e));return w(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(e))}function O(e){return c(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ie(e){return JSON.parse(JSON.stringify(e))}function oe(e,n){return s(e,n)}function ae(e){setTimeout(e,0)}function ue(e,n){e=e.then(function(e){return n&&setTimeout(function(){n(null,e)},0),e},function(e){if(!n)return Promise.reject(e);setTimeout(function(){n(e,null)},0)});return n?void 0:e}function j(e){var n,t={};for(n in e)le(e,n)&&(t[n]={value:e[n],version:0});return t}function se(e){var n,t={};for(n in e)le(e,n)&&(t[n]=e[n].value);return t}function T(e,n){for(var t,r=n.slice(0),i=[],o=e;0<r.length;){for(t=[];0<o;){var a=r.shift();if(!a)break;(o-=O(JSON.stringify(a)).length)<0&&0<t.length?r.unshift(a):t.push(a)}o=e,i.push(t)}return i}function R(e){var n=e.version||"3.7.0";return e.userAgent+"/"+n}function ce(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.reduce(function(e,n){return ee(ee({},e),n)},{})}function le(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function ye(e){if(!e)return e;var n,t;for(t in I){var r=I[t],i=e[r];void 0!==i&&"string"!=typeof i&&((n=n||ee({},e))[r]=String(i))}return n||e}var N=Object.freeze({__proto__:null,appendUrlPath:C,btoa:c,base64URLEncode:O,clone:ie,deepEquals:oe,onNextTick:ae,wrapPromiseCallback:ue,transformValuesToVersionedValues:j,transformVersionedValuesToValues:se,chunkUserEventsForUrl:T,getLDUserAgentString:R,extend:ce,objectHasOwnProperty:le,sanitizeUser:ye});(function(e){var n,t,r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);r?(n=new Uint8Array(16),e.exports=function(){return r(n),n}):(t=new Array(16),e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),t[n]=e>>>((3&n)<<3)&255;return t})})(F={exports:{}});for(var F,x=F.exports,_=[],a=0;a<256;++a)_[a]=(a+256).toString(16).substr(1);var V,l,q=function(e,n){var n=n||0,t=_;return[t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[+n]]].join("")},f=0,d=0;var v=function(e,n,t){var r=n&&t||0,i=n||[],o=(e=e||{}).node||V,t=void 0!==e.clockseq?e.clockseq:l,a=(null!=o&&null!=t||(a=x(),null==o&&(o=V=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==t&&(t=l=16383&(a[6]<<8|a[7]))),void 0!==e.msecs?e.msecs:(new Date).getTime()),u=void 0!==e.nsecs?e.nsecs:d+1,s=a-f+(u-d)/1e4;if(s<0&&void 0===e.clockseq&&(t=t+1&16383),1e4<=(u=(s<0||f<a)&&void 0===e.nsecs?0:u))throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=a,l=t,s=(1e4*(268435455&(a+=122192928e5))+(d=u))%4294967296,i[r++]=s>>>24&255,i[r++]=s>>>16&255,i[r++]=s>>>8&255,i[r++]=255&s,e=a/4294967296*1e4&268435455,i[r++]=e>>>8&255,i[r++]=255&e,i[r++]=e>>>24&15|16,i[r++]=e>>>16&255,i[r++]=t>>>8|128,i[r++]=255&t;for(var c=0;c<6;++c)i[r+c]=o[c];return n||q(i)},g=["debug","info","warn","error","none"];function M(e,u){if(e&&e.destination&&"function"!=typeof e.destination)throw new Error("destination for basicLogger was set to a non-function");function n(n){return function(e){console&&console[n]&&console[n].call(console,e)}}var s=e&&e.destination?[e.destination,e.destination,e.destination,e.destination]:[n("log"),n("info"),n("warn"),n("error")],c=!(!e||!e.destination),l=e&&void 0!==e.prefix&&null!==e.prefix?e.prefix:"[LaunchDarkly] ",t=1;if(e&&e.level)for(var r=0;r<g.length;r++)g[r]===e.level&&(t=r);for(var i={},o=function(e){var o,a=g[e];"none"!==a&&(e<t?i[a]=function(){}:(o=e,i[a]=function(){var e=o,n=a,t=arguments;if(!(t.length<1)){var r=c?n+": "+l:l,i=1!==t.length&&u?((i=b(t))[0]=r+i[0],u.apply(void 0,b(i))):r+t[0];try{s[e](i)}catch(e){console&&console.log&&console.log("[LaunchDarkly] Configured logger's "+n+" method threw an exception: "+e)}}}))},a=0;a<g.length;a++)o(a);return i}function he(e,n){return M({level:e,prefix:n})}function p(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}function be(){return"LaunchDarkly client initialized"}function ke(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"}function fe(e){return'Custom event "'+e+'" does not exist'}function z(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+m}function Ee(){return"No environment/client-side ID was specified."+m}function de(e){return"Error fetching flag settings: "+p(e)}function we(){return"Invalid data received from LaunchDarkly; connection may have been interrupted"}function De(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+m}function Oe(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."}function J(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'}function Pe(){return"identify() has no effect here; it must be called on the main client instance"}function K(e){return'Ignoring unknown config option "'+e+'"'}function B(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"}function $(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"}function H(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t}function Se(){return"received ping message from stream"}function Ue(){return"received streaming update for all flags"}function Ie(e){return'received streaming update for flag "'+e+'"'}function je(e){return'received streaming update for flag "'+e+'" but ignored due to version check'}function Te(e){return'received streaming deletion for flag "'+e+'"'}function Re(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'}function Ae(e){return'enqueueing "'+e+'" event'}var m=" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initializing-the-client for instructions on SDK initialization.",G=function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},W=function(e){return'Expected application/json content type but got "'+e+'"'},ve=function(e){return"local storage is unavailable: "+p(e)},X=function(e){return"network error"+(e?" ("+e+")":"")},Q=function(){return"No user specified."+m},Y=function(){return"Invalid user specified."+m},Z=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(A(e)?t:"giving up permanently")},Ce=function(){return"Cannot make HTTP requests in this environment."+m},Le=function(){return"Closing stream connection"},Ne=function(e){return"Opening stream connection to "+e},Fe=function(e,n){return"Error on stream connection: "+p(e)+", will continue retrying every "+n+" milliseconds."},xe=function(e){return"polling for feature flags at "+e},_e=function(e){return"sending "+e+" events"},Ve=function(e){return'Config option "'.concat(e,'" must only contain letters, numbers, ., _ or -.')},qe=Object.freeze({__proto__:null,clientInitialized:be,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded:G,eventWithoutUser:ke,invalidContentType:W,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:ve,networkError:X,unknownCustomEventKey:fe,environmentNotFound:z,environmentNotSpecified:Ee,errorFetchingFlags:de,userNotSpecified:Q,invalidUser:Y,invalidData:we,bootstrapOldFormat:De,bootstrapInvalid:Oe,deprecated:J,httpErrorMessage:Z,httpUnavailable:Ce,identifyDisabled:Pe,streamClosing:Le,streamConnecting:Ne,streamError:Fe,unknownOption:K,wrongOptionType:B,wrongOptionTypeBoolean:$,optionBelowMinimum:H,debugPolling:xe,debugStreamPing:Se,debugStreamPut:Ue,debugStreamPatch:Ie,debugStreamPatchIgnored:je,debugStreamDelete:Te,debugStreamDeleteIgnored:Re,debugEnqueueingEvent:Ae,debugPostingEvents:_e,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"},invalidTagValue:Ve}),Me={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},requestHeaderTransform:{type:"function"},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},diagnosticRecordingInterval:{default:9e5,minimum:2e3},diagnosticOptOut:{default:!1},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"},autoAliasingOptOut:{default:!1},application:{validator:function(e,n,t,r){var i={};t.id&&(i.id=Je("".concat(e,".id"),0,t.id,r));t.version&&(i.version=Je("".concat(e,".version"),0,t.version,r));return i}}},ze=/^(\w|\.|-)+$/;function Je(e,n,t,r){if("string"==typeof t&&t.match(ze))return t;r.warn(Ve(e))}function Ke(e,n,t,a){var u=ce({logger:{default:a}},Me,t),r={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null,allowFrequentDuplicateEvents:void 0};function s(e){ae(function(){n&&n.maybeReportError(new k(e))})}var i,o,c,l,f,t=ce({},e||{});function d(e){return null===e?"any":void 0!==e?Array.isArray(e)?"array":"boolean"===(e=ne(e))||"string"===e||"number"===e||"function"===e?e:"object":void 0}return i=t,Object.keys(r).forEach(function(e){var n;void 0!==i[e]&&(n=r[e],a&&a.warn(J(e,n)),n&&(void 0===i[n]&&(i[n]=i[e]),delete i[e]))}),o=ce({},t),Object.keys(u).forEach(function(e){void 0!==o[e]&&null!==o[e]||(o[e]=u[e]&&u[e].default)}),l=ce({},c=t=o),Object.keys(c).forEach(function(e){var n,t,r,i,o=c[e];null!=o&&(void 0===(n=u[e])?s(K(e)):(t=n.type||d(n.default),(r=n.validator)?void 0!==(r=r(e,c,c[e],a))?l[e]=r:delete l[e]:"any"!==t&&(r=t.split("|"),i=d(o),r.indexOf(i)<0?"boolean"===t?(l[e]=!!o,s($(e,i))):(s(B(e,t,i)),l[e]=n.default):"number"===i&&void 0!==n.minimum&&o<n.minimum&&(s(H(e,o,n.minimum)),l[e]=n.minimum))))}),f=(t=l).logger,g.forEach(function(e){if("none"!==e&&(!f[e]||"function"!=typeof f[e]))throw new Error("Provided logger instance must support logger."+e+"(...) method")}),t}function Be(e){var n={};return e&&(e.application&&void 0!==e.application.id&&null!==e.application.id&&(n["application-id"]=[e.application.id]),e.application&&void 0!==e.application.version&&null!==e.application.id&&(n["application-version"]=[e.application.version])),n}function $e(e,n){var t;return n&&!n.sendLDHeaders?{}:(e={"X-LaunchDarkly-User-Agent":R(e)},n&&n.wrapperName&&(e["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t=Be(n),(n=Object.keys(t)).length&&(e["x-launchdarkly-tags"]=n.sort().flatMap(function(n){return Array.isArray(t[n])?t[n].sort().map(function(e){return"".concat(n,"/").concat(e)}):["".concat(n,"/").concat(t[n])]}).join(" ")),e)}function He(e,n){return n&&n.requestHeaderTransform?n.requestHeaderTransform(ee({},e)):e}var Ge=2e3;function We(u,e,s){var c="/a/"+e+".gif",l=ce({"Content-Type":"application/json"},$e(u,s)),f=u.httpFallbackPing,d={};return d.sendChunk=function(e,n,r,t){var i=JSON.stringify(e),o=r?null:v();function a(t){var e=r?l:ce({},l,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":o});return u.httpRequest("POST",n,He(e,s),i).promise.then(function(e){var n;if(e)return 400<=e.status&&A(e.status)&&t?a(!1):(n={status:(e=e).status},(e=e.header("date"))&&(e=Date.parse(e))&&(n.serverTime=e),n)}).catch(function(){return t?a(!1):Promise.reject()})}return t?a(!0).catch(function(){}):(f&&f(n+c+"?d="+O(i)),Promise.resolve())},d.sendEvents=function(e,n,t){if(!u.httpRequest)return Promise.resolve();for(var r=u.httpAllowsPost(),i=r?[e]:T(Ge-n.length,e),o=[],a=0;a<i.length;a++)o.push(d.sendChunk(i[a],n,t,r));return Promise.all(o)},d}function Xe(e,n,t,r,i,o){var a,u,s,c,l,f,d,v,g=3<arguments.length&&void 0!==r?r:null,p=4<arguments.length&&void 0!==i?i:null,m={},y=(5<arguments.length&&void 0!==o?o:null)||We(e,t,n),h=C(n.eventsUrl,"/events/bulk/"+t),b=(u=a=0,s={},(r={}).summarizeEvent=function(e){var n,t;"feature"===e.kind&&(n=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),(t=s[n])?t.count=t.count+1:s[n]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===a||e.creationDate<a)&&(a=e.creationDate),e.creationDate>u&&(u=e.creationDate))},r.getSummary=function(){var e,n={},t=!0;for(e in s){var r=s[e],i=n[r.key],o=(i||(i={default:r.default,counters:[]},n[r.key]=i),{value:r.value,count:r.count});void 0!==r.variation&&null!==r.variation&&(o.variation=r.variation),r.version?o.version=r.version:o.unknown=!0,i.counters.push(o),t=!1}return t?null:{startDate:a,endDate:u,features:n}},r.clearSummary=function(){u=a=0,s={}},r),k=(i={},c=(o=n).allAttributesPrivate,l=o.privateAttributeNames||[],f={key:!0,custom:!0,anonymous:!0},d={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0},i.filterUser=function(e){var n,i,t,r,o;return e?(n=e.privateAttributeNames||[],i=function(e){return!f[e]&&(c||-1!==n.indexOf(e)||-1!==l.indexOf(e))},t=(r=(o=function(t,r){return Object.keys(t).reduce(function(e,n){return r(n)&&(i(n)?e[1][n]=!0:e[0][n]=t[n]),e},[{},{}])})(e,function(e){return d[e]}))[0],r=r[1],e.custom&&(o=o(e.custom,function(){return 1}),t.custom=o[0],r=ce({},r,o[1])),(e=Object.keys(r)).length&&(e.sort(),t.privateAttrs=e),t):null},i),E=n.inlineUsersInEvents,w=n.samplingInterval,D=n.eventCapacity,O=n.flushInterval,P=n.logger,S=[],U=0,I=!1,j=!1;function T(){return 0===w||0===Math.floor(Math.random()*w)}function R(e){S.length<D?(S.push(e),j=!1):(j||(j=!0,P.warn(G())),g&&g.incrementDroppedEvents())}return m.enqueue=function(e){var n,t,r;I||(n=r=!1,b.summarizeEvent(e),"feature"===e.kind?T()&&(r=!!e.trackEvents,n=!!(t=e).debugEventsUntilDate&&(t.debugEventsUntilDate>U&&t.debugEventsUntilDate>(new Date).getTime())):r=T(),r&&R((r=ce({},t=e),"alias"!==t.kind&&(E||"identify"===t.kind?r.user=k.filterUser(t.user):(r.userKey=t.user.key,delete r.user),"feature"===t.kind&&(delete r.trackEvents,delete r.debugEventsUntilDate)),r)),n&&((r=ce({},e,{kind:"debug"})).user=k.filterUser(r.user),delete r.trackEvents,delete r.debugEventsUntilDate,R(r)))},m.flush=function(){var e,n;return I||(e=S,n=b.getSummary(),b.clearSummary(),n&&(n.kind="summary",e.push(n)),g&&g.setEventsInLastBatch(e.length),0===e.length)?Promise.resolve():(S=[],P.debug(_e(e.length)),y.sendEvents(e,h).then(function(e){e&&(e.serverTime&&(U=e.serverTime),A(e.status)||(I=!0),400<=e.status&&ae(function(){p.maybeReportError(new L(Z(e.status,"event posting","some events were dropped")))}))}))},m.start=function(){v=setTimeout(function e(){m.flush(),v=setTimeout(e,O)},O)},m.stop=function(){clearTimeout(v)},m}function Qe(n){var e={},i={};return e.on=function(e,n,t){i[e]=i[e]||[],i[e]=i[e].concat({handler:n,context:t})},e.off=function(e,n,t){if(i[e])for(var r=0;r<i[e].length;r++)i[e][r].handler===n&&i[e][r].context===t&&(i[e]=i[e].slice(0,r).concat(i[e].slice(r+1)))},e.emit=function(e){if(i[e])for(var n=i[e].slice(0),t=0;t<n.length;t++)n[t].handler.apply(n[t].context,Array.prototype.slice.call(arguments,1))},e.getEvents=function(){return Object.keys(i)},e.getEventListenerCount=function(e){return i[e]?i[e].length:0},e.maybeReportError=function(e){e&&(i["error"]?this.emit("error",e):(n||console).error(e.message))},e}var y="ready",Ye="initialized",Ze="failed";var en=function(i){var n=!1,t=!1,r=null,e=null,o=new Promise(function(n){i.on(y,function e(){i.off(y,e),n()})}).catch(function(){});return{getInitializationPromise:function(){if(!e){if(n)return Promise.resolve();if(t)return Promise.reject(r);e=new Promise(function(n,t){function r(e){i.off(Ze,r),t(e)}i.on(Ye,function e(){i.off(Ye,e),n()}),i.on(Ze,r)})}return e},getReadyPromise:function(){return o},signalSuccess:function(){n||t||(n=!0,i.emit(Ye),i.emit(y))},signalFailure:function(e){n||t||(t=!0,r=e,i.emit(Ze,e),i.emit(y)),i.maybeReportError(e)}}};function nn(n,t,r,i){var o={};function a(){var e="",n=i.getUser();return n&&(e=r||c(JSON.stringify(n))),"ld:"+t+":"+e}return o.loadFlags=function(){return n.get(a()).then(function(e){if(null==e)return null;try{var n,t=JSON.parse(e);return t&&(void 0===(n=t.$schema)||n<1?t=j(t):delete t.$schema),t}catch(e){return o.clearFlags().then(function(){return null})}})},o.saveFlags=function(e){e=ce({},e,{$schema:1});return n.set(a(),JSON.stringify(e))},o.clearFlags=function(){return n.clear(a())},o}function tn(r,n){function i(e){t||(t=!0,n.warn(ve(e)))}var e={},t=!1;return e.isEnabled=function(){return!!r},e.get=function(e){return new Promise(function(n){r?r.get(e).then(n).catch(function(e){i(e),n(void 0)}):n(void 0)})},e.set=function(e,t){return new Promise(function(n){r?r.set(e,t).then(function(){return n(!0)}).catch(function(e){i(e),n(!1)}):n(!1)})},e.clear=function(e){return new Promise(function(n){r?r.clear(e).then(function(){return n(!0)}).catch(function(e){i(e),n(!1)}):n(!1)})},e}var rn=3e5;function on(i,o,a,n){var u,s=o.streamUrl,c=o.logger,e={},l=C(s,"/eval/"+a),f=o.useReport,d=o.evaluationReasons,t=o.streamReconnectDelay,v=$e(i,o),g=!1,p=null,m=null,y=null,h=null,b=null;function k(e){g||(c.warn(Fe(e,t)),g=!0),D(!1),w(),E(t)}function E(e){m||(e?m=setTimeout(r,e):r())}function r(){m=null;var e,n="",t={headers:v,readTimeoutMillis:rn};if(i.eventSourceFactory){for(var r in null!=h&&(n="h="+h),f?i.eventSourceAllowsReport?(e=l,t.method="REPORT",t.headers["Content-Type"]="application/json",t.body=JSON.stringify(y)):(e=C(s,"/ping/"+a),n=""):e=l+"/"+O(JSON.stringify(y)),t.headers=He(t.headers,o),e=e+((n=d?n+(n?"&":"")+"withReasons=true":n)?"?":"")+n,w(),c.info(Ne(e)),u=(new Date).getTime(),p=i.eventSourceFactory(e,t),b)le(b,r)&&p.addEventListener(r,b[r]);p.onerror=k}}function w(){p&&(c.info(Le()),p.close(),p=null)}function D(e){u&&n&&n.recordStreamInit(u,!e,(new Date).getTime()-u),u=null}return e.connect=function(e,n,t){y=e,h=n,b={};for(var r in t||{})!function(n){b[n]=function(e){D(!(g=!1)),t[n]&&t[n](e)}}(r);E()},e.disconnect=function(){clearTimeout(m),m=null,w()},e.isConnected=function(){return!!(p&&i.eventSourceIsActive&&i.eventSourceIsActive(p))},e}var an="application/json";function un(d,v,o){var a=v.baseUrl,u=v.useReport,s=v.evaluationReasons,c=v.logger,e={},g={};function l(e,n){var t,r,i,o,a,u,s,c,l,f;return d.httpRequest?(t=n?"REPORT":"GET",r=$e(d,v),n&&(r["Content-Type"]=an),(i=g[e])||(o=function(){delete g[e]},(f={addPromise:function(n,e){a=n,u&&u(),u=e,n.then(function(e){a===n&&(s(e),o&&o())},function(e){a===n&&(c(e),o&&o())})}}).resultPromise=new Promise(function(e,n){s=e,c=n}),i=f,g[e]=i),f=(l=d.httpRequest(t,e,He(r,v),n)).promise.then(function(e){var n;return 200===e.status?e.header("content-type")&&e.header("content-type").substring(0,an.length)===an?JSON.parse(e.body):(n=W(e.header("content-type")||""),Promise.reject(new re(n))):Promise.reject(404===(n=e).status?new te(z()):new re(de(n.statusText||String(n.status))))},function(e){return Promise.reject(new re(X(e)))}),i.addPromise(f,function(){l.cancel&&l.cancel()}),i.resultPromise):new Promise(function(e,n){n(new re(Ce()))})}return e.fetchJSON=function(e){return l(C(a,e),null)},e.fetchFlagSettings=function(e,n){var t,r,i="";return u?(t=[a,"/sdk/evalx/",o,"/user"].join(""),r=JSON.stringify(e)):(e=O(JSON.stringify(e)),t=[a,"/sdk/evalx/",o,"/users/",e].join("")),n&&(i="h="+n),c.debug(xe(t=t+((i=s?i+(i?"&":"")+"withReasons=true":i)?"?":"")+i)),l(t,r)},e}var sn="ld:$anonUserId";function cn(t){var e={};return e.validateUser=function(e){var n;return e?null!==(n=ie(e)).key&&void 0!==n.key?(n.key=n.key.toString(),Promise.resolve(n)):n.anonymous?t.get(sn).then(function(e){return e?(n.key=e,n):(e=v(),n.key=e,t.set(sn,e).then(function(){return n}))}):Promise.reject(new i(Y())):Promise.reject(new i(Q()))},e}var ln=Object.freeze({__proto__:null,baseOptionDefs:Me,validate:Ke,getTags:Be}).baseOptionDefs,fn=N.appendUrlPath;var dn=function(e){var n={diagnosticId:v()};return e&&(n.sdkKeySuffix=6<e.length?e.substring(e.length-6):e),n},vn=function(e){var n,t,r,i;function o(e){n=e,r=t=0,i=[]}return o(e),{getProps:function(){return{dataSinceDate:n,droppedEvents:t,eventsInLastBatch:r,streamInits:i}},setProps:function(e){n=e.dataSinceDate,t=e.droppedEvents||0,r=e.eventsInLastBatch||0,i=e.streamInits||[]},incrementDroppedEvents:function(){t++},setEventsInLastBatch:function(e){r=e},recordStreamInit:function(e,n,t){i.push({timestamp:e,failed:n,durationMillis:t})},reset:o}},gn=function(n,r,e,t,i,o,a){var u,s,c=!!n.diagnosticUseCombinedEvent,l="ld:"+i+":$diagnostics",f=fn(o.eventsUrl,"/events/diagnostic/"+i),d=o.diagnosticRecordingInterval,v=e,g=!!o.streaming;function p(){return{sdk:function(){var e=ee({},n.diagnosticSdkData);o.wrapperName&&(e.wrapperName=o.wrapperName);o.wrapperVersion&&(e.wrapperVersion=o.wrapperVersion);return e}(),configuration:{customBaseURI:o.baseUrl!==ln.baseUrl.default,customStreamURI:o.streamUrl!==ln.streamUrl.default,customEventsURI:o.eventsUrl!==ln.eventsUrl.default,eventsCapacity:o.eventCapacity,eventsFlushIntervalMillis:o.flushInterval,reconnectTimeMillis:o.streamReconnectDelay,streamingDisabled:!g,allAttributesPrivate:!!o.allAttributesPrivate,inlineUsersInEvents:!!o.inlineUsersInEvents,diagnosticRecordingIntervalMillis:o.diagnosticRecordingInterval,usingSecureMode:!!o.hash,bootstrapMode:!!o.bootstrap,fetchGoalsDisabled:!o.fetchGoals,sendEventsOnlyForVariation:!!o.sendEventsOnlyForVariation,autoAliasingOptOut:!!o.autoAliasingOptOut},platform:n.diagnosticPlatformData}}function m(e){o.logger&&o.logger.debug(qe.debugPostingDiagnosticEvent(e)),t.sendEvents(e,f,!0).then(function(){}).catch(function(){})}function y(){var e,n;m((n=(new Date).getTime(),e=ee({kind:c?"diagnostic-combined":"diagnostic",id:a,creationDate:n},v.getProps()),c&&(e=ee(ee({},e),p())),v.reset(n),e)),s=setTimeout(y,d),u=(new Date).getTime(),c&&r.isEnabled()&&(n=ee({},v.getProps()),r.set(l,JSON.stringify(n)))}return(i={}).start=function(){var t;c?(t=function(e){var n;e?(e=(u||0)+d)<=(n=(new Date).getTime())?y():s=setTimeout(y,e-n):0===Math.floor(4*Math.random())?y():s=setTimeout(y,d)},r.isEnabled()?r.get(l).then(function(e){if(e)try{var n=JSON.parse(e);v.setProps(n),u=n.dataSinceDate}catch(e){}t(!0)}).catch(function(){t(!1)}):t(!1)):(m(ee({kind:"diagnostic-init",id:a,creationDate:v.getProps().dataSinceDate},p())),s=setTimeout(y,d))},i.stop=function(){s&&clearTimeout(s)},i.setStreaming=function(e){g=e},i},ge="change",pn="internal-change";e.commonBasicLogger=M,e.createConsoleLogger=he,e.errors=E,e.initialize=function(F,x,e,i,n){var t,o,r,a,u,s,_,c,l,f=function(){if(e&&e.logger)return e.logger;return n&&n.logger&&n.logger.default||he("warn")}(),d=Qe(f),v=en(d),g=Ke(e,d,n,f),p=g.sendEvents,m=F,y=g.hash,h=tn(i.localStorage,f),b=We(i,m,g),k=g.sendEvents&&!g.diagnosticOptOut,V=k?dn(m):null,E=k?vn((new Date).getTime()):null,w=k?gn(i,h,E,b,m,g,V):null,q=on(i,g,m,E),D=g.eventProcessor||Xe(i,g,m,E,d,b),O=un(i,g,m),P={},S=g.streaming,M=!1,U=!1,z=!0,I=g.stateProvider,j=(a=function(e,n){(function(e){I||e&&R({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})})(e),!g.autoAliasingOptOut&&n&&n.anonymous&&e&&!e.anonymous&&$(e,n)},k={setUser:function(e){var n=u&&ie(u);(u=ye(e))&&a&&a(ie(u),n)},getUser:function(){return u?ie(u):null}},(V=null)&&k.setUser(V),k),J=cn(h),T=h.isEnabled()?new nn(h,m,y,j):null;function R(e){if(m&&!(I&&I.enqueueEvent&&I.enqueueEvent(e))){if("alias"!==e.kind){if(!e.user)return void(z&&(f.warn(ke()),z=!1));z=!1}!p||U||i.isDoNotTrack()||(f.debug(Ae(e.kind)),D.enqueue(e))}}function K(e,n,t,r){var i=j.getUser(),o=new Date,t={kind:"feature",key:e,user:i,value:n?n.value:null,variation:n?n.variationIndex:null,default:t,creationDate:o.getTime()},o=(i&&i.anonymous&&(t.contextKind=C(i)),P[e]);o&&(t.version=o.flagVersion||o.version,t.trackEvents=o.trackEvents,t.debugEventsUntilDate=o.debugEventsUntilDate),(r||o&&o.trackReason)&&n&&(t.reason=n.reason),R(t)}function B(e,n,t,r){var i,o;return P&&le(P,e)&&P[e]&&!P[e].deleted?(o=A(i=P[e]),null!==i.value&&void 0!==i.value||(o.value=n)):o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}},t&&K(e,o,n,r),o}function A(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function C(e){return e.anonymous?"anonymousUser":"user"}function $(e,n){I||e&&n&&R({kind:"alias",key:e.key,contextKind:C(e),previousKey:n.key,previousContextKind:C(n),creationDate:(new Date).getTime()})}function H(){var i;o=!0,j.getUser()&&(i=function(e){try{return JSON.parse(e)}catch(e){d.maybeReportError(new me(we()))}},q.connect(j.getUser(),y,{ping:function(){f.debug(Se());var n=j.getUser();O.fetchFlagSettings(n,y).then(function(e){oe(n,j.getUser())&&L(e||{})}).catch(function(e){d.maybeReportError(new re(de(e)))})},put:function(e){e=i(e.data);e&&(f.debug(Ue()),L(e))},patch:function(e){var n,t,r,e=i(e.data);e&&(!(n=P[e.key])||!n.version||!e.version||n.version<e.version?(f.debug(Ie(e.key)),t={},delete(r=ce({},e)).key,r=A(P[e.key]=r),t[e.key]=n?{previous:n.value,current:r}:{current:r},W(t)):f.debug(je(e.key)))},delete:function(e){var n,e=i(e.data);e&&(!P[e.key]||P[e.key].version<e.version?(f.debug(Te(e.key)),n={},P[e.key]&&!P[e.key].deleted&&(n[e.key]={previous:P[e.key].value}),P[e.key]={version:e.version,deleted:!0},W(n)):f.debug(Re(e.key)))}}))}function G(){o&&(q.disconnect(),o=!1)}function L(e){var n,t,r={};if(!e)return Promise.resolve();for(n in P)le(P,n)&&P[n]&&(e[n]&&!oe(e[n].value,P[n].value)?r[n]={previous:P[n].value,current:A(e[n])}:e[n]&&!e[n].deleted||(r[n]={previous:P[n].value}));for(t in e)le(e,t)&&e[t]&&(!P[t]||P[t].deleted)&&(r[t]={current:A(e[t])});return P=ee({},e),W(r).catch(function(){})}function W(i){var o,e=Object.keys(i);return 0<e.length&&(o={},e.forEach(function(e){var n=i[e].current,t=n?n.value:void 0,r=i[e].previous;d.emit(ge+":"+e,t,r),o[e]=n?{current:t,previous:r}:{previous:r}}),d.emit(ge,o),d.emit(pn,P),g.sendEventsOnlyForVariation||I||e.forEach(function(e){K(e,i[e].current)})),t&&T?T.saveFlags(P):Promise.resolve()}function X(){var e=S||r&&void 0===S;e&&!o?H():!e&&o&&G(),w&&w.setStreaming(e)}function Q(e){return e===ge||e.substr(0,ge.length+1)===ge+":"}function Y(e){m=e.environment,j.setUser(e.user),P=ee({},e.flags),ae(N)}function N(){f.info(be()),M=!0,X(),v.signalSuccess()}function Z(e){v.signalFailure(e)}return"string"==typeof g.bootstrap&&"LOCALSTORAGE"===g.bootstrap.toUpperCase()&&(T?t=!0:f.warn(ve())),"object"===ne(g.bootstrap)&&(s=g.bootstrap,E=Object.keys(s),!(c=s[_="$flagsState"])&&E.length&&f.warn(De()),!1===s.$valid&&f.warn(Oe()),l={},E.forEach(function(e){var n;e!==_&&"$valid"!==e&&(n={value:s[e]},c&&c[e]?n=ce(n,c[e]):n.version=0,l[e]=n)}),P=l),I?((b=I.getInitialState())?Y(b):I.on("init",Y),I.on("update",function(e){e.user&&j.setUser(e.user);e.flags&&L(e.flags)})):(F?J.validateUser(x).then(function(e){return j.setUser(e),"object"===ne(g.bootstrap)?N():t?T.loadFlags().then(function(e){return null==e?(P={},O.fetchFlagSettings(j.getUser(),y).then(function(e){return L(e||{})}).then(N).catch(function(e){Z(new re(de(e)))})):(P=e,ae(N),O.fetchFlagSettings(j.getUser(),y).then(L).catch(function(e){return d.maybeReportError(e)}))}):O.fetchFlagSettings(j.getUser(),y).then(function(e){P=e||{},N()}).catch(function(e){P={},Z(e)})}):Promise.reject(new te(Ee()))).catch(Z),{client:{waitForInitialization:function(){return v.getInitializationPromise()},waitUntilReady:function(){return v.getReadyPromise()},identify:function(e,r,n){return U?ue(Promise.resolve({}),n):I?(f.warn(Pe()),ue(Promise.resolve(se(P)),n)):ue((t&&T?T.clearFlags():Promise.resolve()).then(function(){return J.validateUser(e)}).then(function(t){return O.fetchFlagSettings(t,r).then(function(e){var n=se(e);return j.setUser(t),y=r,e?L(e).then(function(){return n}):n})}).then(function(e){return o&&H(),e}).catch(function(e){return d.maybeReportError(e),Promise.reject(e)}),n)},getUser:function(){return j.getUser()},variation:function(e,n){return B(e,n,!0,!1).value},variationDetail:function(e,n){return B(e,n,!0,!0)},track:function(e,n,t){var r;"string"!=typeof e?d.maybeReportError(new pe(fe(e))):(i.customEventFilter&&!i.customEventFilter(e)&&f.warn(fe(e)),r={kind:"custom",key:e,user:e=j.getUser(),url:i.getCurrentUrl(),creationDate:(new Date).getTime()},e&&e.anonymous&&(r.contextKind=C(e)),null!=n&&(r.data=n),null!=t&&(r.metricValue=t),R(r))},alias:$,on:function(e,n,t){Q(e)?(r=!0,M&&X(),d.on(e,n,t)):d.on.apply(d,arguments)},off:function(e){var n;d.off.apply(d,arguments),Q(e)&&(n=!1,d.getEvents().forEach(function(e){Q(e)&&0<d.getEventListenerCount(e)&&(n=!0)}),n||(r=!1,o&&void 0===S&&G()))},setStreaming:function(e){(e=null===e?void 0:e)!==S&&(S=e,X())},flush:function(e){return ue(p?D.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(P)for(var n in P)le(P,n)&&!P[n].deleted&&(e[n]=B(n,null,!g.sendEventsOnlyForVariation).value);return e},close:function(e){var n;return U?ue(Promise.resolve(),e):(n=function(){U=!0,P={}},ue(Promise.resolve().then(function(){if(G(),w&&w.stop(),p)return D.stop(),D.flush()}).then(n).catch(n),e))}},options:g,emitter:d,ident:j,logger:f,requestor:O,start:function(){p&&(w&&w.start(),D.start())},enqueueEvent:R,getFlagsInternal:function(){return P},getEnvironmentId:function(){return m},internalChangeEventName:pn}},e.messages=qe,e.utils=N,e.version="3.7.0",Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self)["LDClient-Common"]={})}(this,function(e){"use strict";function b(n,e){var t,r=Object.keys(n);return Object.getOwnPropertySymbols&&(t=Object.getOwnPropertySymbols(n),e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),r.push.apply(r,t)),r}function oe(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?b(Object(t),!0).forEach(function(e){r(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function ie(e){return(ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,n,t){n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t}function ye(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||E(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||E(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,n){var t;if(e)return"string"==typeof e?o(e,n):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,n):void 0}function o(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function n(e){function n(e,n){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=n}return(n.prototype=new Error).name=e,n.prototype.constructor=n}var L=n("LaunchDarklyUnexpectedResponseError"),ae=n("LaunchDarklyInvalidEnvironmentIdError"),i=n("LaunchDarklyInvalidUserError"),be=n("LaunchDarklyInvalidEventKeyError"),w=n("LaunchDarklyInvalidArgumentError"),ue=n("LaunchDarklyFlagFetchError"),ke=n("LaunchDarklyInvalidDataError");function R(e){return!(400<=e&&e<500)||(400===e||408===e||429===e)}for(var D=Object.freeze({__proto__:null,LDUnexpectedResponseError:L,LDInvalidEnvironmentIdError:ae,LDInvalidUserError:i,LDInvalidEventKeyError:be,LDInvalidArgumentError:w,LDFlagFetchError:ue,LDInvalidDataError:ke,isHttpErrorRecoverable:R}),S=function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(function(e,n,t){for(var r,o=[],i=n;i<t;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(function(e){return u[e>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}(r));return o.join("")}(e,i,a<i+16383?a:i+16383));1==r?(n=e[t-1],o.push(u[n>>2]+u[n<<4&63]+"==")):2==r&&(n=(e[t-2]<<8)+e[t-1],o.push(u[n>>10]+u[n>>4&63]+u[n<<2&63]+"="));return o.join("")},u=[],t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,P=t.length;a<P;++a)u[a]=t[a],t.charCodeAt(a),a;"-".charCodeAt(0),"_".charCodeAt(0);function s(e,n){if(e===n)return!0;if(e&&n&&"object"==typeof e&&"object"==typeof n){var t,r,o=U(e),i=U(n);if(o&&i){if((a=e.length)!=n.length)return!1;for(t=a;0!=t--;)if(!s(e[t],n[t]))return!1}else{if(o!=i)return!1;o=e instanceof Date,i=n instanceof Date;if(o!=i)return!1;if(o&&i)return e.getTime()==n.getTime();o=e instanceof RegExp,i=n instanceof RegExp;if(o!=i)return!1;if(o&&i)return e.toString()==n.toString();var a,u=I(e);if((a=u.length)!==I(n).length)return!1;for(t=a;0!=t--;)if(!j.call(n,u[t]))return!1;for(t=a;0!=t--;)if(!s(e[r=u[t]],n[r]))return!1}return!0}return e!=e&&n!=n}var U=Array.isArray,I=Object.keys,j=Object.prototype.hasOwnProperty,C=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function A(e,n){return(e.endsWith("/")?e.substring(0,e.length-1):e)+(n.startsWith("/")?"":"/")+n}function c(e){e=unescape(encodeURIComponent(e));return S(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(e))}function O(e){return c(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function se(e){return JSON.parse(JSON.stringify(e))}function ce(e,n){return s(e,n)}function le(e){setTimeout(e,0)}function fe(e,n){e=e.then(function(e){return n&&setTimeout(function(){n(null,e)},0),e},function(e){if(!n)return Promise.reject(e);setTimeout(function(){n(e,null)},0)});return n?void 0:e}function T(e){var n,t={};for(n in e)ge(e,n)&&(t[n]={value:e[n],version:0});return t}function de(e){var n,t={};for(n in e)ge(e,n)&&(t[n]=e[n].value);return t}function F(e,n){for(var t,r=n.slice(0),o=[],i=e;0<r.length;){for(t=[];0<i;){var a=r.shift();if(!a)break;(i-=O(JSON.stringify(a)).length)<0&&0<t.length?r.unshift(a):t.push(a)}i=e,o.push(t)}return o}function N(e){var n=e.version||"3.8.0";return e.userAgent+"/"+n}function ve(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.reduce(function(e,n){return oe(oe({},e),n)},{})}function ge(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function Ee(e){if(!e)return e;var n,t;for(t in C){var r=C[t],o=e[r];void 0!==o&&"string"!=typeof o&&((n=n||oe({},e))[r]=String(o))}return n||e}var x=Object.freeze({__proto__:null,appendUrlPath:A,btoa:c,base64URLEncode:O,clone:se,deepEquals:ce,onNextTick:le,wrapPromiseCallback:fe,transformValuesToVersionedValues:T,transformVersionedValuesToValues:de,chunkUserEventsForUrl:F,getLDUserAgentString:N,extend:ve,objectHasOwnProperty:ge,sanitizeUser:Ee});(function(e){var n,t,r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);r?(n=new Uint8Array(16),e.exports=function(){return r(n),n}):(t=new Array(16),e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),t[n]=e>>>((3&n)<<3)&255;return t})})(V={exports:{}});for(var V,_=V.exports,q=[],l=0;l<256;++l)q[l]=(l+256).toString(16).substr(1);var M,f,z=function(e,n){var n=n||0,t=q;return[t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[+n]]].join("")},d=0,v=0;var g=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||M,t=void 0!==e.clockseq?e.clockseq:f,a=(null!=i&&null!=t||(a=_(),null==i&&(i=M=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==t&&(t=f=16383&(a[6]<<8|a[7]))),void 0!==e.msecs?e.msecs:(new Date).getTime()),u=void 0!==e.nsecs?e.nsecs:v+1,s=a-d+(u-v)/1e4;if(s<0&&void 0===e.clockseq&&(t=t+1&16383),1e4<=(u=(s<0||d<a)&&void 0===e.nsecs?0:u))throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");d=a,f=t,s=(1e4*(268435455&(a+=122192928e5))+(v=u))%4294967296,o[r++]=s>>>24&255,o[r++]=s>>>16&255,o[r++]=s>>>8&255,o[r++]=255&s,e=a/4294967296*1e4&268435455,o[r++]=e>>>8&255,o[r++]=255&e,o[r++]=e>>>24&15|16,o[r++]=e>>>16&255,o[r++]=t>>>8|128,o[r++]=255&t;for(var c=0;c<6;++c)o[r+c]=i[c];return n||z(o)},p=["debug","info","warn","error","none"];function J(e,u){if(e&&e.destination&&"function"!=typeof e.destination)throw new Error("destination for basicLogger was set to a non-function");function n(n){return function(e){console&&console[n]&&console[n].call(console,e)}}var s=e&&e.destination?[e.destination,e.destination,e.destination,e.destination]:[n("log"),n("info"),n("warn"),n("error")],c=!(!e||!e.destination),l=e&&void 0!==e.prefix&&null!==e.prefix?e.prefix:"[LaunchDarkly] ",t=1;if(e&&e.level)for(var r=0;r<p.length;r++)p[r]===e.level&&(t=r);for(var o={},i=function(e){var i,a=p[e];"none"!==a&&(e<t?o[a]=function(){}:(i=e,o[a]=function(){var e=i,n=a,t=arguments;if(!(t.length<1)){var r=c?n+": "+l:l,o=1!==t.length&&u?((o=k(t))[0]=r+o[0],u.apply(void 0,k(o))):r+t[0];try{s[e](o)}catch(e){console&&console.log&&console.log("[LaunchDarkly] Configured logger's "+n+" method threw an exception: "+e)}}}))},a=0;a<p.length;a++)i(a);return o}function we(e,n){return J({level:e,prefix:n})}function m(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}function De(){return"LaunchDarkly client initialized"}function Oe(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"}function Se(e){return'Custom event "'+e+'" does not exist'}function K(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+h}function Pe(){return"No environment/client-side ID was specified."+h}function pe(e){return"Error fetching flag settings: "+m(e)}function Ue(){return"Invalid data received from LaunchDarkly; connection may have been interrupted"}function Ie(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+h}function je(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."}function B(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'}function Ce(){return"identify() has no effect here; it must be called on the main client instance"}function $(e){return'Ignoring unknown config option "'+e+'"'}function H(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"}function G(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"}function W(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t}function Te(){return"received ping message from stream"}function Re(){return"received streaming update for all flags"}function Ae(e){return'received streaming update for flag "'+e+'"'}function Le(e){return'received streaming update for flag "'+e+'" but ignored due to version check'}function Fe(e){return'received streaming deletion for flag "'+e+'"'}function Ne(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'}function xe(e){return'enqueueing "'+e+'" event'}function X(e,n){return'an inspector: "'.concat(n,'" of type: "').concat(e,'" generated an exception')}var h=" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initializing-the-client for instructions on SDK initialization.",Q=function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},Y=function(e){return'Expected application/json content type but got "'+e+'"'},Ve=function(e){return"local storage is unavailable: "+m(e)},Z=function(e){return"network error"+(e?" ("+e+")":"")},ee=function(){return"No user specified."+h},ne=function(){return"Invalid user specified."+h},te=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(R(e)?t:"giving up permanently")},re=function(){return"Cannot make HTTP requests in this environment."+h},_e=function(){return"Closing stream connection"},qe=function(e){return"Opening stream connection to "+e},Me=function(e,n){return"Error on stream connection: "+m(e)+", will continue retrying every "+n+" milliseconds."},ze=function(e){return"polling for feature flags at "+e},Je=function(e){return"sending "+e+" events"},Ke=function(e){return'Config option "'.concat(e,'" must only contain letters, numbers, ., _ or -.')},Be=function(e,n){return'an inspector: "'.concat(n,'" of an invalid type (').concat(e,") was configured")},$e=function(e){return'Value of "'.concat(e,'" was longer than 64 characters and was discarded.')},He=Object.freeze({__proto__:null,clientInitialized:De,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded:Q,eventWithoutUser:Oe,invalidContentType:Y,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:Ve,networkError:Z,unknownCustomEventKey:Se,environmentNotFound:K,environmentNotSpecified:Pe,errorFetchingFlags:pe,userNotSpecified:ee,invalidUser:ne,invalidData:Ue,bootstrapOldFormat:Ie,bootstrapInvalid:je,deprecated:B,httpErrorMessage:te,httpUnavailable:re,identifyDisabled:Ce,streamClosing:_e,streamConnecting:qe,streamError:Me,unknownOption:$,wrongOptionType:H,wrongOptionTypeBoolean:G,optionBelowMinimum:W,debugPolling:ze,debugStreamPing:Te,debugStreamPut:Re,debugStreamPatch:Ae,debugStreamPatchIgnored:Le,debugStreamDelete:Fe,debugStreamDeleteIgnored:Ne,debugEnqueueingEvent:xe,debugPostingEvents:Je,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"},invalidTagValue:Ke,invalidInspector:Be,inspectorMethodError:X,tagValueTooLong:$e}),Ge={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},requestHeaderTransform:{type:"function"},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},diagnosticRecordingInterval:{default:9e5,minimum:2e3},diagnosticOptOut:{default:!1},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"},autoAliasingOptOut:{default:!1},application:{validator:function(e,n,t){var r={};n.id&&(r.id=Xe("".concat(e,".id"),n.id,t));n.version&&(r.version=Xe("".concat(e,".version"),n.version,t));return r}},inspectors:{default:[]}},We=/^(\w|\.|-)+$/;function Xe(e,n,t){if("string"==typeof n&&n.match(We)){if(!(64<n.length))return n;t.warn($e(e))}else t.warn(Ke(e))}function Qe(e,n,t,a){var u=ve({logger:{default:a}},Ge,t),r={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null,allowFrequentDuplicateEvents:void 0};function s(e){le(function(){n&&n.maybeReportError(new w(e))})}var o,i,c,l,f,t=ve({},e||{});function d(e){return null===e?"any":void 0!==e?Array.isArray(e)?"array":"boolean"===(e=ie(e))||"string"===e||"number"===e||"function"===e?e:"object":void 0}return o=t,Object.keys(r).forEach(function(e){var n;void 0!==o[e]&&(n=r[e],a&&a.warn(B(e,n)),n&&(void 0===o[n]&&(o[n]=o[e]),delete o[e]))}),i=ve({},t),Object.keys(u).forEach(function(e){void 0!==i[e]&&null!==i[e]||(i[e]=u[e]&&u[e].default)}),l=ve({},c=t=i),Object.keys(c).forEach(function(e){var n,t,r,o,i=c[e];null!=i&&(void 0===(n=u[e])?s($(e)):(t=n.type||d(n.default),(r=n.validator)?void 0!==(r=r(e,c[e],a))?l[e]=r:delete l[e]:"any"!==t&&(r=t.split("|"),o=d(i),r.indexOf(o)<0?"boolean"===t?(l[e]=!!i,s(G(e,o))):(s(H(e,t,o)),l[e]=n.default):"number"===o&&void 0!==n.minimum&&i<n.minimum&&(s(W(e,i,n.minimum)),l[e]=n.minimum))))}),f=(t=l).logger,p.forEach(function(e){if("none"!==e&&(!f[e]||"function"!=typeof f[e]))throw new Error("Provided logger instance must support logger."+e+"(...) method")}),t}function Ye(e){var n={};return e&&(e.application&&void 0!==e.application.id&&null!==e.application.id&&(n["application-id"]=[e.application.id]),e.application&&void 0!==e.application.version&&null!==e.application.id&&(n["application-version"]=[e.application.version])),n}function Ze(e,n){var t;return n&&!n.sendLDHeaders?{}:(e={"X-LaunchDarkly-User-Agent":N(e)},n&&n.wrapperName&&(e["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t=Ye(n),(n=Object.keys(t)).length&&(e["x-launchdarkly-tags"]=n.sort().flatMap(function(n){return Array.isArray(t[n])?t[n].sort().map(function(e){return"".concat(n,"/").concat(e)}):["".concat(n,"/").concat(t[n])]}).join(" ")),e)}function en(e,n){return n&&n.requestHeaderTransform?n.requestHeaderTransform(oe({},e)):e}var nn=2e3;function tn(u,e,s){var c="/a/"+e+".gif",l=ve({"Content-Type":"application/json"},Ze(u,s)),f=u.httpFallbackPing,d={};return d.sendChunk=function(e,n,r,t){var o=JSON.stringify(e),i=r?null:g();function a(t){var e=r?l:ve({},l,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":i});return u.httpRequest("POST",n,en(e,s),o).promise.then(function(e){var n;if(e)return 400<=e.status&&R(e.status)&&t?a(!1):(n={status:(e=e).status},(e=(e=e.header("date"))&&Date.parse(e))&&(n.serverTime=e),n)}).catch(function(){return t?a(!1):Promise.reject()})}return t?a(!0).catch(function(){}):(f&&f(n+c+"?d="+O(o)),Promise.resolve())},d.sendEvents=function(e,n,t){if(!u.httpRequest)return Promise.resolve();for(var r=u.httpAllowsPost(),o=r?[e]:F(nn-n.length,e),i=[],a=0;a<o.length;a++)i.push(d.sendChunk(o[a],n,t,r));return Promise.all(i)},d}function rn(e,n,t,r,o,i){var a,u,s,c,l,f,d,v,g=3<arguments.length&&void 0!==r?r:null,p=4<arguments.length&&void 0!==o?o:null,m={},h=(5<arguments.length&&void 0!==i?i:null)||tn(e,t,n),y=A(n.eventsUrl,"/events/bulk/"+t),b=(u=a=0,s={},(r={}).summarizeEvent=function(e){var n,t;"feature"===e.kind&&(n=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),(t=s[n])?t.count=t.count+1:s[n]={count:1,key:e.key,variation:e.variation,version:e.version,value:e.value,default:e.default},(0===a||e.creationDate<a)&&(a=e.creationDate),e.creationDate>u&&(u=e.creationDate))},r.getSummary=function(){var e,n={},t=!0;for(e in s){var r=s[e],o=n[r.key],i=(o||(o={default:r.default,counters:[]},n[r.key]=o),{value:r.value,count:r.count});void 0!==r.variation&&null!==r.variation&&(i.variation=r.variation),r.version?i.version=r.version:i.unknown=!0,o.counters.push(i),t=!1}return t?null:{startDate:a,endDate:u,features:n}},r.clearSummary=function(){u=a=0,s={}},r),k=(o={},c=(i=n).allAttributesPrivate,l=i.privateAttributeNames||[],f={key:!0,custom:!0,anonymous:!0},d={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0},o.filterUser=function(e){var n,o,t,r,i;return e?(n=e.privateAttributeNames||[],o=function(e){return!f[e]&&(c||-1!==n.indexOf(e)||-1!==l.indexOf(e))},t=(r=(i=function(t,r){return Object.keys(t).reduce(function(e,n){return r(n)&&(o(n)?e[1][n]=!0:e[0][n]=t[n]),e},[{},{}])})(e,function(e){return d[e]}))[0],r=r[1],e.custom&&(i=i(e.custom,function(){return 1}),t.custom=i[0],r=ve({},r,i[1])),(e=Object.keys(r)).length&&(e.sort(),t.privateAttrs=e),t):null},o),E=n.inlineUsersInEvents,w=n.samplingInterval,D=n.eventCapacity,O=n.flushInterval,S=n.logger,P=[],U=0,I=!1,j=!1;function C(){return 0===w||0===Math.floor(Math.random()*w)}function T(e){P.length<D?(P.push(e),j=!1):(j||(j=!0,S.warn(Q())),g&&g.incrementDroppedEvents())}return m.enqueue=function(e){var n,t,r;I||(n=r=!1,b.summarizeEvent(e),"feature"===e.kind?C()&&(r=!!e.trackEvents,n=!!(t=e).debugEventsUntilDate&&(t.debugEventsUntilDate>U&&t.debugEventsUntilDate>(new Date).getTime())):r=C(),r&&T((r=ve({},t=e),"alias"!==t.kind&&(E||"identify"===t.kind?r.user=k.filterUser(t.user):(r.userKey=t.user.key,delete r.user),"feature"===t.kind&&(delete r.trackEvents,delete r.debugEventsUntilDate)),r)),n&&((r=ve({},e,{kind:"debug"})).user=k.filterUser(r.user),delete r.trackEvents,delete r.debugEventsUntilDate,T(r)))},m.flush=function(){var e,n;return I||(e=P,n=b.getSummary(),b.clearSummary(),n&&(n.kind="summary",e.push(n)),g&&g.setEventsInLastBatch(e.length),0===e.length)?Promise.resolve():(P=[],S.debug(Je(e.length)),h.sendEvents(e,y).then(function(e){e&&(e.serverTime&&(U=e.serverTime),R(e.status)||(I=!0),400<=e.status&&le(function(){p.maybeReportError(new L(te(e.status,"event posting","some events were dropped")))}))}))},m.start=function(){v=setTimeout(function e(){m.flush(),v=setTimeout(e,O)},O)},m.stop=function(){clearTimeout(v)},m}function on(n){var e={},o={};return e.on=function(e,n,t){o[e]=o[e]||[],o[e]=o[e].concat({handler:n,context:t})},e.off=function(e,n,t){if(o[e])for(var r=0;r<o[e].length;r++)o[e][r].handler===n&&o[e][r].context===t&&(o[e]=o[e].slice(0,r).concat(o[e].slice(r+1)))},e.emit=function(e){if(o[e])for(var n=o[e].slice(0),t=0;t<n.length;t++)n[t].handler.apply(n[t].context,Array.prototype.slice.call(arguments,1))},e.getEvents=function(){return Object.keys(o)},e.getEventListenerCount=function(e){return o[e]?o[e].length:0},e.maybeReportError=function(e){e&&(o["error"]?this.emit("error",e):(n||console).error(e.message))},e}var y="ready",an="initialized",un="failed";var sn=function(o){var n=!1,t=!1,r=null,e=null,i=new Promise(function(n){o.on(y,function e(){o.off(y,e),n()})}).catch(function(){});return{getInitializationPromise:function(){if(!e){if(n)return Promise.resolve();if(t)return Promise.reject(r);e=new Promise(function(n,t){function r(e){o.off(un,r),t(e)}o.on(an,function e(){o.off(an,e),n()}),o.on(un,r)})}return e},getReadyPromise:function(){return i},signalSuccess:function(){n||t||(n=!0,o.emit(an),o.emit(y))},signalFailure:function(e){n||t||(t=!0,r=e,o.emit(un,e),o.emit(y)),o.maybeReportError(e)}}};function cn(n,t,r,o){var i={};function a(){var e="",n=o.getUser();return n&&(e=r||c(JSON.stringify(n))),"ld:"+t+":"+e}return i.loadFlags=function(){return n.get(a()).then(function(e){if(null==e)return null;try{var n,t=JSON.parse(e);return t&&(void 0===(n=t.$schema)||n<1?t=T(t):delete t.$schema),t}catch(e){return i.clearFlags().then(function(){return null})}})},i.saveFlags=function(e){e=ve({},e,{$schema:1});return n.set(a(),JSON.stringify(e))},i.clearFlags=function(){return n.clear(a())},i}function ln(r,n){function o(e){t||(t=!0,n.warn(Ve(e)))}var e={},t=!1;return e.isEnabled=function(){return!!r},e.get=function(e){return new Promise(function(n){r?r.get(e).then(n).catch(function(e){o(e),n(void 0)}):n(void 0)})},e.set=function(e,t){return new Promise(function(n){r?r.set(e,t).then(function(){return n(!0)}).catch(function(e){o(e),n(!1)}):n(!1)})},e.clear=function(e){return new Promise(function(n){r?r.clear(e).then(function(){return n(!0)}).catch(function(e){o(e),n(!1)}):n(!1)})},e}var fn=3e5;function dn(o,i,a,n){var u,s=i.streamUrl,c=i.logger,e={},l=A(s,"/eval/"+a),f=i.useReport,d=i.evaluationReasons,t=i.streamReconnectDelay,v=Ze(o,i),g=!1,p=null,m=null,h=null,y=null,b=null;function k(e){g||(c.warn(Me(e,t)),g=!0),D(!1),w(),E(t)}function E(e){m||(e?m=setTimeout(r,e):r())}function r(){m=null;var e,n="",t={headers:v,readTimeoutMillis:fn};if(o.eventSourceFactory){for(var r in null!=y&&(n="h="+y),f?o.eventSourceAllowsReport?(e=l,t.method="REPORT",t.headers["Content-Type"]="application/json",t.body=JSON.stringify(h)):(e=A(s,"/ping/"+a),n=""):e=l+"/"+O(JSON.stringify(h)),t.headers=en(t.headers,i),e=e+((n=d?n+(n?"&":"")+"withReasons=true":n)?"?":"")+n,w(),c.info(qe(e)),u=(new Date).getTime(),p=o.eventSourceFactory(e,t),b)ge(b,r)&&p.addEventListener(r,b[r]);p.onerror=k}}function w(){p&&(c.info(_e()),p.close(),p=null)}function D(e){u&&n&&n.recordStreamInit(u,!e,(new Date).getTime()-u),u=null}return e.connect=function(e,n,t){h=e,y=n,b={};for(var r in t||{})!function(n){b[n]=function(e){D(!(g=!1)),t[n]&&t[n](e)}}(r);E()},e.disconnect=function(){clearTimeout(m),m=null,w()},e.isConnected=function(){return!!(p&&o.eventSourceIsActive&&o.eventSourceIsActive(p))},e}var vn="application/json";function gn(d,v,i){var a=v.baseUrl,u=v.useReport,s=v.evaluationReasons,c=v.logger,e={},g={};function l(e,n){var t,r,o,i,a,u,s,c,l,f;return d.httpRequest?(t=n?"REPORT":"GET",r=Ze(d,v),n&&(r["Content-Type"]=vn),(o=g[e])||(i=function(){delete g[e]},(f={addPromise:function(n,e){a=n,u&&u(),u=e,n.then(function(e){a===n&&(s(e),i&&i())},function(e){a===n&&(c(e),i&&i())})}}).resultPromise=new Promise(function(e,n){s=e,c=n}),o=f,g[e]=o),f=(l=d.httpRequest(t,e,en(r,v),n)).promise.then(function(e){var n;return 200===e.status?e.header("content-type")&&e.header("content-type").substring(0,vn.length)===vn?JSON.parse(e.body):(n=Y(e.header("content-type")||""),Promise.reject(new ue(n))):Promise.reject(404===(n=e).status?new ae(K()):new ue(pe(n.statusText||String(n.status))))},function(e){return Promise.reject(new ue(Z(e)))}),o.addPromise(f,function(){l.cancel&&l.cancel()}),o.resultPromise):new Promise(function(e,n){n(new ue(re()))})}return e.fetchJSON=function(e){return l(A(a,e),null)},e.fetchFlagSettings=function(e,n){var t,r,o="";return u?(t=[a,"/sdk/evalx/",i,"/user"].join(""),r=JSON.stringify(e)):(e=O(JSON.stringify(e)),t=[a,"/sdk/evalx/",i,"/users/",e].join("")),n&&(o="h="+n),c.debug(ze(t=t+((o=s?o+(o?"&":"")+"withReasons=true":o)?"?":"")+o)),l(t,r)},e}var pn="ld:$anonUserId";function mn(t){var e={};return e.validateUser=function(e){var n;return e?null!==(n=se(e)).key&&void 0!==n.key?(n.key=n.key.toString(),Promise.resolve(n)):n.anonymous?t.get(pn).then(function(e){return e?(n.key=e,n):(e=g(),n.key=e,t.set(pn,e).then(function(){return n}))}):Promise.reject(new i(ne())):Promise.reject(new i(ee()))},e}var hn=Object.freeze({__proto__:null,baseOptionDefs:Ge,validate:Qe,getTags:Ye}).baseOptionDefs,yn=x.appendUrlPath;var bn=function(e){var n={diagnosticId:g()};return e&&(n.sdkKeySuffix=6<e.length?e.substring(e.length-6):e),n},kn=function(e){var n,t,r,o;function i(e){n=e,r=t=0,o=[]}return i(e),{getProps:function(){return{dataSinceDate:n,droppedEvents:t,eventsInLastBatch:r,streamInits:o}},setProps:function(e){n=e.dataSinceDate,t=e.droppedEvents||0,r=e.eventsInLastBatch||0,o=e.streamInits||[]},incrementDroppedEvents:function(){t++},setEventsInLastBatch:function(e){r=e},recordStreamInit:function(e,n,t){o.push({timestamp:e,failed:n,durationMillis:t})},reset:i}},En=function(n,r,e,t,o,i,a){var u,s,c=!!n.diagnosticUseCombinedEvent,l="ld:"+o+":$diagnostics",f=yn(i.eventsUrl,"/events/diagnostic/"+o),d=i.diagnosticRecordingInterval,v=e,g=!!i.streaming;function p(){return{sdk:function(){var e=oe({},n.diagnosticSdkData);i.wrapperName&&(e.wrapperName=i.wrapperName);i.wrapperVersion&&(e.wrapperVersion=i.wrapperVersion);return e}(),configuration:{customBaseURI:i.baseUrl!==hn.baseUrl.default,customStreamURI:i.streamUrl!==hn.streamUrl.default,customEventsURI:i.eventsUrl!==hn.eventsUrl.default,eventsCapacity:i.eventCapacity,eventsFlushIntervalMillis:i.flushInterval,reconnectTimeMillis:i.streamReconnectDelay,streamingDisabled:!g,allAttributesPrivate:!!i.allAttributesPrivate,inlineUsersInEvents:!!i.inlineUsersInEvents,diagnosticRecordingIntervalMillis:i.diagnosticRecordingInterval,usingSecureMode:!!i.hash,bootstrapMode:!!i.bootstrap,fetchGoalsDisabled:!i.fetchGoals,sendEventsOnlyForVariation:!!i.sendEventsOnlyForVariation,autoAliasingOptOut:!!i.autoAliasingOptOut},platform:n.diagnosticPlatformData}}function m(e){i.logger&&i.logger.debug(He.debugPostingDiagnosticEvent(e)),t.sendEvents(e,f,!0).then(function(){}).catch(function(){})}function h(){var e,n;m((n=(new Date).getTime(),e=oe({kind:c?"diagnostic-combined":"diagnostic",id:a,creationDate:n},v.getProps()),c&&(e=oe(oe({},e),p())),v.reset(n),e)),s=setTimeout(h,d),u=(new Date).getTime(),c&&r.isEnabled()&&(n=oe({},v.getProps()),r.set(l,JSON.stringify(n)))}return(o={}).start=function(){var t;c?(t=function(e){var n;e?(e=(u||0)+d)<=(n=(new Date).getTime())?h():s=setTimeout(h,e-n):0===Math.floor(4*Math.random())?h():s=setTimeout(h,d)},r.isEnabled()?r.get(l).then(function(e){if(e)try{var n=JSON.parse(e);v.setProps(n),u=n.dataSinceDate}catch(e){}t(!0)}).catch(function(){t(!1)}):t(!1)):(m(oe({kind:"diagnostic-init",id:a,creationDate:v.getProps().dataSinceDate},p())),s=setTimeout(h,d))},o.stop=function(){s&&clearTimeout(s)},o.setStreaming=function(e){g=e},o};var me={flagUsed:"flag-used",flagDetailsChanged:"flag-details-changed",flagDetailChanged:"flag-detail-changed",clientIdentityChanged:"client-identity-changed"};function wn(e,i){var n,t={},o=(r(n={},me.flagUsed,[]),r(n,me.flagDetailsChanged,[]),r(n,me.flagDetailChanged,[]),r(n,me.clientIdentityChanged,[]),n);return(null==e?void 0:e.map(function(e){return t=i,r=!1,o={type:(n=e).type,name:n.name,method:function(){try{n.method.apply(n,arguments)}catch(e){r||(r=!0,t.warn(X(o.type,o.name)))}}};var n,t,r,o})).forEach(function(e){Object.prototype.hasOwnProperty.call(o,e.type)?o[e.type].push(e):i.warn(Be(e.type,e.name))}),t.hasListeners=function(e){return null==(e=o[e])?void 0:e.length},t.onFlagUsed=function(n,t,r){o[me.flagUsed].length&&le(function(){o[me.flagUsed].forEach(function(e){return e.method(n,t,r)})})},t.onFlags=function(n){o[me.flagDetailsChanged].length&&le(function(){o[me.flagDetailsChanged].forEach(function(e){return e.method(n)})})},t.onFlagChanged=function(n,t){o[me.flagDetailChanged].length&&le(function(){console.log("what?"),o[me.flagDetailChanged].forEach(function(e){return e.method(n,t)})})},t.onIdentityChanged=function(n){o[me.clientIdentityChanged].length&&le(function(){o[me.clientIdentityChanged].forEach(function(e){return e.method(n)})})},t}Object.freeze(me);var he="change",Dn="internal-change";e.commonBasicLogger=J,e.createConsoleLogger=we,e.errors=D,e.initialize=function(N,x,e,o,n){var t,a,r,i,u,s,V,c,_,l=function(){if(e&&e.logger)return e.logger;return n&&n.logger&&n.logger.default||we("warn")}(),f=on(l),d=sn(f),v=Qe(e,f,n,l),g=wn(v.inspectors,l),p=v.sendEvents,m=N,h=v.hash,y=ln(o.localStorage,l),b=tn(o,m,v),k=v.sendEvents&&!v.diagnosticOptOut,q=k?bn(m):null,E=k?kn((new Date).getTime()):null,w=k?En(o,y,E,b,m,v,q):null,M=dn(o,v,m,E),D=v.eventProcessor||rn(o,v,m,E,f,b),O=gn(o,v,m),S={},P=v.streaming,z=!1,U=!1,J=!0,I=v.stateProvider,j=(i=function(e,n){(function(e){I||e&&T({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})})(e),!v.autoAliasingOptOut&&n&&n.anonymous&&e&&!e.anonymous&&X(e,n);B()},k={setUser:function(e){var n=u&&se(u);(u=Ee(e))&&i&&i(se(u),n)},getUser:function(){return u?se(u):null}},(q=null)&&k.setUser(q),k),K=mn(y),C=y.isEnabled()?new cn(y,m,h,j):null;function T(e){if(m&&!(I&&I.enqueueEvent&&I.enqueueEvent(e))){if("alias"!==e.kind){if(!e.user)return void(J&&(l.warn(Oe()),J=!1));J=!1}!p||U||o.isDoNotTrack()||(l.debug(xe(e.kind)),D.enqueue(e))}}function B(){g.hasListeners(me.clientIdentityChanged)&&g.onIdentityChanged(j.getUser())}function $(e,n){g.hasListeners(me.flagDetailChanged)&&g.onFlagChanged(e.key,R(n))}function H(){g.hasListeners(me.flagDetailsChanged)&&g.onFlags(Object.entries(S).map(function(e){e=ye(e,2);return{key:e[0],detail:R(e[1])}}).reduce(function(e,n){return e[n.key]=n.detail,e},{}))}function G(e,n,t,r){var o=j.getUser(),i=new Date,t={kind:"feature",key:e,user:o,value:n?n.value:null,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()},i=(o&&o.anonymous&&(t.contextKind=A(o)),S[e]);i&&(t.version=i.flagVersion||i.version,t.trackEvents=i.trackEvents,t.debugEventsUntilDate=i.debugEventsUntilDate),(r||i&&i.trackReason)&&n&&(t.reason=n.reason),T(t)}function W(e,n,t,r,o){var i,a;return S&&ge(S,e)&&S[e]&&!S[e].deleted?(a=R(i=S[e]),null!==i.value&&void 0!==i.value||(a.value=n)):a={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}},t&&G(e,a,n,r),o||B(),a}function R(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function A(e){return e.anonymous?"anonymousUser":"user"}function X(e,n){I||e&&n&&T({kind:"alias",key:e.key,contextKind:A(e),previousKey:n.key,previousContextKind:A(n),creationDate:(new Date).getTime()})}function Q(){var i;a=!0,j.getUser()&&(i=function(e){try{return JSON.parse(e)}catch(e){f.maybeReportError(new ke(Ue()))}},M.connect(j.getUser(),h,{ping:function(){l.debug(Te());var n=j.getUser();O.fetchFlagSettings(n,h).then(function(e){ce(n,j.getUser())&&L(e||{})}).catch(function(e){f.maybeReportError(new ue(pe(e)))})},put:function(e){e=i(e.data);e&&(l.debug(Re()),L(e))},patch:function(e){var n,t,r,o,e=i(e.data);e&&(!(n=S[e.key])||!n.version||!e.version||n.version<e.version?(l.debug(Ae(e.key)),t={},delete(r=ve({},e)).key,o=R(S[e.key]=r),t[e.key]=n?{previous:n.value,current:o}:{current:o},Z(t),$(e,r)):l.debug(Le(e.key)))},delete:function(e){var n,e=i(e.data);e&&(!S[e.key]||S[e.key].version<e.version?(l.debug(Fe(e.key)),n={},S[e.key]&&!S[e.key].deleted&&(n[e.key]={previous:S[e.key].value}),S[e.key]={version:e.version,deleted:!0},$(e,S[e.key]),Z(n)):l.debug(Ne(e.key)))}}))}function Y(){a&&(M.disconnect(),a=!1)}function L(e){var n,t,r={};if(!e)return Promise.resolve();for(n in S)ge(S,n)&&S[n]&&(e[n]&&!ce(e[n].value,S[n].value)?r[n]={previous:S[n].value,current:R(e[n])}:e[n]&&!e[n].deleted||(r[n]={previous:S[n].value}));for(t in e)ge(e,t)&&e[t]&&(!S[t]||S[t].deleted)&&(r[t]={current:R(e[t])});return S=oe({},e),H(),Z(r).catch(function(){})}function Z(o){var i,e=Object.keys(o);return 0<e.length&&(i={},e.forEach(function(e){var n=o[e].current,t=n?n.value:void 0,r=o[e].previous;f.emit(he+":"+e,t,r),i[e]=n?{current:t,previous:r}:{previous:r}}),f.emit(he,i),f.emit(Dn,S),v.sendEventsOnlyForVariation||I||e.forEach(function(e){G(e,o[e].current)})),t&&C?C.saveFlags(S):Promise.resolve()}function ee(){var e=P||r&&void 0===P;e&&!a?Q():!e&&a&&Y(),w&&w.setStreaming(e)}function ne(e){return e===he||e.substr(0,he.length+1)===he+":"}function te(e){m=e.environment,j.setUser(e.user),S=oe({},e.flags),le(F)}function F(){l.info(De()),z=!0,ee(),d.signalSuccess()}function re(e){d.signalFailure(e)}return"string"==typeof v.bootstrap&&"LOCALSTORAGE"===v.bootstrap.toUpperCase()&&(C?t=!0:l.warn(Ve())),"object"===ie(v.bootstrap)&&(s=v.bootstrap,E=Object.keys(s),!(c=s[V="$flagsState"])&&E.length&&l.warn(Ie()),!1===s.$valid&&l.warn(je()),_={},E.forEach(function(e){var n;e!==V&&"$valid"!==e&&(n={value:s[e]},c&&c[e]?n=ve(n,c[e]):n.version=0,_[e]=n)}),S=_),I?((b=I.getInitialState())?te(b):I.on("init",te),I.on("update",function(e){e.user&&j.setUser(e.user);e.flags&&L(e.flags)})):(N?K.validateUser(x).then(function(e){return j.setUser(e),"object"===ie(v.bootstrap)?F():t?C.loadFlags().then(function(e){return null==e?(S={},O.fetchFlagSettings(j.getUser(),h).then(function(e){return L(e||{})}).then(F).catch(function(e){re(new ue(pe(e)))})):(S=e,le(F),O.fetchFlagSettings(j.getUser(),h).then(L).catch(function(e){return f.maybeReportError(e)}))}):O.fetchFlagSettings(j.getUser(),h).then(function(e){S=e||{},H(),F()}).catch(function(e){S={},re(e)})}):Promise.reject(new ae(Pe()))).catch(re),{client:{waitForInitialization:function(){return d.getInitializationPromise()},waitUntilReady:function(){return d.getReadyPromise()},identify:function(e,r,n){return U?fe(Promise.resolve({}),n):I?(l.warn(Ce()),fe(Promise.resolve(de(S)),n)):fe((t&&C?C.clearFlags():Promise.resolve()).then(function(){return K.validateUser(e)}).then(function(t){return O.fetchFlagSettings(t,r).then(function(e){var n=de(e);return j.setUser(t),h=r,e?L(e).then(function(){return n}):n})}).then(function(e){return a&&Q(),e}).catch(function(e){return f.maybeReportError(e),Promise.reject(e)}),n)},getUser:function(){return j.getUser()},variation:function(e,n){return W(e,n,!0,!1,!1).value},variationDetail:function(e,n){return W(e,n,!0,!0,!1)},track:function(e,n,t){var r;"string"!=typeof e?f.maybeReportError(new be(Se(e))):(o.customEventFilter&&!o.customEventFilter(e)&&l.warn(Se(e)),r={kind:"custom",key:e,user:e=j.getUser(),url:o.getCurrentUrl(),creationDate:(new Date).getTime()},e&&e.anonymous&&(r.contextKind=A(e)),null!=n&&(r.data=n),null!=t&&(r.metricValue=t),T(r))},alias:X,on:function(e,n,t){ne(e)?(r=!0,z&&ee(),f.on(e,n,t)):f.on.apply(f,arguments)},off:function(e){var n;f.off.apply(f,arguments),ne(e)&&(n=!1,f.getEvents().forEach(function(e){ne(e)&&0<f.getEventListenerCount(e)&&(n=!0)}),n||(r=!1,a&&void 0===P&&Y()))},setStreaming:function(e){(e=null===e?void 0:e)!==P&&(P=e,ee())},flush:function(e){return fe(p?D.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(S)for(var n in S)ge(S,n)&&!S[n].deleted&&(e[n]=W(n,null,!v.sendEventsOnlyForVariation,!1,!0).value);return e},close:function(e){var n;return U?fe(Promise.resolve(),e):(n=function(){U=!0,S={}},fe(Promise.resolve().then(function(){if(Y(),w&&w.stop(),p)return D.stop(),D.flush()}).then(n).catch(n),e))}},options:v,emitter:f,ident:j,logger:l,requestor:O,start:function(){p&&(w&&w.start(),D.start())},enqueueEvent:T,getFlagsInternal:function(){return S},getEnvironmentId:function(){return m},internalChangeEventName:Dn}},e.messages=He,e.utils=x,e.version="3.8.0",Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ldclient-common.min.js.map
{
"name": "launchdarkly-js-sdk-common",
"version": "3.7.0",
"version": "3.8.0",
"description": "LaunchDarkly SDK for JavaScript - common code",

@@ -5,0 +5,0 @@ "author": "LaunchDarkly <team@launchdarkly.com>",

@@ -319,2 +319,7 @@ /**

}
/**
* Inspectors can be used for collecting information for monitoring, analytics, and debugging.
*/
inspectors?: LDInspection[];
}

@@ -863,2 +868,103 @@

export type LDLogLevel = 'debug' | 'info' | 'warn' | 'error' | 'none';
/**
* Callback interface for collecting information about the SDK at runtime.
*
* This interface is used to collect information about flag usage.
*
* This interface should not be used by the application to access flags for the purpose of controlling application
* flow. It is intended for monitoring, analytics, or debugging purposes.
*/
interface LDInspectionFlagUsedHandler {
type: 'flag-used',
/**
* Name of the inspector. Will be used for logging issues with the inspector.
*/
name: string,
/**
* This method is called when a flag is accessed via a variation method, or it can be called based on actions in
* wrapper SDKs which have different methods of tracking when a flag was accessed. It is not called when a call is made
* to allFlags.
*/
method: (flagKey: string, flagDetail: LDEvaluationDetail, user: LDUser) => void;
}
/**
* Callback interface for collecting information about the SDK at runtime.
*
* This interface is used to collect information about flag data. In order to understand the
* current flag state it should be combined with {@link LDInspectionFlagValueChangedHandler}.
* This interface will get the initial flag information, and
* {@link LDInspectionFlagValueChangedHandler} will provide changes to individual flags.
*
* This interface should not be used by the application to access flags for the purpose of controlling application
* flow. It is intended for monitoring, analytics, or debugging purposes.
*/
interface LDInspectionFlagDetailsChangedHandler {
type: 'flag-details-changed',
/**
* Name of the inspector. Will be used for logging issues with the inspector.
*/
name: string,
/**
* This method is called when the flags in the store are replaced with new flags. It will contain all flags
* regardless of if they have been evaluated.
*/
method: (details: Record<string, LDEvaluationDetail>) => void;
}
/**
* Callback interface for collecting information about the SDK at runtime.
*
* This interface is used to collect changes to flag data, but does not provide the initial
* data. It can be combined with {@link LDInspectionFlagValuesChangedHandler} to track the
* entire flag state.
*
* This interface should not be used by the application to access flags for the purpose of controlling application
* flow. It is intended for monitoring, analytics, or debugging purposes.
*/
interface LDInspectionFlagDetailChangedHandler {
type: 'flag-detail-changed',
/**
* Name of the inspector. Will be used for logging issues with the inspector.
*/
name: string,
/**
* This method is called when a flag is updated. It will not be called
* when all flags are updated.
*/
method: (flagKey: string, detail: LDEvaluationDetail) => void;
}
/**
* Callback interface for collecting information about the SDK at runtime.
*
* This interface is used to track current identity state of the SDK.
*
* This interface should not be used by the application to access flags for the purpose of controlling application
* flow. It is intended for monitoring, analytics, or debugging purposes.
*/
interface LDInspectionIdentifyHandler {
type: 'client-identity-changed',
/**
* Name of the inspector. Will be used for logging issues with the inspector.
*/
name: string,
/**
* This method will be called when an identify operation completes.
*/
method: (user: LDUser) => void;
}
type LDInspection = LDInspectionFlagUsedHandler | LDInspectionFlagDetailsChangedHandler
| LDInspectionFlagDetailChangedHandler | LDInspectionIdentifyHandler;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc