@design.estate/dees-comms 1.0.31 → 1.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,13 @@
1
- var Sm=Object.create;var Uo=Object.defineProperty;var Mm=Object.getOwnPropertyDescriptor;var km=Object.getOwnPropertyNames;var Om=Object.getPrototypeOf,Im=Object.prototype.hasOwnProperty;var i=(r,e)=>Uo(r,"name",{value:e,configurable:!0});var nt=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},V=(r,e)=>{for(var t in e)Uo(r,t,{get:e[t],enumerable:!0})},Em=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of km(e))!Im.call(r,n)&&n!==t&&Uo(r,n,{get:()=>e[n],enumerable:!(o=Mm(e,n))||o.enumerable});return r};var rr=(r,e,t)=>(t=r!=null?Sm(Om(r)):{},Em(e||!r||!r.__esModule?Uo(t,"default",{value:r,enumerable:!0}):t,r));var Bs=nt(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0}),Go.uni=void 0;var Lm=i((r="uni")=>`${r}_${"xxxxxxxxxxxxxxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}`,"uni");Go.uni=Lm});var Kl=nt((Ta,Da)=>{(function(r,e){typeof Ta=="object"&&typeof Da<"u"?Da.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self).dayjs=e()})(Ta,(function(){"use strict";var r=1e3,e=6e4,t=36e5,o="millisecond",n="second",s="minute",a="hour",u="day",c="week",f="month",l="quarter",m="year",p="date",h="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:i(function(I){var D=["th","st","nd","rd"],b=I%100;return"["+I+(D[(b-20)%10]||D[b]||D[0])+"]"},"ordinal")},T=i(function(I,D,b){var O=String(I);return!O||O.length>=D?I:""+Array(D+1-O.length).join(b)+I},"m"),J={s:T,z:i(function(I){var D=-I.utcOffset(),b=Math.abs(D),O=Math.floor(b/60),v=b%60;return(D<=0?"+":"-")+T(O,2,"0")+":"+T(v,2,"0")},"z"),m:i(function I(D,b){if(D.date()<b.date())return-I(b,D);var O=12*(b.year()-D.year())+(b.month()-D.month()),v=D.clone().add(O,f),C=b-v<0,P=D.clone().add(O+(C?-1:1),f);return+(-(O+(b-v)/(C?v-P:P-v))||0)},"t"),a:i(function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},"a"),p:i(function(I){return{M:f,y:m,w:c,d:u,D:p,h:a,m:s,s:n,ms:o,Q:l}[I]||String(I||"").toLowerCase().replace(/s$/,"")},"p"),u:i(function(I){return I===void 0},"u")},Te="en",se={};se[Te]=w;var rt="$isDayjsObject",Ke=i(function(I){return I instanceof Ho||!(!I||!I[rt])},"S"),er=i(function I(D,b,O){var v;if(!D)return Te;if(typeof D=="string"){var C=D.toLowerCase();se[C]&&(v=C),b&&(se[C]=b,v=C);var P=D.split("-");if(!v&&P.length>1)return I(P[0])}else{var U=D.name;se[U]=D,v=U}return!O&&v&&(Te=v),v||!O&&Te},"t"),te=i(function(I,D){if(Ke(I))return I.clone();var b=typeof D=="object"?D:{};return b.date=I,b.args=arguments,new Ho(b)},"O"),B=J;B.l=er,B.i=Ke,B.w=function(I,D){return te(I,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var Ho=(function(){function I(b){this.$L=er(b.locale,null,!0),this.parse(b),this.$x=this.$x||b.x||{},this[rt]=!0}i(I,"M");var D=I.prototype;return D.parse=function(b){this.$d=(function(O){var v=O.date,C=O.utc;if(v===null)return new Date(NaN);if(B.u(v))return new Date;if(v instanceof Date)return new Date(v);if(typeof v=="string"&&!/Z$/i.test(v)){var P=v.match(g);if(P){var U=P[2]-1||0,Q=(P[7]||"0").substring(0,3);return C?new Date(Date.UTC(P[1],U,P[3]||1,P[4]||0,P[5]||0,P[6]||0,Q)):new Date(P[1],U,P[3]||1,P[4]||0,P[5]||0,P[6]||0,Q)}}return new Date(v)})(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 B},D.isValid=function(){return this.$d.toString()!==h},D.isSame=function(b,O){var v=te(b);return this.startOf(O)<=v&&v<=this.endOf(O)},D.isAfter=function(b,O){return te(b)<this.startOf(O)},D.isBefore=function(b,O){return this.endOf(O)<te(b)},D.$g=function(b,O,v){return B.u(b)?this[O]:this.set(v,b)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(b,O){var v=this,C=!!B.u(O)||O,P=B.p(b),U=i(function(Ct,we){var ot=B.w(v.$u?Date.UTC(v.$y,we,Ct):new Date(v.$y,we,Ct),v);return C?ot:ot.endOf(u)},"l"),Q=i(function(Ct,we){return B.w(v.toDate()[Ct].apply(v.toDate("s"),(C?[0,0,0,0]:[23,59,59,999]).slice(we)),v)},"$"),re=this.$W,ce=this.$M,Ie=this.$D,tr="set"+(this.$u?"UTC":"");switch(P){case m:return C?U(1,0):U(31,11);case f:return C?U(1,ce):U(0,ce+1);case c:var _t=this.$locale().weekStart||0,Jr=(re<_t?re+7:re)-_t;return U(C?Ie-Jr:Ie+(6-Jr),ce);case u:case p:return Q(tr+"Hours",0);case a:return Q(tr+"Minutes",1);case s:return Q(tr+"Seconds",2);case n:return Q(tr+"Milliseconds",3);default:return this.clone()}},D.endOf=function(b){return this.startOf(b,!1)},D.$set=function(b,O){var v,C=B.p(b),P="set"+(this.$u?"UTC":""),U=(v={},v[u]=P+"Date",v[p]=P+"Date",v[f]=P+"Month",v[m]=P+"FullYear",v[a]=P+"Hours",v[s]=P+"Minutes",v[n]=P+"Seconds",v[o]=P+"Milliseconds",v)[C],Q=C===u?this.$D+(O-this.$W):O;if(C===f||C===m){var re=this.clone().set(p,1);re.$d[U](Q),re.init(),this.$d=re.set(p,Math.min(this.$D,re.daysInMonth())).$d}else U&&this.$d[U](Q);return this.init(),this},D.set=function(b,O){return this.clone().$set(b,O)},D.get=function(b){return this[B.p(b)]()},D.add=function(b,O){var v,C=this;b=Number(b);var P=B.p(O),U=i(function(ce){var Ie=te(C);return B.w(Ie.date(Ie.date()+Math.round(ce*b)),C)},"y");if(P===f)return this.set(f,this.$M+b);if(P===m)return this.set(m,this.$y+b);if(P===u)return U(1);if(P===c)return U(7);var Q=(v={},v[s]=e,v[a]=t,v[n]=r,v)[P]||1,re=this.$d.getTime()+b*Q;return B.w(re,this)},D.subtract=function(b,O){return this.add(-1*b,O)},D.format=function(b){var O=this,v=this.$locale();if(!this.isValid())return v.invalidDate||h;var C=b||"YYYY-MM-DDTHH:mm:ssZ",P=B.z(this),U=this.$H,Q=this.$m,re=this.$M,ce=v.weekdays,Ie=v.months,tr=v.meridiem,_t=i(function(we,ot,Kr,qo){return we&&(we[ot]||we(O,C))||Kr[ot].slice(0,qo)},"h"),Jr=i(function(we){return B.s(U%12||12,we,"0")},"d"),Ct=tr||function(we,ot,Kr){var qo=we<12?"AM":"PM";return Kr?qo.toLowerCase():qo};return C.replace(x,(function(we,ot){return ot||(function(Kr){switch(Kr){case"YY":return String(O.$y).slice(-2);case"YYYY":return B.s(O.$y,4,"0");case"M":return re+1;case"MM":return B.s(re+1,2,"0");case"MMM":return _t(v.monthsShort,re,Ie,3);case"MMMM":return _t(Ie,re);case"D":return O.$D;case"DD":return B.s(O.$D,2,"0");case"d":return String(O.$W);case"dd":return _t(v.weekdaysMin,O.$W,ce,2);case"ddd":return _t(v.weekdaysShort,O.$W,ce,3);case"dddd":return ce[O.$W];case"H":return String(U);case"HH":return B.s(U,2,"0");case"h":return Jr(1);case"hh":return Jr(2);case"a":return Ct(U,Q,!0);case"A":return Ct(U,Q,!1);case"m":return String(Q);case"mm":return B.s(Q,2,"0");case"s":return String(O.$s);case"ss":return B.s(O.$s,2,"0");case"SSS":return B.s(O.$ms,3,"0");case"Z":return P}return null})(we)||P.replace(":","")}))},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(b,O,v){var C,P=this,U=B.p(O),Q=te(b),re=(Q.utcOffset()-this.utcOffset())*e,ce=this-Q,Ie=i(function(){return B.m(P,Q)},"D");switch(U){case m:C=Ie()/12;break;case f:C=Ie();break;case l:C=Ie()/3;break;case c:C=(ce-re)/6048e5;break;case u:C=(ce-re)/864e5;break;case a:C=ce/t;break;case s:C=ce/e;break;case n:C=ce/r;break;default:C=ce}return v?C:B.a(C)},D.daysInMonth=function(){return this.endOf(f).$D},D.$locale=function(){return se[this.$L]},D.locale=function(b,O){if(!b)return this.$L;var v=this.clone(),C=er(b,O,!0);return C&&(v.$L=C),v},D.clone=function(){return B.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()},I})(),xu=Ho.prototype;return te.prototype=xu,[["$ms",o],["$s",n],["$m",s],["$H",a],["$W",u],["$M",f],["$y",m],["$D",p]].forEach((function(I){xu[I[1]]=function(D){return this.$g(D,I[0],I[1])}})),te.extend=function(I,D){return I.$i||(I(D,Ho,te),I.$i=!0),te},te.locale=er,te.isDayjs=Ke,te.unix=function(I){return te(1e3*I)},te.en=se[Te],te.Ls=se,te.p={},te}))});var Xl=nt((Sa,Ma)=>{(function(r,e){typeof Sa=="object"&&typeof Ma<"u"?Ma.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self).dayjs_plugin_isToday=e()})(Sa,(function(){"use strict";return function(r,e,t){e.prototype.isToday=function(){var o="YYYY-MM-DD",n=t();return this.format(o)===n.format(o)}}}))});var rd=nt((xte,td)=>{"use strict";td.exports=class{static{i(this,"SymbolTreeNode")}constructor(){this.parent=null,this.previousSibling=null,this.nextSibling=null,this.firstChild=null,this.lastChild=null,this.childrenVersion=0,this.childIndexCachedUpTo=null,this.cachedIndex=-1,this.cachedIndexVersion=NaN}get isAttached(){return!!(this.parent||this.previousSibling||this.nextSibling)}get hasChildren(){return!!this.firstChild}childrenChanged(){this.childrenVersion=this.childrenVersion+1&4294967295,this.childIndexCachedUpTo=null}getCachedIndex(e){return this.cachedIndexVersion!==e.childrenVersion?(this.cachedIndexVersion=NaN,-1):this.cachedIndex}setCachedIndex(e,t){this.cachedIndexVersion=e.childrenVersion,this.cachedIndex=t}}});var nd=nt((wte,od)=>{"use strict";od.exports=Object.freeze({DISCONNECTED:1,PRECEDING:2,FOLLOWING:4,CONTAINS:8,CONTAINED_BY:16})});var cd=nt((bte,ud)=>{"use strict";var id=Symbol(),sd=Symbol(),Tt=Symbol(),ad=Symbol(),Ae=class{static{i(this,"TreeIterator")}constructor(e,t,o,n){this[id]=e,this[sd]=t,this[Tt]=o,this[ad]=n}next(){let e=this[id],t=this[ad],o=this[sd];if(!this[Tt])return{done:!0,value:o};let n=this[Tt];return t===1?this[Tt]=e._node(n).previousSibling:t===2?this[Tt]=e._node(n).nextSibling:t===3?this[Tt]=e._node(n).parent:t===4?this[Tt]=e.preceding(n,{root:o}):this[Tt]=e.following(n,{root:o}),{done:!1,value:n}}};Object.defineProperty(Ae.prototype,Symbol.iterator,{value:i(function(){return this},"value"),writable:!1}),Ae.PREV=1,Ae.NEXT=2,Ae.PARENT=3,Ae.PRECEDING=4,Ae.FOLLOWING=5,Object.freeze(Ae),Object.freeze(Ae.prototype),ud.exports=Ae});var ld=nt((Tte,fd)=>{"use strict";var Xx=rd(),Dt=nd(),Re=cd();function Na(){return!0}i(Na,"returnTrue");function Nr(r,e){return r[r.length-1-e]}i(Nr,"reverseArrayIndex");var us=class{static{i(this,"SymbolTree")}constructor(e){this.symbol=Symbol(e||"SymbolTree data")}initialize(e){return this._node(e),e}_node(e){if(!e)return null;let t=e[this.symbol];return t||(e[this.symbol]=new Xx)}hasChildren(e){return this._node(e).hasChildren}firstChild(e){return this._node(e).firstChild}lastChild(e){return this._node(e).lastChild}previousSibling(e){return this._node(e).previousSibling}nextSibling(e){return this._node(e).nextSibling}parent(e){return this._node(e).parent}lastInclusiveDescendant(e){let t,o=e;for(;t=this._node(o).lastChild;)o=t;return o}preceding(e,t){let o=t&&t.root;if(e===o)return null;let n=this._node(e).previousSibling;return n?this.lastInclusiveDescendant(n):this._node(e).parent}following(e,t){let o=t&&t.root,s=!(t&&t.skipChildren)&&this._node(e).firstChild;if(s)return s;let a=e;do{if(a===o)return null;let u=this._node(a).nextSibling;if(u)return u;a=this._node(a).parent}while(a);return null}childrenToArray(e,t){let o=t&&t.array||[],n=t&&t.filter||Na,s=t&&t.thisArg||void 0,a=this._node(e),u=a.firstChild,c=0;for(;u;){let f=this._node(u);f.setCachedIndex(a,c),n.call(s,u)&&o.push(u),u=f.nextSibling,++c}return o}ancestorsToArray(e,t){let o=t&&t.array||[],n=t&&t.filter||Na,s=t&&t.thisArg||void 0,a=e;for(;a;)n.call(s,a)&&o.push(a),a=this._node(a).parent;return o}treeToArray(e,t){let o=t&&t.array||[],n=t&&t.filter||Na,s=t&&t.thisArg||void 0,a=e;for(;a;)n.call(s,a)&&o.push(a),a=this.following(a,{root:e});return o}childrenIterator(e,t){let o=t&&t.reverse,n=this._node(e);return new Re(this,e,o?n.lastChild:n.firstChild,o?Re.PREV:Re.NEXT)}previousSiblingsIterator(e){return new Re(this,e,this._node(e).previousSibling,Re.PREV)}nextSiblingsIterator(e){return new Re(this,e,this._node(e).nextSibling,Re.NEXT)}ancestorsIterator(e){return new Re(this,e,e,Re.PARENT)}treeIterator(e,t){let o=t&&t.reverse;return new Re(this,e,o?this.lastInclusiveDescendant(e):e,o?Re.PRECEDING:Re.FOLLOWING)}index(e){let t=this._node(e),o=this._node(t.parent);if(!o)return-1;let n=t.getCachedIndex(o);if(n>=0)return n;n=0;let s=o.firstChild;if(o.childIndexCachedUpTo){let a=this._node(o.childIndexCachedUpTo);s=a.nextSibling,n=a.getCachedIndex(o)+1}for(;s;){let a=this._node(s);if(a.setCachedIndex(o,n),s===e)break;++n,s=a.nextSibling}return o.childIndexCachedUpTo=e,n}childrenCount(e){let t=this._node(e);return t.lastChild?this.index(t.lastChild)+1:0}compareTreePosition(e,t){if(e===t)return 0;let o=[];{let l=e;for(;l;){if(l===t)return Dt.CONTAINS|Dt.PRECEDING;o.push(l),l=this.parent(l)}}let n=[];{let l=t;for(;l;){if(l===e)return Dt.CONTAINED_BY|Dt.FOLLOWING;n.push(l),l=this.parent(l)}}let s=Nr(o,0);if(!s||s!==Nr(n,0))return Dt.DISCONNECTED;let a=0,u=Math.min(o.length,n.length);for(let l=0;l<u;++l){let m=Nr(o,l),p=Nr(n,l);if(m!==p)break;a=l}let c=this.index(Nr(o,a+1));return this.index(Nr(n,a+1))<c?Dt.PRECEDING:Dt.FOLLOWING}remove(e){let t=this._node(e),o=this._node(t.parent),n=this._node(t.previousSibling),s=this._node(t.nextSibling);return o&&(o.firstChild===e&&(o.firstChild=t.nextSibling),o.lastChild===e&&(o.lastChild=t.previousSibling)),n&&(n.nextSibling=t.nextSibling),s&&(s.previousSibling=t.previousSibling),t.parent=null,t.previousSibling=null,t.nextSibling=null,t.cachedIndex=-1,t.cachedIndexVersion=NaN,o&&o.childrenChanged(),e}insertBefore(e,t){let o=this._node(e),n=this._node(o.previousSibling),s=this._node(t),a=this._node(o.parent);if(s.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return s.parent=o.parent,s.previousSibling=o.previousSibling,s.nextSibling=e,o.previousSibling=t,n&&(n.nextSibling=t),a&&a.firstChild===e&&(a.firstChild=t),a&&a.childrenChanged(),t}insertAfter(e,t){let o=this._node(e),n=this._node(o.nextSibling),s=this._node(t),a=this._node(o.parent);if(s.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return s.parent=o.parent,s.previousSibling=e,s.nextSibling=o.nextSibling,o.nextSibling=t,n&&(n.previousSibling=t),a&&a.lastChild===e&&(a.lastChild=t),a&&a.childrenChanged(),t}prependChild(e,t){let o=this._node(e),n=this._node(t);if(n.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return o.hasChildren?this.insertBefore(o.firstChild,t):(n.parent=e,o.firstChild=t,o.lastChild=t,o.childrenChanged()),t}appendChild(e,t){let o=this._node(e),n=this._node(t);if(n.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return o.hasChildren?this.insertAfter(o.lastChild,t):(n.parent=e,o.firstChild=t,o.lastChild=t,o.childrenChanged()),t}};fd.exports=us,us.TreePosition=Dt});var kd=nt((aoe,Md)=>{"use strict";Md.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,o=e.cmp&&(function(s){return function(a){return function(u,c){var f={key:u,value:a[u]},l={key:c,value:a[c]};return s(f,l)}}})(e.cmp),n=[];return i((function s(a){if(a&&a.toJSON&&typeof a.toJSON=="function"&&(a=a.toJSON()),a!==void 0){if(typeof a=="number")return isFinite(a)?""+a:"null";if(typeof a!="object")return JSON.stringify(a);var u,c;if(Array.isArray(a)){for(c="[",u=0;u<a.length;u++)u&&(c+=","),c+=s(a[u])||"null";return c+"]"}if(a===null)return"null";if(n.indexOf(a)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var f=n.push(a)-1,l=Object.keys(a).sort(o&&o(a));for(c="",u=0;u<l.length;u++){var m=l[u],p=s(a[m]);p&&(c&&(c+=","),c+=JSON.stringify(m)+":"+p)}return n.splice(f,1),"{"+c+"}"}}),"stringify")(r)}});var A={};V(A,{Timeout:()=>zo,delayFor:()=>wu,delayForRandom:()=>Am});var R={};V(R,{CumulativeDeferred:()=>$o,Deferred:()=>jo,cumulativeDefer:()=>_m,defer:()=>it,fromCallback:()=>Wm,getFirstTrueOrFalse:()=>Fm,map:()=>Nm,rejectedPromise:()=>Pm,resolvedPromise:()=>Cm,timeoutAndContinue:()=>Rm,timeoutWrap:()=>gu});var jo=class{static{i(this,"Deferred")}claim(){if(this.claimed)throw new Error("Deferred already claimed");this.claimed=!0}get duration(){return this.stoppedAt?this.stoppedAt-this.startedAt:Date.now()-this.startedAt}constructor(){this.claimed=!1,this.promise=new Promise((e,t)=>{this.resolve=o=>{this.status="fulfilled",this.stoppedAt=Date.now(),e(o)},this.reject=o=>{this.status="rejected",this.stoppedAt=Date.now(),t(o)},this.startedAt=Date.now(),this.status="pending"})}},it=i(()=>new jo,"defer");var $o=class{static{i(this,"CumulativeDeferred")}constructor(){this.accumulatedPromises=[],this.deferred=it(),this.promise=this.deferred.promise,setTimeout(async()=>{for(;this.accumulatedPromises.length>0;)await this.accumulatedPromises.shift();this.deferred.resolve()},0)}subDefer(){let e=it();return this.addPromise(e.promise),e}addPromise(e){this.accumulatedPromises.push(e)}},_m=i(()=>new $o,"cumulativeDefer");function Cm(r){return Promise.resolve(r)}i(Cm,"resolvedPromise");var Pm=i(r=>Promise.reject(r),"rejectedPromise"),Nm=i(async(r,e)=>Promise.all(r.map(e)),"map"),gu=i(async(r,e,t=!0)=>new Promise((o,n)=>{let s,a=i(()=>{s!==void 0&&(clearTimeout(s),s=void 0)},"releaseTimeout");s=setTimeout(()=>{s=void 0,t?n(new Error("timeout")):o(null)},e),r.then(u=>{a(),o(u)},u=>{a(),n(u)})}),"timeoutWrap"),Rm=i(async(r,e=6e4)=>gu(r,e,!1),"timeoutAndContinue"),Fm=i(async r=>{let e=it();for(let t of r)t.then(o=>{o===!0&&e.resolve(!0)});return Promise.all(r).then(()=>{e.resolve(!1)}),e.promise},"getFirstTrueOrFalse"),Wm=i(r=>new Promise((e,t)=>{r((o,n)=>{o?t(o):e(n)})}),"fromCallback");var wu=i(async(r,e,t=!1)=>(await new zo(r,null,t).promise,e),"delayFor"),Am=i(async(r,e,t,o=!1)=>(await wu(Math.random()*(e-r)+r,null,o),t),"delayForRandom"),zo=class{static{i(this,"Timeout")}constructor(e,t,o=!1){this._cancelled=!1,this.timeoutInMillis=e,this._deferred=it(),this.promise=this._deferred.promise,this._timeout=setTimeout(()=>{this._cancelled||this._deferred.resolve(t)},e),this.started=Date.now(),o&&this.makeUnrefed()}makeUnrefed(){this._timeout.unref?.()}cancel(){this._cancelled=!0,clearTimeout(this._timeout)}getTimeLeft(){let e=this.started+this.timeoutInMillis-Date.now();return e>0?e:0}};var Vo={};var Et={};V(Et,{TYPED_REQUEST_REDACTED_PAYLOAD:()=>jr,TypedHandler:()=>su,TypedRequest:()=>cu,TypedRequestRetryLimitError:()=>As,TypedRequestTimeoutError:()=>Ws,TypedResponseError:()=>Fe,TypedRouter:()=>Ao,TypedTarget:()=>uu,VirtualStream:()=>Oe,VirtualStreamActivationScope:()=>Lo,VirtualStreamClosedError:()=>It});var ie={};V(ie,{AsyncExecutionStack:()=>Ra,BackpressuredArray:()=>Fa,FastMap:()=>So,Interest:()=>Mo,InterestMap:()=>Wa,LimitedArray:()=>Aa,LoopTracker:()=>La,ObjectMap:()=>Vt,Stringmap:()=>Ya,TimedAggregator:()=>ko,TimedAggregtor:()=>ko,Tree:()=>Ba,uni:()=>dd});var Zr={};V(Zr,{SmartMatch:()=>Us});var Xr={};V(Xr,{isMatch:()=>Hm,matcher:()=>Bm});function Hs(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}i(Hs,"escapeStringRegexp");var qs=new Map,bu=i((r,e)=>{if(!Array.isArray(r))switch(typeof r){case"string":r=[r];break;case"undefined":r=[];break;default:throw new TypeError(`Expected '${e}' to be a string or an array, but got a type of '${typeof r}'`)}return r.filter(t=>{if(typeof t!="string"){if(typeof t>"u")return!1;throw new TypeError(`Expected '${e}' to be an array of strings, but found a type of '${typeof t}' in the array`)}return!0})},"sanitizeArray"),Ym=i((r,e)=>{e={caseSensitive:!1,...e};let t=r+JSON.stringify(e);if(qs.has(t))return qs.get(t);let o=r[0]==="!";o&&(r=r.slice(1)),r=Hs(r).replace(/\\\*/g,"[\\s\\S]*");let n=new RegExp(`^${r}$`,e.caseSensitive?"":"i");return n.negated=o,qs.set(t,n),n},"makeRegexp"),vu=i((r,e,t,o)=>{if(r=bu(r,"inputs"),e=bu(e,"patterns"),e.length===0)return[];e=e.map(a=>Ym(a,t));let{allPatterns:n}=t||{},s=[];for(let a of r){let u,c=[...e].fill(!1);for(let[f,l]of e.entries())if(l.test(a)&&(c[f]=!0,u=!l.negated,!u))break;if(!(u===!1||u===void 0&&e.some(f=>!f.negated)||n&&c.some((f,l)=>!f&&!e[l].negated))&&(s.push(a),o))break}return s},"baseMatcher");function Bm(r,e,t){return vu(r,e,t,!1)}i(Bm,"matcher");function Hm(r,e,t){return vu(r,e,t,!0).length>0}i(Hm,"isMatch");var Us=class{static{i(this,"SmartMatch")}constructor(e){this.wildcard=e}match(e){return Xr.isMatch(e,this.wildcard)}};var Ce={};V(Ce,{ObservableIntake:()=>ma,Observablemap:()=>da,fromStreamWithBackpressure:()=>wy,rxjs:()=>ur});var ur={};V(ur,{Observable:()=>H,ReplaySubject:()=>Zo,Subject:()=>He,Subscription:()=>be,from:()=>Ft,fromEvent:()=>At,of:()=>fa,ops:()=>gy});var js=i(function(r,e){return js=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])},js(r,e)},"extendStatics");function ae(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");js(r,e);function t(){this.constructor=r}i(t,"__"),r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}i(ae,"__extends");var $s=i(function(){return $s=Object.assign||i(function(e){for(var t,o=1,n=arguments.length;o<n;o++){t=arguments[o];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),$s.apply(this,arguments)},"__assign");function jm(r,e){var t={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.indexOf(o)<0&&(t[o]=r[o]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,o=Object.getOwnPropertySymbols(r);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(r,o[n])&&(t[o[n]]=r[o[n]]);return t}i(jm,"__rest");function $m(r,e,t,o){var n=arguments.length,s=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,o);else for(var u=r.length-1;u>=0;u--)(a=r[u])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}i($m,"__decorate");function zm(r,e){return function(t,o){e(t,o,r)}}i(zm,"__param");function Vm(r,e,t,o,n,s){function a(T){if(T!==void 0&&typeof T!="function")throw new TypeError("Function expected");return T}i(a,"accept");for(var u=o.kind,c=u==="getter"?"get":u==="setter"?"set":"value",f=!e&&r?o.static?r:r.prototype:null,l=e||(f?Object.getOwnPropertyDescriptor(f,o.name):{}),m,p=!1,h=t.length-1;h>=0;h--){var g={};for(var x in o)g[x]=x==="access"?{}:o[x];for(var x in o.access)g.access[x]=o.access[x];g.addInitializer=function(T){if(p)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(T||null))};var w=(0,t[h])(u==="accessor"?{get:l.get,set:l.set}:l[c],g);if(u==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(m=a(w.get))&&(l.get=m),(m=a(w.set))&&(l.set=m),(m=a(w.init))&&n.unshift(m)}else(m=a(w))&&(u==="field"?n.unshift(m):l[c]=m)}f&&Object.defineProperty(f,o.name,l),p=!0}i(Vm,"__esDecorate");function Gm(r,e,t){for(var o=arguments.length>2,n=0;n<e.length;n++)t=o?e[n].call(r,t):e[n].call(r);return o?t:void 0}i(Gm,"__runInitializers");function Qm(r){return typeof r=="symbol"?r:"".concat(r)}i(Qm,"__propKey");function Jm(r,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(r,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}i(Jm,"__setFunctionName");function Km(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}i(Km,"__metadata");function Gs(r,e,t,o){function n(s){return s instanceof t?s:new t(function(a){a(s)})}return i(n,"adopt"),new(t||(t=Promise))(function(s,a){function u(l){try{f(o.next(l))}catch(m){a(m)}}i(u,"fulfilled");function c(l){try{f(o.throw(l))}catch(m){a(m)}}i(c,"rejected");function f(l){l.done?s(l.value):n(l.value).then(u,c)}i(f,"step"),f((o=o.apply(r,e||[])).next())})}i(Gs,"__awaiter");function eo(r,e){var t={label:0,sent:i(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},o,n,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(f){return function(l){return c([f,l])}}function c(f){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,f[0]&&(t=0)),t;)try{if(o=1,n&&(s=f[0]&2?n.return:f[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,f[1])).done)return s;switch(n=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,n=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){t.label=f[1];break}if(f[0]===6&&t.label<s[1]){t.label=s[1],s=f;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(f);break}s[2]&&t.ops.pop(),t.trys.pop();continue}f=e.call(r,t)}catch(l){f=[6,l],n=0}finally{o=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}i(eo,"__generator");var zs=Object.create?(function(r,e,t,o){o===void 0&&(o=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:i(function(){return e[t]},"get")}),Object.defineProperty(r,o,n)}):(function(r,e,t,o){o===void 0&&(o=t),r[o]=e[t]});function Xm(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&zs(e,r,t)}i(Xm,"__exportStar");function fe(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],o=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:i(function(){return r&&o>=r.length&&(r=void 0),{value:r&&r[o++],done:!r}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}i(fe,"__values");function ye(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var o=t.call(r),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(u){a={error:u}}finally{try{n&&!n.done&&(t=o.return)&&t.call(o)}finally{if(a)throw a.error}}return s}i(ye,"__read");function Zm(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(ye(arguments[e]));return r}i(Zm,"__spread");function ep(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var o=Array(r),n=0,e=0;e<t;e++)for(var s=arguments[e],a=0,u=s.length;a<u;a++,n++)o[n]=s[a];return o}i(ep,"__spreadArrays");function Ee(r,e,t){if(t||arguments.length===2)for(var o=0,n=e.length,s;o<n;o++)(s||!(o in e))&&(s||(s=Array.prototype.slice.call(e,0,o)),s[o]=e[o]);return r.concat(s||Array.prototype.slice.call(e))}i(Ee,"__spreadArray");function Xe(r){return this instanceof Xe?(this.v=r,this):new Xe(r)}i(Xe,"__await");function Qs(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=t.apply(r,e||[]),n,s=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(h){return function(g){return Promise.resolve(g).then(h,m)}}function u(h,g){o[h]&&(n[h]=function(x){return new Promise(function(w,T){s.push([h,x,w,T])>1||c(h,x)})},g&&(n[h]=g(n[h])))}function c(h,g){try{f(o[h](g))}catch(x){p(s[0][3],x)}}function f(h){h.value instanceof Xe?Promise.resolve(h.value.v).then(l,m):p(s[0][2],h)}function l(h){c("next",h)}function m(h){c("throw",h)}function p(h,g){h(g),s.shift(),s.length&&c(s[0][0],s[0][1])}}i(Qs,"__asyncGenerator");function tp(r){var e,t;return e={},o("next"),o("throw",function(n){throw n}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(n,s){e[n]=r[n]?function(a){return(t=!t)?{value:Xe(r[n](a)),done:!1}:s?s(a):a}:s}}i(tp,"__asyncDelegator");function Js(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof fe=="function"?fe(r):r[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(s){t[s]=r[s]&&function(a){return new Promise(function(u,c){a=r[s](a),n(u,c,a.done,a.value)})}}function n(s,a,u,c){Promise.resolve(c).then(function(f){s({value:f,done:u})},a)}}i(Js,"__asyncValues");function rp(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}i(rp,"__makeTemplateObject");var op=Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e},Vs=i(function(r){return Vs=Object.getOwnPropertyNames||function(e){var t=[];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[t.length]=o);return t},Vs(r)},"ownKeys");function np(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t=Vs(r),o=0;o<t.length;o++)t[o]!=="default"&&zs(e,r,t[o]);return op(e,r),e}i(np,"__importStar");function ip(r){return r&&r.__esModule?r:{default:r}}i(ip,"__importDefault");function sp(r,e,t,o){if(t==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!o:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?o:t==="a"?o.call(r):o?o.value:e.get(r)}i(sp,"__classPrivateFieldGet");function ap(r,e,t,o,n){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t}i(ap,"__classPrivateFieldSet");function up(r,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?e===r:r.has(e)}i(up,"__classPrivateFieldIn");function cp(r,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var o,n;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=e[Symbol.asyncDispose]}if(o===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=e[Symbol.dispose],t&&(n=o)}if(typeof o!="function")throw new TypeError("Object not disposable.");n&&(o=i(function(){try{n.call(this)}catch(s){return Promise.reject(s)}},"dispose")),r.stack.push({value:e,dispose:o,async:t})}else t&&r.stack.push({async:!0});return e}i(cp,"__addDisposableResource");var fp=typeof SuppressedError=="function"?SuppressedError:function(r,e,t){var o=new Error(t);return o.name="SuppressedError",o.error=r,o.suppressed=e,o};function lp(r){function e(s){r.error=r.hasError?new fp(s,r.error,"An error was suppressed during disposal."):s,r.hasError=!0}i(e,"fail");var t,o=0;function n(){for(;t=r.stack.pop();)try{if(!t.async&&o===1)return o=0,r.stack.push(t),Promise.resolve().then(n);if(t.dispose){var s=t.dispose.call(t.value);if(t.async)return o|=2,Promise.resolve(s).then(n,function(a){return e(a),n()})}else o|=1}catch(a){e(a)}if(o===1)return r.hasError?Promise.reject(r.error):Promise.resolve();if(r.hasError)throw r.error}return i(n,"next"),n()}i(lp,"__disposeResources");function dp(r,e){return typeof r=="string"&&/^\.\.?\//.test(r)?r.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,o,n,s,a){return o?e?".jsx":".js":n&&(!s||!a)?t:n+s+"."+a.toLowerCase()+"js"}):r}i(dp,"__rewriteRelativeImportExtension");var Ib={__extends:ae,__assign:$s,__rest:jm,__decorate:$m,__param:zm,__esDecorate:Vm,__runInitializers:Gm,__propKey:Qm,__setFunctionName:Jm,__metadata:Km,__awaiter:Gs,__generator:eo,__createBinding:zs,__exportStar:Xm,__values:fe,__read:ye,__spread:Zm,__spreadArrays:ep,__spreadArray:Ee,__await:Xe,__asyncGenerator:Qs,__asyncDelegator:tp,__asyncValues:Js,__makeTemplateObject:rp,__importStar:np,__importDefault:ip,__classPrivateFieldGet:sp,__classPrivateFieldSet:ap,__classPrivateFieldIn:up,__addDisposableResource:cp,__disposeResources:lp,__rewriteRelativeImportExtension:dp};function E(r){return typeof r=="function"}i(E,"isFunction");function Qo(r){var e=i(function(o){Error.call(o),o.stack=new Error().stack},"_super"),t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}i(Qo,"createErrorClass");var to=Qo(function(r){return i(function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
1
+ var Pp=Object.create;var Uo=Object.defineProperty;var _p=Object.getOwnPropertyDescriptor;var Rp=Object.getOwnPropertyNames;var Np=Object.getPrototypeOf,Wp=Object.prototype.hasOwnProperty;var i=(r,e)=>Uo(r,"name",{value:e,configurable:!0});var nt=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},A=(r,e)=>{for(var t in e)Uo(r,t,{get:e[t],enumerable:!0})},Fp=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Rp(e))!Wp.call(r,n)&&n!==t&&Uo(r,n,{get:()=>e[n],enumerable:!(o=_p(e,n))||o.enumerable});return r};var or=(r,e,t)=>(t=r!=null?Pp(Np(r)):{},Fp(e||!r||!r.__esModule?Uo(t,"default",{value:r,enumerable:!0}):t,r));var Us=nt(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0}),Ao.uni=void 0;var zp=i((r="uni")=>`${r}_${"xxxxxxxxxxxxxxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}`,"uni");Ao.uni=zp});var rd=nt((Sa,Ma)=>{(function(r,e){typeof Sa=="object"&&typeof Ma<"u"?Ma.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self).dayjs=e()})(Sa,(function(){"use strict";var r=1e3,e=6e4,t=36e5,o="millisecond",n="second",s="minute",a="hour",u="day",c="week",f="month",l="quarter",p="year",m="date",h="Invalid Date",x=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:i(function(k){var D=["th","st","nd","rd"],b=k%100;return"["+k+(D[(b-20)%10]||D[b]||D[0])+"]"},"ordinal")},v=i(function(k,D,b){var E=String(k);return!E||E.length>=D?k:""+Array(D+1-E.length).join(b)+k},"m"),G={s:v,z:i(function(k){var D=-k.utcOffset(),b=Math.abs(D),E=Math.floor(b/60),T=b%60;return(D<=0?"+":"-")+v(E,2,"0")+":"+v(T,2,"0")},"z"),m:i(function k(D,b){if(D.date()<b.date())return-k(b,D);var E=12*(b.year()-D.year())+(b.month()-D.month()),T=D.clone().add(E,f),P=b-T<0,_=D.clone().add(E+(P?-1:1),f);return+(-(E+(b-T)/(P?T-_:_-T))||0)},"t"),a:i(function(k){return k<0?Math.ceil(k)||0:Math.floor(k)},"a"),p:i(function(k){return{M:f,y:p,w:c,d:u,D:m,h:a,m:s,s:n,ms:o,Q:l}[k]||String(k||"").toLowerCase().replace(/s$/,"")},"p"),u:i(function(k){return k===void 0},"u")},te="en",ae={};ae[te]=w;var rt="$isDayjsObject",Qe=i(function(k){return k instanceof jo||!(!k||!k[rt])},"S"),tr=i(function k(D,b,E){var T;if(!D)return te;if(typeof D=="string"){var P=D.toLowerCase();ae[P]&&(T=P),b&&(ae[P]=b,T=P);var _=D.split("-");if(!T&&_.length>1)return k(_[0])}else{var $=D.name;ae[$]=D,T=$}return!E&&T&&(te=T),T||!E&&te},"t"),re=i(function(k,D){if(Qe(k))return k.clone();var b=typeof D=="object"?D:{};return b.date=k,b.args=arguments,new jo(b)},"O"),q=G;q.l=tr,q.i=Qe,q.w=function(k,D){return re(k,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var jo=(function(){function k(b){this.$L=tr(b.locale,null,!0),this.parse(b),this.$x=this.$x||b.x||{},this[rt]=!0}i(k,"M");var D=k.prototype;return D.parse=function(b){this.$d=(function(E){var T=E.date,P=E.utc;if(T===null)return new Date(NaN);if(q.u(T))return new Date;if(T instanceof Date)return new Date(T);if(typeof T=="string"&&!/Z$/i.test(T)){var _=T.match(x);if(_){var $=_[2]-1||0,K=(_[7]||"0").substring(0,3);return P?new Date(Date.UTC(_[1],$,_[3]||1,_[4]||0,_[5]||0,_[6]||0,K)):new Date(_[1],$,_[3]||1,_[4]||0,_[5]||0,_[6]||0,K)}}return new Date(T)})(b),this.init()},D.init=function(){var b=this.$d;this.$y=b.getFullYear(),this.$M=b.getMonth(),this.$D=b.getDate(),this.$W=b.getDay(),this.$H=b.getHours(),this.$m=b.getMinutes(),this.$s=b.getSeconds(),this.$ms=b.getMilliseconds()},D.$utils=function(){return q},D.isValid=function(){return this.$d.toString()!==h},D.isSame=function(b,E){var T=re(b);return this.startOf(E)<=T&&T<=this.endOf(E)},D.isAfter=function(b,E){return re(b)<this.startOf(E)},D.isBefore=function(b,E){return this.endOf(E)<re(b)},D.$g=function(b,E,T){return q.u(b)?this[E]:this.set(T,b)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(b,E){var T=this,P=!!q.u(E)||E,_=q.p(b),$=i(function(Ct,ve){var ot=q.w(T.$u?Date.UTC(T.$y,ve,Ct):new Date(T.$y,ve,Ct),T);return P?ot:ot.endOf(u)},"l"),K=i(function(Ct,ve){return q.w(T.toDate()[Ct].apply(T.toDate("s"),(P?[0,0,0,0]:[23,59,59,999]).slice(ve)),T)},"$"),oe=this.$W,fe=this.$M,ke=this.$D,rr="set"+(this.$u?"UTC":"");switch(_){case p:return P?$(1,0):$(31,11);case f:return P?$(1,fe):$(0,fe+1);case c:var It=this.$locale().weekStart||0,Kr=(oe<It?oe+7:oe)-It;return $(P?ke-Kr:ke+(6-Kr),fe);case u:case m:return K(rr+"Hours",0);case a:return K(rr+"Minutes",1);case s:return K(rr+"Seconds",2);case n:return K(rr+"Milliseconds",3);default:return this.clone()}},D.endOf=function(b){return this.startOf(b,!1)},D.$set=function(b,E){var T,P=q.p(b),_="set"+(this.$u?"UTC":""),$=(T={},T[u]=_+"Date",T[m]=_+"Date",T[f]=_+"Month",T[p]=_+"FullYear",T[a]=_+"Hours",T[s]=_+"Minutes",T[n]=_+"Seconds",T[o]=_+"Milliseconds",T)[P],K=P===u?this.$D+(E-this.$W):E;if(P===f||P===p){var oe=this.clone().set(m,1);oe.$d[$](K),oe.init(),this.$d=oe.set(m,Math.min(this.$D,oe.daysInMonth())).$d}else $&&this.$d[$](K);return this.init(),this},D.set=function(b,E){return this.clone().$set(b,E)},D.get=function(b){return this[q.p(b)]()},D.add=function(b,E){var T,P=this;b=Number(b);var _=q.p(E),$=i(function(fe){var ke=re(P);return q.w(ke.date(ke.date()+Math.round(fe*b)),P)},"y");if(_===f)return this.set(f,this.$M+b);if(_===p)return this.set(p,this.$y+b);if(_===u)return $(1);if(_===c)return $(7);var K=(T={},T[s]=e,T[a]=t,T[n]=r,T)[_]||1,oe=this.$d.getTime()+b*K;return q.w(oe,this)},D.subtract=function(b,E){return this.add(-1*b,E)},D.format=function(b){var E=this,T=this.$locale();if(!this.isValid())return T.invalidDate||h;var P=b||"YYYY-MM-DDTHH:mm:ssZ",_=q.z(this),$=this.$H,K=this.$m,oe=this.$M,fe=T.weekdays,ke=T.months,rr=T.meridiem,It=i(function(ve,ot,Qr,Ho){return ve&&(ve[ot]||ve(E,P))||Qr[ot].slice(0,Ho)},"h"),Kr=i(function(ve){return q.s($%12||12,ve,"0")},"d"),Ct=rr||function(ve,ot,Qr){var Ho=ve<12?"AM":"PM";return Qr?Ho.toLowerCase():Ho};return P.replace(g,(function(ve,ot){return ot||(function(Qr){switch(Qr){case"YY":return String(E.$y).slice(-2);case"YYYY":return q.s(E.$y,4,"0");case"M":return oe+1;case"MM":return q.s(oe+1,2,"0");case"MMM":return It(T.monthsShort,oe,ke,3);case"MMMM":return It(ke,oe);case"D":return E.$D;case"DD":return q.s(E.$D,2,"0");case"d":return String(E.$W);case"dd":return It(T.weekdaysMin,E.$W,fe,2);case"ddd":return It(T.weekdaysShort,E.$W,fe,3);case"dddd":return fe[E.$W];case"H":return String($);case"HH":return q.s($,2,"0");case"h":return Kr(1);case"hh":return Kr(2);case"a":return Ct($,K,!0);case"A":return Ct($,K,!1);case"m":return String(K);case"mm":return q.s(K,2,"0");case"s":return String(E.$s);case"ss":return q.s(E.$s,2,"0");case"SSS":return q.s(E.$ms,3,"0");case"Z":return _}return null})(ve)||_.replace(":","")}))},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(b,E,T){var P,_=this,$=q.p(E),K=re(b),oe=(K.utcOffset()-this.utcOffset())*e,fe=this-K,ke=i(function(){return q.m(_,K)},"D");switch($){case p:P=ke()/12;break;case f:P=ke();break;case l:P=ke()/3;break;case c:P=(fe-oe)/6048e5;break;case u:P=(fe-oe)/864e5;break;case a:P=fe/t;break;case s:P=fe/e;break;case n:P=fe/r;break;default:P=fe}return T?P:q.a(P)},D.daysInMonth=function(){return this.endOf(f).$D},D.$locale=function(){return ae[this.$L]},D.locale=function(b,E){if(!b)return this.$L;var T=this.clone(),P=tr(b,E,!0);return P&&(T.$L=P),T},D.clone=function(){return q.w(this.$d,this)},D.toDate=function(){return new Date(this.valueOf())},D.toJSON=function(){return this.isValid()?this.toISOString():null},D.toISOString=function(){return this.$d.toISOString()},D.toString=function(){return this.$d.toUTCString()},k})(),Tu=jo.prototype;return re.prototype=Tu,[["$ms",o],["$s",n],["$m",s],["$H",a],["$W",u],["$M",f],["$y",p],["$D",m]].forEach((function(k){Tu[k[1]]=function(D){return this.$g(D,k[0],k[1])}})),re.extend=function(k,D){return k.$i||(k(D,jo,re),k.$i=!0),re},re.locale=tr,re.isDayjs=Qe,re.unix=function(k){return re(1e3*k)},re.en=ae[te],re.Ls=ae,re.p={},re}))});var od=nt((Oa,Ea)=>{(function(r,e){typeof Oa=="object"&&typeof Ea<"u"?Ea.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self).dayjs_plugin_isToday=e()})(Oa,(function(){"use strict";return function(r,e,t){e.prototype.isToday=function(){var o="YYYY-MM-DD",n=t();return this.format(o)===n.format(o)}}}))});var ad=nt((Ete,sd)=>{"use strict";sd.exports=class{static{i(this,"SymbolTreeNode")}constructor(){this.parent=null,this.previousSibling=null,this.nextSibling=null,this.firstChild=null,this.lastChild=null,this.childrenVersion=0,this.childIndexCachedUpTo=null,this.cachedIndex=-1,this.cachedIndexVersion=NaN}get isAttached(){return!!(this.parent||this.previousSibling||this.nextSibling)}get hasChildren(){return!!this.firstChild}childrenChanged(){this.childrenVersion=this.childrenVersion+1&4294967295,this.childIndexCachedUpTo=null}getCachedIndex(e){return this.cachedIndexVersion!==e.childrenVersion?(this.cachedIndexVersion=NaN,-1):this.cachedIndex}setCachedIndex(e,t){this.cachedIndexVersion=e.childrenVersion,this.cachedIndex=t}}});var cd=nt((Ite,ud)=>{"use strict";ud.exports=Object.freeze({DISCONNECTED:1,PRECEDING:2,FOLLOWING:4,CONTAINS:8,CONTAINED_BY:16})});var md=nt((Cte,pd)=>{"use strict";var fd=Symbol(),ld=Symbol(),Tt=Symbol(),dd=Symbol(),Le=class{static{i(this,"TreeIterator")}constructor(e,t,o,n){this[fd]=e,this[ld]=t,this[Tt]=o,this[dd]=n}next(){let e=this[fd],t=this[dd],o=this[ld];if(!this[Tt])return{done:!0,value:o};let n=this[Tt];return t===1?this[Tt]=e._node(n).previousSibling:t===2?this[Tt]=e._node(n).nextSibling:t===3?this[Tt]=e._node(n).parent:t===4?this[Tt]=e.preceding(n,{root:o}):this[Tt]=e.following(n,{root:o}),{done:!1,value:n}}};Object.defineProperty(Le.prototype,Symbol.iterator,{value:i(function(){return this},"value"),writable:!1}),Le.PREV=1,Le.NEXT=2,Le.PARENT=3,Le.PRECEDING=4,Le.FOLLOWING=5,Object.freeze(Le),Object.freeze(Le.prototype),pd.exports=Le});var yd=nt((_te,hd)=>{"use strict";var ig=ad(),Dt=cd(),Ne=md();function Wa(){return!0}i(Wa,"returnTrue");function Nr(r,e){return r[r.length-1-e]}i(Nr,"reverseArrayIndex");var as=class{static{i(this,"SymbolTree")}constructor(e){this.symbol=Symbol(e||"SymbolTree data")}initialize(e){return this._node(e),e}_node(e){if(!e)return null;let t=e[this.symbol];return t||(e[this.symbol]=new ig)}hasChildren(e){return this._node(e).hasChildren}firstChild(e){return this._node(e).firstChild}lastChild(e){return this._node(e).lastChild}previousSibling(e){return this._node(e).previousSibling}nextSibling(e){return this._node(e).nextSibling}parent(e){return this._node(e).parent}lastInclusiveDescendant(e){let t,o=e;for(;t=this._node(o).lastChild;)o=t;return o}preceding(e,t){let o=t&&t.root;if(e===o)return null;let n=this._node(e).previousSibling;return n?this.lastInclusiveDescendant(n):this._node(e).parent}following(e,t){let o=t&&t.root,s=!(t&&t.skipChildren)&&this._node(e).firstChild;if(s)return s;let a=e;do{if(a===o)return null;let u=this._node(a).nextSibling;if(u)return u;a=this._node(a).parent}while(a);return null}childrenToArray(e,t){let o=t&&t.array||[],n=t&&t.filter||Wa,s=t&&t.thisArg||void 0,a=this._node(e),u=a.firstChild,c=0;for(;u;){let f=this._node(u);f.setCachedIndex(a,c),n.call(s,u)&&o.push(u),u=f.nextSibling,++c}return o}ancestorsToArray(e,t){let o=t&&t.array||[],n=t&&t.filter||Wa,s=t&&t.thisArg||void 0,a=e;for(;a;)n.call(s,a)&&o.push(a),a=this._node(a).parent;return o}treeToArray(e,t){let o=t&&t.array||[],n=t&&t.filter||Wa,s=t&&t.thisArg||void 0,a=e;for(;a;)n.call(s,a)&&o.push(a),a=this.following(a,{root:e});return o}childrenIterator(e,t){let o=t&&t.reverse,n=this._node(e);return new Ne(this,e,o?n.lastChild:n.firstChild,o?Ne.PREV:Ne.NEXT)}previousSiblingsIterator(e){return new Ne(this,e,this._node(e).previousSibling,Ne.PREV)}nextSiblingsIterator(e){return new Ne(this,e,this._node(e).nextSibling,Ne.NEXT)}ancestorsIterator(e){return new Ne(this,e,e,Ne.PARENT)}treeIterator(e,t){let o=t&&t.reverse;return new Ne(this,e,o?this.lastInclusiveDescendant(e):e,o?Ne.PRECEDING:Ne.FOLLOWING)}index(e){let t=this._node(e),o=this._node(t.parent);if(!o)return-1;let n=t.getCachedIndex(o);if(n>=0)return n;n=0;let s=o.firstChild;if(o.childIndexCachedUpTo){let a=this._node(o.childIndexCachedUpTo);s=a.nextSibling,n=a.getCachedIndex(o)+1}for(;s;){let a=this._node(s);if(a.setCachedIndex(o,n),s===e)break;++n,s=a.nextSibling}return o.childIndexCachedUpTo=e,n}childrenCount(e){let t=this._node(e);return t.lastChild?this.index(t.lastChild)+1:0}compareTreePosition(e,t){if(e===t)return 0;let o=[];{let l=e;for(;l;){if(l===t)return Dt.CONTAINS|Dt.PRECEDING;o.push(l),l=this.parent(l)}}let n=[];{let l=t;for(;l;){if(l===e)return Dt.CONTAINED_BY|Dt.FOLLOWING;n.push(l),l=this.parent(l)}}let s=Nr(o,0);if(!s||s!==Nr(n,0))return Dt.DISCONNECTED;let a=0,u=Math.min(o.length,n.length);for(let l=0;l<u;++l){let p=Nr(o,l),m=Nr(n,l);if(p!==m)break;a=l}let c=this.index(Nr(o,a+1));return this.index(Nr(n,a+1))<c?Dt.PRECEDING:Dt.FOLLOWING}remove(e){let t=this._node(e),o=this._node(t.parent),n=this._node(t.previousSibling),s=this._node(t.nextSibling);return o&&(o.firstChild===e&&(o.firstChild=t.nextSibling),o.lastChild===e&&(o.lastChild=t.previousSibling)),n&&(n.nextSibling=t.nextSibling),s&&(s.previousSibling=t.previousSibling),t.parent=null,t.previousSibling=null,t.nextSibling=null,t.cachedIndex=-1,t.cachedIndexVersion=NaN,o&&o.childrenChanged(),e}insertBefore(e,t){let o=this._node(e),n=this._node(o.previousSibling),s=this._node(t),a=this._node(o.parent);if(s.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return s.parent=o.parent,s.previousSibling=o.previousSibling,s.nextSibling=e,o.previousSibling=t,n&&(n.nextSibling=t),a&&a.firstChild===e&&(a.firstChild=t),a&&a.childrenChanged(),t}insertAfter(e,t){let o=this._node(e),n=this._node(o.nextSibling),s=this._node(t),a=this._node(o.parent);if(s.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return s.parent=o.parent,s.previousSibling=e,s.nextSibling=o.nextSibling,o.nextSibling=t,n&&(n.previousSibling=t),a&&a.lastChild===e&&(a.lastChild=t),a&&a.childrenChanged(),t}prependChild(e,t){let o=this._node(e),n=this._node(t);if(n.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return o.hasChildren?this.insertBefore(o.firstChild,t):(n.parent=e,o.firstChild=t,o.lastChild=t,o.childrenChanged()),t}appendChild(e,t){let o=this._node(e),n=this._node(t);if(n.isAttached)throw Error("Given object is already present in this SymbolTree, remove it first");return o.hasChildren?this.insertAfter(o.lastChild,t):(n.parent=e,o.firstChild=t,o.lastChild=t,o.childrenChanged()),t}};hd.exports=as,as.TreePosition=Dt});var Pd=nt((xoe,Cd)=>{"use strict";Cd.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,o=e.cmp&&(function(s){return function(a){return function(u,c){var f={key:u,value:a[u]},l={key:c,value:a[c]};return s(f,l)}}})(e.cmp),n=[];return i((function s(a){if(a&&a.toJSON&&typeof a.toJSON=="function"&&(a=a.toJSON()),a!==void 0){if(typeof a=="number")return isFinite(a)?""+a:"null";if(typeof a!="object")return JSON.stringify(a);var u,c;if(Array.isArray(a)){for(c="[",u=0;u<a.length;u++)u&&(c+=","),c+=s(a[u])||"null";return c+"]"}if(a===null)return"null";if(n.indexOf(a)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var f=n.push(a)-1,l=Object.keys(a).sort(o&&o(a));for(c="",u=0;u<l.length;u++){var p=l[u],m=s(a[p]);m&&(c&&(c+=","),c+=JSON.stringify(p)+":"+m)}return n.splice(f,1),"{"+c+"}"}}),"stringify")(r)}});var H={};A(H,{Timeout:()=>zo,delayFor:()=>Su,delayForRandom:()=>Bp});var F={};A(F,{CumulativeDeferred:()=>Bo,Deferred:()=>$o,cumulativeDefer:()=>Lp,defer:()=>it,fromCallback:()=>$p,getFirstTrueOrFalse:()=>Up,map:()=>jp,rejectedPromise:()=>qp,resolvedPromise:()=>Yp,timeoutAndContinue:()=>Hp,timeoutWrap:()=>Du});var $o=class{static{i(this,"Deferred")}claim(){if(this.claimed)throw new Error("Deferred already claimed");this.claimed=!0}get duration(){return this.stoppedAt?this.stoppedAt-this.startedAt:Date.now()-this.startedAt}constructor(){this.claimed=!1,this.promise=new Promise((e,t)=>{this.resolve=o=>{this.status="fulfilled",this.stoppedAt=Date.now(),e(o)},this.reject=o=>{this.status="rejected",this.stoppedAt=Date.now(),t(o)},this.startedAt=Date.now(),this.status="pending"})}},it=i(()=>new $o,"defer");var Bo=class{static{i(this,"CumulativeDeferred")}constructor(){this.accumulatedPromises=[],this.deferred=it(),this.promise=this.deferred.promise,setTimeout(async()=>{for(;this.accumulatedPromises.length>0;)await this.accumulatedPromises.shift();this.deferred.resolve()},0)}subDefer(){let e=it();return this.addPromise(e.promise),e}addPromise(e){this.accumulatedPromises.push(e)}},Lp=i(()=>new Bo,"cumulativeDefer");function Yp(r){return Promise.resolve(r)}i(Yp,"resolvedPromise");var qp=i(r=>Promise.reject(r),"rejectedPromise"),jp=i(async(r,e)=>Promise.all(r.map(e)),"map"),Du=i(async(r,e,t=!0)=>new Promise((o,n)=>{let s,a=i(()=>{s!==void 0&&(clearTimeout(s),s=void 0)},"releaseTimeout");s=setTimeout(()=>{s=void 0,t?n(new Error("timeout")):o(null)},e),r.then(u=>{a(),o(u)},u=>{a(),n(u)})}),"timeoutWrap"),Hp=i(async(r,e=6e4)=>Du(r,e,!1),"timeoutAndContinue"),Up=i(async r=>{let e=it();for(let t of r)t.then(o=>{o===!0&&e.resolve(!0)});return Promise.all(r).then(()=>{e.resolve(!1)}),e.promise},"getFirstTrueOrFalse"),$p=i(r=>new Promise((e,t)=>{r((o,n)=>{o?t(o):e(n)})}),"fromCallback");var Su=i(async(r,e,t=!1)=>(await new zo(r,null,t).promise,e),"delayFor"),Bp=i(async(r,e,t,o=!1)=>(await Su(Math.random()*(e-r)+r,null,o),t),"delayForRandom"),zo=class{static{i(this,"Timeout")}constructor(e,t,o=!1){this._cancelled=!1,this.timeoutInMillis=e,this._deferred=it(),this.promise=this._deferred.promise,this._timeout=setTimeout(()=>{this._cancelled||this._deferred.resolve(t)},e),this.started=Date.now(),o&&this.makeUnrefed()}makeUnrefed(){this._timeout.unref?.()}cancel(){this._cancelled=!0,clearTimeout(this._timeout)}getTimeLeft(){let e=this.started+this.timeoutInMillis-Date.now();return e>0?e:0}};var Vo={};var kt={};A(kt,{TYPED_REQUEST_REDACTED_PAYLOAD:()=>zr,TypedHandler:()=>du,TypedRequest:()=>hu,TypedRequestRetryLimitError:()=>qs,TypedRequestTimeoutError:()=>Ys,TypedResponseError:()=>We,TypedRouter:()=>pu,TypedTarget:()=>mu,VirtualStream:()=>Ye,VirtualStreamActivationScope:()=>et,VirtualStreamClosedError:()=>Qt,VirtualStreamLifecycleContractError:()=>Is,VirtualStreamOpenTimeoutError:()=>Xt,getTypedRequestResponseInterestKey:()=>Ws});var Se={};A(Se,{AsyncExecutionStack:()=>Fa,BackpressuredArray:()=>La,FastMap:()=>So,Interest:()=>Mo,InterestMap:()=>Ya,LimitedArray:()=>qa,LoopTracker:()=>ja,ObjectMap:()=>Vt,Stringmap:()=>Ha,TimedAggregator:()=>Oo,TimedAggregtor:()=>Oo,Tree:()=>Ua,uni:()=>xd});var Zr={};A(Zr,{SmartMatch:()=>zs});var Xr={};A(Xr,{isMatch:()=>Gp,matcher:()=>Ap});function $s(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}i($s,"escapeStringRegexp");var Bs=new Map,Mu=i((r,e)=>{if(!Array.isArray(r))switch(typeof r){case"string":r=[r];break;case"undefined":r=[];break;default:throw new TypeError(`Expected '${e}' to be a string or an array, but got a type of '${typeof r}'`)}return r.filter(t=>{if(typeof t!="string"){if(typeof t>"u")return!1;throw new TypeError(`Expected '${e}' to be an array of strings, but found a type of '${typeof t}' in the array`)}return!0})},"sanitizeArray"),Vp=i((r,e)=>{e={caseSensitive:!1,...e};let t=r+JSON.stringify(e);if(Bs.has(t))return Bs.get(t);let o=r[0]==="!";o&&(r=r.slice(1)),r=$s(r).replace(/\\\*/g,"[\\s\\S]*");let n=new RegExp(`^${r}$`,e.caseSensitive?"":"i");return n.negated=o,Bs.set(t,n),n},"makeRegexp"),Ou=i((r,e,t,o)=>{if(r=Mu(r,"inputs"),e=Mu(e,"patterns"),e.length===0)return[];e=e.map(a=>Vp(a,t));let{allPatterns:n}=t||{},s=[];for(let a of r){let u,c=[...e].fill(!1);for(let[f,l]of e.entries())if(l.test(a)&&(c[f]=!0,u=!l.negated,!u))break;if(!(u===!1||u===void 0&&e.some(f=>!f.negated)||n&&c.some((f,l)=>!f&&!e[l].negated))&&(s.push(a),o))break}return s},"baseMatcher");function Ap(r,e,t){return Ou(r,e,t,!1)}i(Ap,"matcher");function Gp(r,e,t){return Ou(r,e,t,!0).length>0}i(Gp,"isMatch");var zs=class{static{i(this,"SmartMatch")}constructor(e){this.wildcard=e}match(e){return Xr.isMatch(e,this.wildcard)}};var Pe={};A(Pe,{ObservableIntake:()=>ha,Observablemap:()=>ma,fromStreamWithBackpressure:()=>Oy,rxjs:()=>cr});var cr={};A(cr,{Observable:()=>j,ReplaySubject:()=>Xo,Subject:()=>He,Subscription:()=>Te,from:()=>Nt,fromEvent:()=>Ft,of:()=>da,ops:()=>My});var Vs=i(function(r,e){return Vs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])},Vs(r,e)},"extendStatics");function ue(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Vs(r,e);function t(){this.constructor=r}i(t,"__"),r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}i(ue,"__extends");var As=i(function(){return As=Object.assign||i(function(e){for(var t,o=1,n=arguments.length;o<n;o++){t=arguments[o];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),As.apply(this,arguments)},"__assign");function Qp(r,e){var t={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.indexOf(o)<0&&(t[o]=r[o]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,o=Object.getOwnPropertySymbols(r);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(r,o[n])&&(t[o[n]]=r[o[n]]);return t}i(Qp,"__rest");function Xp(r,e,t,o){var n=arguments.length,s=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,o);else for(var u=r.length-1;u>=0;u--)(a=r[u])&&(s=(n<3?a(s):n>3?a(e,t,s):a(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}i(Xp,"__decorate");function Zp(r,e){return function(t,o){e(t,o,r)}}i(Zp,"__param");function em(r,e,t,o,n,s){function a(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}i(a,"accept");for(var u=o.kind,c=u==="getter"?"get":u==="setter"?"set":"value",f=!e&&r?o.static?r:r.prototype:null,l=e||(f?Object.getOwnPropertyDescriptor(f,o.name):{}),p,m=!1,h=t.length-1;h>=0;h--){var x={};for(var g in o)x[g]=g==="access"?{}:o[g];for(var g in o.access)x.access[g]=o.access[g];x.addInitializer=function(v){if(m)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(v||null))};var w=(0,t[h])(u==="accessor"?{get:l.get,set:l.set}:l[c],x);if(u==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(p=a(w.get))&&(l.get=p),(p=a(w.set))&&(l.set=p),(p=a(w.init))&&n.unshift(p)}else(p=a(w))&&(u==="field"?n.unshift(p):l[c]=p)}f&&Object.defineProperty(f,o.name,l),m=!0}i(em,"__esDecorate");function tm(r,e,t){for(var o=arguments.length>2,n=0;n<e.length;n++)t=o?e[n].call(r,t):e[n].call(r);return o?t:void 0}i(tm,"__runInitializers");function rm(r){return typeof r=="symbol"?r:"".concat(r)}i(rm,"__propKey");function om(r,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(r,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}i(om,"__setFunctionName");function nm(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}i(nm,"__metadata");function Ks(r,e,t,o){function n(s){return s instanceof t?s:new t(function(a){a(s)})}return i(n,"adopt"),new(t||(t=Promise))(function(s,a){function u(l){try{f(o.next(l))}catch(p){a(p)}}i(u,"fulfilled");function c(l){try{f(o.throw(l))}catch(p){a(p)}}i(c,"rejected");function f(l){l.done?s(l.value):n(l.value).then(u,c)}i(f,"step"),f((o=o.apply(r,e||[])).next())})}i(Ks,"__awaiter");function eo(r,e){var t={label:0,sent:i(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},o,n,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(f){return function(l){return c([f,l])}}function c(f){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,f[0]&&(t=0)),t;)try{if(o=1,n&&(s=f[0]&2?n.return:f[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,f[1])).done)return s;switch(n=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,n=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){t.label=f[1];break}if(f[0]===6&&t.label<s[1]){t.label=s[1],s=f;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(f);break}s[2]&&t.ops.pop(),t.trys.pop();continue}f=e.call(r,t)}catch(l){f=[6,l],n=0}finally{o=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}i(eo,"__generator");var Gs=Object.create?(function(r,e,t,o){o===void 0&&(o=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:i(function(){return e[t]},"get")}),Object.defineProperty(r,o,n)}):(function(r,e,t,o){o===void 0&&(o=t),r[o]=e[t]});function im(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Gs(e,r,t)}i(im,"__exportStar");function le(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],o=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:i(function(){return r&&o>=r.length&&(r=void 0),{value:r&&r[o++],done:!r}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}i(le,"__values");function ge(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var o=t.call(r),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(u){a={error:u}}finally{try{n&&!n.done&&(t=o.return)&&t.call(o)}finally{if(a)throw a.error}}return s}i(ge,"__read");function sm(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(ge(arguments[e]));return r}i(sm,"__spread");function am(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var o=Array(r),n=0,e=0;e<t;e++)for(var s=arguments[e],a=0,u=s.length;a<u;a++,n++)o[n]=s[a];return o}i(am,"__spreadArrays");function Ie(r,e,t){if(t||arguments.length===2)for(var o=0,n=e.length,s;o<n;o++)(s||!(o in e))&&(s||(s=Array.prototype.slice.call(e,0,o)),s[o]=e[o]);return r.concat(s||Array.prototype.slice.call(e))}i(Ie,"__spreadArray");function Xe(r){return this instanceof Xe?(this.v=r,this):new Xe(r)}i(Xe,"__await");function Qs(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=t.apply(r,e||[]),n,s=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(h){return function(x){return Promise.resolve(x).then(h,p)}}function u(h,x){o[h]&&(n[h]=function(g){return new Promise(function(w,v){s.push([h,g,w,v])>1||c(h,g)})},x&&(n[h]=x(n[h])))}function c(h,x){try{f(o[h](x))}catch(g){m(s[0][3],g)}}function f(h){h.value instanceof Xe?Promise.resolve(h.value.v).then(l,p):m(s[0][2],h)}function l(h){c("next",h)}function p(h){c("throw",h)}function m(h,x){h(x),s.shift(),s.length&&c(s[0][0],s[0][1])}}i(Qs,"__asyncGenerator");function um(r){var e,t;return e={},o("next"),o("throw",function(n){throw n}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(n,s){e[n]=r[n]?function(a){return(t=!t)?{value:Xe(r[n](a)),done:!1}:s?s(a):a}:s}}i(um,"__asyncDelegator");function Xs(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof le=="function"?le(r):r[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(s){t[s]=r[s]&&function(a){return new Promise(function(u,c){a=r[s](a),n(u,c,a.done,a.value)})}}function n(s,a,u,c){Promise.resolve(c).then(function(f){s({value:f,done:u})},a)}}i(Xs,"__asyncValues");function cm(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}i(cm,"__makeTemplateObject");var fm=Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e},Js=i(function(r){return Js=Object.getOwnPropertyNames||function(e){var t=[];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[t.length]=o);return t},Js(r)},"ownKeys");function lm(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t=Js(r),o=0;o<t.length;o++)t[o]!=="default"&&Gs(e,r,t[o]);return fm(e,r),e}i(lm,"__importStar");function dm(r){return r&&r.__esModule?r:{default:r}}i(dm,"__importDefault");function pm(r,e,t,o){if(t==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!o:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?o:t==="a"?o.call(r):o?o.value:e.get(r)}i(pm,"__classPrivateFieldGet");function mm(r,e,t,o,n){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t}i(mm,"__classPrivateFieldSet");function hm(r,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?e===r:r.has(e)}i(hm,"__classPrivateFieldIn");function ym(r,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var o,n;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=e[Symbol.asyncDispose]}if(o===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=e[Symbol.dispose],t&&(n=o)}if(typeof o!="function")throw new TypeError("Object not disposable.");n&&(o=i(function(){try{n.call(this)}catch(s){return Promise.reject(s)}},"dispose")),r.stack.push({value:e,dispose:o,async:t})}else t&&r.stack.push({async:!0});return e}i(ym,"__addDisposableResource");var xm=typeof SuppressedError=="function"?SuppressedError:function(r,e,t){var o=new Error(t);return o.name="SuppressedError",o.error=r,o.suppressed=e,o};function gm(r){function e(s){r.error=r.hasError?new xm(s,r.error,"An error was suppressed during disposal."):s,r.hasError=!0}i(e,"fail");var t,o=0;function n(){for(;t=r.stack.pop();)try{if(!t.async&&o===1)return o=0,r.stack.push(t),Promise.resolve().then(n);if(t.dispose){var s=t.dispose.call(t.value);if(t.async)return o|=2,Promise.resolve(s).then(n,function(a){return e(a),n()})}else o|=1}catch(a){e(a)}if(o===1)return r.hasError?Promise.reject(r.error):Promise.resolve();if(r.hasError)throw r.error}return i(n,"next"),n()}i(gm,"__disposeResources");function wm(r,e){return typeof r=="string"&&/^\.\.?\//.test(r)?r.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,o,n,s,a){return o?e?".jsx":".js":n&&(!s||!a)?t:n+s+"."+a.toLowerCase()+"js"}):r}i(wm,"__rewriteRelativeImportExtension");var Yb={__extends:ue,__assign:As,__rest:Qp,__decorate:Xp,__param:Zp,__esDecorate:em,__runInitializers:tm,__propKey:rm,__setFunctionName:om,__metadata:nm,__awaiter:Ks,__generator:eo,__createBinding:Gs,__exportStar:im,__values:le,__read:ge,__spread:sm,__spreadArrays:am,__spreadArray:Ie,__await:Xe,__asyncGenerator:Qs,__asyncDelegator:um,__asyncValues:Xs,__makeTemplateObject:cm,__importStar:lm,__importDefault:dm,__classPrivateFieldGet:pm,__classPrivateFieldSet:mm,__classPrivateFieldIn:hm,__addDisposableResource:ym,__disposeResources:gm,__rewriteRelativeImportExtension:wm};function I(r){return typeof r=="function"}i(I,"isFunction");function Go(r){var e=i(function(o){Error.call(o),o.stack=new Error().stack},"_super"),t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}i(Go,"createErrorClass");var to=Go(function(r){return i(function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
2
2
  `+t.map(function(o,n){return n+1+") "+o.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=t},"UnsubscriptionErrorImpl")});function We(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}i(We,"arrRemove");var be=(function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return i(r,"Subscription"),r.prototype.unsubscribe=function(){var e,t,o,n,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var u=fe(a),c=u.next();!c.done;c=u.next()){var f=c.value;f.remove(this)}}catch(x){e={error:x}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}else a.remove(this);var l=this.initialTeardown;if(E(l))try{l()}catch(x){s=x instanceof to?x.errors:[x]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var p=fe(m),h=p.next();!h.done;h=p.next()){var g=h.value;try{Tu(g)}catch(x){s=s??[],x instanceof to?s=Ee(Ee([],ye(s)),ye(x.errors)):s.push(x)}}}catch(x){o={error:x}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(o)throw o.error}}}if(s)throw new to(s)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)Tu(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&We(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&We(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=(function(){var e=new r;return e.closed=!0,e})(),r})(),Ks=be.EMPTY;function Jo(r){return r instanceof be||r&&"closed"in r&&E(r.remove)&&E(r.add)&&E(r.unsubscribe)}i(Jo,"isSubscription");function Tu(r){E(r)?r():r.unsubscribe()}i(Tu,"execFinalizer");var _e={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var or={setTimeout:i(function(r,e){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];var n=or.delegate;return n?.setTimeout?n.setTimeout.apply(n,Ee([r,e],ye(t))):setTimeout.apply(void 0,Ee([r,e],ye(t)))},"setTimeout"),clearTimeout:i(function(r){var e=or.delegate;return(e?.clearTimeout||clearTimeout)(r)},"clearTimeout"),delegate:void 0};function Ko(r){or.setTimeout(function(){var e=_e.onUnhandledError;if(e)e(r);else throw r})}i(Ko,"reportUnhandledError");function Be(){}i(Be,"noop");var Du=(function(){return Xs("C",void 0,void 0)})();function Su(r){return Xs("E",void 0,r)}i(Su,"errorNotification");function Mu(r){return Xs("N",r,void 0)}i(Mu,"nextNotification");function Xs(r,e,t){return{kind:r,value:e,error:t}}i(Xs,"createNotification");var Pt=null;function nr(r){if(_e.useDeprecatedSynchronousErrorHandling){var e=!Pt;if(e&&(Pt={errorThrown:!1,error:null}),r(),e){var t=Pt,o=t.errorThrown,n=t.error;if(Pt=null,o)throw n}}else r()}i(nr,"errorContext");function ku(r){_e.useDeprecatedSynchronousErrorHandling&&Pt&&(Pt.errorThrown=!0,Pt.error=r)}i(ku,"captureError");var Nt=(function(r){ae(e,r);function e(t){var o=r.call(this)||this;return o.isStopped=!1,t?(o.destination=t,Jo(t)&&t.add(o)):o.destination=yp,o}return i(e,"Subscriber"),e.create=function(t,o,n){return new ro(t,o,n)},e.prototype.next=function(t){this.isStopped?ea(Mu(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?ea(Su(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?ea(Du,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(be),mp=Function.prototype.bind;function Zs(r,e){return mp.call(r,e)}i(Zs,"bind");var pp=(function(){function r(e){this.partialObserver=e}return i(r,"ConsumerObserver"),r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(o){Xo(o)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(o){Xo(o)}else Xo(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Xo(t)}},r})(),ro=(function(r){ae(e,r);function e(t,o,n){var s=r.call(this)||this,a;if(E(t)||!t)a={next:t??void 0,error:o??void 0,complete:n??void 0};else{var u;s&&_e.useDeprecatedNextContext?(u=Object.create(t),u.unsubscribe=function(){return s.unsubscribe()},a={next:t.next&&Zs(t.next,u),error:t.error&&Zs(t.error,u),complete:t.complete&&Zs(t.complete,u)}):a=t}return s.destination=new pp(a),s}return i(e,"SafeSubscriber"),e})(Nt);function Xo(r){_e.useDeprecatedSynchronousErrorHandling?ku(r):Ko(r)}i(Xo,"handleUnhandledError");function hp(r){throw r}i(hp,"defaultErrorHandler");function ea(r,e){var t=_e.onStoppedNotification;t&&or.setTimeout(function(){return t(r,e)})}i(ea,"handleStoppedNotification");var yp={closed:!0,next:Be,error:hp,complete:Be};var Rt=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function oo(r){return r}i(oo,"identity");function xp(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return ta(r)}i(xp,"pipe");function ta(r){return r.length===0?oo:r.length===1?r[0]:i(function(t){return r.reduce(function(o,n){return n(o)},t)},"piped")}i(ta,"pipeFromArray");var H=(function(){function r(e){e&&(this._subscribe=e)}return i(r,"Observable"),r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,o){var n=this,s=wp(e)?e:new ro(e,t,o);return nr(function(){var a=n,u=a.operator,c=a.source;s.add(u?u.call(s,c):c?n._subscribe(s):n._trySubscribe(s))}),s},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var o=this;return t=Ou(t),new t(function(n,s){var a=new ro({next:i(function(u){try{e(u)}catch(c){s(c),a.unsubscribe()}},"next"),error:s,complete:n});o.subscribe(a)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[Rt]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ta(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=Ou(e),new e(function(o,n){var s;t.subscribe(function(a){return s=a},function(a){return n(a)},function(){return o(s)})})},r.create=function(e){return new r(e)},r})();function Ou(r){var e;return(e=r??_e.Promise)!==null&&e!==void 0?e:Promise}i(Ou,"getPromiseCtor");function gp(r){return r&&E(r.next)&&E(r.error)&&E(r.complete)}i(gp,"isObserver");function wp(r){return r&&r instanceof Nt||gp(r)&&Jo(r)}i(wp,"isSubscriber");function bp(r){return E(r?.lift)}i(bp,"hasLift");function j(r){return function(e){if(bp(e))return e.lift(function(t){try{return r(t,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}i(j,"operate");function $(r,e,t,o,n){return new Iu(r,e,t,o,n)}i($,"createOperatorSubscriber");var Iu=(function(r){ae(e,r);function e(t,o,n,s,a,u){var c=r.call(this,t)||this;return c.onFinalize=a,c.shouldUnsubscribe=u,c._next=o?function(f){try{o(f)}catch(l){t.error(l)}}:r.prototype._next,c._error=s?function(f){try{s(f)}catch(l){t.error(l)}finally{this.unsubscribe()}}:r.prototype._error,c._complete=n?function(){try{n()}catch(f){t.error(f)}finally{this.unsubscribe()}}:r.prototype._complete,c}return i(e,"OperatorSubscriber"),e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;r.prototype.unsubscribe.call(this),!o&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e})(Nt);var ra=Qo(function(r){return i(function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl")});var He=(function(r){ae(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return i(e,"Subject"),e.prototype.lift=function(t){var o=new oa(this,this);return o.operator=t,o},e.prototype._throwIfClosed=function(){if(this.closed)throw new ra},e.prototype.next=function(t){var o=this;nr(function(){var n,s;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var a=fe(o.currentObservers),u=a.next();!u.done;u=a.next()){var c=u.value;c.next(t)}}catch(f){n={error:f}}finally{try{u&&!u.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}}})},e.prototype.error=function(t){var o=this;nr(function(){if(o._throwIfClosed(),!o.isStopped){o.hasError=o.isStopped=!0,o.thrownError=t;for(var n=o.observers;n.length;)n.shift().error(t)}})},e.prototype.complete=function(){var t=this;nr(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var o=t.observers;o.length;)o.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:i(function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},"get"),enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var o=this,n=this,s=n.hasError,a=n.isStopped,u=n.observers;return s||a?Ks:(this.currentObservers=null,u.push(t),new be(function(){o.currentObservers=null,We(u,t)}))},e.prototype._checkFinalizedStatuses=function(t){var o=this,n=o.hasError,s=o.thrownError,a=o.isStopped;n?t.error(s):a&&t.complete()},e.prototype.asObservable=function(){var t=new H;return t.source=this,t},e.create=function(t,o){return new oa(t,o)},e})(H),oa=(function(r){ae(e,r);function e(t,o){var n=r.call(this)||this;return n.destination=t,n.source=o,n}return i(e,"AnonymousSubject"),e.prototype.next=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.next)===null||n===void 0||n.call(o,t)},e.prototype.error=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.error)===null||n===void 0||n.call(o,t)},e.prototype.complete=function(){var t,o;(o=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||o===void 0||o.call(t)},e.prototype._subscribe=function(t){var o,n;return(n=(o=this.source)===null||o===void 0?void 0:o.subscribe(t))!==null&&n!==void 0?n:Ks},e})(He);var no={now:i(function(){return(no.delegate||Date).now()},"now"),delegate:void 0};var Zo=(function(r){ae(e,r);function e(t,o,n){t===void 0&&(t=1/0),o===void 0&&(o=1/0),n===void 0&&(n=no);var s=r.call(this)||this;return s._bufferSize=t,s._windowTime=o,s._timestampProvider=n,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=o===1/0,s._bufferSize=Math.max(1,t),s._windowTime=Math.max(1,o),s}return i(e,"ReplaySubject"),e.prototype.next=function(t){var o=this,n=o.isStopped,s=o._buffer,a=o._infiniteTimeWindow,u=o._timestampProvider,c=o._windowTime;n||(s.push(t),!a&&s.push(u.now()+c)),this._trimBuffer(),r.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var o=this._innerSubscribe(t),n=this,s=n._infiniteTimeWindow,a=n._buffer,u=a.slice(),c=0;c<u.length&&!t.closed;c+=s?1:2)t.next(u[c]);return this._checkFinalizedStatuses(t),o},e.prototype._trimBuffer=function(){var t=this,o=t._bufferSize,n=t._timestampProvider,s=t._buffer,a=t._infiniteTimeWindow,u=(a?1:2)*o;if(o<1/0&&u<s.length&&s.splice(0,s.length-u),!a){for(var c=n.now(),f=0,l=1;l<s.length&&s[l]<=c;l+=2)f=l;f&&s.splice(0,f+1)}},e})(He);var na=(function(r){ae(e,r);function e(t,o){return r.call(this)||this}return i(e,"Action"),e.prototype.schedule=function(t,o){return o===void 0&&(o=0),this},e})(be);var io={setInterval:i(function(r,e){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];var n=io.delegate;return n?.setInterval?n.setInterval.apply(n,Ee([r,e],ye(t))):setInterval.apply(void 0,Ee([r,e],ye(t)))},"setInterval"),clearInterval:i(function(r){var e=io.delegate;return(e?.clearInterval||clearInterval)(r)},"clearInterval"),delegate:void 0};var ia=(function(r){ae(e,r);function e(t,o){var n=r.call(this,t,o)||this;return n.scheduler=t,n.work=o,n.pending=!1,n}return i(e,"AsyncAction"),e.prototype.schedule=function(t,o){var n;if(o===void 0&&(o=0),this.closed)return this;this.state=t;var s=this.id,a=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(a,s,o)),this.pending=!0,this.delay=o,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(a,this.id,o),this},e.prototype.requestAsyncId=function(t,o,n){return n===void 0&&(n=0),io.setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,o,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return o;o!=null&&io.clearInterval(o)},e.prototype.execute=function(t,o){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,o);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,o){var n=!1,s;try{this.work(t)}catch(a){n=!0,s=a||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,o=t.id,n=t.scheduler,s=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,We(s,this),o!=null&&(this.id=this.recycleAsyncId(n,o,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e})(na);var so=(function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return i(r,"Scheduler"),r.prototype.schedule=function(e,t,o){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(o,t)},r.now=no.now,r})();var sa=(function(r){ae(e,r);function e(t,o){o===void 0&&(o=so.now);var n=r.call(this,t,o)||this;return n.actions=[],n._active=!1,n}return i(e,"AsyncScheduler"),e.prototype.flush=function(t){var o=this.actions;if(this._active){o.push(t);return}var n;this._active=!0;do if(n=t.execute(t.state,t.delay))break;while(t=o.shift());if(this._active=!1,n){for(;t=o.shift();)t.unsubscribe();throw n}},e})(so);var st=new sa(ia),aa=st;function en(r){return r&&E(r.schedule)}i(en,"isScheduler");function ua(r){return r[r.length-1]}i(ua,"last");function Pv(r){return E(ua(r))?r.pop():void 0}i(Pv,"popResultSelector");function at(r){return en(ua(r))?r.pop():void 0}i(at,"popScheduler");function Nv(r,e){return typeof ua(r)=="number"?r.pop():e}i(Nv,"popNumber");var ir=i((function(r){return r&&typeof r.length=="number"&&typeof r!="function"}),"isArrayLike");function tn(r){return E(r?.then)}i(tn,"isPromise");function rn(r){return E(r[Rt])}i(rn,"isInteropObservable");function on(r){return Symbol.asyncIterator&&E(r?.[Symbol.asyncIterator])}i(on,"isAsyncIterable");function nn(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}i(nn,"createInvalidObservableTypeError");function vp(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(vp,"getSymbolIterator");var sn=vp();function an(r){return E(r?.[sn])}i(an,"isIterable");function un(r){return Qs(this,arguments,i(function(){var t,o,n,s;return eo(this,function(a){switch(a.label){case 0:t=r.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Xe(t.read())];case 3:return o=a.sent(),n=o.value,s=o.done,s?[4,Xe(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Xe(n)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})},"readableStreamLikeToAsyncGenerator_1"))}i(un,"readableStreamLikeToAsyncGenerator");function cn(r){return E(r?.getReader)}i(cn,"isReadableStreamLike");function K(r){if(r instanceof H)return r;if(r!=null){if(rn(r))return Tp(r);if(ir(r))return Dp(r);if(tn(r))return Sp(r);if(on(r))return Eu(r);if(an(r))return Mp(r);if(cn(r))return kp(r)}throw nn(r)}i(K,"innerFrom");function Tp(r){return new H(function(e){var t=r[Rt]();if(E(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i(Tp,"fromInteropObservable");function Dp(r){return new H(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}i(Dp,"fromArrayLike");function Sp(r){return new H(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Ko)})}i(Sp,"fromPromise");function Mp(r){return new H(function(e){var t,o;try{for(var n=fe(r),s=n.next();!s.done;s=n.next()){var a=s.value;if(e.next(a),e.closed)return}}catch(u){t={error:u}}finally{try{s&&!s.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}e.complete()})}i(Mp,"fromIterable");function Eu(r){return new H(function(e){Op(r,e).catch(function(t){return e.error(t)})})}i(Eu,"fromAsyncIterable");function kp(r){return Eu(un(r))}i(kp,"fromReadableStreamLike");function Op(r,e){var t,o,n,s;return Gs(this,void 0,void 0,function(){var a,u;return eo(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),t=Js(r),c.label=1;case 1:return[4,t.next()];case 2:if(o=c.sent(),!!o.done)return[3,4];if(a=o.value,e.next(a),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),n={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),o&&!o.done&&(s=t.return)?[4,s.call(t)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}i(Op,"process");function xe(r,e,t,o,n){o===void 0&&(o=0),n===void 0&&(n=!1);var s=e.schedule(function(){t(),n?r.add(this.schedule(null,o)):this.unsubscribe()},o);if(r.add(s),!n)return s}i(xe,"executeSchedule");function sr(r,e){return e===void 0&&(e=0),j(function(t,o){t.subscribe($(o,function(n){return xe(o,r,function(){return o.next(n)},e)},function(){return xe(o,r,function(){return o.complete()},e)},function(n){return xe(o,r,function(){return o.error(n)},e)}))})}i(sr,"observeOn");function ar(r,e){return e===void 0&&(e=0),j(function(t,o){o.add(r.schedule(function(){return t.subscribe(o)},e))})}i(ar,"subscribeOn");function _u(r,e){return K(r).pipe(ar(e),sr(e))}i(_u,"scheduleObservable");function Cu(r,e){return K(r).pipe(ar(e),sr(e))}i(Cu,"schedulePromise");function Pu(r,e){return new H(function(t){var o=0;return e.schedule(function(){o===r.length?t.complete():(t.next(r[o++]),t.closed||this.schedule())})})}i(Pu,"scheduleArray");function Nu(r,e){return new H(function(t){var o;return xe(t,e,function(){o=r[sn](),xe(t,e,function(){var n,s,a;try{n=o.next(),s=n.value,a=n.done}catch(u){t.error(u);return}a?t.complete():t.next(s)},0,!0)}),function(){return E(o?.return)&&o.return()}})}i(Nu,"scheduleIterable");function fn(r,e){if(!r)throw new Error("Iterable cannot be null");return new H(function(t){xe(t,e,function(){var o=r[Symbol.asyncIterator]();xe(t,e,function(){o.next().then(function(n){n.done?t.complete():t.next(n.value)})},0,!0)})})}i(fn,"scheduleAsyncIterable");function Ru(r,e){return fn(un(r),e)}i(Ru,"scheduleReadableStreamLike");function ca(r,e){if(r!=null){if(rn(r))return _u(r,e);if(ir(r))return Pu(r,e);if(tn(r))return Cu(r,e);if(on(r))return fn(r,e);if(an(r))return Nu(r,e);if(cn(r))return Ru(r,e)}throw nn(r)}i(ca,"scheduled");function Ft(r,e){return e?ca(r,e):K(r)}i(Ft,"from");function fa(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=at(r);return Ft(r,t)}i(fa,"of");function Fu(r){return r instanceof Date&&!isNaN(r)}i(Fu,"isValidDate");function ut(r,e){return j(function(t,o){var n=0;t.subscribe($(o,function(s){o.next(r.call(e,s,n++))}))})}i(ut,"map");var Ip=Array.isArray;function Ep(r,e){return Ip(e)?r.apply(void 0,Ee([],ye(e))):r(e)}i(Ep,"callOrApply");function Wu(r){return ut(function(e){return Ep(r,e)})}i(Wu,"mapOneOrManyArgs");function Au(r,e,t,o,n,s,a,u){var c=[],f=0,l=0,m=!1,p=i(function(){m&&!c.length&&!f&&e.complete()},"checkComplete"),h=i(function(x){return f<o?g(x):c.push(x)},"outerNext"),g=i(function(x){s&&e.next(x),f++;var w=!1;K(t(x,l++)).subscribe($(e,function(T){n?.(T),s?h(T):e.next(T)},function(){w=!0},void 0,function(){if(w)try{f--;for(var T=i(function(){var J=c.shift();a?xe(e,a,function(){return g(J)}):g(J)},"_loop_1");c.length&&f<o;)T();p()}catch(J){e.error(J)}}))},"doInnerSub");return r.subscribe($(e,h,function(){m=!0,p()})),function(){u?.()}}i(Au,"mergeInternals");function Wt(r,e,t){return t===void 0&&(t=1/0),E(e)?Wt(function(o,n){return ut(function(s,a){return e(o,s,n,a)})(K(r(o,n)))},t):(typeof e=="number"&&(t=e),j(function(o,n){return Au(o,n,r,t)}))}i(Wt,"mergeMap");function ln(r){return r===void 0&&(r=1/0),Wt(oo,r)}i(ln,"mergeAll");function dn(){return ln(1)}i(dn,"concatAll");function mn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return dn()(Ft(r,at(r)))}i(mn,"concat");var _p=["addListener","removeListener"],Cp=["addEventListener","removeEventListener"],Pp=["on","off"];function At(r,e,t,o){if(E(t)&&(o=t,t=void 0),o)return At(r,e,t).pipe(Wu(o));var n=ye(Fp(r)?Cp.map(function(u){return function(c){return r[u](e,c,t)}}):Np(r)?_p.map(Lu(r,e)):Rp(r)?Pp.map(Lu(r,e)):[],2),s=n[0],a=n[1];if(!s&&ir(r))return Wt(function(u){return At(u,e,t)})(K(r));if(!s)throw new TypeError("Invalid event target");return new H(function(u){var c=i(function(){for(var f=[],l=0;l<arguments.length;l++)f[l]=arguments[l];return u.next(1<f.length?f:f[0])},"handler");return s(c),function(){return a(c)}})}i(At,"fromEvent");function Lu(r,e){return function(t){return function(o){return r[t](e,o)}}}i(Lu,"toCommonHandlerRegistry");function Np(r){return E(r.addListener)&&E(r.removeListener)}i(Np,"isNodeStyleEventEmitter");function Rp(r){return E(r.on)&&E(r.off)}i(Rp,"isJQueryStyleEventEmitter");function Fp(r){return E(r.addEventListener)&&E(r.removeEventListener)}i(Fp,"isEventTarget");function la(r,e,t){r===void 0&&(r=0),t===void 0&&(t=aa);var o=-1;return e!=null&&(en(e)?t=e:o=e),new H(function(n){var s=Fu(r)?+r-t.now():r;s<0&&(s=0);var a=0;return t.schedule(function(){n.closed||(n.next(a++),0<=o?this.schedule(void 0,o):n.complete())},s)})}i(la,"timer");function pn(r,e){return j(function(t,o){var n=0;t.subscribe($(o,function(s){return r.call(e,s,n++)&&o.next(s)}))})}i(pn,"filter");function hn(r){return j(function(e,t){var o=[];return e.subscribe($(t,function(n){return o.push(n)},function(){t.next(o),t.complete()})),K(r).subscribe($(t,function(){var n=o;o=[],t.next(n)},Be)),function(){o=null}})}i(hn,"buffer");function yn(r,e){return e===void 0&&(e=null),e=e??r,j(function(t,o){var n=[],s=0;t.subscribe($(o,function(a){var u,c,f,l,m=null;s++%e===0&&n.push([]);try{for(var p=fe(n),h=p.next();!h.done;h=p.next()){var g=h.value;g.push(a),r<=g.length&&(m=m??[],m.push(g))}}catch(T){u={error:T}}finally{try{h&&!h.done&&(c=p.return)&&c.call(p)}finally{if(u)throw u.error}}if(m)try{for(var x=fe(m),w=x.next();!w.done;w=x.next()){var g=w.value;We(n,g),o.next(g)}}catch(T){f={error:T}}finally{try{w&&!w.done&&(l=x.return)&&l.call(x)}finally{if(f)throw f.error}}},function(){var a,u;try{for(var c=fe(n),f=c.next();!f.done;f=c.next()){var l=f.value;o.next(l)}}catch(m){a={error:m}}finally{try{f&&!f.done&&(u=c.return)&&u.call(c)}finally{if(a)throw a.error}}o.complete()},void 0,function(){n=null}))})}i(yn,"bufferCount");function xn(r){for(var e,t,o=[],n=1;n<arguments.length;n++)o[n-1]=arguments[n];var s=(e=at(o))!==null&&e!==void 0?e:st,a=(t=o[0])!==null&&t!==void 0?t:null,u=o[1]||1/0;return j(function(c,f){var l=[],m=!1,p=i(function(x){var w=x.buffer,T=x.subs;T.unsubscribe(),We(l,x),f.next(w),m&&h()},"emit"),h=i(function(){if(l){var x=new be;f.add(x);var w=[],T={buffer:w,subs:x};l.push(T),xe(x,s,function(){return p(T)},r)}},"startBuffer");a!==null&&a>=0?xe(f,s,h,a,!0):m=!0,h();var g=$(f,function(x){var w,T,J=l.slice();try{for(var Te=fe(J),se=Te.next();!se.done;se=Te.next()){var rt=se.value,Ke=rt.buffer;Ke.push(x),u<=Ke.length&&p(rt)}}catch(er){w={error:er}}finally{try{se&&!se.done&&(T=Te.return)&&T.call(Te)}finally{if(w)throw w.error}}},function(){for(;l?.length;)f.next(l.shift().buffer);g?.unsubscribe(),f.complete(),f.unsubscribe()},void 0,function(){return l=null});c.subscribe(g)})}i(xn,"bufferTime");function gn(r){return j(function(e,t){var o=!1,n=null,s=null,a=i(function(){if(s?.unsubscribe(),s=null,o){o=!1;var u=n;n=null,t.next(u)}},"emit");e.subscribe($(t,function(u){s?.unsubscribe(),o=!0,n=u,s=$(t,a,Be),K(r(u)).subscribe(s)},function(){a(),t.complete()},void 0,function(){n=s=null}))})}i(gn,"debounce");function wn(r,e){return e===void 0&&(e=st),j(function(t,o){var n=null,s=null,a=null,u=i(function(){if(n){n.unsubscribe(),n=null;var f=s;s=null,o.next(f)}},"emit");function c(){var f=a+r,l=e.now();if(l<f){n=this.schedule(void 0,f-l),o.add(n);return}u()}i(c,"emitWhenIdle"),t.subscribe($(o,function(f){s=f,a=e.now(),n||(n=e.schedule(c,r),o.add(n))},function(){u(),o.complete()},void 0,function(){s=n=null}))})}i(wn,"debounceTime");function bn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=at(r);return j(function(o,n){(t?mn(r,o,t):mn(r,o)).subscribe(n)})}i(bn,"startWith");function vn(r){return j(function(e,t){K(r).subscribe($(t,function(){return t.complete()},Be)),!t.closed&&e.subscribe(t)})}i(vn,"takeUntil");function Tn(r,e){return j(function(t,o){var n=e??{},s=n.leading,a=s===void 0?!0:s,u=n.trailing,c=u===void 0?!1:u,f=!1,l=null,m=null,p=!1,h=i(function(){m?.unsubscribe(),m=null,c&&(w(),p&&o.complete())},"endThrottling"),g=i(function(){m=null,p&&o.complete()},"cleanupThrottling"),x=i(function(T){return m=K(r(T)).subscribe($(o,h,g))},"startThrottle"),w=i(function(){if(f){f=!1;var T=l;l=null,o.next(T),!p&&x(T)}},"send");t.subscribe($(o,function(T){f=!0,l=T,!(m&&!m.closed)&&(a?w():x(T))},function(){p=!0,!(c&&f&&m&&!m.closed)&&o.complete()}))})}i(Tn,"throttle");function Dn(r,e,t){e===void 0&&(e=st);var o=la(r,e);return Tn(function(){return o},t)}i(Dn,"throttleTime");var gy={buffer:hn,bufferCount:yn,bufferTime:xn,debounce:gn,debounceTime:wn,filter:pn,map:ut,startWith:bn,takeUntil:vn,throttleTime:Dn};var da=class{static{i(this,"Observablemap")}constructor(){this.observableEventEmitterBundleArray=new Array,this.observableEventTargetBundleArray=new Array}getSubjectForEmitterEvent(e,t){let o=this.observableEventEmitterBundleArray.find(n=>n.eventRef===e&&n.event===t);if(o)return o.subject;{let n=At(e,t),s=new He;n.subscribe(s);let a={subject:s,eventRef:e,event:t};return this.observableEventEmitterBundleArray.push(a),a.subject}}getSubjectForEventTarget(e,t){let o=this.observableEventTargetBundleArray.find(n=>n.eventRef===e&&n.event===t);if(o)return o.subject;{let s={subject:new He,eventRef:e,event:t};return this.observableEventTargetBundleArray.push(s),s.subject}}};var ma=class{static{i(this,"ObservableIntake")}constructor(){this.observableFunctions={next:i(e=>{},"next"),complete:i(e=>{},"complete")},this.buffered=!1,this.payloadBuffer=[],this.observable=new H(e=>{this.observableFunctions.next=t=>e.next(t),this.observableFunctions.complete=()=>(this.completedDeffered.resolve(),e.complete())}),this.completedDeffered=R.defer(),this.completed=this.completedDeffered.promise}setObservable(e){this.observable=e}push(e){this.buffered?this.payloadBuffer.push(e):this.internalPush(e)}pushMany(e){for(let t of e)this.push(t)}setGenerator(e){this.generator=e}makeBuffered(){this.buffered=!0}subscribe(...e){return this.observable.subscribe(...e)}request(e){if(e!==0)for(let t=0;t!==e;t++)if(this.payloadBuffer.length>0)this.internalPush(this.payloadBuffer.shift());else{if(!this.generator)throw new Error("Cannot request an unbuffered value before setting a generator");let o=this.generator.next();this.internalPush(o.value)}}signalComplete(){this.observableFunctions.complete()}internalPush(e){this.observableFunctions.next(e)}};function wy(r){return new H(e=>{let t=i(()=>r.pause(),"pauseStream"),o=i(()=>process.nextTick(()=>r.resume()),"resumeStream"),n=i(s=>{t(),e.next(s),o()},"onData");return r.on("data",n),r.on("error",s=>e.error(s)),r.on("end",()=>e.complete()),r.on("close",()=>e.complete()),()=>{r.removeListener("data",n),r.removeListener("error",e.error),r.removeListener("end",e.complete),r.removeListener("close",e.complete)}})}i(wy,"fromStreamWithBackpressure");var zt={};V(zt,{CronJob:()=>Do,CronManager:()=>Oa,ExtendedDate:()=>Ea,HrtMeasurement:()=>_a,Interval:()=>Ca,TimeStamp:()=>Pr,Timer:()=>Pa,getMilliSecondsAsHumanReadableAgoTime:()=>Jx,getMilliSecondsAsHumanReadableString:()=>Qx,getMilliSecondsFromUnits:()=>Ia,units:()=>vt});var fo={};V(fo,{Cron:()=>ju,CronDate:()=>Z,CronPattern:()=>Sn,scheduledJobs:()=>cr});function ao(r){return Date.UTC(r.y,r.m-1,r.d,r.h,r.i,r.s)}i(ao,"T");function pa(r,e){return r.y===e.y&&r.m===e.m&&r.d===e.d&&r.h===e.h&&r.i===e.i&&r.s===e.s}i(pa,"D");function by(r,e){let t=new Date(Date.parse(r));if(isNaN(t))throw new Error("Invalid ISO8601 passed to timezone parser.");let o=r.substring(9);return o.includes("Z")||o.includes("+")||o.includes("-")?ha(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),"Etc/UTC"):ha(t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),e)}i(by,"A");function Yu(r,e,t){return Bu(by(r,e),t)}i(Yu,"v");function Bu(r,e){let t=new Date(ao(r)),o=uo(t,r.tz),n=ao(r),s=ao(o),a=n-s,u=new Date(t.getTime()+a),c=uo(u,r.tz);if(pa(c,r)){let m=new Date(u.getTime()-36e5),p=uo(m,r.tz);return pa(p,r)?m:u}let f=new Date(u.getTime()+ao(r)-ao(c)),l=uo(f,r.tz);if(pa(l,r))return f;if(e)throw new Error("Invalid date passed to fromTZ()");return u.getTime()>f.getTime()?u:f}i(Bu,"k");function uo(r,e){let t,o;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}),o=t.formatToParts(r)}catch(s){let a=s instanceof Error?s.message:String(s);throw new RangeError(`toTZ: Invalid timezone '${e}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${a}`)}let n={year:0,month:0,day:0,hour:0,minute:0,second:0};for(let s of o)(s.type==="year"||s.type==="month"||s.type==="day"||s.type==="hour"||s.type==="minute"||s.type==="second")&&(n[s.type]=parseInt(s.value,10));if(isNaN(n.year)||isNaN(n.month)||isNaN(n.day)||isNaN(n.hour)||isNaN(n.minute)||isNaN(n.second))throw new Error(`toTZ: Failed to parse all date components from timezone '${e}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(n)}`);return n.hour===24&&(n.hour=0),{y:n.year,m:n.month,d:n.day,h:n.hour,i:n.minute,s:n.second,tz:e}}i(uo,"g");function ha(r,e,t,o,n,s,a){return{y:r,m:e,d:t,h:o,i:n,s,tz:a}}i(ha,"b");var Hu=[1,2,4,8,16],Sn=class{static{i(this,"C")}pattern;timezone;mode;alternativeWeekdays;sloppyRanges;second;minute;hour;day;month;dayOfWeek;year;lastDayOfMonth;lastWeekday;nearestWeekdays;starDOM;starDOW;starYear;useAndLogic;constructor(r,e,t){this.pattern=r,this.timezone=e,this.mode=t?.mode??"auto",this.alternativeWeekdays=t?.alternativeWeekdays??!1,this.sloppyRanges=t?.sloppyRanges??!1,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.year=Array(1e4).fill(0),this.lastDayOfMonth=!1,this.lastWeekday=!1,this.nearestWeekdays=Array(31).fill(0),this.starDOM=!1,this.starDOW=!1,this.starYear=!1,this.useAndLogic=!1,this.parse()}parse(){if(!(typeof this.pattern=="string"||this.pattern instanceof String))throw new TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let r=this.pattern.match(/\S+/g)||[""],e=r.length;if(r.length<5||r.length>7)throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five, six, or seven space separated parts are required.");if(this.mode!=="auto"){let o;switch(this.mode){case"5-part":o=5;break;case"6-part":o=6;break;case"7-part":o=7;break;case"5-or-6-parts":o=[5,6];break;case"6-or-7-parts":o=[6,7];break;default:o=0}if(!(Array.isArray(o)?o.includes(e):e===o)){let n=Array.isArray(o)?o.join(" or "):o.toString();throw new TypeError(`CronPattern: mode '${this.mode}' requires exactly ${n} parts, but pattern '${this.pattern}' has ${e} parts.`)}}if(r.length===5&&r.unshift("0"),r.length===6&&r.push("*"),r[3].toUpperCase()==="LW"?(this.lastWeekday=!0,r[3]=""):r[3].toUpperCase().indexOf("L")>=0&&(r[3]=r[3].replace(/L/gi,""),this.lastDayOfMonth=!0),r[3]=="*"&&(this.starDOM=!0),r[6]=="*"&&(this.starYear=!0),r[4].length>=3&&(r[4]=this.replaceAlphaMonths(r[4])),r[5].length>=3&&(r[5]=this.alternativeWeekdays?this.replaceAlphaDaysQuartz(r[5]):this.replaceAlphaDays(r[5])),r[5].startsWith("+")&&(this.useAndLogic=!0,r[5]=r[5].substring(1),r[5]===""))throw new TypeError("CronPattern: Day-of-week field cannot be empty after '+' modifier.");switch(r[5]=="*"&&(this.starDOW=!0),this.pattern.indexOf("?")>=0&&(r[0]=r[0].replace(/\?/g,"*"),r[1]=r[1].replace(/\?/g,"*"),r[2]=r[2].replace(/\?/g,"*"),r[3]=r[3].replace(/\?/g,"*"),r[4]=r[4].replace(/\?/g,"*"),r[5]=r[5].replace(/\?/g,"*"),r[6]&&(r[6]=r[6].replace(/\?/g,"*"))),this.mode){case"5-part":r[0]="0",r[6]="*";break;case"6-part":r[6]="*";break;case"5-or-6-parts":r[6]="*";break;case"6-or-7-parts":break;case"7-part":case"auto":break}this.throwAtIllegalCharacters(r),this.partToArray("second",r[0],0,1),this.partToArray("minute",r[1],0,1),this.partToArray("hour",r[2],0,1),this.partToArray("day",r[3],-1,1),this.partToArray("month",r[4],-1,1);let t=this.alternativeWeekdays?-1:0;this.partToArray("dayOfWeek",r[5],t,63),this.partToArray("year",r[6],0,1),!this.alternativeWeekdays&&this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(r,e,t,o){let n=this[r],s=r==="day"&&this.lastDayOfMonth,a=r==="day"&&this.lastWeekday;if(e===""&&!s&&!a)throw new TypeError("CronPattern: configuration entry "+r+" ("+e+") is empty, check for trailing spaces.");if(e==="*")return n.fill(o);let u=e.split(",");if(u.length>1)for(let c=0;c<u.length;c++)this.partToArray(r,u[c],t,o);else e.indexOf("-")!==-1&&e.indexOf("/")!==-1?this.handleRangeWithStepping(e,r,t,o):e.indexOf("-")!==-1?this.handleRange(e,r,t,o):e.indexOf("/")!==-1?this.handleStepping(e,r,t,o):e!==""&&this.handleNumber(e,r,t,o)}throwAtIllegalCharacters(r){for(let e=0;e<r.length;e++)if((e===3?/[^/*0-9,\-WwLl]+/:e===5?/[^/*0-9,\-#Ll]+/:/[^/*0-9,\-]+/).test(r[e]))throw new TypeError("CronPattern: configuration entry "+e+" ("+r[e]+") contains illegal characters.")}handleNumber(r,e,t,o){let n=this.extractNth(r,e),s=r.toUpperCase().includes("W");if(e!=="day"&&s)throw new TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");s&&(e="nearestWeekdays");let a=parseInt(n[0],10)+t;if(isNaN(a))throw new TypeError("CronPattern: "+e+" is not a number: '"+r+"'");this.setPart(e,a,n[1]||o)}setPart(r,e,t){if(!Object.prototype.hasOwnProperty.call(this,r))throw new TypeError("CronPattern: Invalid part specified: "+r);if(r==="dayOfWeek"){if(e===7&&(e=0),e<0||e>6)throw new RangeError("CronPattern: Invalid value for dayOfWeek: "+e);this.setNthWeekdayOfMonth(e,t);return}if(r==="second"||r==="minute"){if(e<0||e>=60)throw new RangeError("CronPattern: Invalid value for "+r+": "+e)}else if(r==="hour"){if(e<0||e>=24)throw new RangeError("CronPattern: Invalid value for "+r+": "+e)}else if(r==="day"||r==="nearestWeekdays"){if(e<0||e>=31)throw new RangeError("CronPattern: Invalid value for "+r+": "+e)}else if(r==="month"){if(e<0||e>=12)throw new RangeError("CronPattern: Invalid value for "+r+": "+e)}else if(r==="year"&&(e<1||e>=1e4))throw new RangeError("CronPattern: Invalid value for "+r+": "+e+" (supported range: 1-9999)");this[r][e]=t}validateNotNaN(r,e){if(isNaN(r))throw new TypeError(e)}validateRange(r,e,t,o,n){if(r>e)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");if(t!==void 0){if(t===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(t>this[o].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[o].length+")")}}handleRangeWithStepping(r,e,t,o){if(r.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");let n=this.extractNth(r,e),s=n[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(s===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+r+"'");let[,a,u,c]=s,f=parseInt(a,10)+t,l=parseInt(u,10)+t,m=parseInt(c,10);this.validateNotNaN(f,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(l,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateNotNaN(m,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(f,l,m,e,r);for(let p=f;p<=l;p+=m)this.setPart(e,p,n[1]||o)}extractNth(r,e){let t=r,o;if(t.includes("#")){if(e!=="dayOfWeek")throw new Error("CronPattern: nth (#) only allowed in day-of-week field");o=t.split("#")[1],t=t.split("#")[0]}else if(t.toUpperCase().endsWith("L")){if(e!=="dayOfWeek")throw new Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");o="L",t=t.slice(0,-1)}return[t,o]}handleRange(r,e,t,o){if(r.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in a range.");let n=this.extractNth(r,e),s=n[0].split("-");if(s.length!==2)throw new TypeError("CronPattern: Syntax error, illegal range: '"+r+"'");let a=parseInt(s[0],10)+t,u=parseInt(s[1],10)+t;this.validateNotNaN(a,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(u,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateRange(a,u,void 0,e,r);for(let c=a;c<=u;c++)this.setPart(e,c,n[1]||o)}handleStepping(r,e,t,o){if(r.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");let n=this.extractNth(r,e),s=n[0].split("/");if(s.length!==2)throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+r+"'");if(this.sloppyRanges)s[0]===""&&(s[0]="*");else{if(s[0]==="")throw new TypeError("CronPattern: Syntax error, stepping with missing prefix ('"+r+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");if(s[0]!=="*")throw new TypeError("CronPattern: Syntax error, stepping with numeric prefix ('"+r+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.")}let a=0;s[0]!=="*"&&(a=parseInt(s[0],10)+t);let u=parseInt(s[1],10);this.validateNotNaN(u,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(0,this[e].length-1,u,e,r);for(let c=a;c<this[e].length;c+=u)this.setPart(e,c,n[1]||o)}replaceAlphaDays(r){return r.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaDaysQuartz(r){return r.replace(/sun/gi,"1").replace(/mon/gi,"2").replace(/tue/gi,"3").replace(/wed/gi,"4").replace(/thu/gi,"5").replace(/fri/gi,"6").replace(/sat/gi,"7")}replaceAlphaMonths(r){return r.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames(r){let e=r.trim().toLowerCase();if(e==="@yearly"||e==="@annually")return"0 0 1 1 *";if(e==="@monthly")return"0 0 1 * *";if(e==="@weekly")return"0 0 * * 0";if(e==="@daily"||e==="@midnight")return"0 0 * * *";if(e==="@hourly")return"0 * * * *";if(e==="@reboot")throw new TypeError("CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.");return r}setNthWeekdayOfMonth(r,e){if(typeof e!="number"&&e.toUpperCase()==="L")this.dayOfWeek[r]=this.dayOfWeek[r]|32;else if(e===63)this.dayOfWeek[r]=63;else if(e<6&&e>0)this.dayOfWeek[r]=this.dayOfWeek[r]|Hu[e-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${e}, Type: ${typeof e}`)}},ya=[31,28,31,30,31,30,31,31,30,31,30,31],z=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],Z=class Uu{static{i(this,"s")}tz;ms;second;minute;hour;day;month;year;constructor(e,t){if(this.tz=t,e&&e instanceof Date)if(!isNaN(e))this.fromDate(e);else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");else if(e==null)this.fromDate(new Date);else if(e&&typeof e=="string")this.fromString(e);else if(e instanceof Uu)this.fromCronDate(e);else throw new TypeError("CronDate: Invalid type ("+typeof e+") passed to CronDate constructor")}getLastDayOfMonth(e,t){return t!==1?ya[t]:new Date(Date.UTC(e,t+1,0)).getUTCDate()}getLastWeekday(e,t){let o=this.getLastDayOfMonth(e,t),n=new Date(Date.UTC(e,t,o)).getUTCDay();return n===0?o-2:n===6?o-1:o}getNearestWeekday(e,t,o){let n=this.getLastDayOfMonth(e,t);if(o>n)return-1;let s=new Date(Date.UTC(e,t,o)).getUTCDay();return s===0?o===n?o-2:o+1:s===6?o===1?o+2:o-1:o}isNthWeekdayOfMonth(e,t,o,n){let s=new Date(Date.UTC(e,t,o)).getUTCDay(),a=0;for(let u=1;u<=o;u++)new Date(Date.UTC(e,t,u)).getUTCDay()===s&&a++;if(n&63&&Hu[a-1]&n)return!0;if(n&32){let u=this.getLastDayOfMonth(e,t);for(let c=o+1;c<=u;c++)if(new Date(Date.UTC(e,t,c)).getUTCDay()===s)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz=="number")this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else try{let t=uo(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}catch(t){let o=t instanceof Error?t.message:String(t);throw new TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${o}`)}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.month<0||this.day>ya[this.month]||this.day<1||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz=="number"){let t=Yu(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(Yu(e,this.tz))}findNext(e,t,o,n){return this._findMatch(e,t,o,n,1)}_findMatch(e,t,o,n,s){let a=this[t],u;o.lastDayOfMonth&&(u=this.getLastDayOfMonth(this.year,this.month));let c=!o.starDOW&&t=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0,f=this[t]+n,l=s===1?m=>m<o[t].length:m=>m>=0;for(let m=f;l(m);m+=s){let p=o[t][m];if(t==="day"&&!p){for(let h=0;h<o.nearestWeekdays.length;h++)if(o.nearestWeekdays[h]){let g=this.getNearestWeekday(this.year,this.month,h-n);if(g===-1)continue;if(g===m-n){p=1;break}}}if(t==="day"&&o.lastWeekday){let h=this.getLastWeekday(this.year,this.month);m-n===h&&(p=1)}if(t==="day"&&o.lastDayOfMonth&&m-n==u&&(p=1),t==="day"&&!o.starDOW){let h=o.dayOfWeek[(c+(m-n-1))%7];if(h&&h&63)h=this.isNthWeekdayOfMonth(this.year,this.month,m-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[t]=m-n,a!==this[t]?2:1}return 3}recurse(e,t,o){if(o===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let s=-1;for(let a=this.year+1;a<e.year.length&&a<1e4;a++)if(e.year[a]===1){s=a;break}if(s===-1)return null;this.year=s,this.month=0,this.day=1,this.hour=0,this.minute=0,this.second=0,this.ms=0}if(this.year>=1e4)return null}let n=this.findNext(t,z[o][0],e,z[o][2]);if(n>1){let s=o+1;for(;s<z.length;)this[z[s][0]]=-z[s][2],s++;if(n===3){if(this[z[o][1]]++,this[z[o][0]]=-z[o][2],this.apply(),o===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0&&this.year<1e4;)this.year++;if(this.year>=1e4||this.year>=e.year.length)return null}return this.recurse(e,t,0)}else if(this.apply())return this.recurse(e,t,o-1)}return o+=1,o>=z.length?this:(e.starYear?this.year>=3e3:this.year>=1e4)?null:this.recurse(e,t,o)}increment(e,t,o){return this.second+=t.interval!==void 0&&t.interval>1&&o?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}decrement(e,t){return this.second-=t.interval!==void 0&&t.interval>1?t.interval:1,this.ms=0,this.apply(),this.recurseBackward(e,t,0,0)}recurseBackward(e,t,o,n=0){if(n>1e4)return null;if(o===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let a=-1;for(let u=this.year-1;u>=0;u--)if(e.year[u]===1){a=u;break}if(a===-1)return null;this.year=a,this.month=11,this.day=31,this.hour=23,this.minute=59,this.second=59,this.ms=0}if(this.year<0)return null}let s=this.findPrevious(t,z[o][0],e,z[o][2]);if(s>1){let a=o+1;for(;a<z.length;){let u=z[a][0],c=z[a][2],f=this.getMaxPatternValue(u,e,c);this[u]=f,a++}if(s===3){if(this[z[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,m=this.month;for(;m<0;)m+=12,l--;for(;m>11;)m-=12,l++;let p=m!==1?ya[m]:new Date(Date.UTC(l,m+1,0)).getUTCDate();this.day>p&&(this.day=p)}this.apply();let u=z[o][0],c=z[o][2],f=this.getMaxPatternValue(u,e,c);if(u==="day"){let l=this.getLastDayOfMonth(this.year,this.month);this[u]=Math.min(f,l)}else this[u]=f;if(this.apply(),o===0){let l=z[1][2],m=this.getMaxPatternValue("day",e,l),p=this.getLastDayOfMonth(this.year,this.month),h=Math.min(m,p);h!==this.day&&(this.day=h,this.hour=this.getMaxPatternValue("hour",e,z[2][2]),this.minute=this.getMaxPatternValue("minute",e,z[3][2]),this.second=this.getMaxPatternValue("second",e,z[4][2]))}if(o===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0;)this.year--;if(this.year<0)return null}return this.recurseBackward(e,t,0,n+1)}else if(this.apply())return this.recurseBackward(e,t,o-1,n+1)}return o+=1,o>=z.length?this:this.year<0?null:this.recurseBackward(e,t,o,n+1)}getMaxPatternValue(e,t,o){if(e==="day"&&t.lastDayOfMonth)return this.getLastDayOfMonth(this.year,this.month);if(e==="day"&&!t.starDOW)return this.getLastDayOfMonth(this.year,this.month);for(let n=t[e].length-1;n>=0;n--)if(t[e][n])return n-o;return t[e].length-1-o}findPrevious(e,t,o,n){return this._findMatch(e,t,o,n,-1)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz=="number"?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):Bu(ha(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}match(e,t){if(!e.starYear&&(this.year<0||this.year>=e.year.length||e.year[this.year]===0))return!1;for(let o=0;o<z.length;o++){let n=z[o][0],s=z[o][2],a=this[n];if(a+s<0||a+s>=e[n].length)return!1;let u=e[n][a+s];if(n==="day"){if(!u){for(let c=0;c<e.nearestWeekdays.length;c++)if(e.nearestWeekdays[c]){let f=this.getNearestWeekday(this.year,this.month,c-s);if(f!==-1&&f===a){u=1;break}}}if(e.lastWeekday){let c=this.getLastWeekday(this.year,this.month);a===c&&(u=1)}if(e.lastDayOfMonth){let c=this.getLastDayOfMonth(this.year,this.month);a===c&&(u=1)}if(!e.starDOW){let c=new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay(),f=e.dayOfWeek[(c+(a-1))%7];f&&f&63&&(f=this.isNthWeekdayOfMonth(this.year,this.month,a,f)?1:0),e.useAndLogic?u=u&&f:!t.domAndDow&&!e.starDOM?u=u||f:u=u&&f}}if(!u)return!1}return!0}};function vy(r){if(r===void 0&&(r={}),delete r.name,r.legacyMode!==void 0&&r.domAndDow===void 0?r.domAndDow=!r.legacyMode:r.domAndDow===void 0&&(r.domAndDow=!1),r.legacyMode=!r.domAndDow,r.paused=r.paused===void 0?!1:r.paused,r.maxRuns=r.maxRuns===void 0?1/0:r.maxRuns,r.catch=r.catch===void 0?!1:r.catch,r.interval=r.interval===void 0?0:parseInt(r.interval.toString(),10),r.utcOffset=r.utcOffset===void 0?void 0:parseInt(r.utcOffset.toString(),10),r.dayOffset=r.dayOffset===void 0?0:parseInt(r.dayOffset.toString(),10),r.unref=r.unref===void 0?!1:r.unref,r.mode=r.mode===void 0?"auto":r.mode,r.alternativeWeekdays=r.alternativeWeekdays===void 0?!1:r.alternativeWeekdays,r.sloppyRanges=r.sloppyRanges===void 0?!1:r.sloppyRanges,!["auto","5-part","6-part","7-part","5-or-6-parts","6-or-7-parts"].includes(r.mode))throw new Error("CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.");if(r.startAt&&(r.startAt=new Z(r.startAt,r.timezone)),r.stopAt&&(r.stopAt=new Z(r.stopAt,r.timezone)),r.interval!==null){if(isNaN(r.interval))throw new Error("CronOptions: Supplied value for interval is not a number");if(r.interval<0)throw new Error("CronOptions: Supplied value for interval can not be negative")}if(r.utcOffset!==void 0){if(isNaN(r.utcOffset))throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if(r.utcOffset<-870||r.utcOffset>870)throw new Error("CronOptions: utcOffset out of bounds.");if(r.utcOffset!==void 0&&r.timezone)throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if(r.unref!==!0&&r.unref!==!1)throw new Error("CronOptions: Unref should be either true, false or undefined(false).");if(r.dayOffset!==void 0&&r.dayOffset!==0&&isNaN(r.dayOffset))throw new Error("CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.");return r}i(vy,"R");function co(r){return Object.prototype.toString.call(r)==="[object Function]"||typeof r=="function"||r instanceof Function}i(co,"p");function Ty(r){return co(r)}i(Ty,"_");function Dy(r){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(r):r&&typeof r.unref<"u"&&r.unref()}i(Dy,"x");var qu=30*1e3,cr=[],ju=class{static{i(this,"E")}name;options;_states;fn;getTz(){return this.options.timezone||this.options.utcOffset}applyDayOffset(r){if(this.options.dayOffset!==void 0&&this.options.dayOffset!==0){let e=this.options.dayOffset*24*60*60*1e3;return new Date(r.getTime()+e)}return r}constructor(r,e,t){let o,n;if(co(e))n=e;else if(typeof e=="object")o=e;else if(e!==void 0)throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(co(t))n=t;else if(typeof t=="object")o=t;else if(t!==void 0)throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=o?.name,this.options=vy(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 Sn("* * * * *",void 0,{mode:"auto"})},r&&(r instanceof Date||typeof r=="string"&&r.indexOf(":")>0)?this._states.once=new Z(r,this.getTz()):this._states.pattern=new Sn(r,this.options.timezone,{mode:this.options.mode,alternativeWeekdays:this.options.alternativeWeekdays,sloppyRanges:this.options.sloppyRanges}),this.name){if(cr.find(s=>s.name===this.name))throw new Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");cr.push(this)}return n!==void 0&&Ty(n)&&(this.fn=n,this.schedule()),this}nextRun(r){let e=this._next(r);return e?this.applyDayOffset(e.getDate(!1)):null}nextRuns(r,e){this._states.maxRuns!==void 0&&r>this._states.maxRuns&&(r=this._states.maxRuns);let t=e||this._states.currentRun||void 0;return this._enumerateRuns(r,t,"next")}previousRuns(r,e){return this._enumerateRuns(r,e||void 0,"previous")}_enumerateRuns(r,e,t){let o=[],n=e?new Z(e,this.getTz()):null,s=t==="next"?this._next:this._previous;for(;r--;){let a=s.call(this,n);if(!a)break;let u=a.getDate(!1);o.push(this.applyDayOffset(u)),n=a}return o}match(r){if(this._states.once){let t=new Z(r,this.getTz());t.ms=0;let o=new Z(this._states.once,this.getTz());return o.ms=0,t.getTime()===o.getTime()}let e=new Z(r,this.getTz());return e.ms=0,e.match(this._states.pattern,this.options)}getPattern(){if(!this._states.once)return this._states.pattern?this._states.pattern.pattern:void 0}getOnce(){return this._states.once?this._states.once.getDate():null}isRunning(){let r=this.nextRun(this._states.currentRun),e=!this._states.paused,t=this.fn!==void 0,o=!this._states.kill;return e&&t&&o&&r!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(r){let e=this._next(r);return e?r instanceof Z||r instanceof Date?e.getTime()-r.getTime():e.getTime()-new Z(r).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let r=cr.indexOf(this);r>=0&&cr.splice(r,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(r){if(r&&this.fn)throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");r&&(this.fn=r);let e=this.msToNext(),t=this.nextRun(this._states.currentRun);return e==null||isNaN(e)||t===null?this:(e>qu&&(e=qu),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(t),e),this._states.currentTimeout&&this.options.unref&&Dy(this._states.currentTimeout),this)}async _trigger(r){this._states.blocking=!0,this._states.currentRun=new Z(void 0,this.getTz());try{if(this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){if(co(this.options.catch))try{this.options.catch(e,this)}catch{}}else this.fn!==void 0&&await this.fn(this,this.options.context)}finally{this._states.previousRun=new Z(r,this.getTz()),this._states.blocking=!1}}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(r){let e=new Date,t=!this._states.paused&&e.getTime()>=r.getTime(),o=this._states.blocking&&this.options.protect;t&&!o?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):t&&o&&co(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(r){let e=!!(r||this._states.currentRun),t=!1;!r&&this.options.startAt&&this.options.interval&&([r,e]=this._calculatePreviousRun(r,e),t=!r),r=new Z(r,this.getTz()),this.options.startAt&&r&&r.getTime()<this.options.startAt.getTime()&&(r=this.options.startAt);let o=this._states.once||new Z(r,this.getTz());return!t&&o!==this._states.once&&(o=o.increment(this._states.pattern,this.options,e)),this._states.once&&this._states.once.getTime()<=r.getTime()||o===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&o.getTime()>=this.options.stopAt.getTime()?null:o}_previous(r){let e=new Z(r,this.getTz());this.options.stopAt&&e.getTime()>this.options.stopAt.getTime()&&(e=this.options.stopAt);let t=new Z(e,this.getTz());return this._states.once?this._states.once.getTime()<e.getTime()?this._states.once:null:(t=t.decrement(this._states.pattern,this.options),t===null||this.options.startAt&&t.getTime()<this.options.startAt.getTime()?null:t)}_calculatePreviousRun(r,e){let t=new Z(void 0,this.getTz()),o=r;if(this.options.startAt.getTime()<=t.getTime()){o=this.options.startAt;let n=o.getTime()+this.options.interval*1e3;for(;n<=t.getTime();)o=new Z(o,this.getTz()).increment(this._states.pattern,this.options,!0),n=o.getTime()+this.options.interval*1e3;e=!0}return o===null&&(o=void 0),[o,e]}};var vo={};V(vo,{add:()=>ft,addBusinessDays:()=>Rn,addDays:()=>ee,addHours:()=>Fn,addISOWeekYears:()=>An,addMilliseconds:()=>lt,addMinutes:()=>mr,addMonths:()=>Ue,addQuarters:()=>pr,addSeconds:()=>Ln,addWeeks:()=>dt,addYears:()=>Yn,areIntervalsOverlapping:()=>Qu,clamp:()=>Ju,closestIndexTo:()=>qn,closestTo:()=>Ku,compareAsc:()=>de,compareDesc:()=>Xu,constructFrom:()=>y,constructNow:()=>N,daysToWeeks:()=>Zu,differenceInBusinessDays:()=>ec,differenceInCalendarDays:()=>oe,differenceInCalendarISOWeekYears:()=>jn,differenceInCalendarISOWeeks:()=>tc,differenceInCalendarMonths:()=>Yt,differenceInCalendarQuarters:()=>hr,differenceInCalendarWeeks:()=>Bt,differenceInCalendarYears:()=>mt,differenceInDays:()=>yr,differenceInHours:()=>Ht,differenceInISOWeekYears:()=>oc,differenceInMilliseconds:()=>xr,differenceInMinutes:()=>qt,differenceInMonths:()=>pt,differenceInQuarters:()=>nc,differenceInSeconds:()=>Ve,differenceInWeeks:()=>ic,differenceInYears:()=>Vn,eachDayOfInterval:()=>Gn,eachHourOfInterval:()=>sc,eachMinuteOfInterval:()=>ac,eachMonthOfInterval:()=>uc,eachQuarterOfInterval:()=>cc,eachWeekOfInterval:()=>fc,eachWeekendOfInterval:()=>br,eachWeekendOfMonth:()=>lc,eachWeekendOfYear:()=>dc,eachYearOfInterval:()=>mc,endOfDay:()=>gr,endOfDecade:()=>pc,endOfHour:()=>hc,endOfISOWeek:()=>yc,endOfISOWeekYear:()=>xc,endOfMinute:()=>gc,endOfMonth:()=>wr,endOfQuarter:()=>wc,endOfSecond:()=>bc,endOfToday:()=>vc,endOfTomorrow:()=>Tc,endOfWeek:()=>Jn,endOfYear:()=>Qn,endOfYesterday:()=>Dc,format:()=>yo,formatDate:()=>yo,formatDistance:()=>ti,formatDistanceStrict:()=>ri,formatDistanceToNow:()=>Rc,formatDistanceToNowStrict:()=>Fc,formatDuration:()=>Wc,formatISO:()=>Ac,formatISO9075:()=>Lc,formatISODuration:()=>Yc,formatRFC3339:()=>Bc,formatRFC7231:()=>Hc,formatRelative:()=>qc,formatters:()=>po,fromUnixTime:()=>Uc,getDate:()=>oi,getDay:()=>gt,getDayOfYear:()=>Xn,getDaysInMonth:()=>ni,getDaysInYear:()=>jc,getDecade:()=>$c,getDefaultOptions:()=>si,getHours:()=>zc,getISODay:()=>ai,getISOWeek:()=>Sr,getISOWeekYear:()=>ge,getISOWeeksInYear:()=>Vc,getMilliseconds:()=>Gc,getMinutes:()=>Qc,getMonth:()=>Jc,getOverlappingDaysInIntervals:()=>Kc,getQuarter:()=>mo,getSeconds:()=>Xc,getTime:()=>Zc,getUnixTime:()=>ef,getWeek:()=>Mr,getWeekOfMonth:()=>tf,getWeekYear:()=>yt,getWeeksInMonth:()=>rf,getYear:()=>of,hoursToMilliseconds:()=>nf,hoursToMinutes:()=>sf,hoursToSeconds:()=>af,interval:()=>uf,intervalToDuration:()=>cf,intlFormat:()=>ff,intlFormatDistance:()=>lf,isAfter:()=>df,isBefore:()=>mf,isDate:()=>Un,isEqual:()=>pf,isExists:()=>hf,isFirstDayOfMonth:()=>yf,isFriday:()=>xf,isFuture:()=>gf,isLastDayOfMonth:()=>zn,isLeapYear:()=>ii,isMatch:()=>wf,isMonday:()=>bf,isPast:()=>vf,isSameDay:()=>ze,isSameHour:()=>Xi,isSameISOWeek:()=>Zi,isSameISOWeekYear:()=>Tf,isSameMinute:()=>es,isSameMonth:()=>ts,isSameQuarter:()=>rs,isSameSecond:()=>os,isSameWeek:()=>Er,isSameYear:()=>ns,isSaturday:()=>Pn,isSunday:()=>Nn,isThisHour:()=>Df,isThisISOWeek:()=>Sf,isThisMinute:()=>Mf,isThisMonth:()=>kf,isThisQuarter:()=>Of,isThisSecond:()=>If,isThisWeek:()=>Ef,isThisYear:()=>_f,isThursday:()=>Cf,isToday:()=>Pf,isTomorrow:()=>Nf,isTuesday:()=>Rf,isValid:()=>ue,isWednesday:()=>Ff,isWeekend:()=>je,isWithinInterval:()=>Wf,isYesterday:()=>Af,lastDayOfDecade:()=>Lf,lastDayOfISOWeek:()=>Yf,lastDayOfISOWeekYear:()=>Bf,lastDayOfMonth:()=>ui,lastDayOfQuarter:()=>Hf,lastDayOfWeek:()=>is,lastDayOfYear:()=>qf,lightFormat:()=>Uf,lightFormatters:()=>Me,longFormatters:()=>xt,max:()=>Bn,milliseconds:()=>jf,millisecondsToHours:()=>$f,millisecondsToMinutes:()=>zf,millisecondsToSeconds:()=>Vf,min:()=>Hn,minutesToHours:()=>Gf,minutesToMilliseconds:()=>Qf,minutesToSeconds:()=>Jf,monthsToQuarters:()=>Kf,monthsToYears:()=>Xf,nextDay:()=>pe,nextFriday:()=>Zf,nextMonday:()=>el,nextSaturday:()=>tl,nextSunday:()=>rl,nextThursday:()=>ol,nextTuesday:()=>nl,nextWednesday:()=>il,parse:()=>Ki,parseISO:()=>al,parseJSON:()=>ul,parsers:()=>Ji,previousDay:()=>he,previousFriday:()=>cl,previousMonday:()=>fl,previousSaturday:()=>ll,previousSunday:()=>dl,previousThursday:()=>ml,previousTuesday:()=>pl,previousWednesday:()=>hl,quartersToMonths:()=>yl,quartersToYears:()=>xl,roundToNearestHours:()=>gl,roundToNearestMinutes:()=>wl,secondsToHours:()=>bl,secondsToMilliseconds:()=>vl,secondsToMinutes:()=>Tl,set:()=>Dl,setDate:()=>Sl,setDay:()=>wt,setDayOfYear:()=>Ml,setDefaultOptions:()=>kl,setHours:()=>Ol,setISODay:()=>Ri,setISOWeek:()=>Oi,setISOWeekYear:()=>Wn,setMilliseconds:()=>Il,setMinutes:()=>El,setMonth:()=>_r,setQuarter:()=>_l,setSeconds:()=>Cl,setWeek:()=>Mi,setWeekYear:()=>Pl,setYear:()=>Nl,startOfDay:()=>$e,startOfDecade:()=>Rl,startOfHour:()=>xo,startOfISOWeek:()=>X,startOfISOWeekYear:()=>Se,startOfMinute:()=>go,startOfMonth:()=>ht,startOfQuarter:()=>Ge,startOfSecond:()=>wo,startOfToday:()=>Fl,startOfTomorrow:()=>Wl,startOfWeek:()=>q,startOfWeekYear:()=>Ut,startOfYear:()=>vr,startOfYesterday:()=>Al,sub:()=>Ll,subBusinessDays:()=>Yl,subDays:()=>bt,subHours:()=>Bl,subISOWeekYears:()=>$n,subMilliseconds:()=>Hl,subMinutes:()=>ql,subMonths:()=>as,subQuarters:()=>Ul,subSeconds:()=>jl,subWeeks:()=>$l,subYears:()=>zl,toDate:()=>d,transpose:()=>ci,weeksToDays:()=>Vl,yearsToDays:()=>Gl,yearsToMonths:()=>Ql,yearsToQuarters:()=>Jl});var kn=7,lo=365.2425,Sy=Math.pow(10,8)*24*60*60*1e3,eC=-Sy,qe=6048e5,On=864e5,le=6e4,De=36e5,fr=1e3,xa=525600,ct=43200,lr=1440,In=60,En=3,_n=12,Cn=4,Lt=3600,dr=60,Mn=Lt*24,$u=Mn*7,ga=Mn*365.2425,wa=ga/12,zu=wa*3,ba=Symbol.for("constructDateFrom");function y(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&ba in r?r[ba](e):r instanceof Date?new r.constructor(e):new Date(e)}i(y,"constructFrom");var oC=y;function d(r,e){return y(e||r,r)}i(d,"toDate");var aC=d;function ee(r,e,t){let o=d(r,t?.in);return isNaN(e)?y(t?.in||r,NaN):(e&&o.setDate(o.getDate()+e),o)}i(ee,"addDays");var dC=ee;function Ue(r,e,t){let o=d(r,t?.in);if(isNaN(e))return y(t?.in||r,NaN);if(!e)return o;let n=o.getDate(),s=y(t?.in||r,o.getTime());s.setMonth(o.getMonth()+e+1,0);let a=s.getDate();return n>=a?s:(o.setFullYear(s.getFullYear(),s.getMonth(),n),o)}i(Ue,"addMonths");var xC=Ue;function ft(r,e,t){let{years:o=0,months:n=0,weeks:s=0,days:a=0,hours:u=0,minutes:c=0,seconds:f=0}=e,l=d(r,t?.in),m=n||o?Ue(l,n+o*12):l,p=a||s?ee(m,a+s*7):m,h=c+u*60,x=(f+h*60)*1e3;return y(t?.in||r,+p+x)}i(ft,"add");var SC=ft;function Pn(r,e){return d(r,e?.in).getDay()===6}i(Pn,"isSaturday");var IC=Pn;function Nn(r,e){return d(r,e?.in).getDay()===0}i(Nn,"isSunday");var PC=Nn;function je(r,e){let t=d(r,e?.in).getDay();return t===0||t===6}i(je,"isWeekend");var WC=je;function Rn(r,e,t){let o=d(r,t?.in),n=je(o,t);if(isNaN(e))return y(t?.in,NaN);let s=o.getHours(),a=e<0?-1:1,u=Math.trunc(e/5);o.setDate(o.getDate()+u*7);let c=Math.abs(e%5);for(;c>0;)o.setDate(o.getDate()+a),je(o,t)||(c-=1);return n&&je(o,t)&&e!==0&&(Pn(o,t)&&o.setDate(o.getDate()+(a<0?2:-1)),Nn(o,t)&&o.setDate(o.getDate()+(a<0?1:-2))),o.setHours(s),o}i(Rn,"addBusinessDays");var jC=Rn;function lt(r,e,t){return y(t?.in||r,+d(r)+e)}i(lt,"addMilliseconds");var QC=lt;function Fn(r,e,t){return lt(r,e*De,t)}i(Fn,"addHours");var eP=Fn;var Vu={};function L(){return Vu}i(L,"getDefaultOptions");function Gu(r){Vu=r}i(Gu,"setDefaultOptions");function q(r,e){let t=L(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=d(r,e?.in),s=n.getDay(),a=(s<o?7:0)+s-o;return n.setDate(n.getDate()-a),n.setHours(0,0,0,0),n}i(q,"startOfWeek");var aP=q;function X(r,e){return q(r,{...e,weekStartsOn:1})}i(X,"startOfISOWeek");var lP=X;function ge(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=y(t,0);n.setFullYear(o+1,0,4),n.setHours(0,0,0,0);let s=X(n),a=y(t,0);a.setFullYear(o,0,4),a.setHours(0,0,0,0);let u=X(a);return t.getTime()>=s.getTime()?o+1:t.getTime()>=u.getTime()?o:o-1}i(ge,"getISOWeekYear");var xP=ge;function G(r){let e=d(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}i(G,"getTimezoneOffsetInMilliseconds");function k(r,...e){let t=y.bind(null,r||e.find(o=>typeof o=="object"));return e.map(t)}i(k,"normalizeDates");function $e(r,e){let t=d(r,e?.in);return t.setHours(0,0,0,0),t}i($e,"startOfDay");var OP=$e;function oe(r,e,t){let[o,n]=k(t?.in,r,e),s=$e(o),a=$e(n),u=+s-G(s),c=+a-G(a);return Math.round((u-c)/On)}i(oe,"differenceInCalendarDays");var RP=oe;function Se(r,e){let t=ge(r,e),o=y(e?.in||r,0);return o.setFullYear(t,0,4),o.setHours(0,0,0,0),X(o)}i(Se,"startOfISOWeekYear");var BP=Se;function Wn(r,e,t){let o=d(r,t?.in),n=oe(o,Se(o,t)),s=y(t?.in||r,0);return s.setFullYear(e,0,4),s.setHours(0,0,0,0),o=Se(s),o.setDate(o.getDate()+n),o}i(Wn,"setISOWeekYear");var VP=Wn;function An(r,e,t){return Wn(r,ge(r,t)+e,t)}i(An,"addISOWeekYears");var XP=An;function mr(r,e,t){let o=d(r,t?.in);return o.setTime(o.getTime()+e*le),o}i(mr,"addMinutes");var oN=mr;function pr(r,e,t){return Ue(r,e*3,t)}i(pr,"addQuarters");var aN=pr;function Ln(r,e,t){return lt(r,e*1e3,t)}i(Ln,"addSeconds");var lN=Ln;function dt(r,e,t){return ee(r,e*7,t)}i(dt,"addWeeks");var hN=dt;function Yn(r,e,t){return Ue(r,e*12,t)}i(Yn,"addYears");var wN=Yn;function Qu(r,e,t){let[o,n]=[+d(r.start,t?.in),+d(r.end,t?.in)].sort((u,c)=>u-c),[s,a]=[+d(e.start,t?.in),+d(e.end,t?.in)].sort((u,c)=>u-c);return t?.inclusive?o<=a&&s<=n:o<a&&s<n}i(Qu,"areIntervalsOverlapping");var DN=Qu;function Bn(r,e){let t,o=e?.in;return r.forEach(n=>{!o&&typeof n=="object"&&(o=y.bind(null,n));let s=d(n,o);(!t||t<s||isNaN(+s))&&(t=s)}),y(o,t||NaN)}i(Bn,"max");var IN=Bn;function Hn(r,e){let t,o=e?.in;return r.forEach(n=>{!o&&typeof n=="object"&&(o=y.bind(null,n));let s=d(n,o);(!t||t>s||isNaN(+s))&&(t=s)}),y(o,t||NaN)}i(Hn,"min");var NN=Hn;function Ju(r,e,t){let[o,n,s]=k(t?.in,r,e.start,e.end);return Hn([Bn([o,n],t),s],t)}i(Ju,"clamp");var YN=Ju;function qn(r,e){let t=+d(r);if(isNaN(t))return NaN;let o,n;return e.forEach((s,a)=>{let u=d(s);if(isNaN(+u)){o=NaN,n=NaN;return}let c=Math.abs(t-+u);(o==null||c<n)&&(o=a,n=c)}),o}i(qn,"closestIndexTo");var UN=qn;function Ku(r,e,t){let[o,...n]=k(t?.in,r,...e),s=qn(o,n);if(typeof s=="number"&&isNaN(s))return y(o,NaN);if(s!==void 0)return n[s]}i(Ku,"closestTo");var QN=Ku;function de(r,e){let t=+d(r)-+d(e);return t<0?-1:t>0?1:t}i(de,"compareAsc");var ZN=de;function Xu(r,e){let t=+d(r)-+d(e);return t>0?-1:t<0?1:t}i(Xu,"compareDesc");var oR=Xu;function N(r){return y(r,Date.now())}i(N,"constructNow");var aR=N;function Zu(r){let e=Math.trunc(r/7);return e===0?0:e}i(Zu,"daysToWeeks");var lR=Zu;function ze(r,e,t){let[o,n]=k(t?.in,r,e);return+$e(o)==+$e(n)}i(ze,"isSameDay");var yR=ze;function Un(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}i(Un,"isDate");var wR=Un;function ue(r){return!(!Un(r)&&typeof r!="number"||isNaN(+d(r)))}i(ue,"isValid");var SR=ue;function ec(r,e,t){let[o,n]=k(t?.in,r,e);if(!ue(o)||!ue(n))return NaN;let s=oe(o,n),a=s<0?-1:1,u=Math.trunc(s/7),c=u*5,f=ee(n,u*7);for(;!ze(o,f);)c+=je(f,t)?0:a,f=ee(f,a);return c===0?0:c}i(ec,"differenceInBusinessDays");var NR=ec;function jn(r,e,t){let[o,n]=k(t?.in,r,e);return ge(o,t)-ge(n,t)}i(jn,"differenceInCalendarISOWeekYears");var LR=jn;function tc(r,e,t){let[o,n]=k(t?.in,r,e),s=X(o),a=X(n),u=+s-G(s),c=+a-G(a);return Math.round((u-c)/qe)}i(tc,"differenceInCalendarISOWeeks");var $R=tc;function Yt(r,e,t){let[o,n]=k(t?.in,r,e),s=o.getFullYear()-n.getFullYear(),a=o.getMonth()-n.getMonth();return s*12+a}i(Yt,"differenceInCalendarMonths");var QR=Yt;function mo(r,e){let t=d(r,e?.in);return Math.trunc(t.getMonth()/3)+1}i(mo,"getQuarter");var ZR=mo;function hr(r,e,t){let[o,n]=k(t?.in,r,e),s=o.getFullYear()-n.getFullYear(),a=mo(o)-mo(n);return s*4+a}i(hr,"differenceInCalendarQuarters");var nF=hr;function Bt(r,e,t){let[o,n]=k(t?.in,r,e),s=q(o,t),a=q(n,t),u=+s-G(s),c=+a-G(a);return Math.round((u-c)/qe)}i(Bt,"differenceInCalendarWeeks");var lF=Bt;function mt(r,e,t){let[o,n]=k(t?.in,r,e);return o.getFullYear()-n.getFullYear()}i(mt,"differenceInCalendarYears");var hF=mt;function yr(r,e,t){let[o,n]=k(t?.in,r,e),s=rc(o,n),a=Math.abs(oe(o,n));o.setDate(o.getDate()-s*a);let u=+(rc(o,n)===-s),c=s*(a-u);return c===0?0:c}i(yr,"differenceInDays");function rc(r,e){let t=r.getFullYear()-e.getFullYear()||r.getMonth()-e.getMonth()||r.getDate()-e.getDate()||r.getHours()-e.getHours()||r.getMinutes()-e.getMinutes()||r.getSeconds()-e.getSeconds()||r.getMilliseconds()-e.getMilliseconds();return t<0?-1:t>0?1:t}i(rc,"compareLocalAsc");var bF=yr;function me(r){return e=>{let o=(r?Math[r]:Math.trunc)(e);return o===0?0:o}}i(me,"getRoundingMethod");function Ht(r,e,t){let[o,n]=k(t?.in,r,e),s=(+o-+n)/De;return me(t?.roundingMethod)(s)}i(Ht,"differenceInHours");var IF=Ht;function $n(r,e,t){return An(r,-e,t)}i($n,"subISOWeekYears");var PF=$n;function oc(r,e,t){let[o,n]=k(t?.in,r,e),s=de(o,n),a=Math.abs(jn(o,n,t)),u=$n(o,s*a,t),c=+(de(u,n)===-s),f=s*(a-c);return f===0?0:f}i(oc,"differenceInISOWeekYears");var YF=oc;function xr(r,e){return+d(r)-+d(e)}i(xr,"differenceInMilliseconds");var UF=xr;function qt(r,e,t){let o=xr(r,e)/le;return me(t?.roundingMethod)(o)}i(qt,"differenceInMinutes");var QF=qt;function gr(r,e){let t=d(r,e?.in);return t.setHours(23,59,59,999),t}i(gr,"endOfDay");var ZF=gr;function wr(r,e){let t=d(r,e?.in),o=t.getMonth();return t.setFullYear(t.getFullYear(),o+1,0),t.setHours(23,59,59,999),t}i(wr,"endOfMonth");var oW=wr;function zn(r,e){let t=d(r,e?.in);return+gr(t,e)==+wr(t,e)}i(zn,"isLastDayOfMonth");var cW=zn;function pt(r,e,t){let[o,n,s]=k(t?.in,r,r,e),a=de(n,s),u=Math.abs(Yt(n,s));if(u<1)return 0;n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*u);let c=de(n,s)===-a;zn(o)&&u===1&&de(o,s)===1&&(c=!1);let f=a*(u-+c);return f===0?0:f}i(pt,"differenceInMonths");var yW=pt;function nc(r,e,t){let o=pt(r,e,t)/3;return me(t?.roundingMethod)(o)}i(nc,"differenceInQuarters");var vW=nc;function Ve(r,e,t){let o=xr(r,e)/1e3;return me(t?.roundingMethod)(o)}i(Ve,"differenceInSeconds");var kW=Ve;function ic(r,e,t){let o=yr(r,e,t)/7;return me(t?.roundingMethod)(o)}i(ic,"differenceInWeeks");var CW=ic;function Vn(r,e,t){let[o,n]=k(t?.in,r,e),s=de(o,n),a=Math.abs(mt(o,n));o.setFullYear(1584),n.setFullYear(1584);let u=de(o,n)===-s,c=s*(a-+u);return c===0?0:c}i(Vn,"differenceInYears");var AW=Vn;function ne(r,e){let[t,o]=k(r,e.start,e.end);return{start:t,end:o}}i(ne,"normalizeInterval");function Gn(r,e){let{start:t,end:o}=ne(e?.in,r),n=+t>+o,s=n?+t:+o,a=n?o:t;a.setHours(0,0,0,0);let u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a.setDate(a.getDate()+u),a.setHours(0,0,0,0);return n?c.reverse():c}i(Gn,"eachDayOfInterval");var $W=Gn;function sc(r,e){let{start:t,end:o}=ne(e?.in,r),n=+t>+o,s=n?+t:+o,a=n?o:t;a.setMinutes(0,0,0);let u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a.setHours(a.getHours()+u);return n?c.reverse():c}i(sc,"eachHourOfInterval");var JW=sc;function ac(r,e){let{start:t,end:o}=ne(e?.in,r);t.setSeconds(0,0);let n=+t>+o,s=n?+t:+o,a=n?o:t,u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a=mr(a,u);return n?c.reverse():c}i(ac,"eachMinuteOfInterval");var rA=ac;function uc(r,e){let{start:t,end:o}=ne(e?.in,r),n=+t>+o,s=n?+t:+o,a=n?o:t;a.setHours(0,0,0,0),a.setDate(1);let u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a.setMonth(a.getMonth()+u);return n?c.reverse():c}i(uc,"eachMonthOfInterval");var aA=uc;function Ge(r,e){let t=d(r,e?.in),o=t.getMonth(),n=o-o%3;return t.setMonth(n,1),t.setHours(0,0,0,0),t}i(Ge,"startOfQuarter");var lA=Ge;function cc(r,e){let{start:t,end:o}=ne(e?.in,r),n=+t>+o,s=n?+Ge(t):+Ge(o),a=n?Ge(o):Ge(t),u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a=pr(a,u);return n?c.reverse():c}i(cc,"eachQuarterOfInterval");var gA=cc;function fc(r,e){let{start:t,end:o}=ne(e?.in,r),n=+t>+o,s=n?q(o,e):q(t,e),a=n?q(t,e):q(o,e);s.setHours(15),a.setHours(15);let u=+a.getTime(),c=s,f=e?.step??1;if(!f)return[];f<0&&(f=-f,n=!n);let l=[];for(;+c<=u;)c.setHours(0),l.push(y(t,c)),c=dt(c,f),c.setHours(15);return n?l.reverse():l}i(fc,"eachWeekOfInterval");var MA=fc;function br(r,e){let{start:t,end:o}=ne(e?.in,r),n=Gn({start:t,end:o},e),s=[],a=0;for(;a<n.length;){let u=n[a++];je(u)&&s.push(y(t,u))}return s}i(br,"eachWeekendOfInterval");var PA=br;function ht(r,e){let t=d(r,e?.in);return t.setDate(1),t.setHours(0,0,0,0),t}i(ht,"startOfMonth");var WA=ht;function lc(r,e){let t=ht(r,e),o=wr(r,e);return br({start:t,end:o},e)}i(lc,"eachWeekendOfMonth");var qA=lc;function Qn(r,e){let t=d(r,e?.in),o=t.getFullYear();return t.setFullYear(o+1,0,0),t.setHours(23,59,59,999),t}i(Qn,"endOfYear");var zA=Qn;function vr(r,e){let t=d(r,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}i(vr,"startOfYear");var JA=vr;function dc(r,e){let t=vr(r,e),o=Qn(r,e);return br({start:t,end:o},e)}i(dc,"eachWeekendOfYear");var rL=dc;function mc(r,e){let{start:t,end:o}=ne(e?.in,r),n=+t>+o,s=n?+t:+o,a=n?o:t;a.setHours(0,0,0,0),a.setMonth(0,1);let u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a.setFullYear(a.getFullYear()+u);return n?c.reverse():c}i(mc,"eachYearOfInterval");var aL=mc;function pc(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=9+Math.floor(o/10)*10;return t.setFullYear(n,11,31),t.setHours(23,59,59,999),t}i(pc,"endOfDecade");var lL=pc;function hc(r,e){let t=d(r,e?.in);return t.setMinutes(59,59,999),t}i(hc,"endOfHour");var hL=hc;function Jn(r,e){let t=L(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=d(r,e?.in),s=n.getDay(),a=(s<o?-7:0)+6-(s-o);return n.setDate(n.getDate()+a),n.setHours(23,59,59,999),n}i(Jn,"endOfWeek");var bL=Jn;function yc(r,e){return Jn(r,{...e,weekStartsOn:1})}i(yc,"endOfISOWeek");var SL=yc;function xc(r,e){let t=ge(r,e),o=y(e?.in||r,0);o.setFullYear(t+1,0,4),o.setHours(0,0,0,0);let n=X(o,e);return n.setMilliseconds(n.getMilliseconds()-1),n}i(xc,"endOfISOWeekYear");var _L=xc;function gc(r,e){let t=d(r,e?.in);return t.setSeconds(59,999),t}i(gc,"endOfMinute");var RL=gc;function wc(r,e){let t=d(r,e?.in),o=t.getMonth(),n=o-o%3+3;return t.setMonth(n,0),t.setHours(23,59,59,999),t}i(wc,"endOfQuarter");var LL=wc;function bc(r,e){let t=d(r,e?.in);return t.setMilliseconds(999),t}i(bc,"endOfSecond");var qL=bc;function vc(r){return gr(Date.now(),r)}i(vc,"endOfToday");var zL=vc;function Tc(r){let e=N(r?.in),t=e.getFullYear(),o=e.getMonth(),n=e.getDate(),s=N(r?.in);return s.setFullYear(t,o,n+1),s.setHours(23,59,59,999),r?.in?r.in(s):s}i(Tc,"endOfTomorrow");var JL=Tc;function Dc(r){let e=N(r?.in),t=y(r?.in,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()-1),t.setHours(23,59,59,999),t}i(Dc,"endOfYesterday");var t2=Dc;var My={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"}},Sc=i((r,e,t)=>{let o,n=My[r];return typeof n=="string"?o=n:e===1?o=n.one:o=n.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+o:o+" ago":o},"formatDistance");function Kn(r){return(e={})=>{let t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}i(Kn,"buildFormatLongFn");var ky={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Oy={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Iy={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Mc={date:Kn({formats:ky,defaultWidth:"full"}),time:Kn({formats:Oy,defaultWidth:"full"}),dateTime:Kn({formats:Iy,defaultWidth:"full"})};var Ey={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},kc=i((r,e,t,o)=>Ey[r],"formatRelative");function Tr(r){return(e,t)=>{let o=t?.context?String(t.context):"standalone",n;if(o==="formatting"&&r.formattingValues){let a=r.defaultFormattingWidth||r.defaultWidth,u=t?.width?String(t.width):a;n=r.formattingValues[u]||r.formattingValues[a]}else{let a=r.defaultWidth,u=t?.width?String(t.width):r.defaultWidth;n=r.values[u]||r.values[a]}let s=r.argumentCallback?r.argumentCallback(e):e;return n[s]}}i(Tr,"buildLocalizeFn");var _y={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Cy={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Py={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"]},Ny={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"]},Ry={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"}},Fy={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"}},Wy=i((r,e)=>{let t=Number(r),o=t%100;if(o>20||o<10)switch(o%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},"ordinalNumber"),Oc={ordinalNumber:Wy,era:Tr({values:_y,defaultWidth:"wide"}),quarter:Tr({values:Cy,defaultWidth:"wide",argumentCallback:i(r=>r-1,"argumentCallback")}),month:Tr({values:Py,defaultWidth:"wide"}),day:Tr({values:Ny,defaultWidth:"wide"}),dayPeriod:Tr({values:Ry,defaultWidth:"wide",formattingValues:Fy,defaultFormattingWidth:"wide"})};function Dr(r){return(e,t={})=>{let o=t.width,n=o&&r.matchPatterns[o]||r.matchPatterns[r.defaultMatchWidth],s=e.match(n);if(!s)return null;let a=s[0],u=o&&r.parsePatterns[o]||r.parsePatterns[r.defaultParseWidth],c=Array.isArray(u)?Ly(u,m=>m.test(a)):Ay(u,m=>m.test(a)),f;f=r.valueCallback?r.valueCallback(c):c,f=t.valueCallback?t.valueCallback(f):f;let l=e.slice(a.length);return{value:f,rest:l}}}i(Dr,"buildMatchFn");function Ay(r,e){for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}i(Ay,"findKey");function Ly(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}i(Ly,"findIndex");function Ic(r){return(e,t={})=>{let o=e.match(r.matchPattern);if(!o)return null;let n=o[0],s=e.match(r.parsePattern);if(!s)return null;let a=r.valueCallback?r.valueCallback(s[0]):s[0];a=t.valueCallback?t.valueCallback(a):a;let u=e.slice(n.length);return{value:a,rest:u}}}i(Ic,"buildMatchPatternFn");var Yy=/^(\d+)(th|st|nd|rd)?/i,By=/\d+/i,Hy={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},qy={any:[/^b/i,/^(a|c)/i]},Uy={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},jy={any:[/1/i,/2/i,/3/i,/4/i]},$y={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},zy={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Vy={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},Gy={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]},Qy={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},Jy={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}},Ec={ordinalNumber:Ic({matchPattern:Yy,parsePattern:By,valueCallback:i(r=>parseInt(r,10),"valueCallback")}),era:Dr({matchPatterns:Hy,defaultMatchWidth:"wide",parsePatterns:qy,defaultParseWidth:"any"}),quarter:Dr({matchPatterns:Uy,defaultMatchWidth:"wide",parsePatterns:jy,defaultParseWidth:"any",valueCallback:i(r=>r+1,"valueCallback")}),month:Dr({matchPatterns:$y,defaultMatchWidth:"wide",parsePatterns:zy,defaultParseWidth:"any"}),day:Dr({matchPatterns:Vy,defaultMatchWidth:"wide",parsePatterns:Gy,defaultParseWidth:"any"}),dayPeriod:Dr({matchPatterns:Qy,defaultMatchWidth:"any",parsePatterns:Jy,defaultParseWidth:"any"})};var ve={code:"en-US",formatDistance:Sc,formatLong:Mc,formatRelative:kc,localize:Oc,match:Ec,options:{weekStartsOn:0,firstWeekContainsDate:1}},_2=ve;function Xn(r,e){let t=d(r,e?.in);return oe(t,vr(t))+1}i(Xn,"getDayOfYear");var A2=Xn;function Sr(r,e){let t=d(r,e?.in),o=+X(t)-+Se(t);return Math.round(o/qe)+1}i(Sr,"getISOWeek");var j2=Sr;function yt(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=L(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=y(e?.in||r,0);a.setFullYear(o+1,0,s),a.setHours(0,0,0,0);let u=q(a,e),c=y(e?.in||r,0);c.setFullYear(o,0,s),c.setHours(0,0,0,0);let f=q(c,e);return+t>=+u?o+1:+t>=+f?o:o-1}i(yt,"getWeekYear");var K2=yt;function Ut(r,e){let t=L(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,n=yt(r,e),s=y(e?.in||r,0);return s.setFullYear(n,0,o),s.setHours(0,0,0,0),q(s,e)}i(Ut,"startOfWeekYear");var nY=Ut;function Mr(r,e){let t=d(r,e?.in),o=+q(t,e)-+Ut(t,e);return Math.round(o/qe)+1}i(Mr,"getWeek");var lY=Mr;function M(r,e){let t=r<0?"-":"",o=Math.abs(r).toString().padStart(e,"0");return t+o}i(M,"addLeadingZeros");var Me={y(r,e){let t=r.getFullYear(),o=t>0?t:1-t;return M(e==="yy"?o%100:o,e.length)},M(r,e){let t=r.getMonth();return e==="M"?String(t+1):M(t+1,2)},d(r,e){return M(r.getDate(),e.length)},a(r,e){let t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(r,e){return M(r.getHours()%12||12,e.length)},H(r,e){return M(r.getHours(),e.length)},m(r,e){return M(r.getMinutes(),e.length)},s(r,e){return M(r.getSeconds(),e.length)},S(r,e){let t=e.length,o=r.getMilliseconds(),n=Math.trunc(o*Math.pow(10,t-3));return M(n,e.length)}};var kr={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},po={G:i(function(r,e,t){let o=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(o,{width:"abbreviated"});case"GGGGG":return t.era(o,{width:"narrow"});default:return t.era(o,{width:"wide"})}},"G"),y:i(function(r,e,t){if(e==="yo"){let o=r.getFullYear(),n=o>0?o:1-o;return t.ordinalNumber(n,{unit:"year"})}return Me.y(r,e)},"y"),Y:i(function(r,e,t,o){let n=yt(r,o),s=n>0?n:1-n;if(e==="YY"){let a=s%100;return M(a,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):M(s,e.length)},"Y"),R:i(function(r,e){let t=ge(r);return M(t,e.length)},"R"),u:i(function(r,e){let t=r.getFullYear();return M(t,e.length)},"u"),Q:i(function(r,e,t){let o=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(o);case"QQ":return M(o,2);case"Qo":return t.ordinalNumber(o,{unit:"quarter"});case"QQQ":return t.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(o,{width:"narrow",context:"formatting"});default:return t.quarter(o,{width:"wide",context:"formatting"})}},"Q"),q:i(function(r,e,t){let o=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(o);case"qq":return M(o,2);case"qo":return t.ordinalNumber(o,{unit:"quarter"});case"qqq":return t.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(o,{width:"narrow",context:"standalone"});default:return t.quarter(o,{width:"wide",context:"standalone"})}},"q"),M:i(function(r,e,t){let o=r.getMonth();switch(e){case"M":case"MM":return Me.M(r,e);case"Mo":return t.ordinalNumber(o+1,{unit:"month"});case"MMM":return t.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(o,{width:"narrow",context:"formatting"});default:return t.month(o,{width:"wide",context:"formatting"})}},"M"),L:i(function(r,e,t){let o=r.getMonth();switch(e){case"L":return String(o+1);case"LL":return M(o+1,2);case"Lo":return t.ordinalNumber(o+1,{unit:"month"});case"LLL":return t.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(o,{width:"narrow",context:"standalone"});default:return t.month(o,{width:"wide",context:"standalone"})}},"L"),w:i(function(r,e,t,o){let n=Mr(r,o);return e==="wo"?t.ordinalNumber(n,{unit:"week"}):M(n,e.length)},"w"),I:i(function(r,e,t){let o=Sr(r);return e==="Io"?t.ordinalNumber(o,{unit:"week"}):M(o,e.length)},"I"),d:i(function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):Me.d(r,e)},"d"),D:i(function(r,e,t){let o=Xn(r);return e==="Do"?t.ordinalNumber(o,{unit:"dayOfYear"}):M(o,e.length)},"D"),E:i(function(r,e,t){let o=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(o,{width:"short",context:"formatting"});default:return t.day(o,{width:"wide",context:"formatting"})}},"E"),e:i(function(r,e,t,o){let n=r.getDay(),s=(n-o.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return M(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(n,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(n,{width:"short",context:"formatting"});default:return t.day(n,{width:"wide",context:"formatting"})}},"e"),c:i(function(r,e,t,o){let n=r.getDay(),s=(n-o.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return M(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(n,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(n,{width:"narrow",context:"standalone"});case"cccccc":return t.day(n,{width:"short",context:"standalone"});default:return t.day(n,{width:"wide",context:"standalone"})}},"c"),i:i(function(r,e,t){let o=r.getDay(),n=o===0?7:o;switch(e){case"i":return String(n);case"ii":return M(n,e.length);case"io":return t.ordinalNumber(n,{unit:"day"});case"iii":return t.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(o,{width:"short",context:"formatting"});default:return t.day(o,{width:"wide",context:"formatting"})}},"i"),a:i(function(r,e,t){let n=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},"a"),b:i(function(r,e,t){let o=r.getHours(),n;switch(o===12?n=kr.noon:o===0?n=kr.midnight:n=o/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},"b"),B:i(function(r,e,t){let o=r.getHours(),n;switch(o>=17?n=kr.evening:o>=12?n=kr.afternoon:o>=4?n=kr.morning:n=kr.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},"B"),h:i(function(r,e,t){if(e==="ho"){let o=r.getHours()%12;return o===0&&(o=12),t.ordinalNumber(o,{unit:"hour"})}return Me.h(r,e)},"h"),H:i(function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):Me.H(r,e)},"H"),K:i(function(r,e,t){let o=r.getHours()%12;return e==="Ko"?t.ordinalNumber(o,{unit:"hour"}):M(o,e.length)},"K"),k:i(function(r,e,t){let o=r.getHours();return o===0&&(o=24),e==="ko"?t.ordinalNumber(o,{unit:"hour"}):M(o,e.length)},"k"),m:i(function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):Me.m(r,e)},"m"),s:i(function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):Me.s(r,e)},"s"),S:i(function(r,e){return Me.S(r,e)},"S"),X:i(function(r,e,t){let o=r.getTimezoneOffset();if(o===0)return"Z";switch(e){case"X":return Cc(o);case"XXXX":case"XX":return jt(o);default:return jt(o,":")}},"X"),x:i(function(r,e,t){let o=r.getTimezoneOffset();switch(e){case"x":return Cc(o);case"xxxx":case"xx":return jt(o);default:return jt(o,":")}},"x"),O:i(function(r,e,t){let o=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+_c(o,":");default:return"GMT"+jt(o,":")}},"O"),z:i(function(r,e,t){let o=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+_c(o,":");default:return"GMT"+jt(o,":")}},"z"),t:i(function(r,e,t){let o=Math.trunc(+r/1e3);return M(o,e.length)},"t"),T:i(function(r,e,t){return M(+r,e.length)},"T")};function _c(r,e=""){let t=r>0?"-":"+",o=Math.abs(r),n=Math.trunc(o/60),s=o%60;return s===0?t+String(n):t+String(n)+e+M(s,2)}i(_c,"formatTimezoneShort");function Cc(r,e){return r%60===0?(r>0?"-":"+")+M(Math.abs(r)/60,2):jt(r,e)}i(Cc,"formatTimezoneWithOptionalMinutes");function jt(r,e=""){let t=r>0?"-":"+",o=Math.abs(r),n=M(Math.trunc(o/60),2),s=M(o%60,2);return t+n+e+s}i(jt,"formatTimezone");var Pc=i((r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},"dateLongFormatter"),Nc=i((r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},"timeLongFormatter"),Ky=i((r,e)=>{let t=r.match(/(P+)(p+)?/)||[],o=t[1],n=t[2];if(!n)return Pc(r,e);let s;switch(o){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",Pc(o,e)).replace("{{time}}",Nc(n,e))},"dateTimeLongFormatter"),xt={p:Nc,P:Ky};var Xy=/^D+$/,Zy=/^Y+$/,ex=["D","DD","YY","YYYY"];function Zn(r){return Xy.test(r)}i(Zn,"isProtectedDayOfYearToken");function ei(r){return Zy.test(r)}i(ei,"isProtectedWeekYearToken");function ho(r,e,t){let o=tx(r,e,t);if(console.warn(o),ex.includes(r))throw new RangeError(o)}i(ho,"warnOrThrowProtectedError");function tx(r,e,t){let o=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${o} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}i(tx,"message");var rx=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ox=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,nx=/^'([^]*?)'?$/,ix=/''/g,sx=/[a-zA-Z]/;function yo(r,e,t){let o=L(),n=t?.locale??o.locale??ve,s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,u=d(r,t?.in);if(!ue(u))throw new RangeError("Invalid time value");let c=e.match(ox).map(l=>{let m=l[0];if(m==="p"||m==="P"){let p=xt[m];return p(l,n.formatLong)}return l}).join("").match(rx).map(l=>{if(l==="''")return{isToken:!1,value:"'"};let m=l[0];if(m==="'")return{isToken:!1,value:ax(l)};if(po[m])return{isToken:!0,value:l};if(m.match(sx))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:l}});n.localize.preprocessor&&(c=n.localize.preprocessor(u,c));let f={firstWeekContainsDate:s,weekStartsOn:a,locale:n};return c.map(l=>{if(!l.isToken)return l.value;let m=l.value;(!t?.useAdditionalWeekYearTokens&&ei(m)||!t?.useAdditionalDayOfYearTokens&&Zn(m))&&ho(m,e,String(r));let p=po[m[0]];return p(u,m,n.localize,f)}).join("")}i(yo,"format");function ax(r){let e=r.match(nx);return e?e[1].replace(ix,"'"):r}i(ax,"cleanEscapedString");var LY=yo;function ti(r,e,t){let o=L(),n=t?.locale??o.locale??ve,s=2520,a=de(r,e);if(isNaN(a))throw new RangeError("Invalid time value");let u=Object.assign({},t,{addSuffix:t?.addSuffix,comparison:a}),[c,f]=k(t?.in,...a>0?[e,r]:[r,e]),l=Ve(f,c),m=(G(f)-G(c))/1e3,p=Math.round((l-m)/60),h;if(p<2)return t?.includeSeconds?l<5?n.formatDistance("lessThanXSeconds",5,u):l<10?n.formatDistance("lessThanXSeconds",10,u):l<20?n.formatDistance("lessThanXSeconds",20,u):l<40?n.formatDistance("halfAMinute",0,u):l<60?n.formatDistance("lessThanXMinutes",1,u):n.formatDistance("xMinutes",1,u):p===0?n.formatDistance("lessThanXMinutes",1,u):n.formatDistance("xMinutes",p,u);if(p<45)return n.formatDistance("xMinutes",p,u);if(p<90)return n.formatDistance("aboutXHours",1,u);if(p<lr){let g=Math.round(p/60);return n.formatDistance("aboutXHours",g,u)}else{if(p<s)return n.formatDistance("xDays",1,u);if(p<ct){let g=Math.round(p/lr);return n.formatDistance("xDays",g,u)}else if(p<ct*2)return h=Math.round(p/ct),n.formatDistance("aboutXMonths",h,u)}if(h=pt(f,c),h<12){let g=Math.round(p/ct);return n.formatDistance("xMonths",g,u)}else{let g=h%12,x=Math.trunc(h/12);return g<3?n.formatDistance("aboutXYears",x,u):g<9?n.formatDistance("overXYears",x,u):n.formatDistance("almostXYears",x+1,u)}}i(ti,"formatDistance");var QY=ti;function ri(r,e,t){let o=L(),n=t?.locale??o.locale??ve,s=de(r,e);if(isNaN(s))throw new RangeError("Invalid time value");let a=Object.assign({},t,{addSuffix:t?.addSuffix,comparison:s}),[u,c]=k(t?.in,...s>0?[e,r]:[r,e]),f=me(t?.roundingMethod??"round"),l=c.getTime()-u.getTime(),m=l/le,p=G(c)-G(u),h=(l-p)/le,g=t?.unit,x;if(g?x=g:m<1?x="second":m<60?x="minute":m<lr?x="hour":h<ct?x="day":h<xa?x="month":x="year",x==="second"){let w=f(l/1e3);return n.formatDistance("xSeconds",w,a)}else if(x==="minute"){let w=f(m);return n.formatDistance("xMinutes",w,a)}else if(x==="hour"){let w=f(m/60);return n.formatDistance("xHours",w,a)}else if(x==="day"){let w=f(h/lr);return n.formatDistance("xDays",w,a)}else if(x==="month"){let w=f(h/ct);return w===12&&g!=="month"?n.formatDistance("xYears",1,a):n.formatDistance("xMonths",w,a)}else{let w=f(h/xa);return n.formatDistance("xYears",w,a)}}i(ri,"formatDistanceStrict");var iB=ri;function Rc(r,e){return ti(r,N(r),e)}i(Rc,"formatDistanceToNow");var fB=Rc;function Fc(r,e){return ri(r,N(r),e)}i(Fc,"formatDistanceToNowStrict");var hB=Fc;var ux=["years","months","weeks","days","hours","minutes","seconds"];function Wc(r,e){let t=L(),o=e?.locale??t.locale??ve,n=e?.format??ux,s=e?.zero??!1,a=e?.delimiter??" ";return o.formatDistance?n.reduce((c,f)=>{let l=`x${f.replace(/(^.)/,p=>p.toUpperCase())}`,m=r[f];return m!==void 0&&(s||r[f])?c.concat(o.formatDistance(l,m)):c},[]).join(a):""}i(Wc,"formatDuration");var bB=Wc;function Ac(r,e){let t=d(r,e?.in);if(isNaN(+t))throw new RangeError("Invalid time value");let o=e?.format??"extended",n=e?.representation??"complete",s="",a="",u=o==="extended"?"-":"",c=o==="extended"?":":"";if(n!=="time"){let f=M(t.getDate(),2),l=M(t.getMonth()+1,2);s=`${M(t.getFullYear(),4)}${u}${l}${u}${f}`}if(n!=="date"){let f=t.getTimezoneOffset();if(f!==0){let x=Math.abs(f),w=M(Math.trunc(x/60),2),T=M(x%60,2);a=`${f<0?"+":"-"}${w}:${T}`}else a="Z";let l=M(t.getHours(),2),m=M(t.getMinutes(),2),p=M(t.getSeconds(),2),h=s===""?"":"T",g=[l,m,p].join(c);s=`${s}${h}${g}${a}`}return s}i(Ac,"formatISO");var MB=Ac;function Lc(r,e){let t=d(r,e?.in);if(!ue(t))throw new RangeError("Invalid time value");let o=e?.format??"extended",n=e?.representation??"complete",s="",a=o==="extended"?"-":"",u=o==="extended"?":":"";if(n!=="time"){let c=M(t.getDate(),2),f=M(t.getMonth()+1,2);s=`${M(t.getFullYear(),4)}${a}${f}${a}${c}`}if(n!=="date"){let c=M(t.getHours(),2),f=M(t.getMinutes(),2),l=M(t.getSeconds(),2);s=`${s}${s===""?"":" "}${c}${u}${f}${u}${l}`}return s}i(Lc,"formatISO9075");var CB=Lc;function Yc(r){let{years:e=0,months:t=0,days:o=0,hours:n=0,minutes:s=0,seconds:a=0}=r;return`P${e}Y${t}M${o}DT${n}H${s}M${a}S`}i(Yc,"formatISODuration");var RB=Yc;function Bc(r,e){let t=d(r,e?.in);if(!ue(t))throw new RangeError("Invalid time value");let o=e?.fractionDigits??0,n=M(t.getDate(),2),s=M(t.getMonth()+1,2),a=t.getFullYear(),u=M(t.getHours(),2),c=M(t.getMinutes(),2),f=M(t.getSeconds(),2),l="";if(o>0){let h=t.getMilliseconds(),g=Math.trunc(h*Math.pow(10,o-3));l="."+M(g,o)}let m="",p=t.getTimezoneOffset();if(p!==0){let h=Math.abs(p),g=M(Math.trunc(h/60),2),x=M(h%60,2);m=`${p<0?"+":"-"}${g}:${x}`}else m="Z";return`${a}-${s}-${n}T${u}:${c}:${f}${l}${m}`}i(Bc,"formatRFC3339");var BB=Bc;var cx=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],fx=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Hc(r){let e=d(r);if(!ue(e))throw new RangeError("Invalid time value");let t=cx[e.getUTCDay()],o=M(e.getUTCDate(),2),n=fx[e.getUTCMonth()],s=e.getUTCFullYear(),a=M(e.getUTCHours(),2),u=M(e.getUTCMinutes(),2),c=M(e.getUTCSeconds(),2);return`${t}, ${o} ${n} ${s} ${a}:${u}:${c} GMT`}i(Hc,"formatRFC7231");var zB=Hc;function qc(r,e,t){let[o,n]=k(t?.in,r,e),s=L(),a=t?.locale??s.locale??ve,u=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,c=oe(o,n);if(isNaN(c))throw new RangeError("Invalid time value");let f;c<-6?f="other":c<-1?f="lastWeek":c<0?f="yesterday":c<1?f="today":c<2?f="tomorrow":c<7?f="nextWeek":f="other";let l=a.formatRelative(f,o,n,{locale:a,weekStartsOn:u});return yo(o,l,{locale:a,weekStartsOn:u})}i(qc,"formatRelative");var eH=qc;function Uc(r,e){return d(r*1e3,e?.in)}i(Uc,"fromUnixTime");var nH=Uc;function oi(r,e){return d(r,e?.in).getDate()}i(oi,"getDate");var uH=oi;function gt(r,e){return d(r,e?.in).getDay()}i(gt,"getDay");var dH=gt;function ni(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=t.getMonth(),s=y(t,0);return s.setFullYear(o,n+1,0),s.setHours(0,0,0,0),s.getDate()}i(ni,"getDaysInMonth");var xH=ni;function ii(r,e){let o=d(r,e?.in).getFullYear();return o%400===0||o%4===0&&o%100!==0}i(ii,"isLeapYear");var vH=ii;function jc(r,e){let t=d(r,e?.in);return Number.isNaN(+t)?NaN:ii(t)?366:365}i(jc,"getDaysInYear");var kH=jc;function $c(r,e){let o=d(r,e?.in).getFullYear();return Math.floor(o/10)*10}i($c,"getDecade");var _H=$c;function si(){return Object.assign({},L())}i(si,"getDefaultOptions");var RH=si;function zc(r,e){return d(r,e?.in).getHours()}i(zc,"getHours");var LH=zc;function ai(r,e){let t=d(r,e?.in).getDay();return t===0?7:t}i(ai,"getISODay");var qH=ai;function Vc(r,e){let t=Se(r,e),n=+Se(dt(t,60))-+t;return Math.round(n/qe)}i(Vc,"getISOWeeksInYear");var GH=Vc;function Gc(r){return d(r).getMilliseconds()}i(Gc,"getMilliseconds");var XH=Gc;function Qc(r,e){return d(r,e?.in).getMinutes()}i(Qc,"getMinutes");var rq=Qc;function Jc(r,e){return d(r,e?.in).getMonth()}i(Jc,"getMonth");var sq=Jc;function Kc(r,e){let[t,o]=[+d(r.start),+d(r.end)].sort((m,p)=>m-p),[n,s]=[+d(e.start),+d(e.end)].sort((m,p)=>m-p);if(!(t<s&&n<o))return 0;let u=n<t?t:n,c=u-G(u),f=s>o?o:s,l=f-G(f);return Math.ceil((l-c)/On)}i(Kc,"getOverlappingDaysInIntervals");var dq=Kc;function Xc(r){return d(r).getSeconds()}i(Xc,"getSeconds");var yq=Xc;function Zc(r){return+d(r)}i(Zc,"getTime");var bq=Zc;function ef(r){return Math.trunc(+d(r)/1e3)}i(ef,"getUnixTime");var Sq=ef;function tf(r,e){let t=L(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=oi(d(r,e?.in));if(isNaN(n))return NaN;let s=gt(ht(r,e)),a=o-s;a<=0&&(a+=7);let u=n-a;return Math.ceil(u/7)+1}i(tf,"getWeekOfMonth");var Pq=tf;function ui(r,e){let t=d(r,e?.in),o=t.getMonth();return t.setFullYear(t.getFullYear(),o+1,0),t.setHours(0,0,0,0),d(t,e?.in)}i(ui,"lastDayOfMonth");var Wq=ui;function rf(r,e){let t=d(r,e?.in);return Bt(ui(t,e),ht(t,e),e)+1}i(rf,"getWeeksInMonth");var Uq=rf;function of(r,e){return d(r,e?.in).getFullYear()}i(of,"getYear");var Vq=of;function nf(r){return Math.trunc(r*De)}i(nf,"hoursToMilliseconds");var Kq=nf;function sf(r){return Math.trunc(r*In)}i(sf,"hoursToMinutes");var tU=sf;function af(r){return Math.trunc(r*Lt)}i(af,"hoursToSeconds");var iU=af;function uf(r,e,t){let[o,n]=k(t?.in,r,e);if(isNaN(+o))throw new TypeError("Start date is invalid");if(isNaN(+n))throw new TypeError("End date is invalid");if(t?.assertPositive&&+o>+n)throw new TypeError("End date must be after start date");return{start:o,end:n}}i(uf,"interval");var cU=uf;function cf(r,e){let{start:t,end:o}=ne(e?.in,r),n={},s=Vn(o,t);s&&(n.years=s);let a=ft(t,{years:n.years}),u=pt(o,a);u&&(n.months=u);let c=ft(a,{months:n.months}),f=yr(o,c);f&&(n.days=f);let l=ft(c,{days:n.days}),m=Ht(o,l);m&&(n.hours=m);let p=ft(l,{hours:n.hours}),h=qt(o,p);h&&(n.minutes=h);let g=ft(p,{minutes:n.minutes}),x=Ve(o,g);return x&&(n.seconds=x),n}i(cf,"intervalToDuration");var bU=cf;function ff(r,e,t){let o;return lx(e)?o=e:t=e,new Intl.DateTimeFormat(t?.locale,o).format(d(r))}i(ff,"intlFormat");function lx(r){return r!==void 0&&!("locale"in r)}i(lx,"isFormatOptions");var SU=ff;function lf(r,e,t){let o=0,n,[s,a]=k(t?.in,r,e);if(t?.unit)n=t?.unit,n==="second"?o=Ve(s,a):n==="minute"?o=qt(s,a):n==="hour"?o=Ht(s,a):n==="day"?o=oe(s,a):n==="week"?o=Bt(s,a):n==="month"?o=Yt(s,a):n==="quarter"?o=hr(s,a):n==="year"&&(o=mt(s,a));else{let c=Ve(s,a);Math.abs(c)<dr?(o=Ve(s,a),n="second"):Math.abs(c)<Lt?(o=qt(s,a),n="minute"):Math.abs(c)<Mn&&Math.abs(oe(s,a))<1?(o=Ht(s,a),n="hour"):Math.abs(c)<$u&&(o=oe(s,a))&&Math.abs(o)<7?n="day":Math.abs(c)<wa?(o=Bt(s,a),n="week"):Math.abs(c)<zu?(o=Yt(s,a),n="month"):Math.abs(c)<ga?hr(s,a)<4?(o=hr(s,a),n="quarter"):(o=mt(s,a),n="year"):(o=mt(s,a),n="year")}return new Intl.RelativeTimeFormat(t?.locale,{numeric:"auto",...t}).format(o,n)}i(lf,"intlFormatDistance");var AU=lf;function df(r,e){return+d(r)>+d(e)}i(df,"isAfter");var HU=df;function mf(r,e){return+d(r)<+d(e)}i(mf,"isBefore");var $U=mf;function pf(r,e){return+d(r)==+d(e)}i(pf,"isEqual");var QU=pf;function hf(r,e,t){let o=new Date(r,e,t);return o.getFullYear()===r&&o.getMonth()===e&&o.getDate()===t}i(hf,"isExists");var XU=hf;function yf(r,e){return d(r,e?.in).getDate()===1}i(yf,"isFirstDayOfMonth");var rj=yf;function xf(r,e){return d(r,e?.in).getDay()===5}i(xf,"isFriday");var sj=xf;function gf(r){return+d(r)>Date.now()}i(gf,"isFuture");var fj=gf;function ci(r,e){let t=dx(e)?new e(0):y(e,0);return t.setFullYear(r.getFullYear(),r.getMonth(),r.getDate()),t.setHours(r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()),t}i(ci,"transpose");function dx(r){return typeof r=="function"&&r.prototype?.constructor===r}i(dx,"isConstructor");var pj=ci;var mx=10,fi=class{static{i(this,"Setter")}subPriority=0;validate(e,t){return!0}},li=class extends fi{static{i(this,"ValueSetter")}constructor(e,t,o,n,s){super(),this.value=e,this.validateValue=t,this.setValue=o,this.priority=n,s&&(this.subPriority=s)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,o){return this.setValue(e,t,this.value,o)}},di=class extends fi{static{i(this,"DateTimezoneSetter")}priority=mx;subPriority=-1;constructor(e,t){super(),this.context=e||(o=>y(t,o))}set(e,t){return t.timestampIsSet?e:y(e,ci(e,this.context))}};var S=class{static{i(this,"Parser")}run(e,t,o,n){let s=this.parse(e,t,o,n);return s?{setter:new li(s.value,this.validate,this.set,this.priority,this.subPriority),rest:s.rest}:null}validate(e,t,o){return!0}};var mi=class extends S{static{i(this,"EraParser")}priority=140;parse(e,t,o){switch(t){case"G":case"GG":case"GGG":return o.era(e,{width:"abbreviated"})||o.era(e,{width:"narrow"});case"GGGGG":return o.era(e,{width:"narrow"});default:return o.era(e,{width:"wide"})||o.era(e,{width:"abbreviated"})||o.era(e,{width:"narrow"})}}set(e,t,o){return t.era=o,e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]};var W={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},Pe={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function Y(r,e){return r&&{value:e(r.value),rest:r.rest}}i(Y,"mapValue");function F(r,e){let t=e.match(r);return t?{value:parseInt(t[0],10),rest:e.slice(t[0].length)}:null}i(F,"parseNumericPattern");function Ne(r,e){let t=e.match(r);if(!t)return null;if(t[0]==="Z")return{value:0,rest:e.slice(1)};let o=t[1]==="+"?1:-1,n=t[2]?parseInt(t[2],10):0,s=t[3]?parseInt(t[3],10):0,a=t[5]?parseInt(t[5],10):0;return{value:o*(n*De+s*le+a*fr),rest:e.slice(t[0].length)}}i(Ne,"parseTimezonePattern");function pi(r){return F(W.anyDigitsSigned,r)}i(pi,"parseAnyDigitsSigned");function _(r,e){switch(r){case 1:return F(W.singleDigit,e);case 2:return F(W.twoDigits,e);case 3:return F(W.threeDigits,e);case 4:return F(W.fourDigits,e);default:return F(new RegExp("^\\d{1,"+r+"}"),e)}}i(_,"parseNDigits");function Or(r,e){switch(r){case 1:return F(W.singleDigitSigned,e);case 2:return F(W.twoDigitsSigned,e);case 3:return F(W.threeDigitsSigned,e);case 4:return F(W.fourDigitsSigned,e);default:return F(new RegExp("^-?\\d{1,"+r+"}"),e)}}i(Or,"parseNDigitsSigned");function Ir(r){switch(r){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}i(Ir,"dayPeriodEnumToHours");function hi(r,e){let t=e>0,o=t?e:1-e,n;if(o<=50)n=r||100;else{let s=o+50,a=Math.trunc(s/100)*100,u=r>=s%100;n=r+a-(u?100:0)}return t?n:1-n}i(hi,"normalizeTwoDigitYear");function yi(r){return r%400===0||r%4===0&&r%100!==0}i(yi,"isLeapYearIndex");var xi=class extends S{static{i(this,"YearParser")}priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,t,o){let n=i(s=>({year:s,isTwoDigitYear:t==="yy"}),"valueCallback");switch(t){case"y":return Y(_(4,e),n);case"yo":return Y(o.ordinalNumber(e,{unit:"year"}),n);default:return Y(_(t.length,e),n)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,o){let n=e.getFullYear();if(o.isTwoDigitYear){let a=hi(o.year,n);return e.setFullYear(a,0,1),e.setHours(0,0,0,0),e}let s=!("era"in t)||t.era===1?o.year:1-o.year;return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}};var gi=class extends S{static{i(this,"LocalWeekYearParser")}priority=130;parse(e,t,o){let n=i(s=>({year:s,isTwoDigitYear:t==="YY"}),"valueCallback");switch(t){case"Y":return Y(_(4,e),n);case"Yo":return Y(o.ordinalNumber(e,{unit:"year"}),n);default:return Y(_(t.length,e),n)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,o,n){let s=yt(e,n);if(o.isTwoDigitYear){let u=hi(o.year,s);return e.setFullYear(u,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),q(e,n)}let a=!("era"in t)||t.era===1?o.year:1-o.year;return e.setFullYear(a,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),q(e,n)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]};var wi=class extends S{static{i(this,"ISOWeekYearParser")}priority=130;parse(e,t){return t==="R"?Or(4,e):Or(t.length,e)}set(e,t,o){let n=y(e,0);return n.setFullYear(o,0,4),n.setHours(0,0,0,0),X(n)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]};var bi=class extends S{static{i(this,"ExtendedYearParser")}priority=130;parse(e,t){return t==="u"?Or(4,e):Or(t.length,e)}set(e,t,o){return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]};var vi=class extends S{static{i(this,"QuarterParser")}priority=120;parse(e,t,o){switch(t){case"Q":case"QQ":return _(t.length,e);case"Qo":return o.ordinalNumber(e,{unit:"quarter"});case"QQQ":return o.quarter(e,{width:"abbreviated",context:"formatting"})||o.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return o.quarter(e,{width:"narrow",context:"formatting"});default:return o.quarter(e,{width:"wide",context:"formatting"})||o.quarter(e,{width:"abbreviated",context:"formatting"})||o.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=1&&t<=4}set(e,t,o){return e.setMonth((o-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]};var Ti=class extends S{static{i(this,"StandAloneQuarterParser")}priority=120;parse(e,t,o){switch(t){case"q":case"qq":return _(t.length,e);case"qo":return o.ordinalNumber(e,{unit:"quarter"});case"qqq":return o.quarter(e,{width:"abbreviated",context:"standalone"})||o.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return o.quarter(e,{width:"narrow",context:"standalone"});default:return o.quarter(e,{width:"wide",context:"standalone"})||o.quarter(e,{width:"abbreviated",context:"standalone"})||o.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=1&&t<=4}set(e,t,o){return e.setMonth((o-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]};var Di=class extends S{static{i(this,"MonthParser")}incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,t,o){let n=i(s=>s-1,"valueCallback");switch(t){case"M":return Y(F(W.month,e),n);case"MM":return Y(_(2,e),n);case"Mo":return Y(o.ordinalNumber(e,{unit:"month"}),n);case"MMM":return o.month(e,{width:"abbreviated",context:"formatting"})||o.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return o.month(e,{width:"narrow",context:"formatting"});default:return o.month(e,{width:"wide",context:"formatting"})||o.month(e,{width:"abbreviated",context:"formatting"})||o.month(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=11}set(e,t,o){return e.setMonth(o,1),e.setHours(0,0,0,0),e}};var Si=class extends S{static{i(this,"StandAloneMonthParser")}priority=110;parse(e,t,o){let n=i(s=>s-1,"valueCallback");switch(t){case"L":return Y(F(W.month,e),n);case"LL":return Y(_(2,e),n);case"Lo":return Y(o.ordinalNumber(e,{unit:"month"}),n);case"LLL":return o.month(e,{width:"abbreviated",context:"standalone"})||o.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return o.month(e,{width:"narrow",context:"standalone"});default:return o.month(e,{width:"wide",context:"standalone"})||o.month(e,{width:"abbreviated",context:"standalone"})||o.month(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=11}set(e,t,o){return e.setMonth(o,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]};function Mi(r,e,t){let o=d(r,t?.in),n=Mr(o,t)-e;return o.setDate(o.getDate()-n*7),d(o,t?.in)}i(Mi,"setWeek");var g$=Mi;var ki=class extends S{static{i(this,"LocalWeekParser")}priority=100;parse(e,t,o){switch(t){case"w":return F(W.week,e);case"wo":return o.ordinalNumber(e,{unit:"week"});default:return _(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,o,n){return q(Mi(e,o,n),n)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]};function Oi(r,e,t){let o=d(r,t?.in),n=Sr(o,t)-e;return o.setDate(o.getDate()-n*7),o}i(Oi,"setISOWeek");var _$=Oi;var Ii=class extends S{static{i(this,"ISOWeekParser")}priority=100;parse(e,t,o){switch(t){case"I":return F(W.week,e);case"Io":return o.ordinalNumber(e,{unit:"week"});default:return _(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,o){return X(Oi(e,o))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]};var px=[31,28,31,30,31,30,31,31,30,31,30,31],hx=[31,29,31,30,31,30,31,31,30,31,30,31],Ei=class extends S{static{i(this,"DateParser")}priority=90;subPriority=1;parse(e,t,o){switch(t){case"d":return F(W.date,e);case"do":return o.ordinalNumber(e,{unit:"date"});default:return _(t.length,e)}}validate(e,t){let o=e.getFullYear(),n=yi(o),s=e.getMonth();return n?t>=1&&t<=hx[s]:t>=1&&t<=px[s]}set(e,t,o){return e.setDate(o),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]};var _i=class extends S{static{i(this,"DayOfYearParser")}priority=90;subpriority=1;parse(e,t,o){switch(t){case"D":case"DD":return F(W.dayOfYear,e);case"Do":return o.ordinalNumber(e,{unit:"date"});default:return _(t.length,e)}}validate(e,t){let o=e.getFullYear();return yi(o)?t>=1&&t<=366:t>=1&&t<=365}set(e,t,o){return e.setMonth(0,o),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]};function wt(r,e,t){let o=L(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,s=d(r,t?.in),a=s.getDay(),c=(e%7+7)%7,f=7-n,l=e<0||e>6?e-(a+f)%7:(c+f)%7-(a+f)%7;return ee(s,l,t)}i(wt,"setDay");var Z$=wt;var Ci=class extends S{static{i(this,"DayParser")}priority=90;parse(e,t,o){switch(t){case"E":case"EE":case"EEE":return o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return o.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});default:return o.day(e,{width:"wide",context:"formatting"})||o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,o,n){return e=wt(e,o,n),e.setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]};var Pi=class extends S{static{i(this,"LocalDayParser")}priority=90;parse(e,t,o,n){let s=i(a=>{let u=Math.floor((a-1)/7)*7;return(a+n.weekStartsOn+6)%7+u},"valueCallback");switch(t){case"e":case"ee":return Y(_(t.length,e),s);case"eo":return Y(o.ordinalNumber(e,{unit:"day"}),s);case"eee":return o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});case"eeeee":return o.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});default:return o.day(e,{width:"wide",context:"formatting"})||o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,o,n){return e=wt(e,o,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]};var Ni=class extends S{static{i(this,"StandAloneLocalDayParser")}priority=90;parse(e,t,o,n){let s=i(a=>{let u=Math.floor((a-1)/7)*7;return(a+n.weekStartsOn+6)%7+u},"valueCallback");switch(t){case"c":case"cc":return Y(_(t.length,e),s);case"co":return Y(o.ordinalNumber(e,{unit:"day"}),s);case"ccc":return o.day(e,{width:"abbreviated",context:"standalone"})||o.day(e,{width:"short",context:"standalone"})||o.day(e,{width:"narrow",context:"standalone"});case"ccccc":return o.day(e,{width:"narrow",context:"standalone"});case"cccccc":return o.day(e,{width:"short",context:"standalone"})||o.day(e,{width:"narrow",context:"standalone"});default:return o.day(e,{width:"wide",context:"standalone"})||o.day(e,{width:"abbreviated",context:"standalone"})||o.day(e,{width:"short",context:"standalone"})||o.day(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=6}set(e,t,o,n){return e=wt(e,o,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]};function Ri(r,e,t){let o=d(r,t?.in),n=ai(o,t),s=e-n;return ee(o,s,t)}i(Ri,"setISODay");var w3=Ri;var Fi=class extends S{static{i(this,"ISODayParser")}priority=90;parse(e,t,o){let n=i(s=>s===0?7:s,"valueCallback");switch(t){case"i":case"ii":return _(t.length,e);case"io":return o.ordinalNumber(e,{unit:"day"});case"iii":return Y(o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"}),n);case"iiiii":return Y(o.day(e,{width:"narrow",context:"formatting"}),n);case"iiiiii":return Y(o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"}),n);default:return Y(o.day(e,{width:"wide",context:"formatting"})||o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"}),n)}}validate(e,t){return t>=1&&t<=7}set(e,t,o){return e=Ri(e,o),e.setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]};var Wi=class extends S{static{i(this,"AMPMParser")}priority=80;parse(e,t,o){switch(t){case"a":case"aa":case"aaa":return o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return o.dayPeriod(e,{width:"narrow",context:"formatting"});default:return o.dayPeriod(e,{width:"wide",context:"formatting"})||o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,o){return e.setHours(Ir(o),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]};var Ai=class extends S{static{i(this,"AMPMMidnightParser")}priority=80;parse(e,t,o){switch(t){case"b":case"bb":case"bbb":return o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return o.dayPeriod(e,{width:"narrow",context:"formatting"});default:return o.dayPeriod(e,{width:"wide",context:"formatting"})||o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,o){return e.setHours(Ir(o),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]};var Li=class extends S{static{i(this,"DayPeriodParser")}priority=80;parse(e,t,o){switch(t){case"B":case"BB":case"BBB":return o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return o.dayPeriod(e,{width:"narrow",context:"formatting"});default:return o.dayPeriod(e,{width:"wide",context:"formatting"})||o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,o){return e.setHours(Ir(o),0,0,0),e}incompatibleTokens=["a","b","t","T"]};var Yi=class extends S{static{i(this,"Hour1to12Parser")}priority=70;parse(e,t,o){switch(t){case"h":return F(W.hour12h,e);case"ho":return o.ordinalNumber(e,{unit:"hour"});default:return _(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,o){let n=e.getHours()>=12;return n&&o<12?e.setHours(o+12,0,0,0):!n&&o===12?e.setHours(0,0,0,0):e.setHours(o,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]};var Bi=class extends S{static{i(this,"Hour0to23Parser")}priority=70;parse(e,t,o){switch(t){case"H":return F(W.hour23h,e);case"Ho":return o.ordinalNumber(e,{unit:"hour"});default:return _(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,o){return e.setHours(o,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]};var Hi=class extends S{static{i(this,"Hour0To11Parser")}priority=70;parse(e,t,o){switch(t){case"K":return F(W.hour11h,e);case"Ko":return o.ordinalNumber(e,{unit:"hour"});default:return _(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,o){return e.getHours()>=12&&o<12?e.setHours(o+12,0,0,0):e.setHours(o,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]};var qi=class extends S{static{i(this,"Hour1To24Parser")}priority=70;parse(e,t,o){switch(t){case"k":return F(W.hour24h,e);case"ko":return o.ordinalNumber(e,{unit:"hour"});default:return _(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,o){let n=o<=24?o%24:o;return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]};var Ui=class extends S{static{i(this,"MinuteParser")}priority=60;parse(e,t,o){switch(t){case"m":return F(W.minute,e);case"mo":return o.ordinalNumber(e,{unit:"minute"});default:return _(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,o){return e.setMinutes(o,0,0),e}incompatibleTokens=["t","T"]};var ji=class extends S{static{i(this,"SecondParser")}priority=50;parse(e,t,o){switch(t){case"s":return F(W.second,e);case"so":return o.ordinalNumber(e,{unit:"second"});default:return _(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,o){return e.setSeconds(o,0),e}incompatibleTokens=["t","T"]};var $i=class extends S{static{i(this,"FractionOfSecondParser")}priority=30;parse(e,t){let o=i(n=>Math.trunc(n*Math.pow(10,-t.length+3)),"valueCallback");return Y(_(t.length,e),o)}set(e,t,o){return e.setMilliseconds(o),e}incompatibleTokens=["t","T"]};var zi=class extends S{static{i(this,"ISOTimezoneWithZParser")}priority=10;parse(e,t){switch(t){case"X":return Ne(Pe.basicOptionalMinutes,e);case"XX":return Ne(Pe.basic,e);case"XXXX":return Ne(Pe.basicOptionalSeconds,e);case"XXXXX":return Ne(Pe.extendedOptionalSeconds,e);default:return Ne(Pe.extended,e)}}set(e,t,o){return t.timestampIsSet?e:y(e,e.getTime()-G(e)-o)}incompatibleTokens=["t","T","x"]};var Vi=class extends S{static{i(this,"ISOTimezoneParser")}priority=10;parse(e,t){switch(t){case"x":return Ne(Pe.basicOptionalMinutes,e);case"xx":return Ne(Pe.basic,e);case"xxxx":return Ne(Pe.basicOptionalSeconds,e);case"xxxxx":return Ne(Pe.extendedOptionalSeconds,e);default:return Ne(Pe.extended,e)}}set(e,t,o){return t.timestampIsSet?e:y(e,e.getTime()-G(e)-o)}incompatibleTokens=["t","T","X"]};var Gi=class extends S{static{i(this,"TimestampSecondsParser")}priority=40;parse(e){return pi(e)}set(e,t,o){return[y(e,o*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"};var Qi=class extends S{static{i(this,"TimestampMillisecondsParser")}priority=20;parse(e){return pi(e)}set(e,t,o){return[y(e,o),{timestampIsSet:!0}]}incompatibleTokens="*"};var Ji={G:new mi,y:new xi,Y:new gi,R:new wi,u:new bi,Q:new vi,q:new Ti,M:new Di,L:new Si,w:new ki,I:new Ii,d:new Ei,D:new _i,E:new Ci,e:new Pi,c:new Ni,i:new Fi,a:new Wi,b:new Ai,B:new Li,h:new Yi,H:new Bi,K:new Hi,k:new qi,m:new Ui,s:new ji,S:new $i,X:new zi,x:new Vi,t:new Gi,T:new Qi};var yx=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,xx=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,gx=/^'([^]*?)'?$/,wx=/''/g,bx=/\S/,vx=/[a-zA-Z]/;function Ki(r,e,t,o){let n=i(()=>y(o?.in||t,NaN),"invalidDate"),s=si(),a=o?.locale??s.locale??ve,u=o?.firstWeekContainsDate??o?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,c=o?.weekStartsOn??o?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0;if(!e)return r?n():d(t,o?.in);let f={firstWeekContainsDate:u,weekStartsOn:c,locale:a},l=[new di(o?.in,t)],m=e.match(xx).map(w=>{let T=w[0];if(T in xt){let J=xt[T];return J(w,a.formatLong)}return w}).join("").match(yx),p=[];for(let w of m){!o?.useAdditionalWeekYearTokens&&ei(w)&&ho(w,e,r),!o?.useAdditionalDayOfYearTokens&&Zn(w)&&ho(w,e,r);let T=w[0],J=Ji[T];if(J){let{incompatibleTokens:Te}=J;if(Array.isArray(Te)){let rt=p.find(Ke=>Te.includes(Ke.token)||Ke.token===T);if(rt)throw new RangeError(`The format string mustn't contain \`${rt.fullToken}\` and \`${w}\` at the same time`)}else if(J.incompatibleTokens==="*"&&p.length>0)throw new RangeError(`The format string mustn't contain \`${w}\` and any other token at the same time`);p.push({token:T,fullToken:w});let se=J.run(r,w,a.match,f);if(!se)return n();l.push(se.setter),r=se.rest}else{if(T.match(vx))throw new RangeError("Format string contains an unescaped latin alphabet character `"+T+"`");if(w==="''"?w="'":T==="'"&&(w=Tx(w)),r.indexOf(w)===0)r=r.slice(w.length);else return n()}}if(r.length>0&&bx.test(r))return n();let h=l.map(w=>w.priority).sort((w,T)=>T-w).filter((w,T,J)=>J.indexOf(w)===T).map(w=>l.filter(T=>T.priority===w).sort((T,J)=>J.subPriority-T.subPriority)).map(w=>w[0]),g=d(t,o?.in);if(isNaN(+g))return n();let x={};for(let w of h){if(!w.validate(g,f))return n();let T=w.set(g,x,f);Array.isArray(T)?(g=T[0],Object.assign(x,T[1])):g=T}return g}i(Ki,"parse");function Tx(r){return r.match(gx)[1].replace(wx,"'")}i(Tx,"cleanEscapedString");var E4=Ki;function wf(r,e,t){return ue(Ki(r,e,new Date,t))}i(wf,"isMatch");var R4=wf;function bf(r,e){return d(r,e?.in).getDay()===1}i(bf,"isMonday");var L4=bf;function vf(r){return+d(r)<Date.now()}i(vf,"isPast");var q4=vf;function xo(r,e){let t=d(r,e?.in);return t.setMinutes(0,0,0),t}i(xo,"startOfHour");var z4=xo;function Xi(r,e,t){let[o,n]=k(t?.in,r,e);return+xo(o)==+xo(n)}i(Xi,"isSameHour");var K4=Xi;function Er(r,e,t){let[o,n]=k(t?.in,r,e);return+q(o,t)==+q(n,t)}i(Er,"isSameWeek");var rz=Er;function Zi(r,e,t){return Er(r,e,{...t,weekStartsOn:1})}i(Zi,"isSameISOWeek");var sz=Zi;function Tf(r,e,t){let[o,n]=k(t?.in,r,e);return+Se(o)==+Se(n)}i(Tf,"isSameISOWeekYear");var lz=Tf;function go(r,e){let t=d(r,e?.in);return t.setSeconds(0,0),t}i(go,"startOfMinute");var hz=go;function es(r,e){return+go(r)==+go(e)}i(es,"isSameMinute");var wz=es;function ts(r,e,t){let[o,n]=k(t?.in,r,e);return o.getFullYear()===n.getFullYear()&&o.getMonth()===n.getMonth()}i(ts,"isSameMonth");var Dz=ts;function rs(r,e,t){let[o,n]=k(t?.in,r,e);return+Ge(o)==+Ge(n)}i(rs,"isSameQuarter");var Iz=rs;function wo(r,e){let t=d(r,e?.in);return t.setMilliseconds(0),t}i(wo,"startOfSecond");var Pz=wo;function os(r,e){return+wo(r)==+wo(e)}i(os,"isSameSecond");var Wz=os;function ns(r,e,t){let[o,n]=k(t?.in,r,e);return o.getFullYear()===n.getFullYear()}i(ns,"isSameYear");var Bz=ns;function Df(r,e){return Xi(d(r,e?.in),N(e?.in||r))}i(Df,"isThisHour");var zz=Df;function Sf(r,e){return Zi(y(e?.in||r,r),N(e?.in||r))}i(Sf,"isThisISOWeek");var Xz=Sf;function Mf(r){return es(r,N(r))}i(Mf,"isThisMinute");var oV=Mf;function kf(r,e){return ts(y(e?.in||r,r),N(e?.in||r))}i(kf,"isThisMonth");var cV=kf;function Of(r,e){return rs(y(e?.in||r,r),N(e?.in||r))}i(Of,"isThisQuarter");var hV=Of;function If(r){return os(r,N(r))}i(If,"isThisSecond");var bV=If;function Ef(r,e){return Er(y(e?.in||r,r),N(e?.in||r),e)}i(Ef,"isThisWeek");var kV=Ef;function _f(r,e){return ns(y(e?.in||r,r),N(e?.in||r))}i(_f,"isThisYear");var PV=_f;function Cf(r,e){return d(r,e?.in).getDay()===4}i(Cf,"isThursday");var WV=Cf;function Pf(r,e){return ze(y(e?.in||r,r),N(e?.in||r))}i(Pf,"isToday");var qV=Pf;function Nf(r,e){return ze(r,ee(N(e?.in||r),1),e)}i(Nf,"isTomorrow");var GV=Nf;function Rf(r,e){return d(r,e?.in).getDay()===2}i(Rf,"isTuesday");var XV=Rf;function Ff(r,e){return d(r,e?.in).getDay()===3}i(Ff,"isWednesday");var r5=Ff;function Wf(r,e,t){let o=+d(r,t?.in),[n,s]=[+d(e.start,t?.in),+d(e.end,t?.in)].sort((a,u)=>a-u);return o>=n&&o<=s}i(Wf,"isWithinInterval");var s5=Wf;function bt(r,e,t){return ee(r,-e,t)}i(bt,"subDays");var f5=bt;function Af(r,e){return ze(y(e?.in||r,r),bt(N(e?.in||r),1))}i(Af,"isYesterday");var x5=Af;function Lf(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=9+Math.floor(o/10)*10;return t.setFullYear(n+1,0,0),t.setHours(0,0,0,0),d(t,e?.in)}i(Lf,"lastDayOfDecade");var v5=Lf;function is(r,e){let t=L(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=d(r,e?.in),s=n.getDay(),a=(s<o?-7:0)+6-(s-o);return n.setHours(0,0,0,0),n.setDate(n.getDate()+a),n}i(is,"lastDayOfWeek");var k5=is;function Yf(r,e){return is(r,{...e,weekStartsOn:1})}i(Yf,"lastDayOfISOWeek");var _5=Yf;function Bf(r,e){let t=ge(r,e),o=y(e?.in||r,0);o.setFullYear(t+1,0,4),o.setHours(0,0,0,0);let n=X(o,e);return n.setDate(n.getDate()-1),n}i(Bf,"lastDayOfISOWeekYear");var W5=Bf;function Hf(r,e){let t=d(r,e?.in),o=t.getMonth(),n=o-o%3+3;return t.setMonth(n,0),t.setHours(0,0,0,0),t}i(Hf,"lastDayOfQuarter");var B5=Hf;function qf(r,e){let t=d(r,e?.in),o=t.getFullYear();return t.setFullYear(o+1,0,0),t.setHours(0,0,0,0),t}i(qf,"lastDayOfYear");var j5=qf;var Dx=/(\w)\1*|''|'(''|[^'])+('|$)|./g,Sx=/^'([^]*?)'?$/,Mx=/''/g,kx=/[a-zA-Z]/;function Uf(r,e){let t=d(r);if(!ue(t))throw new RangeError("Invalid time value");let o=e.match(Dx);return o?o.map(s=>{if(s==="''")return"'";let a=s[0];if(a==="'")return Ox(s);let u=Me[a];if(u)return u(t,s);if(a.match(kx))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return s}).join(""):""}i(Uf,"lightFormat");function Ox(r){let e=r.match(Sx);return e?e[1].replace(Mx,"'"):r}i(Ox,"cleanEscapedString");var J5=Uf;function jf({years:r,months:e,weeks:t,days:o,hours:n,minutes:s,seconds:a}){let u=0;r&&(u+=r*365.2425),e&&(u+=e*(365.2425/12)),t&&(u+=t*7),o&&(u+=o);let c=u*24*60*60;return n&&(c+=n*60*60),s&&(c+=s*60),a&&(c+=a),Math.trunc(c*1e3)}i(jf,"milliseconds");var e8=jf;function $f(r){let e=r/De;return Math.trunc(e)}i($f,"millisecondsToHours");var n8=$f;function zf(r){let e=r/le;return Math.trunc(e)}i(zf,"millisecondsToMinutes");var u8=zf;function Vf(r){let e=r/fr;return Math.trunc(e)}i(Vf,"millisecondsToSeconds");var d8=Vf;function Gf(r){let e=r/In;return Math.trunc(e)}i(Gf,"minutesToHours");var y8=Gf;function Qf(r){return Math.trunc(r*le)}i(Qf,"minutesToMilliseconds");var b8=Qf;function Jf(r){return Math.trunc(r*dr)}i(Jf,"minutesToSeconds");var S8=Jf;function Kf(r){let e=r/En;return Math.trunc(e)}i(Kf,"monthsToQuarters");var I8=Kf;function Xf(r){let e=r/_n;return Math.trunc(e)}i(Xf,"monthsToYears");var P8=Xf;function pe(r,e,t){let o=e-gt(r,t);return o<=0&&(o+=7),ee(r,o,t)}i(pe,"nextDay");var A8=pe;function Zf(r,e){return pe(r,5,e)}i(Zf,"nextFriday");var H8=Zf;function el(r,e){return pe(r,1,e)}i(el,"nextMonday");var $8=el;function tl(r,e){return pe(r,6,e)}i(tl,"nextSaturday");var Q8=tl;function rl(r,e){return pe(r,0,e)}i(rl,"nextSunday");var Z8=rl;function ol(r,e){return pe(r,4,e)}i(ol,"nextThursday");var oG=ol;function nl(r,e){return pe(r,2,e)}i(nl,"nextTuesday");var aG=nl;function il(r,e){return pe(r,3,e)}i(il,"nextWednesday");var lG=il;function al(r,e){let t=i(()=>y(e?.in,NaN),"invalidDate"),o=e?.additionalDigits??2,n=Cx(r),s;if(n.date){let f=Px(n.date,o);s=Nx(f.restDateString,f.year)}if(!s||isNaN(+s))return t();let a=+s,u=0,c;if(n.time&&(u=Rx(n.time),isNaN(u)))return t();if(n.timezone){if(c=Fx(n.timezone),isNaN(c))return t()}else{let f=new Date(a+u),l=d(0,e?.in);return l.setFullYear(f.getUTCFullYear(),f.getUTCMonth(),f.getUTCDate()),l.setHours(f.getUTCHours(),f.getUTCMinutes(),f.getUTCSeconds(),f.getUTCMilliseconds()),l}return d(a+u+c,e?.in)}i(al,"parseISO");var ss={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Ix=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Ex=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,_x=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Cx(r){let e={},t=r.split(ss.dateTimeDelimiter),o;if(t.length>2)return e;if(/:/.test(t[0])?o=t[0]:(e.date=t[0],o=t[1],ss.timeZoneDelimiter.test(e.date)&&(e.date=r.split(ss.timeZoneDelimiter)[0],o=r.substr(e.date.length,r.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(Cx,"splitDateString");function Px(r,e){let t=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),o=r.match(t);if(!o)return{year:NaN,restDateString:""};let n=o[1]?parseInt(o[1]):null,s=o[2]?parseInt(o[2]):null;return{year:s===null?n:s*100,restDateString:r.slice((o[1]||o[2]).length)}}i(Px,"parseYear");function Nx(r,e){if(e===null)return new Date(NaN);let t=r.match(Ix);if(!t)return new Date(NaN);let o=!!t[4],n=bo(t[1]),s=bo(t[2])-1,a=bo(t[3]),u=bo(t[4]),c=bo(t[5])-1;if(o)return Bx(e,u,c)?Wx(e,u,c):new Date(NaN);{let f=new Date(0);return!Lx(e,s,a)||!Yx(e,n)?new Date(NaN):(f.setUTCFullYear(e,s,Math.max(n,a)),f)}}i(Nx,"parseDate");function bo(r){return r?parseInt(r):1}i(bo,"parseDateUnit");function Rx(r){let e=r.match(Ex);if(!e)return NaN;let t=va(e[1]),o=va(e[2]),n=va(e[3]);return Hx(t,o,n)?t*De+o*le+n*1e3:NaN}i(Rx,"parseTime");function va(r){return r&&parseFloat(r.replace(",","."))||0}i(va,"parseTimeUnit");function Fx(r){if(r==="Z")return 0;let e=r.match(_x);if(!e)return 0;let t=e[1]==="+"?-1:1,o=parseInt(e[2]),n=e[3]&&parseInt(e[3])||0;return qx(o,n)?t*(o*De+n*le):NaN}i(Fx,"parseTimezone");function Wx(r,e,t){let o=new Date(0);o.setUTCFullYear(r,0,4);let n=o.getUTCDay()||7,s=(e-1)*7+t+1-n;return o.setUTCDate(o.getUTCDate()+s),o}i(Wx,"dayOfISOWeekYear");var Ax=[31,null,31,30,31,30,31,31,30,31,30,31];function sl(r){return r%400===0||r%4===0&&r%100!==0}i(sl,"isLeapYearIndex");function Lx(r,e,t){return e>=0&&e<=11&&t>=1&&t<=(Ax[e]||(sl(r)?29:28))}i(Lx,"validateDate");function Yx(r,e){return e>=1&&e<=(sl(r)?366:365)}i(Yx,"validateDayOfYearDate");function Bx(r,e,t){return e>=1&&e<=53&&t>=0&&t<=6}i(Bx,"validateWeekDate");function Hx(r,e,t){return r===24?e===0&&t===0:t>=0&&t<60&&e>=0&&e<60&&r>=0&&r<25}i(Hx,"validateTime");function qx(r,e){return e>=0&&e<=59}i(qx,"validateTimezone");var xG=al;function ul(r,e){let t=r.match(/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/);return t?d(Date.UTC(+t[1],+t[2]-1,+t[3],+t[4]-(+t[9]||0)*(t[8]=="-"?-1:1),+t[5]-(+t[10]||0)*(t[8]=="-"?-1:1),+t[6],+((t[7]||"0")+"00").substring(0,3)),e?.in):d(NaN,e?.in)}i(ul,"parseJSON");var vG=ul;function he(r,e,t){let o=gt(r,t)-e;return o<=0&&(o+=7),bt(r,o,t)}i(he,"previousDay");var kG=he;function cl(r,e){return he(r,5,e)}i(cl,"previousFriday");var _G=cl;function fl(r,e){return he(r,1,e)}i(fl,"previousMonday");var RG=fl;function ll(r,e){return he(r,6,e)}i(ll,"previousSaturday");var LG=ll;function dl(r,e){return he(r,0,e)}i(dl,"previousSunday");var qG=dl;function ml(r,e){return he(r,4,e)}i(ml,"previousThursday");var zG=ml;function pl(r,e){return he(r,2,e)}i(pl,"previousTuesday");var JG=pl;function hl(r,e){return he(r,3,e)}i(hl,"previousWednesday");var e9=hl;function yl(r){return Math.trunc(r*En)}i(yl,"quartersToMonths");var n9=yl;function xl(r){let e=r/Cn;return Math.trunc(e)}i(xl,"quartersToYears");var u9=xl;function gl(r,e){let t=e?.nearestTo??1;if(t<1||t>12)return y(e?.in||r,NaN);let o=d(r,e?.in),n=o.getMinutes()/60,s=o.getSeconds()/60/60,a=o.getMilliseconds()/1e3/60/60,u=o.getHours()+n+s+a,c=e?.roundingMethod??"round",l=me(c)(u/t)*t;return o.setHours(l,0,0,0),o}i(gl,"roundToNearestHours");var p9=gl;function wl(r,e){let t=e?.nearestTo??1;if(t<1||t>30)return y(r,NaN);let o=d(r,e?.in),n=o.getSeconds()/60,s=o.getMilliseconds()/1e3/60,a=o.getMinutes()+n+s,u=e?.roundingMethod??"round",f=me(u)(a/t)*t;return o.setMinutes(f,0,0),o}i(wl,"roundToNearestMinutes");var b9=wl;function bl(r){let e=r/Lt;return Math.trunc(e)}i(bl,"secondsToHours");var S9=bl;function vl(r){return r*fr}i(vl,"secondsToMilliseconds");var I9=vl;function Tl(r){let e=r/dr;return Math.trunc(e)}i(Tl,"secondsToMinutes");var P9=Tl;function _r(r,e,t){let o=d(r,t?.in),n=o.getFullYear(),s=o.getDate(),a=y(t?.in||r,0);a.setFullYear(n,e,15),a.setHours(0,0,0,0);let u=ni(a);return o.setMonth(e,Math.min(s,u)),o}i(_r,"setMonth");var L9=_r;function Dl(r,e,t){let o=d(r,t?.in);return isNaN(+o)?y(t?.in||r,NaN):(e.year!=null&&o.setFullYear(e.year),e.month!=null&&(o=_r(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(Dl,"set");var j9=Dl;function Sl(r,e,t){let o=d(r,t?.in);return o.setDate(e),o}i(Sl,"setDate");var G9=Sl;function Ml(r,e,t){let o=d(r,t?.in);return o.setMonth(0),o.setDate(e),o}i(Ml,"setDayOfYear");var X9=Ml;function kl(r){let e={},t=L();for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&(r[o]===void 0?delete e[o]:e[o]=r[o]);Gu(e)}i(kl,"setDefaultOptions");var rQ=kl;function Ol(r,e,t){let o=d(r,t?.in);return o.setHours(e),o}i(Ol,"setHours");var sQ=Ol;function Il(r,e,t){let o=d(r,t?.in);return o.setMilliseconds(e),o}i(Il,"setMilliseconds");var fQ=Il;function El(r,e,t){let o=d(r,t?.in);return o.setMinutes(e),o}i(El,"setMinutes");var pQ=El;function _l(r,e,t){let o=d(r,t?.in),n=Math.trunc(o.getMonth()/3)+1,s=e-n;return _r(o,o.getMonth()+s*3)}i(_l,"setQuarter");var wQ=_l;function Cl(r,e,t){let o=d(r,t?.in);return o.setSeconds(e),o}i(Cl,"setSeconds");var DQ=Cl;function Pl(r,e,t){let o=L(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,s=oe(d(r,t?.in),Ut(r,t),t),a=y(t?.in||r,0);a.setFullYear(e,0,n),a.setHours(0,0,0,0);let u=Ut(a,t);return u.setDate(u.getDate()+s),u}i(Pl,"setWeekYear");var CQ=Pl;function Nl(r,e,t){let o=d(r,t?.in);return isNaN(+o)?y(t?.in||r,NaN):(o.setFullYear(e),o)}i(Nl,"setYear");var WQ=Nl;function Rl(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=Math.floor(o/10)*10;return t.setFullYear(n,0,1),t.setHours(0,0,0,0),t}i(Rl,"startOfDecade");var BQ=Rl;function Fl(r){return $e(Date.now(),r)}i(Fl,"startOfToday");var jQ=Fl;function Wl(r){let e=N(r?.in),t=e.getFullYear(),o=e.getMonth(),n=e.getDate(),s=y(r?.in,0);return s.setFullYear(t,o,n+1),s.setHours(0,0,0,0),s}i(Wl,"startOfTomorrow");var QQ=Wl;function Al(r){let e=N(r?.in),t=e.getFullYear(),o=e.getMonth(),n=e.getDate(),s=N(r?.in);return s.setFullYear(t,o,n-1),s.setHours(0,0,0,0),s}i(Al,"startOfYesterday");var ZQ=Al;function as(r,e,t){return Ue(r,-e,t)}i(as,"subMonths");var oJ=as;function Ll(r,e,t){let{years:o=0,months:n=0,weeks:s=0,days:a=0,hours:u=0,minutes:c=0,seconds:f=0}=e,l=as(r,n+o*12,t),m=bt(l,a+s*7,t),p=c+u*60,g=(f+p*60)*1e3;return y(t?.in||r,+m-g)}i(Ll,"sub");var cJ=Ll;function Yl(r,e,t){return Rn(r,-e,t)}i(Yl,"subBusinessDays");var mJ=Yl;function Bl(r,e,t){return Fn(r,-e,t)}i(Bl,"subHours");var xJ=Bl;function Hl(r,e,t){return lt(r,-e,t)}i(Hl,"subMilliseconds");var vJ=Hl;function ql(r,e,t){return mr(r,-e,t)}i(ql,"subMinutes");var MJ=ql;function Ul(r,e,t){return pr(r,-e,t)}i(Ul,"subQuarters");var EJ=Ul;function jl(r,e,t){return Ln(r,-e,t)}i(jl,"subSeconds");var NJ=jl;function $l(r,e,t){return dt(r,-e,t)}i($l,"subWeeks");var AJ=$l;function zl(r,e,t){return Yn(r,-e,t)}i(zl,"subYears");var HJ=zl;function Vl(r){return Math.trunc(r*7)}i(Vl,"weeksToDays");var $J=Vl;function Gl(r){return Math.trunc(r*365.2425)}i(Gl,"yearsToDays");var QJ=Gl;function Ql(r){return Math.trunc(r*_n)}i(Ql,"yearsToMonths");var ZJ=Ql;function Jl(r){return Math.trunc(r*Cn)}i(Jl,"yearsToQuarters");var o7=Jl;var Zl=i(r=>Number.isFinite(r)?r:0,"toZeroIfInfinity");function Ux(r){return{days:Math.trunc(r/864e5),hours:Math.trunc(r/36e5%24),minutes:Math.trunc(r/6e4%60),seconds:Math.trunc(r/1e3%60),milliseconds:Math.trunc(r%1e3),microseconds:Math.trunc(Zl(r*1e3)%1e3),nanoseconds:Math.trunc(Zl(r*1e6)%1e3)}}i(Ux,"parseNumber");function jx(r){return{days:r/86400000n,hours:r/3600000n%24n,minutes:r/60000n%60n,seconds:r/1000n%60n,milliseconds:r%1000n,microseconds:0n,nanoseconds:0n}}i(jx,"parseBigint");function ka(r){switch(typeof r){case"number":{if(Number.isFinite(r))return Ux(r);break}case"bigint":return jx(r)}throw new TypeError("Expected a finite number or bigint")}i(ka,"parseMilliseconds");var $x=i(r=>r===0||r===0n,"isZero"),zx=i((r,e)=>e===1||e===1n?r:`${r}s`,"pluralize"),Vx=1e-7,Gx=24n*60n*60n*1000n;function To(r,e){let t=typeof r=="bigint";if(!t&&!Number.isFinite(r))throw new TypeError("Expected a finite number or bigint");e={...e};let o=r<0?"-":"";r=r<0?-r:r,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let n=[],s=i((l,m)=>{let p=Math.floor(l*10**m+Vx);return(Math.round(p)/10**m).toFixed(m)},"floorDecimals"),a=i((l,m,p,h)=>{if(!((n.length===0||!e.colonNotation)&&$x(l)&&!(e.colonNotation&&p==="m"))){if(h??=String(l),e.colonNotation){let g=h.includes(".")?h.split(".")[0].length:h.length,x=n.length>0?2:1;h="0".repeat(Math.max(0,x-g))+h}else h+=e.verbose?" "+zx(m,l):p;n.push(h)}},"add"),u=ka(r),c=BigInt(u.days);if(e.hideYearAndDays?a(BigInt(c)*24n+BigInt(u.hours),"hour","h"):(e.hideYear?a(c,"day","d"):(a(c/365n,"year","y"),a(c%365n,"day","d")),a(Number(u.hours),"hour","h")),a(Number(u.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&r<1e3&&!e.subSecondsAsDecimals){let l=Number(u.seconds),m=Number(u.milliseconds),p=Number(u.microseconds),h=Number(u.nanoseconds);if(a(l,"second","s"),e.formatSubMilliseconds)a(m,"millisecond","ms"),a(p,"microsecond","\xB5s"),a(h,"nanosecond","ns");else{let g=m+p/1e3+h/1e6,x=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,w=g>=1?Math.round(g):Math.ceil(g),T=x?g.toFixed(x):w;a(Number.parseFloat(T),"millisecond","ms",T)}}else{let l=(t?Number(r%Gx):r)/1e3%60,m=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,p=s(l,m),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(To,"prettyMilliseconds");var $t=rr(Kl(),1),ed=rr(Xl(),1);$t.default.extend(ed.default);var Do=class{static{i(this,"CronJob")}constructor(e,t,o){this.status="initial",this.nextExecutionUnix=0,this.cronExpression=t,this.jobFunction=o,this.cronParser=new fo.Cron(t)}checkExecution(){if(this.status==="stopped")return this.nextExecutionUnix;if(this.nextExecutionUnix===0&&this.getNextExecutionTime(),Date.now()>this.nextExecutionUnix){let e=this.jobFunction(this.nextExecutionUnix);e instanceof Promise&&e.catch(t=>console.log(t)),this.nextExecutionUnix=this.getNextExecutionTime()}return this.nextExecutionUnix}getNextExecutionTime(){return this.nextExecutionUnix=Date.now()+this.getTimeToNextExecution()}getTimeToNextExecution(){return this.cronParser.msToNext()}start(){this.status="started"}stop(){this.status="stopped"}};var Oa=class{static{i(this,"CronManager")}constructor(){this.status="stopped",this.cronjobs=new ie.ObjectMap,this.cycleWakeDeferred=null}wakeCycle(){this.cycleWakeDeferred&&this.cycleWakeDeferred.status==="pending"&&this.cycleWakeDeferred.resolve()}addCronjob(e,t){let o=new Do(this,e,t);return this.cronjobs.add(o),this.status==="started"&&(o.start(),this.wakeCycle()),o}removeCronjob(e){e.stop(),this.cronjobs.remove(e),this.status==="started"&&this.wakeCycle()}start(){if(this.status!=="started"){this.status="started";for(let e of this.cronjobs.getArray())e.start();this.runCronCycle()}}async runCronCycle(){for(;this.status==="started";){this.cycleWakeDeferred=new R.Deferred;let e=1/0;for(let t of this.cronjobs.getArray()){t.checkExecution();let o=t.getTimeToNextExecution();o<e&&(e=o)}if(e<1/0&&e>0)this.executionTimeout=new A.Timeout(e),await Promise.race([this.executionTimeout.promise,this.cycleWakeDeferred.promise]),this.executionTimeout.cancel();else{if(e<=0)continue;await this.cycleWakeDeferred.promise}}this.cycleWakeDeferred=null}stop(){this.status==="started"&&(this.status="stopped",this.executionTimeout&&this.executionTimeout.cancel(),this.wakeCycle());for(let e of this.cronjobs.getArray())e.stop()}};var vt={years:i((r=1)=>r*3154e7,"years"),months:i((r=1)=>r*2628e6,"months"),weeks:i((r=1)=>r*6048e5,"weeks"),days:i((r=1)=>r*864e5,"days"),hours:i((r=1)=>r*36e5,"hours"),minutes:i((r=1)=>r*6e4,"minutes"),seconds:i((r=1)=>r*1e3,"seconds")},Ia=i(r=>{let e=0,t=i(o=>{e=e+o},"addMilliSeconds");return r.years&&t(vt.years(r.years)),r.months&&t(vt.months(r.months)),r.weeks&&t(vt.weeks(r.weeks)),r.days&&t(vt.days(r.days)),r.hours&&t(vt.hours(r.hours)),r.minutes&&t(vt.minutes(r.minutes)),r.seconds&&t(vt.seconds(r.seconds)),e},"getMilliSecondsFromUnits"),Qx=i(r=>To(r),"getMilliSecondsAsHumanReadableString"),Jx=i(r=>vo.formatDistanceToNow(new Date(r)),"getMilliSecondsAsHumanReadableAgoTime");var Ea=class r extends Date{static{i(this,"ExtendedDate")}static fromMillis(e){return new r(e)}static fromDate(e){return new r(e.getTime())}static fromEuropeanDate(e){let t=/(.*)\.(.*)\.(.*)/.exec(e),n=new Date(parseFloat(t[3]),parseFloat(t[2])-1,parseFloat(t[1])).getTime();return new r(n)}static fromHyphedDate(e){let t=new Date(e).getTime();return new r(t)}static fromEuropeanDateAndTime(e,t="12:00:00",o="Europe/Berlin"){let n=/(.*)\.(.*)\.(.*)/.exec(e),s=i(f=>`0${f}`.slice(-2),"sliceDate"),a=`${n[3]}-${s(n[2])}-${s(n[1])}T${t}`,c=$t.default(a).toDate().getTime();return new r(c)}constructor(e=Date.now()){super(e)}exportToEuropeanDate(){let e=this.exportToUnits();return`${e.dayString}.${e.monthString}.${e.yearString}`}exportToHyphedSortableDate(){let e=this.exportToUnits();return`${e.yearString}-${e.monthString}-${e.dayString}`}exportToUnits(){let e=["January","February","March","April","May","June","July","August","September","October","November","December"],t=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];return{year:this.getFullYear(),yearString:`${this.getFullYear()}`,month:this.getMonth()+1,monthString:("0"+(this.getMonth()+1)).slice(-2),monthName:e[this.getMonth()],day:this.getDate(),dayString:("0"+this.getDate()).slice(-2),dayOfTheWeek:this.getDay(),dayOfTheWeekName:t[this.getDay()]}}format(e){return $t.default(this.getTime()).format(e)}isToday(){return $t.default(this.getTime()).isToday()}lessTimePassedToNow(e){let t=Ia(e);return Date.now()-this.getTime()<t}moreTimePassedToNow(e){return!this.lessTimePassedToNow(e)}};var _a=class{static{i(this,"HrtMeasurement")}constructor(){this.nanoSeconds=null,this.milliSeconds=null,this._milliStart=null,this._milliDiff=null,this._started=!1}start(){this._started=!0,this._milliStart=Date.now()}stop(){if(this._started===!1){console.log("Hasn't started yet");return}return this._milliDiff=Date.now()-this._milliStart,this.nanoSeconds=this._milliDiff*1e3,this.milliSeconds=this._milliDiff,this}reset(){this.nanoSeconds=null,this.milliSeconds=null,this._milliStart=null,this._milliDiff=null,this._started=!1}};var Ca=class{static{i(this,"Interval")}constructor(e){this.status="initial",this.statusAuthorization=null,this.intervalJobs=[],this.intervalMilliseconds=e}start(){this.status="started";let e=new Date;this.statusAuthorization=e,i(async()=>{for(;this.status==="started"&&this.statusAuthorization===e;)await A.delayFor(this.intervalMilliseconds),this.executeIntervalJobs()},"runInterval")()}stop(){this.status="stopped",this.statusAuthorization=null}addIntervalJob(e){this.intervalJobs.push(e)}executeIntervalJobs(){for(let e of this.intervalJobs)e()}};var Pr=class r{static{i(this,"TimeStamp")}static fromMilliSeconds(e){return new r(e)}static fromTimeStamp(e){let t=new r;return t.change=t.milliSeconds-e.milliSeconds,t}constructor(e){this.change=null,e?typeof e=="number"&&(this.date=new Date(e)):this.date=new Date,this.milliSeconds=this.date.getTime(),this.epochtime=Math.floor(this.milliSeconds/1e3)}isOlderThanOtherTimeStamp(e,t=0){return this.milliSeconds<e.milliSeconds-t}isOlderThan(e,t=0){return this.milliSeconds+t<e.milliSeconds}isYoungerThanOtherTimeStamp(e,t=0){return this.milliSeconds>e.milliSeconds+t}isYoungerThanMilliSeconds(e){let o=new r().epochtime-e,n=new r(o);return this.isYoungerThanOtherTimeStamp(n)}};var Pa=class{static{i(this,"Timer")}get timeLeft(){return this.timeInMilliseconds-this.pausedAt.change}constructor(e){this.state="initiated",this.completedDeferred=R.defer(),this.timeInMilliseconds=e,this.completed=this.completedDeferred.promise}start(){if(!this.startedAt)this.currentTimeout=setTimeout(()=>{this.completedDeferred.resolve()},this.timeInMilliseconds),this.startedAt=new Pr;else throw new Error("timer has been started before. Please use resume instead")}pause(){this.startedAt&&(clearTimeout(this.currentTimeout),this.currentTimeout=null,this.pausedAt=Pr.fromTimeStamp(this.startedAt))}resume(){if(this.startedAt)this.currentTimeout=setTimeout(()=>{this.completedDeferred.resolve()},this.timeLeft);else throw new Error("timer has NOT been started before. Please use .start() instead")}reset(){this.pause(),this.startedAt=null,this.pausedAt=null}};var cs=rr(ld(),1);var Ra=class{static{i(this,"AsyncExecutionStack")}executionSlots=[];isProcessing=!1;nonExclusiveMaxConcurrency=1/0;nonExclusiveCurrentCount=0;nonExclusivePendingQueue=[];async getExclusiveExecutionSlot(e,t){let o=R.defer(),n={funcToExecute:e,executionDeferred:o,timeout:t,mode:"exclusive"};return this.executionSlots.push(n),this.processExecutionSlots(),o.promise}async getNonExclusiveExecutionSlot(e,t){let o=R.defer(),n={funcToExecute:e,executionDeferred:o,timeout:t,mode:"nonexclusive"};return this.executionSlots.push(n),this.processExecutionSlots(),o.promise}setNonExclusiveMaxConcurrency(e){if(!Number.isFinite(e)||e<1)throw new Error("nonExclusiveMaxConcurrency must be a finite number >= 1");this.nonExclusiveMaxConcurrency=e}getNonExclusiveMaxConcurrency(){return this.nonExclusiveMaxConcurrency}getActiveNonExclusiveCount(){return this.nonExclusiveCurrentCount}getPendingNonExclusiveCount(){return this.nonExclusivePendingQueue.length}async processExecutionSlots(){if(!this.isProcessing){for(this.isProcessing=!0;this.executionSlots.length>0;){let e=this.executionSlots[0];if(e.mode==="exclusive")await this.executeExclusiveSlot(e),this.executionSlots.shift();else{let t=[];for(;this.executionSlots.length>0&&this.executionSlots[0].mode==="nonexclusive";)t.push(this.executionSlots.shift());await this.executeNonExclusiveSlots(t)}}this.isProcessing=!1}}async executeExclusiveSlot(e){try{if(e.timeout){let t=new A.Timeout(e.timeout);try{let o=await Promise.race([e.funcToExecute(),t.promise.then(()=>{throw new Error("Timeout reached")})]);t.cancel(),e.executionDeferred.resolve(o)}catch(o){throw t.cancel(),o}}else{let t=await e.funcToExecute();e.executionDeferred.resolve(t)}}catch(t){e.executionDeferred.reject(t)}}async executeNonExclusiveSlots(e){let t=e.map(async o=>{await this.waitForNonExclusiveSlot();try{if(o.timeout){let n=new A.Timeout(o.timeout);try{let s=await Promise.race([o.funcToExecute(),n.promise.then(()=>{throw new Error("Timeout reached")})]);n.cancel(),o.executionDeferred.resolve(s)}catch(s){throw n.cancel(),s}}else{let n=await o.funcToExecute();o.executionDeferred.resolve(n)}}catch(n){o.executionDeferred.reject(n)}finally{this.releaseNonExclusiveSlot()}});await Promise.all(t)}waitForNonExclusiveSlot(){return this.nonExclusiveCurrentCount<this.nonExclusiveMaxConcurrency?(this.nonExclusiveCurrentCount++,Promise.resolve()):new Promise(e=>{this.nonExclusivePendingQueue.push(()=>{this.nonExclusiveCurrentCount++,e()})})}releaseNonExclusiveSlot(){this.nonExclusiveCurrentCount--;let e=this.nonExclusivePendingQueue.shift();e&&e()}};var Fa=class{static{i(this,"BackpressuredArray")}data;highWaterMark;hasSpace=new Ce.rxjs.Subject;itemsAvailable=new Ce.rxjs.Subject;isDestroyed=!1;constructor(e=16){this.data=[],this.highWaterMark=e}get length(){return this.data.length}push(e){this.data.push(e),this.itemsAvailable.next("itemsAvailable");let t=this.checkSpaceAvailable();return t&&this.hasSpace.next("hasSpace"),t}pushMany(e){for(let t of e)this.push(t);return this.checkSpaceAvailable()}shift(){let e=this.data.shift();return this.checkSpaceAvailable()&&this.hasSpace.next("hasSpace"),e}peek(){return this.data[0]}checkSpaceAvailable(){return this.data.length<this.highWaterMark}checkHasItems(){return this.data.length>0}waitForSpace(){return new Promise(e=>{if(this.checkSpaceAvailable()||this.isDestroyed)e();else{let t=this.hasSpace.subscribe({next:i(()=>{t.unsubscribe(),e()},"next"),complete:i(()=>{e()},"complete")})}})}waitForItems(){return new Promise(e=>{if(this.data.length>0||this.isDestroyed)e();else{let t=this.itemsAvailable.subscribe({next:i(()=>{t.unsubscribe(),e()},"next"),complete:i(()=>{e()},"complete")})}})}[Symbol.iterator](){return this.data[Symbol.iterator]()}destroy(){this.isDestroyed=!0,this.hasSpace.complete(),this.itemsAvailable.complete()}};var So=class r{static{i(this,"FastMap")}mapObject=new Map;isUniqueKey(e){return!this.mapObject.has(e)}has(e){return this.mapObject.has(e)}get size(){return this.mapObject.size}addToMap(e,t,o){return this.isUniqueKey(e)||o&&o.force?(this.mapObject.set(e,t),!0):!1}getByKey(e){return this.mapObject.get(e)}removeFromMap(e){let t=this.mapObject.get(e);return this.mapObject.delete(e),t}getKeys(){return Array.from(this.mapObject.keys())}values(){return Array.from(this.mapObject.values())}entries(){return Array.from(this.mapObject.entries())}clean(){this.mapObject.clear()}concat(e){let t=new r;for(let o of this.getKeys())t.addToMap(o,this.getByKey(o));for(let o of e.getKeys())t.addToMap(o,e.getByKey(o),{force:!0});return t}addAllFromOther(e){for(let t of e.getKeys())this.addToMap(t,e.getByKey(t),{force:!0})}async find(e){for(let t of this.getKeys()){let o=this.getByKey(t);if(await e(o))return o}}[Symbol.iterator](){return this.mapObject.entries()}};var dd=i((r="uni")=>`${r}xxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),"uni"),Vt=class r{static{i(this,"ObjectMap")}fastMap=new So;reverseMap=new Map;eventSubject=new Ce.rxjs.Subject;constructor(){}get length(){return this.fastMap.size}addMappedUnique(e,t){this.fastMap.addToMap(e,t),this.reverseMap.set(t,e)}getMappedUnique(e){return this.fastMap.getByKey(e)}removeMappedUnique(e){let t=this.fastMap.removeFromMap(e);return t!==void 0&&(this.reverseMap.delete(t),this.eventSubject.next({operation:"remove",payload:t})),t}add(e){let t=this.reverseMap.get(e);if(t!==void 0)return t;let o=dd("key");return this.addMappedUnique(o,e),this.eventSubject.next({operation:"add",payload:e}),o}addArray(e){for(let t of e)this.add(t)}checkForObject(e){return this.reverseMap.has(e)}getKeyForObject(e){return this.reverseMap.get(e)??null}async find(e){return this.fastMap.find(e)}findSync(e){for(let t of this.fastMap.getKeys())if(e(this.fastMap.getByKey(t)))return this.getMappedUnique(t)}async findOneAndRemove(e){let t=await this.find(e);return t&&this.remove(t),t}findOneAndRemoveSync(e){let t=this.findSync(e);return t&&this.remove(t),t}async forEach(e){for(let t of this.fastMap.getKeys())await e(this.fastMap.getByKey(t))}getOneAndRemove(){let e=this.fastMap.getKeys();if(e.length===0)return null;{let t=e[0],o=this.fastMap.removeFromMap(t);return this.reverseMap.delete(o),this.eventSubject.next({operation:"remove",payload:o}),o}}getArray(){return this.fastMap.values()}isEmpty(){return this.fastMap.size===0}remove(e){let t=this.reverseMap.get(e);if(t!==void 0){let o=this.fastMap.removeFromMap(t);return this.reverseMap.delete(o),this.eventSubject.next({operation:"remove",payload:o}),o}return null}wipe(){let e=this.fastMap.getKeys();for(let t of e){let o=this.fastMap.removeFromMap(t);this.reverseMap.delete(o),this.eventSubject.next({operation:"remove",payload:o})}}concat(e){let t=new r;t.fastMap.addAllFromOther(this.fastMap),t.fastMap.addAllFromOther(e.fastMap);for(let o of t.fastMap.getKeys())t.reverseMap.set(t.fastMap.getByKey(o),o);return t}addAllFromOther(e){this.fastMap.addAllFromOther(e.fastMap);for(let t of e.fastMap.getKeys())this.reverseMap.set(e.fastMap.getByKey(t),t)}map(e){return this.getArray().map(e)}filter(e){return this.getArray().filter(e)}reduce(e,t){return this.getArray().reduce(e,t)}[Symbol.iterator](){return this.getArray()[Symbol.iterator]()}destroy(){this.wipe(),this.reverseMap.clear(),this.eventSubject.complete()}};var Mo=class{static{i(this,"Interest")}options;interestMapRef;originalInterest;comparisonFunc;destructionTimer=new zt.Timer(1e4);isFullfilled=!1;isDestroyed=!1;fullfillmentStore=[];markLostTimeout=null;get comparisonString(){return this.comparisonFunc(this.originalInterest)}interestDeferred=new R.Deferred;interestFullfilled=this.interestDeferred.promise;fullfillInterest(e){this.isFullfilled=!0,this.fullfillmentStore=[],this.interestDeferred.resolve(e),this.destroy()}constructor(e,t,o,n){this.interestMapRef=e,this.originalInterest=t,this.comparisonFunc=o,this.options=n,this.destructionTimer.completed.then(()=>{this.isDestroyed||this.destroy()}),this.options?.markLostAfterDefault&&(this.markLostTimeout=new A.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 Wa=class{static{i(this,"InterestMap")}options;interestObjectMap=new Vt;interestsByComparisonString=new Map;comparisonFunc;constructor(e,t={}){this.comparisonFunc=e,this.options=t}async addInterest(e,t){let o=this.comparisonFunc(e),n,s=this.interestsByComparisonString.get(o);return s?(n=s,n.renew()):(n=new Mo(this,e,this.comparisonFunc,{markLostAfterDefault:this.options.markLostAfterDefault,defaultFullfillment:t}),this.interestObjectMap.add(n),this.interestsByComparisonString.set(o,n)),this.interestObservable.push(n),n}interestObservable=new Ce.ObservableIntake;removeInterest(e){this.interestObjectMap.findOneAndRemoveSync(t=>e.comparisonString===t.comparisonString),this.interestsByComparisonString.delete(e.comparisonString)}checkInterest(e){let t=this.comparisonFunc(e);return this.checkInterestByString(t)}checkInterestByString(e){return this.interestsByComparisonString.has(e)}informLostInterest(e){let t=this.findInterest(e);t&&t.markLost()}findInterest(e){let t=this.comparisonFunc(e);return this.interestsByComparisonString.get(t)??null}destroy(){let e=this.interestObjectMap.getArray();for(let t of e)t.destroy();this.interestObjectMap.wipe(),this.interestsByComparisonString.clear(),this.interestObservable.signalComplete()}};var Aa=class{static{i(this,"LimitedArray")}array=[];arrayLimit;constructor(e){this.arrayLimit=e}get length(){return this.array.length}addOne(e){this.array.unshift(e),this.array.length>this.arrayLimit&&(this.array.length=this.arrayLimit)}addMany(e){for(let t of e)this.addOne(t)}setLimit(e){this.arrayLimit=e,this.array.length>this.arrayLimit&&(this.array.length=this.arrayLimit)}getAverage(){if(this.array.length===0)return 0;if(typeof this.array[0]=="number"){let e=0;for(let t of this.array)e=e+t;return e/this.array.length}else return null}remove(e){let t=this.array.indexOf(e);return t!==-1?(this.array.splice(t,1),!0):!1}clear(){this.array.length=0}getArray(){return[...this.array]}[Symbol.iterator](){return this.array[Symbol.iterator]()}};var La=class{static{i(this,"LoopTracker")}referenceObjectMap=new Vt;constructor(){}checkAndTrack(e){return this.referenceObjectMap.checkForObject(e)?!1:(this.referenceObjectMap.add(e),!0)}reset(){this.referenceObjectMap.wipe()}destroy(){this.referenceObjectMap.destroy()}};var Ya=class{static{i(this,"Stringmap")}_stringArray=[];_triggerUntilTrueFunctionArray=[];constructor(){}addString(e){this._stringArray.push(e),this.notifyTrigger()}addStringArray(e){for(let t of e)this.addString(t)}removeString(e){this._stringArray=this._stringArray.filter(t=>t!==e),this.notifyTrigger()}wipe(){this._stringArray=[],this.notifyTrigger()}checkString(e){return this._stringArray.indexOf(e)!==-1}checkMinimatch(e){let t=new Zr.SmartMatch(e),o=!1;for(let n of this._stringArray)t.match(n)&&(o=!0);return o}checkIsEmpty(){return this._stringArray.length===0}getStringArray(){let e=[];for(let t of this._stringArray)e.push(t);return e}registerUntilTrue(e,t){let o=R.defer();return this._triggerUntilTrueFunctionArray.push(()=>{let n=e(this.getStringArray());return n===!0&&(t&&t(),o.resolve()),n}),this.notifyTrigger(),o.promise}notifyTrigger(){let e=this._triggerUntilTrueFunctionArray.filter(t=>!t());this._triggerUntilTrueFunctionArray=e}destroy(){this._stringArray=[],this._triggerUntilTrueFunctionArray=[]}};var ko=class{static{i(this,"TimedAggregtor")}options;storageArray=[];isStopped=!1;constructor(e){this.options=e}aggregationTimer;checkAggregationStatus(){if(this.isStopped)return;let e=i(()=>{this.aggregationTimer=new zt.Timer(this.options.aggregationIntervalInMillis),this.aggregationTimer.completed.then(()=>{if(this.isStopped){this.aggregationTimer=null;return}let t=this.storageArray;if(t.length===0){this.aggregationTimer=null;return}this.storageArray=[],e(),this.options.functionForAggregation(t)}),this.aggregationTimer.start()},"addAggregationTimer");this.aggregationTimer||e()}add(e){this.isStopped||(this.storageArray.push(e),this.checkAggregationStatus())}stop(e=!1){if(this.isStopped=!0,this.aggregationTimer&&(this.aggregationTimer.reset(),this.aggregationTimer=null),e&&this.storageArray.length>0){let t=this.storageArray;this.storageArray=[],this.options.functionForAggregation(t)}else this.storageArray=[]}restart(){this.isStopped=!1}};var Ba=class{static{i(this,"Tree")}symbolTree;constructor(){this.symbolTree=new cs.default}initialize(e){return this.symbolTree.initialize(e)}hasChildren(e){return this.symbolTree.hasChildren(e)}firstChild(e){return this.symbolTree.firstChild(e)}lastChild(e){return this.symbolTree.lastChild(e)}previousSibling(e){return this.symbolTree.previousSibling(e)}nextSibling(e){return this.symbolTree.nextSibling(e)}parent(e){return this.symbolTree.parent(e)}lastInclusiveDescendant(e){return this.symbolTree.lastInclusiveDescendant(e)}preceding(e,t){return this.symbolTree.preceding(e,t)}following(e,t){return this.symbolTree.following(e,t)}childrenToArray(e,t){return this.symbolTree.childrenToArray(e,t)}ancestorsToArray(e,t){return this.symbolTree.ancestorsToArray(e,t)}treeToArray(e,t){return this.symbolTree.treeToArray(e,t)}childrenIterator(e,t){return this.symbolTree.childrenIterator(e,t)}previousSiblingsIterator(e){return this.symbolTree.previousSiblingsIterator(e)}nextSiblingsIterator(e){return this.symbolTree.nextSiblingsIterator(e)}ancestorsIterator(e){return this.symbolTree.ancestorsIterator(e)}treeIterator(e,t){return this.symbolTree.treeIterator(e,t)}index(e){return this.symbolTree.index(e)}childrenCount(e){return this.symbolTree.childrenCount(e)}compareTreePosition(e,t){return this.symbolTree.compareTreePosition(e,t)}remove(e){return this.symbolTree.remove(e)}insertBefore(e,t){return this.symbolTree.insertBefore(e,t)}insertAfter(e,t){return this.symbolTree.insertAfter(e,t)}prependChild(e,t){return this.symbolTree.prependChild(e,t)}appendChild(e,t){return this.symbolTree.appendChild(e,t)}toJsonWithHierachy(e){let t=i(o=>{let n=[];if(this.hasChildren(o)){let s=this.childrenToArray(o,{});for(let a of s)n.push(t(a))}return{data:o,children:n}},"buildNode");return t(e)}fromJsonWithHierachy(e,t){let o=i((n,s)=>{let a=t?t(n.data):n.data;this.initialize(a),s&&this.appendChild(s,a);for(let u of n.children)o(u,a);return a},"buildTree");return o(e)}};var Gt={};V(Gt,{base64ToUint8Array:()=>vg,ensurePureUint8Array:()=>Sg,isBufferLike:()=>Dg,isUint8Array:()=>Tg,uInt8ArrayExtras:()=>wg,uInt8ArrayToBase64:()=>bg});var kt={};V(kt,{areUint8ArraysEqual:()=>sg,assertUint8Array:()=>Mt,assertUint8ArrayOrArrayBuffer:()=>xd,base64ToString:()=>dg,base64ToUint8Array:()=>vd,compareUint8Arrays:()=>ag,concatUint8Arrays:()=>ig,getUintBE:()=>yg,hexToUint8Array:()=>hg,includes:()=>xg,indexOf:()=>Td,isUint8Array:()=>Ha,stringToBase64:()=>lg,stringToUint8Array:()=>wd,toUint8Array:()=>ng,uint8ArrayToBase64:()=>bd,uint8ArrayToHex:()=>pg,uint8ArrayToString:()=>gd});var Zx=Object.prototype.toString,eg="[object Uint8Array]",tg="[object ArrayBuffer]";function md(r,e,t){return r?r.constructor===e?!0:Zx.call(r)===t:!1}i(md,"isType");function Ha(r){return md(r,Uint8Array,eg)}i(Ha,"isUint8Array");function rg(r){return md(r,ArrayBuffer,tg)}i(rg,"isArrayBuffer");function og(r){return Ha(r)||rg(r)}i(og,"isUint8ArrayOrArrayBuffer");function Mt(r){if(!Ha(r))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof r}\``)}i(Mt,"assertUint8Array");function xd(r){if(!og(r))throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof r}\``)}i(xd,"assertUint8ArrayOrArrayBuffer");function ng(r){if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new TypeError(`Unsupported value, got \`${typeof r}\`.`)}i(ng,"toUint8Array");function ig(r,e){if(r.length===0)return new Uint8Array(0);e??=r.reduce((n,s)=>n+s.length,0);let t=new Uint8Array(e),o=0;for(let n of r)Mt(n),t.set(n,o),o+=n.length;return t}i(ig,"concatUint8Arrays");function sg(r,e){if(Mt(r),Mt(e),r===e)return!0;if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}i(sg,"areUint8ArraysEqual");function ag(r,e){Mt(r),Mt(e);let t=Math.min(r.length,e.length);for(let o=0;o<t;o++){let n=r[o]-e[o];if(n!==0)return Math.sign(n)}return Math.sign(r.length-e.length)}i(ag,"compareUint8Arrays");var pd={utf8:new globalThis.TextDecoder("utf8")};function gd(r,e="utf8"){return xd(r),pd[e]??=new globalThis.TextDecoder(e),pd[e].decode(r)}i(gd,"uint8ArrayToString");function Oo(r){if(typeof r!="string")throw new TypeError(`Expected \`string\`, got \`${typeof r}\``)}i(Oo,"assertString");var ug=new globalThis.TextEncoder;function wd(r){return Oo(r),ug.encode(r)}i(wd,"stringToUint8Array");function cg(r){return r.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}i(cg,"base64ToBase64Url");function fg(r){let e=r.replaceAll("-","+").replaceAll("_","/"),t=(4-e.length%4)%4;return e+"=".repeat(t)}i(fg,"base64UrlToBase64");var hd=65535;function bd(r,{urlSafe:e=!1}={}){Mt(r);let t="";for(let o=0;o<r.length;o+=hd){let n=r.subarray(o,o+hd);t+=globalThis.btoa(String.fromCodePoint.apply(void 0,n))}return e?cg(t):t}i(bd,"uint8ArrayToBase64");function vd(r){return Oo(r),Uint8Array.from(globalThis.atob(fg(r)),e=>e.codePointAt(0))}i(vd,"base64ToUint8Array");function lg(r,{urlSafe:e=!1}={}){return Oo(r),bd(wd(r),{urlSafe:e})}i(lg,"stringToBase64");function dg(r){return Oo(r),gd(vd(r))}i(dg,"base64ToString");var mg=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function pg(r){Mt(r);let e="";for(let t=0;t<r.length;t++)e+=mg[r[t]];return e}i(pg,"uint8ArrayToHex");var yd={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 hg(r){if(Oo(r),r.length%2!==0)throw new Error("Invalid Hex string length.");let e=r.length/2,t=new Uint8Array(e);for(let o=0;o<e;o++){let n=yd[r[o*2]],s=yd[r[o*2+1]];if(n===void 0||s===void 0)throw new Error(`Invalid Hex character encountered at position ${o*2}`);t[o]=n<<4|s}return t}i(hg,"hexToUint8Array");function yg(r){let{byteLength:e}=r;if(e===6)return r.getUint16(0)*2**32+r.getUint32(2);if(e===5)return r.getUint8(0)*2**32+r.getUint32(1);if(e===4)return r.getUint32(0);if(e===3)return r.getUint8(0)*2**16+r.getUint16(1);if(e===2)return r.getUint16(0);if(e===1)return r.getUint8(0)}i(yg,"getUintBE");function Td(r,e){let t=r.length,o=e.length;if(o===0||o>t)return-1;let n=t-o;for(let s=0;s<=n;s++){let a=!0;for(let u=0;u<o;u++)if(r[s+u]!==e[u]){a=!1;break}if(a)return s}return-1}i(Td,"indexOf");function xg(r,e){return Td(r,e)!==-1}i(xg,"includes");var wg=kt;function bg(r){return kt.uint8ArrayToBase64(r)}i(bg,"uInt8ArrayToBase64");function vg(r){return kt.base64ToUint8Array(r)}i(vg,"base64ToUint8Array");var Tg=i(r=>kt.isUint8Array(r),"isUint8Array");function Dg(r){return r&&typeof r.byteLength=="number"?!0:typeof Buffer<"u"&&Buffer.isBuffer?Buffer.isBuffer(r):!1}i(Dg,"isBufferLike");function Sg(r){let e=new Uint8Array(r.length);return e.set(r),e}i(Sg,"ensurePureUint8Array");var Co={};V(Co,{Guard:()=>Io,GuardError:()=>Eo,GuardSet:()=>_o,passGuardsOrReject:()=>Mg});var Io=class{static{i(this,"Guard")}constructor(e,t){this.guardFunction=e,this.options=t||{}}async exec(e){return await this.guardFunction(e)}async getFailedHint(e){return await this.exec(e)?null:this.options.failedHint||null}};var Eo=class extends Error{static{i(this,"GuardError")}constructor(e){super(e),this.name="GuardError"}};var _o=class extends Io{static{i(this,"GuardSet")}constructor(e=[]){super(async t=>this.allGuardsPass(t)),this.guards=e}async execAllWithData(e,t={mode:"parallel",stopOnFail:!1}){let o=[];for(let s of this.guards){let a=s.exec(e);if(t.mode==="serial"&&await a,o.push(a),t.stopOnFail&&!await a)return await Promise.all(o)}return await Promise.all(o)}async allGuardsPass(e,t={mode:"parallel",stopOnFail:!1}){return(await this.execAllWithData(e,t)).every(n=>n)}async anyGuardsPass(e){return(await this.execAllWithData(e,{mode:"parallel",stopOnFail:!1})).some(o=>o)}async getFailedHint(e){for(let t of this.guards){let o=await t.getFailedHint(e);if(o)return o}return null}};var Mg=i(async(r,e)=>{let t=new _o(e);if(!await t.allGuardsPass(r)){let n=await t.getFailedHint(r);throw new Eo(`Guards failed:
3
+ `):"",this.name="UnsubscriptionError",this.errors=t},"UnsubscriptionErrorImpl")});function Fe(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}i(Fe,"arrRemove");var Te=(function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return i(r,"Subscription"),r.prototype.unsubscribe=function(){var e,t,o,n,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var u=le(a),c=u.next();!c.done;c=u.next()){var f=c.value;f.remove(this)}}catch(g){e={error:g}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}else a.remove(this);var l=this.initialTeardown;if(I(l))try{l()}catch(g){s=g instanceof to?g.errors:[g]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var m=le(p),h=m.next();!h.done;h=m.next()){var x=h.value;try{Eu(x)}catch(g){s=s??[],g instanceof to?s=Ie(Ie([],ge(s)),ge(g.errors)):s.push(g)}}}catch(g){o={error:g}}finally{try{h&&!h.done&&(n=m.return)&&n.call(m)}finally{if(o)throw o.error}}}if(s)throw new to(s)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)Eu(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Fe(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&Fe(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=(function(){var e=new r;return e.closed=!0,e})(),r})(),Zs=Te.EMPTY;function Jo(r){return r instanceof Te||r&&"closed"in r&&I(r.remove)&&I(r.add)&&I(r.unsubscribe)}i(Jo,"isSubscription");function Eu(r){I(r)?r():r.unsubscribe()}i(Eu,"execFinalizer");var Ce={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var nr={setTimeout:i(function(r,e){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];var n=nr.delegate;return n?.setTimeout?n.setTimeout.apply(n,Ie([r,e],ge(t))):setTimeout.apply(void 0,Ie([r,e],ge(t)))},"setTimeout"),clearTimeout:i(function(r){var e=nr.delegate;return(e?.clearTimeout||clearTimeout)(r)},"clearTimeout"),delegate:void 0};function Ko(r){nr.setTimeout(function(){var e=Ce.onUnhandledError;if(e)e(r);else throw r})}i(Ko,"reportUnhandledError");function je(){}i(je,"noop");var ku=(function(){return ea("C",void 0,void 0)})();function Iu(r){return ea("E",void 0,r)}i(Iu,"errorNotification");function Cu(r){return ea("N",r,void 0)}i(Cu,"nextNotification");function ea(r,e,t){return{kind:r,value:e,error:t}}i(ea,"createNotification");var Pt=null;function ir(r){if(Ce.useDeprecatedSynchronousErrorHandling){var e=!Pt;if(e&&(Pt={errorThrown:!1,error:null}),r(),e){var t=Pt,o=t.errorThrown,n=t.error;if(Pt=null,o)throw n}}else r()}i(ir,"errorContext");function Pu(r){Ce.useDeprecatedSynchronousErrorHandling&&Pt&&(Pt.errorThrown=!0,Pt.error=r)}i(Pu,"captureError");var _t=(function(r){ue(e,r);function e(t){var o=r.call(this)||this;return o.isStopped=!1,t?(o.destination=t,Jo(t)&&t.add(o)):o.destination=Dm,o}return i(e,"Subscriber"),e.create=function(t,o,n){return new ro(t,o,n)},e.prototype.next=function(t){this.isStopped?ra(Cu(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?ra(Iu(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?ra(ku,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Te),bm=Function.prototype.bind;function ta(r,e){return bm.call(r,e)}i(ta,"bind");var vm=(function(){function r(e){this.partialObserver=e}return i(r,"ConsumerObserver"),r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(o){Qo(o)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(o){Qo(o)}else Qo(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Qo(t)}},r})(),ro=(function(r){ue(e,r);function e(t,o,n){var s=r.call(this)||this,a;if(I(t)||!t)a={next:t??void 0,error:o??void 0,complete:n??void 0};else{var u;s&&Ce.useDeprecatedNextContext?(u=Object.create(t),u.unsubscribe=function(){return s.unsubscribe()},a={next:t.next&&ta(t.next,u),error:t.error&&ta(t.error,u),complete:t.complete&&ta(t.complete,u)}):a=t}return s.destination=new vm(a),s}return i(e,"SafeSubscriber"),e})(_t);function Qo(r){Ce.useDeprecatedSynchronousErrorHandling?Pu(r):Ko(r)}i(Qo,"handleUnhandledError");function Tm(r){throw r}i(Tm,"defaultErrorHandler");function ra(r,e){var t=Ce.onStoppedNotification;t&&nr.setTimeout(function(){return t(r,e)})}i(ra,"handleStoppedNotification");var Dm={closed:!0,next:je,error:Tm,complete:je};var Rt=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function oo(r){return r}i(oo,"identity");function Sm(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return oa(r)}i(Sm,"pipe");function oa(r){return r.length===0?oo:r.length===1?r[0]:i(function(t){return r.reduce(function(o,n){return n(o)},t)},"piped")}i(oa,"pipeFromArray");var j=(function(){function r(e){e&&(this._subscribe=e)}return i(r,"Observable"),r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,o){var n=this,s=Om(e)?e:new ro(e,t,o);return ir(function(){var a=n,u=a.operator,c=a.source;s.add(u?u.call(s,c):c?n._subscribe(s):n._trySubscribe(s))}),s},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var o=this;return t=_u(t),new t(function(n,s){var a=new ro({next:i(function(u){try{e(u)}catch(c){s(c),a.unsubscribe()}},"next"),error:s,complete:n});o.subscribe(a)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[Rt]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return oa(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=_u(e),new e(function(o,n){var s;t.subscribe(function(a){return s=a},function(a){return n(a)},function(){return o(s)})})},r.create=function(e){return new r(e)},r})();function _u(r){var e;return(e=r??Ce.Promise)!==null&&e!==void 0?e:Promise}i(_u,"getPromiseCtor");function Mm(r){return r&&I(r.next)&&I(r.error)&&I(r.complete)}i(Mm,"isObserver");function Om(r){return r&&r instanceof _t||Mm(r)&&Jo(r)}i(Om,"isSubscriber");function Em(r){return I(r?.lift)}i(Em,"hasLift");function B(r){return function(e){if(Em(e))return e.lift(function(t){try{return r(t,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}i(B,"operate");function z(r,e,t,o,n){return new Ru(r,e,t,o,n)}i(z,"createOperatorSubscriber");var Ru=(function(r){ue(e,r);function e(t,o,n,s,a,u){var c=r.call(this,t)||this;return c.onFinalize=a,c.shouldUnsubscribe=u,c._next=o?function(f){try{o(f)}catch(l){t.error(l)}}:r.prototype._next,c._error=s?function(f){try{s(f)}catch(l){t.error(l)}finally{this.unsubscribe()}}:r.prototype._error,c._complete=n?function(){try{n()}catch(f){t.error(f)}finally{this.unsubscribe()}}:r.prototype._complete,c}return i(e,"OperatorSubscriber"),e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;r.prototype.unsubscribe.call(this),!o&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e})(_t);var na=Go(function(r){return i(function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl")});var He=(function(r){ue(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return i(e,"Subject"),e.prototype.lift=function(t){var o=new ia(this,this);return o.operator=t,o},e.prototype._throwIfClosed=function(){if(this.closed)throw new na},e.prototype.next=function(t){var o=this;ir(function(){var n,s;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var a=le(o.currentObservers),u=a.next();!u.done;u=a.next()){var c=u.value;c.next(t)}}catch(f){n={error:f}}finally{try{u&&!u.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}}})},e.prototype.error=function(t){var o=this;ir(function(){if(o._throwIfClosed(),!o.isStopped){o.hasError=o.isStopped=!0,o.thrownError=t;for(var n=o.observers;n.length;)n.shift().error(t)}})},e.prototype.complete=function(){var t=this;ir(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var o=t.observers;o.length;)o.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:i(function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},"get"),enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var o=this,n=this,s=n.hasError,a=n.isStopped,u=n.observers;return s||a?Zs:(this.currentObservers=null,u.push(t),new Te(function(){o.currentObservers=null,Fe(u,t)}))},e.prototype._checkFinalizedStatuses=function(t){var o=this,n=o.hasError,s=o.thrownError,a=o.isStopped;n?t.error(s):a&&t.complete()},e.prototype.asObservable=function(){var t=new j;return t.source=this,t},e.create=function(t,o){return new ia(t,o)},e})(j),ia=(function(r){ue(e,r);function e(t,o){var n=r.call(this)||this;return n.destination=t,n.source=o,n}return i(e,"AnonymousSubject"),e.prototype.next=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.next)===null||n===void 0||n.call(o,t)},e.prototype.error=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.error)===null||n===void 0||n.call(o,t)},e.prototype.complete=function(){var t,o;(o=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||o===void 0||o.call(t)},e.prototype._subscribe=function(t){var o,n;return(n=(o=this.source)===null||o===void 0?void 0:o.subscribe(t))!==null&&n!==void 0?n:Zs},e})(He);var no={now:i(function(){return(no.delegate||Date).now()},"now"),delegate:void 0};var Xo=(function(r){ue(e,r);function e(t,o,n){t===void 0&&(t=1/0),o===void 0&&(o=1/0),n===void 0&&(n=no);var s=r.call(this)||this;return s._bufferSize=t,s._windowTime=o,s._timestampProvider=n,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=o===1/0,s._bufferSize=Math.max(1,t),s._windowTime=Math.max(1,o),s}return i(e,"ReplaySubject"),e.prototype.next=function(t){var o=this,n=o.isStopped,s=o._buffer,a=o._infiniteTimeWindow,u=o._timestampProvider,c=o._windowTime;n||(s.push(t),!a&&s.push(u.now()+c)),this._trimBuffer(),r.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var o=this._innerSubscribe(t),n=this,s=n._infiniteTimeWindow,a=n._buffer,u=a.slice(),c=0;c<u.length&&!t.closed;c+=s?1:2)t.next(u[c]);return this._checkFinalizedStatuses(t),o},e.prototype._trimBuffer=function(){var t=this,o=t._bufferSize,n=t._timestampProvider,s=t._buffer,a=t._infiniteTimeWindow,u=(a?1:2)*o;if(o<1/0&&u<s.length&&s.splice(0,s.length-u),!a){for(var c=n.now(),f=0,l=1;l<s.length&&s[l]<=c;l+=2)f=l;f&&s.splice(0,f+1)}},e})(He);var sa=(function(r){ue(e,r);function e(t,o){return r.call(this)||this}return i(e,"Action"),e.prototype.schedule=function(t,o){return o===void 0&&(o=0),this},e})(Te);var io={setInterval:i(function(r,e){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];var n=io.delegate;return n?.setInterval?n.setInterval.apply(n,Ie([r,e],ge(t))):setInterval.apply(void 0,Ie([r,e],ge(t)))},"setInterval"),clearInterval:i(function(r){var e=io.delegate;return(e?.clearInterval||clearInterval)(r)},"clearInterval"),delegate:void 0};var aa=(function(r){ue(e,r);function e(t,o){var n=r.call(this,t,o)||this;return n.scheduler=t,n.work=o,n.pending=!1,n}return i(e,"AsyncAction"),e.prototype.schedule=function(t,o){var n;if(o===void 0&&(o=0),this.closed)return this;this.state=t;var s=this.id,a=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(a,s,o)),this.pending=!0,this.delay=o,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(a,this.id,o),this},e.prototype.requestAsyncId=function(t,o,n){return n===void 0&&(n=0),io.setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,o,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return o;o!=null&&io.clearInterval(o)},e.prototype.execute=function(t,o){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,o);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,o){var n=!1,s;try{this.work(t)}catch(a){n=!0,s=a||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,o=t.id,n=t.scheduler,s=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Fe(s,this),o!=null&&(this.id=this.recycleAsyncId(n,o,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e})(sa);var so=(function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return i(r,"Scheduler"),r.prototype.schedule=function(e,t,o){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(o,t)},r.now=no.now,r})();var ua=(function(r){ue(e,r);function e(t,o){o===void 0&&(o=so.now);var n=r.call(this,t,o)||this;return n.actions=[],n._active=!1,n}return i(e,"AsyncScheduler"),e.prototype.flush=function(t){var o=this.actions;if(this._active){o.push(t);return}var n;this._active=!0;do if(n=t.execute(t.state,t.delay))break;while(t=o.shift());if(this._active=!1,n){for(;t=o.shift();)t.unsubscribe();throw n}},e})(so);var st=new ua(aa),ca=st;function Zo(r){return r&&I(r.schedule)}i(Zo,"isScheduler");function fa(r){return r[r.length-1]}i(fa,"last");function Uv(r){return I(fa(r))?r.pop():void 0}i(Uv,"popResultSelector");function at(r){return Zo(fa(r))?r.pop():void 0}i(at,"popScheduler");function $v(r,e){return typeof fa(r)=="number"?r.pop():e}i($v,"popNumber");var sr=i((function(r){return r&&typeof r.length=="number"&&typeof r!="function"}),"isArrayLike");function en(r){return I(r?.then)}i(en,"isPromise");function tn(r){return I(r[Rt])}i(tn,"isInteropObservable");function rn(r){return Symbol.asyncIterator&&I(r?.[Symbol.asyncIterator])}i(rn,"isAsyncIterable");function on(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}i(on,"createInvalidObservableTypeError");function km(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(km,"getSymbolIterator");var nn=km();function sn(r){return I(r?.[nn])}i(sn,"isIterable");function an(r){return Qs(this,arguments,i(function(){var t,o,n,s;return eo(this,function(a){switch(a.label){case 0:t=r.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Xe(t.read())];case 3:return o=a.sent(),n=o.value,s=o.done,s?[4,Xe(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Xe(n)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})},"readableStreamLikeToAsyncGenerator_1"))}i(an,"readableStreamLikeToAsyncGenerator");function un(r){return I(r?.getReader)}i(un,"isReadableStreamLike");function Q(r){if(r instanceof j)return r;if(r!=null){if(tn(r))return Im(r);if(sr(r))return Cm(r);if(en(r))return Pm(r);if(rn(r))return Nu(r);if(sn(r))return _m(r);if(un(r))return Rm(r)}throw on(r)}i(Q,"innerFrom");function Im(r){return new j(function(e){var t=r[Rt]();if(I(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i(Im,"fromInteropObservable");function Cm(r){return new j(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}i(Cm,"fromArrayLike");function Pm(r){return new j(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Ko)})}i(Pm,"fromPromise");function _m(r){return new j(function(e){var t,o;try{for(var n=le(r),s=n.next();!s.done;s=n.next()){var a=s.value;if(e.next(a),e.closed)return}}catch(u){t={error:u}}finally{try{s&&!s.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}e.complete()})}i(_m,"fromIterable");function Nu(r){return new j(function(e){Nm(r,e).catch(function(t){return e.error(t)})})}i(Nu,"fromAsyncIterable");function Rm(r){return Nu(an(r))}i(Rm,"fromReadableStreamLike");function Nm(r,e){var t,o,n,s;return Ks(this,void 0,void 0,function(){var a,u;return eo(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),t=Xs(r),c.label=1;case 1:return[4,t.next()];case 2:if(o=c.sent(),!!o.done)return[3,4];if(a=o.value,e.next(a),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),n={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),o&&!o.done&&(s=t.return)?[4,s.call(t)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}i(Nm,"process");function we(r,e,t,o,n){o===void 0&&(o=0),n===void 0&&(n=!1);var s=e.schedule(function(){t(),n?r.add(this.schedule(null,o)):this.unsubscribe()},o);if(r.add(s),!n)return s}i(we,"executeSchedule");function ar(r,e){return e===void 0&&(e=0),B(function(t,o){t.subscribe(z(o,function(n){return we(o,r,function(){return o.next(n)},e)},function(){return we(o,r,function(){return o.complete()},e)},function(n){return we(o,r,function(){return o.error(n)},e)}))})}i(ar,"observeOn");function ur(r,e){return e===void 0&&(e=0),B(function(t,o){o.add(r.schedule(function(){return t.subscribe(o)},e))})}i(ur,"subscribeOn");function Wu(r,e){return Q(r).pipe(ur(e),ar(e))}i(Wu,"scheduleObservable");function Fu(r,e){return Q(r).pipe(ur(e),ar(e))}i(Fu,"schedulePromise");function Lu(r,e){return new j(function(t){var o=0;return e.schedule(function(){o===r.length?t.complete():(t.next(r[o++]),t.closed||this.schedule())})})}i(Lu,"scheduleArray");function Yu(r,e){return new j(function(t){var o;return we(t,e,function(){o=r[nn](),we(t,e,function(){var n,s,a;try{n=o.next(),s=n.value,a=n.done}catch(u){t.error(u);return}a?t.complete():t.next(s)},0,!0)}),function(){return I(o?.return)&&o.return()}})}i(Yu,"scheduleIterable");function cn(r,e){if(!r)throw new Error("Iterable cannot be null");return new j(function(t){we(t,e,function(){var o=r[Symbol.asyncIterator]();we(t,e,function(){o.next().then(function(n){n.done?t.complete():t.next(n.value)})},0,!0)})})}i(cn,"scheduleAsyncIterable");function qu(r,e){return cn(an(r),e)}i(qu,"scheduleReadableStreamLike");function la(r,e){if(r!=null){if(tn(r))return Wu(r,e);if(sr(r))return Lu(r,e);if(en(r))return Fu(r,e);if(rn(r))return cn(r,e);if(sn(r))return Yu(r,e);if(un(r))return qu(r,e)}throw on(r)}i(la,"scheduled");function Nt(r,e){return e?la(r,e):Q(r)}i(Nt,"from");function da(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=at(r);return Nt(r,t)}i(da,"of");function ju(r){return r instanceof Date&&!isNaN(r)}i(ju,"isValidDate");function ut(r,e){return B(function(t,o){var n=0;t.subscribe(z(o,function(s){o.next(r.call(e,s,n++))}))})}i(ut,"map");var Wm=Array.isArray;function Fm(r,e){return Wm(e)?r.apply(void 0,Ie([],ge(e))):r(e)}i(Fm,"callOrApply");function Hu(r){return ut(function(e){return Fm(r,e)})}i(Hu,"mapOneOrManyArgs");function Uu(r,e,t,o,n,s,a,u){var c=[],f=0,l=0,p=!1,m=i(function(){p&&!c.length&&!f&&e.complete()},"checkComplete"),h=i(function(g){return f<o?x(g):c.push(g)},"outerNext"),x=i(function(g){s&&e.next(g),f++;var w=!1;Q(t(g,l++)).subscribe(z(e,function(v){n?.(v),s?h(v):e.next(v)},function(){w=!0},void 0,function(){if(w)try{f--;for(var v=i(function(){var G=c.shift();a?we(e,a,function(){return x(G)}):x(G)},"_loop_1");c.length&&f<o;)v();m()}catch(G){e.error(G)}}))},"doInnerSub");return r.subscribe(z(e,h,function(){p=!0,m()})),function(){u?.()}}i(Uu,"mergeInternals");function Wt(r,e,t){return t===void 0&&(t=1/0),I(e)?Wt(function(o,n){return ut(function(s,a){return e(o,s,n,a)})(Q(r(o,n)))},t):(typeof e=="number"&&(t=e),B(function(o,n){return Uu(o,n,r,t)}))}i(Wt,"mergeMap");function fn(r){return r===void 0&&(r=1/0),Wt(oo,r)}i(fn,"mergeAll");function ln(){return fn(1)}i(ln,"concatAll");function dn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return ln()(Nt(r,at(r)))}i(dn,"concat");var Lm=["addListener","removeListener"],Ym=["addEventListener","removeEventListener"],qm=["on","off"];function Ft(r,e,t,o){if(I(t)&&(o=t,t=void 0),o)return Ft(r,e,t).pipe(Hu(o));var n=ge(Um(r)?Ym.map(function(u){return function(c){return r[u](e,c,t)}}):jm(r)?Lm.map($u(r,e)):Hm(r)?qm.map($u(r,e)):[],2),s=n[0],a=n[1];if(!s&&sr(r))return Wt(function(u){return Ft(u,e,t)})(Q(r));if(!s)throw new TypeError("Invalid event target");return new j(function(u){var c=i(function(){for(var f=[],l=0;l<arguments.length;l++)f[l]=arguments[l];return u.next(1<f.length?f:f[0])},"handler");return s(c),function(){return a(c)}})}i(Ft,"fromEvent");function $u(r,e){return function(t){return function(o){return r[t](e,o)}}}i($u,"toCommonHandlerRegistry");function jm(r){return I(r.addListener)&&I(r.removeListener)}i(jm,"isNodeStyleEventEmitter");function Hm(r){return I(r.on)&&I(r.off)}i(Hm,"isJQueryStyleEventEmitter");function Um(r){return I(r.addEventListener)&&I(r.removeEventListener)}i(Um,"isEventTarget");function pa(r,e,t){r===void 0&&(r=0),t===void 0&&(t=ca);var o=-1;return e!=null&&(Zo(e)?t=e:o=e),new j(function(n){var s=ju(r)?+r-t.now():r;s<0&&(s=0);var a=0;return t.schedule(function(){n.closed||(n.next(a++),0<=o?this.schedule(void 0,o):n.complete())},s)})}i(pa,"timer");function pn(r,e){return B(function(t,o){var n=0;t.subscribe(z(o,function(s){return r.call(e,s,n++)&&o.next(s)}))})}i(pn,"filter");function mn(r){return B(function(e,t){var o=[];return e.subscribe(z(t,function(n){return o.push(n)},function(){t.next(o),t.complete()})),Q(r).subscribe(z(t,function(){var n=o;o=[],t.next(n)},je)),function(){o=null}})}i(mn,"buffer");function hn(r,e){return e===void 0&&(e=null),e=e??r,B(function(t,o){var n=[],s=0;t.subscribe(z(o,function(a){var u,c,f,l,p=null;s++%e===0&&n.push([]);try{for(var m=le(n),h=m.next();!h.done;h=m.next()){var x=h.value;x.push(a),r<=x.length&&(p=p??[],p.push(x))}}catch(v){u={error:v}}finally{try{h&&!h.done&&(c=m.return)&&c.call(m)}finally{if(u)throw u.error}}if(p)try{for(var g=le(p),w=g.next();!w.done;w=g.next()){var x=w.value;Fe(n,x),o.next(x)}}catch(v){f={error:v}}finally{try{w&&!w.done&&(l=g.return)&&l.call(g)}finally{if(f)throw f.error}}},function(){var a,u;try{for(var c=le(n),f=c.next();!f.done;f=c.next()){var l=f.value;o.next(l)}}catch(p){a={error:p}}finally{try{f&&!f.done&&(u=c.return)&&u.call(c)}finally{if(a)throw a.error}}o.complete()},void 0,function(){n=null}))})}i(hn,"bufferCount");function yn(r){for(var e,t,o=[],n=1;n<arguments.length;n++)o[n-1]=arguments[n];var s=(e=at(o))!==null&&e!==void 0?e:st,a=(t=o[0])!==null&&t!==void 0?t:null,u=o[1]||1/0;return B(function(c,f){var l=[],p=!1,m=i(function(g){var w=g.buffer,v=g.subs;v.unsubscribe(),Fe(l,g),f.next(w),p&&h()},"emit"),h=i(function(){if(l){var g=new Te;f.add(g);var w=[],v={buffer:w,subs:g};l.push(v),we(g,s,function(){return m(v)},r)}},"startBuffer");a!==null&&a>=0?we(f,s,h,a,!0):p=!0,h();var x=z(f,function(g){var w,v,G=l.slice();try{for(var te=le(G),ae=te.next();!ae.done;ae=te.next()){var rt=ae.value,Qe=rt.buffer;Qe.push(g),u<=Qe.length&&m(rt)}}catch(tr){w={error:tr}}finally{try{ae&&!ae.done&&(v=te.return)&&v.call(te)}finally{if(w)throw w.error}}},function(){for(;l?.length;)f.next(l.shift().buffer);x?.unsubscribe(),f.complete(),f.unsubscribe()},void 0,function(){return l=null});c.subscribe(x)})}i(yn,"bufferTime");function xn(r){return B(function(e,t){var o=!1,n=null,s=null,a=i(function(){if(s?.unsubscribe(),s=null,o){o=!1;var u=n;n=null,t.next(u)}},"emit");e.subscribe(z(t,function(u){s?.unsubscribe(),o=!0,n=u,s=z(t,a,je),Q(r(u)).subscribe(s)},function(){a(),t.complete()},void 0,function(){n=s=null}))})}i(xn,"debounce");function gn(r,e){return e===void 0&&(e=st),B(function(t,o){var n=null,s=null,a=null,u=i(function(){if(n){n.unsubscribe(),n=null;var f=s;s=null,o.next(f)}},"emit");function c(){var f=a+r,l=e.now();if(l<f){n=this.schedule(void 0,f-l),o.add(n);return}u()}i(c,"emitWhenIdle"),t.subscribe(z(o,function(f){s=f,a=e.now(),n||(n=e.schedule(c,r),o.add(n))},function(){u(),o.complete()},void 0,function(){s=n=null}))})}i(gn,"debounceTime");function wn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=at(r);return B(function(o,n){(t?dn(r,o,t):dn(r,o)).subscribe(n)})}i(wn,"startWith");function bn(r){return B(function(e,t){Q(r).subscribe(z(t,function(){return t.complete()},je)),!t.closed&&e.subscribe(t)})}i(bn,"takeUntil");function vn(r,e){return B(function(t,o){var n=e??{},s=n.leading,a=s===void 0?!0:s,u=n.trailing,c=u===void 0?!1:u,f=!1,l=null,p=null,m=!1,h=i(function(){p?.unsubscribe(),p=null,c&&(w(),m&&o.complete())},"endThrottling"),x=i(function(){p=null,m&&o.complete()},"cleanupThrottling"),g=i(function(v){return p=Q(r(v)).subscribe(z(o,h,x))},"startThrottle"),w=i(function(){if(f){f=!1;var v=l;l=null,o.next(v),!m&&g(v)}},"send");t.subscribe(z(o,function(v){f=!0,l=v,!(p&&!p.closed)&&(a?w():g(v))},function(){m=!0,!(c&&f&&p&&!p.closed)&&o.complete()}))})}i(vn,"throttle");function Tn(r,e,t){e===void 0&&(e=st);var o=pa(r,e);return vn(function(){return o},t)}i(Tn,"throttleTime");var My={buffer:mn,bufferCount:hn,bufferTime:yn,debounce:xn,debounceTime:gn,filter:pn,map:ut,startWith:wn,takeUntil:bn,throttleTime:Tn};var ma=class{static{i(this,"Observablemap")}constructor(){this.observableEventEmitterBundleArray=new Array,this.observableEventTargetBundleArray=new Array}getSubjectForEmitterEvent(e,t){let o=this.observableEventEmitterBundleArray.find(n=>n.eventRef===e&&n.event===t);if(o)return o.subject;{let n=Ft(e,t),s=new He;n.subscribe(s);let a={subject:s,eventRef:e,event:t};return this.observableEventEmitterBundleArray.push(a),a.subject}}getSubjectForEventTarget(e,t){let o=this.observableEventTargetBundleArray.find(n=>n.eventRef===e&&n.event===t);if(o)return o.subject;{let s={subject:new He,eventRef:e,event:t};return this.observableEventTargetBundleArray.push(s),s.subject}}};var ha=class{static{i(this,"ObservableIntake")}constructor(){this.observableFunctions={next:i(e=>{},"next"),complete:i(e=>{},"complete")},this.buffered=!1,this.payloadBuffer=[],this.observable=new j(e=>{this.observableFunctions.next=t=>e.next(t),this.observableFunctions.complete=()=>(this.completedDeffered.resolve(),e.complete())}),this.completedDeffered=F.defer(),this.completed=this.completedDeffered.promise}setObservable(e){this.observable=e}push(e){this.buffered?this.payloadBuffer.push(e):this.internalPush(e)}pushMany(e){for(let t of e)this.push(t)}setGenerator(e){this.generator=e}makeBuffered(){this.buffered=!0}subscribe(...e){return this.observable.subscribe(...e)}request(e){if(e!==0)for(let t=0;t!==e;t++)if(this.payloadBuffer.length>0)this.internalPush(this.payloadBuffer.shift());else{if(!this.generator)throw new Error("Cannot request an unbuffered value before setting a generator");let o=this.generator.next();this.internalPush(o.value)}}signalComplete(){this.observableFunctions.complete()}internalPush(e){this.observableFunctions.next(e)}};function Oy(r){return new j(e=>{let t=i(()=>r.pause(),"pauseStream"),o=i(()=>process.nextTick(()=>r.resume()),"resumeStream"),n=i(s=>{t(),e.next(s),o()},"onData");return r.on("data",n),r.on("error",s=>e.error(s)),r.on("end",()=>e.complete()),r.on("close",()=>e.complete()),()=>{r.removeListener("data",n),r.removeListener("error",e.error),r.removeListener("end",e.complete),r.removeListener("close",e.complete)}})}i(Oy,"fromStreamWithBackpressure");var zt={};A(zt,{CronJob:()=>Do,CronManager:()=>Ia,ExtendedDate:()=>Pa,HrtMeasurement:()=>_a,Interval:()=>Ra,TimeStamp:()=>Rr,Timer:()=>Na,getMilliSecondsAsHumanReadableAgoTime:()=>og,getMilliSecondsAsHumanReadableString:()=>rg,getMilliSecondsFromUnits:()=>Ca,units:()=>vt});var fo={};A(fo,{Cron:()=>Ju,CronDate:()=>Z,CronPattern:()=>Dn,scheduledJobs:()=>fr});function ao(r){return Date.UTC(r.y,r.m-1,r.d,r.h,r.i,r.s)}i(ao,"T");function ya(r,e){return r.y===e.y&&r.m===e.m&&r.d===e.d&&r.h===e.h&&r.i===e.i&&r.s===e.s}i(ya,"D");function Ey(r,e){let t=new Date(Date.parse(r));if(isNaN(t))throw new Error("Invalid ISO8601 passed to timezone parser.");let o=r.substring(9);return o.includes("Z")||o.includes("+")||o.includes("-")?xa(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),"Etc/UTC"):xa(t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),e)}i(Ey,"A");function Bu(r,e,t){return zu(Ey(r,e),t)}i(Bu,"v");function zu(r,e){let t=new Date(ao(r)),o=uo(t,r.tz),n=ao(r),s=ao(o),a=n-s,u=new Date(t.getTime()+a),c=uo(u,r.tz);if(ya(c,r)){let p=new Date(u.getTime()-36e5),m=uo(p,r.tz);return ya(m,r)?p:u}let f=new Date(u.getTime()+ao(r)-ao(c)),l=uo(f,r.tz);if(ya(l,r))return f;if(e)throw new Error("Invalid date passed to fromTZ()");return u.getTime()>f.getTime()?u:f}i(zu,"k");function uo(r,e){let t,o;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}),o=t.formatToParts(r)}catch(s){let a=s instanceof Error?s.message:String(s);throw new RangeError(`toTZ: Invalid timezone '${e}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${a}`)}let n={year:0,month:0,day:0,hour:0,minute:0,second:0};for(let s of o)(s.type==="year"||s.type==="month"||s.type==="day"||s.type==="hour"||s.type==="minute"||s.type==="second")&&(n[s.type]=parseInt(s.value,10));if(isNaN(n.year)||isNaN(n.month)||isNaN(n.day)||isNaN(n.hour)||isNaN(n.minute)||isNaN(n.second))throw new Error(`toTZ: Failed to parse all date components from timezone '${e}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(n)}`);return n.hour===24&&(n.hour=0),{y:n.year,m:n.month,d:n.day,h:n.hour,i:n.minute,s:n.second,tz:e}}i(uo,"g");function xa(r,e,t,o,n,s,a){return{y:r,m:e,d:t,h:o,i:n,s,tz:a}}i(xa,"b");var Vu=[1,2,4,8,16],Dn=class{static{i(this,"C")}pattern;timezone;mode;alternativeWeekdays;sloppyRanges;second;minute;hour;day;month;dayOfWeek;year;lastDayOfMonth;lastWeekday;nearestWeekdays;starDOM;starDOW;starYear;useAndLogic;constructor(r,e,t){this.pattern=r,this.timezone=e,this.mode=t?.mode??"auto",this.alternativeWeekdays=t?.alternativeWeekdays??!1,this.sloppyRanges=t?.sloppyRanges??!1,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.year=Array(1e4).fill(0),this.lastDayOfMonth=!1,this.lastWeekday=!1,this.nearestWeekdays=Array(31).fill(0),this.starDOM=!1,this.starDOW=!1,this.starYear=!1,this.useAndLogic=!1,this.parse()}parse(){if(!(typeof this.pattern=="string"||this.pattern instanceof String))throw new TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let r=this.pattern.match(/\S+/g)||[""],e=r.length;if(r.length<5||r.length>7)throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five, six, or seven space separated parts are required.");if(this.mode!=="auto"){let o;switch(this.mode){case"5-part":o=5;break;case"6-part":o=6;break;case"7-part":o=7;break;case"5-or-6-parts":o=[5,6];break;case"6-or-7-parts":o=[6,7];break;default:o=0}if(!(Array.isArray(o)?o.includes(e):e===o)){let n=Array.isArray(o)?o.join(" or "):o.toString();throw new TypeError(`CronPattern: mode '${this.mode}' requires exactly ${n} parts, but pattern '${this.pattern}' has ${e} parts.`)}}if(r.length===5&&r.unshift("0"),r.length===6&&r.push("*"),r[3].toUpperCase()==="LW"?(this.lastWeekday=!0,r[3]=""):r[3].toUpperCase().indexOf("L")>=0&&(r[3]=r[3].replace(/L/gi,""),this.lastDayOfMonth=!0),r[3]=="*"&&(this.starDOM=!0),r[6]=="*"&&(this.starYear=!0),r[4].length>=3&&(r[4]=this.replaceAlphaMonths(r[4])),r[5].length>=3&&(r[5]=this.alternativeWeekdays?this.replaceAlphaDaysQuartz(r[5]):this.replaceAlphaDays(r[5])),r[5].startsWith("+")&&(this.useAndLogic=!0,r[5]=r[5].substring(1),r[5]===""))throw new TypeError("CronPattern: Day-of-week field cannot be empty after '+' modifier.");switch(r[5]=="*"&&(this.starDOW=!0),this.pattern.indexOf("?")>=0&&(r[0]=r[0].replace(/\?/g,"*"),r[1]=r[1].replace(/\?/g,"*"),r[2]=r[2].replace(/\?/g,"*"),r[3]=r[3].replace(/\?/g,"*"),r[4]=r[4].replace(/\?/g,"*"),r[5]=r[5].replace(/\?/g,"*"),r[6]&&(r[6]=r[6].replace(/\?/g,"*"))),this.mode){case"5-part":r[0]="0",r[6]="*";break;case"6-part":r[6]="*";break;case"5-or-6-parts":r[6]="*";break;case"6-or-7-parts":break;case"7-part":case"auto":break}this.throwAtIllegalCharacters(r),this.partToArray("second",r[0],0,1),this.partToArray("minute",r[1],0,1),this.partToArray("hour",r[2],0,1),this.partToArray("day",r[3],-1,1),this.partToArray("month",r[4],-1,1);let t=this.alternativeWeekdays?-1:0;this.partToArray("dayOfWeek",r[5],t,63),this.partToArray("year",r[6],0,1),!this.alternativeWeekdays&&this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(r,e,t,o){let n=this[r],s=r==="day"&&this.lastDayOfMonth,a=r==="day"&&this.lastWeekday;if(e===""&&!s&&!a)throw new TypeError("CronPattern: configuration entry "+r+" ("+e+") is empty, check for trailing spaces.");if(e==="*")return n.fill(o);let u=e.split(",");if(u.length>1)for(let c=0;c<u.length;c++)this.partToArray(r,u[c],t,o);else e.indexOf("-")!==-1&&e.indexOf("/")!==-1?this.handleRangeWithStepping(e,r,t,o):e.indexOf("-")!==-1?this.handleRange(e,r,t,o):e.indexOf("/")!==-1?this.handleStepping(e,r,t,o):e!==""&&this.handleNumber(e,r,t,o)}throwAtIllegalCharacters(r){for(let e=0;e<r.length;e++)if((e===3?/[^/*0-9,\-WwLl]+/:e===5?/[^/*0-9,\-#Ll]+/:/[^/*0-9,\-]+/).test(r[e]))throw new TypeError("CronPattern: configuration entry "+e+" ("+r[e]+") contains illegal characters.")}handleNumber(r,e,t,o){let n=this.extractNth(r,e),s=r.toUpperCase().includes("W");if(e!=="day"&&s)throw new TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");s&&(e="nearestWeekdays");let a=parseInt(n[0],10)+t;if(isNaN(a))throw new TypeError("CronPattern: "+e+" is not a number: '"+r+"'");this.setPart(e,a,n[1]||o)}setPart(r,e,t){if(!Object.prototype.hasOwnProperty.call(this,r))throw new TypeError("CronPattern: Invalid part specified: "+r);if(r==="dayOfWeek"){if(e===7&&(e=0),e<0||e>6)throw new RangeError("CronPattern: Invalid value for dayOfWeek: "+e);this.setNthWeekdayOfMonth(e,t);return}if(r==="second"||r==="minute"){if(e<0||e>=60)throw new RangeError("CronPattern: Invalid value for "+r+": "+e)}else if(r==="hour"){if(e<0||e>=24)throw new RangeError("CronPattern: Invalid value for "+r+": "+e)}else if(r==="day"||r==="nearestWeekdays"){if(e<0||e>=31)throw new RangeError("CronPattern: Invalid value for "+r+": "+e)}else if(r==="month"){if(e<0||e>=12)throw new RangeError("CronPattern: Invalid value for "+r+": "+e)}else if(r==="year"&&(e<1||e>=1e4))throw new RangeError("CronPattern: Invalid value for "+r+": "+e+" (supported range: 1-9999)");this[r][e]=t}validateNotNaN(r,e){if(isNaN(r))throw new TypeError(e)}validateRange(r,e,t,o,n){if(r>e)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");if(t!==void 0){if(t===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(t>this[o].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[o].length+")")}}handleRangeWithStepping(r,e,t,o){if(r.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");let n=this.extractNth(r,e),s=n[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(s===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+r+"'");let[,a,u,c]=s,f=parseInt(a,10)+t,l=parseInt(u,10)+t,p=parseInt(c,10);this.validateNotNaN(f,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(l,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateNotNaN(p,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(f,l,p,e,r);for(let m=f;m<=l;m+=p)this.setPart(e,m,n[1]||o)}extractNth(r,e){let t=r,o;if(t.includes("#")){if(e!=="dayOfWeek")throw new Error("CronPattern: nth (#) only allowed in day-of-week field");o=t.split("#")[1],t=t.split("#")[0]}else if(t.toUpperCase().endsWith("L")){if(e!=="dayOfWeek")throw new Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");o="L",t=t.slice(0,-1)}return[t,o]}handleRange(r,e,t,o){if(r.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in a range.");let n=this.extractNth(r,e),s=n[0].split("-");if(s.length!==2)throw new TypeError("CronPattern: Syntax error, illegal range: '"+r+"'");let a=parseInt(s[0],10)+t,u=parseInt(s[1],10)+t;this.validateNotNaN(a,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(u,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateRange(a,u,void 0,e,r);for(let c=a;c<=u;c++)this.setPart(e,c,n[1]||o)}handleStepping(r,e,t,o){if(r.toUpperCase().includes("W"))throw new TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");let n=this.extractNth(r,e),s=n[0].split("/");if(s.length!==2)throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+r+"'");if(this.sloppyRanges)s[0]===""&&(s[0]="*");else{if(s[0]==="")throw new TypeError("CronPattern: Syntax error, stepping with missing prefix ('"+r+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");if(s[0]!=="*")throw new TypeError("CronPattern: Syntax error, stepping with numeric prefix ('"+r+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.")}let a=0;s[0]!=="*"&&(a=parseInt(s[0],10)+t);let u=parseInt(s[1],10);this.validateNotNaN(u,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(0,this[e].length-1,u,e,r);for(let c=a;c<this[e].length;c+=u)this.setPart(e,c,n[1]||o)}replaceAlphaDays(r){return r.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaDaysQuartz(r){return r.replace(/sun/gi,"1").replace(/mon/gi,"2").replace(/tue/gi,"3").replace(/wed/gi,"4").replace(/thu/gi,"5").replace(/fri/gi,"6").replace(/sat/gi,"7")}replaceAlphaMonths(r){return r.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames(r){let e=r.trim().toLowerCase();if(e==="@yearly"||e==="@annually")return"0 0 1 1 *";if(e==="@monthly")return"0 0 1 * *";if(e==="@weekly")return"0 0 * * 0";if(e==="@daily"||e==="@midnight")return"0 0 * * *";if(e==="@hourly")return"0 * * * *";if(e==="@reboot")throw new TypeError("CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.");return r}setNthWeekdayOfMonth(r,e){if(typeof e!="number"&&e.toUpperCase()==="L")this.dayOfWeek[r]=this.dayOfWeek[r]|32;else if(e===63)this.dayOfWeek[r]=63;else if(e<6&&e>0)this.dayOfWeek[r]=this.dayOfWeek[r]|Vu[e-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${e}, Type: ${typeof e}`)}},ga=[31,28,31,30,31,30,31,31,30,31,30,31],V=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],Z=class Gu{static{i(this,"s")}tz;ms;second;minute;hour;day;month;year;constructor(e,t){if(this.tz=t,e&&e instanceof Date)if(!isNaN(e))this.fromDate(e);else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");else if(e==null)this.fromDate(new Date);else if(e&&typeof e=="string")this.fromString(e);else if(e instanceof Gu)this.fromCronDate(e);else throw new TypeError("CronDate: Invalid type ("+typeof e+") passed to CronDate constructor")}getLastDayOfMonth(e,t){return t!==1?ga[t]:new Date(Date.UTC(e,t+1,0)).getUTCDate()}getLastWeekday(e,t){let o=this.getLastDayOfMonth(e,t),n=new Date(Date.UTC(e,t,o)).getUTCDay();return n===0?o-2:n===6?o-1:o}getNearestWeekday(e,t,o){let n=this.getLastDayOfMonth(e,t);if(o>n)return-1;let s=new Date(Date.UTC(e,t,o)).getUTCDay();return s===0?o===n?o-2:o+1:s===6?o===1?o+2:o-1:o}isNthWeekdayOfMonth(e,t,o,n){let s=new Date(Date.UTC(e,t,o)).getUTCDay(),a=0;for(let u=1;u<=o;u++)new Date(Date.UTC(e,t,u)).getUTCDay()===s&&a++;if(n&63&&Vu[a-1]&n)return!0;if(n&32){let u=this.getLastDayOfMonth(e,t);for(let c=o+1;c<=u;c++)if(new Date(Date.UTC(e,t,c)).getUTCDay()===s)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz=="number")this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else try{let t=uo(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}catch(t){let o=t instanceof Error?t.message:String(t);throw new TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${o}`)}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.month<0||this.day>ga[this.month]||this.day<1||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz=="number"){let t=Bu(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(Bu(e,this.tz))}findNext(e,t,o,n){return this._findMatch(e,t,o,n,1)}_findMatch(e,t,o,n,s){let a=this[t],u;o.lastDayOfMonth&&(u=this.getLastDayOfMonth(this.year,this.month));let c=!o.starDOW&&t=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0,f=this[t]+n,l=s===1?p=>p<o[t].length:p=>p>=0;for(let p=f;l(p);p+=s){let m=o[t][p];if(t==="day"&&!m){for(let h=0;h<o.nearestWeekdays.length;h++)if(o.nearestWeekdays[h]){let x=this.getNearestWeekday(this.year,this.month,h-n);if(x===-1)continue;if(x===p-n){m=1;break}}}if(t==="day"&&o.lastWeekday){let h=this.getLastWeekday(this.year,this.month);p-n===h&&(m=1)}if(t==="day"&&o.lastDayOfMonth&&p-n==u&&(m=1),t==="day"&&!o.starDOW){let h=o.dayOfWeek[(c+(p-n-1))%7];if(h&&h&63)h=this.isNthWeekdayOfMonth(this.year,this.month,p-n,h)?1:0;else if(h)throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${h}`);o.useAndLogic?m=m&&h:!e.domAndDow&&!o.starDOM?m=m||h:m=m&&h}if(m)return this[t]=p-n,a!==this[t]?2:1}return 3}recurse(e,t,o){if(o===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let s=-1;for(let a=this.year+1;a<e.year.length&&a<1e4;a++)if(e.year[a]===1){s=a;break}if(s===-1)return null;this.year=s,this.month=0,this.day=1,this.hour=0,this.minute=0,this.second=0,this.ms=0}if(this.year>=1e4)return null}let n=this.findNext(t,V[o][0],e,V[o][2]);if(n>1){let s=o+1;for(;s<V.length;)this[V[s][0]]=-V[s][2],s++;if(n===3){if(this[V[o][1]]++,this[V[o][0]]=-V[o][2],this.apply(),o===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0&&this.year<1e4;)this.year++;if(this.year>=1e4||this.year>=e.year.length)return null}return this.recurse(e,t,0)}else if(this.apply())return this.recurse(e,t,o-1)}return o+=1,o>=V.length?this:(e.starYear?this.year>=3e3:this.year>=1e4)?null:this.recurse(e,t,o)}increment(e,t,o){return this.second+=t.interval!==void 0&&t.interval>1&&o?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}decrement(e,t){return this.second-=t.interval!==void 0&&t.interval>1?t.interval:1,this.ms=0,this.apply(),this.recurseBackward(e,t,0,0)}recurseBackward(e,t,o,n=0){if(n>1e4)return null;if(o===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let a=-1;for(let u=this.year-1;u>=0;u--)if(e.year[u]===1){a=u;break}if(a===-1)return null;this.year=a,this.month=11,this.day=31,this.hour=23,this.minute=59,this.second=59,this.ms=0}if(this.year<0)return null}let s=this.findPrevious(t,V[o][0],e,V[o][2]);if(s>1){let a=o+1;for(;a<V.length;){let u=V[a][0],c=V[a][2],f=this.getMaxPatternValue(u,e,c);this[u]=f,a++}if(s===3){if(this[V[o][1]]--,o===0){let l=this.getLastDayOfMonth(this.year,this.month);this.day>l&&(this.day=l)}if(o===1)if(this.day<=0)this.day=1;else{let l=this.year,p=this.month;for(;p<0;)p+=12,l--;for(;p>11;)p-=12,l++;let m=p!==1?ga[p]:new Date(Date.UTC(l,p+1,0)).getUTCDate();this.day>m&&(this.day=m)}this.apply();let u=V[o][0],c=V[o][2],f=this.getMaxPatternValue(u,e,c);if(u==="day"){let l=this.getLastDayOfMonth(this.year,this.month);this[u]=Math.min(f,l)}else this[u]=f;if(this.apply(),o===0){let l=V[1][2],p=this.getMaxPatternValue("day",e,l),m=this.getLastDayOfMonth(this.year,this.month),h=Math.min(p,m);h!==this.day&&(this.day=h,this.hour=this.getMaxPatternValue("hour",e,V[2][2]),this.minute=this.getMaxPatternValue("minute",e,V[3][2]),this.second=this.getMaxPatternValue("second",e,V[4][2]))}if(o===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0;)this.year--;if(this.year<0)return null}return this.recurseBackward(e,t,0,n+1)}else if(this.apply())return this.recurseBackward(e,t,o-1,n+1)}return o+=1,o>=V.length?this:this.year<0?null:this.recurseBackward(e,t,o,n+1)}getMaxPatternValue(e,t,o){if(e==="day"&&t.lastDayOfMonth)return this.getLastDayOfMonth(this.year,this.month);if(e==="day"&&!t.starDOW)return this.getLastDayOfMonth(this.year,this.month);for(let n=t[e].length-1;n>=0;n--)if(t[e][n])return n-o;return t[e].length-1-o}findPrevious(e,t,o,n){return this._findMatch(e,t,o,n,-1)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz=="number"?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):zu(xa(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}match(e,t){if(!e.starYear&&(this.year<0||this.year>=e.year.length||e.year[this.year]===0))return!1;for(let o=0;o<V.length;o++){let n=V[o][0],s=V[o][2],a=this[n];if(a+s<0||a+s>=e[n].length)return!1;let u=e[n][a+s];if(n==="day"){if(!u){for(let c=0;c<e.nearestWeekdays.length;c++)if(e.nearestWeekdays[c]){let f=this.getNearestWeekday(this.year,this.month,c-s);if(f!==-1&&f===a){u=1;break}}}if(e.lastWeekday){let c=this.getLastWeekday(this.year,this.month);a===c&&(u=1)}if(e.lastDayOfMonth){let c=this.getLastDayOfMonth(this.year,this.month);a===c&&(u=1)}if(!e.starDOW){let c=new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay(),f=e.dayOfWeek[(c+(a-1))%7];f&&f&63&&(f=this.isNthWeekdayOfMonth(this.year,this.month,a,f)?1:0),e.useAndLogic?u=u&&f:!t.domAndDow&&!e.starDOM?u=u||f:u=u&&f}}if(!u)return!1}return!0}};function ky(r){if(r===void 0&&(r={}),delete r.name,r.legacyMode!==void 0&&r.domAndDow===void 0?r.domAndDow=!r.legacyMode:r.domAndDow===void 0&&(r.domAndDow=!1),r.legacyMode=!r.domAndDow,r.paused=r.paused===void 0?!1:r.paused,r.maxRuns=r.maxRuns===void 0?1/0:r.maxRuns,r.catch=r.catch===void 0?!1:r.catch,r.interval=r.interval===void 0?0:parseInt(r.interval.toString(),10),r.utcOffset=r.utcOffset===void 0?void 0:parseInt(r.utcOffset.toString(),10),r.dayOffset=r.dayOffset===void 0?0:parseInt(r.dayOffset.toString(),10),r.unref=r.unref===void 0?!1:r.unref,r.mode=r.mode===void 0?"auto":r.mode,r.alternativeWeekdays=r.alternativeWeekdays===void 0?!1:r.alternativeWeekdays,r.sloppyRanges=r.sloppyRanges===void 0?!1:r.sloppyRanges,!["auto","5-part","6-part","7-part","5-or-6-parts","6-or-7-parts"].includes(r.mode))throw new Error("CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.");if(r.startAt&&(r.startAt=new Z(r.startAt,r.timezone)),r.stopAt&&(r.stopAt=new Z(r.stopAt,r.timezone)),r.interval!==null){if(isNaN(r.interval))throw new Error("CronOptions: Supplied value for interval is not a number");if(r.interval<0)throw new Error("CronOptions: Supplied value for interval can not be negative")}if(r.utcOffset!==void 0){if(isNaN(r.utcOffset))throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if(r.utcOffset<-870||r.utcOffset>870)throw new Error("CronOptions: utcOffset out of bounds.");if(r.utcOffset!==void 0&&r.timezone)throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if(r.unref!==!0&&r.unref!==!1)throw new Error("CronOptions: Unref should be either true, false or undefined(false).");if(r.dayOffset!==void 0&&r.dayOffset!==0&&isNaN(r.dayOffset))throw new Error("CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.");return r}i(ky,"R");function co(r){return Object.prototype.toString.call(r)==="[object Function]"||typeof r=="function"||r instanceof Function}i(co,"p");function Iy(r){return co(r)}i(Iy,"_");function Cy(r){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(r):r&&typeof r.unref<"u"&&r.unref()}i(Cy,"x");var Au=30*1e3,fr=[],Ju=class{static{i(this,"E")}name;options;_states;fn;getTz(){return this.options.timezone||this.options.utcOffset}applyDayOffset(r){if(this.options.dayOffset!==void 0&&this.options.dayOffset!==0){let e=this.options.dayOffset*24*60*60*1e3;return new Date(r.getTime()+e)}return r}constructor(r,e,t){let o,n;if(co(e))n=e;else if(typeof e=="object")o=e;else if(e!==void 0)throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(co(t))n=t;else if(typeof t=="object")o=t;else if(t!==void 0)throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=o?.name,this.options=ky(o),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:o?o.maxRuns:void 0,paused:o?o.paused:!1,pattern:new Dn("* * * * *",void 0,{mode:"auto"})},r&&(r instanceof Date||typeof r=="string"&&r.indexOf(":")>0)?this._states.once=new Z(r,this.getTz()):this._states.pattern=new Dn(r,this.options.timezone,{mode:this.options.mode,alternativeWeekdays:this.options.alternativeWeekdays,sloppyRanges:this.options.sloppyRanges}),this.name){if(fr.find(s=>s.name===this.name))throw new Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");fr.push(this)}return n!==void 0&&Iy(n)&&(this.fn=n,this.schedule()),this}nextRun(r){let e=this._next(r);return e?this.applyDayOffset(e.getDate(!1)):null}nextRuns(r,e){this._states.maxRuns!==void 0&&r>this._states.maxRuns&&(r=this._states.maxRuns);let t=e||this._states.currentRun||void 0;return this._enumerateRuns(r,t,"next")}previousRuns(r,e){return this._enumerateRuns(r,e||void 0,"previous")}_enumerateRuns(r,e,t){let o=[],n=e?new Z(e,this.getTz()):null,s=t==="next"?this._next:this._previous;for(;r--;){let a=s.call(this,n);if(!a)break;let u=a.getDate(!1);o.push(this.applyDayOffset(u)),n=a}return o}match(r){if(this._states.once){let t=new Z(r,this.getTz());t.ms=0;let o=new Z(this._states.once,this.getTz());return o.ms=0,t.getTime()===o.getTime()}let e=new Z(r,this.getTz());return e.ms=0,e.match(this._states.pattern,this.options)}getPattern(){if(!this._states.once)return this._states.pattern?this._states.pattern.pattern:void 0}getOnce(){return this._states.once?this._states.once.getDate():null}isRunning(){let r=this.nextRun(this._states.currentRun),e=!this._states.paused,t=this.fn!==void 0,o=!this._states.kill;return e&&t&&o&&r!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(r){let e=this._next(r);return e?r instanceof Z||r instanceof Date?e.getTime()-r.getTime():e.getTime()-new Z(r).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let r=fr.indexOf(this);r>=0&&fr.splice(r,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(r){if(r&&this.fn)throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");r&&(this.fn=r);let e=this.msToNext(),t=this.nextRun(this._states.currentRun);return e==null||isNaN(e)||t===null?this:(e>Au&&(e=Au),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(t),e),this._states.currentTimeout&&this.options.unref&&Cy(this._states.currentTimeout),this)}async _trigger(r){this._states.blocking=!0,this._states.currentRun=new Z(void 0,this.getTz());try{if(this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){if(co(this.options.catch))try{this.options.catch(e,this)}catch{}}else this.fn!==void 0&&await this.fn(this,this.options.context)}finally{this._states.previousRun=new Z(r,this.getTz()),this._states.blocking=!1}}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(r){let e=new Date,t=!this._states.paused&&e.getTime()>=r.getTime(),o=this._states.blocking&&this.options.protect;t&&!o?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):t&&o&&co(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(r){let e=!!(r||this._states.currentRun),t=!1;!r&&this.options.startAt&&this.options.interval&&([r,e]=this._calculatePreviousRun(r,e),t=!r),r=new Z(r,this.getTz()),this.options.startAt&&r&&r.getTime()<this.options.startAt.getTime()&&(r=this.options.startAt);let o=this._states.once||new Z(r,this.getTz());return!t&&o!==this._states.once&&(o=o.increment(this._states.pattern,this.options,e)),this._states.once&&this._states.once.getTime()<=r.getTime()||o===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&o.getTime()>=this.options.stopAt.getTime()?null:o}_previous(r){let e=new Z(r,this.getTz());this.options.stopAt&&e.getTime()>this.options.stopAt.getTime()&&(e=this.options.stopAt);let t=new Z(e,this.getTz());return this._states.once?this._states.once.getTime()<e.getTime()?this._states.once:null:(t=t.decrement(this._states.pattern,this.options),t===null||this.options.startAt&&t.getTime()<this.options.startAt.getTime()?null:t)}_calculatePreviousRun(r,e){let t=new Z(void 0,this.getTz()),o=r;if(this.options.startAt.getTime()<=t.getTime()){o=this.options.startAt;let n=o.getTime()+this.options.interval*1e3;for(;n<=t.getTime();)o=new Z(o,this.getTz()).increment(this._states.pattern,this.options,!0),n=o.getTime()+this.options.interval*1e3;e=!0}return o===null&&(o=void 0),[o,e]}};var vo={};A(vo,{add:()=>ft,addBusinessDays:()=>Rn,addDays:()=>ee,addHours:()=>Nn,addISOWeekYears:()=>Fn,addMilliseconds:()=>lt,addMinutes:()=>mr,addMonths:()=>$e,addQuarters:()=>hr,addSeconds:()=>Ln,addWeeks:()=>dt,addYears:()=>Yn,areIntervalsOverlapping:()=>ec,clamp:()=>tc,closestIndexTo:()=>Hn,closestTo:()=>rc,compareAsc:()=>pe,compareDesc:()=>oc,constructFrom:()=>y,constructNow:()=>R,daysToWeeks:()=>nc,differenceInBusinessDays:()=>ic,differenceInCalendarDays:()=>ne,differenceInCalendarISOWeekYears:()=>$n,differenceInCalendarISOWeeks:()=>sc,differenceInCalendarMonths:()=>Yt,differenceInCalendarQuarters:()=>yr,differenceInCalendarWeeks:()=>qt,differenceInCalendarYears:()=>pt,differenceInDays:()=>xr,differenceInHours:()=>jt,differenceInISOWeekYears:()=>uc,differenceInMilliseconds:()=>gr,differenceInMinutes:()=>Ht,differenceInMonths:()=>mt,differenceInQuarters:()=>cc,differenceInSeconds:()=>Ae,differenceInWeeks:()=>fc,differenceInYears:()=>Vn,eachDayOfInterval:()=>An,eachHourOfInterval:()=>lc,eachMinuteOfInterval:()=>dc,eachMonthOfInterval:()=>pc,eachQuarterOfInterval:()=>mc,eachWeekOfInterval:()=>hc,eachWeekendOfInterval:()=>vr,eachWeekendOfMonth:()=>yc,eachWeekendOfYear:()=>xc,eachYearOfInterval:()=>gc,endOfDay:()=>wr,endOfDecade:()=>wc,endOfHour:()=>bc,endOfISOWeek:()=>vc,endOfISOWeekYear:()=>Tc,endOfMinute:()=>Dc,endOfMonth:()=>br,endOfQuarter:()=>Sc,endOfSecond:()=>Mc,endOfToday:()=>Oc,endOfTomorrow:()=>Ec,endOfWeek:()=>Jn,endOfYear:()=>Gn,endOfYesterday:()=>kc,format:()=>yo,formatDate:()=>yo,formatDistance:()=>ei,formatDistanceStrict:()=>ti,formatDistanceToNow:()=>qc,formatDistanceToNowStrict:()=>jc,formatDuration:()=>Hc,formatISO:()=>Uc,formatISO9075:()=>$c,formatISODuration:()=>Bc,formatRFC3339:()=>zc,formatRFC7231:()=>Vc,formatRelative:()=>Ac,formatters:()=>mo,fromUnixTime:()=>Gc,getDate:()=>ri,getDay:()=>gt,getDayOfYear:()=>Qn,getDaysInMonth:()=>oi,getDaysInYear:()=>Jc,getDecade:()=>Kc,getDefaultOptions:()=>ii,getHours:()=>Qc,getISODay:()=>si,getISOWeek:()=>Mr,getISOWeekYear:()=>be,getISOWeeksInYear:()=>Xc,getMilliseconds:()=>Zc,getMinutes:()=>ef,getMonth:()=>tf,getOverlappingDaysInIntervals:()=>rf,getQuarter:()=>po,getSeconds:()=>of,getTime:()=>nf,getUnixTime:()=>sf,getWeek:()=>Or,getWeekOfMonth:()=>af,getWeekYear:()=>yt,getWeeksInMonth:()=>uf,getYear:()=>cf,hoursToMilliseconds:()=>ff,hoursToMinutes:()=>lf,hoursToSeconds:()=>df,interval:()=>pf,intervalToDuration:()=>mf,intlFormat:()=>hf,intlFormatDistance:()=>yf,isAfter:()=>xf,isBefore:()=>gf,isDate:()=>Un,isEqual:()=>wf,isExists:()=>bf,isFirstDayOfMonth:()=>vf,isFriday:()=>Tf,isFuture:()=>Df,isLastDayOfMonth:()=>zn,isLeapYear:()=>ni,isMatch:()=>Sf,isMonday:()=>Mf,isPast:()=>Of,isSameDay:()=>Ve,isSameHour:()=>Qi,isSameISOWeek:()=>Xi,isSameISOWeekYear:()=>Ef,isSameMinute:()=>Zi,isSameMonth:()=>es,isSameQuarter:()=>ts,isSameSecond:()=>rs,isSameWeek:()=>Cr,isSameYear:()=>os,isSaturday:()=>Pn,isSunday:()=>_n,isThisHour:()=>kf,isThisISOWeek:()=>If,isThisMinute:()=>Cf,isThisMonth:()=>Pf,isThisQuarter:()=>_f,isThisSecond:()=>Rf,isThisWeek:()=>Nf,isThisYear:()=>Wf,isThursday:()=>Ff,isToday:()=>Lf,isTomorrow:()=>Yf,isTuesday:()=>qf,isValid:()=>ce,isWednesday:()=>jf,isWeekend:()=>Be,isWithinInterval:()=>Hf,isYesterday:()=>Uf,lastDayOfDecade:()=>$f,lastDayOfISOWeek:()=>Bf,lastDayOfISOWeekYear:()=>zf,lastDayOfMonth:()=>ai,lastDayOfQuarter:()=>Vf,lastDayOfWeek:()=>ns,lastDayOfYear:()=>Af,lightFormat:()=>Gf,lightFormatters:()=>Ee,longFormatters:()=>xt,max:()=>qn,milliseconds:()=>Jf,millisecondsToHours:()=>Kf,millisecondsToMinutes:()=>Qf,millisecondsToSeconds:()=>Xf,min:()=>jn,minutesToHours:()=>Zf,minutesToMilliseconds:()=>el,minutesToSeconds:()=>tl,monthsToQuarters:()=>rl,monthsToYears:()=>ol,nextDay:()=>he,nextFriday:()=>nl,nextMonday:()=>il,nextSaturday:()=>sl,nextSunday:()=>al,nextThursday:()=>ul,nextTuesday:()=>cl,nextWednesday:()=>fl,parse:()=>Ki,parseISO:()=>dl,parseJSON:()=>pl,parsers:()=>Ji,previousDay:()=>ye,previousFriday:()=>ml,previousMonday:()=>hl,previousSaturday:()=>yl,previousSunday:()=>xl,previousThursday:()=>gl,previousTuesday:()=>wl,previousWednesday:()=>bl,quartersToMonths:()=>vl,quartersToYears:()=>Tl,roundToNearestHours:()=>Dl,roundToNearestMinutes:()=>Sl,secondsToHours:()=>Ml,secondsToMilliseconds:()=>Ol,secondsToMinutes:()=>El,set:()=>kl,setDate:()=>Il,setDay:()=>wt,setDayOfYear:()=>Cl,setDefaultOptions:()=>Pl,setHours:()=>_l,setISODay:()=>Ri,setISOWeek:()=>Oi,setISOWeekYear:()=>Wn,setMilliseconds:()=>Rl,setMinutes:()=>Nl,setMonth:()=>Pr,setQuarter:()=>Wl,setSeconds:()=>Fl,setWeek:()=>Si,setWeekYear:()=>Ll,setYear:()=>Yl,startOfDay:()=>ze,startOfDecade:()=>ql,startOfHour:()=>xo,startOfISOWeek:()=>X,startOfISOWeekYear:()=>Oe,startOfMinute:()=>go,startOfMonth:()=>ht,startOfQuarter:()=>Ge,startOfSecond:()=>wo,startOfToday:()=>jl,startOfTomorrow:()=>Hl,startOfWeek:()=>U,startOfWeekYear:()=>Ut,startOfYear:()=>Tr,startOfYesterday:()=>Ul,sub:()=>$l,subBusinessDays:()=>Bl,subDays:()=>bt,subHours:()=>zl,subISOWeekYears:()=>Bn,subMilliseconds:()=>Vl,subMinutes:()=>Al,subMonths:()=>ss,subQuarters:()=>Gl,subSeconds:()=>Jl,subWeeks:()=>Kl,subYears:()=>Ql,toDate:()=>d,transpose:()=>ui,weeksToDays:()=>Xl,yearsToDays:()=>Zl,yearsToMonths:()=>ed,yearsToQuarters:()=>td});var Mn=7,lo=365.2425,Py=Math.pow(10,8)*24*60*60*1e3,fP=-Py,Ue=6048e5,On=864e5,de=6e4,Me=36e5,lr=1e3,wa=525600,ct=43200,dr=1440,En=60,kn=3,In=12,Cn=4,Lt=3600,pr=60,Sn=Lt*24,Ku=Sn*7,ba=Sn*365.2425,va=ba/12,Qu=va*3,Ta=Symbol.for("constructDateFrom");function y(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&Ta in r?r[Ta](e):r instanceof Date?new r.constructor(e):new Date(e)}i(y,"constructFrom");var pP=y;function d(r,e){return y(e||r,r)}i(d,"toDate");var xP=d;function ee(r,e,t){let o=d(r,t?.in);return isNaN(e)?y(t?.in||r,NaN):(e&&o.setDate(o.getDate()+e),o)}i(ee,"addDays");var TP=ee;function $e(r,e,t){let o=d(r,t?.in);if(isNaN(e))return y(t?.in||r,NaN);if(!e)return o;let n=o.getDate(),s=y(t?.in||r,o.getTime());s.setMonth(o.getMonth()+e+1,0);let a=s.getDate();return n>=a?s:(o.setFullYear(s.getFullYear(),s.getMonth(),n),o)}i($e,"addMonths");var EP=$e;function ft(r,e,t){let{years:o=0,months:n=0,weeks:s=0,days:a=0,hours:u=0,minutes:c=0,seconds:f=0}=e,l=d(r,t?.in),p=n||o?$e(l,n+o*12):l,m=a||s?ee(p,a+s*7):p,h=c+u*60,g=(f+h*60)*1e3;return y(t?.in||r,+m+g)}i(ft,"add");var NP=ft;function Pn(r,e){return d(r,e?.in).getDay()===6}i(Pn,"isSaturday");var YP=Pn;function _n(r,e){return d(r,e?.in).getDay()===0}i(_n,"isSunday");var UP=_n;function Be(r,e){let t=d(r,e?.in).getDay();return t===0||t===6}i(Be,"isWeekend");var VP=Be;function Rn(r,e,t){let o=d(r,t?.in),n=Be(o,t);if(isNaN(e))return y(t?.in,NaN);let s=o.getHours(),a=e<0?-1:1,u=Math.trunc(e/5);o.setDate(o.getDate()+u*7);let c=Math.abs(e%5);for(;c>0;)o.setDate(o.getDate()+a),Be(o,t)||(c-=1);return n&&Be(o,t)&&e!==0&&(Pn(o,t)&&o.setDate(o.getDate()+(a<0?2:-1)),_n(o,t)&&o.setDate(o.getDate()+(a<0?1:-2))),o.setHours(s),o}i(Rn,"addBusinessDays");var e_=Rn;function lt(r,e,t){return y(t?.in||r,+d(r)+e)}i(lt,"addMilliseconds");var i_=lt;function Nn(r,e,t){return lt(r,e*Me,t)}i(Nn,"addHours");var f_=Nn;var Xu={};function L(){return Xu}i(L,"getDefaultOptions");function Zu(r){Xu=r}i(Zu,"setDefaultOptions");function U(r,e){let t=L(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=d(r,e?.in),s=n.getDay(),a=(s<o?7:0)+s-o;return n.setDate(n.getDate()-a),n.setHours(0,0,0,0),n}i(U,"startOfWeek");var x_=U;function X(r,e){return U(r,{...e,weekStartsOn:1})}i(X,"startOfISOWeek");var v_=X;function be(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=y(t,0);n.setFullYear(o+1,0,4),n.setHours(0,0,0,0);let s=X(n),a=y(t,0);a.setFullYear(o,0,4),a.setHours(0,0,0,0);let u=X(a);return t.getTime()>=s.getTime()?o+1:t.getTime()>=u.getTime()?o:o-1}i(be,"getISOWeekYear");var E_=be;function J(r){let e=d(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}i(J,"getTimezoneOffsetInMilliseconds");function O(r,...e){let t=y.bind(null,r||e.find(o=>typeof o=="object"));return e.map(t)}i(O,"normalizeDates");function ze(r,e){let t=d(r,e?.in);return t.setHours(0,0,0,0),t}i(ze,"startOfDay");var L_=ze;function ne(r,e,t){let[o,n]=O(t?.in,r,e),s=ze(o),a=ze(n),u=+s-J(s),c=+a-J(a);return Math.round((u-c)/On)}i(ne,"differenceInCalendarDays");var B_=ne;function Oe(r,e){let t=be(r,e),o=y(e?.in||r,0);return o.setFullYear(t,0,4),o.setHours(0,0,0,0),X(o)}i(Oe,"startOfISOWeekYear");var K_=Oe;function Wn(r,e,t){let o=d(r,t?.in),n=ne(o,Oe(o,t)),s=y(t?.in||r,0);return s.setFullYear(e,0,4),s.setHours(0,0,0,0),o=Oe(s),o.setDate(o.getDate()+n),o}i(Wn,"setISOWeekYear");var oR=Wn;function Fn(r,e,t){return Wn(r,be(r,t)+e,t)}i(Fn,"addISOWeekYears");var uR=Fn;function mr(r,e,t){let o=d(r,t?.in);return o.setTime(o.getTime()+e*de),o}i(mr,"addMinutes");var pR=mr;function hr(r,e,t){return $e(r,e*3,t)}i(hr,"addQuarters");var xR=hr;function Ln(r,e,t){return lt(r,e*1e3,t)}i(Ln,"addSeconds");var vR=Ln;function dt(r,e,t){return ee(r,e*7,t)}i(dt,"addWeeks");var MR=dt;function Yn(r,e,t){return $e(r,e*12,t)}i(Yn,"addYears");var IR=Yn;function ec(r,e,t){let[o,n]=[+d(r.start,t?.in),+d(r.end,t?.in)].sort((u,c)=>u-c),[s,a]=[+d(e.start,t?.in),+d(e.end,t?.in)].sort((u,c)=>u-c);return t?.inclusive?o<=a&&s<=n:o<a&&s<n}i(ec,"areIntervalsOverlapping");var RR=ec;function qn(r,e){let t,o=e?.in;return r.forEach(n=>{!o&&typeof n=="object"&&(o=y.bind(null,n));let s=d(n,o);(!t||t<s||isNaN(+s))&&(t=s)}),y(o,t||NaN)}i(qn,"max");var YR=qn;function jn(r,e){let t,o=e?.in;return r.forEach(n=>{!o&&typeof n=="object"&&(o=y.bind(null,n));let s=d(n,o);(!t||t>s||isNaN(+s))&&(t=s)}),y(o,t||NaN)}i(jn,"min");var $R=jn;function tc(r,e,t){let[o,n,s]=O(t?.in,r,e.start,e.end);return jn([qn([o,n],t),s],t)}i(tc,"clamp");var JR=tc;function Hn(r,e){let t=+d(r);if(isNaN(t))return NaN;let o,n;return e.forEach((s,a)=>{let u=d(s);if(isNaN(+u)){o=NaN,n=NaN;return}let c=Math.abs(t-+u);(o==null||c<n)&&(o=a,n=c)}),o}i(Hn,"closestIndexTo");var ZR=Hn;function rc(r,e,t){let[o,...n]=O(t?.in,r,...e),s=Hn(o,n);if(typeof s=="number"&&isNaN(s))return y(o,NaN);if(s!==void 0)return n[s]}i(rc,"closestTo");var iN=rc;function pe(r,e){let t=+d(r)-+d(e);return t<0?-1:t>0?1:t}i(pe,"compareAsc");var cN=pe;function oc(r,e){let t=+d(r)-+d(e);return t>0?-1:t<0?1:t}i(oc,"compareDesc");var pN=oc;function R(r){return y(r,Date.now())}i(R,"constructNow");var xN=R;function nc(r){let e=Math.trunc(r/7);return e===0?0:e}i(nc,"daysToWeeks");var vN=nc;function Ve(r,e,t){let[o,n]=O(t?.in,r,e);return+ze(o)==+ze(n)}i(Ve,"isSameDay");var ON=Ve;function Un(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}i(Un,"isDate");var IN=Un;function ce(r){return!(!Un(r)&&typeof r!="number"||isNaN(+d(r)))}i(ce,"isValid");var NN=ce;function ic(r,e,t){let[o,n]=O(t?.in,r,e);if(!ce(o)||!ce(n))return NaN;let s=ne(o,n),a=s<0?-1:1,u=Math.trunc(s/7),c=u*5,f=ee(n,u*7);for(;!Ve(o,f);)c+=Be(f,t)?0:a,f=ee(f,a);return c===0?0:c}i(ic,"differenceInBusinessDays");var $N=ic;function $n(r,e,t){let[o,n]=O(t?.in,r,e);return be(o,t)-be(n,t)}i($n,"differenceInCalendarISOWeekYears");var GN=$n;function sc(r,e,t){let[o,n]=O(t?.in,r,e),s=X(o),a=X(n),u=+s-J(s),c=+a-J(a);return Math.round((u-c)/Ue)}i(sc,"differenceInCalendarISOWeeks");var tW=sc;function Yt(r,e,t){let[o,n]=O(t?.in,r,e),s=o.getFullYear()-n.getFullYear(),a=o.getMonth()-n.getMonth();return s*12+a}i(Yt,"differenceInCalendarMonths");var iW=Yt;function po(r,e){let t=d(r,e?.in);return Math.trunc(t.getMonth()/3)+1}i(po,"getQuarter");var cW=po;function yr(r,e,t){let[o,n]=O(t?.in,r,e),s=o.getFullYear()-n.getFullYear(),a=po(o)-po(n);return s*4+a}i(yr,"differenceInCalendarQuarters");var mW=yr;function qt(r,e,t){let[o,n]=O(t?.in,r,e),s=U(o,t),a=U(n,t),u=+s-J(s),c=+a-J(a);return Math.round((u-c)/Ue)}i(qt,"differenceInCalendarWeeks");var vW=qt;function pt(r,e,t){let[o,n]=O(t?.in,r,e);return o.getFullYear()-n.getFullYear()}i(pt,"differenceInCalendarYears");var MW=pt;function xr(r,e,t){let[o,n]=O(t?.in,r,e),s=ac(o,n),a=Math.abs(ne(o,n));o.setDate(o.getDate()-s*a);let u=+(ac(o,n)===-s),c=s*(a-u);return c===0?0:c}i(xr,"differenceInDays");function ac(r,e){let t=r.getFullYear()-e.getFullYear()||r.getMonth()-e.getMonth()||r.getDate()-e.getDate()||r.getHours()-e.getHours()||r.getMinutes()-e.getMinutes()||r.getSeconds()-e.getSeconds()||r.getMilliseconds()-e.getMilliseconds();return t<0?-1:t>0?1:t}i(ac,"compareLocalAsc");var CW=xr;function me(r){return e=>{let o=(r?Math[r]:Math.trunc)(e);return o===0?0:o}}i(me,"getRoundingMethod");function jt(r,e,t){let[o,n]=O(t?.in,r,e),s=(+o-+n)/Me;return me(t?.roundingMethod)(s)}i(jt,"differenceInHours");var YW=jt;function Bn(r,e,t){return Fn(r,-e,t)}i(Bn,"subISOWeekYears");var UW=Bn;function uc(r,e,t){let[o,n]=O(t?.in,r,e),s=pe(o,n),a=Math.abs($n(o,n,t)),u=Bn(o,s*a,t),c=+(pe(u,n)===-s),f=s*(a-c);return f===0?0:f}i(uc,"differenceInISOWeekYears");var JW=uc;function gr(r,e){return+d(r)-+d(e)}i(gr,"differenceInMilliseconds");var ZW=gr;function Ht(r,e,t){let o=gr(r,e)/de;return me(t?.roundingMethod)(o)}i(Ht,"differenceInMinutes");var iF=Ht;function wr(r,e){let t=d(r,e?.in);return t.setHours(23,59,59,999),t}i(wr,"endOfDay");var cF=wr;function br(r,e){let t=d(r,e?.in),o=t.getMonth();return t.setFullYear(t.getFullYear(),o+1,0),t.setHours(23,59,59,999),t}i(br,"endOfMonth");var pF=br;function zn(r,e){let t=d(r,e?.in);return+wr(t,e)==+br(t,e)}i(zn,"isLastDayOfMonth");var wF=zn;function mt(r,e,t){let[o,n,s]=O(t?.in,r,r,e),a=pe(n,s),u=Math.abs(Yt(n,s));if(u<1)return 0;n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*u);let c=pe(n,s)===-a;zn(o)&&u===1&&pe(o,s)===1&&(c=!1);let f=a*(u-+c);return f===0?0:f}i(mt,"differenceInMonths");var OF=mt;function cc(r,e,t){let o=mt(r,e,t)/3;return me(t?.roundingMethod)(o)}i(cc,"differenceInQuarters");var PF=cc;function Ae(r,e,t){let o=gr(r,e)/1e3;return me(t?.roundingMethod)(o)}i(Ae,"differenceInSeconds");var FF=Ae;function fc(r,e,t){let o=xr(r,e,t)/7;return me(t?.roundingMethod)(o)}i(fc,"differenceInWeeks");var HF=fc;function Vn(r,e,t){let[o,n]=O(t?.in,r,e),s=pe(o,n),a=Math.abs(pt(o,n));o.setFullYear(1584),n.setFullYear(1584);let u=pe(o,n)===-s,c=s*(a-+u);return c===0?0:c}i(Vn,"differenceInYears");var AF=Vn;function ie(r,e){let[t,o]=O(r,e.start,e.end);return{start:t,end:o}}i(ie,"normalizeInterval");function An(r,e){let{start:t,end:o}=ie(e?.in,r),n=+t>+o,s=n?+t:+o,a=n?o:t;a.setHours(0,0,0,0);let u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a.setDate(a.getDate()+u),a.setHours(0,0,0,0);return n?c.reverse():c}i(An,"eachDayOfInterval");var tL=An;function lc(r,e){let{start:t,end:o}=ie(e?.in,r),n=+t>+o,s=n?+t:+o,a=n?o:t;a.setMinutes(0,0,0);let u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a.setHours(a.getHours()+u);return n?c.reverse():c}i(lc,"eachHourOfInterval");var sL=lc;function dc(r,e){let{start:t,end:o}=ie(e?.in,r);t.setSeconds(0,0);let n=+t>+o,s=n?+t:+o,a=n?o:t,u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a=mr(a,u);return n?c.reverse():c}i(dc,"eachMinuteOfInterval");var dL=dc;function pc(r,e){let{start:t,end:o}=ie(e?.in,r),n=+t>+o,s=n?+t:+o,a=n?o:t;a.setHours(0,0,0,0),a.setDate(1);let u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a.setMonth(a.getMonth()+u);return n?c.reverse():c}i(pc,"eachMonthOfInterval");var xL=pc;function Ge(r,e){let t=d(r,e?.in),o=t.getMonth(),n=o-o%3;return t.setMonth(n,1),t.setHours(0,0,0,0),t}i(Ge,"startOfQuarter");var vL=Ge;function mc(r,e){let{start:t,end:o}=ie(e?.in,r),n=+t>+o,s=n?+Ge(t):+Ge(o),a=n?Ge(o):Ge(t),u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a=hr(a,u);return n?c.reverse():c}i(mc,"eachQuarterOfInterval");var kL=mc;function hc(r,e){let{start:t,end:o}=ie(e?.in,r),n=+t>+o,s=n?U(o,e):U(t,e),a=n?U(t,e):U(o,e);s.setHours(15),a.setHours(15);let u=+a.getTime(),c=s,f=e?.step??1;if(!f)return[];f<0&&(f=-f,n=!n);let l=[];for(;+c<=u;)c.setHours(0),l.push(y(t,c)),c=dt(c,f),c.setHours(15);return n?l.reverse():l}i(hc,"eachWeekOfInterval");var WL=hc;function vr(r,e){let{start:t,end:o}=ie(e?.in,r),n=An({start:t,end:o},e),s=[],a=0;for(;a<n.length;){let u=n[a++];Be(u)&&s.push(y(t,u))}return s}i(vr,"eachWeekendOfInterval");var UL=vr;function ht(r,e){let t=d(r,e?.in);return t.setDate(1),t.setHours(0,0,0,0),t}i(ht,"startOfMonth");var VL=ht;function yc(r,e){let t=ht(r,e),o=br(r,e);return vr({start:t,end:o},e)}i(yc,"eachWeekendOfMonth");var XL=yc;function Gn(r,e){let t=d(r,e?.in),o=t.getFullYear();return t.setFullYear(o+1,0,0),t.setHours(23,59,59,999),t}i(Gn,"endOfYear");var r2=Gn;function Tr(r,e){let t=d(r,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}i(Tr,"startOfYear");var s2=Tr;function xc(r,e){let t=Tr(r,e),o=Gn(r,e);return vr({start:t,end:o},e)}i(xc,"eachWeekendOfYear");var d2=xc;function gc(r,e){let{start:t,end:o}=ie(e?.in,r),n=+t>+o,s=n?+t:+o,a=n?o:t;a.setHours(0,0,0,0),a.setMonth(0,1);let u=e?.step??1;if(!u)return[];u<0&&(u=-u,n=!n);let c=[];for(;+a<=s;)c.push(y(t,a)),a.setFullYear(a.getFullYear()+u);return n?c.reverse():c}i(gc,"eachYearOfInterval");var x2=gc;function wc(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=9+Math.floor(o/10)*10;return t.setFullYear(n,11,31),t.setHours(23,59,59,999),t}i(wc,"endOfDecade");var v2=wc;function bc(r,e){let t=d(r,e?.in);return t.setMinutes(59,59,999),t}i(bc,"endOfHour");var M2=bc;function Jn(r,e){let t=L(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=d(r,e?.in),s=n.getDay(),a=(s<o?-7:0)+6-(s-o);return n.setDate(n.getDate()+a),n.setHours(23,59,59,999),n}i(Jn,"endOfWeek");var C2=Jn;function vc(r,e){return Jn(r,{...e,weekStartsOn:1})}i(vc,"endOfISOWeek");var N2=vc;function Tc(r,e){let t=be(r,e),o=y(e?.in||r,0);o.setFullYear(t+1,0,4),o.setHours(0,0,0,0);let n=X(o,e);return n.setMilliseconds(n.getMilliseconds()-1),n}i(Tc,"endOfISOWeekYear");var j2=Tc;function Dc(r,e){let t=d(r,e?.in);return t.setSeconds(59,999),t}i(Dc,"endOfMinute");var B2=Dc;function Sc(r,e){let t=d(r,e?.in),o=t.getMonth(),n=o-o%3+3;return t.setMonth(n,0),t.setHours(23,59,59,999),t}i(Sc,"endOfQuarter");var G2=Sc;function Mc(r,e){let t=d(r,e?.in);return t.setMilliseconds(999),t}i(Mc,"endOfSecond");var X2=Mc;function Oc(r){return wr(Date.now(),r)}i(Oc,"endOfToday");var rY=Oc;function Ec(r){let e=R(r?.in),t=e.getFullYear(),o=e.getMonth(),n=e.getDate(),s=R(r?.in);return s.setFullYear(t,o,n+1),s.setHours(23,59,59,999),r?.in?r.in(s):s}i(Ec,"endOfTomorrow");var sY=Ec;function kc(r){let e=R(r?.in),t=y(r?.in,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()-1),t.setHours(23,59,59,999),t}i(kc,"endOfYesterday");var lY=kc;var _y={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Ic=i((r,e,t)=>{let o,n=_y[r];return typeof n=="string"?o=n:e===1?o=n.one:o=n.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+o:o+" ago":o},"formatDistance");function Kn(r){return(e={})=>{let t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}i(Kn,"buildFormatLongFn");var Ry={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ny={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Wy={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Cc={date:Kn({formats:Ry,defaultWidth:"full"}),time:Kn({formats:Ny,defaultWidth:"full"}),dateTime:Kn({formats:Wy,defaultWidth:"full"})};var Fy={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Pc=i((r,e,t,o)=>Fy[r],"formatRelative");function Dr(r){return(e,t)=>{let o=t?.context?String(t.context):"standalone",n;if(o==="formatting"&&r.formattingValues){let a=r.defaultFormattingWidth||r.defaultWidth,u=t?.width?String(t.width):a;n=r.formattingValues[u]||r.formattingValues[a]}else{let a=r.defaultWidth,u=t?.width?String(t.width):r.defaultWidth;n=r.values[u]||r.values[a]}let s=r.argumentCallback?r.argumentCallback(e):e;return n[s]}}i(Dr,"buildLocalizeFn");var Ly={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Yy={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},qy={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},jy={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"]},Hy={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Uy={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},$y=i((r,e)=>{let t=Number(r),o=t%100;if(o>20||o<10)switch(o%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},"ordinalNumber"),_c={ordinalNumber:$y,era:Dr({values:Ly,defaultWidth:"wide"}),quarter:Dr({values:Yy,defaultWidth:"wide",argumentCallback:i(r=>r-1,"argumentCallback")}),month:Dr({values:qy,defaultWidth:"wide"}),day:Dr({values:jy,defaultWidth:"wide"}),dayPeriod:Dr({values:Hy,defaultWidth:"wide",formattingValues:Uy,defaultFormattingWidth:"wide"})};function Sr(r){return(e,t={})=>{let o=t.width,n=o&&r.matchPatterns[o]||r.matchPatterns[r.defaultMatchWidth],s=e.match(n);if(!s)return null;let a=s[0],u=o&&r.parsePatterns[o]||r.parsePatterns[r.defaultParseWidth],c=Array.isArray(u)?zy(u,p=>p.test(a)):By(u,p=>p.test(a)),f;f=r.valueCallback?r.valueCallback(c):c,f=t.valueCallback?t.valueCallback(f):f;let l=e.slice(a.length);return{value:f,rest:l}}}i(Sr,"buildMatchFn");function By(r,e){for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}i(By,"findKey");function zy(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}i(zy,"findIndex");function Rc(r){return(e,t={})=>{let o=e.match(r.matchPattern);if(!o)return null;let n=o[0],s=e.match(r.parsePattern);if(!s)return null;let a=r.valueCallback?r.valueCallback(s[0]):s[0];a=t.valueCallback?t.valueCallback(a):a;let u=e.slice(n.length);return{value:a,rest:u}}}i(Rc,"buildMatchPatternFn");var Vy=/^(\d+)(th|st|nd|rd)?/i,Ay=/\d+/i,Gy={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Jy={any:[/^b/i,/^(a|c)/i]},Ky={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Qy={any:[/1/i,/2/i,/3/i,/4/i]},Xy={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Zy={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ex={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},tx={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},rx={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ox={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Nc={ordinalNumber:Rc({matchPattern:Vy,parsePattern:Ay,valueCallback:i(r=>parseInt(r,10),"valueCallback")}),era:Sr({matchPatterns:Gy,defaultMatchWidth:"wide",parsePatterns:Jy,defaultParseWidth:"any"}),quarter:Sr({matchPatterns:Ky,defaultMatchWidth:"wide",parsePatterns:Qy,defaultParseWidth:"any",valueCallback:i(r=>r+1,"valueCallback")}),month:Sr({matchPatterns:Xy,defaultMatchWidth:"wide",parsePatterns:Zy,defaultParseWidth:"any"}),day:Sr({matchPatterns:ex,defaultMatchWidth:"wide",parsePatterns:tx,defaultParseWidth:"any"}),dayPeriod:Sr({matchPatterns:rx,defaultMatchWidth:"any",parsePatterns:ox,defaultParseWidth:"any"})};var De={code:"en-US",formatDistance:Ic,formatLong:Cc,formatRelative:Pc,localize:_c,match:Nc,options:{weekStartsOn:0,firstWeekContainsDate:1}},jY=De;function Qn(r,e){let t=d(r,e?.in);return ne(t,Tr(t))+1}i(Qn,"getDayOfYear");var AY=Qn;function Mr(r,e){let t=d(r,e?.in),o=+X(t)-+Oe(t);return Math.round(o/Ue)+1}i(Mr,"getISOWeek");var eq=Mr;function yt(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=L(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=y(e?.in||r,0);a.setFullYear(o+1,0,s),a.setHours(0,0,0,0);let u=U(a,e),c=y(e?.in||r,0);c.setFullYear(o,0,s),c.setHours(0,0,0,0);let f=U(c,e);return+t>=+u?o+1:+t>=+f?o:o-1}i(yt,"getWeekYear");var aq=yt;function Ut(r,e){let t=L(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,n=yt(r,e),s=y(e?.in||r,0);return s.setFullYear(n,0,o),s.setHours(0,0,0,0),U(s,e)}i(Ut,"startOfWeekYear");var mq=Ut;function Or(r,e){let t=d(r,e?.in),o=+U(t,e)-+Ut(t,e);return Math.round(o/Ue)+1}i(Or,"getWeek");var vq=Or;function M(r,e){let t=r<0?"-":"",o=Math.abs(r).toString().padStart(e,"0");return t+o}i(M,"addLeadingZeros");var Ee={y(r,e){let t=r.getFullYear(),o=t>0?t:1-t;return M(e==="yy"?o%100:o,e.length)},M(r,e){let t=r.getMonth();return e==="M"?String(t+1):M(t+1,2)},d(r,e){return M(r.getDate(),e.length)},a(r,e){let t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(r,e){return M(r.getHours()%12||12,e.length)},H(r,e){return M(r.getHours(),e.length)},m(r,e){return M(r.getMinutes(),e.length)},s(r,e){return M(r.getSeconds(),e.length)},S(r,e){let t=e.length,o=r.getMilliseconds(),n=Math.trunc(o*Math.pow(10,t-3));return M(n,e.length)}};var Er={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},mo={G:i(function(r,e,t){let o=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(o,{width:"abbreviated"});case"GGGGG":return t.era(o,{width:"narrow"});default:return t.era(o,{width:"wide"})}},"G"),y:i(function(r,e,t){if(e==="yo"){let o=r.getFullYear(),n=o>0?o:1-o;return t.ordinalNumber(n,{unit:"year"})}return Ee.y(r,e)},"y"),Y:i(function(r,e,t,o){let n=yt(r,o),s=n>0?n:1-n;if(e==="YY"){let a=s%100;return M(a,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):M(s,e.length)},"Y"),R:i(function(r,e){let t=be(r);return M(t,e.length)},"R"),u:i(function(r,e){let t=r.getFullYear();return M(t,e.length)},"u"),Q:i(function(r,e,t){let o=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(o);case"QQ":return M(o,2);case"Qo":return t.ordinalNumber(o,{unit:"quarter"});case"QQQ":return t.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(o,{width:"narrow",context:"formatting"});default:return t.quarter(o,{width:"wide",context:"formatting"})}},"Q"),q:i(function(r,e,t){let o=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(o);case"qq":return M(o,2);case"qo":return t.ordinalNumber(o,{unit:"quarter"});case"qqq":return t.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(o,{width:"narrow",context:"standalone"});default:return t.quarter(o,{width:"wide",context:"standalone"})}},"q"),M:i(function(r,e,t){let o=r.getMonth();switch(e){case"M":case"MM":return Ee.M(r,e);case"Mo":return t.ordinalNumber(o+1,{unit:"month"});case"MMM":return t.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(o,{width:"narrow",context:"formatting"});default:return t.month(o,{width:"wide",context:"formatting"})}},"M"),L:i(function(r,e,t){let o=r.getMonth();switch(e){case"L":return String(o+1);case"LL":return M(o+1,2);case"Lo":return t.ordinalNumber(o+1,{unit:"month"});case"LLL":return t.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(o,{width:"narrow",context:"standalone"});default:return t.month(o,{width:"wide",context:"standalone"})}},"L"),w:i(function(r,e,t,o){let n=Or(r,o);return e==="wo"?t.ordinalNumber(n,{unit:"week"}):M(n,e.length)},"w"),I:i(function(r,e,t){let o=Mr(r);return e==="Io"?t.ordinalNumber(o,{unit:"week"}):M(o,e.length)},"I"),d:i(function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):Ee.d(r,e)},"d"),D:i(function(r,e,t){let o=Qn(r);return e==="Do"?t.ordinalNumber(o,{unit:"dayOfYear"}):M(o,e.length)},"D"),E:i(function(r,e,t){let o=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(o,{width:"short",context:"formatting"});default:return t.day(o,{width:"wide",context:"formatting"})}},"E"),e:i(function(r,e,t,o){let n=r.getDay(),s=(n-o.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return M(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(n,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(n,{width:"short",context:"formatting"});default:return t.day(n,{width:"wide",context:"formatting"})}},"e"),c:i(function(r,e,t,o){let n=r.getDay(),s=(n-o.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return M(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(n,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(n,{width:"narrow",context:"standalone"});case"cccccc":return t.day(n,{width:"short",context:"standalone"});default:return t.day(n,{width:"wide",context:"standalone"})}},"c"),i:i(function(r,e,t){let o=r.getDay(),n=o===0?7:o;switch(e){case"i":return String(n);case"ii":return M(n,e.length);case"io":return t.ordinalNumber(n,{unit:"day"});case"iii":return t.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(o,{width:"short",context:"formatting"});default:return t.day(o,{width:"wide",context:"formatting"})}},"i"),a:i(function(r,e,t){let n=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},"a"),b:i(function(r,e,t){let o=r.getHours(),n;switch(o===12?n=Er.noon:o===0?n=Er.midnight:n=o/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},"b"),B:i(function(r,e,t){let o=r.getHours(),n;switch(o>=17?n=Er.evening:o>=12?n=Er.afternoon:o>=4?n=Er.morning:n=Er.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},"B"),h:i(function(r,e,t){if(e==="ho"){let o=r.getHours()%12;return o===0&&(o=12),t.ordinalNumber(o,{unit:"hour"})}return Ee.h(r,e)},"h"),H:i(function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):Ee.H(r,e)},"H"),K:i(function(r,e,t){let o=r.getHours()%12;return e==="Ko"?t.ordinalNumber(o,{unit:"hour"}):M(o,e.length)},"K"),k:i(function(r,e,t){let o=r.getHours();return o===0&&(o=24),e==="ko"?t.ordinalNumber(o,{unit:"hour"}):M(o,e.length)},"k"),m:i(function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):Ee.m(r,e)},"m"),s:i(function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):Ee.s(r,e)},"s"),S:i(function(r,e){return Ee.S(r,e)},"S"),X:i(function(r,e,t){let o=r.getTimezoneOffset();if(o===0)return"Z";switch(e){case"X":return Fc(o);case"XXXX":case"XX":return $t(o);default:return $t(o,":")}},"X"),x:i(function(r,e,t){let o=r.getTimezoneOffset();switch(e){case"x":return Fc(o);case"xxxx":case"xx":return $t(o);default:return $t(o,":")}},"x"),O:i(function(r,e,t){let o=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Wc(o,":");default:return"GMT"+$t(o,":")}},"O"),z:i(function(r,e,t){let o=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Wc(o,":");default:return"GMT"+$t(o,":")}},"z"),t:i(function(r,e,t){let o=Math.trunc(+r/1e3);return M(o,e.length)},"t"),T:i(function(r,e,t){return M(+r,e.length)},"T")};function Wc(r,e=""){let t=r>0?"-":"+",o=Math.abs(r),n=Math.trunc(o/60),s=o%60;return s===0?t+String(n):t+String(n)+e+M(s,2)}i(Wc,"formatTimezoneShort");function Fc(r,e){return r%60===0?(r>0?"-":"+")+M(Math.abs(r)/60,2):$t(r,e)}i(Fc,"formatTimezoneWithOptionalMinutes");function $t(r,e=""){let t=r>0?"-":"+",o=Math.abs(r),n=M(Math.trunc(o/60),2),s=M(o%60,2);return t+n+e+s}i($t,"formatTimezone");var Lc=i((r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},"dateLongFormatter"),Yc=i((r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},"timeLongFormatter"),nx=i((r,e)=>{let t=r.match(/(P+)(p+)?/)||[],o=t[1],n=t[2];if(!n)return Lc(r,e);let s;switch(o){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",Lc(o,e)).replace("{{time}}",Yc(n,e))},"dateTimeLongFormatter"),xt={p:Yc,P:nx};var ix=/^D+$/,sx=/^Y+$/,ax=["D","DD","YY","YYYY"];function Xn(r){return ix.test(r)}i(Xn,"isProtectedDayOfYearToken");function Zn(r){return sx.test(r)}i(Zn,"isProtectedWeekYearToken");function ho(r,e,t){let o=ux(r,e,t);if(console.warn(o),ax.includes(r))throw new RangeError(o)}i(ho,"warnOrThrowProtectedError");function ux(r,e,t){let o=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${o} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}i(ux,"message");var cx=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,fx=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,lx=/^'([^]*?)'?$/,dx=/''/g,px=/[a-zA-Z]/;function yo(r,e,t){let o=L(),n=t?.locale??o.locale??De,s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,u=d(r,t?.in);if(!ce(u))throw new RangeError("Invalid time value");let c=e.match(fx).map(l=>{let p=l[0];if(p==="p"||p==="P"){let m=xt[p];return m(l,n.formatLong)}return l}).join("").match(cx).map(l=>{if(l==="''")return{isToken:!1,value:"'"};let p=l[0];if(p==="'")return{isToken:!1,value:mx(l)};if(mo[p])return{isToken:!0,value:l};if(p.match(px))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:l}});n.localize.preprocessor&&(c=n.localize.preprocessor(u,c));let f={firstWeekContainsDate:s,weekStartsOn:a,locale:n};return c.map(l=>{if(!l.isToken)return l.value;let p=l.value;(!t?.useAdditionalWeekYearTokens&&Zn(p)||!t?.useAdditionalDayOfYearTokens&&Xn(p))&&ho(p,e,String(r));let m=mo[p[0]];return m(u,p,n.localize,f)}).join("")}i(yo,"format");function mx(r){let e=r.match(lx);return e?e[1].replace(dx,"'"):r}i(mx,"cleanEscapedString");var Gq=yo;function ei(r,e,t){let o=L(),n=t?.locale??o.locale??De,s=2520,a=pe(r,e);if(isNaN(a))throw new RangeError("Invalid time value");let u=Object.assign({},t,{addSuffix:t?.addSuffix,comparison:a}),[c,f]=O(t?.in,...a>0?[e,r]:[r,e]),l=Ae(f,c),p=(J(f)-J(c))/1e3,m=Math.round((l-p)/60),h;if(m<2)return t?.includeSeconds?l<5?n.formatDistance("lessThanXSeconds",5,u):l<10?n.formatDistance("lessThanXSeconds",10,u):l<20?n.formatDistance("lessThanXSeconds",20,u):l<40?n.formatDistance("halfAMinute",0,u):l<60?n.formatDistance("lessThanXMinutes",1,u):n.formatDistance("xMinutes",1,u):m===0?n.formatDistance("lessThanXMinutes",1,u):n.formatDistance("xMinutes",m,u);if(m<45)return n.formatDistance("xMinutes",m,u);if(m<90)return n.formatDistance("aboutXHours",1,u);if(m<dr){let x=Math.round(m/60);return n.formatDistance("aboutXHours",x,u)}else{if(m<s)return n.formatDistance("xDays",1,u);if(m<ct){let x=Math.round(m/dr);return n.formatDistance("xDays",x,u)}else if(m<ct*2)return h=Math.round(m/ct),n.formatDistance("aboutXMonths",h,u)}if(h=mt(f,c),h<12){let x=Math.round(m/ct);return n.formatDistance("xMonths",x,u)}else{let x=h%12,g=Math.trunc(h/12);return x<3?n.formatDistance("aboutXYears",g,u):x<9?n.formatDistance("overXYears",g,u):n.formatDistance("almostXYears",g+1,u)}}i(ei,"formatDistance");var ij=ei;function ti(r,e,t){let o=L(),n=t?.locale??o.locale??De,s=pe(r,e);if(isNaN(s))throw new RangeError("Invalid time value");let a=Object.assign({},t,{addSuffix:t?.addSuffix,comparison:s}),[u,c]=O(t?.in,...s>0?[e,r]:[r,e]),f=me(t?.roundingMethod??"round"),l=c.getTime()-u.getTime(),p=l/de,m=J(c)-J(u),h=(l-m)/de,x=t?.unit,g;if(x?g=x:p<1?g="second":p<60?g="minute":p<dr?g="hour":h<ct?g="day":h<wa?g="month":g="year",g==="second"){let w=f(l/1e3);return n.formatDistance("xSeconds",w,a)}else if(g==="minute"){let w=f(p);return n.formatDistance("xMinutes",w,a)}else if(g==="hour"){let w=f(p/60);return n.formatDistance("xHours",w,a)}else if(g==="day"){let w=f(h/dr);return n.formatDistance("xDays",w,a)}else if(g==="month"){let w=f(h/ct);return w===12&&x!=="month"?n.formatDistance("xYears",1,a):n.formatDistance("xMonths",w,a)}else{let w=f(h/wa);return n.formatDistance("xYears",w,a)}}i(ti,"formatDistanceStrict");var hj=ti;function qc(r,e){return ei(r,R(r),e)}i(qc,"formatDistanceToNow");var bj=qc;function jc(r,e){return ti(r,R(r),e)}i(jc,"formatDistanceToNowStrict");var Mj=jc;var hx=["years","months","weeks","days","hours","minutes","seconds"];function Hc(r,e){let t=L(),o=e?.locale??t.locale??De,n=e?.format??hx,s=e?.zero??!1,a=e?.delimiter??" ";return o.formatDistance?n.reduce((c,f)=>{let l=`x${f.replace(/(^.)/,m=>m.toUpperCase())}`,p=r[f];return p!==void 0&&(s||r[f])?c.concat(o.formatDistance(l,p)):c},[]).join(a):""}i(Hc,"formatDuration");var Cj=Hc;function Uc(r,e){let t=d(r,e?.in);if(isNaN(+t))throw new RangeError("Invalid time value");let o=e?.format??"extended",n=e?.representation??"complete",s="",a="",u=o==="extended"?"-":"",c=o==="extended"?":":"";if(n!=="time"){let f=M(t.getDate(),2),l=M(t.getMonth()+1,2);s=`${M(t.getFullYear(),4)}${u}${l}${u}${f}`}if(n!=="date"){let f=t.getTimezoneOffset();if(f!==0){let g=Math.abs(f),w=M(Math.trunc(g/60),2),v=M(g%60,2);a=`${f<0?"+":"-"}${w}:${v}`}else a="Z";let l=M(t.getHours(),2),p=M(t.getMinutes(),2),m=M(t.getSeconds(),2),h=s===""?"":"T",x=[l,p,m].join(c);s=`${s}${h}${x}${a}`}return s}i(Uc,"formatISO");var Wj=Uc;function $c(r,e){let t=d(r,e?.in);if(!ce(t))throw new RangeError("Invalid time value");let o=e?.format??"extended",n=e?.representation??"complete",s="",a=o==="extended"?"-":"",u=o==="extended"?":":"";if(n!=="time"){let c=M(t.getDate(),2),f=M(t.getMonth()+1,2);s=`${M(t.getFullYear(),4)}${a}${f}${a}${c}`}if(n!=="date"){let c=M(t.getHours(),2),f=M(t.getMinutes(),2),l=M(t.getSeconds(),2);s=`${s}${s===""?"":" "}${c}${u}${f}${u}${l}`}return s}i($c,"formatISO9075");var Hj=$c;function Bc(r){let{years:e=0,months:t=0,days:o=0,hours:n=0,minutes:s=0,seconds:a=0}=r;return`P${e}Y${t}M${o}DT${n}H${s}M${a}S`}i(Bc,"formatISODuration");var Bj=Bc;function zc(r,e){let t=d(r,e?.in);if(!ce(t))throw new RangeError("Invalid time value");let o=e?.fractionDigits??0,n=M(t.getDate(),2),s=M(t.getMonth()+1,2),a=t.getFullYear(),u=M(t.getHours(),2),c=M(t.getMinutes(),2),f=M(t.getSeconds(),2),l="";if(o>0){let h=t.getMilliseconds(),x=Math.trunc(h*Math.pow(10,o-3));l="."+M(x,o)}let p="",m=t.getTimezoneOffset();if(m!==0){let h=Math.abs(m),x=M(Math.trunc(h/60),2),g=M(h%60,2);p=`${m<0?"+":"-"}${x}:${g}`}else p="Z";return`${a}-${s}-${n}T${u}:${c}:${f}${l}${p}`}i(zc,"formatRFC3339");var Kj=zc;var yx=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],xx=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Vc(r){let e=d(r);if(!ce(e))throw new RangeError("Invalid time value");let t=yx[e.getUTCDay()],o=M(e.getUTCDate(),2),n=xx[e.getUTCMonth()],s=e.getUTCFullYear(),a=M(e.getUTCHours(),2),u=M(e.getUTCMinutes(),2),c=M(e.getUTCSeconds(),2);return`${t}, ${o} ${n} ${s} ${a}:${u}:${c} GMT`}i(Vc,"formatRFC7231");var rH=Vc;function Ac(r,e,t){let[o,n]=O(t?.in,r,e),s=L(),a=t?.locale??s.locale??De,u=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,c=ne(o,n);if(isNaN(c))throw new RangeError("Invalid time value");let f;c<-6?f="other":c<-1?f="lastWeek":c<0?f="yesterday":c<1?f="today":c<2?f="tomorrow":c<7?f="nextWeek":f="other";let l=a.formatRelative(f,o,n,{locale:a,weekStartsOn:u});return yo(o,l,{locale:a,weekStartsOn:u})}i(Ac,"formatRelative");var fH=Ac;function Gc(r,e){return d(r*1e3,e?.in)}i(Gc,"fromUnixTime");var mH=Gc;function ri(r,e){return d(r,e?.in).getDate()}i(ri,"getDate");var gH=ri;function gt(r,e){return d(r,e?.in).getDay()}i(gt,"getDay");var TH=gt;function oi(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=t.getMonth(),s=y(t,0);return s.setFullYear(o,n+1,0),s.setHours(0,0,0,0),s.getDate()}i(oi,"getDaysInMonth");var EH=oi;function ni(r,e){let o=d(r,e?.in).getFullYear();return o%400===0||o%4===0&&o%100!==0}i(ni,"isLeapYear");var PH=ni;function Jc(r,e){let t=d(r,e?.in);return Number.isNaN(+t)?NaN:ni(t)?366:365}i(Jc,"getDaysInYear");var FH=Jc;function Kc(r,e){let o=d(r,e?.in).getFullYear();return Math.floor(o/10)*10}i(Kc,"getDecade");var jH=Kc;function ii(){return Object.assign({},L())}i(ii,"getDefaultOptions");var BH=ii;function Qc(r,e){return d(r,e?.in).getHours()}i(Qc,"getHours");var GH=Qc;function si(r,e){let t=d(r,e?.in).getDay();return t===0?7:t}i(si,"getISODay");var XH=si;function Xc(r,e){let t=Oe(r,e),n=+Oe(dt(t,60))-+t;return Math.round(n/Ue)}i(Xc,"getISOWeeksInYear");var nU=Xc;function Zc(r){return d(r).getMilliseconds()}i(Zc,"getMilliseconds");var uU=Zc;function ef(r,e){return d(r,e?.in).getMinutes()}i(ef,"getMinutes");var dU=ef;function tf(r,e){return d(r,e?.in).getMonth()}i(tf,"getMonth");var yU=tf;function rf(r,e){let[t,o]=[+d(r.start),+d(r.end)].sort((p,m)=>p-m),[n,s]=[+d(e.start),+d(e.end)].sort((p,m)=>p-m);if(!(t<s&&n<o))return 0;let u=n<t?t:n,c=u-J(u),f=s>o?o:s,l=f-J(f);return Math.ceil((l-c)/On)}i(rf,"getOverlappingDaysInIntervals");var TU=rf;function of(r){return d(r).getSeconds()}i(of,"getSeconds");var OU=of;function nf(r){return+d(r)}i(nf,"getTime");var CU=nf;function sf(r){return Math.trunc(+d(r)/1e3)}i(sf,"getUnixTime");var NU=sf;function af(r,e){let t=L(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=ri(d(r,e?.in));if(isNaN(n))return NaN;let s=gt(ht(r,e)),a=o-s;a<=0&&(a+=7);let u=n-a;return Math.ceil(u/7)+1}i(af,"getWeekOfMonth");var UU=af;function ai(r,e){let t=d(r,e?.in),o=t.getMonth();return t.setFullYear(t.getFullYear(),o+1,0),t.setHours(0,0,0,0),d(t,e?.in)}i(ai,"lastDayOfMonth");var VU=ai;function uf(r,e){let t=d(r,e?.in);return qt(ai(t,e),ht(t,e),e)+1}i(uf,"getWeeksInMonth");var ZU=uf;function cf(r,e){return d(r,e?.in).getFullYear()}i(cf,"getYear");var o$=cf;function ff(r){return Math.trunc(r*Me)}i(ff,"hoursToMilliseconds");var a$=ff;function lf(r){return Math.trunc(r*En)}i(lf,"hoursToMinutes");var l$=lf;function df(r){return Math.trunc(r*Lt)}i(df,"hoursToSeconds");var h$=df;function pf(r,e,t){let[o,n]=O(t?.in,r,e);if(isNaN(+o))throw new TypeError("Start date is invalid");if(isNaN(+n))throw new TypeError("End date is invalid");if(t?.assertPositive&&+o>+n)throw new TypeError("End date must be after start date");return{start:o,end:n}}i(pf,"interval");var w$=pf;function mf(r,e){let{start:t,end:o}=ie(e?.in,r),n={},s=Vn(o,t);s&&(n.years=s);let a=ft(t,{years:n.years}),u=mt(o,a);u&&(n.months=u);let c=ft(a,{months:n.months}),f=xr(o,c);f&&(n.days=f);let l=ft(c,{days:n.days}),p=jt(o,l);p&&(n.hours=p);let m=ft(l,{hours:n.hours}),h=Ht(o,m);h&&(n.minutes=h);let x=ft(m,{minutes:n.minutes}),g=Ae(o,x);return g&&(n.seconds=g),n}i(mf,"intervalToDuration");var C$=mf;function hf(r,e,t){let o;return gx(e)?o=e:t=e,new Intl.DateTimeFormat(t?.locale,o).format(d(r))}i(hf,"intlFormat");function gx(r){return r!==void 0&&!("locale"in r)}i(gx,"isFormatOptions");var N$=hf;function yf(r,e,t){let o=0,n,[s,a]=O(t?.in,r,e);if(t?.unit)n=t?.unit,n==="second"?o=Ae(s,a):n==="minute"?o=Ht(s,a):n==="hour"?o=jt(s,a):n==="day"?o=ne(s,a):n==="week"?o=qt(s,a):n==="month"?o=Yt(s,a):n==="quarter"?o=yr(s,a):n==="year"&&(o=pt(s,a));else{let c=Ae(s,a);Math.abs(c)<pr?(o=Ae(s,a),n="second"):Math.abs(c)<Lt?(o=Ht(s,a),n="minute"):Math.abs(c)<Sn&&Math.abs(ne(s,a))<1?(o=jt(s,a),n="hour"):Math.abs(c)<Ku&&(o=ne(s,a))&&Math.abs(o)<7?n="day":Math.abs(c)<va?(o=qt(s,a),n="week"):Math.abs(c)<Qu?(o=Yt(s,a),n="month"):Math.abs(c)<ba?yr(s,a)<4?(o=yr(s,a),n="quarter"):(o=pt(s,a),n="year"):(o=pt(s,a),n="year")}return new Intl.RelativeTimeFormat(t?.locale,{numeric:"auto",...t}).format(o,n)}i(yf,"intlFormatDistance");var A$=yf;function xf(r,e){return+d(r)>+d(e)}i(xf,"isAfter");var Q$=xf;function gf(r,e){return+d(r)<+d(e)}i(gf,"isBefore");var tB=gf;function wf(r,e){return+d(r)==+d(e)}i(wf,"isEqual");var iB=wf;function bf(r,e,t){let o=new Date(r,e,t);return o.getFullYear()===r&&o.getMonth()===e&&o.getDate()===t}i(bf,"isExists");var uB=bf;function vf(r,e){return d(r,e?.in).getDate()===1}i(vf,"isFirstDayOfMonth");var dB=vf;function Tf(r,e){return d(r,e?.in).getDay()===5}i(Tf,"isFriday");var yB=Tf;function Df(r){return+d(r)>Date.now()}i(Df,"isFuture");var bB=Df;function ui(r,e){let t=wx(e)?new e(0):y(e,0);return t.setFullYear(r.getFullYear(),r.getMonth(),r.getDate()),t.setHours(r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()),t}i(ui,"transpose");function wx(r){return typeof r=="function"&&r.prototype?.constructor===r}i(wx,"isConstructor");var SB=ui;var bx=10,ci=class{static{i(this,"Setter")}subPriority=0;validate(e,t){return!0}},fi=class extends ci{static{i(this,"ValueSetter")}constructor(e,t,o,n,s){super(),this.value=e,this.validateValue=t,this.setValue=o,this.priority=n,s&&(this.subPriority=s)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,o){return this.setValue(e,t,this.value,o)}},li=class extends ci{static{i(this,"DateTimezoneSetter")}priority=bx;subPriority=-1;constructor(e,t){super(),this.context=e||(o=>y(t,o))}set(e,t){return t.timestampIsSet?e:y(e,ui(e,this.context))}};var S=class{static{i(this,"Parser")}run(e,t,o,n){let s=this.parse(e,t,o,n);return s?{setter:new fi(s.value,this.validate,this.set,this.priority,this.subPriority),rest:s.rest}:null}validate(e,t,o){return!0}};var di=class extends S{static{i(this,"EraParser")}priority=140;parse(e,t,o){switch(t){case"G":case"GG":case"GGG":return o.era(e,{width:"abbreviated"})||o.era(e,{width:"narrow"});case"GGGGG":return o.era(e,{width:"narrow"});default:return o.era(e,{width:"wide"})||o.era(e,{width:"abbreviated"})||o.era(e,{width:"narrow"})}}set(e,t,o){return t.era=o,e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]};var W={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},_e={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function Y(r,e){return r&&{value:e(r.value),rest:r.rest}}i(Y,"mapValue");function N(r,e){let t=e.match(r);return t?{value:parseInt(t[0],10),rest:e.slice(t[0].length)}:null}i(N,"parseNumericPattern");function Re(r,e){let t=e.match(r);if(!t)return null;if(t[0]==="Z")return{value:0,rest:e.slice(1)};let o=t[1]==="+"?1:-1,n=t[2]?parseInt(t[2],10):0,s=t[3]?parseInt(t[3],10):0,a=t[5]?parseInt(t[5],10):0;return{value:o*(n*Me+s*de+a*lr),rest:e.slice(t[0].length)}}i(Re,"parseTimezonePattern");function pi(r){return N(W.anyDigitsSigned,r)}i(pi,"parseAnyDigitsSigned");function C(r,e){switch(r){case 1:return N(W.singleDigit,e);case 2:return N(W.twoDigits,e);case 3:return N(W.threeDigits,e);case 4:return N(W.fourDigits,e);default:return N(new RegExp("^\\d{1,"+r+"}"),e)}}i(C,"parseNDigits");function kr(r,e){switch(r){case 1:return N(W.singleDigitSigned,e);case 2:return N(W.twoDigitsSigned,e);case 3:return N(W.threeDigitsSigned,e);case 4:return N(W.fourDigitsSigned,e);default:return N(new RegExp("^-?\\d{1,"+r+"}"),e)}}i(kr,"parseNDigitsSigned");function Ir(r){switch(r){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}i(Ir,"dayPeriodEnumToHours");function mi(r,e){let t=e>0,o=t?e:1-e,n;if(o<=50)n=r||100;else{let s=o+50,a=Math.trunc(s/100)*100,u=r>=s%100;n=r+a-(u?100:0)}return t?n:1-n}i(mi,"normalizeTwoDigitYear");function hi(r){return r%400===0||r%4===0&&r%100!==0}i(hi,"isLeapYearIndex");var yi=class extends S{static{i(this,"YearParser")}priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,t,o){let n=i(s=>({year:s,isTwoDigitYear:t==="yy"}),"valueCallback");switch(t){case"y":return Y(C(4,e),n);case"yo":return Y(o.ordinalNumber(e,{unit:"year"}),n);default:return Y(C(t.length,e),n)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,o){let n=e.getFullYear();if(o.isTwoDigitYear){let a=mi(o.year,n);return e.setFullYear(a,0,1),e.setHours(0,0,0,0),e}let s=!("era"in t)||t.era===1?o.year:1-o.year;return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}};var xi=class extends S{static{i(this,"LocalWeekYearParser")}priority=130;parse(e,t,o){let n=i(s=>({year:s,isTwoDigitYear:t==="YY"}),"valueCallback");switch(t){case"Y":return Y(C(4,e),n);case"Yo":return Y(o.ordinalNumber(e,{unit:"year"}),n);default:return Y(C(t.length,e),n)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,o,n){let s=yt(e,n);if(o.isTwoDigitYear){let u=mi(o.year,s);return e.setFullYear(u,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),U(e,n)}let a=!("era"in t)||t.era===1?o.year:1-o.year;return e.setFullYear(a,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),U(e,n)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]};var gi=class extends S{static{i(this,"ISOWeekYearParser")}priority=130;parse(e,t){return t==="R"?kr(4,e):kr(t.length,e)}set(e,t,o){let n=y(e,0);return n.setFullYear(o,0,4),n.setHours(0,0,0,0),X(n)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]};var wi=class extends S{static{i(this,"ExtendedYearParser")}priority=130;parse(e,t){return t==="u"?kr(4,e):kr(t.length,e)}set(e,t,o){return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]};var bi=class extends S{static{i(this,"QuarterParser")}priority=120;parse(e,t,o){switch(t){case"Q":case"QQ":return C(t.length,e);case"Qo":return o.ordinalNumber(e,{unit:"quarter"});case"QQQ":return o.quarter(e,{width:"abbreviated",context:"formatting"})||o.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return o.quarter(e,{width:"narrow",context:"formatting"});default:return o.quarter(e,{width:"wide",context:"formatting"})||o.quarter(e,{width:"abbreviated",context:"formatting"})||o.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=1&&t<=4}set(e,t,o){return e.setMonth((o-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]};var vi=class extends S{static{i(this,"StandAloneQuarterParser")}priority=120;parse(e,t,o){switch(t){case"q":case"qq":return C(t.length,e);case"qo":return o.ordinalNumber(e,{unit:"quarter"});case"qqq":return o.quarter(e,{width:"abbreviated",context:"standalone"})||o.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return o.quarter(e,{width:"narrow",context:"standalone"});default:return o.quarter(e,{width:"wide",context:"standalone"})||o.quarter(e,{width:"abbreviated",context:"standalone"})||o.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=1&&t<=4}set(e,t,o){return e.setMonth((o-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]};var Ti=class extends S{static{i(this,"MonthParser")}incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,t,o){let n=i(s=>s-1,"valueCallback");switch(t){case"M":return Y(N(W.month,e),n);case"MM":return Y(C(2,e),n);case"Mo":return Y(o.ordinalNumber(e,{unit:"month"}),n);case"MMM":return o.month(e,{width:"abbreviated",context:"formatting"})||o.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return o.month(e,{width:"narrow",context:"formatting"});default:return o.month(e,{width:"wide",context:"formatting"})||o.month(e,{width:"abbreviated",context:"formatting"})||o.month(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=11}set(e,t,o){return e.setMonth(o,1),e.setHours(0,0,0,0),e}};var Di=class extends S{static{i(this,"StandAloneMonthParser")}priority=110;parse(e,t,o){let n=i(s=>s-1,"valueCallback");switch(t){case"L":return Y(N(W.month,e),n);case"LL":return Y(C(2,e),n);case"Lo":return Y(o.ordinalNumber(e,{unit:"month"}),n);case"LLL":return o.month(e,{width:"abbreviated",context:"standalone"})||o.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return o.month(e,{width:"narrow",context:"standalone"});default:return o.month(e,{width:"wide",context:"standalone"})||o.month(e,{width:"abbreviated",context:"standalone"})||o.month(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=11}set(e,t,o){return e.setMonth(o,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]};function Si(r,e,t){let o=d(r,t?.in),n=Or(o,t)-e;return o.setDate(o.getDate()-n*7),d(o,t?.in)}i(Si,"setWeek");var k3=Si;var Mi=class extends S{static{i(this,"LocalWeekParser")}priority=100;parse(e,t,o){switch(t){case"w":return N(W.week,e);case"wo":return o.ordinalNumber(e,{unit:"week"});default:return C(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,o,n){return U(Si(e,o,n),n)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]};function Oi(r,e,t){let o=d(r,t?.in),n=Mr(o,t)-e;return o.setDate(o.getDate()-n*7),o}i(Oi,"setISOWeek");var j3=Oi;var Ei=class extends S{static{i(this,"ISOWeekParser")}priority=100;parse(e,t,o){switch(t){case"I":return N(W.week,e);case"Io":return o.ordinalNumber(e,{unit:"week"});default:return C(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,o){return X(Oi(e,o))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]};var vx=[31,28,31,30,31,30,31,31,30,31,30,31],Tx=[31,29,31,30,31,30,31,31,30,31,30,31],ki=class extends S{static{i(this,"DateParser")}priority=90;subPriority=1;parse(e,t,o){switch(t){case"d":return N(W.date,e);case"do":return o.ordinalNumber(e,{unit:"date"});default:return C(t.length,e)}}validate(e,t){let o=e.getFullYear(),n=hi(o),s=e.getMonth();return n?t>=1&&t<=Tx[s]:t>=1&&t<=vx[s]}set(e,t,o){return e.setDate(o),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]};var Ii=class extends S{static{i(this,"DayOfYearParser")}priority=90;subpriority=1;parse(e,t,o){switch(t){case"D":case"DD":return N(W.dayOfYear,e);case"Do":return o.ordinalNumber(e,{unit:"date"});default:return C(t.length,e)}}validate(e,t){let o=e.getFullYear();return hi(o)?t>=1&&t<=366:t>=1&&t<=365}set(e,t,o){return e.setMonth(0,o),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]};function wt(r,e,t){let o=L(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,s=d(r,t?.in),a=s.getDay(),c=(e%7+7)%7,f=7-n,l=e<0||e>6?e-(a+f)%7:(c+f)%7-(a+f)%7;return ee(s,l,t)}i(wt,"setDay");var c6=wt;var Ci=class extends S{static{i(this,"DayParser")}priority=90;parse(e,t,o){switch(t){case"E":case"EE":case"EEE":return o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return o.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});default:return o.day(e,{width:"wide",context:"formatting"})||o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,o,n){return e=wt(e,o,n),e.setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]};var Pi=class extends S{static{i(this,"LocalDayParser")}priority=90;parse(e,t,o,n){let s=i(a=>{let u=Math.floor((a-1)/7)*7;return(a+n.weekStartsOn+6)%7+u},"valueCallback");switch(t){case"e":case"ee":return Y(C(t.length,e),s);case"eo":return Y(o.ordinalNumber(e,{unit:"day"}),s);case"eee":return o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});case"eeeee":return o.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"});default:return o.day(e,{width:"wide",context:"formatting"})||o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,o,n){return e=wt(e,o,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]};var _i=class extends S{static{i(this,"StandAloneLocalDayParser")}priority=90;parse(e,t,o,n){let s=i(a=>{let u=Math.floor((a-1)/7)*7;return(a+n.weekStartsOn+6)%7+u},"valueCallback");switch(t){case"c":case"cc":return Y(C(t.length,e),s);case"co":return Y(o.ordinalNumber(e,{unit:"day"}),s);case"ccc":return o.day(e,{width:"abbreviated",context:"standalone"})||o.day(e,{width:"short",context:"standalone"})||o.day(e,{width:"narrow",context:"standalone"});case"ccccc":return o.day(e,{width:"narrow",context:"standalone"});case"cccccc":return o.day(e,{width:"short",context:"standalone"})||o.day(e,{width:"narrow",context:"standalone"});default:return o.day(e,{width:"wide",context:"standalone"})||o.day(e,{width:"abbreviated",context:"standalone"})||o.day(e,{width:"short",context:"standalone"})||o.day(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=6}set(e,t,o,n){return e=wt(e,o,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]};function Ri(r,e,t){let o=d(r,t?.in),n=si(o,t),s=e-n;return ee(o,s,t)}i(Ri,"setISODay");var I6=Ri;var Ni=class extends S{static{i(this,"ISODayParser")}priority=90;parse(e,t,o){let n=i(s=>s===0?7:s,"valueCallback");switch(t){case"i":case"ii":return C(t.length,e);case"io":return o.ordinalNumber(e,{unit:"day"});case"iii":return Y(o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"}),n);case"iiiii":return Y(o.day(e,{width:"narrow",context:"formatting"}),n);case"iiiiii":return Y(o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"}),n);default:return Y(o.day(e,{width:"wide",context:"formatting"})||o.day(e,{width:"abbreviated",context:"formatting"})||o.day(e,{width:"short",context:"formatting"})||o.day(e,{width:"narrow",context:"formatting"}),n)}}validate(e,t){return t>=1&&t<=7}set(e,t,o){return e=Ri(e,o),e.setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]};var Wi=class extends S{static{i(this,"AMPMParser")}priority=80;parse(e,t,o){switch(t){case"a":case"aa":case"aaa":return o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return o.dayPeriod(e,{width:"narrow",context:"formatting"});default:return o.dayPeriod(e,{width:"wide",context:"formatting"})||o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,o){return e.setHours(Ir(o),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]};var Fi=class extends S{static{i(this,"AMPMMidnightParser")}priority=80;parse(e,t,o){switch(t){case"b":case"bb":case"bbb":return o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return o.dayPeriod(e,{width:"narrow",context:"formatting"});default:return o.dayPeriod(e,{width:"wide",context:"formatting"})||o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,o){return e.setHours(Ir(o),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]};var Li=class extends S{static{i(this,"DayPeriodParser")}priority=80;parse(e,t,o){switch(t){case"B":case"BB":case"BBB":return o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return o.dayPeriod(e,{width:"narrow",context:"formatting"});default:return o.dayPeriod(e,{width:"wide",context:"formatting"})||o.dayPeriod(e,{width:"abbreviated",context:"formatting"})||o.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,o){return e.setHours(Ir(o),0,0,0),e}incompatibleTokens=["a","b","t","T"]};var Yi=class extends S{static{i(this,"Hour1to12Parser")}priority=70;parse(e,t,o){switch(t){case"h":return N(W.hour12h,e);case"ho":return o.ordinalNumber(e,{unit:"hour"});default:return C(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,o){let n=e.getHours()>=12;return n&&o<12?e.setHours(o+12,0,0,0):!n&&o===12?e.setHours(0,0,0,0):e.setHours(o,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]};var qi=class extends S{static{i(this,"Hour0to23Parser")}priority=70;parse(e,t,o){switch(t){case"H":return N(W.hour23h,e);case"Ho":return o.ordinalNumber(e,{unit:"hour"});default:return C(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,o){return e.setHours(o,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]};var ji=class extends S{static{i(this,"Hour0To11Parser")}priority=70;parse(e,t,o){switch(t){case"K":return N(W.hour11h,e);case"Ko":return o.ordinalNumber(e,{unit:"hour"});default:return C(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,o){return e.getHours()>=12&&o<12?e.setHours(o+12,0,0,0):e.setHours(o,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]};var Hi=class extends S{static{i(this,"Hour1To24Parser")}priority=70;parse(e,t,o){switch(t){case"k":return N(W.hour24h,e);case"ko":return o.ordinalNumber(e,{unit:"hour"});default:return C(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,o){let n=o<=24?o%24:o;return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]};var Ui=class extends S{static{i(this,"MinuteParser")}priority=60;parse(e,t,o){switch(t){case"m":return N(W.minute,e);case"mo":return o.ordinalNumber(e,{unit:"minute"});default:return C(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,o){return e.setMinutes(o,0,0),e}incompatibleTokens=["t","T"]};var $i=class extends S{static{i(this,"SecondParser")}priority=50;parse(e,t,o){switch(t){case"s":return N(W.second,e);case"so":return o.ordinalNumber(e,{unit:"second"});default:return C(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,o){return e.setSeconds(o,0),e}incompatibleTokens=["t","T"]};var Bi=class extends S{static{i(this,"FractionOfSecondParser")}priority=30;parse(e,t){let o=i(n=>Math.trunc(n*Math.pow(10,-t.length+3)),"valueCallback");return Y(C(t.length,e),o)}set(e,t,o){return e.setMilliseconds(o),e}incompatibleTokens=["t","T"]};var zi=class extends S{static{i(this,"ISOTimezoneWithZParser")}priority=10;parse(e,t){switch(t){case"X":return Re(_e.basicOptionalMinutes,e);case"XX":return Re(_e.basic,e);case"XXXX":return Re(_e.basicOptionalSeconds,e);case"XXXXX":return Re(_e.extendedOptionalSeconds,e);default:return Re(_e.extended,e)}}set(e,t,o){return t.timestampIsSet?e:y(e,e.getTime()-J(e)-o)}incompatibleTokens=["t","T","x"]};var Vi=class extends S{static{i(this,"ISOTimezoneParser")}priority=10;parse(e,t){switch(t){case"x":return Re(_e.basicOptionalMinutes,e);case"xx":return Re(_e.basic,e);case"xxxx":return Re(_e.basicOptionalSeconds,e);case"xxxxx":return Re(_e.extendedOptionalSeconds,e);default:return Re(_e.extended,e)}}set(e,t,o){return t.timestampIsSet?e:y(e,e.getTime()-J(e)-o)}incompatibleTokens=["t","T","X"]};var Ai=class extends S{static{i(this,"TimestampSecondsParser")}priority=40;parse(e){return pi(e)}set(e,t,o){return[y(e,o*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"};var Gi=class extends S{static{i(this,"TimestampMillisecondsParser")}priority=20;parse(e){return pi(e)}set(e,t,o){return[y(e,o),{timestampIsSet:!0}]}incompatibleTokens="*"};var Ji={G:new di,y:new yi,Y:new xi,R:new gi,u:new wi,Q:new bi,q:new vi,M:new Ti,L:new Di,w:new Mi,I:new Ei,d:new ki,D:new Ii,E:new Ci,e:new Pi,c:new _i,i:new Ni,a:new Wi,b:new Fi,B:new Li,h:new Yi,H:new qi,K:new ji,k:new Hi,m:new Ui,s:new $i,S:new Bi,X:new zi,x:new Vi,t:new Ai,T:new Gi};var Dx=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Sx=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Mx=/^'([^]*?)'?$/,Ox=/''/g,Ex=/\S/,kx=/[a-zA-Z]/;function Ki(r,e,t,o){let n=i(()=>y(o?.in||t,NaN),"invalidDate"),s=ii(),a=o?.locale??s.locale??De,u=o?.firstWeekContainsDate??o?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,c=o?.weekStartsOn??o?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0;if(!e)return r?n():d(t,o?.in);let f={firstWeekContainsDate:u,weekStartsOn:c,locale:a},l=[new li(o?.in,t)],p=e.match(Sx).map(w=>{let v=w[0];if(v in xt){let G=xt[v];return G(w,a.formatLong)}return w}).join("").match(Dx),m=[];for(let w of p){!o?.useAdditionalWeekYearTokens&&Zn(w)&&ho(w,e,r),!o?.useAdditionalDayOfYearTokens&&Xn(w)&&ho(w,e,r);let v=w[0],G=Ji[v];if(G){let{incompatibleTokens:te}=G;if(Array.isArray(te)){let rt=m.find(Qe=>te.includes(Qe.token)||Qe.token===v);if(rt)throw new RangeError(`The format string mustn't contain \`${rt.fullToken}\` and \`${w}\` at the same time`)}else if(G.incompatibleTokens==="*"&&m.length>0)throw new RangeError(`The format string mustn't contain \`${w}\` and any other token at the same time`);m.push({token:v,fullToken:w});let ae=G.run(r,w,a.match,f);if(!ae)return n();l.push(ae.setter),r=ae.rest}else{if(v.match(kx))throw new RangeError("Format string contains an unescaped latin alphabet character `"+v+"`");if(w==="''"?w="'":v==="'"&&(w=Ix(w)),r.indexOf(w)===0)r=r.slice(w.length);else return n()}}if(r.length>0&&Ex.test(r))return n();let h=l.map(w=>w.priority).sort((w,v)=>v-w).filter((w,v,G)=>G.indexOf(w)===v).map(w=>l.filter(v=>v.priority===w).sort((v,G)=>G.subPriority-v.subPriority)).map(w=>w[0]),x=d(t,o?.in);if(isNaN(+x))return n();let g={};for(let w of h){if(!w.validate(x,f))return n();let v=w.set(x,g,f);Array.isArray(v)?(x=v[0],Object.assign(g,v[1])):x=v}return x}i(Ki,"parse");function Ix(r){return r.match(Mx)[1].replace(Ox,"'")}i(Ix,"cleanEscapedString");var q4=Ki;function Sf(r,e,t){return ce(Ki(r,e,new Date,t))}i(Sf,"isMatch");var B4=Sf;function Mf(r,e){return d(r,e?.in).getDay()===1}i(Mf,"isMonday");var G4=Mf;function Of(r){return+d(r)<Date.now()}i(Of,"isPast");var X4=Of;function xo(r,e){let t=d(r,e?.in);return t.setMinutes(0,0,0),t}i(xo,"startOfHour");var rV=xo;function Qi(r,e,t){let[o,n]=O(t?.in,r,e);return+xo(o)==+xo(n)}i(Qi,"isSameHour");var aV=Qi;function Cr(r,e,t){let[o,n]=O(t?.in,r,e);return+U(o,t)==+U(n,t)}i(Cr,"isSameWeek");var dV=Cr;function Xi(r,e,t){return Cr(r,e,{...t,weekStartsOn:1})}i(Xi,"isSameISOWeek");var yV=Xi;function Ef(r,e,t){let[o,n]=O(t?.in,r,e);return+Oe(o)==+Oe(n)}i(Ef,"isSameISOWeekYear");var vV=Ef;function go(r,e){let t=d(r,e?.in);return t.setSeconds(0,0),t}i(go,"startOfMinute");var MV=go;function Zi(r,e){return+go(r)==+go(e)}i(Zi,"isSameMinute");var IV=Zi;function es(r,e,t){let[o,n]=O(t?.in,r,e);return o.getFullYear()===n.getFullYear()&&o.getMonth()===n.getMonth()}i(es,"isSameMonth");var RV=es;function ts(r,e,t){let[o,n]=O(t?.in,r,e);return+Ge(o)==+Ge(n)}i(ts,"isSameQuarter");var YV=ts;function wo(r,e){let t=d(r,e?.in);return t.setMilliseconds(0),t}i(wo,"startOfSecond");var UV=wo;function rs(r,e){return+wo(r)==+wo(e)}i(rs,"isSameSecond");var VV=rs;function os(r,e,t){let[o,n]=O(t?.in,r,e);return o.getFullYear()===n.getFullYear()}i(os,"isSameYear");var KV=os;function kf(r,e){return Qi(d(r,e?.in),R(e?.in||r))}i(kf,"isThisHour");var rA=kf;function If(r,e){return Xi(y(e?.in||r,r),R(e?.in||r))}i(If,"isThisISOWeek");var uA=If;function Cf(r){return Zi(r,R(r))}i(Cf,"isThisMinute");var pA=Cf;function Pf(r,e){return es(y(e?.in||r,r),R(e?.in||r))}i(Pf,"isThisMonth");var wA=Pf;function _f(r,e){return ts(y(e?.in||r,r),R(e?.in||r))}i(_f,"isThisQuarter");var MA=_f;function Rf(r){return rs(r,R(r))}i(Rf,"isThisSecond");var CA=Rf;function Nf(r,e){return Cr(y(e?.in||r,r),R(e?.in||r),e)}i(Nf,"isThisWeek");var FA=Nf;function Wf(r,e){return os(y(e?.in||r,r),R(e?.in||r))}i(Wf,"isThisYear");var UA=Wf;function Ff(r,e){return d(r,e?.in).getDay()===4}i(Ff,"isThursday");var VA=Ff;function Lf(r,e){return Ve(y(e?.in||r,r),R(e?.in||r))}i(Lf,"isToday");var XA=Lf;function Yf(r,e){return Ve(r,ee(R(e?.in||r),1),e)}i(Yf,"isTomorrow");var n5=Yf;function qf(r,e){return d(r,e?.in).getDay()===2}i(qf,"isTuesday");var u5=qf;function jf(r,e){return d(r,e?.in).getDay()===3}i(jf,"isWednesday");var d5=jf;function Hf(r,e,t){let o=+d(r,t?.in),[n,s]=[+d(e.start,t?.in),+d(e.end,t?.in)].sort((a,u)=>a-u);return o>=n&&o<=s}i(Hf,"isWithinInterval");var y5=Hf;function bt(r,e,t){return ee(r,-e,t)}i(bt,"subDays");var b5=bt;function Uf(r,e){return Ve(y(e?.in||r,r),bt(R(e?.in||r),1))}i(Uf,"isYesterday");var E5=Uf;function $f(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=9+Math.floor(o/10)*10;return t.setFullYear(n+1,0,0),t.setHours(0,0,0,0),d(t,e?.in)}i($f,"lastDayOfDecade");var P5=$f;function ns(r,e){let t=L(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=d(r,e?.in),s=n.getDay(),a=(s<o?-7:0)+6-(s-o);return n.setHours(0,0,0,0),n.setDate(n.getDate()+a),n}i(ns,"lastDayOfWeek");var F5=ns;function Bf(r,e){return ns(r,{...e,weekStartsOn:1})}i(Bf,"lastDayOfISOWeek");var j5=Bf;function zf(r,e){let t=be(r,e),o=y(e?.in||r,0);o.setFullYear(t+1,0,4),o.setHours(0,0,0,0);let n=X(o,e);return n.setDate(n.getDate()-1),n}i(zf,"lastDayOfISOWeekYear");var V5=zf;function Vf(r,e){let t=d(r,e?.in),o=t.getMonth(),n=o-o%3+3;return t.setMonth(n,0),t.setHours(0,0,0,0),t}i(Vf,"lastDayOfQuarter");var K5=Vf;function Af(r,e){let t=d(r,e?.in),o=t.getFullYear();return t.setFullYear(o+1,0,0),t.setHours(0,0,0,0),t}i(Af,"lastDayOfYear");var e8=Af;var Cx=/(\w)\1*|''|'(''|[^'])+('|$)|./g,Px=/^'([^]*?)'?$/,_x=/''/g,Rx=/[a-zA-Z]/;function Gf(r,e){let t=d(r);if(!ce(t))throw new RangeError("Invalid time value");let o=e.match(Cx);return o?o.map(s=>{if(s==="''")return"'";let a=s[0];if(a==="'")return Nx(s);let u=Ee[a];if(u)return u(t,s);if(a.match(Rx))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return s}).join(""):""}i(Gf,"lightFormat");function Nx(r){let e=r.match(Px);return e?e[1].replace(_x,"'"):r}i(Nx,"cleanEscapedString");var s8=Gf;function Jf({years:r,months:e,weeks:t,days:o,hours:n,minutes:s,seconds:a}){let u=0;r&&(u+=r*365.2425),e&&(u+=e*(365.2425/12)),t&&(u+=t*7),o&&(u+=o);let c=u*24*60*60;return n&&(c+=n*60*60),s&&(c+=s*60),a&&(c+=a),Math.trunc(c*1e3)}i(Jf,"milliseconds");var f8=Jf;function Kf(r){let e=r/Me;return Math.trunc(e)}i(Kf,"millisecondsToHours");var m8=Kf;function Qf(r){let e=r/de;return Math.trunc(e)}i(Qf,"millisecondsToMinutes");var g8=Qf;function Xf(r){let e=r/lr;return Math.trunc(e)}i(Xf,"millisecondsToSeconds");var T8=Xf;function Zf(r){let e=r/En;return Math.trunc(e)}i(Zf,"minutesToHours");var O8=Zf;function el(r){return Math.trunc(r*de)}i(el,"minutesToMilliseconds");var C8=el;function tl(r){return Math.trunc(r*pr)}i(tl,"minutesToSeconds");var N8=tl;function rl(r){let e=r/kn;return Math.trunc(e)}i(rl,"monthsToQuarters");var Y8=rl;function ol(r){let e=r/In;return Math.trunc(e)}i(ol,"monthsToYears");var U8=ol;function he(r,e,t){let o=e-gt(r,t);return o<=0&&(o+=7),ee(r,o,t)}i(he,"nextDay");var A8=he;function nl(r,e){return he(r,5,e)}i(nl,"nextFriday");var Q8=nl;function il(r,e){return he(r,1,e)}i(il,"nextMonday");var tG=il;function sl(r,e){return he(r,6,e)}i(sl,"nextSaturday");var iG=sl;function al(r,e){return he(r,0,e)}i(al,"nextSunday");var cG=al;function ul(r,e){return he(r,4,e)}i(ul,"nextThursday");var pG=ul;function cl(r,e){return he(r,2,e)}i(cl,"nextTuesday");var xG=cl;function fl(r,e){return he(r,3,e)}i(fl,"nextWednesday");var vG=fl;function dl(r,e){let t=i(()=>y(e?.in,NaN),"invalidDate"),o=e?.additionalDigits??2,n=Yx(r),s;if(n.date){let f=qx(n.date,o);s=jx(f.restDateString,f.year)}if(!s||isNaN(+s))return t();let a=+s,u=0,c;if(n.time&&(u=Hx(n.time),isNaN(u)))return t();if(n.timezone){if(c=Ux(n.timezone),isNaN(c))return t()}else{let f=new Date(a+u),l=d(0,e?.in);return l.setFullYear(f.getUTCFullYear(),f.getUTCMonth(),f.getUTCDate()),l.setHours(f.getUTCHours(),f.getUTCMinutes(),f.getUTCSeconds(),f.getUTCMilliseconds()),l}return d(a+u+c,e?.in)}i(dl,"parseISO");var is={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Wx=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Fx=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Lx=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Yx(r){let e={},t=r.split(is.dateTimeDelimiter),o;if(t.length>2)return e;if(/:/.test(t[0])?o=t[0]:(e.date=t[0],o=t[1],is.timeZoneDelimiter.test(e.date)&&(e.date=r.split(is.timeZoneDelimiter)[0],o=r.substr(e.date.length,r.length))),o){let n=is.timezone.exec(o);n?(e.time=o.replace(n[1],""),e.timezone=n[1]):e.time=o}return e}i(Yx,"splitDateString");function qx(r,e){let t=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),o=r.match(t);if(!o)return{year:NaN,restDateString:""};let n=o[1]?parseInt(o[1]):null,s=o[2]?parseInt(o[2]):null;return{year:s===null?n:s*100,restDateString:r.slice((o[1]||o[2]).length)}}i(qx,"parseYear");function jx(r,e){if(e===null)return new Date(NaN);let t=r.match(Wx);if(!t)return new Date(NaN);let o=!!t[4],n=bo(t[1]),s=bo(t[2])-1,a=bo(t[3]),u=bo(t[4]),c=bo(t[5])-1;if(o)return Ax(e,u,c)?$x(e,u,c):new Date(NaN);{let f=new Date(0);return!zx(e,s,a)||!Vx(e,n)?new Date(NaN):(f.setUTCFullYear(e,s,Math.max(n,a)),f)}}i(jx,"parseDate");function bo(r){return r?parseInt(r):1}i(bo,"parseDateUnit");function Hx(r){let e=r.match(Fx);if(!e)return NaN;let t=Da(e[1]),o=Da(e[2]),n=Da(e[3]);return Gx(t,o,n)?t*Me+o*de+n*1e3:NaN}i(Hx,"parseTime");function Da(r){return r&&parseFloat(r.replace(",","."))||0}i(Da,"parseTimeUnit");function Ux(r){if(r==="Z")return 0;let e=r.match(Lx);if(!e)return 0;let t=e[1]==="+"?-1:1,o=parseInt(e[2]),n=e[3]&&parseInt(e[3])||0;return Jx(o,n)?t*(o*Me+n*de):NaN}i(Ux,"parseTimezone");function $x(r,e,t){let o=new Date(0);o.setUTCFullYear(r,0,4);let n=o.getUTCDay()||7,s=(e-1)*7+t+1-n;return o.setUTCDate(o.getUTCDate()+s),o}i($x,"dayOfISOWeekYear");var Bx=[31,null,31,30,31,30,31,31,30,31,30,31];function ll(r){return r%400===0||r%4===0&&r%100!==0}i(ll,"isLeapYearIndex");function zx(r,e,t){return e>=0&&e<=11&&t>=1&&t<=(Bx[e]||(ll(r)?29:28))}i(zx,"validateDate");function Vx(r,e){return e>=1&&e<=(ll(r)?366:365)}i(Vx,"validateDayOfYearDate");function Ax(r,e,t){return e>=1&&e<=53&&t>=0&&t<=6}i(Ax,"validateWeekDate");function Gx(r,e,t){return r===24?e===0&&t===0:t>=0&&t<60&&e>=0&&e<60&&r>=0&&r<25}i(Gx,"validateTime");function Jx(r,e){return e>=0&&e<=59}i(Jx,"validateTimezone");var EG=dl;function pl(r,e){let t=r.match(/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/);return t?d(Date.UTC(+t[1],+t[2]-1,+t[3],+t[4]-(+t[9]||0)*(t[8]=="-"?-1:1),+t[5]-(+t[10]||0)*(t[8]=="-"?-1:1),+t[6],+((t[7]||"0")+"00").substring(0,3)),e?.in):d(NaN,e?.in)}i(pl,"parseJSON");var PG=pl;function ye(r,e,t){let o=gt(r,t)-e;return o<=0&&(o+=7),bt(r,o,t)}i(ye,"previousDay");var FG=ye;function ml(r,e){return ye(r,5,e)}i(ml,"previousFriday");var jG=ml;function hl(r,e){return ye(r,1,e)}i(hl,"previousMonday");var BG=hl;function yl(r,e){return ye(r,6,e)}i(yl,"previousSaturday");var GG=yl;function xl(r,e){return ye(r,0,e)}i(xl,"previousSunday");var XG=xl;function gl(r,e){return ye(r,4,e)}i(gl,"previousThursday");var rJ=gl;function wl(r,e){return ye(r,2,e)}i(wl,"previousTuesday");var sJ=wl;function bl(r,e){return ye(r,3,e)}i(bl,"previousWednesday");var fJ=bl;function vl(r){return Math.trunc(r*kn)}i(vl,"quartersToMonths");var mJ=vl;function Tl(r){let e=r/Cn;return Math.trunc(e)}i(Tl,"quartersToYears");var gJ=Tl;function Dl(r,e){let t=e?.nearestTo??1;if(t<1||t>12)return y(e?.in||r,NaN);let o=d(r,e?.in),n=o.getMinutes()/60,s=o.getSeconds()/60/60,a=o.getMilliseconds()/1e3/60/60,u=o.getHours()+n+s+a,c=e?.roundingMethod??"round",l=me(c)(u/t)*t;return o.setHours(l,0,0,0),o}i(Dl,"roundToNearestHours");var SJ=Dl;function Sl(r,e){let t=e?.nearestTo??1;if(t<1||t>30)return y(r,NaN);let o=d(r,e?.in),n=o.getSeconds()/60,s=o.getMilliseconds()/1e3/60,a=o.getMinutes()+n+s,u=e?.roundingMethod??"round",f=me(u)(a/t)*t;return o.setMinutes(f,0,0),o}i(Sl,"roundToNearestMinutes");var CJ=Sl;function Ml(r){let e=r/Lt;return Math.trunc(e)}i(Ml,"secondsToHours");var NJ=Ml;function Ol(r){return r*lr}i(Ol,"secondsToMilliseconds");var YJ=Ol;function El(r){let e=r/pr;return Math.trunc(e)}i(El,"secondsToMinutes");var UJ=El;function Pr(r,e,t){let o=d(r,t?.in),n=o.getFullYear(),s=o.getDate(),a=y(t?.in||r,0);a.setFullYear(n,e,15),a.setHours(0,0,0,0);let u=oi(a);return o.setMonth(e,Math.min(s,u)),o}i(Pr,"setMonth");var GJ=Pr;function kl(r,e,t){let o=d(r,t?.in);return isNaN(+o)?y(t?.in||r,NaN):(e.year!=null&&o.setFullYear(e.year),e.month!=null&&(o=Pr(o,e.month)),e.date!=null&&o.setDate(e.date),e.hours!=null&&o.setHours(e.hours),e.minutes!=null&&o.setMinutes(e.minutes),e.seconds!=null&&o.setSeconds(e.seconds),e.milliseconds!=null&&o.setMilliseconds(e.milliseconds),o)}i(kl,"set");var e9=kl;function Il(r,e,t){let o=d(r,t?.in);return o.setDate(e),o}i(Il,"setDate");var n9=Il;function Cl(r,e,t){let o=d(r,t?.in);return o.setMonth(0),o.setDate(e),o}i(Cl,"setDayOfYear");var u9=Cl;function Pl(r){let e={},t=L();for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&(r[o]===void 0?delete e[o]:e[o]=r[o]);Zu(e)}i(Pl,"setDefaultOptions");var d9=Pl;function _l(r,e,t){let o=d(r,t?.in);return o.setHours(e),o}i(_l,"setHours");var y9=_l;function Rl(r,e,t){let o=d(r,t?.in);return o.setMilliseconds(e),o}i(Rl,"setMilliseconds");var b9=Rl;function Nl(r,e,t){let o=d(r,t?.in);return o.setMinutes(e),o}i(Nl,"setMinutes");var S9=Nl;function Wl(r,e,t){let o=d(r,t?.in),n=Math.trunc(o.getMonth()/3)+1,s=e-n;return Pr(o,o.getMonth()+s*3)}i(Wl,"setQuarter");var I9=Wl;function Fl(r,e,t){let o=d(r,t?.in);return o.setSeconds(e),o}i(Fl,"setSeconds");var R9=Fl;function Ll(r,e,t){let o=L(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,s=ne(d(r,t?.in),Ut(r,t),t),a=y(t?.in||r,0);a.setFullYear(e,0,n),a.setHours(0,0,0,0);let u=Ut(a,t);return u.setDate(u.getDate()+s),u}i(Ll,"setWeekYear");var H9=Ll;function Yl(r,e,t){let o=d(r,t?.in);return isNaN(+o)?y(t?.in||r,NaN):(o.setFullYear(e),o)}i(Yl,"setYear");var V9=Yl;function ql(r,e){let t=d(r,e?.in),o=t.getFullYear(),n=Math.floor(o/10)*10;return t.setFullYear(n,0,1),t.setHours(0,0,0,0),t}i(ql,"startOfDecade");var K9=ql;function jl(r){return ze(Date.now(),r)}i(jl,"startOfToday");var eK=jl;function Hl(r){let e=R(r?.in),t=e.getFullYear(),o=e.getMonth(),n=e.getDate(),s=y(r?.in,0);return s.setFullYear(t,o,n+1),s.setHours(0,0,0,0),s}i(Hl,"startOfTomorrow");var iK=Hl;function Ul(r){let e=R(r?.in),t=e.getFullYear(),o=e.getMonth(),n=e.getDate(),s=R(r?.in);return s.setFullYear(t,o,n-1),s.setHours(0,0,0,0),s}i(Ul,"startOfYesterday");var cK=Ul;function ss(r,e,t){return $e(r,-e,t)}i(ss,"subMonths");var pK=ss;function $l(r,e,t){let{years:o=0,months:n=0,weeks:s=0,days:a=0,hours:u=0,minutes:c=0,seconds:f=0}=e,l=ss(r,n+o*12,t),p=bt(l,a+s*7,t),m=c+u*60,x=(f+m*60)*1e3;return y(t?.in||r,+p-x)}i($l,"sub");var wK=$l;function Bl(r,e,t){return Rn(r,-e,t)}i(Bl,"subBusinessDays");var DK=Bl;function zl(r,e,t){return Nn(r,-e,t)}i(zl,"subHours");var EK=zl;function Vl(r,e,t){return lt(r,-e,t)}i(Vl,"subMilliseconds");var PK=Vl;function Al(r,e,t){return mr(r,-e,t)}i(Al,"subMinutes");var WK=Al;function Gl(r,e,t){return hr(r,-e,t)}i(Gl,"subQuarters");var qK=Gl;function Jl(r,e,t){return Ln(r,-e,t)}i(Jl,"subSeconds");var $K=Jl;function Kl(r,e,t){return dt(r,-e,t)}i(Kl,"subWeeks");var AK=Kl;function Ql(r,e,t){return Yn(r,-e,t)}i(Ql,"subYears");var QK=Ql;function Xl(r){return Math.trunc(r*7)}i(Xl,"weeksToDays");var t7=Xl;function Zl(r){return Math.trunc(r*365.2425)}i(Zl,"yearsToDays");var i7=Zl;function ed(r){return Math.trunc(r*In)}i(ed,"yearsToMonths");var c7=ed;function td(r){return Math.trunc(r*Cn)}i(td,"yearsToQuarters");var p7=td;var nd=i(r=>Number.isFinite(r)?r:0,"toZeroIfInfinity");function Kx(r){return{days:Math.trunc(r/864e5),hours:Math.trunc(r/36e5%24),minutes:Math.trunc(r/6e4%60),seconds:Math.trunc(r/1e3%60),milliseconds:Math.trunc(r%1e3),microseconds:Math.trunc(nd(r*1e3)%1e3),nanoseconds:Math.trunc(nd(r*1e6)%1e3)}}i(Kx,"parseNumber");function Qx(r){return{days:r/86400000n,hours:r/3600000n%24n,minutes:r/60000n%60n,seconds:r/1000n%60n,milliseconds:r%1000n,microseconds:0n,nanoseconds:0n}}i(Qx,"parseBigint");function ka(r){switch(typeof r){case"number":{if(Number.isFinite(r))return Kx(r);break}case"bigint":return Qx(r)}throw new TypeError("Expected a finite number or bigint")}i(ka,"parseMilliseconds");var Xx=i(r=>r===0||r===0n,"isZero"),Zx=i((r,e)=>e===1||e===1n?r:`${r}s`,"pluralize"),eg=1e-7,tg=24n*60n*60n*1000n;function To(r,e){let t=typeof r=="bigint";if(!t&&!Number.isFinite(r))throw new TypeError("Expected a finite number or bigint");e={...e};let o=r<0?"-":"";r=r<0?-r:r,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let n=[],s=i((l,p)=>{let m=Math.floor(l*10**p+eg);return(Math.round(m)/10**p).toFixed(p)},"floorDecimals"),a=i((l,p,m,h)=>{if(!((n.length===0||!e.colonNotation)&&Xx(l)&&!(e.colonNotation&&m==="m"))){if(h??=String(l),e.colonNotation){let x=h.includes(".")?h.split(".")[0].length:h.length,g=n.length>0?2:1;h="0".repeat(Math.max(0,g-x))+h}else h+=e.verbose?" "+Zx(p,l):m;n.push(h)}},"add"),u=ka(r),c=BigInt(u.days);if(e.hideYearAndDays?a(BigInt(c)*24n+BigInt(u.hours),"hour","h"):(e.hideYear?a(c,"day","d"):(a(c/365n,"year","y"),a(c%365n,"day","d")),a(Number(u.hours),"hour","h")),a(Number(u.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&r<1e3&&!e.subSecondsAsDecimals){let l=Number(u.seconds),p=Number(u.milliseconds),m=Number(u.microseconds),h=Number(u.nanoseconds);if(a(l,"second","s"),e.formatSubMilliseconds)a(p,"millisecond","ms"),a(m,"microsecond","\xB5s"),a(h,"nanosecond","ns");else{let x=p+m/1e3+h/1e6,g=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,w=x>=1?Math.round(x):Math.ceil(x),v=g?x.toFixed(g):w;a(Number.parseFloat(v),"millisecond","ms",v)}}else{let l=(t?Number(r%tg):r)/1e3%60,p=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,m=s(l,p),h=e.keepDecimalsOnWholeSeconds?m:m.replace(/\.0+$/,"");a(Number.parseFloat(h),"second","s",h)}if(n.length===0)return o+"0"+(e.verbose?" milliseconds":"ms");let f=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(n=n.slice(0,Math.max(e.unitCount,1))),o+n.join(f)}i(To,"prettyMilliseconds");var Bt=or(rd(),1),id=or(od(),1);Bt.default.extend(id.default);var Do=class{static{i(this,"CronJob")}constructor(e,t,o){this.status="initial",this.nextExecutionUnix=0,this.cronExpression=t,this.jobFunction=o,this.cronParser=new fo.Cron(t)}checkExecution(){if(this.status==="stopped")return this.nextExecutionUnix;if(this.nextExecutionUnix===0&&this.getNextExecutionTime(),Date.now()>this.nextExecutionUnix){let e=this.jobFunction(this.nextExecutionUnix);e instanceof Promise&&e.catch(t=>console.log(t)),this.nextExecutionUnix=this.getNextExecutionTime()}return this.nextExecutionUnix}getNextExecutionTime(){return this.nextExecutionUnix=Date.now()+this.getTimeToNextExecution()}getTimeToNextExecution(){return this.cronParser.msToNext()}start(){this.status="started"}stop(){this.status="stopped"}};var Ia=class{static{i(this,"CronManager")}constructor(){this.status="stopped",this.cronjobs=new Se.ObjectMap,this.cycleWakeDeferred=null}wakeCycle(){this.cycleWakeDeferred&&this.cycleWakeDeferred.status==="pending"&&this.cycleWakeDeferred.resolve()}addCronjob(e,t){let o=new Do(this,e,t);return this.cronjobs.add(o),this.status==="started"&&(o.start(),this.wakeCycle()),o}removeCronjob(e){e.stop(),this.cronjobs.remove(e),this.status==="started"&&this.wakeCycle()}start(){if(this.status!=="started"){this.status="started";for(let e of this.cronjobs.getArray())e.start();this.runCronCycle()}}async runCronCycle(){for(;this.status==="started";){this.cycleWakeDeferred=new F.Deferred;let e=1/0;for(let t of this.cronjobs.getArray()){t.checkExecution();let o=t.getTimeToNextExecution();o<e&&(e=o)}if(e<1/0&&e>0)this.executionTimeout=new H.Timeout(e),await Promise.race([this.executionTimeout.promise,this.cycleWakeDeferred.promise]),this.executionTimeout.cancel();else{if(e<=0)continue;await this.cycleWakeDeferred.promise}}this.cycleWakeDeferred=null}stop(){this.status==="started"&&(this.status="stopped",this.executionTimeout&&this.executionTimeout.cancel(),this.wakeCycle());for(let e of this.cronjobs.getArray())e.stop()}};var vt={years:i((r=1)=>r*3154e7,"years"),months:i((r=1)=>r*2628e6,"months"),weeks:i((r=1)=>r*6048e5,"weeks"),days:i((r=1)=>r*864e5,"days"),hours:i((r=1)=>r*36e5,"hours"),minutes:i((r=1)=>r*6e4,"minutes"),seconds:i((r=1)=>r*1e3,"seconds")},Ca=i(r=>{let e=0,t=i(o=>{e=e+o},"addMilliSeconds");return r.years&&t(vt.years(r.years)),r.months&&t(vt.months(r.months)),r.weeks&&t(vt.weeks(r.weeks)),r.days&&t(vt.days(r.days)),r.hours&&t(vt.hours(r.hours)),r.minutes&&t(vt.minutes(r.minutes)),r.seconds&&t(vt.seconds(r.seconds)),e},"getMilliSecondsFromUnits"),rg=i(r=>To(r),"getMilliSecondsAsHumanReadableString"),og=i(r=>vo.formatDistanceToNow(new Date(r)),"getMilliSecondsAsHumanReadableAgoTime");var Pa=class r extends Date{static{i(this,"ExtendedDate")}static fromMillis(e){return new r(e)}static fromDate(e){return new r(e.getTime())}static fromEuropeanDate(e){let t=/(.*)\.(.*)\.(.*)/.exec(e),n=new Date(parseFloat(t[3]),parseFloat(t[2])-1,parseFloat(t[1])).getTime();return new r(n)}static fromHyphedDate(e){let t=new Date(e).getTime();return new r(t)}static fromEuropeanDateAndTime(e,t="12:00:00",o="Europe/Berlin"){let n=/(.*)\.(.*)\.(.*)/.exec(e),s=i(f=>`0${f}`.slice(-2),"sliceDate"),a=`${n[3]}-${s(n[2])}-${s(n[1])}T${t}`,c=Bt.default(a).toDate().getTime();return new r(c)}constructor(e=Date.now()){super(e)}exportToEuropeanDate(){let e=this.exportToUnits();return`${e.dayString}.${e.monthString}.${e.yearString}`}exportToHyphedSortableDate(){let e=this.exportToUnits();return`${e.yearString}-${e.monthString}-${e.dayString}`}exportToUnits(){let e=["January","February","March","April","May","June","July","August","September","October","November","December"],t=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];return{year:this.getFullYear(),yearString:`${this.getFullYear()}`,month:this.getMonth()+1,monthString:("0"+(this.getMonth()+1)).slice(-2),monthName:e[this.getMonth()],day:this.getDate(),dayString:("0"+this.getDate()).slice(-2),dayOfTheWeek:this.getDay(),dayOfTheWeekName:t[this.getDay()]}}format(e){return Bt.default(this.getTime()).format(e)}isToday(){return Bt.default(this.getTime()).isToday()}lessTimePassedToNow(e){let t=Ca(e);return Date.now()-this.getTime()<t}moreTimePassedToNow(e){return!this.lessTimePassedToNow(e)}};var _a=class{static{i(this,"HrtMeasurement")}constructor(){this.nanoSeconds=null,this.milliSeconds=null,this._milliStart=null,this._milliDiff=null,this._started=!1}start(){this._started=!0,this._milliStart=Date.now()}stop(){if(this._started===!1){console.log("Hasn't started yet");return}return this._milliDiff=Date.now()-this._milliStart,this.nanoSeconds=this._milliDiff*1e3,this.milliSeconds=this._milliDiff,this}reset(){this.nanoSeconds=null,this.milliSeconds=null,this._milliStart=null,this._milliDiff=null,this._started=!1}};var Ra=class{static{i(this,"Interval")}constructor(e){this.status="initial",this.statusAuthorization=null,this.intervalJobs=[],this.intervalMilliseconds=e}start(){this.status="started";let e=new Date;this.statusAuthorization=e,i(async()=>{for(;this.status==="started"&&this.statusAuthorization===e;)await H.delayFor(this.intervalMilliseconds),this.executeIntervalJobs()},"runInterval")()}stop(){this.status="stopped",this.statusAuthorization=null}addIntervalJob(e){this.intervalJobs.push(e)}executeIntervalJobs(){for(let e of this.intervalJobs)e()}};var Rr=class r{static{i(this,"TimeStamp")}static fromMilliSeconds(e){return new r(e)}static fromTimeStamp(e){let t=new r;return t.change=t.milliSeconds-e.milliSeconds,t}constructor(e){this.change=null,e?typeof e=="number"&&(this.date=new Date(e)):this.date=new Date,this.milliSeconds=this.date.getTime(),this.epochtime=Math.floor(this.milliSeconds/1e3)}isOlderThanOtherTimeStamp(e,t=0){return this.milliSeconds<e.milliSeconds-t}isOlderThan(e,t=0){return this.milliSeconds+t<e.milliSeconds}isYoungerThanOtherTimeStamp(e,t=0){return this.milliSeconds>e.milliSeconds+t}isYoungerThanMilliSeconds(e){let o=new r().epochtime-e,n=new r(o);return this.isYoungerThanOtherTimeStamp(n)}};var Na=class{static{i(this,"Timer")}get timeLeft(){return this.timeInMilliseconds-this.pausedAt.change}constructor(e){this.state="initiated",this.completedDeferred=F.defer(),this.timeInMilliseconds=e,this.completed=this.completedDeferred.promise}start(){if(!this.startedAt)this.currentTimeout=setTimeout(()=>{this.completedDeferred.resolve()},this.timeInMilliseconds),this.startedAt=new Rr;else throw new Error("timer has been started before. Please use resume instead")}pause(){this.startedAt&&(clearTimeout(this.currentTimeout),this.currentTimeout=null,this.pausedAt=Rr.fromTimeStamp(this.startedAt))}resume(){if(this.startedAt)this.currentTimeout=setTimeout(()=>{this.completedDeferred.resolve()},this.timeLeft);else throw new Error("timer has NOT been started before. Please use .start() instead")}reset(){this.pause(),this.startedAt=null,this.pausedAt=null}};var us=or(yd(),1);var Fa=class{static{i(this,"AsyncExecutionStack")}executionSlots=[];isProcessing=!1;nonExclusiveMaxConcurrency=1/0;nonExclusiveCurrentCount=0;nonExclusivePendingQueue=[];async getExclusiveExecutionSlot(e,t){let o=F.defer(),n={funcToExecute:e,executionDeferred:o,timeout:t,mode:"exclusive"};return this.executionSlots.push(n),this.processExecutionSlots(),o.promise}async getNonExclusiveExecutionSlot(e,t){let o=F.defer(),n={funcToExecute:e,executionDeferred:o,timeout:t,mode:"nonexclusive"};return this.executionSlots.push(n),this.processExecutionSlots(),o.promise}setNonExclusiveMaxConcurrency(e){if(!Number.isFinite(e)||e<1)throw new Error("nonExclusiveMaxConcurrency must be a finite number >= 1");this.nonExclusiveMaxConcurrency=e}getNonExclusiveMaxConcurrency(){return this.nonExclusiveMaxConcurrency}getActiveNonExclusiveCount(){return this.nonExclusiveCurrentCount}getPendingNonExclusiveCount(){return this.nonExclusivePendingQueue.length}async processExecutionSlots(){if(!this.isProcessing){for(this.isProcessing=!0;this.executionSlots.length>0;){let e=this.executionSlots[0];if(e.mode==="exclusive")await this.executeExclusiveSlot(e),this.executionSlots.shift();else{let t=[];for(;this.executionSlots.length>0&&this.executionSlots[0].mode==="nonexclusive";)t.push(this.executionSlots.shift());await this.executeNonExclusiveSlots(t)}}this.isProcessing=!1}}async executeExclusiveSlot(e){try{if(e.timeout){let t=new H.Timeout(e.timeout);try{let o=await Promise.race([e.funcToExecute(),t.promise.then(()=>{throw new Error("Timeout reached")})]);t.cancel(),e.executionDeferred.resolve(o)}catch(o){throw t.cancel(),o}}else{let t=await e.funcToExecute();e.executionDeferred.resolve(t)}}catch(t){e.executionDeferred.reject(t)}}async executeNonExclusiveSlots(e){let t=e.map(async o=>{await this.waitForNonExclusiveSlot();try{if(o.timeout){let n=new H.Timeout(o.timeout);try{let s=await Promise.race([o.funcToExecute(),n.promise.then(()=>{throw new Error("Timeout reached")})]);n.cancel(),o.executionDeferred.resolve(s)}catch(s){throw n.cancel(),s}}else{let n=await o.funcToExecute();o.executionDeferred.resolve(n)}}catch(n){o.executionDeferred.reject(n)}finally{this.releaseNonExclusiveSlot()}});await Promise.all(t)}waitForNonExclusiveSlot(){return this.nonExclusiveCurrentCount<this.nonExclusiveMaxConcurrency?(this.nonExclusiveCurrentCount++,Promise.resolve()):new Promise(e=>{this.nonExclusivePendingQueue.push(()=>{this.nonExclusiveCurrentCount++,e()})})}releaseNonExclusiveSlot(){this.nonExclusiveCurrentCount--;let e=this.nonExclusivePendingQueue.shift();e&&e()}};var La=class{static{i(this,"BackpressuredArray")}data;highWaterMark;hasSpace=new Pe.rxjs.Subject;itemsAvailable=new Pe.rxjs.Subject;isDestroyed=!1;constructor(e=16){this.data=[],this.highWaterMark=e}get length(){return this.data.length}push(e){this.data.push(e),this.itemsAvailable.next("itemsAvailable");let t=this.checkSpaceAvailable();return t&&this.hasSpace.next("hasSpace"),t}pushMany(e){for(let t of e)this.push(t);return this.checkSpaceAvailable()}shift(){let e=this.data.shift();return this.checkSpaceAvailable()&&this.hasSpace.next("hasSpace"),e}peek(){return this.data[0]}checkSpaceAvailable(){return this.data.length<this.highWaterMark}checkHasItems(){return this.data.length>0}waitForSpace(){return new Promise(e=>{if(this.checkSpaceAvailable()||this.isDestroyed)e();else{let t=this.hasSpace.subscribe({next:i(()=>{t.unsubscribe(),e()},"next"),complete:i(()=>{e()},"complete")})}})}waitForItems(){return new Promise(e=>{if(this.data.length>0||this.isDestroyed)e();else{let t=this.itemsAvailable.subscribe({next:i(()=>{t.unsubscribe(),e()},"next"),complete:i(()=>{e()},"complete")})}})}[Symbol.iterator](){return this.data[Symbol.iterator]()}destroy(){this.isDestroyed=!0,this.hasSpace.complete(),this.itemsAvailable.complete()}};var So=class r{static{i(this,"FastMap")}mapObject=new Map;isUniqueKey(e){return!this.mapObject.has(e)}has(e){return this.mapObject.has(e)}get size(){return this.mapObject.size}addToMap(e,t,o){return this.isUniqueKey(e)||o&&o.force?(this.mapObject.set(e,t),!0):!1}getByKey(e){return this.mapObject.get(e)}removeFromMap(e){let t=this.mapObject.get(e);return this.mapObject.delete(e),t}getKeys(){return Array.from(this.mapObject.keys())}values(){return Array.from(this.mapObject.values())}entries(){return Array.from(this.mapObject.entries())}clean(){this.mapObject.clear()}concat(e){let t=new r;for(let o of this.getKeys())t.addToMap(o,this.getByKey(o));for(let o of e.getKeys())t.addToMap(o,e.getByKey(o),{force:!0});return t}addAllFromOther(e){for(let t of e.getKeys())this.addToMap(t,e.getByKey(t),{force:!0})}async find(e){for(let t of this.getKeys()){let o=this.getByKey(t);if(await e(o))return o}}[Symbol.iterator](){return this.mapObject.entries()}};var xd=i((r="uni")=>`${r}xxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),"uni"),Vt=class r{static{i(this,"ObjectMap")}fastMap=new So;reverseMap=new Map;eventSubject=new Pe.rxjs.Subject;constructor(){}get length(){return this.fastMap.size}addMappedUnique(e,t){this.fastMap.addToMap(e,t),this.reverseMap.set(t,e)}getMappedUnique(e){return this.fastMap.getByKey(e)}removeMappedUnique(e){let t=this.fastMap.removeFromMap(e);return t!==void 0&&(this.reverseMap.delete(t),this.eventSubject.next({operation:"remove",payload:t})),t}add(e){let t=this.reverseMap.get(e);if(t!==void 0)return t;let o=xd("key");return this.addMappedUnique(o,e),this.eventSubject.next({operation:"add",payload:e}),o}addArray(e){for(let t of e)this.add(t)}checkForObject(e){return this.reverseMap.has(e)}getKeyForObject(e){return this.reverseMap.get(e)??null}async find(e){return this.fastMap.find(e)}findSync(e){for(let t of this.fastMap.getKeys())if(e(this.fastMap.getByKey(t)))return this.getMappedUnique(t)}async findOneAndRemove(e){let t=await this.find(e);return t&&this.remove(t),t}findOneAndRemoveSync(e){let t=this.findSync(e);return t&&this.remove(t),t}async forEach(e){for(let t of this.fastMap.getKeys())await e(this.fastMap.getByKey(t))}getOneAndRemove(){let e=this.fastMap.getKeys();if(e.length===0)return null;{let t=e[0],o=this.fastMap.removeFromMap(t);return this.reverseMap.delete(o),this.eventSubject.next({operation:"remove",payload:o}),o}}getArray(){return this.fastMap.values()}isEmpty(){return this.fastMap.size===0}remove(e){let t=this.reverseMap.get(e);if(t!==void 0){let o=this.fastMap.removeFromMap(t);return this.reverseMap.delete(o),this.eventSubject.next({operation:"remove",payload:o}),o}return null}wipe(){let e=this.fastMap.getKeys();for(let t of e){let o=this.fastMap.removeFromMap(t);this.reverseMap.delete(o),this.eventSubject.next({operation:"remove",payload:o})}}concat(e){let t=new r;t.fastMap.addAllFromOther(this.fastMap),t.fastMap.addAllFromOther(e.fastMap);for(let o of t.fastMap.getKeys())t.reverseMap.set(t.fastMap.getByKey(o),o);return t}addAllFromOther(e){this.fastMap.addAllFromOther(e.fastMap);for(let t of e.fastMap.getKeys())this.reverseMap.set(e.fastMap.getByKey(t),t)}map(e){return this.getArray().map(e)}filter(e){return this.getArray().filter(e)}reduce(e,t){return this.getArray().reduce(e,t)}[Symbol.iterator](){return this.getArray()[Symbol.iterator]()}destroy(){this.wipe(),this.reverseMap.clear(),this.eventSubject.complete()}};var Mo=class{static{i(this,"Interest")}options;interestMapRef;originalInterest;comparisonFunc;destructionTimer=new zt.Timer(1e4);isFullfilled=!1;isDestroyed=!1;fullfillmentStore=[];markLostTimeout=null;get comparisonString(){return this.comparisonFunc(this.originalInterest)}interestDeferred=new F.Deferred;interestFullfilled=this.interestDeferred.promise;fullfillInterest(e){this.isFullfilled=!0,this.fullfillmentStore=[],this.interestDeferred.resolve(e),this.destroy()}constructor(e,t,o,n){this.interestMapRef=e,this.originalInterest=t,this.comparisonFunc=o,this.options=n,this.destructionTimer.completed.then(()=>{this.isDestroyed||this.destroy()}),this.options?.markLostAfterDefault&&(this.markLostTimeout=new H.Timeout(this.options.markLostAfterDefault),this.markLostTimeout.promise.then(()=>{this.isDestroyed||this.markLost()}))}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.destructionTimer.reset(),this.markLostTimeout&&(this.markLostTimeout.cancel(),this.markLostTimeout=null),this.fullfillmentStore=[],this.interestMapRef.removeInterest(this),!this.isFullfilled&&this.options?.defaultFullfillment&&(this.isFullfilled=!0,this.interestDeferred.resolve(this.options.defaultFullfillment)))}markLost(){this.destructionTimer.start()}renew(){this.destructionTimer.reset()}};var Ya=class{static{i(this,"InterestMap")}options;interestObjectMap=new Vt;interestsByComparisonString=new Map;comparisonStringsByInterest=new WeakMap;comparisonFunc;constructor(e,t={}){this.comparisonFunc=e,this.options=t}async addInterest(e,t){let o=this.comparisonFunc(e),n,s=this.interestsByComparisonString.get(o);return s?(n=s,n.renew()):(n=new Mo(this,e,this.comparisonFunc,{markLostAfterDefault:this.options.markLostAfterDefault,defaultFullfillment:t}),this.interestObjectMap.add(n),this.comparisonStringsByInterest.set(n,o),this.interestsByComparisonString.set(o,n)),this.interestObservable.push(n),n}interestObservable=new Pe.ObservableIntake;removeInterest(e){if(!this.comparisonStringsByInterest.has(e))return;let t=this.comparisonStringsByInterest.get(e);this.interestObjectMap.remove(e),this.comparisonStringsByInterest.delete(e),this.interestsByComparisonString.get(t)===e&&this.interestsByComparisonString.delete(t)}checkInterest(e){let t=this.comparisonFunc(e);return this.checkInterestByString(t)}checkInterestByString(e){return this.interestsByComparisonString.has(e)}informLostInterest(e){let t=this.findInterest(e);t&&t.markLost()}findInterest(e){let t=this.comparisonFunc(e);return this.interestsByComparisonString.get(t)??null}destroy(){let e=this.interestObjectMap.getArray();for(let t of e)t.destroy();this.interestObjectMap.wipe(),this.interestsByComparisonString.clear(),this.interestObservable.signalComplete()}};var qa=class{static{i(this,"LimitedArray")}array=[];arrayLimit;constructor(e){this.arrayLimit=e}get length(){return this.array.length}addOne(e){this.array.unshift(e),this.array.length>this.arrayLimit&&(this.array.length=this.arrayLimit)}addMany(e){for(let t of e)this.addOne(t)}setLimit(e){this.arrayLimit=e,this.array.length>this.arrayLimit&&(this.array.length=this.arrayLimit)}getAverage(){if(this.array.length===0)return 0;if(typeof this.array[0]=="number"){let e=0;for(let t of this.array)e=e+t;return e/this.array.length}else return null}remove(e){let t=this.array.indexOf(e);return t!==-1?(this.array.splice(t,1),!0):!1}clear(){this.array.length=0}getArray(){return[...this.array]}[Symbol.iterator](){return this.array[Symbol.iterator]()}};var ja=class{static{i(this,"LoopTracker")}referenceObjectMap=new Vt;constructor(){}checkAndTrack(e){return this.referenceObjectMap.checkForObject(e)?!1:(this.referenceObjectMap.add(e),!0)}reset(){this.referenceObjectMap.wipe()}destroy(){this.referenceObjectMap.destroy()}};var Ha=class{static{i(this,"Stringmap")}_stringArray=[];_triggerUntilTrueFunctionArray=[];constructor(){}addString(e){this._stringArray.push(e),this.notifyTrigger()}addStringArray(e){for(let t of e)this.addString(t)}removeString(e){this._stringArray=this._stringArray.filter(t=>t!==e),this.notifyTrigger()}wipe(){this._stringArray=[],this.notifyTrigger()}checkString(e){return this._stringArray.indexOf(e)!==-1}checkMinimatch(e){let t=new Zr.SmartMatch(e),o=!1;for(let n of this._stringArray)t.match(n)&&(o=!0);return o}checkIsEmpty(){return this._stringArray.length===0}getStringArray(){let e=[];for(let t of this._stringArray)e.push(t);return e}registerUntilTrue(e,t){let o=F.defer();return this._triggerUntilTrueFunctionArray.push(()=>{let n=e(this.getStringArray());return n===!0&&(t&&t(),o.resolve()),n}),this.notifyTrigger(),o.promise}notifyTrigger(){let e=this._triggerUntilTrueFunctionArray.filter(t=>!t());this._triggerUntilTrueFunctionArray=e}destroy(){this._stringArray=[],this._triggerUntilTrueFunctionArray=[]}};var Oo=class{static{i(this,"TimedAggregtor")}options;storageArray=[];isStopped=!1;constructor(e){this.options=e}aggregationTimer;checkAggregationStatus(){if(this.isStopped)return;let e=i(()=>{this.aggregationTimer=new zt.Timer(this.options.aggregationIntervalInMillis),this.aggregationTimer.completed.then(()=>{if(this.isStopped){this.aggregationTimer=null;return}let t=this.storageArray;if(t.length===0){this.aggregationTimer=null;return}this.storageArray=[],e(),this.options.functionForAggregation(t)}),this.aggregationTimer.start()},"addAggregationTimer");this.aggregationTimer||e()}add(e){this.isStopped||(this.storageArray.push(e),this.checkAggregationStatus())}stop(e=!1){if(this.isStopped=!0,this.aggregationTimer&&(this.aggregationTimer.reset(),this.aggregationTimer=null),e&&this.storageArray.length>0){let t=this.storageArray;this.storageArray=[],this.options.functionForAggregation(t)}else this.storageArray=[]}restart(){this.isStopped=!1}};var Ua=class{static{i(this,"Tree")}symbolTree;constructor(){this.symbolTree=new us.default}initialize(e){return this.symbolTree.initialize(e)}hasChildren(e){return this.symbolTree.hasChildren(e)}firstChild(e){return this.symbolTree.firstChild(e)}lastChild(e){return this.symbolTree.lastChild(e)}previousSibling(e){return this.symbolTree.previousSibling(e)}nextSibling(e){return this.symbolTree.nextSibling(e)}parent(e){return this.symbolTree.parent(e)}lastInclusiveDescendant(e){return this.symbolTree.lastInclusiveDescendant(e)}preceding(e,t){return this.symbolTree.preceding(e,t)}following(e,t){return this.symbolTree.following(e,t)}childrenToArray(e,t){return this.symbolTree.childrenToArray(e,t)}ancestorsToArray(e,t){return this.symbolTree.ancestorsToArray(e,t)}treeToArray(e,t){return this.symbolTree.treeToArray(e,t)}childrenIterator(e,t){return this.symbolTree.childrenIterator(e,t)}previousSiblingsIterator(e){return this.symbolTree.previousSiblingsIterator(e)}nextSiblingsIterator(e){return this.symbolTree.nextSiblingsIterator(e)}ancestorsIterator(e){return this.symbolTree.ancestorsIterator(e)}treeIterator(e,t){return this.symbolTree.treeIterator(e,t)}index(e){return this.symbolTree.index(e)}childrenCount(e){return this.symbolTree.childrenCount(e)}compareTreePosition(e,t){return this.symbolTree.compareTreePosition(e,t)}remove(e){return this.symbolTree.remove(e)}insertBefore(e,t){return this.symbolTree.insertBefore(e,t)}insertAfter(e,t){return this.symbolTree.insertAfter(e,t)}prependChild(e,t){return this.symbolTree.prependChild(e,t)}appendChild(e,t){return this.symbolTree.appendChild(e,t)}toJsonWithHierachy(e){let t=i(o=>{let n=[];if(this.hasChildren(o)){let s=this.childrenToArray(o,{});for(let a of s)n.push(t(a))}return{data:o,children:n}},"buildNode");return t(e)}fromJsonWithHierachy(e,t){let o=i((n,s)=>{let a=t?t(n.data):n.data;this.initialize(a),s&&this.appendChild(s,a);for(let u of n.children)o(u,a);return a},"buildTree");return o(e)}};var At={};A(At,{base64ToUint8Array:()=>kg,ensurePureUint8Array:()=>Pg,isBufferLike:()=>Cg,isUint8Array:()=>Ig,uInt8ArrayExtras:()=>Og,uInt8ArrayToBase64:()=>Eg});var Ot={};A(Ot,{areUint8ArraysEqual:()=>pg,assertUint8Array:()=>Mt,assertUint8ArrayOrArrayBuffer:()=>Td,base64ToString:()=>wg,base64ToUint8Array:()=>Od,compareUint8Arrays:()=>mg,concatUint8Arrays:()=>dg,getUintBE:()=>Dg,hexToUint8Array:()=>Tg,includes:()=>Sg,indexOf:()=>Ed,isUint8Array:()=>$a,stringToBase64:()=>gg,stringToUint8Array:()=>Sd,toUint8Array:()=>lg,uint8ArrayToBase64:()=>Md,uint8ArrayToHex:()=>vg,uint8ArrayToString:()=>Dd});var sg=Object.prototype.toString,ag="[object Uint8Array]",ug="[object ArrayBuffer]";function gd(r,e,t){return r?r.constructor===e?!0:sg.call(r)===t:!1}i(gd,"isType");function $a(r){return gd(r,Uint8Array,ag)}i($a,"isUint8Array");function cg(r){return gd(r,ArrayBuffer,ug)}i(cg,"isArrayBuffer");function fg(r){return $a(r)||cg(r)}i(fg,"isUint8ArrayOrArrayBuffer");function Mt(r){if(!$a(r))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof r}\``)}i(Mt,"assertUint8Array");function Td(r){if(!fg(r))throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof r}\``)}i(Td,"assertUint8ArrayOrArrayBuffer");function lg(r){if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new TypeError(`Unsupported value, got \`${typeof r}\`.`)}i(lg,"toUint8Array");function dg(r,e){if(r.length===0)return new Uint8Array(0);e??=r.reduce((n,s)=>n+s.length,0);let t=new Uint8Array(e),o=0;for(let n of r)Mt(n),t.set(n,o),o+=n.length;return t}i(dg,"concatUint8Arrays");function pg(r,e){if(Mt(r),Mt(e),r===e)return!0;if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}i(pg,"areUint8ArraysEqual");function mg(r,e){Mt(r),Mt(e);let t=Math.min(r.length,e.length);for(let o=0;o<t;o++){let n=r[o]-e[o];if(n!==0)return Math.sign(n)}return Math.sign(r.length-e.length)}i(mg,"compareUint8Arrays");var wd={utf8:new globalThis.TextDecoder("utf8")};function Dd(r,e="utf8"){return Td(r),wd[e]??=new globalThis.TextDecoder(e),wd[e].decode(r)}i(Dd,"uint8ArrayToString");function Eo(r){if(typeof r!="string")throw new TypeError(`Expected \`string\`, got \`${typeof r}\``)}i(Eo,"assertString");var hg=new globalThis.TextEncoder;function Sd(r){return Eo(r),hg.encode(r)}i(Sd,"stringToUint8Array");function yg(r){return r.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}i(yg,"base64ToBase64Url");function xg(r){let e=r.replaceAll("-","+").replaceAll("_","/"),t=(4-e.length%4)%4;return e+"=".repeat(t)}i(xg,"base64UrlToBase64");var bd=65535;function Md(r,{urlSafe:e=!1}={}){Mt(r);let t="";for(let o=0;o<r.length;o+=bd){let n=r.subarray(o,o+bd);t+=globalThis.btoa(String.fromCodePoint.apply(void 0,n))}return e?yg(t):t}i(Md,"uint8ArrayToBase64");function Od(r){return Eo(r),Uint8Array.from(globalThis.atob(xg(r)),e=>e.codePointAt(0))}i(Od,"base64ToUint8Array");function gg(r,{urlSafe:e=!1}={}){return Eo(r),Md(Sd(r),{urlSafe:e})}i(gg,"stringToBase64");function wg(r){return Eo(r),Dd(Od(r))}i(wg,"base64ToString");var bg=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function vg(r){Mt(r);let e="";for(let t=0;t<r.length;t++)e+=bg[r[t]];return e}i(vg,"uint8ArrayToHex");var vd={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function Tg(r){if(Eo(r),r.length%2!==0)throw new Error("Invalid Hex string length.");let e=r.length/2,t=new Uint8Array(e);for(let o=0;o<e;o++){let n=vd[r[o*2]],s=vd[r[o*2+1]];if(n===void 0||s===void 0)throw new Error(`Invalid Hex character encountered at position ${o*2}`);t[o]=n<<4|s}return t}i(Tg,"hexToUint8Array");function Dg(r){let{byteLength:e}=r;if(e===6)return r.getUint16(0)*2**32+r.getUint32(2);if(e===5)return r.getUint8(0)*2**32+r.getUint32(1);if(e===4)return r.getUint32(0);if(e===3)return r.getUint8(0)*2**16+r.getUint16(1);if(e===2)return r.getUint16(0);if(e===1)return r.getUint8(0)}i(Dg,"getUintBE");function Ed(r,e){let t=r.length,o=e.length;if(o===0||o>t)return-1;let n=t-o;for(let s=0;s<=n;s++){let a=!0;for(let u=0;u<o;u++)if(r[s+u]!==e[u]){a=!1;break}if(a)return s}return-1}i(Ed,"indexOf");function Sg(r,e){return Ed(r,e)!==-1}i(Sg,"includes");var Og=Ot;function Eg(r){return Ot.uint8ArrayToBase64(r)}i(Eg,"uInt8ArrayToBase64");function kg(r){return Ot.base64ToUint8Array(r)}i(kg,"base64ToUint8Array");var Ig=i(r=>Ot.isUint8Array(r),"isUint8Array");function Cg(r){return r&&typeof r.byteLength=="number"?!0:typeof Buffer<"u"&&Buffer.isBuffer?Buffer.isBuffer(r):!1}i(Cg,"isBufferLike");function Pg(r){let e=new Uint8Array(r.length);return e.set(r),e}i(Pg,"ensurePureUint8Array");var Po={};A(Po,{Guard:()=>ko,GuardError:()=>Io,GuardSet:()=>Co,passGuardsOrReject:()=>_g});var ko=class{static{i(this,"Guard")}constructor(e,t){this.guardFunction=e,this.options=t||{}}async exec(e){return await this.guardFunction(e)}async getFailedHint(e){return await this.exec(e)?null:this.options.failedHint||null}};var Io=class extends Error{static{i(this,"GuardError")}constructor(e){super(e),this.name="GuardError"}};var Co=class extends ko{static{i(this,"GuardSet")}constructor(e=[]){super(async t=>this.allGuardsPass(t)),this.guards=e}async execAllWithData(e,t={mode:"parallel",stopOnFail:!1}){let o=[];for(let s of this.guards){let a=s.exec(e);if(t.mode==="serial"&&await a,o.push(a),t.stopOnFail&&!await a)return await Promise.all(o)}return await Promise.all(o)}async allGuardsPass(e,t={mode:"parallel",stopOnFail:!1}){return(await this.execAllWithData(e,t)).every(n=>n)}async anyGuardsPass(e){return(await this.execAllWithData(e,{mode:"parallel",stopOnFail:!1})).some(o=>o)}async getFailedHint(e){for(let t of this.guards){let o=await t.getFailedHint(e);if(o)return o}return null}};var _g=i(async(r,e)=>{let t=new Co(e);if(!await t.allGuardsPass(r)){let n=await t.getFailedHint(r);throw new Io(`Guards failed:
4
4
  ${n}
5
- `)}},"passGuardsOrReject");var Ur={};V(Ur,{CacheManager:()=>Br,CacheStore:()=>Ar,InterceptorManager:()=>Rr,RequestDeduplicator:()=>qr,RetryManager:()=>Hr,WebrequestClient:()=>Kt,createConditionalHeaders:()=>Ms,defaultCacheMaxEntries:()=>Ro,extractCacheMetadata:()=>Qe,headersToObject:()=>ks,isFresh:()=>Ss,isWebrequestTimeoutError:()=>Fo,objectToHeaders:()=>Ld,requiresRevalidation:()=>Lr,webrequest:()=>ke});var Rr=class{static{i(this,"InterceptorManager")}constructor(){this.requestInterceptors=[],this.responseInterceptors=[],this.errorInterceptors=[]}addRequestInterceptor(e){this.requestInterceptors.push(e)}addResponseInterceptor(e){this.responseInterceptors.push(e)}addErrorInterceptor(e){this.errorInterceptors.push(e)}removeRequestInterceptor(e){let t=this.requestInterceptors.indexOf(e);t>-1&&this.requestInterceptors.splice(t,1)}removeResponseInterceptor(e){let t=this.responseInterceptors.indexOf(e);t>-1&&this.responseInterceptors.splice(t,1)}removeErrorInterceptor(e){let t=this.errorInterceptors.indexOf(e);t>-1&&this.errorInterceptors.splice(t,1)}clearAll(){this.requestInterceptors=[],this.responseInterceptors=[],this.errorInterceptors=[]}async processRequest(e){let t=e;for(let o of this.requestInterceptors)try{t=await o(t)}catch(n){throw await this.processError(n instanceof Error?n:new Error(String(n)))}return t}async processResponse(e){let t=e;for(let o of this.responseInterceptors)try{t=await o(t)}catch(n){throw await this.processError(n instanceof Error?n:new Error(String(n)))}return t}async processError(e){let t=e;for(let o of this.errorInterceptors)try{t=await o(t)}catch(n){t=n instanceof Error?n:new Error(String(n))}return t}getInterceptorCounts(){return{request:this.requestInterceptors.length,response:this.responseInterceptors.length,error:this.errorInterceptors.length}}};var Ze={};V(Ze,{Smartenv:()=>qa});var qa=class{static{i(this,"Smartenv")}constructor(){this.loadedScripts=[]}async getEnvAwareModule(e){if(this.isNode)return await this.getSafeNodeModule(e.nodeModuleName);if(this.isBrowser)return await this.getSafeWebModule(e.webUrlArg,e.getFunction);console.error("platform for loading not supported by smartenv")}async getSafeNodeModule(e,t){if(!this.isNode&&!this.isDeno&&!this.isBun){console.error(`You tried to load a server module in a wrong context: ${e}. This does not throw.`);return}let o=await new Function(`return import('${e}')`)();return t&&await t(o),o}async getSafeWebModule(e,t){if(!this.isBrowser){console.error("You tried to load a web module in a wrong context");return}if(this.loadedScripts.includes(e))return t();this.loadedScripts.push(e);let o=R.defer(),n=globalThis;if(n.importScripts)n.importScripts(e),o.resolve();else{let s=document.createElement("script");s.onload=()=>{o.resolve()},s.src=e,document.head.appendChild(s)}return await o.promise,t()}get runtimeEnv(){let e=globalThis;return typeof e.Deno<"u"&&typeof e.Deno.version<"u"?"deno":typeof e.Bun<"u"&&typeof e.Bun.version<"u"?"bun":typeof globalThis.process<"u"&&typeof globalThis.process?.versions?.node<"u"?"node":(typeof globalThis.window<"u"&&typeof globalThis.document<"u","browser")}get isBrowser(){return this.runtimeEnv==="browser"}get isNode(){return this.runtimeEnv==="node"}get isDeno(){return this.runtimeEnv==="deno"}get isBun(){return this.runtimeEnv==="bun"}get userAgent(){return this.isBrowser?navigator.userAgent:"undefined"}get nodeVersion(){return this.isNode?process.version:"undefined"}get denoVersion(){return this.isDeno?globalThis.Deno?.version?.deno??"undefined":"undefined"}get bunVersion(){return this.isBun?globalThis.Bun?.version??"undefined":"undefined"}async getSafeModuleFor(e,t,o){let n;if(Array.isArray(e)?n=e.flatMap(s=>s==="server"?["node","deno","bun"]:[s]):e==="server"?n=["node","deno","bun"]:n=[e],!n.includes(this.runtimeEnv)){console.warn(`Module "${t}" requested for runtime(s) [${n.join(", ")}] but current runtime is "${this.runtimeEnv}". Skipping load.`);return}if(this.isNode||this.isDeno||this.isBun)return await this.getSafeNodeModule(t);if(this.isBrowser){if(!o){console.error(`Browser module load requires getFunction parameter for "${t}"`);return}return await this.getSafeWebModule(t,o)}}get isCI(){return this.isNode?!!process.env.CI:!1}async isMacAsync(){return this.isNode||this.isDeno||this.isBun?(await this.getSafeNodeModule(this.isDeno?"node:os":"os"))?.platform()==="darwin":!1}async isWindowsAsync(){return this.isNode||this.isDeno||this.isBun?(await this.getSafeNodeModule(this.isDeno?"node:os":"os"))?.platform()==="win32":!1}async isLinuxAsync(){return this.isNode||this.isDeno||this.isBun?(await this.getSafeNodeModule(this.isDeno?"node:os":"os"))?.platform()==="linux":!1}async printEnv(){this.isNode?(console.log("running on NODE"),console.log("node version is "+this.nodeVersion)):this.isDeno?(console.log("running on DENO"),console.log("deno version is "+this.denoVersion)):this.isBun?(console.log("running on BUN"),console.log("bun version is "+this.bunVersion)):(console.log("running on BROWSER"),console.log("browser is "+this.userAgent))}};var Jt={};V(Jt,{Smartjson:()=>Ka,deepEqualJsonLStrings:()=>ew,deepEqualObjects:()=>Pd,foldDec:()=>Zg,parse:()=>bs,parseBase64:()=>Xg,parseJsonL:()=>Ja,stableOneWayStringify:()=>Qg,stringify:()=>Qt,stringifyBase64:()=>Kg,stringifyJsonL:()=>Gg,stringifyPretty:()=>Jg});var Wr={};V(Wr,{Base64:()=>ps,Domain:()=>ys,GitRepo:()=>xs,base64:()=>Fr,create:()=>fs,docker:()=>ls,indent:()=>ds,normalize:()=>ms,type:()=>hs});var fs={};V(fs,{createCryptoRandomString:()=>Cg,createRandomString:()=>_g});var Ua=rr(Bs(),1);var Ig=i((r,e)=>{if(typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.getRandomValues){let t=e-r,o=new Uint32Array(1);return globalThis.crypto.getRandomValues(o),r+o[0]%t}else return Math.floor(Math.random()*(e-r))+r},"getRandomInt"),Eg=i((r,e,t)=>{let o={A:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",a:"abcdefghijklmnopqrstuvwxyz",0:"0123456789","!":"!@#$%^&*()_+-=[]{}|;:,.<>?","*":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=[]{}|;:,.<>?"},n=r;e&&e>r.length?n=r.repeat(Math.ceil(e/r.length)).slice(0,e):e&&(n=r.slice(0,e));let s="";for(let a of n)if(o[a]){let u=o[a],c=Ig(0,u.length);s+=u[c]}else s+=a;return s},"customRandomatic"),_g=i((r,e,t)=>Eg(r,e,t),"createRandomString"),Cg=i(()=>Ua.uni(),"createCryptoRandomString");var ls={};V(ls,{makeEnvObject:()=>Pg});var Pg=i(function(r){let e={},t=/(.*)=(.*)/;if(typeof r<"u")for(let o in r){let n=t.exec(r[o]);e[n[1]]=n[2]}return e},"makeEnvObject");var ds={};V(ds,{indent:()=>Rg,indentWithPrefix:()=>Fg,normalize:()=>Wg});var ja=i(r=>{let e=r.split(`
6
- `);return Ng(e)},"splitStringAtLineBreak"),$a=i(r=>{let e="";for(let t of r)e=e+t+`
7
- `;return e},"joinStringWithLineBreaks"),Ng=i(r=>{let e=/^[\s]*$/;return e.test(r[0])&&r.shift(),e.test(r[r.length-1])&&r.pop(),r},"cleanStringArray"),Rg=i((r,e)=>{let t=ja(r);for(let n of t)n=" ".repeat(e)+n;return $a(t)},"indent"),Fg=i((r,e)=>{let t,o=ja(r),n=[];for(let s of o)n.push(e+s);return t=$a(n),t},"indentWithPrefix"),Wg=i(r=>{let e,t=ja(r),o,n=/^(\s*)/,s=/^(\s*)$/;for(let u of t){let c=n.exec(u)[1];(typeof o>"u"||c.length<o)&&!s.test(u)&&(o=c.length)}let a=[];for(let u of t)a.push(u.substr(o));return e=$a(a),e},"normalize");var ms={};V(ms,{replaceAll:()=>Dd,standard:()=>Lg});var Dd=i((r,e,t)=>r.replace(new RegExp(e,"g"),t),"replaceAll"),Ag=i(r=>{let e=r.split(`
5
+ `)}},"passGuardsOrReject");var Br={};A(Br,{CacheManager:()=>Hr,CacheStore:()=>Yr,InterceptorManager:()=>Wr,RequestDeduplicator:()=>$r,RetryManager:()=>Ur,WebrequestClient:()=>Kt,createConditionalHeaders:()=>Ss,defaultCacheMaxEntries:()=>No,extractCacheMetadata:()=>Je,headersToObject:()=>Ms,isFresh:()=>Ds,isWebrequestTimeoutError:()=>Wo,objectToHeaders:()=>$d,requiresRevalidation:()=>qr,webrequest:()=>se});var Wr=class{static{i(this,"InterceptorManager")}constructor(){this.requestInterceptors=[],this.responseInterceptors=[],this.errorInterceptors=[]}addRequestInterceptor(e){this.requestInterceptors.push(e)}addResponseInterceptor(e){this.responseInterceptors.push(e)}addErrorInterceptor(e){this.errorInterceptors.push(e)}removeRequestInterceptor(e){let t=this.requestInterceptors.indexOf(e);t>-1&&this.requestInterceptors.splice(t,1)}removeResponseInterceptor(e){let t=this.responseInterceptors.indexOf(e);t>-1&&this.responseInterceptors.splice(t,1)}removeErrorInterceptor(e){let t=this.errorInterceptors.indexOf(e);t>-1&&this.errorInterceptors.splice(t,1)}clearAll(){this.requestInterceptors=[],this.responseInterceptors=[],this.errorInterceptors=[]}async processRequest(e){let t=e;for(let o of this.requestInterceptors)try{t=await o(t)}catch(n){throw await this.processError(n instanceof Error?n:new Error(String(n)))}return t}async processResponse(e){let t=e;for(let o of this.responseInterceptors)try{t=await o(t)}catch(n){throw await this.processError(n instanceof Error?n:new Error(String(n)))}return t}async processError(e){let t=e;for(let o of this.errorInterceptors)try{t=await o(t)}catch(n){t=n instanceof Error?n:new Error(String(n))}return t}getInterceptorCounts(){return{request:this.requestInterceptors.length,response:this.responseInterceptors.length,error:this.errorInterceptors.length}}};var Ze={};A(Ze,{Smartenv:()=>Ba});var Ba=class{static{i(this,"Smartenv")}constructor(){this.loadedScripts=[]}async getEnvAwareModule(e){if(this.isNode)return await this.getSafeNodeModule(e.nodeModuleName);if(this.isBrowser)return await this.getSafeWebModule(e.webUrlArg,e.getFunction);console.error("platform for loading not supported by smartenv")}async getSafeNodeModule(e,t){if(!this.isNode&&!this.isDeno&&!this.isBun){console.error(`You tried to load a server module in a wrong context: ${e}. This does not throw.`);return}let o=await new Function(`return import('${e}')`)();return t&&await t(o),o}async getSafeWebModule(e,t){if(!this.isBrowser){console.error("You tried to load a web module in a wrong context");return}if(this.loadedScripts.includes(e))return t();this.loadedScripts.push(e);let o=F.defer(),n=globalThis;if(n.importScripts)n.importScripts(e),o.resolve();else{let s=document.createElement("script");s.onload=()=>{o.resolve()},s.src=e,document.head.appendChild(s)}return await o.promise,t()}get runtimeEnv(){let e=globalThis;return typeof e.Deno<"u"&&typeof e.Deno.version<"u"?"deno":typeof e.Bun<"u"&&typeof e.Bun.version<"u"?"bun":typeof globalThis.process<"u"&&typeof globalThis.process?.versions?.node<"u"?"node":(typeof globalThis.window<"u"&&typeof globalThis.document<"u","browser")}get isBrowser(){return this.runtimeEnv==="browser"}get isNode(){return this.runtimeEnv==="node"}get isDeno(){return this.runtimeEnv==="deno"}get isBun(){return this.runtimeEnv==="bun"}get userAgent(){return this.isBrowser?navigator.userAgent:"undefined"}get nodeVersion(){return this.isNode?process.version:"undefined"}get denoVersion(){return this.isDeno?globalThis.Deno?.version?.deno??"undefined":"undefined"}get bunVersion(){return this.isBun?globalThis.Bun?.version??"undefined":"undefined"}async getSafeModuleFor(e,t,o){let n;if(Array.isArray(e)?n=e.flatMap(s=>s==="server"?["node","deno","bun"]:[s]):e==="server"?n=["node","deno","bun"]:n=[e],!n.includes(this.runtimeEnv)){console.warn(`Module "${t}" requested for runtime(s) [${n.join(", ")}] but current runtime is "${this.runtimeEnv}". Skipping load.`);return}if(this.isNode||this.isDeno||this.isBun)return await this.getSafeNodeModule(t);if(this.isBrowser){if(!o){console.error(`Browser module load requires getFunction parameter for "${t}"`);return}return await this.getSafeWebModule(t,o)}}get isCI(){return this.isNode?!!process.env.CI:!1}async isMacAsync(){return this.isNode||this.isDeno||this.isBun?(await this.getSafeNodeModule(this.isDeno?"node:os":"os"))?.platform()==="darwin":!1}async isWindowsAsync(){return this.isNode||this.isDeno||this.isBun?(await this.getSafeNodeModule(this.isDeno?"node:os":"os"))?.platform()==="win32":!1}async isLinuxAsync(){return this.isNode||this.isDeno||this.isBun?(await this.getSafeNodeModule(this.isDeno?"node:os":"os"))?.platform()==="linux":!1}async printEnv(){this.isNode?(console.log("running on NODE"),console.log("node version is "+this.nodeVersion)):this.isDeno?(console.log("running on DENO"),console.log("deno version is "+this.denoVersion)):this.isBun?(console.log("running on BUN"),console.log("bun version is "+this.bunVersion)):(console.log("running on BROWSER"),console.log("browser is "+this.userAgent))}};var Jt={};A(Jt,{Smartjson:()=>Za,deepEqualJsonLStrings:()=>aw,deepEqualObjects:()=>Ld,foldDec:()=>sw,parse:()=>ws,parseBase64:()=>iw,parseJsonL:()=>Xa,stableOneWayStringify:()=>rw,stringify:()=>Gt,stringifyBase64:()=>nw,stringifyJsonL:()=>tw,stringifyPretty:()=>ow});var Lr={};A(Lr,{Base64:()=>ps,Domain:()=>hs,GitRepo:()=>ys,base64:()=>Fr,create:()=>cs,docker:()=>fs,indent:()=>ls,normalize:()=>ds,type:()=>ms});var cs={};A(cs,{createCryptoRandomString:()=>Yg,createRandomString:()=>Lg});var za=or(Us(),1);var Wg=i((r,e)=>{if(typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.getRandomValues){let t=e-r,o=new Uint32Array(1);return globalThis.crypto.getRandomValues(o),r+o[0]%t}else return Math.floor(Math.random()*(e-r))+r},"getRandomInt"),Fg=i((r,e,t)=>{let o={A:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",a:"abcdefghijklmnopqrstuvwxyz",0:"0123456789","!":"!@#$%^&*()_+-=[]{}|;:,.<>?","*":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=[]{}|;:,.<>?"},n=r;e&&e>r.length?n=r.repeat(Math.ceil(e/r.length)).slice(0,e):e&&(n=r.slice(0,e));let s="";for(let a of n)if(o[a]){let u=o[a],c=Wg(0,u.length);s+=u[c]}else s+=a;return s},"customRandomatic"),Lg=i((r,e,t)=>Fg(r,e,t),"createRandomString"),Yg=i(()=>za.uni(),"createCryptoRandomString");var fs={};A(fs,{makeEnvObject:()=>qg});var qg=i(function(r){let e={},t=/(.*)=(.*)/;if(typeof r<"u")for(let o in r){let n=t.exec(r[o]);e[n[1]]=n[2]}return e},"makeEnvObject");var ls={};A(ls,{indent:()=>Hg,indentWithPrefix:()=>Ug,normalize:()=>$g});var Va=i(r=>{let e=r.split(`
6
+ `);return jg(e)},"splitStringAtLineBreak"),Aa=i(r=>{let e="";for(let t of r)e=e+t+`
7
+ `;return e},"joinStringWithLineBreaks"),jg=i(r=>{let e=/^[\s]*$/;return e.test(r[0])&&r.shift(),e.test(r[r.length-1])&&r.pop(),r},"cleanStringArray"),Hg=i((r,e)=>{let t=Va(r);for(let n of t)n=" ".repeat(e)+n;return Aa(t)},"indent"),Ug=i((r,e)=>{let t,o=Va(r),n=[];for(let s of o)n.push(e+s);return t=Aa(n),t},"indentWithPrefix"),$g=i(r=>{let e,t=Va(r),o,n=/^(\s*)/,s=/^(\s*)$/;for(let u of t){let c=n.exec(u)[1];(typeof o>"u"||c.length<o)&&!s.test(u)&&(o=c.length)}let a=[];for(let u of t)a.push(u.substr(o));return e=Aa(a),e},"normalize");var ds={};A(ds,{replaceAll:()=>kd,standard:()=>zg});var kd=i((r,e,t)=>r.replace(new RegExp(e,"g"),t),"replaceAll"),Bg=i(r=>{let e=r.split(`
8
8
  `),t=1/0;for(let o of e)if(o.trim().length>0){let n=o.match(/^(\s*)/);n&&(t=Math.min(t,n[1].length))}return t===1/0||t===0?r:e.map(o=>o.length>=t?o.slice(t):o).join(`
9
- `)},"stripIndent"),Lg=i((r,e)=>{let t=r;return(!e||e.stripIndent)&&(t=Ag(t)),(!e||e.normalizeNewline)&&(t=t.replace(/\r\n/g,`
10
- `)),(!e||e.replaceTabs)&&(t=Dd(t," /"," ")),(!e||e.stripLeadingTrailingEmptyLines)&&(t=t.replace(/^\s*[\r\n]/gm,"").replace(/\s*[\r\n]$/gm,"")),(!e||e.stripAllEmptyLines)&&(t=t.replace(/^\s*[\r\n]/gm,"")),t},"standard");var hs={};V(hs,{isBase64:()=>Bg,isUtf8:()=>Yg});var za={encode:i(r=>{if(typeof Buffer<"u")return Buffer.from(r,"utf8").toString("base64");if(typeof btoa<"u"){let e=new TextEncoder().encode(r),t=Array.from(e,o=>String.fromCharCode(o)).join("");return btoa(t)}else{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=new TextEncoder().encode(r),o="",n=0;for(;n<t.length;){let s=t[n++],a=n<t.length?t[n++]:0,u=n<t.length?t[n++]:0,c=s<<16|a<<8|u;o+=e.charAt(c>>18&63),o+=e.charAt(c>>12&63),o+=n-2<t.length?e.charAt(c>>6&63):"=",o+=n-1<t.length?e.charAt(c&63):"="}return o}},"encode"),decode:i(r=>{let e=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"=");if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("utf8");if(typeof atob<"u"){let t=atob(e),o=new Uint8Array(t.length);for(let n=0;n<t.length;n++)o[n]=t.charCodeAt(n);return new TextDecoder().decode(o)}else{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=[],n=0;for(;n<e.length;){let s=t.indexOf(e.charAt(n++)),a=t.indexOf(e.charAt(n++)),u=t.indexOf(e.charAt(n++)),c=t.indexOf(e.charAt(n++)),f=s<<18|a<<12|u<<6|c;o.push(f>>16&255),u!==64&&o.push(f>>8&255),c!==64&&o.push(f&255)}return new TextDecoder().decode(new Uint8Array(o))}},"decode")},ps=class{static{i(this,"Base64")}constructor(e,t){switch(t){case"string":this.refString=e;break;case"base64":this.refString=Fr.decode(e);break;case"base64uri":this.refString=Fr.decode(e)}}get simpleString(){return this.refString}get base64String(){return Fr.encode(this.refString)}get base64UriString(){return Fr.encodeUri(this.refString)}},Fr={encode:i(r=>za.encode(r),"encode"),encodeUri:i(r=>za.encode(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),"encodeUri"),decode:i(r=>za.decode(r),"decode"),isBase64:i(r=>/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$/.test(r),"isBase64")};var Yg=i(r=>{let t=new TextEncoder().encode(r),o=0;for(;o<t.length;){if(t[o]===9||t[o]===10||t[o]===13||32<=t[o]&&t[o]<=126){o+=1;continue}if(194<=t[o]&&t[o]<=223&&128<=t[o+1]&&t[o+1]<=191){o+=2;continue}if(t[o]===224&&160<=t[o+1]&&t[o+1]<=191&&128<=t[o+2]&&t[o+2]<=191||(225<=t[o]&&t[o]<=236||t[o]===238||t[o]===239)&&128<=t[o+1]&&t[o+1]<=191&&128<=t[o+2]&&t[o+2]<=191||t[o]===237&&128<=t[o+1]&&t[o+1]<=159&&128<=t[o+2]&&t[o+2]<=191){o+=3;continue}if(t[o]===240&&144<=t[o+1]&&t[o+1]<=191&&128<=t[o+2]&&t[o+2]<=191&&128<=t[o+3]&&t[o+3]<=191||241<=t[o]&&t[o]<=243&&128<=t[o+1]&&t[o+1]<=191&&128<=t[o+2]&&t[o+2]<=191&&128<=t[o+3]&&t[o+3]<=191||t[o]===244&&128<=t[o+1]&&t[o+1]<=143&&128<=t[o+2]&&t[o+2]<=191&&128<=t[o+3]&&t[o+3]<=191){o+=4;continue}return!1}return!0},"isUtf8"),Bg=i(r=>{let e=/[^A-Z0-9+\/=]/i,t=r.length;if(!t||t%4!==0||e.test(r))return!1;let o=r.indexOf("=");return o===-1||o===t-1||o===t-2&&r[t-1]==="="},"isBase64");var 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 t=this._domainRegex(e.replace(this.nodeParsedUrl.pathname,""));this.fullName="";for(let o=1;o<=5;o++)if(t[o-1]){let n=t[o-1];this["level"+o.toString()]=n,this.fullName===""?this.fullName=n:this.fullName=n+"."+this.fullName}else this["level"+o.toString()]=void 0;this.zoneName=this.level2+"."+this.level1,this.topLevel=this.level1,this.domainName=this.level2,this.subDomain=this.level3}_domainRegex(e){let o=/([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}$/.exec(e);return o.reverse(),o.pop(),o.filter(function(s){return s!==""})}_protocolRegex(e){let o=/^([a-zA-Z0-9]*):\/\//.exec(e);if(o)return o[1]}_portRegex(e){let o=/^([a-zA-Z0-9]*):\/\//.exec(e);if(o)return o[1]}};var xs=class{static{i(this,"GitRepo")}constructor(e,t){let o=Hg(e);this.host=o[1],this.user=o[2],this.repo=o[3],this.accessToken=t,this.sshUrl=Sd(this.host,this.user,this.repo,this.accessToken,"ssh"),this.httpsUrl=Sd(this.host,this.user,this.repo,this.accessToken,"https")}},Hg=i(function(r){return/([a-zA-Z0-9\-_\.]*)(?:\/|\:)([a-zA-Z0-9\-_\.]*)(?:\/)([a-zA-Z0-9\-_\.]*)(?:\.git)/.exec(r)},"gitRegex"),Sd=i(function(r,e,t,o="",n){let s;switch(o!==""&&(o=o+"@"),n){case"https":s="https://"+o+r+"/"+e+"/"+t+".git";break;case"ssh":s="git@"+r+":"+e+"/"+t+".git";break;default:console.error("Link Type "+n+" not known");break}return s},"gitLink");var Od=rr(kd(),1),gs=Od.default;var Id=i(()=>globalThis.Buffer,"getNodeBuffer");function Ug(r){let e=Id();return e?e.from(r).toString("base64"):btoa(String.fromCharCode(...r))}i(Ug,"base64Encode");function jg(r){let e=Id();if(e){let t=e.from(r,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return new Uint8Array(Array.from(atob(r)).map(t=>t.charCodeAt(0)))}i(jg,"base64Decode");function Ga(r,e){return JSON.stringify(r,ws,e)}i(Ga,"stringify");function Qa(r){return JSON.parse(r,Ed)}i(Qa,"parse");var ws=i((r,e)=>{if(zg(e)){let t;if("data"in e&&_d(e.data))t=new Uint8Array(e.data);else if(e instanceof Uint8Array)t=e;else return e;return{type:"EncodedBuffer",data:"base64:"+Ug(t)}}return e},"replacer"),Ed=i((r,e)=>{if($g(e)&&Va(e.data)&&e.data.startsWith("base64:")){let t=e.data.slice(7);return jg(t)}return e},"reviver");function $g(r){return Cd(r)&&r.type==="EncodedBuffer"&&Va(r.data)}i($g,"isEncodedBuffer");function zg(r){return Cd(r)&&r.type==="Buffer"&&(_d(r.data)||Va(r.data))||r instanceof Uint8Array}i(zg,"isBufferLike");function _d(r){return Array.isArray(r)}i(_d,"isArray");function Va(r){return typeof r=="string"}i(Va,"isString");function Cd(r){return typeof r=="object"&&r!==null}i(Cd,"isObject");var bs=Qa,Ja=i(r=>r.split(`
11
- `).reduce((o,n)=>{let s=n.trim();return s.length>0&&o.push(bs(s)),o},[]),"parseJsonL"),Gg=i(r=>r.map(e=>Qt(e)).join(`
12
- `),"stringifyJsonL"),Qg=i((r,e,t={})=>{let o=new WeakSet,n=i(u=>{if(u===null||typeof u!="object")return u;let c=ws("",u);if(c&&c.type==="EncodedBuffer"&&typeof c.data=="string")return c;if(o.has(u))return"__cycle__";if(o.add(u),Array.isArray(u))return u.map(l=>n(l));let f={};for(let l of Object.keys(u))try{f[l]=n(u[l])}catch{f[l]="__unserializable__"}return f},"sanitize"),s=n(r),a={...t,cycles:!0};if(e&&!a.cmp){let u=new Map;e.forEach((c,f)=>u.set(c,f)),a.cmp=(c,f)=>{let l=u.has(c.key)?u.get(c.key):Number.POSITIVE_INFINITY,m=u.has(f.key)?u.get(f.key):Number.POSITIVE_INFINITY;return l!==m?l-m:c.key<f.key?-1:c.key>f.key?1:0}}return gs(s,a)},"stableOneWayStringify"),Qt=i((r,e,t={})=>{let o=Ga(r);r=JSON.parse(o);let n={...t};if(e&&!n.cmp){let a=new Map;e.forEach((u,c)=>a.set(u,c)),n.cmp=(u,c)=>{let f=a.has(u.key)?a.get(u.key):Number.POSITIVE_INFINITY,l=a.has(c.key)?a.get(c.key):Number.POSITIVE_INFINITY;return f!==l?f-l:u.key<c.key?-1:u.key>c.key?1:0}}return gs(r,n)},"stringify"),Jg=i(r=>{let e=Qt(r),t=JSON.parse(e);return JSON.stringify(t,null,2)},"stringifyPretty"),Kg=i((...r)=>{let e=Qt(...r);return Wr.base64.encodeUri(e)},"stringifyBase64"),Xg=i(r=>{let e=Wr.base64,o=(e.decodeUri||e.decode)(r);return bs(o)},"parseBase64"),Ka=class r{static{i(this,"Smartjson")}static enfoldFromObject(e){let t=new this,o=t.saveableProperties||[];for(let n in e)o.indexOf(n)!==-1&&(t[n]=e[n]);return t}static enfoldFromJson(e){let t=bs(e);return this.enfoldFromObject(t)}saveableProperties=[];foldToObject(){let e=new Set;return e.add(this),this.foldToObjectInternal(e)}foldToObjectInternal(e){let t={},o=i(s=>{if(s instanceof r){if(e.has(s))throw new Error("cycle detected");return e.add(s),s.foldToObjectInternal(e)}return Array.isArray(s)?s.map(a=>o(a)):structuredClone(s)},"foldValue"),n=this.saveableProperties||[];for(let s of n){let a=this[s];t[s]=o(a)}return t}foldToJson(){let e=this.foldToObject();return Qt(e)}},Zg=i(()=>(r,e)=>{let t=String(e.name);e.addInitializer(function(){this.saveableProperties||(this.saveableProperties=[]),this.saveableProperties.includes(t)||this.saveableProperties.push(t)})},"foldDec"),Pd=i((r,e)=>{let t=Qt(r),o=Qt(e);return t===o},"deepEqualObjects"),ew=i((r,e)=>{let t=Ja(r),o=Ja(e);return Pd(t,o)},"deepEqualJsonLStrings");var No={};V(No,{TypedrequestCache:()=>Xa,WebStore:()=>Po});var Nd={};var vs=class{static{i(this,"WebStoreDb")}constructor(e){this.nativeDb=e}async get(e,t,o={}){return this.runObjectStoreRequest(e,"readonly",n=>n.get(t),o)}async getKey(e,t,o={}){return this.runObjectStoreRequest(e,"readonly",n=>n.getKey(t),o)}async put(e,t,o,n={}){return this.runObjectStoreRequest(e,"readwrite",s=>o===void 0?s.put(t):s.put(t,o),n)}async delete(e,t,o={}){await this.runObjectStoreRequest(e,"readwrite",n=>n.delete(t),o)}async clear(e,t={}){await this.runObjectStoreRequest(e,"readwrite",o=>o.clear(),t)}async getAllKeys(e,t={}){return this.runObjectStoreRequest(e,"readonly",o=>o.getAllKeys(),t)}close(){this.nativeDb.close()}async runObjectStoreRequest(e,t,o,n){n.signal?.throwIfAborted();let s=this.nativeDb.transaction(e,t),a=s.objectStore(e),u=o(a),c,f=new Promise((m,p)=>{c=p}),l=i(()=>{try{s.abort()}catch(m){if(!(m instanceof DOMException)||m.name!=="InvalidStateError"){c(m);return}}n.signal&&c(n.signal.reason)},"abortTransaction");n.signal?.addEventListener("abort",l,{once:!0});try{let[m]=await Promise.race([Promise.all([tw(u),rw(s)]),f]);return m}catch(m){throw n.signal?.aborted?n.signal.reason:m}finally{n.signal?.removeEventListener("abort",l)}}},Fd=i(async(r,e)=>{if(e?.throwIfAborted(),!e)return r;let t,o=new Promise((s,a)=>{t=a}),n=i(()=>{t(e.reason)},"abortListener");e.addEventListener("abort",n,{once:!0});try{return await Promise.race([r,o])}finally{e.removeEventListener("abort",n)}},"awaitWithSignal"),tw=i(r=>new Promise((e,t)=>{r.onsuccess=()=>e(r.result),r.onerror=()=>t(Ts("IndexedDB request failed",r.error))}),"indexedDbRequestToPromise"),rw=i(r=>new Promise((e,t)=>{r.oncomplete=()=>e(),r.onabort=()=>t(Ts("IndexedDB transaction aborted",r.error)),r.onerror=()=>t(Ts("IndexedDB transaction failed",r.error))}),"indexedDbTransactionToPromise"),Ts=i((r,e)=>e?new Error(`${r}: ${e.message}`,{cause:e}):new Error(r),"createIndexedDbError"),Wd=i((r,e)=>{r.objectStoreNames.contains(e)||r.createObjectStore(e)},"ensureObjectStore"),Ad=i(async(r,e,t)=>{if(!globalThis.indexedDB)throw new Error("IndexedDB is not available in this runtime");return new Promise((o,n)=>{let s=!1,a=typeof e=="number"?globalThis.indexedDB.open(r,e):globalThis.indexedDB.open(r),u=i(c=>{s||(s=!0,n(c instanceof Error?c:new Error(String(c))))},"rejectOnce");a.onupgradeneeded=()=>{if(t)try{t(a.result)}catch(c){a.transaction?.abort(),u(c)}},a.onsuccess=()=>{if(s){a.result.close();return}s=!0;let c=a.result;c.onversionchange=()=>c.close(),o(c)},a.onerror=()=>u(Ts(`Failed to open IndexedDB database "${r}"`,a.error)),a.onblocked=()=>u(new Error(`Opening IndexedDB database "${r}" was blocked by another connection`))})},"openNativeDb"),ow=i(async(r,e)=>{let t=await Ad(r,void 0,n=>Wd(n,e));if(t.objectStoreNames.contains(e))return new vs(t);let o=t.version+1;if(t.close(),t=await Ad(r,o,n=>Wd(n,e)),!t.objectStoreNames.contains(e))throw t.close(),new Error(`Failed to create IndexedDB object store "${e}" in database "${r}"`);return new vs(t)},"openWebStoreDb"),Po=class{static{i(this,"WebStore")}constructor(e){this.lifecycleGeneration=0,this.closeCoveredGeneration=0,this.activeOperations=new Set,this.options=e}trackOperation(e){this.lifecycleGeneration+=1;let t;return t=(async()=>e())().finally(()=>{this.activeOperations.delete(t)}),this.activeOperations.add(t),t}init(e={}){return this.trackOperation(()=>this.initForOperation(e.signal))}async initForOperation(e){e?.throwIfAborted();let t=this.closePromise;return t&&(await Fd(t,e),e?.throwIfAborted()),this.initPromise||(this.initPromise=this.runInit().catch(o=>{throw this.initPromise=void 0,o})),Fd(this.initPromise,e)}async runInit(){let e=new Ze.Smartenv;if(!e.isBrowser&&!globalThis.indexedDB&&(await e.getSafeNodeModule("fake-indexeddb/auto"),!globalThis.indexedDB)){let t=await e.getSafeNodeModule("fake-indexeddb");globalThis.indexedDB=new t.IDBFactory}this.db=await ow(this.options.dbName,this.options.storeName)}runDataOperation(e,t){return this.trackOperation(async()=>(await this.initForOperation(t.signal),t.signal?.throwIfAborted(),e(this.db)))}close(){let e=this.lifecycleGeneration;if(this.closePromise&&e<=this.closeCoveredGeneration)return this.closePromise;let t=this.closePromise,o=[...this.activeOperations];if(!t&&!this.initPromise&&o.length===0)return Promise.resolve();let n;return n=(async()=>{try{if(t)try{await t}catch{}await Promise.allSettled(o);let s=this.initPromise;if(!s)return;try{await s}catch{return}finally{this.initPromise===s&&(this.initPromise=void 0)}this.db.close()}finally{this.closePromise===n&&(this.closePromise=void 0)}})(),this.closePromise=n,this.closeCoveredGeneration=e,n}async get(e,t={}){return this.runDataOperation(o=>o.get(this.options.storeName,e,t),t)}async check(e,t={}){return this.runDataOperation(async o=>await o.getKey(this.options.storeName,e,t)!==void 0,t)}async set(e,t,o={}){return this.runDataOperation(n=>n.put(this.options.storeName,t,e,o),o)}async delete(e,t={}){return this.runDataOperation(o=>o.delete(this.options.storeName,e,t),t)}async clear(e={}){return this.runDataOperation(t=>t.clear(this.options.storeName,e),e)}async keys(e={}){return this.runDataOperation(t=>t.getAllKeys(this.options.storeName,e),e)}};var Xa=class{static{i(this,"TypedrequestCache")}constructor(e="default"){this.webstore=new Po({dbName:"trStore",storeName:`trStore-${e}`})}buildKey(e){return Jt.stringify({method:e.method,request:e.request})}async setByRequest(e){if(!e.response)throw new Error("You cannot store requests without a response present");await this.webstore.set(this.buildKey(e),e)}async getByRequest(e){return await this.webstore.get(this.buildKey(e))}};var Ro=256,Ar=class{static{i(this,"CacheStore")}constructor(e="webrequest-v4",t="cache"){this.lifecycleController=new AbortController,this.closeReason=new Error("Webrequest cache store is closed"),this.disposed=!1,this.pruneGeneration=0,this.pruneWaiters=new Set,this.activeOwnedOperations=new Set,this.webstore=new No.WebStore({dbName:e,storeName:t}),this.initPromise=this.init()}async init(){}generateCacheKey(e){let t=e.url,o=e.method;return o==="GET"?t:`${o}:${t}`}async set(e,t,o={}){await this.initPromise;let n=this.getOperationSignal(o.signal),s=o.maxEntries??Ro;if(!Number.isSafeInteger(s)||s<=0)throw new RangeError("webrequest cache maxEntries must be a positive safe integer");await this.webstore.set(e,t,{signal:n}),await this.schedulePrune(s,n)}async get(e,t={}){await this.initPromise;let o=this.getOperationSignal(t.signal);try{let n=await this.webstore.get(e,{signal:o});return n===void 0?null:this.isCacheEntry(n)?n:(await this.webstore.delete(e,{signal:o}),null)}catch{if(o.aborted)throw o.reason;return null}}async has(e,t={}){return await this.get(e,t)!==null}async delete(e,t={}){await this.initPromise;let o=this.getOperationSignal(t.signal);await this.webstore.delete(e,{signal:o})}async clear(e={}){await this.initPromise;let t=this.getOperationSignal(e.signal);await this.webstore.clear({signal:t})}responseFromCacheEntry(e){let t=new Headers(e.headers);return new Response(e.response,{status:e.status,statusText:e.statusText,headers:t})}cacheEntryFromResponse(e,t,o,n={}){return this.trackOwnedOperation(async()=>{let s=this.getOperationSignal(n.signal),a=n.preserveResponse!==!1,u=a?t.clone():t,c=await this.consumeArrayBuffer(u,s,a?t.body:void 0,n.responseSignal),f={};return u.headers.forEach((l,m)=>{f[m]=l}),{response:c,headers:f,timestamp:Date.now(),etag:o?.etag||u.headers.get("etag")||void 0,lastModified:o?.lastModified||u.headers.get("last-modified")||void 0,maxAge:o?.maxAge,url:e,status:u.status,statusText:u.statusText}})}async pruneExpired(e={}){await this.initPromise;let t=this.getOperationSignal(e.signal),o=await this.collectEntries(t),n=0;for(let s of o)t.throwIfAborted(),!(s.valid&&!this.isExpired(s))&&(await this.webstore.delete(s.key,{signal:t}),n+=1);return n}async schedulePrune(e,t){t?.throwIfAborted();let o=++this.pruneGeneration;this.pendingPruneMaxEntries=this.pendingPruneMaxEntries===void 0?e:Math.min(this.pendingPruneMaxEntries,e);let n,s,a=new Promise((c,f)=>{n=c,s=f}),u={generation:o,resolve:n,reject:s};this.pruneWaiters.add(u),this.ensurePruneLoop();try{await nw(a,t)}finally{this.pruneWaiters.delete(u)}}ensurePruneLoop(){if(this.pruneLoopPromise)return this.pruneLoopPromise;let e;return e=this.runPruneLoop().catch(t=>{this.pendingPruneMaxEntries=void 0,this.settlePruneWaiters(this.pruneGeneration,t)}).finally(()=>{this.pruneLoopPromise===e&&(this.pruneLoopPromise=void 0,this.pendingPruneMaxEntries!==void 0&&!this.disposed&&this.ensurePruneLoop())}),this.pruneLoopPromise=e,e}async runPruneLoop(){for(;this.pendingPruneMaxEntries!==void 0;){let e=this.pendingPruneMaxEntries;this.pendingPruneMaxEntries=void 0;let t=this.pruneGeneration;await this.pruneToLimit(e,this.lifecycleController.signal),this.settlePruneWaiters(t)}}settlePruneWaiters(e,t){for(let o of this.pruneWaiters)o.generation>e||(this.pruneWaiters.delete(o),t===void 0?o.resolve():o.reject(t))}async pruneToLimit(e,t){let o=await this.collectEntries(t),n=o.filter(u=>!u.valid||this.isExpired(u));for(let u of n)t?.throwIfAborted(),await this.webstore.delete(u.key,{signal:t});let s=o.filter(u=>u.valid&&!this.isExpired(u)).sort((u,c)=>u.timestamp===c.timestamp?u.key.localeCompare(c.key):(u.timestamp??0)-(c.timestamp??0)),a=Math.max(0,s.length-e);for(let u of s.slice(0,a))t?.throwIfAborted(),await this.webstore.delete(u.key,{signal:t})}async collectEntries(e){e?.throwIfAborted();let t=await this.webstore.keys({signal:e}),o=[];for(let n of t)if(e?.throwIfAborted(),typeof n=="string")try{let s=await this.webstore.get(n,{signal:e});o.push(this.isCacheEntry(s)?{key:n,valid:!0,timestamp:s.timestamp,maxAge:s.maxAge}:{key:n,valid:!1,timestamp:0})}catch{if(e?.aborted)throw e.reason;continue}return o}isCacheEntry(e){if(!e||typeof e!="object")return!1;let t=Reflect.get(e,"response"),o=Reflect.get(e,"headers"),n=Reflect.get(e,"timestamp"),s=Reflect.get(e,"url"),a=Reflect.get(e,"status"),u=Reflect.get(e,"statusText");return t instanceof ArrayBuffer&&typeof o=="object"&&o!==null&&Number.isFinite(n)&&typeof s=="string"&&Number.isInteger(a)&&typeof u=="string"}isExpired(e){return e.maxAge!==void 0&&e.maxAge>0&&Date.now()-e.timestamp>=e.maxAge}getOperationSignal(e){if(this.disposed)throw this.closeReason;return e?.throwIfAborted(),e?AbortSignal.any([e,this.lifecycleController.signal]):this.lifecycleController.signal}trackOwnedOperation(e){let t;return t=e().finally(()=>{this.activeOwnedOperations.delete(t)}),this.activeOwnedOperations.add(t),t}close(){if(this.closePromise)return this.closePromise;this.disposed=!0,this.lifecycleController.abort(this.closeReason);let e=this.pruneLoopPromise,t=[...this.activeOwnedOperations];return this.closePromise=(async()=>{await Promise.allSettled([...t,...e?[e]:[]]),await this.webstore.close()})(),this.closePromise}async consumeArrayBuffer(e,t,o,n){if(t?.throwIfAborted(),!t)return e.arrayBuffer();let s=e.body?.getReader();if(!s)return new ArrayBuffer(0);let a=[],u=0,c,f=new Promise((g,x)=>{c=x}),l,m=i(()=>{c(t.reason),n?.aborted||(l=Promise.all([s.cancel(t.reason).catch(()=>{}),o?.cancel(t.reason).catch(()=>{})]).then(()=>{}))},"abortListener");t.addEventListener("abort",m,{once:!0});try{for(;;){let g=await Promise.race([s.read(),f]);if(g.done)break;a.push(g.value),u+=g.value.byteLength}}finally{t.removeEventListener("abort",m),l&&await l;try{s.releaseLock()}catch{}}let p=new Uint8Array(u),h=0;for(let g of a)p.set(g,h),h+=g.byteLength;return p.buffer}},nw=i(async(r,e)=>{if(e?.throwIfAborted(),!e)return r;let t,o=new Promise((s,a)=>{t=a}),n=i(()=>{t(e.reason)},"abortListener");e.addEventListener("abort",n,{once:!0});try{return await Promise.race([r,o])}finally{e.removeEventListener("abort",n)}},"awaitWithSignal");function iw(r){let e={maxAge:0,immutable:!1,noCache:!1,noStore:!1,mustRevalidate:!1};if(!r)return e;let t=r.toLowerCase().split(",").map(o=>o.trim());for(let o of t)if(o==="no-cache")e.noCache=!0;else if(o==="no-store")e.noStore=!0;else if(o==="immutable")e.immutable=!0;else if(o==="must-revalidate")e.mustRevalidate=!0;else if(o.startsWith("max-age=")){let n=parseInt(o.split("=")[1],10);isNaN(n)||(e.maxAge=n*1e3)}return e}i(iw,"parseCacheControl");function sw(r){if(r)try{return new Date(r).getTime()}catch{return}}i(sw,"parseExpires");function Qe(r){let e=r.get("cache-control"),t=r.get("expires"),o=r.get("etag"),n=r.get("last-modified"),s=iw(e);if(s.maxAge===0&&t){let a=sw(t);a&&(s.maxAge=Math.max(0,a-Date.now()))}return{maxAge:s.maxAge||0,etag:o||void 0,lastModified:n||void 0,immutable:s.immutable||!1,noCache:s.noCache||!1,noStore:s.noStore||!1,mustRevalidate:s.mustRevalidate||!1}}i(Qe,"extractCacheMetadata");function Ss(r,e){if(e.noStore)return!1;if(e.immutable)return!0;let t=Date.now()-r.timestamp,o=r.maxAge||e.maxAge||0;return o===0?!1:t<o}i(Ss,"isFresh");function Lr(r){return r.noCache||r.mustRevalidate}i(Lr,"requiresRevalidation");function Ms(r){let e={};return r.etag&&(e["if-none-match"]=r.etag),r.lastModified&&(e["if-modified-since"]=r.lastModified),e}i(Ms,"createConditionalHeaders");function ks(r){let e={};return r.forEach((t,o)=>{e[o]=t}),e}i(ks,"headersToObject");function Ld(r){let e=new Headers;return Object.entries(r).forEach(([t,o])=>{e.set(t,o)}),e}i(Ld,"objectToHeaders");function aw(r){let e=new AbortController,t=!1,o=!1,n=new A.Timeout(r,null);return n.promise.then(()=>{t=!0,e.abort()}),{controller:e,cleanup:i(()=>{o||(o=!0,n.cancel())},"cleanup"),didTimeout:i(()=>t,"didTimeout")}}i(aw,"createTimeoutController");var Yd=Symbol("webrequestTimeoutError"),Ot=i((r,e)=>{let t=new Error(`Request timeout after ${e}ms: ${r}`);return Object.defineProperty(t,Yd,{configurable:!1,enumerable:!1,value:!0,writable:!1}),t},"createTimeoutError"),Fo=i(r=>r instanceof Error&&Reflect.get(r,Yd)===!0,"isWebrequestTimeoutError");async function Za(r,e,t){let o=r instanceof Request?r.url:String(r),{controller:n,cleanup:s,didTimeout:a}=aw(t),u=e.signal?AbortSignal.any([e.signal,n.signal]):n.signal;try{let c=await fetch(r,{...e,signal:u});return s(),c}catch(c){throw s(),a()?Ot(o,t):c}}i(Za,"fetchWithTimeout");var Bd=i(r=>{if(r.reason instanceof Error)return r.reason;let e=new Error("The request was aborted");return e.name="AbortError",e},"normalizeAbortReason");async function Hd(r,e){if(e.signal?.aborted){let l=Bd(e.signal);throw await r.body?.cancel(l).catch(()=>{}),l}if(e.bodyTimeoutMs!==void 0&&e.bodyTimeoutMs<=0){let l=Ot(e.url,e.reportedTimeoutMs??e.bodyTimeoutMs);throw await r.body?.cancel(l).catch(()=>{}),l}if(e.bodyTimeoutMs===void 0&&!e.signal)return await r.json();let t=r.body?.getReader();if(!t)return JSON.parse("");let o,n,s,a=new Promise((l,m)=>{s=m}),u=i(l=>{o||(o=l,t.cancel(l).catch(()=>{}),s(l))},"terminate"),c=i(()=>{e.signal&&u(Bd(e.signal))},"abortListener");if(e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c,{once:!0})),e.bodyTimeoutMs!==void 0){let l=e.reportedTimeoutMs??e.bodyTimeoutMs;n=setTimeout(()=>{u(Ot(e.url,l))},e.bodyTimeoutMs)}let f=i(async()=>{let l=new TextDecoder,m="";for(;;){let p;try{p=await t.read()}catch(h){throw o||h}if(o)throw o;if(p.done)break;m+=l.decode(p.value,{stream:!0})}if(m+=l.decode(),o)throw o;return JSON.parse(m)},"readBody");try{return await Promise.race([f(),a])}finally{n!==void 0&&clearTimeout(n),e.signal?.removeEventListener("abort",c);try{t.releaseLock()}catch{}}}i(Hd,"consumeJsonWithTimeout");var Os=class{static{i(this,"NetworkFirstStrategy")}async execute(e){let t;try{return t=await e.fetchFn(e.request),t.ok&&await this.cacheResponse(e,t),{response:t,fromCache:!1,revalidated:!1}}catch(o){if(await Yr(t,o,e.request.signal),e.signal?.aborted)throw e.signal.reason;if(Fo(o))throw o;e.logging&&console.log("[webrequest] Network failed, trying cache:",o);let n=await e.cacheStore.get(e.cacheKey,{signal:e.signal});if(n)return{response:e.cacheStore.responseFromCacheEntry(n),fromCache:!0,revalidated:!1};throw o}}async cacheResponse(e,t){let o=Qe(t.headers);if(o.maxAge=Wo(o.maxAge,e.cacheMaxAge),o.noStore)return;let n=await e.cacheStore.cacheEntryFromResponse(e.request.url,t,o,{signal:e.signal,responseSignal:e.request.signal});await e.cacheStore.set(e.cacheKey,n,{signal:e.signal,maxEntries:e.cacheMaxEntries})}},eu=class{static{i(this,"CacheFirstStrategy")}async execute(e){let t=await e.cacheStore.get(e.cacheKey,{signal:e.signal});if(t){let s=Qe(new Headers(t.headers));if(qd(e,t,s)&&!Lr(s))return e.logging&&console.log("[webrequest] Cache hit (fresh):",e.request.url),{response:e.cacheStore.responseFromCacheEntry(t),fromCache:!0,revalidated:!1};if(Lr(s)&&(t.etag||t.lastModified))return await this.revalidate(e,t)}e.logging&&console.log("[webrequest] Cache miss, fetching:",e.request.url);let o=await e.fetchFn(e.request),n=Qe(o.headers);if(n.maxAge=Wo(n.maxAge,e.cacheMaxAge),!n.noStore)try{let s=await e.cacheStore.cacheEntryFromResponse(e.request.url,o,n,{signal:e.signal,responseSignal:e.request.signal});await e.cacheStore.set(e.cacheKey,s,{signal:e.signal,maxEntries:e.cacheMaxEntries})}catch(s){throw await Yr(o,s,e.request.signal),s}return{response:o,fromCache:!1,revalidated:!1}}async revalidate(e,t){let o=Ms(t),n=new Request(e.request.url,{method:e.request.method,headers:{...ks(e.request.headers),...o},signal:e.signal}),s;try{if(s=await e.fetchFn(n),s.status===304)return e.logging&&console.log("[webrequest] Cache revalidated (304):",e.request.url),t.timestamp=Date.now(),await e.cacheStore.set(e.cacheKey,t,{signal:e.signal,maxEntries:e.cacheMaxEntries}),await Yr(s,"304 response replaced by cached response",n.signal),{response:e.cacheStore.responseFromCacheEntry(t),fromCache:!0,revalidated:!0};if(s.ok){let a=Qe(s.headers);if(a.maxAge=Wo(a.maxAge,e.cacheMaxAge),!a.noStore){let u=await e.cacheStore.cacheEntryFromResponse(e.request.url,s,a,{signal:e.signal,responseSignal:n.signal});await e.cacheStore.set(e.cacheKey,u,{signal:e.signal,maxEntries:e.cacheMaxEntries})}}return{response:s,fromCache:!1,revalidated:!0}}catch(a){if(await Yr(s,a,n.signal),e.signal?.aborted)throw e.signal.reason;if(Fo(a))throw a;return e.logging&&console.log("[webrequest] Revalidation failed, using cache:",a),{response:e.cacheStore.responseFromCacheEntry(t),fromCache:!0,revalidated:!1}}}},tu=class{static{i(this,"StaleWhileRevalidateStrategy")}async execute(e){let t=await e.cacheStore.get(e.cacheKey,{signal:e.signal});if(t){let s=e.cacheStore.responseFromCacheEntry(t);return e.scheduleBackgroundRevalidation(async a=>{let u={...e,request:new Request(e.request,{signal:a}),signal:a};await this.revalidateInBackground(u,t)}),{response:s,fromCache:!0,revalidated:!1}}let o=await e.fetchFn(e.request),n=Qe(o.headers);if(n.maxAge=Wo(n.maxAge,e.cacheMaxAge),!n.noStore&&o.ok)try{let s=await e.cacheStore.cacheEntryFromResponse(e.request.url,o,n,{signal:e.signal,responseSignal:e.request.signal});await e.cacheStore.set(e.cacheKey,s,{signal:e.signal,maxEntries:e.cacheMaxEntries})}catch(s){throw await Yr(o,s,e.request.signal),s}return{response:o,fromCache:!1,revalidated:!1}}async revalidateInBackground(e,t){let o=Qe(new Headers(t.headers));if(qd(e,t,o)&&!Lr(o))return;let n;try{if(e.signal?.throwIfAborted(),n=await e.fetchFn(e.request),n.ok){let s=Qe(n.headers);if(s.maxAge=Wo(s.maxAge,e.cacheMaxAge),!s.noStore){let a=await e.cacheStore.cacheEntryFromResponse(e.request.url,n,s,{signal:e.signal,responseSignal:e.request.signal,preserveResponse:!1});await e.cacheStore.set(e.cacheKey,a,{signal:e.signal,maxEntries:e.cacheMaxEntries}),e.logging&&console.log("[webrequest] Background revalidation complete:",e.request.url)}}}catch(s){if(e.signal?.aborted)return;e.logging&&console.warn("[webrequest] Background revalidation failed:",s)}finally{await Yr(n,"background revalidation response discarded",e.request.signal)}}},ru=class{static{i(this,"NetworkOnlyStrategy")}async execute(e){return{response:await e.fetchFn(e.request),fromCache:!1,revalidated:!1}}},ou=class{static{i(this,"CacheOnlyStrategy")}async execute(e){let t=await e.cacheStore.get(e.cacheKey,{signal:e.signal});if(!t)throw new Error(`Cache miss for ${e.request.url} (cache-only mode)`);return{response:e.cacheStore.responseFromCacheEntry(t),fromCache:!0,revalidated:!1}}},Wo=i((r,e)=>e===void 0?r:Math.min(r,e),"resolveEffectiveMaxAge"),qd=i((r,e,t)=>Ss(e,t)?r.cacheMaxAge===void 0?!0:Date.now()-e.timestamp<r.cacheMaxAge:!1,"isFreshForContext"),Yr=i(async(r,e,t)=>{!r?.body||r.bodyUsed||t?.aborted||await r.body.cancel(e).catch(()=>{})},"cancelDiscardedResponse");function Ud(r){switch(r){case"network-first":return new Os;case"cache-first":return new eu;case"stale-while-revalidate":return new tu;case"network-only":return new ru;case"cache-only":return new ou;default:return new Os}}i(Ud,"getStrategyHandler");var Br=class{static{i(this,"CacheManager")}constructor(e,t,o){this.lifecycleController=new AbortController,this.closeReason=new Error("Webrequest cache manager is closed"),this.disposed=!1,this.backgroundRevalidations=new Map,this.cacheStore=o??new Ar(e,t)}async execute(e,t,o){if(this.disposed)throw this.closeReason;e.signal.throwIfAborted();let n=this.determineStrategy(e,t);if(n==="network-only")return{response:await o(e),fromCache:!1,revalidated:!1};let s=t.cacheMaxEntries??Ro;if(!Number.isSafeInteger(s)||s<=0)throw new RangeError("webrequest cacheMaxEntries must be a positive safe integer");if(t.cacheMaxAge!==void 0&&(!Number.isSafeInteger(t.cacheMaxAge)||t.cacheMaxAge<0))throw new RangeError("webrequest cacheMaxAge must be a non-negative safe integer");let a=t.timeout??6e4,u=new AbortController,c=setTimeout(()=>{u.abort(Ot(e.url,a))},Math.max(0,a)),f=AbortSignal.any([e.signal,this.lifecycleController.signal,u.signal]);try{let l=this.generateCacheKey(e,t),m=Ud(n),p={request:e,cacheKey:l,cacheStore:this.cacheStore,fetchFn:o,logging:t.logging,signal:f,cacheMaxAge:t.cacheMaxAge,cacheMaxEntries:s,scheduleBackgroundRevalidation:i(h=>{this.scheduleBackgroundRevalidation(l,e.url,a,h)},"scheduleBackgroundRevalidation")};return await m.execute(p)}finally{clearTimeout(c)}}determineStrategy(e,t){return t.cacheStrategy?t.cacheStrategy:t.cache?this.mapCacheModeToStrategy(t.cache):e.cache?this.mapCacheModeToStrategy(e.cache):"network-first"}mapCacheModeToStrategy(e){switch(e){case"default":return"network-first";case"no-store":case"reload":return"network-only";case"no-cache":return"network-first";case"force-cache":return"cache-first";case"only-if-cached":return"cache-only";default:return"network-first"}}generateCacheKey(e,t){return t.cacheKey?typeof t.cacheKey=="function"?t.cacheKey(e):t.cacheKey:this.cacheStore.generateCacheKey(e)}async clear(){await this.cacheStore.clear()}async delete(e){await this.cacheStore.delete(e)}async has(e){return await this.cacheStore.has(e)}getStore(){return this.cacheStore}scheduleBackgroundRevalidation(e,t,o,n){if(this.disposed||this.backgroundRevalidations.has(e))return;let s=new AbortController,a=AbortSignal.any([this.lifecycleController.signal,s.signal]),u=setTimeout(()=>{s.abort(Ot(t,o))},Math.max(0,o)),c;c=n(a).catch(()=>{}).finally(()=>{clearTimeout(u),this.backgroundRevalidations.get(e)===c&&this.backgroundRevalidations.delete(e)}),this.backgroundRevalidations.set(e,c)}close(){if(this.closePromise)return this.closePromise;this.disposed=!0,this.lifecycleController.abort(this.closeReason);let e=[...this.backgroundRevalidations.values()];return this.closePromise=(async()=>{await Promise.allSettled(e),await this.cacheStore.close()})(),this.closePromise}};var Is=class{static{i(this,"ExponentialBackoff")}calculate(e,t,o){let n=t*Math.pow(2,e-1);return Math.min(n,o)}},nu=class{static{i(this,"LinearBackoff")}calculate(e,t,o){let n=t*e;return Math.min(n,o)}},iu=class{static{i(this,"ConstantBackoff")}calculate(e,t,o){return Math.min(t,o)}};function jd(r){switch(r){case"exponential":return new Is;case"linear":return new nu;case"constant":return new iu;default:return new Is}}i(jd,"getBackoffCalculator");function $d(r,e=.1){let t=r*e*Math.random();return r+t}i($d,"addJitter");var Hr=class{static{i(this,"RetryManager")}constructor(e={},t){this.signal=t,this.options={maxAttempts:e.maxAttempts??3,backoff:e.backoff??"exponential",initialDelay:e.initialDelay??1e3,maxDelay:e.maxDelay??3e4,retryOn:e.retryOn??[408,429,500,502,503,504],onRetry:e.onRetry??(()=>{})}}async execute(e,t){let o;for(let n=1;n<=this.options.maxAttempts;n++){this.throwIfAborted();try{let s=await e();if(s instanceof Response&&this.shouldRetryResponse(s)){if(n===this.options.maxAttempts)return s;await this.cancelResponseBody(s,`Retrying after HTTP ${s.status}`);let a=this.calculateDelay(n);this.options.onRetry(n,new Error(`HTTP ${s.status}`),a),await this.delay(a);continue}return s}catch(s){if(this.signal?.aborted)throw this.getAbortError();o=s instanceof Error?s:new Error(String(s));let a=t?t(s,n):this.shouldRetryError(s);if(n===this.options.maxAttempts||!a)throw o;let u=this.calculateDelay(n);this.options.onRetry(n,o,u),await this.delay(u)}}throw o||new Error("Max retry attempts reached")}async executeWithFallbacks(e,t,o){if(e.length===0)throw new Error("No URLs provided for fallback execution");let n,s=[];for(let a of e){this.throwIfAborted();try{let u=await this.execute(async()=>await o(a,t));if(u.status<400||u.status>=400&&u.status<500&&u.status!==408)return u;await this.cancelResponseBody(u,`Trying fallback after HTTP ${u.status}`),s.push(a),n=new Error(`Request failed with status ${u.status}`)}catch(u){if(this.signal?.aborted)throw this.getAbortError();s.push(a),n=u instanceof Error?u:new Error(String(u))}}throw new Error(`All URLs failed: ${s.join(", ")}. Last error: ${n?.message||"Unknown error"}`)}shouldRetryResponse(e){let t=this.options.retryOn;return typeof t=="function"?t(e):Array.isArray(t)?t.includes(e.status):!1}shouldRetryError(e){if(e instanceof TypeError&&e.message.includes("fetch")||e.name==="AbortError"||e.message.includes("timeout"))return!0;let t=this.options.retryOn;return typeof t=="function"?t(void 0,e):!1}calculateDelay(e){let o=jd(this.options.backoff).calculate(e,this.options.initialDelay,this.options.maxDelay);return $d(o)}async delay(e){if(!this.signal){await A.delayFor(e);return}if(this.signal.aborted)throw this.getAbortError();let t=new A.Timeout(e,null),o,n=new Promise((a,u)=>{o=u}),s=i(()=>{t.cancel(),o(this.getAbortError())},"abortListener");try{this.signal.addEventListener("abort",s,{once:!0}),this.signal.aborted&&s(),await Promise.race([t.promise,n])}finally{t.cancel(),this.signal.removeEventListener("abort",s)}}async cancelResponseBody(e,t){await e.body?.cancel(t).catch(()=>{})}throwIfAborted(){if(this.signal?.aborted)throw this.getAbortError()}getAbortError(){if(this.signal?.reason instanceof Error)return this.signal.reason;let e=new Error("The request was aborted");return e.name="AbortError",e}};var qr=class{static{i(this,"RequestDeduplicator")}constructor(){this.inFlightRequests=new Map}generateKey(e){let t=e.url,o=e.method;return o==="GET"||o==="HEAD"?`${o}:${t}`:`${o}:${t}:${Date.now()}`}async execute(e,t){let o=this.inFlightRequests.get(e);if(o)return{response:(await o.promise).clone(),wasDeduplicated:!0};let n=R.defer();this.inFlightRequests.set(e,n);try{let s=await t();return n.resolve(s),this.inFlightRequests.delete(e),{response:s,wasDeduplicated:!1}}catch(s){throw n.reject(s),this.inFlightRequests.delete(e),s}}isInFlight(e){return this.inFlightRequests.has(e)}getInFlightCount(){return this.inFlightRequests.size}clear(){this.inFlightRequests.clear()}};var Kt=class{static{i(this,"WebrequestClient")}constructor(e={}){this.closeReason=new Error("Webrequest client is closed"),this.disposed=!1,this.defaultOptions=e,this.interceptorManager=new Rr,this.cacheManager=new Br,this.deduplicator=new qr}addRequestInterceptor(e){this.interceptorManager.addRequestInterceptor(e)}addResponseInterceptor(e){this.interceptorManager.addResponseInterceptor(e)}addErrorInterceptor(e){this.interceptorManager.addErrorInterceptor(e)}removeRequestInterceptor(e){this.interceptorManager.removeRequestInterceptor(e)}removeResponseInterceptor(e){this.interceptorManager.removeResponseInterceptor(e)}removeErrorInterceptor(e){this.interceptorManager.removeErrorInterceptor(e)}clearInterceptors(){this.interceptorManager.clearAll()}async clearCache(){await this.cacheManager.clear()}async deleteCache(e){await this.cacheManager.delete(e)}async request(e,t={}){if(this.disposed)throw this.closeReason;let o={...this.defaultOptions,...t},n;if(typeof e=="string"?n=new Request(e,o):n=e,n=await this.interceptorManager.processRequest(n),o.interceptors?.request)for(let a of o.interceptors.request)n=await a(n);if(o.deduplicate??!1){let a=this.deduplicator.generateKey(n);return(await this.deduplicator.execute(a,async()=>await this.executeRequest(n,o))).response}return await this.executeRequest(n,o)}async executeRequest(e,t){try{let o=typeof t.retry=="object"?t.retry:t.retry?{}:void 0,n=i(async u=>{let c=t.timeout??6e4,f={...t,method:u.method,headers:u.headers,signal:u.signal};return u.body&&(f.body=u.body,f.duplex="half"),await Za(u.url,f,c)},"fetchFnForRequest"),s=i(async(u,c)=>{let f=t.timeout??6e4;return await Za(u,c,f)},"fetchFnForFallbacks"),a;if(o){let u=new Hr(o,t.signal);if(t.fallbackUrls&&t.fallbackUrls.length>0){let c=[e.url,...t.fallbackUrls];a=await u.executeWithFallbacks(c,{method:e.method,headers:e.headers,body:e.body,...t},s)}else a=await u.execute(async()=>(await this.cacheManager.execute(e,t,n)).response)}else a=(await this.cacheManager.execute(e,t,n)).response;if(a=await this.interceptorManager.processResponse(a),t.interceptors?.response)for(let u of t.interceptors.response)a=await u(a);return a}catch(o){throw await this.interceptorManager.processError(o instanceof Error?o:new Error(String(o)))}}async close(){return this.closePromise?this.closePromise:(this.disposed=!0,this.closePromise=this.cacheManager.close(),this.closePromise)}async requestJson(e,t){let o={...this.defaultOptions,...t},n=o.timeout??6e4,s=o.retry?void 0:performance.now()+n,a=s===void 0?void 0:new AbortController,u=a?o.signal?AbortSignal.any([o.signal,a.signal]):a.signal:o.signal,c=a===void 0?void 0:setTimeout(()=>{a.abort(Ot(e,n))},Math.max(0,n));try{let f=await this.request(e,{...t,signal:u});if(u?.aborted)throw await f.body?.cancel(u.reason).catch(()=>{}),u.reason instanceof Error?u.reason:new Error("The request was aborted");if(!f.ok)throw await f.body?.cancel(`HTTP ${f.status}`).catch(()=>{}),new Error(`HTTP ${f.status}: ${f.statusText}`);let l=s===void 0?n:s-performance.now();return await Hd(f,{bodyTimeoutMs:l,reportedTimeoutMs:n,signal:u,url:e})}catch(f){throw u?.aborted&&u.reason instanceof Error?u.reason:f}finally{c!==void 0&&clearTimeout(c)}}async getJson(e,t={}){return await this.requestJson(e,{...t,method:"GET",headers:{Accept:"application/json",...t.headers||{}}})}async postJson(e,t,o={}){return await this.requestJson(e,{...o,method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...o.headers||{}},body:JSON.stringify(t)})}async putJson(e,t,o={}){return await this.requestJson(e,{...o,method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json",...o.headers||{}},body:JSON.stringify(t)})}async deleteJson(e,t={}){return await this.requestJson(e,{...t,method:"DELETE",headers:{Accept:"application/json",...t.headers||{}}})}};var Le=new Kt;async function ke(r,e){let t=r instanceof Request?r.url:String(r),o=r instanceof Request?r:new Request(t,e);return await Le.request(o,e)}i(ke,"webrequest"),ke.getJson=async function(r,e){return await Le.getJson(r,e)},ke.postJson=async function(r,e,t){return await Le.postJson(r,e,t)},ke.putJson=async function(r,e,t){return await Le.putJson(r,e,t)},ke.deleteJson=async function(r,e){return await Le.deleteJson(r,e)},ke.addRequestInterceptor=function(r){Le.addRequestInterceptor(r)},ke.addResponseInterceptor=function(r){Le.addResponseInterceptor(r)},ke.addErrorInterceptor=function(r){Le.addErrorInterceptor(r)},ke.clearInterceptors=function(){Le.clearInterceptors()},ke.clearCache=async function(){await Le.clearCache()},ke.createClient=function(r){return new Kt(r)},ke.getDefaultClient=function(){return Le};var et=rr(Bs(),1);var Fe=class extends Error{static{i(this,"TypedResponseError")}constructor(e,t){super(e),this.name="TypedResponseError",this.errorText=e,this.errorData=t??{}}};var _s=class{static{i(this,"TypedTools")}constructor(){this.localData={}}async passGuards(e,t){let o=new Co.GuardSet(e);if(!await o.allGuardsPass(t)){let s=await o.getFailedHint(t);throw new Fe(`guard failed: ${s}`,{failedHint:s})}}};var su=class r{static{i(this,"TypedHandler")}static{this.internalErrorMessage="Internal server error"}constructor(e,t){this.method=e,this.handlerFunction=t}async addResponse(e){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 t,o=new _s;e.localData&&(o.localData=e.localData);let n=await this.handlerFunction(e.request,o).catch(s=>{s instanceof Fe?t=s:(console.error(`TypedRequest handler '${this.method}' failed`),t=new Fe(r.internalErrorMessage))});return t&&(e.error={text:t.errorText,data:t.errorData}),n&&(e.response=n),e?.correlation?.phase&&(e.correlation.phase="response"),e}};var jr=Object.freeze({redacted:!0});var zd=Object.freeze(["onOutgoingRequest","onIncomingResponse","onIncomingRequest","onOutgoingResponse"]),Vd=Symbol.for("@api.global/typedrequest:global-hooks:3.8"),Gd=i(r=>({payloadProjector:r?.payloadProjector,errorProjector:r?.errorProjector}),"copyProjectionOptions"),Ps=i((r={})=>({hooks:r,projectedRegistrationsByPhase:{}}),"createTypedRouterHookRegistrationState"),uw=i(r=>zd.filter(e=>Object.hasOwn(r,e)).map(e=>[e,r[e]]),"getSuppliedHookEntries"),Ns=i((r,e,t)=>{let o=uw(e);r.hooks={...r.hooks,...e};for(let[n]of o){let s=r.hooks[n];if(typeof s!="function"){delete r.projectedRegistrationsByPhase[n];continue}r.projectedRegistrationsByPhase[n]={callback:s,projectionOptions:Gd(t)}}},"mergeTypedRouterHookRegistrations"),Rs=i((r,e)=>{r.hooks=e;for(let t of zd)delete r.projectedRegistrationsByPhase[t]},"replaceTypedRouterHookRegistrations"),$r=i(()=>{let r=globalThis[Vd];if(r?.version==="3.8"&&r.stateShape==="callback-bound-projections-v1"&&r.subscribers instanceof Map)return r;let e={version:"3.8",stateShape:"callback-bound-projections-v1",legacy:Ps(),subscribers:new Map};return globalThis[Vd]=e,e},"getRealmGlobalHookState"),Jd=i(()=>$r().legacy.hooks,"getLegacyGlobalHooks"),Kd=i(r=>{Rs($r().legacy,r)},"replaceLegacyGlobalHooks"),Xd=i((r,e)=>{Ns($r().legacy,r,e)},"mergeLegacyGlobalHooks"),Zd=i((r,e)=>{let t=$r(),o=Symbol("typedrequest-hook-subscriber"),n=Ps();Ns(n,r,e),t.subscribers.set(o,n);let s=!1;return()=>{s||(s=!0,t.subscribers.delete(o))}},"addGlobalHookSubscriber"),em=i(()=>{let r=$r();Rs(r.legacy,{}),r.subscribers.clear()},"clearGlobalHookRegistrations"),Cs=i(r=>{try{console.error(`TypedRequest hook projection failed (${r})`)}catch{}},"logProjectionFailure"),au=i(r=>{try{console.error(`TypedRequest hook callback failed (${r})`)}catch{}},"logCallbackFailure"),cw=i((r,e)=>{let t={correlationId:r.correlationId,method:r.method,direction:r.direction,phase:r.phase,timestamp:r.timestamp,...r.durationMs===void 0?{}:{durationMs:r.durationMs},hasError:r.errorText!==void 0};try{return Object.freeze(t)}catch{Cs(e);return}},"createMetadata"),Qd=i(r=>typeof SharedArrayBuffer>"u"?!1:r instanceof SharedArrayBuffer||Object.prototype.toString.call(r)==="[object SharedArrayBuffer]","isSharedArrayBuffer"),zr=i((r,e=new Set)=>{if(!(r===null||typeof r!="object"&&typeof r!="function")){if(Qd(r))throw new TypeError("TypedRequest hook projections cannot contain SharedArrayBuffer");if(ArrayBuffer.isView(r)){if(Qd(r.buffer))throw new TypeError("TypedRequest hook projections cannot contain SharedArrayBuffer-backed views");return}if(!e.has(r)){if(e.add(r),r instanceof Map){for(let[t,o]of r)zr(t,e),zr(o,e);return}if(r instanceof Set){for(let t of r)zr(t,e);return}for(let t of Reflect.ownKeys(r)){let o=Reflect.getOwnPropertyDescriptor(r,t);if(o){if(!Object.hasOwn(o,"value"))throw new TypeError("TypedRequest hook projections cannot contain accessor properties");zr(o.value,e)}}}}},"assertNoSharedArrayBuffer"),fw=i((r,e,t,o)=>{if(!e||!t.payloadProjector)return{payload:jr,payloadRedacted:!0};try{let n=t.payloadProjector(r,e);zr(n);let s=structuredClone(n);return zr(s),s!==null&&(typeof s=="object"||typeof s=="function")&&Object.freeze(s),{payload:s,payloadRedacted:!1}}catch{return Cs(o),{payload:jr,payloadRedacted:!0}}},"snapshotPayload"),lw=i((r,e,t,o)=>{if(!(!e||r.errorText===void 0||!t.errorProjector))try{let n=t.errorProjector(r.errorText,e);if(n===void 0)return;let s=structuredClone(n);if(typeof s!="string")throw new TypeError("TypedRequest error projector must return a string or undefined");return s}catch{Cs(o);return}},"snapshotError"),dw=i((r,e,t)=>{let o=cw(r,t),n=fw(r.payload,o,e,t),s=lw(r,o,e,t),a={correlationId:r.correlationId,method:r.method,direction:r.direction,phase:r.phase,timestamp:r.timestamp,...r.durationMs===void 0?{}:{durationMs:r.durationMs},hasError:r.errorText!==void 0,...n,...s===void 0?{}:{error:s}};try{return Object.freeze(a)}catch{Cs(t);let u={correlationId:r.correlationId,method:r.method,direction:r.direction,phase:r.phase,timestamp:r.timestamp,...r.durationMs===void 0?{}:{durationMs:r.durationMs},hasError:r.errorText!==void 0,payload:jr,payloadRedacted:!0};try{return Object.freeze(u)}catch{return u}}},"projectLogEntry"),mw=i((r,e)=>{try{let t=r.hooks[e];if(typeof t!="function")return;let o=r.projectedRegistrationsByPhase[e];return{callback:t,projectionOptions:o?.callback===t?Gd(o.projectionOptions):{}}}catch{au(e);return}},"snapshotDispatchRecipient"),pw=i((r,e,t)=>{let o=dw(t,r.projectionOptions,e);try{let n=r.callback(o);n&&typeof n.then=="function"&&Promise.resolve(n).catch(()=>{au(e)})}catch{au(e)}},"dispatchToRecipient"),Vr=i((r,e,t)=>{let o=$r(),s=[o.legacy,...Array.from(o.subscribers.values()),...t?[t]:[]].map(a=>mw(a,r)).filter(a=>!!a);for(let a of s)pw(a,r,e)},"dispatchTypedRequestHook");var Ao=class r{static{i(this,"TypedRouter")}constructor(){this.hookRegistrationState=Ps(),this.routerMap=new ie.ObjectMap,this.fallbackRouterMap=new ie.ObjectMap,this.fallbackParentRouters=new Set,this.handlerMap=new ie.ObjectMap,this.registeredVirtualStreams=new ie.ObjectMap,this.middlewares=[],this.fireEventInterestMap=new ie.InterestMap(e=>e)}static{this.internalErrorMessage="Internal server error"}static get globalHooks(){return Jd()}static set globalHooks(e){Kd(e)}static setGlobalHooks(e,t){Xd(e,t)}static addGlobalHooks(e,t){return Zd(e,t)}static clearGlobalHooks(){em()}get hooks(){return this.hookRegistrationState.hooks}set hooks(e){Rs(this.hookRegistrationState,e)}setHooks(e,t){Ns(this.hookRegistrationState,e,t)}callHook(e,t){Vr(e,t,this.hookRegistrationState)}setErrorFromCaughtError(e,t,o){if(t instanceof Fe){e.error={text:t.errorText,data:t.errorData??{}};return}console.error(`TypedRequest ${o} failed`),e.error={text:r.internalErrorMessage,data:{}}}getRegisteredVirtualStreamById(e){return this.registeredVirtualStreams.findSync(t=>t.streamId===e)}registerVirtualStream(e){let t=this.getRegisteredVirtualStreamById(e.streamId);return t||(this.registeredVirtualStreams.add(e),e)}unregisterVirtualStream(e){this.registeredVirtualStreams.remove(e)}addMiddleware(e){this.middlewares.push(e)}addTypedHandler(e){if(this.getTypedHandlerForMethod(e.method))throw new Error(`a TypedHandler for ${e.method} alredy exists! Can't add another one.`);this.handlerMap.add(e);try{this.validateAffectedCompositionRoots()}catch(o){throw this.handlerMap.remove(e),o}}addTypedRouter(e){if(e===this)throw new Error("A TypedRouter cannot be composed with itself.");if(!this.routerMap.findSync(o=>o===e)){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(s){throw this.routerMap.remove(e),e.routerMap.remove(this),s}}}addFallbackRouter(e){if(e===this)throw new Error("A TypedRouter cannot use itself as a fallback.");if(this.fallbackRouterMap.findSync(o=>o===e))return()=>{};if(e.canReachRouter(this))throw new Error("Adding this fallback would create a TypedRouter composition cycle.");this.fallbackRouterMap.add(e),e.fallbackParentRouters.add(this);try{this.validateAffectedCompositionRoots()}catch(o){throw this.fallbackRouterMap.remove(e),e.fallbackParentRouters.delete(this),o}let t=!1;return()=>{t||(t=!0,this.fallbackRouterMap.remove(e),e.fallbackParentRouters.delete(this))}}getMethodNames(){return[...this.collectReachableHandlers().keys()].sort()}canReachRouter(e,t=new Set){if(this===e)return!0;if(t.has(this))return!1;t.add(this);for(let o of[...this.routerMap.getArray(),...this.fallbackRouterMap.getArray()])if(o.canReachRouter(e,t))return!0;return!1}collectReachableHandlers(e=new Set,t=new Map){if(e.has(this))return t;e.add(this);for(let o of this.handlerMap.getArray()){let n=t.get(o.method);n||(n=new Set,t.set(o.method,n)),n.add(this)}for(let o of[...this.routerMap.getArray(),...this.fallbackRouterMap.getArray()])o.collectReachableHandlers(e,t);return t}getAffectedCompositionRoots(){let e=new Set,t=[this];for(;t.length>0;){let o=t.pop();e.has(o)||(e.add(o),t.push(...o.routerMap.getArray(),...o.fallbackParentRouters))}return e}validateAffectedCompositionRoots(){for(let e of this.getAffectedCompositionRoots())for(let[t,o]of e.collectReachableHandlers())if(o.size>1)throw new Error(`TypedRouter composition exposes more than one handler for method "${t}".`)}checkForTypedHandler(e){return!!this.getTypedHandlerForMethod(e)}getTypedHandlerForMethod(e,t=[]){t.push(this);let o;return o=this.handlerMap.findSync(n=>n.method===e),o||this.routerMap.getArray().forEach(n=>{!o&&!t.includes(n)&&(o=n.getTypedHandlerForMethod(e,t))}),o||this.fallbackRouterMap.getArray().forEach(n=>{!o&&!t.includes(n)&&(o=n.getTypedHandlerForMethod(e,t))}),o}getTypedHandlerAndRouter(e,t=[]){t.push(this);let o=this.handlerMap.findSync(n=>n.method===e);if(o)return{handler:o,router:this};for(let n of this.routerMap.getArray())if(!t.includes(n)){let s=n.getTypedHandlerAndRouter(e,t);if(s)return s}for(let n of this.fallbackRouterMap.getArray())if(!t.includes(n)){let s=n.getTypedHandlerAndRouter(e,t);if(s)return s}return null}static{this.defaultRouteOptions={localRequest:!1,skipHooks:!1}}async routeAndAddResponse(e,t={}){let o={...r.defaultRouteOptions,...t};if(e=Oe.decodePayloadFromNetwork(e,{typedrouter:this}),e.localData=o.trustedLocalData?{...o.trustedLocalData}:e.localData||{},e.localData.firstTypedrouter=this,e.method==="##VirtualStream##"){let n=await this.handleStreamTypedRequest(e);return n.localData=null,n}if(e?.correlation?.phase==="request"||o.localRequest){let n=Date.now();o.skipHooks||this.callHook("onIncomingRequest",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"incoming",phase:"request",timestamp:n,payload:e.request});let s=this.getTypedHandlerAndRouter(e.method);if(!s)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.localData=void 0,e=Oe.encodePayloadForNetwork(e,{typedrouter:this}),o.skipHooks||this.callHook("onOutgoingResponse",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"outgoing",phase:"response",timestamp:Date.now(),durationMs:Date.now()-n,payload:e.response,errorText:e.error?.text}),e;let{handler:a,router:u}=s;if(u.middlewares.length>0)try{for(let c of u.middlewares)await c(e)}catch(c){return this.setErrorFromCaughtError(e,c,`middleware for method '${e.method}'`),e.correlation.phase="response",e.localData=void 0,e=Oe.encodePayloadForNetwork(e,{typedrouter:this}),o.skipHooks||this.callHook("onOutgoingResponse",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"outgoing",phase:"response",timestamp:Date.now(),durationMs:Date.now()-n,payload:e.response,errorText:e.error?.text}),e}return e=await a.addResponse(e),e.localData=void 0,e=Oe.encodePayloadForNetwork(e,{typedrouter:this}),o.skipHooks||this.callHook("onOutgoingResponse",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"outgoing",phase:"response",timestamp:Date.now(),durationMs:Date.now()-n,payload:e.response,errorText:e.error?.text}),e}else return e?.correlation?.phase==="response"?(o.skipHooks||this.callHook("onIncomingResponse",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"incoming",phase:"response",timestamp:Date.now(),payload:e.response,errorText:e.error?.text}),this.fireEventInterestMap.findInterest(e.correlation.id)?.fullfillInterest(e),null):(console.log("TypedRouter received a malformed request DTO"),null)}async handleStreamTypedRequest(e){let t=this.getRegisteredVirtualStreamById(e.request.streamId);return t?t.handleStreamTr(e):(e.response={streamId:e.request.streamId,cycleId:e.request.cycleId,cycle:"response",mainPurpose:"end",keepAlive:!1,next:!1,backpressure:!1},e)}};var Gr="#############CLOSING BIT#############",It=class extends Error{static{i(this,"VirtualStreamClosedError")}constructor(e="VirtualStream is closed",t){super(e,t),this.name="VirtualStreamClosedError"}},Lo=class{static{i(this,"VirtualStreamActivationScope")}constructor(){this.trackedStreams=new Set,this.settled=!1}track(e){this.settled||this.trackedStreams.add(e)}commit(){let e=[...this.trackedStreams];this.settled=!0,this.trackedStreams.clear();for(let t of e)t.commitActivation()}async rollback(e){if(this.settled)return;this.settled=!0;let t=[...this.trackedStreams];this.trackedStreams.clear(),await Promise.all(t.map(o=>o.abort(e)))}},Oe=class r{static{i(this,"VirtualStream")}constructor(){this.streamId=et.uni(),this.lifecycleStateInternal="idle",this.keepAlive=!0,this.sendAdmissionTail=Promise.resolve(),this.frameAdmissionTail=Promise.resolve(),this.closeStarted=!1,this.activationCommitted=!1,this.activationResolvers=new Set,this.respondingDrainResolvers=new Set,this.sendBackpressuredArray=new ie.BackpressuredArray(16),this.receiveBackpressuredArray=new ie.BackpressuredArray(16)}static{this.respondingRegistrationIdleTimeoutMs=15e3}static{this.gracefulCloseTimeoutMs=1e4}static encodePayloadForNetwork(e,t,o,n=[]){return!e||Gt.isBufferLike(e)?e:e instanceof r?(e.activate(t),!o?.response||n.includes("response")?{_isVirtualStream:!0,streamId:e.streamId}:{_OBMITTED_VIRTUAL_STREAM:!0,reason:"path is under .request: omitted for deduplication reasons in response cycle."}):Array.isArray(e)?e.map((s,a)=>r.encodePayloadForNetwork(s,t,o||e,n.concat(String(a)))):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"?e:Object.entries(e).reduce((s,[a,u])=>(s[a]=r.encodePayloadForNetwork(u,t,o||e,n.concat(a)),s),{}):e}static decodePayloadFromNetwork(e,t){return r.decodePayloadFromNetworkInternal(e,t,new Map)}static containsNetworkDescriptor(e){return!e||Gt.isBufferLike(e)||typeof e!="object"?!1:e._isVirtualStream===!0?!0:Array.isArray(e)?e.some(t=>r.containsNetworkDescriptor(t)):Object.values(e).some(t=>r.containsNetworkDescriptor(t))}static decodePayloadFromNetworkInternal(e,t,o){if(Gt.isBufferLike(e)||e instanceof Ao||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){if(typeof e.streamId!="string"||e.streamId.length===0)throw new TypeError("VirtualStream network descriptor requires a non-empty streamId");let n=o.get(e.streamId);if(n)return n;let s=t.typedrouter?.getRegisteredVirtualStreamById(e.streamId);if(s)return s.refreshRespondingRegistration(),o.set(e.streamId,s),s;let a=new r;return a.streamId=e.streamId,a.activate(t),o.set(e.streamId,a),a}return Array.isArray(e)?e.map(n=>r.decodePayloadFromNetworkInternal(n,t,o)):Object.keys(e).reduce((n,s)=>(n[s]=r.decodePayloadFromNetworkInternal(e[s],t,o),n),{})}get lifecycleState(){return this.lifecycleStateInternal}activate(e){if(this.lifecycleStateInternal==="closed")throw this.getCloseError();let t=e.sendMethod?"requesting":e.typedrouter?"responding":void 0;if(!t)throw new Error("VirtualStream requires a send method or TypedRouter");if(this.lifecycleStateInternal==="active"&&this.side!==t)throw new Error(`VirtualStream ${this.streamId} is already active on the ${this.side} side`);let o=this.lifecycleStateInternal==="idle";if(this.lifecycleStateInternal="active",this.keepAlive=!0,this.side=t,t==="requesting")this.sendMethod=e.sendMethod;else{if(this.typedrouter=e.typedrouter,this.typedrouter.registerVirtualStream(this)!==this)throw this.lifecycleStateInternal="idle",this.typedrouter=void 0,new Error(`VirtualStream ${this.streamId} is already registered on this router`);this.refreshRespondingRegistration()}o&&(e.activationScope?e.activationScope.track(this):this.commitActivation())}commitActivation(){if(this.lifecycleStateInternal==="active"&&this.side==="requesting"){this.activationCommitted=!0;let e=[...this.activationResolvers];this.activationResolvers.clear();for(let t of e)t();this.startKeepAliveLoop(),this.ensureQueueWork()}}getCloseError(e){return this.closeError||(this.closeError=new It("VirtualStream is closed",e===void 0?void 0:{cause:e})),this.closeError}assertNotClosed(){if(this.lifecycleStateInternal==="closed")throw this.getCloseError()}assertCanSend(){if(this.assertNotClosed(),this.closeStarted)throw new It("VirtualStream is closing")}async acquireSendAdmission(){let e=this.sendAdmissionTail,t;return this.sendAdmissionTail=new Promise(o=>{t=o}),await e,t}async acquireFrameAdmission(){let e=this.frameAdmissionTail,t;return this.frameAdmissionTail=new Promise(o=>{t=o}),await e,t}async waitForOutboundDrain(){for(;this.sendBackpressuredArray.data.length>0||this.queueWorkPromise;){this.assertNotClosed(),this.ensureQueueWork();let e=this.queueWorkPromise;e?await e:this.activationCommitted||await new Promise(t=>{this.activationResolvers.add(t)})}this.assertNotClosed()}async waitWithinGracefulCloseDeadline(e){let t,o=new Promise((n,s)=>{t=setTimeout(()=>{s(new It("VirtualStream graceful close timed out"))},r.gracefulCloseTimeoutMs),t.unref?.()});try{await Promise.race([e,o])}finally{t&&clearTimeout(t)}}async waitForRespondingDrain(){this.sendBackpressuredArray.data.length!==0&&await new Promise(e=>{this.respondingDrainResolvers.add(e)})}resolveRespondingDrain(){if(this.sendBackpressuredArray.data.length>0)return;let e=[...this.respondingDrainResolvers];this.respondingDrainResolvers.clear();for(let t of e)t()}static reconstituteBinaryData(e){if(e==null||e instanceof Uint8Array||typeof Buffer<"u"&&Buffer.isBuffer(e))return e;if(typeof e=="object"){if(e.type==="EncodedBuffer"&&typeof e.data=="string"&&e.data.startsWith("base64:")){let o=e.data.slice(7);if(typeof Buffer<"u"){let n=Buffer.from(o,"base64");return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}return new Uint8Array(Array.from(atob(o)).map(n=>n.charCodeAt(0)))}if(e.type==="Buffer"&&Array.isArray(e.data))return new Uint8Array(e.data);let t=Object.keys(e);if(t.length>0&&t.every(o=>/^\d+$/.test(o))){let o=new Array(t.length);for(let n of t)o[Number(n)]=e[n];if(o.every(n=>typeof n=="number"))return new Uint8Array(o)}}return e}ensureQueueWork(){this.lifecycleStateInternal==="closed"||this.side!=="requesting"||!this.activationCommitted||this.queueWorkPromise||(this.queueWorkPromise=this.workOnQueue().catch(async e=>{await this.abort(e)}).finally(()=>{this.queueWorkPromise=void 0,this.lifecycleStateInternal==="active"&&this.side==="requesting"&&this.sendBackpressuredArray.data.length>0&&this.ensureQueueWork()}))}async workOnQueue(){this.assertNotClosed();let e=!this.receiveBackpressuredArray.checkSpaceAvailable(),t=!1,o=!1,n=i(async()=>{let s=await this.sendStreamRequest({streamId:this.streamId,cycleId:et.uni(),cycle:"request",mainPurpose:"feedback",next:this.sendBackpressuredArray.data.length>0,backpressure:!this.receiveBackpressuredArray.checkSpaceAvailable()});this.acceptRemoteResponse(s)&&(o=!!s.response?.backpressure,t=!!s.response?.next)},"getFeedback");for(await n();this.sendBackpressuredArray.data.length>0||t;){for(this.assertNotClosed(),t&&this.sendBackpressuredArray.data.length===0&&!this.receiveBackpressuredArray.checkSpaceAvailable()&&(await this.receiveBackpressuredArray.waitForSpace(),this.assertNotClosed(),e=!this.receiveBackpressuredArray.checkSpaceAvailable());o;)await A.delayFor(50),this.assertNotClosed(),await n();let s=this.sendBackpressuredArray.data.length>0?this.sendBackpressuredArray.shift():void 0,a=await this.sendStreamRequest({streamId:this.streamId,cycleId:et.uni(),cycle:"request",mainPurpose:s===void 0?"read":"chunk",backpressure:e,next:this.sendBackpressuredArray.data.length>0,...s===void 0?{}:{chunkData:s}});if(!this.acceptRemoteResponse(a))return;o=!!a.response?.backpressure,e=!this.receiveBackpressuredArray.checkSpaceAvailable(),t=!!a.response?.next}}async sendStreamRequest(e){let t=await this.acquireFrameAdmission();try{if(this.assertNotClosed(),!this.sendMethod)throw new Error("VirtualStream is missing a send method");return await this.sendMethod({method:"##VirtualStream##",request:e,response:null})}finally{t()}}acceptRemoteResponse(e){if(this.lifecycleStateInternal==="closed")return!1;let t=e.response?.chunkData;return t!==void 0&&this.receiveBackpressuredArray.push(r.reconstituteBinaryData(t)),e.response?.keepAlive===!1||e.response?.mainPurpose==="end"?(this.terminate(new It("Remote VirtualStream is closed"),t===Gr),!1):!0}async handleStreamTr(e){if(this.lifecycleStateInternal==="closed")return e.response=this.createClosedResponse(e),e;if(this.refreshRespondingRegistration(),e.request.keepAlive===!1||e.request.mainPurpose==="end")return e.response=this.createClosedResponse(e),await this.abort(),e;let t=e.request.chunkData===Gr;e.request.chunkData!==void 0&&this.receiveBackpressuredArray.push(r.reconstituteBinaryData(e.request.chunkData));let o=!!e.request.backpressure,n=!t&&!o&&this.sendBackpressuredArray.data.length>0?this.sendBackpressuredArray.shift():void 0;this.resolveRespondingDrain();let s=n===Gr;return e.response={streamId:this.streamId,cycleId:e.request.cycleId,cycle:"response",mainPurpose:s?"end":n!==void 0?"chunk":e.request.mainPurpose==="keepAlive"?"keepAlive":"feedback",keepAlive:!s,next:this.sendBackpressuredArray.data.length>0,backpressure:!this.receiveBackpressuredArray.checkSpaceAvailable(),...n===void 0?{}:{chunkData:n}},(t||s)&&(e.response.mainPurpose="end",e.response.keepAlive=!1,this.terminate(void 0,t)),e}createClosedResponse(e){return{streamId:e.request.streamId,cycleId:e.request.cycleId,cycle:"response",mainPurpose:"end",keepAlive:!1,next:!1,backpressure:!1}}refreshRespondingRegistration(){this.side!=="responding"||this.lifecycleStateInternal!=="active"||(this.respondingExpiryTimer&&clearTimeout(this.respondingExpiryTimer),this.respondingExpiryTimer=setTimeout(()=>{this.abort(new It("Responding VirtualStream registration expired"))},r.respondingRegistrationIdleTimeoutMs),this.respondingExpiryTimer.unref?.())}async cleanup(){await this.abort()}cleanupRegistration(){if(this.respondingExpiryTimer&&(clearTimeout(this.respondingExpiryTimer),this.respondingExpiryTimer=void 0),this.typedrouter){let e=this.typedrouter;this.typedrouter=void 0,e.unregisterVirtualStream(this)}}startKeepAliveLoop(){this.side!=="requesting"||this.lifecycleStateInternal==="closed"||this.keepAliveLoopPromise||(this.keepAliveLoopPromise=this.runKeepAliveLoop().catch(async e=>{await this.abort(e)}).finally(()=>{this.keepAliveLoopPromise=void 0}))}async runKeepAliveLoop(){for(await A.delayFor(0);this.keepAlive&&this.lifecycleStateInternal==="active";)await this.triggerKeepAlive(),this.keepAlive&&this.lifecycleStateInternal==="active"&&await A.delayFor(1e3)}async triggerKeepAlive(){let e=await this.sendStreamRequest({streamId:this.streamId,cycleId:et.uni(),cycle:"request",mainPurpose:"keepAlive",keepAlive:!0,backpressure:!this.receiveBackpressuredArray.checkSpaceAvailable()});this.acceptRemoteResponse(e)&&e.response?.next&&this.ensureQueueWork()}async sendData(e){let t=await this.acquireSendAdmission();try{this.assertCanSend(),await this.sendBackpressuredArray.waitForSpace(),this.assertCanSend(),this.sendBackpressuredArray.push(e),this.ensureQueueWork(),await this.sendBackpressuredArray.waitForSpace(),this.assertCanSend()}finally{t()}}async fetchData(){if(this.receiveBackpressuredArray.checkHasItems())return this.receiveBackpressuredArray.shift();if(this.assertNotClosed(),await this.receiveBackpressuredArray.waitForItems(),!this.receiveBackpressuredArray.checkHasItems())throw this.getCloseError();return this.receiveBackpressuredArray.shift()}async readFromWebstream(e,t=!0){let o=e.getReader();try{let n=!1;for(;!n;){let{value:s,done:a}=await o.read();s!==void 0&&await this.sendData(s),n=a}t&&await this.close(!0)}finally{o.releaseLock()}}async writeToWebstream(e){let t=e.getWriter();try{for(;this.lifecycleStateInternal!=="closed"||this.receiveBackpressuredArray.checkHasItems();){let o=await this.fetchData();if(o===Gr)break;await t.write(o)}await t.close()}finally{t.releaseLock()}}async close(e=!1){if(this.lifecycleStateInternal!=="closed"){if(this.closeStarted=!0,e){if(this.side==="requesting"&&this.sendMethod)try{await this.waitWithinGracefulCloseDeadline(this.waitForOutboundDrain()),await this.sendStreamRequest({streamId:this.streamId,cycleId:et.uni(),cycle:"request",mainPurpose:"chunk",chunkData:Gr,next:!1,backpressure:!1})}catch{}else if(this.side==="responding"){this.sendBackpressuredArray.push(Gr);try{await this.waitWithinGracefulCloseDeadline(this.waitForRespondingDrain())}catch{}}}await this.abort()}}async abort(e){this.terminate(e)}terminate(e,t=!1){if(this.lifecycleStateInternal==="closed")return;this.getCloseError(e),this.lifecycleStateInternal="closed",this.keepAlive=!1,this.activationCommitted=!1,this.sendMethod=void 0,this.sendBackpressuredArray.data.length=0,t||(this.receiveBackpressuredArray.data.length=0),this.sendBackpressuredArray.destroy(),this.receiveBackpressuredArray.destroy();let o=[...this.activationResolvers];this.activationResolvers.clear();for(let s of o)s();let n=[...this.respondingDrainResolvers];this.respondingDrainResolvers.clear();for(let s of n)s();this.cleanupRegistration()}};var uu=class{static{i(this,"TypedTarget")}constructor(e){if(this.isAsync=!1,e.postMethodWithTypedRouter&&!e.typedRouterRef)throw new Error("you have to specify a typedrouter when using postmethod with typedrouter");let t=e.responseTimeoutMs??3e4;if(!Number.isSafeInteger(t)||t<=0||t>2147483647)throw new RangeError("TypedTarget responseTimeoutMs must be a positive safe integer no greater than 2147483647");this.options=e,this.responseTimeoutMs=t}async post(e,t={}){if(t.signal&&this.options.supportsAbortSignal!==!0)throw new Error("TypedTarget does not declare AbortSignal transport support");let o=this.options.postMethod||this.options.postMethodWithTypedRouter;if(!o)throw new Error("TypedTarget requires a post method");let n;this.options.typedRouterRef&&(n=await this.options.typedRouterRef.fireEventInterestMap.addInterest(e.correlation.id,e));let s=t.signal;if(s?.aborted)throw n?.destroy(),s.reason??new DOMException("The operation was aborted","AbortError");let a,u=s?new Promise((l,m)=>{a=i(()=>{n?.destroy(),m(s.reason??new DOMException("The operation was aborted","AbortError"))},"abortListener"),s.addEventListener("abort",a,{once:!0})}):void 0,c,f=n?new Promise((l,m)=>{c=setTimeout(()=>{m(new Error(`TypedTarget response timed out after ${this.responseTimeoutMs}ms`))},this.responseTimeoutMs),c.unref?.()}):void 0;try{let l=Promise.resolve(o(e,t)),m=await Promise.race([l,...f?[f]:[],...u?[u]:[]]);return n?await Promise.race([n.interestFullfilled,f,...u?[u]:[]]):m||e}finally{c&&clearTimeout(c),s&&a&&s.removeEventListener("abort",a),n?.destroy()}}};var tm=new Ur.WebrequestClient,Fs=2147483647,rm=1e4,Ws=class extends Error{static{i(this,"TypedRequestTimeoutError")}constructor(e,t){super(`Typed request "${e}" timed out after ${t}ms`),this.name="TypedRequestTimeoutError",this.method=e,this.timeoutMs=t}},As=class extends Error{static{i(this,"TypedRequestRetryLimitError")}constructor(e,t){super(`Typed request "${e}" exceeded its ${t} server-directed retries`),this.name="TypedRequestRetryLimitError",this.method=e,this.maxRetries=t}},cu=class{static{i(this,"TypedRequest")}constructor(e,t){this.skipHooks=!1,typeof e=="string"?this.urlEndPoint=e:this.typedTarget=e,this.method=t}async fire(e,t=!1){let o=Date.now(),n=this.resolveFireOptions(t),s=new Lo,a={method:this.method,request:e,response:null,correlation:{id:et.uni(),phase:"request"}};try{a=Oe.encodePayloadForNetwork(a,{sendMethod:i(m=>this.postStreamTrObject(m),"sendMethod"),activationScope:s});let u=Oe.containsNetworkDescriptor(a);if(u&&!this.urlEndPoint&&this.typedTarget.options.supportsAbortSignal!==!0)throw new Error("VirtualStreams require TypedTarget AbortSignal transport support");if(n.useCache&&u)throw new Error("TypedRequest response caching is not supported for requests containing VirtualStreams");this.assertDeadline(n),n.useCache&&(n.cacheKey=await this.createCacheKey(a),this.assertDeadline(n)),this.skipHooks||Vr("onOutgoingRequest",{correlationId:a.correlation.id,method:this.method,direction:"outgoing",phase:"request",timestamp:o,payload:e});let c=await this.postTrObject(a,n),f=c.error;if(this.assertDeadline(n),f)throw this.skipHooks||Vr("onIncomingResponse",{correlationId:a.correlation.id,method:this.method,direction:"incoming",phase:"response",timestamp:Date.now(),durationMs:Date.now()-o,payload:c.response,errorText:f.text}),this.assertDeadline(n),new Fe(f.text,f.data);let l=Oe.containsNetworkDescriptor(c);if(l&&!this.urlEndPoint&&this.typedTarget.options.supportsAbortSignal!==!0)throw new Error("VirtualStreams require TypedTarget AbortSignal transport support");return n.useCache&&n.cacheKey&&l&&(await tm.deleteCache(n.cacheKey),this.assertDeadline(n)),c=Oe.decodePayloadFromNetwork(c,{sendMethod:i(m=>this.postStreamTrObject(m),"sendMethod"),activationScope:s}),this.assertDeadline(n),this.skipHooks||Vr("onIncomingResponse",{correlationId:a.correlation.id,method:this.method,direction:"incoming",phase:"response",timestamp:Date.now(),durationMs:Date.now()-o,payload:c?.response}),this.assertDeadline(n),s.commit(),c.response}catch(u){throw await s.rollback(u),u}}async postTrObject(e,t={useCache:!1,maxRetries:3}){let o=0;for(;;){this.assertDeadline(t);let n;if(this.urlEndPoint)try{n=await tm.postJson(this.urlEndPoint,e,{cacheKey:t.cacheKey,cacheStrategy:t.useCache?"cache-first":"network-only",timeout:this.getRemainingTimeout(t)})}catch(s){throw t.timeoutMs!==void 0&&(this.hasDeadlineExpired(t)||Ur.isWebrequestTimeoutError(s))?this.createTimeoutError(t):s}else n=await this.postTypedTarget(e,t);if(this.assertDeadline(t),n.error&&!n.retry||!n.retry)return n;if(console.log(`Server requested a retry for TypedRequest method '${this.method}'`),o>=t.maxRetries)throw new As(this.method,t.maxRetries);o+=1,await this.waitForRetry(n.retry.waitForMs,t)}}async postStreamTrObject(e){let t={useCache:!1,maxRetries:3,timeoutMs:rm,deadlineAt:performance.now()+rm};return this.postTrObject(e,t)}async postTypedTarget(e,t){let o=this.getRemainingTimeout(t);if(o===void 0)return this.typedTarget.post(e);let n=new AbortController,s=setTimeout(()=>{n.abort(this.createTimeoutError(t))},o);s.unref?.();try{return await this.typedTarget.post(e,{signal:n.signal})}catch(a){throw n.signal.aborted?this.createTimeoutError(t):a}finally{clearTimeout(s)}}resolveFireOptions(e){let t=typeof e=="boolean"?{useCache:e}:e;if(!t||typeof t!="object")throw new TypeError("TypedRequest fire options must be a boolean or an options object");if(t.useCache!==void 0&&typeof t.useCache!="boolean")throw new TypeError("TypedRequest useCache must be a boolean");if(t.timeoutMs!==void 0&&(!Number.isSafeInteger(t.timeoutMs)||t.timeoutMs<=0||t.timeoutMs>Fs))throw new RangeError(`TypedRequest timeoutMs must be a positive safe integer no greater than ${Fs}`);if(t.maxRetries!==void 0&&(!Number.isSafeInteger(t.maxRetries)||t.maxRetries<0||t.maxRetries>1e3))throw new RangeError("TypedRequest maxRetries must be a safe integer between 0 and 1000");if(t.timeoutMs!==void 0&&!this.urlEndPoint&&this.typedTarget.options.supportsAbortSignal!==!0)throw new Error("TypedRequest timeoutMs requires an HTTP URL or a TypedTarget with AbortSignal support");return{useCache:t.useCache??!1,timeoutMs:t.timeoutMs,maxRetries:t.maxRetries??3,deadlineAt:t.timeoutMs===void 0?void 0:performance.now()+t.timeoutMs}}getRemainingTimeout(e){if(e.deadlineAt===void 0||e.timeoutMs===void 0)return;let t=Math.ceil(e.deadlineAt-performance.now());if(t<=0)throw this.createTimeoutError(e);return t}assertDeadline(e){this.getRemainingTimeout(e)}hasDeadlineExpired(e){return e.deadlineAt!==void 0&&performance.now()>=e.deadlineAt}createTimeoutError(e){return new Ws(this.method,e.timeoutMs)}async waitForRetry(e,t){if(!Number.isSafeInteger(e)||e<=0||e>Fs)throw new RangeError(`TypedRequest retry waitForMs must be a positive safe integer no greater than ${Fs}`);let o=this.getRemainingTimeout(t);if(o===void 0){await A.delayFor(e);return}if(e>=o)throw await A.delayFor(o),this.createTimeoutError(t);await A.delayFor(e),this.assertDeadline(t)}async createCacheKey(e){let t=JSON.stringify({endpoint:this.urlEndPoint,method:e.method,request:e.request}),o=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return`typedrequest:v1:${Array.from(new Uint8Array(o),s=>s.toString(16).padStart(2,"0")).join("")}`}};function om(r){return r&&typeof r.then=="function"}i(om,"isPromise");var nm=Promise.resolve(!1),eie=Promise.resolve(!0),Je=Promise.resolve();function Ls(r,e){return r||(r=0),new Promise(function(t){return setTimeout(function(){return t(e)},r)})}i(Ls,"sleep");function im(r,e){return Math.floor(Math.random()*(e-r+1)+r)}i(im,"randomInt");function Yo(){return Math.random().toString(36).substring(2)}i(Yo,"randomToken");var fu=0;function tt(){var r=Date.now()*1e3;return r<=fu&&(r=fu+1),fu=r,r}i(tt,"microSeconds");function tie(){return typeof navigator<"u"&&typeof navigator.locks<"u"&&typeof navigator.locks.request=="function"}i(tie,"supportsWebLockAPI");var hw=tt,yw="native";function xw(r){var e={time:tt(),messagesCallback:null,bc:new BroadcastChannel(r),subFns:[]};return e.bc.onmessage=function(t){e.messagesCallback&&e.messagesCallback(t.data)},e}i(xw,"create");function gw(r){r.bc.close(),r.subFns=[]}i(gw,"close");function ww(r,e){try{return r.bc.postMessage(e,!1),Je}catch(t){return Promise.reject(t)}}i(ww,"postMessage");function bw(r,e){r.messagesCallback=e}i(bw,"onMessage");function vw(){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(vw,"canBeUsed");function Tw(){return 150}i(Tw,"averageResponseTime");var sm={create:xw,close:gw,onMessage:bw,postMessage:ww,canBeUsed:vw,type:yw,averageResponseTime:Tw,microSeconds:hw};var Qr=class{static{i(this,"ObliviousSet")}ttl;map=new Map;_to=!1;constructor(e){this.ttl=e}has(e){let t=this.map.get(e);return typeof t>"u"?!1:t<lu()-this.ttl?(this.map.delete(e),!1):!0}add(e){this.map.delete(e),this.map.set(e,lu()),this._to||(this._to=!0,setTimeout(()=>{this._to=!1,Dw(this)},0))}clear(){this.map.clear()}};function Dw(r){let e=lu()-r.ttl,t=r.map[Symbol.iterator]();for(;;){let o=t.next().value;if(!o)break;let n=o[0];if(o[1]<e)r.map.delete(n);else break}}i(Dw,"removeTooOldValues");function lu(){return Date.now()}i(lu,"now");function Xt(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=JSON.parse(JSON.stringify(r));return typeof e.webWorkerSupport>"u"&&(e.webWorkerSupport=!0),e.idb||(e.idb={}),e.idb.ttl||(e.idb.ttl=1e3*45),e.idb.fallbackInterval||(e.idb.fallbackInterval=150),r.idb&&typeof r.idb.onclose=="function"&&(e.idb.onclose=r.idb.onclose),e.localstorage||(e.localstorage={}),e.localstorage.removeTimeout||(e.localstorage.removeTimeout=1e3*60),r.methods&&(e.methods=r.methods),e.node||(e.node={}),e.node.ttl||(e.node.ttl=1e3*60*2),e.node.maxParallelWrites||(e.node.maxParallelWrites=2048),typeof e.node.useFastPath>"u"&&(e.node.useFastPath=!0),e}i(Xt,"fillOptionsWithDefaults");var Sw=tt,Mw="pubkey.broadcast-channel-0-",Ye="messages",Bo={durability:"relaxed"},kw="idb";function am(){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(am,"getIdb");function Ys(r){r.commit&&r.commit()}i(Ys,"commitIndexedDBTransaction");function Ow(r){var e=am(),t=Mw+r,o=e.open(t);return o.onupgradeneeded=function(n){var s=n.target.result;s.createObjectStore(Ye,{keyPath:"id",autoIncrement:!0})},new Promise(function(n,s){o.onerror=function(a){return s(a)},o.onsuccess=function(){n(o.result)}})}i(Ow,"createDatabase");function Iw(r,e,t){var o=Date.now(),n={uuid:e,time:o,data:t},s=r.transaction([Ye],"readwrite",Bo);return new Promise(function(a,u){s.oncomplete=function(){return a()},s.onerror=function(f){return u(f)};var c=s.objectStore(Ye);c.add(n),Ys(s)})}i(Iw,"writeMessage");function pie(r){var e=r.transaction(Ye,"readonly",Bo),t=e.objectStore(Ye),o=[];return new Promise(function(n){t.openCursor().onsuccess=function(s){var a=s.target.result;a?(o.push(a.value),a.continue()):(Ys(e),n(o))}})}i(pie,"getAllMessages");function Ew(r,e){var t=r.transaction(Ye,"readonly",Bo),o=t.objectStore(Ye),n=[],s=IDBKeyRange.bound(e+1,1/0);if(o.getAll){var a=o.getAll(s);return new Promise(function(c,f){a.onerror=function(l){return f(l)},a.onsuccess=function(l){c(l.target.result)}})}function u(){try{return s=IDBKeyRange.bound(e+1,1/0),o.openCursor(s)}catch{return o.openCursor()}}return i(u,"openCursor"),new Promise(function(c,f){var l=u();l.onerror=function(m){return f(m)},l.onsuccess=function(m){var p=m.target.result;p?p.value.id<e+1?p.continue(e+1):(n.push(p.value),p.continue()):(Ys(t),c(n))}})}i(Ew,"getMessagesHigherThan");function _w(r,e){if(r.closed)return Promise.resolve([]);var t=r.db.transaction(Ye,"readwrite",Bo),o=t.objectStore(Ye);return Promise.all(e.map(function(n){var s=o.delete(n);return new Promise(function(a){s.onsuccess=function(){return a()}})}))}i(_w,"removeMessagesById");function Cw(r,e){var t=Date.now()-e,o=r.transaction(Ye,"readonly",Bo),n=o.objectStore(Ye),s=[];return new Promise(function(a){n.openCursor().onsuccess=function(u){var c=u.target.result;if(c){var f=c.value;f.time<t?(s.push(f),c.continue()):(Ys(o),a(s))}else a(s)}})}i(Cw,"getOldMessages");function Pw(r){return Cw(r.db,r.options.idb.ttl).then(function(e){return _w(r,e.map(function(t){return t.id}))})}i(Pw,"cleanOldMessages");function Nw(r,e){return e=Xt(e),Ow(r).then(function(t){var o={closed:!1,lastCursorId:0,channelName:r,options:e,uuid:Yo(),eMIs:new Qr(e.idb.ttl*2),writeBlockPromise:Je,messagesCallback:null,readQueuePromises:[],db:t};return t.onclose=function(){o.closed=!0,e.idb.onclose&&e.idb.onclose()},um(o),o})}i(Nw,"create");function um(r){r.closed||cm(r).then(function(){return Ls(r.options.idb.fallbackInterval)}).then(function(){return um(r)})}i(um,"_readLoop");function Rw(r,e){return!(r.uuid===e.uuid||e.eMIs.has(r.id)||r.data.time<e.messagesCallbackTime)}i(Rw,"_filterMessage");function cm(r){return r.closed?Je:r.messagesCallback?Ew(r.db,r.lastCursorId).then(function(e){var t=e.filter(function(o){return!!o}).map(function(o){return o.id>r.lastCursorId&&(r.lastCursorId=o.id),o}).filter(function(o){return Rw(o,r)}).sort(function(o,n){return o.time-n.time});return t.forEach(function(o){r.messagesCallback&&(r.eMIs.add(o.id),r.messagesCallback(o.data))}),Je}):Je}i(cm,"readNewMessages");function Fw(r){r.closed=!0,r.db.close()}i(Fw,"close");function Ww(r,e){return r.writeBlockPromise=r.writeBlockPromise.then(function(){return Iw(r.db,r.uuid,e)}).then(function(){im(0,10)===0&&Pw(r)}),r.writeBlockPromise}i(Ww,"postMessage");function Aw(r,e,t){r.messagesCallbackTime=t,r.messagesCallback=e,cm(r)}i(Aw,"onMessage");function Lw(){return!!am()}i(Lw,"canBeUsed");function Yw(r){return r.idb.fallbackInterval*2}i(Yw,"averageResponseTime");var fm={create:Nw,close:Fw,onMessage:Aw,postMessage:Ww,canBeUsed:Lw,type:kw,averageResponseTime:Yw,microSeconds:Sw};var Bw=tt,Hw="pubkey.broadcastChannel-",qw="localstorage";function lm(){var r;if(typeof window>"u")return null;try{r=window.localStorage,r=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return r}i(lm,"getLocalStorage");function dm(r){return Hw+r}i(dm,"storageKey");function Uw(r,e){return new Promise(function(t){Ls().then(function(){var o=dm(r.channelName),n={token:Yo(),time:Date.now(),data:e,uuid:r.uuid},s=JSON.stringify(n);lm().setItem(o,s);var a=document.createEvent("Event");a.initEvent("storage",!0,!0),a.key=o,a.newValue=s,window.dispatchEvent(a),t()})})}i(Uw,"postMessage");function jw(r,e){var t=dm(r),o=i(function(s){s.key===t&&e(JSON.parse(s.newValue))},"listener");return window.addEventListener("storage",o),o}i(jw,"addStorageEventListener");function $w(r){window.removeEventListener("storage",r)}i($w,"removeStorageEventListener");function zw(r,e){if(e=Xt(e),!mm())throw new Error("BroadcastChannel: localstorage cannot be used");var t=Yo(),o=new Qr(e.localstorage.removeTimeout),n={channelName:r,uuid:t,eMIs:o};return n.listener=jw(r,function(s){n.messagesCallback&&s.uuid!==t&&(!s.token||o.has(s.token)||s.data.time&&s.data.time<n.messagesCallbackTime||(o.add(s.token),n.messagesCallback(s.data)))}),n}i(zw,"create");function Vw(r){$w(r.listener)}i(Vw,"close");function Gw(r,e,t){r.messagesCallbackTime=t,r.messagesCallback=e}i(Gw,"onMessage");function mm(){var r=lm();if(!r)return!1;try{var e="__broadcastchannel_check";r.setItem(e,"works"),r.removeItem(e)}catch{return!1}return!0}i(mm,"canBeUsed");function Qw(){var r=120,e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")?r*2:r}i(Qw,"averageResponseTime");var pm={create:zw,close:Vw,onMessage:Gw,postMessage:Uw,canBeUsed:mm,type:qw,averageResponseTime:Qw,microSeconds:Bw};var hm=tt,Jw="simulate",du=new Set;function Kw(r){var e={time:hm(),name:r,messagesCallback:null};return du.add(e),e}i(Kw,"create");function Xw(r){du.delete(r)}i(Xw,"close");var ym=5;function Zw(r,e){return new Promise(function(t){return setTimeout(function(){var o=Array.from(du);o.forEach(function(n){n.name===r.name&&n!==r&&n.messagesCallback&&n.time<e.time&&n.messagesCallback(e)}),t()},ym)})}i(Zw,"postMessage");function eb(r,e){r.messagesCallback=e}i(eb,"onMessage");function tb(){return!0}i(tb,"canBeUsed");function rb(){return ym}i(rb,"averageResponseTime");var xm={create:Kw,close:Xw,onMessage:eb,postMessage:Zw,canBeUsed:tb,type:Jw,averageResponseTime:rb,microSeconds:hm};var gm=[sm,fm,pm];function mu(r){var e=[].concat(r.methods,gm).filter(Boolean);if(r.type){if(r.type==="simulate")return xm;var t=e.find(function(n){return n.type===r.type});if(t)return t;throw new Error("method-type "+r.type+" not found")}r.webWorkerSupport||(e=e.filter(function(n){return n.type!=="idb"}));var o=e.find(function(n){return n.canBeUsed()});if(o)return o;throw new Error("No usable method found in "+JSON.stringify(gm.map(function(n){return n.type})))}i(mu,"chooseMethod");var hu=new Set,ob=0,Zt=i(function(e,t){this.id=ob++,hu.add(this),this.name=e,pu&&(t=pu),this.options=Xt(t),this.method=mu(this.options),this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,sb(this)},"BroadcastChannel");Zt._pubkey=!0;function nb(r){r=Xt(r);var e=mu(r);return e.type==="node"?e.clearNodeFolder().then(function(){return!0}):nm}i(nb,"clearNodeFolder");var pu;function ib(r){pu=r}i(ib,"enforceOptions"),Zt.prototype={postMessage:i(function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return wm(this,"message",e)},"postMessage"),postInternal:i(function(e){return wm(this,"internal",e)},"postInternal"),set onmessage(r){var e=this.method.microSeconds(),t={time:e,fn:r};Tm(this,"message",this._onML),r&&typeof r=="function"?(this._onML=t,vm(this,"message",t)):this._onML=null},addEventListener:i(function(e,t){var o=this.method.microSeconds(),n={time:o,fn:t};vm(this,e,n)},"addEventListener"),removeEventListener:i(function(e,t){var o=this._addEL[e].find(function(n){return n.fn===t});Tm(this,e,o)},"removeEventListener"),close:i(function(){var e=this;if(!this.closed){hu.delete(this),this.closed=!0;var t=this._prepP?this._prepP:Je;return this._onML=null,this._addEL.message=[],t.then(function(){return Promise.all(Array.from(e._uMP))}).then(function(){return Promise.all(e._befC.map(function(o){return o()}))}).then(function(){return e.method.close(e._state)})}},"close"),get type(){return this.method.type},get isClosed(){return this.closed}};function wm(r,e,t){var o=r.method.microSeconds(),n={time:o,type:e,data:t},s=r._prepP?r._prepP:Je;return s.then(function(){var a=r.method.postMessage(r._state,n);return r._uMP.add(a),a.catch().then(function(){return r._uMP.delete(a)}),a})}i(wm,"_post");function sb(r){var e=r.method.create(r.name,r.options);om(e)?(r._prepP=e,e.then(function(t){r._state=t})):r._state=e}i(sb,"_prepareChannel");function bm(r){return r._addEL.message.length>0||r._addEL.internal.length>0}i(bm,"_hasMessageListeners");function vm(r,e,t){r._addEL[e].push(t),ab(r)}i(vm,"_addListenerObject");function Tm(r,e,t){r._addEL[e]=r._addEL[e].filter(function(o){return o!==t}),ub(r)}i(Tm,"_removeListenerObject");function ab(r){if(!r._iL&&bm(r)){var e=i(function(n){r._addEL[n.type].forEach(function(s){n.time>=s.time&&s.fn(n.data)})},"listenerFn"),t=r.method.microSeconds();r._prepP?r._prepP.then(function(){r._iL=!0,r.method.onMessage(r._state,e,t)}):(r._iL=!0,r.method.onMessage(r._state,e,t))}}i(ab,"_startListening");function ub(r){if(r._iL&&!bm(r)){r._iL=!1;var e=r.method.microSeconds();r.method.onMessage(r._state,null,e)}}i(ub,"_stopListening");var yu=globalThis.BroadcastChannel;yu||(yu=Zt);var Dm=class{static{i(this,"DeesComms")}broadcastChannel=new yu("dees-comms");typedrouter=new Et.TypedRouter;typedtarget=new Et.TypedTarget({postMethodWithTypedRouter:i(async e=>{this.postMessage(e)},"postMethodWithTypedRouter"),typedRouterRef:this.typedrouter});constructor(){this.broadcastChannel.onmessage=async e=>{let t=e.method?e:e.data,o=await this.typedrouter.routeAndAddResponse(t,{skipHooks:!0});o&&!o.error&&this.postMessage(o)}}createTypedRequest(e){return new Et.TypedRequest(this.typedtarget,e)}async postMessage(e){this.broadcastChannel.postMessage(e)}async createTypedHandler(e,t){this.typedrouter.addTypedHandler(new Et.TypedHandler(e,t))}};export{Dm as DeesComms};
9
+ `)},"stripIndent"),zg=i((r,e)=>{let t=r;return(!e||e.stripIndent)&&(t=Bg(t)),(!e||e.normalizeNewline)&&(t=t.replace(/\r\n/g,`
10
+ `)),(!e||e.replaceTabs)&&(t=kd(t," /"," ")),(!e||e.stripLeadingTrailingEmptyLines)&&(t=t.replace(/^\s*[\r\n]/gm,"").replace(/\s*[\r\n]$/gm,"")),(!e||e.stripAllEmptyLines)&&(t=t.replace(/^\s*[\r\n]/gm,"")),t},"standard");var ms={};A(ms,{isBase64:()=>Ag,isUtf8:()=>Vg});var Ga={encode:i(r=>{if(typeof Buffer<"u")return Buffer.from(r,"utf8").toString("base64");if(typeof btoa<"u"){let e=new TextEncoder().encode(r),t=Array.from(e,o=>String.fromCharCode(o)).join("");return btoa(t)}else{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=new TextEncoder().encode(r),o="",n=0;for(;n<t.length;){let s=t[n++],a=n<t.length?t[n++]:0,u=n<t.length?t[n++]:0,c=s<<16|a<<8|u;o+=e.charAt(c>>18&63),o+=e.charAt(c>>12&63),o+=n-2<t.length?e.charAt(c>>6&63):"=",o+=n-1<t.length?e.charAt(c&63):"="}return o}},"encode"),decode:i(r=>{let e=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"=");if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("utf8");if(typeof atob<"u"){let t=atob(e),o=new Uint8Array(t.length);for(let n=0;n<t.length;n++)o[n]=t.charCodeAt(n);return new TextDecoder().decode(o)}else{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=[],n=0;for(;n<e.length;){let s=t.indexOf(e.charAt(n++)),a=t.indexOf(e.charAt(n++)),u=t.indexOf(e.charAt(n++)),c=t.indexOf(e.charAt(n++)),f=s<<18|a<<12|u<<6|c;o.push(f>>16&255),u!==64&&o.push(f>>8&255),c!==64&&o.push(f&255)}return new TextDecoder().decode(new Uint8Array(o))}},"decode")},ps=class{static{i(this,"Base64")}constructor(e,t){switch(t){case"string":this.refString=e;break;case"base64":this.refString=Fr.decode(e);break;case"base64uri":this.refString=Fr.decode(e)}}get simpleString(){return this.refString}get base64String(){return Fr.encode(this.refString)}get base64UriString(){return Fr.encodeUri(this.refString)}},Fr={encode:i(r=>Ga.encode(r),"encode"),encodeUri:i(r=>Ga.encode(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),"encodeUri"),decode:i(r=>Ga.decode(r),"decode"),isBase64:i(r=>/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$/.test(r),"isBase64")};var Vg=i(r=>{let t=new TextEncoder().encode(r),o=0;for(;o<t.length;){if(t[o]===9||t[o]===10||t[o]===13||32<=t[o]&&t[o]<=126){o+=1;continue}if(194<=t[o]&&t[o]<=223&&128<=t[o+1]&&t[o+1]<=191){o+=2;continue}if(t[o]===224&&160<=t[o+1]&&t[o+1]<=191&&128<=t[o+2]&&t[o+2]<=191||(225<=t[o]&&t[o]<=236||t[o]===238||t[o]===239)&&128<=t[o+1]&&t[o+1]<=191&&128<=t[o+2]&&t[o+2]<=191||t[o]===237&&128<=t[o+1]&&t[o+1]<=159&&128<=t[o+2]&&t[o+2]<=191){o+=3;continue}if(t[o]===240&&144<=t[o+1]&&t[o+1]<=191&&128<=t[o+2]&&t[o+2]<=191&&128<=t[o+3]&&t[o+3]<=191||241<=t[o]&&t[o]<=243&&128<=t[o+1]&&t[o+1]<=191&&128<=t[o+2]&&t[o+2]<=191&&128<=t[o+3]&&t[o+3]<=191||t[o]===244&&128<=t[o+1]&&t[o+1]<=143&&128<=t[o+2]&&t[o+2]<=191&&128<=t[o+3]&&t[o+3]<=191){o+=4;continue}return!1}return!0},"isUtf8"),Ag=i(r=>{let e=/[^A-Z0-9+\/=]/i,t=r.length;if(!t||t%4!==0||e.test(r))return!1;let o=r.indexOf("=");return o===-1||o===t-1||o===t-2&&r[t-1]==="="},"isBase64");var hs=class{static{i(this,"Domain")}constructor(e){this.protocol=this._protocolRegex(e),this.protocol||(e=`https://${e}`),this.nodeParsedUrl=new URL(e),this.port=this.nodeParsedUrl.port;let t=this._domainRegex(e.replace(this.nodeParsedUrl.pathname,""));this.fullName="";for(let o=1;o<=5;o++)if(t[o-1]){let n=t[o-1];this["level"+o.toString()]=n,this.fullName===""?this.fullName=n:this.fullName=n+"."+this.fullName}else this["level"+o.toString()]=void 0;this.zoneName=this.level2+"."+this.level1,this.topLevel=this.level1,this.domainName=this.level2,this.subDomain=this.level3}_domainRegex(e){let o=/([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}$/.exec(e);return o.reverse(),o.pop(),o.filter(function(s){return s!==""})}_protocolRegex(e){let o=/^([a-zA-Z0-9]*):\/\//.exec(e);if(o)return o[1]}_portRegex(e){let o=/^([a-zA-Z0-9]*):\/\//.exec(e);if(o)return o[1]}};var ys=class{static{i(this,"GitRepo")}constructor(e,t){let o=Gg(e);this.host=o[1],this.user=o[2],this.repo=o[3],this.accessToken=t,this.sshUrl=Id(this.host,this.user,this.repo,this.accessToken,"ssh"),this.httpsUrl=Id(this.host,this.user,this.repo,this.accessToken,"https")}},Gg=i(function(r){return/([a-zA-Z0-9\-_\.]*)(?:\/|\:)([a-zA-Z0-9\-_\.]*)(?:\/)([a-zA-Z0-9\-_\.]*)(?:\.git)/.exec(r)},"gitRegex"),Id=i(function(r,e,t,o="",n){let s;switch(o!==""&&(o=o+"@"),n){case"https":s="https://"+o+r+"/"+e+"/"+t+".git";break;case"ssh":s="git@"+r+":"+e+"/"+t+".git";break;default:console.error("Link Type "+n+" not known");break}return s},"gitLink");var _d=or(Pd(),1),xs=_d.default;var Rd=i(()=>globalThis.Buffer,"getNodeBuffer");function Kg(r){let e=Rd();return e?e.from(r).toString("base64"):btoa(String.fromCharCode(...r))}i(Kg,"base64Encode");function Qg(r){let e=Rd();if(e){let t=e.from(r,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return new Uint8Array(Array.from(atob(r)).map(t=>t.charCodeAt(0)))}i(Qg,"base64Decode");function Ka(r,e){return JSON.stringify(r,gs,e)}i(Ka,"stringify");function Qa(r){return JSON.parse(r,Nd)}i(Qa,"parse");var gs=i((r,e)=>{if(Zg(e)){let t;if("data"in e&&Wd(e.data))t=new Uint8Array(e.data);else if(e instanceof Uint8Array)t=e;else return e;return{type:"EncodedBuffer",data:"base64:"+Kg(t)}}return e},"replacer"),Nd=i((r,e)=>{if(Xg(e)&&Ja(e.data)&&e.data.startsWith("base64:")){let t=e.data.slice(7);return Qg(t)}return e},"reviver");function Xg(r){return Fd(r)&&r.type==="EncodedBuffer"&&Ja(r.data)}i(Xg,"isEncodedBuffer");function Zg(r){return Fd(r)&&r.type==="Buffer"&&(Wd(r.data)||Ja(r.data))||r instanceof Uint8Array}i(Zg,"isBufferLike");function Wd(r){return Array.isArray(r)}i(Wd,"isArray");function Ja(r){return typeof r=="string"}i(Ja,"isString");function Fd(r){return typeof r=="object"&&r!==null}i(Fd,"isObject");var ws=Qa,Xa=i(r=>r.split(`
11
+ `).reduce((o,n)=>{let s=n.trim();return s.length>0&&o.push(ws(s)),o},[]),"parseJsonL"),tw=i(r=>r.map(e=>Gt(e)).join(`
12
+ `),"stringifyJsonL"),rw=i((r,e,t={})=>{let o=new WeakSet,n=i(u=>{if(u===null||typeof u!="object")return u;let c=gs("",u);if(c&&c.type==="EncodedBuffer"&&typeof c.data=="string")return c;if(o.has(u))return"__cycle__";if(o.add(u),Array.isArray(u))return u.map(l=>n(l));let f={};for(let l of Object.keys(u))try{f[l]=n(u[l])}catch{f[l]="__unserializable__"}return f},"sanitize"),s=n(r),a={...t,cycles:!0};if(e&&!a.cmp){let u=new Map;e.forEach((c,f)=>u.set(c,f)),a.cmp=(c,f)=>{let l=u.has(c.key)?u.get(c.key):Number.POSITIVE_INFINITY,p=u.has(f.key)?u.get(f.key):Number.POSITIVE_INFINITY;return l!==p?l-p:c.key<f.key?-1:c.key>f.key?1:0}}return xs(s,a)},"stableOneWayStringify"),Gt=i((r,e,t={})=>{let o=Ka(r);r=JSON.parse(o);let n={...t};if(e&&!n.cmp){let a=new Map;e.forEach((u,c)=>a.set(u,c)),n.cmp=(u,c)=>{let f=a.has(u.key)?a.get(u.key):Number.POSITIVE_INFINITY,l=a.has(c.key)?a.get(c.key):Number.POSITIVE_INFINITY;return f!==l?f-l:u.key<c.key?-1:u.key>c.key?1:0}}return xs(r,n)},"stringify"),ow=i(r=>{let e=Gt(r),t=JSON.parse(e);return JSON.stringify(t,null,2)},"stringifyPretty"),nw=i((...r)=>{let e=Gt(...r);return Lr.base64.encodeUri(e)},"stringifyBase64"),iw=i(r=>{let e=Lr.base64,o=(e.decodeUri||e.decode)(r);return ws(o)},"parseBase64"),Za=class r{static{i(this,"Smartjson")}static enfoldFromObject(e){let t=new this,o=t.saveableProperties||[];for(let n in e)o.indexOf(n)!==-1&&(t[n]=e[n]);return t}static enfoldFromJson(e){let t=ws(e);return this.enfoldFromObject(t)}saveableProperties=[];foldToObject(){let e=new Set;return e.add(this),this.foldToObjectInternal(e)}foldToObjectInternal(e){let t={},o=i(s=>{if(s instanceof r){if(e.has(s))throw new Error("cycle detected");return e.add(s),s.foldToObjectInternal(e)}return Array.isArray(s)?s.map(a=>o(a)):structuredClone(s)},"foldValue"),n=this.saveableProperties||[];for(let s of n){let a=this[s];t[s]=o(a)}return t}foldToJson(){let e=this.foldToObject();return Gt(e)}},sw=i(()=>(r,e)=>{let t=String(e.name);e.addInitializer(function(){this.saveableProperties||(this.saveableProperties=[]),this.saveableProperties.includes(t)||this.saveableProperties.push(t)})},"foldDec"),Ld=i((r,e)=>{let t=Gt(r),o=Gt(e);return t===o},"deepEqualObjects"),aw=i((r,e)=>{let t=Xa(r),o=Xa(e);return Ld(t,o)},"deepEqualJsonLStrings");var Ro={};A(Ro,{TypedrequestCache:()=>eu,WebStore:()=>_o});var Yd={};var bs=class{static{i(this,"WebStoreDb")}constructor(e){this.nativeDb=e}async get(e,t,o={}){return this.runObjectStoreRequest(e,"readonly",n=>n.get(t),o)}async getKey(e,t,o={}){return this.runObjectStoreRequest(e,"readonly",n=>n.getKey(t),o)}async put(e,t,o,n={}){return this.runObjectStoreRequest(e,"readwrite",s=>o===void 0?s.put(t):s.put(t,o),n)}async delete(e,t,o={}){await this.runObjectStoreRequest(e,"readwrite",n=>n.delete(t),o)}async clear(e,t={}){await this.runObjectStoreRequest(e,"readwrite",o=>o.clear(),t)}async getAllKeys(e,t={}){return this.runObjectStoreRequest(e,"readonly",o=>o.getAllKeys(),t)}close(){this.nativeDb.close()}async runObjectStoreRequest(e,t,o,n){n.signal?.throwIfAborted();let s=this.nativeDb.transaction(e,t),a=s.objectStore(e),u=o(a),c,f=new Promise((p,m)=>{c=m}),l=i(()=>{try{s.abort()}catch(p){if(!(p instanceof DOMException)||p.name!=="InvalidStateError"){c(p);return}}n.signal&&c(n.signal.reason)},"abortTransaction");n.signal?.addEventListener("abort",l,{once:!0});try{let[p]=await Promise.race([Promise.all([uw(u),cw(s)]),f]);return p}catch(p){throw n.signal?.aborted?n.signal.reason:p}finally{n.signal?.removeEventListener("abort",l)}}},jd=i(async(r,e)=>{if(e?.throwIfAborted(),!e)return r;let t,o=new Promise((s,a)=>{t=a}),n=i(()=>{t(e.reason)},"abortListener");e.addEventListener("abort",n,{once:!0});try{return await Promise.race([r,o])}finally{e.removeEventListener("abort",n)}},"awaitWithSignal"),uw=i(r=>new Promise((e,t)=>{r.onsuccess=()=>e(r.result),r.onerror=()=>t(vs("IndexedDB request failed",r.error))}),"indexedDbRequestToPromise"),cw=i(r=>new Promise((e,t)=>{r.oncomplete=()=>e(),r.onabort=()=>t(vs("IndexedDB transaction aborted",r.error)),r.onerror=()=>t(vs("IndexedDB transaction failed",r.error))}),"indexedDbTransactionToPromise"),vs=i((r,e)=>e?new Error(`${r}: ${e.message}`,{cause:e}):new Error(r),"createIndexedDbError"),Hd=i((r,e)=>{r.objectStoreNames.contains(e)||r.createObjectStore(e)},"ensureObjectStore"),Ud=i(async(r,e,t)=>{if(!globalThis.indexedDB)throw new Error("IndexedDB is not available in this runtime");return new Promise((o,n)=>{let s=!1,a=typeof e=="number"?globalThis.indexedDB.open(r,e):globalThis.indexedDB.open(r),u=i(c=>{s||(s=!0,n(c instanceof Error?c:new Error(String(c))))},"rejectOnce");a.onupgradeneeded=()=>{if(t)try{t(a.result)}catch(c){a.transaction?.abort(),u(c)}},a.onsuccess=()=>{if(s){a.result.close();return}s=!0;let c=a.result;c.onversionchange=()=>c.close(),o(c)},a.onerror=()=>u(vs(`Failed to open IndexedDB database "${r}"`,a.error)),a.onblocked=()=>u(new Error(`Opening IndexedDB database "${r}" was blocked by another connection`))})},"openNativeDb"),fw=i(async(r,e)=>{let t=await Ud(r,void 0,n=>Hd(n,e));if(t.objectStoreNames.contains(e))return new bs(t);let o=t.version+1;if(t.close(),t=await Ud(r,o,n=>Hd(n,e)),!t.objectStoreNames.contains(e))throw t.close(),new Error(`Failed to create IndexedDB object store "${e}" in database "${r}"`);return new bs(t)},"openWebStoreDb"),_o=class{static{i(this,"WebStore")}constructor(e){this.lifecycleGeneration=0,this.closeCoveredGeneration=0,this.activeOperations=new Set,this.options=e}trackOperation(e){this.lifecycleGeneration+=1;let t;return t=(async()=>e())().finally(()=>{this.activeOperations.delete(t)}),this.activeOperations.add(t),t}init(e={}){return this.trackOperation(()=>this.initForOperation(e.signal))}async initForOperation(e){e?.throwIfAborted();let t=this.closePromise;return t&&(await jd(t,e),e?.throwIfAborted()),this.initPromise||(this.initPromise=this.runInit().catch(o=>{throw this.initPromise=void 0,o})),jd(this.initPromise,e)}async runInit(){let e=new Ze.Smartenv;if(!e.isBrowser&&!globalThis.indexedDB&&(await e.getSafeNodeModule("fake-indexeddb/auto"),!globalThis.indexedDB)){let t=await e.getSafeNodeModule("fake-indexeddb");globalThis.indexedDB=new t.IDBFactory}this.db=await fw(this.options.dbName,this.options.storeName)}runDataOperation(e,t){return this.trackOperation(async()=>(await this.initForOperation(t.signal),t.signal?.throwIfAborted(),e(this.db)))}close(){let e=this.lifecycleGeneration;if(this.closePromise&&e<=this.closeCoveredGeneration)return this.closePromise;let t=this.closePromise,o=[...this.activeOperations];if(!t&&!this.initPromise&&o.length===0)return Promise.resolve();let n;return n=(async()=>{try{if(t)try{await t}catch{}await Promise.allSettled(o);let s=this.initPromise;if(!s)return;try{await s}catch{return}finally{this.initPromise===s&&(this.initPromise=void 0)}this.db.close()}finally{this.closePromise===n&&(this.closePromise=void 0)}})(),this.closePromise=n,this.closeCoveredGeneration=e,n}async get(e,t={}){return this.runDataOperation(o=>o.get(this.options.storeName,e,t),t)}async check(e,t={}){return this.runDataOperation(async o=>await o.getKey(this.options.storeName,e,t)!==void 0,t)}async set(e,t,o={}){return this.runDataOperation(n=>n.put(this.options.storeName,t,e,o),o)}async delete(e,t={}){return this.runDataOperation(o=>o.delete(this.options.storeName,e,t),t)}async clear(e={}){return this.runDataOperation(t=>t.clear(this.options.storeName,e),e)}async keys(e={}){return this.runDataOperation(t=>t.getAllKeys(this.options.storeName,e),e)}};var eu=class{static{i(this,"TypedrequestCache")}constructor(e="default"){this.webstore=new _o({dbName:"trStore",storeName:`trStore-${e}`})}buildKey(e){return Jt.stringify({method:e.method,request:e.request})}async setByRequest(e){if(!e.response)throw new Error("You cannot store requests without a response present");await this.webstore.set(this.buildKey(e),e)}async getByRequest(e){return await this.webstore.get(this.buildKey(e))}};var No=256,Yr=class{static{i(this,"CacheStore")}constructor(e="webrequest-v4",t="cache"){this.lifecycleController=new AbortController,this.closeReason=new Error("Webrequest cache store is closed"),this.disposed=!1,this.pruneGeneration=0,this.pruneWaiters=new Set,this.activeOwnedOperations=new Set,this.webstore=new Ro.WebStore({dbName:e,storeName:t}),this.initPromise=this.init()}async init(){}generateCacheKey(e){let t=e.url,o=e.method;return o==="GET"?t:`${o}:${t}`}async set(e,t,o={}){await this.initPromise;let n=this.getOperationSignal(o.signal),s=o.maxEntries??No;if(!Number.isSafeInteger(s)||s<=0)throw new RangeError("webrequest cache maxEntries must be a positive safe integer");await this.webstore.set(e,t,{signal:n}),await this.schedulePrune(s,n)}async get(e,t={}){await this.initPromise;let o=this.getOperationSignal(t.signal);try{let n=await this.webstore.get(e,{signal:o});return n===void 0?null:this.isCacheEntry(n)?n:(await this.webstore.delete(e,{signal:o}),null)}catch{if(o.aborted)throw o.reason;return null}}async has(e,t={}){return await this.get(e,t)!==null}async delete(e,t={}){await this.initPromise;let o=this.getOperationSignal(t.signal);await this.webstore.delete(e,{signal:o})}async clear(e={}){await this.initPromise;let t=this.getOperationSignal(e.signal);await this.webstore.clear({signal:t})}responseFromCacheEntry(e){let t=new Headers(e.headers);return new Response(e.response,{status:e.status,statusText:e.statusText,headers:t})}cacheEntryFromResponse(e,t,o,n={}){return this.trackOwnedOperation(async()=>{let s=this.getOperationSignal(n.signal),a=n.preserveResponse!==!1,u=a?t.clone():t,c=await this.consumeArrayBuffer(u,s,a?t.body:void 0,n.responseSignal),f={};return u.headers.forEach((l,p)=>{f[p]=l}),{response:c,headers:f,timestamp:Date.now(),etag:o?.etag||u.headers.get("etag")||void 0,lastModified:o?.lastModified||u.headers.get("last-modified")||void 0,maxAge:o?.maxAge,url:e,status:u.status,statusText:u.statusText}})}async pruneExpired(e={}){await this.initPromise;let t=this.getOperationSignal(e.signal),o=await this.collectEntries(t),n=0;for(let s of o)t.throwIfAborted(),!(s.valid&&!this.isExpired(s))&&(await this.webstore.delete(s.key,{signal:t}),n+=1);return n}async schedulePrune(e,t){t?.throwIfAborted();let o=++this.pruneGeneration;this.pendingPruneMaxEntries=this.pendingPruneMaxEntries===void 0?e:Math.min(this.pendingPruneMaxEntries,e);let n,s,a=new Promise((c,f)=>{n=c,s=f}),u={generation:o,resolve:n,reject:s};this.pruneWaiters.add(u),this.ensurePruneLoop();try{await lw(a,t)}finally{this.pruneWaiters.delete(u)}}ensurePruneLoop(){if(this.pruneLoopPromise)return this.pruneLoopPromise;let e;return e=this.runPruneLoop().catch(t=>{this.pendingPruneMaxEntries=void 0,this.settlePruneWaiters(this.pruneGeneration,t)}).finally(()=>{this.pruneLoopPromise===e&&(this.pruneLoopPromise=void 0,this.pendingPruneMaxEntries!==void 0&&!this.disposed&&this.ensurePruneLoop())}),this.pruneLoopPromise=e,e}async runPruneLoop(){for(;this.pendingPruneMaxEntries!==void 0;){let e=this.pendingPruneMaxEntries;this.pendingPruneMaxEntries=void 0;let t=this.pruneGeneration;await this.pruneToLimit(e,this.lifecycleController.signal),this.settlePruneWaiters(t)}}settlePruneWaiters(e,t){for(let o of this.pruneWaiters)o.generation>e||(this.pruneWaiters.delete(o),t===void 0?o.resolve():o.reject(t))}async pruneToLimit(e,t){let o=await this.collectEntries(t),n=o.filter(u=>!u.valid||this.isExpired(u));for(let u of n)t?.throwIfAborted(),await this.webstore.delete(u.key,{signal:t});let s=o.filter(u=>u.valid&&!this.isExpired(u)).sort((u,c)=>u.timestamp===c.timestamp?u.key.localeCompare(c.key):(u.timestamp??0)-(c.timestamp??0)),a=Math.max(0,s.length-e);for(let u of s.slice(0,a))t?.throwIfAborted(),await this.webstore.delete(u.key,{signal:t})}async collectEntries(e){e?.throwIfAborted();let t=await this.webstore.keys({signal:e}),o=[];for(let n of t)if(e?.throwIfAborted(),typeof n=="string")try{let s=await this.webstore.get(n,{signal:e});o.push(this.isCacheEntry(s)?{key:n,valid:!0,timestamp:s.timestamp,maxAge:s.maxAge}:{key:n,valid:!1,timestamp:0})}catch{if(e?.aborted)throw e.reason;continue}return o}isCacheEntry(e){if(!e||typeof e!="object")return!1;let t=Reflect.get(e,"response"),o=Reflect.get(e,"headers"),n=Reflect.get(e,"timestamp"),s=Reflect.get(e,"url"),a=Reflect.get(e,"status"),u=Reflect.get(e,"statusText");return t instanceof ArrayBuffer&&typeof o=="object"&&o!==null&&Number.isFinite(n)&&typeof s=="string"&&Number.isInteger(a)&&typeof u=="string"}isExpired(e){return e.maxAge!==void 0&&e.maxAge>0&&Date.now()-e.timestamp>=e.maxAge}getOperationSignal(e){if(this.disposed)throw this.closeReason;return e?.throwIfAborted(),e?AbortSignal.any([e,this.lifecycleController.signal]):this.lifecycleController.signal}trackOwnedOperation(e){let t;return t=e().finally(()=>{this.activeOwnedOperations.delete(t)}),this.activeOwnedOperations.add(t),t}close(){if(this.closePromise)return this.closePromise;this.disposed=!0,this.lifecycleController.abort(this.closeReason);let e=this.pruneLoopPromise,t=[...this.activeOwnedOperations];return this.closePromise=(async()=>{await Promise.allSettled([...t,...e?[e]:[]]),await this.webstore.close()})(),this.closePromise}async consumeArrayBuffer(e,t,o,n){if(t?.throwIfAborted(),!t)return e.arrayBuffer();let s=e.body?.getReader();if(!s)return new ArrayBuffer(0);let a=[],u=0,c,f=new Promise((x,g)=>{c=g}),l,p=i(()=>{c(t.reason),n?.aborted||(l=Promise.all([s.cancel(t.reason).catch(()=>{}),o?.cancel(t.reason).catch(()=>{})]).then(()=>{}))},"abortListener");t.addEventListener("abort",p,{once:!0});try{for(;;){let x=await Promise.race([s.read(),f]);if(x.done)break;a.push(x.value),u+=x.value.byteLength}}finally{t.removeEventListener("abort",p),l&&await l;try{s.releaseLock()}catch{}}let m=new Uint8Array(u),h=0;for(let x of a)m.set(x,h),h+=x.byteLength;return m.buffer}},lw=i(async(r,e)=>{if(e?.throwIfAborted(),!e)return r;let t,o=new Promise((s,a)=>{t=a}),n=i(()=>{t(e.reason)},"abortListener");e.addEventListener("abort",n,{once:!0});try{return await Promise.race([r,o])}finally{e.removeEventListener("abort",n)}},"awaitWithSignal");function dw(r){let e={maxAge:0,immutable:!1,noCache:!1,noStore:!1,mustRevalidate:!1};if(!r)return e;let t=r.toLowerCase().split(",").map(o=>o.trim());for(let o of t)if(o==="no-cache")e.noCache=!0;else if(o==="no-store")e.noStore=!0;else if(o==="immutable")e.immutable=!0;else if(o==="must-revalidate")e.mustRevalidate=!0;else if(o.startsWith("max-age=")){let n=parseInt(o.split("=")[1],10);isNaN(n)||(e.maxAge=n*1e3)}return e}i(dw,"parseCacheControl");function pw(r){if(r)try{return new Date(r).getTime()}catch{return}}i(pw,"parseExpires");function Je(r){let e=r.get("cache-control"),t=r.get("expires"),o=r.get("etag"),n=r.get("last-modified"),s=dw(e);if(s.maxAge===0&&t){let a=pw(t);a&&(s.maxAge=Math.max(0,a-Date.now()))}return{maxAge:s.maxAge||0,etag:o||void 0,lastModified:n||void 0,immutable:s.immutable||!1,noCache:s.noCache||!1,noStore:s.noStore||!1,mustRevalidate:s.mustRevalidate||!1}}i(Je,"extractCacheMetadata");function Ds(r,e){if(e.noStore)return!1;if(e.immutable)return!0;let t=Date.now()-r.timestamp,o=r.maxAge||e.maxAge||0;return o===0?!1:t<o}i(Ds,"isFresh");function qr(r){return r.noCache||r.mustRevalidate}i(qr,"requiresRevalidation");function Ss(r){let e={};return r.etag&&(e["if-none-match"]=r.etag),r.lastModified&&(e["if-modified-since"]=r.lastModified),e}i(Ss,"createConditionalHeaders");function Ms(r){let e={};return r.forEach((t,o)=>{e[o]=t}),e}i(Ms,"headersToObject");function $d(r){let e=new Headers;return Object.entries(r).forEach(([t,o])=>{e.set(t,o)}),e}i($d,"objectToHeaders");function mw(r){let e=new AbortController,t=!1,o=!1,n=new H.Timeout(r,null);return n.promise.then(()=>{t=!0,e.abort()}),{controller:e,cleanup:i(()=>{o||(o=!0,n.cancel())},"cleanup"),didTimeout:i(()=>t,"didTimeout")}}i(mw,"createTimeoutController");var Bd=Symbol("webrequestTimeoutError"),Et=i((r,e)=>{let t=new Error(`Request timeout after ${e}ms: ${r}`);return Object.defineProperty(t,Bd,{configurable:!1,enumerable:!1,value:!0,writable:!1}),t},"createTimeoutError"),Wo=i(r=>r instanceof Error&&Reflect.get(r,Bd)===!0,"isWebrequestTimeoutError");async function tu(r,e,t){let o=r instanceof Request?r.url:String(r),{controller:n,cleanup:s,didTimeout:a}=mw(t),u=e.signal?AbortSignal.any([e.signal,n.signal]):n.signal;try{let c=await fetch(r,{...e,signal:u});return s(),c}catch(c){throw s(),a()?Et(o,t):c}}i(tu,"fetchWithTimeout");var zd=i(r=>{if(r.reason instanceof Error)return r.reason;let e=new Error("The request was aborted");return e.name="AbortError",e},"normalizeAbortReason");async function Vd(r,e){if(e.signal?.aborted){let l=zd(e.signal);throw await r.body?.cancel(l).catch(()=>{}),l}if(e.bodyTimeoutMs!==void 0&&e.bodyTimeoutMs<=0){let l=Et(e.url,e.reportedTimeoutMs??e.bodyTimeoutMs);throw await r.body?.cancel(l).catch(()=>{}),l}if(e.bodyTimeoutMs===void 0&&!e.signal)return await r.json();let t=r.body?.getReader();if(!t)return JSON.parse("");let o,n,s,a=new Promise((l,p)=>{s=p}),u=i(l=>{o||(o=l,t.cancel(l).catch(()=>{}),s(l))},"terminate"),c=i(()=>{e.signal&&u(zd(e.signal))},"abortListener");if(e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c,{once:!0})),e.bodyTimeoutMs!==void 0){let l=e.reportedTimeoutMs??e.bodyTimeoutMs;n=setTimeout(()=>{u(Et(e.url,l))},e.bodyTimeoutMs)}let f=i(async()=>{let l=new TextDecoder,p="";for(;;){let m;try{m=await t.read()}catch(h){throw o||h}if(o)throw o;if(m.done)break;p+=l.decode(m.value,{stream:!0})}if(p+=l.decode(),o)throw o;return JSON.parse(p)},"readBody");try{return await Promise.race([f(),a])}finally{n!==void 0&&clearTimeout(n),e.signal?.removeEventListener("abort",c);try{t.releaseLock()}catch{}}}i(Vd,"consumeJsonWithTimeout");var Os=class{static{i(this,"NetworkFirstStrategy")}async execute(e){let t;try{return t=await e.fetchFn(e.request),t.ok&&await this.cacheResponse(e,t),{response:t,fromCache:!1,revalidated:!1}}catch(o){if(await jr(t,o,e.request.signal),e.signal?.aborted)throw e.signal.reason;if(Wo(o))throw o;e.logging&&console.log("[webrequest] Network failed, trying cache:",o);let n=await e.cacheStore.get(e.cacheKey,{signal:e.signal});if(n)return{response:e.cacheStore.responseFromCacheEntry(n),fromCache:!0,revalidated:!1};throw o}}async cacheResponse(e,t){let o=Je(t.headers);if(o.maxAge=Fo(o.maxAge,e.cacheMaxAge),o.noStore)return;let n=await e.cacheStore.cacheEntryFromResponse(e.request.url,t,o,{signal:e.signal,responseSignal:e.request.signal});await e.cacheStore.set(e.cacheKey,n,{signal:e.signal,maxEntries:e.cacheMaxEntries})}},ru=class{static{i(this,"CacheFirstStrategy")}async execute(e){let t=await e.cacheStore.get(e.cacheKey,{signal:e.signal});if(t){let s=Je(new Headers(t.headers));if(Ad(e,t,s)&&!qr(s))return e.logging&&console.log("[webrequest] Cache hit (fresh):",e.request.url),{response:e.cacheStore.responseFromCacheEntry(t),fromCache:!0,revalidated:!1};if(qr(s)&&(t.etag||t.lastModified))return await this.revalidate(e,t)}e.logging&&console.log("[webrequest] Cache miss, fetching:",e.request.url);let o=await e.fetchFn(e.request),n=Je(o.headers);if(n.maxAge=Fo(n.maxAge,e.cacheMaxAge),!n.noStore)try{let s=await e.cacheStore.cacheEntryFromResponse(e.request.url,o,n,{signal:e.signal,responseSignal:e.request.signal});await e.cacheStore.set(e.cacheKey,s,{signal:e.signal,maxEntries:e.cacheMaxEntries})}catch(s){throw await jr(o,s,e.request.signal),s}return{response:o,fromCache:!1,revalidated:!1}}async revalidate(e,t){let o=Ss(t),n=new Request(e.request.url,{method:e.request.method,headers:{...Ms(e.request.headers),...o},signal:e.signal}),s;try{if(s=await e.fetchFn(n),s.status===304)return e.logging&&console.log("[webrequest] Cache revalidated (304):",e.request.url),t.timestamp=Date.now(),await e.cacheStore.set(e.cacheKey,t,{signal:e.signal,maxEntries:e.cacheMaxEntries}),await jr(s,"304 response replaced by cached response",n.signal),{response:e.cacheStore.responseFromCacheEntry(t),fromCache:!0,revalidated:!0};if(s.ok){let a=Je(s.headers);if(a.maxAge=Fo(a.maxAge,e.cacheMaxAge),!a.noStore){let u=await e.cacheStore.cacheEntryFromResponse(e.request.url,s,a,{signal:e.signal,responseSignal:n.signal});await e.cacheStore.set(e.cacheKey,u,{signal:e.signal,maxEntries:e.cacheMaxEntries})}}return{response:s,fromCache:!1,revalidated:!0}}catch(a){if(await jr(s,a,n.signal),e.signal?.aborted)throw e.signal.reason;if(Wo(a))throw a;return e.logging&&console.log("[webrequest] Revalidation failed, using cache:",a),{response:e.cacheStore.responseFromCacheEntry(t),fromCache:!0,revalidated:!1}}}},ou=class{static{i(this,"StaleWhileRevalidateStrategy")}async execute(e){let t=await e.cacheStore.get(e.cacheKey,{signal:e.signal});if(t){let s=e.cacheStore.responseFromCacheEntry(t);return e.scheduleBackgroundRevalidation(async a=>{let u={...e,request:new Request(e.request,{signal:a}),signal:a};await this.revalidateInBackground(u,t)}),{response:s,fromCache:!0,revalidated:!1}}let o=await e.fetchFn(e.request),n=Je(o.headers);if(n.maxAge=Fo(n.maxAge,e.cacheMaxAge),!n.noStore&&o.ok)try{let s=await e.cacheStore.cacheEntryFromResponse(e.request.url,o,n,{signal:e.signal,responseSignal:e.request.signal});await e.cacheStore.set(e.cacheKey,s,{signal:e.signal,maxEntries:e.cacheMaxEntries})}catch(s){throw await jr(o,s,e.request.signal),s}return{response:o,fromCache:!1,revalidated:!1}}async revalidateInBackground(e,t){let o=Je(new Headers(t.headers));if(Ad(e,t,o)&&!qr(o))return;let n;try{if(e.signal?.throwIfAborted(),n=await e.fetchFn(e.request),n.ok){let s=Je(n.headers);if(s.maxAge=Fo(s.maxAge,e.cacheMaxAge),!s.noStore){let a=await e.cacheStore.cacheEntryFromResponse(e.request.url,n,s,{signal:e.signal,responseSignal:e.request.signal,preserveResponse:!1});await e.cacheStore.set(e.cacheKey,a,{signal:e.signal,maxEntries:e.cacheMaxEntries}),e.logging&&console.log("[webrequest] Background revalidation complete:",e.request.url)}}}catch(s){if(e.signal?.aborted)return;e.logging&&console.warn("[webrequest] Background revalidation failed:",s)}finally{await jr(n,"background revalidation response discarded",e.request.signal)}}},nu=class{static{i(this,"NetworkOnlyStrategy")}async execute(e){return{response:await e.fetchFn(e.request),fromCache:!1,revalidated:!1}}},iu=class{static{i(this,"CacheOnlyStrategy")}async execute(e){let t=await e.cacheStore.get(e.cacheKey,{signal:e.signal});if(!t)throw new Error(`Cache miss for ${e.request.url} (cache-only mode)`);return{response:e.cacheStore.responseFromCacheEntry(t),fromCache:!0,revalidated:!1}}},Fo=i((r,e)=>e===void 0?r:Math.min(r,e),"resolveEffectiveMaxAge"),Ad=i((r,e,t)=>Ds(e,t)?r.cacheMaxAge===void 0?!0:Date.now()-e.timestamp<r.cacheMaxAge:!1,"isFreshForContext"),jr=i(async(r,e,t)=>{!r?.body||r.bodyUsed||t?.aborted||await r.body.cancel(e).catch(()=>{})},"cancelDiscardedResponse");function Gd(r){switch(r){case"network-first":return new Os;case"cache-first":return new ru;case"stale-while-revalidate":return new ou;case"network-only":return new nu;case"cache-only":return new iu;default:return new Os}}i(Gd,"getStrategyHandler");var Hr=class{static{i(this,"CacheManager")}constructor(e,t,o){this.lifecycleController=new AbortController,this.closeReason=new Error("Webrequest cache manager is closed"),this.disposed=!1,this.backgroundRevalidations=new Map,this.cacheStore=o??new Yr(e,t)}async execute(e,t,o){if(this.disposed)throw this.closeReason;e.signal.throwIfAborted();let n=this.determineStrategy(e,t);if(n==="network-only")return{response:await o(e),fromCache:!1,revalidated:!1};let s=t.cacheMaxEntries??No;if(!Number.isSafeInteger(s)||s<=0)throw new RangeError("webrequest cacheMaxEntries must be a positive safe integer");if(t.cacheMaxAge!==void 0&&(!Number.isSafeInteger(t.cacheMaxAge)||t.cacheMaxAge<0))throw new RangeError("webrequest cacheMaxAge must be a non-negative safe integer");let a=t.timeout??6e4,u=new AbortController,c=setTimeout(()=>{u.abort(Et(e.url,a))},Math.max(0,a)),f=AbortSignal.any([e.signal,this.lifecycleController.signal,u.signal]);try{let l=this.generateCacheKey(e,t),p=Gd(n),m={request:e,cacheKey:l,cacheStore:this.cacheStore,fetchFn:o,logging:t.logging,signal:f,cacheMaxAge:t.cacheMaxAge,cacheMaxEntries:s,scheduleBackgroundRevalidation:i(h=>{this.scheduleBackgroundRevalidation(l,e.url,a,h)},"scheduleBackgroundRevalidation")};return await p.execute(m)}finally{clearTimeout(c)}}determineStrategy(e,t){return t.cacheStrategy?t.cacheStrategy:t.cache?this.mapCacheModeToStrategy(t.cache):e.cache?this.mapCacheModeToStrategy(e.cache):"network-first"}mapCacheModeToStrategy(e){switch(e){case"default":return"network-first";case"no-store":case"reload":return"network-only";case"no-cache":return"network-first";case"force-cache":return"cache-first";case"only-if-cached":return"cache-only";default:return"network-first"}}generateCacheKey(e,t){return t.cacheKey?typeof t.cacheKey=="function"?t.cacheKey(e):t.cacheKey:this.cacheStore.generateCacheKey(e)}async clear(){await this.cacheStore.clear()}async delete(e){await this.cacheStore.delete(e)}async has(e){return await this.cacheStore.has(e)}getStore(){return this.cacheStore}scheduleBackgroundRevalidation(e,t,o,n){if(this.disposed||this.backgroundRevalidations.has(e))return;let s=new AbortController,a=AbortSignal.any([this.lifecycleController.signal,s.signal]),u=setTimeout(()=>{s.abort(Et(t,o))},Math.max(0,o)),c;c=n(a).catch(()=>{}).finally(()=>{clearTimeout(u),this.backgroundRevalidations.get(e)===c&&this.backgroundRevalidations.delete(e)}),this.backgroundRevalidations.set(e,c)}close(){if(this.closePromise)return this.closePromise;this.disposed=!0,this.lifecycleController.abort(this.closeReason);let e=[...this.backgroundRevalidations.values()];return this.closePromise=(async()=>{await Promise.allSettled(e),await this.cacheStore.close()})(),this.closePromise}};var Es=class{static{i(this,"ExponentialBackoff")}calculate(e,t,o){let n=t*Math.pow(2,e-1);return Math.min(n,o)}},su=class{static{i(this,"LinearBackoff")}calculate(e,t,o){let n=t*e;return Math.min(n,o)}},au=class{static{i(this,"ConstantBackoff")}calculate(e,t,o){return Math.min(t,o)}};function Jd(r){switch(r){case"exponential":return new Es;case"linear":return new su;case"constant":return new au;default:return new Es}}i(Jd,"getBackoffCalculator");function Kd(r,e=.1){let t=r*e*Math.random();return r+t}i(Kd,"addJitter");var Ur=class{static{i(this,"RetryManager")}constructor(e={},t){this.signal=t,this.options={maxAttempts:e.maxAttempts??3,backoff:e.backoff??"exponential",initialDelay:e.initialDelay??1e3,maxDelay:e.maxDelay??3e4,retryOn:e.retryOn??[408,429,500,502,503,504],onRetry:e.onRetry??(()=>{})}}async execute(e,t){let o;for(let n=1;n<=this.options.maxAttempts;n++){this.throwIfAborted();try{let s=await e();if(s instanceof Response&&this.shouldRetryResponse(s)){if(n===this.options.maxAttempts)return s;await this.cancelResponseBody(s,`Retrying after HTTP ${s.status}`);let a=this.calculateDelay(n);this.options.onRetry(n,new Error(`HTTP ${s.status}`),a),await this.delay(a);continue}return s}catch(s){if(this.signal?.aborted)throw this.getAbortError();o=s instanceof Error?s:new Error(String(s));let a=t?t(s,n):this.shouldRetryError(s);if(n===this.options.maxAttempts||!a)throw o;let u=this.calculateDelay(n);this.options.onRetry(n,o,u),await this.delay(u)}}throw o||new Error("Max retry attempts reached")}async executeWithFallbacks(e,t,o){if(e.length===0)throw new Error("No URLs provided for fallback execution");let n,s=[];for(let a of e){this.throwIfAborted();try{let u=await this.execute(async()=>await o(a,t));if(u.status<400||u.status>=400&&u.status<500&&u.status!==408)return u;await this.cancelResponseBody(u,`Trying fallback after HTTP ${u.status}`),s.push(a),n=new Error(`Request failed with status ${u.status}`)}catch(u){if(this.signal?.aborted)throw this.getAbortError();s.push(a),n=u instanceof Error?u:new Error(String(u))}}throw new Error(`All URLs failed: ${s.join(", ")}. Last error: ${n?.message||"Unknown error"}`)}shouldRetryResponse(e){let t=this.options.retryOn;return typeof t=="function"?t(e):Array.isArray(t)?t.includes(e.status):!1}shouldRetryError(e){if(e instanceof TypeError&&e.message.includes("fetch")||e.name==="AbortError"||e.message.includes("timeout"))return!0;let t=this.options.retryOn;return typeof t=="function"?t(void 0,e):!1}calculateDelay(e){let o=Jd(this.options.backoff).calculate(e,this.options.initialDelay,this.options.maxDelay);return Kd(o)}async delay(e){if(!this.signal){await H.delayFor(e);return}if(this.signal.aborted)throw this.getAbortError();let t=new H.Timeout(e,null),o,n=new Promise((a,u)=>{o=u}),s=i(()=>{t.cancel(),o(this.getAbortError())},"abortListener");try{this.signal.addEventListener("abort",s,{once:!0}),this.signal.aborted&&s(),await Promise.race([t.promise,n])}finally{t.cancel(),this.signal.removeEventListener("abort",s)}}async cancelResponseBody(e,t){await e.body?.cancel(t).catch(()=>{})}throwIfAborted(){if(this.signal?.aborted)throw this.getAbortError()}getAbortError(){if(this.signal?.reason instanceof Error)return this.signal.reason;let e=new Error("The request was aborted");return e.name="AbortError",e}};var $r=class{static{i(this,"RequestDeduplicator")}constructor(){this.inFlightRequests=new Map}generateKey(e){let t=e.url,o=e.method;return o==="GET"||o==="HEAD"?`${o}:${t}`:`${o}:${t}:${Date.now()}`}async execute(e,t){let o=this.inFlightRequests.get(e);if(o){let s=await o.promise;return{response:this.cloneValue(s),wasDeduplicated:!0}}let n=F.defer();this.inFlightRequests.set(e,n);try{let s=await t();return n.resolve(s),this.inFlightRequests.delete(e),{response:s,wasDeduplicated:!1}}catch(s){throw n.reject(s),this.inFlightRequests.delete(e),s}}isInFlight(e){return this.inFlightRequests.has(e)}getInFlightCount(){return this.inFlightRequests.size}clear(){this.inFlightRequests.clear()}cloneValue(e){return e instanceof Response?e.clone():{...e,response:e.response.clone()}}};var Kt=class{static{i(this,"WebrequestClient")}constructor(e={}){this.closeReason=new Error("Webrequest client is closed"),this.disposed=!1,this.defaultOptions=e,this.interceptorManager=new Wr,this.cacheManager=new Hr,this.deduplicator=new $r}addRequestInterceptor(e){this.interceptorManager.addRequestInterceptor(e)}addResponseInterceptor(e){this.interceptorManager.addResponseInterceptor(e)}addErrorInterceptor(e){this.interceptorManager.addErrorInterceptor(e)}removeRequestInterceptor(e){this.interceptorManager.removeRequestInterceptor(e)}removeResponseInterceptor(e){this.interceptorManager.removeResponseInterceptor(e)}removeErrorInterceptor(e){this.interceptorManager.removeErrorInterceptor(e)}clearInterceptors(){this.interceptorManager.clearAll()}async clearCache(){await this.cacheManager.clear()}async deleteCache(e){await this.cacheManager.delete(e)}async request(e,t={}){return(await this.requestWithMetadata(e,t)).response}async requestWithMetadata(e,t={}){if(this.disposed)throw this.closeReason;let o={...this.defaultOptions,...t},n;if(typeof e=="string"?n=new Request(e,o):n=e,n=await this.interceptorManager.processRequest(n),o.interceptors?.request)for(let a of o.interceptors.request)n=await a(n);if(o.deduplicate??!1){let a=this.deduplicator.generateKey(n);return(await this.deduplicator.execute(a,async()=>await this.executeRequest(n,o))).response}return await this.executeRequest(n,o)}async executeRequest(e,t){try{let o=typeof t.retry=="object"?t.retry:t.retry?{}:void 0,n=i(async c=>{let f=t.timeout??6e4,l={...t};return delete l.body,delete l.headers,delete l.method,delete l.signal,await tu(c,{...l,signal:c.signal},f)},"fetchFnForRequest"),s=i(async(c,f)=>{let l=t.timeout??6e4;return await tu(c,f,l)},"fetchFnForFallbacks"),a;if(o){let c=new Ur(o,t.signal);if(t.fallbackUrls&&t.fallbackUrls.length>0){let f=[e.url,...t.fallbackUrls];a={response:await c.executeWithFallbacks(f,{method:e.method,headers:e.headers,body:e.body,...t},s),fromCache:!1,revalidated:!1}}else{let f,l=await c.execute(async()=>{let p=await this.cacheManager.execute(e,t,n);return f=p,p.response});a=f?.response===l?f:{response:l,fromCache:!1,revalidated:!1}}}else a=await this.cacheManager.execute(e,t,n);let u=await this.interceptorManager.processResponse(a.response);if(t.interceptors?.response)for(let c of t.interceptors.response)u=await c(u);return hw(u,a)}catch(o){throw await this.interceptorManager.processError(o instanceof Error?o:new Error(String(o)))}}async close(){return this.closePromise?this.closePromise:(this.disposed=!0,this.closePromise=this.cacheManager.close(),this.closePromise)}async requestJsonWithMetadata(e,t){let o={...this.defaultOptions,...t},n=o.timeout??6e4,s=o.retry?void 0:performance.now()+n,a=s===void 0?void 0:new AbortController,u=a?o.signal?AbortSignal.any([o.signal,a.signal]):a.signal:o.signal,c=a===void 0?void 0:setTimeout(()=>{a.abort(Et(e,n))},Math.max(0,n));try{let f=await this.requestWithMetadata(e,{...t,signal:u}),l=f.response;if(u?.aborted)throw await l.body?.cancel(u.reason).catch(()=>{}),u.reason instanceof Error?u.reason:new Error("The request was aborted");if(!l.ok)throw await l.body?.cancel(`HTTP ${l.status}`).catch(()=>{}),new Error(`HTTP ${l.status}: ${l.statusText}`);let p=s===void 0?n:s-performance.now(),m=await Vd(l,{bodyTimeoutMs:p,reportedTimeoutMs:n,signal:u,url:e});return Object.freeze({data:m,response:l,metadata:f.metadata})}catch(f){throw u?.aborted&&u.reason instanceof Error?u.reason:f}finally{c!==void 0&&clearTimeout(c)}}async getJson(e,t={}){return(await this.getJsonWithMetadata(e,t)).data}async getJsonWithMetadata(e,t={}){return await this.requestJsonWithMetadata(e,{...t,method:"GET",headers:{Accept:"application/json",...t.headers||{}}})}async postJson(e,t,o={}){return(await this.postJsonWithMetadata(e,t,o)).data}async postJsonWithMetadata(e,t,o={}){return await this.requestJsonWithMetadata(e,{...o,method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...o.headers||{}},body:JSON.stringify(t)})}async putJson(e,t,o={}){return(await this.putJsonWithMetadata(e,t,o)).data}async putJsonWithMetadata(e,t,o={}){return await this.requestJsonWithMetadata(e,{...o,method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json",...o.headers||{}},body:JSON.stringify(t)})}async deleteJson(e,t={}){return(await this.deleteJsonWithMetadata(e,t)).data}async deleteJsonWithMetadata(e,t={}){return await this.requestJsonWithMetadata(e,{...t,method:"DELETE",headers:{Accept:"application/json",...t.headers||{}}})}},hw=i((r,e)=>{let t=Object.freeze({fromCache:e.fromCache,revalidated:e.revalidated});return Object.freeze({response:r,metadata:t})},"createResponseResult");var xe=new Kt;async function se(r,e){let t=r instanceof Request?r.url:String(r),o=r instanceof Request?r:new Request(t,e);return await xe.request(o,e)}i(se,"webrequest"),se.requestWithMetadata=async function(r,e){let t=r instanceof Request?r.url:String(r),o=r instanceof Request?r:new Request(t,e);return await xe.requestWithMetadata(o,e)},se.getJson=async function(r,e){return await xe.getJson(r,e)},se.getJsonWithMetadata=async function(r,e){return await xe.getJsonWithMetadata(r,e)},se.postJson=async function(r,e,t){return await xe.postJson(r,e,t)},se.postJsonWithMetadata=async function(r,e,t){return await xe.postJsonWithMetadata(r,e,t)},se.putJson=async function(r,e,t){return await xe.putJson(r,e,t)},se.putJsonWithMetadata=async function(r,e,t){return await xe.putJsonWithMetadata(r,e,t)},se.deleteJson=async function(r,e){return await xe.deleteJson(r,e)},se.deleteJsonWithMetadata=async function(r,e){return await xe.deleteJsonWithMetadata(r,e)},se.addRequestInterceptor=function(r){xe.addRequestInterceptor(r)},se.addResponseInterceptor=function(r){xe.addResponseInterceptor(r)},se.addErrorInterceptor=function(r){xe.addErrorInterceptor(r)},se.clearInterceptors=function(){xe.clearInterceptors()},se.clearCache=async function(){await xe.clearCache()},se.createClient=function(r){return new Kt(r)},se.getDefaultClient=function(){return xe};var Lo=or(Us(),1);var yw=1e4,Qd=new WeakSet,Xd=new WeakMap,uu=i(r=>{Qd.add(r)},"authorizeVirtualStreamApplicationUse"),Qt=class extends Error{static{i(this,"VirtualStreamClosedError")}constructor(e="VirtualStream is closed",t){super(e,t),this.name="VirtualStreamClosedError"}},Xt=class extends Error{static{i(this,"VirtualStreamOpenTimeoutError")}constructor(e,t){super(e>0?`VirtualStream transport staging timed out after ${e}ms`:"VirtualStream transport staging deadline is exhausted"),this.timeoutMs=e,this.deadlineAt=t,this.name="VirtualStreamOpenTimeoutError"}},Is=class extends Error{static{i(this,"VirtualStreamLifecycleContractError")}constructor(e){super(`VirtualStream endpoint closed before terminal ${e} produced a receipt`),this.name="VirtualStreamLifecycleContractError"}},et=class{static{i(this,"VirtualStreamActivationScope")}constructor(){this.trackedStreams=new Set,this.hasAuthorizedTrackedStreams=!1,this.published=!1,this.settled=!1}track(e){if(this.settled)throw new Error("Cannot track a VirtualStream in a settled activation scope");let t=Xd.get(e);if(t&&t!==this)throw new Error("VirtualStream is already owned by another activation scope");t||Xd.set(e,this),this.trackedStreams.add(e),this.hasAuthorizedTrackedStreams&&uu(e),this.published&&e.publishActivation()}authorizeApplicationUse(){if(!(this.settled||this.hasAuthorizedTrackedStreams)){this.hasAuthorizedTrackedStreams=!0;for(let e of this.trackedStreams)uu(e)}}publish(){if(!(this.settled||this.published)){this.published=!0;for(let e of this.trackedStreams)e.publishActivation()}}commit(){this.publish(),this.settled=!0,this.trackedStreams.clear()}async rollback(e){if(this.settled)return;this.settled=!0;let t=[...this.trackedStreams];this.trackedStreams.clear(),await Promise.allSettled(t.map(o=>o.rollbackActivation(e)))}},Ye=class r{static{i(this,"VirtualStream")}static{this.maximumStreamIdLength=256}static fromRegistration(e){let t=e.registration?.dispose,o=i(()=>{let n=t;t=void 0,n?.()},"disposeOnce");try{if(r.validateTransport(e.transport),typeof e.registration?.dispose!="function")throw new TypeError("VirtualStream registration requires a synchronous disposer");return r.validateNetworkDescriptor(e.registration.descriptor),r.validateEndpoint(e.registration.endpoint,e.registration.descriptor,e.registration.descriptor.creatorDirection),new r({transport:e.transport,descriptor:e.registration.descriptor,endpoint:e.registration.endpoint,registrationDispose:o,explicitRegistration:!0})}catch(n){throw o(),n}}static encodePayloadForNetwork(e,t){let o=e?.correlation?.phase==="response";return r.encodePayloadValue(e,t,o,!1,!0,{standard:new WeakMap,omittingResponseRequestStreams:new WeakMap})}static encodePayloadForNetworkWithMetadata(e,t){let o=e?.correlation?.phase==="response",n={standard:new WeakMap,omittingResponseRequestStreams:new WeakMap,containsNetworkDescriptor:!1,requiresNetworkDescriptorScan:!1},s=r.encodePayloadValue(e,t,o,!1,!0,n),a=n.requiresNetworkDescriptorScan||r.encodedContainerPrototypesMayExposeNetworkDescriptor();return{payload:s,containsNetworkDescriptor:a?r.containsNetworkDescriptor(s):n.containsNetworkDescriptor}}static encodePayloadValue(e,t,o,n,s,a){if(!e||At.isBufferLike(e))return e;if(e instanceof r)return n?{_OMITTED_VIRTUAL_STREAM:!0,reason:"Streams beneath an echoed response.request are omitted."}:(a.containsNetworkDescriptor!==void 0&&(a.containsNetworkDescriptor=!0),e.activateForEncoding(t));if(e instanceof Set||e instanceof Map||e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Promise||typeof e.then=="function")return a.containsNetworkDescriptor!==void 0&&typeof e=="object"&&(a.requiresNetworkDescriptorScan=!0),e;if(typeof e!="object")return e;let c=n?a.omittingResponseRequestStreams:a.standard,f=c.get(e);if(f)return f;if(Array.isArray(e)){let p=[];c.set(e,p);for(let m=0;m<e.length;m++)p.push(r.encodePayloadValue(e[m],t,o,n,!1,a));return a.containsNetworkDescriptor!==void 0&&Object.getPrototypeOf(p)!==Array.prototype&&(a.requiresNetworkDescriptorScan=!0),p}let l={};c.set(e,l);for(let p of Object.keys(e)){let m=n||o&&s&&p==="request";l[p]=r.encodePayloadValue(e[p],t,o,m,!1,a)}return a.containsNetworkDescriptor!==void 0&&Object.getPrototypeOf(l)!==Object.prototype&&(a.requiresNetworkDescriptorScan=!0),a.containsNetworkDescriptor!==void 0&&Object.hasOwn(l,"_isVirtualStream")&&l._isVirtualStream===!0&&(a.containsNetworkDescriptor=!0),l}static async decodePayloadFromNetworkAsync(e,t){let o=new Map,n=[],s=[],a=t.activationScope??new et,u=!t.activationScope,c=r.resolveOpenDeadlineAt(t.openDeadlineAt);try{let f=r.preparePayloadFromNetwork(e,{...t,activationScope:a},o,n,s,new WeakMap);if(n.length>0){let l=t.virtualStreamTransport;if(!l)throw new Error("VirtualStream descriptor requires a virtual stream transport");r.validateTransport(l);for(let p of n){let m=r.getRemainingOpenTimeoutMs(c),h=await r.openVirtualStreamWithTimeout(l,p.descriptor,m,c,t.abortSignal);p.stream.bindOpenedEndpoint(h)}}return u&&(a.authorizeApplicationUse(),a.commit()),f}catch(f){throw await Promise.allSettled(s.map(l=>l.rollbackActivation(f))),f}}static containsNetworkDescriptor(e,t=new WeakSet){return!e||At.isBufferLike(e)||typeof e!="object"?!1:e._isVirtualStream===!0?!0:t.has(e)?!1:(t.add(e),Array.isArray(e)?e.some(o=>r.containsNetworkDescriptor(o,t)):e instanceof Set||e instanceof Map||e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Promise||typeof e.then=="function"?!1:Object.values(e).some(o=>r.containsNetworkDescriptor(o,t)))}static encodedContainerPrototypesMayExposeNetworkDescriptor(){return Object.getPrototypeOf(Object.prototype)!==null||Object.getPrototypeOf(Array.prototype)!==Object.prototype||Object.getOwnPropertyDescriptor(Object.prototype,"_isVirtualStream")!==void 0||Object.getOwnPropertyDescriptor(Array.prototype,"_isVirtualStream")!==void 0}static preparePayloadFromNetwork(e,t,o,n,s,a){if(At.isBufferLike(e)||e===null||typeof e!="object"||e instanceof Set||e instanceof Map||e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Promise||typeof e.then=="function")return e;if(e._isVirtualStream===!0){r.validateNetworkDescriptor(e);let f=e,l=o.get(f.streamId);if(l){if(!r.descriptorMetadataMatches(l.descriptor,f))throw new TypeError(`Conflicting VirtualStream metadata for streamId "${f.streamId}"`);return l.stream}let p=t.virtualStreamTransport,m=new r({transport:p,descriptor:f,explicitRegistration:!1});return o.set(f.streamId,{stream:m,descriptor:f}),n.push({stream:m,descriptor:f}),s.push(m),t.activationScope?.track(m),m}let u=a.get(e);if(u)return u;if(Array.isArray(e)){let f=[];a.set(e,f);for(let l of e)f.push(r.preparePayloadFromNetwork(l,t,o,n,s,a));return f}let c={};a.set(e,c);for(let f of Object.keys(e))Object.defineProperty(c,f,{value:r.preparePayloadFromNetwork(e[f],t,o,n,s,a),configurable:!0,enumerable:!0,writable:!0});return c}static resolveOpenDeadlineAt(e){let t=performance.now()+yw;if(e===void 0)return t;if(!Number.isFinite(e)||e<0)throw new RangeError("VirtualStream openDeadlineAt must be a non-negative finite number");return Math.min(e,t)}static getRemainingOpenTimeoutMs(e){let t=Math.ceil(e-performance.now());if(!Number.isSafeInteger(t)||t<=0)throw new Xt(0,e);return t}static async openVirtualStreamWithTimeout(e,t,o,n,s){let a=new Xt(o,n),u=new AbortController,c,f,l,p=Promise.resolve().then(()=>e.openVirtualStream(t,{abortSignal:u.signal,timeoutMs:o}));p.then(async h=>{c!==void 0&&await r.abortLateOpenedEndpoint(h,c)},()=>{});let m=new Promise((h,x)=>{f=setTimeout(()=>{c=a,u.abort(a),x(a)},o),s&&(l=i(()=>{let g=s.reason??new DOMException("The operation was aborted","AbortError");c=g,u.abort(g),x(g)},"parentAbortListener"),s.addEventListener("abort",l,{once:!0}),s.aborted&&l())});try{return await Promise.race([p,m])}finally{f&&clearTimeout(f),s&&l&&s.removeEventListener("abort",l)}}static async abortLateOpenedEndpoint(e,t){let o;try{o=Promise.resolve(e.abort(t))}catch{}o?.catch(()=>{});try{await e.closed}catch{}}static validateTransport(e){if(!e||typeof e!="object"||typeof e.openVirtualStream!="function")throw new TypeError("VirtualStream transport is invalid")}static validateNetworkDescriptor(e){if(!r.isPlainObject(e))throw new TypeError("VirtualStream descriptor must be a plain object");let t=r.getOwnDataProperty(e,"_isVirtualStream"),o=r.getOwnDataProperty(e,"protocol"),n=r.getOwnDataProperty(e,"streamId"),s=r.getOwnDataProperty(e,"creatorDirection");if(t!==!0||o!=="virtual-stream-v1")throw new TypeError("VirtualStream descriptor requires protocol virtual-stream-v1");if(typeof n!="string"||n.length===0||n.length>r.maximumStreamIdLength)throw new TypeError(`VirtualStream descriptor streamId must contain 1-${r.maximumStreamIdLength} characters`);if(s!=="send"&&s!=="receive")throw new TypeError("VirtualStream descriptor creatorDirection must be send or receive");let a=Object.getOwnPropertyDescriptor(e,"contentType");if(a&&(!("value"in a)||typeof a.value!="string"||a.value.length===0))throw new TypeError("VirtualStream descriptor contentType must be a non-empty string");let u=Object.getOwnPropertyDescriptor(e,"integrity");if(u){if(!("value"in u))throw new TypeError("VirtualStream descriptor integrity must be data");r.validateIntegrity(u.value)}let c=Object.getOwnPropertyDescriptor(e,"transport");if(!c||!("value"in c))throw new TypeError("VirtualStream descriptor requires an own transport property");if(!r.isJsonCompatible(c.value,new WeakSet))throw new TypeError("VirtualStream descriptor transport must be JSON-compatible")}static validateIntegrity(e){if(!r.isPlainObject(e))throw new TypeError("VirtualStream integrity must be a plain object");let t=r.getOwnDataProperty(e,"algorithm"),o=r.getOwnDataProperty(e,"byteLength"),n=r.getOwnDataProperty(e,"digest");if(t!=="sha256")throw new TypeError("VirtualStream integrity algorithm must be sha256");if(!Number.isSafeInteger(o)||o<0)throw new TypeError("VirtualStream integrity byteLength must be a non-negative safe integer");if(typeof n!="string"||!/^sha256:[0-9a-f]{64}$/.test(n))throw new TypeError("VirtualStream integrity digest is invalid")}static validateEndpoint(e,t,o){if(!e||typeof e!="object")throw new TypeError("VirtualStream transport returned an invalid endpoint");let n=e;if(n.protocol!=="virtual-stream-v1"||n.direction!==o||n.streamId!==t.streamId||n.contentType!==t.contentType||!r.integrityMatches(n.integrity,t.integrity))throw new TypeError("VirtualStream endpoint direction or metadata does not match its descriptor");if(!("opened"in n)||!("completion"in n)||!n.closed||typeof n.closed.then!="function"||typeof n.abort!="function")throw new TypeError("VirtualStream endpoint lacks lifecycle contracts");if(o==="send"){if(typeof n.send!="function"||typeof n.close!="function"||!("writable"in n))throw new TypeError("VirtualStream sender endpoint is invalid")}else if(typeof n.receive!="function"||typeof n.accept!="function"||typeof n.reject!="function"||!("readable"in n))throw new TypeError("VirtualStream receiver endpoint is invalid")}static descriptorMetadataMatches(e,t){return e.creatorDirection===t.creatorDirection&&e.contentType===t.contentType&&r.integrityMatches(e.integrity,t.integrity)}static integrityMatches(e,t){return!e||!t?e===t:e.algorithm===t.algorithm&&e.byteLength===t.byteLength&&e.digest===t.digest}static getOwnDataProperty(e,t){let o=Object.getOwnPropertyDescriptor(e,t);if(!(!o||!("value"in o)))return o.value}static isPlainObject(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}static isJsonCompatible(e,t){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(!e||typeof e!="object"||t.has(e))return!1;t.add(e);try{if(Array.isArray(e)){for(let o=0;o<e.length;o++){let n=Object.getOwnPropertyDescriptor(e,String(o));if(!n||!("value"in n)||!r.isJsonCompatible(n.value,t))return!1}return Reflect.ownKeys(e).every(o=>o==="length"||typeof o=="string"&&/^(0|[1-9][0-9]*)$/.test(o)&&Number(o)<e.length)}if(!r.isPlainObject(e))return!1;for(let o of Reflect.ownKeys(e)){if(typeof o!="string")return!1;let n=Object.getOwnPropertyDescriptor(e,o);if(!n.enumerable||!("value"in n)||!r.isJsonCompatible(n.value,t))return!1}return!0}finally{t.delete(e)}}constructor(e){this.activationPublished=!1,this.endpointUseStarted=!1,this.endpointClosed=!1,this.locallyDisposed=!1,this.transport=e.transport,this.descriptor=e.descriptor,this.endpoint=e.endpoint,this.registrationDispose=e.registrationDispose,this.explicitRegistration=e.explicitRegistration,this.explicitRegistration&&uu(this),this.endpoint&&this.observeEndpoint(this.endpoint)}get protocol(){return"virtual-stream-v1"}get direction(){return this.endpoint?this.endpoint.direction:this.descriptor.creatorDirection==="send"?"receive":"send"}get streamId(){return this.descriptor.streamId}get contentType(){return this.descriptor.contentType}get integrity(){return this.descriptor.integrity}get opened(){try{this.assertApplicationOperationsAllowed(),this.assertNotClosed(),this.endpointUseStarted=!0;let e=this.requireEndpoint().opened;if(!e||typeof e.then!="function")throw new TypeError("VirtualStream endpoint opened contract is invalid");return e}catch(e){return Promise.reject(e)}}get completion(){let e=this.requireEndpoint().completion;if(!e||typeof e.then!="function")throw new TypeError("VirtualStream endpoint completion contract is invalid");return e}get closed(){return this.requireEndpoint().closed}get writable(){return this.assertApplicationOperation("send"),this.endpointUseStarted=!0,this.requireEndpoint().writable}get readable(){return this.assertApplicationOperation("receive"),this.endpointUseStarted=!0,this.requireEndpoint().readable}publishActivation(){this.explicitRegistration&&!this.locallyDisposed&&(this.activationPublished=!0)}async rollbackActivation(e){if(!this.locallyDisposed){if(this.explicitRegistration&&!this.activationPublished&&!this.endpointUseStarted){this.disposeUnpublishedRegistration();return}this.endpoint&&await this.abort(e)}}async send(e){if(this.assertApplicationOperation("send"),!(e instanceof Uint8Array))throw new TypeError("VirtualStream.send accepts only Uint8Array chunks");this.endpointUseStarted=!0,await this.requireEndpoint().send(e)}async receive(){return this.assertApplicationOperation("receive"),this.endpointUseStarted=!0,this.requireEndpoint().receive()}close(){if(this.terminalPromise)return this.followTerminal("close");try{this.assertApplicationOperation("send"),this.endpointUseStarted=!0;let e=this.requireEndpoint();return this.terminateEndpoint(()=>e.close(),"close")}catch(e){return Promise.reject(e)}}accept(){if(this.terminalPromise)return this.followTerminal("accept");try{this.assertApplicationOperation("receive"),this.endpointUseStarted=!0;let e=this.requireEndpoint();return this.terminateEndpoint(()=>e.accept(),"accept")}catch(e){return Promise.reject(e)}}reject(e){if(this.terminalPromise)return this.followTerminal("reject");try{this.assertApplicationOperation("receive"),this.endpointUseStarted=!0;let t=this.requireEndpoint();return this.terminateEndpoint(()=>t.reject(e),"reject")}catch(t){return Promise.reject(t)}}abort(e){if(this.terminalPromise)return this.followTerminal("abort");if(this.locallyDisposed||this.endpointClosed)return Promise.resolve();let t=this.endpoint;return t?(this.endpointUseStarted=!0,this.terminateEndpoint(()=>t.abort(e),"abort")):Promise.resolve()}activateForEncoding(e){e.activationScope?.track(this);try{if(!e.virtualStreamTransport)throw new Error("VirtualStream requires a virtual stream transport");if(this.transport!==e.virtualStreamTransport)throw new Error("VirtualStream cannot be encoded through a different virtual stream transport");if(this.assertNotClosed(),this.terminalPromise)throw new Qt("VirtualStream has a terminal operation");return e.activationScope||this.publishActivation(),this.descriptor}catch(t){throw e.activationScope||this.rollbackActivation(t).catch(()=>{}),t}}bindOpenedEndpoint(e){this.endpoint=e;let t=this.descriptor.creatorDirection==="send"?"receive":"send";r.validateEndpoint(e,this.descriptor,t),this.observeEndpoint(e)}observeEndpoint(e){let t=e.completion;if(!t||typeof t.then!="function")throw new TypeError("VirtualStream endpoint completion contract is invalid");t.then(o=>{this.completionOutcome={status:"fulfilled",value:o}},o=>{this.completionOutcome={status:"rejected",error:o}}),e.closed.then(()=>this.markEndpointClosed(),o=>this.markEndpointClosed(o))}markEndpointClosed(e){e!==void 0&&this.getCloseError(e),this.endpointClosed=!0,this.disposeRegistration()}disposeRegistration(){let e=this.registrationDispose;this.registrationDispose=void 0,e?.()}disposeUnpublishedRegistration(){this.locallyDisposed||(this.locallyDisposed=!0,this.disposeRegistration())}requireEndpoint(){if(!this.endpoint)throw new Error("VirtualStream endpoint is not staged");return this.endpoint}assertApplicationOperationsAllowed(){if(!Qd.has(this))throw new Error("VirtualStream application use is not authorized")}assertApplicationOperation(e){if(this.assertApplicationOperationsAllowed(),this.assertNotClosed(),this.terminalPromise)throw new Qt("VirtualStream has a terminal operation");if(this.direction!==e)throw new TypeError(`${this.direction} VirtualStreams cannot perform ${e} operations`)}assertNotClosed(){if(this.endpointClosed||this.locallyDisposed)throw this.getCloseError()}getCloseError(e){return this.closeError||(this.closeError=new Qt("VirtualStream is closed",e===void 0?void 0:{cause:e})),this.closeError}followTerminal(e){let t=this.terminalPromise;if(this.terminalKind===e)return t;let o=new Qt(`VirtualStream terminal ${this.terminalKind} already completed`);return t.then(()=>Promise.reject(o),()=>Promise.reject(o))}terminateEndpoint(e,t){if(this.terminalPromise)return this.followTerminal(t);let o=this.requireEndpoint();this.terminalKind=t;let n=e,s=Promise.resolve().then(()=>{let l=n;return n=void 0,l()});s.catch(()=>{});let a=s.then(l=>({status:"fulfilled",value:l}),l=>({status:"rejected",error:l})),u;a.then(l=>{u=l});let c=o.closed.then(()=>({status:"closed"}),l=>({status:"closedError",error:l})),f=(async()=>{let l=await Promise.race([a,c]);if(l.status==="fulfilled"||l.status==="rejected"){let p=await c;if(this.endpointClosed=!0,this.disposeRegistration(),l.status==="rejected")throw l.error;if(p.status==="closedError")throw p.error;return l.value}if(this.endpointClosed=!0,this.disposeRegistration(),l.status==="closedError")throw l.error;if(await Promise.resolve(),await Promise.resolve(),u?.status==="rejected")throw u.error;if(u?.status==="fulfilled")return u.value;if(t==="close"||t==="accept"){if(this.completionOutcome?.status==="fulfilled")return this.completionOutcome.value;throw this.completionOutcome?.status==="rejected"?this.completionOutcome.error:new Is(t)}})();return this.terminalPromise=f,f}};var We=class extends Error{static{i(this,"TypedResponseError")}constructor(e,t){super(e),this.name="TypedResponseError",this.errorText=e,this.errorData=t??{}}};var zr=Object.freeze({redacted:!0});var Zd=Object.freeze(["onOutgoingRequest","onIncomingResponse","onIncomingRequest","onOutgoingResponse"]),ep=Symbol.for("@api.global/typedrequest:global-hooks:3.8"),tp=i(r=>({payloadProjector:r?.payloadProjector,errorProjector:r?.errorProjector}),"copyProjectionOptions"),Ps=i((r={})=>({hooks:r,projectedRegistrationsByPhase:{}}),"createTypedRouterHookRegistrationState"),xw=i(r=>Zd.filter(e=>Object.hasOwn(r,e)).map(e=>[e,r[e]]),"getSuppliedHookEntries"),_s=i((r,e,t)=>{let o=xw(e);r.hooks={...r.hooks,...e};for(let[n]of o){let s=r.hooks[n];if(typeof s!="function"){delete r.projectedRegistrationsByPhase[n];continue}r.projectedRegistrationsByPhase[n]={callback:s,projectionOptions:tp(t)}}},"mergeTypedRouterHookRegistrations"),Rs=i((r,e)=>{r.hooks=e;for(let t of Zd)delete r.projectedRegistrationsByPhase[t]},"replaceTypedRouterHookRegistrations"),Vr=i(()=>{let r=globalThis[ep];if(r?.version==="3.8"&&r.stateShape==="callback-bound-projections-v1"&&r.subscribers instanceof Map)return r;let e={version:"3.8",stateShape:"callback-bound-projections-v1",legacy:Ps(),subscribers:new Map};return globalThis[ep]=e,e},"getRealmGlobalHookState"),op=i(()=>Vr().legacy.hooks,"getLegacyGlobalHooks"),np=i(r=>{Rs(Vr().legacy,r)},"replaceLegacyGlobalHooks"),ip=i((r,e)=>{_s(Vr().legacy,r,e)},"mergeLegacyGlobalHooks"),sp=i((r,e)=>{let t=Vr(),o=Symbol("typedrequest-hook-subscriber"),n=Ps();_s(n,r,e),t.subscribers.set(o,n);let s=!1;return()=>{s||(s=!0,t.subscribers.delete(o))}},"addGlobalHookSubscriber"),ap=i(()=>{let r=Vr();Rs(r.legacy,{}),r.subscribers.clear()},"clearGlobalHookRegistrations"),Cs=i(r=>{try{console.error(`TypedRequest hook projection failed (${r})`)}catch{}},"logProjectionFailure"),cu=i(r=>{try{console.error(`TypedRequest hook callback failed (${r})`)}catch{}},"logCallbackFailure"),gw=i((r,e)=>{let t={correlationId:r.correlationId,method:r.method,direction:r.direction,phase:r.phase,timestamp:r.timestamp,...r.durationMs===void 0?{}:{durationMs:r.durationMs},hasError:r.errorText!==void 0};try{return Object.freeze(t)}catch{Cs(e);return}},"createMetadata"),rp=i(r=>typeof SharedArrayBuffer>"u"?!1:r instanceof SharedArrayBuffer||Object.prototype.toString.call(r)==="[object SharedArrayBuffer]","isSharedArrayBuffer"),Ar=i((r,e=new Set)=>{if(!(r===null||typeof r!="object"&&typeof r!="function")){if(rp(r))throw new TypeError("TypedRequest hook projections cannot contain SharedArrayBuffer");if(ArrayBuffer.isView(r)){if(rp(r.buffer))throw new TypeError("TypedRequest hook projections cannot contain SharedArrayBuffer-backed views");return}if(!e.has(r)){if(e.add(r),r instanceof Map){for(let[t,o]of r)Ar(t,e),Ar(o,e);return}if(r instanceof Set){for(let t of r)Ar(t,e);return}for(let t of Reflect.ownKeys(r)){let o=Reflect.getOwnPropertyDescriptor(r,t);if(o){if(!Object.hasOwn(o,"value"))throw new TypeError("TypedRequest hook projections cannot contain accessor properties");Ar(o.value,e)}}}}},"assertNoSharedArrayBuffer"),ww=i((r,e,t,o)=>{if(!e||!t.payloadProjector)return{payload:zr,payloadRedacted:!0};try{let n=t.payloadProjector(r,e);Ar(n);let s=structuredClone(n);return Ar(s),s!==null&&(typeof s=="object"||typeof s=="function")&&Object.freeze(s),{payload:s,payloadRedacted:!1}}catch{return Cs(o),{payload:zr,payloadRedacted:!0}}},"snapshotPayload"),bw=i((r,e,t,o)=>{if(!(!e||r.errorText===void 0||!t.errorProjector))try{let n=t.errorProjector(r.errorText,e);if(n===void 0)return;let s=structuredClone(n);if(typeof s!="string")throw new TypeError("TypedRequest error projector must return a string or undefined");return s}catch{Cs(o);return}},"snapshotError"),vw=i((r,e,t)=>{let o=gw(r,t),n=ww(r.payload,o,e,t),s=bw(r,o,e,t),a={correlationId:r.correlationId,method:r.method,direction:r.direction,phase:r.phase,timestamp:r.timestamp,...r.durationMs===void 0?{}:{durationMs:r.durationMs},hasError:r.errorText!==void 0,...n,...s===void 0?{}:{error:s}};try{return Object.freeze(a)}catch{Cs(t);let u={correlationId:r.correlationId,method:r.method,direction:r.direction,phase:r.phase,timestamp:r.timestamp,...r.durationMs===void 0?{}:{durationMs:r.durationMs},hasError:r.errorText!==void 0,payload:zr,payloadRedacted:!0};try{return Object.freeze(u)}catch{return u}}},"projectLogEntry"),fu=i((r,e)=>{try{let t=r.hooks[e];if(typeof t!="function")return;let o=r.projectedRegistrationsByPhase[e];return{callback:t,projectionOptions:o?.callback===t?tp(o.projectionOptions):{}}}catch{cu(e);return}},"snapshotDispatchRecipient"),lu=i((r,e,t)=>{let o=vw(t,r.projectionOptions,e);try{let n=r.callback(o);n&&typeof n.then=="function"&&Promise.resolve(n).catch(()=>{cu(e)})}catch{cu(e)}},"dispatchToRecipient"),Gr=i((r,e,t)=>{let o=Vr();if(o.subscribers.size===0){let a=fu(o.legacy,r),u=t?fu(t,r):void 0;if(!a&&!u)return;a&&lu(a,r,e),u&&lu(u,r,e);return}let s=[o.legacy,...Array.from(o.subscribers.values()),...t?[t]:[]].map(a=>fu(a,r)).filter(a=>!!a);for(let a of s)lu(a,r,e)},"dispatchTypedRequestHook");var Ns=class{static{i(this,"TypedTools")}constructor(e){this.localData={},this.abortSignal=e??new AbortController().signal}async passGuards(e,t){let o=new Po.GuardSet(e);if(!await o.allGuardsPass(t)){let s=await o.getFailedHint(t);throw new We(`guard failed: ${s}`,{failedHint:s})}}};var du=class r{static{i(this,"TypedHandler")}static{this.internalErrorMessage="Internal server error"}constructor(e,t){this.method=e,this.handlerFunction=t}async addResponse(e,t){if(e.method!==this.method)throw new Error("this handler has been given a wrong method to answer to. Please use a TypedRouter to filter requests");let o,n=new Ns(t);e.localData&&(n.localData=e.localData);let s=await this.handlerFunction(e.request,n).catch(a=>{a instanceof We?o=a:(console.error(`TypedRequest handler '${this.method}' failed`),o=new We(r.internalErrorMessage))});return o&&(e.error={text:o.errorText,data:o.errorData}),s&&(e.response=s),e?.correlation?.phase&&(e.correlation.phase="response"),e}};function Ws(r){let e=r?.method,t=r?.correlation?.id,o=r?.requestInstanceId;if(!(typeof e!="string"||e.length===0||typeof t!="string"||t.length===0||typeof o!="string"||o.length===0))return JSON.stringify([e,t,o])}i(Ws,"getTypedRequestResponseInterestKey");var pu=class r{static{i(this,"TypedRouter")}constructor(){this.hookRegistrationState=Ps(),this.routerMap=new Se.ObjectMap,this.fallbackRouterMap=new Se.ObjectMap,this.fallbackParentRouters=new Set,this.handlerMap=new Se.ObjectMap,this.middlewares=[],this.fireEventInterestMap=new Se.InterestMap(e=>e)}static{this.internalErrorMessage="Internal server error"}registerVirtualStreamTransportResolver(e){if(typeof e!="function")throw new TypeError("TypedRouter virtual stream transport resolver must be a function");if(this.virtualStreamTransportResolver)throw new Error("TypedRouter already has a virtual stream transport resolver owner");this.virtualStreamTransportResolver=e;let t=!1;return()=>{t||(t=!0,this.virtualStreamTransportResolver===e&&(this.virtualStreamTransportResolver=void 0))}}registerIncomingRequestAuthorityGuard(e){if(typeof e!="function")throw new TypeError("TypedRouter incoming request authority guard must be a function");if(this.incomingRequestAuthorityGuard)throw new Error("TypedRouter already has an incoming request authority guard owner");this.incomingRequestAuthorityGuard=e;let t=!1;return()=>{t||(t=!0,this.incomingRequestAuthorityGuard===e&&(this.incomingRequestAuthorityGuard=void 0))}}registerIncomingRequestSignalResolver(e){if(typeof e!="function")throw new TypeError("TypedRouter incoming request signal resolver must be a function");if(this.incomingRequestSignalResolver)throw new Error("TypedRouter already has an incoming request signal resolver owner");this.incomingRequestSignalResolver=e;let t=!1;return()=>{t||(t=!0,this.incomingRequestSignalResolver===e&&(this.incomingRequestSignalResolver=void 0))}}registerIncomingResponseAuthorityGuard(e){if(typeof e!="function")throw new TypeError("TypedRouter incoming response authority guard must be a function");if(this.incomingResponseAuthorityGuard)throw new Error("TypedRouter already has an incoming response authority guard owner");this.incomingResponseAuthorityGuard=e;let t=!1;return()=>{t||(t=!0,this.incomingResponseAuthorityGuard===e&&(this.incomingResponseAuthorityGuard=void 0))}}static get globalHooks(){return op()}static set globalHooks(e){np(e)}static setGlobalHooks(e,t){ip(e,t)}static addGlobalHooks(e,t){return sp(e,t)}static clearGlobalHooks(){ap()}get hooks(){return this.hookRegistrationState.hooks}set hooks(e){Rs(this.hookRegistrationState,e)}setHooks(e,t){_s(this.hookRegistrationState,e,t)}callHook(e,t){Gr(e,t,this.hookRegistrationState)}setErrorFromCaughtError(e,t,o){if(t instanceof We){e.error={text:t.errorText,data:t.errorData??{}};return}console.error(`TypedRequest ${o} failed`),e.error={text:r.internalErrorMessage,data:{}}}addMiddleware(e){this.middlewares.push(e)}addTypedHandler(e){if(this.getTypedHandlerForMethod(e.method))throw new Error(`a TypedHandler for ${e.method} alredy exists! Can't add another one.`);this.handlerMap.add(e);try{this.validateAffectedCompositionRoots()}catch(o){throw this.handlerMap.remove(e),o}}addTypedRouter(e){if(e===this)throw new Error("A TypedRouter cannot be composed with itself.");if(this.routerMap.findSync(a=>a===e))return()=>{};let o=this.canReachRouter(e),n=e.canReachRouter(this);if(o!==n)throw new Error("Cannot add a bidirectional TypedRouter edge across an existing composition boundary.");this.routerMap.add(e),e.routerMap.add(this);try{this.validateAffectedCompositionRoots()}catch(a){throw this.routerMap.remove(e),e.routerMap.remove(this),a}let s=!1;return()=>{s||(s=!0,this.routerMap.remove(e),e.routerMap.remove(this))}}addFallbackRouter(e){if(e===this)throw new Error("A TypedRouter cannot use itself as a fallback.");if(this.fallbackRouterMap.findSync(o=>o===e))return()=>{};if(e.canReachRouter(this))throw new Error("Adding this fallback would create a TypedRouter composition cycle.");this.fallbackRouterMap.add(e),e.fallbackParentRouters.add(this);try{this.validateAffectedCompositionRoots()}catch(o){throw this.fallbackRouterMap.remove(e),e.fallbackParentRouters.delete(this),o}let t=!1;return()=>{t||(t=!0,this.fallbackRouterMap.remove(e),e.fallbackParentRouters.delete(this))}}getMethodNames(){return[...this.collectReachableHandlers().keys()].sort()}canReachRouter(e,t=new Set){if(this===e)return!0;if(t.has(this))return!1;t.add(this);for(let o of[...this.routerMap.getArray(),...this.fallbackRouterMap.getArray()])if(o.canReachRouter(e,t))return!0;return!1}collectReachableHandlers(e=new Set,t=new Map){if(e.has(this))return t;e.add(this);for(let o of this.handlerMap.getArray()){let n=t.get(o.method);n||(n=new Set,t.set(o.method,n)),n.add(this)}for(let o of[...this.routerMap.getArray(),...this.fallbackRouterMap.getArray()])o.collectReachableHandlers(e,t);return t}getAffectedCompositionRoots(){let e=new Set,t=[this];for(;t.length>0;){let o=t.pop();e.has(o)||(e.add(o),t.push(...o.routerMap.getArray(),...o.fallbackParentRouters))}return e}validateAffectedCompositionRoots(){for(let e of this.getAffectedCompositionRoots())for(let[t,o]of e.collectReachableHandlers())if(o.size>1)throw new Error(`TypedRouter composition exposes more than one handler for method "${t}".`)}checkForTypedHandler(e){return!!this.getTypedHandlerForMethod(e)}getTypedHandlerForMethod(e,t=[]){t.push(this);let o;return o=this.handlerMap.findSync(n=>n.method===e),o||this.routerMap.getArray().forEach(n=>{!o&&!t.includes(n)&&(o=n.getTypedHandlerForMethod(e,t))}),o||this.fallbackRouterMap.getArray().forEach(n=>{!o&&!t.includes(n)&&(o=n.getTypedHandlerForMethod(e,t))}),o}getTypedHandlerAndRouter(e,t=[]){t.push(this);let o=this.handlerMap.findSync(n=>n.method===e);if(o)return{handler:o,router:this};for(let n of this.routerMap.getArray())if(!t.includes(n)){let s=n.getTypedHandlerAndRouter(e,t);if(s)return s}for(let n of this.fallbackRouterMap.getArray())if(!t.includes(n)){let s=n.getTypedHandlerAndRouter(e,t);if(s)return s}return null}static{this.defaultRouteOptions={localRequest:!1,skipHooks:!1}}async routeAndAddResponse(e,t={}){if(!e||typeof e!="object")return null;let o;try{o=Object.prototype.propertyIsEnumerable.call(e,"localData")}catch{return null}let n={...r.defaultRouteOptions,...t};if(!this.sanitizeIncomingLocalData(e))return null;let s=Object.freeze({...n.trustedLocalData??{}});if(e?.correlation?.phase==="response"){let x=Ws(e);if(!x)return null;if(this.incomingResponseAuthorityGuard){let g=Object.freeze({typedRouter:this,trustedLocalData:s,wireLocalDataPresent:o}),w=!1;try{w=this.incomingResponseAuthorityGuard(e,g)===!0}catch{}if(!w)return null}return n.skipHooks||this.callHook("onIncomingResponse",{correlationId:e.correlation.id,method:e.method,direction:"incoming",phase:"response",timestamp:Date.now(),payload:e.response,errorText:e.error?.text}),this.fireEventInterestMap.findInterest(x)?.fullfillInterest(e),null}if(e?.correlation?.phase!=="request"||typeof e.correlation.id!="string"||e.correlation.id.length===0||typeof e.method!="string"||e.method.length===0||!e.request||typeof e.request!="object")return console.log("TypedRouter received a malformed request DTO"),null;if(this.incomingRequestAuthorityGuard){let x=Object.freeze({typedRouter:this,trustedLocalData:s,wireLocalDataPresent:o}),g=!1;try{g=this.incomingRequestAuthorityGuard(e,x)===!0}catch{}if(!g)return null}let a,u=n.trustedAbortSignal;if(u!==void 0&&!this.isAbortSignal(u))throw new TypeError("TypedRouter trustedAbortSignal must be an AbortSignal");if(!u&&this.incomingRequestSignalResolver){if(typeof e.requestInstanceId!="string"||e.requestInstanceId.length===0)return null;let x=Object.freeze({typedRouter:this,trustedLocalData:s,wireLocalDataPresent:o});try{a=this.incomingRequestSignalResolver(e,x)}catch{return null}if(a&&(!this.isAbortSignal(a.abortSignal)||typeof a.complete!="function")){try{a.complete?.()}catch{}return null}u=a?.abortSignal}let c;try{c=this.virtualStreamTransportResolver?.(s)}catch(x){try{a?.complete()}catch{}throw x}let f=new et,l=new et,p=i(async x=>{await Promise.allSettled([f.rollback(x),l.rollback(x)])},"rollbackRouteActivations"),m=i(()=>{f.commit(),l.commit()},"commitRouteActivations"),h=i(async()=>(delete e.localData,Ye.encodePayloadForNetwork(e,{side:"responding",virtualStreamTransport:c,activationScope:l})),"encodeResponse");try{if(e=await Ye.decodePayloadFromNetworkAsync(e,{side:"responding",virtualStreamTransport:c,activationScope:f,abortSignal:u}),e.localData={...s},e.localData.firstTypedrouter=this,e?.correlation?.phase==="request"){let x=Date.now();n.skipHooks||this.callHook("onIncomingRequest",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"incoming",phase:"request",timestamp:x,payload:e.request});let g=this.getTypedHandlerAndRouter(e.method);if(!g)return console.log(`Cannot find handler for methodname ${e.method}`),e.error={text:"There is no available method for this call on the server side",data:{}},e.correlation.phase="response",e=await h(),await p(e.error),n.skipHooks||this.callHook("onOutgoingResponse",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"outgoing",phase:"response",timestamp:Date.now(),durationMs:Date.now()-x,payload:e.response,errorText:e.error?.text}),this.assertTrustedAbortSignalActive(u),e;let{handler:w,router:v}=g;if(v.middlewares.length>0)try{for(let te of v.middlewares)await te(e)}catch(te){return this.setErrorFromCaughtError(e,te,`middleware for method '${e.method}'`),e.correlation.phase="response",e=await h(),await p(te),n.skipHooks||this.callHook("onOutgoingResponse",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"outgoing",phase:"response",timestamp:Date.now(),durationMs:Date.now()-x,payload:e.response,errorText:e.error?.text}),this.assertTrustedAbortSignalActive(u),e}f.authorizeApplicationUse(),e=await w.addResponse(e,u);let G=!!e.error;return e=await h(),G&&await p(e.error),n.skipHooks||this.callHook("onOutgoingResponse",{correlationId:e.correlation?.id||"unknown",method:e.method,direction:"outgoing",phase:"response",timestamp:Date.now(),durationMs:Date.now()-x,payload:e.response,errorText:e.error?.text}),G||(this.assertTrustedAbortSignalActive(u),m()),this.assertTrustedAbortSignalActive(u),e}return await p(new Error("TypedRouter received an unroutable request DTO")),this.assertTrustedAbortSignalActive(u),null}catch(x){throw await p(x),x}finally{try{a?.complete()}catch{}}}sanitizeIncomingLocalData(e){try{let t=Reflect.getOwnPropertyDescriptor(e,"localData");if(t&&(t.configurable!==!0||!Reflect.deleteProperty(e,"localData")))return!1;if(!Reflect.has(e,"localData"))return!0;if(!Reflect.isExtensible(e)||!Reflect.defineProperty(e,"localData",{configurable:!0,enumerable:!1,value:void 0,writable:!0}))return!1;let o=Reflect.getOwnPropertyDescriptor(e,"localData");return!!(o&&o.configurable===!0&&o.enumerable===!1&&o.value===void 0&&o.writable===!0)}catch{return!1}}isAbortSignal(e){return!!(e&&typeof e=="object"&&typeof Reflect.get(e,"aborted")=="boolean"&&typeof Reflect.get(e,"addEventListener")=="function"&&typeof Reflect.get(e,"removeEventListener")=="function")}assertTrustedAbortSignalActive(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}};var mu=class{static{i(this,"TypedTarget")}constructor(e){if(this.isAsync=!1,e.postMethodWithTypedRouter&&!e.typedRouterRef)throw new Error("you have to specify a typedrouter when using postmethod with typedrouter");let t=e.responseTimeoutMs??3e4;if(!Number.isSafeInteger(t)||t<=0||t>2147483647)throw new RangeError("TypedTarget responseTimeoutMs must be a positive safe integer no greater than 2147483647");this.options=e,this.responseTimeoutMs=t}async post(e,t={}){if(t.signal&&this.options.supportsAbortSignal!==!0)throw new Error("TypedTarget does not declare AbortSignal transport support");let o=this.options.postMethod||this.options.postMethodWithTypedRouter;if(!o)throw new Error("TypedTarget requires a post method");let n;if(this.options.typedRouterRef){let l=Ws(e);if(!l)throw new TypeError("TypedTarget request response identity is malformed");n=await this.options.typedRouterRef.fireEventInterestMap.addInterest(l,e)}let s=t.signal;if(s?.aborted)throw n?.destroy(),s.reason??new DOMException("The operation was aborted","AbortError");let a,u=s?new Promise((l,p)=>{a=i(()=>{n?.destroy(),p(s.reason??new DOMException("The operation was aborted","AbortError"))},"abortListener"),s.addEventListener("abort",a,{once:!0})}):void 0,c,f=n?new Promise((l,p)=>{c=setTimeout(()=>{p(new Error(`TypedTarget response timed out after ${this.responseTimeoutMs}ms`))},this.responseTimeoutMs),c.unref?.()}):void 0;try{let l=Promise.resolve(o(e,t)),p=await Promise.race([l,...f?[f]:[],...u?[u]:[]]);return n?await Promise.race([n.interestFullfilled,f,...u?[u]:[]]):p||e}finally{c&&clearTimeout(c),s&&a&&s.removeEventListener("abort",a),n?.destroy()}}};var Fs=new Br.WebrequestClient,Ls=2147483647,Ys=class extends Error{static{i(this,"TypedRequestTimeoutError")}constructor(e,t){super(`Typed request "${e}" timed out after ${t}ms`),this.name="TypedRequestTimeoutError",this.method=e,this.timeoutMs=t}},qs=class extends Error{static{i(this,"TypedRequestRetryLimitError")}constructor(e,t){super(`Typed request "${e}" exceeded its ${t} server-directed retries`),this.name="TypedRequestRetryLimitError",this.method=e,this.maxRetries=t}},hu=class{static{i(this,"TypedRequest")}constructor(e,t){this.skipHooks=!1,typeof e=="string"?this.urlEndPoint=e:this.typedTarget=e,this.method=t}async fire(e,t=!1){let o=Date.now(),n=this.resolveFireOptions(t),s=this.createAbortContext(n);n.abortSignal=s.signal;let a=new et,u={method:this.method,request:e,response:null,requestInstanceId:Lo.uni(),correlation:{id:Lo.uni(),phase:"request"}};try{this.assertActive(n);let c=Ye.encodePayloadForNetworkWithMetadata(u,{side:"requesting",activationScope:a,virtualStreamTransport:this.typedTarget?.options.virtualStreamTransport});u=c.payload;let f=c.containsNetworkDescriptor;if(f&&!this.urlEndPoint&&this.typedTarget.options.supportsAbortSignal!==!0)throw new Error("VirtualStreams require TypedTarget AbortSignal transport support");if(n.useCache&&f)throw new Error("TypedRequest response caching is not supported for requests containing VirtualStreams");this.assertActive(n),n.useCache&&(n.cacheKey=await this.createCacheKey(u),this.assertActive(n)),this.skipHooks||Gr("onOutgoingRequest",{correlationId:u.correlation.id,method:this.method,direction:"outgoing",phase:"request",timestamp:o,payload:e}),a.publish();let l=await this.postTrObject(u,n);delete l.localData;let p=l.error;if(this.assertActive(n),p)throw this.skipHooks||Gr("onIncomingResponse",{correlationId:u.correlation.id,method:this.method,direction:"incoming",phase:"response",timestamp:Date.now(),durationMs:Date.now()-o,payload:l.response,errorText:p.text}),this.assertActive(n),new We(p.text,p.data);let m=l.response;if(!this.urlEndPoint&&this.typedTarget.options.supportsAbortSignal!==!0&&Ye.containsNetworkDescriptor(m))throw new Error("VirtualStreams require TypedTarget AbortSignal transport support");try{m=await Ye.decodePayloadFromNetworkAsync(m,{side:"requesting",activationScope:a,virtualStreamTransport:this.typedTarget?.options.virtualStreamTransport,openDeadlineAt:n.deadlineAt,abortSignal:n.abortSignal})}catch(h){throw h instanceof Xt&&n.deadlineAt!==void 0&&h.deadlineAt===n.deadlineAt?this.createTimeoutError(n):h}return this.assertActive(n),a.authorizeApplicationUse(),this.skipHooks||Gr("onIncomingResponse",{correlationId:u.correlation.id,method:this.method,direction:"incoming",phase:"response",timestamp:Date.now(),durationMs:Date.now()-o,payload:m}),this.assertActive(n),a.commit(),m}catch(c){throw await a.rollback(c),c}finally{s.cleanup()}}async postTrObject(e,t={useCache:!1,maxRetries:3}){let o=0;for(;;){this.assertActive(t);let n=this.createRequestIdentitySnapshot(e),s;if(this.urlEndPoint){let a;try{a=await Fs.postJsonWithMetadata(this.urlEndPoint,e,{cacheStrategy:t.useCache?"cache-first":"network-only",cacheKey:t.cacheKey,timeout:this.getRemainingTimeout(t),signal:t.abortSignal})}catch(u){throw t.cacheKey&&u instanceof SyntaxError&&await Fs.deleteCache(t.cacheKey),t.abortSignal?.aborted?this.getAbortReason(t):t.timeoutMs!==void 0&&(this.hasDeadlineExpired(t)||Br.isWebrequestTimeoutError(u))?this.createTimeoutError(t):u}s=a.data;try{a.metadata.fromCache?s=this.reconstructCachedHttpResponse(s,e,n):this.assertResponseEnvelope(s,n)}catch(u){throw t.cacheKey&&await Fs.deleteCache(t.cacheKey),u}t.cacheKey&&!this.isReusableCachedHttpEnvelope(s)&&await Fs.deleteCache(t.cacheKey)}else s=await this.postTypedTarget(e,t);if(this.assertResponseEnvelope(s,n),this.assertActive(t),s.error&&!s.retry||!s.retry)return s;if(console.log(`Server requested a retry for TypedRequest method '${this.method}'`),o>=t.maxRetries)throw new qs(this.method,t.maxRetries);o+=1,await this.waitForRetry(s.retry.waitForMs,t),e.requestInstanceId=Lo.uni(),e.correlation.phase="request",e.response=null,delete e.error,delete e.retry}}assertResponseEnvelope(e,t){let o=e?.error,n=e?.requestInstanceId,s=t.requestInstanceId;if(!e||typeof e!="object"||e.method!==t.method||e.correlation?.phase!=="response"||typeof e.correlation.id!="string"||e.correlation.id.length===0||!Object.hasOwn(e,"response")||typeof n!="string"||n.length===0||typeof s!="string"||s.length===0||n!==s||o!==void 0&&(!o||typeof o!="object"||typeof o.text!="string")||e.correlation.id!==t.correlationId)throw new TypeError("TypedRequest received an invalid response envelope")}async postTypedTarget(e,t){this.assertActive(t);try{return await this.typedTarget.post(e,{signal:t.abortSignal})}catch(o){throw t.abortSignal?.aborted?this.getAbortReason(t):o}}resolveFireOptions(e){let t=typeof e=="boolean"?{useCache:e}:e;if(!t||typeof t!="object")throw new TypeError("TypedRequest fire options must be a boolean or an options object");if(t.useCache!==void 0&&typeof t.useCache!="boolean")throw new TypeError("TypedRequest useCache must be a boolean");if(t.timeoutMs!==void 0&&(!Number.isSafeInteger(t.timeoutMs)||t.timeoutMs<=0||t.timeoutMs>Ls))throw new RangeError(`TypedRequest timeoutMs must be a positive safe integer no greater than ${Ls}`);if(t.abortSignal!==void 0&&!this.isAbortSignal(t.abortSignal))throw new TypeError("TypedRequest abortSignal must be an AbortSignal");if(t.maxRetries!==void 0&&(!Number.isSafeInteger(t.maxRetries)||t.maxRetries<0||t.maxRetries>1e3))throw new RangeError("TypedRequest maxRetries must be a safe integer between 0 and 1000");if((t.timeoutMs!==void 0||t.abortSignal!==void 0)&&!this.urlEndPoint&&this.typedTarget.options.supportsAbortSignal!==!0)throw new Error(t.abortSignal?"TypedRequest cancellation requires an HTTP URL or a TypedTarget with AbortSignal support":"TypedRequest timeoutMs requires an HTTP URL or a TypedTarget with AbortSignal support");return{useCache:t.useCache??!1,timeoutMs:t.timeoutMs,maxRetries:t.maxRetries??3,abortSignal:t.abortSignal,deadlineAt:t.timeoutMs===void 0?void 0:performance.now()+t.timeoutMs}}getRemainingTimeout(e){if(e.deadlineAt===void 0||e.timeoutMs===void 0)return;let t=Math.ceil(e.deadlineAt-performance.now());if(t<=0)throw this.createTimeoutError(e);return t}assertDeadline(e){this.getRemainingTimeout(e)}assertActive(e){if(e.abortSignal?.aborted)throw this.getAbortReason(e);this.assertDeadline(e)}hasDeadlineExpired(e){return e.deadlineAt!==void 0&&performance.now()>=e.deadlineAt}createTimeoutError(e){return new Ys(this.method,e.timeoutMs)}async waitForRetry(e,t){if(!Number.isSafeInteger(e)||e<=0||e>Ls)throw new RangeError(`TypedRequest retry waitForMs must be a positive safe integer no greater than ${Ls}`);this.assertActive(t);let o=this.getRemainingTimeout(t);if(o===void 0){await this.delayWithAbort(e,t);return}if(e>=o)throw await this.delayWithAbort(o,t),this.createTimeoutError(t);await this.delayWithAbort(e,t),this.assertActive(t)}async delayWithAbort(e,t){let o=t.abortSignal;if(!o){await H.delayFor(e);return}await new Promise((n,s)=>{let a=setTimeout(()=>{o.removeEventListener("abort",u),n()},e),u=i(()=>{clearTimeout(a),o.removeEventListener("abort",u),s(this.getAbortReason(t))},"onAbort");o.addEventListener("abort",u,{once:!0}),o.aborted&&u()})}createAbortContext(e){let t=e.abortSignal;if(e.timeoutMs===void 0)return{signal:t,cleanup:i(()=>{},"cleanup")};let o=new AbortController,n=i(()=>{o.abort(t?.reason??new DOMException("The operation was aborted","AbortError"))},"onCallerAbort");t?.aborted?n():t?.addEventListener("abort",n,{once:!0});let s=Math.max(0,Math.ceil(e.deadlineAt-performance.now())),a=setTimeout(()=>{o.abort(this.createTimeoutError(e))},s);return a.unref?.(),{signal:o.signal,cleanup:i(()=>{clearTimeout(a),t?.removeEventListener("abort",n)},"cleanup")}}getAbortReason(e){return e.abortSignal?.reason??new DOMException("The operation was aborted","AbortError")}reconstructCachedHttpResponse(e,t,o){if(!e||typeof e!="object"||Array.isArray(e)||e.method!==o.method||!Object.hasOwn(e,"response")||!e.response||typeof e.response!="object"||!this.isReusableCachedHttpEnvelope(e))throw new TypeError("TypedRequest received an invalid cached response envelope");return{method:o.method,request:t.request,response:e.response,requestInstanceId:o.requestInstanceId,correlation:{id:o.correlationId,phase:"response"}}}createRequestIdentitySnapshot(e){return Object.freeze({method:e.method,correlationId:e.correlation?.id,requestInstanceId:e.requestInstanceId})}isReusableCachedHttpEnvelope(e){return!Object.hasOwn(e,"error")&&!Object.hasOwn(e,"retry")&&!Ye.containsNetworkDescriptor(e)}isAbortSignal(e){return!!(e&&typeof e=="object"&&typeof Reflect.get(e,"aborted")=="boolean"&&typeof Reflect.get(e,"addEventListener")=="function"&&typeof Reflect.get(e,"removeEventListener")=="function")}async createCacheKey(e){let t=JSON.stringify({endpoint:this.urlEndPoint,method:e.method,request:e.request}),o=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return`typedrequest:v1:${Array.from(new Uint8Array(o),s=>s.toString(16).padStart(2,"0")).join("")}`}};function up(r){return r&&typeof r.then=="function"}i(up,"isPromise");var cp=Promise.resolve(!1),cie=Promise.resolve(!0),Ke=Promise.resolve();function js(r,e){return r||(r=0),new Promise(function(t){return setTimeout(function(){return t(e)},r)})}i(js,"sleep");function fp(r,e){return Math.floor(Math.random()*(e-r+1)+r)}i(fp,"randomInt");function Yo(){return Math.random().toString(36).substring(2)}i(Yo,"randomToken");var yu=0;function tt(){var r=Date.now()*1e3;return r<=yu&&(r=yu+1),yu=r,r}i(tt,"microSeconds");function fie(){return typeof navigator<"u"&&typeof navigator.locks<"u"&&typeof navigator.locks.request=="function"}i(fie,"supportsWebLockAPI");var Tw=tt,Dw="native";function Sw(r){var e={time:tt(),messagesCallback:null,bc:new BroadcastChannel(r),subFns:[]};return e.bc.onmessage=function(t){e.messagesCallback&&e.messagesCallback(t.data)},e}i(Sw,"create");function Mw(r){r.bc.close(),r.subFns=[]}i(Mw,"close");function Ow(r,e){try{return r.bc.postMessage(e,!1),Ke}catch(t){return Promise.reject(t)}}i(Ow,"postMessage");function Ew(r,e){r.messagesCallback=e}i(Ew,"onMessage");function kw(){if(typeof globalThis<"u"&&globalThis.Deno&&globalThis.Deno.args)return!0;if((typeof window<"u"||typeof self<"u")&&typeof BroadcastChannel=="function"){if(BroadcastChannel._pubkey)throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0}else return!1}i(kw,"canBeUsed");function Iw(){return 150}i(Iw,"averageResponseTime");var lp={create:Sw,close:Mw,onMessage:Ew,postMessage:Ow,canBeUsed:kw,type:Dw,averageResponseTime:Iw,microSeconds:Tw};var Jr=class{static{i(this,"ObliviousSet")}ttl;map=new Map;_to=!1;constructor(e){this.ttl=e}has(e){let t=this.map.get(e);return typeof t>"u"?!1:t<xu()-this.ttl?(this.map.delete(e),!1):!0}add(e){this.map.delete(e),this.map.set(e,xu()),this._to||(this._to=!0,setTimeout(()=>{this._to=!1,Cw(this)},0))}clear(){this.map.clear()}};function Cw(r){let e=xu()-r.ttl,t=r.map[Symbol.iterator]();for(;;){let o=t.next().value;if(!o)break;let n=o[0];if(o[1]<e)r.map.delete(n);else break}}i(Cw,"removeTooOldValues");function xu(){return Date.now()}i(xu,"now");function Zt(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=JSON.parse(JSON.stringify(r));return typeof e.webWorkerSupport>"u"&&(e.webWorkerSupport=!0),e.idb||(e.idb={}),e.idb.ttl||(e.idb.ttl=1e3*45),e.idb.fallbackInterval||(e.idb.fallbackInterval=150),r.idb&&typeof r.idb.onclose=="function"&&(e.idb.onclose=r.idb.onclose),e.localstorage||(e.localstorage={}),e.localstorage.removeTimeout||(e.localstorage.removeTimeout=1e3*60),r.methods&&(e.methods=r.methods),e.node||(e.node={}),e.node.ttl||(e.node.ttl=1e3*60*2),e.node.maxParallelWrites||(e.node.maxParallelWrites=2048),typeof e.node.useFastPath>"u"&&(e.node.useFastPath=!0),e}i(Zt,"fillOptionsWithDefaults");var Pw=tt,_w="pubkey.broadcast-channel-0-",qe="messages",qo={durability:"relaxed"},Rw="idb";function dp(){if(typeof indexedDB<"u")return indexedDB;if(typeof window<"u"){if(typeof window.mozIndexedDB<"u")return window.mozIndexedDB;if(typeof window.webkitIndexedDB<"u")return window.webkitIndexedDB;if(typeof window.msIndexedDB<"u")return window.msIndexedDB}return!1}i(dp,"getIdb");function Hs(r){r.commit&&r.commit()}i(Hs,"commitIndexedDBTransaction");function Nw(r){var e=dp(),t=_w+r,o=e.open(t);return o.onupgradeneeded=function(n){var s=n.target.result;s.createObjectStore(qe,{keyPath:"id",autoIncrement:!0})},new Promise(function(n,s){o.onerror=function(a){return s(a)},o.onsuccess=function(){n(o.result)}})}i(Nw,"createDatabase");function Ww(r,e,t){var o=Date.now(),n={uuid:e,time:o,data:t},s=r.transaction([qe],"readwrite",qo);return new Promise(function(a,u){s.oncomplete=function(){return a()},s.onerror=function(f){return u(f)};var c=s.objectStore(qe);c.add(n),Hs(s)})}i(Ww,"writeMessage");function Die(r){var e=r.transaction(qe,"readonly",qo),t=e.objectStore(qe),o=[];return new Promise(function(n){t.openCursor().onsuccess=function(s){var a=s.target.result;a?(o.push(a.value),a.continue()):(Hs(e),n(o))}})}i(Die,"getAllMessages");function Fw(r,e){var t=r.transaction(qe,"readonly",qo),o=t.objectStore(qe),n=[],s=IDBKeyRange.bound(e+1,1/0);if(o.getAll){var a=o.getAll(s);return new Promise(function(c,f){a.onerror=function(l){return f(l)},a.onsuccess=function(l){c(l.target.result)}})}function u(){try{return s=IDBKeyRange.bound(e+1,1/0),o.openCursor(s)}catch{return o.openCursor()}}return i(u,"openCursor"),new Promise(function(c,f){var l=u();l.onerror=function(p){return f(p)},l.onsuccess=function(p){var m=p.target.result;m?m.value.id<e+1?m.continue(e+1):(n.push(m.value),m.continue()):(Hs(t),c(n))}})}i(Fw,"getMessagesHigherThan");function Lw(r,e){if(r.closed)return Promise.resolve([]);var t=r.db.transaction(qe,"readwrite",qo),o=t.objectStore(qe);return Promise.all(e.map(function(n){var s=o.delete(n);return new Promise(function(a){s.onsuccess=function(){return a()}})}))}i(Lw,"removeMessagesById");function Yw(r,e){var t=Date.now()-e,o=r.transaction(qe,"readonly",qo),n=o.objectStore(qe),s=[];return new Promise(function(a){n.openCursor().onsuccess=function(u){var c=u.target.result;if(c){var f=c.value;f.time<t?(s.push(f),c.continue()):(Hs(o),a(s))}else a(s)}})}i(Yw,"getOldMessages");function qw(r){return Yw(r.db,r.options.idb.ttl).then(function(e){return Lw(r,e.map(function(t){return t.id}))})}i(qw,"cleanOldMessages");function jw(r,e){return e=Zt(e),Nw(r).then(function(t){var o={closed:!1,lastCursorId:0,channelName:r,options:e,uuid:Yo(),eMIs:new Jr(e.idb.ttl*2),writeBlockPromise:Ke,messagesCallback:null,readQueuePromises:[],db:t};return t.onclose=function(){o.closed=!0,e.idb.onclose&&e.idb.onclose()},pp(o),o})}i(jw,"create");function pp(r){r.closed||mp(r).then(function(){return js(r.options.idb.fallbackInterval)}).then(function(){return pp(r)})}i(pp,"_readLoop");function Hw(r,e){return!(r.uuid===e.uuid||e.eMIs.has(r.id)||r.data.time<e.messagesCallbackTime)}i(Hw,"_filterMessage");function mp(r){return r.closed?Ke:r.messagesCallback?Fw(r.db,r.lastCursorId).then(function(e){var t=e.filter(function(o){return!!o}).map(function(o){return o.id>r.lastCursorId&&(r.lastCursorId=o.id),o}).filter(function(o){return Hw(o,r)}).sort(function(o,n){return o.time-n.time});return t.forEach(function(o){r.messagesCallback&&(r.eMIs.add(o.id),r.messagesCallback(o.data))}),Ke}):Ke}i(mp,"readNewMessages");function Uw(r){r.closed=!0,r.db.close()}i(Uw,"close");function $w(r,e){return r.writeBlockPromise=r.writeBlockPromise.then(function(){return Ww(r.db,r.uuid,e)}).then(function(){fp(0,10)===0&&qw(r)}),r.writeBlockPromise}i($w,"postMessage");function Bw(r,e,t){r.messagesCallbackTime=t,r.messagesCallback=e,mp(r)}i(Bw,"onMessage");function zw(){return!!dp()}i(zw,"canBeUsed");function Vw(r){return r.idb.fallbackInterval*2}i(Vw,"averageResponseTime");var hp={create:jw,close:Uw,onMessage:Bw,postMessage:$w,canBeUsed:zw,type:Rw,averageResponseTime:Vw,microSeconds:Pw};var Aw=tt,Gw="pubkey.broadcastChannel-",Jw="localstorage";function yp(){var r;if(typeof window>"u")return null;try{r=window.localStorage,r=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return r}i(yp,"getLocalStorage");function xp(r){return Gw+r}i(xp,"storageKey");function Kw(r,e){return new Promise(function(t){js().then(function(){var o=xp(r.channelName),n={token:Yo(),time:Date.now(),data:e,uuid:r.uuid},s=JSON.stringify(n);yp().setItem(o,s);var a=document.createEvent("Event");a.initEvent("storage",!0,!0),a.key=o,a.newValue=s,window.dispatchEvent(a),t()})})}i(Kw,"postMessage");function Qw(r,e){var t=xp(r),o=i(function(s){s.key===t&&e(JSON.parse(s.newValue))},"listener");return window.addEventListener("storage",o),o}i(Qw,"addStorageEventListener");function Xw(r){window.removeEventListener("storage",r)}i(Xw,"removeStorageEventListener");function Zw(r,e){if(e=Zt(e),!gp())throw new Error("BroadcastChannel: localstorage cannot be used");var t=Yo(),o=new Jr(e.localstorage.removeTimeout),n={channelName:r,uuid:t,eMIs:o};return n.listener=Qw(r,function(s){n.messagesCallback&&s.uuid!==t&&(!s.token||o.has(s.token)||s.data.time&&s.data.time<n.messagesCallbackTime||(o.add(s.token),n.messagesCallback(s.data)))}),n}i(Zw,"create");function eb(r){Xw(r.listener)}i(eb,"close");function tb(r,e,t){r.messagesCallbackTime=t,r.messagesCallback=e}i(tb,"onMessage");function gp(){var r=yp();if(!r)return!1;try{var e="__broadcastchannel_check";r.setItem(e,"works"),r.removeItem(e)}catch{return!1}return!0}i(gp,"canBeUsed");function rb(){var r=120,e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")?r*2:r}i(rb,"averageResponseTime");var wp={create:Zw,close:eb,onMessage:tb,postMessage:Kw,canBeUsed:gp,type:Jw,averageResponseTime:rb,microSeconds:Aw};var bp=tt,ob="simulate",gu=new Set;function nb(r){var e={time:bp(),name:r,messagesCallback:null};return gu.add(e),e}i(nb,"create");function ib(r){gu.delete(r)}i(ib,"close");var vp=5;function sb(r,e){return new Promise(function(t){return setTimeout(function(){var o=Array.from(gu);o.forEach(function(n){n.name===r.name&&n!==r&&n.messagesCallback&&n.time<e.time&&n.messagesCallback(e)}),t()},vp)})}i(sb,"postMessage");function ab(r,e){r.messagesCallback=e}i(ab,"onMessage");function ub(){return!0}i(ub,"canBeUsed");function cb(){return vp}i(cb,"averageResponseTime");var Tp={create:nb,close:ib,onMessage:ab,postMessage:sb,canBeUsed:ub,type:ob,averageResponseTime:cb,microSeconds:bp};var Dp=[lp,hp,wp];function wu(r){var e=[].concat(r.methods,Dp).filter(Boolean);if(r.type){if(r.type==="simulate")return Tp;var t=e.find(function(n){return n.type===r.type});if(t)return t;throw new Error("method-type "+r.type+" not found")}r.webWorkerSupport||(e=e.filter(function(n){return n.type!=="idb"}));var o=e.find(function(n){return n.canBeUsed()});if(o)return o;throw new Error("No usable method found in "+JSON.stringify(Dp.map(function(n){return n.type})))}i(wu,"chooseMethod");var vu=new Set,fb=0,er=i(function(e,t){this.id=fb++,vu.add(this),this.name=e,bu&&(t=bu),this.options=Zt(t),this.method=wu(this.options),this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,pb(this)},"BroadcastChannel");er._pubkey=!0;function lb(r){r=Zt(r);var e=wu(r);return e.type==="node"?e.clearNodeFolder().then(function(){return!0}):cp}i(lb,"clearNodeFolder");var bu;function db(r){bu=r}i(db,"enforceOptions"),er.prototype={postMessage:i(function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return Sp(this,"message",e)},"postMessage"),postInternal:i(function(e){return Sp(this,"internal",e)},"postInternal"),set onmessage(r){var e=this.method.microSeconds(),t={time:e,fn:r};Ep(this,"message",this._onML),r&&typeof r=="function"?(this._onML=t,Op(this,"message",t)):this._onML=null},addEventListener:i(function(e,t){var o=this.method.microSeconds(),n={time:o,fn:t};Op(this,e,n)},"addEventListener"),removeEventListener:i(function(e,t){var o=this._addEL[e].find(function(n){return n.fn===t});Ep(this,e,o)},"removeEventListener"),close:i(function(){var e=this;if(!this.closed){vu.delete(this),this.closed=!0;var t=this._prepP?this._prepP:Ke;return this._onML=null,this._addEL.message=[],t.then(function(){return Promise.all(Array.from(e._uMP))}).then(function(){return Promise.all(e._befC.map(function(o){return o()}))}).then(function(){return e.method.close(e._state)})}},"close"),get type(){return this.method.type},get isClosed(){return this.closed}};function Sp(r,e,t){var o=r.method.microSeconds(),n={time:o,type:e,data:t},s=r._prepP?r._prepP:Ke;return s.then(function(){var a=r.method.postMessage(r._state,n);return r._uMP.add(a),a.catch().then(function(){return r._uMP.delete(a)}),a})}i(Sp,"_post");function pb(r){var e=r.method.create(r.name,r.options);up(e)?(r._prepP=e,e.then(function(t){r._state=t})):r._state=e}i(pb,"_prepareChannel");function Mp(r){return r._addEL.message.length>0||r._addEL.internal.length>0}i(Mp,"_hasMessageListeners");function Op(r,e,t){r._addEL[e].push(t),mb(r)}i(Op,"_addListenerObject");function Ep(r,e,t){r._addEL[e]=r._addEL[e].filter(function(o){return o!==t}),hb(r)}i(Ep,"_removeListenerObject");function mb(r){if(!r._iL&&Mp(r)){var e=i(function(n){r._addEL[n.type].forEach(function(s){n.time>=s.time&&s.fn(n.data)})},"listenerFn"),t=r.method.microSeconds();r._prepP?r._prepP.then(function(){r._iL=!0,r.method.onMessage(r._state,e,t)}):(r._iL=!0,r.method.onMessage(r._state,e,t))}}i(mb,"_startListening");function hb(r){if(r._iL&&!Mp(r)){r._iL=!1;var e=r.method.microSeconds();r.method.onMessage(r._state,null,e)}}i(hb,"_stopListening");var xb=i((r,e)=>{if(typeof globalThis.BroadcastChannel=="function"){let o=new globalThis.BroadcastChannel(r);return o.onmessage=n=>{e(n.data)},{post:i(async n=>{o.postMessage(n)},"post"),close:i(async()=>{o.close()},"close")}}let t=new er(r);return t.onmessage=o=>{e(o)},{post:i(o=>t.postMessage(o),"post"),close:i(()=>t.close(),"close")}},"openChannel"),kp=i(r=>typeof r=="object"&&r!==null,"isObject"),Ip=i((r,e)=>Object.prototype.hasOwnProperty.call(r,e),"hasOwn"),gb=i(r=>{if(!kp(r)||!Ip(r,"deesCommsEvent"))return null;let e=r.deesCommsEvent;return!kp(e)||typeof e.name!="string"||typeof e.uniqueEventId!="string"||!Ip(e,"payload")?"malformed":{name:e.name,uniqueEventId:e.uniqueEventId,payload:e.payload}},"eventOf"),wb=i(()=>{let r=globalThis.crypto.getRandomValues(new Uint8Array(16));return Array.from(r,e=>e.toString(16).padStart(2,"0")).join("")},"createEventId"),Cp=class r{constructor(e={}){this.eventHandlers=new Map;this.closed=!1;this.closing=null;this.typedrouter=new kt.TypedRouter;this.typedtarget=new kt.TypedTarget({postMethodWithTypedRouter:i(async e=>{await this.postMessage(e)},"postMethodWithTypedRouter"),typedRouterRef:this.typedrouter});this.channelName=e.channelName??r.defaultChannelName,this.channel=xb(this.channelName,t=>{this.receive(t)})}static{i(this,"DeesComms")}static{this.defaultChannelName="dees-comms"}createTypedRequest(e){return new kt.TypedRequest(this.typedtarget,e)}async postMessage(e){this.assertOpen(),await this.channel.post(e)}async createTypedHandler(e,t){this.typedrouter.addTypedHandler(new kt.TypedHandler(e,t))}async broadcast(e,t){let o={deesCommsEvent:{name:e,uniqueEventId:wb(),payload:t}};await this.postMessage(o)}subscribe(e,t){this.assertOpen();let o=i((s,a)=>t(s,a),"handler"),n=this.eventHandlers.get(e);return n||(n=new Set,this.eventHandlers.set(e,n)),n.add(o),{unsubscribe:i(()=>{let s=this.eventHandlers.get(e);s&&(s.delete(o),s.size===0&&this.eventHandlers.delete(e))},"unsubscribe")}}async close(){this.closing||(this.closed=!0,this.eventHandlers.clear(),this.closing=this.channel.close()),await this.closing}assertOpen(){if(this.closed)throw new Error(`DeesComms channel "${this.channelName}" is closed`)}async receive(e){if(this.closed)return;let t=gb(e);if(t==="malformed"){console.log("DeesComms received a malformed event");return}if(t){this.dispatch(t);return}let o=await this.typedrouter.routeAndAddResponse(e,{skipHooks:!0});o&&!o.error&&!this.closed&&await this.postMessage(o)}dispatch(e){let t=this.eventHandlers.get(e.name);if(t)for(let o of[...t]){if(this.closed)return;t.has(o)&&(async()=>o(e.payload,e))().catch(n=>{console.error(`DeesComms: a handler of the event "${e.name}" failed`,n)})}}};export{Cp as DeesComms};
13
13
  //# sourceMappingURL=bundle.js.map