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

launchdarkly-js-client-sdk

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 2.19.4 to 2.20.0-alpha.1

2

dist/ldclient.cjs.js

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

"use strict";function e(n){return(e="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})(n)}function n(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function t(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function r(r){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?t(o,!0).forEach(function(e){n(r,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(o).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})}return r}function i(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 o=i("LaunchDarklyUnexpectedResponseError"),a=i("LaunchDarklyInvalidEnvironmentIdError"),u=i("LaunchDarklyInvalidUserError"),s=i("LaunchDarklyInvalidEventKeyError"),c=i("LaunchDarklyInvalidArgumentError"),l=i("LaunchDarklyFlagFetchError");function f(e){return!(400<=e&&e<500)||400===e||408===e||429===e}for(var v=Object.freeze({__proto__:null,LDUnexpectedResponseError:o,LDInvalidEnvironmentIdError:a,LDInvalidUserError:u,LDInvalidEventKeyError:s,LDInvalidArgumentError:c,LDFlagFetchError:l,isHttpErrorRecoverable:f}),d=function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(b(e,i,a<i+16383?a:i+16383));return 1==r?(n=e[t-1],o.push(g[n>>2]+g[n<<4&63]+"==")):2==r&&(n=(e[t-2]<<8)+e[t-1],o.push(g[n>>10]+g[n>>4&63]+g[n<<2&63]+"=")),o.join("")},g=[],m=[],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=0,h=p.length;y<h;++y)g[y]=p[y],m[p.charCodeAt(y)]=y;function b(e,n,t){for(var r,o,i=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(g[(o=r)>>18&63]+g[o>>12&63]+g[o>>6&63]+g[63&o]);return i.join("")}m["-".charCodeAt(0)]=62,m["_".charCodeAt(0)]=63;var k=Array.isArray,E=Object.keys,w=Object.prototype.hasOwnProperty,D=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function S(e){var n=unescape(encodeURIComponent(e));return d(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(n))}function O(e){return S(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function P(e){return JSON.parse(JSON.stringify(e))}function U(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,o,i,a=k(n),u=k(t);if(a&&u){if((o=n.length)!=t.length)return!1;for(r=o;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 d=E(n);if((o=d.length)!==E(t).length)return!1;for(r=o;0!=r--;)if(!w.call(t,d[r]))return!1;for(r=o;0!=r--;)if(!e(n[i=d[r]],t[i]))return!1;return!0}return n!=n&&t!=t}(e,n)}function I(e){setTimeout(e,0)}function j(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 R(e){var n={};for(var t in e)A(e,t)&&(n[t]={value:e[t],version:0});return n}function T(e){var n={};for(var t in e)A(e,t)&&(n[t]=e[t].value);return n}function N(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 F(e){var n=e.version||"3.3.2";return e.userAgent+"/"+n}function C(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":F(e)};return n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t}function L(){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 r({},e,{},n)},{})}function A(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function x(e){if(!e)return e;var n;for(var t in D){var o=D[t],i=e[o];void 0!==i&&"string"!=typeof i&&((n=n||r({},e))[o]=String(i))}return n||e}for(var V=Object.freeze({__proto__:null,btoa:S,base64URLEncode:O,clone:P,deepEquals:U,onNextTick:I,wrapPromiseCallback:j,transformValuesToVersionedValues:R,transformVersionedValuesToValues:T,chunkUserEventsForUrl:N,getLDUserAgentString:F,getLDHeaders:C,extend:L,objectHasOwnProperty:A,sanitizeUser:x}),q=function(e,n){return 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}}}(n={exports:{}}),n.exports}(),_=[],J=0;J<256;++J)_[J]=(J+256).toString(16).substr(1);var z,M,K=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("")},B=0,$=0,H=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||z,a=void 0!==e.clockseq?e.clockseq:M;if(null==i||null==a){var u=q();null==i&&(i=z=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=M=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:$+1,l=s-B+(c-$)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||B<s)&&void 0===e.nsecs&&(c=0),1e4<=c)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");B=s,M=a;var f=(1e4*(268435455&(s+=122192928e5))+($=c))%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=255&f;var d=s/4294967296*1e4&268435455;o[r++]=d>>>8&255,o[r++]=255&d,o[r++]=d>>>24&15|16,o[r++]=d>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var v=0;v<6;++v)o[r+v]=i[v];return n||K(o)};function G(u,e,n){var t="/a/"+e+".gif",s=L({"Content-Type":"application/json"},C(u,n)),c=u.httpFallbackPing,l={sendChunk:function(e,r,o,n){var i=JSON.stringify(e),a=o?null:H();return n?function n(t){var e=o?s:L({},s,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":a});return u.httpRequest("POST",r,e,i).promise.then(function(e){if(e)return 400<=e.status&&f(e.status)&&t?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 t?n(!1):Promise.reject()})}(!0).catch(function(){}):(c&&c(r+t+"?d="+O(i)),Promise.resolve())},sendEvents:function(e,n,t){if(!u.httpRequest)return Promise.resolve();var r,o=u.httpAllowsPost();r=o?[e]:N(2e3-n.length,e);for(var i=[],a=0;a<r.length;a++)i.push(l.sendChunk(r[a],n,t,o));return Promise.all(i)}};return l}function X(){var e={},a=0,u=0,s={};return e.summarizeEvent=function(e){if("feature"===e.kind){var 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?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)}},e.getSummary=function(){var e={},n=!0;for(var t in s){var r=s[t],o=e[r.key];o||(o={default:r.default,counters:[]},e[r.key]=o);var i={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:u,features:e}},e.clearSummary=function(){u=a=0,s={}},e}function W(e){var n={},s=e.allAttributesPrivate,c=e.privateAttributeNames||[],l={key:!0,custom:!0,anonymous:!0},f={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;function n(o,i){return Object.keys(o).reduce(function(e,n){var t,r=e;return i(n)&&(l[t=n]||!s&&-1===a.indexOf(t)&&-1===c.indexOf(t)?r[0][n]=o[n]:r[1][n]=!0),r},[{},{}])}var a=e.privateAttributeNames||[],t=n(e,function(e){return f[e]}),r=t[0],o=t[1];if(e.custom){var i=n(e.custom,function(){return!0});r.custom=i[0],o=L({},o,i[1])}var u=Object.keys(o);return u.length&&(u.sort(),r.privateAttrs=u),r},n}function Q(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var Y=function(){return"LaunchDarkly client initialized"},Z=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#initializing-the-client for instructions on SDK initialization.",ee=function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},ne=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"},te=function(e){return'Expected application/json content type but got "'+e+'"'},re=function(){return"localStorage is unavailable"},ie=function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},oe=function(e){return"network error"+(e?" ("+e+")":"")},ae=function(e){return'Custom event "'+e+'" does not exist'},ue=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+Z},se=function(){return"No environment/client-side ID was specified."+Z},ce=function(e){return"Error fetching flag settings: "+Q(e)},le=function(){return"No user specified."+Z},fe=function(){return"Invalid user specified."+Z},ve=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+Z},de=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},ge=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},me=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(f(e)?t:"giving up permanently")},pe=function(){return"Cannot make HTTP requests in this environment."+Z},ye=function(){return"identify() has no effect here; it must be called on the main client instance"},he=function(){return"Closing stream connection"},be=function(e){return"Opening stream connection to "+e},ke=function(e,n){return"Error on stream connection: "+Q(e)+", will continue retrying every "+n+" milliseconds."},Ee=function(e){return'Ignoring unknown config option "'+e+'"'},we=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},De=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},Se=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},Oe=function(e){return"polling for feature flags at "+e},Pe=function(){return"received ping message from stream"},Ue=function(){return"received streaming update for all flags"},Ie=function(e){return'received streaming update for flag "'+e+'"'},je=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},Re=function(e){return'received streaming deletion for flag "'+e+'"'},Te=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"},Ce=Object.freeze({__proto__:null,clientInitialized:Y,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded:ee,eventWithoutUser:ne,invalidContentType:te,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:re,localStorageUnavailableForUserId:ie,networkError:oe,unknownCustomEventKey:ae,environmentNotFound:ue,environmentNotSpecified:se,errorFetchingFlags:ce,userNotSpecified:le,invalidUser:fe,bootstrapOldFormat:ve,bootstrapInvalid:de,deprecated:ge,httpErrorMessage:me,httpUnavailable:pe,identifyDisabled:ye,streamClosing:he,streamConnecting:be,streamError:ke,unknownOption:Ee,wrongOptionType:we,wrongOptionTypeBoolean:De,optionBelowMinimum:Se,debugPolling:Oe,debugStreamPing:Pe,debugStreamPut:Ue,debugStreamPatch:Ie,debugStreamPatchIgnored:je,debugStreamDelete:Re,debugStreamDeleteIgnored:Te,debugEnqueueingEvent:Ne,debugPostingEvents:Fe,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"}});function Le(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 Ae=function(r){var n=!1,t=!1,o=null,e=null,i=new Promise(function(n){r.on("ready",function e(){r.off("ready",e),n()})}).catch(function(){});return{getInitializationPromise:function(){return e||(n?Promise.resolve():t?Promise.reject(o):e=new Promise(function(n,t){r.on("initialized",function e(){r.off("initialized",e),n()}),r.on("failed",function e(n){r.off("failed",e),t(n)})}))},getReadyPromise:function(){return i},signalSuccess:function(){n||t||(n=!0,r.emit("initialized"),r.emit("ready"))},signalFailure:function(e){n||t||(t=!0,o=e,r.emit("failed",e),r.emit("ready")),r.maybeReportError(e)}}};function xe(t,r,o,i,a){var u={};function s(){var e="",n=i.getUser();return n&&(e=o||S(JSON.stringify(n))),"ld:"+r+":"+e}return u.loadFlags=function(){return t.get(s()).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=R(n):delete n.$schema}return n}catch(e){return u.clearFlags().then(function(){return Promise.reject(e)})}}).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.saveFlags=function(e){var n=L({},e,{$schema:1});return t.set(s(),JSON.stringify(n)).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.clearFlags=function(){return t.clear(s()).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u}function Ve(o,e,i,n){var a,u=e.streamUrl,s=e.logger,t={},c=u+"/eval/"+i,l=e.useReport,f=e.evaluationReasons,r=e.streamReconnectDelay,d=C(o,e),v=!1,g=null,p=null,m=null,h=null,y=null;function w(e){v||(s.warn(ke(e,r)),v=!0),S(!1),E(),b(r)}function b(e){p||(e?p=setTimeout(k,e):k())}function k(){var e;p=null;var n="",t={headers:d,readTimeoutMillis:3e5};if(o.eventSourceFactory){for(var r in null!=h&&(n="h="+h),l?o.eventSourceAllowsReport?(e=c,t.method="REPORT",t.headers["Content-Type"]="application/json",t.body=JSON.stringify(m)):(e=u+"/ping/"+i,n=""):e=c+"/"+O(JSON.stringify(m)),f&&(n=n+(n?"&":"")+"withReasons=true"),e=e+(n?"?":"")+n,E(),s.info(be(e)),a=(new Date).getTime(),g=o.eventSourceFactory(e,t),y)A(y,r)&&g.addEventListener(r,y[r]);g.onerror=w}}function E(){g&&(s.info("Closing stream connection"),g.close(),g=null)}function S(e){a&&n&&n.recordStreamInit(a,!e,(new Date).getTime()-a),a=null}return t.connect=function(e,n,t){m=e,h=n,y={};function r(n){y[n]=function(e){S(!(v=!1)),t[n]&&t[n](e)}}for(var o in t||{})r(o);b()},t.disconnect=function(){clearTimeout(p),p=null,E()},t.isConnected=function(){return!!(g&&o.eventSourceIsActive&&o.eventSourceIsActive(g))},t}function qe(p,m,u){var s=m.baseUrl,c=m.useReport,f=m.evaluationReasons,d=m.logger,e={},h={};function v(e,n){if(!p.httpRequest)return new Promise(function(e,n){n(new l(pe()))});var t=n?"REPORT":"GET",r=C(p,m);n&&(r["Content-Type"]="application/json");var o,i,u,s,c,f,d=h[e];d||(o=function(){delete h[e]},(f={addPromise:function(n,e){i=n,u&&u(),u=e,n.then(function(e){i===n&&(s(e),o())},function(e){i===n&&(c(e),o())})}}).resultPromise=new Promise(function(e,n){s=e,c=n}),d=f,h[e]=d);var v=p.httpRequest(t,e,r,n),g=v.promise.then(function(e){if(200!==e.status)return Promise.reject(404===(n=e).status?new a(ue()):new l(ce(n.statusText||String(n.status))));if(e.header("content-type")&&"application/json"===e.header("content-type").substring(0,"application/json".length))return JSON.parse(e.body);var n,t=te(e.header("content-type")||"");return Promise.reject(new l(t))},function(e){return Promise.reject(new l(oe(e)))});return d.addPromise(g,function(){v.cancel&&v.cancel()}),d.resultPromise}return e.fetchJSON=function(e){return v(s+e,null)},e.fetchFlagSettings=function(e,n){var t,r,o,i="";return c?(r=[s,"/sdk/evalx/",u,"/user"].join(""),o=JSON.stringify(e)):(t=O(JSON.stringify(e)),r=[s,"/sdk/evalx/",u,"/users/",t].join("")),n&&(i="h="+n),f&&(i=i+(i?"&":"")+"withReasons=true"),r=r+(i?"?":"")+i,d.debug(Oe(r)),v(r,o)},e}function _e(o,i){var e={};return e.validateUser=function(e){if(!e)return Promise.reject(new u(le()));var r=P(e);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(o?o.get("ld:$anonUserId").catch(function(){return null}):Promise.resolve(null)).then(function(e){if(e)return r.key=e,r;var n,t=H();return r.key=t,(n=t,o?o.set("ld:$anonUserId",n).catch(function(){i.warn("localStorage is unavailable, so anonymous user ID cannot be cached")}):Promise.resolve()).then(function(){return r})}):Promise.reject(new u(fe()))},e}var Je={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},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}};function ze(n,t,r,o){var a=L({logger:{default:o}},Je,r),i={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function u(e){I(function(){t&&t.maybeReportError(new c(e))})}var s,l,f,d,v=L({},n||{});return d=v,Object.keys(i).forEach(function(e){if(void 0!==d[e]){var n=i[e];o&&o.warn(ge(e,n)),n&&(void 0===d[n]&&(d[n]=d[e]),delete d[e])}}),f=L({},v),Object.keys(a).forEach(function(e){void 0!==f[e]&&null!==f[e]||(f[e]=a[e]&&a[e].default)}),s=v=f,l=L({},s),Object.keys(s).forEach(function(e){var n=s[e];if(null!=n){var t=a[e];if(void 0===t)u(Ee(e));else{var r=t.type||g(t.default);if("any"!==r){var o=r.split("|"),i=g(n);o.indexOf(i)<0?"boolean"===r?(l[e]=!!n,u(De(e,i))):(u(we(e,r,i)),l[e]=t.default):"number"===i&&void 0!==t.minimum&&n<t.minimum&&(u(Se(e,n,t.minimum)),l[e]=t.minimum)}}}}),l;function g(n){if(null===n)return"any";if(void 0!==n){if(Array.isArray(n))return"array";var t=e(n);return"boolean"===t||"string"===t||"number"===t||"function"===t?t:"object"}}}var Me=Object.freeze({__proto__:null,baseOptionDefs:Je,validate:ze}).baseOptionDefs,Ke=function(e){var n={diagnosticId:H()};return e&&(n.sdkKeySuffix=6<e.length?e.substring(e.length-6):e),n},Be=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){var r={timestamp:e,failed:n,durationMillis:t};o.push(r)},reset:i}},$e=function(o,e,n,t,i,a){var u,s,c=!!o.diagnosticUseCombinedEvent,l="ld:"+t+":$diagnostics",f=i.eventsUrl+"/events/diagnostic/"+t,d=i.diagnosticRecordingInterval,v=e,g=!!i.streaming,p={};function m(){return{sdk:function(){var e=r({},o.diagnosticSdkData);return i.wrapperName&&(e.wrapperName=i.wrapperName),i.wrapperVersion&&(e.wrapperVersion=i.wrapperVersion),e}(),configuration:(e={customBaseURI:i.baseUrl!==Me.baseUrl.default,customStreamURI:i.streamUrl!==Me.streamUrl.default,customEventsURI:i.eventsUrl!==Me.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,allowFrequentDuplicateEvents:!!i.allowFrequentDuplicateEvents,sendEventsOnlyForVariation:!!i.sendEventsOnlyForVariation,autoAliasingOptOut:!!i.autoAliasingOptOut},e),platform:o.diagnosticPlatformData};var e}function h(e){i.logger&&i.logger.debug(Ce.debugPostingDiagnosticEvent(e)),n.sendEvents(e,f,!0).then(function(){}).catch(function(){})}function y(){var e,n;h((e=(new Date).getTime(),n=r({kind:c?"diagnostic-combined":"diagnostic",id:a,creationDate:e},v.getProps()),c&&(n=r({},n,{},m())),v.reset(e),n)),s=setTimeout(y,d),u=(new Date).getTime(),c&&function(){if(o.localStorage){var e=r({},v.getProps());o.localStorage.set(l,JSON.stringify(e),function(){})}}()}return p.start=function(){c?function(t){if(!o.localStorage)return t(!1);o.localStorage.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)})}(function(e){if(e){var n=(u||0)+d,t=(new Date).getTime();n<=t?y():s=setTimeout(y,n-t)}else 0===Math.floor(4*Math.random())?y():s=setTimeout(y,d)}):(h(r({kind:"diagnostic-init",id:a,creationDate:v.getProps().dataSinceDate},m())),s=setTimeout(y,d))},p.stop=function(){s&&clearTimeout(s)},p.setStreaming=function(e){g=e},p};function He(e,n){var i,a=["debug","info","warn","error"];i=null!=n?""===n?"":n+" ":"LD: ";var u=0;e&&(u="none"===e?100:a.indexOf(e));var t={};function r(e,n,t){if(u<=e&&console){var r=console[n];if(r){var o=e<a.length?a[e]:"?";r.call(console,i+"["+o+"] "+t)}}}return t.debug=function(e){return r(0,"log",e)},t.info=function(e){return r(1,"info",e)},t.warn=function(e){return r(2,"warn",e)},t.error=function(e){return r(3,"error",e)},t}function Ge(n,t,i,u,c){var d,v,g,p,m,h,y=i&&i.logger?i.logger:c&&c.logger&&c.logger.default||He("warn"),w=Le(y),b=Ae(w),k=ze(i,w,c,y),E=k.sendEvents,S=n,O=k.hash,D=G(u,S,k),R=k.sendEvents&&!k.diagnosticOptOut,N=R?Ke(S):null,C=R?Be((new Date).getTime()):null,F=R?$e(u,C,D,S,k,N):null,q=Ve(u,k,S,C),_=k.eventProcessor||function(e,n,t,r,i,a){var u,s=3<arguments.length&&void 0!==r?r:null,c=4<arguments.length&&void 0!==i?i:null,l={},d=(5<arguments.length&&void 0!==a?a:null)||G(e,t,n),v=n.eventsUrl+"/events/bulk/"+t,g=X(),p=W(n),m=n.inlineUsersInEvents,h=n.samplingInterval,y=n.eventCapacity,w=n.flushInterval,b=n.logger,k=[],E=0,S=!1,O=!1;function P(){return 0===h||0===Math.floor(Math.random()*h)}function D(e){k.length<y?(k.push(e),O=!1):(O||(O=!0,b.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),s&&s.incrementDroppedEvents())}return l.enqueue=function(e){if(!S){var n=!1,t=!1;if(g.summarizeEvent(e),"feature"===e.kind?P()&&(n=!!e.trackEvents,t=function(e){return!!e.debugEventsUntilDate&&e.debugEventsUntilDate>E&&e.debugEventsUntilDate>(new Date).getTime()}(e)):n=P(),n&&D(function(e){var n=L({},e);return"alias"===e.kind||(m||"identify"===e.kind?n.user=p.filterUser(e.user):(n.userKey=e.user.key,delete n.user),"feature"===e.kind&&(delete n.trackEvents,delete n.debugEventsUntilDate)),n}(e)),t){var r=L({},e,{kind:"debug"});r.user=p.filterUser(r.user),delete r.trackEvents,delete r.debugEventsUntilDate,D(r)}}},l.flush=function(){if(S)return Promise.resolve();var e=k,n=g.getSummary();return g.clearSummary(),n&&(n.kind="summary",e.push(n)),s&&s.setEventsInLastBatch(e.length),0===e.length?Promise.resolve():(k=[],b.debug(Fe(e.length)),d.sendEvents(e,v).then(function(e){e&&(e.serverTime&&(E=e.serverTime),f(e.status)||(S=!0),400<=e.status&&I(function(){c.maybeReportError(new o(me(e.status,"event posting","some events were dropped")))}))}))},l.start=function(){u=setTimeout(function e(){l.flush(),u=setTimeout(e,w)},w)},l.stop=function(){clearTimeout(u)},l}(u,k,S,C,w,D),z=qe(u,k,S),M={},J={},V=k.streaming,H=!1,K=!1,$=!0,B=k.stateProvider,Z=(m=function(e,n){var t;t=e,B||t&&Y({kind:"identify",key:t.key,user:t,creationDate:(new Date).getTime()}),!k.autoAliasingOptOut&&n&&n.anonymous&&e&&!e.anonymous&&oe(e,n)},{setUser:function(e){var n=h&&P(h);(h=x(e))&&m&&m(P(h),n)},getUser:function(){return h?P(h):null}}),Q=_e(u.localStorage,y);function Y(e){if(S&&!(B&&B.enqueueEvent&&B.enqueueEvent(e))){if("alias"!==e.kind){if(!e.user)return void($&&(y.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"),$=!1));$=!1}!E||K||u.isDoNotTrack()||(y.debug(Ne(e.kind)),_.enqueue(e))}}function ee(e,n,t,r){var o=Z.getUser(),i=new Date,a=n?n.value:null;if(!k.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,s=M[u];if(s&&i-s<3e5)return;M[u]=i}var c={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()};o&&o.anonymous&&(c.contextKind=re(o));var l=J[e];l&&(c.version=l.flagVersion?l.flagVersion:l.version,c.trackEvents=l.trackEvents,c.debugEventsUntilDate=l.debugEventsUntilDate),(r||l&&l.trackReason)&&n&&(c.reason=n.reason),Y(c)}function ne(e,n,t,r){var o;if(J&&A(J,e)&&J[e]&&!J[e].deleted){var i=J[e];o=te(i),null!==i.value&&void 0!==i.value||(o.value=n)}else o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&ee(e,o,n,r),o}function te(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function re(e){return e.anonymous?"anonymousUser":"user"}function oe(e,n){B||e&&n&&Y({kind:"alias",key:e.key,contextKind:re(e),previousKey:n.key,previousContextKind:re(n),creationDate:(new Date).getTime()})}function ie(){v=!0,Z.getUser()&&q.connect(Z.getUser(),O,{ping:function(){y.debug("received ping message from stream");var n=Z.getUser();z.fetchFlagSettings(n,O).then(function(e){U(n,Z.getUser())&&le(e||{})}).catch(function(e){w.maybeReportError(new l(ce(e)))})},put:function(e){var n=JSON.parse(e.data);y.debug("received streaming update for all flags"),le(n)},patch:function(e){var n=JSON.parse(e.data),t=J[n.key];if(!t||!t.version||!n.version||t.version<n.version){y.debug(Ie(n.key));var r={},o=L({},n);delete o.key;var i=te(J[n.key]=o);r[n.key]=t?{previous:t.value,current:i}:{current:i},fe(r)}else y.debug(je(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!J[n.key]||J[n.key].version<n.version){y.debug(Re(n.key));var t={};J[n.key]&&!J[n.key].deleted&&(t[n.key]={previous:J[n.key].value}),J[n.key]={version:n.version,deleted:!0},fe(t)}else y.debug(Te(n.key))}})}function ue(){v&&(q.disconnect(),v=!1)}function le(e){var n={};if(!e)return Promise.resolve();for(var t in J)A(J,t)&&J[t]&&(e[t]&&!U(e[t].value,J[t].value)?n[t]={previous:J[t].value,current:te(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:J[t].value}));for(var o in e)A(e,o)&&e[o]&&(!J[o]||J[o].deleted)&&(n[o]={current:te(e[o])});return J=r({},e),fe(n).catch(function(){})}function fe(o){var e=Object.keys(o);if(0<e.length){var i={};e.forEach(function(e){var n=o[e].current,t=n?n.value:void 0,r=o[e].previous;w.emit("change:"+e,t,r),i[e]=n?{current:t,previous:r}:{previous:r}}),w.emit("change",i),w.emit("internal-change",J),k.sendEventsOnlyForVariation||B||e.forEach(function(e){ee(e,o[e].current)})}return d&&p?p.saveFlags(J).catch(function(){return null}):Promise.resolve()}function de(){var e=V||g&&void 0===V;e&&!v?ie():!e&&v&&ue(),F&&F.setStreaming(e)}function ge(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}if(u.localStorage&&(p=new xe(u.localStorage,S,O,Z,y)),"string"==typeof k.bootstrap&&"LOCALSTORAGE"===k.bootstrap.toUpperCase()&&(p?d=!0:y.warn("localStorage is unavailable")),"object"===e(k.bootstrap)&&(J=function(t){var e=Object.keys(t),r=t.$flagsState;!r&&e.length&&y.warn(ve()),!1===t.$valid&&y.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var o={};return e.forEach(function(e){if("$flagsState"!==e&&"$valid"!==e){var n={value:t[e]};r&&r[e]?n=L(n,r[e]):n.version=0,o[e]=n}}),o}(k.bootstrap)),B){var pe=B.getInitialState();pe?he(pe):B.on("init",he),B.on("update",function(e){e.user&&Z.setUser(e.user),e.flags&&le(e.flags)})}else(n?Q.validateUser(t).then(function(n){return Z.setUser(n),"object"===e(k.bootstrap)?ye():d?p.loadFlags().catch(function(){return null}).then(function(e){return null==e?(J={},z.fetchFlagSettings(Z.getUser(),O).then(function(e){return le(e||{})}).then(ye).catch(function(e){we(new l(ce(e)))})):(J=e,I(ye),z.fetchFlagSettings(Z.getUser(),O).then(function(e){return le(e)}).catch(function(e){return w.maybeReportError(e)}))}):z.fetchFlagSettings(Z.getUser(),O).then(function(e){J=e||{},ye()}).catch(function(e){J={},we(e)})}):Promise.reject(new a(se()))).catch(we);function he(e){S=e.environment,Z.setUser(e.user),J=r({},e.flags),I(ye)}function ye(){y.info("LaunchDarkly client initialized"),H=!0,de(),b.signalSuccess()}function we(e){b.signalFailure(e)}return{client:{waitForInitialization:function(){return b.getInitializationPromise()},waitUntilReady:function(){return b.getReadyPromise()},identify:function(e,r,n){return K?j(Promise.resolve({}),n):B?(y.warn("identify() has no effect here; it must be called on the main client instance"),j(Promise.resolve(T(J)),n)):j((d&&p?p.clearFlags():Promise.resolve()).then(function(){return Q.validateUser(e)}).then(function(t){return z.fetchFlagSettings(t,r).then(function(e){var n=T(e);return Z.setUser(t),O=r,e?le(e).then(function(){return n}):n})}).then(function(e){return v&&ie(),e}).catch(function(e){return w.maybeReportError(e),Promise.reject(e)}),n)},getUser:function(){return Z.getUser()},variation:function(e,n){return ne(e,n,!0,!1).value},variationDetail:function(e,n){return ne(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){u.customEventFilter&&!u.customEventFilter(e)&&y.warn(ae(e));var r=Z.getUser(),o={kind:"custom",key:e,user:r,url:u.getCurrentUrl(),creationDate:(new Date).getTime()};r&&r.anonymous&&(o.contextKind=re(r)),null!=n&&(o.data=n),null!=t&&(o.metricValue=t),Y(o)}else w.maybeReportError(new s(ae(e)))},alias:oe,on:function(e,n,t){ge(e)?(g=!0,H&&de(),w.on(e,n,t)):w.on.apply(w,arguments)},off:function(e){if(w.off.apply(w,arguments),ge(e)){var n=!1;w.getEvents().forEach(function(e){ge(e)&&0<w.getEventListenerCount(e)&&(n=!0)}),n||(g=!1,v&&void 0===V&&ue())}},setStreaming:function(e){var n=null===e?void 0:e;n!==V&&(V=n,de())},flush:function(e){return j(E?_.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!J)return e;for(var n in J)A(J,n)&&(e[n]=ne(n,null,!k.sendEventsOnlyForVariation).value);return e},close:function(e){if(K)return j(Promise.resolve(),e);function n(){K=!0,J={}}return j(Promise.resolve().then(function(){if(ue(),F&&F.stop(),E)return _.stop(),_.flush()}).then(n).catch(n),e)}},options:k,emitter:w,ident:Z,logger:y,requestor:z,start:function(){E&&(F&&F.start(),_.start())},enqueueEvent:Y,getFlagsInternal:function(){return J},getEnvironmentId:function(){return S},internalChangeEventName:"internal-change"}}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 ownKeys(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}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 isSyncXhrSupported(){var e=window.navigator&&window.navigator.userAgent;if(e){var n=e.match(/Chrom(e|ium)\/([0-9]+)\./);if(n)return parseInt(n[2],10)<73}return!0}var emptyResult={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function newHttpRequest(e,n,t,r,o){if(o&&!isSyncXhrSupported())return emptyResult;var i=new window.XMLHttpRequest;for(var a in i.open(e,n,!o),t||{})Object.prototype.hasOwnProperty.call(t,a)&&i.setRequestHeader(a,t[a]);if(o)return i.send(r),emptyResult;var u;return{promise:new Promise(function(e,n){i.addEventListener("load",function(){u||e({status:i.status,header:function(e){return i.getResponseHeader(e)},body:i.responseText})}),i.addEventListener("error",function(){u||n(new Error)}),i.send(r)}),cancel:function(){u=!0,i.abort()}}}function makeBrowserPlatform(e){var n,i={synchronousFlush:!1};if(window.XMLHttpRequest){var a=e&&e.disableSyncEventPost;i.httpRequest=function(e,n,t,r){var o=i.synchronousFlush&!a;return i.synchronousFlush=!1,newHttpRequest(e,n,t,r,o)}}i.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},i.httpFallbackPing=function(e){(new window.Image).src=e};var r,t=e&&e.eventUrlTransformer;i.getCurrentUrl=function(){return t?t(window.location.href):window.location.href},i.isDoNotTrack=function(){var e;return 1===(e=window.navigator&&void 0!==window.navigator.doNotTrack?window.navigator.doNotTrack:window.navigator&&void 0!==window.navigator.msDoNotTrack?window.navigator.msDoNotTrack:window.doNotTrack)||!0===e||"1"===e||"yes"===e};try{window.localStorage&&(i.localStorage={get:function(n){return new Promise(function(e){e(window.localStorage.getItem(n))})},set:function(n,t){return new Promise(function(e){window.localStorage.setItem(n,t),e()})},clear:function(n){return new Promise(function(e){window.localStorage.removeItem(n),e()})}})}catch(e){i.localStorage=null}var o=e&&e.useReport;if(r=o&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(i.eventSourceAllowsReport=!0,window.EventSourcePolyfill):(i.eventSourceAllowsReport=!1,window.EventSource),window.EventSource){i.eventSourceFactory=function(e,n){var t=_objectSpread2(_objectSpread2({},{heartbeatTimeout:3e5,silentTimeout:3e5,skipDefaultHeaders:!0}),n);return new r(e,t)},i.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return i.userAgent="JSClient",i.version="2.19.4",i.diagnosticSdkData={name:"js-client-sdk",version:"2.19.4"},i.diagnosticPlatformData={name:"JS"},i.diagnosticUseCombinedEvent=!0,i}var matchOperatorsRe=/[|\\{}()[\]^$+*?.]/g,escapeStringRegexp=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(matchOperatorsRe,"\\$&")};function doesUrlMatch(e,n,t,r){var o,i,a=(("substring"===e.kind||"regex"===e.kind)&&r.includes("/")?n:n.replace(r,"")).replace(t,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+escapeStringRegexp(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+escapeStringRegexp(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+escapeStringRegexp(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function findGoalsForClick(e,n){for(var t=[],r=0;r<n.length;r++)for(var o=e.target,i=n[r],a=i.selector,u=document.querySelectorAll(a);o&&0<u.length;){for(var s=0;s<u.length;s++)o===u[s]&&t.push(i);o=o.parentNode}return t}function GoalTracker(e,r){for(var n={},t=null,o=[],i=0;i<e.length;i++)for(var a=e[i],u=a.urls||[],s=0;s<u.length;s++)if(doesUrlMatch(u[s],window.location.href,window.location.search,window.location.hash)){"pageview"===a.kind?r("pageview",a):(o.push(a),r("click_pageview",a));break}return 0<o.length&&(t=function(e){for(var n=findGoalsForClick(e,o),t=0;t<n.length;t++)r("click",n[t])},document.addEventListener("click",t)),n.dispose=function(){document.removeEventListener("click",t)},n}var locationWatcherInterval=300;function GoalManager(o,n){var t,r;function i(){r&&r.dispose(),t&&t.length&&(r=GoalTracker(t,a))}function a(e,n){var t=o.ident.getUser(),r={kind:e,key:n.key,data:null,url:window.location.href,user:t,creationDate:(new Date).getTime()};return t&&t.anonymous&&(r.contextKind="anonymousUser"),"click"===e&&(r.selector=n.selector),o.enqueueEvent(r)}function u(e,n){var t,r=window.location.href;function o(){(t=window.location.href)!==r&&(r=t,n())}!function e(n,t){n(),setTimeout(function(){e(n,t)},t)}(o,e),window.history&&window.history.pushState?window.addEventListener("popstate",o):window.addEventListener("hashchange",o)}return o.requestor.fetchJSON("/sdk/goals/"+o.getEnvironmentId()).then(function(e){e&&0<e.length&&(r=GoalTracker(t=e,a),u(locationWatcherInterval,i)),n()}).catch(function(e){o.emitter.maybeReportError(new v.LDUnexpectedResponseError((e&&e.message,e.message))),n()}),{}}var goalsEvent="goalsReady",extraOptionDefs={fetchGoals:{default:!0},hash:{type:"string"},eventProcessor:{type:"object"},eventUrlTransformer:{type:"function"},disableSyncEventPost:{default:!1}};function initialize(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=makeBrowserPlatform(t),o=Ge(e,n,t,r,extraOptionDefs),i=o.client,a=o.options,u=o.emitter,s=new Promise(function(e){var n=u.on(goalsEvent,function(){u.off(goalsEvent,n),e()})});i.waitUntilGoalsReady=function(){return s},a.fetchGoals?GoalManager(o,function(){return u.emit(goalsEvent)}):u.emit(goalsEvent),"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();function c(){r.synchronousFlush=!0,i.flush().catch(function(){}),r.synchronousFlush=!1}return window.addEventListener("beforeunload",c),window.addEventListener("unload",c),i}var createConsoleLogger=He,version="2.19.4";function deprecatedInitialize(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(Ce.deprecated("default export","named LDClient export")),initialize(e,n,t)}var index={initialize:deprecatedInitialize,version:version};exports.createConsoleLogger=createConsoleLogger,exports.default=index,exports.initialize=initialize,exports.version=version;
"use strict";function e(n){return(e="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})(n)}function n(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function t(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function r(r){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?t(o,!0).forEach(function(e){n(r,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(o).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})}return r}function i(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 a=i("LaunchDarklyUnexpectedResponseError"),o=i("LaunchDarklyInvalidEnvironmentIdError"),u=i("LaunchDarklyInvalidUserError"),s=i("LaunchDarklyInvalidEventKeyError"),c=i("LaunchDarklyInvalidArgumentError"),l=i("LaunchDarklyFlagFetchError");function f(e){return!(400<=e&&e<500)||400===e||408===e||429===e}for(var v=Object.freeze({__proto__:null,LDUnexpectedResponseError:a,LDInvalidEnvironmentIdError:o,LDInvalidUserError:u,LDInvalidEventKeyError:s,LDInvalidArgumentError:c,LDFlagFetchError:l,isHttpErrorRecoverable:f}),d=function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(b(e,i,a<i+16383?a:i+16383));return 1==r?(n=e[t-1],o.push(g[n>>2]+g[n<<4&63]+"==")):2==r&&(n=(e[t-2]<<8)+e[t-1],o.push(g[n>>10]+g[n>>4&63]+g[n<<2&63]+"=")),o.join("")},g=[],p=[],m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,y=m.length;h<y;++h)g[h]=m[h],p[m.charCodeAt(h)]=h;function b(e,n,t){for(var r,o,i=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(g[(o=r)>>18&63]+g[o>>12&63]+g[o>>6&63]+g[63&o]);return i.join("")}p["-".charCodeAt(0)]=62,p["_".charCodeAt(0)]=63;var k=Array.isArray,E=Object.keys,w=Object.prototype.hasOwnProperty,D=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function S(e){var n=unescape(encodeURIComponent(e));return d(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(n))}function U(e){return S(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function O(e){return JSON.parse(JSON.stringify(e))}function P(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,o,i,a=k(n),u=k(t);if(a&&u){if((o=n.length)!=t.length)return!1;for(r=o;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 d=E(n);if((o=d.length)!==E(t).length)return!1;for(r=o;0!=r--;)if(!w.call(t,d[r]))return!1;for(r=o;0!=r--;)if(!e(n[i=d[r]],t[i]))return!1;return!0}return n!=n&&t!=t}(e,n)}function I(e){setTimeout(e,0)}function j(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 R(e){var n={};for(var t in e)x(e,t)&&(n[t]={value:e[t],version:0});return n}function T(e){var n={};for(var t in e)x(e,t)&&(n[t]=e[t].value);return n}function A(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-=U(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.4.0-alpha.1";return e.userAgent+"/"+n}function C(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":N(e)};return n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t}function F(e,n){return n&&n.requestHeaderTransform?n.requestHeaderTransform(r({},e)):e}function L(){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 r({},e,{},n)},{})}function x(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function q(e){if(!e)return e;var n;for(var t in D){var o=D[t],i=e[o];void 0!==i&&"string"!=typeof i&&((n=n||r({},e))[o]=String(i))}return n||e}var _=Object.freeze({__proto__:null,btoa:S,base64URLEncode:U,clone:O,deepEquals:P,onNextTick:I,wrapPromiseCallback:j,transformValuesToVersionedValues:R,transformVersionedValuesToValues:T,chunkUserEventsForUrl:A,getLDUserAgentString:N,getLDHeaders:C,transformHeaders:F,extend:L,objectHasOwnProperty:x,sanitizeUser:q}),V=require("uuid").v1;function z(u,e,s){var t="/a/"+e+".gif",c=L({"Content-Type":"application/json"},C(u,s)),l=u.httpFallbackPing,d={sendChunk:function(e,r,o,n){var i=JSON.stringify(e),a=o?null:V();return n?function n(t){var e=o?c:L({},c,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":a});return u.httpRequest("POST",r,F(e,s),i).promise.then(function(e){if(e)return 400<=e.status&&f(e.status)&&t?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 t?n(!1):Promise.reject()})}(!0).catch(function(){}):(l&&l(r+t+"?d="+U(i)),Promise.resolve())},sendEvents:function(e,n,t){if(!u.httpRequest)return Promise.resolve();var r,o=u.httpAllowsPost();r=o?[e]:A(2e3-n.length,e);for(var i=[],a=0;a<r.length;a++)i.push(d.sendChunk(r[a],n,t,o));return Promise.all(i)}};return d}function J(){var e={},a=0,u=0,s={};return e.summarizeEvent=function(e){if("feature"===e.kind){var 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?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)}},e.getSummary=function(){var e={},n=!0;for(var t in s){var r=s[t],o=e[r.key];o||(o={default:r.default,counters:[]},e[r.key]=o);var i={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:u,features:e}},e.clearSummary=function(){u=a=0,s={}},e}function M(e){var n={},s=e.allAttributesPrivate,c=e.privateAttributeNames||[],l={key:!0,custom:!0,anonymous:!0},f={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;function n(o,i){return Object.keys(o).reduce(function(e,n){var t,r=e;return i(n)&&(l[t=n]||!s&&-1===a.indexOf(t)&&-1===c.indexOf(t)?r[0][n]=o[n]:r[1][n]=!0),r},[{},{}])}var a=e.privateAttributeNames||[],t=n(e,function(e){return f[e]}),r=t[0],o=t[1];if(e.custom){var i=n(e.custom,function(){return!0});r.custom=i[0],o=L({},o,i[1])}var u=Object.keys(o);return u.length&&(u.sort(),r.privateAttrs=u),r},n}function K(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var H=function(){return"LaunchDarkly client initialized"},$=" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initializing-the-client for instructions on SDK initialization.",B=function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},G=function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"},X=function(e){return'Expected application/json content type but got "'+e+'"'},W=function(){return"localStorage is unavailable"},Q=function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},Y=function(e){return"network error"+(e?" ("+e+")":"")},Z=function(e){return'Custom event "'+e+'" does not exist'},ee=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+$},ne=function(){return"No environment/client-side ID was specified."+$},te=function(e){return"Error fetching flag settings: "+K(e)},re=function(){return"No user specified."+$},ie=function(){return"Invalid user specified."+$},ae=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+$},oe=function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},ue=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},se=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(f(e)?t:"giving up permanently")},ce=function(){return"Cannot make HTTP requests in this environment."+$},le=function(){return"identify() has no effect here; it must be called on the main client instance"},fe=function(){return"Closing stream connection"},ve=function(e){return"Opening stream connection to "+e},de=function(e,n){return"Error on stream connection: "+K(e)+", will continue retrying every "+n+" milliseconds."},ge=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"},me=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},he=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},ye=function(e){return"polling for feature flags at "+e},be=function(){return"received ping message from stream"},ke=function(){return"received streaming update for all flags"},Ee=function(e){return'received streaming update for flag "'+e+'"'},we=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},De=function(e){return'received streaming deletion for flag "'+e+'"'},Se=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},Ue=function(e){return'enqueueing "'+e+'" event'},Oe=function(e){return"sending "+e+" events"},Pe=Object.freeze({__proto__:null,clientInitialized:H,clientNotReady:function(){return"LaunchDarkly client is not ready"},eventCapacityExceeded:B,eventWithoutUser:G,invalidContentType:X,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:W,localStorageUnavailableForUserId:Q,networkError:Y,unknownCustomEventKey:Z,environmentNotFound:ee,environmentNotSpecified:ne,errorFetchingFlags:te,userNotSpecified:re,invalidUser:ie,bootstrapOldFormat:ae,bootstrapInvalid:oe,deprecated:ue,httpErrorMessage:se,httpUnavailable:ce,identifyDisabled:le,streamClosing:fe,streamConnecting:ve,streamError:de,unknownOption:ge,wrongOptionType:pe,wrongOptionTypeBoolean:me,optionBelowMinimum:he,debugPolling:ye,debugStreamPing:be,debugStreamPut:ke,debugStreamPatch:Ee,debugStreamPatchIgnored:we,debugStreamDelete:De,debugStreamDeleteIgnored:Se,debugEnqueueingEvent:Ue,debugPostingEvents:Oe,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"}});function Ie(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 je=function(r){var n=!1,t=!1,o=null,e=null,i=new Promise(function(n){r.on("ready",function e(){r.off("ready",e),n()})}).catch(function(){});return{getInitializationPromise:function(){return e||(n?Promise.resolve():t?Promise.reject(o):e=new Promise(function(n,t){r.on("initialized",function e(){r.off("initialized",e),n()}),r.on("failed",function e(n){r.off("failed",e),t(n)})}))},getReadyPromise:function(){return i},signalSuccess:function(){n||t||(n=!0,r.emit("initialized"),r.emit("ready"))},signalFailure:function(e){n||t||(t=!0,o=e,r.emit("failed",e),r.emit("ready")),r.maybeReportError(e)}}};function Re(t,r,o,i,a){var u={};function s(){var e="",n=i.getUser();return n&&(e=o||S(JSON.stringify(n))),"ld:"+r+":"+e}return u.loadFlags=function(){return t.get(s()).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=R(n):delete n.$schema}return n}catch(e){return u.clearFlags().then(function(){return Promise.reject(e)})}}).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.saveFlags=function(e){var n=L({},e,{$schema:1});return t.set(s(),JSON.stringify(n)).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.clearFlags=function(){return t.clear(s()).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u}function Te(o,i,a,n){var u,s=i.streamUrl,c=i.logger,e={},l=s+"/eval/"+a,f=i.useReport,d=i.evaluationReasons,t=i.streamReconnectDelay,v=C(o,i),g=!1,p=null,m=null,h=null,y=null,w=null;function b(e){g||(c.warn(de(e,t)),g=!0),S(!1),E(),k(t)}function k(e){m||(e?m=setTimeout(r,e):r())}function r(){var e;m=null;var n="",t={headers:v,readTimeoutMillis:3e5};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=s+"/ping/"+a,n=""):e=l+"/"+U(JSON.stringify(h)),t.headers=F(t.headers,i),d&&(n=n+(n?"&":"")+"withReasons=true"),e=e+(n?"?":"")+n,E(),c.info(ve(e)),u=(new Date).getTime(),p=o.eventSourceFactory(e,t),w)x(w,r)&&p.addEventListener(r,w[r]);p.onerror=b}}function E(){p&&(c.info("Closing stream connection"),p.close(),p=null)}function S(e){u&&n&&n.recordStreamInit(u,!e,(new Date).getTime()-u),u=null}return e.connect=function(e,n,t){h=e,y=n,w={};function r(n){w[n]=function(e){S(!(g=!1)),t[n]&&t[n](e)}}for(var o in t||{})r(o);k()},e.disconnect=function(){clearTimeout(m),m=null,E()},e.isConnected=function(){return!!(p&&o.eventSourceIsActive&&o.eventSourceIsActive(p))},e}function Ae(p,m,a){var u=m.baseUrl,s=m.useReport,c=m.evaluationReasons,f=m.logger,e={},h={};function d(e,n){if(!p.httpRequest)return new Promise(function(e,n){n(new l(ce()))});var t=n?"REPORT":"GET",r=C(p,m);n&&(r["Content-Type"]="application/json");var i,a,u,s,c,f,d=h[e];d||(i=function(){delete h[e]},(f={addPromise:function(n,e){a=n,u&&u(),u=e,n.then(function(e){a===n&&(s(e),i())},function(e){a===n&&(c(e),i())})}}).resultPromise=new Promise(function(e,n){s=e,c=n}),d=f,h[e]=d);var v=p.httpRequest(t,e,F(r,m),n),g=v.promise.then(function(e){if(200!==e.status)return Promise.reject(404===(n=e).status?new o(ee()):new l(te(n.statusText||String(n.status))));if(e.header("content-type")&&"application/json"===e.header("content-type").substring(0,"application/json".length))return JSON.parse(e.body);var n,t=X(e.header("content-type")||"");return Promise.reject(new l(t))},function(e){return Promise.reject(new l(Y(e)))});return d.addPromise(g,function(){v.cancel&&v.cancel()}),d.resultPromise}return e.fetchJSON=function(e){return d(u+e,null)},e.fetchFlagSettings=function(e,n){var t,r,o,i="";return s?(r=[u,"/sdk/evalx/",a,"/user"].join(""),o=JSON.stringify(e)):(t=U(JSON.stringify(e)),r=[u,"/sdk/evalx/",a,"/users/",t].join("")),n&&(i="h="+n),c&&(i=i+(i?"&":"")+"withReasons=true"),r=r+(i?"?":"")+i,f.debug(ye(r)),d(r,o)},e}var Ne=require("uuid").v1;function Ce(o,i){var e={};return e.validateUser=function(e){if(!e)return Promise.reject(new u(re()));var r=O(e);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(o?o.get("ld:$anonUserId").catch(function(){return null}):Promise.resolve(null)).then(function(e){if(e)return r.key=e,r;var n,t=Ne();return r.key=t,(n=t,o?o.set("ld:$anonUserId",n).catch(function(){i.warn("localStorage is unavailable, so anonymous user ID cannot be cached")}):Promise.resolve()).then(function(){return r})}):Promise.reject(new u(ie()))},e}var Fe={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}};function Le(n,t,r,o){var a=L({logger:{default:o}},Fe,r),i={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function u(e){I(function(){t&&t.maybeReportError(new c(e))})}var s,l,f,d,v=L({},n||{});return d=v,Object.keys(i).forEach(function(e){if(void 0!==d[e]){var n=i[e];o&&o.warn(ue(e,n)),n&&(void 0===d[n]&&(d[n]=d[e]),delete d[e])}}),f=L({},v),Object.keys(a).forEach(function(e){void 0!==f[e]&&null!==f[e]||(f[e]=a[e]&&a[e].default)}),s=v=f,l=L({},s),Object.keys(s).forEach(function(e){var n=s[e];if(null!=n){var t=a[e];if(void 0===t)u(ge(e));else{var r=t.type||g(t.default);if("any"!==r){var o=r.split("|"),i=g(n);o.indexOf(i)<0?"boolean"===r?(l[e]=!!n,u(me(e,i))):(u(pe(e,r,i)),l[e]=t.default):"number"===i&&void 0!==t.minimum&&n<t.minimum&&(u(he(e,n,t.minimum)),l[e]=t.minimum)}}}}),l;function g(n){if(null===n)return"any";if(void 0!==n){if(Array.isArray(n))return"array";var t=e(n);return"boolean"===t||"string"===t||"number"===t||"function"===t?t:"object"}}}var xe,qe=Object.freeze({__proto__:null,baseOptionDefs:Fe,validate:Le}),_e=new Uint8Array(16);function Ve(){if(!xe&&!(xe="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return xe(_e)}var ze=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Je(e){return"string"==typeof e&&ze.test(e)}for(var Me,Ke,He=[],$e=0;$e<256;++$e)He.push(($e+256).toString(16).substr(1));function Be(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,t=(He[e[n+0]]+He[e[n+1]]+He[e[n+2]]+He[e[n+3]]+"-"+He[e[n+4]]+He[e[n+5]]+"-"+He[e[n+6]]+He[e[n+7]]+"-"+He[e[n+8]]+He[e[n+9]]+"-"+He[e[n+10]]+He[e[n+11]]+He[e[n+12]]+He[e[n+13]]+He[e[n+14]]+He[e[n+15]]).toLowerCase();if(!Je(t))throw TypeError("Stringified UUID is invalid");return t}var Ge=0,Xe=0;function We(e){if(!Je(e))throw TypeError("Invalid UUID");var n,t=new Uint8Array(16);return t[0]=(n=parseInt(e.slice(0,8),16))>>>24,t[1]=n>>>16&255,t[2]=n>>>8&255,t[3]=255&n,t[4]=(n=parseInt(e.slice(9,13),16))>>>8,t[5]=255&n,t[6]=(n=parseInt(e.slice(14,18),16))>>>8,t[7]=255&n,t[8]=(n=parseInt(e.slice(19,23),16))>>>8,t[9]=255&n,t[10]=(n=parseInt(e.slice(24,36),16))/1099511627776&255,t[11]=n/4294967296&255,t[12]=n>>>24&255,t[13]=n>>>16&255,t[14]=n>>>8&255,t[15]=255&n,t}function Qe(e,a,u){function n(e,n,t,r){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var n=[],t=0;t<e.length;++t)n.push(e.charCodeAt(t));return n}(e)),"string"==typeof n&&(n=We(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var o=new Uint8Array(16+e.length);if(o.set(n),o.set(e,n.length),(o=u(o))[6]=15&o[6]|a,o[8]=63&o[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=o[i];return t}return Be(o)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function Ye(e){return 14+(e+64>>>9<<4)+1}function Ze(e,n){var t=(65535&e)+(65535&n);return(e>>16)+(n>>16)+(t>>16)<<16|65535&t}function en(e,n,t,r,o,i){return Ze((a=Ze(Ze(n,e),Ze(r,i)))<<(u=o)|a>>>32-u,t);var a,u}function nn(e,n,t,r,o,i,a){return en(n&t|~n&r,e,n,o,i,a)}function tn(e,n,t,r,o,i,a){return en(n&r|t&~r,e,n,o,i,a)}function rn(e,n,t,r,o,i,a){return en(n^t^r,e,n,o,i,a)}function an(e,n,t,r,o,i,a){return en(t^(n|~r),e,n,o,i,a)}var on=Qe("v3",48,function(e){if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=new Uint8Array(n.length);for(var t=0;t<n.length;++t)e[t]=n.charCodeAt(t)}return function(e){for(var n=[],t=32*e.length,r=0;r<t;r+=8){var o=e[r>>5]>>>r%32&255,i=parseInt("0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o),16);n.push(i)}return n}(function(e,n){e[n>>5]|=128<<n%32,e[Ye(n)-1]=n;for(var t=1732584193,r=-271733879,o=-1732584194,i=271733878,a=0;a<e.length;a+=16){var u=t,s=r,c=o,l=i;r=an(r=an(r=an(r=an(r=rn(r=rn(r=rn(r=rn(r=tn(r=tn(r=tn(r=tn(r=nn(r=nn(r=nn(r=nn(r,o=nn(o,i=nn(i,t=nn(t,r,o,i,e[a],7,-680876936),r,o,e[a+1],12,-389564586),t,r,e[a+2],17,606105819),i,t,e[a+3],22,-1044525330),o=nn(o,i=nn(i,t=nn(t,r,o,i,e[a+4],7,-176418897),r,o,e[a+5],12,1200080426),t,r,e[a+6],17,-1473231341),i,t,e[a+7],22,-45705983),o=nn(o,i=nn(i,t=nn(t,r,o,i,e[a+8],7,1770035416),r,o,e[a+9],12,-1958414417),t,r,e[a+10],17,-42063),i,t,e[a+11],22,-1990404162),o=nn(o,i=nn(i,t=nn(t,r,o,i,e[a+12],7,1804603682),r,o,e[a+13],12,-40341101),t,r,e[a+14],17,-1502002290),i,t,e[a+15],22,1236535329),o=tn(o,i=tn(i,t=tn(t,r,o,i,e[a+1],5,-165796510),r,o,e[a+6],9,-1069501632),t,r,e[a+11],14,643717713),i,t,e[a],20,-373897302),o=tn(o,i=tn(i,t=tn(t,r,o,i,e[a+5],5,-701558691),r,o,e[a+10],9,38016083),t,r,e[a+15],14,-660478335),i,t,e[a+4],20,-405537848),o=tn(o,i=tn(i,t=tn(t,r,o,i,e[a+9],5,568446438),r,o,e[a+14],9,-1019803690),t,r,e[a+3],14,-187363961),i,t,e[a+8],20,1163531501),o=tn(o,i=tn(i,t=tn(t,r,o,i,e[a+13],5,-1444681467),r,o,e[a+2],9,-51403784),t,r,e[a+7],14,1735328473),i,t,e[a+12],20,-1926607734),o=rn(o,i=rn(i,t=rn(t,r,o,i,e[a+5],4,-378558),r,o,e[a+8],11,-2022574463),t,r,e[a+11],16,1839030562),i,t,e[a+14],23,-35309556),o=rn(o,i=rn(i,t=rn(t,r,o,i,e[a+1],4,-1530992060),r,o,e[a+4],11,1272893353),t,r,e[a+7],16,-155497632),i,t,e[a+10],23,-1094730640),o=rn(o,i=rn(i,t=rn(t,r,o,i,e[a+13],4,681279174),r,o,e[a],11,-358537222),t,r,e[a+3],16,-722521979),i,t,e[a+6],23,76029189),o=rn(o,i=rn(i,t=rn(t,r,o,i,e[a+9],4,-640364487),r,o,e[a+12],11,-421815835),t,r,e[a+15],16,530742520),i,t,e[a+2],23,-995338651),o=an(o,i=an(i,t=an(t,r,o,i,e[a],6,-198630844),r,o,e[a+7],10,1126891415),t,r,e[a+14],15,-1416354905),i,t,e[a+5],21,-57434055),o=an(o,i=an(i,t=an(t,r,o,i,e[a+12],6,1700485571),r,o,e[a+3],10,-1894986606),t,r,e[a+10],15,-1051523),i,t,e[a+1],21,-2054922799),o=an(o,i=an(i,t=an(t,r,o,i,e[a+8],6,1873313359),r,o,e[a+15],10,-30611744),t,r,e[a+6],15,-1560198380),i,t,e[a+13],21,1309151649),o=an(o,i=an(i,t=an(t,r,o,i,e[a+4],6,-145523070),r,o,e[a+11],10,-1120210379),t,r,e[a+2],15,718787259),i,t,e[a+9],21,-343485551),t=Ze(t,u),r=Ze(r,s),o=Ze(o,c),i=Ze(i,l)}return[t,r,o,i]}(function(e){if(0===e.length)return[];for(var n=8*e.length,t=new Uint32Array(Ye(n)),r=0;r<n;r+=8)t[r>>5]|=(255&e[r/8])<<r%32;return t}(e),8*e.length))});function un(e,n,t,r){switch(e){case 0:return n&t^~n&r;case 1:return n^t^r;case 2:return n&t^n&r^t&r;case 3:return n^t^r}}function sn(e,n){return e<<n|e>>>32-n}var cn=Qe("v5",80,function(e){var n=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=[];for(var o=0;o<r.length;++o)e.push(r.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var i=e.length/4+2,a=Math.ceil(i/16),u=new Array(a),s=0;s<a;++s){for(var c=new Uint32Array(16),l=0;l<16;++l)c[l]=e[64*s+4*l]<<24|e[64*s+4*l+1]<<16|e[64*s+4*l+2]<<8|e[64*s+4*l+3];u[s]=c}u[a-1][14]=8*(e.length-1)/Math.pow(2,32),u[a-1][14]=Math.floor(u[a-1][14]),u[a-1][15]=8*(e.length-1)&4294967295;for(var f=0;f<a;++f){for(var d=new Uint32Array(80),v=0;v<16;++v)d[v]=u[f][v];for(var g=16;g<80;++g)d[g]=sn(d[g-3]^d[g-8]^d[g-14]^d[g-16],1);for(var p=t[0],m=t[1],h=t[2],y=t[3],w=t[4],b=0;b<80;++b){var k=Math.floor(b/20),E=sn(p,5)+un(k,m,h,y)+w+n[k]+d[b]>>>0;w=y,y=h,h=sn(m,30)>>>0,m=p,p=E}t[0]=t[0]+p>>>0,t[1]=t[1]+m>>>0,t[2]=t[2]+h>>>0,t[3]=t[3]+y>>>0,t[4]=t[4]+w>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,255&t[0],t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,255&t[1],t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,255&t[2],t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,255&t[3],t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,255&t[4]]}),ln=Object.freeze({__proto__:null,v1:function(e,n,t){var r=n&&t||0,o=n||new Array(16),i=(e=e||{}).node||Me,a=void 0!==e.clockseq?e.clockseq:Ke;if(null==i||null==a){var u=e.random||(e.rng||Ve)();null==i&&(i=Me=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=Ke=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:Date.now(),c=void 0!==e.nsecs?e.nsecs:Xe+1,l=s-Ge+(c-Xe)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||Ge<s)&&void 0===e.nsecs&&(c=0),1e4<=c)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Ge=s,Ke=a;var f=(1e4*(268435455&(s+=122192928e5))+(Xe=c))%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=255&f;var d=s/4294967296*1e4&268435455;o[r++]=d>>>8&255,o[r++]=255&d,o[r++]=d>>>24&15|16,o[r++]=d>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var v=0;v<6;++v)o[r+v]=i[v];return n||Be(o)},v3:on,v4:function(e,n,t){var r=(e=e||{}).random||(e.rng||Ve)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,n){t=t||0;for(var o=0;o<16;++o)n[t+o]=r[o];return n}return Be(r)},v5:cn,NIL:"00000000-0000-0000-0000-000000000000",version:function(e){if(!Je(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)},validate:Je,stringify:Be,parse:We}).v1,fn=qe.baseOptionDefs,vn=function(e){var n={diagnosticId:ln()};return e&&(n.sdkKeySuffix=6<e.length?e.substring(e.length-6):e),n},dn=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){var r={timestamp:e,failed:n,durationMillis:t};o.push(r)},reset:i}},gn=function(o,e,n,t,i,a){var u,s,c=!!o.diagnosticUseCombinedEvent,l="ld:"+t+":$diagnostics",f=i.eventsUrl+"/events/diagnostic/"+t,d=i.diagnosticRecordingInterval,v=e,g=!!i.streaming,p={};function m(){return{sdk:function(){var e=r({},o.diagnosticSdkData);return i.wrapperName&&(e.wrapperName=i.wrapperName),i.wrapperVersion&&(e.wrapperVersion=i.wrapperVersion),e}(),configuration:(e={customBaseURI:i.baseUrl!==fn.baseUrl.default,customStreamURI:i.streamUrl!==fn.streamUrl.default,customEventsURI:i.eventsUrl!==fn.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,allowFrequentDuplicateEvents:!!i.allowFrequentDuplicateEvents,sendEventsOnlyForVariation:!!i.sendEventsOnlyForVariation,autoAliasingOptOut:!!i.autoAliasingOptOut},e),platform:o.diagnosticPlatformData};var e}function h(e){i.logger&&i.logger.debug(Pe.debugPostingDiagnosticEvent(e)),n.sendEvents(e,f,!0).then(function(){}).catch(function(){})}function y(){var e,n;h((e=(new Date).getTime(),n=r({kind:c?"diagnostic-combined":"diagnostic",id:a,creationDate:e},v.getProps()),c&&(n=r({},n,{},m())),v.reset(e),n)),s=setTimeout(y,d),u=(new Date).getTime(),c&&function(){if(o.localStorage){var e=r({},v.getProps());o.localStorage.set(l,JSON.stringify(e),function(){})}}()}return p.start=function(){c?function(t){if(!o.localStorage)return t(!1);o.localStorage.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)})}(function(e){if(e){var n=(u||0)+d,t=(new Date).getTime();n<=t?y():s=setTimeout(y,n-t)}else 0===Math.floor(4*Math.random())?y():s=setTimeout(y,d)}):(h(r({kind:"diagnostic-init",id:a,creationDate:v.getProps().dataSinceDate},m())),s=setTimeout(y,d))},p.stop=function(){s&&clearTimeout(s)},p.setStreaming=function(e){g=e},p};function pn(e,n){var i,a=["debug","info","warn","error"];i=null!=n?""===n?"":n+" ":"LD: ";var u=0;e&&(u="none"===e?100:a.indexOf(e));var t={};function r(e,n,t){if(u<=e&&console){var r=console[n];if(r){var o=e<a.length?a[e]:"?";r.call(console,i+"["+o+"] "+t)}}}return t.debug=function(e){return r(0,"log",e)},t.info=function(e){return r(1,"info",e)},t.warn=function(e){return r(2,"warn",e)},t.error=function(e){return r(3,"error",e)},t}function mn(n,t,i,u,c){var d,v,g,p,m,h,y=i&&i.logger?i.logger:c&&c.logger&&c.logger.default||pn("warn"),w=Ie(y),b=je(w),k=Le(i,w,c,y),E=k.sendEvents,S=n,D=k.hash,U=z(u,S,k),R=k.sendEvents&&!k.diagnosticOptOut,C=R?vn(S):null,N=R?dn((new Date).getTime()):null,A=R?gn(u,N,U,S,k,C):null,F=Te(u,k,S,N),H=k.eventProcessor||function(e,n,t,r,o,i){var u,s=3<arguments.length&&void 0!==r?r:null,c=4<arguments.length&&void 0!==o?o:null,l={},d=(5<arguments.length&&void 0!==i?i:null)||z(e,t,n),v=n.eventsUrl+"/events/bulk/"+t,g=J(),p=M(n),m=n.inlineUsersInEvents,h=n.samplingInterval,y=n.eventCapacity,w=n.flushInterval,b=n.logger,k=[],E=0,S=!1,O=!1;function D(){return 0===h||0===Math.floor(Math.random()*h)}function P(e){k.length<y?(k.push(e),O=!1):(O||(O=!0,b.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),s&&s.incrementDroppedEvents())}return l.enqueue=function(e){if(!S){var n=!1,t=!1;if(g.summarizeEvent(e),"feature"===e.kind?D()&&(n=!!e.trackEvents,t=function(e){return!!e.debugEventsUntilDate&&e.debugEventsUntilDate>E&&e.debugEventsUntilDate>(new Date).getTime()}(e)):n=D(),n&&P(function(e){var n=L({},e);return"alias"===e.kind||(m||"identify"===e.kind?n.user=p.filterUser(e.user):(n.userKey=e.user.key,delete n.user),"feature"===e.kind&&(delete n.trackEvents,delete n.debugEventsUntilDate)),n}(e)),t){var r=L({},e,{kind:"debug"});r.user=p.filterUser(r.user),delete r.trackEvents,delete r.debugEventsUntilDate,P(r)}}},l.flush=function(){if(S)return Promise.resolve();var e=k,n=g.getSummary();return g.clearSummary(),n&&(n.kind="summary",e.push(n)),s&&s.setEventsInLastBatch(e.length),0===e.length?Promise.resolve():(k=[],b.debug(Oe(e.length)),d.sendEvents(e,v).then(function(e){e&&(e.serverTime&&(E=e.serverTime),f(e.status)||(S=!0),400<=e.status&&I(function(){c.maybeReportError(new a(se(e.status,"event posting","some events were dropped")))}))}))},l.start=function(){u=setTimeout(function e(){l.flush(),u=setTimeout(e,w)},w)},l.stop=function(){clearTimeout(u)},l}(u,k,S,N,w,U),_=Ae(u,k,S),V={},$={},K=k.streaming,G=!1,B=!1,X=!0,W=k.stateProvider,Y=(m=function(e,n){var t;t=e,W||t&&ee({kind:"identify",key:t.key,user:t,creationDate:(new Date).getTime()}),!k.autoAliasingOptOut&&n&&n.anonymous&&e&&!e.anonymous&&ce(e,n)},{setUser:function(e){var n=h&&O(h);(h=q(e))&&m&&m(O(h),n)},getUser:function(){return h?O(h):null}}),Q=Ce(u.localStorage,y);function ee(e){if(S&&!(W&&W.enqueueEvent&&W.enqueueEvent(e))){if("alias"!==e.kind){if(!e.user)return void(X&&(y.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"),X=!1));X=!1}!E||B||u.isDoNotTrack()||(y.debug(Ue(e.kind)),H.enqueue(e))}}function re(e,n,t,r){var o=Y.getUser(),i=new Date,a=n?n.value:null;if(!k.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,s=V[u];if(s&&i-s<3e5)return;V[u]=i}var c={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()};o&&o.anonymous&&(c.contextKind=ue(o));var l=$[e];l&&(c.version=l.flagVersion?l.flagVersion:l.version,c.trackEvents=l.trackEvents,c.debugEventsUntilDate=l.debugEventsUntilDate),(r||l&&l.trackReason)&&n&&(c.reason=n.reason),ee(c)}function oe(e,n,t,r){var o;if($&&x($,e)&&$[e]&&!$[e].deleted){var i=$[e];o=ie(i),null!==i.value&&void 0!==i.value||(o.value=n)}else o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&re(e,o,n,r),o}function ie(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function ue(e){return e.anonymous?"anonymousUser":"user"}function ce(e,n){W||e&&n&&ee({kind:"alias",key:e.key,contextKind:ue(e),previousKey:n.key,previousContextKind:ue(n),creationDate:(new Date).getTime()})}function le(){v=!0,Y.getUser()&&F.connect(Y.getUser(),D,{ping:function(){y.debug("received ping message from stream");var n=Y.getUser();_.fetchFlagSettings(n,D).then(function(e){P(n,Y.getUser())&&de(e||{})}).catch(function(e){w.maybeReportError(new l(te(e)))})},put:function(e){var n=JSON.parse(e.data);y.debug("received streaming update for all flags"),de(n)},patch:function(e){var n=JSON.parse(e.data),t=$[n.key];if(!t||!t.version||!n.version||t.version<n.version){y.debug(Ee(n.key));var r={},o=L({},n);delete o.key;var i=ie($[n.key]=o);r[n.key]=t?{previous:t.value,current:i}:{current:i},ve(r)}else y.debug(we(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!$[n.key]||$[n.key].version<n.version){y.debug(De(n.key));var t={};$[n.key]&&!$[n.key].deleted&&(t[n.key]={previous:$[n.key].value}),$[n.key]={version:n.version,deleted:!0},ve(t)}else y.debug(Se(n.key))}})}function fe(){v&&(F.disconnect(),v=!1)}function de(e){var n={};if(!e)return Promise.resolve();for(var t in $)x($,t)&&$[t]&&(e[t]&&!P(e[t].value,$[t].value)?n[t]={previous:$[t].value,current:ie(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:$[t].value}));for(var o in e)x(e,o)&&e[o]&&(!$[o]||$[o].deleted)&&(n[o]={current:ie(e[o])});return $=r({},e),ve(n).catch(function(){})}function ve(o){var e=Object.keys(o);if(0<e.length){var i={};e.forEach(function(e){var n=o[e].current,t=n?n.value:void 0,r=o[e].previous;w.emit("change:"+e,t,r),i[e]=n?{current:t,previous:r}:{previous:r}}),w.emit("change",i),w.emit("internal-change",$),k.sendEventsOnlyForVariation||W||e.forEach(function(e){re(e,o[e].current)})}return d&&p?p.saveFlags($).catch(function(){return null}):Promise.resolve()}function ge(){var e=K||g&&void 0===K;e&&!v?le():!e&&v&&fe(),A&&A.setStreaming(e)}function pe(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}if(u.localStorage&&(p=new Re(u.localStorage,S,D,Y,y)),"string"==typeof k.bootstrap&&"LOCALSTORAGE"===k.bootstrap.toUpperCase()&&(p?d=!0:y.warn("localStorage is unavailable")),"object"===e(k.bootstrap)&&($=function(t){var e=Object.keys(t),r=t.$flagsState;!r&&e.length&&y.warn(ae()),!1===t.$valid&&y.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var o={};return e.forEach(function(e){if("$flagsState"!==e&&"$valid"!==e){var n={value:t[e]};r&&r[e]?n=L(n,r[e]):n.version=0,o[e]=n}}),o}(k.bootstrap)),W){var me=W.getInitialState();me?he(me):W.on("init",he),W.on("update",function(e){e.user&&Y.setUser(e.user),e.flags&&de(e.flags)})}else(n?Q.validateUser(t).then(function(n){return Y.setUser(n),"object"===e(k.bootstrap)?ye():d?p.loadFlags().catch(function(){return null}).then(function(e){return null==e?($={},_.fetchFlagSettings(Y.getUser(),D).then(function(e){return de(e||{})}).then(ye).catch(function(e){be(new l(te(e)))})):($=e,I(ye),_.fetchFlagSettings(Y.getUser(),D).then(function(e){return de(e)}).catch(function(e){return w.maybeReportError(e)}))}):_.fetchFlagSettings(Y.getUser(),D).then(function(e){$=e||{},ye()}).catch(function(e){$={},be(e)})}):Promise.reject(new o(ne()))).catch(be);function he(e){S=e.environment,Y.setUser(e.user),$=r({},e.flags),I(ye)}function ye(){y.info("LaunchDarkly client initialized"),G=!0,ge(),b.signalSuccess()}function be(e){b.signalFailure(e)}return{client:{waitForInitialization:function(){return b.getInitializationPromise()},waitUntilReady:function(){return b.getReadyPromise()},identify:function(e,r,n){return B?j(Promise.resolve({}),n):W?(y.warn("identify() has no effect here; it must be called on the main client instance"),j(Promise.resolve(T($)),n)):j((d&&p?p.clearFlags():Promise.resolve()).then(function(){return Q.validateUser(e)}).then(function(t){return _.fetchFlagSettings(t,r).then(function(e){var n=T(e);return Y.setUser(t),D=r,e?de(e).then(function(){return n}):n})}).then(function(e){return v&&le(),e}).catch(function(e){return w.maybeReportError(e),Promise.reject(e)}),n)},getUser:function(){return Y.getUser()},variation:function(e,n){return oe(e,n,!0,!1).value},variationDetail:function(e,n){return oe(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){u.customEventFilter&&!u.customEventFilter(e)&&y.warn(Z(e));var r=Y.getUser(),o={kind:"custom",key:e,user:r,url:u.getCurrentUrl(),creationDate:(new Date).getTime()};r&&r.anonymous&&(o.contextKind=ue(r)),null!=n&&(o.data=n),null!=t&&(o.metricValue=t),ee(o)}else w.maybeReportError(new s(Z(e)))},alias:ce,on:function(e,n,t){pe(e)?(g=!0,G&&ge(),w.on(e,n,t)):w.on.apply(w,arguments)},off:function(e){if(w.off.apply(w,arguments),pe(e)){var n=!1;w.getEvents().forEach(function(e){pe(e)&&0<w.getEventListenerCount(e)&&(n=!0)}),n||(g=!1,v&&void 0===K&&fe())}},setStreaming:function(e){var n=null===e?void 0:e;n!==K&&(K=n,ge())},flush:function(e){return j(E?H.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!$)return e;for(var n in $)x($,n)&&(e[n]=oe(n,null,!k.sendEventsOnlyForVariation).value);return e},close:function(e){if(B)return j(Promise.resolve(),e);function n(){B=!0,$={}}return j(Promise.resolve().then(function(){if(fe(),A&&A.stop(),E)return H.stop(),H.flush()}).then(n).catch(n),e)}},options:k,emitter:w,ident:Y,logger:y,requestor:_,start:function(){E&&(A&&A.start(),H.start())},enqueueEvent:ee,getFlagsInternal:function(){return $},getEnvironmentId:function(){return S},internalChangeEventName:"internal-change"}}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 ownKeys(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}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 isSyncXhrSupported(){var e=window.navigator&&window.navigator.userAgent;if(e){var n=e.match(/Chrom(e|ium)\/([0-9]+)\./);if(n)return parseInt(n[2],10)<73}return!0}var emptyResult={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function newHttpRequest(e,n,t,r,o){if(o&&!isSyncXhrSupported())return emptyResult;var i=new window.XMLHttpRequest;for(var a in i.open(e,n,!o),t||{})Object.prototype.hasOwnProperty.call(t,a)&&i.setRequestHeader(a,t[a]);if(o)return i.send(r),emptyResult;var u;return{promise:new Promise(function(e,n){i.addEventListener("load",function(){u||e({status:i.status,header:function(e){return i.getResponseHeader(e)},body:i.responseText})}),i.addEventListener("error",function(){u||n(new Error)}),i.send(r)}),cancel:function(){u=!0,i.abort()}}}function makeBrowserPlatform(e){var n,i={synchronousFlush:!1};if(window.XMLHttpRequest){var a=e&&e.disableSyncEventPost;i.httpRequest=function(e,n,t,r){var o=i.synchronousFlush&!a;return i.synchronousFlush=!1,newHttpRequest(e,n,t,r,o)}}i.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},i.httpFallbackPing=function(e){(new window.Image).src=e};var r,t=e&&e.eventUrlTransformer;i.getCurrentUrl=function(){return t?t(window.location.href):window.location.href},i.isDoNotTrack=function(){var e;return 1===(e=window.navigator&&void 0!==window.navigator.doNotTrack?window.navigator.doNotTrack:window.navigator&&void 0!==window.navigator.msDoNotTrack?window.navigator.msDoNotTrack:window.doNotTrack)||!0===e||"1"===e||"yes"===e};try{window.localStorage&&(i.localStorage={get:function(n){return new Promise(function(e){e(window.localStorage.getItem(n))})},set:function(n,t){return new Promise(function(e){window.localStorage.setItem(n,t),e()})},clear:function(n){return new Promise(function(e){window.localStorage.removeItem(n),e()})}})}catch(e){i.localStorage=null}var o=e&&e.useReport;if(r=o&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(i.eventSourceAllowsReport=!0,window.EventSourcePolyfill):(i.eventSourceAllowsReport=!1,window.EventSource),window.EventSource){i.eventSourceFactory=function(e,n){var t=_objectSpread2(_objectSpread2({},{heartbeatTimeout:3e5,silentTimeout:3e5,skipDefaultHeaders:!0}),n);return new r(e,t)},i.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return i.userAgent="JSClient",i.version="2.20.0-alpha.1",i.diagnosticSdkData={name:"js-client-sdk",version:"2.20.0-alpha.1"},i.diagnosticPlatformData={name:"JS"},i.diagnosticUseCombinedEvent=!0,i}var matchOperatorsRe=/[|\\{}()[\]^$+*?.]/g,escapeStringRegexp=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(matchOperatorsRe,"\\$&")};function doesUrlMatch(e,n,t,r){var o,i,a=(("substring"===e.kind||"regex"===e.kind)&&r.includes("/")?n:n.replace(r,"")).replace(t,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+escapeStringRegexp(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+escapeStringRegexp(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+escapeStringRegexp(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function findGoalsForClick(e,n){for(var t=[],r=0;r<n.length;r++)for(var o=e.target,i=n[r],a=i.selector,u=document.querySelectorAll(a);o&&0<u.length;){for(var s=0;s<u.length;s++)o===u[s]&&t.push(i);o=o.parentNode}return t}function GoalTracker(e,r){for(var n={},t=null,o=[],i=0;i<e.length;i++)for(var a=e[i],u=a.urls||[],s=0;s<u.length;s++)if(doesUrlMatch(u[s],window.location.href,window.location.search,window.location.hash)){"pageview"===a.kind?r("pageview",a):(o.push(a),r("click_pageview",a));break}return 0<o.length&&(t=function(e){for(var n=findGoalsForClick(e,o),t=0;t<n.length;t++)r("click",n[t])},document.addEventListener("click",t)),n.dispose=function(){document.removeEventListener("click",t)},n}var locationWatcherInterval=300;function GoalManager(o,n){var t,r;function i(){r&&r.dispose(),t&&t.length&&(r=GoalTracker(t,a))}function a(e,n){var t=o.ident.getUser(),r={kind:e,key:n.key,data:null,url:window.location.href,user:t,creationDate:(new Date).getTime()};return t&&t.anonymous&&(r.contextKind="anonymousUser"),"click"===e&&(r.selector=n.selector),o.enqueueEvent(r)}function u(e,n){var t,r=window.location.href;function o(){(t=window.location.href)!==r&&(r=t,n())}!function e(n,t){n(),setTimeout(function(){e(n,t)},t)}(o,e),window.history&&window.history.pushState?window.addEventListener("popstate",o):window.addEventListener("hashchange",o)}return o.requestor.fetchJSON("/sdk/goals/"+o.getEnvironmentId()).then(function(e){e&&0<e.length&&(r=GoalTracker(t=e,a),u(locationWatcherInterval,i)),n()}).catch(function(e){o.emitter.maybeReportError(new v.LDUnexpectedResponseError((e&&e.message,e.message))),n()}),{}}var goalsEvent="goalsReady",extraOptionDefs={fetchGoals:{default:!0},hash:{type:"string"},eventProcessor:{type:"object"},eventUrlTransformer:{type:"function"},disableSyncEventPost:{default:!1}};function initialize(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=makeBrowserPlatform(t),o=mn(e,n,t,r,extraOptionDefs),i=o.client,a=o.options,u=o.emitter,s=new Promise(function(e){var n=u.on(goalsEvent,function(){u.off(goalsEvent,n),e()})});i.waitUntilGoalsReady=function(){return s},a.fetchGoals?GoalManager(o,function(){return u.emit(goalsEvent)}):u.emit(goalsEvent),"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();function c(){r.synchronousFlush=!0,i.flush().catch(function(){}),r.synchronousFlush=!1}return window.addEventListener("beforeunload",c),window.addEventListener("unload",c),i}var createConsoleLogger=pn,version="2.20.0-alpha.1";function deprecatedInitialize(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(Pe.deprecated("default export","named LDClient export")),initialize(e,n,t)}var index={initialize:deprecatedInitialize,version:version};exports.createConsoleLogger=createConsoleLogger,exports.default=index,exports.initialize=initialize,exports.version=version;
//# sourceMappingURL=ldclient.cjs.js.map

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

function e(n){return(e="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})(n)}function n(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function t(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 r(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?t(o,!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(o).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(o,n))}))}return e}function o(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 i=o("LaunchDarklyUnexpectedResponseError"),a=o("LaunchDarklyInvalidEnvironmentIdError"),u=o("LaunchDarklyInvalidUserError"),s=o("LaunchDarklyInvalidEventKeyError"),c=o("LaunchDarklyInvalidArgumentError"),l=o("LaunchDarklyFlagFetchError");function f(e){return!(e>=400&&e<500)||400===e||408===e||429===e}for(var d=Object.freeze({__proto__:null,LDUnexpectedResponseError:i,LDInvalidEnvironmentIdError:a,LDInvalidUserError:u,LDInvalidEventKeyError:s,LDInvalidArgumentError:c,LDFlagFetchError:l,isHttpErrorRecoverable:f}),v=[],g=[],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",m=0,h=p.length;m<h;++m)v[m]=p[m],g[p.charCodeAt(m)]=m;function y(e,n,t){for(var r,o,i=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(v[(o=r)>>18&63]+v[o>>12&63]+v[o>>6&63]+v[63&o]);return i.join("")}g["-".charCodeAt(0)]=62,g["_".charCodeAt(0)]=63;var w=Array.isArray,b=Object.keys,k=Object.prototype.hasOwnProperty,E=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function S(e){return function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(y(e,i,i+16383>a?a:i+16383));return 1===r?(n=e[t-1],o.push(v[n>>2]+v[n<<4&63]+"==")):2===r&&(n=(e[t-2]<<8)+e[t-1],o.push(v[n>>10]+v[n>>4&63]+v[n<<2&63]+"=")),o.join("")}(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(unescape(encodeURIComponent(e))))}function D(e){return S(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function O(e){return JSON.parse(JSON.stringify(e))}function P(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,o,i,a=w(n),u=w(t);if(a&&u){if((o=n.length)!=t.length)return!1;for(r=o;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 d=b(n);if((o=d.length)!==b(t).length)return!1;for(r=o;0!=r--;)if(!k.call(t,d[r]))return!1;for(r=o;0!=r--;)if(!e(n[i=d[r]],t[i]))return!1;return!0}return n!=n&&t!=t}(e,n)}function U(e){setTimeout(e,0)}function R(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 j(e){var n={};for(var t in e)C(e,t)&&(n[t]={value:e[t],version:0});return n}function I(e){var n={};for(var t in e)C(e,t)&&(n[t]=e[t].value);return n}function T(e,n){for(var t,r=n.slice(0),o=[],i=e;r.length>0;){for(t=[];i>0;){var a=r.shift();if(!a)break;(i-=D(JSON.stringify(a)).length)<0&&t.length>0?r.unshift(a):t.push(a)}i=e,o.push(t)}return o}function N(e){var n=e.version||"3.3.2";return e.userAgent+"/"+n}function L(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":N(e)};return n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t}function F(){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 r({},e,{},n)}),{})}function C(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function x(e){if(!e)return e;var n;for(var t in E){var o=E[t],i=e[o];void 0!==i&&"string"!=typeof i&&((n=n||r({},e))[o]=String(i))}return n||e}Object.freeze({__proto__:null,btoa:S,base64URLEncode:D,clone:O,deepEquals:P,onNextTick:U,wrapPromiseCallback:R,transformValuesToVersionedValues:j,transformVersionedValuesToValues:I,chunkUserEventsForUrl:T,getLDUserAgentString:N,getLDHeaders:L,extend:F,objectHasOwnProperty:C,sanitizeUser:x});for(var A=function(e,n){return 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}}}(n={exports:{}}),n.exports}(),q=[],V=0;V<256;++V)q[V]=(V+256).toString(16).substr(1);var _,J,z=0,M=0,K=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||_,a=void 0!==e.clockseq?e.clockseq:J;if(null==i||null==a){var u=A();null==i&&(i=_=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=J=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:M+1,l=s-z+(c-M)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||s>z)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");z=s,M=c,J=a;var f=(1e4*(268435455&(s+=122192928e5))+c)%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=255&f;var d=s/4294967296*1e4&268435455;o[r++]=d>>>8&255,o[r++]=255&d,o[r++]=d>>>24&15|16,o[r++]=d>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var v=0;v<6;++v)o[r+v]=i[v];return n||function(e,n){var t=n||0,r=q;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("")}(o)};function $(e,n,t){var r="/a/"+n+".gif",o=F({"Content-Type":"application/json"},L(e,t)),i=e.httpFallbackPing,a={sendChunk:function(n,t,a,u){var s=JSON.stringify(n),c=a?null:K();return u?function n(r){var i=a?o:F({},o,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":c});return e.httpRequest("POST",t,i,s).promise.then((function(e){if(e)return e.status>=400&&f(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(){})):(i&&i(t+r+"?d="+D(s)),Promise.resolve())},sendEvents:function(n,t,r){if(!e.httpRequest)return Promise.resolve();var o,i=e.httpAllowsPost();o=i?[n]:T(2e3-t.length,n);for(var u=[],s=0;s<o.length;s++)u.push(a.sendChunk(o[s],t,r,i));return Promise.all(u)}};return a}function H(){var e={},n=0,t=0,r={};return e.summarizeEvent=function(e){if("feature"===e.kind){var o=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),i=r[o];i?i.count=i.count+1:r[o]={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={},o=!0;for(var i in r){var a=r[i],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),o=!1}return o?null:{startDate:n,endDate:t,features:e}},e.clearSummary=function(){n=0,t=0,r={}},e}function B(e){var n={},t=e.allAttributesPrivate,r=e.privateAttributeNames||[],o={key:!0,custom:!0,anonymous:!0},i={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,i){return Object.keys(e).reduce((function(a,u){var s=a;return i(u)&&(function(e){return!o[e]&&(t||-1!==n.indexOf(e)||-1!==r.indexOf(e))}(u)?s[1][u]=!0:s[0][u]=e[u]),s}),[{},{}])},u=a(e,(function(e){return i[e]})),s=u[0],c=u[1];if(e.custom){var l=a(e.custom,(function(){return!0}));s.custom=l[0],c=F({},c,l[1])}var f=Object.keys(c);return f.length&&(f.sort(),s.privateAttrs=f),s},n}function G(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var X=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#initializing-the-client for instructions on SDK initialization.",W=function(e){return'Expected application/json content type but got "'+e+'"'},Q=function(e){return"network error"+(e?" ("+e+")":"")},Y=function(e){return'Custom event "'+e+'" does not exist'},Z=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+X},ee=function(){return"No environment/client-side ID was specified."+X},ne=function(e){return"Error fetching flag settings: "+G(e)},te=function(){return"No user specified."+X},re=function(){return"Invalid user specified."+X},oe=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+X},ie=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},ae=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(f(e)?t:"giving up permanently")},ue=function(){return"Cannot make HTTP requests in this environment."+X},se=function(e){return"Opening stream connection to "+e},ce=function(e,n){return"Error on stream connection: "+G(e)+", will continue retrying every "+n+" milliseconds."},le=function(e){return'Ignoring unknown config option "'+e+'"'},fe=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},de=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},ve=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},ge=function(e){return"polling for feature flags at "+e},pe=function(e){return'received streaming update for flag "'+e+'"'},me=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},he=function(e){return'received streaming deletion for flag "'+e+'"'},ye=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},we=function(e){return'enqueueing "'+e+'" event'},be=function(e){return"sending "+e+" events"},ke=Object.freeze({__proto__:null,clientInitialized:function(){return"LaunchDarkly client initialized"},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/docs/js-sdk-reference#section-analytics-events"},invalidContentType:W,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:function(){return"localStorage is unavailable"},localStorageUnavailableForUserId:function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},networkError:Q,unknownCustomEventKey:Y,environmentNotFound:Z,environmentNotSpecified:ee,errorFetchingFlags:ne,userNotSpecified:te,invalidUser:re,bootstrapOldFormat:oe,bootstrapInvalid:function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},deprecated:ie,httpErrorMessage:ae,httpUnavailable:ue,identifyDisabled:function(){return"identify() has no effect here; it must be called on the main client instance"},streamClosing:function(){return"Closing stream connection"},streamConnecting:se,streamError:ce,unknownOption:le,wrongOptionType:fe,wrongOptionTypeBoolean:de,optionBelowMinimum:ve,debugPolling:ge,debugStreamPing:function(){return"received ping message from stream"},debugStreamPut:function(){return"received streaming update for all flags"},debugStreamPatch:pe,debugStreamPatchIgnored:me,debugStreamDelete:he,debugStreamDeleteIgnored:ye,debugEnqueueingEvent:we,debugPostingEvents:be,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"}});function Ee(e,n,t,r,o){var i={};function a(){var e="",o=r.getUser();return o&&(e=t||S(JSON.stringify(o))),"ld:"+n+":"+e}return i.loadFlags=function(){return e.get(a()).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=j(n):delete n.$schema}return n}catch(e){return i.clearFlags().then((function(){return Promise.reject(e)}))}})).catch((function(e){return o.warn("localStorage is unavailable"),Promise.reject(e)}))},i.saveFlags=function(n){var t=F({},n,{$schema:1});return e.set(a(),JSON.stringify(t)).catch((function(e){return o.warn("localStorage is unavailable"),Promise.reject(e)}))},i.clearFlags=function(){return e.clear(a()).catch((function(e){return o.warn("localStorage is unavailable"),Promise.reject(e)}))},i}function Se(e,n,t,r){var o,i=n.streamUrl,a=n.logger,u={},s=i+"/eval/"+t,c=n.useReport,l=n.evaluationReasons,f=n.streamReconnectDelay,d=L(e,n),v=!1,g=null,p=null,m=null,h=null,y=null;function w(e){v||(a.warn(ce(e,f)),v=!0),S(!1),E(),b(f)}function b(e){p||(e?p=setTimeout(k,e):k())}function k(){var n;p=null;var r="",u={headers:d,readTimeoutMillis:3e5};if(e.eventSourceFactory){for(var f in null!=h&&(r="h="+h),c?e.eventSourceAllowsReport?(n=s,u.method="REPORT",u.headers["Content-Type"]="application/json",u.body=JSON.stringify(m)):(n=i+"/ping/"+t,r=""):n=s+"/"+D(JSON.stringify(m)),l&&(r=r+(r?"&":"")+"withReasons=true"),n=n+(r?"?":"")+r,E(),a.info(se(n)),o=(new Date).getTime(),g=e.eventSourceFactory(n,u),y)C(y,f)&&g.addEventListener(f,y[f]);g.onerror=w}}function E(){g&&(a.info("Closing stream connection"),g.close(),g=null)}function S(e){o&&r&&r.recordStreamInit(o,!e,(new Date).getTime()-o),o=null}return u.connect=function(e,n,t){m=e,h=n,y={};var r=function(e){y[e]=function(n){v=!1,S(!0),t[e]&&t[e](n)}};for(var o in t||{})r(o);b()},u.disconnect=function(){clearTimeout(p),p=null,E()},u.isConnected=function(){return!!(g&&e.eventSourceIsActive&&e.eventSourceIsActive(g))},u}function De(e,n,t){var r=n.baseUrl,o=n.useReport,i=n.evaluationReasons,u=n.logger,s={},c={};function f(t,r){if(!e.httpRequest)return new Promise((function(e,n){n(new l(ue()))}));var o=r?"REPORT":"GET",i=L(e,n);r&&(i["Content-Type"]="application/json");var u=c[t];u||(u=function(e){var n,t,r,o,i={addPromise:function(i,a){n=i,t&&t(),t=a,i.then((function(t){n===i&&(r(t),e&&e())}),(function(t){n===i&&(o(t),e&&e())}))}};return i.resultPromise=new Promise((function(e,n){r=e,o=n})),i}((function(){delete c[t]})),c[t]=u);var s=e.httpRequest(o,t,i,r),f=s.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=W(e.header("content-type")||"");return Promise.reject(new l(n))}return Promise.reject(function(e){return 404===e.status?new a(Z()):new l(ne(e.statusText||String(e.status)))}(e))}),(function(e){return Promise.reject(new l(Q(e)))}));return u.addPromise(f,(function(){s.cancel&&s.cancel()})),u.resultPromise}return s.fetchJSON=function(e){return f(r+e,null)},s.fetchFlagSettings=function(e,n){var a,s,c,l="";return o?(s=[r,"/sdk/evalx/",t,"/user"].join(""),c=JSON.stringify(e)):(a=D(JSON.stringify(e)),s=[r,"/sdk/evalx/",t,"/users/",a].join("")),n&&(l="h="+n),i&&(l=l+(l?"&":"")+"withReasons=true"),s=s+(l?"?":"")+l,u.debug(ge(s)),f(s,c)},s}function Oe(e,n){var t={validateUser:function(t){if(!t)return Promise.reject(new u(te()));var r=O(t);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(e?e.get("ld:$anonUserId").catch((function(){return null})):Promise.resolve(null)).then((function(t){if(t)return r.key=t,r;var o=K();return r.key=o,function(t){return e?e.set("ld:$anonUserId",t).catch((function(){n.warn("localStorage is unavailable, so anonymous user ID cannot be cached")})):Promise.resolve()}(o).then((function(){return r}))})):Promise.reject(new u(re()))}};return t}var Pe={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},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}};function Ue(n,t,r,o){var i=F({logger:{default:o}},Pe,r),a={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function u(e){U((function(){t&&t.maybeReportError(new c(e))}))}var s=F({},n||{});return function(e){var n=e;Object.keys(a).forEach((function(e){if(void 0!==n[e]){var t=a[e];o&&o.warn(ie(e,t)),t&&(void 0===n[t]&&(n[t]=n[e]),delete n[e])}}))}(s),function(n){var t=F({},n),r=function(n){if(null===n)return"any";if(void 0!==n){if(Array.isArray(n))return"array";var t=e(n);return"boolean"===t||"string"===t||"number"===t||"function"===t?t:"object"}};return Object.keys(n).forEach((function(e){var o=n[e];if(null!=o){var a=i[e];if(void 0===a)u(le(e));else{var s=a.type||r(a.default);if("any"!==s){var c=s.split("|"),l=r(o);c.indexOf(l)<0?"boolean"===s?(t[e]=!!o,u(de(e,l))):(u(fe(e,s,l)),t[e]=a.default):"number"===l&&void 0!==a.minimum&&o<a.minimum&&(u(ve(e,o,a.minimum)),t[e]=a.minimum)}}}})),t}(s=function(e){var n=F({},e);return Object.keys(i).forEach((function(e){void 0!==n[e]&&null!==n[e]||(n[e]=i[e]&&i[e].default)})),n}(s))}var Re=Object.freeze({__proto__:null,baseOptionDefs:Pe,validate:Ue}).baseOptionDefs,je=function(e){var n={diagnosticId:K()};return e&&(n.sdkKeySuffix=e.length>6?e.substring(e.length-6):e),n};function Ie(e,n){var t,r=["debug","info","warn","error"];t=null!=n?""===n?"":n+" ":"LD: ";var o=0;e&&(o="none"===e?100:r.indexOf(e));var i={};function a(e,n,i){if(e>=o&&console){var a=console[n];if(a){var u=e<r.length?r[e]:"?";a.call(console,t+"["+u+"] "+i)}}}return i.debug=function(e){return a(0,"log",e)},i.info=function(e){return a(1,"info",e)},i.warn=function(e){return a(2,"warn",e)},i.error=function(e){return a(3,"error",e)},i}function Te(n,t,o,u,c){var d,v,g,p,m=o&&o.logger?o.logger:c&&c.logger&&c.logger.default||Ie("warn"),h=function(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 o=0;o<t[e].length;o++)t[e][o].handler===n&&t[e][o].context===r&&(t[e]=t[e].slice(0,o).concat(t[e].slice(o+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}(m),y=function(e){var n=!1,t=!1,r=null,o=null,i=new Promise((function(n){e.on("ready",(function t(){e.off("ready",t),n()}))})).catch((function(){}));return{getInitializationPromise:function(){return o||(n?Promise.resolve():t?Promise.reject(r):o=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 i},signalSuccess:function(){n||t||(n=!0,e.emit("initialized"),e.emit("ready"))},signalFailure:function(o){n||t||(t=!0,r=o,e.emit("failed",o),e.emit("ready")),e.maybeReportError(o)}}}(h),w=Ue(o,h,c,m),b=w.sendEvents,k=n,E=w.hash,S=$(u,k,w),D=w.sendEvents&&!w.diagnosticOptOut,j=D?je(k):null,T=D?function(e){var n,t,r,o;function i(e){n=e,t=0,r=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){var r={timestamp:e,failed:n,durationMillis:t};o.push(r)},reset:i}}((new Date).getTime()):null,N=D?function(e,n,t,o,i,a){var u,s,c=!!e.diagnosticUseCombinedEvent,l="ld:"+o+":$diagnostics",f=i.eventsUrl+"/events/diagnostic/"+o,d=i.diagnosticRecordingInterval,v=n,g=!!i.streaming,p={};function m(){return{sdk:w(),configuration:(n={customBaseURI:i.baseUrl!==Re.baseUrl.default,customStreamURI:i.streamUrl!==Re.streamUrl.default,customEventsURI:i.eventsUrl!==Re.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,allowFrequentDuplicateEvents:!!i.allowFrequentDuplicateEvents,sendEventsOnlyForVariation:!!i.sendEventsOnlyForVariation,autoAliasingOptOut:!!i.autoAliasingOptOut},n),platform:e.diagnosticPlatformData};var n}function h(e){i.logger&&i.logger.debug(ke.debugPostingDiagnosticEvent(e)),t.sendEvents(e,f,!0).then((function(){})).catch((function(){}))}function y(){var n,t;h((n=(new Date).getTime(),t=r({kind:c?"diagnostic-combined":"diagnostic",id:a,creationDate:n},v.getProps()),c&&(t=r({},t,{},m())),v.reset(n),t)),s=setTimeout(y,d),u=(new Date).getTime(),c&&function(){if(e.localStorage){var n=r({},v.getProps());e.localStorage.set(l,JSON.stringify(n),(function(){}))}}()}function w(){var n=r({},e.diagnosticSdkData);return i.wrapperName&&(n.wrapperName=i.wrapperName),i.wrapperVersion&&(n.wrapperVersion=i.wrapperVersion),n}return p.start=function(){c?function(n){if(!e.localStorage)return n(!1);e.localStorage.get(l).then((function(e){if(e)try{var t=JSON.parse(e);v.setProps(t),u=t.dataSinceDate}catch(e){}n(!0)})).catch((function(){n(!1)}))}((function(e){if(e){var n=(u||0)+d,t=(new Date).getTime();t>=n?y():s=setTimeout(y,n-t)}else 0===Math.floor(4*Math.random())?y():s=setTimeout(y,d)})):(h(r({kind:"diagnostic-init",id:a,creationDate:v.getProps().dataSinceDate},m())),s=setTimeout(y,d))},p.stop=function(){s&&clearTimeout(s)},p.setStreaming=function(e){g=e},p}(u,T,S,k,w,j):null,L=Se(u,w,k,T),A=w.eventProcessor||function(e,n,t){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s={},c=u||$(e,t,n),l=n.eventsUrl+"/events/bulk/"+t,d=H(),v=B(n),g=n.inlineUsersInEvents,p=n.samplingInterval,m=n.eventCapacity,h=n.flushInterval,y=n.logger,w=[],b=0,k=!1,E=!1;function S(){return 0===p||0===Math.floor(Math.random()*p)}function D(e){return!!e.debugEventsUntilDate&&e.debugEventsUntilDate>b&&e.debugEventsUntilDate>(new Date).getTime()}function O(e){var n=F({},e);return"alias"===e.kind||(g||"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 P(e){w.length<m?(w.push(e),E=!1):(E||(E=!0,y.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),o&&o.incrementDroppedEvents())}return s.enqueue=function(e){if(!k){var n=!1,t=!1;if(d.summarizeEvent(e),"feature"===e.kind?S()&&(n=!!e.trackEvents,t=D(e)):n=S(),n&&P(O(e)),t){var r=F({},e,{kind:"debug"});r.user=v.filterUser(r.user),delete r.trackEvents,delete r.debugEventsUntilDate,P(r)}}},s.flush=function(){if(k)return Promise.resolve();var e=w,n=d.getSummary();return d.clearSummary(),n&&(n.kind="summary",e.push(n)),o&&o.setEventsInLastBatch(e.length),0===e.length?Promise.resolve():(w=[],y.debug(be(e.length)),c.sendEvents(e,l).then((function(e){e&&(e.serverTime&&(b=e.serverTime),f(e.status)||(k=!0),e.status>=400&&U((function(){a.maybeReportError(new i(ae(e.status,"event posting","some events were dropped")))})))})))},s.start=function(){r=setTimeout((function e(){s.flush(),r=setTimeout(e,h)}),h)},s.stop=function(){clearTimeout(r)},s}(u,w,k,T,h,S),q=De(u,w,k),V={},_={},J=w.streaming,z=!1,M=!1,K=!0,G=w.stateProvider,X=function(e,n){var t,r={setUser:function(e){var r=t&&O(t);(t=x(e))&&n&&n(O(t),r)},getUser:function(){return t?O(t):null}};return r}(0,(function(e,n){(function(e){G||e&&Q({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})})(e),!w.autoAliasingOptOut&&n&&n.anonymous&&e&&!e.anonymous&&ue(e,n)})),W=Oe(u.localStorage,m);function Q(e){if(k&&!(G&&G.enqueueEvent&&G.enqueueEvent(e))){if("alias"!==e.kind){if(!e.user)return void(K&&(m.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"),K=!1));K=!1}!b||M||u.isDoNotTrack()||(m.debug(we(e.kind)),A.enqueue(e))}}function Z(e,n,t,r){var o=X.getUser(),i=new Date,a=n?n.value:null;if(!w.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,s=V[u];if(s&&i-s<3e5)return;V[u]=i}var c={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()};o&&o.anonymous&&(c.contextKind=ie(o));var l=_[e];l&&(c.version=l.flagVersion?l.flagVersion:l.version,c.trackEvents=l.trackEvents,c.debugEventsUntilDate=l.debugEventsUntilDate),(r||l&&l.trackReason)&&n&&(c.reason=n.reason),Q(c)}function te(e,n,t,r){var o;if(_&&C(_,e)&&_[e]&&!_[e].deleted){var i=_[e];o=re(i),null!==i.value&&void 0!==i.value||(o.value=n)}else o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&Z(e,o,n,r),o}function re(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function ie(e){return e.anonymous?"anonymousUser":"user"}function ue(e,n){G||e&&n&&Q({kind:"alias",key:e.key,contextKind:ie(e),previousKey:n.key,previousContextKind:ie(n),creationDate:(new Date).getTime()})}function se(){v=!0,X.getUser()&&L.connect(X.getUser(),E,{ping:function(){m.debug("received ping message from stream");var e=X.getUser();q.fetchFlagSettings(e,E).then((function(n){P(e,X.getUser())&&le(n||{})})).catch((function(e){h.maybeReportError(new l(ne(e)))}))},put:function(e){var n=JSON.parse(e.data);m.debug("received streaming update for all flags"),le(n)},patch:function(e){var n=JSON.parse(e.data),t=_[n.key];if(!t||!t.version||!n.version||t.version<n.version){m.debug(pe(n.key));var r={},o=F({},n);delete o.key,_[n.key]=o;var i=re(o);r[n.key]=t?{previous:t.value,current:i}:{current:i},fe(r)}else m.debug(me(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!_[n.key]||_[n.key].version<n.version){m.debug(he(n.key));var t={};_[n.key]&&!_[n.key].deleted&&(t[n.key]={previous:_[n.key].value}),_[n.key]={version:n.version,deleted:!0},fe(t)}else m.debug(ye(n.key))}})}function ce(){v&&(L.disconnect(),v=!1)}function le(e){var n={};if(!e)return Promise.resolve();for(var t in _)C(_,t)&&_[t]&&(e[t]&&!P(e[t].value,_[t].value)?n[t]={previous:_[t].value,current:re(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:_[t].value}));for(var o in e)C(e,o)&&e[o]&&(!_[o]||_[o].deleted)&&(n[o]={current:re(e[o])});return _=r({},e),fe(n).catch((function(){}))}function fe(e){var n=Object.keys(e);if(n.length>0){var t={};n.forEach((function(n){var r=e[n].current,o=r?r.value:void 0,i=e[n].previous;h.emit("change:"+n,o,i),t[n]=r?{current:o,previous:i}:{previous:i}})),h.emit("change",t),h.emit("internal-change",_),w.sendEventsOnlyForVariation||G||n.forEach((function(n){Z(n,e[n].current)}))}return d&&p?p.saveFlags(_).catch((function(){return null})):Promise.resolve()}function de(){var e=J||g&&void 0===J;e&&!v?se():!e&&v&&ce(),N&&N.setStreaming(e)}function ve(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}if(u.localStorage&&(p=new Ee(u.localStorage,k,E,X,m)),"string"==typeof w.bootstrap&&"LOCALSTORAGE"===w.bootstrap.toUpperCase()&&(p?d=!0:m.warn("localStorage is unavailable")),"object"===e(w.bootstrap)&&(_=function(e){var n=Object.keys(e),t=e.$flagsState;!t&&n.length&&m.warn(oe()),!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 o={value:e[n]};t&&t[n]?o=F(o,t[n]):o.version=0,r[n]=o}})),r}(w.bootstrap)),G){var ge=G.getInitialState();ge?Pe(ge):G.on("init",Pe),G.on("update",(function(e){e.user&&X.setUser(e.user),e.flags&&le(e.flags)}))}else(n?W.validateUser(t).then((function(n){return X.setUser(n),"object"===e(w.bootstrap)?Te():d?p.loadFlags().catch((function(){return null})).then((function(e){return null==e?(_={},q.fetchFlagSettings(X.getUser(),E).then((function(e){return le(e||{})})).then(Te).catch((function(e){Ne(new l(ne(e)))}))):(_=e,U(Te),q.fetchFlagSettings(X.getUser(),E).then((function(e){return le(e)})).catch((function(e){return h.maybeReportError(e)})))})):q.fetchFlagSettings(X.getUser(),E).then((function(e){_=e||{},Te()})).catch((function(e){_={},Ne(e)}))})):Promise.reject(new a(ee()))).catch(Ne);function Pe(e){k=e.environment,X.setUser(e.user),_=r({},e.flags),U(Te)}function Te(){m.info("LaunchDarkly client initialized"),z=!0,de(),y.signalSuccess()}function Ne(e){y.signalFailure(e)}return{client:{waitForInitialization:function(){return y.getInitializationPromise()},waitUntilReady:function(){return y.getReadyPromise()},identify:function(e,n,t){return M?R(Promise.resolve({}),t):G?(m.warn("identify() has no effect here; it must be called on the main client instance"),R(Promise.resolve(I(_)),t)):R((d&&p?p.clearFlags():Promise.resolve()).then((function(){return W.validateUser(e)})).then((function(e){return q.fetchFlagSettings(e,n).then((function(t){var r=I(t);return X.setUser(e),E=n,t?le(t).then((function(){return r})):r}))})).then((function(e){return v&&se(),e})).catch((function(e){return h.maybeReportError(e),Promise.reject(e)})),t)},getUser:function(){return X.getUser()},variation:function(e,n){return te(e,n,!0,!1).value},variationDetail:function(e,n){return te(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){u.customEventFilter&&!u.customEventFilter(e)&&m.warn(Y(e));var r=X.getUser(),o={kind:"custom",key:e,user:r,url:u.getCurrentUrl(),creationDate:(new Date).getTime()};r&&r.anonymous&&(o.contextKind=ie(r)),null!=n&&(o.data=n),null!=t&&(o.metricValue=t),Q(o)}else h.maybeReportError(new s(Y(e)))},alias:ue,on:function(e,n,t){ve(e)?(g=!0,z&&de(),h.on(e,n,t)):h.on.apply(h,arguments)},off:function(e){if(h.off.apply(h,arguments),ve(e)){var n=!1;h.getEvents().forEach((function(e){ve(e)&&h.getEventListenerCount(e)>0&&(n=!0)})),n||(g=!1,v&&void 0===J&&ce())}},setStreaming:function(e){var n=null===e?void 0:e;n!==J&&(J=n,de())},flush:function(e){return R(b?A.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!_)return e;for(var n in _)C(_,n)&&(e[n]=te(n,null,!w.sendEventsOnlyForVariation).value);return e},close:function(e){if(M)return R(Promise.resolve(),e);var n=function(){M=!0,_={}};return R(Promise.resolve().then((function(){if(ce(),N&&N.stop(),b)return A.stop(),A.flush()})).then(n).catch(n),e)}},options:w,emitter:h,ident:X,logger:m,requestor:q,start:function(){b&&(N&&N.start(),A.start())},enqueueEvent:Q,getFlagsInternal:function(){return _},getEnvironmentId:function(){return k},internalChangeEventName:"internal-change"}}function Ne(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Le(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 Fe(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Le(Object(t),!0).forEach((function(n){Ne(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Le(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ce={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function xe(e,n,t,r,o){if(o&&!function(){var e=window.navigator&&window.navigator.userAgent;if(e){var n=e.match(/Chrom(e|ium)\/([0-9]+)\./);if(n)return parseInt(n[2],10)<73}return!0}())return Ce;var i=new window.XMLHttpRequest;for(var a in i.open(e,n,!o),t||{})Object.prototype.hasOwnProperty.call(t,a)&&i.setRequestHeader(a,t[a]);if(o)return i.send(r),Ce;var u;return{promise:new Promise((function(e,n){i.addEventListener("load",(function(){u||e({status:i.status,header:function(e){return i.getResponseHeader(e)},body:i.responseText})})),i.addEventListener("error",(function(){u||n(new Error)})),i.send(r)})),cancel:function(){u=!0,i.abort()}}}function Ae(e){var n,t={synchronousFlush:!1};if(window.XMLHttpRequest){var r=e&&e.disableSyncEventPost;t.httpRequest=function(e,n,o,i){var a=t.synchronousFlush&!r;return t.synchronousFlush=!1,xe(e,n,o,i,a)}}t.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},t.httpFallbackPing=function(e){(new window.Image).src=e};var o,i=e&&e.eventUrlTransformer;t.getCurrentUrl=function(){return i?i(window.location.href):window.location.href},t.isDoNotTrack=function(){var e;return 1===(e=window.navigator&&void 0!==window.navigator.doNotTrack?window.navigator.doNotTrack:window.navigator&&void 0!==window.navigator.msDoNotTrack?window.navigator.msDoNotTrack:window.doNotTrack)||!0===e||"1"===e||"yes"===e};try{window.localStorage&&(t.localStorage={get:function(e){return new Promise((function(n){n(window.localStorage.getItem(e))}))},set:function(e,n){return new Promise((function(t){window.localStorage.setItem(e,n),t()}))},clear:function(e){return new Promise((function(n){window.localStorage.removeItem(e),n()}))}})}catch(e){t.localStorage=null}if(e&&e.useReport&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(t.eventSourceAllowsReport=!0,o=window.EventSourcePolyfill):(t.eventSourceAllowsReport=!1,o=window.EventSource),window.EventSource){var a=3e5;t.eventSourceFactory=function(e,n){var t=Fe(Fe({},{heartbeatTimeout:a,silentTimeout:a,skipDefaultHeaders:!0}),n);return new o(e,t)},t.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return t.userAgent="JSClient",t.version="2.19.4",t.diagnosticSdkData={name:"js-client-sdk",version:"2.19.4"},t.diagnosticPlatformData={name:"JS"},t.diagnosticUseCombinedEvent=!0,t}var qe=/[|\\{}()[\]^$+*?.]/g,Ve=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(qe,"\\$&")};function _e(e,n,t,r){var o,i,a=(("substring"===e.kind||"regex"===e.kind)&&r.includes("/")?n:n.replace(r,"")).replace(t,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+Ve(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+Ve(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+Ve(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function Je(e,n){for(var t={},r=null,o=[],i=0;i<e.length;i++)for(var a=e[i],u=a.urls||[],s=0;s<u.length;s++)if(_e(u[s],window.location.href,window.location.search,window.location.hash)){"pageview"===a.kind?n("pageview",a):(o.push(a),n("click_pageview",a));break}return o.length>0&&(r=function(e){for(var t=function(e,n){for(var t=[],r=0;r<n.length;r++)for(var o=e.target,i=n[r],a=i.selector,u=document.querySelectorAll(a);o&&u.length>0;){for(var s=0;s<u.length;s++)o===u[s]&&t.push(i);o=o.parentNode}return t}(e,o),r=0;r<t.length;r++)n("click",t[r])},document.addEventListener("click",r)),t.dispose=function(){document.removeEventListener("click",r)},t}function ze(e,n){var t,r;function o(){r&&r.dispose(),t&&t.length&&(r=Je(t,i))}function i(n,t){var r=e.ident.getUser(),o={kind:n,key:t.key,data:null,url:window.location.href,user:r,creationDate:(new Date).getTime()};return r&&r.anonymous&&(o.contextKind="anonymousUser"),"click"===n&&(o.selector=t.selector),e.enqueueEvent(o)}return e.requestor.fetchJSON("/sdk/goals/"+e.getEnvironmentId()).then((function(e){e&&e.length>0&&(r=Je(t=e,i),function(e,n){var t,r=window.location.href;function o(){(t=window.location.href)!==r&&(r=t,n())}!function e(n,t){n(),setTimeout((function(){e(n,t)}),t)}(o,e),window.history&&window.history.pushState?window.addEventListener("popstate",o):window.addEventListener("hashchange",o)}(300,o)),n()})).catch((function(t){e.emitter.maybeReportError(new d.LDUnexpectedResponseError((t&&t.message,t.message))),n()})),{}}var Me={fetchGoals:{default:!0},hash:{type:"string"},eventProcessor:{type:"object"},eventUrlTransformer:{type:"function"},disableSyncEventPost:{default:!1}};function Ke(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=Ae(t),o=Te(e,n,t,r,Me),i=o.client,a=o.options,u=o.emitter,s=new Promise((function(e){var n=u.on("goalsReady",(function(){u.off("goalsReady",n),e()}))}));i.waitUntilGoalsReady=function(){return s},a.fetchGoals?ze(o,(function(){return u.emit("goalsReady")})):u.emit("goalsReady"),"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();var c=function(){r.synchronousFlush=!0,i.flush().catch((function(){})),r.synchronousFlush=!1};return window.addEventListener("beforeunload",c),window.addEventListener("unload",c),i}var $e=Ie,He="2.19.4";var Be={initialize:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(ke.deprecated("default export","named LDClient export")),Ke(e,n,t)},version:"2.19.4"};export default Be;export{$e as createConsoleLogger,Ke as initialize,He as version};
function e(n){return(e="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})(n)}function n(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function t(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 r(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?t(o,!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(o).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(o,n))}))}return e}function o(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 i=o("LaunchDarklyUnexpectedResponseError"),a=o("LaunchDarklyInvalidEnvironmentIdError"),u=o("LaunchDarklyInvalidUserError"),s=o("LaunchDarklyInvalidEventKeyError"),c=o("LaunchDarklyInvalidArgumentError"),l=o("LaunchDarklyFlagFetchError");function f(e){return!(e>=400&&e<500)||400===e||408===e||429===e}for(var v=Object.freeze({__proto__:null,LDUnexpectedResponseError:i,LDInvalidEnvironmentIdError:a,LDInvalidUserError:u,LDInvalidEventKeyError:s,LDInvalidArgumentError:c,LDFlagFetchError:l,isHttpErrorRecoverable:f}),d=[],g=[],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",m=0,h=p.length;m<h;++m)d[m]=p[m],g[p.charCodeAt(m)]=m;function y(e,n,t){for(var r,o,i=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(d[(o=r)>>18&63]+d[o>>12&63]+d[o>>6&63]+d[63&o]);return i.join("")}g["-".charCodeAt(0)]=62,g["_".charCodeAt(0)]=63;var w=Array.isArray,b=Object.keys,k=Object.prototype.hasOwnProperty,E=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function S(e){return function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(y(e,i,i+16383>a?a:i+16383));return 1===r?(n=e[t-1],o.push(d[n>>2]+d[n<<4&63]+"==")):2===r&&(n=(e[t-2]<<8)+e[t-1],o.push(d[n>>10]+d[n>>4&63]+d[n<<2&63]+"=")),o.join("")}(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(unescape(encodeURIComponent(e))))}function D(e){return S(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function O(e){return JSON.parse(JSON.stringify(e))}function P(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,o,i,a=w(n),u=w(t);if(a&&u){if((o=n.length)!=t.length)return!1;for(r=o;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=b(n);if((o=v.length)!==b(t).length)return!1;for(r=o;0!=r--;)if(!k.call(t,v[r]))return!1;for(r=o;0!=r--;)if(!e(n[i=v[r]],t[i]))return!1;return!0}return n!=n&&t!=t}(e,n)}function U(e){setTimeout(e,0)}function I(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 R(e){var n={};for(var t in e)F(e,t)&&(n[t]={value:e[t],version:0});return n}function j(e){var n={};for(var t in e)F(e,t)&&(n[t]=e[t].value);return n}function T(e,n){for(var t,r=n.slice(0),o=[],i=e;r.length>0;){for(t=[];i>0;){var a=r.shift();if(!a)break;(i-=D(JSON.stringify(a)).length)<0&&t.length>0?r.unshift(a):t.push(a)}i=e,o.push(t)}return o}function N(e){var n=e.version||"3.4.0-alpha.1";return e.userAgent+"/"+n}function A(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":N(e)};return n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t}function L(e,n){return n&&n.requestHeaderTransform?n.requestHeaderTransform(r({},e)):e}function C(){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 r({},e,{},n)}),{})}function F(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function x(e){if(!e)return e;var n;for(var t in E){var o=E[t],i=e[o];void 0!==i&&"string"!=typeof i&&((n=n||r({},e))[o]=String(i))}return n||e}Object.freeze({__proto__:null,btoa:S,base64URLEncode:D,clone:O,deepEquals:P,onNextTick:U,wrapPromiseCallback:I,transformValuesToVersionedValues:R,transformVersionedValuesToValues:j,chunkUserEventsForUrl:T,getLDUserAgentString:N,getLDHeaders:A,transformHeaders:L,extend:C,objectHasOwnProperty:F,sanitizeUser:x});var q=require("uuid").v1;function _(e,n,t){var r="/a/"+n+".gif",o=C({"Content-Type":"application/json"},A(e,t)),i=e.httpFallbackPing,a={sendChunk:function(n,a,u,s){var c=JSON.stringify(n),l=u?null:q();return s?function n(r){var i=u?o:C({},o,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":l});return e.httpRequest("POST",a,L(i,t),c).promise.then((function(e){if(e)return e.status>=400&&f(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(){})):(i&&i(a+r+"?d="+D(c)),Promise.resolve())},sendEvents:function(n,t,r){if(!e.httpRequest)return Promise.resolve();var o,i=e.httpAllowsPost();o=i?[n]:T(2e3-t.length,n);for(var u=[],s=0;s<o.length;s++)u.push(a.sendChunk(o[s],t,r,i));return Promise.all(u)}};return a}function V(){var e={},n=0,t=0,r={};return e.summarizeEvent=function(e){if("feature"===e.kind){var o=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),i=r[o];i?i.count=i.count+1:r[o]={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={},o=!0;for(var i in r){var a=r[i],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),o=!1}return o?null:{startDate:n,endDate:t,features:e}},e.clearSummary=function(){n=0,t=0,r={}},e}function J(e){var n={},t=e.allAttributesPrivate,r=e.privateAttributeNames||[],o={key:!0,custom:!0,anonymous:!0},i={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,i){return Object.keys(e).reduce((function(a,u){var s=a;return i(u)&&(function(e){return!o[e]&&(t||-1!==n.indexOf(e)||-1!==r.indexOf(e))}(u)?s[1][u]=!0:s[0][u]=e[u]),s}),[{},{}])},u=a(e,(function(e){return i[e]})),s=u[0],c=u[1];if(e.custom){var l=a(e.custom,(function(){return!0}));s.custom=l[0],c=C({},c,l[1])}var f=Object.keys(c);return f.length&&(f.sort(),s.privateAttrs=f),s},n}function M(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var z=" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initializing-the-client for instructions on SDK initialization.",H=function(e){return'Expected application/json content type but got "'+e+'"'},K=function(e){return"network error"+(e?" ("+e+")":"")},$=function(e){return'Custom event "'+e+'" does not exist'},B=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+z},G=function(){return"No environment/client-side ID was specified."+z},X=function(e){return"Error fetching flag settings: "+M(e)},W=function(){return"No user specified."+z},Q=function(){return"Invalid user specified."+z},Y=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+z},Z=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},ee=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(f(e)?t:"giving up permanently")},ne=function(){return"Cannot make HTTP requests in this environment."+z},te=function(e){return"Opening stream connection to "+e},re=function(e,n){return"Error on stream connection: "+M(e)+", will continue retrying every "+n+" milliseconds."},oe=function(e){return'Ignoring unknown config option "'+e+'"'},ie=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},ae=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},se=function(e){return"polling for feature flags at "+e},ce=function(e){return'received streaming update for flag "'+e+'"'},le=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+'"'},ve=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},de=function(e){return'enqueueing "'+e+'" event'},ge=function(e){return"sending "+e+" events"},pe=Object.freeze({__proto__:null,clientInitialized:function(){return"LaunchDarkly client initialized"},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:H,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:function(){return"localStorage is unavailable"},localStorageUnavailableForUserId:function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},networkError:K,unknownCustomEventKey:$,environmentNotFound:B,environmentNotSpecified:G,errorFetchingFlags:X,userNotSpecified:W,invalidUser:Q,bootstrapOldFormat:Y,bootstrapInvalid:function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},deprecated:Z,httpErrorMessage:ee,httpUnavailable:ne,identifyDisabled:function(){return"identify() has no effect here; it must be called on the main client instance"},streamClosing:function(){return"Closing stream connection"},streamConnecting:te,streamError:re,unknownOption:oe,wrongOptionType:ie,wrongOptionTypeBoolean:ae,optionBelowMinimum:ue,debugPolling:se,debugStreamPing:function(){return"received ping message from stream"},debugStreamPut:function(){return"received streaming update for all flags"},debugStreamPatch:ce,debugStreamPatchIgnored:le,debugStreamDelete:fe,debugStreamDeleteIgnored:ve,debugEnqueueingEvent:de,debugPostingEvents:ge,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"}});function me(e,n,t,r,o){var i={};function a(){var e="",o=r.getUser();return o&&(e=t||S(JSON.stringify(o))),"ld:"+n+":"+e}return i.loadFlags=function(){return e.get(a()).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=R(n):delete n.$schema}return n}catch(e){return i.clearFlags().then((function(){return Promise.reject(e)}))}})).catch((function(e){return o.warn("localStorage is unavailable"),Promise.reject(e)}))},i.saveFlags=function(n){var t=C({},n,{$schema:1});return e.set(a(),JSON.stringify(t)).catch((function(e){return o.warn("localStorage is unavailable"),Promise.reject(e)}))},i.clearFlags=function(){return e.clear(a()).catch((function(e){return o.warn("localStorage is unavailable"),Promise.reject(e)}))},i}function he(e,n,t,r){var o,i=n.streamUrl,a=n.logger,u={},s=i+"/eval/"+t,c=n.useReport,l=n.evaluationReasons,f=n.streamReconnectDelay,v=A(e,n),d=!1,g=null,p=null,m=null,h=null,y=null;function w(e){d||(a.warn(re(e,f)),d=!0),S(!1),E(),b(f)}function b(e){p||(e?p=setTimeout(k,e):k())}function k(){var r;p=null;var u="",f={headers:v,readTimeoutMillis:3e5};if(e.eventSourceFactory){for(var d in null!=h&&(u="h="+h),c?e.eventSourceAllowsReport?(r=s,f.method="REPORT",f.headers["Content-Type"]="application/json",f.body=JSON.stringify(m)):(r=i+"/ping/"+t,u=""):r=s+"/"+D(JSON.stringify(m)),f.headers=L(f.headers,n),l&&(u=u+(u?"&":"")+"withReasons=true"),r=r+(u?"?":"")+u,E(),a.info(te(r)),o=(new Date).getTime(),g=e.eventSourceFactory(r,f),y)F(y,d)&&g.addEventListener(d,y[d]);g.onerror=w}}function E(){g&&(a.info("Closing stream connection"),g.close(),g=null)}function S(e){o&&r&&r.recordStreamInit(o,!e,(new Date).getTime()-o),o=null}return u.connect=function(e,n,t){m=e,h=n,y={};var r=function(e){y[e]=function(n){d=!1,S(!0),t[e]&&t[e](n)}};for(var o in t||{})r(o);b()},u.disconnect=function(){clearTimeout(p),p=null,E()},u.isConnected=function(){return!!(g&&e.eventSourceIsActive&&e.eventSourceIsActive(g))},u}function ye(e,n,t){var r=n.baseUrl,o=n.useReport,i=n.evaluationReasons,u=n.logger,s={},c={};function f(t,r){if(!e.httpRequest)return new Promise((function(e,n){n(new l(ne()))}));var o=r?"REPORT":"GET",i=A(e,n);r&&(i["Content-Type"]="application/json");var u=c[t];u||(u=function(e){var n,t,r,o,i={addPromise:function(i,a){n=i,t&&t(),t=a,i.then((function(t){n===i&&(r(t),e&&e())}),(function(t){n===i&&(o(t),e&&e())}))}};return i.resultPromise=new Promise((function(e,n){r=e,o=n})),i}((function(){delete c[t]})),c[t]=u);var s=e.httpRequest(o,t,L(i,n),r),f=s.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=H(e.header("content-type")||"");return Promise.reject(new l(n))}return Promise.reject(function(e){return 404===e.status?new a(B()):new l(X(e.statusText||String(e.status)))}(e))}),(function(e){return Promise.reject(new l(K(e)))}));return u.addPromise(f,(function(){s.cancel&&s.cancel()})),u.resultPromise}return s.fetchJSON=function(e){return f(r+e,null)},s.fetchFlagSettings=function(e,n){var a,s,c,l="";return o?(s=[r,"/sdk/evalx/",t,"/user"].join(""),c=JSON.stringify(e)):(a=D(JSON.stringify(e)),s=[r,"/sdk/evalx/",t,"/users/",a].join("")),n&&(l="h="+n),i&&(l=l+(l?"&":"")+"withReasons=true"),s=s+(l?"?":"")+l,u.debug(se(s)),f(s,c)},s}var we=require("uuid").v1;function be(e,n){var t={validateUser:function(t){if(!t)return Promise.reject(new u(W()));var r=O(t);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(e?e.get("ld:$anonUserId").catch((function(){return null})):Promise.resolve(null)).then((function(t){if(t)return r.key=t,r;var o=we();return r.key=o,function(t){return e?e.set("ld:$anonUserId",t).catch((function(){n.warn("localStorage is unavailable, so anonymous user ID cannot be cached")})):Promise.resolve()}(o).then((function(){return r}))})):Promise.reject(new u(Q()))}};return t}var 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}};function Ee(n,t,r,o){var i=C({logger:{default:o}},ke,r),a={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function u(e){U((function(){t&&t.maybeReportError(new c(e))}))}var s=C({},n||{});return function(e){var n=e;Object.keys(a).forEach((function(e){if(void 0!==n[e]){var t=a[e];o&&o.warn(Z(e,t)),t&&(void 0===n[t]&&(n[t]=n[e]),delete n[e])}}))}(s),function(n){var t=C({},n),r=function(n){if(null===n)return"any";if(void 0!==n){if(Array.isArray(n))return"array";var t=e(n);return"boolean"===t||"string"===t||"number"===t||"function"===t?t:"object"}};return Object.keys(n).forEach((function(e){var o=n[e];if(null!=o){var a=i[e];if(void 0===a)u(oe(e));else{var s=a.type||r(a.default);if("any"!==s){var c=s.split("|"),l=r(o);c.indexOf(l)<0?"boolean"===s?(t[e]=!!o,u(ae(e,l))):(u(ie(e,s,l)),t[e]=a.default):"number"===l&&void 0!==a.minimum&&o<a.minimum&&(u(ue(e,o,a.minimum)),t[e]=a.minimum)}}}})),t}(s=function(e){var n=C({},e);return Object.keys(i).forEach((function(e){void 0!==n[e]&&null!==n[e]||(n[e]=i[e]&&i[e].default)})),n}(s))}var Se,De=Object.freeze({__proto__:null,baseOptionDefs:ke,validate:Ee}),Oe=new Uint8Array(16);function Pe(){if(!Se&&!(Se="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Se(Oe)}var Ue=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Ie(e){return"string"==typeof e&&Ue.test(e)}for(var Re,je,Te=[],Ne=0;Ne<256;++Ne)Te.push((Ne+256).toString(16).substr(1));function Ae(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=(Te[e[n+0]]+Te[e[n+1]]+Te[e[n+2]]+Te[e[n+3]]+"-"+Te[e[n+4]]+Te[e[n+5]]+"-"+Te[e[n+6]]+Te[e[n+7]]+"-"+Te[e[n+8]]+Te[e[n+9]]+"-"+Te[e[n+10]]+Te[e[n+11]]+Te[e[n+12]]+Te[e[n+13]]+Te[e[n+14]]+Te[e[n+15]]).toLowerCase();if(!Ie(t))throw TypeError("Stringified UUID is invalid");return t}var Le=0,Ce=0;function Fe(e){if(!Ie(e))throw TypeError("Invalid UUID");var n,t=new Uint8Array(16);return t[0]=(n=parseInt(e.slice(0,8),16))>>>24,t[1]=n>>>16&255,t[2]=n>>>8&255,t[3]=255&n,t[4]=(n=parseInt(e.slice(9,13),16))>>>8,t[5]=255&n,t[6]=(n=parseInt(e.slice(14,18),16))>>>8,t[7]=255&n,t[8]=(n=parseInt(e.slice(19,23),16))>>>8,t[9]=255&n,t[10]=(n=parseInt(e.slice(24,36),16))/1099511627776&255,t[11]=n/4294967296&255,t[12]=n>>>24&255,t[13]=n>>>16&255,t[14]=n>>>8&255,t[15]=255&n,t}function xe(e,n,t){function r(e,r,o,i){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var n=[],t=0;t<e.length;++t)n.push(e.charCodeAt(t));return n}(e)),"string"==typeof r&&(r=Fe(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var a=new Uint8Array(16+e.length);if(a.set(r),a.set(e,r.length),(a=t(a))[6]=15&a[6]|n,a[8]=63&a[8]|128,o){i=i||0;for(var u=0;u<16;++u)o[i+u]=a[u];return o}return Ae(a)}try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}function qe(e){return 14+(e+64>>>9<<4)+1}function _e(e,n){var t=(65535&e)+(65535&n);return(e>>16)+(n>>16)+(t>>16)<<16|65535&t}function Ve(e,n,t,r,o,i){return _e((a=_e(_e(n,e),_e(r,i)))<<(u=o)|a>>>32-u,t);var a,u}function Je(e,n,t,r,o,i,a){return Ve(n&t|~n&r,e,n,o,i,a)}function Me(e,n,t,r,o,i,a){return Ve(n&r|t&~r,e,n,o,i,a)}function ze(e,n,t,r,o,i,a){return Ve(n^t^r,e,n,o,i,a)}function He(e,n,t,r,o,i,a){return Ve(t^(n|~r),e,n,o,i,a)}var Ke=xe("v3",48,(function(e){if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=new Uint8Array(n.length);for(var t=0;t<n.length;++t)e[t]=n.charCodeAt(t)}return function(e){for(var n=[],t=32*e.length,r=0;r<t;r+=8){var o=e[r>>5]>>>r%32&255,i=parseInt("0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o),16);n.push(i)}return n}(function(e,n){e[n>>5]|=128<<n%32,e[qe(n)-1]=n;for(var t=1732584193,r=-271733879,o=-1732584194,i=271733878,a=0;a<e.length;a+=16){var u=t,s=r,c=o,l=i;t=Je(t,r,o,i,e[a],7,-680876936),i=Je(i,t,r,o,e[a+1],12,-389564586),o=Je(o,i,t,r,e[a+2],17,606105819),r=Je(r,o,i,t,e[a+3],22,-1044525330),t=Je(t,r,o,i,e[a+4],7,-176418897),i=Je(i,t,r,o,e[a+5],12,1200080426),o=Je(o,i,t,r,e[a+6],17,-1473231341),r=Je(r,o,i,t,e[a+7],22,-45705983),t=Je(t,r,o,i,e[a+8],7,1770035416),i=Je(i,t,r,o,e[a+9],12,-1958414417),o=Je(o,i,t,r,e[a+10],17,-42063),r=Je(r,o,i,t,e[a+11],22,-1990404162),t=Je(t,r,o,i,e[a+12],7,1804603682),i=Je(i,t,r,o,e[a+13],12,-40341101),o=Je(o,i,t,r,e[a+14],17,-1502002290),t=Me(t,r=Je(r,o,i,t,e[a+15],22,1236535329),o,i,e[a+1],5,-165796510),i=Me(i,t,r,o,e[a+6],9,-1069501632),o=Me(o,i,t,r,e[a+11],14,643717713),r=Me(r,o,i,t,e[a],20,-373897302),t=Me(t,r,o,i,e[a+5],5,-701558691),i=Me(i,t,r,o,e[a+10],9,38016083),o=Me(o,i,t,r,e[a+15],14,-660478335),r=Me(r,o,i,t,e[a+4],20,-405537848),t=Me(t,r,o,i,e[a+9],5,568446438),i=Me(i,t,r,o,e[a+14],9,-1019803690),o=Me(o,i,t,r,e[a+3],14,-187363961),r=Me(r,o,i,t,e[a+8],20,1163531501),t=Me(t,r,o,i,e[a+13],5,-1444681467),i=Me(i,t,r,o,e[a+2],9,-51403784),o=Me(o,i,t,r,e[a+7],14,1735328473),t=ze(t,r=Me(r,o,i,t,e[a+12],20,-1926607734),o,i,e[a+5],4,-378558),i=ze(i,t,r,o,e[a+8],11,-2022574463),o=ze(o,i,t,r,e[a+11],16,1839030562),r=ze(r,o,i,t,e[a+14],23,-35309556),t=ze(t,r,o,i,e[a+1],4,-1530992060),i=ze(i,t,r,o,e[a+4],11,1272893353),o=ze(o,i,t,r,e[a+7],16,-155497632),r=ze(r,o,i,t,e[a+10],23,-1094730640),t=ze(t,r,o,i,e[a+13],4,681279174),i=ze(i,t,r,o,e[a],11,-358537222),o=ze(o,i,t,r,e[a+3],16,-722521979),r=ze(r,o,i,t,e[a+6],23,76029189),t=ze(t,r,o,i,e[a+9],4,-640364487),i=ze(i,t,r,o,e[a+12],11,-421815835),o=ze(o,i,t,r,e[a+15],16,530742520),t=He(t,r=ze(r,o,i,t,e[a+2],23,-995338651),o,i,e[a],6,-198630844),i=He(i,t,r,o,e[a+7],10,1126891415),o=He(o,i,t,r,e[a+14],15,-1416354905),r=He(r,o,i,t,e[a+5],21,-57434055),t=He(t,r,o,i,e[a+12],6,1700485571),i=He(i,t,r,o,e[a+3],10,-1894986606),o=He(o,i,t,r,e[a+10],15,-1051523),r=He(r,o,i,t,e[a+1],21,-2054922799),t=He(t,r,o,i,e[a+8],6,1873313359),i=He(i,t,r,o,e[a+15],10,-30611744),o=He(o,i,t,r,e[a+6],15,-1560198380),r=He(r,o,i,t,e[a+13],21,1309151649),t=He(t,r,o,i,e[a+4],6,-145523070),i=He(i,t,r,o,e[a+11],10,-1120210379),o=He(o,i,t,r,e[a+2],15,718787259),r=He(r,o,i,t,e[a+9],21,-343485551),t=_e(t,u),r=_e(r,s),o=_e(o,c),i=_e(i,l)}return[t,r,o,i]}(function(e){if(0===e.length)return[];for(var n=8*e.length,t=new Uint32Array(qe(n)),r=0;r<n;r+=8)t[r>>5]|=(255&e[r/8])<<r%32;return t}(e),8*e.length))}));function $e(e,n,t,r){switch(e){case 0:return n&t^~n&r;case 1:return n^t^r;case 2:return n&t^n&r^t&r;case 3:return n^t^r}}function Be(e,n){return e<<n|e>>>32-n}var Ge=xe("v5",80,(function(e){var n=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=[];for(var o=0;o<r.length;++o)e.push(r.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var i=e.length/4+2,a=Math.ceil(i/16),u=new Array(a),s=0;s<a;++s){for(var c=new Uint32Array(16),l=0;l<16;++l)c[l]=e[64*s+4*l]<<24|e[64*s+4*l+1]<<16|e[64*s+4*l+2]<<8|e[64*s+4*l+3];u[s]=c}u[a-1][14]=8*(e.length-1)/Math.pow(2,32),u[a-1][14]=Math.floor(u[a-1][14]),u[a-1][15]=8*(e.length-1)&4294967295;for(var f=0;f<a;++f){for(var v=new Uint32Array(80),d=0;d<16;++d)v[d]=u[f][d];for(var g=16;g<80;++g)v[g]=Be(v[g-3]^v[g-8]^v[g-14]^v[g-16],1);for(var p=t[0],m=t[1],h=t[2],y=t[3],w=t[4],b=0;b<80;++b){var k=Math.floor(b/20),E=Be(p,5)+$e(k,m,h,y)+w+n[k]+v[b]>>>0;w=y,y=h,h=Be(m,30)>>>0,m=p,p=E}t[0]=t[0]+p>>>0,t[1]=t[1]+m>>>0,t[2]=t[2]+h>>>0,t[3]=t[3]+y>>>0,t[4]=t[4]+w>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,255&t[0],t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,255&t[1],t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,255&t[2],t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,255&t[3],t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,255&t[4]]})),Xe=Object.freeze({__proto__:null,v1:function(e,n,t){var r=n&&t||0,o=n||new Array(16),i=(e=e||{}).node||Re,a=void 0!==e.clockseq?e.clockseq:je;if(null==i||null==a){var u=e.random||(e.rng||Pe)();null==i&&(i=Re=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=je=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:Date.now(),c=void 0!==e.nsecs?e.nsecs:Ce+1,l=s-Le+(c-Ce)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||s>Le)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Le=s,Ce=c,je=a;var f=(1e4*(268435455&(s+=122192928e5))+c)%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=255&f;var v=s/4294967296*1e4&268435455;o[r++]=v>>>8&255,o[r++]=255&v,o[r++]=v>>>24&15|16,o[r++]=v>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var d=0;d<6;++d)o[r+d]=i[d];return n||Ae(o)},v3:Ke,v4:function(e,n,t){var r=(e=e||{}).random||(e.rng||Pe)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,n){t=t||0;for(var o=0;o<16;++o)n[t+o]=r[o];return n}return Ae(r)},v5:Ge,NIL:"00000000-0000-0000-0000-000000000000",version:function(e){if(!Ie(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)},validate:Ie,stringify:Ae,parse:Fe}).v1,We=De.baseOptionDefs;function Qe(e,n){var t,r=["debug","info","warn","error"];t=null!=n?""===n?"":n+" ":"LD: ";var o=0;e&&(o="none"===e?100:r.indexOf(e));var i={};function a(e,n,i){if(e>=o&&console){var a=console[n];if(a){var u=e<r.length?r[e]:"?";a.call(console,t+"["+u+"] "+i)}}}return i.debug=function(e){return a(0,"log",e)},i.info=function(e){return a(1,"info",e)},i.warn=function(e){return a(2,"warn",e)},i.error=function(e){return a(3,"error",e)},i}function Ye(n,t,o,u,c){var v,d,g,p,m=o&&o.logger?o.logger:c&&c.logger&&c.logger.default||Qe("warn"),h=function(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 o=0;o<t[e].length;o++)t[e][o].handler===n&&t[e][o].context===r&&(t[e]=t[e].slice(0,o).concat(t[e].slice(o+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}(m),y=function(e){var n=!1,t=!1,r=null,o=null,i=new Promise((function(n){e.on("ready",(function t(){e.off("ready",t),n()}))})).catch((function(){}));return{getInitializationPromise:function(){return o||(n?Promise.resolve():t?Promise.reject(r):o=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 i},signalSuccess:function(){n||t||(n=!0,e.emit("initialized"),e.emit("ready"))},signalFailure:function(o){n||t||(t=!0,r=o,e.emit("failed",o),e.emit("ready")),e.maybeReportError(o)}}}(h),w=Ee(o,h,c,m),b=w.sendEvents,k=n,E=w.hash,S=_(u,k,w),D=w.sendEvents&&!w.diagnosticOptOut,R=D?function(e){var n={diagnosticId:Xe()};return e&&(n.sdkKeySuffix=e.length>6?e.substring(e.length-6):e),n}(k):null,T=D?function(e){var n,t,r,o;function i(e){n=e,t=0,r=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){var r={timestamp:e,failed:n,durationMillis:t};o.push(r)},reset:i}}((new Date).getTime()):null,N=D?function(e,n,t,o,i,a){var u,s,c=!!e.diagnosticUseCombinedEvent,l="ld:"+o+":$diagnostics",f=i.eventsUrl+"/events/diagnostic/"+o,v=i.diagnosticRecordingInterval,d=n,g=!!i.streaming,p={};function m(){return{sdk:w(),configuration:(n={customBaseURI:i.baseUrl!==We.baseUrl.default,customStreamURI:i.streamUrl!==We.streamUrl.default,customEventsURI:i.eventsUrl!==We.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,allowFrequentDuplicateEvents:!!i.allowFrequentDuplicateEvents,sendEventsOnlyForVariation:!!i.sendEventsOnlyForVariation,autoAliasingOptOut:!!i.autoAliasingOptOut},n),platform:e.diagnosticPlatformData};var n}function h(e){i.logger&&i.logger.debug(pe.debugPostingDiagnosticEvent(e)),t.sendEvents(e,f,!0).then((function(){})).catch((function(){}))}function y(){var n,t;h((n=(new Date).getTime(),t=r({kind:c?"diagnostic-combined":"diagnostic",id:a,creationDate:n},d.getProps()),c&&(t=r({},t,{},m())),d.reset(n),t)),s=setTimeout(y,v),u=(new Date).getTime(),c&&function(){if(e.localStorage){var n=r({},d.getProps());e.localStorage.set(l,JSON.stringify(n),(function(){}))}}()}function w(){var n=r({},e.diagnosticSdkData);return i.wrapperName&&(n.wrapperName=i.wrapperName),i.wrapperVersion&&(n.wrapperVersion=i.wrapperVersion),n}return p.start=function(){c?function(n){if(!e.localStorage)return n(!1);e.localStorage.get(l).then((function(e){if(e)try{var t=JSON.parse(e);d.setProps(t),u=t.dataSinceDate}catch(e){}n(!0)})).catch((function(){n(!1)}))}((function(e){if(e){var n=(u||0)+v,t=(new Date).getTime();t>=n?y():s=setTimeout(y,n-t)}else 0===Math.floor(4*Math.random())?y():s=setTimeout(y,v)})):(h(r({kind:"diagnostic-init",id:a,creationDate:d.getProps().dataSinceDate},m())),s=setTimeout(y,v))},p.stop=function(){s&&clearTimeout(s)},p.setStreaming=function(e){g=e},p}(u,T,S,k,w,R):null,A=he(u,w,k,T),L=w.eventProcessor||function(e,n,t){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s={},c=u||_(e,t,n),l=n.eventsUrl+"/events/bulk/"+t,v=V(),d=J(n),g=n.inlineUsersInEvents,p=n.samplingInterval,m=n.eventCapacity,h=n.flushInterval,y=n.logger,w=[],b=0,k=!1,E=!1;function S(){return 0===p||0===Math.floor(Math.random()*p)}function D(e){return!!e.debugEventsUntilDate&&e.debugEventsUntilDate>b&&e.debugEventsUntilDate>(new Date).getTime()}function O(e){var n=C({},e);return"alias"===e.kind||(g||"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){w.length<m?(w.push(e),E=!1):(E||(E=!0,y.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),o&&o.incrementDroppedEvents())}return s.enqueue=function(e){if(!k){var n=!1,t=!1;if(v.summarizeEvent(e),"feature"===e.kind?S()&&(n=!!e.trackEvents,t=D(e)):n=S(),n&&P(O(e)),t){var r=C({},e,{kind:"debug"});r.user=d.filterUser(r.user),delete r.trackEvents,delete r.debugEventsUntilDate,P(r)}}},s.flush=function(){if(k)return Promise.resolve();var e=w,n=v.getSummary();return v.clearSummary(),n&&(n.kind="summary",e.push(n)),o&&o.setEventsInLastBatch(e.length),0===e.length?Promise.resolve():(w=[],y.debug(ge(e.length)),c.sendEvents(e,l).then((function(e){e&&(e.serverTime&&(b=e.serverTime),f(e.status)||(k=!0),e.status>=400&&U((function(){a.maybeReportError(new i(ee(e.status,"event posting","some events were dropped")))})))})))},s.start=function(){r=setTimeout((function e(){s.flush(),r=setTimeout(e,h)}),h)},s.stop=function(){clearTimeout(r)},s}(u,w,k,T,h,S),q=ye(u,w,k),M={},z={},H=w.streaming,K=!1,B=!1,W=!0,Q=w.stateProvider,Z=function(e,n){var t,r={setUser:function(e){var r=t&&O(t);(t=x(e))&&n&&n(O(t),r)},getUser:function(){return t?O(t):null}};return r}(0,(function(e,n){(function(e){Q||e&&te({kind:"identify",key:e.key,user:e,creationDate:(new Date).getTime()})})(e),!w.autoAliasingOptOut&&n&&n.anonymous&&e&&!e.anonymous&&ue(e,n)})),ne=be(u.localStorage,m);function te(e){if(k&&!(Q&&Q.enqueueEvent&&Q.enqueueEvent(e))){if("alias"!==e.kind){if(!e.user)return void(W&&(m.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"),W=!1));W=!1}!b||B||u.isDoNotTrack()||(m.debug(de(e.kind)),L.enqueue(e))}}function re(e,n,t,r){var o=Z.getUser(),i=new Date,a=n?n.value:null;if(!w.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,s=M[u];if(s&&i-s<3e5)return;M[u]=i}var c={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()};o&&o.anonymous&&(c.contextKind=ae(o));var l=z[e];l&&(c.version=l.flagVersion?l.flagVersion:l.version,c.trackEvents=l.trackEvents,c.debugEventsUntilDate=l.debugEventsUntilDate),(r||l&&l.trackReason)&&n&&(c.reason=n.reason),te(c)}function oe(e,n,t,r){var o;if(z&&F(z,e)&&z[e]&&!z[e].deleted){var i=z[e];o=ie(i),null!==i.value&&void 0!==i.value||(o.value=n)}else o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&re(e,o,n,r),o}function ie(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){Q||e&&n&&te({kind:"alias",key:e.key,contextKind:ae(e),previousKey:n.key,previousContextKind:ae(n),creationDate:(new Date).getTime()})}function se(){d=!0,Z.getUser()&&A.connect(Z.getUser(),E,{ping:function(){m.debug("received ping message from stream");var e=Z.getUser();q.fetchFlagSettings(e,E).then((function(n){P(e,Z.getUser())&&ke(n||{})})).catch((function(e){h.maybeReportError(new l(X(e)))}))},put:function(e){var n=JSON.parse(e.data);m.debug("received streaming update for all flags"),ke(n)},patch:function(e){var n=JSON.parse(e.data),t=z[n.key];if(!t||!t.version||!n.version||t.version<n.version){m.debug(ce(n.key));var r={},o=C({},n);delete o.key,z[n.key]=o;var i=ie(o);r[n.key]=t?{previous:t.value,current:i}:{current:i},Se(r)}else m.debug(le(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!z[n.key]||z[n.key].version<n.version){m.debug(fe(n.key));var t={};z[n.key]&&!z[n.key].deleted&&(t[n.key]={previous:z[n.key].value}),z[n.key]={version:n.version,deleted:!0},Se(t)}else m.debug(ve(n.key))}})}function we(){d&&(A.disconnect(),d=!1)}function ke(e){var n={};if(!e)return Promise.resolve();for(var t in z)F(z,t)&&z[t]&&(e[t]&&!P(e[t].value,z[t].value)?n[t]={previous:z[t].value,current:ie(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:z[t].value}));for(var o in e)F(e,o)&&e[o]&&(!z[o]||z[o].deleted)&&(n[o]={current:ie(e[o])});return z=r({},e),Se(n).catch((function(){}))}function Se(e){var n=Object.keys(e);if(n.length>0){var t={};n.forEach((function(n){var r=e[n].current,o=r?r.value:void 0,i=e[n].previous;h.emit("change:"+n,o,i),t[n]=r?{current:o,previous:i}:{previous:i}})),h.emit("change",t),h.emit("internal-change",z),w.sendEventsOnlyForVariation||Q||n.forEach((function(n){re(n,e[n].current)}))}return v&&p?p.saveFlags(z).catch((function(){return null})):Promise.resolve()}function De(){var e=H||g&&void 0===H;e&&!d?se():!e&&d&&we(),N&&N.setStreaming(e)}function Oe(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}if(u.localStorage&&(p=new me(u.localStorage,k,E,Z,m)),"string"==typeof w.bootstrap&&"LOCALSTORAGE"===w.bootstrap.toUpperCase()&&(p?v=!0:m.warn("localStorage is unavailable")),"object"===e(w.bootstrap)&&(z=function(e){var n=Object.keys(e),t=e.$flagsState;!t&&n.length&&m.warn(Y()),!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 o={value:e[n]};t&&t[n]?o=C(o,t[n]):o.version=0,r[n]=o}})),r}(w.bootstrap)),Q){var Pe=Q.getInitialState();Pe?Ue(Pe):Q.on("init",Ue),Q.on("update",(function(e){e.user&&Z.setUser(e.user),e.flags&&ke(e.flags)}))}else(n?ne.validateUser(t).then((function(n){return Z.setUser(n),"object"===e(w.bootstrap)?Ie():v?p.loadFlags().catch((function(){return null})).then((function(e){return null==e?(z={},q.fetchFlagSettings(Z.getUser(),E).then((function(e){return ke(e||{})})).then(Ie).catch((function(e){Re(new l(X(e)))}))):(z=e,U(Ie),q.fetchFlagSettings(Z.getUser(),E).then((function(e){return ke(e)})).catch((function(e){return h.maybeReportError(e)})))})):q.fetchFlagSettings(Z.getUser(),E).then((function(e){z=e||{},Ie()})).catch((function(e){z={},Re(e)}))})):Promise.reject(new a(G()))).catch(Re);function Ue(e){k=e.environment,Z.setUser(e.user),z=r({},e.flags),U(Ie)}function Ie(){m.info("LaunchDarkly client initialized"),K=!0,De(),y.signalSuccess()}function Re(e){y.signalFailure(e)}return{client:{waitForInitialization:function(){return y.getInitializationPromise()},waitUntilReady:function(){return y.getReadyPromise()},identify:function(e,n,t){return B?I(Promise.resolve({}),t):Q?(m.warn("identify() has no effect here; it must be called on the main client instance"),I(Promise.resolve(j(z)),t)):I((v&&p?p.clearFlags():Promise.resolve()).then((function(){return ne.validateUser(e)})).then((function(e){return q.fetchFlagSettings(e,n).then((function(t){var r=j(t);return Z.setUser(e),E=n,t?ke(t).then((function(){return r})):r}))})).then((function(e){return d&&se(),e})).catch((function(e){return h.maybeReportError(e),Promise.reject(e)})),t)},getUser:function(){return Z.getUser()},variation:function(e,n){return oe(e,n,!0,!1).value},variationDetail:function(e,n){return oe(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){u.customEventFilter&&!u.customEventFilter(e)&&m.warn($(e));var r=Z.getUser(),o={kind:"custom",key:e,user:r,url:u.getCurrentUrl(),creationDate:(new Date).getTime()};r&&r.anonymous&&(o.contextKind=ae(r)),null!=n&&(o.data=n),null!=t&&(o.metricValue=t),te(o)}else h.maybeReportError(new s($(e)))},alias:ue,on:function(e,n,t){Oe(e)?(g=!0,K&&De(),h.on(e,n,t)):h.on.apply(h,arguments)},off:function(e){if(h.off.apply(h,arguments),Oe(e)){var n=!1;h.getEvents().forEach((function(e){Oe(e)&&h.getEventListenerCount(e)>0&&(n=!0)})),n||(g=!1,d&&void 0===H&&we())}},setStreaming:function(e){var n=null===e?void 0:e;n!==H&&(H=n,De())},flush:function(e){return I(b?L.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!z)return e;for(var n in z)F(z,n)&&(e[n]=oe(n,null,!w.sendEventsOnlyForVariation).value);return e},close:function(e){if(B)return I(Promise.resolve(),e);var n=function(){B=!0,z={}};return I(Promise.resolve().then((function(){if(we(),N&&N.stop(),b)return L.stop(),L.flush()})).then(n).catch(n),e)}},options:w,emitter:h,ident:Z,logger:m,requestor:q,start:function(){b&&(N&&N.start(),L.start())},enqueueEvent:te,getFlagsInternal:function(){return z},getEnvironmentId:function(){return k},internalChangeEventName:"internal-change"}}function Ze(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function en(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 nn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?en(Object(t),!0).forEach((function(n){Ze(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):en(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var tn={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function rn(e,n,t,r,o){if(o&&!function(){var e=window.navigator&&window.navigator.userAgent;if(e){var n=e.match(/Chrom(e|ium)\/([0-9]+)\./);if(n)return parseInt(n[2],10)<73}return!0}())return tn;var i=new window.XMLHttpRequest;for(var a in i.open(e,n,!o),t||{})Object.prototype.hasOwnProperty.call(t,a)&&i.setRequestHeader(a,t[a]);if(o)return i.send(r),tn;var u;return{promise:new Promise((function(e,n){i.addEventListener("load",(function(){u||e({status:i.status,header:function(e){return i.getResponseHeader(e)},body:i.responseText})})),i.addEventListener("error",(function(){u||n(new Error)})),i.send(r)})),cancel:function(){u=!0,i.abort()}}}function on(e){var n,t={synchronousFlush:!1};if(window.XMLHttpRequest){var r=e&&e.disableSyncEventPost;t.httpRequest=function(e,n,o,i){var a=t.synchronousFlush&!r;return t.synchronousFlush=!1,rn(e,n,o,i,a)}}t.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},t.httpFallbackPing=function(e){(new window.Image).src=e};var o,i=e&&e.eventUrlTransformer;t.getCurrentUrl=function(){return i?i(window.location.href):window.location.href},t.isDoNotTrack=function(){var e;return 1===(e=window.navigator&&void 0!==window.navigator.doNotTrack?window.navigator.doNotTrack:window.navigator&&void 0!==window.navigator.msDoNotTrack?window.navigator.msDoNotTrack:window.doNotTrack)||!0===e||"1"===e||"yes"===e};try{window.localStorage&&(t.localStorage={get:function(e){return new Promise((function(n){n(window.localStorage.getItem(e))}))},set:function(e,n){return new Promise((function(t){window.localStorage.setItem(e,n),t()}))},clear:function(e){return new Promise((function(n){window.localStorage.removeItem(e),n()}))}})}catch(e){t.localStorage=null}if(e&&e.useReport&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(t.eventSourceAllowsReport=!0,o=window.EventSourcePolyfill):(t.eventSourceAllowsReport=!1,o=window.EventSource),window.EventSource){var a=3e5;t.eventSourceFactory=function(e,n){var t=nn(nn({},{heartbeatTimeout:a,silentTimeout:a,skipDefaultHeaders:!0}),n);return new o(e,t)},t.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return t.userAgent="JSClient",t.version="2.20.0-alpha.1",t.diagnosticSdkData={name:"js-client-sdk",version:"2.20.0-alpha.1"},t.diagnosticPlatformData={name:"JS"},t.diagnosticUseCombinedEvent=!0,t}var an=/[|\\{}()[\]^$+*?.]/g,un=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(an,"\\$&")};function sn(e,n,t,r){var o,i,a=(("substring"===e.kind||"regex"===e.kind)&&r.includes("/")?n:n.replace(r,"")).replace(t,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+un(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+un(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+un(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function cn(e,n){for(var t={},r=null,o=[],i=0;i<e.length;i++)for(var a=e[i],u=a.urls||[],s=0;s<u.length;s++)if(sn(u[s],window.location.href,window.location.search,window.location.hash)){"pageview"===a.kind?n("pageview",a):(o.push(a),n("click_pageview",a));break}return o.length>0&&(r=function(e){for(var t=function(e,n){for(var t=[],r=0;r<n.length;r++)for(var o=e.target,i=n[r],a=i.selector,u=document.querySelectorAll(a);o&&u.length>0;){for(var s=0;s<u.length;s++)o===u[s]&&t.push(i);o=o.parentNode}return t}(e,o),r=0;r<t.length;r++)n("click",t[r])},document.addEventListener("click",r)),t.dispose=function(){document.removeEventListener("click",r)},t}function ln(e,n){var t,r;function o(){r&&r.dispose(),t&&t.length&&(r=cn(t,i))}function i(n,t){var r=e.ident.getUser(),o={kind:n,key:t.key,data:null,url:window.location.href,user:r,creationDate:(new Date).getTime()};return r&&r.anonymous&&(o.contextKind="anonymousUser"),"click"===n&&(o.selector=t.selector),e.enqueueEvent(o)}return e.requestor.fetchJSON("/sdk/goals/"+e.getEnvironmentId()).then((function(e){e&&e.length>0&&(r=cn(t=e,i),function(e,n){var t,r=window.location.href;function o(){(t=window.location.href)!==r&&(r=t,n())}!function e(n,t){n(),setTimeout((function(){e(n,t)}),t)}(o,e),window.history&&window.history.pushState?window.addEventListener("popstate",o):window.addEventListener("hashchange",o)}(300,o)),n()})).catch((function(t){e.emitter.maybeReportError(new v.LDUnexpectedResponseError((t&&t.message,t.message))),n()})),{}}var fn={fetchGoals:{default:!0},hash:{type:"string"},eventProcessor:{type:"object"},eventUrlTransformer:{type:"function"},disableSyncEventPost:{default:!1}};function vn(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=on(t),o=Ye(e,n,t,r,fn),i=o.client,a=o.options,u=o.emitter,s=new Promise((function(e){var n=u.on("goalsReady",(function(){u.off("goalsReady",n),e()}))}));i.waitUntilGoalsReady=function(){return s},a.fetchGoals?ln(o,(function(){return u.emit("goalsReady")})):u.emit("goalsReady"),"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();var c=function(){r.synchronousFlush=!0,i.flush().catch((function(){})),r.synchronousFlush=!1};return window.addEventListener("beforeunload",c),window.addEventListener("unload",c),i}var dn=Qe,gn="2.20.0-alpha.1";var pn={initialize:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(pe.deprecated("default export","named LDClient export")),vn(e,n,t)},version:"2.20.0-alpha.1"};export default pn;export{dn as createConsoleLogger,vn as initialize,gn as version};
//# sourceMappingURL=ldclient.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={})}(this,function(e){"use strict";function Q(e){return(Q="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 n(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function Y(o){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(i,!0).forEach(function(e){var n,t,r;n=o,r=i[t=e],t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):n(i).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(i,e))})}return o}function t(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 Z=t("LaunchDarklyUnexpectedResponseError"),ee=t("LaunchDarklyInvalidEnvironmentIdError"),a=t("LaunchDarklyInvalidUserError"),ne=t("LaunchDarklyInvalidEventKeyError"),v=t("LaunchDarklyInvalidArgumentError"),te=t("LaunchDarklyFlagFetchError");function re(e){return!(400<=e&&e<500)||400===e||408===e||429===e}for(var s=Object.freeze({__proto__:null,LDUnexpectedResponseError:Z,LDInvalidEnvironmentIdError:ee,LDInvalidUserError:a,LDInvalidEventKeyError:ne,LDInvalidArgumentError:v,LDFlagFetchError:te,isHttpErrorRecoverable:re}),r=function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(f(e,i,a<i+16383?a:i+16383));return 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]+"=")),o.join("")},u=[],o=[],i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,l=i.length;c<l;++c)u[c]=i[c],o[i.charCodeAt(c)]=c;function f(e,n,t){for(var r,o,i=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(u[(o=r)>>18&63]+u[o>>12&63]+u[o>>6&63]+u[63&o]);return i.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63;var g=Array.isArray,p=Object.keys,m=Object.prototype.hasOwnProperty,d=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function h(e){var n=unescape(encodeURIComponent(e));return r(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(n))}function D(e){return h(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function oe(e){return JSON.parse(JSON.stringify(e))}function ie(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,o,i,a=g(n),u=g(t);if(a&&u){if((o=n.length)!=t.length)return!1;for(r=o;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 d=p(n);if((o=d.length)!==p(t).length)return!1;for(r=o;0!=r--;)if(!m.call(t,d[r]))return!1;for(r=o;0!=r--;)if(!e(n[i=d[r]],t[i]))return!1;return!0}return n!=n&&t!=t}(e,n)}function ae(e){setTimeout(e,0)}function ue(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 y(e){var n={};for(var t in e)le(e,t)&&(n[t]={value:e[t],version:0});return n}function se(e){var n={};for(var t in e)le(e,t)&&(n[t]=e[t].value);return n}function w(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-=D(JSON.stringify(a)).length)<0&&0<t.length?r.unshift(a):t.push(a)}i=e,o.push(t)}return o}function b(e){var n=e.version||"3.3.2";return e.userAgent+"/"+n}function O(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":b(e)};return n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t}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 Y({},e,{},n)},{})}function le(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function fe(e){if(!e)return e;var n;for(var t in d){var r=d[t],o=e[r];void 0!==o&&"string"!=typeof o&&((n=n||Y({},e))[r]=String(o))}return n||e}Object.freeze({__proto__:null,btoa:h,base64URLEncode:D,clone:oe,deepEquals:ie,onNextTick:ae,wrapPromiseCallback:ue,transformValuesToVersionedValues:y,transformVersionedValuesToValues:se,chunkUserEventsForUrl:w,getLDUserAgentString:b,getLDHeaders:O,extend:ce,objectHasOwnProperty:le,sanitizeUser:fe});for(var k,E=(k=void 0,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}}}(k={exports:{}}),k.exports),S=[],P=0;P<256;++P)S[P]=(P+256).toString(16).substr(1);var U,j,R=0,I=0,T=function(e,n,t){var r=n&&t||0,o=n||[],i=(e=e||{}).node||U,a=void 0!==e.clockseq?e.clockseq:j;if(null==i||null==a){var u=E();null==i&&(i=U=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=j=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:I+1,l=s-R+(c-I)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||R<s)&&void 0===e.nsecs&&(c=0),1e4<=c)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");R=s,j=a;var f=(1e4*(268435455&(s+=122192928e5))+(I=c))%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=255&f;var d=s/4294967296*1e4&268435455;o[r++]=d>>>8&255,o[r++]=255&d,o[r++]=d>>>24&15|16,o[r++]=d>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var v=0;v<6;++v)o[r+v]=i[v];return n||function(e,n){var t=n||0,r=S;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("")}(o)};function de(u,e,n){var t="/a/"+e+".gif",s=ce({"Content-Type":"application/json"},O(u,n)),c=u.httpFallbackPing,l={sendChunk:function(e,r,o,n){var i=JSON.stringify(e),a=o?null:T();return n?function n(t){var e=o?s:ce({},s,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":a});return u.httpRequest("POST",r,e,i).promise.then(function(e){if(e)return 400<=e.status&&re(e.status)&&t?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 t?n(!1):Promise.reject()})}(!0).catch(function(){}):(c&&c(r+t+"?d="+D(i)),Promise.resolve())},sendEvents:function(e,n,t){if(!u.httpRequest)return Promise.resolve();var r,o=u.httpAllowsPost();r=o?[e]:w(2e3-n.length,e);for(var i=[],a=0;a<r.length;a++)i.push(l.sendChunk(r[a],n,t,o));return Promise.all(i)}};return l}function ve(e){var n={},s=e.allAttributesPrivate,c=e.privateAttributeNames||[],l={key:!0,custom:!0,anonymous:!0},f={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;function n(o,i){return Object.keys(o).reduce(function(e,n){var t,r=e;return i(n)&&(l[t=n]||!s&&-1===a.indexOf(t)&&-1===c.indexOf(t)?r[0][n]=o[n]:r[1][n]=!0),r},[{},{}])}var a=e.privateAttributeNames||[],t=n(e,function(e){return f[e]}),r=t[0],o=t[1];if(e.custom){var i=n(e.custom,function(){return!0});r.custom=i[0],o=ce({},o,i[1])}var u=Object.keys(o);return u.length&&(u.sort(),r.privateAttrs=u),r},n}function N(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var L=" Please see https://docs.launchdarkly.com/docs/js-sdk-reference#initializing-the-client for instructions on SDK initialization.",F=function(e){return'Expected application/json content type but got "'+e+'"'},C=function(e){return"network error"+(e?" ("+e+")":"")},ge=function(e){return'Custom event "'+e+'" does not exist'},x=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+L},pe=function(){return"No environment/client-side ID was specified."+L},me=function(e){return"Error fetching flag settings: "+N(e)},A=function(){return"No user specified."+L},q=function(){return"Invalid user specified."+L},he=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+L},_=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},ye=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(re(e)?t:"giving up permanently")},V=function(){return"Cannot make HTTP requests in this environment."+L},J=function(e){return"Opening stream connection to "+e},z=function(e,n){return"Error on stream connection: "+N(e)+", will continue retrying every "+n+" milliseconds."},M=function(e){return'Ignoring unknown config option "'+e+'"'},K=function(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"},H=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},B=function(e){return"polling for feature flags at "+e},we=function(e){return'received streaming update for flag "'+e+'"'},be=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},ke=function(e){return'received streaming deletion for flag "'+e+'"'},Ee=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},Se=function(e){return'enqueueing "'+e+'" event'},De=function(e){return"sending "+e+" events"},G=Object.freeze({__proto__:null,clientInitialized:function(){return"LaunchDarkly client initialized"},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/docs/js-sdk-reference#section-analytics-events"},invalidContentType:F,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:function(){return"localStorage is unavailable"},localStorageUnavailableForUserId:function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},networkError:C,unknownCustomEventKey:ge,environmentNotFound:x,environmentNotSpecified:pe,errorFetchingFlags:me,userNotSpecified:A,invalidUser:q,bootstrapOldFormat:he,bootstrapInvalid:function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},deprecated:_,httpErrorMessage:ye,httpUnavailable:V,identifyDisabled:function(){return"identify() has no effect here; it must be called on the main client instance"},streamClosing:function(){return"Closing stream connection"},streamConnecting:J,streamError:z,unknownOption:M,wrongOptionType:K,wrongOptionTypeBoolean:$,optionBelowMinimum:H,debugPolling:B,debugStreamPing:function(){return"received ping message from stream"},debugStreamPut:function(){return"received streaming update for all flags"},debugStreamPatch:we,debugStreamPatchIgnored:be,debugStreamDelete:ke,debugStreamDeleteIgnored:Ee,debugEnqueueingEvent:Se,debugPostingEvents:De,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"}});var Oe=function(r){var n=!1,t=!1,o=null,e=null,i=new Promise(function(n){r.on("ready",function e(){r.off("ready",e),n()})}).catch(function(){});return{getInitializationPromise:function(){return e||(n?Promise.resolve():t?Promise.reject(o):e=new Promise(function(n,t){r.on("initialized",function e(){r.off("initialized",e),n()}),r.on("failed",function e(n){r.off("failed",e),t(n)})}))},getReadyPromise:function(){return i},signalSuccess:function(){n||t||(n=!0,r.emit("initialized"),r.emit("ready"))},signalFailure:function(e){n||t||(t=!0,o=e,r.emit("failed",e),r.emit("ready")),r.maybeReportError(e)}}};function Pe(t,r,o,i,a){var u={};function s(){var e="",n=i.getUser();return n&&(e=o||h(JSON.stringify(n))),"ld:"+r+":"+e}return u.loadFlags=function(){return t.get(s()).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=y(n):delete n.$schema}return n}catch(e){return u.clearFlags().then(function(){return Promise.reject(e)})}}).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.saveFlags=function(e){var n=ce({},e,{$schema:1});return t.set(s(),JSON.stringify(n)).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.clearFlags=function(){return t.clear(s()).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u}function Ue(o,e,i,n){var a,u=e.streamUrl,s=e.logger,t={},c=u+"/eval/"+i,l=e.useReport,f=e.evaluationReasons,r=e.streamReconnectDelay,d=O(o,e),v=!1,g=null,p=null,m=null,h=null,y=null;function w(e){v||(s.warn(z(e,r)),v=!0),S(!1),E(),b(r)}function b(e){p||(e?p=setTimeout(k,e):k())}function k(){var e;p=null;var n="",t={headers:d,readTimeoutMillis:3e5};if(o.eventSourceFactory){for(var r in null!=h&&(n="h="+h),l?o.eventSourceAllowsReport?(e=c,t.method="REPORT",t.headers["Content-Type"]="application/json",t.body=JSON.stringify(m)):(e=u+"/ping/"+i,n=""):e=c+"/"+D(JSON.stringify(m)),f&&(n=n+(n?"&":"")+"withReasons=true"),e=e+(n?"?":"")+n,E(),s.info(J(e)),a=(new Date).getTime(),g=o.eventSourceFactory(e,t),y)le(y,r)&&g.addEventListener(r,y[r]);g.onerror=w}}function E(){g&&(s.info("Closing stream connection"),g.close(),g=null)}function S(e){a&&n&&n.recordStreamInit(a,!e,(new Date).getTime()-a),a=null}return t.connect=function(e,n,t){m=e,h=n,y={};function r(n){y[n]=function(e){S(!(v=!1)),t[n]&&t[n](e)}}for(var o in t||{})r(o);b()},t.disconnect=function(){clearTimeout(p),p=null,E()},t.isConnected=function(){return!!(g&&o.eventSourceIsActive&&o.eventSourceIsActive(g))},t}function je(v,g,a){var u=g.baseUrl,s=g.useReport,c=g.evaluationReasons,l=g.logger,e={},p={};function f(e,n){if(!v.httpRequest)return new Promise(function(e,n){n(new te(V()))});var t=n?"REPORT":"GET",r=O(v,g);n&&(r["Content-Type"]="application/json");var o,i,a,u,s,c,l=p[e];l||(o=function(){delete p[e]},(c={addPromise:function(n,e){i=n,a&&a(),a=e,n.then(function(e){i===n&&(u(e),o())},function(e){i===n&&(s(e),o())})}}).resultPromise=new Promise(function(e,n){u=e,s=n}),l=c,p[e]=l);var f=v.httpRequest(t,e,r,n),d=f.promise.then(function(e){if(200!==e.status)return Promise.reject(404===(n=e).status?new ee(x()):new te(me(n.statusText||String(n.status))));if(e.header("content-type")&&"application/json"===e.header("content-type").substring(0,"application/json".length))return JSON.parse(e.body);var n,t=F(e.header("content-type")||"");return Promise.reject(new te(t))},function(e){return Promise.reject(new te(C(e)))});return l.addPromise(d,function(){f.cancel&&f.cancel()}),l.resultPromise}return e.fetchJSON=function(e){return f(u+e,null)},e.fetchFlagSettings=function(e,n){var t,r,o,i="";return s?(r=[u,"/sdk/evalx/",a,"/user"].join(""),o=JSON.stringify(e)):(t=D(JSON.stringify(e)),r=[u,"/sdk/evalx/",a,"/users/",t].join("")),n&&(i="h="+n),c&&(i=i+(i?"&":"")+"withReasons=true"),r=r+(i?"?":"")+i,l.debug(B(r)),f(r,o)},e}function Re(o,i){var e={};return e.validateUser=function(e){if(!e)return Promise.reject(new a(A()));var r=oe(e);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(o?o.get("ld:$anonUserId").catch(function(){return null}):Promise.resolve(null)).then(function(e){if(e)return r.key=e,r;var n,t=T();return r.key=t,(n=t,o?o.set("ld:$anonUserId",n).catch(function(){i.warn("localStorage is unavailable, so anonymous user ID cannot be cached")}):Promise.resolve()).then(function(){return r})}):Promise.reject(new a(q()))},e}var X={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},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}};function Ie(e,n,t,r){var a=ce({logger:{default:r}},X,t),o={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function u(e){ae(function(){n&&n.maybeReportError(new v(e))})}var s,c,i,l,f=ce({},e||{});return l=f,Object.keys(o).forEach(function(e){if(void 0!==l[e]){var n=o[e];r&&r.warn(_(e,n)),n&&(void 0===l[n]&&(l[n]=l[e]),delete l[e])}}),i=ce({},f),Object.keys(a).forEach(function(e){void 0!==i[e]&&null!==i[e]||(i[e]=a[e]&&a[e].default)}),s=f=i,c=ce({},s),Object.keys(s).forEach(function(e){var n=s[e];if(null!=n){var t=a[e];if(void 0===t)u(M(e));else{var r=t.type||d(t.default);if("any"!==r){var o=r.split("|"),i=d(n);o.indexOf(i)<0?"boolean"===r?(c[e]=!!n,u($(e,i))):(u(K(e,r,i)),c[e]=t.default):"number"===i&&void 0!==t.minimum&&n<t.minimum&&(u(H(e,n,t.minimum)),c[e]=t.minimum)}}}}),c;function d(e){if(null===e)return"any";if(void 0!==e){if(Array.isArray(e))return"array";var n=Q(e);return"boolean"===n||"string"===n||"number"===n||"function"===n?n:"object"}}}var W=Object.freeze({__proto__:null,baseOptionDefs:X,validate:Ie}).baseOptionDefs,Te=function(e){var n={diagnosticId:T()};return e&&(n.sdkKeySuffix=6<e.length?e.substring(e.length-6):e),n},Ne=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){var r={timestamp:e,failed:n,durationMillis:t};o.push(r)},reset:i}},Le=function(r,e,n,t,o,i){var a,u,s=!!r.diagnosticUseCombinedEvent,c="ld:"+t+":$diagnostics",l=o.eventsUrl+"/events/diagnostic/"+t,f=o.diagnosticRecordingInterval,d=e,v=!!o.streaming,g={};function p(){return{sdk:function(){var e=Y({},r.diagnosticSdkData);return o.wrapperName&&(e.wrapperName=o.wrapperName),o.wrapperVersion&&(e.wrapperVersion=o.wrapperVersion),e}(),configuration:(e={customBaseURI:o.baseUrl!==W.baseUrl.default,customStreamURI:o.streamUrl!==W.streamUrl.default,customEventsURI:o.eventsUrl!==W.eventsUrl.default,eventsCapacity:o.eventCapacity,eventsFlushIntervalMillis:o.flushInterval,reconnectTimeMillis:o.streamReconnectDelay,streamingDisabled:!v,allAttributesPrivate:!!o.allAttributesPrivate,inlineUsersInEvents:!!o.inlineUsersInEvents,diagnosticRecordingIntervalMillis:o.diagnosticRecordingInterval,usingSecureMode:!!o.hash,bootstrapMode:!!o.bootstrap,fetchGoalsDisabled:!o.fetchGoals,allowFrequentDuplicateEvents:!!o.allowFrequentDuplicateEvents,sendEventsOnlyForVariation:!!o.sendEventsOnlyForVariation,autoAliasingOptOut:!!o.autoAliasingOptOut},e),platform:r.diagnosticPlatformData};var e}function m(e){o.logger&&o.logger.debug(G.debugPostingDiagnosticEvent(e)),n.sendEvents(e,l,!0).then(function(){}).catch(function(){})}function h(){var e,n;m((e=(new Date).getTime(),n=Y({kind:s?"diagnostic-combined":"diagnostic",id:i,creationDate:e},d.getProps()),s&&(n=Y({},n,{},p())),d.reset(e),n)),u=setTimeout(h,f),a=(new Date).getTime(),s&&function(){if(r.localStorage){var e=Y({},d.getProps());r.localStorage.set(c,JSON.stringify(e),function(){})}}()}return g.start=function(){s?function(t){if(!r.localStorage)return t(!1);r.localStorage.get(c).then(function(e){if(e)try{var n=JSON.parse(e);d.setProps(n),a=n.dataSinceDate}catch(e){}t(!0)}).catch(function(){t(!1)})}(function(e){if(e){var n=(a||0)+f,t=(new Date).getTime();n<=t?h():u=setTimeout(h,n-t)}else 0===Math.floor(4*Math.random())?h():u=setTimeout(h,f)}):(m(Y({kind:"diagnostic-init",id:i,creationDate:d.getProps().dataSinceDate},p())),u=setTimeout(h,f))},g.stop=function(){u&&clearTimeout(u)},g.setStreaming=function(e){v=e},g};function Fe(e,n){var i,a=["debug","info","warn","error"];i=null!=n?""===n?"":n+" ":"LD: ";var u=0;e&&(u="none"===e?100:a.indexOf(e));var t={};function r(e,n,t){if(u<=e&&console){var r=console[n];if(r){var o=e<a.length?a[e]:"?";r.call(console,i+"["+o+"] "+t)}}}return t.debug=function(e){return r(0,"log",e)},t.info=function(e){return r(1,"info",e)},t.warn=function(e){return r(2,"warn",e)},t.error=function(e){return r(3,"error",e)},t}function Ce(e,n,t,i,r){var a,o,u,s,c,l,f=t&&t.logger?t.logger:r&&r.logger&&r.logger.default||Fe("warn"),d=function(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}(f),v=Oe(d),g=Ie(t,d,r,f),p=g.sendEvents,m=e,h=g.hash,y=de(i,m,g),w=g.sendEvents&&!g.diagnosticOptOut,b=w?Te(m):null,k=w?Ne((new Date).getTime()):null,E=w?Le(i,k,y,m,g,b):null,S=Ue(i,g,m,k),D=g.eventProcessor||function(e,n,t,r,o,i){var a,u=3<arguments.length&&void 0!==r?r:null,s=4<arguments.length&&void 0!==o?o:null,c={},l=(5<arguments.length&&void 0!==i?i:null)||de(e,t,n),f=n.eventsUrl+"/events/bulk/"+t,d=function(){var e={},a=0,u=0,s={};return e.summarizeEvent=function(e){if("feature"===e.kind){var 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?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)}},e.getSummary=function(){var e={},n=!0;for(var t in s){var r=s[t],o=e[r.key];o||(o={default:r.default,counters:[]},e[r.key]=o);var i={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:u,features:e}},e.clearSummary=function(){u=a=0,s={}},e}(),v=ve(n),g=n.inlineUsersInEvents,p=n.samplingInterval,m=n.eventCapacity,h=n.flushInterval,y=n.logger,w=[],b=0,k=!1,E=!1;function S(){return 0===p||0===Math.floor(Math.random()*p)}function D(e){w.length<m?(w.push(e),E=!1):(E||(E=!0,y.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),u&&u.incrementDroppedEvents())}return c.enqueue=function(e){if(!k){var n=!1,t=!1;if(d.summarizeEvent(e),"feature"===e.kind?S()&&(n=!!e.trackEvents,t=function(e){return!!e.debugEventsUntilDate&&e.debugEventsUntilDate>b&&e.debugEventsUntilDate>(new Date).getTime()}(e)):n=S(),n&&D(function(e){var n=ce({},e);return"alias"===e.kind||(g||"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}(e)),t){var r=ce({},e,{kind:"debug"});r.user=v.filterUser(r.user),delete r.trackEvents,delete r.debugEventsUntilDate,D(r)}}},c.flush=function(){if(k)return Promise.resolve();var e=w,n=d.getSummary();return d.clearSummary(),n&&(n.kind="summary",e.push(n)),u&&u.setEventsInLastBatch(e.length),0===e.length?Promise.resolve():(w=[],y.debug(De(e.length)),l.sendEvents(e,f).then(function(e){e&&(e.serverTime&&(b=e.serverTime),re(e.status)||(k=!0),400<=e.status&&ae(function(){s.maybeReportError(new Z(ye(e.status,"event posting","some events were dropped")))}))}))},c.start=function(){a=setTimeout(function e(){c.flush(),a=setTimeout(e,h)},h)},c.stop=function(){clearTimeout(a)},c}(i,g,m,k,d,y),O=je(i,g,m),P={},U={},j=g.streaming,R=!1,I=!1,T=!0,N=g.stateProvider,L=(c=function(e,n){var t;t=e,N||t&&C({kind:"identify",key:t.key,user:t,creationDate:(new Date).getTime()}),!g.autoAliasingOptOut&&n&&n.anonymous&&e&&!e.anonymous&&V(e,n)},{setUser:function(e){var n=l&&oe(l);(l=fe(e))&&c&&c(oe(l),n)},getUser:function(){return l?oe(l):null}}),F=Re(i.localStorage,f);function C(e){if(m&&!(N&&N.enqueueEvent&&N.enqueueEvent(e))){if("alias"!==e.kind){if(!e.user)return void(T&&(f.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/docs/js-sdk-reference#section-analytics-events"),T=!1));T=!1}!p||I||i.isDoNotTrack()||(f.debug(Se(e.kind)),D.enqueue(e))}}function x(e,n,t,r){var o=L.getUser(),i=new Date,a=n?n.value:null;if(!g.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,s=P[u];if(s&&i-s<3e5)return;P[u]=i}var c={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()};o&&o.anonymous&&(c.contextKind=_(o));var l=U[e];l&&(c.version=l.flagVersion?l.flagVersion:l.version,c.trackEvents=l.trackEvents,c.debugEventsUntilDate=l.debugEventsUntilDate),(r||l&&l.trackReason)&&n&&(c.reason=n.reason),C(c)}function A(e,n,t,r){var o;if(U&&le(U,e)&&U[e]&&!U[e].deleted){var i=U[e];o=q(i),null!==i.value&&void 0!==i.value||(o.value=n)}else o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&x(e,o,n,r),o}function q(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function _(e){return e.anonymous?"anonymousUser":"user"}function V(e,n){N||e&&n&&C({kind:"alias",key:e.key,contextKind:_(e),previousKey:n.key,previousContextKind:_(n),creationDate:(new Date).getTime()})}function J(){o=!0,L.getUser()&&S.connect(L.getUser(),h,{ping:function(){f.debug("received ping message from stream");var n=L.getUser();O.fetchFlagSettings(n,h).then(function(e){ie(n,L.getUser())&&M(e||{})}).catch(function(e){d.maybeReportError(new te(me(e)))})},put:function(e){var n=JSON.parse(e.data);f.debug("received streaming update for all flags"),M(n)},patch:function(e){var n=JSON.parse(e.data),t=U[n.key];if(!t||!t.version||!n.version||t.version<n.version){f.debug(we(n.key));var r={},o=ce({},n);delete o.key;var i=q(U[n.key]=o);r[n.key]=t?{previous:t.value,current:i}:{current:i},K(r)}else f.debug(be(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!U[n.key]||U[n.key].version<n.version){f.debug(ke(n.key));var t={};U[n.key]&&!U[n.key].deleted&&(t[n.key]={previous:U[n.key].value}),U[n.key]={version:n.version,deleted:!0},K(t)}else f.debug(Ee(n.key))}})}function z(){o&&(S.disconnect(),o=!1)}function M(e){var n={};if(!e)return Promise.resolve();for(var t in U)le(U,t)&&U[t]&&(e[t]&&!ie(e[t].value,U[t].value)?n[t]={previous:U[t].value,current:q(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:U[t].value}));for(var r in e)le(e,r)&&e[r]&&(!U[r]||U[r].deleted)&&(n[r]={current:q(e[r])});return U=Y({},e),K(n).catch(function(){})}function K(o){var e=Object.keys(o);if(0<e.length){var i={};e.forEach(function(e){var n=o[e].current,t=n?n.value:void 0,r=o[e].previous;d.emit("change:"+e,t,r),i[e]=n?{current:t,previous:r}:{previous:r}}),d.emit("change",i),d.emit("internal-change",U),g.sendEventsOnlyForVariation||N||e.forEach(function(e){x(e,o[e].current)})}return a&&s?s.saveFlags(U).catch(function(){return null}):Promise.resolve()}function $(){var e=j||u&&void 0===j;e&&!o?J():!e&&o&&z(),E&&E.setStreaming(e)}function H(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}if(i.localStorage&&(s=new Pe(i.localStorage,m,h,L,f)),"string"==typeof g.bootstrap&&"LOCALSTORAGE"===g.bootstrap.toUpperCase()&&(s?a=!0:f.warn("localStorage is unavailable")),"object"===Q(g.bootstrap)&&(U=function(t){var e=Object.keys(t),r=t.$flagsState;!r&&e.length&&f.warn(he()),!1===t.$valid&&f.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var o={};return e.forEach(function(e){if("$flagsState"!==e&&"$valid"!==e){var n={value:t[e]};r&&r[e]?n=ce(n,r[e]):n.version=0,o[e]=n}}),o}(g.bootstrap)),N){var B=N.getInitialState();B?G(B):N.on("init",G),N.on("update",function(e){e.user&&L.setUser(e.user),e.flags&&M(e.flags)})}else(e?F.validateUser(n).then(function(e){return L.setUser(e),"object"===Q(g.bootstrap)?X():a?s.loadFlags().catch(function(){return null}).then(function(e){return null==e?(U={},O.fetchFlagSettings(L.getUser(),h).then(function(e){return M(e||{})}).then(X).catch(function(e){W(new te(me(e)))})):(U=e,ae(X),O.fetchFlagSettings(L.getUser(),h).then(function(e){return M(e)}).catch(function(e){return d.maybeReportError(e)}))}):O.fetchFlagSettings(L.getUser(),h).then(function(e){U=e||{},X()}).catch(function(e){U={},W(e)})}):Promise.reject(new ee(pe()))).catch(W);function G(e){m=e.environment,L.setUser(e.user),U=Y({},e.flags),ae(X)}function X(){f.info("LaunchDarkly client initialized"),R=!0,$(),v.signalSuccess()}function W(e){v.signalFailure(e)}return{client:{waitForInitialization:function(){return v.getInitializationPromise()},waitUntilReady:function(){return v.getReadyPromise()},identify:function(e,r,n){return I?ue(Promise.resolve({}),n):N?(f.warn("identify() has no effect here; it must be called on the main client instance"),ue(Promise.resolve(se(U)),n)):ue((a&&s?s.clearFlags():Promise.resolve()).then(function(){return F.validateUser(e)}).then(function(t){return O.fetchFlagSettings(t,r).then(function(e){var n=se(e);return L.setUser(t),h=r,e?M(e).then(function(){return n}):n})}).then(function(e){return o&&J(),e}).catch(function(e){return d.maybeReportError(e),Promise.reject(e)}),n)},getUser:function(){return L.getUser()},variation:function(e,n){return A(e,n,!0,!1).value},variationDetail:function(e,n){return A(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){i.customEventFilter&&!i.customEventFilter(e)&&f.warn(ge(e));var r=L.getUser(),o={kind:"custom",key:e,user:r,url:i.getCurrentUrl(),creationDate:(new Date).getTime()};r&&r.anonymous&&(o.contextKind=_(r)),null!=n&&(o.data=n),null!=t&&(o.metricValue=t),C(o)}else d.maybeReportError(new ne(ge(e)))},alias:V,on:function(e,n,t){H(e)?(u=!0,R&&$(),d.on(e,n,t)):d.on.apply(d,arguments)},off:function(e){if(d.off.apply(d,arguments),H(e)){var n=!1;d.getEvents().forEach(function(e){H(e)&&0<d.getEventListenerCount(e)&&(n=!0)}),n||(u=!1,o&&void 0===j&&z())}},setStreaming:function(e){var n=null===e?void 0:e;n!==j&&(j=n,$())},flush:function(e){return ue(p?D.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!U)return e;for(var n in U)le(U,n)&&(e[n]=A(n,null,!g.sendEventsOnlyForVariation).value);return e},close:function(e){if(I)return ue(Promise.resolve(),e);function n(){I=!0,U={}}return ue(Promise.resolve().then(function(){if(z(),E&&E.stop(),p)return D.stop(),D.flush()}).then(n).catch(n),e)}},options:g,emitter:d,ident:L,logger:f,requestor:O,start:function(){p&&(E&&E.start(),D.start())},enqueueEvent:C,getFlagsInternal:function(){return U},getEnvironmentId:function(){return m},internalChangeEventName:"internal-change"}}function xe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function Ae(o){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?xe(Object(i),!0).forEach(function(e){var n,t,r;n=o,r=i[t=e],t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):xe(Object(i)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(i,e))})}return o}var qe={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function _e(e,n,t,r,o){if(o&&!function(){var e=window.navigator&&window.navigator.userAgent;if(e){var n=e.match(/Chrom(e|ium)\/([0-9]+)\./);if(n)return parseInt(n[2],10)<73}return!0}())return qe;var i=new window.XMLHttpRequest;for(var a in i.open(e,n,!o),t||{})Object.prototype.hasOwnProperty.call(t,a)&&i.setRequestHeader(a,t[a]);if(o)return i.send(r),qe;var u;return{promise:new Promise(function(e,n){i.addEventListener("load",function(){u||e({status:i.status,header:function(e){return i.getResponseHeader(e)},body:i.responseText})}),i.addEventListener("error",function(){u||n(new Error)}),i.send(r)}),cancel:function(){u=!0,i.abort()}}}var Ve=/[|\\{}()[\]^$+*?.]/g,Je=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(Ve,"\\$&")};function ze(e,n,t,r){var o,i,a=(("substring"===e.kind||"regex"===e.kind)&&r.includes("/")?n:n.replace(r,"")).replace(t,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+Je(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+Je(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+Je(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function Me(e,r){for(var n={},t=null,o=[],i=0;i<e.length;i++)for(var a=e[i],u=a.urls||[],s=0;s<u.length;s++)if(ze(u[s],window.location.href,window.location.search,window.location.hash)){"pageview"===a.kind?r("pageview",a):(o.push(a),r("click_pageview",a));break}return 0<o.length&&(t=function(e){for(var n=function(e,n){for(var t=[],r=0;r<n.length;r++)for(var o=e.target,i=n[r],a=i.selector,u=document.querySelectorAll(a);o&&0<u.length;){for(var s=0;s<u.length;s++)o===u[s]&&t.push(i);o=o.parentNode}return t}(e,o),t=0;t<n.length;t++)r("click",n[t])},document.addEventListener("click",t)),n.dispose=function(){document.removeEventListener("click",t)},n}var Ke=300;function $e(o,n){var t,r;function i(){r&&r.dispose(),t&&t.length&&(r=Me(t,a))}function a(e,n){var t=o.ident.getUser(),r={kind:e,key:n.key,data:null,url:window.location.href,user:t,creationDate:(new Date).getTime()};return t&&t.anonymous&&(r.contextKind="anonymousUser"),"click"===e&&(r.selector=n.selector),o.enqueueEvent(r)}function u(e,n){var t,r=window.location.href;function o(){(t=window.location.href)!==r&&(r=t,n())}!function e(n,t){n(),setTimeout(function(){e(n,t)},t)}(o,e),window.history&&window.history.pushState?window.addEventListener("popstate",o):window.addEventListener("hashchange",o)}return o.requestor.fetchJSON("/sdk/goals/"+o.getEnvironmentId()).then(function(e){e&&0<e.length&&(r=Me(t=e,a),u(Ke,i)),n()}).catch(function(e){o.emitter.maybeReportError(new s.LDUnexpectedResponseError((e&&e.message,e.message))),n()}),{}}var He="goalsReady",Be={fetchGoals:{default:!0},hash:{type:"string"},eventProcessor:{type:"object"},eventUrlTransformer:{type:"function"},disableSyncEventPost:{default:!1}};function Ge(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=function(e){var n,i={synchronousFlush:!1};if(window.XMLHttpRequest){var a=e&&e.disableSyncEventPost;i.httpRequest=function(e,n,t,r){var o=i.synchronousFlush&!a;return i.synchronousFlush=!1,_e(e,n,t,r,o)}}i.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},i.httpFallbackPing=function(e){(new window.Image).src=e};var r,t=e&&e.eventUrlTransformer;i.getCurrentUrl=function(){return t?t(window.location.href):window.location.href},i.isDoNotTrack=function(){var e;return 1===(e=window.navigator&&void 0!==window.navigator.doNotTrack?window.navigator.doNotTrack:window.navigator&&void 0!==window.navigator.msDoNotTrack?window.navigator.msDoNotTrack:window.doNotTrack)||!0===e||"1"===e||"yes"===e};try{window.localStorage&&(i.localStorage={get:function(n){return new Promise(function(e){e(window.localStorage.getItem(n))})},set:function(n,t){return new Promise(function(e){window.localStorage.setItem(n,t),e()})},clear:function(n){return new Promise(function(e){window.localStorage.removeItem(n),e()})}})}catch(e){i.localStorage=null}var o=e&&e.useReport;if(r=o&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(i.eventSourceAllowsReport=!0,window.EventSourcePolyfill):(i.eventSourceAllowsReport=!1,window.EventSource),window.EventSource){i.eventSourceFactory=function(e,n){var t=Ae(Ae({},{heartbeatTimeout:3e5,silentTimeout:3e5,skipDefaultHeaders:!0}),n);return new r(e,t)},i.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return i.userAgent="JSClient",i.version="2.19.4",i.diagnosticSdkData={name:"js-client-sdk",version:"2.19.4"},i.diagnosticPlatformData={name:"JS"},i.diagnosticUseCombinedEvent=!0,i}(t),o=Ce(e,n,t,r,Be),i=o.client,a=o.options,u=o.emitter,s=new Promise(function(e){var n=u.on(He,function(){u.off(He,n),e()})});i.waitUntilGoalsReady=function(){return s},a.fetchGoals?$e(o,function(){return u.emit(He)}):u.emit(He),"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();function c(){r.synchronousFlush=!0,i.flush().catch(function(){}),r.synchronousFlush=!1}return window.addEventListener("beforeunload",c),window.addEventListener("unload",c),i}var Xe=Fe;var We={initialize:function(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(G.deprecated("default export","named LDClient export")),Ge(e,n,t)},version:"2.19.4"};e.createConsoleLogger=Xe,e.default=We,e.initialize=Ge,e.version="2.19.4",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={})}(this,function(e){"use strict";function Q(e){return(Q="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 n(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function Y(o){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(i,!0).forEach(function(e){var n,t,r;n=o,r=i[t=e],t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):n(i).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(i,e))})}return o}function t(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 Z=t("LaunchDarklyUnexpectedResponseError"),ee=t("LaunchDarklyInvalidEnvironmentIdError"),a=t("LaunchDarklyInvalidUserError"),ne=t("LaunchDarklyInvalidEventKeyError"),d=t("LaunchDarklyInvalidArgumentError"),te=t("LaunchDarklyFlagFetchError");function re(e){return!(400<=e&&e<500)||400===e||408===e||429===e}for(var s=Object.freeze({__proto__:null,LDUnexpectedResponseError:Z,LDInvalidEnvironmentIdError:ee,LDInvalidUserError:a,LDInvalidEventKeyError:ne,LDInvalidArgumentError:d,LDFlagFetchError:te,isHttpErrorRecoverable:re}),r=function(e){for(var n,t=e.length,r=t%3,o=[],i=0,a=t-r;i<a;i+=16383)o.push(f(e,i,a<i+16383?a:i+16383));return 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]+"=")),o.join("")},u=[],o=[],i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,l=i.length;c<l;++c)u[c]=i[c],o[i.charCodeAt(c)]=c;function f(e,n,t){for(var r,o,i=[],a=n;a<t;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(u[(o=r)>>18&63]+u[o>>12&63]+u[o>>6&63]+u[63&o]);return i.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63;var g=Array.isArray,p=Object.keys,m=Object.prototype.hasOwnProperty,v=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function h(e){var n=unescape(encodeURIComponent(e));return r(function(e){for(var n=[],t=0;t<e.length;t++)n.push(e.charCodeAt(t));return n}(n))}function D(e){return h(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function oe(e){return JSON.parse(JSON.stringify(e))}function ie(e,n){return function e(n,t){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){var r,o,i,a=g(n),u=g(t);if(a&&u){if((o=n.length)!=t.length)return!1;for(r=o;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=p(n);if((o=v.length)!==p(t).length)return!1;for(r=o;0!=r--;)if(!m.call(t,v[r]))return!1;for(r=o;0!=r--;)if(!e(n[i=v[r]],t[i]))return!1;return!0}return n!=n&&t!=t}(e,n)}function ae(e){setTimeout(e,0)}function ue(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 y(e){var n={};for(var t in e)le(e,t)&&(n[t]={value:e[t],version:0});return n}function se(e){var n={};for(var t in e)le(e,t)&&(n[t]=e[t].value);return n}function w(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-=D(JSON.stringify(a)).length)<0&&0<t.length?r.unshift(a):t.push(a)}i=e,o.push(t)}return o}function b(e){var n=e.version||"3.4.0-alpha.1";return e.userAgent+"/"+n}function O(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":b(e)};return n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName),t}function P(e,n){return n&&n.requestHeaderTransform?n.requestHeaderTransform(Y({},e)):e}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 Y({},e,{},n)},{})}function le(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function fe(e){if(!e)return e;var n;for(var t in v){var r=v[t],o=e[r];void 0!==o&&"string"!=typeof o&&((n=n||Y({},e))[r]=String(o))}return n||e}Object.freeze({__proto__:null,btoa:h,base64URLEncode:D,clone:oe,deepEquals:ie,onNextTick:ae,wrapPromiseCallback:ue,transformValuesToVersionedValues:y,transformVersionedValuesToValues:se,chunkUserEventsForUrl:w,getLDUserAgentString:b,getLDHeaders:O,transformHeaders:P,extend:ce,objectHasOwnProperty:le,sanitizeUser:fe});var k=require("uuid").v1;function ve(u,e,s){var t="/a/"+e+".gif",c=ce({"Content-Type":"application/json"},O(u,s)),l=u.httpFallbackPing,f={sendChunk:function(e,r,o,n){var i=JSON.stringify(e),a=o?null:k();return n?function n(t){var e=o?c:ce({},c,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":a});return u.httpRequest("POST",r,P(e,s),i).promise.then(function(e){if(e)return 400<=e.status&&re(e.status)&&t?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 t?n(!1):Promise.reject()})}(!0).catch(function(){}):(l&&l(r+t+"?d="+D(i)),Promise.resolve())},sendEvents:function(e,n,t){if(!u.httpRequest)return Promise.resolve();var r,o=u.httpAllowsPost();r=o?[e]:w(2e3-n.length,e);for(var i=[],a=0;a<r.length;a++)i.push(f.sendChunk(r[a],n,t,o));return Promise.all(i)}};return f}function de(e){var n={},s=e.allAttributesPrivate,c=e.privateAttributeNames||[],l={key:!0,custom:!0,anonymous:!0},f={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;function n(o,i){return Object.keys(o).reduce(function(e,n){var t,r=e;return i(n)&&(l[t=n]||!s&&-1===a.indexOf(t)&&-1===c.indexOf(t)?r[0][n]=o[n]:r[1][n]=!0),r},[{},{}])}var a=e.privateAttributeNames||[],t=n(e,function(e){return f[e]}),r=t[0],o=t[1];if(e.custom){var i=n(e.custom,function(){return!0});r.custom=i[0],o=ce({},o,i[1])}var u=Object.keys(o);return u.length&&(u.sort(),r.privateAttrs=u),r},n}function E(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var S=" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initializing-the-client for instructions on SDK initialization.",U=function(e){return'Expected application/json content type but got "'+e+'"'},I=function(e){return"network error"+(e?" ("+e+")":"")},ge=function(e){return'Custom event "'+e+'" does not exist'},j=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+S},pe=function(){return"No environment/client-side ID was specified."+S},me=function(e){return"Error fetching flag settings: "+E(e)},R=function(){return"No user specified."+S},T=function(){return"Invalid user specified."+S},he=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+S},N=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},ye=function(e,n,t){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+n+" - "+(re(e)?t:"giving up permanently")},A=function(){return"Cannot make HTTP requests in this environment."+S},L=function(e){return"Opening stream connection to "+e},C=function(e,n){return"Error on stream connection: "+E(e)+", will continue retrying every "+n+" milliseconds."},F=function(e){return'Ignoring unknown config option "'+e+'"'},x=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},q=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},_=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},V=function(e){return"polling for feature flags at "+e},we=function(e){return'received streaming update for flag "'+e+'"'},be=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},ke=function(e){return'received streaming deletion for flag "'+e+'"'},Ee=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},Se=function(e){return'enqueueing "'+e+'" event'},De=function(e){return"sending "+e+" events"},J=Object.freeze({__proto__:null,clientInitialized:function(){return"LaunchDarkly client initialized"},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:U,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:function(){return"localStorage is unavailable"},localStorageUnavailableForUserId:function(){return"localStorage is unavailable, so anonymous user ID cannot be cached"},networkError:I,unknownCustomEventKey:ge,environmentNotFound:j,environmentNotSpecified:pe,errorFetchingFlags:me,userNotSpecified:R,invalidUser:T,bootstrapOldFormat:he,bootstrapInvalid:function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},deprecated:N,httpErrorMessage:ye,httpUnavailable:A,identifyDisabled:function(){return"identify() has no effect here; it must be called on the main client instance"},streamClosing:function(){return"Closing stream connection"},streamConnecting:L,streamError:C,unknownOption:F,wrongOptionType:x,wrongOptionTypeBoolean:q,optionBelowMinimum:_,debugPolling:V,debugStreamPing:function(){return"received ping message from stream"},debugStreamPut:function(){return"received streaming update for all flags"},debugStreamPatch:we,debugStreamPatchIgnored:be,debugStreamDelete:ke,debugStreamDeleteIgnored:Ee,debugEnqueueingEvent:Se,debugPostingEvents:De,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"}});var Oe=function(r){var n=!1,t=!1,o=null,e=null,i=new Promise(function(n){r.on("ready",function e(){r.off("ready",e),n()})}).catch(function(){});return{getInitializationPromise:function(){return e||(n?Promise.resolve():t?Promise.reject(o):e=new Promise(function(n,t){r.on("initialized",function e(){r.off("initialized",e),n()}),r.on("failed",function e(n){r.off("failed",e),t(n)})}))},getReadyPromise:function(){return i},signalSuccess:function(){n||t||(n=!0,r.emit("initialized"),r.emit("ready"))},signalFailure:function(e){n||t||(t=!0,o=e,r.emit("failed",e),r.emit("ready")),r.maybeReportError(e)}}};function Pe(t,r,o,i,a){var u={};function s(){var e="",n=i.getUser();return n&&(e=o||h(JSON.stringify(n))),"ld:"+r+":"+e}return u.loadFlags=function(){return t.get(s()).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=y(n):delete n.$schema}return n}catch(e){return u.clearFlags().then(function(){return Promise.reject(e)})}}).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.saveFlags=function(e){var n=ce({},e,{$schema:1});return t.set(s(),JSON.stringify(n)).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u.clearFlags=function(){return t.clear(s()).catch(function(e){return a.warn("localStorage is unavailable"),Promise.reject(e)})},u}function Ue(o,i,a,n){var u,s=i.streamUrl,c=i.logger,e={},l=s+"/eval/"+a,f=i.useReport,v=i.evaluationReasons,t=i.streamReconnectDelay,d=O(o,i),g=!1,p=null,m=null,h=null,y=null,w=null;function b(e){g||(c.warn(C(e,t)),g=!0),S(!1),E(),k(t)}function k(e){m||(e?m=setTimeout(r,e):r())}function r(){var e;m=null;var n="",t={headers:d,readTimeoutMillis:3e5};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=s+"/ping/"+a,n=""):e=l+"/"+D(JSON.stringify(h)),t.headers=P(t.headers,i),v&&(n=n+(n?"&":"")+"withReasons=true"),e=e+(n?"?":"")+n,E(),c.info(L(e)),u=(new Date).getTime(),p=o.eventSourceFactory(e,t),w)le(w,r)&&p.addEventListener(r,w[r]);p.onerror=b}}function E(){p&&(c.info("Closing stream connection"),p.close(),p=null)}function S(e){u&&n&&n.recordStreamInit(u,!e,(new Date).getTime()-u),u=null}return e.connect=function(e,n,t){h=e,y=n,w={};function r(n){w[n]=function(e){S(!(g=!1)),t[n]&&t[n](e)}}for(var o in t||{})r(o);k()},e.disconnect=function(){clearTimeout(m),m=null,E()},e.isConnected=function(){return!!(p&&o.eventSourceIsActive&&o.eventSourceIsActive(p))},e}function Ie(d,g,a){var u=g.baseUrl,s=g.useReport,c=g.evaluationReasons,l=g.logger,e={},p={};function f(e,n){if(!d.httpRequest)return new Promise(function(e,n){n(new te(A()))});var t=n?"REPORT":"GET",r=O(d,g);n&&(r["Content-Type"]="application/json");var o,i,a,u,s,c,l=p[e];l||(o=function(){delete p[e]},(c={addPromise:function(n,e){i=n,a&&a(),a=e,n.then(function(e){i===n&&(u(e),o())},function(e){i===n&&(s(e),o())})}}).resultPromise=new Promise(function(e,n){u=e,s=n}),l=c,p[e]=l);var f=d.httpRequest(t,e,P(r,g),n),v=f.promise.then(function(e){if(200!==e.status)return Promise.reject(404===(n=e).status?new ee(j()):new te(me(n.statusText||String(n.status))));if(e.header("content-type")&&"application/json"===e.header("content-type").substring(0,"application/json".length))return JSON.parse(e.body);var n,t=U(e.header("content-type")||"");return Promise.reject(new te(t))},function(e){return Promise.reject(new te(I(e)))});return l.addPromise(v,function(){f.cancel&&f.cancel()}),l.resultPromise}return e.fetchJSON=function(e){return f(u+e,null)},e.fetchFlagSettings=function(e,n){var t,r,o,i="";return s?(r=[u,"/sdk/evalx/",a,"/user"].join(""),o=JSON.stringify(e)):(t=D(JSON.stringify(e)),r=[u,"/sdk/evalx/",a,"/users/",t].join("")),n&&(i="h="+n),c&&(i=i+(i?"&":"")+"withReasons=true"),r=r+(i?"?":"")+i,l.debug(V(r)),f(r,o)},e}var M=require("uuid").v1;function je(o,i){var e={};return e.validateUser=function(e){if(!e)return Promise.reject(new a(R()));var r=oe(e);return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?(o?o.get("ld:$anonUserId").catch(function(){return null}):Promise.resolve(null)).then(function(e){if(e)return r.key=e,r;var n,t=M();return r.key=t,(n=t,o?o.set("ld:$anonUserId",n).catch(function(){i.warn("localStorage is unavailable, so anonymous user ID cannot be cached")}):Promise.resolve()).then(function(){return r})}):Promise.reject(new a(T()))},e}var z={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}};function Re(e,n,t,r){var a=ce({logger:{default:r}},z,t),o={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function u(e){ae(function(){n&&n.maybeReportError(new d(e))})}var s,c,i,l,f=ce({},e||{});return l=f,Object.keys(o).forEach(function(e){if(void 0!==l[e]){var n=o[e];r&&r.warn(N(e,n)),n&&(void 0===l[n]&&(l[n]=l[e]),delete l[e])}}),i=ce({},f),Object.keys(a).forEach(function(e){void 0!==i[e]&&null!==i[e]||(i[e]=a[e]&&a[e].default)}),s=f=i,c=ce({},s),Object.keys(s).forEach(function(e){var n=s[e];if(null!=n){var t=a[e];if(void 0===t)u(F(e));else{var r=t.type||v(t.default);if("any"!==r){var o=r.split("|"),i=v(n);o.indexOf(i)<0?"boolean"===r?(c[e]=!!n,u(q(e,i))):(u(x(e,r,i)),c[e]=t.default):"number"===i&&void 0!==t.minimum&&n<t.minimum&&(u(_(e,n,t.minimum)),c[e]=t.minimum)}}}}),c;function v(e){if(null===e)return"any";if(void 0!==e){if(Array.isArray(e))return"array";var n=Q(e);return"boolean"===n||"string"===n||"number"===n||"function"===n?n:"object"}}}var H,K=Object.freeze({__proto__:null,baseOptionDefs:z,validate:Re}),$=new Uint8Array(16);function B(){if(!H&&!(H="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return H($)}var G=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function X(e){return"string"==typeof e&&G.test(e)}for(var W,Te,Ne=[],Ae=0;Ae<256;++Ae)Ne.push((Ae+256).toString(16).substr(1));function Le(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,t=(Ne[e[n+0]]+Ne[e[n+1]]+Ne[e[n+2]]+Ne[e[n+3]]+"-"+Ne[e[n+4]]+Ne[e[n+5]]+"-"+Ne[e[n+6]]+Ne[e[n+7]]+"-"+Ne[e[n+8]]+Ne[e[n+9]]+"-"+Ne[e[n+10]]+Ne[e[n+11]]+Ne[e[n+12]]+Ne[e[n+13]]+Ne[e[n+14]]+Ne[e[n+15]]).toLowerCase();if(!X(t))throw TypeError("Stringified UUID is invalid");return t}var Ce=0,Fe=0;function xe(e){if(!X(e))throw TypeError("Invalid UUID");var n,t=new Uint8Array(16);return t[0]=(n=parseInt(e.slice(0,8),16))>>>24,t[1]=n>>>16&255,t[2]=n>>>8&255,t[3]=255&n,t[4]=(n=parseInt(e.slice(9,13),16))>>>8,t[5]=255&n,t[6]=(n=parseInt(e.slice(14,18),16))>>>8,t[7]=255&n,t[8]=(n=parseInt(e.slice(19,23),16))>>>8,t[9]=255&n,t[10]=(n=parseInt(e.slice(24,36),16))/1099511627776&255,t[11]=n/4294967296&255,t[12]=n>>>24&255,t[13]=n>>>16&255,t[14]=n>>>8&255,t[15]=255&n,t}function qe(e,a,u){function n(e,n,t,r){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var n=[],t=0;t<e.length;++t)n.push(e.charCodeAt(t));return n}(e)),"string"==typeof n&&(n=xe(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var o=new Uint8Array(16+e.length);if(o.set(n),o.set(e,n.length),(o=u(o))[6]=15&o[6]|a,o[8]=63&o[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=o[i];return t}return Le(o)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function _e(e){return 14+(e+64>>>9<<4)+1}function Ve(e,n){var t=(65535&e)+(65535&n);return(e>>16)+(n>>16)+(t>>16)<<16|65535&t}function Je(e,n,t,r,o,i){return Ve((a=Ve(Ve(n,e),Ve(r,i)))<<(u=o)|a>>>32-u,t);var a,u}function Me(e,n,t,r,o,i,a){return Je(n&t|~n&r,e,n,o,i,a)}function ze(e,n,t,r,o,i,a){return Je(n&r|t&~r,e,n,o,i,a)}function He(e,n,t,r,o,i,a){return Je(n^t^r,e,n,o,i,a)}function Ke(e,n,t,r,o,i,a){return Je(t^(n|~r),e,n,o,i,a)}var $e=qe("v3",48,function(e){if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=new Uint8Array(n.length);for(var t=0;t<n.length;++t)e[t]=n.charCodeAt(t)}return function(e){for(var n=[],t=32*e.length,r=0;r<t;r+=8){var o=e[r>>5]>>>r%32&255,i=parseInt("0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o),16);n.push(i)}return n}(function(e,n){e[n>>5]|=128<<n%32,e[_e(n)-1]=n;for(var t=1732584193,r=-271733879,o=-1732584194,i=271733878,a=0;a<e.length;a+=16){var u=t,s=r,c=o,l=i;r=Ke(r=Ke(r=Ke(r=Ke(r=He(r=He(r=He(r=He(r=ze(r=ze(r=ze(r=ze(r=Me(r=Me(r=Me(r=Me(r,o=Me(o,i=Me(i,t=Me(t,r,o,i,e[a],7,-680876936),r,o,e[a+1],12,-389564586),t,r,e[a+2],17,606105819),i,t,e[a+3],22,-1044525330),o=Me(o,i=Me(i,t=Me(t,r,o,i,e[a+4],7,-176418897),r,o,e[a+5],12,1200080426),t,r,e[a+6],17,-1473231341),i,t,e[a+7],22,-45705983),o=Me(o,i=Me(i,t=Me(t,r,o,i,e[a+8],7,1770035416),r,o,e[a+9],12,-1958414417),t,r,e[a+10],17,-42063),i,t,e[a+11],22,-1990404162),o=Me(o,i=Me(i,t=Me(t,r,o,i,e[a+12],7,1804603682),r,o,e[a+13],12,-40341101),t,r,e[a+14],17,-1502002290),i,t,e[a+15],22,1236535329),o=ze(o,i=ze(i,t=ze(t,r,o,i,e[a+1],5,-165796510),r,o,e[a+6],9,-1069501632),t,r,e[a+11],14,643717713),i,t,e[a],20,-373897302),o=ze(o,i=ze(i,t=ze(t,r,o,i,e[a+5],5,-701558691),r,o,e[a+10],9,38016083),t,r,e[a+15],14,-660478335),i,t,e[a+4],20,-405537848),o=ze(o,i=ze(i,t=ze(t,r,o,i,e[a+9],5,568446438),r,o,e[a+14],9,-1019803690),t,r,e[a+3],14,-187363961),i,t,e[a+8],20,1163531501),o=ze(o,i=ze(i,t=ze(t,r,o,i,e[a+13],5,-1444681467),r,o,e[a+2],9,-51403784),t,r,e[a+7],14,1735328473),i,t,e[a+12],20,-1926607734),o=He(o,i=He(i,t=He(t,r,o,i,e[a+5],4,-378558),r,o,e[a+8],11,-2022574463),t,r,e[a+11],16,1839030562),i,t,e[a+14],23,-35309556),o=He(o,i=He(i,t=He(t,r,o,i,e[a+1],4,-1530992060),r,o,e[a+4],11,1272893353),t,r,e[a+7],16,-155497632),i,t,e[a+10],23,-1094730640),o=He(o,i=He(i,t=He(t,r,o,i,e[a+13],4,681279174),r,o,e[a],11,-358537222),t,r,e[a+3],16,-722521979),i,t,e[a+6],23,76029189),o=He(o,i=He(i,t=He(t,r,o,i,e[a+9],4,-640364487),r,o,e[a+12],11,-421815835),t,r,e[a+15],16,530742520),i,t,e[a+2],23,-995338651),o=Ke(o,i=Ke(i,t=Ke(t,r,o,i,e[a],6,-198630844),r,o,e[a+7],10,1126891415),t,r,e[a+14],15,-1416354905),i,t,e[a+5],21,-57434055),o=Ke(o,i=Ke(i,t=Ke(t,r,o,i,e[a+12],6,1700485571),r,o,e[a+3],10,-1894986606),t,r,e[a+10],15,-1051523),i,t,e[a+1],21,-2054922799),o=Ke(o,i=Ke(i,t=Ke(t,r,o,i,e[a+8],6,1873313359),r,o,e[a+15],10,-30611744),t,r,e[a+6],15,-1560198380),i,t,e[a+13],21,1309151649),o=Ke(o,i=Ke(i,t=Ke(t,r,o,i,e[a+4],6,-145523070),r,o,e[a+11],10,-1120210379),t,r,e[a+2],15,718787259),i,t,e[a+9],21,-343485551),t=Ve(t,u),r=Ve(r,s),o=Ve(o,c),i=Ve(i,l)}return[t,r,o,i]}(function(e){if(0===e.length)return[];for(var n=8*e.length,t=new Uint32Array(_e(n)),r=0;r<n;r+=8)t[r>>5]|=(255&e[r/8])<<r%32;return t}(e),8*e.length))});function Be(e,n,t,r){switch(e){case 0:return n&t^~n&r;case 1:return n^t^r;case 2:return n&t^n&r^t&r;case 3:return n^t^r}}function Ge(e,n){return e<<n|e>>>32-n}var Xe=qe("v5",80,function(e){var n=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=[];for(var o=0;o<r.length;++o)e.push(r.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var i=e.length/4+2,a=Math.ceil(i/16),u=new Array(a),s=0;s<a;++s){for(var c=new Uint32Array(16),l=0;l<16;++l)c[l]=e[64*s+4*l]<<24|e[64*s+4*l+1]<<16|e[64*s+4*l+2]<<8|e[64*s+4*l+3];u[s]=c}u[a-1][14]=8*(e.length-1)/Math.pow(2,32),u[a-1][14]=Math.floor(u[a-1][14]),u[a-1][15]=8*(e.length-1)&4294967295;for(var f=0;f<a;++f){for(var v=new Uint32Array(80),d=0;d<16;++d)v[d]=u[f][d];for(var g=16;g<80;++g)v[g]=Ge(v[g-3]^v[g-8]^v[g-14]^v[g-16],1);for(var p=t[0],m=t[1],h=t[2],y=t[3],w=t[4],b=0;b<80;++b){var k=Math.floor(b/20),E=Ge(p,5)+Be(k,m,h,y)+w+n[k]+v[b]>>>0;w=y,y=h,h=Ge(m,30)>>>0,m=p,p=E}t[0]=t[0]+p>>>0,t[1]=t[1]+m>>>0,t[2]=t[2]+h>>>0,t[3]=t[3]+y>>>0,t[4]=t[4]+w>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,255&t[0],t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,255&t[1],t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,255&t[2],t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,255&t[3],t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,255&t[4]]}),We=Object.freeze({__proto__:null,v1:function(e,n,t){var r=n&&t||0,o=n||new Array(16),i=(e=e||{}).node||W,a=void 0!==e.clockseq?e.clockseq:Te;if(null==i||null==a){var u=e.random||(e.rng||B)();null==i&&(i=W=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==a&&(a=Te=16383&(u[6]<<8|u[7]))}var s=void 0!==e.msecs?e.msecs:Date.now(),c=void 0!==e.nsecs?e.nsecs:Fe+1,l=s-Ce+(c-Fe)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||Ce<s)&&void 0===e.nsecs&&(c=0),1e4<=c)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Ce=s,Te=a;var f=(1e4*(268435455&(s+=122192928e5))+(Fe=c))%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=255&f;var v=s/4294967296*1e4&268435455;o[r++]=v>>>8&255,o[r++]=255&v,o[r++]=v>>>24&15|16,o[r++]=v>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var d=0;d<6;++d)o[r+d]=i[d];return n||Le(o)},v3:$e,v4:function(e,n,t){var r=(e=e||{}).random||(e.rng||B)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,n){t=t||0;for(var o=0;o<16;++o)n[t+o]=r[o];return n}return Le(r)},v5:Xe,NIL:"00000000-0000-0000-0000-000000000000",version:function(e){if(!X(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)},validate:X,stringify:Le,parse:xe}).v1,Qe=K.baseOptionDefs,Ye=function(e){var n={diagnosticId:We()};return e&&(n.sdkKeySuffix=6<e.length?e.substring(e.length-6):e),n},Ze=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){var r={timestamp:e,failed:n,durationMillis:t};o.push(r)},reset:i}},en=function(r,e,n,t,o,i){var a,u,s=!!r.diagnosticUseCombinedEvent,c="ld:"+t+":$diagnostics",l=o.eventsUrl+"/events/diagnostic/"+t,f=o.diagnosticRecordingInterval,v=e,d=!!o.streaming,g={};function p(){return{sdk:function(){var e=Y({},r.diagnosticSdkData);return o.wrapperName&&(e.wrapperName=o.wrapperName),o.wrapperVersion&&(e.wrapperVersion=o.wrapperVersion),e}(),configuration:(e={customBaseURI:o.baseUrl!==Qe.baseUrl.default,customStreamURI:o.streamUrl!==Qe.streamUrl.default,customEventsURI:o.eventsUrl!==Qe.eventsUrl.default,eventsCapacity:o.eventCapacity,eventsFlushIntervalMillis:o.flushInterval,reconnectTimeMillis:o.streamReconnectDelay,streamingDisabled:!d,allAttributesPrivate:!!o.allAttributesPrivate,inlineUsersInEvents:!!o.inlineUsersInEvents,diagnosticRecordingIntervalMillis:o.diagnosticRecordingInterval,usingSecureMode:!!o.hash,bootstrapMode:!!o.bootstrap,fetchGoalsDisabled:!o.fetchGoals,allowFrequentDuplicateEvents:!!o.allowFrequentDuplicateEvents,sendEventsOnlyForVariation:!!o.sendEventsOnlyForVariation,autoAliasingOptOut:!!o.autoAliasingOptOut},e),platform:r.diagnosticPlatformData};var e}function m(e){o.logger&&o.logger.debug(J.debugPostingDiagnosticEvent(e)),n.sendEvents(e,l,!0).then(function(){}).catch(function(){})}function h(){var e,n;m((e=(new Date).getTime(),n=Y({kind:s?"diagnostic-combined":"diagnostic",id:i,creationDate:e},v.getProps()),s&&(n=Y({},n,{},p())),v.reset(e),n)),u=setTimeout(h,f),a=(new Date).getTime(),s&&function(){if(r.localStorage){var e=Y({},v.getProps());r.localStorage.set(c,JSON.stringify(e),function(){})}}()}return g.start=function(){s?function(t){if(!r.localStorage)return t(!1);r.localStorage.get(c).then(function(e){if(e)try{var n=JSON.parse(e);v.setProps(n),a=n.dataSinceDate}catch(e){}t(!0)}).catch(function(){t(!1)})}(function(e){if(e){var n=(a||0)+f,t=(new Date).getTime();n<=t?h():u=setTimeout(h,n-t)}else 0===Math.floor(4*Math.random())?h():u=setTimeout(h,f)}):(m(Y({kind:"diagnostic-init",id:i,creationDate:v.getProps().dataSinceDate},p())),u=setTimeout(h,f))},g.stop=function(){u&&clearTimeout(u)},g.setStreaming=function(e){d=e},g};function nn(e,n){var i,a=["debug","info","warn","error"];i=null!=n?""===n?"":n+" ":"LD: ";var u=0;e&&(u="none"===e?100:a.indexOf(e));var t={};function r(e,n,t){if(u<=e&&console){var r=console[n];if(r){var o=e<a.length?a[e]:"?";r.call(console,i+"["+o+"] "+t)}}}return t.debug=function(e){return r(0,"log",e)},t.info=function(e){return r(1,"info",e)},t.warn=function(e){return r(2,"warn",e)},t.error=function(e){return r(3,"error",e)},t}function tn(e,n,t,i,r){var a,o,u,s,c,l,f=t&&t.logger?t.logger:r&&r.logger&&r.logger.default||nn("warn"),v=function(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}(f),d=Oe(v),g=Re(t,v,r,f),p=g.sendEvents,m=e,h=g.hash,y=ve(i,m,g),w=g.sendEvents&&!g.diagnosticOptOut,b=w?Ye(m):null,k=w?Ze((new Date).getTime()):null,E=w?en(i,k,y,m,g,b):null,S=Ue(i,g,m,k),D=g.eventProcessor||function(e,n,t,r,o,i){var a,u=3<arguments.length&&void 0!==r?r:null,s=4<arguments.length&&void 0!==o?o:null,c={},l=(5<arguments.length&&void 0!==i?i:null)||ve(e,t,n),f=n.eventsUrl+"/events/bulk/"+t,v=function(){var e={},a=0,u=0,s={};return e.summarizeEvent=function(e){if("feature"===e.kind){var 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?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)}},e.getSummary=function(){var e={},n=!0;for(var t in s){var r=s[t],o=e[r.key];o||(o={default:r.default,counters:[]},e[r.key]=o);var i={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:u,features:e}},e.clearSummary=function(){u=a=0,s={}},e}(),d=de(n),g=n.inlineUsersInEvents,p=n.samplingInterval,m=n.eventCapacity,h=n.flushInterval,y=n.logger,w=[],b=0,k=!1,E=!1;function S(){return 0===p||0===Math.floor(Math.random()*p)}function D(e){w.length<m?(w.push(e),E=!1):(E||(E=!0,y.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),u&&u.incrementDroppedEvents())}return c.enqueue=function(e){if(!k){var n=!1,t=!1;if(v.summarizeEvent(e),"feature"===e.kind?S()&&(n=!!e.trackEvents,t=function(e){return!!e.debugEventsUntilDate&&e.debugEventsUntilDate>b&&e.debugEventsUntilDate>(new Date).getTime()}(e)):n=S(),n&&D(function(e){var n=ce({},e);return"alias"===e.kind||(g||"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}(e)),t){var r=ce({},e,{kind:"debug"});r.user=d.filterUser(r.user),delete r.trackEvents,delete r.debugEventsUntilDate,D(r)}}},c.flush=function(){if(k)return Promise.resolve();var e=w,n=v.getSummary();return v.clearSummary(),n&&(n.kind="summary",e.push(n)),u&&u.setEventsInLastBatch(e.length),0===e.length?Promise.resolve():(w=[],y.debug(De(e.length)),l.sendEvents(e,f).then(function(e){e&&(e.serverTime&&(b=e.serverTime),re(e.status)||(k=!0),400<=e.status&&ae(function(){s.maybeReportError(new Z(ye(e.status,"event posting","some events were dropped")))}))}))},c.start=function(){a=setTimeout(function e(){c.flush(),a=setTimeout(e,h)},h)},c.stop=function(){clearTimeout(a)},c}(i,g,m,k,v,y),O=Ie(i,g,m),P={},U={},I=g.streaming,j=!1,R=!1,T=!0,N=g.stateProvider,A=(c=function(e,n){var t;t=e,N||t&&C({kind:"identify",key:t.key,user:t,creationDate:(new Date).getTime()}),!g.autoAliasingOptOut&&n&&n.anonymous&&e&&!e.anonymous&&V(e,n)},{setUser:function(e){var n=l&&oe(l);(l=fe(e))&&c&&c(oe(l),n)},getUser:function(){return l?oe(l):null}}),L=je(i.localStorage,f);function C(e){if(m&&!(N&&N.enqueueEvent&&N.enqueueEvent(e))){if("alias"!==e.kind){if(!e.user)return void(T&&(f.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"),T=!1));T=!1}!p||R||i.isDoNotTrack()||(f.debug(Se(e.kind)),D.enqueue(e))}}function F(e,n,t,r){var o=A.getUser(),i=new Date,a=n?n.value:null;if(!g.allowFrequentDuplicateEvents){var u=JSON.stringify(a)+(o&&o.key?o.key:"")+e,s=P[u];if(s&&i-s<3e5)return;P[u]=i}var c={kind:"feature",key:e,user:o,value:a,variation:n?n.variationIndex:null,default:t,creationDate:i.getTime()};o&&o.anonymous&&(c.contextKind=_(o));var l=U[e];l&&(c.version=l.flagVersion?l.flagVersion:l.version,c.trackEvents=l.trackEvents,c.debugEventsUntilDate=l.debugEventsUntilDate),(r||l&&l.trackReason)&&n&&(c.reason=n.reason),C(c)}function x(e,n,t,r){var o;if(U&&le(U,e)&&U[e]&&!U[e].deleted){var i=U[e];o=q(i),null!==i.value&&void 0!==i.value||(o.value=n)}else o={value:n,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return t&&F(e,o,n,r),o}function q(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}}function _(e){return e.anonymous?"anonymousUser":"user"}function V(e,n){N||e&&n&&C({kind:"alias",key:e.key,contextKind:_(e),previousKey:n.key,previousContextKind:_(n),creationDate:(new Date).getTime()})}function J(){o=!0,A.getUser()&&S.connect(A.getUser(),h,{ping:function(){f.debug("received ping message from stream");var n=A.getUser();O.fetchFlagSettings(n,h).then(function(e){ie(n,A.getUser())&&z(e||{})}).catch(function(e){v.maybeReportError(new te(me(e)))})},put:function(e){var n=JSON.parse(e.data);f.debug("received streaming update for all flags"),z(n)},patch:function(e){var n=JSON.parse(e.data),t=U[n.key];if(!t||!t.version||!n.version||t.version<n.version){f.debug(we(n.key));var r={},o=ce({},n);delete o.key;var i=q(U[n.key]=o);r[n.key]=t?{previous:t.value,current:i}:{current:i},H(r)}else f.debug(be(n.key))},delete:function(e){var n=JSON.parse(e.data);if(!U[n.key]||U[n.key].version<n.version){f.debug(ke(n.key));var t={};U[n.key]&&!U[n.key].deleted&&(t[n.key]={previous:U[n.key].value}),U[n.key]={version:n.version,deleted:!0},H(t)}else f.debug(Ee(n.key))}})}function M(){o&&(S.disconnect(),o=!1)}function z(e){var n={};if(!e)return Promise.resolve();for(var t in U)le(U,t)&&U[t]&&(e[t]&&!ie(e[t].value,U[t].value)?n[t]={previous:U[t].value,current:q(e[t])}:e[t]&&!e[t].deleted||(n[t]={previous:U[t].value}));for(var r in e)le(e,r)&&e[r]&&(!U[r]||U[r].deleted)&&(n[r]={current:q(e[r])});return U=Y({},e),H(n).catch(function(){})}function H(o){var e=Object.keys(o);if(0<e.length){var i={};e.forEach(function(e){var n=o[e].current,t=n?n.value:void 0,r=o[e].previous;v.emit("change:"+e,t,r),i[e]=n?{current:t,previous:r}:{previous:r}}),v.emit("change",i),v.emit("internal-change",U),g.sendEventsOnlyForVariation||N||e.forEach(function(e){F(e,o[e].current)})}return a&&s?s.saveFlags(U).catch(function(){return null}):Promise.resolve()}function K(){var e=I||u&&void 0===I;e&&!o?J():!e&&o&&M(),E&&E.setStreaming(e)}function $(e){return"change"===e||"change:"===e.substr(0,"change".length+1)}if(i.localStorage&&(s=new Pe(i.localStorage,m,h,A,f)),"string"==typeof g.bootstrap&&"LOCALSTORAGE"===g.bootstrap.toUpperCase()&&(s?a=!0:f.warn("localStorage is unavailable")),"object"===Q(g.bootstrap)&&(U=function(t){var e=Object.keys(t),r=t.$flagsState;!r&&e.length&&f.warn(he()),!1===t.$valid&&f.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var o={};return e.forEach(function(e){if("$flagsState"!==e&&"$valid"!==e){var n={value:t[e]};r&&r[e]?n=ce(n,r[e]):n.version=0,o[e]=n}}),o}(g.bootstrap)),N){var B=N.getInitialState();B?G(B):N.on("init",G),N.on("update",function(e){e.user&&A.setUser(e.user),e.flags&&z(e.flags)})}else(e?L.validateUser(n).then(function(e){return A.setUser(e),"object"===Q(g.bootstrap)?X():a?s.loadFlags().catch(function(){return null}).then(function(e){return null==e?(U={},O.fetchFlagSettings(A.getUser(),h).then(function(e){return z(e||{})}).then(X).catch(function(e){W(new te(me(e)))})):(U=e,ae(X),O.fetchFlagSettings(A.getUser(),h).then(function(e){return z(e)}).catch(function(e){return v.maybeReportError(e)}))}):O.fetchFlagSettings(A.getUser(),h).then(function(e){U=e||{},X()}).catch(function(e){U={},W(e)})}):Promise.reject(new ee(pe()))).catch(W);function G(e){m=e.environment,A.setUser(e.user),U=Y({},e.flags),ae(X)}function X(){f.info("LaunchDarkly client initialized"),j=!0,K(),d.signalSuccess()}function W(e){d.signalFailure(e)}return{client:{waitForInitialization:function(){return d.getInitializationPromise()},waitUntilReady:function(){return d.getReadyPromise()},identify:function(e,r,n){return R?ue(Promise.resolve({}),n):N?(f.warn("identify() has no effect here; it must be called on the main client instance"),ue(Promise.resolve(se(U)),n)):ue((a&&s?s.clearFlags():Promise.resolve()).then(function(){return L.validateUser(e)}).then(function(t){return O.fetchFlagSettings(t,r).then(function(e){var n=se(e);return A.setUser(t),h=r,e?z(e).then(function(){return n}):n})}).then(function(e){return o&&J(),e}).catch(function(e){return v.maybeReportError(e),Promise.reject(e)}),n)},getUser:function(){return A.getUser()},variation:function(e,n){return x(e,n,!0,!1).value},variationDetail:function(e,n){return x(e,n,!0,!0)},track:function(e,n,t){if("string"==typeof e){i.customEventFilter&&!i.customEventFilter(e)&&f.warn(ge(e));var r=A.getUser(),o={kind:"custom",key:e,user:r,url:i.getCurrentUrl(),creationDate:(new Date).getTime()};r&&r.anonymous&&(o.contextKind=_(r)),null!=n&&(o.data=n),null!=t&&(o.metricValue=t),C(o)}else v.maybeReportError(new ne(ge(e)))},alias:V,on:function(e,n,t){$(e)?(u=!0,j&&K(),v.on(e,n,t)):v.on.apply(v,arguments)},off:function(e){if(v.off.apply(v,arguments),$(e)){var n=!1;v.getEvents().forEach(function(e){$(e)&&0<v.getEventListenerCount(e)&&(n=!0)}),n||(u=!1,o&&void 0===I&&M())}},setStreaming:function(e){var n=null===e?void 0:e;n!==I&&(I=n,K())},flush:function(e){return ue(p?D.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!U)return e;for(var n in U)le(U,n)&&(e[n]=x(n,null,!g.sendEventsOnlyForVariation).value);return e},close:function(e){if(R)return ue(Promise.resolve(),e);function n(){R=!0,U={}}return ue(Promise.resolve().then(function(){if(M(),E&&E.stop(),p)return D.stop(),D.flush()}).then(n).catch(n),e)}},options:g,emitter:v,ident:A,logger:f,requestor:O,start:function(){p&&(E&&E.start(),D.start())},enqueueEvent:C,getFlagsInternal:function(){return U},getEnvironmentId:function(){return m},internalChangeEventName:"internal-change"}}function rn(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,r)}return t}function on(o){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?rn(Object(i),!0).forEach(function(e){var n,t,r;n=o,r=i[t=e],t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):rn(Object(i)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(i,e))})}return o}var an={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function un(e,n,t,r,o){if(o&&!function(){var e=window.navigator&&window.navigator.userAgent;if(e){var n=e.match(/Chrom(e|ium)\/([0-9]+)\./);if(n)return parseInt(n[2],10)<73}return!0}())return an;var i=new window.XMLHttpRequest;for(var a in i.open(e,n,!o),t||{})Object.prototype.hasOwnProperty.call(t,a)&&i.setRequestHeader(a,t[a]);if(o)return i.send(r),an;var u;return{promise:new Promise(function(e,n){i.addEventListener("load",function(){u||e({status:i.status,header:function(e){return i.getResponseHeader(e)},body:i.responseText})}),i.addEventListener("error",function(){u||n(new Error)}),i.send(r)}),cancel:function(){u=!0,i.abort()}}}var sn=/[|\\{}()[\]^$+*?.]/g,cn=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(sn,"\\$&")};function ln(e,n,t,r){var o,i,a=(("substring"===e.kind||"regex"===e.kind)&&r.includes("/")?n:n.replace(r,"")).replace(t,"");switch(e.kind){case"exact":i=n,o=new RegExp("^"+cn(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+cn(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+cn(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function fn(e,r){for(var n={},t=null,o=[],i=0;i<e.length;i++)for(var a=e[i],u=a.urls||[],s=0;s<u.length;s++)if(ln(u[s],window.location.href,window.location.search,window.location.hash)){"pageview"===a.kind?r("pageview",a):(o.push(a),r("click_pageview",a));break}return 0<o.length&&(t=function(e){for(var n=function(e,n){for(var t=[],r=0;r<n.length;r++)for(var o=e.target,i=n[r],a=i.selector,u=document.querySelectorAll(a);o&&0<u.length;){for(var s=0;s<u.length;s++)o===u[s]&&t.push(i);o=o.parentNode}return t}(e,o),t=0;t<n.length;t++)r("click",n[t])},document.addEventListener("click",t)),n.dispose=function(){document.removeEventListener("click",t)},n}var vn=300;function dn(o,n){var t,r;function i(){r&&r.dispose(),t&&t.length&&(r=fn(t,a))}function a(e,n){var t=o.ident.getUser(),r={kind:e,key:n.key,data:null,url:window.location.href,user:t,creationDate:(new Date).getTime()};return t&&t.anonymous&&(r.contextKind="anonymousUser"),"click"===e&&(r.selector=n.selector),o.enqueueEvent(r)}function u(e,n){var t,r=window.location.href;function o(){(t=window.location.href)!==r&&(r=t,n())}!function e(n,t){n(),setTimeout(function(){e(n,t)},t)}(o,e),window.history&&window.history.pushState?window.addEventListener("popstate",o):window.addEventListener("hashchange",o)}return o.requestor.fetchJSON("/sdk/goals/"+o.getEnvironmentId()).then(function(e){e&&0<e.length&&(r=fn(t=e,a),u(vn,i)),n()}).catch(function(e){o.emitter.maybeReportError(new s.LDUnexpectedResponseError((e&&e.message,e.message))),n()}),{}}var gn="goalsReady",pn={fetchGoals:{default:!0},hash:{type:"string"},eventProcessor:{type:"object"},eventUrlTransformer:{type:"function"},disableSyncEventPost:{default:!1}};function mn(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=function(e){var n,i={synchronousFlush:!1};if(window.XMLHttpRequest){var a=e&&e.disableSyncEventPost;i.httpRequest=function(e,n,t,r){var o=i.synchronousFlush&!a;return i.synchronousFlush=!1,un(e,n,t,r,o)}}i.httpAllowsPost=function(){return void 0===n&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},i.httpFallbackPing=function(e){(new window.Image).src=e};var r,t=e&&e.eventUrlTransformer;i.getCurrentUrl=function(){return t?t(window.location.href):window.location.href},i.isDoNotTrack=function(){var e;return 1===(e=window.navigator&&void 0!==window.navigator.doNotTrack?window.navigator.doNotTrack:window.navigator&&void 0!==window.navigator.msDoNotTrack?window.navigator.msDoNotTrack:window.doNotTrack)||!0===e||"1"===e||"yes"===e};try{window.localStorage&&(i.localStorage={get:function(n){return new Promise(function(e){e(window.localStorage.getItem(n))})},set:function(n,t){return new Promise(function(e){window.localStorage.setItem(n,t),e()})},clear:function(n){return new Promise(function(e){window.localStorage.removeItem(n),e()})}})}catch(e){i.localStorage=null}var o=e&&e.useReport;if(r=o&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(i.eventSourceAllowsReport=!0,window.EventSourcePolyfill):(i.eventSourceAllowsReport=!1,window.EventSource),window.EventSource){i.eventSourceFactory=function(e,n){var t=on(on({},{heartbeatTimeout:3e5,silentTimeout:3e5,skipDefaultHeaders:!0}),n);return new r(e,t)},i.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return i.userAgent="JSClient",i.version="2.20.0-alpha.1",i.diagnosticSdkData={name:"js-client-sdk",version:"2.20.0-alpha.1"},i.diagnosticPlatformData={name:"JS"},i.diagnosticUseCombinedEvent=!0,i}(t),o=tn(e,n,t,r,pn),i=o.client,a=o.options,u=o.emitter,s=new Promise(function(e){var n=u.on(gn,function(){u.off(gn,n),e()})});i.waitUntilGoalsReady=function(){return s},a.fetchGoals?dn(o,function(){return u.emit(gn)}):u.emit(gn),"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();function c(){r.synchronousFlush=!0,i.flush().catch(function(){}),r.synchronousFlush=!1}return window.addEventListener("beforeunload",c),window.addEventListener("unload",c),i}var hn=nn,yn="2.20.0-alpha.1";var wn={initialize:function(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return console&&console.warn&&console.warn(J.deprecated("default export","named LDClient export")),mn(e,n,t)},version:yn};e.createConsoleLogger=hn,e.default=wn,e.initialize=mn,e.version=yn,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ldclient.min.js.map
{
"name": "launchdarkly-js-client-sdk",
"version": "2.19.4",
"version": "2.20.0-alpha.1",
"description": "LaunchDarkly SDK for JavaScript",

@@ -83,3 +83,3 @@ "author": "LaunchDarkly <team@launchdarkly.com>",

"escape-string-regexp": "^1.0.5",
"launchdarkly-js-sdk-common": "3.3.2"
"launchdarkly-js-sdk-common": "3.4.0-alpha.1"
},

@@ -86,0 +86,0 @@ "repository": {

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