@launchdarkly/akamai-server-base-sdk 3.0.2 → 3.0.3
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.
- package/CHANGELOG.md +10 -0
- package/dist/cjs/bundle.cjs.js +3 -3
- package/dist/cjs/bundle.cjs.js.map +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/esm/bundle.es.js +3 -3
- package/dist/esm/bundle.es.js.map +1 -1
- package/dist/esm/package.json +1 -1
- package/package.json +3 -3
package/dist/esm/bundle.es.js
CHANGED
|
@@ -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)))}}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 h{is(e){return"number"==typeof e||"string"==typeof e&&u.test(e)}getType(){return"date"}}class d 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}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 h,f.Kind=new d,f.NullableBoolean=new c;const _="user";function y(e){return e.includes("%")||e.includes(":")?e.replace(/%/g,"%25").replace(/:/g,"%3A"):e}function m(e){return f.Kind.is(e)}function b(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(m);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=>b(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=m(r),n=b(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=_){return e.isKind?this.kinds:w._getValueFromContext(e,this._contextForKind(t))}key(e=_){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}:${y(this._contexts[e].key)}`)).join(":"):`${this.kind}:${y(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}}w.UserKind=_;const S=["key","kind","_meta","anonymous"].map((e=>new r(e,!0))),k=["name","ip","firstName","lastName","email","avatar","country"];class O{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=>!S.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&&k.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}}var x,R,D,A;e.DataSourceErrorKind=void 0,(x=e.DataSourceErrorKind||(e.DataSourceErrorKind={})).Unknown="UNKNOWN",x.NetworkError="NETWORK_ERROR",x.ErrorResponse="ERROR_RESPONSE",x.InvalidData="INVALID_DATA";class I extends Error{constructor(e){super(e),this.name="LaunchDarklyFileDataSourceError"}}class P extends Error{constructor(e,t,r,i=!0){super(t),this.kind=e,this.status=r,this.name="LaunchDarklyPollingError",this.recoverable=i}}class T extends Error{constructor(e,t,r,i=!0){super(t),this.kind=e,this.code=r,this.name="LaunchDarklyStreamingError",this.recoverable=i}}e.AutoEnvAttributes=void 0,(R=e.AutoEnvAttributes||(e.AutoEnvAttributes={}))[R.Disabled=0]="Disabled",R[R.Enabled=1]="Enabled",function(e){e[e.AnalyticsEvents=0]="AnalyticsEvents",e[e.DiagnosticEvent=1]="DiagnosticEvent"}(D||(D={})),function(e){e[e.Succeeded=0]="Succeeded",e[e.Failed=1]="Failed",e[e.FailedAndMustShutDown=2]="FailedAndMustShutDown"}(A||(A={}));var M=Object.freeze({__proto__:null,get LDDeliveryStatus(){return A},get LDEventType(){return D}});function C(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 N={s:e=>C(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=>C(e),o:e=>C(e),O:e=>C(e),c:()=>""};function j(...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 N&&e.length){const t=e.shift();r+=N[n]?.(t)}else r+="%"===n?"%":`%${n}`;i+=2}}else r+=n,i+=1}return e.length&&(r.length&&(r+=" "),r+=e.map(C).join(" ")),r}return e.map(C).join(" ")}var $;!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"}($||($={}));const F=["debug","info","warn","error","none"];class L{static get(){return new L({})}constructor(e){if(this._logLevel=$[e.level??"info"]??$.info,this._name=e.name??"LaunchDarkly",this._formatter=e.formatter,"object"==typeof e.destination)this._destinations={[$.debug]:e.destination.debug,[$.info]:e.destination.info,[$.warn]:e.destination.warn,[$.error]:e.destination.error};else if("function"==typeof e.destination){const{destination:t}=e;this._destinations={[$.debug]:t,[$.info]:t,[$.warn]:t,[$.error]:t}}}_tryFormat(...e){try{return this._formatter?this._formatter?.(...e):j(...e)}catch{return j(...e)}}_tryWrite(e,t){try{e(t)}catch{console.error(t)}}_log(e,t){if(e>=this._logLevel){const r=`${F[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($.error,e)}warn(...e){this._log($.warn,e)}info(...e){this._log($.info,e)}debug(...e){this._log($.debug,e)}}const B={error:f.Function,warn:f.Function,info:f.Function,debug:f.Function};class V{constructor(e,t){Object.entries(B).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 z{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 K=f.stringMatchingRegex(/^(\w|\.|-)+$/),H=(e,t)=>K.is(e)?e.length>64?{valid:!1,message:z.tagValueTooLong(t)}:{valid:!0}:{valid:!1,message:z.invalidTagValue(t)};function U(e){return e.replace(/\/+$/,"")}function q(e){return e.replace(/^\/+/,"").replace(/\?$/,"")}class W{constructor(e,t,r=W.DEFAULT_EVENTS,i="/bulk",n="/diagnostic",s=!0,a){this.streaming=U(e),this.polling=U(t),this.events=U(r),this.analyticsEventPath=i,this.diagnosticEventPath=n,this.includeAuthorizationHeader=s,this.payloadFilterKey=a}}function G(e,t){if(0===t.length)return e;return`${e}?${t.map((({key:e,value:t})=>`${e}=${t}`)).join("&")}`}function X(e,t,r){const i=q(t);return G(`${e.events}/${i}`,r)}W.DEFAULT_EVENTS="https://events.launchdarkly.com";class J extends Error{constructor(e){super(e),this.name="LaunchDarklyUnexpectedResponseError"}}class Y extends Error{constructor(e){super(e),this.name="LaunchDarklyClientError"}}class Z extends Error{constructor(e){super(e),this.name="LaunchDarklyTimeoutError"}}function Q(e){return!(e>=400&&e<500)||(400===e||408===e||429===e)}function ee(e){return 413===e||Q(e)}const te=(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?te(i,t):i),e)),{}):e;function re(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 ie=async(e=1e3)=>new Promise((e=>{}));var ne;!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"}(ne||(ne={}));var se=ne;class ae{static invalidMetricValue(e){return`The track function was called with a non-numeric "metricValue" (${e}), only numeric metric values are supported.`}}ae.MissingContextKeyNoEvent="Context was unspecified or had no key; event will not be sent";class oe{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=X(r.serviceEndpoints,n,[]),this._diagnosticEventsUri=X(r.serviceEndpoints,s,[]),this._requests=o,this._crypto=a}async _tryPostingEvents(e,t,r,i){const n={status:A.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),method:"POST",keepalive:!0}),o=Date.parse(i.get("date")||"");if(o&&(n.serverTime=o),r<=204)return n;if(a=new J(re({status:r,message:"some events were dropped"},"event posting")),!Q(r))return ee(r)?n.status=A.Failed:n.status=A.FailedAndMustShutDown,n.error=a,n}catch(e){a=e}return a&&!i?(n.status=A.Failed,n.error=a,n):(await ie(),this._tryPostingEvents(e,this._eventsUri,r,!1))}async sendEventData(e,t){const r=e===D.AnalyticsEvents?this._crypto.randomUUID():void 0,i=e===D.AnalyticsEvents?this._eventsUri:this._diagnosticEventsUri;return this._tryPostingEvents(t,i,r,!0)}}function le(e){return"feature"===e.kind}class ce{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 ue{constructor(){this._startDate=0,this._endDate=0,this._counters={},this._contextKinds={}}summarizeEvent(e){if(le(e)&&!e.excludeFromSummaries){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 ce(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}),{});return{startDate:this._startDate,endDate:this._endDate,features:e,kind:"summary"}}clearSummary(){this._startDate=0,this._endDate=0,this._counters={},this._contextKinds={}}}class he extends Error{constructor(e){super(e),this.name="LaunchDarklyInvalidSDKKeyError"}}function de(e){const t=Math.trunc(e);return 1===t||0!==t&&0===Math.floor(Math.random()*t)}class fe{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 pe{constructor(e,t,r,i,n,s,a,o,l,c,u,h,d=1){this.withReasons=e,this.context=t,this.key=r,this.samplingRatio=d,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!==h&&(this.excludeFromSummaries=h)}}class ve{constructor(e,t=1){this.context=e,this.samplingRatio=t,this.kind="identify",this.creationDate=Date.now()}}var ge=Object.freeze({__proto__:null,ClientMessages:ae,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:se,EventFactoryBase:class{constructor(e){this._withReasons=e}evalEvent(e){return new pe(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 pe(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 ve(e,1)}customEvent(e,t,r,i,n=1){return new fe(t,e,r??void 0,i??void 0,n)}},EventProcessor:class{constructor(e,t,i,n,s,a=!0){this._config=e,this._contextDeduplicator=n,this._diagnosticsManager=s,this._summarizer=new ue,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 oe(t,i),this._contextFilter=new O(e.allAttributesPrivate,e.privateAttributes.map((e=>new r(e)))),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(D.DiagnosticEvent,e)}close(){clearInterval(this._flushTimer),this._flushUsersTimer&&clearInterval(this._flushUsersTimer),this._diagnosticsTimer&&clearInterval(this._diagnosticsTimer)}async flush(){if(this._shutdown)throw new he("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;this._queue=[];const t=this._summarizer.getSummary();this._summarizer.clearSummary(),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(de(e.samplingRatio)){const t={...e};1===t.samplingRatio&&delete t.samplingRatio,this._enqueue(t)}return}this._summarizer.summarizeEvent(e);const t=le(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&&de(e.samplingRatio)&&this._enqueue(this._makeOutputEvent(e,!1)),i&&de(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,contextKeys:e.context.kindsAndKeys};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 le(e)&&e.debugEventsUntilDate&&e.debugEventsUntilDate>this._lastKnownPastTime&&e.debugEventsUntilDate>Date.now()}async _tryPostingEvents(e){const t=await this._eventSender.sendEventData(D.AnalyticsEvents,e);if(t.status===A.FailedAndMustShutDown&&(this._shutdown=!0),t.serverTime&&(this._lastKnownPastTime=t.serverTime),t.error)throw t.error}},InputCustomEvent:fe,InputEvalEvent:pe,InputIdentifyEvent:ve,NullEventProcessor:class{close(){}async flush(){}sendEvent(){}},PayloadReader:class{constructor(e,t,r,i){this._objProcessors=t,this._errorHandler=r,this._logger=i,this._listeners=[],this._tempId=void 0,this._tempBasis=void 0,this._tempUpdates=[],this._processServerIntent=e=>{if(this._resetState(),!e.payloads.length)return;const t=e.payloads[0];switch(t?.code){case"xfer-full":this._tempBasis=!0;break;case"xfer-changes":case"none":this._tempBasis=!1;break;default:return}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 prcoess 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._processPayloadTransferred=e=>{if(!this._tempId||!e.state||!e.version||void 0===this._tempBasis)return void this._resetState();const t={id:this._tempId,version:e.version,state:e.state,basis:this._tempBasis,updates:this._tempUpdates};this._listeners.forEach((e=>e(t))),this._resetState()},this._processGoodbye=e=>{this._logger?.info(`Goodbye was received from the LaunchDarkly connection with reason: ${e.reason}.`),this._resetState()},this._processError=e=>{this._logger?.info(`An issue was encountered receiving updates for payload ${this._tempId} with reason: ${e.reason}. Automatic retry will occur.`),this._resetState()},this._attachHandler(e,"server-intent",this._processServerIntent),this._attachHandler(e,"put-object",this._processPutObject),this._attachHandler(e,"delete-object",this._processDeleteObject),this._attachHandler(e,"payload-transferred",this._processPayloadTransferred),this._attachHandler(e,"goodbye",this._processGoodbye),this._attachHandler(e,"error",this._processError)}addPayloadListener(e){this._listeners.push(e)}removePayloadListener(e){const t=this._listeners.indexOf(e,0);t>-1&&this._listeners.splice(t,1)}_attachHandler(t,r,i){t.addEventListener(r,(async t=>{if(t?.data){this._logger?.debug(`Received ${r} event. Data is ${t.data}`);try{i(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 event stream")}}else this._errorHandler?.(e.DataSourceErrorKind.Unknown,"Unexpected message from event stream")}))}_processObj(e,t){return this._objProcessors[e]?.(t)}_resetState(){this._tempId=void 0,this._tempBasis=void 0,this._tempUpdates=[]}},isLegacyUser:g,isMultiKind:v,isSingleKind:p,shouldSample:de});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}=H(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=L,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.Context=w,e.ContextFilter=O,e.DateValidator=h,e.FactoryOrInstance=i,e.Function=l,e.KindValidator=d,e.LDClientError=Y,e.LDFileDataSourceError=I,e.LDPollingError=P,e.LDStreamingError=T,e.LDTimeoutError=Z,e.LDUnexpectedResponseError=J,e.NullableBoolean=c,e.NumberWithMinimum=a,e.OptionMessages=z,e.SafeLogger=V,e.ServiceEndpoints=W,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 L({level:"info",destination:console.error,formatter:j});return e?new V(e,t):t},e.debounce=(e,t=5e3)=>{let r;return(...e)=>{clearTimeout(r),r=e=>{e()}}},e.deepCompact=te,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=X,e.getPollingUri=function(e,t,r){const i=q(t),n=[...r];return e.payloadFilterKey&&n.push({key:"filter",value:e.payloadFilterKey}),G(`${e.polling}/${i}`,n)},e.getStreamingUri=function(e,t,r){const i=q(t),n=[...r];return e.payloadFilterKey&&n.push({key:"filter",value:e.payloadFilterKey}),G(`${e.streaming}/${i}`,n)},e.httpErrorMessage=re,e.internal=ge,e.isHttpLocallyRecoverable=ee,e.isHttpRecoverable=Q,e.noop=()=>{},e.secondsToMillis=function(e){return Math.trunc(1e3*e)},e.shouldRetry=function({status:e}){return!e||Q(e)},e.sleep=ie,e.subsystem=M,e.timedPromise=(e,t)=>new Promise(((e,t)=>{}))}(o);var l={},c={},u={};Object.defineProperty(u,"__esModule",{value:!0});var h={};Object.defineProperty(h,"__esModule",{value:!0});var d,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"}(d||(f.LDMigrationStage=d={})),f.IsMigrationStage=function(e){return Object.values(d).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(h,g),y(f,g),y(p,g),y(m,g);var b={},E={};Object.defineProperty(E,"__esModule",{value:!0});var w={};Object.defineProperty(w,"__esModule",{value:!0});var S={};Object.defineProperty(S,"__esModule",{value:!0});var k={};Object.defineProperty(k,"__esModule",{value:!0});var O,x,R={};Object.defineProperty(R,"__esModule",{value:!0}),R.LDConcurrentExecution=R.LDSerialExecution=R.LDExecution=R.LDExecutionOrdering=void 0,function(e){e[e.Fixed=0]="Fixed",e[e.Random=1]="Random"}(O||(R.LDExecutionOrdering=O={})),function(e){e[e.Serial=0]="Serial",e[e.Concurrent=1]="Concurrent"}(x||(R.LDExecution=x={}));R.LDSerialExecution=class{constructor(e){this.ordering=e,this.type=x.Serial}};R.LDConcurrentExecution=class{constructor(){this.type=x.Concurrent}},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,e),i(w,e),i(S,e),i(k,e),i(R,e)}(b);var D={};Object.defineProperty(D,"__esModule",{value:!0});var A={};Object.defineProperty(A,"__esModule",{value:!0});var I={};Object.defineProperty(I,"__esModule",{value:!0});var P={};Object.defineProperty(P,"__esModule",{value:!0});var T={};Object.defineProperty(T,"__esModule",{value:!0});var M={},C={};Object.defineProperty(C,"__esModule",{value:!0});var N={};Object.defineProperty(N,"__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(C,e),i(N,e)}(M);var j={},$={};Object.defineProperty($,"__esModule",{value:!0});var F={};Object.defineProperty(F,"__esModule",{value:!0});var L={};Object.defineProperty(L,"__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 K={};Object.defineProperty(K,"__esModule",{value:!0});var H={};Object.defineProperty(H,"__esModule",{value:!0});var U={};Object.defineProperty(U,"__esModule",{value:!0});var q={};Object.defineProperty(q,"__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(F,e),i(L,e),i(B,e),i(V,e),i(I,e),i(z,e),i(K,e),i(H,e),i(U,e),i(q,e)}(j);var W={},G={};Object.defineProperty(G,"__esModule",{value:!0});var X={};Object.defineProperty(X,"__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(G,e),i(P,e),i(X,e)}(W),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(D,e),i(A,e),i(I,e),i(P,e),i(T,e),e.integrations=M,e.interfaces=j,e.subsystems=W}(l);var J={},Y={};Object.defineProperty(Y,"__esModule",{value:!0});Y.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(J,"__esModule",{value:!0});const Z=o,Q=s,ee=Y;J.default=class{constructor(e,t,r,i){this._store=e,this._logger=r,this._crypto=i,this.statusProvider=new Q.default((async()=>this._pollStoreAndUpdateStatus())),this._staleTimeMs=1e3*(Z.TypeValidators.Number.is(t.staleAfter)&&t.staleAfter>0?t.staleAfter:120);Z.TypeValidators.Number.is(t.statusPollInterval)&&t.statusPollInterval>0&&t.statusPollInterval;this._pollHandle=e?void 0:null,e&&(this._cache=new ee.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 te={},re={},ie={};Object.defineProperty(ie,"__esModule",{value:!0});class ne{static getKeyFromPath(e,t){return t.startsWith(e.streamApiPath)?t.substring(e.streamApiPath.length):void 0}}ne.Features={namespace:"features",streamApiPath:"/flags/"},ne.Segments={namespace:"segments",streamApiPath:"/segments/"},ie.default=ne,Object.defineProperty(re,"__esModule",{value:!0}),re.deserializeSegment=re.serializeSegment=re.deserializeFlag=re.serializeFlag=re.deserializeDelete=re.deserializePatch=re.deserializePoll=re.deserializeAll=re.processSegment=re.processFlag=re.replacer=re.nullReplacer=void 0;const se=o,ae=ie,oe=100;function le(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 ce(e,t){if(!(t instanceof se.AttributeReference||Array.isArray(t)&&t[0]&&t[0]instanceof se.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 ue(e){e&&e.bucketBy&&(e.bucketByAttributeReference=new se.AttributeReference(e.bucketBy,!e.contextKind))}function he(e){var t;if(le(e,["variations"]),e.fallthrough&&e.fallthrough.rollout){ue(e.fallthrough.rollout)}null===(t=null==e?void 0:e.rules)||void 0===t||t.forEach((e=>{var t;ue(e.rollout),null===(t=null==e?void 0:e.clauses)||void 0===t||t.forEach((e=>{e&&e.attribute?e.attributeReference=new se.AttributeReference(e.attribute,!e.contextKind):e&&(e.attributeReference=se.AttributeReference.InvalidReference)}))}))}function de(e){var t,r,i,n,s;le(e),(null===(t=null==e?void 0:e.included)||void 0===t?void 0:t.length)&&e.included.length>oe&&(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>oe&&(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>oe&&(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>oe&&(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 se.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 se.AttributeReference(e.attribute,!e.contextKind):e&&(e.attributeReference=se.AttributeReference.InvalidReference)}))}))}function fe(e){try{return JSON.parse(e)}catch(e){return}}re.nullReplacer=le,re.replacer=ce,re.processFlag=he,re.processSegment=de,re.deserializeAll=function(e){var t,r;const i=fe(e);if(i)return Object.values((null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.flags)||[]).forEach((e=>{he(e)})),Object.values((null===(r=null==i?void 0:i.data)||void 0===r?void 0:r.segments)||[]).forEach((e=>{de(e)})),i},re.deserializePoll=function(e){const t=fe(e);if(t)return Object.values((null==t?void 0:t.flags)||[]).forEach((e=>{he(e)})),Object.values((null==t?void 0:t.segments)||[]).forEach((e=>{de(e)})),t},re.deserializePatch=function(e){const t=fe(e);if(t)return t.path.startsWith(ae.default.Features.streamApiPath)?(he(t.data),t.kind=ae.default.Features):t.path.startsWith(ae.default.Segments.streamApiPath)&&(de(t.data),t.kind=ae.default.Segments),t},re.deserializeDelete=function(e){const t=fe(e);if(t)return t.path.startsWith(ae.default.Features.streamApiPath)?t.kind=ae.default.Features:t.path.startsWith(ae.default.Segments.streamApiPath)&&(t.kind=ae.default.Segments),t},re.serializeFlag=function(e){return JSON.stringify(e,ce)},re.deserializeFlag=function(e){const t=fe(e);if(t)return he(t),t},re.serializeSegment=function(e){return JSON.stringify(e,ce)},re.deserializeSegment=function(e){const t=fe(e);if(t)return de(t),t},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createStreamListeners=e.createDeleteListener=e.createPatchListener=e.createPutListener=void 0;const t=re,r=ie;e.createPutListener=(e,i,n=()=>{})=>({deserializeData:t.deserializeAll,processJson:async({data:{flags:t,segments:s}})=>{const a={[r.default.Features.namespace]:t,[r.default.Segments.namespace]:s};null==i||i.debug("Initializing all data"),e.init(a,n)}});e.createPatchListener=(e,i,n=()=>{})=>({deserializeData:t.deserializePatch,processJson:async({data:t,kind:s,path:a})=>{if(s){const o=r.default.getKeyFromPath(s,a);o&&(null==i||i.debug(`Updating ${o} in ${s.namespace}`),e.upsert(s,t,n))}}});e.createDeleteListener=(e,i,n=()=>{})=>({deserializeData:t.deserializeDelete,processJson:async({kind:t,path:s,version:a})=>{if(t){const o=r.default.getKeyFromPath(t,s);o&&(null==i||i.debug(`Deleting ${o} in ${t.namespace}`),e.upsert(t,{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}}(te);var pe={},ve={},ge={};Object.defineProperty(ge,"__esModule",{value:!0});ge.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(ve,"__esModule",{value:!0});const _e=ge;ve.default=class{constructor(){this._dependenciesFrom=new _e.default,this._dependenciesTo=new _e.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 _e.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(pe,"__esModule",{value:!0});const ye=ie,me=ve,be=ge;function Ee(e,t){var r,i;const n=new be.default,s=e===ye.default.Features.namespace,a=e===ye.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(ye.default.Segments.namespace,e,!0)}))}))}))}return n}pe.default=class{constructor(e,t,r){this._featureStore=e,this._hasEventListeners=t,this._onChange=r,this._dependencyTracker=new me.default}init(e,t){const r=this._hasEventListeners(),i=i=>{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,Ee(e,i))}))})),r){const t=new be.default;Object.keys(e).forEach((r=>{const n=(null==i?void 0:i[r])||{},s=e[r],a=Object.assign(Object.assign({},n),s);Object.keys(a).forEach((e=>{this.addIfModified(r,e,n&&n[e],s&&s[e],t)}))})),this.sendChangeEvents(t)}})),null==t||t()}))};r?this._featureStore.all(ye.default.Features,(e=>{this._featureStore.all(ye.default.Segments,(t=>{const r={[ye.default.Features.namespace]:e,[ye.default.Segments.namespace]:t};i(r)}))})):i()}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,Ee(e.namespace,t)),n){const r=new be.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===ye.default.Features.namespace&&this._onChange(t)}))}};var we={},Se={},ke={},Oe={};Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.default=function(e){return new Promise((t=>{e((e=>{t(e)}))}))},Object.defineProperty(ke,"__esModule",{value:!0});const xe=Oe;ke.default=class{constructor(e){this._store=e}async get(e,t){return(0,xe.default)((r=>{this._store.get(e,t,r)}))}async all(e){return(0,xe.default)((t=>{this._store.all(e,t)}))}async init(e){return(0,xe.default)((t=>{this._store.init(e,t)}))}async delete(e,t,r){return(0,xe.default)((i=>{this._store.delete(e,t,r,i)}))}async upsert(e,t){return(0,xe.default)((r=>{this._store.upsert(e,t,r)}))}async initialized(){return(0,xe.default)((e=>{this._store.initialized(e)}))}close(){this._store.close()}};var Re={},De={};function Ae(e){return Date.now()>e.expiration}Object.defineProperty(De,"__esModule",{value:!0});De.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||!Ae(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)=>{Ae(e)&&this._storage.delete(t)}))}get size(){return this._storage.size}};var Ie={};Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.persistentStoreKinds=void 0;const Pe=re,Te=ie;Ie.persistentStoreKinds={segments:{namespace:Te.default.Segments.namespace,deserialize:e=>{const t=(0,Pe.deserializeSegment)(e);if(t)return{version:t.version,item:t}},serialize:e=>{const t=(0,Pe.serializeSegment)(e);return{version:e.version,deleted:e.deleted,serializedItem:t}},priority:0},features:{namespace:Te.default.Features.namespace,deserialize:e=>{const t=(0,Pe.deserializeFlag)(e);if(t)return{version:t.version,item:t}},serialize:e=>{const t=(0,Pe.serializeFlag)(e);return{version:e.version,deleted:e.deleted,serializedItem:t}},priority:1}};var Me={};Object.defineProperty(Me,"__esModule",{value:!0});const Ce=Ie;function Ne(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}Me.default=function(e){const t=[];return Object.keys(e).forEach((r=>{const i=Ce.persistentStoreKinds[r];t.push({key:i,item:Ne(i,e[r])})})),t.sort(((e,t)=>e.key.priority-t.key.priority)),t};var je={};Object.defineProperty(je,"__esModule",{value:!0});je.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(Re,"__esModule",{value:!0});const $e=De,Fe=Ie,Le=Me,Be=je;function Ve(e,t){return`${e.namespace}:${t}`}function ze(e){return`$all:${e.namespace}`}const Ke="$checkedInit";function He(e){return!e||e.item.deleted?null:e.item}function Ue(e){return{version:e,item:{version:e,deleted:!0}}}function qe(e,t){if(t.deleted||!t.serializedItem)return Ue(t.version);const r=e.deserialize(t.serializedItem);return void 0===r?Ue(t.version):0===r.version||r.version===t.version||void 0===r.item?r:{version:t.version,item:r.item}}Re.default=class{constructor(e,t){this._core=e,this._isInitialized=!1,this._queue=new Be.default,t&&(this._itemCache=new $e.default({ttl:t,checkInterval:600}),this._allItemsCache=new $e.default({ttl:t,checkInterval:600}))}init(e,t){this._queue.enqueue((t=>{this._core.init((0,Le.default)(e),(()=>{this._isInitialized=!0,this._itemCache&&(this._itemCache.clear(),this._allItemsCache.clear(),Object.keys(e).forEach((t=>{const r=Fe.persistentStoreKinds[t],i=e[t];this._allItemsCache.set(ze(r),i),Object.keys(i).forEach((e=>{const t=i[e],n={version:t.version,item:t};this._itemCache.set(Ve(r,e),n)}))}))),t()}))}),t)}get(e,t,r){if(this._itemCache){const i=this._itemCache.get(Ve(e,t));if(i)return void r(He(i))}const i=Fe.persistentStoreKinds[e.namespace];this._core.get(i,t,(n=>{var s;if(n&&n.serializedItem){const a=qe(i,n);return null===(s=this._itemCache)||void 0===s||s.set(Ve(e,t),a),void r(He(a))}r(null)}))}initialized(e){var t;this._isInitialized?e(!0):(null===(t=this._itemCache)||void 0===t?void 0:t.get(Ke))?e(!1):this._core.initialized((t=>{var r;this._isInitialized=t,this._isInitialized||null===(r=this._itemCache)||void 0===r||r.set(Ke,!0),e(this._isInitialized)}))}all(e,t){var r;const i=null===(r=this._allItemsCache)||void 0===r?void 0:r.get(ze(e));if(i)return void t(i);const n=Fe.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=He(qe(n,t));r&&(s[e]=r)})),null===(i=this._allItemsCache)||void 0===i||i.set(ze(e),s),t(s)}))}upsert(e,t,r){this._queue.enqueue((r=>{this._allItemsCache&&this._allItemsCache.clear();const i=Fe.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=qe(i,s);null===(a=this._itemCache)||void 0===a||a.set(Ve(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()}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserializePoll=e.PersistentDataStoreWrapper=e.AsyncStoreFacade=void 0;const t=ke;e.AsyncStoreFacade=t.default;const r=Re;e.PersistentDataStoreWrapper=r.default;const i=re;Object.defineProperty(e,"deserializePoll",{enumerable:!0,get:function(){return i.deserializePoll}})}(Se),Object.defineProperty(we,"__esModule",{value:!0});const We=o,Ge=Se,Xe=ie;we.default=class{constructor(e,t,r,i=()=>{},n){this._requestor=t,this._featureStore=r,this._initSuccessHandler=i,this._errorHandler=n,this._stopped=!1,this._logger=e.logger,this._pollInterval=e.pollInterval}_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 We.LDPollingError(We.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)=>{var n,s,a,o;const l=Date.now()-r,c=Math.max(1e3*this._pollInterval-l,0);if(null===(n=this._logger)||void 0===n||n.debug("Elapsed: %d ms, sleeping for %d ms",l,c),e){const{status:t}=e;if(t&&!(0,We.isHttpRecoverable)(t)){const r=(0,We.httpErrorMessage)(e,"polling request");return null===(s=this._logger)||void 0===s||s.error(r),void(null===(a=this._errorHandler)||void 0===a||a.call(this,new We.LDPollingError(We.DataSourceErrorKind.ErrorResponse,r,t)))}null===(o=this._logger)||void 0===o||o.warn((0,We.httpErrorMessage)(e,"polling request","will retry"))}else if(i){const e=(0,Ge.deserializePoll)(i);if(e){const t={[Xe.default.Features.namespace]:e.flags,[Xe.default.Segments.namespace]:e.segments};return void this._featureStore.init(t,(()=>{this._initSuccessHandler(),this._timeoutHandle=e=>{e()}}))}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 Je={};Object.defineProperty(Je,"__esModule",{value:!0});const Ye=o;Je.default=class{constructor(e,t,r){this._requests=t,this._eTagCache={},this._headers=Object.assign({},r),this._uri=(0,Ye.getPollingUri)(e.serviceEndpoints,"/sdk/latest-all",[])}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){const t={method:"GET",headers:this._headers};try{const{res:r,body:i}=await this._requestWithETagCache(this._uri,t);if(200!==r.status&&304!==r.status){return e(new Ye.LDPollingError(Ye.DataSourceErrorKind.ErrorResponse,`Unexpected status code: ${r.status}`,r.status),void 0)}return e(void 0,304===r.status?null:i)}catch(t){return e(t,void 0)}}};var Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});const Qe=o;Ze.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:h}=c;this._headers=Object.assign({},n),this._logger=u,this._requests=h,this._streamUri=(0,Qe.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,Qe.shouldRetry)(e)?(null===(i=this._logger)||void 0===i||i.warn((0,Qe.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 Qe.LDStreamingError(Qe.DataSourceErrorKind.ErrorResponse,e.message,e.status)),null===(r=this._logger)||void 0===r||r.error((0,Qe.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=()=>{var e;null===(e=this._logger)||void 0===e||e.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 Qe.LDStreamingError(Qe.DataSourceErrorKind.InvalidData,"Malformed JSON data in event stream"))})(i,n,this._logger,this._errorHandler);r(s)}else null===(s=this._errorHandler)||void 0===s||s.call(this,new Qe.LDStreamingError(Qe.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 et={},tt={},rt={};Object.defineProperty(rt,"__esModule",{value:!0});rt.default=class{constructor(){this._allData={},this._initCalled=!1}_addItem(e,t,r){let i=this._allData[e.namespace];if(i||(i={},this._allData[e.namespace]=i),Object.hasOwnProperty.call(i,t)){const e=i[t];(!e||e.version<r.version)&&(i[t]=r)}else i[t]=r}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){this._initCalled=!0,this._allData=e,null==t||t()}delete(e,t,r,i){const n={version:r,deleted:!0};this._addItem(e,t,n),null==i||i()}upsert(e,t,r){this._addItem(e,t.key,t),null==r||r()}initialized(e){return null==e?void 0:e(this._initCalled)}close(){}getDescription(){return"memory"}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultValues=void 0;const t=o,r=rt,i={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,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[]",{})};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:30,offline:!1,useLdd:!1,allAttributesPrivate:!1,privateAttributes:[],contextKeysCapacity:1e3,contextKeysFlushInterval:300,diagnosticOptOut:!1,diagnosticRecordingInterval:900,featureStore:()=>new r.default};e.default=class{constructor(r={},n={}){r=r||{},this.logger=r.logger;const{errors:s,validatedOptions:a}=function(r){const n=[],s=Object.assign({},e.defaultValues);return Object.keys(r).forEach((a=>{var o;const l=r[a],c=i[a];if(c)if(c.is(l))s[a]=l;else if("boolean"===c.getType())n.push(t.OptionMessages.wrongOptionTypeBoolean(a,typeof l)),s[a]=!!l;else if(c instanceof t.NumberWithMinimum&&t.TypeValidators.Number.is(l)){const{min:e}=c;n.push(t.OptionMessages.optionBelowMinimum(a,l,e)),s[a]=e}else n.push(t.OptionMessages.wrongOptionType(a,c.getType(),typeof l)),s[a]=e.defaultValues[a];else null===(o=r.logger)||void 0===o||o.warn(t.OptionMessages.unknownOption(a))})),{errors:n,validatedOptions:s}}(r);s.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,h=null!=l;c===u&&c===h||(!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")),!h&&r.sendEvents&&(null===(s=r.logger)||void 0===s||s.warn(t.OptionMessages.partialEndpoint("eventsUri"))))}(r,a),this.serviceEndpoints=new t.ServiceEndpoints(a.streamUri,a.baseUri,a.eventsUri,n.analyticsEventPath,n.diagnosticEventPath,n.includeAuthorizationHeader,a.payloadFilterKey),this.eventsCapacity=a.capacity,this.timeout=a.timeout,this.bigSegments=a.bigSegments,this.flushInterval=a.flushInterval,this.pollInterval=a.pollInterval,this.proxyOptions=a.proxyOptions,this.offline=a.offline,this.stream=a.stream,this.streamInitialReconnectDelay=a.streamInitialReconnectDelay,this.useLdd=a.useLdd,this.sendEvents=a.sendEvents,this.allAttributesPrivate=a.allAttributesPrivate,this.privateAttributes=a.privateAttributes,this.contextKeysCapacity=a.contextKeysCapacity,this.contextKeysFlushInterval=a.contextKeysFlushInterval,this.tlsParams=a.tlsParams,this.diagnosticOptOut=a.diagnosticOptOut,this.wrapperName=a.wrapperName,this.payloadFilterKey=a.payloadFilterKey,this.wrapperVersion=a.wrapperVersion,this.tags=new t.ApplicationTags(a),this.diagnosticRecordingInterval=a.diagnosticRecordingInterval,t.TypeValidators.Function.is(a.updateProcessor)?this.updateProcessorFactory=a.updateProcessor:this.updateProcessorFactory=()=>a.updateProcessor,t.TypeValidators.Function.is(a.featureStore)?this.featureStoreFactory=a.featureStore:this.featureStoreFactory=()=>a.featureStore,this.hooks=a.hooks}}}(tt),Object.defineProperty(et,"__esModule",{value:!0});const it=o,nt=tt;et.default=(e,t,r)=>{var i,n,s,a,o,l;return{customBaseURI:e.serviceEndpoints.polling!==nt.defaultValues.baseUri,customStreamURI:e.serviceEndpoints.streaming!==nt.defaultValues.streamUri,customEventsURI:e.serviceEndpoints.events!==nt.defaultValues.eventsUri,eventsCapacity:e.eventsCapacity,connectTimeoutMillis:(0,it.secondsToMillis)(e.timeout),socketTimeoutMillis:(0,it.secondsToMillis)(e.timeout),eventsFlushIntervalMillis:(0,it.secondsToMillis)(e.flushInterval),pollingIntervalMillis:(0,it.secondsToMillis)(e.pollInterval),reconnectTimeMillis:(0,it.secondsToMillis)(e.streamInitialReconnectDelay),contextKeysFlushIntervalMillis:(0,it.secondsToMillis)(e.contextKeysFlushInterval),diagnosticRecordingIntervalMillis:(0,it.secondsToMillis)(e.diagnosticRecordingInterval),streamingDisabled:!e.stream,usingRelayDaemon:e.useLdd,offline:e.offline,allAttributesPrivate:e.allAttributesPrivate,contextKeysCapacity:e.contextKeysCapacity,usingProxy:!!(null===(n=(i=t.requests).usingProxy)||void 0===n?void 0:n.call(i)),usingProxyAuthenticator:!!(null===(a=(s=t.requests).usingProxyAuth)||void 0===a?void 0:a.call(s)),dataStoreType:null!==(l=null===(o=r.getDescription)||void 0===o?void 0:o.call(r))&&void 0!==l?l:"memory"}};var st={};Object.defineProperty(st,"__esModule",{value:!0}),st.allAsync=st.firstSeriesAsync=st.allSeriesAsync=st.firstResult=void 0,st.firstResult=function(e,t){let r;return null==e||e.some(((e,i)=>(r=t(e,i),!!r))),r};function at(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((()=>{at(e,t,r,i+1,n)})):at(e,t,r,i+1,n)})):n(r):n(!1)}st.allSeriesAsync=function(e,t,r){at(e,t,!0,0,r)},st.firstSeriesAsync=function(e,t,r){at(e,t,!1,0,r)},st.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 ot={},lt={};Object.defineProperty(lt,"__esModule",{value:!0});class ct{static prerequisiteFailed(e){return{kind:"PREREQUISITE_FAILED",prerequisiteKey:e}}static ruleMatch(e,t){return{kind:"RULE_MATCH",ruleId:e,ruleIndex:t}}}ct.Fallthrough={kind:"FALLTHROUGH"},ct.Off={kind:"OFF"},ct.TargetMatch={kind:"TARGET_MATCH"},lt.default=ct,Object.defineProperty(ot,"__esModule",{value:!0});const ut=lt;class ht{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===ut.default.Off.kind}setDefault(e){this.detail.value=e}static forError(e,t,r){return new ht(!0,{value:null!=r?r:null,variationIndex:null,reason:{kind:"ERROR",errorKind:e}},t)}static forSuccess(e,t,r){return new ht(!1,{value:e,variationIndex:void 0===r?null:r,reason:t})}}ot.default=ht;var dt={},ft={};Object.defineProperty(ft,"__esModule",{value:!0});ft.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 pt={},vt={};Object.defineProperty(vt,"__esModule",{value:!0}),vt.getBucketBy=vt.getOffVariation=vt.getVariation=void 0;const gt=o,_t=ot,{ErrorKinds:yt}=gt.internal,mt=new gt.AttributeReference("key");function bt(e,t,r){return gt.TypeValidators.Number.is(t)&&t>=0&&t<e.variations.length?_t.default.forSuccess(e.variations[t],r,t):_t.default.forError(yt.MalformedFlag,"Invalid variation index in flag")}vt.getVariation=bt,vt.getOffVariation=function(e,t){return gt.TypeValidators.Number.is(e.offVariation)?bt(e,e.offVariation,t):_t.default.forSuccess(null,t)},vt.getBucketBy=function(e,t){var r;return null!==(r=e?void 0:t)&&void 0!==r?r:mt},Object.defineProperty(pt,"__esModule",{value:!0});const Et=o,wt=st,St=lt,kt=vt;function Ot(e,t,r){const i=r.key(t.contextKind);if(void 0!==i){if(t.values.indexOf(i)>=0)return(0,kt.getVariation)(e,t.variation,St.default.TargetMatch)}}pt.default=function(e,t){var r;return(null===(r=e.contextTargets)||void 0===r?void 0:r.length)?(0,wt.firstResult)(e.contextTargets,(r=>{if(!r.contextKind||r.contextKind===Et.Context.UserKind){const i=(e.targets||[]).find((e=>e.variation===r.variation));return i?Ot(e,i,t):void 0}return Ot(e,r,t)})):(0,wt.firstResult)(e.targets,(r=>Ot(e,r,t)))};var xt={};Object.defineProperty(xt,"__esModule",{value:!0}),xt.default=function(e){return`${e.key}.g${e.generation}`};var Rt={},Dt={},At={exports:{}};var It={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 Pt="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}=It,s=Pt,a=(t=e.exports={}).re=[],o=t.safeRe=[],l=t.src=[],c=t.t={};let u=0;const h="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",n],[h,i]],f=(e,t,r)=>{const i=(e=>{for(const[t,r]of d)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-]${h}*`),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",`${h}+`),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*$")}(At,At.exports);var Tt=At.exports;const Mt=Object.freeze({loose:!0}),Ct=Object.freeze({});var Nt=e=>e?"object"!=typeof e?Mt:e:Ct;const jt=/^[0-9]+$/,$t=(e,t)=>{const r=jt.test(e),i=jt.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};var Ft={compareIdentifiers:$t,rcompareIdentifiers:(e,t)=>$t(t,e)};const Lt=Pt,{MAX_LENGTH:Bt,MAX_SAFE_INTEGER:Vt}=It,{safeRe:zt,t:Kt}=Tt,Ht=Nt,{compareIdentifiers:Ut}=Ft;var qt=class e{constructor(t,r){if(r=Ht(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>Bt)throw new TypeError(`version is longer than ${Bt} characters`);Lt("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const i=t.trim().match(r.loose?zt[Kt.LOOSE]:zt[Kt.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>Vt||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Vt||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Vt||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<Vt)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(Lt("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)),Ut(this.major,t.major)||Ut(this.minor,t.minor)||Ut(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(Lt("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 Ut(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(Lt("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 Ut(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===Ut(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 Wt=qt;var Gt=(e,t,r=!1)=>{if(e instanceof Wt)return e;try{return new Wt(e,t)}catch(e){if(!r)return null;throw e}};const Xt=Gt;var Jt=(e,t)=>{const r=Xt(e,t);return r?r.version:null};const Yt=Gt;var Zt=(e,t)=>{const r=Yt(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const Qt=qt;var er=(e,t,r,i,n)=>{"string"==typeof r&&(n=i,i=r,r=void 0);try{return new Qt(e instanceof Qt?e.version:e,r).inc(t,i,n).version}catch(e){return null}};const tr=Gt;var rr=(e,t)=>{const r=tr(e,null,!0),i=tr(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 ir=qt;var nr=(e,t)=>new ir(e,t).major;const sr=qt;var ar=(e,t)=>new sr(e,t).minor;const or=qt;var lr=(e,t)=>new or(e,t).patch;const cr=Gt;var ur=(e,t)=>{const r=cr(e,t);return r&&r.prerelease.length?r.prerelease:null};const hr=qt;var dr=(e,t,r)=>new hr(e,r).compare(new hr(t,r));const fr=dr;var pr=(e,t,r)=>fr(t,e,r);const vr=dr;var gr=(e,t)=>vr(e,t,!0);const _r=qt;var yr=(e,t,r)=>{const i=new _r(e,r),n=new _r(t,r);return i.compare(n)||i.compareBuild(n)};const mr=yr;var br=(e,t)=>e.sort(((e,r)=>mr(e,r,t)));const Er=yr;var wr=(e,t)=>e.sort(((e,r)=>Er(r,e,t)));const Sr=dr;var kr=(e,t,r)=>Sr(e,t,r)>0;const Or=dr;var xr=(e,t,r)=>Or(e,t,r)<0;const Rr=dr;var Dr=(e,t,r)=>0===Rr(e,t,r);const Ar=dr;var Ir=(e,t,r)=>0!==Ar(e,t,r);const Pr=dr;var Tr=(e,t,r)=>Pr(e,t,r)>=0;const Mr=dr;var Cr=(e,t,r)=>Mr(e,t,r)<=0;const Nr=Dr,jr=Ir,$r=kr,Fr=Tr,Lr=xr,Br=Cr;var Vr=(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 Nr(e,r,i);case"!=":return jr(e,r,i);case">":return $r(e,r,i);case">=":return Fr(e,r,i);case"<":return Lr(e,r,i);case"<=":return Br(e,r,i);default:throw new TypeError(`Invalid operator: ${t}`)}};const zr=qt,Kr=Gt,{safeRe:Hr,t:Ur}=Tt;var qr,Wr,Gr,Xr,Jr,Yr,Zr,Qr,ei,ti,ri=(e,t)=>{if(e instanceof zr)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=Hr[Ur.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),Hr[Ur.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;Hr[Ur.COERCERTL].lastIndex=-1}else r=e.match(Hr[Ur.COERCE]);return null===r?null:Kr(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function ii(){if(Xr)return Gr;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}Xr=1,Gr=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{(Wr?qr:(Wr=1,qr=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}))(e)}catch(e){}return Gr}function ni(){if(Qr)return Zr;Qr=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&&d)|(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,R(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],h),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(D(this.set[t],e,this.options))return!0;return!1}}Zr=e;const t=function(){if(Yr)return Jr;Yr=1;const e=ii(),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"),h=()=>1,d=(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 Jr=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||h;if(this[i]="function"!=typeof r?h: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=h),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 h=u?Date.now():0,d=this[i](n,e);if(this[c].has(e)){if(d>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=h,i.maxAge=u,i.value=n,this[r]+=d-i.length,i.length=d,this.get(e),p(this),!0}const f=new g(e,n,d,h,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 d(this,e,!0)}peek(e){return d(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)=>d(this,t,!1)))}},Jr}(),r=new t({max:1e3}),i=Nt,n=si(),s=Pt,a=qt,{safeRe:o,t:l,comparatorTrimReplace:c,tildeTrimReplace:u,caretTrimReplace:h}=Tt,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:f}=It,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=E(e,t),s("caret",e),e=m(e,t),s("tildes",e),e=S(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}))},E=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(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}))},S=(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),h=u||y(o),d=h;return"="===i&&d&&(i=""),l=t.includePrerelease?"-0":"",c?r=">"===i||"<"===i?"<0.0.0-0":"*":i&&d?(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`:h&&(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],"")),R=e=>(t,r,i,n,s,a,o,l,c,u,h,d,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(h)?`<${c}.${+u+1}.0-0`:d?`<=${c}.${u}.${h}-${d}`:e?`<${c}.${u}.${+h+1}-0`:`<=${l}`}`.trim(),D=(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 Zr}function si(){if(ti)return ei;ti=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(">")))))))}}ei=t;const r=Nt,{safeRe:i,t:n}=Tt,s=Vr,a=Pt,o=qt,l=ni();return ei}const ai=ni();var oi=(e,t,r)=>{try{t=new ai(t,r)}catch(e){return!1}return t.test(e)};const li=ni();var ci=(e,t)=>new li(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")));const ui=qt,hi=ni();var di=(e,t,r)=>{let i=null,n=null,s=null;try{s=new hi(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 fi=qt,pi=ni();var vi=(e,t,r)=>{let i=null,n=null,s=null;try{s=new pi(t,r)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(i&&1!==n.compare(e)||(i=e,n=new fi(i,r)))})),i};const gi=qt,_i=ni(),yi=kr;var mi=(e,t)=>{e=new _i(e,t);let r=new gi("0.0.0");if(e.test(r))return r;if(r=new gi("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 gi(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":n&&!yi(t,n)||(n=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!n||r&&!yi(r,n)||(r=n)}return r&&e.test(r)?r:null};const bi=ni();var Ei=(e,t)=>{try{return new bi(e,t).range||"*"}catch(e){return null}};const wi=qt,Si=si(),{ANY:ki}=Si,Oi=ni(),xi=oi,Ri=kr,Di=xr,Ai=Cr,Ii=Tr;var Pi=(e,t,r,i)=>{let n,s,a,o,l;switch(e=new wi(e,i),t=new Oi(t,i),r){case">":n=Ri,s=Ai,a=Di,o=">",l=">=";break;case"<":n=Di,s=Ii,a=Ri,o="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(xi(e,t,i))return!1;for(let r=0;r<t.set.length;++r){const c=t.set[r];let u=null,h=null;if(c.forEach((e=>{e.semver===ki&&(e=new Si(">=0.0.0")),u=u||e,h=h||e,n(e.semver,u.semver,i)?u=e:a(e.semver,h.semver,i)&&(h=e)})),u.operator===o||u.operator===l)return!1;if((!h.operator||h.operator===o)&&s(e,h.semver))return!1;if(h.operator===l&&a(e,h.semver))return!1}return!0};const Ti=Pi;var Mi=(e,t,r)=>Ti(e,t,">",r);const Ci=Pi;var Ni=(e,t,r)=>Ci(e,t,"<",r);const ji=ni();var $i=(e,t,r)=>(e=new ji(e,r),t=new ji(t,r),e.intersects(t,r));const Fi=oi,Li=dr;const Bi=ni(),Vi=si(),{ANY:zi}=Vi,Ki=oi,Hi=dr,Ui=[new Vi(">=0.0.0-0")],qi=[new Vi(">=0.0.0")],Wi=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===zi){if(1===t.length&&t[0].semver===zi)return!0;e=r.includePrerelease?Ui:qi}if(1===t.length&&t[0].semver===zi){if(r.includePrerelease)return!0;t=qi}const i=new Set;let n,s,a,o,l,c,u;for(const t of e)">"===t.operator||">="===t.operator?n=Gi(n,t,r):"<"===t.operator||"<="===t.operator?s=Xi(s,t,r):i.add(t.semver);if(i.size>1)return null;if(n&&s){if(a=Hi(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&&!Ki(e,String(n),r))return null;if(s&&!Ki(e,String(s),r))return null;for(const i of t)if(!Ki(e,String(i),r))return!1;return!0}let h=!(!s||r.includePrerelease||!s.semver.prerelease.length)&&s.semver,d=!(!n||r.includePrerelease||!n.semver.prerelease.length)&&n.semver;h&&1===h.prerelease.length&&"<"===s.operator&&0===h.prerelease[0]&&(h=!1);for(const e of t){if(u=u||">"===e.operator||">="===e.operator,c=c||"<"===e.operator||"<="===e.operator,n)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(o=Gi(n,e,r),o===e&&o!==n)return!1}else if(">="===n.operator&&!Ki(n.semver,String(e),r))return!1;if(s)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(l=Xi(s,e,r),l===e&&l!==s)return!1}else if("<="===s.operator&&!Ki(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)&&(!d&&!h))},Gi=(e,t,r)=>{if(!e)return t;const i=Hi(e.semver,t.semver,r);return i>0?e:i<0||">"===t.operator&&">="===e.operator?t:e},Xi=(e,t,r)=>{if(!e)return t;const i=Hi(e.semver,t.semver,r);return i<0?e:i>0||"<"===t.operator&&"<="===e.operator?t:e};var Ji=(e,t,r={})=>{if(e===t)return!0;e=new Bi(e,r),t=new Bi(t,r);let i=!1;e:for(const n of e.set){for(const e of t.set){const t=Wi(n,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0};const Yi=Tt,Zi=It,Qi=qt,en=Ft,tn=(e,t,r)=>{const i=[];let n=null,s=null;const a=e.sort(((e,t)=>Li(e,t,r)));for(const e of a){Fi(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:Gt,valid:Jt,clean:Zt,inc:er,diff:rr,major:nr,minor:ar,patch:lr,prerelease:ur,compare:dr,rcompare:pr,compareLoose:gr,compareBuild:yr,sort:br,rsort:wr,gt:kr,lt:xr,eq:Dr,neq:Ir,gte:Tr,lte:Cr,cmp:Vr,coerce:ri,Comparator:si(),Range:ni(),satisfies:oi,toComparators:ci,maxSatisfying:di,minSatisfying:vi,minVersion:mi,validRange:Ei,outside:Pi,gtr:Mi,ltr:Ni,intersects:$i,simplifyRange:tn,subset:Ji,SemVer:Qi,re:Yi.re,src:Yi.src,tokens:Yi.t,SEMVER_SPEC_VERSION:Zi.SEMVER_SPEC_VERSION,RELEASE_TYPES:Zi.RELEASE_TYPES,compareIdentifiers:en.compareIdentifiers,rcompareIdentifiers:en.rcompareIdentifiers};Object.defineProperty(Dt,"__esModule",{value:!0});const nn=rn,sn=o,an=/^\d+(\.\d+)?(\.\d+)?/;function on(e){if(sn.TypeValidators.String.is(e)&&!e.startsWith("v")){const t=(0,nn.parse)(e);if(t)return t;const r=an.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,nn.parse)(t)}}return null}function ln(e){return(t,r)=>{const i=on(t),n=on(r);return!!(i&&n&&e(i,n))}}function cn(e,t,r){return(i,n)=>!(!t.is(i)||!t.is(n))&&(r?e(r(i),r(n)):e(i,n))}function un(e){return"number"==typeof e?e:Date.parse(e)}const hn={in:(e,t)=>e===t,endsWith:cn(((e,t)=>e.endsWith(t)),sn.TypeValidators.String),startsWith:cn(((e,t)=>e.startsWith(t)),sn.TypeValidators.String),matches:cn(((e,t)=>function(e,t){try{return new RegExp(e).test(t)}catch(e){return!1}}(t,e)),sn.TypeValidators.String),contains:cn(((e,t)=>e.indexOf(t)>-1),sn.TypeValidators.String),lessThan:cn(((e,t)=>e<t),sn.TypeValidators.Number),lessThanOrEqual:cn(((e,t)=>e<=t),sn.TypeValidators.Number),greaterThan:cn(((e,t)=>e>t),sn.TypeValidators.Number),greaterThanOrEqual:cn(((e,t)=>e>=t),sn.TypeValidators.Number),before:cn(((e,t)=>e<t),sn.TypeValidators.Date,un),after:cn(((e,t)=>e>t),sn.TypeValidators.Date,un),semVerEqual:ln(((e,t)=>0===e.compare(t))),semVerLessThan:ln(((e,t)=>e.compare(t)<0)),semVerGreaterThan:ln(((e,t)=>e.compare(t)>0))};Dt.default=class{static is(e){return Object.prototype.hasOwnProperty.call(hn,e)}static execute(e,t,r){var i,n;return null!==(n=null===(i=hn[e])||void 0===i?void 0:i.call(hn,t,r))&&void 0!==n&&n}},Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.maybeNegate=void 0;const dn=Dt;function fn(e,t){return e.negate?!t:t}function pn(e,t,r){return r.some((r=>dn.default.execute(e,t,r)))}Rt.maybeNegate=fn,Rt.default=function(e,t){const r=t.valueForKind(e.attributeReference,e.contextKind);return null!=r&&(Array.isArray(r)?fn(e,r.some((t=>pn(e.op,t,e.values)))):fn(e,pn(e.op,r,e.values)))};var vn={};function gn(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(gn(t,e.includedContexts,e.included,e.generated_includedSet))return!0;const r=gn(t,e.excludedContexts,e.excluded,e.generated_excludedSet);return r?!r:void 0},Object.defineProperty(dt,"__esModule",{value:!0});const _n=o,yn=ft,mn=st,bn=ot,En=pt,wn=xt,Sn=Rt,kn=vn,On=lt,xn=vt,{ErrorKinds:Rn}=_n.internal,Dn={HEALTHY:1,STALE:2,STORE_ERROR:3,NOT_CONFIGURED:4};function An(e){return void 0!==e&&Dn[e]||0}function In(e,t){return void 0!==e&&An(e)>An(t)?e:t}function Pn(e){return{error:!1,isMatch:e,result:void 0}}function Tn(e){return{error:!0,isMatch:!1,result:e}}dt.default=class{constructor(e,t){this._queries=t,this._bucketer=new yn.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,En.default)(e,t);s?n(s):this._evaluateRules(e,t,r,(r=>{n(r||this._variationForContext(e.fallthrough,t,e,On.default.Fallthrough))}))}),s,a):n((0,xn.getOffVariation)(e,On.default.Off))}_checkPrerequisites(e,t,r,i,n,s,a){let o;e.prerequisites&&e.prerequisites.length?(0,mn.allSeriesAsync)(e.prerequisites,((n,l,c)=>{if(-1!==i.indexOf(n.key))return o=bn.default.forError(Rn.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,xn.getOffVariation)(e,On.default.prerequisiteFailed(n.key)),void c(!1);this._evaluateInternal(i,t,r,u,(l=>{var u,h;return null!==(u=r.events)&&void 0!==u||(r.events=[]),s&&(null!==(h=r.prerequisites)&&void 0!==h||(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,xn.getOffVariation)(e,On.default.prerequisiteFailed(n.key)),c(!1)):c(!0)}),!1,a)}))}),(()=>{n(o)})):n(void 0)}_evaluateRules(e,t,r,i){let n;(0,mn.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(Pn((0,Sn.default)(e,t))):n(Tn(bn.default.forError(Rn.MalformedFlag,"Invalid attribute reference in clause"))):(0,mn.firstSeriesAsync)(e.values,((e,n,a)=>{this._queries.getSegment(e,(e=>{if(e){if(r.includes(e.key))return s=bn.default.forError(Rn.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?Tn(s):Pn((0,Sn.maybeNegate)(e,t)))))}_ruleMatchContext(e,t,r,i,n,s,a){if(!t.clauses)return void a(void 0);let o;(0,mn.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,On.default.ruleMatch(t.id,r)):void 0))))}_variationForContext(e,t,r,i){if(void 0===e)return bn.default.forError(Rn.MalformedFlag,"Fallthrough variation undefined");if(void 0!==e.variation)return(0,xn.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,xn.getBucketBy)(a,n.bucketByAttributeReference);if(!e.isValid)return bn.default.forError(Rn.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,xn.getVariation)(r,t.variation,c)}const h=s[s.length-1];return a&&!h.untracked&&(c.inExperiment=!0),(0,xn.getVariation)(r,h.variation,c)}}return bn.default.forError(Rn.MalformedFlag,"Variation/rollout object with no variation or rollout")}segmentRuleMatchContext(e,t,r,i,n,s){let a;(0,mn.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(Tn(a));if(i){if(void 0===t.weight)return s(Pn(i));const n=(0,xn.getBucketBy)(!1,t.bucketByAttributeReference);if(!n.isValid)return s(Tn(bn.default.forError(Rn.MalformedFlag,"Invalid attribute reference in clause")));const[a]=this._bucketer.bucket(r,e.key,n,e.salt||"",t.rolloutContextKind);return s(Pn(a<t.weight/1e5))}return s(Pn(!1))}))}simpleSegmentMatchContext(e,t,r,i,n){if(!e.unbounded){const r=(0,kn.default)(e,t);if(void 0!==r)return void n(Pn(r))}let s;(0,mn.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?Tn(s):Pn(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=In(r.bigSegmentsStatus,t)}else r.bigSegmentsStatus=In(r.bigSegmentsStatus,"NOT_CONFIGURED");this.bigSegmentMatchContext(r.bigSegmentsMembership[a],e,t,r).then(n)}))):(r.bigSegmentsStatus=In(r.bigSegmentsStatus,"NOT_CONFIGURED"),void n(Pn(!1)));n(Pn(!1))}bigSegmentMatchContext(e,t,r,i){const n=(0,wn.default)(t),s=null==e?void 0:e[n];return new Promise((e=>{null==s?this.simpleSegmentMatchContext(t,r,i,[],e):e(Pn(s))}))}};var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});const Cn=Y;Mn.default=class{constructor(e){this._contextKeysCache=new Cn.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 Nn={},jn={};Object.defineProperty(jn,"__esModule",{value:!0}),jn.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(Nn,"__esModule",{value:!0});const $n=o,Fn=jn;class Ln extends $n.internal.EventFactoryBase{evalEventServer(e,t,r,i,n){var s;const a=(0,Fn.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})}}Nn.default=Ln;var Bn={};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.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 Vn={};Object.defineProperty(Vn,"__esModule",{value:!0});const zn="unknown hook";Vn.default=class{constructor(e,t){this._logger=e,this._hooks=[],this._hooks.push(...t)}async withEvaluationSeries(e,t,r,i,n){return 0===this._hooks.length?n():this.withEvaluationSeriesExtraDetail(e,t,r,i,(async()=>({detail:await n()}))).then((({detail:e})=>e))}async withEvaluationSeriesExtraDetail(e,t,r,i,n){if(0===this._hooks.length)return n();const{hooks:s,hookContext:a}=this._prepareHooks(e,t,r,i),o=this._executeBeforeEvaluation(s,a),l=await n();return this._executeAfterEvaluation(s,a,o,l.detail),l}_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:zn}catch(e){return null===(r=this._logger)||void 0===r||r.error("Exception thrown getting metadata for hook. Unable to get hook name."),zn}}_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){return{hooks:[...this._hooks],hookContext:{flagKey:e,context:t,defaultValue:r,method:i}}}addHook(e){this._hooks.push(e)}};var Kn={};Object.defineProperty(Kn,"__esModule",{value:!0});const Hn=o;function Un(e){const t=e.old,r=e.new;return!(void 0!==t&&!Hn.TypeValidators.Boolean.is(t))&&!(void 0!==r&&!Hn.TypeValidators.Boolean.is(r))}function qn(e){if(Hn.TypeValidators.String.is(e.key)&&""!==e.key){if("latency_ms"===e.key){if(!Hn.TypeValidators.Object.is(e.values))return;if(!function(e){const t=e.old,r=e.new;return!(void 0!==t&&!Hn.TypeValidators.Number.is(t)||void 0!==r&&!Hn.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(!Hn.TypeValidators.Object.is(e.values))return;if(!Un(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(!Hn.TypeValidators.Boolean.is(e.value)||!Hn.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(!Hn.TypeValidators.Object.is(e.values))return;if(!Un(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}}}Kn.default=function(e){var t,r;if("migration_op"!==e.kind)return;if(r=e.operation,!Hn.TypeValidators.String.is(r)||"read"!==r&&"write"!==r)return;if(!Hn.TypeValidators.Object.is(e.contextKeys))return;if(!Hn.TypeValidators.Number.is(e.creationDate))return;if(!Object.keys(e.contextKeys).every((e=>Hn.TypeValidators.Kind.is(e))))return;const i=null!==(t=e.samplingRatio)&&void 0!==t?t:1;if(!Hn.TypeValidators.Number.is(i))return;if(!Object.values(e.contextKeys).every((e=>Hn.TypeValidators.String.is(e)&&""!==e)))return;const n=function(e){if(!Hn.TypeValidators.String.is(e.key)||""===e.key)return;if(!Hn.TypeValidators.Object.is(e.reason))return;if(!Hn.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 Hn.TypeValidators.String.is(r.errorKind)&&(i.errorKind=r.errorKind),Hn.TypeValidators.String.is(r.ruleId)&&(i.ruleId=r.ruleId),Hn.TypeValidators.String.is(r.prerequisiteKey)&&(i.prerequisiteKey=r.prerequisiteKey),Hn.TypeValidators.Boolean.is(r.inExperiment)&&(i.inExperiment=r.inExperiment),Hn.TypeValidators.Number.is(r.ruleIndex)&&(i.ruleIndex=r.ruleIndex),Hn.TypeValidators.String.is(r.bigSegmentsStatus)&&(i.bigSegmentsStatus=r.bigSegmentsStatus),void 0!==e.variation&&Hn.TypeValidators.Number.is(e.variation)&&(t.variation=e.variation),void 0!==e.version&&Hn.TypeValidators.Number.is(e.version)&&(t.version=e.version),t}(e.evaluation);var s;return n?{kind:e.kind,operation:e.operation,creationDate:e.creationDate,contextKeys:Object.assign({},e.contextKeys),measurements:(s=e.measurements,s.map(qn).filter((e=>void 0!==e))),evaluation:n,samplingRatio:i}:void 0};var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});const Gn=o,Xn=c;function Jn(e){return!Number.isNaN(e)}Wn.default=class{constructor(e,t,r,i,n,s,a,o,l,c){this._flagKey=e,this._contextKeys=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=Xn.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(Gn.internal.shouldSample(null!==(t=this._checkRatio)&&void 0!==t?t:1))try{const t=e();this._consistencyCheck=t?Xn.LDConsistencyCheck.Consistent:Xn.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(!Gn.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(0===Object.keys(this._contextKeys).length)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(),contextKeys:this._contextKeys,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===Xn.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!==Xn.LDConsistencyCheck.NotChecked&&e.push({key:"consistent",value:this._consistencyCheck===Xn.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=Jn(this._latencyMeasurement.new),r=Jn(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 Yn=o,Zn=l,Qn=J,es=te,ts=pe,rs=we,is=Je,ns=Ze,ss=et,as=st,os=ot,ls=dt,cs=Mn,us=Nn,hs=jn,ds=Bn,fs=Vn,ps=Kn,vs=Wn,gs=tt,_s=ie,{ClientMessages:ys,ErrorKinds:ms,NullEventProcessor:bs}=Yn.internal;var Es;!function(e){e[e.Initializing=0]="Initializing",e[e.Initialized=1]="Initialized",e[e.Failed=2]="Failed"}(Es||(Es={}));a.default=class{get logger(){return this._logger}constructor(e,t,r,i,n){var s,a,o,l,c;this._sdkKey=e,this._platform=t,this._initState=Es.Initializing,this._eventFactoryDefault=new us.default(!1),this._eventFactoryWithReasons=new us.default(!0),this._onError=i.onError,this._onFailed=i.onFailed,this._onReady=i.onReady;const{onUpdate:u,hasEventListeners:h}=i,d=new gs.default(r,n);if(this._hookRunner=new fs.default(d.logger,d.hooks||[]),!e&&!d.offline)throw new Error("You must configure the client with an SDK key");this._config=d,this._logger=d.logger;const f=(0,Yn.defaultHeaders)(e,t.info,d.tags),p=new Yn.ClientContext(e,d,t),v=d.featureStoreFactory(p),g=new ts.default(v,h,u);!d.sendEvents||d.offline||d.diagnosticOptOut||(this._diagnosticsManager=new Yn.internal.DiagnosticsManager(e,t,(0,ss.default)(d,t,v))),!d.sendEvents||d.offline?this._eventProcessor=new bs:this._eventProcessor=new Yn.internal.EventProcessor(d,p,f,new cs.default(d),this._diagnosticsManager),this._featureStore=v;const _=new Qn.default(null===(a=null===(s=d.bigSegments)||void 0===s?void 0:s.store)||void 0===a?void 0:a.call(s,p),null!==(o=d.bigSegments)&&void 0!==o?o:{},d.logger,this._platform.crypto);this._bigSegmentsManager=_,this.bigSegmentStatusProviderInternal=_.statusProvider;const y={getFlag(e,t){v.get(_s.default.Features,e,(e=>t(e)))},getSegment(e,t){v.get(_s.default.Segments,e,(e=>t(e)))},getBigSegmentsMembership:e=>_.getUserMembership(e)};this._evaluator=new ls.default(this._platform,y);const m=(0,es.createStreamListeners)(g,this._logger,{put:()=>this._initSuccess()}),b=()=>d.stream?new ns.default(p,"/all",[],m,f,this._diagnosticsManager,(e=>this._dataSourceErrorHandler(e)),this._config.streamInitialReconnectDelay):new rs.default(d,new is.default(d,this._platform.requests,f),g,(()=>this._initSuccess()),(e=>this._dataSourceErrorHandler(e)));d.offline||d.useLdd||(this._updateProcessor=null!==(c=null===(l=d.updateProcessorFactory)||void 0===l?void 0:l.call(d,p,g,(()=>this._initSuccess()),(e=>this._dataSourceErrorHandler(e))))&&void 0!==c?c:b()),this._updateProcessor&&this._updateProcessor.start()}initialized(){return this._initState===Es.Initialized}waitForInitialization(e){var t,r;return void 0===(null==e?void 0:e.timeout)&&void 0!==this._updateProcessor&&(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&&(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===Es.Initialized?(this._initializedPromise=Promise.resolve(this),this._initializedPromise):this._initState===Es.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){return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.variation",(()=>new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryDefault,(e=>{i(e.detail)}))})))).then((e=>(null==i||i(null,e.value),e.value)))}variationDetail(e,t,r,i){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)}))}))))}_typedEval(e,t,r,i,n,s){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)}))))}async boolVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.boolVariation",(e=>[Yn.TypeValidators.Boolean.is(e),Yn.TypeValidators.Boolean.getType()]))).value}async numberVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.numberVariation",(e=>[Yn.TypeValidators.Number.is(e),Yn.TypeValidators.Number.getType()]))).value}async stringVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.stringVariation",(e=>[Yn.TypeValidators.String.is(e),Yn.TypeValidators.String.getType()]))).value}jsonVariation(e,t,r){return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.jsonVariation",(()=>new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryDefault,(e=>{i(e.detail)}))})))).then((e=>e.value))}boolVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.boolVariationDetail",(e=>[Yn.TypeValidators.Boolean.is(e),Yn.TypeValidators.Boolean.getType()]))}numberVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.numberVariationDetail",(e=>[Yn.TypeValidators.Number.is(e),Yn.TypeValidators.Number.getType()]))}stringVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.stringVariationDetail",(e=>[Yn.TypeValidators.String.is(e),Yn.TypeValidators.String.getType()]))}jsonVariationDetail(e,t,r){return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.jsonVariationDetail",(()=>new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,(e=>{i(e.detail)}))}))))}async _migrationVariationInternal(e,t,r){var i;const n=Yn.Context.fromLDContext(t),s=await new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,(({detail:t},n)=>{if((0,Zn.IsMigrationStage)(t.value))i({detail:t,flag:n});else{const t=new Error(`Unrecognized MigrationState for "${e}"; returning default value.`);this._onError(t);const s={kind:"ERROR",errorKind:ms.WrongType};i({detail:{value:r,reason:s},flag:n})}}))})),{detail:a,flag:o}=s,l=n.valid?n.kindsAndKeys:{},c=null===(i=null==o?void 0:o.migration)||void 0===i?void 0:i.checkRatio,u=null==o?void 0:o.samplingRatio;return{detail:a,migration:{value:a.value,tracker:new vs.default(e,l,r,a.value,a.reason,c,null===a.variationIndex?void 0:a.variationIndex,null==o?void 0:o.version,u,this._logger)}}}async migrationVariation(e,t,r){return(await this._hookRunner.withEvaluationSeriesExtraDetail(e,t,r,"LDClient.migrationVariation",(()=>this._migrationVariationInternal(e,t,r)))).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 ds.default(!1,!1).build();return null==r||r(null,e),Promise.resolve(e)}const a=Yn.Context.fromLDContext(e);return a.valid?new Promise((e=>{const i=i=>this._featureStore.all(_s.default.Features,(n=>{const s=new ds.default(i,!!(null==t?void 0:t.withReasons)),o=!!(null==t?void 0:t.clientSideOnly),l=!!(null==t?void 0:t.detailsOnlyForTrackedFlags);(0,as.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,hs.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 ds.default(!1,!1).build()))}secureModeHash(e){const t=Yn.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 Yn.LDClientError("Could not generate secure mode hash for invalid context");return i.update(r),i.digest("hex")}close(){var e;this._eventProcessor.close(),null===(e=this._updateProcessor)||void 0===e||e.close(),this._featureStore.close(),this._bigSegmentsManager.close()}isOffline(){return this._config.offline}track(e,t,r,i){var n,s;const a=Yn.Context.fromLDContext(t);a.valid?(void 0===i||Yn.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,ps.default)(e);t&&this._eventProcessor.sendEvent(t)}identify(e){var t;const r=Yn.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(os.default.forError(ms.ClientNotReady,void 0,r));const l=Yn.Context.fromLDContext(t);if(!l.valid)return this._onError(new Yn.LDClientError(`${null!==(o=l.message)&&void 0!==o?o:"Context not valid;"} returning default value.`)),void n(os.default.forError(ms.UserNotSpecified,void 0,r));this._featureStore.get(_s.default.Features,e,(t=>{const a=t;if(!a){const t=new Yn.LDClientError(`Unknown feature flag "${e}"; returning default value`);this._onError(t);const i=os.default.forError(ms.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=os.default.forError(ms.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(os.default.forError(ms.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=Es.Failed,this._rejectionReason=r,null===(t=this._initReject)||void 0===t||t.call(this,r))}_initSuccess(){var e;this.initialized()||(this._initState=Es.Initialized,null===(e=this._initResolve)||void 0===e||e.call(this,this),this._onReady())}_clientWithTimeout(e,t,r){if(t){const i=(0,Yn.cancelableTimedPromise)(t,"waitForInitialization");return Promise.race([e.then((()=>this)),i.promise.then((()=>this))]).catch((e=>{throw e instanceof Yn.LDTimeoutError&&(null==r||r.error(e.message)),e})).finally((()=>i.cancel()))}return e}};var ws={};Object.defineProperty(ws,"__esModule",{value:!0}),ws.createMigration=ws.LDMigrationError=ws.LDMigrationSuccess=void 0;const Ss=l,ks=R;ws.LDMigrationSuccess=function(e){return{success:!0,result:e}},ws.LDMigrationError=function(e){return{success:!1,error:e}};class Os{constructor(e,t){var r,i;this._client=e,this._config=t,this._readTable={[Ss.LDMigrationStage.Off]:async e=>this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),[Ss.LDMigrationStage.DualWrite]:async e=>this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),[Ss.LDMigrationStage.Shadow]:async e=>{const{fromOld:t,fromNew:r}=await this._doRead(e);return this._trackConsistency(e,t,r),t},[Ss.LDMigrationStage.Live]:async e=>{const{fromNew:t,fromOld:r}=await this._doRead(e);return this._trackConsistency(e,r,t),t},[Ss.LDMigrationStage.RampDown]:async e=>this._doSingleOp(e,"new",this._config.readNew.bind(this._config)),[Ss.LDMigrationStage.Complete]:async e=>this._doSingleOp(e,"new",this._config.readNew.bind(this._config))},this._writeTable={[Ss.LDMigrationStage.Off]:async e=>({authoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}),[Ss.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))}},[Ss.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))}},[Ss.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))}},[Ss.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))}},[Ss.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 ks.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)===ks.LDExecution.Serial){return this._execution.ordering===ks.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}}ws.createMigration=function(e,t){return new Os(e,t)};var xs={},Rs={},Ds={},As={};Object.defineProperty(As,"__esModule",{value:!0});As.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(Ds,"__esModule",{value:!0});const Is=re,Ps=ie,Ts=As;Ds.default=class{constructor(e,t,r,i=()=>{},n){var s;this._featureStore=r,this._initSuccessHandler=i,this._errorHandler=n,this._allData={},this._fileLoader=new Ts.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,Is.processFlag)(e.flags[t]),this._addItem(Ps.default.Features,e.flags[t])})),Object.keys(e.flagValues||{}).forEach((r=>{var i,n;const s=null===(i=t[Ps.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,Is.processFlag)(o),this._addItem(Ps.default.Features,o)})),Object.keys(e.segments||{}).forEach((t=>{(0,Is.processSegment)(e.segments[t]),this._addItem(Ps.default.Segments,e.segments[t])}))}},Object.defineProperty(Rs,"__esModule",{value:!0});const Ms=Ds;Rs.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 Ms.default(n,e.platform.fileSystem,t,r,i)}getFactory(){return(e,t,r,i)=>this.create(e,t,r,i)}};var Cs={},Ns={},js={},$s={};!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}}($s);var Fs={};Object.defineProperty(Fs,"__esModule",{value:!0});const Ls=o,Bs=$s;class Vs{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 Ls.AttributeReference(t),op:"in",values:r,negate:!1}),this}andNotMatch(e,t,...r){return this._clauses.push({contextKind:e,attribute:t,attributeReference:new Ls.AttributeReference(t),op:"in",values:r,negate:!0}),this}thenReturn(e){return Ls.TypeValidators.Boolean.is(e)?(this._flagBuilder.booleanFlag(),this.thenReturn((0,Bs.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 Vs(this._flagBuilder,this._clauses,this._variation)}}Fs.default=Vs,Object.defineProperty(js,"__esModule",{value:!0});const zs=o,Ks=$s,Hs=Fs;class Us{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[Ks.TRUE_VARIATION_INDEX]&&!1===this._data.variations[Ks.FALSE_VARIATION_INDEX]}booleanFlag(){return this._isBooleanFlag?this:this.variations(!0,!1).fallthroughVariation(Ks.TRUE_VARIATION_INDEX).offVariation(Ks.FALSE_VARIATION_INDEX)}variations(...e){return this._data.variations=[...e],this}on(e){return this._data.on=e,this}fallthroughVariation(e){return zs.TypeValidators.Boolean.is(e)?this.booleanFlag().fallthroughVariation((0,Ks.variationForBoolean)(e)):(this._data.fallthroughVariation=e,this)}offVariation(e){return zs.TypeValidators.Boolean.is(e)?this.booleanFlag().offVariation((0,Ks.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 zs.TypeValidators.Boolean.is(r)?this.booleanFlag().variationForContext(e,t,(0,Ks.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 Hs.default(this).andMatch(e,t,...r)}ifNotMatch(e,t,...r){return new Hs.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 Us(this._key,this._data)}getKey(){return this._key}}js.default=Us;var qs={};Object.defineProperty(qs,"__esModule",{value:!0});qs.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(Ns,"__esModule",{value:!0});const Ws=te,Gs=ke,Xs=re,Js=ie,Ys=js,Zs=qs;Ns.default=class{constructor(){this._currentFlags={},this._currentSegments={},this._dataSources=[],this._flagBuilders={}}getFactory(){return(e,t,r,i)=>{const n=(0,Ws.createStreamListeners)(t,e.basicConfiguration.logger,{put:r}),s=new Zs.default(new Gs.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 Ys.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(Js.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,Xs.processFlag)(i),this._currentFlags[t.key]=i,Promise.all(this._dataSources.map((e=>e.upsert(Js.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,Xs.processSegment)(i),this._currentSegments[t.key]=i,Promise.all(this._dataSources.map((e=>e.upsert(Js.default.Segments,i))))}},Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.TestDataRuleBuilder=Cs.TestDataFlagBuilder=Cs.TestData=void 0;const Qs=Ns;Cs.TestData=Qs.default;const ea=js;Cs.TestDataFlagBuilder=ea.default;const ta=Fs;Cs.TestDataRuleBuilder=ta.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=Rs;e.FileDataSourceFactory=n.default,i(Cs,e),i(M,e)}(xs);var ra={},ia={};Object.defineProperty(ia,"__esModule",{value:!0});ia.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(ra,"__esModule",{value:!0}),ra.NullEventSource=void 0;const na=ia;ra.NullEventSource=na.default;var sa={};Object.defineProperty(sa,"__esModule",{value:!0}),sa.TtlCache=void 0;const aa=De;sa.TtlCache=aa.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=ws;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=xs,e.platform=o,i(l,e),i(Se,e),i(ra,e),i(o,e),e.internalServer=sa}(n);var oa={},la={},ca={};Object.defineProperty(ca,"__esModule",{value:!0}),ca.createCallbacks=void 0;ca.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 ha={},da=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(ha,"__esModule",{value:!0}),ha.validateOptions=void 0;ha.validateOptions=(e,t)=>{const{featureStore:r,logger:i,sendEvents:n}=t,s=da(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(ca,e),i(ua,e),i(ha,e)}(la),Object.defineProperty(oa,"__esModule",{value:!0});const fa=n,pa=la;oa.default=class extends fa.LDClientImpl{constructor(e,t,r){const i=(0,pa.createOptions)(r);super(e,t,i,(0,pa.createCallbacks)(i.logger))}initialized(){return!0}waitForInitialization(){return Promise.resolve(this)}};var va={},ga={};Object.defineProperty(ga,"__esModule",{value:!0});ga.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=ga;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}}}(va);var _a={},ya={},ma=r(e),ba={},Ea={exports:{}};var wa,Sa={exports:{}};function ka(){return wa||(wa=1,Sa.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||h).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={},h=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)}},d=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(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.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 h=0;h<l;h+=a)this._doProcessBlock(n,h);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}()),Sa.exports}var Oa,xa={exports:{}};function Ra(){return Oa?xa.exports:(Oa=1,xa.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}(ka()))}var Da,Aa={exports:{}};function Ia(){return Da||(Da=1,Aa.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}(ka())),Aa.exports}var Pa,Ta={exports:{}};function Ma(){return Pa?Ta.exports:(Pa=1,Ta.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}(ka()))}var Ca,Na={exports:{}},ja=Na.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}(ka()),$a={exports:{}};function Fa(){return Ca?$a.exports:(Ca=1,$a.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}(ka()))}var La,Ba={exports:{}};function Va(){return La||(La=1,Ba.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],E=e[t+10],w=e[t+11],S=e[t+12],k=e[t+13],O=e[t+14],x=e[t+15],R=s[0],D=s[1],A=s[2],I=s[3];R=c(R,D,A,I,a,7,o[0]),I=c(I,R,D,A,l,12,o[1]),A=c(A,I,R,D,f,17,o[2]),D=c(D,A,I,R,p,22,o[3]),R=c(R,D,A,I,v,7,o[4]),I=c(I,R,D,A,g,12,o[5]),A=c(A,I,R,D,_,17,o[6]),D=c(D,A,I,R,y,22,o[7]),R=c(R,D,A,I,m,7,o[8]),I=c(I,R,D,A,b,12,o[9]),A=c(A,I,R,D,E,17,o[10]),D=c(D,A,I,R,w,22,o[11]),R=c(R,D,A,I,S,7,o[12]),I=c(I,R,D,A,k,12,o[13]),A=c(A,I,R,D,O,17,o[14]),R=u(R,D=c(D,A,I,R,x,22,o[15]),A,I,l,5,o[16]),I=u(I,R,D,A,_,9,o[17]),A=u(A,I,R,D,w,14,o[18]),D=u(D,A,I,R,a,20,o[19]),R=u(R,D,A,I,g,5,o[20]),I=u(I,R,D,A,E,9,o[21]),A=u(A,I,R,D,x,14,o[22]),D=u(D,A,I,R,v,20,o[23]),R=u(R,D,A,I,b,5,o[24]),I=u(I,R,D,A,O,9,o[25]),A=u(A,I,R,D,p,14,o[26]),D=u(D,A,I,R,m,20,o[27]),R=u(R,D,A,I,k,5,o[28]),I=u(I,R,D,A,f,9,o[29]),A=u(A,I,R,D,y,14,o[30]),R=h(R,D=u(D,A,I,R,S,20,o[31]),A,I,g,4,o[32]),I=h(I,R,D,A,m,11,o[33]),A=h(A,I,R,D,w,16,o[34]),D=h(D,A,I,R,O,23,o[35]),R=h(R,D,A,I,l,4,o[36]),I=h(I,R,D,A,v,11,o[37]),A=h(A,I,R,D,y,16,o[38]),D=h(D,A,I,R,E,23,o[39]),R=h(R,D,A,I,k,4,o[40]),I=h(I,R,D,A,a,11,o[41]),A=h(A,I,R,D,p,16,o[42]),D=h(D,A,I,R,_,23,o[43]),R=h(R,D,A,I,b,4,o[44]),I=h(I,R,D,A,S,11,o[45]),A=h(A,I,R,D,x,16,o[46]),R=d(R,D=h(D,A,I,R,f,23,o[47]),A,I,a,6,o[48]),I=d(I,R,D,A,y,10,o[49]),A=d(A,I,R,D,O,15,o[50]),D=d(D,A,I,R,g,21,o[51]),R=d(R,D,A,I,S,6,o[52]),I=d(I,R,D,A,p,10,o[53]),A=d(A,I,R,D,E,15,o[54]),D=d(D,A,I,R,l,21,o[55]),R=d(R,D,A,I,m,6,o[56]),I=d(I,R,D,A,x,10,o[57]),A=d(A,I,R,D,_,15,o[58]),D=d(D,A,I,R,k,21,o[59]),R=d(R,D,A,I,v,6,o[60]),I=d(I,R,D,A,w,10,o[61]),A=d(A,I,R,D,f,15,o[62]),D=d(D,A,I,R,b,21,o[63]),s[0]=s[0]+R|0,s[1]=s[1]+D|0,s[2]=s[2]+A|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 h(e,t,r,i,n,s,a){var o=e+(t^r^i)+n+a;return(o<<s|o>>>32-s)+t}function d(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}(ka())),Ba.exports}var za,Ka={exports:{}};function Ha(){return za||(za=1,Ka.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 h=(i<<5|i>>>27)+l+a[c];h+=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=h}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}(ka())),Ka.exports}var Ua,qa={exports:{}};function Wa(){return Ua||(Ua=1,qa.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],h=r[6],d=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=d+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&u^~o&h)+l[f]+c[f];d=h,h=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]+h|0,r[7]=r[7]+d|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}(ka())),qa.exports}var Ga,Xa={exports:{}};var Ja,Ya={exports:{}};function Za(){return Ja||(Ja=1,Ya.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],h=r[6],d=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,E=o.high,w=o.low,S=u.high,k=u.low,O=h.high,x=h.low,R=d.high,D=d.low,A=f,I=p,P=v,T=g,M=_,C=y,N=m,j=b,$=E,F=w,L=S,B=k,V=O,z=x,K=R,H=D,U=0;U<80;U++){var q,W,G=c[U];if(U<16)W=G.high=0|e[t+2*U],q=G.low=0|e[t+2*U+1];else{var X=c[U-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[U-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[U-7],ae=se.high,oe=se.low,le=c[U-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 he,de=$&L^~$&V,fe=F&B^~F&z,pe=A&P^A&M^P&M,ve=I&T^I&C^T&C,ge=(A>>>28|I<<4)^(A<<30|I>>>2)^(A<<25|I>>>7),_e=(I>>>28|A<<4)^(I<<30|A>>>2)^(I<<25|A>>>7),ye=($>>>14|F<<18)^($>>>18|F<<14)^($<<23|F>>>9),me=(F>>>14|$<<18)^(F>>>18|$<<14)^(F<<23|$>>>9),be=l[U],Ee=be.high,we=be.low,Se=K+ye+((he=H+me)>>>0<H>>>0?1:0),ke=_e+ve;K=V,H=z,V=L,z=B,L=$,B=F,$=N+(Se=(Se=(Se=Se+de+((he+=fe)>>>0<fe>>>0?1:0))+Ee+((he+=we)>>>0<we>>>0?1:0))+W+((he+=q)>>>0<q>>>0?1:0))+((F=j+he|0)>>>0<j>>>0?1:0)|0,N=M,j=C,M=P,C=T,P=A,T=I,A=Se+(ge+pe+(ke>>>0<_e>>>0?1:0))+((I=he+ke|0)>>>0<he>>>0?1:0)|0}p=i.low=p+I,i.high=f+A+(p>>>0<I>>>0?1:0),g=n.low=g+T,n.high=v+P+(g>>>0<T>>>0?1:0),y=s.low=y+C,s.high=_+M+(y>>>0<C>>>0?1:0),b=a.low=b+j,a.high=m+N+(b>>>0<j>>>0?1:0),w=o.low=w+F,o.high=E+$+(w>>>0<F>>>0?1:0),k=u.low=k+B,u.high=S+L+(k>>>0<B>>>0?1:0),x=h.low=x+z,h.high=O+V+(x>>>0<z>>>0?1:0),D=d.low=D+H,d.high=R+K+(D>>>0<H>>>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}(ka(),Ra())),Ya.exports}var Qa,eo={exports:{}};var to,ro={exports:{}};function io(){return to||(to=1,ro.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,h=0,d=0;d<7;d++){if(1&n){var f=(1<<d)-1;f<32?h^=1<<f:o^=1<<f-32}128&n?n=n<<1^113:n<<=1}u[s]=a.create(o,h)}}();var h=[];!function(){for(var e=0;e<25;e++)h[e]=a.create()}();var d=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),(D=r[n]).high^=a,D.low^=s}for(var o=0;o<24;o++){for(var d=0;d<5;d++){for(var f=0,p=0,v=0;v<5;v++)f^=(D=r[d+5*v]).high,p^=D.low;var g=h[d];g.high=f,g.low=p}for(d=0;d<5;d++){var _=h[(d+4)%5],y=h[(d+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++)(D=r[d+5*v]).high^=f,D.low^=p}for(var E=1;E<25;E++){var w=(D=r[E]).high,S=D.low,k=l[E];k<32?(f=w<<k|S>>>32-k,p=S<<k|w>>>32-k):(f=S<<k-32|w>>>64-k,p=w<<k-32|S>>>64-k);var O=h[c[E]];O.high=f,O.low=p}var x=h[0],R=r[0];for(x.high=R.high,x.low=R.low,d=0;d<5;d++)for(v=0;v<5;v++){var D=r[E=d+5*v],A=h[E],I=h[(d+1)%5+5*v],P=h[(d+2)%5+5*v];D.high=A.high^~I.high&P.high,D.low=A.low^~I.low&P.low}D=r[0];var T=u[o];D.high^=T.high,D.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 h=a[u],d=h.high,f=h.low;d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),c.push(f),c.push(d)}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(d),r.HmacSHA3=s._createHmacHelper(d)}(Math),e.SHA3}(ka(),Ra())),ro.exports}var no,so={exports:{}};var ao,oo={exports:{}};function lo(){return ao?oo.exports:(ao=1,oo.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))}})}(ka()))}var co,uo={exports:{}};var ho,fo={exports:{}};function po(){return ho?fo.exports:(ho=1,fo.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}(ka(),Ha(),lo()))}var vo,go={exports:{}};function _o(){return vo||(vo=1,go.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 h=r.mode={},d=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=h.CBC=function(){var e=d.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)}})}()}(ka(),po())),go.exports}var yo,mo={exports:{}};function bo(){return yo?mo.exports:(yo=1,mo.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}(ka(),_o()))}var Eo,wo={exports:{}};function So(){return Eo?wo.exports:(Eo=1,wo.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}(ka(),_o()))}var ko,Oo={exports:{}};function xo(){return ko?Oo.exports:(ko=1,Oo.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)))}}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 h{is(e){return"number"==typeof e||"string"==typeof e&&u.test(e)}getType(){return"date"}}class d 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}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 h,f.Kind=new d,f.NullableBoolean=new c;const _="user";function y(e){return e.includes("%")||e.includes(":")?e.replace(/%/g,"%25").replace(/:/g,"%3A"):e}function m(e){return f.Kind.is(e)}function b(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(m);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=>b(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=m(r),n=b(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=_){return e.isKind?this.kinds:w._getValueFromContext(e,this._contextForKind(t))}key(e=_){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}:${y(this._contexts[e].key)}`)).join(":"):`${this.kind}:${y(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}}w.UserKind=_;const S=["key","kind","_meta","anonymous"].map((e=>new r(e,!0))),k=["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=>!S.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&&k.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}}var O,R,D,I;e.DataSourceErrorKind=void 0,(O=e.DataSourceErrorKind||(e.DataSourceErrorKind={})).Unknown="UNKNOWN",O.NetworkError="NETWORK_ERROR",O.ErrorResponse="ERROR_RESPONSE",O.InvalidData="INVALID_DATA";class A extends Error{constructor(e){super(e),this.name="LaunchDarklyFileDataSourceError"}}class P extends Error{constructor(e,t,r,i=!0){super(t),this.kind=e,this.status=r,this.name="LaunchDarklyPollingError",this.recoverable=i}}class T extends Error{constructor(e,t,r,i=!0){super(t),this.kind=e,this.code=r,this.name="LaunchDarklyStreamingError",this.recoverable=i}}e.AutoEnvAttributes=void 0,(R=e.AutoEnvAttributes||(e.AutoEnvAttributes={}))[R.Disabled=0]="Disabled",R[R.Enabled=1]="Enabled",function(e){e[e.AnalyticsEvents=0]="AnalyticsEvents",e[e.DiagnosticEvent=1]="DiagnosticEvent"}(D||(D={})),function(e){e[e.Succeeded=0]="Succeeded",e[e.Failed=1]="Failed",e[e.FailedAndMustShutDown=2]="FailedAndMustShutDown"}(I||(I={}));var M=Object.freeze({__proto__:null,get LDDeliveryStatus(){return I},get LDEventType(){return D}});function C(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 N={s:e=>C(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=>C(e),o:e=>C(e),O:e=>C(e),c:()=>""};function j(...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 N&&e.length){const t=e.shift();r+=N[n]?.(t)}else r+="%"===n?"%":`%${n}`;i+=2}}else r+=n,i+=1}return e.length&&(r.length&&(r+=" "),r+=e.map(C).join(" ")),r}return e.map(C).join(" ")}var F;!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"}(F||(F={}));const $=["debug","info","warn","error","none"];class L{static get(){return new L({})}constructor(e){if(this._logLevel=F[e.level??"info"]??F.info,this._name=e.name??"LaunchDarkly",this._formatter=e.formatter,"object"==typeof e.destination)this._destinations={[F.debug]:e.destination.debug,[F.info]:e.destination.info,[F.warn]:e.destination.warn,[F.error]:e.destination.error};else if("function"==typeof e.destination){const{destination:t}=e;this._destinations={[F.debug]:t,[F.info]:t,[F.warn]:t,[F.error]:t}}}_tryFormat(...e){try{return this._formatter?this._formatter?.(...e):j(...e)}catch{return j(...e)}}_tryWrite(e,t){try{e(t)}catch{console.error(t)}}_log(e,t){if(e>=this._logLevel){const r=`${$[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(F.error,e)}warn(...e){this._log(F.warn,e)}info(...e){this._log(F.info,e)}debug(...e){this._log(F.debug,e)}}const B={error:f.Function,warn:f.Function,info:f.Function,debug:f.Function};class V{constructor(e,t){Object.entries(B).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 z{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 H=f.stringMatchingRegex(/^(\w|\.|-)+$/),K=(e,t)=>H.is(e)?e.length>64?{valid:!1,message:z.tagValueTooLong(t)}:{valid:!0}:{valid:!1,message:z.invalidTagValue(t)};function U(e){return e.replace(/\/+$/,"")}function q(e){return e.replace(/^\/+/,"").replace(/\?$/,"")}class W{constructor(e,t,r=W.DEFAULT_EVENTS,i="/bulk",n="/diagnostic",s=!0,a){this.streaming=U(e),this.polling=U(t),this.events=U(r),this.analyticsEventPath=i,this.diagnosticEventPath=n,this.includeAuthorizationHeader=s,this.payloadFilterKey=a}}function G(e,t){if(0===t.length)return e;return`${e}?${t.map((({key:e,value:t})=>`${e}=${t}`)).join("&")}`}function X(e,t,r){const i=q(t);return G(`${e.events}/${i}`,r)}W.DEFAULT_EVENTS="https://events.launchdarkly.com";class J extends Error{constructor(e){super(e),this.name="LaunchDarklyUnexpectedResponseError"}}class Y extends Error{constructor(e){super(e),this.name="LaunchDarklyClientError"}}class Z extends Error{constructor(e){super(e),this.name="LaunchDarklyTimeoutError"}}function Q(e){return!(e>=400&&e<500)||(400===e||408===e||429===e)}function ee(e){return 413===e||Q(e)}const te=(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?te(i,t):i),e)),{}):e;function re(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 ie=async(e=1e3)=>new Promise((e=>{}));var ne;!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"}(ne||(ne={}));var se=ne;class ae{static invalidMetricValue(e){return`The track function was called with a non-numeric "metricValue" (${e}), only numeric metric values are supported.`}}ae.MissingContextKeyNoEvent="Context was unspecified or had no key; event will not be sent";class oe{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=X(r.serviceEndpoints,n,[]),this._diagnosticEventsUri=X(r.serviceEndpoints,s,[]),this._requests=o,this._crypto=a}async _tryPostingEvents(e,t,r,i){const n={status:I.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),method:"POST",keepalive:!0}),o=Date.parse(i.get("date")||"");if(o&&(n.serverTime=o),r<=204)return n;if(a=new J(re({status:r,message:"some events were dropped"},"event posting")),!Q(r))return ee(r)?n.status=I.Failed:n.status=I.FailedAndMustShutDown,n.error=a,n}catch(e){a=e}return a&&!i?(n.status=I.Failed,n.error=a,n):(await ie(),this._tryPostingEvents(e,this._eventsUri,r,!1))}async sendEventData(e,t){const r=e===D.AnalyticsEvents?this._crypto.randomUUID():void 0,i=e===D.AnalyticsEvents?this._eventsUri:this._diagnosticEventsUri;return this._tryPostingEvents(t,i,r,!0)}}function le(e){return"feature"===e.kind}class ce{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 ue{constructor(){this._startDate=0,this._endDate=0,this._counters={},this._contextKinds={}}summarizeEvent(e){if(le(e)&&!e.excludeFromSummaries){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 ce(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}),{});return{startDate:this._startDate,endDate:this._endDate,features:e,kind:"summary"}}clearSummary(){this._startDate=0,this._endDate=0,this._counters={},this._contextKinds={}}}class he extends Error{constructor(e){super(e),this.name="LaunchDarklyInvalidSDKKeyError"}}function de(e){const t=Math.trunc(e);return 1===t||0!==t&&0===Math.floor(Math.random()*t)}class fe{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 pe{constructor(e,t,r,i,n,s,a,o,l,c,u,h,d=1){this.withReasons=e,this.context=t,this.key=r,this.samplingRatio=d,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!==h&&(this.excludeFromSummaries=h)}}class ve{constructor(e,t=1){this.context=e,this.samplingRatio=t,this.kind="identify",this.creationDate=Date.now()}}var ge=Object.freeze({__proto__:null,ClientMessages:ae,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:se,EventFactoryBase:class{constructor(e){this._withReasons=e}evalEvent(e){return new pe(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 pe(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 ve(e,1)}customEvent(e,t,r,i,n=1){return new fe(t,e,r??void 0,i??void 0,n)}},EventProcessor:class{constructor(e,t,i,n,s,a=!0){this._config=e,this._contextDeduplicator=n,this._diagnosticsManager=s,this._summarizer=new ue,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 oe(t,i),this._contextFilter=new x(e.allAttributesPrivate,e.privateAttributes.map((e=>new r(e)))),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(D.DiagnosticEvent,e)}close(){clearInterval(this._flushTimer),this._flushUsersTimer&&clearInterval(this._flushUsersTimer),this._diagnosticsTimer&&clearInterval(this._diagnosticsTimer)}async flush(){if(this._shutdown)throw new he("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;this._queue=[];const t=this._summarizer.getSummary();this._summarizer.clearSummary(),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(de(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=le(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&&de(e.samplingRatio)&&this._enqueue(this._makeOutputEvent(e,!1)),i&&de(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 le(e)&&e.debugEventsUntilDate&&e.debugEventsUntilDate>this._lastKnownPastTime&&e.debugEventsUntilDate>Date.now()}async _tryPostingEvents(e){const t=await this._eventSender.sendEventData(D.AnalyticsEvents,e);if(t.status===I.FailedAndMustShutDown&&(this._shutdown=!0),t.serverTime&&(this._lastKnownPastTime=t.serverTime),t.error)throw t.error}},InputCustomEvent:fe,InputEvalEvent:pe,InputIdentifyEvent:ve,NullEventProcessor:class{close(){}async flush(){}sendEvent(){}},PayloadReader:class{constructor(e,t,r,i){this._objProcessors=t,this._errorHandler=r,this._logger=i,this._listeners=[],this._tempId=void 0,this._tempBasis=void 0,this._tempUpdates=[],this._processServerIntent=e=>{if(this._resetState(),!e.payloads.length)return;const t=e.payloads[0];switch(t?.code){case"xfer-full":this._tempBasis=!0;break;case"xfer-changes":case"none":this._tempBasis=!1;break;default:return}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 prcoess 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._processPayloadTransferred=e=>{if(!this._tempId||!e.state||!e.version||void 0===this._tempBasis)return void this._resetState();const t={id:this._tempId,version:e.version,state:e.state,basis:this._tempBasis,updates:this._tempUpdates};this._listeners.forEach((e=>e(t))),this._resetState()},this._processGoodbye=e=>{this._logger?.info(`Goodbye was received from the LaunchDarkly connection with reason: ${e.reason}.`),this._resetState()},this._processError=e=>{this._logger?.info(`An issue was encountered receiving updates for payload ${this._tempId} with reason: ${e.reason}. Automatic retry will occur.`),this._resetState()},this._attachHandler(e,"server-intent",this._processServerIntent),this._attachHandler(e,"put-object",this._processPutObject),this._attachHandler(e,"delete-object",this._processDeleteObject),this._attachHandler(e,"payload-transferred",this._processPayloadTransferred),this._attachHandler(e,"goodbye",this._processGoodbye),this._attachHandler(e,"error",this._processError)}addPayloadListener(e){this._listeners.push(e)}removePayloadListener(e){const t=this._listeners.indexOf(e,0);t>-1&&this._listeners.splice(t,1)}_attachHandler(t,r,i){t.addEventListener(r,(async t=>{if(t?.data){this._logger?.debug(`Received ${r} event. Data is ${t.data}`);try{i(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 event stream")}}else this._errorHandler?.(e.DataSourceErrorKind.Unknown,"Unexpected message from event stream")}))}_processObj(e,t){return this._objProcessors[e]?.(t)}_resetState(){this._tempId=void 0,this._tempBasis=void 0,this._tempUpdates=[]}},isLegacyUser:g,isMultiKind:v,isSingleKind:p,shouldSample:de});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}=K(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=L,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.Context=w,e.ContextFilter=x,e.DateValidator=h,e.FactoryOrInstance=i,e.Function=l,e.KindValidator=d,e.LDClientError=Y,e.LDFileDataSourceError=A,e.LDPollingError=P,e.LDStreamingError=T,e.LDTimeoutError=Z,e.LDUnexpectedResponseError=J,e.NullableBoolean=c,e.NumberWithMinimum=a,e.OptionMessages=z,e.SafeLogger=V,e.ServiceEndpoints=W,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 L({level:"info",destination:console.error,formatter:j});return e?new V(e,t):t},e.debounce=(e,t=5e3)=>{let r;return(...e)=>{clearTimeout(r),r=e=>{e()}}},e.deepCompact=te,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=X,e.getPollingUri=function(e,t,r){const i=q(t),n=[...r];return e.payloadFilterKey&&n.push({key:"filter",value:e.payloadFilterKey}),G(`${e.polling}/${i}`,n)},e.getStreamingUri=function(e,t,r){const i=q(t),n=[...r];return e.payloadFilterKey&&n.push({key:"filter",value:e.payloadFilterKey}),G(`${e.streaming}/${i}`,n)},e.httpErrorMessage=re,e.internal=ge,e.isHttpLocallyRecoverable=ee,e.isHttpRecoverable=Q,e.noop=()=>{},e.secondsToMillis=function(e){return Math.trunc(1e3*e)},e.shouldRetry=function({status:e}){return!e||Q(e)},e.sleep=ie,e.subsystem=M,e.timedPromise=(e,t)=>new Promise(((e,t)=>{}))}(o);var l={},c={},u={};Object.defineProperty(u,"__esModule",{value:!0});var h={};Object.defineProperty(h,"__esModule",{value:!0});var d,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"}(d||(f.LDMigrationStage=d={})),f.IsMigrationStage=function(e){return Object.values(d).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(h,g),y(f,g),y(p,g),y(m,g);var b={},E={};Object.defineProperty(E,"__esModule",{value:!0});var w={};Object.defineProperty(w,"__esModule",{value:!0});var S={};Object.defineProperty(S,"__esModule",{value:!0});var k={};Object.defineProperty(k,"__esModule",{value:!0});var x,O,R={};Object.defineProperty(R,"__esModule",{value:!0}),R.LDConcurrentExecution=R.LDSerialExecution=R.LDExecution=R.LDExecutionOrdering=void 0,function(e){e[e.Fixed=0]="Fixed",e[e.Random=1]="Random"}(x||(R.LDExecutionOrdering=x={})),function(e){e[e.Serial=0]="Serial",e[e.Concurrent=1]="Concurrent"}(O||(R.LDExecution=O={}));R.LDSerialExecution=class{constructor(e){this.ordering=e,this.type=O.Serial}};R.LDConcurrentExecution=class{constructor(){this.type=O.Concurrent}},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,e),i(w,e),i(S,e),i(k,e),i(R,e)}(b);var D={};Object.defineProperty(D,"__esModule",{value:!0});var I={};Object.defineProperty(I,"__esModule",{value:!0});var A={};Object.defineProperty(A,"__esModule",{value:!0});var P={};Object.defineProperty(P,"__esModule",{value:!0});var T={};Object.defineProperty(T,"__esModule",{value:!0});var M={},C={};Object.defineProperty(C,"__esModule",{value:!0});var N={};Object.defineProperty(N,"__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(C,e),i(N,e)}(M);var j={},F={};Object.defineProperty(F,"__esModule",{value:!0});var $={};Object.defineProperty($,"__esModule",{value:!0});var L={};Object.defineProperty(L,"__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 K={};Object.defineProperty(K,"__esModule",{value:!0});var U={};Object.defineProperty(U,"__esModule",{value:!0});var q={};Object.defineProperty(q,"__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(F,e),i($,e),i(L,e),i(B,e),i(V,e),i(A,e),i(z,e),i(H,e),i(K,e),i(U,e),i(q,e)}(j);var W={},G={};Object.defineProperty(G,"__esModule",{value:!0});var X={};Object.defineProperty(X,"__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(G,e),i(P,e),i(X,e)}(W),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(D,e),i(I,e),i(A,e),i(P,e),i(T,e),e.integrations=M,e.interfaces=j,e.subsystems=W}(l);var J={},Y={};Object.defineProperty(Y,"__esModule",{value:!0});Y.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(J,"__esModule",{value:!0});const Z=o,Q=s,ee=Y;J.default=class{constructor(e,t,r,i){this._store=e,this._logger=r,this._crypto=i,this.statusProvider=new Q.default((async()=>this._pollStoreAndUpdateStatus())),this._staleTimeMs=1e3*(Z.TypeValidators.Number.is(t.staleAfter)&&t.staleAfter>0?t.staleAfter:120);Z.TypeValidators.Number.is(t.statusPollInterval)&&t.statusPollInterval>0&&t.statusPollInterval;this._pollHandle=e?void 0:null,e&&(this._cache=new ee.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 te={},re={},ie={};Object.defineProperty(ie,"__esModule",{value:!0});class ne{static getKeyFromPath(e,t){return t.startsWith(e.streamApiPath)?t.substring(e.streamApiPath.length):void 0}}ne.Features={namespace:"features",streamApiPath:"/flags/"},ne.Segments={namespace:"segments",streamApiPath:"/segments/"},ie.default=ne,Object.defineProperty(re,"__esModule",{value:!0}),re.deserializeSegment=re.serializeSegment=re.deserializeFlag=re.serializeFlag=re.deserializeDelete=re.deserializePatch=re.deserializePoll=re.deserializeAll=re.processSegment=re.processFlag=re.replacer=re.nullReplacer=void 0;const se=o,ae=ie,oe=100;function le(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 ce(e,t){if(!(t instanceof se.AttributeReference||Array.isArray(t)&&t[0]&&t[0]instanceof se.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 ue(e){e&&e.bucketBy&&(e.bucketByAttributeReference=new se.AttributeReference(e.bucketBy,!e.contextKind))}function he(e){var t;if(le(e,["variations"]),e.fallthrough&&e.fallthrough.rollout){ue(e.fallthrough.rollout)}null===(t=null==e?void 0:e.rules)||void 0===t||t.forEach((e=>{var t;ue(e.rollout),null===(t=null==e?void 0:e.clauses)||void 0===t||t.forEach((e=>{e&&e.attribute?e.attributeReference=new se.AttributeReference(e.attribute,!e.contextKind):e&&(e.attributeReference=se.AttributeReference.InvalidReference)}))}))}function de(e){var t,r,i,n,s;le(e),(null===(t=null==e?void 0:e.included)||void 0===t?void 0:t.length)&&e.included.length>oe&&(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>oe&&(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>oe&&(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>oe&&(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 se.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 se.AttributeReference(e.attribute,!e.contextKind):e&&(e.attributeReference=se.AttributeReference.InvalidReference)}))}))}function fe(e){try{return JSON.parse(e)}catch(e){return}}re.nullReplacer=le,re.replacer=ce,re.processFlag=he,re.processSegment=de,re.deserializeAll=function(e){var t,r;const i=fe(e);if(i)return Object.values((null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.flags)||[]).forEach((e=>{he(e)})),Object.values((null===(r=null==i?void 0:i.data)||void 0===r?void 0:r.segments)||[]).forEach((e=>{de(e)})),i},re.deserializePoll=function(e){const t=fe(e);if(t)return Object.values((null==t?void 0:t.flags)||[]).forEach((e=>{he(e)})),Object.values((null==t?void 0:t.segments)||[]).forEach((e=>{de(e)})),t},re.deserializePatch=function(e){const t=fe(e);if(t)return t.path.startsWith(ae.default.Features.streamApiPath)?(he(t.data),t.kind=ae.default.Features):t.path.startsWith(ae.default.Segments.streamApiPath)&&(de(t.data),t.kind=ae.default.Segments),t},re.deserializeDelete=function(e){const t=fe(e);if(t)return t.path.startsWith(ae.default.Features.streamApiPath)?t.kind=ae.default.Features:t.path.startsWith(ae.default.Segments.streamApiPath)&&(t.kind=ae.default.Segments),t},re.serializeFlag=function(e){return JSON.stringify(e,ce)},re.deserializeFlag=function(e){const t=fe(e);if(t)return he(t),t},re.serializeSegment=function(e){return JSON.stringify(e,ce)},re.deserializeSegment=function(e){const t=fe(e);if(t)return de(t),t},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createStreamListeners=e.createDeleteListener=e.createPatchListener=e.createPutListener=void 0;const t=re,r=ie;e.createPutListener=(e,i,n=()=>{})=>({deserializeData:t.deserializeAll,processJson:async({data:{flags:t,segments:s}})=>{const a={[r.default.Features.namespace]:t,[r.default.Segments.namespace]:s};null==i||i.debug("Initializing all data"),e.init(a,n)}});e.createPatchListener=(e,i,n=()=>{})=>({deserializeData:t.deserializePatch,processJson:async({data:t,kind:s,path:a})=>{if(s){const o=r.default.getKeyFromPath(s,a);o&&(null==i||i.debug(`Updating ${o} in ${s.namespace}`),e.upsert(s,t,n))}}});e.createDeleteListener=(e,i,n=()=>{})=>({deserializeData:t.deserializeDelete,processJson:async({kind:t,path:s,version:a})=>{if(t){const o=r.default.getKeyFromPath(t,s);o&&(null==i||i.debug(`Deleting ${o} in ${t.namespace}`),e.upsert(t,{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}}(te);var pe={},ve={},ge={};Object.defineProperty(ge,"__esModule",{value:!0});ge.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(ve,"__esModule",{value:!0});const _e=ge;ve.default=class{constructor(){this._dependenciesFrom=new _e.default,this._dependenciesTo=new _e.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 _e.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(pe,"__esModule",{value:!0});const ye=ie,me=ve,be=ge;function Ee(e,t){var r,i;const n=new be.default,s=e===ye.default.Features.namespace,a=e===ye.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(ye.default.Segments.namespace,e,!0)}))}))}))}return n}pe.default=class{constructor(e,t,r){this._featureStore=e,this._hasEventListeners=t,this._onChange=r,this._dependencyTracker=new me.default}init(e,t){const r=this._hasEventListeners(),i=i=>{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,Ee(e,i))}))})),r){const t=new be.default;Object.keys(e).forEach((r=>{const n=(null==i?void 0:i[r])||{},s=e[r],a=Object.assign(Object.assign({},n),s);Object.keys(a).forEach((e=>{this.addIfModified(r,e,n&&n[e],s&&s[e],t)}))})),this.sendChangeEvents(t)}})),null==t||t()}))};r?this._featureStore.all(ye.default.Features,(e=>{this._featureStore.all(ye.default.Segments,(t=>{const r={[ye.default.Features.namespace]:e,[ye.default.Segments.namespace]:t};i(r)}))})):i()}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,Ee(e.namespace,t)),n){const r=new be.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===ye.default.Features.namespace&&this._onChange(t)}))}};var we={},Se={},ke={},xe={};Object.defineProperty(xe,"__esModule",{value:!0}),xe.default=function(e){return new Promise((t=>{e((e=>{t(e)}))}))},Object.defineProperty(ke,"__esModule",{value:!0});const Oe=xe;ke.default=class{constructor(e){this._store=e}async get(e,t){return(0,Oe.default)((r=>{this._store.get(e,t,r)}))}async all(e){return(0,Oe.default)((t=>{this._store.all(e,t)}))}async init(e){return(0,Oe.default)((t=>{this._store.init(e,t)}))}async delete(e,t,r){return(0,Oe.default)((i=>{this._store.delete(e,t,r,i)}))}async upsert(e,t){return(0,Oe.default)((r=>{this._store.upsert(e,t,r)}))}async initialized(){return(0,Oe.default)((e=>{this._store.initialized(e)}))}close(){this._store.close()}};var Re={},De={};function Ie(e){return Date.now()>e.expiration}Object.defineProperty(De,"__esModule",{value:!0});De.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||!Ie(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)=>{Ie(e)&&this._storage.delete(t)}))}get size(){return this._storage.size}};var Ae={};Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.persistentStoreKinds=void 0;const Pe=re,Te=ie;Ae.persistentStoreKinds={segments:{namespace:Te.default.Segments.namespace,deserialize:e=>{const t=(0,Pe.deserializeSegment)(e);if(t)return{version:t.version,item:t}},serialize:e=>{const t=(0,Pe.serializeSegment)(e);return{version:e.version,deleted:e.deleted,serializedItem:t}},priority:0},features:{namespace:Te.default.Features.namespace,deserialize:e=>{const t=(0,Pe.deserializeFlag)(e);if(t)return{version:t.version,item:t}},serialize:e=>{const t=(0,Pe.serializeFlag)(e);return{version:e.version,deleted:e.deleted,serializedItem:t}},priority:1}};var Me={};Object.defineProperty(Me,"__esModule",{value:!0});const Ce=Ae;function Ne(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}Me.default=function(e){const t=[];return Object.keys(e).forEach((r=>{const i=Ce.persistentStoreKinds[r];t.push({key:i,item:Ne(i,e[r])})})),t.sort(((e,t)=>e.key.priority-t.key.priority)),t};var je={};Object.defineProperty(je,"__esModule",{value:!0});je.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(Re,"__esModule",{value:!0});const Fe=De,$e=Ae,Le=Me,Be=je;function Ve(e,t){return`${e.namespace}:${t}`}function ze(e){return`$all:${e.namespace}`}const He="$checkedInit";function Ke(e){return!e||e.item.deleted?null:e.item}function Ue(e){return{version:e,item:{version:e,deleted:!0}}}function qe(e,t){if(t.deleted||!t.serializedItem)return Ue(t.version);const r=e.deserialize(t.serializedItem);return void 0===r?Ue(t.version):0===r.version||r.version===t.version||void 0===r.item?r:{version:t.version,item:r.item}}Re.default=class{constructor(e,t){this._core=e,this._isInitialized=!1,this._queue=new Be.default,t&&(this._itemCache=new Fe.default({ttl:t,checkInterval:600}),this._allItemsCache=new Fe.default({ttl:t,checkInterval:600}))}init(e,t){this._queue.enqueue((t=>{this._core.init((0,Le.default)(e),(()=>{this._isInitialized=!0,this._itemCache&&(this._itemCache.clear(),this._allItemsCache.clear(),Object.keys(e).forEach((t=>{const r=$e.persistentStoreKinds[t],i=e[t];this._allItemsCache.set(ze(r),i),Object.keys(i).forEach((e=>{const t=i[e],n={version:t.version,item:t};this._itemCache.set(Ve(r,e),n)}))}))),t()}))}),t)}get(e,t,r){if(this._itemCache){const i=this._itemCache.get(Ve(e,t));if(i)return void r(Ke(i))}const i=$e.persistentStoreKinds[e.namespace];this._core.get(i,t,(n=>{var s;if(n&&n.serializedItem){const a=qe(i,n);return null===(s=this._itemCache)||void 0===s||s.set(Ve(e,t),a),void r(Ke(a))}r(null)}))}initialized(e){var t;this._isInitialized?e(!0):(null===(t=this._itemCache)||void 0===t?void 0:t.get(He))?e(!1):this._core.initialized((t=>{var r;this._isInitialized=t,this._isInitialized||null===(r=this._itemCache)||void 0===r||r.set(He,!0),e(this._isInitialized)}))}all(e,t){var r;const i=null===(r=this._allItemsCache)||void 0===r?void 0:r.get(ze(e));if(i)return void t(i);const n=$e.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=Ke(qe(n,t));r&&(s[e]=r)})),null===(i=this._allItemsCache)||void 0===i||i.set(ze(e),s),t(s)}))}upsert(e,t,r){this._queue.enqueue((r=>{this._allItemsCache&&this._allItemsCache.clear();const i=$e.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=qe(i,s);null===(a=this._itemCache)||void 0===a||a.set(Ve(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()}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserializePoll=e.PersistentDataStoreWrapper=e.AsyncStoreFacade=void 0;const t=ke;e.AsyncStoreFacade=t.default;const r=Re;e.PersistentDataStoreWrapper=r.default;const i=re;Object.defineProperty(e,"deserializePoll",{enumerable:!0,get:function(){return i.deserializePoll}})}(Se),Object.defineProperty(we,"__esModule",{value:!0});const We=o,Ge=Se,Xe=ie;we.default=class{constructor(e,t,r,i=()=>{},n){this._requestor=t,this._featureStore=r,this._initSuccessHandler=i,this._errorHandler=n,this._stopped=!1,this._logger=e.logger,this._pollInterval=e.pollInterval}_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 We.LDPollingError(We.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)=>{var n,s,a,o;const l=Date.now()-r,c=Math.max(1e3*this._pollInterval-l,0);if(null===(n=this._logger)||void 0===n||n.debug("Elapsed: %d ms, sleeping for %d ms",l,c),e){const{status:t}=e;if(t&&!(0,We.isHttpRecoverable)(t)){const r=(0,We.httpErrorMessage)(e,"polling request");return null===(s=this._logger)||void 0===s||s.error(r),void(null===(a=this._errorHandler)||void 0===a||a.call(this,new We.LDPollingError(We.DataSourceErrorKind.ErrorResponse,r,t)))}null===(o=this._logger)||void 0===o||o.warn((0,We.httpErrorMessage)(e,"polling request","will retry"))}else if(i){const e=(0,Ge.deserializePoll)(i);if(e){const t={[Xe.default.Features.namespace]:e.flags,[Xe.default.Segments.namespace]:e.segments};return void this._featureStore.init(t,(()=>{this._initSuccessHandler(),this._timeoutHandle=e=>{e()}}))}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 Je={};Object.defineProperty(Je,"__esModule",{value:!0});const Ye=o;Je.default=class{constructor(e,t,r){this._requests=t,this._eTagCache={},this._headers=Object.assign({},r),this._uri=(0,Ye.getPollingUri)(e.serviceEndpoints,"/sdk/latest-all",[])}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){const t={method:"GET",headers:this._headers};try{const{res:r,body:i}=await this._requestWithETagCache(this._uri,t);if(200!==r.status&&304!==r.status){return e(new Ye.LDPollingError(Ye.DataSourceErrorKind.ErrorResponse,`Unexpected status code: ${r.status}`,r.status),void 0)}return e(void 0,304===r.status?null:i)}catch(t){return e(t,void 0)}}};var Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});const Qe=o;Ze.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:h}=c;this._headers=Object.assign({},n),this._logger=u,this._requests=h,this._streamUri=(0,Qe.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,Qe.shouldRetry)(e)?(null===(i=this._logger)||void 0===i||i.warn((0,Qe.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 Qe.LDStreamingError(Qe.DataSourceErrorKind.ErrorResponse,e.message,e.status)),null===(r=this._logger)||void 0===r||r.error((0,Qe.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=()=>{var e;null===(e=this._logger)||void 0===e||e.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 Qe.LDStreamingError(Qe.DataSourceErrorKind.InvalidData,"Malformed JSON data in event stream"))})(i,n,this._logger,this._errorHandler);r(s)}else null===(s=this._errorHandler)||void 0===s||s.call(this,new Qe.LDStreamingError(Qe.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 et={},tt={},rt={};Object.defineProperty(rt,"__esModule",{value:!0});rt.default=class{constructor(){this._allData={},this._initCalled=!1}_addItem(e,t,r){let i=this._allData[e.namespace];if(i||(i={},this._allData[e.namespace]=i),Object.hasOwnProperty.call(i,t)){const e=i[t];(!e||e.version<r.version)&&(i[t]=r)}else i[t]=r}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){this._initCalled=!0,this._allData=e,null==t||t()}delete(e,t,r,i){const n={version:r,deleted:!0};this._addItem(e,t,n),null==i||i()}upsert(e,t,r){this._addItem(e,t.key,t),null==r||r()}initialized(e){return null==e?void 0:e(this._initCalled)}close(){}getDescription(){return"memory"}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultValues=void 0;const t=o,r=rt,i={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,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[]",{})};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:30,offline:!1,useLdd:!1,allAttributesPrivate:!1,privateAttributes:[],contextKeysCapacity:1e3,contextKeysFlushInterval:300,diagnosticOptOut:!1,diagnosticRecordingInterval:900,featureStore:()=>new r.default};e.default=class{constructor(r={},n={}){r=r||{},this.logger=r.logger;const{errors:s,validatedOptions:a}=function(r){const n=[],s=Object.assign({},e.defaultValues);return Object.keys(r).forEach((a=>{var o;const l=r[a],c=i[a];if(c)if(c.is(l))s[a]=l;else if("boolean"===c.getType())n.push(t.OptionMessages.wrongOptionTypeBoolean(a,typeof l)),s[a]=!!l;else if(c instanceof t.NumberWithMinimum&&t.TypeValidators.Number.is(l)){const{min:e}=c;n.push(t.OptionMessages.optionBelowMinimum(a,l,e)),s[a]=e}else n.push(t.OptionMessages.wrongOptionType(a,c.getType(),typeof l)),s[a]=e.defaultValues[a];else null===(o=r.logger)||void 0===o||o.warn(t.OptionMessages.unknownOption(a))})),{errors:n,validatedOptions:s}}(r);s.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,h=null!=l;c===u&&c===h||(!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")),!h&&r.sendEvents&&(null===(s=r.logger)||void 0===s||s.warn(t.OptionMessages.partialEndpoint("eventsUri"))))}(r,a),this.serviceEndpoints=new t.ServiceEndpoints(a.streamUri,a.baseUri,a.eventsUri,n.analyticsEventPath,n.diagnosticEventPath,n.includeAuthorizationHeader,a.payloadFilterKey),this.eventsCapacity=a.capacity,this.timeout=a.timeout,this.bigSegments=a.bigSegments,this.flushInterval=a.flushInterval,this.pollInterval=a.pollInterval,this.proxyOptions=a.proxyOptions,this.offline=a.offline,this.stream=a.stream,this.streamInitialReconnectDelay=a.streamInitialReconnectDelay,this.useLdd=a.useLdd,this.sendEvents=a.sendEvents,this.allAttributesPrivate=a.allAttributesPrivate,this.privateAttributes=a.privateAttributes,this.contextKeysCapacity=a.contextKeysCapacity,this.contextKeysFlushInterval=a.contextKeysFlushInterval,this.tlsParams=a.tlsParams,this.diagnosticOptOut=a.diagnosticOptOut,this.wrapperName=a.wrapperName,this.payloadFilterKey=a.payloadFilterKey,this.wrapperVersion=a.wrapperVersion,this.tags=new t.ApplicationTags(a),this.diagnosticRecordingInterval=a.diagnosticRecordingInterval,t.TypeValidators.Function.is(a.updateProcessor)?this.updateProcessorFactory=a.updateProcessor:this.updateProcessorFactory=()=>a.updateProcessor,t.TypeValidators.Function.is(a.featureStore)?this.featureStoreFactory=a.featureStore:this.featureStoreFactory=()=>a.featureStore,this.hooks=a.hooks}}}(tt),Object.defineProperty(et,"__esModule",{value:!0});const it=o,nt=tt;et.default=(e,t,r)=>{var i,n,s,a,o,l;return{customBaseURI:e.serviceEndpoints.polling!==nt.defaultValues.baseUri,customStreamURI:e.serviceEndpoints.streaming!==nt.defaultValues.streamUri,customEventsURI:e.serviceEndpoints.events!==nt.defaultValues.eventsUri,eventsCapacity:e.eventsCapacity,connectTimeoutMillis:(0,it.secondsToMillis)(e.timeout),socketTimeoutMillis:(0,it.secondsToMillis)(e.timeout),eventsFlushIntervalMillis:(0,it.secondsToMillis)(e.flushInterval),pollingIntervalMillis:(0,it.secondsToMillis)(e.pollInterval),reconnectTimeMillis:(0,it.secondsToMillis)(e.streamInitialReconnectDelay),contextKeysFlushIntervalMillis:(0,it.secondsToMillis)(e.contextKeysFlushInterval),diagnosticRecordingIntervalMillis:(0,it.secondsToMillis)(e.diagnosticRecordingInterval),streamingDisabled:!e.stream,usingRelayDaemon:e.useLdd,offline:e.offline,allAttributesPrivate:e.allAttributesPrivate,contextKeysCapacity:e.contextKeysCapacity,usingProxy:!!(null===(n=(i=t.requests).usingProxy)||void 0===n?void 0:n.call(i)),usingProxyAuthenticator:!!(null===(a=(s=t.requests).usingProxyAuth)||void 0===a?void 0:a.call(s)),dataStoreType:null!==(l=null===(o=r.getDescription)||void 0===o?void 0:o.call(r))&&void 0!==l?l:"memory"}};var st={};Object.defineProperty(st,"__esModule",{value:!0}),st.allAsync=st.firstSeriesAsync=st.allSeriesAsync=st.firstResult=void 0,st.firstResult=function(e,t){let r;return null==e||e.some(((e,i)=>(r=t(e,i),!!r))),r};function at(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((()=>{at(e,t,r,i+1,n)})):at(e,t,r,i+1,n)})):n(r):n(!1)}st.allSeriesAsync=function(e,t,r){at(e,t,!0,0,r)},st.firstSeriesAsync=function(e,t,r){at(e,t,!1,0,r)},st.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 ot={},lt={};Object.defineProperty(lt,"__esModule",{value:!0});class ct{static prerequisiteFailed(e){return{kind:"PREREQUISITE_FAILED",prerequisiteKey:e}}static ruleMatch(e,t){return{kind:"RULE_MATCH",ruleId:e,ruleIndex:t}}}ct.Fallthrough={kind:"FALLTHROUGH"},ct.Off={kind:"OFF"},ct.TargetMatch={kind:"TARGET_MATCH"},lt.default=ct,Object.defineProperty(ot,"__esModule",{value:!0});const ut=lt;class ht{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===ut.default.Off.kind}setDefault(e){this.detail.value=e}static forError(e,t,r){return new ht(!0,{value:null!=r?r:null,variationIndex:null,reason:{kind:"ERROR",errorKind:e}},t)}static forSuccess(e,t,r){return new ht(!1,{value:e,variationIndex:void 0===r?null:r,reason:t})}}ot.default=ht;var dt={},ft={};Object.defineProperty(ft,"__esModule",{value:!0});ft.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 pt={},vt={};Object.defineProperty(vt,"__esModule",{value:!0}),vt.getBucketBy=vt.getOffVariation=vt.getVariation=void 0;const gt=o,_t=ot,{ErrorKinds:yt}=gt.internal,mt=new gt.AttributeReference("key");function bt(e,t,r){return gt.TypeValidators.Number.is(t)&&t>=0&&t<e.variations.length?_t.default.forSuccess(e.variations[t],r,t):_t.default.forError(yt.MalformedFlag,"Invalid variation index in flag")}vt.getVariation=bt,vt.getOffVariation=function(e,t){return gt.TypeValidators.Number.is(e.offVariation)?bt(e,e.offVariation,t):_t.default.forSuccess(null,t)},vt.getBucketBy=function(e,t){var r;return null!==(r=e?void 0:t)&&void 0!==r?r:mt},Object.defineProperty(pt,"__esModule",{value:!0});const Et=o,wt=st,St=lt,kt=vt;function xt(e,t,r){const i=r.key(t.contextKind);if(void 0!==i){if(t.values.indexOf(i)>=0)return(0,kt.getVariation)(e,t.variation,St.default.TargetMatch)}}pt.default=function(e,t){var r;return(null===(r=e.contextTargets)||void 0===r?void 0:r.length)?(0,wt.firstResult)(e.contextTargets,(r=>{if(!r.contextKind||r.contextKind===Et.Context.UserKind){const i=(e.targets||[]).find((e=>e.variation===r.variation));return i?xt(e,i,t):void 0}return xt(e,r,t)})):(0,wt.firstResult)(e.targets,(r=>xt(e,r,t)))};var Ot={};Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.default=function(e){return`${e.key}.g${e.generation}`};var Rt={},Dt={},It={exports:{}};var At={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 Pt="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}=At,s=Pt,a=(t=e.exports={}).re=[],o=t.safeRe=[],l=t.src=[],c=t.t={};let u=0;const h="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",n],[h,i]],f=(e,t,r)=>{const i=(e=>{for(const[t,r]of d)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-]${h}*`),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",`${h}+`),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*$")}(It,It.exports);var Tt=It.exports;const Mt=Object.freeze({loose:!0}),Ct=Object.freeze({});var Nt=e=>e?"object"!=typeof e?Mt:e:Ct;const jt=/^[0-9]+$/,Ft=(e,t)=>{const r=jt.test(e),i=jt.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};var $t={compareIdentifiers:Ft,rcompareIdentifiers:(e,t)=>Ft(t,e)};const Lt=Pt,{MAX_LENGTH:Bt,MAX_SAFE_INTEGER:Vt}=At,{safeRe:zt,t:Ht}=Tt,Kt=Nt,{compareIdentifiers:Ut}=$t;var qt=class e{constructor(t,r){if(r=Kt(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>Bt)throw new TypeError(`version is longer than ${Bt} characters`);Lt("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const i=t.trim().match(r.loose?zt[Ht.LOOSE]:zt[Ht.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>Vt||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Vt||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Vt||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<Vt)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(Lt("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)),Ut(this.major,t.major)||Ut(this.minor,t.minor)||Ut(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(Lt("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 Ut(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(Lt("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 Ut(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===Ut(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 Wt=qt;var Gt=(e,t,r=!1)=>{if(e instanceof Wt)return e;try{return new Wt(e,t)}catch(e){if(!r)return null;throw e}};const Xt=Gt;var Jt=(e,t)=>{const r=Xt(e,t);return r?r.version:null};const Yt=Gt;var Zt=(e,t)=>{const r=Yt(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const Qt=qt;var er=(e,t,r,i,n)=>{"string"==typeof r&&(n=i,i=r,r=void 0);try{return new Qt(e instanceof Qt?e.version:e,r).inc(t,i,n).version}catch(e){return null}};const tr=Gt;var rr=(e,t)=>{const r=tr(e,null,!0),i=tr(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 ir=qt;var nr=(e,t)=>new ir(e,t).major;const sr=qt;var ar=(e,t)=>new sr(e,t).minor;const or=qt;var lr=(e,t)=>new or(e,t).patch;const cr=Gt;var ur=(e,t)=>{const r=cr(e,t);return r&&r.prerelease.length?r.prerelease:null};const hr=qt;var dr=(e,t,r)=>new hr(e,r).compare(new hr(t,r));const fr=dr;var pr=(e,t,r)=>fr(t,e,r);const vr=dr;var gr=(e,t)=>vr(e,t,!0);const _r=qt;var yr=(e,t,r)=>{const i=new _r(e,r),n=new _r(t,r);return i.compare(n)||i.compareBuild(n)};const mr=yr;var br=(e,t)=>e.sort(((e,r)=>mr(e,r,t)));const Er=yr;var wr=(e,t)=>e.sort(((e,r)=>Er(r,e,t)));const Sr=dr;var kr=(e,t,r)=>Sr(e,t,r)>0;const xr=dr;var Or=(e,t,r)=>xr(e,t,r)<0;const Rr=dr;var Dr=(e,t,r)=>0===Rr(e,t,r);const Ir=dr;var Ar=(e,t,r)=>0!==Ir(e,t,r);const Pr=dr;var Tr=(e,t,r)=>Pr(e,t,r)>=0;const Mr=dr;var Cr=(e,t,r)=>Mr(e,t,r)<=0;const Nr=Dr,jr=Ar,Fr=kr,$r=Tr,Lr=Or,Br=Cr;var Vr=(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 Nr(e,r,i);case"!=":return jr(e,r,i);case">":return Fr(e,r,i);case">=":return $r(e,r,i);case"<":return Lr(e,r,i);case"<=":return Br(e,r,i);default:throw new TypeError(`Invalid operator: ${t}`)}};const zr=qt,Hr=Gt,{safeRe:Kr,t:Ur}=Tt;var qr,Wr,Gr,Xr,Jr,Yr,Zr,Qr,ei,ti,ri=(e,t)=>{if(e instanceof zr)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=Kr[Ur.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),Kr[Ur.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;Kr[Ur.COERCERTL].lastIndex=-1}else r=e.match(Kr[Ur.COERCE]);return null===r?null:Hr(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function ii(){if(Xr)return Gr;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}Xr=1,Gr=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{(Wr?qr:(Wr=1,qr=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}))(e)}catch(e){}return Gr}function ni(){if(Qr)return Zr;Qr=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&&d)|(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,R(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],h),s("caret trim",e);let g=e.split(" ").map((e=>_(e,this.options))).join(" ").split(/\s+/).map((e=>O(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(D(this.set[t],e,this.options))return!0;return!1}}Zr=e;const t=function(){if(Yr)return Jr;Yr=1;const e=ii(),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"),h=()=>1,d=(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 Jr=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||h;if(this[i]="function"!=typeof r?h: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=h),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 h=u?Date.now():0,d=this[i](n,e);if(this[c].has(e)){if(d>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=h,i.maxAge=u,i.value=n,this[r]+=d-i.length,i.length=d,this.get(e),p(this),!0}const f=new g(e,n,d,h,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 d(this,e,!0)}peek(e){return d(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)=>d(this,t,!1)))}},Jr}(),r=new t({max:1e3}),i=Nt,n=si(),s=Pt,a=qt,{safeRe:o,t:l,comparatorTrimReplace:c,tildeTrimReplace:u,caretTrimReplace:h}=Tt,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:f}=At,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=E(e,t),s("caret",e),e=m(e,t),s("tildes",e),e=S(e,t),s("xrange",e),e=x(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}))},E=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(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}))},S=(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),h=u||y(o),d=h;return"="===i&&d&&(i=""),l=t.includePrerelease?"-0":"",c?r=">"===i||"<"===i?"<0.0.0-0":"*":i&&d?(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`:h&&(r=`>=${n}.${a}.0${l} <${n}.${+a+1}.0-0`),s("xRange return",r),r}))},x=(e,t)=>(s("replaceStars",e,t),e.trim().replace(o[l.STAR],"")),O=(e,t)=>(s("replaceGTE0",e,t),e.trim().replace(o[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),R=e=>(t,r,i,n,s,a,o,l,c,u,h,d,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(h)?`<${c}.${+u+1}.0-0`:d?`<=${c}.${u}.${h}-${d}`:e?`<${c}.${u}.${+h+1}-0`:`<=${l}`}`.trim(),D=(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 Zr}function si(){if(ti)return ei;ti=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(">")))))))}}ei=t;const r=Nt,{safeRe:i,t:n}=Tt,s=Vr,a=Pt,o=qt,l=ni();return ei}const ai=ni();var oi=(e,t,r)=>{try{t=new ai(t,r)}catch(e){return!1}return t.test(e)};const li=ni();var ci=(e,t)=>new li(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")));const ui=qt,hi=ni();var di=(e,t,r)=>{let i=null,n=null,s=null;try{s=new hi(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 fi=qt,pi=ni();var vi=(e,t,r)=>{let i=null,n=null,s=null;try{s=new pi(t,r)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(i&&1!==n.compare(e)||(i=e,n=new fi(i,r)))})),i};const gi=qt,_i=ni(),yi=kr;var mi=(e,t)=>{e=new _i(e,t);let r=new gi("0.0.0");if(e.test(r))return r;if(r=new gi("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 gi(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":n&&!yi(t,n)||(n=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!n||r&&!yi(r,n)||(r=n)}return r&&e.test(r)?r:null};const bi=ni();var Ei=(e,t)=>{try{return new bi(e,t).range||"*"}catch(e){return null}};const wi=qt,Si=si(),{ANY:ki}=Si,xi=ni(),Oi=oi,Ri=kr,Di=Or,Ii=Cr,Ai=Tr;var Pi=(e,t,r,i)=>{let n,s,a,o,l;switch(e=new wi(e,i),t=new xi(t,i),r){case">":n=Ri,s=Ii,a=Di,o=">",l=">=";break;case"<":n=Di,s=Ai,a=Ri,o="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Oi(e,t,i))return!1;for(let r=0;r<t.set.length;++r){const c=t.set[r];let u=null,h=null;if(c.forEach((e=>{e.semver===ki&&(e=new Si(">=0.0.0")),u=u||e,h=h||e,n(e.semver,u.semver,i)?u=e:a(e.semver,h.semver,i)&&(h=e)})),u.operator===o||u.operator===l)return!1;if((!h.operator||h.operator===o)&&s(e,h.semver))return!1;if(h.operator===l&&a(e,h.semver))return!1}return!0};const Ti=Pi;var Mi=(e,t,r)=>Ti(e,t,">",r);const Ci=Pi;var Ni=(e,t,r)=>Ci(e,t,"<",r);const ji=ni();var Fi=(e,t,r)=>(e=new ji(e,r),t=new ji(t,r),e.intersects(t,r));const $i=oi,Li=dr;const Bi=ni(),Vi=si(),{ANY:zi}=Vi,Hi=oi,Ki=dr,Ui=[new Vi(">=0.0.0-0")],qi=[new Vi(">=0.0.0")],Wi=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===zi){if(1===t.length&&t[0].semver===zi)return!0;e=r.includePrerelease?Ui:qi}if(1===t.length&&t[0].semver===zi){if(r.includePrerelease)return!0;t=qi}const i=new Set;let n,s,a,o,l,c,u;for(const t of e)">"===t.operator||">="===t.operator?n=Gi(n,t,r):"<"===t.operator||"<="===t.operator?s=Xi(s,t,r):i.add(t.semver);if(i.size>1)return null;if(n&&s){if(a=Ki(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&&!Hi(e,String(n),r))return null;if(s&&!Hi(e,String(s),r))return null;for(const i of t)if(!Hi(e,String(i),r))return!1;return!0}let h=!(!s||r.includePrerelease||!s.semver.prerelease.length)&&s.semver,d=!(!n||r.includePrerelease||!n.semver.prerelease.length)&&n.semver;h&&1===h.prerelease.length&&"<"===s.operator&&0===h.prerelease[0]&&(h=!1);for(const e of t){if(u=u||">"===e.operator||">="===e.operator,c=c||"<"===e.operator||"<="===e.operator,n)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(o=Gi(n,e,r),o===e&&o!==n)return!1}else if(">="===n.operator&&!Hi(n.semver,String(e),r))return!1;if(s)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(l=Xi(s,e,r),l===e&&l!==s)return!1}else if("<="===s.operator&&!Hi(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)&&(!d&&!h))},Gi=(e,t,r)=>{if(!e)return t;const i=Ki(e.semver,t.semver,r);return i>0?e:i<0||">"===t.operator&&">="===e.operator?t:e},Xi=(e,t,r)=>{if(!e)return t;const i=Ki(e.semver,t.semver,r);return i<0?e:i>0||"<"===t.operator&&"<="===e.operator?t:e};var Ji=(e,t,r={})=>{if(e===t)return!0;e=new Bi(e,r),t=new Bi(t,r);let i=!1;e:for(const n of e.set){for(const e of t.set){const t=Wi(n,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0};const Yi=Tt,Zi=At,Qi=qt,en=$t,tn=(e,t,r)=>{const i=[];let n=null,s=null;const a=e.sort(((e,t)=>Li(e,t,r)));for(const e of a){$i(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:Gt,valid:Jt,clean:Zt,inc:er,diff:rr,major:nr,minor:ar,patch:lr,prerelease:ur,compare:dr,rcompare:pr,compareLoose:gr,compareBuild:yr,sort:br,rsort:wr,gt:kr,lt:Or,eq:Dr,neq:Ar,gte:Tr,lte:Cr,cmp:Vr,coerce:ri,Comparator:si(),Range:ni(),satisfies:oi,toComparators:ci,maxSatisfying:di,minSatisfying:vi,minVersion:mi,validRange:Ei,outside:Pi,gtr:Mi,ltr:Ni,intersects:Fi,simplifyRange:tn,subset:Ji,SemVer:Qi,re:Yi.re,src:Yi.src,tokens:Yi.t,SEMVER_SPEC_VERSION:Zi.SEMVER_SPEC_VERSION,RELEASE_TYPES:Zi.RELEASE_TYPES,compareIdentifiers:en.compareIdentifiers,rcompareIdentifiers:en.rcompareIdentifiers};Object.defineProperty(Dt,"__esModule",{value:!0});const nn=rn,sn=o,an=/^\d+(\.\d+)?(\.\d+)?/;function on(e){if(sn.TypeValidators.String.is(e)&&!e.startsWith("v")){const t=(0,nn.parse)(e);if(t)return t;const r=an.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,nn.parse)(t)}}return null}function ln(e){return(t,r)=>{const i=on(t),n=on(r);return!!(i&&n&&e(i,n))}}function cn(e,t,r){return(i,n)=>!(!t.is(i)||!t.is(n))&&(r?e(r(i),r(n)):e(i,n))}function un(e){return"number"==typeof e?e:Date.parse(e)}const hn={in:(e,t)=>e===t,endsWith:cn(((e,t)=>e.endsWith(t)),sn.TypeValidators.String),startsWith:cn(((e,t)=>e.startsWith(t)),sn.TypeValidators.String),matches:cn(((e,t)=>function(e,t){try{return new RegExp(e).test(t)}catch(e){return!1}}(t,e)),sn.TypeValidators.String),contains:cn(((e,t)=>e.indexOf(t)>-1),sn.TypeValidators.String),lessThan:cn(((e,t)=>e<t),sn.TypeValidators.Number),lessThanOrEqual:cn(((e,t)=>e<=t),sn.TypeValidators.Number),greaterThan:cn(((e,t)=>e>t),sn.TypeValidators.Number),greaterThanOrEqual:cn(((e,t)=>e>=t),sn.TypeValidators.Number),before:cn(((e,t)=>e<t),sn.TypeValidators.Date,un),after:cn(((e,t)=>e>t),sn.TypeValidators.Date,un),semVerEqual:ln(((e,t)=>0===e.compare(t))),semVerLessThan:ln(((e,t)=>e.compare(t)<0)),semVerGreaterThan:ln(((e,t)=>e.compare(t)>0))};Dt.default=class{static is(e){return Object.prototype.hasOwnProperty.call(hn,e)}static execute(e,t,r){var i,n;return null!==(n=null===(i=hn[e])||void 0===i?void 0:i.call(hn,t,r))&&void 0!==n&&n}},Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.maybeNegate=void 0;const dn=Dt;function fn(e,t){return e.negate?!t:t}function pn(e,t,r){return r.some((r=>dn.default.execute(e,t,r)))}Rt.maybeNegate=fn,Rt.default=function(e,t){const r=t.valueForKind(e.attributeReference,e.contextKind);return null!=r&&(Array.isArray(r)?fn(e,r.some((t=>pn(e.op,t,e.values)))):fn(e,pn(e.op,r,e.values)))};var vn={};function gn(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(gn(t,e.includedContexts,e.included,e.generated_includedSet))return!0;const r=gn(t,e.excludedContexts,e.excluded,e.generated_excludedSet);return r?!r:void 0},Object.defineProperty(dt,"__esModule",{value:!0});const _n=o,yn=ft,mn=st,bn=ot,En=pt,wn=Ot,Sn=Rt,kn=vn,xn=lt,On=vt,{ErrorKinds:Rn}=_n.internal,Dn={HEALTHY:1,STALE:2,STORE_ERROR:3,NOT_CONFIGURED:4};function In(e){return void 0!==e&&Dn[e]||0}function An(e,t){return void 0!==e&&In(e)>In(t)?e:t}function Pn(e){return{error:!1,isMatch:e,result:void 0}}function Tn(e){return{error:!0,isMatch:!1,result:e}}dt.default=class{constructor(e,t){this._queries=t,this._bucketer=new yn.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,En.default)(e,t);s?n(s):this._evaluateRules(e,t,r,(r=>{n(r||this._variationForContext(e.fallthrough,t,e,xn.default.Fallthrough))}))}),s,a):n((0,On.getOffVariation)(e,xn.default.Off))}_checkPrerequisites(e,t,r,i,n,s,a){let o;e.prerequisites&&e.prerequisites.length?(0,mn.allSeriesAsync)(e.prerequisites,((n,l,c)=>{if(-1!==i.indexOf(n.key))return o=bn.default.forError(Rn.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,On.getOffVariation)(e,xn.default.prerequisiteFailed(n.key)),void c(!1);this._evaluateInternal(i,t,r,u,(l=>{var u,h;return null!==(u=r.events)&&void 0!==u||(r.events=[]),s&&(null!==(h=r.prerequisites)&&void 0!==h||(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,On.getOffVariation)(e,xn.default.prerequisiteFailed(n.key)),c(!1)):c(!0)}),!1,a)}))}),(()=>{n(o)})):n(void 0)}_evaluateRules(e,t,r,i){let n;(0,mn.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(Pn((0,Sn.default)(e,t))):n(Tn(bn.default.forError(Rn.MalformedFlag,"Invalid attribute reference in clause"))):(0,mn.firstSeriesAsync)(e.values,((e,n,a)=>{this._queries.getSegment(e,(e=>{if(e){if(r.includes(e.key))return s=bn.default.forError(Rn.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?Tn(s):Pn((0,Sn.maybeNegate)(e,t)))))}_ruleMatchContext(e,t,r,i,n,s,a){if(!t.clauses)return void a(void 0);let o;(0,mn.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,xn.default.ruleMatch(t.id,r)):void 0))))}_variationForContext(e,t,r,i){if(void 0===e)return bn.default.forError(Rn.MalformedFlag,"Fallthrough variation undefined");if(void 0!==e.variation)return(0,On.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,On.getBucketBy)(a,n.bucketByAttributeReference);if(!e.isValid)return bn.default.forError(Rn.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,On.getVariation)(r,t.variation,c)}const h=s[s.length-1];return a&&!h.untracked&&(c.inExperiment=!0),(0,On.getVariation)(r,h.variation,c)}}return bn.default.forError(Rn.MalformedFlag,"Variation/rollout object with no variation or rollout")}segmentRuleMatchContext(e,t,r,i,n,s){let a;(0,mn.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(Tn(a));if(i){if(void 0===t.weight)return s(Pn(i));const n=(0,On.getBucketBy)(!1,t.bucketByAttributeReference);if(!n.isValid)return s(Tn(bn.default.forError(Rn.MalformedFlag,"Invalid attribute reference in clause")));const[a]=this._bucketer.bucket(r,e.key,n,e.salt||"",t.rolloutContextKind);return s(Pn(a<t.weight/1e5))}return s(Pn(!1))}))}simpleSegmentMatchContext(e,t,r,i,n){if(!e.unbounded){const r=(0,kn.default)(e,t);if(void 0!==r)return void n(Pn(r))}let s;(0,mn.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?Tn(s):Pn(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=An(r.bigSegmentsStatus,t)}else r.bigSegmentsStatus=An(r.bigSegmentsStatus,"NOT_CONFIGURED");this.bigSegmentMatchContext(r.bigSegmentsMembership[a],e,t,r).then(n)}))):(r.bigSegmentsStatus=An(r.bigSegmentsStatus,"NOT_CONFIGURED"),void n(Pn(!1)));n(Pn(!1))}bigSegmentMatchContext(e,t,r,i){const n=(0,wn.default)(t),s=null==e?void 0:e[n];return new Promise((e=>{null==s?this.simpleSegmentMatchContext(t,r,i,[],e):e(Pn(s))}))}};var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});const Cn=Y;Mn.default=class{constructor(e){this._contextKeysCache=new Cn.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 Nn={},jn={};Object.defineProperty(jn,"__esModule",{value:!0}),jn.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(Nn,"__esModule",{value:!0});const Fn=o,$n=jn;class Ln extends Fn.internal.EventFactoryBase{evalEventServer(e,t,r,i,n){var s;const a=(0,$n.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})}}Nn.default=Ln;var Bn={};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.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 Vn={};Object.defineProperty(Vn,"__esModule",{value:!0});const zn="unknown hook";Vn.default=class{constructor(e,t){this._logger=e,this._hooks=[],this._hooks.push(...t)}async withEvaluationSeries(e,t,r,i,n){return 0===this._hooks.length?n():this.withEvaluationSeriesExtraDetail(e,t,r,i,(async()=>({detail:await n()}))).then((({detail:e})=>e))}async withEvaluationSeriesExtraDetail(e,t,r,i,n){if(0===this._hooks.length)return n();const{hooks:s,hookContext:a}=this._prepareHooks(e,t,r,i),o=this._executeBeforeEvaluation(s,a),l=await n();return this._executeAfterEvaluation(s,a,o,l.detail),l}_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:zn}catch(e){return null===(r=this._logger)||void 0===r||r.error("Exception thrown getting metadata for hook. Unable to get hook name."),zn}}_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){return{hooks:[...this._hooks],hookContext:{flagKey:e,context:t,defaultValue:r,method:i}}}addHook(e){this._hooks.push(e)}};var Hn={};Object.defineProperty(Hn,"__esModule",{value:!0});const Kn=o;function Un(e){const t=e.old,r=e.new;return!(void 0!==t&&!Kn.TypeValidators.Boolean.is(t))&&!(void 0!==r&&!Kn.TypeValidators.Boolean.is(r))}function qn(e){if(Kn.TypeValidators.String.is(e.key)&&""!==e.key){if("latency_ms"===e.key){if(!Kn.TypeValidators.Object.is(e.values))return;if(!function(e){const t=e.old,r=e.new;return!(void 0!==t&&!Kn.TypeValidators.Number.is(t)||void 0!==r&&!Kn.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(!Kn.TypeValidators.Object.is(e.values))return;if(!Un(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(!Kn.TypeValidators.Boolean.is(e.value)||!Kn.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(!Kn.TypeValidators.Object.is(e.values))return;if(!Un(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}}}Hn.default=function(e){var t,r;if("migration_op"!==e.kind)return;if(r=e.operation,!Kn.TypeValidators.String.is(r)||"read"!==r&&"write"!==r)return;if(!Kn.TypeValidators.Number.is(e.creationDate))return;const i={};if(Kn.TypeValidators.Object.is(e.context)){const t=Kn.Context.fromLDContext(e.context);t.valid&&(i.context=t)}else Kn.TypeValidators.Object.is(e.contextKeys)&&Object.keys(e.contextKeys).every((e=>Kn.TypeValidators.Kind.is(e)))&&Object.values(e.contextKeys).every((e=>Kn.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(!Kn.TypeValidators.Number.is(n))return;const s=function(e){if(!Kn.TypeValidators.String.is(e.key)||""===e.key)return;if(!Kn.TypeValidators.Object.is(e.reason))return;if(!Kn.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 Kn.TypeValidators.String.is(r.errorKind)&&(i.errorKind=r.errorKind),Kn.TypeValidators.String.is(r.ruleId)&&(i.ruleId=r.ruleId),Kn.TypeValidators.String.is(r.prerequisiteKey)&&(i.prerequisiteKey=r.prerequisiteKey),Kn.TypeValidators.Boolean.is(r.inExperiment)&&(i.inExperiment=r.inExperiment),Kn.TypeValidators.Number.is(r.ruleIndex)&&(i.ruleIndex=r.ruleIndex),Kn.TypeValidators.String.is(r.bigSegmentsStatus)&&(i.bigSegmentsStatus=r.bigSegmentsStatus),void 0!==e.variation&&Kn.TypeValidators.Number.is(e.variation)&&(t.variation=e.variation),void 0!==e.version&&Kn.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(qn).filter((e=>void 0!==e))),evaluation:s,samplingRatio:n}):void 0};var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});const Gn=o,Xn=c;function Jn(e){return!Number.isNaN(e)}Wn.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=Xn.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(Gn.internal.shouldSample(null!==(t=this._checkRatio)&&void 0!==t?t:1))try{const t=e();this._consistencyCheck=t?Xn.LDConsistencyCheck.Consistent:Xn.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(!Gn.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(!Gn.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===Xn.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!==Xn.LDConsistencyCheck.NotChecked&&e.push({key:"consistent",value:this._consistencyCheck===Xn.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=Jn(this._latencyMeasurement.new),r=Jn(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 Yn=o,Zn=l,Qn=J,es=te,ts=pe,rs=we,is=Je,ns=Ze,ss=et,as=st,os=ot,ls=dt,cs=Mn,us=Nn,hs=jn,ds=Bn,fs=Vn,ps=Hn,vs=Wn,gs=tt,_s=ie,{ClientMessages:ys,ErrorKinds:ms,NullEventProcessor:bs}=Yn.internal;var Es;!function(e){e[e.Initializing=0]="Initializing",e[e.Initialized=1]="Initialized",e[e.Failed=2]="Failed"}(Es||(Es={}));a.default=class{get logger(){return this._logger}constructor(e,t,r,i,n){var s,a,o,l,c;this._sdkKey=e,this._platform=t,this._initState=Es.Initializing,this._eventFactoryDefault=new us.default(!1),this._eventFactoryWithReasons=new us.default(!0),this._onError=i.onError,this._onFailed=i.onFailed,this._onReady=i.onReady;const{onUpdate:u,hasEventListeners:h}=i,d=new gs.default(r,n);if(this._hookRunner=new fs.default(d.logger,d.hooks||[]),!e&&!d.offline)throw new Error("You must configure the client with an SDK key");this._config=d,this._logger=d.logger;const f=(0,Yn.defaultHeaders)(e,t.info,d.tags),p=new Yn.ClientContext(e,d,t),v=d.featureStoreFactory(p),g=new ts.default(v,h,u);!d.sendEvents||d.offline||d.diagnosticOptOut||(this._diagnosticsManager=new Yn.internal.DiagnosticsManager(e,t,(0,ss.default)(d,t,v))),!d.sendEvents||d.offline?this._eventProcessor=new bs:this._eventProcessor=new Yn.internal.EventProcessor(d,p,f,new cs.default(d),this._diagnosticsManager),this._featureStore=v;const _=new Qn.default(null===(a=null===(s=d.bigSegments)||void 0===s?void 0:s.store)||void 0===a?void 0:a.call(s,p),null!==(o=d.bigSegments)&&void 0!==o?o:{},d.logger,this._platform.crypto);this._bigSegmentsManager=_,this.bigSegmentStatusProviderInternal=_.statusProvider;const y={getFlag(e,t){v.get(_s.default.Features,e,(e=>t(e)))},getSegment(e,t){v.get(_s.default.Segments,e,(e=>t(e)))},getBigSegmentsMembership:e=>_.getUserMembership(e)};this._evaluator=new ls.default(this._platform,y);const m=(0,es.createStreamListeners)(g,this._logger,{put:()=>this._initSuccess()}),b=()=>d.stream?new ns.default(p,"/all",[],m,f,this._diagnosticsManager,(e=>this._dataSourceErrorHandler(e)),this._config.streamInitialReconnectDelay):new rs.default(d,new is.default(d,this._platform.requests,f),g,(()=>this._initSuccess()),(e=>this._dataSourceErrorHandler(e)));d.offline||d.useLdd||(this._updateProcessor=null!==(c=null===(l=d.updateProcessorFactory)||void 0===l?void 0:l.call(d,p,g,(()=>this._initSuccess()),(e=>this._dataSourceErrorHandler(e))))&&void 0!==c?c:b()),this._updateProcessor&&this._updateProcessor.start()}initialized(){return this._initState===Es.Initialized}waitForInitialization(e){var t,r;return void 0===(null==e?void 0:e.timeout)&&void 0!==this._updateProcessor&&(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&&(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===Es.Initialized?(this._initializedPromise=Promise.resolve(this),this._initializedPromise):this._initState===Es.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){return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.variation",(()=>new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryDefault,(e=>{i(e.detail)}))})))).then((e=>(null==i||i(null,e.value),e.value)))}variationDetail(e,t,r,i){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)}))}))))}_typedEval(e,t,r,i,n,s){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)}))))}async boolVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.boolVariation",(e=>[Yn.TypeValidators.Boolean.is(e),Yn.TypeValidators.Boolean.getType()]))).value}async numberVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.numberVariation",(e=>[Yn.TypeValidators.Number.is(e),Yn.TypeValidators.Number.getType()]))).value}async stringVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.stringVariation",(e=>[Yn.TypeValidators.String.is(e),Yn.TypeValidators.String.getType()]))).value}jsonVariation(e,t,r){return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.jsonVariation",(()=>new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryDefault,(e=>{i(e.detail)}))})))).then((e=>e.value))}boolVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.boolVariationDetail",(e=>[Yn.TypeValidators.Boolean.is(e),Yn.TypeValidators.Boolean.getType()]))}numberVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.numberVariationDetail",(e=>[Yn.TypeValidators.Number.is(e),Yn.TypeValidators.Number.getType()]))}stringVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.stringVariationDetail",(e=>[Yn.TypeValidators.String.is(e),Yn.TypeValidators.String.getType()]))}jsonVariationDetail(e,t,r){return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.jsonVariationDetail",(()=>new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,(e=>{i(e.detail)}))}))))}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,Zn.IsMigrationStage)(t.value))i({detail:t,flag:n});else{const t=new Error(`Unrecognized MigrationState for "${e}"; returning default value.`);this._onError(t);const s={kind:"ERROR",errorKind:ms.WrongType};i({detail:{value:r,reason:s},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 vs.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){return(await this._hookRunner.withEvaluationSeriesExtraDetail(e,t,r,"LDClient.migrationVariation",(()=>this._migrationVariationInternal(e,t,r)))).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 ds.default(!1,!1).build();return null==r||r(null,e),Promise.resolve(e)}const a=Yn.Context.fromLDContext(e);return a.valid?new Promise((e=>{const i=i=>this._featureStore.all(_s.default.Features,(n=>{const s=new ds.default(i,!!(null==t?void 0:t.withReasons)),o=!!(null==t?void 0:t.clientSideOnly),l=!!(null==t?void 0:t.detailsOnlyForTrackedFlags);(0,as.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,hs.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 ds.default(!1,!1).build()))}secureModeHash(e){const t=Yn.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 Yn.LDClientError("Could not generate secure mode hash for invalid context");return i.update(r),i.digest("hex")}close(){var e;this._eventProcessor.close(),null===(e=this._updateProcessor)||void 0===e||e.close(),this._featureStore.close(),this._bigSegmentsManager.close()}isOffline(){return this._config.offline}track(e,t,r,i){var n,s;const a=Yn.Context.fromLDContext(t);a.valid?(void 0===i||Yn.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,ps.default)(e);t&&this._eventProcessor.sendEvent(t)}identify(e){var t;const r=Yn.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(os.default.forError(ms.ClientNotReady,void 0,r));const l=Yn.Context.fromLDContext(t);if(!l.valid)return this._onError(new Yn.LDClientError(`${null!==(o=l.message)&&void 0!==o?o:"Context not valid;"} returning default value.`)),void n(os.default.forError(ms.UserNotSpecified,void 0,r));this._featureStore.get(_s.default.Features,e,(t=>{const a=t;if(!a){const t=new Yn.LDClientError(`Unknown feature flag "${e}"; returning default value`);this._onError(t);const i=os.default.forError(ms.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=os.default.forError(ms.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(os.default.forError(ms.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=Es.Failed,this._rejectionReason=r,null===(t=this._initReject)||void 0===t||t.call(this,r))}_initSuccess(){var e;this.initialized()||(this._initState=Es.Initialized,null===(e=this._initResolve)||void 0===e||e.call(this,this),this._onReady())}_clientWithTimeout(e,t,r){if(t){const i=(0,Yn.cancelableTimedPromise)(t,"waitForInitialization");return Promise.race([e.then((()=>this)),i.promise.then((()=>this))]).catch((e=>{throw e instanceof Yn.LDTimeoutError&&(null==r||r.error(e.message)),e})).finally((()=>i.cancel()))}return e}};var ws={};Object.defineProperty(ws,"__esModule",{value:!0}),ws.createMigration=ws.LDMigrationError=ws.LDMigrationSuccess=void 0;const Ss=l,ks=R;ws.LDMigrationSuccess=function(e){return{success:!0,result:e}},ws.LDMigrationError=function(e){return{success:!1,error:e}};class xs{constructor(e,t){var r,i;this._client=e,this._config=t,this._readTable={[Ss.LDMigrationStage.Off]:async e=>this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),[Ss.LDMigrationStage.DualWrite]:async e=>this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),[Ss.LDMigrationStage.Shadow]:async e=>{const{fromOld:t,fromNew:r}=await this._doRead(e);return this._trackConsistency(e,t,r),t},[Ss.LDMigrationStage.Live]:async e=>{const{fromNew:t,fromOld:r}=await this._doRead(e);return this._trackConsistency(e,r,t),t},[Ss.LDMigrationStage.RampDown]:async e=>this._doSingleOp(e,"new",this._config.readNew.bind(this._config)),[Ss.LDMigrationStage.Complete]:async e=>this._doSingleOp(e,"new",this._config.readNew.bind(this._config))},this._writeTable={[Ss.LDMigrationStage.Off]:async e=>({authoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}),[Ss.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))}},[Ss.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))}},[Ss.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))}},[Ss.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))}},[Ss.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 ks.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)===ks.LDExecution.Serial){return this._execution.ordering===ks.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}}ws.createMigration=function(e,t){return new xs(e,t)};var Os={},Rs={},Ds={},Is={};Object.defineProperty(Is,"__esModule",{value:!0});Is.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(Ds,"__esModule",{value:!0});const As=re,Ps=ie,Ts=Is;Ds.default=class{constructor(e,t,r,i=()=>{},n){var s;this._featureStore=r,this._initSuccessHandler=i,this._errorHandler=n,this._allData={},this._fileLoader=new Ts.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,As.processFlag)(e.flags[t]),this._addItem(Ps.default.Features,e.flags[t])})),Object.keys(e.flagValues||{}).forEach((r=>{var i,n;const s=null===(i=t[Ps.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,As.processFlag)(o),this._addItem(Ps.default.Features,o)})),Object.keys(e.segments||{}).forEach((t=>{(0,As.processSegment)(e.segments[t]),this._addItem(Ps.default.Segments,e.segments[t])}))}},Object.defineProperty(Rs,"__esModule",{value:!0});const Ms=Ds;Rs.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 Ms.default(n,e.platform.fileSystem,t,r,i)}getFactory(){return(e,t,r,i)=>this.create(e,t,r,i)}};var Cs={},Ns={},js={},Fs={};!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}}(Fs);var $s={};Object.defineProperty($s,"__esModule",{value:!0});const Ls=o,Bs=Fs;class Vs{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 Ls.AttributeReference(t),op:"in",values:r,negate:!1}),this}andNotMatch(e,t,...r){return this._clauses.push({contextKind:e,attribute:t,attributeReference:new Ls.AttributeReference(t),op:"in",values:r,negate:!0}),this}thenReturn(e){return Ls.TypeValidators.Boolean.is(e)?(this._flagBuilder.booleanFlag(),this.thenReturn((0,Bs.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 Vs(this._flagBuilder,this._clauses,this._variation)}}$s.default=Vs,Object.defineProperty(js,"__esModule",{value:!0});const zs=o,Hs=Fs,Ks=$s;class Us{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[Hs.TRUE_VARIATION_INDEX]&&!1===this._data.variations[Hs.FALSE_VARIATION_INDEX]}booleanFlag(){return this._isBooleanFlag?this:this.variations(!0,!1).fallthroughVariation(Hs.TRUE_VARIATION_INDEX).offVariation(Hs.FALSE_VARIATION_INDEX)}variations(...e){return this._data.variations=[...e],this}on(e){return this._data.on=e,this}fallthroughVariation(e){return zs.TypeValidators.Boolean.is(e)?this.booleanFlag().fallthroughVariation((0,Hs.variationForBoolean)(e)):(this._data.fallthroughVariation=e,this)}offVariation(e){return zs.TypeValidators.Boolean.is(e)?this.booleanFlag().offVariation((0,Hs.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 zs.TypeValidators.Boolean.is(r)?this.booleanFlag().variationForContext(e,t,(0,Hs.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 Ks.default(this).andMatch(e,t,...r)}ifNotMatch(e,t,...r){return new Ks.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 Us(this._key,this._data)}getKey(){return this._key}}js.default=Us;var qs={};Object.defineProperty(qs,"__esModule",{value:!0});qs.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(Ns,"__esModule",{value:!0});const Ws=te,Gs=ke,Xs=re,Js=ie,Ys=js,Zs=qs;Ns.default=class{constructor(){this._currentFlags={},this._currentSegments={},this._dataSources=[],this._flagBuilders={}}getFactory(){return(e,t,r,i)=>{const n=(0,Ws.createStreamListeners)(t,e.basicConfiguration.logger,{put:r}),s=new Zs.default(new Gs.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 Ys.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(Js.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,Xs.processFlag)(i),this._currentFlags[t.key]=i,Promise.all(this._dataSources.map((e=>e.upsert(Js.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,Xs.processSegment)(i),this._currentSegments[t.key]=i,Promise.all(this._dataSources.map((e=>e.upsert(Js.default.Segments,i))))}},Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.TestDataRuleBuilder=Cs.TestDataFlagBuilder=Cs.TestData=void 0;const Qs=Ns;Cs.TestData=Qs.default;const ea=js;Cs.TestDataFlagBuilder=ea.default;const ta=$s;Cs.TestDataRuleBuilder=ta.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=Rs;e.FileDataSourceFactory=n.default,i(Cs,e),i(M,e)}(Os);var ra={},ia={};Object.defineProperty(ia,"__esModule",{value:!0});ia.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(ra,"__esModule",{value:!0}),ra.NullEventSource=void 0;const na=ia;ra.NullEventSource=na.default;var sa={};Object.defineProperty(sa,"__esModule",{value:!0}),sa.TtlCache=void 0;const aa=De;sa.TtlCache=aa.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=ws;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=Os,e.platform=o,i(l,e),i(Se,e),i(ra,e),i(o,e),e.internalServer=sa}(n);var oa={},la={},ca={};Object.defineProperty(ca,"__esModule",{value:!0}),ca.createCallbacks=void 0;ca.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 ha={},da=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(ha,"__esModule",{value:!0}),ha.validateOptions=void 0;ha.validateOptions=(e,t)=>{const{featureStore:r,logger:i,sendEvents:n}=t,s=da(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(ca,e),i(ua,e),i(ha,e)}(la),Object.defineProperty(oa,"__esModule",{value:!0});const fa=n,pa=la;oa.default=class extends fa.LDClientImpl{constructor(e,t,r){const i=(0,pa.createOptions)(r);super(e,t,i,(0,pa.createCallbacks)(i.logger))}initialized(){return!0}waitForInitialization(){return Promise.resolve(this)}};var va={},ga={};Object.defineProperty(ga,"__esModule",{value:!0});ga.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=ga;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}}}(va);var _a={},ya={},ma=r(e),ba={},Ea={exports:{}};var wa,Sa={exports:{}};function ka(){return wa||(wa=1,Sa.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||h).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={},h=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)}},d=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(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.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 h=0;h<l;h+=a)this._doProcessBlock(n,h);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}()),Sa.exports}var xa,Oa={exports:{}};function Ra(){return xa?Oa.exports:(xa=1,Oa.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}(ka()))}var Da,Ia={exports:{}};function Aa(){return Da||(Da=1,Ia.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}(ka())),Ia.exports}var Pa,Ta={exports:{}};function Ma(){return Pa?Ta.exports:(Pa=1,Ta.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}(ka()))}var Ca,Na={exports:{}},ja=Na.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}(ka()),Fa={exports:{}};function $a(){return Ca?Fa.exports:(Ca=1,Fa.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}(ka()))}var La,Ba={exports:{}};function Va(){return La||(La=1,Ba.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],E=e[t+10],w=e[t+11],S=e[t+12],k=e[t+13],x=e[t+14],O=e[t+15],R=s[0],D=s[1],I=s[2],A=s[3];R=c(R,D,I,A,a,7,o[0]),A=c(A,R,D,I,l,12,o[1]),I=c(I,A,R,D,f,17,o[2]),D=c(D,I,A,R,p,22,o[3]),R=c(R,D,I,A,v,7,o[4]),A=c(A,R,D,I,g,12,o[5]),I=c(I,A,R,D,_,17,o[6]),D=c(D,I,A,R,y,22,o[7]),R=c(R,D,I,A,m,7,o[8]),A=c(A,R,D,I,b,12,o[9]),I=c(I,A,R,D,E,17,o[10]),D=c(D,I,A,R,w,22,o[11]),R=c(R,D,I,A,S,7,o[12]),A=c(A,R,D,I,k,12,o[13]),I=c(I,A,R,D,x,17,o[14]),R=u(R,D=c(D,I,A,R,O,22,o[15]),I,A,l,5,o[16]),A=u(A,R,D,I,_,9,o[17]),I=u(I,A,R,D,w,14,o[18]),D=u(D,I,A,R,a,20,o[19]),R=u(R,D,I,A,g,5,o[20]),A=u(A,R,D,I,E,9,o[21]),I=u(I,A,R,D,O,14,o[22]),D=u(D,I,A,R,v,20,o[23]),R=u(R,D,I,A,b,5,o[24]),A=u(A,R,D,I,x,9,o[25]),I=u(I,A,R,D,p,14,o[26]),D=u(D,I,A,R,m,20,o[27]),R=u(R,D,I,A,k,5,o[28]),A=u(A,R,D,I,f,9,o[29]),I=u(I,A,R,D,y,14,o[30]),R=h(R,D=u(D,I,A,R,S,20,o[31]),I,A,g,4,o[32]),A=h(A,R,D,I,m,11,o[33]),I=h(I,A,R,D,w,16,o[34]),D=h(D,I,A,R,x,23,o[35]),R=h(R,D,I,A,l,4,o[36]),A=h(A,R,D,I,v,11,o[37]),I=h(I,A,R,D,y,16,o[38]),D=h(D,I,A,R,E,23,o[39]),R=h(R,D,I,A,k,4,o[40]),A=h(A,R,D,I,a,11,o[41]),I=h(I,A,R,D,p,16,o[42]),D=h(D,I,A,R,_,23,o[43]),R=h(R,D,I,A,b,4,o[44]),A=h(A,R,D,I,S,11,o[45]),I=h(I,A,R,D,O,16,o[46]),R=d(R,D=h(D,I,A,R,f,23,o[47]),I,A,a,6,o[48]),A=d(A,R,D,I,y,10,o[49]),I=d(I,A,R,D,x,15,o[50]),D=d(D,I,A,R,g,21,o[51]),R=d(R,D,I,A,S,6,o[52]),A=d(A,R,D,I,p,10,o[53]),I=d(I,A,R,D,E,15,o[54]),D=d(D,I,A,R,l,21,o[55]),R=d(R,D,I,A,m,6,o[56]),A=d(A,R,D,I,O,10,o[57]),I=d(I,A,R,D,_,15,o[58]),D=d(D,I,A,R,k,21,o[59]),R=d(R,D,I,A,v,6,o[60]),A=d(A,R,D,I,w,10,o[61]),I=d(I,A,R,D,f,15,o[62]),D=d(D,I,A,R,b,21,o[63]),s[0]=s[0]+R|0,s[1]=s[1]+D|0,s[2]=s[2]+I|0,s[3]=s[3]+A|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 h(e,t,r,i,n,s,a){var o=e+(t^r^i)+n+a;return(o<<s|o>>>32-s)+t}function d(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}(ka())),Ba.exports}var za,Ha={exports:{}};function Ka(){return za||(za=1,Ha.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 h=(i<<5|i>>>27)+l+a[c];h+=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=h}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}(ka())),Ha.exports}var Ua,qa={exports:{}};function Wa(){return Ua||(Ua=1,qa.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],h=r[6],d=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=d+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&u^~o&h)+l[f]+c[f];d=h,h=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]+h|0,r[7]=r[7]+d|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}(ka())),qa.exports}var Ga,Xa={exports:{}};var Ja,Ya={exports:{}};function Za(){return Ja||(Ja=1,Ya.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],h=r[6],d=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,E=o.high,w=o.low,S=u.high,k=u.low,x=h.high,O=h.low,R=d.high,D=d.low,I=f,A=p,P=v,T=g,M=_,C=y,N=m,j=b,F=E,$=w,L=S,B=k,V=x,z=O,H=R,K=D,U=0;U<80;U++){var q,W,G=c[U];if(U<16)W=G.high=0|e[t+2*U],q=G.low=0|e[t+2*U+1];else{var X=c[U-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[U-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[U-7],ae=se.high,oe=se.low,le=c[U-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 he,de=F&L^~F&V,fe=$&B^~$&z,pe=I&P^I&M^P&M,ve=A&T^A&C^T&C,ge=(I>>>28|A<<4)^(I<<30|A>>>2)^(I<<25|A>>>7),_e=(A>>>28|I<<4)^(A<<30|I>>>2)^(A<<25|I>>>7),ye=(F>>>14|$<<18)^(F>>>18|$<<14)^(F<<23|$>>>9),me=($>>>14|F<<18)^($>>>18|F<<14)^($<<23|F>>>9),be=l[U],Ee=be.high,we=be.low,Se=H+ye+((he=K+me)>>>0<K>>>0?1:0),ke=_e+ve;H=V,K=z,V=L,z=B,L=F,B=$,F=N+(Se=(Se=(Se=Se+de+((he+=fe)>>>0<fe>>>0?1:0))+Ee+((he+=we)>>>0<we>>>0?1:0))+W+((he+=q)>>>0<q>>>0?1:0))+(($=j+he|0)>>>0<j>>>0?1:0)|0,N=M,j=C,M=P,C=T,P=I,T=A,I=Se+(ge+pe+(ke>>>0<_e>>>0?1:0))+((A=he+ke|0)>>>0<he>>>0?1:0)|0}p=i.low=p+A,i.high=f+I+(p>>>0<A>>>0?1:0),g=n.low=g+T,n.high=v+P+(g>>>0<T>>>0?1:0),y=s.low=y+C,s.high=_+M+(y>>>0<C>>>0?1:0),b=a.low=b+j,a.high=m+N+(b>>>0<j>>>0?1:0),w=o.low=w+$,o.high=E+F+(w>>>0<$>>>0?1:0),k=u.low=k+B,u.high=S+L+(k>>>0<B>>>0?1:0),O=h.low=O+z,h.high=x+V+(O>>>0<z>>>0?1:0),D=d.low=D+K,d.high=R+H+(D>>>0<K>>>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}(ka(),Ra())),Ya.exports}var Qa,eo={exports:{}};var to,ro={exports:{}};function io(){return to||(to=1,ro.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,h=0,d=0;d<7;d++){if(1&n){var f=(1<<d)-1;f<32?h^=1<<f:o^=1<<f-32}128&n?n=n<<1^113:n<<=1}u[s]=a.create(o,h)}}();var h=[];!function(){for(var e=0;e<25;e++)h[e]=a.create()}();var d=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),(D=r[n]).high^=a,D.low^=s}for(var o=0;o<24;o++){for(var d=0;d<5;d++){for(var f=0,p=0,v=0;v<5;v++)f^=(D=r[d+5*v]).high,p^=D.low;var g=h[d];g.high=f,g.low=p}for(d=0;d<5;d++){var _=h[(d+4)%5],y=h[(d+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++)(D=r[d+5*v]).high^=f,D.low^=p}for(var E=1;E<25;E++){var w=(D=r[E]).high,S=D.low,k=l[E];k<32?(f=w<<k|S>>>32-k,p=S<<k|w>>>32-k):(f=S<<k-32|w>>>64-k,p=w<<k-32|S>>>64-k);var x=h[c[E]];x.high=f,x.low=p}var O=h[0],R=r[0];for(O.high=R.high,O.low=R.low,d=0;d<5;d++)for(v=0;v<5;v++){var D=r[E=d+5*v],I=h[E],A=h[(d+1)%5+5*v],P=h[(d+2)%5+5*v];D.high=I.high^~A.high&P.high,D.low=I.low^~A.low&P.low}D=r[0];var T=u[o];D.high^=T.high,D.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 h=a[u],d=h.high,f=h.low;d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),c.push(f),c.push(d)}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(d),r.HmacSHA3=s._createHmacHelper(d)}(Math),e.SHA3}(ka(),Ra())),ro.exports}var no,so={exports:{}};var ao,oo={exports:{}};function lo(){return ao?oo.exports:(ao=1,oo.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))}})}(ka()))}var co,uo={exports:{}};var ho,fo={exports:{}};function po(){return ho?fo.exports:(ho=1,fo.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}(ka(),Ka(),lo()))}var vo,go={exports:{}};function _o(){return vo||(vo=1,go.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 h=r.mode={},d=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=h.CBC=function(){var e=d.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)}})}()}(ka(),po())),go.exports}var yo,mo={exports:{}};function bo(){return yo?mo.exports:(yo=1,mo.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}(ka(),_o()))}var Eo,wo={exports:{}};function So(){return Eo?wo.exports:(Eo=1,wo.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}(ka(),_o()))}var ko,xo={exports:{}};function Oo(){return ko?xo.exports:(ko=1,xo.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}(ka(),_o()))}var Ro,Do={exports:{}};function Ao(){return Ro?Do.exports:(Ro=1,Do.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}(ka(),_o()))}var Io,Po={exports:{}};var To,Mo={exports:{}};var Co,No={exports:{}};var jo,$o={exports:{}};var Fo,Lo={exports:{}};var Bo,Vo={exports:{}};var zo,Ko={exports:{}};var Ho,Uo={exports:{}};var qo,Wo={exports:{}};function Go(){return qo||(qo=1,Wo.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],h=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 h=this._invSubKeys=[];for(r=0;r<16;r++)h[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],d.call(this,4,252645135),d.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),d.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 h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,d.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),d.call(this,16,65535),d.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function d(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(h);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=h.createEncryptor(i.create(t)),this._des2=h.createEncryptor(i.create(r)),this._des3=h.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}(ka(),Va(),po(),_o())),Wo.exports}var Xo,Jo={exports:{}};var Yo,Zo={exports:{}};var Qo,el={exports:{}};var tl,rl={exports:{}};function il(){return tl?rl.exports:(tl=1,rl.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 h(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 d=i.Blowfish=r.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4;h(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(d)}(),e.Blowfish}(ka(),Va(),po(),_o()))}Ea.exports=function(e){return e}(ka(),Ra(),Ia(),Ma(),Fa(),Va(),Ha(),Wa(),Ga||(Ga=1,Xa.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}(ka(),Wa())),Za(),Qa||(Qa=1,eo.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}(ka(),Ra(),Za())),io(),no||(no=1,so.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}(ka(),_o()))}var Ro,Do={exports:{}};function Io(){return Ro?Do.exports:(Ro=1,Do.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}(ka(),_o()))}var Ao,Po={exports:{}};var To,Mo={exports:{}};var Co,No={exports:{}};var jo,Fo={exports:{}};var $o,Lo={exports:{}};var Bo,Vo={exports:{}};var zo,Ho={exports:{}};var Ko,Uo={exports:{}};var qo,Wo={exports:{}};function Go(){return qo||(qo=1,Wo.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],h=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 h=this._invSubKeys=[];for(r=0;r<16;r++)h[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],d.call(this,4,252645135),d.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),d.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 h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,d.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),d.call(this,16,65535),d.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function d(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(h);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=h.createEncryptor(i.create(t)),this._des2=h.createEncryptor(i.create(r)),this._des3=h.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}(ka(),Va(),po(),_o())),Wo.exports}var Xo,Jo={exports:{}};var Yo,Zo={exports:{}};var Qo,el={exports:{}};var tl,rl={exports:{}};function il(){return tl?rl.exports:(tl=1,rl.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 h(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 d=i.Blowfish=r.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4;h(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(d)}(),e.Blowfish}(ka(),Va(),po(),_o()))}Ea.exports=function(e){return e}(ka(),Ra(),Aa(),Ma(),$a(),Va(),Ka(),Wa(),Ga||(Ga=1,Xa.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}(ka(),Wa())),Za(),Qa||(Qa=1,eo.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}(ka(),Ra(),Za())),io(),no||(no=1,so.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]),h=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=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,d,m,b,E,w,S,k,O,x,R,D=this._hash.words,A=u.words,I=h.words,P=a.words,T=o.words,M=l.words,C=c.words;for(w=s=D[0],S=d=D[1],k=m=D[2],O=b=D[3],x=E=D[4],r=0;r<80;r+=1)R=s+e[t+P[r]]|0,R+=r<16?f(d,m,b)+A[0]:r<32?p(d,m,b)+A[1]:r<48?v(d,m,b)+A[2]:r<64?g(d,m,b)+A[3]:_(d,m,b)+A[4],R=(R=y(R|=0,M[r]))+E|0,s=E,E=b,b=y(m,10),m=d,d=R,R=w+e[t+T[r]]|0,R+=r<16?_(S,k,O)+I[0]:r<32?g(S,k,O)+I[1]:r<48?v(S,k,O)+I[2]:r<64?p(S,k,O)+I[3]:f(S,k,O)+I[4],R=(R=y(R|=0,C[r]))+x|0,w=x,x=O,O=y(k,10),k=S,S=R;R=D[1]+m+O|0,D[1]=D[2]+b+x|0,D[2]=D[3]+E+w|0,D[3]=D[4]+s+S|0,D[4]=D[0]+d+k|0,D[0]=R},_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(d),t.HmacRIPEMD160=n._createHmacHelper(d)}(),e.RIPEMD160}(ka())),lo(),co||(co=1,uo.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,h=r.iterations;l.length<u;){var d=i.update(t).finalize(a);i.reset();for(var f=d.words,p=f.length,v=d,g=1;g<h;g++){v=i.finalize(v),i.reset();for(var _=v.words,y=0;y<p;y++)f[y]^=_[y]}s.concat(d),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}(ka(),Wa(),lo())),po(),_o(),bo(),So(),xo(),Ao(),Io||(Io=1,Po.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}(ka(),_o())),To||(To=1,Mo.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}(ka(),_o())),Co||(Co=1,No.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}(ka(),_o())),jo||(jo=1,$o.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}(ka(),_o())),Fo||(Fo=1,Lo.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}(ka(),_o())),Bo||(Bo=1,Vo.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(ka(),_o())),zo||(zo=1,Ko.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}(ka(),_o())),Ho||(Ho=1,Uo.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,i=t.algo,n=[],s=[],a=[],o=[],l=[],c=[],u=[],h=[],d=[],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,h[p]=y<<16|y>>>16,d[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]]^h[n[c>>>16&255]]^d[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,h,d,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],h=e[t+2]^r[2],d=e[t+3]^r[3],f=4,p=1;p<l;p++){var v=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^a[255&d]^r[f++],g=i[u>>>24]^n[h>>>16&255]^s[d>>>8&255]^a[255&c]^r[f++],_=i[h>>>24]^n[d>>>16&255]^s[c>>>8&255]^a[255&u]^r[f++],y=i[d>>>24]^n[c>>>16&255]^s[u>>>8&255]^a[255&h]^r[f++];c=v,u=g,h=_,d=y}v=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&d])^r[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[d>>>8&255]<<8|o[255&c])^r[f++],_=(o[h>>>24]<<24|o[d>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],y=(o[d>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^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}(ka(),Va(),po(),_o())),Go(),Xo||(Xo=1,Jo.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}(ka(),Va(),po(),_o())),Yo||(Yo=1,Zo.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),h=c>>>16|4294901760&u,d=u<<16|65535&c;for(n[0]^=c,n[1]^=h,n[2]^=u,n[3]^=d,n[4]^=c,n[5]^=h,n[6]^=u,n[7]^=d,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}(ka(),Va(),po(),_o())),Qo||(Qo=1,el.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),h=c>>>16|4294901760&u,d=u<<16|65535&c;for(i[0]^=c,i[1]^=h,i[2]^=u,i[3]^=d,i[4]^=c,i[5]^=h,i[6]^=u,i[7]^=d,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}(ka(),Va(),po(),_o())),il());var nl=Ea.exports,sl={exports:{}},al=sl.exports=function(e){return e.enc.Hex}(ka());Object.defineProperty(ba,"__esModule",{value:!0});const ol=nl,ll=ja,cl=al;ba.default=class{constructor(e){let t;switch(e){case"sha1":t=ol.algo.SHA1;break;case"sha256":t=ol.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=ll.default;break;case"hex":r=cl.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 hl=nl;ul.default=class{constructor(e,t){let r;switch(e){case"sha1":r=hl.algo.SHA1;break;case"sha256":r=hl.algo.SHA256;break;default:throw new Error("unsupported hash algorithm. Only sha1 and sha256 are supported.")}this._cryptoJSHmac=hl.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(ya,"__esModule",{value:!0});const dl=ma,fl=ba,pl=ul;ya.default=class{createHash(e){return new fl.default(e)}createHmac(e,t){return new pl.default(e,t)}randomUUID(){const e=new Uint32Array(1);return dl.crypto.getRandomValues(e),e.join()}};var vl={};Object.defineProperty(vl,"__esModule",{value:!0});const gl=n;class _l{constructor(){this.headers={},this.status=0}text(){return Promise.resolve("")}json(){return Promise.resolve({})}}vl.default=class{fetch(e,t={}){return Promise.resolve(new _l)}createEventSource(e,t){return new gl.NullEventSource(e,t)}getEventSourceCapabilities(){return{readTimeout:!1,headers:!1,customMethod:!1}}},Object.defineProperty(_a,"__esModule",{value:!0});const yl=ya,ml=vl;_a.default=class{constructor(e){this.crypto=new yl.default,this.requests=new ml.default,this.info=e}};var bl={};Object.defineProperty(bl,"__esModule",{value:!0});class El{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"}}}bl.default=(e,t,r)=>new El(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=oa,l=va;Object.defineProperty(e,"EdgeFeatureStore",{enumerable:!0,get:function(){return l.EdgeFeatureStore}});const c=_a,u=bl,h=la;i(n,e);e.init=e=>{var t;const{sdkKey:r,options:i={},featureStoreProvider:n,platformName:d,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,h.validateOptions)(e.sdkKey,b);const E=(0,u.default)(d,f,p);return new o.default(r,new c.default(E),b)}}(i);const wl=({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.2"});export{wl 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]),h=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=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,d,m,b,E,w,S,k,x,O,R,D=this._hash.words,I=u.words,A=h.words,P=a.words,T=o.words,M=l.words,C=c.words;for(w=s=D[0],S=d=D[1],k=m=D[2],x=b=D[3],O=E=D[4],r=0;r<80;r+=1)R=s+e[t+P[r]]|0,R+=r<16?f(d,m,b)+I[0]:r<32?p(d,m,b)+I[1]:r<48?v(d,m,b)+I[2]:r<64?g(d,m,b)+I[3]:_(d,m,b)+I[4],R=(R=y(R|=0,M[r]))+E|0,s=E,E=b,b=y(m,10),m=d,d=R,R=w+e[t+T[r]]|0,R+=r<16?_(S,k,x)+A[0]:r<32?g(S,k,x)+A[1]:r<48?v(S,k,x)+A[2]:r<64?p(S,k,x)+A[3]:f(S,k,x)+A[4],R=(R=y(R|=0,C[r]))+O|0,w=O,O=x,x=y(k,10),k=S,S=R;R=D[1]+m+x|0,D[1]=D[2]+b+O|0,D[2]=D[3]+E+w|0,D[3]=D[4]+s+S|0,D[4]=D[0]+d+k|0,D[0]=R},_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(d),t.HmacRIPEMD160=n._createHmacHelper(d)}(),e.RIPEMD160}(ka())),lo(),co||(co=1,uo.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,h=r.iterations;l.length<u;){var d=i.update(t).finalize(a);i.reset();for(var f=d.words,p=f.length,v=d,g=1;g<h;g++){v=i.finalize(v),i.reset();for(var _=v.words,y=0;y<p;y++)f[y]^=_[y]}s.concat(d),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}(ka(),Wa(),lo())),po(),_o(),bo(),So(),Oo(),Io(),Ao||(Ao=1,Po.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}(ka(),_o())),To||(To=1,Mo.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}(ka(),_o())),Co||(Co=1,No.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}(ka(),_o())),jo||(jo=1,Fo.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}(ka(),_o())),$o||($o=1,Lo.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}(ka(),_o())),Bo||(Bo=1,Vo.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(ka(),_o())),zo||(zo=1,Ho.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}(ka(),_o())),Ko||(Ko=1,Uo.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,i=t.algo,n=[],s=[],a=[],o=[],l=[],c=[],u=[],h=[],d=[],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,h[p]=y<<16|y>>>16,d[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]]^h[n[c>>>16&255]]^d[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,h,d,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],h=e[t+2]^r[2],d=e[t+3]^r[3],f=4,p=1;p<l;p++){var v=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^a[255&d]^r[f++],g=i[u>>>24]^n[h>>>16&255]^s[d>>>8&255]^a[255&c]^r[f++],_=i[h>>>24]^n[d>>>16&255]^s[c>>>8&255]^a[255&u]^r[f++],y=i[d>>>24]^n[c>>>16&255]^s[u>>>8&255]^a[255&h]^r[f++];c=v,u=g,h=_,d=y}v=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&d])^r[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[d>>>8&255]<<8|o[255&c])^r[f++],_=(o[h>>>24]<<24|o[d>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],y=(o[d>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^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}(ka(),Va(),po(),_o())),Go(),Xo||(Xo=1,Jo.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}(ka(),Va(),po(),_o())),Yo||(Yo=1,Zo.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),h=c>>>16|4294901760&u,d=u<<16|65535&c;for(n[0]^=c,n[1]^=h,n[2]^=u,n[3]^=d,n[4]^=c,n[5]^=h,n[6]^=u,n[7]^=d,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}(ka(),Va(),po(),_o())),Qo||(Qo=1,el.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),h=c>>>16|4294901760&u,d=u<<16|65535&c;for(i[0]^=c,i[1]^=h,i[2]^=u,i[3]^=d,i[4]^=c,i[5]^=h,i[6]^=u,i[7]^=d,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}(ka(),Va(),po(),_o())),il());var nl=Ea.exports,sl={exports:{}},al=sl.exports=function(e){return e.enc.Hex}(ka());Object.defineProperty(ba,"__esModule",{value:!0});const ol=nl,ll=ja,cl=al;ba.default=class{constructor(e){let t;switch(e){case"sha1":t=ol.algo.SHA1;break;case"sha256":t=ol.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=ll.default;break;case"hex":r=cl.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 hl=nl;ul.default=class{constructor(e,t){let r;switch(e){case"sha1":r=hl.algo.SHA1;break;case"sha256":r=hl.algo.SHA256;break;default:throw new Error("unsupported hash algorithm. Only sha1 and sha256 are supported.")}this._cryptoJSHmac=hl.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(ya,"__esModule",{value:!0});const dl=ma,fl=ba,pl=ul;ya.default=class{createHash(e){return new fl.default(e)}createHmac(e,t){return new pl.default(e,t)}randomUUID(){const e=new Uint32Array(1);return dl.crypto.getRandomValues(e),e.join()}};var vl={};Object.defineProperty(vl,"__esModule",{value:!0});const gl=n;class _l{constructor(){this.headers={},this.status=0}text(){return Promise.resolve("")}json(){return Promise.resolve({})}}vl.default=class{fetch(e,t={}){return Promise.resolve(new _l)}createEventSource(e,t){return new gl.NullEventSource(e,t)}getEventSourceCapabilities(){return{readTimeout:!1,headers:!1,customMethod:!1}}},Object.defineProperty(_a,"__esModule",{value:!0});const yl=ya,ml=vl;_a.default=class{constructor(e){this.crypto=new yl.default,this.requests=new ml.default,this.info=e}};var bl={};Object.defineProperty(bl,"__esModule",{value:!0});class El{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"}}}bl.default=(e,t,r)=>new El(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=oa,l=va;Object.defineProperty(e,"EdgeFeatureStore",{enumerable:!0,get:function(){return l.EdgeFeatureStore}});const c=_a,u=bl,h=la;i(n,e);e.init=e=>{var t;const{sdkKey:r,options:i={},featureStoreProvider:n,platformName:d,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,h.validateOptions)(e.sdkKey,b);const E=(0,u.default)(d,f,p);return new o.default(r,new c.default(E),b)}}(i);const wl=({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.3"});export{wl as init};
|
|
19
19
|
//# sourceMappingURL=bundle.es.js.map
|