@configdirector/openfeature-server-provider 1.11.1 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import e,{EventEmitter as t}from"node:events";import{createHash as n,randomUUID as r}from"node:crypto";import{readFile as i}from"node:fs/promises";import{resolve as a}from"node:path";import{OpenFeatureEventEmitter as o,ProviderEvents as s}from"@openfeature/server-sdk";var c=Object.create,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyNames,f=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty,m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),h=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=d(t),a=0,o=i.length,s;a<o;a++)s=i[a],!p.call(e,s)&&s!==n&&l(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=u(t,s))||r.enumerable});return e},g=(e,t,n)=>(n=e==null?{}:c(f(e)),h(t||!e||!e.__esModule?l(n,`default`,{value:e,enumerable:!0}):n,e)),_=class e extends Error{constructor(t,n){super(t),this.name=`ConfigDirectorConnectionError`,this.status=n,Object.setPrototypeOf(this,e.prototype)}},v=class e extends Error{constructor(t){super(t),this.name=`ConfigDirectorValidationError`,Object.setPrototypeOf(this,e.prototype)}},y=class e extends Error{constructor(t){super(t),this.name=`ConfigDirectorInitializationError`,Object.setPrototypeOf(this,e.prototype)}},ee=class e extends Error{constructor(t){super(t),this.name=`StreamClosedError`,Object.setPrototypeOf(this,e.prototype)}},te=class e extends Error{constructor(t){super(t),this.name=`MissingResponseBodyError`,Object.setPrototypeOf(this,e.prototype)}},ne=class e extends Error{constructor(t){super(t),this.name=`InvalidOptionError`,Object.setPrototypeOf(this,e.prototype)}},b=class e extends Error{constructor(t){super(t),this.name=`ValueOutOfRangeError`,Object.setPrototypeOf(this,e.prototype)}},re=class{constructor(e){this.isFirstChunk=!0,this.bufferedInput=``,this.currentEvent={data:``},this.currentEvent={data:``},this.onEvent=e.onEvent??(()=>{}),this.onRetry=e.onRetry,this.onComment=e.onComment}parse(e){let t=e;this.isFirstChunk&&(this.isFirstChunk=!1,t.startsWith(``)?t=t.slice(1):t.startsWith(``)&&(t=t.slice(3)));let n=this.scanLines(this.bufferedInput+t);for(let e of n)this.dispatchLine(e)}finish(){this.bufferedInput=``}scanLines(e){let t=[],n=0,r=0;for(;r<e.length;){let i=e[r];i===`\r`||i===`
1
+ import e,{EventEmitter as t}from"node:events";import{createHash as n,randomUUID as r}from"node:crypto";import{readFile as i}from"node:fs/promises";import{resolve as a}from"node:path";import{ErrorCode as o,OpenFeatureEventEmitter as s,ProviderEvents as c,ProviderNotReadyError as l,StandardResolutionReasons as u}from"@openfeature/server-sdk";var d=Object.create,f=Object.defineProperty,p=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,h=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,_=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=m(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&f(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=p(t,s))||r.enumerable});return e},y=(e,t,n)=>(n=e==null?{}:d(h(e)),v(t||!e||!e.__esModule?f(n,`default`,{value:e,enumerable:!0}):n,e)),b=class e extends Error{constructor(t,n){super(t),this.name=`ConfigDirectorConnectionError`,this.status=n,Object.setPrototypeOf(this,e.prototype)}},x=class e extends Error{constructor(t){super(t),this.name=`ConfigDirectorValidationError`,Object.setPrototypeOf(this,e.prototype)}},S=class e extends Error{constructor(t){super(t),this.name=`ConfigDirectorInitializationError`,Object.setPrototypeOf(this,e.prototype)}},ee=class e extends Error{constructor(t){super(t),this.name=`StreamClosedError`,Object.setPrototypeOf(this,e.prototype)}},te=class e extends Error{constructor(t){super(t),this.name=`MissingResponseBodyError`,Object.setPrototypeOf(this,e.prototype)}},ne=class e extends Error{constructor(t){super(t),this.name=`InvalidOptionError`,Object.setPrototypeOf(this,e.prototype)}},re=class e extends Error{constructor(t){super(t),this.name=`ValueOutOfRangeError`,Object.setPrototypeOf(this,e.prototype)}},ie=class{constructor(e){this.isFirstChunk=!0,this.bufferedInput=``,this.currentEvent={data:``},this.currentEvent={data:``},this.onEvent=e.onEvent??(()=>{}),this.onRetry=e.onRetry,this.onComment=e.onComment}parse(e){let t=e;this.isFirstChunk&&(this.isFirstChunk=!1,t.startsWith(``)?t=t.slice(1):t.startsWith(``)&&(t=t.slice(3)));let n=this.scanLines(this.bufferedInput+t);for(let e of n)this.dispatchLine(e)}finish(){this.bufferedInput=``}scanLines(e){let t=[],n=0,r=0;for(;r<e.length;){let i=e[r];i===`\r`||i===`
2
2
  `?(t.push(e.slice(n,r)),i===`\r`&&e[r+1]===`
3
3
  `&&r++,r++,n=r):r++}return this.bufferedInput=e.slice(n),t}dispatchLine(e){if(e.startsWith(`:`)){this.onComment?.(this.extractValue(e,1));return}if(e===``){this.emitEvent();return}this.applyField(this.parseField(e))}emitEvent(){let e=this.currentEvent.data.endsWith(`
4
4
  `)?this.currentEvent.data.slice(0,-1):this.currentEvent.data;e!==``&&this.onEvent({...this.currentEvent,id:this.lastEventId,data:e}),this.currentEvent={data:``}}applyField(e){switch(e.field){case`event`:this.currentEvent.type=e.value;break;case`data`:this.currentEvent.data+=e.value+`
5
- `;break;case`id`:e.value.includes(`\0`)||(this.lastEventId=e.value);break;case`retry`:/^\d+$/.test(e.value)&&this.onRetry?.(Number.parseInt(e.value,10));break;default:break}}parseField(e){let t=e.indexOf(`:`);return t===-1?{field:e,value:``}:{field:e.slice(0,t),value:this.extractValue(e,t+1)}}extractValue(e,t){return e[t]===` `?e.slice(t+1):e.slice(t)}};let x=function(e){return e.OPEN=`open`,e.CLOSED=`closed`,e.CONNECTING=`connecting`,e}({});var ie=class{constructor(e){this.DEFAULT_SHOULD_RECONNECT=()=>!0,this.DEFAULT_CALCULATE_RECONNECT_DELAY=()=>this.serverReconnectionTime,this.reconnectAttempt=0,this.abortController=new AbortController,this._readyState=x.CLOSED,this.serverReconnectionTime=2e3,this.url=e.url.toString(),this.lastEventId=e.lastEventId,this.headers={Accept:`text/event-stream`,...e.headers};let t=e.body;this.body=typeof t==`function`?t:()=>t,this.requestOptions={method:e.method??`GET`,mode:e.mode,credentials:e.credentials,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy},this._fetch=e.fetch??((e,t)=>fetch(e,t)),this._onError=this.resolveCallback(e.onError,()=>{},`onError`),this._onConnect=this.resolveCallback(e.onConnect,()=>{},`onConnect`),this._onDisconnect=this.resolveCallback(e.onDisconnect,()=>{},`onDisconnect`),this._onMessage=this.resolveCallback(e.onMessage,()=>{},`onMessage`),this._onComment=this.resolveCallback(e.onComment,()=>{},`onComment`),this._shouldReconnect=this.resolveCallback(e.shouldReconnect,this.DEFAULT_SHOULD_RECONNECT,`shouldReconnect`),this._calculateReconnectDelay=this.resolveCallback(e.calculateReconnectDelay,this.DEFAULT_CALCULATE_RECONNECT_DELAY,`calculateReconnectDelay`)}set onError(e){this._onError=this.resolveCallback(e,()=>{},`onError`)}set onMessage(e){this._onMessage=this.resolveCallback(e,()=>{},`onMessage`)}set onComment(e){this._onComment=this.resolveCallback(e,()=>{},`onComment`)}set onConnect(e){this._onConnect=this.resolveCallback(e,()=>{},`onConnect`)}set onDisconnect(e){this._onDisconnect=this.resolveCallback(e,()=>{},`onDisconnect`)}set shouldReconnect(e){this._shouldReconnect=this.resolveCallback(e,this.DEFAULT_SHOULD_RECONNECT,`shouldReconnect`)}set calculateReconnectDelay(e){this._calculateReconnectDelay=this.resolveCallback(e,this.DEFAULT_CALCULATE_RECONNECT_DELAY,`shouldReconnect`)}get readyState(){return this._readyState}connect(){this._readyState===x.CLOSED&&(this.reconnectAttempt=0,this.initiateConnection())}close(){clearTimeout(this.reconnectTimeout),this._readyState=x.CLOSED,this.abortController.abort()}initiateConnection(){this.abortController=new AbortController,this._readyState=x.CONNECTING,this._fetch(this.url,{...this.requestOptions,body:this.body(),headers:this.buildRequestHeaders(),signal:this.abortController.signal,cache:`no-store`}).then(e=>this.handleFetchResponse(e)).catch(e=>{if(e.name===`AbortError`||this.abortController.signal.aborted){this.close();return}this._onError(e),this.scheduleReconnect({error:e})})}async handleFetchResponse(e){let{body:t,status:n}=e;if(n===204){this.disconnected();return}if(n>=400){this.scheduleReconnect({status:n});return}if(!t)throw new te(`The server response did not have a body`);this._readyState=x.OPEN,this._onConnect(),this.reconnectAttempt=0;let r=new re({onEvent:e=>{typeof e.id==`string`&&(this.lastEventId=e.id),this._onMessage(e)},onComment:e=>this._onComment(e),onRetry:e=>this.serverReconnectionTime=e});await this.readResponseStream(t,r),this.scheduleReconnect({status:n,error:new ee(`The server response stream was closed`)})}async readResponseStream(e,t){let n=e.getReader(),r=new TextDecoder,i=!1;for(;!i;){let e=await n.read();e.value&&t.parse(r.decode(e.value,{stream:!0})),i=e.done}t.finish()}disconnected(){clearTimeout(this.reconnectTimeout),this._readyState=x.CLOSED,this._onDisconnect()}buildRequestHeaders(){let e=this.lastEventId?{"Last-Event-ID":this.lastEventId}:void 0;return{...this.headers,...e}}scheduleReconnect(e){if(this.abortController.signal.aborted)return;clearTimeout(this.reconnectTimeout),this.reconnectAttempt+=1;let t={attempt:this.reconnectAttempt,status:e.status,error:e.error,serverReconnectionTime:this.serverReconnectionTime};if(!this._shouldReconnect(t)){this.disconnected();return}this._readyState=x.CONNECTING;let n=this._calculateReconnectDelay(t);(!Number.isFinite(n)||n<1||n>1e3*60*60)&&(this._onError(new b(`The calculated reconnect delay is out of range: ${n}. Defaulting to ${this.serverReconnectionTime}`)),n=this.serverReconnectionTime),this.reconnectTimeout=setTimeout(()=>this.initiateConnection(),n)}resolveCallback(e,t,n){if(e==null)return t;if(typeof e!=`function`)throw new ne(`${n} must be a function`);return e}};const ae=e=>new ie(e),oe=async(e,t,n,r)=>{let i=new AbortController,a=setTimeout(()=>{r.debug(`[fetchWithTimeout] Reached timeout, aborting request`),i.abort()},e);try{let e=await fetch(typeof t==`string`||t instanceof Request?t:t.toString(),{...n,signal:i.signal});return clearTimeout(a),e}catch(e){throw r.warn(`[fetchWithTimeout] Fetch error: `,e),clearTimeout(a),e}},se=9e4;var ce=class{constructor(e){this.options=e,this.eventEmitter=new t,this.options=e,this.logger=e.logger,this.url=new URL(`server/sse/v1`,e.baseUrl),this.heartbeatUrl=new URL(`server/heartbeat/v1`,e.baseUrl)}async connect(e){this.eventSource&&this.close();let t=new Promise((e,t)=>{this.eventSource=ae({url:this.url,method:`POST`,headers:{"Content-Type":`application/json`},body:()=>this.buildRequestBody(),onMessage:({data:e})=>{this.dispatchMessage(e)},onConnect:()=>{this.logger.debug(`[StreamingTransport] Connected`),e(this)},shouldReconnect:e=>{let n=!this.isStatusFatal(e.status);if(!n){this.stopHeartbeat();let n=this.prepareFatalError(e.status,e.error);this.eventEmitter.emit(`connectionError`,n),t(n)}return n},calculateReconnectDelay:e=>{let t=2**Math.min(e.attempt,9)*1e3,n=`[StreamingTransport] Scheduling reconnect attempt #${e.attempt} in ${t}ms.`;return e.attempt<=5?this.logger.info(n):this.logger.warn(n),t},onDisconnect:()=>{this.logger.debug(`[StreamingTransport] Disconnected`)}}),this.eventSource.connect()});this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),se);let n;try{return await Promise.race([t,new Promise(t=>{n=setTimeout(()=>t(this),e)})])}finally{clearTimeout(n)}}get sessionId(){return this._sessionId}sendHeartbeat(){!this.isConnected||!this._sessionId||oe(se,this.heartbeatUrl,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({serverSdkKey:this.options.serverSdkKey,sessionId:this._sessionId})},this.logger).then(e=>{e.ok||this.logger.debug(`[StreamingTransport] Heartbeat failed with status: ${e.status}`)}).catch(e=>{this.logger.debug(`[StreamingTransport] Heartbeat failed: `,e)})}buildRequestBody(){return this._sessionId=r(),JSON.stringify({metaContext:this.options.metaContext,serverSdkKey:this.options.serverSdkKey,sessionId:this._sessionId})}dispatchMessage(e){try{let t=JSON.parse(e);this.eventEmitter.emit(`configBundleReceived`,t)}catch(e){this.logger.error(`[StreamingTransport] Error parsing and dispatching config data update: `,e)}}prepareFatalError(e,t){let n=e??0;return new _(`${`Connection failed with status: ${e??`unknown`}.`}${t?` Error: ${t}.`:``} This is an unrecoverable error, will not attempt to reconnect.`,n)}isStatusFatal(e){return!!e&&e>=400&&e<500&&e!=429}get isConnected(){return this.eventSource?.readyState==`open`}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}clear(){this.eventEmitter.removeAllListeners()}stopHeartbeat(){clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0}close(){this.stopHeartbeat(),this.eventSource?.close()}dispose(){this.close(),this.clear()}},le=class{constructor(){this.fatalError=!1}clearPollingInterval(){clearInterval(this.pollingInterval)}schedulePollingInterval(e){clearInterval(this.pollingInterval),!(this.pollingIntervalSeconds<=0)&&(this.pollingInterval=setInterval(e,this.pollingIntervalSeconds*1e3))}async handleNonOkResponse(e){if(!e.ok)throw this.isStatusFatal(e.status)?(this.fatalError=!0,this.close(),this.prepareFatalResponseStatusError(e.status,await e.text())):new _(`Connection failed with status: ${e.status}`,e.status)}handleFetchError(e){throw this.isFetchErrorFatal(e)?(this.fatalError=!0,this.close(),new _(`Connection failed with fatal error: ${e}. This is an unrecoverable error, retry attempts will be ignored.`)):e instanceof SyntaxError?new _(`Failed to parse the response from the server: ${e}`):new _(`Connection failed with error: ${e}.`)}prepareFatalResponseStatusError(e,t){let n=e??0;return new _(`${`Connection failed with status: ${e??`unknown`}`}${(t?.trim()?.length??0)>0?` (${t})`:``}. This is an unrecoverable error, retry attempts will be ignored.`,n)}isStatusFatal(e){return!!e&&e>=400&&e<500&&e!=429}isFetchErrorFatal(e){return e?.name===`NotAllowedError`}get isConnected(){return this.pollingInterval!==void 0}close(){clearInterval(this.pollingInterval),this.pollingInterval=void 0}dispose(){this.close(),this.clear()}},ue=class extends le{constructor(e){super(),this.options=e,this.eventEmitter=new t,this._sessionId=r(),this.options=e,this.logger=e.logger,this.url=new URL(`server/polling/v1`,e.baseUrl),this.pollingIntervalSeconds=e.pollingInterval??300}async connect(e){this.clearPollingInterval();try{await this.fetchConfigs(e)}finally{this.fatalError||this.schedulePollingInterval(()=>{this.fetchConfigs(e).catch(e=>{this.logger.error(`[PollingTransport] Error during polling:`,e)})})}return this}get sessionId(){return this._sessionId}async fetchConfigs(e){if(this.fatalError){this.logger.warn(`[PollingTransport] There was a prior unrecoverable error. Ignoring attempt to reconnect.`);return}try{let t=await oe(e,this.url,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({metaContext:this.options.metaContext,serverSdkKey:this.options.serverSdkKey,lastUpdateTimestamp:this.lastUpdateTimestamp,sessionId:this._sessionId})},this.logger);if(await this.handleNonOkResponse(t),t.status===200){let e=JSON.parse(await t.text());this.lastUpdateTimestamp=e.timestamp,this.eventEmitter.emit(`configBundleReceived`,e)}}catch(e){try{this.handleFetchError(e)}catch(e){throw this.fatalError&&this.eventEmitter.emit(`connectionError`,e),e}}}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}clear(){this.eventEmitter.removeAllListeners()}};const de=(e,t)=>{if(e.trim().length==0)throw new v(`Invalid config key. The key of a value cannot be empty.`);return fe(e,t)},fe=(e,t)=>{switch(typeof t){case`boolean`:return{type:`boolean`,value:t?`true`:`false`};case`number`:return pe(e,t);case`string`:return{type:`string`,value:t};case`object`:if(t!==null)return he(e,t,``),{type:`json`,value:JSON.stringify(t)}}throw new v(`Invalid value for '${e}': ${ve(t)}. Use a boolean, a number, a string, a plain object, or an array.`)},pe=(e,t)=>{if(!Number.isFinite(t))throw new v(`Invalid value for '${e}': ${ve(t)} is not a finite number.`);if(Number.isInteger(t)){if(!Number.isSafeInteger(t))throw new v(`Invalid value for '${e}': ${t} is not a safe integer, so the SDK could not read it back exactly.`);return{type:`integer`,value:String(t)}}return{type:`float`,value:me(t)}},me=e=>{let t=String(e),n=t.indexOf(`e-`);if(n<0)return t;let r=t.startsWith(`-`)?`-`:``,[i=``,a=``]=t.slice(r.length,n).split(`.`),o=Number(t.slice(n+2))-i.length;return`${r}0.${`0`.repeat(o)}${i}${a}`},he=(e,t,n)=>{if(!(t===null||typeof t==`boolean`||typeof t==`string`)){if(typeof t==`number`){if(!Number.isFinite(t))throw ge(e,n,`${ve(t)} is not a finite number`);return}if(Array.isArray(t)){t.forEach((t,r)=>he(e,t,`${n}[${r}]`));return}if(_e(t)){for(let[r,i]of Object.entries(t))he(e,i,n?`${n}.${r}`:r);return}throw ge(e,n,`${ve(t)} cannot be encoded as JSON`)}},ge=(e,t,n)=>new v(`Invalid value for '${e}'${t?` at '${t}'`:``}: ${n}. JSON contents can hold booleans, finite numbers, strings, null, arrays, and plain objects.`),_e=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},ve=e=>e===null?`null`:typeof e==`function`?`a function`:typeof e==`object`?`a ${e.constructor?.name??`object`} instance`:typeof e==`symbol`?`a symbol`:String(e),ye=(e,t,n)=>{let r=de(t,n);return{id:e,key:t,type:r.type,variations:[{name:null,value:r.value}],target:{defaultValue:r.value,rules:[]}}},be={environmentId:`offline`,projectId:`offline`};var xe=class{constructor(t){this.source=t,this.emitter=new e,this.connected=!1}async connect(){let e=await Se(this.source);return this.connected=!0,this.emitter.emit(`configBundleReceived`,{...be,kind:`full`,configs:e}),this}get isConnected(){return this.connected}on(e,t){this.emitter.on(e,t)}off(e,t){t?this.emitter.off(e,t):this.emitter.removeAllListeners(e)}close(){this.connected=!1}dispose(){this.close(),this.emitter.removeAllListeners()}};const Se=async e=>{switch(e.kind){case`in-code-defaults`:return{};case`values`:return we(e.values,`The offline values`);case`file`:return we(await Ce(e.path),`The offline values file '${e.path}'`);case`rejected`:throw new y(e.message)}},Ce=async e=>{let t;try{t=await i(a(e),`utf8`)}catch(t){throw new y(`The offline values file '${e}' could not be read: ${De(t)}`)}let n;try{n=JSON.parse(t)}catch(t){throw new y(`The offline values file '${e}' is not valid JSON: ${De(t)}`)}if(!Te(n))throw new y(`The offline values file '${e}' must hold a JSON object with one value per config key, but holds ${Ee(n)}.`);return n},we=(e,t)=>{try{return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,ye(`offline:${e}`,e,t)]))}catch(e){throw e instanceof v?new y(`${t} could not be loaded. ${e.message}`):e}},Te=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ee=e=>e===null?`null`:Array.isArray(e)?`an array`:`a ${typeof e}`,De=e=>e instanceof Error?e.message:String(e),Oe=new URL(`https://server-sdk-api.configdirector.com`),ke=(e,t)=>{if(t?.mode===`offline`)return{kind:`stay-offline`,source:je(t)};let n=t?.mode??`streaming`;if(!e||e.trim().length==0)throw new v(`No server SDK key was provided, the client cannot be instantiated without a valid server SDK key`);return t?.file!==void 0||t?.values!==void 0?{kind:`stay-offline`,source:{kind:`rejected`,message:`The connection options 'file' and 'values' apply only when the connection mode is 'offline', but the mode is '${n}'.`}}:{kind:`connect`,mode:n,serverSdkKey:e,baseUrl:Ae(t?.url)}},Ae=e=>{if(!e)return Oe;try{return new URL(e)}catch(t){throw new v(`Invalid base URL '${e}'. Parsing failed: ${t}`)}},je=e=>e.file!==void 0&&e.values!==void 0?{kind:`rejected`,message:`An offline connection takes either 'file' or 'values', not both.`}:e.file===void 0?e.values===void 0?{kind:`in-code-defaults`}:{kind:`values`,values:e.values}:{kind:`file`,path:e.file},Me=/^(?:0|[1-9][0-9]*)$/,Ne=/~(?![01])/,Pe=Object.prototype.propertyIsEnumerable,Fe=e=>{if(!Ne.test(e))return e.replace(/~1/g,`/`).replace(/~0/g,`~`)},Ie=(e,t)=>{if(Array.isArray(e))return Me.test(t)&&Pe.call(e,t)?e[Number(t)]:void 0;if(typeof e==`object`&&e)return Pe.call(e,t)?e[t]:void 0},Le=(e,t)=>{if(e===``)return t;if(!e.startsWith(`/`))return;let n=t;for(let t of e.slice(1).split(`/`)){let e=Fe(t);if(e===void 0||(n=Ie(n,e),n===void 0))return}return n},Re=(e,t,n)=>{let r=n[0];switch(t.toLowerCase()){case`=`:case`equals`:return r!==void 0&&e===r;case`!=`:case`does not equal`:return r!==void 0&&e!==r;case`is one of`:return n.includes(e);case`is not one of`:return!n.includes(e);case`starts with any of`:return n.some(t=>e.startsWith(t));case`does not start with any of`:return!n.some(t=>e.startsWith(t));case`ends with any of`:return n.some(t=>e.endsWith(t));case`does not end with any of`:return!n.some(t=>e.endsWith(t));default:return!1}},ze=(e,t,n)=>{let r=t.toLowerCase(),i=Be(e);if(i===void 0)return r===`!=`||r===`does not equal`;let a=n[0];if(a===void 0)return!1;let o=Be(a);if(o===void 0)return!1;switch(r){case`=`:case`equals`:return i===o;case`!=`:case`does not equal`:return i!==o;case`<`:return i<o;case`<=`:return i<=o;case`>`:return i>o;case`>=`:return i>=o;default:return!1}},Be=e=>{if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e!=`string`||e.length===0||!Ve(e))return;let t=Number(e);return Number.isFinite(t)?t:void 0},Ve=e=>{for(let t of e)if(!(t>=`0`&&t<=`9`)&&!`+-.eE`.includes(t))return!1;return!0};var S=class extends Error{},He=class extends S{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Ue=class extends S{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},We=class extends S{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Ge=class extends S{},Ke=class extends S{constructor(e){super(`Invalid unit ${e}`)}},C=class extends S{},w=class extends S{constructor(){super(`Zone is an abstract class`)}};const T=`numeric`,E=`short`,D=`long`,qe={year:T,month:T,day:T},Je={year:T,month:E,day:T},Ye={year:T,month:E,day:T,weekday:E},Xe={year:T,month:D,day:T},Ze={year:T,month:D,day:T,weekday:D},Qe={hour:T,minute:T},$e={hour:T,minute:T,second:T},et={hour:T,minute:T,second:T,timeZoneName:E},tt={hour:T,minute:T,second:T,timeZoneName:D},nt={hour:T,minute:T,hourCycle:`h23`},rt={hour:T,minute:T,second:T,hourCycle:`h23`},it={hour:T,minute:T,second:T,hourCycle:`h23`,timeZoneName:E},at={hour:T,minute:T,second:T,hourCycle:`h23`,timeZoneName:D},ot={year:T,month:T,day:T,hour:T,minute:T},st={year:T,month:T,day:T,hour:T,minute:T,second:T},ct={year:T,month:E,day:T,hour:T,minute:T},lt={year:T,month:E,day:T,hour:T,minute:T,second:T},ut={year:T,month:E,day:T,weekday:E,hour:T,minute:T},dt={year:T,month:D,day:T,hour:T,minute:T,timeZoneName:E},ft={year:T,month:D,day:T,hour:T,minute:T,second:T,timeZoneName:E},pt={year:T,month:D,day:T,weekday:D,hour:T,minute:T,timeZoneName:D},mt={year:T,month:D,day:T,weekday:D,hour:T,minute:T,second:T,timeZoneName:D};var ht=class{get type(){throw new w}get name(){throw new w}get ianaName(){return this.name}get isUniversal(){throw new w}offsetName(e,t){throw new w}formatOffset(e,t){throw new w}offset(e){throw new w}equals(e){throw new w}get isValid(){throw new w}};let gt=null;var _t=class e extends ht{static get instance(){return gt===null&&(gt=new e),gt}get type(){return`system`}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return qn(e,t,n)}formatOffset(e,t){return Zn(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type===`system`}get isValid(){return!0}};const vt=new Map;function yt(e){let t=vt.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(`en-US`,{hour12:!1,timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,era:`short`}),vt.set(e,t)),t}const bt={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function xt(e,t){let n=e.format(t).replace(/\u200E/g,``),[,r,i,a,o,s,c,l]=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n);return[a,r,i,o,s,c,l]}function St(e,t){let n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){let{type:t,value:i}=n[e],a=bt[t];t===`era`?r[a]=i:F(a)||(r[a]=parseInt(i,10))}return r}const Ct=new Map;var wt=class e extends ht{static create(t){let n=Ct.get(t);return n===void 0&&Ct.set(t,n=new e(t)),n}static resetCache(){Ct.clear(),vt.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e}).format(),!0}catch{return!1}}constructor(t){super(),this.zoneName=t,this.valid=e.isValidZone(t)}get type(){return`iana`}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return qn(e,t,n,this.name)}formatOffset(e,t){return Zn(this.offset(e),t)}offset(e){if(!this.valid)return NaN;let t=new Date(e);if(isNaN(t))return NaN;let n=yt(this.name),[r,i,a,o,s,c,l]=n.formatToParts?St(n,t):xt(n,t);o===`BC`&&(r=-Math.abs(r)+1);let u=Un({year:r,month:i,day:a,hour:s===24?0:s,minute:c,second:l,millisecond:0}),d=+t,f=d%1e3;return d-=f>=0?f:1e3+f,(u-d)/(60*1e3)}equals(e){return e.type===`iana`&&e.name===this.name}get isValid(){return this.valid}};let Tt={};function Et(e,t={}){let n=JSON.stringify([e,t]),r=Tt[n];return r||(r=new Intl.ListFormat(e,t),Tt[n]=r),r}const Dt=new Map;function Ot(e,t={}){let n=JSON.stringify([e,t]),r=Dt.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,t),Dt.set(n,r)),r}const kt=new Map;function At(e,t={}){let n=JSON.stringify([e,t]),r=kt.get(n);return r===void 0&&(r=new Intl.NumberFormat(e,t),kt.set(n,r)),r}const jt=new Map;function Mt(e,t={}){let{base:n,...r}=t,i=JSON.stringify([e,r]),a=jt.get(i);return a===void 0&&(a=new Intl.RelativeTimeFormat(e,t),jt.set(i,a)),a}let Nt=null;function Pt(){return Nt||(Nt=new Intl.DateTimeFormat().resolvedOptions().locale,Nt)}const Ft=new Map;function It(e){let t=Ft.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),Ft.set(e,t)),t}const Lt=new Map;function Rt(e){let t=Lt.get(e);if(!t){let n=new Intl.Locale(e);t=`getWeekInfo`in n?n.getWeekInfo():n.weekInfo,`minimalDays`in t||(t={...Jt,...t}),Lt.set(e,t)}return t}function zt(e){let t=e.indexOf(`-x-`);t!==-1&&(e=e.substring(0,t));let n=e.indexOf(`-u-`);if(n===-1)return[e];{let t,r;try{t=Ot(e).resolvedOptions(),r=e}catch{let i=e.substring(0,n);t=Ot(i).resolvedOptions(),r=i}let{numberingSystem:i,calendar:a}=t;return[r,i,a]}}function Bt(e,t,n){return n||t?(e.includes(`-u-`)||(e+=`-u`),n&&(e+=`-ca-${n}`),t&&(e+=`-nu-${t}`),e):e}function Vt(e){let t=[];for(let n=1;n<=12;n++){let r=Y.utc(2009,n,1);t.push(e(r))}return t}function Ht(e){let t=[];for(let n=1;n<=7;n++){let r=Y.utc(2016,11,13+n);t.push(e(r))}return t}function Ut(e,t,n,r){let i=e.listingMode();return i===`error`?null:i===`en`?n(t):r(t)}function Wt(e){return e.numberingSystem&&e.numberingSystem!==`latn`?!1:e.numberingSystem===`latn`||!e.locale||e.locale.startsWith(`en`)||It(e.locale).numberingSystem===`latn`}var Gt=class{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:r,floor:i,...a}=n;if(!t||Object.keys(a).length>0){let t={useGrouping:!1,...n};n.padTo>0&&(t.minimumIntegerDigits=n.padTo),this.inf=At(e,t)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else return R(this.floor?Math.floor(e):zn(e,3),this.padTo)}},Kt=class{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type===`fixed`){let t=-1*(e.offset/60),n=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;e.offset!==0&&wt.create(n).valid?(r=n,this.dt=e):(r=`UTC`,this.dt=e.offset===0?e:e.setZone(`UTC`).plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type===`system`?this.dt=e:e.zone.type===`iana`?(this.dt=e,r=e.zone.name):(r=`UTC`,this.dt=e.setZone(`UTC`).plus({minutes:e.offset}),this.originalZone=e.zone);let i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=Ot(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(``):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if(e.type===`timeZoneName`){let t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}else return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},qt=class{constructor(e,t,n){this.opts={style:`long`,...n},!t&&An()&&(this.rtf=Mt(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):gr(t,e,this.opts.numeric,this.opts.style!==`long`)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}};const Jt={firstDay:1,minimalDays:4,weekend:[6,7]};var O=class e{static fromOpts(t){return e.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,n,r,i,a=!1){let o=t||M.defaultLocale;return new e(o||(a?`en-US`:Pt()),n||M.defaultNumberingSystem,r||M.defaultOutputCalendar,In(i)||M.defaultWeekSettings,o)}static resetCache(){Nt=null,Dt.clear(),kt.clear(),jt.clear(),Ft.clear(),Lt.clear()}static fromObject({locale:t,numberingSystem:n,outputCalendar:r,weekSettings:i}={}){return e.create(t,n,r,i)}constructor(e,t,n,r,i){let[a,o,s]=zt(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=n||s||null,this.weekSettings=r,this.intl=Bt(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached??(this.fastNumbersCached=Wt(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem===`latn`)&&(this.outputCalendar===null||this.outputCalendar===`gregory`);return e&&t?`en`:`intl`}clone(t){return!t||Object.getOwnPropertyNames(t).length===0?this:e.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,In(t.weekSettings)||this.weekSettings,t.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Ut(this,e,nr,()=>{let n=this.intl===`ja`||this.intl.startsWith(`ja-`);t&=!n;let r=t?{month:e,day:`numeric`}:{month:e},i=t?`format`:`standalone`;if(!this.monthsCache[i][e]){let t=n?e=>this.dtFormatter(e,r).format():e=>this.extract(e,r,`month`);this.monthsCache[i][e]=Vt(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return Ut(this,e,or,()=>{let n=t?{weekday:e,year:`numeric`,month:`long`,day:`numeric`}:{weekday:e},r=t?`format`:`standalone`;return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=Ht(e=>this.extract(e,n,`weekday`))),this.weekdaysCache[r][e]})}meridiems(){return Ut(this,void 0,()=>sr,()=>{if(!this.meridiemCache){let e={hour:`numeric`,hourCycle:`h12`};this.meridiemCache=[Y.utc(2016,11,13,9),Y.utc(2016,11,13,19)].map(t=>this.extract(t,e,`dayperiod`))}return this.meridiemCache})}eras(e){return Ut(this,e,dr,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[Y.utc(-40,1,1),Y.utc(2017,1,1)].map(e=>this.extract(e,t,`era`))),this.eraCache[e]})}extract(e,t,n){let r=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===n);return r?r.value:null}numberFormatter(e={}){return new Gt(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Kt(e,this.intl,t)}relFormatter(e={}){return new qt(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Et(this.intl,e)}isEnglish(){return this.locale===`en`||this.locale.toLowerCase()===`en-us`||It(this.intl).locale.startsWith(`en-us`)}getWeekSettings(){return this.weekSettings?this.weekSettings:jn()?Rt(this.locale):Jt}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}};let Yt=null;var k=class e extends ht{static get utcInstance(){return Yt===null&&(Yt=new e(0)),Yt}static instance(t){return t===0?e.utcInstance:new e(t)}static parseSpecifier(t){if(t){let n=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new e(Jn(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return`fixed`}get name(){return this.fixed===0?`UTC`:`UTC${Zn(this.fixed,`narrow`)}`}get ianaName(){return this.fixed===0?`Etc/UTC`:`Etc/GMT${Zn(-this.fixed,`narrow`)}`}offsetName(){return this.name}formatOffset(e,t){return Zn(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type===`fixed`&&e.fixed===this.fixed}get isValid(){return!0}},Xt=class extends ht{constructor(e){super(),this.zoneName=e}get type(){return`invalid`}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return``}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function A(e,t){if(F(e)||e===null)return t;if(e instanceof ht)return e;if(On(e)){let n=e.toLowerCase();return n===`default`?t:n===`local`||n===`system`?_t.instance:n===`utc`||n===`gmt`?k.utcInstance:k.parseSpecifier(n)||wt.create(e)}else if(I(e))return k.instance(e);else if(typeof e==`object`&&`offset`in e&&typeof e.offset==`function`)return e;else return new Xt(e)}const Zt={arab:`[٠-٩]`,arabext:`[۰-۹]`,bali:`[᭐-᭙]`,beng:`[০-৯]`,deva:`[०-९]`,fullwide:`[0-9]`,gujr:`[૦-૯]`,hanidec:`[〇|一|二|三|四|五|六|七|八|九]`,khmr:`[០-៩]`,knda:`[೦-೯]`,laoo:`[໐-໙]`,limb:`[᥆-᥏]`,mlym:`[൦-൯]`,mong:`[᠐-᠙]`,mymr:`[၀-၉]`,orya:`[୦-୯]`,tamldec:`[௦-௯]`,telu:`[౦-౯]`,thai:`[๐-๙]`,tibt:`[༠-༩]`,latn:`\\d`},Qt={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},$t=Zt.hanidec.replace(/[\[|\]]/g,``).split(``);function en(e){let t=parseInt(e,10);if(isNaN(t)){t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(e[n].search(Zt.hanidec)!==-1)t+=$t.indexOf(e[n]);else for(let e in Qt){let[n,i]=Qt[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}else return t}const tn=new Map;function nn(){tn.clear()}function j({numberingSystem:e},t=``){let n=e||`latn`,r=tn.get(n);r===void 0&&(r=new Map,tn.set(n,r));let i=r.get(t);return i===void 0&&(i=RegExp(`${Zt[n]}${t}`),r.set(t,i)),i}let rn=()=>Date.now(),an=`system`,on=null,sn=null,cn=null,ln=60,un,dn=null;var M=class{static get now(){return rn}static set now(e){rn=e}static set defaultZone(e){an=e}static get defaultZone(){return A(an,_t.instance)}static get defaultLocale(){return on}static set defaultLocale(e){on=e}static get defaultNumberingSystem(){return sn}static set defaultNumberingSystem(e){sn=e}static get defaultOutputCalendar(){return cn}static set defaultOutputCalendar(e){cn=e}static get defaultWeekSettings(){return dn}static set defaultWeekSettings(e){dn=In(e)}static get twoDigitCutoffYear(){return ln}static set twoDigitCutoffYear(e){ln=e%100}static get throwOnInvalid(){return un}static set throwOnInvalid(e){un=e}static resetCaches(){O.resetCache(),wt.resetCache(),Y.resetCache(),nn()}},N=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};const fn=[0,31,59,90,120,151,181,212,243,273,304,334],pn=[0,31,60,91,121,152,182,213,244,274,305,335];function P(e,t){return new N(`unit out of range`,`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function mn(e,t,n){let r=new Date(Date.UTC(e,t-1,n));e<100&&e>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let i=r.getUTCDay();return i===0?7:i}function hn(e,t,n){return n+(Bn(e)?pn:fn)[t-1]}function gn(e,t){let n=Bn(e)?pn:fn,r=n.findIndex(e=>e<t),i=t-n[r];return{month:r+1,day:i}}function _n(e,t){return(e-t+7)%7+1}function vn(e,t=4,n=1){let{year:r,month:i,day:a}=e,o=hn(r,i,a),s=_n(mn(r,i,a),n),c=Math.floor((o-s+14-t)/7),l;return c<1?(l=r-1,c=Gn(l,t,n)):c>Gn(r,t,n)?(l=r+1,c=1):l=r,{weekYear:l,weekNumber:c,weekday:s,...Qn(e)}}function yn(e,t=4,n=1){let{weekYear:r,weekNumber:i,weekday:a}=e,o=_n(mn(r,1,t),n),s=Vn(r),c=i*7+a-o-7+t,l;c<1?(l=r-1,c+=Vn(l)):c>s?(l=r+1,c-=Vn(r)):l=r;let{month:u,day:d}=gn(l,c);return{year:l,month:u,day:d,...Qn(e)}}function bn(e){let{year:t,month:n,day:r}=e;return{year:t,ordinal:hn(t,n,r),...Qn(e)}}function xn(e){let{year:t,ordinal:n}=e,{month:r,day:i}=gn(t,n);return{year:t,month:r,day:i,...Qn(e)}}function Sn(e,t){if(!F(e.localWeekday)||!F(e.localWeekNumber)||!F(e.localWeekYear)){if(!F(e.weekday)||!F(e.weekNumber)||!F(e.weekYear))throw new Ge(`Cannot mix locale-based week fields with ISO-based week fields`);return F(e.localWeekday)||(e.weekday=e.localWeekday),F(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),F(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Cn(e,t=4,n=1){let r=Dn(e.weekYear),i=L(e.weekNumber,1,Gn(e.weekYear,t,n)),a=L(e.weekday,1,7);return r?i?a?!1:P(`weekday`,e.weekday):P(`week`,e.weekNumber):P(`weekYear`,e.weekYear)}function wn(e){let t=Dn(e.year),n=L(e.ordinal,1,Vn(e.year));return t?n?!1:P(`ordinal`,e.ordinal):P(`year`,e.year)}function Tn(e){let t=Dn(e.year),n=L(e.month,1,12),r=L(e.day,1,Hn(e.year,e.month));return t?n?r?!1:P(`day`,e.day):P(`month`,e.month):P(`year`,e.year)}function En(e){let{hour:t,minute:n,second:r,millisecond:i}=e,a=L(t,0,23)||t===24&&n===0&&r===0&&i===0,o=L(n,0,59),s=L(r,0,59),c=L(i,0,999);return a?o?s?c?!1:P(`millisecond`,i):P(`second`,r):P(`minute`,n):P(`hour`,t)}function F(e){return e===void 0}function I(e){return typeof e==`number`}function Dn(e){return typeof e==`number`&&e%1==0}function On(e){return typeof e==`string`}function kn(e){return Object.prototype.toString.call(e)===`[object Date]`}function An(){try{return typeof Intl<`u`&&!!Intl.RelativeTimeFormat}catch{return!1}}function jn(){try{return typeof Intl<`u`&&!!Intl.Locale&&(`weekInfo`in Intl.Locale.prototype||`getWeekInfo`in Intl.Locale.prototype)}catch{return!1}}function Mn(e){return Array.isArray(e)?e:[e]}function Nn(e,t,n){if(e.length!==0)return e.reduce((e,r)=>{let i=[t(r),r];return e&&n(e[0],i[0])===e[0]?e:i},null)[1]}function Pn(e,t){return t.reduce((t,n)=>(t[n]=e[n],t),{})}function Fn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function In(e){if(e==null)return null;if(typeof e!=`object`)throw new C(`Week settings must be an object`);if(!L(e.firstDay,1,7)||!L(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!L(e,1,7)))throw new C(`Invalid week settings`);return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function L(e,t,n){return Dn(e)&&e>=t&&e<=n}function Ln(e,t){return e-t*Math.floor(e/t)}function R(e,t=2){let n=e<0,r;return r=n?`-`+(``+-e).padStart(t,`0`):(``+e).padStart(t,`0`),r}function z(e){if(!(F(e)||e===null||e===``))return parseInt(e,10)}function B(e){if(!(F(e)||e===null||e===``))return parseFloat(e)}function Rn(e){if(!(F(e)||e===null||e===``)){let t=parseFloat(`0.`+e)*1e3;return Math.floor(t)}}function zn(e,t,n=`round`){let r=10**t;switch(n){case`expand`:return e>0?Math.ceil(e*r)/r:Math.floor(e*r)/r;case`trunc`:return Math.trunc(e*r)/r;case`round`:return Math.round(e*r)/r;case`floor`:return Math.floor(e*r)/r;case`ceil`:return Math.ceil(e*r)/r;default:throw RangeError(`Value rounding ${n} is out of range`)}}function Bn(e){return e%4==0&&(e%100!=0||e%400==0)}function Vn(e){return Bn(e)?366:365}function Hn(e,t){let n=Ln(t-1,12)+1,r=e+(t-n)/12;return n===2?Bn(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Un(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Wn(e,t,n){return-_n(mn(e,1,t),n)+t-1}function Gn(e,t=4,n=1){let r=Wn(e,t,n),i=Wn(e+1,t,n);return(Vn(e)-r+i)/7}function Kn(e){return e>99?e:e>M.twoDigitCutoffYear?1900+e:2e3+e}function qn(e,t,n,r=null){let i=new Date(e),a={hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`};r&&(a.timeZone=r);let o={timeZoneName:t,...a},s=new Intl.DateTimeFormat(n,o).formatToParts(i).find(e=>e.type.toLowerCase()===`timezonename`);return s?s.value:null}function Jn(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);let r=parseInt(t,10)||0,i=n<0||Object.is(n,-0)?-r:r;return n*60+i}function Yn(e){let t=Number(e);if(typeof e==`boolean`||e===``||!Number.isFinite(t))throw new C(`Invalid unit value ${e}`);return t}function Xn(e,t){let n={};for(let r in e)if(Fn(e,r)){let i=e[r];if(i==null)continue;n[t(r)]=Yn(i)}return n}function Zn(e,t){let n=Math.trunc(Math.abs(e/60)),r=Math.trunc(Math.abs(e%60)),i=e>=0?`+`:`-`;switch(t){case`short`:return`${i}${R(n,2)}:${R(r,2)}`;case`narrow`:return`${i}${n}${r>0?`:${r}`:``}`;case`techie`:return`${i}${R(n,2)}${R(r,2)}`;default:throw RangeError(`Value format ${t} is out of range for property format`)}}function Qn(e){return Pn(e,[`hour`,`minute`,`second`,`millisecond`])}const $n=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],er=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],tr=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`];function nr(e){switch(e){case`narrow`:return[...tr];case`short`:return[...er];case`long`:return[...$n];case`numeric`:return[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`,`12`];case`2-digit`:return[`01`,`02`,`03`,`04`,`05`,`06`,`07`,`08`,`09`,`10`,`11`,`12`];default:return null}}const rr=[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],ir=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],ar=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function or(e){switch(e){case`narrow`:return[...ar];case`short`:return[...ir];case`long`:return[...rr];case`numeric`:return[`1`,`2`,`3`,`4`,`5`,`6`,`7`];default:return null}}const sr=[`AM`,`PM`],cr=[`Before Christ`,`Anno Domini`],lr=[`BC`,`AD`],ur=[`B`,`A`];function dr(e){switch(e){case`narrow`:return[...ur];case`short`:return[...lr];case`long`:return[...cr];default:return null}}function fr(e){return sr[e.hour<12?0:1]}function pr(e,t){return or(t)[e.weekday-1]}function mr(e,t){return nr(t)[e.month-1]}function hr(e,t){return dr(t)[e.year<0?0:1]}function gr(e,t,n=`always`,r=!1){let i={years:[`year`,`yr.`],quarters:[`quarter`,`qtr.`],months:[`month`,`mo.`],weeks:[`week`,`wk.`],days:[`day`,`day`,`days`],hours:[`hour`,`hr.`],minutes:[`minute`,`min.`],seconds:[`second`,`sec.`]},a=[`hours`,`minutes`,`seconds`].indexOf(e)===-1;if(n===`auto`&&a){let n=e===`days`;switch(t){case 1:return n?`tomorrow`:`next ${i[e][0]}`;case-1:return n?`yesterday`:`last ${i[e][0]}`;case 0:return n?`today`:`this ${i[e][0]}`}}let o=Object.is(t,-0)||t<0,s=Math.abs(t),c=s===1,l=i[e],u=r?c?l[1]:l[2]||l[1]:c?i[e][0]:e;return o?`${s} ${u} ago`:`in ${s} ${u}`}function _r(e,t){let n=``;for(let r of e)r.literal?n+=r.val:n+=t(r.val);return n}const vr={D:qe,DD:Je,DDD:Xe,DDDD:Ze,t:Qe,tt:$e,ttt:et,tttt:tt,T:nt,TT:rt,TTT:it,TTTT:at,f:ot,ff:ct,fff:dt,ffff:pt,F:st,FF:lt,FFF:ft,FFFF:mt};var V=class e{static create(t,n={}){return new e(t,n)}static parseFormat(e){let t=null,n=``,r=!1,i=[];for(let a=0;a<e.length;a++){let o=e.charAt(a);o===`'`?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:n===``?`'`:n}),t=null,n=``,r=!r):r||o===t?n+=o:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=o,t=o)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return vr[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n=void 0){if(this.opts.forceSimple)return R(e,t);let r={...this.opts};return t>0&&(r.padTo=t),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(t,n){let r=this.loc.listingMode()===`en`,i=this.loc.outputCalendar&&this.loc.outputCalendar!==`gregory`,a=(e,n)=>this.loc.extract(t,e,n),o=e=>t.isOffsetFixed&&t.offset===0&&e.allowZ?`Z`:t.isValid?t.zone.formatOffset(t.ts,e.format):``,s=()=>r?fr(t):a({hour:`numeric`,hourCycle:`h12`},`dayperiod`),c=(e,n)=>r?mr(t,e):a(n?{month:e}:{month:e,day:`numeric`},`month`),l=(e,n)=>r?pr(t,e):a(n?{weekday:e}:{weekday:e,month:`long`,day:`numeric`},`weekday`),u=n=>{let r=e.macroTokenToFormatOpts(n);return r?this.formatWithSystemDefault(t,r):n},d=e=>r?hr(t,e):a({era:e},`era`);return _r(e.parseFormat(n),e=>{switch(e){case`S`:return this.num(t.millisecond);case`u`:case`SSS`:return this.num(t.millisecond,3);case`s`:return this.num(t.second);case`ss`:return this.num(t.second,2);case`uu`:return this.num(Math.floor(t.millisecond/10),2);case`uuu`:return this.num(Math.floor(t.millisecond/100));case`m`:return this.num(t.minute);case`mm`:return this.num(t.minute,2);case`h`:return this.num(t.hour%12==0?12:t.hour%12);case`hh`:return this.num(t.hour%12==0?12:t.hour%12,2);case`H`:return this.num(t.hour);case`HH`:return this.num(t.hour,2);case`Z`:return o({format:`narrow`,allowZ:this.opts.allowZ});case`ZZ`:return o({format:`short`,allowZ:this.opts.allowZ});case`ZZZ`:return o({format:`techie`,allowZ:this.opts.allowZ});case`ZZZZ`:return t.zone.offsetName(t.ts,{format:`short`,locale:this.loc.locale});case`ZZZZZ`:return t.zone.offsetName(t.ts,{format:`long`,locale:this.loc.locale});case`z`:return t.zoneName;case`a`:return s();case`d`:return i?a({day:`numeric`},`day`):this.num(t.day);case`dd`:return i?a({day:`2-digit`},`day`):this.num(t.day,2);case`c`:return this.num(t.weekday);case`ccc`:return l(`short`,!0);case`cccc`:return l(`long`,!0);case`ccccc`:return l(`narrow`,!0);case`E`:return this.num(t.weekday);case`EEE`:return l(`short`,!1);case`EEEE`:return l(`long`,!1);case`EEEEE`:return l(`narrow`,!1);case`L`:return i?a({month:`numeric`,day:`numeric`},`month`):this.num(t.month);case`LL`:return i?a({month:`2-digit`,day:`numeric`},`month`):this.num(t.month,2);case`LLL`:return c(`short`,!0);case`LLLL`:return c(`long`,!0);case`LLLLL`:return c(`narrow`,!0);case`M`:return i?a({month:`numeric`},`month`):this.num(t.month);case`MM`:return i?a({month:`2-digit`},`month`):this.num(t.month,2);case`MMM`:return c(`short`,!1);case`MMMM`:return c(`long`,!1);case`MMMMM`:return c(`narrow`,!1);case`y`:return i?a({year:`numeric`},`year`):this.num(t.year);case`yy`:return i?a({year:`2-digit`},`year`):this.num(t.year.toString().slice(-2),2);case`yyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,4);case`yyyyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,6);case`G`:return d(`short`);case`GG`:return d(`long`);case`GGGGG`:return d(`narrow`);case`kk`:return this.num(t.weekYear.toString().slice(-2),2);case`kkkk`:return this.num(t.weekYear,4);case`W`:return this.num(t.weekNumber);case`WW`:return this.num(t.weekNumber,2);case`n`:return this.num(t.localWeekNumber);case`nn`:return this.num(t.localWeekNumber,2);case`ii`:return this.num(t.localWeekYear.toString().slice(-2),2);case`iiii`:return this.num(t.localWeekYear,4);case`o`:return this.num(t.ordinal);case`ooo`:return this.num(t.ordinal,3);case`q`:return this.num(t.quarter);case`qq`:return this.num(t.quarter,2);case`X`:return this.num(Math.floor(t.ts/1e3));case`x`:return this.num(t.ts);default:return u(e)}})}formatDurationFromString(t,n){let r=this.opts.signMode===`negativeLargestOnly`?-1:1,i=e=>{switch(e[0]){case`S`:return`milliseconds`;case`s`:return`seconds`;case`m`:return`minutes`;case`h`:return`hours`;case`d`:return`days`;case`w`:return`weeks`;case`M`:return`months`;case`y`:return`years`;default:return null}},a=(e,t)=>n=>{let a=i(n);if(a){let i=t.isNegativeDuration&&a!==t.largestUnit?r:1,o;return o=this.opts.signMode===`negativeLargestOnly`&&a!==t.largestUnit?`never`:this.opts.signMode===`all`?`always`:`auto`,this.num(e.get(a)*i,n.length,o)}else return n},o=e.parseFormat(n),s=o.reduce((e,{literal:t,val:n})=>t?e:e.concat(n),[]),c=t.shiftTo(...s.map(i).filter(e=>e));return _r(o,a(c,{isNegativeDuration:c<0,largestUnit:Object.keys(c.values)[0]}))}};const yr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function br(...e){let t=e.reduce((e,t)=>e+t.source,``);return RegExp(`^${t}$`)}function xr(...e){return t=>e.reduce(([e,n,r],i)=>{let[a,o,s]=i(t,r);return[{...e,...a},o||n,s]},[{},null,1]).slice(0,2)}function Sr(e,...t){if(e==null)return[null,null];for(let[n,r]of t){let t=n.exec(e);if(t)return r(t)}return[null,null]}function Cr(...e){return(t,n)=>{let r={},i;for(i=0;i<e.length;i++)r[e[i]]=z(t[n+i]);return[r,null,n+i]}}const wr=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Tr=`(?:${wr.source}?(?:\\[(${yr.source})\\])?)?`,Er=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Dr=RegExp(`${Er.source}${Tr}`),Or=RegExp(`(?:[Tt]${Dr.source})?`),kr=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Ar=/(\d{4})-?W(\d\d)(?:-?(\d))?/,jr=/(\d{4})-?(\d{3})/,Mr=Cr(`weekYear`,`weekNumber`,`weekDay`),Nr=Cr(`year`,`ordinal`),Pr=/(\d{4})-(\d\d)-(\d\d)/,Fr=RegExp(`${Er.source} ?(?:${wr.source}|(${yr.source}))?`),Ir=RegExp(`(?: ${Fr.source})?`);function Lr(e,t,n){let r=e[t];return F(r)?n:z(r)}function Rr(e,t){return[{year:Lr(e,t),month:Lr(e,t+1,1),day:Lr(e,t+2,1)},null,t+3]}function zr(e,t){return[{hours:Lr(e,t,0),minutes:Lr(e,t+1,0),seconds:Lr(e,t+2,0),milliseconds:Rn(e[t+3])},null,t+4]}function Br(e,t){let n=!e[t]&&!e[t+1],r=Jn(e[t+1],e[t+2]);return[{},n?null:k.instance(r),t+3]}function Vr(e,t){return[{},e[t]?wt.create(e[t]):null,t+1]}const Hr=RegExp(`^T?${Er.source}$`),Ur=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Wr(e){let[t,n,r,i,a,o,s,c,l]=e,u=t[0]===`-`,d=c&&c[0]===`-`,f=(e,t=!1)=>e!==void 0&&(t||e&&u)?-e:e;return[{years:f(B(n)),months:f(B(r)),weeks:f(B(i)),days:f(B(a)),hours:f(B(o)),minutes:f(B(s)),seconds:f(B(c),c===`-0`),milliseconds:f(Rn(l),d)}]}const Gr={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Kr(e,t,n,r,i,a,o){let s={year:t.length===2?Kn(z(t)):z(t),month:er.indexOf(n)+1,day:z(r),hour:z(i),minute:z(a)};return o&&(s.second=z(o)),e&&(s.weekday=e.length>3?rr.indexOf(e)+1:ir.indexOf(e)+1),s}const qr=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Jr(e){let[,t,n,r,i,a,o,s,c,l,u,d]=e,f=Kr(t,i,r,n,a,o,s),p;return p=c?Gr[c]:l?0:Jn(u,d),[f,new k(p)]}function Yr(e){return e.replace(/\([^()]*\)|[\n\t]/g,` `).replace(/(\s\s+)/g,` `).trim()}const Xr=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Zr=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Qr=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function $r(e){let[,t,n,r,i,a,o,s]=e;return[Kr(t,i,r,n,a,o,s),k.utcInstance]}function ei(e){let[,t,n,r,i,a,o,s]=e;return[Kr(t,s,n,r,i,a,o),k.utcInstance]}const ti=br(kr,Or),ni=br(Ar,Or),ri=br(jr,Or),ii=br(Dr),ai=xr(Rr,zr,Br,Vr),oi=xr(Mr,zr,Br,Vr),si=xr(Nr,zr,Br,Vr),ci=xr(zr,Br,Vr);function li(e){return Sr(e,[ti,ai],[ni,oi],[ri,si],[ii,ci])}function ui(e){return Sr(Yr(e),[qr,Jr])}function di(e){return Sr(e,[Xr,$r],[Zr,$r],[Qr,ei])}function fi(e){return Sr(e,[Ur,Wr])}const pi=xr(zr);function mi(e){return Sr(e,[Hr,pi])}const hi=br(Pr,Ir),gi=br(Fr),_i=xr(zr,Br,Vr);function vi(e){return Sr(e,[hi,ai],[gi,_i])}const yi=`Invalid Duration`,bi={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},xi={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...bi},H=146097/400,Si=146097/4800,Ci={years:{quarters:4,months:12,weeks:H/7,days:H,hours:H*24,minutes:H*24*60,seconds:H*24*60*60,milliseconds:H*24*60*60*1e3},quarters:{months:3,weeks:H/28,days:H/4,hours:H*24/4,minutes:H*24*60/4,seconds:H*24*60*60/4,milliseconds:H*24*60*60*1e3/4},months:{weeks:Si/7,days:Si,hours:Si*24,minutes:Si*24*60,seconds:Si*24*60*60,milliseconds:Si*24*60*60*1e3},...bi},U=[`years`,`quarters`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`,`milliseconds`],wi=U.slice(0).reverse();function W(e,t,n=!1){return new G({values:n?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix})}function Ti(e,t){let n=t.milliseconds??0;for(let r of wi.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function Ei(e,t){let n=Ti(e,t)<0?-1:1;U.reduceRight((r,i)=>{if(F(t[i]))return r;if(r){let a=t[r]*n,o=e[i][r],s=Math.floor(a/o);t[i]+=s*n,t[r]-=s*o*n}return i},null),U.reduce((n,r)=>{if(F(t[r]))return n;if(n){let i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function Di(e){let t={};for(let[n,r]of Object.entries(e))r!==0&&(t[n]=r);return t}var G=class e{constructor(e){let t=e.conversionAccuracy===`longterm`||!1,n=t?Ci:xi;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||O.create(),this.conversionAccuracy=t?`longterm`:`casual`,this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,n){return e.fromObject({milliseconds:t},n)}static fromObject(t,n={}){if(typeof t!=`object`||!t)throw new C(`Duration.fromObject: argument expected to be an object, got ${t===null?`null`:typeof t}`);return new e({values:Xn(t,e.normalizeUnit),loc:O.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(t){if(I(t))return e.fromMillis(t);if(e.isDuration(t))return t;if(typeof t==`object`)return e.fromObject(t);throw new C(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,n){let[r]=fi(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,n){let[r]=mi(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,n=null){if(!t)throw new C(`need to specify a reason the Duration is invalid`);let r=t instanceof N?t:new N(t,n);if(M.throwOnInvalid)throw new We(r);return new e({invalid:r})}static normalizeUnit(e){let t={year:`years`,years:`years`,quarter:`quarters`,quarters:`quarters`,month:`months`,months:`months`,week:`weeks`,weeks:`weeks`,day:`days`,days:`days`,hour:`hours`,hours:`hours`,minute:`minutes`,minutes:`minutes`,second:`seconds`,seconds:`seconds`,millisecond:`milliseconds`,milliseconds:`milliseconds`}[e&&e.toLowerCase()];if(!t)throw new Ke(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){let n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?V.create(this.loc,n).formatDurationFromString(this,e):yi}toHuman(e={}){if(!this.isValid)return yi;let t=e.showZeros!==!1,n=U.map(n=>{let r=this.values[n];return F(r)||r===0&&!t?null:this.loc.numberFormatter({style:`unit`,unitDisplay:`long`,...e,unit:n.slice(0,-1)}).format(r)}).filter(e=>e);return this.loc.listFormatter({type:`conjunction`,style:e.listStyle||`narrow`,...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e=`P`;return this.years!==0&&(e+=this.years+`Y`),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+`M`),this.weeks!==0&&(e+=this.weeks+`W`),this.days!==0&&(e+=this.days+`D`),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+=`T`),this.hours!==0&&(e+=this.hours+`H`),this.minutes!==0&&(e+=this.minutes+`M`),(this.seconds!==0||this.milliseconds!==0)&&(e+=zn(this.seconds+this.milliseconds/1e3,3)+`S`),e===`P`&&(e+=`T0S`),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:`extended`,...e,includeOffset:!1},Y.fromMillis(t,{zone:`UTC`}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Ti(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t),r={};for(let e of U)(Fn(n.values,e)||Fn(this.values,e))&&(r[e]=n.get(e)+this.get(e));return W(this,{values:r},!0)}minus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let n of Object.keys(this.values))t[n]=Yn(e(this.values[n],n));return W(this,{values:t},!0)}get(t){return this[e.normalizeUnit(t)]}set(t){if(!this.isValid)return this;let n={...this.values,...Xn(t,e.normalizeUnit)};return W(this,{values:n})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){let i={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:n};return W(this,i)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return Ei(this.matrix,e),W(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Di(this.normalize().shiftToAll().toObject());return W(this,{values:e},!0)}shiftTo(...t){if(!this.isValid||t.length===0)return this;t=t.map(t=>e.normalizeUnit(t));let n={},r={},i=this.toObject(),a;for(let e of U)if(t.indexOf(e)>=0){a=e;let t=0;for(let n in r)t+=this.matrix[n][e]*r[n],r[n]=0;I(i[e])&&(t+=i[e]);let o=Math.trunc(t);n[e]=o,r[e]=(t*1e3-o*1e3)/1e3}else I(i[e])&&(r[e]=i[e]);for(let e in r)r[e]!==0&&(n[a]+=e===a?r[e]:r[e]/this.matrix[a][e]);return Ei(this.matrix,n),W(this,{values:n},!0)}shiftToAll(){return this.isValid?this.shiftTo(`years`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`,`milliseconds`):this}negate(){if(!this.isValid)return this;let e={};for(let t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return W(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=Di(this.values);return W(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(e,t){return e===void 0||e===0?t===void 0||t===0:e===t}for(let n of U)if(!t(this.values[n],e.values[n]))return!1;return!0}};const Oi=`Invalid Interval`;function ki(e,t){return!e||!e.isValid?Ai.invalid(`missing or invalid start`):!t||!t.isValid?Ai.invalid(`missing or invalid end`):t<e?Ai.invalid(`end before start`,`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null}var Ai=class e{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(t,n=null){if(!t)throw new C(`need to specify a reason the Interval is invalid`);let r=t instanceof N?t:new N(t,n);if(M.throwOnInvalid)throw new Ue(r);return new e({invalid:r})}static fromDateTimes(t,n){let r=ka(t),i=ka(n);return ki(r,i)??new e({start:r,end:i})}static after(t,n){let r=G.fromDurationLike(n),i=ka(t);return e.fromDateTimes(i,i.plus(r))}static before(t,n){let r=G.fromDurationLike(n),i=ka(t);return e.fromDateTimes(i.minus(r),i)}static fromISO(t,n){let[r,i]=(t||``).split(`/`,2);if(r&&i){let t,a;try{t=Y.fromISO(r,n),a=t.isValid}catch{a=!1}let o,s;try{o=Y.fromISO(i,n),s=o.isValid}catch{s=!1}if(a&&s)return e.fromDateTimes(t,o);if(a){let r=G.fromISO(i,n);if(r.isValid)return e.after(t,r)}else if(s){let t=G.fromISO(r,n);if(t.isValid)return e.before(o,t)}}return e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e=`milliseconds`){return this.isValid?this.toDuration(e).get(e):NaN}count(e=`milliseconds`,t){if(!this.isValid)return NaN;let n=this.start.startOf(e,t),r;return r=t?.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(e,t),Math.floor(r.diff(n,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:t,end:n}={}){return this.isValid?e.fromDateTimes(t||this.s,n||this.e):this}splitAt(...t){if(!this.isValid)return[];let n=t.map(ka).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),r=[],{s:i}=this,a=0;for(;i<this.e;){let t=n[a]||this.e,o=+t>+this.e?this.e:t;r.push(e.fromDateTimes(i,o)),i=o,a+=1}return r}splitBy(t){let n=G.fromDurationLike(t);if(!this.isValid||!n.isValid||n.as(`milliseconds`)===0)return[];let{s:r}=this,i=1,a,o=[];for(;r<this.e;){let t=this.start.plus(n.mapUnits(e=>e*i));a=+t>+this.e?this.e:t,o.push(e.fromDateTimes(r,a)),r=a,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(t){if(!this.isValid)return this;let n=this.s>t.s?this.s:t.s,r=this.e<t.e?this.e:t.e;return n>=r?null:e.fromDateTimes(n,r)}union(t){if(!this.isValid)return this;let n=this.s<t.s?this.s:t.s,r=this.e>t.e?this.e:t.e;return e.fromDateTimes(n,r)}static merge(e){let[t,n]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],n)=>t?t.overlaps(n)||t.abutsStart(n)?[e,t.union(n)]:[e.concat([t]),n]:[e,n],[[],null]);return n&&t.push(n),t}static xor(t){let n=null,r=0,i=[],a=t.map(e=>[{time:e.s,type:`s`},{time:e.e,type:`e`}]),o=Array.prototype.concat(...a).sort((e,t)=>e.time-t.time);for(let t of o)r+=t.type===`s`?1:-1,r===1?n=t.time:(n&&+n!=+t.time&&i.push(e.fromDateTimes(n,t.time)),n=null);return e.merge(i)}difference(...t){return e.xor([this].concat(t)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Oi}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=qe,t={}){return this.isValid?V.create(this.s.loc.clone(t),e).formatInterval(this):Oi}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Oi}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Oi}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Oi}toFormat(e,{separator:t=` – `}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Oi}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):G.invalid(this.invalidReason)}mapEndpoints(t){return e.fromDateTimes(t(this.s),t(this.e))}},ji=class{static hasDST(e=M.defaultZone){let t=Y.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return wt.isValidZone(e)}static normalizeZone(e){return A(e,M.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||O.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||O.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||O.create(e)).getWeekendDays().slice()}static months(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||O.create(t,n,i)).months(e)}static monthsFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||O.create(t,n,i)).months(e,!0)}static weekdays(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||O.create(t,n,null)).weekdays(e)}static weekdaysFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||O.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return O.create(e).meridiems()}static eras(e=`short`,{locale:t=null}={}){return O.create(t,null,`gregory`).eras(e)}static features(){return{relative:An(),localeWeek:jn()}}};function Mi(e,t){let n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf(`day`).valueOf(),r=n(t)-n(e);return Math.floor(G.fromMillis(r).as(`days`))}function Ni(e,t,n){let r=[[`years`,(e,t)=>t.year-e.year],[`quarters`,(e,t)=>t.quarter-e.quarter+(t.year-e.year)*4],[`months`,(e,t)=>t.month-e.month+(t.year-e.year)*12],[`weeks`,(e,t)=>{let n=Mi(e,t);return(n-n%7)/7}],[`days`,Mi]],i={},a=e,o,s;for(let[c,l]of r)n.indexOf(c)>=0&&(o=c,i[c]=l(e,t),s=a.plus(i),s>t?(i[c]--,e=a.plus(i),e>t&&(s=e,i[c]--,e=a.plus(i))):e=s);return[e,i,s,o]}function Pi(e,t,n,r){let[i,a,o,s]=Ni(e,t,n),c=t-i,l=n.filter(e=>[`hours`,`minutes`,`seconds`,`milliseconds`].indexOf(e)>=0);l.length===0&&(o<t&&(o=i.plus({[s]:1})),o!==i&&(a[s]=(a[s]||0)+c/(o-i)));let u=G.fromObject(a,r);return l.length>0?G.fromMillis(c,r).shiftTo(...l).plus(u):u}function K(e,t=e=>e){return{regex:e,deser:([e])=>t(en(e))}}const Fi=`[ \xA0]`,Ii=new RegExp(Fi,`g`);function Li(e){return e.replace(/\./g,`\\.?`).replace(Ii,Fi)}function Ri(e){return e.replace(/\./g,``).replace(Ii,` `).toLowerCase()}function q(e,t){return e===null?null:{regex:RegExp(e.map(Li).join(`|`)),deser:([n])=>e.findIndex(e=>Ri(n)===Ri(e))+t}}function zi(e,t){return{regex:e,deser:([,e,t])=>Jn(e,t),groups:t}}function Bi(e){return{regex:e,deser:([e])=>e}}function Vi(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,`\\$&`)}function Hi(e,t){let n=j(t),r=j(t,`{2}`),i=j(t,`{3}`),a=j(t,`{4}`),o=j(t,`{6}`),s=j(t,`{1,2}`),c=j(t,`{1,3}`),l=j(t,`{1,6}`),u=j(t,`{1,9}`),d=j(t,`{2,4}`),f=j(t,`{4,6}`),p=e=>({regex:RegExp(Vi(e.val)),deser:([e])=>e,literal:!0}),m=(m=>{if(e.literal)return p(m);switch(m.val){case`G`:return q(t.eras(`short`),0);case`GG`:return q(t.eras(`long`),0);case`y`:return K(l);case`yy`:return K(d,Kn);case`yyyy`:return K(a);case`yyyyy`:return K(f);case`yyyyyy`:return K(o);case`M`:return K(s);case`MM`:return K(r);case`MMM`:return q(t.months(`short`,!0),1);case`MMMM`:return q(t.months(`long`,!0),1);case`L`:return K(s);case`LL`:return K(r);case`LLL`:return q(t.months(`short`,!1),1);case`LLLL`:return q(t.months(`long`,!1),1);case`d`:return K(s);case`dd`:return K(r);case`o`:return K(c);case`ooo`:return K(i);case`HH`:return K(r);case`H`:return K(s);case`hh`:return K(r);case`h`:return K(s);case`mm`:return K(r);case`m`:return K(s);case`q`:return K(s);case`qq`:return K(r);case`s`:return K(s);case`ss`:return K(r);case`S`:return K(c);case`SSS`:return K(i);case`u`:return Bi(u);case`uu`:return Bi(s);case`uuu`:return K(n);case`a`:return q(t.meridiems(),0);case`kkkk`:return K(a);case`kk`:return K(d,Kn);case`W`:return K(s);case`WW`:return K(r);case`E`:case`c`:return K(n);case`EEE`:return q(t.weekdays(`short`,!1),1);case`EEEE`:return q(t.weekdays(`long`,!1),1);case`ccc`:return q(t.weekdays(`short`,!0),1);case`cccc`:return q(t.weekdays(`long`,!0),1);case`Z`:case`ZZ`:return zi(RegExp(`([+-]${s.source})(?::(${r.source}))?`),2);case`ZZZ`:return zi(RegExp(`([+-]${s.source})(${r.source})?`),2);case`z`:return Bi(/[a-z_+-/]{1,256}?/i);case` `:return Bi(/[^\S\n\r]/);default:return p(m)}})(e)||{invalidReason:`missing Intl.DateTimeFormat.formatToParts support`};return m.token=e,m}const Ui={year:{"2-digit":`yy`,numeric:`yyyyy`},month:{numeric:`M`,"2-digit":`MM`,short:`MMM`,long:`MMMM`},day:{numeric:`d`,"2-digit":`dd`},weekday:{short:`EEE`,long:`EEEE`},dayperiod:`a`,dayPeriod:`a`,hour12:{numeric:`h`,"2-digit":`hh`},hour24:{numeric:`H`,"2-digit":`HH`},minute:{numeric:`m`,"2-digit":`mm`},second:{numeric:`s`,"2-digit":`ss`},timeZoneName:{long:`ZZZZZ`,short:`ZZZ`}};function Wi(e,t,n){let{type:r,value:i}=e;if(r===`literal`){let e=/^\s+$/.test(i);return{literal:!e,val:e?` `:i}}let a=t[r],o=r;r===`hour`&&(o=t.hour12==null?t.hourCycle==null?n.hour12?`hour12`:`hour24`:t.hourCycle===`h11`||t.hourCycle===`h12`?`hour12`:`hour24`:t.hour12?`hour12`:`hour24`);let s=Ui[o];if(typeof s==`object`&&(s=s[a]),s)return{literal:!1,val:s}}function Gi(e){return[`^${e.map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,``)}$`,e]}function Ki(e,t,n){let r=e.match(t);if(r){let e={},t=1;for(let i in n)if(Fn(n,i)){let a=n[i],o=a.groups?a.groups+1:1;!a.literal&&a.token&&(e[a.token.val[0]]=a.deser(r.slice(t,t+o))),t+=o}return[r,e]}else return[r,{}]}function qi(e){let t=e=>{switch(e){case`S`:return`millisecond`;case`s`:return`second`;case`m`:return`minute`;case`h`:case`H`:return`hour`;case`d`:return`day`;case`o`:return`ordinal`;case`L`:case`M`:return`month`;case`y`:return`year`;case`E`:case`c`:return`weekday`;case`W`:return`weekNumber`;case`k`:return`weekYear`;case`q`:return`quarter`;default:return null}},n=null,r;return F(e.z)||(n=wt.create(e.z)),F(e.Z)||(n||(n=new k(e.Z)),r=e.Z),F(e.q)||(e.M=(e.q-1)*3+1),F(e.h)||(e.h<12&&e.a===1?e.h+=12:e.h===12&&e.a===0&&(e.h=0)),e.G===0&&e.y&&(e.y=-e.y),F(e.u)||(e.S=Rn(e.u)),[Object.keys(e).reduce((n,r)=>{let i=t(r);return i&&(n[i]=e[r]),n},{}),n,r]}let Ji=null;function Yi(){return Ji||(Ji=Y.fromMillis(1555555555555)),Ji}function Xi(e,t){if(e.literal)return e;let n=ta(V.macroTokenToFormatOpts(e.val),t);return n==null||n.includes(void 0)?e:n}function Zi(e,t){return Array.prototype.concat(...e.map(e=>Xi(e,t)))}var Qi=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Zi(V.parseFormat(t),e),this.units=this.tokens.map(t=>Hi(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){let[e,t]=Gi(this.units);this.regex=RegExp(e,`i`),this.handlers=t}}explainFromTokens(e){if(this.isValid){let[t,n]=Ki(e,this.regex,this.handlers),[r,i,a]=n?qi(n):[null,null,void 0];if(Fn(n,`a`)&&Fn(n,`H`))throw new Ge(`Can't include meridiem when specifying 24-hour format`);return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:r,zone:i,specificOffset:a}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function $i(e,t,n){return new Qi(e,n).explainFromTokens(t)}function ea(e,t,n){let{result:r,zone:i,specificOffset:a,invalidReason:o}=$i(e,t,n);return[r,i,a,o]}function ta(e,t){if(!e)return null;let n=V.create(t,e).dtFormatter(Yi()),r=n.formatToParts(),i=n.resolvedOptions();return r.map(t=>Wi(t,e,i))}const na=`Invalid DateTime`,ra=864e13;function ia(e){return new N(`unsupported zone`,`the zone "${e.name}" is not supported`)}function aa(e){return e.weekData===null&&(e.weekData=vn(e.c)),e.weekData}function oa(e){return e.localWeekData===null&&(e.localWeekData=vn(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function J(e,t){let n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new Y({...n,...t,old:n})}function sa(e,t,n){let r=e-t*60*1e3,i=n.offset(r);if(t===i)return[r,t];r-=(i-t)*60*1e3;let a=n.offset(r);return i===a?[r,i]:[e-Math.min(i,a)*60*1e3,Math.max(i,a)]}function ca(e,t){e+=t*60*1e3;let n=new Date(e);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function la(e,t,n){return sa(Un(e),t,n)}function ua(e,t){let n=e.o,r=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+Math.trunc(t.quarters)*3,a={...e.c,year:r,month:i,day:Math.min(e.c.day,Hn(r,i))+Math.trunc(t.days)+Math.trunc(t.weeks)*7},o=G.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as(`milliseconds`),[s,c]=sa(Un(a),n,e.zone);return o!==0&&(s+=o,c=e.zone.offset(s)),{ts:s,o:c}}function da(e,t,n,r,i,a){let{setZone:o,zone:s}=n;if(e&&Object.keys(e).length!==0||t){let r=t||s,i=Y.fromObject(e,{...n,zone:r,specificOffset:a});return o?i:i.setZone(s)}else return Y.invalid(new N(`unparsable`,`the input "${i}" can't be parsed as ${r}`))}function fa(e,t,n=!0){return e.isValid?V.create(O.create(`en-US`),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function pa(e,t,n){let r=e.c.year>9999||e.c.year<0,i=``;if(r&&e.c.year>=0&&(i+=`+`),i+=R(e.c.year,r?6:4),n===`year`)return i;if(t){if(i+=`-`,i+=R(e.c.month),n===`month`)return i;i+=`-`}else if(i+=R(e.c.month),n===`month`)return i;return i+=R(e.c.day),i}function ma(e,t,n,r,i,a,o){let s=!n||e.c.millisecond!==0||e.c.second!==0,c=``;switch(o){case`day`:case`month`:case`year`:break;default:if(c+=R(e.c.hour),o===`hour`)break;if(t){if(c+=`:`,c+=R(e.c.minute),o===`minute`)break;s&&(c+=`:`,c+=R(e.c.second))}else{if(c+=R(e.c.minute),o===`minute`)break;s&&(c+=R(e.c.second))}if(o===`second`)break;s&&(!r||e.c.millisecond!==0)&&(c+=`.`,c+=R(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&e.offset===0&&!a?c+=`Z`:e.o<0?(c+=`-`,c+=R(Math.trunc(-e.o/60)),c+=`:`,c+=R(Math.trunc(-e.o%60))):(c+=`+`,c+=R(Math.trunc(e.o/60)),c+=`:`,c+=R(Math.trunc(e.o%60)))),a&&(c+=`[`+e.zone.ianaName+`]`),c}const ha={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ga={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},_a={ordinal:1,hour:0,minute:0,second:0,millisecond:0},va=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],ya=[`weekYear`,`weekNumber`,`weekday`,`hour`,`minute`,`second`,`millisecond`],ba=[`year`,`ordinal`,`hour`,`minute`,`second`,`millisecond`];function xa(e){let t={year:`year`,years:`year`,month:`month`,months:`month`,day:`day`,days:`day`,hour:`hour`,hours:`hour`,minute:`minute`,minutes:`minute`,quarter:`quarter`,quarters:`quarter`,second:`second`,seconds:`second`,millisecond:`millisecond`,milliseconds:`millisecond`,weekday:`weekday`,weekdays:`weekday`,weeknumber:`weekNumber`,weeksnumber:`weekNumber`,weeknumbers:`weekNumber`,weekyear:`weekYear`,weekyears:`weekYear`,ordinal:`ordinal`}[e.toLowerCase()];if(!t)throw new Ke(e);return t}function Sa(e){switch(e.toLowerCase()){case`localweekday`:case`localweekdays`:return`localWeekday`;case`localweeknumber`:case`localweeknumbers`:return`localWeekNumber`;case`localweekyear`:case`localweekyears`:return`localWeekYear`;default:return xa(e)}}function Ca(e){if(Da===void 0&&(Da=M.now()),e.type!==`iana`)return e.offset(Da);let t=e.name,n=Oa.get(t);return n===void 0&&(n=e.offset(Da),Oa.set(t,n)),n}function wa(e,t){let n=A(t.zone,M.defaultZone);if(!n.isValid)return Y.invalid(ia(n));let r=O.fromObject(t),i,a;if(F(e.year))i=M.now();else{for(let t of va)F(e[t])&&(e[t]=ha[t]);let t=Tn(e)||En(e);if(t)return Y.invalid(t);let r=Ca(n);[i,a]=la(e,r,n)}return new Y({ts:i,zone:n,loc:r,o:a})}function Ta(e,t,n){let r=F(n.round)?!0:n.round,i=F(n.rounding)?`trunc`:n.rounding,a=(e,a)=>(e=zn(e,r||n.calendary?0:2,n.calendary?`round`:i),t.loc.clone(n).relFormatter(n).format(e,a)),o=r=>n.calendary?t.hasSame(e,r)?0:t.startOf(r).diff(e.startOf(r),r).get(r):t.diff(e,r).get(r);if(n.unit)return a(o(n.unit),n.unit);for(let e of n.units){let t=o(e);if(Math.abs(t)>=1)return a(t,e)}return a(e>t?-0:0,n.units[n.units.length-1])}function Ea(e){let t={},n;return e.length>0&&typeof e[e.length-1]==`object`?(t=e[e.length-1],n=Array.from(e).slice(0,e.length-1)):n=Array.from(e),[t,n]}let Da;const Oa=new Map;var Y=class e{constructor(e){let t=e.zone||M.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new N(`invalid input`):null)||(t.isValid?null:ia(t));this.ts=F(e.ts)?M.now():e.ts;let r=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{let a=I(e.o)&&!e.old?e.o:t.offset(this.ts);r=ca(this.ts,a),n=Number.isNaN(r.year)?new N(`invalid input`):null,r=n?null:r,i=n?null:a}this._zone=t,this.loc=e.loc||O.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new e({})}static local(){let[e,t]=Ea(arguments),[n,r,i,a,o,s,c]=t;return wa({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static utc(){let[e,t]=Ea(arguments),[n,r,i,a,o,s,c]=t;return e.zone=k.utcInstance,wa({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static fromJSDate(t,n={}){let r=kn(t)?t.valueOf():NaN;if(Number.isNaN(r))return e.invalid(`invalid input`);let i=A(n.zone,M.defaultZone);return i.isValid?new e({ts:r,zone:i,loc:O.fromObject(n)}):e.invalid(ia(i))}static fromMillis(t,n={}){if(!I(t))throw new C(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`);return t<-ra||t>ra?e.invalid(`Timestamp out of range`):new e({ts:t,zone:A(n.zone,M.defaultZone),loc:O.fromObject(n)})}static fromSeconds(t,n={}){if(I(t))return new e({ts:t*1e3,zone:A(n.zone,M.defaultZone),loc:O.fromObject(n)});throw new C(`fromSeconds requires a numerical input`)}static fromObject(t,n={}){t=t||{};let r=A(n.zone,M.defaultZone);if(!r.isValid)return e.invalid(ia(r));let i=O.fromObject(n),a=Xn(t,Sa),{minDaysInFirstWeek:o,startOfWeek:s}=Sn(a,i),c=M.now(),l=F(n.specificOffset)?r.offset(c):n.specificOffset,u=!F(a.ordinal),d=!F(a.year),f=!F(a.month)||!F(a.day),p=d||f,m=a.weekYear||a.weekNumber;if((p||u)&&m)throw new Ge(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(f&&u)throw new Ge(`Can't mix ordinal dates with month/day`);let h=m||a.weekday&&!p,g,_,v=ca(c,l);h?(g=ya,_=ga,v=vn(v,o,s)):u?(g=ba,_=_a,v=bn(v)):(g=va,_=ha);let y=!1;for(let e of g){let t=a[e];F(t)?y?a[e]=_[e]:a[e]=v[e]:y=!0}let ee=(h?Cn(a,o,s):u?wn(a):Tn(a))||En(a);if(ee)return e.invalid(ee);let[te,ne]=la(h?yn(a,o,s):u?xn(a):a,l,r),b=new e({ts:te,zone:r,o:ne,loc:i});return a.weekday&&p&&t.weekday!==b.weekday?e.invalid(`mismatched weekday`,`you can't specify both a weekday of ${a.weekday} and a date of ${b.toISO()}`):b.isValid?b:e.invalid(b.invalid)}static fromISO(e,t={}){let[n,r]=li(e);return da(n,r,t,`ISO 8601`,e)}static fromRFC2822(e,t={}){let[n,r]=ui(e);return da(n,r,t,`RFC 2822`,e)}static fromHTTP(e,t={}){let[n,r]=di(e);return da(n,r,t,`HTTP`,t)}static fromFormat(t,n,r={}){if(F(t)||F(n))throw new C(`fromFormat requires an input string and a format`);let{locale:i=null,numberingSystem:a=null}=r,[o,s,c,l]=ea(O.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),t,n);return l?e.invalid(l):da(o,s,r,`format ${n}`,t,c)}static fromString(t,n,r={}){return e.fromFormat(t,n,r)}static fromSQL(e,t={}){let[n,r]=vi(e);return da(n,r,t,`SQL`,e)}static invalid(t,n=null){if(!t)throw new C(`need to specify a reason the DateTime is invalid`);let r=t instanceof N?t:new N(t,n);if(M.throwOnInvalid)throw new He(r);return new e({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let n=ta(e,O.fromObject(t));return n?n.map(e=>e?e.val:null).join(``):null}static expandFormat(e,t={}){return Zi(V.parseFormat(e),O.fromObject(t)).map(e=>e.val).join(``)}static resetCache(){Da=void 0,Oa.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?aa(this).weekYear:NaN}get weekNumber(){return this.isValid?aa(this).weekNumber:NaN}get weekday(){return this.isValid?aa(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?oa(this).weekday:NaN}get localWeekNumber(){return this.isValid?oa(this).weekNumber:NaN}get localWeekYear(){return this.isValid?oa(this).weekYear:NaN}get ordinal(){return this.isValid?bn(this.c).ordinal:NaN}get monthShort(){return this.isValid?ji.months(`short`,{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?ji.months(`long`,{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?ji.weekdays(`short`,{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?ji.weekdays(`long`,{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:`short`,locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:`long`,locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,t=6e4,n=Un(this.c),r=this.zone.offset(n-e),i=this.zone.offset(n+e),a=this.zone.offset(n-r*t),o=this.zone.offset(n-i*t);if(a===o)return[this];let s=n-a*t,c=n-o*t,l=ca(s,a),u=ca(c,o);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[J(this,{ts:s}),J(this,{ts:c})]:[this]}get isInLeapYear(){return Bn(this.year)}get daysInMonth(){return Hn(this.year,this.month)}get daysInYear(){return this.isValid?Vn(this.year):NaN}get weeksInWeekYear(){return this.isValid?Gn(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Gn(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:n,calendar:r}=V.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(k.instance(e),t)}toLocal(){return this.setZone(M.defaultZone)}setZone(t,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(t=A(t,M.defaultZone),t.equals(this.zone))return this;if(t.isValid){let e=this.ts;if(n||r){let n=t.offset(this.ts),r=this.toObject();[e]=la(r,n,t)}return J(this,{ts:e,zone:t})}else return e.invalid(ia(t))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){let r=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return J(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=Xn(e,Sa),{minDaysInFirstWeek:n,startOfWeek:r}=Sn(t,this.loc),i=!F(t.weekYear)||!F(t.weekNumber)||!F(t.weekday),a=!F(t.ordinal),o=!F(t.year),s=!F(t.month)||!F(t.day),c=o||s,l=t.weekYear||t.weekNumber;if((c||a)&&l)throw new Ge(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(s&&a)throw new Ge(`Can't mix ordinal dates with month/day`);let u;i?u=yn({...vn(this.c,n,r),...t},n,r):F(t.ordinal)?(u={...this.toObject(),...t},F(t.day)&&(u.day=Math.min(Hn(u.year,u.month),u.day))):u=xn({...bn(this.c),...t});let[d,f]=la(u,this.o,this.zone);return J(this,{ts:d,o:f})}plus(e){if(!this.isValid)return this;let t=G.fromDurationLike(e);return J(this,ua(this,t))}minus(e){if(!this.isValid)return this;let t=G.fromDurationLike(e).negate();return J(this,ua(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let n={},r=G.normalizeUnit(e);switch(r){case`years`:n.month=1;case`quarters`:case`months`:n.day=1;case`weeks`:case`days`:n.hour=0;case`hours`:n.minute=0;case`minutes`:n.second=0;case`seconds`:n.millisecond=0;break}if(r===`weeks`)if(t){let e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(n.weekNumber=this.weekNumber-1),n.weekday=e}else n.weekday=1;return r===`quarters`&&(n.month=(Math.ceil(this.month/3)-1)*3+1),this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?V.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):na}toLocaleString(e=qe,t={}){return this.isValid?V.create(this.loc.clone(t),e).formatDateTime(this):na}toLocaleParts(e={}){return this.isValid?V.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e=`extended`,suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:a=`milliseconds`}={}){if(!this.isValid)return null;a=xa(a);let o=e===`extended`,s=pa(this,o,a);return va.indexOf(a)>=3&&(s+=`T`),s+=ma(this,o,t,n,r,i,a),s}toISODate({format:e=`extended`,precision:t=`day`}={}){return this.isValid?pa(this,e===`extended`,xa(t)):null}toISOWeekDate(){return fa(this,`kkkk-'W'WW-c`)}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:a=`extended`,precision:o=`milliseconds`}={}){return this.isValid?(o=xa(o),(r&&va.indexOf(o)>=3?`T`:``)+ma(this,a===`extended`,t,e,n,i,o)):null}toRFC2822(){return fa(this,`EEE, dd LLL yyyy HH:mm:ss ZZZ`,!1)}toHTTP(){return fa(this.toUTC(),`EEE, dd LLL yyyy HH:mm:ss 'GMT'`)}toSQLDate(){return this.isValid?pa(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let r=`HH:mm:ss.SSS`;return(t||e)&&(n&&(r+=` `),t?r+=`z`:e&&(r+=`ZZ`)),fa(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():na}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t=`milliseconds`,n={}){if(!this.isValid||!e.isValid)return G.invalid(`created by diffing an invalid DateTime`);let r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=Mn(t).map(G.normalizeUnit),a=e.valueOf()>this.valueOf(),o=Pi(a?this:e,a?e:this,i,r);return a?o.negate():o}diffNow(t=`milliseconds`,n={}){return this.diff(e.now(),t,n)}until(e){return this.isValid?Ai.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;let r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=r&&r<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(t={}){if(!this.isValid)return null;let n=t.base||e.fromObject({},{zone:this.zone}),r=t.padding?this<n?-t.padding:t.padding:0,i=[`years`,`months`,`days`,`hours`,`minutes`,`seconds`],a=t.unit;return Array.isArray(t.unit)&&(i=t.unit,a=void 0),Ta(n,this.plus(r),{...t,numeric:`always`,units:i,unit:a})}toRelativeCalendar(t={}){return this.isValid?Ta(t.base||e.fromObject({},{zone:this.zone}),this,{...t,numeric:`auto`,units:[`years`,`months`,`days`],calendary:!0}):null}static min(...t){if(!t.every(e.isDateTime))throw new C(`min requires all arguments be DateTimes`);return Nn(t,e=>e.valueOf(),Math.min)}static max(...t){if(!t.every(e.isDateTime))throw new C(`max requires all arguments be DateTimes`);return Nn(t,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){let{locale:r=null,numberingSystem:i=null}=n;return $i(O.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(t,n,r={}){return e.fromFormatExplain(t,n,r)}static buildFormatParser(e,t={}){let{locale:n=null,numberingSystem:r=null}=t;return new Qi(O.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0}),e)}static fromFormatParser(t,n,r={}){if(F(t)||F(n))throw new C(`fromFormatParser requires an input string and a format parser`);let{locale:i=null,numberingSystem:a=null}=r,o=O.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});if(!o.equals(n.locale))throw new C(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${n.locale}`);let{result:s,zone:c,specificOffset:l,invalidReason:u}=n.explainFromTokens(t);return u?e.invalid(u):da(s,c,r,`format ${n.format}`,t,l)}static get DATE_SHORT(){return qe}static get DATE_MED(){return Je}static get DATE_MED_WITH_WEEKDAY(){return Ye}static get DATE_FULL(){return Xe}static get DATE_HUGE(){return Ze}static get TIME_SIMPLE(){return Qe}static get TIME_WITH_SECONDS(){return $e}static get TIME_WITH_SHORT_OFFSET(){return et}static get TIME_WITH_LONG_OFFSET(){return tt}static get TIME_24_SIMPLE(){return nt}static get TIME_24_WITH_SECONDS(){return rt}static get TIME_24_WITH_SHORT_OFFSET(){return it}static get TIME_24_WITH_LONG_OFFSET(){return at}static get DATETIME_SHORT(){return ot}static get DATETIME_SHORT_WITH_SECONDS(){return st}static get DATETIME_MED(){return ct}static get DATETIME_MED_WITH_SECONDS(){return lt}static get DATETIME_MED_WITH_WEEKDAY(){return ut}static get DATETIME_FULL(){return dt}static get DATETIME_FULL_WITH_SECONDS(){return ft}static get DATETIME_HUGE(){return pt}static get DATETIME_HUGE_WITH_SECONDS(){return mt}};function ka(e){if(Y.isDateTime(e))return e;if(e&&e.valueOf&&I(e.valueOf()))return Y.fromJSDate(e);if(e&&typeof e==`object`)return Y.fromObject(e);throw new C(`Unknown datetime argument: ${e}, of type ${typeof e}`)}const Aa=(e,t,n)=>{let r=n[0];if(r===void 0)return!1;let i=ja(e),a=ja(r);if(i===void 0||a===void 0)return!1;switch(t){case`is after`:return i>a;case`is before`:return i<a;default:return!1}},ja=e=>{let t=Y.fromISO(e,{zone:`utc`});return t.isValid?t.toMillis():void 0};var Ma=m(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),Na=m(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),Pa=m(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=Ma(),a=Na();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),Fa=m(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),Ia=m(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),X=m(((e,t)=>{let n=Na(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=Ma(),{safeRe:a,t:o}=Pa(),s=Fa(),{compareIdentifiers:c}=Ia();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[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(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&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)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}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{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),La=m(((e,t)=>{let n=X();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),Ra=m(((e,t)=>{let n=La();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),za=m(((e,t)=>{let n=La();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),Ba=m(((e,t)=>{let n=X();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),Va=m(((e,t)=>{let n=La();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),Ha=m(((e,t)=>{let n=X();t.exports=(e,t)=>new n(e,t).major})),Ua=m(((e,t)=>{let n=X();t.exports=(e,t)=>new n(e,t).minor})),Wa=m(((e,t)=>{let n=X();t.exports=(e,t)=>new n(e,t).patch})),Ga=m(((e,t)=>{let n=La();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),Z=m(((e,t)=>{let n=X();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Ka=m(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(t,e,r)})),qa=m(((e,t)=>{let n=Z();t.exports=(e,t)=>n(e,t,!0)})),Ja=m(((e,t)=>{let n=X();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Ya=m(((e,t)=>{let n=Ja();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),Xa=m(((e,t)=>{let n=Ja();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),Za=m(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)>0})),Qa=m(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)<0})),$a=m(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)===0})),eo=m(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)!==0})),to=m(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)>=0})),no=m(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)<=0})),ro=m(((e,t)=>{let n=$a(),r=eo(),i=Za(),a=to(),o=Qa(),s=no();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),io=m(((e,t)=>{let n=X(),r=La(),{safeRe:i,t:a}=Pa();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t=t||{};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),ao=m(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),Q=m(((e,t)=>{let n=/\s+/g;t.exports=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 a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,oe(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>ae(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let ee=[..._.values()];return r.set(t,ee),ee}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(se(this.set[t],e,this.options))return!0;return!1}};let r=new(ao()),i=Fa(),a=oo(),o=Na(),s=X(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=Pa(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=Ma(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=ne(e,t),o(`caret`,e),e=ee(e,t),o(`tildes`,e),e=re(e,t),o(`xrange`,e),e=ie(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,ee=(e,t)=>e.trim().split(/\s+/).map(e=>te(e,t)).join(` `),te=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},ne=(e,t)=>e.trim().split(/\s+/).map(e=>b(e,t)).join(` `),b=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},re=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>x(e,t)).join(` `)),x=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},ie=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),ae=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),oe=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),se=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),oo=m(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=Fa(),{safeRe:i,t:a}=Pa(),o=ro(),s=Na(),c=X(),l=Q()})),so=m(((e,t)=>{let n=Q();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),co=m(((e,t)=>{let n=Q();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),lo=m(((e,t)=>{let n=X(),r=Q();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),uo=m(((e,t)=>{let n=X(),r=Q();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),fo=m(((e,t)=>{let n=X(),r=Q(),i=Za();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),po=m(((e,t)=>{let n=Q();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),mo=m(((e,t)=>{let n=X(),r=oo(),{ANY:i}=r,a=Q(),o=so(),s=Za(),c=Qa(),l=no(),u=to();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o=o||e,s=s||e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),ho=m(((e,t)=>{let n=mo();t.exports=(e,t,r)=>n(e,t,`>`,r)})),go=m(((e,t)=>{let n=mo();t.exports=(e,t,r)=>n(e,t,`<`,r)})),_o=m(((e,t)=>{let n=Q();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),vo=m(((e,t)=>{let n=so(),r=Z();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||(o=e)):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),yo=m(((e,t)=>{let n=Q(),r=oo(),{ANY:i}=r,a=so(),o=Z(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i=i||t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),bo=g(m(((e,t)=>{let n=Pa(),r=Ma(),i=X(),a=Ia();t.exports={parse:La(),valid:Ra(),clean:za(),inc:Ba(),diff:Va(),major:Ha(),minor:Ua(),patch:Wa(),prerelease:Ga(),compare:Z(),rcompare:Ka(),compareLoose:qa(),compareBuild:Ja(),sort:Ya(),rsort:Xa(),gt:Za(),lt:Qa(),eq:$a(),neq:eo(),gte:to(),lte:no(),cmp:ro(),coerce:io(),Comparator:oo(),Range:Q(),satisfies:so(),toComparators:co(),maxSatisfying:lo(),minSatisfying:uo(),minVersion:fo(),validRange:po(),outside:mo(),gtr:ho(),ltr:go(),intersects:_o(),simplifyRange:vo(),subset:yo(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}))(),1);const xo=(e,t,n)=>{let r=t.toLowerCase();if(e.trim().length===0)return r===`is not one of`;let i=bo.coerce(e),a=n.map(e=>bo.coerce(e)),o=a[0]??null;switch(r){case`=`:return So(i,o);case`<`:return Co(i,o,bo.lt);case`<=`:return Co(i,o,bo.lte);case`>`:return Co(i,o,bo.gt);case`>=`:return Co(i,o,bo.gte);case`is one of`:return a.some(e=>So(i,e));case`is not one of`:return!a.some(e=>So(i,e));default:return!1}},So=(e,t)=>e!==null&&t!==null&&bo.eq(e,t),Co=(e,t,n)=>e!==null&&t!==null&&n(e,t),wo=Symbol(`absent`),To=Symbol(`unknown-attribute`),Eo=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`,Do=e=>e===wo||e==null?``:Eo(e)?Oo(e):``,Oo=e=>typeof e==`string`?e:String(e),ko=e=>e===wo?void 0:e,Ao=e=>e===To?`unknown-attribute`:e===wo?`absent`:Eo(e)?`scalar`:Array.isArray(e)?`array`:`object`,jo=(e,t,n)=>{let r=t.toLowerCase();if(!Array.isArray(e))return r===`does not contain any of`;let i=e.filter(Eo).map(Oo);switch(r){case`contains any of`:return i.some(e=>n.includes(e));case`does not contain any of`:return!i.some(e=>n.includes(e));default:return!1}},Mo=e=>e?.context?.kind??`user`;var No=class{evaluate(e,t){return this.explain(e,t).matched}explain(e,t){let n=this.resolve(e,t),r=Ao(n),i=n===wo||n===To?void 0:n;return n===To?{matched:!1,resolvedValue:i,resolvedType:r}:{matched:this.compare(e,n),resolvedValue:i,resolvedType:r}}compare(e,t){let n=e.targetValues??[];switch(e.targetType){case`text`:return Re(Do(t),e.operator,n);case`number`:return ze(ko(t),e.operator,n);case`datetime`:return Aa(Do(t),e.operator,n);case`semver`:return xo(Do(t),e.operator,n);case`array`:return jo(ko(t),e.operator,n)}return!1}resolve(e,t){switch(e.attribute){case`identifier`:return Po(t?.context?.id);case`name`:return Po(t?.context?.name);case`kind`:return Mo(t);case`appName`:return Po(t?.metadata?.appName);case`appVersion`:return Po(t?.metadata?.appVersion);case`traits`:return e.trait?Po(Le(e.trait,t?.context?.traits)):wo;default:return To}}};const Po=e=>e??wo;var Fo=class{constructor(e){this.conditionEvaluator=e}explain(e,t,n){let r=t?.[e.segmentId];if(r===void 0||!Io(r))return{matched:!1,segmentFound:!1,matchedGroupIndex:void 0};let i=this.matchingGroupIndex(r,n),a=i!==void 0;return{matched:this.operatorHolds(e,a),segmentFound:!0,matchedGroupIndex:i}}operatorHolds(e,t){switch(e.operator.toLowerCase()){case`in`:return t;case`not in`:return!t;default:return!1}}matchingGroupIndex(e,t){let n=(e.groups??[]).findIndex(e=>(e??[]).every(e=>this.conditionEvaluator.evaluate(e,t)));return n===-1?void 0:n}};const Io=e=>(e.groups??[]).every(e=>(e??[]).every(e=>e.kind===void 0||e.kind===`attribute`));function Lo(e,t){let n=e*t;return BigInt.asUintN(64,n)^n>>64n}function Ro(e,t){let n=e*t;return BigInt.asUintN(64,n)^n>>64n^e^t}new DataView(new Uint8Array(8).buffer);var zo=new DataView(new Uint8Array(8).buffer);function Bo(e,t){return zo.setUint32(0,e.getUint32(t,!0),!0),zo.getBigUint64(0,!0)}function $(e,t){return e.getBigUint64(t,!0)}new DataView(new Uint8Array(8).buffer),new DataView(new Uint8Array(8).buffer);var Vo=new TextEncoder,Ho=2048,Uo=Ho/3,Wo=new Uint8Array(Ho);function Go(e){if(typeof e==`string`){if(e.length<=Uo){let{written:t}=Vo.encodeInto(e,Wo);return new DataView(Wo.buffer,0,t)}let t=Vo.encode(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}return e instanceof Uint8Array?new DataView(e.buffer,e.byteOffset,e.byteLength):e}var Ko=`fast`;function qo(e){return e>=0n&&e<=18446744073709551615n}function Jo(e,t){let n={seed:t,rapidMumBehaviour:Ko};if(e===void 0)return n;if(e.seed!==void 0){if(!qo(e.seed))throw Error(`seed must be a 64-bit unsigned bigint value: ${e.seed}`);n.seed=e.seed}return e.rapidMumBehaviour!==void 0&&(n.rapidMumBehaviour=e.rapidMumBehaviour),n}var Yo=0n,Xo=[3257665815644502181n,10067880064238660809n,5418857496715711651n,5573817676018592327n,11562461410679940143n,16646288086500911323n,10443028834174122124n,12297829382473034410n],Zo=new Uint8Array(8),Qo=new DataView(Zo.buffer);function $o(e,t){let n=e.getUint8(0);return Zo[6]=n>>3,Zo[5]=n<<5,Zo[0]=e.getUint8(t-1),Qo.getBigUint64(0,!0)}function es(e,t,n,r){let i=e*t,a=(BigInt.asUintN(64,i)^n[7])*(i>>64n^n[1]^r);return BigInt.asUintN(64,a)^a>>64n}function ts(e,t,n,r){let i=e*t,a=BigInt.asUintN(64,i)^n[7]^e,o=i>>64n^n[1]^r^t,s=a*o;return BigInt.asUintN(64,s)^s>>64n^a^o}var ns={fast:{rapid_mix:Lo,rapidhash_epilogue:es},protected:{rapid_mix:Ro,rapidhash_epilogue:ts}};function rs(e,t,n,r,i){let a=e.byteLength,o=BigInt(e.byteLength);t^=r(t^n[2],n[1]);let s,c,l=a,u;if(a<=16)if(u=o,a>=4)if(t^=o,a>=8){let t=a-8;s=$(e,0),c=$(e,t)}else{let t=a-4;s=Bo(e,0),c=Bo(e,t)}else a>0?(s=$o(e,a),c=BigInt(e.getUint8(a>>1))):(s=0n,c=0n);else{let i=0;if(l>112){let a=t,o=t,s=t,c=t,u=t,d=t;do t=r($(e,i)^n[0],$(e,i+8)^t),a=r($(e,i+16)^n[1],$(e,i+24)^a),o=r($(e,i+32)^n[2],$(e,i+40)^o),s=r($(e,i+48)^n[3],$(e,i+56)^s),c=r($(e,i+64)^n[4],$(e,i+72)^c),u=r($(e,i+80)^n[5],$(e,i+88)^u),d=r($(e,i+96)^n[6],$(e,i+104)^d),i+=112,l-=112;while(l>112);t^=a,o^=s,c^=u,t^=d,o^=c,t^=o}u=BigInt(l),l>16&&(t=r($(e,i)^n[2],$(e,i+8)^t),l>32&&(t=r($(e,i+16)^n[2],$(e,i+24)^t),l>48&&(t=r($(e,i+32)^n[1],$(e,i+40)^t),l>64&&(t=r($(e,i+48)^n[1],$(e,i+56)^t),l>80&&(t=r($(e,i+64)^n[2],$(e,i+72)^t),l>96&&(t=r($(e,i+80)^n[1],$(e,i+88)^t))))))),s=$(e,i+l-16)^u,c=$(e,i+l-8)}return s^=n[1],c^=t,i(s,c,n,u)}function is(e,t){let{seed:n,rapidMumBehaviour:r}=Jo(t,Yo),{rapid_mix:i,rapidhash_epilogue:a}=ns[r];return rs(Go(e),n,Xo,i,a)}const as=({configId:e,contextIdentifier:t,contextKind:n})=>{let r=n===`user`?`${t}-${e}`:`${t}-${e}:${n}`;return Number(is(r,{seed:15426857351n})%1000n)/10};var os=class{constructor(e){if(this.logger=e,this.conditionEvaluator=new No,this.segmentEvaluator=new Fo(this.conditionEvaluator),!e||!e.warn||!e.error||!e.info)throw TypeError(`The provided logger is not a valid 'ConfigDirectorLogger'`);this.logger=e}evaluate(e,t,n){return{id:e.id,key:e.key,type:e.type,value:this.explain(e,t,n).value}}explain(e,t,n){let r=[...e.target?.rules??[]].sort((e,t)=>(e.order??2**53-1)-(t.order??2**53-1)),i=[],a;for(let o of r){if(a){i.push({ruleId:o.id,outcome:`not-evaluated`,conditions:[],bucket:void 0});continue}let r=this.explainRule(o,e,t,n);i.push(r.explanation),r.value!==void 0&&(a={ruleId:o.id,value:r.value})}return{value:a?.value??e.target?.defaultValue,servedBy:a?{kind:`rule`,ruleId:a.ruleId}:{kind:`default`},rules:i}}explainRule(e,t,n,r){let i={ruleId:e.id,outcome:`not-matched`,conditions:[],bucket:void 0};try{let a;return e.type==`percentage`?a=this.explainPercentage(e.percentages??[],t,n,i):e.type==`conditional`&&(a=this.explainConditionalRule(e,t,n,r,i)),a!==void 0&&(i.outcome=`matched`),{explanation:i,value:a}}catch(n){return this.logger.warn(`There was an error while evaluating a targeting rule '${e?.id}' for '${t?.key}'. The rule will be disregarded.`,{error:n,configKey:t?.key,ruleId:e?.id}),{explanation:{ruleId:e.id,outcome:`errored`,conditions:[],bucket:void 0},value:void 0}}}explainPercentage(e,t,n,r){let i=n?.context?.id??void 0,a=i===void 0?0:as({configId:t.id,contextIdentifier:i,contextKind:Mo(n)}),o=[],s=0,c;for(let t of e){let e=s+t.percentage;o.push({percentageId:t.id,from:s,to:e,value:t.value?.toString()}),c===void 0&&a<e&&(c=t),s=e}return r.bucket={identifier:i,defaultedToPredefinedBucket:i===void 0,assignedPercentage:a,shares:o,selectedPercentageId:c?.id},c?.value==null?void 0:c.value.toString()}explainConditionalRule(e,t,n,r,i){let a=!1;for(let t of e.conditions??[]){if(a){i.conditions.push({conditionId:t.id,outcome:`not-evaluated`});continue}let e=this.explainCondition(t,n,r);i.conditions.push(e),a=e.outcome!==`matched`}if(!a){if(e.target==`value`)return e.value==null?void 0:e.value.toString();if(e.target==`percentage`)return this.explainPercentage(e.percentages??[],t,n,i)}}explainCondition(e,t,n){if(e.kind===`segment`){let r=this.segmentEvaluator.explain(e,n,t);return{conditionId:e.id,kind:`segment`,outcome:r.matched?`matched`:`not-matched`,segmentId:e.segmentId,segmentFound:r.segmentFound,matchedGroupIndex:r.matchedGroupIndex}}let r=this.conditionEvaluator.explain(e,t);return{conditionId:e.id,kind:`attribute`,outcome:r.matched?`matched`:`not-matched`,resolvedValue:r.resolvedValue,resolvedType:r.resolvedType}}};const ss=e=>{let t=typeof e;if(t===`object`)try{return e.constructor?.name??t}catch{return t}else if(t===`function`)try{let n=e.name;return n?`function: ${n}`:t}catch{return t}return t},cs=e=>e===`number`||e===`bigint`,ls=new Set([`boolean`,`integer`,`float`]),us=(e,t)=>{let n=e.value,r=ss(t);if(n==null||n===``)return{parsedValue:t,parsedValueId:void 0,requestedType:r,usedDefault:!0,reason:`value-missing`};if(e.type===`json`)return gs(n,t,r,e.valueId);if(typeof t==`string`)return ls.has(e.type)?{parsedValue:t,parsedValueId:void 0,requestedType:r,usedDefault:!0,reason:`type-mismatch`}:{parsedValue:n,parsedValueId:e.valueId,requestedType:r,usedDefault:!1,reason:`found-match`};if(typeof t==`boolean`&&(e.type===`boolean`||e.type===`string`||e.type===`enum`)){let i=ds(n),a=typeof i==`boolean`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-boolean`}}if(cs(typeof t)&&e.type===`integer`){let i=fs(n),a=typeof i==`number`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-number`}}if(cs(typeof t)&&(e.type===`float`||e.type===`enum`||e.type===`string`)){let i=ps(n),a=typeof i==`number`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-number`}}return{parsedValue:t,parsedValueId:void 0,requestedType:r,usedDefault:!0,reason:`type-mismatch`}},ds=e=>{if(!e)return;let t=e.toLowerCase();if(!(t!=`true`&&t!=`false`))return t===`true`},fs=e=>{let t=ms(e);return t==null?void 0:Math.trunc(t)},ps=e=>ms(e),ms=e=>{if(!e||!hs(e))return;let t=Number(e);if(!(isNaN(t)||!isFinite(t)))return t},hs=e=>{for(let t of e)if(!(t>=`0`&&t<=`9`)&&!`+-.eE`.includes(t))return!1;return!0},gs=(e,t,n,r)=>{if(typeof t==`string`)return{parsedValue:e,parsedValueId:r,requestedType:n,usedDefault:!1,reason:`found-match`};try{let i=JSON.parse(e);return _s(i,t)?{parsedValue:i,parsedValueId:r,requestedType:n,usedDefault:!1,reason:`found-match`}:{parsedValue:t,parsedValueId:void 0,requestedType:n,usedDefault:!0,reason:`type-mismatch`}}catch{return{parsedValue:t,parsedValueId:void 0,requestedType:n,usedDefault:!0,reason:`invalid-json`}}},_s=(e,t)=>{if(e===null)return!1;let n=typeof t;return n===`bigint`?typeof e==`number`:typeof e===n},vs={off:-1,error:0,warn:1,info:2,debug:3},ys=()=>{let e={year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`};try{return new Intl.DateTimeFormat(void 0,{...e,fractionalSecondDigits:3})}catch{return new Intl.DateTimeFormat(void 0,e)}};var bs=class{constructor(e,t){this.level=e,this.decorator=t,this.level=e,this.decorator=t,this.dateFormatter=ys()}debug(e,...t){this.log(console.debug,`debug`,e,...t)}info(e,...t){this.log(console.info,`info`,e,...t)}warn(e,...t){this.log(console.warn,`warn`,e,...t)}error(e,...t){this.log(console.error,`error`,e,...t)}log(e,t,n,...r){vs[this.level]>=vs[t]&&e(`[${this.dateFormatter.format(new Date)}] ${this.decorator?.decorateMessage(n)}`,...r)}},xs=class{decorateMessage(e){return`[ConfigDirector:js-server-sdk] ${e}`}};const Ss=(e,t)=>new bs(e??`warn`,t??new xs),Cs=(e,t)=>new URL(e,t?.toString()),ws=(e,t)=>e===void 0?{seconds:t.defaultSeconds,warning:void 0}:e>=t.minimumSeconds?{seconds:e,warning:void 0}:{seconds:t.minimumSeconds,warning:`pollingInterval of ${e} seconds is below the minimum of ${t.minimumSeconds} seconds. Using ${t.minimumSeconds} seconds.`},Ts=e=>e>=`a`&&e<=`z`||e>=`0`&&e<=`9`||e===`-`||e===`_`,Es=e=>{if(e.length<1||e.length>64)return!1;for(let t of e)if(!Ts(t))return!1;return!0},Ds=e=>e==null||typeof e==`string`&&Es(e),Os=e=>{if(typeof e==`string`)return e;try{return String(e)}catch{return Object.prototype.toString.call(e)}},ks=(e,t)=>{let n=``,r=0;for(let i of e){if(r===t)break;n+=i,r+=1}return n},As=e=>{let t=e?.kind;return Ds(t)?{outcome:`admitted`,context:e}:{outcome:`ignored`,kindSample:ks(Os(t),128)}};var js=class{constructor(){this.countsByKindSample=new Map,this.countBeyondSampleLimit=0}record(e){return this.startTime??(this.startTime=new Date),this.add(e,1)}absorb(e){for(let t of e)(this.startTime===void 0||t.startTime<this.startTime)&&(this.startTime=t.startTime),this.add(t.event.kindSample,t.count)}add(e,t){if(e!==void 0){let n=this.countsByKindSample.get(e);if(n!==void 0)return this.countsByKindSample.set(e,n+t),`known-kind-sample`;if(this.countsByKindSample.size<20)return this.countsByKindSample.set(e,t),`new-kind-sample`}let n=this.countBeyondSampleLimit===0;return this.countBeyondSampleLimit+=t,n?`first-beyond-sample-limit`:`beyond-sample-limit`}takeSnapshot(){let e=new Date,t=this.startTime??e,n=(n,r)=>({startTime:t,endTime:e,count:n,event:{reason:`invalid-context-kind`,kindSample:r}}),r=Array.from(this.countsByKindSample,([e,t])=>n(t,e)),i=this.countBeyondSampleLimit>0?[...r,n(this.countBeyondSampleLimit)]:r;return this.clear(),i}clear(){this.countsByKindSample.clear(),this.countBeyondSampleLimit=0,this.startTime=void 0}};const Ms=async(e,t)=>e.valueId?{valueId:e.valueId}:e.value?e.value.length<=500&&e.type!=`json`?{value:e.value}:{valueId:await t(e.value)}:e,Ns=e=>{if(e.type===`json`||e.type==null&&typeof e.value==`object`){if(e.valueId)return{valueId:e.valueId,type:`json`};try{return{value:JSON.stringify(e.value),type:`json`}}catch{return{value:e.value.toString(),type:`json`}}}let t=e.value?.toString();return t&&t.length<=500?{value:t}:e.valueId?{valueId:e.valueId}:{value:t}},Ps=e=>{let t=Object.keys(e);if(t.length==0)return!0;for(let n of t)if((e[n]?.length??0)>0)return!1;return!0},Fs=e=>{if(!e)return!0;let t=Object.keys(e);if(t.length==0)return!0;for(let n of t)if((e[n]??0)>0)return!1;return!0};var Is=class{constructor(e){this.executeRequests=!0,this.sdkKey=e.sdkKey,this.sdkIdentity=e.sdkIdentity,this.logger=e.logger,this.metaContext=e.metaContext,this.url=new URL(`server/telemetry/v1`,e.baseUrl.toString())}async report({discreteEvents:e,aggregatedEvents:t,droppedEvents:n}){if(!this.executeRequests)return{success:!1,fatalError:!0};let r={serverSdkKey:this.sdkKey,metaContext:{sdkName:this.sdkIdentity.sdkName,sdkVersion:this.sdkIdentity.sdkVersion,appName:this.metaContext.appName,appVersion:this.metaContext.appVersion},discreteEvents:e,aggregatedEvents:t,droppedEvents:n};if(this.isReportEmpty(r))return{success:!0,fatalError:!1};let i=await this.sendReport(r);return i.fatalError&&(this.executeRequests=!1),i}isReportEmpty(e){return Ps(e.discreteEvents)&&Ps(e.aggregatedEvents)&&Fs(e.droppedEvents)}async sendReport(e){try{let t=await oe(5e3,this.url,{method:`POST`,body:JSON.stringify(e)},this.logger),n=this.isStatusFatal(t.status);return n&&this.logger.warn(`[EventReporter] Received a fatal status response (${t.status}) from the telemetry endpoint. No more telemetry data will be sent.`),{success:t.ok,fatalError:n}}catch(e){return this.logger.warn(`[EventReporter] Error attempting to send telemetry data: ${e}`,{error:e}),{success:!1,fatalError:!1}}}isStatusFatal(e){return!!e&&e>=400&&e<500&&e!=429}},Ls=class{aggregate(e){if(e.events.length==0)return[];let t=new Map;for(let n of e.events){let e=JSON.stringify(n),r=t.get(e)?.count||0;t.set(e,{event:n,count:r+1})}return Array.from(t).map(([,t])=>({startTime:e.startTime,endTime:e.endTime,count:t.count,event:t.event}))}},Rs=class{constructor(e){this._events=[],this._droppedEventCount=0,this.limit=e??1e3}get events(){return this._events}get reachedLimit(){return this._events.length>=this.limit}get droppedEventCount(){return this._droppedEventCount}push(...e){this.startTime||(this.startTime=new Date);let t=Math.max(0,e.length-this.limit),n=e.slice(t,e.length);if(this._droppedEventCount+=t,this._events.length+n.length>this.limit){let e=this._events.length+n.length-this.limit;this._events.splice(0,e),this._droppedEventCount+=e}return this._events.push(...n)}takeSnapshot(){let e=new Date,t=this.startTime??e,n=this._events.splice(0),r=this._droppedEventCount;return this.startTime=void 0,this._droppedEventCount=0,{startTime:t,endTime:e,events:n,droppedCount:r}}clear(){this._events=[],this.startTime=void 0,this._droppedEventCount=0}},zs=class{constructor(e){this.aggregator=new Ls,this.collectEvents=!0,this.started=!1,this.logger=e.logger,this.evaluationEventQueue=new Rs(e.evaluationQueueLimit??1e3),this.flushIntervalDelay=e.flushIntervalDelay??3e4,this.initialFlushIntervalDelay=e.initialFlushIntervalDelay??5e3}start(){this.started||!this.collectEvents||(this.started=!0,this.flushTimeout=setTimeout(()=>this.flushAndScheduleNext(),this.initialFlushIntervalDelay))}async flushAndScheduleNext(){if(!this.collectEvents)return;let e;try{e=await this.flush()}catch(t){this.logger.warn(`[TelemetryEventCollector] Error flushing telemetry events: `,t),e={success:!1,fatalError:!1}}e.fatalError?(this.collectEvents=!1,this.close(),this.logger.warn(`[TelemetryEventCollector] Received a fatal error from telemetry collection. No longer collecting events.`)):this.collectEvents&&(this.cancelScheduledFlush(),this.flushTimeout=setTimeout(()=>this.flushAndScheduleNext(),this.flushIntervalDelay))}cancelScheduledFlush(){clearTimeout(this.flushTimeout)}async close(){this.collectEvents=!1,clearTimeout(this.flushTimeout);try{await this.flush()}catch(e){this.logger.warn(`[TelemetryEventCollector] Error flushing telemetry events during close: `,e)}this.evaluationEventQueue.clear()}dispose(){this.close()}},Bs=class extends Map{constructor(e,t){super(t),this._droppedCount=0,this.limit=e,this.enforceLimit()}set(e,t){return super.set(e,t),this.enforceLimit(),this}get droppedCount(){return this._droppedCount}clearAndReset(){this.clear(),this._droppedCount=0}enforceLimit(){for(;this.size>this.limit;){let e=this.keys().next().value;e!==void 0&&(this.delete(e),this._droppedCount+=1)}}},Vs=class{constructor(e){this.valueIdGenerator=e,this.valueIdGenerator=e}async process(e){let t=await Promise.all(e.events.map(async e=>({...e,defaultValue:await Ms(e.defaultValue,this.valueIdGenerator),evaluatedValue:await Ms(e.evaluatedValue,this.valueIdGenerator)})));return{...e,events:t}}},Hs=class extends zs{constructor(e){super(e),this.invalidContextSubmissions=new js,this.reporter=new Is(e),this.contexts=new Bs(e.contextLimit??1e3),this.evaluationEventSnapshotPreprocessor=new Vs(e.valueIdGenerator)}evaluatedConfig(e){if(!this.collectEvents)return;let t=e.context??void 0,n=Mo({context:t}),r=t?.anonymous?void 0:t?.id;r&&this.contexts.set(`${n}:${r}`,{...t,kind:n});let i={...e.evaluation,contextId:r,contextKind:r===void 0?void 0:n};this.evaluationEventQueue.push(this.sanitizeEvaluatedConfigEvent(i))}recordInvalidContext(e){return this.invalidContextSubmissions.record(e)}sanitizeEvaluatedConfigEvent(e){return{...e,defaultValue:Ns({value:e.defaultValue,type:e.type}),evaluatedValue:Ns({value:e.evaluatedValue,valueId:e.evaluatedValueId,type:e.type})}}snapshotContexts(){let e=Array.from(this.contexts.values()),t=this.contexts.droppedCount;return this.contexts.clearAndReset(),{contexts:e,droppedCount:t}}async flush(){if(!this.reporter)return{success:!1,fatalError:!1};let e=await this.evaluationEventSnapshotPreprocessor.process(this.evaluationEventQueue.takeSnapshot()),t=this.snapshotContexts();return await this.reporter?.report({context:this._context,discreteEvents:{capturedContexts:t.contexts},aggregatedEvents:{evaluatedConfig:this.aggregator.aggregate(e),invalidContext:this.invalidContextSubmissions.takeSnapshot()},droppedEvents:{evaluatedConfig:e.droppedCount,capturedContexts:t.droppedCount}})}};const Us={start:()=>{},evaluatedConfig:()=>{},recordInvalidContext:()=>`new-kind-sample`,close:async()=>{}},Ws=(e,t)=>{let n=BigInt(0),r=BigInt(62),i=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``),a=BigInt(`0x`+i),o=``;for(;a>n;)o=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`[Number(a%r)]+o,a/=r;return o.padStart(t,`0`)},Gs=Math.ceil(128/Math.log2(62)),Ks=async e=>Ws(n(`sha256`).update(e?.toString()??``).digest().subarray(0,16),Gs),qs={streaming:`The client will continue to retry since there were no fatal errors detected. Configs will return the default value until the connection succeeds.`,polling:`Since the client was configured without streaming, configs may not update and always return the default value.`},Js={"new-kind-sample":(e,t)=>e.error(`[ConfigDirectorClient] Ignored a context with the invalid kind '${t}' and evaluated as if no context was supplied. A context kind has 1 to 64 characters, using only lowercase letters, digits, '-' and '_'.`),"known-kind-sample":()=>{},"first-beyond-sample-limit":e=>e.error(`[ConfigDirectorClient] Ignored a context with another invalid kind and evaluated as if no context was supplied. 20 different invalid kinds were logged recently, so further invalid kinds are not logged individually.`),"beyond-sample-limit":()=>{}},Ys=(e,t)=>(e.target?.rules??[]).some(e=>e.type===`conditional`&&(e.conditions??[]).some(e=>e.kind===`segment`&&t.has(e.segmentId)));var Xs=class t{static from(e,n,r){return typeof e==`object`?new t(void 0,n,e):new t(e,n,r)}constructor(t,n,r,i){this.handlersMap=new Map,this.eventEmitter=new e,this.ready=!1,this.logger=r?.logger??Ss(),this.timeout=r?.connection?.timeout??3e3,this.metaContext=r?.metadata??{},this.connectionPlan=ke(t,r?.connection),this.configEvaluator=new os(this.logger),this.usageEventCollector=i?.telemetry??this.buildTelemetryClient(n,r),this.transport=i?.transport??this.buildTransport(n,r),this.transport.on(`configBundleReceived`,e=>{this.readyResolve?.(!1);let t=this.findKeysRemovedBy(e);!this.configSet||e.kind==`full`?this.configSet=e:(this.configSet.configs={...this.configSet.configs,...e.configs},this.configSet.segments={...this.configSet.segments,...e.segments});let n=this.findKeysUpdatedBy(e);this.eventEmitter.emit(`configsUpdated`,{keys:n,removedKeys:t}),this.updateWatchers([...n,...t]),this.logger.debug(`[ConfigDirectorClient] ConfigSet updated from server with ${n.length} key(s) and ${t.length} removed key(s)`,{keys:n,removedKeys:t})}),this.transport.on(`connectionError`,e=>{this.logger.error(`[ConfigDirectorClient] The connection encountered an unrecoverable error and will not be retried. Configs will no longer receive updates.`,e),this.eventEmitter.emit(`connectionError`,{error:e})}),this.registerHandler(`clientReady`,r?.hooks?.clientReady),this.registerHandler(`configEvaluated`,r?.hooks?.configEvaluated),this.registerHandler(`configsUpdated`,r?.hooks?.configsUpdated),this.registerHandler(`connectionError`,r?.hooks?.connectionError)}registerHandler(e,t){if(!t)return;let n=Array.isArray(t)?t:[t];for(let t of n)typeof t==`function`&&this.on(e,t)}async initialize(){try{this.ready=!1,this.readyPromise=new Promise(e=>{this.readyResolve=e}).then(e=>{e||(this.ready=!0,this.eventEmitter.emit(`clientReady`),this.logger.debug(`[ConfigDirectorClient] Received initial payload from the server, client is ready`))}),this.usageEventCollector.start();let e=new Date().getTime();await this.transport.connect(this.timeout);let t=new Date().getTime()-e,n=this.timeout-t;n>0&&(await Promise.race([this.readyPromise,new Promise(e=>{this.readyTimer=setTimeout(()=>e(),n)})]),this.clearReadyTimer()),this.ready||this.logger.warn(`[ConfigDirectorClient] Timed out waiting for initialization after ${this.timeout}ms. ${this.timeoutWarningDetails()}`)}catch(e){if(e instanceof y)throw e;this.logger.error(`[ConfigDirectorClient] An error occurred during initialization: `,e)}}timeoutWarningDetails(){switch(this.connectionPlan.kind){case`connect`:return qs[this.connectionPlan.mode];case`stay-offline`:return`The offline values were not delivered, so configs return the default value.`}}pollingIntervalFor(e,t){if(e!==`polling`)return;let n=ws(t,{defaultSeconds:300,minimumSeconds:60});return n.warning&&this.logger.warn(`[ConfigDirectorClient] ${n.warning}`),n.seconds}buildTelemetryClient(e,t){let n=this.connectionPlan;switch(n.kind){case`stay-offline`:return Us;case`connect`:{let r=t?.telemetry?.eventQueueLimit??5e3;return new Hs({sdkKey:n.serverSdkKey,sdkIdentity:e,metaContext:t?.metadata??{},logger:this.logger,baseUrl:n.baseUrl,flushIntervalDelay:t?.telemetry?.flushInterval??3e4,evaluationQueueLimit:Math.ceil(r*.7),contextLimit:Math.floor(r*.3),urlFactory:Cs,valueIdGenerator:Ks})}}}buildTransport(e,t){let n=this.connectionPlan;switch(n.kind){case`stay-offline`:return new xe(n.source);case`connect`:return new(this.getTransportConstructor(n.mode))({serverSdkKey:n.serverSdkKey,baseUrl:n.baseUrl,metaContext:{...t?.metadata,sdkName:e.sdkName,sdkVersion:e.sdkVersion},logger:this.logger,pollingInterval:this.pollingIntervalFor(n.mode,t?.connection?.pollingInterval)})}}getTransportConstructor(e){switch(e){case`polling`:return ue;case`streaming`:return ce}}findKeysRemovedBy(e){return!this.configSet||e.kind!=`full`?[]:Object.keys(this.configSet.configs).filter(t=>!Object.prototype.hasOwnProperty.call(e.configs,t))}findKeysUpdatedBy(e){let t=new Set(Object.keys(e.segments??{})),n=Object.entries(this.configSet?.configs??{}).filter(([,e])=>Ys(e,t)).map(([e])=>e);return[...new Set([...Object.keys(e.configs),...n])]}updateWatchers(e){e.forEach(e=>this.updateWatchersForConfig(e))}updateWatchersForConfig(e){let t=this.configSet?.configs[e];this.handlersMap.get(e)?.forEach(n=>{let r=this.getValueFromConfigDefinition(e,t,n.defaultValue,n.context);n.handler(r)})}watch(e,t,n,r){this.validateDefaultValue(t);let i=this.handlersMap.get(e),a={handler:n,defaultValue:t,requestedType:typeof t,context:r};return i?i.push(a):this.handlersMap.set(e,[a]),()=>this.unwatch(e,n)}unwatch(e,t){let n=this.handlersMap.get(e);if(n)if(t){let e=n.findIndex(e=>e.handler==t);e>=0&&n?.splice(e,1)}else n.splice(0)}getValue(e,t,n){this.validateDefaultValue(t);let r=this.configSet?.configs[e];return this.getValueFromConfigDefinition(e,r,t,n)}getValueFromConfigDefinition(e,t,n,r){let i=this.contextToEvaluate(r);if(t){let r=this.configEvaluator.evaluate(t,{context:i,metadata:this.metaContext},this.configSet?.segments),a=us(r,n);return this.usageEventCollector.evaluatedConfig({context:i,evaluation:{key:e,type:r.type,defaultValue:n,requestedType:a.requestedType,evaluatedValue:a.parsedValue,evaluatedValueId:a.parsedValueId,usedDefault:a.usedDefault,evaluationReason:a.reason}}),this.dispatchEvaluationEvent({key:e,value:a.parsedValue,valueId:a.parsedValueId??void 0,isDefaultValue:a.usedDefault,reason:a.reason,context:i}),this.logger.debug(`[ConfigDirectorClient] Evaluated '${e}' to '${a.parsedValue}'`),a.parsedValue}else{this.logger.debug(`[ConfigDirectorClient] No config state found for '${e}', returning default value '${n}'`);let t=this.isReady?`config-state-missing`:`client-not-ready`;return this.usageEventCollector.evaluatedConfig({context:i,evaluation:{key:e,defaultValue:n,requestedType:ss(n),evaluatedValue:n,usedDefault:!0,evaluationReason:t}}),this.dispatchEvaluationEvent({key:e,value:n,isDefaultValue:!0,reason:t,context:i}),n}}contextToEvaluate(e){let t=As(e);switch(t.outcome){case`admitted`:return t.context;case`ignored`:Js[this.usageEventCollector.recordInvalidContext(t.kindSample)](this.logger,t.kindSample);return}}dispatchEvaluationEvent(e){setTimeout(()=>this.eventEmitter.emit(`configEvaluated`,{evaluation:e}),0)}validateDefaultValue(e){if(e==null)throw new v(`Invalid default value. The default value for a config must be defined and non-null.`);if(typeof e==`function`)throw new v(`Invalid default value. The default value for a config cannot be a function.`)}get isReady(){return this.ready}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}removeAllObservers(){this.logger.debug(`[ConfigDirectorClient] removeAllObservers() has been called, removing all observers`),this.eventEmitter.removeAllListeners(),this.handlersMap.clear()}unwatchAll(){this.handlersMap.clear()}getAllConfigs(e){let t=this.contextToEvaluate(e?.context);if(!this.configSet)return{};let n=Object.entries(this.configSet.configs),r=e?.configKeys?n.filter(([t])=>e.configKeys?.includes(t)):n;return Object.fromEntries(r.map(([e,n])=>[e,this.configEvaluator.evaluate(n,{context:t,metadata:this.metaContext},this.configSet?.segments)]))}closeConnection(){this.logger.debug(`[ConfigDirectorClient] closeConnection() has been called, closing connection to server`),this.transport.close(),this.ready=!1}clearReadyTimer(){clearTimeout(this.readyTimer),this.readyTimer=void 0}dispose(){this.removeAllObservers(),this.closeConnection(),this.readyResolve?.(!0),this.clearReadyTimer(),this.usageEventCollector.close().catch(e=>{this.logger.warn(`[ConfigDirectorClient] Error flushing telemetry while disposing the client: `,e)})}};const Zs={sdkName:`js-openfeature-server-provider`,sdkVersion:`1.11.1`};var Qs=class e{constructor(t,n){this.metadata={name:e.name},this.runsOn=`server`,this.events=new o,this.client=Xs.from(t,Zs,n),this.readyHandler=()=>{this.events.emit(s.Ready)},this.client.on(`configsUpdated`,({keys:e,removedKeys:t})=>{this.events.emit(s.ConfigurationChanged,{flagsChanged:[...e,...t]})})}async initialize(){await this.client.initialize(),this.client.off(`clientReady`,this.readyHandler),this.client.on(`clientReady`,this.readyHandler)}resolveBooleanEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}resolveStringEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}resolveNumberEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}resolveObjectEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}onClose(){return this.client.dispose(),Promise.resolve()}evaluate(e,t,n){return{value:this.client.getValue(e,t,this.mapContext(n))}}mapContext(e){if(!e)return;let t=(e.targetingKey??e.id)?.toString(),n=e.kind,r=e.name?.toString(),i=e?.traits||{},a=typeof i==`object`&&Object.keys(i).length>0,o=e.anonymous;return{id:t,kind:n,name:r,traits:a?i:void 0,anonymous:typeof o==`boolean`?o:void 0}}};export{y as ConfigDirectorInitializationError,Qs as ConfigDirectorProvider};
5
+ `;break;case`id`:e.value.includes(`\0`)||(this.lastEventId=e.value);break;case`retry`:/^\d+$/.test(e.value)&&this.onRetry?.(Number.parseInt(e.value,10));break;default:break}}parseField(e){let t=e.indexOf(`:`);return t===-1?{field:e,value:``}:{field:e.slice(0,t),value:this.extractValue(e,t+1)}}extractValue(e,t){return e[t]===` `?e.slice(t+1):e.slice(t)}};let C=function(e){return e.OPEN=`open`,e.CLOSED=`closed`,e.CONNECTING=`connecting`,e}({});var ae=class{constructor(e){this.DEFAULT_SHOULD_RECONNECT=()=>!0,this.DEFAULT_CALCULATE_RECONNECT_DELAY=()=>this.serverReconnectionTime,this.reconnectAttempt=0,this.abortController=new AbortController,this._readyState=C.CLOSED,this.serverReconnectionTime=2e3,this.url=e.url.toString(),this.lastEventId=e.lastEventId,this.headers={Accept:`text/event-stream`,...e.headers};let t=e.body;this.body=typeof t==`function`?t:()=>t,this.requestOptions={method:e.method??`GET`,mode:e.mode,credentials:e.credentials,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy},this._fetch=e.fetch??((e,t)=>fetch(e,t)),this._onError=this.resolveCallback(e.onError,()=>{},`onError`),this._onConnect=this.resolveCallback(e.onConnect,()=>{},`onConnect`),this._onDisconnect=this.resolveCallback(e.onDisconnect,()=>{},`onDisconnect`),this._onMessage=this.resolveCallback(e.onMessage,()=>{},`onMessage`),this._onComment=this.resolveCallback(e.onComment,()=>{},`onComment`),this._shouldReconnect=this.resolveCallback(e.shouldReconnect,this.DEFAULT_SHOULD_RECONNECT,`shouldReconnect`),this._calculateReconnectDelay=this.resolveCallback(e.calculateReconnectDelay,this.DEFAULT_CALCULATE_RECONNECT_DELAY,`calculateReconnectDelay`)}set onError(e){this._onError=this.resolveCallback(e,()=>{},`onError`)}set onMessage(e){this._onMessage=this.resolveCallback(e,()=>{},`onMessage`)}set onComment(e){this._onComment=this.resolveCallback(e,()=>{},`onComment`)}set onConnect(e){this._onConnect=this.resolveCallback(e,()=>{},`onConnect`)}set onDisconnect(e){this._onDisconnect=this.resolveCallback(e,()=>{},`onDisconnect`)}set shouldReconnect(e){this._shouldReconnect=this.resolveCallback(e,this.DEFAULT_SHOULD_RECONNECT,`shouldReconnect`)}set calculateReconnectDelay(e){this._calculateReconnectDelay=this.resolveCallback(e,this.DEFAULT_CALCULATE_RECONNECT_DELAY,`shouldReconnect`)}get readyState(){return this._readyState}connect(){this._readyState===C.CLOSED&&(this.reconnectAttempt=0,this.initiateConnection())}close(){clearTimeout(this.reconnectTimeout),this._readyState=C.CLOSED,this.abortController.abort()}initiateConnection(){this.abortController=new AbortController,this._readyState=C.CONNECTING,this._fetch(this.url,{...this.requestOptions,body:this.body(),headers:this.buildRequestHeaders(),signal:this.abortController.signal,cache:`no-store`}).then(e=>this.handleFetchResponse(e)).catch(e=>{if(e.name===`AbortError`||this.abortController.signal.aborted){this.close();return}this._onError(e),this.scheduleReconnect({error:e})})}async handleFetchResponse(e){let{body:t,status:n}=e;if(n===204){this.disconnected();return}if(n>=400){this.scheduleReconnect({status:n});return}if(!t)throw new te(`The server response did not have a body`);this._readyState=C.OPEN,this._onConnect(),this.reconnectAttempt=0;let r=new ie({onEvent:e=>{typeof e.id==`string`&&(this.lastEventId=e.id),this._onMessage(e)},onComment:e=>this._onComment(e),onRetry:e=>this.serverReconnectionTime=e});await this.readResponseStream(t,r),this.scheduleReconnect({status:n,error:new ee(`The server response stream was closed`)})}async readResponseStream(e,t){let n=e.getReader(),r=new TextDecoder,i=!1;for(;!i;){let e=await n.read();e.value&&t.parse(r.decode(e.value,{stream:!0})),i=e.done}t.finish()}disconnected(){clearTimeout(this.reconnectTimeout),this._readyState=C.CLOSED,this._onDisconnect()}buildRequestHeaders(){let e=this.lastEventId?{"Last-Event-ID":this.lastEventId}:void 0;return{...this.headers,...e}}scheduleReconnect(e){if(this.abortController.signal.aborted)return;clearTimeout(this.reconnectTimeout),this.reconnectAttempt+=1;let t={attempt:this.reconnectAttempt,status:e.status,error:e.error,serverReconnectionTime:this.serverReconnectionTime};if(!this._shouldReconnect(t)){this.disconnected();return}this._readyState=C.CONNECTING;let n=this._calculateReconnectDelay(t);(!Number.isFinite(n)||n<1||n>1e3*60*60)&&(this._onError(new re(`The calculated reconnect delay is out of range: ${n}. Defaulting to ${this.serverReconnectionTime}`)),n=this.serverReconnectionTime),this.reconnectTimeout=setTimeout(()=>this.initiateConnection(),n)}resolveCallback(e,t,n){if(e==null)return t;if(typeof e!=`function`)throw new ne(`${n} must be a function`);return e}};const oe=e=>new ae(e),se=async(e,t,n,r)=>{let i=new AbortController,a=setTimeout(()=>{r.debug(`[fetchWithTimeout] Reached timeout, aborting request`),i.abort()},e);try{let e=await fetch(typeof t==`string`||t instanceof Request?t:t.toString(),{...n,signal:i.signal});return clearTimeout(a),e}catch(e){throw r.warn(`[fetchWithTimeout] Fetch error: `,e),clearTimeout(a),e}},ce=9e4;var le=class{constructor(e){this.options=e,this.eventEmitter=new t,this.options=e,this.logger=e.logger,this.url=new URL(`server/sse/v1`,e.baseUrl),this.heartbeatUrl=new URL(`server/heartbeat/v1`,e.baseUrl)}async connect(e){this.eventSource&&this.close();let t=new Promise((e,t)=>{this.eventSource=oe({url:this.url,method:`POST`,headers:{"Content-Type":`application/json`},body:()=>this.buildRequestBody(),onMessage:({data:e})=>{this.dispatchMessage(e)},onConnect:()=>{this.logger.debug(`[StreamingTransport] Connected`),e(this)},shouldReconnect:e=>{let n=!this.isStatusFatal(e.status);if(!n){this.stopHeartbeat();let n=this.prepareFatalError(e.status,e.error);this.eventEmitter.emit(`connectionError`,n),t(n)}return n},calculateReconnectDelay:e=>{let t=2**Math.min(e.attempt,9)*1e3,n=`[StreamingTransport] Scheduling reconnect attempt #${e.attempt} in ${t}ms.`;return e.attempt<=5?this.logger.info(n):this.logger.warn(n),t},onDisconnect:()=>{this.logger.debug(`[StreamingTransport] Disconnected`)}}),this.eventSource.connect()});this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),ce);let n;try{return await Promise.race([t,new Promise(t=>{n=setTimeout(()=>t(this),e)})])}finally{clearTimeout(n)}}get sessionId(){return this._sessionId}sendHeartbeat(){!this.isConnected||!this._sessionId||se(ce,this.heartbeatUrl,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({serverSdkKey:this.options.serverSdkKey,sessionId:this._sessionId})},this.logger).then(e=>{e.ok||this.logger.debug(`[StreamingTransport] Heartbeat failed with status: ${e.status}`)}).catch(e=>{this.logger.debug(`[StreamingTransport] Heartbeat failed: `,e)})}buildRequestBody(){return this._sessionId=r(),JSON.stringify({metaContext:this.options.metaContext,serverSdkKey:this.options.serverSdkKey,sessionId:this._sessionId})}dispatchMessage(e){try{let t=JSON.parse(e);this.eventEmitter.emit(`configBundleReceived`,t)}catch(e){this.logger.error(`[StreamingTransport] Error parsing and dispatching config data update: `,e)}}prepareFatalError(e,t){let n=e??0;return new b(`${`Connection failed with status: ${e??`unknown`}.`}${t?` Error: ${t}.`:``} This is an unrecoverable error, will not attempt to reconnect.`,n)}isStatusFatal(e){return!!e&&e>=400&&e<500&&e!=429}get isConnected(){return this.eventSource?.readyState==`open`}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}clear(){this.eventEmitter.removeAllListeners()}stopHeartbeat(){clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0}close(){this.stopHeartbeat(),this.eventSource?.close()}dispose(){this.close(),this.clear()}},ue=class{constructor(){this.fatalError=!1}clearPollingInterval(){clearInterval(this.pollingInterval)}schedulePollingInterval(e){clearInterval(this.pollingInterval),!(this.pollingIntervalSeconds<=0)&&(this.pollingInterval=setInterval(e,this.pollingIntervalSeconds*1e3))}async handleNonOkResponse(e){if(!e.ok)throw this.isStatusFatal(e.status)?(this.fatalError=!0,this.close(),this.prepareFatalResponseStatusError(e.status,await e.text())):new b(`Connection failed with status: ${e.status}`,e.status)}handleFetchError(e){throw this.isFetchErrorFatal(e)?(this.fatalError=!0,this.close(),new b(`Connection failed with fatal error: ${e}. This is an unrecoverable error, retry attempts will be ignored.`)):e instanceof SyntaxError?new b(`Failed to parse the response from the server: ${e}`):new b(`Connection failed with error: ${e}.`)}prepareFatalResponseStatusError(e,t){let n=e??0;return new b(`${`Connection failed with status: ${e??`unknown`}`}${(t?.trim()?.length??0)>0?` (${t})`:``}. This is an unrecoverable error, retry attempts will be ignored.`,n)}isStatusFatal(e){return!!e&&e>=400&&e<500&&e!=429}isFetchErrorFatal(e){return e?.name===`NotAllowedError`}get isConnected(){return this.pollingInterval!==void 0}close(){clearInterval(this.pollingInterval),this.pollingInterval=void 0}dispose(){this.close(),this.clear()}},de=class extends ue{constructor(e){super(),this.options=e,this.eventEmitter=new t,this._sessionId=r(),this.options=e,this.logger=e.logger,this.url=new URL(`server/polling/v1`,e.baseUrl),this.pollingIntervalSeconds=e.pollingInterval??300}async connect(e){this.clearPollingInterval();try{await this.fetchConfigs(e)}finally{this.fatalError||this.schedulePollingInterval(()=>{this.fetchConfigs(e).catch(e=>{this.logger.error(`[PollingTransport] Error during polling:`,e)})})}return this}get sessionId(){return this._sessionId}async fetchConfigs(e){if(this.fatalError){this.logger.warn(`[PollingTransport] There was a prior unrecoverable error. Ignoring attempt to reconnect.`);return}try{let t=await se(e,this.url,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({metaContext:this.options.metaContext,serverSdkKey:this.options.serverSdkKey,lastUpdateTimestamp:this.lastUpdateTimestamp,sessionId:this._sessionId})},this.logger);if(await this.handleNonOkResponse(t),t.status===200){let e=JSON.parse(await t.text());this.lastUpdateTimestamp=e.timestamp,this.eventEmitter.emit(`configBundleReceived`,e)}}catch(e){try{this.handleFetchError(e)}catch(e){throw this.fatalError&&this.eventEmitter.emit(`connectionError`,e),e}}}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}clear(){this.eventEmitter.removeAllListeners()}};const fe=(e,t)=>{if(e.trim().length==0)throw new x(`Invalid config key. The key of a value cannot be empty.`);return pe(e,t)},pe=(e,t)=>{switch(typeof t){case`boolean`:return{type:`boolean`,value:t?`true`:`false`};case`number`:return me(e,t);case`string`:return{type:`string`,value:t};case`object`:if(t!==null)return ge(e,t,``),{type:`json`,value:JSON.stringify(t)}}throw new x(`Invalid value for '${e}': ${ye(t)}. Use a boolean, a number, a string, a plain object, or an array.`)},me=(e,t)=>{if(!Number.isFinite(t))throw new x(`Invalid value for '${e}': ${ye(t)} is not a finite number.`);if(Number.isInteger(t)){if(!Number.isSafeInteger(t))throw new x(`Invalid value for '${e}': ${t} is not a safe integer, so the SDK could not read it back exactly.`);return{type:`integer`,value:String(t)}}return{type:`float`,value:he(t)}},he=e=>{let t=String(e),n=t.indexOf(`e-`);if(n<0)return t;let r=t.startsWith(`-`)?`-`:``,[i=``,a=``]=t.slice(r.length,n).split(`.`),o=Number(t.slice(n+2))-i.length;return`${r}0.${`0`.repeat(o)}${i}${a}`},ge=(e,t,n)=>{if(!(t===null||typeof t==`boolean`||typeof t==`string`)){if(typeof t==`number`){if(!Number.isFinite(t))throw _e(e,n,`${ye(t)} is not a finite number`);return}if(Array.isArray(t)){t.forEach((t,r)=>ge(e,t,`${n}[${r}]`));return}if(ve(t)){for(let[r,i]of Object.entries(t))ge(e,i,n?`${n}.${r}`:r);return}throw _e(e,n,`${ye(t)} cannot be encoded as JSON`)}},_e=(e,t,n)=>new x(`Invalid value for '${e}'${t?` at '${t}'`:``}: ${n}. JSON contents can hold booleans, finite numbers, strings, null, arrays, and plain objects.`),ve=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},ye=e=>e===null?`null`:typeof e==`function`?`a function`:typeof e==`object`?`a ${e.constructor?.name??`object`} instance`:typeof e==`symbol`?`a symbol`:String(e),be=(e,t,n)=>{let r=fe(t,n);return{id:e,key:t,type:r.type,variations:[{name:null,value:r.value}],target:{defaultValue:r.value,rules:[]}}},xe={environmentId:`offline`,projectId:`offline`};var Se=class{constructor(t){this.source=t,this.emitter=new e,this.connected=!1}async connect(){let e=await Ce(this.source);return this.connected=!0,this.emitter.emit(`configBundleReceived`,{...xe,kind:`full`,configs:e}),this}get isConnected(){return this.connected}on(e,t){this.emitter.on(e,t)}off(e,t){t?this.emitter.off(e,t):this.emitter.removeAllListeners(e)}close(){this.connected=!1}dispose(){this.close(),this.emitter.removeAllListeners()}};const Ce=async e=>{switch(e.kind){case`in-code-defaults`:return{};case`values`:return Te(e.values,`The offline values`);case`file`:return Te(await we(e.path),`The offline values file '${e.path}'`);case`rejected`:throw new S(e.message)}},we=async e=>{let t;try{t=await i(a(e),`utf8`)}catch(t){throw new S(`The offline values file '${e}' could not be read: ${Oe(t)}`)}let n;try{n=JSON.parse(t)}catch(t){throw new S(`The offline values file '${e}' is not valid JSON: ${Oe(t)}`)}if(!Ee(n))throw new S(`The offline values file '${e}' must hold a JSON object with one value per config key, but holds ${De(n)}.`);return n},Te=(e,t)=>{try{return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,be(`offline:${e}`,e,t)]))}catch(e){throw e instanceof x?new S(`${t} could not be loaded. ${e.message}`):e}},Ee=e=>typeof e==`object`&&!!e&&!Array.isArray(e),De=e=>e===null?`null`:Array.isArray(e)?`an array`:`a ${typeof e}`,Oe=e=>e instanceof Error?e.message:String(e),ke=new URL(`https://server-sdk-api.configdirector.com`),Ae=(e,t)=>{if(t?.mode===`offline`)return{kind:`stay-offline`,source:Me(t)};let n=t?.mode??`streaming`;if(!e||e.trim().length==0)throw new x(`No server SDK key was provided, the client cannot be instantiated without a valid server SDK key`);return t?.file!==void 0||t?.values!==void 0?{kind:`stay-offline`,source:{kind:`rejected`,message:`The connection options 'file' and 'values' apply only when the connection mode is 'offline', but the mode is '${n}'.`}}:{kind:`connect`,mode:n,serverSdkKey:e,baseUrl:je(t?.url)}},je=e=>{if(!e)return ke;try{return new URL(e)}catch(t){throw new x(`Invalid base URL '${e}'. Parsing failed: ${t}`)}},Me=e=>e.file!==void 0&&e.values!==void 0?{kind:`rejected`,message:`An offline connection takes either 'file' or 'values', not both.`}:e.file===void 0?e.values===void 0?{kind:`in-code-defaults`}:{kind:`values`,values:e.values}:{kind:`file`,path:e.file},Ne=/^(?:0|[1-9][0-9]*)$/,Pe=/~(?![01])/,Fe=Object.prototype.propertyIsEnumerable,Ie=e=>{if(!Pe.test(e))return e.replace(/~1/g,`/`).replace(/~0/g,`~`)},Le=(e,t)=>{if(Array.isArray(e))return Ne.test(t)&&Fe.call(e,t)?e[Number(t)]:void 0;if(typeof e==`object`&&e)return Fe.call(e,t)?e[t]:void 0},Re=(e,t)=>{if(e===``)return t;if(!e.startsWith(`/`))return;let n=t;for(let t of e.slice(1).split(`/`)){let e=Ie(t);if(e===void 0||(n=Le(n,e),n===void 0))return}return n},ze=(e,t,n)=>{let r=n[0];switch(t.toLowerCase()){case`=`:case`equals`:return r!==void 0&&e===r;case`!=`:case`does not equal`:return r!==void 0&&e!==r;case`is one of`:return n.includes(e);case`is not one of`:return!n.includes(e);case`starts with any of`:return n.some(t=>e.startsWith(t));case`does not start with any of`:return!n.some(t=>e.startsWith(t));case`ends with any of`:return n.some(t=>e.endsWith(t));case`does not end with any of`:return!n.some(t=>e.endsWith(t));default:return!1}},Be=(e,t,n)=>{let r=t.toLowerCase(),i=Ve(e);if(i===void 0)return r===`!=`||r===`does not equal`;let a=n[0];if(a===void 0)return!1;let o=Ve(a);if(o===void 0)return!1;switch(r){case`=`:case`equals`:return i===o;case`!=`:case`does not equal`:return i!==o;case`<`:return i<o;case`<=`:return i<=o;case`>`:return i>o;case`>=`:return i>=o;default:return!1}},Ve=e=>{if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e!=`string`||e.length===0||!He(e))return;let t=Number(e);return Number.isFinite(t)?t:void 0},He=e=>{for(let t of e)if(!(t>=`0`&&t<=`9`)&&!`+-.eE`.includes(t))return!1;return!0};var w=class extends Error{},Ue=class extends w{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},We=class extends w{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Ge=class extends w{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Ke=class extends w{},qe=class extends w{constructor(e){super(`Invalid unit ${e}`)}},T=class extends w{},E=class extends w{constructor(){super(`Zone is an abstract class`)}};const D=`numeric`,O=`short`,k=`long`,Je={year:D,month:D,day:D},Ye={year:D,month:O,day:D},Xe={year:D,month:O,day:D,weekday:O},Ze={year:D,month:k,day:D},Qe={year:D,month:k,day:D,weekday:k},$e={hour:D,minute:D},et={hour:D,minute:D,second:D},tt={hour:D,minute:D,second:D,timeZoneName:O},nt={hour:D,minute:D,second:D,timeZoneName:k},rt={hour:D,minute:D,hourCycle:`h23`},it={hour:D,minute:D,second:D,hourCycle:`h23`},at={hour:D,minute:D,second:D,hourCycle:`h23`,timeZoneName:O},ot={hour:D,minute:D,second:D,hourCycle:`h23`,timeZoneName:k},st={year:D,month:D,day:D,hour:D,minute:D},ct={year:D,month:D,day:D,hour:D,minute:D,second:D},lt={year:D,month:O,day:D,hour:D,minute:D},ut={year:D,month:O,day:D,hour:D,minute:D,second:D},dt={year:D,month:O,day:D,weekday:O,hour:D,minute:D},ft={year:D,month:k,day:D,hour:D,minute:D,timeZoneName:O},pt={year:D,month:k,day:D,hour:D,minute:D,second:D,timeZoneName:O},mt={year:D,month:k,day:D,weekday:k,hour:D,minute:D,timeZoneName:k},ht={year:D,month:k,day:D,weekday:k,hour:D,minute:D,second:D,timeZoneName:k};var gt=class{get type(){throw new E}get name(){throw new E}get ianaName(){return this.name}get isUniversal(){throw new E}offsetName(e,t){throw new E}formatOffset(e,t){throw new E}offset(e){throw new E}equals(e){throw new E}get isValid(){throw new E}};let _t=null;var vt=class e extends gt{static get instance(){return _t===null&&(_t=new e),_t}get type(){return`system`}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Jn(e,t,n)}formatOffset(e,t){return Qn(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type===`system`}get isValid(){return!0}};const yt=new Map;function bt(e){let t=yt.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(`en-US`,{hour12:!1,timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,era:`short`}),yt.set(e,t)),t}const xt={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function St(e,t){let n=e.format(t).replace(/\u200E/g,``),[,r,i,a,o,s,c,l]=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n);return[a,r,i,o,s,c,l]}function Ct(e,t){let n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){let{type:t,value:i}=n[e],a=xt[t];t===`era`?r[a]=i:L(a)||(r[a]=parseInt(i,10))}return r}const wt=new Map;var Tt=class e extends gt{static create(t){let n=wt.get(t);return n===void 0&&wt.set(t,n=new e(t)),n}static resetCache(){wt.clear(),yt.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e}).format(),!0}catch{return!1}}constructor(t){super(),this.zoneName=t,this.valid=e.isValidZone(t)}get type(){return`iana`}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Jn(e,t,n,this.name)}formatOffset(e,t){return Qn(this.offset(e),t)}offset(e){if(!this.valid)return NaN;let t=new Date(e);if(isNaN(t))return NaN;let n=bt(this.name),[r,i,a,o,s,c,l]=n.formatToParts?Ct(n,t):St(n,t);o===`BC`&&(r=-Math.abs(r)+1);let u=Wn({year:r,month:i,day:a,hour:s===24?0:s,minute:c,second:l,millisecond:0}),d=+t,f=d%1e3;return d-=f>=0?f:1e3+f,(u-d)/(60*1e3)}equals(e){return e.type===`iana`&&e.name===this.name}get isValid(){return this.valid}};let Et={};function Dt(e,t={}){let n=JSON.stringify([e,t]),r=Et[n];return r||(r=new Intl.ListFormat(e,t),Et[n]=r),r}const Ot=new Map;function kt(e,t={}){let n=JSON.stringify([e,t]),r=Ot.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,t),Ot.set(n,r)),r}const At=new Map;function jt(e,t={}){let n=JSON.stringify([e,t]),r=At.get(n);return r===void 0&&(r=new Intl.NumberFormat(e,t),At.set(n,r)),r}const Mt=new Map;function Nt(e,t={}){let{base:n,...r}=t,i=JSON.stringify([e,r]),a=Mt.get(i);return a===void 0&&(a=new Intl.RelativeTimeFormat(e,t),Mt.set(i,a)),a}let Pt=null;function Ft(){return Pt||(Pt=new Intl.DateTimeFormat().resolvedOptions().locale,Pt)}const It=new Map;function Lt(e){let t=It.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),It.set(e,t)),t}const Rt=new Map;function zt(e){let t=Rt.get(e);if(!t){let n=new Intl.Locale(e);t=`getWeekInfo`in n?n.getWeekInfo():n.weekInfo,`minimalDays`in t||(t={...Yt,...t}),Rt.set(e,t)}return t}function Bt(e){let t=e.indexOf(`-x-`);t!==-1&&(e=e.substring(0,t));let n=e.indexOf(`-u-`);if(n===-1)return[e];{let t,r;try{t=kt(e).resolvedOptions(),r=e}catch{let i=e.substring(0,n);t=kt(i).resolvedOptions(),r=i}let{numberingSystem:i,calendar:a}=t;return[r,i,a]}}function Vt(e,t,n){return n||t?(e.includes(`-u-`)||(e+=`-u`),n&&(e+=`-ca-${n}`),t&&(e+=`-nu-${t}`),e):e}function Ht(e){let t=[];for(let n=1;n<=12;n++){let r=Y.utc(2009,n,1);t.push(e(r))}return t}function Ut(e){let t=[];for(let n=1;n<=7;n++){let r=Y.utc(2016,11,13+n);t.push(e(r))}return t}function Wt(e,t,n,r){let i=e.listingMode();return i===`error`?null:i===`en`?n(t):r(t)}function Gt(e){return e.numberingSystem&&e.numberingSystem!==`latn`?!1:e.numberingSystem===`latn`||!e.locale||e.locale.startsWith(`en`)||Lt(e.locale).numberingSystem===`latn`}var Kt=class{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:r,floor:i,...a}=n;if(!t||Object.keys(a).length>0){let t={useGrouping:!1,...n};n.padTo>0&&(t.minimumIntegerDigits=n.padTo),this.inf=jt(e,t)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else return B(this.floor?Math.floor(e):Bn(e,3),this.padTo)}},qt=class{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type===`fixed`){let t=-1*(e.offset/60),n=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;e.offset!==0&&Tt.create(n).valid?(r=n,this.dt=e):(r=`UTC`,this.dt=e.offset===0?e:e.setZone(`UTC`).plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type===`system`?this.dt=e:e.zone.type===`iana`?(this.dt=e,r=e.zone.name):(r=`UTC`,this.dt=e.setZone(`UTC`).plus({minutes:e.offset}),this.originalZone=e.zone);let i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=kt(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(``):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if(e.type===`timeZoneName`){let t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}else return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},Jt=class{constructor(e,t,n){this.opts={style:`long`,...n},!t&&jn()&&(this.rtf=Nt(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):_r(t,e,this.opts.numeric,this.opts.style!==`long`)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}};const Yt={firstDay:1,minimalDays:4,weekend:[6,7]};var A=class e{static fromOpts(t){return e.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,n,r,i,a=!1){let o=t||P.defaultLocale;return new e(o||(a?`en-US`:Ft()),n||P.defaultNumberingSystem,r||P.defaultOutputCalendar,Ln(i)||P.defaultWeekSettings,o)}static resetCache(){Pt=null,Ot.clear(),At.clear(),Mt.clear(),It.clear(),Rt.clear()}static fromObject({locale:t,numberingSystem:n,outputCalendar:r,weekSettings:i}={}){return e.create(t,n,r,i)}constructor(e,t,n,r,i){let[a,o,s]=Bt(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=n||s||null,this.weekSettings=r,this.intl=Vt(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached??(this.fastNumbersCached=Gt(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem===`latn`)&&(this.outputCalendar===null||this.outputCalendar===`gregory`);return e&&t?`en`:`intl`}clone(t){return!t||Object.getOwnPropertyNames(t).length===0?this:e.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,Ln(t.weekSettings)||this.weekSettings,t.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Wt(this,e,rr,()=>{let n=this.intl===`ja`||this.intl.startsWith(`ja-`);t&=!n;let r=t?{month:e,day:`numeric`}:{month:e},i=t?`format`:`standalone`;if(!this.monthsCache[i][e]){let t=n?e=>this.dtFormatter(e,r).format():e=>this.extract(e,r,`month`);this.monthsCache[i][e]=Ht(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return Wt(this,e,sr,()=>{let n=t?{weekday:e,year:`numeric`,month:`long`,day:`numeric`}:{weekday:e},r=t?`format`:`standalone`;return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=Ut(e=>this.extract(e,n,`weekday`))),this.weekdaysCache[r][e]})}meridiems(){return Wt(this,void 0,()=>cr,()=>{if(!this.meridiemCache){let e={hour:`numeric`,hourCycle:`h12`};this.meridiemCache=[Y.utc(2016,11,13,9),Y.utc(2016,11,13,19)].map(t=>this.extract(t,e,`dayperiod`))}return this.meridiemCache})}eras(e){return Wt(this,e,fr,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[Y.utc(-40,1,1),Y.utc(2017,1,1)].map(e=>this.extract(e,t,`era`))),this.eraCache[e]})}extract(e,t,n){let r=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===n);return r?r.value:null}numberFormatter(e={}){return new Kt(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new qt(e,this.intl,t)}relFormatter(e={}){return new Jt(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Dt(this.intl,e)}isEnglish(){return this.locale===`en`||this.locale.toLowerCase()===`en-us`||Lt(this.intl).locale.startsWith(`en-us`)}getWeekSettings(){return this.weekSettings?this.weekSettings:Mn()?zt(this.locale):Yt}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}};let Xt=null;var j=class e extends gt{static get utcInstance(){return Xt===null&&(Xt=new e(0)),Xt}static instance(t){return t===0?e.utcInstance:new e(t)}static parseSpecifier(t){if(t){let n=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new e(Yn(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return`fixed`}get name(){return this.fixed===0?`UTC`:`UTC${Qn(this.fixed,`narrow`)}`}get ianaName(){return this.fixed===0?`Etc/UTC`:`Etc/GMT${Qn(-this.fixed,`narrow`)}`}offsetName(){return this.name}formatOffset(e,t){return Qn(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type===`fixed`&&e.fixed===this.fixed}get isValid(){return!0}},Zt=class extends gt{constructor(e){super(),this.zoneName=e}get type(){return`invalid`}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return``}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function M(e,t){if(L(e)||e===null)return t;if(e instanceof gt)return e;if(kn(e)){let n=e.toLowerCase();return n===`default`?t:n===`local`||n===`system`?vt.instance:n===`utc`||n===`gmt`?j.utcInstance:j.parseSpecifier(n)||Tt.create(e)}else if(R(e))return j.instance(e);else if(typeof e==`object`&&`offset`in e&&typeof e.offset==`function`)return e;else return new Zt(e)}const Qt={arab:`[٠-٩]`,arabext:`[۰-۹]`,bali:`[᭐-᭙]`,beng:`[০-৯]`,deva:`[०-९]`,fullwide:`[0-9]`,gujr:`[૦-૯]`,hanidec:`[〇|一|二|三|四|五|六|七|八|九]`,khmr:`[០-៩]`,knda:`[೦-೯]`,laoo:`[໐-໙]`,limb:`[᥆-᥏]`,mlym:`[൦-൯]`,mong:`[᠐-᠙]`,mymr:`[၀-၉]`,orya:`[୦-୯]`,tamldec:`[௦-௯]`,telu:`[౦-౯]`,thai:`[๐-๙]`,tibt:`[༠-༩]`,latn:`\\d`},$t={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},en=Qt.hanidec.replace(/[\[|\]]/g,``).split(``);function tn(e){let t=parseInt(e,10);if(isNaN(t)){t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(e[n].search(Qt.hanidec)!==-1)t+=en.indexOf(e[n]);else for(let e in $t){let[n,i]=$t[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}else return t}const nn=new Map;function rn(){nn.clear()}function N({numberingSystem:e},t=``){let n=e||`latn`,r=nn.get(n);r===void 0&&(r=new Map,nn.set(n,r));let i=r.get(t);return i===void 0&&(i=RegExp(`${Qt[n]}${t}`),r.set(t,i)),i}let an=()=>Date.now(),on=`system`,sn=null,cn=null,ln=null,un=60,dn,fn=null;var P=class{static get now(){return an}static set now(e){an=e}static set defaultZone(e){on=e}static get defaultZone(){return M(on,vt.instance)}static get defaultLocale(){return sn}static set defaultLocale(e){sn=e}static get defaultNumberingSystem(){return cn}static set defaultNumberingSystem(e){cn=e}static get defaultOutputCalendar(){return ln}static set defaultOutputCalendar(e){ln=e}static get defaultWeekSettings(){return fn}static set defaultWeekSettings(e){fn=Ln(e)}static get twoDigitCutoffYear(){return un}static set twoDigitCutoffYear(e){un=e%100}static get throwOnInvalid(){return dn}static set throwOnInvalid(e){dn=e}static resetCaches(){A.resetCache(),Tt.resetCache(),Y.resetCache(),rn()}},F=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};const pn=[0,31,59,90,120,151,181,212,243,273,304,334],mn=[0,31,60,91,121,152,182,213,244,274,305,335];function I(e,t){return new F(`unit out of range`,`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function hn(e,t,n){let r=new Date(Date.UTC(e,t-1,n));e<100&&e>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let i=r.getUTCDay();return i===0?7:i}function gn(e,t,n){return n+(Vn(e)?mn:pn)[t-1]}function _n(e,t){let n=Vn(e)?mn:pn,r=n.findIndex(e=>e<t),i=t-n[r];return{month:r+1,day:i}}function vn(e,t){return(e-t+7)%7+1}function yn(e,t=4,n=1){let{year:r,month:i,day:a}=e,o=gn(r,i,a),s=vn(hn(r,i,a),n),c=Math.floor((o-s+14-t)/7),l;return c<1?(l=r-1,c=Kn(l,t,n)):c>Kn(r,t,n)?(l=r+1,c=1):l=r,{weekYear:l,weekNumber:c,weekday:s,...$n(e)}}function bn(e,t=4,n=1){let{weekYear:r,weekNumber:i,weekday:a}=e,o=vn(hn(r,1,t),n),s=Hn(r),c=i*7+a-o-7+t,l;c<1?(l=r-1,c+=Hn(l)):c>s?(l=r+1,c-=Hn(r)):l=r;let{month:u,day:d}=_n(l,c);return{year:l,month:u,day:d,...$n(e)}}function xn(e){let{year:t,month:n,day:r}=e;return{year:t,ordinal:gn(t,n,r),...$n(e)}}function Sn(e){let{year:t,ordinal:n}=e,{month:r,day:i}=_n(t,n);return{year:t,month:r,day:i,...$n(e)}}function Cn(e,t){if(!L(e.localWeekday)||!L(e.localWeekNumber)||!L(e.localWeekYear)){if(!L(e.weekday)||!L(e.weekNumber)||!L(e.weekYear))throw new Ke(`Cannot mix locale-based week fields with ISO-based week fields`);return L(e.localWeekday)||(e.weekday=e.localWeekday),L(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),L(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function wn(e,t=4,n=1){let r=On(e.weekYear),i=z(e.weekNumber,1,Kn(e.weekYear,t,n)),a=z(e.weekday,1,7);return r?i?a?!1:I(`weekday`,e.weekday):I(`week`,e.weekNumber):I(`weekYear`,e.weekYear)}function Tn(e){let t=On(e.year),n=z(e.ordinal,1,Hn(e.year));return t?n?!1:I(`ordinal`,e.ordinal):I(`year`,e.year)}function En(e){let t=On(e.year),n=z(e.month,1,12),r=z(e.day,1,Un(e.year,e.month));return t?n?r?!1:I(`day`,e.day):I(`month`,e.month):I(`year`,e.year)}function Dn(e){let{hour:t,minute:n,second:r,millisecond:i}=e,a=z(t,0,23)||t===24&&n===0&&r===0&&i===0,o=z(n,0,59),s=z(r,0,59),c=z(i,0,999);return a?o?s?c?!1:I(`millisecond`,i):I(`second`,r):I(`minute`,n):I(`hour`,t)}function L(e){return e===void 0}function R(e){return typeof e==`number`}function On(e){return typeof e==`number`&&e%1==0}function kn(e){return typeof e==`string`}function An(e){return Object.prototype.toString.call(e)===`[object Date]`}function jn(){try{return typeof Intl<`u`&&!!Intl.RelativeTimeFormat}catch{return!1}}function Mn(){try{return typeof Intl<`u`&&!!Intl.Locale&&(`weekInfo`in Intl.Locale.prototype||`getWeekInfo`in Intl.Locale.prototype)}catch{return!1}}function Nn(e){return Array.isArray(e)?e:[e]}function Pn(e,t,n){if(e.length!==0)return e.reduce((e,r)=>{let i=[t(r),r];return e&&n(e[0],i[0])===e[0]?e:i},null)[1]}function Fn(e,t){return t.reduce((t,n)=>(t[n]=e[n],t),{})}function In(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ln(e){if(e==null)return null;if(typeof e!=`object`)throw new T(`Week settings must be an object`);if(!z(e.firstDay,1,7)||!z(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!z(e,1,7)))throw new T(`Invalid week settings`);return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function z(e,t,n){return On(e)&&e>=t&&e<=n}function Rn(e,t){return e-t*Math.floor(e/t)}function B(e,t=2){let n=e<0,r;return r=n?`-`+(``+-e).padStart(t,`0`):(``+e).padStart(t,`0`),r}function V(e){if(!(L(e)||e===null||e===``))return parseInt(e,10)}function H(e){if(!(L(e)||e===null||e===``))return parseFloat(e)}function zn(e){if(!(L(e)||e===null||e===``)){let t=parseFloat(`0.`+e)*1e3;return Math.floor(t)}}function Bn(e,t,n=`round`){let r=10**t;switch(n){case`expand`:return e>0?Math.ceil(e*r)/r:Math.floor(e*r)/r;case`trunc`:return Math.trunc(e*r)/r;case`round`:return Math.round(e*r)/r;case`floor`:return Math.floor(e*r)/r;case`ceil`:return Math.ceil(e*r)/r;default:throw RangeError(`Value rounding ${n} is out of range`)}}function Vn(e){return e%4==0&&(e%100!=0||e%400==0)}function Hn(e){return Vn(e)?366:365}function Un(e,t){let n=Rn(t-1,12)+1,r=e+(t-n)/12;return n===2?Vn(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Wn(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Gn(e,t,n){return-vn(hn(e,1,t),n)+t-1}function Kn(e,t=4,n=1){let r=Gn(e,t,n),i=Gn(e+1,t,n);return(Hn(e)-r+i)/7}function qn(e){return e>99?e:e>P.twoDigitCutoffYear?1900+e:2e3+e}function Jn(e,t,n,r=null){let i=new Date(e),a={hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`};r&&(a.timeZone=r);let o={timeZoneName:t,...a},s=new Intl.DateTimeFormat(n,o).formatToParts(i).find(e=>e.type.toLowerCase()===`timezonename`);return s?s.value:null}function Yn(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);let r=parseInt(t,10)||0,i=n<0||Object.is(n,-0)?-r:r;return n*60+i}function Xn(e){let t=Number(e);if(typeof e==`boolean`||e===``||!Number.isFinite(t))throw new T(`Invalid unit value ${e}`);return t}function Zn(e,t){let n={};for(let r in e)if(In(e,r)){let i=e[r];if(i==null)continue;n[t(r)]=Xn(i)}return n}function Qn(e,t){let n=Math.trunc(Math.abs(e/60)),r=Math.trunc(Math.abs(e%60)),i=e>=0?`+`:`-`;switch(t){case`short`:return`${i}${B(n,2)}:${B(r,2)}`;case`narrow`:return`${i}${n}${r>0?`:${r}`:``}`;case`techie`:return`${i}${B(n,2)}${B(r,2)}`;default:throw RangeError(`Value format ${t} is out of range for property format`)}}function $n(e){return Fn(e,[`hour`,`minute`,`second`,`millisecond`])}const er=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],tr=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],nr=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`];function rr(e){switch(e){case`narrow`:return[...nr];case`short`:return[...tr];case`long`:return[...er];case`numeric`:return[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`,`12`];case`2-digit`:return[`01`,`02`,`03`,`04`,`05`,`06`,`07`,`08`,`09`,`10`,`11`,`12`];default:return null}}const ir=[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],ar=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],or=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function sr(e){switch(e){case`narrow`:return[...or];case`short`:return[...ar];case`long`:return[...ir];case`numeric`:return[`1`,`2`,`3`,`4`,`5`,`6`,`7`];default:return null}}const cr=[`AM`,`PM`],lr=[`Before Christ`,`Anno Domini`],ur=[`BC`,`AD`],dr=[`B`,`A`];function fr(e){switch(e){case`narrow`:return[...dr];case`short`:return[...ur];case`long`:return[...lr];default:return null}}function pr(e){return cr[e.hour<12?0:1]}function mr(e,t){return sr(t)[e.weekday-1]}function hr(e,t){return rr(t)[e.month-1]}function gr(e,t){return fr(t)[e.year<0?0:1]}function _r(e,t,n=`always`,r=!1){let i={years:[`year`,`yr.`],quarters:[`quarter`,`qtr.`],months:[`month`,`mo.`],weeks:[`week`,`wk.`],days:[`day`,`day`,`days`],hours:[`hour`,`hr.`],minutes:[`minute`,`min.`],seconds:[`second`,`sec.`]},a=[`hours`,`minutes`,`seconds`].indexOf(e)===-1;if(n===`auto`&&a){let n=e===`days`;switch(t){case 1:return n?`tomorrow`:`next ${i[e][0]}`;case-1:return n?`yesterday`:`last ${i[e][0]}`;case 0:return n?`today`:`this ${i[e][0]}`}}let o=Object.is(t,-0)||t<0,s=Math.abs(t),c=s===1,l=i[e],u=r?c?l[1]:l[2]||l[1]:c?i[e][0]:e;return o?`${s} ${u} ago`:`in ${s} ${u}`}function vr(e,t){let n=``;for(let r of e)r.literal?n+=r.val:n+=t(r.val);return n}const yr={D:Je,DD:Ye,DDD:Ze,DDDD:Qe,t:$e,tt:et,ttt:tt,tttt:nt,T:rt,TT:it,TTT:at,TTTT:ot,f:st,ff:lt,fff:ft,ffff:mt,F:ct,FF:ut,FFF:pt,FFFF:ht};var U=class e{static create(t,n={}){return new e(t,n)}static parseFormat(e){let t=null,n=``,r=!1,i=[];for(let a=0;a<e.length;a++){let o=e.charAt(a);o===`'`?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:n===``?`'`:n}),t=null,n=``,r=!r):r||o===t?n+=o:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=o,t=o)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return yr[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n=void 0){if(this.opts.forceSimple)return B(e,t);let r={...this.opts};return t>0&&(r.padTo=t),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(t,n){let r=this.loc.listingMode()===`en`,i=this.loc.outputCalendar&&this.loc.outputCalendar!==`gregory`,a=(e,n)=>this.loc.extract(t,e,n),o=e=>t.isOffsetFixed&&t.offset===0&&e.allowZ?`Z`:t.isValid?t.zone.formatOffset(t.ts,e.format):``,s=()=>r?pr(t):a({hour:`numeric`,hourCycle:`h12`},`dayperiod`),c=(e,n)=>r?hr(t,e):a(n?{month:e}:{month:e,day:`numeric`},`month`),l=(e,n)=>r?mr(t,e):a(n?{weekday:e}:{weekday:e,month:`long`,day:`numeric`},`weekday`),u=n=>{let r=e.macroTokenToFormatOpts(n);return r?this.formatWithSystemDefault(t,r):n},d=e=>r?gr(t,e):a({era:e},`era`);return vr(e.parseFormat(n),e=>{switch(e){case`S`:return this.num(t.millisecond);case`u`:case`SSS`:return this.num(t.millisecond,3);case`s`:return this.num(t.second);case`ss`:return this.num(t.second,2);case`uu`:return this.num(Math.floor(t.millisecond/10),2);case`uuu`:return this.num(Math.floor(t.millisecond/100));case`m`:return this.num(t.minute);case`mm`:return this.num(t.minute,2);case`h`:return this.num(t.hour%12==0?12:t.hour%12);case`hh`:return this.num(t.hour%12==0?12:t.hour%12,2);case`H`:return this.num(t.hour);case`HH`:return this.num(t.hour,2);case`Z`:return o({format:`narrow`,allowZ:this.opts.allowZ});case`ZZ`:return o({format:`short`,allowZ:this.opts.allowZ});case`ZZZ`:return o({format:`techie`,allowZ:this.opts.allowZ});case`ZZZZ`:return t.zone.offsetName(t.ts,{format:`short`,locale:this.loc.locale});case`ZZZZZ`:return t.zone.offsetName(t.ts,{format:`long`,locale:this.loc.locale});case`z`:return t.zoneName;case`a`:return s();case`d`:return i?a({day:`numeric`},`day`):this.num(t.day);case`dd`:return i?a({day:`2-digit`},`day`):this.num(t.day,2);case`c`:return this.num(t.weekday);case`ccc`:return l(`short`,!0);case`cccc`:return l(`long`,!0);case`ccccc`:return l(`narrow`,!0);case`E`:return this.num(t.weekday);case`EEE`:return l(`short`,!1);case`EEEE`:return l(`long`,!1);case`EEEEE`:return l(`narrow`,!1);case`L`:return i?a({month:`numeric`,day:`numeric`},`month`):this.num(t.month);case`LL`:return i?a({month:`2-digit`,day:`numeric`},`month`):this.num(t.month,2);case`LLL`:return c(`short`,!0);case`LLLL`:return c(`long`,!0);case`LLLLL`:return c(`narrow`,!0);case`M`:return i?a({month:`numeric`},`month`):this.num(t.month);case`MM`:return i?a({month:`2-digit`},`month`):this.num(t.month,2);case`MMM`:return c(`short`,!1);case`MMMM`:return c(`long`,!1);case`MMMMM`:return c(`narrow`,!1);case`y`:return i?a({year:`numeric`},`year`):this.num(t.year);case`yy`:return i?a({year:`2-digit`},`year`):this.num(t.year.toString().slice(-2),2);case`yyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,4);case`yyyyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,6);case`G`:return d(`short`);case`GG`:return d(`long`);case`GGGGG`:return d(`narrow`);case`kk`:return this.num(t.weekYear.toString().slice(-2),2);case`kkkk`:return this.num(t.weekYear,4);case`W`:return this.num(t.weekNumber);case`WW`:return this.num(t.weekNumber,2);case`n`:return this.num(t.localWeekNumber);case`nn`:return this.num(t.localWeekNumber,2);case`ii`:return this.num(t.localWeekYear.toString().slice(-2),2);case`iiii`:return this.num(t.localWeekYear,4);case`o`:return this.num(t.ordinal);case`ooo`:return this.num(t.ordinal,3);case`q`:return this.num(t.quarter);case`qq`:return this.num(t.quarter,2);case`X`:return this.num(Math.floor(t.ts/1e3));case`x`:return this.num(t.ts);default:return u(e)}})}formatDurationFromString(t,n){let r=this.opts.signMode===`negativeLargestOnly`?-1:1,i=e=>{switch(e[0]){case`S`:return`milliseconds`;case`s`:return`seconds`;case`m`:return`minutes`;case`h`:return`hours`;case`d`:return`days`;case`w`:return`weeks`;case`M`:return`months`;case`y`:return`years`;default:return null}},a=(e,t)=>n=>{let a=i(n);if(a){let i=t.isNegativeDuration&&a!==t.largestUnit?r:1,o;return o=this.opts.signMode===`negativeLargestOnly`&&a!==t.largestUnit?`never`:this.opts.signMode===`all`?`always`:`auto`,this.num(e.get(a)*i,n.length,o)}else return n},o=e.parseFormat(n),s=o.reduce((e,{literal:t,val:n})=>t?e:e.concat(n),[]),c=t.shiftTo(...s.map(i).filter(e=>e));return vr(o,a(c,{isNegativeDuration:c<0,largestUnit:Object.keys(c.values)[0]}))}};const br=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function xr(...e){let t=e.reduce((e,t)=>e+t.source,``);return RegExp(`^${t}$`)}function Sr(...e){return t=>e.reduce(([e,n,r],i)=>{let[a,o,s]=i(t,r);return[{...e,...a},o||n,s]},[{},null,1]).slice(0,2)}function Cr(e,...t){if(e==null)return[null,null];for(let[n,r]of t){let t=n.exec(e);if(t)return r(t)}return[null,null]}function wr(...e){return(t,n)=>{let r={},i;for(i=0;i<e.length;i++)r[e[i]]=V(t[n+i]);return[r,null,n+i]}}const Tr=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Er=`(?:${Tr.source}?(?:\\[(${br.source})\\])?)?`,Dr=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Or=RegExp(`${Dr.source}${Er}`),kr=RegExp(`(?:[Tt]${Or.source})?`),Ar=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,jr=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Mr=/(\d{4})-?(\d{3})/,Nr=wr(`weekYear`,`weekNumber`,`weekDay`),Pr=wr(`year`,`ordinal`),Fr=/(\d{4})-(\d\d)-(\d\d)/,Ir=RegExp(`${Dr.source} ?(?:${Tr.source}|(${br.source}))?`),Lr=RegExp(`(?: ${Ir.source})?`);function Rr(e,t,n){let r=e[t];return L(r)?n:V(r)}function zr(e,t){return[{year:Rr(e,t),month:Rr(e,t+1,1),day:Rr(e,t+2,1)},null,t+3]}function Br(e,t){return[{hours:Rr(e,t,0),minutes:Rr(e,t+1,0),seconds:Rr(e,t+2,0),milliseconds:zn(e[t+3])},null,t+4]}function Vr(e,t){let n=!e[t]&&!e[t+1],r=Yn(e[t+1],e[t+2]);return[{},n?null:j.instance(r),t+3]}function Hr(e,t){return[{},e[t]?Tt.create(e[t]):null,t+1]}const Ur=RegExp(`^T?${Dr.source}$`),Wr=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Gr(e){let[t,n,r,i,a,o,s,c,l]=e,u=t[0]===`-`,d=c&&c[0]===`-`,f=(e,t=!1)=>e!==void 0&&(t||e&&u)?-e:e;return[{years:f(H(n)),months:f(H(r)),weeks:f(H(i)),days:f(H(a)),hours:f(H(o)),minutes:f(H(s)),seconds:f(H(c),c===`-0`),milliseconds:f(zn(l),d)}]}const Kr={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function qr(e,t,n,r,i,a,o){let s={year:t.length===2?qn(V(t)):V(t),month:tr.indexOf(n)+1,day:V(r),hour:V(i),minute:V(a)};return o&&(s.second=V(o)),e&&(s.weekday=e.length>3?ir.indexOf(e)+1:ar.indexOf(e)+1),s}const Jr=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Yr(e){let[,t,n,r,i,a,o,s,c,l,u,d]=e,f=qr(t,i,r,n,a,o,s),p;return p=c?Kr[c]:l?0:Yn(u,d),[f,new j(p)]}function Xr(e){return e.replace(/\([^()]*\)|[\n\t]/g,` `).replace(/(\s\s+)/g,` `).trim()}const Zr=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Qr=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,$r=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function ei(e){let[,t,n,r,i,a,o,s]=e;return[qr(t,i,r,n,a,o,s),j.utcInstance]}function ti(e){let[,t,n,r,i,a,o,s]=e;return[qr(t,s,n,r,i,a,o),j.utcInstance]}const ni=xr(Ar,kr),ri=xr(jr,kr),ii=xr(Mr,kr),ai=xr(Or),oi=Sr(zr,Br,Vr,Hr),si=Sr(Nr,Br,Vr,Hr),ci=Sr(Pr,Br,Vr,Hr),li=Sr(Br,Vr,Hr);function ui(e){return Cr(e,[ni,oi],[ri,si],[ii,ci],[ai,li])}function di(e){return Cr(Xr(e),[Jr,Yr])}function fi(e){return Cr(e,[Zr,ei],[Qr,ei],[$r,ti])}function pi(e){return Cr(e,[Wr,Gr])}const mi=Sr(Br);function hi(e){return Cr(e,[Ur,mi])}const gi=xr(Fr,Lr),_i=xr(Ir),vi=Sr(Br,Vr,Hr);function yi(e){return Cr(e,[gi,oi],[_i,vi])}const bi=`Invalid Duration`,xi={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Si={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...xi},W=146097/400,Ci=146097/4800,wi={years:{quarters:4,months:12,weeks:W/7,days:W,hours:W*24,minutes:W*24*60,seconds:W*24*60*60,milliseconds:W*24*60*60*1e3},quarters:{months:3,weeks:W/28,days:W/4,hours:W*24/4,minutes:W*24*60/4,seconds:W*24*60*60/4,milliseconds:W*24*60*60*1e3/4},months:{weeks:Ci/7,days:Ci,hours:Ci*24,minutes:Ci*24*60,seconds:Ci*24*60*60,milliseconds:Ci*24*60*60*1e3},...xi},Ti=[`years`,`quarters`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`,`milliseconds`],Ei=Ti.slice(0).reverse();function G(e,t,n=!1){return new K({values:n?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix})}function Di(e,t){let n=t.milliseconds??0;for(let r of Ei.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function Oi(e,t){let n=Di(e,t)<0?-1:1;Ti.reduceRight((r,i)=>{if(L(t[i]))return r;if(r){let a=t[r]*n,o=e[i][r],s=Math.floor(a/o);t[i]+=s*n,t[r]-=s*o*n}return i},null),Ti.reduce((n,r)=>{if(L(t[r]))return n;if(n){let i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function ki(e){let t={};for(let[n,r]of Object.entries(e))r!==0&&(t[n]=r);return t}var K=class e{constructor(e){let t=e.conversionAccuracy===`longterm`||!1,n=t?wi:Si;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||A.create(),this.conversionAccuracy=t?`longterm`:`casual`,this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,n){return e.fromObject({milliseconds:t},n)}static fromObject(t,n={}){if(typeof t!=`object`||!t)throw new T(`Duration.fromObject: argument expected to be an object, got ${t===null?`null`:typeof t}`);return new e({values:Zn(t,e.normalizeUnit),loc:A.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(t){if(R(t))return e.fromMillis(t);if(e.isDuration(t))return t;if(typeof t==`object`)return e.fromObject(t);throw new T(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,n){let[r]=pi(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,n){let[r]=hi(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,n=null){if(!t)throw new T(`need to specify a reason the Duration is invalid`);let r=t instanceof F?t:new F(t,n);if(P.throwOnInvalid)throw new Ge(r);return new e({invalid:r})}static normalizeUnit(e){let t={year:`years`,years:`years`,quarter:`quarters`,quarters:`quarters`,month:`months`,months:`months`,week:`weeks`,weeks:`weeks`,day:`days`,days:`days`,hour:`hours`,hours:`hours`,minute:`minutes`,minutes:`minutes`,second:`seconds`,seconds:`seconds`,millisecond:`milliseconds`,milliseconds:`milliseconds`}[e&&e.toLowerCase()];if(!t)throw new qe(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){let n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?U.create(this.loc,n).formatDurationFromString(this,e):bi}toHuman(e={}){if(!this.isValid)return bi;let t=e.showZeros!==!1,n=Ti.map(n=>{let r=this.values[n];return L(r)||r===0&&!t?null:this.loc.numberFormatter({style:`unit`,unitDisplay:`long`,...e,unit:n.slice(0,-1)}).format(r)}).filter(e=>e);return this.loc.listFormatter({type:`conjunction`,style:e.listStyle||`narrow`,...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e=`P`;return this.years!==0&&(e+=this.years+`Y`),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+`M`),this.weeks!==0&&(e+=this.weeks+`W`),this.days!==0&&(e+=this.days+`D`),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+=`T`),this.hours!==0&&(e+=this.hours+`H`),this.minutes!==0&&(e+=this.minutes+`M`),(this.seconds!==0||this.milliseconds!==0)&&(e+=Bn(this.seconds+this.milliseconds/1e3,3)+`S`),e===`P`&&(e+=`T0S`),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:`extended`,...e,includeOffset:!1},Y.fromMillis(t,{zone:`UTC`}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Di(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t),r={};for(let e of Ti)(In(n.values,e)||In(this.values,e))&&(r[e]=n.get(e)+this.get(e));return G(this,{values:r},!0)}minus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let n of Object.keys(this.values))t[n]=Xn(e(this.values[n],n));return G(this,{values:t},!0)}get(t){return this[e.normalizeUnit(t)]}set(t){if(!this.isValid)return this;let n={...this.values,...Zn(t,e.normalizeUnit)};return G(this,{values:n})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){let i={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:n};return G(this,i)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return Oi(this.matrix,e),G(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=ki(this.normalize().shiftToAll().toObject());return G(this,{values:e},!0)}shiftTo(...t){if(!this.isValid||t.length===0)return this;t=t.map(t=>e.normalizeUnit(t));let n={},r={},i=this.toObject(),a;for(let e of Ti)if(t.indexOf(e)>=0){a=e;let t=0;for(let n in r)t+=this.matrix[n][e]*r[n],r[n]=0;R(i[e])&&(t+=i[e]);let o=Math.trunc(t);n[e]=o,r[e]=(t*1e3-o*1e3)/1e3}else R(i[e])&&(r[e]=i[e]);for(let e in r)r[e]!==0&&(n[a]+=e===a?r[e]:r[e]/this.matrix[a][e]);return Oi(this.matrix,n),G(this,{values:n},!0)}shiftToAll(){return this.isValid?this.shiftTo(`years`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`,`milliseconds`):this}negate(){if(!this.isValid)return this;let e={};for(let t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return G(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=ki(this.values);return G(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(e,t){return e===void 0||e===0?t===void 0||t===0:e===t}for(let n of Ti)if(!t(this.values[n],e.values[n]))return!1;return!0}};const Ai=`Invalid Interval`;function ji(e,t){return!e||!e.isValid?Mi.invalid(`missing or invalid start`):!t||!t.isValid?Mi.invalid(`missing or invalid end`):t<e?Mi.invalid(`end before start`,`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null}var Mi=class e{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(t,n=null){if(!t)throw new T(`need to specify a reason the Interval is invalid`);let r=t instanceof F?t:new F(t,n);if(P.throwOnInvalid)throw new We(r);return new e({invalid:r})}static fromDateTimes(t,n){let r=Ma(t),i=Ma(n);return ji(r,i)??new e({start:r,end:i})}static after(t,n){let r=K.fromDurationLike(n),i=Ma(t);return e.fromDateTimes(i,i.plus(r))}static before(t,n){let r=K.fromDurationLike(n),i=Ma(t);return e.fromDateTimes(i.minus(r),i)}static fromISO(t,n){let[r,i]=(t||``).split(`/`,2);if(r&&i){let t,a;try{t=Y.fromISO(r,n),a=t.isValid}catch{a=!1}let o,s;try{o=Y.fromISO(i,n),s=o.isValid}catch{s=!1}if(a&&s)return e.fromDateTimes(t,o);if(a){let r=K.fromISO(i,n);if(r.isValid)return e.after(t,r)}else if(s){let t=K.fromISO(r,n);if(t.isValid)return e.before(o,t)}}return e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e=`milliseconds`){return this.isValid?this.toDuration(e).get(e):NaN}count(e=`milliseconds`,t){if(!this.isValid)return NaN;let n=this.start.startOf(e,t),r;return r=t?.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(e,t),Math.floor(r.diff(n,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:t,end:n}={}){return this.isValid?e.fromDateTimes(t||this.s,n||this.e):this}splitAt(...t){if(!this.isValid)return[];let n=t.map(Ma).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),r=[],{s:i}=this,a=0;for(;i<this.e;){let t=n[a]||this.e,o=+t>+this.e?this.e:t;r.push(e.fromDateTimes(i,o)),i=o,a+=1}return r}splitBy(t){let n=K.fromDurationLike(t);if(!this.isValid||!n.isValid||n.as(`milliseconds`)===0)return[];let{s:r}=this,i=1,a,o=[];for(;r<this.e;){let t=this.start.plus(n.mapUnits(e=>e*i));a=+t>+this.e?this.e:t,o.push(e.fromDateTimes(r,a)),r=a,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(t){if(!this.isValid)return this;let n=this.s>t.s?this.s:t.s,r=this.e<t.e?this.e:t.e;return n>=r?null:e.fromDateTimes(n,r)}union(t){if(!this.isValid)return this;let n=this.s<t.s?this.s:t.s,r=this.e>t.e?this.e:t.e;return e.fromDateTimes(n,r)}static merge(e){let[t,n]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],n)=>t?t.overlaps(n)||t.abutsStart(n)?[e,t.union(n)]:[e.concat([t]),n]:[e,n],[[],null]);return n&&t.push(n),t}static xor(t){let n=null,r=0,i=[],a=t.map(e=>[{time:e.s,type:`s`},{time:e.e,type:`e`}]),o=Array.prototype.concat(...a).sort((e,t)=>e.time-t.time);for(let t of o)r+=t.type===`s`?1:-1,r===1?n=t.time:(n&&+n!=+t.time&&i.push(e.fromDateTimes(n,t.time)),n=null);return e.merge(i)}difference(...t){return e.xor([this].concat(t)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Ai}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Je,t={}){return this.isValid?U.create(this.s.loc.clone(t),e).formatInterval(this):Ai}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Ai}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Ai}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Ai}toFormat(e,{separator:t=` – `}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Ai}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):K.invalid(this.invalidReason)}mapEndpoints(t){return e.fromDateTimes(t(this.s),t(this.e))}},Ni=class{static hasDST(e=P.defaultZone){let t=Y.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Tt.isValidZone(e)}static normalizeZone(e){return M(e,P.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||A.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||A.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||A.create(e)).getWeekendDays().slice()}static months(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||A.create(t,n,i)).months(e)}static monthsFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||A.create(t,n,i)).months(e,!0)}static weekdays(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||A.create(t,n,null)).weekdays(e)}static weekdaysFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||A.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return A.create(e).meridiems()}static eras(e=`short`,{locale:t=null}={}){return A.create(t,null,`gregory`).eras(e)}static features(){return{relative:jn(),localeWeek:Mn()}}};function Pi(e,t){let n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf(`day`).valueOf(),r=n(t)-n(e);return Math.floor(K.fromMillis(r).as(`days`))}function Fi(e,t,n){let r=[[`years`,(e,t)=>t.year-e.year],[`quarters`,(e,t)=>t.quarter-e.quarter+(t.year-e.year)*4],[`months`,(e,t)=>t.month-e.month+(t.year-e.year)*12],[`weeks`,(e,t)=>{let n=Pi(e,t);return(n-n%7)/7}],[`days`,Pi]],i={},a=e,o,s;for(let[c,l]of r)n.indexOf(c)>=0&&(o=c,i[c]=l(e,t),s=a.plus(i),s>t?(i[c]--,e=a.plus(i),e>t&&(s=e,i[c]--,e=a.plus(i))):e=s);return[e,i,s,o]}function Ii(e,t,n,r){let[i,a,o,s]=Fi(e,t,n),c=t-i,l=n.filter(e=>[`hours`,`minutes`,`seconds`,`milliseconds`].indexOf(e)>=0);l.length===0&&(o<t&&(o=i.plus({[s]:1})),o!==i&&(a[s]=(a[s]||0)+c/(o-i)));let u=K.fromObject(a,r);return l.length>0?K.fromMillis(c,r).shiftTo(...l).plus(u):u}function q(e,t=e=>e){return{regex:e,deser:([e])=>t(tn(e))}}const Li=`[ \xA0]`,Ri=new RegExp(Li,`g`);function zi(e){return e.replace(/\./g,`\\.?`).replace(Ri,Li)}function Bi(e){return e.replace(/\./g,``).replace(Ri,` `).toLowerCase()}function J(e,t){return e===null?null:{regex:RegExp(e.map(zi).join(`|`)),deser:([n])=>e.findIndex(e=>Bi(n)===Bi(e))+t}}function Vi(e,t){return{regex:e,deser:([,e,t])=>Yn(e,t),groups:t}}function Hi(e){return{regex:e,deser:([e])=>e}}function Ui(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,`\\$&`)}function Wi(e,t){let n=N(t),r=N(t,`{2}`),i=N(t,`{3}`),a=N(t,`{4}`),o=N(t,`{6}`),s=N(t,`{1,2}`),c=N(t,`{1,3}`),l=N(t,`{1,6}`),u=N(t,`{1,9}`),d=N(t,`{2,4}`),f=N(t,`{4,6}`),p=e=>({regex:RegExp(Ui(e.val)),deser:([e])=>e,literal:!0}),m=(m=>{if(e.literal)return p(m);switch(m.val){case`G`:return J(t.eras(`short`),0);case`GG`:return J(t.eras(`long`),0);case`y`:return q(l);case`yy`:return q(d,qn);case`yyyy`:return q(a);case`yyyyy`:return q(f);case`yyyyyy`:return q(o);case`M`:return q(s);case`MM`:return q(r);case`MMM`:return J(t.months(`short`,!0),1);case`MMMM`:return J(t.months(`long`,!0),1);case`L`:return q(s);case`LL`:return q(r);case`LLL`:return J(t.months(`short`,!1),1);case`LLLL`:return J(t.months(`long`,!1),1);case`d`:return q(s);case`dd`:return q(r);case`o`:return q(c);case`ooo`:return q(i);case`HH`:return q(r);case`H`:return q(s);case`hh`:return q(r);case`h`:return q(s);case`mm`:return q(r);case`m`:return q(s);case`q`:return q(s);case`qq`:return q(r);case`s`:return q(s);case`ss`:return q(r);case`S`:return q(c);case`SSS`:return q(i);case`u`:return Hi(u);case`uu`:return Hi(s);case`uuu`:return q(n);case`a`:return J(t.meridiems(),0);case`kkkk`:return q(a);case`kk`:return q(d,qn);case`W`:return q(s);case`WW`:return q(r);case`E`:case`c`:return q(n);case`EEE`:return J(t.weekdays(`short`,!1),1);case`EEEE`:return J(t.weekdays(`long`,!1),1);case`ccc`:return J(t.weekdays(`short`,!0),1);case`cccc`:return J(t.weekdays(`long`,!0),1);case`Z`:case`ZZ`:return Vi(RegExp(`([+-]${s.source})(?::(${r.source}))?`),2);case`ZZZ`:return Vi(RegExp(`([+-]${s.source})(${r.source})?`),2);case`z`:return Hi(/[a-z_+-/]{1,256}?/i);case` `:return Hi(/[^\S\n\r]/);default:return p(m)}})(e)||{invalidReason:`missing Intl.DateTimeFormat.formatToParts support`};return m.token=e,m}const Gi={year:{"2-digit":`yy`,numeric:`yyyyy`},month:{numeric:`M`,"2-digit":`MM`,short:`MMM`,long:`MMMM`},day:{numeric:`d`,"2-digit":`dd`},weekday:{short:`EEE`,long:`EEEE`},dayperiod:`a`,dayPeriod:`a`,hour12:{numeric:`h`,"2-digit":`hh`},hour24:{numeric:`H`,"2-digit":`HH`},minute:{numeric:`m`,"2-digit":`mm`},second:{numeric:`s`,"2-digit":`ss`},timeZoneName:{long:`ZZZZZ`,short:`ZZZ`}};function Ki(e,t,n){let{type:r,value:i}=e;if(r===`literal`){let e=/^\s+$/.test(i);return{literal:!e,val:e?` `:i}}let a=t[r],o=r;r===`hour`&&(o=t.hour12==null?t.hourCycle==null?n.hour12?`hour12`:`hour24`:t.hourCycle===`h11`||t.hourCycle===`h12`?`hour12`:`hour24`:t.hour12?`hour12`:`hour24`);let s=Gi[o];if(typeof s==`object`&&(s=s[a]),s)return{literal:!1,val:s}}function qi(e){return[`^${e.map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,``)}$`,e]}function Ji(e,t,n){let r=e.match(t);if(r){let e={},t=1;for(let i in n)if(In(n,i)){let a=n[i],o=a.groups?a.groups+1:1;!a.literal&&a.token&&(e[a.token.val[0]]=a.deser(r.slice(t,t+o))),t+=o}return[r,e]}else return[r,{}]}function Yi(e){let t=e=>{switch(e){case`S`:return`millisecond`;case`s`:return`second`;case`m`:return`minute`;case`h`:case`H`:return`hour`;case`d`:return`day`;case`o`:return`ordinal`;case`L`:case`M`:return`month`;case`y`:return`year`;case`E`:case`c`:return`weekday`;case`W`:return`weekNumber`;case`k`:return`weekYear`;case`q`:return`quarter`;default:return null}},n=null,r;return L(e.z)||(n=Tt.create(e.z)),L(e.Z)||(n||(n=new j(e.Z)),r=e.Z),L(e.q)||(e.M=(e.q-1)*3+1),L(e.h)||(e.h<12&&e.a===1?e.h+=12:e.h===12&&e.a===0&&(e.h=0)),e.G===0&&e.y&&(e.y=-e.y),L(e.u)||(e.S=zn(e.u)),[Object.keys(e).reduce((n,r)=>{let i=t(r);return i&&(n[i]=e[r]),n},{}),n,r]}let Xi=null;function Zi(){return Xi||(Xi=Y.fromMillis(1555555555555)),Xi}function Qi(e,t){if(e.literal)return e;let n=ra(U.macroTokenToFormatOpts(e.val),t);return n==null||n.includes(void 0)?e:n}function $i(e,t){return Array.prototype.concat(...e.map(e=>Qi(e,t)))}var ea=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=$i(U.parseFormat(t),e),this.units=this.tokens.map(t=>Wi(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){let[e,t]=qi(this.units);this.regex=RegExp(e,`i`),this.handlers=t}}explainFromTokens(e){if(this.isValid){let[t,n]=Ji(e,this.regex,this.handlers),[r,i,a]=n?Yi(n):[null,null,void 0];if(In(n,`a`)&&In(n,`H`))throw new Ke(`Can't include meridiem when specifying 24-hour format`);return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:r,zone:i,specificOffset:a}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function ta(e,t,n){return new ea(e,n).explainFromTokens(t)}function na(e,t,n){let{result:r,zone:i,specificOffset:a,invalidReason:o}=ta(e,t,n);return[r,i,a,o]}function ra(e,t){if(!e)return null;let n=U.create(t,e).dtFormatter(Zi()),r=n.formatToParts(),i=n.resolvedOptions();return r.map(t=>Ki(t,e,i))}const ia=`Invalid DateTime`,aa=864e13;function oa(e){return new F(`unsupported zone`,`the zone "${e.name}" is not supported`)}function sa(e){return e.weekData===null&&(e.weekData=yn(e.c)),e.weekData}function ca(e){return e.localWeekData===null&&(e.localWeekData=yn(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function la(e,t){let n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new Y({...n,...t,old:n})}function ua(e,t,n){let r=e-t*60*1e3,i=n.offset(r);if(t===i)return[r,t];r-=(i-t)*60*1e3;let a=n.offset(r);return i===a?[r,i]:[e-Math.min(i,a)*60*1e3,Math.max(i,a)]}function da(e,t){e+=t*60*1e3;let n=new Date(e);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function fa(e,t,n){return ua(Wn(e),t,n)}function pa(e,t){let n=e.o,r=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+Math.trunc(t.quarters)*3,a={...e.c,year:r,month:i,day:Math.min(e.c.day,Un(r,i))+Math.trunc(t.days)+Math.trunc(t.weeks)*7},o=K.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as(`milliseconds`),[s,c]=ua(Wn(a),n,e.zone);return o!==0&&(s+=o,c=e.zone.offset(s)),{ts:s,o:c}}function ma(e,t,n,r,i,a){let{setZone:o,zone:s}=n;if(e&&Object.keys(e).length!==0||t){let r=t||s,i=Y.fromObject(e,{...n,zone:r,specificOffset:a});return o?i:i.setZone(s)}else return Y.invalid(new F(`unparsable`,`the input "${i}" can't be parsed as ${r}`))}function ha(e,t,n=!0){return e.isValid?U.create(A.create(`en-US`),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function ga(e,t,n){let r=e.c.year>9999||e.c.year<0,i=``;if(r&&e.c.year>=0&&(i+=`+`),i+=B(e.c.year,r?6:4),n===`year`)return i;if(t){if(i+=`-`,i+=B(e.c.month),n===`month`)return i;i+=`-`}else if(i+=B(e.c.month),n===`month`)return i;return i+=B(e.c.day),i}function _a(e,t,n,r,i,a,o){let s=!n||e.c.millisecond!==0||e.c.second!==0,c=``;switch(o){case`day`:case`month`:case`year`:break;default:if(c+=B(e.c.hour),o===`hour`)break;if(t){if(c+=`:`,c+=B(e.c.minute),o===`minute`)break;s&&(c+=`:`,c+=B(e.c.second))}else{if(c+=B(e.c.minute),o===`minute`)break;s&&(c+=B(e.c.second))}if(o===`second`)break;s&&(!r||e.c.millisecond!==0)&&(c+=`.`,c+=B(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&e.offset===0&&!a?c+=`Z`:e.o<0?(c+=`-`,c+=B(Math.trunc(-e.o/60)),c+=`:`,c+=B(Math.trunc(-e.o%60))):(c+=`+`,c+=B(Math.trunc(e.o/60)),c+=`:`,c+=B(Math.trunc(e.o%60)))),a&&(c+=`[`+e.zone.ianaName+`]`),c}const va={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ya={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},ba={ordinal:1,hour:0,minute:0,second:0,millisecond:0},xa=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],Sa=[`weekYear`,`weekNumber`,`weekday`,`hour`,`minute`,`second`,`millisecond`],Ca=[`year`,`ordinal`,`hour`,`minute`,`second`,`millisecond`];function wa(e){let t={year:`year`,years:`year`,month:`month`,months:`month`,day:`day`,days:`day`,hour:`hour`,hours:`hour`,minute:`minute`,minutes:`minute`,quarter:`quarter`,quarters:`quarter`,second:`second`,seconds:`second`,millisecond:`millisecond`,milliseconds:`millisecond`,weekday:`weekday`,weekdays:`weekday`,weeknumber:`weekNumber`,weeksnumber:`weekNumber`,weeknumbers:`weekNumber`,weekyear:`weekYear`,weekyears:`weekYear`,ordinal:`ordinal`}[e.toLowerCase()];if(!t)throw new qe(e);return t}function Ta(e){switch(e.toLowerCase()){case`localweekday`:case`localweekdays`:return`localWeekday`;case`localweeknumber`:case`localweeknumbers`:return`localWeekNumber`;case`localweekyear`:case`localweekyears`:return`localWeekYear`;default:return wa(e)}}function Ea(e){if(Aa===void 0&&(Aa=P.now()),e.type!==`iana`)return e.offset(Aa);let t=e.name,n=ja.get(t);return n===void 0&&(n=e.offset(Aa),ja.set(t,n)),n}function Da(e,t){let n=M(t.zone,P.defaultZone);if(!n.isValid)return Y.invalid(oa(n));let r=A.fromObject(t),i,a;if(L(e.year))i=P.now();else{for(let t of xa)L(e[t])&&(e[t]=va[t]);let t=En(e)||Dn(e);if(t)return Y.invalid(t);let r=Ea(n);[i,a]=fa(e,r,n)}return new Y({ts:i,zone:n,loc:r,o:a})}function Oa(e,t,n){let r=L(n.round)?!0:n.round,i=L(n.rounding)?`trunc`:n.rounding,a=(e,a)=>(e=Bn(e,r||n.calendary?0:2,n.calendary?`round`:i),t.loc.clone(n).relFormatter(n).format(e,a)),o=r=>n.calendary?t.hasSame(e,r)?0:t.startOf(r).diff(e.startOf(r),r).get(r):t.diff(e,r).get(r);if(n.unit)return a(o(n.unit),n.unit);for(let e of n.units){let t=o(e);if(Math.abs(t)>=1)return a(t,e)}return a(e>t?-0:0,n.units[n.units.length-1])}function ka(e){let t={},n;return e.length>0&&typeof e[e.length-1]==`object`?(t=e[e.length-1],n=Array.from(e).slice(0,e.length-1)):n=Array.from(e),[t,n]}let Aa;const ja=new Map;var Y=class e{constructor(e){let t=e.zone||P.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new F(`invalid input`):null)||(t.isValid?null:oa(t));this.ts=L(e.ts)?P.now():e.ts;let r=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{let a=R(e.o)&&!e.old?e.o:t.offset(this.ts);r=da(this.ts,a),n=Number.isNaN(r.year)?new F(`invalid input`):null,r=n?null:r,i=n?null:a}this._zone=t,this.loc=e.loc||A.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new e({})}static local(){let[e,t]=ka(arguments),[n,r,i,a,o,s,c]=t;return Da({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static utc(){let[e,t]=ka(arguments),[n,r,i,a,o,s,c]=t;return e.zone=j.utcInstance,Da({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static fromJSDate(t,n={}){let r=An(t)?t.valueOf():NaN;if(Number.isNaN(r))return e.invalid(`invalid input`);let i=M(n.zone,P.defaultZone);return i.isValid?new e({ts:r,zone:i,loc:A.fromObject(n)}):e.invalid(oa(i))}static fromMillis(t,n={}){if(!R(t))throw new T(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`);return t<-aa||t>aa?e.invalid(`Timestamp out of range`):new e({ts:t,zone:M(n.zone,P.defaultZone),loc:A.fromObject(n)})}static fromSeconds(t,n={}){if(R(t))return new e({ts:t*1e3,zone:M(n.zone,P.defaultZone),loc:A.fromObject(n)});throw new T(`fromSeconds requires a numerical input`)}static fromObject(t,n={}){t=t||{};let r=M(n.zone,P.defaultZone);if(!r.isValid)return e.invalid(oa(r));let i=A.fromObject(n),a=Zn(t,Ta),{minDaysInFirstWeek:o,startOfWeek:s}=Cn(a,i),c=P.now(),l=L(n.specificOffset)?r.offset(c):n.specificOffset,u=!L(a.ordinal),d=!L(a.year),f=!L(a.month)||!L(a.day),p=d||f,m=a.weekYear||a.weekNumber;if((p||u)&&m)throw new Ke(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(f&&u)throw new Ke(`Can't mix ordinal dates with month/day`);let h=m||a.weekday&&!p,g,_,v=da(c,l);h?(g=Sa,_=ya,v=yn(v,o,s)):u?(g=Ca,_=ba,v=xn(v)):(g=xa,_=va);let y=!1;for(let e of g){let t=a[e];L(t)?y?a[e]=_[e]:a[e]=v[e]:y=!0}let b=(h?wn(a,o,s):u?Tn(a):En(a))||Dn(a);if(b)return e.invalid(b);let[x,S]=fa(h?bn(a,o,s):u?Sn(a):a,l,r),ee=new e({ts:x,zone:r,o:S,loc:i});return a.weekday&&p&&t.weekday!==ee.weekday?e.invalid(`mismatched weekday`,`you can't specify both a weekday of ${a.weekday} and a date of ${ee.toISO()}`):ee.isValid?ee:e.invalid(ee.invalid)}static fromISO(e,t={}){let[n,r]=ui(e);return ma(n,r,t,`ISO 8601`,e)}static fromRFC2822(e,t={}){let[n,r]=di(e);return ma(n,r,t,`RFC 2822`,e)}static fromHTTP(e,t={}){let[n,r]=fi(e);return ma(n,r,t,`HTTP`,t)}static fromFormat(t,n,r={}){if(L(t)||L(n))throw new T(`fromFormat requires an input string and a format`);let{locale:i=null,numberingSystem:a=null}=r,[o,s,c,l]=na(A.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),t,n);return l?e.invalid(l):ma(o,s,r,`format ${n}`,t,c)}static fromString(t,n,r={}){return e.fromFormat(t,n,r)}static fromSQL(e,t={}){let[n,r]=yi(e);return ma(n,r,t,`SQL`,e)}static invalid(t,n=null){if(!t)throw new T(`need to specify a reason the DateTime is invalid`);let r=t instanceof F?t:new F(t,n);if(P.throwOnInvalid)throw new Ue(r);return new e({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let n=ra(e,A.fromObject(t));return n?n.map(e=>e?e.val:null).join(``):null}static expandFormat(e,t={}){return $i(U.parseFormat(e),A.fromObject(t)).map(e=>e.val).join(``)}static resetCache(){Aa=void 0,ja.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?sa(this).weekYear:NaN}get weekNumber(){return this.isValid?sa(this).weekNumber:NaN}get weekday(){return this.isValid?sa(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?ca(this).weekday:NaN}get localWeekNumber(){return this.isValid?ca(this).weekNumber:NaN}get localWeekYear(){return this.isValid?ca(this).weekYear:NaN}get ordinal(){return this.isValid?xn(this.c).ordinal:NaN}get monthShort(){return this.isValid?Ni.months(`short`,{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Ni.months(`long`,{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Ni.weekdays(`short`,{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Ni.weekdays(`long`,{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:`short`,locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:`long`,locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,t=6e4,n=Wn(this.c),r=this.zone.offset(n-e),i=this.zone.offset(n+e),a=this.zone.offset(n-r*t),o=this.zone.offset(n-i*t);if(a===o)return[this];let s=n-a*t,c=n-o*t,l=da(s,a),u=da(c,o);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[la(this,{ts:s}),la(this,{ts:c})]:[this]}get isInLeapYear(){return Vn(this.year)}get daysInMonth(){return Un(this.year,this.month)}get daysInYear(){return this.isValid?Hn(this.year):NaN}get weeksInWeekYear(){return this.isValid?Kn(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Kn(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:n,calendar:r}=U.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(j.instance(e),t)}toLocal(){return this.setZone(P.defaultZone)}setZone(t,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(t=M(t,P.defaultZone),t.equals(this.zone))return this;if(t.isValid){let e=this.ts;if(n||r){let n=t.offset(this.ts),r=this.toObject();[e]=fa(r,n,t)}return la(this,{ts:e,zone:t})}else return e.invalid(oa(t))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){let r=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return la(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=Zn(e,Ta),{minDaysInFirstWeek:n,startOfWeek:r}=Cn(t,this.loc),i=!L(t.weekYear)||!L(t.weekNumber)||!L(t.weekday),a=!L(t.ordinal),o=!L(t.year),s=!L(t.month)||!L(t.day),c=o||s,l=t.weekYear||t.weekNumber;if((c||a)&&l)throw new Ke(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(s&&a)throw new Ke(`Can't mix ordinal dates with month/day`);let u;i?u=bn({...yn(this.c,n,r),...t},n,r):L(t.ordinal)?(u={...this.toObject(),...t},L(t.day)&&(u.day=Math.min(Un(u.year,u.month),u.day))):u=Sn({...xn(this.c),...t});let[d,f]=fa(u,this.o,this.zone);return la(this,{ts:d,o:f})}plus(e){if(!this.isValid)return this;let t=K.fromDurationLike(e);return la(this,pa(this,t))}minus(e){if(!this.isValid)return this;let t=K.fromDurationLike(e).negate();return la(this,pa(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let n={},r=K.normalizeUnit(e);switch(r){case`years`:n.month=1;case`quarters`:case`months`:n.day=1;case`weeks`:case`days`:n.hour=0;case`hours`:n.minute=0;case`minutes`:n.second=0;case`seconds`:n.millisecond=0;break}if(r===`weeks`)if(t){let e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(n.weekNumber=this.weekNumber-1),n.weekday=e}else n.weekday=1;return r===`quarters`&&(n.month=(Math.ceil(this.month/3)-1)*3+1),this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?U.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):ia}toLocaleString(e=Je,t={}){return this.isValid?U.create(this.loc.clone(t),e).formatDateTime(this):ia}toLocaleParts(e={}){return this.isValid?U.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e=`extended`,suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:a=`milliseconds`}={}){if(!this.isValid)return null;a=wa(a);let o=e===`extended`,s=ga(this,o,a);return xa.indexOf(a)>=3&&(s+=`T`),s+=_a(this,o,t,n,r,i,a),s}toISODate({format:e=`extended`,precision:t=`day`}={}){return this.isValid?ga(this,e===`extended`,wa(t)):null}toISOWeekDate(){return ha(this,`kkkk-'W'WW-c`)}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:a=`extended`,precision:o=`milliseconds`}={}){return this.isValid?(o=wa(o),(r&&xa.indexOf(o)>=3?`T`:``)+_a(this,a===`extended`,t,e,n,i,o)):null}toRFC2822(){return ha(this,`EEE, dd LLL yyyy HH:mm:ss ZZZ`,!1)}toHTTP(){return ha(this.toUTC(),`EEE, dd LLL yyyy HH:mm:ss 'GMT'`)}toSQLDate(){return this.isValid?ga(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let r=`HH:mm:ss.SSS`;return(t||e)&&(n&&(r+=` `),t?r+=`z`:e&&(r+=`ZZ`)),ha(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():ia}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t=`milliseconds`,n={}){if(!this.isValid||!e.isValid)return K.invalid(`created by diffing an invalid DateTime`);let r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=Nn(t).map(K.normalizeUnit),a=e.valueOf()>this.valueOf(),o=Ii(a?this:e,a?e:this,i,r);return a?o.negate():o}diffNow(t=`milliseconds`,n={}){return this.diff(e.now(),t,n)}until(e){return this.isValid?Mi.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;let r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=r&&r<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(t={}){if(!this.isValid)return null;let n=t.base||e.fromObject({},{zone:this.zone}),r=t.padding?this<n?-t.padding:t.padding:0,i=[`years`,`months`,`days`,`hours`,`minutes`,`seconds`],a=t.unit;return Array.isArray(t.unit)&&(i=t.unit,a=void 0),Oa(n,this.plus(r),{...t,numeric:`always`,units:i,unit:a})}toRelativeCalendar(t={}){return this.isValid?Oa(t.base||e.fromObject({},{zone:this.zone}),this,{...t,numeric:`auto`,units:[`years`,`months`,`days`],calendary:!0}):null}static min(...t){if(!t.every(e.isDateTime))throw new T(`min requires all arguments be DateTimes`);return Pn(t,e=>e.valueOf(),Math.min)}static max(...t){if(!t.every(e.isDateTime))throw new T(`max requires all arguments be DateTimes`);return Pn(t,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){let{locale:r=null,numberingSystem:i=null}=n;return ta(A.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(t,n,r={}){return e.fromFormatExplain(t,n,r)}static buildFormatParser(e,t={}){let{locale:n=null,numberingSystem:r=null}=t;return new ea(A.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0}),e)}static fromFormatParser(t,n,r={}){if(L(t)||L(n))throw new T(`fromFormatParser requires an input string and a format parser`);let{locale:i=null,numberingSystem:a=null}=r,o=A.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});if(!o.equals(n.locale))throw new T(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${n.locale}`);let{result:s,zone:c,specificOffset:l,invalidReason:u}=n.explainFromTokens(t);return u?e.invalid(u):ma(s,c,r,`format ${n.format}`,t,l)}static get DATE_SHORT(){return Je}static get DATE_MED(){return Ye}static get DATE_MED_WITH_WEEKDAY(){return Xe}static get DATE_FULL(){return Ze}static get DATE_HUGE(){return Qe}static get TIME_SIMPLE(){return $e}static get TIME_WITH_SECONDS(){return et}static get TIME_WITH_SHORT_OFFSET(){return tt}static get TIME_WITH_LONG_OFFSET(){return nt}static get TIME_24_SIMPLE(){return rt}static get TIME_24_WITH_SECONDS(){return it}static get TIME_24_WITH_SHORT_OFFSET(){return at}static get TIME_24_WITH_LONG_OFFSET(){return ot}static get DATETIME_SHORT(){return st}static get DATETIME_SHORT_WITH_SECONDS(){return ct}static get DATETIME_MED(){return lt}static get DATETIME_MED_WITH_SECONDS(){return ut}static get DATETIME_MED_WITH_WEEKDAY(){return dt}static get DATETIME_FULL(){return ft}static get DATETIME_FULL_WITH_SECONDS(){return pt}static get DATETIME_HUGE(){return mt}static get DATETIME_HUGE_WITH_SECONDS(){return ht}};function Ma(e){if(Y.isDateTime(e))return e;if(e&&e.valueOf&&R(e.valueOf()))return Y.fromJSDate(e);if(e&&typeof e==`object`)return Y.fromObject(e);throw new T(`Unknown datetime argument: ${e}, of type ${typeof e}`)}const Na=(e,t,n)=>{let r=n[0];if(r===void 0)return!1;let i=Pa(e),a=Pa(r);if(i===void 0||a===void 0)return!1;switch(t){case`is after`:return i>a;case`is before`:return i<a;default:return!1}},Pa=e=>{let t=Y.fromISO(e,{zone:`utc`});return t.isValid?t.toMillis():void 0};var Fa=_(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),Ia=_(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),La=_(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=Fa(),a=Ia();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),Ra=_(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),za=_(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),X=_(((e,t)=>{let n=Ia(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=Fa(),{safeRe:a,t:o}=La(),s=Ra(),{compareIdentifiers:c}=za();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[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(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&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)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}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{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),Ba=_(((e,t)=>{let n=X();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),Va=_(((e,t)=>{let n=Ba();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),Ha=_(((e,t)=>{let n=Ba();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),Ua=_(((e,t)=>{let n=X();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),Wa=_(((e,t)=>{let n=Ba();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),Ga=_(((e,t)=>{let n=X();t.exports=(e,t)=>new n(e,t).major})),Ka=_(((e,t)=>{let n=X();t.exports=(e,t)=>new n(e,t).minor})),qa=_(((e,t)=>{let n=X();t.exports=(e,t)=>new n(e,t).patch})),Ja=_(((e,t)=>{let n=Ba();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),Z=_(((e,t)=>{let n=X();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Ya=_(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(t,e,r)})),Xa=_(((e,t)=>{let n=Z();t.exports=(e,t)=>n(e,t,!0)})),Za=_(((e,t)=>{let n=X();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Qa=_(((e,t)=>{let n=Za();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),$a=_(((e,t)=>{let n=Za();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),eo=_(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)>0})),to=_(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)<0})),no=_(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)===0})),ro=_(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)!==0})),io=_(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)>=0})),ao=_(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)<=0})),oo=_(((e,t)=>{let n=no(),r=ro(),i=eo(),a=io(),o=to(),s=ao();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),so=_(((e,t)=>{let n=X(),r=Ba(),{safeRe:i,t:a}=La();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t=t||{};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),co=_(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),Q=_(((e,t)=>{let n=/\s+/g;t.exports=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 a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,C(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>ie(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let b=[..._.values()];return r.set(t,b),b}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(ae(this.set[t],e,this.options))return!0;return!1}};let r=new(co()),i=Ra(),a=lo(),o=Ia(),s=X(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=La(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=Fa(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=S(e,t),o(`caret`,e),e=b(e,t),o(`tildes`,e),e=te(e,t),o(`xrange`,e),e=re(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,b=(e,t)=>e.trim().split(/\s+/).map(e=>x(e,t)).join(` `),x=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},S=(e,t)=>e.trim().split(/\s+/).map(e=>ee(e,t)).join(` `),ee=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},te=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>ne(e,t)).join(` `)),ne=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},re=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),ie=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),C=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),ae=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),lo=_(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=Ra(),{safeRe:i,t:a}=La(),o=oo(),s=Ia(),c=X(),l=Q()})),uo=_(((e,t)=>{let n=Q();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),fo=_(((e,t)=>{let n=Q();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),po=_(((e,t)=>{let n=X(),r=Q();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),mo=_(((e,t)=>{let n=X(),r=Q();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),ho=_(((e,t)=>{let n=X(),r=Q(),i=eo();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),go=_(((e,t)=>{let n=Q();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),_o=_(((e,t)=>{let n=X(),r=lo(),{ANY:i}=r,a=Q(),o=uo(),s=eo(),c=to(),l=ao(),u=io();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o=o||e,s=s||e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),vo=_(((e,t)=>{let n=_o();t.exports=(e,t,r)=>n(e,t,`>`,r)})),yo=_(((e,t)=>{let n=_o();t.exports=(e,t,r)=>n(e,t,`<`,r)})),bo=_(((e,t)=>{let n=Q();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),xo=_(((e,t)=>{let n=uo(),r=Z();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||(o=e)):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),So=_(((e,t)=>{let n=Q(),r=lo(),{ANY:i}=r,a=uo(),o=Z(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i=i||t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),Co=y(_(((e,t)=>{let n=La(),r=Fa(),i=X(),a=za();t.exports={parse:Ba(),valid:Va(),clean:Ha(),inc:Ua(),diff:Wa(),major:Ga(),minor:Ka(),patch:qa(),prerelease:Ja(),compare:Z(),rcompare:Ya(),compareLoose:Xa(),compareBuild:Za(),sort:Qa(),rsort:$a(),gt:eo(),lt:to(),eq:no(),neq:ro(),gte:io(),lte:ao(),cmp:oo(),coerce:so(),Comparator:lo(),Range:Q(),satisfies:uo(),toComparators:fo(),maxSatisfying:po(),minSatisfying:mo(),minVersion:ho(),validRange:go(),outside:_o(),gtr:vo(),ltr:yo(),intersects:bo(),simplifyRange:xo(),subset:So(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}))(),1);const wo=(e,t,n)=>{let r=t.toLowerCase();if(e.trim().length===0)return r===`is not one of`;let i=Co.coerce(e),a=n.map(e=>Co.coerce(e)),o=a[0]??null;switch(r){case`=`:return To(i,o);case`<`:return Eo(i,o,Co.lt);case`<=`:return Eo(i,o,Co.lte);case`>`:return Eo(i,o,Co.gt);case`>=`:return Eo(i,o,Co.gte);case`is one of`:return a.some(e=>To(i,e));case`is not one of`:return!a.some(e=>To(i,e));default:return!1}},To=(e,t)=>e!==null&&t!==null&&Co.eq(e,t),Eo=(e,t,n)=>e!==null&&t!==null&&n(e,t),Do=Symbol(`absent`),Oo=Symbol(`unknown-attribute`),ko=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`,Ao=e=>e===Do||e==null?``:ko(e)?jo(e):``,jo=e=>typeof e==`string`?e:String(e),Mo=e=>e===Do?void 0:e,No=e=>e===Oo?`unknown-attribute`:e===Do?`absent`:ko(e)?`scalar`:Array.isArray(e)?`array`:`object`,Po=(e,t,n)=>{let r=t.toLowerCase();if(!Array.isArray(e))return r===`does not contain any of`;let i=e.filter(ko).map(jo);switch(r){case`contains any of`:return i.some(e=>n.includes(e));case`does not contain any of`:return!i.some(e=>n.includes(e));default:return!1}},Fo=e=>e?.context?.kind??`user`;var Io=class{evaluate(e,t){return this.explain(e,t).matched}explain(e,t){let n=this.resolve(e,t),r=No(n),i=n===Do||n===Oo?void 0:n;return n===Oo?{matched:!1,resolvedValue:i,resolvedType:r}:{matched:this.compare(e,n),resolvedValue:i,resolvedType:r}}compare(e,t){let n=e.targetValues??[];switch(e.targetType){case`text`:return ze(Ao(t),e.operator,n);case`number`:return Be(Mo(t),e.operator,n);case`datetime`:return Na(Ao(t),e.operator,n);case`semver`:return wo(Ao(t),e.operator,n);case`array`:return Po(Mo(t),e.operator,n)}return!1}resolve(e,t){switch(e.attribute){case`identifier`:return Lo(t?.context?.id);case`name`:return Lo(t?.context?.name);case`kind`:return Fo(t);case`appName`:return Lo(t?.metadata?.appName);case`appVersion`:return Lo(t?.metadata?.appVersion);case`traits`:return e.trait?Lo(Re(e.trait,t?.context?.traits)):Do;default:return Oo}}};const Lo=e=>e??Do;var Ro=class{constructor(e){this.conditionEvaluator=e}explain(e,t,n){let r=t?.[e.segmentId];if(r===void 0||!zo(r))return{matched:!1,segmentFound:!1,matchedGroupIndex:void 0};let i=this.matchingGroupIndex(r,n),a=i!==void 0;return{matched:this.operatorHolds(e,a),segmentFound:!0,matchedGroupIndex:i}}operatorHolds(e,t){switch(e.operator.toLowerCase()){case`in`:return t;case`not in`:return!t;default:return!1}}matchingGroupIndex(e,t){let n=(e.groups??[]).findIndex(e=>(e??[]).every(e=>this.conditionEvaluator.evaluate(e,t)));return n===-1?void 0:n}};const zo=e=>(e.groups??[]).every(e=>(e??[]).every(e=>e.kind===void 0||e.kind===`attribute`));function Bo(e,t){let n=e*t;return BigInt.asUintN(64,n)^n>>64n}function Vo(e,t){let n=e*t;return BigInt.asUintN(64,n)^n>>64n^e^t}new DataView(new Uint8Array(8).buffer);var Ho=new DataView(new Uint8Array(8).buffer);function Uo(e,t){return Ho.setUint32(0,e.getUint32(t,!0),!0),Ho.getBigUint64(0,!0)}function $(e,t){return e.getBigUint64(t,!0)}new DataView(new Uint8Array(8).buffer),new DataView(new Uint8Array(8).buffer);var Wo=new TextEncoder,Go=2048,Ko=Go/3,qo=new Uint8Array(Go);function Jo(e){if(typeof e==`string`){if(e.length<=Ko){let{written:t}=Wo.encodeInto(e,qo);return new DataView(qo.buffer,0,t)}let t=Wo.encode(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}return e instanceof Uint8Array?new DataView(e.buffer,e.byteOffset,e.byteLength):e}var Yo=`fast`;function Xo(e){return e>=0n&&e<=18446744073709551615n}function Zo(e,t){let n={seed:t,rapidMumBehaviour:Yo};if(e===void 0)return n;if(e.seed!==void 0){if(!Xo(e.seed))throw Error(`seed must be a 64-bit unsigned bigint value: ${e.seed}`);n.seed=e.seed}return e.rapidMumBehaviour!==void 0&&(n.rapidMumBehaviour=e.rapidMumBehaviour),n}var Qo=0n,$o=[3257665815644502181n,10067880064238660809n,5418857496715711651n,5573817676018592327n,11562461410679940143n,16646288086500911323n,10443028834174122124n,12297829382473034410n],es=new Uint8Array(8),ts=new DataView(es.buffer);function ns(e,t){let n=e.getUint8(0);return es[6]=n>>3,es[5]=n<<5,es[0]=e.getUint8(t-1),ts.getBigUint64(0,!0)}function rs(e,t,n,r){let i=e*t,a=(BigInt.asUintN(64,i)^n[7])*(i>>64n^n[1]^r);return BigInt.asUintN(64,a)^a>>64n}function is(e,t,n,r){let i=e*t,a=BigInt.asUintN(64,i)^n[7]^e,o=i>>64n^n[1]^r^t,s=a*o;return BigInt.asUintN(64,s)^s>>64n^a^o}var as={fast:{rapid_mix:Bo,rapidhash_epilogue:rs},protected:{rapid_mix:Vo,rapidhash_epilogue:is}};function os(e,t,n,r,i){let a=e.byteLength,o=BigInt(e.byteLength);t^=r(t^n[2],n[1]);let s,c,l=a,u;if(a<=16)if(u=o,a>=4)if(t^=o,a>=8){let t=a-8;s=$(e,0),c=$(e,t)}else{let t=a-4;s=Uo(e,0),c=Uo(e,t)}else a>0?(s=ns(e,a),c=BigInt(e.getUint8(a>>1))):(s=0n,c=0n);else{let i=0;if(l>112){let a=t,o=t,s=t,c=t,u=t,d=t;do t=r($(e,i)^n[0],$(e,i+8)^t),a=r($(e,i+16)^n[1],$(e,i+24)^a),o=r($(e,i+32)^n[2],$(e,i+40)^o),s=r($(e,i+48)^n[3],$(e,i+56)^s),c=r($(e,i+64)^n[4],$(e,i+72)^c),u=r($(e,i+80)^n[5],$(e,i+88)^u),d=r($(e,i+96)^n[6],$(e,i+104)^d),i+=112,l-=112;while(l>112);t^=a,o^=s,c^=u,t^=d,o^=c,t^=o}u=BigInt(l),l>16&&(t=r($(e,i)^n[2],$(e,i+8)^t),l>32&&(t=r($(e,i+16)^n[2],$(e,i+24)^t),l>48&&(t=r($(e,i+32)^n[1],$(e,i+40)^t),l>64&&(t=r($(e,i+48)^n[1],$(e,i+56)^t),l>80&&(t=r($(e,i+64)^n[2],$(e,i+72)^t),l>96&&(t=r($(e,i+80)^n[1],$(e,i+88)^t))))))),s=$(e,i+l-16)^u,c=$(e,i+l-8)}return s^=n[1],c^=t,i(s,c,n,u)}function ss(e,t){let{seed:n,rapidMumBehaviour:r}=Zo(t,Qo),{rapid_mix:i,rapidhash_epilogue:a}=as[r];return os(Jo(e),n,$o,i,a)}const cs=({configId:e,contextIdentifier:t,contextKind:n})=>{let r=n===`user`?`${t}-${e}`:`${t}-${e}:${n}`;return Number(ss(r,{seed:15426857351n})%1000n)/10};var ls=class{constructor(e){if(this.logger=e,this.conditionEvaluator=new Io,this.segmentEvaluator=new Ro(this.conditionEvaluator),!e||!e.warn||!e.error||!e.info)throw TypeError(`The provided logger is not a valid 'ConfigDirectorLogger'`);this.logger=e}evaluate(e,t,n){let r=this.explain(e,t,n);return{id:e.id,key:e.key,type:e.type,value:r.value,valueId:r.valueId}}explain(e,t,n){let r=[...e.target?.rules??[]].sort((e,t)=>(e.order??2**53-1)-(t.order??2**53-1)),i=[],a;for(let o of r){if(a){i.push({ruleId:o.id,outcome:`not-evaluated`,conditions:[],bucket:void 0});continue}let r=this.explainRule(o,e,t,n);i.push(r.explanation),r.served!==void 0&&(a={ruleId:o.id,...r.served})}return a?{value:a.value,valueId:a.valueId,servedBy:{kind:`rule`,ruleId:a.ruleId},rules:i}:{value:e.target?.defaultValue,valueId:e.target?.defaultValueId,servedBy:{kind:`default`},rules:i}}explainRule(e,t,n,r){let i={ruleId:e.id,outcome:`not-matched`,conditions:[],bucket:void 0};try{let a;return e.type==`percentage`?a=this.explainPercentage(e.percentages??[],t,n,i):e.type==`conditional`&&(a=this.explainConditionalRule(e,t,n,r,i)),a!==void 0&&(i.outcome=`matched`),{explanation:i,served:a}}catch(n){return this.logger.warn(`There was an error while evaluating a targeting rule '${e?.id}' for '${t?.key}'. The rule will be disregarded.`,{error:n,configKey:t?.key,ruleId:e?.id}),{explanation:{ruleId:e.id,outcome:`errored`,conditions:[],bucket:void 0},served:void 0}}}explainPercentage(e,t,n,r){let i=n?.context?.id??void 0,a=i===void 0?0:cs({configId:t.id,contextIdentifier:i,contextKind:Fo(n)}),o=[],s=0,c;for(let t of e){let e=s+t.percentage;o.push({percentageId:t.id,from:s,to:e,value:t.value?.toString()}),c===void 0&&a<e&&(c=t),s=e}return r.bucket={identifier:i,defaultedToPredefinedBucket:i===void 0,assignedPercentage:a,shares:o,selectedPercentageId:c?.id},c?.value==null?void 0:{value:c.value.toString(),valueId:c.valueId}}explainConditionalRule(e,t,n,r,i){let a=!1;for(let t of e.conditions??[]){if(a){i.conditions.push({conditionId:t.id,outcome:`not-evaluated`});continue}let e=this.explainCondition(t,n,r);i.conditions.push(e),a=e.outcome!==`matched`}if(!a){if(e.target==`value`)return e.value==null?void 0:{value:e.value.toString(),valueId:e.valueId};if(e.target==`percentage`)return this.explainPercentage(e.percentages??[],t,n,i)}}explainCondition(e,t,n){if(e.kind===`segment`){let r=this.segmentEvaluator.explain(e,n,t);return{conditionId:e.id,kind:`segment`,outcome:r.matched?`matched`:`not-matched`,segmentId:e.segmentId,segmentFound:r.segmentFound,matchedGroupIndex:r.matchedGroupIndex}}let r=this.conditionEvaluator.explain(e,t);return{conditionId:e.id,kind:`attribute`,outcome:r.matched?`matched`:`not-matched`,resolvedValue:r.resolvedValue,resolvedType:r.resolvedType}}};const us=e=>{let t=typeof e;if(t===`object`)try{return e.constructor?.name??t}catch{return t}else if(t===`function`)try{let n=e.name;return n?`function: ${n}`:t}catch{return t}return t},ds=e=>e===`number`||e===`bigint`,fs=new Set([`boolean`,`integer`,`float`]),ps=(e,t)=>{let n=e.value,r=us(t);if(n==null||n===``)return{parsedValue:t,parsedValueId:void 0,requestedType:r,usedDefault:!0,reason:`value-missing`};if(e.type===`json`)return ys(n,t,r,e.valueId);if(typeof t==`string`)return fs.has(e.type)?{parsedValue:t,parsedValueId:void 0,requestedType:r,usedDefault:!0,reason:`type-mismatch`}:{parsedValue:n,parsedValueId:e.valueId,requestedType:r,usedDefault:!1,reason:`found-match`};if(typeof t==`boolean`&&(e.type===`boolean`||e.type===`string`||e.type===`enum`)){let i=ms(n),a=typeof i==`boolean`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-boolean`}}if(ds(typeof t)&&e.type===`integer`){let i=hs(n),a=typeof i==`number`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-number`}}if(ds(typeof t)&&(e.type===`float`||e.type===`enum`||e.type===`string`)){let i=gs(n),a=typeof i==`number`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-number`}}return{parsedValue:t,parsedValueId:void 0,requestedType:r,usedDefault:!0,reason:`type-mismatch`}},ms=e=>{if(!e)return;let t=e.toLowerCase();if(!(t!=`true`&&t!=`false`))return t===`true`},hs=e=>{let t=_s(e);return t==null?void 0:Math.trunc(t)},gs=e=>_s(e),_s=e=>{if(!e||!vs(e))return;let t=Number(e);if(!(isNaN(t)||!isFinite(t)))return t},vs=e=>{for(let t of e)if(!(t>=`0`&&t<=`9`)&&!`+-.eE`.includes(t))return!1;return!0},ys=(e,t,n,r)=>{if(typeof t==`string`)return{parsedValue:e,parsedValueId:r,requestedType:n,usedDefault:!1,reason:`found-match`};try{let i=JSON.parse(e);return bs(i,t)?{parsedValue:i,parsedValueId:r,requestedType:n,usedDefault:!1,reason:`found-match`}:{parsedValue:t,parsedValueId:void 0,requestedType:n,usedDefault:!0,reason:`type-mismatch`}}catch{return{parsedValue:t,parsedValueId:void 0,requestedType:n,usedDefault:!0,reason:`invalid-json`}}},bs=(e,t)=>e===null?!1:xs(e)===xs(t),xs=e=>{if(Array.isArray(e))return`array`;let t=typeof e;return t===`bigint`?`number`:t},Ss={off:-1,error:0,warn:1,info:2,debug:3},Cs=()=>{let e={year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`};try{return new Intl.DateTimeFormat(void 0,{...e,fractionalSecondDigits:3})}catch{return new Intl.DateTimeFormat(void 0,e)}};var ws=class{constructor(e,t){this.level=e,this.decorator=t,this.level=e,this.decorator=t,this.dateFormatter=Cs()}debug(e,...t){this.log(console.debug,`debug`,e,...t)}info(e,...t){this.log(console.info,`info`,e,...t)}warn(e,...t){this.log(console.warn,`warn`,e,...t)}error(e,...t){this.log(console.error,`error`,e,...t)}log(e,t,n,...r){Ss[this.level]>=Ss[t]&&e(`[${this.dateFormatter.format(new Date)}] ${this.decorator?.decorateMessage(n)}`,...r)}},Ts=class{decorateMessage(e){return`[ConfigDirector:js-server-sdk] ${e}`}};const Es=(e,t)=>new ws(e??`warn`,t??new Ts),Ds=(e,t)=>new URL(e,t?.toString()),Os=(e,t)=>e===void 0?{seconds:t.defaultSeconds,warning:void 0}:e>=t.minimumSeconds?{seconds:e,warning:void 0}:{seconds:t.minimumSeconds,warning:`pollingInterval of ${e} seconds is below the minimum of ${t.minimumSeconds} seconds. Using ${t.minimumSeconds} seconds.`},ks=e=>e>=`a`&&e<=`z`||e>=`0`&&e<=`9`||e===`-`||e===`_`,As=e=>{if(e.length<1||e.length>64)return!1;for(let t of e)if(!ks(t))return!1;return!0},js=e=>e==null||typeof e==`string`&&As(e),Ms=e=>{if(typeof e==`string`)return e;try{return String(e)}catch{return Object.prototype.toString.call(e)}},Ns=(e,t)=>{let n=``,r=0;for(let i of e){if(r===t)break;n+=i,r+=1}return n},Ps=e=>{let t=e?.kind;return js(t)?{outcome:`admitted`,context:e}:{outcome:`ignored`,kindSample:Ns(Ms(t),128)}};var Fs=class{constructor(){this.countsByKindSample=new Map,this.countBeyondSampleLimit=0}record(e){return this.startTime??(this.startTime=new Date),this.add(e,1)}absorb(e){for(let t of e)(this.startTime===void 0||t.startTime<this.startTime)&&(this.startTime=t.startTime),this.add(t.event.kindSample,t.count)}add(e,t){if(e!==void 0){let n=this.countsByKindSample.get(e);if(n!==void 0)return this.countsByKindSample.set(e,n+t),`known-kind-sample`;if(this.countsByKindSample.size<20)return this.countsByKindSample.set(e,t),`new-kind-sample`}let n=this.countBeyondSampleLimit===0;return this.countBeyondSampleLimit+=t,n?`first-beyond-sample-limit`:`beyond-sample-limit`}takeSnapshot(){let e=new Date,t=this.startTime??e,n=(n,r)=>({startTime:t,endTime:e,count:n,event:{reason:`invalid-context-kind`,kindSample:r}}),r=Array.from(this.countsByKindSample,([e,t])=>n(t,e)),i=this.countBeyondSampleLimit>0?[...r,n(this.countBeyondSampleLimit)]:r;return this.clear(),i}clear(){this.countsByKindSample.clear(),this.countBeyondSampleLimit=0,this.startTime=void 0}};const Is=async(e,t)=>e.valueId?{valueId:e.valueId}:e.value?e.value.length<=500&&e.type!=`json`?{value:e.value}:{valueId:await t(e.value)}:e,Ls=e=>{if(e.type===`json`||e.type==null&&typeof e.value==`object`){if(e.valueId)return{valueId:e.valueId,type:`json`};try{return{value:JSON.stringify(e.value),type:`json`}}catch{return{value:e.value.toString(),type:`json`}}}let t=e.value?.toString();return t&&t.length<=500?{value:t}:e.valueId?{valueId:e.valueId}:{value:t}},Rs=e=>{let t=Object.keys(e);if(t.length==0)return!0;for(let n of t)if((e[n]?.length??0)>0)return!1;return!0},zs=e=>{if(!e)return!0;let t=Object.keys(e);if(t.length==0)return!0;for(let n of t)if((e[n]??0)>0)return!1;return!0};var Bs=class{constructor(e){this.executeRequests=!0,this.sdkKey=e.sdkKey,this.sdkIdentity=e.sdkIdentity,this.logger=e.logger,this.metaContext=e.metaContext,this.url=new URL(`server/telemetry/v1`,e.baseUrl.toString())}async report({discreteEvents:e,aggregatedEvents:t,droppedEvents:n}){if(!this.executeRequests)return{success:!1,fatalError:!0};let r={serverSdkKey:this.sdkKey,metaContext:{sdkName:this.sdkIdentity.sdkName,sdkVersion:this.sdkIdentity.sdkVersion,appName:this.metaContext.appName,appVersion:this.metaContext.appVersion},discreteEvents:e,aggregatedEvents:t,droppedEvents:n};if(this.isReportEmpty(r))return{success:!0,fatalError:!1};let i=await this.sendReport(r);return i.fatalError&&(this.executeRequests=!1),i}isReportEmpty(e){return Rs(e.discreteEvents)&&Rs(e.aggregatedEvents)&&zs(e.droppedEvents)}async sendReport(e){try{let t=await se(5e3,this.url,{method:`POST`,body:JSON.stringify(e)},this.logger),n=this.isStatusFatal(t.status);return n&&this.logger.warn(`[EventReporter] Received a fatal status response (${t.status}) from the telemetry endpoint. No more telemetry data will be sent.`),{success:t.ok,fatalError:n}}catch(e){return this.logger.warn(`[EventReporter] Error attempting to send telemetry data: ${e}`,{error:e}),{success:!1,fatalError:!1}}}isStatusFatal(e){return!!e&&e>=400&&e<500&&e!=429}},Vs=class{aggregate(e){if(e.events.length==0)return[];let t=new Map;for(let n of e.events){let e=JSON.stringify(n),r=t.get(e)?.count||0;t.set(e,{event:n,count:r+1})}return Array.from(t).map(([,t])=>({startTime:e.startTime,endTime:e.endTime,count:t.count,event:t.event}))}},Hs=class{constructor(e){this._events=[],this._droppedEventCount=0,this.limit=e??1e3}get events(){return this._events}get reachedLimit(){return this._events.length>=this.limit}get droppedEventCount(){return this._droppedEventCount}push(...e){this.startTime||(this.startTime=new Date);let t=Math.max(0,e.length-this.limit),n=e.slice(t,e.length);if(this._droppedEventCount+=t,this._events.length+n.length>this.limit){let e=this._events.length+n.length-this.limit;this._events.splice(0,e),this._droppedEventCount+=e}return this._events.push(...n)}takeSnapshot(){let e=new Date,t=this.startTime??e,n=this._events.splice(0),r=this._droppedEventCount;return this.startTime=void 0,this._droppedEventCount=0,{startTime:t,endTime:e,events:n,droppedCount:r}}clear(){this._events=[],this.startTime=void 0,this._droppedEventCount=0}},Us=class{constructor(e){this.aggregator=new Vs,this.collectEvents=!0,this.started=!1,this.logger=e.logger,this.evaluationEventQueue=new Hs(e.evaluationQueueLimit??1e3),this.flushIntervalDelay=e.flushIntervalDelay??3e4,this.initialFlushIntervalDelay=e.initialFlushIntervalDelay??5e3}start(){this.started||!this.collectEvents||(this.started=!0,this.flushTimeout=setTimeout(()=>this.flushAndScheduleNext(),this.initialFlushIntervalDelay))}async flushAndScheduleNext(){if(!this.collectEvents)return;let e;try{e=await this.flush()}catch(t){this.logger.warn(`[TelemetryEventCollector] Error flushing telemetry events: `,t),e={success:!1,fatalError:!1}}e.fatalError?(this.collectEvents=!1,this.close(),this.logger.warn(`[TelemetryEventCollector] Received a fatal error from telemetry collection. No longer collecting events.`)):this.collectEvents&&(this.cancelScheduledFlush(),this.flushTimeout=setTimeout(()=>this.flushAndScheduleNext(),this.flushIntervalDelay))}cancelScheduledFlush(){clearTimeout(this.flushTimeout)}async close(){this.collectEvents=!1,clearTimeout(this.flushTimeout);try{await this.flush()}catch(e){this.logger.warn(`[TelemetryEventCollector] Error flushing telemetry events during close: `,e)}this.evaluationEventQueue.clear()}dispose(){this.close()}},Ws=class extends Map{constructor(e,t){super(t),this._droppedCount=0,this.limit=e,this.enforceLimit()}set(e,t){return super.set(e,t),this.enforceLimit(),this}get droppedCount(){return this._droppedCount}clearAndReset(){this.clear(),this._droppedCount=0}enforceLimit(){for(;this.size>this.limit;){let e=this.keys().next().value;e!==void 0&&(this.delete(e),this._droppedCount+=1)}}},Gs=class{constructor(e){this.valueIdGenerator=e,this.valueIdGenerator=e}async process(e){let t=await Promise.all(e.events.map(async e=>({...e,defaultValue:await Is(e.defaultValue,this.valueIdGenerator),evaluatedValue:await Is(e.evaluatedValue,this.valueIdGenerator)})));return{...e,events:t}}},Ks=class extends Us{constructor(e){super(e),this.invalidContextSubmissions=new Fs,this.reporter=new Bs(e),this.contexts=new Ws(e.contextLimit??1e3),this.evaluationEventSnapshotPreprocessor=new Gs(e.valueIdGenerator)}evaluatedConfig(e){if(!this.collectEvents)return;let t=e.context??void 0,n=Fo({context:t}),r=t?.anonymous?void 0:t?.id;r&&this.contexts.set(`${n}:${r}`,{...t,kind:n});let i={...e.evaluation,contextId:r,contextKind:r===void 0?void 0:n};this.evaluationEventQueue.push(this.sanitizeEvaluatedConfigEvent(i))}recordInvalidContext(e){return this.invalidContextSubmissions.record(e)}sanitizeEvaluatedConfigEvent(e){return{...e,defaultValue:Ls({value:e.defaultValue,type:e.type}),evaluatedValue:Ls({value:e.evaluatedValue,valueId:e.evaluatedValueId,type:e.type})}}snapshotContexts(){let e=Array.from(this.contexts.values()),t=this.contexts.droppedCount;return this.contexts.clearAndReset(),{contexts:e,droppedCount:t}}async flush(){if(!this.reporter)return{success:!1,fatalError:!1};let e=await this.evaluationEventSnapshotPreprocessor.process(this.evaluationEventQueue.takeSnapshot()),t=this.snapshotContexts();return await this.reporter?.report({context:this._context,discreteEvents:{capturedContexts:t.contexts},aggregatedEvents:{evaluatedConfig:this.aggregator.aggregate(e),invalidContext:this.invalidContextSubmissions.takeSnapshot()},droppedEvents:{evaluatedConfig:e.droppedCount,capturedContexts:t.droppedCount}})}};const qs={start:()=>{},evaluatedConfig:()=>{},recordInvalidContext:()=>`new-kind-sample`,close:async()=>{}},Js=(e,t)=>{let n=BigInt(0),r=BigInt(62),i=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``),a=BigInt(`0x`+i),o=``;for(;a>n;)o=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`[Number(a%r)]+o,a/=r;return o.padStart(t,`0`)},Ys=Math.ceil(128/Math.log2(62)),Xs=async e=>Js(n(`sha256`).update(e?.toString()??``).digest().subarray(0,16),Ys),Zs={streaming:`The client will continue to retry since there were no fatal errors detected. Configs will return the default value until the connection succeeds.`,polling:`Since the client was configured without streaming, configs may not update and always return the default value.`},Qs={"new-kind-sample":(e,t)=>e.error(`[ConfigDirectorClient] Ignored a context with the invalid kind '${t}' and evaluated as if no context was supplied. A context kind has 1 to 64 characters, using only lowercase letters, digits, '-' and '_'.`),"known-kind-sample":()=>{},"first-beyond-sample-limit":e=>e.error(`[ConfigDirectorClient] Ignored a context with another invalid kind and evaluated as if no context was supplied. 20 different invalid kinds were logged recently, so further invalid kinds are not logged individually.`),"beyond-sample-limit":()=>{}},$s=(e,t)=>(e.target?.rules??[]).some(e=>e.type===`conditional`&&(e.conditions??[]).some(e=>e.kind===`segment`&&t.has(e.segmentId)));var ec=class t{static from(e,n,r){return typeof e==`object`?new t(void 0,n,e):new t(e,n,r)}constructor(t,n,r,i){this.handlersMap=new Map,this.eventEmitter=new e,this.ready=!1,this.logger=r?.logger??Es(),this.timeout=r?.connection?.timeout??3e3,this.metaContext=r?.metadata??{},this.connectionPlan=Ae(t,r?.connection),this.configEvaluator=new ls(this.logger),this.usageEventCollector=i?.telemetry??this.buildTelemetryClient(n,r),this.transport=i?.transport??this.buildTransport(n,r),this.transport.on(`configBundleReceived`,e=>{this.readyResolve?.(!1);let t=this.findKeysRemovedBy(e);!this.configSet||e.kind==`full`?this.configSet=e:(this.configSet.configs={...this.configSet.configs,...e.configs},this.configSet.segments={...this.configSet.segments,...e.segments});let n=this.findKeysUpdatedBy(e);this.eventEmitter.emit(`configsUpdated`,{keys:n,removedKeys:t}),this.updateWatchers([...n,...t]),this.logger.debug(`[ConfigDirectorClient] ConfigSet updated from server with ${n.length} key(s) and ${t.length} removed key(s)`,{keys:n,removedKeys:t})}),this.transport.on(`connectionError`,e=>{this.logger.error(`[ConfigDirectorClient] The connection encountered an unrecoverable error and will not be retried. Configs will no longer receive updates.`,e),this.eventEmitter.emit(`connectionError`,{error:e})}),this.registerHandler(`clientReady`,r?.hooks?.clientReady),this.registerHandler(`configEvaluated`,r?.hooks?.configEvaluated),this.registerHandler(`configsUpdated`,r?.hooks?.configsUpdated),this.registerHandler(`connectionError`,r?.hooks?.connectionError)}registerHandler(e,t){if(!t)return;let n=Array.isArray(t)?t:[t];for(let t of n)typeof t==`function`&&this.on(e,t)}async initialize(){try{this.ready=!1,this.readyPromise=new Promise(e=>{this.readyResolve=e}).then(e=>{e||(this.ready=!0,this.eventEmitter.emit(`clientReady`),this.logger.debug(`[ConfigDirectorClient] Received initial payload from the server, client is ready`))}),this.usageEventCollector.start();let e=new Date().getTime();await this.transport.connect(this.timeout);let t=new Date().getTime()-e,n=this.timeout-t;n>0&&(await Promise.race([this.readyPromise,new Promise(e=>{this.readyTimer=setTimeout(()=>e(),n)})]),this.clearReadyTimer()),this.ready||this.logger.warn(`[ConfigDirectorClient] Timed out waiting for initialization after ${this.timeout}ms. ${this.timeoutWarningDetails()}`)}catch(e){if(e instanceof S)throw e;this.logger.error(`[ConfigDirectorClient] An error occurred during initialization: `,e)}}timeoutWarningDetails(){switch(this.connectionPlan.kind){case`connect`:return Zs[this.connectionPlan.mode];case`stay-offline`:return`The offline values were not delivered, so configs return the default value.`}}pollingIntervalFor(e,t){if(e!==`polling`)return;let n=Os(t,{defaultSeconds:300,minimumSeconds:60});return n.warning&&this.logger.warn(`[ConfigDirectorClient] ${n.warning}`),n.seconds}buildTelemetryClient(e,t){let n=this.connectionPlan;switch(n.kind){case`stay-offline`:return qs;case`connect`:{let r=t?.telemetry?.eventQueueLimit??5e3;return new Ks({sdkKey:n.serverSdkKey,sdkIdentity:e,metaContext:t?.metadata??{},logger:this.logger,baseUrl:n.baseUrl,flushIntervalDelay:t?.telemetry?.flushInterval??3e4,evaluationQueueLimit:Math.ceil(r*.7),contextLimit:Math.floor(r*.3),urlFactory:Ds,valueIdGenerator:Xs})}}}buildTransport(e,t){let n=this.connectionPlan;switch(n.kind){case`stay-offline`:return new Se(n.source);case`connect`:return new(this.getTransportConstructor(n.mode))({serverSdkKey:n.serverSdkKey,baseUrl:n.baseUrl,metaContext:{...t?.metadata,sdkName:e.sdkName,sdkVersion:e.sdkVersion},logger:this.logger,pollingInterval:this.pollingIntervalFor(n.mode,t?.connection?.pollingInterval)})}}getTransportConstructor(e){switch(e){case`polling`:return de;case`streaming`:return le}}findKeysRemovedBy(e){return!this.configSet||e.kind!=`full`?[]:Object.keys(this.configSet.configs).filter(t=>!Object.prototype.hasOwnProperty.call(e.configs,t))}findKeysUpdatedBy(e){let t=new Set(Object.keys(e.segments??{})),n=Object.entries(this.configSet?.configs??{}).filter(([,e])=>$s(e,t)).map(([e])=>e);return[...new Set([...Object.keys(e.configs),...n])]}updateWatchers(e){e.forEach(e=>this.updateWatchersForConfig(e))}updateWatchersForConfig(e){let t=this.configSet?.configs[e];this.handlersMap.get(e)?.forEach(n=>{let r=this.evaluationOf(e,t,n.defaultValue,n.context).value;n.handler(r)})}watch(e,t,n,r){this.validateDefaultValue(t);let i=this.handlersMap.get(e),a={handler:n,defaultValue:t,requestedType:typeof t,context:r};return i?i.push(a):this.handlersMap.set(e,[a]),()=>this.unwatch(e,n)}unwatch(e,t){let n=this.handlersMap.get(e);if(n)if(t){let e=n.findIndex(e=>e.handler==t);e>=0&&n?.splice(e,1)}else n.splice(0)}getValue(e,t,n){return this.evaluate(e,t,n).value}evaluate(e,t,n){this.validateDefaultValue(t);let r=this.configSet?.configs[e];return this.evaluationOf(e,r,t,n)}evaluationOf(e,t,n,r){let i=this.contextToEvaluate(r);if(t){let r=this.configEvaluator.evaluate(t,{context:i,metadata:this.metaContext},this.configSet?.segments),a=ps(r,n);this.usageEventCollector.evaluatedConfig({context:i,evaluation:{key:e,type:r.type,defaultValue:n,requestedType:a.requestedType,evaluatedValue:a.parsedValue,evaluatedValueId:a.parsedValueId,usedDefault:a.usedDefault,evaluationReason:a.reason}});let o={key:e,value:a.parsedValue,valueId:a.parsedValueId??void 0,isDefaultValue:a.usedDefault,reason:a.reason,context:i};return this.dispatchEvaluationEvent(o),this.logger.debug(`[ConfigDirectorClient] Evaluated '${e}' to '${a.parsedValue}'`),o}else{this.logger.debug(`[ConfigDirectorClient] No config state found for '${e}', returning default value '${n}'`);let t=this.isReady?`config-state-missing`:`client-not-ready`;this.usageEventCollector.evaluatedConfig({context:i,evaluation:{key:e,defaultValue:n,requestedType:us(n),evaluatedValue:n,usedDefault:!0,evaluationReason:t}});let r={key:e,value:n,isDefaultValue:!0,reason:t,context:i};return this.dispatchEvaluationEvent(r),r}}contextToEvaluate(e){let t=Ps(e);switch(t.outcome){case`admitted`:return t.context;case`ignored`:Qs[this.usageEventCollector.recordInvalidContext(t.kindSample)](this.logger,t.kindSample);return}}dispatchEvaluationEvent(e){setTimeout(()=>this.eventEmitter.emit(`configEvaluated`,{evaluation:e}),0)}validateDefaultValue(e){if(e==null)throw new x(`Invalid default value. The default value for a config must be defined and non-null.`);if(typeof e==`function`)throw new x(`Invalid default value. The default value for a config cannot be a function.`)}get isReady(){return this.ready}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}removeAllObservers(){this.logger.debug(`[ConfigDirectorClient] removeAllObservers() has been called, removing all observers`),this.eventEmitter.removeAllListeners(),this.handlersMap.clear()}unwatchAll(){this.handlersMap.clear()}getAllConfigs(e){let t=this.contextToEvaluate(e?.context);if(!this.configSet)return{};let n=Object.entries(this.configSet.configs),r=e?.configKeys?n.filter(([t])=>e.configKeys?.includes(t)):n;return Object.fromEntries(r.map(([e,n])=>[e,this.configEvaluator.evaluate(n,{context:t,metadata:this.metaContext},this.configSet?.segments)]))}closeConnection(){this.logger.debug(`[ConfigDirectorClient] closeConnection() has been called, closing connection to server`),this.transport.close(),this.ready=!1}clearReadyTimer(){clearTimeout(this.readyTimer),this.readyTimer=void 0}dispose(){this.removeAllObservers(),this.closeConnection(),this.readyResolve?.(!0),this.clearReadyTimer(),this.usageEventCollector.close().catch(e=>{this.logger.warn(`[ConfigDirectorClient] Error flushing telemetry while disposing the client: `,e)})}};const tc=(e,t,n)=>({value:e,reason:u.ERROR,errorCode:t,errorMessage:n}),nc=e=>tc(e.value,o.TYPE_MISMATCH,`The value of '${e.key}' cannot be read as the requested type (${e.reason}).`),rc={"found-match":e=>({value:e.value,variant:e.valueId,reason:u.TARGETING_MATCH}),cached:e=>({value:e.value,variant:e.valueId,reason:u.CACHED}),"value-missing":e=>({value:e.value,reason:u.DEFAULT}),"config-state-missing":e=>tc(e.value,o.FLAG_NOT_FOUND,`No config with the key '${e.key}' was found.`),"client-not-ready":e=>tc(e.value,o.PROVIDER_NOT_READY,`ConfigDirector has not delivered config state yet.`),"type-mismatch":nc,"invalid-number":nc,"invalid-json":nc,"invalid-boolean":nc},ic=e=>rc[e.reason](e),ac={sdkName:`js-openfeature-server-provider`,sdkVersion:`1.12.0`};var oc=class{constructor(e,t){this.metadata={name:`ConfigDirectorProvider`},this.runsOn=`server`,this.events=new s,this.client=ec.from(e,ac,t),this.client.on(`configsUpdated`,({keys:e,removedKeys:t})=>{this.events.emit(c.ConfigurationChanged,{flagsChanged:[...e,...t]})})}async initialize(){if(await this.client.initialize(),!this.client.isReady)throw this.client.on(`clientReady`,()=>this.events.emit(c.Ready)),new l(`No config arrived from ConfigDirector within the connection timeout. Flags resolve to their in-code default values until config arrives.`)}resolveBooleanEvaluation(e,t,n){return Promise.resolve(ic(this.client.evaluate(e,t,this.mapContext(n))))}resolveStringEvaluation(e,t,n){return Promise.resolve(ic(this.client.evaluate(e,t,this.mapContext(n))))}resolveNumberEvaluation(e,t,n){return Promise.resolve(ic(this.client.evaluate(e,t,this.mapContext(n))))}resolveObjectEvaluation(e,t,n){return Promise.resolve(ic(this.client.evaluate(e,t,this.mapContext(n))))}onClose(){return this.client.dispose(),Promise.resolve()}mapContext(e){if(!e)return;let t=(e.targetingKey??e.id)?.toString(),n=e.kind,r=e.name?.toString(),i=e?.traits||{},a=typeof i==`object`&&Object.keys(i).length>0,o=e.anonymous;return{id:t,kind:n,name:r,traits:a?i:void 0,anonymous:typeof o==`boolean`?o:void 0}}};export{S as ConfigDirectorInitializationError,oc as ConfigDirectorProvider};
6
6
  //# sourceMappingURL=configdirector-openfeature-server-provider.mjs.map