@launchdarkly/akamai-server-base-sdk 3.0.10 → 3.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- import*as e from"crypto";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})}),r}var i={},n={},s={};Object.defineProperty(s,"__esModule",{value:!0});s.default=class{constructor(e){this._onRequestStatus=e}getStatus(){return this._lastStatus}async requireStatus(){return this._lastStatus||await this._onRequestStatus(),this._lastStatus}notify(){var e;this._lastStatus&&(null===(e=this._listener)||void 0===e||e.call(this,this._lastStatus))}setListener(e){this._listener=e}setStatus(e){this._lastStatus=e}};var a={},o={};!function(e){function t(e){return e.indexOf("~")?e.replace(/~1/g,"/").replace(/~0/g,"~"):e}class r{constructor(e,r=!1){if(r){const t=e;this._components=[t],this.isValid=""!==t,this.redactionName=t.startsWith("/")?`/${t.replace(/~/g,"~0").replace(/\//g,"~1")}`:t}else{if(this.redactionName=e,""===e||"/"===e||e.match(/\/\/|(^\/.*~[^0|^1])|~$/))return this.isValid=!1,void(this._components=[]);!function(e){return!e.startsWith("/")}(e)?e.indexOf("/",1)<0?this._components=[t(e.slice(1))]:this._components=function(e){return(e.startsWith("/")?e.substring(1):e).split("/").map(e=>t(e))}(e):this._components=[e],"_meta"===this._components[0]?this.isValid=!1:this.isValid=!0}}get(e){const{_components:t,isValid:r}=this;if(!r)return;let i=e;for(let e=0;e<t.length;e+=1){const r=t[e];if(null==i||!Object.prototype.hasOwnProperty.call(i,r)||"object"!=typeof i||Array.isArray(i))return;i=i[r]}return i}getComponent(e){return this._components[e]}get depth(){return this._components.length}get isKind(){return 1===this._components.length&&"kind"===this._components[0]}compare(e){return this.depth===e.depth&&this._components.every((t,r)=>t===e.getComponent(r))}get components(){return[...this._components]}}r.InvalidReference=new r("");class i{is(e){if(Array.isArray(e))return!1;const t=typeof e;return"function"===t||"object"===t}getType(){return"factory method or object"}}class n{constructor(e,t){this._typeName=e,this.typeOf=typeof t}is(e){return!Array.isArray(e)&&typeof e===this.typeOf}getType(){return this._typeName}}class s{constructor(e,t){this._typeName=e,this.typeOf=typeof t}is(e){return!!Array.isArray(e)&&(!(e.length>0)||e.every(e=>typeof e===this.typeOf))}getType(){return this._typeName}}class a extends n{constructor(e){super(`number with minimum value of ${e}`,0),this.min=e}is(e){return typeof e===this.typeOf&&e>=this.min}}class o extends n{constructor(e){super(`string matching ${e}`,""),this.expression=e}is(e){return"string"==typeof e&&!!e.match(this.expression)}}class l{is(e){return"function"==typeof e}getType(){return"function"}}class c{is(e){return"boolean"==typeof e||null==e}getType(){return"boolean | undefined | null"}}const u=/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d*)?(Z|[-+]\d\d(:\d\d)?)/;class d{is(e){return"number"==typeof e||"string"==typeof e&&u.test(e)}getType(){return"date"}}class h extends o{constructor(){super(/^(\w|\.|-)+$/)}is(e){return super.is(e)&&"kind"!==e}}class f{static createTypeArray(e,t){return new s(e,t)}static numberWithMin(e){return new a(e)}static stringMatchingRegex(e){return new o(e)}}function p(e){return"kind"in e&&(f.String.is(e.kind)&&"multi"!==e.kind)}function v(e){return"kind"in e&&(f.String.is(e.kind)&&"multi"===e.kind)}function g(e){return!("kind"in e)||null===e.kind||void 0===e.kind}function _(e,t=[]){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(t.includes(e))throw new Error("Cycle detected");if(Array.isArray(e)){return`[${e.map(r=>_(r,[...t,e])).map(e=>void 0===e?"null":e).join(",")}]`}return`{${Object.keys(e).sort().map(r=>{const i=_(e[r],[...t,e]);if(void 0!==i)return`${JSON.stringify(r)}:${i}`}).filter(e=>void 0!==e).join(",")}}`}f.String=new n("string",""),f.Number=new n("number",0),f.ObjectOrFactory=new i,f.Object=new n("object",{}),f.StringArray=new s("string[]",""),f.Boolean=new n("boolean",!0),f.Function=new l,f.Date=new d,f.Kind=new h,f.NullableBoolean=new c;const y="user";function m(e){return e.includes("%")||e.includes(":")?e.replace(/%/g,"%25").replace(/:/g,"%3A"):e}function b(e){return f.Kind.is(e)}function S(e){return f.String.is(e)&&""!==e}function E(e,t=!1){return e?e.map(e=>new r(e,t)):[]}class w{constructor(e,t,r){this._isMulti=!1,this._isUser=!1,this._wasLegacy=!1,this._contexts={},this.kind=t,this.valid=e,this.message=r}static _contextForError(e,t){return new w(!1,e,t)}static _getValueFromContext(e,t){if(t&&e.isValid)return 1===e.depth&&"anonymous"===e.getComponent(0)?!!t?.anonymous:e.get(t)}_contextForKind(e){return this._isMulti?this._contexts[e]:this.kind===e?this._context:void 0}static _fromMultiKindContext(e){const t=Object.keys(e).filter(e=>"kind"!==e),r=t.every(b);if(!t.length)return w._contextForError("multi","A multi-kind context must contain at least one kind");if(!r)return w._contextForError("multi","Context contains invalid kinds");const i={};let n=!0;const s=t.reduce((t,r)=>{const s=e[r];var a;return(a=s)&&f.Object.is(a)?(t[r]=s,i[r]=E(s._meta?.privateAttributes)):n=!1,t},{});if(!n)return w._contextForError("multi","Context contained contexts that were not objects");if(!Object.values(s).every(e=>S(e.key)))return w._contextForError("multi","Context contained invalid keys");if(1===t.length){const e=t[0],r=new w(!0,e);return r._context={...s[e],kind:e},r._privateAttributeReferences=i,r._isUser="user"===e,r}const a=new w(!0,e.kind);return a._contexts=s,a._privateAttributeReferences=i,a._isMulti=!0,a}static _fromSingleKindContext(e){const{key:t,kind:r}=e,i=b(r),n=S(t);if(!i)return w._contextForError(r??"unknown","The kind was not valid for the context");if(!n)return w._contextForError(r,"The key for the context was not valid");const s=E(e._meta?.privateAttributes),a=new w(!0,r);return a._isUser="user"===r,a._context=e,a._privateAttributeReferences={[r]:s},a}static _fromLegacyUser(e){if(!(void 0!==e.key&&null!==e.key))return w._contextForError("user","The key for the context was not valid");const t=new w(!0,"user");return t._isUser=!0,t._wasLegacy=!0,t._context=function(e){const t={...e.custom||[],kind:"user",key:String(e.key)};if(null!=e.anonymous){const r=!!e.anonymous;delete t.anonymous,t.anonymous=r}return null!==e.name&&void 0!==e.name&&(t.name=e.name),null!==e.ip&&void 0!==e.ip&&(t.ip=e.ip),null!==e.firstName&&void 0!==e.firstName&&(t.firstName=e.firstName),null!==e.lastName&&void 0!==e.lastName&&(t.lastName=e.lastName),null!==e.email&&void 0!==e.email&&(t.email=e.email),null!==e.avatar&&void 0!==e.avatar&&(t.avatar=e.avatar),null!==e.country&&void 0!==e.country&&(t.country=e.country),null!==e.privateAttributeNames&&void 0!==e.privateAttributeNames&&(t._meta={privateAttributes:e.privateAttributeNames}),t}(e),t._privateAttributeReferences={user:E(e.privateAttributeNames,!0)},t}static fromLDContext(e){return e?p(e)?w._fromSingleKindContext(e):v(e)?w._fromMultiKindContext(e):g(e)?w._fromLegacyUser(e):w._contextForError("unknown","Context was not of a valid kind"):w._contextForError("unknown","No context specified. Returning default value")}static toLDContext(e){if(!e.valid)return;const t=e.getContexts();if(!e._isMulti)return t[0][1];const r={kind:"multi"};return t.forEach(e=>{const t=e[0],i=e[1];r[t]=i}),r}valueForKind(e,t=y){return e.isKind?this.kinds:w._getValueFromContext(e,this._contextForKind(t))}key(e=y){return this._contextForKind(e)?.key}get isMultiKind(){return this._isMulti}get canonicalKey(){return this._isUser?this._context.key:this._isMulti?Object.keys(this._contexts).sort().map(e=>`${e}:${m(this._contexts[e].key)}`).join(":"):`${this.kind}:${m(this._context.key)}`}get kinds(){return this._isMulti?Object.keys(this._contexts):[this.kind]}get kindsAndKeys(){return this._isMulti?Object.entries(this._contexts).reduce((e,[t,r])=>(e[t]=r.key,e),{}):{[this.kind]:this._context.key}}privateAttributes(e){return this._privateAttributeReferences?.[e]||[]}getContexts(){return this._isMulti?Object.entries(this._contexts):[[this.kind,this._context]]}get legacy(){return this._wasLegacy}canonicalUnfilteredJson(){if(this.valid){if(this._cachedCanonicalJson)return this._cachedCanonicalJson;try{this._cachedCanonicalJson=_(w.toLDContext(this))}catch{}return this._cachedCanonicalJson}}}w.UserKind=y;const k=["key","kind","_meta","anonymous"].map(e=>new r(e,!0)),O=["name","ip","firstName","lastName","email","avatar","country"];class x{constructor(e,t){this._allAttributesPrivate=e,this._privateAttributes=t}filter(e,t=!1){const r=e.getContexts();if(1===r.length)return this._filterSingleKind(e,r[0][1],r[0][0],t);const i={kind:"multi"};return r.forEach(([r,n])=>{i[r]=this._filterSingleKind(e,n,r,t)}),i}_getAttributesToFilter(e,t,i,n){return(n?Object.keys(t).map(e=>new r(e,!0)):[...this._privateAttributes,...e.privateAttributes(i)]).filter(e=>!k.some(t=>t.compare(e)))}_filterSingleKind(e,t,r,i){const n=this._allAttributesPrivate||i&&!0===t.anonymous,{cloned:s,excluded:a}=function(e,t){const r=[],i={},n=[];for(r.push(...Object.keys(e).map(t=>({key:t,ptr:[t],source:e,parent:i,visited:[e]})));r.length;){const e=r.pop(),i=t.find(t=>{return r=t,i=e.ptr,r.depth===i.length&&i.every((e,t)=>e===r.getComponent(t));var r,i});if(i)n.push(i.redactionName);else{const t=e.source[e.key];null===t?e.parent[e.key]=t:Array.isArray(t)?e.parent[e.key]=[...t]:"object"==typeof t?e.visited.includes(t)||(e.parent[e.key]={},r.push(...Object.keys(t).map(r=>({key:r,ptr:[...e.ptr,r],source:t,parent:e.parent[e.key],visited:[...e.visited,t]})))):e.parent[e.key]=t}}return{cloned:i,excluded:n.sort()}}(t,this._getAttributesToFilter(e,t,r,n));return e.legacy&&O.forEach(e=>{e in s&&(s[e]=String(s[e]))}),a.length&&(s._meta||(s._meta={}),s._meta.redactedAttributes=a),s._meta&&(delete s._meta.privateAttributes,0===Object.keys(s._meta).length&&delete s._meta),s}}class D{constructor(e,t,r=Math.random){this._retryResetIntervalMillis=t,this._random=r,this._retryCount=0,this._initialRetryDelayMillis=Math.max(1,e),this._maxExponent=Math.ceil(Math.log2(3e4/this._initialRetryDelayMillis))}_backoff(){const e=Math.min(this._retryCount,this._maxExponent),t=this._initialRetryDelayMillis*2**e;return Math.min(t,3e4)}_jitter(e){return e-Math.trunc(.5*this._random()*e)}success(e=Date.now()){this._activeSince=e}fail(e=Date.now()){void 0!==this._activeSince&&e-this._activeSince>this._retryResetIntervalMillis&&(this._retryCount=0),this._activeSince=void 0;const t=this._jitter(this._backoff());return this._retryCount+=1,t}}class P{constructor(e,t){this._dataCallback=e,this._statusCallback=t,this._disabled=!1}disable(){this._disabled=!0}async dataHandler(e,t){this._disabled||this._dataCallback(e,t)}async statusHandler(e,t){this._disabled||this._statusCallback(e,t)}}var R;!function(e){e[e.Valid=0]="Valid",e[e.Initializing=1]="Initializing",e[e.Interrupted=2]="Interrupted",e[e.Closed=3]="Closed"}(R||(R={}));class I{constructor(e,t){this._list=t?[...t]:[],this._circular=e,this._pos=0}next(){if(this._list.length<=0||this._pos>=this._list.length)return;const e=this._list[this._pos];return this._circular?this._pos=(this._pos+1)%this._list.length:this._pos+=1,e}replace(e){this._list=[...e],this._pos=0}remove(e){const t=this._list.indexOf(e);return!(t<0)&&(this._list.splice(t,1),this._list.length>0&&(t<this._pos&&(this._pos-=1),this._circular&&this._pos>this._list.length-1&&(this._pos=0)),!0)}reset(){this._pos=0}pos(){return this._pos}length(){return this._list.length}clear(){this._list=[],this._pos=0}}class M extends Error{constructor(e){super(e),this.name="LaunchDarklyFileDataSourceError"}}class T extends Error{constructor(e,t,r,i=!0){super(t),this.kind=e,this.status=r,this.name="LaunchDarklyPollingError",this.recoverable=i}}class A extends Error{constructor(e,t,r,i=!0){super(t),this.kind=e,this.code=r,this.name="LaunchDarklyStreamingError",this.recoverable=i}}class C extends Error{constructor(e,t,r){super(t),this.kind=e,this.code=r,this.name="LDFlagDeliveryFallbackError",this.recoverable=!1}}var F,j,L,N;e.DataSourceErrorKind=void 0,(F=e.DataSourceErrorKind||(e.DataSourceErrorKind={})).Unknown="UNKNOWN",F.NetworkError="NETWORK_ERROR",F.ErrorResponse="ERROR_RESPONSE",F.InvalidData="INVALID_DATA",e.AutoEnvAttributes=void 0,(j=e.AutoEnvAttributes||(e.AutoEnvAttributes={}))[j.Disabled=0]="Disabled",j[j.Enabled=1]="Enabled",function(e){e[e.AnalyticsEvents=0]="AnalyticsEvents",e[e.DiagnosticEvent=1]="DiagnosticEvent"}(L||(L={})),function(e){e[e.Succeeded=0]="Succeeded",e[e.Failed=1]="Failed",e[e.FailedAndMustShutDown=2]="FailedAndMustShutDown"}(N||(N={}));var $=Object.freeze({__proto__:null,get DataSourceState(){return R},get LDDeliveryStatus(){return N},get LDEventType(){return L}});function B(e){if("string"==typeof e)return e;if(void 0===e)return"undefined";if(null===e)return"null";if(Object.prototype.hasOwnProperty.call(e,"toString"))try{return e.toString()}catch{}if("bigint"==typeof e)return`${e}n`;try{return JSON.stringify(e)}catch(e){return e instanceof TypeError&&e.message.indexOf("circular")>=0?"[Circular]":"[Not Stringifiable]"}}const V={s:e=>B(e),d:e=>function(e){return"symbol"==typeof e?"NaN":"bigint"==typeof e?`${e}n`:String(Number(e))}(e),i:e=>function(e){return"symbol"==typeof e?"NaN":"bigint"==typeof e?`${e}n`:String(parseInt(e,10))}(e),f:e=>function(e){return"symbol"==typeof e?"NaN":String(parseFloat(e))}(e),j:e=>B(e),o:e=>B(e),O:e=>B(e),c:()=>""};function z(...e){const t=e.shift();if(f.String.is(t)){let r="",i=0;for(;i<t.length;){const n=t.charAt(i);if("%"===n){if(i+1<t.length){const n=t.charAt(i+1);if(n in V&&e.length){const t=e.shift();r+=V[n]?.(t)}else r+="%"===n?"%":`%${n}`;i+=2}}else r+=n,i+=1}return e.length&&(r.length&&(r+=" "),r+=e.map(B).join(" ")),r}return e.map(B).join(" ")}var H;!function(e){e[e.debug=0]="debug",e[e.info=1]="info",e[e.warn=2]="warn",e[e.error=3]="error",e[e.none=4]="none"}(H||(H={}));const U=["debug","info","warn","error","none"];class K{static get(){return new K({})}constructor(e){if(this._logLevel=H[e.level??"info"]??H.info,this._name=e.name??"LaunchDarkly",this._formatter=e.formatter,"object"==typeof e.destination)this._destinations={[H.debug]:e.destination.debug,[H.info]:e.destination.info,[H.warn]:e.destination.warn,[H.error]:e.destination.error};else if("function"==typeof e.destination){const{destination:t}=e;this._destinations={[H.debug]:t,[H.info]:t,[H.warn]:t,[H.error]:t}}}_tryFormat(...e){try{return this._formatter?this._formatter?.(...e):z(...e)}catch{return z(...e)}}_tryWrite(e,t){try{e(t)}catch{console.error(t)}}_log(e,t){if(e>=this._logLevel){const r=`${U[e]}: [${this._name}]`;try{const i=this._destinations?.[e];i?this._tryWrite(i,`${r} ${this._tryFormat(...t)}`):console.error(...t)}catch{console.error(...t)}}}error(...e){this._log(H.error,e)}warn(...e){this._log(H.warn,e)}info(...e){this._log(H.info,e)}debug(...e){this._log(H.debug,e)}}const q={error:f.Function,warn:f.Function,info:f.Function,debug:f.Function};class W{constructor(e,t){Object.entries(q).forEach(([t,r])=>{if(!r.is(e[t]))throw new Error(`Provided logger instance must support logger.${t}(...) method`)}),this._logger=e,this._fallback=t}_log(e,t){try{this._logger[e](...t)}catch{this._fallback[e](...t)}}error(...e){this._log("error",e)}warn(...e){this._log("warn",e)}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}}class G{static deprecated(e,t){return`"${e}" is deprecated, please use "${t}"`}static optionBelowMinimum(e,t,r){return`Config option "${e}" had invalid value of ${t}, using minimum of ${r} instead`}static unknownOption(e){return`Ignoring unknown config option "${e}"`}static wrongOptionType(e,t,r){return`Config option "${e}" should be of type ${t}, got ${r}, using default value`}static wrongOptionTypeBoolean(e,t){return`Config option "${e}" should be a boolean, got ${t}, converting to boolean`}static invalidTagValue(e){return`Config option "${e}" must only contain letters, numbers, ., _ or -.`}static tagValueTooLong(e){return`Value of "${e}" was longer than 64 characters and was discarded.`}static partialEndpoint(e){return`You have set custom uris without specifying the ${e} URI; connections may not work properly`}}const X=f.stringMatchingRegex(/^(\w|\.|-)+$/),J=(e,t)=>X.is(e)?e.length>64?{valid:!1,message:G.tagValueTooLong(t)}:{valid:!0}:{valid:!1,message:G.invalidTagValue(t)};function Y(e){return e.replace(/\/+$/,"")}function Z(e){return e.replace(/^\/+/,"").replace(/\?$/,"")}class Q{constructor(e,t,r=Q.DEFAULT_EVENTS,i="/bulk",n="/diagnostic",s=!0,a){this.streaming=Y(e),this.polling=Y(t),this.events=Y(r),this.analyticsEventPath=i,this.diagnosticEventPath=n,this.includeAuthorizationHeader=s,this.payloadFilterKey=a}}function ee(e,t=[]){if(0===t.length)return e;return`${e}?${t.map(({key:e,value:t})=>`${e}=${t}`).join("&")}`}function te(e,t,r=[]){const i=Z(t);return ee(`${e.events}/${i}`,r)}Q.DEFAULT_EVENTS="https://events.launchdarkly.com";class re extends Error{constructor(e){super(e),this.name="LaunchDarklyUnexpectedResponseError"}}class ie extends Error{constructor(e){super(e),this.name="LaunchDarklyClientError"}}class ne extends Error{constructor(e){super(e),this.name="LaunchDarklyTimeoutError"}}function se(e){return!(e>=400&&e<500)||(400===e||408===e||429===e)}function ae(e){return 413===e||se(e)}const oe=(e,t)=>e?Object.entries(e).reduce((e,[r,i])=>(!Boolean(i)||(e=>"{}"===JSON.stringify(e))(i)||t?.includes(r)||(e[r]="object"==typeof i?oe(i,t):i),e),{}):e;function le(e,t,r){let i;i=e.status?`error ${e.status}${401===e.status?" (invalid SDK key)":""}`:`I/O error (${e.message||"unknown error"})`;return`Received ${i} for ${t} - ${r??"giving up permanently"}`}const ce=async(e=1e3)=>new Promise(e=>{});var ue;!function(e){e.MalformedFlag="MALFORMED_FLAG",e.UserNotSpecified="USER_NOT_SPECIFIED",e.FlagNotFound="FLAG_NOT_FOUND",e.ClientNotReady="CLIENT_NOT_READY",e.WrongType="WRONG_TYPE"}(ue||(ue={}));var de=ue;class he{static invalidMetricValue(e){return`The track function was called with a non-numeric "metricValue" (${e}), only numeric metric values are supported.`}}he.MissingContextKeyNoEvent="Context was unspecified or had no key; event will not be sent";class fe{constructor(e,t){const{basicConfiguration:r,platform:i}=e,{serviceEndpoints:{analyticsEventPath:n,diagnosticEventPath:s}}=r,{crypto:a,requests:o}=i;this._defaultHeaders={...t},this._eventsUri=te(r.serviceEndpoints,n,[]),this._diagnosticEventsUri=te(r.serviceEndpoints,s,[]),this._requests=o,this._crypto=a}async _tryPostingEvents(e,t,r,i){const n={status:N.Succeeded},s={...this._defaultHeaders,"content-type":"application/json"};let a;r&&(s["x-launchdarkly-payload-id"]=r,s["x-launchDarkly-event-schema"]="4");try{const{status:r,headers:i}=await this._requests.fetch(t,{headers:s,body:JSON.stringify(e),compressBodyIfPossible:!0,method:"POST",keepalive:!0}),o=Date.parse(i.get("date")||"");if(o&&(n.serverTime=o),r<=204)return n;if(a=new re(le({status:r,message:"some events were dropped"},"event posting")),!se(r))return ae(r)?n.status=N.Failed:n.status=N.FailedAndMustShutDown,n.error=a,n}catch(e){a=e}return a&&!i?(n.status=N.Failed,n.error=a,n):(await ce(),this._tryPostingEvents(e,this._eventsUri,r,!1))}async sendEventData(e,t){const r=e===L.AnalyticsEvents?this._crypto.randomUUID():void 0,i=e===L.AnalyticsEvents?this._eventsUri:this._diagnosticEventsUri;return this._tryPostingEvents(t,i,r,!0)}}function pe(e){return"feature"===e.kind}class ve{constructor(e,t,r,i,n,s){this.count=e,this.key=t,this.value=r,this.version=n,this.variation=s,this.default=i}increment(){this.count+=1}}class ge{constructor(e=!1,t){this._singleContext=e,this._contextFilter=t,this._startDate=0,this._endDate=0,this._counters={},this._contextKinds={}}summarizeEvent(e){if(pe(e)&&!e.excludeFromSummaries){this._context||(this._context=e.context);const t=function(e){return`${e.key}:${null!==e.variation&&void 0!==e.variation?e.variation:""}:${null!==e.version&&void 0!==e.version?e.version:""}`}(e),r=this._counters[t];let i=this._contextKinds[e.key];i||(i=new Set,this._contextKinds[e.key]=i),e.context.kinds.forEach(e=>i.add(e)),r?r.increment():this._counters[t]=new ve(1,e.key,e.value,e.default,e.version,e.variation),(0===this._startDate||e.creationDate<this._startDate)&&(this._startDate=e.creationDate),e.creationDate>this._endDate&&(this._endDate=e.creationDate)}}getSummary(){const e=Object.values(this._counters).reduce((e,t)=>{let r=e[t.key];r||(r={default:t.default,counters:[],contextKinds:[...this._contextKinds[t.key]]},e[t.key]=r);const i={value:t.value,count:t.count};return void 0!==t.variation&&null!==t.variation&&(i.variation=t.variation),void 0!==t.version&&null!==t.version?i.version=t.version:i.unknown=!0,r.counters.push(i),e},{}),t={startDate:this._startDate,endDate:this._endDate,features:e,kind:"summary",context:void 0!==this._context&&this._singleContext?this._contextFilter?.filter(this._context):void 0};return this._clearSummary(),t}_clearSummary(){this._startDate=0,this._endDate=0,this._counters={},this._contextKinds={}}}class _e extends Error{constructor(e){super(e),this.name="LaunchDarklyInvalidSDKKeyError"}}class ye{constructor(e,t){this._contextFilter=e,this._logger=t,this._summarizers={}}summarizeEvent(e){if(pe(e)){const t=e.context.canonicalUnfilteredJson();if(!t)return void(e.context.valid&&this._logger?.error("Unable to serialize context, likely the context contains a cycle."));let r=this._summarizers[t];r||(this._summarizers[t]=new ge(!0,this._contextFilter),r=this._summarizers[t]),r.summarizeEvent(e)}}getSummaries(){const e=this._summarizers;return this._summarizers={},Object.values(e).map(e=>e.getSummary())}}function me(e){const t=Math.trunc(e);return 1===t||0!==t&&0===Math.floor(Math.random()*t)}class be{constructor(e,t,r,i,n=1,s){this.context=e,this.key=t,this.data=r,this.metricValue=i,this.samplingRatio=n,this.url=s,this.kind="custom",this.creationDate=Date.now(),this.context=e}}class Se{constructor(e,t,r,i,n,s,a,o,l,c,u,d,h=1){this.withReasons=e,this.context=t,this.key=r,this.samplingRatio=h,this.kind="feature",this.creationDate=Date.now(),this.value=i,this.default=n,void 0!==s&&(this.version=s),void 0!==a&&(this.variation=a),void 0!==o&&(this.trackEvents=o),void 0!==l&&(this.prereqOf=l),void 0!==c&&(this.reason=c),void 0!==u&&(this.debugEventsUntilDate=u),void 0!==d&&(this.excludeFromSummaries=d)}}class Ee{constructor(e,t=1){this.context=e,this.samplingRatio=t,this.kind="identify",this.creationDate=Date.now()}}class we{constructor(e,t,r){this._objProcessors=e,this._errorHandler=t,this._logger=r,this._listeners=[],this._tempId=void 0,this._tempBasis=!1,this._tempUpdates=[],this._processServerIntent=e=>{if(this._resetAll(),!e.payloads.length)return;const t=e.payloads[0];switch(t?.intentCode){case"xfer-full":this._tempBasis=!0;break;case"xfer-changes":this._tempBasis=!1;break;case"none":this._tempBasis=!1,this._processIntentNone(t);break;default:return void this._logger?.warn(`Unable to process intent code '${t?.intentCode}'.`)}this._tempId=t?.id},this._processPutObject=e=>{if(!(this._tempId&&e.kind&&e.key&&e.version&&e.object))return;const t=this._processObj(e.kind,e.object);t?this._tempUpdates.push({kind:e.kind,key:e.key,version:e.version,object:t}):this._logger?.warn(`Unable to process object for kind: '${e.kind}'`)},this._processDeleteObject=e=>{this._tempId&&e.kind&&e.key&&e.version&&this._tempUpdates.push({kind:e.kind,key:e.key,version:e.version,deleted:!0})},this._processIntentNone=e=>{if(!e.id||!e.target)return;const t={id:e.id,version:e.target,basis:!1,updates:[]};this._listeners.forEach(e=>e(t)),this._resetAfterEmission()},this._processPayloadTransferred=e=>{if(!this._tempId||!e.state||!e.version)return void this._resetAll();const t={id:this._tempId,version:e.version,state:e.state,basis:this._tempBasis,updates:this._tempUpdates};this._listeners.forEach(e=>e(t)),this._resetAfterEmission()},this._processGoodbye=e=>{this._logger?.info(`Goodbye was received from the LaunchDarkly connection with reason: ${e.reason}.`),this._resetAll()},this._processError=e=>{this._logger?.info(`An issue was encountered receiving updates for payload ${this._tempId} with reason: ${e.reason}.`),this._resetAfterError()}}addPayloadListener(e){this._listeners.push(e)}removePayloadListener(e){const t=this._listeners.indexOf(e,0);t>-1&&this._listeners.splice(t,1)}processEvents(e){e.forEach(e=>{switch(e.event){case"server-intent":this._processServerIntent(e.data);break;case"put-object":this._processPutObject(e.data);break;case"delete-object":this._processDeleteObject(e.data);break;case"payload-transferred":this._processPayloadTransferred(e.data);break;case"goodbye":this._processGoodbye(e.data);break;case"error":this._processError(e.data)}})}_processObj(e,t){return this._objProcessors[e]?.(t)}_resetAfterEmission(){this._tempBasis=!1,this._tempUpdates=[]}_resetAfterError(){this._tempUpdates=[]}_resetAll(){this._tempId=void 0,this._tempBasis=!1,this._tempUpdates=[]}}const ke="unknown plugin";function Oe(e,t){try{return t.getMetadata().name||ke}catch{return e.error("Exception thrown getting metadata for plugin. Unable to get plugin name."),ke}}var xe=Object.freeze({__proto__:null,ClientMessages:he,DiagnosticsManager:class{constructor(e,t,r){this._platform=t,this._diagnosticInitConfig=r,this._streamInits=[],this._startTime=Date.now(),this._dataSinceDate=this._startTime,this._id={diagnosticId:t.crypto.randomUUID(),sdkKeySuffix:e.length>6?e.substring(e.length-6):e}}createInitEvent(){const e=this._platform.info.sdkData(),t=this._platform.info.platformData();return{kind:"diagnostic-init",id:this._id,creationDate:this._startTime,sdk:e,configuration:this._diagnosticInitConfig,platform:{name:t.name,osArch:t.os?.arch,osName:t.os?.name,osVersion:t.os?.version,...t.additional||{}}}}recordStreamInit(e,t,r){const i={timestamp:e,failed:t,durationMillis:r};this._streamInits.push(i)}createStatsEventAndReset(e,t,r){const i=Date.now(),n={kind:"diagnostic",id:this._id,creationDate:i,dataSinceDate:this._dataSinceDate,droppedEvents:e,deduplicatedUsers:t,eventsInLastBatch:r,streamInits:this._streamInits};return this._streamInits=[],this._dataSinceDate=i,n}},ErrorKinds:de,EventFactoryBase:class{constructor(e){this._withReasons=e}evalEvent(e){return new Se(this._withReasons,e.context,e.flagKey,e.value,e.defaultVal,e.version,e.variation??void 0,e.trackEvents||e.addExperimentData,e.prereqOfFlagKey,this._withReasons||e.addExperimentData?e.reason:void 0,e.debugEventsUntilDate,e.excludeFromSummaries,e.samplingRatio)}unknownFlagEvent(e,t,r){return new Se(this._withReasons,r,e,t,t,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}identifyEvent(e){return new Ee(e,1)}customEvent(e,t,r,i,n=1){return new be(t,e,r??void 0,i??void 0,n)}},EventProcessor:class{constructor(e,t,i,n,s,a=!0,o=!1){this._config=e,this._contextDeduplicator=n,this._diagnosticsManager=s,this._queue=[],this._lastKnownPastTime=0,this._droppedEvents=0,this._deduplicatedUsers=0,this._exceededCapacity=!1,this._eventsInLastBatch=0,this._shutdown=!1,this._flushUsersTimer=null,this._capacity=e.eventsCapacity,this._logger=t.basicConfiguration.logger,this._eventSender=new fe(t,i),this._contextFilter=new x(e.allAttributesPrivate,e.privateAttributes.map(e=>new r(e))),this._summarizer=o?new ye(this._contextFilter,this._logger):new ge,a&&this.start()}start(){if(void 0!==this._contextDeduplicator?.flushInterval&&(this._flushUsersTimer=void this._contextDeduplicator.flushInterval),this._flushTimer=void this._config.flushInterval,this._diagnosticsManager){const e=this._diagnosticsManager.createInitEvent();this._postDiagnosticEvent(e),this._diagnosticsTimer=void this._config.diagnosticRecordingInterval}this._logger?.debug("Started EventProcessor.")}_postDiagnosticEvent(e){this._eventSender.sendEventData(L.DiagnosticEvent,e)}close(){clearInterval(this._flushTimer),this._flushUsersTimer&&clearInterval(this._flushUsersTimer),this._diagnosticsTimer&&clearInterval(this._diagnosticsTimer)}async flush(){if(this._shutdown)throw new _e("Events cannot be posted because a permanent error has been encountered. This is most likely an invalid SDK key. The specific error information is logged independently.");const e=this._queue;if(this._queue=[],void 0!==this._summarizer.getSummaries){this._summarizer.getSummaries().forEach(t=>{Object.keys(t.features).length&&e.push(t)})}else{const t=this._summarizer.getSummary();Object.keys(t.features).length&&e.push(t)}e.length&&(this._eventsInLastBatch=e.length,this._logger?.debug("Flushing %d events",e.length),await this._tryPostingEvents(e))}sendEvent(e){if(this._shutdown)return;if("migration_op"===e.kind){if(me(e.samplingRatio)){const t={...e,context:e.context?this._contextFilter.filter(e.context):void 0};1===t.samplingRatio&&delete t.samplingRatio,this._enqueue(t)}return}this._summarizer.summarizeEvent(e);const t=pe(e),r=t&&e.trackEvents||!t,i=this._shouldDebugEvent(e),n=function(e){return"identify"===e.kind}(e),s=this._contextDeduplicator?.processContext(e.context);s||n||(this._deduplicatedUsers+=1);s&&!n&&this._enqueue(this._makeOutputEvent({kind:"index",creationDate:e.creationDate,context:e.context,samplingRatio:1},!1)),r&&me(e.samplingRatio)&&this._enqueue(this._makeOutputEvent(e,!1)),i&&me(e.samplingRatio)&&this._enqueue(this._makeOutputEvent(e,!0))}_makeOutputEvent(e,t){switch(e.kind){case"feature":{const r={kind:t?"debug":"feature",creationDate:e.creationDate,context:this._contextFilter.filter(e.context,!t),key:e.key,value:e.value,default:e.default};return 1!==e.samplingRatio&&(r.samplingRatio=e.samplingRatio),e.prereqOf&&(r.prereqOf=e.prereqOf),void 0!==e.variation&&(r.variation=e.variation),void 0!==e.version&&(r.version=e.version),e.reason&&(r.reason=e.reason),r}case"index":case"identify":{const t={kind:e.kind,creationDate:e.creationDate,context:this._contextFilter.filter(e.context)};return 1!==e.samplingRatio&&(t.samplingRatio=e.samplingRatio),t}case"custom":{const t={kind:"custom",creationDate:e.creationDate,key:e.key,context:this._contextFilter.filter(e.context)};return 1!==e.samplingRatio&&(t.samplingRatio=e.samplingRatio),void 0!==e.data&&(t.data=e.data),void 0!==e.metricValue&&(t.metricValue=e.metricValue),void 0!==e.url&&(t.url=e.url),t}case"click":return{kind:"click",creationDate:e.creationDate,contextKeys:e.context.kindsAndKeys,key:e.key,url:e.url,selector:e.selector};case"pageview":return{kind:"pageview",creationDate:e.creationDate,contextKeys:e.context.kindsAndKeys,key:e.key,url:e.url};default:return e}}_enqueue(e){this._queue.length<this._capacity?(this._queue.push(e),this._exceededCapacity=!1):(this._exceededCapacity||(this._exceededCapacity=!0,this._logger?.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),this._droppedEvents+=1)}_shouldDebugEvent(e){return pe(e)&&e.debugEventsUntilDate&&e.debugEventsUntilDate>this._lastKnownPastTime&&e.debugEventsUntilDate>Date.now()}async _tryPostingEvents(e){const t=await this._eventSender.sendEventData(L.AnalyticsEvents,e);if(t.status===N.FailedAndMustShutDown&&(this._shutdown=!0),t.serverTime&&(this._lastKnownPastTime=t.serverTime),t.error)throw t.error}},InputCustomEvent:be,InputEvalEvent:Se,InputIdentifyEvent:Ee,NullEventProcessor:class{close(){}async flush(){}sendEvent(){}},PayloadProcessor:we,PayloadStreamReader:class{constructor(e,t,r,i){this._errorHandler=r,this._logger=i,this._attachHandler(e,"server-intent"),this._attachHandler(e,"put-object"),this._attachHandler(e,"delete-object"),this._attachHandler(e,"payload-transferred"),this._attachHandler(e,"goodbye"),this._attachHandler(e,"error"),this._payloadProcessor=new we(t,r,i)}addPayloadListener(e){this._payloadProcessor.addPayloadListener(e)}removePayloadListener(e){this._payloadProcessor.removePayloadListener(e)}_attachHandler(t,r){t.addEventListener(r,async t=>{if(t?.data){this._logger?.debug(`Received ${r} event. Data is ${t.data}`);try{this._payloadProcessor.processEvents([{event:r,data:JSON.parse(t.data)}])}catch{this._logger?.error(`Stream received data that was unable to be processed in "${r}" message`),this._logger?.debug(`Data follows: ${t.data}`),this._errorHandler?.(e.DataSourceErrorKind.InvalidData,"Malformed data in EventStream.")}}else this._errorHandler?.(e.DataSourceErrorKind.Unknown,"Event from EventStream missing data.")})}},canonicalize:_,initMetadataFromHeaders:function(e){if(e){const t=Object.keys(e).find(e=>"x-ld-envid"===e.toLowerCase());if(t)return{environmentId:e[t]}}},isLegacyUser:g,isMultiKind:v,isSingleKind:p,safeGetHooks:function(e,t,r){const i=[];return r.forEach(r=>{try{const n=r.getHooks?.(t);void 0===n?e.error(`Plugin ${Oe(e,r)} returned undefined from getHooks.`):n&&n.length>0&&i.push(...n)}catch(t){e.error(`Exception thrown getting hooks for plugin ${Oe(e,r)}. Unable to get hooks.`)}}),i},safeGetName:Oe,safeRegisterPlugins:function(e,t,r,i){i.forEach(i=>{try{i.register(r,t)}catch(t){e.error(`Exception thrown registering plugin ${Oe(e,i)}.`)}})},shouldSample:me});e.ApplicationTags=class{constructor(e){const t={},r=e?.application,i=e?.logger;r&&Object.entries(r).forEach(([e,r])=>{if(null!=r){const{valid:n,message:s}=J(r,`application.${e}`);n?"versionName"===e?t["application-version-name"]=[r]:t[`application-${e}`]=[r]:i?.warn(s)}});const n=Object.keys(t);n.length&&(this.value=n.sort().flatMap(e=>t[e].sort().map(t=>`${e}/${t}`)).join(" "))}},e.AttributeReference=r,e.BasicLogger=K,e.ClientContext=class{constructor(e,t,r){this.platform=r,this.basicConfiguration={tags:t.tags,logger:t.logger,offline:t.offline,serviceEndpoints:t.serviceEndpoints,sdkKey:e}}},e.CompositeDataSource=class{constructor(e,t,r,i,n={[R.Valid]:{durationMS:3e5,transition:"recover"},[R.Interrupted]:{durationMS:12e4,transition:"fallback"}},s=new D(1e3,3e4)){this._logger=i,this._transitionConditions=n,this._backoff=s,this._stopped=!0,this._cancelTokens=[],this._cancellableDelay=e=>{let t;return{promise:new Promise((e,r)=>{t=e=>{e()}}),cancel(){t&&(clearTimeout(t),t=void 0)}}},this._externalTransitionPromise=new Promise(e=>{this._externalTransitionResolve=e}),this._initPhaseActive=e.length>0,this._initFactories=new I(!1,e),this._syncFactories=new I(!0,t),this._fdv1Synchronizers=new I(!0,r)}async start(e,t,r){if(!this._stopped)return void this._logger?.info("CompositeDataSource already running. Ignoring call to start.");this._stopped=!1,this._logger?.debug(`CompositeDataSource starting with (${this._initFactories.length()} initializers, ${this._syncFactories.length()} synchronizers).`);const i=this._wrapStatusCallbackWithSanitizer(t);let n;for(i(R.Initializing);;){const{dataSource:s,isPrimary:a,cullDSFactory:o}=this._pickDataSource(n),l=new Promise(t=>{if(s){let n,l=()=>{};const c=new P((r,n)=>{this._backoff.success(),e(r,n),r&&this._initPhaseActive&&(c.disable(),this._consumeCancelToken(l),i(R.Interrupted),t({transition:"switchToSync"}))},(e,r)=>{if(this._logger?.debug(`CompositeDataSource received state ${e} from underlying data source. Err is ${r}`),r||e===R.Closed)c.disable(),!1===r?.recoverable&&(this._logger?.debug(`Culling data source due to err ${r}`),o?.(),r instanceof C&&(this._logger?.debug("Falling back to FDv1"),this._syncFactories=this._fdv1Synchronizers)),i(e,r),this._consumeCancelToken(l),t({transition:"fallback",err:r});else if(i(e),e!==n){n=e,this._consumeCancelToken(l);const r=this._lookupTransitionCondition(e,a);if(r){const{promise:e,cancel:n}=this._cancellableDelay(r.durationMS);l=n,this._cancelTokens.push(l),e.then(()=>{this._consumeCancelToken(n),c.disable(),i(R.Interrupted),t({transition:r.transition})})}}});s.start((e,t)=>c.dataHandler(e,t),(e,t)=>c.statusHandler(e,t),r)}else t({transition:"stop",err:{name:"ExhaustedDataSources",message:"CompositeDataSource has exhausted all configured initializers and synchronizers."}})});let c=await Promise.race([l,this._externalTransitionPromise]);if(s?.stop(),c.err&&"stop"!==c.transition){const e=this._initPhaseActive?0:this._backoff.fail(),{promise:t,cancel:r}=this._cancellableDelay(e);this._cancelTokens.push(r);const i=t.then(()=>(this._consumeCancelToken(r),c));c=await Promise.race([i,this._externalTransitionPromise]),this._consumeCancelToken(r)}if(n=c.transition,"stop"===c.transition){t(R.Closed,c.err);break}}this._reset()}async stop(){this._cancelTokens.forEach(e=>e()),this._cancelTokens=[],this._externalTransitionResolve?.({transition:"stop"})}_reset(){this._stopped=!0,this._initPhaseActive=this._initFactories.length()>0,this._initFactories.reset(),this._syncFactories.reset(),this._fdv1Synchronizers.reset(),this._externalTransitionPromise=new Promise(e=>{this._externalTransitionResolve=e})}_pickDataSource(e){let t,r;switch(e){case"switchToSync":this._initPhaseActive=!1,this._syncFactories.reset(),r=0===this._syncFactories.pos(),t=this._syncFactories.next();break;case"recover":this._initPhaseActive?(this._initFactories.reset(),r=0===this._initFactories.pos(),t=this._initFactories.next()):(this._syncFactories.reset(),r=0===this._syncFactories.pos(),t=this._syncFactories.next());break;default:this._initPhaseActive&&this._initFactories.pos()>=this._initFactories.length()&&(this._initPhaseActive=!1,this._syncFactories.reset()),this._initPhaseActive?(r=0===this._initFactories.pos(),t=this._initFactories.next()):(r=0===this._syncFactories.pos(),t=this._syncFactories.next())}return t?{dataSource:t(),isPrimary:r,cullDSFactory:()=>{t&&this._syncFactories.remove(t)}}:{dataSource:void 0,isPrimary:r,cullDSFactory:void 0}}_lookupTransitionCondition(e,t){const r=this._transitionConditions[e];if(!t||"recover"!==r?.transition)return r}_consumeCancelToken(e){e();const t=this._cancelTokens.indexOf(e,0);t>-1&&this._cancelTokens.splice(t,1)}_wrapStatusCallbackWithSanitizer(e){let t,r,i=!1;return(n,s)=>{let a=n;if(n===R.Closed&&(a=R.Interrupted),a!==t||s!==r){if(a===R.Initializing){if(i)return;i=!0}t=a,r=s,e(a,s)}}}},e.Context=w,e.ContextFilter=x,e.DateValidator=d,e.DefaultBackoff=D,e.FactoryOrInstance=i,e.Function=l,e.KindValidator=h,e.LDClientError=ie,e.LDFileDataSourceError=M,e.LDFlagDeliveryFallbackError=C,e.LDPollingError=T,e.LDStreamingError=A,e.LDTimeoutError=ne,e.LDUnexpectedResponseError=re,e.NullableBoolean=c,e.NumberWithMinimum=a,e.OptionMessages=G,e.SafeLogger=W,e.ServiceEndpoints=Q,e.StringMatchingRegex=o,e.Type=n,e.TypeArray=s,e.TypeValidators=f,e.base64UrlEncode=(e,t)=>t.btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),e.cancelableTimedPromise=function(e,t){let r,i;return{promise:new Promise((e,t)=>{i=e,r=e=>{e()}}),cancel:()=>{i(),clearTimeout(r)}}},e.clone=function(e){return null==e?e:JSON.parse(JSON.stringify(e))},e.createSafeLogger=e=>{const t=new K({level:"info",destination:console.error,formatter:z});return e?new W(e,t):t},e.debounce=(e,t=5e3)=>{let r;return(...e)=>{clearTimeout(r),r=e=>{e()}}},e.deepCompact=oe,e.defaultHeaders=function(e,t,r,i=!0,n="user-agent"){const{userAgentBase:s,version:a,wrapperName:o,wrapperVersion:l}=t.sdkData(),c={[n]:`${s??"NodeJSClient"}/${a}`};return i&&(c.authorization=e),o&&(c["x-launchdarkly-wrapper"]=l?`${o}/${l}`:o),r?.value&&(c["x-launchdarkly-tags"]=r.value),c},e.fastDeepEqual=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var i,n,s;if(Array.isArray(t)){if((i=t.length)!=r.length)return!1;for(n=i;0!==n--;)if(!e(t[n],r[n]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;for(n of t.entries())if(!e(n[1],r.get(n[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((i=t.length)!=r.length)return!1;for(n=i;0!==n--;)if(t[n]!==r[n])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((i=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=i;0!==n--;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=i;0!==n--;){var a=s[n];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r},e.getEventsUri=te,e.getPollingUri=function(e,t,r=[]){const i=Z(t),n=[...r];return e.payloadFilterKey&&n.push({key:"filter",value:e.payloadFilterKey}),ee(`${e.polling}/${i}`,n)},e.getStreamingUri=function(e,t,r){const i=Z(t),n=[...r];return e.payloadFilterKey&&n.push({key:"filter",value:e.payloadFilterKey}),ee(`${e.streaming}/${i}`,n)},e.httpErrorMessage=le,e.internal=xe,e.isHttpLocallyRecoverable=ae,e.isHttpRecoverable=se,e.noop=()=>{},e.secondsToMillis=function(e){return Math.trunc(1e3*e)},e.shouldRetry=function({status:e}){return!e||se(e)},e.sleep=ce,e.subsystem=$,e.timedPromise=(e,t)=>new Promise((e,t)=>{})}(o);var l={},c={},u={};Object.defineProperty(u,"__esModule",{value:!0});var d={};Object.defineProperty(d,"__esModule",{value:!0});var h,f={};Object.defineProperty(f,"__esModule",{value:!0}),f.IsMigrationStage=f.LDMigrationStage=void 0,function(e){e.Off="off",e.DualWrite="dualwrite",e.Shadow="shadow",e.Live="live",e.RampDown="rampdown",e.Complete="complete"}(h||(f.LDMigrationStage=h={})),f.IsMigrationStage=function(e){return Object.values(h).includes(e)};var p={};Object.defineProperty(p,"__esModule",{value:!0});var v,g,_,y,m={};Object.defineProperty(m,"__esModule",{value:!0}),m.LDConsistencyCheck=void 0,function(e){e[e.Inconsistent=0]="Inconsistent",e[e.Consistent=1]="Consistent",e[e.NotChecked=2]="NotChecked"}(v||(m.LDConsistencyCheck=v={})),g=c,_=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),y=t&&t.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||_(t,e,r)},Object.defineProperty(g,"__esModule",{value:!0}),y(u,g),y(d,g),y(f,g),y(p,g),y(m,g);var b={},S={};Object.defineProperty(S,"__esModule",{value:!0});var E={};Object.defineProperty(E,"__esModule",{value:!0});var w={};Object.defineProperty(w,"__esModule",{value:!0});var k={};Object.defineProperty(k,"__esModule",{value:!0});var O,x,D={};Object.defineProperty(D,"__esModule",{value:!0}),D.LDConcurrentExecution=D.LDSerialExecution=D.LDExecution=D.LDExecutionOrdering=void 0,function(e){e[e.Fixed=0]="Fixed",e[e.Random=1]="Random"}(O||(D.LDExecutionOrdering=O={})),function(e){e[e.Serial=0]="Serial",e[e.Concurrent=1]="Concurrent"}(x||(D.LDExecution=x={}));D.LDSerialExecution=class{constructor(e){this.ordering=e,this.type=x.Serial}};D.LDConcurrentExecution=class{constructor(){this.type=x.Concurrent}};var P={};Object.defineProperty(P,"__esModule",{value:!0}),P.isPollingOnlyOptions=P.isStreamingOnlyOptions=P.isStandardOptions=void 0,P.isStandardOptions=function(e){return"standard"===e.dataSourceOptionsType},P.isStreamingOnlyOptions=function(e){return"streamingOnly"===e.dataSourceOptionsType},P.isPollingOnlyOptions=function(e){return"pollingOnly"===e.dataSourceOptionsType},function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(S,e),i(E,e),i(w,e),i(k,e),i(D,e),i(P,e)}(b);var R={};Object.defineProperty(R,"__esModule",{value:!0});var I={};Object.defineProperty(I,"__esModule",{value:!0});var M={};Object.defineProperty(M,"__esModule",{value:!0});var T={};Object.defineProperty(T,"__esModule",{value:!0});var A={};Object.defineProperty(A,"__esModule",{value:!0});var C={};Object.defineProperty(C,"__esModule",{value:!0});var F={},j={};Object.defineProperty(j,"__esModule",{value:!0});var L={};Object.defineProperty(L,"__esModule",{value:!0}),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(j,e),i(L,e)}(F);var N={},$={};Object.defineProperty($,"__esModule",{value:!0});var B={};Object.defineProperty(B,"__esModule",{value:!0});var V={};Object.defineProperty(V,"__esModule",{value:!0});var z={};Object.defineProperty(z,"__esModule",{value:!0});var H={};Object.defineProperty(H,"__esModule",{value:!0});var U={};Object.defineProperty(U,"__esModule",{value:!0});var K={};Object.defineProperty(K,"__esModule",{value:!0});var q={};Object.defineProperty(q,"__esModule",{value:!0});var W={};Object.defineProperty(W,"__esModule",{value:!0});var G={};Object.defineProperty(G,"__esModule",{value:!0}),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i($,e),i(B,e),i(V,e),i(z,e),i(H,e),i(M,e),i(U,e),i(K,e),i(q,e),i(W,e),i(G,e)}(N);var X={},J={};Object.defineProperty(J,"__esModule",{value:!0});var Y={};Object.defineProperty(Y,"__esModule",{value:!0});var Z={};Object.defineProperty(Z,"__esModule",{value:!0}),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(J,e),i(Y,e),i(T,e),i(Z,e),i(A,e)}(X),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.subsystems=e.interfaces=e.integrations=void 0,i(c,e),i(b,e),i(R,e),i(I,e),i(M,e),i(T,e),i(A,e),i(C,e),e.integrations=F,e.interfaces=N,e.subsystems=X}(l);var Q={},ee={};Object.defineProperty(ee,"__esModule",{value:!0});ee.default=class{constructor(e){this._keyMap=new Map,this._head=0,this._tail=0,this._size=0;const{max:t}=e;this._max=t,this._values=new Array(t),this._keys=new Array(t),this._next=new Uint32Array(t),this._prev=new Uint32Array(t),e.maxAge?(this._lastUpdated=new Array(t).fill(0),this._maxAge=e.maxAge):(this._lastUpdated=[],this._maxAge=0)}set(e,t){let r=this._keyMap.get(e);void 0===r?(r=this._index(),this._keys[r]=e,this._keyMap.set(e,r),this._next[this._tail]=r,this._prev[r]=this._tail,this._tail=r,this._size+=1):this._setTail(r),this._values[r]=t,this._maxAge&&(this._lastUpdated[r]=Date.now())}get(e){const t=this._keyMap.get(e);if(void 0!==t){if(this._maxAge){const e=this._lastUpdated[t];if(Date.now()-e>this._maxAge)return}return this._setTail(t),this._maxAge&&(this._lastUpdated[t]=Date.now()),this._values[t]}}clear(){this._head=0,this._tail=0,this._size=0,this._values.fill(void 0),this._keys.fill(void 0),this._next.fill(0),this._prev.fill(0),this._keyMap.clear()}_index(){return 0===this._size?this._tail:this._size===this._max?this._evict():this._size}_evict(){const{_head:e}=this,t=this._keys[e];return this._head=this._next[e],this._keyMap.delete(t),this._size-=1,e}_link(e,t){this._prev[t]=e,this._next[e]=t}_setTail(e){e!==this._tail&&(e===this._head?this._head=this._next[e]:this._link(this._prev[e],this._next[e]),this._link(this._tail,e),this._tail=e)}},Object.defineProperty(Q,"__esModule",{value:!0});const te=o,re=s,ie=ee;Q.default=class{constructor(e,t,r,i){this._store=e,this._logger=r,this._crypto=i,this.statusProvider=new re.default(async()=>this._pollStoreAndUpdateStatus()),this._staleTimeMs=1e3*(te.TypeValidators.Number.is(t.staleAfter)&&t.staleAfter>0?t.staleAfter:120);te.TypeValidators.Number.is(t.statusPollInterval)&&t.statusPollInterval>0&&t.statusPollInterval;this._pollHandle=e?void 0:null,e&&(this._cache=new ie.default({max:t.userCacheSize||1e3,maxAge:1e3*(t.userCacheTime||5)}))}close(){this._pollHandle&&(clearInterval(this._pollHandle),this._pollHandle=void 0),this._store&&this._store.close()}async getUserMembership(e){var t,r,i;if(!this._store)return;const n=null===(t=this._cache)||void 0===t?void 0:t.get(e);let s;if(n)s=n.membership;else try{s=await this._store.getUserMembership(this._hashForUserKey(e));const t={membership:s};null===(r=this._cache)||void 0===r||r.set(e,t)}catch(e){return null===(i=this._logger)||void 0===i||i.error(`Big Segment store membership query returned error: ${e}`),[null,"STORE_ERROR"]}this.statusProvider.getStatus()||await this._pollStoreAndUpdateStatus();const a=this.statusProvider.getStatus();return a.available?[s||null,a.stale?"STALE":"HEALTHY"]:[s||null,"STORE_ERROR"]}async _pollStoreAndUpdateStatus(){var e,t,r;if(!this._store)return void this.statusProvider.setStatus({available:!1,stale:!1});let i;null===(e=this._logger)||void 0===e||e.debug("Querying Big Segment store status");try{const e=await this._store.getMetadata();i={available:!0,stale:!e||!e.lastUpToDate||this._isStale(e.lastUpToDate)}}catch(e){null===(t=this._logger)||void 0===t||t.error(`Big Segment store status query returned error: ${e}`),i={available:!1,stale:!1}}const n=this.statusProvider.getStatus();n&&n.available===i.available&&n.stale===i.stale||(null===(r=this._logger)||void 0===r||r.debug("Big Segment store status changed from %s to %s",JSON.stringify(n),JSON.stringify(i)),this.statusProvider.setStatus(i),this.statusProvider.notify())}_hashForUserKey(e){const t=this._crypto.createHash("sha256");if(t.update(e),!t.digest)throw new Error("Platform must implement digest or asyncDigest");return t.digest("base64")}_isStale(e){return Date.now()-e>=this._staleTimeMs}};var ne={};Object.defineProperty(ne,"__esModule",{value:!0}),ne.createPluginEnvironmentMetadata=void 0,ne.createPluginEnvironmentMetadata=function(e,t,r){const i={sdk:{name:e.info.sdkData().userAgentBase,version:e.info.sdkData().version},sdkKey:t};return e.info.sdkData().wrapperName&&(i.sdk.wrapperName=e.info.sdkData().wrapperName),e.info.sdkData().wrapperVersion&&(i.sdk.wrapperVersion=e.info.sdkData().wrapperVersion),r.applicationInfo&&(i.application=r.applicationInfo),i};var se={};Object.defineProperty(se,"__esModule",{value:!0}),se.createPayloadListener=void 0;se.createPayloadListener=(e,t,r=()=>{})=>i=>{const{initMetadata:n,payload:s}=i;if(s.basis)null==t||t.debug("Initializing all data");else{if(!(s.updates.length>0))return void(null==t||t.debug("Payload had no updates, ignoring."));null==t||t.debug("Applying updates")}const a={};s.updates.forEach(e=>{const r=(e=>{switch(e){case"flag":return"features";case"segment":return"segments";default:return e}})(e.kind);a[r]?a[r][e.key]=Object.assign(Object.assign({version:e.version},e.deleted&&{deleted:e.deleted}),e.object):a[r]={[e.key]:Object.assign(Object.assign({version:e.version},e.deleted&&{deleted:e.deleted}),e.object)},e.deleted?null==t||t.debug(`Deleting ${e.key} in ${e.kind}`):null==t||t.debug(`Updating ${e.key} in ${e.kind}`)}),e.applyChanges(s.basis,a,r,n,s.state)};var ae={},oe={},le={};Object.defineProperty(le,"__esModule",{value:!0});class ce{static getKeyFromPath(e,t){return t.startsWith(e.streamApiPath)?t.substring(e.streamApiPath.length):void 0}}ce.Features={namespace:"features",streamApiPath:"/flags/"},ce.Segments={namespace:"segments",streamApiPath:"/segments/"},le.default=ce,Object.defineProperty(oe,"__esModule",{value:!0}),oe.deserializeSegment=oe.serializeSegment=oe.deserializeFlag=oe.serializeFlag=oe.deserializeDelete=oe.deserializePatch=oe.deserializePoll=oe.deserializeAll=oe.reviveFullPayload=oe.processSegment=oe.processFlag=oe.replacer=oe.nullReplacer=void 0;const ue=o,de=le,he=100;function fe(e,t){const r=[];if(null==e)return;const i=Object.entries(e).filter(([e,r])=>!(null==t?void 0:t.includes(e)));for(r.push(...i.map(([t,r])=>({key:t,value:r,parent:e})));r.length;){const e=r.pop();null!==e.value||Array.isArray(e.parent)?"object"==typeof e.value&&null!==e.value&&r.push(...Object.entries(e.value).map(([t,r])=>({key:t,value:r,parent:e.value}))):delete e.parent[e.key]}}function pe(e,t){if(!(t instanceof ue.AttributeReference||Array.isArray(t)&&t[0]&&t[0]instanceof ue.AttributeReference))return null==t||(t.generated_includedSet&&(t.included=[...t.generated_includedSet],delete t.generated_includedSet),t.generated_excludedSet&&(t.excluded=[...t.generated_excludedSet],delete t.generated_excludedSet),t.includedContexts&&t.includedContexts.forEach(e=>{e.generated_valuesSet&&(e.values=[...e.generated_valuesSet]),delete e.generated_valuesSet}),t.excludedContexts&&t.excludedContexts.forEach(e=>{e.generated_valuesSet&&(e.values=[...e.generated_valuesSet]),delete e.generated_valuesSet})),t}function ve(e){e&&e.bucketBy&&(e.bucketByAttributeReference=new ue.AttributeReference(e.bucketBy,!e.contextKind))}function ge(e){var t;if(fe(e,["variations"]),e.fallthrough&&e.fallthrough.rollout){ve(e.fallthrough.rollout)}null===(t=null==e?void 0:e.rules)||void 0===t||t.forEach(e=>{var t;ve(e.rollout),null===(t=null==e?void 0:e.clauses)||void 0===t||t.forEach(e=>{e&&e.attribute?e.attributeReference=new ue.AttributeReference(e.attribute,!e.contextKind):e&&(e.attributeReference=ue.AttributeReference.InvalidReference)})})}function _e(e){var t,r,i,n,s;fe(e),(null===(t=null==e?void 0:e.included)||void 0===t?void 0:t.length)&&e.included.length>he&&(e.generated_includedSet=new Set(e.included),delete e.included),(null===(r=null==e?void 0:e.excluded)||void 0===r?void 0:r.length)&&e.excluded.length>he&&(e.generated_excludedSet=new Set(e.excluded),delete e.excluded),(null===(i=null==e?void 0:e.includedContexts)||void 0===i?void 0:i.length)&&e.includedContexts.forEach(e=>{var t;(null===(t=null==e?void 0:e.values)||void 0===t?void 0:t.length)&&e.values.length>he&&(e.generated_valuesSet=new Set(e.values),e.values=[])}),(null===(n=null==e?void 0:e.excludedContexts)||void 0===n?void 0:n.length)&&e.excludedContexts.forEach(e=>{var t;(null===(t=null==e?void 0:e.values)||void 0===t?void 0:t.length)&&e.values.length>he&&(e.generated_valuesSet=new Set(e.values),e.values=[])}),null===(s=null==e?void 0:e.rules)||void 0===s||s.forEach(e=>{var t;e.bucketBy&&(e.bucketByAttributeReference=new ue.AttributeReference(e.bucketBy,!e.rolloutContextKind)),null===(t=null==e?void 0:e.clauses)||void 0===t||t.forEach(e=>{e&&e.attribute?e.attributeReference=new ue.AttributeReference(e.attribute,!e.contextKind):e&&(e.attributeReference=ue.AttributeReference.InvalidReference)})})}function ye(e){try{return JSON.parse(e)}catch(e){return}}function me(e){const t=e;return Object.values((null==t?void 0:t.flags)||[]).forEach(e=>{ge(e)}),Object.values((null==t?void 0:t.segments)||[]).forEach(e=>{_e(e)}),t}oe.nullReplacer=fe,oe.replacer=pe,oe.processFlag=ge,oe.processSegment=_e,oe.reviveFullPayload=me,oe.deserializeAll=function(e){const t=ye(e);if(t)return me(null==t?void 0:t.data),t},oe.deserializePoll=function(e){const t=ye(e);if(t)return me(t),t},oe.deserializePatch=function(e){const t=ye(e);if(t)return t.path.startsWith(de.default.Features.streamApiPath)?(ge(t.data),t.kind=de.default.Features):t.path.startsWith(de.default.Segments.streamApiPath)&&(_e(t.data),t.kind=de.default.Segments),t},oe.deserializeDelete=function(e){const t=ye(e);if(t)return t.path.startsWith(de.default.Features.streamApiPath)?t.kind=de.default.Features:t.path.startsWith(de.default.Segments.streamApiPath)&&(t.kind=de.default.Segments),t},oe.serializeFlag=function(e){return JSON.stringify(e,pe)},oe.deserializeFlag=function(e){const t=ye(e);if(t)return ge(t),t},oe.serializeSegment=function(e){return JSON.stringify(e,pe)},oe.deserializeSegment=function(e){const t=ye(e);if(t)return _e(t),t},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createStreamListeners=e.createDeleteListener=e.createPatchListener=e.createPutListener=void 0;const t=o,r=oe,i=le,{initMetadataFromHeaders:n}=t.internal;e.createPutListener=(e,t,s=()=>{})=>({deserializeData:r.deserializeAll,processJson:async({data:{flags:r,segments:a}},o)=>{const l={[i.default.Features.namespace]:r,[i.default.Segments.namespace]:a};null==t||t.debug("Initializing all data"),e.init(l,s,n(o))}});e.createPatchListener=(e,t,n=()=>{})=>({deserializeData:r.deserializePatch,processJson:async({data:r,kind:s,path:a})=>{if(s){const o=i.default.getKeyFromPath(s,a);o&&(null==t||t.debug(`Updating ${o} in ${s.namespace}`),e.upsert(s,r,n))}}});e.createDeleteListener=(e,t,n=()=>{})=>({deserializeData:r.deserializeDelete,processJson:async({kind:r,path:s,version:a})=>{if(r){const o=i.default.getKeyFromPath(r,s);o&&(null==t||t.debug(`Deleting ${o} in ${r.namespace}`),e.upsert(r,{key:o,version:a,deleted:!0},n))}}});e.createStreamListeners=(t,r,i)=>{const n=new Map;return n.set("put",(0,e.createPutListener)(t,r,null==i?void 0:i.put)),n.set("patch",(0,e.createPatchListener)(t,r,null==i?void 0:i.patch)),n.set("delete",(0,e.createDeleteListener)(t,r,null==i?void 0:i.delete)),n}}(ae);var be={},Se={},Ee={};Object.defineProperty(Ee,"__esModule",{value:!0});Ee.default=class{constructor(){this._itemsByNamespace={}}get(e,t){var r;return null===(r=this._itemsByNamespace[e])||void 0===r?void 0:r[t]}set(e,t,r){e in this._itemsByNamespace||(this._itemsByNamespace[e]={}),this._itemsByNamespace[e][t]=r}remove(e,t){const r=this._itemsByNamespace[e];r&&delete r[t]}removeAll(){this._itemsByNamespace={}}enumerate(e){Object.entries(this._itemsByNamespace).forEach(([t,r])=>{Object.entries(r).forEach(([r,i])=>{e(t,r,i)})})}mergeFrom(e){e.enumerate(this.set.bind(this))}},Object.defineProperty(Se,"__esModule",{value:!0});const we=Ee;Se.default=class{constructor(){this._dependenciesFrom=new we.default,this._dependenciesTo=new we.default}updateDependenciesFrom(e,t,r){const i=this._dependenciesFrom.get(e,t);null==i||i.enumerate((r,i)=>{const n=this._dependenciesTo.get(r,i);null==n||n.remove(e,t)}),this._dependenciesFrom.set(e,t,r),null==r||r.enumerate((r,i)=>{let n=this._dependenciesTo.get(r,i);n||(n=new we.default,this._dependenciesTo.set(r,i,n)),n.set(e,t,!0)})}updateModifiedItems(e,t,r){if(!e.get(t,r)){e.set(t,r,!0);const i=this._dependenciesTo.get(t,r);null==i||i.enumerate((t,r)=>{this.updateModifiedItems(e,t,r)})}}reset(){this._dependenciesFrom.removeAll(),this._dependenciesTo.removeAll()}},Object.defineProperty(be,"__esModule",{value:!0}),be.computeDependencies=void 0;const ke=le,Oe=Se,xe=Ee;function De(e,t){var r,i;const n=new xe.default,s=e===ke.default.Features.namespace,a=e===ke.default.Segments.namespace;if(s){const i=t;null===(r=null==i?void 0:i.prerequisites)||void 0===r||r.forEach(t=>{n.set(e,t.key,!0)})}if(s||a){const e=t;null===(i=null==e?void 0:e.rules)||void 0===i||i.forEach(e=>{var t;null===(t=e.clauses)||void 0===t||t.forEach(e=>{"segmentMatch"===e.op&&e.values.forEach(e=>{n.set(ke.default.Segments.namespace,e,!0)})})})}return n}be.computeDependencies=De;be.default=class{constructor(e,t,r){this._featureStore=e,this._hasEventListeners=t,this._onChange=r,this._dependencyTracker=new Oe.default}init(e,t,r){const i=this._hasEventListeners(),n=n=>{this._featureStore.init(e,()=>{Promise.resolve().then(()=>{if(this._dependencyTracker.reset(),Object.entries(e).forEach(([e,t])=>{Object.keys(t||{}).forEach(r=>{const i=t[r];this._dependencyTracker.updateDependenciesFrom(e,r,De(e,i))})}),i){const t=new xe.default;Object.keys(e).forEach(r=>{const i=(null==n?void 0:n[r])||{},s=e[r],a=Object.assign(Object.assign({},i),s);Object.keys(a).forEach(e=>{this.addIfModified(r,e,i&&i[e],s&&s[e],t)})}),this.sendChangeEvents(t)}}),null==t||t()},r)};i?this._featureStore.all(ke.default.Features,e=>{this._featureStore.all(ke.default.Segments,t=>{const r={[ke.default.Features.namespace]:e,[ke.default.Segments.namespace]:t};n(r)})}):n()}upsert(e,t,r){const{key:i}=t,n=this._hasEventListeners(),s=s=>{this._featureStore.upsert(e,t,()=>{Promise.resolve().then(()=>{if(this._dependencyTracker.updateDependenciesFrom(e.namespace,i,De(e.namespace,t)),n){const r=new xe.default;this.addIfModified(e.namespace,i,s,t,r),this.sendChangeEvents(r)}}),null==r||r()})};n?this._featureStore.get(e,i,s):s()}addIfModified(e,t,r,i,n){i&&r&&i.version<=r.version||this._dependencyTracker.updateModifiedItems(n,e,t)}sendChangeEvents(e){e.enumerate((e,t)=>{e===ke.default.Features.namespace&&this._onChange(t)})}};var Pe={};Object.defineProperty(Pe,"__esModule",{value:!0});const Re=o,Ie=oe;Pe.default=class{constructor(e,t){this._requestor=e,this._logger=t,this._stopped=!1}start(e,t){var r;t(Re.subsystem.DataSourceState.Initializing),null===(r=this._logger)||void 0===r||r.debug("Performing initialization request to LaunchDarkly for feature flag data."),this._requestor.requestAllData((r,i,n)=>{var s,a,o;if(this._stopped)return;if(r){const{status:e}=r,i=(0,Re.httpErrorMessage)(r,"initializer","initializer does not retry");return null===(s=this._logger)||void 0===s||s.error(i),void t(Re.subsystem.DataSourceState.Closed,new Re.LDPollingError(Re.DataSourceErrorKind.ErrorResponse,i,e))}if(!i)return void t(Re.subsystem.DataSourceState.Closed,new Re.LDPollingError(Re.DataSourceErrorKind.InvalidData,"One shot initializer response missing body."));const l=Re.internal.initMetadataFromHeaders(n);try{const r=JSON.parse(i),n=new Re.internal.PayloadProcessor({flag:e=>((0,Ie.processFlag)(e),e),segment:e=>((0,Ie.processSegment)(e),e)},(e,r)=>{t(Re.subsystem.DataSourceState.Interrupted,new Re.LDPollingError(e,r))},this._logger);t(Re.subsystem.DataSourceState.Valid),n.addPayloadListener(t=>{e(t.basis,{initMetadata:l,payload:t})}),n.processEvents(r.events),t(Re.subsystem.DataSourceState.Closed)}catch(e){null===(a=this._logger)||void 0===a||a.error("Response contained invalid data"),null===(o=this._logger)||void 0===o||o.debug(`${r} - Body follows: ${i}`),t(Re.subsystem.DataSourceState.Closed,new Re.LDPollingError(Re.DataSourceErrorKind.InvalidData,"Malformed data in polling response"))}})}stop(){this._stopped=!0}};var Me={},Te={},Ae={},Ce={};Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.default=function(e){return new Promise(t=>{e(e=>{t(e)})})},Object.defineProperty(Ae,"__esModule",{value:!0});const Fe=Ce;Ae.default=class{constructor(e){this._store=e}async get(e,t){return(0,Fe.default)(r=>{this._store.get(e,t,r)})}async all(e){return(0,Fe.default)(t=>{this._store.all(e,t)})}async init(e,t){return(0,Fe.default)(r=>{this._store.init(e,r,t)})}async delete(e,t,r){return(0,Fe.default)(i=>{this._store.delete(e,t,r,i)})}async upsert(e,t){return(0,Fe.default)(r=>{this._store.upsert(e,t,r)})}async initialized(){return(0,Fe.default)(e=>{this._store.initialized(e)})}close(){this._store.close()}getInitMetadata(){var e,t;return null===(t=(e=this._store).getInitMetaData)||void 0===t?void 0:t.call(e)}};var je={};Object.defineProperty(je,"__esModule",{value:!0});const Le=Ce;je.default=class{constructor(e){this._store=e}async get(e,t){return(0,Le.default)(r=>{this._store.get(e,t,r)})}async all(e){return(0,Le.default)(t=>{this._store.all(e,t)})}async init(e,t){return(0,Le.default)(r=>{this._store.init(e,r,t)})}async delete(e,t,r){return(0,Le.default)(i=>{this._store.delete(e,t,r,i)})}async upsert(e,t){return(0,Le.default)(r=>{this._store.upsert(e,t,r)})}async initialized(){return(0,Le.default)(e=>{this._store.initialized(e)})}async applyChanges(e,t,r,i){return(0,Le.default)(n=>{this._store.applyChanges(e,t,n,r,i)})}close(){this._store.close()}getInitMetadata(){var e,t;return null===(t=(e=this._store).getInitMetaData)||void 0===t?void 0:t.call(e)}};var Ne={},$e={};function Be(e){return Date.now()>e.expiration}Object.defineProperty($e,"__esModule",{value:!0});$e.default=class{constructor(e){this._options=e,this._storage=new Map,this._checkIntervalHandle=void e.checkInterval}get(e){const t=this._storage.get(e);if(!t||!Be(t))return null==t?void 0:t.value;this._storage.delete(e)}set(e,t){this._storage.set(e,{value:t,expiration:Date.now()+1e3*this._options.ttl})}delete(e){this._storage.delete(e)}clear(){this._storage.clear()}close(){this.clear(),this._checkIntervalHandle&&(clearInterval(this._checkIntervalHandle),this._checkIntervalHandle=null)}_purgeStale(){this._storage.forEach((e,t)=>{Be(e)&&this._storage.delete(t)})}get size(){return this._storage.size}};var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.persistentStoreKinds=void 0;const ze=oe,He=le;Ve.persistentStoreKinds={segments:{namespace:He.default.Segments.namespace,deserialize:e=>{const t=(0,ze.deserializeSegment)(e);if(t)return{version:t.version,item:t}},serialize:e=>{const t=(0,ze.serializeSegment)(e);return{version:e.version,deleted:e.deleted,serializedItem:t}},priority:0},features:{namespace:He.default.Features.namespace,deserialize:e=>{const t=(0,ze.deserializeFlag)(e);if(t)return{version:t.version,item:t}},serialize:e=>{const t=(0,ze.serializeFlag)(e);return{version:e.version,deleted:e.deleted,serializedItem:t}},priority:1}};var Ue={};Object.defineProperty(Ue,"__esModule",{value:!0});const Ke=Ve;function qe(e,t){const r=[],i=new Set(Object.keys(t)),n=s=>{if(!i.has(s))return;i.delete(s);const a=t[s];var o;"features"===e.namespace&&(o=a,o.prerequisites&&o.prerequisites.length?o.prerequisites.map(e=>e.key):[]).forEach(e=>{n(e)}),r.push({key:s,item:e.serialize(a)})};for(;i.size>0;){const e=i.values().next().value;n(e)}return r}Ue.default=function(e){const t=[];return Object.keys(e).forEach(r=>{const i=Ke.persistentStoreKinds[r];t.push({key:i,item:qe(i,e[r])})}),t.sort((e,t)=>e.key.priority-t.key.priority),t};var We={};Object.defineProperty(We,"__esModule",{value:!0});We.default=class{constructor(){this._queue=[]}enqueue(e,t){this._queue.push([e,t]),1===this._queue.length&&this.executePendingUpdates()}executePendingUpdates(){if(this._queue.length>0){const[e,t]=this._queue[0];e(()=>{this._queue.shift(),this._queue.length,null==t||t()})}}},Object.defineProperty(Ne,"__esModule",{value:!0});const Ge=$e,Xe=Ve,Je=Ue,Ye=We;function Ze(e,t){return`${e.namespace}:${t}`}function Qe(e){return`$all:${e.namespace}`}const et="$checkedInit";function tt(e){return!e||e.item.deleted?null:e.item}function rt(e){return{version:e,item:{version:e,deleted:!0}}}function it(e,t){if(t.deleted||!t.serializedItem)return rt(t.version);const r=e.deserialize(t.serializedItem);return void 0===r?rt(t.version):0===r.version||r.version===t.version||void 0===r.item?r:{version:t.version,item:r.item}}Ne.default=class{constructor(e,t){this._core=e,this._isInitialized=!1,this._queue=new Ye.default,t&&(this._itemCache=new Ge.default({ttl:t,checkInterval:600}),this._allItemsCache=new Ge.default({ttl:t,checkInterval:600}))}init(e,t){this._queue.enqueue(t=>{this._core.init((0,Je.default)(e),()=>{this._isInitialized=!0,this._itemCache&&(this._itemCache.clear(),this._allItemsCache.clear(),Object.keys(e).forEach(t=>{const r=Xe.persistentStoreKinds[t],i=e[t];this._allItemsCache.set(Qe(r),i),Object.keys(i).forEach(e=>{const t=i[e],n={version:t.version,item:t};this._itemCache.set(Ze(r,e),n)})})),t()})},t)}get(e,t,r){if(this._itemCache){const i=this._itemCache.get(Ze(e,t));if(i)return void r(tt(i))}const i=Xe.persistentStoreKinds[e.namespace];this._core.get(i,t,n=>{var s;if(n&&n.serializedItem){const a=it(i,n);return null===(s=this._itemCache)||void 0===s||s.set(Ze(e,t),a),void r(tt(a))}r(null)})}initialized(e){var t;this._isInitialized?e(!0):(null===(t=this._itemCache)||void 0===t?void 0:t.get(et))?e(!1):this._core.initialized(t=>{var r;this._isInitialized=t,this._isInitialized||null===(r=this._itemCache)||void 0===r||r.set(et,!0),e(this._isInitialized)})}all(e,t){var r;const i=null===(r=this._allItemsCache)||void 0===r?void 0:r.get(Qe(e));if(i)return void t(i);const n=Xe.persistentStoreKinds[e.namespace];this._core.getAll(n,r=>{var i;if(!r)return void t({});const s={};r.forEach(({key:e,item:t})=>{const r=tt(it(n,t));r&&(s[e]=r)}),null===(i=this._allItemsCache)||void 0===i||i.set(Qe(e),s),t(s)})}upsert(e,t,r){this._queue.enqueue(r=>{this._allItemsCache&&this._allItemsCache.clear();const i=Xe.persistentStoreKinds[e.namespace];this._core.upsert(i,t.key,i.serialize(t),(n,s)=>{var a,o;if(!n&&s)if(s.serializedItem){const r=it(i,s);null===(a=this._itemCache)||void 0===a||a.set(Ze(e,t.key),r)}else s.deleted&&(null===(o=this._itemCache)||void 0===o||o.set(t.key,{key:t.key,version:s.version,deleted:!0}));r()})},r)}delete(e,t,r,i){this.upsert(e,{key:t,version:r,deleted:!0},i)}close(){var e,t;null===(e=this._itemCache)||void 0===e||e.close(),null===(t=this._allItemsCache)||void 0===t||t.close(),this._core.close()}getDescription(){return this._core.getDescription()}};var nt={},st={};Object.defineProperty(st,"__esModule",{value:!0});st.default=class{constructor(){this._allData={},this._initCalled=!1}get(e,t,r){const i=this._allData[e.namespace];if(i&&Object.prototype.hasOwnProperty.call(i,t)){const e=i[t];if(e&&!e.deleted)return null==r?void 0:r(e)}return null==r?void 0:r(null)}all(e,t){var r;const i={},n=null!==(r=this._allData[e.namespace])&&void 0!==r?r:{};Object.entries(n).forEach(([e,t])=>{t&&!t.deleted&&(i[e]=t)}),null==t||t(i)}init(e,t,r){this.applyChanges(!0,e,t,r)}delete(e,t,r,i){const n={key:t,version:r,deleted:!0};this.applyChanges(!1,{[e.namespace]:{[t]:n}},i)}upsert(e,t,r){this.applyChanges(!1,{[e.namespace]:{[t.key]:t}},r)}applyChanges(e,t,r,i,n){if(e)this._initCalled=!0,this._allData=t,this._initMetadata=i;else{const e={};Object.entries(this._allData).forEach(([t,r])=>{e[t]=Object.assign({},r)}),Object.entries(t).forEach(([t,r])=>{Object.keys(r||{}).forEach(i=>{let n=e[t];n||(n={},e[t]=n);const s=r[i];if(Object.hasOwnProperty.call(n,i)){const e=n[i];(!e||e.version<s.version)&&(n[i]=Object.assign({key:i},s))}else n[i]=Object.assign({key:i},s)})}),this._allData=e}this._selector=n,null==r||r()}initialized(e){return null==e?void 0:e(this._initCalled)}close(){}getDescription(){return"memory"}getInitMetaData(){return this._initMetadata}getSelector(){return this._selector}},Object.defineProperty(nt,"__esModule",{value:!0});const at=st;nt.default=class{constructor(e){this._nonTransPersistenceStore=e,this._activeStore=this._nonTransPersistenceStore,this._memoryStore=new at.default}get(e,t,r){this._activeStore.get(e,t,r)}all(e,t){this._activeStore.all(e,t)}init(e,t){this.applyChanges(!0,e,t)}delete(e,t,r,i){const n={key:t,version:r,deleted:!0};this.applyChanges(!1,{[e.namespace]:{[t]:n}},i)}upsert(e,t,r){this.applyChanges(!1,{[e.namespace]:{[t.key]:t}},r)}applyChanges(e,t,r,i,n){this._memoryStore.applyChanges(e,t,()=>{if(e)this._activeStore=this._memoryStore,this._nonTransPersistenceStore.init(t,r);else{const e=[];Object.entries(t).forEach(([t,r])=>{Object.keys(r||{}).forEach(i=>{e.push({dataKind:{namespace:t},item:Object.assign({key:i},r[i])})})}),e.reduce((e,t)=>e.then(()=>new Promise(e=>{this._nonTransPersistenceStore.upsert(t.dataKind,t.item,e)})),Promise.resolve()).then(r)}},i,n)}initialized(e){this._activeStore.initialized(e)}close(){this._nonTransPersistenceStore.close(),this._memoryStore.close()}getDescription(){return"transactional persistent store"}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reviveFullPayload=e.deserializePoll=e.TransactionalFeatureStore=e.PersistentDataStoreWrapper=e.AsyncTransactionalStoreFacade=e.AsyncStoreFacade=void 0;const t=Ae;e.AsyncStoreFacade=t.default;const r=je;e.AsyncTransactionalStoreFacade=r.default;const i=Ne;e.PersistentDataStoreWrapper=i.default;const n=oe;Object.defineProperty(e,"deserializePoll",{enumerable:!0,get:function(){return n.deserializePoll}}),Object.defineProperty(e,"reviveFullPayload",{enumerable:!0,get:function(){return n.reviveFullPayload}});const s=nt;e.TransactionalFeatureStore=s.default}(Te),Object.defineProperty(Me,"__esModule",{value:!0});const ot=o,lt=Te,ct=le,{initMetadataFromHeaders:ut}=ot.internal;Me.default=class{constructor(e,t,r,i,n=()=>{},s){this._requestor=e,this._pollInterval=t,this._featureStore=r,this._logger=i,this._initSuccessHandler=n,this._errorHandler=s,this._stopped=!1}_poll(){var e;if(this._stopped)return;const t=e=>{var t,r,i;null===(t=this._logger)||void 0===t||t.error("Polling received invalid data"),null===(r=this._logger)||void 0===r||r.debug(`Invalid JSON follows: ${e}`),null===(i=this._errorHandler)||void 0===i||i.call(this,new ot.LDPollingError(ot.DataSourceErrorKind.InvalidData,"Malformed JSON data in polling response"))},r=Date.now();null===(e=this._logger)||void 0===e||e.debug("Polling LaunchDarkly for feature flag updates"),this._requestor.requestAllData((e,i,n)=>{var s,a,o,l;const c=Date.now()-r,u=Math.max(1e3*this._pollInterval-c,0);if(null===(s=this._logger)||void 0===s||s.debug("Elapsed: %d ms, sleeping for %d ms",c,u),e){const{status:t}=e;if(t&&!(0,ot.isHttpRecoverable)(t)){const r=(0,ot.httpErrorMessage)(e,"polling request");return null===(a=this._logger)||void 0===a||a.error(r),void(null===(o=this._errorHandler)||void 0===o||o.call(this,new ot.LDPollingError(ot.DataSourceErrorKind.ErrorResponse,r,t)))}null===(l=this._logger)||void 0===l||l.warn((0,ot.httpErrorMessage)(e,"polling request","will retry"))}else if(i){const e=(0,lt.deserializePoll)(i);if(e){const t={[ct.default.Features.namespace]:e.flags,[ct.default.Segments.namespace]:e.segments};return void this._featureStore.init(t,()=>{this._initSuccessHandler(),this._timeoutHandle=e=>{e()}},ut(n))}t(i)}this._timeoutHandle=e=>{e()}})}start(){this._poll()}stop(){this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0),this._stopped=!0}close(){this.stop()}};var dt={};Object.defineProperty(dt,"__esModule",{value:!0});const ht=o,ft=oe;dt.default=class{constructor(e,t=30,r,i=!1){this._requestor=e,this._pollInterval=t,this._logger=r,this._processResponseAsFDv1=i,this._stopped=!1}_poll(e,t,r){var i;if(this._stopped)return;const n=Date.now();var s;null===(i=this._logger)||void 0===i||i.debug("Polling LaunchDarkly for feature flag updates"),this._requestor.requestAllData((r,i,s)=>{var a,o,l,c,u,d,h;if(this._stopped)return;const f=Date.now()-n,p=Math.max(1e3*this._pollInterval-f,0);if(null===(a=this._logger)||void 0===a||a.debug("Elapsed: %d ms, sleeping for %d ms",f,p),r){const{status:e}=r;if(r instanceof ht.LDFlagDeliveryFallbackError)return null===(o=this._logger)||void 0===o||o.error(r.message),void t(ht.subsystem.DataSourceState.Closed,r);if(e&&!(0,ht.isHttpRecoverable)(e)){const i=(0,ht.httpErrorMessage)(r,"polling request");return null===(l=this._logger)||void 0===l||l.error(i),void t(ht.subsystem.DataSourceState.Closed,new ht.LDPollingError(ht.DataSourceErrorKind.ErrorResponse,i,e,!1))}const i=(0,ht.httpErrorMessage)(r,"polling request","will retry");return t(ht.subsystem.DataSourceState.Interrupted,new ht.LDPollingError(ht.DataSourceErrorKind.ErrorResponse,i,e)),null===(c=this._logger)||void 0===c||c.warn(i),void(this._timeoutHandle=e=>{e()})}const v=ht.internal.initMetadataFromHeaders(s);if(i)try{const r=new ht.internal.PayloadProcessor({flag:e=>((0,ft.processFlag)(e),e),segment:e=>((0,ft.processSegment)(e),e)},(e,r)=>{t(ht.subsystem.DataSourceState.Interrupted,new ht.LDPollingError(e,r))},this._logger);if(r.addPayloadListener(t=>{e(t.basis,{initMetadata:v,payload:t})}),null===(u=this._logger)||void 0===u||u.debug(`Got body: ${i}`),this._processResponseAsFDv1){!function(e,t){e.processEvents([{event:"server-intent",data:{payloads:[{id:"FDv1Fallback",target:1,intentCode:"xfer-full"}]}}]),Object.entries((null==t?void 0:t.flags)||[]).forEach(([t,r])=>{e.processEvents([{event:"put-object",data:{kind:"flag",key:t,version:r.version,object:r}}])}),Object.entries((null==t?void 0:t.segments)||[]).forEach(([t,r])=>{e.processEvents([{event:"put-object",data:{kind:"segment",key:t,version:r.version,object:r}}])}),e.processEvents([{event:"payload-transferred",data:{state:"FDv1Fallback",version:1}}])}(r,JSON.parse(i))}else{const e=JSON.parse(i);r.processEvents(e.events)}t(ht.subsystem.DataSourceState.Valid)}catch(e){null===(d=this._logger)||void 0===d||d.error("Response contained invalid data"),null===(h=this._logger)||void 0===h||h.debug(`${r} - Body follows: ${i}`),t(ht.subsystem.DataSourceState.Interrupted,new ht.LDPollingError(ht.DataSourceErrorKind.InvalidData,"Malformed data in polling response"))}this._timeoutHandle=e=>{e()}},(s=null==r?void 0:r())?[{key:"basis",value:s}]:[])}start(e,t,r){this._statusCallback=t,t(ht.subsystem.DataSourceState.Initializing),this._poll(e,t,r)}stop(){var e;this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0),null===(e=this._statusCallback)||void 0===e||e.call(this,ht.subsystem.DataSourceState.Closed),this._stopped=!0,this._statusCallback=void 0}};var pt={};Object.defineProperty(pt,"__esModule",{value:!0});const vt=o;pt.default=class{constructor(e,t,r,i="/sdk/latest-all",n){this._requests=t,this._path=i,this._logger=n,this._eTagCache={},this._headers=Object.assign({},r),this._serviceEndpoints=e.serviceEndpoints}async _requestWithETagCache(e,t){const r=this._eTagCache[e],i=null==r?void 0:r.etag,n=i?Object.assign(Object.assign({},t),{headers:Object.assign(Object.assign({},t.headers),{"if-none-match":i})}):t,s=await this._requests.fetch(e,n);if(304===s.status&&r)return{res:s,body:r.body};const a=s.headers.get("etag"),o=await s.text();return a&&(this._eTagCache[e]={etag:a,body:o}),{res:s,body:o}}async requestAllData(e,t=[]){var r,i;const n={method:"GET",headers:this._headers},s=(0,vt.getPollingUri)(this._serviceEndpoints,this._path,t);null===(r=this._logger)||void 0===r||r.debug(`Requestor making request to uri: ${s}`);try{const{res:t,body:r}=await this._requestWithETagCache(s,n);if(null===(i=this._logger)||void 0===i||i.debug(`Requestor got (possibly cached) body: ${JSON.stringify(r)}`),"true"===t.headers.get("x-ld-fd-fallback")){return e(new vt.LDFlagDeliveryFallbackError(vt.DataSourceErrorKind.ErrorResponse,"Response header indicates to fallback to FDv1.",t.status),void 0,void 0)}if(200!==t.status&&304!==t.status){return e(new vt.LDPollingError(vt.DataSourceErrorKind.ErrorResponse,`Unexpected status code: ${t.status}`,t.status),void 0,void 0)}return e(void 0,304===t.status?null:r,Object.fromEntries(t.headers.entries()))}catch(t){return e(t,void 0,void 0)}}};var gt={};Object.defineProperty(gt,"__esModule",{value:!0});const _t=o;gt.default=class{constructor(e,t,r,i,n,s,a,o=1){this._listeners=i,this._diagnosticsManager=s,this._errorHandler=a,this._streamInitialReconnectDelay=o;const{basicConfiguration:l,platform:c}=e,{logger:u}=l,{requests:d}=c;this._headers=Object.assign({},n),this._logger=u,this._requests=d,this._streamUri=(0,_t.getStreamingUri)(l.serviceEndpoints,t,r)}_logConnectionStarted(){this._connectionAttemptStartTime=Date.now()}_logConnectionResult(e){this._connectionAttemptStartTime&&this._diagnosticsManager&&this._diagnosticsManager.recordStreamInit(this._connectionAttemptStartTime,!e,Date.now()-this._connectionAttemptStartTime),this._connectionAttemptStartTime=void 0}_retryAndHandleError(e){var t,r,i;return(0,_t.shouldRetry)(e)?(null===(i=this._logger)||void 0===i||i.warn((0,_t.httpErrorMessage)(e,"streaming request","will retry")),this._logConnectionResult(!1),this._logConnectionStarted(),!0):(this._logConnectionResult(!1),null===(t=this._errorHandler)||void 0===t||t.call(this,new _t.LDStreamingError(_t.DataSourceErrorKind.ErrorResponse,e.message,e.status)),null===(r=this._logger)||void 0===r||r.error((0,_t.httpErrorMessage)(e,"streaming request")),!1)}start(){this._logConnectionStarted();const e=this._requests.createEventSource(this._streamUri,{headers:this._headers,errorFilter:e=>this._retryAndHandleError(e),initialRetryDelayMillis:1e3*this._streamInitialReconnectDelay,readTimeoutMillis:3e5,retryResetIntervalMillis:6e4});this._eventSource=e,e.onclose=()=>{var e;null===(e=this._logger)||void 0===e||e.info("Closed LaunchDarkly stream connection")},e.onerror=()=>{},e.onopen=e=>{var t;this._initHeaders=e.headers,null===(t=this._logger)||void 0===t||t.info("Opened LaunchDarkly stream connection")},e.onretrying=e=>{var t;null===(t=this._logger)||void 0===t||t.info(`Will retry stream connection in ${e.delayMillis} milliseconds`)},this._listeners.forEach(({deserializeData:t,processJson:r},i)=>{e.addEventListener(i,e=>{var n,s;if(null===(n=this._logger)||void 0===n||n.debug(`Received ${i} event`),null==e?void 0:e.data){this._logConnectionResult(!0);const{data:n}=e,s=t(n);if(!s)return void((e,t,r,i)=>{null==r||r.error(`Stream received invalid data in "${e}" message`),null==r||r.debug(`Invalid JSON follows: ${t}`),null==i||i(new _t.LDStreamingError(_t.DataSourceErrorKind.InvalidData,"Malformed JSON data in event stream"))})(i,n,this._logger,this._errorHandler);r(s,this._initHeaders)}else null===(s=this._errorHandler)||void 0===s||s.call(this,new _t.LDStreamingError(_t.DataSourceErrorKind.Unknown,"Unexpected payload from event stream"))})})}stop(){var e;null===(e=this._eventSource)||void 0===e||e.close(),this._eventSource=void 0}close(){this.stop()}};var yt={};Object.defineProperty(yt,"__esModule",{value:!0});const mt=o,bt=oe;yt.default=class{constructor(e,t,r,i,n,s=1){this._streamUriPath=t,this._parameters=r,this._diagnosticsManager=n,this._streamInitialReconnectDelay=s;const{basicConfiguration:a,platform:o}=e,{logger:l,serviceEndpoints:c}=a,{requests:u}=o;this._headers=Object.assign({},i),this._serviceEndpoints=c,this._logger=l,this._requests=u}_logConnectionAttempt(){this._connectionAttemptStartTime=Date.now()}_logConnectionResult(e){this._connectionAttemptStartTime&&this._diagnosticsManager&&this._diagnosticsManager.recordStreamInit(this._connectionAttemptStartTime,!e,Date.now()-this._connectionAttemptStartTime),this._connectionAttemptStartTime=void 0}_retryAndHandleError(e,t){var r,i,n;if("true"===(null===(r=e.headers)||void 0===r?void 0:r["x-ld-fd-fallback"])){const r=new mt.LDFlagDeliveryFallbackError(mt.DataSourceErrorKind.ErrorResponse,"Response header indicates to fallback to FDv1",e.status);return t(mt.subsystem.DataSourceState.Closed,r),!1}return(0,mt.shouldRetry)(e)?(null===(n=this._logger)||void 0===n||n.warn((0,mt.httpErrorMessage)(e,"streaming request","will retry")),this._logConnectionResult(!1),this._logConnectionAttempt(),t(mt.subsystem.DataSourceState.Interrupted),!0):(null===(i=this._logger)||void 0===i||i.error((0,mt.httpErrorMessage)(e,"streaming request")),this._logConnectionResult(!1),t(mt.subsystem.DataSourceState.Closed,new mt.LDStreamingError(mt.DataSourceErrorKind.ErrorResponse,e.message,e.status,!1)),!1)}start(e,t,r){var i;this._logConnectionAttempt(),t(mt.subsystem.DataSourceState.Initializing);const n=null==r?void 0:r(),s=n?[...this._parameters,{key:"basis",value:n}]:this._parameters,a=(0,mt.getStreamingUri)(this._serviceEndpoints,this._streamUriPath,s);null===(i=this._logger)||void 0===i||i.debug(`Streaming processor opening event source to uri: ${a}`);const o=this._requests.createEventSource(a,{headers:this._headers,errorFilter:e=>this._retryAndHandleError(e,t),initialRetryDelayMillis:1e3*this._streamInitialReconnectDelay,readTimeoutMillis:3e5,retryResetIntervalMillis:6e4});this._eventSource=o;new mt.internal.PayloadStreamReader(o,{flag:e=>((0,bt.processFlag)(e),e),segment:e=>((0,bt.processSegment)(e),e)},(e,r)=>{t(mt.subsystem.DataSourceState.Interrupted,new mt.LDStreamingError(e,r)),this.stop()},this._logger).addPayloadListener(t=>{this._logConnectionResult(!0),e(t.basis,{initMetadata:this._initMetadata,payload:t})}),o.onclose=()=>{var e;null===(e=this._logger)||void 0===e||e.info("Closed LaunchDarkly stream connection"),t(mt.subsystem.DataSourceState.Closed)},o.onerror=()=>{},o.onopen=e=>{var r;null===(r=this._logger)||void 0===r||r.info("Opened LaunchDarkly stream connection"),this._initMetadata=mt.internal.initMetadataFromHeaders(e.headers),t(mt.subsystem.DataSourceState.Valid)},o.onretrying=e=>{var t;null===(t=this._logger)||void 0===t||t.info(`Will retry stream connection in ${e.delayMillis} milliseconds`)}}stop(){var e;null===(e=this._eventSource)||void 0===e||e.close(),this._eventSource=void 0}close(){this.stop()}};var St={};Object.defineProperty(St,"__esModule",{value:!0});const Et=le,wt=be,kt=Se,Ot=Ee;St.default=class{constructor(e,t,r){this._featureStore=e,this._hasEventListeners=t,this._onChange=r,this._dependencyTracker=new kt.default}init(e,t,r){this.applyChanges(!0,e,t,r)}upsert(e,t,r){this.applyChanges(!1,{[e.namespace]:{[t.key]:t}},r)}applyChanges(e,t,r,i,n){const s=this._hasEventListeners();let a={};s&&this._featureStore.all(Et.default.Features,e=>{this._featureStore.all(Et.default.Segments,t=>{a={[Et.default.Features.namespace]:e,[Et.default.Segments.namespace]:t}})}),(a=>{this._featureStore.applyChanges(e,t,()=>{Promise.resolve().then(()=>{if(e&&this._dependencyTracker.reset(),Object.entries(t).forEach(([e,t])=>{Object.keys(t||{}).forEach(r=>{const i=t[r];this._dependencyTracker.updateDependenciesFrom(e,r,(0,wt.computeDependencies)(e,i))})}),s){const r=new Ot.default;Object.keys(t).forEach(i=>{const n=a[i],s=t[i];let o;o=e?Object.assign(Object.assign({},n),s):Object.assign({},s),Object.keys(o).forEach(e=>{this.addIfModified(i,e,n&&n[e],s&&s[e],r)})}),this.sendChangeEvents(r)}}),null==r||r()},i,n)})(a)}addIfModified(e,t,r,i,n){i&&r&&i.version<=r.version||this._dependencyTracker.updateModifiedItems(n,e,t)}sendChangeEvents(e){e.enumerate((e,t)=>{e===Et.default.Features.namespace&&this._onChange(t)})}};var xt={},Dt={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultValues=e.DEFAULT_POLL_INTERVAL=void 0;const t=o,r=P,i=st,n={baseUri:t.TypeValidators.String,streamUri:t.TypeValidators.String,eventsUri:t.TypeValidators.String,timeout:t.TypeValidators.Number,capacity:t.TypeValidators.Number,logger:t.TypeValidators.Object,featureStore:t.TypeValidators.ObjectOrFactory,dataSystem:t.TypeValidators.Object,bigSegments:t.TypeValidators.Object,updateProcessor:t.TypeValidators.ObjectOrFactory,flushInterval:t.TypeValidators.Number,pollInterval:t.TypeValidators.numberWithMin(30),proxyOptions:t.TypeValidators.Object,offline:t.TypeValidators.Boolean,stream:t.TypeValidators.Boolean,streamInitialReconnectDelay:t.TypeValidators.Number,useLdd:t.TypeValidators.Boolean,sendEvents:t.TypeValidators.Boolean,allAttributesPrivate:t.TypeValidators.Boolean,privateAttributes:t.TypeValidators.StringArray,contextKeysCapacity:t.TypeValidators.Number,contextKeysFlushInterval:t.TypeValidators.Number,tlsParams:t.TypeValidators.Object,diagnosticOptOut:t.TypeValidators.Boolean,diagnosticRecordingInterval:t.TypeValidators.numberWithMin(60),wrapperName:t.TypeValidators.String,wrapperVersion:t.TypeValidators.String,application:t.TypeValidators.Object,payloadFilterKey:t.TypeValidators.stringMatchingRegex(/^[a-zA-Z0-9](\w|\.|-)*$/),hooks:t.TypeValidators.createTypeArray("Hook[]",{}),enableEventCompression:t.TypeValidators.Boolean,dataSourceOptionsType:t.TypeValidators.String};e.DEFAULT_POLL_INTERVAL=30;const s={dataSourceOptionsType:"standard",streamInitialReconnectDelay:1,pollInterval:e.DEFAULT_POLL_INTERVAL},a={dataSourceOptionsType:"streamingOnly",streamInitialReconnectDelay:1},l={dataSourceOptionsType:"pollingOnly",pollInterval:e.DEFAULT_POLL_INTERVAL},c={dataSource:s};function u(r,i){const s=[],a=Object.assign({},i);return Object.keys(r).forEach(i=>{var o;const l=r[i],c=n[i];if(c)if(c.is(l))a[i]=l;else if("boolean"===c.getType())s.push(t.OptionMessages.wrongOptionTypeBoolean(i,typeof l)),a[i]=!!l;else if(c instanceof t.NumberWithMinimum&&t.TypeValidators.Number.is(l)){const{min:e}=c;s.push(t.OptionMessages.optionBelowMinimum(i,l,e)),a[i]=e}else s.push(t.OptionMessages.wrongOptionType(i,c.getType(),typeof l)),a[i]=e.defaultValues[i];else null===(o=r.logger)||void 0===o||o.warn(t.OptionMessages.unknownOption(i))}),{errors:s,validatedOptions:a}}e.defaultValues={baseUri:"https://sdk.launchdarkly.com",streamUri:"https://stream.launchdarkly.com",eventsUri:t.ServiceEndpoints.DEFAULT_EVENTS,stream:!0,streamInitialReconnectDelay:1,sendEvents:!0,timeout:5,capacity:1e4,flushInterval:5,pollInterval:e.DEFAULT_POLL_INTERVAL,offline:!1,useLdd:!1,allAttributesPrivate:!1,privateAttributes:[],contextKeysCapacity:1e3,contextKeysFlushInterval:300,diagnosticOptOut:!1,diagnosticRecordingInterval:900,featureStore:()=>new i.default,enableEventCompression:!1,dataSystem:c};e.default=class{constructor(n={},o={}){var c;n=n||{},this.logger=n.logger;const{errors:d,validatedOptions:h}=u(n,e.defaultValues),f=h;if(d.forEach(e=>{var t;null===(t=this.logger)||void 0===t||t.warn(e)}),function(e,r){var i,n,s;const{baseUri:a,streamUri:o,eventsUri:l}=e,c=null!=o,u=null!=a,d=null!=l;c===u&&c===d||(!c&&r.stream&&(null===(i=r.logger)||void 0===i||i.warn(t.OptionMessages.partialEndpoint("streamUri"))),u||null===(n=r.logger)||void 0===n||n.warn(t.OptionMessages.partialEndpoint("baseUri")),!d&&r.sendEvents&&(null===(s=r.logger)||void 0===s||s.warn(t.OptionMessages.partialEndpoint("eventsUri"))))}(n,f),n.dataSystem){const{errors:e,validatedOptions:o}=function(e){const i=[],n=Object.assign({},e);if(e.persistentStore&&!t.TypeValidators.ObjectOrFactory.is(e.persistentStore)&&(n.persistentStore=void 0,i.push(t.OptionMessages.wrongOptionType("persistentStore","LDFeatureStore",typeof e.persistentStore))),e.dataSource){let o,c;(0,r.isStandardOptions)(e.dataSource)?({errors:o,validatedOptions:c}=u(e.dataSource,s)):(0,r.isStreamingOnlyOptions)(e.dataSource)?({errors:o,validatedOptions:c}=u(e.dataSource,a)):(0,r.isPollingOnlyOptions)(e.dataSource)?({errors:o,validatedOptions:c}=u(e.dataSource,l)):(c=s,o=[t.OptionMessages.wrongOptionType("dataSource","DataSourceOptions",typeof e.dataSource)]),n.dataSource=c,i.push(...o)}else n.dataSource=s;return{errors:i,validatedOptions:n}}(n.dataSystem),c=o;this.dataSystem={dataSource:c.dataSource,useLdd:c.useLdd,featureStoreFactory:e=>void 0===c.persistentStore?new i.default:t.TypeValidators.Function.is(c.persistentStore)?c.persistentStore(e):c.persistentStore},e.forEach(e=>{var t;null===(t=this.logger)||void 0===t||t.warn(e)})}this.serviceEndpoints=new t.ServiceEndpoints(f.streamUri,f.baseUri,f.eventsUri,o.analyticsEventPath,o.diagnosticEventPath,o.includeAuthorizationHeader,f.payloadFilterKey),this.eventsCapacity=f.capacity,this.timeout=f.timeout,this.bigSegments=f.bigSegments,this.flushInterval=f.flushInterval,this.pollInterval=f.pollInterval,this.proxyOptions=f.proxyOptions,this.offline=f.offline,this.stream=f.stream,this.streamInitialReconnectDelay=f.streamInitialReconnectDelay,this.useLdd=f.useLdd,this.sendEvents=f.sendEvents,this.allAttributesPrivate=f.allAttributesPrivate,this.privateAttributes=f.privateAttributes,this.contextKeysCapacity=f.contextKeysCapacity,this.contextKeysFlushInterval=f.contextKeysFlushInterval,this.tlsParams=f.tlsParams,this.diagnosticOptOut=f.diagnosticOptOut,this.wrapperName=f.wrapperName,this.payloadFilterKey=f.payloadFilterKey,this.wrapperVersion=f.wrapperVersion,this.tags=new t.ApplicationTags(f),this.diagnosticRecordingInterval=f.diagnosticRecordingInterval,t.TypeValidators.Function.is(f.updateProcessor)?this.updateProcessorFactory=f.updateProcessor:this.updateProcessorFactory=()=>f.updateProcessor,t.TypeValidators.Function.is(f.featureStore)?this.featureStoreFactory=f.featureStore:this.featureStoreFactory=()=>f.featureStore,this.hooks=f.hooks,this.enableEventCompression=f.enableEventCompression,this.getImplementationHooks=null!==(c=o.getImplementationHooks)&&void 0!==c?c:()=>[],this.applicationInfo=f.application}}}(Dt),Object.defineProperty(xt,"__esModule",{value:!0});const Pt=o,Rt=l,It=Dt;xt.default=(e,t,r)=>{var i,n,s,a,o,l,c,u,d,h,f,p;let v,g,_;return(null===(i=e.dataSystem)||void 0===i?void 0:i.dataSource)?((0,Rt.isStandardOptions)(e.dataSystem.dataSource)||(0,Rt.isPollingOnlyOptions)(e.dataSystem.dataSource))&&e.dataSystem.dataSource.pollInterval&&(v=(0,Pt.secondsToMillis)(e.dataSystem.dataSource.pollInterval)):v=(0,Pt.secondsToMillis)(e.pollInterval),(null===(n=e.dataSystem)||void 0===n?void 0:n.dataSource)?((0,Rt.isStandardOptions)(e.dataSystem.dataSource)||(0,Rt.isStreamingOnlyOptions)(e.dataSystem.dataSource))&&e.dataSystem.dataSource.streamInitialReconnectDelay&&(g=(0,Pt.secondsToMillis)(e.dataSystem.dataSource.streamInitialReconnectDelay)):g=(0,Pt.secondsToMillis)(e.streamInitialReconnectDelay),_=(null===(s=e.dataSystem)||void 0===s?void 0:s.dataSource)?(0,Rt.isPollingOnlyOptions)(null===(a=e.dataSystem)||void 0===a?void 0:a.dataSource):!e.stream,Object.assign(Object.assign(Object.assign({customBaseURI:e.serviceEndpoints.polling!==It.defaultValues.baseUri,customStreamURI:e.serviceEndpoints.streaming!==It.defaultValues.streamUri,customEventsURI:e.serviceEndpoints.events!==It.defaultValues.eventsUri,eventsCapacity:e.eventsCapacity,connectTimeoutMillis:(0,Pt.secondsToMillis)(e.timeout),socketTimeoutMillis:(0,Pt.secondsToMillis)(e.timeout),eventsFlushIntervalMillis:(0,Pt.secondsToMillis)(e.flushInterval)},v?{pollingIntervalMillis:v}:null),g?{reconnectTimeMillis:g}:null),{contextKeysFlushIntervalMillis:(0,Pt.secondsToMillis)(e.contextKeysFlushInterval),diagnosticRecordingIntervalMillis:(0,Pt.secondsToMillis)(e.diagnosticRecordingInterval),streamingDisabled:_,usingRelayDaemon:null!==(l=null===(o=e.dataSystem)||void 0===o?void 0:o.useLdd)&&void 0!==l?l:e.useLdd,offline:e.offline,allAttributesPrivate:e.allAttributesPrivate,contextKeysCapacity:e.contextKeysCapacity,usingProxy:!!(null===(u=(c=t.requests).usingProxy)||void 0===u?void 0:u.call(c)),usingProxyAuthenticator:!!(null===(h=(d=t.requests).usingProxyAuth)||void 0===h?void 0:h.call(d)),dataStoreType:null!==(p=null===(f=r.getDescription)||void 0===f?void 0:f.call(r))&&void 0!==p?p:"memory"})};var Mt={};Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.allAsync=Mt.firstSeriesAsync=Mt.allSeriesAsync=Mt.firstResult=void 0,Mt.firstResult=function(e,t){let r;return null==e||e.some((e,i)=>(r=t(e,i),!!r)),r};function Tt(e,t,r,i,n){e?i<(null==e?void 0:e.length)?t(e[i],i,s=>{if(r){if(!s)return void n(!1)}else if(s)return void n(!0);e.length>50?Promise.resolve().then(()=>{Tt(e,t,r,i+1,n)}):Tt(e,t,r,i+1,n)}):n(r):n(!1)}Mt.allSeriesAsync=function(e,t,r){Tt(e,t,!0,0,r)},Mt.firstSeriesAsync=function(e,t,r){Tt(e,t,!1,0,r)},Mt.allAsync=function(e,t,r){e?Promise.all(null==e?void 0:e.map(e=>new Promise(r=>{t(e,r)}))).then(e=>{r(e.every(e=>e))}):r(!1)};var At={},Ct={};Object.defineProperty(Ct,"__esModule",{value:!0});class Ft{static prerequisiteFailed(e){return{kind:"PREREQUISITE_FAILED",prerequisiteKey:e}}static ruleMatch(e,t){return{kind:"RULE_MATCH",ruleId:e,ruleIndex:t}}}Ft.Fallthrough={kind:"FALLTHROUGH"},Ft.Off={kind:"OFF"},Ft.TargetMatch={kind:"TARGET_MATCH"},Ct.default=Ft,Object.defineProperty(At,"__esModule",{value:!0});const jt=Ct;class Lt{constructor(e,t,r){this.isError=e,this.detail=t,this.message=r,this.isError=e,this.detail=t,this.message=r}get isOff(){return this.detail.reason.kind===jt.default.Off.kind}setDefault(e){this.detail.value=e}static forError(e,t,r){return new Lt(!0,{value:null!=r?r:null,variationIndex:null,reason:{kind:"ERROR",errorKind:e}},t)}static forSuccess(e,t,r){return new Lt(!1,{value:e,variationIndex:void 0===r?null:r,reason:t})}}At.default=Lt;var Nt={},$t={};Object.defineProperty($t,"__esModule",{value:!0});$t.default=class{constructor(e){this._crypto=e}_sha1Hex(e){const t=this._crypto.createHash("sha1");if(t.update(e),!t.digest)throw new Error("Platform must implement digest or asyncDigest");return t.digest("hex")}bucket(e,t,r,i,n="user",s){const a=function(e){return"string"==typeof e?e:Number.isInteger(e)?String(e):null}(e.valueForKind(r,n));if(null===a){return[0,e.kinds.indexOf(n)>=0]}const o=`${s?Number(s):`${t}.${i}`}.${a}`;return[parseInt(this._sha1Hex(o).substring(0,15),16)/0x1000000000000000,!0]}};var Bt={},Vt={};Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.getBucketBy=Vt.getOffVariation=Vt.getVariation=void 0;const zt=o,Ht=At,{ErrorKinds:Ut}=zt.internal,Kt=new zt.AttributeReference("key");function qt(e,t,r){return zt.TypeValidators.Number.is(t)&&t>=0&&t<e.variations.length?Ht.default.forSuccess(e.variations[t],r,t):Ht.default.forError(Ut.MalformedFlag,"Invalid variation index in flag")}Vt.getVariation=qt,Vt.getOffVariation=function(e,t){return zt.TypeValidators.Number.is(e.offVariation)?qt(e,e.offVariation,t):Ht.default.forSuccess(null,t)},Vt.getBucketBy=function(e,t){var r;return null!==(r=e?void 0:t)&&void 0!==r?r:Kt},Object.defineProperty(Bt,"__esModule",{value:!0});const Wt=o,Gt=Mt,Xt=Ct,Jt=Vt;function Yt(e,t,r){const i=r.key(t.contextKind);if(void 0!==i){if(t.values.indexOf(i)>=0)return(0,Jt.getVariation)(e,t.variation,Xt.default.TargetMatch)}}Bt.default=function(e,t){var r;return(null===(r=e.contextTargets)||void 0===r?void 0:r.length)?(0,Gt.firstResult)(e.contextTargets,r=>{if(!r.contextKind||r.contextKind===Wt.Context.UserKind){const i=(e.targets||[]).find(e=>e.variation===r.variation);return i?Yt(e,i,t):void 0}return Yt(e,r,t)}):(0,Gt.firstResult)(e.targets,r=>Yt(e,r,t))};var Zt={};Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.default=function(e){return`${e.key}.g${e.generation}`};var Qt={},er={},tr={exports:{}};var rr={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};var ir="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:n}=rr,s=ir,a=(t=e.exports={}).re=[],o=t.safeRe=[],l=t.src=[],c=t.t={};let u=0;const d="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",n],[d,i]],f=(e,t,r)=>{const i=(e=>{for(const[t,r]of h)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),n=u++;s(e,n,t),c[e]=n,l[n]=t,a[n]=new RegExp(t,r?"g":void 0),o[n]=new RegExp(i,r?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),f("MAINVERSION",`(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})`),f("MAINVERSIONLOOSE",`(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASEIDENTIFIER",`(?:${l[c.NUMERICIDENTIFIER]}|${l[c.NONNUMERICIDENTIFIER]})`),f("PRERELEASEIDENTIFIERLOOSE",`(?:${l[c.NUMERICIDENTIFIERLOOSE]}|${l[c.NONNUMERICIDENTIFIER]})`),f("PRERELEASE",`(?:-(${l[c.PRERELEASEIDENTIFIER]}(?:\\.${l[c.PRERELEASEIDENTIFIER]})*))`),f("PRERELEASELOOSE",`(?:-?(${l[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[c.PRERELEASEIDENTIFIERLOOSE]})*))`),f("BUILDIDENTIFIER",`${d}+`),f("BUILD",`(?:\\+(${l[c.BUILDIDENTIFIER]}(?:\\.${l[c.BUILDIDENTIFIER]})*))`),f("FULLPLAIN",`v?${l[c.MAINVERSION]}${l[c.PRERELEASE]}?${l[c.BUILD]}?`),f("FULL",`^${l[c.FULLPLAIN]}$`),f("LOOSEPLAIN",`[v=\\s]*${l[c.MAINVERSIONLOOSE]}${l[c.PRERELEASELOOSE]}?${l[c.BUILD]}?`),f("LOOSE",`^${l[c.LOOSEPLAIN]}$`),f("GTLT","((?:<|>)?=?)"),f("XRANGEIDENTIFIERLOOSE",`${l[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),f("XRANGEIDENTIFIER",`${l[c.NUMERICIDENTIFIER]}|x|X|\\*`),f("XRANGEPLAIN",`[v=\\s]*(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:${l[c.PRERELEASE]})?${l[c.BUILD]}?)?)?`),f("XRANGEPLAINLOOSE",`[v=\\s]*(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:${l[c.PRERELEASELOOSE]})?${l[c.BUILD]}?)?)?`),f("XRANGE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAIN]}$`),f("XRANGELOOSE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAINLOOSE]}$`),f("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),f("COERCERTL",l[c.COERCE],!0),f("LONETILDE","(?:~>?)"),f("TILDETRIM",`(\\s*)${l[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",f("TILDE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAIN]}$`),f("TILDELOOSE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAINLOOSE]}$`),f("LONECARET","(?:\\^)"),f("CARETTRIM",`(\\s*)${l[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",f("CARET",`^${l[c.LONECARET]}${l[c.XRANGEPLAIN]}$`),f("CARETLOOSE",`^${l[c.LONECARET]}${l[c.XRANGEPLAINLOOSE]}$`),f("COMPARATORLOOSE",`^${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]})$|^$`),f("COMPARATOR",`^${l[c.GTLT]}\\s*(${l[c.FULLPLAIN]})$|^$`),f("COMPARATORTRIM",`(\\s*)${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]}|${l[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",f("HYPHENRANGE",`^\\s*(${l[c.XRANGEPLAIN]})\\s+-\\s+(${l[c.XRANGEPLAIN]})\\s*$`),f("HYPHENRANGELOOSE",`^\\s*(${l[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[c.XRANGEPLAINLOOSE]})\\s*$`),f("STAR","(<|>)?=?\\s*\\*"),f("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),f("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(tr,tr.exports);var nr=tr.exports;const sr=Object.freeze({loose:!0}),ar=Object.freeze({});var or=e=>e?"object"!=typeof e?sr:e:ar;const lr=/^[0-9]+$/,cr=(e,t)=>{const r=lr.test(e),i=lr.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};var ur={compareIdentifiers:cr,rcompareIdentifiers:(e,t)=>cr(t,e)};const dr=ir,{MAX_LENGTH:hr,MAX_SAFE_INTEGER:fr}=rr,{safeRe:pr,t:vr}=nr,gr=or,{compareIdentifiers:_r}=ur;var yr=class e{constructor(t,r){if(r=gr(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>hr)throw new TypeError(`version is longer than ${hr} characters`);dr("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const i=t.trim().match(r.loose?pr[vr.LOOSE]:pr[vr.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>fr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>fr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>fr||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<fr)return t}return e}):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(dr("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if("string"==typeof t&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),_r(this.major,t.major)||_r(this.minor,t.minor)||_r(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const e=this.prerelease[r],i=t.prerelease[r];if(dr("prerelease compare",r,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return _r(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{const e=this.build[r],i=t.build[r];if(dr("prerelease compare",r,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return _r(e,i)}while(++r)}inc(e,t,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(0===this.prerelease.length)this.prerelease=[e];else{let i=this.prerelease.length;for(;--i>=0;)"number"==typeof this.prerelease[i]&&(this.prerelease[i]++,i=-2);if(-1===i){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let i=[t,e];!1===r&&(i=[t]),0===_r(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const mr=yr;var br=(e,t,r=!1)=>{if(e instanceof mr)return e;try{return new mr(e,t)}catch(e){if(!r)return null;throw e}};const Sr=br;var Er=(e,t)=>{const r=Sr(e,t);return r?r.version:null};const wr=br;var kr=(e,t)=>{const r=wr(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const Or=yr;var xr=(e,t,r,i,n)=>{"string"==typeof r&&(n=i,i=r,r=void 0);try{return new Or(e instanceof Or?e.version:e,r).inc(t,i,n).version}catch(e){return null}};const Dr=br;var Pr=(e,t)=>{const r=Dr(e,null,!0),i=Dr(t,null,!0),n=r.compare(i);if(0===n)return null;const s=n>0,a=s?r:i,o=s?i:r,l=!!a.prerelease.length;if(!!o.prerelease.length&&!l)return o.patch||o.minor?a.patch?"patch":a.minor?"minor":"major":"major";const c=l?"pre":"";return r.major!==i.major?c+"major":r.minor!==i.minor?c+"minor":r.patch!==i.patch?c+"patch":"prerelease"};const Rr=yr;var Ir=(e,t)=>new Rr(e,t).major;const Mr=yr;var Tr=(e,t)=>new Mr(e,t).minor;const Ar=yr;var Cr=(e,t)=>new Ar(e,t).patch;const Fr=br;var jr=(e,t)=>{const r=Fr(e,t);return r&&r.prerelease.length?r.prerelease:null};const Lr=yr;var Nr=(e,t,r)=>new Lr(e,r).compare(new Lr(t,r));const $r=Nr;var Br=(e,t,r)=>$r(t,e,r);const Vr=Nr;var zr=(e,t)=>Vr(e,t,!0);const Hr=yr;var Ur=(e,t,r)=>{const i=new Hr(e,r),n=new Hr(t,r);return i.compare(n)||i.compareBuild(n)};const Kr=Ur;var qr=(e,t)=>e.sort((e,r)=>Kr(e,r,t));const Wr=Ur;var Gr=(e,t)=>e.sort((e,r)=>Wr(r,e,t));const Xr=Nr;var Jr=(e,t,r)=>Xr(e,t,r)>0;const Yr=Nr;var Zr=(e,t,r)=>Yr(e,t,r)<0;const Qr=Nr;var ei=(e,t,r)=>0===Qr(e,t,r);const ti=Nr;var ri=(e,t,r)=>0!==ti(e,t,r);const ii=Nr;var ni=(e,t,r)=>ii(e,t,r)>=0;const si=Nr;var ai=(e,t,r)=>si(e,t,r)<=0;const oi=ei,li=ri,ci=Jr,ui=ni,di=Zr,hi=ai;var fi=(e,t,r,i)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return oi(e,r,i);case"!=":return li(e,r,i);case">":return ci(e,r,i);case">=":return ui(e,r,i);case"<":return di(e,r,i);case"<=":return hi(e,r,i);default:throw new TypeError(`Invalid operator: ${t}`)}};const pi=yr,vi=br,{safeRe:gi,t:_i}=nr;var yi,mi,bi,Si,Ei,wi,ki,Oi,xi,Di,Pi=(e,t)=>{if(e instanceof pi)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=gi[_i.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),gi[_i.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;gi[_i.COERCERTL].lastIndex=-1}else r=e.match(gi[_i.COERCE]);return null===r?null:vi(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function Ri(){if(Si)return bi;function e(t){var r=this;if(r instanceof e||(r=new e),r.tail=null,r.head=null,r.length=0,t&&"function"==typeof t.forEach)t.forEach(function(e){r.push(e)});else if(arguments.length>0)for(var i=0,n=arguments.length;i<n;i++)r.push(arguments[i]);return r}function t(e,t,r){var i=t===e.head?new n(r,null,t,e):new n(r,t,t.next,e);return null===i.next&&(e.tail=i),null===i.prev&&(e.head=i),e.length++,i}function r(e,t){e.tail=new n(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function i(e,t){e.head=new n(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function n(e,t,r,i){if(!(this instanceof n))return new n(e,t,r,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}Si=1,bi=e,e.Node=n,e.create=e,e.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},e.prototype.unshiftNode=function(e){if(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.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},e.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)r(this,arguments[e]);return this.length},e.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},e.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},e.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},e.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,i=0;null!==r;i++)e.call(t,r.value,i,this),r=r.next},e.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,i=this.length-1;null!==r;i--)e.call(t,r.value,i,this),r=r.prev},e.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},e.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},e.prototype.map=function(t,r){r=r||this;for(var i=new e,n=this.head;null!==n;)i.push(t.call(r,n.value,this)),n=n.next;return i},e.prototype.mapReverse=function(t,r){r=r||this;for(var i=new e,n=this.tail;null!==n;)i.push(t.call(r,n.value,this)),n=n.prev;return i},e.prototype.reduce=function(e,t){var r,i=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,r=this.head.value}for(var n=0;null!==i;n++)r=e(r,i.value,n),i=i.next;return r},e.prototype.reduceReverse=function(e,t){var r,i=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,r=this.tail.value}for(var n=this.length-1;null!==i;n--)r=e(r,i.value,n),i=i.prev;return r},e.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},e.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},e.prototype.slice=function(t,r){(r=r||this.length)<0&&(r+=this.length),(t=t||0)<0&&(t+=this.length);var i=new e;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=0,s=this.head;null!==s&&n<t;n++)s=s.next;for(;null!==s&&n<r;n++,s=s.next)i.push(s.value);return i},e.prototype.sliceReverse=function(t,r){(r=r||this.length)<0&&(r+=this.length),(t=t||0)<0&&(t+=this.length);var i=new e;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=this.length,s=this.tail;null!==s&&n>r;n--)s=s.prev;for(;null!==s&&n>t;n--,s=s.prev)i.push(s.value);return i},e.prototype.splice=function(e,r,...i){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,s=this.head;null!==s&&n<e;n++)s=s.next;var a=[];for(n=0;s&&n<r;n++)a.push(s.value),s=this.removeNode(s);null===s&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(n=0;n<i.length;n++)s=t(this,s,i[n]);return a},e.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var i=r.prev;r.prev=r.next,r.next=i}return this.head=t,this.tail=e,this};try{(mi?yi:(mi=1,yi=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}))(e)}catch(e){}return bi}function Ii(){if(Oi)return ki;Oi=1;class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof n)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!p(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&v(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&h)|(this.options.loose&&f))+":"+e,i=r.get(t);if(i)return i;const a=this.options.loose,v=a?o[l.HYPHENRANGELOOSE]:o[l.HYPHENRANGE];e=e.replace(v,D(this.options.includePrerelease)),s("hyphen replace",e),e=e.replace(o[l.COMPARATORTRIM],c),s("comparator trim",e),e=e.replace(o[l.TILDETRIM],u),s("tilde trim",e),e=e.replace(o[l.CARETTRIM],d),s("caret trim",e);let g=e.split(" ").map(e=>_(e,this.options)).join(" ").split(/\s+/).map(e=>x(e,this.options));a&&(g=g.filter(e=>(s("loose invalid filter",e,this.options),!!e.match(o[l.COMPARATORLOOSE])))),s("range list",g);const y=new Map,m=g.map(e=>new n(e,this.options));for(const e of m){if(p(e))return[e];y.set(e.value,e)}y.size>1&&y.has("")&&y.delete("");const b=[...y.values()];return r.set(t,b),b}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(e=>g(e,r)&&t.set.some(t=>g(t,r)&&e.every(e=>t.every(t=>e.intersects(t,r)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(P(this.set[t],e,this.options))return!0;return!1}}ki=e;const t=function(){if(wi)return Ei;wi=1;const e=Ri(),t=Symbol("max"),r=Symbol("length"),i=Symbol("lengthCalculator"),n=Symbol("allowStale"),s=Symbol("maxAge"),a=Symbol("dispose"),o=Symbol("noDisposeOnSet"),l=Symbol("lruList"),c=Symbol("cache"),u=Symbol("updateAgeOnGet"),d=()=>1,h=(e,t,r)=>{const i=e[c].get(t);if(i){const t=i.value;if(f(e,t)){if(v(e,i),!e[n])return}else r&&(e[u]&&(i.value.now=Date.now()),e[l].unshiftNode(i));return t.value}},f=(e,t)=>{if(!t||!t.maxAge&&!e[s])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[s]&&r>e[s]},p=e=>{if(e[r]>e[t])for(let i=e[l].tail;e[r]>e[t]&&null!==i;){const t=i.prev;v(e,i),i=t}},v=(e,t)=>{if(t){const i=t.value;e[a]&&e[a](i.key,i.value),e[r]-=i.length,e[c].delete(i.key),e[l].removeNode(t)}};class g{constructor(e,t,r,i,n){this.key=e,this.value=t,this.length=r,this.now=i,this.maxAge=n||0}}const _=(e,t,r,i)=>{let s=r.value;f(e,s)&&(v(e,r),e[n]||(s=void 0)),s&&t.call(i,s.value,s.key,e)};return Ei=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[t]=e.max||1/0;const r=e.length||d;if(this[i]="function"!=typeof r?d:r,this[n]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[s]=e.maxAge||0,this[a]=e.dispose,this[o]=e.noDisposeOnSet||!1,this[u]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[t]=e||1/0,p(this)}get max(){return this[t]}set allowStale(e){this[n]=!!e}get allowStale(){return this[n]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[s]=e,p(this)}get maxAge(){return this[s]}set lengthCalculator(e){"function"!=typeof e&&(e=d),e!==this[i]&&(this[i]=e,this[r]=0,this[l].forEach(e=>{e.length=this[i](e.value,e.key),this[r]+=e.length})),p(this)}get lengthCalculator(){return this[i]}get length(){return this[r]}get itemCount(){return this[l].length}rforEach(e,t){t=t||this;for(let r=this[l].tail;null!==r;){const i=r.prev;_(this,e,r,t),r=i}}forEach(e,t){t=t||this;for(let r=this[l].head;null!==r;){const i=r.next;_(this,e,r,t),r=i}}keys(){return this[l].toArray().map(e=>e.key)}values(){return this[l].toArray().map(e=>e.value)}reset(){this[a]&&this[l]&&this[l].length&&this[l].forEach(e=>this[a](e.key,e.value)),this[c]=new Map,this[l]=new e,this[r]=0}dump(){return this[l].map(e=>!f(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[l]}set(e,n,u){if((u=u||this[s])&&"number"!=typeof u)throw new TypeError("maxAge must be a number");const d=u?Date.now():0,h=this[i](n,e);if(this[c].has(e)){if(h>this[t])return v(this,this[c].get(e)),!1;const i=this[c].get(e).value;return this[a]&&(this[o]||this[a](e,i.value)),i.now=d,i.maxAge=u,i.value=n,this[r]+=h-i.length,i.length=h,this.get(e),p(this),!0}const f=new g(e,n,h,d,u);return f.length>this[t]?(this[a]&&this[a](e,n),!1):(this[r]+=f.length,this[l].unshift(f),this[c].set(e,this[l].head),p(this),!0)}has(e){if(!this[c].has(e))return!1;const t=this[c].get(e).value;return!f(this,t)}get(e){return h(this,e,!0)}peek(e){return h(this,e,!1)}pop(){const e=this[l].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[c].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const i=e[r],n=i.e||0;if(0===n)this.set(i.k,i.v);else{const e=n-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[c].forEach((e,t)=>h(this,t,!1))}},Ei}(),r=new t({max:1e3}),i=or,n=Mi(),s=ir,a=yr,{safeRe:o,t:l,comparatorTrimReplace:c,tildeTrimReplace:u,caretTrimReplace:d}=nr,{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:f}=rr,p=e=>"<0.0.0-0"===e.value,v=e=>""===e.value,g=(e,t)=>{let r=!0;const i=e.slice();let n=i.pop();for(;r&&i.length;)r=i.every(e=>n.intersects(e,t)),n=i.pop();return r},_=(e,t)=>(s("comp",e,t),e=S(e,t),s("caret",e),e=m(e,t),s("tildes",e),e=w(e,t),s("xrange",e),e=O(e,t),s("stars",e),e),y=e=>!e||"x"===e.toLowerCase()||"*"===e,m=(e,t)=>e.trim().split(/\s+/).map(e=>b(e,t)).join(" "),b=(e,t)=>{const r=t.loose?o[l.TILDELOOSE]:o[l.TILDE];return e.replace(r,(t,r,i,n,a)=>{let o;return s("tilde",e,t,r,i,n,a),y(r)?o="":y(i)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:y(n)?o=`>=${r}.${i}.0 <${r}.${+i+1}.0-0`:a?(s("replaceTilde pr",a),o=`>=${r}.${i}.${n}-${a} <${r}.${+i+1}.0-0`):o=`>=${r}.${i}.${n} <${r}.${+i+1}.0-0`,s("tilde return",o),o})},S=(e,t)=>e.trim().split(/\s+/).map(e=>E(e,t)).join(" "),E=(e,t)=>{s("caret",e,t);const r=t.loose?o[l.CARETLOOSE]:o[l.CARET],i=t.includePrerelease?"-0":"";return e.replace(r,(t,r,n,a,o)=>{let l;return s("caret",e,t,r,n,a,o),y(r)?l="":y(n)?l=`>=${r}.0.0${i} <${+r+1}.0.0-0`:y(a)?l="0"===r?`>=${r}.${n}.0${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.0${i} <${+r+1}.0.0-0`:o?(s("replaceCaret pr",o),l="0"===r?"0"===n?`>=${r}.${n}.${a}-${o} <${r}.${n}.${+a+1}-0`:`>=${r}.${n}.${a}-${o} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${a}-${o} <${+r+1}.0.0-0`):(s("no pr"),l="0"===r?"0"===n?`>=${r}.${n}.${a}${i} <${r}.${n}.${+a+1}-0`:`>=${r}.${n}.${a}${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${a} <${+r+1}.0.0-0`),s("caret return",l),l})},w=(e,t)=>(s("replaceXRanges",e,t),e.split(/\s+/).map(e=>k(e,t)).join(" ")),k=(e,t)=>{e=e.trim();const r=t.loose?o[l.XRANGELOOSE]:o[l.XRANGE];return e.replace(r,(r,i,n,a,o,l)=>{s("xRange",e,r,i,n,a,o,l);const c=y(n),u=c||y(a),d=u||y(o),h=d;return"="===i&&h&&(i=""),l=t.includePrerelease?"-0":"",c?r=">"===i||"<"===i?"<0.0.0-0":"*":i&&h?(u&&(a=0),o=0,">"===i?(i=">=",u?(n=+n+1,a=0,o=0):(a=+a+1,o=0)):"<="===i&&(i="<",u?n=+n+1:a=+a+1),"<"===i&&(l="-0"),r=`${i+n}.${a}.${o}${l}`):u?r=`>=${n}.0.0${l} <${+n+1}.0.0-0`:d&&(r=`>=${n}.${a}.0${l} <${n}.${+a+1}.0-0`),s("xRange return",r),r})},O=(e,t)=>(s("replaceStars",e,t),e.trim().replace(o[l.STAR],"")),x=(e,t)=>(s("replaceGTE0",e,t),e.trim().replace(o[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),D=e=>(t,r,i,n,s,a,o,l,c,u,d,h,f)=>`${r=y(i)?"":y(n)?`>=${i}.0.0${e?"-0":""}`:y(s)?`>=${i}.${n}.0${e?"-0":""}`:a?`>=${r}`:`>=${r}${e?"-0":""}`} ${l=y(c)?"":y(u)?`<${+c+1}.0.0-0`:y(d)?`<${c}.${+u+1}.0-0`:h?`<=${c}.${u}.${d}-${h}`:e?`<${c}.${u}.${+d+1}-0`:`<=${l}`}`.trim(),P=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(s(e[r].semver),e[r].semver!==n.ANY&&e[r].semver.prerelease.length>0){const i=e[r].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0};return ki}function Mi(){if(Di)return xi;Di=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(i,n){if(n=r(n),i instanceof t){if(i.loose===!!n.loose)return i;i=i.value}i=i.trim().split(/\s+/).join(" "),a("comparator",i,n),this.options=n,this.loose=!!n.loose,this.parse(i),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(t){const r=this.options.loose?i[n.COMPARATORLOOSE]:i[n.COMPARATOR],s=t.match(r);if(!s)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==s[1]?s[1]:"","="===this.operator&&(this.operator=""),s[2]?this.semver=new o(s[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(a("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new o(t,this.options)}catch(e){return!1}return s(t,this.operator,this.semver,this.options)}intersects(e,i){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new l(e.value,i).test(this.value):""===e.operator?""===e.value||new l(this.value,i).test(e.semver):(!(i=r(i)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!i.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(s(this.semver,"<",e.semver,i)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(s(this.semver,">",e.semver,i)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}xi=t;const r=or,{safeRe:i,t:n}=nr,s=fi,a=ir,o=yr,l=Ii();return xi}const Ti=Ii();var Ai=(e,t,r)=>{try{t=new Ti(t,r)}catch(e){return!1}return t.test(e)};const Ci=Ii();var Fi=(e,t)=>new Ci(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "));const ji=yr,Li=Ii();var Ni=(e,t,r)=>{let i=null,n=null,s=null;try{s=new Li(t,r)}catch(e){return null}return e.forEach(e=>{s.test(e)&&(i&&-1!==n.compare(e)||(i=e,n=new ji(i,r)))}),i};const $i=yr,Bi=Ii();var Vi=(e,t,r)=>{let i=null,n=null,s=null;try{s=new Bi(t,r)}catch(e){return null}return e.forEach(e=>{s.test(e)&&(i&&1!==n.compare(e)||(i=e,n=new $i(i,r)))}),i};const zi=yr,Hi=Ii(),Ui=Jr;var Ki=(e,t)=>{e=new Hi(e,t);let r=new zi("0.0.0");if(e.test(r))return r;if(r=new zi("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const i=e.set[t];let n=null;i.forEach(e=>{const t=new zi(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":n&&!Ui(t,n)||(n=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),!n||r&&!Ui(r,n)||(r=n)}return r&&e.test(r)?r:null};const qi=Ii();var Wi=(e,t)=>{try{return new qi(e,t).range||"*"}catch(e){return null}};const Gi=yr,Xi=Mi(),{ANY:Ji}=Xi,Yi=Ii(),Zi=Ai,Qi=Jr,en=Zr,tn=ai,rn=ni;var nn=(e,t,r,i)=>{let n,s,a,o,l;switch(e=new Gi(e,i),t=new Yi(t,i),r){case">":n=Qi,s=tn,a=en,o=">",l=">=";break;case"<":n=en,s=rn,a=Qi,o="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Zi(e,t,i))return!1;for(let r=0;r<t.set.length;++r){const c=t.set[r];let u=null,d=null;if(c.forEach(e=>{e.semver===Ji&&(e=new Xi(">=0.0.0")),u=u||e,d=d||e,n(e.semver,u.semver,i)?u=e:a(e.semver,d.semver,i)&&(d=e)}),u.operator===o||u.operator===l)return!1;if((!d.operator||d.operator===o)&&s(e,d.semver))return!1;if(d.operator===l&&a(e,d.semver))return!1}return!0};const sn=nn;var an=(e,t,r)=>sn(e,t,">",r);const on=nn;var ln=(e,t,r)=>on(e,t,"<",r);const cn=Ii();var un=(e,t,r)=>(e=new cn(e,r),t=new cn(t,r),e.intersects(t,r));const dn=Ai,hn=Nr;const fn=Ii(),pn=Mi(),{ANY:vn}=pn,gn=Ai,_n=Nr,yn=[new pn(">=0.0.0-0")],mn=[new pn(">=0.0.0")],bn=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===vn){if(1===t.length&&t[0].semver===vn)return!0;e=r.includePrerelease?yn:mn}if(1===t.length&&t[0].semver===vn){if(r.includePrerelease)return!0;t=mn}const i=new Set;let n,s,a,o,l,c,u;for(const t of e)">"===t.operator||">="===t.operator?n=Sn(n,t,r):"<"===t.operator||"<="===t.operator?s=En(s,t,r):i.add(t.semver);if(i.size>1)return null;if(n&&s){if(a=_n(n.semver,s.semver,r),a>0)return null;if(0===a&&(">="!==n.operator||"<="!==s.operator))return null}for(const e of i){if(n&&!gn(e,String(n),r))return null;if(s&&!gn(e,String(s),r))return null;for(const i of t)if(!gn(e,String(i),r))return!1;return!0}let d=!(!s||r.includePrerelease||!s.semver.prerelease.length)&&s.semver,h=!(!n||r.includePrerelease||!n.semver.prerelease.length)&&n.semver;d&&1===d.prerelease.length&&"<"===s.operator&&0===d.prerelease[0]&&(d=!1);for(const e of t){if(u=u||">"===e.operator||">="===e.operator,c=c||"<"===e.operator||"<="===e.operator,n)if(h&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===h.major&&e.semver.minor===h.minor&&e.semver.patch===h.patch&&(h=!1),">"===e.operator||">="===e.operator){if(o=Sn(n,e,r),o===e&&o!==n)return!1}else if(">="===n.operator&&!gn(n.semver,String(e),r))return!1;if(s)if(d&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===d.major&&e.semver.minor===d.minor&&e.semver.patch===d.patch&&(d=!1),"<"===e.operator||"<="===e.operator){if(l=En(s,e,r),l===e&&l!==s)return!1}else if("<="===s.operator&&!gn(s.semver,String(e),r))return!1;if(!e.operator&&(s||n)&&0!==a)return!1}return!(n&&c&&!s&&0!==a)&&(!(s&&u&&!n&&0!==a)&&(!h&&!d))},Sn=(e,t,r)=>{if(!e)return t;const i=_n(e.semver,t.semver,r);return i>0?e:i<0||">"===t.operator&&">="===e.operator?t:e},En=(e,t,r)=>{if(!e)return t;const i=_n(e.semver,t.semver,r);return i<0?e:i>0||"<"===t.operator&&"<="===e.operator?t:e};var wn=(e,t,r={})=>{if(e===t)return!0;e=new fn(e,r),t=new fn(t,r);let i=!1;e:for(const n of e.set){for(const e of t.set){const t=bn(n,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0};const kn=nr,On=rr,xn=yr,Dn=ur,Pn=(e,t,r)=>{const i=[];let n=null,s=null;const a=e.sort((e,t)=>hn(e,t,r));for(const e of a){dn(e,t,r)?(s=e,n||(n=e)):(s&&i.push([n,s]),s=null,n=null)}n&&i.push([n,null]);const o=[];for(const[e,t]of i)e===t?o.push(e):t||e!==a[0]?t?e===a[0]?o.push(`<=${t}`):o.push(`${e} - ${t}`):o.push(`>=${e}`):o.push("*");const l=o.join(" || "),c="string"==typeof t.raw?t.raw:String(t);return l.length<c.length?l:t};var Rn={parse:br,valid:Er,clean:kr,inc:xr,diff:Pr,major:Ir,minor:Tr,patch:Cr,prerelease:jr,compare:Nr,rcompare:Br,compareLoose:zr,compareBuild:Ur,sort:qr,rsort:Gr,gt:Jr,lt:Zr,eq:ei,neq:ri,gte:ni,lte:ai,cmp:fi,coerce:Pi,Comparator:Mi(),Range:Ii(),satisfies:Ai,toComparators:Fi,maxSatisfying:Ni,minSatisfying:Vi,minVersion:Ki,validRange:Wi,outside:nn,gtr:an,ltr:ln,intersects:un,simplifyRange:Pn,subset:wn,SemVer:xn,re:kn.re,src:kn.src,tokens:kn.t,SEMVER_SPEC_VERSION:On.SEMVER_SPEC_VERSION,RELEASE_TYPES:On.RELEASE_TYPES,compareIdentifiers:Dn.compareIdentifiers,rcompareIdentifiers:Dn.rcompareIdentifiers};Object.defineProperty(er,"__esModule",{value:!0});const In=Rn,Mn=o,Tn=/^\d+(\.\d+)?(\.\d+)?/;function An(e){if(Mn.TypeValidators.String.is(e)&&!e.startsWith("v")){const t=(0,In.parse)(e);if(t)return t;const r=Tn.exec(e);if(r){let t=r[0];for(let e=1;e<r.length;e+=1)void 0===r[e]&&(t+=".0");return t+=e.substring(r[0].length),(0,In.parse)(t)}}return null}function Cn(e){return(t,r)=>{const i=An(t),n=An(r);return!!(i&&n&&e(i,n))}}function Fn(e,t,r){return(i,n)=>!(!t.is(i)||!t.is(n))&&(r?e(r(i),r(n)):e(i,n))}function jn(e){return"number"==typeof e?e:Date.parse(e)}const Ln={in:(e,t)=>e===t,endsWith:Fn((e,t)=>e.endsWith(t),Mn.TypeValidators.String),startsWith:Fn((e,t)=>e.startsWith(t),Mn.TypeValidators.String),matches:Fn((e,t)=>function(e,t){try{return new RegExp(e).test(t)}catch(e){return!1}}(t,e),Mn.TypeValidators.String),contains:Fn((e,t)=>e.indexOf(t)>-1,Mn.TypeValidators.String),lessThan:Fn((e,t)=>e<t,Mn.TypeValidators.Number),lessThanOrEqual:Fn((e,t)=>e<=t,Mn.TypeValidators.Number),greaterThan:Fn((e,t)=>e>t,Mn.TypeValidators.Number),greaterThanOrEqual:Fn((e,t)=>e>=t,Mn.TypeValidators.Number),before:Fn((e,t)=>e<t,Mn.TypeValidators.Date,jn),after:Fn((e,t)=>e>t,Mn.TypeValidators.Date,jn),semVerEqual:Cn((e,t)=>0===e.compare(t)),semVerLessThan:Cn((e,t)=>e.compare(t)<0),semVerGreaterThan:Cn((e,t)=>e.compare(t)>0)};er.default=class{static is(e){return Object.prototype.hasOwnProperty.call(Ln,e)}static execute(e,t,r){var i,n;return null!==(n=null===(i=Ln[e])||void 0===i?void 0:i.call(Ln,t,r))&&void 0!==n&&n}},Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.maybeNegate=void 0;const Nn=er;function $n(e,t){return e.negate?!t:t}function Bn(e,t,r){return r.some(r=>Nn.default.execute(e,t,r))}Qt.maybeNegate=$n,Qt.default=function(e,t){const r=t.valueForKind(e.attributeReference,e.contextKind);return null!=r&&(Array.isArray(r)?$n(e,r.some(t=>Bn(e.op,t,e.values))):$n(e,Bn(e.op,r,e.values)))};var Vn={};function zn(e,t,r,i){if(t)for(let r=0;r<t.length;r+=1){const i=t[r],n=e.key(i.contextKind);if(n)if(i.generated_valuesSet){if(i.generated_valuesSet.has(n))return!0}else if(i.values.includes(n))return!0}if(i){const t=e.key("user");if(t&&i.has(t))return!0}else if(r){const t=e.key("user");if(t&&r.includes(t))return!0}return!1}Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.default=function(e,t){if(zn(t,e.includedContexts,e.included,e.generated_includedSet))return!0;const r=zn(t,e.excludedContexts,e.excluded,e.generated_excludedSet);return r?!r:void 0},Object.defineProperty(Nt,"__esModule",{value:!0});const Hn=o,Un=$t,Kn=Mt,qn=At,Wn=Bt,Gn=Zt,Xn=Qt,Jn=Vn,Yn=Ct,Zn=Vt,{ErrorKinds:Qn}=Hn.internal,es={HEALTHY:1,STALE:2,STORE_ERROR:3,NOT_CONFIGURED:4};function ts(e){return void 0!==e&&es[e]||0}function rs(e,t){return void 0!==e&&ts(e)>ts(t)?e:t}function is(e){return{error:!1,isMatch:e,result:void 0}}function ns(e){return{error:!0,isMatch:!1,result:e}}Nt.default=class{constructor(e,t){this._queries=t,this._bucketer=new Un.default(e.crypto)}async evaluate(e,t,r){return new Promise(i=>{this.evaluateCb(e,t,i,r)})}evaluateCb(e,t,r,i){const n={};this._evaluateInternal(e,t,n,[],e=>{n.bigSegmentsStatus&&(e.detail.reason=Object.assign(Object.assign({},e.detail.reason),{bigSegmentsStatus:n.bigSegmentsStatus})),n.prerequisites&&(e.prerequisites=n.prerequisites),e.events=n.events,r(e)},!0,i)}_evaluateInternal(e,t,r,i,n,s,a){e.on?this._checkPrerequisites(e,t,r,i,i=>{if(i)return void n(i);const s=(0,Wn.default)(e,t);s?n(s):this._evaluateRules(e,t,r,r=>{n(r||this._variationForContext(e.fallthrough,t,e,Yn.default.Fallthrough))})},s,a):n((0,Zn.getOffVariation)(e,Yn.default.Off))}_checkPrerequisites(e,t,r,i,n,s,a){let o;e.prerequisites&&e.prerequisites.length?(0,Kn.allSeriesAsync)(e.prerequisites,(n,l,c)=>{if(-1!==i.indexOf(n.key))return o=qn.default.forError(Qn.MalformedFlag,`Prerequisite of ${e.key} causing a circular reference. This is probably a temporary condition due to an incomplete update.`),void c(!0);const u=[...i,n.key];this._queries.getFlag(n.key,i=>{if(!i)return o=(0,Zn.getOffVariation)(e,Yn.default.prerequisiteFailed(n.key)),void c(!1);this._evaluateInternal(i,t,r,u,l=>{var u,d;return null!==(u=r.events)&&void 0!==u||(r.events=[]),s&&(null!==(d=r.prerequisites)&&void 0!==d||(r.prerequisites=[]),r.prerequisites.push(i.key)),a&&r.events.push(a.evalEventServer(i,t,l.detail,null,e)),l.isError?(o=l,c(!1)):l.isOff||l.detail.variationIndex!==n.variation?(o=(0,Zn.getOffVariation)(e,Yn.default.prerequisiteFailed(n.key)),c(!1)):c(!0)},!1,a)})},()=>{n(o)}):n(void 0)}_evaluateRules(e,t,r,i){let n;(0,Kn.firstSeriesAsync)(e.rules,(i,s,a)=>{this._ruleMatchContext(e,i,s,t,r,[],e=>{n=e,a(!!e)})},()=>i(n))}_clauseMatchContext(e,t,r,i,n){let s;"segmentMatch"!==e.op?e.attributeReference.isValid?n(is((0,Xn.default)(e,t))):n(ns(qn.default.forError(Qn.MalformedFlag,"Invalid attribute reference in clause"))):(0,Kn.firstSeriesAsync)(e.values,(e,n,a)=>{this._queries.getSegment(e,e=>{if(e){if(r.includes(e.key))return s=qn.default.forError(Qn.MalformedFlag,`Segment rule referencing segment ${e.key} caused a circular reference. This is probably a temporary condition due to an incomplete update`),void a(!0);const n=[...r,null==e?void 0:e.key];this.segmentMatchContext(e,t,i,n,e=>{e.error&&(s=e.result),a(e.error||e.isMatch)})}else a(!1)})},t=>n(s?ns(s):is((0,Xn.maybeNegate)(e,t))))}_ruleMatchContext(e,t,r,i,n,s,a){if(!t.clauses)return void a(void 0);let o;(0,Kn.allSeriesAsync)(t.clauses,(e,t,r)=>{this._clauseMatchContext(e,i,s,n,e=>(o=e.result,r(e.error||e.isMatch)))},n=>a(o||(n?this._variationForContext(t,i,e,Yn.default.ruleMatch(t.id,r)):void 0)))}_variationForContext(e,t,r,i){if(void 0===e)return qn.default.forError(Qn.MalformedFlag,"Fallthrough variation undefined");if(void 0!==e.variation)return(0,Zn.getVariation)(r,e.variation,i);if(e.rollout){const{rollout:n}=e,{variations:s}=n,a="experiment"===n.kind;if(s&&s.length){const e=(0,Zn.getBucketBy)(a,n.bucketByAttributeReference);if(!e.isValid)return qn.default.forError(Qn.MalformedFlag,"Invalid attribute reference for bucketBy in rollout");const[o,l]=this._bucketer.bucket(t,r.key,e,r.salt||"",n.contextKind,n.seed),c=Object.assign({},i);let u=0;for(let e=0;e<s.length;e+=1){const t=s[e];if(u+=t.weight/1e5,o<u)return a&&l&&!t.untracked&&(c.inExperiment=!0),(0,Zn.getVariation)(r,t.variation,c)}const d=s[s.length-1];return a&&!d.untracked&&(c.inExperiment=!0),(0,Zn.getVariation)(r,d.variation,c)}}return qn.default.forError(Qn.MalformedFlag,"Variation/rollout object with no variation or rollout")}segmentRuleMatchContext(e,t,r,i,n,s){let a;(0,Kn.allSeriesAsync)(t.clauses,(e,t,s)=>{this._clauseMatchContext(e,r,n,i,e=>{a=e.result,s(e.error||e.isMatch)})},i=>{if(a)return s(ns(a));if(i){if(void 0===t.weight)return s(is(i));const n=(0,Zn.getBucketBy)(!1,t.bucketByAttributeReference);if(!n.isValid)return s(ns(qn.default.forError(Qn.MalformedFlag,"Invalid attribute reference in clause")));const[a]=this._bucketer.bucket(r,e.key,n,e.salt||"",t.rolloutContextKind);return s(is(a<t.weight/1e5))}return s(is(!1))})}simpleSegmentMatchContext(e,t,r,i,n){if(!e.unbounded){const r=(0,Jn.default)(e,t);if(void 0!==r)return void n(is(r))}let s;(0,Kn.firstSeriesAsync)(e.rules,(n,a,o)=>{this.segmentRuleMatchContext(e,n,t,r,i,e=>(s=e.result,o(e.error||e.isMatch)))},e=>n(s?ns(s):is(e)))}segmentMatchContext(e,t,r,i,n){if(!e.unbounded)return void this.simpleSegmentMatchContext(e,t,r,i,n);const s=e.unboundedContextKind||"user",a=t.key(s);if(a)return e.generation?void(r.bigSegmentsMembership&&r.bigSegmentsMembership[a]?this.bigSegmentMatchContext(r.bigSegmentsMembership[a],e,t,r).then(n):this._queries.getBigSegmentsMembership(a).then(i=>{if(r.bigSegmentsMembership=r.bigSegmentsMembership||{},i){const[e,t]=i;r.bigSegmentsMembership[a]=e,r.bigSegmentsStatus=rs(r.bigSegmentsStatus,t)}else r.bigSegmentsStatus=rs(r.bigSegmentsStatus,"NOT_CONFIGURED");this.bigSegmentMatchContext(r.bigSegmentsMembership[a],e,t,r).then(n)})):(r.bigSegmentsStatus=rs(r.bigSegmentsStatus,"NOT_CONFIGURED"),void n(is(!1)));n(is(!1))}bigSegmentMatchContext(e,t,r,i){const n=(0,Gn.default)(t),s=null==e?void 0:e[n];return new Promise(e=>{null==s?this.simpleSegmentMatchContext(t,r,i,[],e):e(is(s))})}};var ss={};Object.defineProperty(ss,"__esModule",{value:!0});const as=ee;ss.default=class{constructor(e){this._contextKeysCache=new as.default({max:e.contextKeysCapacity}),this.flushInterval=e.contextKeysFlushInterval}processContext(e){const{canonicalKey:t}=e,r=this._contextKeysCache.get(t);return this._contextKeysCache.set(t,!0),!r}flush(){this._contextKeysCache.clear()}};var os={},ls={};Object.defineProperty(ls,"__esModule",{value:!0}),ls.default=function(e,t){if(t){if(t.inExperiment)return!0;switch(t.kind){case"RULE_MATCH":{const r=t.ruleIndex;if(void 0!==r){const t=e.rules||[];return r>=0&&r<t.length&&!!t[r].trackEvents}break}case"FALLTHROUGH":return!!e.trackEventsFallthrough}}return!1},Object.defineProperty(os,"__esModule",{value:!0});const cs=o,us=ls;class ds extends cs.internal.EventFactoryBase{evalEventServer(e,t,r,i,n){var s;const a=(0,us.default)(e,r.reason);return super.evalEvent({addExperimentData:a,context:t,debugEventsUntilDate:e.debugEventsUntilDate,defaultVal:i,excludeFromSummaries:e.excludeFromSummaries,flagKey:e.key,prereqOfFlagKey:null==n?void 0:n.key,reason:r.reason,samplingRatio:e.samplingRatio,trackEvents:e.trackEvents||a,value:r.value,variation:null!==(s=r.variationIndex)&&void 0!==s?s:void 0,version:e.version})}}os.default=ds;var hs={};Object.defineProperty(hs,"__esModule",{value:!0});hs.default=class{constructor(e,t){this._valid=e,this._withReasons=t,this._flagValues={},this._flagMetadata={}}addFlag(e,t,r,i,n,s,a,o){this._flagValues[e.key]=t;const l={};void 0!==r&&(l.variation=r);const c=a&&!n&&!s&&void 0===e.debugEventsUntilDate;c||(l.version=e.version),i&&(s||this._withReasons&&!c)&&(l.reason=i),n&&(l.trackEvents=!0),s&&(l.trackReason=!0),void 0!==e.debugEventsUntilDate&&(l.debugEventsUntilDate=e.debugEventsUntilDate),o&&o.length&&(l.prerequisites=o),this._flagMetadata[e.key]=l}build(){return{valid:this._valid,allValues:()=>this._flagValues,getFlagValue:e=>this._flagValues[e],getFlagReason:e=>{var t;return null!==(t=this._flagMetadata[e]?this._flagMetadata[e].reason:null)&&void 0!==t?t:null},toJSON:()=>Object.assign(Object.assign({},this._flagValues),{$flagsState:this._flagMetadata,$valid:this._valid})}}};var fs={};Object.defineProperty(fs,"__esModule",{value:!0});const ps="unknown hook";fs.default=class{constructor(e,t){this._logger=e,this._hooks=[],this._hooks.push(...t)}async withEvaluationSeries(e,t,r,i,n,s){return 0===this._hooks.length?n():this.withEvaluationSeriesExtraDetail(e,t,r,i,async()=>({detail:await n()}),s).then(({detail:e})=>e)}async withEvaluationSeriesExtraDetail(e,t,r,i,n,s){if(0===this._hooks.length)return n();const{hooks:a,hookContext:o}=this._prepareHooks(e,t,r,i,s),l=this._executeBeforeEvaluation(a,o),c=await n();return this._executeAfterEvaluation(a,o,l,c.detail),c}_tryExecuteStage(e,t,r){var i;try{return r()}catch(r){return null===(i=this._logger)||void 0===i||i.error(`An error was encountered in "${e}" of the "${t}" hook: ${r}`),{}}}_hookName(e){var t,r;try{return null!==(t=null==e?void 0:e.getMetadata().name)&&void 0!==t?t:ps}catch(e){return null===(r=this._logger)||void 0===r||r.error("Exception thrown getting metadata for hook. Unable to get hook name."),ps}}_executeAfterEvaluation(e,t,r,i){var n;for(let s=e.length-1;s>=0;s-=1){const a=e[s],o=null!==(n=r[s])&&void 0!==n?n:{};this._tryExecuteStage("afterEvaluation",this._hookName(a),()=>{var e,r;return null!==(r=null===(e=null==a?void 0:a.afterEvaluation)||void 0===e?void 0:e.call(a,t,o,i))&&void 0!==r?r:{}})}}_executeBeforeEvaluation(e,t){return e.map(e=>this._tryExecuteStage("beforeEvaluation",this._hookName(e),()=>{var r,i;return null!==(i=null===(r=null==e?void 0:e.beforeEvaluation)||void 0===r?void 0:r.call(e,t,{}))&&void 0!==i?i:{}}))}_prepareHooks(e,t,r,i,n){return{hooks:[...this._hooks],hookContext:{flagKey:e,context:t,defaultValue:r,method:i,environmentId:n}}}addHook(e){this._hooks.push(e)}};var vs={};Object.defineProperty(vs,"__esModule",{value:!0});const gs=o;function _s(e){const t=e.old,r=e.new;return!(void 0!==t&&!gs.TypeValidators.Boolean.is(t))&&!(void 0!==r&&!gs.TypeValidators.Boolean.is(r))}function ys(e){if(gs.TypeValidators.String.is(e.key)&&""!==e.key){if("latency_ms"===e.key){if(!gs.TypeValidators.Object.is(e.values))return;if(!function(e){const t=e.old,r=e.new;return!(void 0!==t&&!gs.TypeValidators.Number.is(t)||void 0!==r&&!gs.TypeValidators.Number.is(r))}(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}if(function(e){return"error"===e.key}(e)){if(!gs.TypeValidators.Object.is(e.values))return;if(!_s(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}if(function(e){return"consistent"===e.key}(e)){if(!gs.TypeValidators.Boolean.is(e.value)||!gs.TypeValidators.Number.is(e.samplingRatio))return;return{key:e.key,value:e.value,samplingRatio:e.samplingRatio}}if(function(e){return"invoked"===e.key}(e)){if(!gs.TypeValidators.Object.is(e.values))return;if(!_s(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}}}vs.default=function(e){var t,r;if("migration_op"!==e.kind)return;if(r=e.operation,!gs.TypeValidators.String.is(r)||"read"!==r&&"write"!==r)return;if(!gs.TypeValidators.Number.is(e.creationDate))return;const i={};if(gs.TypeValidators.Object.is(e.context)){const t=gs.Context.fromLDContext(e.context);t.valid&&(i.context=t)}else gs.TypeValidators.Object.is(e.contextKeys)&&Object.keys(e.contextKeys).every(e=>gs.TypeValidators.Kind.is(e))&&Object.values(e.contextKeys).every(e=>gs.TypeValidators.String.is(e)&&""!==e)&&(i.contextKeys=Object.assign({},e.contextKeys));if(!i.context&&!i.contextKeys)return;const n=null!==(t=e.samplingRatio)&&void 0!==t?t:1;if(!gs.TypeValidators.Number.is(n))return;const s=function(e){if(!gs.TypeValidators.String.is(e.key)||""===e.key)return;if(!gs.TypeValidators.Object.is(e.reason))return;if(!gs.TypeValidators.String.is(e.reason.kind)||""===e.reason.kind)return;const t={key:e.key,value:e.value,default:e.default,reason:{kind:e.reason.kind}},r=e.reason,i=t.reason;return gs.TypeValidators.String.is(r.errorKind)&&(i.errorKind=r.errorKind),gs.TypeValidators.String.is(r.ruleId)&&(i.ruleId=r.ruleId),gs.TypeValidators.String.is(r.prerequisiteKey)&&(i.prerequisiteKey=r.prerequisiteKey),gs.TypeValidators.Boolean.is(r.inExperiment)&&(i.inExperiment=r.inExperiment),gs.TypeValidators.Number.is(r.ruleIndex)&&(i.ruleIndex=r.ruleIndex),gs.TypeValidators.String.is(r.bigSegmentsStatus)&&(i.bigSegmentsStatus=r.bigSegmentsStatus),void 0!==e.variation&&gs.TypeValidators.Number.is(e.variation)&&(t.variation=e.variation),void 0!==e.version&&gs.TypeValidators.Number.is(e.version)&&(t.version=e.version),t}(e.evaluation);var a;return s?Object.assign(Object.assign({kind:e.kind,operation:e.operation,creationDate:e.creationDate},i),{measurements:(a=e.measurements,a.map(ys).filter(e=>void 0!==e)),evaluation:s,samplingRatio:n}):void 0};var ms={};Object.defineProperty(ms,"__esModule",{value:!0});const bs=o,Ss=c;function Es(e){return!Number.isNaN(e)}ms.default=class{constructor(e,t,r,i,n,s,a,o,l,c){this._flagKey=e,this._context=t,this._defaultStage=r,this._stage=i,this._reason=n,this._checkRatio=s,this._variation=a,this._version=o,this._samplingRatio=l,this._logger=c,this._errors={old:!1,new:!1},this._wasInvoked={old:!1,new:!1},this._consistencyCheck=Ss.LDConsistencyCheck.NotChecked,this._latencyMeasurement={old:NaN,new:NaN}}op(e){this._operation=e}error(e){this._errors[e]=!0}consistency(e){var t,r;if(bs.internal.shouldSample(null!==(t=this._checkRatio)&&void 0!==t?t:1))try{const t=e();this._consistencyCheck=t?Ss.LDConsistencyCheck.Consistent:Ss.LDConsistencyCheck.Inconsistent}catch(e){null===(r=this._logger)||void 0===r||r.error(`Exception when executing consistency check function for migration '${this._flagKey}' the consistency check will not be included in the generated migration op event. Exception: ${e}`)}}latency(e,t){this._latencyMeasurement[e]=t}invoked(e){this._wasInvoked[e]=!0}createEvent(){var e,t,r,i,n;if(!bs.TypeValidators.String.is(this._flagKey)||""===this._flagKey)return void(null===(e=this._logger)||void 0===e||e.error("The flag key for a migration operation must be a non-empty string."));if(!this._operation)return void(null===(t=this._logger)||void 0===t||t.error('The operation must be set using "op" before an event can be created.'));if(!bs.Context.fromLDContext(this._context).valid)return void(null===(r=this._logger)||void 0===r||r.error("The migration was not done against a valid context and cannot generate an event."));if(!this._wasInvoked.old&&!this._wasInvoked.new)return void(null===(i=this._logger)||void 0===i||i.error('The migration invoked neither the "old" or "new" implementation andan event cannot be generated'));if(!this._measurementConsistencyCheck())return;const s=[];return this._populateInvoked(s),this._populateConsistency(s),this._populateLatency(s),this._populateErrors(s),{kind:"migration_op",operation:this._operation,creationDate:Date.now(),context:this._context,evaluation:{key:this._flagKey,value:this._stage,default:this._defaultStage,reason:this._reason,variation:this._variation,version:this._version},measurements:s,samplingRatio:null!==(n=this._samplingRatio)&&void 0!==n?n:1}}_logTag(){return`For migration ${this._operation}-${this._flagKey}:`}_latencyConsistencyMessage(e){return`Latency measurement for "${e}", but "${e}" was not invoked.`}_errorConsistencyMessage(e){return`Error occurred for "${e}", but "${e}" was not invoked.`}_consistencyCheckConsistencyMessage(e){return`Consistency check was done, but "${e}" was not invoked.Both "old" and "new" must be invoked to do a consistency check.`}_checkOriginEventConsistency(e){var t,r,i;return!!this._wasInvoked[e]||(Number.isNaN(this._latencyMeasurement[e])?this._errors[e]?(null===(r=this._logger)||void 0===r||r.error(`${this._logTag()} ${this._errorConsistencyMessage(e)}`),!1):this._consistencyCheck===Ss.LDConsistencyCheck.NotChecked||(null===(i=this._logger)||void 0===i||i.error(`${this._logTag()} ${this._consistencyCheckConsistencyMessage(e)}`),!1):(null===(t=this._logger)||void 0===t||t.error(`${this._logTag()} ${this._latencyConsistencyMessage(e)}`),!1))}_measurementConsistencyCheck(){return this._checkOriginEventConsistency("old")&&this._checkOriginEventConsistency("new")}_populateInvoked(e){var t;const r={key:"invoked",values:{}};this._wasInvoked.old||this._wasInvoked.new||null===(t=this._logger)||void 0===t||t.error("Migration op completed without executing any origins (old/new)."),this._wasInvoked.old&&(r.values.old=!0),this._wasInvoked.new&&(r.values.new=!0),e.push(r)}_populateConsistency(e){var t;void 0!==this._consistencyCheck&&this._consistencyCheck!==Ss.LDConsistencyCheck.NotChecked&&e.push({key:"consistent",value:this._consistencyCheck===Ss.LDConsistencyCheck.Consistent,samplingRatio:null!==(t=this._checkRatio)&&void 0!==t?t:1})}_populateErrors(e){if(this._errors.new||this._errors.old){const t={key:"error",values:{}};this._errors.new&&(t.values.new=!0),this._errors.old&&(t.values.old=!0),e.push(t)}}_populateLatency(e){const t=Es(this._latencyMeasurement.new),r=Es(this._latencyMeasurement.old);if(t||r){const i={};t&&(i.new=this._latencyMeasurement.new),r&&(i.old=this._latencyMeasurement.old),e.push({key:"latency_ms",values:i})}}},Object.defineProperty(a,"__esModule",{value:!0});const ws=o,ks=l,Os=P,xs=Q,Ds=ne,Ps=se,Rs=ae,Is=be,Ms=Pe,Ts=Me,As=dt,Cs=pt,Fs=gt,js=yt,Ls=St,Ns=xt,$s=Mt,Bs=At,Vs=Nt,zs=ss,Hs=os,Us=ls,Ks=hs,qs=fs,Ws=vs,Gs=ms,Xs=Dt,Js=le,{ClientMessages:Ys,ErrorKinds:Zs,NullEventProcessor:Qs}=ws.internal;var ea;!function(e){e[e.Initializing=0]="Initializing",e[e.Initialized=1]="Initialized",e[e.Failed=2]="Failed"}(ea||(ea={}));function ta(e,t,r,i,n,s,a){var o,l,c,u,d;const{onUpdate:h,hasEventListeners:f}=i,p=new qs.default(r.logger,a);if(!e&&!r.offline)throw new Error("You must configure the client with an SDK key");const{logger:v}=r,g=(0,ws.defaultHeaders)(e,t.info,r.tags),_=new ws.ClientContext(e,r,t),y=r.featureStoreFactory(_),m=new Is.default(y,f,h);let b,S;!r.sendEvents||r.offline||r.diagnosticOptOut||(b=new ws.internal.DiagnosticsManager(e,t,(0,Ns.default)(r,t,y))),S=!r.sendEvents||r.offline?new Qs:new ws.internal.EventProcessor(r,_,g,new zs.default(r),b);const E=new xs.default(null===(l=null===(o=r.bigSegments)||void 0===o?void 0:o.store)||void 0===l?void 0:l.call(o,_),null!==(c=r.bigSegments)&&void 0!==c?c:{},r.logger,t.crypto),w={getFlag(e,t){y.get(Js.default.Features,e,e=>t(e))},getSegment(e,t){y.get(Js.default.Segments,e,e=>t(e))},getBigSegmentsMembership:e=>E.getUserMembership(e)},k=new Vs.default(t,w),O=(0,Rs.createStreamListeners)(m,v,{put:n});let x;return r.offline||r.useLdd||(x=null!==(d=null===(u=r.updateProcessorFactory)||void 0===u?void 0:u.call(r,_,m,n,s))&&void 0!==d?d:r.stream?new Fs.default(_,"/all",[],O,g,b,s,r.streamInitialReconnectDelay):new Ts.default(new Cs.default(r,t.requests,g),r.pollInterval,m,r.logger,n,s)),{config:r,logger:v,evaluator:k,featureStore:y,updateProcessor:x,eventProcessor:S,bigSegmentsManager:E,hookRunner:p,onError:i.onError,onFailed:i.onFailed,onReady:i.onReady}}a.default=class{get logger(){return this._logger}constructor(e,t,r,i,n){this._sdkKey=e,this._platform=t,this._initState=ea.Initializing,this._eventFactoryDefault=new Hs.default(!1),this._eventFactoryWithReasons=new Hs.default(!0);const s=new Xs.default(r,n);this.environmentMetadata=(0,Ds.createPluginEnvironmentMetadata)(t,e,s);const a=[];if(s.hooks&&a.push(...s.hooks),s.getImplementationHooks(this.environmentMetadata).forEach(e=>{a.push(e)}),s.dataSystem){let r,n;({config:this._config,logger:this._logger,evaluator:this._evaluator,featureStore:r,dataSource:this._dataSource,payloadListener:n,eventProcessor:this._eventProcessor,bigSegmentsManager:this._bigSegmentsManager,hookRunner:this._hookRunner,onError:this._onError,onFailed:this._onFailed,onReady:this._onReady}=function(e,t,r,i,n,s){var a,o,l,c;const{onUpdate:u,hasEventListeners:d}=i,h=new qs.default(r.logger,s);if(!e&&!r.offline)throw new Error("You must configure the client with an SDK key");const{logger:f}=r,p=(0,ws.defaultHeaders)(e,t.info,r.tags),v=new ws.ClientContext(e,r,t),g=r.dataSystem,_=g.featureStoreFactory(v),y=new Ls.default(_,d,u);let m,b;!r.sendEvents||r.offline||r.diagnosticOptOut||(m=new ws.internal.DiagnosticsManager(e,t,(0,Ns.default)(r,t,_))),b=!r.sendEvents||r.offline?new Qs:new ws.internal.EventProcessor(r,v,p,new zs.default(r),m);const S=new xs.default(null===(o=null===(a=r.bigSegments)||void 0===a?void 0:a.store)||void 0===o?void 0:o.call(a,v),null!==(l=r.bigSegments)&&void 0!==l?l:{},r.logger,t.crypto),E={getFlag(e,t){_.get(Js.default.Features,e,e=>t(e))},getSegment(e,t){_.get(Js.default.Segments,e,e=>t(e))},getBigSegmentsMembership:e=>S.getUserMembership(e)},w=new Vs.default(t,E);let k,O;if(!r.offline&&!r.dataSystem.useLdd){const e=[];(0,Os.isStandardOptions)(g.dataSource)&&e.push(()=>new Ms.default(new Cs.default(r,t.requests,p,"/sdk/poll",r.logger),r.logger));const i=[];if((0,Os.isStandardOptions)(g.dataSource)||(0,Os.isStreamingOnlyOptions)(g.dataSource)){const e=g.dataSource.streamInitialReconnectDelay;i.push(()=>new js.default(v,"/sdk/stream",[],p,m,e))}let s=Xs.DEFAULT_POLL_INTERVAL;((0,Os.isStandardOptions)(g.dataSource)||(0,Os.isPollingOnlyOptions)(g.dataSource))&&(s=null!==(c=g.dataSource.pollInterval)&&void 0!==c?c:Xs.DEFAULT_POLL_INTERVAL,i.push(()=>new As.default(new Cs.default(r,t.requests,p,"/sdk/poll",f),s,f)));const a=[()=>new As.default(new Cs.default(r,t.requests,p,"/sdk/latest-all",r.logger),s,r.logger,!0)];k=new ws.CompositeDataSource(e,i,a,f),O=(0,Ps.createPayloadListener)(y,f,n)}return{config:r,logger:f,evaluator:w,featureStore:_,dataSource:k,payloadListener:O,eventProcessor:b,bigSegmentsManager:S,hookRunner:h,onError:i.onError,onFailed:i.onFailed,onReady:i.onReady}}(e,t,s,i,()=>this._initSuccess(),a)),this._featureStore=r,this.bigSegmentStatusProviderInternal=this._bigSegmentsManager.statusProvider,this._dataSource&&this._dataSource.start((e,t)=>{null==n||n(t)},(e,t)=>{e===ws.subsystem.DataSourceState.Closed&&t&&this._dataSourceErrorHandler(t)},()=>{var e;return null===(e=r.getSelector)||void 0===e?void 0:e.call(r)})}else({config:this._config,logger:this._logger,evaluator:this._evaluator,featureStore:this._featureStore,updateProcessor:this._updateProcessor,eventProcessor:this._eventProcessor,bigSegmentsManager:this._bigSegmentsManager,hookRunner:this._hookRunner,onError:this._onError,onFailed:this._onFailed,onReady:this._onReady}=ta(e,t,s,i,()=>this._initSuccess(),e=>this._dataSourceErrorHandler(e),a)),this.bigSegmentStatusProviderInternal=this._bigSegmentsManager.statusProvider,this._updateProcessor&&this._updateProcessor.start()}initialized(){return this._initState===ea.Initialized}waitForInitialization(e){var t,r;return void 0!==(null==e?void 0:e.timeout)||void 0===this._updateProcessor&&void 0===this._dataSource||null===(t=this._logger)||void 0===t||t.warn("The waitForInitialization function was called without a timeout specified. In a future version a default timeout will be applied."),void 0!==(null==e?void 0:e.timeout)&&(null==e?void 0:e.timeout)>60&&(void 0!==this._updateProcessor||void 0!==this._dataSource)&&(null===(r=this._logger)||void 0===r||r.warn("The waitForInitialization function was called with a timeout greater than 60 seconds. We recommend a timeout of less than 60 seconds.")),this._initializedPromise?this._clientWithTimeout(this._initializedPromise,null==e?void 0:e.timeout,this._logger):this._initState===ea.Initialized?(this._initializedPromise=Promise.resolve(this),this._initializedPromise):this._initState===ea.Failed?(this._initializedPromise=Promise.reject(this._rejectionReason),this._initializedPromise):(this._initializedPromise||(this._initializedPromise=new Promise((e,t)=>{this._initResolve=e,this._initReject=t})),this._clientWithTimeout(this._initializedPromise,null==e?void 0:e.timeout,this._logger))}variation(e,t,r,i){var n,s,a;return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.variation",()=>new Promise(i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryDefault,e=>{i(e.detail)})}),null===(a=null===(s=(n=this._featureStore).getInitMetaData)||void 0===s?void 0:s.call(n))||void 0===a?void 0:a.environmentId).then(e=>(null==i||i(null,e.value),e.value))}variationDetail(e,t,r,i){var n,s,a;return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.variationDetail",()=>new Promise(n=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,e=>{n(e.detail),null==i||i(null,e.detail)})}),null===(a=null===(s=(n=this._featureStore).getInitMetaData)||void 0===s?void 0:s.call(n))||void 0===a?void 0:a.environmentId)}_typedEval(e,t,r,i,n,s){var a,o,l;return this._hookRunner.withEvaluationSeries(e,t,r,n,()=>new Promise(n=>{this._evaluateIfPossible(e,t,r,i,e=>{const t={value:e.detail.value,reason:e.detail.reason,variationIndex:e.detail.variationIndex};n(t)},s)}),null===(l=null===(o=(a=this._featureStore).getInitMetaData)||void 0===o?void 0:o.call(a))||void 0===l?void 0:l.environmentId)}async boolVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.boolVariation",e=>[ws.TypeValidators.Boolean.is(e),ws.TypeValidators.Boolean.getType()])).value}async numberVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.numberVariation",e=>[ws.TypeValidators.Number.is(e),ws.TypeValidators.Number.getType()])).value}async stringVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.stringVariation",e=>[ws.TypeValidators.String.is(e),ws.TypeValidators.String.getType()])).value}jsonVariation(e,t,r){var i,n,s;return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.jsonVariation",()=>new Promise(i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryDefault,e=>{i(e.detail)})}),null===(s=null===(n=(i=this._featureStore).getInitMetaData)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.environmentId).then(e=>e.value)}boolVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.boolVariationDetail",e=>[ws.TypeValidators.Boolean.is(e),ws.TypeValidators.Boolean.getType()])}numberVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.numberVariationDetail",e=>[ws.TypeValidators.Number.is(e),ws.TypeValidators.Number.getType()])}stringVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.stringVariationDetail",e=>[ws.TypeValidators.String.is(e),ws.TypeValidators.String.getType()])}jsonVariationDetail(e,t,r){var i,n,s;return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.jsonVariationDetail",()=>new Promise(i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,e=>{i(e.detail)})}),null===(s=null===(n=(i=this._featureStore).getInitMetaData)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.environmentId)}async _migrationVariationInternal(e,t,r){var i;const n=await new Promise(i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,({detail:t},n)=>{if(!(0,ks.IsMigrationStage)(t.value)){const t=new Error(`Unrecognized MigrationState for "${e}"; returning default value.`);this._onError(t);const s={kind:"ERROR",errorKind:Zs.WrongType};return void i({detail:{value:r,reason:s},flag:n})}i({detail:t,flag:n})})}),{detail:s,flag:a}=n,o=null===(i=null==a?void 0:a.migration)||void 0===i?void 0:i.checkRatio,l=null==a?void 0:a.samplingRatio;return{detail:s,migration:{value:s.value,tracker:new Gs.default(e,t,r,s.value,s.reason,o,null===s.variationIndex?void 0:s.variationIndex,null==a?void 0:a.version,l,this._logger)}}}async migrationVariation(e,t,r){var i,n,s;return(await this._hookRunner.withEvaluationSeriesExtraDetail(e,t,r,"LDClient.migrationVariation",()=>this._migrationVariationInternal(e,t,r),null===(s=null===(n=(i=this._featureStore).getInitMetaData)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.environmentId)).migration}allFlagsState(e,t,r){var i,n,s;if(this._config.offline){null===(i=this._logger)||void 0===i||i.info("allFlagsState() called in offline mode. Returning empty state.");const e=new Ks.default(!1,!1).build();return null==r||r(null,e),Promise.resolve(e)}const a=ws.Context.fromLDContext(e);return a.valid?new Promise(e=>{const i=i=>this._featureStore.all(Js.default.Features,n=>{const s=new Ks.default(i,!!(null==t?void 0:t.withReasons)),o=!!(null==t?void 0:t.clientSideOnly),l=!!(null==t?void 0:t.detailsOnlyForTrackedFlags);(0,$s.allAsync)(Object.values(n),(e,t)=>{var r;const i=e;!o||(null===(r=i.clientSideAvailability)||void 0===r?void 0:r.usingEnvironmentId)?this._evaluator.evaluateCb(i,a,e=>{var r;e.isError&&this._onError(new Error(`Error for feature flag "${i.key}" while evaluating all flags: ${e.message}`));const n=(0,Us.default)(i,e.detail.reason);s.addFlag(i,e.detail.value,null!==(r=e.detail.variationIndex)&&void 0!==r?r:void 0,e.detail.reason,i.trackEvents||n,n,l,e.prerequisites),t(!0)}):t(!0)},()=>{const t=s.build();null==r||r(null,t),e(t)})});this.initialized()?i(!0):this._featureStore.initialized(e=>{var t,r;let n=!0;e?null===(t=this._logger)||void 0===t||t.warn("Called allFlagsState before client initialization; using last known values from data store"):(null===(r=this._logger)||void 0===r||r.warn("Called allFlagsState before client initialization. Data store not available; returning empty state"),n=!1),i(n)})}):(null===(n=this._logger)||void 0===n||n.info(`${null!==(s=a.message)&&void 0!==s?s:"Invalid context."}. Returning empty state.`),Promise.resolve(new Ks.default(!1,!1).build()))}secureModeHash(e){const t=ws.Context.fromLDContext(e),r=t.valid?t.canonicalKey:void 0;if(!this._platform.crypto.createHmac)throw new Error("Platform must implement createHmac");const i=this._platform.crypto.createHmac("sha256",this._sdkKey);if(void 0===r)throw new ws.LDClientError("Could not generate secure mode hash for invalid context");return i.update(r),i.digest("hex")}close(){var e,t;this._eventProcessor.close(),null===(e=this._updateProcessor)||void 0===e||e.close(),null===(t=this._dataSource)||void 0===t||t.stop(),this._featureStore.close(),this._bigSegmentsManager.close()}isOffline(){return this._config.offline}track(e,t,r,i){var n,s;const a=ws.Context.fromLDContext(t);a.valid?(void 0===i||ws.TypeValidators.Number.is(i)||null===(s=this._logger)||void 0===s||s.warn(Ys.invalidMetricValue(typeof i)),this._eventProcessor.sendEvent(this._eventFactoryDefault.customEvent(e,a,r,i))):null===(n=this._logger)||void 0===n||n.warn(Ys.MissingContextKeyNoEvent)}trackMigration(e){const t=(0,Ws.default)(e);t&&this._eventProcessor.sendEvent(t)}identify(e){var t;const r=ws.Context.fromLDContext(e);r.valid?this._eventProcessor.sendEvent(this._eventFactoryDefault.identifyEvent(r)):null===(t=this._logger)||void 0===t||t.warn(Ys.MissingContextKeyNoEvent)}async flush(e){try{await this._eventProcessor.flush()}catch(t){return null==e?void 0:e(t,!1)}return null==e?void 0:e(null,!0)}addHook(e){this._hookRunner.addHook(e)}_variationInternal(e,t,r,i,n,s){var a,o;if(this._config.offline)return null===(a=this._logger)||void 0===a||a.info("Variation called in offline mode. Returning default value."),void n(Bs.default.forError(Zs.ClientNotReady,void 0,r));const l=ws.Context.fromLDContext(t);if(!l.valid)return this._onError(new ws.LDClientError(`${null!==(o=l.message)&&void 0!==o?o:"Context not valid;"} returning default value.`)),void n(Bs.default.forError(Zs.UserNotSpecified,void 0,r));this._featureStore.get(Js.default.Features,e,t=>{const a=t;if(!a){const t=new ws.LDClientError(`Unknown feature flag "${e}"; returning default value`);this._onError(t);const i=Bs.default.forError(Zs.FlagNotFound,void 0,r);return this._eventProcessor.sendEvent(this._eventFactoryDefault.unknownFlagEvent(e,r,l)),void n(i)}this._evaluator.evaluateCb(a,l,t=>{var o;if(void 0!==t.detail.variationIndex&&null!==t.detail.variationIndex||(null===(o=this._logger)||void 0===o||o.debug("Result value is null in variation"),t.setDefault(r)),s){const[o,c]=s(t.detail.value);if(!o){const t=Bs.default.forError(Zs.WrongType,`Did not receive expected type (${c}) evaluating feature flag "${e}"`,r);return this._sendEvalEvent(t,i,a,l,r),void n(t,a)}}this._sendEvalEvent(t,i,a,l,r),n(t,a)},i)})}_sendEvalEvent(e,t,r,i,n){var s;null===(s=e.events)||void 0===s||s.forEach(e=>{this._eventProcessor.sendEvent(Object.assign({},e))}),this._eventProcessor.sendEvent(t.evalEventServer(r,i,e.detail,n,void 0))}_evaluateIfPossible(e,t,r,i,n,s){this.initialized()?this._variationInternal(e,t,r,i,n,s):this._featureStore.initialized(a=>{var o,l;if(a)return null===(o=this._logger)||void 0===o||o.warn("Variation called before LaunchDarkly client initialization completed (did you wait for the 'ready' event?) - using last known values from feature store"),void this._variationInternal(e,t,r,i,n,s);null===(l=this._logger)||void 0===l||l.warn("Variation called before LaunchDarkly client initialization completed (did you wait for the'ready' event?) - using default value"),n(Bs.default.forError(Zs.ClientNotReady,void 0,r))})}_dataSourceErrorHandler(e){var t;const r=401===e.code?new Error("Authentication failed. Double check your SDK key."):e;this._onError(r),this._onFailed(r),this.initialized()||(this._initState=ea.Failed,this._rejectionReason=r,null===(t=this._initReject)||void 0===t||t.call(this,r))}_initSuccess(){var e;this.initialized()||(this._initState=ea.Initialized,null===(e=this._initResolve)||void 0===e||e.call(this,this),this._onReady())}_clientWithTimeout(e,t,r){if(t){const i=(0,ws.cancelableTimedPromise)(t,"waitForInitialization");return Promise.race([e.then(()=>this),i.promise.then(()=>this)]).catch(e=>{throw e instanceof ws.LDTimeoutError&&(null==r||r.error(e.message)),e}).finally(()=>i.cancel())}return e}};var ra={};Object.defineProperty(ra,"__esModule",{value:!0}),ra.createMigration=ra.LDMigrationError=ra.LDMigrationSuccess=void 0;const ia=l,na=D;ra.LDMigrationSuccess=function(e){return{success:!0,result:e}},ra.LDMigrationError=function(e){return{success:!1,error:e}};class sa{constructor(e,t){var r,i;this._client=e,this._config=t,this._readTable={[ia.LDMigrationStage.Off]:async e=>this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),[ia.LDMigrationStage.DualWrite]:async e=>this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),[ia.LDMigrationStage.Shadow]:async e=>{const{fromOld:t,fromNew:r}=await this._doRead(e);return this._trackConsistency(e,t,r),t},[ia.LDMigrationStage.Live]:async e=>{const{fromNew:t,fromOld:r}=await this._doRead(e);return this._trackConsistency(e,r,t),t},[ia.LDMigrationStage.RampDown]:async e=>this._doSingleOp(e,"new",this._config.readNew.bind(this._config)),[ia.LDMigrationStage.Complete]:async e=>this._doSingleOp(e,"new",this._config.readNew.bind(this._config))},this._writeTable={[ia.LDMigrationStage.Off]:async e=>({authoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}),[ia.LDMigrationStage.DualWrite]:async e=>{const t=await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config))}},[ia.LDMigrationStage.Shadow]:async e=>{const t=await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config))}},[ia.LDMigrationStage.Live]:async e=>{const t=await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}},[ia.LDMigrationStage.RampDown]:async e=>{const t=await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}},[ia.LDMigrationStage.Complete]:async e=>({authoritative:await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config))})},this._config.execution?this._execution=this._config.execution:this._execution=new na.LDConcurrentExecution,this._latencyTracking=null===(r=this._config.latencyTracking)||void 0===r||r,this._errorTracking=null===(i=this._config.errorTracking)||void 0===i||i}async read(e,t,r,i){const n=await this._client.migrationVariation(e,t,r),s=await this._readTable[n.value]({payload:i,tracker:n.tracker});return n.tracker.op("read"),this._sendEvent(n.tracker),s}async write(e,t,r,i){const n=await this._client.migrationVariation(e,t,r),s=await this._writeTable[n.value]({payload:i,tracker:n.tracker});return n.tracker.op("write"),this._sendEvent(n.tracker),s}_sendEvent(e){const t=e.createEvent();t&&this._client.trackMigration(t)}_trackConsistency(e,t,r){this._config.check&&t.success&&r.success&&e.tracker.consistency(()=>this._config.check(t.result,r.result))}async _readSequentialFixed(e){return{fromOld:await this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),fromNew:await this._doSingleOp(e,"new",this._config.readNew.bind(this._config))}}async _readConcurrent(e){const t=this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),r=this._doSingleOp(e,"new",this._config.readNew.bind(this._config)),[i,n]=await Promise.all([t,r]);return{fromOld:i,fromNew:n}}async _readSequentialRandom(e){if(0===Math.floor(2*Math.random())){return{fromOld:await this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),fromNew:await this._doSingleOp(e,"new",this._config.readNew.bind(this._config))}}const t=await this._doSingleOp(e,"new",this._config.readNew.bind(this._config));return{fromOld:await this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),fromNew:t}}async _doRead(e){var t;if((null===(t=this._execution)||void 0===t?void 0:t.type)===na.LDExecution.Serial){return this._execution.ordering===na.LDExecutionOrdering.Fixed?this._readSequentialFixed(e):this._readSequentialRandom(e)}return this._readConcurrent(e)}async _doSingleOp(e,t,r){e.tracker.invoked(t);const i=await this._trackLatency(e.tracker,t,()=>async function(e){try{return await e()}catch(e){return{success:!1,error:e}}}(()=>r(e.payload)));return!i.success&&this._errorTracking&&e.tracker.error(t),Object.assign({origin:t},i)}async _trackLatency(e,t,r){if(!this._latencyTracking)return r();let i,n,s;"undefined"!=typeof performance?(i=performance.now(),s=await r(),n=performance.now()):(i=Date.now(),s=await r(),n=Date.now());const a=n-i;return e.latency(t,a),s}}ra.createMigration=function(e,t){return new sa(e,t)};var aa={},oa={},la={},ca={};Object.defineProperty(ca,"__esModule",{value:!0});ca.default=class{constructor(e,t,r,i){this._filesystem=e,this._paths=t,this._watch=r,this._callback=i,this._watchers=[],this._fileData={},this._fileTimestamps={}}async loadAndWatch(){const e=this._paths.map(async e=>({data:await this._filesystem.readFile(e),path:e,timeStamp:await this._filesystem.getFileTimestamp(e)})),t=await Promise.all(e);t.forEach(e=>{this._fileData[e.path]=e.data,this._fileTimestamps[e.path]=e.timeStamp}),this._callback(t),this._watch&&this._paths.forEach(e=>{const t=this._filesystem.watch(e,async(e,t)=>{const r=await this._filesystem.getFileTimestamp(t);if(r===this._fileTimestamps[t])return;this._fileTimestamps[t]=r;const i=await this._filesystem.readFile(t);this._fileData[t]=i,this._debounceCallback()});this._watchers.push(t)})}close(){this._watchers.forEach(e=>e.close())}_debounceCallback(){this._debounceHandle||(this._debounceHandle=e=>{e()})}},Object.defineProperty(la,"__esModule",{value:!0});const ua=oe,da=le,ha=ca;la.default=class{constructor(e,t,r,i=()=>{},n){var s;this._featureStore=r,this._initSuccessHandler=i,this._errorHandler=n,this._allData={},this._fileLoader=new ha.default(t,e.paths,null!==(s=e.autoUpdate)&&void 0!==s&&s,e=>{var t,r;try{this._processFileData(e)}catch(e){null===(t=this._errorHandler)||void 0===t||t.call(this,e),null===(r=this._logger)||void 0===r||r.error(`Error processing files: ${e}`)}}),this._logger=e.logger,this._yamlParser=e.yamlParser}start(){(async()=>{var e;try{await this._fileLoader.loadAndWatch()}catch(t){null===(e=this._errorHandler)||void 0===e||e.call(this,t)}})()}stop(){this._fileLoader.close()}close(){this.stop()}_addItem(e,t){if(this._allData[e.namespace]||(this._allData[e.namespace]={}),this._allData[e.namespace][t.key])throw new Error(`found duplicate key: "${t.key}"`);this._allData[e.namespace][t.key]=t}_processFileData(e){const t=this._allData;this._allData={},e.forEach(e=>{let r;if(e.path.endsWith(".yml")||e.path.endsWith(".yaml")){if(!this._yamlParser)throw new Error(`Attempted to parse yaml file (${e.path}) without parser.`);r=this._yamlParser(e.data)}else r=JSON.parse(e.data);this._processParsedData(r,t)}),this._featureStore.init(this._allData,()=>{this._initSuccessHandler(),this._initSuccessHandler=()=>{}})}_processParsedData(e,t){Object.keys(e.flags||{}).forEach(t=>{(0,ua.processFlag)(e.flags[t]),this._addItem(da.default.Features,e.flags[t])}),Object.keys(e.flagValues||{}).forEach(r=>{var i,n;const s=null===(i=t[da.default.Features.namespace])||void 0===i?void 0:i[r];let{version:a}=null!=s?s:{version:1};s&&JSON.stringify(e.flagValues[r])!==JSON.stringify(null===(n=null==s?void 0:s.variations)||void 0===n?void 0:n[0])&&(a+=1);const o=function(e,t,r){return{key:e,on:!0,fallthrough:{variation:0},variations:[t],version:r}}(r,e.flagValues[r],a);(0,ua.processFlag)(o),this._addItem(da.default.Features,o)}),Object.keys(e.segments||{}).forEach(t=>{(0,ua.processSegment)(e.segments[t]),this._addItem(da.default.Segments,e.segments[t])})}},Object.defineProperty(oa,"__esModule",{value:!0});const fa=la;oa.default=class{constructor(e){this._options=e}create(e,t,r,i){const n={paths:this._options.paths,autoUpdate:this._options.autoUpdate,logger:this._options.logger||e.basicConfiguration.logger,yamlParser:this._options.yamlParser};return new fa.default(n,e.platform.fileSystem,t,r,i)}getFactory(){return(e,t,r,i)=>this.create(e,t,r,i)}};var pa={},va={},ga={},_a={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.variationForBoolean=e.FALSE_VARIATION_INDEX=e.TRUE_VARIATION_INDEX=void 0,e.TRUE_VARIATION_INDEX=0,e.FALSE_VARIATION_INDEX=1,e.variationForBoolean=function(t){return t?e.TRUE_VARIATION_INDEX:e.FALSE_VARIATION_INDEX}}(_a);var ya={};Object.defineProperty(ya,"__esModule",{value:!0});const ma=o,ba=_a;class Sa{constructor(e,t,r){this._flagBuilder=e,this._clauses=[],t&&(this._clauses=[...t]),void 0!==r&&(this._variation=r)}andMatch(e,t,...r){return this._clauses.push({contextKind:e,attribute:t,attributeReference:new ma.AttributeReference(t),op:"in",values:r,negate:!1}),this}andNotMatch(e,t,...r){return this._clauses.push({contextKind:e,attribute:t,attributeReference:new ma.AttributeReference(t),op:"in",values:r,negate:!0}),this}thenReturn(e){return ma.TypeValidators.Boolean.is(e)?(this._flagBuilder.booleanFlag(),this.thenReturn((0,ba.variationForBoolean)(e))):(this._variation=e,this._flagBuilder.addRule(this),this._flagBuilder)}build(e){return{id:`rule${e}`,variation:this._variation,clauses:this._clauses}}clone(){return new Sa(this._flagBuilder,this._clauses,this._variation)}}ya.default=Sa,Object.defineProperty(ga,"__esModule",{value:!0});const Ea=o,wa=_a,ka=ya;class Oa{constructor(e,t){this._key=e,this._data={on:!0,variations:[]},t&&(this._data={on:t.on,variations:[...t.variations]},void 0!==t.offVariation&&(this._data.offVariation=t.offVariation),void 0!==t.fallthroughVariation&&(this._data.fallthroughVariation=t.fallthroughVariation),t.targetsByVariation&&(this._data.targetsByVariation=JSON.parse(JSON.stringify(t.targetsByVariation))),t.rules&&(this._data.rules=[],t.rules.forEach(e=>{var t;null===(t=this._data.rules)||void 0===t||t.push(e.clone())})))}get _isBooleanFlag(){return 2===this._data.variations.length&&!0===this._data.variations[wa.TRUE_VARIATION_INDEX]&&!1===this._data.variations[wa.FALSE_VARIATION_INDEX]}booleanFlag(){return this._isBooleanFlag?this:this.variations(!0,!1).fallthroughVariation(wa.TRUE_VARIATION_INDEX).offVariation(wa.FALSE_VARIATION_INDEX)}variations(...e){return this._data.variations=[...e],this}on(e){return this._data.on=e,this}fallthroughVariation(e){return Ea.TypeValidators.Boolean.is(e)?this.booleanFlag().fallthroughVariation((0,wa.variationForBoolean)(e)):(this._data.fallthroughVariation=e,this)}offVariation(e){return Ea.TypeValidators.Boolean.is(e)?this.booleanFlag().offVariation((0,wa.variationForBoolean)(e)):(this._data.offVariation=e,this)}variationForAll(e){return this.on(!0).clearRules().clearAllTargets().fallthroughVariation(e)}valueForAll(e){return this.variations(e).variationForAll(0)}variationForUser(e,t){return this.variationForContext("user",e,t)}variationForContext(e,t,r){return Ea.TypeValidators.Boolean.is(r)?this.booleanFlag().variationForContext(e,t,(0,wa.variationForBoolean)(r)):(this._data.targetsByVariation||(this._data.targetsByVariation={}),this._data.variations.forEach((i,n)=>{if(n===r){const r=this._data.targetsByVariation[n]||{};e in r||(r[e]=[]);-1!==r[e].indexOf(t)||r[e].push(t),this._data.targetsByVariation[n]=r}else{const r=this._data.targetsByVariation[n];if(r){const i=r[e];if(i){const n=i.indexOf(t);-1!==n&&(i.splice(n,1),i.length||delete r[e])}Object.keys(r).length||delete this._data.targetsByVariation[n]}}}),this)}clearRules(){return delete this._data.rules,this}clearAllTargets(){return delete this._data.targetsByVariation,this}ifMatch(e,t,...r){return new ka.default(this).andMatch(e,t,...r)}ifNotMatch(e,t,...r){return new ka.default(this).andNotMatch(e,t,...r)}checkRatio(e){var t;return this._data.migration=null!==(t=this._data.migration)&&void 0!==t?t:{},this._data.migration.checkRatio=e,this}samplingRatio(e){return this._data.samplingRatio=e,this}addRule(e){this._data.rules||(this._data.rules=[]),this._data.rules.push(e)}build(e){const t={key:this._key,version:e,on:this._data.on,offVariation:this._data.offVariation,fallthrough:{variation:this._data.fallthroughVariation},variations:[...this._data.variations],migration:this._data.migration,samplingRatio:this._data.samplingRatio};if(this._data.targetsByVariation){const e=[],r=[];Object.entries(this._data.targetsByVariation).forEach(([t,i])=>{Object.entries(i).forEach(([i,n])=>{const s=parseInt(t,10);e.push({contextKind:i,values:"user"===i?[]:n,variation:s}),"user"===i&&r.push({values:n,variation:s})})}),t.targets=r,t.contextTargets=e}return this._data.rules&&(t.rules=this._data.rules.map((e,t)=>e.build(String(t)))),t}clone(){return new Oa(this._key,this._data)}getKey(){return this._key}}ga.default=Oa;var xa={};Object.defineProperty(xa,"__esModule",{value:!0});xa.default=class{constructor(e,t,r,i,n){this._featureStore=e,this._onStop=i,this._listeners=n,this._flags=Object.assign({},t),this._segments=Object.assign({},r)}async start(){this._listeners.forEach(({processJson:e})=>{e({data:{flags:this._flags,segments:this._segments}})})}stop(){this._onStop(this)}close(){this.stop()}async upsert(e,t){return this._featureStore.upsert(e,t)}},Object.defineProperty(va,"__esModule",{value:!0});const Da=ae,Pa=Ae,Ra=oe,Ia=le,Ma=ga,Ta=xa;va.default=class{constructor(){this._currentFlags={},this._currentSegments={},this._dataSources=[],this._flagBuilders={}}getFactory(){return(e,t,r,i)=>{const n=(0,Da.createStreamListeners)(t,e.basicConfiguration.logger,{put:r}),s=new Ta.default(new Pa.default(t),this._currentFlags,this._currentSegments,e=>{this._dataSources.splice(this._dataSources.indexOf(e))},n);return this._dataSources.push(s),s}}flag(e){return this._flagBuilders[e]?this._flagBuilders[e].clone():new Ma.default(e).booleanFlag()}update(e){const t=e.getKey(),r=this._currentFlags[t],i=r?r.version:0,n=e.build(i+1);return this._currentFlags[t]=n,this._flagBuilders[t]=e.clone(),Promise.all(this._dataSources.map(e=>e.upsert(Ia.default.Features,n)))}usePreconfiguredFlag(e){const t=JSON.parse(JSON.stringify(e)),r=this._currentFlags[t.key],i=Object.assign(Object.assign({},t),{version:r?r.version+1:t.version});return(0,Ra.processFlag)(i),this._currentFlags[t.key]=i,Promise.all(this._dataSources.map(e=>e.upsert(Ia.default.Features,i)))}usePreconfiguredSegment(e){const t=JSON.parse(JSON.stringify(e)),r=this._currentSegments[t.key],i=Object.assign(Object.assign({},t),{version:r?r.version+1:t.version});return(0,Ra.processSegment)(i),this._currentSegments[t.key]=i,Promise.all(this._dataSources.map(e=>e.upsert(Ia.default.Segments,i)))}},Object.defineProperty(pa,"__esModule",{value:!0}),pa.TestDataRuleBuilder=pa.TestDataFlagBuilder=pa.TestData=void 0;const Aa=va;pa.TestData=Aa.default;const Ca=ga;pa.TestDataFlagBuilder=Ca.default;const Fa=ya;pa.TestDataRuleBuilder=Fa.default,function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.FileDataSourceFactory=void 0;const n=oa;e.FileDataSourceFactory=n.default,i(pa,e),i(F,e)}(aa);var ja={},La={};Object.defineProperty(La,"__esModule",{value:!0});La.default=class{constructor(e,t){this.handlers={},this.closed=!1,this.url=e,this.options=t}addEventListener(e,t){this.handlers[e]=t}close(){this.closed=!0}simulateError(e){this.options.errorFilter(e)||(this.closed=!0)}},Object.defineProperty(ja,"__esModule",{value:!0}),ja.NullEventSource=void 0;const Na=La;ja.NullEventSource=Na.default;var $a={};Object.defineProperty($a,"__esModule",{value:!0}),$a.TtlCache=void 0;const Ba=$e;$a.TtlCache=Ba.default,function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMigration=e.LDMigrationSuccess=e.LDMigrationError=e.BigSegmentStoreStatusProviderImpl=e.LDClientImpl=e.internalServer=e.platform=e.integrations=void 0;const n=s;e.BigSegmentStoreStatusProviderImpl=n.default;const c=a;e.LDClientImpl=c.default;const u=ra;Object.defineProperty(e,"createMigration",{enumerable:!0,get:function(){return u.createMigration}}),Object.defineProperty(e,"LDMigrationError",{enumerable:!0,get:function(){return u.LDMigrationError}}),Object.defineProperty(e,"LDMigrationSuccess",{enumerable:!0,get:function(){return u.LDMigrationSuccess}}),e.integrations=aa,e.platform=o,i(l,e),i(Te,e),i(ja,e),i(o,e),e.internalServer=$a}(n);var Va={},za={},Ha={};Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.createCallbacks=void 0;Ha.createCallbacks=e=>({onError:t=>{var r;null===(r=null==e?void 0:e.error)||void 0===r||r.call(e,t.message)},onFailed:e=>{},onReady:()=>{},onUpdate:e=>{},hasEventListeners:()=>!1});var Ua={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createOptions=e.defaultOptions=void 0;const t=n;e.defaultOptions={stream:!1,sendEvents:!1,useLdd:!0,diagnosticOptOut:!0,logger:t.BasicLogger.get()};e.createOptions=t=>{var r;const i=Object.assign(Object.assign({},e.defaultOptions),t);return null===(r=i.logger)||void 0===r||r.debug(`Using LD options: ${JSON.stringify(i)}`),i}}(Ua);var Ka={},qa=t&&t.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.validateOptions=void 0;Ka.validateOptions=(e,t)=>{const{featureStore:r,logger:i,sendEvents:n}=t,s=qa(t,["featureStore","logger","sendEvents"]);if(!e)throw new Error("You must configure the client with a client key");if(!r||"object"!=typeof r||!r.get)throw new Error("You must configure the client with a feature store");if(!i)throw new Error("You must configure the client with a logger");if("{}"!==JSON.stringify(s))throw new Error(`Invalid configuration: ${Object.keys(s).toString()} not supported`);return!0},function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(Ha,e),i(Ua,e),i(Ka,e)}(za),Object.defineProperty(Va,"__esModule",{value:!0});const Wa=n,Ga=za;Va.default=class extends Wa.LDClientImpl{constructor(e,t,r){const i=(0,Ga.createOptions)(r);super(e,t,i,(0,Ga.createCallbacks)(i.logger))}initialized(){return!0}waitForInitialization(){return Promise.resolve(this)}};var Xa={},Ja={};Object.defineProperty(Ja,"__esModule",{value:!0});Ja.default=class{constructor(e){this._cacheTtlMs=e}get(){if(!(this._cacheTtlMs<0)&&void 0!==this._cache)return 0===this._cacheTtlMs||Date.now()<this._cache.expiration?this._cache.value:void(this._cache=void 0)}set(e){this._cache={value:e,expiration:Date.now()+this._cacheTtlMs}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EdgeFeatureStore=e.buildRootKey=void 0;const t=n,r=Ja;e.buildRootKey=e=>`LD-Env-${e}`;e.EdgeFeatureStore=class{constructor(i,n,s,a,o){this._edgeProvider=i,this._sdkKey=n,this._description=s,this._logger=a,this.close=t.noop,this.delete=t.noop,this.upsert=t.noop,this._rootKey=(0,e.buildRootKey)(this._sdkKey),this._cache=new r.default(o)}async get(e,t,r){const{namespace:i}=e,n="features"===i?"flags":i;this._logger.debug(`Requesting ${t} from ${this._rootKey}.${n}`);try{const e=await this._getStorePayload();switch(i){case"features":r(e.flags[t]);break;case"segments":r(e.segments[t]);break;default:r(null)}}catch(e){this._logger.error(e),r(null)}}async all(e,r=t.noop){const{namespace:i}=e,n="features"===i?"flags":i;this._logger.debug(`Requesting all from ${this._rootKey}.${n}`);try{const e=await this._getStorePayload();switch(i){case"features":r(e.flags);break;case"segments":r(e.segments);break;default:throw new Error(`Unsupported DataKind: ${i}`)}}catch(e){this._logger.error(e),r({})}}async _getStorePayload(){let e=this._cache.get();if(void 0!==e)return e;const r=await this._edgeProvider.get(this._rootKey);if(!r)throw new Error(`${this._rootKey} is not found in KV.`);if(e=(0,t.deserializePoll)(r),!e)throw new Error(`Error deserializing ${this._rootKey}`);return this._cache.set(e),e}async initialized(e=t.noop){const r=null!==await this._edgeProvider.get(this._rootKey);this._logger.debug(`Is ${this._rootKey} initialized? ${r}`),e(r)}init(e,t){t()}getDescription(){return this._description}}}(Xa);var Ya={},Za={},Qa=r(e),eo={},to={exports:{}};var ro,io={exports:{}};function no(){return ro||(ro=1,io.exports=function(){var e=e||function(e,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=require("crypto")}catch(e){}var n=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},o=a.lib={},l=o.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=o.WordArray=l.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=t!=r?t:4*e.length},toString:function(e){return(e||d).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes,n=e.sigBytes;if(this.clamp(),i%4)for(var s=0;s<n;s++){var a=r[s>>>2]>>>24-s%4*8&255;t[i+s>>>2]|=a<<24-(i+s)%4*8}else for(var o=0;o<n;o+=4)t[i+o>>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),u=a.enc={},d=u.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var s=t[n>>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new c.init(r,t/2)}},h=u.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var s=t[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new c.init(r,t)}},f=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,a=this.blockSize,o=s/(4*a),l=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,u=e.min(4*l,s);if(l){for(var d=0;d<l;d+=a)this._doProcessBlock(n,d);r=n.splice(0,l),i.sigBytes-=u}return new c.init(r,u)},clone:function(){var e=l.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});o.Hasher=p.extend({cfg:l.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new v.HMAC.init(e,r).finalize(t)}}});var v=a.algo={};return a}(Math);return e}()),io.exports}var so,ao={exports:{}};function oo(){return so?ao.exports:(so=1,ao.exports=function(e){return i=(r=e).lib,n=i.Base,s=i.WordArray,(a=r.x64={}).Word=n.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=n.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],i=0;i<t;i++){var n=e[i];r.push(n.high),r.push(n.low)}return s.create(r,this.sigBytes)},clone:function(){for(var e=n.clone.call(this),t=e.words=this.words.slice(0),r=t.length,i=0;i<r;i++)t[i]=t[i].clone();return e}}),e;var t,r,i,n,s,a}(no()))}var lo,co={exports:{}};function uo(){return lo||(lo=1,co.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init,i=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,i=[],n=0;n<t;n++)i[n>>>2]|=e[n]<<24-n%4*8;r.call(this,i,t)}else r.apply(this,arguments)};i.prototype=t}}(),e.lib.WordArray}(no())),co.exports}var ho,fo={exports:{}};function po(){return ho?fo.exports:(ho=1,fo.exports=function(e){return function(){var t=e,r=t.lib.WordArray,i=t.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n+=2){var s=t[n>>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n++)i[n>>>1]|=e.charCodeAt(n)<<16-n%2*16;return r.create(i,2*t)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s<r;s+=2){var a=n(t[s>>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s<t;s++)i[s>>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return r.create(i,2*t)}}}(),e.enc.Utf16}(no()))}var vo,go={exports:{}},_o=go.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function i(e,t,i){for(var n=[],s=0,a=0;a<t;a++)if(a%4){var o=i[e.charCodeAt(a-1)]<<a%4*2|i[e.charCodeAt(a)]>>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return r.create(n,s)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s<r;s+=3)for(var a=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o<r;o++)n.push(i.charAt(a>>>6*(3-o)&63));var l=i.charAt(64);if(l)for(;n.length%4;)n.push(l);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s<r.length;s++)n[r.charCodeAt(s)]=s}var a=r.charAt(64);if(a){var o=e.indexOf(a);-1!==o&&(t=o)}return i(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(no()),yo={exports:{}};function mo(){return vo?yo.exports:(vo=1,yo.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function i(e,t,i){for(var n=[],s=0,a=0;a<t;a++)if(a%4){var o=i[e.charCodeAt(a-1)]<<a%4*2|i[e.charCodeAt(a)]>>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return r.create(n,s)}t.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],a=0;a<i;a+=3)for(var o=(r[a>>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,l=0;l<4&&a+.75*l<i;l++)s.push(n.charAt(o>>>6*(3-l)&63));var c=n.charAt(64);if(c)for(;s.length%4;)s.push(c);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var a=0;a<n.length;a++)s[n.charCodeAt(a)]=a}var o=n.charAt(64);if(o){var l=e.indexOf(o);-1!==l&&(r=l)}return i(e,r,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),e.enc.Base64url}(no()))}var bo,So={exports:{}};function Eo(){return bo||(bo=1,So.exports=function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[];!function(){for(var e=0;e<64;e++)o[e]=4294967296*t.abs(t.sin(e+1))|0}();var l=a.MD5=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,a=e[t+0],l=e[t+1],f=e[t+2],p=e[t+3],v=e[t+4],g=e[t+5],_=e[t+6],y=e[t+7],m=e[t+8],b=e[t+9],S=e[t+10],E=e[t+11],w=e[t+12],k=e[t+13],O=e[t+14],x=e[t+15],D=s[0],P=s[1],R=s[2],I=s[3];D=c(D,P,R,I,a,7,o[0]),I=c(I,D,P,R,l,12,o[1]),R=c(R,I,D,P,f,17,o[2]),P=c(P,R,I,D,p,22,o[3]),D=c(D,P,R,I,v,7,o[4]),I=c(I,D,P,R,g,12,o[5]),R=c(R,I,D,P,_,17,o[6]),P=c(P,R,I,D,y,22,o[7]),D=c(D,P,R,I,m,7,o[8]),I=c(I,D,P,R,b,12,o[9]),R=c(R,I,D,P,S,17,o[10]),P=c(P,R,I,D,E,22,o[11]),D=c(D,P,R,I,w,7,o[12]),I=c(I,D,P,R,k,12,o[13]),R=c(R,I,D,P,O,17,o[14]),D=u(D,P=c(P,R,I,D,x,22,o[15]),R,I,l,5,o[16]),I=u(I,D,P,R,_,9,o[17]),R=u(R,I,D,P,E,14,o[18]),P=u(P,R,I,D,a,20,o[19]),D=u(D,P,R,I,g,5,o[20]),I=u(I,D,P,R,S,9,o[21]),R=u(R,I,D,P,x,14,o[22]),P=u(P,R,I,D,v,20,o[23]),D=u(D,P,R,I,b,5,o[24]),I=u(I,D,P,R,O,9,o[25]),R=u(R,I,D,P,p,14,o[26]),P=u(P,R,I,D,m,20,o[27]),D=u(D,P,R,I,k,5,o[28]),I=u(I,D,P,R,f,9,o[29]),R=u(R,I,D,P,y,14,o[30]),D=d(D,P=u(P,R,I,D,w,20,o[31]),R,I,g,4,o[32]),I=d(I,D,P,R,m,11,o[33]),R=d(R,I,D,P,E,16,o[34]),P=d(P,R,I,D,O,23,o[35]),D=d(D,P,R,I,l,4,o[36]),I=d(I,D,P,R,v,11,o[37]),R=d(R,I,D,P,y,16,o[38]),P=d(P,R,I,D,S,23,o[39]),D=d(D,P,R,I,k,4,o[40]),I=d(I,D,P,R,a,11,o[41]),R=d(R,I,D,P,p,16,o[42]),P=d(P,R,I,D,_,23,o[43]),D=d(D,P,R,I,b,4,o[44]),I=d(I,D,P,R,w,11,o[45]),R=d(R,I,D,P,x,16,o[46]),D=h(D,P=d(P,R,I,D,f,23,o[47]),R,I,a,6,o[48]),I=h(I,D,P,R,y,10,o[49]),R=h(R,I,D,P,O,15,o[50]),P=h(P,R,I,D,g,21,o[51]),D=h(D,P,R,I,w,6,o[52]),I=h(I,D,P,R,p,10,o[53]),R=h(R,I,D,P,S,15,o[54]),P=h(P,R,I,D,l,21,o[55]),D=h(D,P,R,I,m,6,o[56]),I=h(I,D,P,R,x,10,o[57]),R=h(R,I,D,P,_,15,o[58]),P=h(P,R,I,D,k,21,o[59]),D=h(D,P,R,I,v,6,o[60]),I=h(I,D,P,R,E,10,o[61]),R=h(R,I,D,P,f,15,o[62]),P=h(P,R,I,D,b,21,o[63]),s[0]=s[0]+D|0,s[1]=s[1]+P|0,s[2]=s[2]+R|0,s[3]=s[3]+I|0},_doFinalize:function(){var e=this._data,r=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;r[n>>>5]|=128<<24-n%32;var s=t.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,l=o.words,c=0;c<4;c++){var u=l[c];l[c]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return o},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,r,i,n,s,a){var o=e+(t&r|~t&i)+n+a;return(o<<s|o>>>32-s)+t}function u(e,t,r,i,n,s,a){var o=e+(t&i|r&~i)+n+a;return(o<<s|o>>>32-s)+t}function d(e,t,r,i,n,s,a){var o=e+(t^r^i)+n+a;return(o<<s|o>>>32-s)+t}function h(e,t,r,i,n,s,a){var o=e+(r^(t|~i))+n+a;return(o<<s|o>>>32-s)+t}r.MD5=s._createHelper(l),r.HmacMD5=s._createHmacHelper(l)}(Math),e.MD5}(no())),So.exports}var wo,ko={exports:{}};function Oo(){return wo||(wo=1,ko.exports=function(e){return r=(t=e).lib,i=r.WordArray,n=r.Hasher,s=t.algo,a=[],o=s.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],l=r[4],c=0;c<80;c++){if(c<16)a[c]=0|e[t+c];else{var u=a[c-3]^a[c-8]^a[c-14]^a[c-16];a[c]=u<<1|u>>>31}var d=(i<<5|i>>>27)+l+a[c];d+=c<20?1518500249+(n&s|~n&o):c<40?1859775393+(n^s^o):c<60?(n&s|n&o|s&o)-1894007588:(n^s^o)-899497514,l=o,o=s,s=n<<30|n>>>2,n=i,i=d}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+l|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=n._createHelper(o),t.HmacSHA1=n._createHmacHelper(o),e.SHA1;var t,r,i,n,s,a,o}(no())),ko.exports}var xo,Do={exports:{}};function Po(){return xo||(xo=1,Do.exports=function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[],l=[];!function(){function e(e){for(var r=t.sqrt(e),i=2;i<=r;i++)if(!(e%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)e(i)&&(n<8&&(o[n]=r(t.pow(i,.5))),l[n]=r(t.pow(i,1/3)),n++),i++}();var c=[],u=a.SHA256=s.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],u=r[5],d=r[6],h=r[7],f=0;f<64;f++){if(f<16)c[f]=0|e[t+f];else{var p=c[f-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,g=c[f-2],_=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;c[f]=v+c[f-7]+_+c[f-16]}var y=i&n^i&s^n&s,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&u^~o&d)+l[f]+c[f];h=d,d=u,u=o,o=a+b|0,a=s,s=n,n=i,i=b+(m+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=t.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=s._createHelper(u),r.HmacSHA256=s._createHmacHelper(u)}(Math),e.SHA256}(no())),Do.exports}var Ro,Io={exports:{}};var Mo,To={exports:{}};function Ao(){return Mo||(Mo=1,To.exports=function(e){return function(){var t=e,r=t.lib.Hasher,i=t.x64,n=i.Word,s=i.WordArray,a=t.algo;function o(){return n.create.apply(n,arguments)}var l=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],c=[];!function(){for(var e=0;e<80;e++)c[e]=o()}();var u=a.SHA512=r.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],u=r[5],d=r[6],h=r[7],f=i.high,p=i.low,v=n.high,g=n.low,_=s.high,y=s.low,m=a.high,b=a.low,S=o.high,E=o.low,w=u.high,k=u.low,O=d.high,x=d.low,D=h.high,P=h.low,R=f,I=p,M=v,T=g,A=_,C=y,F=m,j=b,L=S,N=E,$=w,B=k,V=O,z=x,H=D,U=P,K=0;K<80;K++){var q,W,G=c[K];if(K<16)W=G.high=0|e[t+2*K],q=G.low=0|e[t+2*K+1];else{var X=c[K-15],J=X.high,Y=X.low,Z=(J>>>1|Y<<31)^(J>>>8|Y<<24)^J>>>7,Q=(Y>>>1|J<<31)^(Y>>>8|J<<24)^(Y>>>7|J<<25),ee=c[K-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=c[K-7],ae=se.high,oe=se.low,le=c[K-16],ce=le.high,ue=le.low;W=(W=(W=Z+ae+((q=Q+oe)>>>0<Q>>>0?1:0))+ie+((q+=ne)>>>0<ne>>>0?1:0))+ce+((q+=ue)>>>0<ue>>>0?1:0),G.high=W,G.low=q}var de,he=L&$^~L&V,fe=N&B^~N&z,pe=R&M^R&A^M&A,ve=I&T^I&C^T&C,ge=(R>>>28|I<<4)^(R<<30|I>>>2)^(R<<25|I>>>7),_e=(I>>>28|R<<4)^(I<<30|R>>>2)^(I<<25|R>>>7),ye=(L>>>14|N<<18)^(L>>>18|N<<14)^(L<<23|N>>>9),me=(N>>>14|L<<18)^(N>>>18|L<<14)^(N<<23|L>>>9),be=l[K],Se=be.high,Ee=be.low,we=H+ye+((de=U+me)>>>0<U>>>0?1:0),ke=_e+ve;H=V,U=z,V=$,z=B,$=L,B=N,L=F+(we=(we=(we=we+he+((de+=fe)>>>0<fe>>>0?1:0))+Se+((de+=Ee)>>>0<Ee>>>0?1:0))+W+((de+=q)>>>0<q>>>0?1:0))+((N=j+de|0)>>>0<j>>>0?1:0)|0,F=A,j=C,A=M,C=T,M=R,T=I,R=we+(ge+pe+(ke>>>0<_e>>>0?1:0))+((I=de+ke|0)>>>0<de>>>0?1:0)|0}p=i.low=p+I,i.high=f+R+(p>>>0<I>>>0?1:0),g=n.low=g+T,n.high=v+M+(g>>>0<T>>>0?1:0),y=s.low=y+C,s.high=_+A+(y>>>0<C>>>0?1:0),b=a.low=b+j,a.high=m+F+(b>>>0<j>>>0?1:0),E=o.low=E+N,o.high=S+L+(E>>>0<N>>>0?1:0),k=u.low=k+B,u.high=w+$+(k>>>0<B>>>0?1:0),x=d.low=x+z,d.high=O+V+(x>>>0<z>>>0?1:0),P=h.low=P+U,h.high=D+H+(P>>>0<U>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(u),t.HmacSHA512=r._createHmacHelper(u)}(),e.SHA512}(no(),oo())),To.exports}var Co,Fo={exports:{}};var jo,Lo={exports:{}};function No(){return jo||(jo=1,Lo.exports=function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.x64.Word,o=r.algo,l=[],c=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){l[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)c[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var o=0,d=0,h=0;h<7;h++){if(1&n){var f=(1<<h)-1;f<32?d^=1<<f:o^=1<<f-32}128&n?n=n<<1^113:n<<=1}u[s]=a.create(o,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=a.create()}();var h=o.SHA3=s.extend({cfg:s.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,i=this.blockSize/2,n=0;n<i;n++){var s=e[t+2*n],a=e[t+2*n+1];s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(P=r[n]).high^=a,P.low^=s}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,v=0;v<5;v++)f^=(P=r[h+5*v]).high,p^=P.low;var g=d[h];g.high=f,g.low=p}for(h=0;h<5;h++){var _=d[(h+4)%5],y=d[(h+1)%5],m=y.high,b=y.low;for(f=_.high^(m<<1|b>>>31),p=_.low^(b<<1|m>>>31),v=0;v<5;v++)(P=r[h+5*v]).high^=f,P.low^=p}for(var S=1;S<25;S++){var E=(P=r[S]).high,w=P.low,k=l[S];k<32?(f=E<<k|w>>>32-k,p=w<<k|E>>>32-k):(f=w<<k-32|E>>>64-k,p=E<<k-32|w>>>64-k);var O=d[c[S]];O.high=f,O.low=p}var x=d[0],D=r[0];for(x.high=D.high,x.low=D.low,h=0;h<5;h++)for(v=0;v<5;v++){var P=r[S=h+5*v],R=d[S],I=d[(h+1)%5+5*v],M=d[(h+2)%5+5*v];P.high=R.high^~I.high&M.high,P.low=R.low^~I.low&M.low}P=r[0];var T=u[o];P.high^=T.high,P.low^=T.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var i=8*e.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(t.ceil((i+1)/s)*s>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,l=o/8,c=[],u=0;u<l;u++){var d=a[u],h=d.high,f=d.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),c.push(f),c.push(h)}return new n.init(c,o)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=s._createHelper(h),r.HmacSHA3=s._createHmacHelper(h)}(Math),e.SHA3}(no(),oo())),Lo.exports}var $o,Bo={exports:{}};var Vo,zo={exports:{}};function Ho(){return Vo?zo.exports:(Vo=1,zo.exports=function(e){var t,r,i;r=(t=e).lib.Base,i=t.enc.Utf8,t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),a=this._iKey=t.clone(),o=s.words,l=a.words,c=0;c<r;c++)o[c]^=1549556828,l[c]^=909522486;s.sigBytes=a.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}(no()))}var Uo,Ko={exports:{}};var qo,Wo={exports:{}};function Go(){return qo?Wo.exports:(qo=1,Wo.exports=function(e){return r=(t=e).lib,i=r.Base,n=r.WordArray,s=t.algo,a=s.MD5,o=s.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,i=this.cfg,s=i.hasher.create(),a=n.create(),o=a.words,l=i.keySize,c=i.iterations;o.length<l;){r&&s.update(r),r=s.update(e).finalize(t),s.reset();for(var u=1;u<c;u++)r=s.finalize(r),s.reset();a.concat(r)}return a.sigBytes=4*l,a}}),t.EvpKDF=function(e,t,r){return o.create(r).compute(e,t)},e.EvpKDF;var t,r,i,n,s,a,o}(no(),Oo(),Ho()))}var Xo,Jo={exports:{}};function Yo(){return Xo||(Xo=1,Jo.exports=function(e){e.lib.Cipher||function(t){var r=e,i=r.lib,n=i.Base,s=i.WordArray,a=i.BufferedBlockAlgorithm,o=r.enc;o.Utf8;var l=o.Base64,c=r.algo.EvpKDF,u=i.Cipher=a.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?m:_}return function(t){return{encrypt:function(r,i,n){return e(i).encrypt(t,r,i,n)},decrypt:function(r,i,n){return e(i).decrypt(t,r,i,n)}}}}()});i.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=r.mode={},h=i.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),f=d.CBC=function(){var e=h.extend();function r(e,r,i){var n,s=this._iv;s?(n=s,this._iv=t):n=this._prevBlock;for(var a=0;a<i;a++)e[r+a]^=n[a]}return e.Encryptor=e.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize;r.call(this,e,t,n),i.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}}),e.Decryptor=e.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize,s=e.slice(t,t+n);i.decryptBlock(e,t),r.call(this,e,t,n),this._prevBlock=s}}),e}(),p=(r.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,i=r-e.sigBytes%r,n=i<<24|i<<16|i<<8|i,a=[],o=0;o<i;o+=4)a.push(n);var l=s.create(a,i);e.concat(l)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};i.BlockCipher=u.extend({cfg:u.cfg.extend({mode:f,padding:p}),reset:function(){var e;u.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var v=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(l)},parse:function(e){var t,r=l.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),v.create({ciphertext:r,salt:t})}},_=i.SerializableCipher=n.extend({cfg:n.extend({format:g}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),a=n.cfg;return v.create({ciphertext:s,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(r.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)a=c.create({keySize:t+r,hasher:n}).compute(e,i);else var a=c.create({keySize:t+r}).compute(e,i);var o=s.create(a.words.slice(t),4*r);return a.sigBytes=4*t,v.create({key:a,iv:o,salt:i})}},m=i.PasswordBasedCipher=_.extend({cfg:_.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=_.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,_.decrypt.call(this,e,t,n.key,i)}})}()}(no(),Go())),Jo.exports}var Zo,Qo={exports:{}};function el(){return Zo?Qo.exports:(Zo=1,Qo.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var a=0;a<r;a++)e[t+a]^=n[a]}return t.Encryptor=t.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize;r.call(this,e,t,n,i),this._prevBlock=e.slice(t,t+n)}}),t.Decryptor=t.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize,s=e.slice(t,t+n);r.call(this,e,t,n,i),this._prevBlock=s}}),t}(),e.mode.CFB}(no(),Yo()))}var tl,rl={exports:{}};function il(){return tl?rl.exports:(tl=1,rl.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,s=this._counter;n&&(s=this._counter=n.slice(0),this._iv=void 0);var a=s.slice(0);r.encryptBlock(a,0),s[i-1]=s[i-1]+1|0;for(var o=0;o<i;o++)e[t+o]^=a[o]}}),t.Decryptor=r,t),e.mode.CTR;var t,r}(no(),Yo()))}var nl,sl={exports:{}};function al(){return nl?sl.exports:(nl=1,sl.exports=function(e){
1
+ import*as e from"crypto";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})}),r}var i={},n={},s={};Object.defineProperty(s,"__esModule",{value:!0});s.default=class{constructor(e){this._onRequestStatus=e}getStatus(){return this._lastStatus}async requireStatus(){return this._lastStatus||await this._onRequestStatus(),this._lastStatus}notify(){var e;this._lastStatus&&(null===(e=this._listener)||void 0===e||e.call(this,this._lastStatus))}setListener(e){this._listener=e}setStatus(e){this._lastStatus=e}};var a={},o={};!function(e){function t(e){return e.indexOf("~")?e.replace(/~1/g,"/").replace(/~0/g,"~"):e}class r{constructor(e,r=!1){if(r){const t=e;this._components=[t],this.isValid=""!==t,this.redactionName=t.startsWith("/")?`/${t.replace(/~/g,"~0").replace(/\//g,"~1")}`:t}else{if(this.redactionName=e,""===e||"/"===e||e.match(/\/\/|(^\/.*~[^0|^1])|~$/))return this.isValid=!1,void(this._components=[]);!function(e){return!e.startsWith("/")}(e)?e.indexOf("/",1)<0?this._components=[t(e.slice(1))]:this._components=function(e){return(e.startsWith("/")?e.substring(1):e).split("/").map(e=>t(e))}(e):this._components=[e],"_meta"===this._components[0]?this.isValid=!1:this.isValid=!0}}get(e){const{_components:t,isValid:r}=this;if(!r)return;let i=e;for(let e=0;e<t.length;e+=1){const r=t[e];if(null==i||!Object.prototype.hasOwnProperty.call(i,r)||"object"!=typeof i||Array.isArray(i))return;i=i[r]}return i}getComponent(e){return this._components[e]}get depth(){return this._components.length}get isKind(){return 1===this._components.length&&"kind"===this._components[0]}compare(e){return this.depth===e.depth&&this._components.every((t,r)=>t===e.getComponent(r))}get components(){return[...this._components]}}r.InvalidReference=new r("");class i{is(e){if(Array.isArray(e))return!1;const t=typeof e;return"function"===t||"object"===t}getType(){return"factory method or object"}}class n{constructor(e,t){this._typeName=e,this.typeOf=typeof t}is(e){return!Array.isArray(e)&&typeof e===this.typeOf}getType(){return this._typeName}}class s{constructor(e,t){this._typeName=e,this.typeOf=typeof t}is(e){return!!Array.isArray(e)&&(!(e.length>0)||e.every(e=>typeof e===this.typeOf))}getType(){return this._typeName}}class a extends n{constructor(e){super(`number with minimum value of ${e}`,0),this.min=e}is(e){return typeof e===this.typeOf&&e>=this.min}}class o extends n{constructor(e){super(`string matching ${e}`,""),this.expression=e}is(e){return"string"==typeof e&&!!e.match(this.expression)}}class l{is(e){return"function"==typeof e}getType(){return"function"}}class c{is(e){return"boolean"==typeof e||null==e}getType(){return"boolean | undefined | null"}}const u=/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d*)?(Z|[-+]\d\d(:\d\d)?)/;class d{is(e){return"number"==typeof e||"string"==typeof e&&u.test(e)}getType(){return"date"}}class h extends o{constructor(){super(/^(\w|\.|-)+$/)}is(e){return super.is(e)&&"kind"!==e}}class f{static createTypeArray(e,t){return new s(e,t)}static numberWithMin(e){return new a(e)}static stringMatchingRegex(e){return new o(e)}}function p(e){return"kind"in e&&(f.String.is(e.kind)&&"multi"!==e.kind)}function v(e){return"kind"in e&&(f.String.is(e.kind)&&"multi"===e.kind)}function g(e){return!("kind"in e)||null===e.kind||void 0===e.kind}function _(e,t=[]){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(t.includes(e))throw new Error("Cycle detected");if(Array.isArray(e)){return`[${e.map(r=>_(r,[...t,e])).map(e=>void 0===e?"null":e).join(",")}]`}return`{${Object.keys(e).sort().map(r=>{const i=_(e[r],[...t,e]);if(void 0!==i)return`${JSON.stringify(r)}:${i}`}).filter(e=>void 0!==e).join(",")}}`}f.String=new n("string",""),f.Number=new n("number",0),f.ObjectOrFactory=new i,f.Object=new n("object",{}),f.StringArray=new s("string[]",""),f.Boolean=new n("boolean",!0),f.Function=new l,f.Date=new d,f.Kind=new h,f.NullableBoolean=new c;const y="user";function m(e){return e.includes("%")||e.includes(":")?e.replace(/%/g,"%25").replace(/:/g,"%3A"):e}function b(e){return f.Kind.is(e)}function S(e){return f.String.is(e)&&""!==e}function E(e,t=!1){return e?e.map(e=>new r(e,t)):[]}class w{constructor(e,t,r){this._isMulti=!1,this._isUser=!1,this._wasLegacy=!1,this._contexts={},this.kind=t,this.valid=e,this.message=r}static _contextForError(e,t){return new w(!1,e,t)}static _getValueFromContext(e,t){if(t&&e.isValid)return 1===e.depth&&"anonymous"===e.getComponent(0)?!!t?.anonymous:e.get(t)}_contextForKind(e){return this._isMulti?this._contexts[e]:this.kind===e?this._context:void 0}static _fromMultiKindContext(e){const t=Object.keys(e).filter(e=>"kind"!==e),r=t.every(b);if(!t.length)return w._contextForError("multi","A multi-kind context must contain at least one kind");if(!r)return w._contextForError("multi","Context contains invalid kinds");const i={};let n=!0;const s=t.reduce((t,r)=>{const s=e[r];var a;return(a=s)&&f.Object.is(a)?(t[r]=s,i[r]=E(s._meta?.privateAttributes)):n=!1,t},{});if(!n)return w._contextForError("multi","Context contained contexts that were not objects");if(!Object.values(s).every(e=>S(e.key)))return w._contextForError("multi","Context contained invalid keys");if(1===t.length){const e=t[0],r=new w(!0,e);return r._context={...s[e],kind:e},r._privateAttributeReferences=i,r._isUser="user"===e,r}const a=new w(!0,e.kind);return a._contexts=s,a._privateAttributeReferences=i,a._isMulti=!0,a}static _fromSingleKindContext(e){const{key:t,kind:r}=e,i=b(r),n=S(t);if(!i)return w._contextForError(r??"unknown","The kind was not valid for the context");if(!n)return w._contextForError(r,"The key for the context was not valid");const s=E(e._meta?.privateAttributes),a=new w(!0,r);return a._isUser="user"===r,a._context=e,a._privateAttributeReferences={[r]:s},a}static _fromLegacyUser(e){if(!(void 0!==e.key&&null!==e.key))return w._contextForError("user","The key for the context was not valid");const t=new w(!0,"user");return t._isUser=!0,t._wasLegacy=!0,t._context=function(e){const t={...e.custom||[],kind:"user",key:String(e.key)};if(null!=e.anonymous){const r=!!e.anonymous;delete t.anonymous,t.anonymous=r}return null!==e.name&&void 0!==e.name&&(t.name=e.name),null!==e.ip&&void 0!==e.ip&&(t.ip=e.ip),null!==e.firstName&&void 0!==e.firstName&&(t.firstName=e.firstName),null!==e.lastName&&void 0!==e.lastName&&(t.lastName=e.lastName),null!==e.email&&void 0!==e.email&&(t.email=e.email),null!==e.avatar&&void 0!==e.avatar&&(t.avatar=e.avatar),null!==e.country&&void 0!==e.country&&(t.country=e.country),null!==e.privateAttributeNames&&void 0!==e.privateAttributeNames&&(t._meta={privateAttributes:e.privateAttributeNames}),t}(e),t._privateAttributeReferences={user:E(e.privateAttributeNames,!0)},t}static fromLDContext(e){return e?p(e)?w._fromSingleKindContext(e):v(e)?w._fromMultiKindContext(e):g(e)?w._fromLegacyUser(e):w._contextForError("unknown","Context was not of a valid kind"):w._contextForError("unknown","No context specified. Returning default value")}static toLDContext(e){if(!e.valid)return;const t=e.getContexts();if(!e._isMulti)return t[0][1];const r={kind:"multi"};return t.forEach(e=>{const t=e[0],i=e[1];r[t]=i}),r}valueForKind(e,t=y){return e.isKind?this.kinds:w._getValueFromContext(e,this._contextForKind(t))}key(e=y){return this._contextForKind(e)?.key}get isMultiKind(){return this._isMulti}get canonicalKey(){return this._isUser?this._context.key:this._isMulti?Object.keys(this._contexts).sort().map(e=>`${e}:${m(this._contexts[e].key)}`).join(":"):`${this.kind}:${m(this._context.key)}`}get kinds(){return this._isMulti?Object.keys(this._contexts):[this.kind]}get kindsAndKeys(){return this._isMulti?Object.entries(this._contexts).reduce((e,[t,r])=>(e[t]=r.key,e),{}):{[this.kind]:this._context.key}}privateAttributes(e){return this._privateAttributeReferences?.[e]||[]}getContexts(){return this._isMulti?Object.entries(this._contexts):[[this.kind,this._context]]}get legacy(){return this._wasLegacy}canonicalUnfilteredJson(){if(this.valid){if(this._cachedCanonicalJson)return this._cachedCanonicalJson;try{this._cachedCanonicalJson=_(w.toLDContext(this))}catch{}return this._cachedCanonicalJson}}}w.UserKind=y;const k=["key","kind","_meta","anonymous"].map(e=>new r(e,!0)),O=["name","ip","firstName","lastName","email","avatar","country"];class x{constructor(e,t){this._allAttributesPrivate=e,this._privateAttributes=t}filter(e,t=!1){const r=e.getContexts();if(1===r.length)return this._filterSingleKind(e,r[0][1],r[0][0],t);const i={kind:"multi"};return r.forEach(([r,n])=>{i[r]=this._filterSingleKind(e,n,r,t)}),i}_getAttributesToFilter(e,t,i,n){return(n?Object.keys(t).map(e=>new r(e,!0)):[...this._privateAttributes,...e.privateAttributes(i)]).filter(e=>!k.some(t=>t.compare(e)))}_filterSingleKind(e,t,r,i){const n=this._allAttributesPrivate||i&&!0===t.anonymous,{cloned:s,excluded:a}=function(e,t){const r=[],i={},n=[];for(r.push(...Object.keys(e).map(t=>({key:t,ptr:[t],source:e,parent:i,visited:[e]})));r.length;){const e=r.pop(),i=t.find(t=>{return r=t,i=e.ptr,r.depth===i.length&&i.every((e,t)=>e===r.getComponent(t));var r,i});if(i)n.push(i.redactionName);else{const t=e.source[e.key];null===t?e.parent[e.key]=t:Array.isArray(t)?e.parent[e.key]=[...t]:"object"==typeof t?e.visited.includes(t)||(e.parent[e.key]={},r.push(...Object.keys(t).map(r=>({key:r,ptr:[...e.ptr,r],source:t,parent:e.parent[e.key],visited:[...e.visited,t]})))):e.parent[e.key]=t}}return{cloned:i,excluded:n.sort()}}(t,this._getAttributesToFilter(e,t,r,n));return e.legacy&&O.forEach(e=>{e in s&&(s[e]=String(s[e]))}),a.length&&(s._meta||(s._meta={}),s._meta.redactedAttributes=a),s._meta&&(delete s._meta.privateAttributes,0===Object.keys(s._meta).length&&delete s._meta),s}}class D{constructor(e,t,r=Math.random){this._retryResetIntervalMillis=t,this._random=r,this._retryCount=0,this._initialRetryDelayMillis=Math.max(1,e),this._maxExponent=Math.ceil(Math.log2(3e4/this._initialRetryDelayMillis))}_backoff(){const e=Math.min(this._retryCount,this._maxExponent),t=this._initialRetryDelayMillis*2**e;return Math.min(t,3e4)}_jitter(e){return e-Math.trunc(.5*this._random()*e)}success(e=Date.now()){this._activeSince=e}fail(e=Date.now()){void 0!==this._activeSince&&e-this._activeSince>this._retryResetIntervalMillis&&(this._retryCount=0),this._activeSince=void 0;const t=this._jitter(this._backoff());return this._retryCount+=1,t}}class P{constructor(e,t){this._dataCallback=e,this._statusCallback=t,this._disabled=!1}disable(){this._disabled=!0}async dataHandler(e,t){this._disabled||this._dataCallback(e,t)}async statusHandler(e,t){this._disabled||this._statusCallback(e,t)}}var R;!function(e){e[e.Valid=0]="Valid",e[e.Initializing=1]="Initializing",e[e.Interrupted=2]="Interrupted",e[e.Closed=3]="Closed"}(R||(R={}));class I{constructor(e,t){this._list=t?[...t]:[],this._circular=e,this._pos=0}next(){if(this._list.length<=0||this._pos>=this._list.length)return;const e=this._list[this._pos];return this._circular?this._pos=(this._pos+1)%this._list.length:this._pos+=1,e}replace(e){this._list=[...e],this._pos=0}remove(e){const t=this._list.indexOf(e);return!(t<0)&&(this._list.splice(t,1),this._list.length>0&&(t<this._pos&&(this._pos-=1),this._circular&&this._pos>this._list.length-1&&(this._pos=0)),!0)}reset(){this._pos=0}pos(){return this._pos}length(){return this._list.length}clear(){this._list=[],this._pos=0}}class T extends Error{constructor(e){super(e),this.name="LaunchDarklyFileDataSourceError"}}class A extends Error{constructor(e,t,r,i=!0){super(t),this.kind=e,this.status=r,this.name="LaunchDarklyPollingError",this.recoverable=i}}class M extends Error{constructor(e,t,r,i=!0){super(t),this.kind=e,this.code=r,this.name="LaunchDarklyStreamingError",this.recoverable=i}}class C extends Error{constructor(e,t,r){super(t),this.kind=e,this.code=r,this.name="LDFlagDeliveryFallbackError",this.recoverable=!1}}var F,L,j,N;e.DataSourceErrorKind=void 0,(F=e.DataSourceErrorKind||(e.DataSourceErrorKind={})).Unknown="UNKNOWN",F.NetworkError="NETWORK_ERROR",F.ErrorResponse="ERROR_RESPONSE",F.InvalidData="INVALID_DATA",e.AutoEnvAttributes=void 0,(L=e.AutoEnvAttributes||(e.AutoEnvAttributes={}))[L.Disabled=0]="Disabled",L[L.Enabled=1]="Enabled",function(e){e[e.AnalyticsEvents=0]="AnalyticsEvents",e[e.DiagnosticEvent=1]="DiagnosticEvent"}(j||(j={})),function(e){e[e.Succeeded=0]="Succeeded",e[e.Failed=1]="Failed",e[e.FailedAndMustShutDown=2]="FailedAndMustShutDown"}(N||(N={}));var $=Object.freeze({__proto__:null,get DataSourceState(){return R},get LDDeliveryStatus(){return N},get LDEventType(){return j}});function B(e){if("string"==typeof e)return e;if(void 0===e)return"undefined";if(null===e)return"null";if(Object.prototype.hasOwnProperty.call(e,"toString"))try{return e.toString()}catch{}if("bigint"==typeof e)return`${e}n`;try{return JSON.stringify(e)}catch(e){return e instanceof TypeError&&e.message.indexOf("circular")>=0?"[Circular]":"[Not Stringifiable]"}}const V={s:e=>B(e),d:e=>function(e){return"symbol"==typeof e?"NaN":"bigint"==typeof e?`${e}n`:String(Number(e))}(e),i:e=>function(e){return"symbol"==typeof e?"NaN":"bigint"==typeof e?`${e}n`:String(parseInt(e,10))}(e),f:e=>function(e){return"symbol"==typeof e?"NaN":String(parseFloat(e))}(e),j:e=>B(e),o:e=>B(e),O:e=>B(e),c:()=>""};function z(...e){const t=e.shift();if(f.String.is(t)){let r="",i=0;for(;i<t.length;){const n=t.charAt(i);if("%"===n){if(i+1<t.length){const n=t.charAt(i+1);if(n in V&&e.length){const t=e.shift();r+=V[n]?.(t)}else r+="%"===n?"%":`%${n}`;i+=2}}else r+=n,i+=1}return e.length&&(r.length&&(r+=" "),r+=e.map(B).join(" ")),r}return e.map(B).join(" ")}var H;!function(e){e[e.debug=0]="debug",e[e.info=1]="info",e[e.warn=2]="warn",e[e.error=3]="error",e[e.none=4]="none"}(H||(H={}));const U=["debug","info","warn","error","none"];class K{static get(){return new K({})}constructor(e){if(this._logLevel=H[e.level??"info"]??H.info,this._name=e.name??"LaunchDarkly",this._formatter=e.formatter,"object"==typeof e.destination)this._destinations={[H.debug]:e.destination.debug,[H.info]:e.destination.info,[H.warn]:e.destination.warn,[H.error]:e.destination.error};else if("function"==typeof e.destination){const{destination:t}=e;this._destinations={[H.debug]:t,[H.info]:t,[H.warn]:t,[H.error]:t}}}_tryFormat(...e){try{return this._formatter?this._formatter?.(...e):z(...e)}catch{return z(...e)}}_tryWrite(e,t){try{e(t)}catch{console.error(t)}}_log(e,t){if(e>=this._logLevel){const r=`${U[e]}: [${this._name}]`;try{const i=this._destinations?.[e];i?this._tryWrite(i,`${r} ${this._tryFormat(...t)}`):console.error(...t)}catch{console.error(...t)}}}error(...e){this._log(H.error,e)}warn(...e){this._log(H.warn,e)}info(...e){this._log(H.info,e)}debug(...e){this._log(H.debug,e)}}const q={error:f.Function,warn:f.Function,info:f.Function,debug:f.Function};class W{constructor(e,t){Object.entries(q).forEach(([t,r])=>{if(!r.is(e[t]))throw new Error(`Provided logger instance must support logger.${t}(...) method`)}),this._logger=e,this._fallback=t}_log(e,t){try{this._logger[e](...t)}catch{this._fallback[e](...t)}}error(...e){this._log("error",e)}warn(...e){this._log("warn",e)}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}}class G{static deprecated(e,t){return`"${e}" is deprecated, please use "${t}"`}static optionBelowMinimum(e,t,r){return`Config option "${e}" had invalid value of ${t}, using minimum of ${r} instead`}static unknownOption(e){return`Ignoring unknown config option "${e}"`}static wrongOptionType(e,t,r){return`Config option "${e}" should be of type ${t}, got ${r}, using default value`}static wrongOptionTypeBoolean(e,t){return`Config option "${e}" should be a boolean, got ${t}, converting to boolean`}static invalidTagValue(e){return`Config option "${e}" must only contain letters, numbers, ., _ or -.`}static tagValueTooLong(e){return`Value of "${e}" was longer than 64 characters and was discarded.`}static partialEndpoint(e){return`You have set custom uris without specifying the ${e} URI; connections may not work properly`}}const X=f.stringMatchingRegex(/^(\w|\.|-)+$/),J=(e,t)=>X.is(e)?e.length>64?{valid:!1,message:G.tagValueTooLong(t)}:{valid:!0}:{valid:!1,message:G.invalidTagValue(t)};function Y(e){return e.replace(/\/+$/,"")}function Z(e){return e.replace(/^\/+/,"").replace(/\?$/,"")}class Q{constructor(e,t,r=Q.DEFAULT_EVENTS,i="/bulk",n="/diagnostic",s=!0,a){this.streaming=Y(e),this.polling=Y(t),this.events=Y(r),this.analyticsEventPath=i,this.diagnosticEventPath=n,this.includeAuthorizationHeader=s,this.payloadFilterKey=a}}function ee(e,t=[]){if(0===t.length)return e;return`${e}?${t.map(({key:e,value:t})=>`${e}=${t}`).join("&")}`}function te(e,t,r=[]){const i=Z(t);return ee(`${e.events}/${i}`,r)}Q.DEFAULT_EVENTS="https://events.launchdarkly.com";class re extends Error{constructor(e){super(e),this.name="LaunchDarklyUnexpectedResponseError"}}class ie extends Error{constructor(e){super(e),this.name="LaunchDarklyClientError"}}class ne extends Error{constructor(e){super(e),this.name="LaunchDarklyTimeoutError"}}function se(e){return!(e>=400&&e<500)||(400===e||408===e||429===e)}function ae(e){return 413===e||se(e)}const oe=(e,t)=>e?Object.entries(e).reduce((e,[r,i])=>(!Boolean(i)||(e=>"{}"===JSON.stringify(e))(i)||t?.includes(r)||(e[r]="object"==typeof i?oe(i,t):i),e),{}):e;function le(e,t,r){let i;i=e.status?`error ${e.status}${401===e.status?" (invalid SDK key)":""}`:`I/O error (${e.message||"unknown error"})`;return`Received ${i} for ${t} - ${r??"giving up permanently"}`}const ce=async(e=1e3)=>new Promise(e=>{});var ue;!function(e){e.MalformedFlag="MALFORMED_FLAG",e.UserNotSpecified="USER_NOT_SPECIFIED",e.FlagNotFound="FLAG_NOT_FOUND",e.ClientNotReady="CLIENT_NOT_READY",e.WrongType="WRONG_TYPE"}(ue||(ue={}));var de=ue;class he{static invalidMetricValue(e){return`The track function was called with a non-numeric "metricValue" (${e}), only numeric metric values are supported.`}}he.MissingContextKeyNoEvent="Context was unspecified or had no key; event will not be sent";class fe{constructor(e,t){const{basicConfiguration:r,platform:i}=e,{serviceEndpoints:{analyticsEventPath:n,diagnosticEventPath:s}}=r,{crypto:a,requests:o}=i;this._defaultHeaders={...t},this._eventsUri=te(r.serviceEndpoints,n,[]),this._diagnosticEventsUri=te(r.serviceEndpoints,s,[]),this._requests=o,this._crypto=a}async _tryPostingEvents(e,t,r,i){const n={status:N.Succeeded},s={...this._defaultHeaders,"content-type":"application/json"};let a;r&&(s["x-launchdarkly-payload-id"]=r,s["x-launchDarkly-event-schema"]="4");try{const{status:r,headers:i}=await this._requests.fetch(t,{headers:s,body:JSON.stringify(e),compressBodyIfPossible:!0,method:"POST",keepalive:!0}),o=Date.parse(i.get("date")||"");if(o&&(n.serverTime=o),r<=204)return n;if(a=new re(le({status:r,message:"some events were dropped"},"event posting")),!se(r))return ae(r)?n.status=N.Failed:n.status=N.FailedAndMustShutDown,n.error=a,n}catch(e){a=e}return a&&!i?(n.status=N.Failed,n.error=a,n):(await ce(),this._tryPostingEvents(e,this._eventsUri,r,!1))}async sendEventData(e,t){const r=e===j.AnalyticsEvents?this._crypto.randomUUID():void 0,i=e===j.AnalyticsEvents?this._eventsUri:this._diagnosticEventsUri;return this._tryPostingEvents(t,i,r,!0)}}function pe(e){return"feature"===e.kind}class ve{constructor(e,t,r,i,n,s){this.count=e,this.key=t,this.value=r,this.version=n,this.variation=s,this.default=i}increment(){this.count+=1}}class ge{constructor(e=!1,t){this._singleContext=e,this._contextFilter=t,this._startDate=0,this._endDate=0,this._counters={},this._contextKinds={}}summarizeEvent(e){if(pe(e)&&!e.excludeFromSummaries){this._context||(this._context=e.context);const t=function(e){return`${e.key}:${null!==e.variation&&void 0!==e.variation?e.variation:""}:${null!==e.version&&void 0!==e.version?e.version:""}`}(e),r=this._counters[t];let i=this._contextKinds[e.key];i||(i=new Set,this._contextKinds[e.key]=i),e.context.kinds.forEach(e=>i.add(e)),r?r.increment():this._counters[t]=new ve(1,e.key,e.value,e.default,e.version,e.variation),(0===this._startDate||e.creationDate<this._startDate)&&(this._startDate=e.creationDate),e.creationDate>this._endDate&&(this._endDate=e.creationDate)}}getSummary(){const e=Object.values(this._counters).reduce((e,t)=>{let r=e[t.key];r||(r={default:t.default,counters:[],contextKinds:[...this._contextKinds[t.key]]},e[t.key]=r);const i={value:t.value,count:t.count};return void 0!==t.variation&&null!==t.variation&&(i.variation=t.variation),void 0!==t.version&&null!==t.version?i.version=t.version:i.unknown=!0,r.counters.push(i),e},{}),t={startDate:this._startDate,endDate:this._endDate,features:e,kind:"summary",context:void 0!==this._context&&this._singleContext?this._contextFilter?.filter(this._context):void 0};return this._clearSummary(),t}_clearSummary(){this._startDate=0,this._endDate=0,this._counters={},this._contextKinds={}}}class _e extends Error{constructor(e){super(e),this.name="LaunchDarklyInvalidSDKKeyError"}}class ye{constructor(e,t){this._contextFilter=e,this._logger=t,this._summarizers={}}summarizeEvent(e){if(pe(e)){const t=e.context.canonicalUnfilteredJson();if(!t)return void(e.context.valid&&this._logger?.error("Unable to serialize context, likely the context contains a cycle."));let r=this._summarizers[t];r||(this._summarizers[t]=new ge(!0,this._contextFilter),r=this._summarizers[t]),r.summarizeEvent(e)}}getSummaries(){const e=this._summarizers;return this._summarizers={},Object.values(e).map(e=>e.getSummary())}}function me(e){const t=Math.trunc(e);return 1===t||0!==t&&0===Math.floor(Math.random()*t)}class be{constructor(e,t,r,i,n=1,s){this.context=e,this.key=t,this.data=r,this.metricValue=i,this.samplingRatio=n,this.url=s,this.kind="custom",this.creationDate=Date.now(),this.context=e}}class Se{constructor(e,t,r,i,n,s,a,o,l,c,u,d,h=1){this.withReasons=e,this.context=t,this.key=r,this.samplingRatio=h,this.kind="feature",this.creationDate=Date.now(),this.value=i,this.default=n,void 0!==s&&(this.version=s),void 0!==a&&(this.variation=a),void 0!==o&&(this.trackEvents=o),void 0!==l&&(this.prereqOf=l),void 0!==c&&(this.reason=c),void 0!==u&&(this.debugEventsUntilDate=u),void 0!==d&&(this.excludeFromSummaries=d)}}class Ee{constructor(e,t=1){this.context=e,this.samplingRatio=t,this.kind="identify",this.creationDate=Date.now()}}const we="FDv1Fallback";class ke{constructor(e,t,r){this._objProcessors=e,this._errorHandler=t,this._logger=r,this._listeners=[],this._tempId=void 0,this._tempBasis=!1,this._tempUpdates=[],this._processServerIntent=e=>{if(this._resetAll(),!e.payloads.length)return;const t=e.payloads[0];switch(t?.intentCode){case"xfer-full":this._tempBasis=!0;break;case"xfer-changes":this._tempBasis=!1;break;case"none":this._tempBasis=!1,this._processIntentNone(t);break;default:return void this._logger?.warn(`Unable to process intent code '${t?.intentCode}'.`)}this._tempId=t?.id},this._processPutObject=e=>{if(!(this._tempId&&e.kind&&e.key&&e.version&&e.object))return;const t=this._processObj(e.kind,e.object);t?this._tempUpdates.push({kind:e.kind,key:e.key,version:e.version,object:t}):this._logger?.warn(`Unable to process object for kind: '${e.kind}'`)},this._processDeleteObject=e=>{this._tempId&&e.kind&&e.key&&e.version&&this._tempUpdates.push({kind:e.kind,key:e.key,version:e.version,deleted:!0})},this._processIntentNone=e=>{if(!e.id||!e.target)return;const t={id:e.id,version:e.target,basis:!1,updates:[]};this._listeners.forEach(e=>e(t)),this._resetAfterEmission()},this._processPayloadTransferred=e=>{if(!this._tempId||null===e.state||void 0===e.state||!e.version)return void this._resetAll();const t={id:this._tempId,version:e.version,state:e.state,basis:this._tempBasis,updates:this._tempUpdates};this._listeners.forEach(e=>e(t)),this._resetAfterEmission()},this._processGoodbye=e=>{this._logger?.info(`Goodbye was received from the LaunchDarkly connection with reason: ${e.reason}.`),this._resetAll()},this._processError=e=>{this._logger?.info(`An issue was encountered receiving updates for payload ${this._tempId} with reason: ${e.reason}.`),this._resetAfterError()}}addPayloadListener(e){this._listeners.push(e)}removePayloadListener(e){const t=this._listeners.indexOf(e,0);t>-1&&this._listeners.splice(t,1)}processEvents(e){e.forEach(e=>{switch(e.event){case"server-intent":this._processServerIntent(e.data);break;case"put-object":this._processPutObject(e.data);break;case"delete-object":this._processDeleteObject(e.data);break;case"payload-transferred":this._processPayloadTransferred(e.data);break;case"goodbye":this._processGoodbye(e.data);break;case"error":this._processError(e.data)}})}_processObj(e,t){return this._objProcessors[e]?.(t)}_resetAfterEmission(){this._tempBasis=!1,this._tempUpdates=[]}_resetAfterError(){this._tempUpdates=[]}_resetAll(){this._tempId=void 0,this._tempBasis=!1,this._tempUpdates=[]}}const Oe="unknown plugin";function xe(e,t){try{return t.getMetadata().name||Oe}catch{return e.error("Exception thrown getting metadata for plugin. Unable to get plugin name."),Oe}}var De=Object.freeze({__proto__:null,ClientMessages:he,DiagnosticsManager:class{constructor(e,t,r){this._platform=t,this._diagnosticInitConfig=r,this._streamInits=[],this._startTime=Date.now(),this._dataSinceDate=this._startTime,this._id={diagnosticId:t.crypto.randomUUID(),sdkKeySuffix:e.length>6?e.substring(e.length-6):e}}createInitEvent(){const e=this._platform.info.sdkData(),t=this._platform.info.platformData();return{kind:"diagnostic-init",id:this._id,creationDate:this._startTime,sdk:e,configuration:this._diagnosticInitConfig,platform:{name:t.name,osArch:t.os?.arch,osName:t.os?.name,osVersion:t.os?.version,...t.additional||{}}}}recordStreamInit(e,t,r){const i={timestamp:e,failed:t,durationMillis:r};this._streamInits.push(i)}createStatsEventAndReset(e,t,r){const i=Date.now(),n={kind:"diagnostic",id:this._id,creationDate:i,dataSinceDate:this._dataSinceDate,droppedEvents:e,deduplicatedUsers:t,eventsInLastBatch:r,streamInits:this._streamInits};return this._streamInits=[],this._dataSinceDate=i,n}},ErrorKinds:de,EventFactoryBase:class{constructor(e){this._withReasons=e}evalEvent(e){return new Se(this._withReasons,e.context,e.flagKey,e.value,e.defaultVal,e.version,e.variation??void 0,e.trackEvents||e.addExperimentData,e.prereqOfFlagKey,this._withReasons||e.addExperimentData?e.reason:void 0,e.debugEventsUntilDate,e.excludeFromSummaries,e.samplingRatio)}unknownFlagEvent(e,t,r){return new Se(this._withReasons,r,e,t,t,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}identifyEvent(e){return new Ee(e,1)}customEvent(e,t,r,i,n=1){return new be(t,e,r??void 0,i??void 0,n)}},EventProcessor:class{constructor(e,t,i,n,s,a=!0,o=!1){this._config=e,this._contextDeduplicator=n,this._diagnosticsManager=s,this._queue=[],this._lastKnownPastTime=0,this._droppedEvents=0,this._deduplicatedUsers=0,this._exceededCapacity=!1,this._eventsInLastBatch=0,this._shutdown=!1,this._flushUsersTimer=null,this._capacity=e.eventsCapacity,this._logger=t.basicConfiguration.logger,this._eventSender=new fe(t,i),this._contextFilter=new x(e.allAttributesPrivate,e.privateAttributes.map(e=>new r(e))),this._summarizer=o?new ye(this._contextFilter,this._logger):new ge,a&&this.start()}start(){if(void 0!==this._contextDeduplicator?.flushInterval&&(this._flushUsersTimer=void this._contextDeduplicator.flushInterval),this._flushTimer=void this._config.flushInterval,this._diagnosticsManager){const e=this._diagnosticsManager.createInitEvent();this._postDiagnosticEvent(e),this._diagnosticsTimer=void this._config.diagnosticRecordingInterval}this._logger?.debug("Started EventProcessor.")}_postDiagnosticEvent(e){this._eventSender.sendEventData(j.DiagnosticEvent,e)}close(){clearInterval(this._flushTimer),this._flushUsersTimer&&clearInterval(this._flushUsersTimer),this._diagnosticsTimer&&clearInterval(this._diagnosticsTimer)}async flush(){if(this._shutdown)throw new _e("Events cannot be posted because a permanent error has been encountered. This is most likely an invalid SDK key. The specific error information is logged independently.");const e=this._queue;if(this._queue=[],void 0!==this._summarizer.getSummaries){this._summarizer.getSummaries().forEach(t=>{Object.keys(t.features).length&&e.push(t)})}else{const t=this._summarizer.getSummary();Object.keys(t.features).length&&e.push(t)}e.length&&(this._eventsInLastBatch=e.length,this._logger?.debug("Flushing %d events",e.length),await this._tryPostingEvents(e))}sendEvent(e){if(this._shutdown)return;if("migration_op"===e.kind){if(me(e.samplingRatio)){const t={...e,context:e.context?this._contextFilter.filter(e.context):void 0};1===t.samplingRatio&&delete t.samplingRatio,this._enqueue(t)}return}this._summarizer.summarizeEvent(e);const t=pe(e),r=t&&e.trackEvents||!t,i=this._shouldDebugEvent(e),n=function(e){return"identify"===e.kind}(e),s=this._contextDeduplicator?.processContext(e.context);s||n||(this._deduplicatedUsers+=1);s&&!n&&this._enqueue(this._makeOutputEvent({kind:"index",creationDate:e.creationDate,context:e.context,samplingRatio:1},!1)),r&&me(e.samplingRatio)&&this._enqueue(this._makeOutputEvent(e,!1)),i&&me(e.samplingRatio)&&this._enqueue(this._makeOutputEvent(e,!0))}_makeOutputEvent(e,t){switch(e.kind){case"feature":{const r={kind:t?"debug":"feature",creationDate:e.creationDate,context:this._contextFilter.filter(e.context,!t),key:e.key,value:e.value,default:e.default};return 1!==e.samplingRatio&&(r.samplingRatio=e.samplingRatio),e.prereqOf&&(r.prereqOf=e.prereqOf),void 0!==e.variation&&(r.variation=e.variation),void 0!==e.version&&(r.version=e.version),e.reason&&(r.reason=e.reason),r}case"index":case"identify":{const t={kind:e.kind,creationDate:e.creationDate,context:this._contextFilter.filter(e.context)};return 1!==e.samplingRatio&&(t.samplingRatio=e.samplingRatio),t}case"custom":{const t={kind:"custom",creationDate:e.creationDate,key:e.key,context:this._contextFilter.filter(e.context)};return 1!==e.samplingRatio&&(t.samplingRatio=e.samplingRatio),void 0!==e.data&&(t.data=e.data),void 0!==e.metricValue&&(t.metricValue=e.metricValue),void 0!==e.url&&(t.url=e.url),t}case"click":return{kind:"click",creationDate:e.creationDate,contextKeys:e.context.kindsAndKeys,key:e.key,url:e.url,selector:e.selector};case"pageview":return{kind:"pageview",creationDate:e.creationDate,contextKeys:e.context.kindsAndKeys,key:e.key,url:e.url};default:return e}}_enqueue(e){this._queue.length<this._capacity?(this._queue.push(e),this._exceededCapacity=!1):(this._exceededCapacity||(this._exceededCapacity=!0,this._logger?.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),this._droppedEvents+=1)}_shouldDebugEvent(e){return pe(e)&&e.debugEventsUntilDate&&e.debugEventsUntilDate>this._lastKnownPastTime&&e.debugEventsUntilDate>Date.now()}async _tryPostingEvents(e){const t=await this._eventSender.sendEventData(j.AnalyticsEvents,e);if(t.status===N.FailedAndMustShutDown&&(this._shutdown=!0),t.serverTime&&(this._lastKnownPastTime=t.serverTime),t.error)throw t.error}},FDv1PayloadAdaptor:function(e){return{_processor:e,_selector:"",useSelector(e){return this._selector=e,this},processFullTransfer(e){const t=[{event:"server-intent",data:{payloads:[{id:we,target:1,intentCode:"xfer-full",reason:"payload-missing"}]}}];Object.entries(e?.flags||[]).forEach(([e,r])=>{t.push({event:"put-object",data:{kind:"flag",key:e,version:r.version||1,object:r}})}),Object.entries(e?.segments||[]).forEach(([e,r])=>{t.push({event:"put-object",data:{kind:"segment",key:e,version:r.version||1,object:r}})}),t.push({event:"payload-transferred",data:{state:this._selector,version:1,id:we}}),this._processor.processEvents(t)}}},InputCustomEvent:be,InputEvalEvent:Se,InputIdentifyEvent:Ee,NullEventProcessor:class{close(){}async flush(){}sendEvent(){}},PayloadProcessor:ke,PayloadStreamReader:class{constructor(e,t,r,i){this._errorHandler=r,this._logger=i,this._attachHandler(e,"server-intent"),this._attachHandler(e,"put-object"),this._attachHandler(e,"delete-object"),this._attachHandler(e,"payload-transferred"),this._attachHandler(e,"goodbye"),this._attachHandler(e,"error"),this._payloadProcessor=new ke(t,r,i)}addPayloadListener(e){this._payloadProcessor.addPayloadListener(e)}removePayloadListener(e){this._payloadProcessor.removePayloadListener(e)}_attachHandler(t,r){t.addEventListener(r,async t=>{if(t?.data){this._logger?.debug(`Received ${r} event. Data is ${t.data}`);try{this._payloadProcessor.processEvents([{event:r,data:JSON.parse(t.data)}])}catch{this._logger?.error(`Stream received data that was unable to be processed in "${r}" message`),this._logger?.debug(`Data follows: ${t.data}`),this._errorHandler?.(e.DataSourceErrorKind.InvalidData,"Malformed data in EventStream.")}}else this._errorHandler?.(e.DataSourceErrorKind.Unknown,"Event from EventStream missing data.")})}},canonicalize:_,initMetadataFromHeaders:function(e){if(e){const t=Object.keys(e).find(e=>"x-ld-envid"===e.toLowerCase());if(t)return{environmentId:e[t]}}},isLegacyUser:g,isMultiKind:v,isSingleKind:p,safeGetHooks:function(e,t,r){const i=[];return r.forEach(r=>{try{const n=r.getHooks?.(t);void 0===n?e.error(`Plugin ${xe(e,r)} returned undefined from getHooks.`):n&&n.length>0&&i.push(...n)}catch(t){e.error(`Exception thrown getting hooks for plugin ${xe(e,r)}. Unable to get hooks.`)}}),i},safeGetName:xe,safeRegisterPlugins:function(e,t,r,i){i.forEach(i=>{try{i.register(r,t)}catch(t){e.error(`Exception thrown registering plugin ${xe(e,i)}.`)}})},shouldSample:me});e.ApplicationTags=class{constructor(e){const t={},r=e?.application,i=e?.logger;r&&Object.entries(r).forEach(([e,r])=>{if(null!=r){const{valid:n,message:s}=J(r,`application.${e}`);n?"versionName"===e?t["application-version-name"]=[r]:t[`application-${e}`]=[r]:i?.warn(s)}});const n=Object.keys(t);n.length&&(this.value=n.sort().flatMap(e=>t[e].sort().map(t=>`${e}/${t}`)).join(" "))}},e.AttributeReference=r,e.BasicLogger=K,e.ClientContext=class{constructor(e,t,r){this.platform=r,this.basicConfiguration={tags:t.tags,logger:t.logger,offline:t.offline,serviceEndpoints:t.serviceEndpoints,sdkKey:e}}},e.CompositeDataSource=class{constructor(e,t,r,i,n={[R.Valid]:{durationMS:3e5,transition:"recover"},[R.Interrupted]:{durationMS:12e4,transition:"fallback"}},s=new D(1e3,3e4)){this._logger=i,this._transitionConditions=n,this._backoff=s,this._stopped=!0,this._cancelTokens=[],this._cancellableDelay=e=>{let t;return{promise:new Promise((e,r)=>{t=e=>{e()}}),cancel(){t&&(clearTimeout(t),t=void 0)}}},this._externalTransitionPromise=new Promise(e=>{this._externalTransitionResolve=e}),this._initPhaseActive=e.length>0,this._initFactories=new I(!1,e),this._syncFactories=new I(!0,t),this._fdv1Synchronizers=new I(!0,r)}async start(e,t,r){if(!this._stopped)return void this._logger?.info("CompositeDataSource already running. Ignoring call to start.");this._stopped=!1,this._logger?.debug(`CompositeDataSource starting with (${this._initFactories.length()} initializers, ${this._syncFactories.length()} synchronizers).`);const i=this._wrapStatusCallbackWithSanitizer(t);let n;for(i(R.Initializing);;){const{dataSource:s,isPrimary:a,cullDSFactory:o}=this._pickDataSource(n),l=new Promise(t=>{if(s){let n,l=()=>{};const c=new P((r,n)=>{this._backoff.success(),e(r,n),r&&this._initPhaseActive&&(c.disable(),this._consumeCancelToken(l),i(R.Interrupted),t({transition:"switchToSync"}))},(e,r)=>{if(this._logger?.debug(`CompositeDataSource received state ${e} from underlying data source. Err is ${r}`),r||e===R.Closed)c.disable(),!1===r?.recoverable&&(this._logger?.debug(`Culling data source due to err ${r}`),o?.(),r instanceof C&&(this._logger?.debug("Falling back to FDv1"),this._syncFactories=this._fdv1Synchronizers)),i(e,r),this._consumeCancelToken(l),t({transition:"fallback",err:r});else if(i(e),e!==n){n=e,this._consumeCancelToken(l);const r=this._lookupTransitionCondition(e,a);if(r){const{promise:e,cancel:n}=this._cancellableDelay(r.durationMS);l=n,this._cancelTokens.push(l),e.then(()=>{this._consumeCancelToken(n),c.disable(),i(R.Interrupted),t({transition:r.transition})})}}});s.start((e,t)=>c.dataHandler(e,t),(e,t)=>c.statusHandler(e,t),r)}else t({transition:"stop",err:{name:"ExhaustedDataSources",message:"CompositeDataSource has exhausted all configured initializers and synchronizers."}})});let c=await Promise.race([l,this._externalTransitionPromise]);if(s?.stop(),c.err&&"stop"!==c.transition){const e=this._initPhaseActive?0:this._backoff.fail(),{promise:t,cancel:r}=this._cancellableDelay(e);this._cancelTokens.push(r);const i=t.then(()=>(this._consumeCancelToken(r),c));c=await Promise.race([i,this._externalTransitionPromise]),this._consumeCancelToken(r)}if(n=c.transition,"stop"===c.transition){t(R.Closed,c.err);break}}this._reset()}async stop(){this._cancelTokens.forEach(e=>e()),this._cancelTokens=[],this._externalTransitionResolve?.({transition:"stop"})}_reset(){this._stopped=!0,this._initPhaseActive=this._initFactories.length()>0,this._initFactories.reset(),this._syncFactories.reset(),this._fdv1Synchronizers.reset(),this._externalTransitionPromise=new Promise(e=>{this._externalTransitionResolve=e})}_pickDataSource(e){let t,r;switch(e){case"switchToSync":this._initPhaseActive=!1,this._syncFactories.reset(),r=0===this._syncFactories.pos(),t=this._syncFactories.next();break;case"recover":this._initPhaseActive?(this._initFactories.reset(),r=0===this._initFactories.pos(),t=this._initFactories.next()):(this._syncFactories.reset(),r=0===this._syncFactories.pos(),t=this._syncFactories.next());break;default:this._initPhaseActive&&this._initFactories.pos()>=this._initFactories.length()&&(this._initPhaseActive=!1,this._syncFactories.reset()),this._initPhaseActive?(r=0===this._initFactories.pos(),t=this._initFactories.next()):(r=0===this._syncFactories.pos(),t=this._syncFactories.next())}return t?{dataSource:t(),isPrimary:r,cullDSFactory:()=>{t&&this._syncFactories.remove(t)}}:{dataSource:void 0,isPrimary:r,cullDSFactory:void 0}}_lookupTransitionCondition(e,t){const r=this._transitionConditions[e];if(!t||"recover"!==r?.transition)return r}_consumeCancelToken(e){e();const t=this._cancelTokens.indexOf(e,0);t>-1&&this._cancelTokens.splice(t,1)}_wrapStatusCallbackWithSanitizer(e){let t,r,i=!1;return(n,s)=>{let a=n;if(n===R.Closed&&(a=R.Interrupted),a!==t||s!==r){if(a===R.Initializing){if(i)return;i=!0}t=a,r=s,e(a,s)}}}},e.Context=w,e.ContextFilter=x,e.DateValidator=d,e.DefaultBackoff=D,e.FactoryOrInstance=i,e.Function=l,e.KindValidator=h,e.LDClientError=ie,e.LDFileDataSourceError=T,e.LDFlagDeliveryFallbackError=C,e.LDPollingError=A,e.LDStreamingError=M,e.LDTimeoutError=ne,e.LDUnexpectedResponseError=re,e.NullableBoolean=c,e.NumberWithMinimum=a,e.OptionMessages=G,e.SafeLogger=W,e.ServiceEndpoints=Q,e.StringMatchingRegex=o,e.Type=n,e.TypeArray=s,e.TypeValidators=f,e.base64UrlEncode=(e,t)=>t.btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),e.cancelableTimedPromise=function(e,t){let r,i;return{promise:new Promise((e,t)=>{i=e,r=e=>{e()}}),cancel:()=>{i(),clearTimeout(r)}}},e.clone=function(e){return null==e?e:JSON.parse(JSON.stringify(e))},e.createSafeLogger=e=>{const t=new K({level:"info",destination:console.error,formatter:z});return e?new W(e,t):t},e.debounce=(e,t=5e3)=>{let r;return(...e)=>{clearTimeout(r),r=e=>{e()}}},e.deepCompact=oe,e.defaultHeaders=function(e,t,r,i=!0,n="user-agent"){const{userAgentBase:s,version:a,wrapperName:o,wrapperVersion:l}=t.sdkData(),c={[n]:`${s??"NodeJSClient"}/${a}`};return i&&(c.authorization=e),o&&(c["x-launchdarkly-wrapper"]=l?`${o}/${l}`:o),r?.value&&(c["x-launchdarkly-tags"]=r.value),c},e.fastDeepEqual=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var i,n,s;if(Array.isArray(t)){if((i=t.length)!=r.length)return!1;for(n=i;0!==n--;)if(!e(t[n],r[n]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;for(n of t.entries())if(!e(n[1],r.get(n[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((i=t.length)!=r.length)return!1;for(n=i;0!==n--;)if(t[n]!==r[n])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((i=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=i;0!==n--;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=i;0!==n--;){var a=s[n];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r},e.getEventsUri=te,e.getPollingUri=function(e,t,r=[]){const i=Z(t),n=[...r];return e.payloadFilterKey&&n.push({key:"filter",value:e.payloadFilterKey}),ee(`${e.polling}/${i}`,n)},e.getStreamingUri=function(e,t,r){const i=Z(t),n=[...r];return e.payloadFilterKey&&n.push({key:"filter",value:e.payloadFilterKey}),ee(`${e.streaming}/${i}`,n)},e.httpErrorMessage=le,e.internal=De,e.isHttpLocallyRecoverable=ae,e.isHttpRecoverable=se,e.noop=()=>{},e.secondsToMillis=function(e){return Math.trunc(1e3*e)},e.shouldRetry=function({status:e}){return!e||se(e)},e.sleep=ce,e.subsystem=$,e.timedPromise=(e,t)=>new Promise((e,t)=>{})}(o);var l={},c={},u={};Object.defineProperty(u,"__esModule",{value:!0});var d={};Object.defineProperty(d,"__esModule",{value:!0});var h,f={};Object.defineProperty(f,"__esModule",{value:!0}),f.IsMigrationStage=f.LDMigrationStage=void 0,function(e){e.Off="off",e.DualWrite="dualwrite",e.Shadow="shadow",e.Live="live",e.RampDown="rampdown",e.Complete="complete"}(h||(f.LDMigrationStage=h={})),f.IsMigrationStage=function(e){return Object.values(h).includes(e)};var p={};Object.defineProperty(p,"__esModule",{value:!0});var v,g,_,y,m={};Object.defineProperty(m,"__esModule",{value:!0}),m.LDConsistencyCheck=void 0,function(e){e[e.Inconsistent=0]="Inconsistent",e[e.Consistent=1]="Consistent",e[e.NotChecked=2]="NotChecked"}(v||(m.LDConsistencyCheck=v={})),g=c,_=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),y=t&&t.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||_(t,e,r)},Object.defineProperty(g,"__esModule",{value:!0}),y(u,g),y(d,g),y(f,g),y(p,g),y(m,g);var b={},S={};Object.defineProperty(S,"__esModule",{value:!0});var E={};Object.defineProperty(E,"__esModule",{value:!0});var w={};Object.defineProperty(w,"__esModule",{value:!0});var k={};Object.defineProperty(k,"__esModule",{value:!0});var O,x,D={};Object.defineProperty(D,"__esModule",{value:!0}),D.LDConcurrentExecution=D.LDSerialExecution=D.LDExecution=D.LDExecutionOrdering=void 0,function(e){e[e.Fixed=0]="Fixed",e[e.Random=1]="Random"}(O||(D.LDExecutionOrdering=O={})),function(e){e[e.Serial=0]="Serial",e[e.Concurrent=1]="Concurrent"}(x||(D.LDExecution=x={}));D.LDSerialExecution=class{constructor(e){this.ordering=e,this.type=x.Serial}};D.LDConcurrentExecution=class{constructor(){this.type=x.Concurrent}};var P={};Object.defineProperty(P,"__esModule",{value:!0}),P.isCustomOptions=P.isPollingOnlyOptions=P.isStreamingOnlyOptions=P.isStandardOptions=void 0,P.isStandardOptions=function(e){return"standard"===e.dataSourceOptionsType},P.isStreamingOnlyOptions=function(e){return"streamingOnly"===e.dataSourceOptionsType},P.isPollingOnlyOptions=function(e){return"pollingOnly"===e.dataSourceOptionsType},P.isCustomOptions=function(e){return"custom"===e.dataSourceOptionsType},function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(S,e),i(E,e),i(w,e),i(k,e),i(D,e),i(P,e)}(b);var R={};Object.defineProperty(R,"__esModule",{value:!0});var I={};Object.defineProperty(I,"__esModule",{value:!0});var T={};Object.defineProperty(T,"__esModule",{value:!0});var A={};Object.defineProperty(A,"__esModule",{value:!0});var M={};Object.defineProperty(M,"__esModule",{value:!0});var C={};Object.defineProperty(C,"__esModule",{value:!0});var F={},L={};Object.defineProperty(L,"__esModule",{value:!0});var j={};Object.defineProperty(j,"__esModule",{value:!0}),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(L,e),i(j,e)}(F);var N={},$={};Object.defineProperty($,"__esModule",{value:!0});var B={};Object.defineProperty(B,"__esModule",{value:!0});var V={};Object.defineProperty(V,"__esModule",{value:!0});var z={};Object.defineProperty(z,"__esModule",{value:!0});var H={};Object.defineProperty(H,"__esModule",{value:!0});var U={};Object.defineProperty(U,"__esModule",{value:!0});var K={};Object.defineProperty(K,"__esModule",{value:!0});var q={};Object.defineProperty(q,"__esModule",{value:!0});var W={};Object.defineProperty(W,"__esModule",{value:!0});var G={};Object.defineProperty(G,"__esModule",{value:!0}),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i($,e),i(B,e),i(V,e),i(z,e),i(H,e),i(T,e),i(U,e),i(K,e),i(q,e),i(W,e),i(G,e)}(N);var X={},J={};Object.defineProperty(J,"__esModule",{value:!0});var Y={};Object.defineProperty(Y,"__esModule",{value:!0});var Z={};Object.defineProperty(Z,"__esModule",{value:!0}),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(J,e),i(Y,e),i(A,e),i(Z,e),i(M,e)}(X),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.subsystems=e.interfaces=e.integrations=void 0,i(c,e),i(b,e),i(R,e),i(I,e),i(T,e),i(A,e),i(M,e),i(C,e),e.integrations=F,e.interfaces=N,e.subsystems=X}(l);var Q={},ee={};Object.defineProperty(ee,"__esModule",{value:!0});ee.default=class{constructor(e){this._keyMap=new Map,this._head=0,this._tail=0,this._size=0;const{max:t}=e;this._max=t,this._values=new Array(t),this._keys=new Array(t),this._next=new Uint32Array(t),this._prev=new Uint32Array(t),e.maxAge?(this._lastUpdated=new Array(t).fill(0),this._maxAge=e.maxAge):(this._lastUpdated=[],this._maxAge=0)}set(e,t){let r=this._keyMap.get(e);void 0===r?(r=this._index(),this._keys[r]=e,this._keyMap.set(e,r),this._next[this._tail]=r,this._prev[r]=this._tail,this._tail=r,this._size+=1):this._setTail(r),this._values[r]=t,this._maxAge&&(this._lastUpdated[r]=Date.now())}get(e){const t=this._keyMap.get(e);if(void 0!==t){if(this._maxAge){const e=this._lastUpdated[t];if(Date.now()-e>this._maxAge)return}return this._setTail(t),this._maxAge&&(this._lastUpdated[t]=Date.now()),this._values[t]}}clear(){this._head=0,this._tail=0,this._size=0,this._values.fill(void 0),this._keys.fill(void 0),this._next.fill(0),this._prev.fill(0),this._keyMap.clear()}_index(){return 0===this._size?this._tail:this._size===this._max?this._evict():this._size}_evict(){const{_head:e}=this,t=this._keys[e];return this._head=this._next[e],this._keyMap.delete(t),this._size-=1,e}_link(e,t){this._prev[t]=e,this._next[e]=t}_setTail(e){e!==this._tail&&(e===this._head?this._head=this._next[e]:this._link(this._prev[e],this._next[e]),this._link(this._tail,e),this._tail=e)}},Object.defineProperty(Q,"__esModule",{value:!0});const te=o,re=s,ie=ee;Q.default=class{constructor(e,t,r,i){this._store=e,this._logger=r,this._crypto=i,this.statusProvider=new re.default(async()=>this._pollStoreAndUpdateStatus()),this._staleTimeMs=1e3*(te.TypeValidators.Number.is(t.staleAfter)&&t.staleAfter>0?t.staleAfter:120);te.TypeValidators.Number.is(t.statusPollInterval)&&t.statusPollInterval>0&&t.statusPollInterval;this._pollHandle=e?void 0:null,e&&(this._cache=new ie.default({max:t.userCacheSize||1e3,maxAge:1e3*(t.userCacheTime||5)}))}close(){this._pollHandle&&(clearInterval(this._pollHandle),this._pollHandle=void 0),this._store&&this._store.close()}async getUserMembership(e){var t,r,i;if(!this._store)return;const n=null===(t=this._cache)||void 0===t?void 0:t.get(e);let s;if(n)s=n.membership;else try{s=await this._store.getUserMembership(this._hashForUserKey(e));const t={membership:s};null===(r=this._cache)||void 0===r||r.set(e,t)}catch(e){return null===(i=this._logger)||void 0===i||i.error(`Big Segment store membership query returned error: ${e}`),[null,"STORE_ERROR"]}this.statusProvider.getStatus()||await this._pollStoreAndUpdateStatus();const a=this.statusProvider.getStatus();return a.available?[s||null,a.stale?"STALE":"HEALTHY"]:[s||null,"STORE_ERROR"]}async _pollStoreAndUpdateStatus(){var e,t,r;if(!this._store)return void this.statusProvider.setStatus({available:!1,stale:!1});let i;null===(e=this._logger)||void 0===e||e.debug("Querying Big Segment store status");try{const e=await this._store.getMetadata();i={available:!0,stale:!e||!e.lastUpToDate||this._isStale(e.lastUpToDate)}}catch(e){null===(t=this._logger)||void 0===t||t.error(`Big Segment store status query returned error: ${e}`),i={available:!1,stale:!1}}const n=this.statusProvider.getStatus();n&&n.available===i.available&&n.stale===i.stale||(null===(r=this._logger)||void 0===r||r.debug("Big Segment store status changed from %s to %s",JSON.stringify(n),JSON.stringify(i)),this.statusProvider.setStatus(i),this.statusProvider.notify())}_hashForUserKey(e){const t=this._crypto.createHash("sha256");if(t.update(e),!t.digest)throw new Error("Platform must implement digest or asyncDigest");return t.digest("base64")}_isStale(e){return Date.now()-e>=this._staleTimeMs}};var ne={};Object.defineProperty(ne,"__esModule",{value:!0}),ne.createPluginEnvironmentMetadata=void 0,ne.createPluginEnvironmentMetadata=function(e,t,r){const i={sdk:{name:e.info.sdkData().userAgentBase,version:e.info.sdkData().version},sdkKey:t};return e.info.sdkData().wrapperName&&(i.sdk.wrapperName=e.info.sdkData().wrapperName),e.info.sdkData().wrapperVersion&&(i.sdk.wrapperVersion=e.info.sdkData().wrapperVersion),r.applicationInfo&&(i.application=r.applicationInfo),i};var se={};Object.defineProperty(se,"__esModule",{value:!0}),se.createPayloadListener=void 0;se.createPayloadListener=(e,t,r=()=>{})=>i=>{const{initMetadata:n,payload:s}=i;if(s.basis)null==t||t.debug("Initializing all data");else{if(!(s.updates.length>0))return void(null==t||t.debug("Payload had no updates, ignoring."));null==t||t.debug("Applying updates")}const a={};s.updates.forEach(e=>{const r=(e=>{switch(e){case"flag":return"features";case"segment":return"segments";default:return e}})(e.kind);a[r]?a[r][e.key]=Object.assign(Object.assign({version:e.version},e.deleted&&{deleted:e.deleted}),e.object):a[r]={[e.key]:Object.assign(Object.assign({version:e.version},e.deleted&&{deleted:e.deleted}),e.object)},e.deleted?null==t||t.debug(`Deleting ${e.key} in ${e.kind}`):null==t||t.debug(`Updating ${e.key} in ${e.kind}`)}),e.applyChanges(s.basis,a,r,n,s.state)};var ae={},oe={},le={};Object.defineProperty(le,"__esModule",{value:!0});class ce{static getKeyFromPath(e,t){return t.startsWith(e.streamApiPath)?t.substring(e.streamApiPath.length):void 0}}ce.Features={namespace:"features",streamApiPath:"/flags/"},ce.Segments={namespace:"segments",streamApiPath:"/segments/"},le.default=ce,Object.defineProperty(oe,"__esModule",{value:!0}),oe.deserializeSegment=oe.serializeSegment=oe.deserializeFlag=oe.serializeFlag=oe.deserializeDelete=oe.deserializePatch=oe.deserializePoll=oe.deserializeAll=oe.reviveFullPayload=oe.processSegment=oe.processFlag=oe.replacer=oe.nullReplacer=void 0;const ue=o,de=le,he=100;function fe(e,t){const r=[];if(null==e)return;const i=Object.entries(e).filter(([e,r])=>!(null==t?void 0:t.includes(e)));for(r.push(...i.map(([t,r])=>({key:t,value:r,parent:e})));r.length;){const e=r.pop();null!==e.value||Array.isArray(e.parent)?"object"==typeof e.value&&null!==e.value&&r.push(...Object.entries(e.value).map(([t,r])=>({key:t,value:r,parent:e.value}))):delete e.parent[e.key]}}function pe(e,t){if(!(t instanceof ue.AttributeReference||Array.isArray(t)&&t[0]&&t[0]instanceof ue.AttributeReference))return null==t||(t.generated_includedSet&&(t.included=[...t.generated_includedSet],delete t.generated_includedSet),t.generated_excludedSet&&(t.excluded=[...t.generated_excludedSet],delete t.generated_excludedSet),t.includedContexts&&t.includedContexts.forEach(e=>{e.generated_valuesSet&&(e.values=[...e.generated_valuesSet]),delete e.generated_valuesSet}),t.excludedContexts&&t.excludedContexts.forEach(e=>{e.generated_valuesSet&&(e.values=[...e.generated_valuesSet]),delete e.generated_valuesSet})),t}function ve(e){e&&e.bucketBy&&(e.bucketByAttributeReference=new ue.AttributeReference(e.bucketBy,!e.contextKind))}function ge(e){var t;if(fe(e,["variations"]),e.fallthrough&&e.fallthrough.rollout){ve(e.fallthrough.rollout)}null===(t=null==e?void 0:e.rules)||void 0===t||t.forEach(e=>{var t;ve(e.rollout),null===(t=null==e?void 0:e.clauses)||void 0===t||t.forEach(e=>{e&&e.attribute?e.attributeReference=new ue.AttributeReference(e.attribute,!e.contextKind):e&&(e.attributeReference=ue.AttributeReference.InvalidReference)})})}function _e(e){var t,r,i,n,s;fe(e),(null===(t=null==e?void 0:e.included)||void 0===t?void 0:t.length)&&e.included.length>he&&(e.generated_includedSet=new Set(e.included),delete e.included),(null===(r=null==e?void 0:e.excluded)||void 0===r?void 0:r.length)&&e.excluded.length>he&&(e.generated_excludedSet=new Set(e.excluded),delete e.excluded),(null===(i=null==e?void 0:e.includedContexts)||void 0===i?void 0:i.length)&&e.includedContexts.forEach(e=>{var t;(null===(t=null==e?void 0:e.values)||void 0===t?void 0:t.length)&&e.values.length>he&&(e.generated_valuesSet=new Set(e.values),e.values=[])}),(null===(n=null==e?void 0:e.excludedContexts)||void 0===n?void 0:n.length)&&e.excludedContexts.forEach(e=>{var t;(null===(t=null==e?void 0:e.values)||void 0===t?void 0:t.length)&&e.values.length>he&&(e.generated_valuesSet=new Set(e.values),e.values=[])}),null===(s=null==e?void 0:e.rules)||void 0===s||s.forEach(e=>{var t;e.bucketBy&&(e.bucketByAttributeReference=new ue.AttributeReference(e.bucketBy,!e.rolloutContextKind)),null===(t=null==e?void 0:e.clauses)||void 0===t||t.forEach(e=>{e&&e.attribute?e.attributeReference=new ue.AttributeReference(e.attribute,!e.contextKind):e&&(e.attributeReference=ue.AttributeReference.InvalidReference)})})}function ye(e){try{return JSON.parse(e)}catch(e){return}}function me(e){const t=e;return Object.values((null==t?void 0:t.flags)||[]).forEach(e=>{ge(e)}),Object.values((null==t?void 0:t.segments)||[]).forEach(e=>{_e(e)}),t}oe.nullReplacer=fe,oe.replacer=pe,oe.processFlag=ge,oe.processSegment=_e,oe.reviveFullPayload=me,oe.deserializeAll=function(e){const t=ye(e);if(t)return me(null==t?void 0:t.data),t},oe.deserializePoll=function(e){const t=ye(e);if(t)return me(t),t},oe.deserializePatch=function(e){const t=ye(e);if(t)return t.path.startsWith(de.default.Features.streamApiPath)?(ge(t.data),t.kind=de.default.Features):t.path.startsWith(de.default.Segments.streamApiPath)&&(_e(t.data),t.kind=de.default.Segments),t},oe.deserializeDelete=function(e){const t=ye(e);if(t)return t.path.startsWith(de.default.Features.streamApiPath)?t.kind=de.default.Features:t.path.startsWith(de.default.Segments.streamApiPath)&&(t.kind=de.default.Segments),t},oe.serializeFlag=function(e){return JSON.stringify(e,pe)},oe.deserializeFlag=function(e){const t=ye(e);if(t)return ge(t),t},oe.serializeSegment=function(e){return JSON.stringify(e,pe)},oe.deserializeSegment=function(e){const t=ye(e);if(t)return _e(t),t},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createStreamListeners=e.createDeleteListener=e.createPatchListener=e.createPutListener=void 0;const t=o,r=oe,i=le,{initMetadataFromHeaders:n}=t.internal;e.createPutListener=(e,t,s=()=>{})=>({deserializeData:r.deserializeAll,processJson:async({data:{flags:r,segments:a}},o)=>{const l={[i.default.Features.namespace]:r,[i.default.Segments.namespace]:a};null==t||t.debug("Initializing all data"),e.init(l,s,n(o))}});e.createPatchListener=(e,t,n=()=>{})=>({deserializeData:r.deserializePatch,processJson:async({data:r,kind:s,path:a})=>{if(s){const o=i.default.getKeyFromPath(s,a);o&&(null==t||t.debug(`Updating ${o} in ${s.namespace}`),e.upsert(s,r,n))}}});e.createDeleteListener=(e,t,n=()=>{})=>({deserializeData:r.deserializeDelete,processJson:async({kind:r,path:s,version:a})=>{if(r){const o=i.default.getKeyFromPath(r,s);o&&(null==t||t.debug(`Deleting ${o} in ${r.namespace}`),e.upsert(r,{key:o,version:a,deleted:!0},n))}}});e.createStreamListeners=(t,r,i)=>{const n=new Map;return n.set("put",(0,e.createPutListener)(t,r,null==i?void 0:i.put)),n.set("patch",(0,e.createPatchListener)(t,r,null==i?void 0:i.patch)),n.set("delete",(0,e.createDeleteListener)(t,r,null==i?void 0:i.delete)),n}}(ae);var be={},Se={},Ee={};Object.defineProperty(Ee,"__esModule",{value:!0});Ee.default=class{constructor(){this._itemsByNamespace={}}get(e,t){var r;return null===(r=this._itemsByNamespace[e])||void 0===r?void 0:r[t]}set(e,t,r){e in this._itemsByNamespace||(this._itemsByNamespace[e]={}),this._itemsByNamespace[e][t]=r}remove(e,t){const r=this._itemsByNamespace[e];r&&delete r[t]}removeAll(){this._itemsByNamespace={}}enumerate(e){Object.entries(this._itemsByNamespace).forEach(([t,r])=>{Object.entries(r).forEach(([r,i])=>{e(t,r,i)})})}mergeFrom(e){e.enumerate(this.set.bind(this))}},Object.defineProperty(Se,"__esModule",{value:!0});const we=Ee;Se.default=class{constructor(){this._dependenciesFrom=new we.default,this._dependenciesTo=new we.default}updateDependenciesFrom(e,t,r){const i=this._dependenciesFrom.get(e,t);null==i||i.enumerate((r,i)=>{const n=this._dependenciesTo.get(r,i);null==n||n.remove(e,t)}),this._dependenciesFrom.set(e,t,r),null==r||r.enumerate((r,i)=>{let n=this._dependenciesTo.get(r,i);n||(n=new we.default,this._dependenciesTo.set(r,i,n)),n.set(e,t,!0)})}updateModifiedItems(e,t,r){if(!e.get(t,r)){e.set(t,r,!0);const i=this._dependenciesTo.get(t,r);null==i||i.enumerate((t,r)=>{this.updateModifiedItems(e,t,r)})}}reset(){this._dependenciesFrom.removeAll(),this._dependenciesTo.removeAll()}},Object.defineProperty(be,"__esModule",{value:!0}),be.computeDependencies=void 0;const ke=le,Oe=Se,xe=Ee;function De(e,t){var r,i;const n=new xe.default,s=e===ke.default.Features.namespace,a=e===ke.default.Segments.namespace;if(s){const i=t;null===(r=null==i?void 0:i.prerequisites)||void 0===r||r.forEach(t=>{n.set(e,t.key,!0)})}if(s||a){const e=t;null===(i=null==e?void 0:e.rules)||void 0===i||i.forEach(e=>{var t;null===(t=e.clauses)||void 0===t||t.forEach(e=>{"segmentMatch"===e.op&&e.values.forEach(e=>{n.set(ke.default.Segments.namespace,e,!0)})})})}return n}be.computeDependencies=De;be.default=class{constructor(e,t,r){this._featureStore=e,this._hasEventListeners=t,this._onChange=r,this._dependencyTracker=new Oe.default}init(e,t,r){const i=this._hasEventListeners(),n=n=>{this._featureStore.init(e,()=>{Promise.resolve().then(()=>{if(this._dependencyTracker.reset(),Object.entries(e).forEach(([e,t])=>{Object.keys(t||{}).forEach(r=>{const i=t[r];this._dependencyTracker.updateDependenciesFrom(e,r,De(e,i))})}),i){const t=new xe.default;Object.keys(e).forEach(r=>{const i=(null==n?void 0:n[r])||{},s=e[r],a=Object.assign(Object.assign({},i),s);Object.keys(a).forEach(e=>{this.addIfModified(r,e,i&&i[e],s&&s[e],t)})}),this.sendChangeEvents(t)}}),null==t||t()},r)};i?this._featureStore.all(ke.default.Features,e=>{this._featureStore.all(ke.default.Segments,t=>{const r={[ke.default.Features.namespace]:e,[ke.default.Segments.namespace]:t};n(r)})}):n()}upsert(e,t,r){const{key:i}=t,n=this._hasEventListeners(),s=s=>{this._featureStore.upsert(e,t,()=>{Promise.resolve().then(()=>{if(this._dependencyTracker.updateDependenciesFrom(e.namespace,i,De(e.namespace,t)),n){const r=new xe.default;this.addIfModified(e.namespace,i,s,t,r),this.sendChangeEvents(r)}}),null==r||r()})};n?this._featureStore.get(e,i,s):s()}addIfModified(e,t,r,i,n){i&&r&&i.version<=r.version||this._dependencyTracker.updateModifiedItems(n,e,t)}sendChangeEvents(e){e.enumerate((e,t)=>{e===ke.default.Features.namespace&&this._onChange(t)})}};var Pe={},Re={};Object.defineProperty(Re,"__esModule",{value:!0});Re.default=class{constructor(e,t,r,i){this._filesystem=e,this._paths=t,this._watch=r,this._callback=i,this._watchers=[],this._fileData={},this._fileTimestamps={}}async loadAndWatch(){const e=this._paths.map(async e=>({data:await this._filesystem.readFile(e),path:e,timeStamp:await this._filesystem.getFileTimestamp(e)})),t=await Promise.all(e);t.forEach(e=>{this._fileData[e.path]=e.data,this._fileTimestamps[e.path]=e.timeStamp}),this._callback(t),this._watch&&this._paths.forEach(e=>{const t=this._filesystem.watch(e,async(e,t)=>{const r=await this._filesystem.getFileTimestamp(t);if(r===this._fileTimestamps[t])return;this._fileTimestamps[t]=r;const i=await this._filesystem.readFile(t);this._fileData[t]=i,this._debounceCallback()});this._watchers.push(t)})}close(){this._watchers.forEach(e=>e.close())}_debounceCallback(){this._debounceHandle||(this._debounceHandle=e=>{e()})}},Object.defineProperty(Pe,"__esModule",{value:!0});const Ie=o,Te=oe,Ae=Re;Pe.default=class{constructor(e,t,r){this._validateInputs(e,t),this._paths=e.paths,this._logger=r,this._filesystem=t.fileSystem,this._yamlParser=e.yamlParser}_validateInputs(e,t){if(!e.paths||0===e.paths.length)throw new Error("FileDataInitializerFDv2: paths are required");if(!t.fileSystem)throw new Error("FileDataInitializerFDv2: file system is required")}start(e,t){t(Ie.subsystem.DataSourceState.Initializing);const r=Ie.internal.initMetadataFromHeaders(void 0),i=new Ie.internal.PayloadProcessor({flag:e=>((0,Te.processFlag)(e),e),segment:e=>((0,Te.processSegment)(e),e)},(e,r)=>{t(Ie.subsystem.DataSourceState.Interrupted,new Ie.LDPollingError(e,r))},this._logger),n=Ie.internal.FDv1PayloadAdaptor(i);this._fileLoader=new Ae.default(this._filesystem,this._paths,!1,s=>{var a;try{const a=this._processFileData(s);i.addPayloadListener(t=>{e(!1,{initMetadata:r,payload:t})}),t(Ie.subsystem.DataSourceState.Valid),n.processFullTransfer(a),t(Ie.subsystem.DataSourceState.Closed)}catch(e){null===(a=this._logger)||void 0===a||a.error("File contained invalid data",e),t(Ie.subsystem.DataSourceState.Closed,new Ie.LDPollingError(Ie.DataSourceErrorKind.InvalidData,"Malformed data in file response"))}}),this._fileLoader.loadAndWatch().catch(e=>{var r;null===(r=this._logger)||void 0===r||r.error("Error loading files",e),t(Ie.subsystem.DataSourceState.Closed,new Ie.LDPollingError(Ie.DataSourceErrorKind.NetworkError,`Failed to load files: ${e instanceof Error?e.message:String(e)}`))})}_processFileData(e){return e.reduce((e,t)=>{var r,i;let n;if(t.path.endsWith(".yml")||t.path.endsWith(".yaml")){if(!this._yamlParser)throw new Error(`Attempted to parse yaml file (${t.path}) without parser.`);n=this._yamlParser(t.data)}else n=JSON.parse(t.data);return{segments:Object.assign(Object.assign({},e.segments),null!==(r=n.segments)&&void 0!==r?r:{}),flags:Object.assign(Object.assign({},e.flags),null!==(i=n.flags)&&void 0!==i?i:{})}},{segments:{},flags:{}})}stop(){this._fileLoader&&this._fileLoader.close()}};var Me={};Object.defineProperty(Me,"__esModule",{value:!0});const Ce=o,Fe=oe;Me.default=class{constructor(e,t){this._requestor=e,this._logger=t,this._stopped=!1}start(e,t){var r;t(Ce.subsystem.DataSourceState.Initializing),null===(r=this._logger)||void 0===r||r.debug("Performing initialization request to LaunchDarkly for feature flag data."),this._requestor.requestAllData((r,i,n)=>{var s,a,o;if(this._stopped)return;if(r){const{status:e}=r,i=(0,Ce.httpErrorMessage)(r,"initializer","initializer does not retry");return null===(s=this._logger)||void 0===s||s.error(i),void t(Ce.subsystem.DataSourceState.Closed,new Ce.LDPollingError(Ce.DataSourceErrorKind.ErrorResponse,i,e))}if(!i)return void t(Ce.subsystem.DataSourceState.Closed,new Ce.LDPollingError(Ce.DataSourceErrorKind.InvalidData,"One shot initializer response missing body."));const l=Ce.internal.initMetadataFromHeaders(n);try{const r=JSON.parse(i),n=new Ce.internal.PayloadProcessor({flag:e=>((0,Fe.processFlag)(e),e),segment:e=>((0,Fe.processSegment)(e),e)},(e,r)=>{t(Ce.subsystem.DataSourceState.Interrupted,new Ce.LDPollingError(e,r))},this._logger);t(Ce.subsystem.DataSourceState.Valid),n.addPayloadListener(t=>{e(t.basis,{initMetadata:l,payload:t})}),n.processEvents(r.events),t(Ce.subsystem.DataSourceState.Closed)}catch(e){null===(a=this._logger)||void 0===a||a.error("Response contained invalid data"),null===(o=this._logger)||void 0===o||o.debug(`${r} - Body follows: ${i}`),t(Ce.subsystem.DataSourceState.Closed,new Ce.LDPollingError(Ce.DataSourceErrorKind.InvalidData,"Malformed data in polling response"))}})}stop(){this._stopped=!0}};var Le={},je={},Ne={},$e={};Object.defineProperty($e,"__esModule",{value:!0}),$e.default=function(e){return new Promise(t=>{e(e=>{t(e)})})},Object.defineProperty(Ne,"__esModule",{value:!0});const Be=$e;Ne.default=class{constructor(e){this._store=e}async get(e,t){return(0,Be.default)(r=>{this._store.get(e,t,r)})}async all(e){return(0,Be.default)(t=>{this._store.all(e,t)})}async init(e,t){return(0,Be.default)(r=>{this._store.init(e,r,t)})}async delete(e,t,r){return(0,Be.default)(i=>{this._store.delete(e,t,r,i)})}async upsert(e,t){return(0,Be.default)(r=>{this._store.upsert(e,t,r)})}async initialized(){return(0,Be.default)(e=>{this._store.initialized(e)})}close(){this._store.close()}getInitMetadata(){var e,t;return null===(t=(e=this._store).getInitMetaData)||void 0===t?void 0:t.call(e)}};var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});const ze=$e;Ve.default=class{constructor(e){this._store=e}async get(e,t){return(0,ze.default)(r=>{this._store.get(e,t,r)})}async all(e){return(0,ze.default)(t=>{this._store.all(e,t)})}async init(e,t){return(0,ze.default)(r=>{this._store.init(e,r,t)})}async delete(e,t,r){return(0,ze.default)(i=>{this._store.delete(e,t,r,i)})}async upsert(e,t){return(0,ze.default)(r=>{this._store.upsert(e,t,r)})}async initialized(){return(0,ze.default)(e=>{this._store.initialized(e)})}async applyChanges(e,t,r,i){return(0,ze.default)(n=>{this._store.applyChanges(e,t,n,r,i)})}close(){this._store.close()}getInitMetadata(){var e,t;return null===(t=(e=this._store).getInitMetaData)||void 0===t?void 0:t.call(e)}};var He={},Ue={};function Ke(e){return Date.now()>e.expiration}Object.defineProperty(Ue,"__esModule",{value:!0});Ue.default=class{constructor(e){this._options=e,this._storage=new Map,this._checkIntervalHandle=void e.checkInterval}get(e){const t=this._storage.get(e);if(!t||!Ke(t))return null==t?void 0:t.value;this._storage.delete(e)}set(e,t){this._storage.set(e,{value:t,expiration:Date.now()+1e3*this._options.ttl})}delete(e){this._storage.delete(e)}clear(){this._storage.clear()}close(){this.clear(),this._checkIntervalHandle&&(clearInterval(this._checkIntervalHandle),this._checkIntervalHandle=null)}_purgeStale(){this._storage.forEach((e,t)=>{Ke(e)&&this._storage.delete(t)})}get size(){return this._storage.size}};var qe={};Object.defineProperty(qe,"__esModule",{value:!0}),qe.persistentStoreKinds=void 0;const We=oe,Ge=le;qe.persistentStoreKinds={segments:{namespace:Ge.default.Segments.namespace,deserialize:e=>{const t=(0,We.deserializeSegment)(e);if(t)return{version:t.version,item:t}},serialize:e=>{const t=(0,We.serializeSegment)(e);return{version:e.version,deleted:e.deleted,serializedItem:t}},priority:0},features:{namespace:Ge.default.Features.namespace,deserialize:e=>{const t=(0,We.deserializeFlag)(e);if(t)return{version:t.version,item:t}},serialize:e=>{const t=(0,We.serializeFlag)(e);return{version:e.version,deleted:e.deleted,serializedItem:t}},priority:1}};var Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});const Je=qe;function Ye(e,t){const r=[],i=new Set(Object.keys(t)),n=s=>{if(!i.has(s))return;i.delete(s);const a=t[s];var o;"features"===e.namespace&&(o=a,o.prerequisites&&o.prerequisites.length?o.prerequisites.map(e=>e.key):[]).forEach(e=>{n(e)}),r.push({key:s,item:e.serialize(a)})};for(;i.size>0;){const e=i.values().next().value;n(e)}return r}Xe.default=function(e){const t=[];return Object.keys(e).forEach(r=>{const i=Je.persistentStoreKinds[r];t.push({key:i,item:Ye(i,e[r])})}),t.sort((e,t)=>e.key.priority-t.key.priority),t};var Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.default=class{constructor(){this._queue=[]}enqueue(e,t){this._queue.push([e,t]),1===this._queue.length&&this.executePendingUpdates()}executePendingUpdates(){if(this._queue.length>0){const[e,t]=this._queue[0];e(()=>{this._queue.shift(),this._queue.length,null==t||t()})}}},Object.defineProperty(He,"__esModule",{value:!0});const Qe=Ue,et=qe,tt=Xe,rt=Ze;function it(e,t){return`${e.namespace}:${t}`}function nt(e){return`$all:${e.namespace}`}const st="$checkedInit";function at(e){return!e||e.item.deleted?null:e.item}function ot(e){return{version:e,item:{version:e,deleted:!0}}}function lt(e,t){if(t.deleted||!t.serializedItem)return ot(t.version);const r=e.deserialize(t.serializedItem);return void 0===r?ot(t.version):0===r.version||r.version===t.version||void 0===r.item?r:{version:t.version,item:r.item}}He.default=class{constructor(e,t){this._core=e,this._isInitialized=!1,this._queue=new rt.default,t&&(this._itemCache=new Qe.default({ttl:t,checkInterval:600}),this._allItemsCache=new Qe.default({ttl:t,checkInterval:600}))}init(e,t){this._queue.enqueue(t=>{this._core.init((0,tt.default)(e),()=>{this._isInitialized=!0,this._itemCache&&(this._itemCache.clear(),this._allItemsCache.clear(),Object.keys(e).forEach(t=>{const r=et.persistentStoreKinds[t],i=e[t];this._allItemsCache.set(nt(r),i),Object.keys(i).forEach(e=>{const t=i[e],n={version:t.version,item:t};this._itemCache.set(it(r,e),n)})})),t()})},t)}get(e,t,r){if(this._itemCache){const i=this._itemCache.get(it(e,t));if(i)return void r(at(i))}const i=et.persistentStoreKinds[e.namespace];this._core.get(i,t,n=>{var s;if(n&&n.serializedItem){const a=lt(i,n);return null===(s=this._itemCache)||void 0===s||s.set(it(e,t),a),void r(at(a))}r(null)})}initialized(e){var t;this._isInitialized?e(!0):(null===(t=this._itemCache)||void 0===t?void 0:t.get(st))?e(!1):this._core.initialized(t=>{var r;this._isInitialized=t,this._isInitialized||null===(r=this._itemCache)||void 0===r||r.set(st,!0),e(this._isInitialized)})}all(e,t){var r;const i=null===(r=this._allItemsCache)||void 0===r?void 0:r.get(nt(e));if(i)return void t(i);const n=et.persistentStoreKinds[e.namespace];this._core.getAll(n,r=>{var i;if(!r)return void t({});const s={};r.forEach(({key:e,item:t})=>{const r=at(lt(n,t));r&&(s[e]=r)}),null===(i=this._allItemsCache)||void 0===i||i.set(nt(e),s),t(s)})}upsert(e,t,r){this._queue.enqueue(r=>{this._allItemsCache&&this._allItemsCache.clear();const i=et.persistentStoreKinds[e.namespace];this._core.upsert(i,t.key,i.serialize(t),(n,s)=>{var a,o;if(!n&&s)if(s.serializedItem){const r=lt(i,s);null===(a=this._itemCache)||void 0===a||a.set(it(e,t.key),r)}else s.deleted&&(null===(o=this._itemCache)||void 0===o||o.set(t.key,{key:t.key,version:s.version,deleted:!0}));r()})},r)}delete(e,t,r,i){this.upsert(e,{key:t,version:r,deleted:!0},i)}close(){var e,t;null===(e=this._itemCache)||void 0===e||e.close(),null===(t=this._allItemsCache)||void 0===t||t.close(),this._core.close()}getDescription(){return this._core.getDescription()}};var ct={},ut={};Object.defineProperty(ut,"__esModule",{value:!0});ut.default=class{constructor(){this._allData={},this._initCalled=!1}get(e,t,r){const i=this._allData[e.namespace];if(i&&Object.prototype.hasOwnProperty.call(i,t)){const e=i[t];if(e&&!e.deleted)return null==r?void 0:r(e)}return null==r?void 0:r(null)}all(e,t){var r;const i={},n=null!==(r=this._allData[e.namespace])&&void 0!==r?r:{};Object.entries(n).forEach(([e,t])=>{t&&!t.deleted&&(i[e]=t)}),null==t||t(i)}init(e,t,r){this.applyChanges(!0,e,t,r)}delete(e,t,r,i){const n={key:t,version:r,deleted:!0};this.applyChanges(!1,{[e.namespace]:{[t]:n}},i)}upsert(e,t,r){this.applyChanges(!1,{[e.namespace]:{[t.key]:t}},r)}applyChanges(e,t,r,i,n){if(e)this._initCalled=!0,this._allData=t,this._initMetadata=i;else{const e={};Object.entries(this._allData).forEach(([t,r])=>{e[t]=Object.assign({},r)}),Object.entries(t).forEach(([t,r])=>{Object.keys(r||{}).forEach(i=>{let n=e[t];n||(n={},e[t]=n);const s=r[i];if(Object.hasOwnProperty.call(n,i)){const e=n[i];(!e||e.version<s.version)&&(n[i]=Object.assign({key:i},s))}else n[i]=Object.assign({key:i},s)})}),this._allData=e}this._selector=n,null==r||r()}initialized(e){return null==e?void 0:e(this._initCalled)}close(){}getDescription(){return"memory"}getInitMetaData(){return this._initMetadata}getSelector(){return this._selector}},Object.defineProperty(ct,"__esModule",{value:!0});const dt=ut;ct.default=class{constructor(e){this._nonTransPersistenceStore=e,this._activeStore=this._nonTransPersistenceStore,this._memoryStore=new dt.default}get(e,t,r){this._activeStore.get(e,t,r)}all(e,t){this._activeStore.all(e,t)}init(e,t){this.applyChanges(!0,e,t)}delete(e,t,r,i){const n={key:t,version:r,deleted:!0};this.applyChanges(!1,{[e.namespace]:{[t]:n}},i)}upsert(e,t,r){this.applyChanges(!1,{[e.namespace]:{[t.key]:t}},r)}applyChanges(e,t,r,i,n){this._memoryStore.applyChanges(e,t,()=>{if(e)this._activeStore=this._memoryStore,this._nonTransPersistenceStore.init(t,r);else{const e=[];Object.entries(t).forEach(([t,r])=>{Object.keys(r||{}).forEach(i=>{e.push({dataKind:{namespace:t},item:Object.assign({key:i},r[i])})})}),e.reduce((e,t)=>e.then(()=>new Promise(e=>{this._nonTransPersistenceStore.upsert(t.dataKind,t.item,e)})),Promise.resolve()).then(r)}},i,n)}initialized(e){this._activeStore.initialized(e)}close(){this._nonTransPersistenceStore.close(),this._memoryStore.close()}getDescription(){return"transactional persistent store"}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reviveFullPayload=e.deserializePoll=e.TransactionalFeatureStore=e.PersistentDataStoreWrapper=e.AsyncTransactionalStoreFacade=e.AsyncStoreFacade=void 0;const t=Ne;e.AsyncStoreFacade=t.default;const r=Ve;e.AsyncTransactionalStoreFacade=r.default;const i=He;e.PersistentDataStoreWrapper=i.default;const n=oe;Object.defineProperty(e,"deserializePoll",{enumerable:!0,get:function(){return n.deserializePoll}}),Object.defineProperty(e,"reviveFullPayload",{enumerable:!0,get:function(){return n.reviveFullPayload}});const s=ct;e.TransactionalFeatureStore=s.default}(je),Object.defineProperty(Le,"__esModule",{value:!0});const ht=o,ft=je,pt=le,{initMetadataFromHeaders:vt}=ht.internal;Le.default=class{constructor(e,t,r,i,n=()=>{},s){this._requestor=e,this._pollInterval=t,this._featureStore=r,this._logger=i,this._initSuccessHandler=n,this._errorHandler=s,this._stopped=!1}_poll(){var e;if(this._stopped)return;const t=e=>{var t,r,i;null===(t=this._logger)||void 0===t||t.error("Polling received invalid data"),null===(r=this._logger)||void 0===r||r.debug(`Invalid JSON follows: ${e}`),null===(i=this._errorHandler)||void 0===i||i.call(this,new ht.LDPollingError(ht.DataSourceErrorKind.InvalidData,"Malformed JSON data in polling response"))},r=Date.now();null===(e=this._logger)||void 0===e||e.debug("Polling LaunchDarkly for feature flag updates"),this._requestor.requestAllData((e,i,n)=>{var s,a,o,l;const c=Date.now()-r,u=Math.max(1e3*this._pollInterval-c,0);if(null===(s=this._logger)||void 0===s||s.debug("Elapsed: %d ms, sleeping for %d ms",c,u),e){const{status:t}=e;if(t&&!(0,ht.isHttpRecoverable)(t)){const r=(0,ht.httpErrorMessage)(e,"polling request");return null===(a=this._logger)||void 0===a||a.error(r),void(null===(o=this._errorHandler)||void 0===o||o.call(this,new ht.LDPollingError(ht.DataSourceErrorKind.ErrorResponse,r,t)))}null===(l=this._logger)||void 0===l||l.warn((0,ht.httpErrorMessage)(e,"polling request","will retry"))}else if(i){const e=(0,ft.deserializePoll)(i);if(e){const t={[pt.default.Features.namespace]:e.flags,[pt.default.Segments.namespace]:e.segments};return void this._featureStore.init(t,()=>{this._initSuccessHandler(),this._timeoutHandle=e=>{e()}},vt(n))}t(i)}this._timeoutHandle=e=>{e()}})}start(){this._poll()}stop(){this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0),this._stopped=!0}close(){this.stop()}};var gt={};Object.defineProperty(gt,"__esModule",{value:!0});const _t=o,yt=oe;gt.default=class{constructor(e,t=30,r,i=!1){this._requestor=e,this._pollInterval=t,this._logger=r,this._processResponseAsFDv1=i,this._stopped=!1}_poll(e,t,r){var i;if(this._stopped)return;const n=Date.now();var s;null===(i=this._logger)||void 0===i||i.debug("Polling LaunchDarkly for feature flag updates"),this._requestor.requestAllData((r,i,s)=>{var a,o,l,c,u,d,h;if(this._stopped)return;const f=Date.now()-n,p=Math.max(1e3*this._pollInterval-f,0);if(null===(a=this._logger)||void 0===a||a.debug("Elapsed: %d ms, sleeping for %d ms",f,p),r){const{status:e}=r;if(r instanceof _t.LDFlagDeliveryFallbackError)return null===(o=this._logger)||void 0===o||o.error(r.message),void t(_t.subsystem.DataSourceState.Closed,r);if(e&&!(0,_t.isHttpRecoverable)(e)){const i=(0,_t.httpErrorMessage)(r,"polling request");return null===(l=this._logger)||void 0===l||l.error(i),void t(_t.subsystem.DataSourceState.Closed,new _t.LDPollingError(_t.DataSourceErrorKind.ErrorResponse,i,e,!1))}const i=(0,_t.httpErrorMessage)(r,"polling request","will retry");return t(_t.subsystem.DataSourceState.Interrupted,new _t.LDPollingError(_t.DataSourceErrorKind.ErrorResponse,i,e)),null===(c=this._logger)||void 0===c||c.warn(i),void(this._timeoutHandle=e=>{e()})}const v=_t.internal.initMetadataFromHeaders(s);if(i)try{const r=new _t.internal.PayloadProcessor({flag:e=>((0,yt.processFlag)(e),e),segment:e=>((0,yt.processSegment)(e),e)},(e,r)=>{t(_t.subsystem.DataSourceState.Interrupted,new _t.LDPollingError(e,r))},this._logger);if(r.addPayloadListener(t=>{e(t.basis,{initMetadata:v,payload:t})}),null===(u=this._logger)||void 0===u||u.debug(`Got body: ${i}`),this._processResponseAsFDv1){!function(e,t){_t.internal.FDv1PayloadAdaptor(e).useSelector("FDv1Fallback").processFullTransfer(t)}(r,JSON.parse(i))}else{const e=JSON.parse(i);r.processEvents(e.events)}t(_t.subsystem.DataSourceState.Valid)}catch(e){null===(d=this._logger)||void 0===d||d.error("Response contained invalid data"),null===(h=this._logger)||void 0===h||h.debug(`${r} - Body follows: ${i}`),t(_t.subsystem.DataSourceState.Interrupted,new _t.LDPollingError(_t.DataSourceErrorKind.InvalidData,"Malformed data in polling response"))}this._timeoutHandle=e=>{e()}},(s=null==r?void 0:r())?[{key:"basis",value:s}]:[])}start(e,t,r){this._statusCallback=t,t(_t.subsystem.DataSourceState.Initializing),this._poll(e,t,r)}stop(){var e;this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0),null===(e=this._statusCallback)||void 0===e||e.call(this,_t.subsystem.DataSourceState.Closed),this._stopped=!0,this._statusCallback=void 0}};var mt={};Object.defineProperty(mt,"__esModule",{value:!0});const bt=o;mt.default=class{constructor(e,t,r,i="/sdk/latest-all",n){this._requests=t,this._path=i,this._logger=n,this._eTagCache={},this._headers=Object.assign({},r),this._serviceEndpoints=e.serviceEndpoints}async _requestWithETagCache(e,t){const r=this._eTagCache[e],i=null==r?void 0:r.etag,n=i?Object.assign(Object.assign({},t),{headers:Object.assign(Object.assign({},t.headers),{"if-none-match":i})}):t,s=await this._requests.fetch(e,n);if(304===s.status&&r)return{res:s,body:r.body};const a=s.headers.get("etag"),o=await s.text();return a&&(this._eTagCache[e]={etag:a,body:o}),{res:s,body:o}}async requestAllData(e,t=[]){var r,i;const n={method:"GET",headers:this._headers},s=(0,bt.getPollingUri)(this._serviceEndpoints,this._path,t);null===(r=this._logger)||void 0===r||r.debug(`Requestor making request to uri: ${s}`);try{const{res:t,body:r}=await this._requestWithETagCache(s,n);if(null===(i=this._logger)||void 0===i||i.debug(`Requestor got (possibly cached) body: ${JSON.stringify(r)}`),"true"===t.headers.get("x-ld-fd-fallback")){return e(new bt.LDFlagDeliveryFallbackError(bt.DataSourceErrorKind.ErrorResponse,"Response header indicates to fallback to FDv1.",t.status),void 0,void 0)}if(200!==t.status&&304!==t.status){return e(new bt.LDPollingError(bt.DataSourceErrorKind.ErrorResponse,`Unexpected status code: ${t.status}`,t.status),void 0,void 0)}return e(void 0,304===t.status?null:r,Object.fromEntries(t.headers.entries()))}catch(t){return e(t,void 0,void 0)}}};var St={};Object.defineProperty(St,"__esModule",{value:!0});const Et=o;St.default=class{constructor(e,t,r,i,n,s,a,o=1){this._listeners=i,this._diagnosticsManager=s,this._errorHandler=a,this._streamInitialReconnectDelay=o;const{basicConfiguration:l,platform:c}=e,{logger:u}=l,{requests:d}=c;this._headers=Object.assign({},n),this._logger=u,this._requests=d,this._streamUri=(0,Et.getStreamingUri)(l.serviceEndpoints,t,r)}_logConnectionStarted(){this._connectionAttemptStartTime=Date.now()}_logConnectionResult(e){this._connectionAttemptStartTime&&this._diagnosticsManager&&this._diagnosticsManager.recordStreamInit(this._connectionAttemptStartTime,!e,Date.now()-this._connectionAttemptStartTime),this._connectionAttemptStartTime=void 0}_retryAndHandleError(e){var t,r,i;return(0,Et.shouldRetry)(e)?(null===(i=this._logger)||void 0===i||i.warn((0,Et.httpErrorMessage)(e,"streaming request","will retry")),this._logConnectionResult(!1),this._logConnectionStarted(),!0):(this._logConnectionResult(!1),null===(t=this._errorHandler)||void 0===t||t.call(this,new Et.LDStreamingError(Et.DataSourceErrorKind.ErrorResponse,e.message,e.status)),null===(r=this._logger)||void 0===r||r.error((0,Et.httpErrorMessage)(e,"streaming request")),!1)}start(){this._logConnectionStarted();const e=this._requests.createEventSource(this._streamUri,{headers:this._headers,errorFilter:e=>this._retryAndHandleError(e),initialRetryDelayMillis:1e3*this._streamInitialReconnectDelay,readTimeoutMillis:3e5,retryResetIntervalMillis:6e4});this._eventSource=e,e.onclose=()=>{var e;null===(e=this._logger)||void 0===e||e.info("Closed LaunchDarkly stream connection")},e.onerror=()=>{},e.onopen=e=>{var t;this._initHeaders=e.headers,null===(t=this._logger)||void 0===t||t.info("Opened LaunchDarkly stream connection")},e.onretrying=e=>{var t;null===(t=this._logger)||void 0===t||t.info(`Will retry stream connection in ${e.delayMillis} milliseconds`)},this._listeners.forEach(({deserializeData:t,processJson:r},i)=>{e.addEventListener(i,e=>{var n,s;if(null===(n=this._logger)||void 0===n||n.debug(`Received ${i} event`),null==e?void 0:e.data){this._logConnectionResult(!0);const{data:n}=e,s=t(n);if(!s)return void((e,t,r,i)=>{null==r||r.error(`Stream received invalid data in "${e}" message`),null==r||r.debug(`Invalid JSON follows: ${t}`),null==i||i(new Et.LDStreamingError(Et.DataSourceErrorKind.InvalidData,"Malformed JSON data in event stream"))})(i,n,this._logger,this._errorHandler);r(s,this._initHeaders)}else null===(s=this._errorHandler)||void 0===s||s.call(this,new Et.LDStreamingError(Et.DataSourceErrorKind.Unknown,"Unexpected payload from event stream"))})})}stop(){var e;null===(e=this._eventSource)||void 0===e||e.close(),this._eventSource=void 0}close(){this.stop()}};var wt={};Object.defineProperty(wt,"__esModule",{value:!0});const kt=o,Ot=oe;wt.default=class{constructor(e,t,r,i,n,s=1){this._streamUriPath=t,this._parameters=r,this._diagnosticsManager=n,this._streamInitialReconnectDelay=s;const{basicConfiguration:a,platform:o}=e,{logger:l,serviceEndpoints:c}=a,{requests:u}=o;this._headers=Object.assign({},i),this._serviceEndpoints=c,this._logger=l,this._requests=u}_logConnectionAttempt(){this._connectionAttemptStartTime=Date.now()}_logConnectionResult(e){this._connectionAttemptStartTime&&this._diagnosticsManager&&this._diagnosticsManager.recordStreamInit(this._connectionAttemptStartTime,!e,Date.now()-this._connectionAttemptStartTime),this._connectionAttemptStartTime=void 0}_retryAndHandleError(e,t){var r,i,n;if("true"===(null===(r=e.headers)||void 0===r?void 0:r["x-ld-fd-fallback"])){const r=new kt.LDFlagDeliveryFallbackError(kt.DataSourceErrorKind.ErrorResponse,"Response header indicates to fallback to FDv1",e.status);return t(kt.subsystem.DataSourceState.Closed,r),!1}return(0,kt.shouldRetry)(e)?(null===(n=this._logger)||void 0===n||n.warn((0,kt.httpErrorMessage)(e,"streaming request","will retry")),this._logConnectionResult(!1),this._logConnectionAttempt(),t(kt.subsystem.DataSourceState.Interrupted),!0):(null===(i=this._logger)||void 0===i||i.error((0,kt.httpErrorMessage)(e,"streaming request")),this._logConnectionResult(!1),t(kt.subsystem.DataSourceState.Closed,new kt.LDStreamingError(kt.DataSourceErrorKind.ErrorResponse,e.message,e.status,!1)),!1)}start(e,t,r){var i;this._logConnectionAttempt(),t(kt.subsystem.DataSourceState.Initializing);const n=null==r?void 0:r(),s=n?[...this._parameters,{key:"basis",value:n}]:this._parameters,a=(0,kt.getStreamingUri)(this._serviceEndpoints,this._streamUriPath,s);null===(i=this._logger)||void 0===i||i.debug(`Streaming processor opening event source to uri: ${a}`);const o=this._requests.createEventSource(a,{headers:this._headers,errorFilter:e=>this._retryAndHandleError(e,t),initialRetryDelayMillis:1e3*this._streamInitialReconnectDelay,readTimeoutMillis:3e5,retryResetIntervalMillis:6e4});this._eventSource=o;new kt.internal.PayloadStreamReader(o,{flag:e=>((0,Ot.processFlag)(e),e),segment:e=>((0,Ot.processSegment)(e),e)},(e,r)=>{t(kt.subsystem.DataSourceState.Interrupted,new kt.LDStreamingError(e,r)),this.stop()},this._logger).addPayloadListener(t=>{this._logConnectionResult(!0),e(t.basis,{initMetadata:this._initMetadata,payload:t})}),o.onclose=()=>{var e;null===(e=this._logger)||void 0===e||e.info("Closed LaunchDarkly stream connection"),t(kt.subsystem.DataSourceState.Closed)},o.onerror=()=>{},o.onopen=e=>{var r;null===(r=this._logger)||void 0===r||r.info("Opened LaunchDarkly stream connection"),this._initMetadata=kt.internal.initMetadataFromHeaders(e.headers),t(kt.subsystem.DataSourceState.Valid)},o.onretrying=e=>{var t;null===(t=this._logger)||void 0===t||t.info(`Will retry stream connection in ${e.delayMillis} milliseconds`)}}stop(){var e;null===(e=this._eventSource)||void 0===e||e.close(),this._eventSource=void 0}close(){this.stop()}};var xt={};Object.defineProperty(xt,"__esModule",{value:!0});const Dt=le,Pt=be,Rt=Se,It=Ee;xt.default=class{constructor(e,t,r){this._featureStore=e,this._hasEventListeners=t,this._onChange=r,this._dependencyTracker=new Rt.default}init(e,t,r){this.applyChanges(!0,e,t,r)}upsert(e,t,r){this.applyChanges(!1,{[e.namespace]:{[t.key]:t}},r)}applyChanges(e,t,r,i,n){const s=this._hasEventListeners();let a={};s&&this._featureStore.all(Dt.default.Features,e=>{this._featureStore.all(Dt.default.Segments,t=>{a={[Dt.default.Features.namespace]:e,[Dt.default.Segments.namespace]:t}})}),(a=>{this._featureStore.applyChanges(e,t,()=>{Promise.resolve().then(()=>{if(e&&this._dependencyTracker.reset(),Object.entries(t).forEach(([e,t])=>{Object.keys(t||{}).forEach(r=>{const i=t[r];this._dependencyTracker.updateDependenciesFrom(e,r,(0,Pt.computeDependencies)(e,i))})}),s){const r=new It.default;Object.keys(t).forEach(i=>{const n=a[i],s=t[i];let o;o=e?Object.assign(Object.assign({},n),s):Object.assign({},s),Object.keys(o).forEach(e=>{this.addIfModified(i,e,n&&n[e],s&&s[e],r)})}),this.sendChangeEvents(r)}}),null==r||r()},i,n)})(a)}addIfModified(e,t,r,i,n){i&&r&&i.version<=r.version||this._dependencyTracker.updateModifiedItems(n,e,t)}sendChangeEvents(e){e.enumerate((e,t)=>{e===Dt.default.Features.namespace&&this._onChange(t)})}};var Tt={},At={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultValues=e.DEFAULT_STREAM_RECONNECT_DELAY=e.DEFAULT_POLL_INTERVAL=void 0;const t=o,r=P,i=ut,n={baseUri:t.TypeValidators.String,streamUri:t.TypeValidators.String,eventsUri:t.TypeValidators.String,timeout:t.TypeValidators.Number,capacity:t.TypeValidators.Number,logger:t.TypeValidators.Object,featureStore:t.TypeValidators.ObjectOrFactory,dataSystem:t.TypeValidators.Object,bigSegments:t.TypeValidators.Object,updateProcessor:t.TypeValidators.ObjectOrFactory,flushInterval:t.TypeValidators.Number,pollInterval:t.TypeValidators.numberWithMin(30),proxyOptions:t.TypeValidators.Object,offline:t.TypeValidators.Boolean,stream:t.TypeValidators.Boolean,streamInitialReconnectDelay:t.TypeValidators.Number,useLdd:t.TypeValidators.Boolean,sendEvents:t.TypeValidators.Boolean,allAttributesPrivate:t.TypeValidators.Boolean,privateAttributes:t.TypeValidators.StringArray,contextKeysCapacity:t.TypeValidators.Number,contextKeysFlushInterval:t.TypeValidators.Number,tlsParams:t.TypeValidators.Object,diagnosticOptOut:t.TypeValidators.Boolean,diagnosticRecordingInterval:t.TypeValidators.numberWithMin(60),wrapperName:t.TypeValidators.String,wrapperVersion:t.TypeValidators.String,application:t.TypeValidators.Object,payloadFilterKey:t.TypeValidators.stringMatchingRegex(/^[a-zA-Z0-9](\w|\.|-)*$/),hooks:t.TypeValidators.createTypeArray("Hook[]",{}),enableEventCompression:t.TypeValidators.Boolean,dataSourceOptionsType:t.TypeValidators.String};e.DEFAULT_POLL_INTERVAL=30,e.DEFAULT_STREAM_RECONNECT_DELAY=1;const s={dataSourceOptionsType:"standard",streamInitialReconnectDelay:e.DEFAULT_STREAM_RECONNECT_DELAY,pollInterval:e.DEFAULT_POLL_INTERVAL},a={dataSourceOptionsType:"streamingOnly",streamInitialReconnectDelay:e.DEFAULT_STREAM_RECONNECT_DELAY},l={dataSourceOptionsType:"pollingOnly",pollInterval:e.DEFAULT_POLL_INTERVAL},c={dataSource:s};function u(r,i){const s=[],a=Object.assign({},i);return Object.keys(r).forEach(i=>{var o;const l=r[i],c=n[i];if(c)if(c.is(l))a[i]=l;else if("boolean"===c.getType())s.push(t.OptionMessages.wrongOptionTypeBoolean(i,typeof l)),a[i]=!!l;else if(c instanceof t.NumberWithMinimum&&t.TypeValidators.Number.is(l)){const{min:e}=c;s.push(t.OptionMessages.optionBelowMinimum(i,l,e)),a[i]=e}else s.push(t.OptionMessages.wrongOptionType(i,c.getType(),typeof l)),a[i]=e.defaultValues[i];else null===(o=r.logger)||void 0===o||o.warn(t.OptionMessages.unknownOption(i))}),{errors:s,validatedOptions:a}}e.defaultValues={baseUri:"https://sdk.launchdarkly.com",streamUri:"https://stream.launchdarkly.com",eventsUri:t.ServiceEndpoints.DEFAULT_EVENTS,stream:!0,streamInitialReconnectDelay:e.DEFAULT_STREAM_RECONNECT_DELAY,sendEvents:!0,timeout:5,capacity:1e4,flushInterval:5,pollInterval:e.DEFAULT_POLL_INTERVAL,offline:!1,useLdd:!1,allAttributesPrivate:!1,privateAttributes:[],contextKeysCapacity:1e3,contextKeysFlushInterval:300,diagnosticOptOut:!1,diagnosticRecordingInterval:900,featureStore:()=>new i.default,enableEventCompression:!1,dataSystem:c};e.default=class{constructor(n={},o={}){var c;n=n||{},this.logger=n.logger;const{errors:d,validatedOptions:h}=u(n,e.defaultValues),f=h;if(d.forEach(e=>{var t;null===(t=this.logger)||void 0===t||t.warn(e)}),function(e,r){var i,n,s;const{baseUri:a,streamUri:o,eventsUri:l}=e,c=null!=o,u=null!=a,d=null!=l;c===u&&c===d||(!c&&r.stream&&(null===(i=r.logger)||void 0===i||i.warn(t.OptionMessages.partialEndpoint("streamUri"))),u||null===(n=r.logger)||void 0===n||n.warn(t.OptionMessages.partialEndpoint("baseUri")),!d&&r.sendEvents&&(null===(s=r.logger)||void 0===s||s.warn(t.OptionMessages.partialEndpoint("eventsUri"))))}(n,f),n.dataSystem){const{errors:e,validatedOptions:o}=function(e){const i=[],n=Object.assign({},e);if(e.persistentStore&&!t.TypeValidators.ObjectOrFactory.is(e.persistentStore)&&(n.persistentStore=void 0,i.push(t.OptionMessages.wrongOptionType("persistentStore","LDFeatureStore",typeof e.persistentStore))),e.dataSource){let o,c;(0,r.isStandardOptions)(e.dataSource)?({errors:o,validatedOptions:c}=u(e.dataSource,s)):(0,r.isStreamingOnlyOptions)(e.dataSource)?({errors:o,validatedOptions:c}=u(e.dataSource,a)):(0,r.isPollingOnlyOptions)(e.dataSource)?({errors:o,validatedOptions:c}=u(e.dataSource,l)):(0,r.isCustomOptions)(e.dataSource)?(c=e.dataSource,o=[]):(c=s,o=[t.OptionMessages.wrongOptionType("dataSource","DataSourceOptions",typeof e.dataSource)]),n.dataSource=c,i.push(...o)}else n.dataSource=s;return{errors:i,validatedOptions:n}}(n.dataSystem),c=o;this.dataSystem={dataSource:c.dataSource,useLdd:c.useLdd,featureStoreFactory:e=>void 0===c.persistentStore?new i.default:t.TypeValidators.Function.is(c.persistentStore)?c.persistentStore(e):c.persistentStore},e.forEach(e=>{var t;null===(t=this.logger)||void 0===t||t.warn(e)})}this.serviceEndpoints=new t.ServiceEndpoints(f.streamUri,f.baseUri,f.eventsUri,o.analyticsEventPath,o.diagnosticEventPath,o.includeAuthorizationHeader,f.payloadFilterKey),this.eventsCapacity=f.capacity,this.timeout=f.timeout,this.bigSegments=f.bigSegments,this.flushInterval=f.flushInterval,this.pollInterval=f.pollInterval,this.proxyOptions=f.proxyOptions,this.offline=f.offline,this.stream=f.stream,this.streamInitialReconnectDelay=f.streamInitialReconnectDelay,this.useLdd=f.useLdd,this.sendEvents=f.sendEvents,this.allAttributesPrivate=f.allAttributesPrivate,this.privateAttributes=f.privateAttributes,this.contextKeysCapacity=f.contextKeysCapacity,this.contextKeysFlushInterval=f.contextKeysFlushInterval,this.tlsParams=f.tlsParams,this.diagnosticOptOut=f.diagnosticOptOut,this.wrapperName=f.wrapperName,this.payloadFilterKey=f.payloadFilterKey,this.wrapperVersion=f.wrapperVersion,this.tags=new t.ApplicationTags(f),this.diagnosticRecordingInterval=f.diagnosticRecordingInterval,t.TypeValidators.Function.is(f.updateProcessor)?this.updateProcessorFactory=f.updateProcessor:this.updateProcessorFactory=()=>f.updateProcessor,t.TypeValidators.Function.is(f.featureStore)?this.featureStoreFactory=f.featureStore:this.featureStoreFactory=()=>f.featureStore,this.hooks=f.hooks,this.enableEventCompression=f.enableEventCompression,this.getImplementationHooks=null!==(c=o.getImplementationHooks)&&void 0!==c?c:()=>[],this.applicationInfo=f.application}}}(At),Object.defineProperty(Tt,"__esModule",{value:!0});const Mt=o,Ct=l,Ft=At;Tt.default=(e,t,r)=>{var i,n,s,a,o,l,c,u,d,h,f,p;let v,g,_;return(null===(i=e.dataSystem)||void 0===i?void 0:i.dataSource)?((0,Ct.isStandardOptions)(e.dataSystem.dataSource)||(0,Ct.isPollingOnlyOptions)(e.dataSystem.dataSource))&&e.dataSystem.dataSource.pollInterval&&(v=(0,Mt.secondsToMillis)(e.dataSystem.dataSource.pollInterval)):v=(0,Mt.secondsToMillis)(e.pollInterval),(null===(n=e.dataSystem)||void 0===n?void 0:n.dataSource)?((0,Ct.isStandardOptions)(e.dataSystem.dataSource)||(0,Ct.isStreamingOnlyOptions)(e.dataSystem.dataSource))&&e.dataSystem.dataSource.streamInitialReconnectDelay&&(g=(0,Mt.secondsToMillis)(e.dataSystem.dataSource.streamInitialReconnectDelay)):g=(0,Mt.secondsToMillis)(e.streamInitialReconnectDelay),_=(null===(s=e.dataSystem)||void 0===s?void 0:s.dataSource)?(0,Ct.isPollingOnlyOptions)(null===(a=e.dataSystem)||void 0===a?void 0:a.dataSource):!e.stream,Object.assign(Object.assign(Object.assign({customBaseURI:e.serviceEndpoints.polling!==Ft.defaultValues.baseUri,customStreamURI:e.serviceEndpoints.streaming!==Ft.defaultValues.streamUri,customEventsURI:e.serviceEndpoints.events!==Ft.defaultValues.eventsUri,eventsCapacity:e.eventsCapacity,connectTimeoutMillis:(0,Mt.secondsToMillis)(e.timeout),socketTimeoutMillis:(0,Mt.secondsToMillis)(e.timeout),eventsFlushIntervalMillis:(0,Mt.secondsToMillis)(e.flushInterval)},v?{pollingIntervalMillis:v}:null),g?{reconnectTimeMillis:g}:null),{contextKeysFlushIntervalMillis:(0,Mt.secondsToMillis)(e.contextKeysFlushInterval),diagnosticRecordingIntervalMillis:(0,Mt.secondsToMillis)(e.diagnosticRecordingInterval),streamingDisabled:_,usingRelayDaemon:null!==(l=null===(o=e.dataSystem)||void 0===o?void 0:o.useLdd)&&void 0!==l?l:e.useLdd,offline:e.offline,allAttributesPrivate:e.allAttributesPrivate,contextKeysCapacity:e.contextKeysCapacity,usingProxy:!!(null===(u=(c=t.requests).usingProxy)||void 0===u?void 0:u.call(c)),usingProxyAuthenticator:!!(null===(h=(d=t.requests).usingProxyAuth)||void 0===h?void 0:h.call(d)),dataStoreType:null!==(p=null===(f=r.getDescription)||void 0===f?void 0:f.call(r))&&void 0!==p?p:"memory"})};var Lt={};Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.allAsync=Lt.firstSeriesAsync=Lt.allSeriesAsync=Lt.firstResult=void 0,Lt.firstResult=function(e,t){let r;return null==e||e.some((e,i)=>(r=t(e,i),!!r)),r};function jt(e,t,r,i,n){e?i<(null==e?void 0:e.length)?t(e[i],i,s=>{if(r){if(!s)return void n(!1)}else if(s)return void n(!0);e.length>50?Promise.resolve().then(()=>{jt(e,t,r,i+1,n)}):jt(e,t,r,i+1,n)}):n(r):n(!1)}Lt.allSeriesAsync=function(e,t,r){jt(e,t,!0,0,r)},Lt.firstSeriesAsync=function(e,t,r){jt(e,t,!1,0,r)},Lt.allAsync=function(e,t,r){e?Promise.all(null==e?void 0:e.map(e=>new Promise(r=>{t(e,r)}))).then(e=>{r(e.every(e=>e))}):r(!1)};var Nt={},$t={};Object.defineProperty($t,"__esModule",{value:!0});class Bt{static prerequisiteFailed(e){return{kind:"PREREQUISITE_FAILED",prerequisiteKey:e}}static ruleMatch(e,t){return{kind:"RULE_MATCH",ruleId:e,ruleIndex:t}}}Bt.Fallthrough={kind:"FALLTHROUGH"},Bt.Off={kind:"OFF"},Bt.TargetMatch={kind:"TARGET_MATCH"},$t.default=Bt,Object.defineProperty(Nt,"__esModule",{value:!0});const Vt=$t;class zt{constructor(e,t,r){this.isError=e,this.detail=t,this.message=r,this.isError=e,this.detail=t,this.message=r}get isOff(){return this.detail.reason.kind===Vt.default.Off.kind}setDefault(e){this.detail.value=e}static forError(e,t,r){return new zt(!0,{value:null!=r?r:null,variationIndex:null,reason:{kind:"ERROR",errorKind:e}},t)}static forSuccess(e,t,r){return new zt(!1,{value:e,variationIndex:void 0===r?null:r,reason:t})}}Nt.default=zt;var Ht={},Ut={};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.default=class{constructor(e){this._crypto=e}_sha1Hex(e){const t=this._crypto.createHash("sha1");if(t.update(e),!t.digest)throw new Error("Platform must implement digest or asyncDigest");return t.digest("hex")}bucket(e,t,r,i,n="user",s){const a=function(e){return"string"==typeof e?e:Number.isInteger(e)?String(e):null}(e.valueForKind(r,n));if(null===a){return[0,e.kinds.indexOf(n)>=0]}const o=`${s?Number(s):`${t}.${i}`}.${a}`;return[parseInt(this._sha1Hex(o).substring(0,15),16)/0x1000000000000000,!0]}};var Kt={},qt={};Object.defineProperty(qt,"__esModule",{value:!0}),qt.getBucketBy=qt.getOffVariation=qt.getVariation=void 0;const Wt=o,Gt=Nt,{ErrorKinds:Xt}=Wt.internal,Jt=new Wt.AttributeReference("key");function Yt(e,t,r){return Wt.TypeValidators.Number.is(t)&&t>=0&&t<e.variations.length?Gt.default.forSuccess(e.variations[t],r,t):Gt.default.forError(Xt.MalformedFlag,"Invalid variation index in flag")}qt.getVariation=Yt,qt.getOffVariation=function(e,t){return Wt.TypeValidators.Number.is(e.offVariation)?Yt(e,e.offVariation,t):Gt.default.forSuccess(null,t)},qt.getBucketBy=function(e,t){var r;return null!==(r=e?void 0:t)&&void 0!==r?r:Jt},Object.defineProperty(Kt,"__esModule",{value:!0});const Zt=o,Qt=Lt,er=$t,tr=qt;function rr(e,t,r){const i=r.key(t.contextKind);if(void 0!==i){if(t.values.indexOf(i)>=0)return(0,tr.getVariation)(e,t.variation,er.default.TargetMatch)}}Kt.default=function(e,t){var r;return(null===(r=e.contextTargets)||void 0===r?void 0:r.length)?(0,Qt.firstResult)(e.contextTargets,r=>{if(!r.contextKind||r.contextKind===Zt.Context.UserKind){const i=(e.targets||[]).find(e=>e.variation===r.variation);return i?rr(e,i,t):void 0}return rr(e,r,t)}):(0,Qt.firstResult)(e.targets,r=>rr(e,r,t))};var ir={};Object.defineProperty(ir,"__esModule",{value:!0}),ir.default=function(e){return`${e.key}.g${e.generation}`};var nr={},sr={},ar={exports:{}};var or={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};var lr="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:n}=or,s=lr,a=(t=e.exports={}).re=[],o=t.safeRe=[],l=t.src=[],c=t.t={};let u=0;const d="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",n],[d,i]],f=(e,t,r)=>{const i=(e=>{for(const[t,r]of h)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),n=u++;s(e,n,t),c[e]=n,l[n]=t,a[n]=new RegExp(t,r?"g":void 0),o[n]=new RegExp(i,r?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),f("MAINVERSION",`(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})`),f("MAINVERSIONLOOSE",`(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASEIDENTIFIER",`(?:${l[c.NUMERICIDENTIFIER]}|${l[c.NONNUMERICIDENTIFIER]})`),f("PRERELEASEIDENTIFIERLOOSE",`(?:${l[c.NUMERICIDENTIFIERLOOSE]}|${l[c.NONNUMERICIDENTIFIER]})`),f("PRERELEASE",`(?:-(${l[c.PRERELEASEIDENTIFIER]}(?:\\.${l[c.PRERELEASEIDENTIFIER]})*))`),f("PRERELEASELOOSE",`(?:-?(${l[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[c.PRERELEASEIDENTIFIERLOOSE]})*))`),f("BUILDIDENTIFIER",`${d}+`),f("BUILD",`(?:\\+(${l[c.BUILDIDENTIFIER]}(?:\\.${l[c.BUILDIDENTIFIER]})*))`),f("FULLPLAIN",`v?${l[c.MAINVERSION]}${l[c.PRERELEASE]}?${l[c.BUILD]}?`),f("FULL",`^${l[c.FULLPLAIN]}$`),f("LOOSEPLAIN",`[v=\\s]*${l[c.MAINVERSIONLOOSE]}${l[c.PRERELEASELOOSE]}?${l[c.BUILD]}?`),f("LOOSE",`^${l[c.LOOSEPLAIN]}$`),f("GTLT","((?:<|>)?=?)"),f("XRANGEIDENTIFIERLOOSE",`${l[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),f("XRANGEIDENTIFIER",`${l[c.NUMERICIDENTIFIER]}|x|X|\\*`),f("XRANGEPLAIN",`[v=\\s]*(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:${l[c.PRERELEASE]})?${l[c.BUILD]}?)?)?`),f("XRANGEPLAINLOOSE",`[v=\\s]*(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:${l[c.PRERELEASELOOSE]})?${l[c.BUILD]}?)?)?`),f("XRANGE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAIN]}$`),f("XRANGELOOSE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAINLOOSE]}$`),f("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),f("COERCERTL",l[c.COERCE],!0),f("LONETILDE","(?:~>?)"),f("TILDETRIM",`(\\s*)${l[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",f("TILDE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAIN]}$`),f("TILDELOOSE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAINLOOSE]}$`),f("LONECARET","(?:\\^)"),f("CARETTRIM",`(\\s*)${l[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",f("CARET",`^${l[c.LONECARET]}${l[c.XRANGEPLAIN]}$`),f("CARETLOOSE",`^${l[c.LONECARET]}${l[c.XRANGEPLAINLOOSE]}$`),f("COMPARATORLOOSE",`^${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]})$|^$`),f("COMPARATOR",`^${l[c.GTLT]}\\s*(${l[c.FULLPLAIN]})$|^$`),f("COMPARATORTRIM",`(\\s*)${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]}|${l[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",f("HYPHENRANGE",`^\\s*(${l[c.XRANGEPLAIN]})\\s+-\\s+(${l[c.XRANGEPLAIN]})\\s*$`),f("HYPHENRANGELOOSE",`^\\s*(${l[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[c.XRANGEPLAINLOOSE]})\\s*$`),f("STAR","(<|>)?=?\\s*\\*"),f("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),f("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(ar,ar.exports);var cr=ar.exports;const ur=Object.freeze({loose:!0}),dr=Object.freeze({});var hr=e=>e?"object"!=typeof e?ur:e:dr;const fr=/^[0-9]+$/,pr=(e,t)=>{const r=fr.test(e),i=fr.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};var vr={compareIdentifiers:pr,rcompareIdentifiers:(e,t)=>pr(t,e)};const gr=lr,{MAX_LENGTH:_r,MAX_SAFE_INTEGER:yr}=or,{safeRe:mr,t:br}=cr,Sr=hr,{compareIdentifiers:Er}=vr;var wr=class e{constructor(t,r){if(r=Sr(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>_r)throw new TypeError(`version is longer than ${_r} characters`);gr("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const i=t.trim().match(r.loose?mr[br.LOOSE]:mr[br.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>yr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>yr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>yr||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<yr)return t}return e}):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(gr("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if("string"==typeof t&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),Er(this.major,t.major)||Er(this.minor,t.minor)||Er(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const e=this.prerelease[r],i=t.prerelease[r];if(gr("prerelease compare",r,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return Er(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{const e=this.build[r],i=t.build[r];if(gr("prerelease compare",r,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return Er(e,i)}while(++r)}inc(e,t,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(0===this.prerelease.length)this.prerelease=[e];else{let i=this.prerelease.length;for(;--i>=0;)"number"==typeof this.prerelease[i]&&(this.prerelease[i]++,i=-2);if(-1===i){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let i=[t,e];!1===r&&(i=[t]),0===Er(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const kr=wr;var Or=(e,t,r=!1)=>{if(e instanceof kr)return e;try{return new kr(e,t)}catch(e){if(!r)return null;throw e}};const xr=Or;var Dr=(e,t)=>{const r=xr(e,t);return r?r.version:null};const Pr=Or;var Rr=(e,t)=>{const r=Pr(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const Ir=wr;var Tr=(e,t,r,i,n)=>{"string"==typeof r&&(n=i,i=r,r=void 0);try{return new Ir(e instanceof Ir?e.version:e,r).inc(t,i,n).version}catch(e){return null}};const Ar=Or;var Mr=(e,t)=>{const r=Ar(e,null,!0),i=Ar(t,null,!0),n=r.compare(i);if(0===n)return null;const s=n>0,a=s?r:i,o=s?i:r,l=!!a.prerelease.length;if(!!o.prerelease.length&&!l)return o.patch||o.minor?a.patch?"patch":a.minor?"minor":"major":"major";const c=l?"pre":"";return r.major!==i.major?c+"major":r.minor!==i.minor?c+"minor":r.patch!==i.patch?c+"patch":"prerelease"};const Cr=wr;var Fr=(e,t)=>new Cr(e,t).major;const Lr=wr;var jr=(e,t)=>new Lr(e,t).minor;const Nr=wr;var $r=(e,t)=>new Nr(e,t).patch;const Br=Or;var Vr=(e,t)=>{const r=Br(e,t);return r&&r.prerelease.length?r.prerelease:null};const zr=wr;var Hr=(e,t,r)=>new zr(e,r).compare(new zr(t,r));const Ur=Hr;var Kr=(e,t,r)=>Ur(t,e,r);const qr=Hr;var Wr=(e,t)=>qr(e,t,!0);const Gr=wr;var Xr=(e,t,r)=>{const i=new Gr(e,r),n=new Gr(t,r);return i.compare(n)||i.compareBuild(n)};const Jr=Xr;var Yr=(e,t)=>e.sort((e,r)=>Jr(e,r,t));const Zr=Xr;var Qr=(e,t)=>e.sort((e,r)=>Zr(r,e,t));const ei=Hr;var ti=(e,t,r)=>ei(e,t,r)>0;const ri=Hr;var ii=(e,t,r)=>ri(e,t,r)<0;const ni=Hr;var si=(e,t,r)=>0===ni(e,t,r);const ai=Hr;var oi=(e,t,r)=>0!==ai(e,t,r);const li=Hr;var ci=(e,t,r)=>li(e,t,r)>=0;const ui=Hr;var di=(e,t,r)=>ui(e,t,r)<=0;const hi=si,fi=oi,pi=ti,vi=ci,gi=ii,_i=di;var yi=(e,t,r,i)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return hi(e,r,i);case"!=":return fi(e,r,i);case">":return pi(e,r,i);case">=":return vi(e,r,i);case"<":return gi(e,r,i);case"<=":return _i(e,r,i);default:throw new TypeError(`Invalid operator: ${t}`)}};const mi=wr,bi=Or,{safeRe:Si,t:Ei}=cr;var wi,ki,Oi,xi,Di,Pi,Ri,Ii,Ti,Ai,Mi=(e,t)=>{if(e instanceof mi)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=Si[Ei.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),Si[Ei.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;Si[Ei.COERCERTL].lastIndex=-1}else r=e.match(Si[Ei.COERCE]);return null===r?null:bi(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function Ci(){if(xi)return Oi;function e(t){var r=this;if(r instanceof e||(r=new e),r.tail=null,r.head=null,r.length=0,t&&"function"==typeof t.forEach)t.forEach(function(e){r.push(e)});else if(arguments.length>0)for(var i=0,n=arguments.length;i<n;i++)r.push(arguments[i]);return r}function t(e,t,r){var i=t===e.head?new n(r,null,t,e):new n(r,t,t.next,e);return null===i.next&&(e.tail=i),null===i.prev&&(e.head=i),e.length++,i}function r(e,t){e.tail=new n(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function i(e,t){e.head=new n(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function n(e,t,r,i){if(!(this instanceof n))return new n(e,t,r,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}xi=1,Oi=e,e.Node=n,e.create=e,e.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},e.prototype.unshiftNode=function(e){if(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.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},e.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)r(this,arguments[e]);return this.length},e.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},e.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},e.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},e.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,i=0;null!==r;i++)e.call(t,r.value,i,this),r=r.next},e.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,i=this.length-1;null!==r;i--)e.call(t,r.value,i,this),r=r.prev},e.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},e.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},e.prototype.map=function(t,r){r=r||this;for(var i=new e,n=this.head;null!==n;)i.push(t.call(r,n.value,this)),n=n.next;return i},e.prototype.mapReverse=function(t,r){r=r||this;for(var i=new e,n=this.tail;null!==n;)i.push(t.call(r,n.value,this)),n=n.prev;return i},e.prototype.reduce=function(e,t){var r,i=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,r=this.head.value}for(var n=0;null!==i;n++)r=e(r,i.value,n),i=i.next;return r},e.prototype.reduceReverse=function(e,t){var r,i=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,r=this.tail.value}for(var n=this.length-1;null!==i;n--)r=e(r,i.value,n),i=i.prev;return r},e.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},e.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},e.prototype.slice=function(t,r){(r=r||this.length)<0&&(r+=this.length),(t=t||0)<0&&(t+=this.length);var i=new e;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=0,s=this.head;null!==s&&n<t;n++)s=s.next;for(;null!==s&&n<r;n++,s=s.next)i.push(s.value);return i},e.prototype.sliceReverse=function(t,r){(r=r||this.length)<0&&(r+=this.length),(t=t||0)<0&&(t+=this.length);var i=new e;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=this.length,s=this.tail;null!==s&&n>r;n--)s=s.prev;for(;null!==s&&n>t;n--,s=s.prev)i.push(s.value);return i},e.prototype.splice=function(e,r,...i){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,s=this.head;null!==s&&n<e;n++)s=s.next;var a=[];for(n=0;s&&n<r;n++)a.push(s.value),s=this.removeNode(s);null===s&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(n=0;n<i.length;n++)s=t(this,s,i[n]);return a},e.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var i=r.prev;r.prev=r.next,r.next=i}return this.head=t,this.tail=e,this};try{(ki?wi:(ki=1,wi=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}))(e)}catch(e){}return Oi}function Fi(){if(Ii)return Ri;Ii=1;class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof n)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!p(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&v(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&h)|(this.options.loose&&f))+":"+e,i=r.get(t);if(i)return i;const a=this.options.loose,v=a?o[l.HYPHENRANGELOOSE]:o[l.HYPHENRANGE];e=e.replace(v,D(this.options.includePrerelease)),s("hyphen replace",e),e=e.replace(o[l.COMPARATORTRIM],c),s("comparator trim",e),e=e.replace(o[l.TILDETRIM],u),s("tilde trim",e),e=e.replace(o[l.CARETTRIM],d),s("caret trim",e);let g=e.split(" ").map(e=>_(e,this.options)).join(" ").split(/\s+/).map(e=>x(e,this.options));a&&(g=g.filter(e=>(s("loose invalid filter",e,this.options),!!e.match(o[l.COMPARATORLOOSE])))),s("range list",g);const y=new Map,m=g.map(e=>new n(e,this.options));for(const e of m){if(p(e))return[e];y.set(e.value,e)}y.size>1&&y.has("")&&y.delete("");const b=[...y.values()];return r.set(t,b),b}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(e=>g(e,r)&&t.set.some(t=>g(t,r)&&e.every(e=>t.every(t=>e.intersects(t,r)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(P(this.set[t],e,this.options))return!0;return!1}}Ri=e;const t=function(){if(Pi)return Di;Pi=1;const e=Ci(),t=Symbol("max"),r=Symbol("length"),i=Symbol("lengthCalculator"),n=Symbol("allowStale"),s=Symbol("maxAge"),a=Symbol("dispose"),o=Symbol("noDisposeOnSet"),l=Symbol("lruList"),c=Symbol("cache"),u=Symbol("updateAgeOnGet"),d=()=>1,h=(e,t,r)=>{const i=e[c].get(t);if(i){const t=i.value;if(f(e,t)){if(v(e,i),!e[n])return}else r&&(e[u]&&(i.value.now=Date.now()),e[l].unshiftNode(i));return t.value}},f=(e,t)=>{if(!t||!t.maxAge&&!e[s])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[s]&&r>e[s]},p=e=>{if(e[r]>e[t])for(let i=e[l].tail;e[r]>e[t]&&null!==i;){const t=i.prev;v(e,i),i=t}},v=(e,t)=>{if(t){const i=t.value;e[a]&&e[a](i.key,i.value),e[r]-=i.length,e[c].delete(i.key),e[l].removeNode(t)}};class g{constructor(e,t,r,i,n){this.key=e,this.value=t,this.length=r,this.now=i,this.maxAge=n||0}}const _=(e,t,r,i)=>{let s=r.value;f(e,s)&&(v(e,r),e[n]||(s=void 0)),s&&t.call(i,s.value,s.key,e)};return Di=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[t]=e.max||1/0;const r=e.length||d;if(this[i]="function"!=typeof r?d:r,this[n]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[s]=e.maxAge||0,this[a]=e.dispose,this[o]=e.noDisposeOnSet||!1,this[u]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[t]=e||1/0,p(this)}get max(){return this[t]}set allowStale(e){this[n]=!!e}get allowStale(){return this[n]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[s]=e,p(this)}get maxAge(){return this[s]}set lengthCalculator(e){"function"!=typeof e&&(e=d),e!==this[i]&&(this[i]=e,this[r]=0,this[l].forEach(e=>{e.length=this[i](e.value,e.key),this[r]+=e.length})),p(this)}get lengthCalculator(){return this[i]}get length(){return this[r]}get itemCount(){return this[l].length}rforEach(e,t){t=t||this;for(let r=this[l].tail;null!==r;){const i=r.prev;_(this,e,r,t),r=i}}forEach(e,t){t=t||this;for(let r=this[l].head;null!==r;){const i=r.next;_(this,e,r,t),r=i}}keys(){return this[l].toArray().map(e=>e.key)}values(){return this[l].toArray().map(e=>e.value)}reset(){this[a]&&this[l]&&this[l].length&&this[l].forEach(e=>this[a](e.key,e.value)),this[c]=new Map,this[l]=new e,this[r]=0}dump(){return this[l].map(e=>!f(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[l]}set(e,n,u){if((u=u||this[s])&&"number"!=typeof u)throw new TypeError("maxAge must be a number");const d=u?Date.now():0,h=this[i](n,e);if(this[c].has(e)){if(h>this[t])return v(this,this[c].get(e)),!1;const i=this[c].get(e).value;return this[a]&&(this[o]||this[a](e,i.value)),i.now=d,i.maxAge=u,i.value=n,this[r]+=h-i.length,i.length=h,this.get(e),p(this),!0}const f=new g(e,n,h,d,u);return f.length>this[t]?(this[a]&&this[a](e,n),!1):(this[r]+=f.length,this[l].unshift(f),this[c].set(e,this[l].head),p(this),!0)}has(e){if(!this[c].has(e))return!1;const t=this[c].get(e).value;return!f(this,t)}get(e){return h(this,e,!0)}peek(e){return h(this,e,!1)}pop(){const e=this[l].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[c].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const i=e[r],n=i.e||0;if(0===n)this.set(i.k,i.v);else{const e=n-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[c].forEach((e,t)=>h(this,t,!1))}},Di}(),r=new t({max:1e3}),i=hr,n=Li(),s=lr,a=wr,{safeRe:o,t:l,comparatorTrimReplace:c,tildeTrimReplace:u,caretTrimReplace:d}=cr,{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:f}=or,p=e=>"<0.0.0-0"===e.value,v=e=>""===e.value,g=(e,t)=>{let r=!0;const i=e.slice();let n=i.pop();for(;r&&i.length;)r=i.every(e=>n.intersects(e,t)),n=i.pop();return r},_=(e,t)=>(s("comp",e,t),e=S(e,t),s("caret",e),e=m(e,t),s("tildes",e),e=w(e,t),s("xrange",e),e=O(e,t),s("stars",e),e),y=e=>!e||"x"===e.toLowerCase()||"*"===e,m=(e,t)=>e.trim().split(/\s+/).map(e=>b(e,t)).join(" "),b=(e,t)=>{const r=t.loose?o[l.TILDELOOSE]:o[l.TILDE];return e.replace(r,(t,r,i,n,a)=>{let o;return s("tilde",e,t,r,i,n,a),y(r)?o="":y(i)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:y(n)?o=`>=${r}.${i}.0 <${r}.${+i+1}.0-0`:a?(s("replaceTilde pr",a),o=`>=${r}.${i}.${n}-${a} <${r}.${+i+1}.0-0`):o=`>=${r}.${i}.${n} <${r}.${+i+1}.0-0`,s("tilde return",o),o})},S=(e,t)=>e.trim().split(/\s+/).map(e=>E(e,t)).join(" "),E=(e,t)=>{s("caret",e,t);const r=t.loose?o[l.CARETLOOSE]:o[l.CARET],i=t.includePrerelease?"-0":"";return e.replace(r,(t,r,n,a,o)=>{let l;return s("caret",e,t,r,n,a,o),y(r)?l="":y(n)?l=`>=${r}.0.0${i} <${+r+1}.0.0-0`:y(a)?l="0"===r?`>=${r}.${n}.0${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.0${i} <${+r+1}.0.0-0`:o?(s("replaceCaret pr",o),l="0"===r?"0"===n?`>=${r}.${n}.${a}-${o} <${r}.${n}.${+a+1}-0`:`>=${r}.${n}.${a}-${o} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${a}-${o} <${+r+1}.0.0-0`):(s("no pr"),l="0"===r?"0"===n?`>=${r}.${n}.${a}${i} <${r}.${n}.${+a+1}-0`:`>=${r}.${n}.${a}${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${a} <${+r+1}.0.0-0`),s("caret return",l),l})},w=(e,t)=>(s("replaceXRanges",e,t),e.split(/\s+/).map(e=>k(e,t)).join(" ")),k=(e,t)=>{e=e.trim();const r=t.loose?o[l.XRANGELOOSE]:o[l.XRANGE];return e.replace(r,(r,i,n,a,o,l)=>{s("xRange",e,r,i,n,a,o,l);const c=y(n),u=c||y(a),d=u||y(o),h=d;return"="===i&&h&&(i=""),l=t.includePrerelease?"-0":"",c?r=">"===i||"<"===i?"<0.0.0-0":"*":i&&h?(u&&(a=0),o=0,">"===i?(i=">=",u?(n=+n+1,a=0,o=0):(a=+a+1,o=0)):"<="===i&&(i="<",u?n=+n+1:a=+a+1),"<"===i&&(l="-0"),r=`${i+n}.${a}.${o}${l}`):u?r=`>=${n}.0.0${l} <${+n+1}.0.0-0`:d&&(r=`>=${n}.${a}.0${l} <${n}.${+a+1}.0-0`),s("xRange return",r),r})},O=(e,t)=>(s("replaceStars",e,t),e.trim().replace(o[l.STAR],"")),x=(e,t)=>(s("replaceGTE0",e,t),e.trim().replace(o[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),D=e=>(t,r,i,n,s,a,o,l,c,u,d,h,f)=>`${r=y(i)?"":y(n)?`>=${i}.0.0${e?"-0":""}`:y(s)?`>=${i}.${n}.0${e?"-0":""}`:a?`>=${r}`:`>=${r}${e?"-0":""}`} ${l=y(c)?"":y(u)?`<${+c+1}.0.0-0`:y(d)?`<${c}.${+u+1}.0-0`:h?`<=${c}.${u}.${d}-${h}`:e?`<${c}.${u}.${+d+1}-0`:`<=${l}`}`.trim(),P=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(s(e[r].semver),e[r].semver!==n.ANY&&e[r].semver.prerelease.length>0){const i=e[r].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0};return Ri}function Li(){if(Ai)return Ti;Ai=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(i,n){if(n=r(n),i instanceof t){if(i.loose===!!n.loose)return i;i=i.value}i=i.trim().split(/\s+/).join(" "),a("comparator",i,n),this.options=n,this.loose=!!n.loose,this.parse(i),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(t){const r=this.options.loose?i[n.COMPARATORLOOSE]:i[n.COMPARATOR],s=t.match(r);if(!s)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==s[1]?s[1]:"","="===this.operator&&(this.operator=""),s[2]?this.semver=new o(s[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(a("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new o(t,this.options)}catch(e){return!1}return s(t,this.operator,this.semver,this.options)}intersects(e,i){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new l(e.value,i).test(this.value):""===e.operator?""===e.value||new l(this.value,i).test(e.semver):(!(i=r(i)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!i.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(s(this.semver,"<",e.semver,i)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(s(this.semver,">",e.semver,i)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}Ti=t;const r=hr,{safeRe:i,t:n}=cr,s=yi,a=lr,o=wr,l=Fi();return Ti}const ji=Fi();var Ni=(e,t,r)=>{try{t=new ji(t,r)}catch(e){return!1}return t.test(e)};const $i=Fi();var Bi=(e,t)=>new $i(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "));const Vi=wr,zi=Fi();var Hi=(e,t,r)=>{let i=null,n=null,s=null;try{s=new zi(t,r)}catch(e){return null}return e.forEach(e=>{s.test(e)&&(i&&-1!==n.compare(e)||(i=e,n=new Vi(i,r)))}),i};const Ui=wr,Ki=Fi();var qi=(e,t,r)=>{let i=null,n=null,s=null;try{s=new Ki(t,r)}catch(e){return null}return e.forEach(e=>{s.test(e)&&(i&&1!==n.compare(e)||(i=e,n=new Ui(i,r)))}),i};const Wi=wr,Gi=Fi(),Xi=ti;var Ji=(e,t)=>{e=new Gi(e,t);let r=new Wi("0.0.0");if(e.test(r))return r;if(r=new Wi("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const i=e.set[t];let n=null;i.forEach(e=>{const t=new Wi(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":n&&!Xi(t,n)||(n=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),!n||r&&!Xi(r,n)||(r=n)}return r&&e.test(r)?r:null};const Yi=Fi();var Zi=(e,t)=>{try{return new Yi(e,t).range||"*"}catch(e){return null}};const Qi=wr,en=Li(),{ANY:tn}=en,rn=Fi(),nn=Ni,sn=ti,an=ii,on=di,ln=ci;var cn=(e,t,r,i)=>{let n,s,a,o,l;switch(e=new Qi(e,i),t=new rn(t,i),r){case">":n=sn,s=on,a=an,o=">",l=">=";break;case"<":n=an,s=ln,a=sn,o="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(nn(e,t,i))return!1;for(let r=0;r<t.set.length;++r){const c=t.set[r];let u=null,d=null;if(c.forEach(e=>{e.semver===tn&&(e=new en(">=0.0.0")),u=u||e,d=d||e,n(e.semver,u.semver,i)?u=e:a(e.semver,d.semver,i)&&(d=e)}),u.operator===o||u.operator===l)return!1;if((!d.operator||d.operator===o)&&s(e,d.semver))return!1;if(d.operator===l&&a(e,d.semver))return!1}return!0};const un=cn;var dn=(e,t,r)=>un(e,t,">",r);const hn=cn;var fn=(e,t,r)=>hn(e,t,"<",r);const pn=Fi();var vn=(e,t,r)=>(e=new pn(e,r),t=new pn(t,r),e.intersects(t,r));const gn=Ni,_n=Hr;const yn=Fi(),mn=Li(),{ANY:bn}=mn,Sn=Ni,En=Hr,wn=[new mn(">=0.0.0-0")],kn=[new mn(">=0.0.0")],On=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===bn){if(1===t.length&&t[0].semver===bn)return!0;e=r.includePrerelease?wn:kn}if(1===t.length&&t[0].semver===bn){if(r.includePrerelease)return!0;t=kn}const i=new Set;let n,s,a,o,l,c,u;for(const t of e)">"===t.operator||">="===t.operator?n=xn(n,t,r):"<"===t.operator||"<="===t.operator?s=Dn(s,t,r):i.add(t.semver);if(i.size>1)return null;if(n&&s){if(a=En(n.semver,s.semver,r),a>0)return null;if(0===a&&(">="!==n.operator||"<="!==s.operator))return null}for(const e of i){if(n&&!Sn(e,String(n),r))return null;if(s&&!Sn(e,String(s),r))return null;for(const i of t)if(!Sn(e,String(i),r))return!1;return!0}let d=!(!s||r.includePrerelease||!s.semver.prerelease.length)&&s.semver,h=!(!n||r.includePrerelease||!n.semver.prerelease.length)&&n.semver;d&&1===d.prerelease.length&&"<"===s.operator&&0===d.prerelease[0]&&(d=!1);for(const e of t){if(u=u||">"===e.operator||">="===e.operator,c=c||"<"===e.operator||"<="===e.operator,n)if(h&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===h.major&&e.semver.minor===h.minor&&e.semver.patch===h.patch&&(h=!1),">"===e.operator||">="===e.operator){if(o=xn(n,e,r),o===e&&o!==n)return!1}else if(">="===n.operator&&!Sn(n.semver,String(e),r))return!1;if(s)if(d&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===d.major&&e.semver.minor===d.minor&&e.semver.patch===d.patch&&(d=!1),"<"===e.operator||"<="===e.operator){if(l=Dn(s,e,r),l===e&&l!==s)return!1}else if("<="===s.operator&&!Sn(s.semver,String(e),r))return!1;if(!e.operator&&(s||n)&&0!==a)return!1}return!(n&&c&&!s&&0!==a)&&(!(s&&u&&!n&&0!==a)&&(!h&&!d))},xn=(e,t,r)=>{if(!e)return t;const i=En(e.semver,t.semver,r);return i>0?e:i<0||">"===t.operator&&">="===e.operator?t:e},Dn=(e,t,r)=>{if(!e)return t;const i=En(e.semver,t.semver,r);return i<0?e:i>0||"<"===t.operator&&"<="===e.operator?t:e};var Pn=(e,t,r={})=>{if(e===t)return!0;e=new yn(e,r),t=new yn(t,r);let i=!1;e:for(const n of e.set){for(const e of t.set){const t=On(n,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0};const Rn=cr,In=or,Tn=wr,An=vr,Mn=(e,t,r)=>{const i=[];let n=null,s=null;const a=e.sort((e,t)=>_n(e,t,r));for(const e of a){gn(e,t,r)?(s=e,n||(n=e)):(s&&i.push([n,s]),s=null,n=null)}n&&i.push([n,null]);const o=[];for(const[e,t]of i)e===t?o.push(e):t||e!==a[0]?t?e===a[0]?o.push(`<=${t}`):o.push(`${e} - ${t}`):o.push(`>=${e}`):o.push("*");const l=o.join(" || "),c="string"==typeof t.raw?t.raw:String(t);return l.length<c.length?l:t};var Cn={parse:Or,valid:Dr,clean:Rr,inc:Tr,diff:Mr,major:Fr,minor:jr,patch:$r,prerelease:Vr,compare:Hr,rcompare:Kr,compareLoose:Wr,compareBuild:Xr,sort:Yr,rsort:Qr,gt:ti,lt:ii,eq:si,neq:oi,gte:ci,lte:di,cmp:yi,coerce:Mi,Comparator:Li(),Range:Fi(),satisfies:Ni,toComparators:Bi,maxSatisfying:Hi,minSatisfying:qi,minVersion:Ji,validRange:Zi,outside:cn,gtr:dn,ltr:fn,intersects:vn,simplifyRange:Mn,subset:Pn,SemVer:Tn,re:Rn.re,src:Rn.src,tokens:Rn.t,SEMVER_SPEC_VERSION:In.SEMVER_SPEC_VERSION,RELEASE_TYPES:In.RELEASE_TYPES,compareIdentifiers:An.compareIdentifiers,rcompareIdentifiers:An.rcompareIdentifiers};Object.defineProperty(sr,"__esModule",{value:!0});const Fn=Cn,Ln=o,jn=/^\d+(\.\d+)?(\.\d+)?/;function Nn(e){if(Ln.TypeValidators.String.is(e)&&!e.startsWith("v")){const t=(0,Fn.parse)(e);if(t)return t;const r=jn.exec(e);if(r){let t=r[0];for(let e=1;e<r.length;e+=1)void 0===r[e]&&(t+=".0");return t+=e.substring(r[0].length),(0,Fn.parse)(t)}}return null}function $n(e){return(t,r)=>{const i=Nn(t),n=Nn(r);return!!(i&&n&&e(i,n))}}function Bn(e,t,r){return(i,n)=>!(!t.is(i)||!t.is(n))&&(r?e(r(i),r(n)):e(i,n))}function Vn(e){return"number"==typeof e?e:Date.parse(e)}const zn={in:(e,t)=>e===t,endsWith:Bn((e,t)=>e.endsWith(t),Ln.TypeValidators.String),startsWith:Bn((e,t)=>e.startsWith(t),Ln.TypeValidators.String),matches:Bn((e,t)=>function(e,t){try{return new RegExp(e).test(t)}catch(e){return!1}}(t,e),Ln.TypeValidators.String),contains:Bn((e,t)=>e.indexOf(t)>-1,Ln.TypeValidators.String),lessThan:Bn((e,t)=>e<t,Ln.TypeValidators.Number),lessThanOrEqual:Bn((e,t)=>e<=t,Ln.TypeValidators.Number),greaterThan:Bn((e,t)=>e>t,Ln.TypeValidators.Number),greaterThanOrEqual:Bn((e,t)=>e>=t,Ln.TypeValidators.Number),before:Bn((e,t)=>e<t,Ln.TypeValidators.Date,Vn),after:Bn((e,t)=>e>t,Ln.TypeValidators.Date,Vn),semVerEqual:$n((e,t)=>0===e.compare(t)),semVerLessThan:$n((e,t)=>e.compare(t)<0),semVerGreaterThan:$n((e,t)=>e.compare(t)>0)};sr.default=class{static is(e){return Object.prototype.hasOwnProperty.call(zn,e)}static execute(e,t,r){var i,n;return null!==(n=null===(i=zn[e])||void 0===i?void 0:i.call(zn,t,r))&&void 0!==n&&n}},Object.defineProperty(nr,"__esModule",{value:!0}),nr.maybeNegate=void 0;const Hn=sr;function Un(e,t){return e.negate?!t:t}function Kn(e,t,r){return r.some(r=>Hn.default.execute(e,t,r))}nr.maybeNegate=Un,nr.default=function(e,t){const r=t.valueForKind(e.attributeReference,e.contextKind);return null!=r&&(Array.isArray(r)?Un(e,r.some(t=>Kn(e.op,t,e.values))):Un(e,Kn(e.op,r,e.values)))};var qn={};function Wn(e,t,r,i){if(t)for(let r=0;r<t.length;r+=1){const i=t[r],n=e.key(i.contextKind);if(n)if(i.generated_valuesSet){if(i.generated_valuesSet.has(n))return!0}else if(i.values.includes(n))return!0}if(i){const t=e.key("user");if(t&&i.has(t))return!0}else if(r){const t=e.key("user");if(t&&r.includes(t))return!0}return!1}Object.defineProperty(qn,"__esModule",{value:!0}),qn.default=function(e,t){if(Wn(t,e.includedContexts,e.included,e.generated_includedSet))return!0;const r=Wn(t,e.excludedContexts,e.excluded,e.generated_excludedSet);return r?!r:void 0},Object.defineProperty(Ht,"__esModule",{value:!0});const Gn=o,Xn=Ut,Jn=Lt,Yn=Nt,Zn=Kt,Qn=ir,es=nr,ts=qn,rs=$t,is=qt,{ErrorKinds:ns}=Gn.internal,ss={HEALTHY:1,STALE:2,STORE_ERROR:3,NOT_CONFIGURED:4};function as(e){return void 0!==e&&ss[e]||0}function os(e,t){return void 0!==e&&as(e)>as(t)?e:t}function ls(e){return{error:!1,isMatch:e,result:void 0}}function cs(e){return{error:!0,isMatch:!1,result:e}}Ht.default=class{constructor(e,t){this._queries=t,this._bucketer=new Xn.default(e.crypto)}async evaluate(e,t,r){return new Promise(i=>{this.evaluateCb(e,t,i,r)})}evaluateCb(e,t,r,i){const n={};this._evaluateInternal(e,t,n,[],e=>{n.bigSegmentsStatus&&(e.detail.reason=Object.assign(Object.assign({},e.detail.reason),{bigSegmentsStatus:n.bigSegmentsStatus})),n.prerequisites&&(e.prerequisites=n.prerequisites),e.events=n.events,r(e)},!0,i)}_evaluateInternal(e,t,r,i,n,s,a){e.on?this._checkPrerequisites(e,t,r,i,i=>{if(i)return void n(i);const s=(0,Zn.default)(e,t);s?n(s):this._evaluateRules(e,t,r,r=>{n(r||this._variationForContext(e.fallthrough,t,e,rs.default.Fallthrough))})},s,a):n((0,is.getOffVariation)(e,rs.default.Off))}_checkPrerequisites(e,t,r,i,n,s,a){let o;e.prerequisites&&e.prerequisites.length?(0,Jn.allSeriesAsync)(e.prerequisites,(n,l,c)=>{if(-1!==i.indexOf(n.key))return o=Yn.default.forError(ns.MalformedFlag,`Prerequisite of ${e.key} causing a circular reference. This is probably a temporary condition due to an incomplete update.`),void c(!0);const u=[...i,n.key];this._queries.getFlag(n.key,i=>{if(!i)return o=(0,is.getOffVariation)(e,rs.default.prerequisiteFailed(n.key)),void c(!1);this._evaluateInternal(i,t,r,u,l=>{var u,d;return null!==(u=r.events)&&void 0!==u||(r.events=[]),s&&(null!==(d=r.prerequisites)&&void 0!==d||(r.prerequisites=[]),r.prerequisites.push(i.key)),a&&r.events.push(a.evalEventServer(i,t,l.detail,null,e)),l.isError?(o=l,c(!1)):l.isOff||l.detail.variationIndex!==n.variation?(o=(0,is.getOffVariation)(e,rs.default.prerequisiteFailed(n.key)),c(!1)):c(!0)},!1,a)})},()=>{n(o)}):n(void 0)}_evaluateRules(e,t,r,i){let n;(0,Jn.firstSeriesAsync)(e.rules,(i,s,a)=>{this._ruleMatchContext(e,i,s,t,r,[],e=>{n=e,a(!!e)})},()=>i(n))}_clauseMatchContext(e,t,r,i,n){let s;"segmentMatch"!==e.op?e.attributeReference.isValid?n(ls((0,es.default)(e,t))):n(cs(Yn.default.forError(ns.MalformedFlag,"Invalid attribute reference in clause"))):(0,Jn.firstSeriesAsync)(e.values,(e,n,a)=>{this._queries.getSegment(e,e=>{if(e){if(r.includes(e.key))return s=Yn.default.forError(ns.MalformedFlag,`Segment rule referencing segment ${e.key} caused a circular reference. This is probably a temporary condition due to an incomplete update`),void a(!0);const n=[...r,null==e?void 0:e.key];this.segmentMatchContext(e,t,i,n,e=>{e.error&&(s=e.result),a(e.error||e.isMatch)})}else a(!1)})},t=>n(s?cs(s):ls((0,es.maybeNegate)(e,t))))}_ruleMatchContext(e,t,r,i,n,s,a){if(!t.clauses)return void a(void 0);let o;(0,Jn.allSeriesAsync)(t.clauses,(e,t,r)=>{this._clauseMatchContext(e,i,s,n,e=>(o=e.result,r(e.error||e.isMatch)))},n=>a(o||(n?this._variationForContext(t,i,e,rs.default.ruleMatch(t.id,r)):void 0)))}_variationForContext(e,t,r,i){if(void 0===e)return Yn.default.forError(ns.MalformedFlag,"Fallthrough variation undefined");if(void 0!==e.variation)return(0,is.getVariation)(r,e.variation,i);if(e.rollout){const{rollout:n}=e,{variations:s}=n,a="experiment"===n.kind;if(s&&s.length){const e=(0,is.getBucketBy)(a,n.bucketByAttributeReference);if(!e.isValid)return Yn.default.forError(ns.MalformedFlag,"Invalid attribute reference for bucketBy in rollout");const[o,l]=this._bucketer.bucket(t,r.key,e,r.salt||"",n.contextKind,n.seed),c=Object.assign({},i);let u=0;for(let e=0;e<s.length;e+=1){const t=s[e];if(u+=t.weight/1e5,o<u)return a&&l&&!t.untracked&&(c.inExperiment=!0),(0,is.getVariation)(r,t.variation,c)}const d=s[s.length-1];return a&&!d.untracked&&(c.inExperiment=!0),(0,is.getVariation)(r,d.variation,c)}}return Yn.default.forError(ns.MalformedFlag,"Variation/rollout object with no variation or rollout")}segmentRuleMatchContext(e,t,r,i,n,s){let a;(0,Jn.allSeriesAsync)(t.clauses,(e,t,s)=>{this._clauseMatchContext(e,r,n,i,e=>{a=e.result,s(e.error||e.isMatch)})},i=>{if(a)return s(cs(a));if(i){if(void 0===t.weight)return s(ls(i));const n=(0,is.getBucketBy)(!1,t.bucketByAttributeReference);if(!n.isValid)return s(cs(Yn.default.forError(ns.MalformedFlag,"Invalid attribute reference in clause")));const[a]=this._bucketer.bucket(r,e.key,n,e.salt||"",t.rolloutContextKind);return s(ls(a<t.weight/1e5))}return s(ls(!1))})}simpleSegmentMatchContext(e,t,r,i,n){if(!e.unbounded){const r=(0,ts.default)(e,t);if(void 0!==r)return void n(ls(r))}let s;(0,Jn.firstSeriesAsync)(e.rules,(n,a,o)=>{this.segmentRuleMatchContext(e,n,t,r,i,e=>(s=e.result,o(e.error||e.isMatch)))},e=>n(s?cs(s):ls(e)))}segmentMatchContext(e,t,r,i,n){if(!e.unbounded)return void this.simpleSegmentMatchContext(e,t,r,i,n);const s=e.unboundedContextKind||"user",a=t.key(s);if(a)return e.generation?void(r.bigSegmentsMembership&&r.bigSegmentsMembership[a]?this.bigSegmentMatchContext(r.bigSegmentsMembership[a],e,t,r).then(n):this._queries.getBigSegmentsMembership(a).then(i=>{if(r.bigSegmentsMembership=r.bigSegmentsMembership||{},i){const[e,t]=i;r.bigSegmentsMembership[a]=e,r.bigSegmentsStatus=os(r.bigSegmentsStatus,t)}else r.bigSegmentsStatus=os(r.bigSegmentsStatus,"NOT_CONFIGURED");this.bigSegmentMatchContext(r.bigSegmentsMembership[a],e,t,r).then(n)})):(r.bigSegmentsStatus=os(r.bigSegmentsStatus,"NOT_CONFIGURED"),void n(ls(!1)));n(ls(!1))}bigSegmentMatchContext(e,t,r,i){const n=(0,Qn.default)(t),s=null==e?void 0:e[n];return new Promise(e=>{null==s?this.simpleSegmentMatchContext(t,r,i,[],e):e(ls(s))})}};var us={};Object.defineProperty(us,"__esModule",{value:!0});const ds=ee;us.default=class{constructor(e){this._contextKeysCache=new ds.default({max:e.contextKeysCapacity}),this.flushInterval=e.contextKeysFlushInterval}processContext(e){const{canonicalKey:t}=e,r=this._contextKeysCache.get(t);return this._contextKeysCache.set(t,!0),!r}flush(){this._contextKeysCache.clear()}};var hs={},fs={};Object.defineProperty(fs,"__esModule",{value:!0}),fs.default=function(e,t){if(t){if(t.inExperiment)return!0;switch(t.kind){case"RULE_MATCH":{const r=t.ruleIndex;if(void 0!==r){const t=e.rules||[];return r>=0&&r<t.length&&!!t[r].trackEvents}break}case"FALLTHROUGH":return!!e.trackEventsFallthrough}}return!1},Object.defineProperty(hs,"__esModule",{value:!0});const ps=o,vs=fs;class gs extends ps.internal.EventFactoryBase{evalEventServer(e,t,r,i,n){var s;const a=(0,vs.default)(e,r.reason);return super.evalEvent({addExperimentData:a,context:t,debugEventsUntilDate:e.debugEventsUntilDate,defaultVal:i,excludeFromSummaries:e.excludeFromSummaries,flagKey:e.key,prereqOfFlagKey:null==n?void 0:n.key,reason:r.reason,samplingRatio:e.samplingRatio,trackEvents:e.trackEvents||a,value:r.value,variation:null!==(s=r.variationIndex)&&void 0!==s?s:void 0,version:e.version})}}hs.default=gs;var _s={};Object.defineProperty(_s,"__esModule",{value:!0});_s.default=class{constructor(e,t){this._valid=e,this._withReasons=t,this._flagValues={},this._flagMetadata={}}addFlag(e,t,r,i,n,s,a,o){this._flagValues[e.key]=t;const l={};void 0!==r&&(l.variation=r);const c=a&&!n&&!s&&void 0===e.debugEventsUntilDate;c||(l.version=e.version),i&&(s||this._withReasons&&!c)&&(l.reason=i),n&&(l.trackEvents=!0),s&&(l.trackReason=!0),void 0!==e.debugEventsUntilDate&&(l.debugEventsUntilDate=e.debugEventsUntilDate),o&&o.length&&(l.prerequisites=o),this._flagMetadata[e.key]=l}build(){return{valid:this._valid,allValues:()=>this._flagValues,getFlagValue:e=>this._flagValues[e],getFlagReason:e=>{var t;return null!==(t=this._flagMetadata[e]?this._flagMetadata[e].reason:null)&&void 0!==t?t:null},toJSON:()=>Object.assign(Object.assign({},this._flagValues),{$flagsState:this._flagMetadata,$valid:this._valid})}}};var ys={};Object.defineProperty(ys,"__esModule",{value:!0});const ms="unknown hook";ys.default=class{constructor(e,t){this._logger=e,this._hooks=[],this._hooks.push(...t)}async withEvaluationSeries(e,t,r,i,n,s){return 0===this._hooks.length?n():this.withEvaluationSeriesExtraDetail(e,t,r,i,async()=>({detail:await n()}),s).then(({detail:e})=>e)}async withEvaluationSeriesExtraDetail(e,t,r,i,n,s){if(0===this._hooks.length)return n();const{hooks:a,hookContext:o}=this._prepareHooks(e,t,r,i,s),l=this._executeBeforeEvaluation(a,o),c=await n();return this._executeAfterEvaluation(a,o,l,c.detail),c}_tryExecuteStage(e,t,r){var i;try{return r()}catch(r){return null===(i=this._logger)||void 0===i||i.error(`An error was encountered in "${e}" of the "${t}" hook: ${r}`),{}}}_hookName(e){var t,r;try{return null!==(t=null==e?void 0:e.getMetadata().name)&&void 0!==t?t:ms}catch(e){return null===(r=this._logger)||void 0===r||r.error("Exception thrown getting metadata for hook. Unable to get hook name."),ms}}_executeAfterEvaluation(e,t,r,i){var n;for(let s=e.length-1;s>=0;s-=1){const a=e[s],o=null!==(n=r[s])&&void 0!==n?n:{};this._tryExecuteStage("afterEvaluation",this._hookName(a),()=>{var e,r;return null!==(r=null===(e=null==a?void 0:a.afterEvaluation)||void 0===e?void 0:e.call(a,t,o,i))&&void 0!==r?r:{}})}}_executeBeforeEvaluation(e,t){return e.map(e=>this._tryExecuteStage("beforeEvaluation",this._hookName(e),()=>{var r,i;return null!==(i=null===(r=null==e?void 0:e.beforeEvaluation)||void 0===r?void 0:r.call(e,t,{}))&&void 0!==i?i:{}}))}_prepareHooks(e,t,r,i,n){return{hooks:[...this._hooks],hookContext:{flagKey:e,context:t,defaultValue:r,method:i,environmentId:n}}}addHook(e){this._hooks.push(e)}};var bs={};Object.defineProperty(bs,"__esModule",{value:!0});const Ss=o;function Es(e){const t=e.old,r=e.new;return!(void 0!==t&&!Ss.TypeValidators.Boolean.is(t))&&!(void 0!==r&&!Ss.TypeValidators.Boolean.is(r))}function ws(e){if(Ss.TypeValidators.String.is(e.key)&&""!==e.key){if("latency_ms"===e.key){if(!Ss.TypeValidators.Object.is(e.values))return;if(!function(e){const t=e.old,r=e.new;return!(void 0!==t&&!Ss.TypeValidators.Number.is(t)||void 0!==r&&!Ss.TypeValidators.Number.is(r))}(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}if(function(e){return"error"===e.key}(e)){if(!Ss.TypeValidators.Object.is(e.values))return;if(!Es(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}if(function(e){return"consistent"===e.key}(e)){if(!Ss.TypeValidators.Boolean.is(e.value)||!Ss.TypeValidators.Number.is(e.samplingRatio))return;return{key:e.key,value:e.value,samplingRatio:e.samplingRatio}}if(function(e){return"invoked"===e.key}(e)){if(!Ss.TypeValidators.Object.is(e.values))return;if(!Es(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}}}bs.default=function(e){var t,r;if("migration_op"!==e.kind)return;if(r=e.operation,!Ss.TypeValidators.String.is(r)||"read"!==r&&"write"!==r)return;if(!Ss.TypeValidators.Number.is(e.creationDate))return;const i={};if(Ss.TypeValidators.Object.is(e.context)){const t=Ss.Context.fromLDContext(e.context);t.valid&&(i.context=t)}else Ss.TypeValidators.Object.is(e.contextKeys)&&Object.keys(e.contextKeys).every(e=>Ss.TypeValidators.Kind.is(e))&&Object.values(e.contextKeys).every(e=>Ss.TypeValidators.String.is(e)&&""!==e)&&(i.contextKeys=Object.assign({},e.contextKeys));if(!i.context&&!i.contextKeys)return;const n=null!==(t=e.samplingRatio)&&void 0!==t?t:1;if(!Ss.TypeValidators.Number.is(n))return;const s=function(e){if(!Ss.TypeValidators.String.is(e.key)||""===e.key)return;if(!Ss.TypeValidators.Object.is(e.reason))return;if(!Ss.TypeValidators.String.is(e.reason.kind)||""===e.reason.kind)return;const t={key:e.key,value:e.value,default:e.default,reason:{kind:e.reason.kind}},r=e.reason,i=t.reason;return Ss.TypeValidators.String.is(r.errorKind)&&(i.errorKind=r.errorKind),Ss.TypeValidators.String.is(r.ruleId)&&(i.ruleId=r.ruleId),Ss.TypeValidators.String.is(r.prerequisiteKey)&&(i.prerequisiteKey=r.prerequisiteKey),Ss.TypeValidators.Boolean.is(r.inExperiment)&&(i.inExperiment=r.inExperiment),Ss.TypeValidators.Number.is(r.ruleIndex)&&(i.ruleIndex=r.ruleIndex),Ss.TypeValidators.String.is(r.bigSegmentsStatus)&&(i.bigSegmentsStatus=r.bigSegmentsStatus),void 0!==e.variation&&Ss.TypeValidators.Number.is(e.variation)&&(t.variation=e.variation),void 0!==e.version&&Ss.TypeValidators.Number.is(e.version)&&(t.version=e.version),t}(e.evaluation);var a;return s?Object.assign(Object.assign({kind:e.kind,operation:e.operation,creationDate:e.creationDate},i),{measurements:(a=e.measurements,a.map(ws).filter(e=>void 0!==e)),evaluation:s,samplingRatio:n}):void 0};var ks={};Object.defineProperty(ks,"__esModule",{value:!0});const Os=o,xs=c;function Ds(e){return!Number.isNaN(e)}ks.default=class{constructor(e,t,r,i,n,s,a,o,l,c){this._flagKey=e,this._context=t,this._defaultStage=r,this._stage=i,this._reason=n,this._checkRatio=s,this._variation=a,this._version=o,this._samplingRatio=l,this._logger=c,this._errors={old:!1,new:!1},this._wasInvoked={old:!1,new:!1},this._consistencyCheck=xs.LDConsistencyCheck.NotChecked,this._latencyMeasurement={old:NaN,new:NaN}}op(e){this._operation=e}error(e){this._errors[e]=!0}consistency(e){var t,r;if(Os.internal.shouldSample(null!==(t=this._checkRatio)&&void 0!==t?t:1))try{const t=e();this._consistencyCheck=t?xs.LDConsistencyCheck.Consistent:xs.LDConsistencyCheck.Inconsistent}catch(e){null===(r=this._logger)||void 0===r||r.error(`Exception when executing consistency check function for migration '${this._flagKey}' the consistency check will not be included in the generated migration op event. Exception: ${e}`)}}latency(e,t){this._latencyMeasurement[e]=t}invoked(e){this._wasInvoked[e]=!0}createEvent(){var e,t,r,i,n;if(!Os.TypeValidators.String.is(this._flagKey)||""===this._flagKey)return void(null===(e=this._logger)||void 0===e||e.error("The flag key for a migration operation must be a non-empty string."));if(!this._operation)return void(null===(t=this._logger)||void 0===t||t.error('The operation must be set using "op" before an event can be created.'));if(!Os.Context.fromLDContext(this._context).valid)return void(null===(r=this._logger)||void 0===r||r.error("The migration was not done against a valid context and cannot generate an event."));if(!this._wasInvoked.old&&!this._wasInvoked.new)return void(null===(i=this._logger)||void 0===i||i.error('The migration invoked neither the "old" or "new" implementation andan event cannot be generated'));if(!this._measurementConsistencyCheck())return;const s=[];return this._populateInvoked(s),this._populateConsistency(s),this._populateLatency(s),this._populateErrors(s),{kind:"migration_op",operation:this._operation,creationDate:Date.now(),context:this._context,evaluation:{key:this._flagKey,value:this._stage,default:this._defaultStage,reason:this._reason,variation:this._variation,version:this._version},measurements:s,samplingRatio:null!==(n=this._samplingRatio)&&void 0!==n?n:1}}_logTag(){return`For migration ${this._operation}-${this._flagKey}:`}_latencyConsistencyMessage(e){return`Latency measurement for "${e}", but "${e}" was not invoked.`}_errorConsistencyMessage(e){return`Error occurred for "${e}", but "${e}" was not invoked.`}_consistencyCheckConsistencyMessage(e){return`Consistency check was done, but "${e}" was not invoked.Both "old" and "new" must be invoked to do a consistency check.`}_checkOriginEventConsistency(e){var t,r,i;return!!this._wasInvoked[e]||(Number.isNaN(this._latencyMeasurement[e])?this._errors[e]?(null===(r=this._logger)||void 0===r||r.error(`${this._logTag()} ${this._errorConsistencyMessage(e)}`),!1):this._consistencyCheck===xs.LDConsistencyCheck.NotChecked||(null===(i=this._logger)||void 0===i||i.error(`${this._logTag()} ${this._consistencyCheckConsistencyMessage(e)}`),!1):(null===(t=this._logger)||void 0===t||t.error(`${this._logTag()} ${this._latencyConsistencyMessage(e)}`),!1))}_measurementConsistencyCheck(){return this._checkOriginEventConsistency("old")&&this._checkOriginEventConsistency("new")}_populateInvoked(e){var t;const r={key:"invoked",values:{}};this._wasInvoked.old||this._wasInvoked.new||null===(t=this._logger)||void 0===t||t.error("Migration op completed without executing any origins (old/new)."),this._wasInvoked.old&&(r.values.old=!0),this._wasInvoked.new&&(r.values.new=!0),e.push(r)}_populateConsistency(e){var t;void 0!==this._consistencyCheck&&this._consistencyCheck!==xs.LDConsistencyCheck.NotChecked&&e.push({key:"consistent",value:this._consistencyCheck===xs.LDConsistencyCheck.Consistent,samplingRatio:null!==(t=this._checkRatio)&&void 0!==t?t:1})}_populateErrors(e){if(this._errors.new||this._errors.old){const t={key:"error",values:{}};this._errors.new&&(t.values.new=!0),this._errors.old&&(t.values.old=!0),e.push(t)}}_populateLatency(e){const t=Ds(this._latencyMeasurement.new),r=Ds(this._latencyMeasurement.old);if(t||r){const i={};t&&(i.new=this._latencyMeasurement.new),r&&(i.old=this._latencyMeasurement.old),e.push({key:"latency_ms",values:i})}}},Object.defineProperty(a,"__esModule",{value:!0});const Ps=o,Rs=l,Is=P,Ts=Q,As=ne,Ms=se,Cs=ae,Fs=be,Ls=Pe,js=Me,Ns=Le,$s=gt,Bs=mt,Vs=St,zs=wt,Hs=xt,Us=Tt,Ks=Lt,qs=Nt,Ws=Ht,Gs=us,Xs=hs,Js=fs,Ys=_s,Zs=ys,Qs=bs,ea=ks,ta=At,ra=le,{ClientMessages:ia,ErrorKinds:na,NullEventProcessor:sa}=Ps.internal;var aa;!function(e){e[e.Initializing=0]="Initializing",e[e.Initialized=1]="Initialized",e[e.Failed=2]="Failed"}(aa||(aa={}));function oa(e,t,r,i,n,s,a){var o,l,c,u,d;const{onUpdate:h,hasEventListeners:f}=i,p=new Zs.default(r.logger,a);if(!e&&!r.offline)throw new Error("You must configure the client with an SDK key");const{logger:v}=r,g=(0,Ps.defaultHeaders)(e,t.info,r.tags),_=new Ps.ClientContext(e,r,t),y=r.featureStoreFactory(_),m=new Fs.default(y,f,h);let b,S;!r.sendEvents||r.offline||r.diagnosticOptOut||(b=new Ps.internal.DiagnosticsManager(e,t,(0,Us.default)(r,t,y))),S=!r.sendEvents||r.offline?new sa:new Ps.internal.EventProcessor(r,_,g,new Gs.default(r),b);const E=new Ts.default(null===(l=null===(o=r.bigSegments)||void 0===o?void 0:o.store)||void 0===l?void 0:l.call(o,_),null!==(c=r.bigSegments)&&void 0!==c?c:{},r.logger,t.crypto),w={getFlag(e,t){y.get(ra.default.Features,e,e=>t(e))},getSegment(e,t){y.get(ra.default.Segments,e,e=>t(e))},getBigSegmentsMembership:e=>E.getUserMembership(e)},k=new Ws.default(t,w),O=(0,Cs.createStreamListeners)(m,v,{put:n});let x;return r.offline||r.useLdd||(x=null!==(d=null===(u=r.updateProcessorFactory)||void 0===u?void 0:u.call(r,_,m,n,s))&&void 0!==d?d:r.stream?new Vs.default(_,"/all",[],O,g,b,s,r.streamInitialReconnectDelay):new Ns.default(new Bs.default(r,t.requests,g),r.pollInterval,m,r.logger,n,s)),{config:r,logger:v,evaluator:k,featureStore:y,updateProcessor:x,eventProcessor:S,bigSegmentsManager:E,hookRunner:p,onError:i.onError,onFailed:i.onFailed,onReady:i.onReady}}a.default=class{get logger(){return this._logger}constructor(e,t,r,i,n){this._sdkKey=e,this._platform=t,this._initState=aa.Initializing,this._eventFactoryDefault=new Xs.default(!1),this._eventFactoryWithReasons=new Xs.default(!0);const s=new ta.default(r,n);this.environmentMetadata=(0,As.createPluginEnvironmentMetadata)(t,e,s);const a=[];if(s.hooks&&a.push(...s.hooks),s.getImplementationHooks(this.environmentMetadata).forEach(e=>{a.push(e)}),s.dataSystem){let r,n;({config:this._config,logger:this._logger,evaluator:this._evaluator,featureStore:r,dataSource:this._dataSource,payloadListener:n,eventProcessor:this._eventProcessor,bigSegmentsManager:this._bigSegmentsManager,hookRunner:this._hookRunner,onError:this._onError,onFailed:this._onFailed,onReady:this._onReady}=function(e,t,r,i,n,s){var a,o,l,c;const{onUpdate:u,hasEventListeners:d}=i,h=new Zs.default(r.logger,s);if(!e&&!r.offline)throw new Error("You must configure the client with an SDK key");const{logger:f}=r,p=(0,Ps.defaultHeaders)(e,t.info,r.tags),v=new Ps.ClientContext(e,r,t),g=r.dataSystem,_=g.featureStoreFactory(v),y=new Hs.default(_,d,u);let m,b;!r.sendEvents||r.offline||r.diagnosticOptOut||(m=new Ps.internal.DiagnosticsManager(e,t,(0,Us.default)(r,t,_))),b=!r.sendEvents||r.offline?new sa:new Ps.internal.EventProcessor(r,v,p,new Gs.default(r),m);const S=new Ts.default(null===(o=null===(a=r.bigSegments)||void 0===a?void 0:a.store)||void 0===o?void 0:o.call(a,v),null!==(l=r.bigSegments)&&void 0!==l?l:{},r.logger,t.crypto),E={getFlag(e,t){_.get(ra.default.Features,e,e=>t(e))},getSegment(e,t){_.get(ra.default.Segments,e,e=>t(e))},getBigSegmentsMembership:e=>S.getUserMembership(e)},w=new Ws.default(t,E);let k,O;if(!r.offline&&!r.dataSystem.useLdd){const e=[],i=[],s=[];if((0,Is.isCustomOptions)(g.dataSource)){const{initializers:n=[],synchronizers:s=[]}=g.dataSource;n.forEach(i=>{switch(i.type){case"file":e.push(()=>new Ls.default(i,t,r.logger));break;case"polling":e.push(()=>new js.default(new Bs.default(r,t.requests,p,"/sdk/poll",r.logger),r.logger));break;default:throw new Error("Unsupported initializer type")}}),s.forEach(e=>{switch(e.type){case"streaming":{const{streamInitialReconnectDelay:t=ta.DEFAULT_STREAM_RECONNECT_DELAY}=e;i.push(()=>new zs.default(v,"/sdk/stream",[],p,m,t));break}case"polling":{const{pollInterval:n=ta.DEFAULT_POLL_INTERVAL}=e;i.push(()=>new $s.default(new Bs.default(r,t.requests,p,"/sdk/poll",r.logger),n,r.logger));break}default:throw new Error("Unsupported synchronizer type")}})}else{if((0,Is.isStandardOptions)(g.dataSource)&&e.push(()=>new js.default(new Bs.default(r,t.requests,p,"/sdk/poll",r.logger),r.logger)),(0,Is.isStandardOptions)(g.dataSource)||(0,Is.isStreamingOnlyOptions)(g.dataSource)){const e=g.dataSource.streamInitialReconnectDelay;i.push(()=>new zs.default(v,"/sdk/stream",[],p,m,e))}let n=ta.DEFAULT_POLL_INTERVAL;((0,Is.isStandardOptions)(g.dataSource)||(0,Is.isPollingOnlyOptions)(g.dataSource))&&(n=null!==(c=g.dataSource.pollInterval)&&void 0!==c?c:ta.DEFAULT_POLL_INTERVAL,i.push(()=>new $s.default(new Bs.default(r,t.requests,p,"/sdk/poll",f),n,f))),s.push(()=>new $s.default(new Bs.default(r,t.requests,p,"/sdk/latest-all",r.logger),n,r.logger,!0))}k=new Ps.CompositeDataSource(e,i,s,f),O=(0,Ms.createPayloadListener)(y,f,n)}return{config:r,logger:f,evaluator:w,featureStore:_,dataSource:k,payloadListener:O,eventProcessor:b,bigSegmentsManager:S,hookRunner:h,onError:i.onError,onFailed:i.onFailed,onReady:i.onReady}}(e,t,s,i,()=>this._initSuccess(),a)),this._featureStore=r,this.bigSegmentStatusProviderInternal=this._bigSegmentsManager.statusProvider,this._dataSource&&this._dataSource.start((e,t)=>{null==n||n(t)},(e,t)=>{e===Ps.subsystem.DataSourceState.Closed&&t&&this._dataSourceErrorHandler(t)},()=>{var e;return null===(e=r.getSelector)||void 0===e?void 0:e.call(r)})}else({config:this._config,logger:this._logger,evaluator:this._evaluator,featureStore:this._featureStore,updateProcessor:this._updateProcessor,eventProcessor:this._eventProcessor,bigSegmentsManager:this._bigSegmentsManager,hookRunner:this._hookRunner,onError:this._onError,onFailed:this._onFailed,onReady:this._onReady}=oa(e,t,s,i,()=>this._initSuccess(),e=>this._dataSourceErrorHandler(e),a)),this.bigSegmentStatusProviderInternal=this._bigSegmentsManager.statusProvider,this._updateProcessor&&this._updateProcessor.start()}initialized(){return this._initState===aa.Initialized}waitForInitialization(e){var t,r;return void 0!==(null==e?void 0:e.timeout)||void 0===this._updateProcessor&&void 0===this._dataSource||null===(t=this._logger)||void 0===t||t.warn("The waitForInitialization function was called without a timeout specified. In a future version a default timeout will be applied."),void 0!==(null==e?void 0:e.timeout)&&(null==e?void 0:e.timeout)>60&&(void 0!==this._updateProcessor||void 0!==this._dataSource)&&(null===(r=this._logger)||void 0===r||r.warn("The waitForInitialization function was called with a timeout greater than 60 seconds. We recommend a timeout of less than 60 seconds.")),this._initializedPromise?this._clientWithTimeout(this._initializedPromise,null==e?void 0:e.timeout,this._logger):this._initState===aa.Initialized?(this._initializedPromise=Promise.resolve(this),this._initializedPromise):this._initState===aa.Failed?(this._initializedPromise=Promise.reject(this._rejectionReason),this._initializedPromise):(this._initializedPromise||(this._initializedPromise=new Promise((e,t)=>{this._initResolve=e,this._initReject=t})),this._clientWithTimeout(this._initializedPromise,null==e?void 0:e.timeout,this._logger))}variation(e,t,r,i){var n,s,a;return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.variation",()=>new Promise(i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryDefault,e=>{i(e.detail)})}),null===(a=null===(s=(n=this._featureStore).getInitMetaData)||void 0===s?void 0:s.call(n))||void 0===a?void 0:a.environmentId).then(e=>(null==i||i(null,e.value),e.value))}variationDetail(e,t,r,i){var n,s,a;return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.variationDetail",()=>new Promise(n=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,e=>{n(e.detail),null==i||i(null,e.detail)})}),null===(a=null===(s=(n=this._featureStore).getInitMetaData)||void 0===s?void 0:s.call(n))||void 0===a?void 0:a.environmentId)}_typedEval(e,t,r,i,n,s){var a,o,l;return this._hookRunner.withEvaluationSeries(e,t,r,n,()=>new Promise(n=>{this._evaluateIfPossible(e,t,r,i,e=>{const t={value:e.detail.value,reason:e.detail.reason,variationIndex:e.detail.variationIndex};n(t)},s)}),null===(l=null===(o=(a=this._featureStore).getInitMetaData)||void 0===o?void 0:o.call(a))||void 0===l?void 0:l.environmentId)}async boolVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.boolVariation",e=>[Ps.TypeValidators.Boolean.is(e),Ps.TypeValidators.Boolean.getType()])).value}async numberVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.numberVariation",e=>[Ps.TypeValidators.Number.is(e),Ps.TypeValidators.Number.getType()])).value}async stringVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.stringVariation",e=>[Ps.TypeValidators.String.is(e),Ps.TypeValidators.String.getType()])).value}jsonVariation(e,t,r){var i,n,s;return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.jsonVariation",()=>new Promise(i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryDefault,e=>{i(e.detail)})}),null===(s=null===(n=(i=this._featureStore).getInitMetaData)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.environmentId).then(e=>e.value)}boolVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.boolVariationDetail",e=>[Ps.TypeValidators.Boolean.is(e),Ps.TypeValidators.Boolean.getType()])}numberVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.numberVariationDetail",e=>[Ps.TypeValidators.Number.is(e),Ps.TypeValidators.Number.getType()])}stringVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.stringVariationDetail",e=>[Ps.TypeValidators.String.is(e),Ps.TypeValidators.String.getType()])}jsonVariationDetail(e,t,r){var i,n,s;return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.jsonVariationDetail",()=>new Promise(i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,e=>{i(e.detail)})}),null===(s=null===(n=(i=this._featureStore).getInitMetaData)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.environmentId)}async _migrationVariationInternal(e,t,r){var i;const n=await new Promise(i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,({detail:t},n)=>{if(!(0,Rs.IsMigrationStage)(t.value)){const t=new Error(`Unrecognized MigrationState for "${e}"; returning default value.`);this._onError(t);const s={kind:"ERROR",errorKind:na.WrongType};return void i({detail:{value:r,reason:s},flag:n})}i({detail:t,flag:n})})}),{detail:s,flag:a}=n,o=null===(i=null==a?void 0:a.migration)||void 0===i?void 0:i.checkRatio,l=null==a?void 0:a.samplingRatio;return{detail:s,migration:{value:s.value,tracker:new ea.default(e,t,r,s.value,s.reason,o,null===s.variationIndex?void 0:s.variationIndex,null==a?void 0:a.version,l,this._logger)}}}async migrationVariation(e,t,r){var i,n,s;return(await this._hookRunner.withEvaluationSeriesExtraDetail(e,t,r,"LDClient.migrationVariation",()=>this._migrationVariationInternal(e,t,r),null===(s=null===(n=(i=this._featureStore).getInitMetaData)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.environmentId)).migration}allFlagsState(e,t,r){var i,n,s;if(this._config.offline){null===(i=this._logger)||void 0===i||i.info("allFlagsState() called in offline mode. Returning empty state.");const e=new Ys.default(!1,!1).build();return null==r||r(null,e),Promise.resolve(e)}const a=Ps.Context.fromLDContext(e);return a.valid?new Promise(e=>{const i=i=>this._featureStore.all(ra.default.Features,n=>{const s=new Ys.default(i,!!(null==t?void 0:t.withReasons)),o=!!(null==t?void 0:t.clientSideOnly),l=!!(null==t?void 0:t.detailsOnlyForTrackedFlags);(0,Ks.allAsync)(Object.values(n),(e,t)=>{var r;const i=e;!o||(null===(r=i.clientSideAvailability)||void 0===r?void 0:r.usingEnvironmentId)?this._evaluator.evaluateCb(i,a,e=>{var r;e.isError&&this._onError(new Error(`Error for feature flag "${i.key}" while evaluating all flags: ${e.message}`));const n=(0,Js.default)(i,e.detail.reason);s.addFlag(i,e.detail.value,null!==(r=e.detail.variationIndex)&&void 0!==r?r:void 0,e.detail.reason,i.trackEvents||n,n,l,e.prerequisites),t(!0)}):t(!0)},()=>{const t=s.build();null==r||r(null,t),e(t)})});this.initialized()?i(!0):this._featureStore.initialized(e=>{var t,r;let n=!0;e?null===(t=this._logger)||void 0===t||t.warn("Called allFlagsState before client initialization; using last known values from data store"):(null===(r=this._logger)||void 0===r||r.warn("Called allFlagsState before client initialization. Data store not available; returning empty state"),n=!1),i(n)})}):(null===(n=this._logger)||void 0===n||n.info(`${null!==(s=a.message)&&void 0!==s?s:"Invalid context."}. Returning empty state.`),Promise.resolve(new Ys.default(!1,!1).build()))}secureModeHash(e){const t=Ps.Context.fromLDContext(e),r=t.valid?t.canonicalKey:void 0;if(!this._platform.crypto.createHmac)throw new Error("Platform must implement createHmac");const i=this._platform.crypto.createHmac("sha256",this._sdkKey);if(void 0===r)throw new Ps.LDClientError("Could not generate secure mode hash for invalid context");return i.update(r),i.digest("hex")}close(){var e,t;this._eventProcessor.close(),null===(e=this._updateProcessor)||void 0===e||e.close(),null===(t=this._dataSource)||void 0===t||t.stop(),this._featureStore.close(),this._bigSegmentsManager.close()}isOffline(){return this._config.offline}track(e,t,r,i){var n,s;const a=Ps.Context.fromLDContext(t);a.valid?(void 0===i||Ps.TypeValidators.Number.is(i)||null===(s=this._logger)||void 0===s||s.warn(ia.invalidMetricValue(typeof i)),this._eventProcessor.sendEvent(this._eventFactoryDefault.customEvent(e,a,r,i))):null===(n=this._logger)||void 0===n||n.warn(ia.MissingContextKeyNoEvent)}trackMigration(e){const t=(0,Qs.default)(e);t&&this._eventProcessor.sendEvent(t)}identify(e){var t;const r=Ps.Context.fromLDContext(e);r.valid?this._eventProcessor.sendEvent(this._eventFactoryDefault.identifyEvent(r)):null===(t=this._logger)||void 0===t||t.warn(ia.MissingContextKeyNoEvent)}async flush(e){try{await this._eventProcessor.flush()}catch(t){return null==e?void 0:e(t,!1)}return null==e?void 0:e(null,!0)}addHook(e){this._hookRunner.addHook(e)}_variationInternal(e,t,r,i,n,s){var a,o;if(this._config.offline)return null===(a=this._logger)||void 0===a||a.info("Variation called in offline mode. Returning default value."),void n(qs.default.forError(na.ClientNotReady,void 0,r));const l=Ps.Context.fromLDContext(t);if(!l.valid)return this._onError(new Ps.LDClientError(`${null!==(o=l.message)&&void 0!==o?o:"Context not valid;"} returning default value.`)),void n(qs.default.forError(na.UserNotSpecified,void 0,r));this._featureStore.get(ra.default.Features,e,t=>{const a=t;if(!a){const t=new Ps.LDClientError(`Unknown feature flag "${e}"; returning default value`);this._onError(t);const i=qs.default.forError(na.FlagNotFound,void 0,r);return this._eventProcessor.sendEvent(this._eventFactoryDefault.unknownFlagEvent(e,r,l)),void n(i)}this._evaluator.evaluateCb(a,l,t=>{var o;if(void 0!==t.detail.variationIndex&&null!==t.detail.variationIndex||(null===(o=this._logger)||void 0===o||o.debug("Result value is null in variation"),t.setDefault(r)),s){const[o,c]=s(t.detail.value);if(!o){const t=qs.default.forError(na.WrongType,`Did not receive expected type (${c}) evaluating feature flag "${e}"`,r);return this._sendEvalEvent(t,i,a,l,r),void n(t,a)}}this._sendEvalEvent(t,i,a,l,r),n(t,a)},i)})}_sendEvalEvent(e,t,r,i,n){var s;null===(s=e.events)||void 0===s||s.forEach(e=>{this._eventProcessor.sendEvent(Object.assign({},e))}),this._eventProcessor.sendEvent(t.evalEventServer(r,i,e.detail,n,void 0))}_evaluateIfPossible(e,t,r,i,n,s){this.initialized()?this._variationInternal(e,t,r,i,n,s):this._featureStore.initialized(a=>{var o,l;if(a)return null===(o=this._logger)||void 0===o||o.warn("Variation called before LaunchDarkly client initialization completed (did you wait for the 'ready' event?) - using last known values from feature store"),void this._variationInternal(e,t,r,i,n,s);null===(l=this._logger)||void 0===l||l.warn("Variation called before LaunchDarkly client initialization completed (did you wait for the'ready' event?) - using default value"),n(qs.default.forError(na.ClientNotReady,void 0,r))})}_dataSourceErrorHandler(e){var t;const r=401===e.code?new Error("Authentication failed. Double check your SDK key."):e;this._onError(r),this._onFailed(r),this.initialized()||(this._initState=aa.Failed,this._rejectionReason=r,null===(t=this._initReject)||void 0===t||t.call(this,r))}_initSuccess(){var e;this.initialized()||(this._initState=aa.Initialized,null===(e=this._initResolve)||void 0===e||e.call(this,this),this._onReady())}_clientWithTimeout(e,t,r){if(t){const i=(0,Ps.cancelableTimedPromise)(t,"waitForInitialization");return Promise.race([e.then(()=>this),i.promise.then(()=>this)]).catch(e=>{throw e instanceof Ps.LDTimeoutError&&(null==r||r.error(e.message)),e}).finally(()=>i.cancel())}return e}};var la={};Object.defineProperty(la,"__esModule",{value:!0}),la.createMigration=la.LDMigrationError=la.LDMigrationSuccess=void 0;const ca=l,ua=D;la.LDMigrationSuccess=function(e){return{success:!0,result:e}},la.LDMigrationError=function(e){return{success:!1,error:e}};class da{constructor(e,t){var r,i;this._client=e,this._config=t,this._readTable={[ca.LDMigrationStage.Off]:async e=>this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),[ca.LDMigrationStage.DualWrite]:async e=>this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),[ca.LDMigrationStage.Shadow]:async e=>{const{fromOld:t,fromNew:r}=await this._doRead(e);return this._trackConsistency(e,t,r),t},[ca.LDMigrationStage.Live]:async e=>{const{fromNew:t,fromOld:r}=await this._doRead(e);return this._trackConsistency(e,r,t),t},[ca.LDMigrationStage.RampDown]:async e=>this._doSingleOp(e,"new",this._config.readNew.bind(this._config)),[ca.LDMigrationStage.Complete]:async e=>this._doSingleOp(e,"new",this._config.readNew.bind(this._config))},this._writeTable={[ca.LDMigrationStage.Off]:async e=>({authoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}),[ca.LDMigrationStage.DualWrite]:async e=>{const t=await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config))}},[ca.LDMigrationStage.Shadow]:async e=>{const t=await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config))}},[ca.LDMigrationStage.Live]:async e=>{const t=await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}},[ca.LDMigrationStage.RampDown]:async e=>{const t=await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}},[ca.LDMigrationStage.Complete]:async e=>({authoritative:await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config))})},this._config.execution?this._execution=this._config.execution:this._execution=new ua.LDConcurrentExecution,this._latencyTracking=null===(r=this._config.latencyTracking)||void 0===r||r,this._errorTracking=null===(i=this._config.errorTracking)||void 0===i||i}async read(e,t,r,i){const n=await this._client.migrationVariation(e,t,r),s=await this._readTable[n.value]({payload:i,tracker:n.tracker});return n.tracker.op("read"),this._sendEvent(n.tracker),s}async write(e,t,r,i){const n=await this._client.migrationVariation(e,t,r),s=await this._writeTable[n.value]({payload:i,tracker:n.tracker});return n.tracker.op("write"),this._sendEvent(n.tracker),s}_sendEvent(e){const t=e.createEvent();t&&this._client.trackMigration(t)}_trackConsistency(e,t,r){this._config.check&&t.success&&r.success&&e.tracker.consistency(()=>this._config.check(t.result,r.result))}async _readSequentialFixed(e){return{fromOld:await this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),fromNew:await this._doSingleOp(e,"new",this._config.readNew.bind(this._config))}}async _readConcurrent(e){const t=this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),r=this._doSingleOp(e,"new",this._config.readNew.bind(this._config)),[i,n]=await Promise.all([t,r]);return{fromOld:i,fromNew:n}}async _readSequentialRandom(e){if(0===Math.floor(2*Math.random())){return{fromOld:await this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),fromNew:await this._doSingleOp(e,"new",this._config.readNew.bind(this._config))}}const t=await this._doSingleOp(e,"new",this._config.readNew.bind(this._config));return{fromOld:await this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),fromNew:t}}async _doRead(e){var t;if((null===(t=this._execution)||void 0===t?void 0:t.type)===ua.LDExecution.Serial){return this._execution.ordering===ua.LDExecutionOrdering.Fixed?this._readSequentialFixed(e):this._readSequentialRandom(e)}return this._readConcurrent(e)}async _doSingleOp(e,t,r){e.tracker.invoked(t);const i=await this._trackLatency(e.tracker,t,()=>async function(e){try{return await e()}catch(e){return{success:!1,error:e}}}(()=>r(e.payload)));return!i.success&&this._errorTracking&&e.tracker.error(t),Object.assign({origin:t},i)}async _trackLatency(e,t,r){if(!this._latencyTracking)return r();let i,n,s;"undefined"!=typeof performance?(i=performance.now(),s=await r(),n=performance.now()):(i=Date.now(),s=await r(),n=Date.now());const a=n-i;return e.latency(t,a),s}}la.createMigration=function(e,t){return new da(e,t)};var ha={},fa={},pa={};Object.defineProperty(pa,"__esModule",{value:!0});const va=oe,ga=le,_a=Re;pa.default=class{constructor(e,t,r,i=()=>{},n){var s;this._featureStore=r,this._initSuccessHandler=i,this._errorHandler=n,this._allData={},this._fileLoader=new _a.default(t,e.paths,null!==(s=e.autoUpdate)&&void 0!==s&&s,e=>{var t,r;try{this._processFileData(e)}catch(e){null===(t=this._errorHandler)||void 0===t||t.call(this,e),null===(r=this._logger)||void 0===r||r.error(`Error processing files: ${e}`)}}),this._logger=e.logger,this._yamlParser=e.yamlParser}start(){(async()=>{var e;try{await this._fileLoader.loadAndWatch()}catch(t){null===(e=this._errorHandler)||void 0===e||e.call(this,t)}})()}stop(){this._fileLoader.close()}close(){this.stop()}_addItem(e,t){if(this._allData[e.namespace]||(this._allData[e.namespace]={}),this._allData[e.namespace][t.key])throw new Error(`found duplicate key: "${t.key}"`);this._allData[e.namespace][t.key]=t}_processFileData(e){const t=this._allData;this._allData={},e.forEach(e=>{let r;if(e.path.endsWith(".yml")||e.path.endsWith(".yaml")){if(!this._yamlParser)throw new Error(`Attempted to parse yaml file (${e.path}) without parser.`);r=this._yamlParser(e.data)}else r=JSON.parse(e.data);this._processParsedData(r,t)}),this._featureStore.init(this._allData,()=>{this._initSuccessHandler(),this._initSuccessHandler=()=>{}})}_processParsedData(e,t){Object.keys(e.flags||{}).forEach(t=>{(0,va.processFlag)(e.flags[t]),this._addItem(ga.default.Features,e.flags[t])}),Object.keys(e.flagValues||{}).forEach(r=>{var i,n;const s=null===(i=t[ga.default.Features.namespace])||void 0===i?void 0:i[r];let{version:a}=null!=s?s:{version:1};s&&JSON.stringify(e.flagValues[r])!==JSON.stringify(null===(n=null==s?void 0:s.variations)||void 0===n?void 0:n[0])&&(a+=1);const o=function(e,t,r){return{key:e,on:!0,fallthrough:{variation:0},variations:[t],version:r}}(r,e.flagValues[r],a);(0,va.processFlag)(o),this._addItem(ga.default.Features,o)}),Object.keys(e.segments||{}).forEach(t=>{(0,va.processSegment)(e.segments[t]),this._addItem(ga.default.Segments,e.segments[t])})}},Object.defineProperty(fa,"__esModule",{value:!0});const ya=pa;fa.default=class{constructor(e){this._options=e}create(e,t,r,i){const n={paths:this._options.paths,autoUpdate:this._options.autoUpdate,logger:this._options.logger||e.basicConfiguration.logger,yamlParser:this._options.yamlParser};return new ya.default(n,e.platform.fileSystem,t,r,i)}getFactory(){return(e,t,r,i)=>this.create(e,t,r,i)}};var ma={},ba={},Sa={},Ea={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.variationForBoolean=e.FALSE_VARIATION_INDEX=e.TRUE_VARIATION_INDEX=void 0,e.TRUE_VARIATION_INDEX=0,e.FALSE_VARIATION_INDEX=1,e.variationForBoolean=function(t){return t?e.TRUE_VARIATION_INDEX:e.FALSE_VARIATION_INDEX}}(Ea);var wa={};Object.defineProperty(wa,"__esModule",{value:!0});const ka=o,Oa=Ea;class xa{constructor(e,t,r){this._flagBuilder=e,this._clauses=[],t&&(this._clauses=[...t]),void 0!==r&&(this._variation=r)}andMatch(e,t,...r){return this._clauses.push({contextKind:e,attribute:t,attributeReference:new ka.AttributeReference(t),op:"in",values:r,negate:!1}),this}andNotMatch(e,t,...r){return this._clauses.push({contextKind:e,attribute:t,attributeReference:new ka.AttributeReference(t),op:"in",values:r,negate:!0}),this}thenReturn(e){return ka.TypeValidators.Boolean.is(e)?(this._flagBuilder.booleanFlag(),this.thenReturn((0,Oa.variationForBoolean)(e))):(this._variation=e,this._flagBuilder.addRule(this),this._flagBuilder)}build(e){return{id:`rule${e}`,variation:this._variation,clauses:this._clauses}}clone(){return new xa(this._flagBuilder,this._clauses,this._variation)}}wa.default=xa,Object.defineProperty(Sa,"__esModule",{value:!0});const Da=o,Pa=Ea,Ra=wa;class Ia{constructor(e,t){this._key=e,this._data={on:!0,variations:[]},t&&(this._data={on:t.on,variations:[...t.variations]},void 0!==t.offVariation&&(this._data.offVariation=t.offVariation),void 0!==t.fallthroughVariation&&(this._data.fallthroughVariation=t.fallthroughVariation),t.targetsByVariation&&(this._data.targetsByVariation=JSON.parse(JSON.stringify(t.targetsByVariation))),t.rules&&(this._data.rules=[],t.rules.forEach(e=>{var t;null===(t=this._data.rules)||void 0===t||t.push(e.clone())})))}get _isBooleanFlag(){return 2===this._data.variations.length&&!0===this._data.variations[Pa.TRUE_VARIATION_INDEX]&&!1===this._data.variations[Pa.FALSE_VARIATION_INDEX]}booleanFlag(){return this._isBooleanFlag?this:this.variations(!0,!1).fallthroughVariation(Pa.TRUE_VARIATION_INDEX).offVariation(Pa.FALSE_VARIATION_INDEX)}variations(...e){return this._data.variations=[...e],this}on(e){return this._data.on=e,this}fallthroughVariation(e){return Da.TypeValidators.Boolean.is(e)?this.booleanFlag().fallthroughVariation((0,Pa.variationForBoolean)(e)):(this._data.fallthroughVariation=e,this)}offVariation(e){return Da.TypeValidators.Boolean.is(e)?this.booleanFlag().offVariation((0,Pa.variationForBoolean)(e)):(this._data.offVariation=e,this)}variationForAll(e){return this.on(!0).clearRules().clearAllTargets().fallthroughVariation(e)}valueForAll(e){return this.variations(e).variationForAll(0)}variationForUser(e,t){return this.variationForContext("user",e,t)}variationForContext(e,t,r){return Da.TypeValidators.Boolean.is(r)?this.booleanFlag().variationForContext(e,t,(0,Pa.variationForBoolean)(r)):(this._data.targetsByVariation||(this._data.targetsByVariation={}),this._data.variations.forEach((i,n)=>{if(n===r){const r=this._data.targetsByVariation[n]||{};e in r||(r[e]=[]);-1!==r[e].indexOf(t)||r[e].push(t),this._data.targetsByVariation[n]=r}else{const r=this._data.targetsByVariation[n];if(r){const i=r[e];if(i){const n=i.indexOf(t);-1!==n&&(i.splice(n,1),i.length||delete r[e])}Object.keys(r).length||delete this._data.targetsByVariation[n]}}}),this)}clearRules(){return delete this._data.rules,this}clearAllTargets(){return delete this._data.targetsByVariation,this}ifMatch(e,t,...r){return new Ra.default(this).andMatch(e,t,...r)}ifNotMatch(e,t,...r){return new Ra.default(this).andNotMatch(e,t,...r)}checkRatio(e){var t;return this._data.migration=null!==(t=this._data.migration)&&void 0!==t?t:{},this._data.migration.checkRatio=e,this}samplingRatio(e){return this._data.samplingRatio=e,this}addRule(e){this._data.rules||(this._data.rules=[]),this._data.rules.push(e)}build(e){const t={key:this._key,version:e,on:this._data.on,offVariation:this._data.offVariation,fallthrough:{variation:this._data.fallthroughVariation},variations:[...this._data.variations],migration:this._data.migration,samplingRatio:this._data.samplingRatio};if(this._data.targetsByVariation){const e=[],r=[];Object.entries(this._data.targetsByVariation).forEach(([t,i])=>{Object.entries(i).forEach(([i,n])=>{const s=parseInt(t,10);e.push({contextKind:i,values:"user"===i?[]:n,variation:s}),"user"===i&&r.push({values:n,variation:s})})}),t.targets=r,t.contextTargets=e}return this._data.rules&&(t.rules=this._data.rules.map((e,t)=>e.build(String(t)))),t}clone(){return new Ia(this._key,this._data)}getKey(){return this._key}}Sa.default=Ia;var Ta={};Object.defineProperty(Ta,"__esModule",{value:!0});Ta.default=class{constructor(e,t,r,i,n){this._featureStore=e,this._onStop=i,this._listeners=n,this._flags=Object.assign({},t),this._segments=Object.assign({},r)}async start(){this._listeners.forEach(({processJson:e})=>{e({data:{flags:this._flags,segments:this._segments}})})}stop(){this._onStop(this)}close(){this.stop()}async upsert(e,t){return this._featureStore.upsert(e,t)}},Object.defineProperty(ba,"__esModule",{value:!0});const Aa=ae,Ma=Ne,Ca=oe,Fa=le,La=Sa,ja=Ta;ba.default=class{constructor(){this._currentFlags={},this._currentSegments={},this._dataSources=[],this._flagBuilders={}}getFactory(){return(e,t,r,i)=>{const n=(0,Aa.createStreamListeners)(t,e.basicConfiguration.logger,{put:r}),s=new ja.default(new Ma.default(t),this._currentFlags,this._currentSegments,e=>{this._dataSources.splice(this._dataSources.indexOf(e))},n);return this._dataSources.push(s),s}}flag(e){return this._flagBuilders[e]?this._flagBuilders[e].clone():new La.default(e).booleanFlag()}update(e){const t=e.getKey(),r=this._currentFlags[t],i=r?r.version:0,n=e.build(i+1);return this._currentFlags[t]=n,this._flagBuilders[t]=e.clone(),Promise.all(this._dataSources.map(e=>e.upsert(Fa.default.Features,n)))}usePreconfiguredFlag(e){const t=JSON.parse(JSON.stringify(e)),r=this._currentFlags[t.key],i=Object.assign(Object.assign({},t),{version:r?r.version+1:t.version});return(0,Ca.processFlag)(i),this._currentFlags[t.key]=i,Promise.all(this._dataSources.map(e=>e.upsert(Fa.default.Features,i)))}usePreconfiguredSegment(e){const t=JSON.parse(JSON.stringify(e)),r=this._currentSegments[t.key],i=Object.assign(Object.assign({},t),{version:r?r.version+1:t.version});return(0,Ca.processSegment)(i),this._currentSegments[t.key]=i,Promise.all(this._dataSources.map(e=>e.upsert(Fa.default.Segments,i)))}},Object.defineProperty(ma,"__esModule",{value:!0}),ma.TestDataRuleBuilder=ma.TestDataFlagBuilder=ma.TestData=void 0;const Na=ba;ma.TestData=Na.default;const $a=Sa;ma.TestDataFlagBuilder=$a.default;const Ba=wa;ma.TestDataRuleBuilder=Ba.default,function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.FileDataSourceFactory=void 0;const n=fa;e.FileDataSourceFactory=n.default,i(ma,e),i(F,e)}(ha);var Va={},za={};Object.defineProperty(za,"__esModule",{value:!0});za.default=class{constructor(e,t){this.handlers={},this.closed=!1,this.url=e,this.options=t}addEventListener(e,t){this.handlers[e]=t}close(){this.closed=!0}simulateError(e){this.options.errorFilter(e)||(this.closed=!0)}},Object.defineProperty(Va,"__esModule",{value:!0}),Va.NullEventSource=void 0;const Ha=za;Va.NullEventSource=Ha.default;var Ua={};Object.defineProperty(Ua,"__esModule",{value:!0}),Ua.TtlCache=void 0;const Ka=Ue;Ua.TtlCache=Ka.default,function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMigration=e.LDMigrationSuccess=e.LDMigrationError=e.BigSegmentStoreStatusProviderImpl=e.LDClientImpl=e.internalServer=e.platform=e.integrations=void 0;const n=s;e.BigSegmentStoreStatusProviderImpl=n.default;const c=a;e.LDClientImpl=c.default;const u=la;Object.defineProperty(e,"createMigration",{enumerable:!0,get:function(){return u.createMigration}}),Object.defineProperty(e,"LDMigrationError",{enumerable:!0,get:function(){return u.LDMigrationError}}),Object.defineProperty(e,"LDMigrationSuccess",{enumerable:!0,get:function(){return u.LDMigrationSuccess}}),e.integrations=ha,e.platform=o,i(l,e),i(je,e),i(Va,e),i(o,e),e.internalServer=Ua}(n);var qa={},Wa={},Ga={};Object.defineProperty(Ga,"__esModule",{value:!0}),Ga.createCallbacks=void 0;Ga.createCallbacks=e=>({onError:t=>{var r;null===(r=null==e?void 0:e.error)||void 0===r||r.call(e,t.message)},onFailed:e=>{},onReady:()=>{},onUpdate:e=>{},hasEventListeners:()=>!1});var Xa={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createOptions=e.defaultOptions=void 0;const t=n;e.defaultOptions={stream:!1,sendEvents:!1,useLdd:!0,diagnosticOptOut:!0,logger:t.BasicLogger.get()};e.createOptions=t=>{var r;const i=Object.assign(Object.assign({},e.defaultOptions),t);return null===(r=i.logger)||void 0===r||r.debug(`Using LD options: ${JSON.stringify(i)}`),i}}(Xa);var Ja={},Ya=t&&t.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.validateOptions=void 0;Ja.validateOptions=(e,t)=>{const{featureStore:r,logger:i,sendEvents:n}=t,s=Ya(t,["featureStore","logger","sendEvents"]);if(!e)throw new Error("You must configure the client with a client key");if(!r||"object"!=typeof r||!r.get)throw new Error("You must configure the client with a feature store");if(!i)throw new Error("You must configure the client with a logger");if("{}"!==JSON.stringify(s))throw new Error(`Invalid configuration: ${Object.keys(s).toString()} not supported`);return!0},function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(Ga,e),i(Xa,e),i(Ja,e)}(Wa),Object.defineProperty(qa,"__esModule",{value:!0});const Za=n,Qa=Wa;qa.default=class extends Za.LDClientImpl{constructor(e,t,r){const i=(0,Qa.createOptions)(r);super(e,t,i,(0,Qa.createCallbacks)(i.logger))}initialized(){return!0}waitForInitialization(){return Promise.resolve(this)}};var eo={},to={};Object.defineProperty(to,"__esModule",{value:!0});to.default=class{constructor(e){this._cacheTtlMs=e}get(){if(!(this._cacheTtlMs<0)&&void 0!==this._cache)return 0===this._cacheTtlMs||Date.now()<this._cache.expiration?this._cache.value:void(this._cache=void 0)}set(e){this._cache={value:e,expiration:Date.now()+this._cacheTtlMs}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EdgeFeatureStore=e.buildRootKey=void 0;const t=n,r=to;e.buildRootKey=e=>`LD-Env-${e}`;e.EdgeFeatureStore=class{constructor(i,n,s,a,o){this._edgeProvider=i,this._sdkKey=n,this._description=s,this._logger=a,this.close=t.noop,this.delete=t.noop,this.upsert=t.noop,this._rootKey=(0,e.buildRootKey)(this._sdkKey),this._cache=new r.default(o)}async get(e,t,r){const{namespace:i}=e,n="features"===i?"flags":i;this._logger.debug(`Requesting ${t} from ${this._rootKey}.${n}`);try{const e=await this._getStorePayload();switch(i){case"features":r(e.flags[t]);break;case"segments":r(e.segments[t]);break;default:r(null)}}catch(e){this._logger.error(e),r(null)}}async all(e,r=t.noop){const{namespace:i}=e,n="features"===i?"flags":i;this._logger.debug(`Requesting all from ${this._rootKey}.${n}`);try{const e=await this._getStorePayload();switch(i){case"features":r(e.flags);break;case"segments":r(e.segments);break;default:throw new Error(`Unsupported DataKind: ${i}`)}}catch(e){this._logger.error(e),r({})}}async _getStorePayload(){let e=this._cache.get();if(void 0!==e)return e;const r=await this._edgeProvider.get(this._rootKey);if(!r)throw new Error(`${this._rootKey} is not found in KV.`);if(e=(0,t.deserializePoll)(r),!e)throw new Error(`Error deserializing ${this._rootKey}`);return this._cache.set(e),e}async initialized(e=t.noop){const r=null!==await this._edgeProvider.get(this._rootKey);this._logger.debug(`Is ${this._rootKey} initialized? ${r}`),e(r)}init(e,t){t()}getDescription(){return this._description}}}(eo);var ro={},io={},no=r(e),so={},ao={exports:{}};var oo,lo={exports:{}};function co(){return oo||(oo=1,lo.exports=function(){var e=e||function(e,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=require("crypto")}catch(e){}var n=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},o=a.lib={},l=o.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=o.WordArray=l.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=t!=r?t:4*e.length},toString:function(e){return(e||d).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes,n=e.sigBytes;if(this.clamp(),i%4)for(var s=0;s<n;s++){var a=r[s>>>2]>>>24-s%4*8&255;t[i+s>>>2]|=a<<24-(i+s)%4*8}else for(var o=0;o<n;o+=4)t[i+o>>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),u=a.enc={},d=u.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var s=t[n>>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new c.init(r,t/2)}},h=u.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var s=t[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new c.init(r,t)}},f=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,a=this.blockSize,o=s/(4*a),l=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,u=e.min(4*l,s);if(l){for(var d=0;d<l;d+=a)this._doProcessBlock(n,d);r=n.splice(0,l),i.sigBytes-=u}return new c.init(r,u)},clone:function(){var e=l.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});o.Hasher=p.extend({cfg:l.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new v.HMAC.init(e,r).finalize(t)}}});var v=a.algo={};return a}(Math);return e}()),lo.exports}var uo,ho={exports:{}};function fo(){return uo?ho.exports:(uo=1,ho.exports=function(e){return i=(r=e).lib,n=i.Base,s=i.WordArray,(a=r.x64={}).Word=n.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=n.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],i=0;i<t;i++){var n=e[i];r.push(n.high),r.push(n.low)}return s.create(r,this.sigBytes)},clone:function(){for(var e=n.clone.call(this),t=e.words=this.words.slice(0),r=t.length,i=0;i<r;i++)t[i]=t[i].clone();return e}}),e;var t,r,i,n,s,a}(co()))}var po,vo={exports:{}};function go(){return po||(po=1,vo.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init,i=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,i=[],n=0;n<t;n++)i[n>>>2]|=e[n]<<24-n%4*8;r.call(this,i,t)}else r.apply(this,arguments)};i.prototype=t}}(),e.lib.WordArray}(co())),vo.exports}var _o,yo={exports:{}};function mo(){return _o?yo.exports:(_o=1,yo.exports=function(e){return function(){var t=e,r=t.lib.WordArray,i=t.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n+=2){var s=t[n>>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n++)i[n>>>1]|=e.charCodeAt(n)<<16-n%2*16;return r.create(i,2*t)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s<r;s+=2){var a=n(t[s>>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s<t;s++)i[s>>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return r.create(i,2*t)}}}(),e.enc.Utf16}(co()))}var bo,So={exports:{}},Eo=So.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function i(e,t,i){for(var n=[],s=0,a=0;a<t;a++)if(a%4){var o=i[e.charCodeAt(a-1)]<<a%4*2|i[e.charCodeAt(a)]>>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return r.create(n,s)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s<r;s+=3)for(var a=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o<r;o++)n.push(i.charAt(a>>>6*(3-o)&63));var l=i.charAt(64);if(l)for(;n.length%4;)n.push(l);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s<r.length;s++)n[r.charCodeAt(s)]=s}var a=r.charAt(64);if(a){var o=e.indexOf(a);-1!==o&&(t=o)}return i(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(co()),wo={exports:{}};function ko(){return bo?wo.exports:(bo=1,wo.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function i(e,t,i){for(var n=[],s=0,a=0;a<t;a++)if(a%4){var o=i[e.charCodeAt(a-1)]<<a%4*2|i[e.charCodeAt(a)]>>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return r.create(n,s)}t.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],a=0;a<i;a+=3)for(var o=(r[a>>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,l=0;l<4&&a+.75*l<i;l++)s.push(n.charAt(o>>>6*(3-l)&63));var c=n.charAt(64);if(c)for(;s.length%4;)s.push(c);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var a=0;a<n.length;a++)s[n.charCodeAt(a)]=a}var o=n.charAt(64);if(o){var l=e.indexOf(o);-1!==l&&(r=l)}return i(e,r,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),e.enc.Base64url}(co()))}var Oo,xo={exports:{}};function Do(){return Oo||(Oo=1,xo.exports=function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[];!function(){for(var e=0;e<64;e++)o[e]=4294967296*t.abs(t.sin(e+1))|0}();var l=a.MD5=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,a=e[t+0],l=e[t+1],f=e[t+2],p=e[t+3],v=e[t+4],g=e[t+5],_=e[t+6],y=e[t+7],m=e[t+8],b=e[t+9],S=e[t+10],E=e[t+11],w=e[t+12],k=e[t+13],O=e[t+14],x=e[t+15],D=s[0],P=s[1],R=s[2],I=s[3];D=c(D,P,R,I,a,7,o[0]),I=c(I,D,P,R,l,12,o[1]),R=c(R,I,D,P,f,17,o[2]),P=c(P,R,I,D,p,22,o[3]),D=c(D,P,R,I,v,7,o[4]),I=c(I,D,P,R,g,12,o[5]),R=c(R,I,D,P,_,17,o[6]),P=c(P,R,I,D,y,22,o[7]),D=c(D,P,R,I,m,7,o[8]),I=c(I,D,P,R,b,12,o[9]),R=c(R,I,D,P,S,17,o[10]),P=c(P,R,I,D,E,22,o[11]),D=c(D,P,R,I,w,7,o[12]),I=c(I,D,P,R,k,12,o[13]),R=c(R,I,D,P,O,17,o[14]),D=u(D,P=c(P,R,I,D,x,22,o[15]),R,I,l,5,o[16]),I=u(I,D,P,R,_,9,o[17]),R=u(R,I,D,P,E,14,o[18]),P=u(P,R,I,D,a,20,o[19]),D=u(D,P,R,I,g,5,o[20]),I=u(I,D,P,R,S,9,o[21]),R=u(R,I,D,P,x,14,o[22]),P=u(P,R,I,D,v,20,o[23]),D=u(D,P,R,I,b,5,o[24]),I=u(I,D,P,R,O,9,o[25]),R=u(R,I,D,P,p,14,o[26]),P=u(P,R,I,D,m,20,o[27]),D=u(D,P,R,I,k,5,o[28]),I=u(I,D,P,R,f,9,o[29]),R=u(R,I,D,P,y,14,o[30]),D=d(D,P=u(P,R,I,D,w,20,o[31]),R,I,g,4,o[32]),I=d(I,D,P,R,m,11,o[33]),R=d(R,I,D,P,E,16,o[34]),P=d(P,R,I,D,O,23,o[35]),D=d(D,P,R,I,l,4,o[36]),I=d(I,D,P,R,v,11,o[37]),R=d(R,I,D,P,y,16,o[38]),P=d(P,R,I,D,S,23,o[39]),D=d(D,P,R,I,k,4,o[40]),I=d(I,D,P,R,a,11,o[41]),R=d(R,I,D,P,p,16,o[42]),P=d(P,R,I,D,_,23,o[43]),D=d(D,P,R,I,b,4,o[44]),I=d(I,D,P,R,w,11,o[45]),R=d(R,I,D,P,x,16,o[46]),D=h(D,P=d(P,R,I,D,f,23,o[47]),R,I,a,6,o[48]),I=h(I,D,P,R,y,10,o[49]),R=h(R,I,D,P,O,15,o[50]),P=h(P,R,I,D,g,21,o[51]),D=h(D,P,R,I,w,6,o[52]),I=h(I,D,P,R,p,10,o[53]),R=h(R,I,D,P,S,15,o[54]),P=h(P,R,I,D,l,21,o[55]),D=h(D,P,R,I,m,6,o[56]),I=h(I,D,P,R,x,10,o[57]),R=h(R,I,D,P,_,15,o[58]),P=h(P,R,I,D,k,21,o[59]),D=h(D,P,R,I,v,6,o[60]),I=h(I,D,P,R,E,10,o[61]),R=h(R,I,D,P,f,15,o[62]),P=h(P,R,I,D,b,21,o[63]),s[0]=s[0]+D|0,s[1]=s[1]+P|0,s[2]=s[2]+R|0,s[3]=s[3]+I|0},_doFinalize:function(){var e=this._data,r=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;r[n>>>5]|=128<<24-n%32;var s=t.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,l=o.words,c=0;c<4;c++){var u=l[c];l[c]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return o},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,r,i,n,s,a){var o=e+(t&r|~t&i)+n+a;return(o<<s|o>>>32-s)+t}function u(e,t,r,i,n,s,a){var o=e+(t&i|r&~i)+n+a;return(o<<s|o>>>32-s)+t}function d(e,t,r,i,n,s,a){var o=e+(t^r^i)+n+a;return(o<<s|o>>>32-s)+t}function h(e,t,r,i,n,s,a){var o=e+(r^(t|~i))+n+a;return(o<<s|o>>>32-s)+t}r.MD5=s._createHelper(l),r.HmacMD5=s._createHmacHelper(l)}(Math),e.MD5}(co())),xo.exports}var Po,Ro={exports:{}};function Io(){return Po||(Po=1,Ro.exports=function(e){return r=(t=e).lib,i=r.WordArray,n=r.Hasher,s=t.algo,a=[],o=s.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],l=r[4],c=0;c<80;c++){if(c<16)a[c]=0|e[t+c];else{var u=a[c-3]^a[c-8]^a[c-14]^a[c-16];a[c]=u<<1|u>>>31}var d=(i<<5|i>>>27)+l+a[c];d+=c<20?1518500249+(n&s|~n&o):c<40?1859775393+(n^s^o):c<60?(n&s|n&o|s&o)-1894007588:(n^s^o)-899497514,l=o,o=s,s=n<<30|n>>>2,n=i,i=d}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+l|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=n._createHelper(o),t.HmacSHA1=n._createHmacHelper(o),e.SHA1;var t,r,i,n,s,a,o}(co())),Ro.exports}var To,Ao={exports:{}};function Mo(){return To||(To=1,Ao.exports=function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[],l=[];!function(){function e(e){for(var r=t.sqrt(e),i=2;i<=r;i++)if(!(e%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)e(i)&&(n<8&&(o[n]=r(t.pow(i,.5))),l[n]=r(t.pow(i,1/3)),n++),i++}();var c=[],u=a.SHA256=s.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],u=r[5],d=r[6],h=r[7],f=0;f<64;f++){if(f<16)c[f]=0|e[t+f];else{var p=c[f-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,g=c[f-2],_=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;c[f]=v+c[f-7]+_+c[f-16]}var y=i&n^i&s^n&s,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&u^~o&d)+l[f]+c[f];h=d,d=u,u=o,o=a+b|0,a=s,s=n,n=i,i=b+(m+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=t.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=s._createHelper(u),r.HmacSHA256=s._createHmacHelper(u)}(Math),e.SHA256}(co())),Ao.exports}var Co,Fo={exports:{}};var Lo,jo={exports:{}};function No(){return Lo||(Lo=1,jo.exports=function(e){return function(){var t=e,r=t.lib.Hasher,i=t.x64,n=i.Word,s=i.WordArray,a=t.algo;function o(){return n.create.apply(n,arguments)}var l=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],c=[];!function(){for(var e=0;e<80;e++)c[e]=o()}();var u=a.SHA512=r.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],u=r[5],d=r[6],h=r[7],f=i.high,p=i.low,v=n.high,g=n.low,_=s.high,y=s.low,m=a.high,b=a.low,S=o.high,E=o.low,w=u.high,k=u.low,O=d.high,x=d.low,D=h.high,P=h.low,R=f,I=p,T=v,A=g,M=_,C=y,F=m,L=b,j=S,N=E,$=w,B=k,V=O,z=x,H=D,U=P,K=0;K<80;K++){var q,W,G=c[K];if(K<16)W=G.high=0|e[t+2*K],q=G.low=0|e[t+2*K+1];else{var X=c[K-15],J=X.high,Y=X.low,Z=(J>>>1|Y<<31)^(J>>>8|Y<<24)^J>>>7,Q=(Y>>>1|J<<31)^(Y>>>8|J<<24)^(Y>>>7|J<<25),ee=c[K-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=c[K-7],ae=se.high,oe=se.low,le=c[K-16],ce=le.high,ue=le.low;W=(W=(W=Z+ae+((q=Q+oe)>>>0<Q>>>0?1:0))+ie+((q+=ne)>>>0<ne>>>0?1:0))+ce+((q+=ue)>>>0<ue>>>0?1:0),G.high=W,G.low=q}var de,he=j&$^~j&V,fe=N&B^~N&z,pe=R&T^R&M^T&M,ve=I&A^I&C^A&C,ge=(R>>>28|I<<4)^(R<<30|I>>>2)^(R<<25|I>>>7),_e=(I>>>28|R<<4)^(I<<30|R>>>2)^(I<<25|R>>>7),ye=(j>>>14|N<<18)^(j>>>18|N<<14)^(j<<23|N>>>9),me=(N>>>14|j<<18)^(N>>>18|j<<14)^(N<<23|j>>>9),be=l[K],Se=be.high,Ee=be.low,we=H+ye+((de=U+me)>>>0<U>>>0?1:0),ke=_e+ve;H=V,U=z,V=$,z=B,$=j,B=N,j=F+(we=(we=(we=we+he+((de+=fe)>>>0<fe>>>0?1:0))+Se+((de+=Ee)>>>0<Ee>>>0?1:0))+W+((de+=q)>>>0<q>>>0?1:0))+((N=L+de|0)>>>0<L>>>0?1:0)|0,F=M,L=C,M=T,C=A,T=R,A=I,R=we+(ge+pe+(ke>>>0<_e>>>0?1:0))+((I=de+ke|0)>>>0<de>>>0?1:0)|0}p=i.low=p+I,i.high=f+R+(p>>>0<I>>>0?1:0),g=n.low=g+A,n.high=v+T+(g>>>0<A>>>0?1:0),y=s.low=y+C,s.high=_+M+(y>>>0<C>>>0?1:0),b=a.low=b+L,a.high=m+F+(b>>>0<L>>>0?1:0),E=o.low=E+N,o.high=S+j+(E>>>0<N>>>0?1:0),k=u.low=k+B,u.high=w+$+(k>>>0<B>>>0?1:0),x=d.low=x+z,d.high=O+V+(x>>>0<z>>>0?1:0),P=h.low=P+U,h.high=D+H+(P>>>0<U>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(u),t.HmacSHA512=r._createHmacHelper(u)}(),e.SHA512}(co(),fo())),jo.exports}var $o,Bo={exports:{}};var Vo,zo={exports:{}};function Ho(){return Vo||(Vo=1,zo.exports=function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.x64.Word,o=r.algo,l=[],c=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){l[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)c[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var o=0,d=0,h=0;h<7;h++){if(1&n){var f=(1<<h)-1;f<32?d^=1<<f:o^=1<<f-32}128&n?n=n<<1^113:n<<=1}u[s]=a.create(o,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=a.create()}();var h=o.SHA3=s.extend({cfg:s.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,i=this.blockSize/2,n=0;n<i;n++){var s=e[t+2*n],a=e[t+2*n+1];s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(P=r[n]).high^=a,P.low^=s}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,v=0;v<5;v++)f^=(P=r[h+5*v]).high,p^=P.low;var g=d[h];g.high=f,g.low=p}for(h=0;h<5;h++){var _=d[(h+4)%5],y=d[(h+1)%5],m=y.high,b=y.low;for(f=_.high^(m<<1|b>>>31),p=_.low^(b<<1|m>>>31),v=0;v<5;v++)(P=r[h+5*v]).high^=f,P.low^=p}for(var S=1;S<25;S++){var E=(P=r[S]).high,w=P.low,k=l[S];k<32?(f=E<<k|w>>>32-k,p=w<<k|E>>>32-k):(f=w<<k-32|E>>>64-k,p=E<<k-32|w>>>64-k);var O=d[c[S]];O.high=f,O.low=p}var x=d[0],D=r[0];for(x.high=D.high,x.low=D.low,h=0;h<5;h++)for(v=0;v<5;v++){var P=r[S=h+5*v],R=d[S],I=d[(h+1)%5+5*v],T=d[(h+2)%5+5*v];P.high=R.high^~I.high&T.high,P.low=R.low^~I.low&T.low}P=r[0];var A=u[o];P.high^=A.high,P.low^=A.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var i=8*e.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(t.ceil((i+1)/s)*s>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,l=o/8,c=[],u=0;u<l;u++){var d=a[u],h=d.high,f=d.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),c.push(f),c.push(h)}return new n.init(c,o)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=s._createHelper(h),r.HmacSHA3=s._createHmacHelper(h)}(Math),e.SHA3}(co(),fo())),zo.exports}var Uo,Ko={exports:{}};var qo,Wo={exports:{}};function Go(){return qo?Wo.exports:(qo=1,Wo.exports=function(e){var t,r,i;r=(t=e).lib.Base,i=t.enc.Utf8,t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),a=this._iKey=t.clone(),o=s.words,l=a.words,c=0;c<r;c++)o[c]^=1549556828,l[c]^=909522486;s.sigBytes=a.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}(co()))}var Xo,Jo={exports:{}};var Yo,Zo={exports:{}};function Qo(){return Yo?Zo.exports:(Yo=1,Zo.exports=function(e){return r=(t=e).lib,i=r.Base,n=r.WordArray,s=t.algo,a=s.MD5,o=s.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,i=this.cfg,s=i.hasher.create(),a=n.create(),o=a.words,l=i.keySize,c=i.iterations;o.length<l;){r&&s.update(r),r=s.update(e).finalize(t),s.reset();for(var u=1;u<c;u++)r=s.finalize(r),s.reset();a.concat(r)}return a.sigBytes=4*l,a}}),t.EvpKDF=function(e,t,r){return o.create(r).compute(e,t)},e.EvpKDF;var t,r,i,n,s,a,o}(co(),Io(),Go()))}var el,tl={exports:{}};function rl(){return el||(el=1,tl.exports=function(e){e.lib.Cipher||function(t){var r=e,i=r.lib,n=i.Base,s=i.WordArray,a=i.BufferedBlockAlgorithm,o=r.enc;o.Utf8;var l=o.Base64,c=r.algo.EvpKDF,u=i.Cipher=a.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?m:_}return function(t){return{encrypt:function(r,i,n){return e(i).encrypt(t,r,i,n)},decrypt:function(r,i,n){return e(i).decrypt(t,r,i,n)}}}}()});i.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=r.mode={},h=i.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),f=d.CBC=function(){var e=h.extend();function r(e,r,i){var n,s=this._iv;s?(n=s,this._iv=t):n=this._prevBlock;for(var a=0;a<i;a++)e[r+a]^=n[a]}return e.Encryptor=e.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize;r.call(this,e,t,n),i.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}}),e.Decryptor=e.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize,s=e.slice(t,t+n);i.decryptBlock(e,t),r.call(this,e,t,n),this._prevBlock=s}}),e}(),p=(r.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,i=r-e.sigBytes%r,n=i<<24|i<<16|i<<8|i,a=[],o=0;o<i;o+=4)a.push(n);var l=s.create(a,i);e.concat(l)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};i.BlockCipher=u.extend({cfg:u.cfg.extend({mode:f,padding:p}),reset:function(){var e;u.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var v=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(l)},parse:function(e){var t,r=l.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),v.create({ciphertext:r,salt:t})}},_=i.SerializableCipher=n.extend({cfg:n.extend({format:g}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),a=n.cfg;return v.create({ciphertext:s,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(r.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)a=c.create({keySize:t+r,hasher:n}).compute(e,i);else var a=c.create({keySize:t+r}).compute(e,i);var o=s.create(a.words.slice(t),4*r);return a.sigBytes=4*t,v.create({key:a,iv:o,salt:i})}},m=i.PasswordBasedCipher=_.extend({cfg:_.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=_.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,_.decrypt.call(this,e,t,n.key,i)}})}()}(co(),Qo())),tl.exports}var il,nl={exports:{}};function sl(){return il?nl.exports:(il=1,nl.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var a=0;a<r;a++)e[t+a]^=n[a]}return t.Encryptor=t.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize;r.call(this,e,t,n,i),this._prevBlock=e.slice(t,t+n)}}),t.Decryptor=t.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize,s=e.slice(t,t+n);r.call(this,e,t,n,i),this._prevBlock=s}}),t}(),e.mode.CFB}(co(),rl()))}var al,ol={exports:{}};function ll(){return al?ol.exports:(al=1,ol.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,s=this._counter;n&&(s=this._counter=n.slice(0),this._iv=void 0);var a=s.slice(0);r.encryptBlock(a,0),s[i-1]=s[i-1]+1|0;for(var o=0;o<i;o++)e[t+o]^=a[o]}}),t.Decryptor=r,t),e.mode.CTR;var t,r}(co(),rl()))}var cl,ul={exports:{}};function dl(){return cl?ul.exports:(cl=1,ul.exports=function(e){
2
2
  /** @preserve
3
3
  * Counter block mode compatible with Dr Brian Gladman fileenc.c
4
4
  * derived from CryptoJS.mode.CTR
5
5
  * Jan Hruby jhruby.web@gmail.com
6
6
  */
7
- return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}return e}function i(e){return 0===(e[0]=r(e[0]))&&(e[1]=r(e[1])),e}var n=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,a=this._counter;s&&(a=this._counter=s.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var l=0;l<n;l++)e[t+l]^=o[l]}});return t.Decryptor=n,t}(),e.mode.CTRGladman}(no(),Yo()))}var ol,ll={exports:{}};function cl(){return ol?ll.exports:(ol=1,ll.exports=function(e){return e.mode.OFB=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,s=this._keystream;n&&(s=this._keystream=n.slice(0),this._iv=void 0),r.encryptBlock(s,0);for(var a=0;a<i;a++)e[t+a]^=s[a]}}),t.Decryptor=r,t),e.mode.OFB;var t,r}(no(),Yo()))}var ul,dl={exports:{}};var hl,fl={exports:{}};var pl,vl={exports:{}};var gl,_l={exports:{}};var yl,ml={exports:{}};var bl,Sl={exports:{}};var El,wl={exports:{}};var kl,Ol={exports:{}};var xl,Dl={exports:{}};function Pl(){return xl||(xl=1,Dl.exports=function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=r.BlockCipher,s=t.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var c=n[s]=[],u=l[s];for(r=0;r<24;r++)c[r/6|0]|=t[(o[r]-1+u)%28]<<31-r%6,c[4+(r/6|0)]|=t[28+(o[r+24]-1+u)%28]<<31-r%6;for(c[0]=c[0]<<1|c[0]>>>31,r=1;r<7;r++)c[r]=c[r]>>>4*(r-1)+3;c[7]=c[7]<<5|c[7]>>>27}var d=this._invSubKeys=[];for(r=0;r<16;r++)d[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,a=this._rBlock,o=0,l=0;l<8;l++)o|=c[l][((a^n[l])&u[l])>>>0];this._lBlock=a,this._rBlock=s^o}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function f(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}t.DES=n._createHelper(d);var p=s.TripleDES=n.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(i.create(t)),this._des2=d.createEncryptor(i.create(r)),this._des3=d.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=n._createHelper(p)}(),e.TripleDES}(no(),Eo(),Go(),Yo())),Dl.exports}var Rl,Il={exports:{}};var Ml,Tl={exports:{}};var Al,Cl={exports:{}};var Fl,jl={exports:{}};function Ll(){return Fl?jl.exports:(Fl=1,jl.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,i=t.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function l(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][n],a+=e.sbox[3][s],a}function c(e,t,r){let i,s=t,a=r;for(let t=0;t<n;++t)s^=e.pbox[t],a=l(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[n],s^=e.pbox[n+1],{left:s,right:a}}function u(e,t,r){let i,s=t,a=r;for(let t=n+1;t>1;--t)s^=e.pbox[t],a=l(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[1],s^=e.pbox[0],{left:s,right:a}}function d(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a<n+2;a++)e.pbox[a]=s[a]^t[i],i++,i>=r&&(i=0);let o=0,l=0,u=0;for(let t=0;t<n+2;t+=2)u=c(e,o,l),o=u.left,l=u.right,e.pbox[t]=o,e.pbox[t+1]=l;for(let t=0;t<4;t++)for(let r=0;r<256;r+=2)u=c(e,o,l),o=u.left,l=u.right,e.sbox[t][r]=o,e.sbox[t][r+1]=l;return!0}var h=i.Blowfish=r.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4;d(o,t,r)}},encryptBlock:function(e,t){var r=c(o,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},decryptBlock:function(e,t){var r=u(o,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},blockSize:2,keySize:4,ivSize:2});t.Blowfish=r._createHelper(h)}(),e.Blowfish}(no(),Eo(),Go(),Yo()))}to.exports=function(e){return e}(no(),oo(),uo(),po(),mo(),Eo(),Oo(),Po(),Ro||(Ro=1,Io.exports=function(e){return r=(t=e).lib.WordArray,i=t.algo,n=i.SHA256,s=i.SHA224=n.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}}),t.SHA224=n._createHelper(s),t.HmacSHA224=n._createHmacHelper(s),e.SHA224;var t,r,i,n,s}(no(),Po())),Ao(),Co||(Co=1,Fo.exports=function(e){return r=(t=e).x64,i=r.Word,n=r.WordArray,s=t.algo,a=s.SHA512,o=s.SHA384=a.extend({_doReset:function(){this._hash=new n.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),t.SHA384=a._createHelper(o),t.HmacSHA384=a._createHmacHelper(o),e.SHA384;var t,r,i,n,s,a,o}(no(),oo(),Ao())),No(),$o||($o=1,Bo.exports=function(e){
7
+ return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}return e}function i(e){return 0===(e[0]=r(e[0]))&&(e[1]=r(e[1])),e}var n=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,a=this._counter;s&&(a=this._counter=s.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var l=0;l<n;l++)e[t+l]^=o[l]}});return t.Decryptor=n,t}(),e.mode.CTRGladman}(co(),rl()))}var hl,fl={exports:{}};function pl(){return hl?fl.exports:(hl=1,fl.exports=function(e){return e.mode.OFB=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,s=this._keystream;n&&(s=this._keystream=n.slice(0),this._iv=void 0),r.encryptBlock(s,0);for(var a=0;a<i;a++)e[t+a]^=s[a]}}),t.Decryptor=r,t),e.mode.OFB;var t,r}(co(),rl()))}var vl,gl={exports:{}};var _l,yl={exports:{}};var ml,bl={exports:{}};var Sl,El={exports:{}};var wl,kl={exports:{}};var Ol,xl={exports:{}};var Dl,Pl={exports:{}};var Rl,Il={exports:{}};var Tl,Al={exports:{}};function Ml(){return Tl||(Tl=1,Al.exports=function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=r.BlockCipher,s=t.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var c=n[s]=[],u=l[s];for(r=0;r<24;r++)c[r/6|0]|=t[(o[r]-1+u)%28]<<31-r%6,c[4+(r/6|0)]|=t[28+(o[r+24]-1+u)%28]<<31-r%6;for(c[0]=c[0]<<1|c[0]>>>31,r=1;r<7;r++)c[r]=c[r]>>>4*(r-1)+3;c[7]=c[7]<<5|c[7]>>>27}var d=this._invSubKeys=[];for(r=0;r<16;r++)d[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,a=this._rBlock,o=0,l=0;l<8;l++)o|=c[l][((a^n[l])&u[l])>>>0];this._lBlock=a,this._rBlock=s^o}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function f(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}t.DES=n._createHelper(d);var p=s.TripleDES=n.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(i.create(t)),this._des2=d.createEncryptor(i.create(r)),this._des3=d.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=n._createHelper(p)}(),e.TripleDES}(co(),Do(),Qo(),rl())),Al.exports}var Cl,Fl={exports:{}};var Ll,jl={exports:{}};var Nl,$l={exports:{}};var Bl,Vl={exports:{}};function zl(){return Bl?Vl.exports:(Bl=1,Vl.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,i=t.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function l(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][n],a+=e.sbox[3][s],a}function c(e,t,r){let i,s=t,a=r;for(let t=0;t<n;++t)s^=e.pbox[t],a=l(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[n],s^=e.pbox[n+1],{left:s,right:a}}function u(e,t,r){let i,s=t,a=r;for(let t=n+1;t>1;--t)s^=e.pbox[t],a=l(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[1],s^=e.pbox[0],{left:s,right:a}}function d(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a<n+2;a++)e.pbox[a]=s[a]^t[i],i++,i>=r&&(i=0);let o=0,l=0,u=0;for(let t=0;t<n+2;t+=2)u=c(e,o,l),o=u.left,l=u.right,e.pbox[t]=o,e.pbox[t+1]=l;for(let t=0;t<4;t++)for(let r=0;r<256;r+=2)u=c(e,o,l),o=u.left,l=u.right,e.sbox[t][r]=o,e.sbox[t][r+1]=l;return!0}var h=i.Blowfish=r.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4;d(o,t,r)}},encryptBlock:function(e,t){var r=c(o,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},decryptBlock:function(e,t){var r=u(o,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},blockSize:2,keySize:4,ivSize:2});t.Blowfish=r._createHelper(h)}(),e.Blowfish}(co(),Do(),Qo(),rl()))}ao.exports=function(e){return e}(co(),fo(),go(),mo(),ko(),Do(),Io(),Mo(),Co||(Co=1,Fo.exports=function(e){return r=(t=e).lib.WordArray,i=t.algo,n=i.SHA256,s=i.SHA224=n.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}}),t.SHA224=n._createHelper(s),t.HmacSHA224=n._createHmacHelper(s),e.SHA224;var t,r,i,n,s}(co(),Mo())),No(),$o||($o=1,Bo.exports=function(e){return r=(t=e).x64,i=r.Word,n=r.WordArray,s=t.algo,a=s.SHA512,o=s.SHA384=a.extend({_doReset:function(){this._hash=new n.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),t.SHA384=a._createHelper(o),t.HmacSHA384=a._createHmacHelper(o),e.SHA384;var t,r,i,n,s,a,o}(co(),fo(),No())),Ho(),Uo||(Uo=1,Ko.exports=function(e){
8
8
  /** @preserve
9
9
  (c) 2012 by Cédric Mesnil. All rights reserved.
10
10
 
@@ -15,5 +15,5 @@ return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();functio
15
15
 
16
16
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17
17
  */
18
- return function(){var t=e,r=t.lib,i=r.WordArray,n=r.Hasher,s=t.algo,a=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),o=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=i.create([0,1518500249,1859775393,2400959708,2840853838]),d=i.create([1352829926,1548603684,1836072691,2053994217,0]),h=s.RIPEMD160=n.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,h,m,b,S,E,w,k,O,x,D,P=this._hash.words,R=u.words,I=d.words,M=a.words,T=o.words,A=l.words,C=c.words;for(E=s=P[0],w=h=P[1],k=m=P[2],O=b=P[3],x=S=P[4],r=0;r<80;r+=1)D=s+e[t+M[r]]|0,D+=r<16?f(h,m,b)+R[0]:r<32?p(h,m,b)+R[1]:r<48?v(h,m,b)+R[2]:r<64?g(h,m,b)+R[3]:_(h,m,b)+R[4],D=(D=y(D|=0,A[r]))+S|0,s=S,S=b,b=y(m,10),m=h,h=D,D=E+e[t+T[r]]|0,D+=r<16?_(w,k,O)+I[0]:r<32?g(w,k,O)+I[1]:r<48?v(w,k,O)+I[2]:r<64?p(w,k,O)+I[3]:f(w,k,O)+I[4],D=(D=y(D|=0,C[r]))+x|0,E=x,x=O,O=y(k,10),k=w,w=D;D=P[1]+m+O|0,P[1]=P[2]+b+x|0,P[2]=P[3]+S+E|0,P[3]=P[4]+s+w|0,P[4]=P[0]+h+k|0,P[0]=D},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,a=0;a<5;a++){var o=s[a];s[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return n},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function f(e,t,r){return e^t^r}function p(e,t,r){return e&t|~e&r}function v(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function _(e,t,r){return e^(t|~r)}function y(e,t){return e<<t|e>>>32-t}t.RIPEMD160=n._createHelper(h),t.HmacRIPEMD160=n._createHmacHelper(h)}(),e.RIPEMD160}(no())),Ho(),Uo||(Uo=1,Ko.exports=function(e){return i=(r=(t=e).lib).Base,n=r.WordArray,a=(s=t.algo).SHA256,o=s.HMAC,l=s.PBKDF2=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,i=o.create(r.hasher,e),s=n.create(),a=n.create([1]),l=s.words,c=a.words,u=r.keySize,d=r.iterations;l.length<u;){var h=i.update(t).finalize(a);i.reset();for(var f=h.words,p=f.length,v=h,g=1;g<d;g++){v=i.finalize(v),i.reset();for(var _=v.words,y=0;y<p;y++)f[y]^=_[y]}s.concat(h),c[0]++}return s.sigBytes=4*u,s}}),t.PBKDF2=function(e,t,r){return l.create(r).compute(e,t)},e.PBKDF2;var t,r,i,n,s,a,o,l}(no(),Po(),Ho())),Go(),Yo(),el(),il(),al(),cl(),ul||(ul=1,dl.exports=function(e){return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB;var t}(no(),Yo())),hl||(hl=1,fl.exports=function(e){return e.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,i=4*t,n=i-r%i,s=r+n-1;e.clamp(),e.words[s>>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(no(),Yo())),pl||(pl=1,vl.exports=function(e){return e.pad.Iso10126={pad:function(t,r){var i=4*r,n=i-t.sigBytes%i;t.concat(e.lib.WordArray.random(n-1)).concat(e.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(no(),Yo())),gl||(gl=1,_l.exports=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(no(),Yo())),yl||(yl=1,ml.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding}(no(),Yo())),bl||(bl=1,Sl.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(no(),Yo())),El||(El=1,wl.exports=function(e){return r=(t=e).lib.CipherParams,i=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(i)},parse:function(e){var t=i.parse(e);return r.create({ciphertext:t})}},e.format.Hex;var t,r,i}(no(),Yo())),kl||(kl=1,Ol.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,i=t.algo,n=[],s=[],a=[],o=[],l=[],c=[],u=[],d=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var v=e[r],g=e[v],_=e[g],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,l[r]=y<<8|y>>>24,c[r]=y,y=16843009*_^65537*g^257*v^16843008*r,u[p]=y<<24|y>>>8,d[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=v^e[e[e[_^v]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],v=i.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],a=0;a<i;a++)a<r?s[a]=t[a]:(c=s[a-1],a%r?r>6&&a%r==4&&(c=n[c>>>24]<<24|n[c>>>16&255]<<16|n[c>>>8&255]<<8|n[255&c]):(c=n[(c=c<<8|c>>>24)>>>24]<<24|n[c>>>16&255]<<16|n[c>>>8&255]<<8|n[255&c],c^=p[a/r|0]<<24),s[a]=s[a-r]^c);for(var o=this._invKeySchedule=[],l=0;l<i;l++){if(a=i-l,l%4)var c=s[a];else c=s[a-4];o[l]=l<4||a<=4?c:u[n[c>>>24]]^d[n[c>>>16&255]]^h[n[c>>>8&255]]^f[n[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,l,c,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,u,d,h,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,a,o){for(var l=this._nRounds,c=e[t]^r[0],u=e[t+1]^r[1],d=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p<l;p++){var v=i[c>>>24]^n[u>>>16&255]^s[d>>>8&255]^a[255&h]^r[f++],g=i[u>>>24]^n[d>>>16&255]^s[h>>>8&255]^a[255&c]^r[f++],_=i[d>>>24]^n[h>>>16&255]^s[c>>>8&255]^a[255&u]^r[f++],y=i[h>>>24]^n[c>>>16&255]^s[u>>>8&255]^a[255&d]^r[f++];c=v,u=g,d=_,h=y}v=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[d>>>8&255]<<8|o[255&h])^r[f++],g=(o[u>>>24]<<24|o[d>>>16&255]<<16|o[h>>>8&255]<<8|o[255&c])^r[f++],_=(o[d>>>24]<<24|o[h>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],y=(o[h>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&d])^r[f++],e[t]=v,e[t+1]=g,e[t+2]=_,e[t+3]=y},keySize:8});t.AES=r._createHelper(v)}(),e.AES}(no(),Eo(),Go(),Yo())),Pl(),Rl||(Rl=1,Il.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,i=t.algo,n=i.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var a=n%r,o=t[a>>>2]>>>24-a%4*8&255;s=(s+i[n]+o)%256;var l=i[n];i[n]=i[s],i[s]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}t.RC4=r._createHelper(n);var a=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});t.RC4Drop=r._createHelper(a)}(),e.RC4}(no(),Eo(),Go(),Yo())),Ml||(Ml=1,Tl.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,i=t.algo,n=[],s=[],a=[],o=i.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)l.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,a=s[0],o=s[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),d=c>>>16|4294901760&u,h=u<<16|65535&c;for(n[0]^=c,n[1]^=d,n[2]^=u,n[3]^=h,n[4]^=c,n[5]^=d,n[6]^=u,n[7]^=h,r=0;r<4;r++)l.call(this)}},_doProcessBlock:function(e,t){var r=this._X;l.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,l=((n*n>>>17)+n*o>>>15)+o*o,c=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=l^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=r._createHelper(o)}(),e.Rabbit}(no(),Eo(),Go(),Yo())),Al||(Al=1,Cl.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,i=t.algo,n=[],s=[],a=[],o=i.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)l.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,a=s[0],o=s[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),d=c>>>16|4294901760&u,h=u<<16|65535&c;for(i[0]^=c,i[1]^=d,i[2]^=u,i[3]^=h,i[4]^=c,i[5]^=d,i[6]^=u,i[7]^=h,n=0;n<4;n++)l.call(this)}},_doProcessBlock:function(e,t){var r=this._X;l.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,l=((n*n>>>17)+n*o>>>15)+o*o,c=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=l^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=r._createHelper(o)}(),e.RabbitLegacy}(no(),Eo(),Go(),Yo())),Ll());var Nl=to.exports,$l={exports:{}},Bl=$l.exports=function(e){return e.enc.Hex}(no());Object.defineProperty(eo,"__esModule",{value:!0});const Vl=Nl,zl=_o,Hl=Bl;eo.default=class{constructor(e){let t;switch(e){case"sha1":t=Vl.algo.SHA1;break;case"sha256":t=Vl.algo.SHA256;break;default:throw new Error("unsupported hash algorithm. Only sha1 and sha256 are supported.")}this._cryptoJSHasher=t.create()}digest(e){const t=this._cryptoJSHasher.finalize();let r;switch(e){case"base64":r=zl.default;break;case"hex":r=Hl.default;break;default:throw new Error("unsupported output encoding. Only base64 and hex are supported.")}return t.toString(r)}update(e){return this._cryptoJSHasher.update(e),this}};var Ul={};Object.defineProperty(Ul,"__esModule",{value:!0});const Kl=Nl;Ul.default=class{constructor(e,t){let r;switch(e){case"sha1":r=Kl.algo.SHA1;break;case"sha256":r=Kl.algo.SHA256;break;default:throw new Error("unsupported hash algorithm. Only sha1 and sha256 are supported.")}this._cryptoJSHmac=Kl.algo.HMAC.create(r,t)}digest(e){const t=this._cryptoJSHmac.finalize();if("base64"===e)return t.toString(CryptoJS.enc.Base64);if("hex"===e)return t.toString(CryptoJS.enc.Hex);throw new Error("unsupported output encoding. Only base64 and hex are supported.")}update(e){return this._cryptoJSHmac.update(e),this}},Object.defineProperty(Za,"__esModule",{value:!0});const ql=Qa,Wl=eo,Gl=Ul;Za.default=class{createHash(e){return new Wl.default(e)}createHmac(e,t){return new Gl.default(e,t)}randomUUID(){const e=new Uint32Array(1);return ql.crypto.getRandomValues(e),e.join()}};var Xl={};Object.defineProperty(Xl,"__esModule",{value:!0});const Jl=n;class Yl{constructor(){this.headers={},this.status=0}text(){return Promise.resolve("")}json(){return Promise.resolve({})}}Xl.default=class{fetch(e,t={}){return Promise.resolve(new Yl)}createEventSource(e,t){return new Jl.NullEventSource(e,t)}getEventSourceCapabilities(){return{readTimeout:!1,headers:!1,customMethod:!1}}},Object.defineProperty(Ya,"__esModule",{value:!0});const Zl=Za,Ql=Xl;Ya.default=class{constructor(e){this.crypto=new Zl.default,this.requests=new Ql.default,this.info=e}};var ec={};Object.defineProperty(ec,"__esModule",{value:!0});class tc{constructor(e,t,r){this._platformName=e,this._sdkName=t,this._sdkVersion=r}platformData(){return{name:this._platformName}}sdkData(){return{name:this._sdkName,version:this._sdkVersion,userAgentBase:"AkamaiEdgeSDK"}}}ec.default=(e,t,r)=>new tc(e,t,r),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)},s=t&&t.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};Object.defineProperty(e,"__esModule",{value:!0}),e.init=e.EdgeFeatureStore=void 0;const a=n,o=Va,l=Xa;Object.defineProperty(e,"EdgeFeatureStore",{enumerable:!0,get:function(){return l.EdgeFeatureStore}});const c=Ya,u=ec,d=za;i(n,e);e.init=e=>{var t;const{sdkKey:r,options:i={},featureStoreProvider:n,platformName:h,sdkName:f,sdkVersion:p}=e,v=null!==(t=i.logger)&&void 0!==t?t:a.BasicLogger.get(),g=i,{cacheTtlMs:_}=g,y=s(g,["cacheTtlMs"]),m=new l.EdgeFeatureStore(n,r,"Akamai",v,null!=_?_:100),b=Object.assign({featureStore:m,logger:v},y);(0,d.validateOptions)(e.sdkKey,b);const S=(0,u.default)(h,f,p);return new o.default(r,new c.default(S),b)}}(i);const rc=({options:e={},sdkKey:t,featureStoreProvider:r})=>i.init({sdkKey:t,options:e,featureStoreProvider:r,platformName:"Akamai EdgeWorker",sdkName:"@launchdarkly/akamai-server-base-sdk",sdkVersion:"3.0.10"});export{rc as init};
18
+ return function(){var t=e,r=t.lib,i=r.WordArray,n=r.Hasher,s=t.algo,a=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),o=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=i.create([0,1518500249,1859775393,2400959708,2840853838]),d=i.create([1352829926,1548603684,1836072691,2053994217,0]),h=s.RIPEMD160=n.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,h,m,b,S,E,w,k,O,x,D,P=this._hash.words,R=u.words,I=d.words,T=a.words,A=o.words,M=l.words,C=c.words;for(E=s=P[0],w=h=P[1],k=m=P[2],O=b=P[3],x=S=P[4],r=0;r<80;r+=1)D=s+e[t+T[r]]|0,D+=r<16?f(h,m,b)+R[0]:r<32?p(h,m,b)+R[1]:r<48?v(h,m,b)+R[2]:r<64?g(h,m,b)+R[3]:_(h,m,b)+R[4],D=(D=y(D|=0,M[r]))+S|0,s=S,S=b,b=y(m,10),m=h,h=D,D=E+e[t+A[r]]|0,D+=r<16?_(w,k,O)+I[0]:r<32?g(w,k,O)+I[1]:r<48?v(w,k,O)+I[2]:r<64?p(w,k,O)+I[3]:f(w,k,O)+I[4],D=(D=y(D|=0,C[r]))+x|0,E=x,x=O,O=y(k,10),k=w,w=D;D=P[1]+m+O|0,P[1]=P[2]+b+x|0,P[2]=P[3]+S+E|0,P[3]=P[4]+s+w|0,P[4]=P[0]+h+k|0,P[0]=D},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,a=0;a<5;a++){var o=s[a];s[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return n},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function f(e,t,r){return e^t^r}function p(e,t,r){return e&t|~e&r}function v(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function _(e,t,r){return e^(t|~r)}function y(e,t){return e<<t|e>>>32-t}t.RIPEMD160=n._createHelper(h),t.HmacRIPEMD160=n._createHmacHelper(h)}(),e.RIPEMD160}(co())),Go(),Xo||(Xo=1,Jo.exports=function(e){return i=(r=(t=e).lib).Base,n=r.WordArray,a=(s=t.algo).SHA256,o=s.HMAC,l=s.PBKDF2=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,i=o.create(r.hasher,e),s=n.create(),a=n.create([1]),l=s.words,c=a.words,u=r.keySize,d=r.iterations;l.length<u;){var h=i.update(t).finalize(a);i.reset();for(var f=h.words,p=f.length,v=h,g=1;g<d;g++){v=i.finalize(v),i.reset();for(var _=v.words,y=0;y<p;y++)f[y]^=_[y]}s.concat(h),c[0]++}return s.sigBytes=4*u,s}}),t.PBKDF2=function(e,t,r){return l.create(r).compute(e,t)},e.PBKDF2;var t,r,i,n,s,a,o,l}(co(),Mo(),Go())),Qo(),rl(),sl(),ll(),dl(),pl(),vl||(vl=1,gl.exports=function(e){return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB;var t}(co(),rl())),_l||(_l=1,yl.exports=function(e){return e.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,i=4*t,n=i-r%i,s=r+n-1;e.clamp(),e.words[s>>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(co(),rl())),ml||(ml=1,bl.exports=function(e){return e.pad.Iso10126={pad:function(t,r){var i=4*r,n=i-t.sigBytes%i;t.concat(e.lib.WordArray.random(n-1)).concat(e.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(co(),rl())),Sl||(Sl=1,El.exports=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(co(),rl())),wl||(wl=1,kl.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding}(co(),rl())),Ol||(Ol=1,xl.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(co(),rl())),Dl||(Dl=1,Pl.exports=function(e){return r=(t=e).lib.CipherParams,i=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(i)},parse:function(e){var t=i.parse(e);return r.create({ciphertext:t})}},e.format.Hex;var t,r,i}(co(),rl())),Rl||(Rl=1,Il.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,i=t.algo,n=[],s=[],a=[],o=[],l=[],c=[],u=[],d=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var v=e[r],g=e[v],_=e[g],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,l[r]=y<<8|y>>>24,c[r]=y,y=16843009*_^65537*g^257*v^16843008*r,u[p]=y<<24|y>>>8,d[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=v^e[e[e[_^v]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],v=i.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],a=0;a<i;a++)a<r?s[a]=t[a]:(c=s[a-1],a%r?r>6&&a%r==4&&(c=n[c>>>24]<<24|n[c>>>16&255]<<16|n[c>>>8&255]<<8|n[255&c]):(c=n[(c=c<<8|c>>>24)>>>24]<<24|n[c>>>16&255]<<16|n[c>>>8&255]<<8|n[255&c],c^=p[a/r|0]<<24),s[a]=s[a-r]^c);for(var o=this._invKeySchedule=[],l=0;l<i;l++){if(a=i-l,l%4)var c=s[a];else c=s[a-4];o[l]=l<4||a<=4?c:u[n[c>>>24]]^d[n[c>>>16&255]]^h[n[c>>>8&255]]^f[n[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,l,c,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,u,d,h,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,a,o){for(var l=this._nRounds,c=e[t]^r[0],u=e[t+1]^r[1],d=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p<l;p++){var v=i[c>>>24]^n[u>>>16&255]^s[d>>>8&255]^a[255&h]^r[f++],g=i[u>>>24]^n[d>>>16&255]^s[h>>>8&255]^a[255&c]^r[f++],_=i[d>>>24]^n[h>>>16&255]^s[c>>>8&255]^a[255&u]^r[f++],y=i[h>>>24]^n[c>>>16&255]^s[u>>>8&255]^a[255&d]^r[f++];c=v,u=g,d=_,h=y}v=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[d>>>8&255]<<8|o[255&h])^r[f++],g=(o[u>>>24]<<24|o[d>>>16&255]<<16|o[h>>>8&255]<<8|o[255&c])^r[f++],_=(o[d>>>24]<<24|o[h>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],y=(o[h>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&d])^r[f++],e[t]=v,e[t+1]=g,e[t+2]=_,e[t+3]=y},keySize:8});t.AES=r._createHelper(v)}(),e.AES}(co(),Do(),Qo(),rl())),Ml(),Cl||(Cl=1,Fl.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,i=t.algo,n=i.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var a=n%r,o=t[a>>>2]>>>24-a%4*8&255;s=(s+i[n]+o)%256;var l=i[n];i[n]=i[s],i[s]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}t.RC4=r._createHelper(n);var a=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});t.RC4Drop=r._createHelper(a)}(),e.RC4}(co(),Do(),Qo(),rl())),Ll||(Ll=1,jl.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,i=t.algo,n=[],s=[],a=[],o=i.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)l.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,a=s[0],o=s[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),d=c>>>16|4294901760&u,h=u<<16|65535&c;for(n[0]^=c,n[1]^=d,n[2]^=u,n[3]^=h,n[4]^=c,n[5]^=d,n[6]^=u,n[7]^=h,r=0;r<4;r++)l.call(this)}},_doProcessBlock:function(e,t){var r=this._X;l.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,l=((n*n>>>17)+n*o>>>15)+o*o,c=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=l^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=r._createHelper(o)}(),e.Rabbit}(co(),Do(),Qo(),rl())),Nl||(Nl=1,$l.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,i=t.algo,n=[],s=[],a=[],o=i.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)l.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,a=s[0],o=s[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),d=c>>>16|4294901760&u,h=u<<16|65535&c;for(i[0]^=c,i[1]^=d,i[2]^=u,i[3]^=h,i[4]^=c,i[5]^=d,i[6]^=u,i[7]^=h,n=0;n<4;n++)l.call(this)}},_doProcessBlock:function(e,t){var r=this._X;l.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,l=((n*n>>>17)+n*o>>>15)+o*o,c=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=l^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=r._createHelper(o)}(),e.RabbitLegacy}(co(),Do(),Qo(),rl())),zl());var Hl=ao.exports,Ul={exports:{}},Kl=Ul.exports=function(e){return e.enc.Hex}(co());Object.defineProperty(so,"__esModule",{value:!0});const ql=Hl,Wl=Eo,Gl=Kl;so.default=class{constructor(e){let t;switch(e){case"sha1":t=ql.algo.SHA1;break;case"sha256":t=ql.algo.SHA256;break;default:throw new Error("unsupported hash algorithm. Only sha1 and sha256 are supported.")}this._cryptoJSHasher=t.create()}digest(e){const t=this._cryptoJSHasher.finalize();let r;switch(e){case"base64":r=Wl.default;break;case"hex":r=Gl.default;break;default:throw new Error("unsupported output encoding. Only base64 and hex are supported.")}return t.toString(r)}update(e){return this._cryptoJSHasher.update(e),this}};var Xl={};Object.defineProperty(Xl,"__esModule",{value:!0});const Jl=Hl;Xl.default=class{constructor(e,t){let r;switch(e){case"sha1":r=Jl.algo.SHA1;break;case"sha256":r=Jl.algo.SHA256;break;default:throw new Error("unsupported hash algorithm. Only sha1 and sha256 are supported.")}this._cryptoJSHmac=Jl.algo.HMAC.create(r,t)}digest(e){const t=this._cryptoJSHmac.finalize();if("base64"===e)return t.toString(CryptoJS.enc.Base64);if("hex"===e)return t.toString(CryptoJS.enc.Hex);throw new Error("unsupported output encoding. Only base64 and hex are supported.")}update(e){return this._cryptoJSHmac.update(e),this}},Object.defineProperty(io,"__esModule",{value:!0});const Yl=no,Zl=so,Ql=Xl;io.default=class{createHash(e){return new Zl.default(e)}createHmac(e,t){return new Ql.default(e,t)}randomUUID(){const e=new Uint32Array(1);return Yl.crypto.getRandomValues(e),e.join()}};var ec={};Object.defineProperty(ec,"__esModule",{value:!0});const tc=n;class rc{constructor(){this.headers={},this.status=0}text(){return Promise.resolve("")}json(){return Promise.resolve({})}}ec.default=class{fetch(e,t={}){return Promise.resolve(new rc)}createEventSource(e,t){return new tc.NullEventSource(e,t)}getEventSourceCapabilities(){return{readTimeout:!1,headers:!1,customMethod:!1}}},Object.defineProperty(ro,"__esModule",{value:!0});const ic=io,nc=ec;ro.default=class{constructor(e){this.crypto=new ic.default,this.requests=new nc.default,this.info=e}};var sc={};Object.defineProperty(sc,"__esModule",{value:!0});class ac{constructor(e,t,r){this._platformName=e,this._sdkName=t,this._sdkVersion=r}platformData(){return{name:this._platformName}}sdkData(){return{name:this._sdkName,version:this._sdkVersion,userAgentBase:"AkamaiEdgeSDK"}}}sc.default=(e,t,r)=>new ac(e,t,r),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)},s=t&&t.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};Object.defineProperty(e,"__esModule",{value:!0}),e.init=e.EdgeFeatureStore=void 0;const a=n,o=qa,l=eo;Object.defineProperty(e,"EdgeFeatureStore",{enumerable:!0,get:function(){return l.EdgeFeatureStore}});const c=ro,u=sc,d=Wa;i(n,e);e.init=e=>{var t;const{sdkKey:r,options:i={},featureStoreProvider:n,platformName:h,sdkName:f,sdkVersion:p}=e,v=null!==(t=i.logger)&&void 0!==t?t:a.BasicLogger.get(),g=i,{cacheTtlMs:_}=g,y=s(g,["cacheTtlMs"]),m=new l.EdgeFeatureStore(n,r,"Akamai",v,null!=_?_:100),b=Object.assign({featureStore:m,logger:v},y);(0,d.validateOptions)(e.sdkKey,b);const S=(0,u.default)(h,f,p);return new o.default(r,new c.default(S),b)}}(i);const oc=({options:e={},sdkKey:t,featureStoreProvider:r})=>i.init({sdkKey:t,options:e,featureStoreProvider:r,platformName:"Akamai EdgeWorker",sdkName:"@launchdarkly/akamai-server-base-sdk",sdkVersion:"3.0.12"});export{oc as init};
19
19
  //# sourceMappingURL=bundle.es.js.map