@ember-nexus/app-core 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/esm/Service/ServiceResolver.js +60 -6
- package/dist/esm/Service/ServiceResolver.js.map +1 -1
- package/dist/esm/Type/Definition/Proxy.js +2 -0
- package/dist/esm/Type/Definition/Proxy.js.map +1 -0
- package/dist/esm/Type/Definition/index.js +1 -0
- package/dist/esm/Type/Definition/index.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/Service/ServiceResolver.d.ts +5 -4
- package/dist/types/Type/Definition/Proxy.d.ts +6 -0
- package/dist/types/Type/Definition/index.d.ts +1 -0
- package/package.json +2 -2
package/dist/browser/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=/* @__PURE__ */(e=>(e.GetServiceResolver="ember-nexus.app-core.get-service-resolver",e))(e||{}),t=/* @__PURE__ */(e=>(e.NormalizedValueToRawValueEvent="ember-nexus.app-core.event.normalized-value-to-raw-value",e.RawValueToNormalizedValueEvent="ember-nexus.app-core.event.raw-value-to-normalized-value",e))(t||{}),r=/* @__PURE__ */(e=>(e.GET="GET",e.POST="POST",e.PATCH="PATCH",e.PUT="PUT",e.DELETE="DELETE",e.HEAD="HEAD",e.COPY="COPY",e.LOCK="LOCK",e.UNLOCK="UNLOCK",e.MKCOL="MKCOL",e.MOVE="MOVE",e.PROPFIND="PROPFIND",e.PROPPATCH="PROPPATCH",e))(r||{}),n=/* @__PURE__ */(e=>(e[e.Debug=2]="Debug",e[e.Info=3]="Info",e[e.Warn=4]="Warn",e[e.Error=5]="Error",e))(n||{}),s=/* @__PURE__ */(e=>(e.ClientSide="client",e.ServerSide="server",e.Logic="Logic",e))(s||{}),i=/* @__PURE__ */(e=>(e.emberNexusWebSDK="ember-nexus.web-sdk",e.logger="global.logger",e.action="global.action-registry",e.setting="global.setting-registry",e.icon="global.icon-registry",e.serviceFetchHelper="ember-nexus.app-core.service.fetch-helper-service",e.serviceApiConfiguration="ember-nexus.app-core.service.api-configuration-service",e.serviceElementParser="ember-nexus.app-core.service.element-parser-service",e.serviceCollectionParser="ember-nexus.app-core.service.collection-parser-service",e.serviceTokenParser="ember-nexus.app-core.service.token-parser-service",e.serviceApiWrapper="ember-nexus.app-core.service.api-wrapper",e.serviceEventDispatcher="ember-nexus.app-core.service.event-dispatcher",e.endpointElementDeleteElementEndpoint="ember-nexus.app-core.endpoint.element.delete-element-endpoint",e.endpointElementGetElementEndpoint="ember-nexus.app-core.endpoint.element.get-element-endpoint",e.endpointElementGetElementChildrenEndpoint="ember-nexus.app-core.endpoint.element.get-element-children-endpoint",e.endpointElementGetElementParentsEndpoint="ember-nexus.app-core.endpoint.element.get-element-parents-endpoint",e.endpointElementGetElementRelatedEndpoint="ember-nexus.app-core.endpoint.element.get-element-related-endpoint",e.endpointElementGetIndexEndpoint="ember-nexus.app-core.endpoint.element.get-index-endpoint",e.endpointElementPatchElementEndpoint="ember-nexus.app-core.endpoint.element.patch-element-endpoint",e.endpointElementPostElementEndpoint="ember-nexus.app-core.endpoint.element.post-element-endpoint",e.endpointElementPostIndexEndpoint="ember-nexus.app-core.endpoint.element.post-index-endpoint",e.endpointElementPutElementEndpoint="ember-nexus.app-core.endpoint.element.put-element-endpoint",e.endpointUserDeleteTokenEndpoint="ember-nexus.app-core.endpoint.user.delete-token-endpoint",e.endpointUserGetMeEndpoint="ember-nexus.app-core.endpoint.user.get-me-endpoint",e.endpointUserGetTokenEndpoint="ember-nexus.app-core.endpoint.user.get-token-endpoint",e.endpointUserPostChangePasswordEndpoint="ember-nexus.app-core.endpoint.user.post-change-password-endpoint",e.endpointUserPostRegisterEndpoint="ember-nexus.app-core.endpoint.user.post-register-endpoint",e.endpointUserPostTokenEndpoint="ember-nexus.app-core.endpoint.user.post-token-endpoint",e.cacheElement="ember-nexus.app-core.cache.element-cache",e.cacheElementChildren="ember-nexus.app-core.cache.element-children-cache",e.cacheElementParents="ember-nexus.app-core.cache.element-parents-cache",e.cacheElementRelated="ember-nexus.app-core.cache.element-related-cache",e.cacheIndex="ember-nexus.app-core.cache.index-cache",e))(i||{});const o=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,BrowserEventIdentifier:e,EventIdentifier:t,HttpRequestMethod:r,LogLevel:n,RequestProblemCategory:s,ServiceIdentifier:i},Symbol.toStringTag,{value:"Module"})),a={bubbles:!0,composed:!0,cancelable:!0},l=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,customEventDefaultInit:a},Symbol.toStringTag,{value:"Module"})),c=class e extends CustomEvent{constructor(){super(e.type,{...a,detail:{serviceResolver:null}})}getServiceResolver(){return this.detail.serviceResolver}setServiceResolver(e){this.detail.serviceResolver=e}};c.type=e.GetServiceResolver;let u=c;const h=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,GetServiceResolverEvent:u},Symbol.toStringTag,{value:"Module"})),d=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,exportPlaceholder:!1},Symbol.toStringTag,{value:"Module"}));class f extends Error{constructor(e){super(e)}}class m extends f{constructor(e){super(e),this.name="LogicError"}}class p extends f{constructor(e,t){super(e),this.name="NetworkError",this.cause=t}}class g extends f{constructor(e){super(e),this.name="ParseError"}}class y extends f{constructor(e){super(e),this._type=null,this._title=null,this._detail=null,this._status=null}getType(){return this._type}setType(e){return this._type=e,this}getTitle(){return this._title}setTitle(e){return this._title=e,this}getDetail(){return this._detail}setDetail(e){return this._detail=e,this}getStatus(){return this._status}setStatus(e){return this._status=e,this}}class w extends y{constructor(e){super(e),this.name="Response401UnauthorizedError",this.setStatus(401)}}class v extends y{constructor(e){super(e),this.name="Response403ForbiddenError",this.setStatus(403)}}class E extends y{constructor(e){super(e),this.name="Response404NotFoundError",this.setStatus(404)}}class S extends y{constructor(e){super(e),this.name="Response429TooManyRequestsError",this.setStatus(429)}}class b extends f{constructor(e){super(e),this.name="ValidationError"}}const T=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,EmberNexusError:f,LogicError:m,NetworkError:p,ParseError:g,Response401UnauthorizedError:w,Response403ForbiddenError:v,Response404NotFoundError:E,Response429TooManyRequestsError:S,ResponseError:y,ValidationError:b},Symbol.toStringTag,{value:"Module"}));class k{has(e){return this.cache.has(e)}get(e){return this.cache.get(e)}set(e,t){return this.cache.set(e,t),this}delete(e){return this.cache.delete(e),this}setFromDataEtag(e,t,r){const n=this.cache.get(e);n&&void 0===r&&(r=n.etag);const s={data:t,etag:r};return this.cache.set(e,s),this}setFromParsedResponse(e,t){const r=t.response.headers.get("ETag");if(null===r)throw new m("Expected parsedResponse to contain ETag header.");const n={data:t.data,etag:r};return this.cache.set(e,n),this}refresh(e){return this}}const O="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,F=/* @__PURE__ */new Set,x="object"==typeof process&&process?process:{},C=(e,t,r,n)=>{"function"==typeof x.emitWarning?x.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)};let L=globalThis.AbortController,N=globalThis.AbortSignal;if(void 0===L){N=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},L=class{constructor(){t()}signal=new N;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e="1"!==x.env?.LRU_CACHE_IGNORE_AC_WARNING;const t=()=>{e&&(e=!1,C("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}const D=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),M=e=>D(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?P:null:null;class P extends Array{constructor(e){super(e),this.fill(0)}}class z{heap;length;static#e=!1;static create(e){const t=M(e);if(!t)return[];z.#e=!0;const r=new z(e,t);return z.#e=!1,r}constructor(e,t){if(!z.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class R{#t;#r;#n;#s;#i;#o;#a;#l;get perf(){return this.#l}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#u;#h;#d;#f;#m;#p;#g;#y;#w;#v;#E;#S;#b;#T;#k;#O;#F;#x;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#b,autopurgeTimers:e.#T,sizes:e.#E,keyMap:e.#h,keyList:e.#d,valList:e.#f,next:e.#m,prev:e.#p,get head(){return e.#g},get tail(){return e.#y},free:e.#w,isBackgroundFetch:t=>e.#C(t),backgroundFetch:(t,r,n,s)=>e.#L(t,r,n,s),moveToTail:t=>e.#N(t),indexes:t=>e.#D(t),rindexes:t=>e.#M(t),isStale:t=>e.#P(t)}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#u}get size(){return this.#c}get fetchMethod(){return this.#o}get memoMethod(){return this.#a}get dispose(){return this.#n}get onInsert(){return this.#s}get disposeAfter(){return this.#i}constructor(e){const{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:s,updateAgeOnGet:i,updateAgeOnHas:o,allowStale:a,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:d,maxSize:f=0,maxEntrySize:m=0,sizeCalculation:p,fetchMethod:g,memoMethod:y,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:S,ignoreFetchAbort:b,perf:T}=e;if(void 0!==T&&"function"!=typeof T?.now)throw new TypeError("perf option must have a now() method if specified");if(this.#l=T??O,0!==t&&!D(t))throw new TypeError("max option must be a nonnegative integer");const k=t?M(t):Array;if(!k)throw new Error("invalid max value: "+t);if(this.#t=t,this.#r=f,this.maxEntrySize=m||this.#r,this.sizeCalculation=p,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==y&&"function"!=typeof y)throw new TypeError("memoMethod must be a function if defined");if(this.#a=y,void 0!==g&&"function"!=typeof g)throw new TypeError("fetchMethod must be a function if specified");if(this.#o=g,this.#O=!!g,this.#h=/* @__PURE__ */new Map,this.#d=new Array(t).fill(void 0),this.#f=new Array(t).fill(void 0),this.#m=new k(t),this.#p=new k(t),this.#g=0,this.#y=0,this.#w=z.create(t),this.#c=0,this.#u=0,"function"==typeof l&&(this.#n=l),"function"==typeof c&&(this.#s=c),"function"==typeof u?(this.#i=u,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#k=!!this.#n,this.#x=!!this.#s,this.#F=!!this.#i,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!b,0!==this.maxEntrySize){if(0!==this.#r&&!D(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!D(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#z()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!i,this.updateAgeOnHas=!!o,this.ttlResolution=D(n)||0===n?n:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!D(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#R()}if(0===this.#t&&0===this.ttl&&0===this.#r)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){const e="LRU_CACHE_UNBOUNDED";if((e=>!F.has(e))(e)){F.add(e);C("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,R)}}}getRemainingTTL(e){return this.#h.has(e)?1/0:0}#R(){const e=new P(this.#t),t=new P(this.#t);this.#b=e,this.#S=t;const r=this.ttlAutopurge?new Array(this.#t):void 0;this.#T=r,this.#A=(n,s,i=this.#l.now())=>{if(t[n]=0!==s?i:0,e[n]=s,r?.[n]&&(clearTimeout(r[n]),r[n]=void 0),0!==s&&r){const e=setTimeout(()=>{this.#P(n)&&this.#I(this.#d[n],"expire")},s+1);e.unref&&e.unref(),r[n]=e}},this.#_=r=>{t[r]=0!==e[r]?this.#l.now():0},this.#H=(r,i)=>{if(e[i]){const o=e[i],a=t[i];if(!o||!a)return;r.ttl=o,r.start=a,r.now=n||s();const l=r.now-a;r.remainingTTL=o-l}};let n=0;const s=()=>{const e=this.#l.now();if(this.ttlResolution>0){n=e;const t=setTimeout(()=>n=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=r=>{const i=this.#h.get(r);if(void 0===i)return 0;const o=e[i],a=t[i];if(!o||!a)return 1/0;return o-((n||s())-a)},this.#P=r=>{const i=t[r],o=e[r];return!!o&&!!i&&(n||s())-i>o}}#_=()=>{};#H=()=>{};#A=()=>{};#P=()=>!1;#z(){const e=new P(this.#t);this.#u=0,this.#E=e,this.#V=t=>{this.#u-=e[t],e[t]=0},this.#$=(e,t,r,n)=>{if(this.#C(t))return 0;if(!D(r)){if(!n)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof n)throw new TypeError("sizeCalculation must be a function");if(r=n(t,e),!D(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return r},this.#j=(t,r,n)=>{if(e[t]=r,this.#r){const r=this.#r-e[t];for(;this.#u>r;)this.#W(!0)}this.#u+=e[t],n&&(n.entrySize=r,n.totalCalculatedSize=this.#u)}}#V=e=>{};#j=(e,t,r)=>{};#$=(e,t,r,n)=>{if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#D({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#y;this.#U(t)&&(!e&&this.#P(t)||(yield t),t!==this.#g);)t=this.#p[t]}*#M({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;this.#U(t)&&(!e&&this.#P(t)||(yield t),t!==this.#y);)t=this.#m[t]}#U(e){return void 0!==e&&this.#h.get(this.#d[e])===e}*entries(){for(const e of this.#D())void 0===this.#f[e]||void 0===this.#d[e]||this.#C(this.#f[e])||(yield[this.#d[e],this.#f[e]])}*rentries(){for(const e of this.#M())void 0===this.#f[e]||void 0===this.#d[e]||this.#C(this.#f[e])||(yield[this.#d[e],this.#f[e]])}*keys(){for(const e of this.#D()){const t=this.#d[e];void 0===t||this.#C(this.#f[e])||(yield t)}}*rkeys(){for(const e of this.#M()){const t=this.#d[e];void 0===t||this.#C(this.#f[e])||(yield t)}}*values(){for(const e of this.#D()){void 0===this.#f[e]||this.#C(this.#f[e])||(yield this.#f[e])}}*rvalues(){for(const e of this.#M()){void 0===this.#f[e]||this.#C(this.#f[e])||(yield this.#f[e])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(const r of this.#D()){const n=this.#f[r],s=this.#C(n)?n.__staleWhileFetching:n;if(void 0!==s&&e(s,this.#d[r],this))return this.get(this.#d[r],t)}}forEach(e,t=this){for(const r of this.#D()){const n=this.#f[r],s=this.#C(n)?n.__staleWhileFetching:n;void 0!==s&&e.call(t,s,this.#d[r],this)}}rforEach(e,t=this){for(const r of this.#M()){const n=this.#f[r],s=this.#C(n)?n.__staleWhileFetching:n;void 0!==s&&e.call(t,s,this.#d[r],this)}}purgeStale(){let e=!1;for(const t of this.#M({allowStale:!0}))this.#P(t)&&(this.#I(this.#d[t],"expire"),e=!0);return e}info(e){const t=this.#h.get(e);if(void 0===t)return;const r=this.#f[t],n=this.#C(r)?r.__staleWhileFetching:r;if(void 0===n)return;const s={value:n};if(this.#b&&this.#S){const e=this.#b[t],r=this.#S[t];if(e&&r){const t=e-(this.#l.now()-r);s.ttl=t,s.start=Date.now()}}return this.#E&&(s.size=this.#E[t]),s}dump(){const e=[];for(const t of this.#D({allowStale:!0})){const r=this.#d[t],n=this.#f[t],s=this.#C(n)?n.__staleWhileFetching:n;if(void 0===s||void 0===r)continue;const i={value:s};if(this.#b&&this.#S){i.ttl=this.#b[t];const e=this.#l.now()-this.#S[t];i.start=Math.floor(Date.now()-e)}this.#E&&(i.size=this.#E[t]),e.unshift([r,i])}return e}load(e){this.clear();for(const[t,r]of e){if(r.start){const e=Date.now()-r.start;r.start=this.#l.now()-e}this.set(t,r.value,r)}}set(e,t,r={}){if(void 0===t)return this.delete(e),this;const{ttl:n=this.ttl,start:s,noDisposeOnSet:i=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:a}=r;let{noUpdateTTL:l=this.noUpdateTTL}=r;const c=this.#$(e,t,r.size||0,o);if(this.maxEntrySize&&c>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.#I(e,"set"),this;let u=0===this.#c?void 0:this.#h.get(e);if(void 0===u)u=0===this.#c?this.#y:0!==this.#w.length?this.#w.pop():this.#c===this.#t?this.#W(!1):this.#c,this.#d[u]=e,this.#f[u]=t,this.#h.set(e,u),this.#m[this.#y]=u,this.#p[u]=this.#y,this.#y=u,this.#c++,this.#j(u,c,a),a&&(a.set="add"),l=!1,this.#x&&this.#s?.(t,e,"add");else{this.#N(u);const r=this.#f[u];if(t!==r){if(this.#O&&this.#C(r)){r.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:t}=r;void 0===t||i||(this.#k&&this.#n?.(t,e,"set"),this.#F&&this.#v?.push([t,e,"set"]))}else i||(this.#k&&this.#n?.(r,e,"set"),this.#F&&this.#v?.push([r,e,"set"]));if(this.#V(u),this.#j(u,c,a),this.#f[u]=t,a){a.set="replace";const e=r&&this.#C(r)?r.__staleWhileFetching:r;void 0!==e&&(a.oldValue=e)}}else a&&(a.set="update");this.#x&&this.onInsert?.(t,e,t===r?"update":"replace")}if(0===n||this.#b||this.#R(),this.#b&&(l||this.#A(u,n,s),a&&this.#H(a,u)),!i&&this.#F&&this.#v){const e=this.#v;let t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){const e=this.#f[this.#g];if(this.#W(!0),this.#C(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#F&&this.#v){const e=this.#v;let t;for(;t=e?.shift();)this.#i?.(...t)}}}#W(e){const t=this.#g,r=this.#d[t],n=this.#f[t];return this.#O&&this.#C(n)?n.__abortController.abort(new Error("evicted")):(this.#k||this.#F)&&(this.#k&&this.#n?.(n,r,"evict"),this.#F&&this.#v?.push([n,r,"evict"])),this.#V(t),this.#T?.[t]&&(clearTimeout(this.#T[t]),this.#T[t]=void 0),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#w.push(t)),1===this.#c?(this.#g=this.#y=0,this.#w.length=0):this.#g=this.#m[t],this.#h.delete(r),this.#c--,t}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,s=this.#h.get(e);if(void 0!==s){const e=this.#f[s];if(this.#C(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#P(s))return r&&this.#_(s),n&&(n.has="hit",this.#H(n,s)),!0;n&&(n.has="stale",this.#H(n,s))}else n&&(n.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,n=this.#h.get(e);if(void 0===n||!r&&this.#P(n))return;const s=this.#f[n];return this.#C(s)?s.__staleWhileFetching:s}#L(e,t,r,n){const s=void 0===t?void 0:this.#f[t];if(this.#C(s))return s;const i=new L,{signal:o}=r;o?.addEventListener("abort",()=>i.abort(o.reason),{signal:i.signal});const a={signal:i.signal,options:r,context:n},l=(n,s=!1)=>{const{aborted:o}=i.signal,l=r.ignoreFetchAbort&&void 0!==n;if(r.status&&(o&&!s?(r.status.fetchAborted=!0,r.status.fetchError=i.signal.reason,l&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),o&&!l&&!s)return c(i.signal.reason);const h=u,d=this.#f[t];return(d===u||l&&s&&void 0===d)&&(void 0===n?void 0!==h.__staleWhileFetching?this.#f[t]=h.__staleWhileFetching:this.#I(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,n,a.options))),n},c=n=>{const{aborted:s}=i.signal,o=s&&r.allowStaleOnFetchAbort,a=o||r.allowStaleOnFetchRejection,l=a||r.noDeleteOnFetchRejection,c=u;if(this.#f[t]===u){!l||void 0===c.__staleWhileFetching?this.#I(e,"fetch"):o||(this.#f[t]=c.__staleWhileFetching)}if(a)return r.status&&void 0!==c.__staleWhileFetching&&(r.status.returnedStale=!0),c.__staleWhileFetching;if(c.__returned===c)throw n};r.status&&(r.status.fetchDispatched=!0);const u=new Promise((t,n)=>{const o=this.#o?.(e,s,a);o&&o instanceof Promise&&o.then(e=>t(void 0===e?void 0:e),n),i.signal.addEventListener("abort",()=>{r.ignoreFetchAbort&&!r.allowStaleOnFetchAbort||(t(void 0),r.allowStaleOnFetchAbort&&(t=e=>l(e,!0)))})}).then(l,e=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=e),c(e))),h=Object.assign(u,{__abortController:i,__staleWhileFetching:s,__returned:void 0});return void 0===t?(this.set(e,h,{...a.options,status:void 0}),t=this.#h.get(e)):this.#f[t]=h,h}#C(e){if(!this.#O)return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof L}async fetch(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:a=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,context:m,forceRefresh:p=!1,status:g,signal:y}=t;if(!this.#O)return g&&(g.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:s,status:g});const w={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:s,ttl:i,noDisposeOnSet:o,size:a,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:f,ignoreFetchAbort:d,status:g,signal:y};let v=this.#h.get(e);if(void 0===v){g&&(g.fetch="miss");const t=this.#L(e,v,w,m);return t.__returned=t}{const t=this.#f[v];if(this.#C(t)){const e=r&&void 0!==t.__staleWhileFetching;return g&&(g.fetch="inflight",e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}const s=this.#P(v);if(!p&&!s)return g&&(g.fetch="hit"),this.#N(v),n&&this.#_(v),g&&this.#H(g,v),t;const i=this.#L(e,v,w,m),o=void 0!==i.__staleWhileFetching&&r;return g&&(g.fetch=s?"stale":"refresh",o&&s&&(g.returnedStale=!0)),o?i.__staleWhileFetching:i.__returned=i}}async forceFetch(e,t={}){const r=await this.fetch(e,t);if(void 0===r)throw new Error("fetch() returned undefined");return r}memo(e,t={}){const r=this.#a;if(!r)throw new Error("no memoMethod provided to constructor");const{context:n,forceRefresh:s,...i}=t,o=this.get(e,i);if(!s&&void 0!==o)return o;const a=r(e,o,{options:i,context:n});return this.set(e,a,i),a}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:i}=t,o=this.#h.get(e);if(void 0!==o){const t=this.#f[o],a=this.#C(t);return i&&this.#H(i,o),this.#P(o)?(i&&(i.get="stale"),a?(i&&r&&void 0!==t.__staleWhileFetching&&(i.returnedStale=!0),r?t.__staleWhileFetching:void 0):(s||this.#I(e,"expire"),i&&r&&(i.returnedStale=!0),r?t:void 0)):(i&&(i.get="hit"),a?t.__staleWhileFetching:(this.#N(o),n&&this.#_(o),t))}i&&(i.get="miss")}#Z(e,t){this.#p[t]=e,this.#m[e]=t}#N(e){e!==this.#y&&(e===this.#g?this.#g=this.#m[e]:this.#Z(this.#p[e],this.#m[e]),this.#Z(this.#y,e),this.#y=e)}delete(e){return this.#I(e,"delete")}#I(e,t){let r=!1;if(0!==this.#c){const n=this.#h.get(e);if(void 0!==n)if(this.#T?.[n]&&(clearTimeout(this.#T?.[n]),this.#T[n]=void 0),r=!0,1===this.#c)this.#G(t);else{this.#V(n);const r=this.#f[n];if(this.#C(r)?r.__abortController.abort(new Error("deleted")):(this.#k||this.#F)&&(this.#k&&this.#n?.(r,e,t),this.#F&&this.#v?.push([r,e,t])),this.#h.delete(e),this.#d[n]=void 0,this.#f[n]=void 0,n===this.#y)this.#y=this.#p[n];else if(n===this.#g)this.#g=this.#m[n];else{const e=this.#p[n];this.#m[e]=this.#m[n];const t=this.#m[n];this.#p[t]=this.#p[n]}this.#c--,this.#w.push(n)}}if(this.#F&&this.#v?.length){const e=this.#v;let t;for(;t=e?.shift();)this.#i?.(...t)}return r}clear(){return this.#G("delete")}#G(e){for(const t of this.#M({allowStale:!0})){const r=this.#f[t];if(this.#C(r))r.__abortController.abort(new Error("deleted"));else{const n=this.#d[t];this.#k&&this.#n?.(r,n,e),this.#F&&this.#v?.push([r,n,e])}}if(this.#h.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#b&&this.#S){this.#b.fill(0),this.#S.fill(0);for(const e of this.#T??[])void 0!==e&&clearTimeout(e);this.#T?.fill(void 0)}if(this.#E&&this.#E.fill(0),this.#g=0,this.#y=0,this.#w.length=0,this.#u=0,this.#c=0,this.#F&&this.#v){const e=this.#v;let t;for(;t=e?.shift();)this.#i?.(...t)}}}const A=class e extends k{constructor(){super(),this.cache=new R({max:500})}static constructFromServiceResolver(){return new e}static createCacheKey(e){return`${e}`}setFromCollection(t){for(let r=0;r<t.nodes.length;r++)this.setFromDataEtag(e.createCacheKey(t.nodes[r].id),t.nodes[r]);for(let r=0;r<t.relations.length;r++)this.setFromDataEtag(e.createCacheKey(t.relations[r].id),t.relations[r]);return this}};A.identifier=i.cacheElement;let I=A;const _=class e extends k{constructor(){super(),this.cache=new R({max:50})}static constructFromServiceResolver(){return new e}static createCacheKey(e,t,r){return`${e}-${t}-${r}`}};_.identifier=i.cacheElementChildren;let H=_;const V=class e extends k{constructor(){super(),this.cache=new R({max:50})}static constructFromServiceResolver(){return new e}static createCacheKey(e,t,r){return`${e}-${t}-${r}`}};V.identifier=i.cacheElementParents;let $=V;const j=class e extends k{constructor(){super(),this.cache=new R({max:50})}static constructFromServiceResolver(){return new e}static createCacheKey(e,t,r){return`${e}-${t}-${r}`}};j.identifier=i.cacheElementRelated;let W=j;const U=class e extends k{constructor(){super(),this.cache=new R({max:50})}static constructFromServiceResolver(){return new e}static createCacheKey(e,t){return`${e}-${t}`}};U.identifier=i.cacheIndex;let Z=U;const G=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,Cache:k,ElementCache:I,ElementChildrenCache:H,ElementParentsCache:$,ElementRelatedCache:W,IndexCache:Z},Symbol.toStringTag,{value:"Module"})),B=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async deleteElement(e){try{const t=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP DELETE request against URL: ${t}`);const r=await fetch(t,this.fetchHelper.getDefaultDeleteOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(r),{response:r}}catch(t){this.fetchHelper.logAndThrowError(t)}}};B.identifier=i.endpointElementDeleteElementEndpoint;let q=B;const J=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceCollectionParser))}async getElementChildren(e,t=1,r=25,n){try{if(t<1)throw new b("Page number must be at least 1.");if(r<1)throw new b("Page size must be at least 1.");const s=this.fetchHelper.buildUrl(`/${e}/children?page=${t}&pageSize=${r}`);this.logger.debug(`Executing HTTP GET request against URL: ${s}`);const i=await fetch(s,this.fetchHelper.getDefaultGetOptions(n)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===i.status)return{response:i};const o=await this.fetchHelper.parseJsonResponse(i);return{data:await this.collectionParser.deserializeCollection(o),response:i}}catch(s){this.fetchHelper.logAndThrowError(s)}}};J.identifier=i.endpointElementGetElementChildrenEndpoint;let Y=J;const K=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.elementParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceElementParser))}async getElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP GET request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultGetOptions(t)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===n.status)return{response:n};const s=await this.fetchHelper.parseJsonResponse(n);return{data:await this.elementParser.deserializeElement(s),response:n}}catch(r){this.fetchHelper.logAndThrowError(r)}}};K.identifier=i.endpointElementGetElementEndpoint;let Q=K;const X=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceCollectionParser))}async getElementParents(e,t=1,r=25,n){try{if(t<1)throw new b("Page number must be at least 1.");if(r<1)throw new b("Page size must be at least 1.");const s=this.fetchHelper.buildUrl(`/${e}/parents?page=${t}&pageSize=${r}`);this.logger.debug(`Executing HTTP GET request against URL: ${s}`);const i=await fetch(s,this.fetchHelper.getDefaultGetOptions(n)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===i.status)return{response:i};const o=await this.fetchHelper.parseJsonResponse(i);return{data:await this.collectionParser.deserializeCollection(o),response:i}}catch(s){this.fetchHelper.logAndThrowError(s)}}};X.identifier=i.endpointElementGetElementParentsEndpoint;let ee=X;const te=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceCollectionParser))}async getElementRelated(e,t=1,r=25,n){try{if(t<1)throw new b("Page number must be at least 1.");if(r<1)throw new b("Page size must be at least 1.");const s=this.fetchHelper.buildUrl(`/${e}/related?page=${t}&pageSize=${r}`);this.logger.debug(`Executing HTTP GET request against URL: ${s}`);const i=await fetch(s,this.fetchHelper.getDefaultGetOptions(n)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===i.status)return{response:i};const o=await this.fetchHelper.parseJsonResponse(i);return{data:await this.collectionParser.deserializeCollection(o),response:i}}catch(s){this.fetchHelper.logAndThrowError(s)}}};te.identifier=i.endpointElementGetElementRelatedEndpoint;let re=te;const ne=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceCollectionParser))}async getIndex(e=1,t=25,r){try{if(e<1)throw new b("Page number must be at least 1.");if(t<1)throw new b("Page size must be at least 1.");const n=this.fetchHelper.buildUrl(`/?page=${e}&pageSize=${t}`);this.logger.debug(`Executing HTTP GET request against URL: ${n}`);const s=await fetch(n,this.fetchHelper.getDefaultGetOptions(r)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===s.status)return{response:s};const i=await this.fetchHelper.parseJsonResponse(s);return{data:await this.collectionParser.deserializeCollection(i),response:s}}catch(n){this.fetchHelper.logAndThrowError(n)}}};ne.identifier=i.endpointElementGetIndexEndpoint;let se=ne;const ie=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async patchElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP PATCH request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultPatchOptions(JSON.stringify(t))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(n),{response:n}}catch(r){this.fetchHelper.logAndThrowError(r)}}};ie.identifier=i.endpointElementPatchElementEndpoint;let oe=ie;const ae=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async postElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP POST request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultPostOptions(JSON.stringify(t))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return{data:await this.fetchHelper.parseLocationResponse(n),response:n}}catch(r){this.fetchHelper.logAndThrowError(r)}}};ae.identifier=i.endpointElementPostElementEndpoint;let le=ae;const ce=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async postIndex(e){try{const t=this.fetchHelper.buildUrl("/");this.logger.debug(`Executing HTTP POST request against URL: ${t}`);const r=await fetch(t,this.fetchHelper.getDefaultPostOptions(JSON.stringify(e))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return{data:await this.fetchHelper.parseLocationResponse(r),response:r}}catch(t){this.fetchHelper.logAndThrowError(t)}}};ce.identifier=i.endpointElementPostIndexEndpoint;let ue=ce;const he=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async putElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP PUT request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultPutOptions(JSON.stringify(t))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(n),{response:n}}catch(r){this.fetchHelper.logAndThrowError(r)}}};he.identifier=i.endpointElementPutElementEndpoint;let de=he;const fe=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,DeleteElementEndpoint:q,GetElementChildrenEndpoint:Y,GetElementEndpoint:Q,GetElementParentsEndpoint:ee,GetElementRelatedEndpoint:re,GetIndexEndpoint:se,PatchElementEndpoint:oe,PostElementEndpoint:le,PostIndexEndpoint:ue,PutElementEndpoint:de},Symbol.toStringTag,{value:"Module"})),me=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async deleteToken(){try{const e=this.fetchHelper.buildUrl("/token");this.logger.debug(`Executing HTTP DELETE request against URL: ${e}`);const t=await fetch(e,this.fetchHelper.getDefaultDeleteOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(t),{response:t}}catch(e){this.fetchHelper.logAndThrowError(e)}}};me.identifier=i.endpointUserDeleteTokenEndpoint;let pe=me;const ge=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.elementParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceElementParser))}async getMe(){try{const e=this.fetchHelper.buildUrl("/me");this.logger.debug(`Executing HTTP GET request against URL: ${e}`);const t=await fetch(e,this.fetchHelper.getDefaultGetOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e)),r=await this.fetchHelper.parseJsonResponse(t),n=await this.elementParser.deserializeElement(r);if("User"!==n.type)throw new m("Expected node to be of type 'User'.");return{data:n,response:t}}catch(e){this.fetchHelper.logAndThrowError(e)}}};ge.identifier=i.endpointUserGetMeEndpoint;let ye=ge;const we=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.elementParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceElementParser))}async getToken(){try{const e=this.fetchHelper.buildUrl("/token");this.logger.debug(`Executing HTTP GET request against URL: ${e}`);const t=await fetch(e,this.fetchHelper.getDefaultGetOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e)),r=await this.fetchHelper.parseJsonResponse(t),n=await this.elementParser.deserializeElement(r);if("Token"!==n.type)throw new m("Expected node to be of type 'Token'.");return{data:n,response:t}}catch(e){this.fetchHelper.logAndThrowError(e)}}};we.identifier=i.endpointUserGetTokenEndpoint;let ve=we;const Ee=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async postChangePassword(e,t,r){try{const n=this.fetchHelper.buildUrl("/change-password");this.logger.debug(`Executing HTTP POST request against URL: ${n}`);const s={type:"ActionChangePassword",currentPassword:t,newPassword:r,uniqueUserIdentifier:e},i=await fetch(n,this.fetchHelper.getDefaultPostOptions(JSON.stringify(s))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(i),{response:i}}catch(n){this.fetchHelper.logAndThrowError(n)}}};Ee.identifier=i.endpointUserPostChangePasswordEndpoint;let Se=Ee;const be=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async postRegister(e,t,r={}){try{const n=this.fetchHelper.buildUrl("/register");this.logger.debug(`Executing HTTP POST request against URL: ${n}`);const s={type:"User",uniqueUserIdentifier:e,password:t,data:r},i=await fetch(n,this.fetchHelper.getDefaultPostOptions(JSON.stringify(s))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return{data:await this.fetchHelper.parseLocationResponse(i),response:i}}catch(n){this.fetchHelper.logAndThrowError(n)}}};be.identifier=i.endpointUserPostRegisterEndpoint;let Te=be;const ke=class e{constructor(e,t,r){this.logger=e,this.tokenParser=t,this.fetchHelper=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceTokenParser),t.getServiceOrFail(i.serviceFetchHelper))}async postToken(e,t,r={}){try{const n=this.fetchHelper.buildUrl("/token");this.logger.debug(`Executing HTTP POST request against URL: ${n}`);const s={type:"Token",uniqueUserIdentifier:e,password:t,data:r},i=await fetch(n,this.fetchHelper.getDefaultPostOptions(JSON.stringify(s))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e)),o=await this.fetchHelper.parseJsonResponse(i);return{data:this.tokenParser.rawTokenToToken(o),response:i}}catch(n){this.fetchHelper.logAndThrowError(n)}}};ke.identifier=i.endpointUserPostTokenEndpoint;let Oe=ke;const Fe=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,DeleteTokenEndpoint:pe,GetMeEndpoint:ye,GetTokenEndpoint:ve,PostChangePasswordEndpoint:Se,PostRegisterEndpoint:Te,PostTokenEndpoint:Oe},Symbol.toStringTag,{value:"Module"})),xe=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,Element:fe,User:Fe},Symbol.toStringTag,{value:"Module"}));class Ce{constructor(e){this.stopped=!1,this.identifier=e}getIdentifier(){return this.identifier}isPropagationStopped(){return this.stopped}stopPropagation(){return this.stopped=!0,this}}const Le=/^([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*$/;const Ne=/^(?:([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*|\*|([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*(\.\*))$/;function De(e){if(!Ne.test(e))throw new g("Passed variable is not a valid event listener target.");return e}function Me(e){const t=e.split("."),r=[];r.push(De(e));for(let n=t.length-1;n>0;n--)r.push(De(t.slice(0,n).join(".")+".*"));return r.push(De("*")),r}class Pe{constructor(){this.entries=/* @__PURE__ */new Map}clearEntries(){return this.entries.clear(),this}deleteEntry(e){return this.entries.delete(e),this}getEntry(e){if(!this.hasEntry(e))return null;const t=this.entries.get(e);return t[t.length-1].entry}hasEntry(e){return this.entries.has(e)}setEntry(e,t,r){let n;void 0===r&&(r=0),this.entries.has(e)?n=this.entries.get(e):(n=[],this.entries.set(e,n));let s=0,i=n.length-1,o=-1;for(;s<=i;){const e=Math.floor((s+i)/2);n[e].priority>=r?(o=e,i=e-1):s=e+1}const a=-1===o?s:o;return n.splice(a,0,{priority:r,entry:t}),this}getAllEntriesForKey(e){return this.entries.has(e)?this.entries.get(e).map(e=>e.entry):null}}class ze{constructor(){this.entries=/* @__PURE__ */new Map}clearEntries(){return this.entries.clear(),this}deleteEntry(e){return this.entries.delete(e),this}getEntry(e){return this.hasEntry(e)?this.entries.get(e):null}hasEntry(e){return this.entries.has(e)}setEntry(e,t){return this.entries.set(e,t),this}}const Re=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Ae=/^([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*$/;const Ie=/^secret-token:.+$/;function _e(e){if(!Ie.test(e))throw new Error("Passed variable is not a valid token.");return e}const He=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;function Ve(e){if(!He.test(e))throw new g("Passed variable is not a valid UUID v4.");return e}const $e=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,Event:Ce,PriorityRegistry:Pe,Registry:ze,Response:Re,createUniqueUserIdentifierFromString:function(e){return e},eventIdentifierRegex:Le,eventListenerTargetRegex:Ne,getEventListenerTargetsFromEventIdentifier:Me,serviceIdentifierRegex:Ae,tokenRegex:Ie,uuidv4Regex:He,validateEventIdentifierFromString:function(e){if(!Le.test(e))throw new g("Passed variable is not a valid event identifier.");return e},validateEventListenerTargetFromString:De,validateServiceIdentifierFromString:function(e){if(!Ae.test(e))throw new g("Passed variable is not a valid service identifier.");return e},validateTokenFromString:_e,validateUuidFromString:Ve},Symbol.toStringTag,{value:"Module"})),je=class e extends Ce{constructor(t){super(e.identifier),this.normalizedValue=t,this.rawValue=null}getNormalizedValue(){return this.normalizedValue}getRawValue(){return this.rawValue}setRawValue(e){return this.isPropagationStopped()||(this.rawValue=e),this}};je.identifier=t.NormalizedValueToRawValueEvent;let We=je;const Ue=class e extends Ce{constructor(t){super(e.identifier),this.rawValue=t,this.normalizedValue=null}getRawValue(){return this.rawValue}getNormalizedValue(){return this.normalizedValue}setNormalizedValue(e){return this.isPropagationStopped()||(this.normalizedValue=e),this}};Ue.identifier=t.RawValueToNormalizedValueEvent;let Ze=Ue;const Ge=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,NormalizedValueToRawValueEvent:We,RawValueToNormalizedValueEvent:Ze},Symbol.toStringTag,{value:"Module"}));class Be extends Error{}class qe extends Be{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Je extends Be{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Ye extends Be{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Ke extends Be{}class Qe extends Be{constructor(e){super(`Invalid unit ${e}`)}}class Xe extends Be{}class et extends Be{constructor(){super("Zone is an abstract class")}}const tt="numeric",rt="short",nt="long",st={year:tt,month:tt,day:tt},it={year:tt,month:rt,day:tt},ot={year:tt,month:rt,day:tt,weekday:rt},at={year:tt,month:nt,day:tt},lt={year:tt,month:nt,day:tt,weekday:nt},ct={hour:tt,minute:tt},ut={hour:tt,minute:tt,second:tt},ht={hour:tt,minute:tt,second:tt,timeZoneName:rt},dt={hour:tt,minute:tt,second:tt,timeZoneName:nt},ft={hour:tt,minute:tt,hourCycle:"h23"},mt={hour:tt,minute:tt,second:tt,hourCycle:"h23"},pt={hour:tt,minute:tt,second:tt,hourCycle:"h23",timeZoneName:rt},gt={hour:tt,minute:tt,second:tt,hourCycle:"h23",timeZoneName:nt},yt={year:tt,month:tt,day:tt,hour:tt,minute:tt},wt={year:tt,month:tt,day:tt,hour:tt,minute:tt,second:tt},vt={year:tt,month:rt,day:tt,hour:tt,minute:tt},Et={year:tt,month:rt,day:tt,hour:tt,minute:tt,second:tt},St={year:tt,month:rt,day:tt,weekday:rt,hour:tt,minute:tt},bt={year:tt,month:nt,day:tt,hour:tt,minute:tt,timeZoneName:rt},Tt={year:tt,month:nt,day:tt,hour:tt,minute:tt,second:tt,timeZoneName:rt},kt={year:tt,month:nt,day:tt,weekday:nt,hour:tt,minute:tt,timeZoneName:nt},Ot={year:tt,month:nt,day:tt,weekday:nt,hour:tt,minute:tt,second:tt,timeZoneName:nt};class Ft{get type(){throw new et}get name(){throw new et}get ianaName(){return this.name}get isUniversal(){throw new et}offsetName(e,t){throw new et}formatOffset(e,t){throw new et}offset(e){throw new et}equals(e){throw new et}get isValid(){throw new et}}let xt=null;class Ct extends Ft{static get instance(){return null===xt&&(xt=new Ct),xt}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return qr(e,t,r)}formatOffset(e,t){return Qr(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const Lt=/* @__PURE__ */new Map;const Nt={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};const Dt=/* @__PURE__ */new Map;class Mt extends Ft{static create(e){let t=Dt.get(e);return void 0===t&&Dt.set(e,t=new Mt(e)),t}static resetCache(){Dt.clear(),Lt.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(t){return!1}}constructor(e){super(),this.zoneName=e,this.valid=Mt.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return qr(e,t,r,this.name)}formatOffset(e,t){return Qr(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const r=function(e){let t=Lt.get(e);return void 0===t&&(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"}),Lt.set(e,t)),t}(this.name);let[n,s,i,o,a,l,c]=r.formatToParts?function(e,t){const r=e.formatToParts(t),n=[];for(let s=0;s<r.length;s++){const{type:e,value:t}=r[s],i=Nt[e];"era"===e?n[i]=t:xr(i)||(n[i]=parseInt(t,10))}return n}(r,t):function(e,t){const r=e.format(t).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,s,i,o,a,l,c,u]=n;return[o,s,i,a,l,c,u]}(r,t);"BC"===o&&(n=1-Math.abs(n));let u=+t;const h=u%1e3;return u-=h>=0?h:1e3+h,(Ur({year:n,month:s,day:i,hour:24===a?0:a,minute:l,second:c,millisecond:0})-u)/6e4}equals(e){return"iana"===e.type&&e.name===this.name}get isValid(){return this.valid}}let Pt={};const zt=/* @__PURE__ */new Map;function Rt(e,t={}){const r=JSON.stringify([e,t]);let n=zt.get(r);return void 0===n&&(n=new Intl.DateTimeFormat(e,t),zt.set(r,n)),n}const At=/* @__PURE__ */new Map;const It=/* @__PURE__ */new Map;let _t=null;const Ht=/* @__PURE__ */new Map;function Vt(e){let t=Ht.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),Ht.set(e,t)),t}const $t=/* @__PURE__ */new Map;function jt(e,t,r,n){const s=e.listingMode();return"error"===s?null:"en"===s?r(t):n(t)}class Wt{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:n,floor:s,...i}=r;if(!t||Object.keys(i).length>0){const t={useGrouping:!1,...r};r.padTo>0&&(t.minimumIntegerDigits=r.padTo),this.inf=function(e,t={}){const r=JSON.stringify([e,t]);let n=At.get(r);return void 0===n&&(n=new Intl.NumberFormat(e,t),At.set(r,n)),n}(e,t)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}return Ar(this.floor?Math.floor(e):Vr(e,3),this.padTo)}}class Ut{constructor(e,t,r){let n;if(this.opts=r,this.originalZone=void 0,this.opts.timeZone)this.dt=e;else if("fixed"===e.zone.type){const t=e.offset/60*-1,r=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;0!==e.offset&&Mt.create(r).valid?(n=r,this.dt=e):(n="UTC",this.dt=0===e.offset?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else"system"===e.zone.type?this.dt=e:"iana"===e.zone.type?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||n,this.dtf=Rt(t,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if("timeZoneName"===e.type){const t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class Zt{constructor(e,t,r){this.opts={style:"long",...r},!t&&Nr()&&(this.rtf=function(e,t={}){const{base:r,...n}=t,s=JSON.stringify([e,n]);let i=It.get(s);return void 0===i&&(i=new Intl.RelativeTimeFormat(e,t),It.set(s,i)),i}(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):function(e,t,r="always",n=!1){const s={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."]},i=-1===["hours","minutes","seconds"].indexOf(e);if("auto"===r&&i){const r="days"===e;switch(t){case 1:return r?"tomorrow":`next ${s[e][0]}`;case-1:return r?"yesterday":`last ${s[e][0]}`;case 0:return r?"today":`this ${s[e][0]}`}}const o=Object.is(t,-0)||t<0,a=Math.abs(t),l=1===a,c=s[e],u=n?l?c[1]:c[2]||c[1]:l?s[e][0]:e;return o?`${a} ${u} ago`:`in ${a} ${u}`}(t,e,this.opts.numeric,"long"!==this.opts.style)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const Gt={firstDay:1,minimalDays:4,weekend:[6,7]};class Bt{static fromOpts(e){return Bt.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,n,s=!1){const i=e||hr.defaultLocale,o=i||(s?"en-US":_t||(_t=(new Intl.DateTimeFormat).resolvedOptions().locale,_t)),a=t||hr.defaultNumberingSystem,l=r||hr.defaultOutputCalendar,c=zr(n)||hr.defaultWeekSettings;return new Bt(o,a,l,c,i)}static resetCache(){_t=null,zt.clear(),At.clear(),It.clear(),Ht.clear(),$t.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:n}={}){return Bt.create(e,t,r,n)}constructor(e,t,r,n,s){const[i,o,a]=function(e){const t=e.indexOf("-x-");-1!==t&&(e=e.substring(0,t));const r=e.indexOf("-u-");if(-1===r)return[e];{let t,s;try{t=Rt(e).resolvedOptions(),s=e}catch(n){const i=e.substring(0,r);t=Rt(i).resolvedOptions(),s=i}const{numberingSystem:i,calendar:o}=t;return[s,i,o]}}(e);this.locale=i,this.numberingSystem=t||o||null,this.outputCalendar=r||a||null,this.weekSettings=n,this.intl=function(e,t,r){return r||t?(e.includes("-u-")||(e+="-u"),r&&(e+=`-ca-${r}`),t&&(e+=`-nu-${t}`),e):e}(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){var e;return null==this.fastNumbersCached&&(this.fastNumbersCached=(!(e=this).numberingSystem||"latn"===e.numberingSystem)&&("latn"===e.numberingSystem||!e.locale||e.locale.startsWith("en")||"latn"===Vt(e.locale).numberingSystem)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return e&&t?"en":"intl"}clone(e){return e&&0!==Object.getOwnPropertyNames(e).length?Bt.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,zr(e.weekSettings)||this.weekSettings,e.defaultToEN||!1):this}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return jt(this,e,nn,()=>{const r="ja"===this.intl||this.intl.startsWith("ja-"),n=(t&=!r)?{month:e,day:"numeric"}:{month:e},s=t?"format":"standalone";if(!this.monthsCache[s][e]){const t=r?e=>this.dtFormatter(e,n).format():e=>this.extract(e,n,"month");this.monthsCache[s][e]=function(e){const t=[];for(let r=1;r<=12;r++){const n=ci.utc(2009,r,1);t.push(e(n))}return t}(t)}return this.monthsCache[s][e]})}weekdays(e,t=!1){return jt(this,e,ln,()=>{const r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=t?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=function(e){const t=[];for(let r=1;r<=7;r++){const n=ci.utc(2016,11,13+r);t.push(e(n))}return t}(e=>this.extract(e,r,"weekday"))),this.weekdaysCache[n][e]})}meridiems(){return jt(this,void 0,()=>cn,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[ci.utc(2016,11,13,9),ci.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return jt(this,e,fn,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[ci.utc(-40,1,1),ci.utc(2017,1,1)].map(e=>this.extract(e,t,"era"))),this.eraCache[e]})}extract(e,t,r){const n=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===r);return n?n.value:null}numberFormatter(e={}){return new Wt(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Ut(e,this.intl,t)}relFormatter(e={}){return new Zt(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function(e,t={}){const r=JSON.stringify([e,t]);let n=Pt[r];return n||(n=new Intl.ListFormat(e,t),Pt[r]=n),n}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||Vt(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Dr()?function(e){let t=$t.get(e);if(!t){const r=new Intl.Locale(e);t="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,"minimalDays"in t||(t={...Gt,...t}),$t.set(e,t)}return t}(this.locale):Gt}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 qt=null;class Jt extends Ft{static get utcInstance(){return null===qt&&(qt=new Jt(0)),qt}static instance(e){return 0===e?Jt.utcInstance:new Jt(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Jt(Jr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Qr(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Qr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Qr(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return"fixed"===e.type&&e.fixed===this.fixed}get isValid(){return!0}}class Yt extends Ft{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 Kt(e,t){if(xr(e)||null===e)return t;if(e instanceof Ft)return e;if("string"==typeof e){const r=e.toLowerCase();return"default"===r?t:"local"===r||"system"===r?Ct.instance:"utc"===r||"gmt"===r?Jt.utcInstance:Jt.parseSpecifier(r)||Mt.create(e)}return Cr(e)?Jt.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new Yt(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"},Xt={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]},er=Qt.hanidec.replace(/[\[|\]]/g,"").split("");const tr=/* @__PURE__ */new Map;function rr({numberingSystem:e},t=""){const r=e||"latn";let n=tr.get(r);void 0===n&&(n=/* @__PURE__ */new Map,tr.set(r,n));let s=n.get(t);return void 0===s&&(s=new RegExp(`${Qt[r]}${t}`),n.set(t,s)),s}let nr,sr=()=>Date.now(),ir="system",or=null,ar=null,lr=null,cr=60,ur=null;class hr{static get now(){return sr}static set now(e){sr=e}static set defaultZone(e){ir=e}static get defaultZone(){return Kt(ir,Ct.instance)}static get defaultLocale(){return or}static set defaultLocale(e){or=e}static get defaultNumberingSystem(){return ar}static set defaultNumberingSystem(e){ar=e}static get defaultOutputCalendar(){return lr}static set defaultOutputCalendar(e){lr=e}static get defaultWeekSettings(){return ur}static set defaultWeekSettings(e){ur=zr(e)}static get twoDigitCutoffYear(){return cr}static set twoDigitCutoffYear(e){cr=e%100}static get throwOnInvalid(){return nr}static set throwOnInvalid(e){nr=e}static resetCaches(){Bt.resetCache(),Mt.resetCache(),ci.resetCache(),tr.clear()}}class dr{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const fr=[0,31,59,90,120,151,181,212,243,273,304,334],mr=[0,31,60,91,121,152,182,213,244,274,305,335];function pr(e,t){return new dr("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function gr(e,t,r){const n=new Date(Date.UTC(e,t-1,r));e<100&&e>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const s=n.getUTCDay();return 0===s?7:s}function yr(e,t,r){return r+($r(e)?mr:fr)[t-1]}function wr(e,t){const r=$r(e)?mr:fr,n=r.findIndex(e=>e<t);return{month:n+1,day:t-r[n]}}function vr(e,t){return(e-t+7)%7+1}function Er(e,t=4,r=1){const{year:n,month:s,day:i}=e,o=yr(n,s,i),a=vr(gr(n,s,i),r);let l,c=Math.floor((o-a+14-t)/7);return c<1?(l=n-1,c=Gr(l,t,r)):c>Gr(n,t,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:a,...Xr(e)}}function Sr(e,t=4,r=1){const{weekYear:n,weekNumber:s,weekday:i}=e,o=vr(gr(n,1,t),r),a=jr(n);let l,c=7*s+i-o-7+t;c<1?(l=n-1,c+=jr(l)):c>a?(l=n+1,c-=jr(n)):l=n;const{month:u,day:h}=wr(l,c);return{year:l,month:u,day:h,...Xr(e)}}function br(e){const{year:t,month:r,day:n}=e;return{year:t,ordinal:yr(t,r,n),...Xr(e)}}function Tr(e){const{year:t,ordinal:r}=e,{month:n,day:s}=wr(t,r);return{year:t,month:n,day:s,...Xr(e)}}function kr(e,t){if(!xr(e.localWeekday)||!xr(e.localWeekNumber)||!xr(e.localWeekYear)){if(!xr(e.weekday)||!xr(e.weekNumber)||!xr(e.weekYear))throw new Ke("Cannot mix locale-based week fields with ISO-based week fields");return xr(e.localWeekday)||(e.weekday=e.localWeekday),xr(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),xr(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function Or(e){const t=Lr(e.year),r=Rr(e.month,1,12),n=Rr(e.day,1,Wr(e.year,e.month));return t?r?!n&&pr("day",e.day):pr("month",e.month):pr("year",e.year)}function Fr(e){const{hour:t,minute:r,second:n,millisecond:s}=e,i=Rr(t,0,23)||24===t&&0===r&&0===n&&0===s,o=Rr(r,0,59),a=Rr(n,0,59),l=Rr(s,0,999);return i?o?a?!l&&pr("millisecond",s):pr("second",n):pr("minute",r):pr("hour",t)}function xr(e){return void 0===e}function Cr(e){return"number"==typeof e}function Lr(e){return"number"==typeof e&&e%1==0}function Nr(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function Dr(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function Mr(e,t,r){if(0!==e.length)return e.reduce((e,n)=>{const s=[t(n),n];return e&&r(e[0],s[0])===e[0]?e:s},null)[1]}function Pr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function zr(e){if(null==e)return null;if("object"!=typeof e)throw new Xe("Week settings must be an object");if(!Rr(e.firstDay,1,7)||!Rr(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!Rr(e,1,7)))throw new Xe("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function Rr(e,t,r){return Lr(e)&&e>=t&&e<=r}function Ar(e,t=2){let r;return r=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),r}function Ir(e){return xr(e)||null===e||""===e?void 0:parseInt(e,10)}function _r(e){return xr(e)||null===e||""===e?void 0:parseFloat(e)}function Hr(e){if(!xr(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function Vr(e,t,r="round"){const n=10**t;switch(r){case"expand":return e>0?Math.ceil(e*n)/n:Math.floor(e*n)/n;case"trunc":return Math.trunc(e*n)/n;case"round":return Math.round(e*n)/n;case"floor":return Math.floor(e*n)/n;case"ceil":return Math.ceil(e*n)/n;default:throw new RangeError(`Value rounding ${r} is out of range`)}}function $r(e){return e%4==0&&(e%100!=0||e%400==0)}function jr(e){return $r(e)?366:365}function Wr(e,t){const r=(n=t-1)-(s=12)*Math.floor(n/s)+1;var n,s;return 2===r?$r(e+(t-r)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function Ur(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 Zr(e,t,r){return-vr(gr(e,1,t),r)+t-1}function Gr(e,t=4,r=1){const n=Zr(e,t,r),s=Zr(e+1,t,r);return(jr(e)-n+s)/7}function Br(e){return e>99?e:e>hr.twoDigitCutoffYear?1900+e:2e3+e}function qr(e,t,r,n=null){const s=new Date(e),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(i.timeZone=n);const o={timeZoneName:t,...i},a=new Intl.DateTimeFormat(r,o).formatToParts(s).find(e=>"timezonename"===e.type.toLowerCase());return a?a.value:null}function Jr(e,t){let r=parseInt(e,10);Number.isNaN(r)&&(r=0);const n=parseInt(t,10)||0;return 60*r+(r<0||Object.is(r,-0)?-n:n)}function Yr(e){const t=Number(e);if("boolean"==typeof e||""===e||!Number.isFinite(t))throw new Xe(`Invalid unit value ${e}`);return t}function Kr(e,t){const r={};for(const n in e)if(Pr(e,n)){const s=e[n];if(null==s)continue;r[t(n)]=Yr(s)}return r}function Qr(e,t){const r=Math.trunc(Math.abs(e/60)),n=Math.trunc(Math.abs(e%60)),s=e>=0?"+":"-";switch(t){case"short":return`${s}${Ar(r,2)}:${Ar(n,2)}`;case"narrow":return`${s}${r}${n>0?`:${n}`:""}`;case"techie":return`${s}${Ar(r,2)}${Ar(n,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function Xr(e){return function(e,t){return t.reduce((t,r)=>(t[r]=e[r],t),{})}(e,["hour","minute","second","millisecond"])}const en=["January","February","March","April","May","June","July","August","September","October","November","December"],tn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],rn=["J","F","M","A","M","J","J","A","S","O","N","D"];function nn(e){switch(e){case"narrow":return[...rn];case"short":return[...tn];case"long":return[...en];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 sn=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],on=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],an=["M","T","W","T","F","S","S"];function ln(e){switch(e){case"narrow":return[...an];case"short":return[...on];case"long":return[...sn];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const cn=["AM","PM"],un=["Before Christ","Anno Domini"],hn=["BC","AD"],dn=["B","A"];function fn(e){switch(e){case"narrow":return[...dn];case"short":return[...hn];case"long":return[...un];default:return null}}function mn(e,t){let r="";for(const n of e)n.literal?r+=n.val:r+=t(n.val);return r}const pn={D:st,DD:it,DDD:at,DDDD:lt,t:ct,tt:ut,ttt:ht,tttt:dt,T:ft,TT:mt,TTT:pt,TTTT:gt,f:yt,ff:vt,fff:bt,ffff:kt,F:wt,FF:Et,FFF:Tt,FFFF:Ot};class gn{static create(e,t={}){return new gn(e,t)}static parseFormat(e){let t=null,r="",n=!1;const s=[];for(let i=0;i<e.length;i++){const o=e.charAt(i);"'"===o?((r.length>0||n)&&s.push({literal:n||/^\s+$/.test(r),val:""===r?"'":r}),t=null,r="",n=!n):n||o===t?r+=o:(r.length>0&&s.push({literal:/^\s+$/.test(r),val:r}),r=o,t=o)}return r.length>0&&s.push({literal:n||/^\s+$/.test(r),val:r}),s}static macroTokenToFormatOpts(e){return pn[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem());return 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,r=void 0){if(this.opts.forceSimple)return Ar(e,t);const n={...this.opts};return t>0&&(n.padTo=t),r&&(n.signDisplay=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){const r="en"===this.loc.listingMode(),n=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,s=(t,r)=>this.loc.extract(e,t,r),i=t=>e.isOffsetFixed&&0===e.offset&&t.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,t.format):"",o=()=>r?function(e){return cn[e.hour<12?0:1]}(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(t,n)=>r?function(e,t){return nn(t)[e.month-1]}(e,t):s(n?{month:t}:{month:t,day:"numeric"},"month"),l=(t,n)=>r?function(e,t){return ln(t)[e.weekday-1]}(e,t):s(n?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),c=t=>{const r=gn.macroTokenToFormatOpts(t);return r?this.formatWithSystemDefault(e,r):t},u=t=>r?function(e,t){return fn(t)[e.year<0?0:1]}(e,t):s({era:t},"era");return mn(gn.parseFormat(t),t=>{switch(t){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12==0?12:e.hour%12);case"hh":return this.num(e.hour%12==0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return i({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return i({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return i({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return n?s({day:"numeric"},"day"):this.num(e.day);case"dd":return n?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":case"E":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return n?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return n?s({month:"numeric"},"month"):this.num(e.month);case"MM":return n?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return n?s({year:"numeric"},"year"):this.num(e.year);case"yy":return n?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return u("short");case"GG":return u("long");case"GGGGG":return u("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(t)}})}formatDurationFromString(e,t){const r="negativeLargestOnly"===this.opts.signMode?-1:1,n=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}},s=gn.parseFormat(t),i=s.reduce((e,{literal:t,val:r})=>t?e:e.concat(r),[]),o=e.shiftTo(...i.map(n).filter(e=>e));return mn(s,((e,t)=>s=>{const i=n(s);if(i){const n=t.isNegativeDuration&&i!==t.largestUnit?r:1;let o;return o="negativeLargestOnly"===this.opts.signMode&&i!==t.largestUnit?"never":"all"===this.opts.signMode?"always":"auto",this.num(e.get(i)*n,s.length,o)}return s})(o,{isNegativeDuration:o<0,largestUnit:Object.keys(o.values)[0]}))}}const yn=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function wn(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function vn(...e){return t=>e.reduce(([e,r,n],s)=>{const[i,o,a]=s(t,n);return[{...e,...i},o||r,a]},[{},null,1]).slice(0,2)}function En(e,...t){if(null==e)return[null,null];for(const[r,n]of t){const t=r.exec(e);if(t)return n(t)}return[null,null]}function Sn(...e){return(t,r)=>{const n={};let s;for(s=0;s<e.length;s++)n[e[s]]=Ir(t[r+s]);return[n,null,r+s]}}const bn=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Tn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,kn=RegExp(`${Tn.source}${`(?:${bn.source}?(?:\\[(${yn.source})\\])?)?`}`),On=RegExp(`(?:[Tt]${kn.source})?`),Fn=Sn("weekYear","weekNumber","weekDay"),xn=Sn("year","ordinal"),Cn=RegExp(`${Tn.source} ?(?:${bn.source}|(${yn.source}))?`),Ln=RegExp(`(?: ${Cn.source})?`);function Nn(e,t,r){const n=e[t];return xr(n)?r:Ir(n)}function Dn(e,t){return[{hours:Nn(e,t,0),minutes:Nn(e,t+1,0),seconds:Nn(e,t+2,0),milliseconds:Hr(e[t+3])},null,t+4]}function Mn(e,t){const r=!e[t]&&!e[t+1],n=Jr(e[t+1],e[t+2]);return[{},r?null:Jt.instance(n),t+3]}function Pn(e,t){return[{},e[t]?Mt.create(e[t]):null,t+1]}const zn=RegExp(`^T?${Tn.source}$`),Rn=/^-?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 An(e){const[t,r,n,s,i,o,a,l,c]=e,u="-"===t[0],h=l&&"-"===l[0],d=(e,t=!1)=>void 0!==e&&(t||e&&u)?-e:e;return[{years:d(_r(r)),months:d(_r(n)),weeks:d(_r(s)),days:d(_r(i)),hours:d(_r(o)),minutes:d(_r(a)),seconds:d(_r(l),"-0"===l),milliseconds:d(Hr(c),h)}]}const In={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function _n(e,t,r,n,s,i,o){const a={year:2===t.length?Br(Ir(t)):Ir(t),month:tn.indexOf(r)+1,day:Ir(n),hour:Ir(s),minute:Ir(i)};return o&&(a.second=Ir(o)),e&&(a.weekday=e.length>3?sn.indexOf(e)+1:on.indexOf(e)+1),a}const Hn=/^(?:(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 Vn(e){const[,t,r,n,s,i,o,a,l,c,u,h]=e,d=_n(t,s,n,r,i,o,a);let f;return f=l?In[l]:c?0:Jr(u,h),[d,new Jt(f)]}const $n=/^(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$/,jn=/^(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$/,Wn=/^(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 Un(e){const[,t,r,n,s,i,o,a]=e;return[_n(t,s,n,r,i,o,a),Jt.utcInstance]}function Zn(e){const[,t,r,n,s,i,o,a]=e;return[_n(t,a,r,n,s,i,o),Jt.utcInstance]}const Gn=wn(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,On),Bn=wn(/(\d{4})-?W(\d\d)(?:-?(\d))?/,On),qn=wn(/(\d{4})-?(\d{3})/,On),Jn=wn(kn),Yn=vn(function(e,t){return[{year:Nn(e,t),month:Nn(e,t+1,1),day:Nn(e,t+2,1)},null,t+3]},Dn,Mn,Pn),Kn=vn(Fn,Dn,Mn,Pn),Qn=vn(xn,Dn,Mn,Pn),Xn=vn(Dn,Mn,Pn);const es=vn(Dn);const ts=wn(/(\d{4})-(\d\d)-(\d\d)/,Ln),rs=wn(Cn),ns=vn(Dn,Mn,Pn);const ss="Invalid Duration",is={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},os={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...is},as=365.2425,ls=30.436875,cs={years:{quarters:4,months:12,weeks:52.1775,days:as,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:ls,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...is},us=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],hs=us.slice(0).reverse();function ds(e,t,r=!1){const n={values:r?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new gs(n)}function fs(e,t){let r=t.milliseconds??0;for(const n of hs.slice(1))t[n]&&(r+=t[n]*e[n].milliseconds);return r}function ms(e,t){const r=fs(e,t)<0?-1:1;us.reduceRight((n,s)=>{if(xr(t[s]))return n;if(n){const i=t[n]*r,o=e[s][n],a=Math.floor(i/o);t[s]+=a*r,t[n]-=a*o*r}return s},null),us.reduce((r,n)=>{if(xr(t[n]))return r;if(r){const s=t[r]%1;t[r]-=s,t[n]+=s*e[r][n]}return n},null)}function ps(e){const t={};for(const[r,n]of Object.entries(e))0!==n&&(t[r]=n);return t}class gs{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let r=t?cs:os;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||Bt.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return gs.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new Xe("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new gs({values:Kr(e,gs.normalizeUnit),loc:Bt.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(Cr(e))return gs.fromMillis(e);if(gs.isDuration(e))return e;if("object"==typeof e)return gs.fromObject(e);throw new Xe(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[r]=En(e,[Rn,An]);return r?gs.fromObject(r,t):gs.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[r]=En(e,[zn,es]);return r?gs.fromObject(r,t):gs.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Xe("need to specify a reason the Duration is invalid");const r=e instanceof dr?e:new dr(e,t);if(hr.throwOnInvalid)throw new Ye(r);return new gs({invalid:r})}static normalizeUnit(e){const 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():e];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={}){const r={...t,floor:!1!==t.round&&!1!==t.floor};return this.isValid?gn.create(this.loc,r).formatDurationFromString(this,e):ss}toHuman(e={}){if(!this.isValid)return ss;const t=!1!==e.showZeros,r=us.map(r=>{const n=this.values[r];return xr(n)||0===n&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(n)}).filter(e=>e);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return 0!==this.years&&(e+=this.years+"Y"),0===this.months&&0===this.quarters||(e+=this.months+3*this.quarters+"M"),0!==this.weeks&&(e+=this.weeks+"W"),0!==this.days&&(e+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(e+="T"),0!==this.hours&&(e+=this.hours+"H"),0!==this.minutes&&(e+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(e+=Vr(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===e&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();if(t<0||t>=864e5)return null;e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1};return ci.fromMillis(t,{zone:"UTC"}).toISOTime(e)}toJSON(){return this.toISO()}toString(){return this.toISO()}[/* @__PURE__ */Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?fs(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=gs.fromDurationLike(e),r={};for(const n of us)(Pr(t.values,n)||Pr(this.values,n))&&(r[n]=t.get(n)+this.get(n));return ds(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const t=gs.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const r of Object.keys(this.values))t[r]=Yr(e(this.values[r],r));return ds(this,{values:t},!0)}get(e){return this[gs.normalizeUnit(e)]}set(e){if(!this.isValid)return this;return ds(this,{values:{...this.values,...Kr(e,gs.normalizeUnit)}})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:n}={}){return ds(this,{loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:n,conversionAccuracy:r})}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return ms(this.matrix,e),ds(this,{values:e},!0)}rescale(){if(!this.isValid)return this;return ds(this,{values:ps(this.normalize().shiftToAll().toObject())},!0)}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>gs.normalizeUnit(e));const t={},r={},n=this.toObject();let s;for(const i of us)if(e.indexOf(i)>=0){s=i;let e=0;for(const t in r)e+=this.matrix[t][i]*r[t],r[t]=0;Cr(n[i])&&(e+=n[i]);const o=Math.trunc(e);t[i]=o,r[i]=(1e3*e-1e3*o)/1e3}else Cr(n[i])&&(r[i]=n[i]);for(const i in r)0!==r[i]&&(t[s]+=i===s?r[i]:r[i]/this.matrix[s][i]);return ms(this.matrix,t),ds(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=0===this.values[t]?0:-this.values[t];return ds(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;return ds(this,{values:ps(this.values)},!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 null===this.invalid}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)return!1;if(!this.loc.equals(e.loc))return!1;function t(e,t){return void 0===e||0===e?void 0===t||0===t:e===t}for(const r of us)if(!t(this.values[r],e.values[r]))return!1;return!0}}const ys="Invalid Interval";class ws{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new Xe("need to specify a reason the Interval is invalid");const r=e instanceof dr?e:new dr(e,t);if(hr.throwOnInvalid)throw new Je(r);return new ws({invalid:r})}static fromDateTimes(e,t){const r=ui(e),n=ui(t),s=function(e,t){return e&&e.isValid?t&&t.isValid?t<e?ws.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:ws.invalid("missing or invalid end"):ws.invalid("missing or invalid start")}(r,n);return null==s?new ws({start:r,end:n}):s}static after(e,t){const r=gs.fromDurationLike(t),n=ui(e);return ws.fromDateTimes(n,n.plus(r))}static before(e,t){const r=gs.fromDurationLike(t),n=ui(e);return ws.fromDateTimes(n.minus(r),n)}static fromISO(e,t){const[r,n]=(e||"").split("/",2);if(r&&n){let e,i,o,a;try{e=ci.fromISO(r,t),i=e.isValid}catch(s){i=!1}try{o=ci.fromISO(n,t),a=o.isValid}catch(s){a=!1}if(i&&a)return ws.fromDateTimes(e,o);if(i){const r=gs.fromISO(n,t);if(r.isValid)return ws.after(e,r)}else if(a){const e=gs.fromISO(r,t);if(e.isValid)return ws.before(o,e)}}return ws.invalid("unparsable",`the input "${e}" 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 null===this.invalidReason}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;const r=this.start.startOf(e,t);let n;return n=t?.useLocaleWeeks?this.end.reconfigure({locale:r.locale}):this.end,n=n.startOf(e,t),Math.floor(n.diff(r,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,e))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return!!this.isValid&&this.s>e}isBefore(e){return!!this.isValid&&this.e<=e}contains(e){return!!this.isValid&&(this.s<=e&&this.e>e)}set({start:e,end:t}={}){return this.isValid?ws.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(ui).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),r=[];let{s:n}=this,s=0;for(;n<this.e;){const e=t[s]||this.e,i=+e>+this.e?this.e:e;r.push(ws.fromDateTimes(n,i)),n=i,s+=1}return r}splitBy(e){const t=gs.fromDurationLike(e);if(!this.isValid||!t.isValid||0===t.as("milliseconds"))return[];let r,{s:n}=this,s=1;const i=[];for(;n<this.e;){const e=this.start.plus(t.mapUnits(e=>e*s));r=+e>+this.e?this.e:e,i.push(ws.fromDateTimes(n,r)),n=r,s+=1}return i}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}abutsEnd(e){return!!this.isValid&&+e.e===+this.s}engulfs(e){return!!this.isValid&&(this.s<=e.s&&this.e>=e.e)}equals(e){return!(!this.isValid||!e.isValid)&&(this.s.equals(e.s)&&this.e.equals(e.e))}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return t>=r?null:ws.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return ws.fromDateTimes(t,r)}static merge(e){const[t,r]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],r)=>t?t.overlaps(r)||t.abutsStart(r)?[e,t.union(r)]:[e.concat([t]),r]:[e,r],[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0;const n=[],s=e.map(e=>[{time:e.s,type:"s"},{time:e.e,type:"e"}]),i=Array.prototype.concat(...s).sort((e,t)=>e.time-t.time);for(const o of i)r+="s"===o.type?1:-1,1===r?t=o.time:(t&&+t!==+o.time&&n.push(ws.fromDateTimes(t,o.time)),t=null);return ws.merge(n)}difference(...e){return ws.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ys}[/* @__PURE__ */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=st,t={}){return this.isValid?gn.create(this.s.loc.clone(t),e).formatInterval(this):ys}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ys}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ys}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ys}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ys}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):gs.invalid(this.invalidReason)}mapEndpoints(e){return ws.fromDateTimes(e(this.s),e(this.e))}}class vs{static hasDST(e=hr.defaultZone){const t=ci.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Mt.isValidZone(e)}static normalizeZone(e){return Kt(e,hr.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Bt.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Bt.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Bt.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:s="gregory"}={}){return(n||Bt.create(t,r,s)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:s="gregory"}={}){return(n||Bt.create(t,r,s)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Bt.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Bt.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Bt.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Bt.create(t,null,"gregory").eras(e)}static features(){return{relative:Nr(),localeWeek:Dr()}}}function Es(e,t){const r=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(t)-r(e);return Math.floor(gs.fromMillis(n).as("days"))}function Ss(e,t,r,n){let[s,i,o,a]=function(e,t,r){const n=[["years",(e,t)=>t.year-e.year],["quarters",(e,t)=>t.quarter-e.quarter+4*(t.year-e.year)],["months",(e,t)=>t.month-e.month+12*(t.year-e.year)],["weeks",(e,t)=>{const r=Es(e,t);return(r-r%7)/7}],["days",Es]],s={},i=e;let o,a;for(const[l,c]of n)r.indexOf(l)>=0&&(o=l,s[l]=c(e,t),a=i.plus(s),a>t?(s[l]--,(e=i.plus(s))>t&&(a=e,s[l]--,e=i.plus(s))):e=a);return[e,s,a,o]}(e,t,r);const l=t-s,c=r.filter(e=>["hours","minutes","seconds","milliseconds"].indexOf(e)>=0);0===c.length&&(o<t&&(o=s.plus({[a]:1})),o!==s&&(i[a]=(i[a]||0)+l/(o-s)));const u=gs.fromObject(i,n);return c.length>0?gs.fromMillis(l,n).shiftTo(...c).plus(u):u}function bs(e,t=e=>e){return{regex:e,deser:([e])=>t(function(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(-1!==e[r].search(Qt.hanidec))t+=er.indexOf(e[r]);else for(const e in Xt){const[r,s]=Xt[e];n>=r&&n<=s&&(t+=n-r)}}return parseInt(t,10)}return t}(e))}}const Ts=`[ ${String.fromCharCode(160)}]`,ks=new RegExp(Ts,"g");function Os(e){return e.replace(/\./g,"\\.?").replace(ks,Ts)}function Fs(e){return e.replace(/\./g,"").replace(ks," ").toLowerCase()}function xs(e,t){return null===e?null:{regex:RegExp(e.map(Os).join("|")),deser:([r])=>e.findIndex(e=>Fs(r)===Fs(e))+t}}function Cs(e,t){return{regex:e,deser:([,e,t])=>Jr(e,t),groups:t}}function Ls(e){return{regex:e,deser:([e])=>e}}const Ns={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"}};let Ds=null;function Ms(e,t){return Array.prototype.concat(...e.map(e=>function(e,t){if(e.literal)return e;const r=Rs(gn.macroTokenToFormatOpts(e.val),t);return null==r||r.includes(void 0)?e:r}(e,t)))}let Ps=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Ms(gn.parseFormat(t),e),this.units=this.tokens.map(t=>function(e,t){const r=rr(t),n=rr(t,"{2}"),s=rr(t,"{3}"),i=rr(t,"{4}"),o=rr(t,"{6}"),a=rr(t,"{1,2}"),l=rr(t,"{1,3}"),c=rr(t,"{1,6}"),u=rr(t,"{1,9}"),h=rr(t,"{2,4}"),d=rr(t,"{4,6}"),f=e=>{return{regex:RegExp((t=e.val,t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([e])=>e,literal:!0};var t},m=(m=>{if(e.literal)return f(m);switch(m.val){case"G":return xs(t.eras("short"),0);case"GG":return xs(t.eras("long"),0);case"y":return bs(c);case"yy":case"kk":return bs(h,Br);case"yyyy":case"kkkk":return bs(i);case"yyyyy":return bs(d);case"yyyyyy":return bs(o);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return bs(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return bs(n);case"MMM":return xs(t.months("short",!0),1);case"MMMM":return xs(t.months("long",!0),1);case"LLL":return xs(t.months("short",!1),1);case"LLLL":return xs(t.months("long",!1),1);case"o":case"S":return bs(l);case"ooo":case"SSS":return bs(s);case"u":return Ls(u);case"uu":return Ls(a);case"uuu":case"E":case"c":return bs(r);case"a":return xs(t.meridiems(),0);case"EEE":return xs(t.weekdays("short",!1),1);case"EEEE":return xs(t.weekdays("long",!1),1);case"ccc":return xs(t.weekdays("short",!0),1);case"cccc":return xs(t.weekdays("long",!0),1);case"Z":case"ZZ":return Cs(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return Cs(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return Ls(/[a-z_+-/]{1,256}?/i);case" ":return Ls(/[^\S\n\r]/);default:return f(m)}})(e)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return m.token=e,m}(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){const[e,t]=[`^${(r=this.units).map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,"")}$`,r];this.regex=RegExp(e,"i"),this.handlers=t}var r}explainFromTokens(e){if(this.isValid){const[t,r]=function(e,t,r){const n=e.match(t);if(n){const e={};let t=1;for(const s in r)if(Pr(r,s)){const i=r[s],o=i.groups?i.groups+1:1;!i.literal&&i.token&&(e[i.token.val[0]]=i.deser(n.slice(t,t+o))),t+=o}return[n,e]}return[n,{}]}(e,this.regex,this.handlers),[n,s,i]=r?function(e){let t,r=null;return xr(e.z)||(r=Mt.create(e.z)),xr(e.Z)||(r||(r=new Jt(e.Z)),t=e.Z),xr(e.q)||(e.M=3*(e.q-1)+1),xr(e.h)||(e.h<12&&1===e.a?e.h+=12:12===e.h&&0===e.a&&(e.h=0)),0===e.G&&e.y&&(e.y=-e.y),xr(e.u)||(e.S=Hr(e.u)),[Object.keys(e).reduce((t,r)=>{const n=(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}})(r);return n&&(t[n]=e[r]),t},{}),r,t]}(r):[null,null,void 0];if(Pr(r,"a")&&Pr(r,"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:r,result:n,zone:s,specificOffset:i}}return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function zs(e,t,r){return new Ps(e,r).explainFromTokens(t)}function Rs(e,t){if(!e)return null;const r=gn.create(t,e).dtFormatter((Ds||(Ds=ci.fromMillis(1555555555555)),Ds)),n=r.formatToParts(),s=r.resolvedOptions();return n.map(t=>function(e,t,r){const{type:n,value:s}=e;if("literal"===n){const e=/^\s+$/.test(s);return{literal:!e,val:e?" ":s}}const i=t[n];let o=n;"hour"===n&&(o=null!=t.hour12?t.hour12?"hour12":"hour24":null!=t.hourCycle?"h11"===t.hourCycle||"h12"===t.hourCycle?"hour12":"hour24":r.hour12?"hour12":"hour24");let a=Ns[o];if("object"==typeof a&&(a=a[i]),a)return{literal:!1,val:a}}(t,e,s))}const As="Invalid DateTime",Is=864e13;function _s(e){return new dr("unsupported zone",`the zone "${e.name}" is not supported`)}function Hs(e){return null===e.weekData&&(e.weekData=Er(e.c)),e.weekData}function Vs(e){return null===e.localWeekData&&(e.localWeekData=Er(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function $s(e,t){const r={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new ci({...r,...t,old:r})}function js(e,t,r){let n=e-60*t*1e3;const s=r.offset(n);if(t===s)return[n,t];n-=60*(s-t)*1e3;const i=r.offset(n);return s===i?[n,s]:[e-60*Math.min(s,i)*1e3,Math.max(s,i)]}function Ws(e,t){const r=new Date(e+=60*t*1e3);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function Us(e,t,r){return js(Ur(e),t,r)}function Zs(e,t){const r=e.o,n=e.c.year+Math.trunc(t.years),s=e.c.month+Math.trunc(t.months)+3*Math.trunc(t.quarters),i={...e.c,year:n,month:s,day:Math.min(e.c.day,Wr(n,s))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},o=gs.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"),a=Ur(i);let[l,c]=js(a,r,e.zone);return 0!==o&&(l+=o,c=e.zone.offset(l)),{ts:l,o:c}}function Gs(e,t,r,n,s,i){const{setZone:o,zone:a}=r;if(e&&0!==Object.keys(e).length||t){const n=t||a,s=ci.fromObject(e,{...r,zone:n,specificOffset:i});return o?s:s.setZone(a)}return ci.invalid(new dr("unparsable",`the input "${s}" can't be parsed as ${n}`))}function Bs(e,t,r=!0){return e.isValid?gn.create(Bt.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(e,t):null}function qs(e,t,r){const n=e.c.year>9999||e.c.year<0;let s="";if(n&&e.c.year>=0&&(s+="+"),s+=Ar(e.c.year,n?6:4),"year"===r)return s;if(t){if(s+="-",s+=Ar(e.c.month),"month"===r)return s;s+="-"}else if(s+=Ar(e.c.month),"month"===r)return s;return s+=Ar(e.c.day),s}function Js(e,t,r,n,s,i,o){let a=!r||0!==e.c.millisecond||0!==e.c.second,l="";switch(o){case"day":case"month":case"year":break;default:if(l+=Ar(e.c.hour),"hour"===o)break;if(t){if(l+=":",l+=Ar(e.c.minute),"minute"===o)break;a&&(l+=":",l+=Ar(e.c.second))}else{if(l+=Ar(e.c.minute),"minute"===o)break;a&&(l+=Ar(e.c.second))}if("second"===o)break;!a||n&&0===e.c.millisecond||(l+=".",l+=Ar(e.c.millisecond,3))}return s&&(e.isOffsetFixed&&0===e.offset&&!i?l+="Z":e.o<0?(l+="-",l+=Ar(Math.trunc(-e.o/60)),l+=":",l+=Ar(Math.trunc(-e.o%60))):(l+="+",l+=Ar(Math.trunc(e.o/60)),l+=":",l+=Ar(Math.trunc(e.o%60)))),i&&(l+="["+e.zone.ianaName+"]"),l}const Ys={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Ks={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Qs={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Xs=["year","month","day","hour","minute","second","millisecond"],ei=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],ti=["year","ordinal","hour","minute","second","millisecond"];function ri(e){const 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 ni(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return ri(e)}}function si(e,t){const r=Kt(t.zone,hr.defaultZone);if(!r.isValid)return ci.invalid(_s(r));const n=Bt.fromObject(t);let s,i;if(xr(e.year))s=hr.now();else{for(const r of Xs)xr(e[r])&&(e[r]=Ys[r]);const t=Or(e)||Fr(e);if(t)return ci.invalid(t);const n=function(e){if(void 0===ai&&(ai=hr.now()),"iana"!==e.type)return e.offset(ai);const t=e.name;let r=li.get(t);return void 0===r&&(r=e.offset(ai),li.set(t,r)),r}(r);[s,i]=Us(e,n,r)}return new ci({ts:s,zone:r,loc:n,o:i})}function ii(e,t,r){const n=!!xr(r.round)||r.round,s=xr(r.rounding)?"trunc":r.rounding,i=(e,i)=>{e=Vr(e,n||r.calendary?0:2,r.calendary?"round":s);return t.loc.clone(r).relFormatter(r).format(e,i)},o=n=>r.calendary?t.hasSame(e,n)?0:t.startOf(n).diff(e.startOf(n),n).get(n):t.diff(e,n).get(n);if(r.unit)return i(o(r.unit),r.unit);for(const a of r.units){const e=o(a);if(Math.abs(e)>=1)return i(e,a)}return i(e>t?-0:0,r.units[r.units.length-1])}function oi(e){let t,r={};return e.length>0&&"object"==typeof e[e.length-1]?(r=e[e.length-1],t=Array.from(e).slice(0,e.length-1)):t=Array.from(e),[r,t]}let ai;const li=/* @__PURE__ */new Map;class ci{constructor(e){const t=e.zone||hr.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new dr("invalid input"):null)||(t.isValid?null:_s(t));this.ts=xr(e.ts)?hr.now():e.ts;let n=null,s=null;if(!r){if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[n,s]=[e.old.c,e.old.o];else{const i=Cr(e.o)&&!e.old?e.o:t.offset(this.ts);n=Ws(this.ts,i),r=Number.isNaN(n.year)?new dr("invalid input"):null,n=r?null:n,s=r?null:i}}this._zone=t,this.loc=e.loc||Bt.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=n,this.o=s,this.isLuxonDateTime=!0}static now(){return new ci({})}static local(){const[e,t]=oi(arguments),[r,n,s,i,o,a,l]=t;return si({year:r,month:n,day:s,hour:i,minute:o,second:a,millisecond:l},e)}static utc(){const[e,t]=oi(arguments),[r,n,s,i,o,a,l]=t;return e.zone=Jt.utcInstance,si({year:r,month:n,day:s,hour:i,minute:o,second:a,millisecond:l},e)}static fromJSDate(e,t={}){const r=(n=e,"[object Date]"===Object.prototype.toString.call(n)?e.valueOf():NaN);var n;if(Number.isNaN(r))return ci.invalid("invalid input");const s=Kt(t.zone,hr.defaultZone);return s.isValid?new ci({ts:r,zone:s,loc:Bt.fromObject(t)}):ci.invalid(_s(s))}static fromMillis(e,t={}){if(Cr(e))return e<-Is||e>Is?ci.invalid("Timestamp out of range"):new ci({ts:e,zone:Kt(t.zone,hr.defaultZone),loc:Bt.fromObject(t)});throw new Xe(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(Cr(e))return new ci({ts:1e3*e,zone:Kt(t.zone,hr.defaultZone),loc:Bt.fromObject(t)});throw new Xe("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const r=Kt(t.zone,hr.defaultZone);if(!r.isValid)return ci.invalid(_s(r));const n=Bt.fromObject(t),s=Kr(e,ni),{minDaysInFirstWeek:i,startOfWeek:o}=kr(s,n),a=hr.now(),l=xr(t.specificOffset)?r.offset(a):t.specificOffset,c=!xr(s.ordinal),u=!xr(s.year),h=!xr(s.month)||!xr(s.day),d=u||h,f=s.weekYear||s.weekNumber;if((d||c)&&f)throw new Ke("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(h&&c)throw new Ke("Can't mix ordinal dates with month/day");const m=f||s.weekday&&!d;let p,g,y=Ws(a,l);m?(p=ei,g=Ks,y=Er(y,i,o)):c?(p=ti,g=Qs,y=br(y)):(p=Xs,g=Ys);let w=!1;for(const O of p){xr(s[O])?s[O]=w?g[O]:y[O]:w=!0}const v=m?function(e,t=4,r=1){const n=Lr(e.weekYear),s=Rr(e.weekNumber,1,Gr(e.weekYear,t,r)),i=Rr(e.weekday,1,7);return n?s?!i&&pr("weekday",e.weekday):pr("week",e.weekNumber):pr("weekYear",e.weekYear)}(s,i,o):c?function(e){const t=Lr(e.year),r=Rr(e.ordinal,1,jr(e.year));return t?!r&&pr("ordinal",e.ordinal):pr("year",e.year)}(s):Or(s),E=v||Fr(s);if(E)return ci.invalid(E);const S=m?Sr(s,i,o):c?Tr(s):s,[b,T]=Us(S,l,r),k=new ci({ts:b,zone:r,o:T,loc:n});return s.weekday&&d&&e.weekday!==k.weekday?ci.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${k.toISO()}`):k.isValid?k:ci.invalid(k.invalid)}static fromISO(e,t={}){const[r,n]=En(e,[Gn,Yn],[Bn,Kn],[qn,Qn],[Jn,Xn]);return Gs(r,n,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[r,n]=En(function(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[Hn,Vn]);return Gs(r,n,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[r,n]=En(e,[$n,Un],[jn,Un],[Wn,Zn]);return Gs(r,n,t,"HTTP",t)}static fromFormat(e,t,r={}){if(xr(e)||xr(t))throw new Xe("fromFormat requires an input string and a format");const{locale:n=null,numberingSystem:s=null}=r,i=Bt.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0}),[o,a,l,c]=function(e,t,r){const{result:n,zone:s,specificOffset:i,invalidReason:o}=zs(e,t,r);return[n,s,i,o]}(i,e,t);return c?ci.invalid(c):Gs(o,a,r,`format ${t}`,e,l)}static fromString(e,t,r={}){return ci.fromFormat(e,t,r)}static fromSQL(e,t={}){const[r,n]=En(e,[ts,Yn],[rs,ns]);return Gs(r,n,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Xe("need to specify a reason the DateTime is invalid");const r=e instanceof dr?e:new dr(e,t);if(hr.throwOnInvalid)throw new qe(r);return new ci({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const r=Rs(e,Bt.fromObject(t));return r?r.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return Ms(gn.parseFormat(e),Bt.fromObject(t)).map(e=>e.val).join("")}static resetCache(){ai=void 0,li.clear()}get(e){return this[e]}get isValid(){return null===this.invalid}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?Hs(this).weekYear:NaN}get weekNumber(){return this.isValid?Hs(this).weekNumber:NaN}get weekday(){return this.isValid?Hs(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Vs(this).weekday:NaN}get localWeekNumber(){return this.isValid?Vs(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Vs(this).weekYear:NaN}get ordinal(){return this.isValid?br(this.c).ordinal:NaN}get monthShort(){return this.isValid?vs.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?vs.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?vs.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?vs.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&&(this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,r=Ur(this.c),n=this.zone.offset(r-e),s=this.zone.offset(r+e),i=this.zone.offset(r-n*t),o=this.zone.offset(r-s*t);if(i===o)return[this];const a=r-i*t,l=r-o*t,c=Ws(a,i),u=Ws(l,o);return c.hour===u.hour&&c.minute===u.minute&&c.second===u.second&&c.millisecond===u.millisecond?[$s(this,{ts:a}),$s(this,{ts:l})]:[this]}get isInLeapYear(){return $r(this.year)}get daysInMonth(){return Wr(this.year,this.month)}get daysInYear(){return this.isValid?jr(this.year):NaN}get weeksInWeekYear(){return this.isValid?Gr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Gr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:r,calendar:n}=gn.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:n}}toUTC(e=0,t={}){return this.setZone(Jt.instance(e),t)}toLocal(){return this.setZone(hr.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if((e=Kt(e,hr.defaultZone)).equals(this.zone))return this;if(e.isValid){let n=this.ts;if(t||r){const t=e.offset(this.ts),r=this.toObject();[n]=Us(r,t,e)}return $s(this,{ts:n,zone:e})}return ci.invalid(_s(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){return $s(this,{loc:this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r})})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Kr(e,ni),{minDaysInFirstWeek:r,startOfWeek:n}=kr(t,this.loc),s=!xr(t.weekYear)||!xr(t.weekNumber)||!xr(t.weekday),i=!xr(t.ordinal),o=!xr(t.year),a=!xr(t.month)||!xr(t.day),l=o||a,c=t.weekYear||t.weekNumber;if((l||i)&&c)throw new Ke("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&i)throw new Ke("Can't mix ordinal dates with month/day");let u;s?u=Sr({...Er(this.c,r,n),...t},r,n):xr(t.ordinal)?(u={...this.toObject(),...t},xr(t.day)&&(u.day=Math.min(Wr(u.year,u.month),u.day))):u=Tr({...br(this.c),...t});const[h,d]=Us(u,this.o,this.zone);return $s(this,{ts:h,o:d})}plus(e){if(!this.isValid)return this;return $s(this,Zs(this,gs.fromDurationLike(e)))}minus(e){if(!this.isValid)return this;return $s(this,Zs(this,gs.fromDurationLike(e).negate()))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const r={},n=gs.normalizeUnit(e);switch(n){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0}if("weeks"===n)if(t){const e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(r.weekNumber=this.weekNumber-1),r.weekday=e}else r.weekday=1;if("quarters"===n){const e=Math.ceil(this.month/3);r.month=3*(e-1)+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?gn.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):As}toLocaleString(e=st,t={}){return this.isValid?gn.create(this.loc.clone(t),e).formatDateTime(this):As}toLocaleParts(e={}){return this.isValid?gn.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:n=!0,extendedZone:s=!1,precision:i="milliseconds"}={}){if(!this.isValid)return null;const o="extended"===e;let a=qs(this,o,i=ri(i));return Xs.indexOf(i)>=3&&(a+="T"),a+=Js(this,o,t,r,n,s,i),a}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?qs(this,"extended"===e,ri(t)):null}toISOWeekDate(){return Bs(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:n=!1,extendedZone:s=!1,format:i="extended",precision:o="milliseconds"}={}){if(!this.isValid)return null;return o=ri(o),(n&&Xs.indexOf(o)>=3?"T":"")+Js(this,"extended"===i,t,e,r,s,o)}toRFC2822(){return Bs(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Bs(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?qs(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let n="HH:mm:ss.SSS";return(t||e)&&(r&&(n+=" "),t?n+="z":e&&(n+="ZZ")),Bs(this,n,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():As}[/* @__PURE__ */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{};const 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",r={}){if(!this.isValid||!e.isValid)return gs.invalid("created by diffing an invalid DateTime");const n={locale:this.locale,numberingSystem:this.numberingSystem,...r},s=(a=t,Array.isArray(a)?a:[a]).map(gs.normalizeUnit),i=e.valueOf()>this.valueOf(),o=Ss(i?this:e,i?e:this,s,n);var a;return i?o.negate():o}diffNow(e="milliseconds",t={}){return this.diff(ci.now(),e,t)}until(e){return this.isValid?ws.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;const n=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t,r)<=n&&n<=s.endOf(t,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||ci.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0;let n=["years","months","days","hours","minutes","seconds"],s=e.unit;return Array.isArray(e.unit)&&(n=e.unit,s=void 0),ii(t,this.plus(r),{...e,numeric:"always",units:n,unit:s})}toRelativeCalendar(e={}){return this.isValid?ii(e.base||ci.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(ci.isDateTime))throw new Xe("min requires all arguments be DateTimes");return Mr(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(ci.isDateTime))throw new Xe("max requires all arguments be DateTimes");return Mr(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,r={}){const{locale:n=null,numberingSystem:s=null}=r;return zs(Bt.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,r={}){return ci.fromFormatExplain(e,t,r)}static buildFormatParser(e,t={}){const{locale:r=null,numberingSystem:n=null}=t,s=Bt.fromOpts({locale:r,numberingSystem:n,defaultToEN:!0});return new Ps(s,e)}static fromFormatParser(e,t,r={}){if(xr(e)||xr(t))throw new Xe("fromFormatParser requires an input string and a format parser");const{locale:n=null,numberingSystem:s=null}=r,i=Bt.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0});if(!i.equals(t.locale))throw new Xe(`fromFormatParser called with a locale of ${i}, but the format parser was created for ${t.locale}`);const{result:o,zone:a,specificOffset:l,invalidReason:c}=t.explainFromTokens(e);return c?ci.invalid(c):Gs(o,a,r,`format ${t.format}`,e,l)}static get DATE_SHORT(){return st}static get DATE_MED(){return it}static get DATE_MED_WITH_WEEKDAY(){return ot}static get DATE_FULL(){return at}static get DATE_HUGE(){return lt}static get TIME_SIMPLE(){return ct}static get TIME_WITH_SECONDS(){return ut}static get TIME_WITH_SHORT_OFFSET(){return ht}static get TIME_WITH_LONG_OFFSET(){return dt}static get TIME_24_SIMPLE(){return ft}static get TIME_24_WITH_SECONDS(){return mt}static get TIME_24_WITH_SHORT_OFFSET(){return pt}static get TIME_24_WITH_LONG_OFFSET(){return gt}static get DATETIME_SHORT(){return yt}static get DATETIME_SHORT_WITH_SECONDS(){return wt}static get DATETIME_MED(){return vt}static get DATETIME_MED_WITH_SECONDS(){return Et}static get DATETIME_MED_WITH_WEEKDAY(){return St}static get DATETIME_FULL(){return bt}static get DATETIME_FULL_WITH_SECONDS(){return Tt}static get DATETIME_HUGE(){return kt}static get DATETIME_HUGE_WITH_SECONDS(){return Ot}}function ui(e){if(ci.isDateTime(e))return e;if(e&&e.valueOf&&Cr(e.valueOf()))return ci.fromJSDate(e);if(e&&"object"==typeof e)return ci.fromObject(e);throw new Xe(`Unknown datetime argument: ${e}, of type ${typeof e}`)}const hi=class e{constructor(){}static constructFromServiceResolver(){return new e}onEvent(t){if(t.getIdentifier()!==e.eventListenerTarget)return;const r=t.getNormalizedValue();if(!(r instanceof Date))return;const n=ci.fromJSDate(r).toFormat("yyyy-MM-dd'T'HH:mm:ssZZ");t.setRawValue(n),t.stopPropagation()}};hi.eventListenerTarget=t.NormalizedValueToRawValueEvent,hi.priority=50;let di=hi;const fi=class e{constructor(){}static constructFromServiceResolver(){return new e}onEvent(t){if(t.getIdentifier()!==e.eventListenerTarget)return;const r=t.getRawValue();if("string"!=typeof r)return;if(!e.dateRegex.test(r))return;const n=new Date(r);t.setNormalizedValue(n),t.stopPropagation()}};fi.eventListenerTarget=t.RawValueToNormalizedValueEvent,fi.priority=50,fi.dateRegex=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\+\d{2}:\d{2}$/;let mi=fi;const pi=class e{constructor(){}static constructFromServiceResolver(){return new e}onEvent(t){if(t.getIdentifier()!==e.eventListenerTarget)return;const r=t.getNormalizedValue();(Array.isArray(r)||"number"==typeof r||"boolean"==typeof r||"string"==typeof r||r instanceof String||null===r)&&(t.setRawValue(r),t.stopPropagation())}};pi.eventListenerTarget=t.NormalizedValueToRawValueEvent,pi.priority=0;let gi=pi;const yi=class e{constructor(){}static constructFromServiceResolver(){return new e}onEvent(t){if(t.getIdentifier()!==e.eventListenerTarget)return;const r=t.getRawValue();(Array.isArray(r)||"number"==typeof r||"boolean"==typeof r||"string"==typeof r||null===r)&&(t.setNormalizedValue(r),t.stopPropagation())}};yi.eventListenerTarget=t.RawValueToNormalizedValueEvent,yi.priority=0;let wi=yi;const vi=class e{constructor(e){this.logger=e,this.token=null,this.apiHost="",this.elementCacheMaxEntries=100,this.collectionCacheMaxEntries=50,this.collectionPageSize=25}static constructFromServiceResolver(t){const r=t.getServiceOrFail(i.logger);return new e(r)}hasToken(){return null!==this.token}getToken(){return this.token}setToken(e){return this.token=e,this}getApiHost(){return this.apiHost}setApiHost(e){return e.endsWith("/")&&(this.logger.warn("Removed trailing slash from API host configuration due to internal requirement. Please check if trailing slash can be directly removed."),e=e.replace(/\/+$/,"")),this.apiHost=e,this}getElementCacheMaxEntries(){return this.elementCacheMaxEntries}setElementCacheMaxEntries(e){return this.elementCacheMaxEntries=e,this}getCollectionCacheMaxEntries(){return this.collectionCacheMaxEntries}setCollectionCacheMaxEntries(e){return this.collectionCacheMaxEntries=e,this}getCollectionPageSize(){return this.collectionPageSize}setCollectionPageSize(e){return this.collectionPageSize=e,this}};vi.identifier=i.serviceApiConfiguration;let Ei=vi;const Si=class e{constructor(e,t,r,n,s,i,o,a,l,c,u,h,d,f,m,p,g,y,w,v,E){this.getElementEndpoint=e,this.getElementChildrenEndpoint=t,this.getElementParentsEndpoint=r,this.getElementRelatedEndpoint=n,this.getIndexEndpoint=s,this.postIndexEndpoint=i,this.postElementEndpoint=o,this.putElementEndpoint=a,this.patchElementEndpoint=l,this.deleteElementEndpoint=c,this.postRegisterEndpoint=u,this.postChangePasswordEndpoint=h,this.getMeEndpoint=d,this.postTokenEndpoint=f,this.getTokenEndpoint=m,this.deleteTokenEndpoint=p,this.elementCache=g,this.elementChildrenCache=y,this.elementParentsCache=w,this.elementRelatedCache=v,this.indexCache=E}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.endpointElementGetElementEndpoint),t.getServiceOrFail(i.endpointElementGetElementChildrenEndpoint),t.getServiceOrFail(i.endpointElementGetElementParentsEndpoint),t.getServiceOrFail(i.endpointElementGetElementRelatedEndpoint),t.getServiceOrFail(i.endpointElementGetIndexEndpoint),t.getServiceOrFail(i.endpointElementPostIndexEndpoint),t.getServiceOrFail(i.endpointElementPostElementEndpoint),t.getServiceOrFail(i.endpointElementPutElementEndpoint),t.getServiceOrFail(i.endpointElementPatchElementEndpoint),t.getServiceOrFail(i.endpointElementDeleteElementEndpoint),t.getServiceOrFail(i.endpointUserPostRegisterEndpoint),t.getServiceOrFail(i.endpointUserPostChangePasswordEndpoint),t.getServiceOrFail(i.endpointUserGetMeEndpoint),t.getServiceOrFail(i.endpointUserPostTokenEndpoint),t.getServiceOrFail(i.endpointUserGetTokenEndpoint),t.getServiceOrFail(i.endpointUserDeleteTokenEndpoint),t.getServiceOrFail(i.cacheElement),t.getServiceOrFail(i.cacheElementChildren),t.getServiceOrFail(i.cacheElementParents),t.getServiceOrFail(i.cacheElementRelated),t.getServiceOrFail(i.cacheIndex))}async getElement(e,{forceLoad:t=!1}={}){const r=I.createCacheKey(e),n=this.elementCache.get(r);if(n&&!t)return n.data;if(n){const t=await this.getElementEndpoint.getElement(e,n.etag);return"data"in t?(this.elementCache.setFromParsedResponse(r,t),t.data):(this.elementCache.refresh(r),n.data)}const s=await this.getElementEndpoint.getElement(e);return this.elementCache.setFromParsedResponse(r,s),s.data}async getElementChildren(e,{page:t=1,pageSize:r=25,forceLoad:n=!1}={}){const s=H.createCacheKey(e,t,r),i=this.elementChildrenCache.get(s);if(i&&!n)return i.data;if(i){const n=await this.getElementChildrenEndpoint.getElementChildren(e,t,r,i.etag);return"data"in n?(this.elementChildrenCache.setFromParsedResponse(s,n),this.elementCache.setFromCollection(n.data),n.data):(this.elementChildrenCache.refresh(s),i.data)}const o=await this.getElementChildrenEndpoint.getElementChildren(e,t,r);return this.elementChildrenCache.setFromParsedResponse(s,o),this.elementCache.setFromCollection(o.data),o.data}async getElementParents(e,{page:t=1,pageSize:r=25,forceLoad:n=!1}={}){const s=$.createCacheKey(e,t,r),i=this.elementParentsCache.get(s);if(i&&!n)return i.data;if(i){const n=await this.getElementParentsEndpoint.getElementParents(e,t,r,i.etag);return"data"in n?(this.elementParentsCache.setFromParsedResponse(s,n),this.elementCache.setFromCollection(n.data),n.data):(this.elementParentsCache.refresh(s),i.data)}const o=await this.getElementParentsEndpoint.getElementParents(e,t,r);return this.elementParentsCache.setFromParsedResponse(s,o),this.elementCache.setFromCollection(o.data),o.data}async getElementRelated(e,{page:t=1,pageSize:r=25,forceLoad:n=!1}={}){const s=W.createCacheKey(e,t,r),i=this.elementRelatedCache.get(s);if(i&&!n)return i.data;if(i){const n=await this.getElementRelatedEndpoint.getElementRelated(e,t,r,i.etag);return"data"in n?(this.elementRelatedCache.setFromParsedResponse(s,n),this.elementCache.setFromCollection(n.data),n.data):(this.elementRelatedCache.refresh(s),i.data)}const o=await this.getElementRelatedEndpoint.getElementRelated(e,t,r);return this.elementRelatedCache.setFromParsedResponse(s,o),this.elementCache.setFromCollection(o.data),o.data}async getIndex({page:e=1,pageSize:t=25,forceLoad:r=!1}={}){const n=Z.createCacheKey(e,t),s=this.indexCache.get(n);if(s&&!r)return s.data;if(s){const r=await this.getIndexEndpoint.getIndex(e,t,s.etag);return"data"in r?(this.indexCache.setFromParsedResponse(n,r),this.elementCache.setFromCollection(r.data),r.data):(this.indexCache.refresh(n),s.data)}const i=await this.getIndexEndpoint.getIndex(e,t);return this.indexCache.setFromParsedResponse(n,i),this.elementCache.setFromCollection(i.data),i.data}async postIndex(e){return(await this.postIndexEndpoint.postIndex(e)).data}async postElement(e,t){return(await this.postElementEndpoint.postElement(e,t)).data}async putElement(e,t){await this.putElementEndpoint.putElement(e,t),this.elementCache.delete(I.createCacheKey(e))}async patchElement(e,t){await this.patchElementEndpoint.patchElement(e,t),this.elementCache.delete(I.createCacheKey(e))}async deleteElement(e){await this.deleteElementEndpoint.deleteElement(e),this.elementCache.delete(I.createCacheKey(e))}async postRegister(e,t,r={}){return(await this.postRegisterEndpoint.postRegister(e,t,r)).data}async postChangePassword(e,t,r){await this.postChangePasswordEndpoint.postChangePassword(e,t,r)}async getMe(){const e=(await this.getMeEndpoint.getMe()).data;return this.elementCache.setFromDataEtag(I.createCacheKey(e.id),e),e}async postToken(e,t,r={}){return(await this.postTokenEndpoint.postToken(e,t,r)).data}async getToken(){const e=(await this.getTokenEndpoint.getToken()).data;return this.elementCache.setFromDataEtag(I.createCacheKey(e.id),e),e}async deleteToken(){await this.deleteTokenEndpoint.deleteToken()}};Si.identifier=i.serviceApiWrapper;let bi=Si;const Ti=class e{constructor(e){this.elementParser=e}static constructFromServiceResolver(t){const r=t.getServiceOrFail(i.serviceElementParser);return new e(r)}async deserializeCollection(e){if(!("id"in e))throw new Error("Raw collection must contain property 'id' in order to be parsed to a collection.");const t=String(e.id);if(!("totalNodes"in e))throw new Error("Raw collection must contain property 'totalNodes' in order to be parsed to a collection.");const r=Number(e.totalNodes);if(!("links"in e))throw new Error("Raw collection must contain property 'links' in order to be parsed to a collection.");if("object"!=typeof e.links||null===e.links)throw new Error("Links property in raw collection must be of type object.");const n=e.links;if(!("first"in n))throw new Error("Raw collection must contain property 'links.first' in order to be parsed to a collection.");const s=String(n.first);if(!("previous"in n))throw new Error("Raw collection must contain property 'links.previous' in order to be parsed to a collection.");const i=null===n.previous?null:String(n.previous);if(!("next"in n))throw new Error("Raw collection must contain property 'links.next' in order to be parsed to a collection.");const o=null===n.next?null:String(n.next);if(!("last"in n))throw new Error("Raw collection must contain property 'links.last' in order to be parsed to a collection.");const a=String(n.last);if(!("nodes"in e))throw new Error("Raw collection must contain property 'nodes' in order to be parsed to a collection.");if(!Array.isArray(e.nodes))throw new Error("Nodes property in raw collection must be of type array.");const l=[];for(const u of e.nodes)l.push(await this.elementParser.deserializeElement(u));if(!("relations"in e))throw new Error("Raw collection must contain property 'relations' in order to be parsed to a collection.");if(!Array.isArray(e.relations))throw new Error("Relations property in raw collection must be of type array.");const c=[];for(const u of e.relations)c.push(await this.elementParser.deserializeElement(u));return{id:t,totalNodes:r,links:{first:s,previous:i,next:o,last:a},nodes:l,relations:c}}};Ti.identifier=i.serviceCollectionParser;let ki=Ti;const Oi=class e{constructor(e){this.eventDispatcher=e}static constructFromServiceResolver(t){const r=t.getServiceOrFail(i.serviceEventDispatcher);return new e(r)}async deserializeElement(e){if(!("id"in e))throw new Error("Raw element must contain property 'id' in order to be parsed to a node or relation.");const t=Ve(String(e.id));if(!("type"in e))throw new Error("Raw element must contain property 'type' in order to be parsed to a node or relation.");const r=String(e.type);if(!("data"in e))throw new Error("Raw element must contain property 'data' in order to be parsed to a node or relation.");const n=e.data;for(const s in n){const e=new Ze(n[s]);if(await this.eventDispatcher.dispatchEvent(e),!e.isPropagationStopped())throw new Error(`Unable to deserialize property "${s}".`);n[s]=e.getNormalizedValue()}if("start"in e&&"end"in e){return{id:t,start:Ve(String(e.start)),end:Ve(String(e.end)),type:r,data:n}}return{id:t,type:r,data:n}}};Oi.identifier=i.serviceElementParser;let Fi=Oi;const xi=class e{constructor(e){this.logger=e,this.isSilent=!0,this.eventListenerTargets=/* @__PURE__ */new Map}static constructFromServiceResolver(t){const r=t.getServiceOrFail(i.logger);return new e(r)}setSilent(e){return this.isSilent=e,this}async dispatchEvent(e){if(this.isSilent||this.logger.debug(`Dispatching event of identifier ${e.getIdentifier()}.`,{event:e}),e.isPropagationStopped())return void(this.isSilent||this.logger.debug("Stopped event propagation because it is already stopped.",{event:e}));const t=Me(e.getIdentifier());for(let n=0;n<t.length;++n){const s=t[n],i=this.eventListenerTargets.get(s);if(void 0!==i){this.isSilent||this.logger.debug(`Iterating over resolved event listeners of identifier ${s}`,{event:e});for(let t=i.length-1;t>=0;t--){try{await Promise.resolve(i[t].eventListener.onEvent(e))}catch(r){this.logger.error("Event handler threw exception, dispatcher continues with next event listener.",{event:e,error:r})}if(e.isPropagationStopped())return void(this.isSilent||this.logger.debug("Stopped event propagation as it got stopped.",{event:e}))}}}this.isSilent||this.logger.debug("Event got handled by all event listeners.",{event:e})}addListener(e,t,r){let n;void 0===r&&(r=0),n=this.eventListenerTargets.has(e)?this.eventListenerTargets.get(e):[];let s=0,i=n.length-1,o=-1;for(;s<=i;){const e=Math.floor((s+i)/2);n[e].priority>=r?(o=e,i=e-1):s=e+1}const a=-1===o?s:o;return n.splice(a,0,{priority:r,eventListener:t}),this.eventListenerTargets.set(e,n),this}removeListener(e,t){const r=this.eventListenerTargets.get(e);if(!r)return this;for(let n=0;n<r.length;++n)if(r[n].eventListener===t){r.splice(n,1);break}return 0===r.length&&this.eventListenerTargets.delete(e),this}getListeners(e){const t=this.eventListenerTargets.get(e);return t?t.map(e=>e.eventListener):[]}hasListeners(e){return this.eventListenerTargets.has(e)}};xi.identifier=i.serviceEventDispatcher;let Ci=xi;const Li=class e{constructor(e,t){this.logger=e,this.apiConfiguration=t}static constructFromServiceResolver(t){const r=t.getServiceOrFail(i.logger),n=t.getServiceOrFail(i.serviceApiConfiguration);return new e(r,n)}rethrowErrorAsNetworkError(e){if(e instanceof f)throw e;throw new p("Network error occurred during fetch.",e)}logAndThrowError(e){const t=e instanceof Error?e:new Error(String(e));throw this.logger.error(t.message,t),t}async parseJsonResponse(e){const t=e.headers.get("Content-Type");if(!t)return Promise.reject(new g("Response does not contain a Content-Type header."));if(!t.includes("application/json")&&!t.includes("application/problem+json"))return Promise.reject(new g(`Unexpected Content-Type: "${t}". Expected JSON-compatible format.`));const r=await e.json().catch(e=>{throw new g(`Failed to parse response body as JSON: ${e}`)});if(!e.ok)throw this.createResponseErrorFromBadResponse(e,r);return r}async parseEmptyResponse(e){if(e.ok&&204===e.status)return;const t=e.headers.get("Content-Type");if(null===t)throw new g("Response does not contain content type header.");if(!t.includes("application/problem+json"))throw new g("Unable to parse response as content type is not 'application/problem+json'.");const r=await e.json().catch(e=>{throw new g(`Failed to parse response body as JSON: ${e}`)});throw this.createResponseErrorFromBadResponse(e,r)}parseLocationResponse(e){if(e.ok&&(201===e.status||204===e.status)&&e.headers.has("Location")){const t=e.headers.get("Location").split("/").at(-1);return Promise.resolve(Ve(t))}const t=e.headers.get("Content-Type");return null===t?Promise.reject(new g("Response does not contain content type header.")):t.includes("application/problem+json")?e.json().catch(e=>{throw new g(`Failed to parse response body as JSON: ${e}`)}).then(t=>{throw this.createResponseErrorFromBadResponse(e,t)}):Promise.reject(new g("Unable to parse response as content type is not 'application/problem+json'."))}createResponseErrorFromBadResponse(e,t){let r=null;return 401===e.status&&(r=new w("Server returned 401 unauthorized.")),403===e.status&&(r=new v("Server returned 403 forbidden.")),404===e.status&&(r=new E("Server returned 404 not found.")),429===e.status&&(r=new S("Server returned 429 too many requests.")),null===r&&(r=new y("Generic response error.")),"type"in t&&r.setType(String(t.type)),"title"in t&&r.setTitle(String(t.title)),"detail"in t&&r.setDetail(String(t.detail)),"status"in t&&null===r.getStatus()&&r.setStatus(Number(t.status)),r}addAuthorizationHeader(e){this.apiConfiguration.hasToken()&&(e.Authorization=`Bearer ${this.apiConfiguration.getToken()}`)}addAcceptJsonAndProblemJsonHeader(e){e.Accept="application/json, application/problem+json"}addIfNoneMatchHeader(e,t){e["If-None-Match"]=t}addContentTypeJsonHeader(e){e["Content-Type"]="application/json"}getDefaultGetOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),void 0!==e&&this.addIfNoneMatchHeader(t,e),{method:r.GET,headers:t,redirect:"follow",referrerPolicy:"no-referrer",cache:"no-store"}}getDefaultDeleteOptions(){const e={};return this.addAuthorizationHeader(e),this.addAcceptJsonAndProblemJsonHeader(e),{method:r.DELETE,headers:e,redirect:"follow",referrerPolicy:"no-referrer"}}getDefaultPostOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),this.addContentTypeJsonHeader(t),{method:r.POST,headers:t,redirect:"follow",referrerPolicy:"no-referrer",body:e}}getDefaultPatchOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),this.addContentTypeJsonHeader(t),{method:r.PATCH,headers:t,redirect:"follow",referrerPolicy:"no-referrer",body:e}}getDefaultPutOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),this.addContentTypeJsonHeader(t),{method:r.PUT,headers:t,redirect:"follow",referrerPolicy:"no-referrer",body:e}}buildUrl(e){return`${this.apiConfiguration.getApiHost()}${e}`}runWrappedFetch(e,t){return e=`${this.apiConfiguration.getApiHost()}${e}`,this.logger.debug(`Executing HTTP ${t?.method??"-"} request against url ${e} .`),fetch(e,t)}};Li.identifier=i.serviceFetchHelper;let Ni=Li;class Di{constructor(){this.services=/* @__PURE__ */new Map}hasService(e){return this.services.has(String(e))}getService(e){return this.hasService(String(e))?this.services.get(String(e)):null}getServiceOrFail(e){if(!this.hasService(String(e)))throw new Error(`Requested service with identifier ${String(e)} could not be resolved.`);return this.services.get(String(e))}setService(e,t){return this.services.set(String(e),t),this}deleteService(e){return this.services.delete(String(e)),this}getServiceIdentifiers(){return[...this.services.keys()]}getServices(){return[...this.services.values()]}clearServices(){return this.services.clear(),this}}const Mi=class e{constructor(){}static constructFromServiceResolver(){return new e}rawTokenToToken(e){if(!("type"in e))throw new Error("Raw token must contain property 'type' in order to be parsed to a token.");if("_TokenResponse"!==String(e.type))throw new Error("Type must be '_TokenResponse' in order to be parsed to a token.");if(!("token"in e))throw new Error("Raw token must contain property 'token' in order to be parsed to a token.");return _e(String(e.token))}};Mi.identifier=i.serviceTokenParser;let Pi=Mi;const zi=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,ApiConfiguration:Ei,ApiWrapper:bi,CollectionParser:ki,ElementParser:Fi,EventDispatcher:Ci,FetchHelper:Ni,Logger:class{constructor(e){this.logger=e}debug(...e){return this.logger.debug(e)}error(...e){return this.logger.error(e)}info(...e){return this.logger.info(e)}warn(...e){return this.logger.warn(e)}},ServiceResolver:Di,TokenParser:Pi},Symbol.toStringTag,{value:"Module"}));function Ri(e){const t=e.getServiceOrFail(Ci.identifier),r=[di,mi,gi,wi];for(let n=0;n<r.length;n++)t.addListener(r[n].eventListenerTarget,r[n].constructFromServiceResolver(),r[n].priority)}const Ai=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,DateTimeNormalizedValueToRawValueEventListener:di,DateTimeRawValueToNormalizedValueEventListener:mi,GenericNormalizedValueToRawValueEventListener:gi,GenericRawValueToNormalizedValueEventListener:wi,initEventListener:Ri},Symbol.toStringTag,{value:"Module"}));const Ii={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]};function _i(e,t,r,n=!1){const s=String(t),i=(e,t)=>`[${t[0]}m${e}[${t[1]}m`,o=(e,t)=>null!=t&&"string"==typeof t?i(e,Ii[t]):null!=t&&Array.isArray(t)?t.reduce((e,t)=>o(e,t),e):null!=t&&null!=t[e.trim()]?o(e,t[e.trim()]):null!=t&&null!=t["*"]?o(e,t["*"]):e;return s.replace(/{{(.+?)}}/g,(t,s)=>{const a=null!=r[s]?String(r[s]):n?"":t;return e.stylePrettyLogs?o(a,e?.prettyLogStyles?.[s]??null)+i("",Ii.reset):a})}function Hi(e,t=2,r=0){return null!=e&&isNaN(e)?"":(e=null!=e?e+r:e,2===t?null==e?"--":e<10?"0"+e:e.toString():null==e?"---":e<10?"00"+e:e<100?"0"+e:e.toString())}function Vi(e,t){if(null==t)return{text:"",template:e.prettyLogTemplate,placeholders:{}};let r=e.prettyLogTemplate;const n={};r.includes("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}")?r=r.replace("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}","{{dateIsoStr}}"):"UTC"===e.prettyLogTimeZone?(n.yyyy=t.date?.getUTCFullYear()??"----",n.mm=Hi(t.date?.getUTCMonth(),2,1),n.dd=Hi(t.date?.getUTCDate(),2),n.hh=Hi(t.date?.getUTCHours(),2),n.MM=Hi(t.date?.getUTCMinutes(),2),n.ss=Hi(t.date?.getUTCSeconds(),2),n.ms=Hi(t.date?.getUTCMilliseconds(),3)):(n.yyyy=t.date?.getFullYear()??"----",n.mm=Hi(t.date?.getMonth(),2,1),n.dd=Hi(t.date?.getDate(),2),n.hh=Hi(t.date?.getHours(),2),n.MM=Hi(t.date?.getMinutes(),2),n.ss=Hi(t.date?.getSeconds(),2),n.ms=Hi(t.date?.getMilliseconds(),3));const s="UTC"===e.prettyLogTimeZone?t.date:null!=t.date?new Date(t.date.getTime()-6e4*t.date.getTimezoneOffset()):void 0;n.rawIsoStr=s?.toISOString()??"",n.dateIsoStr=s?.toISOString().replace("T"," ").replace("Z","")??"",n.logLevelName=t.logLevelName,n.fileNameWithLine=t.path?.fileNameWithLine??"",n.filePathWithLine=t.path?.filePathWithLine??"",n.fullFilePath=t.path?.fullFilePath??"";let i=e.parentNames?.join(e.prettyErrorParentNamesSeparator);i=null!=i&&null!=t.name?i+e.prettyErrorParentNamesSeparator:void 0;const o=null!=t.name||null!=i?`${i??""}${t.name??""}`:"";return n.name=o,n.nameWithDelimiterPrefix=o.length>0?e.prettyErrorLoggerNameDelimiter+o:"",n.nameWithDelimiterSuffix=o.length>0?o+e.prettyErrorLoggerNameDelimiter:"",null!=e.overwrite?.addPlaceholders&&e.overwrite.addPlaceholders(t,n),{text:_i(e,r,n),template:r,placeholders:n}}const $i=[/(?:^|[\\/])node_modules[\\/].*tslog/i,/(?:^|[\\/])deps[\\/].*tslog/i,/tslog[\\/]+src[\\/]+internal[\\/]/i,/tslog[\\/]+src[\\/]BaseLogger/i,/tslog[\\/]+src[\\/]index/i];function ji(e,t){return function(e,t){const r=[];for(const n of e){const e=t(n);null!=e&&r.push(e)}return r}(function(e){return t=function(e){const t="string"==typeof e?.stack?e.stack:void 0;return null==t||0===t.length?[]:t.split("\n").map(e=>e.trimEnd())}(e),t.filter(e=>e.length>0&&!/^\s*Error\b/.test(e));var t}(e),t)}function Wi(e,t){return e<0?0:e>=t?Math.max(0,t-1):e}function Ui(){return[...$i]}function Zi(e){if(e instanceof Error)return e;const t=new Error("string"==typeof e?e:JSON.stringify(e));return"object"==typeof e&&null!=e&&Object.assign(t,e),t}function Gi(e){const t=/* @__PURE__ */new Set;return JSON.stringify(e,(e,r)=>{if("object"==typeof r&&null!==r){if(t.has(r))return"[Circular]";t.add(r)}return"bigint"==typeof r?`${r}`:void 0===r?"[undefined]":r})}function Bi(e,t){const r={seen:[],stylize:Ji};return null!=t&&uo(r,t),qi(r.showHidden)&&(r.showHidden=!1),qi(r.depth)&&(r.depth=2),qi(r.colors)&&(r.colors=!0),qi(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=Yi),ao(r,e,r.depth)}function qi(e){return void 0===e}function Ji(e){return e}function Yi(e,t){const r=Bi.styles[t];return null!=r&&null!=Bi?.colors?.[r]?.[0]&&null!=Bi?.colors?.[r]?.[1]?"["+Bi.colors[r][0]+"m"+e+"["+Bi.colors[r][1]+"m":e}function Ki(e){return"function"==typeof e}function Qi(e){return"string"==typeof e}function Xi(e){return null===e}function eo(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function to(e){return ro(e)&&"[object RegExp]"===io(e)}function ro(e){return"object"==typeof e&&null!==e}function no(e){return ro(e)&&("[object Error]"===io(e)||e instanceof Error)}function so(e){return ro(e)&&"[object Date]"===io(e)}function io(e){return Object.prototype.toString.call(e)}function oo(e){return"["+Error.prototype.toString.call(e)+"]"}function ao(e,t,r=0){if(e.customInspect&&null!=t&&Ki(t)&&t?.inspect!==Bi&&(!t?.constructor||t?.constructor.prototype!==t)){if("function"!=typeof t.inspect&&null!=t.toString)return t.toString();let n=t?.inspect(r,e);return Qi(n)||(n=ao(e,n,r)),n}const n=co(e,t);if(n)return n;let s=Object.keys(t);const i=function(e){const t={};return e.forEach(e=>{t[e]=!0}),t}(s);try{e.showHidden&&Object.getOwnPropertyNames&&(s=Object.getOwnPropertyNames(t))}catch{}if(no(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return oo(t);if(0===s.length){if(!Ki(e.stylize))return t;if(Ki(t)){const r=t.name?": "+t.name:"";return e.stylize("[Function"+r+"]","special")}if(to(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(so(t))return e.stylize(Date.prototype.toISOString.call(t),"date");if(no(t))return oo(t)}let o,a="",l=!1,c=["{\n","\n}"];if(Array.isArray(t)&&(l=!0,c=["[\n","\n]"]),Ki(t)){a=" [Function"+(t.name?": "+t.name:"")+"]"}return to(t)&&(a=" "+RegExp.prototype.toString.call(t)),so(t)&&(a=" "+Date.prototype.toUTCString.call(t)),no(t)&&(a=" "+oo(t)),0!==s.length||l&&0!=t.length?r<0?to(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),o=l?function(e,t,r,n,s){const i=[];for(let o=0,a=t.length;o<a;++o)eo(t,String(o))?i.push(lo(e,t,r,n,String(o),!0)):i.push("");return s.forEach(s=>{s.match(/^\d+$/)||i.push(lo(e,t,r,n,s,!0))}),i}(e,t,r,i,s):s.map(n=>lo(e,t,r,i,n,l)),e.seen.pop(),function(e,t,r){return r[0]+(""===t?"":t+"\n")+" "+e.join(",\n ")+" "+r[1]}(o,a,c)):c[0]+a+c[1]}function lo(e,t,r,n,s,i){let o,a,l={value:void 0};try{l.value=t[s]}catch{}try{Object.getOwnPropertyDescriptor&&(l=Object.getOwnPropertyDescriptor(t,s)||l)}catch{}if(l.get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),eo(n,s)||(o="["+s+"]"),a||(e.seen.indexOf(l.value)<0?(a=Xi(r)?ao(e,l.value,void 0):ao(e,l.value,r-1),a.indexOf("\n")>-1&&(a=i?a.split("\n").map(e=>" "+e).join("\n").substr(2):"\n"+a.split("\n").map(e=>" "+e).join("\n"))):a=e.stylize("[Circular]","special")),qi(o)){if(i&&s.match(/^\d+$/))return a;o=JSON.stringify(""+s),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,"\\'").replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function co(e,t){if(qi(t))return e.stylize("undefined","undefined");if(Qi(t)){const r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,"\\'")+"'";return e.stylize(r,"string")}return"number"==typeof t?e.stylize(""+t,"number"):function(e){return"boolean"==typeof e}(t)?e.stylize(""+t,"boolean"):Xi(t)?e.stylize("null","null"):void 0}function uo(e,t){const r={...e};if(!t||!ro(t))return e;const n={...t},s=Object.keys(t);let i=s.length;for(;i--;)r[s[i]]=n[s[i]];return r}function ho(){return"undefined"!=typeof window&&"undefined"!=typeof document}Bi.colors=Ii,Bi.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};const fo=/\u001b\[[0-9;]*m/g,mo={black:"#000000",red:"#ef5350",green:"#66bb6a",yellow:"#fdd835",blue:"#42a5f5",magenta:"#ab47bc",cyan:"#26c6da",white:"#fafafa",blackBright:"#424242",redBright:"#ff7043",greenBright:"#81c784",yellowBright:"#ffe082",blueBright:"#64b5f6",magentaBright:"#ce93d8",cyanBright:"#4dd0e1",whiteBright:"#ffffff"},po={bgBlack:"#000000",bgRed:"#ef5350",bgGreen:"#66bb6a",bgYellow:"#fdd835",bgBlue:"#42a5f5",bgMagenta:"#ab47bc",bgCyan:"#26c6da",bgWhite:"#fafafa",bgBlackBright:"#424242",bgRedBright:"#ff7043",bgGreenBright:"#81c784",bgYellowBright:"#ffe082",bgBlueBright:"#64b5f6",bgMagentaBright:"#ce93d8",bgCyanBright:"#4dd0e1",bgWhiteBright:"#ffffff"},go=/(?:(?:file|https?|global code|[^@]+)@)?(?:file:)?((?:\/[^:/]+){2,})(?::(\d+))?(?::(\d+))?/,yo=function(){const e=function(){if(ho()){const e=globalThis.navigator;return{name:"browser",userAgent:e?.userAgent}}const e=globalThis;if("function"==typeof e.importScripts)return{name:"worker",userAgent:e.navigator?.userAgent};const t=globalThis;if(null!=t.Bun){const e=t.Bun.version;return{name:"bun",version:null!=e?`bun/${e}`:void 0,hostname:m(t.process,t.Deno,t.Bun,t.location)}}if(null!=t.Deno){const e=function(e){try{if("function"==typeof e?.hostname){const t=e.hostname();if(null!=t&&t.length>0)return t}}catch{}const t=globalThis.location?.hostname;if(null!=t&&t.length>0)return t;return}(t.Deno),r=t.Deno?.version?.deno;return{name:"deno",version:null!=r?`deno/${r}`:void 0,hostname:e??m(t.process,t.Deno,t.Bun,t.location)}}if(null!=t.process?.versions?.node||null!=t.process?.version)return{name:"node",version:t.process?.versions?.node??t.process?.version,hostname:m(t.process,t.Deno,t.Bun,t.location)};if(null!=t.process)return{name:"node",version:"unknown",hostname:m(t.process,t.Deno,t.Bun,t.location)};return{name:"unknown"}}(),t=function(t){if("browser"===t.name||"worker"===t.name)return{runtime:t.name,browser:t.userAgent};const r={runtime:t.name};"node"!==e.name&&"deno"!==e.name&&"bun"!==e.name||(r.runtimeVersion=t.version??"unknown");"node"!==e.name&&"deno"!==e.name&&"bun"!==e.name||(r.hostname=t.hostname??"unknown");return r}(e),r="browser"===e.name||"worker"===e.name,n=r?[...Ui(),/node_modules[\\/].*tslog/i]:[...Ui(),/node:(?:internal|vm)/i,/\binternal[\\/]/i];let s;const i={getMeta:(e,r,n,s,o,a)=>Object.assign({},t,{name:o,parentNames:a,date:/* @__PURE__ */new Date,logLevelId:e,logLevelName:r,path:s?void 0:i.getCallerStackFrame(n)}),getCallerStackFrame(e,t=new Error){const r=ji(t,e=>o(e));if(0===r.length)return{};const s=function(e,t=$i){for(let r=0;r<e.length;r+=1){const n=e[r],s=n.filePath??"",i=n.fullFilePath??"";if(!t.some(e=>e.test(s)||e.test(i)))return r}return 0}(r,n);return r[Wi(Number.isFinite(e)&&e>=0?e:s,r.length)]??{}},getErrorTrace:e=>ji(e,e=>o(e)),isError:e=>function(e){if(e instanceof Error)return!0;if(null!=e&&"object"==typeof e){const t=Object.prototype.toString.call(e);if(/\[object .*Error\]/.test(t))return!0;const r=e.name;if("string"==typeof r&&r.endsWith("Error"))return!0}return!1}(e),isBuffer:e=>"undefined"!=typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e),prettyFormatLogObj:(e,t)=>e.reduce((e,r)=>(i.isError(r)?e.errors.push(i.prettyFormatErrorObj(r,t)):e.args.push(r),e),{args:[],errors:[]}),prettyFormatErrorObj(e,t){const r=a(i.getErrorTrace(e),t),n=function(e,t={}){const r=t.maxDepth??5,n=[],s=/* @__PURE__ */new Set;let i=e,o=0;for(;null!=i&&o<r;){const e=i?.cause;if(null==e||s.has(e))break;s.add(e),n.push(Zi(e)),i=e,o+=1}return n}(e).map((e,r)=>[`Caused by (${r+1}): ${e.name??"Error"}${e.message?`: ${e.message}`:""}`,...a(ji(e,e=>o(e)),t)].join("\n")),s={errorName:` ${e.name} `,errorMessage:l(e),errorStack:[...r,...n].join("\n")};return _i(t,t.prettyErrorTemplate,s)},transportFormatted(t,r,n,s,i){const o=!1!==i.stylePrettyLogs,a=(n.length>0&&r.length>0?"\n":"")+n.join("\n"),l=t.replace(fo,"");const h=o?t:l;if(function(t){return t&&("browser"===e.name||"worker"===e.name)&&function(){if(!ho())return!1;const e=globalThis?.navigator,t=e?.userAgent??"";if(/firefox/i.test(t))return!0;const r=globalThis;return!!r?.CSS?.supports?.("color","#000")||/safari/i.test(t)&&!/chrome/i.test(t)}()}(o)){i.prettyInspectOptions.colors=!1;const e=d(i.prettyInspectOptions,r),t=null!=s?function(e,t){if(null==t)return{text:"",styles:[]};const{template:r,placeholders:n}=Vi(e,t),s=[],i=[];let o=0;const a=/{{(.+?)}}/g;let l;for(;null!=(l=a.exec(r));){l.index>o&&s.push(r.slice(o,l.index));const t=l[1],h=null!=n[t]?String(n[t]):"",d=u(c(e.prettyLogStyles?.[t],h));d.length>0?(s.push(`%c${h}%c`),i.push(d,"")):s.push(h),o=a.lastIndex}o<r.length&&s.push(r.slice(o));return{text:s.join(""),styles:i}}(i,s):{text:l,styles:[]},n=t.text.length>0&&t.styles.length>0,o=(n?t.text:l)+e+a;return void(n?console.log(o,...t.styles):console.log(o))}i.prettyInspectOptions.colors=o;const f=d(i.prettyInspectOptions,r);console.log(h+f+a)},transportJSON(e){console.log(Gi(e))}};return"test"===function(){const e=globalThis?.process;return e?.env?.NODE_ENV}()&&(i.__resetWorkingDirectoryCacheForTests=()=>{s=void 0}),i;function o(e){return r?function(e){const t=globalThis.location?.origin;if(null==e)return;const r=e.match(go);if(!r)return;const n=r[1]?.replace(/\?.*$/,"");if(null==n)return;const s=n.split("/"),i=r[2],o=r[3],a=s[s.length-1];return{fullFilePath:t?`${t}${n}`:n,fileName:a,fileNameWithLine:a&&i?`${a}:${i}`:void 0,fileColumn:o,fileLine:i,filePath:n,filePathWithLine:i?`${n}:${i}`:void 0,method:void 0}}(e):function(e){if("string"!=typeof e||0===e.length)return;const t=e.trim();if(!t.includes(" at ")&&!t.startsWith("at "))return;const r=t.replace(/^at\s+/,"");let n,i=r;const o=r.match(/^(.*?)\s+\((.*)\)$/);o&&(n=o[1],i=o[2]);const a=i.replace(/^\(/,"").replace(/\)$/,""),l=a.replace(/\?.*$/,"");let c,u,h=l;const d=l.split(":");d.length>=3&&/^\d+$/.test(d[d.length-1]??"")?(u=d.pop(),c=d.pop(),h=d.join(":")):d.length>=2&&/^\d+$/.test(d[d.length-1]??"")&&(c=d.pop(),h=d.join(":"));let f=h.replace(/^file:\/\//,"");const m=function(){void 0===s&&(s=function(){try{const e=globalThis?.process;if("function"==typeof e?.cwd)return e.cwd()}catch{}try{const e=globalThis?.Deno;if("function"==typeof e?.cwd)return e.cwd()}catch{}}()??null);return s??void 0}();null!=m&&f.startsWith(m)&&(f=f.slice(m.length),f=f.replace(/^[\\/]/,""));0===f.length&&(f=h);const p=function(e){if("string"!=typeof e||0===e.length)return e;const t=e.replace(/\\+/g,"\\").replace(/\\/g,"/"),r=t.startsWith("//"),n=t.startsWith("/")&&!r,s=t.match(/^[A-Za-z]:/),i=s?s[0]:"",o=(i?t.slice(i.length):t).split("/"),a=[];for(const c of o)""!==c&&"."!==c&&(".."!==c?a.push(c):a.length>0&&a.pop());let l=a.join("/");r?l=`//${l}`:n?l=`/${l}`:""!==i&&(l=`${i}${l.length>0?`/${l}`:""}`);if(0===l.length)return e;return l}(f),g=p.length>0?p:f,y=g.split(/\\|\//),w=y[y.length-1];return{fullFilePath:a,fileName:w,fileNameWithLine:w&&c?`${w}:${c}`:void 0,fileColumn:u,fileLine:c,filePath:g,filePathWithLine:g&&c?`${g}:${c}`:void 0,method:n}}(e)}function a(e,t){return e.map(e=>_i(t,t.prettyErrorStackTemplate,{...e},!0))}function l(e){return Object.getOwnPropertyNames(e).filter(e=>"stack"!==e&&"cause"!==e).reduce((t,r)=>{const n=e[r];return"function"==typeof n||t.push(String(n)),t},[]).join(", ")}function c(e,t){if(null==e)return[];if("string"==typeof e)return[e];if(Array.isArray(e))return e.flatMap(e=>c(e,t));if("object"==typeof e){const r=e[t.trim()]??e["*"];return null==r?[]:c(r,t)}return[]}function u(e){const t=/* @__PURE__ */new Set,r=[];for(const n of e){const e=h(n);null!=e&&e.length>0&&!t.has(e)&&(t.add(e),r.push(e))}return r.join("; ")}function h(e){const t=mo[e];if(null!=t)return`color: ${t}`;const r=po[e];if(null!=r)return`background-color: ${r}`;switch(e){case"bold":return"font-weight: bold";case"dim":return"opacity: 0.75";case"italic":return"font-style: italic";case"underline":return"text-decoration: underline";case"overline":return"text-decoration: overline";case"inverse":return"filter: invert(1)";case"hidden":return"visibility: hidden";case"strikethrough":return"text-decoration: line-through";default:return}}function d(e,t){try{return function(e,...t){const r={seen:[],stylize:Ji};null!=e&&uo(r,e);const n=t[0];let s=0,i="",o="";if("string"==typeof n){if(1===t.length)return n;let a,l=0;for(let o=0;o<n.length-1;o++)if(37===n.charCodeAt(o)){const c=n.charCodeAt(++o);if(s+1!==t.length){switch(c){case 115:{const n=t[++s];a="number"==typeof n||"bigint"==typeof n?co(r,n):"object"!=typeof n||null===n?String(n):Bi(n,{...e,compact:3,colors:!1,depth:0});break}case 106:a=Gi(t[++s]);break;case 100:{const e=t[++s];a="bigint"==typeof e?co(r,e):"symbol"==typeof e?"NaN":co(r,e);break}case 79:a=Bi(t[++s],e);break;case 111:a=Bi(t[++s],{...e,showHidden:!0,showProxy:!0,depth:4});break;case 105:{const e=t[++s];a="bigint"==typeof e?co(r,e):"symbol"==typeof e?"NaN":co(r,parseInt(a));break}case 102:{const e=t[++s];a="symbol"==typeof e?"NaN":co(r,parseInt(e));break}case 99:s+=1,a="";break;case 37:i+=n.slice(l,o),l=o+1;continue;default:continue}l!==o-1&&(i+=n.slice(l,o-1)),i+=a,l=o+1}else 37===c&&(i+=n.slice(l,o),l=o+1)}0!==l&&(s++,o=" ",l<n.length&&(i+=n.slice(l)))}for(;s<t.length;){const r=t[s];i+=o,i+="string"!=typeof r?Bi(r,e):r,o=" ",s++}return i}(e,...t)}catch{return t.map(f).join(" ")}}function f(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch{return String(e)}}function m(e,t,r,n){const s=e?.env?.HOSTNAME??e?.env?.HOST??e?.env?.COMPUTERNAME;if(null!=s&&s.length>0)return s;const i=r?.env?.HOSTNAME??r?.env?.HOST??r?.env?.COMPUTERNAME;if(null!=i&&i.length>0)return i;try{const e=t?.env?.get;if("function"==typeof e){const t=e("HOSTNAME");if(null!=t&&t.length>0)return t}}catch{}return null!=n?.hostname&&n.hostname.length>0?n.hostname:void 0}}();class wo{constructor(e,t,r=Number.NaN){this.logObj=t,this.stackDepthLevel=r,this.runtime=yo,this.maxErrorCauseDepth=5,this.settings={type:e?.type??"pretty",name:e?.name,parentNames:e?.parentNames,minLevel:e?.minLevel??0,argumentsArrayName:e?.argumentsArrayName,hideLogPositionForProduction:e?.hideLogPositionForProduction??!1,prettyLogTemplate:e?.prettyLogTemplate??"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}\t{{logLevelName}}\t{{filePathWithLine}}{{nameWithDelimiterPrefix}}\t",prettyErrorTemplate:e?.prettyErrorTemplate??"\n{{errorName}} {{errorMessage}}\nerror stack:\n{{errorStack}}",prettyErrorStackTemplate:e?.prettyErrorStackTemplate??" • {{fileName}}\t{{method}}\n\t{{filePathWithLine}}",prettyErrorParentNamesSeparator:e?.prettyErrorParentNamesSeparator??":",prettyErrorLoggerNameDelimiter:e?.prettyErrorLoggerNameDelimiter??"\t",stylePrettyLogs:e?.stylePrettyLogs??!0,prettyLogTimeZone:e?.prettyLogTimeZone??"UTC",prettyLogStyles:e?.prettyLogStyles??{logLevelName:{"*":["bold","black","bgWhiteBright","dim"],SILLY:["bold","white"],TRACE:["bold","whiteBright"],DEBUG:["bold","green"],INFO:["bold","blue"],WARN:["bold","yellow"],ERROR:["bold","red"],FATAL:["bold","redBright"]},dateIsoStr:"white",filePathWithLine:"white",name:["white","bold"],nameWithDelimiterPrefix:["white","bold"],nameWithDelimiterSuffix:["white","bold"],errorName:["bold","bgRedBright","whiteBright"],fileName:["yellow"],fileNameWithLine:"white"},prettyInspectOptions:e?.prettyInspectOptions??{colors:!0,compact:!1,depth:1/0},metaProperty:e?.metaProperty??"_meta",maskPlaceholder:e?.maskPlaceholder??"[***]",maskValuesOfKeys:e?.maskValuesOfKeys??["password"],maskValuesOfKeysCaseInsensitive:e?.maskValuesOfKeysCaseInsensitive??!1,maskValuesRegEx:e?.maskValuesRegEx,prefix:[...e?.prefix??[]],attachedTransports:[...e?.attachedTransports??[]],overwrite:{mask:e?.overwrite?.mask,toLogObj:e?.overwrite?.toLogObj,addMeta:e?.overwrite?.addMeta,addPlaceholders:e?.overwrite?.addPlaceholders,formatMeta:e?.overwrite?.formatMeta,formatLogObj:e?.overwrite?.formatLogObj,transportFormatted:e?.overwrite?.transportFormatted,transportJSON:e?.overwrite?.transportJSON}},this.captureStackForMeta=this._shouldCaptureStack()}log(e,t,...r){if(e<this.settings.minLevel)return;const n=this._resolveLogArguments(r),s=[...this.settings.prefix,...n],i=null!=this.settings.overwrite?.mask?this.settings.overwrite?.mask(s):null!=this.settings.maskValuesOfKeys&&this.settings.maskValuesOfKeys.length>0?this._mask(s):s,o=null!=this.logObj?this._recursiveCloneAndExecuteFunctions(this.logObj):void 0,a=null!=this.settings.overwrite?.toLogObj?this.settings.overwrite?.toLogObj(i,o):this._toLogObj(i,o),l=null!=this.settings.overwrite?.addMeta?this.settings.overwrite?.addMeta(a,e,t):this._addMetaToLogObj(a,e,t),c=l?.[this.settings.metaProperty];let u,h;if(null!=this.settings.overwrite?.formatMeta&&(u=this.settings.overwrite?.formatMeta(l?.[this.settings.metaProperty])),null!=this.settings.overwrite?.formatLogObj&&(h=this.settings.overwrite?.formatLogObj(i,this.settings)),"pretty"===this.settings.type&&(u=u??this._prettyFormatLogObjMeta(l?.[this.settings.metaProperty]),h=h??yo.prettyFormatLogObj(i,this.settings)),null!=u&&null!=h)if(null!=this.settings.overwrite?.transportFormatted){const e=this.settings.overwrite.transportFormatted,t=e.length;t<4?e(u,h.args,h.errors):4===t?e(u,h.args,h.errors,c):e(u,h.args,h.errors,c,this.settings)}else yo.transportFormatted(u,h.args,h.errors,c,this.settings);else null!=this.settings.overwrite?.transportJSON?this.settings.overwrite.transportJSON(l):"hidden"!==this.settings.type&&yo.transportJSON(l);return null!=this.settings.attachedTransports&&this.settings.attachedTransports.length>0&&this.settings.attachedTransports.forEach(e=>{e(l)}),l}attachTransport(e){this.settings.attachedTransports.push(e)}getSubLogger(e,t){const r={...this.settings,...e,parentNames:null!=this.settings?.parentNames&&null!=this.settings?.name?[...this.settings.parentNames,this.settings.name]:null!=this.settings?.name?[this.settings.name]:void 0,prefix:[...this.settings.prefix,...e?.prefix??[]]};return new this.constructor(r,t??this.logObj,this.stackDepthLevel)}_mask(e){const t=this._getMaskKeys();return e?.map(e=>this._recursiveCloneAndMaskValuesOfKeys(e,t))}_getMaskKeys(){const e=this.settings.maskValuesOfKeys??[],t=e.map(String).join("|");if(!0===this.settings.maskValuesOfKeysCaseInsensitive){if(this.maskKeysCache?.source===e&&!0===this.maskKeysCache.caseInsensitive&&this.maskKeysCache.signature===t)return this.maskKeysCache.normalized;const r=e.map(e=>"string"==typeof e?e.toLowerCase():String(e).toLowerCase());return this.maskKeysCache={source:e,caseInsensitive:!0,normalized:r,signature:t},r}return this.maskKeysCache={source:e,caseInsensitive:!1,normalized:e,signature:t},e}_resolveLogArguments(e){if(1===e.length&&"function"==typeof e[0]){const t=e[0];if(0===t.length){const e=t();return Array.isArray(e)?e:[e]}}return e}_recursiveCloneAndMaskValuesOfKeys(e,t,r=[]){if(r.includes(e))return{...e};if("object"==typeof e&&null!==e&&r.push(e),yo.isError(e)||yo.isBuffer(e))return e;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(Array.isArray(e))return e.map(e=>this._recursiveCloneAndMaskValuesOfKeys(e,t,r));if(e instanceof Date)return new Date(e.getTime());if(e instanceof URL)return{href:(n=e).href,protocol:n.protocol,username:n.username,password:n.password,host:n.host,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search,searchParams:[...n.searchParams].map(([e,t])=>({key:e,value:t})),hash:n.hash,origin:n.origin};if(null!==e&&"object"==typeof e){const n=yo.isError(e)?this._cloneError(e):Object.create(Object.getPrototypeOf(e));return Object.getOwnPropertyNames(e).reduce((n,s)=>{const i=!0!==this.settings?.maskValuesOfKeysCaseInsensitive?s:"string"==typeof s?s.toLowerCase():String(s).toLowerCase();return n[s]=t.includes(i)?this.settings.maskPlaceholder:(()=>{try{return this._recursiveCloneAndMaskValuesOfKeys(e[s],t,r)}catch{return null}})(),n},n)}if("string"==typeof e){let t=e;for(const e of this.settings?.maskValuesRegEx||[])t=t.replace(e,this.settings?.maskPlaceholder||"");return t}return e;var n}_recursiveCloneAndExecuteFunctions(e,t=[]){return this.isObjectOrArray(e)&&t.includes(e)?this.shallowCopy(e):(this.isObjectOrArray(e)&&t.push(e),Array.isArray(e)?e.map(e=>this._recursiveCloneAndExecuteFunctions(e,t)):e instanceof Date?new Date(e.getTime()):this.isObject(e)?Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=Object.getOwnPropertyDescriptor(e,n);if(s){Object.defineProperty(r,n,s);const i=e[n];r[n]="function"==typeof i?i():this._recursiveCloneAndExecuteFunctions(i,t)}return r},Object.create(Object.getPrototypeOf(e))):e)}isObjectOrArray(e){return"object"==typeof e&&null!==e}isObject(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}shallowCopy(e){return Array.isArray(e)?[...e]:{...e}}_toLogObj(e,t={}){return e=e?.map(e=>yo.isError(e)?this._toErrorObject(e):e),t=null==this.settings.argumentsArrayName?1!==e.length||Array.isArray(e[0])||!0===yo.isBuffer(e[0])||e[0]instanceof Date?{...t,...e}:"object"==typeof e[0]&&null!=e[0]?{...e[0],...t}:{0:e[0],...t}:{...t,[this.settings.argumentsArrayName]:e}}_cloneError(e){const t=new e.constructor;return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=e[r]}),t}_toErrorObject(e,t=0,r=/* @__PURE__ */new Set){r.has(e)||r.add(e);const n={nativeError:e,name:e.name??"Error",message:e.message,stack:yo.getErrorTrace(e)};if(t>=this.maxErrorCauseDepth)return n;const s=e.cause;if(null!=s){const e=Zi(s);r.has(e)||(n.cause=this._toErrorObject(e,t+1,r))}return n}_addMetaToLogObj(e,t,r){return{...e,[this.settings.metaProperty]:yo.getMeta(t,r,this.stackDepthLevel,!this.captureStackForMeta,this.settings.name,this.settings.parentNames)}}_shouldCaptureStack(){if(this.settings.hideLogPositionForProduction)return!1;if("json"===this.settings.type)return!0;const e=this.settings.prettyLogTemplate??"";return!!/{{\s*(file(Name|Path|Line|PathWithLine|NameWithLine)|fullFilePath)\s*}}/.test(e)}_prettyFormatLogObjMeta(e){return Vi(this.settings,e).text}}class vo extends wo{constructor(e,t){const r={...e??{}};"undefined"!=typeof window&&"undefined"!=typeof document&&(r.stylePrettyLogs=e?.stylePrettyLogs??!0),super(r,t,Number.NaN)}log(e,t,...r){return super.log(e,t,...r)}silly(...e){return super.log(0,"SILLY",...e)}trace(...e){return super.log(1,"TRACE",...e)}debug(...e){return super.log(2,"DEBUG",...e)}info(...e){return super.log(3,"INFO",...e)}warn(...e){return super.log(4,"WARN",...e)}error(...e){return super.log(5,"ERROR",...e)}fatal(...e){return super.log(6,"FATAL",...e)}getSubLogger(e,t){return super.getSubLogger(e,t)}}function Eo(t){const r=new Di;r.setService(i.action,new Pe),r.setService(i.setting,new ze),r.setService(i.icon,new ze);const n=new vo({name:"app-core",type:"pretty"});r.setService(i.logger,n);const s=[Ci,Fi,ki,Pi,Ei,Ni,q,Q,Y,ee,re,se,oe,le,ue,de,pe,ye,ve,Se,Te,Oe,I,H,$,W,Z,bi];for(let e=0;e<s.length;e++)r.setService(s[e].identifier,s[e].constructFromServiceResolver(r));return Ri(r),t.addEventListener(e.GetServiceResolver,e=>{e.setServiceResolver(r),e.stopPropagation()}),r}const So=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,Definition:$e,Enum:o,Partial:l},Symbol.toStringTag,{value:"Module"}));export{h as BrowserEvent,d as BrowserEventListener,G as Cache,xe as Endpoint,T as Error,Ge as Event,Ai as EventListener,zi as Service,So as Type,Eo as init};
|
|
1
|
+
var e=/* @__PURE__ */(e=>(e.GetServiceResolver="ember-nexus.app-core.get-service-resolver",e))(e||{}),t=/* @__PURE__ */(e=>(e.NormalizedValueToRawValueEvent="ember-nexus.app-core.event.normalized-value-to-raw-value",e.RawValueToNormalizedValueEvent="ember-nexus.app-core.event.raw-value-to-normalized-value",e))(t||{}),r=/* @__PURE__ */(e=>(e.GET="GET",e.POST="POST",e.PATCH="PATCH",e.PUT="PUT",e.DELETE="DELETE",e.HEAD="HEAD",e.COPY="COPY",e.LOCK="LOCK",e.UNLOCK="UNLOCK",e.MKCOL="MKCOL",e.MOVE="MOVE",e.PROPFIND="PROPFIND",e.PROPPATCH="PROPPATCH",e))(r||{}),n=/* @__PURE__ */(e=>(e[e.Debug=2]="Debug",e[e.Info=3]="Info",e[e.Warn=4]="Warn",e[e.Error=5]="Error",e))(n||{}),s=/* @__PURE__ */(e=>(e.ClientSide="client",e.ServerSide="server",e.Logic="Logic",e))(s||{}),i=/* @__PURE__ */(e=>(e.emberNexusWebSDK="ember-nexus.web-sdk",e.logger="global.logger",e.action="global.action-registry",e.setting="global.setting-registry",e.icon="global.icon-registry",e.serviceFetchHelper="ember-nexus.app-core.service.fetch-helper-service",e.serviceApiConfiguration="ember-nexus.app-core.service.api-configuration-service",e.serviceElementParser="ember-nexus.app-core.service.element-parser-service",e.serviceCollectionParser="ember-nexus.app-core.service.collection-parser-service",e.serviceTokenParser="ember-nexus.app-core.service.token-parser-service",e.serviceApiWrapper="ember-nexus.app-core.service.api-wrapper",e.serviceEventDispatcher="ember-nexus.app-core.service.event-dispatcher",e.endpointElementDeleteElementEndpoint="ember-nexus.app-core.endpoint.element.delete-element-endpoint",e.endpointElementGetElementEndpoint="ember-nexus.app-core.endpoint.element.get-element-endpoint",e.endpointElementGetElementChildrenEndpoint="ember-nexus.app-core.endpoint.element.get-element-children-endpoint",e.endpointElementGetElementParentsEndpoint="ember-nexus.app-core.endpoint.element.get-element-parents-endpoint",e.endpointElementGetElementRelatedEndpoint="ember-nexus.app-core.endpoint.element.get-element-related-endpoint",e.endpointElementGetIndexEndpoint="ember-nexus.app-core.endpoint.element.get-index-endpoint",e.endpointElementPatchElementEndpoint="ember-nexus.app-core.endpoint.element.patch-element-endpoint",e.endpointElementPostElementEndpoint="ember-nexus.app-core.endpoint.element.post-element-endpoint",e.endpointElementPostIndexEndpoint="ember-nexus.app-core.endpoint.element.post-index-endpoint",e.endpointElementPutElementEndpoint="ember-nexus.app-core.endpoint.element.put-element-endpoint",e.endpointUserDeleteTokenEndpoint="ember-nexus.app-core.endpoint.user.delete-token-endpoint",e.endpointUserGetMeEndpoint="ember-nexus.app-core.endpoint.user.get-me-endpoint",e.endpointUserGetTokenEndpoint="ember-nexus.app-core.endpoint.user.get-token-endpoint",e.endpointUserPostChangePasswordEndpoint="ember-nexus.app-core.endpoint.user.post-change-password-endpoint",e.endpointUserPostRegisterEndpoint="ember-nexus.app-core.endpoint.user.post-register-endpoint",e.endpointUserPostTokenEndpoint="ember-nexus.app-core.endpoint.user.post-token-endpoint",e.cacheElement="ember-nexus.app-core.cache.element-cache",e.cacheElementChildren="ember-nexus.app-core.cache.element-children-cache",e.cacheElementParents="ember-nexus.app-core.cache.element-parents-cache",e.cacheElementRelated="ember-nexus.app-core.cache.element-related-cache",e.cacheIndex="ember-nexus.app-core.cache.index-cache",e))(i||{});const o=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,BrowserEventIdentifier:e,EventIdentifier:t,HttpRequestMethod:r,LogLevel:n,RequestProblemCategory:s,ServiceIdentifier:i},Symbol.toStringTag,{value:"Module"})),a={bubbles:!0,composed:!0,cancelable:!0},l=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,customEventDefaultInit:a},Symbol.toStringTag,{value:"Module"})),c=class e extends CustomEvent{constructor(){super(e.type,{...a,detail:{serviceResolver:null}})}getServiceResolver(){return this.detail.serviceResolver}setServiceResolver(e){this.detail.serviceResolver=e}};c.type=e.GetServiceResolver;let u=c;const h=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,GetServiceResolverEvent:u},Symbol.toStringTag,{value:"Module"})),d=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,exportPlaceholder:!1},Symbol.toStringTag,{value:"Module"}));class f extends Error{constructor(e){super(e)}}class m extends f{constructor(e){super(e),this.name="LogicError"}}class p extends f{constructor(e,t){super(e),this.name="NetworkError",this.cause=t}}class g extends f{constructor(e){super(e),this.name="ParseError"}}class y extends f{constructor(e){super(e),this._type=null,this._title=null,this._detail=null,this._status=null}getType(){return this._type}setType(e){return this._type=e,this}getTitle(){return this._title}setTitle(e){return this._title=e,this}getDetail(){return this._detail}setDetail(e){return this._detail=e,this}getStatus(){return this._status}setStatus(e){return this._status=e,this}}class w extends y{constructor(e){super(e),this.name="Response401UnauthorizedError",this.setStatus(401)}}class v extends y{constructor(e){super(e),this.name="Response403ForbiddenError",this.setStatus(403)}}class E extends y{constructor(e){super(e),this.name="Response404NotFoundError",this.setStatus(404)}}class S extends y{constructor(e){super(e),this.name="Response429TooManyRequestsError",this.setStatus(429)}}class b extends f{constructor(e){super(e),this.name="ValidationError"}}const T=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,EmberNexusError:f,LogicError:m,NetworkError:p,ParseError:g,Response401UnauthorizedError:w,Response403ForbiddenError:v,Response404NotFoundError:E,Response429TooManyRequestsError:S,ResponseError:y,ValidationError:b},Symbol.toStringTag,{value:"Module"}));class k{has(e){return this.cache.has(e)}get(e){return this.cache.get(e)}set(e,t){return this.cache.set(e,t),this}delete(e){return this.cache.delete(e),this}setFromDataEtag(e,t,r){const n=this.cache.get(e);n&&void 0===r&&(r=n.etag);const s={data:t,etag:r};return this.cache.set(e,s),this}setFromParsedResponse(e,t){const r=t.response.headers.get("ETag");if(null===r)throw new m("Expected parsedResponse to contain ETag header.");const n={data:t.data,etag:r};return this.cache.set(e,n),this}refresh(e){return this}}const O="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,F=/* @__PURE__ */new Set,x="object"==typeof process&&process?process:{},C=(e,t,r,n)=>{"function"==typeof x.emitWarning?x.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)};let L=globalThis.AbortController,N=globalThis.AbortSignal;if(void 0===L){N=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},L=class{constructor(){t()}signal=new N;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e="1"!==x.env?.LRU_CACHE_IGNORE_AC_WARNING;const t=()=>{e&&(e=!1,C("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}const D=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),P=e=>D(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?M:null:null;class M extends Array{constructor(e){super(e),this.fill(0)}}class z{heap;length;static#e=!1;static create(e){const t=P(e);if(!t)return[];z.#e=!0;const r=new z(e,t);return z.#e=!1,r}constructor(e,t){if(!z.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class R{#t;#r;#n;#s;#i;#o;#a;#l;get perf(){return this.#l}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#u;#h;#d;#f;#m;#p;#g;#y;#w;#v;#E;#S;#b;#T;#k;#O;#F;#x;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#b,autopurgeTimers:e.#T,sizes:e.#E,keyMap:e.#h,keyList:e.#d,valList:e.#f,next:e.#m,prev:e.#p,get head(){return e.#g},get tail(){return e.#y},free:e.#w,isBackgroundFetch:t=>e.#C(t),backgroundFetch:(t,r,n,s)=>e.#L(t,r,n,s),moveToTail:t=>e.#N(t),indexes:t=>e.#D(t),rindexes:t=>e.#P(t),isStale:t=>e.#M(t)}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#u}get size(){return this.#c}get fetchMethod(){return this.#o}get memoMethod(){return this.#a}get dispose(){return this.#n}get onInsert(){return this.#s}get disposeAfter(){return this.#i}constructor(e){const{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:s,updateAgeOnGet:i,updateAgeOnHas:o,allowStale:a,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:d,maxSize:f=0,maxEntrySize:m=0,sizeCalculation:p,fetchMethod:g,memoMethod:y,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:S,ignoreFetchAbort:b,perf:T}=e;if(void 0!==T&&"function"!=typeof T?.now)throw new TypeError("perf option must have a now() method if specified");if(this.#l=T??O,0!==t&&!D(t))throw new TypeError("max option must be a nonnegative integer");const k=t?P(t):Array;if(!k)throw new Error("invalid max value: "+t);if(this.#t=t,this.#r=f,this.maxEntrySize=m||this.#r,this.sizeCalculation=p,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==y&&"function"!=typeof y)throw new TypeError("memoMethod must be a function if defined");if(this.#a=y,void 0!==g&&"function"!=typeof g)throw new TypeError("fetchMethod must be a function if specified");if(this.#o=g,this.#O=!!g,this.#h=/* @__PURE__ */new Map,this.#d=new Array(t).fill(void 0),this.#f=new Array(t).fill(void 0),this.#m=new k(t),this.#p=new k(t),this.#g=0,this.#y=0,this.#w=z.create(t),this.#c=0,this.#u=0,"function"==typeof l&&(this.#n=l),"function"==typeof c&&(this.#s=c),"function"==typeof u?(this.#i=u,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#k=!!this.#n,this.#x=!!this.#s,this.#F=!!this.#i,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!b,0!==this.maxEntrySize){if(0!==this.#r&&!D(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!D(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#z()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!i,this.updateAgeOnHas=!!o,this.ttlResolution=D(n)||0===n?n:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!D(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#R()}if(0===this.#t&&0===this.ttl&&0===this.#r)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){const e="LRU_CACHE_UNBOUNDED";if((e=>!F.has(e))(e)){F.add(e);C("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,R)}}}getRemainingTTL(e){return this.#h.has(e)?1/0:0}#R(){const e=new M(this.#t),t=new M(this.#t);this.#b=e,this.#S=t;const r=this.ttlAutopurge?new Array(this.#t):void 0;this.#T=r,this.#A=(n,s,i=this.#l.now())=>{if(t[n]=0!==s?i:0,e[n]=s,r?.[n]&&(clearTimeout(r[n]),r[n]=void 0),0!==s&&r){const e=setTimeout(()=>{this.#M(n)&&this.#I(this.#d[n],"expire")},s+1);e.unref&&e.unref(),r[n]=e}},this.#_=r=>{t[r]=0!==e[r]?this.#l.now():0},this.#H=(r,i)=>{if(e[i]){const o=e[i],a=t[i];if(!o||!a)return;r.ttl=o,r.start=a,r.now=n||s();const l=r.now-a;r.remainingTTL=o-l}};let n=0;const s=()=>{const e=this.#l.now();if(this.ttlResolution>0){n=e;const t=setTimeout(()=>n=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=r=>{const i=this.#h.get(r);if(void 0===i)return 0;const o=e[i],a=t[i];if(!o||!a)return 1/0;return o-((n||s())-a)},this.#M=r=>{const i=t[r],o=e[r];return!!o&&!!i&&(n||s())-i>o}}#_=()=>{};#H=()=>{};#A=()=>{};#M=()=>!1;#z(){const e=new M(this.#t);this.#u=0,this.#E=e,this.#V=t=>{this.#u-=e[t],e[t]=0},this.#$=(e,t,r,n)=>{if(this.#C(t))return 0;if(!D(r)){if(!n)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof n)throw new TypeError("sizeCalculation must be a function");if(r=n(t,e),!D(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return r},this.#j=(t,r,n)=>{if(e[t]=r,this.#r){const r=this.#r-e[t];for(;this.#u>r;)this.#W(!0)}this.#u+=e[t],n&&(n.entrySize=r,n.totalCalculatedSize=this.#u)}}#V=e=>{};#j=(e,t,r)=>{};#$=(e,t,r,n)=>{if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#D({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#y;this.#U(t)&&(!e&&this.#M(t)||(yield t),t!==this.#g);)t=this.#p[t]}*#P({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;this.#U(t)&&(!e&&this.#M(t)||(yield t),t!==this.#y);)t=this.#m[t]}#U(e){return void 0!==e&&this.#h.get(this.#d[e])===e}*entries(){for(const e of this.#D())void 0===this.#f[e]||void 0===this.#d[e]||this.#C(this.#f[e])||(yield[this.#d[e],this.#f[e]])}*rentries(){for(const e of this.#P())void 0===this.#f[e]||void 0===this.#d[e]||this.#C(this.#f[e])||(yield[this.#d[e],this.#f[e]])}*keys(){for(const e of this.#D()){const t=this.#d[e];void 0===t||this.#C(this.#f[e])||(yield t)}}*rkeys(){for(const e of this.#P()){const t=this.#d[e];void 0===t||this.#C(this.#f[e])||(yield t)}}*values(){for(const e of this.#D()){void 0===this.#f[e]||this.#C(this.#f[e])||(yield this.#f[e])}}*rvalues(){for(const e of this.#P()){void 0===this.#f[e]||this.#C(this.#f[e])||(yield this.#f[e])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(const r of this.#D()){const n=this.#f[r],s=this.#C(n)?n.__staleWhileFetching:n;if(void 0!==s&&e(s,this.#d[r],this))return this.get(this.#d[r],t)}}forEach(e,t=this){for(const r of this.#D()){const n=this.#f[r],s=this.#C(n)?n.__staleWhileFetching:n;void 0!==s&&e.call(t,s,this.#d[r],this)}}rforEach(e,t=this){for(const r of this.#P()){const n=this.#f[r],s=this.#C(n)?n.__staleWhileFetching:n;void 0!==s&&e.call(t,s,this.#d[r],this)}}purgeStale(){let e=!1;for(const t of this.#P({allowStale:!0}))this.#M(t)&&(this.#I(this.#d[t],"expire"),e=!0);return e}info(e){const t=this.#h.get(e);if(void 0===t)return;const r=this.#f[t],n=this.#C(r)?r.__staleWhileFetching:r;if(void 0===n)return;const s={value:n};if(this.#b&&this.#S){const e=this.#b[t],r=this.#S[t];if(e&&r){const t=e-(this.#l.now()-r);s.ttl=t,s.start=Date.now()}}return this.#E&&(s.size=this.#E[t]),s}dump(){const e=[];for(const t of this.#D({allowStale:!0})){const r=this.#d[t],n=this.#f[t],s=this.#C(n)?n.__staleWhileFetching:n;if(void 0===s||void 0===r)continue;const i={value:s};if(this.#b&&this.#S){i.ttl=this.#b[t];const e=this.#l.now()-this.#S[t];i.start=Math.floor(Date.now()-e)}this.#E&&(i.size=this.#E[t]),e.unshift([r,i])}return e}load(e){this.clear();for(const[t,r]of e){if(r.start){const e=Date.now()-r.start;r.start=this.#l.now()-e}this.set(t,r.value,r)}}set(e,t,r={}){if(void 0===t)return this.delete(e),this;const{ttl:n=this.ttl,start:s,noDisposeOnSet:i=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:a}=r;let{noUpdateTTL:l=this.noUpdateTTL}=r;const c=this.#$(e,t,r.size||0,o);if(this.maxEntrySize&&c>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.#I(e,"set"),this;let u=0===this.#c?void 0:this.#h.get(e);if(void 0===u)u=0===this.#c?this.#y:0!==this.#w.length?this.#w.pop():this.#c===this.#t?this.#W(!1):this.#c,this.#d[u]=e,this.#f[u]=t,this.#h.set(e,u),this.#m[this.#y]=u,this.#p[u]=this.#y,this.#y=u,this.#c++,this.#j(u,c,a),a&&(a.set="add"),l=!1,this.#x&&this.#s?.(t,e,"add");else{this.#N(u);const r=this.#f[u];if(t!==r){if(this.#O&&this.#C(r)){r.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:t}=r;void 0===t||i||(this.#k&&this.#n?.(t,e,"set"),this.#F&&this.#v?.push([t,e,"set"]))}else i||(this.#k&&this.#n?.(r,e,"set"),this.#F&&this.#v?.push([r,e,"set"]));if(this.#V(u),this.#j(u,c,a),this.#f[u]=t,a){a.set="replace";const e=r&&this.#C(r)?r.__staleWhileFetching:r;void 0!==e&&(a.oldValue=e)}}else a&&(a.set="update");this.#x&&this.onInsert?.(t,e,t===r?"update":"replace")}if(0===n||this.#b||this.#R(),this.#b&&(l||this.#A(u,n,s),a&&this.#H(a,u)),!i&&this.#F&&this.#v){const e=this.#v;let t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){const e=this.#f[this.#g];if(this.#W(!0),this.#C(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#F&&this.#v){const e=this.#v;let t;for(;t=e?.shift();)this.#i?.(...t)}}}#W(e){const t=this.#g,r=this.#d[t],n=this.#f[t];return this.#O&&this.#C(n)?n.__abortController.abort(new Error("evicted")):(this.#k||this.#F)&&(this.#k&&this.#n?.(n,r,"evict"),this.#F&&this.#v?.push([n,r,"evict"])),this.#V(t),this.#T?.[t]&&(clearTimeout(this.#T[t]),this.#T[t]=void 0),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#w.push(t)),1===this.#c?(this.#g=this.#y=0,this.#w.length=0):this.#g=this.#m[t],this.#h.delete(r),this.#c--,t}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,s=this.#h.get(e);if(void 0!==s){const e=this.#f[s];if(this.#C(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#M(s))return r&&this.#_(s),n&&(n.has="hit",this.#H(n,s)),!0;n&&(n.has="stale",this.#H(n,s))}else n&&(n.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,n=this.#h.get(e);if(void 0===n||!r&&this.#M(n))return;const s=this.#f[n];return this.#C(s)?s.__staleWhileFetching:s}#L(e,t,r,n){const s=void 0===t?void 0:this.#f[t];if(this.#C(s))return s;const i=new L,{signal:o}=r;o?.addEventListener("abort",()=>i.abort(o.reason),{signal:i.signal});const a={signal:i.signal,options:r,context:n},l=(n,s=!1)=>{const{aborted:o}=i.signal,l=r.ignoreFetchAbort&&void 0!==n;if(r.status&&(o&&!s?(r.status.fetchAborted=!0,r.status.fetchError=i.signal.reason,l&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),o&&!l&&!s)return c(i.signal.reason);const h=u,d=this.#f[t];return(d===u||l&&s&&void 0===d)&&(void 0===n?void 0!==h.__staleWhileFetching?this.#f[t]=h.__staleWhileFetching:this.#I(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,n,a.options))),n},c=n=>{const{aborted:s}=i.signal,o=s&&r.allowStaleOnFetchAbort,a=o||r.allowStaleOnFetchRejection,l=a||r.noDeleteOnFetchRejection,c=u;if(this.#f[t]===u){!l||void 0===c.__staleWhileFetching?this.#I(e,"fetch"):o||(this.#f[t]=c.__staleWhileFetching)}if(a)return r.status&&void 0!==c.__staleWhileFetching&&(r.status.returnedStale=!0),c.__staleWhileFetching;if(c.__returned===c)throw n};r.status&&(r.status.fetchDispatched=!0);const u=new Promise((t,n)=>{const o=this.#o?.(e,s,a);o&&o instanceof Promise&&o.then(e=>t(void 0===e?void 0:e),n),i.signal.addEventListener("abort",()=>{r.ignoreFetchAbort&&!r.allowStaleOnFetchAbort||(t(void 0),r.allowStaleOnFetchAbort&&(t=e=>l(e,!0)))})}).then(l,e=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=e),c(e))),h=Object.assign(u,{__abortController:i,__staleWhileFetching:s,__returned:void 0});return void 0===t?(this.set(e,h,{...a.options,status:void 0}),t=this.#h.get(e)):this.#f[t]=h,h}#C(e){if(!this.#O)return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof L}async fetch(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:a=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,context:m,forceRefresh:p=!1,status:g,signal:y}=t;if(!this.#O)return g&&(g.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:s,status:g});const w={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:s,ttl:i,noDisposeOnSet:o,size:a,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:f,ignoreFetchAbort:d,status:g,signal:y};let v=this.#h.get(e);if(void 0===v){g&&(g.fetch="miss");const t=this.#L(e,v,w,m);return t.__returned=t}{const t=this.#f[v];if(this.#C(t)){const e=r&&void 0!==t.__staleWhileFetching;return g&&(g.fetch="inflight",e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}const s=this.#M(v);if(!p&&!s)return g&&(g.fetch="hit"),this.#N(v),n&&this.#_(v),g&&this.#H(g,v),t;const i=this.#L(e,v,w,m),o=void 0!==i.__staleWhileFetching&&r;return g&&(g.fetch=s?"stale":"refresh",o&&s&&(g.returnedStale=!0)),o?i.__staleWhileFetching:i.__returned=i}}async forceFetch(e,t={}){const r=await this.fetch(e,t);if(void 0===r)throw new Error("fetch() returned undefined");return r}memo(e,t={}){const r=this.#a;if(!r)throw new Error("no memoMethod provided to constructor");const{context:n,forceRefresh:s,...i}=t,o=this.get(e,i);if(!s&&void 0!==o)return o;const a=r(e,o,{options:i,context:n});return this.set(e,a,i),a}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:i}=t,o=this.#h.get(e);if(void 0!==o){const t=this.#f[o],a=this.#C(t);return i&&this.#H(i,o),this.#M(o)?(i&&(i.get="stale"),a?(i&&r&&void 0!==t.__staleWhileFetching&&(i.returnedStale=!0),r?t.__staleWhileFetching:void 0):(s||this.#I(e,"expire"),i&&r&&(i.returnedStale=!0),r?t:void 0)):(i&&(i.get="hit"),a?t.__staleWhileFetching:(this.#N(o),n&&this.#_(o),t))}i&&(i.get="miss")}#Z(e,t){this.#p[t]=e,this.#m[e]=t}#N(e){e!==this.#y&&(e===this.#g?this.#g=this.#m[e]:this.#Z(this.#p[e],this.#m[e]),this.#Z(this.#y,e),this.#y=e)}delete(e){return this.#I(e,"delete")}#I(e,t){let r=!1;if(0!==this.#c){const n=this.#h.get(e);if(void 0!==n)if(this.#T?.[n]&&(clearTimeout(this.#T?.[n]),this.#T[n]=void 0),r=!0,1===this.#c)this.#G(t);else{this.#V(n);const r=this.#f[n];if(this.#C(r)?r.__abortController.abort(new Error("deleted")):(this.#k||this.#F)&&(this.#k&&this.#n?.(r,e,t),this.#F&&this.#v?.push([r,e,t])),this.#h.delete(e),this.#d[n]=void 0,this.#f[n]=void 0,n===this.#y)this.#y=this.#p[n];else if(n===this.#g)this.#g=this.#m[n];else{const e=this.#p[n];this.#m[e]=this.#m[n];const t=this.#m[n];this.#p[t]=this.#p[n]}this.#c--,this.#w.push(n)}}if(this.#F&&this.#v?.length){const e=this.#v;let t;for(;t=e?.shift();)this.#i?.(...t)}return r}clear(){return this.#G("delete")}#G(e){for(const t of this.#P({allowStale:!0})){const r=this.#f[t];if(this.#C(r))r.__abortController.abort(new Error("deleted"));else{const n=this.#d[t];this.#k&&this.#n?.(r,n,e),this.#F&&this.#v?.push([r,n,e])}}if(this.#h.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#b&&this.#S){this.#b.fill(0),this.#S.fill(0);for(const e of this.#T??[])void 0!==e&&clearTimeout(e);this.#T?.fill(void 0)}if(this.#E&&this.#E.fill(0),this.#g=0,this.#y=0,this.#w.length=0,this.#u=0,this.#c=0,this.#F&&this.#v){const e=this.#v;let t;for(;t=e?.shift();)this.#i?.(...t)}}}const A=class e extends k{constructor(){super(),this.cache=new R({max:500})}static constructFromServiceResolver(){return new e}static createCacheKey(e){return`${e}`}setFromCollection(t){for(let r=0;r<t.nodes.length;r++)this.setFromDataEtag(e.createCacheKey(t.nodes[r].id),t.nodes[r]);for(let r=0;r<t.relations.length;r++)this.setFromDataEtag(e.createCacheKey(t.relations[r].id),t.relations[r]);return this}};A.identifier=i.cacheElement;let I=A;const _=class e extends k{constructor(){super(),this.cache=new R({max:50})}static constructFromServiceResolver(){return new e}static createCacheKey(e,t,r){return`${e}-${t}-${r}`}};_.identifier=i.cacheElementChildren;let H=_;const V=class e extends k{constructor(){super(),this.cache=new R({max:50})}static constructFromServiceResolver(){return new e}static createCacheKey(e,t,r){return`${e}-${t}-${r}`}};V.identifier=i.cacheElementParents;let $=V;const j=class e extends k{constructor(){super(),this.cache=new R({max:50})}static constructFromServiceResolver(){return new e}static createCacheKey(e,t,r){return`${e}-${t}-${r}`}};j.identifier=i.cacheElementRelated;let W=j;const U=class e extends k{constructor(){super(),this.cache=new R({max:50})}static constructFromServiceResolver(){return new e}static createCacheKey(e,t){return`${e}-${t}`}};U.identifier=i.cacheIndex;let Z=U;const G=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,Cache:k,ElementCache:I,ElementChildrenCache:H,ElementParentsCache:$,ElementRelatedCache:W,IndexCache:Z},Symbol.toStringTag,{value:"Module"})),B=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async deleteElement(e){try{const t=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP DELETE request against URL: ${t}`);const r=await fetch(t,this.fetchHelper.getDefaultDeleteOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(r),{response:r}}catch(t){this.fetchHelper.logAndThrowError(t)}}};B.identifier=i.endpointElementDeleteElementEndpoint;let q=B;const J=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceCollectionParser))}async getElementChildren(e,t=1,r=25,n){try{if(t<1)throw new b("Page number must be at least 1.");if(r<1)throw new b("Page size must be at least 1.");const s=this.fetchHelper.buildUrl(`/${e}/children?page=${t}&pageSize=${r}`);this.logger.debug(`Executing HTTP GET request against URL: ${s}`);const i=await fetch(s,this.fetchHelper.getDefaultGetOptions(n)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===i.status)return{response:i};const o=await this.fetchHelper.parseJsonResponse(i);return{data:await this.collectionParser.deserializeCollection(o),response:i}}catch(s){this.fetchHelper.logAndThrowError(s)}}};J.identifier=i.endpointElementGetElementChildrenEndpoint;let Y=J;const K=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.elementParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceElementParser))}async getElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP GET request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultGetOptions(t)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===n.status)return{response:n};const s=await this.fetchHelper.parseJsonResponse(n);return{data:await this.elementParser.deserializeElement(s),response:n}}catch(r){this.fetchHelper.logAndThrowError(r)}}};K.identifier=i.endpointElementGetElementEndpoint;let Q=K;const X=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceCollectionParser))}async getElementParents(e,t=1,r=25,n){try{if(t<1)throw new b("Page number must be at least 1.");if(r<1)throw new b("Page size must be at least 1.");const s=this.fetchHelper.buildUrl(`/${e}/parents?page=${t}&pageSize=${r}`);this.logger.debug(`Executing HTTP GET request against URL: ${s}`);const i=await fetch(s,this.fetchHelper.getDefaultGetOptions(n)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===i.status)return{response:i};const o=await this.fetchHelper.parseJsonResponse(i);return{data:await this.collectionParser.deserializeCollection(o),response:i}}catch(s){this.fetchHelper.logAndThrowError(s)}}};X.identifier=i.endpointElementGetElementParentsEndpoint;let ee=X;const te=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceCollectionParser))}async getElementRelated(e,t=1,r=25,n){try{if(t<1)throw new b("Page number must be at least 1.");if(r<1)throw new b("Page size must be at least 1.");const s=this.fetchHelper.buildUrl(`/${e}/related?page=${t}&pageSize=${r}`);this.logger.debug(`Executing HTTP GET request against URL: ${s}`);const i=await fetch(s,this.fetchHelper.getDefaultGetOptions(n)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===i.status)return{response:i};const o=await this.fetchHelper.parseJsonResponse(i);return{data:await this.collectionParser.deserializeCollection(o),response:i}}catch(s){this.fetchHelper.logAndThrowError(s)}}};te.identifier=i.endpointElementGetElementRelatedEndpoint;let re=te;const ne=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceCollectionParser))}async getIndex(e=1,t=25,r){try{if(e<1)throw new b("Page number must be at least 1.");if(t<1)throw new b("Page size must be at least 1.");const n=this.fetchHelper.buildUrl(`/?page=${e}&pageSize=${t}`);this.logger.debug(`Executing HTTP GET request against URL: ${n}`);const s=await fetch(n,this.fetchHelper.getDefaultGetOptions(r)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===s.status)return{response:s};const i=await this.fetchHelper.parseJsonResponse(s);return{data:await this.collectionParser.deserializeCollection(i),response:s}}catch(n){this.fetchHelper.logAndThrowError(n)}}};ne.identifier=i.endpointElementGetIndexEndpoint;let se=ne;const ie=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async patchElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP PATCH request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultPatchOptions(JSON.stringify(t))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(n),{response:n}}catch(r){this.fetchHelper.logAndThrowError(r)}}};ie.identifier=i.endpointElementPatchElementEndpoint;let oe=ie;const ae=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async postElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP POST request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultPostOptions(JSON.stringify(t))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return{data:await this.fetchHelper.parseLocationResponse(n),response:n}}catch(r){this.fetchHelper.logAndThrowError(r)}}};ae.identifier=i.endpointElementPostElementEndpoint;let le=ae;const ce=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async postIndex(e){try{const t=this.fetchHelper.buildUrl("/");this.logger.debug(`Executing HTTP POST request against URL: ${t}`);const r=await fetch(t,this.fetchHelper.getDefaultPostOptions(JSON.stringify(e))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return{data:await this.fetchHelper.parseLocationResponse(r),response:r}}catch(t){this.fetchHelper.logAndThrowError(t)}}};ce.identifier=i.endpointElementPostIndexEndpoint;let ue=ce;const he=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async putElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP PUT request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultPutOptions(JSON.stringify(t))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(n),{response:n}}catch(r){this.fetchHelper.logAndThrowError(r)}}};he.identifier=i.endpointElementPutElementEndpoint;let de=he;const fe=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,DeleteElementEndpoint:q,GetElementChildrenEndpoint:Y,GetElementEndpoint:Q,GetElementParentsEndpoint:ee,GetElementRelatedEndpoint:re,GetIndexEndpoint:se,PatchElementEndpoint:oe,PostElementEndpoint:le,PostIndexEndpoint:ue,PutElementEndpoint:de},Symbol.toStringTag,{value:"Module"})),me=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async deleteToken(){try{const e=this.fetchHelper.buildUrl("/token");this.logger.debug(`Executing HTTP DELETE request against URL: ${e}`);const t=await fetch(e,this.fetchHelper.getDefaultDeleteOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(t),{response:t}}catch(e){this.fetchHelper.logAndThrowError(e)}}};me.identifier=i.endpointUserDeleteTokenEndpoint;let pe=me;const ge=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.elementParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceElementParser))}async getMe(){try{const e=this.fetchHelper.buildUrl("/me");this.logger.debug(`Executing HTTP GET request against URL: ${e}`);const t=await fetch(e,this.fetchHelper.getDefaultGetOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e)),r=await this.fetchHelper.parseJsonResponse(t),n=await this.elementParser.deserializeElement(r);if("User"!==n.type)throw new m("Expected node to be of type 'User'.");return{data:n,response:t}}catch(e){this.fetchHelper.logAndThrowError(e)}}};ge.identifier=i.endpointUserGetMeEndpoint;let ye=ge;const we=class e{constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.elementParser=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper),t.getServiceOrFail(i.serviceElementParser))}async getToken(){try{const e=this.fetchHelper.buildUrl("/token");this.logger.debug(`Executing HTTP GET request against URL: ${e}`);const t=await fetch(e,this.fetchHelper.getDefaultGetOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e)),r=await this.fetchHelper.parseJsonResponse(t),n=await this.elementParser.deserializeElement(r);if("Token"!==n.type)throw new m("Expected node to be of type 'Token'.");return{data:n,response:t}}catch(e){this.fetchHelper.logAndThrowError(e)}}};we.identifier=i.endpointUserGetTokenEndpoint;let ve=we;const Ee=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async postChangePassword(e,t,r){try{const n=this.fetchHelper.buildUrl("/change-password");this.logger.debug(`Executing HTTP POST request against URL: ${n}`);const s={type:"ActionChangePassword",currentPassword:t,newPassword:r,uniqueUserIdentifier:e},i=await fetch(n,this.fetchHelper.getDefaultPostOptions(JSON.stringify(s))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(i),{response:i}}catch(n){this.fetchHelper.logAndThrowError(n)}}};Ee.identifier=i.endpointUserPostChangePasswordEndpoint;let Se=Ee;const be=class e{constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceFetchHelper))}async postRegister(e,t,r={}){try{const n=this.fetchHelper.buildUrl("/register");this.logger.debug(`Executing HTTP POST request against URL: ${n}`);const s={type:"User",uniqueUserIdentifier:e,password:t,data:r},i=await fetch(n,this.fetchHelper.getDefaultPostOptions(JSON.stringify(s))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return{data:await this.fetchHelper.parseLocationResponse(i),response:i}}catch(n){this.fetchHelper.logAndThrowError(n)}}};be.identifier=i.endpointUserPostRegisterEndpoint;let Te=be;const ke=class e{constructor(e,t,r){this.logger=e,this.tokenParser=t,this.fetchHelper=r}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.logger),t.getServiceOrFail(i.serviceTokenParser),t.getServiceOrFail(i.serviceFetchHelper))}async postToken(e,t,r={}){try{const n=this.fetchHelper.buildUrl("/token");this.logger.debug(`Executing HTTP POST request against URL: ${n}`);const s={type:"Token",uniqueUserIdentifier:e,password:t,data:r},i=await fetch(n,this.fetchHelper.getDefaultPostOptions(JSON.stringify(s))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e)),o=await this.fetchHelper.parseJsonResponse(i);return{data:this.tokenParser.rawTokenToToken(o),response:i}}catch(n){this.fetchHelper.logAndThrowError(n)}}};ke.identifier=i.endpointUserPostTokenEndpoint;let Oe=ke;const Fe=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,DeleteTokenEndpoint:pe,GetMeEndpoint:ye,GetTokenEndpoint:ve,PostChangePasswordEndpoint:Se,PostRegisterEndpoint:Te,PostTokenEndpoint:Oe},Symbol.toStringTag,{value:"Module"})),xe=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,Element:fe,User:Fe},Symbol.toStringTag,{value:"Module"}));class Ce{constructor(e){this.stopped=!1,this.identifier=e}getIdentifier(){return this.identifier}isPropagationStopped(){return this.stopped}stopPropagation(){return this.stopped=!0,this}}const Le=/^([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*$/;const Ne=/^(?:([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*|\*|([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*(\.\*))$/;function De(e){if(!Ne.test(e))throw new g("Passed variable is not a valid event listener target.");return e}function Pe(e){const t=e.split("."),r=[];r.push(De(e));for(let n=t.length-1;n>0;n--)r.push(De(t.slice(0,n).join(".")+".*"));return r.push(De("*")),r}class Me{constructor(){this.entries=/* @__PURE__ */new Map}clearEntries(){return this.entries.clear(),this}deleteEntry(e){return this.entries.delete(e),this}getEntry(e){if(!this.hasEntry(e))return null;const t=this.entries.get(e);return t[t.length-1].entry}hasEntry(e){return this.entries.has(e)}setEntry(e,t,r){let n;void 0===r&&(r=0),this.entries.has(e)?n=this.entries.get(e):(n=[],this.entries.set(e,n));let s=0,i=n.length-1,o=-1;for(;s<=i;){const e=Math.floor((s+i)/2);n[e].priority>=r?(o=e,i=e-1):s=e+1}const a=-1===o?s:o;return n.splice(a,0,{priority:r,entry:t}),this}getAllEntriesForKey(e){return this.entries.has(e)?this.entries.get(e).map(e=>e.entry):null}}class ze{constructor(){this.entries=/* @__PURE__ */new Map}clearEntries(){return this.entries.clear(),this}deleteEntry(e){return this.entries.delete(e),this}getEntry(e){return this.hasEntry(e)?this.entries.get(e):null}hasEntry(e){return this.entries.has(e)}setEntry(e,t){return this.entries.set(e,t),this}}const Re=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Ae=/^([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*$/;const Ie=/^secret-token:.+$/;function _e(e){if(!Ie.test(e))throw new Error("Passed variable is not a valid token.");return e}const He=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;function Ve(e){if(!He.test(e))throw new g("Passed variable is not a valid UUID v4.");return e}const $e=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,Event:Ce,PriorityRegistry:Me,Registry:ze,Response:Re,createUniqueUserIdentifierFromString:function(e){return e},eventIdentifierRegex:Le,eventListenerTargetRegex:Ne,getEventListenerTargetsFromEventIdentifier:Pe,serviceIdentifierRegex:Ae,tokenRegex:Ie,uuidv4Regex:He,validateEventIdentifierFromString:function(e){if(!Le.test(e))throw new g("Passed variable is not a valid event identifier.");return e},validateEventListenerTargetFromString:De,validateServiceIdentifierFromString:function(e){if(!Ae.test(e))throw new g("Passed variable is not a valid service identifier.");return e},validateTokenFromString:_e,validateUuidFromString:Ve},Symbol.toStringTag,{value:"Module"})),je=class e extends Ce{constructor(t){super(e.identifier),this.normalizedValue=t,this.rawValue=null}getNormalizedValue(){return this.normalizedValue}getRawValue(){return this.rawValue}setRawValue(e){return this.isPropagationStopped()||(this.rawValue=e),this}};je.identifier=t.NormalizedValueToRawValueEvent;let We=je;const Ue=class e extends Ce{constructor(t){super(e.identifier),this.rawValue=t,this.normalizedValue=null}getRawValue(){return this.rawValue}getNormalizedValue(){return this.normalizedValue}setNormalizedValue(e){return this.isPropagationStopped()||(this.normalizedValue=e),this}};Ue.identifier=t.RawValueToNormalizedValueEvent;let Ze=Ue;const Ge=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,NormalizedValueToRawValueEvent:We,RawValueToNormalizedValueEvent:Ze},Symbol.toStringTag,{value:"Module"}));class Be extends Error{}class qe extends Be{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Je extends Be{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Ye extends Be{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Ke extends Be{}class Qe extends Be{constructor(e){super(`Invalid unit ${e}`)}}class Xe extends Be{}class et extends Be{constructor(){super("Zone is an abstract class")}}const tt="numeric",rt="short",nt="long",st={year:tt,month:tt,day:tt},it={year:tt,month:rt,day:tt},ot={year:tt,month:rt,day:tt,weekday:rt},at={year:tt,month:nt,day:tt},lt={year:tt,month:nt,day:tt,weekday:nt},ct={hour:tt,minute:tt},ut={hour:tt,minute:tt,second:tt},ht={hour:tt,minute:tt,second:tt,timeZoneName:rt},dt={hour:tt,minute:tt,second:tt,timeZoneName:nt},ft={hour:tt,minute:tt,hourCycle:"h23"},mt={hour:tt,minute:tt,second:tt,hourCycle:"h23"},pt={hour:tt,minute:tt,second:tt,hourCycle:"h23",timeZoneName:rt},gt={hour:tt,minute:tt,second:tt,hourCycle:"h23",timeZoneName:nt},yt={year:tt,month:tt,day:tt,hour:tt,minute:tt},wt={year:tt,month:tt,day:tt,hour:tt,minute:tt,second:tt},vt={year:tt,month:rt,day:tt,hour:tt,minute:tt},Et={year:tt,month:rt,day:tt,hour:tt,minute:tt,second:tt},St={year:tt,month:rt,day:tt,weekday:rt,hour:tt,minute:tt},bt={year:tt,month:nt,day:tt,hour:tt,minute:tt,timeZoneName:rt},Tt={year:tt,month:nt,day:tt,hour:tt,minute:tt,second:tt,timeZoneName:rt},kt={year:tt,month:nt,day:tt,weekday:nt,hour:tt,minute:tt,timeZoneName:nt},Ot={year:tt,month:nt,day:tt,weekday:nt,hour:tt,minute:tt,second:tt,timeZoneName:nt};class Ft{get type(){throw new et}get name(){throw new et}get ianaName(){return this.name}get isUniversal(){throw new et}offsetName(e,t){throw new et}formatOffset(e,t){throw new et}offset(e){throw new et}equals(e){throw new et}get isValid(){throw new et}}let xt=null;class Ct extends Ft{static get instance(){return null===xt&&(xt=new Ct),xt}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return qr(e,t,r)}formatOffset(e,t){return Qr(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const Lt=/* @__PURE__ */new Map;const Nt={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};const Dt=/* @__PURE__ */new Map;class Pt extends Ft{static create(e){let t=Dt.get(e);return void 0===t&&Dt.set(e,t=new Pt(e)),t}static resetCache(){Dt.clear(),Lt.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(t){return!1}}constructor(e){super(),this.zoneName=e,this.valid=Pt.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return qr(e,t,r,this.name)}formatOffset(e,t){return Qr(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const r=function(e){let t=Lt.get(e);return void 0===t&&(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"}),Lt.set(e,t)),t}(this.name);let[n,s,i,o,a,l,c]=r.formatToParts?function(e,t){const r=e.formatToParts(t),n=[];for(let s=0;s<r.length;s++){const{type:e,value:t}=r[s],i=Nt[e];"era"===e?n[i]=t:xr(i)||(n[i]=parseInt(t,10))}return n}(r,t):function(e,t){const r=e.format(t).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,s,i,o,a,l,c,u]=n;return[o,s,i,a,l,c,u]}(r,t);"BC"===o&&(n=1-Math.abs(n));let u=+t;const h=u%1e3;return u-=h>=0?h:1e3+h,(Ur({year:n,month:s,day:i,hour:24===a?0:a,minute:l,second:c,millisecond:0})-u)/6e4}equals(e){return"iana"===e.type&&e.name===this.name}get isValid(){return this.valid}}let Mt={};const zt=/* @__PURE__ */new Map;function Rt(e,t={}){const r=JSON.stringify([e,t]);let n=zt.get(r);return void 0===n&&(n=new Intl.DateTimeFormat(e,t),zt.set(r,n)),n}const At=/* @__PURE__ */new Map;const It=/* @__PURE__ */new Map;let _t=null;const Ht=/* @__PURE__ */new Map;function Vt(e){let t=Ht.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),Ht.set(e,t)),t}const $t=/* @__PURE__ */new Map;function jt(e,t,r,n){const s=e.listingMode();return"error"===s?null:"en"===s?r(t):n(t)}class Wt{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:n,floor:s,...i}=r;if(!t||Object.keys(i).length>0){const t={useGrouping:!1,...r};r.padTo>0&&(t.minimumIntegerDigits=r.padTo),this.inf=function(e,t={}){const r=JSON.stringify([e,t]);let n=At.get(r);return void 0===n&&(n=new Intl.NumberFormat(e,t),At.set(r,n)),n}(e,t)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}return Ar(this.floor?Math.floor(e):Vr(e,3),this.padTo)}}class Ut{constructor(e,t,r){let n;if(this.opts=r,this.originalZone=void 0,this.opts.timeZone)this.dt=e;else if("fixed"===e.zone.type){const t=e.offset/60*-1,r=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;0!==e.offset&&Pt.create(r).valid?(n=r,this.dt=e):(n="UTC",this.dt=0===e.offset?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else"system"===e.zone.type?this.dt=e:"iana"===e.zone.type?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||n,this.dtf=Rt(t,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if("timeZoneName"===e.type){const t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class Zt{constructor(e,t,r){this.opts={style:"long",...r},!t&&Nr()&&(this.rtf=function(e,t={}){const{base:r,...n}=t,s=JSON.stringify([e,n]);let i=It.get(s);return void 0===i&&(i=new Intl.RelativeTimeFormat(e,t),It.set(s,i)),i}(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):function(e,t,r="always",n=!1){const s={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."]},i=-1===["hours","minutes","seconds"].indexOf(e);if("auto"===r&&i){const r="days"===e;switch(t){case 1:return r?"tomorrow":`next ${s[e][0]}`;case-1:return r?"yesterday":`last ${s[e][0]}`;case 0:return r?"today":`this ${s[e][0]}`}}const o=Object.is(t,-0)||t<0,a=Math.abs(t),l=1===a,c=s[e],u=n?l?c[1]:c[2]||c[1]:l?s[e][0]:e;return o?`${a} ${u} ago`:`in ${a} ${u}`}(t,e,this.opts.numeric,"long"!==this.opts.style)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const Gt={firstDay:1,minimalDays:4,weekend:[6,7]};class Bt{static fromOpts(e){return Bt.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,n,s=!1){const i=e||hr.defaultLocale,o=i||(s?"en-US":_t||(_t=(new Intl.DateTimeFormat).resolvedOptions().locale,_t)),a=t||hr.defaultNumberingSystem,l=r||hr.defaultOutputCalendar,c=zr(n)||hr.defaultWeekSettings;return new Bt(o,a,l,c,i)}static resetCache(){_t=null,zt.clear(),At.clear(),It.clear(),Ht.clear(),$t.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:n}={}){return Bt.create(e,t,r,n)}constructor(e,t,r,n,s){const[i,o,a]=function(e){const t=e.indexOf("-x-");-1!==t&&(e=e.substring(0,t));const r=e.indexOf("-u-");if(-1===r)return[e];{let t,s;try{t=Rt(e).resolvedOptions(),s=e}catch(n){const i=e.substring(0,r);t=Rt(i).resolvedOptions(),s=i}const{numberingSystem:i,calendar:o}=t;return[s,i,o]}}(e);this.locale=i,this.numberingSystem=t||o||null,this.outputCalendar=r||a||null,this.weekSettings=n,this.intl=function(e,t,r){return r||t?(e.includes("-u-")||(e+="-u"),r&&(e+=`-ca-${r}`),t&&(e+=`-nu-${t}`),e):e}(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){var e;return null==this.fastNumbersCached&&(this.fastNumbersCached=(!(e=this).numberingSystem||"latn"===e.numberingSystem)&&("latn"===e.numberingSystem||!e.locale||e.locale.startsWith("en")||"latn"===Vt(e.locale).numberingSystem)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return e&&t?"en":"intl"}clone(e){return e&&0!==Object.getOwnPropertyNames(e).length?Bt.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,zr(e.weekSettings)||this.weekSettings,e.defaultToEN||!1):this}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return jt(this,e,nn,()=>{const r="ja"===this.intl||this.intl.startsWith("ja-"),n=(t&=!r)?{month:e,day:"numeric"}:{month:e},s=t?"format":"standalone";if(!this.monthsCache[s][e]){const t=r?e=>this.dtFormatter(e,n).format():e=>this.extract(e,n,"month");this.monthsCache[s][e]=function(e){const t=[];for(let r=1;r<=12;r++){const n=ci.utc(2009,r,1);t.push(e(n))}return t}(t)}return this.monthsCache[s][e]})}weekdays(e,t=!1){return jt(this,e,ln,()=>{const r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=t?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=function(e){const t=[];for(let r=1;r<=7;r++){const n=ci.utc(2016,11,13+r);t.push(e(n))}return t}(e=>this.extract(e,r,"weekday"))),this.weekdaysCache[n][e]})}meridiems(){return jt(this,void 0,()=>cn,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[ci.utc(2016,11,13,9),ci.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return jt(this,e,fn,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[ci.utc(-40,1,1),ci.utc(2017,1,1)].map(e=>this.extract(e,t,"era"))),this.eraCache[e]})}extract(e,t,r){const n=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===r);return n?n.value:null}numberFormatter(e={}){return new Wt(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Ut(e,this.intl,t)}relFormatter(e={}){return new Zt(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function(e,t={}){const r=JSON.stringify([e,t]);let n=Mt[r];return n||(n=new Intl.ListFormat(e,t),Mt[r]=n),n}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||Vt(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Dr()?function(e){let t=$t.get(e);if(!t){const r=new Intl.Locale(e);t="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,"minimalDays"in t||(t={...Gt,...t}),$t.set(e,t)}return t}(this.locale):Gt}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 qt=null;class Jt extends Ft{static get utcInstance(){return null===qt&&(qt=new Jt(0)),qt}static instance(e){return 0===e?Jt.utcInstance:new Jt(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Jt(Jr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Qr(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Qr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Qr(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return"fixed"===e.type&&e.fixed===this.fixed}get isValid(){return!0}}class Yt extends Ft{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 Kt(e,t){if(xr(e)||null===e)return t;if(e instanceof Ft)return e;if("string"==typeof e){const r=e.toLowerCase();return"default"===r?t:"local"===r||"system"===r?Ct.instance:"utc"===r||"gmt"===r?Jt.utcInstance:Jt.parseSpecifier(r)||Pt.create(e)}return Cr(e)?Jt.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new Yt(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"},Xt={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]},er=Qt.hanidec.replace(/[\[|\]]/g,"").split("");const tr=/* @__PURE__ */new Map;function rr({numberingSystem:e},t=""){const r=e||"latn";let n=tr.get(r);void 0===n&&(n=/* @__PURE__ */new Map,tr.set(r,n));let s=n.get(t);return void 0===s&&(s=new RegExp(`${Qt[r]}${t}`),n.set(t,s)),s}let nr,sr=()=>Date.now(),ir="system",or=null,ar=null,lr=null,cr=60,ur=null;class hr{static get now(){return sr}static set now(e){sr=e}static set defaultZone(e){ir=e}static get defaultZone(){return Kt(ir,Ct.instance)}static get defaultLocale(){return or}static set defaultLocale(e){or=e}static get defaultNumberingSystem(){return ar}static set defaultNumberingSystem(e){ar=e}static get defaultOutputCalendar(){return lr}static set defaultOutputCalendar(e){lr=e}static get defaultWeekSettings(){return ur}static set defaultWeekSettings(e){ur=zr(e)}static get twoDigitCutoffYear(){return cr}static set twoDigitCutoffYear(e){cr=e%100}static get throwOnInvalid(){return nr}static set throwOnInvalid(e){nr=e}static resetCaches(){Bt.resetCache(),Pt.resetCache(),ci.resetCache(),tr.clear()}}class dr{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const fr=[0,31,59,90,120,151,181,212,243,273,304,334],mr=[0,31,60,91,121,152,182,213,244,274,305,335];function pr(e,t){return new dr("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function gr(e,t,r){const n=new Date(Date.UTC(e,t-1,r));e<100&&e>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const s=n.getUTCDay();return 0===s?7:s}function yr(e,t,r){return r+($r(e)?mr:fr)[t-1]}function wr(e,t){const r=$r(e)?mr:fr,n=r.findIndex(e=>e<t);return{month:n+1,day:t-r[n]}}function vr(e,t){return(e-t+7)%7+1}function Er(e,t=4,r=1){const{year:n,month:s,day:i}=e,o=yr(n,s,i),a=vr(gr(n,s,i),r);let l,c=Math.floor((o-a+14-t)/7);return c<1?(l=n-1,c=Gr(l,t,r)):c>Gr(n,t,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:a,...Xr(e)}}function Sr(e,t=4,r=1){const{weekYear:n,weekNumber:s,weekday:i}=e,o=vr(gr(n,1,t),r),a=jr(n);let l,c=7*s+i-o-7+t;c<1?(l=n-1,c+=jr(l)):c>a?(l=n+1,c-=jr(n)):l=n;const{month:u,day:h}=wr(l,c);return{year:l,month:u,day:h,...Xr(e)}}function br(e){const{year:t,month:r,day:n}=e;return{year:t,ordinal:yr(t,r,n),...Xr(e)}}function Tr(e){const{year:t,ordinal:r}=e,{month:n,day:s}=wr(t,r);return{year:t,month:n,day:s,...Xr(e)}}function kr(e,t){if(!xr(e.localWeekday)||!xr(e.localWeekNumber)||!xr(e.localWeekYear)){if(!xr(e.weekday)||!xr(e.weekNumber)||!xr(e.weekYear))throw new Ke("Cannot mix locale-based week fields with ISO-based week fields");return xr(e.localWeekday)||(e.weekday=e.localWeekday),xr(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),xr(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function Or(e){const t=Lr(e.year),r=Rr(e.month,1,12),n=Rr(e.day,1,Wr(e.year,e.month));return t?r?!n&&pr("day",e.day):pr("month",e.month):pr("year",e.year)}function Fr(e){const{hour:t,minute:r,second:n,millisecond:s}=e,i=Rr(t,0,23)||24===t&&0===r&&0===n&&0===s,o=Rr(r,0,59),a=Rr(n,0,59),l=Rr(s,0,999);return i?o?a?!l&&pr("millisecond",s):pr("second",n):pr("minute",r):pr("hour",t)}function xr(e){return void 0===e}function Cr(e){return"number"==typeof e}function Lr(e){return"number"==typeof e&&e%1==0}function Nr(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function Dr(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function Pr(e,t,r){if(0!==e.length)return e.reduce((e,n)=>{const s=[t(n),n];return e&&r(e[0],s[0])===e[0]?e:s},null)[1]}function Mr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function zr(e){if(null==e)return null;if("object"!=typeof e)throw new Xe("Week settings must be an object");if(!Rr(e.firstDay,1,7)||!Rr(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!Rr(e,1,7)))throw new Xe("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function Rr(e,t,r){return Lr(e)&&e>=t&&e<=r}function Ar(e,t=2){let r;return r=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),r}function Ir(e){return xr(e)||null===e||""===e?void 0:parseInt(e,10)}function _r(e){return xr(e)||null===e||""===e?void 0:parseFloat(e)}function Hr(e){if(!xr(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function Vr(e,t,r="round"){const n=10**t;switch(r){case"expand":return e>0?Math.ceil(e*n)/n:Math.floor(e*n)/n;case"trunc":return Math.trunc(e*n)/n;case"round":return Math.round(e*n)/n;case"floor":return Math.floor(e*n)/n;case"ceil":return Math.ceil(e*n)/n;default:throw new RangeError(`Value rounding ${r} is out of range`)}}function $r(e){return e%4==0&&(e%100!=0||e%400==0)}function jr(e){return $r(e)?366:365}function Wr(e,t){const r=(n=t-1)-(s=12)*Math.floor(n/s)+1;var n,s;return 2===r?$r(e+(t-r)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function Ur(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 Zr(e,t,r){return-vr(gr(e,1,t),r)+t-1}function Gr(e,t=4,r=1){const n=Zr(e,t,r),s=Zr(e+1,t,r);return(jr(e)-n+s)/7}function Br(e){return e>99?e:e>hr.twoDigitCutoffYear?1900+e:2e3+e}function qr(e,t,r,n=null){const s=new Date(e),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(i.timeZone=n);const o={timeZoneName:t,...i},a=new Intl.DateTimeFormat(r,o).formatToParts(s).find(e=>"timezonename"===e.type.toLowerCase());return a?a.value:null}function Jr(e,t){let r=parseInt(e,10);Number.isNaN(r)&&(r=0);const n=parseInt(t,10)||0;return 60*r+(r<0||Object.is(r,-0)?-n:n)}function Yr(e){const t=Number(e);if("boolean"==typeof e||""===e||!Number.isFinite(t))throw new Xe(`Invalid unit value ${e}`);return t}function Kr(e,t){const r={};for(const n in e)if(Mr(e,n)){const s=e[n];if(null==s)continue;r[t(n)]=Yr(s)}return r}function Qr(e,t){const r=Math.trunc(Math.abs(e/60)),n=Math.trunc(Math.abs(e%60)),s=e>=0?"+":"-";switch(t){case"short":return`${s}${Ar(r,2)}:${Ar(n,2)}`;case"narrow":return`${s}${r}${n>0?`:${n}`:""}`;case"techie":return`${s}${Ar(r,2)}${Ar(n,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function Xr(e){return function(e,t){return t.reduce((t,r)=>(t[r]=e[r],t),{})}(e,["hour","minute","second","millisecond"])}const en=["January","February","March","April","May","June","July","August","September","October","November","December"],tn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],rn=["J","F","M","A","M","J","J","A","S","O","N","D"];function nn(e){switch(e){case"narrow":return[...rn];case"short":return[...tn];case"long":return[...en];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 sn=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],on=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],an=["M","T","W","T","F","S","S"];function ln(e){switch(e){case"narrow":return[...an];case"short":return[...on];case"long":return[...sn];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const cn=["AM","PM"],un=["Before Christ","Anno Domini"],hn=["BC","AD"],dn=["B","A"];function fn(e){switch(e){case"narrow":return[...dn];case"short":return[...hn];case"long":return[...un];default:return null}}function mn(e,t){let r="";for(const n of e)n.literal?r+=n.val:r+=t(n.val);return r}const pn={D:st,DD:it,DDD:at,DDDD:lt,t:ct,tt:ut,ttt:ht,tttt:dt,T:ft,TT:mt,TTT:pt,TTTT:gt,f:yt,ff:vt,fff:bt,ffff:kt,F:wt,FF:Et,FFF:Tt,FFFF:Ot};class gn{static create(e,t={}){return new gn(e,t)}static parseFormat(e){let t=null,r="",n=!1;const s=[];for(let i=0;i<e.length;i++){const o=e.charAt(i);"'"===o?((r.length>0||n)&&s.push({literal:n||/^\s+$/.test(r),val:""===r?"'":r}),t=null,r="",n=!n):n||o===t?r+=o:(r.length>0&&s.push({literal:/^\s+$/.test(r),val:r}),r=o,t=o)}return r.length>0&&s.push({literal:n||/^\s+$/.test(r),val:r}),s}static macroTokenToFormatOpts(e){return pn[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem());return 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,r=void 0){if(this.opts.forceSimple)return Ar(e,t);const n={...this.opts};return t>0&&(n.padTo=t),r&&(n.signDisplay=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){const r="en"===this.loc.listingMode(),n=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,s=(t,r)=>this.loc.extract(e,t,r),i=t=>e.isOffsetFixed&&0===e.offset&&t.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,t.format):"",o=()=>r?function(e){return cn[e.hour<12?0:1]}(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(t,n)=>r?function(e,t){return nn(t)[e.month-1]}(e,t):s(n?{month:t}:{month:t,day:"numeric"},"month"),l=(t,n)=>r?function(e,t){return ln(t)[e.weekday-1]}(e,t):s(n?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),c=t=>{const r=gn.macroTokenToFormatOpts(t);return r?this.formatWithSystemDefault(e,r):t},u=t=>r?function(e,t){return fn(t)[e.year<0?0:1]}(e,t):s({era:t},"era");return mn(gn.parseFormat(t),t=>{switch(t){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12==0?12:e.hour%12);case"hh":return this.num(e.hour%12==0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return i({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return i({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return i({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return n?s({day:"numeric"},"day"):this.num(e.day);case"dd":return n?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":case"E":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return n?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return n?s({month:"numeric"},"month"):this.num(e.month);case"MM":return n?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return n?s({year:"numeric"},"year"):this.num(e.year);case"yy":return n?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return u("short");case"GG":return u("long");case"GGGGG":return u("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(t)}})}formatDurationFromString(e,t){const r="negativeLargestOnly"===this.opts.signMode?-1:1,n=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}},s=gn.parseFormat(t),i=s.reduce((e,{literal:t,val:r})=>t?e:e.concat(r),[]),o=e.shiftTo(...i.map(n).filter(e=>e));return mn(s,((e,t)=>s=>{const i=n(s);if(i){const n=t.isNegativeDuration&&i!==t.largestUnit?r:1;let o;return o="negativeLargestOnly"===this.opts.signMode&&i!==t.largestUnit?"never":"all"===this.opts.signMode?"always":"auto",this.num(e.get(i)*n,s.length,o)}return s})(o,{isNegativeDuration:o<0,largestUnit:Object.keys(o.values)[0]}))}}const yn=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function wn(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function vn(...e){return t=>e.reduce(([e,r,n],s)=>{const[i,o,a]=s(t,n);return[{...e,...i},o||r,a]},[{},null,1]).slice(0,2)}function En(e,...t){if(null==e)return[null,null];for(const[r,n]of t){const t=r.exec(e);if(t)return n(t)}return[null,null]}function Sn(...e){return(t,r)=>{const n={};let s;for(s=0;s<e.length;s++)n[e[s]]=Ir(t[r+s]);return[n,null,r+s]}}const bn=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Tn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,kn=RegExp(`${Tn.source}${`(?:${bn.source}?(?:\\[(${yn.source})\\])?)?`}`),On=RegExp(`(?:[Tt]${kn.source})?`),Fn=Sn("weekYear","weekNumber","weekDay"),xn=Sn("year","ordinal"),Cn=RegExp(`${Tn.source} ?(?:${bn.source}|(${yn.source}))?`),Ln=RegExp(`(?: ${Cn.source})?`);function Nn(e,t,r){const n=e[t];return xr(n)?r:Ir(n)}function Dn(e,t){return[{hours:Nn(e,t,0),minutes:Nn(e,t+1,0),seconds:Nn(e,t+2,0),milliseconds:Hr(e[t+3])},null,t+4]}function Pn(e,t){const r=!e[t]&&!e[t+1],n=Jr(e[t+1],e[t+2]);return[{},r?null:Jt.instance(n),t+3]}function Mn(e,t){return[{},e[t]?Pt.create(e[t]):null,t+1]}const zn=RegExp(`^T?${Tn.source}$`),Rn=/^-?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 An(e){const[t,r,n,s,i,o,a,l,c]=e,u="-"===t[0],h=l&&"-"===l[0],d=(e,t=!1)=>void 0!==e&&(t||e&&u)?-e:e;return[{years:d(_r(r)),months:d(_r(n)),weeks:d(_r(s)),days:d(_r(i)),hours:d(_r(o)),minutes:d(_r(a)),seconds:d(_r(l),"-0"===l),milliseconds:d(Hr(c),h)}]}const In={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function _n(e,t,r,n,s,i,o){const a={year:2===t.length?Br(Ir(t)):Ir(t),month:tn.indexOf(r)+1,day:Ir(n),hour:Ir(s),minute:Ir(i)};return o&&(a.second=Ir(o)),e&&(a.weekday=e.length>3?sn.indexOf(e)+1:on.indexOf(e)+1),a}const Hn=/^(?:(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 Vn(e){const[,t,r,n,s,i,o,a,l,c,u,h]=e,d=_n(t,s,n,r,i,o,a);let f;return f=l?In[l]:c?0:Jr(u,h),[d,new Jt(f)]}const $n=/^(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$/,jn=/^(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$/,Wn=/^(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 Un(e){const[,t,r,n,s,i,o,a]=e;return[_n(t,s,n,r,i,o,a),Jt.utcInstance]}function Zn(e){const[,t,r,n,s,i,o,a]=e;return[_n(t,a,r,n,s,i,o),Jt.utcInstance]}const Gn=wn(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,On),Bn=wn(/(\d{4})-?W(\d\d)(?:-?(\d))?/,On),qn=wn(/(\d{4})-?(\d{3})/,On),Jn=wn(kn),Yn=vn(function(e,t){return[{year:Nn(e,t),month:Nn(e,t+1,1),day:Nn(e,t+2,1)},null,t+3]},Dn,Pn,Mn),Kn=vn(Fn,Dn,Pn,Mn),Qn=vn(xn,Dn,Pn,Mn),Xn=vn(Dn,Pn,Mn);const es=vn(Dn);const ts=wn(/(\d{4})-(\d\d)-(\d\d)/,Ln),rs=wn(Cn),ns=vn(Dn,Pn,Mn);const ss="Invalid Duration",is={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},os={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...is},as=365.2425,ls=30.436875,cs={years:{quarters:4,months:12,weeks:52.1775,days:as,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:ls,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...is},us=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],hs=us.slice(0).reverse();function ds(e,t,r=!1){const n={values:r?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new gs(n)}function fs(e,t){let r=t.milliseconds??0;for(const n of hs.slice(1))t[n]&&(r+=t[n]*e[n].milliseconds);return r}function ms(e,t){const r=fs(e,t)<0?-1:1;us.reduceRight((n,s)=>{if(xr(t[s]))return n;if(n){const i=t[n]*r,o=e[s][n],a=Math.floor(i/o);t[s]+=a*r,t[n]-=a*o*r}return s},null),us.reduce((r,n)=>{if(xr(t[n]))return r;if(r){const s=t[r]%1;t[r]-=s,t[n]+=s*e[r][n]}return n},null)}function ps(e){const t={};for(const[r,n]of Object.entries(e))0!==n&&(t[r]=n);return t}class gs{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let r=t?cs:os;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||Bt.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return gs.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new Xe("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new gs({values:Kr(e,gs.normalizeUnit),loc:Bt.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(Cr(e))return gs.fromMillis(e);if(gs.isDuration(e))return e;if("object"==typeof e)return gs.fromObject(e);throw new Xe(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[r]=En(e,[Rn,An]);return r?gs.fromObject(r,t):gs.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[r]=En(e,[zn,es]);return r?gs.fromObject(r,t):gs.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Xe("need to specify a reason the Duration is invalid");const r=e instanceof dr?e:new dr(e,t);if(hr.throwOnInvalid)throw new Ye(r);return new gs({invalid:r})}static normalizeUnit(e){const 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():e];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={}){const r={...t,floor:!1!==t.round&&!1!==t.floor};return this.isValid?gn.create(this.loc,r).formatDurationFromString(this,e):ss}toHuman(e={}){if(!this.isValid)return ss;const t=!1!==e.showZeros,r=us.map(r=>{const n=this.values[r];return xr(n)||0===n&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(n)}).filter(e=>e);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return 0!==this.years&&(e+=this.years+"Y"),0===this.months&&0===this.quarters||(e+=this.months+3*this.quarters+"M"),0!==this.weeks&&(e+=this.weeks+"W"),0!==this.days&&(e+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(e+="T"),0!==this.hours&&(e+=this.hours+"H"),0!==this.minutes&&(e+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(e+=Vr(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===e&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();if(t<0||t>=864e5)return null;e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1};return ci.fromMillis(t,{zone:"UTC"}).toISOTime(e)}toJSON(){return this.toISO()}toString(){return this.toISO()}[/* @__PURE__ */Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?fs(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=gs.fromDurationLike(e),r={};for(const n of us)(Mr(t.values,n)||Mr(this.values,n))&&(r[n]=t.get(n)+this.get(n));return ds(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const t=gs.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const r of Object.keys(this.values))t[r]=Yr(e(this.values[r],r));return ds(this,{values:t},!0)}get(e){return this[gs.normalizeUnit(e)]}set(e){if(!this.isValid)return this;return ds(this,{values:{...this.values,...Kr(e,gs.normalizeUnit)}})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:n}={}){return ds(this,{loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:n,conversionAccuracy:r})}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return ms(this.matrix,e),ds(this,{values:e},!0)}rescale(){if(!this.isValid)return this;return ds(this,{values:ps(this.normalize().shiftToAll().toObject())},!0)}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>gs.normalizeUnit(e));const t={},r={},n=this.toObject();let s;for(const i of us)if(e.indexOf(i)>=0){s=i;let e=0;for(const t in r)e+=this.matrix[t][i]*r[t],r[t]=0;Cr(n[i])&&(e+=n[i]);const o=Math.trunc(e);t[i]=o,r[i]=(1e3*e-1e3*o)/1e3}else Cr(n[i])&&(r[i]=n[i]);for(const i in r)0!==r[i]&&(t[s]+=i===s?r[i]:r[i]/this.matrix[s][i]);return ms(this.matrix,t),ds(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=0===this.values[t]?0:-this.values[t];return ds(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;return ds(this,{values:ps(this.values)},!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 null===this.invalid}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)return!1;if(!this.loc.equals(e.loc))return!1;function t(e,t){return void 0===e||0===e?void 0===t||0===t:e===t}for(const r of us)if(!t(this.values[r],e.values[r]))return!1;return!0}}const ys="Invalid Interval";class ws{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new Xe("need to specify a reason the Interval is invalid");const r=e instanceof dr?e:new dr(e,t);if(hr.throwOnInvalid)throw new Je(r);return new ws({invalid:r})}static fromDateTimes(e,t){const r=ui(e),n=ui(t),s=function(e,t){return e&&e.isValid?t&&t.isValid?t<e?ws.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:ws.invalid("missing or invalid end"):ws.invalid("missing or invalid start")}(r,n);return null==s?new ws({start:r,end:n}):s}static after(e,t){const r=gs.fromDurationLike(t),n=ui(e);return ws.fromDateTimes(n,n.plus(r))}static before(e,t){const r=gs.fromDurationLike(t),n=ui(e);return ws.fromDateTimes(n.minus(r),n)}static fromISO(e,t){const[r,n]=(e||"").split("/",2);if(r&&n){let e,i,o,a;try{e=ci.fromISO(r,t),i=e.isValid}catch(s){i=!1}try{o=ci.fromISO(n,t),a=o.isValid}catch(s){a=!1}if(i&&a)return ws.fromDateTimes(e,o);if(i){const r=gs.fromISO(n,t);if(r.isValid)return ws.after(e,r)}else if(a){const e=gs.fromISO(r,t);if(e.isValid)return ws.before(o,e)}}return ws.invalid("unparsable",`the input "${e}" 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 null===this.invalidReason}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;const r=this.start.startOf(e,t);let n;return n=t?.useLocaleWeeks?this.end.reconfigure({locale:r.locale}):this.end,n=n.startOf(e,t),Math.floor(n.diff(r,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,e))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return!!this.isValid&&this.s>e}isBefore(e){return!!this.isValid&&this.e<=e}contains(e){return!!this.isValid&&(this.s<=e&&this.e>e)}set({start:e,end:t}={}){return this.isValid?ws.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(ui).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),r=[];let{s:n}=this,s=0;for(;n<this.e;){const e=t[s]||this.e,i=+e>+this.e?this.e:e;r.push(ws.fromDateTimes(n,i)),n=i,s+=1}return r}splitBy(e){const t=gs.fromDurationLike(e);if(!this.isValid||!t.isValid||0===t.as("milliseconds"))return[];let r,{s:n}=this,s=1;const i=[];for(;n<this.e;){const e=this.start.plus(t.mapUnits(e=>e*s));r=+e>+this.e?this.e:e,i.push(ws.fromDateTimes(n,r)),n=r,s+=1}return i}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}abutsEnd(e){return!!this.isValid&&+e.e===+this.s}engulfs(e){return!!this.isValid&&(this.s<=e.s&&this.e>=e.e)}equals(e){return!(!this.isValid||!e.isValid)&&(this.s.equals(e.s)&&this.e.equals(e.e))}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return t>=r?null:ws.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return ws.fromDateTimes(t,r)}static merge(e){const[t,r]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],r)=>t?t.overlaps(r)||t.abutsStart(r)?[e,t.union(r)]:[e.concat([t]),r]:[e,r],[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0;const n=[],s=e.map(e=>[{time:e.s,type:"s"},{time:e.e,type:"e"}]),i=Array.prototype.concat(...s).sort((e,t)=>e.time-t.time);for(const o of i)r+="s"===o.type?1:-1,1===r?t=o.time:(t&&+t!==+o.time&&n.push(ws.fromDateTimes(t,o.time)),t=null);return ws.merge(n)}difference(...e){return ws.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ys}[/* @__PURE__ */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=st,t={}){return this.isValid?gn.create(this.s.loc.clone(t),e).formatInterval(this):ys}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ys}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ys}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ys}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ys}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):gs.invalid(this.invalidReason)}mapEndpoints(e){return ws.fromDateTimes(e(this.s),e(this.e))}}class vs{static hasDST(e=hr.defaultZone){const t=ci.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Pt.isValidZone(e)}static normalizeZone(e){return Kt(e,hr.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Bt.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Bt.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Bt.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:s="gregory"}={}){return(n||Bt.create(t,r,s)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:s="gregory"}={}){return(n||Bt.create(t,r,s)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Bt.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Bt.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Bt.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Bt.create(t,null,"gregory").eras(e)}static features(){return{relative:Nr(),localeWeek:Dr()}}}function Es(e,t){const r=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(t)-r(e);return Math.floor(gs.fromMillis(n).as("days"))}function Ss(e,t,r,n){let[s,i,o,a]=function(e,t,r){const n=[["years",(e,t)=>t.year-e.year],["quarters",(e,t)=>t.quarter-e.quarter+4*(t.year-e.year)],["months",(e,t)=>t.month-e.month+12*(t.year-e.year)],["weeks",(e,t)=>{const r=Es(e,t);return(r-r%7)/7}],["days",Es]],s={},i=e;let o,a;for(const[l,c]of n)r.indexOf(l)>=0&&(o=l,s[l]=c(e,t),a=i.plus(s),a>t?(s[l]--,(e=i.plus(s))>t&&(a=e,s[l]--,e=i.plus(s))):e=a);return[e,s,a,o]}(e,t,r);const l=t-s,c=r.filter(e=>["hours","minutes","seconds","milliseconds"].indexOf(e)>=0);0===c.length&&(o<t&&(o=s.plus({[a]:1})),o!==s&&(i[a]=(i[a]||0)+l/(o-s)));const u=gs.fromObject(i,n);return c.length>0?gs.fromMillis(l,n).shiftTo(...c).plus(u):u}function bs(e,t=e=>e){return{regex:e,deser:([e])=>t(function(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(-1!==e[r].search(Qt.hanidec))t+=er.indexOf(e[r]);else for(const e in Xt){const[r,s]=Xt[e];n>=r&&n<=s&&(t+=n-r)}}return parseInt(t,10)}return t}(e))}}const Ts=`[ ${String.fromCharCode(160)}]`,ks=new RegExp(Ts,"g");function Os(e){return e.replace(/\./g,"\\.?").replace(ks,Ts)}function Fs(e){return e.replace(/\./g,"").replace(ks," ").toLowerCase()}function xs(e,t){return null===e?null:{regex:RegExp(e.map(Os).join("|")),deser:([r])=>e.findIndex(e=>Fs(r)===Fs(e))+t}}function Cs(e,t){return{regex:e,deser:([,e,t])=>Jr(e,t),groups:t}}function Ls(e){return{regex:e,deser:([e])=>e}}const Ns={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"}};let Ds=null;function Ps(e,t){return Array.prototype.concat(...e.map(e=>function(e,t){if(e.literal)return e;const r=Rs(gn.macroTokenToFormatOpts(e.val),t);return null==r||r.includes(void 0)?e:r}(e,t)))}let Ms=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Ps(gn.parseFormat(t),e),this.units=this.tokens.map(t=>function(e,t){const r=rr(t),n=rr(t,"{2}"),s=rr(t,"{3}"),i=rr(t,"{4}"),o=rr(t,"{6}"),a=rr(t,"{1,2}"),l=rr(t,"{1,3}"),c=rr(t,"{1,6}"),u=rr(t,"{1,9}"),h=rr(t,"{2,4}"),d=rr(t,"{4,6}"),f=e=>{return{regex:RegExp((t=e.val,t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([e])=>e,literal:!0};var t},m=(m=>{if(e.literal)return f(m);switch(m.val){case"G":return xs(t.eras("short"),0);case"GG":return xs(t.eras("long"),0);case"y":return bs(c);case"yy":case"kk":return bs(h,Br);case"yyyy":case"kkkk":return bs(i);case"yyyyy":return bs(d);case"yyyyyy":return bs(o);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return bs(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return bs(n);case"MMM":return xs(t.months("short",!0),1);case"MMMM":return xs(t.months("long",!0),1);case"LLL":return xs(t.months("short",!1),1);case"LLLL":return xs(t.months("long",!1),1);case"o":case"S":return bs(l);case"ooo":case"SSS":return bs(s);case"u":return Ls(u);case"uu":return Ls(a);case"uuu":case"E":case"c":return bs(r);case"a":return xs(t.meridiems(),0);case"EEE":return xs(t.weekdays("short",!1),1);case"EEEE":return xs(t.weekdays("long",!1),1);case"ccc":return xs(t.weekdays("short",!0),1);case"cccc":return xs(t.weekdays("long",!0),1);case"Z":case"ZZ":return Cs(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return Cs(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return Ls(/[a-z_+-/]{1,256}?/i);case" ":return Ls(/[^\S\n\r]/);default:return f(m)}})(e)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return m.token=e,m}(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){const[e,t]=[`^${(r=this.units).map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,"")}$`,r];this.regex=RegExp(e,"i"),this.handlers=t}var r}explainFromTokens(e){if(this.isValid){const[t,r]=function(e,t,r){const n=e.match(t);if(n){const e={};let t=1;for(const s in r)if(Mr(r,s)){const i=r[s],o=i.groups?i.groups+1:1;!i.literal&&i.token&&(e[i.token.val[0]]=i.deser(n.slice(t,t+o))),t+=o}return[n,e]}return[n,{}]}(e,this.regex,this.handlers),[n,s,i]=r?function(e){let t,r=null;return xr(e.z)||(r=Pt.create(e.z)),xr(e.Z)||(r||(r=new Jt(e.Z)),t=e.Z),xr(e.q)||(e.M=3*(e.q-1)+1),xr(e.h)||(e.h<12&&1===e.a?e.h+=12:12===e.h&&0===e.a&&(e.h=0)),0===e.G&&e.y&&(e.y=-e.y),xr(e.u)||(e.S=Hr(e.u)),[Object.keys(e).reduce((t,r)=>{const n=(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}})(r);return n&&(t[n]=e[r]),t},{}),r,t]}(r):[null,null,void 0];if(Mr(r,"a")&&Mr(r,"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:r,result:n,zone:s,specificOffset:i}}return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function zs(e,t,r){return new Ms(e,r).explainFromTokens(t)}function Rs(e,t){if(!e)return null;const r=gn.create(t,e).dtFormatter((Ds||(Ds=ci.fromMillis(1555555555555)),Ds)),n=r.formatToParts(),s=r.resolvedOptions();return n.map(t=>function(e,t,r){const{type:n,value:s}=e;if("literal"===n){const e=/^\s+$/.test(s);return{literal:!e,val:e?" ":s}}const i=t[n];let o=n;"hour"===n&&(o=null!=t.hour12?t.hour12?"hour12":"hour24":null!=t.hourCycle?"h11"===t.hourCycle||"h12"===t.hourCycle?"hour12":"hour24":r.hour12?"hour12":"hour24");let a=Ns[o];if("object"==typeof a&&(a=a[i]),a)return{literal:!1,val:a}}(t,e,s))}const As="Invalid DateTime",Is=864e13;function _s(e){return new dr("unsupported zone",`the zone "${e.name}" is not supported`)}function Hs(e){return null===e.weekData&&(e.weekData=Er(e.c)),e.weekData}function Vs(e){return null===e.localWeekData&&(e.localWeekData=Er(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function $s(e,t){const r={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new ci({...r,...t,old:r})}function js(e,t,r){let n=e-60*t*1e3;const s=r.offset(n);if(t===s)return[n,t];n-=60*(s-t)*1e3;const i=r.offset(n);return s===i?[n,s]:[e-60*Math.min(s,i)*1e3,Math.max(s,i)]}function Ws(e,t){const r=new Date(e+=60*t*1e3);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function Us(e,t,r){return js(Ur(e),t,r)}function Zs(e,t){const r=e.o,n=e.c.year+Math.trunc(t.years),s=e.c.month+Math.trunc(t.months)+3*Math.trunc(t.quarters),i={...e.c,year:n,month:s,day:Math.min(e.c.day,Wr(n,s))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},o=gs.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"),a=Ur(i);let[l,c]=js(a,r,e.zone);return 0!==o&&(l+=o,c=e.zone.offset(l)),{ts:l,o:c}}function Gs(e,t,r,n,s,i){const{setZone:o,zone:a}=r;if(e&&0!==Object.keys(e).length||t){const n=t||a,s=ci.fromObject(e,{...r,zone:n,specificOffset:i});return o?s:s.setZone(a)}return ci.invalid(new dr("unparsable",`the input "${s}" can't be parsed as ${n}`))}function Bs(e,t,r=!0){return e.isValid?gn.create(Bt.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(e,t):null}function qs(e,t,r){const n=e.c.year>9999||e.c.year<0;let s="";if(n&&e.c.year>=0&&(s+="+"),s+=Ar(e.c.year,n?6:4),"year"===r)return s;if(t){if(s+="-",s+=Ar(e.c.month),"month"===r)return s;s+="-"}else if(s+=Ar(e.c.month),"month"===r)return s;return s+=Ar(e.c.day),s}function Js(e,t,r,n,s,i,o){let a=!r||0!==e.c.millisecond||0!==e.c.second,l="";switch(o){case"day":case"month":case"year":break;default:if(l+=Ar(e.c.hour),"hour"===o)break;if(t){if(l+=":",l+=Ar(e.c.minute),"minute"===o)break;a&&(l+=":",l+=Ar(e.c.second))}else{if(l+=Ar(e.c.minute),"minute"===o)break;a&&(l+=Ar(e.c.second))}if("second"===o)break;!a||n&&0===e.c.millisecond||(l+=".",l+=Ar(e.c.millisecond,3))}return s&&(e.isOffsetFixed&&0===e.offset&&!i?l+="Z":e.o<0?(l+="-",l+=Ar(Math.trunc(-e.o/60)),l+=":",l+=Ar(Math.trunc(-e.o%60))):(l+="+",l+=Ar(Math.trunc(e.o/60)),l+=":",l+=Ar(Math.trunc(e.o%60)))),i&&(l+="["+e.zone.ianaName+"]"),l}const Ys={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Ks={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Qs={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Xs=["year","month","day","hour","minute","second","millisecond"],ei=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],ti=["year","ordinal","hour","minute","second","millisecond"];function ri(e){const 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 ni(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return ri(e)}}function si(e,t){const r=Kt(t.zone,hr.defaultZone);if(!r.isValid)return ci.invalid(_s(r));const n=Bt.fromObject(t);let s,i;if(xr(e.year))s=hr.now();else{for(const r of Xs)xr(e[r])&&(e[r]=Ys[r]);const t=Or(e)||Fr(e);if(t)return ci.invalid(t);const n=function(e){if(void 0===ai&&(ai=hr.now()),"iana"!==e.type)return e.offset(ai);const t=e.name;let r=li.get(t);return void 0===r&&(r=e.offset(ai),li.set(t,r)),r}(r);[s,i]=Us(e,n,r)}return new ci({ts:s,zone:r,loc:n,o:i})}function ii(e,t,r){const n=!!xr(r.round)||r.round,s=xr(r.rounding)?"trunc":r.rounding,i=(e,i)=>{e=Vr(e,n||r.calendary?0:2,r.calendary?"round":s);return t.loc.clone(r).relFormatter(r).format(e,i)},o=n=>r.calendary?t.hasSame(e,n)?0:t.startOf(n).diff(e.startOf(n),n).get(n):t.diff(e,n).get(n);if(r.unit)return i(o(r.unit),r.unit);for(const a of r.units){const e=o(a);if(Math.abs(e)>=1)return i(e,a)}return i(e>t?-0:0,r.units[r.units.length-1])}function oi(e){let t,r={};return e.length>0&&"object"==typeof e[e.length-1]?(r=e[e.length-1],t=Array.from(e).slice(0,e.length-1)):t=Array.from(e),[r,t]}let ai;const li=/* @__PURE__ */new Map;class ci{constructor(e){const t=e.zone||hr.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new dr("invalid input"):null)||(t.isValid?null:_s(t));this.ts=xr(e.ts)?hr.now():e.ts;let n=null,s=null;if(!r){if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[n,s]=[e.old.c,e.old.o];else{const i=Cr(e.o)&&!e.old?e.o:t.offset(this.ts);n=Ws(this.ts,i),r=Number.isNaN(n.year)?new dr("invalid input"):null,n=r?null:n,s=r?null:i}}this._zone=t,this.loc=e.loc||Bt.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=n,this.o=s,this.isLuxonDateTime=!0}static now(){return new ci({})}static local(){const[e,t]=oi(arguments),[r,n,s,i,o,a,l]=t;return si({year:r,month:n,day:s,hour:i,minute:o,second:a,millisecond:l},e)}static utc(){const[e,t]=oi(arguments),[r,n,s,i,o,a,l]=t;return e.zone=Jt.utcInstance,si({year:r,month:n,day:s,hour:i,minute:o,second:a,millisecond:l},e)}static fromJSDate(e,t={}){const r=(n=e,"[object Date]"===Object.prototype.toString.call(n)?e.valueOf():NaN);var n;if(Number.isNaN(r))return ci.invalid("invalid input");const s=Kt(t.zone,hr.defaultZone);return s.isValid?new ci({ts:r,zone:s,loc:Bt.fromObject(t)}):ci.invalid(_s(s))}static fromMillis(e,t={}){if(Cr(e))return e<-Is||e>Is?ci.invalid("Timestamp out of range"):new ci({ts:e,zone:Kt(t.zone,hr.defaultZone),loc:Bt.fromObject(t)});throw new Xe(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(Cr(e))return new ci({ts:1e3*e,zone:Kt(t.zone,hr.defaultZone),loc:Bt.fromObject(t)});throw new Xe("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const r=Kt(t.zone,hr.defaultZone);if(!r.isValid)return ci.invalid(_s(r));const n=Bt.fromObject(t),s=Kr(e,ni),{minDaysInFirstWeek:i,startOfWeek:o}=kr(s,n),a=hr.now(),l=xr(t.specificOffset)?r.offset(a):t.specificOffset,c=!xr(s.ordinal),u=!xr(s.year),h=!xr(s.month)||!xr(s.day),d=u||h,f=s.weekYear||s.weekNumber;if((d||c)&&f)throw new Ke("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(h&&c)throw new Ke("Can't mix ordinal dates with month/day");const m=f||s.weekday&&!d;let p,g,y=Ws(a,l);m?(p=ei,g=Ks,y=Er(y,i,o)):c?(p=ti,g=Qs,y=br(y)):(p=Xs,g=Ys);let w=!1;for(const O of p){xr(s[O])?s[O]=w?g[O]:y[O]:w=!0}const v=m?function(e,t=4,r=1){const n=Lr(e.weekYear),s=Rr(e.weekNumber,1,Gr(e.weekYear,t,r)),i=Rr(e.weekday,1,7);return n?s?!i&&pr("weekday",e.weekday):pr("week",e.weekNumber):pr("weekYear",e.weekYear)}(s,i,o):c?function(e){const t=Lr(e.year),r=Rr(e.ordinal,1,jr(e.year));return t?!r&&pr("ordinal",e.ordinal):pr("year",e.year)}(s):Or(s),E=v||Fr(s);if(E)return ci.invalid(E);const S=m?Sr(s,i,o):c?Tr(s):s,[b,T]=Us(S,l,r),k=new ci({ts:b,zone:r,o:T,loc:n});return s.weekday&&d&&e.weekday!==k.weekday?ci.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${k.toISO()}`):k.isValid?k:ci.invalid(k.invalid)}static fromISO(e,t={}){const[r,n]=En(e,[Gn,Yn],[Bn,Kn],[qn,Qn],[Jn,Xn]);return Gs(r,n,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[r,n]=En(function(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[Hn,Vn]);return Gs(r,n,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[r,n]=En(e,[$n,Un],[jn,Un],[Wn,Zn]);return Gs(r,n,t,"HTTP",t)}static fromFormat(e,t,r={}){if(xr(e)||xr(t))throw new Xe("fromFormat requires an input string and a format");const{locale:n=null,numberingSystem:s=null}=r,i=Bt.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0}),[o,a,l,c]=function(e,t,r){const{result:n,zone:s,specificOffset:i,invalidReason:o}=zs(e,t,r);return[n,s,i,o]}(i,e,t);return c?ci.invalid(c):Gs(o,a,r,`format ${t}`,e,l)}static fromString(e,t,r={}){return ci.fromFormat(e,t,r)}static fromSQL(e,t={}){const[r,n]=En(e,[ts,Yn],[rs,ns]);return Gs(r,n,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Xe("need to specify a reason the DateTime is invalid");const r=e instanceof dr?e:new dr(e,t);if(hr.throwOnInvalid)throw new qe(r);return new ci({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const r=Rs(e,Bt.fromObject(t));return r?r.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return Ps(gn.parseFormat(e),Bt.fromObject(t)).map(e=>e.val).join("")}static resetCache(){ai=void 0,li.clear()}get(e){return this[e]}get isValid(){return null===this.invalid}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?Hs(this).weekYear:NaN}get weekNumber(){return this.isValid?Hs(this).weekNumber:NaN}get weekday(){return this.isValid?Hs(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Vs(this).weekday:NaN}get localWeekNumber(){return this.isValid?Vs(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Vs(this).weekYear:NaN}get ordinal(){return this.isValid?br(this.c).ordinal:NaN}get monthShort(){return this.isValid?vs.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?vs.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?vs.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?vs.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&&(this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,r=Ur(this.c),n=this.zone.offset(r-e),s=this.zone.offset(r+e),i=this.zone.offset(r-n*t),o=this.zone.offset(r-s*t);if(i===o)return[this];const a=r-i*t,l=r-o*t,c=Ws(a,i),u=Ws(l,o);return c.hour===u.hour&&c.minute===u.minute&&c.second===u.second&&c.millisecond===u.millisecond?[$s(this,{ts:a}),$s(this,{ts:l})]:[this]}get isInLeapYear(){return $r(this.year)}get daysInMonth(){return Wr(this.year,this.month)}get daysInYear(){return this.isValid?jr(this.year):NaN}get weeksInWeekYear(){return this.isValid?Gr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Gr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:r,calendar:n}=gn.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:n}}toUTC(e=0,t={}){return this.setZone(Jt.instance(e),t)}toLocal(){return this.setZone(hr.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if((e=Kt(e,hr.defaultZone)).equals(this.zone))return this;if(e.isValid){let n=this.ts;if(t||r){const t=e.offset(this.ts),r=this.toObject();[n]=Us(r,t,e)}return $s(this,{ts:n,zone:e})}return ci.invalid(_s(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){return $s(this,{loc:this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r})})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Kr(e,ni),{minDaysInFirstWeek:r,startOfWeek:n}=kr(t,this.loc),s=!xr(t.weekYear)||!xr(t.weekNumber)||!xr(t.weekday),i=!xr(t.ordinal),o=!xr(t.year),a=!xr(t.month)||!xr(t.day),l=o||a,c=t.weekYear||t.weekNumber;if((l||i)&&c)throw new Ke("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&i)throw new Ke("Can't mix ordinal dates with month/day");let u;s?u=Sr({...Er(this.c,r,n),...t},r,n):xr(t.ordinal)?(u={...this.toObject(),...t},xr(t.day)&&(u.day=Math.min(Wr(u.year,u.month),u.day))):u=Tr({...br(this.c),...t});const[h,d]=Us(u,this.o,this.zone);return $s(this,{ts:h,o:d})}plus(e){if(!this.isValid)return this;return $s(this,Zs(this,gs.fromDurationLike(e)))}minus(e){if(!this.isValid)return this;return $s(this,Zs(this,gs.fromDurationLike(e).negate()))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const r={},n=gs.normalizeUnit(e);switch(n){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0}if("weeks"===n)if(t){const e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(r.weekNumber=this.weekNumber-1),r.weekday=e}else r.weekday=1;if("quarters"===n){const e=Math.ceil(this.month/3);r.month=3*(e-1)+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?gn.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):As}toLocaleString(e=st,t={}){return this.isValid?gn.create(this.loc.clone(t),e).formatDateTime(this):As}toLocaleParts(e={}){return this.isValid?gn.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:n=!0,extendedZone:s=!1,precision:i="milliseconds"}={}){if(!this.isValid)return null;const o="extended"===e;let a=qs(this,o,i=ri(i));return Xs.indexOf(i)>=3&&(a+="T"),a+=Js(this,o,t,r,n,s,i),a}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?qs(this,"extended"===e,ri(t)):null}toISOWeekDate(){return Bs(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:n=!1,extendedZone:s=!1,format:i="extended",precision:o="milliseconds"}={}){if(!this.isValid)return null;return o=ri(o),(n&&Xs.indexOf(o)>=3?"T":"")+Js(this,"extended"===i,t,e,r,s,o)}toRFC2822(){return Bs(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Bs(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?qs(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let n="HH:mm:ss.SSS";return(t||e)&&(r&&(n+=" "),t?n+="z":e&&(n+="ZZ")),Bs(this,n,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():As}[/* @__PURE__ */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{};const 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",r={}){if(!this.isValid||!e.isValid)return gs.invalid("created by diffing an invalid DateTime");const n={locale:this.locale,numberingSystem:this.numberingSystem,...r},s=(a=t,Array.isArray(a)?a:[a]).map(gs.normalizeUnit),i=e.valueOf()>this.valueOf(),o=Ss(i?this:e,i?e:this,s,n);var a;return i?o.negate():o}diffNow(e="milliseconds",t={}){return this.diff(ci.now(),e,t)}until(e){return this.isValid?ws.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;const n=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t,r)<=n&&n<=s.endOf(t,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||ci.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0;let n=["years","months","days","hours","minutes","seconds"],s=e.unit;return Array.isArray(e.unit)&&(n=e.unit,s=void 0),ii(t,this.plus(r),{...e,numeric:"always",units:n,unit:s})}toRelativeCalendar(e={}){return this.isValid?ii(e.base||ci.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(ci.isDateTime))throw new Xe("min requires all arguments be DateTimes");return Pr(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(ci.isDateTime))throw new Xe("max requires all arguments be DateTimes");return Pr(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,r={}){const{locale:n=null,numberingSystem:s=null}=r;return zs(Bt.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,r={}){return ci.fromFormatExplain(e,t,r)}static buildFormatParser(e,t={}){const{locale:r=null,numberingSystem:n=null}=t,s=Bt.fromOpts({locale:r,numberingSystem:n,defaultToEN:!0});return new Ms(s,e)}static fromFormatParser(e,t,r={}){if(xr(e)||xr(t))throw new Xe("fromFormatParser requires an input string and a format parser");const{locale:n=null,numberingSystem:s=null}=r,i=Bt.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0});if(!i.equals(t.locale))throw new Xe(`fromFormatParser called with a locale of ${i}, but the format parser was created for ${t.locale}`);const{result:o,zone:a,specificOffset:l,invalidReason:c}=t.explainFromTokens(e);return c?ci.invalid(c):Gs(o,a,r,`format ${t.format}`,e,l)}static get DATE_SHORT(){return st}static get DATE_MED(){return it}static get DATE_MED_WITH_WEEKDAY(){return ot}static get DATE_FULL(){return at}static get DATE_HUGE(){return lt}static get TIME_SIMPLE(){return ct}static get TIME_WITH_SECONDS(){return ut}static get TIME_WITH_SHORT_OFFSET(){return ht}static get TIME_WITH_LONG_OFFSET(){return dt}static get TIME_24_SIMPLE(){return ft}static get TIME_24_WITH_SECONDS(){return mt}static get TIME_24_WITH_SHORT_OFFSET(){return pt}static get TIME_24_WITH_LONG_OFFSET(){return gt}static get DATETIME_SHORT(){return yt}static get DATETIME_SHORT_WITH_SECONDS(){return wt}static get DATETIME_MED(){return vt}static get DATETIME_MED_WITH_SECONDS(){return Et}static get DATETIME_MED_WITH_WEEKDAY(){return St}static get DATETIME_FULL(){return bt}static get DATETIME_FULL_WITH_SECONDS(){return Tt}static get DATETIME_HUGE(){return kt}static get DATETIME_HUGE_WITH_SECONDS(){return Ot}}function ui(e){if(ci.isDateTime(e))return e;if(e&&e.valueOf&&Cr(e.valueOf()))return ci.fromJSDate(e);if(e&&"object"==typeof e)return ci.fromObject(e);throw new Xe(`Unknown datetime argument: ${e}, of type ${typeof e}`)}const hi=class e{constructor(){}static constructFromServiceResolver(){return new e}onEvent(t){if(t.getIdentifier()!==e.eventListenerTarget)return;const r=t.getNormalizedValue();if(!(r instanceof Date))return;const n=ci.fromJSDate(r).toFormat("yyyy-MM-dd'T'HH:mm:ssZZ");t.setRawValue(n),t.stopPropagation()}};hi.eventListenerTarget=t.NormalizedValueToRawValueEvent,hi.priority=50;let di=hi;const fi=class e{constructor(){}static constructFromServiceResolver(){return new e}onEvent(t){if(t.getIdentifier()!==e.eventListenerTarget)return;const r=t.getRawValue();if("string"!=typeof r)return;if(!e.dateRegex.test(r))return;const n=new Date(r);t.setNormalizedValue(n),t.stopPropagation()}};fi.eventListenerTarget=t.RawValueToNormalizedValueEvent,fi.priority=50,fi.dateRegex=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\+\d{2}:\d{2}$/;let mi=fi;const pi=class e{constructor(){}static constructFromServiceResolver(){return new e}onEvent(t){if(t.getIdentifier()!==e.eventListenerTarget)return;const r=t.getNormalizedValue();(Array.isArray(r)||"number"==typeof r||"boolean"==typeof r||"string"==typeof r||r instanceof String||null===r)&&(t.setRawValue(r),t.stopPropagation())}};pi.eventListenerTarget=t.NormalizedValueToRawValueEvent,pi.priority=0;let gi=pi;const yi=class e{constructor(){}static constructFromServiceResolver(){return new e}onEvent(t){if(t.getIdentifier()!==e.eventListenerTarget)return;const r=t.getRawValue();(Array.isArray(r)||"number"==typeof r||"boolean"==typeof r||"string"==typeof r||null===r)&&(t.setNormalizedValue(r),t.stopPropagation())}};yi.eventListenerTarget=t.RawValueToNormalizedValueEvent,yi.priority=0;let wi=yi;const vi=class e{constructor(e){this.logger=e,this.token=null,this.apiHost="",this.elementCacheMaxEntries=100,this.collectionCacheMaxEntries=50,this.collectionPageSize=25}static constructFromServiceResolver(t){const r=t.getServiceOrFail(i.logger);return new e(r)}hasToken(){return null!==this.token}getToken(){return this.token}setToken(e){return this.token=e,this}getApiHost(){return this.apiHost}setApiHost(e){return e.endsWith("/")&&(this.logger.warn("Removed trailing slash from API host configuration due to internal requirement. Please check if trailing slash can be directly removed."),e=e.replace(/\/+$/,"")),this.apiHost=e,this}getElementCacheMaxEntries(){return this.elementCacheMaxEntries}setElementCacheMaxEntries(e){return this.elementCacheMaxEntries=e,this}getCollectionCacheMaxEntries(){return this.collectionCacheMaxEntries}setCollectionCacheMaxEntries(e){return this.collectionCacheMaxEntries=e,this}getCollectionPageSize(){return this.collectionPageSize}setCollectionPageSize(e){return this.collectionPageSize=e,this}};vi.identifier=i.serviceApiConfiguration;let Ei=vi;const Si=class e{constructor(e,t,r,n,s,i,o,a,l,c,u,h,d,f,m,p,g,y,w,v,E){this.getElementEndpoint=e,this.getElementChildrenEndpoint=t,this.getElementParentsEndpoint=r,this.getElementRelatedEndpoint=n,this.getIndexEndpoint=s,this.postIndexEndpoint=i,this.postElementEndpoint=o,this.putElementEndpoint=a,this.patchElementEndpoint=l,this.deleteElementEndpoint=c,this.postRegisterEndpoint=u,this.postChangePasswordEndpoint=h,this.getMeEndpoint=d,this.postTokenEndpoint=f,this.getTokenEndpoint=m,this.deleteTokenEndpoint=p,this.elementCache=g,this.elementChildrenCache=y,this.elementParentsCache=w,this.elementRelatedCache=v,this.indexCache=E}static constructFromServiceResolver(t){return new e(t.getServiceOrFail(i.endpointElementGetElementEndpoint),t.getServiceOrFail(i.endpointElementGetElementChildrenEndpoint),t.getServiceOrFail(i.endpointElementGetElementParentsEndpoint),t.getServiceOrFail(i.endpointElementGetElementRelatedEndpoint),t.getServiceOrFail(i.endpointElementGetIndexEndpoint),t.getServiceOrFail(i.endpointElementPostIndexEndpoint),t.getServiceOrFail(i.endpointElementPostElementEndpoint),t.getServiceOrFail(i.endpointElementPutElementEndpoint),t.getServiceOrFail(i.endpointElementPatchElementEndpoint),t.getServiceOrFail(i.endpointElementDeleteElementEndpoint),t.getServiceOrFail(i.endpointUserPostRegisterEndpoint),t.getServiceOrFail(i.endpointUserPostChangePasswordEndpoint),t.getServiceOrFail(i.endpointUserGetMeEndpoint),t.getServiceOrFail(i.endpointUserPostTokenEndpoint),t.getServiceOrFail(i.endpointUserGetTokenEndpoint),t.getServiceOrFail(i.endpointUserDeleteTokenEndpoint),t.getServiceOrFail(i.cacheElement),t.getServiceOrFail(i.cacheElementChildren),t.getServiceOrFail(i.cacheElementParents),t.getServiceOrFail(i.cacheElementRelated),t.getServiceOrFail(i.cacheIndex))}async getElement(e,{forceLoad:t=!1}={}){const r=I.createCacheKey(e),n=this.elementCache.get(r);if(n&&!t)return n.data;if(n){const t=await this.getElementEndpoint.getElement(e,n.etag);return"data"in t?(this.elementCache.setFromParsedResponse(r,t),t.data):(this.elementCache.refresh(r),n.data)}const s=await this.getElementEndpoint.getElement(e);return this.elementCache.setFromParsedResponse(r,s),s.data}async getElementChildren(e,{page:t=1,pageSize:r=25,forceLoad:n=!1}={}){const s=H.createCacheKey(e,t,r),i=this.elementChildrenCache.get(s);if(i&&!n)return i.data;if(i){const n=await this.getElementChildrenEndpoint.getElementChildren(e,t,r,i.etag);return"data"in n?(this.elementChildrenCache.setFromParsedResponse(s,n),this.elementCache.setFromCollection(n.data),n.data):(this.elementChildrenCache.refresh(s),i.data)}const o=await this.getElementChildrenEndpoint.getElementChildren(e,t,r);return this.elementChildrenCache.setFromParsedResponse(s,o),this.elementCache.setFromCollection(o.data),o.data}async getElementParents(e,{page:t=1,pageSize:r=25,forceLoad:n=!1}={}){const s=$.createCacheKey(e,t,r),i=this.elementParentsCache.get(s);if(i&&!n)return i.data;if(i){const n=await this.getElementParentsEndpoint.getElementParents(e,t,r,i.etag);return"data"in n?(this.elementParentsCache.setFromParsedResponse(s,n),this.elementCache.setFromCollection(n.data),n.data):(this.elementParentsCache.refresh(s),i.data)}const o=await this.getElementParentsEndpoint.getElementParents(e,t,r);return this.elementParentsCache.setFromParsedResponse(s,o),this.elementCache.setFromCollection(o.data),o.data}async getElementRelated(e,{page:t=1,pageSize:r=25,forceLoad:n=!1}={}){const s=W.createCacheKey(e,t,r),i=this.elementRelatedCache.get(s);if(i&&!n)return i.data;if(i){const n=await this.getElementRelatedEndpoint.getElementRelated(e,t,r,i.etag);return"data"in n?(this.elementRelatedCache.setFromParsedResponse(s,n),this.elementCache.setFromCollection(n.data),n.data):(this.elementRelatedCache.refresh(s),i.data)}const o=await this.getElementRelatedEndpoint.getElementRelated(e,t,r);return this.elementRelatedCache.setFromParsedResponse(s,o),this.elementCache.setFromCollection(o.data),o.data}async getIndex({page:e=1,pageSize:t=25,forceLoad:r=!1}={}){const n=Z.createCacheKey(e,t),s=this.indexCache.get(n);if(s&&!r)return s.data;if(s){const r=await this.getIndexEndpoint.getIndex(e,t,s.etag);return"data"in r?(this.indexCache.setFromParsedResponse(n,r),this.elementCache.setFromCollection(r.data),r.data):(this.indexCache.refresh(n),s.data)}const i=await this.getIndexEndpoint.getIndex(e,t);return this.indexCache.setFromParsedResponse(n,i),this.elementCache.setFromCollection(i.data),i.data}async postIndex(e){return(await this.postIndexEndpoint.postIndex(e)).data}async postElement(e,t){return(await this.postElementEndpoint.postElement(e,t)).data}async putElement(e,t){await this.putElementEndpoint.putElement(e,t),this.elementCache.delete(I.createCacheKey(e))}async patchElement(e,t){await this.patchElementEndpoint.patchElement(e,t),this.elementCache.delete(I.createCacheKey(e))}async deleteElement(e){await this.deleteElementEndpoint.deleteElement(e),this.elementCache.delete(I.createCacheKey(e))}async postRegister(e,t,r={}){return(await this.postRegisterEndpoint.postRegister(e,t,r)).data}async postChangePassword(e,t,r){await this.postChangePasswordEndpoint.postChangePassword(e,t,r)}async getMe(){const e=(await this.getMeEndpoint.getMe()).data;return this.elementCache.setFromDataEtag(I.createCacheKey(e.id),e),e}async postToken(e,t,r={}){return(await this.postTokenEndpoint.postToken(e,t,r)).data}async getToken(){const e=(await this.getTokenEndpoint.getToken()).data;return this.elementCache.setFromDataEtag(I.createCacheKey(e.id),e),e}async deleteToken(){await this.deleteTokenEndpoint.deleteToken()}};Si.identifier=i.serviceApiWrapper;let bi=Si;const Ti=class e{constructor(e){this.elementParser=e}static constructFromServiceResolver(t){const r=t.getServiceOrFail(i.serviceElementParser);return new e(r)}async deserializeCollection(e){if(!("id"in e))throw new Error("Raw collection must contain property 'id' in order to be parsed to a collection.");const t=String(e.id);if(!("totalNodes"in e))throw new Error("Raw collection must contain property 'totalNodes' in order to be parsed to a collection.");const r=Number(e.totalNodes);if(!("links"in e))throw new Error("Raw collection must contain property 'links' in order to be parsed to a collection.");if("object"!=typeof e.links||null===e.links)throw new Error("Links property in raw collection must be of type object.");const n=e.links;if(!("first"in n))throw new Error("Raw collection must contain property 'links.first' in order to be parsed to a collection.");const s=String(n.first);if(!("previous"in n))throw new Error("Raw collection must contain property 'links.previous' in order to be parsed to a collection.");const i=null===n.previous?null:String(n.previous);if(!("next"in n))throw new Error("Raw collection must contain property 'links.next' in order to be parsed to a collection.");const o=null===n.next?null:String(n.next);if(!("last"in n))throw new Error("Raw collection must contain property 'links.last' in order to be parsed to a collection.");const a=String(n.last);if(!("nodes"in e))throw new Error("Raw collection must contain property 'nodes' in order to be parsed to a collection.");if(!Array.isArray(e.nodes))throw new Error("Nodes property in raw collection must be of type array.");const l=[];for(const u of e.nodes)l.push(await this.elementParser.deserializeElement(u));if(!("relations"in e))throw new Error("Raw collection must contain property 'relations' in order to be parsed to a collection.");if(!Array.isArray(e.relations))throw new Error("Relations property in raw collection must be of type array.");const c=[];for(const u of e.relations)c.push(await this.elementParser.deserializeElement(u));return{id:t,totalNodes:r,links:{first:s,previous:i,next:o,last:a},nodes:l,relations:c}}};Ti.identifier=i.serviceCollectionParser;let ki=Ti;const Oi=class e{constructor(e){this.eventDispatcher=e}static constructFromServiceResolver(t){const r=t.getServiceOrFail(i.serviceEventDispatcher);return new e(r)}async deserializeElement(e){if(!("id"in e))throw new Error("Raw element must contain property 'id' in order to be parsed to a node or relation.");const t=Ve(String(e.id));if(!("type"in e))throw new Error("Raw element must contain property 'type' in order to be parsed to a node or relation.");const r=String(e.type);if(!("data"in e))throw new Error("Raw element must contain property 'data' in order to be parsed to a node or relation.");const n=e.data;for(const s in n){const e=new Ze(n[s]);if(await this.eventDispatcher.dispatchEvent(e),!e.isPropagationStopped())throw new Error(`Unable to deserialize property "${s}".`);n[s]=e.getNormalizedValue()}if("start"in e&&"end"in e){return{id:t,start:Ve(String(e.start)),end:Ve(String(e.end)),type:r,data:n}}return{id:t,type:r,data:n}}};Oi.identifier=i.serviceElementParser;let Fi=Oi;const xi=class e{constructor(e){this.logger=e,this.isSilent=!0,this.eventListenerTargets=/* @__PURE__ */new Map}static constructFromServiceResolver(t){const r=t.getServiceOrFail(i.logger);return new e(r)}setSilent(e){return this.isSilent=e,this}async dispatchEvent(e){if(this.isSilent||this.logger.debug(`Dispatching event of identifier ${e.getIdentifier()}.`,{event:e}),e.isPropagationStopped())return void(this.isSilent||this.logger.debug("Stopped event propagation because it is already stopped.",{event:e}));const t=Pe(e.getIdentifier());for(let n=0;n<t.length;++n){const s=t[n],i=this.eventListenerTargets.get(s);if(void 0!==i){this.isSilent||this.logger.debug(`Iterating over resolved event listeners of identifier ${s}`,{event:e});for(let t=i.length-1;t>=0;t--){try{await Promise.resolve(i[t].eventListener.onEvent(e))}catch(r){this.logger.error("Event handler threw exception, dispatcher continues with next event listener.",{event:e,error:r})}if(e.isPropagationStopped())return void(this.isSilent||this.logger.debug("Stopped event propagation as it got stopped.",{event:e}))}}}this.isSilent||this.logger.debug("Event got handled by all event listeners.",{event:e})}addListener(e,t,r){let n;void 0===r&&(r=0),n=this.eventListenerTargets.has(e)?this.eventListenerTargets.get(e):[];let s=0,i=n.length-1,o=-1;for(;s<=i;){const e=Math.floor((s+i)/2);n[e].priority>=r?(o=e,i=e-1):s=e+1}const a=-1===o?s:o;return n.splice(a,0,{priority:r,eventListener:t}),this.eventListenerTargets.set(e,n),this}removeListener(e,t){const r=this.eventListenerTargets.get(e);if(!r)return this;for(let n=0;n<r.length;++n)if(r[n].eventListener===t){r.splice(n,1);break}return 0===r.length&&this.eventListenerTargets.delete(e),this}getListeners(e){const t=this.eventListenerTargets.get(e);return t?t.map(e=>e.eventListener):[]}hasListeners(e){return this.eventListenerTargets.has(e)}};xi.identifier=i.serviceEventDispatcher;let Ci=xi;const Li=class e{constructor(e,t){this.logger=e,this.apiConfiguration=t}static constructFromServiceResolver(t){const r=t.getServiceOrFail(i.logger),n=t.getServiceOrFail(i.serviceApiConfiguration);return new e(r,n)}rethrowErrorAsNetworkError(e){if(e instanceof f)throw e;throw new p("Network error occurred during fetch.",e)}logAndThrowError(e){const t=e instanceof Error?e:new Error(String(e));throw this.logger.error(t.message,t),t}async parseJsonResponse(e){const t=e.headers.get("Content-Type");if(!t)return Promise.reject(new g("Response does not contain a Content-Type header."));if(!t.includes("application/json")&&!t.includes("application/problem+json"))return Promise.reject(new g(`Unexpected Content-Type: "${t}". Expected JSON-compatible format.`));const r=await e.json().catch(e=>{throw new g(`Failed to parse response body as JSON: ${e}`)});if(!e.ok)throw this.createResponseErrorFromBadResponse(e,r);return r}async parseEmptyResponse(e){if(e.ok&&204===e.status)return;const t=e.headers.get("Content-Type");if(null===t)throw new g("Response does not contain content type header.");if(!t.includes("application/problem+json"))throw new g("Unable to parse response as content type is not 'application/problem+json'.");const r=await e.json().catch(e=>{throw new g(`Failed to parse response body as JSON: ${e}`)});throw this.createResponseErrorFromBadResponse(e,r)}parseLocationResponse(e){if(e.ok&&(201===e.status||204===e.status)&&e.headers.has("Location")){const t=e.headers.get("Location").split("/").at(-1);return Promise.resolve(Ve(t))}const t=e.headers.get("Content-Type");return null===t?Promise.reject(new g("Response does not contain content type header.")):t.includes("application/problem+json")?e.json().catch(e=>{throw new g(`Failed to parse response body as JSON: ${e}`)}).then(t=>{throw this.createResponseErrorFromBadResponse(e,t)}):Promise.reject(new g("Unable to parse response as content type is not 'application/problem+json'."))}createResponseErrorFromBadResponse(e,t){let r=null;return 401===e.status&&(r=new w("Server returned 401 unauthorized.")),403===e.status&&(r=new v("Server returned 403 forbidden.")),404===e.status&&(r=new E("Server returned 404 not found.")),429===e.status&&(r=new S("Server returned 429 too many requests.")),null===r&&(r=new y("Generic response error.")),"type"in t&&r.setType(String(t.type)),"title"in t&&r.setTitle(String(t.title)),"detail"in t&&r.setDetail(String(t.detail)),"status"in t&&null===r.getStatus()&&r.setStatus(Number(t.status)),r}addAuthorizationHeader(e){this.apiConfiguration.hasToken()&&(e.Authorization=`Bearer ${this.apiConfiguration.getToken()}`)}addAcceptJsonAndProblemJsonHeader(e){e.Accept="application/json, application/problem+json"}addIfNoneMatchHeader(e,t){e["If-None-Match"]=t}addContentTypeJsonHeader(e){e["Content-Type"]="application/json"}getDefaultGetOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),void 0!==e&&this.addIfNoneMatchHeader(t,e),{method:r.GET,headers:t,redirect:"follow",referrerPolicy:"no-referrer",cache:"no-store"}}getDefaultDeleteOptions(){const e={};return this.addAuthorizationHeader(e),this.addAcceptJsonAndProblemJsonHeader(e),{method:r.DELETE,headers:e,redirect:"follow",referrerPolicy:"no-referrer"}}getDefaultPostOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),this.addContentTypeJsonHeader(t),{method:r.POST,headers:t,redirect:"follow",referrerPolicy:"no-referrer",body:e}}getDefaultPatchOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),this.addContentTypeJsonHeader(t),{method:r.PATCH,headers:t,redirect:"follow",referrerPolicy:"no-referrer",body:e}}getDefaultPutOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),this.addContentTypeJsonHeader(t),{method:r.PUT,headers:t,redirect:"follow",referrerPolicy:"no-referrer",body:e}}buildUrl(e){return`${this.apiConfiguration.getApiHost()}${e}`}runWrappedFetch(e,t){return e=`${this.apiConfiguration.getApiHost()}${e}`,this.logger.debug(`Executing HTTP ${t?.method??"-"} request against url ${e} .`),fetch(e,t)}};Li.identifier=i.serviceFetchHelper;let Ni=Li;class Di{constructor(){this.services=/* @__PURE__ */new Map}createServiceProxy(e){let t=e;return{proxy:new Proxy({},{get(e,r,n){const s=Reflect.get(t,r,n);return"function"==typeof s?s.bind(t):s},set:(e,r,n)=>Reflect.set(t,r,n),has:(e,r)=>r in t,ownKeys:()=>Reflect.ownKeys(t),getOwnPropertyDescriptor(e,r){const n=Object.getOwnPropertyDescriptor(t,r);if(n)return{...n,configurable:!0}},defineProperty:(e,r,n)=>Reflect.defineProperty(t,r,n),getPrototypeOf:()=>Object.getPrototypeOf(t)}),targetReplaceFunction(e){t=e}}}hasService(e){return this.services.has(String(e))}getService(e){const t=this.services.get(String(e));return void 0===t?null:t.proxy}getServiceOrFail(e){const t=this.services.get(String(e));if(void 0===t)throw new Error(`Requested service with identifier ${String(e)} could not be resolved.`);return t.proxy}setService(e,t){let r=this.services.get(String(e));return void 0===r?(r=this.createServiceProxy(t),this.services.set(String(e),r),this):(r.targetReplaceFunction(t),this)}deleteService(e){return this.services.delete(String(e)),this}getServiceIdentifiers(){return[...this.services.keys()]}getServices(){return[...this.services.values()].map(e=>e.proxy)}clearServices(){return this.services.clear(),this}}const Pi=class e{constructor(){}static constructFromServiceResolver(){return new e}rawTokenToToken(e){if(!("type"in e))throw new Error("Raw token must contain property 'type' in order to be parsed to a token.");if("_TokenResponse"!==String(e.type))throw new Error("Type must be '_TokenResponse' in order to be parsed to a token.");if(!("token"in e))throw new Error("Raw token must contain property 'token' in order to be parsed to a token.");return _e(String(e.token))}};Pi.identifier=i.serviceTokenParser;let Mi=Pi;const zi=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,ApiConfiguration:Ei,ApiWrapper:bi,CollectionParser:ki,ElementParser:Fi,EventDispatcher:Ci,FetchHelper:Ni,Logger:class{constructor(e){this.logger=e}debug(...e){return this.logger.debug(e)}error(...e){return this.logger.error(e)}info(...e){return this.logger.info(e)}warn(...e){return this.logger.warn(e)}},ServiceResolver:Di,TokenParser:Mi},Symbol.toStringTag,{value:"Module"}));function Ri(e){const t=e.getServiceOrFail(Ci.identifier),r=[di,mi,gi,wi];for(let n=0;n<r.length;n++)t.addListener(r[n].eventListenerTarget,r[n].constructFromServiceResolver(),r[n].priority)}const Ai=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,DateTimeNormalizedValueToRawValueEventListener:di,DateTimeRawValueToNormalizedValueEventListener:mi,GenericNormalizedValueToRawValueEventListener:gi,GenericRawValueToNormalizedValueEventListener:wi,initEventListener:Ri},Symbol.toStringTag,{value:"Module"}));const Ii={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]};function _i(e,t,r,n=!1){const s=String(t),i=(e,t)=>`[${t[0]}m${e}[${t[1]}m`,o=(e,t)=>null!=t&&"string"==typeof t?i(e,Ii[t]):null!=t&&Array.isArray(t)?t.reduce((e,t)=>o(e,t),e):null!=t&&null!=t[e.trim()]?o(e,t[e.trim()]):null!=t&&null!=t["*"]?o(e,t["*"]):e;return s.replace(/{{(.+?)}}/g,(t,s)=>{const a=null!=r[s]?String(r[s]):n?"":t;return e.stylePrettyLogs?o(a,e?.prettyLogStyles?.[s]??null)+i("",Ii.reset):a})}function Hi(e,t=2,r=0){return null!=e&&isNaN(e)?"":(e=null!=e?e+r:e,2===t?null==e?"--":e<10?"0"+e:e.toString():null==e?"---":e<10?"00"+e:e<100?"0"+e:e.toString())}function Vi(e,t){if(null==t)return{text:"",template:e.prettyLogTemplate,placeholders:{}};let r=e.prettyLogTemplate;const n={};r.includes("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}")?r=r.replace("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}","{{dateIsoStr}}"):"UTC"===e.prettyLogTimeZone?(n.yyyy=t.date?.getUTCFullYear()??"----",n.mm=Hi(t.date?.getUTCMonth(),2,1),n.dd=Hi(t.date?.getUTCDate(),2),n.hh=Hi(t.date?.getUTCHours(),2),n.MM=Hi(t.date?.getUTCMinutes(),2),n.ss=Hi(t.date?.getUTCSeconds(),2),n.ms=Hi(t.date?.getUTCMilliseconds(),3)):(n.yyyy=t.date?.getFullYear()??"----",n.mm=Hi(t.date?.getMonth(),2,1),n.dd=Hi(t.date?.getDate(),2),n.hh=Hi(t.date?.getHours(),2),n.MM=Hi(t.date?.getMinutes(),2),n.ss=Hi(t.date?.getSeconds(),2),n.ms=Hi(t.date?.getMilliseconds(),3));const s="UTC"===e.prettyLogTimeZone?t.date:null!=t.date?new Date(t.date.getTime()-6e4*t.date.getTimezoneOffset()):void 0;n.rawIsoStr=s?.toISOString()??"",n.dateIsoStr=s?.toISOString().replace("T"," ").replace("Z","")??"",n.logLevelName=t.logLevelName,n.fileNameWithLine=t.path?.fileNameWithLine??"",n.filePathWithLine=t.path?.filePathWithLine??"",n.fullFilePath=t.path?.fullFilePath??"";let i=e.parentNames?.join(e.prettyErrorParentNamesSeparator);i=null!=i&&null!=t.name?i+e.prettyErrorParentNamesSeparator:void 0;const o=null!=t.name||null!=i?`${i??""}${t.name??""}`:"";return n.name=o,n.nameWithDelimiterPrefix=o.length>0?e.prettyErrorLoggerNameDelimiter+o:"",n.nameWithDelimiterSuffix=o.length>0?o+e.prettyErrorLoggerNameDelimiter:"",null!=e.overwrite?.addPlaceholders&&e.overwrite.addPlaceholders(t,n),{text:_i(e,r,n),template:r,placeholders:n}}const $i=[/(?:^|[\\/])node_modules[\\/].*tslog/i,/(?:^|[\\/])deps[\\/].*tslog/i,/tslog[\\/]+src[\\/]+internal[\\/]/i,/tslog[\\/]+src[\\/]BaseLogger/i,/tslog[\\/]+src[\\/]index/i];function ji(e,t){return function(e,t){const r=[];for(const n of e){const e=t(n);null!=e&&r.push(e)}return r}(function(e){return t=function(e){const t="string"==typeof e?.stack?e.stack:void 0;return null==t||0===t.length?[]:t.split("\n").map(e=>e.trimEnd())}(e),t.filter(e=>e.length>0&&!/^\s*Error\b/.test(e));var t}(e),t)}function Wi(e,t){return e<0?0:e>=t?Math.max(0,t-1):e}function Ui(){return[...$i]}function Zi(e){if(e instanceof Error)return e;const t=new Error("string"==typeof e?e:JSON.stringify(e));return"object"==typeof e&&null!=e&&Object.assign(t,e),t}function Gi(e){const t=/* @__PURE__ */new Set;return JSON.stringify(e,(e,r)=>{if("object"==typeof r&&null!==r){if(t.has(r))return"[Circular]";t.add(r)}return"bigint"==typeof r?`${r}`:void 0===r?"[undefined]":r})}function Bi(e,t){const r={seen:[],stylize:Ji};return null!=t&&uo(r,t),qi(r.showHidden)&&(r.showHidden=!1),qi(r.depth)&&(r.depth=2),qi(r.colors)&&(r.colors=!0),qi(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=Yi),ao(r,e,r.depth)}function qi(e){return void 0===e}function Ji(e){return e}function Yi(e,t){const r=Bi.styles[t];return null!=r&&null!=Bi?.colors?.[r]?.[0]&&null!=Bi?.colors?.[r]?.[1]?"["+Bi.colors[r][0]+"m"+e+"["+Bi.colors[r][1]+"m":e}function Ki(e){return"function"==typeof e}function Qi(e){return"string"==typeof e}function Xi(e){return null===e}function eo(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function to(e){return ro(e)&&"[object RegExp]"===io(e)}function ro(e){return"object"==typeof e&&null!==e}function no(e){return ro(e)&&("[object Error]"===io(e)||e instanceof Error)}function so(e){return ro(e)&&"[object Date]"===io(e)}function io(e){return Object.prototype.toString.call(e)}function oo(e){return"["+Error.prototype.toString.call(e)+"]"}function ao(e,t,r=0){if(e.customInspect&&null!=t&&Ki(t)&&t?.inspect!==Bi&&(!t?.constructor||t?.constructor.prototype!==t)){if("function"!=typeof t.inspect&&null!=t.toString)return t.toString();let n=t?.inspect(r,e);return Qi(n)||(n=ao(e,n,r)),n}const n=co(e,t);if(n)return n;let s=Object.keys(t);const i=function(e){const t={};return e.forEach(e=>{t[e]=!0}),t}(s);try{e.showHidden&&Object.getOwnPropertyNames&&(s=Object.getOwnPropertyNames(t))}catch{}if(no(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return oo(t);if(0===s.length){if(!Ki(e.stylize))return t;if(Ki(t)){const r=t.name?": "+t.name:"";return e.stylize("[Function"+r+"]","special")}if(to(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(so(t))return e.stylize(Date.prototype.toISOString.call(t),"date");if(no(t))return oo(t)}let o,a="",l=!1,c=["{\n","\n}"];if(Array.isArray(t)&&(l=!0,c=["[\n","\n]"]),Ki(t)){a=" [Function"+(t.name?": "+t.name:"")+"]"}return to(t)&&(a=" "+RegExp.prototype.toString.call(t)),so(t)&&(a=" "+Date.prototype.toUTCString.call(t)),no(t)&&(a=" "+oo(t)),0!==s.length||l&&0!=t.length?r<0?to(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),o=l?function(e,t,r,n,s){const i=[];for(let o=0,a=t.length;o<a;++o)eo(t,String(o))?i.push(lo(e,t,r,n,String(o),!0)):i.push("");return s.forEach(s=>{s.match(/^\d+$/)||i.push(lo(e,t,r,n,s,!0))}),i}(e,t,r,i,s):s.map(n=>lo(e,t,r,i,n,l)),e.seen.pop(),function(e,t,r){return r[0]+(""===t?"":t+"\n")+" "+e.join(",\n ")+" "+r[1]}(o,a,c)):c[0]+a+c[1]}function lo(e,t,r,n,s,i){let o,a,l={value:void 0};try{l.value=t[s]}catch{}try{Object.getOwnPropertyDescriptor&&(l=Object.getOwnPropertyDescriptor(t,s)||l)}catch{}if(l.get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),eo(n,s)||(o="["+s+"]"),a||(e.seen.indexOf(l.value)<0?(a=Xi(r)?ao(e,l.value,void 0):ao(e,l.value,r-1),a.indexOf("\n")>-1&&(a=i?a.split("\n").map(e=>" "+e).join("\n").substr(2):"\n"+a.split("\n").map(e=>" "+e).join("\n"))):a=e.stylize("[Circular]","special")),qi(o)){if(i&&s.match(/^\d+$/))return a;o=JSON.stringify(""+s),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,"\\'").replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function co(e,t){if(qi(t))return e.stylize("undefined","undefined");if(Qi(t)){const r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,"\\'")+"'";return e.stylize(r,"string")}return"number"==typeof t?e.stylize(""+t,"number"):function(e){return"boolean"==typeof e}(t)?e.stylize(""+t,"boolean"):Xi(t)?e.stylize("null","null"):void 0}function uo(e,t){const r={...e};if(!t||!ro(t))return e;const n={...t},s=Object.keys(t);let i=s.length;for(;i--;)r[s[i]]=n[s[i]];return r}function ho(){return"undefined"!=typeof window&&"undefined"!=typeof document}Bi.colors=Ii,Bi.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};const fo=/\u001b\[[0-9;]*m/g,mo={black:"#000000",red:"#ef5350",green:"#66bb6a",yellow:"#fdd835",blue:"#42a5f5",magenta:"#ab47bc",cyan:"#26c6da",white:"#fafafa",blackBright:"#424242",redBright:"#ff7043",greenBright:"#81c784",yellowBright:"#ffe082",blueBright:"#64b5f6",magentaBright:"#ce93d8",cyanBright:"#4dd0e1",whiteBright:"#ffffff"},po={bgBlack:"#000000",bgRed:"#ef5350",bgGreen:"#66bb6a",bgYellow:"#fdd835",bgBlue:"#42a5f5",bgMagenta:"#ab47bc",bgCyan:"#26c6da",bgWhite:"#fafafa",bgBlackBright:"#424242",bgRedBright:"#ff7043",bgGreenBright:"#81c784",bgYellowBright:"#ffe082",bgBlueBright:"#64b5f6",bgMagentaBright:"#ce93d8",bgCyanBright:"#4dd0e1",bgWhiteBright:"#ffffff"},go=/(?:(?:file|https?|global code|[^@]+)@)?(?:file:)?((?:\/[^:/]+){2,})(?::(\d+))?(?::(\d+))?/,yo=function(){const e=function(){if(ho()){const e=globalThis.navigator;return{name:"browser",userAgent:e?.userAgent}}const e=globalThis;if("function"==typeof e.importScripts)return{name:"worker",userAgent:e.navigator?.userAgent};const t=globalThis;if(null!=t.Bun){const e=t.Bun.version;return{name:"bun",version:null!=e?`bun/${e}`:void 0,hostname:m(t.process,t.Deno,t.Bun,t.location)}}if(null!=t.Deno){const e=function(e){try{if("function"==typeof e?.hostname){const t=e.hostname();if(null!=t&&t.length>0)return t}}catch{}const t=globalThis.location?.hostname;if(null!=t&&t.length>0)return t;return}(t.Deno),r=t.Deno?.version?.deno;return{name:"deno",version:null!=r?`deno/${r}`:void 0,hostname:e??m(t.process,t.Deno,t.Bun,t.location)}}if(null!=t.process?.versions?.node||null!=t.process?.version)return{name:"node",version:t.process?.versions?.node??t.process?.version,hostname:m(t.process,t.Deno,t.Bun,t.location)};if(null!=t.process)return{name:"node",version:"unknown",hostname:m(t.process,t.Deno,t.Bun,t.location)};return{name:"unknown"}}(),t=function(t){if("browser"===t.name||"worker"===t.name)return{runtime:t.name,browser:t.userAgent};const r={runtime:t.name};"node"!==e.name&&"deno"!==e.name&&"bun"!==e.name||(r.runtimeVersion=t.version??"unknown");"node"!==e.name&&"deno"!==e.name&&"bun"!==e.name||(r.hostname=t.hostname??"unknown");return r}(e),r="browser"===e.name||"worker"===e.name,n=r?[...Ui(),/node_modules[\\/].*tslog/i]:[...Ui(),/node:(?:internal|vm)/i,/\binternal[\\/]/i];let s;const i={getMeta:(e,r,n,s,o,a)=>Object.assign({},t,{name:o,parentNames:a,date:/* @__PURE__ */new Date,logLevelId:e,logLevelName:r,path:s?void 0:i.getCallerStackFrame(n)}),getCallerStackFrame(e,t=new Error){const r=ji(t,e=>o(e));if(0===r.length)return{};const s=function(e,t=$i){for(let r=0;r<e.length;r+=1){const n=e[r],s=n.filePath??"",i=n.fullFilePath??"";if(!t.some(e=>e.test(s)||e.test(i)))return r}return 0}(r,n);return r[Wi(Number.isFinite(e)&&e>=0?e:s,r.length)]??{}},getErrorTrace:e=>ji(e,e=>o(e)),isError:e=>function(e){if(e instanceof Error)return!0;if(null!=e&&"object"==typeof e){const t=Object.prototype.toString.call(e);if(/\[object .*Error\]/.test(t))return!0;const r=e.name;if("string"==typeof r&&r.endsWith("Error"))return!0}return!1}(e),isBuffer:e=>"undefined"!=typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e),prettyFormatLogObj:(e,t)=>e.reduce((e,r)=>(i.isError(r)?e.errors.push(i.prettyFormatErrorObj(r,t)):e.args.push(r),e),{args:[],errors:[]}),prettyFormatErrorObj(e,t){const r=a(i.getErrorTrace(e),t),n=function(e,t={}){const r=t.maxDepth??5,n=[],s=/* @__PURE__ */new Set;let i=e,o=0;for(;null!=i&&o<r;){const e=i?.cause;if(null==e||s.has(e))break;s.add(e),n.push(Zi(e)),i=e,o+=1}return n}(e).map((e,r)=>[`Caused by (${r+1}): ${e.name??"Error"}${e.message?`: ${e.message}`:""}`,...a(ji(e,e=>o(e)),t)].join("\n")),s={errorName:` ${e.name} `,errorMessage:l(e),errorStack:[...r,...n].join("\n")};return _i(t,t.prettyErrorTemplate,s)},transportFormatted(t,r,n,s,i){const o=!1!==i.stylePrettyLogs,a=(n.length>0&&r.length>0?"\n":"")+n.join("\n"),l=t.replace(fo,"");const h=o?t:l;if(function(t){return t&&("browser"===e.name||"worker"===e.name)&&function(){if(!ho())return!1;const e=globalThis?.navigator,t=e?.userAgent??"";if(/firefox/i.test(t))return!0;const r=globalThis;return!!r?.CSS?.supports?.("color","#000")||/safari/i.test(t)&&!/chrome/i.test(t)}()}(o)){i.prettyInspectOptions.colors=!1;const e=d(i.prettyInspectOptions,r),t=null!=s?function(e,t){if(null==t)return{text:"",styles:[]};const{template:r,placeholders:n}=Vi(e,t),s=[],i=[];let o=0;const a=/{{(.+?)}}/g;let l;for(;null!=(l=a.exec(r));){l.index>o&&s.push(r.slice(o,l.index));const t=l[1],h=null!=n[t]?String(n[t]):"",d=u(c(e.prettyLogStyles?.[t],h));d.length>0?(s.push(`%c${h}%c`),i.push(d,"")):s.push(h),o=a.lastIndex}o<r.length&&s.push(r.slice(o));return{text:s.join(""),styles:i}}(i,s):{text:l,styles:[]},n=t.text.length>0&&t.styles.length>0,o=(n?t.text:l)+e+a;return void(n?console.log(o,...t.styles):console.log(o))}i.prettyInspectOptions.colors=o;const f=d(i.prettyInspectOptions,r);console.log(h+f+a)},transportJSON(e){console.log(Gi(e))}};return"test"===function(){const e=globalThis?.process;return e?.env?.NODE_ENV}()&&(i.__resetWorkingDirectoryCacheForTests=()=>{s=void 0}),i;function o(e){return r?function(e){const t=globalThis.location?.origin;if(null==e)return;const r=e.match(go);if(!r)return;const n=r[1]?.replace(/\?.*$/,"");if(null==n)return;const s=n.split("/"),i=r[2],o=r[3],a=s[s.length-1];return{fullFilePath:t?`${t}${n}`:n,fileName:a,fileNameWithLine:a&&i?`${a}:${i}`:void 0,fileColumn:o,fileLine:i,filePath:n,filePathWithLine:i?`${n}:${i}`:void 0,method:void 0}}(e):function(e){if("string"!=typeof e||0===e.length)return;const t=e.trim();if(!t.includes(" at ")&&!t.startsWith("at "))return;const r=t.replace(/^at\s+/,"");let n,i=r;const o=r.match(/^(.*?)\s+\((.*)\)$/);o&&(n=o[1],i=o[2]);const a=i.replace(/^\(/,"").replace(/\)$/,""),l=a.replace(/\?.*$/,"");let c,u,h=l;const d=l.split(":");d.length>=3&&/^\d+$/.test(d[d.length-1]??"")?(u=d.pop(),c=d.pop(),h=d.join(":")):d.length>=2&&/^\d+$/.test(d[d.length-1]??"")&&(c=d.pop(),h=d.join(":"));let f=h.replace(/^file:\/\//,"");const m=function(){void 0===s&&(s=function(){try{const e=globalThis?.process;if("function"==typeof e?.cwd)return e.cwd()}catch{}try{const e=globalThis?.Deno;if("function"==typeof e?.cwd)return e.cwd()}catch{}}()??null);return s??void 0}();null!=m&&f.startsWith(m)&&(f=f.slice(m.length),f=f.replace(/^[\\/]/,""));0===f.length&&(f=h);const p=function(e){if("string"!=typeof e||0===e.length)return e;const t=e.replace(/\\+/g,"\\").replace(/\\/g,"/"),r=t.startsWith("//"),n=t.startsWith("/")&&!r,s=t.match(/^[A-Za-z]:/),i=s?s[0]:"",o=(i?t.slice(i.length):t).split("/"),a=[];for(const c of o)""!==c&&"."!==c&&(".."!==c?a.push(c):a.length>0&&a.pop());let l=a.join("/");r?l=`//${l}`:n?l=`/${l}`:""!==i&&(l=`${i}${l.length>0?`/${l}`:""}`);if(0===l.length)return e;return l}(f),g=p.length>0?p:f,y=g.split(/\\|\//),w=y[y.length-1];return{fullFilePath:a,fileName:w,fileNameWithLine:w&&c?`${w}:${c}`:void 0,fileColumn:u,fileLine:c,filePath:g,filePathWithLine:g&&c?`${g}:${c}`:void 0,method:n}}(e)}function a(e,t){return e.map(e=>_i(t,t.prettyErrorStackTemplate,{...e},!0))}function l(e){return Object.getOwnPropertyNames(e).filter(e=>"stack"!==e&&"cause"!==e).reduce((t,r)=>{const n=e[r];return"function"==typeof n||t.push(String(n)),t},[]).join(", ")}function c(e,t){if(null==e)return[];if("string"==typeof e)return[e];if(Array.isArray(e))return e.flatMap(e=>c(e,t));if("object"==typeof e){const r=e[t.trim()]??e["*"];return null==r?[]:c(r,t)}return[]}function u(e){const t=/* @__PURE__ */new Set,r=[];for(const n of e){const e=h(n);null!=e&&e.length>0&&!t.has(e)&&(t.add(e),r.push(e))}return r.join("; ")}function h(e){const t=mo[e];if(null!=t)return`color: ${t}`;const r=po[e];if(null!=r)return`background-color: ${r}`;switch(e){case"bold":return"font-weight: bold";case"dim":return"opacity: 0.75";case"italic":return"font-style: italic";case"underline":return"text-decoration: underline";case"overline":return"text-decoration: overline";case"inverse":return"filter: invert(1)";case"hidden":return"visibility: hidden";case"strikethrough":return"text-decoration: line-through";default:return}}function d(e,t){try{return function(e,...t){const r={seen:[],stylize:Ji};null!=e&&uo(r,e);const n=t[0];let s=0,i="",o="";if("string"==typeof n){if(1===t.length)return n;let a,l=0;for(let o=0;o<n.length-1;o++)if(37===n.charCodeAt(o)){const c=n.charCodeAt(++o);if(s+1!==t.length){switch(c){case 115:{const n=t[++s];a="number"==typeof n||"bigint"==typeof n?co(r,n):"object"!=typeof n||null===n?String(n):Bi(n,{...e,compact:3,colors:!1,depth:0});break}case 106:a=Gi(t[++s]);break;case 100:{const e=t[++s];a="bigint"==typeof e?co(r,e):"symbol"==typeof e?"NaN":co(r,e);break}case 79:a=Bi(t[++s],e);break;case 111:a=Bi(t[++s],{...e,showHidden:!0,showProxy:!0,depth:4});break;case 105:{const e=t[++s];a="bigint"==typeof e?co(r,e):"symbol"==typeof e?"NaN":co(r,parseInt(a));break}case 102:{const e=t[++s];a="symbol"==typeof e?"NaN":co(r,parseInt(e));break}case 99:s+=1,a="";break;case 37:i+=n.slice(l,o),l=o+1;continue;default:continue}l!==o-1&&(i+=n.slice(l,o-1)),i+=a,l=o+1}else 37===c&&(i+=n.slice(l,o),l=o+1)}0!==l&&(s++,o=" ",l<n.length&&(i+=n.slice(l)))}for(;s<t.length;){const r=t[s];i+=o,i+="string"!=typeof r?Bi(r,e):r,o=" ",s++}return i}(e,...t)}catch{return t.map(f).join(" ")}}function f(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch{return String(e)}}function m(e,t,r,n){const s=e?.env?.HOSTNAME??e?.env?.HOST??e?.env?.COMPUTERNAME;if(null!=s&&s.length>0)return s;const i=r?.env?.HOSTNAME??r?.env?.HOST??r?.env?.COMPUTERNAME;if(null!=i&&i.length>0)return i;try{const e=t?.env?.get;if("function"==typeof e){const t=e("HOSTNAME");if(null!=t&&t.length>0)return t}}catch{}return null!=n?.hostname&&n.hostname.length>0?n.hostname:void 0}}();class wo{constructor(e,t,r=Number.NaN){this.logObj=t,this.stackDepthLevel=r,this.runtime=yo,this.maxErrorCauseDepth=5,this.settings={type:e?.type??"pretty",name:e?.name,parentNames:e?.parentNames,minLevel:e?.minLevel??0,argumentsArrayName:e?.argumentsArrayName,hideLogPositionForProduction:e?.hideLogPositionForProduction??!1,prettyLogTemplate:e?.prettyLogTemplate??"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}\t{{logLevelName}}\t{{filePathWithLine}}{{nameWithDelimiterPrefix}}\t",prettyErrorTemplate:e?.prettyErrorTemplate??"\n{{errorName}} {{errorMessage}}\nerror stack:\n{{errorStack}}",prettyErrorStackTemplate:e?.prettyErrorStackTemplate??" • {{fileName}}\t{{method}}\n\t{{filePathWithLine}}",prettyErrorParentNamesSeparator:e?.prettyErrorParentNamesSeparator??":",prettyErrorLoggerNameDelimiter:e?.prettyErrorLoggerNameDelimiter??"\t",stylePrettyLogs:e?.stylePrettyLogs??!0,prettyLogTimeZone:e?.prettyLogTimeZone??"UTC",prettyLogStyles:e?.prettyLogStyles??{logLevelName:{"*":["bold","black","bgWhiteBright","dim"],SILLY:["bold","white"],TRACE:["bold","whiteBright"],DEBUG:["bold","green"],INFO:["bold","blue"],WARN:["bold","yellow"],ERROR:["bold","red"],FATAL:["bold","redBright"]},dateIsoStr:"white",filePathWithLine:"white",name:["white","bold"],nameWithDelimiterPrefix:["white","bold"],nameWithDelimiterSuffix:["white","bold"],errorName:["bold","bgRedBright","whiteBright"],fileName:["yellow"],fileNameWithLine:"white"},prettyInspectOptions:e?.prettyInspectOptions??{colors:!0,compact:!1,depth:1/0},metaProperty:e?.metaProperty??"_meta",maskPlaceholder:e?.maskPlaceholder??"[***]",maskValuesOfKeys:e?.maskValuesOfKeys??["password"],maskValuesOfKeysCaseInsensitive:e?.maskValuesOfKeysCaseInsensitive??!1,maskValuesRegEx:e?.maskValuesRegEx,prefix:[...e?.prefix??[]],attachedTransports:[...e?.attachedTransports??[]],overwrite:{mask:e?.overwrite?.mask,toLogObj:e?.overwrite?.toLogObj,addMeta:e?.overwrite?.addMeta,addPlaceholders:e?.overwrite?.addPlaceholders,formatMeta:e?.overwrite?.formatMeta,formatLogObj:e?.overwrite?.formatLogObj,transportFormatted:e?.overwrite?.transportFormatted,transportJSON:e?.overwrite?.transportJSON}},this.captureStackForMeta=this._shouldCaptureStack()}log(e,t,...r){if(e<this.settings.minLevel)return;const n=this._resolveLogArguments(r),s=[...this.settings.prefix,...n],i=null!=this.settings.overwrite?.mask?this.settings.overwrite?.mask(s):null!=this.settings.maskValuesOfKeys&&this.settings.maskValuesOfKeys.length>0?this._mask(s):s,o=null!=this.logObj?this._recursiveCloneAndExecuteFunctions(this.logObj):void 0,a=null!=this.settings.overwrite?.toLogObj?this.settings.overwrite?.toLogObj(i,o):this._toLogObj(i,o),l=null!=this.settings.overwrite?.addMeta?this.settings.overwrite?.addMeta(a,e,t):this._addMetaToLogObj(a,e,t),c=l?.[this.settings.metaProperty];let u,h;if(null!=this.settings.overwrite?.formatMeta&&(u=this.settings.overwrite?.formatMeta(l?.[this.settings.metaProperty])),null!=this.settings.overwrite?.formatLogObj&&(h=this.settings.overwrite?.formatLogObj(i,this.settings)),"pretty"===this.settings.type&&(u=u??this._prettyFormatLogObjMeta(l?.[this.settings.metaProperty]),h=h??yo.prettyFormatLogObj(i,this.settings)),null!=u&&null!=h)if(null!=this.settings.overwrite?.transportFormatted){const e=this.settings.overwrite.transportFormatted,t=e.length;t<4?e(u,h.args,h.errors):4===t?e(u,h.args,h.errors,c):e(u,h.args,h.errors,c,this.settings)}else yo.transportFormatted(u,h.args,h.errors,c,this.settings);else null!=this.settings.overwrite?.transportJSON?this.settings.overwrite.transportJSON(l):"hidden"!==this.settings.type&&yo.transportJSON(l);return null!=this.settings.attachedTransports&&this.settings.attachedTransports.length>0&&this.settings.attachedTransports.forEach(e=>{e(l)}),l}attachTransport(e){this.settings.attachedTransports.push(e)}getSubLogger(e,t){const r={...this.settings,...e,parentNames:null!=this.settings?.parentNames&&null!=this.settings?.name?[...this.settings.parentNames,this.settings.name]:null!=this.settings?.name?[this.settings.name]:void 0,prefix:[...this.settings.prefix,...e?.prefix??[]]};return new this.constructor(r,t??this.logObj,this.stackDepthLevel)}_mask(e){const t=this._getMaskKeys();return e?.map(e=>this._recursiveCloneAndMaskValuesOfKeys(e,t))}_getMaskKeys(){const e=this.settings.maskValuesOfKeys??[],t=e.map(String).join("|");if(!0===this.settings.maskValuesOfKeysCaseInsensitive){if(this.maskKeysCache?.source===e&&!0===this.maskKeysCache.caseInsensitive&&this.maskKeysCache.signature===t)return this.maskKeysCache.normalized;const r=e.map(e=>"string"==typeof e?e.toLowerCase():String(e).toLowerCase());return this.maskKeysCache={source:e,caseInsensitive:!0,normalized:r,signature:t},r}return this.maskKeysCache={source:e,caseInsensitive:!1,normalized:e,signature:t},e}_resolveLogArguments(e){if(1===e.length&&"function"==typeof e[0]){const t=e[0];if(0===t.length){const e=t();return Array.isArray(e)?e:[e]}}return e}_recursiveCloneAndMaskValuesOfKeys(e,t,r=[]){if(r.includes(e))return{...e};if("object"==typeof e&&null!==e&&r.push(e),yo.isError(e)||yo.isBuffer(e))return e;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(Array.isArray(e))return e.map(e=>this._recursiveCloneAndMaskValuesOfKeys(e,t,r));if(e instanceof Date)return new Date(e.getTime());if(e instanceof URL)return{href:(n=e).href,protocol:n.protocol,username:n.username,password:n.password,host:n.host,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search,searchParams:[...n.searchParams].map(([e,t])=>({key:e,value:t})),hash:n.hash,origin:n.origin};if(null!==e&&"object"==typeof e){const n=yo.isError(e)?this._cloneError(e):Object.create(Object.getPrototypeOf(e));return Object.getOwnPropertyNames(e).reduce((n,s)=>{const i=!0!==this.settings?.maskValuesOfKeysCaseInsensitive?s:"string"==typeof s?s.toLowerCase():String(s).toLowerCase();return n[s]=t.includes(i)?this.settings.maskPlaceholder:(()=>{try{return this._recursiveCloneAndMaskValuesOfKeys(e[s],t,r)}catch{return null}})(),n},n)}if("string"==typeof e){let t=e;for(const e of this.settings?.maskValuesRegEx||[])t=t.replace(e,this.settings?.maskPlaceholder||"");return t}return e;var n}_recursiveCloneAndExecuteFunctions(e,t=[]){return this.isObjectOrArray(e)&&t.includes(e)?this.shallowCopy(e):(this.isObjectOrArray(e)&&t.push(e),Array.isArray(e)?e.map(e=>this._recursiveCloneAndExecuteFunctions(e,t)):e instanceof Date?new Date(e.getTime()):this.isObject(e)?Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=Object.getOwnPropertyDescriptor(e,n);if(s){Object.defineProperty(r,n,s);const i=e[n];r[n]="function"==typeof i?i():this._recursiveCloneAndExecuteFunctions(i,t)}return r},Object.create(Object.getPrototypeOf(e))):e)}isObjectOrArray(e){return"object"==typeof e&&null!==e}isObject(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}shallowCopy(e){return Array.isArray(e)?[...e]:{...e}}_toLogObj(e,t={}){return e=e?.map(e=>yo.isError(e)?this._toErrorObject(e):e),t=null==this.settings.argumentsArrayName?1!==e.length||Array.isArray(e[0])||!0===yo.isBuffer(e[0])||e[0]instanceof Date?{...t,...e}:"object"==typeof e[0]&&null!=e[0]?{...e[0],...t}:{0:e[0],...t}:{...t,[this.settings.argumentsArrayName]:e}}_cloneError(e){const t=new e.constructor;return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=e[r]}),t}_toErrorObject(e,t=0,r=/* @__PURE__ */new Set){r.has(e)||r.add(e);const n={nativeError:e,name:e.name??"Error",message:e.message,stack:yo.getErrorTrace(e)};if(t>=this.maxErrorCauseDepth)return n;const s=e.cause;if(null!=s){const e=Zi(s);r.has(e)||(n.cause=this._toErrorObject(e,t+1,r))}return n}_addMetaToLogObj(e,t,r){return{...e,[this.settings.metaProperty]:yo.getMeta(t,r,this.stackDepthLevel,!this.captureStackForMeta,this.settings.name,this.settings.parentNames)}}_shouldCaptureStack(){if(this.settings.hideLogPositionForProduction)return!1;if("json"===this.settings.type)return!0;const e=this.settings.prettyLogTemplate??"";return!!/{{\s*(file(Name|Path|Line|PathWithLine|NameWithLine)|fullFilePath)\s*}}/.test(e)}_prettyFormatLogObjMeta(e){return Vi(this.settings,e).text}}class vo extends wo{constructor(e,t){const r={...e??{}};"undefined"!=typeof window&&"undefined"!=typeof document&&(r.stylePrettyLogs=e?.stylePrettyLogs??!0),super(r,t,Number.NaN)}log(e,t,...r){return super.log(e,t,...r)}silly(...e){return super.log(0,"SILLY",...e)}trace(...e){return super.log(1,"TRACE",...e)}debug(...e){return super.log(2,"DEBUG",...e)}info(...e){return super.log(3,"INFO",...e)}warn(...e){return super.log(4,"WARN",...e)}error(...e){return super.log(5,"ERROR",...e)}fatal(...e){return super.log(6,"FATAL",...e)}getSubLogger(e,t){return super.getSubLogger(e,t)}}function Eo(t){const r=new Di;r.setService(i.action,new Me),r.setService(i.setting,new ze),r.setService(i.icon,new ze);const n=new vo({name:"app-core",type:"pretty"});r.setService(i.logger,n);const s=[Ci,Fi,ki,Mi,Ei,Ni,q,Q,Y,ee,re,se,oe,le,ue,de,pe,ye,ve,Se,Te,Oe,I,H,$,W,Z,bi];for(let e=0;e<s.length;e++)r.setService(s[e].identifier,s[e].constructFromServiceResolver(r));return Ri(r),t.addEventListener(e.GetServiceResolver,e=>{e.setServiceResolver(r),e.stopPropagation()}),r}const So=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,Definition:$e,Enum:o,Partial:l},Symbol.toStringTag,{value:"Module"}));export{h as BrowserEvent,d as BrowserEventListener,G as Cache,xe as Endpoint,T as Error,Ge as Event,Ai as EventListener,zi as Service,So as Type,Eo as init};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|