@design.estate/dees-comms 2.0.0 → 2.1.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,16 @@
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:
1
+ var Ym=Object.create;var un=Object.defineProperty;var jm=Object.getOwnPropertyDescriptor;var qm=Object.getOwnPropertyNames;var $m=Object.getPrototypeOf,Bm=Object.prototype.hasOwnProperty;var i=(t,e)=>un(t,"name",{value:e,configurable:!0});var Bt=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},H=(t,e)=>{for(var r in e)un(t,r,{get:e[r],enumerable:!0})},zm=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of qm(e))!Bm.call(t,n)&&n!==r&&un(t,n,{get:()=>e[n],enumerable:!(o=jm(e,n))||o.enumerable});return t};var fn=(t,e,r)=>(r=t!=null?Ym($m(t)):{},zm(e||!t||!t.__esModule?un(r,"default",{value:t,enumerable:!0}):r,t));var Cd=Bt((Xa,Za)=>{(function(t,e){typeof Xa=="object"&&typeof Za<"u"?Za.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(Xa,(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",m="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 O=String(k);return!O||O.length>=D?k:""+Array(D+1-O.length).join(b)+k},"m"),G={s:v,z:i(function(k){var D=-k.utcOffset(),b=Math.abs(D),O=Math.floor(b/60),T=b%60;return(D<=0?"+":"-")+v(O,2,"0")+":"+v(T,2,"0")},"z"),m:i(function k(D,b){if(D.date()<b.date())return-k(b,D);var O=12*(b.year()-D.year())+(b.month()-D.month()),T=D.clone().add(O,f),C=b-T<0,R=D.clone().add(O+(C?-1:1),f);return+(-(O+(b-T)/(C?T-R:R-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: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")},ee="en",Q={};Q[ee]=g;var Ce="$isDayjsObject",Re=i(function(k){return k instanceof at||!(!k||!k[Ce])},"S"),st=i(function k(D,b,O){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 R=D.split("-");if(!T&&R.length>1)return k(R[0])}else{var $=D.name;Q[$]=D,T=$}return!O&&T&&(ee=T),T||!O&&ee},"t"),K=i(function(k,D){if(Re(k))return k.clone();var b=typeof D=="object"?D:{};return b.date=k,b.args=arguments,new at(b)},"O"),_=G;_.l=st,_.i=Re,_.w=function(k,D){return K(k,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var at=(function(){function k(b){this.$L=st(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(O){var T=O.date,C=O.utc;if(T===null)return new Date(NaN);if(_.u(T))return new Date;if(T instanceof Date)return new Date(T);if(typeof T=="string"&&!/Z$/i.test(T)){var R=T.match(y);if(R){var $=R[2]-1||0,X=(R[7]||"0").substring(0,3);return C?new Date(Date.UTC(R[1],$,R[3]||1,R[4]||0,R[5]||0,R[6]||0,X)):new Date(R[1],$,R[3]||1,R[4]||0,R[5]||0,R[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 _},D.isValid=function(){return this.$d.toString()!==h},D.isSame=function(b,O){var T=K(b);return this.startOf(O)<=T&&T<=this.endOf(O)},D.isAfter=function(b,O){return K(b)<this.startOf(O)},D.isBefore=function(b,O){return this.endOf(O)<K(b)},D.$g=function(b,O,T){return _.u(b)?this[O]:this.set(T,b)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(b,O){var T=this,C=!!_.u(O)||O,R=_.p(b),$=i(function($t,Se){var ht=_.w(T.$u?Date.UTC(T.$y,Se,$t):new Date(T.$y,Se,$t),T);return C?ht:ht.endOf(c)},"l"),X=i(function($t,Se){return _.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,_e=this.$D,xr="set"+(this.$u?"UTC":"");switch(R){case d:return C?$(1,0):$(31,11);case f:return C?$(1,ue):$(0,ue+1);case u:var qt=this.$locale().weekStart||0,uo=(oe<qt?oe+7:oe)-qt;return $(C?_e-uo:_e+(6-uo),ue);case c:case m: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,O){var T,C=_.p(b),R="set"+(this.$u?"UTC":""),$=(T={},T[c]=R+"Date",T[m]=R+"Date",T[f]=R+"Month",T[d]=R+"FullYear",T[a]=R+"Hours",T[s]=R+"Minutes",T[n]=R+"Seconds",T[o]=R+"Milliseconds",T)[C],X=C===c?this.$D+(O-this.$W):O;if(C===f||C===d){var oe=this.clone().set(m,1);oe.$d[$](X),oe.init(),this.$d=oe.set(m,Math.min(this.$D,oe.daysInMonth())).$d}else $&&this.$d[$](X);return this.init(),this},D.set=function(b,O){return this.clone().$set(b,O)},D.get=function(b){return this[_.p(b)]()},D.add=function(b,O){var T,C=this;b=Number(b);var R=_.p(O),$=i(function(ue){var _e=K(C);return _.w(_e.date(_e.date()+Math.round(ue*b)),C)},"y");if(R===f)return this.set(f,this.$M+b);if(R===d)return this.set(d,this.$y+b);if(R===c)return $(1);if(R===u)return $(7);var X=(T={},T[s]=e,T[a]=r,T[n]=t,T)[R]||1,oe=this.$d.getTime()+b*X;return _.w(oe,this)},D.subtract=function(b,O){return this.add(-1*b,O)},D.format=function(b){var O=this,T=this.$locale();if(!this.isValid())return T.invalidDate||h;var C=b||"YYYY-MM-DDTHH:mm:ssZ",R=_.z(this),$=this.$H,X=this.$m,oe=this.$M,ue=T.weekdays,_e=T.months,xr=T.meridiem,qt=i(function(Se,ht,fo,cn){return Se&&(Se[ht]||Se(O,C))||fo[ht].slice(0,cn)},"h"),uo=i(function(Se){return _.s($%12||12,Se,"0")},"d"),$t=xr||function(Se,ht,fo){var cn=Se<12?"AM":"PM";return fo?cn.toLowerCase():cn};return C.replace(w,(function(Se,ht){return ht||(function(fo){switch(fo){case"YY":return String(O.$y).slice(-2);case"YYYY":return _.s(O.$y,4,"0");case"M":return oe+1;case"MM":return _.s(oe+1,2,"0");case"MMM":return qt(T.monthsShort,oe,_e,3);case"MMMM":return qt(_e,oe);case"D":return O.$D;case"DD":return _.s(O.$D,2,"0");case"d":return String(O.$W);case"dd":return qt(T.weekdaysMin,O.$W,ue,2);case"ddd":return qt(T.weekdaysShort,O.$W,ue,3);case"dddd":return ue[O.$W];case"H":return String($);case"HH":return _.s($,2,"0");case"h":return uo(1);case"hh":return uo(2);case"a":return $t($,X,!0);case"A":return $t($,X,!1);case"m":return String(X);case"mm":return _.s(X,2,"0");case"s":return String(O.$s);case"ss":return _.s(O.$s,2,"0");case"SSS":return _.s(O.$ms,3,"0");case"Z":return R}return null})(Se)||R.replace(":","")}))},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(b,O,T){var C,R=this,$=_.p(O),X=K(b),oe=(X.utcOffset()-this.utcOffset())*e,ue=this-X,_e=i(function(){return _.m(R,X)},"D");switch($){case d:C=_e()/12;break;case f:C=_e();break;case l:C=_e()/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:_.a(C)},D.daysInMonth=function(){return this.endOf(f).$D},D.$locale=function(){return Q[this.$L]},D.locale=function(b,O){if(!b)return this.$L;var T=this.clone(),C=st(b,O,!0);return C&&(T.$L=C),T},D.clone=function(){return _.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})(),ct=at.prototype;return K.prototype=ct,[["$ms",o],["$s",n],["$m",s],["$H",a],["$W",c],["$M",f],["$y",d],["$D",m]].forEach((function(k){ct[k[1]]=function(D){return this.$g(D,k[0],k[1])}})),K.extend=function(k,D){return k.$i||(k(D,at,K),k.$i=!0),K},K.locale=st,K.isDayjs=Re,K.unix=function(k){return K(1e3*k)},K.en=Q[ee],K.Ls=Q,K.p={},K}))});var Rd=Bt((Aa,ec)=>{(function(t,e){typeof Aa=="object"&&typeof ec<"u"?ec.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_isToday=e()})(Aa,(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 Wd=Bt((rne,Fd)=>{"use strict";Fd.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 Ud=Bt((nne,Ld)=>{"use strict";Ld.exports=Object.freeze({DISCONNECTED:1,PRECEDING:2,FOLLOWING:4,CONTAINS:8,CONTAINED_BY:16})});var $d=Bt((ine,qd)=>{"use strict";var Hd=Symbol(),Yd=Symbol(),_t=Symbol(),jd=Symbol(),$e=class{static{i(this,"TreeIterator")}constructor(e,r,o,n){this[Hd]=e,this[Yd]=r,this[_t]=o,this[jd]=n}next(){let e=this[Hd],r=this[jd],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($e.prototype,Symbol.iterator,{value:i(function(){return this},"value"),writable:!1}),$e.PREV=1,$e.NEXT=2,$e.PARENT=3,$e.PRECEDING=4,$e.FOLLOWING=5,Object.freeze($e),Object.freeze($e.prototype),qd.exports=$e});var zd=Bt((ane,Bd)=>{"use strict";var m0=Wd(),Nt=Ud(),He=$d();function cc(){return!0}i(cc,"returnTrue");function Jr(t,e){return t[t.length-1-e]}i(Jr,"reverseArrayIndex");var Es=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 m0)}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||cc,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||cc,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||cc,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 He(this,e,o?n.lastChild:n.firstChild,o?He.PREV:He.NEXT)}previousSiblingsIterator(e){return new He(this,e,this._node(e).previousSibling,He.PREV)}nextSiblingsIterator(e){return new He(this,e,this._node(e).nextSibling,He.NEXT)}ancestorsIterator(e){return new He(this,e,e,He.PARENT)}treeIterator(e,r){let o=r&&r.reverse;return new He(this,e,o?this.lastInclusiveDescendant(e):e,o?He.PRECEDING:He.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 Nt.CONTAINS|Nt.PRECEDING;o.push(l),l=this.parent(l)}}let n=[];{let l=r;for(;l;){if(l===e)return Nt.CONTAINED_BY|Nt.FOLLOWING;n.push(l),l=this.parent(l)}}let s=Jr(o,0);if(!s||s!==Jr(n,0))return Nt.DISCONNECTED;let a=0,c=Math.min(o.length,n.length);for(let l=0;l<c;++l){let d=Jr(o,l),m=Jr(n,l);if(d!==m)break;a=l}let u=this.index(Jr(o,a+1));return this.index(Jr(n,a+1))<u?Nt.PRECEDING:Nt.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}};Bd.exports=Es,Es.TreePosition=Nt});var Pp=Bt((Eae,Ip)=>{"use strict";Ip.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],m=s(a[d]);m&&(u&&(u+=","),u+=JSON.stringify(d)+":"+m)}return n.splice(f,1),"{"+u+"}"}}),"stringify")(t)}});var ln={};var Ve={};H(Ve,{TYPED_REQUEST_REDACTED_PAYLOAD:()=>oo,TypedHandler:()=>jc,TypedRequest:()=>Bc,TypedRequestRetryLimitError:()=>da,TypedRequestTimeoutError:()=>la,TypedResponseError:()=>je,TypedRouter:()=>qc,TypedTarget:()=>$c,VirtualStream:()=>ze,VirtualStreamActivationScope:()=>pt,VirtualStreamClosedError:()=>pr,VirtualStreamLifecycleContractError:()=>ra,VirtualStreamOpenTimeoutError:()=>mr,getTypedRequestResponseInterestKey:()=>ca});var ot={};H(ot,{AsyncExecutionStack:()=>uc,BackpressuredArray:()=>fc,FastMap:()=>Ho,Interest:()=>Yo,InterestMap:()=>lc,LimitedArray:()=>dc,LoopTracker:()=>pc,ObjectMap:()=>sr,Stringmap:()=>mc,TimedAggregator:()=>jo,TimedAggregtor:()=>jo,Tree:()=>hc,uni:()=>Vd});var po={};H(po,{SmartMatch:()=>wa});var lo={};H(lo,{isMatch:()=>Jm,matcher:()=>Gm});function ya(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}i(ya,"escapeStringRegexp");var xa=new Map,Xc=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"),Vm=i((t,e)=>{e={caseSensitive:!1,...e};let r=t+JSON.stringify(e);if(xa.has(r))return xa.get(r);let o=t[0]==="!";o&&(t=t.slice(1)),t=ya(t).replace(/\\\*/g,"[\\s\\S]*");let n=new RegExp(`^${t}$`,e.caseSensitive?"":"i");return n.negated=o,xa.set(r,n),n},"makeRegexp"),Zc=i((t,e,r,o)=>{if(t=Xc(t,"inputs"),e=Xc(e,"patterns"),e.length===0)return[];e=e.map(a=>Vm(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 Gm(t,e,r){return Zc(t,e,r,!1)}i(Gm,"matcher");function Jm(t,e,r){return Zc(t,e,r,!0).length>0}i(Jm,"isMatch");var wa=class{static{i(this,"SmartMatch")}constructor(e){this.wildcard=e}match(e){return lo.isMatch(e,this.wildcard)}};var F={};H(F,{CumulativeDeferred:()=>pn,Deferred:()=>dn,Timeout:()=>mo,cumulativeDefer:()=>Xm,defer:()=>yt,delayFor:()=>tu,delayForRandom:()=>rh,fromCallback:()=>nh,getFirstTrueOrFalse:()=>oh,map:()=>eh,rejectedPromise:()=>Am,resolvedPromise:()=>Zm,timeoutAndContinue:()=>th,timeoutWrap:()=>eu});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"})}},yt=i(()=>new dn,"defer");var Km=2147483647,Ac=i(t=>{t.unref?.()},"unrefTimer"),mo=class{static{i(this,"Timeout")}constructor(e,r,o=!1){this.unrefed=!1,this.state="running",this.timeLeftAtCancel=0,this.passOn=r,this.deferred=yt(),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,Km),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&&Ac(o),o}makeUnrefed(){this.unrefed=!0,Ac(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 pn=class{static{i(this,"CumulativeDeferred")}constructor(){this.accumulatedPromises=[],this.deferred=yt(),this.promise=this.deferred.promise,setTimeout(async()=>{for(;this.accumulatedPromises.length>0;)await this.accumulatedPromises.shift();this.deferred.resolve()},0)}subDefer(){let e=yt();return this.addPromise(e.promise),e}addPromise(e){this.accumulatedPromises.push(e)}},Xm=i(()=>new pn,"cumulativeDefer");function Zm(t){return Promise.resolve(t)}i(Zm,"resolvedPromise");var Am=i(t=>Promise.reject(t),"rejectedPromise"),eh=i(async(t,e)=>Promise.all(t.map(e)),"map"),eu=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)=>eu(t,e,!1),"timeoutAndContinue"),tu=i(async(t,e,r=!1)=>(await new mo(t,void 0,r).promise,e),"delayFor"),rh=i(async(t,e,r,o=!1)=>(await tu(Math.random()*(e-t)+t,void 0,o),r),"delayForRandom"),oh=i(async t=>{let e=yt();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={};H(We,{ObservableIntake:()=>qa,Observablemap:()=>ja,fromStreamWithBackpressure:()=>Fx,rxjs:()=>Dr});var Dr={};H(Dr,{Observable:()=>j,ReplaySubject:()=>wn,Subject:()=>Qe,Subscription:()=>Me,from:()=>Jt,fromEvent:()=>Kt,of:()=>Ha,ops:()=>Nx});var ga=i(function(t,e){return ga=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])},ga(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");ga(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 ba=i(function(){return ba=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"),ba.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,m=!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(m)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),m=!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 ph(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}i(ph,"__metadata");function Da(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(Da,"__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 va=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 mh(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&va(e,t,r)}i(mh,"__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 ut(t){return this instanceof ut?(this.v=t,this):new ut(t)}i(ut,"__await");function Sa(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){m(s[0][3],w)}}function f(h){h.value instanceof ut?Promise.resolve(h.value.v).then(l,d):m(s[0][2],h)}function l(h){u("next",h)}function d(h){u("throw",h)}function m(h,y){h(y),s.shift(),s.length&&u(s[0][0],s[0][1])}}i(Sa,"__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:ut(t[n](a)),done:!1}:s?s(a):a}:s}}i(xh,"__asyncDelegator");function Ma(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(Ma,"__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},Ta=i(function(t){return Ta=Object.getOwnPropertyNames||function(e){var r=[];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[r.length]=o);return r},Ta(t)},"ownKeys");function bh(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Ta(t),o=0;o<r.length;o++)r[o]!=="default"&&va(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 Eh=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 Oh(t){function e(s){t.error=t.hasError?new Eh(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(Oh,"__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 uT={__extends:se,__assign:ba,__rest:sh,__decorate:ah,__param:ch,__esDecorate:uh,__runInitializers:fh,__propKey:lh,__setFunctionName:dh,__metadata:ph,__awaiter:Da,__generator:ho,__createBinding:va,__exportStar:mh,__values:fe,__read:be,__spread:hh,__spreadArrays:yh,__spreadArray:Ne,__await:ut,__asyncGenerator:Sa,__asyncDelegator:xh,__asyncValues:Ma,__makeTemplateObject:wh,__importStar:bh,__importDefault:vh,__classPrivateFieldGet:Th,__classPrivateFieldSet:Dh,__classPrivateFieldIn:Sh,__addDisposableResource:Mh,__disposeResources:Oh,__rewriteRelativeImportExtension:kh};function I(t){return typeof t=="function"}i(I,"isFunction");function mn(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(mn,"createErrorClass");var yo=mn(function(t){return i(function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
2
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:
3
+ `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl")});function qe(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}i(qe,"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 m=fe(d),h=m.next();!h.done;h=m.next()){var y=h.value;try{ru(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=m.return)&&n.call(m)}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)ru(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)&&qe(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&qe(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})(),Ea=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 ru(t){I(t)?t():t.unsubscribe()}i(ru,"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 Je(){}i(Je,"noop");var ou=(function(){return Oa("C",void 0,void 0)})();function nu(t){return Oa("E",void 0,t)}i(nu,"errorNotification");function iu(t){return Oa("N",t,void 0)}i(iu,"nextNotification");function Oa(t,e,r){return{kind:t,value:e,error:r}}i(Oa,"createNotification");var zt=null;function gr(t){if(Fe.useDeprecatedSynchronousErrorHandling){var e=!zt;if(e&&(zt={errorThrown:!1,error:null}),t(),e){var r=zt,o=r.errorThrown,n=r.error;if(zt=null,o)throw n}}else t()}i(gr,"errorContext");function su(t){Fe.useDeprecatedSynchronousErrorHandling&&zt&&(zt.errorThrown=!0,zt.error=t)}i(su,"captureError");var Vt=(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=Rh,o}return i(e,"Subscriber"),e.create=function(r,o,n){return new xo(r,o,n)},e.prototype.next=function(r){this.isStopped?Ia(iu(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?Ia(nu(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?Ia(ou,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 ka(t,e){return Ih.call(t,e)}i(ka,"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&&ka(r.next,c),error:r.error&&ka(r.error,c),complete:r.complete&&ka(r.complete,c)}):a=r}return s.destination=new Ph(a),s}return i(e,"SafeSubscriber"),e})(Vt);function xn(t){Fe.useDeprecatedSynchronousErrorHandling?su(t):yn(t)}i(xn,"handleUnhandledError");function Ch(t){throw t}i(Ch,"defaultErrorHandler");function Ia(t,e){var r=Fe.onStoppedNotification;r&&wr.setTimeout(function(){return r(t,e)})}i(Ia,"handleStoppedNotification");var Rh={closed:!0,next:Je,error:Ch,complete:Je};var Gt=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function wo(t){return t}i(wo,"identity");function _h(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Pa(t)}i(_h,"pipe");function Pa(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(Pa,"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=au(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[Gt]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Pa(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=au(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 au(t){var e;return(e=t??Fe.Promise)!==null&&e!==void 0?e:Promise}i(au,"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 Vt||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 cu(t,e,r,o,n)}i(z,"createOperatorSubscriber");var cu=(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})(Vt);var Ca=mn(function(t){return i(function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl")});var Qe=(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 Ra(this,this);return o.operator=r,o},e.prototype._throwIfClosed=function(){if(this.closed)throw new Ca},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?Ea:(this.currentObservers=null,c.push(r),new Me(function(){o.currentObservers=null,qe(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 Ra(r,o)},e})(j),Ra=(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:Ea},e})(Qe);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})(Qe);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 Na=(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,qe(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 Fa=(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 xt=new Fa(Na),Wa=xt;function gn(t){return t&&I(t.schedule)}i(gn,"isScheduler");function La(t){return t[t.length-1]}i(La,"last");function pS(t){return I(La(t))?t.pop():void 0}i(pS,"popResultSelector");function wt(t){return gn(La(t))?t.pop():void 0}i(wt,"popScheduler");function mS(t,e){return typeof La(t)=="number"?t.pop():e}i(mS,"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[Gt])}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 En(t){return Sa(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,ut(r.read())];case 3:return o=a.sent(),n=o.value,s=o.done,s?[4,ut(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,ut(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(En,"readableStreamLikeToAsyncGenerator");function On(t){return I(t?.getReader)}i(On,"isReadableStreamLike");function Z(t){if(t instanceof j)return t;if(t!=null){if(vn(t))return Uh(t);if(br(t))return Hh(t);if(bn(t))return Yh(t);if(Tn(t))return uu(t);if(Mn(t))return jh(t);if(On(t))return qh(t)}throw Dn(t)}i(Z,"innerFrom");function Uh(t){return new j(function(e){var r=t[Gt]();if(I(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i(Uh,"fromInteropObservable");function Hh(t){return new j(function(e){for(var r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}i(Hh,"fromArrayLike");function Yh(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(Yh,"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 uu(t){return new j(function(e){$h(t,e).catch(function(r){return e.error(r)})})}i(uu,"fromAsyncIterable");function qh(t){return uu(En(t))}i(qh,"fromReadableStreamLike");function $h(t,e){var r,o,n,s;return Da(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=Ma(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($h,"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 fu(t,e){return Z(t).pipe(Tr(e),vr(e))}i(fu,"scheduleObservable");function lu(t,e){return Z(t).pipe(Tr(e),vr(e))}i(lu,"schedulePromise");function du(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(du,"scheduleArray");function pu(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(pu,"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(En(t),e)}i(mu,"scheduleReadableStreamLike");function Ua(t,e){if(t!=null){if(vn(t))return fu(t,e);if(br(t))return du(t,e);if(bn(t))return lu(t,e);if(Tn(t))return kn(t,e);if(Mn(t))return pu(t,e);if(On(t))return mu(t,e)}throw Dn(t)}i(Ua,"scheduled");function Jt(t,e){return e?Ua(t,e):Z(t)}i(Jt,"from");function Ha(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=wt(t);return Jt(t,r)}i(Ha,"of");function hu(t){return t instanceof Date&&!isNaN(t)}i(hu,"isValidDate");function gt(t,e){return B(function(r,o){var n=0;r.subscribe(z(o,function(s){o.next(t.call(e,s,n++))}))})}i(gt,"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 yu(t){return gt(function(e){return zh(t,e)})}i(yu,"mapOneOrManyArgs");function xu(t,e,r,o,n,s,a,c){var u=[],f=0,l=0,d=!1,m=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();m()}catch(G){e.error(G)}}))},"doInnerSub");return t.subscribe(z(e,h,function(){d=!0,m()})),function(){c?.()}}i(xu,"mergeInternals");function Qt(t,e,r){return r===void 0&&(r=1/0),I(e)?Qt(function(o,n){return gt(function(s,a){return e(o,s,n,a)})(Z(t(o,n)))},r):(typeof e=="number"&&(r=e),B(function(o,n){return xu(o,n,t,r)}))}i(Qt,"mergeMap");function In(t){return t===void 0&&(t=1/0),Qt(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()(Jt(t,wt(t)))}i(Cn,"concat");var Vh=["addListener","removeListener"],Gh=["addEventListener","removeEventListener"],Jh=["on","off"];function Kt(t,e,r,o){if(I(r)&&(o=r,r=void 0),o)return Kt(t,e,r).pipe(yu(o));var n=be(Xh(t)?Gh.map(function(c){return function(u){return t[c](e,u,r)}}):Qh(t)?Vh.map(wu(t,e)):Kh(t)?Jh.map(wu(t,e)):[],2),s=n[0],a=n[1];if(!s&&br(t))return Qt(function(c){return Kt(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(Kt,"fromEvent");function wu(t,e){return function(r){return function(o){return t[r](e,o)}}}i(wu,"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=Wa);var o=-1;return e!=null&&(gn(e)?r=e:o=e),new j(function(n){var s=hu(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 Rn(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(Rn,"filter");function _n(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)},Je)),function(){o=null}})}i(_n,"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 m=fe(n),h=m.next();!h.done;h=m.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=m.return)&&u.call(m)}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;qe(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=wt(o))!==null&&e!==void 0?e:xt,a=(r=o[0])!==null&&r!==void 0?r:null,c=o[1]||1/0;return B(function(u,f){var l=[],d=!1,m=i(function(w){var g=w.buffer,v=w.subs;v.unsubscribe(),qe(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 m(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,Re=Ce.buffer;Re.push(w),c<=Re.length&&m(Ce)}}catch(st){g={error:st}}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,Je),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=xt),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=wt(t);return B(function(o,n){(r?Cn(t,o,r):Cn(t,o)).subscribe(n)})}i(Un,"startWith");function Hn(t){return B(function(e,r){Z(t).subscribe(z(r,function(){return r.complete()},Je)),!r.closed&&e.subscribe(r)})}i(Hn,"takeUntil");function Yn(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,m=!1,h=i(function(){d?.unsubscribe(),d=null,u&&(g(),m&&o.complete())},"endThrottling"),y=i(function(){d=null,m&&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),!m&&w(v)}},"send");r.subscribe(z(o,function(v){f=!0,l=v,!(d&&!d.closed)&&(a?g():w(v))},function(){m=!0,!(u&&f&&d&&!d.closed)&&o.complete()}))})}i(Yn,"throttle");function jn(t,e,r){e===void 0&&(e=xt);var o=Ya(t,e);return Yn(function(){return o},r)}i(jn,"throttleTime");var Nx={buffer:_n,bufferCount:Nn,bufferTime:Fn,debounce:Wn,debounceTime:Ln,filter:Rn,map:gt,startWith:Un,takeUntil:Hn,throttleTime:jn};var ja=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=Kt(e,r),s=new Qe;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 Qe,eventRef:e,event:r};return this.observableEventTargetBundleArray.push(s),s.subject}}};var qa=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 ir={};H(ir,{CronJob:()=>Lo,CronJobCollection:()=>Uo,CronManager:()=>rc,ExtendedDate:()=>nc,HrtMeasurement:()=>ic,Interval:()=>sc,TimeStamp:()=>Gr,Timer:()=>ac,getMilliSecondsAsHumanReadableAgoTime:()=>d0,getMilliSecondsAsHumanReadableString:()=>l0,getMilliSecondsFromUnits:()=>oc,units:()=>Rt});var Mo={};H(Mo,{Cron:()=>Su,CronDate:()=>te,CronPattern:()=>qn,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("-")?Ba(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),"Etc/UTC"):Ba(r.getFullYear(),r.getMonth()+1,r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),e)}i(Wx,"A");function gu(t,e,r){return bu(Wx(t,e),r)}i(gu,"v");function bu(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),m=Do(d,t.tz);return $a(m,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(bu,"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 Ba(t,e,r,o,n,s,a){return{y:t,m:e,d:r,h:o,i:n,s,tz:a}}i(Ba,"b");var vu=[1,2,4,8,16],qn=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 m=f;m<=l;m+=d)this.setPart(e,m,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]|vu[e-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${e}, Type: ${typeof e}`)}},za=[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 Du{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 Du)this.fromCronDate(e);else throw new TypeError("CronDate: Invalid type ("+typeof e+") passed to CronDate constructor")}getLastDayOfMonth(e,r){return r!==1?za[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&&vu[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>za[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=gu(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(gu(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 m=o[r][d];if(r==="day"&&!m){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){m=1;break}}}if(r==="day"&&o.lastWeekday){let h=this.getLastWeekday(this.year,this.month);d-n===h&&(m=1)}if(r==="day"&&o.lastDayOfMonth&&d-n==c&&(m=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?m=m&&h:!e.domAndDow&&!o.starDOM?m=m||h:m=m&&h}if(m)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 m=d!==1?za[d]:new Date(Date.UTC(l,d+1,0)).getUTCDate();this.day>m&&(this.day=m)}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),m=this.getLastDayOfMonth(this.year,this.month),h=Math.min(d,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,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)):bu(Ba(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 Hx(t){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(t):t&&typeof t.unref<"u"&&t.unref()}i(Hx,"x");var Tu=30*1e3,Sr=[],Su=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 qn("* * * * *",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 qn(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>Tu&&(e=Tu),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(r),e),this._states.currentTimeout&&this.options.unref&&Hx(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={};H(Fo,{add:()=>vt,addBusinessDays:()=>Zn,addDays:()=>re,addHours:()=>An,addISOWeekYears:()=>ti,addMilliseconds:()=>Tt,addMinutes:()=>kr,addMonths:()=>Xe,addQuarters:()=>Ir,addSeconds:()=>ri,addWeeks:()=>Dt,addYears:()=>oi,areIntervalsOverlapping:()=>Iu,clamp:()=>Pu,closestIndexTo:()=>si,closestTo:()=>Cu,compareAsc:()=>de,compareDesc:()=>Ru,constructFrom:()=>x,constructNow:()=>N,daysToWeeks:()=>_u,differenceInBusinessDays:()=>Nu,differenceInCalendarDays:()=>ne,differenceInCalendarISOWeekYears:()=>ci,differenceInCalendarISOWeeks:()=>Fu,differenceInCalendarMonths:()=>Zt,differenceInCalendarQuarters:()=>Pr,differenceInCalendarWeeks:()=>At,differenceInCalendarYears:()=>St,differenceInDays:()=>Cr,differenceInHours:()=>er,differenceInISOWeekYears:()=>Lu,differenceInMilliseconds:()=>Rr,differenceInMinutes:()=>tr,differenceInMonths:()=>Mt,differenceInQuarters:()=>Uu,differenceInSeconds:()=>tt,differenceInWeeks:()=>Hu,differenceInYears:()=>li,eachDayOfInterval:()=>di,eachHourOfInterval:()=>Yu,eachMinuteOfInterval:()=>ju,eachMonthOfInterval:()=>qu,eachQuarterOfInterval:()=>$u,eachWeekOfInterval:()=>Bu,eachWeekendOfInterval:()=>Fr,eachWeekendOfMonth:()=>zu,eachWeekendOfYear:()=>Vu,eachYearOfInterval:()=>Gu,endOfDay:()=>_r,endOfDecade:()=>Ju,endOfHour:()=>Qu,endOfISOWeek:()=>Ku,endOfISOWeekYear:()=>Xu,endOfMinute:()=>Zu,endOfMonth:()=>Nr,endOfQuarter:()=>Au,endOfSecond:()=>ef,endOfToday:()=>tf,endOfTomorrow:()=>rf,endOfWeek:()=>mi,endOfYear:()=>pi,endOfYesterday:()=>of,format:()=>Po,formatDate:()=>Po,formatDistance:()=>gi,formatDistanceStrict:()=>bi,formatDistanceToNow:()=>hf,formatDistanceToNowStrict:()=>yf,formatDuration:()=>xf,formatISO:()=>wf,formatISO9075:()=>gf,formatISODuration:()=>bf,formatRFC3339:()=>vf,formatRFC7231:()=>Tf,formatRelative:()=>Df,formatters:()=>ko,fromUnixTime:()=>Sf,getDate:()=>vi,getDay:()=>It,getDayOfYear:()=>yi,getDaysInMonth:()=>Ti,getDaysInYear:()=>Mf,getDecade:()=>Ef,getDefaultOptions:()=>Si,getHours:()=>Of,getISODay:()=>Mi,getISOWeek:()=>Hr,getISOWeekYear:()=>Te,getISOWeeksInYear:()=>kf,getMilliseconds:()=>If,getMinutes:()=>Pf,getMonth:()=>Cf,getOverlappingDaysInIntervals:()=>Rf,getQuarter:()=>Oo,getSeconds:()=>_f,getTime:()=>Nf,getUnixTime:()=>Ff,getWeek:()=>Yr,getWeekOfMonth:()=>Wf,getWeekYear:()=>Ot,getWeeksInMonth:()=>Lf,getYear:()=>Uf,hoursToMilliseconds:()=>Hf,hoursToMinutes:()=>Yf,hoursToSeconds:()=>jf,interval:()=>qf,intervalToDuration:()=>$f,intlFormat:()=>Bf,intlFormatDistance:()=>zf,isAfter:()=>Vf,isBefore:()=>Gf,isDate:()=>ai,isEqual:()=>Jf,isExists:()=>Qf,isFirstDayOfMonth:()=>Kf,isFriday:()=>Xf,isFuture:()=>Zf,isLastDayOfMonth:()=>fi,isLeapYear:()=>Di,isMatch:()=>Af,isMonday:()=>el,isPast:()=>tl,isSameDay:()=>et,isSameHour:()=>ys,isSameISOWeek:()=>xs,isSameISOWeekYear:()=>rl,isSameMinute:()=>ws,isSameMonth:()=>gs,isSameQuarter:()=>bs,isSameSecond:()=>vs,isSameWeek:()=>Br,isSameYear:()=>Ts,isSaturday:()=>Kn,isSunday:()=>Xn,isThisHour:()=>ol,isThisISOWeek:()=>nl,isThisMinute:()=>il,isThisMonth:()=>sl,isThisQuarter:()=>al,isThisSecond:()=>cl,isThisWeek:()=>ul,isThisYear:()=>fl,isThursday:()=>ll,isToday:()=>dl,isTomorrow:()=>pl,isTuesday:()=>ml,isValid:()=>ae,isWednesday:()=>hl,isWeekend:()=>Ze,isWithinInterval:()=>yl,isYesterday:()=>xl,lastDayOfDecade:()=>wl,lastDayOfISOWeek:()=>gl,lastDayOfISOWeekYear:()=>bl,lastDayOfMonth:()=>Ei,lastDayOfQuarter:()=>vl,lastDayOfWeek:()=>Ds,lastDayOfYear:()=>Tl,lightFormat:()=>Dl,lightFormatters:()=>Ie,longFormatters:()=>kt,max:()=>ni,milliseconds:()=>Sl,millisecondsToHours:()=>Ml,millisecondsToMinutes:()=>El,millisecondsToSeconds:()=>Ol,min:()=>ii,minutesToHours:()=>kl,minutesToMilliseconds:()=>Il,minutesToSeconds:()=>Pl,monthsToQuarters:()=>Cl,monthsToYears:()=>Rl,nextDay:()=>me,nextFriday:()=>_l,nextMonday:()=>Nl,nextSaturday:()=>Fl,nextSunday:()=>Wl,nextThursday:()=>Ll,nextTuesday:()=>Ul,nextWednesday:()=>Hl,parse:()=>hs,parseISO:()=>jl,parseJSON:()=>ql,parsers:()=>ms,previousDay:()=>he,previousFriday:()=>$l,previousMonday:()=>Bl,previousSaturday:()=>zl,previousSunday:()=>Vl,previousThursday:()=>Gl,previousTuesday:()=>Jl,previousWednesday:()=>Ql,quartersToMonths:()=>Kl,quartersToYears:()=>Xl,roundToNearestHours:()=>Zl,roundToNearestMinutes:()=>Al,secondsToHours:()=>ed,secondsToMilliseconds:()=>td,secondsToMinutes:()=>rd,set:()=>od,setDate:()=>nd,setDay:()=>Pt,setDayOfYear:()=>id,setDefaultOptions:()=>sd,setHours:()=>ad,setISODay:()=>Zi,setISOWeek:()=>zi,setISOWeekYear:()=>ei,setMilliseconds:()=>cd,setMinutes:()=>ud,setMonth:()=>zr,setQuarter:()=>fd,setSeconds:()=>ld,setWeek:()=>$i,setWeekYear:()=>dd,setYear:()=>pd,startOfDay:()=>Ae,startOfDecade:()=>md,startOfHour:()=>Co,startOfISOWeek:()=>A,startOfISOWeekYear:()=>ke,startOfMinute:()=>Ro,startOfMonth:()=>Et,startOfQuarter:()=>rt,startOfSecond:()=>_o,startOfToday:()=>hd,startOfTomorrow:()=>yd,startOfWeek:()=>q,startOfWeekYear:()=>rr,startOfYear:()=>Wr,startOfYesterday:()=>xd,sub:()=>wd,subBusinessDays:()=>gd,subDays:()=>Ct,subHours:()=>bd,subISOWeekYears:()=>ui,subMilliseconds:()=>vd,subMinutes:()=>Td,subMonths:()=>Ms,subQuarters:()=>Dd,subSeconds:()=>Sd,subWeeks:()=>Md,subYears:()=>Ed,toDate:()=>p,transpose:()=>Oi,weeksToDays:()=>Od,yearsToDays:()=>kd,yearsToMonths:()=>Id,yearsToQuarters:()=>Pd});var Bn=7,Eo=365.2425,Yx=Math.pow(10,8)*24*60*60*1e3,F_=-Yx,Ke=6048e5,zn=864e5,le=6e4,Oe=36e5,Mr=1e3,Va=525600,bt=43200,Er=1440,Vn=60,Gn=3,Jn=12,Qn=4,Xt=3600,Or=60,$n=Xt*24,Mu=$n*7,Ga=$n*365.2425,Ja=Ga/12,Eu=Ja*3,Qa=Symbol.for("constructDateFrom");function x(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&Qa in t?t[Qa](e):t instanceof Date?new t.constructor(e):new Date(e)}i(x,"constructFrom");var U_=x;function p(t,e){return x(e||t,t)}i(p,"toDate");var q_=p;function re(t,e,r){let o=p(t,r?.in);return isNaN(e)?x(r?.in||t,NaN):(e&&o.setDate(o.getDate()+e),o)}i(re,"addDays");var G_=re;function Xe(t,e,r){let o=p(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(Xe,"addMonths");var Z_=Xe;function vt(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=p(t,r?.in),d=n||o?Xe(l,n+o*12):l,m=a||s?re(d,a+s*7):d,h=u+c*60,w=(f+h*60)*1e3;return x(r?.in||t,+m+w)}i(vt,"add");var iN=vt;function Kn(t,e){return p(t,e?.in).getDay()===6}i(Kn,"isSaturday");var uN=Kn;function Xn(t,e){return p(t,e?.in).getDay()===0}i(Xn,"isSunday");var pN=Xn;function Ze(t,e){let r=p(t,e?.in).getDay();return r===0||r===6}i(Ze,"isWeekend");var xN=Ze;function Zn(t,e,r){let o=p(t,r?.in),n=Ze(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),Ze(o,r)||(u-=1);return n&&Ze(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 MN=Zn;function Tt(t,e,r){return x(r?.in||t,+p(t)+e)}i(Tt,"addMilliseconds");var PN=Tt;function An(t,e,r){return Tt(t,e*Oe,r)}i(An,"addHours");var FN=An;var Ou={};function U(){return Ou}i(U,"getDefaultOptions");function ku(t){Ou=t}i(ku,"setDefaultOptions");function q(t,e){let r=U(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,n=p(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(q,"startOfWeek");var qN=q;function A(t,e){return q(t,{...e,weekStartsOn:1})}i(A,"startOfISOWeek");var VN=A;function Te(t,e){let r=p(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 ZN=Te;function J(t){let e=p(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 E(t,...e){let r=x.bind(null,t||e.find(o=>typeof o=="object"));return e.map(r)}i(E,"normalizeDates");function Ae(t,e){let r=p(t,e?.in);return r.setHours(0,0,0,0),r}i(Ae,"startOfDay");var c2=Ae;function ne(t,e,r){let[o,n]=E(r?.in,t,e),s=Ae(o),a=Ae(n),c=+s-J(s),u=+a-J(a);return Math.round((c-u)/zn)}i(ne,"differenceInCalendarDays");var h2=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 v2=ke;function ei(t,e,r){let o=p(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 k2=ei;function ti(t,e,r){return ei(t,Te(t,r)+e,r)}i(ti,"addISOWeekYears");var _2=ti;function kr(t,e,r){let o=p(t,r?.in);return o.setTime(o.getTime()+e*le),o}i(kr,"addMinutes");var U2=kr;function Ir(t,e,r){return Xe(t,e*3,r)}i(Ir,"addQuarters");var q2=Ir;function ri(t,e,r){return Tt(t,e*1e3,r)}i(ri,"addSeconds");var V2=ri;function Dt(t,e,r){return re(t,e*7,r)}i(Dt,"addWeeks");var K2=Dt;function oi(t,e,r){return Xe(t,e*12,r)}i(oi,"addYears");var eF=oi;function Iu(t,e,r){let[o,n]=[+p(t.start,r?.in),+p(t.end,r?.in)].sort((c,u)=>c-u),[s,a]=[+p(e.start,r?.in),+p(e.end,r?.in)].sort((c,u)=>c-u);return r?.inclusive?o<=a&&s<=n:o<a&&s<n}i(Iu,"areIntervalsOverlapping");var nF=Iu;function ni(t,e){let r,o=e?.in;return t.forEach(n=>{!o&&typeof n=="object"&&(o=x.bind(null,n));let s=p(n,o);(!r||r<s||isNaN(+s))&&(r=s)}),x(o,r||NaN)}i(ni,"max");var uF=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=p(n,o);(!r||r>s||isNaN(+s))&&(r=s)}),x(o,r||NaN)}i(ii,"min");var mF=ii;function Pu(t,e,r){let[o,n,s]=E(r?.in,t,e.start,e.end);return ii([ni([o,n],r),s],r)}i(Pu,"clamp");var bF=Pu;function si(t,e){let r=+p(t);if(isNaN(r))return NaN;let o,n;return e.forEach((s,a)=>{let c=p(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 SF=si;function Cu(t,e,r){let[o,...n]=E(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(Cu,"closestTo");var PF=Cu;function de(t,e){let r=+p(t)-+p(e);return r<0?-1:r>0?1:r}i(de,"compareAsc");var NF=de;function Ru(t,e){let r=+p(t)-+p(e);return r>0?-1:r<0?1:r}i(Ru,"compareDesc");var UF=Ru;function N(t){return x(t,Date.now())}i(N,"constructNow");var qF=N;function _u(t){let e=Math.trunc(t/7);return e===0?0:e}i(_u,"daysToWeeks");var VF=_u;function et(t,e,r){let[o,n]=E(r?.in,t,e);return+Ae(o)==+Ae(n)}i(et,"isSameDay");var XF=et;function ai(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}i(ai,"isDate");var eW=ai;function ae(t){return!(!ai(t)&&typeof t!="number"||isNaN(+p(t)))}i(ae,"isValid");var iW=ae;function Nu(t,e,r){let[o,n]=E(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(;!et(o,f);)u+=Ze(f,r)?0:a,f=re(f,a);return u===0?0:u}i(Nu,"differenceInBusinessDays");var mW=Nu;function ci(t,e,r){let[o,n]=E(r?.in,t,e);return Te(o,r)-Te(n,r)}i(ci,"differenceInCalendarISOWeekYears");var gW=ci;function Fu(t,e,r){let[o,n]=E(r?.in,t,e),s=A(o),a=A(n),c=+s-J(s),u=+a-J(a);return Math.round((c-u)/Ke)}i(Fu,"differenceInCalendarISOWeeks");var EW=Fu;function Zt(t,e,r){let[o,n]=E(r?.in,t,e),s=o.getFullYear()-n.getFullYear(),a=o.getMonth()-n.getMonth();return s*12+a}i(Zt,"differenceInCalendarMonths");var PW=Zt;function Oo(t,e){let r=p(t,e?.in);return Math.trunc(r.getMonth()/3)+1}i(Oo,"getQuarter");var NW=Oo;function Pr(t,e,r){let[o,n]=E(r?.in,t,e),s=o.getFullYear()-n.getFullYear(),a=Oo(o)-Oo(n);return s*4+a}i(Pr,"differenceInCalendarQuarters");var HW=Pr;function At(t,e,r){let[o,n]=E(r?.in,t,e),s=q(o,r),a=q(n,r),c=+s-J(s),u=+a-J(a);return Math.round((c-u)/Ke)}i(At,"differenceInCalendarWeeks");var VW=At;function St(t,e,r){let[o,n]=E(r?.in,t,e);return o.getFullYear()-n.getFullYear()}i(St,"differenceInCalendarYears");var KW=St;function Cr(t,e,r){let[o,n]=E(r?.in,t,e),s=Wu(o,n),a=Math.abs(ne(o,n));o.setDate(o.getDate()-s*a);let c=+(Wu(o,n)===-s),u=s*(a-c);return u===0?0:u}i(Cr,"differenceInDays");function Wu(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(Wu,"compareLocalAsc");var tL=Cr;function pe(t){return e=>{let o=(t?Math[t]:Math.trunc)(e);return o===0?0:o}}i(pe,"getRoundingMethod");function er(t,e,r){let[o,n]=E(r?.in,t,e),s=(+o-+n)/Oe;return pe(r?.roundingMethod)(s)}i(er,"differenceInHours");var uL=er;function ui(t,e,r){return ti(t,-e,r)}i(ui,"subISOWeekYears");var pL=ui;function Lu(t,e,r){let[o,n]=E(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(Lu,"differenceInISOWeekYears");var bL=Lu;function Rr(t,e){return+p(t)-+p(e)}i(Rr,"differenceInMilliseconds");var SL=Rr;function tr(t,e,r){let o=Rr(t,e)/le;return pe(r?.roundingMethod)(o)}i(tr,"differenceInMinutes");var PL=tr;function _r(t,e){let r=p(t,e?.in);return r.setHours(23,59,59,999),r}i(_r,"endOfDay");var NL=_r;function Nr(t,e){let r=p(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 UL=Nr;function fi(t,e){let r=p(t,e?.in);return+_r(r,e)==+Nr(r,e)}i(fi,"isLastDayOfMonth");var BL=fi;function Mt(t,e,r){let[o,n,s]=E(r?.in,t,t,e),a=de(n,s),c=Math.abs(Zt(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(Mt,"differenceInMonths");var XL=Mt;function Uu(t,e,r){let o=Mt(t,e,r)/3;return pe(r?.roundingMethod)(o)}i(Uu,"differenceInQuarters");var r3=Uu;function tt(t,e,r){let o=Rr(t,e)/1e3;return pe(r?.roundingMethod)(o)}i(tt,"differenceInSeconds");var a3=tt;function Hu(t,e,r){let o=Cr(t,e,r)/7;return pe(r?.roundingMethod)(o)}i(Hu,"differenceInWeeks");var d3=Hu;function li(t,e,r){let[o,n]=E(r?.in,t,e),s=de(o,n),a=Math.abs(St(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 w3=li;function ie(t,e){let[r,o]=E(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 E3=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 C3=Yu;function ju(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(ju,"eachMinuteOfInterval");var L3=ju;function qu(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(qu,"eachMonthOfInterval");var q3=qu;function rt(t,e){let r=p(t,e?.in),o=r.getMonth(),n=o-o%3;return r.setMonth(n,1),r.setHours(0,0,0,0),r}i(rt,"startOfQuarter");var V3=rt;function $u(t,e){let{start:r,end:o}=ie(e?.in,t),n=+r>+o,s=n?+rt(r):+rt(o),a=n?rt(o):rt(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 A3=$u;function Bu(t,e){let{start:r,end:o}=ie(e?.in,t),n=+r>+o,s=n?q(o,e):q(r,e),a=n?q(r,e):q(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=Dt(u,f),u.setHours(15);return n?l.reverse():l}i(Bu,"eachWeekOfInterval");var s6=Bu;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++];Ze(c)&&s.push(x(r,c))}return s}i(Fr,"eachWeekendOfInterval");var p6=Fr;function Et(t,e){let r=p(t,e?.in);return r.setDate(1),r.setHours(0,0,0,0),r}i(Et,"startOfMonth");var x6=Et;function zu(t,e){let r=Et(t,e),o=Nr(t,e);return Fr({start:r,end:o},e)}i(zu,"eachWeekendOfMonth");var D6=zu;function pi(t,e){let r=p(t,e?.in),o=r.getFullYear();return r.setFullYear(o+1,0,0),r.setHours(23,59,59,999),r}i(pi,"endOfYear");var O6=pi;function Wr(t,e){let r=p(t,e?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}i(Wr,"startOfYear");var C6=Wr;function Vu(t,e){let r=Wr(t,e),o=pi(t,e);return Fr({start:r,end:o},e)}i(Vu,"eachWeekendOfYear");var L6=Vu;function Gu(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(Gu,"eachYearOfInterval");var q6=Gu;function Ju(t,e){let r=p(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(Ju,"endOfDecade");var V6=Ju;function Qu(t,e){let r=p(t,e?.in);return r.setMinutes(59,59,999),r}i(Qu,"endOfHour");var K6=Qu;function mi(t,e){let r=U(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,n=p(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(mi,"endOfWeek");var t4=mi;function Ku(t,e){return mi(t,{...e,weekStartsOn:1})}i(Ku,"endOfISOWeek");var i4=Ku;function Xu(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(Xu,"endOfISOWeekYear");var l4=Xu;function Zu(t,e){let r=p(t,e?.in);return r.setSeconds(59,999),r}i(Zu,"endOfMinute");var h4=Zu;function Au(t,e){let r=p(t,e?.in),o=r.getMonth(),n=o-o%3+3;return r.setMonth(n,0),r.setHours(23,59,59,999),r}i(Au,"endOfQuarter");var g4=Au;function ef(t,e){let r=p(t,e?.in);return r.setMilliseconds(999),r}i(ef,"endOfSecond");var D4=ef;function tf(t){return _r(Date.now(),t)}i(tf,"endOfToday");var O4=tf;function rf(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(rf,"endOfTomorrow");var C4=rf;function of(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(of,"endOfYesterday");var W4=of;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"}},nf=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 qx={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},$x={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}}"},sf={date:hi({formats:qx,defaultWidth:"full"}),time:hi({formats:$x,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"},af=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"),cf={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 uf(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(uf,"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}},ff={ordinalNumber:uf({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 Ee={code:"en-US",formatDistance:nf,formatLong:sf,formatRelative:af,localize:cf,match:ff,options:{weekStartsOn:0,firstWeekContainsDate:1}},lU=Ee;function yi(t,e){let r=p(t,e?.in);return ne(r,Wr(r))+1}i(yi,"getDayOfYear");var wU=yi;function Hr(t,e){let r=p(t,e?.in),o=+A(r)-+ke(r);return Math.round(o/Ke)+1}i(Hr,"getISOWeek");var MU=Hr;function Ot(t,e){let r=p(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=q(a,e),u=x(e?.in||t,0);u.setFullYear(o,0,s),u.setHours(0,0,0,0);let f=q(u,e);return+r>=+c?o+1:+r>=+f?o:o-1}i(Ot,"getWeekYear");var RU=Ot;function rr(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),q(s,e)}i(rr,"startOfWeekYear");var HU=rr;function Yr(t,e){let r=p(t,e?.in),o=+q(r,e)-+rr(r,e);return Math.round(o/Ke)+1}i(Yr,"getWeek");var VU=Yr;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=Yr(t,o);return e==="wo"?r.ordinalNumber(n,{unit:"week"}):M(n,e.length)},"w"),I:i(function(t,e,r){let o=Hr(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 df(o);case"XXXX":case"XX":return or(o);default:return or(o,":")}},"X"),x:i(function(t,e,r){let o=t.getTimezoneOffset();switch(e){case"x":return df(o);case"xxxx":case"xx":return or(o);default:return or(o,":")}},"x"),O:i(function(t,e,r){let o=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+lf(o,":");default:return"GMT"+or(o,":")}},"O"),z:i(function(t,e,r){let o=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+lf(o,":");default:return"GMT"+or(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 lf(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(lf,"formatTimezoneShort");function df(t,e){return t%60===0?(t>0?"-":"+")+M(Math.abs(t)/60,2):or(t,e)}i(df,"formatTimezoneWithOptionalMinutes");function or(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(or,"formatTimezone");var pf=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"),pw=i((t,e)=>{let r=t.match(/(P+)(p+)?/)||[],o=r[1],n=r[2];if(!n)return pf(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}}",pf(o,e)).replace("{{time}}",mf(n,e))},"dateTimeLongFormatter"),kt={p:mf,P:pw};var mw=/^D+$/,hw=/^Y+$/,yw=["D","DD","YY","YYYY"];function xi(t){return mw.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??Ee,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=p(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 m=kt[d];return m(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 m=ko[d[0]];return m(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 gH=Po;function gi(t,e,r){let o=U(),n=r?.locale??o.locale??Ee,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]=E(r?.in,...a>0?[e,t]:[t,e]),l=tt(f,u),d=(J(f)-J(u))/1e3,m=Math.round((l-d)/60),h;if(m<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):m===0?n.formatDistance("lessThanXMinutes",1,c):n.formatDistance("xMinutes",m,c);if(m<45)return n.formatDistance("xMinutes",m,c);if(m<90)return n.formatDistance("aboutXHours",1,c);if(m<Er){let y=Math.round(m/60);return n.formatDistance("aboutXHours",y,c)}else{if(m<s)return n.formatDistance("xDays",1,c);if(m<bt){let y=Math.round(m/Er);return n.formatDistance("xDays",y,c)}else if(m<bt*2)return h=Math.round(m/bt),n.formatDistance("aboutXMonths",h,c)}if(h=Mt(f,u),h<12){let y=Math.round(m/bt);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 PH=gi;function bi(t,e,r){let o=U(),n=r?.locale??o.locale??Ee,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]=E(r?.in,...s>0?[e,t]:[t,e]),f=pe(r?.roundingMethod??"round"),l=u.getTime()-c.getTime(),d=l/le,m=J(u)-J(c),h=(l-m)/le,y=r?.unit,w;if(y?w=y:d<1?w="second":d<60?w="minute":d<Er?w="hour":h<bt?w="day":h<Va?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/Er);return n.formatDistance("xDays",g,a)}else if(w==="month"){let g=f(h/bt);return g===12&&y!=="month"?n.formatDistance("xYears",1,a):n.formatDistance("xMonths",g,a)}else{let g=f(h/Va);return n.formatDistance("xYears",g,a)}}i(bi,"formatDistanceStrict");var YH=bi;function hf(t,e){return gi(t,N(t),e)}i(hf,"formatDistanceToNow");var zH=hf;function yf(t,e){return bi(t,N(t),e)}i(yf,"formatDistanceToNowStrict");var KH=yf;var Sw=["years","months","weeks","days","hours","minutes","seconds"];function xf(t,e){let r=U(),o=e?.locale??r.locale??Ee,n=e?.format??Sw,s=e?.zero??!1,a=e?.delimiter??" ";return o.formatDistance?n.reduce((u,f)=>{let l=`x${f.replace(/(^.)/,m=>m.toUpperCase())}`,d=t[f];return d!==void 0&&(s||t[f])?u.concat(o.formatDistance(l,d)):u},[]).join(a):""}i(xf,"formatDuration");var tY=xf;function wf(t,e){let r=p(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),m=M(r.getSeconds(),2),h=s===""?"":"T",y=[l,d,m].join(u);s=`${s}${h}${y}${a}`}return s}i(wf,"formatISO");var sY=wf;function gf(t,e){let r=p(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(gf,"formatISO9075");var dY=gf;function bf(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(bf,"formatISODuration");var hY=bf;function vf(t,e){let r=p(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="",m=r.getTimezoneOffset();if(m!==0){let h=Math.abs(m),y=M(Math.trunc(h/60),2),w=M(h%60,2);d=`${m<0?"+":"-"}${y}:${w}`}else d="Z";return`${a}-${s}-${n}T${c}:${u}:${f}${l}${d}`}i(vf,"formatRFC3339");var vY=vf;var Mw=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Ew=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Tf(t){let e=p(t);if(!ae(e))throw new RangeError("Invalid time value");let r=Mw[e.getUTCDay()],o=M(e.getUTCDate(),2),n=Ew[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(Tf,"formatRFC7231");var OY=Tf;function Df(t,e,r){let[o,n]=E(r?.in,t,e),s=U(),a=r?.locale??s.locale??Ee,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(Df,"formatRelative");var FY=Df;function Sf(t,e){return p(t*1e3,e?.in)}i(Sf,"fromUnixTime");var HY=Sf;function vi(t,e){return p(t,e?.in).getDate()}i(vi,"getDate");var $Y=vi;function It(t,e){return p(t,e?.in).getDay()}i(It,"getDay");var GY=It;function Ti(t,e){let r=p(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 ZY=Ti;function Di(t,e){let o=p(t,e?.in).getFullYear();return o%400===0||o%4===0&&o%100!==0}i(Di,"isLeapYear");var rj=Di;function Mf(t,e){let r=p(t,e?.in);return Number.isNaN(+r)?NaN:Di(r)?366:365}i(Mf,"getDaysInYear");var aj=Mf;function Ef(t,e){let o=p(t,e?.in).getFullYear();return Math.floor(o/10)*10}i(Ef,"getDecade");var lj=Ef;function Si(){return Object.assign({},U())}i(Si,"getDefaultOptions");var hj=Si;function Of(t,e){return p(t,e?.in).getHours()}i(Of,"getHours");var gj=Of;function Mi(t,e){let r=p(t,e?.in).getDay();return r===0?7:r}i(Mi,"getISODay");var Dj=Mi;function kf(t,e){let r=ke(t,e),n=+ke(Dt(r,60))-+r;return Math.round(n/Ke)}i(kf,"getISOWeeksInYear");var Ij=kf;function If(t){return p(t).getMilliseconds()}i(If,"getMilliseconds");var _j=If;function Pf(t,e){return p(t,e?.in).getMinutes()}i(Pf,"getMinutes");var Lj=Pf;function Cf(t,e){return p(t,e?.in).getMonth()}i(Cf,"getMonth");var jj=Cf;function Rf(t,e){let[r,o]=[+p(t.start),+p(t.end)].sort((d,m)=>d-m),[n,s]=[+p(e.start),+p(e.end)].sort((d,m)=>d-m);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(Rf,"getOverlappingDaysInIntervals");var Gj=Rf;function _f(t){return p(t).getSeconds()}i(_f,"getSeconds");var Xj=_f;function Nf(t){return+p(t)}i(Nf,"getTime");var tq=Nf;function Ff(t){return Math.trunc(+p(t)/1e3)}i(Ff,"getUnixTime");var iq=Ff;function Wf(t,e){let r=U(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,n=vi(p(t,e?.in));if(isNaN(n))return NaN;let s=It(Et(t,e)),a=o-s;a<=0&&(a+=7);let c=n-a;return Math.ceil(c/7)+1}i(Wf,"getWeekOfMonth");var pq=Wf;function Ei(t,e){let r=p(t,e?.in),o=r.getMonth();return r.setFullYear(r.getFullYear(),o+1,0),r.setHours(0,0,0,0),p(r,e?.in)}i(Ei,"lastDayOfMonth");var xq=Ei;function Lf(t,e){let r=p(t,e?.in);return At(Ei(r,e),Et(r,e),e)+1}i(Lf,"getWeeksInMonth");var Sq=Lf;function Uf(t,e){return p(t,e?.in).getFullYear()}i(Uf,"getYear");var kq=Uf;function Hf(t){return Math.trunc(t*Oe)}i(Hf,"hoursToMilliseconds");var Rq=Hf;function Yf(t){return Math.trunc(t*Vn)}i(Yf,"hoursToMinutes");var Wq=Yf;function jf(t){return Math.trunc(t*Xt)}i(jf,"hoursToSeconds");var Yq=jf;function qf(t,e,r){let[o,n]=E(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(qf,"interval");var Bq=qf;function $f(t,e){let{start:r,end:o}=ie(e?.in,t),n={},s=li(o,r);s&&(n.years=s);let a=vt(r,{years:n.years}),c=Mt(o,a);c&&(n.months=c);let u=vt(a,{months:n.months}),f=Cr(o,u);f&&(n.days=f);let l=vt(u,{days:n.days}),d=er(o,l);d&&(n.hours=d);let m=vt(l,{hours:n.hours}),h=tr(o,m);h&&(n.minutes=h);let y=vt(m,{minutes:n.minutes}),w=tt(o,y);return w&&(n.seconds=w),n}i($f,"intervalToDuration");var t$=$f;function Bf(t,e,r){let o;return Ow(e)?o=e:r=e,new Intl.DateTimeFormat(r?.locale,o).format(p(t))}i(Bf,"intlFormat");function Ow(t){return t!==void 0&&!("locale"in t)}i(Ow,"isFormatOptions");var i$=Bf;function zf(t,e,r){let o=0,n,[s,a]=E(r?.in,t,e);if(r?.unit)n=r?.unit,n==="second"?o=tt(s,a):n==="minute"?o=tr(s,a):n==="hour"?o=er(s,a):n==="day"?o=ne(s,a):n==="week"?o=At(s,a):n==="month"?o=Zt(s,a):n==="quarter"?o=Pr(s,a):n==="year"&&(o=St(s,a));else{let u=tt(s,a);Math.abs(u)<Or?(o=tt(s,a),n="second"):Math.abs(u)<Xt?(o=tr(s,a),n="minute"):Math.abs(u)<$n&&Math.abs(ne(s,a))<1?(o=er(s,a),n="hour"):Math.abs(u)<Mu&&(o=ne(s,a))&&Math.abs(o)<7?n="day":Math.abs(u)<Ja?(o=At(s,a),n="week"):Math.abs(u)<Eu?(o=Zt(s,a),n="month"):Math.abs(u)<Ga?Pr(s,a)<4?(o=Pr(s,a),n="quarter"):(o=St(s,a),n="year"):(o=St(s,a),n="year")}return new Intl.RelativeTimeFormat(r?.locale,{numeric:"auto",...r}).format(o,n)}i(zf,"intlFormatDistance");var w$=zf;function Vf(t,e){return+p(t)>+p(e)}i(Vf,"isAfter");var T$=Vf;function Gf(t,e){return+p(t)<+p(e)}i(Gf,"isBefore");var E$=Gf;function Jf(t,e){return+p(t)==+p(e)}i(Jf,"isEqual");var P$=Jf;function Qf(t,e,r){let o=new Date(t,e,r);return o.getFullYear()===t&&o.getMonth()===e&&o.getDate()===r}i(Qf,"isExists");var _$=Qf;function Kf(t,e){return p(t,e?.in).getDate()===1}i(Kf,"isFirstDayOfMonth");var L$=Kf;function Xf(t,e){return p(t,e?.in).getDay()===5}i(Xf,"isFriday");var j$=Xf;function Zf(t){return+p(t)>Date.now()}i(Zf,"isFuture");var z$=Zf;function Oi(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(Oi,"transpose");function kw(t){return typeof t=="function"&&t.prototype?.constructor===t}i(kw,"isConstructor");var Q$=Oi;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,Oi(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 Y(t,e){return t&&{value:e(t.value),rest:t.rest}}i(Y,"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*Oe+s*le+a*Mr),rest:e.slice(r[0].length)}}i(Ue,"parseTimezonePattern");function Ri(t){return W(L.anyDigitsSigned,t)}i(Ri,"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 qr(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(qr,"parseNDigitsSigned");function $r(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}i($r,"dayPeriodEnumToHours");function _i(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(_i,"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 Y(P(4,e),n);case"yo":return Y(o.ordinalNumber(e,{unit:"year"}),n);default:return Y(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=_i(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 Y(P(4,e),n);case"Yo":return Y(o.ordinalNumber(e,{unit:"year"}),n);default:return Y(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=_i(o.year,s);return e.setFullYear(c,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),q(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),q(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"?qr(4,e):qr(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"?qr(4,e):qr(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 Hi=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 Yi=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 Y(W(L.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,r){return r>=0&&r<=11}set(e,r,o){return e.setMonth(o,1),e.setHours(0,0,0,0),e}};var qi=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 Y(W(L.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,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 $i(t,e,r){let o=p(t,r?.in),n=Yr(o,r)-e;return o.setDate(o.getDate()-n*7),p(o,r?.in)}i($i,"setWeek");var A8=$i;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 q($i(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=p(t,r?.in),n=Hr(o,r)-e;return o.setDate(o.getDate()-n*7),o}i(zi,"setISOWeek");var l5=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 Pt(t,e,r){let o=U(),n=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,s=p(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(Pt,"setDay");var N5=Pt;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=Pt(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 Y(P(r.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,r){return r>=0&&r<=6}set(e,r,o,n){return e=Pt(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 Y(P(r.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,r){return r>=0&&r<=6}set(e,r,o,n){return e=Pt(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=p(t,r?.in),n=Mi(o,r),s=e-n;return re(o,s,r)}i(Zi,"setISODay");var eB=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 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,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($r(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($r(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($r(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 Y(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 Ri(e)}set(e,r,o){return[x(e,o*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"};var ps=class extends S{static{i(this,"TimestampMillisecondsParser")}priority=20;parse(e){return Ri(e)}set(e,r,o){return[x(e,o),{timestampIsSet:!0}]}incompatibleTokens="*"};var ms={G:new Ci,y:new Fi,Y:new Wi,R:new Li,u:new Ui,Q:new Hi,q:new Yi,M:new ji,L:new qi,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 ps};var Rw=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,_w=/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??Ee,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():p(r,o?.in);let f={firstWeekContainsDate:c,weekStartsOn:u,locale:a},l=[new Pi(o?.in,r)],d=e.match(_w).map(g=>{let v=g[0];if(v in kt){let G=kt[v];return G(g,a.formatLong)}return g}).join("").match(Rw),m=[];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=ms[v];if(G){let{incompatibleTokens:ee}=G;if(Array.isArray(ee)){let Ce=m.find(Re=>ee.includes(Re.token)||Re.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==="*"&&m.length>0)throw new RangeError(`The format string mustn't contain \`${g}\` and any other token at the same time`);m.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=p(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 f9=hs;function Af(t,e,r){return ae(hs(t,e,new Date,r))}i(Af,"isMatch");var h9=Af;function el(t,e){return p(t,e?.in).getDay()===1}i(el,"isMonday");var g9=el;function tl(t){return+p(t)<Date.now()}i(tl,"isPast");var D9=tl;function Co(t,e){let r=p(t,e?.in);return r.setMinutes(0,0,0),r}i(Co,"startOfHour");var O9=Co;function ys(t,e,r){let[o,n]=E(r?.in,t,e);return+Co(o)==+Co(n)}i(ys,"isSameHour");var R9=ys;function Br(t,e,r){let[o,n]=E(r?.in,t,e);return+q(o,r)==+q(n,r)}i(Br,"isSameWeek");var L9=Br;function xs(t,e,r){return Br(t,e,{...r,weekStartsOn:1})}i(xs,"isSameISOWeek");var j9=xs;function rl(t,e,r){let[o,n]=E(r?.in,t,e);return+ke(o)==+ke(n)}i(rl,"isSameISOWeekYear");var V9=rl;function Ro(t,e){let r=p(t,e?.in);return r.setSeconds(0,0),r}i(Ro,"startOfMinute");var K9=Ro;function ws(t,e){return+Ro(t)==+Ro(e)}i(ws,"isSameMinute");var eV=ws;function gs(t,e,r){let[o,n]=E(r?.in,t,e);return o.getFullYear()===n.getFullYear()&&o.getMonth()===n.getMonth()}i(gs,"isSameMonth");var nV=gs;function bs(t,e,r){let[o,n]=E(r?.in,t,e);return+rt(o)==+rt(n)}i(bs,"isSameQuarter");var uV=bs;function _o(t,e){let r=p(t,e?.in);return r.setMilliseconds(0),r}i(_o,"startOfSecond");var pV=_o;function vs(t,e){return+_o(t)==+_o(e)}i(vs,"isSameSecond");var xV=vs;function Ts(t,e,r){let[o,n]=E(r?.in,t,e);return o.getFullYear()===n.getFullYear()}i(Ts,"isSameYear");var vV=Ts;function ol(t,e){return ys(p(t,e?.in),N(e?.in||t))}i(ol,"isThisHour");var OV=ol;function nl(t,e){return xs(x(e?.in||t,t),N(e?.in||t))}i(nl,"isThisISOWeek");var _V=nl;function il(t){return ws(t,N(t))}i(il,"isThisMinute");var UV=il;function sl(t,e){return gs(x(e?.in||t,t),N(e?.in||t))}i(sl,"isThisMonth");var BV=sl;function al(t,e){return bs(x(e?.in||t,t),N(e?.in||t))}i(al,"isThisQuarter");var KV=al;function cl(t){return vs(t,N(t))}i(cl,"isThisSecond");var t7=cl;function ul(t,e){return Br(x(e?.in||t,t),N(e?.in||t),e)}i(ul,"isThisWeek");var a7=ul;function fl(t,e){return Ts(x(e?.in||t,t),N(e?.in||t))}i(fl,"isThisYear");var p7=fl;function ll(t,e){return p(t,e?.in).getDay()===4}i(ll,"isThursday");var x7=ll;function dl(t,e){return et(x(e?.in||t,t),N(e?.in||t))}i(dl,"isToday");var D7=dl;function pl(t,e){return et(t,re(N(e?.in||t),1),e)}i(pl,"isTomorrow");var I7=pl;function ml(t,e){return p(t,e?.in).getDay()===2}i(ml,"isTuesday");var _7=ml;function hl(t,e){return p(t,e?.in).getDay()===3}i(hl,"isWednesday");var L7=hl;function yl(t,e,r){let o=+p(t,r?.in),[n,s]=[+p(e.start,r?.in),+p(e.end,r?.in)].sort((a,c)=>a-c);return o>=n&&o<=s}i(yl,"isWithinInterval");var j7=yl;function Ct(t,e,r){return re(t,-e,r)}i(Ct,"subDays");var z7=Ct;function xl(t,e){return et(x(e?.in||t,t),Ct(N(e?.in||t),1))}i(xl,"isYesterday");var Z7=xl;function wl(t,e){let r=p(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),p(r,e?.in)}i(wl,"lastDayOfDecade");var rG=wl;function Ds(t,e){let r=U(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,n=p(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 aG=Ds;function gl(t,e){return Ds(t,{...e,weekStartsOn:1})}i(gl,"lastDayOfISOWeek");var lG=gl;function bl(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(bl,"lastDayOfISOWeekYear");var xG=bl;function vl(t,e){let r=p(t,e?.in),o=r.getMonth(),n=o-o%3+3;return r.setMonth(n,0),r.setHours(0,0,0,0),r}i(vl,"lastDayOfQuarter");var vG=vl;function Tl(t,e){let r=p(t,e?.in),o=r.getFullYear();return r.setFullYear(o+1,0,0),r.setHours(0,0,0,0),r}i(Tl,"lastDayOfYear");var MG=Tl;var Hw=/(\w)\1*|''|'(''|[^'])+('|$)|./g,Yw=/^'([^]*?)'?$/,jw=/''/g,qw=/[a-zA-Z]/;function Dl(t,e){let r=p(t);if(!ae(r))throw new RangeError("Invalid time value");let o=e.match(Hw);return o?o.map(s=>{if(s==="''")return"'";let a=s[0];if(a==="'")return $w(s);let c=Ie[a];if(c)return c(r,s);if(a.match(qw))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return s}).join(""):""}i(Dl,"lightFormat");function $w(t){let e=t.match(Yw);return e?e[1].replace(jw,"'"):t}i($w,"cleanEscapedString");var CG=Dl;function Sl({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(Sl,"milliseconds");var FG=Sl;function Ml(t){let e=t/Oe;return Math.trunc(e)}i(Ml,"millisecondsToHours");var HG=Ml;function El(t){let e=t/le;return Math.trunc(e)}i(El,"millisecondsToMinutes");var $G=El;function Ol(t){let e=t/Mr;return Math.trunc(e)}i(Ol,"millisecondsToSeconds");var GG=Ol;function kl(t){let e=t/Vn;return Math.trunc(e)}i(kl,"minutesToHours");var XG=kl;function Il(t){return Math.trunc(t*le)}i(Il,"minutesToMilliseconds");var tJ=Il;function Pl(t){return Math.trunc(t*Or)}i(Pl,"minutesToSeconds");var iJ=Pl;function Cl(t){let e=t/Gn;return Math.trunc(e)}i(Cl,"monthsToQuarters");var uJ=Cl;function Rl(t){let e=t/Jn;return Math.trunc(e)}i(Rl,"monthsToYears");var pJ=Rl;function me(t,e,r){let o=e-It(t,r);return o<=0&&(o+=7),re(t,o,r)}i(me,"nextDay");var wJ=me;function _l(t,e){return me(t,5,e)}i(_l,"nextFriday");var TJ=_l;function Nl(t,e){return me(t,1,e)}i(Nl,"nextMonday");var EJ=Nl;function Fl(t,e){return me(t,6,e)}i(Fl,"nextSaturday");var PJ=Fl;function Wl(t,e){return me(t,0,e)}i(Wl,"nextSunday");var NJ=Wl;function Ll(t,e){return me(t,4,e)}i(Ll,"nextThursday");var UJ=Ll;function Ul(t,e){return me(t,2,e)}i(Ul,"nextTuesday");var qJ=Ul;function Hl(t,e){return me(t,3,e)}i(Hl,"nextWednesday");var VJ=Hl;function jl(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=p(0,e?.in);return l.setFullYear(f.getUTCFullYear(),f.getUTCMonth(),f.getUTCDate()),l.setHours(f.getUTCHours(),f.getUTCMinutes(),f.getUTCSeconds(),f.getUTCMilliseconds()),l}return p(a+c+u,e?.in)}i(jl,"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=Ka(e[1]),o=Ka(e[2]),n=Ka(e[3]);return o0(r,o,n)?r*Oe+o*le+n*1e3:NaN}i(Kw,"parseTime");function Ka(t){return t&&parseFloat(t.replace(",","."))||0}i(Ka,"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*Oe+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 ZJ=jl;function ql(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?p(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):p(NaN,e?.in)}i(ql,"parseJSON");var rQ=ql;function he(t,e,r){let o=It(t,r)-e;return o<=0&&(o+=7),Ct(t,o,r)}i(he,"previousDay");var aQ=he;function $l(t,e){return he(t,5,e)}i($l,"previousFriday");var lQ=$l;function Bl(t,e){return he(t,1,e)}i(Bl,"previousMonday");var hQ=Bl;function zl(t,e){return he(t,6,e)}i(zl,"previousSaturday");var gQ=zl;function Vl(t,e){return he(t,0,e)}i(Vl,"previousSunday");var DQ=Vl;function Gl(t,e){return he(t,4,e)}i(Gl,"previousThursday");var OQ=Gl;function Jl(t,e){return he(t,2,e)}i(Jl,"previousTuesday");var CQ=Jl;function Ql(t,e){return he(t,3,e)}i(Ql,"previousWednesday");var FQ=Ql;function Kl(t){return Math.trunc(t*Gn)}i(Kl,"quartersToMonths");var HQ=Kl;function Xl(t){let e=t/Qn;return Math.trunc(e)}i(Xl,"quartersToYears");var $Q=Xl;function Zl(t,e){let r=e?.nearestTo??1;if(r<1||r>12)return x(e?.in||t,NaN);let o=p(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=pe(u)(c/r)*r;return o.setHours(l,0,0,0),o}i(Zl,"roundToNearestHours");var QQ=Zl;function Al(t,e){let r=e?.nearestTo??1;if(r<1||r>30)return x(t,NaN);let o=p(t,e?.in),n=o.getSeconds()/60,s=o.getMilliseconds()/1e3/60,a=o.getMinutes()+n+s,c=e?.roundingMethod??"round",f=pe(c)(a/r)*r;return o.setMinutes(f,0,0),o}i(Al,"roundToNearestMinutes");var tK=Al;function ed(t){let e=t/Xt;return Math.trunc(e)}i(ed,"secondsToHours");var iK=ed;function td(t){return t*Mr}i(td,"secondsToMilliseconds");var uK=td;function rd(t){let e=t/Or;return Math.trunc(e)}i(rd,"secondsToMinutes");var pK=rd;function zr(t,e,r){let o=p(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 gK=zr;function od(t,e,r){let o=p(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(od,"set");var MK=od;function nd(t,e,r){let o=p(t,r?.in);return o.setDate(e),o}i(nd,"setDate");var IK=nd;function id(t,e,r){let o=p(t,r?.in);return o.setMonth(0),o.setDate(e),o}i(id,"setDayOfYear");var _K=id;function sd(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]);ku(e)}i(sd,"setDefaultOptions");var LK=sd;function ad(t,e,r){let o=p(t,r?.in);return o.setHours(e),o}i(ad,"setHours");var jK=ad;function cd(t,e,r){let o=p(t,r?.in);return o.setMilliseconds(e),o}i(cd,"setMilliseconds");var zK=cd;function ud(t,e,r){let o=p(t,r?.in);return o.setMinutes(e),o}i(ud,"setMinutes");var QK=ud;function fd(t,e,r){let o=p(t,r?.in),n=Math.trunc(o.getMonth()/3)+1,s=e-n;return zr(o,o.getMonth()+s*3)}i(fd,"setQuarter");var eX=fd;function ld(t,e,r){let o=p(t,r?.in);return o.setSeconds(e),o}i(ld,"setSeconds");var nX=ld;function dd(t,e,r){let o=U(),n=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,s=ne(p(t,r?.in),rr(t,r),r),a=x(r?.in||t,0);a.setFullYear(e,0,n),a.setHours(0,0,0,0);let c=rr(a,r);return c.setDate(c.getDate()+s),c}i(dd,"setWeekYear");var dX=dd;function pd(t,e,r){let o=p(t,r?.in);return isNaN(+o)?x(r?.in||t,NaN):(o.setFullYear(e),o)}i(pd,"setYear");var xX=pd;function md(t,e){let r=p(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 vX=md;function hd(t){return Ae(Date.now(),t)}i(hd,"startOfToday");var MX=hd;function yd(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(yd,"startOfTomorrow");var PX=yd;function xd(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(xd,"startOfYesterday");var NX=xd;function Ms(t,e,r){return Xe(t,-e,r)}i(Ms,"subMonths");var UX=Ms;function wd(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=Ct(l,a+s*7,r),m=u+c*60,y=(f+m*60)*1e3;return x(r?.in||t,+d-y)}i(wd,"sub");var BX=wd;function gd(t,e,r){return Zn(t,-e,r)}i(gd,"subBusinessDays");var JX=gd;function bd(t,e,r){return An(t,-e,r)}i(bd,"subHours");var ZX=bd;function vd(t,e,r){return Tt(t,-e,r)}i(vd,"subMilliseconds");var rZ=vd;function Td(t,e,r){return kr(t,-e,r)}i(Td,"subMinutes");var sZ=Td;function Dd(t,e,r){return Ir(t,-e,r)}i(Dd,"subQuarters");var fZ=Dd;function Sd(t,e,r){return ri(t,-e,r)}i(Sd,"subSeconds");var mZ=Sd;function Md(t,e,r){return Dt(t,-e,r)}i(Md,"subWeeks");var wZ=Md;function Ed(t,e,r){return oi(t,-e,r)}i(Ed,"subYears");var TZ=Ed;function Od(t){return Math.trunc(t*7)}i(Od,"weeksToDays");var EZ=Od;function kd(t){return Math.trunc(t*365.2425)}i(kd,"yearsToDays");var PZ=kd;function Id(t){return Math.trunc(t*Jn)}i(Id,"yearsToMonths");var NZ=Id;function Pd(t){return Math.trunc(t*Qn)}i(Pd,"yearsToQuarters");var UZ=Pd;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 tc(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(tc,"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 m=Math.floor(l*10**d+u0);return(Math.round(m)/10**d).toFixed(d)},"floorDecimals"),a=i((l,d,m,h)=>{if(!((n.length===0||!e.colonNotation)&&a0(l)&&!(e.colonNotation&&m==="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):m;n.push(h)}},"add"),c=tc(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),m=Number(c.microseconds),h=Number(c.nanoseconds);if(a(l,"second","s"),e.formatSubMilliseconds)a(d,"millisecond","ms"),a(m,"microsecond","\xB5s"),a(h,"nanosecond","ns");else{let y=d+m/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,m=s(l,d),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(Wo,"prettyMilliseconds");var nr=fn(Cd(),1),Nd=fn(Rd(),1);nr.default.extend(Nd.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 rc=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 Rt={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")},oc=i(t=>{let e=0,r=i(o=>{e=e+o},"addMilliSeconds");return t.years&&r(Rt.years(t.years)),t.months&&r(Rt.months(t.months)),t.weeks&&r(Rt.weeks(t.weeks)),t.days&&r(Rt.days(t.days)),t.hours&&r(Rt.hours(t.hours)),t.minutes&&r(Rt.minutes(t.minutes)),t.seconds&&r(Rt.seconds(t.seconds)),e},"getMilliSecondsFromUnits"),l0=i(t=>Wo(t),"getMilliSecondsAsHumanReadableString"),d0=i(t=>Fo.formatDistanceToNow(new Date(t)),"getMilliSecondsAsHumanReadableAgoTime");var nc=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=nr.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 nr.default(this.getTime()).format(e)}isToday(){return nr.default(this.getTime()).isToday()}lessTimePassedToNow(e){let r=oc(e);return Date.now()-this.getTime()<r}moreTimePassedToNow(e){return!this.lessTimePassedToNow(e)}};var ic=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 sc=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 ac=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 Os=fn(zd(),1);var uc=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 fc=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 Ho=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 Vd=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"),sr=class t{static{i(this,"ObjectMap")}fastMap=new Ho;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=Vd("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 Yo=class{static{i(this,"Interest")}options;interestMapRef;originalInterest;comparisonFunc;destructionTimer=new ir.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 lc=class{static{i(this,"InterestMap")}options;interestObjectMap=new sr;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 Yo(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 dc=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 pc=class{static{i(this,"LoopTracker")}referenceObjectMap=new sr;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 po.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 ir.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 hc=class{static{i(this,"Tree")}symbolTree;constructor(){this.symbolTree=new Os.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 ar={};H(ar,{base64ToUint8Array:()=>L0,ensurePureUint8Array:()=>Y0,isBufferLike:()=>H0,isUint8Array:()=>U0,uInt8ArrayExtras:()=>F0,uInt8ArrayToBase64:()=>W0});var Lt={};H(Lt,{areUint8ArraysEqual:()=>T0,assertUint8Array:()=>Wt,assertUint8ArrayOrArrayBuffer:()=>Xd,base64ToString:()=>k0,base64ToUint8Array:()=>tp,compareUint8Arrays:()=>D0,concatUint8Arrays:()=>v0,getUintBE:()=>R0,hexToUint8Array:()=>C0,includes:()=>_0,indexOf:()=>rp,isUint8Array:()=>yc,stringToBase64:()=>O0,stringToUint8Array:()=>Ad,toUint8Array:()=>b0,uint8ArrayToBase64:()=>ep,uint8ArrayToHex:()=>P0,uint8ArrayToString:()=>Zd});var h0=Object.prototype.toString,y0="[object Uint8Array]",x0="[object ArrayBuffer]";function Gd(t,e,r){return t?t.constructor===e?!0:h0.call(t)===r:!1}i(Gd,"isType");function yc(t){return Gd(t,Uint8Array,y0)}i(yc,"isUint8Array");function w0(t){return Gd(t,ArrayBuffer,x0)}i(w0,"isArrayBuffer");function g0(t){return yc(t)||w0(t)}i(g0,"isUint8ArrayOrArrayBuffer");function Wt(t){if(!yc(t))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof t}\``)}i(Wt,"assertUint8Array");function Xd(t){if(!g0(t))throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``)}i(Xd,"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)Wt(n),r.set(n,o),o+=n.length;return r}i(v0,"concatUint8Arrays");function T0(t,e){if(Wt(t),Wt(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){Wt(t),Wt(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 Jd={utf8:new globalThis.TextDecoder("utf8")};function Zd(t,e="utf8"){return Xd(t),Jd[e]??=new globalThis.TextDecoder(e),Jd[e].decode(t)}i(Zd,"uint8ArrayToString");function qo(t){if(typeof t!="string")throw new TypeError(`Expected \`string\`, got \`${typeof t}\``)}i(qo,"assertString");var S0=new globalThis.TextEncoder;function Ad(t){return qo(t),S0.encode(t)}i(Ad,"stringToUint8Array");function M0(t){return t.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}i(M0,"base64ToBase64Url");function E0(t){let e=t.replaceAll("-","+").replaceAll("_","/"),r=(4-e.length%4)%4;return e+"=".repeat(r)}i(E0,"base64UrlToBase64");var Qd=65535;function ep(t,{urlSafe:e=!1}={}){Wt(t);let r="";for(let o=0;o<t.length;o+=Qd){let n=t.subarray(o,o+Qd);r+=globalThis.btoa(String.fromCodePoint.apply(void 0,n))}return e?M0(r):r}i(ep,"uint8ArrayToBase64");function tp(t){return qo(t),Uint8Array.from(globalThis.atob(E0(t)),e=>e.codePointAt(0))}i(tp,"base64ToUint8Array");function O0(t,{urlSafe:e=!1}={}){return qo(t),ep(Ad(t),{urlSafe:e})}i(O0,"stringToBase64");function k0(t){return qo(t),Zd(tp(t))}i(k0,"base64ToString");var I0=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function P0(t){Wt(t);let e="";for(let r=0;r<t.length;r++)e+=I0[t[r]];return e}i(P0,"uint8ArrayToHex");var Kd={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(qo(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=Kd[t[o*2]],s=Kd[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 R0(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(R0,"getUintBE");function rp(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(rp,"indexOf");function _0(t,e){return rp(t,e)!==-1}i(_0,"includes");var F0=Lt;function W0(t){return Lt.uint8ArrayToBase64(t)}i(W0,"uInt8ArrayToBase64");function L0(t){return Lt.base64ToUint8Array(t)}i(L0,"base64ToUint8Array");var U0=i(t=>Lt.isUint8Array(t),"isUint8Array");function H0(t){return t&&typeof t.byteLength=="number"?!0:typeof Buffer<"u"&&Buffer.isBuffer?Buffer.isBuffer(t):!1}i(H0,"isBufferLike");function Y0(t){let e=new Uint8Array(t.length);return e.set(t),e}i(Y0,"ensurePureUint8Array");var Go={};H(Go,{Guard:()=>Bo,GuardError:()=>zo,GuardSet:()=>Vo,passGuardsOrReject:()=>J0});var $o={};H($o,{CumulativeDeferred:()=>Is,Deferred:()=>ks,cumulativeDefer:()=>j0,defer:()=>Qr,fromCallback:()=>G0,getFirstTrueOrFalse:()=>V0,map:()=>B0,rejectedPromise:()=>$0,resolvedPromise:()=>q0,timeoutAndContinue:()=>z0,timeoutWrap:()=>op});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 q0(t){return Promise.resolve(t)}i(q0,"resolvedPromise");var $0=i(t=>Promise.reject(t),"rejectedPromise"),B0=i(async(t,e)=>Promise.all(t.map(e)),"map"),op=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)=>op(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 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(`
5
+ `)}},"passGuardsOrReject");var nn={};H(nn,{HttpCache:()=>Xs});var tn={};H(tn,{TypedrequestCache:()=>_c,WebStore:()=>en});var cr={};H(cr,{Smartenv:()=>xc,getBrowserPlatformFromUserAgent:()=>np});var np=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"],xc=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":np(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={};H(Ao,{Smartjson:()=>Rc,deepEqualJsonLStrings:()=>rb,deepEqualObjects:()=>Hp,foldDec:()=>tb,parse:()=>$s,parseBase64:()=>eb,parseJsonL:()=>Cc,stableOneWayStringify:()=>Xg,stringify:()=>fr,stringifyBase64:()=>Ag,stringifyJsonL:()=>Kg,stringifyPretty:()=>Zg});var Ar={};H(Ar,{Base64:()=>Us,Domain:()=>Ys,GitRepo:()=>js,base64:()=>Zr,create:()=>_s,docker:()=>Ns,encoding:()=>Fs,indent:()=>Ws,normalize:()=>Ls,type:()=>Hs});var _s={};H(_s,{createCryptoRandomString:()=>Cg,createRandomString:()=>Pg});var Be={};H(Be,{shortId:()=>Tg,uni:()=>Mg,uniSimple:()=>Eg,uuid4:()=>Dg,uuid5:()=>Sg});var Jo={};H(Jo,{customAlphabet:()=>X0,customRandom:()=>sp,nanoid:()=>Z0,random:()=>ip,urlAlphabet:()=>Ps});var Ps="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var ip=i(t=>crypto.getRandomValues(new Uint8Array(t)),"random"),sp=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)=>sp(t,e|0,ip),"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 ur={};H(ur,{MAX:()=>ap,NIL:()=>cp,parse:()=>ft,stringify:()=>fp,v1:()=>Cs,v1ToV6:()=>Ko,v3:()=>mp,v4:()=>hp,v5:()=>xp,v6:()=>wp,v6ToV1:()=>Dc,v7:()=>bp,validate:()=>Ut,version:()=>vp});var ap="ffffffff-ffff-ffff-ffff-ffffffffffff";var cp="00000000-0000-0000-0000-000000000000";var up=/^(?:[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"&&up.test(t)}i(A0,"validate");var Ut=A0;function eg(t){if(!Ut(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 ft=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(!Ut(r))throw TypeError("Stringified UUID is invalid");return r}i(tg,"stringify");var fp=tg;var wc,rg=new Uint8Array(16);function lt(){if(!wc){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");wc=crypto.getRandomValues.bind(crypto)}return wc(rg)}i(lt,"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=lp(t.random??t.rng?.()??lt(),t.msecs,t.nsecs,t.clockseq,t.node,e,r);else{let s=Date.now(),a=lt();ng(Qo,s,a),o=lp(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 lp(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(lp,"v1Bytes");var Cs=og;function Ko(t){let e=typeof t=="string"?ft(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 dp(t){return(t+64>>>9<<4)+14+1}i(dp,"getOutputLength");function cg(t,e){let r=new Uint32Array(dp(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=Ht(o,u),n=Ht(n,f),s=Ht(s,l),a=Ht(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(dp(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 Ht(t,e){let r=(t&65535)+(e&65535);return(t>>16)+(e>>16)+(r>>16)<<16|r&65535}i(Ht,"safeAdd");function fg(t,e){return t<<e|t>>>32-e}i(fg,"bitRotateLeft");function Rs(t,e,r,o,n,s){return Ht(fg(Ht(Ht(e,t),Ht(o,s)),n),r)}i(Rs,"md5cmn");function ye(t,e,r,o,n,s,a){return Rs(e&r|~e&o,t,e,n,s,a)}i(ye,"md5ff");function xe(t,e,r,o,n,s,a){return Rs(e&o|r&~o,t,e,n,s,a)}i(xe,"md5gg");function we(t,e,r,o,n,s,a){return Rs(e^r^o,t,e,n,s,a)}i(we,"md5hh");function ge(t,e,r,o,n,s,a){return Rs(r^(e|~o),t,e,n,s,a)}i(ge,"md5ii");var pp=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"?ft(o):o;if(typeof o=="string"&&(o=ft(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 gc(t,e,r,o){return Xo(48,pp,t,e,r,o)}i(gc,"v3"),gc.DNS=Kr,gc.URL=Xr;var mp=gc;var dg=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),bc={randomUUID:dg};function pg(t,e,r){if(bc.randomUUID&&!e&&!t)return bc.randomUUID();t=t||{};let o=t.random??t.rng?.()??lt();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(pg,"v4");var hp=pg;function mg(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(mg,"f");function vc(t,e){return t<<e|t>>>32-e}i(vc,"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]=vc(u[y-3]^u[y-8]^u[y-14]^u[y-16],1);let f=r[0],l=r[1],d=r[2],m=r[3],h=r[4];for(let y=0;y<80;++y){let w=Math.floor(y/20),g=vc(f,5)+mg(w,l,d,m)+h+e[w]+u[y]>>>0;h=m,m=d,d=vc(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]+m>>>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 yp=hg;function Tc(t,e,r,o){return Xo(80,yp,t,e,r,o)}i(Tc,"v5"),Tc.DNS=Kr,Tc.URL=Xr;var xp=Tc;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 wp=yg;function Dc(t){let e=typeof t=="string"?ft(t):t,r=xg(e);return typeof t=="string"?De(r):r}i(Dc,"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 Sc={};function wg(t,e,r){let o;if(t)o=gp(t.random??t.rng?.()??lt(),t.msecs,t.seq,e,r);else{let n=Date.now(),s=lt();gg(Sc,n,s),o=gp(s,Sc.msecs,Sc.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 gp(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(gp,"v7Bytes");var bp=wg;function bg(t){if(!Ut(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}i(bg,"version");var vp=bg;var Tg=i(t=>Jo.nanoid(t),"shortId"),Dg=i(()=>ur.v4(),"uuid4"),Sg=i((t,e=ur.v5.DNS)=>ur.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"),Eg=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={};H(Ns,{makeEnvObject:()=>Rg});var Rg=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={};H(Fs,{decodeText:()=>Fg,decodeUtf8OrWindows1252:()=>Wg,decodeWindows1252:()=>Mc,encodeWindows1252:()=>Ng,encodingOfLabel:()=>Ep,isValidUtf8:()=>Mp,windows1252ByteOf:()=>Sp});var Tp=[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],_g=new Map(Tp.map((t,e)=>[t,128+e])),Dp=4096,Mc=i(t=>{let e="";for(let r=0;r<t.length;r+=Dp){let o=t.subarray(r,r+Dp);e+=String.fromCharCode(...Array.from(o,n=>n>=128&&n<=159?Tp[n-128]:n))}return e},"decodeWindows1252"),Sp=i(t=>t<=127||t>=160&&t<=255?t:_g.get(t),"windows1252ByteOf"),Ng=i(t=>{let e=[],r=[],o=0;for(let n of t){let s=Sp(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"),Mp=i(t=>{try{return new TextDecoder("utf-8",{fatal:!0}).decode(t),!0}catch{return!1}},"isValidUtf8"),Ep=i(t=>{try{return new TextDecoder(t).encoding}catch{return}},"encodingOfLabel"),Fg=i((t,e,r={})=>{let o=Ep(e);if(o!==void 0)return o==="windows-1252"?Mc(t):new TextDecoder(o,{fatal:r.fatal??!1}).decode(t)},"decodeText"),Wg=i(t=>Mp(t)?{text:new TextDecoder("utf-8").decode(t),encoding:"utf-8"}:{text:Mc(t),encoding:"windows-1252"},"decodeUtf8OrWindows1252");var Ws={};H(Ws,{indent:()=>Ug,indentWithPrefix:()=>Hg,normalize:()=>Yg});var Ec=i(t=>{let e=t.split(`
6
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(`
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=Ec(t);for(let n of r)n=" ".repeat(e)+n;return Oc(r)},"indent"),Hg=i((t,e)=>{let r,o=Ec(t),n=[];for(let s of o)n.push(e+s);return r=Oc(n),r},"indentWithPrefix"),Yg=i(t=>{let e,r=Ec(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={};H(Ls,{replaceAll:()=>Op,standard:()=>qg});var Op=i((t,e,r)=>t.replace(new RegExp(e,"g"),r),"replaceAll"),jg=i(t=>{let e=t.split(`
8
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};
9
+ `)},"stripIndent"),qg=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=Op(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 Hs={};H(Hs,{isBase64:()=>Bg,isUtf8:()=>$g});var kc={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=>kc.encode(t),"encode"),encodeUri:i(t=>kc.encode(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),"encodeUri"),decode:i(t=>kc.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 $g=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 Ys=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=kp(this.host,this.user,this.repo,this.accessToken,"ssh"),this.httpsUrl=kp(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"),kp=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 Cp=fn(Pp(),1),eo=Cp.default;var _p=i(()=>globalThis.Buffer,"getNodeBuffer");function Vg(t){let e=_p();return e?e.from(t).toString("base64"):btoa(String.fromCharCode(...t))}i(Vg,"base64Encode");function Gg(t){let e=_p();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,qs,e)}i(Zo,"stringify");function Pc(t){return JSON.parse(t,Np)}i(Pc,"parse");var qs=i((t,e)=>{if(Qg(e)){let r;if("data"in e&&Fp(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"),Np=i((t,e)=>{if(Jg(e)&&Ic(e.data)&&e.data.startsWith("base64:")){let r=e.data.slice(7);return Gg(r)}return e},"reviver");function Jg(t){return Wp(t)&&t.type==="EncodedBuffer"&&Ic(t.data)}i(Jg,"isEncodedBuffer");function Qg(t){return Wp(t)&&t.type==="Buffer"&&(Fp(t.data)||Ic(t.data))||t instanceof Uint8Array}i(Qg,"isBufferLike");function Fp(t){return Array.isArray(t)}i(Fp,"isArray");function Ic(t){return typeof t=="string"}i(Ic,"isString");function Wp(t){return typeof t=="object"&&t!==null}i(Wp,"isObject");var Up=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 $s=Pc,Cc=i(t=>t.split(`
11
+ `).reduce((o,n)=>{let s=n.trim();return s.length>0&&o.push($s(s)),o},[]),"parseJsonL"),Kg=i(t=>t.map(e=>fr(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=qs("",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"),fr=i((t,e,r=void 0)=>{if(r===void 0&&e===void 0)return Up(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=fr(t),r=JSON.parse(e);return JSON.stringify(r,null,2)},"stringifyPretty"),Ag=i((...t)=>{let e=fr(...t);return Ar.base64.encodeUri(e)},"stringifyBase64"),eb=i(t=>{let e=Ar.base64,o=(e.decodeUri||e.decode)(t);return $s(o)},"parseBase64"),Rc=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=$s(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 fr(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"),Hp=i((t,e)=>{let r=fr(t),o=fr(e);return r===o},"deepEqualObjects"),rb=i((t,e)=>{let r=Cc(t),o=Cc(e);return Hp(r,o)},"deepEqualJsonLStrings");var Yp={};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,m)=>{u=m}),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)}}},qp=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"),$p=i((t,e)=>{t.objectStoreNames.contains(e)||t.createObjectStore(e)},"ensureObjectStore"),Bp=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 Bp(t,void 0,n=>$p(n,e));if(r.objectStoreNames.contains(e))return new Bs(r);let o=r.version+1;if(r.close(),r=await Bp(t,o,n=>$p(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 qp(r,e),e?.throwIfAborted()),this.initPromise||(this.initPromise=this.runInit().catch(o=>{throw this.initPromise=void 0,o})),qp(this.initPromise,e)}async runInit(){let e=new cr.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:zp(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(zp(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}},zp=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),m=0;for(let h of s)d.set(h,m),m+=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 Vp=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,Vp,{value:!0})}},lr=i(t=>t instanceof Error&&Reflect.get(t,Vp)===!0,"isFetchTimeoutError"),Ye=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"),dt=i(async(t,e)=>{!t?.body||t.bodyUsed||await t.body.cancel(e).catch(()=>{})},"discardResponse"),Gp=i((t,e)=>e?.aborted?Promise.reject(Ye(e)):new Promise((r,o)=>{let n=i(()=>{clearTimeout(s),o(Ye(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"),Jp=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"),Qp=i(t=>{let e={};return t.etag&&(e["if-none-match"]=t.etag),t.lastModified&&(e["if-modified-since"]=t.lastModified),e},"createConditionalHeaders"),Kp=i(t=>{let e={};return t.forEach((r,o)=>{e[o]=r}),e},"headersToObject");var dr=i((t,...e)=>{t.logging&&console.log("[smartrequest/cache]",...e)},"log"),nt=i((t,e,r)=>({response:t,fromCache:e,revalidated:r}),"result"),fb=i((t,e)=>e===void 0?t:Math.min(t,e),"resolveEffectiveMaxAge"),Xp=i((t,e,r)=>Jp(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),nt(e,!1,!1)}catch(r){if(await rn(e,r,t.request.signal),t.signal.aborted)throw t.signal.reason;if(lr(r)||e)throw r;dr(t,"network failed, trying cache:",t.request.url,r);let o=await Qs(t);if(!o)throw r;return nt(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(Xp(t,e,o)&&!Js(o))return dr(t,"cache hit (fresh):",t.request.url),nt(t.cacheStore.responseFromCacheEntry(e),!0,!1);if(Js(o)&&(e.etag||e.lastModified))return await pb(t,e)}dr(t,"cache miss, fetching:",t.request.url);let r=await t.dispatch(t.request);return await on(t,r,t.request.signal),nt(r,!1,!1)},"cacheFirst"),pb=i(async(t,e)=>{let r=new Request(t.request,{headers:{...Kp(t.request.headers),...Qp(e)},signal:t.signal}),o;try{return o=await t.dispatch(r),o.status===304?(dr(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}),nt(t.cacheStore.responseFromCacheEntry(e),!0,!0)):(await on(t,o,r.signal),nt(o,!1,!0))}catch(n){if(await rn(o,n,r.signal),t.signal.aborted)throw t.signal.reason;if(lr(n)||o)throw n;return dr(t,"revalidation failed, using cache:",t.request.url,n),nt(t.cacheStore.responseFromCacheEntry(e),!0,!1)}},"revalidate"),mb=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),nt(o,!1,!1)}let r=Gs(new Headers(e.headers));if(!Xp(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),dr(t,"background revalidation complete:",t.request.url)}catch(c){n.aborted||dr(t,"background revalidation failed:",t.request.url,c)}finally{await rn(a,"background response discarded",s.request.signal)}})}return nt(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 nt(t.cacheStore.responseFromCacheEntry(e),!0,!1)},"cacheOnly"),Zp={"network-first":lb,"cache-first":db,"stale-while-revalidate":mb,"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 Zp[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={};H(ro,{FetchTimeoutError:()=>Pe,SmartFetch:()=>ea,isFetchTimeoutError:()=>lr});var Ap=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"),em=i(async(t,e)=>{if(e.signal?.aborted){let d=Ye(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,m)=>{n=m}),a=i(d=>{o||(o=d,r.cancel(d).catch(()=>{}),n(d))},"terminate"),c=e.signal,u=i(()=>a(Ye(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,m="";for(;;){let h;try{h=await r.read()}catch(y){throw o??y}if(o)throw o;if(h.done)break;m+=d.decode(h.value,{stream:!0})}return m+=d.decode(),JSON.parse(m)},"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 Ye(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 dt(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 dt(a,`Trying fallback after HTTP ${a.status}`),n=new Error(`Request failed with status ${a.status}`)}catch(a){if(this.signal?.aborted)throw Ye(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||lr(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 Gp(n,this.signal)}throwIfAborted(){if(this.signal?.aborted)throw Ye(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){Nc(this.request,e)}removeResponseInterceptor(e){Nc(this.response,e)}removeErrorInterceptor(e){Nc(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}},Nc=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(Ye(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=Ye(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){dt(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])dt(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 tm=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??tm,a=vb(r),c=i(m=>Tb(e,m,n),"build"),u=i(m=>Ap(this.fetchFunction,m,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 m,h=i(async()=>(m=await o.httpCache.execute(c(e.url),{cacheStrategy:o.cacheStrategy,cacheKey:r.cacheKey,cacheMaxAge:r.cacheMaxAge,timeout:s,logging:r.logging??!1},u),m.response),"attempt");f?await new to(f,e.signal).execute(h):await h(),l=m}else{let m=i(()=>u(c(e.url)),"attempt");l={response:f?await new to(f,e.signal).execute(m):await m(),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??tm,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,m=new Headers(s.headers);m.has("accept")||m.set("accept","application/json"),o!==void 0&&!m.has("content-type")&&m.set("content-type","application/json");try{let h=await this.fetchWithMetadata(e,{...n,method:r,headers:m,...o===void 0?{}:{body:JSON.stringify(o)},signal:l}),y=h.response;if(l?.aborted)throw await dt(y,l.reason),Yt(l.reason);if(!y.ok)throw await dt(y,`HTTP ${y.status}`),new Error(`HTTP ${y.status}: ${y.statusText}`);let w=await em(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,rm=new WeakSet,om=new WeakMap,Fc=i(t=>{rm.add(t)},"authorizeVirtualStreamApplicationUse"),pr=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"}},pt=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=om.get(e);if(r&&r!==this)throw new Error("VirtualStream is already owned by another activation scope");r||om.set(e,this),this.trackedStreams.add(e),this.hasAuthorizedTrackedStreams&&Fc(e),this.published&&e.publishActivation()}authorizeApplicationUse(){if(!(this.settled||this.hasAuthorizedTrackedStreams)){this.hasAuthorizedTrackedStreams=!0;for(let e of this.trackedStreams)Fc(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||ar.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 m=0;m<e.length;m++)d.push(t.encodePayloadValue(e[m],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 m=n||o&&s&&d==="request";l[d]=t.encodePayloadValue(e[d],r,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,r){let o=new Map,n=[],s=[],a=r.activationScope??new pt,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 m=t.getRemainingOpenTimeoutMs(u),h=await t.openVirtualStreamWithTimeout(l,d.descriptor,m,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||ar.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(ar.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,m=new t({transport:d,descriptor:f,explicitRegistration:!1});return o.set(f.streamId,{stream:m,descriptor:f}),n.push({stream:m,descriptor:f}),s.push(m),r.activationScope?.track(m),m}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 m=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,m])}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&&Fc(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 pr("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(!rm.has(this))throw new Error("VirtualStream application use is not authorized")}assertApplicationOperation(e){if(this.assertApplicationOperationsAllowed(),this.assertNotClosed(),this.terminalPromise)throw new pr("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 pr("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 pr(`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 nm=Object.freeze(["onOutgoingRequest","onIncomingResponse","onIncomingRequest","onOutgoingResponse"]),im=Symbol.for("@api.global/typedrequest:global-hooks:3.8"),sm=i(t=>({payloadProjector:t?.payloadProjector,errorProjector:t?.errorProjector}),"copyProjectionOptions"),na=i((t={})=>({hooks:t,projectedRegistrationsByPhase:{}}),"createTypedRouterHookRegistrationState"),Sb=i(t=>nm.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:sm(r)}}},"mergeTypedRouterHookRegistrations"),sa=i((t,e)=>{t.hooks=e;for(let r of nm)delete t.projectedRegistrationsByPhase[r]},"replaceTypedRouterHookRegistrations"),no=i(()=>{let t=globalThis[im];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[im]=e,e},"getRealmGlobalHookState"),cm=i(()=>no().legacy.hooks,"getLegacyGlobalHooks"),um=i(t=>{sa(no().legacy,t)},"replaceLegacyGlobalHooks"),fm=i((t,e)=>{ia(no().legacy,t,e)},"mergeLegacyGlobalHooks"),lm=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"),dm=i(()=>{let t=no();sa(t.legacy,{}),t.subscribers.clear()},"clearGlobalHookRegistrations"),oa=i(t=>{try{console.error(`TypedRequest hook projection failed (${t})`)}catch{}},"logProjectionFailure"),Wc=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"),am=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(am(t))throw new TypeError("TypedRequest hook projections cannot contain SharedArrayBuffer");if(ArrayBuffer.isView(t)){if(am(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"),Eb=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"),Ob=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=Eb(t.payload,o,e,r),s=Ob(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"),Lc=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?sm(o.projectionOptions):{}}}catch{Wc(e);return}},"snapshotDispatchRecipient"),Uc=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(()=>{Wc(e)})}catch{Wc(e)}},"dispatchToRecipient"),so=i((t,e,r)=>{let o=no();if(o.subscribers.size===0){let a=Lc(o.legacy,t),c=r?Lc(r,t):void 0;if(!a&&!c)return;a&&Uc(a,t,e),c&&Uc(c,t,e);return}let s=[o.legacy,...Array.from(o.subscribers.values()),...r?[r]:[]].map(a=>Lc(a,t)).filter(a=>!!a);for(let a of s)Uc(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 Uce=16,Hce=1024,Yce=32,jce=32800,pm=Symbol.for("@api.global/typedrequest:global-error-reporter"),Hc=i(()=>{let t=globalThis[pm];if(t&&typeof t=="object")return t;let e={reporter:void 0};return globalThis[pm]=e,e},"getRealmGlobalErrorReporterState"),Ib=i(()=>Hc().reporter,"getGlobalTypedRequestErrorReporter"),hm=i(t=>{let e=Hc();e.reporter=t;let r=!1;return()=>{r||(r=!0,e.reporter===t&&(e.reporter=void 0))}},"setGlobalTypedRequestErrorReporter"),ym=i(()=>{Hc().reporter=void 0},"clearGlobalTypedRequestErrorReporter"),jt=i(t=>{let e=t.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/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 jt(e)}catch{}try{let e=t.constructor?.name;if(typeof e=="string"&&e.length>0)return jt(e)}catch{}return"Error"},"readErrorName"),Cb=i(t=>{try{let e=t.message;return typeof e=="string"?jt(e):""}catch{return""}},"readErrorMessage"),Rb=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=jt(n))}catch{}return{name:"NonErrorThrowable",message:`<non-Error ${o} thrown>`}}let r="";try{r=jt(String(t))}catch{}return{name:`NonErrorThrowable(${e})`,message:r}},"describeThrowable"),_b=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(Rb(o));let n=_b(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"),mm=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=jt(String(t.method)),r=Nb(t.error),o=typeof t.correlationId=="string"&&t.correlationId.length>0?jt(t.correlationId):void 0,n=o?` [correlation ${o}]`:"",s=`${mm(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"),Ub=i(t=>{let e=t.trim();return/^at\s/.test(e)?!0:e.includes("@")&&(/:\d+:\d+$/.test(e)||e.endsWith("[native code]"))},"isStackFrameLine"),Hb=i((t,e)=>{let r=t.name,o=t.message;if(typeof r!="string"||typeof o!="string")return;let n=r.length===0?[o]:o.length===0?[r]:[r,": ",o],s=0;for(let a of n){if(!e.startsWith(a,s))return;s+=a.length}return s===e.length?s:e[s]===`
13
+ `?s+1:void 0},"findFramesAfterHeader"),Yb=i(t=>{let e=t.stack;if(e===void 0||!(t.error instanceof Error))return[];let r=Hb(t.error,e),o=r??0,n=e.slice(o,o+32800).split(`
14
+ `),s=r===void 0?n.findIndex(Ub):0;if(s===-1)return[];let a=e.length>o+32800,c=[];for(let u of n.slice(s)){let f=jt(u).trim();if(f.length!==0){if(c.length===32){a=!0;break}c.push(` ${f}`)}}return a&&c.length>0&&c.push(" ...[stack truncated]"),c},"renderStackFrameLines"),jb=i(t=>{let e=[];try{e=Yb(t)}catch{}return[t.formatted,...e].join(`
15
+ `)},"renderDefaultReport"),Yc=i(t=>{try{console.error(jb(t))}catch{}},"printDefaultReport"),ao=i(t=>{let e;try{e=Lb(t)}catch{try{console.error(`${mm(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 jc=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 qb=[],xm=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=xm(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"),m;try{await s(o,d,n)}catch(y){m={error:y}}c=!0;let h=a&&!u;if(l&&await l,h)throw f&&m&&m.error!==f.error&&ao({origin:"requestscope",method:n.method,correlationId:o.correlation?.id,error:m.error}),f?f.error:m?m.error:new TypeError("A TypedRouter request scope returned before next() settled");if(m)throw m.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 qc=class t{static{i(this,"TypedRouter")}constructor(){this.hookRegistrationState=na(),this.routerMap=new ot.ObjectMap,this.fallbackRouterMap=new ot.ObjectMap,this.fallbackParentRouters=new Set,this.handlerMap=new ot.ObjectMap,this.middlewares=[],this.requestScopes=[],this.fireEventInterestMap=new ot.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 cm()}static set globalHooks(e){um(e)}static setGlobalHooks(e,r){fm(e,r)}static addGlobalHooks(e,r){return lm(e,r)}static clearGlobalHooks(){dm()}static setGlobalErrorReporter(e){return hm(e)}static clearGlobalErrorReporter(){ym()}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??qb}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 pt,l=new pt,d=i(async y=>{await Promise.allSettled([f.rollback(y),l.rollback(y)])},"rollbackRouteActivations"),m=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,Re=i(async()=>{try{if(v.middlewares.length>0)try{for(let _ of v.middlewares)await _(e)}catch(_){ee={value:_},this.setErrorFromCaughtError(e,_,"middleware"),e.correlation.phase="response",Ce=!0;return}f.authorizeApplicationUse(),e=await g.addResponse(e,c),Ce=!0}catch(_){throw Q={error:_},_}},"runMiddlewareAndHandler"),st=this.collectRequestScopes(G);if(st.length===0)await Re();else{let _=Object.freeze({entryRouter:this,owningRouter:v,method:e.method,localData:s,abortSignal:c}),at;try{await xm(st,0,Re,e,_)}catch(ct){if(Q&&ct===Q.error)throw ct;at={error:ct}}if(at)e.response=null,this.setErrorFromCaughtError(e,at.error,"requestscope"),e.correlation.phase="response",ee={value:at.error};else if(!Ce){if(!e.error&&(e.response===void 0||e.response===null)){let ct=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:ct}),e.error={text:t.internalErrorMessage,data:{}},ee={value:ct}}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),m()),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)}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,$b=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}},Bc=class{static{i(this,"TypedRequest")}#e;constructor(e,r,o={}){if(this.skipHooks=!1,!o||typeof o!="object"||Array.isArray(o))throw new TypeError("TypedRequest options must be an options object");if(o.headers!==void 0&&typeof e!="string")throw new TypeError("TypedRequest headers require an HTTP URL");this.#e=this.normalizeHeaders(o.headers),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 pt,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 m=l.response;if(!this.urlEndPoint&&this.typedTarget.options.supportsAbortSignal!==!0&&ze.containsNetworkDescriptor(m))throw new Error("VirtualStreams require TypedTarget AbortSignal transport support");try{m=await ze.decodePayloadFromNetworkAsync(m,{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:m}),this.assertActive(n),a.commit(),m}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 $b.postJsonWithMetadata(this.urlEndPoint,e,{cacheStrategy:r.useCache?"cache-first":"network-only",cacheKey:r.cacheKey,timeout:this.getRemainingTimeout(r),signal:r.abortSignal,headers:r.headers,...r.headers?{cache:"no-store",redirect:"error"}:{}})}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{this.assertActive(r),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.assertActive(r),this.assertResponseEnvelope(s,n),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");if(r.headers!==void 0&&!this.urlEndPoint)throw new TypeError("TypedRequest headers require an HTTP URL");let o=new Headers(this.#e);this.normalizeHeaders(r.headers).forEach((s,a)=>o.set(a,s));let n=!o.keys().next().done;return{useCache:!n&&(r.useCache??!1),timeoutMs:r.timeoutMs,maxRetries:r.maxRetries??3,abortSignal:r.abortSignal,headers:n?o:void 0,deadlineAt:r.timeoutMs===void 0?void 0:performance.now()+r.timeoutMs}}normalizeHeaders(e){try{return new Headers(e)}catch{throw new TypeError("TypedRequest headers must be valid HTTP headers")}}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 wm(t){return t&&typeof t.then=="function"}i(wm,"isPromise");var gm=Promise.resolve(!1),Mue=Promise.resolve(!0),it=Promise.resolve();function pa(t,e){return t||(t=0),new Promise(function(r){return setTimeout(function(){return r(e)},t)})}i(pa,"sleep");function bm(t,e){return Math.floor(Math.random()*(e-t+1)+t)}i(bm,"randomInt");function sn(){return Math.random().toString(36).substring(2)}i(sn,"randomToken");var zc=0;function mt(){var t=Date.now()*1e3;return t<=zc&&(t=zc+1),zc=t,t}i(mt,"microSeconds");function Eue(){return typeof navigator<"u"&&typeof navigator.locks<"u"&&typeof navigator.locks.request=="function"}i(Eue,"supportsWebLockAPI");var Bb=mt,zb="native";function Vb(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(Vb,"create");function Gb(t){t.bc.close(),t.subFns=[]}i(Gb,"close");function Jb(t,e){try{return t.bc.postMessage(e,!1),it}catch(r){return Promise.reject(r)}}i(Jb,"postMessage");function Qb(t,e){t.messagesCallback=e}i(Qb,"onMessage");function Kb(){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(Kb,"canBeUsed");function Xb(){return 150}i(Xb,"averageResponseTime");var vm={create:Vb,close:Gb,onMessage:Qb,postMessage:Jb,canBeUsed:Kb,type:zb,averageResponseTime:Xb,microSeconds:Bb};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<Vc()-this.ttl?(this.map.delete(e),!1):!0}add(e){this.map.delete(e),this.map.set(e,Vc()),this._to||(this._to=!0,setTimeout(()=>{this._to=!1,Zb(this)},0))}clear(){this.map.clear()}};function Zb(t){let e=Vc()-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(Zb,"removeTooOldValues");function Vc(){return Date.now()}i(Vc,"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 Ab=mt,ev="pubkey.broadcast-channel-0-",Ge="messages",an={durability:"relaxed"},tv="idb";function Tm(){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(Tm,"getIdb");function ma(t){t.commit&&t.commit()}i(ma,"commitIndexedDBTransaction");function rv(t){var e=Tm(),r=ev+t,o=e.open(r);return o.onupgradeneeded=function(n){var s=n.target.result;s.createObjectStore(Ge,{keyPath:"id",autoIncrement:!0})},new Promise(function(n,s){o.onerror=function(a){return s(a)},o.onsuccess=function(){n(o.result)}})}i(rv,"createDatabase");function ov(t,e,r){var o=Date.now(),n={uuid:e,time:o,data:r},s=t.transaction([Ge],"readwrite",an);return new Promise(function(a,c){s.oncomplete=function(){return a()},s.onerror=function(f){return c(f)};var u=s.objectStore(Ge);u.add(n),ma(s)})}i(ov,"writeMessage");function Hue(t){var e=t.transaction(Ge,"readonly",an),r=e.objectStore(Ge),o=[];return new Promise(function(n){r.openCursor().onsuccess=function(s){var a=s.target.result;a?(o.push(a.value),a.continue()):(ma(e),n(o))}})}i(Hue,"getAllMessages");function nv(t,e){var r=t.transaction(Ge,"readonly",an),o=r.objectStore(Ge),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 m=d.target.result;m?m.value.id<e+1?m.continue(e+1):(n.push(m.value),m.continue()):(ma(r),u(n))}})}i(nv,"getMessagesHigherThan");function iv(t,e){if(t.closed)return Promise.resolve([]);var r=t.db.transaction(Ge,"readwrite",an),o=r.objectStore(Ge);return Promise.all(e.map(function(n){var s=o.delete(n);return new Promise(function(a){s.onsuccess=function(){return a()}})}))}i(iv,"removeMessagesById");function sv(t,e){var r=Date.now()-e,o=t.transaction(Ge,"readonly",an),n=o.objectStore(Ge),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()):(ma(o),a(s))}else a(s)}})}i(sv,"getOldMessages");function av(t){return sv(t.db,t.options.idb.ttl).then(function(e){return iv(t,e.map(function(r){return r.id}))})}i(av,"cleanOldMessages");function cv(t,e){return e=hr(e),rv(t).then(function(r){var o={closed:!1,lastCursorId:0,channelName:t,options:e,uuid:sn(),eMIs:new co(e.idb.ttl*2),writeBlockPromise:it,messagesCallback:null,readQueuePromises:[],db:r};return r.onclose=function(){o.closed=!0,e.idb.onclose&&e.idb.onclose()},Dm(o),o})}i(cv,"create");function Dm(t){t.closed||Sm(t).then(function(){return pa(t.options.idb.fallbackInterval)}).then(function(){return Dm(t)})}i(Dm,"_readLoop");function uv(t,e){return!(t.uuid===e.uuid||e.eMIs.has(t.id)||t.data.time<e.messagesCallbackTime)}i(uv,"_filterMessage");function Sm(t){return t.closed?it:t.messagesCallback?nv(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 uv(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))}),it}):it}i(Sm,"readNewMessages");function fv(t){t.closed=!0,t.db.close()}i(fv,"close");function lv(t,e){return t.writeBlockPromise=t.writeBlockPromise.then(function(){return ov(t.db,t.uuid,e)}).then(function(){bm(0,10)===0&&av(t)}),t.writeBlockPromise}i(lv,"postMessage");function dv(t,e,r){t.messagesCallbackTime=r,t.messagesCallback=e,Sm(t)}i(dv,"onMessage");function pv(){return!!Tm()}i(pv,"canBeUsed");function mv(t){return t.idb.fallbackInterval*2}i(mv,"averageResponseTime");var Mm={create:cv,close:fv,onMessage:dv,postMessage:lv,canBeUsed:pv,type:tv,averageResponseTime:mv,microSeconds:Ab};var hv=mt,yv="pubkey.broadcastChannel-",xv="localstorage";function Em(){var t;if(typeof window>"u")return null;try{t=window.localStorage,t=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return t}i(Em,"getLocalStorage");function Om(t){return yv+t}i(Om,"storageKey");function wv(t,e){return new Promise(function(r){pa().then(function(){var o=Om(t.channelName),n={token:sn(),time:Date.now(),data:e,uuid:t.uuid},s=JSON.stringify(n);Em().setItem(o,s);var a=document.createEvent("Event");a.initEvent("storage",!0,!0),a.key=o,a.newValue=s,window.dispatchEvent(a),r()})})}i(wv,"postMessage");function gv(t,e){var r=Om(t),o=i(function(s){s.key===r&&e(JSON.parse(s.newValue))},"listener");return window.addEventListener("storage",o),o}i(gv,"addStorageEventListener");function bv(t){window.removeEventListener("storage",t)}i(bv,"removeStorageEventListener");function vv(t,e){if(e=hr(e),!km())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=gv(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(vv,"create");function Tv(t){bv(t.listener)}i(Tv,"close");function Dv(t,e,r){t.messagesCallbackTime=r,t.messagesCallback=e}i(Dv,"onMessage");function km(){var t=Em();if(!t)return!1;try{var e="__broadcastchannel_check";t.setItem(e,"works"),t.removeItem(e)}catch{return!1}return!0}i(km,"canBeUsed");function Sv(){var t=120,e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")?t*2:t}i(Sv,"averageResponseTime");var Im={create:vv,close:Tv,onMessage:Dv,postMessage:wv,canBeUsed:km,type:xv,averageResponseTime:Sv,microSeconds:hv};var Pm=mt,Mv="simulate",Gc=new Set;function Ev(t){var e={time:Pm(),name:t,messagesCallback:null};return Gc.add(e),e}i(Ev,"create");function Ov(t){Gc.delete(t)}i(Ov,"close");var Cm=5;function kv(t,e){return new Promise(function(r){return setTimeout(function(){var o=Array.from(Gc);o.forEach(function(n){n.name===t.name&&n!==t&&n.messagesCallback&&n.time<e.time&&n.messagesCallback(e)}),r()},Cm)})}i(kv,"postMessage");function Iv(t,e){t.messagesCallback=e}i(Iv,"onMessage");function Pv(){return!0}i(Pv,"canBeUsed");function Cv(){return Cm}i(Cv,"averageResponseTime");var Rm={create:Ev,close:Ov,onMessage:Iv,postMessage:kv,canBeUsed:Pv,type:Mv,averageResponseTime:Cv,microSeconds:Pm};var _m=[vm,Mm,Im];function Jc(t){var e=[].concat(t.methods,_m).filter(Boolean);if(t.type){if(t.type==="simulate")return Rm;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(_m.map(function(n){return n.type})))}i(Jc,"chooseMethod");var Kc=new Set,Rv=0,yr=i(function(e,r){this.id=Rv++,Kc.add(this),this.name=e,Qc&&(r=Qc),this.options=hr(r),this.method=Jc(this.options),this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,Fv(this)},"BroadcastChannel");yr._pubkey=!0;function _v(t){t=hr(t);var e=Jc(t);return e.type==="node"?e.clearNodeFolder().then(function(){return!0}):gm}i(_v,"clearNodeFolder");var Qc;function Nv(t){Qc=t}i(Nv,"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 Nm(this,"message",e)},"postMessage"),postInternal:i(function(e){return Nm(this,"internal",e)},"postInternal"),set onmessage(t){var e=this.method.microSeconds(),r={time:e,fn:t};Lm(this,"message",this._onML),t&&typeof t=="function"?(this._onML=r,Wm(this,"message",r)):this._onML=null},addEventListener:i(function(e,r){var o=this.method.microSeconds(),n={time:o,fn:r};Wm(this,e,n)},"addEventListener"),removeEventListener:i(function(e,r){var o=this._addEL[e].find(function(n){return n.fn===r});Lm(this,e,o)},"removeEventListener"),close:i(function(){var e=this;if(!this.closed){Kc.delete(this),this.closed=!0;var r=this._prepP?this._prepP:it;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 Nm(t,e,r){var o=t.method.microSeconds(),n={time:o,type:e,data:r},s=t._prepP?t._prepP:it;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(Nm,"_post");function Fv(t){var e=t.method.create(t.name,t.options);wm(e)?(t._prepP=e,e.then(function(r){t._state=r})):t._state=e}i(Fv,"_prepareChannel");function Fm(t){return t._addEL.message.length>0||t._addEL.internal.length>0}i(Fm,"_hasMessageListeners");function Wm(t,e,r){t._addEL[e].push(r),Wv(t)}i(Wm,"_addListenerObject");function Lm(t,e,r){t._addEL[e]=t._addEL[e].filter(function(o){return o!==r}),Lv(t)}i(Lm,"_removeListenerObject");function Wv(t){if(!t._iL&&Fm(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(Wv,"_startListening");function Lv(t){if(t._iL&&!Fm(t)){t._iL=!1;var e=t.method.microSeconds();t.method.onMessage(t._state,null,e)}}i(Lv,"_stopListening");var mfe=Ve.TypedResponseError,hfe=Ve.TypedRequestTimeoutError,Hv=i(t=>"ref"in t&&typeof t.ref=="function"&&"unref"in t&&typeof t.unref=="function","isProcessHolding"),Yv=i((t,e)=>{if(typeof globalThis.BroadcastChannel=="function"){let o=new globalThis.BroadcastChannel(t);o.onmessage=s=>{e(s.data)};let n=Hv(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"),ha=i(t=>typeof t=="object"&&t!==null,"isObject"),Um=i((t,e)=>Object.prototype.hasOwnProperty.call(t,e),"hasOwn"),jv=i(t=>{if(!ha(t)||!Um(t,"deesCommsEvent"))return null;let e=t.deesCommsEvent;return!ha(e)||typeof e.name!="string"||typeof e.uniqueEventId!="string"||!Um(e,"payload")?"malformed":{name:e.name,uniqueEventId:e.uniqueEventId,payload:e.payload}},"eventOf"),qv=i(()=>{let t=globalThis.crypto.getRandomValues(new Uint8Array(16));return Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")},"createEventId"),Hm=class t{constructor(e={}){this.eventHandlers=new Map;this.typedHandlerCount=0;this.closed=!1;this.closing=null;this.typedrouter=new Ve.TypedRouter;this.channelName=e.channelName??t.defaultChannelName,this.typedtarget=new Ve.TypedTarget({postMethodWithTypedRouter:i(async r=>{await this.postMessage(r)},"postMethodWithTypedRouter"),typedRouterRef:this.typedrouter,supportsAbortSignal:!0,responseTimeoutMs:e.responseTimeoutMs}),this.channel=Yv(this.channelName,r=>{this.receive(r)})}static{i(this,"DeesComms")}static{this.defaultChannelName="dees-comms"}createTypedRequest(e){return new Ve.TypedRequest(this.typedtarget,e)}async postMessage(e){this.assertOpen(),await this.channel.post(e)}async createTypedHandler(e,r){let o=new Ve.TypedRouter;o.addTypedHandler(new Ve.TypedHandler(e,r));let n=this.typedrouter.addTypedRouter(o);this.typedHandlerCount++,this.holdProcessWhileListened();let s=!1;return{remove:i(()=>{s||(s=!0,n(),this.typedHandlerCount--,this.holdProcessWhileListened())},"remove")}}async broadcast(e,r){let o={deesCommsEvent:{name:e,uniqueEventId:qv(),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.typedHandlerCount>0||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=jv(e);if(r==="malformed"){console.log("DeesComms received a malformed event");return}if(r){this.dispatch(r);return}if(ha(e)&&ha(e.correlation)&&e.correlation.phase==="request"&&typeof e.method=="string"&&!this.typedrouter.checkForTypedHandler(e.method))return;let o=await this.typedrouter.routeAndAddResponse(e,{skipHooks:!0});o&&!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{Hm as DeesComms,hfe as TypedRequestTimeoutError,mfe as TypedResponseError};
13
16
  //# sourceMappingURL=bundle.js.map