@design.estate/dees-comms 1.1.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
- var Cp=Object.create;var Uo=Object.defineProperty;var _p=Object.getOwnPropertyDescriptor;var Rp=Object.getOwnPropertyNames;var Np=Object.getPrototypeOf,Wp=Object.prototype.hasOwnProperty;var i=(r,e)=>Uo(r,"name",{value:e,configurable:!0});var nt=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},A=(r,e)=>{for(var t in e)Uo(r,t,{get:e[t],enumerable:!0})},Fp=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Rp(e))!Wp.call(r,n)&&n!==t&&Uo(r,n,{get:()=>e[n],enumerable:!(o=_p(e,n))||o.enumerable});return r};var or=(r,e,t)=>(t=r!=null?Cp(Np(r)):{},Fp(e||!r||!r.__esModule?Uo(t,"default",{value:r,enumerable:!0}):t,r));var Us=nt(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0}),Ao.uni=void 0;var zp=i((r="uni")=>`${r}_${"xxxxxxxxxxxxxxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}`,"uni");Ao.uni=zp});var rd=nt((Sa,Ma)=>{(function(r,e){typeof Sa=="object"&&typeof Ma<"u"?Ma.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self).dayjs=e()})(Sa,(function(){"use strict";var r=1e3,e=6e4,t=36e5,o="millisecond",n="second",s="minute",a="hour",u="day",c="week",f="month",l="quarter",p="year",m="date",h="Invalid Date",x=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:i(function(k){var D=["th","st","nd","rd"],b=k%100;return"["+k+(D[(b-20)%10]||D[b]||D[0])+"]"},"ordinal")},v=i(function(k,D,b){var E=String(k);return!E||E.length>=D?k:""+Array(D+1-E.length).join(b)+k},"m"),G={s:v,z:i(function(k){var D=-k.utcOffset(),b=Math.abs(D),E=Math.floor(b/60),T=b%60;return(D<=0?"+":"-")+v(E,2,"0")+":"+v(T,2,"0")},"z"),m:i(function k(D,b){if(D.date()<b.date())return-k(b,D);var E=12*(b.year()-D.year())+(b.month()-D.month()),T=D.clone().add(E,f),C=b-T<0,_=D.clone().add(E+(C?-1:1),f);return+(-(E+(b-T)/(C?T-_:_-T))||0)},"t"),a:i(function(k){return k<0?Math.ceil(k)||0:Math.floor(k)},"a"),p:i(function(k){return{M:f,y:p,w:c,d:u,D:m,h:a,m:s,s:n,ms:o,Q:l}[k]||String(k||"").toLowerCase().replace(/s$/,"")},"p"),u:i(function(k){return k===void 0},"u")},te="en",ae={};ae[te]=w;var rt="$isDayjsObject",Qe=i(function(k){return k instanceof Ho||!(!k||!k[rt])},"S"),tr=i(function k(D,b,E){var T;if(!D)return te;if(typeof D=="string"){var C=D.toLowerCase();ae[C]&&(T=C),b&&(ae[C]=b,T=C);var _=D.split("-");if(!T&&_.length>1)return k(_[0])}else{var $=D.name;ae[$]=D,T=$}return!E&&T&&(te=T),T||!E&&te},"t"),re=i(function(k,D){if(Qe(k))return k.clone();var b=typeof D=="object"?D:{};return b.date=k,b.args=arguments,new Ho(b)},"O"),q=G;q.l=tr,q.i=Qe,q.w=function(k,D){return re(k,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var Ho=(function(){function k(b){this.$L=tr(b.locale,null,!0),this.parse(b),this.$x=this.$x||b.x||{},this[rt]=!0}i(k,"M");var D=k.prototype;return D.parse=function(b){this.$d=(function(E){var T=E.date,C=E.utc;if(T===null)return new Date(NaN);if(q.u(T))return new Date;if(T instanceof Date)return new Date(T);if(typeof T=="string"&&!/Z$/i.test(T)){var _=T.match(x);if(_){var $=_[2]-1||0,K=(_[7]||"0").substring(0,3);return C?new Date(Date.UTC(_[1],$,_[3]||1,_[4]||0,_[5]||0,_[6]||0,K)):new Date(_[1],$,_[3]||1,_[4]||0,_[5]||0,_[6]||0,K)}}return new Date(T)})(b),this.init()},D.init=function(){var b=this.$d;this.$y=b.getFullYear(),this.$M=b.getMonth(),this.$D=b.getDate(),this.$W=b.getDay(),this.$H=b.getHours(),this.$m=b.getMinutes(),this.$s=b.getSeconds(),this.$ms=b.getMilliseconds()},D.$utils=function(){return q},D.isValid=function(){return this.$d.toString()!==h},D.isSame=function(b,E){var T=re(b);return this.startOf(E)<=T&&T<=this.endOf(E)},D.isAfter=function(b,E){return re(b)<this.startOf(E)},D.isBefore=function(b,E){return this.endOf(E)<re(b)},D.$g=function(b,E,T){return q.u(b)?this[E]:this.set(T,b)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(b,E){var T=this,C=!!q.u(E)||E,_=q.p(b),$=i(function(Pt,ve){var ot=q.w(T.$u?Date.UTC(T.$y,ve,Pt):new Date(T.$y,ve,Pt),T);return C?ot:ot.endOf(u)},"l"),K=i(function(Pt,ve){return q.w(T.toDate()[Pt].apply(T.toDate("s"),(C?[0,0,0,0]:[23,59,59,999]).slice(ve)),T)},"$"),oe=this.$W,fe=this.$M,ke=this.$D,rr="set"+(this.$u?"UTC":"");switch(_){case p:return C?$(1,0):$(31,11);case f:return C?$(1,fe):$(0,fe+1);case c:var It=this.$locale().weekStart||0,Kr=(oe<It?oe+7:oe)-It;return $(C?ke-Kr:ke+(6-Kr),fe);case u:case m:return K(rr+"Hours",0);case a:return K(rr+"Minutes",1);case s:return K(rr+"Seconds",2);case n:return K(rr+"Milliseconds",3);default:return this.clone()}},D.endOf=function(b){return this.startOf(b,!1)},D.$set=function(b,E){var T,C=q.p(b),_="set"+(this.$u?"UTC":""),$=(T={},T[u]=_+"Date",T[m]=_+"Date",T[f]=_+"Month",T[p]=_+"FullYear",T[a]=_+"Hours",T[s]=_+"Minutes",T[n]=_+"Seconds",T[o]=_+"Milliseconds",T)[C],K=C===u?this.$D+(E-this.$W):E;if(C===f||C===p){var oe=this.clone().set(m,1);oe.$d[$](K),oe.init(),this.$d=oe.set(m,Math.min(this.$D,oe.daysInMonth())).$d}else $&&this.$d[$](K);return this.init(),this},D.set=function(b,E){return this.clone().$set(b,E)},D.get=function(b){return this[q.p(b)]()},D.add=function(b,E){var T,C=this;b=Number(b);var _=q.p(E),$=i(function(fe){var ke=re(C);return q.w(ke.date(ke.date()+Math.round(fe*b)),C)},"y");if(_===f)return this.set(f,this.$M+b);if(_===p)return this.set(p,this.$y+b);if(_===u)return $(1);if(_===c)return $(7);var K=(T={},T[s]=e,T[a]=t,T[n]=r,T)[_]||1,oe=this.$d.getTime()+b*K;return q.w(oe,this)},D.subtract=function(b,E){return this.add(-1*b,E)},D.format=function(b){var E=this,T=this.$locale();if(!this.isValid())return T.invalidDate||h;var C=b||"YYYY-MM-DDTHH:mm:ssZ",_=q.z(this),$=this.$H,K=this.$m,oe=this.$M,fe=T.weekdays,ke=T.months,rr=T.meridiem,It=i(function(ve,ot,Qr,jo){return ve&&(ve[ot]||ve(E,C))||Qr[ot].slice(0,jo)},"h"),Kr=i(function(ve){return q.s($%12||12,ve,"0")},"d"),Pt=rr||function(ve,ot,Qr){var jo=ve<12?"AM":"PM";return Qr?jo.toLowerCase():jo};return C.replace(g,(function(ve,ot){return ot||(function(Qr){switch(Qr){case"YY":return String(E.$y).slice(-2);case"YYYY":return q.s(E.$y,4,"0");case"M":return oe+1;case"MM":return q.s(oe+1,2,"0");case"MMM":return It(T.monthsShort,oe,ke,3);case"MMMM":return It(ke,oe);case"D":return E.$D;case"DD":return q.s(E.$D,2,"0");case"d":return String(E.$W);case"dd":return It(T.weekdaysMin,E.$W,fe,2);case"ddd":return It(T.weekdaysShort,E.$W,fe,3);case"dddd":return fe[E.$W];case"H":return String($);case"HH":return q.s($,2,"0");case"h":return Kr(1);case"hh":return Kr(2);case"a":return Pt($,K,!0);case"A":return Pt($,K,!1);case"m":return String(K);case"mm":return q.s(K,2,"0");case"s":return String(E.$s);case"ss":return q.s(E.$s,2,"0");case"SSS":return q.s(E.$ms,3,"0");case"Z":return _}return null})(ve)||_.replace(":","")}))},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(b,E,T){var C,_=this,$=q.p(E),K=re(b),oe=(K.utcOffset()-this.utcOffset())*e,fe=this-K,ke=i(function(){return q.m(_,K)},"D");switch($){case p:C=ke()/12;break;case f:C=ke();break;case l:C=ke()/3;break;case c:C=(fe-oe)/6048e5;break;case u:C=(fe-oe)/864e5;break;case a:C=fe/t;break;case s:C=fe/e;break;case n:C=fe/r;break;default:C=fe}return T?C:q.a(C)},D.daysInMonth=function(){return this.endOf(f).$D},D.$locale=function(){return ae[this.$L]},D.locale=function(b,E){if(!b)return this.$L;var T=this.clone(),C=tr(b,E,!0);return C&&(T.$L=C),T},D.clone=function(){return q.w(this.$d,this)},D.toDate=function(){return new Date(this.valueOf())},D.toJSON=function(){return this.isValid()?this.toISOString():null},D.toISOString=function(){return this.$d.toISOString()},D.toString=function(){return this.$d.toUTCString()},k})(),Tu=Ho.prototype;return re.prototype=Tu,[["$ms",o],["$s",n],["$m",s],["$H",a],["$W",u],["$M",f],["$y",p],["$D",m]].forEach((function(k){Tu[k[1]]=function(D){return this.$g(D,k[0],k[1])}})),re.extend=function(k,D){return k.$i||(k(D,Ho,re),k.$i=!0),re},re.locale=tr,re.isDayjs=Qe,re.unix=function(k){return re(1e3*k)},re.en=ae[te],re.Ls=ae,re.p={},re}))});var od=nt((Oa,Ea)=>{(function(r,e){typeof Oa=="object"&&typeof Ea<"u"?Ea.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self).dayjs_plugin_isToday=e()})(Oa,(function(){"use strict";return function(r,e,t){e.prototype.isToday=function(){var o="YYYY-MM-DD",n=t();return this.format(o)===n.format(o)}}}))});var ad=nt((kte,sd)=>{"use strict";sd.exports=class{static{i(this,"SymbolTreeNode")}constructor(){this.parent=null,this.previousSibling=null,this.nextSibling=null,this.firstChild=null,this.lastChild=null,this.childrenVersion=0,this.childIndexCachedUpTo=null,this.cachedIndex=-1,this.cachedIndexVersion=NaN}get isAttached(){return!!(this.parent||this.previousSibling||this.nextSibling)}get hasChildren(){return!!this.firstChild}childrenChanged(){this.childrenVersion=this.childrenVersion+1&4294967295,this.childIndexCachedUpTo=null}getCachedIndex(e){return this.cachedIndexVersion!==e.childrenVersion?(this.cachedIndexVersion=NaN,-1):this.cachedIndex}setCachedIndex(e,t){this.cachedIndexVersion=e.childrenVersion,this.cachedIndex=t}}});var cd=nt((Pte,ud)=>{"use strict";ud.exports=Object.freeze({DISCONNECTED:1,PRECEDING:2,FOLLOWING:4,CONTAINS:8,CONTAINED_BY:16})});var md=nt((Cte,pd)=>{"use strict";var fd=Symbol(),ld=Symbol(),Tt=Symbol(),dd=Symbol(),Le=class{static{i(this,"TreeIterator")}constructor(e,t,o,n){this[fd]=e,this[ld]=t,this[Tt]=o,this[dd]=n}next(){let e=this[fd],t=this[dd],o=this[ld];if(!this[Tt])return{done:!0,value:o};let n=this[Tt];return t===1?this[Tt]=e._node(n).previousSibling:t===2?this[Tt]=e._node(n).nextSibling:t===3?this[Tt]=e._node(n).parent:t===4?this[Tt]=e.preceding(n,{root:o}):this[Tt]=e.following(n,{root:o}),{done:!1,value:n}}};Object.defineProperty(Le.prototype,Symbol.iterator,{value:i(function(){return this},"value"),writable:!1}),Le.PREV=1,Le.NEXT=2,Le.PARENT=3,Le.PRECEDING=4,Le.FOLLOWING=5,Object.freeze(Le),Object.freeze(Le.prototype),pd.exports=Le});var yd=nt((Rte,hd)=>{"use strict";var ig=ad(),Dt=cd(),Ne=md();function Wa(){return!0}i(Wa,"returnTrue");function Nr(r,e){return r[r.length-1-e]}i(Nr,"reverseArrayIndex");var as=class{static{i(this,"SymbolTree")}constructor(e){this.symbol=Symbol(e||"SymbolTree data")}initialize(e){return this._node(e),e}_node(e){if(!e)return null;let t=e[this.symbol];return t||(e[this.symbol]=new ig)}hasChildren(e){return this._node(e).hasChildren}firstChild(e){return this._node(e).firstChild}lastChild(e){return this._node(e).lastChild}previousSibling(e){return this._node(e).previousSibling}nextSibling(e){return this._node(e).nextSibling}parent(e){return this._node(e).parent}lastInclusiveDescendant(e){let t,o=e;for(;t=this._node(o).lastChild;)o=t;return o}preceding(e,t){let o=t&&t.root;if(e===o)return null;let n=this._node(e).previousSibling;return n?this.lastInclusiveDescendant(n):this._node(e).parent}following(e,t){let o=t&&t.root,s=!(t&&t.skipChildren)&&this._node(e).firstChild;if(s)return s;let a=e;do{if(a===o)return null;let u=this._node(a).nextSibling;if(u)return u;a=this._node(a).parent}while(a);return null}childrenToArray(e,t){let o=t&&t.array||[],n=t&&t.filter||Wa,s=t&&t.thisArg||void 0,a=this._node(e),u=a.firstChild,c=0;for(;u;){let f=this._node(u);f.setCachedIndex(a,c),n.call(s,u)&&o.push(u),u=f.nextSibling,++c}return o}ancestorsToArray(e,t){let o=t&&t.array||[],n=t&&t.filter||Wa,s=t&&t.thisArg||void 0,a=e;for(;a;)n.call(s,a)&&o.push(a),a=this._node(a).parent;return o}treeToArray(e,t){let o=t&&t.array||[],n=t&&t.filter||Wa,s=t&&t.thisArg||void 0,a=e;for(;a;)n.call(s,a)&&o.push(a),a=this.following(a,{root:e});return o}childrenIterator(e,t){let o=t&&t.reverse,n=this._node(e);return new Ne(this,e,o?n.lastChild:n.firstChild,o?Ne.PREV:Ne.NEXT)}previousSiblingsIterator(e){return new Ne(this,e,this._node(e).previousSibling,Ne.PREV)}nextSiblingsIterator(e){return new Ne(this,e,this._node(e).nextSibling,Ne.NEXT)}ancestorsIterator(e){return new Ne(this,e,e,Ne.PARENT)}treeIterator(e,t){let o=t&&t.reverse;return new Ne(this,e,o?this.lastInclusiveDescendant(e):e,o?Ne.PRECEDING:Ne.FOLLOWING)}index(e){let t=this._node(e),o=this._node(t.parent);if(!o)return-1;let n=t.getCachedIndex(o);if(n>=0)return n;n=0;let s=o.firstChild;if(o.childIndexCachedUpTo){let a=this._node(o.childIndexCachedUpTo);s=a.nextSibling,n=a.getCachedIndex(o)+1}for(;s;){let a=this._node(s);if(a.setCachedIndex(o,n),s===e)break;++n,s=a.nextSibling}return o.childIndexCachedUpTo=e,n}childrenCount(e){let t=this._node(e);return t.lastChild?this.index(t.lastChild)+1:0}compareTreePosition(e,t){if(e===t)return 0;let o=[];{let l=e;for(;l;){if(l===t)return Dt.CONTAINS|Dt.PRECEDING;o.push(l),l=this.parent(l)}}let n=[];{let l=t;for(;l;){if(l===e)return Dt.CONTAINED_BY|Dt.FOLLOWING;n.push(l),l=this.parent(l)}}let s=Nr(o,0);if(!s||s!==Nr(n,0))return Dt.DISCONNECTED;let a=0,u=Math.min(o.length,n.length);for(let l=0;l<u;++l){let p=Nr(o,l),m=Nr(n,l);if(p!==m)break;a=l}let c=this.index(Nr(o,a+1));return this.index(Nr(n,a+1))<c?Dt.PRECEDING:Dt.FOLLOWING}remove(e){let t=this._node(e),o=this._node(t.parent),n=this._node(t.previousSibling),s=this._node(t.nextSibling);return o&&(o.firstChild===e&&(o.firstChild=t.nextSibling),o.lastChild===e&&(o.lastChild=t.previousSibling)),n&&(n.nextSibling=t.nextSibling),s&&(s.previousSibling=t.previousSibling),t.parent=null,t.previousSibling=null,t.nextSibling=null,t.cachedIndex=-1,t.cachedIndexVersion=NaN,o&&o.childrenChanged(),e}insertBefore(e,t){let o=this._node(e),n=this._node(o.previousSibling),s=this._node(t),a=this._node(o.parent);if(s.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return s.parent=o.parent,s.previousSibling=o.previousSibling,s.nextSibling=e,o.previousSibling=t,n&&(n.nextSibling=t),a&&a.firstChild===e&&(a.firstChild=t),a&&a.childrenChanged(),t}insertAfter(e,t){let o=this._node(e),n=this._node(o.nextSibling),s=this._node(t),a=this._node(o.parent);if(s.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return s.parent=o.parent,s.previousSibling=e,s.nextSibling=o.nextSibling,o.nextSibling=t,n&&(n.previousSibling=t),a&&a.lastChild===e&&(a.lastChild=t),a&&a.childrenChanged(),t}prependChild(e,t){let o=this._node(e),n=this._node(t);if(n.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return o.hasChildren?this.insertBefore(o.firstChild,t):(n.parent=e,o.firstChild=t,o.lastChild=t,o.childrenChanged()),t}appendChild(e,t){let o=this._node(e),n=this._node(t);if(n.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return o.hasChildren?this.insertAfter(o.lastChild,t):(n.parent=e,o.firstChild=t,o.lastChild=t,o.childrenChanged()),t}};hd.exports=as,as.TreePosition=Dt});var Cd=nt((goe,Pd)=>{"use strict";Pd.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,o=e.cmp&&(function(s){return function(a){return function(u,c){var f={key:u,value:a[u]},l={key:c,value:a[c]};return s(f,l)}}})(e.cmp),n=[];return i((function s(a){if(a&&a.toJSON&&typeof a.toJSON=="function"&&(a=a.toJSON()),a!==void 0){if(typeof a=="number")return isFinite(a)?""+a:"null";if(typeof a!="object")return JSON.stringify(a);var u,c;if(Array.isArray(a)){for(c="[",u=0;u<a.length;u++)u&&(c+=","),c+=s(a[u])||"null";return c+"]"}if(a===null)return"null";if(n.indexOf(a)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var f=n.push(a)-1,l=Object.keys(a).sort(o&&o(a));for(c="",u=0;u<l.length;u++){var p=l[u],m=s(a[p]);m&&(c&&(c+=","),c+=JSON.stringify(p)+":"+m)}return n.splice(f,1),"{"+c+"}"}}),"stringify")(r)}});var j={};A(j,{Timeout:()=>zo,delayFor:()=>Su,delayForRandom:()=>Bp});var F={};A(F,{CumulativeDeferred:()=>Bo,Deferred:()=>$o,cumulativeDefer:()=>Lp,defer:()=>it,fromCallback:()=>$p,getFirstTrueOrFalse:()=>Up,map:()=>Hp,rejectedPromise:()=>qp,resolvedPromise:()=>Yp,timeoutAndContinue:()=>jp,timeoutWrap:()=>Du});var $o=class{static{i(this,"Deferred")}claim(){if(this.claimed)throw new Error("Deferred already claimed");this.claimed=!0}get duration(){return this.stoppedAt?this.stoppedAt-this.startedAt:Date.now()-this.startedAt}constructor(){this.claimed=!1,this.promise=new Promise((e,t)=>{this.resolve=o=>{this.status="fulfilled",this.stoppedAt=Date.now(),e(o)},this.reject=o=>{this.status="rejected",this.stoppedAt=Date.now(),t(o)},this.startedAt=Date.now(),this.status="pending"})}},it=i(()=>new $o,"defer");var Bo=class{static{i(this,"CumulativeDeferred")}constructor(){this.accumulatedPromises=[],this.deferred=it(),this.promise=this.deferred.promise,setTimeout(async()=>{for(;this.accumulatedPromises.length>0;)await this.accumulatedPromises.shift();this.deferred.resolve()},0)}subDefer(){let e=it();return this.addPromise(e.promise),e}addPromise(e){this.accumulatedPromises.push(e)}},Lp=i(()=>new Bo,"cumulativeDefer");function Yp(r){return Promise.resolve(r)}i(Yp,"resolvedPromise");var qp=i(r=>Promise.reject(r),"rejectedPromise"),Hp=i(async(r,e)=>Promise.all(r.map(e)),"map"),Du=i(async(r,e,t=!0)=>new Promise((o,n)=>{let s,a=i(()=>{s!==void 0&&(clearTimeout(s),s=void 0)},"releaseTimeout");s=setTimeout(()=>{s=void 0,t?n(new Error("timeout")):o(null)},e),r.then(u=>{a(),o(u)},u=>{a(),n(u)})}),"timeoutWrap"),jp=i(async(r,e=6e4)=>Du(r,e,!1),"timeoutAndContinue"),Up=i(async r=>{let e=it();for(let t of r)t.then(o=>{o===!0&&e.resolve(!0)});return Promise.all(r).then(()=>{e.resolve(!1)}),e.promise},"getFirstTrueOrFalse"),$p=i(r=>new Promise((e,t)=>{r((o,n)=>{o?t(o):e(n)})}),"fromCallback");var Su=i(async(r,e,t=!1)=>(await new zo(r,null,t).promise,e),"delayFor"),Bp=i(async(r,e,t,o=!1)=>(await Su(Math.random()*(e-r)+r,null,o),t),"delayForRandom"),zo=class{static{i(this,"Timeout")}constructor(e,t,o=!1){this._cancelled=!1,this.timeoutInMillis=e,this._deferred=it(),this.promise=this._deferred.promise,this._timeout=setTimeout(()=>{this._cancelled||this._deferred.resolve(t)},e),this.started=Date.now(),o&&this.makeUnrefed()}makeUnrefed(){this._timeout.unref?.()}cancel(){this._cancelled=!0,clearTimeout(this._timeout)}getTimeLeft(){let e=this.started+this.timeoutInMillis-Date.now();return e>0?e:0}};var Vo={};var kt={};A(kt,{TYPED_REQUEST_REDACTED_PAYLOAD:()=>zr,TypedHandler:()=>du,TypedRequest:()=>hu,TypedRequestRetryLimitError:()=>qs,TypedRequestTimeoutError:()=>Ys,TypedResponseError:()=>We,TypedRouter:()=>pu,TypedTarget:()=>mu,VirtualStream:()=>Ye,VirtualStreamActivationScope:()=>et,VirtualStreamClosedError:()=>Qt,VirtualStreamLifecycleContractError:()=>Is,VirtualStreamOpenTimeoutError:()=>Xt,getTypedRequestResponseInterestKey:()=>Ws});var Se={};A(Se,{AsyncExecutionStack:()=>Fa,BackpressuredArray:()=>La,FastMap:()=>So,Interest:()=>Mo,InterestMap:()=>Ya,LimitedArray:()=>qa,LoopTracker:()=>Ha,ObjectMap:()=>Vt,Stringmap:()=>ja,TimedAggregator:()=>Oo,TimedAggregtor:()=>Oo,Tree:()=>Ua,uni:()=>xd});var Zr={};A(Zr,{SmartMatch:()=>zs});var Xr={};A(Xr,{isMatch:()=>Gp,matcher:()=>Ap});function $s(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}i($s,"escapeStringRegexp");var Bs=new Map,Mu=i((r,e)=>{if(!Array.isArray(r))switch(typeof r){case"string":r=[r];break;case"undefined":r=[];break;default:throw new TypeError(`Expected '${e}' to be a string or an array, but got a type of '${typeof r}'`)}return r.filter(t=>{if(typeof t!="string"){if(typeof t>"u")return!1;throw new TypeError(`Expected '${e}' to be an array of strings, but found a type of '${typeof t}' in the array`)}return!0})},"sanitizeArray"),Vp=i((r,e)=>{e={caseSensitive:!1,...e};let t=r+JSON.stringify(e);if(Bs.has(t))return Bs.get(t);let o=r[0]==="!";o&&(r=r.slice(1)),r=$s(r).replace(/\\\*/g,"[\\s\\S]*");let n=new RegExp(`^${r}$`,e.caseSensitive?"":"i");return n.negated=o,Bs.set(t,n),n},"makeRegexp"),Ou=i((r,e,t,o)=>{if(r=Mu(r,"inputs"),e=Mu(e,"patterns"),e.length===0)return[];e=e.map(a=>Vp(a,t));let{allPatterns:n}=t||{},s=[];for(let a of r){let u,c=[...e].fill(!1);for(let[f,l]of e.entries())if(l.test(a)&&(c[f]=!0,u=!l.negated,!u))break;if(!(u===!1||u===void 0&&e.some(f=>!f.negated)||n&&c.some((f,l)=>!f&&!e[l].negated))&&(s.push(a),o))break}return s},"baseMatcher");function Ap(r,e,t){return Ou(r,e,t,!1)}i(Ap,"matcher");function Gp(r,e,t){return Ou(r,e,t,!0).length>0}i(Gp,"isMatch");var zs=class{static{i(this,"SmartMatch")}constructor(e){this.wildcard=e}match(e){return Xr.isMatch(e,this.wildcard)}};var Ce={};A(Ce,{ObservableIntake:()=>ha,Observablemap:()=>ma,fromStreamWithBackpressure:()=>Oy,rxjs:()=>cr});var cr={};A(cr,{Observable:()=>H,ReplaySubject:()=>Xo,Subject:()=>je,Subscription:()=>Te,from:()=>Nt,fromEvent:()=>Ft,of:()=>da,ops:()=>My});var Vs=i(function(r,e){return Vs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])},Vs(r,e)},"extendStatics");function ue(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Vs(r,e);function t(){this.constructor=r}i(t,"__"),r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}i(ue,"__extends");var As=i(function(){return As=Object.assign||i(function(e){for(var t,o=1,n=arguments.length;o<n;o++){t=arguments[o];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),As.apply(this,arguments)},"__assign");function Qp(r,e){var t={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.indexOf(o)<0&&(t[o]=r[o]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,o=Object.getOwnPropertySymbols(r);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(r,o[n])&&(t[o[n]]=r[o[n]]);return t}i(Qp,"__rest");function Xp(r,e,t,o){var n=arguments.length,s=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,o);else for(var u=r.length-1;u>=0;u--)(a=r[u])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}i(Xp,"__decorate");function Zp(r,e){return function(t,o){e(t,o,r)}}i(Zp,"__param");function em(r,e,t,o,n,s){function a(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}i(a,"accept");for(var u=o.kind,c=u==="getter"?"get":u==="setter"?"set":"value",f=!e&&r?o.static?r:r.prototype:null,l=e||(f?Object.getOwnPropertyDescriptor(f,o.name):{}),p,m=!1,h=t.length-1;h>=0;h--){var x={};for(var g in o)x[g]=g==="access"?{}:o[g];for(var g in o.access)x.access[g]=o.access[g];x.addInitializer=function(v){if(m)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(v||null))};var w=(0,t[h])(u==="accessor"?{get:l.get,set:l.set}:l[c],x);if(u==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(p=a(w.get))&&(l.get=p),(p=a(w.set))&&(l.set=p),(p=a(w.init))&&n.unshift(p)}else(p=a(w))&&(u==="field"?n.unshift(p):l[c]=p)}f&&Object.defineProperty(f,o.name,l),m=!0}i(em,"__esDecorate");function tm(r,e,t){for(var o=arguments.length>2,n=0;n<e.length;n++)t=o?e[n].call(r,t):e[n].call(r);return o?t:void 0}i(tm,"__runInitializers");function rm(r){return typeof r=="symbol"?r:"".concat(r)}i(rm,"__propKey");function om(r,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(r,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}i(om,"__setFunctionName");function nm(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}i(nm,"__metadata");function Ks(r,e,t,o){function n(s){return s instanceof t?s:new t(function(a){a(s)})}return i(n,"adopt"),new(t||(t=Promise))(function(s,a){function u(l){try{f(o.next(l))}catch(p){a(p)}}i(u,"fulfilled");function c(l){try{f(o.throw(l))}catch(p){a(p)}}i(c,"rejected");function f(l){l.done?s(l.value):n(l.value).then(u,c)}i(f,"step"),f((o=o.apply(r,e||[])).next())})}i(Ks,"__awaiter");function eo(r,e){var t={label:0,sent:i(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},o,n,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(f){return function(l){return c([f,l])}}function c(f){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,f[0]&&(t=0)),t;)try{if(o=1,n&&(s=f[0]&2?n.return:f[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,f[1])).done)return s;switch(n=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,n=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){t.label=f[1];break}if(f[0]===6&&t.label<s[1]){t.label=s[1],s=f;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(f);break}s[2]&&t.ops.pop(),t.trys.pop();continue}f=e.call(r,t)}catch(l){f=[6,l],n=0}finally{o=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}i(eo,"__generator");var Gs=Object.create?(function(r,e,t,o){o===void 0&&(o=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:i(function(){return e[t]},"get")}),Object.defineProperty(r,o,n)}):(function(r,e,t,o){o===void 0&&(o=t),r[o]=e[t]});function im(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Gs(e,r,t)}i(im,"__exportStar");function le(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],o=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:i(function(){return r&&o>=r.length&&(r=void 0),{value:r&&r[o++],done:!r}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}i(le,"__values");function ge(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var o=t.call(r),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(u){a={error:u}}finally{try{n&&!n.done&&(t=o.return)&&t.call(o)}finally{if(a)throw a.error}}return s}i(ge,"__read");function sm(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(ge(arguments[e]));return r}i(sm,"__spread");function am(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var o=Array(r),n=0,e=0;e<t;e++)for(var s=arguments[e],a=0,u=s.length;a<u;a++,n++)o[n]=s[a];return o}i(am,"__spreadArrays");function Ie(r,e,t){if(t||arguments.length===2)for(var o=0,n=e.length,s;o<n;o++)(s||!(o in e))&&(s||(s=Array.prototype.slice.call(e,0,o)),s[o]=e[o]);return r.concat(s||Array.prototype.slice.call(e))}i(Ie,"__spreadArray");function Xe(r){return this instanceof Xe?(this.v=r,this):new Xe(r)}i(Xe,"__await");function Qs(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=t.apply(r,e||[]),n,s=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(h){return function(x){return Promise.resolve(x).then(h,p)}}function u(h,x){o[h]&&(n[h]=function(g){return new Promise(function(w,v){s.push([h,g,w,v])>1||c(h,g)})},x&&(n[h]=x(n[h])))}function c(h,x){try{f(o[h](x))}catch(g){m(s[0][3],g)}}function f(h){h.value instanceof Xe?Promise.resolve(h.value.v).then(l,p):m(s[0][2],h)}function l(h){c("next",h)}function p(h){c("throw",h)}function m(h,x){h(x),s.shift(),s.length&&c(s[0][0],s[0][1])}}i(Qs,"__asyncGenerator");function um(r){var e,t;return e={},o("next"),o("throw",function(n){throw n}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(n,s){e[n]=r[n]?function(a){return(t=!t)?{value:Xe(r[n](a)),done:!1}:s?s(a):a}:s}}i(um,"__asyncDelegator");function Xs(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof le=="function"?le(r):r[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(s){t[s]=r[s]&&function(a){return new Promise(function(u,c){a=r[s](a),n(u,c,a.done,a.value)})}}function n(s,a,u,c){Promise.resolve(c).then(function(f){s({value:f,done:u})},a)}}i(Xs,"__asyncValues");function cm(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}i(cm,"__makeTemplateObject");var fm=Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e},Js=i(function(r){return Js=Object.getOwnPropertyNames||function(e){var t=[];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[t.length]=o);return t},Js(r)},"ownKeys");function lm(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t=Js(r),o=0;o<t.length;o++)t[o]!=="default"&&Gs(e,r,t[o]);return fm(e,r),e}i(lm,"__importStar");function dm(r){return r&&r.__esModule?r:{default:r}}i(dm,"__importDefault");function pm(r,e,t,o){if(t==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!o:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?o:t==="a"?o.call(r):o?o.value:e.get(r)}i(pm,"__classPrivateFieldGet");function mm(r,e,t,o,n){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t}i(mm,"__classPrivateFieldSet");function hm(r,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?e===r:r.has(e)}i(hm,"__classPrivateFieldIn");function ym(r,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var o,n;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=e[Symbol.asyncDispose]}if(o===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=e[Symbol.dispose],t&&(n=o)}if(typeof o!="function")throw new TypeError("Object not disposable.");n&&(o=i(function(){try{n.call(this)}catch(s){return Promise.reject(s)}},"dispose")),r.stack.push({value:e,dispose:o,async:t})}else t&&r.stack.push({async:!0});return e}i(ym,"__addDisposableResource");var xm=typeof SuppressedError=="function"?SuppressedError:function(r,e,t){var o=new Error(t);return o.name="SuppressedError",o.error=r,o.suppressed=e,o};function gm(r){function e(s){r.error=r.hasError?new xm(s,r.error,"An error was suppressed during disposal."):s,r.hasError=!0}i(e,"fail");var t,o=0;function n(){for(;t=r.stack.pop();)try{if(!t.async&&o===1)return o=0,r.stack.push(t),Promise.resolve().then(n);if(t.dispose){var s=t.dispose.call(t.value);if(t.async)return o|=2,Promise.resolve(s).then(n,function(a){return e(a),n()})}else o|=1}catch(a){e(a)}if(o===1)return r.hasError?Promise.reject(r.error):Promise.resolve();if(r.hasError)throw r.error}return i(n,"next"),n()}i(gm,"__disposeResources");function wm(r,e){return typeof r=="string"&&/^\.\.?\//.test(r)?r.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,o,n,s,a){return o?e?".jsx":".js":n&&(!s||!a)?t:n+s+"."+a.toLowerCase()+"js"}):r}i(wm,"__rewriteRelativeImportExtension");var qb={__extends:ue,__assign:As,__rest:Qp,__decorate:Xp,__param:Zp,__esDecorate:em,__runInitializers:tm,__propKey:rm,__setFunctionName:om,__metadata:nm,__awaiter:Ks,__generator:eo,__createBinding:Gs,__exportStar:im,__values:le,__read:ge,__spread:sm,__spreadArrays:am,__spreadArray:Ie,__await:Xe,__asyncGenerator:Qs,__asyncDelegator:um,__asyncValues:Xs,__makeTemplateObject:cm,__importStar:lm,__importDefault:dm,__classPrivateFieldGet:pm,__classPrivateFieldSet:mm,__classPrivateFieldIn:hm,__addDisposableResource:ym,__disposeResources:gm,__rewriteRelativeImportExtension:wm};function I(r){return typeof r=="function"}i(I,"isFunction");function Go(r){var e=i(function(o){Error.call(o),o.stack=new Error().stack},"_super"),t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}i(Go,"createErrorClass");var to=Go(function(r){return i(function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
2
- `+t.map(function(o,n){return n+1+") "+o.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=t},"UnsubscriptionErrorImpl")});function Fe(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}i(Fe,"arrRemove");var Te=(function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return i(r,"Subscription"),r.prototype.unsubscribe=function(){var e,t,o,n,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var u=le(a),c=u.next();!c.done;c=u.next()){var f=c.value;f.remove(this)}}catch(g){e={error:g}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}else a.remove(this);var l=this.initialTeardown;if(I(l))try{l()}catch(g){s=g instanceof to?g.errors:[g]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var m=le(p),h=m.next();!h.done;h=m.next()){var x=h.value;try{Eu(x)}catch(g){s=s??[],g instanceof to?s=Ie(Ie([],ge(s)),ge(g.errors)):s.push(g)}}}catch(g){o={error:g}}finally{try{h&&!h.done&&(n=m.return)&&n.call(m)}finally{if(o)throw o.error}}}if(s)throw new to(s)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)Eu(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Fe(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&Fe(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=(function(){var e=new r;return e.closed=!0,e})(),r})(),Zs=Te.EMPTY;function Jo(r){return r instanceof Te||r&&"closed"in r&&I(r.remove)&&I(r.add)&&I(r.unsubscribe)}i(Jo,"isSubscription");function Eu(r){I(r)?r():r.unsubscribe()}i(Eu,"execFinalizer");var Pe={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var nr={setTimeout:i(function(r,e){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];var n=nr.delegate;return n?.setTimeout?n.setTimeout.apply(n,Ie([r,e],ge(t))):setTimeout.apply(void 0,Ie([r,e],ge(t)))},"setTimeout"),clearTimeout:i(function(r){var e=nr.delegate;return(e?.clearTimeout||clearTimeout)(r)},"clearTimeout"),delegate:void 0};function Ko(r){nr.setTimeout(function(){var e=Pe.onUnhandledError;if(e)e(r);else throw r})}i(Ko,"reportUnhandledError");function He(){}i(He,"noop");var ku=(function(){return ea("C",void 0,void 0)})();function Iu(r){return ea("E",void 0,r)}i(Iu,"errorNotification");function Pu(r){return ea("N",r,void 0)}i(Pu,"nextNotification");function ea(r,e,t){return{kind:r,value:e,error:t}}i(ea,"createNotification");var Ct=null;function ir(r){if(Pe.useDeprecatedSynchronousErrorHandling){var e=!Ct;if(e&&(Ct={errorThrown:!1,error:null}),r(),e){var t=Ct,o=t.errorThrown,n=t.error;if(Ct=null,o)throw n}}else r()}i(ir,"errorContext");function Cu(r){Pe.useDeprecatedSynchronousErrorHandling&&Ct&&(Ct.errorThrown=!0,Ct.error=r)}i(Cu,"captureError");var _t=(function(r){ue(e,r);function e(t){var o=r.call(this)||this;return o.isStopped=!1,t?(o.destination=t,Jo(t)&&t.add(o)):o.destination=Dm,o}return i(e,"Subscriber"),e.create=function(t,o,n){return new ro(t,o,n)},e.prototype.next=function(t){this.isStopped?ra(Pu(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?ra(Iu(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?ra(ku,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Te),bm=Function.prototype.bind;function ta(r,e){return bm.call(r,e)}i(ta,"bind");var vm=(function(){function r(e){this.partialObserver=e}return i(r,"ConsumerObserver"),r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(o){Qo(o)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(o){Qo(o)}else Qo(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Qo(t)}},r})(),ro=(function(r){ue(e,r);function e(t,o,n){var s=r.call(this)||this,a;if(I(t)||!t)a={next:t??void 0,error:o??void 0,complete:n??void 0};else{var u;s&&Pe.useDeprecatedNextContext?(u=Object.create(t),u.unsubscribe=function(){return s.unsubscribe()},a={next:t.next&&ta(t.next,u),error:t.error&&ta(t.error,u),complete:t.complete&&ta(t.complete,u)}):a=t}return s.destination=new vm(a),s}return i(e,"SafeSubscriber"),e})(_t);function Qo(r){Pe.useDeprecatedSynchronousErrorHandling?Cu(r):Ko(r)}i(Qo,"handleUnhandledError");function Tm(r){throw r}i(Tm,"defaultErrorHandler");function ra(r,e){var t=Pe.onStoppedNotification;t&&nr.setTimeout(function(){return t(r,e)})}i(ra,"handleStoppedNotification");var Dm={closed:!0,next:He,error:Tm,complete:He};var Rt=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function oo(r){return r}i(oo,"identity");function Sm(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return oa(r)}i(Sm,"pipe");function oa(r){return r.length===0?oo:r.length===1?r[0]:i(function(t){return r.reduce(function(o,n){return n(o)},t)},"piped")}i(oa,"pipeFromArray");var H=(function(){function r(e){e&&(this._subscribe=e)}return i(r,"Observable"),r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,o){var n=this,s=Om(e)?e:new ro(e,t,o);return ir(function(){var a=n,u=a.operator,c=a.source;s.add(u?u.call(s,c):c?n._subscribe(s):n._trySubscribe(s))}),s},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var o=this;return t=_u(t),new t(function(n,s){var a=new ro({next:i(function(u){try{e(u)}catch(c){s(c),a.unsubscribe()}},"next"),error:s,complete:n});o.subscribe(a)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[Rt]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return oa(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=_u(e),new e(function(o,n){var s;t.subscribe(function(a){return s=a},function(a){return n(a)},function(){return o(s)})})},r.create=function(e){return new r(e)},r})();function _u(r){var e;return(e=r??Pe.Promise)!==null&&e!==void 0?e:Promise}i(_u,"getPromiseCtor");function Mm(r){return r&&I(r.next)&&I(r.error)&&I(r.complete)}i(Mm,"isObserver");function Om(r){return r&&r instanceof _t||Mm(r)&&Jo(r)}i(Om,"isSubscriber");function Em(r){return I(r?.lift)}i(Em,"hasLift");function B(r){return function(e){if(Em(e))return e.lift(function(t){try{return r(t,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}i(B,"operate");function z(r,e,t,o,n){return new Ru(r,e,t,o,n)}i(z,"createOperatorSubscriber");var Ru=(function(r){ue(e,r);function e(t,o,n,s,a,u){var c=r.call(this,t)||this;return c.onFinalize=a,c.shouldUnsubscribe=u,c._next=o?function(f){try{o(f)}catch(l){t.error(l)}}:r.prototype._next,c._error=s?function(f){try{s(f)}catch(l){t.error(l)}finally{this.unsubscribe()}}:r.prototype._error,c._complete=n?function(){try{n()}catch(f){t.error(f)}finally{this.unsubscribe()}}:r.prototype._complete,c}return i(e,"OperatorSubscriber"),e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;r.prototype.unsubscribe.call(this),!o&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e})(_t);var na=Go(function(r){return i(function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl")});var je=(function(r){ue(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return i(e,"Subject"),e.prototype.lift=function(t){var o=new ia(this,this);return o.operator=t,o},e.prototype._throwIfClosed=function(){if(this.closed)throw new na},e.prototype.next=function(t){var o=this;ir(function(){var n,s;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var a=le(o.currentObservers),u=a.next();!u.done;u=a.next()){var c=u.value;c.next(t)}}catch(f){n={error:f}}finally{try{u&&!u.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}}})},e.prototype.error=function(t){var o=this;ir(function(){if(o._throwIfClosed(),!o.isStopped){o.hasError=o.isStopped=!0,o.thrownError=t;for(var n=o.observers;n.length;)n.shift().error(t)}})},e.prototype.complete=function(){var t=this;ir(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var o=t.observers;o.length;)o.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:i(function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},"get"),enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var o=this,n=this,s=n.hasError,a=n.isStopped,u=n.observers;return s||a?Zs:(this.currentObservers=null,u.push(t),new Te(function(){o.currentObservers=null,Fe(u,t)}))},e.prototype._checkFinalizedStatuses=function(t){var o=this,n=o.hasError,s=o.thrownError,a=o.isStopped;n?t.error(s):a&&t.complete()},e.prototype.asObservable=function(){var t=new H;return t.source=this,t},e.create=function(t,o){return new ia(t,o)},e})(H),ia=(function(r){ue(e,r);function e(t,o){var n=r.call(this)||this;return n.destination=t,n.source=o,n}return i(e,"AnonymousSubject"),e.prototype.next=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.next)===null||n===void 0||n.call(o,t)},e.prototype.error=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.error)===null||n===void 0||n.call(o,t)},e.prototype.complete=function(){var t,o;(o=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||o===void 0||o.call(t)},e.prototype._subscribe=function(t){var o,n;return(n=(o=this.source)===null||o===void 0?void 0:o.subscribe(t))!==null&&n!==void 0?n:Zs},e})(je);var no={now:i(function(){return(no.delegate||Date).now()},"now"),delegate:void 0};var Xo=(function(r){ue(e,r);function e(t,o,n){t===void 0&&(t=1/0),o===void 0&&(o=1/0),n===void 0&&(n=no);var s=r.call(this)||this;return s._bufferSize=t,s._windowTime=o,s._timestampProvider=n,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=o===1/0,s._bufferSize=Math.max(1,t),s._windowTime=Math.max(1,o),s}return i(e,"ReplaySubject"),e.prototype.next=function(t){var o=this,n=o.isStopped,s=o._buffer,a=o._infiniteTimeWindow,u=o._timestampProvider,c=o._windowTime;n||(s.push(t),!a&&s.push(u.now()+c)),this._trimBuffer(),r.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var o=this._innerSubscribe(t),n=this,s=n._infiniteTimeWindow,a=n._buffer,u=a.slice(),c=0;c<u.length&&!t.closed;c+=s?1:2)t.next(u[c]);return this._checkFinalizedStatuses(t),o},e.prototype._trimBuffer=function(){var t=this,o=t._bufferSize,n=t._timestampProvider,s=t._buffer,a=t._infiniteTimeWindow,u=(a?1:2)*o;if(o<1/0&&u<s.length&&s.splice(0,s.length-u),!a){for(var c=n.now(),f=0,l=1;l<s.length&&s[l]<=c;l+=2)f=l;f&&s.splice(0,f+1)}},e})(je);var sa=(function(r){ue(e,r);function e(t,o){return r.call(this)||this}return i(e,"Action"),e.prototype.schedule=function(t,o){return o===void 0&&(o=0),this},e})(Te);var io={setInterval:i(function(r,e){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];var n=io.delegate;return n?.setInterval?n.setInterval.apply(n,Ie([r,e],ge(t))):setInterval.apply(void 0,Ie([r,e],ge(t)))},"setInterval"),clearInterval:i(function(r){var e=io.delegate;return(e?.clearInterval||clearInterval)(r)},"clearInterval"),delegate:void 0};var aa=(function(r){ue(e,r);function e(t,o){var n=r.call(this,t,o)||this;return n.scheduler=t,n.work=o,n.pending=!1,n}return i(e,"AsyncAction"),e.prototype.schedule=function(t,o){var n;if(o===void 0&&(o=0),this.closed)return this;this.state=t;var s=this.id,a=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(a,s,o)),this.pending=!0,this.delay=o,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(a,this.id,o),this},e.prototype.requestAsyncId=function(t,o,n){return n===void 0&&(n=0),io.setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,o,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return o;o!=null&&io.clearInterval(o)},e.prototype.execute=function(t,o){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,o);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,o){var n=!1,s;try{this.work(t)}catch(a){n=!0,s=a||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,o=t.id,n=t.scheduler,s=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Fe(s,this),o!=null&&(this.id=this.recycleAsyncId(n,o,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e})(sa);var so=(function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return i(r,"Scheduler"),r.prototype.schedule=function(e,t,o){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(o,t)},r.now=no.now,r})();var ua=(function(r){ue(e,r);function e(t,o){o===void 0&&(o=so.now);var n=r.call(this,t,o)||this;return n.actions=[],n._active=!1,n}return i(e,"AsyncScheduler"),e.prototype.flush=function(t){var o=this.actions;if(this._active){o.push(t);return}var n;this._active=!0;do if(n=t.execute(t.state,t.delay))break;while(t=o.shift());if(this._active=!1,n){for(;t=o.shift();)t.unsubscribe();throw n}},e})(so);var st=new ua(aa),ca=st;function Zo(r){return r&&I(r.schedule)}i(Zo,"isScheduler");function fa(r){return r[r.length-1]}i(fa,"last");function $v(r){return I(fa(r))?r.pop():void 0}i($v,"popResultSelector");function at(r){return Zo(fa(r))?r.pop():void 0}i(at,"popScheduler");function Bv(r,e){return typeof fa(r)=="number"?r.pop():e}i(Bv,"popNumber");var sr=i((function(r){return r&&typeof r.length=="number"&&typeof r!="function"}),"isArrayLike");function en(r){return I(r?.then)}i(en,"isPromise");function tn(r){return I(r[Rt])}i(tn,"isInteropObservable");function rn(r){return Symbol.asyncIterator&&I(r?.[Symbol.asyncIterator])}i(rn,"isAsyncIterable");function on(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}i(on,"createInvalidObservableTypeError");function km(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(km,"getSymbolIterator");var nn=km();function sn(r){return I(r?.[nn])}i(sn,"isIterable");function an(r){return Qs(this,arguments,i(function(){var t,o,n,s;return eo(this,function(a){switch(a.label){case 0:t=r.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Xe(t.read())];case 3:return o=a.sent(),n=o.value,s=o.done,s?[4,Xe(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Xe(n)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})},"readableStreamLikeToAsyncGenerator_1"))}i(an,"readableStreamLikeToAsyncGenerator");function un(r){return I(r?.getReader)}i(un,"isReadableStreamLike");function Q(r){if(r instanceof H)return r;if(r!=null){if(tn(r))return Im(r);if(sr(r))return Pm(r);if(en(r))return Cm(r);if(rn(r))return Nu(r);if(sn(r))return _m(r);if(un(r))return Rm(r)}throw on(r)}i(Q,"innerFrom");function Im(r){return new H(function(e){var t=r[Rt]();if(I(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i(Im,"fromInteropObservable");function Pm(r){return new H(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}i(Pm,"fromArrayLike");function Cm(r){return new H(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Ko)})}i(Cm,"fromPromise");function _m(r){return new H(function(e){var t,o;try{for(var n=le(r),s=n.next();!s.done;s=n.next()){var a=s.value;if(e.next(a),e.closed)return}}catch(u){t={error:u}}finally{try{s&&!s.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}e.complete()})}i(_m,"fromIterable");function Nu(r){return new H(function(e){Nm(r,e).catch(function(t){return e.error(t)})})}i(Nu,"fromAsyncIterable");function Rm(r){return Nu(an(r))}i(Rm,"fromReadableStreamLike");function Nm(r,e){var t,o,n,s;return Ks(this,void 0,void 0,function(){var a,u;return eo(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),t=Xs(r),c.label=1;case 1:return[4,t.next()];case 2:if(o=c.sent(),!!o.done)return[3,4];if(a=o.value,e.next(a),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),n={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),o&&!o.done&&(s=t.return)?[4,s.call(t)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}i(Nm,"process");function we(r,e,t,o,n){o===void 0&&(o=0),n===void 0&&(n=!1);var s=e.schedule(function(){t(),n?r.add(this.schedule(null,o)):this.unsubscribe()},o);if(r.add(s),!n)return s}i(we,"executeSchedule");function ar(r,e){return e===void 0&&(e=0),B(function(t,o){t.subscribe(z(o,function(n){return we(o,r,function(){return o.next(n)},e)},function(){return we(o,r,function(){return o.complete()},e)},function(n){return we(o,r,function(){return o.error(n)},e)}))})}i(ar,"observeOn");function ur(r,e){return e===void 0&&(e=0),B(function(t,o){o.add(r.schedule(function(){return t.subscribe(o)},e))})}i(ur,"subscribeOn");function Wu(r,e){return Q(r).pipe(ur(e),ar(e))}i(Wu,"scheduleObservable");function Fu(r,e){return Q(r).pipe(ur(e),ar(e))}i(Fu,"schedulePromise");function Lu(r,e){return new H(function(t){var o=0;return e.schedule(function(){o===r.length?t.complete():(t.next(r[o++]),t.closed||this.schedule())})})}i(Lu,"scheduleArray");function Yu(r,e){return new H(function(t){var o;return we(t,e,function(){o=r[nn](),we(t,e,function(){var n,s,a;try{n=o.next(),s=n.value,a=n.done}catch(u){t.error(u);return}a?t.complete():t.next(s)},0,!0)}),function(){return I(o?.return)&&o.return()}})}i(Yu,"scheduleIterable");function cn(r,e){if(!r)throw new Error("Iterable cannot be null");return new H(function(t){we(t,e,function(){var o=r[Symbol.asyncIterator]();we(t,e,function(){o.next().then(function(n){n.done?t.complete():t.next(n.value)})},0,!0)})})}i(cn,"scheduleAsyncIterable");function qu(r,e){return cn(an(r),e)}i(qu,"scheduleReadableStreamLike");function la(r,e){if(r!=null){if(tn(r))return Wu(r,e);if(sr(r))return Lu(r,e);if(en(r))return Fu(r,e);if(rn(r))return cn(r,e);if(sn(r))return Yu(r,e);if(un(r))return qu(r,e)}throw on(r)}i(la,"scheduled");function Nt(r,e){return e?la(r,e):Q(r)}i(Nt,"from");function da(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=at(r);return Nt(r,t)}i(da,"of");function Hu(r){return r instanceof Date&&!isNaN(r)}i(Hu,"isValidDate");function ut(r,e){return B(function(t,o){var n=0;t.subscribe(z(o,function(s){o.next(r.call(e,s,n++))}))})}i(ut,"map");var Wm=Array.isArray;function Fm(r,e){return Wm(e)?r.apply(void 0,Ie([],ge(e))):r(e)}i(Fm,"callOrApply");function ju(r){return ut(function(e){return Fm(r,e)})}i(ju,"mapOneOrManyArgs");function Uu(r,e,t,o,n,s,a,u){var c=[],f=0,l=0,p=!1,m=i(function(){p&&!c.length&&!f&&e.complete()},"checkComplete"),h=i(function(g){return f<o?x(g):c.push(g)},"outerNext"),x=i(function(g){s&&e.next(g),f++;var w=!1;Q(t(g,l++)).subscribe(z(e,function(v){n?.(v),s?h(v):e.next(v)},function(){w=!0},void 0,function(){if(w)try{f--;for(var v=i(function(){var G=c.shift();a?we(e,a,function(){return x(G)}):x(G)},"_loop_1");c.length&&f<o;)v();m()}catch(G){e.error(G)}}))},"doInnerSub");return r.subscribe(z(e,h,function(){p=!0,m()})),function(){u?.()}}i(Uu,"mergeInternals");function Wt(r,e,t){return t===void 0&&(t=1/0),I(e)?Wt(function(o,n){return ut(function(s,a){return e(o,s,n,a)})(Q(r(o,n)))},t):(typeof e=="number"&&(t=e),B(function(o,n){return Uu(o,n,r,t)}))}i(Wt,"mergeMap");function fn(r){return r===void 0&&(r=1/0),Wt(oo,r)}i(fn,"mergeAll");function ln(){return fn(1)}i(ln,"concatAll");function dn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return ln()(Nt(r,at(r)))}i(dn,"concat");var Lm=["addListener","removeListener"],Ym=["addEventListener","removeEventListener"],qm=["on","off"];function Ft(r,e,t,o){if(I(t)&&(o=t,t=void 0),o)return Ft(r,e,t).pipe(ju(o));var n=ge(Um(r)?Ym.map(function(u){return function(c){return r[u](e,c,t)}}):Hm(r)?Lm.map($u(r,e)):jm(r)?qm.map($u(r,e)):[],2),s=n[0],a=n[1];if(!s&&sr(r))return Wt(function(u){return Ft(u,e,t)})(Q(r));if(!s)throw new TypeError("Invalid event target");return new H(function(u){var c=i(function(){for(var f=[],l=0;l<arguments.length;l++)f[l]=arguments[l];return u.next(1<f.length?f:f[0])},"handler");return s(c),function(){return a(c)}})}i(Ft,"fromEvent");function $u(r,e){return function(t){return function(o){return r[t](e,o)}}}i($u,"toCommonHandlerRegistry");function Hm(r){return I(r.addListener)&&I(r.removeListener)}i(Hm,"isNodeStyleEventEmitter");function jm(r){return I(r.on)&&I(r.off)}i(jm,"isJQueryStyleEventEmitter");function Um(r){return I(r.addEventListener)&&I(r.removeEventListener)}i(Um,"isEventTarget");function pa(r,e,t){r===void 0&&(r=0),t===void 0&&(t=ca);var o=-1;return e!=null&&(Zo(e)?t=e:o=e),new H(function(n){var s=Hu(r)?+r-t.now():r;s<0&&(s=0);var a=0;return t.schedule(function(){n.closed||(n.next(a++),0<=o?this.schedule(void 0,o):n.complete())},s)})}i(pa,"timer");function pn(r,e){return B(function(t,o){var n=0;t.subscribe(z(o,function(s){return r.call(e,s,n++)&&o.next(s)}))})}i(pn,"filter");function mn(r){return B(function(e,t){var o=[];return e.subscribe(z(t,function(n){return o.push(n)},function(){t.next(o),t.complete()})),Q(r).subscribe(z(t,function(){var n=o;o=[],t.next(n)},He)),function(){o=null}})}i(mn,"buffer");function hn(r,e){return e===void 0&&(e=null),e=e??r,B(function(t,o){var n=[],s=0;t.subscribe(z(o,function(a){var u,c,f,l,p=null;s++%e===0&&n.push([]);try{for(var m=le(n),h=m.next();!h.done;h=m.next()){var x=h.value;x.push(a),r<=x.length&&(p=p??[],p.push(x))}}catch(v){u={error:v}}finally{try{h&&!h.done&&(c=m.return)&&c.call(m)}finally{if(u)throw u.error}}if(p)try{for(var g=le(p),w=g.next();!w.done;w=g.next()){var x=w.value;Fe(n,x),o.next(x)}}catch(v){f={error:v}}finally{try{w&&!w.done&&(l=g.return)&&l.call(g)}finally{if(f)throw f.error}}},function(){var a,u;try{for(var c=le(n),f=c.next();!f.done;f=c.next()){var l=f.value;o.next(l)}}catch(p){a={error:p}}finally{try{f&&!f.done&&(u=c.return)&&u.call(c)}finally{if(a)throw a.error}}o.complete()},void 0,function(){n=null}))})}i(hn,"bufferCount");function yn(r){for(var e,t,o=[],n=1;n<arguments.length;n++)o[n-1]=arguments[n];var s=(e=at(o))!==null&&e!==void 0?e:st,a=(t=o[0])!==null&&t!==void 0?t:null,u=o[1]||1/0;return B(function(c,f){var l=[],p=!1,m=i(function(g){var w=g.buffer,v=g.subs;v.unsubscribe(),Fe(l,g),f.next(w),p&&h()},"emit"),h=i(function(){if(l){var g=new Te;f.add(g);var w=[],v={buffer:w,subs:g};l.push(v),we(g,s,function(){return m(v)},r)}},"startBuffer");a!==null&&a>=0?we(f,s,h,a,!0):p=!0,h();var x=z(f,function(g){var w,v,G=l.slice();try{for(var te=le(G),ae=te.next();!ae.done;ae=te.next()){var rt=ae.value,Qe=rt.buffer;Qe.push(g),u<=Qe.length&&m(rt)}}catch(tr){w={error:tr}}finally{try{ae&&!ae.done&&(v=te.return)&&v.call(te)}finally{if(w)throw w.error}}},function(){for(;l?.length;)f.next(l.shift().buffer);x?.unsubscribe(),f.complete(),f.unsubscribe()},void 0,function(){return l=null});c.subscribe(x)})}i(yn,"bufferTime");function xn(r){return B(function(e,t){var o=!1,n=null,s=null,a=i(function(){if(s?.unsubscribe(),s=null,o){o=!1;var u=n;n=null,t.next(u)}},"emit");e.subscribe(z(t,function(u){s?.unsubscribe(),o=!0,n=u,s=z(t,a,He),Q(r(u)).subscribe(s)},function(){a(),t.complete()},void 0,function(){n=s=null}))})}i(xn,"debounce");function gn(r,e){return e===void 0&&(e=st),B(function(t,o){var n=null,s=null,a=null,u=i(function(){if(n){n.unsubscribe(),n=null;var f=s;s=null,o.next(f)}},"emit");function c(){var f=a+r,l=e.now();if(l<f){n=this.schedule(void 0,f-l),o.add(n);return}u()}i(c,"emitWhenIdle"),t.subscribe(z(o,function(f){s=f,a=e.now(),n||(n=e.schedule(c,r),o.add(n))},function(){u(),o.complete()},void 0,function(){s=n=null}))})}i(gn,"debounceTime");function wn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=at(r);return B(function(o,n){(t?dn(r,o,t):dn(r,o)).subscribe(n)})}i(wn,"startWith");function bn(r){return B(function(e,t){Q(r).subscribe(z(t,function(){return t.complete()},He)),!t.closed&&e.subscribe(t)})}i(bn,"takeUntil");function vn(r,e){return B(function(t,o){var n=e??{},s=n.leading,a=s===void 0?!0:s,u=n.trailing,c=u===void 0?!1:u,f=!1,l=null,p=null,m=!1,h=i(function(){p?.unsubscribe(),p=null,c&&(w(),m&&o.complete())},"endThrottling"),x=i(function(){p=null,m&&o.complete()},"cleanupThrottling"),g=i(function(v){return p=Q(r(v)).subscribe(z(o,h,x))},"startThrottle"),w=i(function(){if(f){f=!1;var v=l;l=null,o.next(v),!m&&g(v)}},"send");t.subscribe(z(o,function(v){f=!0,l=v,!(p&&!p.closed)&&(a?w():g(v))},function(){m=!0,!(c&&f&&p&&!p.closed)&&o.complete()}))})}i(vn,"throttle");function Tn(r,e,t){e===void 0&&(e=st);var o=pa(r,e);return vn(function(){return o},t)}i(Tn,"throttleTime");var My={buffer:mn,bufferCount:hn,bufferTime:yn,debounce:xn,debounceTime:gn,filter:pn,map:ut,startWith:wn,takeUntil:bn,throttleTime:Tn};var ma=class{static{i(this,"Observablemap")}constructor(){this.observableEventEmitterBundleArray=new Array,this.observableEventTargetBundleArray=new Array}getSubjectForEmitterEvent(e,t){let o=this.observableEventEmitterBundleArray.find(n=>n.eventRef===e&&n.event===t);if(o)return o.subject;{let n=Ft(e,t),s=new je;n.subscribe(s);let a={subject:s,eventRef:e,event:t};return this.observableEventEmitterBundleArray.push(a),a.subject}}getSubjectForEventTarget(e,t){let o=this.observableEventTargetBundleArray.find(n=>n.eventRef===e&&n.event===t);if(o)return o.subject;{let s={subject:new je,eventRef:e,event:t};return this.observableEventTargetBundleArray.push(s),s.subject}}};var ha=class{static{i(this,"ObservableIntake")}constructor(){this.observableFunctions={next:i(e=>{},"next"),complete:i(e=>{},"complete")},this.buffered=!1,this.payloadBuffer=[],this.observable=new H(e=>{this.observableFunctions.next=t=>e.next(t),this.observableFunctions.complete=()=>(this.completedDeffered.resolve(),e.complete())}),this.completedDeffered=F.defer(),this.completed=this.completedDeffered.promise}setObservable(e){this.observable=e}push(e){this.buffered?this.payloadBuffer.push(e):this.internalPush(e)}pushMany(e){for(let t of e)this.push(t)}setGenerator(e){this.generator=e}makeBuffered(){this.buffered=!0}subscribe(...e){return this.observable.subscribe(...e)}request(e){if(e!==0)for(let t=0;t!==e;t++)if(this.payloadBuffer.length>0)this.internalPush(this.payloadBuffer.shift());else{if(!this.generator)throw new Error("Cannot request an unbuffered value before setting a generator");let o=this.generator.next();this.internalPush(o.value)}}signalComplete(){this.observableFunctions.complete()}internalPush(e){this.observableFunctions.next(e)}};function Oy(r){return new H(e=>{let t=i(()=>r.pause(),"pauseStream"),o=i(()=>process.nextTick(()=>r.resume()),"resumeStream"),n=i(s=>{t(),e.next(s),o()},"onData");return r.on("data",n),r.on("error",s=>e.error(s)),r.on("end",()=>e.complete()),r.on("close",()=>e.complete()),()=>{r.removeListener("data",n),r.removeListener("error",e.error),r.removeListener("end",e.complete),r.removeListener("close",e.complete)}})}i(Oy,"fromStreamWithBackpressure");var zt={};A(zt,{CronJob:()=>Do,CronManager:()=>Ia,ExtendedDate:()=>Ca,HrtMeasurement:()=>_a,Interval:()=>Ra,TimeStamp:()=>Rr,Timer:()=>Na,getMilliSecondsAsHumanReadableAgoTime:()=>og,getMilliSecondsAsHumanReadableString:()=>rg,getMilliSecondsFromUnits:()=>Pa,units:()=>vt});var fo={};A(fo,{Cron:()=>Ju,CronDate:()=>Z,CronPattern:()=>Dn,scheduledJobs:()=>fr});function ao(r){return Date.UTC(r.y,r.m-1,r.d,r.h,r.i,r.s)}i(ao,"T");function ya(r,e){return r.y===e.y&&r.m===e.m&&r.d===e.d&&r.h===e.h&&r.i===e.i&&r.s===e.s}i(ya,"D");function Ey(r,e){let t=new Date(Date.parse(r));if(isNaN(t))throw new Error("Invalid ISO8601 passed to timezone parser.");let o=r.substring(9);return o.includes("Z")||o.includes("+")||o.includes("-")?xa(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),"Etc/UTC"):xa(t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),e)}i(Ey,"A");function Bu(r,e,t){return zu(Ey(r,e),t)}i(Bu,"v");function zu(r,e){let t=new Date(ao(r)),o=uo(t,r.tz),n=ao(r),s=ao(o),a=n-s,u=new Date(t.getTime()+a),c=uo(u,r.tz);if(ya(c,r)){let p=new Date(u.getTime()-36e5),m=uo(p,r.tz);return ya(m,r)?p:u}let f=new Date(u.getTime()+ao(r)-ao(c)),l=uo(f,r.tz);if(ya(l,r))return f;if(e)throw new Error("Invalid date passed to fromTZ()");return u.getTime()>f.getTime()?u:f}i(zu,"k");function uo(r,e){let t,o;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}),o=t.formatToParts(r)}catch(s){let a=s instanceof Error?s.message:String(s);throw new RangeError(`toTZ: Invalid timezone '${e}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${a}`)}let n={year:0,month:0,day:0,hour:0,minute:0,second:0};for(let s of o)(s.type==="year"||s.type==="month"||s.type==="day"||s.type==="hour"||s.type==="minute"||s.type==="second")&&(n[s.type]=parseInt(s.value,10));if(isNaN(n.year)||isNaN(n.month)||isNaN(n.day)||isNaN(n.hour)||isNaN(n.minute)||isNaN(n.second))throw new Error(`toTZ: Failed to parse all date components from timezone '${e}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(n)}`);return n.hour===24&&(n.hour=0),{y:n.year,m:n.month,d:n.day,h:n.hour,i:n.minute,s:n.second,tz:e}}i(uo,"g");function xa(r,e,t,o,n,s,a){return{y:r,m:e,d:t,h:o,i:n,s,tz:a}}i(xa,"b");var Vu=[1,2,4,8,16],Dn=class{static{i(this,"C")}pattern;timezone;mode;alternativeWeekdays;sloppyRanges;second;minute;hour;day;month;dayOfWeek;year;lastDayOfMonth;lastWeekday;nearestWeekdays;starDOM;starDOW;starYear;useAndLogic;constructor(r,e,t){this.pattern=r,this.timezone=e,this.mode=t?.mode??"auto",this.alternativeWeekdays=t?.alternativeWeekdays??!1,this.sloppyRanges=t?.sloppyRanges??!1,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.year=Array(1e4).fill(0),this.lastDayOfMonth=!1,this.lastWeekday=!1,this.nearestWeekdays=Array(31).fill(0),this.starDOM=!1,this.starDOW=!1,this.starYear=!1,this.useAndLogic=!1,this.parse()}parse(){if(!(typeof this.pattern=="string"||this.pattern instanceof String))throw new TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let r=this.pattern.match(/\S+/g)||[""],e=r.length;if(r.length<5||r.length>7)throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five, six, or seven space separated parts are required.");if(this.mode!=="auto"){let o;switch(this.mode){case"5-part":o=5;break;case"6-part":o=6;break;case"7-part":o=7;break;case"5-or-6-parts":o=[5,6];break;case"6-or-7-parts":o=[6,7];break;default:o=0}if(!(Array.isArray(o)?o.includes(e):e===o)){let n=Array.isArray(o)?o.join(" or "):o.toString();throw new TypeError(`CronPattern: mode '${this.mode}' requires exactly ${n} parts, but pattern '${this.pattern}' has ${e} parts.`)}}if(r.length===5&&r.unshift("0"),r.length===6&&r.push("*"),r[3].toUpperCase()==="LW"?(this.lastWeekday=!0,r[3]=""):r[3].toUpperCase().indexOf("L")>=0&&(r[3]=r[3].replace(/L/gi,""),this.lastDayOfMonth=!0),r[3]=="*"&&(this.starDOM=!0),r[6]=="*"&&(this.starYear=!0),r[4].length>=3&&(r[4]=this.replaceAlphaMonths(r[4])),r[5].length>=3&&(r[5]=this.alternativeWeekdays?this.replaceAlphaDaysQuartz(r[5]):this.replaceAlphaDays(r[5])),r[5].startsWith("+")&&(this.useAndLogic=!0,r[5]=r[5].substring(1),r[5]===""))throw new TypeError("CronPattern: Day-of-week field cannot be empty after '+' modifier.");switch(r[5]=="*"&&(this.starDOW=!0),this.pattern.indexOf("?")>=0&&(r[0]=r[0].replace(/\?/g,"*"),r[1]=r[1].replace(/\?/g,"*"),r[2]=r[2].replace(/\?/g,"*"),r[3]=r[3].replace(/\?/g,"*"),r[4]=r[4].replace(/\?/g,"*"),r[5]=r[5].replace(/\?/g,"*"),r[6]&&(r[6]=r[6].replace(/\?/g,"*"))),this.mode){case"5-part":r[0]="0",r[6]="*";break;case"6-part":r[6]="*";break;case"5-or-6-parts":r[6]="*";break;case"6-or-7-parts":break;case"7-part":case"auto":break}this.throwAtIllegalCharacters(r),this.partToArray("second",r[0],0,1),this.partToArray("minute",r[1],0,1),this.partToArray("hour",r[2],0,1),this.partToArray("day",r[3],-1,1),this.partToArray("month",r[4],-1,1);let t=this.alternativeWeekdays?-1:0;this.partToArray("dayOfWeek",r[5],t,63),this.partToArray("year",r[6],0,1),!this.alternativeWeekdays&&this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(r,e,t,o){let n=this[r],s=r==="day"&&this.lastDayOfMonth,a=r==="day"&&this.lastWeekday;if(e===""&&!s&&!a)throw new TypeError("CronPattern: configuration entry "+r+" ("+e+") is empty, check for trailing spaces.");if(e==="*")return n.fill(o);let u=e.split(",");if(u.length>1)for(let c=0;c<u.length;c++)this.partToArray(r,u[c],t,o);else e.indexOf("-")!==-1&&e.indexOf("/")!==-1?this.handleRangeWithStepping(e,r,t,o):e.indexOf("-")!==-1?this.handleRange(e,r,t,o):e.indexOf("/")!==-1?this.handleStepping(e,r,t,o):e!==""&&this.handleNumber(e,r,t,o)}throwAtIllegalCharacters(r){for(let e=0;e<r.length;e++)if((e===3?/[^/*0-9,\-WwLl]+/:e===5?/[^/*0-9,\-#Ll]+/:/[^/*0-9,\-]+/).test(r[e]))throw new TypeError("CronPattern: configuration entry "+e+" ("+r[e]+") contains illegal characters.")}handleNumber(r,e,t,o){let n=this.extractNth(r,e),s=r.toUpperCase().includes("W");if(e!=="day"&&s)throw new TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");s&&(e="nearestWeekdays");let a=parseInt(n[0],10)+t;if(isNaN(a))throw new TypeError("CronPattern: "+e+" is not a number: '"+r+"'");this.setPart(e,a,n[1]||o)}setPart(r,e,t){if(!Object.prototype.hasOwnProperty.call(this,r))throw new TypeError("CronPattern: Invalid part specified: "+r);if(r==="dayOfWeek"){if(e===7&&(e=0),e<0||e>6)throw new RangeError("CronPattern: Invalid value for dayOfWeek: "+e);this.setNthWeekdayOfMonth(e,t);return}if(r==="second"||r==="minute"){if(e<0||e>=60)throw new RangeError("CronPattern: Invalid value for "+r+": "+e)}else if(r==="hour"){if(e<0||e>=24)throw new RangeError("CronPattern: Invalid value for "+r+": "+e)}else if(r==="day"||r==="nearestWeekdays"){if(e<0||e>=31)throw new RangeError("CronPattern: Invalid value for "+r+": "+e)}else if(r==="month"){if(e<0||e>=12)throw new RangeError("CronPattern: Invalid value for "+r+": "+e)}else if(r==="year"&&(e<1||e>=1e4))throw new RangeError("CronPattern: Invalid value for "+r+": "+e+" (supported range: 1-9999)");this[r][e]=t}validateNotNaN(r,e){if(isNaN(r))throw new TypeError(e)}validateRange(r,e,t,o,n){if(r>e)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");if(t!==void 0){if(t===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(t>this[o].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[o].length+")")}}handleRangeWithStepping(r,e,t,o){if(r.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");let n=this.extractNth(r,e),s=n[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(s===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+r+"'");let[,a,u,c]=s,f=parseInt(a,10)+t,l=parseInt(u,10)+t,p=parseInt(c,10);this.validateNotNaN(f,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(l,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateNotNaN(p,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(f,l,p,e,r);for(let m=f;m<=l;m+=p)this.setPart(e,m,n[1]||o)}extractNth(r,e){let t=r,o;if(t.includes("#")){if(e!=="dayOfWeek")throw new Error("CronPattern: nth (#) only allowed in day-of-week field");o=t.split("#")[1],t=t.split("#")[0]}else if(t.toUpperCase().endsWith("L")){if(e!=="dayOfWeek")throw new Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");o="L",t=t.slice(0,-1)}return[t,o]}handleRange(r,e,t,o){if(r.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in a range.");let n=this.extractNth(r,e),s=n[0].split("-");if(s.length!==2)throw new TypeError("CronPattern: Syntax error, illegal range: '"+r+"'");let a=parseInt(s[0],10)+t,u=parseInt(s[1],10)+t;this.validateNotNaN(a,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(u,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateRange(a,u,void 0,e,r);for(let c=a;c<=u;c++)this.setPart(e,c,n[1]||o)}handleStepping(r,e,t,o){if(r.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");let n=this.extractNth(r,e),s=n[0].split("/");if(s.length!==2)throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+r+"'");if(this.sloppyRanges)s[0]===""&&(s[0]="*");else{if(s[0]==="")throw new TypeError("CronPattern: Syntax error, stepping with missing prefix ('"+r+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");if(s[0]!=="*")throw new TypeError("CronPattern: Syntax error, stepping with numeric prefix ('"+r+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.")}let a=0;s[0]!=="*"&&(a=parseInt(s[0],10)+t);let u=parseInt(s[1],10);this.validateNotNaN(u,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(0,this[e].length-1,u,e,r);for(let c=a;c<this[e].length;c+=u)this.setPart(e,c,n[1]||o)}replaceAlphaDays(r){return r.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaDaysQuartz(r){return r.replace(/sun/gi,"1").replace(/mon/gi,"2").replace(/tue/gi,"3").replace(/wed/gi,"4").replace(/thu/gi,"5").replace(/fri/gi,"6").replace(/sat/gi,"7")}replaceAlphaMonths(r){return r.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames(r){let e=r.trim().toLowerCase();if(e==="@yearly"||e==="@annually")return"0 0 1 1 *";if(e==="@monthly")return"0 0 1 * *";if(e==="@weekly")return"0 0 * * 0";if(e==="@daily"||e==="@midnight")return"0 0 * * *";if(e==="@hourly")return"0 * * * *";if(e==="@reboot")throw new TypeError("CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.");return r}setNthWeekdayOfMonth(r,e){if(typeof e!="number"&&e.toUpperCase()==="L")this.dayOfWeek[r]=this.dayOfWeek[r]|32;else if(e===63)this.dayOfWeek[r]=63;else if(e<6&&e>0)this.dayOfWeek[r]=this.dayOfWeek[r]|Vu[e-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${e}, Type: ${typeof e}`)}},ga=[31,28,31,30,31,30,31,31,30,31,30,31],V=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],Z=class Gu{static{i(this,"s")}tz;ms;second;minute;hour;day;month;year;constructor(e,t){if(this.tz=t,e&&e instanceof Date)if(!isNaN(e))this.fromDate(e);else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");else if(e==null)this.fromDate(new Date);else if(e&&typeof e=="string")this.fromString(e);else if(e instanceof Gu)this.fromCronDate(e);else throw new TypeError("CronDate: Invalid type ("+typeof e+") passed to CronDate constructor")}getLastDayOfMonth(e,t){return t!==1?ga[t]:new Date(Date.UTC(e,t+1,0)).getUTCDate()}getLastWeekday(e,t){let o=this.getLastDayOfMonth(e,t),n=new Date(Date.UTC(e,t,o)).getUTCDay();return n===0?o-2:n===6?o-1:o}getNearestWeekday(e,t,o){let n=this.getLastDayOfMonth(e,t);if(o>n)return-1;let s=new Date(Date.UTC(e,t,o)).getUTCDay();return s===0?o===n?o-2:o+1:s===6?o===1?o+2:o-1:o}isNthWeekdayOfMonth(e,t,o,n){let s=new Date(Date.UTC(e,t,o)).getUTCDay(),a=0;for(let u=1;u<=o;u++)new Date(Date.UTC(e,t,u)).getUTCDay()===s&&a++;if(n&63&&Vu[a-1]&n)return!0;if(n&32){let u=this.getLastDayOfMonth(e,t);for(let c=o+1;c<=u;c++)if(new Date(Date.UTC(e,t,c)).getUTCDay()===s)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz=="number")this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else try{let t=uo(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}catch(t){let o=t instanceof Error?t.message:String(t);throw new TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${o}`)}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.month<0||this.day>ga[this.month]||this.day<1||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz=="number"){let t=Bu(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(Bu(e,this.tz))}findNext(e,t,o,n){return this._findMatch(e,t,o,n,1)}_findMatch(e,t,o,n,s){let a=this[t],u;o.lastDayOfMonth&&(u=this.getLastDayOfMonth(this.year,this.month));let c=!o.starDOW&&t=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0,f=this[t]+n,l=s===1?p=>p<o[t].length:p=>p>=0;for(let p=f;l(p);p+=s){let m=o[t][p];if(t==="day"&&!m){for(let h=0;h<o.nearestWeekdays.length;h++)if(o.nearestWeekdays[h]){let x=this.getNearestWeekday(this.year,this.month,h-n);if(x===-1)continue;if(x===p-n){m=1;break}}}if(t==="day"&&o.lastWeekday){let h=this.getLastWeekday(this.year,this.month);p-n===h&&(m=1)}if(t==="day"&&o.lastDayOfMonth&&p-n==u&&(m=1),t==="day"&&!o.starDOW){let h=o.dayOfWeek[(c+(p-n-1))%7];if(h&&h&63)h=this.isNthWeekdayOfMonth(this.year,this.month,p-n,h)?1:0;else if(h)throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${h}`);o.useAndLogic?m=m&&h:!e.domAndDow&&!o.starDOM?m=m||h:m=m&&h}if(m)return this[t]=p-n,a!==this[t]?2:1}return 3}recurse(e,t,o){if(o===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let s=-1;for(let a=this.year+1;a<e.year.length&&a<1e4;a++)if(e.year[a]===1){s=a;break}if(s===-1)return null;this.year=s,this.month=0,this.day=1,this.hour=0,this.minute=0,this.second=0,this.ms=0}if(this.year>=1e4)return null}let n=this.findNext(t,V[o][0],e,V[o][2]);if(n>1){let s=o+1;for(;s<V.length;)this[V[s][0]]=-V[s][2],s++;if(n===3){if(this[V[o][1]]++,this[V[o][0]]=-V[o][2],this.apply(),o===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0&&this.year<1e4;)this.year++;if(this.year>=1e4||this.year>=e.year.length)return null}return this.recurse(e,t,0)}else if(this.apply())return this.recurse(e,t,o-1)}return o+=1,o>=V.length?this:(e.starYear?this.year>=3e3:this.year>=1e4)?null:this.recurse(e,t,o)}increment(e,t,o){return this.second+=t.interval!==void 0&&t.interval>1&&o?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}decrement(e,t){return this.second-=t.interval!==void 0&&t.interval>1?t.interval:1,this.ms=0,this.apply(),this.recurseBackward(e,t,0,0)}recurseBackward(e,t,o,n=0){if(n>1e4)return null;if(o===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let a=-1;for(let u=this.year-1;u>=0;u--)if(e.year[u]===1){a=u;break}if(a===-1)return null;this.year=a,this.month=11,this.day=31,this.hour=23,this.minute=59,this.second=59,this.ms=0}if(this.year<0)return null}let s=this.findPrevious(t,V[o][0],e,V[o][2]);if(s>1){let a=o+1;for(;a<V.length;){let u=V[a][0],c=V[a][2],f=this.getMaxPatternValue(u,e,c);this[u]=f,a++}if(s===3){if(this[V[o][1]]--,o===0){let l=this.getLastDayOfMonth(this.year,this.month);this.day>l&&(this.day=l)}if(o===1)if(this.day<=0)this.day=1;else{let l=this.year,p=this.month;for(;p<0;)p+=12,l--;for(;p>11;)p-=12,l++;let m=p!==1?ga[p]:new Date(Date.UTC(l,p+1,0)).getUTCDate();this.day>m&&(this.day=m)}this.apply();let u=V[o][0],c=V[o][2],f=this.getMaxPatternValue(u,e,c);if(u==="day"){let l=this.getLastDayOfMonth(this.year,this.month);this[u]=Math.min(f,l)}else this[u]=f;if(this.apply(),o===0){let l=V[1][2],p=this.getMaxPatternValue("day",e,l),m=this.getLastDayOfMonth(this.year,this.month),h=Math.min(p,m);h!==this.day&&(this.day=h,this.hour=this.getMaxPatternValue("hour",e,V[2][2]),this.minute=this.getMaxPatternValue("minute",e,V[3][2]),this.second=this.getMaxPatternValue("second",e,V[4][2]))}if(o===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0;)this.year--;if(this.year<0)return null}return this.recurseBackward(e,t,0,n+1)}else if(this.apply())return this.recurseBackward(e,t,o-1,n+1)}return o+=1,o>=V.length?this:this.year<0?null:this.recurseBackward(e,t,o,n+1)}getMaxPatternValue(e,t,o){if(e==="day"&&t.lastDayOfMonth)return this.getLastDayOfMonth(this.year,this.month);if(e==="day"&&!t.starDOW)return this.getLastDayOfMonth(this.year,this.month);for(let n=t[e].length-1;n>=0;n--)if(t[e][n])return n-o;return t[e].length-1-o}findPrevious(e,t,o,n){return this._findMatch(e,t,o,n,-1)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz=="number"?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):zu(xa(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}match(e,t){if(!e.starYear&&(this.year<0||this.year>=e.year.length||e.year[this.year]===0))return!1;for(let o=0;o<V.length;o++){let n=V[o][0],s=V[o][2],a=this[n];if(a+s<0||a+s>=e[n].length)return!1;let u=e[n][a+s];if(n==="day"){if(!u){for(let c=0;c<e.nearestWeekdays.length;c++)if(e.nearestWeekdays[c]){let f=this.getNearestWeekday(this.year,this.month,c-s);if(f!==-1&&f===a){u=1;break}}}if(e.lastWeekday){let c=this.getLastWeekday(this.year,this.month);a===c&&(u=1)}if(e.lastDayOfMonth){let c=this.getLastDayOfMonth(this.year,this.month);a===c&&(u=1)}if(!e.starDOW){let c=new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay(),f=e.dayOfWeek[(c+(a-1))%7];f&&f&63&&(f=this.isNthWeekdayOfMonth(this.year,this.month,a,f)?1:0),e.useAndLogic?u=u&&f:!t.domAndDow&&!e.starDOM?u=u||f:u=u&&f}}if(!u)return!1}return!0}};function ky(r){if(r===void 0&&(r={}),delete r.name,r.legacyMode!==void 0&&r.domAndDow===void 0?r.domAndDow=!r.legacyMode:r.domAndDow===void 0&&(r.domAndDow=!1),r.legacyMode=!r.domAndDow,r.paused=r.paused===void 0?!1:r.paused,r.maxRuns=r.maxRuns===void 0?1/0:r.maxRuns,r.catch=r.catch===void 0?!1:r.catch,r.interval=r.interval===void 0?0:parseInt(r.interval.toString(),10),r.utcOffset=r.utcOffset===void 0?void 0:parseInt(r.utcOffset.toString(),10),r.dayOffset=r.dayOffset===void 0?0:parseInt(r.dayOffset.toString(),10),r.unref=r.unref===void 0?!1:r.unref,r.mode=r.mode===void 0?"auto":r.mode,r.alternativeWeekdays=r.alternativeWeekdays===void 0?!1:r.alternativeWeekdays,r.sloppyRanges=r.sloppyRanges===void 0?!1:r.sloppyRanges,!["auto","5-part","6-part","7-part","5-or-6-parts","6-or-7-parts"].includes(r.mode))throw new Error("CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.");if(r.startAt&&(r.startAt=new Z(r.startAt,r.timezone)),r.stopAt&&(r.stopAt=new Z(r.stopAt,r.timezone)),r.interval!==null){if(isNaN(r.interval))throw new Error("CronOptions: Supplied value for interval is not a number");if(r.interval<0)throw new Error("CronOptions: Supplied value for interval can not be negative")}if(r.utcOffset!==void 0){if(isNaN(r.utcOffset))throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if(r.utcOffset<-870||r.utcOffset>870)throw new Error("CronOptions: utcOffset out of bounds.");if(r.utcOffset!==void 0&&r.timezone)throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if(r.unref!==!0&&r.unref!==!1)throw new Error("CronOptions: Unref should be either true, false or undefined(false).");if(r.dayOffset!==void 0&&r.dayOffset!==0&&isNaN(r.dayOffset))throw new Error("CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.");return r}i(ky,"R");function co(r){return Object.prototype.toString.call(r)==="[object Function]"||typeof r=="function"||r instanceof Function}i(co,"p");function Iy(r){return co(r)}i(Iy,"_");function Py(r){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(r):r&&typeof r.unref<"u"&&r.unref()}i(Py,"x");var Au=30*1e3,fr=[],Ju=class{static{i(this,"E")}name;options;_states;fn;getTz(){return this.options.timezone||this.options.utcOffset}applyDayOffset(r){if(this.options.dayOffset!==void 0&&this.options.dayOffset!==0){let e=this.options.dayOffset*24*60*60*1e3;return new Date(r.getTime()+e)}return r}constructor(r,e,t){let o,n;if(co(e))n=e;else if(typeof e=="object")o=e;else if(e!==void 0)throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(co(t))n=t;else if(typeof t=="object")o=t;else if(t!==void 0)throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=o?.name,this.options=ky(o),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:o?o.maxRuns:void 0,paused:o?o.paused:!1,pattern:new Dn("* * * * *",void 0,{mode:"auto"})},r&&(r instanceof Date||typeof r=="string"&&r.indexOf(":")>0)?this._states.once=new Z(r,this.getTz()):this._states.pattern=new Dn(r,this.options.timezone,{mode:this.options.mode,alternativeWeekdays:this.options.alternativeWeekdays,sloppyRanges:this.options.sloppyRanges}),this.name){if(fr.find(s=>s.name===this.name))throw new Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");fr.push(this)}return n!==void 0&&Iy(n)&&(this.fn=n,this.schedule()),this}nextRun(r){let e=this._next(r);return e?this.applyDayOffset(e.getDate(!1)):null}nextRuns(r,e){this._states.maxRuns!==void 0&&r>this._states.maxRuns&&(r=this._states.maxRuns);let t=e||this._states.currentRun||void 0;return this._enumerateRuns(r,t,"next")}previousRuns(r,e){return this._enumerateRuns(r,e||void 0,"previous")}_enumerateRuns(r,e,t){let o=[],n=e?new Z(e,this.getTz()):null,s=t==="next"?this._next:this._previous;for(;r--;){let a=s.call(this,n);if(!a)break;let u=a.getDate(!1);o.push(this.applyDayOffset(u)),n=a}return o}match(r){if(this._states.once){let t=new Z(r,this.getTz());t.ms=0;let o=new Z(this._states.once,this.getTz());return o.ms=0,t.getTime()===o.getTime()}let e=new Z(r,this.getTz());return e.ms=0,e.match(this._states.pattern,this.options)}getPattern(){if(!this._states.once)return this._states.pattern?this._states.pattern.pattern:void 0}getOnce(){return this._states.once?this._states.once.getDate():null}isRunning(){let r=this.nextRun(this._states.currentRun),e=!this._states.paused,t=this.fn!==void 0,o=!this._states.kill;return e&&t&&o&&r!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(r){let e=this._next(r);return e?r instanceof Z||r instanceof Date?e.getTime()-r.getTime():e.getTime()-new Z(r).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let r=fr.indexOf(this);r>=0&&fr.splice(r,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(r){if(r&&this.fn)throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");r&&(this.fn=r);let e=this.msToNext(),t=this.nextRun(this._states.currentRun);return e==null||isNaN(e)||t===null?this:(e>Au&&(e=Au),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(t),e),this._states.currentTimeout&&this.options.unref&&Py(this._states.currentTimeout),this)}async _trigger(r){this._states.blocking=!0,this._states.currentRun=new Z(void 0,this.getTz());try{if(this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){if(co(this.options.catch))try{this.options.catch(e,this)}catch{}}else this.fn!==void 0&&await this.fn(this,this.options.context)}finally{this._states.previousRun=new Z(r,this.getTz()),this._states.blocking=!1}}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(r){let e=new Date,t=!this._states.paused&&e.getTime()>=r.getTime(),o=this._states.blocking&&this.options.protect;t&&!o?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):t&&o&&co(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(r){let e=!!(r||this._states.currentRun),t=!1;!r&&this.options.startAt&&this.options.interval&&([r,e]=this._calculatePreviousRun(r,e),t=!r),r=new Z(r,this.getTz()),this.options.startAt&&r&&r.getTime()<this.options.startAt.getTime()&&(r=this.options.startAt);let o=this._states.once||new Z(r,this.getTz());return!t&&o!==this._states.once&&(o=o.increment(this._states.pattern,this.options,e)),this._states.once&&this._states.once.getTime()<=r.getTime()||o===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&o.getTime()>=this.options.stopAt.getTime()?null:o}_previous(r){let e=new Z(r,this.getTz());this.options.stopAt&&e.getTime()>this.options.stopAt.getTime()&&(e=this.options.stopAt);let t=new Z(e,this.getTz());return this._states.once?this._states.once.getTime()<e.getTime()?this._states.once:null:(t=t.decrement(this._states.pattern,this.options),t===null||this.options.startAt&&t.getTime()<this.options.startAt.getTime()?null:t)}_calculatePreviousRun(r,e){let t=new Z(void 0,this.getTz()),o=r;if(this.options.startAt.getTime()<=t.getTime()){o=this.options.startAt;let n=o.getTime()+this.options.interval*1e3;for(;n<=t.getTime();)o=new Z(o,this.getTz()).increment(this._states.pattern,this.options,!0),n=o.getTime()+this.options.interval*1e3;e=!0}return o===null&&(o=void 0),[o,e]}};var vo={};A(vo,{add:()=>ft,addBusinessDays:()=>Rn,addDays:()=>ee,addHours:()=>Nn,addISOWeekYears:()=>Fn,addMilliseconds:()=>lt,addMinutes:()=>mr,addMonths:()=>$e,addQuarters:()=>hr,addSeconds:()=>Ln,addWeeks:()=>dt,addYears:()=>Yn,areIntervalsOverlapping:()=>ec,clamp:()=>tc,closestIndexTo:()=>jn,closestTo:()=>rc,compareAsc:()=>pe,compareDesc:()=>oc,constructFrom:()=>y,constructNow:()=>R,daysToWeeks:()=>nc,differenceInBusinessDays:()=>ic,differenceInCalendarDays:()=>ne,differenceInCalendarISOWeekYears:()=>$n,differenceInCalendarISOWeeks:()=>sc,differenceInCalendarMonths:()=>Yt,differenceInCalendarQuarters:()=>yr,differenceInCalendarWeeks:()=>qt,differenceInCalendarYears:()=>pt,differenceInDays:()=>xr,differenceInHours:()=>Ht,differenceInISOWeekYears:()=>uc,differenceInMilliseconds:()=>gr,differenceInMinutes:()=>jt,differenceInMonths:()=>mt,differenceInQuarters:()=>cc,differenceInSeconds:()=>Ae,differenceInWeeks:()=>fc,differenceInYears:()=>Vn,eachDayOfInterval:()=>An,eachHourOfInterval:()=>lc,eachMinuteOfInterval:()=>dc,eachMonthOfInterval:()=>pc,eachQuarterOfInterval:()=>mc,eachWeekOfInterval:()=>hc,eachWeekendOfInterval:()=>vr,eachWeekendOfMonth:()=>yc,eachWeekendOfYear:()=>xc,eachYearOfInterval:()=>gc,endOfDay:()=>wr,endOfDecade:()=>wc,endOfHour:()=>bc,endOfISOWeek:()=>vc,endOfISOWeekYear:()=>Tc,endOfMinute:()=>Dc,endOfMonth:()=>br,endOfQuarter:()=>Sc,endOfSecond:()=>Mc,endOfToday:()=>Oc,endOfTomorrow:()=>Ec,endOfWeek:()=>Jn,endOfYear:()=>Gn,endOfYesterday:()=>kc,format:()=>yo,formatDate:()=>yo,formatDistance:()=>ei,formatDistanceStrict:()=>ti,formatDistanceToNow:()=>qc,formatDistanceToNowStrict:()=>Hc,formatDuration:()=>jc,formatISO:()=>Uc,formatISO9075:()=>$c,formatISODuration:()=>Bc,formatRFC3339:()=>zc,formatRFC7231:()=>Vc,formatRelative:()=>Ac,formatters:()=>mo,fromUnixTime:()=>Gc,getDate:()=>ri,getDay:()=>gt,getDayOfYear:()=>Qn,getDaysInMonth:()=>oi,getDaysInYear:()=>Jc,getDecade:()=>Kc,getDefaultOptions:()=>ii,getHours:()=>Qc,getISODay:()=>si,getISOWeek:()=>Mr,getISOWeekYear:()=>be,getISOWeeksInYear:()=>Xc,getMilliseconds:()=>Zc,getMinutes:()=>ef,getMonth:()=>tf,getOverlappingDaysInIntervals:()=>rf,getQuarter:()=>po,getSeconds:()=>of,getTime:()=>nf,getUnixTime:()=>sf,getWeek:()=>Or,getWeekOfMonth:()=>af,getWeekYear:()=>yt,getWeeksInMonth:()=>uf,getYear:()=>cf,hoursToMilliseconds:()=>ff,hoursToMinutes:()=>lf,hoursToSeconds:()=>df,interval:()=>pf,intervalToDuration:()=>mf,intlFormat:()=>hf,intlFormatDistance:()=>yf,isAfter:()=>xf,isBefore:()=>gf,isDate:()=>Un,isEqual:()=>wf,isExists:()=>bf,isFirstDayOfMonth:()=>vf,isFriday:()=>Tf,isFuture:()=>Df,isLastDayOfMonth:()=>zn,isLeapYear:()=>ni,isMatch:()=>Sf,isMonday:()=>Mf,isPast:()=>Of,isSameDay:()=>Ve,isSameHour:()=>Qi,isSameISOWeek:()=>Xi,isSameISOWeekYear:()=>Ef,isSameMinute:()=>Zi,isSameMonth:()=>es,isSameQuarter:()=>ts,isSameSecond:()=>rs,isSameWeek:()=>Pr,isSameYear:()=>os,isSaturday:()=>Cn,isSunday:()=>_n,isThisHour:()=>kf,isThisISOWeek:()=>If,isThisMinute:()=>Pf,isThisMonth:()=>Cf,isThisQuarter:()=>_f,isThisSecond:()=>Rf,isThisWeek:()=>Nf,isThisYear:()=>Wf,isThursday:()=>Ff,isToday:()=>Lf,isTomorrow:()=>Yf,isTuesday:()=>qf,isValid:()=>ce,isWednesday:()=>Hf,isWeekend:()=>Be,isWithinInterval:()=>jf,isYesterday:()=>Uf,lastDayOfDecade:()=>$f,lastDayOfISOWeek:()=>Bf,lastDayOfISOWeekYear:()=>zf,lastDayOfMonth:()=>ai,lastDayOfQuarter:()=>Vf,lastDayOfWeek:()=>ns,lastDayOfYear:()=>Af,lightFormat:()=>Gf,lightFormatters:()=>Ee,longFormatters:()=>xt,max:()=>qn,milliseconds:()=>Jf,millisecondsToHours:()=>Kf,millisecondsToMinutes:()=>Qf,millisecondsToSeconds:()=>Xf,min:()=>Hn,minutesToHours:()=>Zf,minutesToMilliseconds:()=>el,minutesToSeconds:()=>tl,monthsToQuarters:()=>rl,monthsToYears:()=>ol,nextDay:()=>he,nextFriday:()=>nl,nextMonday:()=>il,nextSaturday:()=>sl,nextSunday:()=>al,nextThursday:()=>ul,nextTuesday:()=>cl,nextWednesday:()=>fl,parse:()=>Ki,parseISO:()=>dl,parseJSON:()=>pl,parsers:()=>Ji,previousDay:()=>ye,previousFriday:()=>ml,previousMonday:()=>hl,previousSaturday:()=>yl,previousSunday:()=>xl,previousThursday:()=>gl,previousTuesday:()=>wl,previousWednesday:()=>bl,quartersToMonths:()=>vl,quartersToYears:()=>Tl,roundToNearestHours:()=>Dl,roundToNearestMinutes:()=>Sl,secondsToHours:()=>Ml,secondsToMilliseconds:()=>Ol,secondsToMinutes:()=>El,set:()=>kl,setDate:()=>Il,setDay:()=>wt,setDayOfYear:()=>Pl,setDefaultOptions:()=>Cl,setHours:()=>_l,setISODay:()=>Ri,setISOWeek:()=>Oi,setISOWeekYear:()=>Wn,setMilliseconds:()=>Rl,setMinutes:()=>Nl,setMonth:()=>Cr,setQuarter:()=>Wl,setSeconds:()=>Fl,setWeek:()=>Si,setWeekYear:()=>Ll,setYear:()=>Yl,startOfDay:()=>ze,startOfDecade:()=>ql,startOfHour:()=>xo,startOfISOWeek:()=>X,startOfISOWeekYear:()=>Oe,startOfMinute:()=>go,startOfMonth:()=>ht,startOfQuarter:()=>Ge,startOfSecond:()=>wo,startOfToday:()=>Hl,startOfTomorrow:()=>jl,startOfWeek:()=>U,startOfWeekYear:()=>Ut,startOfYear:()=>Tr,startOfYesterday:()=>Ul,sub:()=>$l,subBusinessDays:()=>Bl,subDays:()=>bt,subHours:()=>zl,subISOWeekYears:()=>Bn,subMilliseconds:()=>Vl,subMinutes:()=>Al,subMonths:()=>ss,subQuarters:()=>Gl,subSeconds:()=>Jl,subWeeks:()=>Kl,subYears:()=>Ql,toDate:()=>d,transpose:()=>ui,weeksToDays:()=>Xl,yearsToDays:()=>Zl,yearsToMonths:()=>ed,yearsToQuarters:()=>td});var Mn=7,lo=365.2425,Cy=Math.pow(10,8)*24*60*60*1e3,lC=-Cy,Ue=6048e5,On=864e5,de=6e4,Me=36e5,lr=1e3,wa=525600,ct=43200,dr=1440,En=60,kn=3,In=12,Pn=4,Lt=3600,pr=60,Sn=Lt*24,Ku=Sn*7,ba=Sn*365.2425,va=ba/12,Qu=va*3,Ta=Symbol.for("constructDateFrom");function y(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&Ta in r?r[Ta](e):r instanceof Date?new r.constructor(e):new Date(e)}i(y,"constructFrom");var mC=y;function d(r,e){return y(e||r,r)}i(d,"toDate");var gC=d;function ee(r,e,t){let o=d(r,t?.in);return isNaN(e)?y(t?.in||r,NaN):(e&&o.setDate(o.getDate()+e),o)}i(ee,"addDays");var DC=ee;function $e(r,e,t){let o=d(r,t?.in);if(isNaN(e))return y(t?.in||r,NaN);if(!e)return o;let n=o.getDate(),s=y(t?.in||r,o.getTime());s.setMonth(o.getMonth()+e+1,0);let a=s.getDate();return n>=a?s:(o.setFullYear(s.getFullYear(),s.getMonth(),n),o)}i($e,"addMonths");var kC=$e;function ft(r,e,t){let{years:o=0,months:n=0,weeks:s=0,days:a=0,hours:u=0,minutes:c=0,seconds:f=0}=e,l=d(r,t?.in),p=n||o?$e(l,n+o*12):l,m=a||s?ee(p,a+s*7):p,h=c+u*60,g=(f+h*60)*1e3;return y(t?.in||r,+m+g)}i(ft,"add");var WC=ft;function Cn(r,e){return d(r,e?.in).getDay()===6}i(Cn,"isSaturday");var qC=Cn;function _n(r,e){return d(r,e?.in).getDay()===0}i(_n,"isSunday");var $C=_n;function Be(r,e){let t=d(r,e?.in).getDay();return t===0||t===6}i(Be,"isWeekend");var AC=Be;function Rn(r,e,t){let o=d(r,t?.in),n=Be(o,t);if(isNaN(e))return y(t?.in,NaN);let s=o.getHours(),a=e<0?-1:1,u=Math.trunc(e/5);o.setDate(o.getDate()+u*7);let c=Math.abs(e%5);for(;c>0;)o.setDate(o.getDate()+a),Be(o,t)||(c-=1);return n&&Be(o,t)&&e!==0&&(Cn(o,t)&&o.setDate(o.getDate()+(a<0?2:-1)),_n(o,t)&&o.setDate(o.getDate()+(a<0?1:-2))),o.setHours(s),o}i(Rn,"addBusinessDays");var t_=Rn;function lt(r,e,t){return y(t?.in||r,+d(r)+e)}i(lt,"addMilliseconds");var s_=lt;function Nn(r,e,t){return lt(r,e*Me,t)}i(Nn,"addHours");var l_=Nn;var Xu={};function L(){return Xu}i(L,"getDefaultOptions");function Zu(r){Xu=r}i(Zu,"setDefaultOptions");function U(r,e){let t=L(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=d(r,e?.in),s=n.getDay(),a=(s<o?7:0)+s-o;return n.setDate(n.getDate()-a),n.setHours(0,0,0,0),n}i(U,"startOfWeek");var g_=U;function X(r,e){return U(r,{...e,weekStartsOn:1})}i(X,"startOfISOWeek");var T_=X;function be(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=y(t,0);n.setFullYear(o+1,0,4),n.setHours(0,0,0,0);let s=X(n),a=y(t,0);a.setFullYear(o,0,4),a.setHours(0,0,0,0);let u=X(a);return t.getTime()>=s.getTime()?o+1:t.getTime()>=u.getTime()?o:o-1}i(be,"getISOWeekYear");var k_=be;function J(r){let e=d(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}i(J,"getTimezoneOffsetInMilliseconds");function O(r,...e){let t=y.bind(null,r||e.find(o=>typeof o=="object"));return e.map(t)}i(O,"normalizeDates");function ze(r,e){let t=d(r,e?.in);return t.setHours(0,0,0,0),t}i(ze,"startOfDay");var Y_=ze;function ne(r,e,t){let[o,n]=O(t?.in,r,e),s=ze(o),a=ze(n),u=+s-J(s),c=+a-J(a);return Math.round((u-c)/On)}i(ne,"differenceInCalendarDays");var z_=ne;function Oe(r,e){let t=be(r,e),o=y(e?.in||r,0);return o.setFullYear(t,0,4),o.setHours(0,0,0,0),X(o)}i(Oe,"startOfISOWeekYear");var Q_=Oe;function Wn(r,e,t){let o=d(r,t?.in),n=ne(o,Oe(o,t)),s=y(t?.in||r,0);return s.setFullYear(e,0,4),s.setHours(0,0,0,0),o=Oe(s),o.setDate(o.getDate()+n),o}i(Wn,"setISOWeekYear");var nR=Wn;function Fn(r,e,t){return Wn(r,be(r,t)+e,t)}i(Fn,"addISOWeekYears");var cR=Fn;function mr(r,e,t){let o=d(r,t?.in);return o.setTime(o.getTime()+e*de),o}i(mr,"addMinutes");var mR=mr;function hr(r,e,t){return $e(r,e*3,t)}i(hr,"addQuarters");var gR=hr;function Ln(r,e,t){return lt(r,e*1e3,t)}i(Ln,"addSeconds");var TR=Ln;function dt(r,e,t){return ee(r,e*7,t)}i(dt,"addWeeks");var OR=dt;function Yn(r,e,t){return $e(r,e*12,t)}i(Yn,"addYears");var PR=Yn;function ec(r,e,t){let[o,n]=[+d(r.start,t?.in),+d(r.end,t?.in)].sort((u,c)=>u-c),[s,a]=[+d(e.start,t?.in),+d(e.end,t?.in)].sort((u,c)=>u-c);return t?.inclusive?o<=a&&s<=n:o<a&&s<n}i(ec,"areIntervalsOverlapping");var NR=ec;function qn(r,e){let t,o=e?.in;return r.forEach(n=>{!o&&typeof n=="object"&&(o=y.bind(null,n));let s=d(n,o);(!t||t<s||isNaN(+s))&&(t=s)}),y(o,t||NaN)}i(qn,"max");var qR=qn;function Hn(r,e){let t,o=e?.in;return r.forEach(n=>{!o&&typeof n=="object"&&(o=y.bind(null,n));let s=d(n,o);(!t||t>s||isNaN(+s))&&(t=s)}),y(o,t||NaN)}i(Hn,"min");var BR=Hn;function tc(r,e,t){let[o,n,s]=O(t?.in,r,e.start,e.end);return Hn([qn([o,n],t),s],t)}i(tc,"clamp");var KR=tc;function jn(r,e){let t=+d(r);if(isNaN(t))return NaN;let o,n;return e.forEach((s,a)=>{let u=d(s);if(isNaN(+u)){o=NaN,n=NaN;return}let c=Math.abs(t-+u);(o==null||c<n)&&(o=a,n=c)}),o}i(jn,"closestIndexTo");var eN=jn;function rc(r,e,t){let[o,...n]=O(t?.in,r,...e),s=jn(o,n);if(typeof s=="number"&&isNaN(s))return y(o,NaN);if(s!==void 0)return n[s]}i(rc,"closestTo");var sN=rc;function pe(r,e){let t=+d(r)-+d(e);return t<0?-1:t>0?1:t}i(pe,"compareAsc");var fN=pe;function oc(r,e){let t=+d(r)-+d(e);return t>0?-1:t<0?1:t}i(oc,"compareDesc");var mN=oc;function R(r){return y(r,Date.now())}i(R,"constructNow");var gN=R;function nc(r){let e=Math.trunc(r/7);return e===0?0:e}i(nc,"daysToWeeks");var TN=nc;function Ve(r,e,t){let[o,n]=O(t?.in,r,e);return+ze(o)==+ze(n)}i(Ve,"isSameDay");var EN=Ve;function Un(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}i(Un,"isDate");var PN=Un;function ce(r){return!(!Un(r)&&typeof r!="number"||isNaN(+d(r)))}i(ce,"isValid");var WN=ce;function ic(r,e,t){let[o,n]=O(t?.in,r,e);if(!ce(o)||!ce(n))return NaN;let s=ne(o,n),a=s<0?-1:1,u=Math.trunc(s/7),c=u*5,f=ee(n,u*7);for(;!Ve(o,f);)c+=Be(f,t)?0:a,f=ee(f,a);return c===0?0:c}i(ic,"differenceInBusinessDays");var BN=ic;function $n(r,e,t){let[o,n]=O(t?.in,r,e);return be(o,t)-be(n,t)}i($n,"differenceInCalendarISOWeekYears");var JN=$n;function sc(r,e,t){let[o,n]=O(t?.in,r,e),s=X(o),a=X(n),u=+s-J(s),c=+a-J(a);return Math.round((u-c)/Ue)}i(sc,"differenceInCalendarISOWeeks");var rW=sc;function Yt(r,e,t){let[o,n]=O(t?.in,r,e),s=o.getFullYear()-n.getFullYear(),a=o.getMonth()-n.getMonth();return s*12+a}i(Yt,"differenceInCalendarMonths");var sW=Yt;function po(r,e){let t=d(r,e?.in);return Math.trunc(t.getMonth()/3)+1}i(po,"getQuarter");var fW=po;function yr(r,e,t){let[o,n]=O(t?.in,r,e),s=o.getFullYear()-n.getFullYear(),a=po(o)-po(n);return s*4+a}i(yr,"differenceInCalendarQuarters");var hW=yr;function qt(r,e,t){let[o,n]=O(t?.in,r,e),s=U(o,t),a=U(n,t),u=+s-J(s),c=+a-J(a);return Math.round((u-c)/Ue)}i(qt,"differenceInCalendarWeeks");var TW=qt;function pt(r,e,t){let[o,n]=O(t?.in,r,e);return o.getFullYear()-n.getFullYear()}i(pt,"differenceInCalendarYears");var OW=pt;function xr(r,e,t){let[o,n]=O(t?.in,r,e),s=ac(o,n),a=Math.abs(ne(o,n));o.setDate(o.getDate()-s*a);let u=+(ac(o,n)===-s),c=s*(a-u);return c===0?0:c}i(xr,"differenceInDays");function ac(r,e){let t=r.getFullYear()-e.getFullYear()||r.getMonth()-e.getMonth()||r.getDate()-e.getDate()||r.getHours()-e.getHours()||r.getMinutes()-e.getMinutes()||r.getSeconds()-e.getSeconds()||r.getMilliseconds()-e.getMilliseconds();return t<0?-1:t>0?1:t}i(ac,"compareLocalAsc");var CW=xr;function me(r){return e=>{let o=(r?Math[r]:Math.trunc)(e);return o===0?0:o}}i(me,"getRoundingMethod");function Ht(r,e,t){let[o,n]=O(t?.in,r,e),s=(+o-+n)/Me;return me(t?.roundingMethod)(s)}i(Ht,"differenceInHours");var qW=Ht;function Bn(r,e,t){return Fn(r,-e,t)}i(Bn,"subISOWeekYears");var $W=Bn;function uc(r,e,t){let[o,n]=O(t?.in,r,e),s=pe(o,n),a=Math.abs($n(o,n,t)),u=Bn(o,s*a,t),c=+(pe(u,n)===-s),f=s*(a-c);return f===0?0:f}i(uc,"differenceInISOWeekYears");var KW=uc;function gr(r,e){return+d(r)-+d(e)}i(gr,"differenceInMilliseconds");var eF=gr;function jt(r,e,t){let o=gr(r,e)/de;return me(t?.roundingMethod)(o)}i(jt,"differenceInMinutes");var sF=jt;function wr(r,e){let t=d(r,e?.in);return t.setHours(23,59,59,999),t}i(wr,"endOfDay");var fF=wr;function br(r,e){let t=d(r,e?.in),o=t.getMonth();return t.setFullYear(t.getFullYear(),o+1,0),t.setHours(23,59,59,999),t}i(br,"endOfMonth");var mF=br;function zn(r,e){let t=d(r,e?.in);return+wr(t,e)==+br(t,e)}i(zn,"isLastDayOfMonth");var bF=zn;function mt(r,e,t){let[o,n,s]=O(t?.in,r,r,e),a=pe(n,s),u=Math.abs(Yt(n,s));if(u<1)return 0;n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*u);let c=pe(n,s)===-a;zn(o)&&u===1&&pe(o,s)===1&&(c=!1);let f=a*(u-+c);return f===0?0:f}i(mt,"differenceInMonths");var EF=mt;function cc(r,e,t){let o=mt(r,e,t)/3;return me(t?.roundingMethod)(o)}i(cc,"differenceInQuarters");var _F=cc;function Ae(r,e,t){let o=gr(r,e)/1e3;return me(t?.roundingMethod)(o)}i(Ae,"differenceInSeconds");var LF=Ae;function fc(r,e,t){let o=xr(r,e,t)/7;return me(t?.roundingMethod)(o)}i(fc,"differenceInWeeks");var UF=fc;function Vn(r,e,t){let[o,n]=O(t?.in,r,e),s=pe(o,n),a=Math.abs(pt(o,n));o.setFullYear(1584),n.setFullYear(1584);let u=pe(o,n)===-s,c=s*(a-+u);return c===0?0:c}i(Vn,"differenceInYears");var GF=Vn;function ie(r,e){let[t,o]=O(r,e.start,e.end);return{start:t,end:o}}i(ie,"normalizeInterval");function An(r,e){let{start:t,end:o}=ie(e?.in,r),n=+t>+o,s=n?+t:+o,a=n?o:t;a.setHours(0,0,0,0);let u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a.setDate(a.getDate()+u),a.setHours(0,0,0,0);return n?c.reverse():c}i(An,"eachDayOfInterval");var rL=An;function lc(r,e){let{start:t,end:o}=ie(e?.in,r),n=+t>+o,s=n?+t:+o,a=n?o:t;a.setMinutes(0,0,0);let u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a.setHours(a.getHours()+u);return n?c.reverse():c}i(lc,"eachHourOfInterval");var aL=lc;function dc(r,e){let{start:t,end:o}=ie(e?.in,r);t.setSeconds(0,0);let n=+t>+o,s=n?+t:+o,a=n?o:t,u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a=mr(a,u);return n?c.reverse():c}i(dc,"eachMinuteOfInterval");var pL=dc;function pc(r,e){let{start:t,end:o}=ie(e?.in,r),n=+t>+o,s=n?+t:+o,a=n?o:t;a.setHours(0,0,0,0),a.setDate(1);let u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a.setMonth(a.getMonth()+u);return n?c.reverse():c}i(pc,"eachMonthOfInterval");var gL=pc;function Ge(r,e){let t=d(r,e?.in),o=t.getMonth(),n=o-o%3;return t.setMonth(n,1),t.setHours(0,0,0,0),t}i(Ge,"startOfQuarter");var TL=Ge;function mc(r,e){let{start:t,end:o}=ie(e?.in,r),n=+t>+o,s=n?+Ge(t):+Ge(o),a=n?Ge(o):Ge(t),u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a=hr(a,u);return n?c.reverse():c}i(mc,"eachQuarterOfInterval");var IL=mc;function hc(r,e){let{start:t,end:o}=ie(e?.in,r),n=+t>+o,s=n?U(o,e):U(t,e),a=n?U(t,e):U(o,e);s.setHours(15),a.setHours(15);let u=+a.getTime(),c=s,f=e?.step??1;if(!f)return[];f<0&&(f=-f,n=!n);let l=[];for(;+c<=u;)c.setHours(0),l.push(y(t,c)),c=dt(c,f),c.setHours(15);return n?l.reverse():l}i(hc,"eachWeekOfInterval");var FL=hc;function vr(r,e){let{start:t,end:o}=ie(e?.in,r),n=An({start:t,end:o},e),s=[],a=0;for(;a<n.length;){let u=n[a++];Be(u)&&s.push(y(t,u))}return s}i(vr,"eachWeekendOfInterval");var $L=vr;function ht(r,e){let t=d(r,e?.in);return t.setDate(1),t.setHours(0,0,0,0),t}i(ht,"startOfMonth");var AL=ht;function yc(r,e){let t=ht(r,e),o=br(r,e);return vr({start:t,end:o},e)}i(yc,"eachWeekendOfMonth");var ZL=yc;function Gn(r,e){let t=d(r,e?.in),o=t.getFullYear();return t.setFullYear(o+1,0,0),t.setHours(23,59,59,999),t}i(Gn,"endOfYear");var o2=Gn;function Tr(r,e){let t=d(r,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}i(Tr,"startOfYear");var a2=Tr;function xc(r,e){let t=Tr(r,e),o=Gn(r,e);return vr({start:t,end:o},e)}i(xc,"eachWeekendOfYear");var p2=xc;function gc(r,e){let{start:t,end:o}=ie(e?.in,r),n=+t>+o,s=n?+t:+o,a=n?o:t;a.setHours(0,0,0,0),a.setMonth(0,1);let u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a.setFullYear(a.getFullYear()+u);return n?c.reverse():c}i(gc,"eachYearOfInterval");var g2=gc;function wc(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=9+Math.floor(o/10)*10;return t.setFullYear(n,11,31),t.setHours(23,59,59,999),t}i(wc,"endOfDecade");var T2=wc;function bc(r,e){let t=d(r,e?.in);return t.setMinutes(59,59,999),t}i(bc,"endOfHour");var O2=bc;function Jn(r,e){let t=L(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=d(r,e?.in),s=n.getDay(),a=(s<o?-7:0)+6-(s-o);return n.setDate(n.getDate()+a),n.setHours(23,59,59,999),n}i(Jn,"endOfWeek");var C2=Jn;function vc(r,e){return Jn(r,{...e,weekStartsOn:1})}i(vc,"endOfISOWeek");var W2=vc;function Tc(r,e){let t=be(r,e),o=y(e?.in||r,0);o.setFullYear(t+1,0,4),o.setHours(0,0,0,0);let n=X(o,e);return n.setMilliseconds(n.getMilliseconds()-1),n}i(Tc,"endOfISOWeekYear");var j2=Tc;function Dc(r,e){let t=d(r,e?.in);return t.setSeconds(59,999),t}i(Dc,"endOfMinute");var z2=Dc;function Sc(r,e){let t=d(r,e?.in),o=t.getMonth(),n=o-o%3+3;return t.setMonth(n,0),t.setHours(23,59,59,999),t}i(Sc,"endOfQuarter");var J2=Sc;function Mc(r,e){let t=d(r,e?.in);return t.setMilliseconds(999),t}i(Mc,"endOfSecond");var Z2=Mc;function Oc(r){return wr(Date.now(),r)}i(Oc,"endOfToday");var oY=Oc;function Ec(r){let e=R(r?.in),t=e.getFullYear(),o=e.getMonth(),n=e.getDate(),s=R(r?.in);return s.setFullYear(t,o,n+1),s.setHours(23,59,59,999),r?.in?r.in(s):s}i(Ec,"endOfTomorrow");var aY=Ec;function kc(r){let e=R(r?.in),t=y(r?.in,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()-1),t.setHours(23,59,59,999),t}i(kc,"endOfYesterday");var dY=kc;var _y={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Ic=i((r,e,t)=>{let o,n=_y[r];return typeof n=="string"?o=n:e===1?o=n.one:o=n.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+o:o+" ago":o},"formatDistance");function Kn(r){return(e={})=>{let t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}i(Kn,"buildFormatLongFn");var Ry={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ny={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Wy={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Pc={date:Kn({formats:Ry,defaultWidth:"full"}),time:Kn({formats:Ny,defaultWidth:"full"}),dateTime:Kn({formats:Wy,defaultWidth:"full"})};var Fy={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Cc=i((r,e,t,o)=>Fy[r],"formatRelative");function Dr(r){return(e,t)=>{let o=t?.context?String(t.context):"standalone",n;if(o==="formatting"&&r.formattingValues){let a=r.defaultFormattingWidth||r.defaultWidth,u=t?.width?String(t.width):a;n=r.formattingValues[u]||r.formattingValues[a]}else{let a=r.defaultWidth,u=t?.width?String(t.width):r.defaultWidth;n=r.values[u]||r.values[a]}let s=r.argumentCallback?r.argumentCallback(e):e;return n[s]}}i(Dr,"buildLocalizeFn");var Ly={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Yy={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},qy={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Hy={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},jy={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Uy={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},$y=i((r,e)=>{let t=Number(r),o=t%100;if(o>20||o<10)switch(o%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},"ordinalNumber"),_c={ordinalNumber:$y,era:Dr({values:Ly,defaultWidth:"wide"}),quarter:Dr({values:Yy,defaultWidth:"wide",argumentCallback:i(r=>r-1,"argumentCallback")}),month:Dr({values:qy,defaultWidth:"wide"}),day:Dr({values:Hy,defaultWidth:"wide"}),dayPeriod:Dr({values:jy,defaultWidth:"wide",formattingValues:Uy,defaultFormattingWidth:"wide"})};function Sr(r){return(e,t={})=>{let o=t.width,n=o&&r.matchPatterns[o]||r.matchPatterns[r.defaultMatchWidth],s=e.match(n);if(!s)return null;let a=s[0],u=o&&r.parsePatterns[o]||r.parsePatterns[r.defaultParseWidth],c=Array.isArray(u)?zy(u,p=>p.test(a)):By(u,p=>p.test(a)),f;f=r.valueCallback?r.valueCallback(c):c,f=t.valueCallback?t.valueCallback(f):f;let l=e.slice(a.length);return{value:f,rest:l}}}i(Sr,"buildMatchFn");function By(r,e){for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}i(By,"findKey");function zy(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}i(zy,"findIndex");function Rc(r){return(e,t={})=>{let o=e.match(r.matchPattern);if(!o)return null;let n=o[0],s=e.match(r.parsePattern);if(!s)return null;let a=r.valueCallback?r.valueCallback(s[0]):s[0];a=t.valueCallback?t.valueCallback(a):a;let u=e.slice(n.length);return{value:a,rest:u}}}i(Rc,"buildMatchPatternFn");var Vy=/^(\d+)(th|st|nd|rd)?/i,Ay=/\d+/i,Gy={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Jy={any:[/^b/i,/^(a|c)/i]},Ky={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Qy={any:[/1/i,/2/i,/3/i,/4/i]},Xy={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Zy={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ex={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},tx={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},rx={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ox={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Nc={ordinalNumber:Rc({matchPattern:Vy,parsePattern:Ay,valueCallback:i(r=>parseInt(r,10),"valueCallback")}),era:Sr({matchPatterns:Gy,defaultMatchWidth:"wide",parsePatterns:Jy,defaultParseWidth:"any"}),quarter:Sr({matchPatterns:Ky,defaultMatchWidth:"wide",parsePatterns:Qy,defaultParseWidth:"any",valueCallback:i(r=>r+1,"valueCallback")}),month:Sr({matchPatterns:Xy,defaultMatchWidth:"wide",parsePatterns:Zy,defaultParseWidth:"any"}),day:Sr({matchPatterns:ex,defaultMatchWidth:"wide",parsePatterns:tx,defaultParseWidth:"any"}),dayPeriod:Sr({matchPatterns:rx,defaultMatchWidth:"any",parsePatterns:ox,defaultParseWidth:"any"})};var De={code:"en-US",formatDistance:Ic,formatLong:Pc,formatRelative:Cc,localize:_c,match:Nc,options:{weekStartsOn:0,firstWeekContainsDate:1}},jY=De;function Qn(r,e){let t=d(r,e?.in);return ne(t,Tr(t))+1}i(Qn,"getDayOfYear");var GY=Qn;function Mr(r,e){let t=d(r,e?.in),o=+X(t)-+Oe(t);return Math.round(o/Ue)+1}i(Mr,"getISOWeek");var tq=Mr;function yt(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=L(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=y(e?.in||r,0);a.setFullYear(o+1,0,s),a.setHours(0,0,0,0);let u=U(a,e),c=y(e?.in||r,0);c.setFullYear(o,0,s),c.setHours(0,0,0,0);let f=U(c,e);return+t>=+u?o+1:+t>=+f?o:o-1}i(yt,"getWeekYear");var uq=yt;function Ut(r,e){let t=L(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,n=yt(r,e),s=y(e?.in||r,0);return s.setFullYear(n,0,o),s.setHours(0,0,0,0),U(s,e)}i(Ut,"startOfWeekYear");var hq=Ut;function Or(r,e){let t=d(r,e?.in),o=+U(t,e)-+Ut(t,e);return Math.round(o/Ue)+1}i(Or,"getWeek");var Tq=Or;function M(r,e){let t=r<0?"-":"",o=Math.abs(r).toString().padStart(e,"0");return t+o}i(M,"addLeadingZeros");var Ee={y(r,e){let t=r.getFullYear(),o=t>0?t:1-t;return M(e==="yy"?o%100:o,e.length)},M(r,e){let t=r.getMonth();return e==="M"?String(t+1):M(t+1,2)},d(r,e){return M(r.getDate(),e.length)},a(r,e){let t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(r,e){return M(r.getHours()%12||12,e.length)},H(r,e){return M(r.getHours(),e.length)},m(r,e){return M(r.getMinutes(),e.length)},s(r,e){return M(r.getSeconds(),e.length)},S(r,e){let t=e.length,o=r.getMilliseconds(),n=Math.trunc(o*Math.pow(10,t-3));return M(n,e.length)}};var Er={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},mo={G:i(function(r,e,t){let o=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(o,{width:"abbreviated"});case"GGGGG":return t.era(o,{width:"narrow"});default:return t.era(o,{width:"wide"})}},"G"),y:i(function(r,e,t){if(e==="yo"){let o=r.getFullYear(),n=o>0?o:1-o;return t.ordinalNumber(n,{unit:"year"})}return Ee.y(r,e)},"y"),Y:i(function(r,e,t,o){let n=yt(r,o),s=n>0?n:1-n;if(e==="YY"){let a=s%100;return M(a,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):M(s,e.length)},"Y"),R:i(function(r,e){let t=be(r);return M(t,e.length)},"R"),u:i(function(r,e){let t=r.getFullYear();return M(t,e.length)},"u"),Q:i(function(r,e,t){let o=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(o);case"QQ":return M(o,2);case"Qo":return t.ordinalNumber(o,{unit:"quarter"});case"QQQ":return t.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(o,{width:"narrow",context:"formatting"});default:return t.quarter(o,{width:"wide",context:"formatting"})}},"Q"),q:i(function(r,e,t){let o=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(o);case"qq":return M(o,2);case"qo":return t.ordinalNumber(o,{unit:"quarter"});case"qqq":return t.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(o,{width:"narrow",context:"standalone"});default:return t.quarter(o,{width:"wide",context:"standalone"})}},"q"),M:i(function(r,e,t){let o=r.getMonth();switch(e){case"M":case"MM":return Ee.M(r,e);case"Mo":return t.ordinalNumber(o+1,{unit:"month"});case"MMM":return t.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(o,{width:"narrow",context:"formatting"});default:return t.month(o,{width:"wide",context:"formatting"})}},"M"),L:i(function(r,e,t){let o=r.getMonth();switch(e){case"L":return String(o+1);case"LL":return M(o+1,2);case"Lo":return t.ordinalNumber(o+1,{unit:"month"});case"LLL":return t.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(o,{width:"narrow",context:"standalone"});default:return t.month(o,{width:"wide",context:"standalone"})}},"L"),w:i(function(r,e,t,o){let n=Or(r,o);return e==="wo"?t.ordinalNumber(n,{unit:"week"}):M(n,e.length)},"w"),I:i(function(r,e,t){let o=Mr(r);return e==="Io"?t.ordinalNumber(o,{unit:"week"}):M(o,e.length)},"I"),d:i(function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):Ee.d(r,e)},"d"),D:i(function(r,e,t){let o=Qn(r);return e==="Do"?t.ordinalNumber(o,{unit:"dayOfYear"}):M(o,e.length)},"D"),E:i(function(r,e,t){let o=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(o,{width:"short",context:"formatting"});default:return t.day(o,{width:"wide",context:"formatting"})}},"E"),e:i(function(r,e,t,o){let n=r.getDay(),s=(n-o.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return M(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(n,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(n,{width:"short",context:"formatting"});default:return t.day(n,{width:"wide",context:"formatting"})}},"e"),c:i(function(r,e,t,o){let n=r.getDay(),s=(n-o.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return M(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(n,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(n,{width:"narrow",context:"standalone"});case"cccccc":return t.day(n,{width:"short",context:"standalone"});default:return t.day(n,{width:"wide",context:"standalone"})}},"c"),i:i(function(r,e,t){let o=r.getDay(),n=o===0?7:o;switch(e){case"i":return String(n);case"ii":return M(n,e.length);case"io":return t.ordinalNumber(n,{unit:"day"});case"iii":return t.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(o,{width:"short",context:"formatting"});default:return t.day(o,{width:"wide",context:"formatting"})}},"i"),a:i(function(r,e,t){let n=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},"a"),b:i(function(r,e,t){let o=r.getHours(),n;switch(o===12?n=Er.noon:o===0?n=Er.midnight:n=o/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},"b"),B:i(function(r,e,t){let o=r.getHours(),n;switch(o>=17?n=Er.evening:o>=12?n=Er.afternoon:o>=4?n=Er.morning:n=Er.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},"B"),h:i(function(r,e,t){if(e==="ho"){let o=r.getHours()%12;return o===0&&(o=12),t.ordinalNumber(o,{unit:"hour"})}return Ee.h(r,e)},"h"),H:i(function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):Ee.H(r,e)},"H"),K:i(function(r,e,t){let o=r.getHours()%12;return e==="Ko"?t.ordinalNumber(o,{unit:"hour"}):M(o,e.length)},"K"),k:i(function(r,e,t){let o=r.getHours();return o===0&&(o=24),e==="ko"?t.ordinalNumber(o,{unit:"hour"}):M(o,e.length)},"k"),m:i(function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):Ee.m(r,e)},"m"),s:i(function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):Ee.s(r,e)},"s"),S:i(function(r,e){return Ee.S(r,e)},"S"),X:i(function(r,e,t){let o=r.getTimezoneOffset();if(o===0)return"Z";switch(e){case"X":return Fc(o);case"XXXX":case"XX":return $t(o);default:return $t(o,":")}},"X"),x:i(function(r,e,t){let o=r.getTimezoneOffset();switch(e){case"x":return Fc(o);case"xxxx":case"xx":return $t(o);default:return $t(o,":")}},"x"),O:i(function(r,e,t){let o=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Wc(o,":");default:return"GMT"+$t(o,":")}},"O"),z:i(function(r,e,t){let o=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Wc(o,":");default:return"GMT"+$t(o,":")}},"z"),t:i(function(r,e,t){let o=Math.trunc(+r/1e3);return M(o,e.length)},"t"),T:i(function(r,e,t){return M(+r,e.length)},"T")};function Wc(r,e=""){let t=r>0?"-":"+",o=Math.abs(r),n=Math.trunc(o/60),s=o%60;return s===0?t+String(n):t+String(n)+e+M(s,2)}i(Wc,"formatTimezoneShort");function Fc(r,e){return r%60===0?(r>0?"-":"+")+M(Math.abs(r)/60,2):$t(r,e)}i(Fc,"formatTimezoneWithOptionalMinutes");function $t(r,e=""){let t=r>0?"-":"+",o=Math.abs(r),n=M(Math.trunc(o/60),2),s=M(o%60,2);return t+n+e+s}i($t,"formatTimezone");var Lc=i((r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},"dateLongFormatter"),Yc=i((r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},"timeLongFormatter"),nx=i((r,e)=>{let t=r.match(/(P+)(p+)?/)||[],o=t[1],n=t[2];if(!n)return Lc(r,e);let s;switch(o){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",Lc(o,e)).replace("{{time}}",Yc(n,e))},"dateTimeLongFormatter"),xt={p:Yc,P:nx};var ix=/^D+$/,sx=/^Y+$/,ax=["D","DD","YY","YYYY"];function Xn(r){return ix.test(r)}i(Xn,"isProtectedDayOfYearToken");function Zn(r){return sx.test(r)}i(Zn,"isProtectedWeekYearToken");function ho(r,e,t){let o=ux(r,e,t);if(console.warn(o),ax.includes(r))throw new RangeError(o)}i(ho,"warnOrThrowProtectedError");function ux(r,e,t){let o=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${o} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}i(ux,"message");var cx=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,fx=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,lx=/^'([^]*?)'?$/,dx=/''/g,px=/[a-zA-Z]/;function yo(r,e,t){let o=L(),n=t?.locale??o.locale??De,s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,u=d(r,t?.in);if(!ce(u))throw new RangeError("Invalid time value");let c=e.match(fx).map(l=>{let p=l[0];if(p==="p"||p==="P"){let m=xt[p];return m(l,n.formatLong)}return l}).join("").match(cx).map(l=>{if(l==="''")return{isToken:!1,value:"'"};let p=l[0];if(p==="'")return{isToken:!1,value:mx(l)};if(mo[p])return{isToken:!0,value:l};if(p.match(px))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:l}});n.localize.preprocessor&&(c=n.localize.preprocessor(u,c));let f={firstWeekContainsDate:s,weekStartsOn:a,locale:n};return c.map(l=>{if(!l.isToken)return l.value;let p=l.value;(!t?.useAdditionalWeekYearTokens&&Zn(p)||!t?.useAdditionalDayOfYearTokens&&Xn(p))&&ho(p,e,String(r));let m=mo[p[0]];return m(u,p,n.localize,f)}).join("")}i(yo,"format");function mx(r){let e=r.match(lx);return e?e[1].replace(dx,"'"):r}i(mx,"cleanEscapedString");var Jq=yo;function ei(r,e,t){let o=L(),n=t?.locale??o.locale??De,s=2520,a=pe(r,e);if(isNaN(a))throw new RangeError("Invalid time value");let u=Object.assign({},t,{addSuffix:t?.addSuffix,comparison:a}),[c,f]=O(t?.in,...a>0?[e,r]:[r,e]),l=Ae(f,c),p=(J(f)-J(c))/1e3,m=Math.round((l-p)/60),h;if(m<2)return t?.includeSeconds?l<5?n.formatDistance("lessThanXSeconds",5,u):l<10?n.formatDistance("lessThanXSeconds",10,u):l<20?n.formatDistance("lessThanXSeconds",20,u):l<40?n.formatDistance("halfAMinute",0,u):l<60?n.formatDistance("lessThanXMinutes",1,u):n.formatDistance("xMinutes",1,u):m===0?n.formatDistance("lessThanXMinutes",1,u):n.formatDistance("xMinutes",m,u);if(m<45)return n.formatDistance("xMinutes",m,u);if(m<90)return n.formatDistance("aboutXHours",1,u);if(m<dr){let x=Math.round(m/60);return n.formatDistance("aboutXHours",x,u)}else{if(m<s)return n.formatDistance("xDays",1,u);if(m<ct){let x=Math.round(m/dr);return n.formatDistance("xDays",x,u)}else if(m<ct*2)return h=Math.round(m/ct),n.formatDistance("aboutXMonths",h,u)}if(h=mt(f,c),h<12){let x=Math.round(m/ct);return n.formatDistance("xMonths",x,u)}else{let x=h%12,g=Math.trunc(h/12);return x<3?n.formatDistance("aboutXYears",g,u):x<9?n.formatDistance("overXYears",g,u):n.formatDistance("almostXYears",g+1,u)}}i(ei,"formatDistance");var sH=ei;function ti(r,e,t){let o=L(),n=t?.locale??o.locale??De,s=pe(r,e);if(isNaN(s))throw new RangeError("Invalid time value");let a=Object.assign({},t,{addSuffix:t?.addSuffix,comparison:s}),[u,c]=O(t?.in,...s>0?[e,r]:[r,e]),f=me(t?.roundingMethod??"round"),l=c.getTime()-u.getTime(),p=l/de,m=J(c)-J(u),h=(l-m)/de,x=t?.unit,g;if(x?g=x:p<1?g="second":p<60?g="minute":p<dr?g="hour":h<ct?g="day":h<wa?g="month":g="year",g==="second"){let w=f(l/1e3);return n.formatDistance("xSeconds",w,a)}else if(g==="minute"){let w=f(p);return n.formatDistance("xMinutes",w,a)}else if(g==="hour"){let w=f(p/60);return n.formatDistance("xHours",w,a)}else if(g==="day"){let w=f(h/dr);return n.formatDistance("xDays",w,a)}else if(g==="month"){let w=f(h/ct);return w===12&&x!=="month"?n.formatDistance("xYears",1,a):n.formatDistance("xMonths",w,a)}else{let w=f(h/wa);return n.formatDistance("xYears",w,a)}}i(ti,"formatDistanceStrict");var yH=ti;function qc(r,e){return ei(r,R(r),e)}i(qc,"formatDistanceToNow");var vH=qc;function Hc(r,e){return ti(r,R(r),e)}i(Hc,"formatDistanceToNowStrict");var OH=Hc;var hx=["years","months","weeks","days","hours","minutes","seconds"];function jc(r,e){let t=L(),o=e?.locale??t.locale??De,n=e?.format??hx,s=e?.zero??!1,a=e?.delimiter??" ";return o.formatDistance?n.reduce((c,f)=>{let l=`x${f.replace(/(^.)/,m=>m.toUpperCase())}`,p=r[f];return p!==void 0&&(s||r[f])?c.concat(o.formatDistance(l,p)):c},[]).join(a):""}i(jc,"formatDuration");var CH=jc;function Uc(r,e){let t=d(r,e?.in);if(isNaN(+t))throw new RangeError("Invalid time value");let o=e?.format??"extended",n=e?.representation??"complete",s="",a="",u=o==="extended"?"-":"",c=o==="extended"?":":"";if(n!=="time"){let f=M(t.getDate(),2),l=M(t.getMonth()+1,2);s=`${M(t.getFullYear(),4)}${u}${l}${u}${f}`}if(n!=="date"){let f=t.getTimezoneOffset();if(f!==0){let g=Math.abs(f),w=M(Math.trunc(g/60),2),v=M(g%60,2);a=`${f<0?"+":"-"}${w}:${v}`}else a="Z";let l=M(t.getHours(),2),p=M(t.getMinutes(),2),m=M(t.getSeconds(),2),h=s===""?"":"T",x=[l,p,m].join(c);s=`${s}${h}${x}${a}`}return s}i(Uc,"formatISO");var FH=Uc;function $c(r,e){let t=d(r,e?.in);if(!ce(t))throw new RangeError("Invalid time value");let o=e?.format??"extended",n=e?.representation??"complete",s="",a=o==="extended"?"-":"",u=o==="extended"?":":"";if(n!=="time"){let c=M(t.getDate(),2),f=M(t.getMonth()+1,2);s=`${M(t.getFullYear(),4)}${a}${f}${a}${c}`}if(n!=="date"){let c=M(t.getHours(),2),f=M(t.getMinutes(),2),l=M(t.getSeconds(),2);s=`${s}${s===""?"":" "}${c}${u}${f}${u}${l}`}return s}i($c,"formatISO9075");var UH=$c;function Bc(r){let{years:e=0,months:t=0,days:o=0,hours:n=0,minutes:s=0,seconds:a=0}=r;return`P${e}Y${t}M${o}DT${n}H${s}M${a}S`}i(Bc,"formatISODuration");var zH=Bc;function zc(r,e){let t=d(r,e?.in);if(!ce(t))throw new RangeError("Invalid time value");let o=e?.fractionDigits??0,n=M(t.getDate(),2),s=M(t.getMonth()+1,2),a=t.getFullYear(),u=M(t.getHours(),2),c=M(t.getMinutes(),2),f=M(t.getSeconds(),2),l="";if(o>0){let h=t.getMilliseconds(),x=Math.trunc(h*Math.pow(10,o-3));l="."+M(x,o)}let p="",m=t.getTimezoneOffset();if(m!==0){let h=Math.abs(m),x=M(Math.trunc(h/60),2),g=M(h%60,2);p=`${m<0?"+":"-"}${x}:${g}`}else p="Z";return`${a}-${s}-${n}T${u}:${c}:${f}${l}${p}`}i(zc,"formatRFC3339");var QH=zc;var yx=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],xx=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Vc(r){let e=d(r);if(!ce(e))throw new RangeError("Invalid time value");let t=yx[e.getUTCDay()],o=M(e.getUTCDate(),2),n=xx[e.getUTCMonth()],s=e.getUTCFullYear(),a=M(e.getUTCHours(),2),u=M(e.getUTCMinutes(),2),c=M(e.getUTCSeconds(),2);return`${t}, ${o} ${n} ${s} ${a}:${u}:${c} GMT`}i(Vc,"formatRFC7231");var oj=Vc;function Ac(r,e,t){let[o,n]=O(t?.in,r,e),s=L(),a=t?.locale??s.locale??De,u=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,c=ne(o,n);if(isNaN(c))throw new RangeError("Invalid time value");let f;c<-6?f="other":c<-1?f="lastWeek":c<0?f="yesterday":c<1?f="today":c<2?f="tomorrow":c<7?f="nextWeek":f="other";let l=a.formatRelative(f,o,n,{locale:a,weekStartsOn:u});return yo(o,l,{locale:a,weekStartsOn:u})}i(Ac,"formatRelative");var lj=Ac;function Gc(r,e){return d(r*1e3,e?.in)}i(Gc,"fromUnixTime");var hj=Gc;function ri(r,e){return d(r,e?.in).getDate()}i(ri,"getDate");var wj=ri;function gt(r,e){return d(r,e?.in).getDay()}i(gt,"getDay");var Dj=gt;function oi(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=t.getMonth(),s=y(t,0);return s.setFullYear(o,n+1,0),s.setHours(0,0,0,0),s.getDate()}i(oi,"getDaysInMonth");var kj=oi;function ni(r,e){let o=d(r,e?.in).getFullYear();return o%400===0||o%4===0&&o%100!==0}i(ni,"isLeapYear");var _j=ni;function Jc(r,e){let t=d(r,e?.in);return Number.isNaN(+t)?NaN:ni(t)?366:365}i(Jc,"getDaysInYear");var Lj=Jc;function Kc(r,e){let o=d(r,e?.in).getFullYear();return Math.floor(o/10)*10}i(Kc,"getDecade");var jj=Kc;function ii(){return Object.assign({},L())}i(ii,"getDefaultOptions");var zj=ii;function Qc(r,e){return d(r,e?.in).getHours()}i(Qc,"getHours");var Jj=Qc;function si(r,e){let t=d(r,e?.in).getDay();return t===0?7:t}i(si,"getISODay");var Zj=si;function Xc(r,e){let t=Oe(r,e),n=+Oe(dt(t,60))-+t;return Math.round(n/Ue)}i(Xc,"getISOWeeksInYear");var iU=Xc;function Zc(r){return d(r).getMilliseconds()}i(Zc,"getMilliseconds");var cU=Zc;function ef(r,e){return d(r,e?.in).getMinutes()}i(ef,"getMinutes");var pU=ef;function tf(r,e){return d(r,e?.in).getMonth()}i(tf,"getMonth");var xU=tf;function rf(r,e){let[t,o]=[+d(r.start),+d(r.end)].sort((p,m)=>p-m),[n,s]=[+d(e.start),+d(e.end)].sort((p,m)=>p-m);if(!(t<s&&n<o))return 0;let u=n<t?t:n,c=u-J(u),f=s>o?o:s,l=f-J(f);return Math.ceil((l-c)/On)}i(rf,"getOverlappingDaysInIntervals");var DU=rf;function of(r){return d(r).getSeconds()}i(of,"getSeconds");var EU=of;function nf(r){return+d(r)}i(nf,"getTime");var CU=nf;function sf(r){return Math.trunc(+d(r)/1e3)}i(sf,"getUnixTime");var WU=sf;function af(r,e){let t=L(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=ri(d(r,e?.in));if(isNaN(n))return NaN;let s=gt(ht(r,e)),a=o-s;a<=0&&(a+=7);let u=n-a;return Math.ceil(u/7)+1}i(af,"getWeekOfMonth");var $U=af;function ai(r,e){let t=d(r,e?.in),o=t.getMonth();return t.setFullYear(t.getFullYear(),o+1,0),t.setHours(0,0,0,0),d(t,e?.in)}i(ai,"lastDayOfMonth");var AU=ai;function uf(r,e){let t=d(r,e?.in);return qt(ai(t,e),ht(t,e),e)+1}i(uf,"getWeeksInMonth");var e$=uf;function cf(r,e){return d(r,e?.in).getFullYear()}i(cf,"getYear");var n$=cf;function ff(r){return Math.trunc(r*Me)}i(ff,"hoursToMilliseconds");var u$=ff;function lf(r){return Math.trunc(r*En)}i(lf,"hoursToMinutes");var d$=lf;function df(r){return Math.trunc(r*Lt)}i(df,"hoursToSeconds");var y$=df;function pf(r,e,t){let[o,n]=O(t?.in,r,e);if(isNaN(+o))throw new TypeError("Start date is invalid");if(isNaN(+n))throw new TypeError("End date is invalid");if(t?.assertPositive&&+o>+n)throw new TypeError("End date must be after start date");return{start:o,end:n}}i(pf,"interval");var b$=pf;function mf(r,e){let{start:t,end:o}=ie(e?.in,r),n={},s=Vn(o,t);s&&(n.years=s);let a=ft(t,{years:n.years}),u=mt(o,a);u&&(n.months=u);let c=ft(a,{months:n.months}),f=xr(o,c);f&&(n.days=f);let l=ft(c,{days:n.days}),p=Ht(o,l);p&&(n.hours=p);let m=ft(l,{hours:n.hours}),h=jt(o,m);h&&(n.minutes=h);let x=ft(m,{minutes:n.minutes}),g=Ae(o,x);return g&&(n.seconds=g),n}i(mf,"intervalToDuration");var C$=mf;function hf(r,e,t){let o;return gx(e)?o=e:t=e,new Intl.DateTimeFormat(t?.locale,o).format(d(r))}i(hf,"intlFormat");function gx(r){return r!==void 0&&!("locale"in r)}i(gx,"isFormatOptions");var W$=hf;function yf(r,e,t){let o=0,n,[s,a]=O(t?.in,r,e);if(t?.unit)n=t?.unit,n==="second"?o=Ae(s,a):n==="minute"?o=jt(s,a):n==="hour"?o=Ht(s,a):n==="day"?o=ne(s,a):n==="week"?o=qt(s,a):n==="month"?o=Yt(s,a):n==="quarter"?o=yr(s,a):n==="year"&&(o=pt(s,a));else{let c=Ae(s,a);Math.abs(c)<pr?(o=Ae(s,a),n="second"):Math.abs(c)<Lt?(o=jt(s,a),n="minute"):Math.abs(c)<Sn&&Math.abs(ne(s,a))<1?(o=Ht(s,a),n="hour"):Math.abs(c)<Ku&&(o=ne(s,a))&&Math.abs(o)<7?n="day":Math.abs(c)<va?(o=qt(s,a),n="week"):Math.abs(c)<Qu?(o=Yt(s,a),n="month"):Math.abs(c)<ba?yr(s,a)<4?(o=yr(s,a),n="quarter"):(o=pt(s,a),n="year"):(o=pt(s,a),n="year")}return new Intl.RelativeTimeFormat(t?.locale,{numeric:"auto",...t}).format(o,n)}i(yf,"intlFormatDistance");var G$=yf;function xf(r,e){return+d(r)>+d(e)}i(xf,"isAfter");var X$=xf;function gf(r,e){return+d(r)<+d(e)}i(gf,"isBefore");var rB=gf;function wf(r,e){return+d(r)==+d(e)}i(wf,"isEqual");var sB=wf;function bf(r,e,t){let o=new Date(r,e,t);return o.getFullYear()===r&&o.getMonth()===e&&o.getDate()===t}i(bf,"isExists");var cB=bf;function vf(r,e){return d(r,e?.in).getDate()===1}i(vf,"isFirstDayOfMonth");var pB=vf;function Tf(r,e){return d(r,e?.in).getDay()===5}i(Tf,"isFriday");var xB=Tf;function Df(r){return+d(r)>Date.now()}i(Df,"isFuture");var vB=Df;function ui(r,e){let t=wx(e)?new e(0):y(e,0);return t.setFullYear(r.getFullYear(),r.getMonth(),r.getDate()),t.setHours(r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()),t}i(ui,"transpose");function wx(r){return typeof r=="function"&&r.prototype?.constructor===r}i(wx,"isConstructor");var MB=ui;var bx=10,ci=class{static{i(this,"Setter")}subPriority=0;validate(e,t){return!0}},fi=class extends ci{static{i(this,"ValueSetter")}constructor(e,t,o,n,s){super(),this.value=e,this.validateValue=t,this.setValue=o,this.priority=n,s&&(this.subPriority=s)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,o){return this.setValue(e,t,this.value,o)}},li=class extends ci{static{i(this,"DateTimezoneSetter")}priority=bx;subPriority=-1;constructor(e,t){super(),this.context=e||(o=>y(t,o))}set(e,t){return t.timestampIsSet?e:y(e,ui(e,this.context))}};var S=class{static{i(this,"Parser")}run(e,t,o,n){let s=this.parse(e,t,o,n);return s?{setter:new fi(s.value,this.validate,this.set,this.priority,this.subPriority),rest:s.rest}:null}validate(e,t,o){return!0}};var di=class extends S{static{i(this,"EraParser")}priority=140;parse(e,t,o){switch(t){case"G":case"GG":case"GGG":return o.era(e,{width:"abbreviated"})||o.era(e,{width:"narrow"});case"GGGGG":return o.era(e,{width:"narrow"});default:return o.era(e,{width:"wide"})||o.era(e,{width:"abbreviated"})||o.era(e,{width:"narrow"})}}set(e,t,o){return t.era=o,e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]};var W={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},_e={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function Y(r,e){return r&&{value:e(r.value),rest:r.rest}}i(Y,"mapValue");function N(r,e){let t=e.match(r);return t?{value:parseInt(t[0],10),rest:e.slice(t[0].length)}:null}i(N,"parseNumericPattern");function Re(r,e){let t=e.match(r);if(!t)return null;if(t[0]==="Z")return{value:0,rest:e.slice(1)};let o=t[1]==="+"?1:-1,n=t[2]?parseInt(t[2],10):0,s=t[3]?parseInt(t[3],10):0,a=t[5]?parseInt(t[5],10):0;return{value:o*(n*Me+s*de+a*lr),rest:e.slice(t[0].length)}}i(Re,"parseTimezonePattern");function pi(r){return N(W.anyDigitsSigned,r)}i(pi,"parseAnyDigitsSigned");function P(r,e){switch(r){case 1:return N(W.singleDigit,e);case 2:return N(W.twoDigits,e);case 3:return N(W.threeDigits,e);case 4:return N(W.fourDigits,e);default:return N(new RegExp("^\\d{1,"+r+"}"),e)}}i(P,"parseNDigits");function kr(r,e){switch(r){case 1:return N(W.singleDigitSigned,e);case 2:return N(W.twoDigitsSigned,e);case 3:return N(W.threeDigitsSigned,e);case 4:return N(W.fourDigitsSigned,e);default:return N(new RegExp("^-?\\d{1,"+r+"}"),e)}}i(kr,"parseNDigitsSigned");function Ir(r){switch(r){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}i(Ir,"dayPeriodEnumToHours");function mi(r,e){let t=e>0,o=t?e:1-e,n;if(o<=50)n=r||100;else{let s=o+50,a=Math.trunc(s/100)*100,u=r>=s%100;n=r+a-(u?100:0)}return t?n:1-n}i(mi,"normalizeTwoDigitYear");function hi(r){return r%400===0||r%4===0&&r%100!==0}i(hi,"isLeapYearIndex");var yi=class extends S{static{i(this,"YearParser")}priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,t,o){let n=i(s=>({year:s,isTwoDigitYear:t==="yy"}),"valueCallback");switch(t){case"y":return Y(P(4,e),n);case"yo":return Y(o.ordinalNumber(e,{unit:"year"}),n);default:return Y(P(t.length,e),n)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,o){let n=e.getFullYear();if(o.isTwoDigitYear){let a=mi(o.year,n);return e.setFullYear(a,0,1),e.setHours(0,0,0,0),e}let s=!("era"in t)||t.era===1?o.year:1-o.year;return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}};var xi=class extends S{static{i(this,"LocalWeekYearParser")}priority=130;parse(e,t,o){let n=i(s=>({year:s,isTwoDigitYear:t==="YY"}),"valueCallback");switch(t){case"Y":return Y(P(4,e),n);case"Yo":return Y(o.ordinalNumber(e,{unit:"year"}),n);default:return Y(P(t.length,e),n)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,o,n){let s=yt(e,n);if(o.isTwoDigitYear){let u=mi(o.year,s);return e.setFullYear(u,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),U(e,n)}let a=!("era"in t)||t.era===1?o.year:1-o.year;return e.setFullYear(a,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),U(e,n)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]};var gi=class extends S{static{i(this,"ISOWeekYearParser")}priority=130;parse(e,t){return t==="R"?kr(4,e):kr(t.length,e)}set(e,t,o){let n=y(e,0);return n.setFullYear(o,0,4),n.setHours(0,0,0,0),X(n)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]};var wi=class extends S{static{i(this,"ExtendedYearParser")}priority=130;parse(e,t){return t==="u"?kr(4,e):kr(t.length,e)}set(e,t,o){return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]};var bi=class extends S{static{i(this,"QuarterParser")}priority=120;parse(e,t,o){switch(t){case"Q":case"QQ":return P(t.length,e);case"Qo":return o.ordinalNumber(e,{unit:"quarter"});case"QQQ":return o.quarter(e,{width:"abbreviated",context:"formatting"})||o.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return o.quarter(e,{width:"narrow",context:"formatting"});default:return o.quarter(e,{width:"wide",context:"formatting"})||o.quarter(e,{width:"abbreviated",context:"formatting"})||o.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=1&&t<=4}set(e,t,o){return e.setMonth((o-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]};var vi=class extends S{static{i(this,"StandAloneQuarterParser")}priority=120;parse(e,t,o){switch(t){case"q":case"qq":return P(t.length,e);case"qo":return o.ordinalNumber(e,{unit:"quarter"});case"qqq":return o.quarter(e,{width:"abbreviated",context:"standalone"})||o.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return o.quarter(e,{width:"narrow",context:"standalone"});default:return o.quarter(e,{width:"wide",context:"standalone"})||o.quarter(e,{width:"abbreviated",context:"standalone"})||o.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=1&&t<=4}set(e,t,o){return e.setMonth((o-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]};var Ti=class extends S{static{i(this,"MonthParser")}incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,t,o){let n=i(s=>s-1,"valueCallback");switch(t){case"M":return Y(N(W.month,e),n);case"MM":return Y(P(2,e),n);case"Mo":return Y(o.ordinalNumber(e,{unit:"month"}),n);case"MMM":return o.month(e,{width:"abbreviated",context:"formatting"})||o.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return o.month(e,{width:"narrow",context:"formatting"});default:return o.month(e,{width:"wide",context:"formatting"})||o.month(e,{width:"abbreviated",context:"formatting"})||o.month(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=11}set(e,t,o){return e.setMonth(o,1),e.setHours(0,0,0,0),e}};var Di=class extends S{static{i(this,"StandAloneMonthParser")}priority=110;parse(e,t,o){let n=i(s=>s-1,"valueCallback");switch(t){case"L":return Y(N(W.month,e),n);case"LL":return Y(P(2,e),n);case"Lo":return Y(o.ordinalNumber(e,{unit:"month"}),n);case"LLL":return o.month(e,{width:"abbreviated",context:"standalone"})||o.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return o.month(e,{width:"narrow",context:"standalone"});default:return o.month(e,{width:"wide",context:"standalone"})||o.month(e,{width:"abbreviated",context:"standalone"})||o.month(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=11}set(e,t,o){return e.setMonth(o,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]};function Si(r,e,t){let o=d(r,t?.in),n=Or(o,t)-e;return o.setDate(o.getDate()-n*7),d(o,t?.in)}i(Si,"setWeek");var I3=Si;var Mi=class extends S{static{i(this,"LocalWeekParser")}priority=100;parse(e,t,o){switch(t){case"w":return N(W.week,e);case"wo":return o.ordinalNumber(e,{unit:"week"});default:return P(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,o,n){return U(Si(e,o,n),n)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]};function Oi(r,e,t){let o=d(r,t?.in),n=Mr(o,t)-e;return o.setDate(o.getDate()-n*7),o}i(Oi,"setISOWeek");var j3=Oi;var Ei=class extends S{static{i(this,"ISOWeekParser")}priority=100;parse(e,t,o){switch(t){case"I":return N(W.week,e);case"Io":return o.ordinalNumber(e,{unit:"week"});default:return P(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,o){return X(Oi(e,o))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]};var vx=[31,28,31,30,31,30,31,31,30,31,30,31],Tx=[31,29,31,30,31,30,31,31,30,31,30,31],ki=class extends S{static{i(this,"DateParser")}priority=90;subPriority=1;parse(e,t,o){switch(t){case"d":return N(W.date,e);case"do":return o.ordinalNumber(e,{unit:"date"});default:return P(t.length,e)}}validate(e,t){let o=e.getFullYear(),n=hi(o),s=e.getMonth();return n?t>=1&&t<=Tx[s]:t>=1&&t<=vx[s]}set(e,t,o){return e.setDate(o),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]};var Ii=class extends S{static{i(this,"DayOfYearParser")}priority=90;subpriority=1;parse(e,t,o){switch(t){case"D":case"DD":return N(W.dayOfYear,e);case"Do":return o.ordinalNumber(e,{unit:"date"});default:return P(t.length,e)}}validate(e,t){let o=e.getFullYear();return hi(o)?t>=1&&t<=366:t>=1&&t<=365}set(e,t,o){return e.setMonth(0,o),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]};function wt(r,e,t){let o=L(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,s=d(r,t?.in),a=s.getDay(),c=(e%7+7)%7,f=7-n,l=e<0||e>6?e-(a+f)%7:(c+f)%7-(a+f)%7;return ee(s,l,t)}i(wt,"setDay");var f6=wt;var Pi=class extends S{static{i(this,"DayParser")}priority=90;parse(e,t,o){switch(t){case"E":case"EE":case"EEE":return o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return o.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});default:return o.day(e,{width:"wide",context:"formatting"})||o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,o,n){return e=wt(e,o,n),e.setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]};var Ci=class extends S{static{i(this,"LocalDayParser")}priority=90;parse(e,t,o,n){let s=i(a=>{let u=Math.floor((a-1)/7)*7;return(a+n.weekStartsOn+6)%7+u},"valueCallback");switch(t){case"e":case"ee":return Y(P(t.length,e),s);case"eo":return Y(o.ordinalNumber(e,{unit:"day"}),s);case"eee":return o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});case"eeeee":return o.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});default:return o.day(e,{width:"wide",context:"formatting"})||o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,o,n){return e=wt(e,o,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]};var _i=class extends S{static{i(this,"StandAloneLocalDayParser")}priority=90;parse(e,t,o,n){let s=i(a=>{let u=Math.floor((a-1)/7)*7;return(a+n.weekStartsOn+6)%7+u},"valueCallback");switch(t){case"c":case"cc":return Y(P(t.length,e),s);case"co":return Y(o.ordinalNumber(e,{unit:"day"}),s);case"ccc":return o.day(e,{width:"abbreviated",context:"standalone"})||o.day(e,{width:"short",context:"standalone"})||o.day(e,{width:"narrow",context:"standalone"});case"ccccc":return o.day(e,{width:"narrow",context:"standalone"});case"cccccc":return o.day(e,{width:"short",context:"standalone"})||o.day(e,{width:"narrow",context:"standalone"});default:return o.day(e,{width:"wide",context:"standalone"})||o.day(e,{width:"abbreviated",context:"standalone"})||o.day(e,{width:"short",context:"standalone"})||o.day(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=6}set(e,t,o,n){return e=wt(e,o,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]};function Ri(r,e,t){let o=d(r,t?.in),n=si(o,t),s=e-n;return ee(o,s,t)}i(Ri,"setISODay");var P6=Ri;var Ni=class extends S{static{i(this,"ISODayParser")}priority=90;parse(e,t,o){let n=i(s=>s===0?7:s,"valueCallback");switch(t){case"i":case"ii":return P(t.length,e);case"io":return o.ordinalNumber(e,{unit:"day"});case"iii":return Y(o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"}),n);case"iiiii":return Y(o.day(e,{width:"narrow",context:"formatting"}),n);case"iiiiii":return Y(o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"}),n);default:return Y(o.day(e,{width:"wide",context:"formatting"})||o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"}),n)}}validate(e,t){return t>=1&&t<=7}set(e,t,o){return e=Ri(e,o),e.setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]};var Wi=class extends S{static{i(this,"AMPMParser")}priority=80;parse(e,t,o){switch(t){case"a":case"aa":case"aaa":return o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return o.dayPeriod(e,{width:"narrow",context:"formatting"});default:return o.dayPeriod(e,{width:"wide",context:"formatting"})||o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,o){return e.setHours(Ir(o),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]};var Fi=class extends S{static{i(this,"AMPMMidnightParser")}priority=80;parse(e,t,o){switch(t){case"b":case"bb":case"bbb":return o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return o.dayPeriod(e,{width:"narrow",context:"formatting"});default:return o.dayPeriod(e,{width:"wide",context:"formatting"})||o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,o){return e.setHours(Ir(o),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]};var Li=class extends S{static{i(this,"DayPeriodParser")}priority=80;parse(e,t,o){switch(t){case"B":case"BB":case"BBB":return o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return o.dayPeriod(e,{width:"narrow",context:"formatting"});default:return o.dayPeriod(e,{width:"wide",context:"formatting"})||o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,o){return e.setHours(Ir(o),0,0,0),e}incompatibleTokens=["a","b","t","T"]};var Yi=class extends S{static{i(this,"Hour1to12Parser")}priority=70;parse(e,t,o){switch(t){case"h":return N(W.hour12h,e);case"ho":return o.ordinalNumber(e,{unit:"hour"});default:return P(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,o){let n=e.getHours()>=12;return n&&o<12?e.setHours(o+12,0,0,0):!n&&o===12?e.setHours(0,0,0,0):e.setHours(o,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]};var qi=class extends S{static{i(this,"Hour0to23Parser")}priority=70;parse(e,t,o){switch(t){case"H":return N(W.hour23h,e);case"Ho":return o.ordinalNumber(e,{unit:"hour"});default:return P(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,o){return e.setHours(o,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]};var Hi=class extends S{static{i(this,"Hour0To11Parser")}priority=70;parse(e,t,o){switch(t){case"K":return N(W.hour11h,e);case"Ko":return o.ordinalNumber(e,{unit:"hour"});default:return P(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,o){return e.getHours()>=12&&o<12?e.setHours(o+12,0,0,0):e.setHours(o,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]};var ji=class extends S{static{i(this,"Hour1To24Parser")}priority=70;parse(e,t,o){switch(t){case"k":return N(W.hour24h,e);case"ko":return o.ordinalNumber(e,{unit:"hour"});default:return P(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,o){let n=o<=24?o%24:o;return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]};var Ui=class extends S{static{i(this,"MinuteParser")}priority=60;parse(e,t,o){switch(t){case"m":return N(W.minute,e);case"mo":return o.ordinalNumber(e,{unit:"minute"});default:return P(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,o){return e.setMinutes(o,0,0),e}incompatibleTokens=["t","T"]};var $i=class extends S{static{i(this,"SecondParser")}priority=50;parse(e,t,o){switch(t){case"s":return N(W.second,e);case"so":return o.ordinalNumber(e,{unit:"second"});default:return P(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,o){return e.setSeconds(o,0),e}incompatibleTokens=["t","T"]};var Bi=class extends S{static{i(this,"FractionOfSecondParser")}priority=30;parse(e,t){let o=i(n=>Math.trunc(n*Math.pow(10,-t.length+3)),"valueCallback");return Y(P(t.length,e),o)}set(e,t,o){return e.setMilliseconds(o),e}incompatibleTokens=["t","T"]};var zi=class extends S{static{i(this,"ISOTimezoneWithZParser")}priority=10;parse(e,t){switch(t){case"X":return Re(_e.basicOptionalMinutes,e);case"XX":return Re(_e.basic,e);case"XXXX":return Re(_e.basicOptionalSeconds,e);case"XXXXX":return Re(_e.extendedOptionalSeconds,e);default:return Re(_e.extended,e)}}set(e,t,o){return t.timestampIsSet?e:y(e,e.getTime()-J(e)-o)}incompatibleTokens=["t","T","x"]};var Vi=class extends S{static{i(this,"ISOTimezoneParser")}priority=10;parse(e,t){switch(t){case"x":return Re(_e.basicOptionalMinutes,e);case"xx":return Re(_e.basic,e);case"xxxx":return Re(_e.basicOptionalSeconds,e);case"xxxxx":return Re(_e.extendedOptionalSeconds,e);default:return Re(_e.extended,e)}}set(e,t,o){return t.timestampIsSet?e:y(e,e.getTime()-J(e)-o)}incompatibleTokens=["t","T","X"]};var Ai=class extends S{static{i(this,"TimestampSecondsParser")}priority=40;parse(e){return pi(e)}set(e,t,o){return[y(e,o*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"};var Gi=class extends S{static{i(this,"TimestampMillisecondsParser")}priority=20;parse(e){return pi(e)}set(e,t,o){return[y(e,o),{timestampIsSet:!0}]}incompatibleTokens="*"};var Ji={G:new di,y:new yi,Y:new xi,R:new gi,u:new wi,Q:new bi,q:new vi,M:new Ti,L:new Di,w:new Mi,I:new Ei,d:new ki,D:new Ii,E:new Pi,e:new Ci,c:new _i,i:new Ni,a:new Wi,b:new Fi,B:new Li,h:new Yi,H:new qi,K:new Hi,k:new ji,m:new Ui,s:new $i,S:new Bi,X:new zi,x:new Vi,t:new Ai,T:new Gi};var Dx=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Sx=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Mx=/^'([^]*?)'?$/,Ox=/''/g,Ex=/\S/,kx=/[a-zA-Z]/;function Ki(r,e,t,o){let n=i(()=>y(o?.in||t,NaN),"invalidDate"),s=ii(),a=o?.locale??s.locale??De,u=o?.firstWeekContainsDate??o?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,c=o?.weekStartsOn??o?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0;if(!e)return r?n():d(t,o?.in);let f={firstWeekContainsDate:u,weekStartsOn:c,locale:a},l=[new li(o?.in,t)],p=e.match(Sx).map(w=>{let v=w[0];if(v in xt){let G=xt[v];return G(w,a.formatLong)}return w}).join("").match(Dx),m=[];for(let w of p){!o?.useAdditionalWeekYearTokens&&Zn(w)&&ho(w,e,r),!o?.useAdditionalDayOfYearTokens&&Xn(w)&&ho(w,e,r);let v=w[0],G=Ji[v];if(G){let{incompatibleTokens:te}=G;if(Array.isArray(te)){let rt=m.find(Qe=>te.includes(Qe.token)||Qe.token===v);if(rt)throw new RangeError(`The format string mustn't contain \`${rt.fullToken}\` and \`${w}\` at the same time`)}else if(G.incompatibleTokens==="*"&&m.length>0)throw new RangeError(`The format string mustn't contain \`${w}\` and any other token at the same time`);m.push({token:v,fullToken:w});let ae=G.run(r,w,a.match,f);if(!ae)return n();l.push(ae.setter),r=ae.rest}else{if(v.match(kx))throw new RangeError("Format string contains an unescaped latin alphabet character `"+v+"`");if(w==="''"?w="'":v==="'"&&(w=Ix(w)),r.indexOf(w)===0)r=r.slice(w.length);else return n()}}if(r.length>0&&Ex.test(r))return n();let h=l.map(w=>w.priority).sort((w,v)=>v-w).filter((w,v,G)=>G.indexOf(w)===v).map(w=>l.filter(v=>v.priority===w).sort((v,G)=>G.subPriority-v.subPriority)).map(w=>w[0]),x=d(t,o?.in);if(isNaN(+x))return n();let g={};for(let w of h){if(!w.validate(x,f))return n();let v=w.set(x,g,f);Array.isArray(v)?(x=v[0],Object.assign(g,v[1])):x=v}return x}i(Ki,"parse");function Ix(r){return r.match(Mx)[1].replace(Ox,"'")}i(Ix,"cleanEscapedString");var H4=Ki;function Sf(r,e,t){return ce(Ki(r,e,new Date,t))}i(Sf,"isMatch");var z4=Sf;function Mf(r,e){return d(r,e?.in).getDay()===1}i(Mf,"isMonday");var J4=Mf;function Of(r){return+d(r)<Date.now()}i(Of,"isPast");var Z4=Of;function xo(r,e){let t=d(r,e?.in);return t.setMinutes(0,0,0),t}i(xo,"startOfHour");var oV=xo;function Qi(r,e,t){let[o,n]=O(t?.in,r,e);return+xo(o)==+xo(n)}i(Qi,"isSameHour");var uV=Qi;function Pr(r,e,t){let[o,n]=O(t?.in,r,e);return+U(o,t)==+U(n,t)}i(Pr,"isSameWeek");var pV=Pr;function Xi(r,e,t){return Pr(r,e,{...t,weekStartsOn:1})}i(Xi,"isSameISOWeek");var xV=Xi;function Ef(r,e,t){let[o,n]=O(t?.in,r,e);return+Oe(o)==+Oe(n)}i(Ef,"isSameISOWeekYear");var TV=Ef;function go(r,e){let t=d(r,e?.in);return t.setSeconds(0,0),t}i(go,"startOfMinute");var OV=go;function Zi(r,e){return+go(r)==+go(e)}i(Zi,"isSameMinute");var PV=Zi;function es(r,e,t){let[o,n]=O(t?.in,r,e);return o.getFullYear()===n.getFullYear()&&o.getMonth()===n.getMonth()}i(es,"isSameMonth");var NV=es;function ts(r,e,t){let[o,n]=O(t?.in,r,e);return+Ge(o)==+Ge(n)}i(ts,"isSameQuarter");var qV=ts;function wo(r,e){let t=d(r,e?.in);return t.setMilliseconds(0),t}i(wo,"startOfSecond");var $V=wo;function rs(r,e){return+wo(r)==+wo(e)}i(rs,"isSameSecond");var AV=rs;function os(r,e,t){let[o,n]=O(t?.in,r,e);return o.getFullYear()===n.getFullYear()}i(os,"isSameYear");var QV=os;function kf(r,e){return Qi(d(r,e?.in),R(e?.in||r))}i(kf,"isThisHour");var oA=kf;function If(r,e){return Xi(y(e?.in||r,r),R(e?.in||r))}i(If,"isThisISOWeek");var cA=If;function Pf(r){return Zi(r,R(r))}i(Pf,"isThisMinute");var mA=Pf;function Cf(r,e){return es(y(e?.in||r,r),R(e?.in||r))}i(Cf,"isThisMonth");var bA=Cf;function _f(r,e){return ts(y(e?.in||r,r),R(e?.in||r))}i(_f,"isThisQuarter");var OA=_f;function Rf(r){return rs(r,R(r))}i(Rf,"isThisSecond");var CA=Rf;function Nf(r,e){return Pr(y(e?.in||r,r),R(e?.in||r),e)}i(Nf,"isThisWeek");var LA=Nf;function Wf(r,e){return os(y(e?.in||r,r),R(e?.in||r))}i(Wf,"isThisYear");var $A=Wf;function Ff(r,e){return d(r,e?.in).getDay()===4}i(Ff,"isThursday");var AA=Ff;function Lf(r,e){return Ve(y(e?.in||r,r),R(e?.in||r))}i(Lf,"isToday");var ZA=Lf;function Yf(r,e){return Ve(r,ee(R(e?.in||r),1),e)}i(Yf,"isTomorrow");var i5=Yf;function qf(r,e){return d(r,e?.in).getDay()===2}i(qf,"isTuesday");var c5=qf;function Hf(r,e){return d(r,e?.in).getDay()===3}i(Hf,"isWednesday");var p5=Hf;function jf(r,e,t){let o=+d(r,t?.in),[n,s]=[+d(e.start,t?.in),+d(e.end,t?.in)].sort((a,u)=>a-u);return o>=n&&o<=s}i(jf,"isWithinInterval");var x5=jf;function bt(r,e,t){return ee(r,-e,t)}i(bt,"subDays");var v5=bt;function Uf(r,e){return Ve(y(e?.in||r,r),bt(R(e?.in||r),1))}i(Uf,"isYesterday");var k5=Uf;function $f(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=9+Math.floor(o/10)*10;return t.setFullYear(n+1,0,0),t.setHours(0,0,0,0),d(t,e?.in)}i($f,"lastDayOfDecade");var _5=$f;function ns(r,e){let t=L(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=d(r,e?.in),s=n.getDay(),a=(s<o?-7:0)+6-(s-o);return n.setHours(0,0,0,0),n.setDate(n.getDate()+a),n}i(ns,"lastDayOfWeek");var L5=ns;function Bf(r,e){return ns(r,{...e,weekStartsOn:1})}i(Bf,"lastDayOfISOWeek");var j5=Bf;function zf(r,e){let t=be(r,e),o=y(e?.in||r,0);o.setFullYear(t+1,0,4),o.setHours(0,0,0,0);let n=X(o,e);return n.setDate(n.getDate()-1),n}i(zf,"lastDayOfISOWeekYear");var A5=zf;function Vf(r,e){let t=d(r,e?.in),o=t.getMonth(),n=o-o%3+3;return t.setMonth(n,0),t.setHours(0,0,0,0),t}i(Vf,"lastDayOfQuarter");var Q5=Vf;function Af(r,e){let t=d(r,e?.in),o=t.getFullYear();return t.setFullYear(o+1,0,0),t.setHours(0,0,0,0),t}i(Af,"lastDayOfYear");var t8=Af;var Px=/(\w)\1*|''|'(''|[^'])+('|$)|./g,Cx=/^'([^]*?)'?$/,_x=/''/g,Rx=/[a-zA-Z]/;function Gf(r,e){let t=d(r);if(!ce(t))throw new RangeError("Invalid time value");let o=e.match(Px);return o?o.map(s=>{if(s==="''")return"'";let a=s[0];if(a==="'")return Nx(s);let u=Ee[a];if(u)return u(t,s);if(a.match(Rx))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return s}).join(""):""}i(Gf,"lightFormat");function Nx(r){let e=r.match(Cx);return e?e[1].replace(_x,"'"):r}i(Nx,"cleanEscapedString");var a8=Gf;function Jf({years:r,months:e,weeks:t,days:o,hours:n,minutes:s,seconds:a}){let u=0;r&&(u+=r*365.2425),e&&(u+=e*(365.2425/12)),t&&(u+=t*7),o&&(u+=o);let c=u*24*60*60;return n&&(c+=n*60*60),s&&(c+=s*60),a&&(c+=a),Math.trunc(c*1e3)}i(Jf,"milliseconds");var l8=Jf;function Kf(r){let e=r/Me;return Math.trunc(e)}i(Kf,"millisecondsToHours");var h8=Kf;function Qf(r){let e=r/de;return Math.trunc(e)}i(Qf,"millisecondsToMinutes");var w8=Qf;function Xf(r){let e=r/lr;return Math.trunc(e)}i(Xf,"millisecondsToSeconds");var D8=Xf;function Zf(r){let e=r/En;return Math.trunc(e)}i(Zf,"minutesToHours");var E8=Zf;function el(r){return Math.trunc(r*de)}i(el,"minutesToMilliseconds");var C8=el;function tl(r){return Math.trunc(r*pr)}i(tl,"minutesToSeconds");var W8=tl;function rl(r){let e=r/kn;return Math.trunc(e)}i(rl,"monthsToQuarters");var q8=rl;function ol(r){let e=r/In;return Math.trunc(e)}i(ol,"monthsToYears");var $8=ol;function he(r,e,t){let o=e-gt(r,t);return o<=0&&(o+=7),ee(r,o,t)}i(he,"nextDay");var G8=he;function nl(r,e){return he(r,5,e)}i(nl,"nextFriday");var X8=nl;function il(r,e){return he(r,1,e)}i(il,"nextMonday");var rG=il;function sl(r,e){return he(r,6,e)}i(sl,"nextSaturday");var sG=sl;function al(r,e){return he(r,0,e)}i(al,"nextSunday");var fG=al;function ul(r,e){return he(r,4,e)}i(ul,"nextThursday");var mG=ul;function cl(r,e){return he(r,2,e)}i(cl,"nextTuesday");var gG=cl;function fl(r,e){return he(r,3,e)}i(fl,"nextWednesday");var TG=fl;function dl(r,e){let t=i(()=>y(e?.in,NaN),"invalidDate"),o=e?.additionalDigits??2,n=Yx(r),s;if(n.date){let f=qx(n.date,o);s=Hx(f.restDateString,f.year)}if(!s||isNaN(+s))return t();let a=+s,u=0,c;if(n.time&&(u=jx(n.time),isNaN(u)))return t();if(n.timezone){if(c=Ux(n.timezone),isNaN(c))return t()}else{let f=new Date(a+u),l=d(0,e?.in);return l.setFullYear(f.getUTCFullYear(),f.getUTCMonth(),f.getUTCDate()),l.setHours(f.getUTCHours(),f.getUTCMinutes(),f.getUTCSeconds(),f.getUTCMilliseconds()),l}return d(a+u+c,e?.in)}i(dl,"parseISO");var is={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Wx=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Fx=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Lx=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Yx(r){let e={},t=r.split(is.dateTimeDelimiter),o;if(t.length>2)return e;if(/:/.test(t[0])?o=t[0]:(e.date=t[0],o=t[1],is.timeZoneDelimiter.test(e.date)&&(e.date=r.split(is.timeZoneDelimiter)[0],o=r.substr(e.date.length,r.length))),o){let n=is.timezone.exec(o);n?(e.time=o.replace(n[1],""),e.timezone=n[1]):e.time=o}return e}i(Yx,"splitDateString");function qx(r,e){let t=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),o=r.match(t);if(!o)return{year:NaN,restDateString:""};let n=o[1]?parseInt(o[1]):null,s=o[2]?parseInt(o[2]):null;return{year:s===null?n:s*100,restDateString:r.slice((o[1]||o[2]).length)}}i(qx,"parseYear");function Hx(r,e){if(e===null)return new Date(NaN);let t=r.match(Wx);if(!t)return new Date(NaN);let o=!!t[4],n=bo(t[1]),s=bo(t[2])-1,a=bo(t[3]),u=bo(t[4]),c=bo(t[5])-1;if(o)return Ax(e,u,c)?$x(e,u,c):new Date(NaN);{let f=new Date(0);return!zx(e,s,a)||!Vx(e,n)?new Date(NaN):(f.setUTCFullYear(e,s,Math.max(n,a)),f)}}i(Hx,"parseDate");function bo(r){return r?parseInt(r):1}i(bo,"parseDateUnit");function jx(r){let e=r.match(Fx);if(!e)return NaN;let t=Da(e[1]),o=Da(e[2]),n=Da(e[3]);return Gx(t,o,n)?t*Me+o*de+n*1e3:NaN}i(jx,"parseTime");function Da(r){return r&&parseFloat(r.replace(",","."))||0}i(Da,"parseTimeUnit");function Ux(r){if(r==="Z")return 0;let e=r.match(Lx);if(!e)return 0;let t=e[1]==="+"?-1:1,o=parseInt(e[2]),n=e[3]&&parseInt(e[3])||0;return Jx(o,n)?t*(o*Me+n*de):NaN}i(Ux,"parseTimezone");function $x(r,e,t){let o=new Date(0);o.setUTCFullYear(r,0,4);let n=o.getUTCDay()||7,s=(e-1)*7+t+1-n;return o.setUTCDate(o.getUTCDate()+s),o}i($x,"dayOfISOWeekYear");var Bx=[31,null,31,30,31,30,31,31,30,31,30,31];function ll(r){return r%400===0||r%4===0&&r%100!==0}i(ll,"isLeapYearIndex");function zx(r,e,t){return e>=0&&e<=11&&t>=1&&t<=(Bx[e]||(ll(r)?29:28))}i(zx,"validateDate");function Vx(r,e){return e>=1&&e<=(ll(r)?366:365)}i(Vx,"validateDayOfYearDate");function Ax(r,e,t){return e>=1&&e<=53&&t>=0&&t<=6}i(Ax,"validateWeekDate");function Gx(r,e,t){return r===24?e===0&&t===0:t>=0&&t<60&&e>=0&&e<60&&r>=0&&r<25}i(Gx,"validateTime");function Jx(r,e){return e>=0&&e<=59}i(Jx,"validateTimezone");var kG=dl;function pl(r,e){let t=r.match(/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/);return t?d(Date.UTC(+t[1],+t[2]-1,+t[3],+t[4]-(+t[9]||0)*(t[8]=="-"?-1:1),+t[5]-(+t[10]||0)*(t[8]=="-"?-1:1),+t[6],+((t[7]||"0")+"00").substring(0,3)),e?.in):d(NaN,e?.in)}i(pl,"parseJSON");var _G=pl;function ye(r,e,t){let o=gt(r,t)-e;return o<=0&&(o+=7),bt(r,o,t)}i(ye,"previousDay");var LG=ye;function ml(r,e){return ye(r,5,e)}i(ml,"previousFriday");var jG=ml;function hl(r,e){return ye(r,1,e)}i(hl,"previousMonday");var zG=hl;function yl(r,e){return ye(r,6,e)}i(yl,"previousSaturday");var JG=yl;function xl(r,e){return ye(r,0,e)}i(xl,"previousSunday");var ZG=xl;function gl(r,e){return ye(r,4,e)}i(gl,"previousThursday");var oJ=gl;function wl(r,e){return ye(r,2,e)}i(wl,"previousTuesday");var aJ=wl;function bl(r,e){return ye(r,3,e)}i(bl,"previousWednesday");var lJ=bl;function vl(r){return Math.trunc(r*kn)}i(vl,"quartersToMonths");var hJ=vl;function Tl(r){let e=r/Pn;return Math.trunc(e)}i(Tl,"quartersToYears");var wJ=Tl;function Dl(r,e){let t=e?.nearestTo??1;if(t<1||t>12)return y(e?.in||r,NaN);let o=d(r,e?.in),n=o.getMinutes()/60,s=o.getSeconds()/60/60,a=o.getMilliseconds()/1e3/60/60,u=o.getHours()+n+s+a,c=e?.roundingMethod??"round",l=me(c)(u/t)*t;return o.setHours(l,0,0,0),o}i(Dl,"roundToNearestHours");var MJ=Dl;function Sl(r,e){let t=e?.nearestTo??1;if(t<1||t>30)return y(r,NaN);let o=d(r,e?.in),n=o.getSeconds()/60,s=o.getMilliseconds()/1e3/60,a=o.getMinutes()+n+s,u=e?.roundingMethod??"round",f=me(u)(a/t)*t;return o.setMinutes(f,0,0),o}i(Sl,"roundToNearestMinutes");var CJ=Sl;function Ml(r){let e=r/Lt;return Math.trunc(e)}i(Ml,"secondsToHours");var WJ=Ml;function Ol(r){return r*lr}i(Ol,"secondsToMilliseconds");var qJ=Ol;function El(r){let e=r/pr;return Math.trunc(e)}i(El,"secondsToMinutes");var $J=El;function Cr(r,e,t){let o=d(r,t?.in),n=o.getFullYear(),s=o.getDate(),a=y(t?.in||r,0);a.setFullYear(n,e,15),a.setHours(0,0,0,0);let u=oi(a);return o.setMonth(e,Math.min(s,u)),o}i(Cr,"setMonth");var JJ=Cr;function kl(r,e,t){let o=d(r,t?.in);return isNaN(+o)?y(t?.in||r,NaN):(e.year!=null&&o.setFullYear(e.year),e.month!=null&&(o=Cr(o,e.month)),e.date!=null&&o.setDate(e.date),e.hours!=null&&o.setHours(e.hours),e.minutes!=null&&o.setMinutes(e.minutes),e.seconds!=null&&o.setSeconds(e.seconds),e.milliseconds!=null&&o.setMilliseconds(e.milliseconds),o)}i(kl,"set");var t9=kl;function Il(r,e,t){let o=d(r,t?.in);return o.setDate(e),o}i(Il,"setDate");var i9=Il;function Pl(r,e,t){let o=d(r,t?.in);return o.setMonth(0),o.setDate(e),o}i(Pl,"setDayOfYear");var c9=Pl;function Cl(r){let e={},t=L();for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&(r[o]===void 0?delete e[o]:e[o]=r[o]);Zu(e)}i(Cl,"setDefaultOptions");var p9=Cl;function _l(r,e,t){let o=d(r,t?.in);return o.setHours(e),o}i(_l,"setHours");var x9=_l;function Rl(r,e,t){let o=d(r,t?.in);return o.setMilliseconds(e),o}i(Rl,"setMilliseconds");var v9=Rl;function Nl(r,e,t){let o=d(r,t?.in);return o.setMinutes(e),o}i(Nl,"setMinutes");var M9=Nl;function Wl(r,e,t){let o=d(r,t?.in),n=Math.trunc(o.getMonth()/3)+1,s=e-n;return Cr(o,o.getMonth()+s*3)}i(Wl,"setQuarter");var P9=Wl;function Fl(r,e,t){let o=d(r,t?.in);return o.setSeconds(e),o}i(Fl,"setSeconds");var N9=Fl;function Ll(r,e,t){let o=L(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,s=ne(d(r,t?.in),Ut(r,t),t),a=y(t?.in||r,0);a.setFullYear(e,0,n),a.setHours(0,0,0,0);let u=Ut(a,t);return u.setDate(u.getDate()+s),u}i(Ll,"setWeekYear");var U9=Ll;function Yl(r,e,t){let o=d(r,t?.in);return isNaN(+o)?y(t?.in||r,NaN):(o.setFullYear(e),o)}i(Yl,"setYear");var A9=Yl;function ql(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=Math.floor(o/10)*10;return t.setFullYear(n,0,1),t.setHours(0,0,0,0),t}i(ql,"startOfDecade");var Q9=ql;function Hl(r){return ze(Date.now(),r)}i(Hl,"startOfToday");var tK=Hl;function jl(r){let e=R(r?.in),t=e.getFullYear(),o=e.getMonth(),n=e.getDate(),s=y(r?.in,0);return s.setFullYear(t,o,n+1),s.setHours(0,0,0,0),s}i(jl,"startOfTomorrow");var sK=jl;function Ul(r){let e=R(r?.in),t=e.getFullYear(),o=e.getMonth(),n=e.getDate(),s=R(r?.in);return s.setFullYear(t,o,n-1),s.setHours(0,0,0,0),s}i(Ul,"startOfYesterday");var fK=Ul;function ss(r,e,t){return $e(r,-e,t)}i(ss,"subMonths");var mK=ss;function $l(r,e,t){let{years:o=0,months:n=0,weeks:s=0,days:a=0,hours:u=0,minutes:c=0,seconds:f=0}=e,l=ss(r,n+o*12,t),p=bt(l,a+s*7,t),m=c+u*60,x=(f+m*60)*1e3;return y(t?.in||r,+p-x)}i($l,"sub");var bK=$l;function Bl(r,e,t){return Rn(r,-e,t)}i(Bl,"subBusinessDays");var SK=Bl;function zl(r,e,t){return Nn(r,-e,t)}i(zl,"subHours");var kK=zl;function Vl(r,e,t){return lt(r,-e,t)}i(Vl,"subMilliseconds");var _K=Vl;function Al(r,e,t){return mr(r,-e,t)}i(Al,"subMinutes");var FK=Al;function Gl(r,e,t){return hr(r,-e,t)}i(Gl,"subQuarters");var HK=Gl;function Jl(r,e,t){return Ln(r,-e,t)}i(Jl,"subSeconds");var BK=Jl;function Kl(r,e,t){return dt(r,-e,t)}i(Kl,"subWeeks");var GK=Kl;function Ql(r,e,t){return Yn(r,-e,t)}i(Ql,"subYears");var XK=Ql;function Xl(r){return Math.trunc(r*7)}i(Xl,"weeksToDays");var r7=Xl;function Zl(r){return Math.trunc(r*365.2425)}i(Zl,"yearsToDays");var s7=Zl;function ed(r){return Math.trunc(r*In)}i(ed,"yearsToMonths");var f7=ed;function td(r){return Math.trunc(r*Pn)}i(td,"yearsToQuarters");var m7=td;var nd=i(r=>Number.isFinite(r)?r:0,"toZeroIfInfinity");function Kx(r){return{days:Math.trunc(r/864e5),hours:Math.trunc(r/36e5%24),minutes:Math.trunc(r/6e4%60),seconds:Math.trunc(r/1e3%60),milliseconds:Math.trunc(r%1e3),microseconds:Math.trunc(nd(r*1e3)%1e3),nanoseconds:Math.trunc(nd(r*1e6)%1e3)}}i(Kx,"parseNumber");function Qx(r){return{days:r/86400000n,hours:r/3600000n%24n,minutes:r/60000n%60n,seconds:r/1000n%60n,milliseconds:r%1000n,microseconds:0n,nanoseconds:0n}}i(Qx,"parseBigint");function ka(r){switch(typeof r){case"number":{if(Number.isFinite(r))return Kx(r);break}case"bigint":return Qx(r)}throw new TypeError("Expected a finite number or bigint")}i(ka,"parseMilliseconds");var Xx=i(r=>r===0||r===0n,"isZero"),Zx=i((r,e)=>e===1||e===1n?r:`${r}s`,"pluralize"),eg=1e-7,tg=24n*60n*60n*1000n;function To(r,e){let t=typeof r=="bigint";if(!t&&!Number.isFinite(r))throw new TypeError("Expected a finite number or bigint");e={...e};let o=r<0?"-":"";r=r<0?-r:r,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let n=[],s=i((l,p)=>{let m=Math.floor(l*10**p+eg);return(Math.round(m)/10**p).toFixed(p)},"floorDecimals"),a=i((l,p,m,h)=>{if(!((n.length===0||!e.colonNotation)&&Xx(l)&&!(e.colonNotation&&m==="m"))){if(h??=String(l),e.colonNotation){let x=h.includes(".")?h.split(".")[0].length:h.length,g=n.length>0?2:1;h="0".repeat(Math.max(0,g-x))+h}else h+=e.verbose?" "+Zx(p,l):m;n.push(h)}},"add"),u=ka(r),c=BigInt(u.days);if(e.hideYearAndDays?a(BigInt(c)*24n+BigInt(u.hours),"hour","h"):(e.hideYear?a(c,"day","d"):(a(c/365n,"year","y"),a(c%365n,"day","d")),a(Number(u.hours),"hour","h")),a(Number(u.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&r<1e3&&!e.subSecondsAsDecimals){let l=Number(u.seconds),p=Number(u.milliseconds),m=Number(u.microseconds),h=Number(u.nanoseconds);if(a(l,"second","s"),e.formatSubMilliseconds)a(p,"millisecond","ms"),a(m,"microsecond","\xB5s"),a(h,"nanosecond","ns");else{let x=p+m/1e3+h/1e6,g=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,w=x>=1?Math.round(x):Math.ceil(x),v=g?x.toFixed(g):w;a(Number.parseFloat(v),"millisecond","ms",v)}}else{let l=(t?Number(r%tg):r)/1e3%60,p=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,m=s(l,p),h=e.keepDecimalsOnWholeSeconds?m:m.replace(/\.0+$/,"");a(Number.parseFloat(h),"second","s",h)}if(n.length===0)return o+"0"+(e.verbose?" milliseconds":"ms");let f=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(n=n.slice(0,Math.max(e.unitCount,1))),o+n.join(f)}i(To,"prettyMilliseconds");var Bt=or(rd(),1),id=or(od(),1);Bt.default.extend(id.default);var Do=class{static{i(this,"CronJob")}constructor(e,t,o){this.status="initial",this.nextExecutionUnix=0,this.cronExpression=t,this.jobFunction=o,this.cronParser=new fo.Cron(t)}checkExecution(){if(this.status==="stopped")return this.nextExecutionUnix;if(this.nextExecutionUnix===0&&this.getNextExecutionTime(),Date.now()>this.nextExecutionUnix){let e=this.jobFunction(this.nextExecutionUnix);e instanceof Promise&&e.catch(t=>console.log(t)),this.nextExecutionUnix=this.getNextExecutionTime()}return this.nextExecutionUnix}getNextExecutionTime(){return this.nextExecutionUnix=Date.now()+this.getTimeToNextExecution()}getTimeToNextExecution(){return this.cronParser.msToNext()}start(){this.status="started"}stop(){this.status="stopped"}};var Ia=class{static{i(this,"CronManager")}constructor(){this.status="stopped",this.cronjobs=new Se.ObjectMap,this.cycleWakeDeferred=null}wakeCycle(){this.cycleWakeDeferred&&this.cycleWakeDeferred.status==="pending"&&this.cycleWakeDeferred.resolve()}addCronjob(e,t){let o=new Do(this,e,t);return this.cronjobs.add(o),this.status==="started"&&(o.start(),this.wakeCycle()),o}removeCronjob(e){e.stop(),this.cronjobs.remove(e),this.status==="started"&&this.wakeCycle()}start(){if(this.status!=="started"){this.status="started";for(let e of this.cronjobs.getArray())e.start();this.runCronCycle()}}async runCronCycle(){for(;this.status==="started";){this.cycleWakeDeferred=new F.Deferred;let e=1/0;for(let t of this.cronjobs.getArray()){t.checkExecution();let o=t.getTimeToNextExecution();o<e&&(e=o)}if(e<1/0&&e>0)this.executionTimeout=new j.Timeout(e),await Promise.race([this.executionTimeout.promise,this.cycleWakeDeferred.promise]),this.executionTimeout.cancel();else{if(e<=0)continue;await this.cycleWakeDeferred.promise}}this.cycleWakeDeferred=null}stop(){this.status==="started"&&(this.status="stopped",this.executionTimeout&&this.executionTimeout.cancel(),this.wakeCycle());for(let e of this.cronjobs.getArray())e.stop()}};var vt={years:i((r=1)=>r*3154e7,"years"),months:i((r=1)=>r*2628e6,"months"),weeks:i((r=1)=>r*6048e5,"weeks"),days:i((r=1)=>r*864e5,"days"),hours:i((r=1)=>r*36e5,"hours"),minutes:i((r=1)=>r*6e4,"minutes"),seconds:i((r=1)=>r*1e3,"seconds")},Pa=i(r=>{let e=0,t=i(o=>{e=e+o},"addMilliSeconds");return r.years&&t(vt.years(r.years)),r.months&&t(vt.months(r.months)),r.weeks&&t(vt.weeks(r.weeks)),r.days&&t(vt.days(r.days)),r.hours&&t(vt.hours(r.hours)),r.minutes&&t(vt.minutes(r.minutes)),r.seconds&&t(vt.seconds(r.seconds)),e},"getMilliSecondsFromUnits"),rg=i(r=>To(r),"getMilliSecondsAsHumanReadableString"),og=i(r=>vo.formatDistanceToNow(new Date(r)),"getMilliSecondsAsHumanReadableAgoTime");var Ca=class r extends Date{static{i(this,"ExtendedDate")}static fromMillis(e){return new r(e)}static fromDate(e){return new r(e.getTime())}static fromEuropeanDate(e){let t=/(.*)\.(.*)\.(.*)/.exec(e),n=new Date(parseFloat(t[3]),parseFloat(t[2])-1,parseFloat(t[1])).getTime();return new r(n)}static fromHyphedDate(e){let t=new Date(e).getTime();return new r(t)}static fromEuropeanDateAndTime(e,t="12:00:00",o="Europe/Berlin"){let n=/(.*)\.(.*)\.(.*)/.exec(e),s=i(f=>`0${f}`.slice(-2),"sliceDate"),a=`${n[3]}-${s(n[2])}-${s(n[1])}T${t}`,c=Bt.default(a).toDate().getTime();return new r(c)}constructor(e=Date.now()){super(e)}exportToEuropeanDate(){let e=this.exportToUnits();return`${e.dayString}.${e.monthString}.${e.yearString}`}exportToHyphedSortableDate(){let e=this.exportToUnits();return`${e.yearString}-${e.monthString}-${e.dayString}`}exportToUnits(){let e=["January","February","March","April","May","June","July","August","September","October","November","December"],t=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];return{year:this.getFullYear(),yearString:`${this.getFullYear()}`,month:this.getMonth()+1,monthString:("0"+(this.getMonth()+1)).slice(-2),monthName:e[this.getMonth()],day:this.getDate(),dayString:("0"+this.getDate()).slice(-2),dayOfTheWeek:this.getDay(),dayOfTheWeekName:t[this.getDay()]}}format(e){return Bt.default(this.getTime()).format(e)}isToday(){return Bt.default(this.getTime()).isToday()}lessTimePassedToNow(e){let t=Pa(e);return Date.now()-this.getTime()<t}moreTimePassedToNow(e){return!this.lessTimePassedToNow(e)}};var _a=class{static{i(this,"HrtMeasurement")}constructor(){this.nanoSeconds=null,this.milliSeconds=null,this._milliStart=null,this._milliDiff=null,this._started=!1}start(){this._started=!0,this._milliStart=Date.now()}stop(){if(this._started===!1){console.log("Hasn't started yet");return}return this._milliDiff=Date.now()-this._milliStart,this.nanoSeconds=this._milliDiff*1e3,this.milliSeconds=this._milliDiff,this}reset(){this.nanoSeconds=null,this.milliSeconds=null,this._milliStart=null,this._milliDiff=null,this._started=!1}};var Ra=class{static{i(this,"Interval")}constructor(e){this.status="initial",this.statusAuthorization=null,this.intervalJobs=[],this.intervalMilliseconds=e}start(){this.status="started";let e=new Date;this.statusAuthorization=e,i(async()=>{for(;this.status==="started"&&this.statusAuthorization===e;)await j.delayFor(this.intervalMilliseconds),this.executeIntervalJobs()},"runInterval")()}stop(){this.status="stopped",this.statusAuthorization=null}addIntervalJob(e){this.intervalJobs.push(e)}executeIntervalJobs(){for(let e of this.intervalJobs)e()}};var Rr=class r{static{i(this,"TimeStamp")}static fromMilliSeconds(e){return new r(e)}static fromTimeStamp(e){let t=new r;return t.change=t.milliSeconds-e.milliSeconds,t}constructor(e){this.change=null,e?typeof e=="number"&&(this.date=new Date(e)):this.date=new Date,this.milliSeconds=this.date.getTime(),this.epochtime=Math.floor(this.milliSeconds/1e3)}isOlderThanOtherTimeStamp(e,t=0){return this.milliSeconds<e.milliSeconds-t}isOlderThan(e,t=0){return this.milliSeconds+t<e.milliSeconds}isYoungerThanOtherTimeStamp(e,t=0){return this.milliSeconds>e.milliSeconds+t}isYoungerThanMilliSeconds(e){let o=new r().epochtime-e,n=new r(o);return this.isYoungerThanOtherTimeStamp(n)}};var Na=class{static{i(this,"Timer")}get timeLeft(){return this.timeInMilliseconds-this.pausedAt.change}constructor(e){this.state="initiated",this.completedDeferred=F.defer(),this.timeInMilliseconds=e,this.completed=this.completedDeferred.promise}start(){if(!this.startedAt)this.currentTimeout=setTimeout(()=>{this.completedDeferred.resolve()},this.timeInMilliseconds),this.startedAt=new Rr;else throw new Error("timer has been started before. Please use resume instead")}pause(){this.startedAt&&(clearTimeout(this.currentTimeout),this.currentTimeout=null,this.pausedAt=Rr.fromTimeStamp(this.startedAt))}resume(){if(this.startedAt)this.currentTimeout=setTimeout(()=>{this.completedDeferred.resolve()},this.timeLeft);else throw new Error("timer has NOT been started before. Please use .start() instead")}reset(){this.pause(),this.startedAt=null,this.pausedAt=null}};var us=or(yd(),1);var Fa=class{static{i(this,"AsyncExecutionStack")}executionSlots=[];isProcessing=!1;nonExclusiveMaxConcurrency=1/0;nonExclusiveCurrentCount=0;nonExclusivePendingQueue=[];async getExclusiveExecutionSlot(e,t){let o=F.defer(),n={funcToExecute:e,executionDeferred:o,timeout:t,mode:"exclusive"};return this.executionSlots.push(n),this.processExecutionSlots(),o.promise}async getNonExclusiveExecutionSlot(e,t){let o=F.defer(),n={funcToExecute:e,executionDeferred:o,timeout:t,mode:"nonexclusive"};return this.executionSlots.push(n),this.processExecutionSlots(),o.promise}setNonExclusiveMaxConcurrency(e){if(!Number.isFinite(e)||e<1)throw new Error("nonExclusiveMaxConcurrency must be a finite number >= 1");this.nonExclusiveMaxConcurrency=e}getNonExclusiveMaxConcurrency(){return this.nonExclusiveMaxConcurrency}getActiveNonExclusiveCount(){return this.nonExclusiveCurrentCount}getPendingNonExclusiveCount(){return this.nonExclusivePendingQueue.length}async processExecutionSlots(){if(!this.isProcessing){for(this.isProcessing=!0;this.executionSlots.length>0;){let e=this.executionSlots[0];if(e.mode==="exclusive")await this.executeExclusiveSlot(e),this.executionSlots.shift();else{let t=[];for(;this.executionSlots.length>0&&this.executionSlots[0].mode==="nonexclusive";)t.push(this.executionSlots.shift());await this.executeNonExclusiveSlots(t)}}this.isProcessing=!1}}async executeExclusiveSlot(e){try{if(e.timeout){let t=new j.Timeout(e.timeout);try{let o=await Promise.race([e.funcToExecute(),t.promise.then(()=>{throw new Error("Timeout reached")})]);t.cancel(),e.executionDeferred.resolve(o)}catch(o){throw t.cancel(),o}}else{let t=await e.funcToExecute();e.executionDeferred.resolve(t)}}catch(t){e.executionDeferred.reject(t)}}async executeNonExclusiveSlots(e){let t=e.map(async o=>{await this.waitForNonExclusiveSlot();try{if(o.timeout){let n=new j.Timeout(o.timeout);try{let s=await Promise.race([o.funcToExecute(),n.promise.then(()=>{throw new Error("Timeout reached")})]);n.cancel(),o.executionDeferred.resolve(s)}catch(s){throw n.cancel(),s}}else{let n=await o.funcToExecute();o.executionDeferred.resolve(n)}}catch(n){o.executionDeferred.reject(n)}finally{this.releaseNonExclusiveSlot()}});await Promise.all(t)}waitForNonExclusiveSlot(){return this.nonExclusiveCurrentCount<this.nonExclusiveMaxConcurrency?(this.nonExclusiveCurrentCount++,Promise.resolve()):new Promise(e=>{this.nonExclusivePendingQueue.push(()=>{this.nonExclusiveCurrentCount++,e()})})}releaseNonExclusiveSlot(){this.nonExclusiveCurrentCount--;let e=this.nonExclusivePendingQueue.shift();e&&e()}};var La=class{static{i(this,"BackpressuredArray")}data;highWaterMark;hasSpace=new Ce.rxjs.Subject;itemsAvailable=new Ce.rxjs.Subject;isDestroyed=!1;constructor(e=16){this.data=[],this.highWaterMark=e}get length(){return this.data.length}push(e){this.data.push(e),this.itemsAvailable.next("itemsAvailable");let t=this.checkSpaceAvailable();return t&&this.hasSpace.next("hasSpace"),t}pushMany(e){for(let t of e)this.push(t);return this.checkSpaceAvailable()}shift(){let e=this.data.shift();return this.checkSpaceAvailable()&&this.hasSpace.next("hasSpace"),e}peek(){return this.data[0]}checkSpaceAvailable(){return this.data.length<this.highWaterMark}checkHasItems(){return this.data.length>0}waitForSpace(){return new Promise(e=>{if(this.checkSpaceAvailable()||this.isDestroyed)e();else{let t=this.hasSpace.subscribe({next:i(()=>{t.unsubscribe(),e()},"next"),complete:i(()=>{e()},"complete")})}})}waitForItems(){return new Promise(e=>{if(this.data.length>0||this.isDestroyed)e();else{let t=this.itemsAvailable.subscribe({next:i(()=>{t.unsubscribe(),e()},"next"),complete:i(()=>{e()},"complete")})}})}[Symbol.iterator](){return this.data[Symbol.iterator]()}destroy(){this.isDestroyed=!0,this.hasSpace.complete(),this.itemsAvailable.complete()}};var So=class r{static{i(this,"FastMap")}mapObject=new Map;isUniqueKey(e){return!this.mapObject.has(e)}has(e){return this.mapObject.has(e)}get size(){return this.mapObject.size}addToMap(e,t,o){return this.isUniqueKey(e)||o&&o.force?(this.mapObject.set(e,t),!0):!1}getByKey(e){return this.mapObject.get(e)}removeFromMap(e){let t=this.mapObject.get(e);return this.mapObject.delete(e),t}getKeys(){return Array.from(this.mapObject.keys())}values(){return Array.from(this.mapObject.values())}entries(){return Array.from(this.mapObject.entries())}clean(){this.mapObject.clear()}concat(e){let t=new r;for(let o of this.getKeys())t.addToMap(o,this.getByKey(o));for(let o of e.getKeys())t.addToMap(o,e.getByKey(o),{force:!0});return t}addAllFromOther(e){for(let t of e.getKeys())this.addToMap(t,e.getByKey(t),{force:!0})}async find(e){for(let t of this.getKeys()){let o=this.getByKey(t);if(await e(o))return o}}[Symbol.iterator](){return this.mapObject.entries()}};var xd=i((r="uni")=>`${r}xxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),"uni"),Vt=class r{static{i(this,"ObjectMap")}fastMap=new So;reverseMap=new Map;eventSubject=new Ce.rxjs.Subject;constructor(){}get length(){return this.fastMap.size}addMappedUnique(e,t){this.fastMap.addToMap(e,t),this.reverseMap.set(t,e)}getMappedUnique(e){return this.fastMap.getByKey(e)}removeMappedUnique(e){let t=this.fastMap.removeFromMap(e);return t!==void 0&&(this.reverseMap.delete(t),this.eventSubject.next({operation:"remove",payload:t})),t}add(e){let t=this.reverseMap.get(e);if(t!==void 0)return t;let o=xd("key");return this.addMappedUnique(o,e),this.eventSubject.next({operation:"add",payload:e}),o}addArray(e){for(let t of e)this.add(t)}checkForObject(e){return this.reverseMap.has(e)}getKeyForObject(e){return this.reverseMap.get(e)??null}async find(e){return this.fastMap.find(e)}findSync(e){for(let t of this.fastMap.getKeys())if(e(this.fastMap.getByKey(t)))return this.getMappedUnique(t)}async findOneAndRemove(e){let t=await this.find(e);return t&&this.remove(t),t}findOneAndRemoveSync(e){let t=this.findSync(e);return t&&this.remove(t),t}async forEach(e){for(let t of this.fastMap.getKeys())await e(this.fastMap.getByKey(t))}getOneAndRemove(){let e=this.fastMap.getKeys();if(e.length===0)return null;{let t=e[0],o=this.fastMap.removeFromMap(t);return this.reverseMap.delete(o),this.eventSubject.next({operation:"remove",payload:o}),o}}getArray(){return this.fastMap.values()}isEmpty(){return this.fastMap.size===0}remove(e){let t=this.reverseMap.get(e);if(t!==void 0){let o=this.fastMap.removeFromMap(t);return this.reverseMap.delete(o),this.eventSubject.next({operation:"remove",payload:o}),o}return null}wipe(){let e=this.fastMap.getKeys();for(let t of e){let o=this.fastMap.removeFromMap(t);this.reverseMap.delete(o),this.eventSubject.next({operation:"remove",payload:o})}}concat(e){let t=new r;t.fastMap.addAllFromOther(this.fastMap),t.fastMap.addAllFromOther(e.fastMap);for(let o of t.fastMap.getKeys())t.reverseMap.set(t.fastMap.getByKey(o),o);return t}addAllFromOther(e){this.fastMap.addAllFromOther(e.fastMap);for(let t of e.fastMap.getKeys())this.reverseMap.set(e.fastMap.getByKey(t),t)}map(e){return this.getArray().map(e)}filter(e){return this.getArray().filter(e)}reduce(e,t){return this.getArray().reduce(e,t)}[Symbol.iterator](){return this.getArray()[Symbol.iterator]()}destroy(){this.wipe(),this.reverseMap.clear(),this.eventSubject.complete()}};var Mo=class{static{i(this,"Interest")}options;interestMapRef;originalInterest;comparisonFunc;destructionTimer=new zt.Timer(1e4);isFullfilled=!1;isDestroyed=!1;fullfillmentStore=[];markLostTimeout=null;get comparisonString(){return this.comparisonFunc(this.originalInterest)}interestDeferred=new F.Deferred;interestFullfilled=this.interestDeferred.promise;fullfillInterest(e){this.isFullfilled=!0,this.fullfillmentStore=[],this.interestDeferred.resolve(e),this.destroy()}constructor(e,t,o,n){this.interestMapRef=e,this.originalInterest=t,this.comparisonFunc=o,this.options=n,this.destructionTimer.completed.then(()=>{this.isDestroyed||this.destroy()}),this.options?.markLostAfterDefault&&(this.markLostTimeout=new j.Timeout(this.options.markLostAfterDefault),this.markLostTimeout.promise.then(()=>{this.isDestroyed||this.markLost()}))}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.destructionTimer.reset(),this.markLostTimeout&&(this.markLostTimeout.cancel(),this.markLostTimeout=null),this.fullfillmentStore=[],this.interestMapRef.removeInterest(this),!this.isFullfilled&&this.options?.defaultFullfillment&&(this.isFullfilled=!0,this.interestDeferred.resolve(this.options.defaultFullfillment)))}markLost(){this.destructionTimer.start()}renew(){this.destructionTimer.reset()}};var Ya=class{static{i(this,"InterestMap")}options;interestObjectMap=new Vt;interestsByComparisonString=new Map;comparisonStringsByInterest=new WeakMap;comparisonFunc;constructor(e,t={}){this.comparisonFunc=e,this.options=t}async addInterest(e,t){let o=this.comparisonFunc(e),n,s=this.interestsByComparisonString.get(o);return s?(n=s,n.renew()):(n=new Mo(this,e,this.comparisonFunc,{markLostAfterDefault:this.options.markLostAfterDefault,defaultFullfillment:t}),this.interestObjectMap.add(n),this.comparisonStringsByInterest.set(n,o),this.interestsByComparisonString.set(o,n)),this.interestObservable.push(n),n}interestObservable=new Ce.ObservableIntake;removeInterest(e){if(!this.comparisonStringsByInterest.has(e))return;let t=this.comparisonStringsByInterest.get(e);this.interestObjectMap.remove(e),this.comparisonStringsByInterest.delete(e),this.interestsByComparisonString.get(t)===e&&this.interestsByComparisonString.delete(t)}checkInterest(e){let t=this.comparisonFunc(e);return this.checkInterestByString(t)}checkInterestByString(e){return this.interestsByComparisonString.has(e)}informLostInterest(e){let t=this.findInterest(e);t&&t.markLost()}findInterest(e){let t=this.comparisonFunc(e);return this.interestsByComparisonString.get(t)??null}destroy(){let e=this.interestObjectMap.getArray();for(let t of e)t.destroy();this.interestObjectMap.wipe(),this.interestsByComparisonString.clear(),this.interestObservable.signalComplete()}};var qa=class{static{i(this,"LimitedArray")}array=[];arrayLimit;constructor(e){this.arrayLimit=e}get length(){return this.array.length}addOne(e){this.array.unshift(e),this.array.length>this.arrayLimit&&(this.array.length=this.arrayLimit)}addMany(e){for(let t of e)this.addOne(t)}setLimit(e){this.arrayLimit=e,this.array.length>this.arrayLimit&&(this.array.length=this.arrayLimit)}getAverage(){if(this.array.length===0)return 0;if(typeof this.array[0]=="number"){let e=0;for(let t of this.array)e=e+t;return e/this.array.length}else return null}remove(e){let t=this.array.indexOf(e);return t!==-1?(this.array.splice(t,1),!0):!1}clear(){this.array.length=0}getArray(){return[...this.array]}[Symbol.iterator](){return this.array[Symbol.iterator]()}};var Ha=class{static{i(this,"LoopTracker")}referenceObjectMap=new Vt;constructor(){}checkAndTrack(e){return this.referenceObjectMap.checkForObject(e)?!1:(this.referenceObjectMap.add(e),!0)}reset(){this.referenceObjectMap.wipe()}destroy(){this.referenceObjectMap.destroy()}};var ja=class{static{i(this,"Stringmap")}_stringArray=[];_triggerUntilTrueFunctionArray=[];constructor(){}addString(e){this._stringArray.push(e),this.notifyTrigger()}addStringArray(e){for(let t of e)this.addString(t)}removeString(e){this._stringArray=this._stringArray.filter(t=>t!==e),this.notifyTrigger()}wipe(){this._stringArray=[],this.notifyTrigger()}checkString(e){return this._stringArray.indexOf(e)!==-1}checkMinimatch(e){let t=new Zr.SmartMatch(e),o=!1;for(let n of this._stringArray)t.match(n)&&(o=!0);return o}checkIsEmpty(){return this._stringArray.length===0}getStringArray(){let e=[];for(let t of this._stringArray)e.push(t);return e}registerUntilTrue(e,t){let o=F.defer();return this._triggerUntilTrueFunctionArray.push(()=>{let n=e(this.getStringArray());return n===!0&&(t&&t(),o.resolve()),n}),this.notifyTrigger(),o.promise}notifyTrigger(){let e=this._triggerUntilTrueFunctionArray.filter(t=>!t());this._triggerUntilTrueFunctionArray=e}destroy(){this._stringArray=[],this._triggerUntilTrueFunctionArray=[]}};var Oo=class{static{i(this,"TimedAggregtor")}options;storageArray=[];isStopped=!1;constructor(e){this.options=e}aggregationTimer;checkAggregationStatus(){if(this.isStopped)return;let e=i(()=>{this.aggregationTimer=new zt.Timer(this.options.aggregationIntervalInMillis),this.aggregationTimer.completed.then(()=>{if(this.isStopped){this.aggregationTimer=null;return}let t=this.storageArray;if(t.length===0){this.aggregationTimer=null;return}this.storageArray=[],e(),this.options.functionForAggregation(t)}),this.aggregationTimer.start()},"addAggregationTimer");this.aggregationTimer||e()}add(e){this.isStopped||(this.storageArray.push(e),this.checkAggregationStatus())}stop(e=!1){if(this.isStopped=!0,this.aggregationTimer&&(this.aggregationTimer.reset(),this.aggregationTimer=null),e&&this.storageArray.length>0){let t=this.storageArray;this.storageArray=[],this.options.functionForAggregation(t)}else this.storageArray=[]}restart(){this.isStopped=!1}};var Ua=class{static{i(this,"Tree")}symbolTree;constructor(){this.symbolTree=new us.default}initialize(e){return this.symbolTree.initialize(e)}hasChildren(e){return this.symbolTree.hasChildren(e)}firstChild(e){return this.symbolTree.firstChild(e)}lastChild(e){return this.symbolTree.lastChild(e)}previousSibling(e){return this.symbolTree.previousSibling(e)}nextSibling(e){return this.symbolTree.nextSibling(e)}parent(e){return this.symbolTree.parent(e)}lastInclusiveDescendant(e){return this.symbolTree.lastInclusiveDescendant(e)}preceding(e,t){return this.symbolTree.preceding(e,t)}following(e,t){return this.symbolTree.following(e,t)}childrenToArray(e,t){return this.symbolTree.childrenToArray(e,t)}ancestorsToArray(e,t){return this.symbolTree.ancestorsToArray(e,t)}treeToArray(e,t){return this.symbolTree.treeToArray(e,t)}childrenIterator(e,t){return this.symbolTree.childrenIterator(e,t)}previousSiblingsIterator(e){return this.symbolTree.previousSiblingsIterator(e)}nextSiblingsIterator(e){return this.symbolTree.nextSiblingsIterator(e)}ancestorsIterator(e){return this.symbolTree.ancestorsIterator(e)}treeIterator(e,t){return this.symbolTree.treeIterator(e,t)}index(e){return this.symbolTree.index(e)}childrenCount(e){return this.symbolTree.childrenCount(e)}compareTreePosition(e,t){return this.symbolTree.compareTreePosition(e,t)}remove(e){return this.symbolTree.remove(e)}insertBefore(e,t){return this.symbolTree.insertBefore(e,t)}insertAfter(e,t){return this.symbolTree.insertAfter(e,t)}prependChild(e,t){return this.symbolTree.prependChild(e,t)}appendChild(e,t){return this.symbolTree.appendChild(e,t)}toJsonWithHierachy(e){let t=i(o=>{let n=[];if(this.hasChildren(o)){let s=this.childrenToArray(o,{});for(let a of s)n.push(t(a))}return{data:o,children:n}},"buildNode");return t(e)}fromJsonWithHierachy(e,t){let o=i((n,s)=>{let a=t?t(n.data):n.data;this.initialize(a),s&&this.appendChild(s,a);for(let u of n.children)o(u,a);return a},"buildTree");return o(e)}};var At={};A(At,{base64ToUint8Array:()=>kg,ensurePureUint8Array:()=>Cg,isBufferLike:()=>Pg,isUint8Array:()=>Ig,uInt8ArrayExtras:()=>Og,uInt8ArrayToBase64:()=>Eg});var Ot={};A(Ot,{areUint8ArraysEqual:()=>pg,assertUint8Array:()=>Mt,assertUint8ArrayOrArrayBuffer:()=>Td,base64ToString:()=>wg,base64ToUint8Array:()=>Od,compareUint8Arrays:()=>mg,concatUint8Arrays:()=>dg,getUintBE:()=>Dg,hexToUint8Array:()=>Tg,includes:()=>Sg,indexOf:()=>Ed,isUint8Array:()=>$a,stringToBase64:()=>gg,stringToUint8Array:()=>Sd,toUint8Array:()=>lg,uint8ArrayToBase64:()=>Md,uint8ArrayToHex:()=>vg,uint8ArrayToString:()=>Dd});var sg=Object.prototype.toString,ag="[object Uint8Array]",ug="[object ArrayBuffer]";function gd(r,e,t){return r?r.constructor===e?!0:sg.call(r)===t:!1}i(gd,"isType");function $a(r){return gd(r,Uint8Array,ag)}i($a,"isUint8Array");function cg(r){return gd(r,ArrayBuffer,ug)}i(cg,"isArrayBuffer");function fg(r){return $a(r)||cg(r)}i(fg,"isUint8ArrayOrArrayBuffer");function Mt(r){if(!$a(r))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof r}\``)}i(Mt,"assertUint8Array");function Td(r){if(!fg(r))throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof r}\``)}i(Td,"assertUint8ArrayOrArrayBuffer");function lg(r){if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new TypeError(`Unsupported value, got \`${typeof r}\`.`)}i(lg,"toUint8Array");function dg(r,e){if(r.length===0)return new Uint8Array(0);e??=r.reduce((n,s)=>n+s.length,0);let t=new Uint8Array(e),o=0;for(let n of r)Mt(n),t.set(n,o),o+=n.length;return t}i(dg,"concatUint8Arrays");function pg(r,e){if(Mt(r),Mt(e),r===e)return!0;if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}i(pg,"areUint8ArraysEqual");function mg(r,e){Mt(r),Mt(e);let t=Math.min(r.length,e.length);for(let o=0;o<t;o++){let n=r[o]-e[o];if(n!==0)return Math.sign(n)}return Math.sign(r.length-e.length)}i(mg,"compareUint8Arrays");var wd={utf8:new globalThis.TextDecoder("utf8")};function Dd(r,e="utf8"){return Td(r),wd[e]??=new globalThis.TextDecoder(e),wd[e].decode(r)}i(Dd,"uint8ArrayToString");function Eo(r){if(typeof r!="string")throw new TypeError(`Expected \`string\`, got \`${typeof r}\``)}i(Eo,"assertString");var hg=new globalThis.TextEncoder;function Sd(r){return Eo(r),hg.encode(r)}i(Sd,"stringToUint8Array");function yg(r){return r.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}i(yg,"base64ToBase64Url");function xg(r){let e=r.replaceAll("-","+").replaceAll("_","/"),t=(4-e.length%4)%4;return e+"=".repeat(t)}i(xg,"base64UrlToBase64");var bd=65535;function Md(r,{urlSafe:e=!1}={}){Mt(r);let t="";for(let o=0;o<r.length;o+=bd){let n=r.subarray(o,o+bd);t+=globalThis.btoa(String.fromCodePoint.apply(void 0,n))}return e?yg(t):t}i(Md,"uint8ArrayToBase64");function Od(r){return Eo(r),Uint8Array.from(globalThis.atob(xg(r)),e=>e.codePointAt(0))}i(Od,"base64ToUint8Array");function gg(r,{urlSafe:e=!1}={}){return Eo(r),Md(Sd(r),{urlSafe:e})}i(gg,"stringToBase64");function wg(r){return Eo(r),Dd(Od(r))}i(wg,"base64ToString");var bg=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function vg(r){Mt(r);let e="";for(let t=0;t<r.length;t++)e+=bg[r[t]];return e}i(vg,"uint8ArrayToHex");var vd={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function Tg(r){if(Eo(r),r.length%2!==0)throw new Error("Invalid Hex string length.");let e=r.length/2,t=new Uint8Array(e);for(let o=0;o<e;o++){let n=vd[r[o*2]],s=vd[r[o*2+1]];if(n===void 0||s===void 0)throw new Error(`Invalid Hex character encountered at position ${o*2}`);t[o]=n<<4|s}return t}i(Tg,"hexToUint8Array");function Dg(r){let{byteLength:e}=r;if(e===6)return r.getUint16(0)*2**32+r.getUint32(2);if(e===5)return r.getUint8(0)*2**32+r.getUint32(1);if(e===4)return r.getUint32(0);if(e===3)return r.getUint8(0)*2**16+r.getUint16(1);if(e===2)return r.getUint16(0);if(e===1)return r.getUint8(0)}i(Dg,"getUintBE");function Ed(r,e){let t=r.length,o=e.length;if(o===0||o>t)return-1;let n=t-o;for(let s=0;s<=n;s++){let a=!0;for(let u=0;u<o;u++)if(r[s+u]!==e[u]){a=!1;break}if(a)return s}return-1}i(Ed,"indexOf");function Sg(r,e){return Ed(r,e)!==-1}i(Sg,"includes");var Og=Ot;function Eg(r){return Ot.uint8ArrayToBase64(r)}i(Eg,"uInt8ArrayToBase64");function kg(r){return Ot.base64ToUint8Array(r)}i(kg,"base64ToUint8Array");var Ig=i(r=>Ot.isUint8Array(r),"isUint8Array");function Pg(r){return r&&typeof r.byteLength=="number"?!0:typeof Buffer<"u"&&Buffer.isBuffer?Buffer.isBuffer(r):!1}i(Pg,"isBufferLike");function Cg(r){let e=new Uint8Array(r.length);return e.set(r),e}i(Cg,"ensurePureUint8Array");var Co={};A(Co,{Guard:()=>ko,GuardError:()=>Io,GuardSet:()=>Po,passGuardsOrReject:()=>_g});var ko=class{static{i(this,"Guard")}constructor(e,t){this.guardFunction=e,this.options=t||{}}async exec(e){return await this.guardFunction(e)}async getFailedHint(e){return await this.exec(e)?null:this.options.failedHint||null}};var Io=class extends Error{static{i(this,"GuardError")}constructor(e){super(e),this.name="GuardError"}};var Po=class extends ko{static{i(this,"GuardSet")}constructor(e=[]){super(async t=>this.allGuardsPass(t)),this.guards=e}async execAllWithData(e,t={mode:"parallel",stopOnFail:!1}){let o=[];for(let s of this.guards){let a=s.exec(e);if(t.mode==="serial"&&await a,o.push(a),t.stopOnFail&&!await a)return await Promise.all(o)}return await Promise.all(o)}async allGuardsPass(e,t={mode:"parallel",stopOnFail:!1}){return(await this.execAllWithData(e,t)).every(n=>n)}async anyGuardsPass(e){return(await this.execAllWithData(e,{mode:"parallel",stopOnFail:!1})).some(o=>o)}async getFailedHint(e){for(let t of this.guards){let o=await t.getFailedHint(e);if(o)return o}return null}};var _g=i(async(r,e)=>{let t=new Po(e);if(!await t.allGuardsPass(r)){let n=await t.getFailedHint(r);throw new Io(`Guards failed:
1
+ var Hp=Object.create;var un=Object.defineProperty;var jp=Object.getOwnPropertyDescriptor;var $p=Object.getOwnPropertyNames;var qp=Object.getPrototypeOf,Bp=Object.prototype.hasOwnProperty;var i=(t,e)=>un(t,"name",{value:e,configurable:!0});var qt=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Y=(t,e)=>{for(var r in e)un(t,r,{get:e[r],enumerable:!0})},zp=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of $p(e))!Bp.call(t,n)&&n!==r&&un(t,n,{get:()=>e[n],enumerable:!(o=jp(e,n))||o.enumerable});return t};var fn=(t,e,r)=>(r=t!=null?Hp(qp(t)):{},zp(e||!t||!t.__esModule?un(r,"default",{value:t,enumerable:!0}):r,t));var Pd=qt((Ka,Xa)=>{(function(t,e){typeof Ka=="object"&&typeof Xa<"u"?Xa.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(Ka,(function(){"use strict";var t=1e3,e=6e4,r=36e5,o="millisecond",n="second",s="minute",a="hour",c="day",u="week",f="month",l="quarter",d="year",p="date",h="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:i(function(k){var D=["th","st","nd","rd"],b=k%100;return"["+k+(D[(b-20)%10]||D[b]||D[0])+"]"},"ordinal")},v=i(function(k,D,b){var E=String(k);return!E||E.length>=D?k:""+Array(D+1-E.length).join(b)+k},"m"),G={s:v,z:i(function(k){var D=-k.utcOffset(),b=Math.abs(D),E=Math.floor(b/60),T=b%60;return(D<=0?"+":"-")+v(E,2,"0")+":"+v(T,2,"0")},"z"),m:i(function k(D,b){if(D.date()<b.date())return-k(b,D);var E=12*(b.year()-D.year())+(b.month()-D.month()),T=D.clone().add(E,f),C=b-T<0,_=D.clone().add(E+(C?-1:1),f);return+(-(E+(b-T)/(C?T-_:_-T))||0)},"t"),a:i(function(k){return k<0?Math.ceil(k)||0:Math.floor(k)},"a"),p:i(function(k){return{M:f,y:d,w:u,d:c,D:p,h:a,m:s,s:n,ms:o,Q:l}[k]||String(k||"").toLowerCase().replace(/s$/,"")},"p"),u:i(function(k){return k===void 0},"u")},ee="en",Q={};Q[ee]=g;var Ce="$isDayjsObject",_e=i(function(k){return k instanceof st||!(!k||!k[Ce])},"S"),it=i(function k(D,b,E){var T;if(!D)return ee;if(typeof D=="string"){var C=D.toLowerCase();Q[C]&&(T=C),b&&(Q[C]=b,T=C);var _=D.split("-");if(!T&&_.length>1)return k(_[0])}else{var q=D.name;Q[q]=D,T=q}return!E&&T&&(ee=T),T||!E&&ee},"t"),K=i(function(k,D){if(_e(k))return k.clone();var b=typeof D=="object"?D:{};return b.date=k,b.args=arguments,new st(b)},"O"),R=G;R.l=it,R.i=_e,R.w=function(k,D){return K(k,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var st=(function(){function k(b){this.$L=it(b.locale,null,!0),this.parse(b),this.$x=this.$x||b.x||{},this[Ce]=!0}i(k,"M");var D=k.prototype;return D.parse=function(b){this.$d=(function(E){var T=E.date,C=E.utc;if(T===null)return new Date(NaN);if(R.u(T))return new Date;if(T instanceof Date)return new Date(T);if(typeof T=="string"&&!/Z$/i.test(T)){var _=T.match(y);if(_){var q=_[2]-1||0,X=(_[7]||"0").substring(0,3);return C?new Date(Date.UTC(_[1],q,_[3]||1,_[4]||0,_[5]||0,_[6]||0,X)):new Date(_[1],q,_[3]||1,_[4]||0,_[5]||0,_[6]||0,X)}}return new Date(T)})(b),this.init()},D.init=function(){var b=this.$d;this.$y=b.getFullYear(),this.$M=b.getMonth(),this.$D=b.getDate(),this.$W=b.getDay(),this.$H=b.getHours(),this.$m=b.getMinutes(),this.$s=b.getSeconds(),this.$ms=b.getMilliseconds()},D.$utils=function(){return R},D.isValid=function(){return this.$d.toString()!==h},D.isSame=function(b,E){var T=K(b);return this.startOf(E)<=T&&T<=this.endOf(E)},D.isAfter=function(b,E){return K(b)<this.startOf(E)},D.isBefore=function(b,E){return this.endOf(E)<K(b)},D.$g=function(b,E,T){return R.u(b)?this[E]:this.set(T,b)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(b,E){var T=this,C=!!R.u(E)||E,_=R.p(b),q=i(function($t,Se){var pt=R.w(T.$u?Date.UTC(T.$y,Se,$t):new Date(T.$y,Se,$t),T);return C?pt:pt.endOf(c)},"l"),X=i(function($t,Se){return R.w(T.toDate()[$t].apply(T.toDate("s"),(C?[0,0,0,0]:[23,59,59,999]).slice(Se)),T)},"$"),oe=this.$W,ue=this.$M,Re=this.$D,xr="set"+(this.$u?"UTC":"");switch(_){case d:return C?q(1,0):q(31,11);case f:return C?q(1,ue):q(0,ue+1);case u:var jt=this.$locale().weekStart||0,uo=(oe<jt?oe+7:oe)-jt;return q(C?Re-uo:Re+(6-uo),ue);case c:case p:return X(xr+"Hours",0);case a:return X(xr+"Minutes",1);case s:return X(xr+"Seconds",2);case n:return X(xr+"Milliseconds",3);default:return this.clone()}},D.endOf=function(b){return this.startOf(b,!1)},D.$set=function(b,E){var T,C=R.p(b),_="set"+(this.$u?"UTC":""),q=(T={},T[c]=_+"Date",T[p]=_+"Date",T[f]=_+"Month",T[d]=_+"FullYear",T[a]=_+"Hours",T[s]=_+"Minutes",T[n]=_+"Seconds",T[o]=_+"Milliseconds",T)[C],X=C===c?this.$D+(E-this.$W):E;if(C===f||C===d){var oe=this.clone().set(p,1);oe.$d[q](X),oe.init(),this.$d=oe.set(p,Math.min(this.$D,oe.daysInMonth())).$d}else q&&this.$d[q](X);return this.init(),this},D.set=function(b,E){return this.clone().$set(b,E)},D.get=function(b){return this[R.p(b)]()},D.add=function(b,E){var T,C=this;b=Number(b);var _=R.p(E),q=i(function(ue){var Re=K(C);return R.w(Re.date(Re.date()+Math.round(ue*b)),C)},"y");if(_===f)return this.set(f,this.$M+b);if(_===d)return this.set(d,this.$y+b);if(_===c)return q(1);if(_===u)return q(7);var X=(T={},T[s]=e,T[a]=r,T[n]=t,T)[_]||1,oe=this.$d.getTime()+b*X;return R.w(oe,this)},D.subtract=function(b,E){return this.add(-1*b,E)},D.format=function(b){var E=this,T=this.$locale();if(!this.isValid())return T.invalidDate||h;var C=b||"YYYY-MM-DDTHH:mm:ssZ",_=R.z(this),q=this.$H,X=this.$m,oe=this.$M,ue=T.weekdays,Re=T.months,xr=T.meridiem,jt=i(function(Se,pt,fo,cn){return Se&&(Se[pt]||Se(E,C))||fo[pt].slice(0,cn)},"h"),uo=i(function(Se){return R.s(q%12||12,Se,"0")},"d"),$t=xr||function(Se,pt,fo){var cn=Se<12?"AM":"PM";return fo?cn.toLowerCase():cn};return C.replace(w,(function(Se,pt){return pt||(function(fo){switch(fo){case"YY":return String(E.$y).slice(-2);case"YYYY":return R.s(E.$y,4,"0");case"M":return oe+1;case"MM":return R.s(oe+1,2,"0");case"MMM":return jt(T.monthsShort,oe,Re,3);case"MMMM":return jt(Re,oe);case"D":return E.$D;case"DD":return R.s(E.$D,2,"0");case"d":return String(E.$W);case"dd":return jt(T.weekdaysMin,E.$W,ue,2);case"ddd":return jt(T.weekdaysShort,E.$W,ue,3);case"dddd":return ue[E.$W];case"H":return String(q);case"HH":return R.s(q,2,"0");case"h":return uo(1);case"hh":return uo(2);case"a":return $t(q,X,!0);case"A":return $t(q,X,!1);case"m":return String(X);case"mm":return R.s(X,2,"0");case"s":return String(E.$s);case"ss":return R.s(E.$s,2,"0");case"SSS":return R.s(E.$ms,3,"0");case"Z":return _}return null})(Se)||_.replace(":","")}))},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(b,E,T){var C,_=this,q=R.p(E),X=K(b),oe=(X.utcOffset()-this.utcOffset())*e,ue=this-X,Re=i(function(){return R.m(_,X)},"D");switch(q){case d:C=Re()/12;break;case f:C=Re();break;case l:C=Re()/3;break;case u:C=(ue-oe)/6048e5;break;case c:C=(ue-oe)/864e5;break;case a:C=ue/r;break;case s:C=ue/e;break;case n:C=ue/t;break;default:C=ue}return T?C:R.a(C)},D.daysInMonth=function(){return this.endOf(f).$D},D.$locale=function(){return Q[this.$L]},D.locale=function(b,E){if(!b)return this.$L;var T=this.clone(),C=it(b,E,!0);return C&&(T.$L=C),T},D.clone=function(){return R.w(this.$d,this)},D.toDate=function(){return new Date(this.valueOf())},D.toJSON=function(){return this.isValid()?this.toISOString():null},D.toISOString=function(){return this.$d.toISOString()},D.toString=function(){return this.$d.toUTCString()},k})(),at=st.prototype;return K.prototype=at,[["$ms",o],["$s",n],["$m",s],["$H",a],["$W",c],["$M",f],["$y",d],["$D",p]].forEach((function(k){at[k[1]]=function(D){return this.$g(D,k[0],k[1])}})),K.extend=function(k,D){return k.$i||(k(D,st,K),k.$i=!0),K},K.locale=it,K.isDayjs=_e,K.unix=function(k){return K(1e3*k)},K.en=Q[ee],K.Ls=Q,K.p={},K}))});var Cd=qt((Za,Aa)=>{(function(t,e){typeof Za=="object"&&typeof Aa<"u"?Aa.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_isToday=e()})(Za,(function(){"use strict";return function(t,e,r){e.prototype.isToday=function(){var o="YYYY-MM-DD",n=r();return this.format(o)===n.format(o)}}}))});var Fd=qt((Zoe,Nd)=>{"use strict";Nd.exports=class{static{i(this,"SymbolTreeNode")}constructor(){this.parent=null,this.previousSibling=null,this.nextSibling=null,this.firstChild=null,this.lastChild=null,this.childrenVersion=0,this.childIndexCachedUpTo=null,this.cachedIndex=-1,this.cachedIndexVersion=NaN}get isAttached(){return!!(this.parent||this.previousSibling||this.nextSibling)}get hasChildren(){return!!this.firstChild}childrenChanged(){this.childrenVersion=this.childrenVersion+1&4294967295,this.childIndexCachedUpTo=null}getCachedIndex(e){return this.cachedIndexVersion!==e.childrenVersion?(this.cachedIndexVersion=NaN,-1):this.cachedIndex}setCachedIndex(e,r){this.cachedIndexVersion=e.childrenVersion,this.cachedIndex=r}}});var Ld=qt((ene,Wd)=>{"use strict";Wd.exports=Object.freeze({DISCONNECTED:1,PRECEDING:2,FOLLOWING:4,CONTAINS:8,CONTAINED_BY:16})});var $d=qt((tne,jd)=>{"use strict";var Ud=Symbol(),Yd=Symbol(),_t=Symbol(),Hd=Symbol(),qe=class{static{i(this,"TreeIterator")}constructor(e,r,o,n){this[Ud]=e,this[Yd]=r,this[_t]=o,this[Hd]=n}next(){let e=this[Ud],r=this[Hd],o=this[Yd];if(!this[_t])return{done:!0,value:o};let n=this[_t];return r===1?this[_t]=e._node(n).previousSibling:r===2?this[_t]=e._node(n).nextSibling:r===3?this[_t]=e._node(n).parent:r===4?this[_t]=e.preceding(n,{root:o}):this[_t]=e.following(n,{root:o}),{done:!1,value:n}}};Object.defineProperty(qe.prototype,Symbol.iterator,{value:i(function(){return this},"value"),writable:!1}),qe.PREV=1,qe.NEXT=2,qe.PARENT=3,qe.PRECEDING=4,qe.FOLLOWING=5,Object.freeze(qe),Object.freeze(qe.prototype),jd.exports=qe});var Bd=qt((one,qd)=>{"use strict";var p0=Fd(),Rt=Ld(),Ye=$d();function ac(){return!0}i(ac,"returnTrue");function Jr(t,e){return t[t.length-1-e]}i(Jr,"reverseArrayIndex");var Os=class{static{i(this,"SymbolTree")}constructor(e){this.symbol=Symbol(e||"SymbolTree data")}initialize(e){return this._node(e),e}_node(e){if(!e)return null;let r=e[this.symbol];return r||(e[this.symbol]=new p0)}hasChildren(e){return this._node(e).hasChildren}firstChild(e){return this._node(e).firstChild}lastChild(e){return this._node(e).lastChild}previousSibling(e){return this._node(e).previousSibling}nextSibling(e){return this._node(e).nextSibling}parent(e){return this._node(e).parent}lastInclusiveDescendant(e){let r,o=e;for(;r=this._node(o).lastChild;)o=r;return o}preceding(e,r){let o=r&&r.root;if(e===o)return null;let n=this._node(e).previousSibling;return n?this.lastInclusiveDescendant(n):this._node(e).parent}following(e,r){let o=r&&r.root,s=!(r&&r.skipChildren)&&this._node(e).firstChild;if(s)return s;let a=e;do{if(a===o)return null;let c=this._node(a).nextSibling;if(c)return c;a=this._node(a).parent}while(a);return null}childrenToArray(e,r){let o=r&&r.array||[],n=r&&r.filter||ac,s=r&&r.thisArg||void 0,a=this._node(e),c=a.firstChild,u=0;for(;c;){let f=this._node(c);f.setCachedIndex(a,u),n.call(s,c)&&o.push(c),c=f.nextSibling,++u}return o}ancestorsToArray(e,r){let o=r&&r.array||[],n=r&&r.filter||ac,s=r&&r.thisArg||void 0,a=e;for(;a;)n.call(s,a)&&o.push(a),a=this._node(a).parent;return o}treeToArray(e,r){let o=r&&r.array||[],n=r&&r.filter||ac,s=r&&r.thisArg||void 0,a=e;for(;a;)n.call(s,a)&&o.push(a),a=this.following(a,{root:e});return o}childrenIterator(e,r){let o=r&&r.reverse,n=this._node(e);return new Ye(this,e,o?n.lastChild:n.firstChild,o?Ye.PREV:Ye.NEXT)}previousSiblingsIterator(e){return new Ye(this,e,this._node(e).previousSibling,Ye.PREV)}nextSiblingsIterator(e){return new Ye(this,e,this._node(e).nextSibling,Ye.NEXT)}ancestorsIterator(e){return new Ye(this,e,e,Ye.PARENT)}treeIterator(e,r){let o=r&&r.reverse;return new Ye(this,e,o?this.lastInclusiveDescendant(e):e,o?Ye.PRECEDING:Ye.FOLLOWING)}index(e){let r=this._node(e),o=this._node(r.parent);if(!o)return-1;let n=r.getCachedIndex(o);if(n>=0)return n;n=0;let s=o.firstChild;if(o.childIndexCachedUpTo){let a=this._node(o.childIndexCachedUpTo);s=a.nextSibling,n=a.getCachedIndex(o)+1}for(;s;){let a=this._node(s);if(a.setCachedIndex(o,n),s===e)break;++n,s=a.nextSibling}return o.childIndexCachedUpTo=e,n}childrenCount(e){let r=this._node(e);return r.lastChild?this.index(r.lastChild)+1:0}compareTreePosition(e,r){if(e===r)return 0;let o=[];{let l=e;for(;l;){if(l===r)return Rt.CONTAINS|Rt.PRECEDING;o.push(l),l=this.parent(l)}}let n=[];{let l=r;for(;l;){if(l===e)return Rt.CONTAINED_BY|Rt.FOLLOWING;n.push(l),l=this.parent(l)}}let s=Jr(o,0);if(!s||s!==Jr(n,0))return Rt.DISCONNECTED;let a=0,c=Math.min(o.length,n.length);for(let l=0;l<c;++l){let d=Jr(o,l),p=Jr(n,l);if(d!==p)break;a=l}let u=this.index(Jr(o,a+1));return this.index(Jr(n,a+1))<u?Rt.PRECEDING:Rt.FOLLOWING}remove(e){let r=this._node(e),o=this._node(r.parent),n=this._node(r.previousSibling),s=this._node(r.nextSibling);return o&&(o.firstChild===e&&(o.firstChild=r.nextSibling),o.lastChild===e&&(o.lastChild=r.previousSibling)),n&&(n.nextSibling=r.nextSibling),s&&(s.previousSibling=r.previousSibling),r.parent=null,r.previousSibling=null,r.nextSibling=null,r.cachedIndex=-1,r.cachedIndexVersion=NaN,o&&o.childrenChanged(),e}insertBefore(e,r){let o=this._node(e),n=this._node(o.previousSibling),s=this._node(r),a=this._node(o.parent);if(s.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return s.parent=o.parent,s.previousSibling=o.previousSibling,s.nextSibling=e,o.previousSibling=r,n&&(n.nextSibling=r),a&&a.firstChild===e&&(a.firstChild=r),a&&a.childrenChanged(),r}insertAfter(e,r){let o=this._node(e),n=this._node(o.nextSibling),s=this._node(r),a=this._node(o.parent);if(s.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return s.parent=o.parent,s.previousSibling=e,s.nextSibling=o.nextSibling,o.nextSibling=r,n&&(n.previousSibling=r),a&&a.lastChild===e&&(a.lastChild=r),a&&a.childrenChanged(),r}prependChild(e,r){let o=this._node(e),n=this._node(r);if(n.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return o.hasChildren?this.insertBefore(o.firstChild,r):(n.parent=e,o.firstChild=r,o.lastChild=r,o.childrenChanged()),r}appendChild(e,r){let o=this._node(e),n=this._node(r);if(n.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return o.hasChildren?this.insertAfter(o.lastChild,r):(n.parent=e,o.firstChild=r,o.lastChild=r,o.childrenChanged()),r}};qd.exports=Os,Os.TreePosition=Rt});var Im=qt((Tae,km)=>{"use strict";km.exports=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,o=e.cmp&&(function(s){return function(a){return function(c,u){var f={key:c,value:a[c]},l={key:u,value:a[u]};return s(f,l)}}})(e.cmp),n=[];return i((function s(a){if(a&&a.toJSON&&typeof a.toJSON=="function"&&(a=a.toJSON()),a!==void 0){if(typeof a=="number")return isFinite(a)?""+a:"null";if(typeof a!="object")return JSON.stringify(a);var c,u;if(Array.isArray(a)){for(u="[",c=0;c<a.length;c++)c&&(u+=","),u+=s(a[c])||"null";return u+"]"}if(a===null)return"null";if(n.indexOf(a)!==-1){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var f=n.push(a)-1,l=Object.keys(a).sort(o&&o(a));for(u="",c=0;c<l.length;c++){var d=l[c],p=s(a[d]);p&&(u&&(u+=","),u+=JSON.stringify(d)+":"+p)}return n.splice(f,1),"{"+u+"}"}}),"stringify")(t)}});var ln={};var Ht={};Y(Ht,{TYPED_REQUEST_REDACTED_PAYLOAD:()=>oo,TypedHandler:()=>Hc,TypedRequest:()=>qc,TypedRequestRetryLimitError:()=>da,TypedRequestTimeoutError:()=>la,TypedResponseError:()=>je,TypedRouter:()=>jc,TypedTarget:()=>$c,VirtualStream:()=>ze,VirtualStreamActivationScope:()=>dt,VirtualStreamClosedError:()=>dr,VirtualStreamLifecycleContractError:()=>ra,VirtualStreamOpenTimeoutError:()=>mr,getTypedRequestResponseInterestKey:()=>ca});var rt={};Y(rt,{AsyncExecutionStack:()=>cc,BackpressuredArray:()=>uc,FastMap:()=>Yo,Interest:()=>Ho,InterestMap:()=>fc,LimitedArray:()=>lc,LoopTracker:()=>dc,ObjectMap:()=>ir,Stringmap:()=>mc,TimedAggregator:()=>jo,TimedAggregtor:()=>jo,Tree:()=>pc,uni:()=>zd});var mo={};Y(mo,{SmartMatch:()=>xa});var lo={};Y(lo,{isMatch:()=>Jp,matcher:()=>Gp});function ha(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}i(ha,"escapeStringRegexp");var ya=new Map,Kc=i((t,e)=>{if(!Array.isArray(t))switch(typeof t){case"string":t=[t];break;case"undefined":t=[];break;default:throw new TypeError(`Expected '${e}' to be a string or an array, but got a type of '${typeof t}'`)}return t.filter(r=>{if(typeof r!="string"){if(typeof r>"u")return!1;throw new TypeError(`Expected '${e}' to be an array of strings, but found a type of '${typeof r}' in the array`)}return!0})},"sanitizeArray"),Vp=i((t,e)=>{e={caseSensitive:!1,...e};let r=t+JSON.stringify(e);if(ya.has(r))return ya.get(r);let o=t[0]==="!";o&&(t=t.slice(1)),t=ha(t).replace(/\\\*/g,"[\\s\\S]*");let n=new RegExp(`^${t}$`,e.caseSensitive?"":"i");return n.negated=o,ya.set(r,n),n},"makeRegexp"),Xc=i((t,e,r,o)=>{if(t=Kc(t,"inputs"),e=Kc(e,"patterns"),e.length===0)return[];e=e.map(a=>Vp(a,r));let{allPatterns:n}=r||{},s=[];for(let a of t){let c,u=[...e].fill(!1);for(let[f,l]of e.entries())if(l.test(a)&&(u[f]=!0,c=!l.negated,!c))break;if(!(c===!1||c===void 0&&e.some(f=>!f.negated)||n&&u.some((f,l)=>!f&&!e[l].negated))&&(s.push(a),o))break}return s},"baseMatcher");function Gp(t,e,r){return Xc(t,e,r,!1)}i(Gp,"matcher");function Jp(t,e,r){return Xc(t,e,r,!0).length>0}i(Jp,"isMatch");var xa=class{static{i(this,"SmartMatch")}constructor(e){this.wildcard=e}match(e){return lo.isMatch(e,this.wildcard)}};var F={};Y(F,{CumulativeDeferred:()=>mn,Deferred:()=>dn,Timeout:()=>po,cumulativeDefer:()=>Xp,defer:()=>ht,delayFor:()=>eu,delayForRandom:()=>rh,fromCallback:()=>nh,getFirstTrueOrFalse:()=>oh,map:()=>eh,rejectedPromise:()=>Ap,resolvedPromise:()=>Zp,timeoutAndContinue:()=>th,timeoutWrap:()=>Ac});var dn=class{static{i(this,"Deferred")}claim(){if(this.claimed)throw new Error("Deferred already claimed");this.claimed=!0}get duration(){return this.stoppedAt?this.stoppedAt-this.startedAt:Date.now()-this.startedAt}constructor(){this.claimed=!1,this.promise=new Promise((e,r)=>{this.resolve=o=>{this.status="fulfilled",this.stoppedAt=Date.now(),e(o)},this.reject=o=>{this.status="rejected",this.stoppedAt=Date.now(),r(o)},this.startedAt=Date.now(),this.status="pending"})}},ht=i(()=>new dn,"defer");var Kp=2147483647,Zc=i(t=>{t.unref?.()},"unrefTimer"),po=class{static{i(this,"Timeout")}constructor(e,r,o=!1){this.unrefed=!1,this.state="running",this.timeLeftAtCancel=0,this.passOn=r,this.deferred=ht(),this.promise=this.deferred.promise,this.deadline=performance.now()+e,this.timer=this.startChunk(e),o&&this.makeUnrefed()}startChunk(e){let r=Math.min(e,Kp),o=setTimeout(()=>{if(this.state!=="running")return;let n=e-r;n>0?this.timer=this.startChunk(n):(this.state="completed",this.deferred.resolve(this.passOn))},r);return this.unrefed&&Zc(o),o}makeUnrefed(){this.unrefed=!0,Zc(this.timer)}cancel(){this.state==="running"&&(this.timeLeftAtCancel=this.getTimeLeft(),this.state="cancelled",clearTimeout(this.timer))}getTimeLeft(){if(this.state==="completed")return 0;if(this.state==="cancelled")return this.timeLeftAtCancel;let e=Math.ceil(this.deadline-performance.now());return e>0?e:0}};var mn=class{static{i(this,"CumulativeDeferred")}constructor(){this.accumulatedPromises=[],this.deferred=ht(),this.promise=this.deferred.promise,setTimeout(async()=>{for(;this.accumulatedPromises.length>0;)await this.accumulatedPromises.shift();this.deferred.resolve()},0)}subDefer(){let e=ht();return this.addPromise(e.promise),e}addPromise(e){this.accumulatedPromises.push(e)}},Xp=i(()=>new mn,"cumulativeDefer");function Zp(t){return Promise.resolve(t)}i(Zp,"resolvedPromise");var Ap=i(t=>Promise.reject(t),"rejectedPromise"),eh=i(async(t,e)=>Promise.all(t.map(e)),"map"),Ac=i(async(t,e,r=!0)=>new Promise((o,n)=>{let s,a=i(()=>{s!==void 0&&(clearTimeout(s),s=void 0)},"releaseTimeout");s=setTimeout(()=>{s=void 0,r?n(new Error("timeout")):o(null)},e),t.then(c=>{a(),o(c)},c=>{a(),n(c)})}),"timeoutWrap"),th=i(async(t,e=6e4)=>Ac(t,e,!1),"timeoutAndContinue"),eu=i(async(t,e,r=!1)=>(await new po(t,void 0,r).promise,e),"delayFor"),rh=i(async(t,e,r,o=!1)=>(await eu(Math.random()*(e-t)+t,void 0,o),r),"delayForRandom"),oh=i(async t=>{let e=ht();for(let r of t)r.then(o=>{o===!0&&e.resolve(!0)});return Promise.all(t).then(()=>{e.resolve(!1)}),e.promise},"getFirstTrueOrFalse"),nh=i(t=>new Promise((e,r)=>{t((o,n)=>{o?r(o):e(n)})}),"fromCallback");var We={};Y(We,{ObservableIntake:()=>ja,Observablemap:()=>Ha,fromStreamWithBackpressure:()=>Fx,rxjs:()=>Dr});var Dr={};Y(Dr,{Observable:()=>j,ReplaySubject:()=>wn,Subject:()=>Je,Subscription:()=>Me,from:()=>Gt,fromEvent:()=>Qt,of:()=>Ua,ops:()=>Nx});var wa=i(function(t,e){return wa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(r[n]=o[n])},wa(t,e)},"extendStatics");function se(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");wa(t,e);function r(){this.constructor=t}i(r,"__"),t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}i(se,"__extends");var ga=i(function(){return ga=Object.assign||i(function(e){for(var r,o=1,n=arguments.length;o<n;o++){r=arguments[o];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},"__assign"),ga.apply(this,arguments)},"__assign");function sh(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]]);return r}i(sh,"__rest");function ah(t,e,r,o){var n=arguments.length,s=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,r):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,o);else for(var c=t.length-1;c>=0;c--)(a=t[c])&&(s=(n<3?a(s):n>3?a(e,r,s):a(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}i(ah,"__decorate");function ch(t,e){return function(r,o){e(r,o,t)}}i(ch,"__param");function uh(t,e,r,o,n,s){function a(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}i(a,"accept");for(var c=o.kind,u=c==="getter"?"get":c==="setter"?"set":"value",f=!e&&t?o.static?t:t.prototype:null,l=e||(f?Object.getOwnPropertyDescriptor(f,o.name):{}),d,p=!1,h=r.length-1;h>=0;h--){var y={};for(var w in o)y[w]=w==="access"?{}:o[w];for(var w in o.access)y.access[w]=o.access[w];y.addInitializer=function(v){if(p)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(v||null))};var g=(0,r[h])(c==="accessor"?{get:l.get,set:l.set}:l[u],y);if(c==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(d=a(g.get))&&(l.get=d),(d=a(g.set))&&(l.set=d),(d=a(g.init))&&n.unshift(d)}else(d=a(g))&&(c==="field"?n.unshift(d):l[u]=d)}f&&Object.defineProperty(f,o.name,l),p=!0}i(uh,"__esDecorate");function fh(t,e,r){for(var o=arguments.length>2,n=0;n<e.length;n++)r=o?e[n].call(t,r):e[n].call(t);return o?r:void 0}i(fh,"__runInitializers");function lh(t){return typeof t=="symbol"?t:"".concat(t)}i(lh,"__propKey");function dh(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}i(dh,"__setFunctionName");function mh(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}i(mh,"__metadata");function Ta(t,e,r,o){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return i(n,"adopt"),new(r||(r=Promise))(function(s,a){function c(l){try{f(o.next(l))}catch(d){a(d)}}i(c,"fulfilled");function u(l){try{f(o.throw(l))}catch(d){a(d)}}i(u,"rejected");function f(l){l.done?s(l.value):n(l.value).then(c,u)}i(f,"step"),f((o=o.apply(t,e||[])).next())})}i(Ta,"__awaiter");function ho(t,e){var r={label:0,sent:i(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},o,n,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(f){return function(l){return u([f,l])}}function u(f){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,f[0]&&(r=0)),r;)try{if(o=1,n&&(s=f[0]&2?n.return:f[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,f[1])).done)return s;switch(n=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,n=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],n=0}finally{o=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}i(ho,"__generator");var ba=Object.create?(function(t,e,r,o){o===void 0&&(o=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:i(function(){return e[r]},"get")}),Object.defineProperty(t,o,n)}):(function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]});function ph(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ba(e,t,r)}i(ph,"__exportStar");function fe(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],o=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:i(function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}i(fe,"__values");function be(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var o=r.call(t),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(c){a={error:c}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return s}i(be,"__read");function hh(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(be(arguments[e]));return t}i(hh,"__spread");function yh(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var o=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],a=0,c=s.length;a<c;a++,n++)o[n]=s[a];return o}i(yh,"__spreadArrays");function Ne(t,e,r){if(r||arguments.length===2)for(var o=0,n=e.length,s;o<n;o++)(s||!(o in e))&&(s||(s=Array.prototype.slice.call(e,0,o)),s[o]=e[o]);return t.concat(s||Array.prototype.slice.call(e))}i(Ne,"__spreadArray");function ct(t){return this instanceof ct?(this.v=t,this):new ct(t)}i(ct,"__await");function Da(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=r.apply(t,e||[]),n,s=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(h){return function(y){return Promise.resolve(y).then(h,d)}}function c(h,y){o[h]&&(n[h]=function(w){return new Promise(function(g,v){s.push([h,w,g,v])>1||u(h,w)})},y&&(n[h]=y(n[h])))}function u(h,y){try{f(o[h](y))}catch(w){p(s[0][3],w)}}function f(h){h.value instanceof ct?Promise.resolve(h.value.v).then(l,d):p(s[0][2],h)}function l(h){u("next",h)}function d(h){u("throw",h)}function p(h,y){h(y),s.shift(),s.length&&u(s[0][0],s[0][1])}}i(Da,"__asyncGenerator");function xh(t){var e,r;return e={},o("next"),o("throw",function(n){throw n}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(n,s){e[n]=t[n]?function(a){return(r=!r)?{value:ct(t[n](a)),done:!1}:s?s(a):a}:s}}i(xh,"__asyncDelegator");function Sa(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof fe=="function"?fe(t):t[Symbol.iterator](),r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r);function o(s){r[s]=t[s]&&function(a){return new Promise(function(c,u){a=t[s](a),n(c,u,a.done,a.value)})}}function n(s,a,c,u){Promise.resolve(u).then(function(f){s({value:f,done:c})},a)}}i(Sa,"__asyncValues");function wh(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}i(wh,"__makeTemplateObject");var gh=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},va=i(function(t){return va=Object.getOwnPropertyNames||function(e){var r=[];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[r.length]=o);return r},va(t)},"ownKeys");function bh(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=va(t),o=0;o<r.length;o++)r[o]!=="default"&&ba(e,t,r[o]);return gh(e,t),e}i(bh,"__importStar");function vh(t){return t&&t.__esModule?t:{default:t}}i(vh,"__importDefault");function Th(t,e,r,o){if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(t):o?o.value:e.get(t)}i(Th,"__classPrivateFieldGet");function Dh(t,e,r,o,n){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}i(Dh,"__classPrivateFieldSet");function Sh(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}i(Sh,"__classPrivateFieldIn");function Mh(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var o,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=e[Symbol.asyncDispose]}if(o===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=e[Symbol.dispose],r&&(n=o)}if(typeof o!="function")throw new TypeError("Object not disposable.");n&&(o=i(function(){try{n.call(this)}catch(s){return Promise.reject(s)}},"dispose")),t.stack.push({value:e,dispose:o,async:r})}else r&&t.stack.push({async:!0});return e}i(Mh,"__addDisposableResource");var Oh=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var o=new Error(r);return o.name="SuppressedError",o.error=t,o.suppressed=e,o};function Eh(t){function e(s){t.error=t.hasError?new Oh(s,t.error,"An error was suppressed during disposal."):s,t.hasError=!0}i(e,"fail");var r,o=0;function n(){for(;r=t.stack.pop();)try{if(!r.async&&o===1)return o=0,t.stack.push(r),Promise.resolve().then(n);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return o|=2,Promise.resolve(s).then(n,function(a){return e(a),n()})}else o|=1}catch(a){e(a)}if(o===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return i(n,"next"),n()}i(Eh,"__disposeResources");function kh(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,o,n,s,a){return o?e?".jsx":".js":n&&(!s||!a)?r:n+s+"."+a.toLowerCase()+"js"}):t}i(kh,"__rewriteRelativeImportExtension");var iT={__extends:se,__assign:ga,__rest:sh,__decorate:ah,__param:ch,__esDecorate:uh,__runInitializers:fh,__propKey:lh,__setFunctionName:dh,__metadata:mh,__awaiter:Ta,__generator:ho,__createBinding:ba,__exportStar:ph,__values:fe,__read:be,__spread:hh,__spreadArrays:yh,__spreadArray:Ne,__await:ct,__asyncGenerator:Da,__asyncDelegator:xh,__asyncValues:Sa,__makeTemplateObject:wh,__importStar:bh,__importDefault:vh,__classPrivateFieldGet:Th,__classPrivateFieldSet:Dh,__classPrivateFieldIn:Sh,__addDisposableResource:Mh,__disposeResources:Eh,__rewriteRelativeImportExtension:kh};function I(t){return typeof t=="function"}i(I,"isFunction");function pn(t){var e=i(function(o){Error.call(o),o.stack=new Error().stack},"_super"),r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}i(pn,"createErrorClass");var yo=pn(function(t){return i(function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
2
+ `+r.map(function(o,n){return n+1+") "+o.toString()}).join(`
3
+ `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl")});function $e(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}i($e,"arrRemove");var Me=(function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return i(t,"Subscription"),t.prototype.unsubscribe=function(){var e,r,o,n,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var c=fe(a),u=c.next();!u.done;u=c.next()){var f=u.value;f.remove(this)}}catch(w){e={error:w}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}else a.remove(this);var l=this.initialTeardown;if(I(l))try{l()}catch(w){s=w instanceof yo?w.errors:[w]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var p=fe(d),h=p.next();!h.done;h=p.next()){var y=h.value;try{tu(y)}catch(w){s=s??[],w instanceof yo?s=Ne(Ne([],be(s)),be(w.errors)):s.push(w)}}}catch(w){o={error:w}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(o)throw o.error}}}if(s)throw new yo(s)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)tu(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&$e(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&$e(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})(),Ma=Me.EMPTY;function hn(t){return t instanceof Me||t&&"closed"in t&&I(t.remove)&&I(t.add)&&I(t.unsubscribe)}i(hn,"isSubscription");function tu(t){I(t)?t():t.unsubscribe()}i(tu,"execFinalizer");var Fe={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var wr={setTimeout:i(function(t,e){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];var n=wr.delegate;return n?.setTimeout?n.setTimeout.apply(n,Ne([t,e],be(r))):setTimeout.apply(void 0,Ne([t,e],be(r)))},"setTimeout"),clearTimeout:i(function(t){var e=wr.delegate;return(e?.clearTimeout||clearTimeout)(t)},"clearTimeout"),delegate:void 0};function yn(t){wr.setTimeout(function(){var e=Fe.onUnhandledError;if(e)e(t);else throw t})}i(yn,"reportUnhandledError");function Ge(){}i(Ge,"noop");var ru=(function(){return Oa("C",void 0,void 0)})();function ou(t){return Oa("E",void 0,t)}i(ou,"errorNotification");function nu(t){return Oa("N",t,void 0)}i(nu,"nextNotification");function Oa(t,e,r){return{kind:t,value:e,error:r}}i(Oa,"createNotification");var Bt=null;function gr(t){if(Fe.useDeprecatedSynchronousErrorHandling){var e=!Bt;if(e&&(Bt={errorThrown:!1,error:null}),t(),e){var r=Bt,o=r.errorThrown,n=r.error;if(Bt=null,o)throw n}}else t()}i(gr,"errorContext");function iu(t){Fe.useDeprecatedSynchronousErrorHandling&&Bt&&(Bt.errorThrown=!0,Bt.error=t)}i(iu,"captureError");var zt=(function(t){se(e,t);function e(r){var o=t.call(this)||this;return o.isStopped=!1,r?(o.destination=r,hn(r)&&r.add(o)):o.destination=_h,o}return i(e,"Subscriber"),e.create=function(r,o,n){return new xo(r,o,n)},e.prototype.next=function(r){this.isStopped?ka(nu(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?ka(ou(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?ka(ru,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Me),Ih=Function.prototype.bind;function Ea(t,e){return Ih.call(t,e)}i(Ea,"bind");var Ph=(function(){function t(e){this.partialObserver=e}return i(t,"ConsumerObserver"),t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(o){xn(o)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(o){xn(o)}else xn(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){xn(r)}},t})(),xo=(function(t){se(e,t);function e(r,o,n){var s=t.call(this)||this,a;if(I(r)||!r)a={next:r??void 0,error:o??void 0,complete:n??void 0};else{var c;s&&Fe.useDeprecatedNextContext?(c=Object.create(r),c.unsubscribe=function(){return s.unsubscribe()},a={next:r.next&&Ea(r.next,c),error:r.error&&Ea(r.error,c),complete:r.complete&&Ea(r.complete,c)}):a=r}return s.destination=new Ph(a),s}return i(e,"SafeSubscriber"),e})(zt);function xn(t){Fe.useDeprecatedSynchronousErrorHandling?iu(t):yn(t)}i(xn,"handleUnhandledError");function Ch(t){throw t}i(Ch,"defaultErrorHandler");function ka(t,e){var r=Fe.onStoppedNotification;r&&wr.setTimeout(function(){return r(t,e)})}i(ka,"handleStoppedNotification");var _h={closed:!0,next:Ge,error:Ch,complete:Ge};var Vt=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function wo(t){return t}i(wo,"identity");function Rh(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Ia(t)}i(Rh,"pipe");function Ia(t){return t.length===0?wo:t.length===1?t[0]:i(function(r){return t.reduce(function(o,n){return n(o)},r)},"piped")}i(Ia,"pipeFromArray");var j=(function(){function t(e){e&&(this._subscribe=e)}return i(t,"Observable"),t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,o){var n=this,s=Fh(e)?e:new xo(e,r,o);return gr(function(){var a=n,c=a.operator,u=a.source;s.add(c?c.call(s,u):u?n._subscribe(s):n._trySubscribe(s))}),s},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var o=this;return r=su(r),new r(function(n,s){var a=new xo({next:i(function(c){try{e(c)}catch(u){s(u),a.unsubscribe()}},"next"),error:s,complete:n});o.subscribe(a)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[Vt]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Ia(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=su(e),new e(function(o,n){var s;r.subscribe(function(a){return s=a},function(a){return n(a)},function(){return o(s)})})},t.create=function(e){return new t(e)},t})();function su(t){var e;return(e=t??Fe.Promise)!==null&&e!==void 0?e:Promise}i(su,"getPromiseCtor");function Nh(t){return t&&I(t.next)&&I(t.error)&&I(t.complete)}i(Nh,"isObserver");function Fh(t){return t&&t instanceof zt||Nh(t)&&hn(t)}i(Fh,"isSubscriber");function Wh(t){return I(t?.lift)}i(Wh,"hasLift");function B(t){return function(e){if(Wh(e))return e.lift(function(r){try{return t(r,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}i(B,"operate");function z(t,e,r,o,n){return new au(t,e,r,o,n)}i(z,"createOperatorSubscriber");var au=(function(t){se(e,t);function e(r,o,n,s,a,c){var u=t.call(this,r)||this;return u.onFinalize=a,u.shouldUnsubscribe=c,u._next=o?function(f){try{o(f)}catch(l){r.error(l)}}:t.prototype._next,u._error=s?function(f){try{s(f)}catch(l){r.error(l)}finally{this.unsubscribe()}}:t.prototype._error,u._complete=n?function(){try{n()}catch(f){r.error(f)}finally{this.unsubscribe()}}:t.prototype._complete,u}return i(e,"OperatorSubscriber"),e.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;t.prototype.unsubscribe.call(this),!o&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},e})(zt);var Pa=pn(function(t){return i(function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl")});var Je=(function(t){se(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return i(e,"Subject"),e.prototype.lift=function(r){var o=new Ca(this,this);return o.operator=r,o},e.prototype._throwIfClosed=function(){if(this.closed)throw new Pa},e.prototype.next=function(r){var o=this;gr(function(){var n,s;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var a=fe(o.currentObservers),c=a.next();!c.done;c=a.next()){var u=c.value;u.next(r)}}catch(f){n={error:f}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}}})},e.prototype.error=function(r){var o=this;gr(function(){if(o._throwIfClosed(),!o.isStopped){o.hasError=o.isStopped=!0,o.thrownError=r;for(var n=o.observers;n.length;)n.shift().error(r)}})},e.prototype.complete=function(){var r=this;gr(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var o=r.observers;o.length;)o.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:i(function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},"get"),enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var o=this,n=this,s=n.hasError,a=n.isStopped,c=n.observers;return s||a?Ma:(this.currentObservers=null,c.push(r),new Me(function(){o.currentObservers=null,$e(c,r)}))},e.prototype._checkFinalizedStatuses=function(r){var o=this,n=o.hasError,s=o.thrownError,a=o.isStopped;n?r.error(s):a&&r.complete()},e.prototype.asObservable=function(){var r=new j;return r.source=this,r},e.create=function(r,o){return new Ca(r,o)},e})(j),Ca=(function(t){se(e,t);function e(r,o){var n=t.call(this)||this;return n.destination=r,n.source=o,n}return i(e,"AnonymousSubject"),e.prototype.next=function(r){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.next)===null||n===void 0||n.call(o,r)},e.prototype.error=function(r){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.error)===null||n===void 0||n.call(o,r)},e.prototype.complete=function(){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||o===void 0||o.call(r)},e.prototype._subscribe=function(r){var o,n;return(n=(o=this.source)===null||o===void 0?void 0:o.subscribe(r))!==null&&n!==void 0?n:Ma},e})(Je);var go={now:i(function(){return(go.delegate||Date).now()},"now"),delegate:void 0};var wn=(function(t){se(e,t);function e(r,o,n){r===void 0&&(r=1/0),o===void 0&&(o=1/0),n===void 0&&(n=go);var s=t.call(this)||this;return s._bufferSize=r,s._windowTime=o,s._timestampProvider=n,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=o===1/0,s._bufferSize=Math.max(1,r),s._windowTime=Math.max(1,o),s}return i(e,"ReplaySubject"),e.prototype.next=function(r){var o=this,n=o.isStopped,s=o._buffer,a=o._infiniteTimeWindow,c=o._timestampProvider,u=o._windowTime;n||(s.push(r),!a&&s.push(c.now()+u)),this._trimBuffer(),t.prototype.next.call(this,r)},e.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var o=this._innerSubscribe(r),n=this,s=n._infiniteTimeWindow,a=n._buffer,c=a.slice(),u=0;u<c.length&&!r.closed;u+=s?1:2)r.next(c[u]);return this._checkFinalizedStatuses(r),o},e.prototype._trimBuffer=function(){var r=this,o=r._bufferSize,n=r._timestampProvider,s=r._buffer,a=r._infiniteTimeWindow,c=(a?1:2)*o;if(o<1/0&&c<s.length&&s.splice(0,s.length-c),!a){for(var u=n.now(),f=0,l=1;l<s.length&&s[l]<=u;l+=2)f=l;f&&s.splice(0,f+1)}},e})(Je);var _a=(function(t){se(e,t);function e(r,o){return t.call(this)||this}return i(e,"Action"),e.prototype.schedule=function(r,o){return o===void 0&&(o=0),this},e})(Me);var bo={setInterval:i(function(t,e){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];var n=bo.delegate;return n?.setInterval?n.setInterval.apply(n,Ne([t,e],be(r))):setInterval.apply(void 0,Ne([t,e],be(r)))},"setInterval"),clearInterval:i(function(t){var e=bo.delegate;return(e?.clearInterval||clearInterval)(t)},"clearInterval"),delegate:void 0};var Ra=(function(t){se(e,t);function e(r,o){var n=t.call(this,r,o)||this;return n.scheduler=r,n.work=o,n.pending=!1,n}return i(e,"AsyncAction"),e.prototype.schedule=function(r,o){var n;if(o===void 0&&(o=0),this.closed)return this;this.state=r;var s=this.id,a=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(a,s,o)),this.pending=!0,this.delay=o,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(a,this.id,o),this},e.prototype.requestAsyncId=function(r,o,n){return n===void 0&&(n=0),bo.setInterval(r.flush.bind(r,this),n)},e.prototype.recycleAsyncId=function(r,o,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return o;o!=null&&bo.clearInterval(o)},e.prototype.execute=function(r,o){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(r,o);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(r,o){var n=!1,s;try{this.work(r)}catch(a){n=!0,s=a||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var r=this,o=r.id,n=r.scheduler,s=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,$e(s,this),o!=null&&(this.id=this.recycleAsyncId(n,o,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e})(_a);var vo=(function(){function t(e,r){r===void 0&&(r=t.now),this.schedulerActionCtor=e,this.now=r}return i(t,"Scheduler"),t.prototype.schedule=function(e,r,o){return r===void 0&&(r=0),new this.schedulerActionCtor(this,e).schedule(o,r)},t.now=go.now,t})();var Na=(function(t){se(e,t);function e(r,o){o===void 0&&(o=vo.now);var n=t.call(this,r,o)||this;return n.actions=[],n._active=!1,n}return i(e,"AsyncScheduler"),e.prototype.flush=function(r){var o=this.actions;if(this._active){o.push(r);return}var n;this._active=!0;do if(n=r.execute(r.state,r.delay))break;while(r=o.shift());if(this._active=!1,n){for(;r=o.shift();)r.unsubscribe();throw n}},e})(vo);var yt=new Na(Ra),Fa=yt;function gn(t){return t&&I(t.schedule)}i(gn,"isScheduler");function Wa(t){return t[t.length-1]}i(Wa,"last");function uS(t){return I(Wa(t))?t.pop():void 0}i(uS,"popResultSelector");function xt(t){return gn(Wa(t))?t.pop():void 0}i(xt,"popScheduler");function fS(t,e){return typeof Wa(t)=="number"?t.pop():e}i(fS,"popNumber");var br=i((function(t){return t&&typeof t.length=="number"&&typeof t!="function"}),"isArrayLike");function bn(t){return I(t?.then)}i(bn,"isPromise");function vn(t){return I(t[Vt])}i(vn,"isInteropObservable");function Tn(t){return Symbol.asyncIterator&&I(t?.[Symbol.asyncIterator])}i(Tn,"isAsyncIterable");function Dn(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}i(Dn,"createInvalidObservableTypeError");function Lh(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(Lh,"getSymbolIterator");var Sn=Lh();function Mn(t){return I(t?.[Sn])}i(Mn,"isIterable");function On(t){return Da(this,arguments,i(function(){var r,o,n,s;return ho(this,function(a){switch(a.label){case 0:r=t.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,ct(r.read())];case 3:return o=a.sent(),n=o.value,s=o.done,s?[4,ct(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,ct(n)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})},"readableStreamLikeToAsyncGenerator_1"))}i(On,"readableStreamLikeToAsyncGenerator");function En(t){return I(t?.getReader)}i(En,"isReadableStreamLike");function Z(t){if(t instanceof j)return t;if(t!=null){if(vn(t))return Uh(t);if(br(t))return Yh(t);if(bn(t))return Hh(t);if(Tn(t))return cu(t);if(Mn(t))return jh(t);if(En(t))return $h(t)}throw Dn(t)}i(Z,"innerFrom");function Uh(t){return new j(function(e){var r=t[Vt]();if(I(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i(Uh,"fromInteropObservable");function Yh(t){return new j(function(e){for(var r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}i(Yh,"fromArrayLike");function Hh(t){return new j(function(e){t.then(function(r){e.closed||(e.next(r),e.complete())},function(r){return e.error(r)}).then(null,yn)})}i(Hh,"fromPromise");function jh(t){return new j(function(e){var r,o;try{for(var n=fe(t),s=n.next();!s.done;s=n.next()){var a=s.value;if(e.next(a),e.closed)return}}catch(c){r={error:c}}finally{try{s&&!s.done&&(o=n.return)&&o.call(n)}finally{if(r)throw r.error}}e.complete()})}i(jh,"fromIterable");function cu(t){return new j(function(e){qh(t,e).catch(function(r){return e.error(r)})})}i(cu,"fromAsyncIterable");function $h(t){return cu(On(t))}i($h,"fromReadableStreamLike");function qh(t,e){var r,o,n,s;return Ta(this,void 0,void 0,function(){var a,c;return ho(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=Sa(t),u.label=1;case 1:return[4,r.next()];case 2:if(o=u.sent(),!!o.done)return[3,4];if(a=o.value,e.next(a),e.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=u.sent(),n={error:c},[3,11];case 6:return u.trys.push([6,,9,10]),o&&!o.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}i(qh,"process");function ve(t,e,r,o,n){o===void 0&&(o=0),n===void 0&&(n=!1);var s=e.schedule(function(){r(),n?t.add(this.schedule(null,o)):this.unsubscribe()},o);if(t.add(s),!n)return s}i(ve,"executeSchedule");function vr(t,e){return e===void 0&&(e=0),B(function(r,o){r.subscribe(z(o,function(n){return ve(o,t,function(){return o.next(n)},e)},function(){return ve(o,t,function(){return o.complete()},e)},function(n){return ve(o,t,function(){return o.error(n)},e)}))})}i(vr,"observeOn");function Tr(t,e){return e===void 0&&(e=0),B(function(r,o){o.add(t.schedule(function(){return r.subscribe(o)},e))})}i(Tr,"subscribeOn");function uu(t,e){return Z(t).pipe(Tr(e),vr(e))}i(uu,"scheduleObservable");function fu(t,e){return Z(t).pipe(Tr(e),vr(e))}i(fu,"schedulePromise");function lu(t,e){return new j(function(r){var o=0;return e.schedule(function(){o===t.length?r.complete():(r.next(t[o++]),r.closed||this.schedule())})})}i(lu,"scheduleArray");function du(t,e){return new j(function(r){var o;return ve(r,e,function(){o=t[Sn](),ve(r,e,function(){var n,s,a;try{n=o.next(),s=n.value,a=n.done}catch(c){r.error(c);return}a?r.complete():r.next(s)},0,!0)}),function(){return I(o?.return)&&o.return()}})}i(du,"scheduleIterable");function kn(t,e){if(!t)throw new Error("Iterable cannot be null");return new j(function(r){ve(r,e,function(){var o=t[Symbol.asyncIterator]();ve(r,e,function(){o.next().then(function(n){n.done?r.complete():r.next(n.value)})},0,!0)})})}i(kn,"scheduleAsyncIterable");function mu(t,e){return kn(On(t),e)}i(mu,"scheduleReadableStreamLike");function La(t,e){if(t!=null){if(vn(t))return uu(t,e);if(br(t))return lu(t,e);if(bn(t))return fu(t,e);if(Tn(t))return kn(t,e);if(Mn(t))return du(t,e);if(En(t))return mu(t,e)}throw Dn(t)}i(La,"scheduled");function Gt(t,e){return e?La(t,e):Z(t)}i(Gt,"from");function Ua(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=xt(t);return Gt(t,r)}i(Ua,"of");function pu(t){return t instanceof Date&&!isNaN(t)}i(pu,"isValidDate");function wt(t,e){return B(function(r,o){var n=0;r.subscribe(z(o,function(s){o.next(t.call(e,s,n++))}))})}i(wt,"map");var Bh=Array.isArray;function zh(t,e){return Bh(e)?t.apply(void 0,Ne([],be(e))):t(e)}i(zh,"callOrApply");function hu(t){return wt(function(e){return zh(t,e)})}i(hu,"mapOneOrManyArgs");function yu(t,e,r,o,n,s,a,c){var u=[],f=0,l=0,d=!1,p=i(function(){d&&!u.length&&!f&&e.complete()},"checkComplete"),h=i(function(w){return f<o?y(w):u.push(w)},"outerNext"),y=i(function(w){s&&e.next(w),f++;var g=!1;Z(r(w,l++)).subscribe(z(e,function(v){n?.(v),s?h(v):e.next(v)},function(){g=!0},void 0,function(){if(g)try{f--;for(var v=i(function(){var G=u.shift();a?ve(e,a,function(){return y(G)}):y(G)},"_loop_1");u.length&&f<o;)v();p()}catch(G){e.error(G)}}))},"doInnerSub");return t.subscribe(z(e,h,function(){d=!0,p()})),function(){c?.()}}i(yu,"mergeInternals");function Jt(t,e,r){return r===void 0&&(r=1/0),I(e)?Jt(function(o,n){return wt(function(s,a){return e(o,s,n,a)})(Z(t(o,n)))},r):(typeof e=="number"&&(r=e),B(function(o,n){return yu(o,n,t,r)}))}i(Jt,"mergeMap");function In(t){return t===void 0&&(t=1/0),Jt(wo,t)}i(In,"mergeAll");function Pn(){return In(1)}i(Pn,"concatAll");function Cn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Pn()(Gt(t,xt(t)))}i(Cn,"concat");var Vh=["addListener","removeListener"],Gh=["addEventListener","removeEventListener"],Jh=["on","off"];function Qt(t,e,r,o){if(I(r)&&(o=r,r=void 0),o)return Qt(t,e,r).pipe(hu(o));var n=be(Xh(t)?Gh.map(function(c){return function(u){return t[c](e,u,r)}}):Qh(t)?Vh.map(xu(t,e)):Kh(t)?Jh.map(xu(t,e)):[],2),s=n[0],a=n[1];if(!s&&br(t))return Jt(function(c){return Qt(c,e,r)})(Z(t));if(!s)throw new TypeError("Invalid event target");return new j(function(c){var u=i(function(){for(var f=[],l=0;l<arguments.length;l++)f[l]=arguments[l];return c.next(1<f.length?f:f[0])},"handler");return s(u),function(){return a(u)}})}i(Qt,"fromEvent");function xu(t,e){return function(r){return function(o){return t[r](e,o)}}}i(xu,"toCommonHandlerRegistry");function Qh(t){return I(t.addListener)&&I(t.removeListener)}i(Qh,"isNodeStyleEventEmitter");function Kh(t){return I(t.on)&&I(t.off)}i(Kh,"isJQueryStyleEventEmitter");function Xh(t){return I(t.addEventListener)&&I(t.removeEventListener)}i(Xh,"isEventTarget");function Ya(t,e,r){t===void 0&&(t=0),r===void 0&&(r=Fa);var o=-1;return e!=null&&(gn(e)?r=e:o=e),new j(function(n){var s=pu(t)?+t-r.now():t;s<0&&(s=0);var a=0;return r.schedule(function(){n.closed||(n.next(a++),0<=o?this.schedule(void 0,o):n.complete())},s)})}i(Ya,"timer");function _n(t,e){return B(function(r,o){var n=0;r.subscribe(z(o,function(s){return t.call(e,s,n++)&&o.next(s)}))})}i(_n,"filter");function Rn(t){return B(function(e,r){var o=[];return e.subscribe(z(r,function(n){return o.push(n)},function(){r.next(o),r.complete()})),Z(t).subscribe(z(r,function(){var n=o;o=[],r.next(n)},Ge)),function(){o=null}})}i(Rn,"buffer");function Nn(t,e){return e===void 0&&(e=null),e=e??t,B(function(r,o){var n=[],s=0;r.subscribe(z(o,function(a){var c,u,f,l,d=null;s++%e===0&&n.push([]);try{for(var p=fe(n),h=p.next();!h.done;h=p.next()){var y=h.value;y.push(a),t<=y.length&&(d=d??[],d.push(y))}}catch(v){c={error:v}}finally{try{h&&!h.done&&(u=p.return)&&u.call(p)}finally{if(c)throw c.error}}if(d)try{for(var w=fe(d),g=w.next();!g.done;g=w.next()){var y=g.value;$e(n,y),o.next(y)}}catch(v){f={error:v}}finally{try{g&&!g.done&&(l=w.return)&&l.call(w)}finally{if(f)throw f.error}}},function(){var a,c;try{for(var u=fe(n),f=u.next();!f.done;f=u.next()){var l=f.value;o.next(l)}}catch(d){a={error:d}}finally{try{f&&!f.done&&(c=u.return)&&c.call(u)}finally{if(a)throw a.error}}o.complete()},void 0,function(){n=null}))})}i(Nn,"bufferCount");function Fn(t){for(var e,r,o=[],n=1;n<arguments.length;n++)o[n-1]=arguments[n];var s=(e=xt(o))!==null&&e!==void 0?e:yt,a=(r=o[0])!==null&&r!==void 0?r:null,c=o[1]||1/0;return B(function(u,f){var l=[],d=!1,p=i(function(w){var g=w.buffer,v=w.subs;v.unsubscribe(),$e(l,w),f.next(g),d&&h()},"emit"),h=i(function(){if(l){var w=new Me;f.add(w);var g=[],v={buffer:g,subs:w};l.push(v),ve(w,s,function(){return p(v)},t)}},"startBuffer");a!==null&&a>=0?ve(f,s,h,a,!0):d=!0,h();var y=z(f,function(w){var g,v,G=l.slice();try{for(var ee=fe(G),Q=ee.next();!Q.done;Q=ee.next()){var Ce=Q.value,_e=Ce.buffer;_e.push(w),c<=_e.length&&p(Ce)}}catch(it){g={error:it}}finally{try{Q&&!Q.done&&(v=ee.return)&&v.call(ee)}finally{if(g)throw g.error}}},function(){for(;l?.length;)f.next(l.shift().buffer);y?.unsubscribe(),f.complete(),f.unsubscribe()},void 0,function(){return l=null});u.subscribe(y)})}i(Fn,"bufferTime");function Wn(t){return B(function(e,r){var o=!1,n=null,s=null,a=i(function(){if(s?.unsubscribe(),s=null,o){o=!1;var c=n;n=null,r.next(c)}},"emit");e.subscribe(z(r,function(c){s?.unsubscribe(),o=!0,n=c,s=z(r,a,Ge),Z(t(c)).subscribe(s)},function(){a(),r.complete()},void 0,function(){n=s=null}))})}i(Wn,"debounce");function Ln(t,e){return e===void 0&&(e=yt),B(function(r,o){var n=null,s=null,a=null,c=i(function(){if(n){n.unsubscribe(),n=null;var f=s;s=null,o.next(f)}},"emit");function u(){var f=a+t,l=e.now();if(l<f){n=this.schedule(void 0,f-l),o.add(n);return}c()}i(u,"emitWhenIdle"),r.subscribe(z(o,function(f){s=f,a=e.now(),n||(n=e.schedule(u,t),o.add(n))},function(){c(),o.complete()},void 0,function(){s=n=null}))})}i(Ln,"debounceTime");function Un(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=xt(t);return B(function(o,n){(r?Cn(t,o,r):Cn(t,o)).subscribe(n)})}i(Un,"startWith");function Yn(t){return B(function(e,r){Z(t).subscribe(z(r,function(){return r.complete()},Ge)),!r.closed&&e.subscribe(r)})}i(Yn,"takeUntil");function Hn(t,e){return B(function(r,o){var n=e??{},s=n.leading,a=s===void 0?!0:s,c=n.trailing,u=c===void 0?!1:c,f=!1,l=null,d=null,p=!1,h=i(function(){d?.unsubscribe(),d=null,u&&(g(),p&&o.complete())},"endThrottling"),y=i(function(){d=null,p&&o.complete()},"cleanupThrottling"),w=i(function(v){return d=Z(t(v)).subscribe(z(o,h,y))},"startThrottle"),g=i(function(){if(f){f=!1;var v=l;l=null,o.next(v),!p&&w(v)}},"send");r.subscribe(z(o,function(v){f=!0,l=v,!(d&&!d.closed)&&(a?g():w(v))},function(){p=!0,!(u&&f&&d&&!d.closed)&&o.complete()}))})}i(Hn,"throttle");function jn(t,e,r){e===void 0&&(e=yt);var o=Ya(t,e);return Hn(function(){return o},r)}i(jn,"throttleTime");var Nx={buffer:Rn,bufferCount:Nn,bufferTime:Fn,debounce:Wn,debounceTime:Ln,filter:_n,map:wt,startWith:Un,takeUntil:Yn,throttleTime:jn};var Ha=class{static{i(this,"Observablemap")}constructor(){this.observableEventEmitterBundleArray=new Array,this.observableEventTargetBundleArray=new Array}getSubjectForEmitterEvent(e,r){let o=this.observableEventEmitterBundleArray.find(n=>n.eventRef===e&&n.event===r);if(o)return o.subject;{let n=Qt(e,r),s=new Je;n.subscribe(s);let a={subject:s,eventRef:e,event:r};return this.observableEventEmitterBundleArray.push(a),a.subject}}getSubjectForEventTarget(e,r){let o=this.observableEventTargetBundleArray.find(n=>n.eventRef===e&&n.event===r);if(o)return o.subject;{let s={subject:new Je,eventRef:e,event:r};return this.observableEventTargetBundleArray.push(s),s.subject}}};var ja=class{static{i(this,"ObservableIntake")}constructor(){this.observableFunctions={next:i(e=>{},"next"),complete:i(e=>{},"complete")},this.buffered=!1,this.payloadBuffer=[],this.observable=new j(e=>{this.observableFunctions.next=r=>e.next(r),this.observableFunctions.complete=()=>(this.completedDeffered.resolve(),e.complete())}),this.completedDeffered=F.defer(),this.completed=this.completedDeffered.promise}setObservable(e){this.observable=e}push(e){this.buffered?this.payloadBuffer.push(e):this.internalPush(e)}pushMany(e){for(let r of e)this.push(r)}setGenerator(e){this.generator=e}makeBuffered(){this.buffered=!0}subscribe(...e){return this.observable.subscribe(...e)}request(e){if(e!==0)for(let r=0;r!==e;r++)if(this.payloadBuffer.length>0)this.internalPush(this.payloadBuffer.shift());else{if(!this.generator)throw new Error("Cannot request an unbuffered value before setting a generator");let o=this.generator.next();this.internalPush(o.value)}}signalComplete(){this.observableFunctions.complete()}internalPush(e){this.observableFunctions.next(e)}};function Fx(t){return new j(e=>{let r=i(()=>t.pause(),"pauseStream"),o=i(()=>process.nextTick(()=>t.resume()),"resumeStream"),n=i(s=>{r(),e.next(s),o()},"onData");return t.on("data",n),t.on("error",s=>e.error(s)),t.on("end",()=>e.complete()),t.on("close",()=>e.complete()),()=>{t.removeListener("data",n),t.removeListener("error",e.error),t.removeListener("end",e.complete),t.removeListener("close",e.complete)}})}i(Fx,"fromStreamWithBackpressure");var nr={};Y(nr,{CronJob:()=>Lo,CronJobCollection:()=>Uo,CronManager:()=>tc,ExtendedDate:()=>oc,HrtMeasurement:()=>nc,Interval:()=>ic,TimeStamp:()=>Gr,Timer:()=>sc,getMilliSecondsAsHumanReadableAgoTime:()=>d0,getMilliSecondsAsHumanReadableString:()=>l0,getMilliSecondsFromUnits:()=>rc,units:()=>Ct});var Mo={};Y(Mo,{Cron:()=>Du,CronDate:()=>te,CronPattern:()=>$n,scheduledJobs:()=>Sr});function To(t){return Date.UTC(t.y,t.m-1,t.d,t.h,t.i,t.s)}i(To,"T");function $a(t,e){return t.y===e.y&&t.m===e.m&&t.d===e.d&&t.h===e.h&&t.i===e.i&&t.s===e.s}i($a,"D");function Wx(t,e){let r=new Date(Date.parse(t));if(isNaN(r))throw new Error("Invalid ISO8601 passed to timezone parser.");let o=t.substring(9);return o.includes("Z")||o.includes("+")||o.includes("-")?qa(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),"Etc/UTC"):qa(r.getFullYear(),r.getMonth()+1,r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),e)}i(Wx,"A");function wu(t,e,r){return gu(Wx(t,e),r)}i(wu,"v");function gu(t,e){let r=new Date(To(t)),o=Do(r,t.tz),n=To(t),s=To(o),a=n-s,c=new Date(r.getTime()+a),u=Do(c,t.tz);if($a(u,t)){let d=new Date(c.getTime()-36e5),p=Do(d,t.tz);return $a(p,t)?d:c}let f=new Date(c.getTime()+To(t)-To(u)),l=Do(f,t.tz);if($a(l,t))return f;if(e)throw new Error("Invalid date passed to fromTZ()");return c.getTime()>f.getTime()?c:f}i(gu,"k");function Do(t,e){let r,o;try{r=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}),o=r.formatToParts(t)}catch(s){let a=s instanceof Error?s.message:String(s);throw new RangeError(`toTZ: Invalid timezone '${e}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${a}`)}let n={year:0,month:0,day:0,hour:0,minute:0,second:0};for(let s of o)(s.type==="year"||s.type==="month"||s.type==="day"||s.type==="hour"||s.type==="minute"||s.type==="second")&&(n[s.type]=parseInt(s.value,10));if(isNaN(n.year)||isNaN(n.month)||isNaN(n.day)||isNaN(n.hour)||isNaN(n.minute)||isNaN(n.second))throw new Error(`toTZ: Failed to parse all date components from timezone '${e}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(n)}`);return n.hour===24&&(n.hour=0),{y:n.year,m:n.month,d:n.day,h:n.hour,i:n.minute,s:n.second,tz:e}}i(Do,"g");function qa(t,e,r,o,n,s,a){return{y:t,m:e,d:r,h:o,i:n,s,tz:a}}i(qa,"b");var bu=[1,2,4,8,16],$n=class{static{i(this,"C")}pattern;timezone;mode;alternativeWeekdays;sloppyRanges;second;minute;hour;day;month;dayOfWeek;year;lastDayOfMonth;lastWeekday;nearestWeekdays;starDOM;starDOW;starYear;useAndLogic;constructor(t,e,r){this.pattern=t,this.timezone=e,this.mode=r?.mode??"auto",this.alternativeWeekdays=r?.alternativeWeekdays??!1,this.sloppyRanges=r?.sloppyRanges??!1,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.year=Array(1e4).fill(0),this.lastDayOfMonth=!1,this.lastWeekday=!1,this.nearestWeekdays=Array(31).fill(0),this.starDOM=!1,this.starDOW=!1,this.starYear=!1,this.useAndLogic=!1,this.parse()}parse(){if(!(typeof this.pattern=="string"||this.pattern instanceof String))throw new TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let t=this.pattern.match(/\S+/g)||[""],e=t.length;if(t.length<5||t.length>7)throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five, six, or seven space separated parts are required.");if(this.mode!=="auto"){let o;switch(this.mode){case"5-part":o=5;break;case"6-part":o=6;break;case"7-part":o=7;break;case"5-or-6-parts":o=[5,6];break;case"6-or-7-parts":o=[6,7];break;default:o=0}if(!(Array.isArray(o)?o.includes(e):e===o)){let n=Array.isArray(o)?o.join(" or "):o.toString();throw new TypeError(`CronPattern: mode '${this.mode}' requires exactly ${n} parts, but pattern '${this.pattern}' has ${e} parts.`)}}if(t.length===5&&t.unshift("0"),t.length===6&&t.push("*"),t[3].toUpperCase()==="LW"?(this.lastWeekday=!0,t[3]=""):t[3].toUpperCase().indexOf("L")>=0&&(t[3]=t[3].replace(/L/gi,""),this.lastDayOfMonth=!0),t[3]=="*"&&(this.starDOM=!0),t[6]=="*"&&(this.starYear=!0),t[4].length>=3&&(t[4]=this.replaceAlphaMonths(t[4])),t[5].length>=3&&(t[5]=this.alternativeWeekdays?this.replaceAlphaDaysQuartz(t[5]):this.replaceAlphaDays(t[5])),t[5].startsWith("+")&&(this.useAndLogic=!0,t[5]=t[5].substring(1),t[5]===""))throw new TypeError("CronPattern: Day-of-week field cannot be empty after '+' modifier.");switch(t[5]=="*"&&(this.starDOW=!0),this.pattern.indexOf("?")>=0&&(t[0]=t[0].replace(/\?/g,"*"),t[1]=t[1].replace(/\?/g,"*"),t[2]=t[2].replace(/\?/g,"*"),t[3]=t[3].replace(/\?/g,"*"),t[4]=t[4].replace(/\?/g,"*"),t[5]=t[5].replace(/\?/g,"*"),t[6]&&(t[6]=t[6].replace(/\?/g,"*"))),this.mode){case"5-part":t[0]="0",t[6]="*";break;case"6-part":t[6]="*";break;case"5-or-6-parts":t[6]="*";break;case"6-or-7-parts":break;case"7-part":case"auto":break}this.throwAtIllegalCharacters(t),this.partToArray("second",t[0],0,1),this.partToArray("minute",t[1],0,1),this.partToArray("hour",t[2],0,1),this.partToArray("day",t[3],-1,1),this.partToArray("month",t[4],-1,1);let r=this.alternativeWeekdays?-1:0;this.partToArray("dayOfWeek",t[5],r,63),this.partToArray("year",t[6],0,1),!this.alternativeWeekdays&&this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(t,e,r,o){let n=this[t],s=t==="day"&&this.lastDayOfMonth,a=t==="day"&&this.lastWeekday;if(e===""&&!s&&!a)throw new TypeError("CronPattern: configuration entry "+t+" ("+e+") is empty, check for trailing spaces.");if(e==="*")return n.fill(o);let c=e.split(",");if(c.length>1)for(let u=0;u<c.length;u++)this.partToArray(t,c[u],r,o);else e.indexOf("-")!==-1&&e.indexOf("/")!==-1?this.handleRangeWithStepping(e,t,r,o):e.indexOf("-")!==-1?this.handleRange(e,t,r,o):e.indexOf("/")!==-1?this.handleStepping(e,t,r,o):e!==""&&this.handleNumber(e,t,r,o)}throwAtIllegalCharacters(t){for(let e=0;e<t.length;e++)if((e===3?/[^/*0-9,\-WwLl]+/:e===5?/[^/*0-9,\-#Ll]+/:/[^/*0-9,\-]+/).test(t[e]))throw new TypeError("CronPattern: configuration entry "+e+" ("+t[e]+") contains illegal characters.")}handleNumber(t,e,r,o){let n=this.extractNth(t,e),s=t.toUpperCase().includes("W");if(e!=="day"&&s)throw new TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");s&&(e="nearestWeekdays");let a=parseInt(n[0],10)+r;if(isNaN(a))throw new TypeError("CronPattern: "+e+" is not a number: '"+t+"'");this.setPart(e,a,n[1]||o)}setPart(t,e,r){if(!Object.prototype.hasOwnProperty.call(this,t))throw new TypeError("CronPattern: Invalid part specified: "+t);if(t==="dayOfWeek"){if(e===7&&(e=0),e<0||e>6)throw new RangeError("CronPattern: Invalid value for dayOfWeek: "+e);this.setNthWeekdayOfMonth(e,r);return}if(t==="second"||t==="minute"){if(e<0||e>=60)throw new RangeError("CronPattern: Invalid value for "+t+": "+e)}else if(t==="hour"){if(e<0||e>=24)throw new RangeError("CronPattern: Invalid value for "+t+": "+e)}else if(t==="day"||t==="nearestWeekdays"){if(e<0||e>=31)throw new RangeError("CronPattern: Invalid value for "+t+": "+e)}else if(t==="month"){if(e<0||e>=12)throw new RangeError("CronPattern: Invalid value for "+t+": "+e)}else if(t==="year"&&(e<1||e>=1e4))throw new RangeError("CronPattern: Invalid value for "+t+": "+e+" (supported range: 1-9999)");this[t][e]=r}validateNotNaN(t,e){if(isNaN(t))throw new TypeError(e)}validateRange(t,e,r,o,n){if(t>e)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");if(r!==void 0){if(r===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(r>this[o].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[o].length+")")}}handleRangeWithStepping(t,e,r,o){if(t.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");let n=this.extractNth(t,e),s=n[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(s===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+t+"'");let[,a,c,u]=s,f=parseInt(a,10)+r,l=parseInt(c,10)+r,d=parseInt(u,10);this.validateNotNaN(f,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(l,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateNotNaN(d,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(f,l,d,e,t);for(let p=f;p<=l;p+=d)this.setPart(e,p,n[1]||o)}extractNth(t,e){let r=t,o;if(r.includes("#")){if(e!=="dayOfWeek")throw new Error("CronPattern: nth (#) only allowed in day-of-week field");o=r.split("#")[1],r=r.split("#")[0]}else if(r.toUpperCase().endsWith("L")){if(e!=="dayOfWeek")throw new Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");o="L",r=r.slice(0,-1)}return[r,o]}handleRange(t,e,r,o){if(t.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in a range.");let n=this.extractNth(t,e),s=n[0].split("-");if(s.length!==2)throw new TypeError("CronPattern: Syntax error, illegal range: '"+t+"'");let a=parseInt(s[0],10)+r,c=parseInt(s[1],10)+r;this.validateNotNaN(a,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(c,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateRange(a,c,void 0,e,t);for(let u=a;u<=c;u++)this.setPart(e,u,n[1]||o)}handleStepping(t,e,r,o){if(t.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");let n=this.extractNth(t,e),s=n[0].split("/");if(s.length!==2)throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+t+"'");if(this.sloppyRanges)s[0]===""&&(s[0]="*");else{if(s[0]==="")throw new TypeError("CronPattern: Syntax error, stepping with missing prefix ('"+t+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");if(s[0]!=="*")throw new TypeError("CronPattern: Syntax error, stepping with numeric prefix ('"+t+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.")}let a=0;s[0]!=="*"&&(a=parseInt(s[0],10)+r);let c=parseInt(s[1],10);this.validateNotNaN(c,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(0,this[e].length-1,c,e,t);for(let u=a;u<this[e].length;u+=c)this.setPart(e,u,n[1]||o)}replaceAlphaDays(t){return t.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaDaysQuartz(t){return t.replace(/sun/gi,"1").replace(/mon/gi,"2").replace(/tue/gi,"3").replace(/wed/gi,"4").replace(/thu/gi,"5").replace(/fri/gi,"6").replace(/sat/gi,"7")}replaceAlphaMonths(t){return t.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames(t){let e=t.trim().toLowerCase();if(e==="@yearly"||e==="@annually")return"0 0 1 1 *";if(e==="@monthly")return"0 0 1 * *";if(e==="@weekly")return"0 0 * * 0";if(e==="@daily"||e==="@midnight")return"0 0 * * *";if(e==="@hourly")return"0 * * * *";if(e==="@reboot")throw new TypeError("CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.");return t}setNthWeekdayOfMonth(t,e){if(typeof e!="number"&&e.toUpperCase()==="L")this.dayOfWeek[t]=this.dayOfWeek[t]|32;else if(e===63)this.dayOfWeek[t]=63;else if(e<6&&e>0)this.dayOfWeek[t]=this.dayOfWeek[t]|bu[e-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${e}, Type: ${typeof e}`)}},Ba=[31,28,31,30,31,30,31,31,30,31,30,31],V=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],te=class Tu{static{i(this,"s")}tz;ms;second;minute;hour;day;month;year;constructor(e,r){if(this.tz=r,e&&e instanceof Date)if(!isNaN(e))this.fromDate(e);else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");else if(e==null)this.fromDate(new Date);else if(e&&typeof e=="string")this.fromString(e);else if(e instanceof Tu)this.fromCronDate(e);else throw new TypeError("CronDate: Invalid type ("+typeof e+") passed to CronDate constructor")}getLastDayOfMonth(e,r){return r!==1?Ba[r]:new Date(Date.UTC(e,r+1,0)).getUTCDate()}getLastWeekday(e,r){let o=this.getLastDayOfMonth(e,r),n=new Date(Date.UTC(e,r,o)).getUTCDay();return n===0?o-2:n===6?o-1:o}getNearestWeekday(e,r,o){let n=this.getLastDayOfMonth(e,r);if(o>n)return-1;let s=new Date(Date.UTC(e,r,o)).getUTCDay();return s===0?o===n?o-2:o+1:s===6?o===1?o+2:o-1:o}isNthWeekdayOfMonth(e,r,o,n){let s=new Date(Date.UTC(e,r,o)).getUTCDay(),a=0;for(let c=1;c<=o;c++)new Date(Date.UTC(e,r,c)).getUTCDay()===s&&a++;if(n&63&&bu[a-1]&n)return!0;if(n&32){let c=this.getLastDayOfMonth(e,r);for(let u=o+1;u<=c;u++)if(new Date(Date.UTC(e,r,u)).getUTCDay()===s)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz=="number")this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else try{let r=Do(e,this.tz);this.ms=e.getMilliseconds(),this.second=r.s,this.minute=r.i,this.hour=r.h,this.day=r.d,this.month=r.m-1,this.year=r.y}catch(r){let o=r instanceof Error?r.message:String(r);throw new TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${o}`)}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.month<0||this.day>Ba[this.month]||this.day<1||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz=="number"){let r=wu(e);this.ms=r.getUTCMilliseconds(),this.second=r.getUTCSeconds(),this.minute=r.getUTCMinutes(),this.hour=r.getUTCHours(),this.day=r.getUTCDate(),this.month=r.getUTCMonth(),this.year=r.getUTCFullYear(),this.apply()}else return this.fromDate(wu(e,this.tz))}findNext(e,r,o,n){return this._findMatch(e,r,o,n,1)}_findMatch(e,r,o,n,s){let a=this[r],c;o.lastDayOfMonth&&(c=this.getLastDayOfMonth(this.year,this.month));let u=!o.starDOW&&r=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0,f=this[r]+n,l=s===1?d=>d<o[r].length:d=>d>=0;for(let d=f;l(d);d+=s){let p=o[r][d];if(r==="day"&&!p){for(let h=0;h<o.nearestWeekdays.length;h++)if(o.nearestWeekdays[h]){let y=this.getNearestWeekday(this.year,this.month,h-n);if(y===-1)continue;if(y===d-n){p=1;break}}}if(r==="day"&&o.lastWeekday){let h=this.getLastWeekday(this.year,this.month);d-n===h&&(p=1)}if(r==="day"&&o.lastDayOfMonth&&d-n==c&&(p=1),r==="day"&&!o.starDOW){let h=o.dayOfWeek[(u+(d-n-1))%7];if(h&&h&63)h=this.isNthWeekdayOfMonth(this.year,this.month,d-n,h)?1:0;else if(h)throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${h}`);o.useAndLogic?p=p&&h:!e.domAndDow&&!o.starDOM?p=p||h:p=p&&h}if(p)return this[r]=d-n,a!==this[r]?2:1}return 3}recurse(e,r,o){if(o===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let s=-1;for(let a=this.year+1;a<e.year.length&&a<1e4;a++)if(e.year[a]===1){s=a;break}if(s===-1)return null;this.year=s,this.month=0,this.day=1,this.hour=0,this.minute=0,this.second=0,this.ms=0}if(this.year>=1e4)return null}let n=this.findNext(r,V[o][0],e,V[o][2]);if(n>1){let s=o+1;for(;s<V.length;)this[V[s][0]]=-V[s][2],s++;if(n===3){if(this[V[o][1]]++,this[V[o][0]]=-V[o][2],this.apply(),o===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0&&this.year<1e4;)this.year++;if(this.year>=1e4||this.year>=e.year.length)return null}return this.recurse(e,r,0)}else if(this.apply())return this.recurse(e,r,o-1)}return o+=1,o>=V.length?this:(e.starYear?this.year>=3e3:this.year>=1e4)?null:this.recurse(e,r,o)}increment(e,r,o){return this.second+=r.interval!==void 0&&r.interval>1&&o?r.interval:1,this.ms=0,this.apply(),this.recurse(e,r,0)}decrement(e,r){return this.second-=r.interval!==void 0&&r.interval>1?r.interval:1,this.ms=0,this.apply(),this.recurseBackward(e,r,0,0)}recurseBackward(e,r,o,n=0){if(n>1e4)return null;if(o===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let a=-1;for(let c=this.year-1;c>=0;c--)if(e.year[c]===1){a=c;break}if(a===-1)return null;this.year=a,this.month=11,this.day=31,this.hour=23,this.minute=59,this.second=59,this.ms=0}if(this.year<0)return null}let s=this.findPrevious(r,V[o][0],e,V[o][2]);if(s>1){let a=o+1;for(;a<V.length;){let c=V[a][0],u=V[a][2],f=this.getMaxPatternValue(c,e,u);this[c]=f,a++}if(s===3){if(this[V[o][1]]--,o===0){let l=this.getLastDayOfMonth(this.year,this.month);this.day>l&&(this.day=l)}if(o===1)if(this.day<=0)this.day=1;else{let l=this.year,d=this.month;for(;d<0;)d+=12,l--;for(;d>11;)d-=12,l++;let p=d!==1?Ba[d]:new Date(Date.UTC(l,d+1,0)).getUTCDate();this.day>p&&(this.day=p)}this.apply();let c=V[o][0],u=V[o][2],f=this.getMaxPatternValue(c,e,u);if(c==="day"){let l=this.getLastDayOfMonth(this.year,this.month);this[c]=Math.min(f,l)}else this[c]=f;if(this.apply(),o===0){let l=V[1][2],d=this.getMaxPatternValue("day",e,l),p=this.getLastDayOfMonth(this.year,this.month),h=Math.min(d,p);h!==this.day&&(this.day=h,this.hour=this.getMaxPatternValue("hour",e,V[2][2]),this.minute=this.getMaxPatternValue("minute",e,V[3][2]),this.second=this.getMaxPatternValue("second",e,V[4][2]))}if(o===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0;)this.year--;if(this.year<0)return null}return this.recurseBackward(e,r,0,n+1)}else if(this.apply())return this.recurseBackward(e,r,o-1,n+1)}return o+=1,o>=V.length?this:this.year<0?null:this.recurseBackward(e,r,o,n+1)}getMaxPatternValue(e,r,o){if(e==="day"&&r.lastDayOfMonth)return this.getLastDayOfMonth(this.year,this.month);if(e==="day"&&!r.starDOW)return this.getLastDayOfMonth(this.year,this.month);for(let n=r[e].length-1;n>=0;n--)if(r[e][n])return n-o;return r[e].length-1-o}findPrevious(e,r,o,n){return this._findMatch(e,r,o,n,-1)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz=="number"?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):gu(qa(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}match(e,r){if(!e.starYear&&(this.year<0||this.year>=e.year.length||e.year[this.year]===0))return!1;for(let o=0;o<V.length;o++){let n=V[o][0],s=V[o][2],a=this[n];if(a+s<0||a+s>=e[n].length)return!1;let c=e[n][a+s];if(n==="day"){if(!c){for(let u=0;u<e.nearestWeekdays.length;u++)if(e.nearestWeekdays[u]){let f=this.getNearestWeekday(this.year,this.month,u-s);if(f!==-1&&f===a){c=1;break}}}if(e.lastWeekday){let u=this.getLastWeekday(this.year,this.month);a===u&&(c=1)}if(e.lastDayOfMonth){let u=this.getLastDayOfMonth(this.year,this.month);a===u&&(c=1)}if(!e.starDOW){let u=new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay(),f=e.dayOfWeek[(u+(a-1))%7];f&&f&63&&(f=this.isNthWeekdayOfMonth(this.year,this.month,a,f)?1:0),e.useAndLogic?c=c&&f:!r.domAndDow&&!e.starDOM?c=c||f:c=c&&f}}if(!c)return!1}return!0}};function Lx(t){if(t===void 0&&(t={}),delete t.name,t.legacyMode!==void 0&&t.domAndDow===void 0?t.domAndDow=!t.legacyMode:t.domAndDow===void 0&&(t.domAndDow=!1),t.legacyMode=!t.domAndDow,t.paused=t.paused===void 0?!1:t.paused,t.maxRuns=t.maxRuns===void 0?1/0:t.maxRuns,t.catch=t.catch===void 0?!1:t.catch,t.interval=t.interval===void 0?0:parseInt(t.interval.toString(),10),t.utcOffset=t.utcOffset===void 0?void 0:parseInt(t.utcOffset.toString(),10),t.dayOffset=t.dayOffset===void 0?0:parseInt(t.dayOffset.toString(),10),t.unref=t.unref===void 0?!1:t.unref,t.mode=t.mode===void 0?"auto":t.mode,t.alternativeWeekdays=t.alternativeWeekdays===void 0?!1:t.alternativeWeekdays,t.sloppyRanges=t.sloppyRanges===void 0?!1:t.sloppyRanges,!["auto","5-part","6-part","7-part","5-or-6-parts","6-or-7-parts"].includes(t.mode))throw new Error("CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.");if(t.startAt&&(t.startAt=new te(t.startAt,t.timezone)),t.stopAt&&(t.stopAt=new te(t.stopAt,t.timezone)),t.interval!==null){if(isNaN(t.interval))throw new Error("CronOptions: Supplied value for interval is not a number");if(t.interval<0)throw new Error("CronOptions: Supplied value for interval can not be negative")}if(t.utcOffset!==void 0){if(isNaN(t.utcOffset))throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if(t.utcOffset<-870||t.utcOffset>870)throw new Error("CronOptions: utcOffset out of bounds.");if(t.utcOffset!==void 0&&t.timezone)throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if(t.unref!==!0&&t.unref!==!1)throw new Error("CronOptions: Unref should be either true, false or undefined(false).");if(t.dayOffset!==void 0&&t.dayOffset!==0&&isNaN(t.dayOffset))throw new Error("CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.");return t}i(Lx,"R");function So(t){return Object.prototype.toString.call(t)==="[object Function]"||typeof t=="function"||t instanceof Function}i(So,"p");function Ux(t){return So(t)}i(Ux,"_");function Yx(t){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(t):t&&typeof t.unref<"u"&&t.unref()}i(Yx,"x");var vu=30*1e3,Sr=[],Du=class{static{i(this,"E")}name;options;_states;fn;getTz(){return this.options.timezone||this.options.utcOffset}applyDayOffset(t){if(this.options.dayOffset!==void 0&&this.options.dayOffset!==0){let e=this.options.dayOffset*24*60*60*1e3;return new Date(t.getTime()+e)}return t}constructor(t,e,r){let o,n;if(So(e))n=e;else if(typeof e=="object")o=e;else if(e!==void 0)throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(So(r))n=r;else if(typeof r=="object")o=r;else if(r!==void 0)throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=o?.name,this.options=Lx(o),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:o?o.maxRuns:void 0,paused:o?o.paused:!1,pattern:new $n("* * * * *",void 0,{mode:"auto"})},t&&(t instanceof Date||typeof t=="string"&&t.indexOf(":")>0)?this._states.once=new te(t,this.getTz()):this._states.pattern=new $n(t,this.options.timezone,{mode:this.options.mode,alternativeWeekdays:this.options.alternativeWeekdays,sloppyRanges:this.options.sloppyRanges}),this.name){if(Sr.find(s=>s.name===this.name))throw new Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");Sr.push(this)}return n!==void 0&&Ux(n)&&(this.fn=n,this.schedule()),this}nextRun(t){let e=this._next(t);return e?this.applyDayOffset(e.getDate(!1)):null}nextRuns(t,e){this._states.maxRuns!==void 0&&t>this._states.maxRuns&&(t=this._states.maxRuns);let r=e||this._states.currentRun||void 0;return this._enumerateRuns(t,r,"next")}previousRuns(t,e){return this._enumerateRuns(t,e||void 0,"previous")}_enumerateRuns(t,e,r){let o=[],n=e?new te(e,this.getTz()):null,s=r==="next"?this._next:this._previous;for(;t--;){let a=s.call(this,n);if(!a)break;let c=a.getDate(!1);o.push(this.applyDayOffset(c)),n=a}return o}match(t){if(this._states.once){let r=new te(t,this.getTz());r.ms=0;let o=new te(this._states.once,this.getTz());return o.ms=0,r.getTime()===o.getTime()}let e=new te(t,this.getTz());return e.ms=0,e.match(this._states.pattern,this.options)}getPattern(){if(!this._states.once)return this._states.pattern?this._states.pattern.pattern:void 0}getOnce(){return this._states.once?this._states.once.getDate():null}isRunning(){let t=this.nextRun(this._states.currentRun),e=!this._states.paused,r=this.fn!==void 0,o=!this._states.kill;return e&&r&&o&&t!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(t){let e=this._next(t);return e?t instanceof te||t instanceof Date?e.getTime()-t.getTime():e.getTime()-new te(t).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let t=Sr.indexOf(this);t>=0&&Sr.splice(t,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(t){if(t&&this.fn)throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");t&&(this.fn=t);let e=this.msToNext(),r=this.nextRun(this._states.currentRun);return e==null||isNaN(e)||r===null?this:(e>vu&&(e=vu),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(r),e),this._states.currentTimeout&&this.options.unref&&Yx(this._states.currentTimeout),this)}async _trigger(t){this._states.blocking=!0,this._states.currentRun=new te(void 0,this.getTz());try{if(this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){if(So(this.options.catch))try{this.options.catch(e,this)}catch{}}else this.fn!==void 0&&await this.fn(this,this.options.context)}finally{this._states.previousRun=new te(t,this.getTz()),this._states.blocking=!1}}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(t){let e=new Date,r=!this._states.paused&&e.getTime()>=t.getTime(),o=this._states.blocking&&this.options.protect;r&&!o?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):r&&o&&So(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(t){let e=!!(t||this._states.currentRun),r=!1;!t&&this.options.startAt&&this.options.interval&&([t,e]=this._calculatePreviousRun(t,e),r=!t),t=new te(t,this.getTz()),this.options.startAt&&t&&t.getTime()<this.options.startAt.getTime()&&(t=this.options.startAt);let o=this._states.once||new te(t,this.getTz());return!r&&o!==this._states.once&&(o=o.increment(this._states.pattern,this.options,e)),this._states.once&&this._states.once.getTime()<=t.getTime()||o===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&o.getTime()>=this.options.stopAt.getTime()?null:o}_previous(t){let e=new te(t,this.getTz());this.options.stopAt&&e.getTime()>this.options.stopAt.getTime()&&(e=this.options.stopAt);let r=new te(e,this.getTz());return this._states.once?this._states.once.getTime()<e.getTime()?this._states.once:null:(r=r.decrement(this._states.pattern,this.options),r===null||this.options.startAt&&r.getTime()<this.options.startAt.getTime()?null:r)}_calculatePreviousRun(t,e){let r=new te(void 0,this.getTz()),o=t;if(this.options.startAt.getTime()<=r.getTime()){o=this.options.startAt;let n=o.getTime()+this.options.interval*1e3;for(;n<=r.getTime();)o=new te(o,this.getTz()).increment(this._states.pattern,this.options,!0),n=o.getTime()+this.options.interval*1e3;e=!0}return o===null&&(o=void 0),[o,e]}};var Fo={};Y(Fo,{add:()=>bt,addBusinessDays:()=>Zn,addDays:()=>re,addHours:()=>An,addISOWeekYears:()=>ti,addMilliseconds:()=>vt,addMinutes:()=>kr,addMonths:()=>Ke,addQuarters:()=>Ir,addSeconds:()=>ri,addWeeks:()=>Tt,addYears:()=>oi,areIntervalsOverlapping:()=>ku,clamp:()=>Iu,closestIndexTo:()=>si,closestTo:()=>Pu,compareAsc:()=>de,compareDesc:()=>Cu,constructFrom:()=>x,constructNow:()=>N,daysToWeeks:()=>_u,differenceInBusinessDays:()=>Ru,differenceInCalendarDays:()=>ne,differenceInCalendarISOWeekYears:()=>ci,differenceInCalendarISOWeeks:()=>Nu,differenceInCalendarMonths:()=>Xt,differenceInCalendarQuarters:()=>Pr,differenceInCalendarWeeks:()=>Zt,differenceInCalendarYears:()=>Dt,differenceInDays:()=>Cr,differenceInHours:()=>At,differenceInISOWeekYears:()=>Wu,differenceInMilliseconds:()=>_r,differenceInMinutes:()=>er,differenceInMonths:()=>St,differenceInQuarters:()=>Lu,differenceInSeconds:()=>et,differenceInWeeks:()=>Uu,differenceInYears:()=>li,eachDayOfInterval:()=>di,eachHourOfInterval:()=>Yu,eachMinuteOfInterval:()=>Hu,eachMonthOfInterval:()=>ju,eachQuarterOfInterval:()=>$u,eachWeekOfInterval:()=>qu,eachWeekendOfInterval:()=>Fr,eachWeekendOfMonth:()=>Bu,eachWeekendOfYear:()=>zu,eachYearOfInterval:()=>Vu,endOfDay:()=>Rr,endOfDecade:()=>Gu,endOfHour:()=>Ju,endOfISOWeek:()=>Qu,endOfISOWeekYear:()=>Ku,endOfMinute:()=>Xu,endOfMonth:()=>Nr,endOfQuarter:()=>Zu,endOfSecond:()=>Au,endOfToday:()=>ef,endOfTomorrow:()=>tf,endOfWeek:()=>pi,endOfYear:()=>mi,endOfYesterday:()=>rf,format:()=>Po,formatDate:()=>Po,formatDistance:()=>gi,formatDistanceStrict:()=>bi,formatDistanceToNow:()=>pf,formatDistanceToNowStrict:()=>hf,formatDuration:()=>yf,formatISO:()=>xf,formatISO9075:()=>wf,formatISODuration:()=>gf,formatRFC3339:()=>bf,formatRFC7231:()=>vf,formatRelative:()=>Tf,formatters:()=>ko,fromUnixTime:()=>Df,getDate:()=>vi,getDay:()=>kt,getDayOfYear:()=>yi,getDaysInMonth:()=>Ti,getDaysInYear:()=>Sf,getDecade:()=>Mf,getDefaultOptions:()=>Si,getHours:()=>Of,getISODay:()=>Mi,getISOWeek:()=>Yr,getISOWeekYear:()=>Te,getISOWeeksInYear:()=>Ef,getMilliseconds:()=>kf,getMinutes:()=>If,getMonth:()=>Pf,getOverlappingDaysInIntervals:()=>Cf,getQuarter:()=>Eo,getSeconds:()=>_f,getTime:()=>Rf,getUnixTime:()=>Nf,getWeek:()=>Hr,getWeekOfMonth:()=>Ff,getWeekYear:()=>Ot,getWeeksInMonth:()=>Wf,getYear:()=>Lf,hoursToMilliseconds:()=>Uf,hoursToMinutes:()=>Yf,hoursToSeconds:()=>Hf,interval:()=>jf,intervalToDuration:()=>$f,intlFormat:()=>qf,intlFormatDistance:()=>Bf,isAfter:()=>zf,isBefore:()=>Vf,isDate:()=>ai,isEqual:()=>Gf,isExists:()=>Jf,isFirstDayOfMonth:()=>Qf,isFriday:()=>Kf,isFuture:()=>Xf,isLastDayOfMonth:()=>fi,isLeapYear:()=>Di,isMatch:()=>Zf,isMonday:()=>Af,isPast:()=>el,isSameDay:()=>Ae,isSameHour:()=>ys,isSameISOWeek:()=>xs,isSameISOWeekYear:()=>tl,isSameMinute:()=>ws,isSameMonth:()=>gs,isSameQuarter:()=>bs,isSameSecond:()=>vs,isSameWeek:()=>Br,isSameYear:()=>Ts,isSaturday:()=>Kn,isSunday:()=>Xn,isThisHour:()=>rl,isThisISOWeek:()=>ol,isThisMinute:()=>nl,isThisMonth:()=>il,isThisQuarter:()=>sl,isThisSecond:()=>al,isThisWeek:()=>cl,isThisYear:()=>ul,isThursday:()=>fl,isToday:()=>ll,isTomorrow:()=>dl,isTuesday:()=>ml,isValid:()=>ae,isWednesday:()=>pl,isWeekend:()=>Xe,isWithinInterval:()=>hl,isYesterday:()=>yl,lastDayOfDecade:()=>xl,lastDayOfISOWeek:()=>wl,lastDayOfISOWeekYear:()=>gl,lastDayOfMonth:()=>Oi,lastDayOfQuarter:()=>bl,lastDayOfWeek:()=>Ds,lastDayOfYear:()=>vl,lightFormat:()=>Tl,lightFormatters:()=>Ie,longFormatters:()=>Et,max:()=>ni,milliseconds:()=>Dl,millisecondsToHours:()=>Sl,millisecondsToMinutes:()=>Ml,millisecondsToSeconds:()=>Ol,min:()=>ii,minutesToHours:()=>El,minutesToMilliseconds:()=>kl,minutesToSeconds:()=>Il,monthsToQuarters:()=>Pl,monthsToYears:()=>Cl,nextDay:()=>pe,nextFriday:()=>_l,nextMonday:()=>Rl,nextSaturday:()=>Nl,nextSunday:()=>Fl,nextThursday:()=>Wl,nextTuesday:()=>Ll,nextWednesday:()=>Ul,parse:()=>hs,parseISO:()=>Hl,parseJSON:()=>jl,parsers:()=>ps,previousDay:()=>he,previousFriday:()=>$l,previousMonday:()=>ql,previousSaturday:()=>Bl,previousSunday:()=>zl,previousThursday:()=>Vl,previousTuesday:()=>Gl,previousWednesday:()=>Jl,quartersToMonths:()=>Ql,quartersToYears:()=>Kl,roundToNearestHours:()=>Xl,roundToNearestMinutes:()=>Zl,secondsToHours:()=>Al,secondsToMilliseconds:()=>ed,secondsToMinutes:()=>td,set:()=>rd,setDate:()=>od,setDay:()=>It,setDayOfYear:()=>nd,setDefaultOptions:()=>id,setHours:()=>sd,setISODay:()=>Zi,setISOWeek:()=>zi,setISOWeekYear:()=>ei,setMilliseconds:()=>ad,setMinutes:()=>cd,setMonth:()=>zr,setQuarter:()=>ud,setSeconds:()=>fd,setWeek:()=>qi,setWeekYear:()=>ld,setYear:()=>dd,startOfDay:()=>Ze,startOfDecade:()=>md,startOfHour:()=>Co,startOfISOWeek:()=>A,startOfISOWeekYear:()=>ke,startOfMinute:()=>_o,startOfMonth:()=>Mt,startOfQuarter:()=>tt,startOfSecond:()=>Ro,startOfToday:()=>pd,startOfTomorrow:()=>hd,startOfWeek:()=>$,startOfWeekYear:()=>tr,startOfYear:()=>Wr,startOfYesterday:()=>yd,sub:()=>xd,subBusinessDays:()=>wd,subDays:()=>Pt,subHours:()=>gd,subISOWeekYears:()=>ui,subMilliseconds:()=>bd,subMinutes:()=>vd,subMonths:()=>Ms,subQuarters:()=>Td,subSeconds:()=>Dd,subWeeks:()=>Sd,subYears:()=>Md,toDate:()=>m,transpose:()=>Ei,weeksToDays:()=>Od,yearsToDays:()=>Ed,yearsToMonths:()=>kd,yearsToQuarters:()=>Id});var Bn=7,Oo=365.2425,Hx=Math.pow(10,8)*24*60*60*1e3,CR=-Hx,Qe=6048e5,zn=864e5,le=6e4,Ee=36e5,Mr=1e3,za=525600,gt=43200,Or=1440,Vn=60,Gn=3,Jn=12,Qn=4,Kt=3600,Er=60,qn=Kt*24,Su=qn*7,Va=qn*365.2425,Ga=Va/12,Mu=Ga*3,Ja=Symbol.for("constructDateFrom");function x(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&Ja in t?t[Ja](e):t instanceof Date?new t.constructor(e):new Date(e)}i(x,"constructFrom");var NR=x;function m(t,e){return x(e||t,t)}i(m,"toDate");var UR=m;function re(t,e,r){let o=m(t,r?.in);return isNaN(e)?x(r?.in||t,NaN):(e&&o.setDate(o.getDate()+e),o)}i(re,"addDays");var qR=re;function Ke(t,e,r){let o=m(t,r?.in);if(isNaN(e))return x(r?.in||t,NaN);if(!e)return o;let n=o.getDate(),s=x(r?.in||t,o.getTime());s.setMonth(o.getMonth()+e+1,0);let a=s.getDate();return n>=a?s:(o.setFullYear(s.getFullYear(),s.getMonth(),n),o)}i(Ke,"addMonths");var JR=Ke;function bt(t,e,r){let{years:o=0,months:n=0,weeks:s=0,days:a=0,hours:c=0,minutes:u=0,seconds:f=0}=e,l=m(t,r?.in),d=n||o?Ke(l,n+o*12):l,p=a||s?re(d,a+s*7):d,h=u+c*60,w=(f+h*60)*1e3;return x(r?.in||t,+p+w)}i(bt,"add");var tN=bt;function Kn(t,e){return m(t,e?.in).getDay()===6}i(Kn,"isSaturday");var iN=Kn;function Xn(t,e){return m(t,e?.in).getDay()===0}i(Xn,"isSunday");var uN=Xn;function Xe(t,e){let r=m(t,e?.in).getDay();return r===0||r===6}i(Xe,"isWeekend");var mN=Xe;function Zn(t,e,r){let o=m(t,r?.in),n=Xe(o,r);if(isNaN(e))return x(r?.in,NaN);let s=o.getHours(),a=e<0?-1:1,c=Math.trunc(e/5);o.setDate(o.getDate()+c*7);let u=Math.abs(e%5);for(;u>0;)o.setDate(o.getDate()+a),Xe(o,r)||(u-=1);return n&&Xe(o,r)&&e!==0&&(Kn(o,r)&&o.setDate(o.getDate()+(a<0?2:-1)),Xn(o,r)&&o.setDate(o.getDate()+(a<0?1:-2))),o.setHours(s),o}i(Zn,"addBusinessDays");var vN=Zn;function vt(t,e,r){return x(r?.in||t,+m(t)+e)}i(vt,"addMilliseconds");var ON=vt;function An(t,e,r){return vt(t,e*Ee,r)}i(An,"addHours");var CN=An;var Ou={};function U(){return Ou}i(U,"getDefaultOptions");function Eu(t){Ou=t}i(Eu,"setDefaultOptions");function $(t,e){let r=U(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,n=m(t,e?.in),s=n.getDay(),a=(s<o?7:0)+s-o;return n.setDate(n.getDate()-a),n.setHours(0,0,0,0),n}i($,"startOfWeek");var UN=$;function A(t,e){return $(t,{...e,weekStartsOn:1})}i(A,"startOfISOWeek");var $N=A;function Te(t,e){let r=m(t,e?.in),o=r.getFullYear(),n=x(r,0);n.setFullYear(o+1,0,4),n.setHours(0,0,0,0);let s=A(n),a=x(r,0);a.setFullYear(o,0,4),a.setHours(0,0,0,0);let c=A(a);return r.getTime()>=s.getTime()?o+1:r.getTime()>=c.getTime()?o:o-1}i(Te,"getISOWeekYear");var JN=Te;function J(t){let e=m(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}i(J,"getTimezoneOffsetInMilliseconds");function O(t,...e){let r=x.bind(null,t||e.find(o=>typeof o=="object"));return e.map(r)}i(O,"normalizeDates");function Ze(t,e){let r=m(t,e?.in);return r.setHours(0,0,0,0),r}i(Ze,"startOfDay");var n2=Ze;function ne(t,e,r){let[o,n]=O(r?.in,t,e),s=Ze(o),a=Ze(n),c=+s-J(s),u=+a-J(a);return Math.round((c-u)/zn)}i(ne,"differenceInCalendarDays");var l2=ne;function ke(t,e){let r=Te(t,e),o=x(e?.in||t,0);return o.setFullYear(r,0,4),o.setHours(0,0,0,0),A(o)}i(ke,"startOfISOWeekYear");var x2=ke;function ei(t,e,r){let o=m(t,r?.in),n=ne(o,ke(o,r)),s=x(r?.in||t,0);return s.setFullYear(e,0,4),s.setHours(0,0,0,0),o=ke(s),o.setDate(o.getDate()+n),o}i(ei,"setISOWeekYear");var S2=ei;function ti(t,e,r){return ei(t,Te(t,r)+e,r)}i(ti,"addISOWeekYears");var I2=ti;function kr(t,e,r){let o=m(t,r?.in);return o.setTime(o.getTime()+e*le),o}i(kr,"addMinutes");var N2=kr;function Ir(t,e,r){return Ke(t,e*3,r)}i(Ir,"addQuarters");var U2=Ir;function ri(t,e,r){return vt(t,e*1e3,r)}i(ri,"addSeconds");var $2=ri;function Tt(t,e,r){return re(t,e*7,r)}i(Tt,"addWeeks");var V2=Tt;function oi(t,e,r){return Ke(t,e*12,r)}i(oi,"addYears");var K2=oi;function ku(t,e,r){let[o,n]=[+m(t.start,r?.in),+m(t.end,r?.in)].sort((c,u)=>c-u),[s,a]=[+m(e.start,r?.in),+m(e.end,r?.in)].sort((c,u)=>c-u);return r?.inclusive?o<=a&&s<=n:o<a&&s<n}i(ku,"areIntervalsOverlapping");var eF=ku;function ni(t,e){let r,o=e?.in;return t.forEach(n=>{!o&&typeof n=="object"&&(o=x.bind(null,n));let s=m(n,o);(!r||r<s||isNaN(+s))&&(r=s)}),x(o,r||NaN)}i(ni,"max");var iF=ni;function ii(t,e){let r,o=e?.in;return t.forEach(n=>{!o&&typeof n=="object"&&(o=x.bind(null,n));let s=m(n,o);(!r||r>s||isNaN(+s))&&(r=s)}),x(o,r||NaN)}i(ii,"min");var fF=ii;function Iu(t,e,r){let[o,n,s]=O(r?.in,t,e.start,e.end);return ii([ni([o,n],r),s],r)}i(Iu,"clamp");var yF=Iu;function si(t,e){let r=+m(t);if(isNaN(r))return NaN;let o,n;return e.forEach((s,a)=>{let c=m(s);if(isNaN(+c)){o=NaN,n=NaN;return}let u=Math.abs(r-+c);(o==null||u<n)&&(o=a,n=u)}),o}i(si,"closestIndexTo");var bF=si;function Pu(t,e,r){let[o,...n]=O(r?.in,t,...e),s=si(o,n);if(typeof s=="number"&&isNaN(s))return x(o,NaN);if(s!==void 0)return n[s]}i(Pu,"closestTo");var OF=Pu;function de(t,e){let r=+m(t)-+m(e);return r<0?-1:r>0?1:r}i(de,"compareAsc");var PF=de;function Cu(t,e){let r=+m(t)-+m(e);return r>0?-1:r<0?1:r}i(Cu,"compareDesc");var NF=Cu;function N(t){return x(t,Date.now())}i(N,"constructNow");var UF=N;function _u(t){let e=Math.trunc(t/7);return e===0?0:e}i(_u,"daysToWeeks");var $F=_u;function Ae(t,e,r){let[o,n]=O(r?.in,t,e);return+Ze(o)==+Ze(n)}i(Ae,"isSameDay");var GF=Ae;function ai(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}i(ai,"isDate");var KF=ai;function ae(t){return!(!ai(t)&&typeof t!="number"||isNaN(+m(t)))}i(ae,"isValid");var tW=ae;function Ru(t,e,r){let[o,n]=O(r?.in,t,e);if(!ae(o)||!ae(n))return NaN;let s=ne(o,n),a=s<0?-1:1,c=Math.trunc(s/7),u=c*5,f=re(n,c*7);for(;!Ae(o,f);)u+=Xe(f,r)?0:a,f=re(f,a);return u===0?0:u}i(Ru,"differenceInBusinessDays");var fW=Ru;function ci(t,e,r){let[o,n]=O(r?.in,t,e);return Te(o,r)-Te(n,r)}i(ci,"differenceInCalendarISOWeekYears");var hW=ci;function Nu(t,e,r){let[o,n]=O(r?.in,t,e),s=A(o),a=A(n),c=+s-J(s),u=+a-J(a);return Math.round((c-u)/Qe)}i(Nu,"differenceInCalendarISOWeeks");var TW=Nu;function Xt(t,e,r){let[o,n]=O(r?.in,t,e),s=o.getFullYear()-n.getFullYear(),a=o.getMonth()-n.getMonth();return s*12+a}i(Xt,"differenceInCalendarMonths");var OW=Xt;function Eo(t,e){let r=m(t,e?.in);return Math.trunc(r.getMonth()/3)+1}i(Eo,"getQuarter");var PW=Eo;function Pr(t,e,r){let[o,n]=O(r?.in,t,e),s=o.getFullYear()-n.getFullYear(),a=Eo(o)-Eo(n);return s*4+a}i(Pr,"differenceInCalendarQuarters");var FW=Pr;function Zt(t,e,r){let[o,n]=O(r?.in,t,e),s=$(o,r),a=$(n,r),c=+s-J(s),u=+a-J(a);return Math.round((c-u)/Qe)}i(Zt,"differenceInCalendarWeeks");var $W=Zt;function Dt(t,e,r){let[o,n]=O(r?.in,t,e);return o.getFullYear()-n.getFullYear()}i(Dt,"differenceInCalendarYears");var VW=Dt;function Cr(t,e,r){let[o,n]=O(r?.in,t,e),s=Fu(o,n),a=Math.abs(ne(o,n));o.setDate(o.getDate()-s*a);let c=+(Fu(o,n)===-s),u=s*(a-c);return u===0?0:u}i(Cr,"differenceInDays");function Fu(t,e){let r=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return r<0?-1:r>0?1:r}i(Fu,"compareLocalAsc");var XW=Cr;function me(t){return e=>{let o=(t?Math[t]:Math.trunc)(e);return o===0?0:o}}i(me,"getRoundingMethod");function At(t,e,r){let[o,n]=O(r?.in,t,e),s=(+o-+n)/Ee;return me(r?.roundingMethod)(s)}i(At,"differenceInHours");var i3=At;function ui(t,e,r){return ti(t,-e,r)}i(ui,"subISOWeekYears");var u3=ui;function Wu(t,e,r){let[o,n]=O(r?.in,t,e),s=de(o,n),a=Math.abs(ci(o,n,r)),c=ui(o,s*a,r),u=+(de(c,n)===-s),f=s*(a-u);return f===0?0:f}i(Wu,"differenceInISOWeekYears");var y3=Wu;function _r(t,e){return+m(t)-+m(e)}i(_r,"differenceInMilliseconds");var b3=_r;function er(t,e,r){let o=_r(t,e)/le;return me(r?.roundingMethod)(o)}i(er,"differenceInMinutes");var O3=er;function Rr(t,e){let r=m(t,e?.in);return r.setHours(23,59,59,999),r}i(Rr,"endOfDay");var P3=Rr;function Nr(t,e){let r=m(t,e?.in),o=r.getMonth();return r.setFullYear(r.getFullYear(),o+1,0),r.setHours(23,59,59,999),r}i(Nr,"endOfMonth");var N3=Nr;function fi(t,e){let r=m(t,e?.in);return+Rr(r,e)==+Nr(r,e)}i(fi,"isLastDayOfMonth");var H3=fi;function St(t,e,r){let[o,n,s]=O(r?.in,t,t,e),a=de(n,s),c=Math.abs(Xt(n,s));if(c<1)return 0;n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*c);let u=de(n,s)===-a;fi(o)&&c===1&&de(o,s)===1&&(u=!1);let f=a*(c-+u);return f===0?0:f}i(St,"differenceInMonths");var G3=St;function Lu(t,e,r){let o=St(t,e,r)/3;return me(r?.roundingMethod)(o)}i(Lu,"differenceInQuarters");var Z3=Lu;function et(t,e,r){let o=_r(t,e)/1e3;return me(r?.roundingMethod)(o)}i(et,"differenceInSeconds");var oL=et;function Uu(t,e,r){let o=Cr(t,e,r)/7;return me(r?.roundingMethod)(o)}i(Uu,"differenceInWeeks");var cL=Uu;function li(t,e,r){let[o,n]=O(r?.in,t,e),s=de(o,n),a=Math.abs(Dt(o,n));o.setFullYear(1584),n.setFullYear(1584);let c=de(o,n)===-s,u=s*(a-+c);return u===0?0:u}i(li,"differenceInYears");var pL=li;function ie(t,e){let[r,o]=O(t,e.start,e.end);return{start:r,end:o}}i(ie,"normalizeInterval");function di(t,e){let{start:r,end:o}=ie(e?.in,t),n=+r>+o,s=n?+r:+o,a=n?o:r;a.setHours(0,0,0,0);let c=e?.step??1;if(!c)return[];c<0&&(c=-c,n=!n);let u=[];for(;+a<=s;)u.push(x(r,a)),a.setDate(a.getDate()+c),a.setHours(0,0,0,0);return n?u.reverse():u}i(di,"eachDayOfInterval");var TL=di;function Yu(t,e){let{start:r,end:o}=ie(e?.in,t),n=+r>+o,s=n?+r:+o,a=n?o:r;a.setMinutes(0,0,0);let c=e?.step??1;if(!c)return[];c<0&&(c=-c,n=!n);let u=[];for(;+a<=s;)u.push(x(r,a)),a.setHours(a.getHours()+c);return n?u.reverse():u}i(Yu,"eachHourOfInterval");var EL=Yu;function Hu(t,e){let{start:r,end:o}=ie(e?.in,t);r.setSeconds(0,0);let n=+r>+o,s=n?+r:+o,a=n?o:r,c=e?.step??1;if(!c)return[];c<0&&(c=-c,n=!n);let u=[];for(;+a<=s;)u.push(x(r,a)),a=kr(a,c);return n?u.reverse():u}i(Hu,"eachMinuteOfInterval");var RL=Hu;function ju(t,e){let{start:r,end:o}=ie(e?.in,t),n=+r>+o,s=n?+r:+o,a=n?o:r;a.setHours(0,0,0,0),a.setDate(1);let c=e?.step??1;if(!c)return[];c<0&&(c=-c,n=!n);let u=[];for(;+a<=s;)u.push(x(r,a)),a.setMonth(a.getMonth()+c);return n?u.reverse():u}i(ju,"eachMonthOfInterval");var UL=ju;function tt(t,e){let r=m(t,e?.in),o=r.getMonth(),n=o-o%3;return r.setMonth(n,1),r.setHours(0,0,0,0),r}i(tt,"startOfQuarter");var $L=tt;function $u(t,e){let{start:r,end:o}=ie(e?.in,t),n=+r>+o,s=n?+tt(r):+tt(o),a=n?tt(o):tt(r),c=e?.step??1;if(!c)return[];c<0&&(c=-c,n=!n);let u=[];for(;+a<=s;)u.push(x(r,a)),a=Ir(a,c);return n?u.reverse():u}i($u,"eachQuarterOfInterval");var QL=$u;function qu(t,e){let{start:r,end:o}=ie(e?.in,t),n=+r>+o,s=n?$(o,e):$(r,e),a=n?$(r,e):$(o,e);s.setHours(15),a.setHours(15);let c=+a.getTime(),u=s,f=e?.step??1;if(!f)return[];f<0&&(f=-f,n=!n);let l=[];for(;+u<=c;)u.setHours(0),l.push(x(r,u)),u=Tt(u,f),u.setHours(15);return n?l.reverse():l}i(qu,"eachWeekOfInterval");var r6=qu;function Fr(t,e){let{start:r,end:o}=ie(e?.in,t),n=di({start:r,end:o},e),s=[],a=0;for(;a<n.length;){let c=n[a++];Xe(c)&&s.push(x(r,c))}return s}i(Fr,"eachWeekendOfInterval");var u6=Fr;function Mt(t,e){let r=m(t,e?.in);return r.setDate(1),r.setHours(0,0,0,0),r}i(Mt,"startOfMonth");var m6=Mt;function Bu(t,e){let r=Mt(t,e),o=Nr(t,e);return Fr({start:r,end:o},e)}i(Bu,"eachWeekendOfMonth");var g6=Bu;function mi(t,e){let r=m(t,e?.in),o=r.getFullYear();return r.setFullYear(o+1,0,0),r.setHours(23,59,59,999),r}i(mi,"endOfYear");var D6=mi;function Wr(t,e){let r=m(t,e?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}i(Wr,"startOfYear");var E6=Wr;function zu(t,e){let r=Wr(t,e),o=mi(t,e);return Fr({start:r,end:o},e)}i(zu,"eachWeekendOfYear");var R6=zu;function Vu(t,e){let{start:r,end:o}=ie(e?.in,t),n=+r>+o,s=n?+r:+o,a=n?o:r;a.setHours(0,0,0,0),a.setMonth(0,1);let c=e?.step??1;if(!c)return[];c<0&&(c=-c,n=!n);let u=[];for(;+a<=s;)u.push(x(r,a)),a.setFullYear(a.getFullYear()+c);return n?u.reverse():u}i(Vu,"eachYearOfInterval");var U6=Vu;function Gu(t,e){let r=m(t,e?.in),o=r.getFullYear(),n=9+Math.floor(o/10)*10;return r.setFullYear(n,11,31),r.setHours(23,59,59,999),r}i(Gu,"endOfDecade");var $6=Gu;function Ju(t,e){let r=m(t,e?.in);return r.setMinutes(59,59,999),r}i(Ju,"endOfHour");var V6=Ju;function pi(t,e){let r=U(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,n=m(t,e?.in),s=n.getDay(),a=(s<o?-7:0)+6-(s-o);return n.setDate(n.getDate()+a),n.setHours(23,59,59,999),n}i(pi,"endOfWeek");var X6=pi;function Qu(t,e){return pi(t,{...e,weekStartsOn:1})}i(Qu,"endOfISOWeek");var t4=Qu;function Ku(t,e){let r=Te(t,e),o=x(e?.in||t,0);o.setFullYear(r+1,0,4),o.setHours(0,0,0,0);let n=A(o,e);return n.setMilliseconds(n.getMilliseconds()-1),n}i(Ku,"endOfISOWeekYear");var a4=Ku;function Xu(t,e){let r=m(t,e?.in);return r.setSeconds(59,999),r}i(Xu,"endOfMinute");var l4=Xu;function Zu(t,e){let r=m(t,e?.in),o=r.getMonth(),n=o-o%3+3;return r.setMonth(n,0),r.setHours(23,59,59,999),r}i(Zu,"endOfQuarter");var h4=Zu;function Au(t,e){let r=m(t,e?.in);return r.setMilliseconds(999),r}i(Au,"endOfSecond");var g4=Au;function ef(t){return Rr(Date.now(),t)}i(ef,"endOfToday");var D4=ef;function tf(t){let e=N(t?.in),r=e.getFullYear(),o=e.getMonth(),n=e.getDate(),s=N(t?.in);return s.setFullYear(r,o,n+1),s.setHours(23,59,59,999),t?.in?t.in(s):s}i(tf,"endOfTomorrow");var E4=tf;function rf(t){let e=N(t?.in),r=x(t?.in,0);return r.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()-1),r.setHours(23,59,59,999),r}i(rf,"endOfYesterday");var _4=rf;var jx={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},of=i((t,e,r)=>{let o,n=jx[t];return typeof n=="string"?o=n:e===1?o=n.one:o=n.other.replace("{{count}}",e.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"in "+o:o+" ago":o},"formatDistance");function hi(t){return(e={})=>{let r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}i(hi,"buildFormatLongFn");var $x={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},qx={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Bx={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},nf={date:hi({formats:$x,defaultWidth:"full"}),time:hi({formats:qx,defaultWidth:"full"}),dateTime:hi({formats:Bx,defaultWidth:"full"})};var zx={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},sf=i((t,e,r,o)=>zx[t],"formatRelative");function Lr(t){return(e,r)=>{let o=r?.context?String(r.context):"standalone",n;if(o==="formatting"&&t.formattingValues){let a=t.defaultFormattingWidth||t.defaultWidth,c=r?.width?String(r.width):a;n=t.formattingValues[c]||t.formattingValues[a]}else{let a=t.defaultWidth,c=r?.width?String(r.width):t.defaultWidth;n=t.values[c]||t.values[a]}let s=t.argumentCallback?t.argumentCallback(e):e;return n[s]}}i(Lr,"buildLocalizeFn");var Vx={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Gx={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Jx={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Qx={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Kx={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Xx={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Zx=i((t,e)=>{let r=Number(t),o=r%100;if(o>20||o<10)switch(o%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},"ordinalNumber"),af={ordinalNumber:Zx,era:Lr({values:Vx,defaultWidth:"wide"}),quarter:Lr({values:Gx,defaultWidth:"wide",argumentCallback:i(t=>t-1,"argumentCallback")}),month:Lr({values:Jx,defaultWidth:"wide"}),day:Lr({values:Qx,defaultWidth:"wide"}),dayPeriod:Lr({values:Kx,defaultWidth:"wide",formattingValues:Xx,defaultFormattingWidth:"wide"})};function Ur(t){return(e,r={})=>{let o=r.width,n=o&&t.matchPatterns[o]||t.matchPatterns[t.defaultMatchWidth],s=e.match(n);if(!s)return null;let a=s[0],c=o&&t.parsePatterns[o]||t.parsePatterns[t.defaultParseWidth],u=Array.isArray(c)?ew(c,d=>d.test(a)):Ax(c,d=>d.test(a)),f;f=t.valueCallback?t.valueCallback(u):u,f=r.valueCallback?r.valueCallback(f):f;let l=e.slice(a.length);return{value:f,rest:l}}}i(Ur,"buildMatchFn");function Ax(t,e){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}i(Ax,"findKey");function ew(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}i(ew,"findIndex");function cf(t){return(e,r={})=>{let o=e.match(t.matchPattern);if(!o)return null;let n=o[0],s=e.match(t.parsePattern);if(!s)return null;let a=t.valueCallback?t.valueCallback(s[0]):s[0];a=r.valueCallback?r.valueCallback(a):a;let c=e.slice(n.length);return{value:a,rest:c}}}i(cf,"buildMatchPatternFn");var tw=/^(\d+)(th|st|nd|rd)?/i,rw=/\d+/i,ow={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},nw={any:[/^b/i,/^(a|c)/i]},iw={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},sw={any:[/1/i,/2/i,/3/i,/4/i]},aw={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},cw={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},uw={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},fw={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},lw={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},dw={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},uf={ordinalNumber:cf({matchPattern:tw,parsePattern:rw,valueCallback:i(t=>parseInt(t,10),"valueCallback")}),era:Ur({matchPatterns:ow,defaultMatchWidth:"wide",parsePatterns:nw,defaultParseWidth:"any"}),quarter:Ur({matchPatterns:iw,defaultMatchWidth:"wide",parsePatterns:sw,defaultParseWidth:"any",valueCallback:i(t=>t+1,"valueCallback")}),month:Ur({matchPatterns:aw,defaultMatchWidth:"wide",parsePatterns:cw,defaultParseWidth:"any"}),day:Ur({matchPatterns:uw,defaultMatchWidth:"wide",parsePatterns:fw,defaultParseWidth:"any"}),dayPeriod:Ur({matchPatterns:lw,defaultMatchWidth:"any",parsePatterns:dw,defaultParseWidth:"any"})};var Oe={code:"en-US",formatDistance:of,formatLong:nf,formatRelative:sf,localize:af,match:uf,options:{weekStartsOn:0,firstWeekContainsDate:1}},aU=Oe;function yi(t,e){let r=m(t,e?.in);return ne(r,Wr(r))+1}i(yi,"getDayOfYear");var pU=yi;function Yr(t,e){let r=m(t,e?.in),o=+A(r)-+ke(r);return Math.round(o/Qe)+1}i(Yr,"getISOWeek");var vU=Yr;function Ot(t,e){let r=m(t,e?.in),o=r.getFullYear(),n=U(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=x(e?.in||t,0);a.setFullYear(o+1,0,s),a.setHours(0,0,0,0);let c=$(a,e),u=x(e?.in||t,0);u.setFullYear(o,0,s),u.setHours(0,0,0,0);let f=$(u,e);return+r>=+c?o+1:+r>=+f?o:o-1}i(Ot,"getWeekYear");var kU=Ot;function tr(t,e){let r=U(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,n=Ot(t,e),s=x(e?.in||t,0);return s.setFullYear(n,0,o),s.setHours(0,0,0,0),$(s,e)}i(tr,"startOfWeekYear");var FU=tr;function Hr(t,e){let r=m(t,e?.in),o=+$(r,e)-+tr(r,e);return Math.round(o/Qe)+1}i(Hr,"getWeek");var $U=Hr;function M(t,e){let r=t<0?"-":"",o=Math.abs(t).toString().padStart(e,"0");return r+o}i(M,"addLeadingZeros");var Ie={y(t,e){let r=t.getFullYear(),o=r>0?r:1-r;return M(e==="yy"?o%100:o,e.length)},M(t,e){let r=t.getMonth();return e==="M"?String(r+1):M(r+1,2)},d(t,e){return M(t.getDate(),e.length)},a(t,e){let r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];default:return r==="am"?"a.m.":"p.m."}},h(t,e){return M(t.getHours()%12||12,e.length)},H(t,e){return M(t.getHours(),e.length)},m(t,e){return M(t.getMinutes(),e.length)},s(t,e){return M(t.getSeconds(),e.length)},S(t,e){let r=e.length,o=t.getMilliseconds(),n=Math.trunc(o*Math.pow(10,r-3));return M(n,e.length)}};var jr={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ko={G:i(function(t,e,r){let o=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return r.era(o,{width:"abbreviated"});case"GGGGG":return r.era(o,{width:"narrow"});default:return r.era(o,{width:"wide"})}},"G"),y:i(function(t,e,r){if(e==="yo"){let o=t.getFullYear(),n=o>0?o:1-o;return r.ordinalNumber(n,{unit:"year"})}return Ie.y(t,e)},"y"),Y:i(function(t,e,r,o){let n=Ot(t,o),s=n>0?n:1-n;if(e==="YY"){let a=s%100;return M(a,2)}return e==="Yo"?r.ordinalNumber(s,{unit:"year"}):M(s,e.length)},"Y"),R:i(function(t,e){let r=Te(t);return M(r,e.length)},"R"),u:i(function(t,e){let r=t.getFullYear();return M(r,e.length)},"u"),Q:i(function(t,e,r){let o=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(o);case"QQ":return M(o,2);case"Qo":return r.ordinalNumber(o,{unit:"quarter"});case"QQQ":return r.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(o,{width:"narrow",context:"formatting"});default:return r.quarter(o,{width:"wide",context:"formatting"})}},"Q"),q:i(function(t,e,r){let o=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(o);case"qq":return M(o,2);case"qo":return r.ordinalNumber(o,{unit:"quarter"});case"qqq":return r.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(o,{width:"narrow",context:"standalone"});default:return r.quarter(o,{width:"wide",context:"standalone"})}},"q"),M:i(function(t,e,r){let o=t.getMonth();switch(e){case"M":case"MM":return Ie.M(t,e);case"Mo":return r.ordinalNumber(o+1,{unit:"month"});case"MMM":return r.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(o,{width:"narrow",context:"formatting"});default:return r.month(o,{width:"wide",context:"formatting"})}},"M"),L:i(function(t,e,r){let o=t.getMonth();switch(e){case"L":return String(o+1);case"LL":return M(o+1,2);case"Lo":return r.ordinalNumber(o+1,{unit:"month"});case"LLL":return r.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(o,{width:"narrow",context:"standalone"});default:return r.month(o,{width:"wide",context:"standalone"})}},"L"),w:i(function(t,e,r,o){let n=Hr(t,o);return e==="wo"?r.ordinalNumber(n,{unit:"week"}):M(n,e.length)},"w"),I:i(function(t,e,r){let o=Yr(t);return e==="Io"?r.ordinalNumber(o,{unit:"week"}):M(o,e.length)},"I"),d:i(function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):Ie.d(t,e)},"d"),D:i(function(t,e,r){let o=yi(t);return e==="Do"?r.ordinalNumber(o,{unit:"dayOfYear"}):M(o,e.length)},"D"),E:i(function(t,e,r){let o=t.getDay();switch(e){case"E":case"EE":case"EEE":return r.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(o,{width:"short",context:"formatting"});default:return r.day(o,{width:"wide",context:"formatting"})}},"E"),e:i(function(t,e,r,o){let n=t.getDay(),s=(n-o.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return M(s,2);case"eo":return r.ordinalNumber(s,{unit:"day"});case"eee":return r.day(n,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},"e"),c:i(function(t,e,r,o){let n=t.getDay(),s=(n-o.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return M(s,e.length);case"co":return r.ordinalNumber(s,{unit:"day"});case"ccc":return r.day(n,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(n,{width:"narrow",context:"standalone"});case"cccccc":return r.day(n,{width:"short",context:"standalone"});default:return r.day(n,{width:"wide",context:"standalone"})}},"c"),i:i(function(t,e,r){let o=t.getDay(),n=o===0?7:o;switch(e){case"i":return String(n);case"ii":return M(n,e.length);case"io":return r.ordinalNumber(n,{unit:"day"});case"iii":return r.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(o,{width:"short",context:"formatting"});default:return r.day(o,{width:"wide",context:"formatting"})}},"i"),a:i(function(t,e,r){let n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},"a"),b:i(function(t,e,r){let o=t.getHours(),n;switch(o===12?n=jr.noon:o===0?n=jr.midnight:n=o/12>=1?"pm":"am",e){case"b":case"bb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},"b"),B:i(function(t,e,r){let o=t.getHours(),n;switch(o>=17?n=jr.evening:o>=12?n=jr.afternoon:o>=4?n=jr.morning:n=jr.night,e){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},"B"),h:i(function(t,e,r){if(e==="ho"){let o=t.getHours()%12;return o===0&&(o=12),r.ordinalNumber(o,{unit:"hour"})}return Ie.h(t,e)},"h"),H:i(function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):Ie.H(t,e)},"H"),K:i(function(t,e,r){let o=t.getHours()%12;return e==="Ko"?r.ordinalNumber(o,{unit:"hour"}):M(o,e.length)},"K"),k:i(function(t,e,r){let o=t.getHours();return o===0&&(o=24),e==="ko"?r.ordinalNumber(o,{unit:"hour"}):M(o,e.length)},"k"),m:i(function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):Ie.m(t,e)},"m"),s:i(function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):Ie.s(t,e)},"s"),S:i(function(t,e){return Ie.S(t,e)},"S"),X:i(function(t,e,r){let o=t.getTimezoneOffset();if(o===0)return"Z";switch(e){case"X":return lf(o);case"XXXX":case"XX":return rr(o);default:return rr(o,":")}},"X"),x:i(function(t,e,r){let o=t.getTimezoneOffset();switch(e){case"x":return lf(o);case"xxxx":case"xx":return rr(o);default:return rr(o,":")}},"x"),O:i(function(t,e,r){let o=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+ff(o,":");default:return"GMT"+rr(o,":")}},"O"),z:i(function(t,e,r){let o=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+ff(o,":");default:return"GMT"+rr(o,":")}},"z"),t:i(function(t,e,r){let o=Math.trunc(+t/1e3);return M(o,e.length)},"t"),T:i(function(t,e,r){return M(+t,e.length)},"T")};function ff(t,e=""){let r=t>0?"-":"+",o=Math.abs(t),n=Math.trunc(o/60),s=o%60;return s===0?r+String(n):r+String(n)+e+M(s,2)}i(ff,"formatTimezoneShort");function lf(t,e){return t%60===0?(t>0?"-":"+")+M(Math.abs(t)/60,2):rr(t,e)}i(lf,"formatTimezoneWithOptionalMinutes");function rr(t,e=""){let r=t>0?"-":"+",o=Math.abs(t),n=M(Math.trunc(o/60),2),s=M(o%60,2);return r+n+e+s}i(rr,"formatTimezone");var df=i((t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},"dateLongFormatter"),mf=i((t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},"timeLongFormatter"),mw=i((t,e)=>{let r=t.match(/(P+)(p+)?/)||[],o=r[1],n=r[2];if(!n)return df(t,e);let s;switch(o){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",df(o,e)).replace("{{time}}",mf(n,e))},"dateTimeLongFormatter"),Et={p:mf,P:mw};var pw=/^D+$/,hw=/^Y+$/,yw=["D","DD","YY","YYYY"];function xi(t){return pw.test(t)}i(xi,"isProtectedDayOfYearToken");function wi(t){return hw.test(t)}i(wi,"isProtectedWeekYearToken");function Io(t,e,r){let o=xw(t,e,r);if(console.warn(o),yw.includes(t))throw new RangeError(o)}i(Io,"warnOrThrowProtectedError");function xw(t,e,r){let o=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${o} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}i(xw,"message");var ww=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,gw=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,bw=/^'([^]*?)'?$/,vw=/''/g,Tw=/[a-zA-Z]/;function Po(t,e,r){let o=U(),n=r?.locale??o.locale??Oe,s=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,a=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,c=m(t,r?.in);if(!ae(c))throw new RangeError("Invalid time value");let u=e.match(gw).map(l=>{let d=l[0];if(d==="p"||d==="P"){let p=Et[d];return p(l,n.formatLong)}return l}).join("").match(ww).map(l=>{if(l==="''")return{isToken:!1,value:"'"};let d=l[0];if(d==="'")return{isToken:!1,value:Dw(l)};if(ko[d])return{isToken:!0,value:l};if(d.match(Tw))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:l}});n.localize.preprocessor&&(u=n.localize.preprocessor(c,u));let f={firstWeekContainsDate:s,weekStartsOn:a,locale:n};return u.map(l=>{if(!l.isToken)return l.value;let d=l.value;(!r?.useAdditionalWeekYearTokens&&wi(d)||!r?.useAdditionalDayOfYearTokens&&xi(d))&&Io(d,e,String(t));let p=ko[d[0]];return p(c,d,n.localize,f)}).join("")}i(Po,"format");function Dw(t){let e=t.match(bw);return e?e[1].replace(vw,"'"):t}i(Dw,"cleanEscapedString");var hY=Po;function gi(t,e,r){let o=U(),n=r?.locale??o.locale??Oe,s=2520,a=de(t,e);if(isNaN(a))throw new RangeError("Invalid time value");let c=Object.assign({},r,{addSuffix:r?.addSuffix,comparison:a}),[u,f]=O(r?.in,...a>0?[e,t]:[t,e]),l=et(f,u),d=(J(f)-J(u))/1e3,p=Math.round((l-d)/60),h;if(p<2)return r?.includeSeconds?l<5?n.formatDistance("lessThanXSeconds",5,c):l<10?n.formatDistance("lessThanXSeconds",10,c):l<20?n.formatDistance("lessThanXSeconds",20,c):l<40?n.formatDistance("halfAMinute",0,c):l<60?n.formatDistance("lessThanXMinutes",1,c):n.formatDistance("xMinutes",1,c):p===0?n.formatDistance("lessThanXMinutes",1,c):n.formatDistance("xMinutes",p,c);if(p<45)return n.formatDistance("xMinutes",p,c);if(p<90)return n.formatDistance("aboutXHours",1,c);if(p<Or){let y=Math.round(p/60);return n.formatDistance("aboutXHours",y,c)}else{if(p<s)return n.formatDistance("xDays",1,c);if(p<gt){let y=Math.round(p/Or);return n.formatDistance("xDays",y,c)}else if(p<gt*2)return h=Math.round(p/gt),n.formatDistance("aboutXMonths",h,c)}if(h=St(f,u),h<12){let y=Math.round(p/gt);return n.formatDistance("xMonths",y,c)}else{let y=h%12,w=Math.trunc(h/12);return y<3?n.formatDistance("aboutXYears",w,c):y<9?n.formatDistance("overXYears",w,c):n.formatDistance("almostXYears",w+1,c)}}i(gi,"formatDistance");var OY=gi;function bi(t,e,r){let o=U(),n=r?.locale??o.locale??Oe,s=de(t,e);if(isNaN(s))throw new RangeError("Invalid time value");let a=Object.assign({},r,{addSuffix:r?.addSuffix,comparison:s}),[c,u]=O(r?.in,...s>0?[e,t]:[t,e]),f=me(r?.roundingMethod??"round"),l=u.getTime()-c.getTime(),d=l/le,p=J(u)-J(c),h=(l-p)/le,y=r?.unit,w;if(y?w=y:d<1?w="second":d<60?w="minute":d<Or?w="hour":h<gt?w="day":h<za?w="month":w="year",w==="second"){let g=f(l/1e3);return n.formatDistance("xSeconds",g,a)}else if(w==="minute"){let g=f(d);return n.formatDistance("xMinutes",g,a)}else if(w==="hour"){let g=f(d/60);return n.formatDistance("xHours",g,a)}else if(w==="day"){let g=f(h/Or);return n.formatDistance("xDays",g,a)}else if(w==="month"){let g=f(h/gt);return g===12&&y!=="month"?n.formatDistance("xYears",1,a):n.formatDistance("xMonths",g,a)}else{let g=f(h/za);return n.formatDistance("xYears",g,a)}}i(bi,"formatDistanceStrict");var WY=bi;function pf(t,e){return gi(t,N(t),e)}i(pf,"formatDistanceToNow");var jY=pf;function hf(t,e){return bi(t,N(t),e)}i(hf,"formatDistanceToNowStrict");var VY=hf;var Sw=["years","months","weeks","days","hours","minutes","seconds"];function yf(t,e){let r=U(),o=e?.locale??r.locale??Oe,n=e?.format??Sw,s=e?.zero??!1,a=e?.delimiter??" ";return o.formatDistance?n.reduce((u,f)=>{let l=`x${f.replace(/(^.)/,p=>p.toUpperCase())}`,d=t[f];return d!==void 0&&(s||t[f])?u.concat(o.formatDistance(l,d)):u},[]).join(a):""}i(yf,"formatDuration");var XY=yf;function xf(t,e){let r=m(t,e?.in);if(isNaN(+r))throw new RangeError("Invalid time value");let o=e?.format??"extended",n=e?.representation??"complete",s="",a="",c=o==="extended"?"-":"",u=o==="extended"?":":"";if(n!=="time"){let f=M(r.getDate(),2),l=M(r.getMonth()+1,2);s=`${M(r.getFullYear(),4)}${c}${l}${c}${f}`}if(n!=="date"){let f=r.getTimezoneOffset();if(f!==0){let w=Math.abs(f),g=M(Math.trunc(w/60),2),v=M(w%60,2);a=`${f<0?"+":"-"}${g}:${v}`}else a="Z";let l=M(r.getHours(),2),d=M(r.getMinutes(),2),p=M(r.getSeconds(),2),h=s===""?"":"T",y=[l,d,p].join(u);s=`${s}${h}${y}${a}`}return s}i(xf,"formatISO");var rH=xf;function wf(t,e){let r=m(t,e?.in);if(!ae(r))throw new RangeError("Invalid time value");let o=e?.format??"extended",n=e?.representation??"complete",s="",a=o==="extended"?"-":"",c=o==="extended"?":":"";if(n!=="time"){let u=M(r.getDate(),2),f=M(r.getMonth()+1,2);s=`${M(r.getFullYear(),4)}${a}${f}${a}${u}`}if(n!=="date"){let u=M(r.getHours(),2),f=M(r.getMinutes(),2),l=M(r.getSeconds(),2);s=`${s}${s===""?"":" "}${u}${c}${f}${c}${l}`}return s}i(wf,"formatISO9075");var cH=wf;function gf(t){let{years:e=0,months:r=0,days:o=0,hours:n=0,minutes:s=0,seconds:a=0}=t;return`P${e}Y${r}M${o}DT${n}H${s}M${a}S`}i(gf,"formatISODuration");var lH=gf;function bf(t,e){let r=m(t,e?.in);if(!ae(r))throw new RangeError("Invalid time value");let o=e?.fractionDigits??0,n=M(r.getDate(),2),s=M(r.getMonth()+1,2),a=r.getFullYear(),c=M(r.getHours(),2),u=M(r.getMinutes(),2),f=M(r.getSeconds(),2),l="";if(o>0){let h=r.getMilliseconds(),y=Math.trunc(h*Math.pow(10,o-3));l="."+M(y,o)}let d="",p=r.getTimezoneOffset();if(p!==0){let h=Math.abs(p),y=M(Math.trunc(h/60),2),w=M(h%60,2);d=`${p<0?"+":"-"}${y}:${w}`}else d="Z";return`${a}-${s}-${n}T${c}:${u}:${f}${l}${d}`}i(bf,"formatRFC3339");var xH=bf;var Mw=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Ow=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function vf(t){let e=m(t);if(!ae(e))throw new RangeError("Invalid time value");let r=Mw[e.getUTCDay()],o=M(e.getUTCDate(),2),n=Ow[e.getUTCMonth()],s=e.getUTCFullYear(),a=M(e.getUTCHours(),2),c=M(e.getUTCMinutes(),2),u=M(e.getUTCSeconds(),2);return`${r}, ${o} ${n} ${s} ${a}:${c}:${u} GMT`}i(vf,"formatRFC7231");var DH=vf;function Tf(t,e,r){let[o,n]=O(r?.in,t,e),s=U(),a=r?.locale??s.locale??Oe,c=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,u=ne(o,n);if(isNaN(u))throw new RangeError("Invalid time value");let f;u<-6?f="other":u<-1?f="lastWeek":u<0?f="yesterday":u<1?f="today":u<2?f="tomorrow":u<7?f="nextWeek":f="other";let l=a.formatRelative(f,o,n,{locale:a,weekStartsOn:c});return Po(o,l,{locale:a,weekStartsOn:c})}i(Tf,"formatRelative");var CH=Tf;function Df(t,e){return m(t*1e3,e?.in)}i(Df,"fromUnixTime");var FH=Df;function vi(t,e){return m(t,e?.in).getDate()}i(vi,"getDate");var YH=vi;function kt(t,e){return m(t,e?.in).getDay()}i(kt,"getDay");var qH=kt;function Ti(t,e){let r=m(t,e?.in),o=r.getFullYear(),n=r.getMonth(),s=x(r,0);return s.setFullYear(o,n+1,0),s.setHours(0,0,0,0),s.getDate()}i(Ti,"getDaysInMonth");var JH=Ti;function Di(t,e){let o=m(t,e?.in).getFullYear();return o%400===0||o%4===0&&o%100!==0}i(Di,"isLeapYear");var ZH=Di;function Sf(t,e){let r=m(t,e?.in);return Number.isNaN(+r)?NaN:Di(r)?366:365}i(Sf,"getDaysInYear");var oj=Sf;function Mf(t,e){let o=m(t,e?.in).getFullYear();return Math.floor(o/10)*10}i(Mf,"getDecade");var aj=Mf;function Si(){return Object.assign({},U())}i(Si,"getDefaultOptions");var lj=Si;function Of(t,e){return m(t,e?.in).getHours()}i(Of,"getHours");var hj=Of;function Mi(t,e){let r=m(t,e?.in).getDay();return r===0?7:r}i(Mi,"getISODay");var gj=Mi;function Ef(t,e){let r=ke(t,e),n=+ke(Tt(r,60))-+r;return Math.round(n/Qe)}i(Ef,"getISOWeeksInYear");var Mj=Ef;function kf(t){return m(t).getMilliseconds()}i(kf,"getMilliseconds");var Ij=kf;function If(t,e){return m(t,e?.in).getMinutes()}i(If,"getMinutes");var Rj=If;function Pf(t,e){return m(t,e?.in).getMonth()}i(Pf,"getMonth");var Lj=Pf;function Cf(t,e){let[r,o]=[+m(t.start),+m(t.end)].sort((d,p)=>d-p),[n,s]=[+m(e.start),+m(e.end)].sort((d,p)=>d-p);if(!(r<s&&n<o))return 0;let c=n<r?r:n,u=c-J(c),f=s>o?o:s,l=f-J(f);return Math.ceil((l-u)/zn)}i(Cf,"getOverlappingDaysInIntervals");var qj=Cf;function _f(t){return m(t).getSeconds()}i(_f,"getSeconds");var Gj=_f;function Rf(t){return+m(t)}i(Rf,"getTime");var Xj=Rf;function Nf(t){return Math.trunc(+m(t)/1e3)}i(Nf,"getUnixTime");var t$=Nf;function Ff(t,e){let r=U(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,n=vi(m(t,e?.in));if(isNaN(n))return NaN;let s=kt(Mt(t,e)),a=o-s;a<=0&&(a+=7);let c=n-a;return Math.ceil(c/7)+1}i(Ff,"getWeekOfMonth");var u$=Ff;function Oi(t,e){let r=m(t,e?.in),o=r.getMonth();return r.setFullYear(r.getFullYear(),o+1,0),r.setHours(0,0,0,0),m(r,e?.in)}i(Oi,"lastDayOfMonth");var m$=Oi;function Wf(t,e){let r=m(t,e?.in);return Zt(Oi(r,e),Mt(r,e),e)+1}i(Wf,"getWeeksInMonth");var b$=Wf;function Lf(t,e){return m(t,e?.in).getFullYear()}i(Lf,"getYear");var S$=Lf;function Uf(t){return Math.trunc(t*Ee)}i(Uf,"hoursToMilliseconds");var k$=Uf;function Yf(t){return Math.trunc(t*Vn)}i(Yf,"hoursToMinutes");var _$=Yf;function Hf(t){return Math.trunc(t*Kt)}i(Hf,"hoursToSeconds");var W$=Hf;function jf(t,e,r){let[o,n]=O(r?.in,t,e);if(isNaN(+o))throw new TypeError("Start date is invalid");if(isNaN(+n))throw new TypeError("End date is invalid");if(r?.assertPositive&&+o>+n)throw new TypeError("End date must be after start date");return{start:o,end:n}}i(jf,"interval");var H$=jf;function $f(t,e){let{start:r,end:o}=ie(e?.in,t),n={},s=li(o,r);s&&(n.years=s);let a=bt(r,{years:n.years}),c=St(o,a);c&&(n.months=c);let u=bt(a,{months:n.months}),f=Cr(o,u);f&&(n.days=f);let l=bt(u,{days:n.days}),d=At(o,l);d&&(n.hours=d);let p=bt(l,{hours:n.hours}),h=er(o,p);h&&(n.minutes=h);let y=bt(p,{minutes:n.minutes}),w=et(o,y);return w&&(n.seconds=w),n}i($f,"intervalToDuration");var X$=$f;function qf(t,e,r){let o;return Ew(e)?o=e:r=e,new Intl.DateTimeFormat(r?.locale,o).format(m(t))}i(qf,"intlFormat");function Ew(t){return t!==void 0&&!("locale"in t)}i(Ew,"isFormatOptions");var tq=qf;function Bf(t,e,r){let o=0,n,[s,a]=O(r?.in,t,e);if(r?.unit)n=r?.unit,n==="second"?o=et(s,a):n==="minute"?o=er(s,a):n==="hour"?o=At(s,a):n==="day"?o=ne(s,a):n==="week"?o=Zt(s,a):n==="month"?o=Xt(s,a):n==="quarter"?o=Pr(s,a):n==="year"&&(o=Dt(s,a));else{let u=et(s,a);Math.abs(u)<Er?(o=et(s,a),n="second"):Math.abs(u)<Kt?(o=er(s,a),n="minute"):Math.abs(u)<qn&&Math.abs(ne(s,a))<1?(o=At(s,a),n="hour"):Math.abs(u)<Su&&(o=ne(s,a))&&Math.abs(o)<7?n="day":Math.abs(u)<Ga?(o=Zt(s,a),n="week"):Math.abs(u)<Mu?(o=Xt(s,a),n="month"):Math.abs(u)<Va?Pr(s,a)<4?(o=Pr(s,a),n="quarter"):(o=Dt(s,a),n="year"):(o=Dt(s,a),n="year")}return new Intl.RelativeTimeFormat(r?.locale,{numeric:"auto",...r}).format(o,n)}i(Bf,"intlFormatDistance");var pq=Bf;function zf(t,e){return+m(t)>+m(e)}i(zf,"isAfter");var wq=zf;function Vf(t,e){return+m(t)<+m(e)}i(Vf,"isBefore");var Tq=Vf;function Gf(t,e){return+m(t)==+m(e)}i(Gf,"isEqual");var Oq=Gf;function Jf(t,e,r){let o=new Date(t,e,r);return o.getFullYear()===t&&o.getMonth()===e&&o.getDate()===r}i(Jf,"isExists");var Iq=Jf;function Qf(t,e){return m(t,e?.in).getDate()===1}i(Qf,"isFirstDayOfMonth");var Rq=Qf;function Kf(t,e){return m(t,e?.in).getDay()===5}i(Kf,"isFriday");var Lq=Kf;function Xf(t){return+m(t)>Date.now()}i(Xf,"isFuture");var jq=Xf;function Ei(t,e){let r=kw(e)?new e(0):x(e,0);return r.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),r.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),r}i(Ei,"transpose");function kw(t){return typeof t=="function"&&t.prototype?.constructor===t}i(kw,"isConstructor");var zq=Ei;var Iw=10,ki=class{static{i(this,"Setter")}subPriority=0;validate(e,r){return!0}},Ii=class extends ki{static{i(this,"ValueSetter")}constructor(e,r,o,n,s){super(),this.value=e,this.validateValue=r,this.setValue=o,this.priority=n,s&&(this.subPriority=s)}validate(e,r){return this.validateValue(e,this.value,r)}set(e,r,o){return this.setValue(e,r,this.value,o)}},Pi=class extends ki{static{i(this,"DateTimezoneSetter")}priority=Iw;subPriority=-1;constructor(e,r){super(),this.context=e||(o=>x(r,o))}set(e,r){return r.timestampIsSet?e:x(e,Ei(e,this.context))}};var S=class{static{i(this,"Parser")}run(e,r,o,n){let s=this.parse(e,r,o,n);return s?{setter:new Ii(s.value,this.validate,this.set,this.priority,this.subPriority),rest:s.rest}:null}validate(e,r,o){return!0}};var Ci=class extends S{static{i(this,"EraParser")}priority=140;parse(e,r,o){switch(r){case"G":case"GG":case"GGG":return o.era(e,{width:"abbreviated"})||o.era(e,{width:"narrow"});case"GGGGG":return o.era(e,{width:"narrow"});default:return o.era(e,{width:"wide"})||o.era(e,{width:"abbreviated"})||o.era(e,{width:"narrow"})}}set(e,r,o){return r.era=o,e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]};var L={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},Le={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function H(t,e){return t&&{value:e(t.value),rest:t.rest}}i(H,"mapValue");function W(t,e){let r=e.match(t);return r?{value:parseInt(r[0],10),rest:e.slice(r[0].length)}:null}i(W,"parseNumericPattern");function Ue(t,e){let r=e.match(t);if(!r)return null;if(r[0]==="Z")return{value:0,rest:e.slice(1)};let o=r[1]==="+"?1:-1,n=r[2]?parseInt(r[2],10):0,s=r[3]?parseInt(r[3],10):0,a=r[5]?parseInt(r[5],10):0;return{value:o*(n*Ee+s*le+a*Mr),rest:e.slice(r[0].length)}}i(Ue,"parseTimezonePattern");function _i(t){return W(L.anyDigitsSigned,t)}i(_i,"parseAnyDigitsSigned");function P(t,e){switch(t){case 1:return W(L.singleDigit,e);case 2:return W(L.twoDigits,e);case 3:return W(L.threeDigits,e);case 4:return W(L.fourDigits,e);default:return W(new RegExp("^\\d{1,"+t+"}"),e)}}i(P,"parseNDigits");function $r(t,e){switch(t){case 1:return W(L.singleDigitSigned,e);case 2:return W(L.twoDigitsSigned,e);case 3:return W(L.threeDigitsSigned,e);case 4:return W(L.fourDigitsSigned,e);default:return W(new RegExp("^-?\\d{1,"+t+"}"),e)}}i($r,"parseNDigitsSigned");function qr(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}i(qr,"dayPeriodEnumToHours");function Ri(t,e){let r=e>0,o=r?e:1-e,n;if(o<=50)n=t||100;else{let s=o+50,a=Math.trunc(s/100)*100,c=t>=s%100;n=t+a-(c?100:0)}return r?n:1-n}i(Ri,"normalizeTwoDigitYear");function Ni(t){return t%400===0||t%4===0&&t%100!==0}i(Ni,"isLeapYearIndex");var Fi=class extends S{static{i(this,"YearParser")}priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,r,o){let n=i(s=>({year:s,isTwoDigitYear:r==="yy"}),"valueCallback");switch(r){case"y":return H(P(4,e),n);case"yo":return H(o.ordinalNumber(e,{unit:"year"}),n);default:return H(P(r.length,e),n)}}validate(e,r){return r.isTwoDigitYear||r.year>0}set(e,r,o){let n=e.getFullYear();if(o.isTwoDigitYear){let a=Ri(o.year,n);return e.setFullYear(a,0,1),e.setHours(0,0,0,0),e}let s=!("era"in r)||r.era===1?o.year:1-o.year;return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}};var Wi=class extends S{static{i(this,"LocalWeekYearParser")}priority=130;parse(e,r,o){let n=i(s=>({year:s,isTwoDigitYear:r==="YY"}),"valueCallback");switch(r){case"Y":return H(P(4,e),n);case"Yo":return H(o.ordinalNumber(e,{unit:"year"}),n);default:return H(P(r.length,e),n)}}validate(e,r){return r.isTwoDigitYear||r.year>0}set(e,r,o,n){let s=Ot(e,n);if(o.isTwoDigitYear){let c=Ri(o.year,s);return e.setFullYear(c,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),$(e,n)}let a=!("era"in r)||r.era===1?o.year:1-o.year;return e.setFullYear(a,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),$(e,n)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]};var Li=class extends S{static{i(this,"ISOWeekYearParser")}priority=130;parse(e,r){return r==="R"?$r(4,e):$r(r.length,e)}set(e,r,o){let n=x(e,0);return n.setFullYear(o,0,4),n.setHours(0,0,0,0),A(n)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]};var Ui=class extends S{static{i(this,"ExtendedYearParser")}priority=130;parse(e,r){return r==="u"?$r(4,e):$r(r.length,e)}set(e,r,o){return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]};var Yi=class extends S{static{i(this,"QuarterParser")}priority=120;parse(e,r,o){switch(r){case"Q":case"QQ":return P(r.length,e);case"Qo":return o.ordinalNumber(e,{unit:"quarter"});case"QQQ":return o.quarter(e,{width:"abbreviated",context:"formatting"})||o.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return o.quarter(e,{width:"narrow",context:"formatting"});default:return o.quarter(e,{width:"wide",context:"formatting"})||o.quarter(e,{width:"abbreviated",context:"formatting"})||o.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,r){return r>=1&&r<=4}set(e,r,o){return e.setMonth((o-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]};var Hi=class extends S{static{i(this,"StandAloneQuarterParser")}priority=120;parse(e,r,o){switch(r){case"q":case"qq":return P(r.length,e);case"qo":return o.ordinalNumber(e,{unit:"quarter"});case"qqq":return o.quarter(e,{width:"abbreviated",context:"standalone"})||o.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return o.quarter(e,{width:"narrow",context:"standalone"});default:return o.quarter(e,{width:"wide",context:"standalone"})||o.quarter(e,{width:"abbreviated",context:"standalone"})||o.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,r){return r>=1&&r<=4}set(e,r,o){return e.setMonth((o-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]};var ji=class extends S{static{i(this,"MonthParser")}incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,r,o){let n=i(s=>s-1,"valueCallback");switch(r){case"M":return H(W(L.month,e),n);case"MM":return H(P(2,e),n);case"Mo":return H(o.ordinalNumber(e,{unit:"month"}),n);case"MMM":return o.month(e,{width:"abbreviated",context:"formatting"})||o.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return o.month(e,{width:"narrow",context:"formatting"});default:return o.month(e,{width:"wide",context:"formatting"})||o.month(e,{width:"abbreviated",context:"formatting"})||o.month(e,{width:"narrow",context:"formatting"})}}validate(e,r){return r>=0&&r<=11}set(e,r,o){return e.setMonth(o,1),e.setHours(0,0,0,0),e}};var $i=class extends S{static{i(this,"StandAloneMonthParser")}priority=110;parse(e,r,o){let n=i(s=>s-1,"valueCallback");switch(r){case"L":return H(W(L.month,e),n);case"LL":return H(P(2,e),n);case"Lo":return H(o.ordinalNumber(e,{unit:"month"}),n);case"LLL":return o.month(e,{width:"abbreviated",context:"standalone"})||o.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return o.month(e,{width:"narrow",context:"standalone"});default:return o.month(e,{width:"wide",context:"standalone"})||o.month(e,{width:"abbreviated",context:"standalone"})||o.month(e,{width:"narrow",context:"standalone"})}}validate(e,r){return r>=0&&r<=11}set(e,r,o){return e.setMonth(o,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]};function qi(t,e,r){let o=m(t,r?.in),n=Hr(o,r)-e;return o.setDate(o.getDate()-n*7),m(o,r?.in)}i(qi,"setWeek");var Q8=qi;var Bi=class extends S{static{i(this,"LocalWeekParser")}priority=100;parse(e,r,o){switch(r){case"w":return W(L.week,e);case"wo":return o.ordinalNumber(e,{unit:"week"});default:return P(r.length,e)}}validate(e,r){return r>=1&&r<=53}set(e,r,o,n){return $(qi(e,o,n),n)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]};function zi(t,e,r){let o=m(t,r?.in),n=Yr(o,r)-e;return o.setDate(o.getDate()-n*7),o}i(zi,"setISOWeek");var a5=zi;var Vi=class extends S{static{i(this,"ISOWeekParser")}priority=100;parse(e,r,o){switch(r){case"I":return W(L.week,e);case"Io":return o.ordinalNumber(e,{unit:"week"});default:return P(r.length,e)}}validate(e,r){return r>=1&&r<=53}set(e,r,o){return A(zi(e,o))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]};var Pw=[31,28,31,30,31,30,31,31,30,31,30,31],Cw=[31,29,31,30,31,30,31,31,30,31,30,31],Gi=class extends S{static{i(this,"DateParser")}priority=90;subPriority=1;parse(e,r,o){switch(r){case"d":return W(L.date,e);case"do":return o.ordinalNumber(e,{unit:"date"});default:return P(r.length,e)}}validate(e,r){let o=e.getFullYear(),n=Ni(o),s=e.getMonth();return n?r>=1&&r<=Cw[s]:r>=1&&r<=Pw[s]}set(e,r,o){return e.setDate(o),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]};var Ji=class extends S{static{i(this,"DayOfYearParser")}priority=90;subpriority=1;parse(e,r,o){switch(r){case"D":case"DD":return W(L.dayOfYear,e);case"Do":return o.ordinalNumber(e,{unit:"date"});default:return P(r.length,e)}}validate(e,r){let o=e.getFullYear();return Ni(o)?r>=1&&r<=366:r>=1&&r<=365}set(e,r,o){return e.setMonth(0,o),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]};function It(t,e,r){let o=U(),n=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,s=m(t,r?.in),a=s.getDay(),u=(e%7+7)%7,f=7-n,l=e<0||e>6?e-(a+f)%7:(u+f)%7-(a+f)%7;return re(s,l,r)}i(It,"setDay");var P5=It;var Qi=class extends S{static{i(this,"DayParser")}priority=90;parse(e,r,o){switch(r){case"E":case"EE":case"EEE":return o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return o.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});default:return o.day(e,{width:"wide",context:"formatting"})||o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"})}}validate(e,r){return r>=0&&r<=6}set(e,r,o,n){return e=It(e,o,n),e.setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]};var Ki=class extends S{static{i(this,"LocalDayParser")}priority=90;parse(e,r,o,n){let s=i(a=>{let c=Math.floor((a-1)/7)*7;return(a+n.weekStartsOn+6)%7+c},"valueCallback");switch(r){case"e":case"ee":return H(P(r.length,e),s);case"eo":return H(o.ordinalNumber(e,{unit:"day"}),s);case"eee":return o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});case"eeeee":return o.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});default:return o.day(e,{width:"wide",context:"formatting"})||o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"})}}validate(e,r){return r>=0&&r<=6}set(e,r,o,n){return e=It(e,o,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]};var Xi=class extends S{static{i(this,"StandAloneLocalDayParser")}priority=90;parse(e,r,o,n){let s=i(a=>{let c=Math.floor((a-1)/7)*7;return(a+n.weekStartsOn+6)%7+c},"valueCallback");switch(r){case"c":case"cc":return H(P(r.length,e),s);case"co":return H(o.ordinalNumber(e,{unit:"day"}),s);case"ccc":return o.day(e,{width:"abbreviated",context:"standalone"})||o.day(e,{width:"short",context:"standalone"})||o.day(e,{width:"narrow",context:"standalone"});case"ccccc":return o.day(e,{width:"narrow",context:"standalone"});case"cccccc":return o.day(e,{width:"short",context:"standalone"})||o.day(e,{width:"narrow",context:"standalone"});default:return o.day(e,{width:"wide",context:"standalone"})||o.day(e,{width:"abbreviated",context:"standalone"})||o.day(e,{width:"short",context:"standalone"})||o.day(e,{width:"narrow",context:"standalone"})}}validate(e,r){return r>=0&&r<=6}set(e,r,o,n){return e=It(e,o,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]};function Zi(t,e,r){let o=m(t,r?.in),n=Mi(o,r),s=e-n;return re(o,s,r)}i(Zi,"setISODay");var K5=Zi;var Ai=class extends S{static{i(this,"ISODayParser")}priority=90;parse(e,r,o){let n=i(s=>s===0?7:s,"valueCallback");switch(r){case"i":case"ii":return P(r.length,e);case"io":return o.ordinalNumber(e,{unit:"day"});case"iii":return H(o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"}),n);case"iiiii":return H(o.day(e,{width:"narrow",context:"formatting"}),n);case"iiiiii":return H(o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"}),n);default:return H(o.day(e,{width:"wide",context:"formatting"})||o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"}),n)}}validate(e,r){return r>=1&&r<=7}set(e,r,o){return e=Zi(e,o),e.setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]};var es=class extends S{static{i(this,"AMPMParser")}priority=80;parse(e,r,o){switch(r){case"a":case"aa":case"aaa":return o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return o.dayPeriod(e,{width:"narrow",context:"formatting"});default:return o.dayPeriod(e,{width:"wide",context:"formatting"})||o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,r,o){return e.setHours(qr(o),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]};var ts=class extends S{static{i(this,"AMPMMidnightParser")}priority=80;parse(e,r,o){switch(r){case"b":case"bb":case"bbb":return o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return o.dayPeriod(e,{width:"narrow",context:"formatting"});default:return o.dayPeriod(e,{width:"wide",context:"formatting"})||o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,r,o){return e.setHours(qr(o),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]};var rs=class extends S{static{i(this,"DayPeriodParser")}priority=80;parse(e,r,o){switch(r){case"B":case"BB":case"BBB":return o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return o.dayPeriod(e,{width:"narrow",context:"formatting"});default:return o.dayPeriod(e,{width:"wide",context:"formatting"})||o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,r,o){return e.setHours(qr(o),0,0,0),e}incompatibleTokens=["a","b","t","T"]};var os=class extends S{static{i(this,"Hour1to12Parser")}priority=70;parse(e,r,o){switch(r){case"h":return W(L.hour12h,e);case"ho":return o.ordinalNumber(e,{unit:"hour"});default:return P(r.length,e)}}validate(e,r){return r>=1&&r<=12}set(e,r,o){let n=e.getHours()>=12;return n&&o<12?e.setHours(o+12,0,0,0):!n&&o===12?e.setHours(0,0,0,0):e.setHours(o,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]};var ns=class extends S{static{i(this,"Hour0to23Parser")}priority=70;parse(e,r,o){switch(r){case"H":return W(L.hour23h,e);case"Ho":return o.ordinalNumber(e,{unit:"hour"});default:return P(r.length,e)}}validate(e,r){return r>=0&&r<=23}set(e,r,o){return e.setHours(o,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]};var is=class extends S{static{i(this,"Hour0To11Parser")}priority=70;parse(e,r,o){switch(r){case"K":return W(L.hour11h,e);case"Ko":return o.ordinalNumber(e,{unit:"hour"});default:return P(r.length,e)}}validate(e,r){return r>=0&&r<=11}set(e,r,o){return e.getHours()>=12&&o<12?e.setHours(o+12,0,0,0):e.setHours(o,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]};var ss=class extends S{static{i(this,"Hour1To24Parser")}priority=70;parse(e,r,o){switch(r){case"k":return W(L.hour24h,e);case"ko":return o.ordinalNumber(e,{unit:"hour"});default:return P(r.length,e)}}validate(e,r){return r>=1&&r<=24}set(e,r,o){let n=o<=24?o%24:o;return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]};var as=class extends S{static{i(this,"MinuteParser")}priority=60;parse(e,r,o){switch(r){case"m":return W(L.minute,e);case"mo":return o.ordinalNumber(e,{unit:"minute"});default:return P(r.length,e)}}validate(e,r){return r>=0&&r<=59}set(e,r,o){return e.setMinutes(o,0,0),e}incompatibleTokens=["t","T"]};var cs=class extends S{static{i(this,"SecondParser")}priority=50;parse(e,r,o){switch(r){case"s":return W(L.second,e);case"so":return o.ordinalNumber(e,{unit:"second"});default:return P(r.length,e)}}validate(e,r){return r>=0&&r<=59}set(e,r,o){return e.setSeconds(o,0),e}incompatibleTokens=["t","T"]};var us=class extends S{static{i(this,"FractionOfSecondParser")}priority=30;parse(e,r){let o=i(n=>Math.trunc(n*Math.pow(10,-r.length+3)),"valueCallback");return H(P(r.length,e),o)}set(e,r,o){return e.setMilliseconds(o),e}incompatibleTokens=["t","T"]};var fs=class extends S{static{i(this,"ISOTimezoneWithZParser")}priority=10;parse(e,r){switch(r){case"X":return Ue(Le.basicOptionalMinutes,e);case"XX":return Ue(Le.basic,e);case"XXXX":return Ue(Le.basicOptionalSeconds,e);case"XXXXX":return Ue(Le.extendedOptionalSeconds,e);default:return Ue(Le.extended,e)}}set(e,r,o){return r.timestampIsSet?e:x(e,e.getTime()-J(e)-o)}incompatibleTokens=["t","T","x"]};var ls=class extends S{static{i(this,"ISOTimezoneParser")}priority=10;parse(e,r){switch(r){case"x":return Ue(Le.basicOptionalMinutes,e);case"xx":return Ue(Le.basic,e);case"xxxx":return Ue(Le.basicOptionalSeconds,e);case"xxxxx":return Ue(Le.extendedOptionalSeconds,e);default:return Ue(Le.extended,e)}}set(e,r,o){return r.timestampIsSet?e:x(e,e.getTime()-J(e)-o)}incompatibleTokens=["t","T","X"]};var ds=class extends S{static{i(this,"TimestampSecondsParser")}priority=40;parse(e){return _i(e)}set(e,r,o){return[x(e,o*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"};var ms=class extends S{static{i(this,"TimestampMillisecondsParser")}priority=20;parse(e){return _i(e)}set(e,r,o){return[x(e,o),{timestampIsSet:!0}]}incompatibleTokens="*"};var ps={G:new Ci,y:new Fi,Y:new Wi,R:new Li,u:new Ui,Q:new Yi,q:new Hi,M:new ji,L:new $i,w:new Bi,I:new Vi,d:new Gi,D:new Ji,E:new Qi,e:new Ki,c:new Xi,i:new Ai,a:new es,b:new ts,B:new rs,h:new os,H:new ns,K:new is,k:new ss,m:new as,s:new cs,S:new us,X:new fs,x:new ls,t:new ds,T:new ms};var _w=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Rw=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Nw=/^'([^]*?)'?$/,Fw=/''/g,Ww=/\S/,Lw=/[a-zA-Z]/;function hs(t,e,r,o){let n=i(()=>x(o?.in||r,NaN),"invalidDate"),s=Si(),a=o?.locale??s.locale??Oe,c=o?.firstWeekContainsDate??o?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,u=o?.weekStartsOn??o?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0;if(!e)return t?n():m(r,o?.in);let f={firstWeekContainsDate:c,weekStartsOn:u,locale:a},l=[new Pi(o?.in,r)],d=e.match(Rw).map(g=>{let v=g[0];if(v in Et){let G=Et[v];return G(g,a.formatLong)}return g}).join("").match(_w),p=[];for(let g of d){!o?.useAdditionalWeekYearTokens&&wi(g)&&Io(g,e,t),!o?.useAdditionalDayOfYearTokens&&xi(g)&&Io(g,e,t);let v=g[0],G=ps[v];if(G){let{incompatibleTokens:ee}=G;if(Array.isArray(ee)){let Ce=p.find(_e=>ee.includes(_e.token)||_e.token===v);if(Ce)throw new RangeError(`The format string mustn't contain \`${Ce.fullToken}\` and \`${g}\` at the same time`)}else if(G.incompatibleTokens==="*"&&p.length>0)throw new RangeError(`The format string mustn't contain \`${g}\` and any other token at the same time`);p.push({token:v,fullToken:g});let Q=G.run(t,g,a.match,f);if(!Q)return n();l.push(Q.setter),t=Q.rest}else{if(v.match(Lw))throw new RangeError("Format string contains an unescaped latin alphabet character `"+v+"`");if(g==="''"?g="'":v==="'"&&(g=Uw(g)),t.indexOf(g)===0)t=t.slice(g.length);else return n()}}if(t.length>0&&Ww.test(t))return n();let h=l.map(g=>g.priority).sort((g,v)=>v-g).filter((g,v,G)=>G.indexOf(g)===v).map(g=>l.filter(v=>v.priority===g).sort((v,G)=>G.subPriority-v.subPriority)).map(g=>g[0]),y=m(r,o?.in);if(isNaN(+y))return n();let w={};for(let g of h){if(!g.validate(y,f))return n();let v=g.set(y,w,f);Array.isArray(v)?(y=v[0],Object.assign(w,v[1])):y=v}return y}i(hs,"parse");function Uw(t){return t.match(Nw)[1].replace(Fw,"'")}i(Uw,"cleanEscapedString");var s9=hs;function Zf(t,e,r){return ae(hs(t,e,new Date,r))}i(Zf,"isMatch");var l9=Zf;function Af(t,e){return m(t,e?.in).getDay()===1}i(Af,"isMonday");var h9=Af;function el(t){return+m(t)<Date.now()}i(el,"isPast");var g9=el;function Co(t,e){let r=m(t,e?.in);return r.setMinutes(0,0,0),r}i(Co,"startOfHour");var D9=Co;function ys(t,e,r){let[o,n]=O(r?.in,t,e);return+Co(o)==+Co(n)}i(ys,"isSameHour");var k9=ys;function Br(t,e,r){let[o,n]=O(r?.in,t,e);return+$(o,r)==+$(n,r)}i(Br,"isSameWeek");var R9=Br;function xs(t,e,r){return Br(t,e,{...r,weekStartsOn:1})}i(xs,"isSameISOWeek");var L9=xs;function tl(t,e,r){let[o,n]=O(r?.in,t,e);return+ke(o)==+ke(n)}i(tl,"isSameISOWeekYear");var $9=tl;function _o(t,e){let r=m(t,e?.in);return r.setSeconds(0,0),r}i(_o,"startOfMinute");var V9=_o;function ws(t,e){return+_o(t)==+_o(e)}i(ws,"isSameMinute");var K9=ws;function gs(t,e,r){let[o,n]=O(r?.in,t,e);return o.getFullYear()===n.getFullYear()&&o.getMonth()===n.getMonth()}i(gs,"isSameMonth");var eV=gs;function bs(t,e,r){let[o,n]=O(r?.in,t,e);return+tt(o)==+tt(n)}i(bs,"isSameQuarter");var iV=bs;function Ro(t,e){let r=m(t,e?.in);return r.setMilliseconds(0),r}i(Ro,"startOfSecond");var uV=Ro;function vs(t,e){return+Ro(t)==+Ro(e)}i(vs,"isSameSecond");var mV=vs;function Ts(t,e,r){let[o,n]=O(r?.in,t,e);return o.getFullYear()===n.getFullYear()}i(Ts,"isSameYear");var xV=Ts;function rl(t,e){return ys(m(t,e?.in),N(e?.in||t))}i(rl,"isThisHour");var DV=rl;function ol(t,e){return xs(x(e?.in||t,t),N(e?.in||t))}i(ol,"isThisISOWeek");var IV=ol;function nl(t){return ws(t,N(t))}i(nl,"isThisMinute");var NV=nl;function il(t,e){return gs(x(e?.in||t,t),N(e?.in||t))}i(il,"isThisMonth");var HV=il;function sl(t,e){return bs(x(e?.in||t,t),N(e?.in||t))}i(sl,"isThisQuarter");var VV=sl;function al(t){return vs(t,N(t))}i(al,"isThisSecond");var XV=al;function cl(t,e){return Br(x(e?.in||t,t),N(e?.in||t),e)}i(cl,"isThisWeek");var o7=cl;function ul(t,e){return Ts(x(e?.in||t,t),N(e?.in||t))}i(ul,"isThisYear");var u7=ul;function fl(t,e){return m(t,e?.in).getDay()===4}i(fl,"isThursday");var m7=fl;function ll(t,e){return Ae(x(e?.in||t,t),N(e?.in||t))}i(ll,"isToday");var g7=ll;function dl(t,e){return Ae(t,re(N(e?.in||t),1),e)}i(dl,"isTomorrow");var M7=dl;function ml(t,e){return m(t,e?.in).getDay()===2}i(ml,"isTuesday");var I7=ml;function pl(t,e){return m(t,e?.in).getDay()===3}i(pl,"isWednesday");var R7=pl;function hl(t,e,r){let o=+m(t,r?.in),[n,s]=[+m(e.start,r?.in),+m(e.end,r?.in)].sort((a,c)=>a-c);return o>=n&&o<=s}i(hl,"isWithinInterval");var L7=hl;function Pt(t,e,r){return re(t,-e,r)}i(Pt,"subDays");var j7=Pt;function yl(t,e){return Ae(x(e?.in||t,t),Pt(N(e?.in||t),1))}i(yl,"isYesterday");var J7=yl;function xl(t,e){let r=m(t,e?.in),o=r.getFullYear(),n=9+Math.floor(o/10)*10;return r.setFullYear(n+1,0,0),r.setHours(0,0,0,0),m(r,e?.in)}i(xl,"lastDayOfDecade");var Z7=xl;function Ds(t,e){let r=U(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,n=m(t,e?.in),s=n.getDay(),a=(s<o?-7:0)+6-(s-o);return n.setHours(0,0,0,0),n.setDate(n.getDate()+a),n}i(Ds,"lastDayOfWeek");var oG=Ds;function wl(t,e){return Ds(t,{...e,weekStartsOn:1})}i(wl,"lastDayOfISOWeek");var aG=wl;function gl(t,e){let r=Te(t,e),o=x(e?.in||t,0);o.setFullYear(r+1,0,4),o.setHours(0,0,0,0);let n=A(o,e);return n.setDate(n.getDate()-1),n}i(gl,"lastDayOfISOWeekYear");var mG=gl;function bl(t,e){let r=m(t,e?.in),o=r.getMonth(),n=o-o%3+3;return r.setMonth(n,0),r.setHours(0,0,0,0),r}i(bl,"lastDayOfQuarter");var xG=bl;function vl(t,e){let r=m(t,e?.in),o=r.getFullYear();return r.setFullYear(o+1,0,0),r.setHours(0,0,0,0),r}i(vl,"lastDayOfYear");var vG=vl;var Yw=/(\w)\1*|''|'(''|[^'])+('|$)|./g,Hw=/^'([^]*?)'?$/,jw=/''/g,$w=/[a-zA-Z]/;function Tl(t,e){let r=m(t);if(!ae(r))throw new RangeError("Invalid time value");let o=e.match(Yw);return o?o.map(s=>{if(s==="''")return"'";let a=s[0];if(a==="'")return qw(s);let c=Ie[a];if(c)return c(r,s);if(a.match($w))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return s}).join(""):""}i(Tl,"lightFormat");function qw(t){let e=t.match(Hw);return e?e[1].replace(jw,"'"):t}i(qw,"cleanEscapedString");var EG=Tl;function Dl({years:t,months:e,weeks:r,days:o,hours:n,minutes:s,seconds:a}){let c=0;t&&(c+=t*365.2425),e&&(c+=e*(365.2425/12)),r&&(c+=r*7),o&&(c+=o);let u=c*24*60*60;return n&&(u+=n*60*60),s&&(u+=s*60),a&&(u+=a),Math.trunc(u*1e3)}i(Dl,"milliseconds");var CG=Dl;function Sl(t){let e=t/Ee;return Math.trunc(e)}i(Sl,"millisecondsToHours");var FG=Sl;function Ml(t){let e=t/le;return Math.trunc(e)}i(Ml,"millisecondsToMinutes");var YG=Ml;function Ol(t){let e=t/Mr;return Math.trunc(e)}i(Ol,"millisecondsToSeconds");var qG=Ol;function El(t){let e=t/Vn;return Math.trunc(e)}i(El,"minutesToHours");var GG=El;function kl(t){return Math.trunc(t*le)}i(kl,"minutesToMilliseconds");var XG=kl;function Il(t){return Math.trunc(t*Er)}i(Il,"minutesToSeconds");var tJ=Il;function Pl(t){let e=t/Gn;return Math.trunc(e)}i(Pl,"monthsToQuarters");var iJ=Pl;function Cl(t){let e=t/Jn;return Math.trunc(e)}i(Cl,"monthsToYears");var uJ=Cl;function pe(t,e,r){let o=e-kt(t,r);return o<=0&&(o+=7),re(t,o,r)}i(pe,"nextDay");var pJ=pe;function _l(t,e){return pe(t,5,e)}i(_l,"nextFriday");var wJ=_l;function Rl(t,e){return pe(t,1,e)}i(Rl,"nextMonday");var TJ=Rl;function Nl(t,e){return pe(t,6,e)}i(Nl,"nextSaturday");var OJ=Nl;function Fl(t,e){return pe(t,0,e)}i(Fl,"nextSunday");var PJ=Fl;function Wl(t,e){return pe(t,4,e)}i(Wl,"nextThursday");var NJ=Wl;function Ll(t,e){return pe(t,2,e)}i(Ll,"nextTuesday");var UJ=Ll;function Ul(t,e){return pe(t,3,e)}i(Ul,"nextWednesday");var $J=Ul;function Hl(t,e){let r=i(()=>x(e?.in,NaN),"invalidDate"),o=e?.additionalDigits??2,n=Gw(t),s;if(n.date){let f=Jw(n.date,o);s=Qw(f.restDateString,f.year)}if(!s||isNaN(+s))return r();let a=+s,c=0,u;if(n.time&&(c=Kw(n.time),isNaN(c)))return r();if(n.timezone){if(u=Xw(n.timezone),isNaN(u))return r()}else{let f=new Date(a+c),l=m(0,e?.in);return l.setFullYear(f.getUTCFullYear(),f.getUTCMonth(),f.getUTCDate()),l.setHours(f.getUTCHours(),f.getUTCMinutes(),f.getUTCSeconds(),f.getUTCMilliseconds()),l}return m(a+c+u,e?.in)}i(Hl,"parseISO");var Ss={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Bw=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,zw=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Vw=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Gw(t){let e={},r=t.split(Ss.dateTimeDelimiter),o;if(r.length>2)return e;if(/:/.test(r[0])?o=r[0]:(e.date=r[0],o=r[1],Ss.timeZoneDelimiter.test(e.date)&&(e.date=t.split(Ss.timeZoneDelimiter)[0],o=t.substr(e.date.length,t.length))),o){let n=Ss.timezone.exec(o);n?(e.time=o.replace(n[1],""),e.timezone=n[1]):e.time=o}return e}i(Gw,"splitDateString");function Jw(t,e){let r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),o=t.match(r);if(!o)return{year:NaN,restDateString:""};let n=o[1]?parseInt(o[1]):null,s=o[2]?parseInt(o[2]):null;return{year:s===null?n:s*100,restDateString:t.slice((o[1]||o[2]).length)}}i(Jw,"parseYear");function Qw(t,e){if(e===null)return new Date(NaN);let r=t.match(Bw);if(!r)return new Date(NaN);let o=!!r[4],n=No(r[1]),s=No(r[2])-1,a=No(r[3]),c=No(r[4]),u=No(r[5])-1;if(o)return r0(e,c,u)?Zw(e,c,u):new Date(NaN);{let f=new Date(0);return!e0(e,s,a)||!t0(e,n)?new Date(NaN):(f.setUTCFullYear(e,s,Math.max(n,a)),f)}}i(Qw,"parseDate");function No(t){return t?parseInt(t):1}i(No,"parseDateUnit");function Kw(t){let e=t.match(zw);if(!e)return NaN;let r=Qa(e[1]),o=Qa(e[2]),n=Qa(e[3]);return o0(r,o,n)?r*Ee+o*le+n*1e3:NaN}i(Kw,"parseTime");function Qa(t){return t&&parseFloat(t.replace(",","."))||0}i(Qa,"parseTimeUnit");function Xw(t){if(t==="Z")return 0;let e=t.match(Vw);if(!e)return 0;let r=e[1]==="+"?-1:1,o=parseInt(e[2]),n=e[3]&&parseInt(e[3])||0;return n0(o,n)?r*(o*Ee+n*le):NaN}i(Xw,"parseTimezone");function Zw(t,e,r){let o=new Date(0);o.setUTCFullYear(t,0,4);let n=o.getUTCDay()||7,s=(e-1)*7+r+1-n;return o.setUTCDate(o.getUTCDate()+s),o}i(Zw,"dayOfISOWeekYear");var Aw=[31,null,31,30,31,30,31,31,30,31,30,31];function Yl(t){return t%400===0||t%4===0&&t%100!==0}i(Yl,"isLeapYearIndex");function e0(t,e,r){return e>=0&&e<=11&&r>=1&&r<=(Aw[e]||(Yl(t)?29:28))}i(e0,"validateDate");function t0(t,e){return e>=1&&e<=(Yl(t)?366:365)}i(t0,"validateDayOfYearDate");function r0(t,e,r){return e>=1&&e<=53&&r>=0&&r<=6}i(r0,"validateWeekDate");function o0(t,e,r){return t===24?e===0&&r===0:r>=0&&r<60&&e>=0&&e<60&&t>=0&&t<25}i(o0,"validateTime");function n0(t,e){return e>=0&&e<=59}i(n0,"validateTimezone");var JJ=Hl;function jl(t,e){let r=t.match(/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/);return r?m(Date.UTC(+r[1],+r[2]-1,+r[3],+r[4]-(+r[9]||0)*(r[8]=="-"?-1:1),+r[5]-(+r[10]||0)*(r[8]=="-"?-1:1),+r[6],+((r[7]||"0")+"00").substring(0,3)),e?.in):m(NaN,e?.in)}i(jl,"parseJSON");var ZJ=jl;function he(t,e,r){let o=kt(t,r)-e;return o<=0&&(o+=7),Pt(t,o,r)}i(he,"previousDay");var oQ=he;function $l(t,e){return he(t,5,e)}i($l,"previousFriday");var aQ=$l;function ql(t,e){return he(t,1,e)}i(ql,"previousMonday");var lQ=ql;function Bl(t,e){return he(t,6,e)}i(Bl,"previousSaturday");var hQ=Bl;function zl(t,e){return he(t,0,e)}i(zl,"previousSunday");var gQ=zl;function Vl(t,e){return he(t,4,e)}i(Vl,"previousThursday");var DQ=Vl;function Gl(t,e){return he(t,2,e)}i(Gl,"previousTuesday");var EQ=Gl;function Jl(t,e){return he(t,3,e)}i(Jl,"previousWednesday");var CQ=Jl;function Ql(t){return Math.trunc(t*Gn)}i(Ql,"quartersToMonths");var FQ=Ql;function Kl(t){let e=t/Qn;return Math.trunc(e)}i(Kl,"quartersToYears");var YQ=Kl;function Xl(t,e){let r=e?.nearestTo??1;if(r<1||r>12)return x(e?.in||t,NaN);let o=m(t,e?.in),n=o.getMinutes()/60,s=o.getSeconds()/60/60,a=o.getMilliseconds()/1e3/60/60,c=o.getHours()+n+s+a,u=e?.roundingMethod??"round",l=me(u)(c/r)*r;return o.setHours(l,0,0,0),o}i(Xl,"roundToNearestHours");var zQ=Xl;function Zl(t,e){let r=e?.nearestTo??1;if(r<1||r>30)return x(t,NaN);let o=m(t,e?.in),n=o.getSeconds()/60,s=o.getMilliseconds()/1e3/60,a=o.getMinutes()+n+s,c=e?.roundingMethod??"round",f=me(c)(a/r)*r;return o.setMinutes(f,0,0),o}i(Zl,"roundToNearestMinutes");var XQ=Zl;function Al(t){let e=t/Kt;return Math.trunc(e)}i(Al,"secondsToHours");var tK=Al;function ed(t){return t*Mr}i(ed,"secondsToMilliseconds");var iK=ed;function td(t){let e=t/Er;return Math.trunc(e)}i(td,"secondsToMinutes");var uK=td;function zr(t,e,r){let o=m(t,r?.in),n=o.getFullYear(),s=o.getDate(),a=x(r?.in||t,0);a.setFullYear(n,e,15),a.setHours(0,0,0,0);let c=Ti(a);return o.setMonth(e,Math.min(s,c)),o}i(zr,"setMonth");var hK=zr;function rd(t,e,r){let o=m(t,r?.in);return isNaN(+o)?x(r?.in||t,NaN):(e.year!=null&&o.setFullYear(e.year),e.month!=null&&(o=zr(o,e.month)),e.date!=null&&o.setDate(e.date),e.hours!=null&&o.setHours(e.hours),e.minutes!=null&&o.setMinutes(e.minutes),e.seconds!=null&&o.setSeconds(e.seconds),e.milliseconds!=null&&o.setMilliseconds(e.milliseconds),o)}i(rd,"set");var vK=rd;function od(t,e,r){let o=m(t,r?.in);return o.setDate(e),o}i(od,"setDate");var MK=od;function nd(t,e,r){let o=m(t,r?.in);return o.setMonth(0),o.setDate(e),o}i(nd,"setDayOfYear");var IK=nd;function id(t){let e={},r=U();for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&(t[o]===void 0?delete e[o]:e[o]=t[o]);Eu(e)}i(id,"setDefaultOptions");var RK=id;function sd(t,e,r){let o=m(t,r?.in);return o.setHours(e),o}i(sd,"setHours");var LK=sd;function ad(t,e,r){let o=m(t,r?.in);return o.setMilliseconds(e),o}i(ad,"setMilliseconds");var jK=ad;function cd(t,e,r){let o=m(t,r?.in);return o.setMinutes(e),o}i(cd,"setMinutes");var zK=cd;function ud(t,e,r){let o=m(t,r?.in),n=Math.trunc(o.getMonth()/3)+1,s=e-n;return zr(o,o.getMonth()+s*3)}i(ud,"setQuarter");var KK=ud;function fd(t,e,r){let o=m(t,r?.in);return o.setSeconds(e),o}i(fd,"setSeconds");var eX=fd;function ld(t,e,r){let o=U(),n=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,s=ne(m(t,r?.in),tr(t,r),r),a=x(r?.in||t,0);a.setFullYear(e,0,n),a.setHours(0,0,0,0);let c=tr(a,r);return c.setDate(c.getDate()+s),c}i(ld,"setWeekYear");var cX=ld;function dd(t,e,r){let o=m(t,r?.in);return isNaN(+o)?x(r?.in||t,NaN):(o.setFullYear(e),o)}i(dd,"setYear");var mX=dd;function md(t,e){let r=m(t,e?.in),o=r.getFullYear(),n=Math.floor(o/10)*10;return r.setFullYear(n,0,1),r.setHours(0,0,0,0),r}i(md,"startOfDecade");var xX=md;function pd(t){return Ze(Date.now(),t)}i(pd,"startOfToday");var vX=pd;function hd(t){let e=N(t?.in),r=e.getFullYear(),o=e.getMonth(),n=e.getDate(),s=x(t?.in,0);return s.setFullYear(r,o,n+1),s.setHours(0,0,0,0),s}i(hd,"startOfTomorrow");var OX=hd;function yd(t){let e=N(t?.in),r=e.getFullYear(),o=e.getMonth(),n=e.getDate(),s=N(t?.in);return s.setFullYear(r,o,n-1),s.setHours(0,0,0,0),s}i(yd,"startOfYesterday");var PX=yd;function Ms(t,e,r){return Ke(t,-e,r)}i(Ms,"subMonths");var NX=Ms;function xd(t,e,r){let{years:o=0,months:n=0,weeks:s=0,days:a=0,hours:c=0,minutes:u=0,seconds:f=0}=e,l=Ms(t,n+o*12,r),d=Pt(l,a+s*7,r),p=u+c*60,y=(f+p*60)*1e3;return x(r?.in||t,+d-y)}i(xd,"sub");var HX=xd;function wd(t,e,r){return Zn(t,-e,r)}i(wd,"subBusinessDays");var BX=wd;function gd(t,e,r){return An(t,-e,r)}i(gd,"subHours");var JX=gd;function bd(t,e,r){return vt(t,-e,r)}i(bd,"subMilliseconds");var ZX=bd;function vd(t,e,r){return kr(t,-e,r)}i(vd,"subMinutes");var rZ=vd;function Td(t,e,r){return Ir(t,-e,r)}i(Td,"subQuarters");var sZ=Td;function Dd(t,e,r){return ri(t,-e,r)}i(Dd,"subSeconds");var fZ=Dd;function Sd(t,e,r){return Tt(t,-e,r)}i(Sd,"subWeeks");var pZ=Sd;function Md(t,e,r){return oi(t,-e,r)}i(Md,"subYears");var wZ=Md;function Od(t){return Math.trunc(t*7)}i(Od,"weeksToDays");var TZ=Od;function Ed(t){return Math.trunc(t*365.2425)}i(Ed,"yearsToDays");var OZ=Ed;function kd(t){return Math.trunc(t*Jn)}i(kd,"yearsToMonths");var PZ=kd;function Id(t){return Math.trunc(t*Qn)}i(Id,"yearsToQuarters");var NZ=Id;var _d=i(t=>Number.isFinite(t)?t:0,"toZeroIfInfinity");function i0(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(_d(t*1e3)%1e3),nanoseconds:Math.trunc(_d(t*1e6)%1e3)}}i(i0,"parseNumber");function s0(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}i(s0,"parseBigint");function ec(t){switch(typeof t){case"number":{if(Number.isFinite(t))return i0(t);break}case"bigint":return s0(t)}throw new TypeError("Expected a finite number or bigint")}i(ec,"parseMilliseconds");var a0=i(t=>t===0||t===0n,"isZero"),c0=i((t,e)=>e===1||e===1n?t:`${t}s`,"pluralize"),u0=1e-7,f0=24n*60n*60n*1000n;function Wo(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let o=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let n=[],s=i((l,d)=>{let p=Math.floor(l*10**d+u0);return(Math.round(p)/10**d).toFixed(d)},"floorDecimals"),a=i((l,d,p,h)=>{if(!((n.length===0||!e.colonNotation)&&a0(l)&&!(e.colonNotation&&p==="m"))){if(h??=String(l),e.colonNotation){let y=h.includes(".")?h.split(".")[0].length:h.length,w=n.length>0?2:1;h="0".repeat(Math.max(0,w-y))+h}else h+=e.verbose?" "+c0(d,l):p;n.push(h)}},"add"),c=ec(t),u=BigInt(c.days);if(e.hideYearAndDays?a(BigInt(u)*24n+BigInt(c.hours),"hour","h"):(e.hideYear?a(u,"day","d"):(a(u/365n,"year","y"),a(u%365n,"day","d")),a(Number(c.hours),"hour","h")),a(Number(c.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let l=Number(c.seconds),d=Number(c.milliseconds),p=Number(c.microseconds),h=Number(c.nanoseconds);if(a(l,"second","s"),e.formatSubMilliseconds)a(d,"millisecond","ms"),a(p,"microsecond","\xB5s"),a(h,"nanosecond","ns");else{let y=d+p/1e3+h/1e6,w=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=y>=1?Math.round(y):Math.ceil(y),v=w?y.toFixed(w):g;a(Number.parseFloat(v),"millisecond","ms",v)}}else{let l=(r?Number(t%f0):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,p=s(l,d),h=e.keepDecimalsOnWholeSeconds?p:p.replace(/\.0+$/,"");a(Number.parseFloat(h),"second","s",h)}if(n.length===0)return o+"0"+(e.verbose?" milliseconds":"ms");let f=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(n=n.slice(0,Math.max(e.unitCount,1))),o+n.join(f)}i(Wo,"prettyMilliseconds");var or=fn(Pd(),1),Rd=fn(Cd(),1);or.default.extend(Rd.default);var Lo=class{static{i(this,"CronJob")}constructor(e,r,o){this.status="initial",this.nextExecutionUnix=0,this.cronExpression=r,this.jobFunction=o,this.cronParser=new Mo.Cron(r)}checkExecution(){if(this.status==="stopped")return this.nextExecutionUnix;if(this.nextExecutionUnix===0&&this.getNextExecutionTime(),Date.now()>this.nextExecutionUnix){let e=this.jobFunction(this.nextExecutionUnix);e instanceof Promise&&e.catch(r=>console.log(r)),this.nextExecutionUnix=this.getNextExecutionTime()}return this.nextExecutionUnix}getNextExecutionTime(){return this.nextExecutionUnix=Date.now()+this.getTimeToNextExecution()}getTimeToNextExecution(){return this.cronParser.msToNext()??1/0}start(){this.status="started"}stop(){this.status="stopped"}};var Uo=class{static{i(this,"CronJobCollection")}constructor(){this.cronJobSet=new Set}add(e){this.cronJobSet.add(e)}remove(e){this.cronJobSet.delete(e)}getArray(){return[...this.cronJobSet]}isEmpty(){return this.cronJobSet.size===0}get length(){return this.cronJobSet.size}[Symbol.iterator](){return this.cronJobSet.values()}};var tc=class{static{i(this,"CronManager")}constructor(){this.executionTimeout=null,this.status="stopped",this.cronjobs=new Uo,this.cycleWakeDeferred=null,this.cycleGeneration=0}wakeCycle(){this.cycleWakeDeferred&&this.cycleWakeDeferred.status==="pending"&&this.cycleWakeDeferred.resolve()}addCronjob(e,r){let o=new Lo(this,e,r);return this.cronjobs.add(o),this.status==="started"&&(o.start(),this.wakeCycle()),o}removeCronjob(e){e.stop(),this.cronjobs.remove(e),this.status==="started"&&this.wakeCycle()}start(){if(this.status!=="started"){this.status="started";for(let e of this.cronjobs.getArray())e.start();this.cycleGeneration++,this.runCronCycle(this.cycleGeneration)}}isCurrentCycle(e){return this.status==="started"&&this.cycleGeneration===e}async runCronCycle(e){for(;this.isCurrentCycle(e);){let r=new F.Deferred;this.cycleWakeDeferred=r;let o=1/0;for(let n of this.cronjobs.getArray()){n.checkExecution();let s=n.getTimeToNextExecution();s<o&&(o=s)}if(o<1/0&&o>0){let n=new F.Timeout(o);this.executionTimeout=n,await Promise.race([n.promise,r.promise]),n.cancel()}else{if(o<=0)continue;await r.promise}}this.cycleGeneration===e&&(this.cycleWakeDeferred=null)}stop(){this.status==="started"&&(this.status="stopped",this.executionTimeout&&this.executionTimeout.cancel(),this.wakeCycle());for(let e of this.cronjobs.getArray())e.stop()}};var Ct={years:i((t=1)=>t*3154e7,"years"),months:i((t=1)=>t*2628e6,"months"),weeks:i((t=1)=>t*6048e5,"weeks"),days:i((t=1)=>t*864e5,"days"),hours:i((t=1)=>t*36e5,"hours"),minutes:i((t=1)=>t*6e4,"minutes"),seconds:i((t=1)=>t*1e3,"seconds")},rc=i(t=>{let e=0,r=i(o=>{e=e+o},"addMilliSeconds");return t.years&&r(Ct.years(t.years)),t.months&&r(Ct.months(t.months)),t.weeks&&r(Ct.weeks(t.weeks)),t.days&&r(Ct.days(t.days)),t.hours&&r(Ct.hours(t.hours)),t.minutes&&r(Ct.minutes(t.minutes)),t.seconds&&r(Ct.seconds(t.seconds)),e},"getMilliSecondsFromUnits"),l0=i(t=>Wo(t),"getMilliSecondsAsHumanReadableString"),d0=i(t=>Fo.formatDistanceToNow(new Date(t)),"getMilliSecondsAsHumanReadableAgoTime");var oc=class t extends Date{static{i(this,"ExtendedDate")}static fromMillis(e){return new t(e)}static fromDate(e){return new t(e.getTime())}static fromEuropeanDate(e){let r=t.parseEuropeanDate(e),n=new Date(parseFloat(r[3]),parseFloat(r[2])-1,parseFloat(r[1])).getTime();return new t(n)}static fromHyphedDate(e){let r=new Date(e).getTime();return new t(r)}static fromEuropeanDateAndTime(e,r="12:00:00",o="Europe/Berlin"){let n=t.parseEuropeanDate(e),s=i(f=>`0${f}`.slice(-2),"sliceDate"),a=`${n[3]}-${s(n[2])}-${s(n[1])}T${r}`,u=or.default(a).toDate().getTime();return new t(u)}static parseEuropeanDate(e){let r=/(.*)\.(.*)\.(.*)/.exec(e);if(!r)throw new Error(`"${e}" is not a European date like "28.03.2018"`);return r}constructor(e=Date.now()){super(e)}exportToEuropeanDate(){let e=this.exportToUnits();return`${e.dayString}.${e.monthString}.${e.yearString}`}exportToHyphedSortableDate(){let e=this.exportToUnits();return`${e.yearString}-${e.monthString}-${e.dayString}`}exportToUnits(){let e=["January","February","March","April","May","June","July","August","September","October","November","December"],r=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];return{year:this.getFullYear(),yearString:`${this.getFullYear()}`,month:this.getMonth()+1,monthString:("0"+(this.getMonth()+1)).slice(-2),monthName:e[this.getMonth()],day:this.getDate(),dayString:("0"+this.getDate()).slice(-2),dayOfTheWeek:this.getDay(),dayOfTheWeekName:r[this.getDay()]}}format(e){return or.default(this.getTime()).format(e)}isToday(){return or.default(this.getTime()).isToday()}lessTimePassedToNow(e){let r=rc(e);return Date.now()-this.getTime()<r}moreTimePassedToNow(e){return!this.lessTimePassedToNow(e)}};var nc=class{static{i(this,"HrtMeasurement")}constructor(){this.nanoSeconds=null,this.milliSeconds=null,this._milliStart=null,this._milliDiff=null}start(){this._milliStart=performance.now()}stop(){return this._milliStart===null?(console.log("Hasn't started yet"),this):(this._milliDiff=performance.now()-this._milliStart,this.nanoSeconds=this._milliDiff*1e6,this.milliSeconds=this._milliDiff,this)}reset(){this.nanoSeconds=null,this.milliSeconds=null,this._milliStart=null,this._milliDiff=null}};var ic=class{static{i(this,"Interval")}constructor(e){this.status="initial",this.currentRun=null,this.intervalJobs=[],this.intervalMilliseconds=e}start(){this.endCurrentRun(),this.status="started";let e={timeout:null,stopped:F.defer()};this.currentRun=e,i(async()=>{for(;this.currentRun===e&&(e.timeout=new F.Timeout(this.intervalMilliseconds),await Promise.race([e.timeout.promise,e.stopped.promise]),this.currentRun===e);)this.executeIntervalJobs()},"runInterval")()}stop(){this.status="stopped",this.endCurrentRun()}addIntervalJob(e){this.intervalJobs.push(e)}endCurrentRun(){let e=this.currentRun;e&&(this.currentRun=null,e.timeout?.cancel(),e.stopped.resolve())}executeIntervalJobs(){for(let e of this.intervalJobs)e()}};var Gr=class t{static{i(this,"TimeStamp")}static fromMilliSeconds(e){return new t(e)}static fromTimeStamp(e){let r=new t;return r.change=r.milliSeconds-e.milliSeconds,r}constructor(e){this.change=null,this.date=e?new Date(e):new Date,this.milliSeconds=this.date.getTime(),this.epochtime=Math.floor(this.milliSeconds/1e3)}isOlderThanOtherTimeStamp(e,r=0){return this.milliSeconds<e.milliSeconds-r}isOlderThan(e,r=0){return this.milliSeconds+r<e.milliSeconds}isYoungerThanOtherTimeStamp(e,r=0){return this.milliSeconds>e.milliSeconds+r}isYoungerThanMilliSeconds(e){let o=new t().epochtime-e,n=new t(o);return this.isYoungerThanOtherTimeStamp(n)}};var sc=class{static{i(this,"Timer")}get timeLeft(){let e=this.pausedAt?.change;if(e==null)throw new Error("timer has NOT been paused before. timeLeft is known after .pause()");return this.timeInMilliseconds-e}constructor(e){this.state="initiated",this.startedAt=null,this.pausedAt=null,this.currentTimeout=null,this.completedDeferred=F.defer(),this.timeInMilliseconds=e,this.completed=this.completedDeferred.promise}start(){if(!this.startedAt)this.startTimeout(this.timeInMilliseconds),this.startedAt=new Gr;else throw new Error("timer has been started before. Please use resume instead")}pause(){this.startedAt&&(this.currentTimeout?.cancel(),this.currentTimeout=null,this.pausedAt=Gr.fromTimeStamp(this.startedAt))}resume(){if(this.startedAt)this.startTimeout(this.timeLeft);else throw new Error("timer has NOT been started before. Please use .start() instead")}reset(){this.pause(),this.startedAt=null,this.pausedAt=null}startTimeout(e){this.currentTimeout?.cancel();let r=new F.Timeout(e);this.currentTimeout=r,r.promise.then(()=>{this.completedDeferred.resolve()})}};var Es=fn(Bd(),1);var cc=class{static{i(this,"AsyncExecutionStack")}executionSlots=[];isProcessing=!1;nonExclusiveMaxConcurrency=1/0;nonExclusiveCurrentCount=0;nonExclusivePendingQueue=[];async getExclusiveExecutionSlot(e,r){let o=F.defer(),n={funcToExecute:e,executionDeferred:o,timeout:r,mode:"exclusive"};return this.executionSlots.push(n),this.processExecutionSlots(),o.promise}async getNonExclusiveExecutionSlot(e,r){let o=F.defer(),n={funcToExecute:e,executionDeferred:o,timeout:r,mode:"nonexclusive"};return this.executionSlots.push(n),this.processExecutionSlots(),o.promise}setNonExclusiveMaxConcurrency(e){if(!Number.isFinite(e)||e<1)throw new Error("nonExclusiveMaxConcurrency must be a finite number >= 1");this.nonExclusiveMaxConcurrency=e}getNonExclusiveMaxConcurrency(){return this.nonExclusiveMaxConcurrency}getActiveNonExclusiveCount(){return this.nonExclusiveCurrentCount}getPendingNonExclusiveCount(){return this.nonExclusivePendingQueue.length}async processExecutionSlots(){if(!this.isProcessing){for(this.isProcessing=!0;this.executionSlots.length>0;){let e=this.executionSlots[0];if(e.mode==="exclusive")await this.executeExclusiveSlot(e),this.executionSlots.shift();else{let r=[];for(;this.executionSlots.length>0&&this.executionSlots[0].mode==="nonexclusive";)r.push(this.executionSlots.shift());await this.executeNonExclusiveSlots(r)}}this.isProcessing=!1}}async executeExclusiveSlot(e){try{if(e.timeout){let r=new F.Timeout(e.timeout);try{let o=await Promise.race([e.funcToExecute(),r.promise.then(()=>{throw new Error("Timeout reached")})]);r.cancel(),e.executionDeferred.resolve(o)}catch(o){throw r.cancel(),o}}else{let r=await e.funcToExecute();e.executionDeferred.resolve(r)}}catch(r){e.executionDeferred.reject(r)}}async executeNonExclusiveSlots(e){let r=e.map(async o=>{await this.waitForNonExclusiveSlot();try{if(o.timeout){let n=new F.Timeout(o.timeout);try{let s=await Promise.race([o.funcToExecute(),n.promise.then(()=>{throw new Error("Timeout reached")})]);n.cancel(),o.executionDeferred.resolve(s)}catch(s){throw n.cancel(),s}}else{let n=await o.funcToExecute();o.executionDeferred.resolve(n)}}catch(n){o.executionDeferred.reject(n)}finally{this.releaseNonExclusiveSlot()}});await Promise.all(r)}waitForNonExclusiveSlot(){return this.nonExclusiveCurrentCount<this.nonExclusiveMaxConcurrency?(this.nonExclusiveCurrentCount++,Promise.resolve()):new Promise(e=>{this.nonExclusivePendingQueue.push(()=>{this.nonExclusiveCurrentCount++,e()})})}releaseNonExclusiveSlot(){this.nonExclusiveCurrentCount--;let e=this.nonExclusivePendingQueue.shift();e&&e()}};var uc=class{static{i(this,"BackpressuredArray")}data;highWaterMark;hasSpace=new We.rxjs.Subject;itemsAvailable=new We.rxjs.Subject;isDestroyed=!1;constructor(e=16){this.data=[],this.highWaterMark=e}get length(){return this.data.length}push(e){this.data.push(e),this.itemsAvailable.next("itemsAvailable");let r=this.checkSpaceAvailable();return r&&this.hasSpace.next("hasSpace"),r}pushMany(e){for(let r of e)this.push(r);return this.checkSpaceAvailable()}shift(){let e=this.data.shift();return this.checkSpaceAvailable()&&this.hasSpace.next("hasSpace"),e}peek(){return this.data[0]}checkSpaceAvailable(){return this.data.length<this.highWaterMark}checkHasItems(){return this.data.length>0}waitForSpace(){return new Promise(e=>{if(this.checkSpaceAvailable()||this.isDestroyed)e();else{let r=this.hasSpace.subscribe({next:i(()=>{r.unsubscribe(),e()},"next"),complete:i(()=>{e()},"complete")})}})}waitForItems(){return new Promise(e=>{if(this.data.length>0||this.isDestroyed)e();else{let r=this.itemsAvailable.subscribe({next:i(()=>{r.unsubscribe(),e()},"next"),complete:i(()=>{e()},"complete")})}})}[Symbol.iterator](){return this.data[Symbol.iterator]()}destroy(){this.isDestroyed=!0,this.hasSpace.complete(),this.itemsAvailable.complete()}};var Yo=class t{static{i(this,"FastMap")}mapObject=new Map;isUniqueKey(e){return!this.mapObject.has(e)}has(e){return this.mapObject.has(e)}get size(){return this.mapObject.size}addToMap(e,r,o){return this.isUniqueKey(e)||o&&o.force?(this.mapObject.set(e,r),!0):!1}getByKey(e){return this.mapObject.get(e)}removeFromMap(e){let r=this.mapObject.get(e);return this.mapObject.delete(e),r}getKeys(){return Array.from(this.mapObject.keys())}values(){return Array.from(this.mapObject.values())}entries(){return Array.from(this.mapObject.entries())}clean(){this.mapObject.clear()}concat(e){let r=new t;for(let o of this.getKeys())r.addToMap(o,this.getByKey(o));for(let o of e.getKeys())r.addToMap(o,e.getByKey(o),{force:!0});return r}addAllFromOther(e){for(let r of e.getKeys())this.addToMap(r,e.getByKey(r),{force:!0})}async find(e){for(let r of this.getKeys()){let o=this.getByKey(r);if(await e(o))return o}}[Symbol.iterator](){return this.mapObject.entries()}};var zd=i((t="uni")=>`${t}xxxxxxxxxxx`.replace(/[xy]/g,e=>{let r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)}),"uni"),ir=class t{static{i(this,"ObjectMap")}fastMap=new Yo;reverseMap=new Map;eventSubject=new We.rxjs.Subject;constructor(){}get length(){return this.fastMap.size}addMappedUnique(e,r){this.fastMap.addToMap(e,r),this.reverseMap.set(r,e)}getMappedUnique(e){return this.fastMap.getByKey(e)}removeMappedUnique(e){let r=this.fastMap.removeFromMap(e);return r!==void 0&&(this.reverseMap.delete(r),this.eventSubject.next({operation:"remove",payload:r})),r}add(e){let r=this.reverseMap.get(e);if(r!==void 0)return r;let o=zd("key");return this.addMappedUnique(o,e),this.eventSubject.next({operation:"add",payload:e}),o}addArray(e){for(let r of e)this.add(r)}checkForObject(e){return this.reverseMap.has(e)}getKeyForObject(e){return this.reverseMap.get(e)??null}async find(e){return this.fastMap.find(e)}findSync(e){for(let r of this.fastMap.getKeys())if(e(this.fastMap.getByKey(r)))return this.getMappedUnique(r)}async findOneAndRemove(e){let r=await this.find(e);return r&&this.remove(r),r}findOneAndRemoveSync(e){let r=this.findSync(e);return r&&this.remove(r),r}async forEach(e){for(let r of this.fastMap.getKeys())await e(this.fastMap.getByKey(r))}getOneAndRemove(){let e=this.fastMap.getKeys();if(e.length===0)return null;{let r=e[0],o=this.fastMap.removeFromMap(r);return this.reverseMap.delete(o),this.eventSubject.next({operation:"remove",payload:o}),o}}getArray(){return this.fastMap.values()}isEmpty(){return this.fastMap.size===0}remove(e){let r=this.reverseMap.get(e);if(r!==void 0){let o=this.fastMap.removeFromMap(r);return this.reverseMap.delete(o),this.eventSubject.next({operation:"remove",payload:o}),o}return null}wipe(){let e=this.fastMap.getKeys();for(let r of e){let o=this.fastMap.removeFromMap(r);this.reverseMap.delete(o),this.eventSubject.next({operation:"remove",payload:o})}}concat(e){let r=new t;r.fastMap.addAllFromOther(this.fastMap),r.fastMap.addAllFromOther(e.fastMap);for(let o of r.fastMap.getKeys())r.reverseMap.set(r.fastMap.getByKey(o),o);return r}addAllFromOther(e){this.fastMap.addAllFromOther(e.fastMap);for(let r of e.fastMap.getKeys())this.reverseMap.set(e.fastMap.getByKey(r),r)}map(e){return this.getArray().map(e)}filter(e){return this.getArray().filter(e)}reduce(e,r){return this.getArray().reduce(e,r)}[Symbol.iterator](){return this.getArray()[Symbol.iterator]()}destroy(){this.wipe(),this.reverseMap.clear(),this.eventSubject.complete()}};var Ho=class{static{i(this,"Interest")}options;interestMapRef;originalInterest;comparisonFunc;destructionTimer=new nr.Timer(1e4);isFullfilled=!1;isDestroyed=!1;fullfillmentStore=[];markLostTimeout=null;get comparisonString(){return this.comparisonFunc(this.originalInterest)}interestDeferred=new F.Deferred;interestFullfilled=this.interestDeferred.promise;fullfillInterest(e){this.isFullfilled=!0,this.fullfillmentStore=[],this.interestDeferred.resolve(e),this.destroy()}constructor(e,r,o,n){this.interestMapRef=e,this.originalInterest=r,this.comparisonFunc=o,this.options=n,this.destructionTimer.completed.then(()=>{this.isDestroyed||this.destroy()}),this.options?.markLostAfterDefault&&(this.markLostTimeout=new F.Timeout(this.options.markLostAfterDefault),this.markLostTimeout.promise.then(()=>{this.isDestroyed||this.markLost()}))}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.destructionTimer.reset(),this.markLostTimeout&&(this.markLostTimeout.cancel(),this.markLostTimeout=null),this.fullfillmentStore=[],this.interestMapRef.removeInterest(this),!this.isFullfilled&&this.options?.defaultFullfillment&&(this.isFullfilled=!0,this.interestDeferred.resolve(this.options.defaultFullfillment)))}markLost(){this.destructionTimer.start()}renew(){this.destructionTimer.reset()}};var fc=class{static{i(this,"InterestMap")}options;interestObjectMap=new ir;interestsByComparisonString=new Map;comparisonStringsByInterest=new WeakMap;comparisonFunc;constructor(e,r={}){this.comparisonFunc=e,this.options=r}async addInterest(e,r){let o=this.comparisonFunc(e),n,s=this.interestsByComparisonString.get(o);return s?(n=s,n.renew()):(n=new Ho(this,e,this.comparisonFunc,{markLostAfterDefault:this.options.markLostAfterDefault,defaultFullfillment:r}),this.interestObjectMap.add(n),this.comparisonStringsByInterest.set(n,o),this.interestsByComparisonString.set(o,n)),this.interestObservable.push(n),n}interestObservable=new We.ObservableIntake;removeInterest(e){if(!this.comparisonStringsByInterest.has(e))return;let r=this.comparisonStringsByInterest.get(e);this.interestObjectMap.remove(e),this.comparisonStringsByInterest.delete(e),this.interestsByComparisonString.get(r)===e&&this.interestsByComparisonString.delete(r)}checkInterest(e){let r=this.comparisonFunc(e);return this.checkInterestByString(r)}checkInterestByString(e){return this.interestsByComparisonString.has(e)}informLostInterest(e){let r=this.findInterest(e);r&&r.markLost()}findInterest(e){let r=this.comparisonFunc(e);return this.interestsByComparisonString.get(r)??null}destroy(){let e=this.interestObjectMap.getArray();for(let r of e)r.destroy();this.interestObjectMap.wipe(),this.interestsByComparisonString.clear(),this.interestObservable.signalComplete()}};var lc=class{static{i(this,"LimitedArray")}array=[];arrayLimit;constructor(e){this.arrayLimit=e}get length(){return this.array.length}addOne(e){this.array.unshift(e),this.array.length>this.arrayLimit&&(this.array.length=this.arrayLimit)}addMany(e){for(let r of e)this.addOne(r)}setLimit(e){this.arrayLimit=e,this.array.length>this.arrayLimit&&(this.array.length=this.arrayLimit)}getAverage(){if(this.array.length===0)return 0;if(typeof this.array[0]=="number"){let e=0;for(let r of this.array)e=e+r;return e/this.array.length}else return null}remove(e){let r=this.array.indexOf(e);return r!==-1?(this.array.splice(r,1),!0):!1}clear(){this.array.length=0}getArray(){return[...this.array]}[Symbol.iterator](){return this.array[Symbol.iterator]()}};var dc=class{static{i(this,"LoopTracker")}referenceObjectMap=new ir;constructor(){}checkAndTrack(e){return this.referenceObjectMap.checkForObject(e)?!1:(this.referenceObjectMap.add(e),!0)}reset(){this.referenceObjectMap.wipe()}destroy(){this.referenceObjectMap.destroy()}};var mc=class{static{i(this,"Stringmap")}_stringArray=[];_triggerUntilTrueFunctionArray=[];constructor(){}addString(e){this._stringArray.push(e),this.notifyTrigger()}addStringArray(e){for(let r of e)this.addString(r)}removeString(e){this._stringArray=this._stringArray.filter(r=>r!==e),this.notifyTrigger()}wipe(){this._stringArray=[],this.notifyTrigger()}checkString(e){return this._stringArray.indexOf(e)!==-1}checkMinimatch(e){let r=new mo.SmartMatch(e),o=!1;for(let n of this._stringArray)r.match(n)&&(o=!0);return o}checkIsEmpty(){return this._stringArray.length===0}getStringArray(){let e=[];for(let r of this._stringArray)e.push(r);return e}registerUntilTrue(e,r){let o=F.defer();return this._triggerUntilTrueFunctionArray.push(()=>{let n=e(this.getStringArray());return n===!0&&(r&&r(),o.resolve()),n}),this.notifyTrigger(),o.promise}notifyTrigger(){let e=this._triggerUntilTrueFunctionArray.filter(r=>!r());this._triggerUntilTrueFunctionArray=e}destroy(){this._stringArray=[],this._triggerUntilTrueFunctionArray=[]}};var jo=class{static{i(this,"TimedAggregtor")}options;storageArray=[];isStopped=!1;constructor(e){this.options=e}aggregationTimer;checkAggregationStatus(){if(this.isStopped)return;let e=i(()=>{this.aggregationTimer=new nr.Timer(this.options.aggregationIntervalInMillis),this.aggregationTimer.completed.then(()=>{if(this.isStopped){this.aggregationTimer=null;return}let r=this.storageArray;if(r.length===0){this.aggregationTimer=null;return}this.storageArray=[],e(),this.options.functionForAggregation(r)}),this.aggregationTimer.start()},"addAggregationTimer");this.aggregationTimer||e()}add(e){this.isStopped||(this.storageArray.push(e),this.checkAggregationStatus())}stop(e=!1){if(this.isStopped=!0,this.aggregationTimer&&(this.aggregationTimer.reset(),this.aggregationTimer=null),e&&this.storageArray.length>0){let r=this.storageArray;this.storageArray=[],this.options.functionForAggregation(r)}else this.storageArray=[]}restart(){this.isStopped=!1}};var pc=class{static{i(this,"Tree")}symbolTree;constructor(){this.symbolTree=new Es.default}initialize(e){return this.symbolTree.initialize(e)}hasChildren(e){return this.symbolTree.hasChildren(e)}firstChild(e){return this.symbolTree.firstChild(e)}lastChild(e){return this.symbolTree.lastChild(e)}previousSibling(e){return this.symbolTree.previousSibling(e)}nextSibling(e){return this.symbolTree.nextSibling(e)}parent(e){return this.symbolTree.parent(e)}lastInclusiveDescendant(e){return this.symbolTree.lastInclusiveDescendant(e)}preceding(e,r){return this.symbolTree.preceding(e,r)}following(e,r){return this.symbolTree.following(e,r)}childrenToArray(e,r){return this.symbolTree.childrenToArray(e,r)}ancestorsToArray(e,r){return this.symbolTree.ancestorsToArray(e,r)}treeToArray(e,r){return this.symbolTree.treeToArray(e,r)}childrenIterator(e,r){return this.symbolTree.childrenIterator(e,r)}previousSiblingsIterator(e){return this.symbolTree.previousSiblingsIterator(e)}nextSiblingsIterator(e){return this.symbolTree.nextSiblingsIterator(e)}ancestorsIterator(e){return this.symbolTree.ancestorsIterator(e)}treeIterator(e,r){return this.symbolTree.treeIterator(e,r)}index(e){return this.symbolTree.index(e)}childrenCount(e){return this.symbolTree.childrenCount(e)}compareTreePosition(e,r){return this.symbolTree.compareTreePosition(e,r)}remove(e){return this.symbolTree.remove(e)}insertBefore(e,r){return this.symbolTree.insertBefore(e,r)}insertAfter(e,r){return this.symbolTree.insertAfter(e,r)}prependChild(e,r){return this.symbolTree.prependChild(e,r)}appendChild(e,r){return this.symbolTree.appendChild(e,r)}toJsonWithHierachy(e){let r=i(o=>{let n=[];if(this.hasChildren(o)){let s=this.childrenToArray(o,{});for(let a of s)n.push(r(a))}return{data:o,children:n}},"buildNode");return r(e)}fromJsonWithHierachy(e,r){let o=i((n,s)=>{let a=r?r(n.data):n.data;this.initialize(a),s&&this.appendChild(s,a);for(let c of n.children)o(c,a);return a},"buildTree");return o(e)}};var sr={};Y(sr,{base64ToUint8Array:()=>L0,ensurePureUint8Array:()=>H0,isBufferLike:()=>Y0,isUint8Array:()=>U0,uInt8ArrayExtras:()=>F0,uInt8ArrayToBase64:()=>W0});var Wt={};Y(Wt,{areUint8ArraysEqual:()=>T0,assertUint8Array:()=>Ft,assertUint8ArrayOrArrayBuffer:()=>Kd,base64ToString:()=>k0,base64ToUint8Array:()=>em,compareUint8Arrays:()=>D0,concatUint8Arrays:()=>v0,getUintBE:()=>_0,hexToUint8Array:()=>C0,includes:()=>R0,indexOf:()=>tm,isUint8Array:()=>hc,stringToBase64:()=>E0,stringToUint8Array:()=>Zd,toUint8Array:()=>b0,uint8ArrayToBase64:()=>Ad,uint8ArrayToHex:()=>P0,uint8ArrayToString:()=>Xd});var h0=Object.prototype.toString,y0="[object Uint8Array]",x0="[object ArrayBuffer]";function Vd(t,e,r){return t?t.constructor===e?!0:h0.call(t)===r:!1}i(Vd,"isType");function hc(t){return Vd(t,Uint8Array,y0)}i(hc,"isUint8Array");function w0(t){return Vd(t,ArrayBuffer,x0)}i(w0,"isArrayBuffer");function g0(t){return hc(t)||w0(t)}i(g0,"isUint8ArrayOrArrayBuffer");function Ft(t){if(!hc(t))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof t}\``)}i(Ft,"assertUint8Array");function Kd(t){if(!g0(t))throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``)}i(Kd,"assertUint8ArrayOrArrayBuffer");function b0(t){if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new TypeError(`Unsupported value, got \`${typeof t}\`.`)}i(b0,"toUint8Array");function v0(t,e){if(t.length===0)return new Uint8Array(0);e??=t.reduce((n,s)=>n+s.length,0);let r=new Uint8Array(e),o=0;for(let n of t)Ft(n),r.set(n,o),o+=n.length;return r}i(v0,"concatUint8Arrays");function T0(t,e){if(Ft(t),Ft(e),t===e)return!0;if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}i(T0,"areUint8ArraysEqual");function D0(t,e){Ft(t),Ft(e);let r=Math.min(t.length,e.length);for(let o=0;o<r;o++){let n=t[o]-e[o];if(n!==0)return Math.sign(n)}return Math.sign(t.length-e.length)}i(D0,"compareUint8Arrays");var Gd={utf8:new globalThis.TextDecoder("utf8")};function Xd(t,e="utf8"){return Kd(t),Gd[e]??=new globalThis.TextDecoder(e),Gd[e].decode(t)}i(Xd,"uint8ArrayToString");function $o(t){if(typeof t!="string")throw new TypeError(`Expected \`string\`, got \`${typeof t}\``)}i($o,"assertString");var S0=new globalThis.TextEncoder;function Zd(t){return $o(t),S0.encode(t)}i(Zd,"stringToUint8Array");function M0(t){return t.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}i(M0,"base64ToBase64Url");function O0(t){let e=t.replaceAll("-","+").replaceAll("_","/"),r=(4-e.length%4)%4;return e+"=".repeat(r)}i(O0,"base64UrlToBase64");var Jd=65535;function Ad(t,{urlSafe:e=!1}={}){Ft(t);let r="";for(let o=0;o<t.length;o+=Jd){let n=t.subarray(o,o+Jd);r+=globalThis.btoa(String.fromCodePoint.apply(void 0,n))}return e?M0(r):r}i(Ad,"uint8ArrayToBase64");function em(t){return $o(t),Uint8Array.from(globalThis.atob(O0(t)),e=>e.codePointAt(0))}i(em,"base64ToUint8Array");function E0(t,{urlSafe:e=!1}={}){return $o(t),Ad(Zd(t),{urlSafe:e})}i(E0,"stringToBase64");function k0(t){return $o(t),Xd(em(t))}i(k0,"base64ToString");var I0=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function P0(t){Ft(t);let e="";for(let r=0;r<t.length;r++)e+=I0[t[r]];return e}i(P0,"uint8ArrayToHex");var Qd={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function C0(t){if($o(t),t.length%2!==0)throw new Error("Invalid Hex string length.");let e=t.length/2,r=new Uint8Array(e);for(let o=0;o<e;o++){let n=Qd[t[o*2]],s=Qd[t[o*2+1]];if(n===void 0||s===void 0)throw new Error(`Invalid Hex character encountered at position ${o*2}`);r[o]=n<<4|s}return r}i(C0,"hexToUint8Array");function _0(t){let{byteLength:e}=t;if(e===6)return t.getUint16(0)*2**32+t.getUint32(2);if(e===5)return t.getUint8(0)*2**32+t.getUint32(1);if(e===4)return t.getUint32(0);if(e===3)return t.getUint8(0)*2**16+t.getUint16(1);if(e===2)return t.getUint16(0);if(e===1)return t.getUint8(0)}i(_0,"getUintBE");function tm(t,e){let r=t.length,o=e.length;if(o===0||o>r)return-1;let n=r-o;for(let s=0;s<=n;s++){let a=!0;for(let c=0;c<o;c++)if(t[s+c]!==e[c]){a=!1;break}if(a)return s}return-1}i(tm,"indexOf");function R0(t,e){return tm(t,e)!==-1}i(R0,"includes");var F0=Wt;function W0(t){return Wt.uint8ArrayToBase64(t)}i(W0,"uInt8ArrayToBase64");function L0(t){return Wt.base64ToUint8Array(t)}i(L0,"base64ToUint8Array");var U0=i(t=>Wt.isUint8Array(t),"isUint8Array");function Y0(t){return t&&typeof t.byteLength=="number"?!0:typeof Buffer<"u"&&Buffer.isBuffer?Buffer.isBuffer(t):!1}i(Y0,"isBufferLike");function H0(t){let e=new Uint8Array(t.length);return e.set(t),e}i(H0,"ensurePureUint8Array");var Go={};Y(Go,{Guard:()=>Bo,GuardError:()=>zo,GuardSet:()=>Vo,passGuardsOrReject:()=>J0});var qo={};Y(qo,{CumulativeDeferred:()=>Is,Deferred:()=>ks,cumulativeDefer:()=>j0,defer:()=>Qr,fromCallback:()=>G0,getFirstTrueOrFalse:()=>V0,map:()=>B0,rejectedPromise:()=>q0,resolvedPromise:()=>$0,timeoutAndContinue:()=>z0,timeoutWrap:()=>rm});var ks=class{static{i(this,"Deferred")}claim(){if(this.claimed)throw new Error("Deferred already claimed");this.claimed=!0}get duration(){return this.stoppedAt?this.stoppedAt-this.startedAt:Date.now()-this.startedAt}constructor(){this.claimed=!1,this.promise=new Promise((e,r)=>{this.resolve=o=>{this.status="fulfilled",this.stoppedAt=Date.now(),e(o)},this.reject=o=>{this.status="rejected",this.stoppedAt=Date.now(),r(o)},this.startedAt=Date.now(),this.status="pending"})}},Qr=i(()=>new ks,"defer");var Is=class{static{i(this,"CumulativeDeferred")}constructor(){this.accumulatedPromises=[],this.deferred=Qr(),this.promise=this.deferred.promise,setTimeout(async()=>{for(;this.accumulatedPromises.length>0;)await this.accumulatedPromises.shift();this.deferred.resolve()},0)}subDefer(){let e=Qr();return this.addPromise(e.promise),e}addPromise(e){this.accumulatedPromises.push(e)}},j0=i(()=>new Is,"cumulativeDefer");function $0(t){return Promise.resolve(t)}i($0,"resolvedPromise");var q0=i(t=>Promise.reject(t),"rejectedPromise"),B0=i(async(t,e)=>Promise.all(t.map(e)),"map"),rm=i(async(t,e,r=!0)=>new Promise((o,n)=>{let s,a=i(()=>{s!==void 0&&(clearTimeout(s),s=void 0)},"releaseTimeout");s=setTimeout(()=>{s=void 0,r?n(new Error("timeout")):o(null)},e),t.then(c=>{a(),o(c)},c=>{a(),n(c)})}),"timeoutWrap"),z0=i(async(t,e=6e4)=>rm(t,e,!1),"timeoutAndContinue"),V0=i(async t=>{let e=Qr();for(let r of t)r.then(o=>{o===!0&&e.resolve(!0)});return Promise.all(t).then(()=>{e.resolve(!1)}),e.promise},"getFirstTrueOrFalse"),G0=i(t=>new Promise((e,r)=>{t((o,n)=>{o?r(o):e(n)})}),"fromCallback");var Bo=class{static{i(this,"Guard")}constructor(e,r){this.guardFunction=e,this.options=r||{}}async exec(e){return await this.guardFunction(e)}async getFailedHint(e){return await this.exec(e)?null:this.options.failedHint||null}};var zo=class extends Error{static{i(this,"GuardError")}constructor(e){super(e),this.name="GuardError"}};var Vo=class extends Bo{static{i(this,"GuardSet")}constructor(e=[]){super(async r=>this.allGuardsPass(r)),this.guards=e}async execAllWithData(e,r={mode:"parallel",stopOnFail:!1}){let o=[];for(let s of this.guards){let a=s.exec(e);if(r.mode==="serial"&&await a,o.push(a),r.stopOnFail&&!await a)return await Promise.all(o)}return await Promise.all(o)}async allGuardsPass(e,r={mode:"parallel",stopOnFail:!1}){return(await this.execAllWithData(e,r)).every(n=>n)}async anyGuardsPass(e){return(await this.execAllWithData(e,{mode:"parallel",stopOnFail:!1})).some(o=>o)}async getFailedHint(e){for(let r of this.guards){let o=await r.getFailedHint(e);if(o)return o}return null}};var J0=i(async(t,e)=>{let r=new Vo(e);if(!await r.allGuardsPass(t)){let n=await r.getFailedHint(t);throw new zo(`Guards failed:
4
4
  ${n}
5
- `)}},"passGuardsOrReject");var Br={};A(Br,{CacheManager:()=>jr,CacheStore:()=>Yr,InterceptorManager:()=>Wr,RequestDeduplicator:()=>$r,RetryManager:()=>Ur,WebrequestClient:()=>Kt,createConditionalHeaders:()=>Ss,defaultCacheMaxEntries:()=>No,extractCacheMetadata:()=>Je,headersToObject:()=>Ms,isFresh:()=>Ds,isWebrequestTimeoutError:()=>Wo,objectToHeaders:()=>$d,requiresRevalidation:()=>qr,webrequest:()=>se});var Wr=class{static{i(this,"InterceptorManager")}constructor(){this.requestInterceptors=[],this.responseInterceptors=[],this.errorInterceptors=[]}addRequestInterceptor(e){this.requestInterceptors.push(e)}addResponseInterceptor(e){this.responseInterceptors.push(e)}addErrorInterceptor(e){this.errorInterceptors.push(e)}removeRequestInterceptor(e){let t=this.requestInterceptors.indexOf(e);t>-1&&this.requestInterceptors.splice(t,1)}removeResponseInterceptor(e){let t=this.responseInterceptors.indexOf(e);t>-1&&this.responseInterceptors.splice(t,1)}removeErrorInterceptor(e){let t=this.errorInterceptors.indexOf(e);t>-1&&this.errorInterceptors.splice(t,1)}clearAll(){this.requestInterceptors=[],this.responseInterceptors=[],this.errorInterceptors=[]}async processRequest(e){let t=e;for(let o of this.requestInterceptors)try{t=await o(t)}catch(n){throw await this.processError(n instanceof Error?n:new Error(String(n)))}return t}async processResponse(e){let t=e;for(let o of this.responseInterceptors)try{t=await o(t)}catch(n){throw await this.processError(n instanceof Error?n:new Error(String(n)))}return t}async processError(e){let t=e;for(let o of this.errorInterceptors)try{t=await o(t)}catch(n){t=n instanceof Error?n:new Error(String(n))}return t}getInterceptorCounts(){return{request:this.requestInterceptors.length,response:this.responseInterceptors.length,error:this.errorInterceptors.length}}};var Ze={};A(Ze,{Smartenv:()=>Ba});var Ba=class{static{i(this,"Smartenv")}constructor(){this.loadedScripts=[]}async getEnvAwareModule(e){if(this.isNode)return await this.getSafeNodeModule(e.nodeModuleName);if(this.isBrowser)return await this.getSafeWebModule(e.webUrlArg,e.getFunction);console.error("platform for loading not supported by smartenv")}async getSafeNodeModule(e,t){if(!this.isNode&&!this.isDeno&&!this.isBun){console.error(`You tried to load a server module in a wrong context: ${e}. This does not throw.`);return}let o=await new Function(`return import('${e}')`)();return t&&await t(o),o}async getSafeWebModule(e,t){if(!this.isBrowser){console.error("You tried to load a web module in a wrong context");return}if(this.loadedScripts.includes(e))return t();this.loadedScripts.push(e);let o=F.defer(),n=globalThis;if(n.importScripts)n.importScripts(e),o.resolve();else{let s=document.createElement("script");s.onload=()=>{o.resolve()},s.src=e,document.head.appendChild(s)}return await o.promise,t()}get runtimeEnv(){let e=globalThis;return typeof e.Deno<"u"&&typeof e.Deno.version<"u"?"deno":typeof e.Bun<"u"&&typeof e.Bun.version<"u"?"bun":typeof globalThis.process<"u"&&typeof globalThis.process?.versions?.node<"u"?"node":(typeof globalThis.window<"u"&&typeof globalThis.document<"u","browser")}get isBrowser(){return this.runtimeEnv==="browser"}get isNode(){return this.runtimeEnv==="node"}get isDeno(){return this.runtimeEnv==="deno"}get isBun(){return this.runtimeEnv==="bun"}get userAgent(){return this.isBrowser?navigator.userAgent:"undefined"}get nodeVersion(){return this.isNode?process.version:"undefined"}get denoVersion(){return this.isDeno?globalThis.Deno?.version?.deno??"undefined":"undefined"}get bunVersion(){return this.isBun?globalThis.Bun?.version??"undefined":"undefined"}async getSafeModuleFor(e,t,o){let n;if(Array.isArray(e)?n=e.flatMap(s=>s==="server"?["node","deno","bun"]:[s]):e==="server"?n=["node","deno","bun"]:n=[e],!n.includes(this.runtimeEnv)){console.warn(`Module "${t}" requested for runtime(s) [${n.join(", ")}] but current runtime is "${this.runtimeEnv}". Skipping load.`);return}if(this.isNode||this.isDeno||this.isBun)return await this.getSafeNodeModule(t);if(this.isBrowser){if(!o){console.error(`Browser module load requires getFunction parameter for "${t}"`);return}return await this.getSafeWebModule(t,o)}}get isCI(){return this.isNode?!!process.env.CI:!1}async isMacAsync(){return this.isNode||this.isDeno||this.isBun?(await this.getSafeNodeModule(this.isDeno?"node:os":"os"))?.platform()==="darwin":!1}async isWindowsAsync(){return this.isNode||this.isDeno||this.isBun?(await this.getSafeNodeModule(this.isDeno?"node:os":"os"))?.platform()==="win32":!1}async isLinuxAsync(){return this.isNode||this.isDeno||this.isBun?(await this.getSafeNodeModule(this.isDeno?"node:os":"os"))?.platform()==="linux":!1}async printEnv(){this.isNode?(console.log("running on NODE"),console.log("node version is "+this.nodeVersion)):this.isDeno?(console.log("running on DENO"),console.log("deno version is "+this.denoVersion)):this.isBun?(console.log("running on BUN"),console.log("bun version is "+this.bunVersion)):(console.log("running on BROWSER"),console.log("browser is "+this.userAgent))}};var Jt={};A(Jt,{Smartjson:()=>Za,deepEqualJsonLStrings:()=>aw,deepEqualObjects:()=>Ld,foldDec:()=>sw,parse:()=>ws,parseBase64:()=>iw,parseJsonL:()=>Xa,stableOneWayStringify:()=>rw,stringify:()=>Gt,stringifyBase64:()=>nw,stringifyJsonL:()=>tw,stringifyPretty:()=>ow});var Lr={};A(Lr,{Base64:()=>ps,Domain:()=>hs,GitRepo:()=>ys,base64:()=>Fr,create:()=>cs,docker:()=>fs,indent:()=>ls,normalize:()=>ds,type:()=>ms});var cs={};A(cs,{createCryptoRandomString:()=>Yg,createRandomString:()=>Lg});var za=or(Us(),1);var Wg=i((r,e)=>{if(typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.getRandomValues){let t=e-r,o=new Uint32Array(1);return globalThis.crypto.getRandomValues(o),r+o[0]%t}else return Math.floor(Math.random()*(e-r))+r},"getRandomInt"),Fg=i((r,e,t)=>{let o={A:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",a:"abcdefghijklmnopqrstuvwxyz",0:"0123456789","!":"!@#$%^&*()_+-=[]{}|;:,.<>?","*":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=[]{}|;:,.<>?"},n=r;e&&e>r.length?n=r.repeat(Math.ceil(e/r.length)).slice(0,e):e&&(n=r.slice(0,e));let s="";for(let a of n)if(o[a]){let u=o[a],c=Wg(0,u.length);s+=u[c]}else s+=a;return s},"customRandomatic"),Lg=i((r,e,t)=>Fg(r,e,t),"createRandomString"),Yg=i(()=>za.uni(),"createCryptoRandomString");var fs={};A(fs,{makeEnvObject:()=>qg});var qg=i(function(r){let e={},t=/(.*)=(.*)/;if(typeof r<"u")for(let o in r){let n=t.exec(r[o]);e[n[1]]=n[2]}return e},"makeEnvObject");var ls={};A(ls,{indent:()=>jg,indentWithPrefix:()=>Ug,normalize:()=>$g});var Va=i(r=>{let e=r.split(`
6
- `);return Hg(e)},"splitStringAtLineBreak"),Aa=i(r=>{let e="";for(let t of r)e=e+t+`
7
- `;return e},"joinStringWithLineBreaks"),Hg=i(r=>{let e=/^[\s]*$/;return e.test(r[0])&&r.shift(),e.test(r[r.length-1])&&r.pop(),r},"cleanStringArray"),jg=i((r,e)=>{let t=Va(r);for(let n of t)n=" ".repeat(e)+n;return Aa(t)},"indent"),Ug=i((r,e)=>{let t,o=Va(r),n=[];for(let s of o)n.push(e+s);return t=Aa(n),t},"indentWithPrefix"),$g=i(r=>{let e,t=Va(r),o,n=/^(\s*)/,s=/^(\s*)$/;for(let u of t){let c=n.exec(u)[1];(typeof o>"u"||c.length<o)&&!s.test(u)&&(o=c.length)}let a=[];for(let u of t)a.push(u.substr(o));return e=Aa(a),e},"normalize");var ds={};A(ds,{replaceAll:()=>kd,standard:()=>zg});var kd=i((r,e,t)=>r.replace(new RegExp(e,"g"),t),"replaceAll"),Bg=i(r=>{let e=r.split(`
8
- `),t=1/0;for(let o of e)if(o.trim().length>0){let n=o.match(/^(\s*)/);n&&(t=Math.min(t,n[1].length))}return t===1/0||t===0?r:e.map(o=>o.length>=t?o.slice(t):o).join(`
9
- `)},"stripIndent"),zg=i((r,e)=>{let t=r;return(!e||e.stripIndent)&&(t=Bg(t)),(!e||e.normalizeNewline)&&(t=t.replace(/\r\n/g,`
10
- `)),(!e||e.replaceTabs)&&(t=kd(t," /"," ")),(!e||e.stripLeadingTrailingEmptyLines)&&(t=t.replace(/^\s*[\r\n]/gm,"").replace(/\s*[\r\n]$/gm,"")),(!e||e.stripAllEmptyLines)&&(t=t.replace(/^\s*[\r\n]/gm,"")),t},"standard");var ms={};A(ms,{isBase64:()=>Ag,isUtf8:()=>Vg});var Ga={encode:i(r=>{if(typeof Buffer<"u")return Buffer.from(r,"utf8").toString("base64");if(typeof btoa<"u"){let e=new TextEncoder().encode(r),t=Array.from(e,o=>String.fromCharCode(o)).join("");return btoa(t)}else{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=new TextEncoder().encode(r),o="",n=0;for(;n<t.length;){let s=t[n++],a=n<t.length?t[n++]:0,u=n<t.length?t[n++]:0,c=s<<16|a<<8|u;o+=e.charAt(c>>18&63),o+=e.charAt(c>>12&63),o+=n-2<t.length?e.charAt(c>>6&63):"=",o+=n-1<t.length?e.charAt(c&63):"="}return o}},"encode"),decode:i(r=>{let e=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"=");if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("utf8");if(typeof atob<"u"){let t=atob(e),o=new Uint8Array(t.length);for(let n=0;n<t.length;n++)o[n]=t.charCodeAt(n);return new TextDecoder().decode(o)}else{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=[],n=0;for(;n<e.length;){let s=t.indexOf(e.charAt(n++)),a=t.indexOf(e.charAt(n++)),u=t.indexOf(e.charAt(n++)),c=t.indexOf(e.charAt(n++)),f=s<<18|a<<12|u<<6|c;o.push(f>>16&255),u!==64&&o.push(f>>8&255),c!==64&&o.push(f&255)}return new TextDecoder().decode(new Uint8Array(o))}},"decode")},ps=class{static{i(this,"Base64")}constructor(e,t){switch(t){case"string":this.refString=e;break;case"base64":this.refString=Fr.decode(e);break;case"base64uri":this.refString=Fr.decode(e)}}get simpleString(){return this.refString}get base64String(){return Fr.encode(this.refString)}get base64UriString(){return Fr.encodeUri(this.refString)}},Fr={encode:i(r=>Ga.encode(r),"encode"),encodeUri:i(r=>Ga.encode(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),"encodeUri"),decode:i(r=>Ga.decode(r),"decode"),isBase64:i(r=>/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$/.test(r),"isBase64")};var Vg=i(r=>{let t=new TextEncoder().encode(r),o=0;for(;o<t.length;){if(t[o]===9||t[o]===10||t[o]===13||32<=t[o]&&t[o]<=126){o+=1;continue}if(194<=t[o]&&t[o]<=223&&128<=t[o+1]&&t[o+1]<=191){o+=2;continue}if(t[o]===224&&160<=t[o+1]&&t[o+1]<=191&&128<=t[o+2]&&t[o+2]<=191||(225<=t[o]&&t[o]<=236||t[o]===238||t[o]===239)&&128<=t[o+1]&&t[o+1]<=191&&128<=t[o+2]&&t[o+2]<=191||t[o]===237&&128<=t[o+1]&&t[o+1]<=159&&128<=t[o+2]&&t[o+2]<=191){o+=3;continue}if(t[o]===240&&144<=t[o+1]&&t[o+1]<=191&&128<=t[o+2]&&t[o+2]<=191&&128<=t[o+3]&&t[o+3]<=191||241<=t[o]&&t[o]<=243&&128<=t[o+1]&&t[o+1]<=191&&128<=t[o+2]&&t[o+2]<=191&&128<=t[o+3]&&t[o+3]<=191||t[o]===244&&128<=t[o+1]&&t[o+1]<=143&&128<=t[o+2]&&t[o+2]<=191&&128<=t[o+3]&&t[o+3]<=191){o+=4;continue}return!1}return!0},"isUtf8"),Ag=i(r=>{let e=/[^A-Z0-9+\/=]/i,t=r.length;if(!t||t%4!==0||e.test(r))return!1;let o=r.indexOf("=");return o===-1||o===t-1||o===t-2&&r[t-1]==="="},"isBase64");var hs=class{static{i(this,"Domain")}constructor(e){this.protocol=this._protocolRegex(e),this.protocol||(e=`https://${e}`),this.nodeParsedUrl=new URL(e),this.port=this.nodeParsedUrl.port;let t=this._domainRegex(e.replace(this.nodeParsedUrl.pathname,""));this.fullName="";for(let o=1;o<=5;o++)if(t[o-1]){let n=t[o-1];this["level"+o.toString()]=n,this.fullName===""?this.fullName=n:this.fullName=n+"."+this.fullName}else this["level"+o.toString()]=void 0;this.zoneName=this.level2+"."+this.level1,this.topLevel=this.level1,this.domainName=this.level2,this.subDomain=this.level3}_domainRegex(e){let o=/([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}$/.exec(e);return o.reverse(),o.pop(),o.filter(function(s){return s!==""})}_protocolRegex(e){let o=/^([a-zA-Z0-9]*):\/\//.exec(e);if(o)return o[1]}_portRegex(e){let o=/^([a-zA-Z0-9]*):\/\//.exec(e);if(o)return o[1]}};var ys=class{static{i(this,"GitRepo")}constructor(e,t){let o=Gg(e);this.host=o[1],this.user=o[2],this.repo=o[3],this.accessToken=t,this.sshUrl=Id(this.host,this.user,this.repo,this.accessToken,"ssh"),this.httpsUrl=Id(this.host,this.user,this.repo,this.accessToken,"https")}},Gg=i(function(r){return/([a-zA-Z0-9\-_\.]*)(?:\/|\:)([a-zA-Z0-9\-_\.]*)(?:\/)([a-zA-Z0-9\-_\.]*)(?:\.git)/.exec(r)},"gitRegex"),Id=i(function(r,e,t,o="",n){let s;switch(o!==""&&(o=o+"@"),n){case"https":s="https://"+o+r+"/"+e+"/"+t+".git";break;case"ssh":s="git@"+r+":"+e+"/"+t+".git";break;default:console.error("Link Type "+n+" not known");break}return s},"gitLink");var _d=or(Cd(),1),xs=_d.default;var Rd=i(()=>globalThis.Buffer,"getNodeBuffer");function Kg(r){let e=Rd();return e?e.from(r).toString("base64"):btoa(String.fromCharCode(...r))}i(Kg,"base64Encode");function Qg(r){let e=Rd();if(e){let t=e.from(r,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return new Uint8Array(Array.from(atob(r)).map(t=>t.charCodeAt(0)))}i(Qg,"base64Decode");function Ka(r,e){return JSON.stringify(r,gs,e)}i(Ka,"stringify");function Qa(r){return JSON.parse(r,Nd)}i(Qa,"parse");var gs=i((r,e)=>{if(Zg(e)){let t;if("data"in e&&Wd(e.data))t=new Uint8Array(e.data);else if(e instanceof Uint8Array)t=e;else return e;return{type:"EncodedBuffer",data:"base64:"+Kg(t)}}return e},"replacer"),Nd=i((r,e)=>{if(Xg(e)&&Ja(e.data)&&e.data.startsWith("base64:")){let t=e.data.slice(7);return Qg(t)}return e},"reviver");function Xg(r){return Fd(r)&&r.type==="EncodedBuffer"&&Ja(r.data)}i(Xg,"isEncodedBuffer");function Zg(r){return Fd(r)&&r.type==="Buffer"&&(Wd(r.data)||Ja(r.data))||r instanceof Uint8Array}i(Zg,"isBufferLike");function Wd(r){return Array.isArray(r)}i(Wd,"isArray");function Ja(r){return typeof r=="string"}i(Ja,"isString");function Fd(r){return typeof r=="object"&&r!==null}i(Fd,"isObject");var ws=Qa,Xa=i(r=>r.split(`
11
- `).reduce((o,n)=>{let s=n.trim();return s.length>0&&o.push(ws(s)),o},[]),"parseJsonL"),tw=i(r=>r.map(e=>Gt(e)).join(`
12
- `),"stringifyJsonL"),rw=i((r,e,t={})=>{let o=new WeakSet,n=i(u=>{if(u===null||typeof u!="object")return u;let c=gs("",u);if(c&&c.type==="EncodedBuffer"&&typeof c.data=="string")return c;if(o.has(u))return"__cycle__";if(o.add(u),Array.isArray(u))return u.map(l=>n(l));let f={};for(let l of Object.keys(u))try{f[l]=n(u[l])}catch{f[l]="__unserializable__"}return f},"sanitize"),s=n(r),a={...t,cycles:!0};if(e&&!a.cmp){let u=new Map;e.forEach((c,f)=>u.set(c,f)),a.cmp=(c,f)=>{let l=u.has(c.key)?u.get(c.key):Number.POSITIVE_INFINITY,p=u.has(f.key)?u.get(f.key):Number.POSITIVE_INFINITY;return l!==p?l-p:c.key<f.key?-1:c.key>f.key?1:0}}return xs(s,a)},"stableOneWayStringify"),Gt=i((r,e,t={})=>{let o=Ka(r);r=JSON.parse(o);let n={...t};if(e&&!n.cmp){let a=new Map;e.forEach((u,c)=>a.set(u,c)),n.cmp=(u,c)=>{let f=a.has(u.key)?a.get(u.key):Number.POSITIVE_INFINITY,l=a.has(c.key)?a.get(c.key):Number.POSITIVE_INFINITY;return f!==l?f-l:u.key<c.key?-1:u.key>c.key?1:0}}return xs(r,n)},"stringify"),ow=i(r=>{let e=Gt(r),t=JSON.parse(e);return JSON.stringify(t,null,2)},"stringifyPretty"),nw=i((...r)=>{let e=Gt(...r);return Lr.base64.encodeUri(e)},"stringifyBase64"),iw=i(r=>{let e=Lr.base64,o=(e.decodeUri||e.decode)(r);return ws(o)},"parseBase64"),Za=class r{static{i(this,"Smartjson")}static enfoldFromObject(e){let t=new this,o=t.saveableProperties||[];for(let n in e)o.indexOf(n)!==-1&&(t[n]=e[n]);return t}static enfoldFromJson(e){let t=ws(e);return this.enfoldFromObject(t)}saveableProperties=[];foldToObject(){let e=new Set;return e.add(this),this.foldToObjectInternal(e)}foldToObjectInternal(e){let t={},o=i(s=>{if(s instanceof r){if(e.has(s))throw new Error("cycle detected");return e.add(s),s.foldToObjectInternal(e)}return Array.isArray(s)?s.map(a=>o(a)):structuredClone(s)},"foldValue"),n=this.saveableProperties||[];for(let s of n){let a=this[s];t[s]=o(a)}return t}foldToJson(){let e=this.foldToObject();return Gt(e)}},sw=i(()=>(r,e)=>{let t=String(e.name);e.addInitializer(function(){this.saveableProperties||(this.saveableProperties=[]),this.saveableProperties.includes(t)||this.saveableProperties.push(t)})},"foldDec"),Ld=i((r,e)=>{let t=Gt(r),o=Gt(e);return t===o},"deepEqualObjects"),aw=i((r,e)=>{let t=Xa(r),o=Xa(e);return Ld(t,o)},"deepEqualJsonLStrings");var Ro={};A(Ro,{TypedrequestCache:()=>eu,WebStore:()=>_o});var Yd={};var bs=class{static{i(this,"WebStoreDb")}constructor(e){this.nativeDb=e}async get(e,t,o={}){return this.runObjectStoreRequest(e,"readonly",n=>n.get(t),o)}async getKey(e,t,o={}){return this.runObjectStoreRequest(e,"readonly",n=>n.getKey(t),o)}async put(e,t,o,n={}){return this.runObjectStoreRequest(e,"readwrite",s=>o===void 0?s.put(t):s.put(t,o),n)}async delete(e,t,o={}){await this.runObjectStoreRequest(e,"readwrite",n=>n.delete(t),o)}async clear(e,t={}){await this.runObjectStoreRequest(e,"readwrite",o=>o.clear(),t)}async getAllKeys(e,t={}){return this.runObjectStoreRequest(e,"readonly",o=>o.getAllKeys(),t)}close(){this.nativeDb.close()}async runObjectStoreRequest(e,t,o,n){n.signal?.throwIfAborted();let s=this.nativeDb.transaction(e,t),a=s.objectStore(e),u=o(a),c,f=new Promise((p,m)=>{c=m}),l=i(()=>{try{s.abort()}catch(p){if(!(p instanceof DOMException)||p.name!=="InvalidStateError"){c(p);return}}n.signal&&c(n.signal.reason)},"abortTransaction");n.signal?.addEventListener("abort",l,{once:!0});try{let[p]=await Promise.race([Promise.all([uw(u),cw(s)]),f]);return p}catch(p){throw n.signal?.aborted?n.signal.reason:p}finally{n.signal?.removeEventListener("abort",l)}}},Hd=i(async(r,e)=>{if(e?.throwIfAborted(),!e)return r;let t,o=new Promise((s,a)=>{t=a}),n=i(()=>{t(e.reason)},"abortListener");e.addEventListener("abort",n,{once:!0});try{return await Promise.race([r,o])}finally{e.removeEventListener("abort",n)}},"awaitWithSignal"),uw=i(r=>new Promise((e,t)=>{r.onsuccess=()=>e(r.result),r.onerror=()=>t(vs("IndexedDB request failed",r.error))}),"indexedDbRequestToPromise"),cw=i(r=>new Promise((e,t)=>{r.oncomplete=()=>e(),r.onabort=()=>t(vs("IndexedDB transaction aborted",r.error)),r.onerror=()=>t(vs("IndexedDB transaction failed",r.error))}),"indexedDbTransactionToPromise"),vs=i((r,e)=>e?new Error(`${r}: ${e.message}`,{cause:e}):new Error(r),"createIndexedDbError"),jd=i((r,e)=>{r.objectStoreNames.contains(e)||r.createObjectStore(e)},"ensureObjectStore"),Ud=i(async(r,e,t)=>{if(!globalThis.indexedDB)throw new Error("IndexedDB is not available in this runtime");return new Promise((o,n)=>{let s=!1,a=typeof e=="number"?globalThis.indexedDB.open(r,e):globalThis.indexedDB.open(r),u=i(c=>{s||(s=!0,n(c instanceof Error?c:new Error(String(c))))},"rejectOnce");a.onupgradeneeded=()=>{if(t)try{t(a.result)}catch(c){a.transaction?.abort(),u(c)}},a.onsuccess=()=>{if(s){a.result.close();return}s=!0;let c=a.result;c.onversionchange=()=>c.close(),o(c)},a.onerror=()=>u(vs(`Failed to open IndexedDB database "${r}"`,a.error)),a.onblocked=()=>u(new Error(`Opening IndexedDB database "${r}" was blocked by another connection`))})},"openNativeDb"),fw=i(async(r,e)=>{let t=await Ud(r,void 0,n=>jd(n,e));if(t.objectStoreNames.contains(e))return new bs(t);let o=t.version+1;if(t.close(),t=await Ud(r,o,n=>jd(n,e)),!t.objectStoreNames.contains(e))throw t.close(),new Error(`Failed to create IndexedDB object store "${e}" in database "${r}"`);return new bs(t)},"openWebStoreDb"),_o=class{static{i(this,"WebStore")}constructor(e){this.lifecycleGeneration=0,this.closeCoveredGeneration=0,this.activeOperations=new Set,this.options=e}trackOperation(e){this.lifecycleGeneration+=1;let t;return t=(async()=>e())().finally(()=>{this.activeOperations.delete(t)}),this.activeOperations.add(t),t}init(e={}){return this.trackOperation(()=>this.initForOperation(e.signal))}async initForOperation(e){e?.throwIfAborted();let t=this.closePromise;return t&&(await Hd(t,e),e?.throwIfAborted()),this.initPromise||(this.initPromise=this.runInit().catch(o=>{throw this.initPromise=void 0,o})),Hd(this.initPromise,e)}async runInit(){let e=new Ze.Smartenv;if(!e.isBrowser&&!globalThis.indexedDB&&(await e.getSafeNodeModule("fake-indexeddb/auto"),!globalThis.indexedDB)){let t=await e.getSafeNodeModule("fake-indexeddb");globalThis.indexedDB=new t.IDBFactory}this.db=await fw(this.options.dbName,this.options.storeName)}runDataOperation(e,t){return this.trackOperation(async()=>(await this.initForOperation(t.signal),t.signal?.throwIfAborted(),e(this.db)))}close(){let e=this.lifecycleGeneration;if(this.closePromise&&e<=this.closeCoveredGeneration)return this.closePromise;let t=this.closePromise,o=[...this.activeOperations];if(!t&&!this.initPromise&&o.length===0)return Promise.resolve();let n;return n=(async()=>{try{if(t)try{await t}catch{}await Promise.allSettled(o);let s=this.initPromise;if(!s)return;try{await s}catch{return}finally{this.initPromise===s&&(this.initPromise=void 0)}this.db.close()}finally{this.closePromise===n&&(this.closePromise=void 0)}})(),this.closePromise=n,this.closeCoveredGeneration=e,n}async get(e,t={}){return this.runDataOperation(o=>o.get(this.options.storeName,e,t),t)}async check(e,t={}){return this.runDataOperation(async o=>await o.getKey(this.options.storeName,e,t)!==void 0,t)}async set(e,t,o={}){return this.runDataOperation(n=>n.put(this.options.storeName,t,e,o),o)}async delete(e,t={}){return this.runDataOperation(o=>o.delete(this.options.storeName,e,t),t)}async clear(e={}){return this.runDataOperation(t=>t.clear(this.options.storeName,e),e)}async keys(e={}){return this.runDataOperation(t=>t.getAllKeys(this.options.storeName,e),e)}};var eu=class{static{i(this,"TypedrequestCache")}constructor(e="default"){this.webstore=new _o({dbName:"trStore",storeName:`trStore-${e}`})}buildKey(e){return Jt.stringify({method:e.method,request:e.request})}async setByRequest(e){if(!e.response)throw new Error("You cannot store requests without a response present");await this.webstore.set(this.buildKey(e),e)}async getByRequest(e){return await this.webstore.get(this.buildKey(e))}};var No=256,Yr=class{static{i(this,"CacheStore")}constructor(e="webrequest-v4",t="cache"){this.lifecycleController=new AbortController,this.closeReason=new Error("Webrequest cache store is closed"),this.disposed=!1,this.pruneGeneration=0,this.pruneWaiters=new Set,this.activeOwnedOperations=new Set,this.webstore=new Ro.WebStore({dbName:e,storeName:t}),this.initPromise=this.init()}async init(){}generateCacheKey(e){let t=e.url,o=e.method;return o==="GET"?t:`${o}:${t}`}async set(e,t,o={}){await this.initPromise;let n=this.getOperationSignal(o.signal),s=o.maxEntries??No;if(!Number.isSafeInteger(s)||s<=0)throw new RangeError("webrequest cache maxEntries must be a positive safe integer");await this.webstore.set(e,t,{signal:n}),await this.schedulePrune(s,n)}async get(e,t={}){await this.initPromise;let o=this.getOperationSignal(t.signal);try{let n=await this.webstore.get(e,{signal:o});return n===void 0?null:this.isCacheEntry(n)?n:(await this.webstore.delete(e,{signal:o}),null)}catch{if(o.aborted)throw o.reason;return null}}async has(e,t={}){return await this.get(e,t)!==null}async delete(e,t={}){await this.initPromise;let o=this.getOperationSignal(t.signal);await this.webstore.delete(e,{signal:o})}async clear(e={}){await this.initPromise;let t=this.getOperationSignal(e.signal);await this.webstore.clear({signal:t})}responseFromCacheEntry(e){let t=new Headers(e.headers);return new Response(e.response,{status:e.status,statusText:e.statusText,headers:t})}cacheEntryFromResponse(e,t,o,n={}){return this.trackOwnedOperation(async()=>{let s=this.getOperationSignal(n.signal),a=n.preserveResponse!==!1,u=a?t.clone():t,c=await this.consumeArrayBuffer(u,s,a?t.body:void 0,n.responseSignal),f={};return u.headers.forEach((l,p)=>{f[p]=l}),{response:c,headers:f,timestamp:Date.now(),etag:o?.etag||u.headers.get("etag")||void 0,lastModified:o?.lastModified||u.headers.get("last-modified")||void 0,maxAge:o?.maxAge,url:e,status:u.status,statusText:u.statusText}})}async pruneExpired(e={}){await this.initPromise;let t=this.getOperationSignal(e.signal),o=await this.collectEntries(t),n=0;for(let s of o)t.throwIfAborted(),!(s.valid&&!this.isExpired(s))&&(await this.webstore.delete(s.key,{signal:t}),n+=1);return n}async schedulePrune(e,t){t?.throwIfAborted();let o=++this.pruneGeneration;this.pendingPruneMaxEntries=this.pendingPruneMaxEntries===void 0?e:Math.min(this.pendingPruneMaxEntries,e);let n,s,a=new Promise((c,f)=>{n=c,s=f}),u={generation:o,resolve:n,reject:s};this.pruneWaiters.add(u),this.ensurePruneLoop();try{await lw(a,t)}finally{this.pruneWaiters.delete(u)}}ensurePruneLoop(){if(this.pruneLoopPromise)return this.pruneLoopPromise;let e;return e=this.runPruneLoop().catch(t=>{this.pendingPruneMaxEntries=void 0,this.settlePruneWaiters(this.pruneGeneration,t)}).finally(()=>{this.pruneLoopPromise===e&&(this.pruneLoopPromise=void 0,this.pendingPruneMaxEntries!==void 0&&!this.disposed&&this.ensurePruneLoop())}),this.pruneLoopPromise=e,e}async runPruneLoop(){for(;this.pendingPruneMaxEntries!==void 0;){let e=this.pendingPruneMaxEntries;this.pendingPruneMaxEntries=void 0;let t=this.pruneGeneration;await this.pruneToLimit(e,this.lifecycleController.signal),this.settlePruneWaiters(t)}}settlePruneWaiters(e,t){for(let o of this.pruneWaiters)o.generation>e||(this.pruneWaiters.delete(o),t===void 0?o.resolve():o.reject(t))}async pruneToLimit(e,t){let o=await this.collectEntries(t),n=o.filter(u=>!u.valid||this.isExpired(u));for(let u of n)t?.throwIfAborted(),await this.webstore.delete(u.key,{signal:t});let s=o.filter(u=>u.valid&&!this.isExpired(u)).sort((u,c)=>u.timestamp===c.timestamp?u.key.localeCompare(c.key):(u.timestamp??0)-(c.timestamp??0)),a=Math.max(0,s.length-e);for(let u of s.slice(0,a))t?.throwIfAborted(),await this.webstore.delete(u.key,{signal:t})}async collectEntries(e){e?.throwIfAborted();let t=await this.webstore.keys({signal:e}),o=[];for(let n of t)if(e?.throwIfAborted(),typeof n=="string")try{let s=await this.webstore.get(n,{signal:e});o.push(this.isCacheEntry(s)?{key:n,valid:!0,timestamp:s.timestamp,maxAge:s.maxAge}:{key:n,valid:!1,timestamp:0})}catch{if(e?.aborted)throw e.reason;continue}return o}isCacheEntry(e){if(!e||typeof e!="object")return!1;let t=Reflect.get(e,"response"),o=Reflect.get(e,"headers"),n=Reflect.get(e,"timestamp"),s=Reflect.get(e,"url"),a=Reflect.get(e,"status"),u=Reflect.get(e,"statusText");return t instanceof ArrayBuffer&&typeof o=="object"&&o!==null&&Number.isFinite(n)&&typeof s=="string"&&Number.isInteger(a)&&typeof u=="string"}isExpired(e){return e.maxAge!==void 0&&e.maxAge>0&&Date.now()-e.timestamp>=e.maxAge}getOperationSignal(e){if(this.disposed)throw this.closeReason;return e?.throwIfAborted(),e?AbortSignal.any([e,this.lifecycleController.signal]):this.lifecycleController.signal}trackOwnedOperation(e){let t;return t=e().finally(()=>{this.activeOwnedOperations.delete(t)}),this.activeOwnedOperations.add(t),t}close(){if(this.closePromise)return this.closePromise;this.disposed=!0,this.lifecycleController.abort(this.closeReason);let e=this.pruneLoopPromise,t=[...this.activeOwnedOperations];return this.closePromise=(async()=>{await Promise.allSettled([...t,...e?[e]:[]]),await this.webstore.close()})(),this.closePromise}async consumeArrayBuffer(e,t,o,n){if(t?.throwIfAborted(),!t)return e.arrayBuffer();let s=e.body?.getReader();if(!s)return new ArrayBuffer(0);let a=[],u=0,c,f=new Promise((x,g)=>{c=g}),l,p=i(()=>{c(t.reason),n?.aborted||(l=Promise.all([s.cancel(t.reason).catch(()=>{}),o?.cancel(t.reason).catch(()=>{})]).then(()=>{}))},"abortListener");t.addEventListener("abort",p,{once:!0});try{for(;;){let x=await Promise.race([s.read(),f]);if(x.done)break;a.push(x.value),u+=x.value.byteLength}}finally{t.removeEventListener("abort",p),l&&await l;try{s.releaseLock()}catch{}}let m=new Uint8Array(u),h=0;for(let x of a)m.set(x,h),h+=x.byteLength;return m.buffer}},lw=i(async(r,e)=>{if(e?.throwIfAborted(),!e)return r;let t,o=new Promise((s,a)=>{t=a}),n=i(()=>{t(e.reason)},"abortListener");e.addEventListener("abort",n,{once:!0});try{return await Promise.race([r,o])}finally{e.removeEventListener("abort",n)}},"awaitWithSignal");function dw(r){let e={maxAge:0,immutable:!1,noCache:!1,noStore:!1,mustRevalidate:!1};if(!r)return e;let t=r.toLowerCase().split(",").map(o=>o.trim());for(let o of t)if(o==="no-cache")e.noCache=!0;else if(o==="no-store")e.noStore=!0;else if(o==="immutable")e.immutable=!0;else if(o==="must-revalidate")e.mustRevalidate=!0;else if(o.startsWith("max-age=")){let n=parseInt(o.split("=")[1],10);isNaN(n)||(e.maxAge=n*1e3)}return e}i(dw,"parseCacheControl");function pw(r){if(r)try{return new Date(r).getTime()}catch{return}}i(pw,"parseExpires");function Je(r){let e=r.get("cache-control"),t=r.get("expires"),o=r.get("etag"),n=r.get("last-modified"),s=dw(e);if(s.maxAge===0&&t){let a=pw(t);a&&(s.maxAge=Math.max(0,a-Date.now()))}return{maxAge:s.maxAge||0,etag:o||void 0,lastModified:n||void 0,immutable:s.immutable||!1,noCache:s.noCache||!1,noStore:s.noStore||!1,mustRevalidate:s.mustRevalidate||!1}}i(Je,"extractCacheMetadata");function Ds(r,e){if(e.noStore)return!1;if(e.immutable)return!0;let t=Date.now()-r.timestamp,o=r.maxAge||e.maxAge||0;return o===0?!1:t<o}i(Ds,"isFresh");function qr(r){return r.noCache||r.mustRevalidate}i(qr,"requiresRevalidation");function Ss(r){let e={};return r.etag&&(e["if-none-match"]=r.etag),r.lastModified&&(e["if-modified-since"]=r.lastModified),e}i(Ss,"createConditionalHeaders");function Ms(r){let e={};return r.forEach((t,o)=>{e[o]=t}),e}i(Ms,"headersToObject");function $d(r){let e=new Headers;return Object.entries(r).forEach(([t,o])=>{e.set(t,o)}),e}i($d,"objectToHeaders");function mw(r){let e=new AbortController,t=!1,o=!1,n=new j.Timeout(r,null);return n.promise.then(()=>{t=!0,e.abort()}),{controller:e,cleanup:i(()=>{o||(o=!0,n.cancel())},"cleanup"),didTimeout:i(()=>t,"didTimeout")}}i(mw,"createTimeoutController");var Bd=Symbol("webrequestTimeoutError"),Et=i((r,e)=>{let t=new Error(`Request timeout after ${e}ms: ${r}`);return Object.defineProperty(t,Bd,{configurable:!1,enumerable:!1,value:!0,writable:!1}),t},"createTimeoutError"),Wo=i(r=>r instanceof Error&&Reflect.get(r,Bd)===!0,"isWebrequestTimeoutError");async function tu(r,e,t){let o=r instanceof Request?r.url:String(r),{controller:n,cleanup:s,didTimeout:a}=mw(t),u=e.signal?AbortSignal.any([e.signal,n.signal]):n.signal;try{let c=await fetch(r,{...e,signal:u});return s(),c}catch(c){throw s(),a()?Et(o,t):c}}i(tu,"fetchWithTimeout");var zd=i(r=>{if(r.reason instanceof Error)return r.reason;let e=new Error("The request was aborted");return e.name="AbortError",e},"normalizeAbortReason");async function Vd(r,e){if(e.signal?.aborted){let l=zd(e.signal);throw await r.body?.cancel(l).catch(()=>{}),l}if(e.bodyTimeoutMs!==void 0&&e.bodyTimeoutMs<=0){let l=Et(e.url,e.reportedTimeoutMs??e.bodyTimeoutMs);throw await r.body?.cancel(l).catch(()=>{}),l}if(e.bodyTimeoutMs===void 0&&!e.signal)return await r.json();let t=r.body?.getReader();if(!t)return JSON.parse("");let o,n,s,a=new Promise((l,p)=>{s=p}),u=i(l=>{o||(o=l,t.cancel(l).catch(()=>{}),s(l))},"terminate"),c=i(()=>{e.signal&&u(zd(e.signal))},"abortListener");if(e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c,{once:!0})),e.bodyTimeoutMs!==void 0){let l=e.reportedTimeoutMs??e.bodyTimeoutMs;n=setTimeout(()=>{u(Et(e.url,l))},e.bodyTimeoutMs)}let f=i(async()=>{let l=new TextDecoder,p="";for(;;){let m;try{m=await t.read()}catch(h){throw o||h}if(o)throw o;if(m.done)break;p+=l.decode(m.value,{stream:!0})}if(p+=l.decode(),o)throw o;return JSON.parse(p)},"readBody");try{return await Promise.race([f(),a])}finally{n!==void 0&&clearTimeout(n),e.signal?.removeEventListener("abort",c);try{t.releaseLock()}catch{}}}i(Vd,"consumeJsonWithTimeout");var Os=class{static{i(this,"NetworkFirstStrategy")}async execute(e){let t;try{return t=await e.fetchFn(e.request),t.ok&&await this.cacheResponse(e,t),{response:t,fromCache:!1,revalidated:!1}}catch(o){if(await Hr(t,o,e.request.signal),e.signal?.aborted)throw e.signal.reason;if(Wo(o))throw o;e.logging&&console.log("[webrequest] Network failed, trying cache:",o);let n=await e.cacheStore.get(e.cacheKey,{signal:e.signal});if(n)return{response:e.cacheStore.responseFromCacheEntry(n),fromCache:!0,revalidated:!1};throw o}}async cacheResponse(e,t){let o=Je(t.headers);if(o.maxAge=Fo(o.maxAge,e.cacheMaxAge),o.noStore)return;let n=await e.cacheStore.cacheEntryFromResponse(e.request.url,t,o,{signal:e.signal,responseSignal:e.request.signal});await e.cacheStore.set(e.cacheKey,n,{signal:e.signal,maxEntries:e.cacheMaxEntries})}},ru=class{static{i(this,"CacheFirstStrategy")}async execute(e){let t=await e.cacheStore.get(e.cacheKey,{signal:e.signal});if(t){let s=Je(new Headers(t.headers));if(Ad(e,t,s)&&!qr(s))return e.logging&&console.log("[webrequest] Cache hit (fresh):",e.request.url),{response:e.cacheStore.responseFromCacheEntry(t),fromCache:!0,revalidated:!1};if(qr(s)&&(t.etag||t.lastModified))return await this.revalidate(e,t)}e.logging&&console.log("[webrequest] Cache miss, fetching:",e.request.url);let o=await e.fetchFn(e.request),n=Je(o.headers);if(n.maxAge=Fo(n.maxAge,e.cacheMaxAge),!n.noStore)try{let s=await e.cacheStore.cacheEntryFromResponse(e.request.url,o,n,{signal:e.signal,responseSignal:e.request.signal});await e.cacheStore.set(e.cacheKey,s,{signal:e.signal,maxEntries:e.cacheMaxEntries})}catch(s){throw await Hr(o,s,e.request.signal),s}return{response:o,fromCache:!1,revalidated:!1}}async revalidate(e,t){let o=Ss(t),n=new Request(e.request.url,{method:e.request.method,headers:{...Ms(e.request.headers),...o},signal:e.signal}),s;try{if(s=await e.fetchFn(n),s.status===304)return e.logging&&console.log("[webrequest] Cache revalidated (304):",e.request.url),t.timestamp=Date.now(),await e.cacheStore.set(e.cacheKey,t,{signal:e.signal,maxEntries:e.cacheMaxEntries}),await Hr(s,"304 response replaced by cached response",n.signal),{response:e.cacheStore.responseFromCacheEntry(t),fromCache:!0,revalidated:!0};if(s.ok){let a=Je(s.headers);if(a.maxAge=Fo(a.maxAge,e.cacheMaxAge),!a.noStore){let u=await e.cacheStore.cacheEntryFromResponse(e.request.url,s,a,{signal:e.signal,responseSignal:n.signal});await e.cacheStore.set(e.cacheKey,u,{signal:e.signal,maxEntries:e.cacheMaxEntries})}}return{response:s,fromCache:!1,revalidated:!0}}catch(a){if(await Hr(s,a,n.signal),e.signal?.aborted)throw e.signal.reason;if(Wo(a))throw a;return e.logging&&console.log("[webrequest] Revalidation failed, using cache:",a),{response:e.cacheStore.responseFromCacheEntry(t),fromCache:!0,revalidated:!1}}}},ou=class{static{i(this,"StaleWhileRevalidateStrategy")}async execute(e){let t=await e.cacheStore.get(e.cacheKey,{signal:e.signal});if(t){let s=e.cacheStore.responseFromCacheEntry(t);return e.scheduleBackgroundRevalidation(async a=>{let u={...e,request:new Request(e.request,{signal:a}),signal:a};await this.revalidateInBackground(u,t)}),{response:s,fromCache:!0,revalidated:!1}}let o=await e.fetchFn(e.request),n=Je(o.headers);if(n.maxAge=Fo(n.maxAge,e.cacheMaxAge),!n.noStore&&o.ok)try{let s=await e.cacheStore.cacheEntryFromResponse(e.request.url,o,n,{signal:e.signal,responseSignal:e.request.signal});await e.cacheStore.set(e.cacheKey,s,{signal:e.signal,maxEntries:e.cacheMaxEntries})}catch(s){throw await Hr(o,s,e.request.signal),s}return{response:o,fromCache:!1,revalidated:!1}}async revalidateInBackground(e,t){let o=Je(new Headers(t.headers));if(Ad(e,t,o)&&!qr(o))return;let n;try{if(e.signal?.throwIfAborted(),n=await e.fetchFn(e.request),n.ok){let s=Je(n.headers);if(s.maxAge=Fo(s.maxAge,e.cacheMaxAge),!s.noStore){let a=await e.cacheStore.cacheEntryFromResponse(e.request.url,n,s,{signal:e.signal,responseSignal:e.request.signal,preserveResponse:!1});await e.cacheStore.set(e.cacheKey,a,{signal:e.signal,maxEntries:e.cacheMaxEntries}),e.logging&&console.log("[webrequest] Background revalidation complete:",e.request.url)}}}catch(s){if(e.signal?.aborted)return;e.logging&&console.warn("[webrequest] Background revalidation failed:",s)}finally{await Hr(n,"background revalidation response discarded",e.request.signal)}}},nu=class{static{i(this,"NetworkOnlyStrategy")}async execute(e){return{response:await e.fetchFn(e.request),fromCache:!1,revalidated:!1}}},iu=class{static{i(this,"CacheOnlyStrategy")}async execute(e){let t=await e.cacheStore.get(e.cacheKey,{signal:e.signal});if(!t)throw new Error(`Cache miss for ${e.request.url} (cache-only mode)`);return{response:e.cacheStore.responseFromCacheEntry(t),fromCache:!0,revalidated:!1}}},Fo=i((r,e)=>e===void 0?r:Math.min(r,e),"resolveEffectiveMaxAge"),Ad=i((r,e,t)=>Ds(e,t)?r.cacheMaxAge===void 0?!0:Date.now()-e.timestamp<r.cacheMaxAge:!1,"isFreshForContext"),Hr=i(async(r,e,t)=>{!r?.body||r.bodyUsed||t?.aborted||await r.body.cancel(e).catch(()=>{})},"cancelDiscardedResponse");function Gd(r){switch(r){case"network-first":return new Os;case"cache-first":return new ru;case"stale-while-revalidate":return new ou;case"network-only":return new nu;case"cache-only":return new iu;default:return new Os}}i(Gd,"getStrategyHandler");var jr=class{static{i(this,"CacheManager")}constructor(e,t,o){this.lifecycleController=new AbortController,this.closeReason=new Error("Webrequest cache manager is closed"),this.disposed=!1,this.backgroundRevalidations=new Map,this.cacheStore=o??new Yr(e,t)}async execute(e,t,o){if(this.disposed)throw this.closeReason;e.signal.throwIfAborted();let n=this.determineStrategy(e,t);if(n==="network-only")return{response:await o(e),fromCache:!1,revalidated:!1};let s=t.cacheMaxEntries??No;if(!Number.isSafeInteger(s)||s<=0)throw new RangeError("webrequest cacheMaxEntries must be a positive safe integer");if(t.cacheMaxAge!==void 0&&(!Number.isSafeInteger(t.cacheMaxAge)||t.cacheMaxAge<0))throw new RangeError("webrequest cacheMaxAge must be a non-negative safe integer");let a=t.timeout??6e4,u=new AbortController,c=setTimeout(()=>{u.abort(Et(e.url,a))},Math.max(0,a)),f=AbortSignal.any([e.signal,this.lifecycleController.signal,u.signal]);try{let l=this.generateCacheKey(e,t),p=Gd(n),m={request:e,cacheKey:l,cacheStore:this.cacheStore,fetchFn:o,logging:t.logging,signal:f,cacheMaxAge:t.cacheMaxAge,cacheMaxEntries:s,scheduleBackgroundRevalidation:i(h=>{this.scheduleBackgroundRevalidation(l,e.url,a,h)},"scheduleBackgroundRevalidation")};return await p.execute(m)}finally{clearTimeout(c)}}determineStrategy(e,t){return t.cacheStrategy?t.cacheStrategy:t.cache?this.mapCacheModeToStrategy(t.cache):e.cache?this.mapCacheModeToStrategy(e.cache):"network-first"}mapCacheModeToStrategy(e){switch(e){case"default":return"network-first";case"no-store":case"reload":return"network-only";case"no-cache":return"network-first";case"force-cache":return"cache-first";case"only-if-cached":return"cache-only";default:return"network-first"}}generateCacheKey(e,t){return t.cacheKey?typeof t.cacheKey=="function"?t.cacheKey(e):t.cacheKey:this.cacheStore.generateCacheKey(e)}async clear(){await this.cacheStore.clear()}async delete(e){await this.cacheStore.delete(e)}async has(e){return await this.cacheStore.has(e)}getStore(){return this.cacheStore}scheduleBackgroundRevalidation(e,t,o,n){if(this.disposed||this.backgroundRevalidations.has(e))return;let s=new AbortController,a=AbortSignal.any([this.lifecycleController.signal,s.signal]),u=setTimeout(()=>{s.abort(Et(t,o))},Math.max(0,o)),c;c=n(a).catch(()=>{}).finally(()=>{clearTimeout(u),this.backgroundRevalidations.get(e)===c&&this.backgroundRevalidations.delete(e)}),this.backgroundRevalidations.set(e,c)}close(){if(this.closePromise)return this.closePromise;this.disposed=!0,this.lifecycleController.abort(this.closeReason);let e=[...this.backgroundRevalidations.values()];return this.closePromise=(async()=>{await Promise.allSettled(e),await this.cacheStore.close()})(),this.closePromise}};var Es=class{static{i(this,"ExponentialBackoff")}calculate(e,t,o){let n=t*Math.pow(2,e-1);return Math.min(n,o)}},su=class{static{i(this,"LinearBackoff")}calculate(e,t,o){let n=t*e;return Math.min(n,o)}},au=class{static{i(this,"ConstantBackoff")}calculate(e,t,o){return Math.min(t,o)}};function Jd(r){switch(r){case"exponential":return new Es;case"linear":return new su;case"constant":return new au;default:return new Es}}i(Jd,"getBackoffCalculator");function Kd(r,e=.1){let t=r*e*Math.random();return r+t}i(Kd,"addJitter");var Ur=class{static{i(this,"RetryManager")}constructor(e={},t){this.signal=t,this.options={maxAttempts:e.maxAttempts??3,backoff:e.backoff??"exponential",initialDelay:e.initialDelay??1e3,maxDelay:e.maxDelay??3e4,retryOn:e.retryOn??[408,429,500,502,503,504],onRetry:e.onRetry??(()=>{})}}async execute(e,t){let o;for(let n=1;n<=this.options.maxAttempts;n++){this.throwIfAborted();try{let s=await e();if(s instanceof Response&&this.shouldRetryResponse(s)){if(n===this.options.maxAttempts)return s;await this.cancelResponseBody(s,`Retrying after HTTP ${s.status}`);let a=this.calculateDelay(n);this.options.onRetry(n,new Error(`HTTP ${s.status}`),a),await this.delay(a);continue}return s}catch(s){if(this.signal?.aborted)throw this.getAbortError();o=s instanceof Error?s:new Error(String(s));let a=t?t(s,n):this.shouldRetryError(s);if(n===this.options.maxAttempts||!a)throw o;let u=this.calculateDelay(n);this.options.onRetry(n,o,u),await this.delay(u)}}throw o||new Error("Max retry attempts reached")}async executeWithFallbacks(e,t,o){if(e.length===0)throw new Error("No URLs provided for fallback execution");let n,s=[];for(let a of e){this.throwIfAborted();try{let u=await this.execute(async()=>await o(a,t));if(u.status<400||u.status>=400&&u.status<500&&u.status!==408)return u;await this.cancelResponseBody(u,`Trying fallback after HTTP ${u.status}`),s.push(a),n=new Error(`Request failed with status ${u.status}`)}catch(u){if(this.signal?.aborted)throw this.getAbortError();s.push(a),n=u instanceof Error?u:new Error(String(u))}}throw new Error(`All URLs failed: ${s.join(", ")}. Last error: ${n?.message||"Unknown error"}`)}shouldRetryResponse(e){let t=this.options.retryOn;return typeof t=="function"?t(e):Array.isArray(t)?t.includes(e.status):!1}shouldRetryError(e){if(e instanceof TypeError&&e.message.includes("fetch")||e.name==="AbortError"||e.message.includes("timeout"))return!0;let t=this.options.retryOn;return typeof t=="function"?t(void 0,e):!1}calculateDelay(e){let o=Jd(this.options.backoff).calculate(e,this.options.initialDelay,this.options.maxDelay);return Kd(o)}async delay(e){if(!this.signal){await j.delayFor(e);return}if(this.signal.aborted)throw this.getAbortError();let t=new j.Timeout(e,null),o,n=new Promise((a,u)=>{o=u}),s=i(()=>{t.cancel(),o(this.getAbortError())},"abortListener");try{this.signal.addEventListener("abort",s,{once:!0}),this.signal.aborted&&s(),await Promise.race([t.promise,n])}finally{t.cancel(),this.signal.removeEventListener("abort",s)}}async cancelResponseBody(e,t){await e.body?.cancel(t).catch(()=>{})}throwIfAborted(){if(this.signal?.aborted)throw this.getAbortError()}getAbortError(){if(this.signal?.reason instanceof Error)return this.signal.reason;let e=new Error("The request was aborted");return e.name="AbortError",e}};var $r=class{static{i(this,"RequestDeduplicator")}constructor(){this.inFlightRequests=new Map}generateKey(e){let t=e.url,o=e.method;return o==="GET"||o==="HEAD"?`${o}:${t}`:`${o}:${t}:${Date.now()}`}async execute(e,t){let o=this.inFlightRequests.get(e);if(o){let s=await o.promise;return{response:this.cloneValue(s),wasDeduplicated:!0}}let n=F.defer();this.inFlightRequests.set(e,n);try{let s=await t();return n.resolve(s),this.inFlightRequests.delete(e),{response:s,wasDeduplicated:!1}}catch(s){throw n.reject(s),this.inFlightRequests.delete(e),s}}isInFlight(e){return this.inFlightRequests.has(e)}getInFlightCount(){return this.inFlightRequests.size}clear(){this.inFlightRequests.clear()}cloneValue(e){return e instanceof Response?e.clone():{...e,response:e.response.clone()}}};var Kt=class{static{i(this,"WebrequestClient")}constructor(e={}){this.closeReason=new Error("Webrequest client is closed"),this.disposed=!1,this.defaultOptions=e,this.interceptorManager=new Wr,this.cacheManager=new jr,this.deduplicator=new $r}addRequestInterceptor(e){this.interceptorManager.addRequestInterceptor(e)}addResponseInterceptor(e){this.interceptorManager.addResponseInterceptor(e)}addErrorInterceptor(e){this.interceptorManager.addErrorInterceptor(e)}removeRequestInterceptor(e){this.interceptorManager.removeRequestInterceptor(e)}removeResponseInterceptor(e){this.interceptorManager.removeResponseInterceptor(e)}removeErrorInterceptor(e){this.interceptorManager.removeErrorInterceptor(e)}clearInterceptors(){this.interceptorManager.clearAll()}async clearCache(){await this.cacheManager.clear()}async deleteCache(e){await this.cacheManager.delete(e)}async request(e,t={}){return(await this.requestWithMetadata(e,t)).response}async requestWithMetadata(e,t={}){if(this.disposed)throw this.closeReason;let o={...this.defaultOptions,...t},n;if(typeof e=="string"?n=new Request(e,o):n=e,n=await this.interceptorManager.processRequest(n),o.interceptors?.request)for(let a of o.interceptors.request)n=await a(n);if(o.deduplicate??!1){let a=this.deduplicator.generateKey(n);return(await this.deduplicator.execute(a,async()=>await this.executeRequest(n,o))).response}return await this.executeRequest(n,o)}async executeRequest(e,t){try{let o=typeof t.retry=="object"?t.retry:t.retry?{}:void 0,n=i(async c=>{let f=t.timeout??6e4,l={...t};return delete l.body,delete l.headers,delete l.method,delete l.signal,await tu(c,{...l,signal:c.signal},f)},"fetchFnForRequest"),s=i(async(c,f)=>{let l=t.timeout??6e4;return await tu(c,f,l)},"fetchFnForFallbacks"),a;if(o){let c=new Ur(o,t.signal);if(t.fallbackUrls&&t.fallbackUrls.length>0){let f=[e.url,...t.fallbackUrls];a={response:await c.executeWithFallbacks(f,{method:e.method,headers:e.headers,body:e.body,...t},s),fromCache:!1,revalidated:!1}}else{let f,l=await c.execute(async()=>{let p=await this.cacheManager.execute(e,t,n);return f=p,p.response});a=f?.response===l?f:{response:l,fromCache:!1,revalidated:!1}}}else a=await this.cacheManager.execute(e,t,n);let u=await this.interceptorManager.processResponse(a.response);if(t.interceptors?.response)for(let c of t.interceptors.response)u=await c(u);return hw(u,a)}catch(o){throw await this.interceptorManager.processError(o instanceof Error?o:new Error(String(o)))}}async close(){return this.closePromise?this.closePromise:(this.disposed=!0,this.closePromise=this.cacheManager.close(),this.closePromise)}async requestJsonWithMetadata(e,t){let o={...this.defaultOptions,...t},n=o.timeout??6e4,s=o.retry?void 0:performance.now()+n,a=s===void 0?void 0:new AbortController,u=a?o.signal?AbortSignal.any([o.signal,a.signal]):a.signal:o.signal,c=a===void 0?void 0:setTimeout(()=>{a.abort(Et(e,n))},Math.max(0,n));try{let f=await this.requestWithMetadata(e,{...t,signal:u}),l=f.response;if(u?.aborted)throw await l.body?.cancel(u.reason).catch(()=>{}),u.reason instanceof Error?u.reason:new Error("The request was aborted");if(!l.ok)throw await l.body?.cancel(`HTTP ${l.status}`).catch(()=>{}),new Error(`HTTP ${l.status}: ${l.statusText}`);let p=s===void 0?n:s-performance.now(),m=await Vd(l,{bodyTimeoutMs:p,reportedTimeoutMs:n,signal:u,url:e});return Object.freeze({data:m,response:l,metadata:f.metadata})}catch(f){throw u?.aborted&&u.reason instanceof Error?u.reason:f}finally{c!==void 0&&clearTimeout(c)}}async getJson(e,t={}){return(await this.getJsonWithMetadata(e,t)).data}async getJsonWithMetadata(e,t={}){return await this.requestJsonWithMetadata(e,{...t,method:"GET",headers:{Accept:"application/json",...t.headers||{}}})}async postJson(e,t,o={}){return(await this.postJsonWithMetadata(e,t,o)).data}async postJsonWithMetadata(e,t,o={}){return await this.requestJsonWithMetadata(e,{...o,method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...o.headers||{}},body:JSON.stringify(t)})}async putJson(e,t,o={}){return(await this.putJsonWithMetadata(e,t,o)).data}async putJsonWithMetadata(e,t,o={}){return await this.requestJsonWithMetadata(e,{...o,method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json",...o.headers||{}},body:JSON.stringify(t)})}async deleteJson(e,t={}){return(await this.deleteJsonWithMetadata(e,t)).data}async deleteJsonWithMetadata(e,t={}){return await this.requestJsonWithMetadata(e,{...t,method:"DELETE",headers:{Accept:"application/json",...t.headers||{}}})}},hw=i((r,e)=>{let t=Object.freeze({fromCache:e.fromCache,revalidated:e.revalidated});return Object.freeze({response:r,metadata:t})},"createResponseResult");var xe=new Kt;async function se(r,e){let t=r instanceof Request?r.url:String(r),o=r instanceof Request?r:new Request(t,e);return await xe.request(o,e)}i(se,"webrequest"),se.requestWithMetadata=async function(r,e){let t=r instanceof Request?r.url:String(r),o=r instanceof Request?r:new Request(t,e);return await xe.requestWithMetadata(o,e)},se.getJson=async function(r,e){return await xe.getJson(r,e)},se.getJsonWithMetadata=async function(r,e){return await xe.getJsonWithMetadata(r,e)},se.postJson=async function(r,e,t){return await xe.postJson(r,e,t)},se.postJsonWithMetadata=async function(r,e,t){return await xe.postJsonWithMetadata(r,e,t)},se.putJson=async function(r,e,t){return await xe.putJson(r,e,t)},se.putJsonWithMetadata=async function(r,e,t){return await xe.putJsonWithMetadata(r,e,t)},se.deleteJson=async function(r,e){return await xe.deleteJson(r,e)},se.deleteJsonWithMetadata=async function(r,e){return await xe.deleteJsonWithMetadata(r,e)},se.addRequestInterceptor=function(r){xe.addRequestInterceptor(r)},se.addResponseInterceptor=function(r){xe.addResponseInterceptor(r)},se.addErrorInterceptor=function(r){xe.addErrorInterceptor(r)},se.clearInterceptors=function(){xe.clearInterceptors()},se.clearCache=async function(){await xe.clearCache()},se.createClient=function(r){return new Kt(r)},se.getDefaultClient=function(){return xe};var Lo=or(Us(),1);var yw=1e4,Qd=new WeakSet,Xd=new WeakMap,uu=i(r=>{Qd.add(r)},"authorizeVirtualStreamApplicationUse"),Qt=class extends Error{static{i(this,"VirtualStreamClosedError")}constructor(e="VirtualStream is closed",t){super(e,t),this.name="VirtualStreamClosedError"}},Xt=class extends Error{static{i(this,"VirtualStreamOpenTimeoutError")}constructor(e,t){super(e>0?`VirtualStream transport staging timed out after ${e}ms`:"VirtualStream transport staging deadline is exhausted"),this.timeoutMs=e,this.deadlineAt=t,this.name="VirtualStreamOpenTimeoutError"}},Is=class extends Error{static{i(this,"VirtualStreamLifecycleContractError")}constructor(e){super(`VirtualStream endpoint closed before terminal ${e} produced a receipt`),this.name="VirtualStreamLifecycleContractError"}},et=class{static{i(this,"VirtualStreamActivationScope")}constructor(){this.trackedStreams=new Set,this.hasAuthorizedTrackedStreams=!1,this.published=!1,this.settled=!1}track(e){if(this.settled)throw new Error("Cannot track a VirtualStream in a settled activation scope");let t=Xd.get(e);if(t&&t!==this)throw new Error("VirtualStream is already owned by another activation scope");t||Xd.set(e,this),this.trackedStreams.add(e),this.hasAuthorizedTrackedStreams&&uu(e),this.published&&e.publishActivation()}authorizeApplicationUse(){if(!(this.settled||this.hasAuthorizedTrackedStreams)){this.hasAuthorizedTrackedStreams=!0;for(let e of this.trackedStreams)uu(e)}}publish(){if(!(this.settled||this.published)){this.published=!0;for(let e of this.trackedStreams)e.publishActivation()}}commit(){this.publish(),this.settled=!0,this.trackedStreams.clear()}async rollback(e){if(this.settled)return;this.settled=!0;let t=[...this.trackedStreams];this.trackedStreams.clear(),await Promise.allSettled(t.map(o=>o.rollbackActivation(e)))}},Ye=class r{static{i(this,"VirtualStream")}static{this.maximumStreamIdLength=256}static fromRegistration(e){let t=e.registration?.dispose,o=i(()=>{let n=t;t=void 0,n?.()},"disposeOnce");try{if(r.validateTransport(e.transport),typeof e.registration?.dispose!="function")throw new TypeError("VirtualStream registration requires a synchronous disposer");return r.validateNetworkDescriptor(e.registration.descriptor),r.validateEndpoint(e.registration.endpoint,e.registration.descriptor,e.registration.descriptor.creatorDirection),new r({transport:e.transport,descriptor:e.registration.descriptor,endpoint:e.registration.endpoint,registrationDispose:o,explicitRegistration:!0})}catch(n){throw o(),n}}static encodePayloadForNetwork(e,t){let o=e?.correlation?.phase==="response";return r.encodePayloadValue(e,t,o,!1,!0,{standard:new WeakMap,omittingResponseRequestStreams:new WeakMap})}static encodePayloadForNetworkWithMetadata(e,t){let o=e?.correlation?.phase==="response",n={standard:new WeakMap,omittingResponseRequestStreams:new WeakMap,containsNetworkDescriptor:!1,requiresNetworkDescriptorScan:!1},s=r.encodePayloadValue(e,t,o,!1,!0,n),a=n.requiresNetworkDescriptorScan||r.encodedContainerPrototypesMayExposeNetworkDescriptor();return{payload:s,containsNetworkDescriptor:a?r.containsNetworkDescriptor(s):n.containsNetworkDescriptor}}static encodePayloadValue(e,t,o,n,s,a){if(!e||At.isBufferLike(e))return e;if(e instanceof r)return n?{_OMITTED_VIRTUAL_STREAM:!0,reason:"Streams beneath an echoed response.request are omitted."}:(a.containsNetworkDescriptor!==void 0&&(a.containsNetworkDescriptor=!0),e.activateForEncoding(t));if(e instanceof Set||e instanceof Map||e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Promise||typeof e.then=="function")return a.containsNetworkDescriptor!==void 0&&typeof e=="object"&&(a.requiresNetworkDescriptorScan=!0),e;if(typeof e!="object")return e;let c=n?a.omittingResponseRequestStreams:a.standard,f=c.get(e);if(f)return f;if(Array.isArray(e)){let p=[];c.set(e,p);for(let m=0;m<e.length;m++)p.push(r.encodePayloadValue(e[m],t,o,n,!1,a));return a.containsNetworkDescriptor!==void 0&&Object.getPrototypeOf(p)!==Array.prototype&&(a.requiresNetworkDescriptorScan=!0),p}let l={};c.set(e,l);for(let p of Object.keys(e)){let m=n||o&&s&&p==="request";l[p]=r.encodePayloadValue(e[p],t,o,m,!1,a)}return a.containsNetworkDescriptor!==void 0&&Object.getPrototypeOf(l)!==Object.prototype&&(a.requiresNetworkDescriptorScan=!0),a.containsNetworkDescriptor!==void 0&&Object.hasOwn(l,"_isVirtualStream")&&l._isVirtualStream===!0&&(a.containsNetworkDescriptor=!0),l}static async decodePayloadFromNetworkAsync(e,t){let o=new Map,n=[],s=[],a=t.activationScope??new et,u=!t.activationScope,c=r.resolveOpenDeadlineAt(t.openDeadlineAt);try{let f=r.preparePayloadFromNetwork(e,{...t,activationScope:a},o,n,s,new WeakMap);if(n.length>0){let l=t.virtualStreamTransport;if(!l)throw new Error("VirtualStream descriptor requires a virtual stream transport");r.validateTransport(l);for(let p of n){let m=r.getRemainingOpenTimeoutMs(c),h=await r.openVirtualStreamWithTimeout(l,p.descriptor,m,c,t.abortSignal);p.stream.bindOpenedEndpoint(h)}}return u&&(a.authorizeApplicationUse(),a.commit()),f}catch(f){throw await Promise.allSettled(s.map(l=>l.rollbackActivation(f))),f}}static containsNetworkDescriptor(e,t=new WeakSet){return!e||At.isBufferLike(e)||typeof e!="object"?!1:e._isVirtualStream===!0?!0:t.has(e)?!1:(t.add(e),Array.isArray(e)?e.some(o=>r.containsNetworkDescriptor(o,t)):e instanceof Set||e instanceof Map||e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Promise||typeof e.then=="function"?!1:Object.values(e).some(o=>r.containsNetworkDescriptor(o,t)))}static encodedContainerPrototypesMayExposeNetworkDescriptor(){return Object.getPrototypeOf(Object.prototype)!==null||Object.getPrototypeOf(Array.prototype)!==Object.prototype||Object.getOwnPropertyDescriptor(Object.prototype,"_isVirtualStream")!==void 0||Object.getOwnPropertyDescriptor(Array.prototype,"_isVirtualStream")!==void 0}static preparePayloadFromNetwork(e,t,o,n,s,a){if(At.isBufferLike(e)||e===null||typeof e!="object"||e instanceof Set||e instanceof Map||e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Promise||typeof e.then=="function")return e;if(e._isVirtualStream===!0){r.validateNetworkDescriptor(e);let f=e,l=o.get(f.streamId);if(l){if(!r.descriptorMetadataMatches(l.descriptor,f))throw new TypeError(`Conflicting VirtualStream metadata for streamId "${f.streamId}"`);return l.stream}let p=t.virtualStreamTransport,m=new r({transport:p,descriptor:f,explicitRegistration:!1});return o.set(f.streamId,{stream:m,descriptor:f}),n.push({stream:m,descriptor:f}),s.push(m),t.activationScope?.track(m),m}let u=a.get(e);if(u)return u;if(Array.isArray(e)){let f=[];a.set(e,f);for(let l of e)f.push(r.preparePayloadFromNetwork(l,t,o,n,s,a));return f}let c={};a.set(e,c);for(let f of Object.keys(e))Object.defineProperty(c,f,{value:r.preparePayloadFromNetwork(e[f],t,o,n,s,a),configurable:!0,enumerable:!0,writable:!0});return c}static resolveOpenDeadlineAt(e){let t=performance.now()+yw;if(e===void 0)return t;if(!Number.isFinite(e)||e<0)throw new RangeError("VirtualStream openDeadlineAt must be a non-negative finite number");return Math.min(e,t)}static getRemainingOpenTimeoutMs(e){let t=Math.ceil(e-performance.now());if(!Number.isSafeInteger(t)||t<=0)throw new Xt(0,e);return t}static async openVirtualStreamWithTimeout(e,t,o,n,s){let a=new Xt(o,n),u=new AbortController,c,f,l,p=Promise.resolve().then(()=>e.openVirtualStream(t,{abortSignal:u.signal,timeoutMs:o}));p.then(async h=>{c!==void 0&&await r.abortLateOpenedEndpoint(h,c)},()=>{});let m=new Promise((h,x)=>{f=setTimeout(()=>{c=a,u.abort(a),x(a)},o),s&&(l=i(()=>{let g=s.reason??new DOMException("The operation was aborted","AbortError");c=g,u.abort(g),x(g)},"parentAbortListener"),s.addEventListener("abort",l,{once:!0}),s.aborted&&l())});try{return await Promise.race([p,m])}finally{f&&clearTimeout(f),s&&l&&s.removeEventListener("abort",l)}}static async abortLateOpenedEndpoint(e,t){let o;try{o=Promise.resolve(e.abort(t))}catch{}o?.catch(()=>{});try{await e.closed}catch{}}static validateTransport(e){if(!e||typeof e!="object"||typeof e.openVirtualStream!="function")throw new TypeError("VirtualStream transport is invalid")}static validateNetworkDescriptor(e){if(!r.isPlainObject(e))throw new TypeError("VirtualStream descriptor must be a plain object");let t=r.getOwnDataProperty(e,"_isVirtualStream"),o=r.getOwnDataProperty(e,"protocol"),n=r.getOwnDataProperty(e,"streamId"),s=r.getOwnDataProperty(e,"creatorDirection");if(t!==!0||o!=="virtual-stream-v1")throw new TypeError("VirtualStream descriptor requires protocol virtual-stream-v1");if(typeof n!="string"||n.length===0||n.length>r.maximumStreamIdLength)throw new TypeError(`VirtualStream descriptor streamId must contain 1-${r.maximumStreamIdLength} characters`);if(s!=="send"&&s!=="receive")throw new TypeError("VirtualStream descriptor creatorDirection must be send or receive");let a=Object.getOwnPropertyDescriptor(e,"contentType");if(a&&(!("value"in a)||typeof a.value!="string"||a.value.length===0))throw new TypeError("VirtualStream descriptor contentType must be a non-empty string");let u=Object.getOwnPropertyDescriptor(e,"integrity");if(u){if(!("value"in u))throw new TypeError("VirtualStream descriptor integrity must be data");r.validateIntegrity(u.value)}let c=Object.getOwnPropertyDescriptor(e,"transport");if(!c||!("value"in c))throw new TypeError("VirtualStream descriptor requires an own transport property");if(!r.isJsonCompatible(c.value,new WeakSet))throw new TypeError("VirtualStream descriptor transport must be JSON-compatible")}static validateIntegrity(e){if(!r.isPlainObject(e))throw new TypeError("VirtualStream integrity must be a plain object");let t=r.getOwnDataProperty(e,"algorithm"),o=r.getOwnDataProperty(e,"byteLength"),n=r.getOwnDataProperty(e,"digest");if(t!=="sha256")throw new TypeError("VirtualStream integrity algorithm must be sha256");if(!Number.isSafeInteger(o)||o<0)throw new TypeError("VirtualStream integrity byteLength must be a non-negative safe integer");if(typeof n!="string"||!/^sha256:[0-9a-f]{64}$/.test(n))throw new TypeError("VirtualStream integrity digest is invalid")}static validateEndpoint(e,t,o){if(!e||typeof e!="object")throw new TypeError("VirtualStream transport returned an invalid endpoint");let n=e;if(n.protocol!=="virtual-stream-v1"||n.direction!==o||n.streamId!==t.streamId||n.contentType!==t.contentType||!r.integrityMatches(n.integrity,t.integrity))throw new TypeError("VirtualStream endpoint direction or metadata does not match its descriptor");if(!("opened"in n)||!("completion"in n)||!n.closed||typeof n.closed.then!="function"||typeof n.abort!="function")throw new TypeError("VirtualStream endpoint lacks lifecycle contracts");if(o==="send"){if(typeof n.send!="function"||typeof n.close!="function"||!("writable"in n))throw new TypeError("VirtualStream sender endpoint is invalid")}else if(typeof n.receive!="function"||typeof n.accept!="function"||typeof n.reject!="function"||!("readable"in n))throw new TypeError("VirtualStream receiver endpoint is invalid")}static descriptorMetadataMatches(e,t){return e.creatorDirection===t.creatorDirection&&e.contentType===t.contentType&&r.integrityMatches(e.integrity,t.integrity)}static integrityMatches(e,t){return!e||!t?e===t:e.algorithm===t.algorithm&&e.byteLength===t.byteLength&&e.digest===t.digest}static getOwnDataProperty(e,t){let o=Object.getOwnPropertyDescriptor(e,t);if(!(!o||!("value"in o)))return o.value}static isPlainObject(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}static isJsonCompatible(e,t){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(!e||typeof e!="object"||t.has(e))return!1;t.add(e);try{if(Array.isArray(e)){for(let o=0;o<e.length;o++){let n=Object.getOwnPropertyDescriptor(e,String(o));if(!n||!("value"in n)||!r.isJsonCompatible(n.value,t))return!1}return Reflect.ownKeys(e).every(o=>o==="length"||typeof o=="string"&&/^(0|[1-9][0-9]*)$/.test(o)&&Number(o)<e.length)}if(!r.isPlainObject(e))return!1;for(let o of Reflect.ownKeys(e)){if(typeof o!="string")return!1;let n=Object.getOwnPropertyDescriptor(e,o);if(!n.enumerable||!("value"in n)||!r.isJsonCompatible(n.value,t))return!1}return!0}finally{t.delete(e)}}constructor(e){this.activationPublished=!1,this.endpointUseStarted=!1,this.endpointClosed=!1,this.locallyDisposed=!1,this.transport=e.transport,this.descriptor=e.descriptor,this.endpoint=e.endpoint,this.registrationDispose=e.registrationDispose,this.explicitRegistration=e.explicitRegistration,this.explicitRegistration&&uu(this),this.endpoint&&this.observeEndpoint(this.endpoint)}get protocol(){return"virtual-stream-v1"}get direction(){return this.endpoint?this.endpoint.direction:this.descriptor.creatorDirection==="send"?"receive":"send"}get streamId(){return this.descriptor.streamId}get contentType(){return this.descriptor.contentType}get integrity(){return this.descriptor.integrity}get opened(){try{this.assertApplicationOperationsAllowed(),this.assertNotClosed(),this.endpointUseStarted=!0;let e=this.requireEndpoint().opened;if(!e||typeof e.then!="function")throw new TypeError("VirtualStream endpoint opened contract is invalid");return e}catch(e){return Promise.reject(e)}}get completion(){let e=this.requireEndpoint().completion;if(!e||typeof e.then!="function")throw new TypeError("VirtualStream endpoint completion contract is invalid");return e}get closed(){return this.requireEndpoint().closed}get writable(){return this.assertApplicationOperation("send"),this.endpointUseStarted=!0,this.requireEndpoint().writable}get readable(){return this.assertApplicationOperation("receive"),this.endpointUseStarted=!0,this.requireEndpoint().readable}publishActivation(){this.explicitRegistration&&!this.locallyDisposed&&(this.activationPublished=!0)}async rollbackActivation(e){if(!this.locallyDisposed){if(this.explicitRegistration&&!this.activationPublished&&!this.endpointUseStarted){this.disposeUnpublishedRegistration();return}this.endpoint&&await this.abort(e)}}async send(e){if(this.assertApplicationOperation("send"),!(e instanceof Uint8Array))throw new TypeError("VirtualStream.send accepts only Uint8Array chunks");this.endpointUseStarted=!0,await this.requireEndpoint().send(e)}async receive(){return this.assertApplicationOperation("receive"),this.endpointUseStarted=!0,this.requireEndpoint().receive()}close(){if(this.terminalPromise)return this.followTerminal("close");try{this.assertApplicationOperation("send"),this.endpointUseStarted=!0;let e=this.requireEndpoint();return this.terminateEndpoint(()=>e.close(),"close")}catch(e){return Promise.reject(e)}}accept(){if(this.terminalPromise)return this.followTerminal("accept");try{this.assertApplicationOperation("receive"),this.endpointUseStarted=!0;let e=this.requireEndpoint();return this.terminateEndpoint(()=>e.accept(),"accept")}catch(e){return Promise.reject(e)}}reject(e){if(this.terminalPromise)return this.followTerminal("reject");try{this.assertApplicationOperation("receive"),this.endpointUseStarted=!0;let t=this.requireEndpoint();return this.terminateEndpoint(()=>t.reject(e),"reject")}catch(t){return Promise.reject(t)}}abort(e){if(this.terminalPromise)return this.followTerminal("abort");if(this.locallyDisposed||this.endpointClosed)return Promise.resolve();let t=this.endpoint;return t?(this.endpointUseStarted=!0,this.terminateEndpoint(()=>t.abort(e),"abort")):Promise.resolve()}activateForEncoding(e){e.activationScope?.track(this);try{if(!e.virtualStreamTransport)throw new Error("VirtualStream requires a virtual stream transport");if(this.transport!==e.virtualStreamTransport)throw new Error("VirtualStream cannot be encoded through a different virtual stream transport");if(this.assertNotClosed(),this.terminalPromise)throw new Qt("VirtualStream has a terminal operation");return e.activationScope||this.publishActivation(),this.descriptor}catch(t){throw e.activationScope||this.rollbackActivation(t).catch(()=>{}),t}}bindOpenedEndpoint(e){this.endpoint=e;let t=this.descriptor.creatorDirection==="send"?"receive":"send";r.validateEndpoint(e,this.descriptor,t),this.observeEndpoint(e)}observeEndpoint(e){let t=e.completion;if(!t||typeof t.then!="function")throw new TypeError("VirtualStream endpoint completion contract is invalid");t.then(o=>{this.completionOutcome={status:"fulfilled",value:o}},o=>{this.completionOutcome={status:"rejected",error:o}}),e.closed.then(()=>this.markEndpointClosed(),o=>this.markEndpointClosed(o))}markEndpointClosed(e){e!==void 0&&this.getCloseError(e),this.endpointClosed=!0,this.disposeRegistration()}disposeRegistration(){let e=this.registrationDispose;this.registrationDispose=void 0,e?.()}disposeUnpublishedRegistration(){this.locallyDisposed||(this.locallyDisposed=!0,this.disposeRegistration())}requireEndpoint(){if(!this.endpoint)throw new Error("VirtualStream endpoint is not staged");return this.endpoint}assertApplicationOperationsAllowed(){if(!Qd.has(this))throw new Error("VirtualStream application use is not authorized")}assertApplicationOperation(e){if(this.assertApplicationOperationsAllowed(),this.assertNotClosed(),this.terminalPromise)throw new Qt("VirtualStream has a terminal operation");if(this.direction!==e)throw new TypeError(`${this.direction} VirtualStreams cannot perform ${e} operations`)}assertNotClosed(){if(this.endpointClosed||this.locallyDisposed)throw this.getCloseError()}getCloseError(e){return this.closeError||(this.closeError=new Qt("VirtualStream is closed",e===void 0?void 0:{cause:e})),this.closeError}followTerminal(e){let t=this.terminalPromise;if(this.terminalKind===e)return t;let o=new Qt(`VirtualStream terminal ${this.terminalKind} already completed`);return t.then(()=>Promise.reject(o),()=>Promise.reject(o))}terminateEndpoint(e,t){if(this.terminalPromise)return this.followTerminal(t);let o=this.requireEndpoint();this.terminalKind=t;let n=e,s=Promise.resolve().then(()=>{let l=n;return n=void 0,l()});s.catch(()=>{});let a=s.then(l=>({status:"fulfilled",value:l}),l=>({status:"rejected",error:l})),u;a.then(l=>{u=l});let c=o.closed.then(()=>({status:"closed"}),l=>({status:"closedError",error:l})),f=(async()=>{let l=await Promise.race([a,c]);if(l.status==="fulfilled"||l.status==="rejected"){let p=await c;if(this.endpointClosed=!0,this.disposeRegistration(),l.status==="rejected")throw l.error;if(p.status==="closedError")throw p.error;return l.value}if(this.endpointClosed=!0,this.disposeRegistration(),l.status==="closedError")throw l.error;if(await Promise.resolve(),await Promise.resolve(),u?.status==="rejected")throw u.error;if(u?.status==="fulfilled")return u.value;if(t==="close"||t==="accept"){if(this.completionOutcome?.status==="fulfilled")return this.completionOutcome.value;throw this.completionOutcome?.status==="rejected"?this.completionOutcome.error:new Is(t)}})();return this.terminalPromise=f,f}};var We=class extends Error{static{i(this,"TypedResponseError")}constructor(e,t){super(e),this.name="TypedResponseError",this.errorText=e,this.errorData=t??{}}};var zr=Object.freeze({redacted:!0});var Zd=Object.freeze(["onOutgoingRequest","onIncomingResponse","onIncomingRequest","onOutgoingResponse"]),ep=Symbol.for("@api.global/typedrequest:global-hooks:3.8"),tp=i(r=>({payloadProjector:r?.payloadProjector,errorProjector:r?.errorProjector}),"copyProjectionOptions"),Cs=i((r={})=>({hooks:r,projectedRegistrationsByPhase:{}}),"createTypedRouterHookRegistrationState"),xw=i(r=>Zd.filter(e=>Object.hasOwn(r,e)).map(e=>[e,r[e]]),"getSuppliedHookEntries"),_s=i((r,e,t)=>{let o=xw(e);r.hooks={...r.hooks,...e};for(let[n]of o){let s=r.hooks[n];if(typeof s!="function"){delete r.projectedRegistrationsByPhase[n];continue}r.projectedRegistrationsByPhase[n]={callback:s,projectionOptions:tp(t)}}},"mergeTypedRouterHookRegistrations"),Rs=i((r,e)=>{r.hooks=e;for(let t of Zd)delete r.projectedRegistrationsByPhase[t]},"replaceTypedRouterHookRegistrations"),Vr=i(()=>{let r=globalThis[ep];if(r?.version==="3.8"&&r.stateShape==="callback-bound-projections-v1"&&r.subscribers instanceof Map)return r;let e={version:"3.8",stateShape:"callback-bound-projections-v1",legacy:Cs(),subscribers:new Map};return globalThis[ep]=e,e},"getRealmGlobalHookState"),op=i(()=>Vr().legacy.hooks,"getLegacyGlobalHooks"),np=i(r=>{Rs(Vr().legacy,r)},"replaceLegacyGlobalHooks"),ip=i((r,e)=>{_s(Vr().legacy,r,e)},"mergeLegacyGlobalHooks"),sp=i((r,e)=>{let t=Vr(),o=Symbol("typedrequest-hook-subscriber"),n=Cs();_s(n,r,e),t.subscribers.set(o,n);let s=!1;return()=>{s||(s=!0,t.subscribers.delete(o))}},"addGlobalHookSubscriber"),ap=i(()=>{let r=Vr();Rs(r.legacy,{}),r.subscribers.clear()},"clearGlobalHookRegistrations"),Ps=i(r=>{try{console.error(`TypedRequest hook projection failed (${r})`)}catch{}},"logProjectionFailure"),cu=i(r=>{try{console.error(`TypedRequest hook callback failed (${r})`)}catch{}},"logCallbackFailure"),gw=i((r,e)=>{let t={correlationId:r.correlationId,method:r.method,direction:r.direction,phase:r.phase,timestamp:r.timestamp,...r.durationMs===void 0?{}:{durationMs:r.durationMs},hasError:r.errorText!==void 0};try{return Object.freeze(t)}catch{Ps(e);return}},"createMetadata"),rp=i(r=>typeof SharedArrayBuffer>"u"?!1:r instanceof SharedArrayBuffer||Object.prototype.toString.call(r)==="[object SharedArrayBuffer]","isSharedArrayBuffer"),Ar=i((r,e=new Set)=>{if(!(r===null||typeof r!="object"&&typeof r!="function")){if(rp(r))throw new TypeError("TypedRequest hook projections cannot contain SharedArrayBuffer");if(ArrayBuffer.isView(r)){if(rp(r.buffer))throw new TypeError("TypedRequest hook projections cannot contain SharedArrayBuffer-backed views");return}if(!e.has(r)){if(e.add(r),r instanceof Map){for(let[t,o]of r)Ar(t,e),Ar(o,e);return}if(r instanceof Set){for(let t of r)Ar(t,e);return}for(let t of Reflect.ownKeys(r)){let o=Reflect.getOwnPropertyDescriptor(r,t);if(o){if(!Object.hasOwn(o,"value"))throw new TypeError("TypedRequest hook projections cannot contain accessor properties");Ar(o.value,e)}}}}},"assertNoSharedArrayBuffer"),ww=i((r,e,t,o)=>{if(!e||!t.payloadProjector)return{payload:zr,payloadRedacted:!0};try{let n=t.payloadProjector(r,e);Ar(n);let s=structuredClone(n);return Ar(s),s!==null&&(typeof s=="object"||typeof s=="function")&&Object.freeze(s),{payload:s,payloadRedacted:!1}}catch{return Ps(o),{payload:zr,payloadRedacted:!0}}},"snapshotPayload"),bw=i((r,e,t,o)=>{if(!(!e||r.errorText===void 0||!t.errorProjector))try{let n=t.errorProjector(r.errorText,e);if(n===void 0)return;let s=structuredClone(n);if(typeof s!="string")throw new TypeError("TypedRequest error projector must return a string or undefined");return s}catch{Ps(o);return}},"snapshotError"),vw=i((r,e,t)=>{let o=gw(r,t),n=ww(r.payload,o,e,t),s=bw(r,o,e,t),a={correlationId:r.correlationId,method:r.method,direction:r.direction,phase:r.phase,timestamp:r.timestamp,...r.durationMs===void 0?{}:{durationMs:r.durationMs},hasError:r.errorText!==void 0,...n,...s===void 0?{}:{error:s}};try{return Object.freeze(a)}catch{Ps(t);let u={correlationId:r.correlationId,method:r.method,direction:r.direction,phase:r.phase,timestamp:r.timestamp,...r.durationMs===void 0?{}:{durationMs:r.durationMs},hasError:r.errorText!==void 0,payload:zr,payloadRedacted:!0};try{return Object.freeze(u)}catch{return u}}},"projectLogEntry"),fu=i((r,e)=>{try{let t=r.hooks[e];if(typeof t!="function")return;let o=r.projectedRegistrationsByPhase[e];return{callback:t,projectionOptions:o?.callback===t?tp(o.projectionOptions):{}}}catch{cu(e);return}},"snapshotDispatchRecipient"),lu=i((r,e,t)=>{let o=vw(t,r.projectionOptions,e);try{let n=r.callback(o);n&&typeof n.then=="function"&&Promise.resolve(n).catch(()=>{cu(e)})}catch{cu(e)}},"dispatchToRecipient"),Gr=i((r,e,t)=>{let o=Vr();if(o.subscribers.size===0){let a=fu(o.legacy,r),u=t?fu(t,r):void 0;if(!a&&!u)return;a&&lu(a,r,e),u&&lu(u,r,e);return}let s=[o.legacy,...Array.from(o.subscribers.values()),...t?[t]:[]].map(a=>fu(a,r)).filter(a=>!!a);for(let a of s)lu(a,r,e)},"dispatchTypedRequestHook");var Ns=class{static{i(this,"TypedTools")}constructor(e){this.localData={},this.abortSignal=e??new AbortController().signal}async passGuards(e,t){let o=new Co.GuardSet(e);if(!await o.allGuardsPass(t)){let s=await o.getFailedHint(t);throw new We(`guard failed: ${s}`,{failedHint:s})}}};var du=class r{static{i(this,"TypedHandler")}static{this.internalErrorMessage="Internal server error"}constructor(e,t){this.method=e,this.handlerFunction=t}async addResponse(e,t){if(e.method!==this.method)throw new Error("this handler has been given a wrong method to answer to. Please use a TypedRouter to filter requests");let o,n=new Ns(t);e.localData&&(n.localData=e.localData);let s=await this.handlerFunction(e.request,n).catch(a=>{a instanceof We?o=a:(console.error(`TypedRequest handler '${this.method}' failed`),o=new We(r.internalErrorMessage))});return o&&(e.error={text:o.errorText,data:o.errorData}),s&&(e.response=s),e?.correlation?.phase&&(e.correlation.phase="response"),e}};function Ws(r){let e=r?.method,t=r?.correlation?.id,o=r?.requestInstanceId;if(!(typeof e!="string"||e.length===0||typeof t!="string"||t.length===0||typeof o!="string"||o.length===0))return JSON.stringify([e,t,o])}i(Ws,"getTypedRequestResponseInterestKey");var pu=class r{static{i(this,"TypedRouter")}constructor(){this.hookRegistrationState=Cs(),this.routerMap=new Se.ObjectMap,this.fallbackRouterMap=new Se.ObjectMap,this.fallbackParentRouters=new Set,this.handlerMap=new Se.ObjectMap,this.middlewares=[],this.fireEventInterestMap=new Se.InterestMap(e=>e)}static{this.internalErrorMessage="Internal server error"}registerVirtualStreamTransportResolver(e){if(typeof e!="function")throw new TypeError("TypedRouter virtual stream transport resolver must be a function");if(this.virtualStreamTransportResolver)throw new Error("TypedRouter already has a virtual stream transport resolver owner");this.virtualStreamTransportResolver=e;let t=!1;return()=>{t||(t=!0,this.virtualStreamTransportResolver===e&&(this.virtualStreamTransportResolver=void 0))}}registerIncomingRequestAuthorityGuard(e){if(typeof e!="function")throw new TypeError("TypedRouter incoming request authority guard must be a function");if(this.incomingRequestAuthorityGuard)throw new Error("TypedRouter already has an incoming request authority guard owner");this.incomingRequestAuthorityGuard=e;let t=!1;return()=>{t||(t=!0,this.incomingRequestAuthorityGuard===e&&(this.incomingRequestAuthorityGuard=void 0))}}registerIncomingRequestSignalResolver(e){if(typeof e!="function")throw new TypeError("TypedRouter incoming request signal resolver must be a function");if(this.incomingRequestSignalResolver)throw new Error("TypedRouter already has an incoming request signal resolver owner");this.incomingRequestSignalResolver=e;let t=!1;return()=>{t||(t=!0,this.incomingRequestSignalResolver===e&&(this.incomingRequestSignalResolver=void 0))}}registerIncomingResponseAuthorityGuard(e){if(typeof e!="function")throw new TypeError("TypedRouter incoming response authority guard must be a function");if(this.incomingResponseAuthorityGuard)throw new Error("TypedRouter already has an incoming response authority guard owner");this.incomingResponseAuthorityGuard=e;let t=!1;return()=>{t||(t=!0,this.incomingResponseAuthorityGuard===e&&(this.incomingResponseAuthorityGuard=void 0))}}static get globalHooks(){return op()}static set globalHooks(e){np(e)}static setGlobalHooks(e,t){ip(e,t)}static addGlobalHooks(e,t){return sp(e,t)}static clearGlobalHooks(){ap()}get hooks(){return this.hookRegistrationState.hooks}set hooks(e){Rs(this.hookRegistrationState,e)}setHooks(e,t){_s(this.hookRegistrationState,e,t)}callHook(e,t){Gr(e,t,this.hookRegistrationState)}setErrorFromCaughtError(e,t,o){if(t instanceof We){e.error={text:t.errorText,data:t.errorData??{}};return}console.error(`TypedRequest ${o} failed`),e.error={text:r.internalErrorMessage,data:{}}}addMiddleware(e){this.middlewares.push(e)}addTypedHandler(e){if(this.getTypedHandlerForMethod(e.method))throw new Error(`a TypedHandler for ${e.method} alredy exists! Can't add another one.`);this.handlerMap.add(e);try{this.validateAffectedCompositionRoots()}catch(o){throw this.handlerMap.remove(e),o}}addTypedRouter(e){if(e===this)throw new Error("A TypedRouter cannot be composed with itself.");if(this.routerMap.findSync(a=>a===e))return()=>{};let o=this.canReachRouter(e),n=e.canReachRouter(this);if(o!==n)throw new Error("Cannot add a bidirectional TypedRouter edge across an existing composition boundary.");this.routerMap.add(e),e.routerMap.add(this);try{this.validateAffectedCompositionRoots()}catch(a){throw this.routerMap.remove(e),e.routerMap.remove(this),a}let s=!1;return()=>{s||(s=!0,this.routerMap.remove(e),e.routerMap.remove(this))}}addFallbackRouter(e){if(e===this)throw new Error("A TypedRouter cannot use itself as a fallback.");if(this.fallbackRouterMap.findSync(o=>o===e))return()=>{};if(e.canReachRouter(this))throw new Error("Adding this fallback would create a TypedRouter composition cycle.");this.fallbackRouterMap.add(e),e.fallbackParentRouters.add(this);try{this.validateAffectedCompositionRoots()}catch(o){throw this.fallbackRouterMap.remove(e),e.fallbackParentRouters.delete(this),o}let t=!1;return()=>{t||(t=!0,this.fallbackRouterMap.remove(e),e.fallbackParentRouters.delete(this))}}getMethodNames(){return[...this.collectReachableHandlers().keys()].sort()}canReachRouter(e,t=new Set){if(this===e)return!0;if(t.has(this))return!1;t.add(this);for(let o of[...this.routerMap.getArray(),...this.fallbackRouterMap.getArray()])if(o.canReachRouter(e,t))return!0;return!1}collectReachableHandlers(e=new Set,t=new Map){if(e.has(this))return t;e.add(this);for(let o of this.handlerMap.getArray()){let n=t.get(o.method);n||(n=new Set,t.set(o.method,n)),n.add(this)}for(let o of[...this.routerMap.getArray(),...this.fallbackRouterMap.getArray()])o.collectReachableHandlers(e,t);return t}getAffectedCompositionRoots(){let e=new Set,t=[this];for(;t.length>0;){let o=t.pop();e.has(o)||(e.add(o),t.push(...o.routerMap.getArray(),...o.fallbackParentRouters))}return e}validateAffectedCompositionRoots(){for(let e of this.getAffectedCompositionRoots())for(let[t,o]of e.collectReachableHandlers())if(o.size>1)throw new Error(`TypedRouter composition exposes more than one handler for method "${t}".`)}checkForTypedHandler(e){return!!this.getTypedHandlerForMethod(e)}getTypedHandlerForMethod(e,t=[]){t.push(this);let o;return o=this.handlerMap.findSync(n=>n.method===e),o||this.routerMap.getArray().forEach(n=>{!o&&!t.includes(n)&&(o=n.getTypedHandlerForMethod(e,t))}),o||this.fallbackRouterMap.getArray().forEach(n=>{!o&&!t.includes(n)&&(o=n.getTypedHandlerForMethod(e,t))}),o}getTypedHandlerAndRouter(e,t=[]){t.push(this);let o=this.handlerMap.findSync(n=>n.method===e);if(o)return{handler:o,router:this};for(let n of this.routerMap.getArray())if(!t.includes(n)){let s=n.getTypedHandlerAndRouter(e,t);if(s)return s}for(let n of this.fallbackRouterMap.getArray())if(!t.includes(n)){let s=n.getTypedHandlerAndRouter(e,t);if(s)return s}return null}static{this.defaultRouteOptions={localRequest:!1,skipHooks:!1}}async routeAndAddResponse(e,t={}){if(!e||typeof e!="object")return null;let o;try{o=Object.prototype.propertyIsEnumerable.call(e,"localData")}catch{return null}let n={...r.defaultRouteOptions,...t};if(!this.sanitizeIncomingLocalData(e))return null;let s=Object.freeze({...n.trustedLocalData??{}});if(e?.correlation?.phase==="response"){let x=Ws(e);if(!x)return null;if(this.incomingResponseAuthorityGuard){let g=Object.freeze({typedRouter:this,trustedLocalData:s,wireLocalDataPresent:o}),w=!1;try{w=this.incomingResponseAuthorityGuard(e,g)===!0}catch{}if(!w)return null}return n.skipHooks||this.callHook("onIncomingResponse",{correlationId:e.correlation.id,method:e.method,direction:"incoming",phase:"response",timestamp:Date.now(),payload:e.response,errorText:e.error?.text}),this.fireEventInterestMap.findInterest(x)?.fullfillInterest(e),null}if(e?.correlation?.phase!=="request"||typeof e.correlation.id!="string"||e.correlation.id.length===0||typeof e.method!="string"||e.method.length===0||!e.request||typeof e.request!="object")return console.log("TypedRouter received a malformed request DTO"),null;if(this.incomingRequestAuthorityGuard){let x=Object.freeze({typedRouter:this,trustedLocalData:s,wireLocalDataPresent:o}),g=!1;try{g=this.incomingRequestAuthorityGuard(e,x)===!0}catch{}if(!g)return null}let a,u=n.trustedAbortSignal;if(u!==void 0&&!this.isAbortSignal(u))throw new TypeError("TypedRouter trustedAbortSignal must be an AbortSignal");if(!u&&this.incomingRequestSignalResolver){if(typeof e.requestInstanceId!="string"||e.requestInstanceId.length===0)return null;let x=Object.freeze({typedRouter:this,trustedLocalData:s,wireLocalDataPresent:o});try{a=this.incomingRequestSignalResolver(e,x)}catch{return null}if(a&&(!this.isAbortSignal(a.abortSignal)||typeof a.complete!="function")){try{a.complete?.()}catch{}return null}u=a?.abortSignal}let c;try{c=this.virtualStreamTransportResolver?.(s)}catch(x){try{a?.complete()}catch{}throw x}let f=new et,l=new et,p=i(async x=>{await Promise.allSettled([f.rollback(x),l.rollback(x)])},"rollbackRouteActivations"),m=i(()=>{f.commit(),l.commit()},"commitRouteActivations"),h=i(async()=>(delete e.localData,Ye.encodePayloadForNetwork(e,{side:"responding",virtualStreamTransport:c,activationScope:l})),"encodeResponse");try{if(e=await Ye.decodePayloadFromNetworkAsync(e,{side:"responding",virtualStreamTransport:c,activationScope:f,abortSignal:u}),e.localData={...s},e.localData.firstTypedrouter=this,e?.correlation?.phase==="request"){let x=Date.now();n.skipHooks||this.callHook("onIncomingRequest",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"incoming",phase:"request",timestamp:x,payload:e.request});let g=this.getTypedHandlerAndRouter(e.method);if(!g)return console.log(`Cannot find handler for methodname ${e.method}`),e.error={text:"There is no available method for this call on the server side",data:{}},e.correlation.phase="response",e=await h(),await p(e.error),n.skipHooks||this.callHook("onOutgoingResponse",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"outgoing",phase:"response",timestamp:Date.now(),durationMs:Date.now()-x,payload:e.response,errorText:e.error?.text}),this.assertTrustedAbortSignalActive(u),e;let{handler:w,router:v}=g;if(v.middlewares.length>0)try{for(let te of v.middlewares)await te(e)}catch(te){return this.setErrorFromCaughtError(e,te,`middleware for method '${e.method}'`),e.correlation.phase="response",e=await h(),await p(te),n.skipHooks||this.callHook("onOutgoingResponse",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"outgoing",phase:"response",timestamp:Date.now(),durationMs:Date.now()-x,payload:e.response,errorText:e.error?.text}),this.assertTrustedAbortSignalActive(u),e}f.authorizeApplicationUse(),e=await w.addResponse(e,u);let G=!!e.error;return e=await h(),G&&await p(e.error),n.skipHooks||this.callHook("onOutgoingResponse",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"outgoing",phase:"response",timestamp:Date.now(),durationMs:Date.now()-x,payload:e.response,errorText:e.error?.text}),G||(this.assertTrustedAbortSignalActive(u),m()),this.assertTrustedAbortSignalActive(u),e}return await p(new Error("TypedRouter received an unroutable request DTO")),this.assertTrustedAbortSignalActive(u),null}catch(x){throw await p(x),x}finally{try{a?.complete()}catch{}}}sanitizeIncomingLocalData(e){try{let t=Reflect.getOwnPropertyDescriptor(e,"localData");if(t&&(t.configurable!==!0||!Reflect.deleteProperty(e,"localData")))return!1;if(!Reflect.has(e,"localData"))return!0;if(!Reflect.isExtensible(e)||!Reflect.defineProperty(e,"localData",{configurable:!0,enumerable:!1,value:void 0,writable:!0}))return!1;let o=Reflect.getOwnPropertyDescriptor(e,"localData");return!!(o&&o.configurable===!0&&o.enumerable===!1&&o.value===void 0&&o.writable===!0)}catch{return!1}}isAbortSignal(e){return!!(e&&typeof e=="object"&&typeof Reflect.get(e,"aborted")=="boolean"&&typeof Reflect.get(e,"addEventListener")=="function"&&typeof Reflect.get(e,"removeEventListener")=="function")}assertTrustedAbortSignalActive(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}};var mu=class{static{i(this,"TypedTarget")}constructor(e){if(this.isAsync=!1,e.postMethodWithTypedRouter&&!e.typedRouterRef)throw new Error("you have to specify a typedrouter when using postmethod with typedrouter");let t=e.responseTimeoutMs??3e4;if(!Number.isSafeInteger(t)||t<=0||t>2147483647)throw new RangeError("TypedTarget responseTimeoutMs must be a positive safe integer no greater than 2147483647");this.options=e,this.responseTimeoutMs=t}async post(e,t={}){if(t.signal&&this.options.supportsAbortSignal!==!0)throw new Error("TypedTarget does not declare AbortSignal transport support");let o=this.options.postMethod||this.options.postMethodWithTypedRouter;if(!o)throw new Error("TypedTarget requires a post method");let n;if(this.options.typedRouterRef){let l=Ws(e);if(!l)throw new TypeError("TypedTarget request response identity is malformed");n=await this.options.typedRouterRef.fireEventInterestMap.addInterest(l,e)}let s=t.signal;if(s?.aborted)throw n?.destroy(),s.reason??new DOMException("The operation was aborted","AbortError");let a,u=s?new Promise((l,p)=>{a=i(()=>{n?.destroy(),p(s.reason??new DOMException("The operation was aborted","AbortError"))},"abortListener"),s.addEventListener("abort",a,{once:!0})}):void 0,c,f=n?new Promise((l,p)=>{c=setTimeout(()=>{p(new Error(`TypedTarget response timed out after ${this.responseTimeoutMs}ms`))},this.responseTimeoutMs),c.unref?.()}):void 0;try{let l=Promise.resolve(o(e,t)),p=await Promise.race([l,...f?[f]:[],...u?[u]:[]]);return n?await Promise.race([n.interestFullfilled,f,...u?[u]:[]]):p||e}finally{c&&clearTimeout(c),s&&a&&s.removeEventListener("abort",a),n?.destroy()}}};var Fs=new Br.WebrequestClient,Ls=2147483647,Ys=class extends Error{static{i(this,"TypedRequestTimeoutError")}constructor(e,t){super(`Typed request "${e}" timed out after ${t}ms`),this.name="TypedRequestTimeoutError",this.method=e,this.timeoutMs=t}},qs=class extends Error{static{i(this,"TypedRequestRetryLimitError")}constructor(e,t){super(`Typed request "${e}" exceeded its ${t} server-directed retries`),this.name="TypedRequestRetryLimitError",this.method=e,this.maxRetries=t}},hu=class{static{i(this,"TypedRequest")}constructor(e,t){this.skipHooks=!1,typeof e=="string"?this.urlEndPoint=e:this.typedTarget=e,this.method=t}async fire(e,t=!1){let o=Date.now(),n=this.resolveFireOptions(t),s=this.createAbortContext(n);n.abortSignal=s.signal;let a=new et,u={method:this.method,request:e,response:null,requestInstanceId:Lo.uni(),correlation:{id:Lo.uni(),phase:"request"}};try{this.assertActive(n);let c=Ye.encodePayloadForNetworkWithMetadata(u,{side:"requesting",activationScope:a,virtualStreamTransport:this.typedTarget?.options.virtualStreamTransport});u=c.payload;let f=c.containsNetworkDescriptor;if(f&&!this.urlEndPoint&&this.typedTarget.options.supportsAbortSignal!==!0)throw new Error("VirtualStreams require TypedTarget AbortSignal transport support");if(n.useCache&&f)throw new Error("TypedRequest response caching is not supported for requests containing VirtualStreams");this.assertActive(n),n.useCache&&(n.cacheKey=await this.createCacheKey(u),this.assertActive(n)),this.skipHooks||Gr("onOutgoingRequest",{correlationId:u.correlation.id,method:this.method,direction:"outgoing",phase:"request",timestamp:o,payload:e}),a.publish();let l=await this.postTrObject(u,n);delete l.localData;let p=l.error;if(this.assertActive(n),p)throw this.skipHooks||Gr("onIncomingResponse",{correlationId:u.correlation.id,method:this.method,direction:"incoming",phase:"response",timestamp:Date.now(),durationMs:Date.now()-o,payload:l.response,errorText:p.text}),this.assertActive(n),new We(p.text,p.data);let m=l.response;if(!this.urlEndPoint&&this.typedTarget.options.supportsAbortSignal!==!0&&Ye.containsNetworkDescriptor(m))throw new Error("VirtualStreams require TypedTarget AbortSignal transport support");try{m=await Ye.decodePayloadFromNetworkAsync(m,{side:"requesting",activationScope:a,virtualStreamTransport:this.typedTarget?.options.virtualStreamTransport,openDeadlineAt:n.deadlineAt,abortSignal:n.abortSignal})}catch(h){throw h instanceof Xt&&n.deadlineAt!==void 0&&h.deadlineAt===n.deadlineAt?this.createTimeoutError(n):h}return this.assertActive(n),a.authorizeApplicationUse(),this.skipHooks||Gr("onIncomingResponse",{correlationId:u.correlation.id,method:this.method,direction:"incoming",phase:"response",timestamp:Date.now(),durationMs:Date.now()-o,payload:m}),this.assertActive(n),a.commit(),m}catch(c){throw await a.rollback(c),c}finally{s.cleanup()}}async postTrObject(e,t={useCache:!1,maxRetries:3}){let o=0;for(;;){this.assertActive(t);let n=this.createRequestIdentitySnapshot(e),s;if(this.urlEndPoint){let a;try{a=await Fs.postJsonWithMetadata(this.urlEndPoint,e,{cacheStrategy:t.useCache?"cache-first":"network-only",cacheKey:t.cacheKey,timeout:this.getRemainingTimeout(t),signal:t.abortSignal})}catch(u){throw t.cacheKey&&u instanceof SyntaxError&&await Fs.deleteCache(t.cacheKey),t.abortSignal?.aborted?this.getAbortReason(t):t.timeoutMs!==void 0&&(this.hasDeadlineExpired(t)||Br.isWebrequestTimeoutError(u))?this.createTimeoutError(t):u}s=a.data;try{a.metadata.fromCache?s=this.reconstructCachedHttpResponse(s,e,n):this.assertResponseEnvelope(s,n)}catch(u){throw t.cacheKey&&await Fs.deleteCache(t.cacheKey),u}t.cacheKey&&!this.isReusableCachedHttpEnvelope(s)&&await Fs.deleteCache(t.cacheKey)}else s=await this.postTypedTarget(e,t);if(this.assertResponseEnvelope(s,n),this.assertActive(t),s.error&&!s.retry||!s.retry)return s;if(console.log(`Server requested a retry for TypedRequest method '${this.method}'`),o>=t.maxRetries)throw new qs(this.method,t.maxRetries);o+=1,await this.waitForRetry(s.retry.waitForMs,t),e.requestInstanceId=Lo.uni(),e.correlation.phase="request",e.response=null,delete e.error,delete e.retry}}assertResponseEnvelope(e,t){let o=e?.error,n=e?.requestInstanceId,s=t.requestInstanceId;if(!e||typeof e!="object"||e.method!==t.method||e.correlation?.phase!=="response"||typeof e.correlation.id!="string"||e.correlation.id.length===0||!Object.hasOwn(e,"response")||typeof n!="string"||n.length===0||typeof s!="string"||s.length===0||n!==s||o!==void 0&&(!o||typeof o!="object"||typeof o.text!="string")||e.correlation.id!==t.correlationId)throw new TypeError("TypedRequest received an invalid response envelope")}async postTypedTarget(e,t){this.assertActive(t);try{return await this.typedTarget.post(e,{signal:t.abortSignal})}catch(o){throw t.abortSignal?.aborted?this.getAbortReason(t):o}}resolveFireOptions(e){let t=typeof e=="boolean"?{useCache:e}:e;if(!t||typeof t!="object")throw new TypeError("TypedRequest fire options must be a boolean or an options object");if(t.useCache!==void 0&&typeof t.useCache!="boolean")throw new TypeError("TypedRequest useCache must be a boolean");if(t.timeoutMs!==void 0&&(!Number.isSafeInteger(t.timeoutMs)||t.timeoutMs<=0||t.timeoutMs>Ls))throw new RangeError(`TypedRequest timeoutMs must be a positive safe integer no greater than ${Ls}`);if(t.abortSignal!==void 0&&!this.isAbortSignal(t.abortSignal))throw new TypeError("TypedRequest abortSignal must be an AbortSignal");if(t.maxRetries!==void 0&&(!Number.isSafeInteger(t.maxRetries)||t.maxRetries<0||t.maxRetries>1e3))throw new RangeError("TypedRequest maxRetries must be a safe integer between 0 and 1000");if((t.timeoutMs!==void 0||t.abortSignal!==void 0)&&!this.urlEndPoint&&this.typedTarget.options.supportsAbortSignal!==!0)throw new Error(t.abortSignal?"TypedRequest cancellation requires an HTTP URL or a TypedTarget with AbortSignal support":"TypedRequest timeoutMs requires an HTTP URL or a TypedTarget with AbortSignal support");return{useCache:t.useCache??!1,timeoutMs:t.timeoutMs,maxRetries:t.maxRetries??3,abortSignal:t.abortSignal,deadlineAt:t.timeoutMs===void 0?void 0:performance.now()+t.timeoutMs}}getRemainingTimeout(e){if(e.deadlineAt===void 0||e.timeoutMs===void 0)return;let t=Math.ceil(e.deadlineAt-performance.now());if(t<=0)throw this.createTimeoutError(e);return t}assertDeadline(e){this.getRemainingTimeout(e)}assertActive(e){if(e.abortSignal?.aborted)throw this.getAbortReason(e);this.assertDeadline(e)}hasDeadlineExpired(e){return e.deadlineAt!==void 0&&performance.now()>=e.deadlineAt}createTimeoutError(e){return new Ys(this.method,e.timeoutMs)}async waitForRetry(e,t){if(!Number.isSafeInteger(e)||e<=0||e>Ls)throw new RangeError(`TypedRequest retry waitForMs must be a positive safe integer no greater than ${Ls}`);this.assertActive(t);let o=this.getRemainingTimeout(t);if(o===void 0){await this.delayWithAbort(e,t);return}if(e>=o)throw await this.delayWithAbort(o,t),this.createTimeoutError(t);await this.delayWithAbort(e,t),this.assertActive(t)}async delayWithAbort(e,t){let o=t.abortSignal;if(!o){await j.delayFor(e);return}await new Promise((n,s)=>{let a=setTimeout(()=>{o.removeEventListener("abort",u),n()},e),u=i(()=>{clearTimeout(a),o.removeEventListener("abort",u),s(this.getAbortReason(t))},"onAbort");o.addEventListener("abort",u,{once:!0}),o.aborted&&u()})}createAbortContext(e){let t=e.abortSignal;if(e.timeoutMs===void 0)return{signal:t,cleanup:i(()=>{},"cleanup")};let o=new AbortController,n=i(()=>{o.abort(t?.reason??new DOMException("The operation was aborted","AbortError"))},"onCallerAbort");t?.aborted?n():t?.addEventListener("abort",n,{once:!0});let s=Math.max(0,Math.ceil(e.deadlineAt-performance.now())),a=setTimeout(()=>{o.abort(this.createTimeoutError(e))},s);return a.unref?.(),{signal:o.signal,cleanup:i(()=>{clearTimeout(a),t?.removeEventListener("abort",n)},"cleanup")}}getAbortReason(e){return e.abortSignal?.reason??new DOMException("The operation was aborted","AbortError")}reconstructCachedHttpResponse(e,t,o){if(!e||typeof e!="object"||Array.isArray(e)||e.method!==o.method||!Object.hasOwn(e,"response")||!e.response||typeof e.response!="object"||!this.isReusableCachedHttpEnvelope(e))throw new TypeError("TypedRequest received an invalid cached response envelope");return{method:o.method,request:t.request,response:e.response,requestInstanceId:o.requestInstanceId,correlation:{id:o.correlationId,phase:"response"}}}createRequestIdentitySnapshot(e){return Object.freeze({method:e.method,correlationId:e.correlation?.id,requestInstanceId:e.requestInstanceId})}isReusableCachedHttpEnvelope(e){return!Object.hasOwn(e,"error")&&!Object.hasOwn(e,"retry")&&!Ye.containsNetworkDescriptor(e)}isAbortSignal(e){return!!(e&&typeof e=="object"&&typeof Reflect.get(e,"aborted")=="boolean"&&typeof Reflect.get(e,"addEventListener")=="function"&&typeof Reflect.get(e,"removeEventListener")=="function")}async createCacheKey(e){let t=JSON.stringify({endpoint:this.urlEndPoint,method:e.method,request:e.request}),o=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return`typedrequest:v1:${Array.from(new Uint8Array(o),s=>s.toString(16).padStart(2,"0")).join("")}`}};function up(r){return r&&typeof r.then=="function"}i(up,"isPromise");var cp=Promise.resolve(!1),fie=Promise.resolve(!0),Ke=Promise.resolve();function Hs(r,e){return r||(r=0),new Promise(function(t){return setTimeout(function(){return t(e)},r)})}i(Hs,"sleep");function fp(r,e){return Math.floor(Math.random()*(e-r+1)+r)}i(fp,"randomInt");function Yo(){return Math.random().toString(36).substring(2)}i(Yo,"randomToken");var yu=0;function tt(){var r=Date.now()*1e3;return r<=yu&&(r=yu+1),yu=r,r}i(tt,"microSeconds");function lie(){return typeof navigator<"u"&&typeof navigator.locks<"u"&&typeof navigator.locks.request=="function"}i(lie,"supportsWebLockAPI");var Tw=tt,Dw="native";function Sw(r){var e={time:tt(),messagesCallback:null,bc:new BroadcastChannel(r),subFns:[]};return e.bc.onmessage=function(t){e.messagesCallback&&e.messagesCallback(t.data)},e}i(Sw,"create");function Mw(r){r.bc.close(),r.subFns=[]}i(Mw,"close");function Ow(r,e){try{return r.bc.postMessage(e,!1),Ke}catch(t){return Promise.reject(t)}}i(Ow,"postMessage");function Ew(r,e){r.messagesCallback=e}i(Ew,"onMessage");function kw(){if(typeof globalThis<"u"&&globalThis.Deno&&globalThis.Deno.args)return!0;if((typeof window<"u"||typeof self<"u")&&typeof BroadcastChannel=="function"){if(BroadcastChannel._pubkey)throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0}else return!1}i(kw,"canBeUsed");function Iw(){return 150}i(Iw,"averageResponseTime");var lp={create:Sw,close:Mw,onMessage:Ew,postMessage:Ow,canBeUsed:kw,type:Dw,averageResponseTime:Iw,microSeconds:Tw};var Jr=class{static{i(this,"ObliviousSet")}ttl;map=new Map;_to=!1;constructor(e){this.ttl=e}has(e){let t=this.map.get(e);return typeof t>"u"?!1:t<xu()-this.ttl?(this.map.delete(e),!1):!0}add(e){this.map.delete(e),this.map.set(e,xu()),this._to||(this._to=!0,setTimeout(()=>{this._to=!1,Pw(this)},0))}clear(){this.map.clear()}};function Pw(r){let e=xu()-r.ttl,t=r.map[Symbol.iterator]();for(;;){let o=t.next().value;if(!o)break;let n=o[0];if(o[1]<e)r.map.delete(n);else break}}i(Pw,"removeTooOldValues");function xu(){return Date.now()}i(xu,"now");function Zt(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=JSON.parse(JSON.stringify(r));return typeof e.webWorkerSupport>"u"&&(e.webWorkerSupport=!0),e.idb||(e.idb={}),e.idb.ttl||(e.idb.ttl=1e3*45),e.idb.fallbackInterval||(e.idb.fallbackInterval=150),r.idb&&typeof r.idb.onclose=="function"&&(e.idb.onclose=r.idb.onclose),e.localstorage||(e.localstorage={}),e.localstorage.removeTimeout||(e.localstorage.removeTimeout=1e3*60),r.methods&&(e.methods=r.methods),e.node||(e.node={}),e.node.ttl||(e.node.ttl=1e3*60*2),e.node.maxParallelWrites||(e.node.maxParallelWrites=2048),typeof e.node.useFastPath>"u"&&(e.node.useFastPath=!0),e}i(Zt,"fillOptionsWithDefaults");var Cw=tt,_w="pubkey.broadcast-channel-0-",qe="messages",qo={durability:"relaxed"},Rw="idb";function dp(){if(typeof indexedDB<"u")return indexedDB;if(typeof window<"u"){if(typeof window.mozIndexedDB<"u")return window.mozIndexedDB;if(typeof window.webkitIndexedDB<"u")return window.webkitIndexedDB;if(typeof window.msIndexedDB<"u")return window.msIndexedDB}return!1}i(dp,"getIdb");function js(r){r.commit&&r.commit()}i(js,"commitIndexedDBTransaction");function Nw(r){var e=dp(),t=_w+r,o=e.open(t);return o.onupgradeneeded=function(n){var s=n.target.result;s.createObjectStore(qe,{keyPath:"id",autoIncrement:!0})},new Promise(function(n,s){o.onerror=function(a){return s(a)},o.onsuccess=function(){n(o.result)}})}i(Nw,"createDatabase");function Ww(r,e,t){var o=Date.now(),n={uuid:e,time:o,data:t},s=r.transaction([qe],"readwrite",qo);return new Promise(function(a,u){s.oncomplete=function(){return a()},s.onerror=function(f){return u(f)};var c=s.objectStore(qe);c.add(n),js(s)})}i(Ww,"writeMessage");function Sie(r){var e=r.transaction(qe,"readonly",qo),t=e.objectStore(qe),o=[];return new Promise(function(n){t.openCursor().onsuccess=function(s){var a=s.target.result;a?(o.push(a.value),a.continue()):(js(e),n(o))}})}i(Sie,"getAllMessages");function Fw(r,e){var t=r.transaction(qe,"readonly",qo),o=t.objectStore(qe),n=[],s=IDBKeyRange.bound(e+1,1/0);if(o.getAll){var a=o.getAll(s);return new Promise(function(c,f){a.onerror=function(l){return f(l)},a.onsuccess=function(l){c(l.target.result)}})}function u(){try{return s=IDBKeyRange.bound(e+1,1/0),o.openCursor(s)}catch{return o.openCursor()}}return i(u,"openCursor"),new Promise(function(c,f){var l=u();l.onerror=function(p){return f(p)},l.onsuccess=function(p){var m=p.target.result;m?m.value.id<e+1?m.continue(e+1):(n.push(m.value),m.continue()):(js(t),c(n))}})}i(Fw,"getMessagesHigherThan");function Lw(r,e){if(r.closed)return Promise.resolve([]);var t=r.db.transaction(qe,"readwrite",qo),o=t.objectStore(qe);return Promise.all(e.map(function(n){var s=o.delete(n);return new Promise(function(a){s.onsuccess=function(){return a()}})}))}i(Lw,"removeMessagesById");function Yw(r,e){var t=Date.now()-e,o=r.transaction(qe,"readonly",qo),n=o.objectStore(qe),s=[];return new Promise(function(a){n.openCursor().onsuccess=function(u){var c=u.target.result;if(c){var f=c.value;f.time<t?(s.push(f),c.continue()):(js(o),a(s))}else a(s)}})}i(Yw,"getOldMessages");function qw(r){return Yw(r.db,r.options.idb.ttl).then(function(e){return Lw(r,e.map(function(t){return t.id}))})}i(qw,"cleanOldMessages");function Hw(r,e){return e=Zt(e),Nw(r).then(function(t){var o={closed:!1,lastCursorId:0,channelName:r,options:e,uuid:Yo(),eMIs:new Jr(e.idb.ttl*2),writeBlockPromise:Ke,messagesCallback:null,readQueuePromises:[],db:t};return t.onclose=function(){o.closed=!0,e.idb.onclose&&e.idb.onclose()},pp(o),o})}i(Hw,"create");function pp(r){r.closed||mp(r).then(function(){return Hs(r.options.idb.fallbackInterval)}).then(function(){return pp(r)})}i(pp,"_readLoop");function jw(r,e){return!(r.uuid===e.uuid||e.eMIs.has(r.id)||r.data.time<e.messagesCallbackTime)}i(jw,"_filterMessage");function mp(r){return r.closed?Ke:r.messagesCallback?Fw(r.db,r.lastCursorId).then(function(e){var t=e.filter(function(o){return!!o}).map(function(o){return o.id>r.lastCursorId&&(r.lastCursorId=o.id),o}).filter(function(o){return jw(o,r)}).sort(function(o,n){return o.time-n.time});return t.forEach(function(o){r.messagesCallback&&(r.eMIs.add(o.id),r.messagesCallback(o.data))}),Ke}):Ke}i(mp,"readNewMessages");function Uw(r){r.closed=!0,r.db.close()}i(Uw,"close");function $w(r,e){return r.writeBlockPromise=r.writeBlockPromise.then(function(){return Ww(r.db,r.uuid,e)}).then(function(){fp(0,10)===0&&qw(r)}),r.writeBlockPromise}i($w,"postMessage");function Bw(r,e,t){r.messagesCallbackTime=t,r.messagesCallback=e,mp(r)}i(Bw,"onMessage");function zw(){return!!dp()}i(zw,"canBeUsed");function Vw(r){return r.idb.fallbackInterval*2}i(Vw,"averageResponseTime");var hp={create:Hw,close:Uw,onMessage:Bw,postMessage:$w,canBeUsed:zw,type:Rw,averageResponseTime:Vw,microSeconds:Cw};var Aw=tt,Gw="pubkey.broadcastChannel-",Jw="localstorage";function yp(){var r;if(typeof window>"u")return null;try{r=window.localStorage,r=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return r}i(yp,"getLocalStorage");function xp(r){return Gw+r}i(xp,"storageKey");function Kw(r,e){return new Promise(function(t){Hs().then(function(){var o=xp(r.channelName),n={token:Yo(),time:Date.now(),data:e,uuid:r.uuid},s=JSON.stringify(n);yp().setItem(o,s);var a=document.createEvent("Event");a.initEvent("storage",!0,!0),a.key=o,a.newValue=s,window.dispatchEvent(a),t()})})}i(Kw,"postMessage");function Qw(r,e){var t=xp(r),o=i(function(s){s.key===t&&e(JSON.parse(s.newValue))},"listener");return window.addEventListener("storage",o),o}i(Qw,"addStorageEventListener");function Xw(r){window.removeEventListener("storage",r)}i(Xw,"removeStorageEventListener");function Zw(r,e){if(e=Zt(e),!gp())throw new Error("BroadcastChannel: localstorage cannot be used");var t=Yo(),o=new Jr(e.localstorage.removeTimeout),n={channelName:r,uuid:t,eMIs:o};return n.listener=Qw(r,function(s){n.messagesCallback&&s.uuid!==t&&(!s.token||o.has(s.token)||s.data.time&&s.data.time<n.messagesCallbackTime||(o.add(s.token),n.messagesCallback(s.data)))}),n}i(Zw,"create");function eb(r){Xw(r.listener)}i(eb,"close");function tb(r,e,t){r.messagesCallbackTime=t,r.messagesCallback=e}i(tb,"onMessage");function gp(){var r=yp();if(!r)return!1;try{var e="__broadcastchannel_check";r.setItem(e,"works"),r.removeItem(e)}catch{return!1}return!0}i(gp,"canBeUsed");function rb(){var r=120,e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")?r*2:r}i(rb,"averageResponseTime");var wp={create:Zw,close:eb,onMessage:tb,postMessage:Kw,canBeUsed:gp,type:Jw,averageResponseTime:rb,microSeconds:Aw};var bp=tt,ob="simulate",gu=new Set;function nb(r){var e={time:bp(),name:r,messagesCallback:null};return gu.add(e),e}i(nb,"create");function ib(r){gu.delete(r)}i(ib,"close");var vp=5;function sb(r,e){return new Promise(function(t){return setTimeout(function(){var o=Array.from(gu);o.forEach(function(n){n.name===r.name&&n!==r&&n.messagesCallback&&n.time<e.time&&n.messagesCallback(e)}),t()},vp)})}i(sb,"postMessage");function ab(r,e){r.messagesCallback=e}i(ab,"onMessage");function ub(){return!0}i(ub,"canBeUsed");function cb(){return vp}i(cb,"averageResponseTime");var Tp={create:nb,close:ib,onMessage:ab,postMessage:sb,canBeUsed:ub,type:ob,averageResponseTime:cb,microSeconds:bp};var Dp=[lp,hp,wp];function wu(r){var e=[].concat(r.methods,Dp).filter(Boolean);if(r.type){if(r.type==="simulate")return Tp;var t=e.find(function(n){return n.type===r.type});if(t)return t;throw new Error("method-type "+r.type+" not found")}r.webWorkerSupport||(e=e.filter(function(n){return n.type!=="idb"}));var o=e.find(function(n){return n.canBeUsed()});if(o)return o;throw new Error("No usable method found in "+JSON.stringify(Dp.map(function(n){return n.type})))}i(wu,"chooseMethod");var vu=new Set,fb=0,er=i(function(e,t){this.id=fb++,vu.add(this),this.name=e,bu&&(t=bu),this.options=Zt(t),this.method=wu(this.options),this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,pb(this)},"BroadcastChannel");er._pubkey=!0;function lb(r){r=Zt(r);var e=wu(r);return e.type==="node"?e.clearNodeFolder().then(function(){return!0}):cp}i(lb,"clearNodeFolder");var bu;function db(r){bu=r}i(db,"enforceOptions"),er.prototype={postMessage:i(function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return Sp(this,"message",e)},"postMessage"),postInternal:i(function(e){return Sp(this,"internal",e)},"postInternal"),set onmessage(r){var e=this.method.microSeconds(),t={time:e,fn:r};Ep(this,"message",this._onML),r&&typeof r=="function"?(this._onML=t,Op(this,"message",t)):this._onML=null},addEventListener:i(function(e,t){var o=this.method.microSeconds(),n={time:o,fn:t};Op(this,e,n)},"addEventListener"),removeEventListener:i(function(e,t){var o=this._addEL[e].find(function(n){return n.fn===t});Ep(this,e,o)},"removeEventListener"),close:i(function(){var e=this;if(!this.closed){vu.delete(this),this.closed=!0;var t=this._prepP?this._prepP:Ke;return this._onML=null,this._addEL.message=[],t.then(function(){return Promise.all(Array.from(e._uMP))}).then(function(){return Promise.all(e._befC.map(function(o){return o()}))}).then(function(){return e.method.close(e._state)})}},"close"),get type(){return this.method.type},get isClosed(){return this.closed}};function Sp(r,e,t){var o=r.method.microSeconds(),n={time:o,type:e,data:t},s=r._prepP?r._prepP:Ke;return s.then(function(){var a=r.method.postMessage(r._state,n);return r._uMP.add(a),a.catch().then(function(){return r._uMP.delete(a)}),a})}i(Sp,"_post");function pb(r){var e=r.method.create(r.name,r.options);up(e)?(r._prepP=e,e.then(function(t){r._state=t})):r._state=e}i(pb,"_prepareChannel");function Mp(r){return r._addEL.message.length>0||r._addEL.internal.length>0}i(Mp,"_hasMessageListeners");function Op(r,e,t){r._addEL[e].push(t),mb(r)}i(Op,"_addListenerObject");function Ep(r,e,t){r._addEL[e]=r._addEL[e].filter(function(o){return o!==t}),hb(r)}i(Ep,"_removeListenerObject");function mb(r){if(!r._iL&&Mp(r)){var e=i(function(n){r._addEL[n.type].forEach(function(s){n.time>=s.time&&s.fn(n.data)})},"listenerFn"),t=r.method.microSeconds();r._prepP?r._prepP.then(function(){r._iL=!0,r.method.onMessage(r._state,e,t)}):(r._iL=!0,r.method.onMessage(r._state,e,t))}}i(mb,"_startListening");function hb(r){if(r._iL&&!Mp(r)){r._iL=!1;var e=r.method.microSeconds();r.method.onMessage(r._state,null,e)}}i(hb,"_stopListening");var xb=i(r=>"ref"in r&&typeof r.ref=="function"&&"unref"in r&&typeof r.unref=="function","isProcessHolding"),gb=i((r,e)=>{if(typeof globalThis.BroadcastChannel=="function"){let o=new globalThis.BroadcastChannel(r);o.onmessage=s=>{e(s.data)};let n=xb(o)?o:null;return n?.unref(),{post:i(async s=>{o.postMessage(s)},"post"),close:i(async()=>{o.close()},"close"),holdProcess:i(s=>{s?n?.ref():n?.unref()},"holdProcess")}}let t=new er(r);return t.onmessage=o=>{e(o)},{post:i(o=>t.postMessage(o),"post"),close:i(()=>t.close(),"close"),holdProcess:i(()=>{},"holdProcess")}},"openChannel"),kp=i(r=>typeof r=="object"&&r!==null,"isObject"),Ip=i((r,e)=>Object.prototype.hasOwnProperty.call(r,e),"hasOwn"),wb=i(r=>{if(!kp(r)||!Ip(r,"deesCommsEvent"))return null;let e=r.deesCommsEvent;return!kp(e)||typeof e.name!="string"||typeof e.uniqueEventId!="string"||!Ip(e,"payload")?"malformed":{name:e.name,uniqueEventId:e.uniqueEventId,payload:e.payload}},"eventOf"),bb=i(()=>{let r=globalThis.crypto.getRandomValues(new Uint8Array(16));return Array.from(r,e=>e.toString(16).padStart(2,"0")).join("")},"createEventId"),Pp=class r{constructor(e={}){this.eventHandlers=new Map;this.hasTypedHandlers=!1;this.closed=!1;this.closing=null;this.typedrouter=new kt.TypedRouter;this.typedtarget=new kt.TypedTarget({postMethodWithTypedRouter:i(async e=>{await this.postMessage(e)},"postMethodWithTypedRouter"),typedRouterRef:this.typedrouter});this.channelName=e.channelName??r.defaultChannelName,this.channel=gb(this.channelName,t=>{this.receive(t)})}static{i(this,"DeesComms")}static{this.defaultChannelName="dees-comms"}createTypedRequest(e){return new kt.TypedRequest(this.typedtarget,e)}async postMessage(e){this.assertOpen(),await this.channel.post(e)}async createTypedHandler(e,t){this.typedrouter.addTypedHandler(new kt.TypedHandler(e,t)),this.hasTypedHandlers=!0,this.holdProcessWhileListened()}async broadcast(e,t){let o={deesCommsEvent:{name:e,uniqueEventId:bb(),payload:t}};await this.postMessage(o)}subscribe(e,t){this.assertOpen();let o=i((s,a)=>t(s,a),"handler"),n=this.eventHandlers.get(e);return n||(n=new Set,this.eventHandlers.set(e,n)),n.add(o),this.holdProcessWhileListened(),{unsubscribe:i(()=>{let s=this.eventHandlers.get(e);s&&(s.delete(o),s.size===0&&(this.eventHandlers.delete(e),this.holdProcessWhileListened()))},"unsubscribe")}}async close(){this.closing||(this.closed=!0,this.eventHandlers.clear(),this.closing=this.channel.close()),await this.closing}holdProcessWhileListened(){this.closed||this.channel.holdProcess(this.hasTypedHandlers||this.eventHandlers.size>0)}assertOpen(){if(this.closed)throw new Error(`DeesComms channel "${this.channelName}" is closed`)}async receive(e){if(this.closed)return;let t=wb(e);if(t==="malformed"){console.log("DeesComms received a malformed event");return}if(t){this.dispatch(t);return}let o=await this.typedrouter.routeAndAddResponse(e,{skipHooks:!0});o&&!o.error&&!this.closed&&await this.postMessage(o)}dispatch(e){let t=this.eventHandlers.get(e.name);if(t)for(let o of[...t]){if(this.closed)return;t.has(o)&&(async()=>o(e.payload,e))().catch(n=>{console.error(`DeesComms: a handler of the event "${e.name}" failed`,n)})}}};export{Pp as DeesComms};
5
+ `)}},"passGuardsOrReject");var nn={};Y(nn,{HttpCache:()=>Xs});var tn={};Y(tn,{TypedrequestCache:()=>_c,WebStore:()=>en});var ar={};Y(ar,{Smartenv:()=>yc,getBrowserPlatformFromUserAgent:()=>om});var om=i((t,e=0)=>{let r=t.toLowerCase();return r.includes("android")?"android":/iphone|ipad|ipod/.test(r)?"ios":r.includes("windows")?"windows":r.includes("macintosh")?e>1?"ios":"mac":r.includes("linux")?"linux":"unknown"},"getBrowserPlatformFromUserAgent"),K0=["standalone","window-controls-overlay"],yc=class{static{i(this,"Smartenv")}constructor(){this.loadedScripts=[]}async getEnvAwareModule(e){if(this.isNode)return await this.getSafeNodeModule(e.nodeModuleName);if(this.isBrowser)return await this.getSafeWebModule(e.webUrlArg,e.getFunction);console.error("platform for loading not supported by smartenv")}async getSafeNodeModule(e,r){if(!this.isNode&&!this.isDeno&&!this.isBun){console.error(`You tried to load a server module in a wrong context: ${e}. This does not throw.`);return}let o=await new Function(`return import('${e}')`)();return r&&await r(o),o}async getSafeWebModule(e,r){if(!this.isBrowser){console.error("You tried to load a web module in a wrong context");return}if(this.loadedScripts.includes(e))return r();this.loadedScripts.push(e);let o=F.defer(),n=globalThis;if(n.importScripts)n.importScripts(e),o.resolve();else{let s=document.createElement("script");s.onload=()=>{o.resolve()},s.src=e,document.head.appendChild(s)}return await o.promise,r()}get runtimeEnv(){let e=globalThis;return typeof e.Deno<"u"&&typeof e.Deno.version<"u"?"deno":typeof e.Bun<"u"&&typeof e.Bun.version<"u"?"bun":typeof globalThis.process<"u"&&typeof globalThis.process?.versions?.node<"u"?"node":(typeof globalThis.window<"u"&&typeof globalThis.document<"u","browser")}get isBrowser(){return this.runtimeEnv==="browser"}get isNode(){return this.runtimeEnv==="node"}get isDeno(){return this.runtimeEnv==="deno"}get isBun(){return this.runtimeEnv==="bun"}get userAgent(){return this.isBrowser?navigator.userAgent:"undefined"}get browserPlatform(){return!this.isBrowser||typeof navigator>"u"?"unknown":om(navigator.userAgent,navigator.maxTouchPoints??0)}get isInstalledPwa(){return!this.isBrowser||typeof globalThis.matchMedia!="function"?!1:K0.some(e=>globalThis.matchMedia(`(display-mode: ${e})`).matches)}get nodeVersion(){return this.isNode?process.version:"undefined"}get denoVersion(){return this.isDeno?globalThis.Deno?.version?.deno??"undefined":"undefined"}get bunVersion(){return this.isBun?globalThis.Bun?.version??"undefined":"undefined"}async getSafeModuleFor(e,r,o){let n;if(Array.isArray(e)?n=e.flatMap(s=>s==="server"?["node","deno","bun"]:[s]):e==="server"?n=["node","deno","bun"]:n=[e],!n.includes(this.runtimeEnv)){console.warn(`Module "${r}" requested for runtime(s) [${n.join(", ")}] but current runtime is "${this.runtimeEnv}". Skipping load.`);return}if(this.isNode||this.isDeno||this.isBun)return await this.getSafeNodeModule(r);if(this.isBrowser){if(!o){console.error(`Browser module load requires getFunction parameter for "${r}"`);return}return await this.getSafeWebModule(r,o)}}get isCI(){return this.isNode?!!process.env.CI:!1}async isMacAsync(){return this.isNode||this.isDeno||this.isBun?(await this.getSafeNodeModule(this.isDeno?"node:os":"os"))?.platform()==="darwin":!1}async isWindowsAsync(){return this.isNode||this.isDeno||this.isBun?(await this.getSafeNodeModule(this.isDeno?"node:os":"os"))?.platform()==="win32":!1}async isLinuxAsync(){return this.isNode||this.isDeno||this.isBun?(await this.getSafeNodeModule(this.isDeno?"node:os":"os"))?.platform()==="linux":!1}async printEnv(){this.isNode?(console.log("running on NODE"),console.log("node version is "+this.nodeVersion)):this.isDeno?(console.log("running on DENO"),console.log("deno version is "+this.denoVersion)):this.isBun?(console.log("running on BUN"),console.log("bun version is "+this.bunVersion)):(console.log("running on BROWSER"),console.log("browser is "+this.userAgent))}};var Ao={};Y(Ao,{Smartjson:()=>Cc,deepEqualJsonLStrings:()=>rb,deepEqualObjects:()=>Um,foldDec:()=>tb,parse:()=>qs,parseBase64:()=>eb,parseJsonL:()=>Pc,stableOneWayStringify:()=>Xg,stringify:()=>ur,stringifyBase64:()=>Ag,stringifyJsonL:()=>Kg,stringifyPretty:()=>Zg});var Ar={};Y(Ar,{Base64:()=>Us,Domain:()=>Hs,GitRepo:()=>js,base64:()=>Zr,create:()=>Rs,docker:()=>Ns,encoding:()=>Fs,indent:()=>Ws,normalize:()=>Ls,type:()=>Ys});var Rs={};Y(Rs,{createCryptoRandomString:()=>Cg,createRandomString:()=>Pg});var Be={};Y(Be,{shortId:()=>Tg,uni:()=>Mg,uniSimple:()=>Og,uuid4:()=>Dg,uuid5:()=>Sg});var Jo={};Y(Jo,{customAlphabet:()=>X0,customRandom:()=>im,nanoid:()=>Z0,random:()=>nm,urlAlphabet:()=>Ps});var Ps="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var nm=i(t=>crypto.getRandomValues(new Uint8Array(t)),"random"),im=i((t,e,r)=>{let o=256-256%t.length;if(o===256){let s=t.length-1;return(a=e)=>{if(!a)return"";let c="";for(;;){let u=r(a),f=a;for(;f--;)if(c+=t[u[f]&s],c.length>=a)return c}}}let n=Math.ceil(1.6*256*e/o);return(s=e)=>{if(!s)return"";let a="";for(;;){let c=r(n),u=n;for(;u--;)if(c[u]<o&&(a+=t[c[u]%t.length],a.length>=s))return a}}},"customRandom"),X0=i((t,e=21)=>im(t,e|0,nm),"customAlphabet"),Z0=i((t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=Ps[r[t]&63];return e},"nanoid");var cr={};Y(cr,{MAX:()=>sm,NIL:()=>am,parse:()=>ut,stringify:()=>um,v1:()=>Cs,v1ToV6:()=>Ko,v3:()=>mm,v4:()=>pm,v5:()=>ym,v6:()=>xm,v6ToV1:()=>Tc,v7:()=>gm,validate:()=>Lt,version:()=>bm});var sm="ffffffff-ffff-ffff-ffff-ffffffffffff";var am="00000000-0000-0000-0000-000000000000";var cm=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function A0(t){return typeof t=="string"&&cm.test(t)}i(A0,"validate");var Lt=A0;function eg(t){if(!Lt(t))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(t.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(t.slice(9,13),16))>>>8,e&255,(e=parseInt(t.slice(14,18),16))>>>8,e&255,(e=parseInt(t.slice(19,23),16))>>>8,e&255,(e=parseInt(t.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}i(eg,"parse");var ut=eg;var ce=[];for(let t=0;t<256;++t)ce.push((t+256).toString(16).slice(1));function De(t,e=0){return(ce[t[e+0]]+ce[t[e+1]]+ce[t[e+2]]+ce[t[e+3]]+"-"+ce[t[e+4]]+ce[t[e+5]]+"-"+ce[t[e+6]]+ce[t[e+7]]+"-"+ce[t[e+8]]+ce[t[e+9]]+"-"+ce[t[e+10]]+ce[t[e+11]]+ce[t[e+12]]+ce[t[e+13]]+ce[t[e+14]]+ce[t[e+15]]).toLowerCase()}i(De,"unsafeStringify");function tg(t,e=0){let r=De(t,e);if(!Lt(r))throw TypeError("Stringified UUID is invalid");return r}i(tg,"stringify");var um=tg;var xc,rg=new Uint8Array(16);function ft(){if(!xc){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");xc=crypto.getRandomValues.bind(crypto)}return xc(rg)}i(ft,"rng");var Qo={};function og(t,e,r){let o,n=t?._v6??!1;if(t){let s=Object.keys(t);s.length===1&&s[0]==="_v6"&&(t=void 0)}if(t)o=fm(t.random??t.rng?.()??ft(),t.msecs,t.nsecs,t.clockseq,t.node,e,r);else{let s=Date.now(),a=ft();ng(Qo,s,a),o=fm(a,Qo.msecs,Qo.nsecs,n?void 0:Qo.clockseq,n?void 0:Qo.node,e,r)}return e??De(o)}i(og,"v1");function ng(t,e,r){return t.msecs??=-1/0,t.nsecs??=0,e===t.msecs?(t.nsecs++,t.nsecs>=1e4&&(t.node=void 0,t.nsecs=0)):e>t.msecs?t.nsecs=0:e<t.msecs&&(t.node=void 0),t.node||(t.node=r.slice(10,16),t.node[0]|=1,t.clockseq=(r[8]<<8|r[9])&16383),t.msecs=e,t}i(ng,"updateV1State");function fm(t,e,r,o,n,s,a=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(!s)s=new Uint8Array(16),a=0;else if(a<0||a+16>s.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);e??=Date.now(),r??=0,o??=(t[8]<<8|t[9])&16383,n??=t.slice(10,16),e+=122192928e5;let c=((e&268435455)*1e4+r)%4294967296;s[a++]=c>>>24&255,s[a++]=c>>>16&255,s[a++]=c>>>8&255,s[a++]=c&255;let u=e/4294967296*1e4&268435455;s[a++]=u>>>8&255,s[a++]=u&255,s[a++]=u>>>24&15|16,s[a++]=u>>>16&255,s[a++]=o>>>8|128,s[a++]=o&255;for(let f=0;f<6;++f)s[a++]=n[f];return s}i(fm,"v1Bytes");var Cs=og;function Ko(t){let e=typeof t=="string"?ut(t):t,r=ig(e);return typeof t=="string"?De(r):r}i(Ko,"v1ToV6");function ig(t){return Uint8Array.of((t[6]&15)<<4|t[7]>>4&15,(t[7]&15)<<4|(t[4]&240)>>4,(t[4]&15)<<4|(t[5]&240)>>4,(t[5]&15)<<4|(t[0]&240)>>4,(t[0]&15)<<4|(t[1]&240)>>4,(t[1]&15)<<4|(t[2]&240)>>4,96|t[2]&15,t[3],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}i(ig,"_v1ToV6");function sg(t){let e=ug(t),r=cg(e,t.length*8);return ag(r)}i(sg,"md5");function ag(t){let e=new Uint8Array(t.length*4);for(let r=0;r<t.length*4;r++)e[r]=t[r>>2]>>>r%4*8&255;return e}i(ag,"uint32ToUint8");function lm(t){return(t+64>>>9<<4)+14+1}i(lm,"getOutputLength");function cg(t,e){let r=new Uint32Array(lm(e)).fill(0);r.set(t),r[e>>5]|=128<<e%32,r[r.length-1]=e,t=r;let o=1732584193,n=-271733879,s=-1732584194,a=271733878;for(let c=0;c<t.length;c+=16){let u=o,f=n,l=s,d=a;o=ye(o,n,s,a,t[c],7,-680876936),a=ye(a,o,n,s,t[c+1],12,-389564586),s=ye(s,a,o,n,t[c+2],17,606105819),n=ye(n,s,a,o,t[c+3],22,-1044525330),o=ye(o,n,s,a,t[c+4],7,-176418897),a=ye(a,o,n,s,t[c+5],12,1200080426),s=ye(s,a,o,n,t[c+6],17,-1473231341),n=ye(n,s,a,o,t[c+7],22,-45705983),o=ye(o,n,s,a,t[c+8],7,1770035416),a=ye(a,o,n,s,t[c+9],12,-1958414417),s=ye(s,a,o,n,t[c+10],17,-42063),n=ye(n,s,a,o,t[c+11],22,-1990404162),o=ye(o,n,s,a,t[c+12],7,1804603682),a=ye(a,o,n,s,t[c+13],12,-40341101),s=ye(s,a,o,n,t[c+14],17,-1502002290),n=ye(n,s,a,o,t[c+15],22,1236535329),o=xe(o,n,s,a,t[c+1],5,-165796510),a=xe(a,o,n,s,t[c+6],9,-1069501632),s=xe(s,a,o,n,t[c+11],14,643717713),n=xe(n,s,a,o,t[c],20,-373897302),o=xe(o,n,s,a,t[c+5],5,-701558691),a=xe(a,o,n,s,t[c+10],9,38016083),s=xe(s,a,o,n,t[c+15],14,-660478335),n=xe(n,s,a,o,t[c+4],20,-405537848),o=xe(o,n,s,a,t[c+9],5,568446438),a=xe(a,o,n,s,t[c+14],9,-1019803690),s=xe(s,a,o,n,t[c+3],14,-187363961),n=xe(n,s,a,o,t[c+8],20,1163531501),o=xe(o,n,s,a,t[c+13],5,-1444681467),a=xe(a,o,n,s,t[c+2],9,-51403784),s=xe(s,a,o,n,t[c+7],14,1735328473),n=xe(n,s,a,o,t[c+12],20,-1926607734),o=we(o,n,s,a,t[c+5],4,-378558),a=we(a,o,n,s,t[c+8],11,-2022574463),s=we(s,a,o,n,t[c+11],16,1839030562),n=we(n,s,a,o,t[c+14],23,-35309556),o=we(o,n,s,a,t[c+1],4,-1530992060),a=we(a,o,n,s,t[c+4],11,1272893353),s=we(s,a,o,n,t[c+7],16,-155497632),n=we(n,s,a,o,t[c+10],23,-1094730640),o=we(o,n,s,a,t[c+13],4,681279174),a=we(a,o,n,s,t[c],11,-358537222),s=we(s,a,o,n,t[c+3],16,-722521979),n=we(n,s,a,o,t[c+6],23,76029189),o=we(o,n,s,a,t[c+9],4,-640364487),a=we(a,o,n,s,t[c+12],11,-421815835),s=we(s,a,o,n,t[c+15],16,530742520),n=we(n,s,a,o,t[c+2],23,-995338651),o=ge(o,n,s,a,t[c],6,-198630844),a=ge(a,o,n,s,t[c+7],10,1126891415),s=ge(s,a,o,n,t[c+14],15,-1416354905),n=ge(n,s,a,o,t[c+5],21,-57434055),o=ge(o,n,s,a,t[c+12],6,1700485571),a=ge(a,o,n,s,t[c+3],10,-1894986606),s=ge(s,a,o,n,t[c+10],15,-1051523),n=ge(n,s,a,o,t[c+1],21,-2054922799),o=ge(o,n,s,a,t[c+8],6,1873313359),a=ge(a,o,n,s,t[c+15],10,-30611744),s=ge(s,a,o,n,t[c+6],15,-1560198380),n=ge(n,s,a,o,t[c+13],21,1309151649),o=ge(o,n,s,a,t[c+4],6,-145523070),a=ge(a,o,n,s,t[c+11],10,-1120210379),s=ge(s,a,o,n,t[c+2],15,718787259),n=ge(n,s,a,o,t[c+9],21,-343485551),o=Ut(o,u),n=Ut(n,f),s=Ut(s,l),a=Ut(a,d)}return Uint32Array.of(o,n,s,a)}i(cg,"wordsToMd5");function ug(t){if(t.length===0)return new Uint32Array;let e=new Uint32Array(lm(t.length*8)).fill(0);for(let r=0;r<t.length;r++)e[r>>2]|=(t[r]&255)<<r%4*8;return e}i(ug,"uint8ToUint32");function Ut(t,e){let r=(t&65535)+(e&65535);return(t>>16)+(e>>16)+(r>>16)<<16|r&65535}i(Ut,"safeAdd");function fg(t,e){return t<<e|t>>>32-e}i(fg,"bitRotateLeft");function _s(t,e,r,o,n,s){return Ut(fg(Ut(Ut(e,t),Ut(o,s)),n),r)}i(_s,"md5cmn");function ye(t,e,r,o,n,s,a){return _s(e&r|~e&o,t,e,n,s,a)}i(ye,"md5ff");function xe(t,e,r,o,n,s,a){return _s(e&o|r&~o,t,e,n,s,a)}i(xe,"md5gg");function we(t,e,r,o,n,s,a){return _s(e^r^o,t,e,n,s,a)}i(we,"md5hh");function ge(t,e,r,o,n,s,a){return _s(r^(e|~o),t,e,n,s,a)}i(ge,"md5ii");var dm=sg;function lg(t){t=unescape(encodeURIComponent(t));let e=new Uint8Array(t.length);for(let r=0;r<t.length;++r)e[r]=t.charCodeAt(r);return e}i(lg,"stringToBytes");var Kr="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Xr="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Xo(t,e,r,o,n,s){let a=typeof r=="string"?lg(r):r,c=typeof o=="string"?ut(o):o;if(typeof o=="string"&&(o=ut(o)),o?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+a.length);if(u.set(c),u.set(a,c.length),u=e(u),u[6]=u[6]&15|t,u[8]=u[8]&63|128,n){if(s=s||0,s<0||s+16>n.length)throw new RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`);for(let f=0;f<16;++f)n[s+f]=u[f];return n}return De(u)}i(Xo,"v35");function wc(t,e,r,o){return Xo(48,dm,t,e,r,o)}i(wc,"v3"),wc.DNS=Kr,wc.URL=Xr;var mm=wc;var dg=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),gc={randomUUID:dg};function mg(t,e,r){if(gc.randomUUID&&!e&&!t)return gc.randomUUID();t=t||{};let o=t.random??t.rng?.()??ft();if(o.length<16)throw new Error("Random bytes length must be >= 16");if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let n=0;n<16;++n)e[r+n]=o[n];return e}return De(o)}i(mg,"v4");var pm=mg;function pg(t,e,r,o){switch(t){case 0:return e&r^~e&o;case 1:return e^r^o;case 2:return e&r^e&o^r&o;case 3:return e^r^o}}i(pg,"f");function bc(t,e){return t<<e|t>>>32-e}i(bc,"ROTL");function hg(t){let e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],o=new Uint8Array(t.length+1);o.set(t),o[t.length]=128,t=o;let n=t.length/4+2,s=Math.ceil(n/16),a=new Array(s);for(let c=0;c<s;++c){let u=new Uint32Array(16);for(let f=0;f<16;++f)u[f]=t[c*64+f*4]<<24|t[c*64+f*4+1]<<16|t[c*64+f*4+2]<<8|t[c*64+f*4+3];a[c]=u}a[s-1][14]=(t.length-1)*8/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=(t.length-1)*8&4294967295;for(let c=0;c<s;++c){let u=new Uint32Array(80);for(let y=0;y<16;++y)u[y]=a[c][y];for(let y=16;y<80;++y)u[y]=bc(u[y-3]^u[y-8]^u[y-14]^u[y-16],1);let f=r[0],l=r[1],d=r[2],p=r[3],h=r[4];for(let y=0;y<80;++y){let w=Math.floor(y/20),g=bc(f,5)+pg(w,l,d,p)+h+e[w]+u[y]>>>0;h=p,p=d,d=bc(l,30)>>>0,l=f,f=g}r[0]=r[0]+f>>>0,r[1]=r[1]+l>>>0,r[2]=r[2]+d>>>0,r[3]=r[3]+p>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}i(hg,"sha1");var hm=hg;function vc(t,e,r,o){return Xo(80,hm,t,e,r,o)}i(vc,"v5"),vc.DNS=Kr,vc.URL=Xr;var ym=vc;function yg(t,e,r){t??={},r??=0;let o=Cs({...t,_v6:!0},new Uint8Array(16));if(o=Ko(o),e){if(r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let n=0;n<16;n++)e[r+n]=o[n];return e}return De(o)}i(yg,"v6");var xm=yg;function Tc(t){let e=typeof t=="string"?ut(t):t,r=xg(e);return typeof t=="string"?De(r):r}i(Tc,"v6ToV1");function xg(t){return Uint8Array.of((t[3]&15)<<4|t[4]>>4&15,(t[4]&15)<<4|(t[5]&240)>>4,(t[5]&15)<<4|t[6]&15,t[7],(t[1]&15)<<4|(t[2]&240)>>4,(t[2]&15)<<4|(t[3]&240)>>4,16|(t[0]&240)>>4,(t[0]&15)<<4|(t[1]&240)>>4,t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}i(xg,"_v6ToV1");var Dc={};function wg(t,e,r){let o;if(t)o=wm(t.random??t.rng?.()??ft(),t.msecs,t.seq,e,r);else{let n=Date.now(),s=ft();gg(Dc,n,s),o=wm(s,Dc.msecs,Dc.seq,e,r)}return e??De(o)}i(wg,"v7");function gg(t,e,r){return t.msecs??=-1/0,t.seq??=0,e>t.msecs?(t.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],t.msecs=e):(t.seq=t.seq+1|0,t.seq===0&&t.msecs++),t}i(gg,"updateV7State");function wm(t,e,r,o,n=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(!o)o=new Uint8Array(16),n=0;else if(n<0||n+16>o.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);return e??=Date.now(),r??=t[6]*127<<24|t[7]<<16|t[8]<<8|t[9],o[n++]=e/1099511627776&255,o[n++]=e/4294967296&255,o[n++]=e/16777216&255,o[n++]=e/65536&255,o[n++]=e/256&255,o[n++]=e&255,o[n++]=112|r>>>28&15,o[n++]=r>>>20&255,o[n++]=128|r>>>14&63,o[n++]=r>>>6&255,o[n++]=r<<2&255|t[10]&3,o[n++]=t[11],o[n++]=t[12],o[n++]=t[13],o[n++]=t[14],o[n++]=t[15],o}i(wm,"v7Bytes");var gm=wg;function bg(t){if(!Lt(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}i(bg,"version");var bm=bg;var Tg=i(t=>Jo.nanoid(t),"shortId"),Dg=i(()=>cr.v4(),"uuid4"),Sg=i((t,e=cr.v5.DNS)=>cr.v5(t,e),"uuid5"),Mg=i((t="uni",e=24)=>`${t}_${"x".repeat(e).replace(/[xy]/g,r=>{let o=Math.random()*16|0;return(r==="x"?o:o&3|8).toString(16)})}`,"uni"),Og=i((t="uni",e=8)=>`${t}${"x".repeat(e).replace(/[xy]/g,r=>{let o=Math.random()*16|0;return(r==="x"?o:o&3|8).toString(16)})}`,"uniSimple");var kg=i((t,e)=>{if(typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.getRandomValues){let r=e-t,o=new Uint32Array(1);return globalThis.crypto.getRandomValues(o),t+o[0]%r}else return Math.floor(Math.random()*(e-t))+t},"getRandomInt"),Ig=i((t,e,r)=>{let o={A:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",a:"abcdefghijklmnopqrstuvwxyz",0:"0123456789","!":"!@#$%^&*()_+-=[]{}|;:,.<>?","*":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=[]{}|;:,.<>?"},n=t;e&&e>t.length?n=t.repeat(Math.ceil(e/t.length)).slice(0,e):e&&(n=t.slice(0,e));let s="";for(let a of n)if(o[a]){let c=o[a],u=kg(0,c.length);s+=c[u]}else s+=a;return s},"customRandomatic"),Pg=i((t,e,r)=>Ig(t,e,r),"createRandomString"),Cg=i(()=>Be.uni(),"createCryptoRandomString");var Ns={};Y(Ns,{makeEnvObject:()=>_g});var _g=i(function(t){let e={},r=/(.*)=(.*)/;if(typeof t<"u")for(let o of t){let n=r.exec(o);n&&(e[n[1]]=n[2])}return e},"makeEnvObject");var Fs={};Y(Fs,{decodeText:()=>Fg,decodeUtf8OrWindows1252:()=>Wg,decodeWindows1252:()=>Sc,encodeWindows1252:()=>Ng,encodingOfLabel:()=>Mm,isValidUtf8:()=>Sm,windows1252ByteOf:()=>Dm});var vm=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376],Rg=new Map(vm.map((t,e)=>[t,128+e])),Tm=4096,Sc=i(t=>{let e="";for(let r=0;r<t.length;r+=Tm){let o=t.subarray(r,r+Tm);e+=String.fromCharCode(...Array.from(o,n=>n>=128&&n<=159?vm[n-128]:n))}return e},"decodeWindows1252"),Dm=i(t=>t<=127||t>=160&&t<=255?t:Rg.get(t),"windows1252ByteOf"),Ng=i(t=>{let e=[],r=[],o=0;for(let n of t){let s=Dm(n.codePointAt(0)??0);s===void 0?(e.push(63),r.push({offset:o,character:n})):e.push(s),o+=n.length}return{bytes:Uint8Array.from(e),replaced:r}},"encodeWindows1252"),Sm=i(t=>{try{return new TextDecoder("utf-8",{fatal:!0}).decode(t),!0}catch{return!1}},"isValidUtf8"),Mm=i(t=>{try{return new TextDecoder(t).encoding}catch{return}},"encodingOfLabel"),Fg=i((t,e,r={})=>{let o=Mm(e);if(o!==void 0)return o==="windows-1252"?Sc(t):new TextDecoder(o,{fatal:r.fatal??!1}).decode(t)},"decodeText"),Wg=i(t=>Sm(t)?{text:new TextDecoder("utf-8").decode(t),encoding:"utf-8"}:{text:Sc(t),encoding:"windows-1252"},"decodeUtf8OrWindows1252");var Ws={};Y(Ws,{indent:()=>Ug,indentWithPrefix:()=>Yg,normalize:()=>Hg});var Mc=i(t=>{let e=t.split(`
6
+ `);return Lg(e)},"splitStringAtLineBreak"),Oc=i(t=>{let e="";for(let r of t)e=e+r+`
7
+ `;return e},"joinStringWithLineBreaks"),Lg=i(t=>{let e=/^[\s]*$/;return e.test(t[0])&&t.shift(),e.test(t[t.length-1])&&t.pop(),t},"cleanStringArray"),Ug=i((t,e)=>{let r=Mc(t);for(let n of r)n=" ".repeat(e)+n;return Oc(r)},"indent"),Yg=i((t,e)=>{let r,o=Mc(t),n=[];for(let s of o)n.push(e+s);return r=Oc(n),r},"indentWithPrefix"),Hg=i(t=>{let e,r=Mc(t),o,n=/^(\s*)/,s=/^(\s*)$/;for(let u of r){let f=n.exec(u),l=f?f[1]:"";(typeof o>"u"||l.length<o)&&!s.test(u)&&(o=l.length)}let a=[],c=o||0;for(let u of r)a.push(u.substr(c));return e=Oc(a),e},"normalize");var Ls={};Y(Ls,{replaceAll:()=>Om,standard:()=>$g});var Om=i((t,e,r)=>t.replace(new RegExp(e,"g"),r),"replaceAll"),jg=i(t=>{let e=t.split(`
8
+ `),r=1/0;for(let o of e)if(o.trim().length>0){let n=o.match(/^(\s*)/);n&&(r=Math.min(r,n[1].length))}return r===1/0||r===0?t:e.map(o=>o.length>=r?o.slice(r):o).join(`
9
+ `)},"stripIndent"),$g=i((t,e)=>{let r=t;return(!e||e.stripIndent)&&(r=jg(r)),(!e||e.normalizeNewline)&&(r=r.replace(/\r\n/g,`
10
+ `)),(!e||e.replaceTabs)&&(r=Om(r," /"," ")),(!e||e.stripLeadingTrailingEmptyLines)&&(r=r.replace(/^\s*[\r\n]/gm,"").replace(/\s*[\r\n]$/gm,"")),(!e||e.stripAllEmptyLines)&&(r=r.replace(/^\s*[\r\n]/gm,"")),r},"standard");var Ys={};Y(Ys,{isBase64:()=>Bg,isUtf8:()=>qg});var Ec={encode:i(t=>{if(typeof Buffer<"u")return Buffer.from(t,"utf8").toString("base64");if(typeof btoa<"u"){let e=new TextEncoder().encode(t),r=Array.from(e,o=>String.fromCharCode(o)).join("");return btoa(r)}else{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new TextEncoder().encode(t),o="",n=0;for(;n<r.length;){let s=r[n++],a=n<r.length?r[n++]:0,c=n<r.length?r[n++]:0,u=s<<16|a<<8|c;o+=e.charAt(u>>18&63),o+=e.charAt(u>>12&63),o+=n-2<r.length?e.charAt(u>>6&63):"=",o+=n-1<r.length?e.charAt(u&63):"="}return o}},"encode"),decode:i(t=>{let e=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"=");if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("utf8");if(typeof atob<"u"){let r=atob(e),o=new Uint8Array(r.length);for(let n=0;n<r.length;n++)o[n]=r.charCodeAt(n);return new TextDecoder().decode(o)}else{let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=[],n=0;for(;n<e.length;){let s=r.indexOf(e.charAt(n++)),a=r.indexOf(e.charAt(n++)),c=r.indexOf(e.charAt(n++)),u=r.indexOf(e.charAt(n++)),f=s<<18|a<<12|c<<6|u;o.push(f>>16&255),c!==64&&o.push(f>>8&255),u!==64&&o.push(f&255)}return new TextDecoder().decode(new Uint8Array(o))}},"decode")},Us=class{static{i(this,"Base64")}constructor(e,r){switch(r){case"string":this.refString=e;break;case"base64":this.refString=Zr.decode(e);break;case"base64uri":this.refString=Zr.decode(e)}}get simpleString(){return this.refString}get base64String(){return Zr.encode(this.refString)}get base64UriString(){return Zr.encodeUri(this.refString)}},Zr={encode:i(t=>Ec.encode(t),"encode"),encodeUri:i(t=>Ec.encode(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),"encodeUri"),decode:i(t=>Ec.decode(t),"decode"),isBase64:i(t=>/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$/.test(t),"isBase64")};var qg=i(t=>{let r=new TextEncoder().encode(t),o=0;for(;o<r.length;){if(r[o]===9||r[o]===10||r[o]===13||32<=r[o]&&r[o]<=126){o+=1;continue}if(194<=r[o]&&r[o]<=223&&128<=r[o+1]&&r[o+1]<=191){o+=2;continue}if(r[o]===224&&160<=r[o+1]&&r[o+1]<=191&&128<=r[o+2]&&r[o+2]<=191||(225<=r[o]&&r[o]<=236||r[o]===238||r[o]===239)&&128<=r[o+1]&&r[o+1]<=191&&128<=r[o+2]&&r[o+2]<=191||r[o]===237&&128<=r[o+1]&&r[o+1]<=159&&128<=r[o+2]&&r[o+2]<=191){o+=3;continue}if(r[o]===240&&144<=r[o+1]&&r[o+1]<=191&&128<=r[o+2]&&r[o+2]<=191&&128<=r[o+3]&&r[o+3]<=191||241<=r[o]&&r[o]<=243&&128<=r[o+1]&&r[o+1]<=191&&128<=r[o+2]&&r[o+2]<=191&&128<=r[o+3]&&r[o+3]<=191||r[o]===244&&128<=r[o+1]&&r[o+1]<=143&&128<=r[o+2]&&r[o+2]<=191&&128<=r[o+3]&&r[o+3]<=191){o+=4;continue}return!1}return!0},"isUtf8"),Bg=i(t=>{let e=/[^A-Z0-9+\/=]/i,r=t.length;if(!r||r%4!==0||e.test(t))return!1;let o=t.indexOf("=");return o===-1||o===r-1||o===r-2&&t[r-1]==="="},"isBase64");var Hs=class{static{i(this,"Domain")}constructor(e){this.protocol=this._protocolRegex(e),this.protocol||(e=`https://${e}`),this.nodeParsedUrl=new URL(e),this.port=this.nodeParsedUrl.port;let r=this._domainRegex(e.replace(this.nodeParsedUrl.pathname,""));[this.level1,this.level2,this.level3,this.level4,this.level5]=r,this.fullName="";for(let o of r)this.fullName===""?this.fullName=o:this.fullName=o+"."+this.fullName;this.zoneName=[this.level2,this.level1].filter(Boolean).join("."),this.topLevel=this.level1,this.domainName=this.level2,this.subDomain=this.level3}_domainRegex(e){let o=/([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}$/.exec(e);if(!o)return[];let n=[...o].reverse();return n.pop(),n.filter(function(a){return a!==""})}_protocolRegex(e){let o=/^([a-zA-Z0-9]*):\/\//.exec(e);if(o)return o[1]}_portRegex(e){let o=/^([a-zA-Z0-9]*):\/\//.exec(e);if(o)return o[1]}};var js=class{static{i(this,"GitRepo")}constructor(e,r){let o=zg(e);if(!o)throw new Error(`Invalid git repository URL: ${e}`);this.host=o[1],this.user=o[2],this.repo=o[3],this.accessToken=r,this.sshUrl=Em(this.host,this.user,this.repo,this.accessToken,"ssh"),this.httpsUrl=Em(this.host,this.user,this.repo,this.accessToken,"https")}},zg=i(function(t){return/([a-zA-Z0-9\-_\.]*)(?:\/|\:)([a-zA-Z0-9\-_\.]*)(?:\/)([a-zA-Z0-9\-_\.]*)(?:\.git)/.exec(t)},"gitRegex"),Em=i(function(t,e,r,o="",n){switch(o!==""&&(o=o+"@"),n){case"https":return"https://"+o+t+"/"+e+"/"+r+".git";case"ssh":return"git@"+t+":"+e+"/"+r+".git"}},"gitLink");var Pm=fn(Im(),1),eo=Pm.default;var _m=i(()=>globalThis.Buffer,"getNodeBuffer");function Vg(t){let e=_m();return e?e.from(t).toString("base64"):btoa(String.fromCharCode(...t))}i(Vg,"base64Encode");function Gg(t){let e=_m();if(e){let r=e.from(t,"base64");return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}return new Uint8Array(Array.from(atob(t)).map(r=>r.charCodeAt(0)))}i(Gg,"base64Decode");function Zo(t,e){return JSON.stringify(t,$s,e)}i(Zo,"stringify");function Ic(t){return JSON.parse(t,Rm)}i(Ic,"parse");var $s=i((t,e)=>{if(Qg(e)){let r;if("data"in e&&Nm(e.data))r=new Uint8Array(e.data);else if(e instanceof Uint8Array)r=e;else return e;return{type:"EncodedBuffer",data:"base64:"+Vg(r)}}return e},"replacer"),Rm=i((t,e)=>{if(Jg(e)&&kc(e.data)&&e.data.startsWith("base64:")){let r=e.data.slice(7);return Gg(r)}return e},"reviver");function Jg(t){return Fm(t)&&t.type==="EncodedBuffer"&&kc(t.data)}i(Jg,"isEncodedBuffer");function Qg(t){return Fm(t)&&t.type==="Buffer"&&(Nm(t.data)||kc(t.data))||t instanceof Uint8Array}i(Qg,"isBufferLike");function Nm(t){return Array.isArray(t)}i(Nm,"isArray");function kc(t){return typeof t=="string"}i(kc,"isString");function Fm(t){return typeof t=="object"&&t!==null}i(Fm,"isObject");var Lm=i(t=>{let e=JSON.parse(Zo(t)),r=!0,o=i(s=>{if(Array.isArray(s))return s.map(f=>o(f));if(s===null||typeof s!="object")return s;let a=Object.keys(s).sort(),c={};for(let f of a){let l=o(s[f]);f in c?Object.defineProperty(c,f,{configurable:!0,enumerable:!0,value:l,writable:!0}):c[f]=l}let u=Object.keys(c);return(u.length!==a.length||u.some((f,l)=>f!==a[l]))&&(r=!1),c},"createSortedValue"),n=o(e);return r?JSON.stringify(n):eo(e,{})},"stableStringify");var qs=Ic,Pc=i(t=>t.split(`
11
+ `).reduce((o,n)=>{let s=n.trim();return s.length>0&&o.push(qs(s)),o},[]),"parseJsonL"),Kg=i(t=>t.map(e=>ur(e)).join(`
12
+ `),"stringifyJsonL"),Xg=i((t,e,r={})=>{let o=new WeakSet,n=i(c=>{if(c===null||typeof c!="object")return c;let u=$s("",c);if(u&&u.type==="EncodedBuffer"&&typeof u.data=="string")return u;if(o.has(c))return"__cycle__";if(o.add(c),Array.isArray(c))return c.map(l=>n(l));let f={};for(let l of Object.keys(c))try{f[l]=n(c[l])}catch{f[l]="__unserializable__"}return f},"sanitize"),s=n(t),a={...r,cycles:!0};if(e&&!a.cmp){let c=new Map;e.forEach((u,f)=>c.set(u,f)),a.cmp=(u,f)=>{let l=c.has(u.key)?c.get(u.key):Number.POSITIVE_INFINITY,d=c.has(f.key)?c.get(f.key):Number.POSITIVE_INFINITY;return l!==d?l-d:u.key<f.key?-1:u.key>f.key?1:0}}return eo(s,a)},"stableOneWayStringify"),ur=i((t,e,r=void 0)=>{if(r===void 0&&e===void 0)return Lm(t);let o=Zo(t);t=JSON.parse(o);let n={...r};if(e&&!n.cmp){let a=new Map;e.forEach((c,u)=>a.set(c,u)),n.cmp=(c,u)=>{let f=a.has(c.key)?a.get(c.key):Number.POSITIVE_INFINITY,l=a.has(u.key)?a.get(u.key):Number.POSITIVE_INFINITY;return f!==l?f-l:c.key<u.key?-1:c.key>u.key?1:0}}return eo(t,n)},"stringify"),Zg=i(t=>{let e=ur(t),r=JSON.parse(e);return JSON.stringify(r,null,2)},"stringifyPretty"),Ag=i((...t)=>{let e=ur(...t);return Ar.base64.encodeUri(e)},"stringifyBase64"),eb=i(t=>{let e=Ar.base64,o=(e.decodeUri||e.decode)(t);return qs(o)},"parseBase64"),Cc=class t{static{i(this,"Smartjson")}static enfoldFromObject(e){let r=new this,o=r.saveableProperties||[];for(let n in e)o.indexOf(n)!==-1&&(r[n]=e[n]);return r}static enfoldFromJson(e){let r=qs(e);return this.enfoldFromObject(r)}saveableProperties=[];foldToObject(){let e=new Set;return e.add(this),this.foldToObjectInternal(e)}foldToObjectInternal(e){let r={},o=i(s=>{if(s instanceof t){if(e.has(s))throw new Error("cycle detected");return e.add(s),s.foldToObjectInternal(e)}return Array.isArray(s)?s.map(a=>o(a)):structuredClone(s)},"foldValue"),n=this.saveableProperties||[];for(let s of n){let a=this[s];r[s]=o(a)}return r}foldToJson(){let e=this.foldToObject();return ur(e)}},tb=i(()=>(t,e)=>{let r=String(e.name);e.addInitializer(function(){this.saveableProperties||(this.saveableProperties=[]),this.saveableProperties.includes(r)||this.saveableProperties.push(r)})},"foldDec"),Um=i((t,e)=>{let r=ur(t),o=ur(e);return r===o},"deepEqualObjects"),rb=i((t,e)=>{let r=Pc(t),o=Pc(e);return Um(r,o)},"deepEqualJsonLStrings");var Ym={};var Bs=class{static{i(this,"WebStoreDb")}constructor(e){this.nativeDb=e}async get(e,r,o={}){return this.runObjectStoreRequest(e,"readonly",n=>n.get(r),o)}async getKey(e,r,o={}){return this.runObjectStoreRequest(e,"readonly",n=>n.getKey(r),o)}async put(e,r,o,n={}){return this.runObjectStoreRequest(e,"readwrite",s=>o===void 0?s.put(r):s.put(r,o),n)}async delete(e,r,o={}){await this.runObjectStoreRequest(e,"readwrite",n=>n.delete(r),o)}async clear(e,r={}){await this.runObjectStoreRequest(e,"readwrite",o=>o.clear(),r)}async getAllKeys(e,r={}){return this.runObjectStoreRequest(e,"readonly",o=>o.getAllKeys(),r)}close(){this.nativeDb.close()}async runObjectStoreRequest(e,r,o,n){n.signal?.throwIfAborted();let s=this.nativeDb.transaction(e,r),a=s.objectStore(e),c=o(a),u,f=new Promise((d,p)=>{u=p}),l=i(()=>{try{s.abort()}catch(d){if(!(d instanceof DOMException)||d.name!=="InvalidStateError"){u(d);return}}n.signal&&u(n.signal.reason)},"abortTransaction");n.signal?.addEventListener("abort",l,{once:!0});try{let[d]=await Promise.race([Promise.all([ob(c),nb(s)]),f]);return d}catch(d){throw n.signal?.aborted?n.signal.reason:d}finally{n.signal?.removeEventListener("abort",l)}}},jm=i(async(t,e)=>{if(e?.throwIfAborted(),!e)return t;let r,o=new Promise((s,a)=>{r=a}),n=i(()=>{r(e.reason)},"abortListener");e.addEventListener("abort",n,{once:!0});try{return await Promise.race([t,o])}finally{e.removeEventListener("abort",n)}},"awaitWithSignal"),ob=i(t=>new Promise((e,r)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>r(zs("IndexedDB request failed",t.error))}),"indexedDbRequestToPromise"),nb=i(t=>new Promise((e,r)=>{t.oncomplete=()=>e(),t.onabort=()=>r(zs("IndexedDB transaction aborted",t.error)),t.onerror=()=>r(zs("IndexedDB transaction failed",t.error))}),"indexedDbTransactionToPromise"),zs=i((t,e)=>e?new Error(`${t}: ${e.message}`,{cause:e}):new Error(t),"createIndexedDbError"),$m=i((t,e)=>{t.objectStoreNames.contains(e)||t.createObjectStore(e)},"ensureObjectStore"),qm=i(async(t,e,r)=>{if(!globalThis.indexedDB)throw new Error("IndexedDB is not available in this runtime");return new Promise((o,n)=>{let s=!1,a=typeof e=="number"?globalThis.indexedDB.open(t,e):globalThis.indexedDB.open(t),c=i(u=>{s||(s=!0,n(u instanceof Error?u:new Error(String(u))))},"rejectOnce");a.onupgradeneeded=()=>{if(r)try{r(a.result)}catch(u){a.transaction?.abort(),c(u)}},a.onsuccess=()=>{if(s){a.result.close();return}s=!0;let u=a.result;u.onversionchange=()=>u.close(),o(u)},a.onerror=()=>c(zs(`Failed to open IndexedDB database "${t}"`,a.error)),a.onblocked=()=>c(new Error(`Opening IndexedDB database "${t}" was blocked by another connection`))})},"openNativeDb"),ib=i(async(t,e)=>{let r=await qm(t,void 0,n=>$m(n,e));if(r.objectStoreNames.contains(e))return new Bs(r);let o=r.version+1;if(r.close(),r=await qm(t,o,n=>$m(n,e)),!r.objectStoreNames.contains(e))throw r.close(),new Error(`Failed to create IndexedDB object store "${e}" in database "${t}"`);return new Bs(r)},"openWebStoreDb"),en=class{static{i(this,"WebStore")}constructor(e){this.lifecycleGeneration=0,this.closeCoveredGeneration=0,this.activeOperations=new Set,this.options=e}trackOperation(e){this.lifecycleGeneration+=1;let r;return r=(async()=>e())().finally(()=>{this.activeOperations.delete(r)}),this.activeOperations.add(r),r}init(e={}){return this.trackOperation(()=>this.initForOperation(e.signal))}async initForOperation(e){e?.throwIfAborted();let r=this.closePromise;return r&&(await jm(r,e),e?.throwIfAborted()),this.initPromise||(this.initPromise=this.runInit().catch(o=>{throw this.initPromise=void 0,o})),jm(this.initPromise,e)}async runInit(){let e=new ar.Smartenv;if(!e.isBrowser&&!globalThis.indexedDB&&(await e.getSafeNodeModule("fake-indexeddb/auto"),!globalThis.indexedDB)){let r=await e.getSafeNodeModule("fake-indexeddb");globalThis.indexedDB=new r.IDBFactory}this.db=await ib(this.options.dbName,this.options.storeName)}runDataOperation(e,r){return this.trackOperation(async()=>(await this.initForOperation(r.signal),r.signal?.throwIfAborted(),e(this.db)))}close(){let e=this.lifecycleGeneration;if(this.closePromise&&e<=this.closeCoveredGeneration)return this.closePromise;let r=this.closePromise,o=[...this.activeOperations];if(!r&&!this.initPromise&&o.length===0)return Promise.resolve();let n;return n=(async()=>{try{if(r)try{await r}catch{}await Promise.allSettled(o);let s=this.initPromise;if(!s)return;try{await s}catch{return}finally{this.initPromise===s&&(this.initPromise=void 0)}this.db.close()}finally{this.closePromise===n&&(this.closePromise=void 0)}})(),this.closePromise=n,this.closeCoveredGeneration=e,n}async get(e,r={}){return this.runDataOperation(o=>o.get(this.options.storeName,e,r),r)}async check(e,r={}){return this.runDataOperation(async o=>await o.getKey(this.options.storeName,e,r)!==void 0,r)}async set(e,r,o={}){return this.runDataOperation(n=>n.put(this.options.storeName,r,e,o),o)}async delete(e,r={}){return this.runDataOperation(o=>o.delete(this.options.storeName,e,r),r)}async clear(e={}){return this.runDataOperation(r=>r.clear(this.options.storeName,e),e)}async keys(e={}){return this.runDataOperation(r=>r.getAllKeys(this.options.storeName,e),e)}};var _c=class{static{i(this,"TypedrequestCache")}constructor(e="default"){this.webstore=new en({dbName:"trStore",storeName:`trStore-${e}`})}buildKey(e){return Ao.stringify({method:e.method,request:e.request})}async setByRequest(e){if(!e.response)throw new Error("You cannot store requests without a response present");await this.webstore.set(this.buildKey(e),e)}async getByRequest(e){return await this.webstore.get(this.buildKey(e))}};var Vs=class{static{i(this,"CacheStore")}constructor(e,r){this.lifecycleController=new AbortController,this.closeReason=new Error("HttpCache store is closed"),this.disposed=!1,this.pruneGeneration=0,this.pruneWaiters=new Set,this.activeOwnedOperations=new Set,this.webstore=new tn.WebStore({dbName:e,storeName:r})}async set(e,r,o){let n=this.getOperationSignal(o.signal);if(!Number.isSafeInteger(o.maxEntries)||o.maxEntries<=0)throw new RangeError("HttpCache maxEntries must be a positive safe integer");await this.webstore.set(e,r,{signal:n}),await this.schedulePrune(o.maxEntries,n)}async get(e,r={}){let o=this.getOperationSignal(r.signal);try{let n=await this.webstore.get(e,{signal:o});return n===void 0?null:Bm(n)?n:(await this.webstore.delete(e,{signal:o}),null)}catch{if(o.aborted)throw o.reason;return null}}async has(e,r={}){return await this.get(e,r)!==null}async delete(e,r={}){let o=this.getOperationSignal(r.signal);await this.webstore.delete(e,{signal:o})}async clear(e={}){let r=this.getOperationSignal(e.signal);await this.webstore.clear({signal:r})}responseFromCacheEntry(e){return new Response(e.response,{status:e.status,statusText:e.statusText,headers:new Headers(e.headers)})}cacheEntryFromResponse(e,r,o,n={}){return this.trackOwnedOperation(async()=>{let s=this.getOperationSignal(n.signal),a=n.preserveResponse!==!1,c=a?r.clone():r,u=await cb(c,s,a?r.body:void 0,n.responseSignal),f={};return c.headers.forEach((l,d)=>{f[d]=l}),{response:u,headers:f,timestamp:Date.now(),etag:o?.etag||c.headers.get("etag")||void 0,lastModified:o?.lastModified||c.headers.get("last-modified")||void 0,maxAge:o?.maxAge,url:e,status:c.status,statusText:c.statusText}})}close(){if(this.closePromise)return this.closePromise;this.disposed=!0,this.lifecycleController.abort(this.closeReason);let e=this.pruneLoopPromise,r=[...this.activeOwnedOperations];return this.closePromise=(async()=>{await Promise.allSettled([...r,...e?[e]:[]]),await this.webstore.close()})(),this.closePromise}async schedulePrune(e,r){r?.throwIfAborted();let o=++this.pruneGeneration;this.pendingPruneMaxEntries=this.pendingPruneMaxEntries===void 0?e:Math.min(this.pendingPruneMaxEntries,e);let n,s=new Promise((a,c)=>{n={generation:o,resolve:a,reject:c}});this.pruneWaiters.add(n),this.ensurePruneLoop();try{await ub(s,r)}finally{this.pruneWaiters.delete(n)}}ensurePruneLoop(){if(this.pruneLoopPromise)return;let e=this.runPruneLoop().catch(r=>{this.pendingPruneMaxEntries=void 0,this.settlePruneWaiters(this.pruneGeneration,r)}).finally(()=>{this.pruneLoopPromise===e&&(this.pruneLoopPromise=void 0,this.pendingPruneMaxEntries!==void 0&&!this.disposed&&this.ensurePruneLoop())});this.pruneLoopPromise=e}async runPruneLoop(){for(;this.pendingPruneMaxEntries!==void 0;){let e=this.pendingPruneMaxEntries;this.pendingPruneMaxEntries=void 0;let r=this.pruneGeneration;await this.pruneToLimit(e,this.lifecycleController.signal),this.settlePruneWaiters(r)}}settlePruneWaiters(e,r){for(let o of this.pruneWaiters)o.generation>e||(this.pruneWaiters.delete(o),r===void 0?o.resolve():o.reject(r))}async pruneToLimit(e,r){let o=await this.collectEntries(r),n=[];for(let a of o){if(a.valid&&!ab(a)){n.push(a);continue}r.throwIfAborted(),await this.webstore.delete(a.key,{signal:r})}n.sort((a,c)=>a.timestamp===c.timestamp?a.key.localeCompare(c.key):a.timestamp-c.timestamp);let s=Math.max(0,n.length-e);for(let a of n.slice(0,s))r.throwIfAborted(),await this.webstore.delete(a.key,{signal:r})}async collectEntries(e){e.throwIfAborted();let r=await this.webstore.keys({signal:e}),o=[];for(let n of r)if(e.throwIfAborted(),typeof n=="string")try{let s=await this.webstore.get(n,{signal:e});o.push(Bm(s)?{key:n,valid:!0,timestamp:s.timestamp,maxAge:s.maxAge}:{key:n,valid:!1,timestamp:0})}catch{if(e.aborted)throw e.reason}return o}getOperationSignal(e){if(this.disposed)throw this.closeReason;return e?.throwIfAborted(),e?AbortSignal.any([e,this.lifecycleController.signal]):this.lifecycleController.signal}trackOwnedOperation(e){let r=e().finally(()=>{this.activeOwnedOperations.delete(r)});return this.activeOwnedOperations.add(r),r}},Bm=i(t=>{if(!t||typeof t!="object")return!1;let e=Reflect.get(t,"headers");return Reflect.get(t,"response")instanceof ArrayBuffer&&typeof e=="object"&&e!==null&&Number.isFinite(Reflect.get(t,"timestamp"))&&typeof Reflect.get(t,"url")=="string"&&Number.isInteger(Reflect.get(t,"status"))&&typeof Reflect.get(t,"statusText")=="string"},"isCacheEntry"),ab=i(t=>t.maxAge!==void 0&&t.maxAge>0&&Date.now()-t.timestamp>=t.maxAge,"isExpired"),cb=i(async(t,e,r,o)=>{e.throwIfAborted();let n=t.body?.getReader();if(!n)return new ArrayBuffer(0);let s=[],a=0,c,u=new Promise((h,y)=>{c=y}),f,l=i(()=>{c(e.reason),o?.aborted||(f=Promise.all([n.cancel(e.reason).catch(()=>{}),r?.cancel(e.reason).catch(()=>{})]).then(()=>{}))},"onAbort");e.addEventListener("abort",l,{once:!0});try{for(;;){let h=await Promise.race([n.read(),u]);if(h.done)break;s.push(h.value),a+=h.value.byteLength}}finally{e.removeEventListener("abort",l),f&&await f;try{n.releaseLock()}catch{}}let d=new Uint8Array(a),p=0;for(let h of s)d.set(h,p),p+=h.byteLength;return d.buffer},"consumeArrayBuffer"),ub=i(async(t,e)=>{if(!e)return t;e.throwIfAborted();let r,o=new Promise((s,a)=>{r=a}),n=i(()=>r(e.reason),"onAbort");e.addEventListener("abort",n,{once:!0});try{return await Promise.race([t,o])}finally{e.removeEventListener("abort",n)}},"awaitWithSignal");var zm=Symbol.for("@push.rocks/smartrequest/FetchTimeoutError"),Pe=class extends Error{static{i(this,"FetchTimeoutError")}constructor(e,r){super(`Request timeout after ${r}ms: ${e}`),this.name="FetchTimeoutError",this.url=e,this.timeoutMs=r,Object.defineProperty(this,zm,{value:!0})}},fr=i(t=>t instanceof Error&&Reflect.get(t,zm)===!0,"isFetchTimeoutError"),He=i(t=>{if(t.reason instanceof Error)return t.reason;let e=new Error("The request was aborted");return e.name="AbortError",e},"abortReasonOf"),Yt=i(t=>t instanceof Error?t:new Error(String(t)),"toError"),lt=i(async(t,e)=>{!t?.body||t.bodyUsed||await t.body.cancel(e).catch(()=>{})},"discardResponse"),Vm=i((t,e)=>e?.aborted?Promise.reject(He(e)):new Promise((r,o)=>{let n=i(()=>{clearTimeout(s),o(He(e))},"onAbort"),s=setTimeout(()=>{e?.removeEventListener("abort",n),r()},Math.max(0,t));e?.addEventListener("abort",n,{once:!0})}),"abortableDelay");var Gs=i(t=>{let e={maxAge:0,etag:t.get("etag")??void 0,lastModified:t.get("last-modified")??void 0,immutable:!1,noCache:!1,noStore:!1,mustRevalidate:!1},r=!1;for(let o of(t.get("cache-control")??"").toLowerCase().split(",").map(n=>n.trim()))if(o==="no-cache")e.noCache=!0;else if(o==="no-store")e.noStore=!0;else if(o==="immutable")e.immutable=!0;else if(o==="must-revalidate")e.mustRevalidate=!0;else if(o.startsWith("max-age=")){let n=Number.parseInt(o.slice(8),10);Number.isNaN(n)||(e.maxAge=n*1e3,r=!0)}if(!r){let o=Date.parse(t.get("expires")??"");Number.isNaN(o)||(e.maxAge=Math.max(0,o-Date.now()))}return e},"extractCacheMetadata"),Gm=i((t,e)=>{if(e.noStore)return!1;if(e.immutable)return!0;let r=t.maxAge||e.maxAge||0;return r>0&&Date.now()-t.timestamp<r},"isFresh"),Js=i(t=>t.noCache||t.mustRevalidate,"requiresRevalidation"),Jm=i(t=>{let e={};return t.etag&&(e["if-none-match"]=t.etag),t.lastModified&&(e["if-modified-since"]=t.lastModified),e},"createConditionalHeaders"),Qm=i(t=>{let e={};return t.forEach((r,o)=>{e[o]=r}),e},"headersToObject");var lr=i((t,...e)=>{t.logging&&console.log("[smartrequest/cache]",...e)},"log"),ot=i((t,e,r)=>({response:t,fromCache:e,revalidated:r}),"result"),fb=i((t,e)=>e===void 0?t:Math.min(t,e),"resolveEffectiveMaxAge"),Km=i((t,e,r)=>Gm(e,r)&&(t.cacheMaxAge===void 0||Date.now()-e.timestamp<t.cacheMaxAge),"isFreshForContext"),rn=i(async(t,e,r)=>{!t?.body||t.bodyUsed||r?.aborted||await t.body.cancel(e).catch(()=>{})},"discard"),on=i(async(t,e,r,o=!0)=>{if(!e.ok)return;let n=Gs(e.headers);if(!n.noStore){n.maxAge=fb(n.maxAge,t.cacheMaxAge);try{let s=await t.cacheStore.cacheEntryFromResponse(t.request.url,e,n,{signal:t.signal,responseSignal:r,preserveResponse:o});await t.cacheStore.set(t.cacheKey,s,{signal:t.signal,maxEntries:t.maxEntries})}catch(s){throw await rn(e,s,r),s}}},"store"),Qs=i(t=>t.cacheStore.get(t.cacheKey,{signal:t.signal}),"readEntry"),lb=i(async t=>{let e;try{return e=await t.dispatch(t.request),await on(t,e,t.request.signal),ot(e,!1,!1)}catch(r){if(await rn(e,r,t.request.signal),t.signal.aborted)throw t.signal.reason;if(fr(r)||e)throw r;lr(t,"network failed, trying cache:",t.request.url,r);let o=await Qs(t);if(!o)throw r;return ot(t.cacheStore.responseFromCacheEntry(o),!0,!1)}},"networkFirst"),db=i(async t=>{let e=await Qs(t);if(e){let o=Gs(new Headers(e.headers));if(Km(t,e,o)&&!Js(o))return lr(t,"cache hit (fresh):",t.request.url),ot(t.cacheStore.responseFromCacheEntry(e),!0,!1);if(Js(o)&&(e.etag||e.lastModified))return await mb(t,e)}lr(t,"cache miss, fetching:",t.request.url);let r=await t.dispatch(t.request);return await on(t,r,t.request.signal),ot(r,!1,!1)},"cacheFirst"),mb=i(async(t,e)=>{let r=new Request(t.request,{headers:{...Qm(t.request.headers),...Jm(e)},signal:t.signal}),o;try{return o=await t.dispatch(r),o.status===304?(lr(t,"cache revalidated (304):",t.request.url),await rn(o,"304 answered from the cache",r.signal),e.timestamp=Date.now(),await t.cacheStore.set(t.cacheKey,e,{signal:t.signal,maxEntries:t.maxEntries}),ot(t.cacheStore.responseFromCacheEntry(e),!0,!0)):(await on(t,o,r.signal),ot(o,!1,!0))}catch(n){if(await rn(o,n,r.signal),t.signal.aborted)throw t.signal.reason;if(fr(n)||o)throw n;return lr(t,"revalidation failed, using cache:",t.request.url,n),ot(t.cacheStore.responseFromCacheEntry(e),!0,!1)}},"revalidate"),pb=i(async t=>{let e=await Qs(t);if(!e){let o=await t.dispatch(t.request);return await on(t,o,t.request.signal),ot(o,!1,!1)}let r=Gs(new Headers(e.headers));if(!Km(t,e,r)||Js(r)){let o=new Request(t.request);t.scheduleBackgroundRevalidation(async n=>{let s={...t,request:new Request(o,{signal:n}),signal:n},a;try{a=await s.dispatch(s.request),await on(s,a,s.request.signal,!1),lr(t,"background revalidation complete:",t.request.url)}catch(c){n.aborted||lr(t,"background revalidation failed:",t.request.url,c)}finally{await rn(a,"background response discarded",s.request.signal)}})}return ot(t.cacheStore.responseFromCacheEntry(e),!0,!1)},"staleWhileRevalidate"),hb=i(async t=>{let e=await Qs(t);if(!e)throw new Error(`Cache miss for ${t.request.url} (cache-only)`);return ot(t.cacheStore.responseFromCacheEntry(e),!0,!1)},"cacheOnly"),Xm={"network-first":lb,"cache-first":db,"stale-while-revalidate":pb,"cache-only":hb};var Ks=class{static{i(this,"CacheManager")}constructor(e,r){this.cacheStore=e,this.maxEntries=r,this.lifecycleController=new AbortController,this.closeReason=new Error("HttpCache is closed"),this.disposed=!1,this.backgroundRevalidations=new Map}async execute(e,r,o){if(this.disposed)throw this.closeReason;if(e.signal.throwIfAborted(),r.cacheMaxAge!==void 0&&(!Number.isSafeInteger(r.cacheMaxAge)||r.cacheMaxAge<0))throw new RangeError("cacheMaxAge must be a non-negative safe integer");let n=yb(e,r),s=new AbortController,a=setTimeout(()=>s.abort(new Pe(e.url,r.timeout)),Math.max(0,r.timeout)),c={request:e,cacheKey:n,cacheStore:this.cacheStore,dispatch:o,logging:r.logging,signal:AbortSignal.any([e.signal,this.lifecycleController.signal,s.signal]),cacheMaxAge:r.cacheMaxAge,maxEntries:this.maxEntries,scheduleBackgroundRevalidation:i(u=>this.scheduleBackgroundRevalidation(n,e.url,r.timeout,u),"scheduleBackgroundRevalidation")};try{return await Xm[r.cacheStrategy](c)}finally{clearTimeout(a)}}close(){if(this.closePromise)return this.closePromise;this.disposed=!0,this.lifecycleController.abort(this.closeReason);let e=[...this.backgroundRevalidations.values()];return this.closePromise=(async()=>{await Promise.allSettled(e),await this.cacheStore.close()})(),this.closePromise}scheduleBackgroundRevalidation(e,r,o,n){if(this.disposed||this.backgroundRevalidations.has(e))return;let s=new AbortController,a=setTimeout(()=>s.abort(new Pe(r,o)),Math.max(0,o)),c=n(AbortSignal.any([this.lifecycleController.signal,s.signal])).catch(()=>{}).finally(()=>{clearTimeout(a),this.backgroundRevalidations.get(e)===c&&this.backgroundRevalidations.delete(e)});this.backgroundRevalidations.set(e,c)}},yb=i((t,e)=>{if(typeof e.cacheKey=="function")return e.cacheKey(t);if(typeof e.cacheKey=="string")return e.cacheKey;if(t.method==="GET")return t.url;throw new TypeError(`cacheStrategy '${e.cacheStrategy}' for a ${t.method} request needs a cacheKey`)},"cacheKeyOf");var Xs=class t{static{i(this,"HttpCache")}static{this.defaultDbName="smartrequest-cache"}static{this.defaultStoreName="cache"}static{this.defaultMaxEntries=256}constructor(e={}){let r=e.maxEntries??t.defaultMaxEntries;if(!Number.isSafeInteger(r)||r<=0)throw new RangeError("HttpCache maxEntries must be a positive safe integer");this.store=new Vs(e.dbName??t.defaultDbName,e.storeName??t.defaultStoreName),this.manager=new Ks(this.store,r)}execute(e,r,o){return this.manager.execute(e,r,o)}has(e){return this.store.has(e)}delete(e){return this.store.delete(e)}clear(){return this.store.clear()}close(){return this.manager.close()}};var ro={};Y(ro,{FetchTimeoutError:()=>Pe,SmartFetch:()=>ea,isFetchTimeoutError:()=>fr});var Zm=i(async(t,e,r,o)=>{let n=new AbortController,s=new Pe(e.url,o),a=setTimeout(()=>n.abort(s),Math.max(0,o));try{return await t(e,{...r,signal:AbortSignal.any([e.signal,n.signal])})}catch(c){throw n.signal.aborted&&!e.signal.aborted?s:c}finally{clearTimeout(a)}},"fetchWithTimeout"),Am=i(async(t,e)=>{if(e.signal?.aborted){let d=He(e.signal);throw await t.body?.cancel(d).catch(()=>{}),d}if(e.bodyTimeoutMs!==void 0&&e.bodyTimeoutMs<=0){let d=new Pe(e.url,e.reportedTimeoutMs??e.bodyTimeoutMs);throw await t.body?.cancel(d).catch(()=>{}),d}if(e.bodyTimeoutMs===void 0&&!e.signal)return await t.json();let r=t.body?.getReader();if(!r)return JSON.parse("");let o,n,s=new Promise((d,p)=>{n=p}),a=i(d=>{o||(o=d,r.cancel(d).catch(()=>{}),n(d))},"terminate"),c=e.signal,u=i(()=>a(He(c)),"onAbort");c?.addEventListener("abort",u,{once:!0});let f;if(e.bodyTimeoutMs!==void 0){let d=e.reportedTimeoutMs??e.bodyTimeoutMs;f=setTimeout(()=>{a(new Pe(e.url,d))},e.bodyTimeoutMs)}let l=i(async()=>{let d=new TextDecoder,p="";for(;;){let h;try{h=await r.read()}catch(y){throw o??y}if(o)throw o;if(h.done)break;p+=d.decode(h.value,{stream:!0})}return p+=d.decode(),JSON.parse(p)},"readBody");try{return await Promise.race([l(),s])}finally{clearTimeout(f),c?.removeEventListener("abort",u);try{r.releaseLock()}catch{}}},"consumeJsonWithTimeout");var xb=[408,429,500,502,503,504],wb=i((t,e,r,o)=>{switch(t){case"linear":return Math.min(r*e,o);case"constant":return Math.min(r,o);case"exponential":return Math.min(r*2**(e-1),o)}},"backoffDelay"),to=class{static{i(this,"RetryManager")}constructor(e={},r){if(this.signal=r,this.maxAttempts=e.maxAttempts??3,!Number.isSafeInteger(this.maxAttempts)||this.maxAttempts<1)throw new RangeError("retry maxAttempts must be a positive safe integer");this.backoff=e.backoff??"exponential",this.initialDelay=e.initialDelay??1e3,this.maxDelay=e.maxDelay??3e4,this.retryOn=e.retryOn??xb,this.onRetry=e.onRetry}async execute(e){for(let r=1;;r++){this.throwIfAborted();let o;try{o=await e()}catch(n){if(this.signal?.aborted)throw He(this.signal);let s=Yt(n);if(r>=this.maxAttempts||!this.shouldRetryError(s))throw s;await this.waitBeforeRetry(r,s);continue}if(r>=this.maxAttempts||!this.shouldRetryResponse(o))return o;await lt(o,`Retrying after HTTP ${o.status}`),await this.waitBeforeRetry(r,new Error(`HTTP ${o.status}`))}}async executeWithFallbacks(e,r){if(e.length===0)throw new Error("No URLs provided for fallback execution");let o=[],n;for(let s of e){this.throwIfAborted();try{let a=await this.execute(()=>r(s));if(a.status<400||a.status<500&&a.status!==408)return a;await lt(a,`Trying fallback after HTTP ${a.status}`),n=new Error(`Request failed with status ${a.status}`)}catch(a){if(this.signal?.aborted)throw He(this.signal);n=Yt(a)}o.push(s)}throw new Error(`All URLs failed: ${o.join(", ")}. Last error: ${n?.message??"unknown error"}`)}shouldRetryResponse(e){return typeof this.retryOn=="function"?this.retryOn(e,void 0):this.retryOn.includes(e.status)}shouldRetryError(e){return e instanceof TypeError||fr(e)?!0:typeof this.retryOn=="function"?this.retryOn(void 0,e):!1}async waitBeforeRetry(e,r){let o=wb(this.backoff,e,this.initialDelay,this.maxDelay),n=o+o*.1*Math.random();this.onRetry?.(e,r,n),await Vm(n,this.signal)}throwIfAborted(){if(this.signal?.aborted)throw He(this.signal)}};var Zs=class{static{i(this,"InterceptorChain")}constructor(){this.request=[],this.response=[],this.error=[]}addRequestInterceptor(e){this.request.push(e)}addResponseInterceptor(e){this.response.push(e)}addErrorInterceptor(e){this.error.push(e)}removeRequestInterceptor(e){Rc(this.request,e)}removeResponseInterceptor(e){Rc(this.response,e)}removeErrorInterceptor(e){Rc(this.error,e)}clear(){this.request.length=0,this.response.length=0,this.error.length=0}async processRequest(e,r){let o=e;for(let n of[...this.request,...r?.request??[]])o=await n(o);return o}async processResponse(e,r){let o=e;for(let n of[...this.response,...r?.response??[]])o=await n(o);return o}async processError(e,r){let o=e;for(let n of[...this.error,...r?.error??[]])try{o=await n(o)}catch(s){o=Yt(s)}return o}},Rc=i((t,e)=>{let r=t.indexOf(e);r>-1&&t.splice(r,1)},"removeFrom");var As=class{static{i(this,"RequestDeduplicator")}constructor(){this.inFlight=new Map}keyOf(e){if(e.method!=="GET"&&e.method!=="HEAD")return;let r=[...e.headers].sort(([o],[n])=>o<n?-1:o>n?1:0);return JSON.stringify([e.method,e.url,r])}execute(e,r,o){if(r.aborted)return Promise.reject(He(r));let n=this.inFlight.get(e)??this.start(e,o);return new Promise((s,a)=>{let c=i(()=>{n.participants.delete(u);let f=He(r);a(f),n.participants.size===0&&(this.detach(e,n),n.controller.abort(f))},"onAbort"),u={resolve:i(f=>{r.removeEventListener("abort",c),s(f)},"resolve"),reject:i(f=>{r.removeEventListener("abort",c),a(f)},"reject")};n.participants.add(u),r.addEventListener("abort",c,{once:!0})})}start(e,r){let o={controller:new AbortController,participants:new Set};this.inFlight.set(e,o);let n=i(s=>{this.detach(e,o);let a=[...o.participants];o.participants.clear();for(let c of a)c.reject(s)},"rejectAll");return r(o.controller.signal).then(s=>{if(this.detach(e,o),o.participants.size===0){lt(s.response,"every deduplicated caller aborted");return}let a=[...o.participants],c=[],u;try{u=a.map((f,l)=>{if(l===a.length-1)return s;let d=s.response.clone();return c.push(d),Object.freeze({response:d,metadata:s.metadata})})}catch(f){for(let l of[s.response,...c])lt(l,f);n(f);return}o.participants.clear(),a.forEach((f,l)=>{f.resolve(u[l])})},n),o}detach(e,r){this.inFlight.get(e)===r&&this.inFlight.delete(e)}};var ep=6e4,gb=new Set(["body","headers","method","signal","window","credentials","mode","cache","redirect","referrer","referrerPolicy","integrity","keepalive","retry","fallbackUrls","timeout","interceptors","deduplicate","logging","cacheStrategy","cacheKey","cacheMaxAge"]),ea=class{static{i(this,"SmartFetch")}constructor(e={}){this.interceptors=new Zs,this.deduplicator=new As,this.httpCache=e.httpCache,this.fetchFunction=e.fetch??((r,o)=>globalThis.fetch(r,o)),this.defaults={...e.defaults}}addRequestInterceptor(e){this.interceptors.addRequestInterceptor(e)}addResponseInterceptor(e){this.interceptors.addResponseInterceptor(e)}addErrorInterceptor(e){this.interceptors.addErrorInterceptor(e)}removeRequestInterceptor(e){this.interceptors.removeRequestInterceptor(e)}removeResponseInterceptor(e){this.interceptors.removeResponseInterceptor(e)}removeErrorInterceptor(e){this.interceptors.removeErrorInterceptor(e)}clearInterceptors(){this.interceptors.clear()}async fetch(e,r={}){return(await this.fetchWithMetadata(e,r)).response}async fetchWithMetadata(e,r={}){let o=this.withDefaults(r,e instanceof Request?e.headers:void 0),n=this.planCache(o);try{let s=new Request(e,o);s=await this.interceptors.processRequest(s,o.interceptors);let a=o.deduplicate?this.deduplicator.keyOf(s):void 0;if(a===void 0)return await this.send(s,o,n);let c=s;return await this.deduplicator.execute(a,c.signal,u=>this.send(new Request(c,{signal:u}),o,n))}catch(s){throw await this.interceptors.processError(Yt(s),o.interceptors)}}async getJson(e,r={}){return(await this.getJsonWithMetadata(e,r)).data}async getJsonWithMetadata(e,r={}){return await this.requestJson(e,"GET",void 0,r)}async postJson(e,r,o={}){return(await this.postJsonWithMetadata(e,r,o)).data}async postJsonWithMetadata(e,r,o={}){return await this.requestJson(e,"POST",r,o)}async putJson(e,r,o={}){return(await this.putJsonWithMetadata(e,r,o)).data}async putJsonWithMetadata(e,r,o={}){return await this.requestJson(e,"PUT",r,o)}async deleteJson(e,r={}){return(await this.deleteJsonWithMetadata(e,r)).data}async deleteJsonWithMetadata(e,r={}){return await this.requestJson(e,"DELETE",void 0,r)}withDefaults(e,r){let o=new Headers(this.defaults.headers);for(let n of[r,new Headers(e.headers)])n?.forEach((s,a)=>o.set(a,s));return{...this.defaults,...e,headers:o}}planCache(e){if(e.timeout!==void 0&&(!Number.isSafeInteger(e.timeout)||e.timeout<0))throw new RangeError("SmartFetch timeout must be a non-negative safe integer");let r=e.cacheStrategy??"network-only";if(r!=="network-only"){if(!this.httpCache)throw new TypeError(`cacheStrategy '${r}' needs a cache: new SmartFetch({ httpCache: new HttpCache() })`);if(e.fallbackUrls?.length)throw new TypeError(`fallbackUrls cannot be combined with cacheStrategy '${r}'`);return{httpCache:this.httpCache,cacheStrategy:r}}}async send(e,r,o){if(o&&e.method!=="GET"&&r.cacheKey===void 0)throw new TypeError(`cacheStrategy '${o.cacheStrategy}' for a ${e.method} request needs a cacheKey`);let n=e.body===null?null:await e.arrayBuffer(),s=r.timeout??ep,a=vb(r),c=i(p=>Tb(e,p,n),"build"),u=i(p=>Zm(this.fetchFunction,p,a,s),"dispatch"),f=bb(r.retry),l;if(r.fallbackUrls?.length)l={response:await new to(f??{maxAttempts:1},e.signal).executeWithFallbacks([e.url,...r.fallbackUrls],y=>u(c(y))),fromCache:!1,revalidated:!1};else if(o){let p,h=i(async()=>(p=await o.httpCache.execute(c(e.url),{cacheStrategy:o.cacheStrategy,cacheKey:r.cacheKey,cacheMaxAge:r.cacheMaxAge,timeout:s,logging:r.logging??!1},u),p.response),"attempt");f?await new to(f,e.signal).execute(h):await h(),l=p}else{let p=i(()=>u(c(e.url)),"attempt");l={response:f?await new to(f,e.signal).execute(p):await p(),fromCache:!1,revalidated:!1}}let d=await this.interceptors.processResponse(l.response,r.interceptors);return Object.freeze({response:d,metadata:Object.freeze({fromCache:l.fromCache,revalidated:l.revalidated})})}async requestJson(e,r,o,n){let s=this.withDefaults(n),a=s.timeout??ep,c=!s.retry&&!s.fallbackUrls?.length,u=c?performance.now()+a:void 0,f=c?new AbortController:void 0,l=f?s.signal?AbortSignal.any([s.signal,f.signal]):f.signal:s.signal??void 0,d=f?setTimeout(()=>f.abort(new Pe(e,a)),Math.max(0,a)):void 0,p=new Headers(s.headers);p.has("accept")||p.set("accept","application/json"),o!==void 0&&!p.has("content-type")&&p.set("content-type","application/json");try{let h=await this.fetchWithMetadata(e,{...n,method:r,headers:p,...o===void 0?{}:{body:JSON.stringify(o)},signal:l}),y=h.response;if(l?.aborted)throw await lt(y,l.reason),Yt(l.reason);if(!y.ok)throw await lt(y,`HTTP ${y.status}`),new Error(`HTTP ${y.status}: ${y.statusText}`);let w=await Am(y,{bodyTimeoutMs:u===void 0?a:u-performance.now(),reportedTimeoutMs:a,signal:l,url:e});return Object.freeze({data:w,response:y,metadata:h.metadata})}catch(h){throw l?.aborted&&l.reason instanceof Error?l.reason:h}finally{clearTimeout(d)}}},bb=i(t=>t===!0?{}:t||void 0,"retryOptionsOf"),vb=i(t=>{let e={};for(let[r,o]of Object.entries(t))!gb.has(r)&&o!==void 0&&(e[r]=o);return e},"transportInitOf"),Tb=i((t,e,r)=>new Request(e,{method:t.method,headers:t.headers,body:r,signal:t.signal,credentials:t.credentials,cache:t.cache,redirect:t.redirect,referrer:t.referrer,referrerPolicy:t.referrerPolicy,integrity:t.integrity,keepalive:t.keepalive,...t.mode==="navigate"?{}:{mode:t.mode}}),"rebuildRequest");var Db=1e4,tp=new WeakSet,rp=new WeakMap,Nc=i(t=>{tp.add(t)},"authorizeVirtualStreamApplicationUse"),dr=class extends Error{static{i(this,"VirtualStreamClosedError")}constructor(e="VirtualStream is closed",r){super(e,r),this.name="VirtualStreamClosedError"}},mr=class extends Error{static{i(this,"VirtualStreamOpenTimeoutError")}constructor(e,r){super(e>0?`VirtualStream transport staging timed out after ${e}ms`:"VirtualStream transport staging deadline is exhausted"),this.timeoutMs=e,this.deadlineAt=r,this.name="VirtualStreamOpenTimeoutError"}},ra=class extends Error{static{i(this,"VirtualStreamLifecycleContractError")}constructor(e){super(`VirtualStream endpoint closed before terminal ${e} produced a receipt`),this.name="VirtualStreamLifecycleContractError"}},dt=class{static{i(this,"VirtualStreamActivationScope")}constructor(){this.trackedStreams=new Set,this.hasAuthorizedTrackedStreams=!1,this.published=!1,this.settled=!1}track(e){if(this.settled)throw new Error("Cannot track a VirtualStream in a settled activation scope");let r=rp.get(e);if(r&&r!==this)throw new Error("VirtualStream is already owned by another activation scope");r||rp.set(e,this),this.trackedStreams.add(e),this.hasAuthorizedTrackedStreams&&Nc(e),this.published&&e.publishActivation()}authorizeApplicationUse(){if(!(this.settled||this.hasAuthorizedTrackedStreams)){this.hasAuthorizedTrackedStreams=!0;for(let e of this.trackedStreams)Nc(e)}}publish(){if(!(this.settled||this.published)){this.published=!0;for(let e of this.trackedStreams)e.publishActivation()}}commit(){this.publish(),this.settled=!0,this.trackedStreams.clear()}async rollback(e){if(this.settled)return;this.settled=!0;let r=[...this.trackedStreams];this.trackedStreams.clear(),await Promise.allSettled(r.map(o=>o.rollbackActivation(e)))}},ze=class t{static{i(this,"VirtualStream")}static{this.maximumStreamIdLength=256}static fromRegistration(e){let r=e.registration?.dispose,o=i(()=>{let n=r;r=void 0,n?.()},"disposeOnce");try{if(t.validateTransport(e.transport),typeof e.registration?.dispose!="function")throw new TypeError("VirtualStream registration requires a synchronous disposer");return t.validateNetworkDescriptor(e.registration.descriptor),t.validateEndpoint(e.registration.endpoint,e.registration.descriptor,e.registration.descriptor.creatorDirection),new t({transport:e.transport,descriptor:e.registration.descriptor,endpoint:e.registration.endpoint,registrationDispose:o,explicitRegistration:!0})}catch(n){throw o(),n}}static encodePayloadForNetwork(e,r){let o=e?.correlation?.phase==="response";return t.encodePayloadValue(e,r,o,!1,!0,{standard:new WeakMap,omittingResponseRequestStreams:new WeakMap})}static encodePayloadForNetworkWithMetadata(e,r){let o=e?.correlation?.phase==="response",n={standard:new WeakMap,omittingResponseRequestStreams:new WeakMap,containsNetworkDescriptor:!1,requiresNetworkDescriptorScan:!1},s=t.encodePayloadValue(e,r,o,!1,!0,n),a=n.requiresNetworkDescriptorScan||t.encodedContainerPrototypesMayExposeNetworkDescriptor();return{payload:s,containsNetworkDescriptor:a?t.containsNetworkDescriptor(s):n.containsNetworkDescriptor}}static encodePayloadValue(e,r,o,n,s,a){if(!e||sr.isBufferLike(e))return e;if(e instanceof t)return n?{_OMITTED_VIRTUAL_STREAM:!0,reason:"Streams beneath an echoed response.request are omitted."}:(a.containsNetworkDescriptor!==void 0&&(a.containsNetworkDescriptor=!0),e.activateForEncoding(r));if(e instanceof Set||e instanceof Map||e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Promise||typeof e.then=="function")return a.containsNetworkDescriptor!==void 0&&typeof e=="object"&&(a.requiresNetworkDescriptorScan=!0),e;if(typeof e!="object")return e;let u=n?a.omittingResponseRequestStreams:a.standard,f=u.get(e);if(f)return f;if(Array.isArray(e)){let d=[];u.set(e,d);for(let p=0;p<e.length;p++)d.push(t.encodePayloadValue(e[p],r,o,n,!1,a));return a.containsNetworkDescriptor!==void 0&&Object.getPrototypeOf(d)!==Array.prototype&&(a.requiresNetworkDescriptorScan=!0),d}let l={};u.set(e,l);for(let d of Object.keys(e)){let p=n||o&&s&&d==="request";l[d]=t.encodePayloadValue(e[d],r,o,p,!1,a)}return a.containsNetworkDescriptor!==void 0&&Object.getPrototypeOf(l)!==Object.prototype&&(a.requiresNetworkDescriptorScan=!0),a.containsNetworkDescriptor!==void 0&&Object.hasOwn(l,"_isVirtualStream")&&l._isVirtualStream===!0&&(a.containsNetworkDescriptor=!0),l}static async decodePayloadFromNetworkAsync(e,r){let o=new Map,n=[],s=[],a=r.activationScope??new dt,c=!r.activationScope,u=t.resolveOpenDeadlineAt(r.openDeadlineAt);try{let f=t.preparePayloadFromNetwork(e,{...r,activationScope:a},o,n,s,new WeakMap);if(n.length>0){let l=r.virtualStreamTransport;if(!l)throw new Error("VirtualStream descriptor requires a virtual stream transport");t.validateTransport(l);for(let d of n){let p=t.getRemainingOpenTimeoutMs(u),h=await t.openVirtualStreamWithTimeout(l,d.descriptor,p,u,r.abortSignal);d.stream.bindOpenedEndpoint(h)}}return c&&(a.authorizeApplicationUse(),a.commit()),f}catch(f){throw await Promise.allSettled(s.map(l=>l.rollbackActivation(f))),f}}static containsNetworkDescriptor(e,r=new WeakSet){return!e||sr.isBufferLike(e)||typeof e!="object"?!1:e._isVirtualStream===!0?!0:r.has(e)?!1:(r.add(e),Array.isArray(e)?e.some(o=>t.containsNetworkDescriptor(o,r)):e instanceof Set||e instanceof Map||e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Promise||typeof e.then=="function"?!1:Object.values(e).some(o=>t.containsNetworkDescriptor(o,r)))}static encodedContainerPrototypesMayExposeNetworkDescriptor(){return Object.getPrototypeOf(Object.prototype)!==null||Object.getPrototypeOf(Array.prototype)!==Object.prototype||Object.getOwnPropertyDescriptor(Object.prototype,"_isVirtualStream")!==void 0||Object.getOwnPropertyDescriptor(Array.prototype,"_isVirtualStream")!==void 0}static preparePayloadFromNetwork(e,r,o,n,s,a){if(sr.isBufferLike(e)||e===null||typeof e!="object"||e instanceof Set||e instanceof Map||e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Promise||typeof e.then=="function")return e;if(e._isVirtualStream===!0){t.validateNetworkDescriptor(e);let f=e,l=o.get(f.streamId);if(l){if(!t.descriptorMetadataMatches(l.descriptor,f))throw new TypeError(`Conflicting VirtualStream metadata for streamId "${f.streamId}"`);return l.stream}let d=r.virtualStreamTransport,p=new t({transport:d,descriptor:f,explicitRegistration:!1});return o.set(f.streamId,{stream:p,descriptor:f}),n.push({stream:p,descriptor:f}),s.push(p),r.activationScope?.track(p),p}let c=a.get(e);if(c)return c;if(Array.isArray(e)){let f=[];a.set(e,f);for(let l of e)f.push(t.preparePayloadFromNetwork(l,r,o,n,s,a));return f}let u={};a.set(e,u);for(let f of Object.keys(e))Object.defineProperty(u,f,{value:t.preparePayloadFromNetwork(e[f],r,o,n,s,a),configurable:!0,enumerable:!0,writable:!0});return u}static resolveOpenDeadlineAt(e){let r=performance.now()+Db;if(e===void 0)return r;if(!Number.isFinite(e)||e<0)throw new RangeError("VirtualStream openDeadlineAt must be a non-negative finite number");return Math.min(e,r)}static getRemainingOpenTimeoutMs(e){let r=Math.ceil(e-performance.now());if(!Number.isSafeInteger(r)||r<=0)throw new mr(0,e);return r}static async openVirtualStreamWithTimeout(e,r,o,n,s){let a=new mr(o,n),c=new AbortController,u,f,l,d=Promise.resolve().then(()=>e.openVirtualStream(r,{abortSignal:c.signal,timeoutMs:o}));d.then(async h=>{u!==void 0&&await t.abortLateOpenedEndpoint(h,u)},()=>{});let p=new Promise((h,y)=>{f=setTimeout(()=>{u=a,c.abort(a),y(a)},o),s&&(l=i(()=>{let w=s.reason??new DOMException("The operation was aborted","AbortError");u=w,c.abort(w),y(w)},"parentAbortListener"),s.addEventListener("abort",l,{once:!0}),s.aborted&&l())});try{return await Promise.race([d,p])}finally{f&&clearTimeout(f),s&&l&&s.removeEventListener("abort",l)}}static async abortLateOpenedEndpoint(e,r){let o;try{o=Promise.resolve(e.abort(r))}catch{}o?.catch(()=>{});try{await e.closed}catch{}}static validateTransport(e){if(!e||typeof e!="object"||typeof e.openVirtualStream!="function")throw new TypeError("VirtualStream transport is invalid")}static validateNetworkDescriptor(e){if(!t.isPlainObject(e))throw new TypeError("VirtualStream descriptor must be a plain object");let r=t.getOwnDataProperty(e,"_isVirtualStream"),o=t.getOwnDataProperty(e,"protocol"),n=t.getOwnDataProperty(e,"streamId"),s=t.getOwnDataProperty(e,"creatorDirection");if(r!==!0||o!=="virtual-stream-v1")throw new TypeError("VirtualStream descriptor requires protocol virtual-stream-v1");if(typeof n!="string"||n.length===0||n.length>t.maximumStreamIdLength)throw new TypeError(`VirtualStream descriptor streamId must contain 1-${t.maximumStreamIdLength} characters`);if(s!=="send"&&s!=="receive")throw new TypeError("VirtualStream descriptor creatorDirection must be send or receive");let a=Object.getOwnPropertyDescriptor(e,"contentType");if(a&&(!("value"in a)||typeof a.value!="string"||a.value.length===0))throw new TypeError("VirtualStream descriptor contentType must be a non-empty string");let c=Object.getOwnPropertyDescriptor(e,"integrity");if(c){if(!("value"in c))throw new TypeError("VirtualStream descriptor integrity must be data");t.validateIntegrity(c.value)}let u=Object.getOwnPropertyDescriptor(e,"transport");if(!u||!("value"in u))throw new TypeError("VirtualStream descriptor requires an own transport property");if(!t.isJsonCompatible(u.value,new WeakSet))throw new TypeError("VirtualStream descriptor transport must be JSON-compatible")}static validateIntegrity(e){if(!t.isPlainObject(e))throw new TypeError("VirtualStream integrity must be a plain object");let r=t.getOwnDataProperty(e,"algorithm"),o=t.getOwnDataProperty(e,"byteLength"),n=t.getOwnDataProperty(e,"digest");if(r!=="sha256")throw new TypeError("VirtualStream integrity algorithm must be sha256");if(!Number.isSafeInteger(o)||o<0)throw new TypeError("VirtualStream integrity byteLength must be a non-negative safe integer");if(typeof n!="string"||!/^sha256:[0-9a-f]{64}$/.test(n))throw new TypeError("VirtualStream integrity digest is invalid")}static validateEndpoint(e,r,o){if(!e||typeof e!="object")throw new TypeError("VirtualStream transport returned an invalid endpoint");let n=e;if(n.protocol!=="virtual-stream-v1"||n.direction!==o||n.streamId!==r.streamId||n.contentType!==r.contentType||!t.integrityMatches(n.integrity,r.integrity))throw new TypeError("VirtualStream endpoint direction or metadata does not match its descriptor");if(!("opened"in n)||!("completion"in n)||!n.closed||typeof n.closed.then!="function"||typeof n.abort!="function")throw new TypeError("VirtualStream endpoint lacks lifecycle contracts");if(o==="send"){if(typeof n.send!="function"||typeof n.close!="function"||!("writable"in n))throw new TypeError("VirtualStream sender endpoint is invalid")}else if(typeof n.receive!="function"||typeof n.accept!="function"||typeof n.reject!="function"||!("readable"in n))throw new TypeError("VirtualStream receiver endpoint is invalid")}static descriptorMetadataMatches(e,r){return e.creatorDirection===r.creatorDirection&&e.contentType===r.contentType&&t.integrityMatches(e.integrity,r.integrity)}static integrityMatches(e,r){return!e||!r?e===r:e.algorithm===r.algorithm&&e.byteLength===r.byteLength&&e.digest===r.digest}static getOwnDataProperty(e,r){let o=Object.getOwnPropertyDescriptor(e,r);if(!(!o||!("value"in o)))return o.value}static isPlainObject(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let r=Object.getPrototypeOf(e);return r===Object.prototype||r===null}static isJsonCompatible(e,r){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(!e||typeof e!="object"||r.has(e))return!1;r.add(e);try{if(Array.isArray(e)){for(let o=0;o<e.length;o++){let n=Object.getOwnPropertyDescriptor(e,String(o));if(!n||!("value"in n)||!t.isJsonCompatible(n.value,r))return!1}return Reflect.ownKeys(e).every(o=>o==="length"||typeof o=="string"&&/^(0|[1-9][0-9]*)$/.test(o)&&Number(o)<e.length)}if(!t.isPlainObject(e))return!1;for(let o of Reflect.ownKeys(e)){if(typeof o!="string")return!1;let n=Object.getOwnPropertyDescriptor(e,o);if(!n.enumerable||!("value"in n)||!t.isJsonCompatible(n.value,r))return!1}return!0}finally{r.delete(e)}}constructor(e){this.activationPublished=!1,this.endpointUseStarted=!1,this.endpointClosed=!1,this.locallyDisposed=!1,this.transport=e.transport,this.descriptor=e.descriptor,this.endpoint=e.endpoint,this.registrationDispose=e.registrationDispose,this.explicitRegistration=e.explicitRegistration,this.explicitRegistration&&Nc(this),this.endpoint&&this.observeEndpoint(this.endpoint)}get protocol(){return"virtual-stream-v1"}get direction(){return this.endpoint?this.endpoint.direction:this.descriptor.creatorDirection==="send"?"receive":"send"}get streamId(){return this.descriptor.streamId}get contentType(){return this.descriptor.contentType}get integrity(){return this.descriptor.integrity}get opened(){try{this.assertApplicationOperationsAllowed(),this.assertNotClosed(),this.endpointUseStarted=!0;let e=this.requireEndpoint().opened;if(!e||typeof e.then!="function")throw new TypeError("VirtualStream endpoint opened contract is invalid");return e}catch(e){return Promise.reject(e)}}get completion(){let e=this.requireEndpoint().completion;if(!e||typeof e.then!="function")throw new TypeError("VirtualStream endpoint completion contract is invalid");return e}get closed(){return this.requireEndpoint().closed}get writable(){return this.assertApplicationOperation("send"),this.endpointUseStarted=!0,this.requireEndpoint().writable}get readable(){return this.assertApplicationOperation("receive"),this.endpointUseStarted=!0,this.requireEndpoint().readable}publishActivation(){this.explicitRegistration&&!this.locallyDisposed&&(this.activationPublished=!0)}async rollbackActivation(e){if(!this.locallyDisposed){if(this.explicitRegistration&&!this.activationPublished&&!this.endpointUseStarted){this.disposeUnpublishedRegistration();return}this.endpoint&&await this.abort(e)}}async send(e){if(this.assertApplicationOperation("send"),!(e instanceof Uint8Array))throw new TypeError("VirtualStream.send accepts only Uint8Array chunks");this.endpointUseStarted=!0,await this.requireEndpoint().send(e)}async receive(){return this.assertApplicationOperation("receive"),this.endpointUseStarted=!0,this.requireEndpoint().receive()}close(){if(this.terminalPromise)return this.followTerminal("close");try{this.assertApplicationOperation("send"),this.endpointUseStarted=!0;let e=this.requireEndpoint();return this.terminateEndpoint(()=>e.close(),"close")}catch(e){return Promise.reject(e)}}accept(){if(this.terminalPromise)return this.followTerminal("accept");try{this.assertApplicationOperation("receive"),this.endpointUseStarted=!0;let e=this.requireEndpoint();return this.terminateEndpoint(()=>e.accept(),"accept")}catch(e){return Promise.reject(e)}}reject(e){if(this.terminalPromise)return this.followTerminal("reject");try{this.assertApplicationOperation("receive"),this.endpointUseStarted=!0;let r=this.requireEndpoint();return this.terminateEndpoint(()=>r.reject(e),"reject")}catch(r){return Promise.reject(r)}}abort(e){if(this.terminalPromise)return this.followTerminal("abort");if(this.locallyDisposed||this.endpointClosed)return Promise.resolve();let r=this.endpoint;return r?(this.endpointUseStarted=!0,this.terminateEndpoint(()=>r.abort(e),"abort")):Promise.resolve()}activateForEncoding(e){e.activationScope?.track(this);try{if(!e.virtualStreamTransport)throw new Error("VirtualStream requires a virtual stream transport");if(this.transport!==e.virtualStreamTransport)throw new Error("VirtualStream cannot be encoded through a different virtual stream transport");if(this.assertNotClosed(),this.terminalPromise)throw new dr("VirtualStream has a terminal operation");return e.activationScope||this.publishActivation(),this.descriptor}catch(r){throw e.activationScope||this.rollbackActivation(r).catch(()=>{}),r}}bindOpenedEndpoint(e){this.endpoint=e;let r=this.descriptor.creatorDirection==="send"?"receive":"send";t.validateEndpoint(e,this.descriptor,r),this.observeEndpoint(e)}observeEndpoint(e){let r=e.completion;if(!r||typeof r.then!="function")throw new TypeError("VirtualStream endpoint completion contract is invalid");r.then(o=>{this.completionOutcome={status:"fulfilled",value:o}},o=>{this.completionOutcome={status:"rejected",error:o}}),e.closed.then(()=>this.markEndpointClosed(),o=>this.markEndpointClosed(o))}markEndpointClosed(e){e!==void 0&&this.getCloseError(e),this.endpointClosed=!0,this.disposeRegistration()}disposeRegistration(){let e=this.registrationDispose;this.registrationDispose=void 0,e?.()}disposeUnpublishedRegistration(){this.locallyDisposed||(this.locallyDisposed=!0,this.disposeRegistration())}requireEndpoint(){if(!this.endpoint)throw new Error("VirtualStream endpoint is not staged");return this.endpoint}assertApplicationOperationsAllowed(){if(!tp.has(this))throw new Error("VirtualStream application use is not authorized")}assertApplicationOperation(e){if(this.assertApplicationOperationsAllowed(),this.assertNotClosed(),this.terminalPromise)throw new dr("VirtualStream has a terminal operation");if(this.direction!==e)throw new TypeError(`${this.direction} VirtualStreams cannot perform ${e} operations`)}assertNotClosed(){if(this.endpointClosed||this.locallyDisposed)throw this.getCloseError()}getCloseError(e){return this.closeError||(this.closeError=new dr("VirtualStream is closed",e===void 0?void 0:{cause:e})),this.closeError}followTerminal(e){let r=this.terminalPromise;if(this.terminalKind===e)return r;let o=new dr(`VirtualStream terminal ${this.terminalKind} already completed`);return r.then(()=>Promise.reject(o),()=>Promise.reject(o))}terminateEndpoint(e,r){if(this.terminalPromise)return this.followTerminal(r);let o=this.requireEndpoint();this.terminalKind=r;let n=e,s=Promise.resolve().then(()=>{let l=n;return n=void 0,l()});s.catch(()=>{});let a=s.then(l=>({status:"fulfilled",value:l}),l=>({status:"rejected",error:l})),c;a.then(l=>{c=l});let u=o.closed.then(()=>({status:"closed"}),l=>({status:"closedError",error:l})),f=(async()=>{let l=await Promise.race([a,u]);if(l.status==="fulfilled"||l.status==="rejected"){let d=await u;if(this.endpointClosed=!0,this.disposeRegistration(),l.status==="rejected")throw l.error;if(d.status==="closedError")throw d.error;return l.value}if(this.endpointClosed=!0,this.disposeRegistration(),l.status==="closedError")throw l.error;if(await Promise.resolve(),await Promise.resolve(),c?.status==="rejected")throw c.error;if(c?.status==="fulfilled")return c.value;if(r==="close"||r==="accept"){if(this.completionOutcome?.status==="fulfilled")return this.completionOutcome.value;throw this.completionOutcome?.status==="rejected"?this.completionOutcome.error:new ra(r)}})();return this.terminalPromise=f,f}};var je=class extends Error{static{i(this,"TypedResponseError")}constructor(e,r){super(e),this.name="TypedResponseError",this.errorText=e,this.errorData=r??{}}};var oo=Object.freeze({redacted:!0});var op=Object.freeze(["onOutgoingRequest","onIncomingResponse","onIncomingRequest","onOutgoingResponse"]),np=Symbol.for("@api.global/typedrequest:global-hooks:3.8"),ip=i(t=>({payloadProjector:t?.payloadProjector,errorProjector:t?.errorProjector}),"copyProjectionOptions"),na=i((t={})=>({hooks:t,projectedRegistrationsByPhase:{}}),"createTypedRouterHookRegistrationState"),Sb=i(t=>op.filter(e=>Object.hasOwn(t,e)).map(e=>[e,t[e]]),"getSuppliedHookEntries"),ia=i((t,e,r)=>{let o=Sb(e);t.hooks={...t.hooks,...e};for(let[n]of o){let s=t.hooks[n];if(typeof s!="function"){delete t.projectedRegistrationsByPhase[n];continue}t.projectedRegistrationsByPhase[n]={callback:s,projectionOptions:ip(r)}}},"mergeTypedRouterHookRegistrations"),sa=i((t,e)=>{t.hooks=e;for(let r of op)delete t.projectedRegistrationsByPhase[r]},"replaceTypedRouterHookRegistrations"),no=i(()=>{let t=globalThis[np];if(t?.version==="3.8"&&t.stateShape==="callback-bound-projections-v1"&&t.subscribers instanceof Map)return t;let e={version:"3.8",stateShape:"callback-bound-projections-v1",legacy:na(),subscribers:new Map};return globalThis[np]=e,e},"getRealmGlobalHookState"),ap=i(()=>no().legacy.hooks,"getLegacyGlobalHooks"),cp=i(t=>{sa(no().legacy,t)},"replaceLegacyGlobalHooks"),up=i((t,e)=>{ia(no().legacy,t,e)},"mergeLegacyGlobalHooks"),fp=i((t,e)=>{let r=no(),o=Symbol("typedrequest-hook-subscriber"),n=na();ia(n,t,e),r.subscribers.set(o,n);let s=!1;return()=>{s||(s=!0,r.subscribers.delete(o))}},"addGlobalHookSubscriber"),lp=i(()=>{let t=no();sa(t.legacy,{}),t.subscribers.clear()},"clearGlobalHookRegistrations"),oa=i(t=>{try{console.error(`TypedRequest hook projection failed (${t})`)}catch{}},"logProjectionFailure"),Fc=i(t=>{try{console.error(`TypedRequest hook callback failed (${t})`)}catch{}},"logCallbackFailure"),Mb=i((t,e)=>{let r={correlationId:t.correlationId,method:t.method,direction:t.direction,phase:t.phase,timestamp:t.timestamp,...t.durationMs===void 0?{}:{durationMs:t.durationMs},hasError:t.errorText!==void 0};try{return Object.freeze(r)}catch{oa(e);return}},"createMetadata"),sp=i(t=>typeof SharedArrayBuffer>"u"?!1:t instanceof SharedArrayBuffer||Object.prototype.toString.call(t)==="[object SharedArrayBuffer]","isSharedArrayBuffer"),io=i((t,e=new Set)=>{if(!(t===null||typeof t!="object"&&typeof t!="function")){if(sp(t))throw new TypeError("TypedRequest hook projections cannot contain SharedArrayBuffer");if(ArrayBuffer.isView(t)){if(sp(t.buffer))throw new TypeError("TypedRequest hook projections cannot contain SharedArrayBuffer-backed views");return}if(!e.has(t)){if(e.add(t),t instanceof Map){for(let[r,o]of t)io(r,e),io(o,e);return}if(t instanceof Set){for(let r of t)io(r,e);return}for(let r of Reflect.ownKeys(t)){let o=Reflect.getOwnPropertyDescriptor(t,r);if(o){if(!Object.hasOwn(o,"value"))throw new TypeError("TypedRequest hook projections cannot contain accessor properties");io(o.value,e)}}}}},"assertNoSharedArrayBuffer"),Ob=i((t,e,r,o)=>{if(!e||!r.payloadProjector)return{payload:oo,payloadRedacted:!0};try{let n=r.payloadProjector(t,e);io(n);let s=structuredClone(n);return io(s),s!==null&&(typeof s=="object"||typeof s=="function")&&Object.freeze(s),{payload:s,payloadRedacted:!1}}catch{return oa(o),{payload:oo,payloadRedacted:!0}}},"snapshotPayload"),Eb=i((t,e,r,o)=>{if(!(!e||t.errorText===void 0||!r.errorProjector))try{let n=r.errorProjector(t.errorText,e);if(n===void 0)return;let s=structuredClone(n);if(typeof s!="string")throw new TypeError("TypedRequest error projector must return a string or undefined");return s}catch{oa(o);return}},"snapshotError"),kb=i((t,e,r)=>{let o=Mb(t,r),n=Ob(t.payload,o,e,r),s=Eb(t,o,e,r),a={correlationId:t.correlationId,method:t.method,direction:t.direction,phase:t.phase,timestamp:t.timestamp,...t.durationMs===void 0?{}:{durationMs:t.durationMs},hasError:t.errorText!==void 0,...n,...s===void 0?{}:{error:s}};try{return Object.freeze(a)}catch{oa(r);let c={correlationId:t.correlationId,method:t.method,direction:t.direction,phase:t.phase,timestamp:t.timestamp,...t.durationMs===void 0?{}:{durationMs:t.durationMs},hasError:t.errorText!==void 0,payload:oo,payloadRedacted:!0};try{return Object.freeze(c)}catch{return c}}},"projectLogEntry"),Wc=i((t,e)=>{try{let r=t.hooks[e];if(typeof r!="function")return;let o=t.projectedRegistrationsByPhase[e];return{callback:r,projectionOptions:o?.callback===r?ip(o.projectionOptions):{}}}catch{Fc(e);return}},"snapshotDispatchRecipient"),Lc=i((t,e,r)=>{let o=kb(r,t.projectionOptions,e);try{let n=t.callback(o);n&&typeof n.then=="function"&&Promise.resolve(n).catch(()=>{Fc(e)})}catch{Fc(e)}},"dispatchToRecipient"),so=i((t,e,r)=>{let o=no();if(o.subscribers.size===0){let a=Wc(o.legacy,t),c=r?Wc(r,t):void 0;if(!a&&!c)return;a&&Lc(a,t,e),c&&Lc(c,t,e);return}let s=[o.legacy,...Array.from(o.subscribers.values()),...r?[r]:[]].map(a=>Wc(a,t)).filter(a=>!!a);for(let a of s)Lc(a,t,e)},"dispatchTypedRequestHook");var aa=class{static{i(this,"TypedTools")}constructor(e){this.localData={},this.abortSignal=e??new AbortController().signal}async passGuards(e,r){let o=new Go.GuardSet(e);if(!await o.allGuardsPass(r)){let s=await o.getFailedHint(r);throw new je(`guard failed: ${s}`,{failedHint:s})}}};var Nce=16,Fce=1024,dp=Symbol.for("@api.global/typedrequest:global-error-reporter"),Uc=i(()=>{let t=globalThis[dp];if(t&&typeof t=="object")return t;let e={reporter:void 0};return globalThis[dp]=e,e},"getRealmGlobalErrorReporterState"),Ib=i(()=>Uc().reporter,"getGlobalTypedRequestErrorReporter"),pp=i(t=>{let e=Uc();e.reporter=t;let r=!1;return()=>{r||(r=!0,e.reporter===t&&(e.reporter=void 0))}},"setGlobalTypedRequestErrorReporter"),hp=i(()=>{Uc().reporter=void 0},"clearGlobalTypedRequestErrorReporter"),pr=i(t=>{let e=t.replace(/[\u0000-\u001f\u007f]/g," ");return e.length<=1024?e:`${e.slice(0,1024)}...[truncated]`},"sanitizeLogText"),Pb=i(t=>{try{let e=t.name;if(typeof e=="string"&&e.length>0)return pr(e)}catch{}try{let e=t.constructor?.name;if(typeof e=="string"&&e.length>0)return pr(e)}catch{}return"Error"},"readErrorName"),Cb=i(t=>{try{let e=t.message;return typeof e=="string"?pr(e):""}catch{return""}},"readErrorMessage"),_b=i(t=>{if(t instanceof Error)return{name:Pb(t),message:Cb(t)};if(t===null)return{name:"null",message:""};let e=typeof t;if(e==="object"||e==="function"){let o=e;try{let n=t?.constructor?.name;typeof n=="string"&&n.length>0&&(o=pr(n))}catch{}return{name:"NonErrorThrowable",message:`<non-Error ${o} thrown>`}}let r="";try{r=pr(String(t))}catch{}return{name:`NonErrorThrowable(${e})`,message:r}},"describeThrowable"),Rb=i(t=>{if(!(t===null||typeof t!="object"&&typeof t!="function"))try{return t.cause}catch{return}},"readCause"),Nb=i(t=>{let e=[],r=new Set,o=t;for(;e.length<16;){if(o!==null&&(typeof o=="object"||typeof o=="function")){if(r.has(o))break;r.add(o)}e.push(_b(o));let n=Rb(o);if(n===void 0)break;o=n}return e},"buildChain"),Fb=i(t=>{if(t instanceof Error)try{return typeof t.stack=="string"?t.stack:void 0}catch{return}},"readStack"),mp=i((t,e)=>t==="handler"?`TypedRequest handler '${e}' failed`:t==="requestscope"?`TypedRequest request scope for method '${e}' failed`:`TypedRequest middleware for method '${e}' failed`,"buildPrefix"),Wb=i(t=>t.map(e=>e.message.length>0?`${e.name}: ${e.message}`:e.name).join(" <- caused by: "),"renderChain"),Lb=i(t=>{let e=pr(String(t.method)),r=Nb(t.error),o=typeof t.correlationId=="string"&&t.correlationId.length>0?pr(t.correlationId):void 0,n=o?` [correlation ${o}]`:"",s=`${mp(t.origin,e)}${n}: ${Wb(r)}`,a=Fb(t.error);return{origin:t.origin,method:e,...o===void 0?{}:{correlationId:o},chain:Object.freeze(r),formatted:s,...a===void 0?{}:{stack:a},error:t.error}},"buildTypedRequestErrorReport"),Yc=i(t=>{try{console.error(t.formatted)}catch{}},"printDefaultReport"),ao=i(t=>{let e;try{e=Lb(t)}catch{try{console.error(`${mp(t.origin,String(t.method))}: <error description unavailable>`)}catch{}return}let r=Ib();if(!r){Yc(e);return}try{let o=r(e);o&&typeof o.then=="function"&&Promise.resolve(o).catch(()=>{Yc(e)})}catch{Yc(e)}},"reportTypedRequestError");var Hc=class t{static{i(this,"TypedHandler")}static{this.internalErrorMessage="Internal server error"}constructor(e,r){this.method=e,this.handlerFunction=r}async addResponse(e,r){if(e.method!==this.method)throw new Error("this handler has been given a wrong method to answer to. Please use a TypedRouter to filter requests");let o,n=new aa(r);e.localData&&(n.localData=e.localData);let s=await this.handlerFunction(e.request,n).catch(a=>{a instanceof je?o=a:(ao({origin:"handler",method:this.method,correlationId:e.correlation?.id,error:a}),o=new je(t.internalErrorMessage))});return o?(e.response=null,e.error={text:o.errorText,data:o.errorData}):e.response=s===void 0?null:s,e?.correlation?.phase&&(e.correlation.phase="response"),e}};var Ub=[],yp=i(async(t,e,r,o,n)=>{if(e>=t.length){await r();return}let s=t[e],a=!1,c=!1,u=!1,f,l,d=i(()=>{if(a)throw new TypeError("A TypedRouter request scope called next() more than once");if(c)throw new TypeError("A TypedRouter request scope called next() after it returned");a=!0;let y=yp(t,e+1,r,o,n);l=y.then(()=>{u=!0},g=>{u=!0,f={error:g}});let w=y.then(()=>{});return w.catch(()=>{}),w},"next"),p;try{await s(o,d,n)}catch(y){p={error:y}}c=!0;let h=a&&!u;if(l&&await l,h)throw f&&p&&p.error!==f.error&&ao({origin:"requestscope",method:n.method,correlationId:o.correlation?.id,error:p.error}),f?f.error:p?p.error:new TypeError("A TypedRouter request scope returned before next() settled");if(p)throw p.error},"runTypedRouterRequestScopeChain");function ca(t){let e=t?.method,r=t?.correlation?.id,o=t?.requestInstanceId;if(!(typeof e!="string"||e.length===0||typeof r!="string"||r.length===0||typeof o!="string"||o.length===0))return JSON.stringify([e,r,o])}i(ca,"getTypedRequestResponseInterestKey");var jc=class t{static{i(this,"TypedRouter")}constructor(){this.hookRegistrationState=na(),this.routerMap=new rt.ObjectMap,this.fallbackRouterMap=new rt.ObjectMap,this.fallbackParentRouters=new Set,this.handlerMap=new rt.ObjectMap,this.middlewares=[],this.requestScopes=[],this.fireEventInterestMap=new rt.InterestMap(e=>e)}static{this.internalErrorMessage="Internal server error"}registerVirtualStreamTransportResolver(e){if(typeof e!="function")throw new TypeError("TypedRouter virtual stream transport resolver must be a function");if(this.virtualStreamTransportResolver)throw new Error("TypedRouter already has a virtual stream transport resolver owner");this.virtualStreamTransportResolver=e;let r=!1;return()=>{r||(r=!0,this.virtualStreamTransportResolver===e&&(this.virtualStreamTransportResolver=void 0))}}registerIncomingRequestAuthorityGuard(e){if(typeof e!="function")throw new TypeError("TypedRouter incoming request authority guard must be a function");if(this.incomingRequestAuthorityGuard)throw new Error("TypedRouter already has an incoming request authority guard owner");this.incomingRequestAuthorityGuard=e;let r=!1;return()=>{r||(r=!0,this.incomingRequestAuthorityGuard===e&&(this.incomingRequestAuthorityGuard=void 0))}}registerIncomingRequestSignalResolver(e){if(typeof e!="function")throw new TypeError("TypedRouter incoming request signal resolver must be a function");if(this.incomingRequestSignalResolver)throw new Error("TypedRouter already has an incoming request signal resolver owner");this.incomingRequestSignalResolver=e;let r=!1;return()=>{r||(r=!0,this.incomingRequestSignalResolver===e&&(this.incomingRequestSignalResolver=void 0))}}registerIncomingResponseAuthorityGuard(e){if(typeof e!="function")throw new TypeError("TypedRouter incoming response authority guard must be a function");if(this.incomingResponseAuthorityGuard)throw new Error("TypedRouter already has an incoming response authority guard owner");this.incomingResponseAuthorityGuard=e;let r=!1;return()=>{r||(r=!0,this.incomingResponseAuthorityGuard===e&&(this.incomingResponseAuthorityGuard=void 0))}}static get globalHooks(){return ap()}static set globalHooks(e){cp(e)}static setGlobalHooks(e,r){up(e,r)}static addGlobalHooks(e,r){return fp(e,r)}static clearGlobalHooks(){lp()}static setGlobalErrorReporter(e){return pp(e)}static clearGlobalErrorReporter(){hp()}get hooks(){return this.hookRegistrationState.hooks}set hooks(e){sa(this.hookRegistrationState,e)}setHooks(e,r){ia(this.hookRegistrationState,e,r)}callHook(e,r){so(e,r,this.hookRegistrationState)}setErrorFromCaughtError(e,r,o){if(r instanceof je){e.error={text:r.errorText,data:r.errorData??{}};return}ao({origin:o,method:e.method,correlationId:e.correlation?.id,error:r}),e.error={text:t.internalErrorMessage,data:{}}}addMiddleware(e){this.middlewares.push(e)}addRequestScope(e){if(typeof e!="function")throw new TypeError("TypedRouter request scope must be a function");let r={scope:e};this.requestScopes.push(r);let o=!1;return()=>{if(o)return;o=!0;let n=this.requestScopes.indexOf(r);n!==-1&&this.requestScopes.splice(n,1)}}collectRequestScopes(e){let r;for(let o of e){let n=o.requestScopes;if(!(!n||n.length===0)){r??=[];for(let s of n)r.push(s.scope)}}return r??Ub}addTypedHandler(e){if(this.getTypedHandlerForMethod(e.method))throw new Error(`a TypedHandler for ${e.method} alredy exists! Can't add another one.`);this.handlerMap.add(e);try{this.validateAffectedCompositionRoots()}catch(o){throw this.handlerMap.remove(e),o}}addTypedRouter(e){if(e===this)throw new Error("A TypedRouter cannot be composed with itself.");if(this.routerMap.findSync(a=>a===e))return()=>{};let o=this.canReachRouter(e),n=e.canReachRouter(this);if(o!==n)throw new Error("Cannot add a bidirectional TypedRouter edge across an existing composition boundary.");this.routerMap.add(e),e.routerMap.add(this);try{this.validateAffectedCompositionRoots()}catch(a){throw this.routerMap.remove(e),e.routerMap.remove(this),a}let s=!1;return()=>{s||(s=!0,this.routerMap.remove(e),e.routerMap.remove(this))}}addFallbackRouter(e){if(e===this)throw new Error("A TypedRouter cannot use itself as a fallback.");if(this.fallbackRouterMap.findSync(o=>o===e))return()=>{};if(e.canReachRouter(this))throw new Error("Adding this fallback would create a TypedRouter composition cycle.");this.fallbackRouterMap.add(e),e.fallbackParentRouters.add(this);try{this.validateAffectedCompositionRoots()}catch(o){throw this.fallbackRouterMap.remove(e),e.fallbackParentRouters.delete(this),o}let r=!1;return()=>{r||(r=!0,this.fallbackRouterMap.remove(e),e.fallbackParentRouters.delete(this))}}getMethodNames(){return[...this.collectReachableHandlers().keys()].sort()}canReachRouter(e,r=new Set){if(this===e)return!0;if(r.has(this))return!1;r.add(this);for(let o of[...this.routerMap.getArray(),...this.fallbackRouterMap.getArray()])if(o.canReachRouter(e,r))return!0;return!1}collectReachableHandlers(e=new Set,r=new Map){if(e.has(this))return r;e.add(this);for(let o of this.handlerMap.getArray()){let n=r.get(o.method);n||(n=new Set,r.set(o.method,n)),n.add(this)}for(let o of[...this.routerMap.getArray(),...this.fallbackRouterMap.getArray()])o.collectReachableHandlers(e,r);return r}getAffectedCompositionRoots(){let e=new Set,r=[this];for(;r.length>0;){let o=r.pop();e.has(o)||(e.add(o),r.push(...o.routerMap.getArray(),...o.fallbackParentRouters))}return e}validateAffectedCompositionRoots(){for(let e of this.getAffectedCompositionRoots())for(let[r,o]of e.collectReachableHandlers())if(o.size>1)throw new Error(`TypedRouter composition exposes more than one handler for method "${r}".`)}checkForTypedHandler(e){return!!this.getTypedHandlerForMethod(e)}getTypedHandlerForMethod(e,r=[]){r.push(this);let o;return o=this.handlerMap.findSync(n=>n.method===e),o||this.routerMap.getArray().forEach(n=>{!o&&!r.includes(n)&&(o=n.getTypedHandlerForMethod(e,r))}),o||this.fallbackRouterMap.getArray().forEach(n=>{!o&&!r.includes(n)&&(o=n.getTypedHandlerForMethod(e,r))}),o}getTypedHandlerAndRouter(e,r=[]){r.push(this);let o=this.handlerMap.findSync(n=>n.method===e);if(o)return{handler:o,router:this,routerPath:[this]};for(let n of this.routerMap.getArray())if(!r.includes(n)){let s=n.getTypedHandlerAndRouter(e,r);if(s)return{...s,routerPath:[this,...s.routerPath??[s.router]]}}for(let n of this.fallbackRouterMap.getArray())if(!r.includes(n)){let s=n.getTypedHandlerAndRouter(e,r);if(s)return{...s,routerPath:[this,...s.routerPath??[s.router]]}}return null}static{this.defaultRouteOptions={localRequest:!1,skipHooks:!1}}async routeAndAddResponse(e,r={}){if(!e||typeof e!="object")return null;let o;try{o=Object.prototype.propertyIsEnumerable.call(e,"localData")}catch{return null}let n={...t.defaultRouteOptions,...r};if(!this.sanitizeIncomingLocalData(e))return null;let s=Object.freeze({...n.trustedLocalData??{}});if(e?.correlation?.phase==="response"){let y=ca(e);if(!y)return null;if(this.incomingResponseAuthorityGuard){let w=Object.freeze({typedRouter:this,trustedLocalData:s,wireLocalDataPresent:o}),g=!1;try{g=this.incomingResponseAuthorityGuard(e,w)===!0}catch{}if(!g)return null}return n.skipHooks||this.callHook("onIncomingResponse",{correlationId:e.correlation.id,method:e.method,direction:"incoming",phase:"response",timestamp:Date.now(),payload:e.response,errorText:e.error?.text}),this.fireEventInterestMap.findInterest(y)?.fullfillInterest(e),null}if(e?.correlation?.phase!=="request"||typeof e.correlation.id!="string"||e.correlation.id.length===0||typeof e.method!="string"||e.method.length===0||!e.request||typeof e.request!="object")return console.log("TypedRouter received a malformed request DTO"),null;if(this.incomingRequestAuthorityGuard){let y=Object.freeze({typedRouter:this,trustedLocalData:s,wireLocalDataPresent:o}),w=!1;try{w=this.incomingRequestAuthorityGuard(e,y)===!0}catch{}if(!w)return null}let a,c=n.trustedAbortSignal;if(c!==void 0&&!this.isAbortSignal(c))throw new TypeError("TypedRouter trustedAbortSignal must be an AbortSignal");if(!c&&this.incomingRequestSignalResolver){if(typeof e.requestInstanceId!="string"||e.requestInstanceId.length===0)return null;let y=Object.freeze({typedRouter:this,trustedLocalData:s,wireLocalDataPresent:o});try{a=this.incomingRequestSignalResolver(e,y)}catch{return null}if(a&&(!this.isAbortSignal(a.abortSignal)||typeof a.complete!="function")){try{a.complete?.()}catch{}return null}c=a?.abortSignal}let u;try{u=this.virtualStreamTransportResolver?.(s)}catch(y){try{a?.complete()}catch{}throw y}let f=new dt,l=new dt,d=i(async y=>{await Promise.allSettled([f.rollback(y),l.rollback(y)])},"rollbackRouteActivations"),p=i(()=>{f.commit(),l.commit()},"commitRouteActivations"),h=i(async()=>(delete e.localData,ze.encodePayloadForNetwork(e,{side:"responding",virtualStreamTransport:u,activationScope:l})),"encodeResponse");try{if(e=await ze.decodePayloadFromNetworkAsync(e,{side:"responding",virtualStreamTransport:u,activationScope:f,abortSignal:c}),e.response=null,e.localData={...s},e.localData.firstTypedrouter=this,e?.correlation?.phase==="request"){let y=Date.now();n.skipHooks||this.callHook("onIncomingRequest",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"incoming",phase:"request",timestamp:y,payload:e.request});let w=this.getTypedHandlerAndRouter(e.method);if(!w)return console.log(`Cannot find handler for methodname ${e.method}`),e.error={text:"There is no available method for this call on the server side",data:{}},e.correlation.phase="response",e=await h(),await d(e.error),n.skipHooks||this.callHook("onOutgoingResponse",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"outgoing",phase:"response",timestamp:Date.now(),durationMs:Date.now()-y,payload:e.response,errorText:e.error?.text}),this.assertTrustedAbortSignalActive(c),e;let{handler:g,router:v}=w,G=w.routerPath??[v],ee,Q,Ce=!1,_e=i(async()=>{try{if(v.middlewares.length>0)try{for(let R of v.middlewares)await R(e)}catch(R){ee={value:R},this.setErrorFromCaughtError(e,R,"middleware"),e.correlation.phase="response",Ce=!0;return}f.authorizeApplicationUse(),e=await g.addResponse(e,c),Ce=!0}catch(R){throw Q={error:R},R}},"runMiddlewareAndHandler"),it=this.collectRequestScopes(G);if(it.length===0)await _e();else{let R=Object.freeze({entryRouter:this,owningRouter:v,method:e.method,localData:s,abortSignal:c}),st;try{await yp(it,0,_e,e,R)}catch(at){if(Q&&at===Q.error)throw at;st={error:at}}if(st)e.response=null,this.setErrorFromCaughtError(e,st.error,"requestscope"),e.correlation.phase="response",ee={value:st.error};else if(!Ce){if(!e.error&&(e.response===void 0||e.response===null)){let at=new Error("A TypedRouter request scope answered with neither a response nor an error");ao({origin:"requestscope",method:e.method,correlationId:e.correlation?.id,error:at}),e.error={text:t.internalErrorMessage,data:{}},ee={value:at}}e.correlation.phase="response"}}let K=!!e.error;return e=await h(),K&&await d(ee?ee.value:e.error),n.skipHooks||this.callHook("onOutgoingResponse",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"outgoing",phase:"response",timestamp:Date.now(),durationMs:Date.now()-y,payload:e.response,errorText:e.error?.text}),K||(this.assertTrustedAbortSignalActive(c),p()),this.assertTrustedAbortSignalActive(c),e}return await d(new Error("TypedRouter received an unroutable request DTO")),this.assertTrustedAbortSignalActive(c),null}catch(y){throw await d(y),y}finally{try{a?.complete()}catch{}}}sanitizeIncomingLocalData(e){try{let r=Reflect.getOwnPropertyDescriptor(e,"localData");if(r&&(r.configurable!==!0||!Reflect.deleteProperty(e,"localData")))return!1;if(!Reflect.has(e,"localData"))return!0;if(!Reflect.isExtensible(e)||!Reflect.defineProperty(e,"localData",{configurable:!0,enumerable:!1,value:void 0,writable:!0}))return!1;let o=Reflect.getOwnPropertyDescriptor(e,"localData");return!!(o&&o.configurable===!0&&o.enumerable===!1&&o.value===void 0&&o.writable===!0)}catch{return!1}}isAbortSignal(e){return!!(e&&typeof e=="object"&&typeof Reflect.get(e,"aborted")=="boolean"&&typeof Reflect.get(e,"addEventListener")=="function"&&typeof Reflect.get(e,"removeEventListener")=="function")}assertTrustedAbortSignalActive(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}};var $c=class{static{i(this,"TypedTarget")}constructor(e){if(this.isAsync=!1,e.postMethodWithTypedRouter&&!e.typedRouterRef)throw new Error("you have to specify a typedrouter when using postmethod with typedrouter");let r=e.responseTimeoutMs??3e4;if(!Number.isSafeInteger(r)||r<=0||r>2147483647)throw new RangeError("TypedTarget responseTimeoutMs must be a positive safe integer no greater than 2147483647");this.options=e,this.responseTimeoutMs=r}async post(e,r={}){if(r.signal&&this.options.supportsAbortSignal!==!0)throw new Error("TypedTarget does not declare AbortSignal transport support");let o=this.options.postMethod||this.options.postMethodWithTypedRouter;if(!o)throw new Error("TypedTarget requires a post method");let n;if(this.options.typedRouterRef){let l=ca(e);if(!l)throw new TypeError("TypedTarget request response identity is malformed");n=await this.options.typedRouterRef.fireEventInterestMap.addInterest(l,e)}let s=r.signal;if(s?.aborted)throw n?.destroy(),s.reason??new DOMException("The operation was aborted","AbortError");let a,c=s?new Promise((l,d)=>{a=i(()=>{n?.destroy(),d(s.reason??new DOMException("The operation was aborted","AbortError"))},"abortListener"),s.addEventListener("abort",a,{once:!0})}):void 0,u,f=n?new Promise((l,d)=>{u=setTimeout(()=>{d(new Error(`TypedTarget response timed out after ${this.responseTimeoutMs}ms`))},this.responseTimeoutMs),u.unref?.()}):void 0;try{let l=Promise.resolve(o(e,r)),d=await Promise.race([l,...f?[f]:[],...c?[c]:[]]);return n?await Promise.race([n.interestFullfilled,f,...c?[c]:[]]):d||e}finally{u&&clearTimeout(u),s&&a&&s.removeEventListener("abort",a),n?.destroy()}}};var ua=new nn.HttpCache,Yb=new ro.SmartFetch({httpCache:ua}),fa=2147483647,la=class extends Error{static{i(this,"TypedRequestTimeoutError")}constructor(e,r){super(`Typed request "${e}" timed out after ${r}ms`),this.name="TypedRequestTimeoutError",this.method=e,this.timeoutMs=r}},da=class extends Error{static{i(this,"TypedRequestRetryLimitError")}constructor(e,r){super(`Typed request "${e}" exceeded its ${r} server-directed retries`),this.name="TypedRequestRetryLimitError",this.method=e,this.maxRetries=r}},qc=class{static{i(this,"TypedRequest")}constructor(e,r){this.skipHooks=!1,typeof e=="string"?this.urlEndPoint=e:this.typedTarget=e,this.method=r}async fire(e,r=!1){let o=Date.now(),n=this.resolveFireOptions(r),s=this.createAbortContext(n);n.abortSignal=s.signal;let a=new dt,c={method:this.method,request:e,response:null,requestInstanceId:Be.uni(),correlation:{id:Be.uni(),phase:"request"}};try{this.assertActive(n);let u=ze.encodePayloadForNetworkWithMetadata(c,{side:"requesting",activationScope:a,virtualStreamTransport:this.typedTarget?.options.virtualStreamTransport});c=u.payload;let f=u.containsNetworkDescriptor;if(f&&!this.urlEndPoint&&this.typedTarget.options.supportsAbortSignal!==!0)throw new Error("VirtualStreams require TypedTarget AbortSignal transport support");if(n.useCache&&f)throw new Error("TypedRequest response caching is not supported for requests containing VirtualStreams");this.assertActive(n),n.useCache&&(n.cacheKey=await this.createCacheKey(c),this.assertActive(n)),this.skipHooks||so("onOutgoingRequest",{correlationId:c.correlation.id,method:this.method,direction:"outgoing",phase:"request",timestamp:o,payload:e}),a.publish();let l=await this.postTrObject(c,n);delete l.localData;let d=l.error;if(this.assertActive(n),d)throw this.skipHooks||so("onIncomingResponse",{correlationId:c.correlation.id,method:this.method,direction:"incoming",phase:"response",timestamp:Date.now(),durationMs:Date.now()-o,payload:l.response,errorText:d.text}),this.assertActive(n),new je(d.text,d.data);let p=l.response;if(!this.urlEndPoint&&this.typedTarget.options.supportsAbortSignal!==!0&&ze.containsNetworkDescriptor(p))throw new Error("VirtualStreams require TypedTarget AbortSignal transport support");try{p=await ze.decodePayloadFromNetworkAsync(p,{side:"requesting",activationScope:a,virtualStreamTransport:this.typedTarget?.options.virtualStreamTransport,openDeadlineAt:n.deadlineAt,abortSignal:n.abortSignal})}catch(h){throw h instanceof mr&&n.deadlineAt!==void 0&&h.deadlineAt===n.deadlineAt?this.createTimeoutError(n):h}return this.assertActive(n),a.authorizeApplicationUse(),this.skipHooks||so("onIncomingResponse",{correlationId:c.correlation.id,method:this.method,direction:"incoming",phase:"response",timestamp:Date.now(),durationMs:Date.now()-o,payload:p}),this.assertActive(n),a.commit(),p}catch(u){throw await a.rollback(u),u}finally{s.cleanup()}}async postTrObject(e,r={useCache:!1,maxRetries:3}){let o=0;for(;;){this.assertActive(r);let n=this.createRequestIdentitySnapshot(e),s;if(this.urlEndPoint){let a;try{a=await Yb.postJsonWithMetadata(this.urlEndPoint,e,{cacheStrategy:r.useCache?"cache-first":"network-only",cacheKey:r.cacheKey,timeout:this.getRemainingTimeout(r),signal:r.abortSignal})}catch(c){throw r.cacheKey&&c instanceof SyntaxError&&await ua.delete(r.cacheKey),r.abortSignal?.aborted?this.getAbortReason(r):r.timeoutMs!==void 0&&(this.hasDeadlineExpired(r)||ro.isFetchTimeoutError(c))?this.createTimeoutError(r):c}s=a.data;try{a.metadata.fromCache?s=this.reconstructCachedHttpResponse(s,e,n):this.assertResponseEnvelope(s,n)}catch(c){throw r.cacheKey&&await ua.delete(r.cacheKey),c}r.cacheKey&&!this.isReusableCachedHttpEnvelope(s)&&await ua.delete(r.cacheKey)}else s=await this.postTypedTarget(e,r);if(this.assertResponseEnvelope(s,n),this.assertActive(r),s.error&&!s.retry||!s.retry)return s;if(console.log(`Server requested a retry for TypedRequest method '${this.method}'`),o>=r.maxRetries)throw new da(this.method,r.maxRetries);o+=1,await this.waitForRetry(s.retry.waitForMs,r),e.requestInstanceId=Be.uni(),e.correlation.phase="request",e.response=null,delete e.error,delete e.retry}}assertResponseEnvelope(e,r){let o=e?.error,n=e?.requestInstanceId,s=r.requestInstanceId;if(!e||typeof e!="object"||e.method!==r.method||e.correlation?.phase!=="response"||typeof e.correlation.id!="string"||e.correlation.id.length===0||!Object.hasOwn(e,"response")||typeof n!="string"||n.length===0||typeof s!="string"||s.length===0||n!==s||o!==void 0&&(!o||typeof o!="object"||typeof o.text!="string")||e.correlation.id!==r.correlationId)throw new TypeError("TypedRequest received an invalid response envelope")}async postTypedTarget(e,r){this.assertActive(r);try{return await this.typedTarget.post(e,{signal:r.abortSignal})}catch(o){throw r.abortSignal?.aborted?this.getAbortReason(r):o}}resolveFireOptions(e){let r=typeof e=="boolean"?{useCache:e}:e;if(!r||typeof r!="object")throw new TypeError("TypedRequest fire options must be a boolean or an options object");if(r.useCache!==void 0&&typeof r.useCache!="boolean")throw new TypeError("TypedRequest useCache must be a boolean");if(r.timeoutMs!==void 0&&(!Number.isSafeInteger(r.timeoutMs)||r.timeoutMs<=0||r.timeoutMs>fa))throw new RangeError(`TypedRequest timeoutMs must be a positive safe integer no greater than ${fa}`);if(r.abortSignal!==void 0&&!this.isAbortSignal(r.abortSignal))throw new TypeError("TypedRequest abortSignal must be an AbortSignal");if(r.maxRetries!==void 0&&(!Number.isSafeInteger(r.maxRetries)||r.maxRetries<0||r.maxRetries>1e3))throw new RangeError("TypedRequest maxRetries must be a safe integer between 0 and 1000");if((r.timeoutMs!==void 0||r.abortSignal!==void 0)&&!this.urlEndPoint&&this.typedTarget.options.supportsAbortSignal!==!0)throw new Error(r.abortSignal?"TypedRequest cancellation requires an HTTP URL or a TypedTarget with AbortSignal support":"TypedRequest timeoutMs requires an HTTP URL or a TypedTarget with AbortSignal support");return{useCache:r.useCache??!1,timeoutMs:r.timeoutMs,maxRetries:r.maxRetries??3,abortSignal:r.abortSignal,deadlineAt:r.timeoutMs===void 0?void 0:performance.now()+r.timeoutMs}}getRemainingTimeout(e){if(e.deadlineAt===void 0||e.timeoutMs===void 0)return;let r=Math.ceil(e.deadlineAt-performance.now());if(r<=0)throw this.createTimeoutError(e);return r}assertDeadline(e){this.getRemainingTimeout(e)}assertActive(e){if(e.abortSignal?.aborted)throw this.getAbortReason(e);this.assertDeadline(e)}hasDeadlineExpired(e){return e.deadlineAt!==void 0&&performance.now()>=e.deadlineAt}createTimeoutError(e){return new la(this.method,e.timeoutMs)}async waitForRetry(e,r){if(!Number.isSafeInteger(e)||e<=0||e>fa)throw new RangeError(`TypedRequest retry waitForMs must be a positive safe integer no greater than ${fa}`);this.assertActive(r);let o=this.getRemainingTimeout(r);if(o===void 0){await this.delayWithAbort(e,r);return}if(e>=o)throw await this.delayWithAbort(o,r),this.createTimeoutError(r);await this.delayWithAbort(e,r),this.assertActive(r)}async delayWithAbort(e,r){let o=r.abortSignal;if(!o){await F.delayFor(e);return}await new Promise((n,s)=>{let a=setTimeout(()=>{o.removeEventListener("abort",c),n()},e),c=i(()=>{clearTimeout(a),o.removeEventListener("abort",c),s(this.getAbortReason(r))},"onAbort");o.addEventListener("abort",c,{once:!0}),o.aborted&&c()})}createAbortContext(e){let r=e.abortSignal;if(e.timeoutMs===void 0)return{signal:r,cleanup:i(()=>{},"cleanup")};let o=new AbortController,n=i(()=>{o.abort(r?.reason??new DOMException("The operation was aborted","AbortError"))},"onCallerAbort");r?.aborted?n():r?.addEventListener("abort",n,{once:!0});let s=Math.max(0,Math.ceil(e.deadlineAt-performance.now())),a=setTimeout(()=>{o.abort(this.createTimeoutError(e))},s);return a.unref?.(),{signal:o.signal,cleanup:i(()=>{clearTimeout(a),r?.removeEventListener("abort",n)},"cleanup")}}getAbortReason(e){return e.abortSignal?.reason??new DOMException("The operation was aborted","AbortError")}reconstructCachedHttpResponse(e,r,o){if(!e||typeof e!="object"||Array.isArray(e)||e.method!==o.method||!Object.hasOwn(e,"response")||!e.response||typeof e.response!="object"||!this.isReusableCachedHttpEnvelope(e))throw new TypeError("TypedRequest received an invalid cached response envelope");return{method:o.method,request:r.request,response:e.response,requestInstanceId:o.requestInstanceId,correlation:{id:o.correlationId,phase:"response"}}}createRequestIdentitySnapshot(e){return Object.freeze({method:e.method,correlationId:e.correlation?.id,requestInstanceId:e.requestInstanceId})}isReusableCachedHttpEnvelope(e){return!Object.hasOwn(e,"error")&&!Object.hasOwn(e,"retry")&&!ze.containsNetworkDescriptor(e)}isAbortSignal(e){return!!(e&&typeof e=="object"&&typeof Reflect.get(e,"aborted")=="boolean"&&typeof Reflect.get(e,"addEventListener")=="function"&&typeof Reflect.get(e,"removeEventListener")=="function")}async createCacheKey(e){let r=JSON.stringify({endpoint:this.urlEndPoint,method:e.method,request:e.request}),o=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(r));return`typedrequest:v1:${Array.from(new Uint8Array(o),s=>s.toString(16).padStart(2,"0")).join("")}`}};function xp(t){return t&&typeof t.then=="function"}i(xp,"isPromise");var wp=Promise.resolve(!1),gue=Promise.resolve(!0),nt=Promise.resolve();function ma(t,e){return t||(t=0),new Promise(function(r){return setTimeout(function(){return r(e)},t)})}i(ma,"sleep");function gp(t,e){return Math.floor(Math.random()*(e-t+1)+t)}i(gp,"randomInt");function sn(){return Math.random().toString(36).substring(2)}i(sn,"randomToken");var Bc=0;function mt(){var t=Date.now()*1e3;return t<=Bc&&(t=Bc+1),Bc=t,t}i(mt,"microSeconds");function bue(){return typeof navigator<"u"&&typeof navigator.locks<"u"&&typeof navigator.locks.request=="function"}i(bue,"supportsWebLockAPI");var Hb=mt,jb="native";function $b(t){var e={time:mt(),messagesCallback:null,bc:new BroadcastChannel(t),subFns:[]};return e.bc.onmessage=function(r){e.messagesCallback&&e.messagesCallback(r.data)},e}i($b,"create");function qb(t){t.bc.close(),t.subFns=[]}i(qb,"close");function Bb(t,e){try{return t.bc.postMessage(e,!1),nt}catch(r){return Promise.reject(r)}}i(Bb,"postMessage");function zb(t,e){t.messagesCallback=e}i(zb,"onMessage");function Vb(){if(typeof globalThis<"u"&&globalThis.Deno&&globalThis.Deno.args)return!0;if((typeof window<"u"||typeof self<"u")&&typeof BroadcastChannel=="function"){if(BroadcastChannel._pubkey)throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0}else return!1}i(Vb,"canBeUsed");function Gb(){return 150}i(Gb,"averageResponseTime");var bp={create:$b,close:qb,onMessage:zb,postMessage:Bb,canBeUsed:Vb,type:jb,averageResponseTime:Gb,microSeconds:Hb};var co=class{static{i(this,"ObliviousSet")}ttl;map=new Map;_to=!1;constructor(e){this.ttl=e}has(e){let r=this.map.get(e);return typeof r>"u"?!1:r<zc()-this.ttl?(this.map.delete(e),!1):!0}add(e){this.map.delete(e),this.map.set(e,zc()),this._to||(this._to=!0,setTimeout(()=>{this._to=!1,Jb(this)},0))}clear(){this.map.clear()}};function Jb(t){let e=zc()-t.ttl,r=t.map[Symbol.iterator]();for(;;){let o=r.next().value;if(!o)break;let n=o[0];if(o[1]<e)t.map.delete(n);else break}}i(Jb,"removeTooOldValues");function zc(){return Date.now()}i(zc,"now");function hr(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=JSON.parse(JSON.stringify(t));return typeof e.webWorkerSupport>"u"&&(e.webWorkerSupport=!0),e.idb||(e.idb={}),e.idb.ttl||(e.idb.ttl=1e3*45),e.idb.fallbackInterval||(e.idb.fallbackInterval=150),t.idb&&typeof t.idb.onclose=="function"&&(e.idb.onclose=t.idb.onclose),e.localstorage||(e.localstorage={}),e.localstorage.removeTimeout||(e.localstorage.removeTimeout=1e3*60),t.methods&&(e.methods=t.methods),e.node||(e.node={}),e.node.ttl||(e.node.ttl=1e3*60*2),e.node.maxParallelWrites||(e.node.maxParallelWrites=2048),typeof e.node.useFastPath>"u"&&(e.node.useFastPath=!0),e}i(hr,"fillOptionsWithDefaults");var Qb=mt,Kb="pubkey.broadcast-channel-0-",Ve="messages",an={durability:"relaxed"},Xb="idb";function vp(){if(typeof indexedDB<"u")return indexedDB;if(typeof window<"u"){if(typeof window.mozIndexedDB<"u")return window.mozIndexedDB;if(typeof window.webkitIndexedDB<"u")return window.webkitIndexedDB;if(typeof window.msIndexedDB<"u")return window.msIndexedDB}return!1}i(vp,"getIdb");function pa(t){t.commit&&t.commit()}i(pa,"commitIndexedDBTransaction");function Zb(t){var e=vp(),r=Kb+t,o=e.open(r);return o.onupgradeneeded=function(n){var s=n.target.result;s.createObjectStore(Ve,{keyPath:"id",autoIncrement:!0})},new Promise(function(n,s){o.onerror=function(a){return s(a)},o.onsuccess=function(){n(o.result)}})}i(Zb,"createDatabase");function Ab(t,e,r){var o=Date.now(),n={uuid:e,time:o,data:r},s=t.transaction([Ve],"readwrite",an);return new Promise(function(a,c){s.oncomplete=function(){return a()},s.onerror=function(f){return c(f)};var u=s.objectStore(Ve);u.add(n),pa(s)})}i(Ab,"writeMessage");function Rue(t){var e=t.transaction(Ve,"readonly",an),r=e.objectStore(Ve),o=[];return new Promise(function(n){r.openCursor().onsuccess=function(s){var a=s.target.result;a?(o.push(a.value),a.continue()):(pa(e),n(o))}})}i(Rue,"getAllMessages");function ev(t,e){var r=t.transaction(Ve,"readonly",an),o=r.objectStore(Ve),n=[],s=IDBKeyRange.bound(e+1,1/0);if(o.getAll){var a=o.getAll(s);return new Promise(function(u,f){a.onerror=function(l){return f(l)},a.onsuccess=function(l){u(l.target.result)}})}function c(){try{return s=IDBKeyRange.bound(e+1,1/0),o.openCursor(s)}catch{return o.openCursor()}}return i(c,"openCursor"),new Promise(function(u,f){var l=c();l.onerror=function(d){return f(d)},l.onsuccess=function(d){var p=d.target.result;p?p.value.id<e+1?p.continue(e+1):(n.push(p.value),p.continue()):(pa(r),u(n))}})}i(ev,"getMessagesHigherThan");function tv(t,e){if(t.closed)return Promise.resolve([]);var r=t.db.transaction(Ve,"readwrite",an),o=r.objectStore(Ve);return Promise.all(e.map(function(n){var s=o.delete(n);return new Promise(function(a){s.onsuccess=function(){return a()}})}))}i(tv,"removeMessagesById");function rv(t,e){var r=Date.now()-e,o=t.transaction(Ve,"readonly",an),n=o.objectStore(Ve),s=[];return new Promise(function(a){n.openCursor().onsuccess=function(c){var u=c.target.result;if(u){var f=u.value;f.time<r?(s.push(f),u.continue()):(pa(o),a(s))}else a(s)}})}i(rv,"getOldMessages");function ov(t){return rv(t.db,t.options.idb.ttl).then(function(e){return tv(t,e.map(function(r){return r.id}))})}i(ov,"cleanOldMessages");function nv(t,e){return e=hr(e),Zb(t).then(function(r){var o={closed:!1,lastCursorId:0,channelName:t,options:e,uuid:sn(),eMIs:new co(e.idb.ttl*2),writeBlockPromise:nt,messagesCallback:null,readQueuePromises:[],db:r};return r.onclose=function(){o.closed=!0,e.idb.onclose&&e.idb.onclose()},Tp(o),o})}i(nv,"create");function Tp(t){t.closed||Dp(t).then(function(){return ma(t.options.idb.fallbackInterval)}).then(function(){return Tp(t)})}i(Tp,"_readLoop");function iv(t,e){return!(t.uuid===e.uuid||e.eMIs.has(t.id)||t.data.time<e.messagesCallbackTime)}i(iv,"_filterMessage");function Dp(t){return t.closed?nt:t.messagesCallback?ev(t.db,t.lastCursorId).then(function(e){var r=e.filter(function(o){return!!o}).map(function(o){return o.id>t.lastCursorId&&(t.lastCursorId=o.id),o}).filter(function(o){return iv(o,t)}).sort(function(o,n){return o.time-n.time});return r.forEach(function(o){t.messagesCallback&&(t.eMIs.add(o.id),t.messagesCallback(o.data))}),nt}):nt}i(Dp,"readNewMessages");function sv(t){t.closed=!0,t.db.close()}i(sv,"close");function av(t,e){return t.writeBlockPromise=t.writeBlockPromise.then(function(){return Ab(t.db,t.uuid,e)}).then(function(){gp(0,10)===0&&ov(t)}),t.writeBlockPromise}i(av,"postMessage");function cv(t,e,r){t.messagesCallbackTime=r,t.messagesCallback=e,Dp(t)}i(cv,"onMessage");function uv(){return!!vp()}i(uv,"canBeUsed");function fv(t){return t.idb.fallbackInterval*2}i(fv,"averageResponseTime");var Sp={create:nv,close:sv,onMessage:cv,postMessage:av,canBeUsed:uv,type:Xb,averageResponseTime:fv,microSeconds:Qb};var lv=mt,dv="pubkey.broadcastChannel-",mv="localstorage";function Mp(){var t;if(typeof window>"u")return null;try{t=window.localStorage,t=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return t}i(Mp,"getLocalStorage");function Op(t){return dv+t}i(Op,"storageKey");function pv(t,e){return new Promise(function(r){ma().then(function(){var o=Op(t.channelName),n={token:sn(),time:Date.now(),data:e,uuid:t.uuid},s=JSON.stringify(n);Mp().setItem(o,s);var a=document.createEvent("Event");a.initEvent("storage",!0,!0),a.key=o,a.newValue=s,window.dispatchEvent(a),r()})})}i(pv,"postMessage");function hv(t,e){var r=Op(t),o=i(function(s){s.key===r&&e(JSON.parse(s.newValue))},"listener");return window.addEventListener("storage",o),o}i(hv,"addStorageEventListener");function yv(t){window.removeEventListener("storage",t)}i(yv,"removeStorageEventListener");function xv(t,e){if(e=hr(e),!Ep())throw new Error("BroadcastChannel: localstorage cannot be used");var r=sn(),o=new co(e.localstorage.removeTimeout),n={channelName:t,uuid:r,eMIs:o};return n.listener=hv(t,function(s){n.messagesCallback&&s.uuid!==r&&(!s.token||o.has(s.token)||s.data.time&&s.data.time<n.messagesCallbackTime||(o.add(s.token),n.messagesCallback(s.data)))}),n}i(xv,"create");function wv(t){yv(t.listener)}i(wv,"close");function gv(t,e,r){t.messagesCallbackTime=r,t.messagesCallback=e}i(gv,"onMessage");function Ep(){var t=Mp();if(!t)return!1;try{var e="__broadcastchannel_check";t.setItem(e,"works"),t.removeItem(e)}catch{return!1}return!0}i(Ep,"canBeUsed");function bv(){var t=120,e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")?t*2:t}i(bv,"averageResponseTime");var kp={create:xv,close:wv,onMessage:gv,postMessage:pv,canBeUsed:Ep,type:mv,averageResponseTime:bv,microSeconds:lv};var Ip=mt,vv="simulate",Vc=new Set;function Tv(t){var e={time:Ip(),name:t,messagesCallback:null};return Vc.add(e),e}i(Tv,"create");function Dv(t){Vc.delete(t)}i(Dv,"close");var Pp=5;function Sv(t,e){return new Promise(function(r){return setTimeout(function(){var o=Array.from(Vc);o.forEach(function(n){n.name===t.name&&n!==t&&n.messagesCallback&&n.time<e.time&&n.messagesCallback(e)}),r()},Pp)})}i(Sv,"postMessage");function Mv(t,e){t.messagesCallback=e}i(Mv,"onMessage");function Ov(){return!0}i(Ov,"canBeUsed");function Ev(){return Pp}i(Ev,"averageResponseTime");var Cp={create:Tv,close:Dv,onMessage:Mv,postMessage:Sv,canBeUsed:Ov,type:vv,averageResponseTime:Ev,microSeconds:Ip};var _p=[bp,Sp,kp];function Gc(t){var e=[].concat(t.methods,_p).filter(Boolean);if(t.type){if(t.type==="simulate")return Cp;var r=e.find(function(n){return n.type===t.type});if(r)return r;throw new Error("method-type "+t.type+" not found")}t.webWorkerSupport||(e=e.filter(function(n){return n.type!=="idb"}));var o=e.find(function(n){return n.canBeUsed()});if(o)return o;throw new Error("No usable method found in "+JSON.stringify(_p.map(function(n){return n.type})))}i(Gc,"chooseMethod");var Qc=new Set,kv=0,yr=i(function(e,r){this.id=kv++,Qc.add(this),this.name=e,Jc&&(r=Jc),this.options=hr(r),this.method=Gc(this.options),this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,Cv(this)},"BroadcastChannel");yr._pubkey=!0;function Iv(t){t=hr(t);var e=Gc(t);return e.type==="node"?e.clearNodeFolder().then(function(){return!0}):wp}i(Iv,"clearNodeFolder");var Jc;function Pv(t){Jc=t}i(Pv,"enforceOptions"),yr.prototype={postMessage:i(function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return Rp(this,"message",e)},"postMessage"),postInternal:i(function(e){return Rp(this,"internal",e)},"postInternal"),set onmessage(t){var e=this.method.microSeconds(),r={time:e,fn:t};Wp(this,"message",this._onML),t&&typeof t=="function"?(this._onML=r,Fp(this,"message",r)):this._onML=null},addEventListener:i(function(e,r){var o=this.method.microSeconds(),n={time:o,fn:r};Fp(this,e,n)},"addEventListener"),removeEventListener:i(function(e,r){var o=this._addEL[e].find(function(n){return n.fn===r});Wp(this,e,o)},"removeEventListener"),close:i(function(){var e=this;if(!this.closed){Qc.delete(this),this.closed=!0;var r=this._prepP?this._prepP:nt;return this._onML=null,this._addEL.message=[],r.then(function(){return Promise.all(Array.from(e._uMP))}).then(function(){return Promise.all(e._befC.map(function(o){return o()}))}).then(function(){return e.method.close(e._state)})}},"close"),get type(){return this.method.type},get isClosed(){return this.closed}};function Rp(t,e,r){var o=t.method.microSeconds(),n={time:o,type:e,data:r},s=t._prepP?t._prepP:nt;return s.then(function(){var a=t.method.postMessage(t._state,n);return t._uMP.add(a),a.catch().then(function(){return t._uMP.delete(a)}),a})}i(Rp,"_post");function Cv(t){var e=t.method.create(t.name,t.options);xp(e)?(t._prepP=e,e.then(function(r){t._state=r})):t._state=e}i(Cv,"_prepareChannel");function Np(t){return t._addEL.message.length>0||t._addEL.internal.length>0}i(Np,"_hasMessageListeners");function Fp(t,e,r){t._addEL[e].push(r),_v(t)}i(Fp,"_addListenerObject");function Wp(t,e,r){t._addEL[e]=t._addEL[e].filter(function(o){return o!==r}),Rv(t)}i(Wp,"_removeListenerObject");function _v(t){if(!t._iL&&Np(t)){var e=i(function(n){t._addEL[n.type].forEach(function(s){n.time>=s.time&&s.fn(n.data)})},"listenerFn"),r=t.method.microSeconds();t._prepP?t._prepP.then(function(){t._iL=!0,t.method.onMessage(t._state,e,r)}):(t._iL=!0,t.method.onMessage(t._state,e,r))}}i(_v,"_startListening");function Rv(t){if(t._iL&&!Np(t)){t._iL=!1;var e=t.method.microSeconds();t.method.onMessage(t._state,null,e)}}i(Rv,"_stopListening");var Fv=i(t=>"ref"in t&&typeof t.ref=="function"&&"unref"in t&&typeof t.unref=="function","isProcessHolding"),Wv=i((t,e)=>{if(typeof globalThis.BroadcastChannel=="function"){let o=new globalThis.BroadcastChannel(t);o.onmessage=s=>{e(s.data)};let n=Fv(o)?o:null;return n?.unref(),{post:i(async s=>{o.postMessage(s)},"post"),close:i(async()=>{o.close()},"close"),holdProcess:i(s=>{s?n?.ref():n?.unref()},"holdProcess")}}let r=new yr(t);return r.onmessage=o=>{e(o)},{post:i(o=>r.postMessage(o),"post"),close:i(()=>r.close(),"close"),holdProcess:i(()=>{},"holdProcess")}},"openChannel"),Lp=i(t=>typeof t=="object"&&t!==null,"isObject"),Up=i((t,e)=>Object.prototype.hasOwnProperty.call(t,e),"hasOwn"),Lv=i(t=>{if(!Lp(t)||!Up(t,"deesCommsEvent"))return null;let e=t.deesCommsEvent;return!Lp(e)||typeof e.name!="string"||typeof e.uniqueEventId!="string"||!Up(e,"payload")?"malformed":{name:e.name,uniqueEventId:e.uniqueEventId,payload:e.payload}},"eventOf"),Uv=i(()=>{let t=globalThis.crypto.getRandomValues(new Uint8Array(16));return Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")},"createEventId"),Yp=class t{constructor(e={}){this.eventHandlers=new Map;this.hasTypedHandlers=!1;this.closed=!1;this.closing=null;this.typedrouter=new Ht.TypedRouter;this.typedtarget=new Ht.TypedTarget({postMethodWithTypedRouter:i(async e=>{await this.postMessage(e)},"postMethodWithTypedRouter"),typedRouterRef:this.typedrouter});this.channelName=e.channelName??t.defaultChannelName,this.channel=Wv(this.channelName,r=>{this.receive(r)})}static{i(this,"DeesComms")}static{this.defaultChannelName="dees-comms"}createTypedRequest(e){return new Ht.TypedRequest(this.typedtarget,e)}async postMessage(e){this.assertOpen(),await this.channel.post(e)}async createTypedHandler(e,r){this.typedrouter.addTypedHandler(new Ht.TypedHandler(e,r)),this.hasTypedHandlers=!0,this.holdProcessWhileListened()}async broadcast(e,r){let o={deesCommsEvent:{name:e,uniqueEventId:Uv(),payload:r}};await this.postMessage(o)}subscribe(e,r){this.assertOpen();let o=i((s,a)=>r(s,a),"handler"),n=this.eventHandlers.get(e);return n||(n=new Set,this.eventHandlers.set(e,n)),n.add(o),this.holdProcessWhileListened(),{unsubscribe:i(()=>{let s=this.eventHandlers.get(e);s&&(s.delete(o),s.size===0&&(this.eventHandlers.delete(e),this.holdProcessWhileListened()))},"unsubscribe")}}async close(){this.closing||(this.closed=!0,this.eventHandlers.clear(),this.closing=this.channel.close()),await this.closing}holdProcessWhileListened(){this.closed||this.channel.holdProcess(this.hasTypedHandlers||this.eventHandlers.size>0)}assertOpen(){if(this.closed)throw new Error(`DeesComms channel "${this.channelName}" is closed`)}async receive(e){if(this.closed)return;let r=Lv(e);if(r==="malformed"){console.log("DeesComms received a malformed event");return}if(r){this.dispatch(r);return}let o=await this.typedrouter.routeAndAddResponse(e,{skipHooks:!0});o&&!o.error&&!this.closed&&await this.postMessage(o)}dispatch(e){let r=this.eventHandlers.get(e.name);if(r)for(let o of[...r]){if(this.closed)return;r.has(o)&&(async()=>o(e.payload,e))().catch(n=>{console.error(`DeesComms: a handler of the event "${e.name}" failed`,n)})}}};export{Yp as DeesComms};
13
13
  //# sourceMappingURL=bundle.js.map