-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsplit-browser-1.6.0.full.min.js
More file actions
9 lines (9 loc) · 132 KB
/
split-browser-1.6.0.full.min.js
File metadata and controls
9 lines (9 loc) · 132 KB
1
2
3
4
5
6
7
8
9
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).splitio=t()}(this,(function(){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}function n(e,t){var n;if(c(e))for(var r=Object.keys(e),i=0;i<r.length&&!n;i++){var s=r[i];t(e[s],s,e)&&(n=e[s])}else if(Array.isArray(e))for(i=0;i<e.length&&!n;i++){t(e[i],i,e)&&(n=e[i])}return n}function r(e,t){if(Array.isArray(e)&&"function"==typeof t)for(var n=0;n<e.length;n++)if(!0===t(e[n],n,e))return n;return-1}function i(e,t){return Object.keys(e).forEach((function(n){return t(e[n],n,e)})),e}function s(e,t,n){var r=n;try{var i=t.split("."),s=e;i.forEach((function(e){return s=s[e]})),void 0!==s&&(r=s)}catch(e){}return r}function o(e){return!0===e||!1===e}function a(e){return e instanceof Number&&(e=e.valueOf()),"number"==typeof e&&(Number.isFinite?Number.isFinite(e):isFinite(e))}function u(e){return e instanceof Number&&(e=e.valueOf()),e!=e}function c(e){return null!==e&&"object"==typeof e&&(e.constructor===Object||null!=e.constructor&&"Object"===e.constructor.name)}function l(e){return"string"==typeof e||e instanceof String}function f(e){return l(e)?e.toUpperCase():e}function h(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=e;if(c(t)&&Object.keys(t).forEach((function(e){var n=t[e];c(n)&&(n=i[e]&&c(i[e])?h({},i[e],n):h({},n)),void 0!==n&&(i[e]=n)})),n&&n.length){var s=n.splice(0,1)[0];i=h.apply(void 0,function(e,t,n){if(n||2===arguments.length)for(var r,i=0,s=t.length;i<s;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([i,s],n,!1))}return i}function p(e,t){return!(!l(e)||!l(t))&&e.slice(0,t.length)===t}function g(e){if("number"==typeof e)return e;if(c(e)&&"function"==typeof e.valueOf){var t=e.valueOf();e=c(t)?t+"":t}return"string"!=typeof e?0===e?e:+e:+(e=e.replace(/^\s+|\s+$/g,""))}function d(e){if(null==e)return"";if("string"==typeof e)return e;if(Array.isArray(e))return e.map((function(e){return l(e)?e:""}))+"";var t=e+"";return"0"===t&&1/e===Number.NEGATIVE_INFINITY?"-0":t}function m(e){var t={};return e.filter((function(e){return!Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=!0)}))}"function"==typeof SuppressedError&&SuppressedError;var v="control",y="IMPRESSION",S="EVENT",b="DEBUG",E="OPTIMIZED",T="NONE",R="localhost",k="standalone",C="producer",w="consumer",N="consumer_partial",_="MEMORY",A="LOCALSTORAGE",I="PLUGGABLE",O="GRANTED",F="DECLINED",L="UNKNOWN",D="getTreatment",M="getTreatments",K="getTreatmentWithConfig",x="getTreatmentsWithConfig",P="getTreatmentsByFlagSet",U="getTreatmentsByFlagSets",B="getTreatmentsWithConfigByFlagSet",j="getTreatmentsWithConfigByFlagSets",q="track",z="split",W="splits",G="names",H=0,Q=1,V=2,J="sp",Y="im",$="ic",Z="ev",X="te",ee="to",te="se",ne="ms",re="t",ie="ts",se="tc",oe="tcs",ae="tf",ue="tfs",ce="tcf",le="tcfs",fe="tr",he=0,pe=30,ge=40,de=50,me=60,ve=70,ye=80,Se=0,be=1,Ee=1,Te=0,Re=1,ke=2,Ce="1.3",we="IN_SEGMENT",Ne="IN_RULE_BASED_SEGMENT",_e="standard",Ae="rule-based";function Ie(e){return w===e||N===e}var Oe=0,Fe=1,Le=2,De=3,Me=23,Ke=24,xe=27,Pe=28,Ue=29,Be=30,je=31,qe=32,ze=33,We=35,Ge=36,He=37,Qe=38,Ve=39,Je=40,Ye=41,$e=100,Ze=101,Xe=102,et=103,tt=104,nt=105,rt=106,it=107,st=108,ot=109,at=110,ut=111,ct=112,lt=113,ft=114,ht=115,pt=116,gt=117,dt=118,mt=119,vt=120,yt=121,St=122,bt=123,Et=124,Tt=200,Rt=201,kt=202,Ct=203,wt=204,Nt=205,_t=206,At=207,It=208,Ot=209,Ft=210,Lt=211,Dt=212,Mt=213,Kt=214,xt=215,Pt=216,Ut=217,Bt=218,jt=219,qt=220,zt=221,Wt=222,Gt=223,Ht=224,Qt=225,Vt=226,Jt=227,Yt=228,$t=300,Zt=301,Xt=302,en=303,tn=304,nn=305,rn=306,sn=307,on=308,an=309,un=310,cn=311,ln=312,fn=313,hn=314,pn=315,gn=316,dn=317,mn=318,vn=319,yn=320,Sn=321,bn=322,En=325,Tn=326,Rn=327,kn=328,Cn=329,wn="settings",Nn="Factory instantiation",_n="Client instantiation",An="engine",In=An+":combiner: ",On=An+":matcher: ",Fn=An+":value: ",Ln="sync",Dn=Ln+":sync-manager: ",Mn=Ln+":offline: ",Kn=Ln+":streaming: ",xn=Ln+":featureflag-changes: ",Pn=Ln+":my-segments: ",Un=Ln+":polling-manager: ",Bn=Ln+":submitter: ",jn="impressions-tracker: ",qn="events-tracker: ",zn="unique-keys-tracker: ",Wn="cleanup: ",Gn=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/;function Hn(e,t,n,r){if(void 0===r&&(r="feature flag name"),null==t)e.error(pn,[n,r]);else if(l(t)){if(Gn.test(t)&&(e.warn(Kt,[n,r,t]),t=t.trim()),t.length>0)return t;e.error(vn,[n,r])}else e.error(mn,[n,r]);return!1}function Qn(e,t,n,r,i){if(void 0===r&&(r="feature flag names"),void 0===i&&(i="feature flag name"),Array.isArray(t)&&t.length>0){var s=[];if(t.forEach((function(t){var r=Hn(e,t,n,i);r&&s.push(r)})),s.length)return m(s)}return e.error(yn,[n,r]),!1}var Vn=Object.assign||function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");e=Object(e);for(var t=1;t<arguments.length;t++){var n=Object(arguments[t]);for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jn=[{type:"bySet",maxLength:50,queryParam:"sets="},{type:"byName",maxLength:400,queryParam:"names="},{type:"byPrefix",maxLength:50,queryParam:"prefixes="}],Yn=/^[a-z0-9][_a-z0-9]{0,49}$/,$n=/[A-Z]/;function Zn(e,t,n){return m(t.map((function(t){return $n.test(t)&&(e.warn(Vt,[n,t]),t=t.toLowerCase()),t})).filter((function(t){return Yn.test(t)?"string"==typeof t:(e.warn(Qt,[n,t,Yn,t]),!1)})))}function Xn(e,t){return n(e,(function(e){return e.type===t&&e.values.length>0}))}function er(e,t,n){var r,i,s={validFilters:[],queryString:null,groupedFilters:{bySet:[],byName:[],byPrefix:[]}};return t?Ie(n)?(e.warn(jt),s):Array.isArray(t)&&0!==t.length?(s.validFilters=t.filter((function(t,n){return t&&(r=t.type,Jn.some((function(e){return e.type===r})))&&Array.isArray(t.values)?(s.groupedFilters[t.type]=s.groupedFilters[t.type].concat(t.values),!0):(e.warn(qt,[n]),!1);var r})),Jn.forEach((function(t){var n=t.type,r=t.maxLength;s.groupedFilters[n].length>0&&(s.groupedFilters[n]=function(e,t,n,r){var i=Qn(e,n,wn,t+" filter",t+" filter value");if(i){if("bySet"===t&&(i=Zn(e,i,wn)),i.length>r)throw new Error(r+" unique values can be specified at most for '"+t+"' filter. You passed "+i.length+". Please consider reducing the amount or using other filter.");i.sort()}return i||[]}(e,n,s.groupedFilters[n],r))})),Xn(s.validFilters,"bySet")&&((Xn(s.validFilters,"byName")||Xn(s.validFilters,"byPrefix"))&&e.error(kn),Vn(s.groupedFilters,{byName:[],byPrefix:[]})),s.queryString=(r=s.groupedFilters,i=[],Jn.forEach((function(e){var t=e.type,n=e.queryParam,s=r[t];s.length>0&&i.push(n+s.map((function(e){return encodeURIComponent(e)})).join(","))})),i.length>0?"&"+i.join("&"):null),e.debug(Ve,[s.queryString]),s):(e.warn(zt),s):s}var tr,nr=250;function rr(e,t,n,r){if(null==t)return e.error(pn,[n,r]),!1;if(a(t))return e.warn(Mt,[n,r,t]),d(t);if(l(t)){if((t=t.trim()).length>0&&t.length<=nr)return t;0===t.length?e.error(vn,[n,r]):t.length>nr&&e.error(gn,[n,r])}else e.error(mn,[n,r]);return!1}function ir(e,t,n){if(c(t)){var r=rr(e,t.matchingKey,n,"matchingKey"),i=rr(e,t.bucketingKey,n,"bucketingKey");return r&&i?{matchingKey:r,bucketingKey:i}:(e.error(dn,[n]),!1)}return rr(e,t,n,"key")}function sr(e,t,n,r){var i=n.splits,s=n.rbSegments,o=n.segments,a=n.largeSegments,u=t.splitChanges,c=u.ff,l=u.rbs;e.debug("storage: set feature flags and segments"+(r?" for key "+r:"")),i&&c&&(i.clear(),i.update(c.d,[],c.t)),s&&l&&(s.clear(),s.update(l.d,[],l.t));var f=t.segmentChanges;if(r){var h=t.memberships&&t.memberships[r];!h&&f&&(h={ms:{k:f.filter((function(e){return e.added.indexOf(r)>-1})).map((function(e){return{n:e.name}}))}}),h&&(h.ms&&o.resetSegments(h.ms),h.ls&&a&&a.resetSegments(h.ls))}else f&&(o.clear(),f.forEach((function(e){o.update(e.name,e.added,e.removed,e.till)})))}!function(e){e.FlagName="Invalid flag name (max 100 chars, no spaces)",e.Treatment="Invalid treatment (max 100 chars and must match pattern)"}(tr||(tr={}));var or=/^[0-9]+[.a-zA-Z0-9_-]*$|^[a-zA-Z]+[a-zA-Z0-9_-]*$/;function ar(e){var t=c(e)?e.treatment:e;return!(!l(t)||t.length>100)&&or.test(t)}function ur(e,t){if(void 0!==t){if(ar(t))return t;e.error("Fallback treatments - Discarded fallback: "+tr.Treatment)}}function cr(e,t){var n={};return c(t)?(Object.keys(t).forEach((function(r){var i,s=t[r];(i=r).length<=100&&!i.includes(" ")?ar(s)?n[r]=s:e.error("Fallback treatments - Discarded treatment for flag '"+r+"': "+tr.Treatment):e.error("Fallback treatments - Discarded flag '"+r+"': "+tr.FlagName)})),n):n}var lr={mode:k,core:{authorizationKey:void 0,key:void 0,labelsEnabled:!0,IPAddressesEnabled:void 0},scheduler:{featuresRefreshRate:60,segmentsRefreshRate:60,telemetryRefreshRate:3600,impressionsRefreshRate:300,offlineRefreshRate:15,eventsPushRate:60,eventsQueueSize:500,impressionsQueueSize:3e4,pushRetryBackoffBase:1},urls:{sdk:"https://sdk.split.io/api",events:"https://events.split.io/api",auth:"https://auth.split.io/api",streaming:"https://streaming.split.io",telemetry:"https://telemetry.split.io/api"},storage:void 0,debug:void 0,impressionListener:void 0,version:void 0,integrations:void 0,streamingEnabled:!0,sync:{splitFilters:void 0,impressionsMode:E,enabled:!0,flagSpecVersion:Ce},log:void 0};function fr(e){return Math.round(1e3*e)}function hr(e,t){var n=t.defaults,r=t.runtime,i=t.storage,o=t.integrations,a=t.logger,u=t.consent,l=t.flagSpec,p=h({},lr,n,e);p.features=s(e,"features");var g=a(p);p.log=g;var d=p.sync;d.impressionsMode=function(e,t){return t=f(t),[b,E,T].indexOf(t)>-1?t:(e.error(Sn,["impressionsMode",[b,E,T],E]),E)}(g,d.impressionsMode);var m,v,y,S=p.scheduler,_=p.startup;S.featuresRefreshRate=fr(S.featuresRefreshRate),S.segmentsRefreshRate=fr(S.segmentsRefreshRate),S.offlineRefreshRate=fr(S.offlineRefreshRate),S.eventsPushRate=fr(S.eventsPushRate),S.telemetryRefreshRate=fr((m="telemetryRefreshRate",(v=S.telemetryRefreshRate)>=(y=60)?v:(g.error(Tn,[m,y]),y))),void 0===s(e,"scheduler.impressionsRefreshRate")&&d.impressionsMode===b&&(S.impressionsRefreshRate=60),S.impressionsRefreshRate=fr(S.impressionsRefreshRate),S.metricsRefreshRate&&g.warn("`metricsRefreshRate` will be deprecated soon. For configuring telemetry rates, update `telemetryRefreshRate` value in configs"),_.requestTimeoutBeforeReady=fr(_.requestTimeoutBeforeReady),_.readyTimeout=fr(_.readyTimeout),_.eventsFirstPushWindow=fr(_.eventsFirstPushWindow),p.mode=function(e,t){if("localhost"===e)return R;if(-1===[k,C,w,N].indexOf(t))throw Error("Invalid mode provided");return t}(p.core.authorizationKey,p.mode),i&&(p.storage=i(p)),p.initialRolloutPlan&&(p.initialRolloutPlan=function(e,t){var n=t.mode,r=t.initialRolloutPlan;if(!Ie(n))return c(r)&&c(r.splitChanges)?r:void e.error("storage: invalid rollout plan provided");e.warn("storage: initial rollout plan is ignored in consumer mode")}(g,p));var A=p.core.key;t.acceptKey?p.mode===R&&void 0===A?p.core.key="localhost_key":p.core.key=ir(g,A,_n):(void 0!==A&&g.warn("Provided `key` is ignored in server-side SDK."),p.core.key=void 0),p.runtime=r(p),o&&(p.integrations=o(p)),!1!==p.streamingEnabled&&(p.streamingEnabled=!0,S.pushRetryBackoffBase=fr(S.pushRetryBackoffBase)),!1!==d.enabled&&(d.enabled=!0);var I=er(g,d.splitFilters,p.mode);return d.splitFilters=I.validFilters,d.__splitFiltersValidation=I,d.flagSpecVersion=l?l(p):Ce,p.userConsent=u?u(p):void 0,p.fallbackTreatments=p.fallbackTreatments?function(e,t){if(c(t))return{global:ur(e,t.global),byFlag:cr(e,t.byFlag)};e.error("Fallback treatments - Discarded configuration: it must be an object with optional `global` and `byFlag` properties")}(g,p.fallbackTreatments):void 0,p}function pr(e){return null!==e&&"object"==typeof e&&"function"==typeof e.debug&&"function"==typeof e.info&&"function"==typeof e.warn&&"function"==typeof e.error}var gr={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR",NONE:"NONE"},dr={DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5},mr={debug:function(e){console.log("[DEBUG] "+e)},info:function(e){console.log("[INFO] "+e)},warn:function(e){console.log("[WARN] "+e)},error:function(e){console.log("[ERROR] "+e)}};function vr(e){return!!n(gr,(function(t){return e===t}))}function yr(e,t){void 0===e&&(e=""),void 0===t&&(t=[]);var n=0;return e.replace(/%s/g,(function(){var e=t[n++];if(c(e)||Array.isArray(e))try{e=JSON.stringify(e)}catch(e){}return e}))}var Sr,br={prefix:"splitio",logLevel:gr.NONE},Er=function(){function e(e,t){this.options=Vn({},br,e),this.codes=t||new Map,this.logLevel=dr[this.options.logLevel]}return e.prototype.setLogLevel=function(e){this.options.logLevel=e,this.logLevel=dr[e]},e.prototype.setLogger=function(e){if(e){if(pr(e))return void(this.logger=e);this.error("Invalid `logger` instance. It must be an object with `debug`, `info`, `warn` and `error` methods. Defaulting to `console.log`")}this.logger=void 0},e.prototype.debug=function(e,t){this._shouldLog(dr.DEBUG)&&this._log("debug",e,t)},e.prototype.info=function(e,t){this._shouldLog(dr.INFO)&&this._log("info",e,t)},e.prototype.warn=function(e,t){this._shouldLog(dr.WARN)&&this._log("warn",e,t)},e.prototype.error=function(e,t){this._shouldLog(dr.ERROR)&&this._log("error",e,t)},e.prototype._log=function(e,t,n){if("number"==typeof t){var r=this.codes.get(t);t=r?yr(r,n):"Message code "+t+(n?", with args: "+n.toString():"")}else n&&(t=yr(t,n));if(this.options.prefix&&(t=this.options.prefix+" => "+t),this.logger)try{return void this.logger[e](t)}catch(e){}mr[e](t)},e.prototype._shouldLog=function(e){return e>=this.logLevel},e}();try{var Tr=localStorage.getItem("splitio_debug")||"";Sr=/^(enabled?|on)/i.test(Tr)?gr.DEBUG:vr(Tr)?Tr:gr.NONE}catch(Ei){}var Rr={startup:{requestTimeoutBeforeReady:5,retriesOnFailureBeforeReady:1,readyTimeout:10,eventsFirstPushWindow:10},userConsent:O,version:"browserjs-1.6.0",debug:Sr};var kr=function(){function e(){}return e.prototype.update=function(e,t,n){var r=this;this.setChangeNumber(n);var i=e.map((function(e){return r.addSplit(e)})).some((function(e){return e}));return t.map((function(e){return r.removeSplit(e.name)})).some((function(e){return e}))||i},e.prototype.getSplits=function(e){var t=this,n={};return e.forEach((function(e){n[e]=t.getSplit(e)})),n},e.prototype.getAll=function(){var e=this;return this.getSplitNames().map((function(t){return e.getSplit(t)}))},e.prototype.killLocally=function(e,t,n){var r=this.getSplit(e);if(r&&(!r.changeNumber||r.changeNumber<n)){var i=Vn({},r);return i.killed=!0,i.defaultTreatment=t,i.changeNumber=n,this.addSplit(i)}return!1},e}();function Cr(e){for(var t=e.conditions||[],n=0;n<t.length;n++)for(var r=t[n].matcherGroup.matchers,i=0;i<r.length;i++){var s=r[i].matcherType;if(s===we||"IN_LARGE_SEGMENT"===s)return!0}var o=e.excluded;return!!(o&&o.segments&&o.segments.length>0)}function wr(e){return e.splits.usesSegments()||e.rbSegments.usesSegments()}var Nr=function(e){function n(t){var n=e.call(this)||this;return n.splitsCache={},n.ttCache={},n.changeNumber=-1,n.segmentsCount=0,n.flagSetsCache={},n.flagSetsFilter=t?t.groupedFilters.bySet:[],n}return t(n,e),n.prototype.clear=function(){this.splitsCache={},this.ttCache={},this.changeNumber=-1,this.segmentsCount=0,this.flagSetsCache={}},n.prototype.addSplit=function(e){var t=e.name,n=this.getSplit(t);if(n){var r=n.trafficTypeName;this.ttCache[r]--,this.ttCache[r]||delete this.ttCache[r],this.removeFromFlagSets(n.name,n.sets),Cr(n)&&this.segmentsCount--}this.splitsCache[t]=e;var i=e.trafficTypeName;return this.ttCache[i]=(this.ttCache[i]||0)+1,this.addToFlagSets(e),Cr(e)&&this.segmentsCount++,!0},n.prototype.removeSplit=function(e){var t=this.getSplit(e);if(!t)return!1;delete this.splitsCache[e];var n=t.trafficTypeName;return this.ttCache[n]--,this.ttCache[n]||delete this.ttCache[n],this.removeFromFlagSets(t.name,t.sets),Cr(t)&&this.segmentsCount--,!0},n.prototype.getSplit=function(e){return this.splitsCache[e]||null},n.prototype.setChangeNumber=function(e){return this.changeNumber=e,!0},n.prototype.getChangeNumber=function(){return this.changeNumber},n.prototype.getSplitNames=function(){return Object.keys(this.splitsCache)},n.prototype.trafficTypeExists=function(e){return a(this.ttCache[e])&&this.ttCache[e]>0},n.prototype.usesSegments=function(){return-1===this.getChangeNumber()||this.segmentsCount>0},n.prototype.getNamesByFlagSets=function(e){var t=this;return e.map((function(e){return t.flagSetsCache[e]||new Set}))},n.prototype.addToFlagSets=function(e){var t=this;e.sets&&e.sets.forEach((function(n){t.flagSetsFilter.length>0&&!t.flagSetsFilter.some((function(e){return e===n}))||(t.flagSetsCache[n]||(t.flagSetsCache[n]=new Set([])),t.flagSetsCache[n].add(e.name))}))},n.prototype.removeFromFlagSets=function(e,t){var n=this;t&&t.forEach((function(t){n.removeNames(t,e)}))},n.prototype.removeNames=function(e,t){this.flagSetsCache[e]&&(this.flagSetsCache[e].delete(t),0===this.flagSetsCache[e].size&&delete this.flagSetsCache[e])},n}(kr),_r=function(){function e(){}return e.prototype.clear=function(){this.resetSegments({})},e.prototype.registerSegments=function(){return!1},e.prototype.update=function(){return!1},e.prototype.resetSegments=function(e){var t=this;this.setChangeNumber(e.cn);var n=e,r=n.added,i=n.removed;if(r&&i){var s=!1;return r.forEach((function(e){s=t.addSegment(e)||s})),i.forEach((function(e){s=t.removeSegment(e)||s})),s}var o=(e.k||[]).map((function(e){return e.n})).sort(),a=this.getRegisteredSegments().sort();if(!o.length&&!a.length)return!1;for(var u=0;u<o.length&&u<a.length&&o[u]===a[u];)u++;if(u===o.length&&u===a.length)return!1;for(var c=u;c<a.length;c++)this.removeSegment(a[c]);for(var l=u;l<o.length;l++)this.addSegment(o[l]);return!0},e}(),Ar=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.segmentCache={},t}return t(n,e),n.prototype.addSegment=function(e){return!this.segmentCache[e]&&(this.segmentCache[e]=!0,!0)},n.prototype.removeSegment=function(e){return!!this.segmentCache[e]&&(delete this.segmentCache[e],!0)},n.prototype.isInSegment=function(e){return!0===this.segmentCache[e]},n.prototype.setChangeNumber=function(e){this.cn=e},n.prototype.getChangeNumber=function(){return this.cn||-1},n.prototype.getRegisteredSegments=function(){return Object.keys(this.segmentCache)},n.prototype.getKeysCount=function(){return 1},n}(_r),Ir=function(){function e(e){void 0===e&&(e=0),this.name="impressions",this.maxQueue=e,this.queue=[]}return e.prototype.setOnFullQueueCb=function(e){this.onFullQueue=e},e.prototype.track=function(e){var t;(t=this.queue).push.apply(t,e),this.maxQueue>0&&this.queue.length>=this.maxQueue&&this.onFullQueue&&this.onFullQueue()},e.prototype.clear=function(){this.queue=[]},e.prototype.pop=function(e){var t=this.queue;return this.clear(),e?e.concat(t):t},e.prototype.isEmpty=function(){return 0===this.queue.length},e}(),Or=function(){function e(e){void 0===e&&(e=0),this.name="events",this.maxQueue=e,this.queue=[],this.queueByteSize=0}return e.prototype.setOnFullQueueCb=function(e){this.onFullQueue=e},e.prototype.track=function(e,t){return void 0===t&&(t=0),this.queueByteSize+=t,this.queue.push(e),this._checkForFlush(),!0},e.prototype.clear=function(){this.queue=[],this.queueByteSize=0},e.prototype.pop=function(e){var t=this.queue;return this.clear(),e?e.concat(t):t},e.prototype.isEmpty=function(){return 0===this.queue.length},e.prototype._checkForFlush=function(){(this.queueByteSize>5242880||this.maxQueue>0&&this.queue.length>=this.maxQueue)&&this.onFullQueue&&this.onFullQueue()},e}(),Fr=36e5;function Lr(e){return e-e%Fr}var Dr=function(){function e(e){void 0===e&&(e=3e4),this.name="impression counts",this.cache={},this.cacheSize=0,this.maxStorage=e}return e.prototype._makeKey=function(e,t){return e+"::"+Lr(t)},e.prototype.track=function(e,t,n){var r=this._makeKey(e,t),i=this.cache[r];this.cache[r]=i?i+n:n,this.onFullQueue&&(this.cacheSize=this.cacheSize+n,this.cacheSize>=this.maxStorage&&this.onFullQueue())},e.prototype.pop=function(e){var t=this.cache;return this.clear(),e?(Object.keys(t).forEach((function(n){e[n]?e[n]+=t[n]:e[n]=t[n]})),e):t},e.prototype.clear=function(){this.cache={},this.cacheSize=0},e.prototype.isEmpty=function(){return 0===Object.keys(this.cache).length},e}();function Mr(e){return c(e)?e.matchingKey:e}function Kr(e){return c(e)?{matchingKey:e.matchingKey,bucketingKey:e.bucketingKey}:{matchingKey:e,bucketingKey:e}}function xr(e){return!e.core.key}function Pr(e){var t=Math.min(22,Math.max(0,Math.ceil(Math.log(e)/Math.log(1.5))));return u(t)?0:t}var Ur=.001;function Br(e){var t=e.settings;return t.mode!==R&&(xr(t)||Math.random()<=Ur)}var jr=function(){function e(e,t,n){this.splits=e,this.segments=t,this.largeSegments=n,this.name="telemetry stats",this.e=!0,this.notReadyUsage=0,this.impressionStats=[0,0,0],this.eventStats=[0,0],this.lastSync={},this.httpErrors={},this.httpLatencies={},this.authRejections=0,this.tokenRefreshes=0,this.streamingEvents=[],this.tags=[],this.exceptions={},this.latencies={},this.updatesFromSSE={}}return e.prototype.isEmpty=function(){return this.e},e.prototype.clear=function(){},e.prototype.pop=function(){return this.e=!0,{lS:this.getLastSynchronization(),mL:this.popLatencies(),mE:this.popExceptions(),hE:this.popHttpErrors(),hL:this.popHttpLatencies(),tR:this.popTokenRefreshes(),aR:this.popAuthRejections(),iQ:this.getImpressionStats(H),iDe:this.getImpressionStats(V),iDr:this.getImpressionStats(Q),spC:this.splits&&this.splits.getSplitNames().length,seC:this.segments&&this.segments.getRegisteredSegments().length,skC:this.segments&&this.segments.getKeysCount(),lsC:this.largeSegments&&this.largeSegments.getRegisteredSegments().length,lskC:this.largeSegments&&this.largeSegments.getKeysCount(),sL:this.getSessionLength(),eQ:this.getEventStats(H),eD:this.getEventStats(Q),sE:this.popStreamingEvents(),t:this.popTags(),ufs:this.popUpdatesFromSSE()}},e.prototype.getTimeUntilReady=function(){return this.timeUntilReady},e.prototype.recordTimeUntilReady=function(e){this.timeUntilReady=e},e.prototype.getTimeUntilReadyFromCache=function(){return this.timeUntilReadyFromCache},e.prototype.recordTimeUntilReadyFromCache=function(e){this.timeUntilReadyFromCache=e},e.prototype.getNonReadyUsage=function(){return this.notReadyUsage},e.prototype.recordNonReadyUsage=function(){this.notReadyUsage++},e.prototype.getImpressionStats=function(e){return this.impressionStats[e]},e.prototype.recordImpressionStats=function(e,t){this.impressionStats[e]+=t,this.e=!1},e.prototype.getEventStats=function(e){return this.eventStats[e]},e.prototype.recordEventStats=function(e,t){this.eventStats[e]+=t,this.e=!1},e.prototype.getLastSynchronization=function(){return this.lastSync},e.prototype.recordSuccessfulSync=function(e,t){this.lastSync[e]=t,this.e=!1},e.prototype.popHttpErrors=function(){var e=this.httpErrors;return this.httpErrors={},e},e.prototype.recordHttpError=function(e,t){var n=this.httpErrors[e]=this.httpErrors[e]||{};n[t]=(n[t]||0)+1,this.e=!1},e.prototype.popHttpLatencies=function(){var e=this.httpLatencies;return this.httpLatencies={},e},e.prototype.recordHttpLatency=function(e,t){(this.httpLatencies[e]=this.httpLatencies[e]||[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])[Pr(t)]++,this.e=!1},e.prototype.popAuthRejections=function(){var e=this.authRejections;return this.authRejections=0,e},e.prototype.recordAuthRejections=function(){this.authRejections++,this.e=!1},e.prototype.popTokenRefreshes=function(){var e=this.tokenRefreshes;return this.tokenRefreshes=0,e},e.prototype.recordTokenRefreshes=function(){this.tokenRefreshes++,this.e=!1},e.prototype.popStreamingEvents=function(){return this.streamingEvents.splice(0)},e.prototype.recordStreamingEvents=function(e){this.streamingEvents.length<20&&this.streamingEvents.push(e),this.e=!1},e.prototype.popTags=function(){return this.tags.splice(0)},e.prototype.addTag=function(e){this.tags.length<10&&this.tags.push(e),this.e=!1},e.prototype.getSessionLength=function(){return this.sessionLength},e.prototype.recordSessionLength=function(e){this.sessionLength=e,this.e=!1},e.prototype.popExceptions=function(){var e=this.exceptions;return this.exceptions={},e},e.prototype.recordException=function(e){this.exceptions[e]=(this.exceptions[e]||0)+1,this.e=!1},e.prototype.popLatencies=function(){var e=this.latencies;return this.latencies={},e},e.prototype.recordLatency=function(e,t){(this.latencies[e]=this.latencies[e]||[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])[Pr(t)]++,this.e=!1},e.prototype.popUpdatesFromSSE=function(){var e=this.updatesFromSSE;return this.updatesFromSSE={},e},e.prototype.recordUpdatesFromSSE=function(e){this.updatesFromSSE[e]=(this.updatesFromSSE[e]||0)+1,this.e=!1},e}();function qr(e){if(Array.from)return Array.from(e);var t=[];return e.forEach((function(e){t.push(e)})),t}var zr=function(){function e(e){void 0===e&&(e=3e4),this.name="unique keys",this.uniqueTrackerSize=0,this.uniqueKeysTracker={},this.maxStorage=e}return e.prototype.setOnFullQueueCb=function(e){this.onFullQueue=e},e.prototype.track=function(e,t){this.uniqueKeysTracker[e]||(this.uniqueKeysTracker[e]=new Set);var n=this.uniqueKeysTracker[e];n.has(t)||(n.add(t),this.uniqueTrackerSize++),this.uniqueTrackerSize>=this.maxStorage&&this.onFullQueue&&this.onFullQueue()},e.prototype.clear=function(){this.uniqueTrackerSize=0,this.uniqueKeysTracker={}},e.prototype.pop=function(){var e=this.uniqueKeysTracker;return this.clear(),this.fromUniqueKeysCollector(e)},e.prototype.isEmpty=function(){return 0===Object.keys(this.uniqueKeysTracker).length},e.prototype.fromUniqueKeysCollector=function(e){for(var t=[],n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],s={k:i,fs:qr(e[i])};t.push(s)}return{keys:t}},e}(),Wr=function(){function e(){this.cache={},this.changeNumber=-1,this.segmentsCount=0}return e.prototype.clear=function(){this.cache={},this.changeNumber=-1,this.segmentsCount=0},e.prototype.update=function(e,t,n){var r=this;this.changeNumber=n;var i=e.map((function(e){return r.add(e)})).some((function(e){return e}));return t.map((function(e){return r.remove(e.name)})).some((function(e){return e}))||i},e.prototype.add=function(e){var t=e.name,n=this.get(t);return n&&Cr(n)&&this.segmentsCount--,this.cache[t]=e,Cr(e)&&this.segmentsCount++,!0},e.prototype.remove=function(e){var t=this.get(e);return!!t&&(delete this.cache[e],Cr(t)&&this.segmentsCount--,!0)},e.prototype.getNames=function(){return Object.keys(this.cache)},e.prototype.get=function(e){return this.cache[e]||null},e.prototype.getAll=function(){var e=this;return this.getNames().map((function(t){return e.get(t)}))},e.prototype.contains=function(e){var t=qr(e),n=this.getNames();return t.every((function(e){return-1!==n.indexOf(e)}))},e.prototype.getChangeNumber=function(){return this.changeNumber},e.prototype.usesSegments=function(){return this.segmentsCount>0},e}();function Gr(e){var t=e.settings,n=t.scheduler,r=n.impressionsQueueSize,i=n.eventsQueueSize,s=t.sync.__splitFiltersValidation,o=new Nr(s),a=new Wr,u=new Ar,c={splits:o,rbSegments:a,segments:u,largeSegments:new Ar,impressions:new Ir(r),impressionCounts:new Dr,events:new Or(i),telemetry:Br(e)?new jr(o,u):void 0,uniqueKeys:new zr,destroy:function(){},shared:function(){return{splits:this.splits,rbSegments:this.rbSegments,segments:new Ar,largeSegments:new Ar,impressions:this.impressions,impressionCounts:this.impressionCounts,events:this.events,telemetry:this.telemetry,uniqueKeys:this.uniqueKeys,destroy:function(){}}}};if(e.settings.mode===R){var l=function(){return!0};c.impressions.track=l,c.events.track=l,c.impressionCounts.track=l,c.uniqueKeys.track=l}return c}function Hr(e){var t=Gr(e);return t.validateCache=function(){return Promise.resolve(!0)},t}Gr.type=_,Hr.type=_;var Qr=gr.NONE;var Vr=[F,O,L];var Jr={defaults:Rr,acceptKey:!0,runtime:function(){return{ip:!1,hostname:!1}},storage:function(e){var t=e.storage,n=void 0===t?Gr:t,r=e.log,i=e.mode;if("function"==typeof n&&-1!==[_,A,I].indexOf(n.type)||(n=Gr,r.error(324)),i===R&&n.type===A)return Hr;if(-1===[R,k].indexOf(i)){if(n.type!==I)throw new Error("A PluggableStorage instance is required on consumer mode")}else n.type===I&&(n=Gr,r.error(324,[" It requires consumer mode."]));return n},integrations:function(e){return function(e,t,n){var r=e.integrations,i=e.log;if(!Array.isArray(r)||0===r.length)return[];var s=r.filter(t),o=r.length-s.length;return o&&i.warn(Bt,[o,n||""]),s}(e,(function(e){return"function"==typeof e}),"Integration items must be functions that initialize the integrations")},logger:function(e){var t,n=e.debug,r=e.logger,i=Qr;if(void 0!==n){if(function(e){return pr(e)&&"function"==typeof e.setLogLevel}(n))return n.setLogger(r),n;i="boolean"==typeof(t=e.debug)?t?gr.DEBUG:gr.NONE:"string"==typeof t&&vr(t)?t:void 0}var s=new Er({logLevel:i||Qr});return s.setLogger(r),i||s._log("error","Invalid `debug` value at config. Logs will be disabled."),s},consent:function(e){var t=e.userConsent,n=e.log;return t=f(t),Vr.indexOf(t)>-1?t:(n.error(Sn,["userConsent",Vr,O]),O)}};var Yr=new Set(["splitsdkclientkey","splitsdkversion","splitsdkmachineip","splitsdkmachinename","splitsdkimpressionsmode","host","referrer","content-type","content-length","content-encoding","accept","keep-alive","x-fastly-debug"]);function $r(e,t){var n;if(null===(n=e.sync.requestOptions)||void 0===n?void 0:n.getHeaderOverrides)try{var r=e.sync.requestOptions.getHeaderOverrides({headers:Vn({},t)});Object.keys(r).filter((function(e){return!Yr.has(e.toLowerCase())})).forEach((function(e){return t[e]=r[e]}))}catch(t){e.log.error("Problem adding custom headers to request decorator: "+t)}return t}function Zr(e,t){return e<1?t:new Promise((function(n,r){var i=setTimeout((function(){r(new Error("Operation timed out because it exceeded the configured time limit of "+e+" ms."))}),e);t.then((function(e){clearTimeout(i),n(e)}),(function(e){clearTimeout(i),r(e)}))}))}var Xr=100,ei="Global fetch API is not available.";var ti={headers:{"Cache-Control":"no-cache"}};function ni(e){return"users="+encodeURIComponent(e)}function ri(e,t,n){var r=e.urls,i=e.sync.__splitFiltersValidation&&e.sync.__splitFiltersValidation.queryString,s=e.sync.impressionsMode,o=function(e,t){var n=t.getOptions,r=t.getFetch,i=e.log,s=e.core.authorizationKey,o=e.version,a=e.runtime,u=a.ip,c=a.hostname,l=n&&n(e),f=r&&r(e);f||i.error(en,[ei]);var h={Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+s,SplitSDKVersion:o};return u&&(h.SplitSDKMachineIP=u),c&&(h.SplitSDKMachineName=c.replace(/[^\x00-\xFF]/g,"")),function(t,n,r,s){void 0===n&&(n={}),void 0===r&&(r=function(){}),void 0===s&&(s=!1);var o=Vn({headers:$r(e,Vn({},h,n.headers||{})),method:n.method||"GET",body:n.body},l);return f?f(t,o).then((function(e){return e.ok?(r(),e):Zr(Xr,e.text()).then((function(t){return Promise.reject({response:e,message:t})}),(function(){return Promise.reject({response:e})}))})).catch((function(e){var n=e&&e.response,o="";o=n?404===n.status?"Invalid SDK key or resource not found.":e.message:e.message||"Network Error",n&&403===n.status||i[s?"info":"error"](bn,[n?"status code "+n.status:"no status code",t,o]);var a=new Error(o);throw a.statusCode=n&&n.status,r(a),a})):Promise.reject(new Error(ei))}}(e,t);return{getSdkAPIHealthCheck:function(){var e=r.sdk+"/version";return o(e).then((function(){return!0})).catch((function(){return!1}))},getEventsAPIHealthCheck:function(){var e=r.events+"/version";return o(e).then((function(){return!0})).catch((function(){return!1}))},fetchAuth:function(t){var i=r.auth+"/v2/auth?s="+e.sync.flagSpecVersion;if(t){var s=t.map(ni).join("&");s&&(i+="&"+s)}return o(i,void 0,n.trackHttp(ee))},fetchSplitChanges:function(t,s,a,u){var c=r.sdk+"/splitChanges?s="+e.sync.flagSpecVersion+"&since="+t+(u?"&rbSince="+u:"")+(i||"")+(a?"&till="+a:"");return o(c,s?ti:void 0,n.trackHttp(J)).catch((function(t){throw 414===t.statusCode&&e.log.error(Rn),t}))},fetchSegmentChanges:function(e,t,i,s){var a=r.sdk+"/segmentChanges/"+t+"?since="+e+(s?"&till="+s:"");return o(a,i?ti:void 0,n.trackHttp(te))},fetchMemberships:function(e,t,i){var s=r.sdk+"/memberships/"+encodeURIComponent(e)+(i?"?till="+i:"");return o(s,t?ti:void 0,n.trackHttp(ne))},postEventsBulk:function(e,t){var i=r.events+"/events/bulk";return o(i,{method:"POST",body:e,headers:t},n.trackHttp(Z))},postTestImpressionsBulk:function(e,t){var i=r.events+"/testImpressions/bulk";return o(i,{method:"POST",body:e,headers:Vn({SplitSDKImpressionsMode:s},t)},n.trackHttp(Y))},postTestImpressionsCount:function(e,t){var i=r.events+"/testImpressions/count";return o(i,{method:"POST",body:e,headers:t},n.trackHttp($))},postUniqueKeysBulkCs:function(e,t){var i=r.telemetry+"/v1/keys/cs";return o(i,{method:"POST",body:e,headers:t},n.trackHttp(X))},postUniqueKeysBulkSs:function(e,t){var i=r.telemetry+"/v1/keys/ss";return o(i,{method:"POST",body:e,headers:t},n.trackHttp(X))},postMetricsConfig:function(e,t){var i=r.telemetry+"/v1/metrics/config";return o(i,{method:"POST",body:e,headers:t},n.trackHttp(X),!0)},postMetricsUsage:function(e,t){var i=r.telemetry+"/v1/metrics/usage";return o(i,{method:"POST",body:e,headers:t},n.trackHttp(X),!0)}}}function ii(e,t,n,r){void 0===r&&(r="task");var i,s,o,a=0,u=!1,c=0;function l(){for(var n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];return a++,e.debug(He,[r]),i=(i?i.then((function(){return t.apply(void 0,n)})):t.apply(void 0,n)).then((function(e){return a--,e}))}function f(e){return l.apply(void 0,s).then((function(t){return u&&e===c&&(o=setTimeout(f,n,e)),t}))}return{execute:l,isExecuting:function(){return a>0},start:function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];if(!u)return u=!0,c++,s=t,e.debug(Ge,[r,n]),f(c)},stop:function(){u&&(u=!1,e.debug(Qe,[r]),clearTimeout(o),o=void 0)},isRunning:function(){return u}}}function si(e,t,n,r,i,s,o){void 0===s&&(s=0);var a,u=n.name,c=0;return ii(e,(function(){if(n.isEmpty()&&!a)return Promise.resolve();var r="number"==typeof(a=n.pop(a)).length?a.length+" "+u:u;e[o?"debug":"info"](pt,[r]);var l=JSON.stringify(i?i(a):a);return s||(a=void 0),t(l).then((function(){c=0,a=void 0})).catch((function(t){s?c===s?(c=0,a=void 0,e[o?"debug":"warn"](Ot,[r,t])):(c++,e[o?"debug":"warn"](Ft,[r,t])):e[o?"debug":"warn"](Ot,[r,t])}))}),r,u+" submitter")}function oi(e,t){var n,r=!1,i=e.start;e.start=function(){r=!0,n=setTimeout(i,t)};var s=e.stop;return e.stop=function(){r=!1,clearTimeout(n),s()},e.isRunning=function(){return r},e}function ai(e){var t=e.settings,n=t.log,r=t.scheduler.eventsPushRate,i=t.startup.eventsFirstPushWindow,s=e.splitApi.postEventsBulk,o=e.storage.events,a=si(n,s,o,r);return i>0&&(a=oi(a,i)),o.setOnFullQueueCb((function(){a.isRunning()&&(n.info(ht,[o.name]),a.execute())})),a}function ui(e,t){var n=function(e,t){var n={};if(Array.isArray(e)&&l(t))for(var r=0;r<e.length;r++){var i=e[r][t];l(i)&&(n[i]||(n[i]=[]),n[i].push(e[r]))}return n}(t,"feature"),r=[];return i(n,(function(t,n){r.push({f:n,i:t.map((function(t){return{k:t.keyName,t:t.treatment,m:t.time,c:t.changeNumber,r:e?t.label:void 0,b:t.bucketingKey,pt:t.pt,properties:t.properties}}))})})),r}function ci(e){var t=e.settings,n=t.log,r=t.scheduler.impressionsRefreshRate,i=t.core.labelsEnabled,s=e.splitApi.postTestImpressionsBulk,o=e.storage.impressions,a=si(n,s,o,r,ui.bind(void 0,i),1);return o.setOnFullQueueCb((function(){a.isRunning()&&(n.info(ht,[o.name]),a.execute())})),a}function li(e){for(var t=[],n=Object.keys(e),r=0;r<n.length;r++){var i=n[r].split("::");if(2===i.length){var s=i[0],o=i[1],a={f:s,m:Number(o),rc:e[n[r]]};t.push(a)}}return{pf:t}}var fi=18e5;function hi(e){return si(e.settings.log,e.splitApi.postTestImpressionsCount,e.storage.impressionCounts,fi,li,1)}var pi="state::splits-arrived",gi="state::splits-cache-loaded",di="state::segments-arrived",mi="init::timeout",vi="init::ready",yi="init::cache-ready",Si="state::update",bi="sdk_key";var Ei,Ti,Ri,ki={};function Ci(e,t){var n=function(e,t){var n=!1;return null==t?e.error(pn,[Nn,bi]):l(t)?t.length>0?n=t:e.error(vn,[Nn,bi]):e.error(mn,[Nn,bi]),n}(e,t);return n&&(ki[n]?(e.warn(Wt,[ki[n]+" factory/ies with this SDK Key"]),ki[n]++):(ki[n]=1,Object.keys(ki).length>1&&e.warn(Wt,["an instance of the Split factory"]))),n}function wi(e){var t=e();return function(){return Math.round(e()-t)}}var Ni=((Ei={})[k]=0,Ei[w]=1,Ei[N]=2,Ei),_i=((Ti={})[E]=0,Ti[b]=1,Ti[T]=2,Ti),Ai=((Ri={})[L]=1,Ri[O]=2,Ri[F]=3,Ri);function Ii(e,t){return{name:"telemetry config",isEmpty:function(){return!1},clear:function(){},pop:function(){var n,r,i=t.urls,s=t.scheduler,o=xr(t),a=function(e){var t=0;e.validFilters.forEach((function(e){"bySet"===e.type&&(t+=e.values.length)}));var n=e.groupedFilters.bySet.length;return{flagSetsTotal:t,flagSetsIgnored:t-n}}(t.sync.__splitFiltersValidation),u=a.flagSetsTotal,c=a.flagSetsIgnored;return Vn((n=t.mode,r=t.storage.type,{oM:Ni[n],st:r.toLowerCase(),aF:Object.keys(ki).length,rF:Object.keys(ki).reduce((function(e,t){return e+ki[t]-1}),0)}),{sE:t.streamingEnabled,rR:{sp:s.featuresRefreshRate/1e3,se:o?s.segmentsRefreshRate/1e3:void 0,ms:o?void 0:s.segmentsRefreshRate/1e3,im:s.impressionsRefreshRate/1e3,ev:s.eventsPushRate/1e3,te:s.telemetryRefreshRate/1e3},uO:{s:i.sdk!==lr.urls.sdk,e:i.events!==lr.urls.events,a:i.auth!==lr.urls.auth,st:i.streaming!==lr.urls.streaming,t:i.telemetry!==lr.urls.telemetry},iQ:s.impressionsQueueSize,eQ:s.eventsQueueSize,iM:_i[t.sync.impressionsMode],iL:!!t.impressionListener,hP:!1,tR:e.getTimeUntilReady(),tC:e.getTimeUntilReadyFromCache(),nR:e.getNonReadyUsage(),t:e.popTags(),i:t.integrations&&t.integrations.map((function(e){return e.type})),uC:t.userConsent?Ai[t.userConsent]:0,fsT:u,fsI:c})}}}var Oi=9e5;function Fi(e){var t=e.settings,n=t.log,r=t.core.key,i=e.splitApi,s=i.postUniqueKeysBulkCs,o=i.postUniqueKeysBulkSs,a=e.storage.uniqueKeys,u=si(n,void 0!==r?s:o,a,Oi);return a.setOnFullQueueCb((function(){u.isRunning()&&(n.info(ht,[a.name]),u.execute())})),u}function Li(e){var t=[ci(e),ai(e),hi(e),Fi(e)],n=function(e){var t=e.storage.telemetry,n=e.platform.now;if(t&&n){var r=e.settings,i=e.settings,s=i.log,o=i.scheduler.telemetryRefreshRate,a=e.splitApi,u=e.readiness,c=e.sdkReadinessManager,l=wi(n),f=oi(si(s,a.postMetricsUsage,t,o,void 0,0,!0),o);return u.gate.once(yi,(function(){t.recordTimeUntilReadyFromCache(l())})),c.incInternalReadyCbCount(),u.gate.once(vi,(function(){t.recordTimeUntilReady(l()),f.isRunning()&&si(s,a.postMetricsConfig,Ii(t,r),0,void 0,0,!0).execute()})),f}}(e);return{start:function(e){e||t.forEach((function(e){return e.start()})),n&&n.start()},stop:function(e){t.forEach((function(e){return e.stop()})),!e&&n&&n.stop()},isRunning:function(){return t.some((function(e){return e.isRunning()}))},execute:function(e){var r=e?[]:t.map((function(e){return e.execute()}));return n&&r.push(n.execute()),Promise.all(r).then((()=>{}))},isExecuting:function(){return t.some((function(e){return e.isExecuting()}))}}}var Di,Mi=600,Ki="PUSH_NONRETRYABLE_ERROR",xi="PUSH_RETRYABLE_ERROR",Pi="PUSH_SUBSYSTEM_UP",Ui="PUSH_SUBSYSTEM_DOWN",Bi="MEMBERSHIPS_MS_UPDATE",ji="MEMBERSHIPS_LS_UPDATE",qi="SEGMENT_UPDATE",zi="SPLIT_KILL",Wi="SPLIT_UPDATE",Gi="RB_SEGMENT_UPDATE",Hi="CONTROL",Qi="OCCUPANCY";function Vi(e){var t=e.userConsent;return!t||t===O}function Ji(e,t){return function(n){var r=n.settings,i=n.settings,s=i.log,o=i.streamingEnabled,a=i.sync.enabled,u=n.telemetryTracker,c=n.storage,l=n.readiness,f=e&&e(n),h=a&&o&&f&&t?t(n,f):void 0,p=Li(n);h&&(h.on(Pi,(function(){s.info(mt),f.isRunning()&&(f.stop(),u.streamingEvent(ve,Se)),f.syncAll()})),h.on(Ui,(function(){f.isRunning()?s.info(dt):(s.info(gt),f.start(),u.streamingEvent(ve,be))})));var g=!1,d=!0;return{pollingManager:f,pushManager:h,submitterManager:p,start:function(){return g=!0,p.start(!Vi(r)),Promise.resolve(!!c.validateCache&&c.validateCache()).then((function(e){g&&(d&&e&&l.splits.emit(gi),f&&(a?h?(d&&f.syncAll(),h.start()):f.start():d&&f.syncAll()),d=!1)}))},stop:function(){g=!1,h&&h.stop(),f&&f.isRunning()&&f.stop(),p.stop()},isRunning:function(){return g},flush:function(){return p.execute(!Vi(r))},shared:function(e,t,n){if(f){var r=f.add(e,t,n);return a&&h&&h.add(e,r),g&&(a?h?f.isRunning()?wr(n)&&r.start():r.execute():wr(n)&&r.start():t.isReady()||r.execute()),{stop:function(){var t=f.get(e);t&&(h&&h.remove(e),t.isRunning()&&t.stop(),f.remove(e))},flush:function(){return Promise.resolve()}}}}}}}!function(e){e.STREAMING_DISABLED="STREAMING_DISABLED",e.STREAMING_PAUSED="STREAMING_PAUSED",e.STREAMING_RESUMED="STREAMING_RESUMED",e.STREAMING_RESET="STREAMING_RESET"}(Di||(Di={}));var Yi=function(){function e(t,n,r){this.baseMillis=e.__TEST__BASE_MILLIS||n||e.DEFAULT_BASE_MILLIS,this.maxMillis=e.__TEST__MAX_MILLIS||r||e.DEFAULT_MAX_MILLIS,this.attempts=0,this.cb=t}return e.prototype.scheduleCall=function(){var e=this,t=Math.min(this.baseMillis*Math.pow(2,this.attempts),this.maxMillis);return this.timeoutID&&clearTimeout(this.timeoutID),this.timeoutID=setTimeout((function(){e.timeoutID=void 0,e.cb()}),t),this.attempts++,t},e.prototype.reset=function(){this.attempts=0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=void 0)},e.DEFAULT_BASE_MILLIS=1e3,e.DEFAULT_MAX_MILLIS=18e5,e}();var $i=[/control_pri$/,/control_sec$/],Zi=[10,20];function Xi(e,t,n){var r=function(e,t){var n=$i.map((function(e){return{regex:e,hasPublishers:!0,oTime:-1,cTime:-1}})),r=!0,i=!0;return{handleOpen:function(){t.streamingEvent(he),e.emit(Pi)},isStreamingUp:function(){return i&&r},handleOccupancyEvent:function(s,o,a){for(var u=0;u<n.length;u++){var c=n[u];if(c.regex.test(o)){if(t.streamingEvent(Zi[u],s),a>c.oTime){c.oTime=a,c.hasPublishers=0!==s;var l=n.some((function(e){return e.hasPublishers}));i&&(!l&&r?e.emit(Ui):l&&!r&&e.emit(Pi)),r=l}return}}},handleControlEvent:function(s,o,a){if(s!==Di.STREAMING_RESET)for(var u=0;u<n.length;u++){var c=n[u];if(c.regex.test(o))return void(a>c.cTime&&(c.cTime=a,s===Di.STREAMING_DISABLED?(t.streamingEvent(pe,Te),e.emit(Ki)):r&&(s===Di.STREAMING_PAUSED&&i?(t.streamingEvent(pe,ke),e.emit(Ui)):s!==Di.STREAMING_RESUMED||i||(t.streamingEvent(pe,Re),e.emit(Pi))),i=s===Di.STREAMING_RESUMED))}else e.emit(s)}}}(t,n);return{handleOpen:function(){r.handleOpen()},handleError:function(r){var i=r;try{i=function(e){return l(e.data)&&(e.parsedData=JSON.parse(e.data)),e}(r)}catch(t){e.warn(_t,[t])}var s=i.parsedData&&i.parsedData.message||i.message;e.error(nn,[s]),!function(e){if(e.parsedData&&e.parsedData.code){var t=e.parsedData.code;if(n.streamingEvent(me,t),40140<=t&&t<=40149)return!0;if(4e4<=t&&t<=49999)return!1}else n.streamingEvent(ge,Ee);return!0}(i)?t.emit(Ki):t.emit(xi)},handleMessage:function(n){var i;try{if(i=function(e){if(e.data){var t=JSON.parse(e.data);return t.parsedData=JSON.parse(t.data),t.name&&"[meta]occupancy"===t.name&&(t.parsedData.type=Qi),t}}(n),!i)return}catch(t){return void e.warn(At,[t])}var s=i.parsedData,o=i.data,a=i.channel,u=i.timestamp;if(e.debug(We,[o]),r.isStreamingUp()||-1!==[Qi,Hi].indexOf(s.type))switch(s.type){case Wi:case qi:case Bi:case ji:case zi:case Gi:t.emit(s.type,s);break;case Qi:r.handleOccupancyEvent(s.metrics.publishers,a,u);break;case Hi:r.handleControlEvent(s.controlType,a,u)}}}}var es=1e4,ts=6e4,ns=10;function rs(e,t,n,r){var i,s,o;function a(t){var i,a,u,c=0,l=-1,f=!1,h=new Yi(p);function p(){if(i=!0,c>Math.max(l,t.getChangeNumber())){f=!1;var g=c;(s?new Promise((function(e){o=setTimeout((function(){s=void 0,n.execute(u,!0,a?c:void 0).then(e)}),s)})):n.execute(u,!0,a?c:void 0)).then((function(n){if(i){if(!1!==n){var s=t.getChangeNumber();l=s>-1?s:Math.max(l,g)}if(f)p();else{u&&r.trackUpdatesFromSSE(ne);var o=h.attempts+1;if(c<=l)return e.debug("Refresh completed"+(a?" bypassing the CDN":"")+" in "+o+" attempts."),void(i=!1);if(o<ns)return void h.scheduleCall();a?(e.debug("No changes fetched after "+o+" attempts with CDN bypassed."),i=!1):(h.reset(),a=!0,p())}}}))}else i=!1}return{put:function(e,n,r){var o=e.type,g=e.cn;g<=Math.max(l,t.getChangeNumber())||g<=c||(c=g,s||(f=!0,a=!1,u=n&&{type:o,cn:g,added:n.added,removed:n.removed},s=r,!h.timeoutID&&i||p(),h.reset()))},stop:function(){clearTimeout(o),s=void 0,i=!1,h.reset()}}}var u=((i={})[Bi]=a(t.segments),i[ji]=a(t.largeSegments),i);return{put:function(e,t,n){u[e.type].put(e,t,n)},stop:function(){u[Bi].stop(),u[ji].stop()}}}function is(e,t,n){var r={};return{put:function(i){var s=i.changeNumber,o=i.segmentName;r[o]||(r[o]=function(r){var i,s,o=0,a=!1,u=new Yi(c,es,ts);function c(){i=!0,o>(n.getChangeNumber(r)||-1)?(a=!1,t.execute(!1,r,!0,s?o:void 0).then((function(){if(i)if(a)c();else{var t=u.attempts+1;if(o<=(n.getChangeNumber(r)||-1))return e.debug("Refresh completed"+(s?" bypassing the CDN":"")+" in "+t+" attempts."),void(i=!1);if(t<ns)return void u.scheduleCall();s?(e.debug("No changes fetched after "+t+" attempts with CDN bypassed."),i=!1):(u.reset(),s=!0,c())}}))):i=!1}return{put:function(e){e<=(n.getChangeNumber(r)||-1)||e<=o||(o=e,a=!0,s=!1,!u.timeoutID&&i||c(),u.reset())},stop:function(){i=!1,u.reset()}}}(o)),r[o].put(s)},stop:function(){Object.keys(r).forEach((function(e){return r[e].stop()}))}}}var ss=function(){if([typeof Uint8Array,typeof Uint16Array,typeof Uint32Array].some((function(e){return"function"!=e})))return"global Uint8Array object is not available for gzip/zlib decompression";var e=Uint8Array,t=Uint16Array,n=Uint32Array,r=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(e,r){for(var i=new t(31),s=0;s<31;++s)i[s]=r+=1<<e[s-1];var o=new n(i[30]);for(s=1;s<30;++s)for(var a=i[s];a<i[s+1];++a)o[a]=a-i[s]<<5|s;return[i,o]},a=o(r,2),u=a[0],c=a[1];u[28]=258,c[258]=28;for(var l=o(i,0)[0],f=new t(32768),h=0;h<32768;++h){var p=(43690&h)>>>1|(21845&h)<<1;p=(61680&(p=(52428&p)>>>2|(13107&p)<<2))>>>4|(3855&p)<<4,f[h]=((65280&p)>>>8|(255&p)<<8)>>>1}var g=function(e,n,r){for(var i=e.length,s=0,o=new t(n);s<i;++s)++o[e[s]-1];var a,u=new t(n);for(s=0;s<n;++s)u[s]=u[s-1]+o[s-1]<<1;if(r){a=new t(1<<n);var c=15-n;for(s=0;s<i;++s)if(e[s])for(var l=s<<4|e[s],h=n-e[s],p=u[e[s]-1]++<<h,g=p|(1<<h)-1;p<=g;++p)a[f[p]>>>c]=l}else for(a=new t(i),s=0;s<i;++s)e[s]&&(a[s]=f[u[e[s]-1]++]>>>15-e[s]);return a},d=new e(288);for(h=0;h<144;++h)d[h]=8;for(h=144;h<256;++h)d[h]=9;for(h=256;h<280;++h)d[h]=7;for(h=280;h<288;++h)d[h]=8;var m=new e(32);for(h=0;h<32;++h)m[h]=5;var v=g(d,9,1),y=g(m,5,1),S=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},b=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},E=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},T=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],R=function(e,t,n){var r=new Error(t||T[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,R),!n)throw r;return r},k=function(o,a,c){var f=o.length;if(!f||c&&c.f&&!c.l)return a||new e(0);var h=!a||c,p=!c||c.i;c||(c={}),a||(a=new e(3*f));var d=function(t){var n=a.length;if(t>n){var r=new e(Math.max(2*n,t));r.set(a),a=r}},m=c.f||0,T=c.p||0,k=c.b||0,C=c.l,w=c.d,N=c.m,_=c.n,A=8*f;do{if(!C){m=b(o,T,1);var I=b(o,T+1,3);if(T+=3,!I){var O=o[(q=4+((T+7)/8|0))-4]|o[q-3]<<8,F=q+O;if(F>f){p&&R(0);break}h&&d(k+O),a.set(o.subarray(q,F),k),c.b=k+=O,c.p=T=8*F,c.f=m;continue}if(1==I)C=v,w=y,N=9,_=5;else if(2==I){var L=b(o,T,31)+257,D=b(o,T+10,15)+4,M=L+b(o,T+5,31)+1;T+=14;for(var K=new e(M),x=new e(19),P=0;P<D;++P)x[s[P]]=b(o,T+3*P,7);T+=3*D;var U=S(x),B=(1<<U)-1,j=g(x,U,1);for(P=0;P<M;){var q,z=j[b(o,T,B)];if(T+=15&z,(q=z>>>4)<16)K[P++]=q;else{var W=0,G=0;for(16==q?(G=3+b(o,T,3),T+=2,W=K[P-1]):17==q?(G=3+b(o,T,7),T+=3):18==q&&(G=11+b(o,T,127),T+=7);G--;)K[P++]=W}}var H=K.subarray(0,L),Q=K.subarray(L);N=S(H),_=S(Q),C=g(H,N,1),w=g(Q,_,1)}else R(1);if(T>A){p&&R(0);break}}h&&d(k+131072);for(var V=(1<<N)-1,J=(1<<_)-1,Y=T;;Y=T){var $=(W=C[E(o,T)&V])>>>4;if((T+=15&W)>A){p&&R(0);break}if(W||R(2),$<256)a[k++]=$;else{if(256==$){Y=T,C=null;break}var Z=$-254;if($>264){var X=r[P=$-257];Z=b(o,T,(1<<X)-1)+u[P],T+=X}var ee=w[E(o,T)&J],te=ee>>>4;ee||R(3),T+=15ⅇQ=l[te];if(te>3){X=i[te];Q+=E(o,T)&(1<<X)-1,T+=X}if(T>A){p&&R(0);break}h&&d(k+131072);for(var ne=k+Z;k<ne;k+=4)a[k]=a[k-Q],a[k+1]=a[k+1-Q],a[k+2]=a[k+2-Q],a[k+3]=a[k+3-Q];k=ne}}c.l=C,c.p=Y,c.b=k,c.f=m,C&&(m=1,c.m=N,c.d=w,c.n=_)}while(!m);return k==a.length?a:function(r,i,s){(null==i||i<0)&&(i=0),(null==s||s>r.length)&&(s=r.length);var o=new(r instanceof t?t:r instanceof n?n:e)(s-i);return o.set(r.subarray(i,s)),o}(a,0,k)};return{gunzipSync:function(t,n){return k(t.subarray(function(e){31==e[0]&&139==e[1]&&8==e[2]||R(6,"invalid gzip data");var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)}(t),-8),n||new e((i=(r=t).length,(r[i-4]|r[i-3]<<8|r[i-2]<<16|r[i-1]<<24)>>>0)));var r,i},unzlibSync:function(e,t){return k(((8!=(15&(n=e)[0])||n[0]>>>4>7||(n[0]<<8|n[1])%31)&&R(6,"invalid zlib data"),32&n[1]&&R(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var n}}}(),os="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function as(e){var t=String(e).replace(/[=]+$/,"");if(t.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var n="",r=0,i=void 0,s=void 0,o=0;s=t.charAt(o++);~s&&(i=r%4?64*i+s:s,r++%4)?n+=String.fromCharCode(255&i>>(-2*r&6)):0)s=os.indexOf(s);return n}var us=String.fromCharCode;function cs(e){var t,n,r,i,s;return n=function(e){if("string"!=typeof e)throw TypeError("Illegal argument: "+typeof e);var t=0;return function(){return t>=e.length?null:e.charCodeAt(t++)}}(e),i=[],s=[],r=t=function(){if(0===arguments.length)return s.join("")+us.apply(String,i);i.length+arguments.length>1024&&(s.push(us.apply(String,i)),i.length=0),Array.prototype.push.apply(i,arguments)},function(e,t){for(var n,r=null;null!==(n=null!==r?r:e());)n>=55296&&n<=57343&&null!==(r=e())&&r>=56320&&r<=57343?(t(1024*(n-55296)+r-56320+65536),r=null):t(n);null!==r&&t(r)}(n,(function(e){!function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(n>>6&31|192),t(63&n|128)):n<65536?(t(n>>12&15|224),t(n>>6&63|128),t(63&n|128)):(t(n>>18&7|240),t(n>>12&63|128),t(n>>6&63|128),t(63&n|128)),n=null}(e,r)})),t()}
/*!
* +----------------------------------------------------------------------------------+
* | murmurHash3.js v3.0.0 (http://github.com/karanlyons/murmurHash3.js) |
* | A TypeScript/JavaScript implementation of MurmurHash3's hashing algorithms. |
* |----------------------------------------------------------------------------------|
* | Copyright (c) 2012-2020 Karan Lyons. Freely distributable under the MIT license. |
* +----------------------------------------------------------------------------------+
*/function ls(e,t){return(65535&e)*t+(((e>>>16)*t&65535)<<16)}function fs(e,t){return e<<t|e>>>32-t}function hs(e,t){t=t||0;for(var n,r=(e=e||"").length%4,i=e.length-r,s=t,o=0,a=3432918353,u=461845907,c=0;c<i;c+=4)o=ls(o=255&e.charCodeAt(c)|(255&e.charCodeAt(c+1))<<8|(255&e.charCodeAt(c+2))<<16|(255&e.charCodeAt(c+3))<<24,a),o=ls(o=fs(o,15),u),s=ls(s=fs(s^=o,13),5)+3864292196;switch(o=0,r){case 3:o^=(255&e.charCodeAt(c+2))<<16;case 2:o^=(255&e.charCodeAt(c+1))<<8;case 1:o=ls(o^=255&e.charCodeAt(c),a),s^=o=ls(o=fs(o,15),u)}return s^=e.length,n=s,n=ls(n^=n>>>16,2246822507),(s=(n=ls(n^=n>>>13,3266489909))^n>>>16)>>>0}function ps(e,t){return hs(cs(e),t>>>0)}function gs(e,t){return Math.abs(ps(e,t)%100)+1}var ds=1,ms=2;function vs(e,t){var n,r=as(e),i=(n=r.split("").map((function(e){return e.charCodeAt(0)})),new Uint8Array(n));if("string"==typeof ss)throw new Error(ss);if(t===ds)return ss.gunzipSync(i);if(t===ms)return ss.unzlibSync(i);throw new Error("Invalid compression algorithm #"+t)}function ys(e,t,n){void 0===n&&(n=!0);var r,i=vs(e,t),s=(r=i,String.fromCharCode.apply(null,r));return n&&(s=s.replace(/\d+/g,'"$&"')),JSON.parse(s)}var Ss=6e4;function bs(e,t){if(0===e.h)return 0;var n=e.i||Ss;return ps(t,e.s||0)%n}function Es(e,t,n,r,i,s){var o=u(t.splits),a=u(t.rbSegments);function u(t){var r,u,c,l=-1,f=!1,h=new Yi(p,es,ts);function p(){r=!0,l>t.getChangeNumber()?(f=!1,n.execute(!0,u?l:void 0,c).then((function(){if(r)if(f)p();else{c&&i.trackUpdatesFromSSE(J),s&&s.execute(!0);var t=h.attempts+1;if(o.isSync()&&a.isSync())return e.debug("Refresh completed"+(u?" bypassing the CDN":"")+" in "+t+" attempts."),void(r=!1);if(t<ns)return void h.scheduleCall();u?(e.debug("No changes fetched after "+t+" attempts with CDN bypassed."),r=!1):(h.reset(),u=!0,p())}}))):r=!1}return{put:function(e,n){var i=e.changeNumber,s=e.pcn,o=e.type,a=t.getChangeNumber();i<=a||i<=l||(l=i,f=!0,u=!1,c=void 0,n&&a===s&&(c={payload:n,changeNumber:i,type:o}),!h.timeoutID&&r||p(),h.reset())},stop:function(){r=!1,h.reset()},isSync:function(){return l<=t.getChangeNumber()}}}return{put:function(t){if(t.d&&void 0!==t.c)try{var n=(r=t.c,i=t.d,r>0?ys(i,r,!1):JSON.parse(as(i)));if(n)return void(t.type===Gi?a:o).put(t,n)}catch(n){e.warn(Ht,[t.type,n])}var r,i;(t.type===Gi?a:o).put(t)},killSplit:function(e){var n=e.changeNumber,i=e.splitName,s=e.defaultTreatment;t.splits.killLocally(i,s,n)&&r.emit(pi,!0),o.put({changeNumber:n})},stop:function(){o.stop(),a.stop()}}}function Ts(e){return function(t){return e(t).then((function(e){return e.json()})).then((function(e){if(e.token){var t=(r=e.token,i=r.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(as(i).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join("")),JSON.parse(s));if("number"!=typeof t.iat||"number"!=typeof t.exp)throw new Error('token properties "issuedAt" (iat) or "expiration" (exp) are missing or invalid');var n=JSON.parse(t["x-ably-capability"]);return Vn({decodedToken:t,channels:n},e)}var r,i,s;return e}))}}function Rs(e){return function(e){for(var t=String(e),n="",r=void 0,i=void 0,s=0,o=os;t.charAt(0|s)||(o="=",s%1);n+=o.charAt(63&r>>8-s%1*8)){if((i=t.charCodeAt(s+=3/4))>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");r=r<<8|i}return n}(ps(e,0).toString())}var ks=/^control_/;var Cs,ws,Ns=function(){function e(e,t){var n=t.getEventSource,r=t.getOptions;if(this.settings=e,this.eventSource=n&&n(e),!this.eventSource)throw new Error("EventSource API is not available.");this.headers=function(e){var t={SplitSDKClientKey:l(e.core.authorizationKey)?e.core.authorizationKey.slice(-4):"",SplitSDKVersion:e.version},n=e.runtime,r=n.ip,i=n.hostname;return r&&(t.SplitSDKMachineIP=r),i&&(t.SplitSDKMachineName=i),t}(e),this.options=r&&r(e)}return e.prototype.setEventHandler=function(e){this.handler=e},e.prototype.open=function(e){var t;this.close();var n=Object.keys(e.channels).map((function(e){var t=ks.test(e)?"[?occupancy=metrics.publishers]":"";return encodeURIComponent(t+e)})).join(","),r=this.settings.urls.streaming+"/sse?channels="+n+"&accessToken="+e.token+"&v=1.1&heartbeats=true",i=xr(this.settings);this.connection=new this.eventSource(i?r:r+"&SplitSDKVersion="+this.headers.SplitSDKVersion+"&SplitSDKClientKey="+this.headers.SplitSDKClientKey,Vn(i?{headers:$r(this.settings,this.headers)}:(null===(t=this.settings.sync.requestOptions)||void 0===t?void 0:t.getHeaderOverrides)?{headers:$r(this.settings,{})}:{},this.options)),this.handler&&(this.connection.addEventListener("open",this.handler.handleOpen),this.connection.addEventListener("message",this.handler.handleMessage),this.connection.addEventListener("error",this.handler.handleError))},e.prototype.close=function(){this.connection&&this.connection.close()},e}();function _s(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function As(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function Is(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])}function Os(e,t){return 0===(t%=64)?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]}function Fs(e,t){return[e[0]^t[0],e[1]^t[1]]}function Ls(e){return e=Fs(e,[0,e[0]>>>1]),e=Fs(e=As(e,[4283543511,3981806797]),[0,e[0]>>>1]),e=Fs(e=As(e,[3301882366,444984403]),[0,e[0]>>>1])}function Ds(e,t){return function(e,t){t=t||0;for(var n=(e=e||"").length%16,r=e.length-n,i=[0,t],s=[0,t],o=[0,0],a=[0,0],u=[2277735313,289559509],c=[1291169091,658871167],l=0;l<r;l+=16)o=[255&e.charCodeAt(l+4)|(255&e.charCodeAt(l+5))<<8|(255&e.charCodeAt(l+6))<<16|(255&e.charCodeAt(l+7))<<24,255&e.charCodeAt(l)|(255&e.charCodeAt(l+1))<<8|(255&e.charCodeAt(l+2))<<16|(255&e.charCodeAt(l+3))<<24],a=[255&e.charCodeAt(l+12)|(255&e.charCodeAt(l+13))<<8|(255&e.charCodeAt(l+14))<<16|(255&e.charCodeAt(l+15))<<24,255&e.charCodeAt(l+8)|(255&e.charCodeAt(l+9))<<8|(255&e.charCodeAt(l+10))<<16|(255&e.charCodeAt(l+11))<<24],o=Is(o=As(o,u),31),i=_s(i=Is(i=Fs(i,o=As(o,c)),27),s),i=_s(As(i,[0,5]),[0,1390208809]),a=Is(a=As(a,c),33),s=_s(s=Is(s=Fs(s,a=As(a,u)),31),i),s=_s(As(s,[0,5]),[0,944331445]);switch(o=[0,0],a=[0,0],n){case 15:a=Fs(a,Os([0,e.charCodeAt(l+14)],48));case 14:a=Fs(a,Os([0,e.charCodeAt(l+13)],40));case 13:a=Fs(a,Os([0,e.charCodeAt(l+12)],32));case 12:a=Fs(a,Os([0,e.charCodeAt(l+11)],24));case 11:a=Fs(a,Os([0,e.charCodeAt(l+10)],16));case 10:a=Fs(a,Os([0,e.charCodeAt(l+9)],8));case 9:a=As(a=Fs(a,[0,e.charCodeAt(l+8)]),c),s=Fs(s,a=As(a=Is(a,33),u));case 8:o=Fs(o,Os([0,e.charCodeAt(l+7)],56));case 7:o=Fs(o,Os([0,e.charCodeAt(l+6)],48));case 6:o=Fs(o,Os([0,e.charCodeAt(l+5)],40));case 5:o=Fs(o,Os([0,e.charCodeAt(l+4)],32));case 4:o=Fs(o,Os([0,e.charCodeAt(l+3)],24));case 3:o=Fs(o,Os([0,e.charCodeAt(l+2)],16));case 2:o=Fs(o,Os([0,e.charCodeAt(l+1)],8));case 1:o=As(o=Fs(o,[0,e.charCodeAt(l)]),u),i=Fs(i,o=As(o=Is(o,31),c))}return i=_s(i=Fs(i,[0,e.length]),s=Fs(s,[0,e.length])),s=_s(s,i),i=_s(i=Ls(i),s=Ls(s)),s=_s(s,i),("00000000"+(i[0]>>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)}(cs(e),t>>>0)}function Ms(e){var t,n,r,i=[0];for(t=0;t<e.length;t+=1){for(r=parseInt(e.charAt(t),16),n=i.length-1;n>=0;n-=1)i[n]=16*i[n]+r,r=i[n]/10|0,i[n]%=10;for(;r>0;)i.unshift(r%10),r=r/10|0}return i.join("")}function Ks(e,t){var n,r=e.settings,s=e.storage,o=e.splitApi,a=e.readiness,u=e.platform,c=e.telemetryTracker,l=xr(r)?void 0:Mr(r.core.key),f=r.log;try{n=new Ns(r,u)}catch(e){return void f.warn(It,[e])}var h=Ts(o.fetchAuth),p=new u.EventEmitter,g=Xi(f,p,c);n.setEventHandler(g);var d,m,v,y,S=l?void 0:is(f,t.segmentsSyncTask,s.segments),b=Es(f,s,t.splitsSyncTask,a.splits,c,l?void 0:t.segmentsSyncTask),E={},T={},R=!1,k=new Yi(C,r.scheduler.pushRetryBackoffBase);function C(){if(!d){f.info(ct),d=!1;var e=l?Object.keys(T):void 0;h(e).then((function(t){if(!d)return t.pushEnabled?void(e&&e.length<Object.keys(T).length||function(e){v&&clearTimeout(v),y&&clearTimeout(y);var t=e.decodedToken,r=t.exp-t.iat-Mi,i="number"==typeof e.connDelay&&e.connDelay>=0?e.connDelay:60;f.info(at,[r,i]),v=setTimeout(C,1e3*r),y=setTimeout((function(){d||n.open(e)}),1e3*i),c.streamingEvent(de,t.exp)}(t)):(f.info(lt),void p.emit(Ki))})).catch((function(e){if(!d){if(f.error(rn,[e.message]),e.statusCode>=400&&e.statusCode<500)return c.streamingEvent(ye),void p.emit(Ki);p.emit(xi)}}))}}function w(){d||(d=!0,n.close(),f.info(ft),v&&clearTimeout(v),y&&clearTimeout(y),k.reset(),N())}function N(){b.stop(),l?i(T,(function(e){return e.worker.stop()})):S.stop()}function _(e){switch(e.u){case ws.BoundedFetchRequest:var t;try{o=e.d,a=e.c,t=vs(o,a)}catch(e){f.warn(Gt,["BoundedFetchRequest",e]);break}return void i(T,(function(n,r){var i,s,o,a,u=n.hash64,c=n.worker;i=t,s=u.hex,o=parseInt(s.slice(8),16)%(8*i.length),a=o%8,(i[Math.floor(o/8)]&1<<a)>0&&c.put(e,void 0,bs(e,r))}));case ws.KeyList:var n,r,s=void 0;try{s=ys(e.d,e.c),n=new Set(s.a),r=new Set(s.r)}catch(e){f.warn(Gt,["KeyList",e]);break}if(!e.n||!e.n.length){f.warn(Gt,["KeyList","No segment name was provided"]);break}return void i(T,(function(t){var i=t.hash64,s=t.worker,o=!!n.has(i.dec)||!r.has(i.dec)&&void 0;void 0!==o&&s.put(e,{added:o?[e.n[0]]:[],removed:o?[]:[e.n[0]]})}));case ws.SegmentRemoval:if(!e.n||!e.n.length){f.warn(Gt,["SegmentRemoval","No segment name was provided"]);break}return void i(T,(function(t){t.worker.put(e,{added:[],removed:e.n})}))}var o,a;i(T,(function(t,n){t.worker.put(e,void 0,bs(e,n))}))}return p.on(Ui,N),p.on(Pi,(function(){k.reset()})),p.on(Ki,(function(){m=!0,w(),p.emit(Ui)})),p.on(xi,(function(){n.close();var e=k.scheduleCall();f.info(ut,[e/1e3]),p.emit(Ui)})),p.on(Di.STREAMING_RESET,(function(){d||(v&&clearTimeout(v),C())})),p.on(zi,b.killSplit),p.on(Wi,b.put),p.on(Gi,b.put),l?(p.on(Bi,_),p.on(ji,_)):p.on(qi,S.put),Vn(Object.create(p),{stop:function(){w(),l&&this.remove(l)},start:function(){m||!1===d||(d=!1,l?this.add(l,t.segmentsSyncTask):setTimeout(C))},isRunning:function(){return!1===d},add:function(e,t){var n,r,i=Rs(e);E[i]||(E[i]=e,T[e]={hash64:(n=e,r=Ds(n).slice(0,16),{hex:r,dec:Ms(r)}),worker:rs(f,s,t,c)},R=!0,this.isRunning()&&setTimeout((function(){R&&(R=!1,C())}),0))},remove:function(e){var t=Rs(e);delete E[t],delete T[e]}})}function xs(e,t,n,r,i,s,o){var a=n.segments,u=n.largeSegments,c=!0,l=!0;function f(e){return l&&(e=Zr(i,e)),e}function h(e){var t;void 0!==e.type?t=e.type===ji?u.resetSegments(e):a.resetSegments(e):(t=a.resetSegments(e.ms||{}),t=u.resetSegments(e.ls||{})||t),n.save&&n.save(),wr(n)&&(t||c)&&(c=!1,r.emit(di))}function p(n,r,i,a){var u=r?new Promise((function(e){h(r),e(!0)})):t(o,i,a,f).then((function(e){return l=!1,h(e),!0}));return u.catch((function(t){return l&&s>n?(n+=1,e.warn(wt,[n,t]),p(n)):(l=!1,!1)}))}return function(e,t,n){return p(0,e,t,n)}}!function(e){e[e.None=0]="None",e[e.Gzip=1]="Gzip",e[e.Zlib=2]="Zlib"}(Cs||(Cs={})),function(e){e[e.UnboundedFetchRequest=0]="UnboundedFetchRequest",e[e.BoundedFetchRequest=1]="BoundedFetchRequest",e[e.KeyList=2]="KeyList",e[e.SegmentRemoval=3]="SegmentRemoval"}(ws||(ws={}));var Ps=36e5,Us=24*Ps;function Bs(e,t,n){var r,i=t.log,s=xr(t)?Us:Ps;return function o(a,u,c,l,f){r&&Date.now()-r>s&&(t.sync.flagSpecVersion=Ce);var h=e(a,u,c,t.sync.flagSpecVersion===Ce?l:void 0).catch((function(n){if((!n.statusCode||400===n.statusCode)&&function(e){return e.urls.sdk!==lr.urls.sdk}(t)&&t.sync.flagSpecVersion===Ce)return i.error(xn+"Proxy error detected. Retrying with spec 1.2. If you are using Split Proxy, please upgrade to latest version"),r=Date.now(),t.sync.flagSpecVersion="1.2",e(a,u,c);throw n}));return f&&(h=f(h)),h.then((function(e){return e.json()})).then((function(e){return e.splits?{ff:{d:e.splits,s:e.since,t:e.till}}:r?(i.info(xn+"Proxy error recovered"),r=void 0,o(-1,void 0,void 0,-1).then((function(e){return Promise.all([n.splits.clear(),n.rbSegments.clear()]).then((function(){return e}))}))):e}))}}function js(e,t){void 0===t&&(t=we);var n=e,r=n.conditions,i=void 0===r?[]:r,s=n.excluded,o=new Set;s&&s.segments&&s.segments.forEach((function(e){var n=e.type,r=e.name;(n===_e&&t===we||n===Ae&&t===Ne)&&o.add(r)}));for(var a=0;a<i.length;a++){i[a].matcherGroup.matchers.forEach((function(e){e.matcherType===t&&o.add(e.userDefinedSegmentMatcherData.segmentName)}))}return o}function qs(e,t,n){return e.reduce((function(e,r){return"ACTIVE"!==r.status||n&&!function(e,t){var n=t.groupedFilters,r=n.bySet,i=n.byName,s=n.byPrefix;if(r.length>0)return e.sets&&e.sets.some((function(e){return r.indexOf(e)>-1}));var o=i.length>0,a=s.length>0;if(!o&&!a)return!0;var u=o&&i.indexOf(e.name)>-1,c=a&&s.some((function(t){return p(e.name,t)}));return u||c}(r,n)?e.removed.push(r):(e.added.push(r),js(r).forEach((function(e){t.add(e)}))),e}),{added:[],removed:[]})}function zs(e,t,n,r,i,s,o,a){void 0===s&&(s=0),void 0===o&&(o=0);var u=n.splits,c=n.rbSegments,l=n.segments,f=!0;function h(e){return f&&s&&(e=Zr(s,e)),e}return function(s,p,g){return Promise.all([u.getChangeNumber(),c.getChangeNumber()]).then((function d(m,v){void 0===v&&(v=0);var y=m[0],S=m[1];return e.debug(je,m),Promise.resolve(g?g.type===Wi?Promise.resolve(c.contains(js(g.payload,Ne))).then((function(e){return e?{ff:{d:[g.payload],t:g.changeNumber}}:t(y,s,p,S,h)})):{rbs:{d:[g.payload],t:g.changeNumber}}:t(y,s,p,S,h)).then((function(t){f=!1;var s=new Set,o=!1;if(t.ff){var h=qs(t.ff.d,s,r),p=h.added,g=h.removed;e.debug(qe,[p.length,g.length]),o=u.update(p,g,t.ff.t)}var d=!1;if(t.rbs){var m=qs(t.rbs.d,s);p=m.added,g=m.removed;e.debug(ze,[p.length,g.length]),d=c.update(p,g,t.rbs.t)}return Promise.all([o,d,l.registerSegments(qr(s))]).then((function(e){var t=e[0],r=e[1];return n.save&&n.save(),!i||Promise.resolve(!i.splitsArrived||(t||r)&&(a||function(e){return Promise.resolve(e.getRegisteredSegments()).then((function(t){return Promise.all(t.map((function(t){return e.getChangeNumber(t)}))).then((function(e){return e.every((function(e){return void 0!==e}))}))}))}(l))).catch((function(){return!1})).then((function(e){return e&&i.emit(pi),!0}))}))})).catch((function(t){return e.warn(Nt,[t]),f&&o>v?(v+=1,e.info(ot,[v,t]),d(m,v)):(f=!1,!1)}))}))}}function Ws(e){var t=e.splitApi,n=e.storage,r=e.readiness,s=e.settings,o=s.log,a=function(e,t,n,r,i){return ii(r.log,zs(r.log,Bs(e,r,t),t,r.sync.__splitFiltersValidation,n.splits,r.startup.requestTimeoutBeforeReady,r.startup.retriesOnFailureBeforeReady,i),r.scheduler.featuresRefreshRate,"splitChangesUpdater")}(t.fetchSplitChanges,n,r,s,!0),u={},c=h(Mr(s.core.key),r,n);function l(){i(u,(function(e){e.start()}))}function f(){i(u,(function(e){e.isRunning()&&e.stop()}))}function h(e,n,r){var i=function(e,t,n,r,i){return ii(r.log,xs(r.log,function(e){return function(t,n,r,i){var s=e(t,n,r);return i&&(s=i(s)),s.then((function(e){return e.json()}))}}(e),t,n.segments,r.startup.requestTimeoutBeforeReady,r.startup.retriesOnFailureBeforeReady,i),r.scheduler.segmentsRefreshRate,"mySegmentsUpdater")}(t.fetchMemberships,r,n,s,e);function o(){n.isReady()||wr(r)||n.segments.emit(di)}return wr(r)?n.splits.once(pi,o):setTimeout(o,0),u[e]=i,i}return r.splits.on(pi,(function(){if(a.isRunning()){var e=wr(n);e!==c.isRunning()&&(o.info(rt,[e?"ON":"OFF"]),e?l():f())}})),{splitsSyncTask:a,segmentsSyncTask:c,start:function(){o.info(it),a.start(),wr(n)&&l()},stop:function(){o.info(st),a.isRunning()&&a.stop(),f()},isRunning:a.isRunning,syncAll:function(){var e=[a.execute()];return i(u,(function(t){e.push(t.execute())})),Promise.all(e)},add:h,remove:function(e){delete u[e]},get:function(e){return u[e]}}}function Gs(e){return null!=e&&"function"==typeof e.then}function Hs(e,t,n){return null==t||c(t)?t:(e.error(cn,[n,"attributes"]),!1)}function Qs(e,t,n){if(!Hs(e,t,n))return!1;var r=!0;return Object.keys(t).forEach((function(i){(function(e,t,n,r){if(!l(t)||0===t.length)return e.warn(r+": you passed an invalid attribute name, attribute name must be a non-empty string."),!1;var i=l(n),s=a(n),u=o(n),c=Array.isArray(n);return!!(i||s||u||c)||(e.warn(r+": you passed an invalid attribute value for "+t+". Acceptable types are: string, number, boolean and array of strings."),!1)})(e,i,t[i],n)||(r=!1)})),r}var Vs=/^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/,Js="event_type";var Ys={NULL:0,STRING:2,BOOLEAN:4,NUMBER:8},$s=300,Zs=32768,Xs=1024;function eo(e,t,n){if(null==t)return{properties:null,size:Xs};if(!c(t))return e.error(cn,[n,"properties"]),{properties:!1,size:Xs};var r=Object.keys(t),i=Vn({},t),s={properties:i,size:Xs};r.length>$s&&e.warn(Dt,[n]);for(var u=0;u<r.length;u++){s.size+=r[u].length*Ys.STRING;var f=i[r[u]],h=l(f),p=a(f),g=o(f),d=null===f;if(h||p||g||d||(i[r[u]]=null,f=null,d=!0,e.warn(Lt,[n,r[u]])),d?s.size+=Ys.NULL:p?s.size+=Ys.NUMBER:g?s.size+=Ys.BOOLEAN:h&&(s.size+=f.length*Ys.STRING),s.size>Zs){e.error(ln,[n]),s.properties=!1;break}}return s}var to=/[A-Z]/,no="traffic_type";function ro(e,t,n){return!t.isDestroyed()||(e.error(hn,[n]),!1)}function io(e,t,n,r){return!!t.isReadyFromCache()||(e.warn(Ct,[n,r?" for feature flag "+r.toString():""]),!1)}function so(e,t,n,r){return ro(e,t,n)&&io(e,t,n,r)}var oo="fallback - ",ao=function(){function e(e){void 0===e&&(e={}),this.fallbacks=e}return e.prototype.resolve=function(e,t){var n,r=null===(n=this.fallbacks.byFlag)||void 0===n?void 0:n[e];return r?this.copyWithLabel(r,t):this.fallbacks.global?this.copyWithLabel(this.fallbacks.global,t):{treatment:v,config:null,label:t}},e.prototype.copyWithLabel=function(e,t){return l(e)?{treatment:e,config:null,label:""+oo+t}:{treatment:e.treatment,config:e.config,label:""+oo+t}},e}(),uo="killed",co="default rule",lo="definition not found",fo="not ready",ho="exception",po="archived",go="not in split",mo="targeting rule type unsupported by sdk",vo="prerequisites not met",yo=oo+lo;function So(e,t,n,r,i){return!t.isReady()||r!==lo&&r!==yo&&null!=r||(e.warn(xt,[i,n]),!1)}function bo(e,t,n){e.warn(Ut,[n,t])}function Eo(e){var t=e.conditions,r=n(t,(function(e){return"ROLLOUT"===e.conditionType}));return r||(r=t[0]),r?r.partitions.map((function(e){return e.treatment})):[]}function To(e){return e?{name:e.name,trafficType:e.trafficTypeName,killed:e.killed,changeNumber:e.changeNumber||0,treatments:Eo(e),configs:e.configurations||{},sets:e.sets||[],defaultTreatment:e.defaultTreatment,impressionsDisabled:!0===e.impressionsDisabled,prerequisites:(e.prerequisites||[]).map((function(e){return{flagName:e.n,treatments:e.ts}}))}:null}function Ro(e){var t=[];return e.forEach((function(e){var n=To(e);n&&t.push(n)})),t}function ko(e,t,n){var r=n.readinessManager,i=n.sdkStatus,s=e.log,o=Ie(e.mode);return Vn(Object.create(i),{split:function(e){var n=Hn(s,e,z);if(!so(s,r,z)||!n)return o?Promise.resolve(null):null;var i=t.getSplit(n);return Gs(i)?i.catch((function(){return null})).then((function(e){return So(s,r,n,e,z),To(e)})):(So(s,r,n,i,z),To(i))},splits:function(){if(!so(s,r,W))return o?Promise.resolve([]):[];var e=t.getAll();return Gs(e)?e.catch((function(){return[]})).then(Ro):Ro(e)},names:function(){if(!so(s,r,G))return o?Promise.resolve([]):[];var e=t.getSplitNames();return Gs(e)?e.catch((function(){return[]})):e}})}var Co=function(){function e(){this.attributesCache={}}return e.prototype.setAttribute=function(e,t){return this.attributesCache[e]=t,!0},e.prototype.getAttribute=function(e){return this.attributesCache[e]},e.prototype.setAttributes=function(e){return this.attributesCache=Vn(this.attributesCache,e),!0},e.prototype.getAll=function(){return this.attributesCache},e.prototype.removeAttribute=function(e){return Object.keys(this.attributesCache).indexOf(e)>=0&&(delete this.attributesCache[e],!0)},e.prototype.clear=function(){return this.attributesCache={},!0},e}();function wo(e,t,n){var r=function(e,t){var n=new Co,r=t.getTreatment,i=t.getTreatmentWithConfig,s=t.getTreatments,o=t.getTreatmentsWithConfig,a=t.getTreatmentsByFlagSets,u=t.getTreatmentsWithConfigByFlagSets,c=t.getTreatmentsByFlagSet,l=t.getTreatmentsWithConfigByFlagSet;function f(e){var t=n.getAll();return Object.keys(t).length>0?Vn({},t,e):e}return Vn(t,{getTreatment:function(e,t,n,i){return r(e,t,f(n),i)},getTreatmentWithConfig:function(e,t,n,r){return i(e,t,f(n),r)},getTreatments:function(e,t,n,r){return s(e,t,f(n),r)},getTreatmentsWithConfig:function(e,t,n,r){return o(e,t,f(n),r)},getTreatmentsByFlagSets:function(e,t,n,r){return a(e,t,f(n),r)},getTreatmentsWithConfigByFlagSets:function(e,t,n,r){return u(e,t,f(n),r)},getTreatmentsByFlagSet:function(e,t,n,r){return c(e,t,f(n),r)},getTreatmentsWithConfigByFlagSet:function(e,t,n,r){return l(e,t,f(n),r)},setAttribute:function(t,r){var i={};return i[t]=r,!!Qs(e,i,"setAttribute")&&(e.debug("stored "+r+" for attribute "+t),n.setAttribute(t,r))},getAttribute:function(t){return e.debug("retrieved attribute "+t),n.getAttribute(t+"")},setAttributes:function(t){return!!Qs(e,t,"setAttributes")&&n.setAttributes(t)},getAttributes:function(){return n.getAll()},removeAttribute:function(t){return e.debug("removed attribute "+t),n.removeAttribute(t+"")},clearAttributes:function(){return n.clear()}})}(e,t);return Vn(r,{getTreatment:r.getTreatment.bind(r,n),getTreatmentWithConfig:r.getTreatmentWithConfig.bind(r,n),getTreatments:r.getTreatments.bind(r,n),getTreatmentsWithConfig:r.getTreatmentsWithConfig.bind(r,n),getTreatmentsByFlagSets:r.getTreatmentsByFlagSets.bind(r,n),getTreatmentsWithConfigByFlagSets:r.getTreatmentsWithConfigByFlagSets.bind(r,n),getTreatmentsByFlagSet:r.getTreatmentsByFlagSet.bind(r,n),getTreatmentsWithConfigByFlagSet:r.getTreatmentsWithConfigByFlagSet.bind(r,n),track:r.track.bind(r,n),isClientSide:!0,key:n})}var No={UNDEFINED:0,ALL_KEYS:1,IN_SEGMENT:2,WHITELIST:3,EQUAL_TO:4,GREATER_THAN_OR_EQUAL_TO:5,LESS_THAN_OR_EQUAL_TO:6,BETWEEN:7,EQUAL_TO_SET:8,CONTAINS_ANY_OF_SET:9,CONTAINS_ALL_OF_SET:10,PART_OF_SET:11,ENDS_WITH:12,STARTS_WITH:13,CONTAINS_STRING:14,IN_SPLIT_TREATMENT:15,EQUAL_TO_BOOLEAN:16,MATCHES_STRING:17,EQUAL_TO_SEMVER:18,GREATER_THAN_OR_EQUAL_TO_SEMVER:19,LESS_THAN_OR_EQUAL_TO_SEMVER:20,BETWEEN_SEMVER:21,IN_LIST_SEMVER:22,IN_LARGE_SEGMENT:23,IN_RULE_BASED_SEGMENT:24},_o={BOOLEAN:"BOOLEAN",STRING:"STRING",NUMBER:"NUMBER",SET:"SET",DATETIME:"DATETIME",NOT_SPECIFIED:"NOT_SPECIFIED"};function Ao(e){return e?e.segmentName||e.largeSegmentName:void 0}function Io(e){return e&&e.whitelist}function Oo(e){return e.value}function Fo(e){return new Date(e).setUTCHours(0,0,0,0)}function Lo(e){return new Date(e).setUTCSeconds(0,0)}function Do(e){var t=e.map((function(e){var t,n=e.matcherType,r=e.negate,i=e.keySelector,s=e.userDefinedSegmentMatcherData,o=e.userDefinedLargeSegmentMatcherData,a=e.whitelistMatcherData,u=e.unaryNumericMatcherData,c=e.betweenMatcherData,l=e.dependencyMatcherData,f=e.booleanMatcherData,h=e.stringMatcherData,p=e.betweenStringMatcherData,g=i&&i.attribute,d=function(e){var t=No[e];return t||No.UNDEFINED}(n),m=_o.STRING;return d===No.IN_SEGMENT?t=Ao(s):d===No.IN_LARGE_SEGMENT?t=Ao(o):d===No.EQUAL_TO?(t=Oo(u),m=_o.NUMBER,"DATETIME"===u.dataType&&(t=Fo(t),m=_o.DATETIME)):d===No.GREATER_THAN_OR_EQUAL_TO||d===No.LESS_THAN_OR_EQUAL_TO?(t=Oo(u),m=_o.NUMBER,"DATETIME"===u.dataType&&(t=Lo(t),m=_o.DATETIME)):d===No.BETWEEN?(t=c,m=_o.NUMBER,"DATETIME"===t.dataType&&(t=function(e){return{dataType:e.dataType,start:Lo(e.start),end:Lo(e.end)}}(t),m=_o.DATETIME)):d===No.BETWEEN_SEMVER?t=p:d===No.EQUAL_TO_SET||d===No.CONTAINS_ANY_OF_SET||d===No.CONTAINS_ALL_OF_SET||d===No.PART_OF_SET?(t=Io(a),m=_o.SET):d===No.WHITELIST||d===No.IN_LIST_SEMVER||d===No.STARTS_WITH||d===No.ENDS_WITH||d===No.CONTAINS_STRING?t=Io(a):d===No.IN_SPLIT_TREATMENT?(t=l,m=_o.NOT_SPECIFIED):d===No.EQUAL_TO_BOOLEAN?(m=_o.BOOLEAN,t=f):d===No.MATCHES_STRING||d===No.EQUAL_TO_SEMVER||d===No.GREATER_THAN_OR_EQUAL_TO_SEMVER||d===No.LESS_THAN_OR_EQUAL_TO_SEMVER?t=h:d===No.IN_RULE_BASED_SEGMENT&&(t=Ao(s),m=_o.NOT_SPECIFIED),{attribute:g,negate:r,type:d,name:n,value:t,dataType:m}}));return-1===r(t,(function(e){return e.type===No.UNDEFINED}))?t:[]}var Mo=function(){function e(e,t){if(100!==e[e.length-1])throw new RangeError("Provided invalid dataset as input");this._ranges=e,this._treatments=t}return e.parse=function(t){var n=t.reduce((function(e,t){var n=t.size,r=t.treatment;return e.ranges.push(e.inc+=n),e.treatments.push(r),e}),{inc:0,ranges:[],treatments:[]});return new e(n.ranges,n.treatments)},e.prototype.getTreatmentFor=function(e){if(e<0||e>100)throw new RangeError("Please provide a value between 0 and 100");var t=r(this._ranges,(function(t){return e<=t}));return this._treatments[t]},e}();var Ko=/^[0-9]+$/,xo=".";function Po(e,t){if(Ko.test(e)&&Ko.test(t)){var n=e.length-t.length;if(0!==n)return n}return e<t?-1:e>t?1:0}function Uo(e){return e.replace(/^0+(?=\d)/,"")}function Bo(e){throw new Error("Unable to convert to Semver, incorrect format: "+e)}var jo=function(){function e(e){l(e)||Bo(e);var t=e.indexOf("+"),n=-1===t?[e]:[e.slice(0,t),e.slice(t+1)],r=n[0],i=n[1];""===i&&Bo(e),-1===(t=r.indexOf("-"))?(this._isStable=!0,this._preRelease=[]):(this._isStable=!1,this._preRelease=r.slice(t+1).split(xo).map((function(t){return t||Bo(e),Ko.test(t)?Uo(t):t})),r=r.slice(0,t));var s=r.split(xo).map((function(t){return t&&Ko.test(t)||Bo(e),Uo(t)}));3!==s.length&&Bo(e),this._major=s[0],this._minor=s[1],this._patch=s[2],this.version=s.join(xo),this._preRelease.length&&(this.version+="-"+this._preRelease.join(xo)),i&&(this.version+="+"+i)}return e.prototype.compare=function(e){if(this.version===e.version)return 0;var t=Po(this._major,e._major);if(0!==t)return t;if(0!==(t=Po(this._minor,e._minor)))return t;if(0!==(t=Po(this._patch,e._patch)))return t;if(!this._isStable&&e._isStable)return-1;if(this._isStable&&!e._isStable)return 1;for(var n=0,r=Math.min(this._preRelease.length,e._preRelease.length);n<r;n++){var i=Po(this._preRelease[n],e._preRelease[n]);if(0!==i)return i}return this._preRelease.length-e._preRelease.length},e}();var qo=[void 0,function(){return function(e){return null!=e}},function(e,t){return function(n){return t.segments.isInSegment(e,n)}},function(e){var t=new Set(e);return function(e){return t.has(e)}},function(e){return function(t){return t===e}},function(e){return function(t){return t>=e}},function(e){return function(t){return t<=e}},function(e){return function(t){return t>=e.start&&t<=e.end}},function(e){return function(t){for(var n=t.length===e.length,i=function(i){r(e,(function(e){return e===t[i]}))<0&&(n=!1)},s=0;s<t.length&&n;s++)i(s);return n}},function(e){return function(t){for(var n=!1,i=function(i){r(t,(function(t){return t===e[i]}))>=0&&(n=!0)},s=0;s<e.length&&!n;s++)i(s);return n}},function(e){return function(t){var n=!0;if(t.length<e.length)n=!1;else for(var i=function(i){r(t,(function(t){return t===e[i]}))<0&&(n=!1)},s=0;s<e.length&&n;s++)i(s);return n}},function(e){return function(t){for(var n=t.length<=e.length,i=function(i){r(e,(function(e){return e===t[i]}))<0&&(n=!1)},s=0;s<t.length&&n;s++)i(s);return n}},function(e){return function(t){return e.some((function(e){return r=e,void 0===i&&(i=!1),!(!l(n=t)||!l(r))&&(i&&(n=n.toLowerCase(),r=r.toLowerCase()),n.slice(n.length-r.length)===r);var n,r,i}))}},function(e){return function(t){return e.some((function(e){return p(t,e)}))}},function(e){return function(t){return e.some((function(e){return l(t)&&t.indexOf(e)>-1}))}},function(e,t,n){var r=e.split,i=e.treatments;function s(e,t,r){var i=!1;return Array.isArray(t)&&(i=-1!==t.indexOf(e.treatment)),n.debug(10,[r,e.treatment,e.label,r,t,i]),i}return function(e,o){var a=e.key,u=e.attributes;n.debug(11,[r,JSON.stringify(a),u?"\n attributes: "+JSON.stringify(u):""]);var c=o(n,a,r,u,t);return Gs(c)?c.then((function(e){return s(e,i,r)})):s(c,i,r)}},function(e){return function(t){return e===t}},function(e){var t=new RegExp(e);return function(e){return t.test(e)}},function(e){var t=new jo(e);return function(e){var n=new jo(e);return t.version===n.version}},function(e){var t=new jo(e);return function(e){return new jo(e).compare(t)>=0}},function(e){var t=new jo(e);return function(e){return new jo(e).compare(t)<=0}},function(e){var t=new jo(e.start),n=new jo(e.end);return function(e){var r=new jo(e);return t.compare(r)<=0&&n.compare(r)>=0}},function(e){if(!e||0===e.length)throw new Error("whitelistMatcherData is required for IN_LIST_SEMVER matcher type");var t=new Set(e.map((function(e){return new jo(e).version})));return function(e){var n=new jo(e).version;return t.has(n)}},function(e,t){return function(n){return!!t.largeSegments&&t.largeSegments.isInSegment(e,n)}},function e(t,n,r){return function(i,s){var o=i.key,a=i.attributes,u=Mr(o);function c(e){var t=e.conditions||[];if(!t.length)return!1;var i=$o(r,t,n)(Kr(o),void 0,void 0,void 0,a,s);return Gs(i)?i.then((function(e){return!!e})):!!i}function l(t){var i=t.type,c=t.name;return i===_e?n.segments.isInSegment(c,u):i===Ae?e(c,n,r)({key:o,attributes:a},s):!("large"!==i||!n.largeSegments)&&n.largeSegments.isInSegment(c,u)}function f(e){if(!e)return!1;var t=function(e){var t=e.excluded||{};return!(!t.keys||-1===t.keys.indexOf(u))||(t.segments||[]).reduce((function(e,t){return Gs(e)?e.then((function(e){return e||l(t)})):e||l(t)}),!1)}(e);return Gs(t)?t.then((function(t){return!t&&c(e)})):!t&&c(e)}var h=n.rbSegments.get(t);return Gs(h)?h.then(f):f(h)}}];function zo(e,t,n){var r,i=t.type,s=t.value;return qo[i]&&(r=qo[i](s,n,e)),r}function Wo(e,t){return{key:e,attributes:t}}function Go(e,t,n,r,i){var s,o,a=function(e,t){switch(e){case No.EQUAL_TO:return"DATETIME"===t?Fo:void 0;case No.GREATER_THAN_OR_EQUAL_TO:case No.LESS_THAN_OR_EQUAL_TO:case No.BETWEEN:return"DATETIME"===t?Lo:void 0;case No.IN_SPLIT_TREATMENT:case No.IN_RULE_BASED_SEGMENT:return Wo;default:return}}(t,r);switch(r){case _o.NUMBER:case _o.DATETIME:o=g(n),s=isNaN(o)?void 0:o;break;case _o.STRING:s=function(e){var t=e;return c(e)&&(t=e.matchingKey?e.matchingKey:void 0),d(t)||void 0}(n);break;case _o.SET:s=function(e){var t=Array.isArray(e)?m(e.map((function(e){return e+""}))):[];return t.length?t:void 0}(n);break;case _o.BOOLEAN:s=function(e){if(!0===e||!1===e)return e;if("string"==typeof e){var t=e.toLocaleLowerCase();if("true"===t)return!0;if("false"===t)return!1}}(n);break;case _o.NOT_SPECIFIED:s=n;break;default:s=void 0}return a&&(s=a(s,i)),e.debug(Ke,[n,r,s instanceof Object?JSON.stringify(s):s]),s}function Ho(e,t,n,r){var i=n.attribute,s=function(e,t,n,r){var i=void 0;return n?r?(i=r[n],e.debug(Me,[n,i])):e.warn(Rt,[n]):i=t,i}(e,t,i,r),o=Go(e,n.type,s,n.dataType,r);return void 0!==o?o:void e.warn(Tt,[s+(i?" for attribute "+i:"")])}function Qo(e,t,n,r){var i=gs(t,n),s=r.getTreatmentFor(i);return e.debug(De,[i,t,n,s]),s}function Vo(e,t,n,r,i,s){if(t)return!i||{treatment:Qo(e,n,r,i),label:s}}function Jo(e,t,n,r,i){return function(s,o,a,u,c,l){if("ROLLOUT"===i&&!function(e,t,n){return!(e<100&&gs(t,n)>e)}(a,s.bucketingKey,u))return{treatment:void 0,label:go};var f=t(s,c,l);return Gs(f)?f.then((function(t){return Vo(e,t,s.bucketingKey,o,n,r)})):Vo(e,f,s.bucketingKey,o,n,r)}}function Yo(e,t){function n(t){var n=t.every((function(e){return e}));return e.debug(Oe,[n]),n}return function(e,i,s){var o=t.map((function(t){return t(e,i,s)}));return-1!==r(o,Gs)?Promise.all(o).then(n):n(o)}}function $o(e,t,n){for(var i=[],s=0;s<t.length;s++){var a=t[s],u=a.matcherGroup,c=a.partitions,l=a.label,f=a.conditionType,h=Do(u.matchers).map((function(t){var r;try{r=zo(e,t,n)}catch(n){e.error(Cn,[t.name,n])}return function(n,i,s){var o=Ho(e,n,t,i),a=!1;if(void 0!==o&&r)try{a=r(o,s)}catch(n){e.error(Cn,[t.name,n])}function u(n){return e.debug(Je,[t.name,n,t.value,o]),Boolean(n^t.negate)}return Gs(a)?a.then(u):u(a)}}));if(0===h.length){i=[];break}i.push(Jo(e,Yo(e,h),c&&Mo.parse(c),l,f))}return function(e,t){function n(t){for(var n=0,r=t.length;n<r;n++){var i=t[n];if(void 0!==i)return o(i)||e.debug(Fe,[i.treatment]),i}e.debug(Le)}return Array.isArray(t)&&0!==t.length?function(e,i,s,o,a,u){var c=t.map((function(t){return t(e,i,s,o,a,u)}));return-1!==r(c,Gs)?Promise.all(c).then((function(e){return n(e)})):n(c)}:function(){return e.error($t),{treatment:v,label:mo}}}(e,i)}function Zo(e,t){return{treatment:s(e,"treatment",t),label:s(e,"label",co)}}function Xo(e,t,n){var r=t.killed,i=t.seed,s=t.trafficAllocation,o=t.trafficAllocationSeed,a=t.status,u=t.conditions,c=t.prerequisites,f=l(t.defaultTreatment)?t.defaultTreatment:v,h=$o(e,u,n),p=function(e,t,n){return void 0===e&&(e=[]),function(r,i){var s=r.key,o=r.attributes;function a(e){var r=i(n,s,e.n,o,t);return Gs(r)?r.then((function(t){return-1!==e.ts.indexOf(t.treatment)})):-1!==e.ts.indexOf(r.treatment)}return e.reduce((function(e,t){return Gs(e)?e.then((function(e){return!!e&&a(t)})):!!e&&a(t)}),!0)}}(c,n,e);return{getTreatment:function(t,n,u){var c=Kr(t);function l(t){if(!t)return e.debug(Ye,["Prerequisite not met"]),{treatment:f,label:vo};var r=h(c,i,s,o,n,u);return Gs(r)?r.then((function(e){return Zo(e,f)})):Zo(r,f)}if("ARCHIVED"===a)return{treatment:v,label:po};if(r)return e.debug(Ye,["Flag is killed"]),{treatment:f,label:uo};var g=p({key:t,attributes:n},u);return Gs(g)?g.then(l):l(g)}}}var ea={treatment:v,label:ho,config:null};function ta(e){var t={};return e.forEach((function(e){t[e]=ea})),t}function na(e,t,n,r,i){var s;try{s=i.splits.getSplit(n)}catch(e){return ea}return Gs(s)?s.then((function(n){return ia(e,t,n,r,i)})).catch((function(){return ea})):ia(e,t,s,r,i)}function ra(e,t,n,r,i){var s;try{s=i.splits.getSplits(n)}catch(e){return ta(n)}return Gs(s)?s.then((function(s){return sa(e,t,n,s,r,i)})).catch((function(){return ta(n)})):sa(e,t,n,s,r,i)}function ia(e,t,n,r,i){var s={treatment:v,label:lo,config:null};if(n){if(Gs(s=Xo(e,n,i).getTreatment(t,r,na)))return s.then((function(e){return e.changeNumber=n.changeNumber,e.config=n.configurations&&n.configurations[e.treatment]||null,e.impressionsDisabled=n.impressionsDisabled,e}));s.changeNumber=n.changeNumber,s.config=n.configurations&&n.configurations[s.treatment]||null,s.impressionsDisabled=n.impressionsDisabled}return s}function sa(e,t,n,r,i,s){var o={},a=[];return n.forEach((function(n){var u=ia(e,t,r[n],i,s);Gs(u)?a.push(u.then((function(e){o[n]=e}))):o[n]=u})),a.length>0?Promise.all(a).then((function(){return o})):o}var oa={treatment:v,label:fo};function aa(e){var t={};return e.forEach((function(e){t[e]=oa})),t}function ua(e){if(e&&e.properties)try{return JSON.stringify(e.properties)}catch(e){}}function ca(e){var t=e.sdkReadinessManager.readinessManager,n=e.storage,r=e.settings,i=e.impressionsTracker,s=e.eventTracker,o=e.telemetryTracker,a=e.fallbackTreatmentsCalculator,u=r.log,l=r.mode,f=Ie(l);function h(e,r,s,a,c,l){void 0===c&&(c=!1),void 0===l&&(l=D);var h=o.trackEval(c?se:re),p=function(t){var n=[],o=d(t,r,e,ua(a),c,l,n);return i.track(n,s),h(n[0]&&n[0].imp.label),o},g=t.isReadyFromCache()?na(u,e,r,s,n):f?Promise.resolve(oa):oa;return Gs(g)?g.then((function(e){return p(e)})):p(g)}function p(e,r,s,a,c,l){void 0===c&&(c=!1),void 0===l&&(l=M);var h=o.trackEval(c?oe:ie),p=function(t){var n=[],r={},o=ua(a);return Object.keys(t).forEach((function(i){r[i]=d(t[i],i,e,o,c,l,n)})),i.track(n,s),h(n[0]&&n[0].imp.label),r},g=t.isReadyFromCache()?ra(u,e,r,s,n):f?Promise.resolve(aa(r)):aa(r);return Gs(g)?g.then((function(e){return p(e)})):p(g)}function g(e,r,s,a,c,l,h){void 0===c&&(c=!1),void 0===l&&(l=ue),void 0===h&&(h=U);var p=o.trackEval(l),g=function(t){var n=[],r={},o=ua(a);return Object.keys(t).forEach((function(i){r[i]=d(t[i],i,e,o,c,h,n)})),i.track(n,s),p(n[0]&&n[0].imp.label),r},m=t.isReadyFromCache()?function(e,t,n,r,i,s){var o;function a(o){for(var a,u=new Set,c=0;c<n.length;c++){var l=o[c];l.size?(a=l,u=new Set(qr(u).concat(qr(a)))):e.warn(Yt,[s,n[c]])}return u.size?ra(e,t,qr(u),r,i):{}}try{o=i.splits.getNamesByFlagSets(n)}catch(e){return{}}return Gs(o)?o.then((function(e){return a(e)})).catch((function(){return{}})):a(o)}(u,e,r,s,n,h):f?Promise.resolve({}):{};return Gs(m)?m.then((function(e){return g(e)})):g(m)}function d(e,n,r,i,s,o,l){var f=Mr(r),h=function(e){return c(e)?e.bucketingKey:void 0}(r),p=e.changeNumber,g=e.impressionsDisabled,d=e.treatment,m=e.label,y=e.config,S=void 0===y?null:y;if(d===v){var b=a.resolve(n,m);d=b.treatment,m=b.label,S=b.config}return u.info(Xe,[n,f,d,m]),So(u,t,n,m,o)&&(u.info(et),l.push({imp:{feature:n,keyName:f,treatment:d,time:Date.now(),bucketingKey:h,label:m,changeNumber:p,properties:i},disabled:g})),s?{treatment:d,config:S}:d}return{getTreatment:h,getTreatmentWithConfig:function(e,t,n,r){return h(e,t,n,r,!0,K)},getTreatments:p,getTreatmentsWithConfig:function(e,t,n,r){return p(e,t,n,r,!0,x)},getTreatmentsByFlagSets:g,getTreatmentsWithConfigByFlagSets:function(e,t,n,r){return g(e,t,n,r,!0,le,j)},getTreatmentsByFlagSet:function(e,t,n,r){return g(e,[t],n,r,!1,ae,P)},getTreatmentsWithConfigByFlagSet:function(e,t,n,r){return g(e,[t],n,r,!0,ce,B)},track:function(e,r,i,a,c,f){void 0===f&&(f=1024);var h=o.trackEval(fe),p=Mr(e),g={eventTypeId:i,trafficTypeName:r,value:a,timestamp:Date.now(),key:p,properties:c};!function(e,t,n,r,i,s){if(!t.isReady()||r===R)return!0;var o=n.trafficTypeExists(i);Gs(o)?o.then((function(t){return t||bo(e,i,s),t})):o||bo(e,i,s)}(u,t,n.splits,l,r,q);var d=s.track(g,f);return Gs(d)?d.then((function(e){return h(),e})):(h(),d)}}}function la(e,t,n,r){var i=e.log,s=Ie(e.mode);function o(t,r,s,o,a){var u=ir(i,r,t),l=t.indexOf("ByFlagSet")>-1?function(e,t,n,r){var i=Qn(e,n,t,"flag sets","flag set"),s=i?Zn(e,i,t):[];return r.length>0&&(s=s.filter((function(n){return r.indexOf(n)>-1||(e.warn(Jt,[t,n]),!1)}))),!!s.length&&s}(i,t,s,e.sync.__splitFiltersValidation.groupedFilters.bySet):p(t,M)?Qn(i,s,t):Hn(i,s,t),f=Hs(i,o,t),h=ro(i,n,t),g=function(e,t,n){if(c(t)){var r=eo(e,t.properties,n).properties;return r&&Object.keys(r).length>0?{properties:r}:void 0}t&&e.error(cn,[n,"evaluation options"])}(i,a,t);return io(i,n,t,l),{valid:h&&u&&l&&!1!==f,key:u,nameOrNames:l,attributes:f,options:g}}function u(e,t){var n=r.resolve(e,""),i=n.treatment,s=n.config;return t?{treatment:i,config:s}:i}function f(e){return s?Promise.resolve(e):e}return{getTreatment:function(e,n,r,i){var s=o(D,e,n,r,i);return s.valid?t.getTreatment(s.key,s.nameOrNames,s.attributes,s.options):f(u(s.nameOrNames,!1))},getTreatmentWithConfig:function(e,n,r,i){var s=o(K,e,n,r,i);return s.valid?t.getTreatmentWithConfig(s.key,s.nameOrNames,s.attributes,s.options):f(u(s.nameOrNames,!0))},getTreatments:function(e,n,r,i){var s=o(M,e,n,r,i);if(s.valid)return t.getTreatments(s.key,s.nameOrNames,s.attributes,s.options);var a={};return s.nameOrNames&&s.nameOrNames.forEach((function(e){return a[e]=u(e,!1)})),f(a)},getTreatmentsWithConfig:function(e,n,r,i){var s=o(x,e,n,r,i);if(s.valid)return t.getTreatmentsWithConfig(s.key,s.nameOrNames,s.attributes,s.options);var a={};return s.nameOrNames&&s.nameOrNames.forEach((function(e){return a[e]=u(e,!0)})),f(a)},getTreatmentsByFlagSets:function(e,n,r,i){var s=o(U,e,n,r,i);return s.valid?t.getTreatmentsByFlagSets(s.key,s.nameOrNames,s.attributes,s.options):f({})},getTreatmentsWithConfigByFlagSets:function(e,n,r,i){var s=o(j,e,n,r,i);return s.valid?t.getTreatmentsWithConfigByFlagSets(s.key,s.nameOrNames,s.attributes,s.options):f({})},getTreatmentsByFlagSet:function(e,n,r,i){var s=o(P,e,[n],r,i);return s.valid?t.getTreatmentsByFlagSet(s.key,s.nameOrNames[0],s.attributes,s.options):f({})},getTreatmentsWithConfigByFlagSet:function(e,n,r,i){var s=o(B,e,[n],r,i);return s.valid?t.getTreatmentsWithConfigByFlagSet(s.key,s.nameOrNames[0],s.attributes,s.options):f({})},track:function(e,r,o,u,c){var f=ir(i,e,q),h=function(e,t,n){if(null==t)e.error(pn,[n,no]);else if(l(t)){if(0!==t.length)return to.test(t)&&(e.warn(Pt,[n]),t=t.toLowerCase()),t;e.error(vn,[n,no])}else e.error(mn,[n,no]);return!1}(i,r,q),p=function(e,t,n){if(null==t)e.error(pn,[n,Js]);else if(l(t))if(0===t.length)e.error(vn,[n,Js]);else{if(Vs.test(t))return t;e.error(un,[n,t])}else e.error(mn,[n,Js]);return!1}(i,o,q),g=function(e,t,n){return a(t)||null==t?t:(e.error(fn,[n]),!1)}(i,u,q),d=eo(i,c,q),m=d.properties,v=d.size;return ro(i,n,q)&&f&&h&&p&&!1!==g&&!1!==m?t.track(f,h,p,g,m,v):!!s&&Promise.resolve(!1)}}}var fa=1e3;function ha(e,t){var n=e.sdkReadinessManager,r=e.syncManager,i=e.storage,s=e.signalListener,o=e.settings,a=e.telemetryTracker,u=e.uniqueKeysTracker,c=0;function l(){return r?r.flush():Promise.resolve()}return Vn(Object.create(n.sdkStatus),la(o,ca(e),n.readinessManager,e.fallbackTreatmentsCalculator),{flush:function(){return function(e,t){var n=Date.now(),r=n-c;return r<t?(o.log.warn("Flush cooldown, remaining time "+(t-r)/1e3+" seconds"),Promise.resolve()):(c=n,e())}(l,fa)},destroy:function(){var e;return n.readinessManager.destroy(),t||(e=o.core.authorizationKey,ki[e]&&ki[e]--,0===ki[e]&&delete ki[e],a.sessionLength(),s&&s.stop(),u.stop()),r&&r.stop(),l().then((function(){return i.destroy()}))}})}function pa(e,t){return(e.matchingKey?e.matchingKey:e)+"-"+(e.bucketingKey?e.bucketingKey:e)+"-"+(t||"")}function ga(e){var t=e.clients,n=e.storage,r=e.syncManager,i=e.sdkReadinessManager,s=e.settings,o=s.core.key,a=s.log,u=s.initialRolloutPlan,c=wo(a,ha(e),o),l=pa(Kr(o));return t[l]=c,function(s){if(void 0===s)return a.debug(xe),c;var o=ir(a,s,_n);if(!1===o)throw new Error("Shared Client needs a valid key.");var l=pa(o);if(t[l])a.debug(Pe);else{var f=Mr(o),h=i.shared(),p=n.shared&&n.shared(f,(function(e){e?h.readinessManager.timeout():h.readinessManager.segments.emit(di)}));p&&u&&sr(a,u,{segments:p.segments,largeSegments:p.largeSegments},f);var g=r&&p&&r.shared(f,h.readinessManager,p);t[l]=wo(a,ha(Vn({},e,{sdkReadinessManager:h,storage:p||n,syncManager:g}),!0),o),a.info(tt)}return t[l]}}var da="visibilitychange",ma="pagehide",va="for visibilitychange and pagehide events.",ya=function(){function e(e,t,n,r){this.syncManager=e,this.settings=t,this.storage=n,this.serviceApi=r,this.flushData=this.flushData.bind(this),this.flushDataIfHidden=this.flushDataIfHidden.bind(this),this.fromImpressionsCollector=ui.bind(void 0,t.core.labelsEnabled)}return e.prototype.start=function(){this.settings.log.debug(25,[va]),"undefined"!=typeof document&&document.addEventListener&&document.addEventListener(da,this.flushDataIfHidden),"undefined"!=typeof window&&window.addEventListener&&window.addEventListener(ma,this.flushData)},e.prototype.stop=function(){this.settings.log.debug(26,[va]),"undefined"!=typeof document&&document.removeEventListener&&document.removeEventListener(da,this.flushDataIfHidden),"undefined"!=typeof window&&window.removeEventListener&&window.removeEventListener(ma,this.flushData)},e.prototype.flushData=function(){if(this.syncManager){var e=this.settings.urls,t=e.events,n=e.telemetry;if(Vi(this.settings)){var r={sim:this.settings.sync.impressionsMode};this._flushData(t+"/testImpressions/beacon",this.storage.impressions,this.serviceApi.postTestImpressionsBulk,this.fromImpressionsCollector,r),this._flushData(t+"/events/beacon",this.storage.events,this.serviceApi.postEventsBulk),this._flushData(t+"/testImpressions/count/beacon",this.storage.impressionCounts,this.serviceApi.postTestImpressionsCount,li),this._flushData(n+"/v1/keys/cs/beacon",this.storage.uniqueKeys,this.serviceApi.postUniqueKeysBulkCs)}this.storage.telemetry&&this._flushData(n+"/v1/metrics/usage/beacon",this.storage.telemetry,this.serviceApi.postMetricsUsage)}},e.prototype.flushDataIfHidden=function(){"hidden"===document.visibilityState&&this.flushData()},e.prototype._flushData=function(e,t,n,r,i){if(!t.isEmpty()){var s=r?r(t.pop()):t.pop();this._sendBeacon(e,s,i)||n(JSON.stringify(s)).catch((function(){})),this.settings.log.debug(125,[t.name])}},e.prototype._sendBeacon=function(e,t,n){if("undefined"!=typeof navigator&&navigator.sendBeacon){var r={entries:t,token:this.settings.core.authorizationKey,sdk:this.settings.version};n&&Vn(r,n);var i=JSON.stringify(r);try{return navigator.sendBeacon(e,i)}catch(e){return!1}}return!1},e}(),Sa=function(e,t,n,r){this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null},ba=function(){function e(){this.tail=null,this.head=null,this.length=0}return e.prototype.removeNode=function(e){if(e&&e instanceof Sa){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t}},e.prototype.unshiftNode=function(e){if(e&&e instanceof Sa&&e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},e.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)this.head=new Sa(arguments[e],null,this.head,this),this.tail||(this.tail=this.head),this.length++;return this.length},e}(),Ea=function(){function e(e){this.maxLen=e||1,this.items=new Map,this.lru=new ba}return e.prototype.get=function(e){var t=this.items.get(e);if(t&&t instanceof Sa)return this.lru.unshiftNode(t),t.value.value},e.prototype.set=function(e,t){var n=this.items.get(e);if(n){if(!(n instanceof Sa))return!1;this.lru.unshiftNode(n),this.lru.head.value.value=t}else{if(this.lru.length===this.maxLen){var r=this.lru.tail;if(!r)return!1;this.items.delete(r.value.key),this.lru.removeNode(this.lru.tail)}this.lru.unshift({key:e,value:t}),this.items.set(e,this.lru.head)}return!0},e}(),Ta=function(){function e(e,t){this.cache=new Ea(e),this.hasher=t}return e.prototype.testAndSet=function(e){var t=this.hasher(e),n=this.cache.get(t);return this.cache.set(t,e.time),n},e}();function Ra(e){return ps(function(e){return e.keyName+":"+e.feature+":"+e.treatment+":"+e.label+":"+e.changeNumber}(e))}var ka=500;function Ca(){return new Ta(ka,Ra)}function wa(e,t){var n=[];if(e.forEach((function(e){var r=e(t);r&&r.queue&&n.push(r)})),0!==n.length)return{handleImpression:function(e){n.forEach((function(t){return t.queue({type:y,payload:e})}))},handleEvent:function(e){n.forEach((function(t){return t.queue({type:S,payload:e})}))}}}var Na={GRANTED:O,DECLINED:F,UNKNOWN:L};function _a(e){var t=e.settings,n=e.settings.log,r=e.syncManager,i=e.storage,s=i.events,a=i.impressions,u=i.impressionCounts,c=i.uniqueKeys;return Vi(t)||n.info(Et,[t.userConsent]),{setStatus:function(e){var i,l;if(!o(e))return n.warn(En,["UserConsent.setStatus"]),!1;var f=e?O:F;return t.userConsent!==f?(n.info(St,[t.userConsent,f]),t.userConsent=f,e?null===(i=null==r?void 0:r.submitterManager)||void 0===i||i.start():(null===(l=null==r?void 0:r.submitterManager)||void 0===l||l.stop(!0),s.clear&&s.clear(),a.clear&&a.clear(),u.clear&&u.clear(),c.clear&&c.clear())):n.info(bt,[f]),!0},getStatus:function(){return t.userConsent},Status:Na}}function Aa(e){var t=e.treatment;return e.keys?{conditionType:"WHITELIST",matcherGroup:{combiner:"AND",matchers:[{keySelector:null,matcherType:"WHITELIST",negate:!1,whitelistMatcherData:{whitelist:l(e.keys)?[e.keys]:e.keys}}]},partitions:[{treatment:t,size:100}],label:"whitelisted "+t}:{conditionType:"ROLLOUT",matcherGroup:{combiner:"AND",matchers:[{keySelector:null,matcherType:"ALL_KEYS",negate:!1}]},partitions:[{treatment:t,size:100}],label:"default rule"}}function Ia(e,t,n,r){return ii(r.log,function(e,t,n,r){var s=r.log,o=t.splits,a=!0;return function(){var u=[],c=null,l={};try{l=e(r)}catch(e){c=e,s.error(tn,[e])}return!c&&l?(s.debug(Be,[JSON.stringify(l)]),i(l,(function(e,t){u.push({name:t,status:"ACTIVE",killed:!1,trafficAllocation:100,defaultTreatment:v,conditions:e.conditions||[],configurations:e.configurations,trafficTypeName:e.trafficTypeName})})),Promise.all([o.clear(),o.update(u,[],Date.now())]).then((function(){return n.splits.emit(pi),a&&(a=!1,Promise.resolve(!!t.validateCache&&t.validateCache()).then((function(e){e&&n.splits.emit(gi),n.segments.emit(di)}))),!0}))):Promise.resolve(!0)}}(e,t,n,r),r.scheduler.offlineRefreshRate,"offlineUpdater")}function Oa(){return Promise.resolve()}var Fa,La,Da,Ma=(Fa=function(){var e={emptyMock:"1"};return function(t){var n,r,s=t.features||{};if(n=s,!((r=Object.keys(n)).length!==Object.keys(e).length?(e=h({},n),1):r.some((function(t){var r,i,s=!e[t],o=typeof(r=e[t])!=typeof(i=n[t])||("string"==typeof r?r!==i:r.treatment!==i.treatment||r.config!==i.config),a=s||o;return a&&(e=h({},n)),a}))))return!1;var o={};return i(s,(function(e,t){var n=e,r=null;c(e)&&(n=e.treatment,r=e.config||r);var i={};null!==r&&(i[n]=r),o[t]={trafficTypeName:"localhost",conditions:[Aa({treatment:n})],configurations:i}})),o}},function(e){var t=e.settings,n=e.readiness,r=e.storage,i=Ia(Fa(),r,n,t),s=i.start,o=[];return Vn(i,{start:function(){s(),o.forEach((function(e){return e()})),o.length=0},flush:Oa,shared:function(e,t){function n(){t.segments.emit(di)}return i.isRunning()?setTimeout(n):o.push(n),{stop:function(){},flush:Oa}}})});function Ka(e,t){var n=!1,r=!1;var i=function e(i){var s=new Promise((function(e,n){return i.then(e,(function(e){r?n(e):t(e)}))})),o=s.then;return Object.defineProperty(s,"then",{value:function(t,i){var a=o.call(s,t,i);return"function"==typeof t&&(n=!0),"function"==typeof i?(r=!0,a):e(a)}}),s}(e);return i.hasOnFulfilled=function(){return n},i}function xa(e,t,n,r){void 0===n&&(n=function(e){var t=Vn(new e,{splitsArrived:!1,splitsCacheLoaded:!1,hasInit:!1,initCallbacks:[]});return t.on(pi,(function(e){e||(t.splitsArrived=!0)})),t.once(gi,(function(){t.splitsCacheLoaded=!0})),t}(e));var i=t.startup.readyTimeout,s=function(e){var t=Vn(new e,{segmentsArrived:!1});return t.once(di,(function(){t.segmentsArrived=!0})),t}(e),o=new e,a=0;function u(){var e=Date.now();a=e>a?e:a+1}var c=!1;n.splitsCacheLoaded?c=!0:n.once(gi,(function(){if(c=!0,!h&&!g)try{u(),o.emit(yi,h)}catch(e){setTimeout((function(){throw e}),0)}}));var l=!1;function f(){l||h||(l=!0,u(),o.emit(mi,"Split SDK emitted SDK_READY_TIMED_OUT event."))}var h=!1;n.on(pi,m),s.on(di,m);var p,g=!1;function d(){g=!1,i>0&&!h&&(p=setTimeout(f,i))}function m(e){if(!g)if(h)try{u(),o.emit(Si,e)}catch(e){setTimeout((function(){throw e}),0)}else if(n.splitsArrived&&s.segmentsArrived){clearTimeout(p),h=!0;try{u(),c||(c=!0,o.emit(yi,h)),o.emit(vi)}catch(e){setTimeout((function(){throw e}),0)}}}return n.initCallbacks.push(d),n.hasInit&&d(),{splits:n,segments:s,gate:o,shared:function(){return xa(e,t,n,!0)},timeout:f,setDestroyed:function(){g=!0},init:function(){n.hasInit||(n.hasInit=!0,n.initCallbacks.forEach((function(e){return e()})))},destroy:function(){g=!0,u(),clearTimeout(p),r||(n.hasInit=!1)},isReady:function(){return h},isReadyFromCache:function(){return c},isTimedout:function(){return l&&!h},hasTimedout:function(){return l},isDestroyed:function(){return g},isOperational:function(){return(h||c)&&!g},lastUpdate:function(){return a}}}var Pa="newListener",Ua="removeListener",Ba=new Error(mi);function ja(e,t,n){void 0===n&&(n=xa(e,t));var r=t.log,i=0,s=0;n.gate.on(Ua,(function(e){e===vi&&s--})),n.gate.on(Pa,(function(e){e===vi||e===mi?n.isReady()?r.error(Xt,[e===vi?"SDK_READY":"SDK_READY_TIMED_OUT"]):e===vi&&s++:e===yi&&n.isReadyFromCache()&&r.error(Xt,["SDK_READY_FROM_CACHE"])}));var o,a=o=Ka(new Promise((function(e,t){n.gate.once(vi,(function(){r.info(Ze),s!==i||o.hasOnFulfilled()||r.warn(kt),e()})),n.gate.once(mi,(function(e){t(new Error(e))}))})),u);function u(e){r.error(e&&e.message)}function c(){return{isReady:n.isReady(),isReadyFromCache:n.isReadyFromCache(),isTimedout:n.isTimedout(),hasTimedout:n.hasTimedout(),isDestroyed:n.isDestroyed(),isOperational:n.isOperational(),lastUpdate:n.lastUpdate()}}return n.gate.once(yi,(function(){r.info($e)})),{readinessManager:n,shared:function(){return ja(e,t,n.shared())},incInternalReadyCbCount:function(){i++},sdkStatus:Vn(Object.create(n.gate),{Event:{SDK_READY:vi,SDK_READY_FROM_CACHE:yi,SDK_UPDATE:Si,SDK_READY_TIMED_OUT:mi},ready:function(){return n.hasTimedout()?n.isReady()?Promise.resolve():Ka(Promise.reject(new Error("Split SDK has emitted SDK_READY_TIMED_OUT event.")),u):a},whenReady:function(){return new Promise((function(e,t){n.isReady()?e():n.hasTimedout()?t(Ba):(n.gate.once(vi,e),n.gate.once(mi,(function(){return t(Ba)})))}))},whenReadyFromCache:function(){return new Promise((function(e,t){n.isReadyFromCache()?e(n.isReady()):n.hasTimedout()?t(Ba):(n.gate.once(yi,(function(){return e(n.isReady())})),n.gate.once(mi,(function(){return t(Ba)})))}))},getStatus:c,__getStatus:c})}}function qa(e){function t(t){vr(t)?e.setLogLevel(t):e.error(Zt)}return{enable:function(){t(gr.DEBUG)},setLogLevel:t,setLogger:function(t){e.setLogger(t)},disable:function(){t(gr.NONE)},LogLevel:gr}}var za={add:function(){return!0},contains:function(){return!0},clear:function(){}};function Wa(e){var t=e.settings,n=e.platform,r=e.storageFactory,i=e.splitApiFactory,s=e.extraProps,o=e.syncManagerFactory,a=e.SignalListener,u=e.impressionsObserverFactory,c=e.integrationsManagerFactory,l=e.sdkManagerFactory,f=e.sdkClientMethodFactory,h=e.filterAdapterFactory,p=e.lazyInit,g=t.log,d=t.sync.impressionsMode,m=t.initialRolloutPlan,v=t.core.key,y=!1,S=[];function T(e){y?e():S.push(e)}var R=ja(n.EventEmitter,t),k=R.readinessManager,C=r({settings:t,onReadyCb:function(e){e?k.timeout():(k.splits.emit(pi),k.segments.emit(di))},onReadyFromCacheCb:function(){k.splits.emit(gi)}}),w=new ao(t.fallbackTreatments);m&&(sr(g,m,C,v&&Mr(v)),C.splits.getChangeNumber()>-1&&k.splits.emit(gi));var N,_,A={},I=function(e,t){if(e&&t){var n=wi(t);return{trackEval:function(n){var r=wi(t);return function(t){switch(t){case ho:return void e.recordException(n);case fo:e.recordNonReadyUsage&&e.recordNonReadyUsage()}e.recordLatency(n,r())}},trackHttp:function(n){var r=wi(t);return function(t){e.recordHttpLatency(n,r()),t&&t.statusCode?e.recordHttpError(n,t.statusCode):e.recordSuccessfulSync(n,Date.now())}},sessionLength:function(){e.recordSessionLength&&e.recordSessionLength(n())},streamingEvent:function(t,n){t===ye?e.recordAuthRejections():(e.recordStreamingEvents({e:t,d:n,t:Date.now()}),t===de&&e.recordTokenRefreshes())},addTag:function(t){e.addTag&&e.addTag(t)},trackUpdatesFromSSE:function(t){e.recordUpdatesFromSSE(t)}}}var r=function(){return function(){}};return{trackEval:r,trackHttp:r,sessionLength:function(){},streamingEvent:function(){},addTag:function(){},trackUpdatesFromSSE:function(){}}}(C.telemetry,n.now),O=c&&c({settings:t,storage:C,telemetryTracker:I}),L=u(),D=function(e,t,n){var r;return void 0===n&&(n=za),{track:function(r,i){n.add(r,i)?t.track(r,i):e.debug(zn+"The feature "+i+" and key "+r+" exist in the filter")},start:function(){n.refreshRate&&(r=setInterval(n.clear,n.refreshRate))},stop:function(){clearInterval(r)}}}(g,C.uniqueKeys,h&&h()),M=function(e,t){return{process:function(n){var r=Date.now();return e.track(n.feature,r,1),t.track(n.keyName,n.feature),!1}}}(C.impressionCounts,D),K=d===E?(N=L,_=C.impressionCounts,{process:function(e){if(e.properties)return!0;e.pt=N.testAndSet(e);var t=Date.now();return e.pt&&_.track(e.feature,t,1),!e.pt||e.pt<Lr(t)}}):d===b?function(e){return{process:function(t){return t.properties||(t.pt=e.testAndSet(t)),!0}}}(L):M,x=function(e,t,n,r,i,s,o){var a=e.log,u=e.impressionListener,c=e.runtime,l=c.ip,f=c.hostname,h=e.version;return{track:function(c,p){if(e.userConsent!==F){var g=c.filter((function(e){var t=e.imp;return e.disabled?n.process(t):r.process(t)})),d=c.length,m=g.length;if(m){var v=t.track(g.map((function(e){return e.imp})));Gs(v)?v.then((function(){a.info(yt,[d])})).catch((function(e){a.error(sn,[d,e])})):o&&(o.recordImpressionStats(H,m),o.recordImpressionStats(V,d-m))}if(u||s)for(var y=function(e){var t={impression:Vn({},c[e].imp),attributes:p,ip:l,hostname:f,sdkLanguageVersion:h};i((function(){setTimeout((function(){s&&s.handleImpression(t);try{u&&u.logImpression(t)}catch(e){a.error(on,[e])}}))}))},S=0;S<d;S++)y(S)}}}}(t,C.impressions,M,K,T,O,C.telemetry),P=function(e,t,n,r,i){var s=e.log,o=Ie(e.mode);function a(e,t){var i=e.eventTypeId,o=e.trafficTypeName,a=e.key,u=e.value,c=e.timestamp,l=e.properties,f='event of type "'+i+'" for traffic type "'+o+'". Key: '+a+". Value: "+u+". Timestamp: "+c+". "+(l?"With properties.":"With no properties.");return t?(s.info(vt,[f]),r&&n((function(){setTimeout((function(){var t=Vn({},e);l&&(t.properties=Vn({},l)),r.handleEvent(t)}))}))):s.error(an,[f]),t}return{track:function(n,r){if(e.userConsent===F)return!!o&&Promise.resolve(!1);var s=t.track(n,r);return Gs(s)?s.then(a.bind(null,n)):(i&&i.recordEventStats(s?H:Q,1),a(n,s))}}}(t,C.events,T,O,C.telemetry),U=i&&i(t,n,I),B={clients:A,splitApi:U,eventTracker:P,impressionsTracker:x,telemetryTracker:I,uniqueKeysTracker:D,sdkReadinessManager:R,readiness:k,settings:t,storage:C,platform:n,fallbackTreatmentsCalculator:w},j=o&&o(B);B.syncManager=j;var q=a&&new a(j,t,C,U);B.signalListener=q;var z=f(B),W=l(t,C.splits,R);function G(){y||(y=!0,Ci(g,t.core.authorizationKey),k.init(),D.start(),j&&j.start(),q&&q.start(),S.forEach((function(e){return e()})),S.length=0)}return g.info(nt,[t.version]),Vn({client:z,manager:function(){return g.debug(Ue),W},Logger:qa(g),settings:t,destroy:function(){return y=!1,Promise.all(Object.keys(A).map((function(e){return A[e].destroy()}))).then((function(){}))}},s&&s(B),p?{init:G}:G())}function Ga(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest,s=[],o=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return s},entries:function(){return o},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){s.push(t=t.toLowerCase()),o.push([t,n]),a[t]=a[t]?a[t]+","+n:n})),n(u())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(c,t.headers[c]);i.send(t.body||null)}))}var Ha="object"==typeof Reflect?Reflect:null,Qa=Ha&&"function"==typeof Ha.apply?Ha.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},Va=function e(){e.init.call(this)};function Ja(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Ya(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}Va.prototype._events=void 0,Va.prototype._eventsCount=0,Va.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0)},Va.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)Qa(a,this,t);else for(var u=a.length,c=function(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}(a,u),l=0;l<u;++l)Qa(c[l],this,t);return!0},Va.prototype.addListener=function(e,t){return function(e,t,n,r){var i,s;return Ja(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),void 0===s?(s=i[t]=n,++e._eventsCount):"function"==typeof s?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),e}(this,e,t,!1)},Va.prototype.on=Va.prototype.addListener,Va.prototype.once=function(e,t){return Ja(t),this.on(e,function(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=Ya.bind(r);return i.listener=n,r.wrapFn=i,i}(this,e,t)),this},Va.prototype.removeListener=function(e,t){var n,r,i,s,o;if(Ja(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},Va.prototype.off=Va.prototype.removeListener,Va.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,s=Object.keys(n);for(r=0;r<s.length;++r)"removeListener"!==(i=s[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};var $a={getFetch:function(){return"function"==typeof fetch?fetch:Ga},getEventSource:function(){return"function"==typeof EventSource?EventSource:void 0},EventEmitter:Va,now:"object"==typeof performance&&"function"==typeof performance.now?performance.now.bind(performance):Date.now};function Za(e,t){var n=function(e){return hr(e,Jr)}(e),r=function(e,t){La||(La=Ji(Ws,Ks));var n={settings:e,platform:t,storageFactory:e.storage,splitApiFactory:ri,syncManagerFactory:La,sdkManagerFactory:ko,sdkClientMethodFactory:ga,SignalListener:ya,integrationsManagerFactory:e.integrations&&e.integrations.length>0?wa.bind(null,e.integrations):void 0,impressionsObserverFactory:Ca,extraProps:function(e){return{UserConsent:_a(e)}}};switch(e.mode){case R:n.splitApiFactory=void 0,n.syncManagerFactory=Ma,n.SignalListener=void 0;break;case w:n.syncManagerFactory=void 0;break;case N:Da||(Da=Ji(void 0,void 0)),n.syncManagerFactory=Da}return n}(n,$a);return t&&t(r),Wa(r)}var Xa=/[^.]+$/;var eu=function(e){function n(t,n){var r=e.call(this,t)||this;return r.matchingKey=n,r.regexSplitsCacheKey=new RegExp("^"+t+"\\.(splits?|trafficType|flagSet)\\."),r}return t(n,e),n.prototype.buildSegmentNameKey=function(e){return this.prefix+"."+this.matchingKey+".segment."+e},n.prototype.extractSegmentName=function(e){var t=this.prefix+"."+this.matchingKey+".segment.";if(p(e,t))return e.slice(t.length)},n.prototype.buildLastUpdatedKey=function(){return this.prefix+".splits.lastUpdated"},n.prototype.isSplitsCacheKey=function(e){return this.regexSplitsCacheKey.test(e)},n.prototype.buildTillKey=function(){return this.prefix+"."+this.matchingKey+".segments.till"},n.prototype.isSplitKey=function(e){return p(e,this.prefix+".split.")},n.prototype.isRBSegmentKey=function(e){return p(e,this.prefix+".rbsegment.")},n.prototype.buildSplitsWithSegmentCountKey=function(){return this.prefix+".splits.usingSegments"},n.prototype.buildLastClear=function(){return this.prefix+".lastClear"},n}(function(){function e(e){void 0===e&&(e="SPLITIO"),this.prefix=e}return e.prototype.buildTrafficTypeKey=function(e){return this.prefix+".trafficType."+e},e.prototype.buildFlagSetKey=function(e){return this.prefix+".flagSet."+e},e.prototype.buildSplitKey=function(e){return this.prefix+".split."+e},e.prototype.buildSplitsTillKey=function(){return this.prefix+".splits.till"},e.prototype.buildSplitKeyPrefix=function(){return this.prefix+".split."},e.prototype.buildRBSegmentKey=function(e){return this.prefix+".rbsegment."+e},e.prototype.buildRBSegmentsTillKey=function(){return this.prefix+".rbsegments.till"},e.prototype.buildRBSegmentKeyPrefix=function(){return this.prefix+".rbsegment."},e.prototype.buildSegmentNameKey=function(e){return this.prefix+".segment."+e},e.prototype.buildSegmentTillKey=function(e){return this.prefix+".segment."+e+".till"},e.prototype.extractKey=function(e){var t=e.match(Xa);if(t&&t.length)return t[0];throw new Error("Invalid latency key provided")},e.prototype.buildHashKey=function(){return this.prefix+".hash"},e}());function tu(e,t){return{buildSegmentNameKey:function(n){return e+"."+t+".largeSegment."+n},extractSegmentName:function(n){var r=e+"."+t+".largeSegment.";if(p(n,r))return n.slice(r.length)},buildTillKey:function(){return e+"."+t+".largeSegments.till"}}}var nu="storage:localstorage: ",ru="1",iu=function(e){function n(t,n,r){var i=e.call(this)||this;return i.keys=n,i.log=t.log,i.flagSetsFilter=t.sync.__splitFiltersValidation.groupedFilters.bySet,i.storage=r,i}return t(n,e),n.prototype._decrementCount=function(e){var t=g(this.storage.getItem(e))-1;t>0?this.storage.setItem(e,t+""):this.storage.removeItem(e)},n.prototype._decrementCounts=function(e){try{var t=this.keys.buildTrafficTypeKey(e.trafficTypeName);if(this._decrementCount(t),Cr(e)){var n=this.keys.buildSplitsWithSegmentCountKey();this._decrementCount(n)}}catch(e){this.log.error(nu+e)}},n.prototype._incrementCounts=function(e){try{var t=this.keys.buildTrafficTypeKey(e.trafficTypeName);if(this.storage.setItem(t,g(this.storage.getItem(t))+1+""),Cr(e)){var n=this.keys.buildSplitsWithSegmentCountKey();this.storage.setItem(n,g(this.storage.getItem(n))+1+"")}}catch(e){this.log.error(nu+e)}},n.prototype.clear=function(){for(var e=this,t=this.storage.length,n=[],r=0;r<t;r++){var i=this.storage.key(r);null!=i&&this.keys.isSplitsCacheKey(i)&&n.push(i)}n.forEach((function(t){e.storage.removeItem(t)})),this.hasSync=!1},n.prototype.addSplit=function(e){try{var t=e.name,n=this.keys.buildSplitKey(t),r=this.storage.getItem(n),i=r?JSON.parse(r):null;return i&&(this._decrementCounts(i),this.removeFromFlagSets(i.name,i.sets)),this.storage.setItem(n,JSON.stringify(e)),this._incrementCounts(e),this.addToFlagSets(e),!0}catch(e){return this.log.error(nu+e),!1}},n.prototype.removeSplit=function(e){try{var t=this.getSplit(e);return!!t&&(this.storage.removeItem(this.keys.buildSplitKey(e)),this._decrementCounts(t),this.removeFromFlagSets(t.name,t.sets),!0)}catch(e){return this.log.error(nu+e),!1}},n.prototype.getSplit=function(e){var t=this.storage.getItem(this.keys.buildSplitKey(e));return t&&JSON.parse(t)},n.prototype.setChangeNumber=function(e){try{return this.storage.setItem(this.keys.buildSplitsTillKey(),e+""),this.storage.setItem(this.keys.buildLastUpdatedKey(),Date.now()+""),this.hasSync=!0,!0}catch(e){return this.log.error(nu+e),!1}},n.prototype.getChangeNumber=function(){var e=this.storage.getItem(this.keys.buildSplitsTillKey());return null!==e?u(e=parseInt(e,10))?-1:e:-1},n.prototype.getSplitNames=function(){for(var e=this.storage.length,t=[],n=0;n<e;){var r=this.storage.key(n);null!=r&&this.keys.isSplitKey(r)&&t.push(this.keys.extractKey(r)),n++}return t},n.prototype.trafficTypeExists=function(e){var t=g(this.storage.getItem(this.keys.buildTrafficTypeKey(e)));return a(t)&&t>0},n.prototype.usesSegments=function(){if(!this.hasSync)return!0;var e=this.storage.getItem(this.keys.buildSplitsWithSegmentCountKey()),t=null===e?0:g(e);return!a(t)||t>0},n.prototype.getNamesByFlagSets=function(e){var t=this;return e.map((function(e){var n=t.keys.buildFlagSetKey(e),r=t.storage.getItem(n);return new Set(r?JSON.parse(r):[])}))},n.prototype.addToFlagSets=function(e){var t=this;e.sets&&e.sets.forEach((function(n){if(!(t.flagSetsFilter.length>0)||t.flagSetsFilter.some((function(e){return e===n}))){var r=t.keys.buildFlagSetKey(n),i=t.storage.getItem(r),s=new Set(i?JSON.parse(i):[]);s.add(e.name),t.storage.setItem(r,JSON.stringify(qr(s)))}}))},n.prototype.removeFromFlagSets=function(e,t){var n=this;t&&t.forEach((function(t){n.removeNames(t,e)}))},n.prototype.removeNames=function(e,t){var n=this.keys.buildFlagSetKey(e),r=this.storage.getItem(n);if(r){var i=new Set(JSON.parse(r));i.delete(t),0!==i.size?this.storage.setItem(n,JSON.stringify(qr(i))):this.storage.removeItem(n)}},n}(kr),su=function(){function e(e,t,n){this.keys=t,this.log=e.log,this.storage=n}return e.prototype.clear=function(){var e=this;this.getNames().forEach((function(t){return e.remove(t)})),this.storage.removeItem(this.keys.buildRBSegmentsTillKey())},e.prototype.update=function(e,t,n){var r=this;this.setChangeNumber(n);var i=e.map((function(e){return r.add(e)})).some((function(e){return e}));return t.map((function(e){return r.remove(e.name)})).some((function(e){return e}))||i},e.prototype.setChangeNumber=function(e){try{this.storage.setItem(this.keys.buildRBSegmentsTillKey(),e+""),this.storage.setItem(this.keys.buildLastUpdatedKey(),Date.now()+"")}catch(e){this.log.error(nu+e)}},e.prototype.updateSegmentCount=function(e){var t=this.keys.buildSplitsWithSegmentCountKey(),n=g(this.storage.getItem(t))+e;n>0?this.storage.setItem(t,n+""):this.storage.removeItem(t)},e.prototype.add=function(e){try{var t=e.name,n=this.keys.buildRBSegmentKey(t),r=this.storage.getItem(n),i=r?JSON.parse(r):null;this.storage.setItem(n,JSON.stringify(e));var s=0;return i&&Cr(i)&&s--,Cr(e)&&s++,0!==s&&this.updateSegmentCount(s),!0}catch(e){return this.log.error(nu+e),!1}},e.prototype.remove=function(e){try{var t=this.get(e);return!!t&&(this.storage.removeItem(this.keys.buildRBSegmentKey(e)),Cr(t)&&this.updateSegmentCount(-1),!0)}catch(e){return this.log.error(nu+e),!1}},e.prototype.getNames=function(){for(var e=this.storage.length,t=[],n=0;n<e;){var r=this.storage.key(n);null!=r&&this.keys.isRBSegmentKey(r)&&t.push(this.keys.extractKey(r)),n++}return t},e.prototype.get=function(e){var t=this.storage.getItem(this.keys.buildRBSegmentKey(e));return t&&JSON.parse(t)},e.prototype.getAll=function(){var e=this;return this.getNames().map((function(t){return e.get(t)}))},e.prototype.contains=function(e){var t=qr(e),n=this.getNames();return t.every((function(e){return-1!==n.indexOf(e)}))},e.prototype.getChangeNumber=function(){var e=this.storage.getItem(this.keys.buildRBSegmentsTillKey());return null!==e?u(e=parseInt(e,10))?-1:e:-1},e.prototype.usesSegments=function(){var e=this.storage.getItem(this.keys.buildSplitsWithSegmentCountKey()),t=null===e?0:g(e);return!a(t)||t>0},e}(),ou=function(e){function n(t,n,r){var i=e.call(this)||this;return i.log=t,i.keys=n,i.storage=r,i}return t(n,e),n.prototype.addSegment=function(e){var t=this.keys.buildSegmentNameKey(e);try{return this.storage.getItem(t)!==ru&&(this.storage.setItem(t,ru),!0)}catch(e){return this.log.error(nu+e),!1}},n.prototype.removeSegment=function(e){var t=this.keys.buildSegmentNameKey(e);try{return this.storage.getItem(t)===ru&&(this.storage.removeItem(t),!0)}catch(e){return this.log.error(nu+e),!1}},n.prototype.isInSegment=function(e){return this.storage.getItem(this.keys.buildSegmentNameKey(e))===ru},n.prototype.getRegisteredSegments=function(){for(var e=[],t=0,n=this.storage.length;t<n;t++){var r=this.keys.extractSegmentName(this.storage.key(t));r&&e.push(r)}return e},n.prototype.getKeysCount=function(){return 1},n.prototype.setChangeNumber=function(e){try{e?this.storage.setItem(this.keys.buildTillKey(),e+""):this.storage.removeItem(this.keys.buildTillKey())}catch(e){this.log.error(e)}},n.prototype.getChangeNumber=function(){var e=this.storage.getItem(this.keys.buildTillKey());return null!==e?u(e=parseInt(e,10))?-1:e:-1},n}(_r),au=10,uu=864e5;function cu(e,t,n,r,i,s){var o=n.log,c=n.initialRolloutPlan,l=parseInt(t.getItem(r.buildLastUpdatedKey()),10);if(!u(l)){var f=a(e.expirationDays)&&e.expirationDays>=1?e.expirationDays:au;if(l<i-uu*f)return o.info(nu+"Cache expired more than "+f+" days ago. Cleaning up cache"),!0}var h=r.buildHashKey(),p=t.getItem(h),g=function(e){return ps(e.core.authorizationKey+"::"+e.sync.__splitFiltersValidation.queryString+"::"+e.sync.flagSpecVersion).toString(16)}(n);if(p!==g){try{t.setItem(h,g)}catch(e){o.error(nu+e)}return!(!s||c)&&(o.info(nu+"SDK key, flags filter criteria, or flags spec version has changed. Cleaning up cache"),!0)}if(e.clearOnInit){var d=parseInt(t.getItem(r.buildLastClear()),10);if(u(d)||d<i-uu)return o.info(nu+"clearOnInit was set and cache was not cleared in the last 24 hours. Cleaning up cache"),!0}}function lu(e,t,n){if(n){if(function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.setItem&&"function"==typeof e.getItem&&"function"==typeof e.removeItem}(n))return function(e){if("number"==typeof e.length)try{return e.key(0),!0}catch(e){return!1}return!1}(n)?n:function(e,t,n){var r,i=[],s={},o=Promise.resolve();return{load:function(){return r||(r=Promise.resolve().then((function(){return n.getItem(t)})).then((function(e){s=JSON.parse(e||"{}"),i=Object.keys(s)})).catch((function(t){e.error(nu+"Error calling wrapper `getItem` method: "+t)})))},save:function(){return o=o.then((function(){return Promise.resolve(n.setItem(t,JSON.stringify(s)))})).catch((function(t){e.error(nu+"Error calling wrapper `setItem` method: "+t)}))},whenSaved:function(){return o},get length(){return i.length},getItem:function(e){return s[e]||null},key:function(e){return i[e]||null},removeItem:function(e){var t=i.indexOf(e);-1!==t&&(i.splice(t,1),delete s[e])},setItem:function(e,t){-1===i.indexOf(e)&&i.push(e),s[e]=t}}}(e,t,n);e.warn(nu+"Invalid storage provided. Falling back to LocalStorage API")}if(function(){var e="__SPLITSOFTWARE__";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}())return localStorage;e.warn(nu+"LocalStorage API is unavailable. Falling back to default MEMORY storage")}var fu=[[$t,In+"Invalid feature flag, no valid rules or unsupported targeting rule type found"],[Cn,On+"[%s] %s"],[Zt,"logger: Invalid Log Level - No changes to the logs will be applied."],[en,"The SDK will not get ready. Reason: %s"],[sn,jn+"Could not store impressions bulk with %s impression(s). Error: %s"],[on,jn+"Impression listener logImpression method threw: %s."],[an,qn+"Failed to queue %s"],[tn,Mn+"There was an issue loading the mock feature flags data. No changes will be applied to the current cache. %s"],[nn,Kn+"Failed to connect or error on streaming connection, with error message: %s"],[rn,Kn+"Failed to authenticate for streaming. Error: %s."],[bn,"HTTP request failed with %s. URL: %s. Message: %s"],[Xt,"A listener was added for %s on the SDK, which has already fired and won't be emitted again. The callback won't be executed."],[hn,"%s: Client has already been destroyed - no calls possible."],[un,'%s: you passed "%s", event_type must adhere to the regular expression /^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/g. This means an event_type must be alphanumeric, cannot be more than 80 characters long, and can only include a dash, underscore, period, or colon as separators of alphanumeric characters.'],[cn,"%s: %s must be a plain object."],[ln,"%s: the maximum size allowed for the properties is 32768 bytes, which was exceeded."],[fn,"%s: value must be a finite number."],[pn,"%s: you passed a null or undefined %s. It must be a non-empty string."],[gn,"%s: %s too long. It must have 250 characters or less."],[dn,"%s: Key must be an object with bucketingKey and matchingKey with valid string properties."],[mn,"%s: you passed an invalid %s. It must be a non-empty string."],[vn,"%s: you passed an empty %s. It must be a non-empty string."],[yn,"%s: %s must be a non-empty array."],[En,"%s: provided param must be a boolean value."],[Sn,wn+': you passed an invalid "%s" config param. It should be one of the following values: %s. Defaulting to "%s".'],[324,wn+": the provided storage is invalid.%s Falling back into default MEMORY storage"],[Tn,wn+': the provided "%s" config param is lower than allowed. Setting to the minimum value %s seconds'],[Rn,wn+": the amount of flag sets provided are big causing uri length error."],[kn,wn+": the Set filter is exclusive and cannot be used simultaneously with names or prefix filters. Ignoring names and prefixes."]];var hu=fu.concat([[Tt,Fn+"Value %s doesn't match with expected type."],[Rt,Fn+"Defined attribute `%s`. No attributes received."],[wt,Pn+"Retrying fetch of memberships (attempt #%s). Reason: %s"],[Nt,xn+"Error while doing fetch of feature flags. %s"],[_t,Kn+"Error parsing SSE error notification: %s"],[At,Kn+"Error parsing SSE message notification: %s"],[It,Kn+"Falling back to polling mode. Reason: %s"],[Ot,Bn+"Dropping %s after retry. Reason: %s."],[Ft,Bn+"Failed to push %s, keeping data to retry on next iteration. Reason: %s."],[Ct,"%s: the SDK is not ready to evaluate. Results may be incorrect%s. Make sure to wait for SDK readiness before using this method."],[kt,"No listeners for SDK_READY event detected. Incorrect control treatments could have been logged if you called getTreatment/s while the SDK was not yet synchronized with the backend."],[Lt,'%s: Property "%s" is of invalid type. Setting value to null.'],[Dt,"%s: more than 300 properties were provided. Some of them will be trimmed when processed."],[Mt,'%s: %s "%s" is not of type string, converting.'],[Kt,'%s: %s "%s" has extra whitespace, trimming.'],[xt,'%s: feature flag "%s" does not exist in this environment. Please double check what feature flags exist in the Split user interface.'],[Pt,"%s: traffic_type_name should be all lowercase - converting string to lowercase."],[Ut,'%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in the Split user interface.'],[Jt,"%s: you passed %s which is not part of the configured FlagSetsFilter, ignoring Flag Set."],[Bt,wn+": %s integration item(s) at settings is invalid. %s"],[jt,wn+": feature flag filters are not applicable for Consumer modes where the SDK does not keep rollout data in sync. Filters were discarded"],[qt,wn+': feature flag filter at position %s is invalid. It must be an object with a valid filter type ("bySet", "byName" or "byPrefix") and a list of "values".'],[zt,wn+": feature flag filter configuration must be a non-empty array of filter objects."],[Wt,wn+": You already have %s. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application"],[Gt,Kn+"Fetching Memberships due to an error processing %s notification: %s"],[Ht,Kn+"Fetching SplitChanges due to an error processing %s notification: %s"],[Qt,"%s: you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded."],[Vt,"%s: flag set %s should be all lowercase - converting string to lowercase."],[Yt,"%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in the Split user interface."]]);var pu="Split SDK client is ready",gu=hu.concat([[$e,pu+" from cache"],[Ze,pu],[Xe,jn+"Feature flag: %s. Key: %s. Evaluation: %s. Label: %s"],[et,jn+"Queueing corresponding impression."],[tt,"New shared client instance created."],[nt,"New Split SDK instance created. %s"],[vt,qn+"Successfully queued %s"],[yt,jn+"Successfully stored %s impression(s)."],[St,"UserConsent: consent status changed from %s to %s."],[bt,"UserConsent: call had no effect because it was the current consent status (%s)."],[Et,"Starting the SDK with %s user consent. No data will be sent."],[rt,Un+"Turning segments data polling %s."],[it,Un+"Starting polling"],[st,Un+"Stopping polling"],[ot,xn+"Retrying fetch of feature flags (attempt #%s). Reason: %s"],[ht,Bn+"Flushing full %s queue and resetting timer."],[pt,Bn+"Pushing %s."],[125,Bn+"Flushing %s because page became hidden."],[at,Kn+"Refreshing streaming token in %s seconds, and connecting streaming in %s seconds."],[ut,Kn+"Attempting to reconnect streaming in %s seconds."],[ct,Kn+"Connecting streaming."],[lt,Kn+"Streaming is disabled for given SDK key. Switching to polling mode."],[ft,Kn+"Disconnecting streaming."],[gt,Dn+"Streaming not available. Starting polling."],[dt,Dn+"Streaming couldn't connect. Continue polling."],[mt,Dn+"Streaming connected. Syncing and stopping polling."]]);var du=gu.concat([[Oe,In+"[andCombiner] evaluates to %s"],[Fe,In+"Treatment found: %s"],[Le,In+"All predicates evaluated, no treatment found."],[De,An+': using algo "murmur" bucket %s for key %s using seed %s - treatment %s'],[10,On+'[IN_SPLIT_TREATMENT] parent feature flag "%s" evaluated to "%s" with label "%s". %s evaluated treatment is part of %s ? %s.'],[11,On+'[IN_SPLIT_TREATMENT] will evaluate parent feature flag: "%s" with key: %s %s'],[Me,Fn+"Extracted attribute `%s`. %s will be used for matching."],[Ke,An+":sanitize: Attempted to sanitize %s which should be of type %s. Sanitized and processed value => %s"],[Je,On+"[%s] Result: %s. Rule value: %s. Evaluation value: %s"],[Ye,An+"Evaluates to default treatment. %s"],[25,Wn+"Registering cleanup handler %s"],[26,Wn+"Deregistering cleanup handler %s"],[xe,"Retrieving default SDK client."],[Pe,"Retrieving existing SDK client."],[Ue,"Retrieving manager instance."],[Be,Mn+"Feature flags data: \n%s"],[je,xn+"Spin up feature flags update using since = %s and rbSince = %s."],[qe,xn+"New feature flags: %s. Removed feature flags: %s."],[ze,xn+"New rule-based segments: %s. Removed rule-based segments: %s."],[We,Kn+"New SSE message received, with data: %s."],[Ge,Ln+": Starting %s. Running each %s millis"],[He,Ln+": Running %s"],[Qe,Ln+": Stopping %s"],[Ve,wn+': feature flags filtering criteria is "%s".']]);return Za.SplitFactory=Za,Za.InLocalStorage=function(e){void 0===e&&(e={});var t=function(e){return e?e+".SPLITIO":"SPLITIO"}(e.prefix);function n(n){var r=n.settings,i=n.settings,s=i.log,o=i.scheduler,a=o.impressionsQueueSize,u=o.eventsQueueSize,c=lu(s,t,e.wrapper);if(!c)return Gr(n);var l,f=Mr(r.core.key),h=new eu(t,f),p=new iu(r,h,c),g=new su(r,h,c),d=new ou(s,h,c),m=new ou(s,tu(t,f),c);return{splits:p,rbSegments:g,segments:d,largeSegments:m,impressions:new Ir(a),impressionCounts:new Dr,events:new Or(u),telemetry:Br(n)?new jr(p,d):void 0,uniqueKeys:new zr,validateCache:function(){return l||(l=function(e,t,n,r,i,s,o,a){return Promise.resolve(t.load&&t.load()).then((function(){var u=Date.now(),c=i.getChangeNumber()>-1;if(cu(e,t,n,r,u,c)){i.clear(),s.clear(),o.clear(),a.clear();try{t.setItem(r.buildLastClear(),u+"")}catch(e){n.log.error(nu+e)}return t.save&&t.save(),!1}return c}))}(e,c,r,h,p,g,d,m))},save:function(){return c.save&&c.save()},destroy:function(){return c.whenSaved&&c.whenSaved()},shared:function(e){return{splits:this.splits,rbSegments:this.rbSegments,segments:new ou(s,new eu(t,e),c),largeSegments:new ou(s,tu(t,e),c),impressions:this.impressions,impressionCounts:this.impressionCounts,events:this.events,telemetry:this.telemetry,uniqueKeys:this.uniqueKeys,destroy:function(){}}}}}return n.type=A,n},Za.ErrorLogger=function(){return new Er({logLevel:"ERROR"},new Map(fu))},Za.WarnLogger=function(){return new Er({logLevel:"WARN"},new Map(hu))},Za.InfoLogger=function(){return new Er({logLevel:"INFO"},new Map(gu))},Za.DebugLogger=function(){return new Er({logLevel:"DEBUG"},new Map(du))},Za}));