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

launchdarkly-vue-client-sdk

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 1.0.0 to 1.0.1

4

CHANGELOG.md

@@ -8,5 +8,1 @@ # Change log

- Initial release
## [1.0.0] - 2022-06-03
### Added:
- Initial release

5

dist/launchdarkly-vue-client-sdk.es.js

@@ -1305,4 +1305,5 @@ var __defProp = Object.defineProperty;

}
const getLDFlag = (isLdReady, $ldClient, enableStreaming = true) => {
const getLDFlag = (ldReady, $ldClient, enableStreaming = true) => {
return function ldFlag(flagKey, defaultFlagValue) {
const isLdReady = ldReady.value;
const flagValue = isLdReady ? $ldClient.variation(flagKey, defaultFlagValue) : defaultFlagValue;

@@ -1362,3 +1363,3 @@ const flagRef = ref(flagValue);

const enableStreaming = pluginOptions.streaming === false || initOptions.streaming === false ? false : true;
app.provide(LD_FLAG, getLDFlag(ldReady.value, $ldClient, enableStreaming));
app.provide(LD_FLAG, getLDFlag(ldReady, $ldClient, enableStreaming));
$ldClient.on("ready", () => ldReady.value = true);

@@ -1365,0 +1366,0 @@ return [$ldReady, $ldClient];

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

(function(R,N){typeof exports=="object"&&typeof module!="undefined"?N(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],N):(R=typeof globalThis!="undefined"?globalThis:R||self,N(R["launchdarkly-vue-client-sdk"]={},R.Vue))})(this,function(R,N){"use strict";var Kt=Object.defineProperty;var ht=Object.getOwnPropertySymbols;var Xt=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable;var yt=(R,N,J)=>N in R?Kt(R,N,{enumerable:!0,configurable:!0,writable:!0,value:J}):R[N]=J,cn=(R,N)=>{for(var J in N||(N={}))Xt.call(N,J)&&yt(R,J,N[J]);if(ht)for(var J of ht(N))Wt.call(N,J)&&yt(R,J,N[J]);return R};function J(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,r)}return t}function B(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?J(Object(t),!0).forEach(function(r){wt(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):J(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function Se(e){return(Se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(e)}function wt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ln(e){return function(n){if(Array.isArray(n))return Ne(n)}(e)||function(n){if(typeof Symbol!="undefined"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}(e)||function(n,t){if(n){if(typeof n=="string")return Ne(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);return r==="Object"&&n.constructor&&(r=n.constructor.name),r==="Map"||r==="Set"?Array.from(n):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ne(n,t):void 0}}(e)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Ne(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function te(e){function n(t,r){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=t,this.code=r}return n.prototype=new Error,n.prototype.name=e,n.prototype.constructor=n,n}var fn=te("LaunchDarklyUnexpectedResponseError"),Ae=te("LaunchDarklyInvalidEnvironmentIdError"),Fe=te("LaunchDarklyInvalidUserError"),dn=te("LaunchDarklyInvalidEventKeyError"),vn=te("LaunchDarklyInvalidArgumentError"),re=te("LaunchDarklyFlagFetchError"),gn=te("LaunchDarklyInvalidDataError");function Pe(e){return!(e>=400&&e<500)||e===400||e===408||e===429}for(var pn=Object.freeze({__proto__:null,LDUnexpectedResponseError:fn,LDInvalidEnvironmentIdError:Ae,LDInvalidUserError:Fe,LDInvalidEventKeyError:dn,LDInvalidArgumentError:vn,LDFlagFetchError:re,LDInvalidDataError:gn,isHttpErrorRecoverable:Pe}),K=[],Ce=[],xe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",se=0,bt=xe.length;se<bt;++se)K[se]=xe[se],Ce[xe.charCodeAt(se)]=se;function kt(e,n,t){for(var r,o,c=[],s=n;s<t;s+=3)r=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),c.push(K[(o=r)>>18&63]+K[o>>12&63]+K[o>>6&63]+K[63&o]);return c.join("")}Ce["-".charCodeAt(0)]=62,Ce["_".charCodeAt(0)]=63;var mn=Array.isArray,hn=Object.keys,Et=Object.prototype.hasOwnProperty,yn=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function ge(e,n){return(e.endsWith("/")?e.substring(0,e.length-1):e)+(n.startsWith("/")?"":"/")+n}function _e(e){return function(n){for(var t,r=n.length,o=r%3,c=[],s=0,u=r-o;s<u;s+=16383)c.push(kt(n,s,s+16383>u?u:s+16383));return o===1?(t=n[r-1],c.push(K[t>>2]+K[t<<4&63]+"==")):o===2&&(t=(n[r-2]<<8)+n[r-1],c.push(K[t>>10]+K[t>>4&63]+K[t<<2&63]+"=")),c.join("")}(function(n){for(var t=[],r=0;r<n.length;r++)t.push(n.charCodeAt(r));return t}(unescape(encodeURIComponent(e))))}function pe(e){return _e(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function me(e){return JSON.parse(JSON.stringify(e))}function qe(e,n){return function t(r,o){if(r===o)return!0;if(r&&o&&typeof r=="object"&&typeof o=="object"){var c,s,u,d=mn(r),f=mn(o);if(d&&f){if((s=r.length)!=o.length)return!1;for(c=s;c--!=0;)if(!t(r[c],o[c]))return!1;return!0}if(d!=f)return!1;var y=r instanceof Date,v=o instanceof Date;if(y!=v)return!1;if(y&&v)return r.getTime()==o.getTime();var k=r instanceof RegExp,h=o instanceof RegExp;if(k!=h)return!1;if(k&&h)return r.toString()==o.toString();var p=hn(r);if((s=p.length)!==hn(o).length)return!1;for(c=s;c--!=0;)if(!Et.call(o,p[c]))return!1;for(c=s;c--!=0;)if(!t(r[u=p[c]],o[u]))return!1;return!0}return r!=r&&o!=o}(e,n)}function he(e){setTimeout(e,0)}function oe(e,n){var t=e.then(function(r){return n&&setTimeout(function(){n(null,r)},0),r},function(r){if(!n)return Promise.reject(r);setTimeout(function(){n(r,null)},0)});return n?void 0:t}function wn(e){var n={};for(var t in e)Z(e,t)&&(n[t]={value:e[t],version:0});return n}function Ve(e){var n={};for(var t in e)Z(e,t)&&(n[t]=e[t].value);return n}function bn(e,n){for(var t,r=n.slice(0),o=[],c=e;r.length>0;){for(t=[];c>0;){var s=r.shift();if(!s)break;(c-=pe(JSON.stringify(s)).length)<0&&t.length>0?r.unshift(s):t.push(s)}c=e,o.push(t)}return o}function kn(e){var n=e.version||"3.6.0";return e.userAgent+"/"+n}function M(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.reduce(function(r,o){return B(B({},r),o)},{})}function Z(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function En(e){if(!e)return e;var n;for(var t in yn){var r=yn[t],o=e[r];o!==void 0&&typeof o!="string"&&((n=n||B({},e))[r]=String(o))}return n||e}for(var Dn=Object.freeze({__proto__:null,appendUrlPath:ge,btoa:_e,base64URLEncode:pe,clone:me,deepEquals:qe,onNextTick:he,wrapPromiseCallback:oe,transformValuesToVersionedValues:wn,transformVersionedValuesToValues:Ve,chunkUserEventsForUrl:bn,getLDUserAgentString:kn,extend:M,objectHasOwnProperty:Z,sanitizeUser:En}),Dt=function(e,n){return function(t){var r=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(r){var o=new Uint8Array(16);t.exports=function(){return r(o),o}}else{var c=new Array(16);t.exports=function(){for(var s,u=0;u<16;u++)(3&u)==0&&(s=4294967296*Math.random()),c[u]=s>>>((3&u)<<3)&255;return c}}}(n={exports:{}}),n.exports}(),Sn=[],Oe=0;Oe<256;++Oe)Sn[Oe]=(Oe+256).toString(16).substr(1);var Pn,ze,Je=0,Me=0,$e=function(e,n,t){var r=n&&t||0,o=n||[],c=(e=e||{}).node||Pn,s=e.clockseq!==void 0?e.clockseq:ze;if(c==null||s==null){var u=Dt();c==null&&(c=Pn=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),s==null&&(s=ze=16383&(u[6]<<8|u[7]))}var d=e.msecs!==void 0?e.msecs:new Date().getTime(),f=e.nsecs!==void 0?e.nsecs:Me+1,y=d-Je+(f-Me)/1e4;if(y<0&&e.clockseq===void 0&&(s=s+1&16383),(y<0||d>Je)&&e.nsecs===void 0&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Je=d,Me=f,ze=s;var v=(1e4*(268435455&(d+=122192928e5))+f)%4294967296;o[r++]=v>>>24&255,o[r++]=v>>>16&255,o[r++]=v>>>8&255,o[r++]=255&v;var k=d/4294967296*1e4&268435455;o[r++]=k>>>8&255,o[r++]=255&k,o[r++]=k>>>24&15|16,o[r++]=k>>>16&255,o[r++]=s>>>8|128,o[r++]=255&s;for(var h=0;h<6;++h)o[r+h]=c[h];return n||function(p,P){var S=P||0,b=Sn;return[b[p[S++]],b[p[S++]],b[p[S++]],b[p[S++]],"-",b[p[S++]],b[p[S++]],"-",b[p[S++]],b[p[S++]],"-",b[p[S++]],b[p[S++]],"-",b[p[S++]],b[p[S++]],b[p[S++]],b[p[S++]],b[p[S++]],b[p[S++]]].join("")}(o)},ye=["debug","info","warn","error","none"];function On(e,n){if(e&&e.destination&&typeof e.destination!="function")throw new Error("destination for basicLogger was set to a non-function");function t(k){return function(h){console&&console[k]&&console[k].call(console,h)}}var r=e&&e.destination?[e.destination,e.destination,e.destination,e.destination]:[t("log"),t("info"),t("warn"),t("error")],o=!(!e||!e.destination),c=e&&e.prefix!==void 0&&e.prefix!==null?e.prefix:"[LaunchDarkly] ",s=1;if(e&&e.level)for(var u=0;u<ye.length;u++)ye[u]===e.level&&(s=u);function d(k,h,p){if(!(p.length<1)){var P,S=o?h+": "+c:c;if(p.length!==1&&n){var b=ln(p);b[0]=S+b[0],P=n.apply(void 0,ln(b))}else P=S+p[0];try{r[k](P)}catch(O){console&&console.log&&console.log("[LaunchDarkly] Configured logger's "+h+" method threw an exception: "+O)}}}for(var f={},y=function(k){var h=ye[k];if(h!=="none")if(k<s)f[h]=function(){};else{var p=k;f[h]=function(){d(p,h,arguments)}}},v=0;v<ye.length;v++)y(v);return f}function In(e,n){return On({level:e,prefix:n})}function He(e){return e&&e.message?e.message:typeof e=="string"||e instanceof String?e:JSON.stringify(e)}var ce=" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initializing-the-client for instructions on SDK initialization.",Ln=function(e){return'Expected application/json content type but got "'+e+'"'},Be=function(e){return"local storage is unavailable: "+He(e)},Un=function(e){return"network error"+(e?" ("+e+")":"")},Ge=function(e){return'Custom event "'+e+'" does not exist'},jn=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+ce},Rn=function(){return"No environment/client-side ID was specified."+ce},Ie=function(e){return"Error fetching flag settings: "+He(e)},Tn=function(){return"No user specified."+ce},Nn=function(){return"Invalid user specified."+ce},An=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+ce},Fn=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},Cn=function(e,n,t){return"Received error "+e+(e===401?" (invalid SDK key)":"")+" for "+n+" - "+(Pe(e)?t:"giving up permanently")},xn=function(){return"Cannot make HTTP requests in this environment."+ce},_n=function(e){return"Opening stream connection to "+e},qn=function(e,n){return"Error on stream connection: "+He(e)+", will continue retrying every "+n+" milliseconds."},Vn=function(e){return'Ignoring unknown config option "'+e+'"'},zn=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},Jn=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},Mn=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},$n=function(e){return"polling for feature flags at "+e},Hn=function(e){return'received streaming update for flag "'+e+'"'},Bn=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},Gn=function(e){return'received streaming deletion for flag "'+e+'"'},Kn=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},Xn=function(e){return'enqueueing "'+e+'" event'},Wn=function(e){return"sending "+e+" events"},Yn=function(e){return'Config option "'.concat(e,'" must only contain letters, numbers, ., _ or -.')},Zn=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:Ln,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:Be,networkError:Un,unknownCustomEventKey:Ge,environmentNotFound:jn,environmentNotSpecified:Rn,errorFetchingFlags:Ie,userNotSpecified:Tn,invalidUser:Nn,invalidData:function(){return"Invalid data received from LaunchDarkly; connection may have been interrupted"},bootstrapOldFormat:An,bootstrapInvalid:function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},deprecated:Fn,httpErrorMessage:Cn,httpUnavailable:xn,identifyDisabled:function(){return"identify() has no effect here; it must be called on the main client instance"},streamClosing:function(){return"Closing stream connection"},streamConnecting:_n,streamError:qn,unknownOption:Vn,wrongOptionType:zn,wrongOptionTypeBoolean:Jn,optionBelowMinimum:Mn,debugPolling:$n,debugStreamPing:function(){return"received ping message from stream"},debugStreamPut:function(){return"received streaming update for all flags"},debugStreamPatch:Hn,debugStreamPatchIgnored:Bn,debugStreamDelete:Gn,debugStreamDeleteIgnored:Kn,debugEnqueueingEvent:Xn,debugPostingEvents:Wn,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"},invalidTagValue:Yn}),Qn={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},requestHeaderTransform:{type:"function"},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},diagnosticRecordingInterval:{default:9e5,minimum:2e3},diagnosticOptOut:{default:!1},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"},autoAliasingOptOut:{default:!1},application:{validator:function(e,n,t,r){var o={};return t.id&&(o.id=et("".concat(e,".id"),n,t.id,r)),t.version&&(o.version=et("".concat(e,".version"),n,t.version,r)),o}}},St=/^(\w|\.|-)+$/;function et(e,n,t,r){if(typeof t=="string"&&t.match(St))return t;r.warn(Yn(e))}function nt(e,n,t,r){var o=M({logger:{default:r}},Qn,t),c={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function s(d){he(function(){n&&n.maybeReportError(new vn(d))})}var u=M({},e||{});return function(d){var f=d;Object.keys(c).forEach(function(y){if(f[y]!==void 0){var v=c[y];r&&r.warn(Fn(y,v)),v&&(f[v]===void 0&&(f[v]=f[y]),delete f[y])}})}(u),function(d){ye.forEach(function(f){if(f!=="none"&&(!d[f]||typeof d[f]!="function"))throw new Error("Provided logger instance must support logger."+f+"(...) method")})}((u=function(d){var f=M({},d),y=function(v){if(v===null)return"any";if(v!==void 0){if(Array.isArray(v))return"array";var k=Se(v);return k==="boolean"||k==="string"||k==="number"||k==="function"?k:"object"}};return Object.keys(d).forEach(function(v){var k=d[v];if(k!=null){var h=o[v];if(h===void 0)s(Vn(v));else{var p=h.type||y(h.default),P=h.validator;if(P){var S=P(v,d,d[v],r);S!==void 0?f[v]=S:delete f[v]}else if(p!=="any"){var b=p.split("|"),O=y(k);b.indexOf(O)<0?p==="boolean"?(f[v]=!!k,s(Jn(v,O))):(s(zn(v,p,O)),f[v]=h.default):O==="number"&&h.minimum!==void 0&&k<h.minimum&&(s(Mn(v,k,h.minimum)),f[v]=h.minimum)}}}}),f}(u=function(d){var f=M({},d);return Object.keys(o).forEach(function(y){f[y]!==void 0&&f[y]!==null||(f[y]=o[y]&&o[y].default)}),f}(u))).logger),u}function tt(e){var n={};return e&&(e.application&&e.application.id!==void 0&&e.application.id!==null&&(n["application-id"]=[e.application.id]),e.application&&e.application.version!==void 0&&e.application.id!==null&&(n["application-version"]=[e.application.version])),n}function Ke(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":kn(e)};n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName);var r=tt(n),o=Object.keys(r);return o.length&&(t["x-launchdarkly-tags"]=o.sort().flatMap(function(c){return Array.isArray(r[c])?r[c].sort().map(function(s){return"".concat(c,"/").concat(s)}):["".concat(c,"/").concat(r[c])]}).join(" ")),t}function Xe(e,n){return n&&n.requestHeaderTransform?n.requestHeaderTransform(B({},e)):e}function rt(e,n,t){var r="/a/"+n+".gif",o=M({"Content-Type":"application/json"},Ke(e,t)),c=e.httpFallbackPing,s={sendChunk:function(u,d,f,y){var v=JSON.stringify(u),k=f?null:$e();return y?function h(p){var P=f?o:M({},o,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":k});return e.httpRequest("POST",d,Xe(P,t),v).promise.then(function(S){if(S)return S.status>=400&&Pe(S.status)&&p?h(!1):function(b){var O={status:b.status},j=b.header("date");if(j){var A=Date.parse(j);A&&(O.serverTime=A)}return O}(S)}).catch(function(){return p?h(!1):Promise.reject()})}(!0).catch(function(){}):(c&&c(d+r+"?d="+pe(v)),Promise.resolve())},sendEvents:function(u,d,f){if(!e.httpRequest)return Promise.resolve();var y,v=e.httpAllowsPost();y=v?[u]:bn(2e3-d.length,u);for(var k=[],h=0;h<y.length;h++)k.push(s.sendChunk(y[h],d,f,v));return Promise.all(k)}};return s}function Pt(){var e={},n=0,t=0,r={};return e.summarizeEvent=function(o){if(o.kind==="feature"){var c=o.key+":"+(o.variation!==null&&o.variation!==void 0?o.variation:"")+":"+(o.version!==null&&o.version!==void 0?o.version:""),s=r[c];s?s.count=s.count+1:r[c]={count:1,key:o.key,variation:o.variation,version:o.version,value:o.value,default:o.default},(n===0||o.creationDate<n)&&(n=o.creationDate),o.creationDate>t&&(t=o.creationDate)}},e.getSummary=function(){var o={},c=!0;for(var s in r){var u=r[s],d=o[u.key];d||(d={default:u.default,counters:[]},o[u.key]=d);var f={value:u.value,count:u.count};u.variation!==void 0&&u.variation!==null&&(f.variation=u.variation),u.version?f.version=u.version:f.unknown=!0,d.counters.push(f),c=!1}return c?null:{startDate:n,endDate:t,features:o}},e.clearSummary=function(){n=0,t=0,r={}},e}function Ot(e){var n={},t=e.allAttributesPrivate,r=e.privateAttributeNames||[],o={key:!0,custom:!0,anonymous:!0},c={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0};return n.filterUser=function(s){if(!s)return null;var u=s.privateAttributeNames||[],d=function(p,P){return Object.keys(p).reduce(function(S,b){var O=S;return P(b)&&(function(j){return!o[j]&&(t||u.indexOf(j)!==-1||r.indexOf(j)!==-1)}(b)?O[1][b]=!0:O[0][b]=p[b]),O},[{},{}])},f=d(s,function(p){return c[p]}),y=f[0],v=f[1];if(s.custom){var k=d(s.custom,function(){return!0});y.custom=k[0],v=M({},v,k[1])}var h=Object.keys(v);return h.length&&(h.sort(),y.privateAttrs=h),y},n}function It(e,n,t,r){var o={};function c(){var s="",u=r.getUser();return u&&(s=t||_e(JSON.stringify(u))),"ld:"+n+":"+s}return o.loadFlags=function(){return e.get(c()).then(function(s){if(s==null)return null;try{var u=JSON.parse(s);if(u){var d=u.$schema;d===void 0||d<1?u=wn(u):delete u.$schema}return u}catch{return o.clearFlags().then(function(){return null})}})},o.saveFlags=function(s){var u=M({},s,{$schema:1});return e.set(c(),JSON.stringify(u))},o.clearFlags=function(){return e.clear(c())},o}function Lt(e,n,t,r){var o,c=n.streamUrl,s=n.logger,u={},d=ge(c,"/eval/"+t),f=n.useReport,y=n.evaluationReasons,v=n.streamReconnectDelay,k=Ke(e,n),h=!1,p=null,P=null,S=null,b=null,O=null;function j(T){h||(s.warn(qn(T,v)),h=!0),x(!1),G(),A(v)}function A(T){P||(T?P=setTimeout(Q,T):Q())}function Q(){var T;P=null;var E="",_={headers:k,readTimeoutMillis:3e5};if(e.eventSourceFactory){for(var ee in b!=null&&(E="h="+b),f?e.eventSourceAllowsReport?(T=d,_.method="REPORT",_.headers["Content-Type"]="application/json",_.body=JSON.stringify(S)):(T=ge(c,"/ping/"+t),E=""):T=d+"/"+pe(JSON.stringify(S)),_.headers=Xe(_.headers,n),y&&(E=E+(E?"&":"")+"withReasons=true"),T=T+(E?"?":"")+E,G(),s.info(_n(T)),o=new Date().getTime(),p=e.eventSourceFactory(T,_),O)Z(O,ee)&&p.addEventListener(ee,O[ee]);p.onerror=j}}function G(){p&&(s.info("Closing stream connection"),p.close(),p=null)}function x(T){o&&r&&r.recordStreamInit(o,!T,new Date().getTime()-o),o=null}return u.connect=function(T,E,_){S=T,b=E,O={};var ee=function(ie){O[ie]=function($){h=!1,x(!0),_[ie]&&_[ie]($)}};for(var le in _||{})ee(le);A()},u.disconnect=function(){clearTimeout(P),P=null,G()},u.isConnected=function(){return!!(p&&e.eventSourceIsActive&&e.eventSourceIsActive(p))},u}function Ut(e,n,t){var r=n.baseUrl,o=n.useReport,c=n.evaluationReasons,s=n.logger,u={},d={};function f(y,v){if(!e.httpRequest)return new Promise(function(b,O){O(new re(xn()))});var k=v?"REPORT":"GET",h=Ke(e,n);v&&(h["Content-Type"]="application/json");var p=d[y];p||(p=function(b){var O,j,A,Q,G={addPromise:function(x,T){O=x,j&&j(),j=T,x.then(function(E){O===x&&(A(E),b&&b())},function(E){O===x&&(Q(E),b&&b())})}};return G.resultPromise=new Promise(function(x,T){A=x,Q=T}),G}(function(){delete d[y]}),d[y]=p);var P=e.httpRequest(k,y,Xe(h,n),v),S=P.promise.then(function(b){if(b.status===200){if(b.header("content-type")&&b.header("content-type").substring(0,16)==="application/json")return JSON.parse(b.body);var O=Ln(b.header("content-type")||"");return Promise.reject(new re(O))}return Promise.reject(function(j){return j.status===404?new Ae(jn()):new re(Ie(j.statusText||String(j.status)))}(b))},function(b){return Promise.reject(new re(Un(b)))});return p.addPromise(S,function(){P.cancel&&P.cancel()}),p.resultPromise}return u.fetchJSON=function(y){return f(ge(r,y),null)},u.fetchFlagSettings=function(y,v){var k,h,p,P="";return o?(h=[r,"/sdk/evalx/",t,"/user"].join(""),p=JSON.stringify(y)):(k=pe(JSON.stringify(y)),h=[r,"/sdk/evalx/",t,"/users/",k].join("")),v&&(P="h="+v),c&&(P=P+(P?"&":"")+"withReasons=true"),h=h+(P?"?":"")+P,s.debug($n(h)),f(h,p)},u}function jt(e){var n={validateUser:function(t){if(!t)return Promise.reject(new Fe(Tn()));var r=me(t);return r.key!==null&&r.key!==void 0?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?e.get("ld:$anonUserId").then(function(o){if(o)return r.key=o,r;var c=$e();return r.key=c,function(s){return e.set("ld:$anonUserId",s)}(c).then(function(){return r})}):Promise.reject(new Fe(Nn()))}};return n}var We=Object.freeze({__proto__:null,baseOptionDefs:Qn,validate:nt,getTags:tt}).baseOptionDefs,Rt=Dn.appendUrlPath,Tt=function(e){var n={diagnosticId:$e()};return e&&(n.sdkKeySuffix=e.length>6?e.substring(e.length-6):e),n};function ot(e,n,t,r,o){var c,s,u,d=t&&t.logger?t.logger:o&&o.logger&&o.logger.default||In("warn"),f=function(i){var l={},a={};return l.on=function(g,w,m){a[g]=a[g]||[],a[g]=a[g].concat({handler:w,context:m})},l.off=function(g,w,m){if(a[g])for(var D=0;D<a[g].length;D++)a[g][D].handler===w&&a[g][D].context===m&&(a[g]=a[g].slice(0,D).concat(a[g].slice(D+1)))},l.emit=function(g){if(a[g])for(var w=a[g].slice(0),m=0;m<w.length;m++)w[m].handler.apply(w[m].context,Array.prototype.slice.call(arguments,1))},l.getEvents=function(){return Object.keys(a)},l.getEventListenerCount=function(g){return a[g]?a[g].length:0},l.maybeReportError=function(g){g&&(a.error?this.emit("error",g):(i||console).error(g.message))},l}(d),y=function(i){var l=!1,a=!1,g=null,w=null,m=new Promise(function(D){i.on("ready",function I(){i.off("ready",I),D()})}).catch(function(){});return{getInitializationPromise:function(){return w||(l?Promise.resolve():a?Promise.reject(g):w=new Promise(function(D,I){i.on("initialized",function F(){i.off("initialized",F),D()}),i.on("failed",function F(C){i.off("failed",F),I(C)})}))},getReadyPromise:function(){return m},signalSuccess:function(){l||a||(l=!0,i.emit("initialized"),i.emit("ready"))},signalFailure:function(D){l||a||(a=!0,g=D,i.emit("failed",D),i.emit("ready")),i.maybeReportError(D)}}}(f),v=nt(t,f,o,d),k=v.sendEvents,h=e,p=v.hash,P=function(i,l){var a={},g=!1,w=function(m){g||(g=!0,l.warn(Be(m)))};return a.isEnabled=function(){return!!i},a.get=function(m){return new Promise(function(D){i?i.get(m).then(D).catch(function(I){w(I),D(void 0)}):D(void 0)})},a.set=function(m,D){return new Promise(function(I){i?i.set(m,D).then(function(){return I(!0)}).catch(function(F){w(F),I(!1)}):I(!1)})},a.clear=function(m){return new Promise(function(D){i?i.clear(m).then(function(){return D(!0)}).catch(function(I){w(I),D(!1)}):D(!1)})},a}(r.localStorage,d),S=rt(r,h,v),b=v.sendEvents&&!v.diagnosticOptOut,O=b?Tt(h):null,j=b?function(i){var l,a,g,w;function m(D){l=D,a=0,g=0,w=[]}return m(i),{getProps:function(){return{dataSinceDate:l,droppedEvents:a,eventsInLastBatch:g,streamInits:w}},setProps:function(D){l=D.dataSinceDate,a=D.droppedEvents||0,g=D.eventsInLastBatch||0,w=D.streamInits||[]},incrementDroppedEvents:function(){a++},setEventsInLastBatch:function(D){g=D},recordStreamInit:function(D,I,F){var C={timestamp:D,failed:I,durationMillis:F};w.push(C)},reset:m}}(new Date().getTime()):null,A=b?function(i,l,a,g,w,m,D){var I,F,C=!!i.diagnosticUseCombinedEvent,V="ld:"+w+":$diagnostics",Re=Rt(m.eventsUrl,"/events/diagnostic/"+w),ve=m.diagnosticRecordingInterval,ne=a,Te=!!m.streaming,ae={};function ke(){return{sdk:Ee(),configuration:(U={customBaseURI:m.baseUrl!==We.baseUrl.default,customStreamURI:m.streamUrl!==We.streamUrl.default,customEventsURI:m.eventsUrl!==We.eventsUrl.default,eventsCapacity:m.eventCapacity,eventsFlushIntervalMillis:m.flushInterval,reconnectTimeMillis:m.streamReconnectDelay,streamingDisabled:!Te,allAttributesPrivate:!!m.allAttributesPrivate,inlineUsersInEvents:!!m.inlineUsersInEvents,diagnosticRecordingIntervalMillis:m.diagnosticRecordingInterval,usingSecureMode:!!m.hash,bootstrapMode:!!m.bootstrap,fetchGoalsDisabled:!m.fetchGoals,allowFrequentDuplicateEvents:!!m.allowFrequentDuplicateEvents,sendEventsOnlyForVariation:!!m.sendEventsOnlyForVariation,autoAliasingOptOut:!!m.autoAliasingOptOut},U),platform:i.diagnosticPlatformData};var U}function ue(U){m.logger&&m.logger.debug(Zn.debugPostingDiagnosticEvent(U)),g.sendEvents(U,Re,!0).then(function(){}).catch(function(){})}function X(){var U,H;ue((U=new Date().getTime(),H=B({kind:C?"diagnostic-combined":"diagnostic",id:D,creationDate:U},ne.getProps()),C&&(H=B(B({},H),ke())),ne.reset(U),H)),F=setTimeout(X,ve),I=new Date().getTime(),C&&function(){if(l.isEnabled()){var W=B({},ne.getProps());l.set(V,JSON.stringify(W))}}()}function Ee(){var U=B({},i.diagnosticSdkData);return m.wrapperName&&(U.wrapperName=m.wrapperName),m.wrapperVersion&&(U.wrapperVersion=m.wrapperVersion),U}return ae.start=function(){C?function(U){if(!l.isEnabled())return U(!1);l.get(V).then(function(H){if(H)try{var W=JSON.parse(H);ne.setProps(W),I=W.dataSinceDate}catch{}U(!0)}).catch(function(){U(!1)})}(function(U){if(U){var H=(I||0)+ve,W=new Date().getTime();W>=H?X():F=setTimeout(X,H-W)}else Math.floor(4*Math.random())===0?X():F=setTimeout(X,ve)}):(ue(B({kind:"diagnostic-init",id:D,creationDate:ne.getProps().dataSinceDate},ke())),F=setTimeout(X,ve))},ae.stop=function(){F&&clearTimeout(F)},ae.setStreaming=function(U){Te=U},ae}(r,P,j,S,h,v,O):null,Q=Lt(r,v,h,j),G=v.eventProcessor||function(i,l,a){var g,w=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,m=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,D=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,I={},F=D||rt(i,a,l),C=ge(l.eventsUrl,"/events/bulk/"+a),V=Pt(),Re=Ot(l),ve=l.inlineUsersInEvents,ne=l.samplingInterval,Te=l.eventCapacity,ae=l.flushInterval,ke=l.logger,ue=[],X=0,Ee=!1,U=!1;function H(){return ne===0||Math.floor(Math.random()*ne)===0}function W(L){return!!L.debugEventsUntilDate&&L.debugEventsUntilDate>X&&L.debugEventsUntilDate>new Date().getTime()}function pt(L){var z=M({},L);return L.kind==="alias"||(ve||L.kind==="identify"?z.user=Re.filterUser(L.user):(z.userKey=L.user.key,delete z.user),L.kind==="feature"&&(delete z.trackEvents,delete z.debugEventsUntilDate)),z}function mt(L){ue.length<Te?(ue.push(L),U=!1):(U||(U=!0,ke.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),w&&w.incrementDroppedEvents())}return I.enqueue=function(L){if(!Ee){var z=!1,Y=!1;if(V.summarizeEvent(L),L.kind==="feature"?H()&&(z=!!L.trackEvents,Y=W(L)):z=H(),z&&mt(pt(L)),Y){var De=M({},L,{kind:"debug"});De.user=Re.filterUser(De.user),delete De.trackEvents,delete De.debugEventsUntilDate,mt(De)}}},I.flush=function(){if(Ee)return Promise.resolve();var L=ue,z=V.getSummary();return V.clearSummary(),z&&(z.kind="summary",L.push(z)),w&&w.setEventsInLastBatch(L.length),L.length===0?Promise.resolve():(ue=[],ke.debug(Wn(L.length)),F.sendEvents(L,C).then(function(Y){Y&&(Y.serverTime&&(X=Y.serverTime),Pe(Y.status)||(Ee=!0),Y.status>=400&&he(function(){m.maybeReportError(new fn(Cn(Y.status,"event posting","some events were dropped")))}))}))},I.start=function(){g=setTimeout(function L(){I.flush(),g=setTimeout(L,ae)},ae)},I.stop=function(){clearTimeout(g)},I}(r,v,h,j,f,S),x=Ut(r,v,h),T={},E={},_=v.streaming,ee=!1,le=!1,ie=!0,$=v.stateProvider,q=function(i,l){var a,g={setUser:function(w){var m=a&&me(a);(a=En(w))&&l&&l(me(a),m)},getUser:function(){return a?me(a):null}};return g}(0,function(i,l){(function(a){$||a&&we({kind:"identify",key:a.key,user:a,creationDate:new Date().getTime()})})(i),!v.autoAliasingOptOut&&l&&l.anonymous&&i&&!i.anonymous&&ft(i,l)}),ct=jt(P),fe=P.isEnabled()?new It(P,h,p,q):null;function we(i){if(h&&!($&&$.enqueueEvent&&$.enqueueEvent(i))){if(i.kind!=="alias"){if(!i.user)return void(ie&&(d.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"),ie=!1));ie=!1}!k||le||r.isDoNotTrack()||(d.debug(Xn(i.kind)),G.enqueue(i))}}function lt(i,l,a,g){var w=q.getUser(),m=new Date,D=l?l.value:null;if(!v.allowFrequentDuplicateEvents){var I=JSON.stringify(D)+(w&&w.key?w.key:"")+i,F=T[I];if(F&&m-F<3e5)return;T[I]=m}var C={kind:"feature",key:i,user:w,value:D,variation:l?l.variationIndex:null,default:a,creationDate:m.getTime()};w&&w.anonymous&&(C.contextKind=je(w));var V=E[i];V&&(C.version=V.flagVersion?V.flagVersion:V.version,C.trackEvents=V.trackEvents,C.debugEventsUntilDate=V.debugEventsUntilDate),(g||V&&V.trackReason)&&l&&(C.reason=l.reason),we(C)}function tn(i,l,a,g){var w;if(E&&Z(E,i)&&E[i]&&!E[i].deleted){var m=E[i];w=Ue(m),m.value!==null&&m.value!==void 0||(w.value=l)}else w={value:l,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return a&&lt(i,w,l,g),w}function Ue(i){return{value:i.value,variationIndex:i.variation===void 0?null:i.variation,reason:i.reason||null}}function je(i){return i.anonymous?"anonymousUser":"user"}function ft(i,l){$||i&&l&&we({kind:"alias",key:i.key,contextKind:je(i),previousKey:l.key,previousContextKind:je(l),creationDate:new Date().getTime()})}function dt(){if(s=!0,q.getUser()){var i=function(l){try{return JSON.parse(l)}catch{return void f.maybeReportError(new gn("Invalid data received from LaunchDarkly; connection may have been interrupted"))}};Q.connect(q.getUser(),p,{ping:function(){d.debug("received ping message from stream");var l=q.getUser();x.fetchFlagSettings(l,p).then(function(a){qe(l,q.getUser())&&de(a||{})}).catch(function(a){f.maybeReportError(new re(Ie(a)))})},put:function(l){var a=i(l.data);a&&(d.debug("received streaming update for all flags"),de(a))},patch:function(l){var a=i(l.data);if(a){var g=E[a.key];if(!g||!g.version||!a.version||g.version<a.version){d.debug(Hn(a.key));var w={},m=M({},a);delete m.key,E[a.key]=m;var D=Ue(m);w[a.key]=g?{previous:g.value,current:D}:{current:D},on(w)}else d.debug(Bn(a.key))}},delete:function(l){var a=i(l.data);if(a)if(!E[a.key]||E[a.key].version<a.version){d.debug(Gn(a.key));var g={};E[a.key]&&!E[a.key].deleted&&(g[a.key]={previous:E[a.key].value}),E[a.key]={version:a.version,deleted:!0},on(g)}else d.debug(Kn(a.key))}})}}function rn(){s&&(Q.disconnect(),s=!1)}function de(i){var l={};if(!i)return Promise.resolve();for(var a in E)Z(E,a)&&E[a]&&(i[a]&&!qe(i[a].value,E[a].value)?l[a]={previous:E[a].value,current:Ue(i[a])}:i[a]&&!i[a].deleted||(l[a]={previous:E[a].value}));for(var g in i)Z(i,g)&&i[g]&&(!E[g]||E[g].deleted)&&(l[g]={current:Ue(i[g])});return E=B({},i),on(l).catch(function(){})}function on(i){var l=Object.keys(i);if(l.length>0){var a={};l.forEach(function(g){var w=i[g].current,m=w?w.value:void 0,D=i[g].previous;f.emit("change:"+g,m,D),a[g]=w?{current:m,previous:D}:{previous:D}}),f.emit("change",a),f.emit("internal-change",E),v.sendEventsOnlyForVariation||$||l.forEach(function(g){lt(g,i[g].current)})}return c&&fe?fe.saveFlags(E):Promise.resolve()}function an(){var i=_||u&&_===void 0;i&&!s?dt():!i&&s&&rn(),A&&A.setStreaming(i)}function un(i){return i==="change"||i.substr(0,6+1)==="change:"}if(typeof v.bootstrap=="string"&&v.bootstrap.toUpperCase()==="LOCALSTORAGE"&&(fe?c=!0:d.warn(Be())),Se(v.bootstrap)==="object"&&(E=function(i){var l=Object.keys(i),a=i.$flagsState;!a&&l.length&&d.warn(An()),i.$valid===!1&&d.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var g={};return l.forEach(function(w){if(w!=="$flagsState"&&w!=="$valid"){var m={value:i[w]};a&&a[w]?m=M(m,a[w]):m.version=0,g[w]=m}}),g}(v.bootstrap)),$){var vt=$.getInitialState();vt?gt(vt):$.on("init",gt),$.on("update",function(i){i.user&&q.setUser(i.user),i.flags&&de(i.flags)})}else(e?ct.validateUser(n).then(function(i){return q.setUser(i),Se(v.bootstrap)==="object"?be():c?fe.loadFlags().then(function(l){return l==null?(E={},x.fetchFlagSettings(q.getUser(),p).then(function(a){return de(a||{})}).then(be).catch(function(a){sn(new re(Ie(a)))})):(E=l,he(be),x.fetchFlagSettings(q.getUser(),p).then(function(a){return de(a)}).catch(function(a){return f.maybeReportError(a)}))}):x.fetchFlagSettings(q.getUser(),p).then(function(l){E=l||{},be()}).catch(function(l){E={},sn(l)})}):Promise.reject(new Ae(Rn()))).catch(sn);function gt(i){h=i.environment,q.setUser(i.user),E=B({},i.flags),he(be)}function be(){d.info("LaunchDarkly client initialized"),ee=!0,an(),y.signalSuccess()}function sn(i){y.signalFailure(i)}return{client:{waitForInitialization:function(){return y.getInitializationPromise()},waitUntilReady:function(){return y.getReadyPromise()},identify:function(i,l,a){return le?oe(Promise.resolve({}),a):$?(d.warn("identify() has no effect here; it must be called on the main client instance"),oe(Promise.resolve(Ve(E)),a)):oe((c&&fe?fe.clearFlags():Promise.resolve()).then(function(){return ct.validateUser(i)}).then(function(g){return x.fetchFlagSettings(g,l).then(function(w){var m=Ve(w);return q.setUser(g),p=l,w?de(w).then(function(){return m}):m})}).then(function(g){return s&&dt(),g}).catch(function(g){return f.maybeReportError(g),Promise.reject(g)}),a)},getUser:function(){return q.getUser()},variation:function(i,l){return tn(i,l,!0,!1).value},variationDetail:function(i,l){return tn(i,l,!0,!0)},track:function(i,l,a){if(typeof i=="string"){r.customEventFilter&&!r.customEventFilter(i)&&d.warn(Ge(i));var g=q.getUser(),w={kind:"custom",key:i,user:g,url:r.getCurrentUrl(),creationDate:new Date().getTime()};g&&g.anonymous&&(w.contextKind=je(g)),l!=null&&(w.data=l),a!=null&&(w.metricValue=a),we(w)}else f.maybeReportError(new dn(Ge(i)))},alias:ft,on:function(i,l,a){un(i)?(u=!0,ee&&an(),f.on(i,l,a)):f.on.apply(f,arguments)},off:function(i){if(f.off.apply(f,arguments),un(i)){var l=!1;f.getEvents().forEach(function(a){un(a)&&f.getEventListenerCount(a)>0&&(l=!0)}),l||(u=!1,s&&_===void 0&&rn())}},setStreaming:function(i){var l=i===null?void 0:i;l!==_&&(_=l,an())},flush:function(i){return oe(k?G.flush():Promise.resolve(),i)},allFlags:function(){var i={};if(!E)return i;for(var l in E)Z(E,l)&&(i[l]=tn(l,null,!v.sendEventsOnlyForVariation).value);return i},close:function(i){if(le)return oe(Promise.resolve(),i);var l=function(){le=!0,E={}};return oe(Promise.resolve().then(function(){if(rn(),A&&A.stop(),k)return G.stop(),G.flush()}).then(l).catch(l),i)}},options:v,emitter:f,ident:q,logger:d,requestor:x,start:function(){k&&(A&&A.start(),G.start())},enqueueEvent:we,getFlagsInternal:function(){return E},getEnvironmentId:function(){return h},internalChangeEventName:"internal-change"}}function it(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,r)}return t}function at(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?it(Object(t),!0).forEach(function(r){Nt(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):it(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function Nt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}Object.freeze({__proto__:null,commonBasicLogger:On,createConsoleLogger:In,errors:pn,initialize:ot,messages:Zn,utils:Dn,version:"3.6.0"}).commonBasicLogger;var ut={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function At(e,n,t,r,o){if(o&&!function(){var f=window.navigator&&window.navigator.userAgent;if(f){var y=f.match(/Chrom(e|ium)\/([0-9]+)\./);if(y)return parseInt(y[2],10)<73}return!0}())return ut;var c=new window.XMLHttpRequest;for(var s in c.open(e,n,!o),t||{})Object.prototype.hasOwnProperty.call(t,s)&&c.setRequestHeader(s,t[s]);if(o)return c.send(r),ut;var u,d=new Promise(function(f,y){c.addEventListener("load",function(){u||f({status:c.status,header:function(v){return c.getResponseHeader(v)},body:c.responseText})}),c.addEventListener("error",function(){u||y(new Error)}),c.send(r)});return{promise:d,cancel:function(){u=!0,c.abort()}}}function Ft(e){var n,t={synchronousFlush:!1};if(window.XMLHttpRequest){var r=e&&e.disableSyncEventPost;t.httpRequest=function(u,d,f,y){var v=t.synchronousFlush&!r;return t.synchronousFlush=!1,At(u,d,f,y,v)}}t.httpAllowsPost=function(){return n===void 0&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},t.httpFallbackPing=function(u){new window.Image().src=u};var o,c=e&&e.eventUrlTransformer;t.getCurrentUrl=function(){return c?c(window.location.href):window.location.href},t.isDoNotTrack=function(){var u;return(u=window.navigator&&window.navigator.doNotTrack!==void 0?window.navigator.doNotTrack:window.navigator&&window.navigator.msDoNotTrack!==void 0?window.navigator.msDoNotTrack:window.doNotTrack)===1||u===!0||u==="1"||u==="yes"};try{window.localStorage&&(t.localStorage={get:function(u){return new Promise(function(d){d(window.localStorage.getItem(u))})},set:function(u,d){return new Promise(function(f){window.localStorage.setItem(u,d),f()})},clear:function(u){return new Promise(function(d){window.localStorage.removeItem(u),d()})}})}catch{t.localStorage=null}if(e&&e.useReport&&typeof window.EventSourcePolyfill=="function"&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(t.eventSourceAllowsReport=!0,o=window.EventSourcePolyfill):(t.eventSourceAllowsReport=!1,o=window.EventSource),window.EventSource){var s=3e5;t.eventSourceFactory=function(u,d){var f=at(at({},{heartbeatTimeout:s,silentTimeout:s,skipDefaultHeaders:!0}),d);return new o(u,f)},t.eventSourceIsActive=function(u){return u.readyState===window.EventSource.OPEN||u.readyState===window.EventSource.CONNECTING}}return t.userAgent="JSClient",t.version="2.22.1",t.diagnosticSdkData={name:"js-client-sdk",version:"2.22.1"},t.diagnosticPlatformData={name:"JS"},t.diagnosticUseCombinedEvent=!0,t}var Ct=/[|\\{}()[\]^$+*?.]/g,Ye=function(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(Ct,"\\$&")};function xt(e,n,t,r){var o,c,s=((e.kind==="substring"||e.kind==="regex")&&r.includes("/")?n:n.replace(r,"")).replace(t,"");switch(e.kind){case"exact":c=n,o=new RegExp("^"+Ye(e.url)+"/?$");break;case"canonical":c=s,o=new RegExp("^"+Ye(e.url)+"/?$");break;case"substring":c=s,o=new RegExp(".*"+Ye(e.substring)+".*$");break;case"regex":c=s,o=new RegExp(e.pattern);break;default:return!1}return o.test(c)}function st(e,n){for(var t={},r=null,o=[],c=0;c<e.length;c++)for(var s=e[c],u=s.urls||[],d=0;d<u.length;d++)if(xt(u[d],window.location.href,window.location.search,window.location.hash)){s.kind==="pageview"?n("pageview",s):(o.push(s),n("click_pageview",s));break}return o.length>0&&(r=function(f){for(var y=function(k,h){for(var p=[],P=0;P<h.length;P++)for(var S=k.target,b=h[P],O=b.selector,j=document.querySelectorAll(O);S&&j.length>0;){for(var A=0;A<j.length;A++)S===j[A]&&p.push(b);S=S.parentNode}return p}(f,o),v=0;v<y.length;v++)n("click",y[v])},document.addEventListener("click",r)),t.dispose=function(){document.removeEventListener("click",r)},t}function _t(e,n){var t,r;function o(){r&&r.dispose(),t&&t.length&&(r=st(t,c))}function c(s,u){var d=e.ident.getUser(),f={kind:s,key:u.key,data:null,url:window.location.href,user:d,creationDate:new Date().getTime()};return d&&d.anonymous&&(f.contextKind="anonymousUser"),s==="click"&&(f.selector=u.selector),e.enqueueEvent(f)}return e.requestor.fetchJSON("/sdk/goals/"+e.getEnvironmentId()).then(function(s){s&&s.length>0&&(r=st(t=s,c),function(u,d){var f,y=window.location.href;function v(){(f=window.location.href)!==y&&(y=f,d())}(function k(h,p){h(),setTimeout(function(){k(h,p)},p)})(v,u),window.history&&window.history.pushState?window.addEventListener("popstate",v):window.addEventListener("hashchange",v)}(300,o)),n()}).catch(function(s){e.emitter.maybeReportError(new pn.LDUnexpectedResponseError((s&&s.message,s.message))),n()}),{}}var qt={fetchGoals:{default:!0},hash:{type:"string"},eventProcessor:{type:"object"},eventUrlTransformer:{type:"function"},disableSyncEventPost:{default:!1}};function Vt(e,n){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=Ft(t),o=ot(e,n,t,r,qt),c=o.client,s=o.options,u=o.emitter,d=new Promise(function(y){var v=u.on("goalsReady",function(){u.off("goalsReady",v),y()})});c.waitUntilGoalsReady=function(){return d},s.fetchGoals?_t(o,function(){return u.emit("goalsReady")}):u.emit("goalsReady"),document.readyState!=="complete"?window.addEventListener("load",o.start):o.start();var f=function(){r.synchronousFlush=!0,c.flush().catch(function(){}),r.synchronousFlush=!1};return window.addEventListener("beforeunload",f),window.addEventListener("unload",f),c}const zt=(e,n,t=!0)=>function(o,c){const s=e?n.variation(o,c):c,u=N.ref(s);if(!t)return N.readonly(u);const d=f=>u.value=f;return n.on(`change:${o}`,d),N.onBeforeUnmount(()=>n.off(`change:${o}`,d)),e||n.on("ready",()=>d(n.variation(o,u.value))),N.readonly(u)},Jt="1.0.0",Le=(e,n)=>{const t=N.inject(e);if(t===void 0)throw new Error(`Injection of ${n} failed. LaunchDarkly plugin may not have been loaded.`);return t};function Mt(){return Le(Qe,"LD_READY")}function $t(){return Le(en,"LD_CLIENT")}function Ht(e){return Le(Ze,"LD_INIT")(e)}function Bt(e,n){return Le(nn,"LD_FLAG")(e,n)}const Ze=Symbol(),Qe=Symbol(),en=Symbol(),nn=Symbol(),Gt={install(e,n={}){const t=N.ref(!1),r=N.readonly(t),o=(c={})=>{var k,h,p,P;const s=(k=c.clientSideID)!=null?k:n.clientSideID;if(!s)throw new Error("Cannot initialize LaunchDarkly without a clientSideID");const u=(p=(h=c.user)!=null?h:n.user)!=null?p:{anonymous:!0},d=(P=c.options)!=null?P:n.options,y=Vt(s,u,cn(cn({},{wrapperName:"vue-client-sdk",wrapperVersion:Jt}),d));e.provide(en,y);const v=!(n.streaming===!1||c.streaming===!1);return e.provide(nn,zt(t.value,y,v)),y.on("ready",()=>t.value=!0),[r,y]};if(e.provide(Qe,r),n.deferInitialization)e.provide(Ze,o);else if(n.clientSideID)o(n);else throw new Error("LaunchDarkly plugin requires a clientSideID unless deferInitialization option is used")}};R.LDPlugin=Gt,R.LD_CLIENT=en,R.LD_FLAG=nn,R.LD_INIT=Ze,R.LD_READY=Qe,R.ldInit=Ht,R.useLDClient=$t,R.useLDFlag=Bt,R.useLDReady=Mt,Object.defineProperties(R,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
(function(j,N){typeof exports=="object"&&typeof module!="undefined"?N(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],N):(j=typeof globalThis!="undefined"?globalThis:j||self,N(j["launchdarkly-vue-client-sdk"]={},j.Vue))})(this,function(j,N){"use strict";var Kt=Object.defineProperty;var yt=Object.getOwnPropertySymbols;var Xt=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable;var ht=(j,N,J)=>N in j?Kt(j,N,{enumerable:!0,configurable:!0,writable:!0,value:J}):j[N]=J,cn=(j,N)=>{for(var J in N||(N={}))Xt.call(N,J)&&ht(j,J,N[J]);if(yt)for(var J of yt(N))Wt.call(N,J)&&ht(j,J,N[J]);return j};function J(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,r)}return t}function B(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?J(Object(t),!0).forEach(function(r){wt(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):J(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function Se(e){return(Se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(e)}function wt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ln(e){return function(n){if(Array.isArray(n))return Ne(n)}(e)||function(n){if(typeof Symbol!="undefined"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}(e)||function(n,t){if(n){if(typeof n=="string")return Ne(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);return r==="Object"&&n.constructor&&(r=n.constructor.name),r==="Map"||r==="Set"?Array.from(n):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ne(n,t):void 0}}(e)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Ne(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function te(e){function n(t,r){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=t,this.code=r}return n.prototype=new Error,n.prototype.name=e,n.prototype.constructor=n,n}var fn=te("LaunchDarklyUnexpectedResponseError"),Ae=te("LaunchDarklyInvalidEnvironmentIdError"),Fe=te("LaunchDarklyInvalidUserError"),dn=te("LaunchDarklyInvalidEventKeyError"),vn=te("LaunchDarklyInvalidArgumentError"),re=te("LaunchDarklyFlagFetchError"),gn=te("LaunchDarklyInvalidDataError");function Pe(e){return!(e>=400&&e<500)||e===400||e===408||e===429}for(var pn=Object.freeze({__proto__:null,LDUnexpectedResponseError:fn,LDInvalidEnvironmentIdError:Ae,LDInvalidUserError:Fe,LDInvalidEventKeyError:dn,LDInvalidArgumentError:vn,LDFlagFetchError:re,LDInvalidDataError:gn,isHttpErrorRecoverable:Pe}),K=[],Ce=[],xe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",se=0,bt=xe.length;se<bt;++se)K[se]=xe[se],Ce[xe.charCodeAt(se)]=se;function kt(e,n,t){for(var r,o,c=[],u=n;u<t;u+=3)r=(e[u]<<16&16711680)+(e[u+1]<<8&65280)+(255&e[u+2]),c.push(K[(o=r)>>18&63]+K[o>>12&63]+K[o>>6&63]+K[63&o]);return c.join("")}Ce["-".charCodeAt(0)]=62,Ce["_".charCodeAt(0)]=63;var mn=Array.isArray,yn=Object.keys,Et=Object.prototype.hasOwnProperty,hn=["key","secondary","ip","country","email","firstName","lastName","avatar","name"];function ge(e,n){return(e.endsWith("/")?e.substring(0,e.length-1):e)+(n.startsWith("/")?"":"/")+n}function _e(e){return function(n){for(var t,r=n.length,o=r%3,c=[],u=0,s=r-o;u<s;u+=16383)c.push(kt(n,u,u+16383>s?s:u+16383));return o===1?(t=n[r-1],c.push(K[t>>2]+K[t<<4&63]+"==")):o===2&&(t=(n[r-2]<<8)+n[r-1],c.push(K[t>>10]+K[t>>4&63]+K[t<<2&63]+"=")),c.join("")}(function(n){for(var t=[],r=0;r<n.length;r++)t.push(n.charCodeAt(r));return t}(unescape(encodeURIComponent(e))))}function pe(e){return _e(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function me(e){return JSON.parse(JSON.stringify(e))}function qe(e,n){return function t(r,o){if(r===o)return!0;if(r&&o&&typeof r=="object"&&typeof o=="object"){var c,u,s,d=mn(r),f=mn(o);if(d&&f){if((u=r.length)!=o.length)return!1;for(c=u;c--!=0;)if(!t(r[c],o[c]))return!1;return!0}if(d!=f)return!1;var h=r instanceof Date,v=o instanceof Date;if(h!=v)return!1;if(h&&v)return r.getTime()==o.getTime();var k=r instanceof RegExp,y=o instanceof RegExp;if(k!=y)return!1;if(k&&y)return r.toString()==o.toString();var p=yn(r);if((u=p.length)!==yn(o).length)return!1;for(c=u;c--!=0;)if(!Et.call(o,p[c]))return!1;for(c=u;c--!=0;)if(!t(r[s=p[c]],o[s]))return!1;return!0}return r!=r&&o!=o}(e,n)}function ye(e){setTimeout(e,0)}function oe(e,n){var t=e.then(function(r){return n&&setTimeout(function(){n(null,r)},0),r},function(r){if(!n)return Promise.reject(r);setTimeout(function(){n(r,null)},0)});return n?void 0:t}function wn(e){var n={};for(var t in e)Z(e,t)&&(n[t]={value:e[t],version:0});return n}function Ve(e){var n={};for(var t in e)Z(e,t)&&(n[t]=e[t].value);return n}function bn(e,n){for(var t,r=n.slice(0),o=[],c=e;r.length>0;){for(t=[];c>0;){var u=r.shift();if(!u)break;(c-=pe(JSON.stringify(u)).length)<0&&t.length>0?r.unshift(u):t.push(u)}c=e,o.push(t)}return o}function kn(e){var n=e.version||"3.6.0";return e.userAgent+"/"+n}function M(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.reduce(function(r,o){return B(B({},r),o)},{})}function Z(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function En(e){if(!e)return e;var n;for(var t in hn){var r=hn[t],o=e[r];o!==void 0&&typeof o!="string"&&((n=n||B({},e))[r]=String(o))}return n||e}for(var Dn=Object.freeze({__proto__:null,appendUrlPath:ge,btoa:_e,base64URLEncode:pe,clone:me,deepEquals:qe,onNextTick:ye,wrapPromiseCallback:oe,transformValuesToVersionedValues:wn,transformVersionedValuesToValues:Ve,chunkUserEventsForUrl:bn,getLDUserAgentString:kn,extend:M,objectHasOwnProperty:Z,sanitizeUser:En}),Dt=function(e,n){return function(t){var r=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(r){var o=new Uint8Array(16);t.exports=function(){return r(o),o}}else{var c=new Array(16);t.exports=function(){for(var u,s=0;s<16;s++)(3&s)==0&&(u=4294967296*Math.random()),c[s]=u>>>((3&s)<<3)&255;return c}}}(n={exports:{}}),n.exports}(),Sn=[],Oe=0;Oe<256;++Oe)Sn[Oe]=(Oe+256).toString(16).substr(1);var Pn,ze,Je=0,Me=0,$e=function(e,n,t){var r=n&&t||0,o=n||[],c=(e=e||{}).node||Pn,u=e.clockseq!==void 0?e.clockseq:ze;if(c==null||u==null){var s=Dt();c==null&&(c=Pn=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),u==null&&(u=ze=16383&(s[6]<<8|s[7]))}var d=e.msecs!==void 0?e.msecs:new Date().getTime(),f=e.nsecs!==void 0?e.nsecs:Me+1,h=d-Je+(f-Me)/1e4;if(h<0&&e.clockseq===void 0&&(u=u+1&16383),(h<0||d>Je)&&e.nsecs===void 0&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Je=d,Me=f,ze=u;var v=(1e4*(268435455&(d+=122192928e5))+f)%4294967296;o[r++]=v>>>24&255,o[r++]=v>>>16&255,o[r++]=v>>>8&255,o[r++]=255&v;var k=d/4294967296*1e4&268435455;o[r++]=k>>>8&255,o[r++]=255&k,o[r++]=k>>>24&15|16,o[r++]=k>>>16&255,o[r++]=u>>>8|128,o[r++]=255&u;for(var y=0;y<6;++y)o[r+y]=c[y];return n||function(p,P){var S=P||0,b=Sn;return[b[p[S++]],b[p[S++]],b[p[S++]],b[p[S++]],"-",b[p[S++]],b[p[S++]],"-",b[p[S++]],b[p[S++]],"-",b[p[S++]],b[p[S++]],"-",b[p[S++]],b[p[S++]],b[p[S++]],b[p[S++]],b[p[S++]],b[p[S++]]].join("")}(o)},he=["debug","info","warn","error","none"];function On(e,n){if(e&&e.destination&&typeof e.destination!="function")throw new Error("destination for basicLogger was set to a non-function");function t(k){return function(y){console&&console[k]&&console[k].call(console,y)}}var r=e&&e.destination?[e.destination,e.destination,e.destination,e.destination]:[t("log"),t("info"),t("warn"),t("error")],o=!(!e||!e.destination),c=e&&e.prefix!==void 0&&e.prefix!==null?e.prefix:"[LaunchDarkly] ",u=1;if(e&&e.level)for(var s=0;s<he.length;s++)he[s]===e.level&&(u=s);function d(k,y,p){if(!(p.length<1)){var P,S=o?y+": "+c:c;if(p.length!==1&&n){var b=ln(p);b[0]=S+b[0],P=n.apply(void 0,ln(b))}else P=S+p[0];try{r[k](P)}catch(O){console&&console.log&&console.log("[LaunchDarkly] Configured logger's "+y+" method threw an exception: "+O)}}}for(var f={},h=function(k){var y=he[k];if(y!=="none")if(k<u)f[y]=function(){};else{var p=k;f[y]=function(){d(p,y,arguments)}}},v=0;v<he.length;v++)h(v);return f}function In(e,n){return On({level:e,prefix:n})}function He(e){return e&&e.message?e.message:typeof e=="string"||e instanceof String?e:JSON.stringify(e)}var ce=" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initializing-the-client for instructions on SDK initialization.",Ln=function(e){return'Expected application/json content type but got "'+e+'"'},Be=function(e){return"local storage is unavailable: "+He(e)},Un=function(e){return"network error"+(e?" ("+e+")":"")},Ge=function(e){return'Custom event "'+e+'" does not exist'},Rn=function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+ce},jn=function(){return"No environment/client-side ID was specified."+ce},Ie=function(e){return"Error fetching flag settings: "+He(e)},Tn=function(){return"No user specified."+ce},Nn=function(){return"Invalid user specified."+ce},An=function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+ce},Fn=function(e,n){return n?'"'+e+'" is deprecated, please use "'+n+'"':'"'+e+'" is deprecated'},Cn=function(e,n,t){return"Received error "+e+(e===401?" (invalid SDK key)":"")+" for "+n+" - "+(Pe(e)?t:"giving up permanently")},xn=function(){return"Cannot make HTTP requests in this environment."+ce},_n=function(e){return"Opening stream connection to "+e},qn=function(e,n){return"Error on stream connection: "+He(e)+", will continue retrying every "+n+" milliseconds."},Vn=function(e){return'Ignoring unknown config option "'+e+'"'},zn=function(e,n,t){return'Config option "'+e+'" should be of type '+n+", got "+t+", using default value"},Jn=function(e,n){return'Config option "'+e+'" should be a boolean, got '+n+", converting to boolean"},Mn=function(e,n,t){return'Config option "'+e+'" was set to '+n+", changing to minimum value of "+t},$n=function(e){return"polling for feature flags at "+e},Hn=function(e){return'received streaming update for flag "'+e+'"'},Bn=function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},Gn=function(e){return'received streaming deletion for flag "'+e+'"'},Kn=function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},Xn=function(e){return'enqueueing "'+e+'" event'},Wn=function(e){return"sending "+e+" events"},Yn=function(e){return'Config option "'.concat(e,'" must only contain letters, numbers, ., _ or -.')},Zn=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:Ln,invalidKey:function(){return"Event key must be a string"},localStorageUnavailable:Be,networkError:Un,unknownCustomEventKey:Ge,environmentNotFound:Rn,environmentNotSpecified:jn,errorFetchingFlags:Ie,userNotSpecified:Tn,invalidUser:Nn,invalidData:function(){return"Invalid data received from LaunchDarkly; connection may have been interrupted"},bootstrapOldFormat:An,bootstrapInvalid:function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},deprecated:Fn,httpErrorMessage:Cn,httpUnavailable:xn,identifyDisabled:function(){return"identify() has no effect here; it must be called on the main client instance"},streamClosing:function(){return"Closing stream connection"},streamConnecting:_n,streamError:qn,unknownOption:Vn,wrongOptionType:zn,wrongOptionTypeBoolean:Jn,optionBelowMinimum:Mn,debugPolling:$n,debugStreamPing:function(){return"received ping message from stream"},debugStreamPut:function(){return"received streaming update for all flags"},debugStreamPatch:Hn,debugStreamPatchIgnored:Bn,debugStreamDelete:Gn,debugStreamDeleteIgnored:Kn,debugEnqueueingEvent:Xn,debugPostingEvents:Wn,debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"},invalidTagValue:Yn}),Qn={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},requestHeaderTransform:{type:"function"},inlineUsersInEvents:{default:!1},allowFrequentDuplicateEvents:{default:!1},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributeNames:{default:[]},bootstrap:{type:"string|object"},diagnosticRecordingInterval:{default:9e5,minimum:2e3},diagnosticOptOut:{default:!1},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"},autoAliasingOptOut:{default:!1},application:{validator:function(e,n,t,r){var o={};return t.id&&(o.id=et("".concat(e,".id"),n,t.id,r)),t.version&&(o.version=et("".concat(e,".version"),n,t.version,r)),o}}},St=/^(\w|\.|-)+$/;function et(e,n,t,r){if(typeof t=="string"&&t.match(St))return t;r.warn(Yn(e))}function nt(e,n,t,r){var o=M({logger:{default:r}},Qn,t),c={all_attributes_private:"allAttributesPrivate",private_attribute_names:"privateAttributeNames",samplingInterval:null};function u(d){ye(function(){n&&n.maybeReportError(new vn(d))})}var s=M({},e||{});return function(d){var f=d;Object.keys(c).forEach(function(h){if(f[h]!==void 0){var v=c[h];r&&r.warn(Fn(h,v)),v&&(f[v]===void 0&&(f[v]=f[h]),delete f[h])}})}(s),function(d){he.forEach(function(f){if(f!=="none"&&(!d[f]||typeof d[f]!="function"))throw new Error("Provided logger instance must support logger."+f+"(...) method")})}((s=function(d){var f=M({},d),h=function(v){if(v===null)return"any";if(v!==void 0){if(Array.isArray(v))return"array";var k=Se(v);return k==="boolean"||k==="string"||k==="number"||k==="function"?k:"object"}};return Object.keys(d).forEach(function(v){var k=d[v];if(k!=null){var y=o[v];if(y===void 0)u(Vn(v));else{var p=y.type||h(y.default),P=y.validator;if(P){var S=P(v,d,d[v],r);S!==void 0?f[v]=S:delete f[v]}else if(p!=="any"){var b=p.split("|"),O=h(k);b.indexOf(O)<0?p==="boolean"?(f[v]=!!k,u(Jn(v,O))):(u(zn(v,p,O)),f[v]=y.default):O==="number"&&y.minimum!==void 0&&k<y.minimum&&(u(Mn(v,k,y.minimum)),f[v]=y.minimum)}}}}),f}(s=function(d){var f=M({},d);return Object.keys(o).forEach(function(h){f[h]!==void 0&&f[h]!==null||(f[h]=o[h]&&o[h].default)}),f}(s))).logger),s}function tt(e){var n={};return e&&(e.application&&e.application.id!==void 0&&e.application.id!==null&&(n["application-id"]=[e.application.id]),e.application&&e.application.version!==void 0&&e.application.id!==null&&(n["application-version"]=[e.application.version])),n}function Ke(e,n){if(n&&!n.sendLDHeaders)return{};var t={"X-LaunchDarkly-User-Agent":kn(e)};n&&n.wrapperName&&(t["X-LaunchDarkly-Wrapper"]=n.wrapperVersion?n.wrapperName+"/"+n.wrapperVersion:n.wrapperName);var r=tt(n),o=Object.keys(r);return o.length&&(t["x-launchdarkly-tags"]=o.sort().flatMap(function(c){return Array.isArray(r[c])?r[c].sort().map(function(u){return"".concat(c,"/").concat(u)}):["".concat(c,"/").concat(r[c])]}).join(" ")),t}function Xe(e,n){return n&&n.requestHeaderTransform?n.requestHeaderTransform(B({},e)):e}function rt(e,n,t){var r="/a/"+n+".gif",o=M({"Content-Type":"application/json"},Ke(e,t)),c=e.httpFallbackPing,u={sendChunk:function(s,d,f,h){var v=JSON.stringify(s),k=f?null:$e();return h?function y(p){var P=f?o:M({},o,{"X-LaunchDarkly-Event-Schema":"3","X-LaunchDarkly-Payload-ID":k});return e.httpRequest("POST",d,Xe(P,t),v).promise.then(function(S){if(S)return S.status>=400&&Pe(S.status)&&p?y(!1):function(b){var O={status:b.status},R=b.header("date");if(R){var A=Date.parse(R);A&&(O.serverTime=A)}return O}(S)}).catch(function(){return p?y(!1):Promise.reject()})}(!0).catch(function(){}):(c&&c(d+r+"?d="+pe(v)),Promise.resolve())},sendEvents:function(s,d,f){if(!e.httpRequest)return Promise.resolve();var h,v=e.httpAllowsPost();h=v?[s]:bn(2e3-d.length,s);for(var k=[],y=0;y<h.length;y++)k.push(u.sendChunk(h[y],d,f,v));return Promise.all(k)}};return u}function Pt(){var e={},n=0,t=0,r={};return e.summarizeEvent=function(o){if(o.kind==="feature"){var c=o.key+":"+(o.variation!==null&&o.variation!==void 0?o.variation:"")+":"+(o.version!==null&&o.version!==void 0?o.version:""),u=r[c];u?u.count=u.count+1:r[c]={count:1,key:o.key,variation:o.variation,version:o.version,value:o.value,default:o.default},(n===0||o.creationDate<n)&&(n=o.creationDate),o.creationDate>t&&(t=o.creationDate)}},e.getSummary=function(){var o={},c=!0;for(var u in r){var s=r[u],d=o[s.key];d||(d={default:s.default,counters:[]},o[s.key]=d);var f={value:s.value,count:s.count};s.variation!==void 0&&s.variation!==null&&(f.variation=s.variation),s.version?f.version=s.version:f.unknown=!0,d.counters.push(f),c=!1}return c?null:{startDate:n,endDate:t,features:o}},e.clearSummary=function(){n=0,t=0,r={}},e}function Ot(e){var n={},t=e.allAttributesPrivate,r=e.privateAttributeNames||[],o={key:!0,custom:!0,anonymous:!0},c={key:!0,secondary:!0,ip:!0,country:!0,email:!0,firstName:!0,lastName:!0,avatar:!0,name:!0,anonymous:!0,custom:!0};return n.filterUser=function(u){if(!u)return null;var s=u.privateAttributeNames||[],d=function(p,P){return Object.keys(p).reduce(function(S,b){var O=S;return P(b)&&(function(R){return!o[R]&&(t||s.indexOf(R)!==-1||r.indexOf(R)!==-1)}(b)?O[1][b]=!0:O[0][b]=p[b]),O},[{},{}])},f=d(u,function(p){return c[p]}),h=f[0],v=f[1];if(u.custom){var k=d(u.custom,function(){return!0});h.custom=k[0],v=M({},v,k[1])}var y=Object.keys(v);return y.length&&(y.sort(),h.privateAttrs=y),h},n}function It(e,n,t,r){var o={};function c(){var u="",s=r.getUser();return s&&(u=t||_e(JSON.stringify(s))),"ld:"+n+":"+u}return o.loadFlags=function(){return e.get(c()).then(function(u){if(u==null)return null;try{var s=JSON.parse(u);if(s){var d=s.$schema;d===void 0||d<1?s=wn(s):delete s.$schema}return s}catch{return o.clearFlags().then(function(){return null})}})},o.saveFlags=function(u){var s=M({},u,{$schema:1});return e.set(c(),JSON.stringify(s))},o.clearFlags=function(){return e.clear(c())},o}function Lt(e,n,t,r){var o,c=n.streamUrl,u=n.logger,s={},d=ge(c,"/eval/"+t),f=n.useReport,h=n.evaluationReasons,v=n.streamReconnectDelay,k=Ke(e,n),y=!1,p=null,P=null,S=null,b=null,O=null;function R(T){y||(u.warn(qn(T,v)),y=!0),x(!1),G(),A(v)}function A(T){P||(T?P=setTimeout(Q,T):Q())}function Q(){var T;P=null;var E="",_={headers:k,readTimeoutMillis:3e5};if(e.eventSourceFactory){for(var ee in b!=null&&(E="h="+b),f?e.eventSourceAllowsReport?(T=d,_.method="REPORT",_.headers["Content-Type"]="application/json",_.body=JSON.stringify(S)):(T=ge(c,"/ping/"+t),E=""):T=d+"/"+pe(JSON.stringify(S)),_.headers=Xe(_.headers,n),h&&(E=E+(E?"&":"")+"withReasons=true"),T=T+(E?"?":"")+E,G(),u.info(_n(T)),o=new Date().getTime(),p=e.eventSourceFactory(T,_),O)Z(O,ee)&&p.addEventListener(ee,O[ee]);p.onerror=R}}function G(){p&&(u.info("Closing stream connection"),p.close(),p=null)}function x(T){o&&r&&r.recordStreamInit(o,!T,new Date().getTime()-o),o=null}return s.connect=function(T,E,_){S=T,b=E,O={};var ee=function(ie){O[ie]=function($){y=!1,x(!0),_[ie]&&_[ie]($)}};for(var le in _||{})ee(le);A()},s.disconnect=function(){clearTimeout(P),P=null,G()},s.isConnected=function(){return!!(p&&e.eventSourceIsActive&&e.eventSourceIsActive(p))},s}function Ut(e,n,t){var r=n.baseUrl,o=n.useReport,c=n.evaluationReasons,u=n.logger,s={},d={};function f(h,v){if(!e.httpRequest)return new Promise(function(b,O){O(new re(xn()))});var k=v?"REPORT":"GET",y=Ke(e,n);v&&(y["Content-Type"]="application/json");var p=d[h];p||(p=function(b){var O,R,A,Q,G={addPromise:function(x,T){O=x,R&&R(),R=T,x.then(function(E){O===x&&(A(E),b&&b())},function(E){O===x&&(Q(E),b&&b())})}};return G.resultPromise=new Promise(function(x,T){A=x,Q=T}),G}(function(){delete d[h]}),d[h]=p);var P=e.httpRequest(k,h,Xe(y,n),v),S=P.promise.then(function(b){if(b.status===200){if(b.header("content-type")&&b.header("content-type").substring(0,16)==="application/json")return JSON.parse(b.body);var O=Ln(b.header("content-type")||"");return Promise.reject(new re(O))}return Promise.reject(function(R){return R.status===404?new Ae(Rn()):new re(Ie(R.statusText||String(R.status)))}(b))},function(b){return Promise.reject(new re(Un(b)))});return p.addPromise(S,function(){P.cancel&&P.cancel()}),p.resultPromise}return s.fetchJSON=function(h){return f(ge(r,h),null)},s.fetchFlagSettings=function(h,v){var k,y,p,P="";return o?(y=[r,"/sdk/evalx/",t,"/user"].join(""),p=JSON.stringify(h)):(k=pe(JSON.stringify(h)),y=[r,"/sdk/evalx/",t,"/users/",k].join("")),v&&(P="h="+v),c&&(P=P+(P?"&":"")+"withReasons=true"),y=y+(P?"?":"")+P,u.debug($n(y)),f(y,p)},s}function Rt(e){var n={validateUser:function(t){if(!t)return Promise.reject(new Fe(Tn()));var r=me(t);return r.key!==null&&r.key!==void 0?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?e.get("ld:$anonUserId").then(function(o){if(o)return r.key=o,r;var c=$e();return r.key=c,function(u){return e.set("ld:$anonUserId",u)}(c).then(function(){return r})}):Promise.reject(new Fe(Nn()))}};return n}var We=Object.freeze({__proto__:null,baseOptionDefs:Qn,validate:nt,getTags:tt}).baseOptionDefs,jt=Dn.appendUrlPath,Tt=function(e){var n={diagnosticId:$e()};return e&&(n.sdkKeySuffix=e.length>6?e.substring(e.length-6):e),n};function ot(e,n,t,r,o){var c,u,s,d=t&&t.logger?t.logger:o&&o.logger&&o.logger.default||In("warn"),f=function(i){var l={},a={};return l.on=function(g,w,m){a[g]=a[g]||[],a[g]=a[g].concat({handler:w,context:m})},l.off=function(g,w,m){if(a[g])for(var D=0;D<a[g].length;D++)a[g][D].handler===w&&a[g][D].context===m&&(a[g]=a[g].slice(0,D).concat(a[g].slice(D+1)))},l.emit=function(g){if(a[g])for(var w=a[g].slice(0),m=0;m<w.length;m++)w[m].handler.apply(w[m].context,Array.prototype.slice.call(arguments,1))},l.getEvents=function(){return Object.keys(a)},l.getEventListenerCount=function(g){return a[g]?a[g].length:0},l.maybeReportError=function(g){g&&(a.error?this.emit("error",g):(i||console).error(g.message))},l}(d),h=function(i){var l=!1,a=!1,g=null,w=null,m=new Promise(function(D){i.on("ready",function I(){i.off("ready",I),D()})}).catch(function(){});return{getInitializationPromise:function(){return w||(l?Promise.resolve():a?Promise.reject(g):w=new Promise(function(D,I){i.on("initialized",function F(){i.off("initialized",F),D()}),i.on("failed",function F(C){i.off("failed",F),I(C)})}))},getReadyPromise:function(){return m},signalSuccess:function(){l||a||(l=!0,i.emit("initialized"),i.emit("ready"))},signalFailure:function(D){l||a||(a=!0,g=D,i.emit("failed",D),i.emit("ready")),i.maybeReportError(D)}}}(f),v=nt(t,f,o,d),k=v.sendEvents,y=e,p=v.hash,P=function(i,l){var a={},g=!1,w=function(m){g||(g=!0,l.warn(Be(m)))};return a.isEnabled=function(){return!!i},a.get=function(m){return new Promise(function(D){i?i.get(m).then(D).catch(function(I){w(I),D(void 0)}):D(void 0)})},a.set=function(m,D){return new Promise(function(I){i?i.set(m,D).then(function(){return I(!0)}).catch(function(F){w(F),I(!1)}):I(!1)})},a.clear=function(m){return new Promise(function(D){i?i.clear(m).then(function(){return D(!0)}).catch(function(I){w(I),D(!1)}):D(!1)})},a}(r.localStorage,d),S=rt(r,y,v),b=v.sendEvents&&!v.diagnosticOptOut,O=b?Tt(y):null,R=b?function(i){var l,a,g,w;function m(D){l=D,a=0,g=0,w=[]}return m(i),{getProps:function(){return{dataSinceDate:l,droppedEvents:a,eventsInLastBatch:g,streamInits:w}},setProps:function(D){l=D.dataSinceDate,a=D.droppedEvents||0,g=D.eventsInLastBatch||0,w=D.streamInits||[]},incrementDroppedEvents:function(){a++},setEventsInLastBatch:function(D){g=D},recordStreamInit:function(D,I,F){var C={timestamp:D,failed:I,durationMillis:F};w.push(C)},reset:m}}(new Date().getTime()):null,A=b?function(i,l,a,g,w,m,D){var I,F,C=!!i.diagnosticUseCombinedEvent,V="ld:"+w+":$diagnostics",je=jt(m.eventsUrl,"/events/diagnostic/"+w),ve=m.diagnosticRecordingInterval,ne=a,Te=!!m.streaming,ae={};function ke(){return{sdk:Ee(),configuration:(U={customBaseURI:m.baseUrl!==We.baseUrl.default,customStreamURI:m.streamUrl!==We.streamUrl.default,customEventsURI:m.eventsUrl!==We.eventsUrl.default,eventsCapacity:m.eventCapacity,eventsFlushIntervalMillis:m.flushInterval,reconnectTimeMillis:m.streamReconnectDelay,streamingDisabled:!Te,allAttributesPrivate:!!m.allAttributesPrivate,inlineUsersInEvents:!!m.inlineUsersInEvents,diagnosticRecordingIntervalMillis:m.diagnosticRecordingInterval,usingSecureMode:!!m.hash,bootstrapMode:!!m.bootstrap,fetchGoalsDisabled:!m.fetchGoals,allowFrequentDuplicateEvents:!!m.allowFrequentDuplicateEvents,sendEventsOnlyForVariation:!!m.sendEventsOnlyForVariation,autoAliasingOptOut:!!m.autoAliasingOptOut},U),platform:i.diagnosticPlatformData};var U}function ue(U){m.logger&&m.logger.debug(Zn.debugPostingDiagnosticEvent(U)),g.sendEvents(U,je,!0).then(function(){}).catch(function(){})}function X(){var U,H;ue((U=new Date().getTime(),H=B({kind:C?"diagnostic-combined":"diagnostic",id:D,creationDate:U},ne.getProps()),C&&(H=B(B({},H),ke())),ne.reset(U),H)),F=setTimeout(X,ve),I=new Date().getTime(),C&&function(){if(l.isEnabled()){var W=B({},ne.getProps());l.set(V,JSON.stringify(W))}}()}function Ee(){var U=B({},i.diagnosticSdkData);return m.wrapperName&&(U.wrapperName=m.wrapperName),m.wrapperVersion&&(U.wrapperVersion=m.wrapperVersion),U}return ae.start=function(){C?function(U){if(!l.isEnabled())return U(!1);l.get(V).then(function(H){if(H)try{var W=JSON.parse(H);ne.setProps(W),I=W.dataSinceDate}catch{}U(!0)}).catch(function(){U(!1)})}(function(U){if(U){var H=(I||0)+ve,W=new Date().getTime();W>=H?X():F=setTimeout(X,H-W)}else Math.floor(4*Math.random())===0?X():F=setTimeout(X,ve)}):(ue(B({kind:"diagnostic-init",id:D,creationDate:ne.getProps().dataSinceDate},ke())),F=setTimeout(X,ve))},ae.stop=function(){F&&clearTimeout(F)},ae.setStreaming=function(U){Te=U},ae}(r,P,R,S,y,v,O):null,Q=Lt(r,v,y,R),G=v.eventProcessor||function(i,l,a){var g,w=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,m=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,D=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,I={},F=D||rt(i,a,l),C=ge(l.eventsUrl,"/events/bulk/"+a),V=Pt(),je=Ot(l),ve=l.inlineUsersInEvents,ne=l.samplingInterval,Te=l.eventCapacity,ae=l.flushInterval,ke=l.logger,ue=[],X=0,Ee=!1,U=!1;function H(){return ne===0||Math.floor(Math.random()*ne)===0}function W(L){return!!L.debugEventsUntilDate&&L.debugEventsUntilDate>X&&L.debugEventsUntilDate>new Date().getTime()}function pt(L){var z=M({},L);return L.kind==="alias"||(ve||L.kind==="identify"?z.user=je.filterUser(L.user):(z.userKey=L.user.key,delete z.user),L.kind==="feature"&&(delete z.trackEvents,delete z.debugEventsUntilDate)),z}function mt(L){ue.length<Te?(ue.push(L),U=!1):(U||(U=!0,ke.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),w&&w.incrementDroppedEvents())}return I.enqueue=function(L){if(!Ee){var z=!1,Y=!1;if(V.summarizeEvent(L),L.kind==="feature"?H()&&(z=!!L.trackEvents,Y=W(L)):z=H(),z&&mt(pt(L)),Y){var De=M({},L,{kind:"debug"});De.user=je.filterUser(De.user),delete De.trackEvents,delete De.debugEventsUntilDate,mt(De)}}},I.flush=function(){if(Ee)return Promise.resolve();var L=ue,z=V.getSummary();return V.clearSummary(),z&&(z.kind="summary",L.push(z)),w&&w.setEventsInLastBatch(L.length),L.length===0?Promise.resolve():(ue=[],ke.debug(Wn(L.length)),F.sendEvents(L,C).then(function(Y){Y&&(Y.serverTime&&(X=Y.serverTime),Pe(Y.status)||(Ee=!0),Y.status>=400&&ye(function(){m.maybeReportError(new fn(Cn(Y.status,"event posting","some events were dropped")))}))}))},I.start=function(){g=setTimeout(function L(){I.flush(),g=setTimeout(L,ae)},ae)},I.stop=function(){clearTimeout(g)},I}(r,v,y,R,f,S),x=Ut(r,v,y),T={},E={},_=v.streaming,ee=!1,le=!1,ie=!0,$=v.stateProvider,q=function(i,l){var a,g={setUser:function(w){var m=a&&me(a);(a=En(w))&&l&&l(me(a),m)},getUser:function(){return a?me(a):null}};return g}(0,function(i,l){(function(a){$||a&&we({kind:"identify",key:a.key,user:a,creationDate:new Date().getTime()})})(i),!v.autoAliasingOptOut&&l&&l.anonymous&&i&&!i.anonymous&&ft(i,l)}),ct=Rt(P),fe=P.isEnabled()?new It(P,y,p,q):null;function we(i){if(y&&!($&&$.enqueueEvent&&$.enqueueEvent(i))){if(i.kind!=="alias"){if(!i.user)return void(ie&&(d.warn("Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"),ie=!1));ie=!1}!k||le||r.isDoNotTrack()||(d.debug(Xn(i.kind)),G.enqueue(i))}}function lt(i,l,a,g){var w=q.getUser(),m=new Date,D=l?l.value:null;if(!v.allowFrequentDuplicateEvents){var I=JSON.stringify(D)+(w&&w.key?w.key:"")+i,F=T[I];if(F&&m-F<3e5)return;T[I]=m}var C={kind:"feature",key:i,user:w,value:D,variation:l?l.variationIndex:null,default:a,creationDate:m.getTime()};w&&w.anonymous&&(C.contextKind=Re(w));var V=E[i];V&&(C.version=V.flagVersion?V.flagVersion:V.version,C.trackEvents=V.trackEvents,C.debugEventsUntilDate=V.debugEventsUntilDate),(g||V&&V.trackReason)&&l&&(C.reason=l.reason),we(C)}function tn(i,l,a,g){var w;if(E&&Z(E,i)&&E[i]&&!E[i].deleted){var m=E[i];w=Ue(m),m.value!==null&&m.value!==void 0||(w.value=l)}else w={value:l,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return a&&lt(i,w,l,g),w}function Ue(i){return{value:i.value,variationIndex:i.variation===void 0?null:i.variation,reason:i.reason||null}}function Re(i){return i.anonymous?"anonymousUser":"user"}function ft(i,l){$||i&&l&&we({kind:"alias",key:i.key,contextKind:Re(i),previousKey:l.key,previousContextKind:Re(l),creationDate:new Date().getTime()})}function dt(){if(u=!0,q.getUser()){var i=function(l){try{return JSON.parse(l)}catch{return void f.maybeReportError(new gn("Invalid data received from LaunchDarkly; connection may have been interrupted"))}};Q.connect(q.getUser(),p,{ping:function(){d.debug("received ping message from stream");var l=q.getUser();x.fetchFlagSettings(l,p).then(function(a){qe(l,q.getUser())&&de(a||{})}).catch(function(a){f.maybeReportError(new re(Ie(a)))})},put:function(l){var a=i(l.data);a&&(d.debug("received streaming update for all flags"),de(a))},patch:function(l){var a=i(l.data);if(a){var g=E[a.key];if(!g||!g.version||!a.version||g.version<a.version){d.debug(Hn(a.key));var w={},m=M({},a);delete m.key,E[a.key]=m;var D=Ue(m);w[a.key]=g?{previous:g.value,current:D}:{current:D},on(w)}else d.debug(Bn(a.key))}},delete:function(l){var a=i(l.data);if(a)if(!E[a.key]||E[a.key].version<a.version){d.debug(Gn(a.key));var g={};E[a.key]&&!E[a.key].deleted&&(g[a.key]={previous:E[a.key].value}),E[a.key]={version:a.version,deleted:!0},on(g)}else d.debug(Kn(a.key))}})}}function rn(){u&&(Q.disconnect(),u=!1)}function de(i){var l={};if(!i)return Promise.resolve();for(var a in E)Z(E,a)&&E[a]&&(i[a]&&!qe(i[a].value,E[a].value)?l[a]={previous:E[a].value,current:Ue(i[a])}:i[a]&&!i[a].deleted||(l[a]={previous:E[a].value}));for(var g in i)Z(i,g)&&i[g]&&(!E[g]||E[g].deleted)&&(l[g]={current:Ue(i[g])});return E=B({},i),on(l).catch(function(){})}function on(i){var l=Object.keys(i);if(l.length>0){var a={};l.forEach(function(g){var w=i[g].current,m=w?w.value:void 0,D=i[g].previous;f.emit("change:"+g,m,D),a[g]=w?{current:m,previous:D}:{previous:D}}),f.emit("change",a),f.emit("internal-change",E),v.sendEventsOnlyForVariation||$||l.forEach(function(g){lt(g,i[g].current)})}return c&&fe?fe.saveFlags(E):Promise.resolve()}function an(){var i=_||s&&_===void 0;i&&!u?dt():!i&&u&&rn(),A&&A.setStreaming(i)}function un(i){return i==="change"||i.substr(0,6+1)==="change:"}if(typeof v.bootstrap=="string"&&v.bootstrap.toUpperCase()==="LOCALSTORAGE"&&(fe?c=!0:d.warn(Be())),Se(v.bootstrap)==="object"&&(E=function(i){var l=Object.keys(i),a=i.$flagsState;!a&&l.length&&d.warn(An()),i.$valid===!1&&d.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");var g={};return l.forEach(function(w){if(w!=="$flagsState"&&w!=="$valid"){var m={value:i[w]};a&&a[w]?m=M(m,a[w]):m.version=0,g[w]=m}}),g}(v.bootstrap)),$){var vt=$.getInitialState();vt?gt(vt):$.on("init",gt),$.on("update",function(i){i.user&&q.setUser(i.user),i.flags&&de(i.flags)})}else(e?ct.validateUser(n).then(function(i){return q.setUser(i),Se(v.bootstrap)==="object"?be():c?fe.loadFlags().then(function(l){return l==null?(E={},x.fetchFlagSettings(q.getUser(),p).then(function(a){return de(a||{})}).then(be).catch(function(a){sn(new re(Ie(a)))})):(E=l,ye(be),x.fetchFlagSettings(q.getUser(),p).then(function(a){return de(a)}).catch(function(a){return f.maybeReportError(a)}))}):x.fetchFlagSettings(q.getUser(),p).then(function(l){E=l||{},be()}).catch(function(l){E={},sn(l)})}):Promise.reject(new Ae(jn()))).catch(sn);function gt(i){y=i.environment,q.setUser(i.user),E=B({},i.flags),ye(be)}function be(){d.info("LaunchDarkly client initialized"),ee=!0,an(),h.signalSuccess()}function sn(i){h.signalFailure(i)}return{client:{waitForInitialization:function(){return h.getInitializationPromise()},waitUntilReady:function(){return h.getReadyPromise()},identify:function(i,l,a){return le?oe(Promise.resolve({}),a):$?(d.warn("identify() has no effect here; it must be called on the main client instance"),oe(Promise.resolve(Ve(E)),a)):oe((c&&fe?fe.clearFlags():Promise.resolve()).then(function(){return ct.validateUser(i)}).then(function(g){return x.fetchFlagSettings(g,l).then(function(w){var m=Ve(w);return q.setUser(g),p=l,w?de(w).then(function(){return m}):m})}).then(function(g){return u&&dt(),g}).catch(function(g){return f.maybeReportError(g),Promise.reject(g)}),a)},getUser:function(){return q.getUser()},variation:function(i,l){return tn(i,l,!0,!1).value},variationDetail:function(i,l){return tn(i,l,!0,!0)},track:function(i,l,a){if(typeof i=="string"){r.customEventFilter&&!r.customEventFilter(i)&&d.warn(Ge(i));var g=q.getUser(),w={kind:"custom",key:i,user:g,url:r.getCurrentUrl(),creationDate:new Date().getTime()};g&&g.anonymous&&(w.contextKind=Re(g)),l!=null&&(w.data=l),a!=null&&(w.metricValue=a),we(w)}else f.maybeReportError(new dn(Ge(i)))},alias:ft,on:function(i,l,a){un(i)?(s=!0,ee&&an(),f.on(i,l,a)):f.on.apply(f,arguments)},off:function(i){if(f.off.apply(f,arguments),un(i)){var l=!1;f.getEvents().forEach(function(a){un(a)&&f.getEventListenerCount(a)>0&&(l=!0)}),l||(s=!1,u&&_===void 0&&rn())}},setStreaming:function(i){var l=i===null?void 0:i;l!==_&&(_=l,an())},flush:function(i){return oe(k?G.flush():Promise.resolve(),i)},allFlags:function(){var i={};if(!E)return i;for(var l in E)Z(E,l)&&(i[l]=tn(l,null,!v.sendEventsOnlyForVariation).value);return i},close:function(i){if(le)return oe(Promise.resolve(),i);var l=function(){le=!0,E={}};return oe(Promise.resolve().then(function(){if(rn(),A&&A.stop(),k)return G.stop(),G.flush()}).then(l).catch(l),i)}},options:v,emitter:f,ident:q,logger:d,requestor:x,start:function(){k&&(A&&A.start(),G.start())},enqueueEvent:we,getFlagsInternal:function(){return E},getEnvironmentId:function(){return y},internalChangeEventName:"internal-change"}}function it(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,r)}return t}function at(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?it(Object(t),!0).forEach(function(r){Nt(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):it(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function Nt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}Object.freeze({__proto__:null,commonBasicLogger:On,createConsoleLogger:In,errors:pn,initialize:ot,messages:Zn,utils:Dn,version:"3.6.0"}).commonBasicLogger;var ut={promise:Promise.resolve({status:200,header:function(){return null},body:null})};function At(e,n,t,r,o){if(o&&!function(){var f=window.navigator&&window.navigator.userAgent;if(f){var h=f.match(/Chrom(e|ium)\/([0-9]+)\./);if(h)return parseInt(h[2],10)<73}return!0}())return ut;var c=new window.XMLHttpRequest;for(var u in c.open(e,n,!o),t||{})Object.prototype.hasOwnProperty.call(t,u)&&c.setRequestHeader(u,t[u]);if(o)return c.send(r),ut;var s,d=new Promise(function(f,h){c.addEventListener("load",function(){s||f({status:c.status,header:function(v){return c.getResponseHeader(v)},body:c.responseText})}),c.addEventListener("error",function(){s||h(new Error)}),c.send(r)});return{promise:d,cancel:function(){s=!0,c.abort()}}}function Ft(e){var n,t={synchronousFlush:!1};if(window.XMLHttpRequest){var r=e&&e.disableSyncEventPost;t.httpRequest=function(s,d,f,h){var v=t.synchronousFlush&!r;return t.synchronousFlush=!1,At(s,d,f,h,v)}}t.httpAllowsPost=function(){return n===void 0&&(n=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),n},t.httpFallbackPing=function(s){new window.Image().src=s};var o,c=e&&e.eventUrlTransformer;t.getCurrentUrl=function(){return c?c(window.location.href):window.location.href},t.isDoNotTrack=function(){var s;return(s=window.navigator&&window.navigator.doNotTrack!==void 0?window.navigator.doNotTrack:window.navigator&&window.navigator.msDoNotTrack!==void 0?window.navigator.msDoNotTrack:window.doNotTrack)===1||s===!0||s==="1"||s==="yes"};try{window.localStorage&&(t.localStorage={get:function(s){return new Promise(function(d){d(window.localStorage.getItem(s))})},set:function(s,d){return new Promise(function(f){window.localStorage.setItem(s,d),f()})},clear:function(s){return new Promise(function(d){window.localStorage.removeItem(s),d()})}})}catch{t.localStorage=null}if(e&&e.useReport&&typeof window.EventSourcePolyfill=="function"&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(t.eventSourceAllowsReport=!0,o=window.EventSourcePolyfill):(t.eventSourceAllowsReport=!1,o=window.EventSource),window.EventSource){var u=3e5;t.eventSourceFactory=function(s,d){var f=at(at({},{heartbeatTimeout:u,silentTimeout:u,skipDefaultHeaders:!0}),d);return new o(s,f)},t.eventSourceIsActive=function(s){return s.readyState===window.EventSource.OPEN||s.readyState===window.EventSource.CONNECTING}}return t.userAgent="JSClient",t.version="2.22.1",t.diagnosticSdkData={name:"js-client-sdk",version:"2.22.1"},t.diagnosticPlatformData={name:"JS"},t.diagnosticUseCombinedEvent=!0,t}var Ct=/[|\\{}()[\]^$+*?.]/g,Ye=function(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(Ct,"\\$&")};function xt(e,n,t,r){var o,c,u=((e.kind==="substring"||e.kind==="regex")&&r.includes("/")?n:n.replace(r,"")).replace(t,"");switch(e.kind){case"exact":c=n,o=new RegExp("^"+Ye(e.url)+"/?$");break;case"canonical":c=u,o=new RegExp("^"+Ye(e.url)+"/?$");break;case"substring":c=u,o=new RegExp(".*"+Ye(e.substring)+".*$");break;case"regex":c=u,o=new RegExp(e.pattern);break;default:return!1}return o.test(c)}function st(e,n){for(var t={},r=null,o=[],c=0;c<e.length;c++)for(var u=e[c],s=u.urls||[],d=0;d<s.length;d++)if(xt(s[d],window.location.href,window.location.search,window.location.hash)){u.kind==="pageview"?n("pageview",u):(o.push(u),n("click_pageview",u));break}return o.length>0&&(r=function(f){for(var h=function(k,y){for(var p=[],P=0;P<y.length;P++)for(var S=k.target,b=y[P],O=b.selector,R=document.querySelectorAll(O);S&&R.length>0;){for(var A=0;A<R.length;A++)S===R[A]&&p.push(b);S=S.parentNode}return p}(f,o),v=0;v<h.length;v++)n("click",h[v])},document.addEventListener("click",r)),t.dispose=function(){document.removeEventListener("click",r)},t}function _t(e,n){var t,r;function o(){r&&r.dispose(),t&&t.length&&(r=st(t,c))}function c(u,s){var d=e.ident.getUser(),f={kind:u,key:s.key,data:null,url:window.location.href,user:d,creationDate:new Date().getTime()};return d&&d.anonymous&&(f.contextKind="anonymousUser"),u==="click"&&(f.selector=s.selector),e.enqueueEvent(f)}return e.requestor.fetchJSON("/sdk/goals/"+e.getEnvironmentId()).then(function(u){u&&u.length>0&&(r=st(t=u,c),function(s,d){var f,h=window.location.href;function v(){(f=window.location.href)!==h&&(h=f,d())}(function k(y,p){y(),setTimeout(function(){k(y,p)},p)})(v,s),window.history&&window.history.pushState?window.addEventListener("popstate",v):window.addEventListener("hashchange",v)}(300,o)),n()}).catch(function(u){e.emitter.maybeReportError(new pn.LDUnexpectedResponseError((u&&u.message,u.message))),n()}),{}}var qt={fetchGoals:{default:!0},hash:{type:"string"},eventProcessor:{type:"object"},eventUrlTransformer:{type:"function"},disableSyncEventPost:{default:!1}};function Vt(e,n){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=Ft(t),o=ot(e,n,t,r,qt),c=o.client,u=o.options,s=o.emitter,d=new Promise(function(h){var v=s.on("goalsReady",function(){s.off("goalsReady",v),h()})});c.waitUntilGoalsReady=function(){return d},u.fetchGoals?_t(o,function(){return s.emit("goalsReady")}):s.emit("goalsReady"),document.readyState!=="complete"?window.addEventListener("load",o.start):o.start();var f=function(){r.synchronousFlush=!0,c.flush().catch(function(){}),r.synchronousFlush=!1};return window.addEventListener("beforeunload",f),window.addEventListener("unload",f),c}const zt=(e,n,t=!0)=>function(o,c){const u=e.value,s=u?n.variation(o,c):c,d=N.ref(s);if(!t)return N.readonly(d);const f=h=>d.value=h;return n.on(`change:${o}`,f),N.onBeforeUnmount(()=>n.off(`change:${o}`,f)),u||n.on("ready",()=>f(n.variation(o,d.value))),N.readonly(d)},Jt="1.0.0",Le=(e,n)=>{const t=N.inject(e);if(t===void 0)throw new Error(`Injection of ${n} failed. LaunchDarkly plugin may not have been loaded.`);return t};function Mt(){return Le(Qe,"LD_READY")}function $t(){return Le(en,"LD_CLIENT")}function Ht(e){return Le(Ze,"LD_INIT")(e)}function Bt(e,n){return Le(nn,"LD_FLAG")(e,n)}const Ze=Symbol(),Qe=Symbol(),en=Symbol(),nn=Symbol(),Gt={install(e,n={}){const t=N.ref(!1),r=N.readonly(t),o=(c={})=>{var k,y,p,P;const u=(k=c.clientSideID)!=null?k:n.clientSideID;if(!u)throw new Error("Cannot initialize LaunchDarkly without a clientSideID");const s=(p=(y=c.user)!=null?y:n.user)!=null?p:{anonymous:!0},d=(P=c.options)!=null?P:n.options,h=Vt(u,s,cn(cn({},{wrapperName:"vue-client-sdk",wrapperVersion:Jt}),d));e.provide(en,h);const v=!(n.streaming===!1||c.streaming===!1);return e.provide(nn,zt(t,h,v)),h.on("ready",()=>t.value=!0),[r,h]};if(e.provide(Qe,r),n.deferInitialization)e.provide(Ze,o);else if(n.clientSideID)o(n);else throw new Error("LaunchDarkly plugin requires a clientSideID unless deferInitialization option is used")}};j.LDPlugin=Gt,j.LD_CLIENT=en,j.LD_FLAG=nn,j.LD_INIT=Ze,j.LD_READY=Qe,j.ldInit=Ht,j.useLDClient=$t,j.useLDFlag=Bt,j.useLDReady=Mt,Object.defineProperties(j,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
import { type Ref } from 'vue';
import type { LDClient } from 'launchdarkly-js-client-sdk';
export declare type FlagRef<T> = Readonly<Ref<T>>;
export declare const getLDFlag: (isLdReady: boolean, $ldClient: LDClient, enableStreaming?: boolean) => <T>(flagKey: string, defaultFlagValue?: T | undefined) => Readonly<Ref<T>>;
export declare const getLDFlag: (ldReady: Ref<boolean>, $ldClient: LDClient, enableStreaming?: boolean) => <T>(flagKey: string, defaultFlagValue?: T | undefined) => Readonly<Ref<T>>;
{
"name": "launchdarkly-vue-client-sdk",
"version": "1.0.0",
"version": "1.0.1",
"description": "LaunchDarkly Client-side SDK for VueJS",

@@ -5,0 +5,0 @@ "main": "./dist/launchdarkly-vue-client-sdk.umd.js",

@@ -23,3 +23,3 @@ # LaunchDarkly Client-side SDK for VueJS

Check out our [documentation](https://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](https://docs.launchdarkly.com/docs/vue-sdk-reference) or our [code-generated API documentation](https://launchdarkly.github.io/vue-client-sdk/).
Check out our [documentation](https://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [reference guide for this SDK](https://docs.launchdarkly.com/sdk/client-side/vue) or our [code-generated API documentation](https://launchdarkly.github.io/vue-client-sdk/).

@@ -52,2 +52,2 @@ This SDK builds upon the [JavaScript SDK](https://github.com/launchdarkly/js-client-sdk), supporting all of the same functionality, but using Vue's Composition API to add providers additional conveniences. While using this SDK you may need to directly interact with the underlying JavaScript SDK. For more information on how to use the JavaScript SDK and its characteristics, see the [SDK's README](https://github.com/launchdarkly/js-client-sdk/blob/main/README.md).

To run locally, clone this repository and run `npm i` then `npm start`. Run unit tests with `npm test` and lint with `npm run lint`.
To run locally, clone this repository and run `npm i` then `npm start`. Run unit tests with `npm test` and lint with `npm run lint`.

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

import { onBeforeUnmount, type Ref } from 'vue'
import { onBeforeUnmount, ref, type Ref } from 'vue'
import type { LDClient, LDFlagValue } from 'launchdarkly-js-client-sdk'

@@ -26,3 +26,3 @@ import { getLDFlag } from './getLDFlag'

ldClient = getMockLdClient('test-flag-value')
flagRef = getLDFlag(false, ldClient)('test-flag-key', 'default-flag-value')
flagRef = getLDFlag(ref(false), ldClient)('test-flag-key', 'default-flag-value')
})

@@ -50,3 +50,3 @@

ldClient = getMockLdClient('test-flag-value')
flagRef = getLDFlag(true, ldClient)('test-flag-key', 'default-flag-value')
flagRef = getLDFlag(ref(true), ldClient)('test-flag-key', 'default-flag-value')
})

@@ -75,3 +75,3 @@

ldClient = getMockLdClient('test-flag-value')
flagRef = getLDFlag(false, ldClient, false)('test-flag-key', 'default-flag-value')
flagRef = getLDFlag(ref(false), ldClient, false)('test-flag-key', 'default-flag-value')
})

@@ -99,3 +99,3 @@

ldClient = getMockLdClient('test-flag-value')
flagRef = getLDFlag(true, ldClient, false)('test-flag-key', 'default-flag-value')
flagRef = getLDFlag(ref(true), ldClient, false)('test-flag-key', 'default-flag-value')
})

@@ -119,3 +119,3 @@

const ldClient = getMockLdClient('test-flag-value')
getLDFlag(true, ldClient)('test-flag-key', 'default-flag-value')
getLDFlag(ref(true), ldClient)('test-flag-key', 'default-flag-value')

@@ -130,3 +130,3 @@ onBeforeUnmountMocked.mock.lastCall[0]()

const ldClientOnMocked = <jest.Mock<typeof ldClient.on>>ldClient.on
const flagRef = getLDFlag(false, ldClient)('test-flag-key', 'default-flag-value')
const flagRef = getLDFlag(ref(false), ldClient)('test-flag-key', 'default-flag-value')
expect(flagRef.value).toBe('default-flag-value')

@@ -133,0 +133,0 @@

@@ -6,4 +6,5 @@ import { onBeforeUnmount, readonly, ref, type Ref } from 'vue'

export const getLDFlag = (isLdReady: boolean, $ldClient: LDClient, enableStreaming = true) => {
export const getLDFlag = (ldReady: Ref<boolean>, $ldClient: LDClient, enableStreaming = true) => {
return function ldFlag<T>(flagKey: string, defaultFlagValue?: T): FlagRef<T> {
const isLdReady = ldReady.value
const flagValue = isLdReady ? $ldClient.variation(flagKey, defaultFlagValue) : defaultFlagValue

@@ -10,0 +11,0 @@ const flagRef = ref(flagValue)

@@ -71,4 +71,5 @@ import type { App } from 'vue'

expect(getLdFlagMock).toHaveBeenCalledWith(false, ldClientMock, false)
expect(getLdFlagMock).toHaveBeenCalledWith(expect.anything(), ldClientMock, false)
expect(getLdFlagMock.mock.calls[0][0]).toHaveProperty('value', false)
})
})

@@ -80,3 +80,3 @@ import { initialize, type LDClient, type LDUser, type LDOptions } from 'launchdarkly-js-client-sdk'

const enableStreaming = pluginOptions.streaming === false || initOptions.streaming === false ? false : true
app.provide(LD_FLAG, getLDFlag(ldReady.value, $ldClient, enableStreaming))
app.provide(LD_FLAG, getLDFlag(ldReady, $ldClient, enableStreaming))
$ldClient.on('ready', () => (ldReady.value = true))

@@ -83,0 +83,0 @@ return [$ldReady, $ldClient]

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