@superglue/cli 1.1.76 → 1.1.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/dist/cli.js +13 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var QS=Object.create;var nl=Object.defineProperty;var SS=Object.getOwnPropertyDescriptor;var DS=Object.getOwnPropertyNames;var TS=Object.getPrototypeOf,RS=Object.prototype.hasOwnProperty;var he=(o,e)=>()=>(o&&(e=o(o=0)),e);var y=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports),Bv=(o,e)=>{for(var t in e)nl(o,t,{get:e[t],enumerable:!0})},Qv=(o,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of DS(e))!RS.call(o,i)&&i!==t&&nl(o,i,{get:()=>e[i],enumerable:!(a=SS(e,i))||a.enumerable});return o};var W=(o,e,t)=>(t=o!=null?QS(TS(o)):{},Qv(e||!o||!o.__esModule?nl(t,"default",{value:o,enumerable:!0}):t,o)),Rp=o=>Qv(nl({},"__esModule",{value:!0}),o);var Nv=y((Ile,Rv)=>{"use strict";var Sv=9007199254740991,NS="[object Arguments]",US="[object Function]",OS="[object GeneratorFunction]",MS=/^(?:0|[1-9]\d*)$/;function _S(o,e){for(var t=-1,a=Array(o);++t<o;)a[t]=e(t);return a}function LS(o,e){return function(t){return o(e(t))}}var cl=Object.prototype,Np=cl.hasOwnProperty,Dv=cl.toString,FS=cl.propertyIsEnumerable,PS=LS(Object.keys,Object);function HS(o,e){var t=WS(o)||$S(o)?_S(o.length,String):[],a=t.length,i=!!a;for(var r in o)(e||Np.call(o,r))&&!(i&&(r=="length"||YS(r,a)))&&t.push(r);return t}function GS(o){if(!VS(o))return PS(o);var e=[];for(var t in Object(o))Np.call(o,t)&&t!="constructor"&&e.push(t);return e}function YS(o,e){return e=e??Sv,!!e&&(typeof o=="number"||MS.test(o))&&o>-1&&o%1==0&&o<e}function VS(o){var e=o&&o.constructor,t=typeof e=="function"&&e.prototype||cl;return o===t}function $S(o){return JS(o)&&Np.call(o,"callee")&&(!FS.call(o,"callee")||Dv.call(o)==NS)}var WS=Array.isArray;function Tv(o){return o!=null&&ZS(o.length)&&!KS(o)}function JS(o){return e7(o)&&Tv(o)}function KS(o){var e=XS(o)?Dv.call(o):"";return e==US||e==OS}function ZS(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=Sv}function XS(o){var e=typeof o;return!!o&&(e=="object"||e=="function")}function e7(o){return!!o&&typeof o=="object"}function o7(o){return Tv(o)?HS(o):GS(o)}Rv.exports=o7});var ux=y((Vn,ss)=>{"use strict";var t7=200,Yv="__lodash_hash_undefined__",a7=800,i7=16,Vv=9007199254740991,$v="[object Arguments]",r7="[object Array]",s7="[object AsyncFunction]",n7="[object Boolean]",c7="[object Date]",m7="[object Error]",Wv="[object Function]",l7="[object GeneratorFunction]",u7="[object Map]",d7="[object Number]",g7="[object Null]",Jv="[object Object]",p7="[object Proxy]",h7="[object RegExp]",f7="[object Set]",b7="[object String]",y7="[object Undefined]",k7="[object WeakMap]",A7="[object ArrayBuffer]",w7="[object DataView]",v7="[object Float32Array]",x7="[object Float64Array]",z7="[object Int8Array]",q7="[object Int16Array]",E7="[object Int32Array]",I7="[object Uint8Array]",C7="[object Uint8ClampedArray]",j7="[object Uint16Array]",B7="[object Uint32Array]",Q7=/[\\^$.*+?()[\]{}|]/g,S7=/^\[object .+?Constructor\]$/,D7=/^(?:0|[1-9]\d*)$/,ke={};ke[v7]=ke[x7]=ke[z7]=ke[q7]=ke[E7]=ke[I7]=ke[C7]=ke[j7]=ke[B7]=!0;ke[$v]=ke[r7]=ke[A7]=ke[n7]=ke[w7]=ke[c7]=ke[m7]=ke[Wv]=ke[u7]=ke[d7]=ke[Jv]=ke[h7]=ke[f7]=ke[b7]=ke[k7]=!1;var Kv=typeof global=="object"&&global&&global.Object===Object&&global,T7=typeof self=="object"&&self&&self.Object===Object&&self,Jn=Kv||T7||Function("return this")(),Zv=typeof Vn=="object"&&Vn&&!Vn.nodeType&&Vn,$n=Zv&&typeof ss=="object"&&ss&&!ss.nodeType&&ss,Xv=$n&&$n.exports===Zv,Up=Xv&&Kv.process,Uv=(function(){try{var o=$n&&$n.require&&$n.require("util").types;return o||Up&&Up.binding&&Up.binding("util")}catch{}})(),Ov=Uv&&Uv.isTypedArray;function R7(o,e,t){switch(t.length){case 0:return o.call(e);case 1:return o.call(e,t[0]);case 2:return o.call(e,t[0],t[1]);case 3:return o.call(e,t[0],t[1],t[2])}return o.apply(e,t)}function N7(o,e){for(var t=-1,a=Array(o);++t<o;)a[t]=e(t);return a}function U7(o){return function(e){return o(e)}}function O7(o,e){return o?.[e]}function M7(o,e){return function(t){return o(e(t))}}var _7=Array.prototype,L7=Function.prototype,ul=Object.prototype,Op=Jn["__core-js_shared__"],dl=L7.toString,ka=ul.hasOwnProperty,Mv=(function(){var o=/[^.]+$/.exec(Op&&Op.keys&&Op.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""})(),ex=ul.toString,F7=dl.call(Object),P7=RegExp("^"+dl.call(ka).replace(Q7,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ml=Xv?Jn.Buffer:void 0,_v=Jn.Symbol,Lv=Jn.Uint8Array,Fv=ml?ml.allocUnsafe:void 0,ox=M7(Object.getPrototypeOf,Object),Pv=Object.create,H7=ul.propertyIsEnumerable,G7=_7.splice,Ki=_v?_v.toStringTag:void 0,ll=(function(){try{var o=Hp(Object,"defineProperty");return o({},"",{}),o}catch{}})(),Y7=ml?ml.isBuffer:void 0,Hv=Math.max,V7=Date.now,tx=Hp(Jn,"Map"),Wn=Hp(Object,"create"),$7=(function(){function o(){}return function(e){if(!Xi(e))return{};if(Pv)return Pv(e);o.prototype=e;var t=new o;return o.prototype=void 0,t}})();function Zi(o){var e=-1,t=o==null?0:o.length;for(this.clear();++e<t;){var a=o[e];this.set(a[0],a[1])}}function W7(){this.__data__=Wn?Wn(null):{},this.size=0}function J7(o){var e=this.has(o)&&delete this.__data__[o];return this.size-=e?1:0,e}function K7(o){var e=this.__data__;if(Wn){var t=e[o];return t===Yv?void 0:t}return ka.call(e,o)?e[o]:void 0}function Z7(o){var e=this.__data__;return Wn?e[o]!==void 0:ka.call(e,o)}function X7(o,e){var t=this.__data__;return this.size+=this.has(o)?0:1,t[o]=Wn&&e===void 0?Yv:e,this}Zi.prototype.clear=W7;Zi.prototype.delete=J7;Zi.prototype.get=K7;Zi.prototype.has=Z7;Zi.prototype.set=X7;function Aa(o){var e=-1,t=o==null?0:o.length;for(this.clear();++e<t;){var a=o[e];this.set(a[0],a[1])}}function eD(){this.__data__=[],this.size=0}function oD(o){var e=this.__data__,t=gl(e,o);if(t<0)return!1;var a=e.length-1;return t==a?e.pop():G7.call(e,t,1),--this.size,!0}function tD(o){var e=this.__data__,t=gl(e,o);return t<0?void 0:e[t][1]}function aD(o){return gl(this.__data__,o)>-1}function iD(o,e){var t=this.__data__,a=gl(t,o);return a<0?(++this.size,t.push([o,e])):t[a][1]=e,this}Aa.prototype.clear=eD;Aa.prototype.delete=oD;Aa.prototype.get=tD;Aa.prototype.has=aD;Aa.prototype.set=iD;function ns(o){var e=-1,t=o==null?0:o.length;for(this.clear();++e<t;){var a=o[e];this.set(a[0],a[1])}}function rD(){this.size=0,this.__data__={hash:new Zi,map:new(tx||Aa),string:new Zi}}function sD(o){var e=hl(this,o).delete(o);return this.size-=e?1:0,e}function nD(o){return hl(this,o).get(o)}function cD(o){return hl(this,o).has(o)}function mD(o,e){var t=hl(this,o),a=t.size;return t.set(o,e),this.size+=t.size==a?0:1,this}ns.prototype.clear=rD;ns.prototype.delete=sD;ns.prototype.get=nD;ns.prototype.has=cD;ns.prototype.set=mD;function cs(o){var e=this.__data__=new Aa(o);this.size=e.size}function lD(){this.__data__=new Aa,this.size=0}function uD(o){var e=this.__data__,t=e.delete(o);return this.size=e.size,t}function dD(o){return this.__data__.get(o)}function gD(o){return this.__data__.has(o)}function pD(o,e){var t=this.__data__;if(t instanceof Aa){var a=t.__data__;if(!tx||a.length<t7-1)return a.push([o,e]),this.size=++t.size,this;t=this.__data__=new ns(a)}return t.set(o,e),this.size=t.size,this}cs.prototype.clear=lD;cs.prototype.delete=uD;cs.prototype.get=dD;cs.prototype.has=gD;cs.prototype.set=pD;function hD(o,e){var t=Fp(o),a=!t&&Lp(o),i=!t&&!a&&sx(o),r=!t&&!a&&!i&&cx(o),s=t||a||i||r,n=s?N7(o.length,String):[],c=n.length;for(var m in o)(e||ka.call(o,m))&&!(s&&(m=="length"||i&&(m=="offset"||m=="parent")||r&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||ix(m,c)))&&n.push(m);return n}function Mp(o,e,t){(t!==void 0&&!fl(o[e],t)||t===void 0&&!(e in o))&&Pp(o,e,t)}function fD(o,e,t){var a=o[e];(!(ka.call(o,e)&&fl(a,t))||t===void 0&&!(e in o))&&Pp(o,e,t)}function gl(o,e){for(var t=o.length;t--;)if(fl(o[t][0],e))return t;return-1}function Pp(o,e,t){e=="__proto__"&&ll?ll(o,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):o[e]=t}var bD=BD();function pl(o){return o==null?o===void 0?y7:g7:Ki&&Ki in Object(o)?QD(o):UD(o)}function Gv(o){return Kn(o)&&pl(o)==$v}function yD(o){if(!Xi(o)||RD(o))return!1;var e=Yp(o)?P7:S7;return e.test(LD(o))}function kD(o){return Kn(o)&&nx(o.length)&&!!ke[pl(o)]}function AD(o){if(!Xi(o))return ND(o);var e=rx(o),t=[];for(var a in o)a=="constructor"&&(e||!ka.call(o,a))||t.push(a);return t}function ax(o,e,t,a,i){o!==e&&bD(e,function(r,s){if(i||(i=new cs),Xi(r))wD(o,e,s,t,ax,a,i);else{var n=a?a(_p(o,s),r,s+"",o,e,i):void 0;n===void 0&&(n=r),Mp(o,s,n)}},mx)}function wD(o,e,t,a,i,r,s){var n=_p(o,t),c=_p(e,t),m=s.get(c);if(m){Mp(o,t,m);return}var l=r?r(n,c,t+"",o,e,s):void 0,u=l===void 0;if(u){var d=Fp(c),g=!d&&sx(c),p=!d&&!g&&cx(c);l=c,d||g||p?Fp(n)?l=n:FD(n)?l=ID(n):g?(u=!1,l=zD(c,!0)):p?(u=!1,l=ED(c,!0)):l=[]:PD(c)||Lp(c)?(l=n,Lp(n)?l=HD(n):(!Xi(n)||Yp(n))&&(l=SD(c))):u=!1}u&&(s.set(c,l),i(l,c,a,r,s),s.delete(c)),Mp(o,t,l)}function vD(o,e){return MD(OD(o,e,lx),o+"")}var xD=ll?function(o,e){return ll(o,"toString",{configurable:!0,enumerable:!1,value:YD(e),writable:!0})}:lx;function zD(o,e){if(e)return o.slice();var t=o.length,a=Fv?Fv(t):new o.constructor(t);return o.copy(a),a}function qD(o){var e=new o.constructor(o.byteLength);return new Lv(e).set(new Lv(o)),e}function ED(o,e){var t=e?qD(o.buffer):o.buffer;return new o.constructor(t,o.byteOffset,o.length)}function ID(o,e){var t=-1,a=o.length;for(e||(e=Array(a));++t<a;)e[t]=o[t];return e}function CD(o,e,t,a){var i=!t;t||(t={});for(var r=-1,s=e.length;++r<s;){var n=e[r],c=a?a(t[n],o[n],n,t,o):void 0;c===void 0&&(c=o[n]),i?Pp(t,n,c):fD(t,n,c)}return t}function jD(o){return vD(function(e,t){var a=-1,i=t.length,r=i>1?t[i-1]:void 0,s=i>2?t[2]:void 0;for(r=o.length>3&&typeof r=="function"?(i--,r):void 0,s&&DD(t[0],t[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++a<i;){var n=t[a];n&&o(e,n,a,r)}return e})}function BD(o){return function(e,t,a){for(var i=-1,r=Object(e),s=a(e),n=s.length;n--;){var c=s[o?n:++i];if(t(r[c],c,r)===!1)break}return e}}function hl(o,e){var t=o.__data__;return TD(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Hp(o,e){var t=O7(o,e);return yD(t)?t:void 0}function QD(o){var e=ka.call(o,Ki),t=o[Ki];try{o[Ki]=void 0;var a=!0}catch{}var i=ex.call(o);return a&&(e?o[Ki]=t:delete o[Ki]),i}function SD(o){return typeof o.constructor=="function"&&!rx(o)?$7(ox(o)):{}}function ix(o,e){var t=typeof o;return e=e??Vv,!!e&&(t=="number"||t!="symbol"&&D7.test(o))&&o>-1&&o%1==0&&o<e}function DD(o,e,t){if(!Xi(t))return!1;var a=typeof e;return(a=="number"?Gp(t)&&ix(e,t.length):a=="string"&&e in t)?fl(t[e],o):!1}function TD(o){var e=typeof o;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?o!=="__proto__":o===null}function RD(o){return!!Mv&&Mv in o}function rx(o){var e=o&&o.constructor,t=typeof e=="function"&&e.prototype||ul;return o===t}function ND(o){var e=[];if(o!=null)for(var t in Object(o))e.push(t);return e}function UD(o){return ex.call(o)}function OD(o,e,t){return e=Hv(e===void 0?o.length-1:e,0),function(){for(var a=arguments,i=-1,r=Hv(a.length-e,0),s=Array(r);++i<r;)s[i]=a[e+i];i=-1;for(var n=Array(e+1);++i<e;)n[i]=a[i];return n[e]=t(s),R7(o,this,n)}}function _p(o,e){if(!(e==="constructor"&&typeof o[e]=="function")&&e!="__proto__")return o[e]}var MD=_D(xD);function _D(o){var e=0,t=0;return function(){var a=V7(),i=i7-(a-t);if(t=a,i>0){if(++e>=a7)return arguments[0]}else e=0;return o.apply(void 0,arguments)}}function LD(o){if(o!=null){try{return dl.call(o)}catch{}try{return o+""}catch{}}return""}function fl(o,e){return o===e||o!==o&&e!==e}var Lp=Gv((function(){return arguments})())?Gv:function(o){return Kn(o)&&ka.call(o,"callee")&&!H7.call(o,"callee")},Fp=Array.isArray;function Gp(o){return o!=null&&nx(o.length)&&!Yp(o)}function FD(o){return Kn(o)&&Gp(o)}var sx=Y7||VD;function Yp(o){if(!Xi(o))return!1;var e=pl(o);return e==Wv||e==l7||e==s7||e==p7}function nx(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=Vv}function Xi(o){var e=typeof o;return o!=null&&(e=="object"||e=="function")}function Kn(o){return o!=null&&typeof o=="object"}function PD(o){if(!Kn(o)||pl(o)!=Jv)return!1;var e=ox(o);if(e===null)return!0;var t=ka.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&dl.call(t)==F7}var cx=Ov?U7(Ov):kD;function HD(o){return CD(o,mx(o))}function mx(o){return Gp(o)?hD(o,!0):AD(o)}var GD=jD(function(o,e,t){ax(o,e,t)});function YD(o){return function(){return o}}function lx(o){return o}function VD(){return!1}ss.exports=GD});var qx=y((Cle,zx)=>{"use strict";var hx=200,Wp="__lodash_hash_undefined__",$D=1/0,WD=9007199254740991,JD="[object Function]",KD="[object GeneratorFunction]",ZD=/[\\^$.*+?()[\]{}|]/g,XD=/^\[object .+?Constructor\]$/,eT=typeof global=="object"&&global&&global.Object===Object&&global,oT=typeof self=="object"&&self&&self.Object===Object&&self,Jp=eT||oT||Function("return this")();function tT(o,e,t){switch(t.length){case 0:return o.call(e);case 1:return o.call(e,t[0]);case 2:return o.call(e,t[0],t[1]);case 3:return o.call(e,t[0],t[1],t[2])}return o.apply(e,t)}function aT(o,e){for(var t=-1,a=o?o.length:0,i=0,r=[];++t<a;){var s=o[t];e(s,t,o)&&(r[i++]=s)}return r}function fx(o,e){var t=o?o.length:0;return!!t&&nT(o,e,0)>-1}function bx(o,e,t){for(var a=-1,i=o?o.length:0;++a<i;)if(t(e,o[a]))return!0;return!1}function iT(o,e){for(var t=-1,a=o?o.length:0,i=Array(a);++t<a;)i[t]=e(o[t],t,o);return i}function rT(o,e){for(var t=-1,a=e.length,i=o.length;++t<a;)o[i+t]=e[t];return o}function sT(o,e,t,a){for(var i=o.length,r=t+(a?1:-1);a?r--:++r<i;)if(e(o[r],r,o))return r;return-1}function nT(o,e,t){if(e!==e)return sT(o,cT,t);for(var a=t-1,i=o.length;++a<i;)if(o[a]===e)return a;return-1}function cT(o){return o!==o}function mT(o){return function(e){return o(e)}}function yx(o,e){return o.has(e)}function lT(o,e){return o?.[e]}function uT(o){var e=!1;if(o!=null&&typeof o.toString!="function")try{e=!!(o+"")}catch{}return e}function kx(o){var e=-1,t=Array(o.size);return o.forEach(function(a){t[++e]=a}),t}var dT=Array.prototype,gT=Function.prototype,Ax=Object.prototype,Vp=Jp["__core-js_shared__"],dx=(function(){var o=/[^.]+$/.exec(Vp&&Vp.keys&&Vp.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""})(),wx=gT.toString,Kp=Ax.hasOwnProperty,pT=Ax.toString,hT=RegExp("^"+wx.call(Kp).replace(ZD,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),fT=dT.splice,gx=Math.max,bT=Zp(Jp,"Map"),$p=Zp(Jp,"Set"),Zn=Zp(Object,"create");function er(o){var e=-1,t=o?o.length:0;for(this.clear();++e<t;){var a=o[e];this.set(a[0],a[1])}}function yT(){this.__data__=Zn?Zn(null):{}}function kT(o){return this.has(o)&&delete this.__data__[o]}function AT(o){var e=this.__data__;if(Zn){var t=e[o];return t===Wp?void 0:t}return Kp.call(e,o)?e[o]:void 0}function wT(o){var e=this.__data__;return Zn?e[o]!==void 0:Kp.call(e,o)}function vT(o,e){var t=this.__data__;return t[o]=Zn&&e===void 0?Wp:e,this}er.prototype.clear=yT;er.prototype.delete=kT;er.prototype.get=AT;er.prototype.has=wT;er.prototype.set=vT;function ms(o){var e=-1,t=o?o.length:0;for(this.clear();++e<t;){var a=o[e];this.set(a[0],a[1])}}function xT(){this.__data__=[]}function zT(o){var e=this.__data__,t=bl(e,o);if(t<0)return!1;var a=e.length-1;return t==a?e.pop():fT.call(e,t,1),!0}function qT(o){var e=this.__data__,t=bl(e,o);return t<0?void 0:e[t][1]}function ET(o){return bl(this.__data__,o)>-1}function IT(o,e){var t=this.__data__,a=bl(t,o);return a<0?t.push([o,e]):t[a][1]=e,this}ms.prototype.clear=xT;ms.prototype.delete=zT;ms.prototype.get=qT;ms.prototype.has=ET;ms.prototype.set=IT;function ls(o){var e=-1,t=o?o.length:0;for(this.clear();++e<t;){var a=o[e];this.set(a[0],a[1])}}function CT(){this.__data__={hash:new er,map:new(bT||ms),string:new er}}function jT(o){return yl(this,o).delete(o)}function BT(o){return yl(this,o).get(o)}function QT(o){return yl(this,o).has(o)}function ST(o,e){return yl(this,o).set(o,e),this}ls.prototype.clear=CT;ls.prototype.delete=jT;ls.prototype.get=BT;ls.prototype.has=QT;ls.prototype.set=ST;function Xn(o){var e=-1,t=o?o.length:0;for(this.__data__=new ls;++e<t;)this.add(o[e])}function DT(o){return this.__data__.set(o,Wp),this}function TT(o){return this.__data__.has(o)}Xn.prototype.add=Xn.prototype.push=DT;Xn.prototype.has=TT;function bl(o,e){for(var t=o.length;t--;)if(HT(o[t][0],e))return t;return-1}function px(o,e,t,a){var i=-1,r=fx,s=!0,n=o.length,c=[],m=e.length;if(!n)return c;t&&(e=iT(e,mT(t))),a?(r=bx,s=!1):e.length>=hx&&(r=yx,s=!1,e=new Xn(e));e:for(;++i<n;){var l=o[i],u=t?t(l):l;if(l=a||l!==0?l:0,s&&u===u){for(var d=m;d--;)if(e[d]===u)continue e;c.push(l)}else r(e,u,a)||c.push(l)}return c}function RT(o){if(!xx(o)||LT(o))return!1;var e=vx(o)||uT(o)?hT:XD;return e.test(FT(o))}function NT(o,e){return e=gx(e===void 0?o.length-1:e,0),function(){for(var t=arguments,a=-1,i=gx(t.length-e,0),r=Array(i);++a<i;)r[a]=t[e+a];a=-1;for(var s=Array(e+1);++a<e;)s[a]=t[a];return s[e]=r,tT(o,this,s)}}function UT(o,e,t){var a=-1,i=fx,r=o.length,s=!0,n=[],c=n;if(t)s=!1,i=bx;else if(r>=hx){var m=e?null:MT(o);if(m)return kx(m);s=!1,i=yx,c=new Xn}else c=e?[]:n;e:for(;++a<r;){var l=o[a],u=e?e(l):l;if(l=t||l!==0?l:0,s&&u===u){for(var d=c.length;d--;)if(c[d]===u)continue e;e&&c.push(u),n.push(l)}else i(c,u,t)||(c!==n&&c.push(u),n.push(l))}return n}function OT(o,e,t){for(var a=-1,i=o.length;++a<i;)var r=r?rT(px(r,o[a],e,t),px(o[a],r,e,t)):o[a];return r&&r.length?UT(r,e,t):[]}var MT=$p&&1/kx(new $p([,-0]))[1]==$D?function(o){return new $p(o)}:WT;function yl(o,e){var t=o.__data__;return _T(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Zp(o,e){var t=lT(o,e);return RT(t)?t:void 0}function _T(o){var e=typeof o;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?o!=="__proto__":o===null}function LT(o){return!!dx&&dx in o}function FT(o){if(o!=null){try{return wx.call(o)}catch{}try{return o+""}catch{}}return""}var PT=NT(function(o){return OT(aT(o,YT))});function HT(o,e){return o===e||o!==o&&e!==e}function GT(o){return o!=null&&VT(o.length)&&!vx(o)}function YT(o){return $T(o)&>(o)}function vx(o){var e=xx(o)?pT.call(o):"";return e==JD||e==KD}function VT(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=WD}function xx(o){var e=typeof o;return!!o&&(e=="object"||e=="function")}function $T(o){return!!o&&typeof o=="object"}function WT(){}zx.exports=PT});var Al=y(wa=>{"use strict";var th=wa&&wa.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(wa,"__esModule",{value:!0});wa.toJsonSchema=oR;wa.convertRequiredToArray=ec;wa.generateDefaultFromSchema=oc;wa.parseJsonSafe=kl;wa.normalizeToolSchemas=tR;var Xp=th(Nv()),eh=th(ux()),JT=th(qx());function us(o,e){if(o===e)return!0;if(o===null||e===null||typeof o!="object"||typeof e!="object"||Array.isArray(o)!==Array.isArray(e))return!1;let t=Object.keys(o),a=Object.keys(e);if(t.length!==a.length)return!1;let i=e;return t.every(r=>r in i&&us(o[r],i[r]))}var KT={required:!1,requiredDepth:Number.POSITIVE_INFINITY,postProcessFnc:null,strings:{preProcessFnc:null},arrays:{mode:"all"},objects:{preProcessFnc:null,postProcessFnc:null,additionalProperties:!0}},ZT={string:function(e){return typeof e=="string"},number:function(e){return typeof e=="number"&&isFinite(e)},integer:function(e){return typeof e=="number"&&e%1===0},boolean:function(e){return typeof e=="boolean"},array:function(e){return e instanceof Array},null:function(e){return e===null},date:function(e){return e instanceof Date},any:function(e){return!0},object:function(e){return e&&typeof e=="object"&&!(e instanceof Array)&&!(e instanceof Date)}},ds={typeNames:["integer","number","string","array","object","boolean","null","date"],getType(o){return ds.typeNames.find(e=>ZT[e](o))},mergeSchemaObjs(o,e){if(!o||!e)return null;let t=(0,Xp.default)(o),a=(0,Xp.default)(e);if(!us(t,a)){if(o.type==="array"&&e.type==="array"&&us((0,JT.default)(t,a),["items"])){let r=t.length>a.length?e:o,s=t.length>a.length?o:e;if((0,Xp.default)(r).reduce((c,m)=>us(r[m],s[m])&&c,!0))return r}if(o.type!=="object"||e.type!=="object")return null}let i={};for(let r=0,{length:s}=t;r<s;r++){let n=t[r];if(ds.getType(o[n])==="object"){let c=ds.mergeSchemaObjs(o[n],e[n]);if(c)i[n]=c;else{if(o.type==="object"||e.type==="object")return{type:"object"};if(n!=="items"||o.type!=="array"||e.type!=="array")return null}}else if(n==="type")if(o[n]!==e[n])if(o[n]==="integer"&&e[n]==="number"||o[n]==="number"&&e[n]==="integer")i[n]="number";else return null;else i[n]=o[n];else{if(!us(o[n],e[n]))return null;i[n]=o[n]}}return i}};function XT(o){let e;for(let t=0,{length:a}=o;t<a;t++){let i=o[t];if(t>0&&(i==="integer"&&e==="number"?i="number":i==="number"&&e==="integer"&&(e="number"),e!==i))return null;e=i}return e}function eR(o){return XT(o.map(e=>ds.getType(e)))}var oh=class{constructor(e){this.options=(0,eh.default)({},KT,e),this.depth=0,this.getObjectSchemaDefault=this.getObjectSchemaDefault.bind(this),this.getStringSchemaDefault=this.getStringSchemaDefault.bind(this),this.objectPostProcessDefault=this.objectPostProcessDefault.bind(this),this.commmonPostProcessDefault=this.commmonPostProcessDefault.bind(this),this.objectPostProcessDefault=this.objectPostProcessDefault.bind(this)}getCommonArrayItemSchema(e){let t=e.map(a=>{this.depth++;let i=this.getSchema(a);return this.depth--,i});return t.reduce((a,i)=>ds.mergeSchemaObjs(a,i),t.pop())}getObjectSchemaDefault(e){let t={type:"object"},a=Object.keys(e);return a.length>0&&(t.properties=a.reduce((i,r)=>(this.depth++,i[r]=this.getSchema(e[r]),this.depth--,i),{})),t}getObjectSchema(e){return this.options.objects.preProcessFnc?this.options.objects.preProcessFnc(e,this.getObjectSchemaDefault):this.getObjectSchemaDefault(e)}getArraySchemaMerging(e){let t={type:"array"},a=eR(e);if(a)if(t.items={type:a},a!=="integer"&&a!=="number"){let i=this.getCommonArrayItemSchema(e);i&&(t.items=i)}else this.options.required&&(t.items.required=!0);return t}getArraySchemaNoMerging(e){let t={type:"array"};return e.length>0&&(this.depth++,t.items=this.getSchema(e[0]),this.depth--),t}getArraySchemaTuple(e){let t={type:"array"};return e.length>0&&(t.items=e.map(a=>{this.depth++;let i=this.getSchema(a);return this.depth--,i})),t}getArraySchemaUniform(e){let t=this.getArraySchemaNoMerging(e);if(e.length>1)for(let a=1;a<e.length;a++){this.depth++;let i=this.getSchema(e[a]);if(this.depth--,!us(t.items,i))throw new Error("Invalid schema, incompatible array items")}return t}getArraySchema(e){if(e.length===0)return{type:"array"};switch(this.options.arrays.mode){case"all":return this.getArraySchemaMerging(e);case"first":return this.getArraySchemaNoMerging(e);case"uniform":return this.getArraySchemaUniform(e);case"tuple":return this.getArraySchemaTuple(e);default:throw new Error(`Unknown array mode option '${this.options.arrays.mode}'`)}}getStringSchemaDefault(e){return{type:"string"}}getStringSchema(e){return this.options.strings.preProcessFnc?this.options.strings.preProcessFnc(e,this.getStringSchemaDefault):this.getStringSchemaDefault(e)}commmonPostProcessDefault(e,t,a){return this.options.required&&this.depth<=this.options.requiredDepth?(0,eh.default)({},t,{required:!0}):t}objectPostProcessDefault(e,t){return this.options.objects.additionalProperties===!1&&Object.getOwnPropertyNames(t).length>0?(0,eh.default)({},e,{additionalProperties:!1}):e}getSchema(e){let t=ds.getType(e);t||(t="null");let a;switch(t){case"object":a=this.getObjectSchema(e);break;case"array":a=this.getArraySchema(e);break;case"string":a=this.getStringSchema(e);break;default:a={type:t}}return this.options.postProcessFnc?a=this.options.postProcessFnc(t,a,e,this.commmonPostProcessDefault):a=this.commmonPostProcessDefault(t,a,e),t==="object"&&(this.options.objects.postProcessFnc?a=this.options.objects.postProcessFnc(a,e,this.objectPostProcessDefault):a=this.objectPostProcessDefault(a,e)),a}};function oR(o,e){return new oh(e).getSchema(o)}function ec(o){if(!o||typeof o!="object")return o;if(Array.isArray(o))return o.map(t=>ec(t));let e={...o};if(delete e.required,e.properties&&typeof e.properties=="object"){let t=[],a={};for(let[i,r]of Object.entries(e.properties)){let s=r;if(s&&typeof s=="object"&&s.required===!0){t.push(i);let{required:n,...c}=s;a[i]=ec(c)}else a[i]=ec(s)}e.properties=a,t.length>0&&(e.required=t)}return e.items&&(e.items=ec(e.items)),e}function oc(o){if(!o||typeof o!="object")return null;if(o.const!==void 0)return o.const;if(o.enum&&Array.isArray(o.enum)&&o.enum.length>0)return o.enum[0];if(o.default!==void 0)return o.default;if(o.oneOf&&Array.isArray(o.oneOf)&&o.oneOf.length>0)return oc(o.oneOf[0]);if(o.anyOf&&Array.isArray(o.anyOf)&&o.anyOf.length>0)return oc(o.anyOf[0]);switch(Array.isArray(o.type)?o.type[0]:o.type){case"string":case"number":case"integer":case"boolean":return null;case"null":return null;case"array":return o.items?[]:[];case"object":let t={};if(o.properties&&typeof o.properties=="object"){let a=o.required||[];for(let[i,r]of Object.entries(o.properties))t[i]=oc(r)}return t;default:if(o.properties&&typeof o.properties=="object"){let a={};for(let[i,r]of Object.entries(o.properties))a[i]=oc(r);return a}return null}}function kl(o){if(typeof o!="string")return o;try{return JSON.parse(o)}catch{return o}}function tR(o){let e={...o};return e.inputSchema&&(e.inputSchema=kl(e.inputSchema)),e.outputSchema&&(e.outputSchema=kl(e.outputSchema)),e.responseSchema&&(e.responseSchema=kl(e.responseSchema)),e}});var rt=y(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.PLAYBOOK_LIMITS=E.DEFAULT_PROJECT_ID=E.PROJECT_LIMITS=E.PROJECT_RESOURCE_TYPES=E.MCP_SERVER_AUTH_MODES=E.OAUTH_CONTINUATION_REASON_MAX_CHARS=E.AGENT_REQUEST_BUSY_STATUSES=E.AGENT_SESSION_RESOURCE_KINDS=E.AGENT_MESSAGE_SCHEMA_VERSION=E.AGENT_APPROVAL_MODES=E.ConfirmationAction=E.SKILL_GATED_TOOLS=E.LOADABLE_MARKDOWN_NAMES=E.SKILL_REFERENCE_NAMES=E.SKILL_BODY_NAMES=E.AGENT_CHECKLIST_MAX_LABEL_CHARS=E.AGENT_CHECKLIST_MAX_ITEMS=E.AGENT_CHECKLIST_MIN_ITEMS=E.DYNAMIC_AGENT_TOOLS=E.AGENT_TOOLS=E.AGENT_BASE_TOOLS=E.AGENT_GLOBAL_TOOLS=E.ARTIFACT_PROPOSAL_ID_PREFIX=E.ARTIFACT_PLAYGROUND_DRAFT_ID=E.PLAYBOOK_PLAYGROUND_DRAFT_ID=E.PLAYGROUND_TOOL_DRAFT_ID=E.AgentType=E.FileStatus=E.MAX_BULK_RESOURCE_SHARE_OPERATIONS=E.MAX_BULK_MUTATION_IDS=E.RunExecutionKind=E.RequestSource=E.RunStatus=E.CredentialMode=E.UpsertMode=E.LogLevel=E.PaginationType=E.DecompressionMethod=E.AuthType=E.FileType=E.CacheMode=E.HttpMethod=E.SupportedFileType=void 0;E.isRequestConfig=aR;E.isTransformConfig=iR;E.getDefaultProjectDisplayName=rR;E.projectResourceKey=gs;E.parseProjectResourceKey=sR;E.normalizeProjectResourceRefs=nR;E.uniqueProjectResourceRefs=cR;E.mergeProjectResourceRefs=mR;var Ex;(function(o){o.JSON="JSON",o.CSV="CSV",o.XML="XML",o.HTML="HTML",o.YAML="YAML",o.EXCEL="EXCEL",o.PDF="PDF",o.DOCX="DOCX",o.PPTX="PPTX",o.ZIP="ZIP",o.GZIP="GZIP",o.BINARY="BINARY",o.RAW="RAW",o.AUTO="AUTO"})(Ex||(E.SupportedFileType=Ex={}));var Ix;(function(o){o.GET="GET",o.POST="POST",o.PUT="PUT",o.DELETE="DELETE",o.PATCH="PATCH",o.HEAD="HEAD",o.OPTIONS="OPTIONS"})(Ix||(E.HttpMethod=Ix={}));var Cx;(function(o){o.ENABLED="ENABLED",o.READONLY="READONLY",o.WRITEONLY="WRITEONLY",o.DISABLED="DISABLED"})(Cx||(E.CacheMode=Cx={}));var jx;(function(o){o.CSV="CSV",o.JSON="JSON",o.XML="XML",o.YAML="YAML",o.EXCEL="EXCEL",o.HTML="HTML",o.PDF="PDF",o.DOCX="DOCX",o.PPTX="PPTX",o.ZIP="ZIP",o.BINARY="BINARY",o.RAW="RAW",o.AUTO="AUTO"})(jx||(E.FileType=jx={}));var Bx;(function(o){o.NONE="NONE",o.OAUTH2="OAUTH2",o.HEADER="HEADER",o.QUERY_PARAM="QUERY_PARAM"})(Bx||(E.AuthType=Bx={}));var Qx;(function(o){o.GZIP="GZIP",o.DEFLATE="DEFLATE",o.NONE="NONE",o.AUTO="AUTO",o.ZIP="ZIP"})(Qx||(E.DecompressionMethod=Qx={}));var Sx;(function(o){o.OFFSET_BASED="OFFSET_BASED",o.PAGE_BASED="PAGE_BASED",o.CURSOR_BASED="CURSOR_BASED",o.DISABLED="DISABLED"})(Sx||(E.PaginationType=Sx={}));var Dx;(function(o){o.DEBUG="DEBUG",o.INFO="INFO",o.WARN="WARN",o.ERROR="ERROR"})(Dx||(E.LogLevel=Dx={}));var Tx;(function(o){o.CREATE="CREATE",o.UPDATE="UPDATE",o.UPSERT="UPSERT"})(Tx||(E.UpsertMode=Tx={}));var Rx;(function(o){o.MERGE="MERGE",o.REPLACE="REPLACE"})(Rx||(E.CredentialMode=Rx={}));var Nx;(function(o){o.RUNNING="RUNNING",o.SUCCESS="SUCCESS",o.FAILED="FAILED",o.ABORTED="ABORTED"})(Nx||(E.RunStatus=Nx={}));var Ux;(function(o){o.API="api",o.FRONTEND="frontend",o.AGENT="agent",o.SCHEDULER="scheduler",o.MCP="mcp",o.TOOL_CHAIN="tool-chain",o.WEBHOOK="webhook",o.CLI="cli"})(Ux||(E.RequestSource=Ux={}));var Ox;(function(o){o.FULL="full",o.DRAFT="draft",o.SINGLE_STEP="single-step"})(Ox||(E.RunExecutionKind=Ox={}));E.MAX_BULK_MUTATION_IDS=100;E.MAX_BULK_RESOURCE_SHARE_OPERATIONS=1e3;function aR(o){return!o||typeof o!="object"?!1:o.type==="request"||!("type"in o)||o.type===void 0}function iR(o){return o?.type==="transform"}var Mx;(function(o){o.PENDING="PENDING",o.UPLOADING="UPLOADING",o.PROCESSING="PROCESSING",o.COMPLETED="COMPLETED",o.FAILED="FAILED"})(Mx||(E.FileStatus=Mx={}));var va;(function(o){o.MAIN="main",o.BACKGROUND_ARTIFACT="background_artifact",o.PLAYGROUND="playground",o.SYSTEM_PLAYGROUND="system_playground",o.PLAYBOOK_PLAYGROUND="playbook_playground",o.ARTIFACT_PLAYGROUND="artifact_playground",o.ACCESS_RULES="access_rules"})(va||(E.AgentType=va={}));E.PLAYGROUND_TOOL_DRAFT_ID="@playground-draft";E.PLAYBOOK_PLAYGROUND_DRAFT_ID="@playground-draft";E.ARTIFACT_PLAYGROUND_DRAFT_ID="@playground-draft";E.ARTIFACT_PROPOSAL_ID_PREFIX="artifact_proposal_";E.AGENT_GLOBAL_TOOLS=["run_command","load_skill"];E.AGENT_BASE_TOOLS=[...E.AGENT_GLOBAL_TOOLS,"call_system","run_tool","share_resource","use_checklist"];E.AGENT_TOOLS={[va.MAIN]:[...E.AGENT_BASE_TOOLS],[va.BACKGROUND_ARTIFACT]:["run_command","create_artifact"],[va.PLAYGROUND]:[...E.AGENT_BASE_TOOLS,"edit_tool"],[va.SYSTEM_PLAYGROUND]:[...E.AGENT_GLOBAL_TOOLS,"call_system","create_system","edit_system","set_credentials","authenticate_oauth","share_resource","use_checklist"],[va.PLAYBOOK_PLAYGROUND]:[...E.AGENT_GLOBAL_TOOLS,"call_system","run_tool","create_playbook","edit_playbook","save_playbook","share_resource","use_checklist"],[va.ARTIFACT_PLAYGROUND]:[...E.AGENT_BASE_TOOLS],[va.ACCESS_RULES]:[...E.AGENT_GLOBAL_TOOLS,"create_role","edit_role","use_checklist"]};E.DYNAMIC_AGENT_TOOLS=["web_search"];E.AGENT_CHECKLIST_MIN_ITEMS=4;E.AGENT_CHECKLIST_MAX_ITEMS=15;E.AGENT_CHECKLIST_MAX_LABEL_CHARS=120;E.SKILL_BODY_NAMES=["superglue-info","tool-building","tool-editing","system-setup","access-management","tool-deployment","notifications","artifacts","playbooks","projects","file-handling","superglue-brain","email","workspace-apps","meetings"];E.SKILL_REFERENCE_NAMES=["http","graphql","postgres","mssql","odbc","redis","mongodb","sftp-smb","file-runtime","tunnel-handling"];E.LOADABLE_MARKDOWN_NAMES=[...E.SKILL_BODY_NAMES,...E.SKILL_REFERENCE_NAMES];E.SKILL_GATED_TOOLS={"tool-building":["build_tool","set_tool_state"],"tool-editing":["edit_tool","save_tool","set_tool_state"],"system-setup":["create_system","edit_system","set_credentials","authenticate_oauth"],"tool-deployment":["create_schedule","edit_schedule","create_mcp_server","edit_mcp_server","show_mcp_server"],"access-management":["create_role","edit_role","share_resource"],playbooks:["create_playbook","edit_playbook"],projects:["create_project","edit_project"],artifacts:["create_artifact","start_background_agent","edit_artifact"]};var _x;(function(o){o.CONFIRMED="confirmed",o.CONFIRMED_AND_SAVE="confirmed_and_save",o.DECLINED="declined",o.OAUTH_SUCCESS="oauth_success",o.OAUTH_FAILURE="oauth_failure"})(_x||(E.ConfirmationAction=_x={}));E.AGENT_APPROVAL_MODES=["ask","act"];E.AGENT_MESSAGE_SCHEMA_VERSION=1;E.AGENT_SESSION_RESOURCE_KINDS=["tool","system","playbook","artifact"];E.AGENT_REQUEST_BUSY_STATUSES=["queued","claimed","running","cancelling"];E.OAUTH_CONTINUATION_REASON_MAX_CHARS=500;E.MCP_SERVER_AUTH_MODES=["oauth","creator_api_key"];E.PROJECT_RESOURCE_TYPES=["system","playbook","artifact","file","tool"];E.PROJECT_LIMITS={name:80,description:500};E.DEFAULT_PROJECT_ID="default";function rR(o){return o.trim()||"Your workspace"}function gs(o){return`${o.type}:${o.id}`}function sR(o){let e=o.indexOf(":");return{type:o.slice(0,e),id:o.slice(e+1)}}function nR({value:o,field:e="resourceRefs"}){if(o===void 0)return{refs:[]};if(!Array.isArray(o))return{error:`${e} must be an array`};let t=[],a=new Set;for(let[i,r]of o.entries()){if(!r||typeof r!="object"||Array.isArray(r))return{error:`${e}[${i}] must be shaped as { type, id }`};let s=r,n=typeof s.type=="string"?s.type.trim():"",c=typeof s.id=="string"?s.id.trim():"";if(!E.PROJECT_RESOURCE_TYPES.includes(n))return{error:`${e}[${i}].type is unsupported`};if(!c||c.length>255)return{error:`${e}[${i}].id must contain between 1 and 255 characters`};let m={type:n,id:c},l=gs(m);a.has(l)||t.push(m),a.add(l)}return{refs:t}}function cR(o){return[...new Map(o.map(e=>[gs(e),e])).values()]}function mR({current:o,add:e,remove:t}){let a=new Map(o.map(i=>[gs(i),i]));for(let i of t)a.delete(gs(i));for(let i of e)a.set(gs(i),i);return[...a.values()]}E.PLAYBOOK_LIMITS={name:120,whenToRun:500,inputs:2e3,instructions:8e3,completionCriteria:2e3,systemRefs:10,toolRefs:25,credentialRefs:10,fileRefs:15,compiledRender:24e3}});var lR,Fx,Lx,uR,dR,gR,pR,Px=he(()=>{"use strict";lR=o=>{let e=Lx(o,0);if(e===void 0||!dR(o[e]))return;let t=Lx(o,e+1);if(t!==void 0)return gR(o,e,t)},Fx=lR,Lx=(o,e)=>{for(let t=e;t<o.length;t+=1){let a=o[t];if(!uR(a))return t}},uR=o=>o===" "||o===" "||o===`
|
|
2
|
+
"use strict";var QS=Object.create;var nl=Object.defineProperty;var SS=Object.getOwnPropertyDescriptor;var DS=Object.getOwnPropertyNames;var TS=Object.getPrototypeOf,RS=Object.prototype.hasOwnProperty;var he=(o,e)=>()=>(o&&(e=o(o=0)),e);var y=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports),Bv=(o,e)=>{for(var t in e)nl(o,t,{get:e[t],enumerable:!0})},Qv=(o,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of DS(e))!RS.call(o,i)&&i!==t&&nl(o,i,{get:()=>e[i],enumerable:!(a=SS(e,i))||a.enumerable});return o};var W=(o,e,t)=>(t=o!=null?QS(TS(o)):{},Qv(e||!o||!o.__esModule?nl(t,"default",{value:o,enumerable:!0}):t,o)),Rp=o=>Qv(nl({},"__esModule",{value:!0}),o);var Nv=y((Ile,Rv)=>{"use strict";var Sv=9007199254740991,NS="[object Arguments]",US="[object Function]",OS="[object GeneratorFunction]",MS=/^(?:0|[1-9]\d*)$/;function _S(o,e){for(var t=-1,a=Array(o);++t<o;)a[t]=e(t);return a}function LS(o,e){return function(t){return o(e(t))}}var cl=Object.prototype,Np=cl.hasOwnProperty,Dv=cl.toString,FS=cl.propertyIsEnumerable,PS=LS(Object.keys,Object);function HS(o,e){var t=WS(o)||$S(o)?_S(o.length,String):[],a=t.length,i=!!a;for(var r in o)(e||Np.call(o,r))&&!(i&&(r=="length"||YS(r,a)))&&t.push(r);return t}function GS(o){if(!VS(o))return PS(o);var e=[];for(var t in Object(o))Np.call(o,t)&&t!="constructor"&&e.push(t);return e}function YS(o,e){return e=e??Sv,!!e&&(typeof o=="number"||MS.test(o))&&o>-1&&o%1==0&&o<e}function VS(o){var e=o&&o.constructor,t=typeof e=="function"&&e.prototype||cl;return o===t}function $S(o){return JS(o)&&Np.call(o,"callee")&&(!FS.call(o,"callee")||Dv.call(o)==NS)}var WS=Array.isArray;function Tv(o){return o!=null&&ZS(o.length)&&!KS(o)}function JS(o){return e7(o)&&Tv(o)}function KS(o){var e=XS(o)?Dv.call(o):"";return e==US||e==OS}function ZS(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=Sv}function XS(o){var e=typeof o;return!!o&&(e=="object"||e=="function")}function e7(o){return!!o&&typeof o=="object"}function o7(o){return Tv(o)?HS(o):GS(o)}Rv.exports=o7});var ux=y((Vn,ss)=>{"use strict";var t7=200,Yv="__lodash_hash_undefined__",a7=800,i7=16,Vv=9007199254740991,$v="[object Arguments]",r7="[object Array]",s7="[object AsyncFunction]",n7="[object Boolean]",c7="[object Date]",m7="[object Error]",Wv="[object Function]",l7="[object GeneratorFunction]",u7="[object Map]",d7="[object Number]",g7="[object Null]",Jv="[object Object]",p7="[object Proxy]",h7="[object RegExp]",f7="[object Set]",b7="[object String]",y7="[object Undefined]",k7="[object WeakMap]",A7="[object ArrayBuffer]",w7="[object DataView]",v7="[object Float32Array]",x7="[object Float64Array]",z7="[object Int8Array]",q7="[object Int16Array]",E7="[object Int32Array]",I7="[object Uint8Array]",C7="[object Uint8ClampedArray]",j7="[object Uint16Array]",B7="[object Uint32Array]",Q7=/[\\^$.*+?()[\]{}|]/g,S7=/^\[object .+?Constructor\]$/,D7=/^(?:0|[1-9]\d*)$/,ke={};ke[v7]=ke[x7]=ke[z7]=ke[q7]=ke[E7]=ke[I7]=ke[C7]=ke[j7]=ke[B7]=!0;ke[$v]=ke[r7]=ke[A7]=ke[n7]=ke[w7]=ke[c7]=ke[m7]=ke[Wv]=ke[u7]=ke[d7]=ke[Jv]=ke[h7]=ke[f7]=ke[b7]=ke[k7]=!1;var Kv=typeof global=="object"&&global&&global.Object===Object&&global,T7=typeof self=="object"&&self&&self.Object===Object&&self,Jn=Kv||T7||Function("return this")(),Zv=typeof Vn=="object"&&Vn&&!Vn.nodeType&&Vn,$n=Zv&&typeof ss=="object"&&ss&&!ss.nodeType&&ss,Xv=$n&&$n.exports===Zv,Up=Xv&&Kv.process,Uv=(function(){try{var o=$n&&$n.require&&$n.require("util").types;return o||Up&&Up.binding&&Up.binding("util")}catch{}})(),Ov=Uv&&Uv.isTypedArray;function R7(o,e,t){switch(t.length){case 0:return o.call(e);case 1:return o.call(e,t[0]);case 2:return o.call(e,t[0],t[1]);case 3:return o.call(e,t[0],t[1],t[2])}return o.apply(e,t)}function N7(o,e){for(var t=-1,a=Array(o);++t<o;)a[t]=e(t);return a}function U7(o){return function(e){return o(e)}}function O7(o,e){return o?.[e]}function M7(o,e){return function(t){return o(e(t))}}var _7=Array.prototype,L7=Function.prototype,ul=Object.prototype,Op=Jn["__core-js_shared__"],dl=L7.toString,ka=ul.hasOwnProperty,Mv=(function(){var o=/[^.]+$/.exec(Op&&Op.keys&&Op.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""})(),ex=ul.toString,F7=dl.call(Object),P7=RegExp("^"+dl.call(ka).replace(Q7,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ml=Xv?Jn.Buffer:void 0,_v=Jn.Symbol,Lv=Jn.Uint8Array,Fv=ml?ml.allocUnsafe:void 0,ox=M7(Object.getPrototypeOf,Object),Pv=Object.create,H7=ul.propertyIsEnumerable,G7=_7.splice,Ki=_v?_v.toStringTag:void 0,ll=(function(){try{var o=Hp(Object,"defineProperty");return o({},"",{}),o}catch{}})(),Y7=ml?ml.isBuffer:void 0,Hv=Math.max,V7=Date.now,tx=Hp(Jn,"Map"),Wn=Hp(Object,"create"),$7=(function(){function o(){}return function(e){if(!Xi(e))return{};if(Pv)return Pv(e);o.prototype=e;var t=new o;return o.prototype=void 0,t}})();function Zi(o){var e=-1,t=o==null?0:o.length;for(this.clear();++e<t;){var a=o[e];this.set(a[0],a[1])}}function W7(){this.__data__=Wn?Wn(null):{},this.size=0}function J7(o){var e=this.has(o)&&delete this.__data__[o];return this.size-=e?1:0,e}function K7(o){var e=this.__data__;if(Wn){var t=e[o];return t===Yv?void 0:t}return ka.call(e,o)?e[o]:void 0}function Z7(o){var e=this.__data__;return Wn?e[o]!==void 0:ka.call(e,o)}function X7(o,e){var t=this.__data__;return this.size+=this.has(o)?0:1,t[o]=Wn&&e===void 0?Yv:e,this}Zi.prototype.clear=W7;Zi.prototype.delete=J7;Zi.prototype.get=K7;Zi.prototype.has=Z7;Zi.prototype.set=X7;function Aa(o){var e=-1,t=o==null?0:o.length;for(this.clear();++e<t;){var a=o[e];this.set(a[0],a[1])}}function eD(){this.__data__=[],this.size=0}function oD(o){var e=this.__data__,t=gl(e,o);if(t<0)return!1;var a=e.length-1;return t==a?e.pop():G7.call(e,t,1),--this.size,!0}function tD(o){var e=this.__data__,t=gl(e,o);return t<0?void 0:e[t][1]}function aD(o){return gl(this.__data__,o)>-1}function iD(o,e){var t=this.__data__,a=gl(t,o);return a<0?(++this.size,t.push([o,e])):t[a][1]=e,this}Aa.prototype.clear=eD;Aa.prototype.delete=oD;Aa.prototype.get=tD;Aa.prototype.has=aD;Aa.prototype.set=iD;function ns(o){var e=-1,t=o==null?0:o.length;for(this.clear();++e<t;){var a=o[e];this.set(a[0],a[1])}}function rD(){this.size=0,this.__data__={hash:new Zi,map:new(tx||Aa),string:new Zi}}function sD(o){var e=hl(this,o).delete(o);return this.size-=e?1:0,e}function nD(o){return hl(this,o).get(o)}function cD(o){return hl(this,o).has(o)}function mD(o,e){var t=hl(this,o),a=t.size;return t.set(o,e),this.size+=t.size==a?0:1,this}ns.prototype.clear=rD;ns.prototype.delete=sD;ns.prototype.get=nD;ns.prototype.has=cD;ns.prototype.set=mD;function cs(o){var e=this.__data__=new Aa(o);this.size=e.size}function lD(){this.__data__=new Aa,this.size=0}function uD(o){var e=this.__data__,t=e.delete(o);return this.size=e.size,t}function dD(o){return this.__data__.get(o)}function gD(o){return this.__data__.has(o)}function pD(o,e){var t=this.__data__;if(t instanceof Aa){var a=t.__data__;if(!tx||a.length<t7-1)return a.push([o,e]),this.size=++t.size,this;t=this.__data__=new ns(a)}return t.set(o,e),this.size=t.size,this}cs.prototype.clear=lD;cs.prototype.delete=uD;cs.prototype.get=dD;cs.prototype.has=gD;cs.prototype.set=pD;function hD(o,e){var t=Fp(o),a=!t&&Lp(o),i=!t&&!a&&sx(o),r=!t&&!a&&!i&&cx(o),s=t||a||i||r,n=s?N7(o.length,String):[],c=n.length;for(var m in o)(e||ka.call(o,m))&&!(s&&(m=="length"||i&&(m=="offset"||m=="parent")||r&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||ix(m,c)))&&n.push(m);return n}function Mp(o,e,t){(t!==void 0&&!fl(o[e],t)||t===void 0&&!(e in o))&&Pp(o,e,t)}function fD(o,e,t){var a=o[e];(!(ka.call(o,e)&&fl(a,t))||t===void 0&&!(e in o))&&Pp(o,e,t)}function gl(o,e){for(var t=o.length;t--;)if(fl(o[t][0],e))return t;return-1}function Pp(o,e,t){e=="__proto__"&&ll?ll(o,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):o[e]=t}var bD=BD();function pl(o){return o==null?o===void 0?y7:g7:Ki&&Ki in Object(o)?QD(o):UD(o)}function Gv(o){return Kn(o)&&pl(o)==$v}function yD(o){if(!Xi(o)||RD(o))return!1;var e=Yp(o)?P7:S7;return e.test(LD(o))}function kD(o){return Kn(o)&&nx(o.length)&&!!ke[pl(o)]}function AD(o){if(!Xi(o))return ND(o);var e=rx(o),t=[];for(var a in o)a=="constructor"&&(e||!ka.call(o,a))||t.push(a);return t}function ax(o,e,t,a,i){o!==e&&bD(e,function(r,s){if(i||(i=new cs),Xi(r))wD(o,e,s,t,ax,a,i);else{var n=a?a(_p(o,s),r,s+"",o,e,i):void 0;n===void 0&&(n=r),Mp(o,s,n)}},mx)}function wD(o,e,t,a,i,r,s){var n=_p(o,t),c=_p(e,t),m=s.get(c);if(m){Mp(o,t,m);return}var l=r?r(n,c,t+"",o,e,s):void 0,u=l===void 0;if(u){var d=Fp(c),g=!d&&sx(c),p=!d&&!g&&cx(c);l=c,d||g||p?Fp(n)?l=n:FD(n)?l=ID(n):g?(u=!1,l=zD(c,!0)):p?(u=!1,l=ED(c,!0)):l=[]:PD(c)||Lp(c)?(l=n,Lp(n)?l=HD(n):(!Xi(n)||Yp(n))&&(l=SD(c))):u=!1}u&&(s.set(c,l),i(l,c,a,r,s),s.delete(c)),Mp(o,t,l)}function vD(o,e){return MD(OD(o,e,lx),o+"")}var xD=ll?function(o,e){return ll(o,"toString",{configurable:!0,enumerable:!1,value:YD(e),writable:!0})}:lx;function zD(o,e){if(e)return o.slice();var t=o.length,a=Fv?Fv(t):new o.constructor(t);return o.copy(a),a}function qD(o){var e=new o.constructor(o.byteLength);return new Lv(e).set(new Lv(o)),e}function ED(o,e){var t=e?qD(o.buffer):o.buffer;return new o.constructor(t,o.byteOffset,o.length)}function ID(o,e){var t=-1,a=o.length;for(e||(e=Array(a));++t<a;)e[t]=o[t];return e}function CD(o,e,t,a){var i=!t;t||(t={});for(var r=-1,s=e.length;++r<s;){var n=e[r],c=a?a(t[n],o[n],n,t,o):void 0;c===void 0&&(c=o[n]),i?Pp(t,n,c):fD(t,n,c)}return t}function jD(o){return vD(function(e,t){var a=-1,i=t.length,r=i>1?t[i-1]:void 0,s=i>2?t[2]:void 0;for(r=o.length>3&&typeof r=="function"?(i--,r):void 0,s&&DD(t[0],t[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++a<i;){var n=t[a];n&&o(e,n,a,r)}return e})}function BD(o){return function(e,t,a){for(var i=-1,r=Object(e),s=a(e),n=s.length;n--;){var c=s[o?n:++i];if(t(r[c],c,r)===!1)break}return e}}function hl(o,e){var t=o.__data__;return TD(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Hp(o,e){var t=O7(o,e);return yD(t)?t:void 0}function QD(o){var e=ka.call(o,Ki),t=o[Ki];try{o[Ki]=void 0;var a=!0}catch{}var i=ex.call(o);return a&&(e?o[Ki]=t:delete o[Ki]),i}function SD(o){return typeof o.constructor=="function"&&!rx(o)?$7(ox(o)):{}}function ix(o,e){var t=typeof o;return e=e??Vv,!!e&&(t=="number"||t!="symbol"&&D7.test(o))&&o>-1&&o%1==0&&o<e}function DD(o,e,t){if(!Xi(t))return!1;var a=typeof e;return(a=="number"?Gp(t)&&ix(e,t.length):a=="string"&&e in t)?fl(t[e],o):!1}function TD(o){var e=typeof o;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?o!=="__proto__":o===null}function RD(o){return!!Mv&&Mv in o}function rx(o){var e=o&&o.constructor,t=typeof e=="function"&&e.prototype||ul;return o===t}function ND(o){var e=[];if(o!=null)for(var t in Object(o))e.push(t);return e}function UD(o){return ex.call(o)}function OD(o,e,t){return e=Hv(e===void 0?o.length-1:e,0),function(){for(var a=arguments,i=-1,r=Hv(a.length-e,0),s=Array(r);++i<r;)s[i]=a[e+i];i=-1;for(var n=Array(e+1);++i<e;)n[i]=a[i];return n[e]=t(s),R7(o,this,n)}}function _p(o,e){if(!(e==="constructor"&&typeof o[e]=="function")&&e!="__proto__")return o[e]}var MD=_D(xD);function _D(o){var e=0,t=0;return function(){var a=V7(),i=i7-(a-t);if(t=a,i>0){if(++e>=a7)return arguments[0]}else e=0;return o.apply(void 0,arguments)}}function LD(o){if(o!=null){try{return dl.call(o)}catch{}try{return o+""}catch{}}return""}function fl(o,e){return o===e||o!==o&&e!==e}var Lp=Gv((function(){return arguments})())?Gv:function(o){return Kn(o)&&ka.call(o,"callee")&&!H7.call(o,"callee")},Fp=Array.isArray;function Gp(o){return o!=null&&nx(o.length)&&!Yp(o)}function FD(o){return Kn(o)&&Gp(o)}var sx=Y7||VD;function Yp(o){if(!Xi(o))return!1;var e=pl(o);return e==Wv||e==l7||e==s7||e==p7}function nx(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=Vv}function Xi(o){var e=typeof o;return o!=null&&(e=="object"||e=="function")}function Kn(o){return o!=null&&typeof o=="object"}function PD(o){if(!Kn(o)||pl(o)!=Jv)return!1;var e=ox(o);if(e===null)return!0;var t=ka.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&dl.call(t)==F7}var cx=Ov?U7(Ov):kD;function HD(o){return CD(o,mx(o))}function mx(o){return Gp(o)?hD(o,!0):AD(o)}var GD=jD(function(o,e,t){ax(o,e,t)});function YD(o){return function(){return o}}function lx(o){return o}function VD(){return!1}ss.exports=GD});var qx=y((Cle,zx)=>{"use strict";var hx=200,Wp="__lodash_hash_undefined__",$D=1/0,WD=9007199254740991,JD="[object Function]",KD="[object GeneratorFunction]",ZD=/[\\^$.*+?()[\]{}|]/g,XD=/^\[object .+?Constructor\]$/,eT=typeof global=="object"&&global&&global.Object===Object&&global,oT=typeof self=="object"&&self&&self.Object===Object&&self,Jp=eT||oT||Function("return this")();function tT(o,e,t){switch(t.length){case 0:return o.call(e);case 1:return o.call(e,t[0]);case 2:return o.call(e,t[0],t[1]);case 3:return o.call(e,t[0],t[1],t[2])}return o.apply(e,t)}function aT(o,e){for(var t=-1,a=o?o.length:0,i=0,r=[];++t<a;){var s=o[t];e(s,t,o)&&(r[i++]=s)}return r}function fx(o,e){var t=o?o.length:0;return!!t&&nT(o,e,0)>-1}function bx(o,e,t){for(var a=-1,i=o?o.length:0;++a<i;)if(t(e,o[a]))return!0;return!1}function iT(o,e){for(var t=-1,a=o?o.length:0,i=Array(a);++t<a;)i[t]=e(o[t],t,o);return i}function rT(o,e){for(var t=-1,a=e.length,i=o.length;++t<a;)o[i+t]=e[t];return o}function sT(o,e,t,a){for(var i=o.length,r=t+(a?1:-1);a?r--:++r<i;)if(e(o[r],r,o))return r;return-1}function nT(o,e,t){if(e!==e)return sT(o,cT,t);for(var a=t-1,i=o.length;++a<i;)if(o[a]===e)return a;return-1}function cT(o){return o!==o}function mT(o){return function(e){return o(e)}}function yx(o,e){return o.has(e)}function lT(o,e){return o?.[e]}function uT(o){var e=!1;if(o!=null&&typeof o.toString!="function")try{e=!!(o+"")}catch{}return e}function kx(o){var e=-1,t=Array(o.size);return o.forEach(function(a){t[++e]=a}),t}var dT=Array.prototype,gT=Function.prototype,Ax=Object.prototype,Vp=Jp["__core-js_shared__"],dx=(function(){var o=/[^.]+$/.exec(Vp&&Vp.keys&&Vp.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""})(),wx=gT.toString,Kp=Ax.hasOwnProperty,pT=Ax.toString,hT=RegExp("^"+wx.call(Kp).replace(ZD,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),fT=dT.splice,gx=Math.max,bT=Zp(Jp,"Map"),$p=Zp(Jp,"Set"),Zn=Zp(Object,"create");function er(o){var e=-1,t=o?o.length:0;for(this.clear();++e<t;){var a=o[e];this.set(a[0],a[1])}}function yT(){this.__data__=Zn?Zn(null):{}}function kT(o){return this.has(o)&&delete this.__data__[o]}function AT(o){var e=this.__data__;if(Zn){var t=e[o];return t===Wp?void 0:t}return Kp.call(e,o)?e[o]:void 0}function wT(o){var e=this.__data__;return Zn?e[o]!==void 0:Kp.call(e,o)}function vT(o,e){var t=this.__data__;return t[o]=Zn&&e===void 0?Wp:e,this}er.prototype.clear=yT;er.prototype.delete=kT;er.prototype.get=AT;er.prototype.has=wT;er.prototype.set=vT;function ms(o){var e=-1,t=o?o.length:0;for(this.clear();++e<t;){var a=o[e];this.set(a[0],a[1])}}function xT(){this.__data__=[]}function zT(o){var e=this.__data__,t=bl(e,o);if(t<0)return!1;var a=e.length-1;return t==a?e.pop():fT.call(e,t,1),!0}function qT(o){var e=this.__data__,t=bl(e,o);return t<0?void 0:e[t][1]}function ET(o){return bl(this.__data__,o)>-1}function IT(o,e){var t=this.__data__,a=bl(t,o);return a<0?t.push([o,e]):t[a][1]=e,this}ms.prototype.clear=xT;ms.prototype.delete=zT;ms.prototype.get=qT;ms.prototype.has=ET;ms.prototype.set=IT;function ls(o){var e=-1,t=o?o.length:0;for(this.clear();++e<t;){var a=o[e];this.set(a[0],a[1])}}function CT(){this.__data__={hash:new er,map:new(bT||ms),string:new er}}function jT(o){return yl(this,o).delete(o)}function BT(o){return yl(this,o).get(o)}function QT(o){return yl(this,o).has(o)}function ST(o,e){return yl(this,o).set(o,e),this}ls.prototype.clear=CT;ls.prototype.delete=jT;ls.prototype.get=BT;ls.prototype.has=QT;ls.prototype.set=ST;function Xn(o){var e=-1,t=o?o.length:0;for(this.__data__=new ls;++e<t;)this.add(o[e])}function DT(o){return this.__data__.set(o,Wp),this}function TT(o){return this.__data__.has(o)}Xn.prototype.add=Xn.prototype.push=DT;Xn.prototype.has=TT;function bl(o,e){for(var t=o.length;t--;)if(HT(o[t][0],e))return t;return-1}function px(o,e,t,a){var i=-1,r=fx,s=!0,n=o.length,c=[],m=e.length;if(!n)return c;t&&(e=iT(e,mT(t))),a?(r=bx,s=!1):e.length>=hx&&(r=yx,s=!1,e=new Xn(e));e:for(;++i<n;){var l=o[i],u=t?t(l):l;if(l=a||l!==0?l:0,s&&u===u){for(var d=m;d--;)if(e[d]===u)continue e;c.push(l)}else r(e,u,a)||c.push(l)}return c}function RT(o){if(!xx(o)||LT(o))return!1;var e=vx(o)||uT(o)?hT:XD;return e.test(FT(o))}function NT(o,e){return e=gx(e===void 0?o.length-1:e,0),function(){for(var t=arguments,a=-1,i=gx(t.length-e,0),r=Array(i);++a<i;)r[a]=t[e+a];a=-1;for(var s=Array(e+1);++a<e;)s[a]=t[a];return s[e]=r,tT(o,this,s)}}function UT(o,e,t){var a=-1,i=fx,r=o.length,s=!0,n=[],c=n;if(t)s=!1,i=bx;else if(r>=hx){var m=e?null:MT(o);if(m)return kx(m);s=!1,i=yx,c=new Xn}else c=e?[]:n;e:for(;++a<r;){var l=o[a],u=e?e(l):l;if(l=t||l!==0?l:0,s&&u===u){for(var d=c.length;d--;)if(c[d]===u)continue e;e&&c.push(u),n.push(l)}else i(c,u,t)||(c!==n&&c.push(u),n.push(l))}return n}function OT(o,e,t){for(var a=-1,i=o.length;++a<i;)var r=r?rT(px(r,o[a],e,t),px(o[a],r,e,t)):o[a];return r&&r.length?UT(r,e,t):[]}var MT=$p&&1/kx(new $p([,-0]))[1]==$D?function(o){return new $p(o)}:WT;function yl(o,e){var t=o.__data__;return _T(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Zp(o,e){var t=lT(o,e);return RT(t)?t:void 0}function _T(o){var e=typeof o;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?o!=="__proto__":o===null}function LT(o){return!!dx&&dx in o}function FT(o){if(o!=null){try{return wx.call(o)}catch{}try{return o+""}catch{}}return""}var PT=NT(function(o){return OT(aT(o,YT))});function HT(o,e){return o===e||o!==o&&e!==e}function GT(o){return o!=null&&VT(o.length)&&!vx(o)}function YT(o){return $T(o)&>(o)}function vx(o){var e=xx(o)?pT.call(o):"";return e==JD||e==KD}function VT(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=WD}function xx(o){var e=typeof o;return!!o&&(e=="object"||e=="function")}function $T(o){return!!o&&typeof o=="object"}function WT(){}zx.exports=PT});var Al=y(wa=>{"use strict";var th=wa&&wa.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(wa,"__esModule",{value:!0});wa.toJsonSchema=oR;wa.convertRequiredToArray=ec;wa.generateDefaultFromSchema=oc;wa.parseJsonSafe=kl;wa.normalizeToolSchemas=tR;var Xp=th(Nv()),eh=th(ux()),JT=th(qx());function us(o,e){if(o===e)return!0;if(o===null||e===null||typeof o!="object"||typeof e!="object"||Array.isArray(o)!==Array.isArray(e))return!1;let t=Object.keys(o),a=Object.keys(e);if(t.length!==a.length)return!1;let i=e;return t.every(r=>r in i&&us(o[r],i[r]))}var KT={required:!1,requiredDepth:Number.POSITIVE_INFINITY,postProcessFnc:null,strings:{preProcessFnc:null},arrays:{mode:"all"},objects:{preProcessFnc:null,postProcessFnc:null,additionalProperties:!0}},ZT={string:function(e){return typeof e=="string"},number:function(e){return typeof e=="number"&&isFinite(e)},integer:function(e){return typeof e=="number"&&e%1===0},boolean:function(e){return typeof e=="boolean"},array:function(e){return e instanceof Array},null:function(e){return e===null},date:function(e){return e instanceof Date},any:function(e){return!0},object:function(e){return e&&typeof e=="object"&&!(e instanceof Array)&&!(e instanceof Date)}},ds={typeNames:["integer","number","string","array","object","boolean","null","date"],getType(o){return ds.typeNames.find(e=>ZT[e](o))},mergeSchemaObjs(o,e){if(!o||!e)return null;let t=(0,Xp.default)(o),a=(0,Xp.default)(e);if(!us(t,a)){if(o.type==="array"&&e.type==="array"&&us((0,JT.default)(t,a),["items"])){let r=t.length>a.length?e:o,s=t.length>a.length?o:e;if((0,Xp.default)(r).reduce((c,m)=>us(r[m],s[m])&&c,!0))return r}if(o.type!=="object"||e.type!=="object")return null}let i={};for(let r=0,{length:s}=t;r<s;r++){let n=t[r];if(ds.getType(o[n])==="object"){let c=ds.mergeSchemaObjs(o[n],e[n]);if(c)i[n]=c;else{if(o.type==="object"||e.type==="object")return{type:"object"};if(n!=="items"||o.type!=="array"||e.type!=="array")return null}}else if(n==="type")if(o[n]!==e[n])if(o[n]==="integer"&&e[n]==="number"||o[n]==="number"&&e[n]==="integer")i[n]="number";else return null;else i[n]=o[n];else{if(!us(o[n],e[n]))return null;i[n]=o[n]}}return i}};function XT(o){let e;for(let t=0,{length:a}=o;t<a;t++){let i=o[t];if(t>0&&(i==="integer"&&e==="number"?i="number":i==="number"&&e==="integer"&&(e="number"),e!==i))return null;e=i}return e}function eR(o){return XT(o.map(e=>ds.getType(e)))}var oh=class{constructor(e){this.options=(0,eh.default)({},KT,e),this.depth=0,this.getObjectSchemaDefault=this.getObjectSchemaDefault.bind(this),this.getStringSchemaDefault=this.getStringSchemaDefault.bind(this),this.objectPostProcessDefault=this.objectPostProcessDefault.bind(this),this.commmonPostProcessDefault=this.commmonPostProcessDefault.bind(this),this.objectPostProcessDefault=this.objectPostProcessDefault.bind(this)}getCommonArrayItemSchema(e){let t=e.map(a=>{this.depth++;let i=this.getSchema(a);return this.depth--,i});return t.reduce((a,i)=>ds.mergeSchemaObjs(a,i),t.pop())}getObjectSchemaDefault(e){let t={type:"object"},a=Object.keys(e);return a.length>0&&(t.properties=a.reduce((i,r)=>(this.depth++,i[r]=this.getSchema(e[r]),this.depth--,i),{})),t}getObjectSchema(e){return this.options.objects.preProcessFnc?this.options.objects.preProcessFnc(e,this.getObjectSchemaDefault):this.getObjectSchemaDefault(e)}getArraySchemaMerging(e){let t={type:"array"},a=eR(e);if(a)if(t.items={type:a},a!=="integer"&&a!=="number"){let i=this.getCommonArrayItemSchema(e);i&&(t.items=i)}else this.options.required&&(t.items.required=!0);return t}getArraySchemaNoMerging(e){let t={type:"array"};return e.length>0&&(this.depth++,t.items=this.getSchema(e[0]),this.depth--),t}getArraySchemaTuple(e){let t={type:"array"};return e.length>0&&(t.items=e.map(a=>{this.depth++;let i=this.getSchema(a);return this.depth--,i})),t}getArraySchemaUniform(e){let t=this.getArraySchemaNoMerging(e);if(e.length>1)for(let a=1;a<e.length;a++){this.depth++;let i=this.getSchema(e[a]);if(this.depth--,!us(t.items,i))throw new Error("Invalid schema, incompatible array items")}return t}getArraySchema(e){if(e.length===0)return{type:"array"};switch(this.options.arrays.mode){case"all":return this.getArraySchemaMerging(e);case"first":return this.getArraySchemaNoMerging(e);case"uniform":return this.getArraySchemaUniform(e);case"tuple":return this.getArraySchemaTuple(e);default:throw new Error(`Unknown array mode option '${this.options.arrays.mode}'`)}}getStringSchemaDefault(e){return{type:"string"}}getStringSchema(e){return this.options.strings.preProcessFnc?this.options.strings.preProcessFnc(e,this.getStringSchemaDefault):this.getStringSchemaDefault(e)}commmonPostProcessDefault(e,t,a){return this.options.required&&this.depth<=this.options.requiredDepth?(0,eh.default)({},t,{required:!0}):t}objectPostProcessDefault(e,t){return this.options.objects.additionalProperties===!1&&Object.getOwnPropertyNames(t).length>0?(0,eh.default)({},e,{additionalProperties:!1}):e}getSchema(e){let t=ds.getType(e);t||(t="null");let a;switch(t){case"object":a=this.getObjectSchema(e);break;case"array":a=this.getArraySchema(e);break;case"string":a=this.getStringSchema(e);break;default:a={type:t}}return this.options.postProcessFnc?a=this.options.postProcessFnc(t,a,e,this.commmonPostProcessDefault):a=this.commmonPostProcessDefault(t,a,e),t==="object"&&(this.options.objects.postProcessFnc?a=this.options.objects.postProcessFnc(a,e,this.objectPostProcessDefault):a=this.objectPostProcessDefault(a,e)),a}};function oR(o,e){return new oh(e).getSchema(o)}function ec(o){if(!o||typeof o!="object")return o;if(Array.isArray(o))return o.map(t=>ec(t));let e={...o};if(delete e.required,e.properties&&typeof e.properties=="object"){let t=[],a={};for(let[i,r]of Object.entries(e.properties)){let s=r;if(s&&typeof s=="object"&&s.required===!0){t.push(i);let{required:n,...c}=s;a[i]=ec(c)}else a[i]=ec(s)}e.properties=a,t.length>0&&(e.required=t)}return e.items&&(e.items=ec(e.items)),e}function oc(o){if(!o||typeof o!="object")return null;if(o.const!==void 0)return o.const;if(o.enum&&Array.isArray(o.enum)&&o.enum.length>0)return o.enum[0];if(o.default!==void 0)return o.default;if(o.oneOf&&Array.isArray(o.oneOf)&&o.oneOf.length>0)return oc(o.oneOf[0]);if(o.anyOf&&Array.isArray(o.anyOf)&&o.anyOf.length>0)return oc(o.anyOf[0]);switch(Array.isArray(o.type)?o.type[0]:o.type){case"string":case"number":case"integer":case"boolean":return null;case"null":return null;case"array":return o.items?[]:[];case"object":let t={};if(o.properties&&typeof o.properties=="object"){let a=o.required||[];for(let[i,r]of Object.entries(o.properties))t[i]=oc(r)}return t;default:if(o.properties&&typeof o.properties=="object"){let a={};for(let[i,r]of Object.entries(o.properties))a[i]=oc(r);return a}return null}}function kl(o){if(typeof o!="string")return o;try{return JSON.parse(o)}catch{return o}}function tR(o){let e={...o};return e.inputSchema&&(e.inputSchema=kl(e.inputSchema)),e.outputSchema&&(e.outputSchema=kl(e.outputSchema)),e.responseSchema&&(e.responseSchema=kl(e.responseSchema)),e}});var rt=y(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.PLAYBOOK_LIMITS=E.DEFAULT_PROJECT_ID=E.PROJECT_LIMITS=E.PROJECT_RESOURCE_TYPES=E.MCP_SERVER_AUTH_MODES=E.OAUTH_POPUP_CLOSED_MESSAGE=E.OAUTH_CONTINUATION_REASON_MAX_CHARS=E.AGENT_REQUEST_BUSY_STATUSES=E.AGENT_SESSION_RESOURCE_KINDS=E.AGENT_MESSAGE_SCHEMA_VERSION=E.AGENT_APPROVAL_MODES=E.ConfirmationAction=E.SKILL_GATED_TOOLS=E.LOADABLE_MARKDOWN_NAMES=E.SKILL_REFERENCE_NAMES=E.SKILL_BODY_NAMES=E.AGENT_CHECKLIST_MAX_LABEL_CHARS=E.AGENT_CHECKLIST_MAX_ITEMS=E.AGENT_CHECKLIST_MIN_ITEMS=E.DYNAMIC_AGENT_TOOLS=E.AGENT_TOOLS=E.AGENT_BASE_TOOLS=E.AGENT_GLOBAL_TOOLS=E.ARTIFACT_PROPOSAL_ID_PREFIX=E.ARTIFACT_PLAYGROUND_DRAFT_ID=E.PLAYBOOK_PLAYGROUND_DRAFT_ID=E.PLAYGROUND_TOOL_DRAFT_ID=E.AgentType=E.FileStatus=E.MAX_BULK_RESOURCE_SHARE_OPERATIONS=E.MAX_BULK_MUTATION_IDS=E.RunExecutionKind=E.RequestSource=E.RunStatus=E.CredentialMode=E.UpsertMode=E.LogLevel=E.PaginationType=E.DecompressionMethod=E.AuthType=E.FileType=E.CacheMode=E.HttpMethod=E.SupportedFileType=void 0;E.isRequestConfig=aR;E.isTransformConfig=iR;E.getDefaultProjectDisplayName=rR;E.projectResourceKey=gs;E.parseProjectResourceKey=sR;E.normalizeProjectResourceRefs=nR;E.uniqueProjectResourceRefs=cR;E.mergeProjectResourceRefs=mR;var Ex;(function(o){o.JSON="JSON",o.CSV="CSV",o.XML="XML",o.HTML="HTML",o.YAML="YAML",o.EXCEL="EXCEL",o.PDF="PDF",o.DOCX="DOCX",o.PPTX="PPTX",o.ZIP="ZIP",o.GZIP="GZIP",o.BINARY="BINARY",o.RAW="RAW",o.AUTO="AUTO"})(Ex||(E.SupportedFileType=Ex={}));var Ix;(function(o){o.GET="GET",o.POST="POST",o.PUT="PUT",o.DELETE="DELETE",o.PATCH="PATCH",o.HEAD="HEAD",o.OPTIONS="OPTIONS"})(Ix||(E.HttpMethod=Ix={}));var Cx;(function(o){o.ENABLED="ENABLED",o.READONLY="READONLY",o.WRITEONLY="WRITEONLY",o.DISABLED="DISABLED"})(Cx||(E.CacheMode=Cx={}));var jx;(function(o){o.CSV="CSV",o.JSON="JSON",o.XML="XML",o.YAML="YAML",o.EXCEL="EXCEL",o.HTML="HTML",o.PDF="PDF",o.DOCX="DOCX",o.PPTX="PPTX",o.ZIP="ZIP",o.BINARY="BINARY",o.RAW="RAW",o.AUTO="AUTO"})(jx||(E.FileType=jx={}));var Bx;(function(o){o.NONE="NONE",o.OAUTH2="OAUTH2",o.HEADER="HEADER",o.QUERY_PARAM="QUERY_PARAM"})(Bx||(E.AuthType=Bx={}));var Qx;(function(o){o.GZIP="GZIP",o.DEFLATE="DEFLATE",o.NONE="NONE",o.AUTO="AUTO",o.ZIP="ZIP"})(Qx||(E.DecompressionMethod=Qx={}));var Sx;(function(o){o.OFFSET_BASED="OFFSET_BASED",o.PAGE_BASED="PAGE_BASED",o.CURSOR_BASED="CURSOR_BASED",o.DISABLED="DISABLED"})(Sx||(E.PaginationType=Sx={}));var Dx;(function(o){o.DEBUG="DEBUG",o.INFO="INFO",o.WARN="WARN",o.ERROR="ERROR"})(Dx||(E.LogLevel=Dx={}));var Tx;(function(o){o.CREATE="CREATE",o.UPDATE="UPDATE",o.UPSERT="UPSERT"})(Tx||(E.UpsertMode=Tx={}));var Rx;(function(o){o.MERGE="MERGE",o.REPLACE="REPLACE"})(Rx||(E.CredentialMode=Rx={}));var Nx;(function(o){o.RUNNING="RUNNING",o.SUCCESS="SUCCESS",o.FAILED="FAILED",o.ABORTED="ABORTED"})(Nx||(E.RunStatus=Nx={}));var Ux;(function(o){o.API="api",o.FRONTEND="frontend",o.AGENT="agent",o.SCHEDULER="scheduler",o.MCP="mcp",o.TOOL_CHAIN="tool-chain",o.WEBHOOK="webhook",o.CLI="cli"})(Ux||(E.RequestSource=Ux={}));var Ox;(function(o){o.FULL="full",o.DRAFT="draft",o.SINGLE_STEP="single-step"})(Ox||(E.RunExecutionKind=Ox={}));E.MAX_BULK_MUTATION_IDS=100;E.MAX_BULK_RESOURCE_SHARE_OPERATIONS=1e3;function aR(o){return!o||typeof o!="object"?!1:o.type==="request"||!("type"in o)||o.type===void 0}function iR(o){return o?.type==="transform"}var Mx;(function(o){o.PENDING="PENDING",o.UPLOADING="UPLOADING",o.PROCESSING="PROCESSING",o.COMPLETED="COMPLETED",o.FAILED="FAILED"})(Mx||(E.FileStatus=Mx={}));var va;(function(o){o.MAIN="main",o.BACKGROUND_ARTIFACT="background_artifact",o.PLAYGROUND="playground",o.SYSTEM_PLAYGROUND="system_playground",o.PLAYBOOK_PLAYGROUND="playbook_playground",o.ARTIFACT_PLAYGROUND="artifact_playground",o.ACCESS_RULES="access_rules"})(va||(E.AgentType=va={}));E.PLAYGROUND_TOOL_DRAFT_ID="@playground-draft";E.PLAYBOOK_PLAYGROUND_DRAFT_ID="@playground-draft";E.ARTIFACT_PLAYGROUND_DRAFT_ID="@playground-draft";E.ARTIFACT_PROPOSAL_ID_PREFIX="artifact_proposal_";E.AGENT_GLOBAL_TOOLS=["run_command","load_skill"];E.AGENT_BASE_TOOLS=[...E.AGENT_GLOBAL_TOOLS,"call_system","run_tool","share_resource","use_checklist"];E.AGENT_TOOLS={[va.MAIN]:[...E.AGENT_BASE_TOOLS],[va.BACKGROUND_ARTIFACT]:["run_command","create_artifact"],[va.PLAYGROUND]:[...E.AGENT_BASE_TOOLS,"edit_tool"],[va.SYSTEM_PLAYGROUND]:[...E.AGENT_GLOBAL_TOOLS,"call_system","create_system","edit_system","set_credentials","authenticate_oauth","share_resource","use_checklist"],[va.PLAYBOOK_PLAYGROUND]:[...E.AGENT_GLOBAL_TOOLS,"call_system","run_tool","create_playbook","edit_playbook","save_playbook","share_resource","use_checklist"],[va.ARTIFACT_PLAYGROUND]:[...E.AGENT_BASE_TOOLS],[va.ACCESS_RULES]:[...E.AGENT_GLOBAL_TOOLS,"create_role","edit_role","use_checklist"]};E.DYNAMIC_AGENT_TOOLS=["web_search"];E.AGENT_CHECKLIST_MIN_ITEMS=4;E.AGENT_CHECKLIST_MAX_ITEMS=15;E.AGENT_CHECKLIST_MAX_LABEL_CHARS=120;E.SKILL_BODY_NAMES=["superglue-info","tool-building","tool-editing","system-setup","access-management","tool-deployment","notifications","artifacts","playbooks","projects","file-handling","superglue-brain","email","workspace-apps","meetings"];E.SKILL_REFERENCE_NAMES=["http","graphql","postgres","mssql","odbc","redis","mongodb","sftp-smb","file-runtime","tunnel-handling"];E.LOADABLE_MARKDOWN_NAMES=[...E.SKILL_BODY_NAMES,...E.SKILL_REFERENCE_NAMES];E.SKILL_GATED_TOOLS={"tool-building":["build_tool","set_tool_state"],"tool-editing":["edit_tool","save_tool","set_tool_state"],"system-setup":["create_system","edit_system","set_credentials","authenticate_oauth"],"tool-deployment":["create_schedule","edit_schedule","create_mcp_server","edit_mcp_server","show_mcp_server"],"access-management":["create_role","edit_role","share_resource"],playbooks:["create_playbook","edit_playbook"],projects:["create_project","edit_project"],artifacts:["create_artifact","start_background_agent","edit_artifact"]};var _x;(function(o){o.CONFIRMED="confirmed",o.CONFIRMED_AND_SAVE="confirmed_and_save",o.DECLINED="declined",o.OAUTH_SUCCESS="oauth_success",o.OAUTH_FAILURE="oauth_failure"})(_x||(E.ConfirmationAction=_x={}));E.AGENT_APPROVAL_MODES=["ask","act"];E.AGENT_MESSAGE_SCHEMA_VERSION=1;E.AGENT_SESSION_RESOURCE_KINDS=["tool","system","playbook","artifact"];E.AGENT_REQUEST_BUSY_STATUSES=["queued","claimed","running","cancelling"];E.OAUTH_CONTINUATION_REASON_MAX_CHARS=500;E.OAUTH_POPUP_CLOSED_MESSAGE="OAuth authentication did not complete.";E.MCP_SERVER_AUTH_MODES=["oauth","creator_api_key"];E.PROJECT_RESOURCE_TYPES=["system","playbook","artifact","file","tool"];E.PROJECT_LIMITS={name:80,description:500};E.DEFAULT_PROJECT_ID="default";function rR(o){return o.trim()||"Your workspace"}function gs(o){return`${o.type}:${o.id}`}function sR(o){let e=o.indexOf(":");return{type:o.slice(0,e),id:o.slice(e+1)}}function nR({value:o,field:e="resourceRefs"}){if(o===void 0)return{refs:[]};if(!Array.isArray(o))return{error:`${e} must be an array`};let t=[],a=new Set;for(let[i,r]of o.entries()){if(!r||typeof r!="object"||Array.isArray(r))return{error:`${e}[${i}] must be shaped as { type, id }`};let s=r,n=typeof s.type=="string"?s.type.trim():"",c=typeof s.id=="string"?s.id.trim():"";if(!E.PROJECT_RESOURCE_TYPES.includes(n))return{error:`${e}[${i}].type is unsupported`};if(!c||c.length>255)return{error:`${e}[${i}].id must contain between 1 and 255 characters`};let m={type:n,id:c},l=gs(m);a.has(l)||t.push(m),a.add(l)}return{refs:t}}function cR(o){return[...new Map(o.map(e=>[gs(e),e])).values()]}function mR({current:o,add:e,remove:t}){let a=new Map(o.map(i=>[gs(i),i]));for(let i of t)a.delete(gs(i));for(let i of e)a.set(gs(i),i);return[...a.values()]}E.PLAYBOOK_LIMITS={name:120,whenToRun:500,inputs:2e3,instructions:8e3,completionCriteria:2e3,systemRefs:10,toolRefs:25,credentialRefs:10,fileRefs:15,compiledRender:24e3}});var lR,Fx,Lx,uR,dR,gR,pR,Px=he(()=>{"use strict";lR=o=>{let e=Lx(o,0);if(e===void 0||!dR(o[e]))return;let t=Lx(o,e+1);if(t!==void 0)return gR(o,e,t)},Fx=lR,Lx=(o,e)=>{for(let t=e;t<o.length;t+=1){let a=o[t];if(!uR(a))return t}},uR=o=>o===" "||o===" "||o===`
|
|
3
3
|
`||o==="\r",dR=o=>o==="{"||o==="[",gR=(o,e,t)=>{let a;for(let i=t-1;i>e;i-=1){let r=o[i];if(r==="\r")return;if(r===`
|
|
4
4
|
`)return pR(a);if(a===void 0)a=r;else if(a[0]===r)a+=r;else return}},pR=o=>o===void 0?0:o[0]===" "?o.length:o});var Hx,ah,hR,fR,Gx=he(()=>{"use strict";Hx=(o,e)=>{let t=ah(o,"toPrecision",e,e);return t===void 0?ah(o,"toExponential",e,e):t},ah=(o,e,t,a)=>{let r=o[e](a).replace(hR,"$1").replace(fR,"$1");return r.length<=t?r:a===1?void 0:ah(o,e,t,a-1)},hR=/(e)\+/iu,fR=/\.?0*($|e)/iu});var Vx,bR,yR,Yx,$x=he(()=>{"use strict";Vx=(o,e)=>{if(typeof o!="string")throw new TypeError(`Input must be a JSON string: ${o}`);bR(e)},bR=o=>{if(yR(o),o<0)throw new TypeError(`"maxSize" argument must be positive: ${o}`);if(o<Yx)throw new TypeError(`"maxSize" argument must be at least ${Yx}: ${o}`)},yR=o=>{if(o===void 0)throw new TypeError('"maxSize" argument must be defined');if(!Number.isInteger(o))throw new TypeError(`"maxSize" argument must be an integer: ${o}`)},Yx=7});var wl,Wx,vl,kR,AR,wR,vR,Jx,xR,zR,qR,ER,IR,CR,ih=he(()=>{"use strict";wl=(o,e,t)=>{let a=Jx(e,t);return Wx(o,e,a)},Wx=(o,e,t)=>{if(t>=e)return t;let a=o[t];return a>=IR&&a<=CR?Wx(o,e,t+1):t},vl=(o,e,t)=>{if(t===void 0)return t;let a=Jx(e,t);return kR(o,a)},kR=(o,e)=>AR(o,e)?e-3:wR(o,e)?e-2:vR(o,e)?e-1:e,AR=(o,e)=>e>=3&&o[e-3]>=xR&&o[e-3]<=zR,wR=(o,e)=>e>=2&&o[e-2]>=qR,vR=(o,e)=>e>=1&&o[e-1]>=ER,Jx=(o,e)=>e<0||Object.is(e,-0)?Math.max(o+e,0):e,xR=240,zR=244,qR=224,ER=194,IR=128,CR=191});var Kx,Zx=he(()=>{"use strict";ih();Kx=(o,e,t)=>{let a=globalThis.Buffer.from(o),i=wl(a,a.length,e),r=vl(a,a.length,t);return i===0&&r>=a.length?a.toString():a.toString("utf8",i,r)}});var Xx,ez=he(()=>{"use strict";Xx=/[\uD800-\uDFFF]/gu});var xl,BR,nh=he(()=>{"use strict";ez();xl=o=>BR(o)?o.replace(Xx,"\uFFFD"):o,BR=o=>{for(let e=0;e<o.length;e+=1){let t=o.codePointAt(e);if(t>=55296&&t<=57343)return!0}return!1}});var ch,oz=he(()=>{"use strict";ch=({input:o,targetByteCount:e,firstStartSurrogate:t,lastStartSurrogate:a,firstEndSurrogate:i,lastEndSurrogate:r,increment:s,canBacktrack:n,shift:c,charIndexInit:m})=>{let l=m,u=l,d=0;for(;d<e;l+=s){u=l;let p=o.charCodeAt(l);if(Number.isNaN(p))break;if(p<=127){d+=1;continue}if(p<=2047){d+=2;continue}if(d+=3,p<t||p>a)continue;let b=o.charCodeAt(l+s);Number.isNaN(b)||b<i||b>r||(d+=1,l+=s)}return(n&&d>e?u:l)+c}});var mh,RR,NR,tz=he(()=>{"use strict";oz();mh=(o,e,t)=>e<0||Object.is(e,-0)?NR(o,e,t):RR(o,e,t),RR=(o,e,t)=>ch({input:o,targetByteCount:e,firstStartSurrogate:55296,lastStartSurrogate:56319,firstEndSurrogate:56320,lastEndSurrogate:57343,increment:1,canBacktrack:t,shift:0,charIndexInit:0}),NR=(o,e,t)=>ch({input:o,targetByteCount:-e,firstStartSurrogate:56320,lastStartSurrogate:57343,firstEndSurrogate:55296,lastEndSurrogate:56319,increment:-1,canBacktrack:!t,shift:1,charIndexInit:o.length-1})});var zl,UR,az=he(()=>{"use strict";nh();tz();zl=(o,e,t)=>{let a=mh(o,e,!1),i=UR(o,t),r=a===0&&i===void 0?o:o.slice(a,i);return xl(r)},UR=(o,e)=>{if(e===void 0)return e;let t=mh(o,e,!0);return t===o.length?void 0:t}});var rz,OR,lh,iz,MR,_R,ql,sz=he(()=>{"use strict";ih();rz=(o,e,t)=>{let{textEncoder:a,textDecoder:i}=OR(),r=MR(o),{written:s}=a.encodeInto(o,r),n=wl(r,s,e),c=vl(r,s,t),m=c===void 0?s:Math.min(c,s),l=r.subarray(n,m);return i.decode(l)},OR=()=>(lh===void 0&&(lh=new globalThis.TextEncoder,iz=new globalThis.TextDecoder("utf8",{fatal:!1})),{textEncoder:lh,textDecoder:iz}),MR=o=>{let e=o.length*3;return e>_R?new Uint8Array(e):((ql===void 0||ql.length<e)&&(ql=new Uint8Array(e)),ql)},_R=1e5});var nz,uh,cz,mz=he(()=>{"use strict";nz=(o,e)=>{if(e===void 0)return e;let t=uh(o,e);return t>=o.length*cz?void 0:t},uh=(o,e)=>e<=o.length*-cz?0:e,cz=4});var lz,LR,FR,uz,dz=he(()=>{"use strict";lz=(o,e,t)=>{if(typeof o!="string")throw new TypeError(`First argument must be a string: ${o}`);LR(e),FR(t)},LR=o=>{if(o===void 0)throw new TypeError("Second argument is required.");uz("Second",o)},FR=o=>{o!==void 0&&uz("Third",o)},uz=(o,e)=>{if(!Number.isInteger(e))throw new TypeError(`${o} argument must be an integer: ${e}`)}});var gz,PR,dh,pz=he(()=>{"use strict";gz=o=>{let e=!0,t=0;for(let a=0;a<dh;a+=1){let i=PR(o,a);i<=127||(e&&(e=!1),i>2047&&(t+=1))}return{asciiOnly:e,longCharsPercentage:t/dh}},PR=(o,e)=>{let t=dh-1,a=1-(t-e)/t,i=Math.round(a*(o.length-1));return o.charCodeAt(i)},dh=50});var HR,hz,GR,YR,VR,$R,fz,bz=he(()=>{"use strict";Zx();az();sz();mz();nh();dz();pz();HR=(o,e,t)=>{if(lz(o,e,t),o==="")return o;let a=uh(o,e),i=nz(o,t);return i===void 0&&Object.is(a,0)?xl(o):GR(o,a,i)},hz=HR,GR=(o,e,t)=>{if(o.length<=YR)return zl(o,e,t);let{asciiOnly:a,longCharsPercentage:i}=gz(o);return a?$R(o,e,t):i>=VR?zl(o,e,t):fz(o,e,t)},YR=200,VR=.4,$R=(o,e,t)=>"Buffer"in globalThis&&"from"in globalThis.Buffer?Kx(o,e,t):fz(o,e,t),fz=(o,e,t)=>"TextEncoder"in globalThis?rz(o,e,t):zl(o,e,t)});var kz,WR,JR,KR,ZR,tc,yz,Az=he(()=>{"use strict";bz();kz=(o,e)=>{let t=JSON.stringify(o),a=KR(t),i=hz(a,0,e-yz.length-tc.length*2),s=`${WR(i)}${yz}`;return ZR(s)},WR=o=>o.replace(JR,""),JR=/(\\|\\u[0-9a-fA-F]{0,3})$/u,KR=o=>o.slice(tc.length,-tc.length),ZR=o=>`${tc}${o}${tc}`,tc='"',yz="..."});var wz,vz=he(()=>{"use strict";wz=o=>globalThis.Buffer.byteLength(o)});var gh,XR,eN,oN,tN,aN,iN,xz=he(()=>{"use strict";gh=o=>{let e=o.length,t=e;for(let a=0;a<e;a+=1){let i=o.charCodeAt(a);if(i<=XR)continue;if(i<=eN){t+=1;continue}if(t+=2,i<oN||i>tN)continue;let r=o.charCodeAt(a+1);r<aN||r>iN||(a+=1)}return t},XR=127,eN=2047,oN=55296,tN=56319,aN=56320,iN=57343});var zz,rN,sN,nN,El,qz=he(()=>{"use strict";zz=()=>rN.bind(void 0,new TextEncoder),rN=(o,e)=>{let t=sN(e);return o.encodeInto(e,t).written},sN=o=>{let e=o.length*3;return e>nN?new Uint8Array(e):((El===void 0||El.length<e)&&(El=new Uint8Array(e)),El)},nN=1e5});var mN,lN,Ez,Iz=he(()=>{"use strict";vz();xz();qz();mN=()=>"Buffer"in globalThis&&"byteLength"in globalThis.Buffer?wz:"TextEncoder"in globalThis?lN.bind(void 0,zz()):gh,lN=(o,e)=>e.length<100?gh(e):o(e),Ez=mN()});var Cz,uN,dN,gN,pN,ph,jz=he(()=>{"use strict";Iz();Cz=o=>{if(o===null)return uN;if(o===!0)return dN;if(o===!1)return gN;let e=typeof o;return e==="object"?pN:e==="number"?JSON.stringify(o).length:ph(o)},uN=4,dN=4,gN=5,pN=2,ph=o=>Ez(JSON.stringify(o))});var Il,Qz,Sz,Dz,hN,Tz,Bz,Rz,fN,ac=he(()=>{"use strict";jz();Il=({size:o,increment:e,maxSize:t,truncatedProps:a,path:i,value:r})=>{let s=o+e,n=s>t;return n?{size:o,stop:n,truncatedProps:[...a,{path:i,value:r}]}:{size:s,stop:n,truncatedProps:a}},Qz=o=>Cz(o),Sz=(o,e,t)=>{let a=Tz({empty:o,indent:e,depth:t,keySpaceSize:0}),i=Rz(o);return a+i},Dz=({key:o,empty:e,indent:t,depth:a})=>{let i=Tz({empty:e,indent:t,depth:a,keySpaceSize:1}),r=ph(o),s=Rz(e);return i+r+hN+s},hN=1,Tz=({empty:o,indent:e,depth:t,keySpaceSize:a})=>{if(e===void 0)return 0;let i=Bz+e*(t+1),r=o?Bz+e*t:0;return a+i+r},Bz=1,Rz=o=>o?0:fN,fN=1});var Cl,bN,hh=he(()=>{"use strict";ac();Cl=({parent:o,truncatedProps:e,path:t,increment:a,maxSize:i,key:r,empty:s,size:n,truncateValue:c,indent:m,depth:l})=>{let u=o[r],d=[...t,r],{size:g,stop:p,truncatedProps:b}=Il({size:n,increment:a,maxSize:i,truncatedProps:e,path:d,value:u});return p?{empty:s,size:g,truncatedProps:b}:bN({value:u,truncatedProps:e,path:d,maxSize:i,empty:s,size:n,newSize:g,truncateValue:c,indent:m,depth:l})},bN=({value:o,truncatedProps:e,path:t,maxSize:a,empty:i,size:r,newSize:s,truncateValue:n,indent:c,depth:m})=>{let{value:l,size:u,truncatedProps:d}=n({value:o,truncatedProps:e,path:t,size:s,maxSize:a,indent:c,depth:m+1});return l===void 0?{empty:i,size:r,truncatedProps:d}:{empty:!1,size:u,value:l,truncatedProps:d}}});var Nz,Uz=he(()=>{"use strict";hh();ac();Nz=({array:o,truncatedProps:e,path:t,size:a,maxSize:i,truncateValue:r,indent:s,depth:n})=>{let c=[],m={empty:!0,size:a,truncatedProps:e};for(let l=0;l<o.length;l+=1){let u=Sz(m.empty,s,n);m=Cl({parent:o,truncatedProps:m.truncatedProps,path:t,increment:u,maxSize:i,key:l,empty:m.empty,size:m.size,truncateValue:r,indent:s,depth:n}),m.value!==void 0&&c.push(m.value)}return{value:c,size:m.size,truncatedProps:m.truncatedProps}}});var Oz,Mz=he(()=>{"use strict";hh();ac();Oz=({object:o,truncatedProps:e,path:t,size:a,maxSize:i,truncateValue:r,indent:s,depth:n})=>{let c={},m={empty:!0,size:a,truncatedProps:e};for(let l in o){let u=Dz({key:l,empty:m.empty,indent:s,depth:n});m=Cl({parent:o,truncatedProps:m.truncatedProps,path:t,increment:u,maxSize:i,key:l,empty:m.empty,size:m.size,truncateValue:r,indent:s,depth:n}),m.value!==void 0&&(c[l]=m.value)}return{value:c,size:m.size,truncatedProps:m.truncatedProps}}});var jl,yN,_z=he(()=>{"use strict";Uz();Mz();ac();jl=({value:o,truncatedProps:e,path:t,size:a,maxSize:i,indent:r,depth:s})=>{let n=Qz(o),{size:c,stop:m,truncatedProps:l}=Il({size:a,increment:n,maxSize:i,truncatedProps:e,path:t,value:o});return m?{value:void 0,size:c,truncatedProps:l}:yN({value:o,truncatedProps:l,path:t,size:c,maxSize:i,indent:r,depth:s})},yN=({value:o,truncatedProps:e,path:t,size:a,maxSize:i,indent:r,depth:s})=>typeof o!="object"||o===null?{value:o,size:a,truncatedProps:e}:Array.isArray(o)?Nz({array:o,truncatedProps:e,path:t,size:a,maxSize:i,truncateValue:jl,indent:r,depth:s}):Oz({object:o,truncatedProps:e,path:t,size:a,maxSize:i,truncateValue:jl,indent:r,depth:s})});var Lz={};Bv(Lz,{default:()=>AN});var kN,AN,wN,vN,xN,Fz=he(()=>{"use strict";Px();Gx();$x();Az();_z();kN=(o,e)=>{Vx(o,e);let t=wN(o),a=vN(o),{value:i,truncatedProps:r}=jl({value:a,truncatedProps:[],path:[],size:0,maxSize:e,indent:t,depth:0});return{jsonString:xN({newValue:i,value:a,maxSize:e,indent:t}),truncatedProps:r}},AN=kN,wN=o=>{let e=Fx(o);return typeof e=="string"?e.length:e},vN=o=>{try{return JSON.parse(o)}catch(e){throw new TypeError(`Invalid JSON string: "${o}"
|
|
5
5
|
${e.message}`)}},xN=({newValue:o,value:e,maxSize:t,indent:a})=>o!==void 0?JSON.stringify(o,void 0,a):typeof e=="number"?Hx(e,t):kz(e,t)});var Hz=y(Pz=>{"use strict";Object.defineProperty(Pz,"__esModule",{value:!0})});var ti=y(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});Bl.CronField=void 0;var fh=class o{#e=!1;#o=!1;#a=!1;#i=[];options={rawValue:""};static get min(){throw new Error("min must be overridden")}static get max(){throw new Error("max must be overridden")}static get chars(){return Object.freeze([])}static get validChars(){return/^[?,*\dH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}static get constraints(){return{min:this.min,max:this.max,chars:this.chars,validChars:this.validChars}}constructor(e,t={rawValue:""}){if(!Array.isArray(e))throw new Error(`${this.constructor.name} Validation error, values is not an array`);if(!(e.length>0))throw new Error(`${this.constructor.name} Validation error, values contains no values`);this.options={...t,rawValue:t.rawValue??""},this.#i=e.sort(o.sorter),this.#a=this.options.wildcard!==void 0?this.options.wildcard:this.#r(),this.#e=this.options.rawValue.includes("L")||e.includes("L"),this.#o=this.options.rawValue.includes("?")||e.includes("?")}get min(){return this.constructor.min}get max(){return this.constructor.max}get chars(){return this.constructor.chars}get hasLastChar(){return this.#e}get hasQuestionMarkChar(){return this.#o}get isWildcard(){return this.#a}get values(){return this.#i}static sorter(e,t){let a=typeof e=="number",i=typeof t=="number";return a&&i?e-t:!a&&!i?e.localeCompare(t):a?-1:1}static findNearestValueInList(e,t,a=!1){if(a){for(let i=e.length-1;i>=0;i--)if(e[i]<t)return e[i];return null}for(let i=0;i<e.length;i++)if(e[i]>t)return e[i];return null}findNearestValue(e,t=!1){return this.constructor.findNearestValueInList(this.values,e,t)}serialize(){return{wildcard:this.#a,values:this.#i}}validate(){let e,t=this.chars.length>0?` or chars ${this.chars.join("")}`:"",a=n=>c=>new RegExp(`^\\d{0,2}${c}$`).test(n),i=n=>(e=n,typeof n=="number"?n>=this.min&&n<=this.max:this.chars.some(a(n)));if(!this.#i.every(i))throw new Error(`${this.constructor.name} Validation error, got value ${e} expected range ${this.min}-${this.max}${t}`);let s=this.#i.find((n,c)=>this.#i.indexOf(n)!==c);if(s)throw new Error(`${this.constructor.name} Validation error, duplicate values found: ${s}`)}#r(){return this.options.rawValue.length>0?["*","?"].includes(this.options.rawValue):Array.from({length:this.max-this.min+1},(e,t)=>t+this.min).every(e=>this.#i.includes(e))}};Bl.CronField=fh});var Gz=y(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});Ql.CronDayOfMonth=void 0;var zN=ti(),qN=1,EN=31,IN=Object.freeze(["L"]),bh=class extends zN.CronField{static get min(){return qN}static get max(){return EN}static get chars(){return IN}static get validChars(){return/^[?,*\dLH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}};Ql.CronDayOfMonth=bh});var Yz=y(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});Sl.CronDayOfWeek=void 0;var CN=ti(),jN=0,BN=7,QN=Object.freeze(["L"]),yh=class extends CN.CronField{static get min(){return jN}static get max(){return BN}static get chars(){return QN}static get validChars(){return/^[?,*\dLH#/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}get nthDay(){return this.options.nthDayOfWeek??0}};Sl.CronDayOfWeek=yh});var Vz=y(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.CronHour=void 0;var SN=ti(),DN=0,TN=23,RN=Object.freeze([]),kh=class extends SN.CronField{static get min(){return DN}static get max(){return TN}static get chars(){return RN}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}};Dl.CronHour=kh});var $z=y(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.CronMinute=void 0;var NN=ti(),UN=0,ON=59,MN=Object.freeze([]),Ah=class extends NN.CronField{static get min(){return UN}static get max(){return ON}static get chars(){return MN}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}};Tl.CronMinute=Ah});var zq=y(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});var za=class extends Error{},Bh=class extends za{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Qh=class extends za{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Sh=class extends za{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},ri=class extends za{},Fl=class extends za{constructor(e){super(`Invalid unit ${e}`)}},$e=class extends za{},Gt=class extends za{constructor(){super("Zone is an abstract class")}},B="numeric",Bt="short",Mo="long",Pl={year:B,month:B,day:B},q0={year:B,month:Bt,day:B},_N={year:B,month:Bt,day:B,weekday:Bt},E0={year:B,month:Mo,day:B},I0={year:B,month:Mo,day:B,weekday:Mo},C0={hour:B,minute:B},j0={hour:B,minute:B,second:B},B0={hour:B,minute:B,second:B,timeZoneName:Bt},Q0={hour:B,minute:B,second:B,timeZoneName:Mo},S0={hour:B,minute:B,hourCycle:"h23"},D0={hour:B,minute:B,second:B,hourCycle:"h23"},T0={hour:B,minute:B,second:B,hourCycle:"h23",timeZoneName:Bt},R0={hour:B,minute:B,second:B,hourCycle:"h23",timeZoneName:Mo},N0={year:B,month:B,day:B,hour:B,minute:B},U0={year:B,month:B,day:B,hour:B,minute:B,second:B},O0={year:B,month:Bt,day:B,hour:B,minute:B},M0={year:B,month:Bt,day:B,hour:B,minute:B,second:B},LN={year:B,month:Bt,day:B,weekday:Bt,hour:B,minute:B},_0={year:B,month:Mo,day:B,hour:B,minute:B,timeZoneName:Bt},L0={year:B,month:Mo,day:B,hour:B,minute:B,second:B,timeZoneName:Bt},F0={year:B,month:Mo,day:B,weekday:Mo,hour:B,minute:B,timeZoneName:Mo},P0={year:B,month:Mo,day:B,weekday:Mo,hour:B,minute:B,second:B,timeZoneName:Mo},ni=class{get type(){throw new Gt}get name(){throw new Gt}get ianaName(){return this.name}get isUniversal(){throw new Gt}offsetName(e,t){throw new Gt}formatOffset(e,t){throw new Gt}offset(e){throw new Gt}equals(e){throw new Gt}get isValid(){throw new Gt}},wh=null,mc=class o extends ni{static get instance(){return wh===null&&(wh=new o),wh}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:a}){return eq(e,t,a)}formatOffset(e,t){return cc(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}},Dh=new Map;function FN(o){let e=Dh.get(o);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:o,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Dh.set(o,e)),e}var PN={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function HN(o,e){let t=o.format(e).replace(/\u200E/g,""),a=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,i,r,s,n,c,m,l]=a;return[s,i,r,n,c,m,l]}function GN(o,e){let t=o.formatToParts(e),a=[];for(let i=0;i<t.length;i++){let{type:r,value:s}=t[i],n=PN[r];r==="era"?a[n]=s:V(n)||(a[n]=parseInt(s,10))}return a}var vh=new Map,qa=class o extends ni{static create(e){let t=vh.get(e);return t===void 0&&vh.set(e,t=new o(e)),t}static resetCache(){vh.clear(),Dh.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=o.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:a}){return eq(e,t,a,this.name)}formatOffset(e,t){return cc(this.offset(e),t)}offset(e){if(!this.valid)return NaN;let t=new Date(e);if(isNaN(t))return NaN;let a=FN(this.name),[i,r,s,n,c,m,l]=a.formatToParts?GN(a,t):HN(a,t);n==="BC"&&(i=-Math.abs(i)+1);let d=Jl({year:i,month:r,day:s,hour:c===24?0:c,minute:m,second:l,millisecond:0}),g=+t,p=g%1e3;return g-=p>=0?p:1e3+p,(d-g)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}},Wz={};function YN(o,e={}){let t=JSON.stringify([o,e]),a=Wz[t];return a||(a=new Intl.ListFormat(o,e),Wz[t]=a),a}var Th=new Map;function Rh(o,e={}){let t=JSON.stringify([o,e]),a=Th.get(t);return a===void 0&&(a=new Intl.DateTimeFormat(o,e),Th.set(t,a)),a}var Nh=new Map;function VN(o,e={}){let t=JSON.stringify([o,e]),a=Nh.get(t);return a===void 0&&(a=new Intl.NumberFormat(o,e),Nh.set(t,a)),a}var Uh=new Map;function $N(o,e={}){let{base:t,...a}=e,i=JSON.stringify([o,a]),r=Uh.get(i);return r===void 0&&(r=new Intl.RelativeTimeFormat(o,e),Uh.set(i,r)),r}var rc=null;function WN(){return rc||(rc=new Intl.DateTimeFormat().resolvedOptions().locale,rc)}var Oh=new Map;function H0(o){let e=Oh.get(o);return e===void 0&&(e=new Intl.DateTimeFormat(o).resolvedOptions(),Oh.set(o,e)),e}var Mh=new Map;function JN(o){let e=Mh.get(o);if(!e){let t=new Intl.Locale(o);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...G0,...e}),Mh.set(o,e)}return e}function KN(o){let e=o.indexOf("-x-");e!==-1&&(o=o.substring(0,e));let t=o.indexOf("-u-");if(t===-1)return[o];{let a,i;try{a=Rh(o).resolvedOptions(),i=o}catch{let c=o.substring(0,t);a=Rh(c).resolvedOptions(),i=c}let{numberingSystem:r,calendar:s}=a;return[i,r,s]}}function ZN(o,e,t){return(t||e)&&(o.includes("-u-")||(o+="-u"),t&&(o+=`-ca-${t}`),e&&(o+=`-nu-${e}`)),o}function XN(o){let e=[];for(let t=1;t<=12;t++){let a=ze.utc(2009,t,1);e.push(o(a))}return e}function eU(o){let e=[];for(let t=1;t<=7;t++){let a=ze.utc(2016,11,13+t);e.push(o(a))}return e}function Rl(o,e,t,a){let i=o.listingMode();return i==="error"?null:i==="en"?t(e):a(e)}function oU(o){return o.numberingSystem&&o.numberingSystem!=="latn"?!1:o.numberingSystem==="latn"||!o.locale||o.locale.startsWith("en")||H0(o.locale).numberingSystem==="latn"}var _h=class{constructor(e,t,a){this.padTo=a.padTo||0,this.floor=a.floor||!1;let{padTo:i,floor:r,...s}=a;if(!t||Object.keys(s).length>0){let n={useGrouping:!1,...a};a.padTo>0&&(n.minimumIntegerDigits=a.padTo),this.inf=VN(e,n)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{let t=this.floor?Math.floor(e):Kh(e,3);return Ue(t,this.padTo)}}},Lh=class{constructor(e,t,a){this.opts=a,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let s=-1*(e.offset/60),n=s>=0?`Etc/GMT+${s}`:`Etc/GMT${s}`;e.offset!==0&&qa.create(n).valid?(i=n,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let r={...this.opts};r.timeZone=r.timeZone||i,this.dtf=Rh(t,r)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){let a=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:a}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},Fh=class{constructor(e,t,a){this.opts={style:"long",...a},!t&&Z0()&&(this.rtf=$N(e,a))}format(e,t){return this.rtf?this.rtf.format(e,t):vU(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}},G0={firstDay:1,minimalDays:4,weekend:[6,7]},be=class o{static fromOpts(e){return o.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,a,i,r=!1){let s=e||Ae.defaultLocale,n=s||(r?"en-US":WN()),c=t||Ae.defaultNumberingSystem,m=a||Ae.defaultOutputCalendar,l=Hh(i)||Ae.defaultWeekSettings;return new o(n,c,m,l,s)}static resetCache(){rc=null,Th.clear(),Nh.clear(),Uh.clear(),Oh.clear(),Mh.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:a,weekSettings:i}={}){return o.create(e,t,a,i)}constructor(e,t,a,i,r){let[s,n,c]=KN(e);this.locale=s,this.numberingSystem=t||n||null,this.outputCalendar=a||c||null,this.weekSettings=i,this.intl=ZN(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=r,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=oU(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:o.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Hh(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Rl(this,e,aq,()=>{let a=this.intl==="ja"||this.intl.startsWith("ja-");t&=!a;let i=t?{month:e,day:"numeric"}:{month:e},r=t?"format":"standalone";if(!this.monthsCache[r][e]){let s=a?n=>this.dtFormatter(n,i).format():n=>this.extract(n,i,"month");this.monthsCache[r][e]=XN(s)}return this.monthsCache[r][e]})}weekdays(e,t=!1){return Rl(this,e,sq,()=>{let a=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=t?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=eU(r=>this.extract(r,a,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return Rl(this,void 0,()=>nq,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[ze.utc(2016,11,13,9),ze.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Rl(this,e,cq,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[ze.utc(-40,1,1),ze.utc(2017,1,1)].map(a=>this.extract(a,t,"era"))),this.eraCache[e]})}extract(e,t,a){let i=this.dtFormatter(e,t),r=i.formatToParts(),s=r.find(n=>n.type.toLowerCase()===a);return s?s.value:null}numberFormatter(e={}){return new _h(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Lh(e,this.intl,t)}relFormatter(e={}){return new Fh(this.intl,this.isEnglish(),e)}listFormatter(e={}){return YN(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||H0(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:X0()?JN(this.locale):G0}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}},xh=null,_o=class o extends ni{static get utcInstance(){return xh===null&&(xh=new o(0)),xh}static instance(e){return e===0?o.utcInstance:new o(e)}static parseSpecifier(e){if(e){let t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new o(Kl(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${cc(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${cc(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return cc(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}},Hl=class extends ni{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function ii(o,e){if(V(o)||o===null)return e;if(o instanceof ni)return o;if(nU(o)){let t=o.toLowerCase();return t==="default"?e:t==="local"||t==="system"?mc.instance:t==="utc"||t==="gmt"?_o.utcInstance:_o.parseSpecifier(t)||qa.create(o)}else return si(o)?_o.instance(o):typeof o=="object"&&"offset"in o&&typeof o.offset=="function"?o:new Hl(o)}var Vh={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},Jz={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},tU=Vh.hanidec.replace(/[\[|\]]/g,"").split("");function aU(o){let e=parseInt(o,10);if(isNaN(e)){e="";for(let t=0;t<o.length;t++){let a=o.charCodeAt(t);if(o[t].search(Vh.hanidec)!==-1)e+=tU.indexOf(o[t]);else for(let i in Jz){let[r,s]=Jz[i];a>=r&&a<=s&&(e+=a-r)}}return parseInt(e,10)}else return e}var Ph=new Map;function iU(){Ph.clear()}function Ct({numberingSystem:o},e=""){let t=o||"latn",a=Ph.get(t);a===void 0&&(a=new Map,Ph.set(t,a));let i=a.get(e);return i===void 0&&(i=new RegExp(`${Vh[t]}${e}`),a.set(e,i)),i}var Kz=()=>Date.now(),Zz="system",Xz=null,e0=null,o0=null,t0=60,a0,i0=null,Ae=class{static get now(){return Kz}static set now(e){Kz=e}static set defaultZone(e){Zz=e}static get defaultZone(){return ii(Zz,mc.instance)}static get defaultLocale(){return Xz}static set defaultLocale(e){Xz=e}static get defaultNumberingSystem(){return e0}static set defaultNumberingSystem(e){e0=e}static get defaultOutputCalendar(){return o0}static set defaultOutputCalendar(e){o0=e}static get defaultWeekSettings(){return i0}static set defaultWeekSettings(e){i0=Hh(e)}static get twoDigitCutoffYear(){return t0}static set twoDigitCutoffYear(e){t0=e%100}static get throwOnInvalid(){return a0}static set throwOnInvalid(e){a0=e}static resetCaches(){be.resetCache(),qa.resetCache(),ze.resetCache(),iU()}},Oo=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},Y0=[0,31,59,90,120,151,181,212,243,273,304,334],V0=[0,31,60,91,121,152,182,213,244,274,305,335];function nt(o,e){return new Oo("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${o}, which is invalid`)}function $h(o,e,t){let a=new Date(Date.UTC(o,e-1,t));o<100&&o>=0&&a.setUTCFullYear(a.getUTCFullYear()-1900);let i=a.getUTCDay();return i===0?7:i}function $0(o,e,t){return t+(uc(o)?V0:Y0)[e-1]}function W0(o,e){let t=uc(o)?V0:Y0,a=t.findIndex(r=>r<e),i=e-t[a];return{month:a+1,day:i}}function Wh(o,e){return(o-e+7)%7+1}function Gl(o,e=4,t=1){let{year:a,month:i,day:r}=o,s=$0(a,i,r),n=Wh($h(a,i,r),t),c=Math.floor((s-n+14-e)/7),m;return c<1?(m=a-1,c=lc(m,e,t)):c>lc(a,e,t)?(m=a+1,c=1):m=a,{weekYear:m,weekNumber:c,weekday:n,...Zl(o)}}function r0(o,e=4,t=1){let{weekYear:a,weekNumber:i,weekday:r}=o,s=Wh($h(a,1,e),t),n=bs(a),c=i*7+r-s-7+e,m;c<1?(m=a-1,c+=bs(m)):c>n?(m=a+1,c-=bs(a)):m=a;let{month:l,day:u}=W0(m,c);return{year:m,month:l,day:u,...Zl(o)}}function zh(o){let{year:e,month:t,day:a}=o,i=$0(e,t,a);return{year:e,ordinal:i,...Zl(o)}}function s0(o){let{year:e,ordinal:t}=o,{month:a,day:i}=W0(e,t);return{year:e,month:a,day:i,...Zl(o)}}function n0(o,e){if(!V(o.localWeekday)||!V(o.localWeekNumber)||!V(o.localWeekYear)){if(!V(o.weekday)||!V(o.weekNumber)||!V(o.weekYear))throw new ri("Cannot mix locale-based week fields with ISO-based week fields");return V(o.localWeekday)||(o.weekday=o.localWeekday),V(o.localWeekNumber)||(o.weekNumber=o.localWeekNumber),V(o.localWeekYear)||(o.weekYear=o.localWeekYear),delete o.localWeekday,delete o.localWeekNumber,delete o.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function rU(o,e=4,t=1){let a=Wl(o.weekYear),i=ct(o.weekNumber,1,lc(o.weekYear,e,t)),r=ct(o.weekday,1,7);return a?i?r?!1:nt("weekday",o.weekday):nt("week",o.weekNumber):nt("weekYear",o.weekYear)}function sU(o){let e=Wl(o.year),t=ct(o.ordinal,1,bs(o.year));return e?t?!1:nt("ordinal",o.ordinal):nt("year",o.year)}function J0(o){let e=Wl(o.year),t=ct(o.month,1,12),a=ct(o.day,1,Yl(o.year,o.month));return e?t?a?!1:nt("day",o.day):nt("month",o.month):nt("year",o.year)}function K0(o){let{hour:e,minute:t,second:a,millisecond:i}=o,r=ct(e,0,23)||e===24&&t===0&&a===0&&i===0,s=ct(t,0,59),n=ct(a,0,59),c=ct(i,0,999);return r?s?n?c?!1:nt("millisecond",i):nt("second",a):nt("minute",t):nt("hour",e)}function V(o){return typeof o>"u"}function si(o){return typeof o=="number"}function Wl(o){return typeof o=="number"&&o%1===0}function nU(o){return typeof o=="string"}function cU(o){return Object.prototype.toString.call(o)==="[object Date]"}function Z0(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function X0(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function mU(o){return Array.isArray(o)?o:[o]}function c0(o,e,t){if(o.length!==0)return o.reduce((a,i)=>{let r=[e(i),i];return a&&t(a[0],r[0])===a[0]?a:r},null)[1]}function lU(o,e){return e.reduce((t,a)=>(t[a]=o[a],t),{})}function ks(o,e){return Object.prototype.hasOwnProperty.call(o,e)}function Hh(o){if(o==null)return null;if(typeof o!="object")throw new $e("Week settings must be an object");if(!ct(o.firstDay,1,7)||!ct(o.minimalDays,1,7)||!Array.isArray(o.weekend)||o.weekend.some(e=>!ct(e,1,7)))throw new $e("Invalid week settings");return{firstDay:o.firstDay,minimalDays:o.minimalDays,weekend:Array.from(o.weekend)}}function ct(o,e,t){return Wl(o)&&o>=e&&o<=t}function uU(o,e){return o-e*Math.floor(o/e)}function Ue(o,e=2){let t=o<0,a;return t?a="-"+(""+-o).padStart(e,"0"):a=(""+o).padStart(e,"0"),a}function ai(o){if(!(V(o)||o===null||o===""))return parseInt(o,10)}function or(o){if(!(V(o)||o===null||o===""))return parseFloat(o)}function Jh(o){if(!(V(o)||o===null||o==="")){let e=parseFloat("0."+o)*1e3;return Math.floor(e)}}function Kh(o,e,t="round"){let a=10**e;switch(t){case"expand":return o>0?Math.ceil(o*a)/a:Math.floor(o*a)/a;case"trunc":return Math.trunc(o*a)/a;case"round":return Math.round(o*a)/a;case"floor":return Math.floor(o*a)/a;case"ceil":return Math.ceil(o*a)/a;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function uc(o){return o%4===0&&(o%100!==0||o%400===0)}function bs(o){return uc(o)?366:365}function Yl(o,e){let t=uU(e-1,12)+1,a=o+(e-t)/12;return t===2?uc(a)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Jl(o){let e=Date.UTC(o.year,o.month-1,o.day,o.hour,o.minute,o.second,o.millisecond);return o.year<100&&o.year>=0&&(e=new Date(e),e.setUTCFullYear(o.year,o.month-1,o.day)),+e}function m0(o,e,t){return-Wh($h(o,1,e),t)+e-1}function lc(o,e=4,t=1){let a=m0(o,e,t),i=m0(o+1,e,t);return(bs(o)-a+i)/7}function Gh(o){return o>99?o:o>Ae.twoDigitCutoffYear?1900+o:2e3+o}function eq(o,e,t,a=null){let i=new Date(o),r={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};a&&(r.timeZone=a);let s={timeZoneName:e,...r},n=new Intl.DateTimeFormat(t,s).formatToParts(i).find(c=>c.type.toLowerCase()==="timezonename");return n?n.value:null}function Kl(o,e){let t=parseInt(o,10);Number.isNaN(t)&&(t=0);let a=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-a:a;return t*60+i}function oq(o){let e=Number(o);if(typeof o=="boolean"||o===""||!Number.isFinite(e))throw new $e(`Invalid unit value ${o}`);return e}function Vl(o,e){let t={};for(let a in o)if(ks(o,a)){let i=o[a];if(i==null)continue;t[e(a)]=oq(i)}return t}function cc(o,e){let t=Math.trunc(Math.abs(o/60)),a=Math.trunc(Math.abs(o%60)),i=o>=0?"+":"-";switch(e){case"short":return`${i}${Ue(t,2)}:${Ue(a,2)}`;case"narrow":return`${i}${t}${a>0?`:${a}`:""}`;case"techie":return`${i}${Ue(t,2)}${Ue(a,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Zl(o){return lU(o,["hour","minute","second","millisecond"])}var dU=["January","February","March","April","May","June","July","August","September","October","November","December"],tq=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],gU=["J","F","M","A","M","J","J","A","S","O","N","D"];function aq(o){switch(o){case"narrow":return[...gU];case"short":return[...tq];case"long":return[...dU];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var iq=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],rq=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],pU=["M","T","W","T","F","S","S"];function sq(o){switch(o){case"narrow":return[...pU];case"short":return[...rq];case"long":return[...iq];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var nq=["AM","PM"],hU=["Before Christ","Anno Domini"],fU=["BC","AD"],bU=["B","A"];function cq(o){switch(o){case"narrow":return[...bU];case"short":return[...fU];case"long":return[...hU];default:return null}}function yU(o){return nq[o.hour<12?0:1]}function kU(o,e){return sq(e)[o.weekday-1]}function AU(o,e){return aq(e)[o.month-1]}function wU(o,e){return cq(e)[o.year<0?0:1]}function vU(o,e,t="always",a=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},r=["hours","minutes","seconds"].indexOf(o)===-1;if(t==="auto"&&r){let u=o==="days";switch(e){case 1:return u?"tomorrow":`next ${i[o][0]}`;case-1:return u?"yesterday":`last ${i[o][0]}`;case 0:return u?"today":`this ${i[o][0]}`}}let s=Object.is(e,-0)||e<0,n=Math.abs(e),c=n===1,m=i[o],l=a?c?m[1]:m[2]||m[1]:c?i[o][0]:o;return s?`${n} ${l} ago`:`in ${n} ${l}`}function l0(o,e){let t="";for(let a of o)a.literal?t+=a.val:t+=e(a.val);return t}var xU={D:Pl,DD:q0,DDD:E0,DDDD:I0,t:C0,tt:j0,ttt:B0,tttt:Q0,T:S0,TT:D0,TTT:T0,TTTT:R0,f:N0,ff:O0,fff:_0,ffff:F0,F:U0,FF:M0,FFF:L0,FFFF:P0},Uo=class o{static create(e,t={}){return new o(e,t)}static parseFormat(e){let t=null,a="",i=!1,r=[];for(let s=0;s<e.length;s++){let n=e.charAt(s);n==="'"?((a.length>0||i)&&r.push({literal:i||/^\s+$/.test(a),val:a===""?"'":a}),t=null,a="",i=!i):i||n===t?a+=n:(a.length>0&&r.push({literal:/^\s+$/.test(a),val:a}),a=n,t=n)}return a.length>0&&r.push({literal:i||/^\s+$/.test(a),val:a}),r}static macroTokenToFormatOpts(e){return xU[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,a=void 0){if(this.opts.forceSimple)return Ue(e,t);let i={...this.opts};return t>0&&(i.padTo=t),a&&(i.signDisplay=a),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,t){let a=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",r=(g,p)=>this.loc.extract(e,g,p),s=g=>e.isOffsetFixed&&e.offset===0&&g.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,g.format):"",n=()=>a?yU(e):r({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(g,p)=>a?AU(e,g):r(p?{month:g}:{month:g,day:"numeric"},"month"),m=(g,p)=>a?kU(e,g):r(p?{weekday:g}:{weekday:g,month:"long",day:"numeric"},"weekday"),l=g=>{let p=o.macroTokenToFormatOpts(g);return p?this.formatWithSystemDefault(e,p):g},u=g=>a?wU(e,g):r({era:g},"era"),d=g=>{switch(g){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return n();case"d":return i?r({day:"numeric"},"day"):this.num(e.day);case"dd":return i?r({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return m("short",!0);case"cccc":return m("long",!0);case"ccccc":return m("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return m("short",!1);case"EEEE":return m("long",!1);case"EEEEE":return m("narrow",!1);case"L":return i?r({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?r({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return i?r({month:"numeric"},"month"):this.num(e.month);case"MM":return i?r({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return i?r({year:"numeric"},"year"):this.num(e.year);case"yy":return i?r({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?r({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?r({year:"numeric"},"year"):this.num(e.year,6);case"G":return u("short");case"GG":return u("long");case"GGGGG":return u("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return l(g)}};return l0(o.parseFormat(t),d)}formatDurationFromString(e,t){let a=this.opts.signMode==="negativeLargestOnly"?-1:1,i=l=>{switch(l[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},r=(l,u)=>d=>{let g=i(d);if(g){let p=u.isNegativeDuration&&g!==u.largestUnit?a:1,b;return this.opts.signMode==="negativeLargestOnly"&&g!==u.largestUnit?b="never":this.opts.signMode==="all"?b="always":b="auto",this.num(l.get(g)*p,d.length,b)}else return d},s=o.parseFormat(t),n=s.reduce((l,{literal:u,val:d})=>u?l:l.concat(d),[]),c=e.shiftTo(...n.map(i).filter(l=>l)),m={isNegativeDuration:c<0,largestUnit:Object.keys(c.values)[0]};return l0(s,r(c,m))}},mq=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function As(...o){let e=o.reduce((t,a)=>t+a.source,"");return RegExp(`^${e}$`)}function ws(...o){return e=>o.reduce(([t,a,i],r)=>{let[s,n,c]=r(e,i);return[{...t,...s},n||a,c]},[{},null,1]).slice(0,2)}function vs(o,...e){if(o==null)return[null,null];for(let[t,a]of e){let i=t.exec(o);if(i)return a(i)}return[null,null]}function lq(...o){return(e,t)=>{let a={},i;for(i=0;i<o.length;i++)a[o[i]]=ai(e[t+i]);return[a,null,t+i]}}var uq=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,zU=`(?:${uq.source}?(?:\\[(${mq.source})\\])?)?`,Zh=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,dq=RegExp(`${Zh.source}${zU}`),Xh=RegExp(`(?:[Tt]${dq.source})?`),qU=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,EU=/(\d{4})-?W(\d\d)(?:-?(\d))?/,IU=/(\d{4})-?(\d{3})/,CU=lq("weekYear","weekNumber","weekDay"),jU=lq("year","ordinal"),BU=/(\d{4})-(\d\d)-(\d\d)/,gq=RegExp(`${Zh.source} ?(?:${uq.source}|(${mq.source}))?`),QU=RegExp(`(?: ${gq.source})?`);function ys(o,e,t){let a=o[e];return V(a)?t:ai(a)}function SU(o,e){return[{year:ys(o,e),month:ys(o,e+1,1),day:ys(o,e+2,1)},null,e+3]}function xs(o,e){return[{hours:ys(o,e,0),minutes:ys(o,e+1,0),seconds:ys(o,e+2,0),milliseconds:Jh(o[e+3])},null,e+4]}function dc(o,e){let t=!o[e]&&!o[e+1],a=Kl(o[e+1],o[e+2]),i=t?null:_o.instance(a);return[{},i,e+3]}function gc(o,e){let t=o[e]?qa.create(o[e]):null;return[{},t,e+1]}var DU=RegExp(`^T?${Zh.source}$`),TU=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function RU(o){let[e,t,a,i,r,s,n,c,m]=o,l=e[0]==="-",u=c&&c[0]==="-",d=(g,p=!1)=>g!==void 0&&(p||g&&l)?-g:g;return[{years:d(or(t)),months:d(or(a)),weeks:d(or(i)),days:d(or(r)),hours:d(or(s)),minutes:d(or(n)),seconds:d(or(c),c==="-0"),milliseconds:d(Jh(m),u)}]}var NU={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function ef(o,e,t,a,i,r,s){let n={year:e.length===2?Gh(ai(e)):ai(e),month:tq.indexOf(t)+1,day:ai(a),hour:ai(i),minute:ai(r)};return s&&(n.second=ai(s)),o&&(n.weekday=o.length>3?iq.indexOf(o)+1:rq.indexOf(o)+1),n}var UU=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function OU(o){let[,e,t,a,i,r,s,n,c,m,l,u]=o,d=ef(e,i,a,t,r,s,n),g;return c?g=NU[c]:m?g=0:g=Kl(l,u),[d,new _o(g)]}function MU(o){return o.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var _U=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,LU=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,FU=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function u0(o){let[,e,t,a,i,r,s,n]=o;return[ef(e,i,a,t,r,s,n),_o.utcInstance]}function PU(o){let[,e,t,a,i,r,s,n]=o;return[ef(e,n,t,a,i,r,s),_o.utcInstance]}var HU=As(qU,Xh),GU=As(EU,Xh),YU=As(IU,Xh),VU=As(dq),pq=ws(SU,xs,dc,gc),$U=ws(CU,xs,dc,gc),WU=ws(jU,xs,dc,gc),JU=ws(xs,dc,gc);function KU(o){return vs(o,[HU,pq],[GU,$U],[YU,WU],[VU,JU])}function ZU(o){return vs(MU(o),[UU,OU])}function XU(o){return vs(o,[_U,u0],[LU,u0],[FU,PU])}function eO(o){return vs(o,[TU,RU])}var oO=ws(xs);function tO(o){return vs(o,[DU,oO])}var aO=As(BU,QU),iO=As(gq),rO=ws(xs,dc,gc);function sO(o){return vs(o,[aO,pq],[iO,rO])}var d0="Invalid Duration",hq={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},nO={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...hq},st=146097/400,ps=146097/4800,cO={years:{quarters:4,months:12,weeks:st/7,days:st,hours:st*24,minutes:st*24*60,seconds:st*24*60*60,milliseconds:st*24*60*60*1e3},quarters:{months:3,weeks:st/28,days:st/4,hours:st*24/4,minutes:st*24*60/4,seconds:st*24*60*60/4,milliseconds:st*24*60*60*1e3/4},months:{weeks:ps/7,days:ps,hours:ps*24,minutes:ps*24*60,seconds:ps*24*60*60,milliseconds:ps*24*60*60*1e3},...hq},ar=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],mO=ar.slice(0).reverse();function xa(o,e,t=!1){let a={values:t?e.values:{...o.values,...e.values||{}},loc:o.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||o.conversionAccuracy,matrix:e.matrix||o.matrix};return new Fe(a)}function fq(o,e){var t;let a=(t=e.milliseconds)!=null?t:0;for(let i of mO.slice(1))e[i]&&(a+=e[i]*o[i].milliseconds);return a}function g0(o,e){let t=fq(o,e)<0?-1:1;ar.reduceRight((a,i)=>{if(V(e[i]))return a;if(a){let r=e[a]*t,s=o[i][a],n=Math.floor(r/s);e[i]+=n*t,e[a]-=n*s*t}return i},null),ar.reduce((a,i)=>{if(V(e[i]))return a;if(a){let r=e[a]%1;e[a]-=r,e[i]+=r*o[a][i]}return i},null)}function p0(o){let e={};for(let[t,a]of Object.entries(o))a!==0&&(e[t]=a);return e}var Fe=class o{constructor(e){let t=e.conversionAccuracy==="longterm"||!1,a=t?cO:nO;e.matrix&&(a=e.matrix),this.values=e.values,this.loc=e.loc||be.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=a,this.isLuxonDuration=!0}static fromMillis(e,t){return o.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new $e(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new o({values:Vl(e,o.normalizeUnit),loc:be.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(si(e))return o.fromMillis(e);if(o.isDuration(e))return e;if(typeof e=="object")return o.fromObject(e);throw new $e(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){let[a]=eO(e);return a?o.fromObject(a,t):o.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){let[a]=tO(e);return a?o.fromObject(a,t):o.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new $e("need to specify a reason the Duration is invalid");let a=e instanceof Oo?e:new Oo(e,t);if(Ae.throwOnInvalid)throw new Sh(a);return new o({invalid:a})}static normalizeUnit(e){let t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Fl(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){let a={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?Uo.create(this.loc,a).formatDurationFromString(this,e):d0}toHuman(e={}){if(!this.isValid)return d0;let t=e.showZeros!==!1,a=ar.map(i=>{let r=this.values[i];return V(r)||r===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(r)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(a)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Kh(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},ze.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?fq(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let t=o.fromDurationLike(e),a={};for(let i of ar)(ks(t.values,i)||ks(this.values,i))&&(a[i]=t.get(i)+this.get(i));return xa(this,{values:a},!0)}minus(e){if(!this.isValid)return this;let t=o.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let a of Object.keys(this.values))t[a]=oq(e(this.values[a],a));return xa(this,{values:t},!0)}get(e){return this[o.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let t={...this.values,...Vl(e,o.normalizeUnit)};return xa(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:a,matrix:i}={}){let s={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:i,conversionAccuracy:a};return xa(this,s)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return g0(this.matrix,e),xa(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=p0(this.normalize().shiftToAll().toObject());return xa(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(s=>o.normalizeUnit(s));let t={},a={},i=this.toObject(),r;for(let s of ar)if(e.indexOf(s)>=0){r=s;let n=0;for(let m in a)n+=this.matrix[m][s]*a[m],a[m]=0;si(i[s])&&(n+=i[s]);let c=Math.trunc(n);t[s]=c,a[s]=(n*1e3-c*1e3)/1e3}else si(i[s])&&(a[s]=i[s]);for(let s in a)a[s]!==0&&(t[r]+=s===r?a[s]:a[s]/this.matrix[r][s]);return g0(this.matrix,t),xa(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return xa(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=p0(this.values);return xa(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(a,i){return a===void 0||a===0?i===void 0||i===0:a===i}for(let a of ar)if(!t(this.values[a],e.values[a]))return!1;return!0}},hs="Invalid Interval";function lO(o,e){return!o||!o.isValid?rr.invalid("missing or invalid start"):!e||!e.isValid?rr.invalid("missing or invalid end"):e<o?rr.invalid("end before start",`The end of an interval must be after its start, but you had start=${o.toISO()} and end=${e.toISO()}`):null}var rr=class o{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new $e("need to specify a reason the Interval is invalid");let a=e instanceof Oo?e:new Oo(e,t);if(Ae.throwOnInvalid)throw new Qh(a);return new o({invalid:a})}static fromDateTimes(e,t){let a=ic(e),i=ic(t),r=lO(a,i);return r??new o({start:a,end:i})}static after(e,t){let a=Fe.fromDurationLike(t),i=ic(e);return o.fromDateTimes(i,i.plus(a))}static before(e,t){let a=Fe.fromDurationLike(t),i=ic(e);return o.fromDateTimes(i.minus(a),i)}static fromISO(e,t){let[a,i]=(e||"").split("/",2);if(a&&i){let r,s;try{r=ze.fromISO(a,t),s=r.isValid}catch{s=!1}let n,c;try{n=ze.fromISO(i,t),c=n.isValid}catch{c=!1}if(s&&c)return o.fromDateTimes(r,n);if(s){let m=Fe.fromISO(i,t);if(m.isValid)return o.after(r,m)}else if(c){let m=Fe.fromISO(a,t);if(m.isValid)return o.before(n,m)}}return o.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;let a=this.start.startOf(e,t),i;return t!=null&&t.useLocaleWeeks?i=this.end.reconfigure({locale:a.locale}):i=this.end,i=i.startOf(e,t),Math.floor(i.diff(a,e).get(e))+(i.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?o.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];let t=e.map(ic).filter(s=>this.contains(s)).sort((s,n)=>s.toMillis()-n.toMillis()),a=[],{s:i}=this,r=0;for(;i<this.e;){let s=t[r]||this.e,n=+s>+this.e?this.e:s;a.push(o.fromDateTimes(i,n)),i=n,r+=1}return a}splitBy(e){let t=Fe.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:a}=this,i=1,r,s=[];for(;a<this.e;){let n=this.start.plus(t.mapUnits(c=>c*i));r=+n>+this.e?this.e:n,s.push(o.fromDateTimes(a,r)),a=r,i+=1}return s}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let t=this.s>e.s?this.s:e.s,a=this.e<e.e?this.e:e.e;return t>=a?null:o.fromDateTimes(t,a)}union(e){if(!this.isValid)return this;let t=this.s<e.s?this.s:e.s,a=this.e>e.e?this.e:e.e;return o.fromDateTimes(t,a)}static merge(e){let[t,a]=e.sort((i,r)=>i.s-r.s).reduce(([i,r],s)=>r?r.overlaps(s)||r.abutsStart(s)?[i,r.union(s)]:[i.concat([r]),s]:[i,s],[[],null]);return a&&t.push(a),t}static xor(e){let t=null,a=0,i=[],r=e.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),s=Array.prototype.concat(...r),n=s.sort((c,m)=>c.time-m.time);for(let c of n)a+=c.type==="s"?1:-1,a===1?t=c.time:(t&&+t!=+c.time&&i.push(o.fromDateTimes(t,c.time)),t=null);return o.merge(i)}difference(...e){return o.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:hs}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Pl,t={}){return this.isValid?Uo.create(this.s.loc.clone(t),e).formatInterval(this):hs}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:hs}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:hs}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:hs}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:hs}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Fe.invalid(this.invalidReason)}mapEndpoints(e){return o.fromDateTimes(e(this.s),e(this.e))}},ir=class{static hasDST(e=Ae.defaultZone){let t=ze.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return qa.isValidZone(e)}static normalizeZone(e){return ii(e,Ae.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||be.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||be.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||be.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:a=null,locObj:i=null,outputCalendar:r="gregory"}={}){return(i||be.create(t,a,r)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:a=null,locObj:i=null,outputCalendar:r="gregory"}={}){return(i||be.create(t,a,r)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:a=null,locObj:i=null}={}){return(i||be.create(t,a,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:a=null,locObj:i=null}={}){return(i||be.create(t,a,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return be.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return be.create(t,null,"gregory").eras(e)}static features(){return{relative:Z0(),localeWeek:X0()}}};function h0(o,e){let t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),a=t(e)-t(o);return Math.floor(Fe.fromMillis(a).as("days"))}function uO(o,e,t){let a=[["years",(c,m)=>m.year-c.year],["quarters",(c,m)=>m.quarter-c.quarter+(m.year-c.year)*4],["months",(c,m)=>m.month-c.month+(m.year-c.year)*12],["weeks",(c,m)=>{let l=h0(c,m);return(l-l%7)/7}],["days",h0]],i={},r=o,s,n;for(let[c,m]of a)t.indexOf(c)>=0&&(s=c,i[c]=m(o,e),n=r.plus(i),n>e?(i[c]--,o=r.plus(i),o>e&&(n=o,i[c]--,o=r.plus(i))):o=n);return[o,i,n,s]}function dO(o,e,t,a){let[i,r,s,n]=uO(o,e,t),c=e-i,m=t.filter(u=>["hours","minutes","seconds","milliseconds"].indexOf(u)>=0);m.length===0&&(s<e&&(s=i.plus({[n]:1})),s!==i&&(r[n]=(r[n]||0)+c/(s-i)));let l=Fe.fromObject(r,a);return m.length>0?Fe.fromMillis(c,a).shiftTo(...m).plus(l):l}var gO="missing Intl.DateTimeFormat.formatToParts support";function me(o,e=t=>t){return{regex:o,deser:([t])=>e(aU(t))}}var pO="\xA0",bq=`[ ${pO}]`,yq=new RegExp(bq,"g");function hO(o){return o.replace(/\./g,"\\.?").replace(yq,bq)}function f0(o){return o.replace(/\./g,"").replace(yq," ").toLowerCase()}function jt(o,e){return o===null?null:{regex:RegExp(o.map(hO).join("|")),deser:([t])=>o.findIndex(a=>f0(t)===f0(a))+e}}function b0(o,e){return{regex:o,deser:([,t,a])=>Kl(t,a),groups:e}}function Nl(o){return{regex:o,deser:([e])=>e}}function fO(o){return o.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function bO(o,e){let t=Ct(e),a=Ct(e,"{2}"),i=Ct(e,"{3}"),r=Ct(e,"{4}"),s=Ct(e,"{6}"),n=Ct(e,"{1,2}"),c=Ct(e,"{1,3}"),m=Ct(e,"{1,6}"),l=Ct(e,"{1,9}"),u=Ct(e,"{2,4}"),d=Ct(e,"{4,6}"),g=A=>({regex:RegExp(fO(A.val)),deser:([k])=>k,literal:!0}),b=(A=>{if(o.literal)return g(A);switch(A.val){case"G":return jt(e.eras("short"),0);case"GG":return jt(e.eras("long"),0);case"y":return me(m);case"yy":return me(u,Gh);case"yyyy":return me(r);case"yyyyy":return me(d);case"yyyyyy":return me(s);case"M":return me(n);case"MM":return me(a);case"MMM":return jt(e.months("short",!0),1);case"MMMM":return jt(e.months("long",!0),1);case"L":return me(n);case"LL":return me(a);case"LLL":return jt(e.months("short",!1),1);case"LLLL":return jt(e.months("long",!1),1);case"d":return me(n);case"dd":return me(a);case"o":return me(c);case"ooo":return me(i);case"HH":return me(a);case"H":return me(n);case"hh":return me(a);case"h":return me(n);case"mm":return me(a);case"m":return me(n);case"q":return me(n);case"qq":return me(a);case"s":return me(n);case"ss":return me(a);case"S":return me(c);case"SSS":return me(i);case"u":return Nl(l);case"uu":return Nl(n);case"uuu":return me(t);case"a":return jt(e.meridiems(),0);case"kkkk":return me(r);case"kk":return me(u,Gh);case"W":return me(n);case"WW":return me(a);case"E":case"c":return me(t);case"EEE":return jt(e.weekdays("short",!1),1);case"EEEE":return jt(e.weekdays("long",!1),1);case"ccc":return jt(e.weekdays("short",!0),1);case"cccc":return jt(e.weekdays("long",!0),1);case"Z":case"ZZ":return b0(new RegExp(`([+-]${n.source})(?::(${a.source}))?`),2);case"ZZZ":return b0(new RegExp(`([+-]${n.source})(${a.source})?`),2);case"z":return Nl(/[a-z_+-/]{1,256}?/i);case" ":return Nl(/[^\S\n\r]/);default:return g(A)}})(o)||{invalidReason:gO};return b.token=o,b}var yO={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function kO(o,e,t){let{type:a,value:i}=o;if(a==="literal"){let c=/^\s+$/.test(i);return{literal:!c,val:c?" ":i}}let r=e[a],s=a;a==="hour"&&(e.hour12!=null?s=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?s="hour12":s="hour24":s=t.hour12?"hour12":"hour24");let n=yO[s];if(typeof n=="object"&&(n=n[r]),n)return{literal:!1,val:n}}function AO(o){return[`^${o.map(t=>t.regex).reduce((t,a)=>`${t}(${a.source})`,"")}$`,o]}function wO(o,e,t){let a=o.match(e);if(a){let i={},r=1;for(let s in t)if(ks(t,s)){let n=t[s],c=n.groups?n.groups+1:1;!n.literal&&n.token&&(i[n.token.val[0]]=n.deser(a.slice(r,r+c))),r+=c}return[a,i]}else return[a,{}]}function vO(o){let e=r=>{switch(r){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},t=null,a;return V(o.z)||(t=qa.create(o.z)),V(o.Z)||(t||(t=new _o(o.Z)),a=o.Z),V(o.q)||(o.M=(o.q-1)*3+1),V(o.h)||(o.h<12&&o.a===1?o.h+=12:o.h===12&&o.a===0&&(o.h=0)),o.G===0&&o.y&&(o.y=-o.y),V(o.u)||(o.S=Jh(o.u)),[Object.keys(o).reduce((r,s)=>{let n=e(s);return n&&(r[n]=o[s]),r},{}),t,a]}var qh=null;function xO(){return qh||(qh=ze.fromMillis(1555555555555)),qh}function zO(o,e){if(o.literal)return o;let t=Uo.macroTokenToFormatOpts(o.val),a=wq(t,e);return a==null||a.includes(void 0)?o:a}function kq(o,e){return Array.prototype.concat(...o.map(t=>zO(t,e)))}var $l=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=kq(Uo.parseFormat(t),e),this.units=this.tokens.map(a=>bO(a,e)),this.disqualifyingUnit=this.units.find(a=>a.invalidReason),!this.disqualifyingUnit){let[a,i]=AO(this.units);this.regex=RegExp(a,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){let[t,a]=wO(e,this.regex,this.handlers),[i,r,s]=a?vO(a):[null,null,void 0];if(ks(a,"a")&&ks(a,"H"))throw new ri("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:a,result:i,zone:r,specificOffset:s}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function Aq(o,e,t){return new $l(o,t).explainFromTokens(e)}function qO(o,e,t){let{result:a,zone:i,specificOffset:r,invalidReason:s}=Aq(o,e,t);return[a,i,r,s]}function wq(o,e){if(!o)return null;let a=Uo.create(e,o).dtFormatter(xO()),i=a.formatToParts(),r=a.resolvedOptions();return i.map(s=>kO(s,o,r))}var Eh="Invalid DateTime",y0=864e13;function sc(o){return new Oo("unsupported zone",`the zone "${o.name}" is not supported`)}function Ih(o){return o.weekData===null&&(o.weekData=Gl(o.c)),o.weekData}function Ch(o){return o.localWeekData===null&&(o.localWeekData=Gl(o.c,o.loc.getMinDaysInFirstWeek(),o.loc.getStartOfWeek())),o.localWeekData}function tr(o,e){let t={ts:o.ts,zone:o.zone,c:o.c,o:o.o,loc:o.loc,invalid:o.invalid};return new ze({...t,...e,old:t})}function vq(o,e,t){let a=o-e*60*1e3,i=t.offset(a);if(e===i)return[a,e];a-=(i-e)*60*1e3;let r=t.offset(a);return i===r?[a,i]:[o-Math.min(i,r)*60*1e3,Math.max(i,r)]}function Ul(o,e){o+=e*60*1e3;let t=new Date(o);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Ml(o,e,t){return vq(Jl(o),e,t)}function k0(o,e){let t=o.o,a=o.c.year+Math.trunc(e.years),i=o.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,r={...o.c,year:a,month:i,day:Math.min(o.c.day,Yl(a,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},s=Fe.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),n=Jl(r),[c,m]=vq(n,t,o.zone);return s!==0&&(c+=s,m=o.zone.offset(c)),{ts:c,o:m}}function fs(o,e,t,a,i,r){let{setZone:s,zone:n}=t;if(o&&Object.keys(o).length!==0||e){let c=e||n,m=ze.fromObject(o,{...t,zone:c,specificOffset:r});return s?m:m.setZone(n)}else return ze.invalid(new Oo("unparsable",`the input "${i}" can't be parsed as ${a}`))}function Ol(o,e,t=!0){return o.isValid?Uo.create(be.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(o,e):null}function jh(o,e,t){let a=o.c.year>9999||o.c.year<0,i="";if(a&&o.c.year>=0&&(i+="+"),i+=Ue(o.c.year,a?6:4),t==="year")return i;if(e){if(i+="-",i+=Ue(o.c.month),t==="month")return i;i+="-"}else if(i+=Ue(o.c.month),t==="month")return i;return i+=Ue(o.c.day),i}function A0(o,e,t,a,i,r,s){let n=!t||o.c.millisecond!==0||o.c.second!==0,c="";switch(s){case"day":case"month":case"year":break;default:if(c+=Ue(o.c.hour),s==="hour")break;if(e){if(c+=":",c+=Ue(o.c.minute),s==="minute")break;n&&(c+=":",c+=Ue(o.c.second))}else{if(c+=Ue(o.c.minute),s==="minute")break;n&&(c+=Ue(o.c.second))}if(s==="second")break;n&&(!a||o.c.millisecond!==0)&&(c+=".",c+=Ue(o.c.millisecond,3))}return i&&(o.isOffsetFixed&&o.offset===0&&!r?c+="Z":o.o<0?(c+="-",c+=Ue(Math.trunc(-o.o/60)),c+=":",c+=Ue(Math.trunc(-o.o%60))):(c+="+",c+=Ue(Math.trunc(o.o/60)),c+=":",c+=Ue(Math.trunc(o.o%60)))),r&&(c+="["+o.zone.ianaName+"]"),c}var xq={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},EO={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},IO={ordinal:1,hour:0,minute:0,second:0,millisecond:0},_l=["year","month","day","hour","minute","second","millisecond"],CO=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],jO=["year","ordinal","hour","minute","second","millisecond"];function Ll(o){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[o.toLowerCase()];if(!e)throw new Fl(o);return e}function w0(o){switch(o.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Ll(o)}}function BO(o){if(nc===void 0&&(nc=Ae.now()),o.type!=="iana")return o.offset(nc);let e=o.name,t=Yh.get(e);return t===void 0&&(t=o.offset(nc),Yh.set(e,t)),t}function v0(o,e){let t=ii(e.zone,Ae.defaultZone);if(!t.isValid)return ze.invalid(sc(t));let a=be.fromObject(e),i,r;if(V(o.year))i=Ae.now();else{for(let c of _l)V(o[c])&&(o[c]=xq[c]);let s=J0(o)||K0(o);if(s)return ze.invalid(s);let n=BO(t);[i,r]=Ml(o,n,t)}return new ze({ts:i,zone:t,loc:a,o:r})}function x0(o,e,t){let a=V(t.round)?!0:t.round,i=V(t.rounding)?"trunc":t.rounding,r=(n,c)=>(n=Kh(n,a||t.calendary?0:2,t.calendary?"round":i),e.loc.clone(t).relFormatter(t).format(n,c)),s=n=>t.calendary?e.hasSame(o,n)?0:e.startOf(n).diff(o.startOf(n),n).get(n):e.diff(o,n).get(n);if(t.unit)return r(s(t.unit),t.unit);for(let n of t.units){let c=s(n);if(Math.abs(c)>=1)return r(c,n)}return r(o>e?-0:0,t.units[t.units.length-1])}function z0(o){let e={},t;return o.length>0&&typeof o[o.length-1]=="object"?(e=o[o.length-1],t=Array.from(o).slice(0,o.length-1)):t=Array.from(o),[e,t]}var nc,Yh=new Map,ze=class o{constructor(e){let t=e.zone||Ae.defaultZone,a=e.invalid||(Number.isNaN(e.ts)?new Oo("invalid input"):null)||(t.isValid?null:sc(t));this.ts=V(e.ts)?Ae.now():e.ts;let i=null,r=null;if(!a)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[i,r]=[e.old.c,e.old.o];else{let n=si(e.o)&&!e.old?e.o:t.offset(this.ts);i=Ul(this.ts,n),a=Number.isNaN(i.year)?new Oo("invalid input"):null,i=a?null:i,r=a?null:n}this._zone=t,this.loc=e.loc||be.create(),this.invalid=a,this.weekData=null,this.localWeekData=null,this.c=i,this.o=r,this.isLuxonDateTime=!0}static now(){return new o({})}static local(){let[e,t]=z0(arguments),[a,i,r,s,n,c,m]=t;return v0({year:a,month:i,day:r,hour:s,minute:n,second:c,millisecond:m},e)}static utc(){let[e,t]=z0(arguments),[a,i,r,s,n,c,m]=t;return e.zone=_o.utcInstance,v0({year:a,month:i,day:r,hour:s,minute:n,second:c,millisecond:m},e)}static fromJSDate(e,t={}){let a=cU(e)?e.valueOf():NaN;if(Number.isNaN(a))return o.invalid("invalid input");let i=ii(t.zone,Ae.defaultZone);return i.isValid?new o({ts:a,zone:i,loc:be.fromObject(t)}):o.invalid(sc(i))}static fromMillis(e,t={}){if(si(e))return e<-y0||e>y0?o.invalid("Timestamp out of range"):new o({ts:e,zone:ii(t.zone,Ae.defaultZone),loc:be.fromObject(t)});throw new $e(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(si(e))return new o({ts:e*1e3,zone:ii(t.zone,Ae.defaultZone),loc:be.fromObject(t)});throw new $e("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};let a=ii(t.zone,Ae.defaultZone);if(!a.isValid)return o.invalid(sc(a));let i=be.fromObject(t),r=Vl(e,w0),{minDaysInFirstWeek:s,startOfWeek:n}=n0(r,i),c=Ae.now(),m=V(t.specificOffset)?a.offset(c):t.specificOffset,l=!V(r.ordinal),u=!V(r.year),d=!V(r.month)||!V(r.day),g=u||d,p=r.weekYear||r.weekNumber;if((g||l)&&p)throw new ri("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&l)throw new ri("Can't mix ordinal dates with month/day");let b=p||r.weekday&&!g,A,k,x=Ul(c,m);b?(A=CO,k=EO,x=Gl(x,s,n)):l?(A=jO,k=IO,x=zh(x)):(A=_l,k=xq);let v=!1;for(let oe of A){let te=r[oe];V(te)?v?r[oe]=k[oe]:r[oe]=x[oe]:v=!0}let j=b?rU(r,s,n):l?sU(r):J0(r),I=j||K0(r);if(I)return o.invalid(I);let T=b?r0(r,s,n):l?s0(r):r,[D,O]=Ml(T,m,a),S=new o({ts:D,zone:a,o:O,loc:i});return r.weekday&&g&&e.weekday!==S.weekday?o.invalid("mismatched weekday",`you can't specify both a weekday of ${r.weekday} and a date of ${S.toISO()}`):S.isValid?S:o.invalid(S.invalid)}static fromISO(e,t={}){let[a,i]=KU(e);return fs(a,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){let[a,i]=ZU(e);return fs(a,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){let[a,i]=XU(e);return fs(a,i,t,"HTTP",t)}static fromFormat(e,t,a={}){if(V(e)||V(t))throw new $e("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:r=null}=a,s=be.fromOpts({locale:i,numberingSystem:r,defaultToEN:!0}),[n,c,m,l]=qO(s,e,t);return l?o.invalid(l):fs(n,c,a,`format ${t}`,e,m)}static fromString(e,t,a={}){return o.fromFormat(e,t,a)}static fromSQL(e,t={}){let[a,i]=sO(e);return fs(a,i,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new $e("need to specify a reason the DateTime is invalid");let a=e instanceof Oo?e:new Oo(e,t);if(Ae.throwOnInvalid)throw new Bh(a);return new o({invalid:a})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let a=wq(e,be.fromObject(t));return a?a.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return kq(Uo.parseFormat(e),be.fromObject(t)).map(i=>i.val).join("")}static resetCache(){nc=void 0,Yh.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Ih(this).weekYear:NaN}get weekNumber(){return this.isValid?Ih(this).weekNumber:NaN}get weekday(){return this.isValid?Ih(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Ch(this).weekday:NaN}get localWeekNumber(){return this.isValid?Ch(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Ch(this).weekYear:NaN}get ordinal(){return this.isValid?zh(this.c).ordinal:NaN}get monthShort(){return this.isValid?ir.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?ir.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?ir.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?ir.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,t=6e4,a=Jl(this.c),i=this.zone.offset(a-e),r=this.zone.offset(a+e),s=this.zone.offset(a-i*t),n=this.zone.offset(a-r*t);if(s===n)return[this];let c=a-s*t,m=a-n*t,l=Ul(c,s),u=Ul(m,n);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[tr(this,{ts:c}),tr(this,{ts:m})]:[this]}get isInLeapYear(){return uc(this.year)}get daysInMonth(){return Yl(this.year,this.month)}get daysInYear(){return this.isValid?bs(this.year):NaN}get weeksInWeekYear(){return this.isValid?lc(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?lc(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:a,calendar:i}=Uo.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:a,outputCalendar:i}}toUTC(e=0,t={}){return this.setZone(_o.instance(e),t)}toLocal(){return this.setZone(Ae.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:a=!1}={}){if(e=ii(e,Ae.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(t||a){let r=e.offset(this.ts),s=this.toObject();[i]=Ml(s,r,e)}return tr(this,{ts:i,zone:e})}else return o.invalid(sc(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:a}={}){let i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:a});return tr(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=Vl(e,w0),{minDaysInFirstWeek:a,startOfWeek:i}=n0(t,this.loc),r=!V(t.weekYear)||!V(t.weekNumber)||!V(t.weekday),s=!V(t.ordinal),n=!V(t.year),c=!V(t.month)||!V(t.day),m=n||c,l=t.weekYear||t.weekNumber;if((m||s)&&l)throw new ri("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new ri("Can't mix ordinal dates with month/day");let u;r?u=r0({...Gl(this.c,a,i),...t},a,i):V(t.ordinal)?(u={...this.toObject(),...t},V(t.day)&&(u.day=Math.min(Yl(u.year,u.month),u.day))):u=s0({...zh(this.c),...t});let[d,g]=Ml(u,this.o,this.zone);return tr(this,{ts:d,o:g})}plus(e){if(!this.isValid)return this;let t=Fe.fromDurationLike(e);return tr(this,k0(this,t))}minus(e){if(!this.isValid)return this;let t=Fe.fromDurationLike(e).negate();return tr(this,k0(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let a={},i=Fe.normalizeUnit(e);switch(i){case"years":a.month=1;case"quarters":case"months":a.day=1;case"weeks":case"days":a.hour=0;case"hours":a.minute=0;case"minutes":a.second=0;case"seconds":a.millisecond=0;break}if(i==="weeks")if(t){let r=this.loc.getStartOfWeek(),{weekday:s}=this;s<r&&(a.weekNumber=this.weekNumber-1),a.weekday=r}else a.weekday=1;if(i==="quarters"){let r=Math.ceil(this.month/3);a.month=(r-1)*3+1}return this.set(a)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?Uo.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Eh}toLocaleString(e=Pl,t={}){return this.isValid?Uo.create(this.loc.clone(t),e).formatDateTime(this):Eh}toLocaleParts(e={}){return this.isValid?Uo.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:a=!1,includeOffset:i=!0,extendedZone:r=!1,precision:s="milliseconds"}={}){if(!this.isValid)return null;s=Ll(s);let n=e==="extended",c=jh(this,n,s);return _l.indexOf(s)>=3&&(c+="T"),c+=A0(this,n,t,a,i,r,s),c}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?jh(this,e==="extended",Ll(t)):null}toISOWeekDate(){return Ol(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:a=!0,includePrefix:i=!1,extendedZone:r=!1,format:s="extended",precision:n="milliseconds"}={}){return this.isValid?(n=Ll(n),(i&&_l.indexOf(n)>=3?"T":"")+A0(this,s==="extended",t,e,a,r,n)):null}toRFC2822(){return Ol(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Ol(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?jh(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:a=!0}={}){let i="HH:mm:ss.SSS";return(t||e)&&(a&&(i+=" "),t?i+="z":e&&(i+="ZZ")),Ol(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Eh}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",a={}){if(!this.isValid||!e.isValid)return Fe.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...a},r=mU(t).map(Fe.normalizeUnit),s=e.valueOf()>this.valueOf(),n=s?this:e,c=s?e:this,m=dO(n,c,r,i);return s?m.negate():m}diffNow(e="milliseconds",t={}){return this.diff(o.now(),e,t)}until(e){return this.isValid?rr.fromDateTimes(this,e):this}hasSame(e,t,a){if(!this.isValid)return!1;let i=e.valueOf(),r=this.setZone(e.zone,{keepLocalTime:!0});return r.startOf(t,a)<=i&&i<=r.endOf(t,a)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let t=e.base||o.fromObject({},{zone:this.zone}),a=e.padding?this<t?-e.padding:e.padding:0,i=["years","months","days","hours","minutes","seconds"],r=e.unit;return Array.isArray(e.unit)&&(i=e.unit,r=void 0),x0(t,this.plus(a),{...e,numeric:"always",units:i,unit:r})}toRelativeCalendar(e={}){return this.isValid?x0(e.base||o.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(o.isDateTime))throw new $e("min requires all arguments be DateTimes");return c0(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(o.isDateTime))throw new $e("max requires all arguments be DateTimes");return c0(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,a={}){let{locale:i=null,numberingSystem:r=null}=a,s=be.fromOpts({locale:i,numberingSystem:r,defaultToEN:!0});return Aq(s,e,t)}static fromStringExplain(e,t,a={}){return o.fromFormatExplain(e,t,a)}static buildFormatParser(e,t={}){let{locale:a=null,numberingSystem:i=null}=t,r=be.fromOpts({locale:a,numberingSystem:i,defaultToEN:!0});return new $l(r,e)}static fromFormatParser(e,t,a={}){if(V(e)||V(t))throw new $e("fromFormatParser requires an input string and a format parser");let{locale:i=null,numberingSystem:r=null}=a,s=be.fromOpts({locale:i,numberingSystem:r,defaultToEN:!0});if(!s.equals(t.locale))throw new $e(`fromFormatParser called with a locale of ${s}, but the format parser was created for ${t.locale}`);let{result:n,zone:c,specificOffset:m,invalidReason:l}=t.explainFromTokens(e);return l?o.invalid(l):fs(n,c,a,`format ${t.format}`,e,m)}static get DATE_SHORT(){return Pl}static get DATE_MED(){return q0}static get DATE_MED_WITH_WEEKDAY(){return _N}static get DATE_FULL(){return E0}static get DATE_HUGE(){return I0}static get TIME_SIMPLE(){return C0}static get TIME_WITH_SECONDS(){return j0}static get TIME_WITH_SHORT_OFFSET(){return B0}static get TIME_WITH_LONG_OFFSET(){return Q0}static get TIME_24_SIMPLE(){return S0}static get TIME_24_WITH_SECONDS(){return D0}static get TIME_24_WITH_SHORT_OFFSET(){return T0}static get TIME_24_WITH_LONG_OFFSET(){return R0}static get DATETIME_SHORT(){return N0}static get DATETIME_SHORT_WITH_SECONDS(){return U0}static get DATETIME_MED(){return O0}static get DATETIME_MED_WITH_SECONDS(){return M0}static get DATETIME_MED_WITH_WEEKDAY(){return LN}static get DATETIME_FULL(){return _0}static get DATETIME_FULL_WITH_SECONDS(){return L0}static get DATETIME_HUGE(){return F0}static get DATETIME_HUGE_WITH_SECONDS(){return P0}};function ic(o){if(ze.isDateTime(o))return o;if(o&&o.valueOf&&si(o.valueOf()))return ze.fromJSDate(o);if(o&&typeof o=="object")return ze.fromObject(o);throw new $e(`Unknown datetime argument: ${o}, of type ${typeof o}`)}var QO="3.7.2";Lo.DateTime=ze;Lo.Duration=Fe;Lo.FixedOffsetZone=_o;Lo.IANAZone=qa;Lo.Info=ir;Lo.Interval=rr;Lo.InvalidZone=Hl;Lo.Settings=Ae;Lo.SystemZone=mc;Lo.VERSION=QO;Lo.Zone=ni});var ou=y(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.CronDate=ho.DAYS_IN_MONTH=ho.DateMathOp=ho.TimeUnit=void 0;var sr=zq(),io;(function(o){o.Second="Second",o.Minute="Minute",o.Hour="Hour",o.Day="Day",o.Month="Month",o.Year="Year"})(io||(ho.TimeUnit=io={}));var Xl;(function(o){o.Add="Add",o.Subtract="Subtract"})(Xl||(ho.DateMathOp=Xl={}));ho.DAYS_IN_MONTH=Object.freeze([31,29,31,30,31,30,31,31,30,31,30,31]);var eu=class o{#e;#o=null;#a=null;#i={add:{[io.Year]:this.addYear.bind(this),[io.Month]:this.addMonth.bind(this),[io.Day]:this.addDay.bind(this),[io.Hour]:this.addHour.bind(this),[io.Minute]:this.addMinute.bind(this),[io.Second]:this.addSecond.bind(this)},subtract:{[io.Year]:this.subtractYear.bind(this),[io.Month]:this.subtractMonth.bind(this),[io.Day]:this.subtractDay.bind(this),[io.Hour]:this.subtractHour.bind(this),[io.Minute]:this.subtractMinute.bind(this),[io.Second]:this.subtractSecond.bind(this)}};constructor(e,t){let a={zone:t};if(e?e instanceof o?(this.#e=e.#e,this.#o=e.#o,this.#a=e.#a):e instanceof Date?this.#e=sr.DateTime.fromJSDate(e,a):typeof e=="number"?this.#e=sr.DateTime.fromMillis(e,a):(this.#e=sr.DateTime.fromISO(e,a),this.#e.isValid||(this.#e=sr.DateTime.fromRFC2822(e,a)),this.#e.isValid||(this.#e=sr.DateTime.fromSQL(e,a)),this.#e.isValid||(this.#e=sr.DateTime.fromFormat(e,"EEE, d MMM yyyy HH:mm:ss",a))):this.#e=sr.DateTime.local(),!this.#e.isValid)throw new Error(`CronDate: unhandled timestamp: ${e}`);t&&t!==this.#e.zoneName&&(this.#e=this.#e.setZone(t))}static#r(e){return e%4===0&&e%100!==0||e%400===0}get dstStart(){return this.#o}set dstStart(e){this.#o=e}get dstEnd(){return this.#a}set dstEnd(e){this.#a=e}addYear(){this.#e=this.#e.plus({years:1})}addMonth(){this.#e=this.#e.plus({months:1}).startOf("month")}addDay(){this.#e=this.#e.plus({days:1}).startOf("day")}addHour(){this.#e=this.#e.plus({hours:1}).startOf("hour")}addMinute(){this.#e=this.#e.plus({minutes:1}).startOf("minute")}addSecond(){this.#e=this.#e.plus({seconds:1})}subtractYear(){this.#e=this.#e.minus({years:1})}subtractMonth(){this.#e=this.#e.minus({months:1}).endOf("month").startOf("second")}subtractDay(){this.#e=this.#e.minus({days:1}).endOf("day").startOf("second")}subtractHour(){this.#e=this.#e.minus({hours:1}).endOf("hour").startOf("second")}subtractMinute(){this.#e=this.#e.minus({minutes:1}).endOf("minute").startOf("second")}subtractSecond(){this.#e=this.#e.minus({seconds:1})}addUnit(e){this.#i.add[e]()}subtractUnit(e){this.#i.subtract[e]()}invokeDateOperation(e,t){if(e===Xl.Add){this.addUnit(t);return}if(e===Xl.Subtract){this.subtractUnit(t);return}throw new Error(`Invalid verb: ${e}`)}getDate(){return this.#e.day}getFullYear(){return this.#e.year}getDay(){let e=this.#e.weekday;return e===7?0:e}getMonth(){return this.#e.month-1}getHours(){return this.#e.hour}getMinutes(){return this.#e.minute}getSeconds(){return this.#e.second}getMilliseconds(){return this.#e.millisecond}getUTCOffset(){return this.#e.offset}setStartOfDay(){this.#e=this.#e.startOf("day")}setEndOfDay(){this.#e=this.#e.endOf("day")}getTime(){return this.#e.valueOf()}getUTCDate(){return this.#t().day}getUTCFullYear(){return this.#t().year}getUTCDay(){let e=this.#t().weekday;return e===7?0:e}getUTCMonth(){return this.#t().month-1}getUTCHours(){return this.#t().hour}getUTCMinutes(){return this.#t().minute}getUTCSeconds(){return this.#t().second}toISOString(){return this.#e.toUTC().toISO()}toJSON(){return this.#e.toJSON()}setDate(e){this.#e=this.#e.set({day:e})}setFullYear(e){this.#e=this.#e.set({year:e})}setDay(e){this.#e=this.#e.set({weekday:e})}setMonth(e){this.#e=this.#e.set({month:e+1})}setHours(e){this.#e=this.#e.set({hour:e})}setMinutes(e){this.#e=this.#e.set({minute:e})}setSeconds(e){this.#e=this.#e.set({second:e})}setMilliseconds(e){this.#e=this.#e.set({millisecond:e})}toString(){return this.toDate().toString()}toDate(){return this.#e.toJSDate()}isLastDayOfMonth(){let{day:e,month:t}=this.#e;if(t===2){let a=o.#r(this.#e.year);return e===ho.DAYS_IN_MONTH[t-1]-(a?0:1)}return e===ho.DAYS_IN_MONTH[t-1]}isLastWeekdayOfMonth(){let{day:e,month:t}=this.#e,a;return t===2?a=ho.DAYS_IN_MONTH[t-1]-(o.#r(this.#e.year)?0:1):a=ho.DAYS_IN_MONTH[t-1],e>a-7}applyDateOperation(e,t,a){if(t===io.Month||t===io.Day){this.invokeDateOperation(e,t);return}let i=this.getHours();this.invokeDateOperation(e,t);let r=this.getHours(),s=r-i;s===2?a!==24&&(this.dstStart=r):s===0&&this.getMinutes()===0&&this.getSeconds()===0&&a!==24&&(this.dstEnd=r)}#t(){return this.#e.toUTC()}};ho.CronDate=eu;ho.default=eu});var qq=y(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.CronMonth=void 0;var SO=ou(),DO=ti(),TO=1,RO=12,NO=Object.freeze([]),of=class extends DO.CronField{static get min(){return TO}static get max(){return RO}static get chars(){return NO}static get daysInMonth(){return SO.DAYS_IN_MONTH}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}};tu.CronMonth=of});var Eq=y(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.CronSecond=void 0;var UO=ti(),OO=0,MO=59,_O=Object.freeze([]),tf=class extends UO.CronField{static get min(){return OO}static get max(){return MO}static get chars(){return _O}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}};au.CronSecond=tf});var iu=y(zo=>{"use strict";var LO=zo&&zo.__createBinding||(Object.create?(function(o,e,t,a){a===void 0&&(a=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(o,a,i)}):(function(o,e,t,a){a===void 0&&(a=t),o[a]=e[t]})),ci=zo&&zo.__exportStar||function(o,e){for(var t in o)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&LO(e,o,t)};Object.defineProperty(zo,"__esModule",{value:!0});ci(Hz(),zo);ci(Gz(),zo);ci(Yz(),zo);ci(ti(),zo);ci(Vz(),zo);ci($z(),zo);ci(qq(),zo);ci(Eq(),zo)});var rf=y(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.CronFieldCollection=void 0;var mt=iu(),af=class o{#e;#o;#a;#i;#r;#t;static from(e,t){return new o({second:this.resolveField(mt.CronSecond,e.second,t.second),minute:this.resolveField(mt.CronMinute,e.minute,t.minute),hour:this.resolveField(mt.CronHour,e.hour,t.hour),dayOfMonth:this.resolveField(mt.CronDayOfMonth,e.dayOfMonth,t.dayOfMonth),month:this.resolveField(mt.CronMonth,e.month,t.month),dayOfWeek:this.resolveField(mt.CronDayOfWeek,e.dayOfWeek,t.dayOfWeek)})}static resolveField(e,t,a){return a?a instanceof mt.CronField?a:new e(a):t}constructor({second:e,minute:t,hour:a,dayOfMonth:i,month:r,dayOfWeek:s}){if(!e)throw new Error("Validation error, Field second is missing");if(!t)throw new Error("Validation error, Field minute is missing");if(!a)throw new Error("Validation error, Field hour is missing");if(!i)throw new Error("Validation error, Field dayOfMonth is missing");if(!r)throw new Error("Validation error, Field month is missing");if(!s)throw new Error("Validation error, Field dayOfWeek is missing");if(r.values.length===1&&!i.hasLastChar&&!(parseInt(i.values[0],10)<=mt.CronMonth.daysInMonth[r.values[0]-1]))throw new Error("Invalid explicit day of month definition");this.#e=e,this.#o=t,this.#a=a,this.#r=r,this.#t=s,this.#i=i}get second(){return this.#e}get minute(){return this.#o}get hour(){return this.#a}get dayOfMonth(){return this.#i}get month(){return this.#r}get dayOfWeek(){return this.#t}static compactField(e){if(e.length===0)return[];let t=[],a;return e.forEach((i,r,s)=>{if(a===void 0){a={start:i,count:1};return}let n=s[r-1]||a.start,c=s[r+1];if(i==="L"||i==="W"){t.push(a),t.push({start:i,count:1}),a=void 0;return}if(a.step===void 0&&c!==void 0){let m=i-n,l=c-i;if(m<=l){a={...a,count:2,end:i,step:m};return}a.step=1}i-(a.end??0)===a.step?(a.count++,a.end=i):(a.count===1?t.push({start:a.start,count:1}):a.count===2?(t.push({start:a.start,count:1}),t.push({start:a.end??n,count:1})):t.push(a),a={start:i,count:1})}),a&&t.push(a),t}static#c(e,t,a){let i=t.step;return i?i===1&&t.start===e.min&&t.end&&t.end>=a?e.hasQuestionMarkChar?"?":"*":i!==1&&t.start===e.min&&t.end&&t.end>=a-i+1?`*/${i}`:null:null}static#s(e,t){let a=e.step;if(a===1)return`${e.start}-${e.end}`;let i=e.start===0?e.count-1:e.count;if(!a)throw new Error("Unexpected range step");if(!e.end)throw new Error("Unexpected range end");if(a*i>e.end){let r=(n,c)=>{if(typeof e.start!="number")throw new Error("Unexpected range start");return c%a===0?e.start+c:null};if(typeof e.start!="number")throw new Error("Unexpected range start");let s={length:e.end-e.start+1};return Array.from(s,r).filter(n=>n!==null).join(",")}return e.end===t-a+1?`${e.start}/${a}`:`${e.start}-${e.end}/${a}`}stringifyField(e){let t=e.max,a=e.values;if(e instanceof mt.CronDayOfWeek){t=6;let r=this.#t.values;a=r[r.length-1]===7?r.slice(0,-1):r}e instanceof mt.CronDayOfMonth&&(t=this.#r.values.length===1?mt.CronMonth.daysInMonth[this.#r.values[0]-1]:e.max);let i=o.compactField(a);if(i.length===1){let r=o.#c(e,i[0],t);if(r)return r}return i.map(r=>{let s=r.count===1?r.start.toString():o.#s(r,t);return e instanceof mt.CronDayOfWeek&&e.nthDay>0?`${s}#${e.nthDay}`:s}).join(",")}stringify(e=!1){let t=[];return e&&t.push(this.stringifyField(this.#e)),t.push(this.stringifyField(this.#o),this.stringifyField(this.#a),this.stringifyField(this.#i),this.stringifyField(this.#r),this.stringifyField(this.#t)),t.join(" ")}serialize(){return{second:this.#e.serialize(),minute:this.#o.serialize(),hour:this.#a.serialize(),dayOfMonth:this.#i.serialize(),month:this.#r.serialize(),dayOfWeek:this.#t.serialize()}}};ru.CronFieldCollection=af});var sf=y(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.CronExpression=lt.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=lt.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=void 0;var je=ou();lt.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE="Out of the time span range";lt.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE="Invalid expression, loop limit exceeded";var Iq=1e4,su=class o{#e;#o;#a;#i;#r;#t;#c=null;#s=!1;constructor(e,t){this.#e=t,this.#o=t.tz,this.#i=t.startDate?new je.CronDate(t.startDate,this.#o):null,this.#r=t.endDate?new je.CronDate(t.endDate,this.#o):null;let a=t.currentDate??t.startDate;if(a){let i=new je.CronDate(a,this.#o);this.#i&&i.getTime()<this.#i.getTime()?a=this.#i:this.#r&&i.getTime()>this.#r.getTime()&&(a=this.#r)}this.#a=new je.CronDate(a,this.#o),this.#t=e}get fields(){return this.#t}static fieldsToExpression(e,t){return new o(e,t||{})}static#n(e,t){return t.some(a=>a===e)}#m(e,t){return e[t?e.length-1:0]}#u(e){let t=`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`;if(this.#c===t)return this.#s;let a=new je.CronDate(e);a.setStartOfDay();let i=new je.CronDate(e);return i.setEndOfDay(),this.#c=t,this.#s=a.getUTCOffset()!==i.getUTCOffset(),this.#s}#l(e,t,a){let i=this.#t.second.values,r=e.getSeconds(),s=this.#t.second.findNearestValue(r,a);if(s!==null){e.setSeconds(s);return}e.applyDateOperation(t,je.TimeUnit.Minute,this.#t.hour.values.length),e.setSeconds(this.#m(i,a))}#d(e,t,a){let i=this.#t.minute.values,r=this.#t.second.values,s=e.getMinutes(),n=this.#t.minute.findNearestValue(s,a);if(n!==null){e.setMinutes(n),e.setSeconds(this.#m(r,a));return}e.applyDateOperation(t,je.TimeUnit.Hour,this.#t.hour.values.length),e.setMinutes(this.#m(i,a)),e.setSeconds(this.#m(r,a))}static#p(e,t){let a=t.isLastWeekdayOfMonth();return e.some(i=>{let r=parseInt(i.toString().charAt(0),10)%7;if(Number.isNaN(r))throw new Error(`Invalid last weekday of the month expression: ${i}`);return t.getDay()===r&&a})}next(){return this.#f()}prev(){return this.#f(!0)}hasNext(){let e=this.#a;try{return this.#f(),!0}catch{return!1}finally{this.#a=e}}hasPrev(){let e=this.#a;try{return this.#f(!0),!0}catch{return!1}finally{this.#a=e}}take(e){let t=[];if(e>=0)for(let a=0;a<e;a++)try{t.push(this.next())}catch{return t}else for(let a=0;a>e;a--)try{t.push(this.prev())}catch{return t}return t}reset(e){this.#a=new je.CronDate(e||this.#e.currentDate)}stringify(e=!1){return this.#t.stringify(e)}includesDate(e){let{second:t,minute:a,hour:i,month:r}=this.#t,s=new je.CronDate(e,this.#o);return!(!t.values.includes(s.getSeconds())||!a.values.includes(s.getMinutes())||!i.values.includes(s.getHours())||!r.values.includes(s.getMonth()+1)||!this.#g(s)||this.#t.dayOfWeek.nthDay>0&&Math.ceil(s.getDate()/7)!==this.#t.dayOfWeek.nthDay)}toString(){return this.#e.expression||this.stringify(!0)}#g(e){let t=this.#t.dayOfMonth.isWildcard,a=!t,i=this.#t.dayOfWeek.isWildcard,r=!i,s=o.#n(e.getDate(),this.#t.dayOfMonth.values)||this.#t.dayOfMonth.hasLastChar&&e.isLastDayOfMonth(),n=o.#n(e.getDay(),this.#t.dayOfWeek.values)||this.#t.dayOfWeek.hasLastChar&&o.#p(this.#t.dayOfWeek.values,e);return!!(a&&r&&(s||n)||s&&!r||t&&!i&&n)}#b(e,t,a){let i=this.#t.hour.values,r=i,s=e.getHours(),n=o.#n(s,i),c=e.dstStart===s,m=e.dstEnd===s;if(c)return o.#n(s-1,i)?!0:(e.invokeDateOperation(t,je.TimeUnit.Hour),!1);if(m&&!a)return e.dstEnd=null,e.applyDateOperation(je.DateMathOp.Add,je.TimeUnit.Hour,r.length),!1;if(n)return!0;e.dstStart=null;let l=this.#t.hour.findNearestValue(s,a);if(l===null)return e.applyDateOperation(t,je.TimeUnit.Day,r.length),!1;if(this.#u(e)){let u=a?s-l:l-s;for(let d=0;d<u;d++)e.applyDateOperation(t,je.TimeUnit.Hour,r.length)}else e.setHours(l);return e.setMinutes(this.#m(this.#t.minute.values,a)),e.setSeconds(this.#m(this.#t.second.values,a)),!1}#h(e){if(!this.#i&&!this.#r)return;let t=e.getTime();if(this.#i&&t<this.#i.getTime())throw new Error(lt.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE);if(this.#r&&t>this.#r.getTime())throw new Error(lt.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE)}#f(e=!1){let t=e?je.DateMathOp.Subtract:je.DateMathOp.Add,a=new je.CronDate(this.#a),i=a.getTime(),r=0;for(;++r<Iq;){if(this.#h(a),!this.#g(a)){a.applyDateOperation(t,je.TimeUnit.Day,this.#t.hour.values.length);continue}if(!(this.#t.dayOfWeek.nthDay<=0||Math.ceil(a.getDate()/7)===this.#t.dayOfWeek.nthDay)){a.applyDateOperation(t,je.TimeUnit.Day,this.#t.hour.values.length);continue}if(!o.#n(a.getMonth()+1,this.#t.month.values)){a.applyDateOperation(t,je.TimeUnit.Month,this.#t.hour.values.length);continue}if(this.#b(a,t,e)){if(!o.#n(a.getMinutes(),this.#t.minute.values)){this.#d(a,t,e);continue}if(!o.#n(a.getSeconds(),this.#t.second.values)){this.#l(a,t,e);continue}if(i===a.getTime()){(t==="Add"||a.getMilliseconds()===0)&&a.applyDateOperation(t,je.TimeUnit.Second,this.#t.hour.values.length);continue}break}}if(r>Iq)throw new Error(lt.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE);return a.getMilliseconds()!==0&&a.setMilliseconds(0),this.#a=a,a}[Symbol.iterator](){return{next:()=>({value:this.#f(),done:!this.hasNext()})}}};lt.CronExpression=su;lt.default=su});var Cq=y(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});nf.seededRandom=HO;function FO(o){let e=2166136261;for(let t=0;t<o.length;t++)e^=o.charCodeAt(t),e=Math.imul(e,16777619);return()=>e>>>0}function PO(o){return()=>{let e=o+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function HO(o){let e=o?FO(o)():Math.floor(Math.random()*1e10);return PO(e)}});var nu=y(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.CronExpressionParser=gt.DayOfWeek=gt.Months=gt.CronUnit=gt.PredefinedExpressions=void 0;var GO=rf(),YO=sf(),VO=Cq(),ut=iu(),cf;(function(o){o["@yearly"]="0 0 0 1 1 *",o["@annually"]="0 0 0 1 1 *",o["@monthly"]="0 0 0 1 * *",o["@weekly"]="0 0 0 * * 0",o["@daily"]="0 0 0 * * *",o["@hourly"]="0 0 * * * *",o["@minutely"]="0 * * * * *",o["@secondly"]="* * * * * *",o["@weekdays"]="0 0 0 * * 1-5",o["@weekends"]="0 0 0 * * 0,6"})(cf||(gt.PredefinedExpressions=cf={}));var dt;(function(o){o.Second="Second",o.Minute="Minute",o.Hour="Hour",o.DayOfMonth="DayOfMonth",o.Month="Month",o.DayOfWeek="DayOfWeek"})(dt||(gt.CronUnit=dt={}));var mf;(function(o){o[o.jan=1]="jan",o[o.feb=2]="feb",o[o.mar=3]="mar",o[o.apr=4]="apr",o[o.may=5]="may",o[o.jun=6]="jun",o[o.jul=7]="jul",o[o.aug=8]="aug",o[o.sep=9]="sep",o[o.oct=10]="oct",o[o.nov=11]="nov",o[o.dec=12]="dec"})(mf||(gt.Months=mf={}));var lf;(function(o){o[o.sun=0]="sun",o[o.mon=1]="mon",o[o.tue=2]="tue",o[o.wed=3]="wed",o[o.thu=4]="thu",o[o.fri=5]="fri",o[o.sat=6]="sat"})(lf||(gt.DayOfWeek=lf={}));var uf=class o{static parse(e,t={}){let{strict:a=!1,hashSeed:i}=t,r=(0,VO.seededRandom)(i);e=cf[e]||e;let s=o.#e(e,a);if(!(s.dayOfMonth==="*"||s.dayOfWeek==="*"||!a))throw new Error("Cannot use both dayOfMonth and dayOfWeek together in strict mode!");let n=o.#o(dt.Second,s.second,ut.CronSecond.constraints,r),c=o.#o(dt.Minute,s.minute,ut.CronMinute.constraints,r),m=o.#o(dt.Hour,s.hour,ut.CronHour.constraints,r),l=o.#o(dt.Month,s.month,ut.CronMonth.constraints,r),u=o.#o(dt.DayOfMonth,s.dayOfMonth,ut.CronDayOfMonth.constraints,r),{dayOfWeek:d,nthDayOfWeek:g}=o.#u(s.dayOfWeek),p=o.#o(dt.DayOfWeek,d,ut.CronDayOfWeek.constraints,r),b=new GO.CronFieldCollection({second:new ut.CronSecond(n,{rawValue:s.second}),minute:new ut.CronMinute(c,{rawValue:s.minute}),hour:new ut.CronHour(m,{rawValue:s.hour}),dayOfMonth:new ut.CronDayOfMonth(u,{rawValue:s.dayOfMonth}),month:new ut.CronMonth(l,{rawValue:s.month}),dayOfWeek:new ut.CronDayOfWeek(p,{rawValue:s.dayOfWeek,nthDayOfWeek:g})});return new YO.CronExpression(b,{...t,expression:e})}static#e(e,t){if(t&&!e.length)throw new Error("Invalid cron expression");e=e||"0 * * * * *";let a=e.trim().split(/\s+/);if(t&&a.length<6)throw new Error("Invalid cron expression, expected 6 fields");if(a.length>6)throw new Error("Invalid cron expression, too many fields");let i=["*","*","*","*","*","0"];a.length<i.length&&a.unshift(...i.slice(a.length));let[r,s,n,c,m,l]=a;return{second:r,minute:s,hour:n,dayOfMonth:c,month:m,dayOfWeek:l}}static#o(e,t,a,i){if((e===dt.Month||e===dt.DayOfWeek)&&(t=t.replace(/[a-z]{3}/gi,r=>{r=r.toLowerCase();let s=mf[r]||lf[r];if(s===void 0)throw new Error(`Validation error, cannot resolve alias "${r}"`);return s.toString()})),!a.validChars.test(t))throw new Error(`Invalid characters, got value: ${t}`);return t=this.#a(t,a),t=this.#i(t,a,i),this.#r(e,t,a)}static#a(e,t){return e.replace(/[*?]/g,t.min+"-"+t.max)}static#i(e,t,a){let i=a();return e.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(r,s,n,c)=>{if(s&&n&&c){let m=parseInt(s,10),l=parseInt(n,10),u=parseInt(c,10);if(m>l)throw new Error(`Invalid range: ${m}-${l}, min > max`);if(u<=0)throw new Error(`Invalid step: ${u}, must be positive`);let d=Math.max(m,t.min),g=Math.floor(i*u),p=[];for(let b=Math.floor(d/u)*u+g;b<=l;b+=u)b>=d&&p.push(b);return p.join(",")}else if(s&&n){let m=parseInt(s,10),l=parseInt(n,10);if(m>l)throw new Error(`Invalid range: ${m}-${l}, min > max`);return String(Math.floor(i*(l-m+1))+m)}else if(c){let m=parseInt(c,10);if(m<=0)throw new Error(`Invalid step: ${m}, must be positive`);let l=Math.floor(i*m),u=[];for(let d=Math.floor(t.min/m)*m+l;d<=t.max;d+=m)d>=t.min&&u.push(d);return u.join(",")}else return String(Math.floor(i*(t.max-t.min+1)+t.min))})}static#r(e,t,a){let i=[];function r(n,c){if(Array.isArray(n))i.push(...n);else if(o.#l(c,n))i.push(n);else{let m=parseInt(n.toString(),10);if(!(m>=c.min&&m<=c.max))throw new Error(`Constraint error, got value ${n} expected range ${c.min}-${c.max}`);i.push(e===dt.DayOfWeek?m%7:n)}}return t.split(",").forEach(n=>{if(!(n.length>0))throw new Error("Invalid list value format");r(o.#t(e,n,a),a)}),i}static#t(e,t,a){let i=t.split("/");if(i.length>2)throw new Error(`Invalid repeat: ${t}`);return i.length===2?(isNaN(parseInt(i[0],10))||(i[0]=`${i[0]}-${a.max}`),o.#m(e,i[0],parseInt(i[1],10),a)):o.#m(e,t,1,a)}static#c(e,t,a){if(!(!isNaN(e)&&!isNaN(t)&&e>=a.min&&t<=a.max))throw new Error(`Constraint error, got range ${e}-${t} expected range ${a.min}-${a.max}`);if(e>t)throw new Error(`Invalid range: ${e}-${t}, min(${e}) > max(${t})`)}static#s(e){if(!(!isNaN(e)&&e>0))throw new Error(`Constraint error, cannot repeat at every ${e} time.`)}static#n(e,t,a,i){let r=[];e===dt.DayOfWeek&&a%7===0&&r.push(0);for(let s=t;s<=a;s+=i)r.indexOf(s)===-1&&r.push(s);return r}static#m(e,t,a,i){let r=t.split("-");if(r.length<=1)return isNaN(+t)?t:+t;let[s,n]=r.map(c=>parseInt(c,10));return this.#c(s,n,i),this.#s(a),this.#n(e,s,n,a)}static#u(e){let t=e.split("#");if(t.length<=1)return{dayOfWeek:t[0]};let a=+t[t.length-1],i=e.match(/([,-/])/);if(i!==null)throw new Error(`Constraint error, invalid dayOfWeek \`#\` and \`${i?.[0]}\` special characters are incompatible`);if(!(t.length<=2&&!isNaN(a)&&a>=1&&a<=5))throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return{dayOfWeek:t[0],nthDayOfWeek:a}}static#l(e,t){return e.chars.some(a=>t.toString().includes(a))}};gt.CronExpressionParser=uf});var jq=y(Yt=>{"use strict";var $O=Yt&&Yt.__createBinding||(Object.create?(function(o,e,t,a){a===void 0&&(a=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(o,a,i)}):(function(o,e,t,a){a===void 0&&(a=t),o[a]=e[t]})),WO=Yt&&Yt.__setModuleDefault||(Object.create?(function(o,e){Object.defineProperty(o,"default",{enumerable:!0,value:e})}):function(o,e){o.default=e}),JO=Yt&&Yt.__importStar||(function(){var o=function(e){return o=Object.getOwnPropertyNames||function(t){var a=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(a[a.length]=i);return a},o(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a=o(e),i=0;i<a.length;i++)a[i]!=="default"&&$O(t,e,a[i]);return WO(t,e),t}})();Object.defineProperty(Yt,"__esModule",{value:!0});Yt.CronFileParser=void 0;var KO=nu(),df=class o{static async parseFile(e){let{readFile:t}=await Promise.resolve().then(()=>JO(require("fs/promises"))),a=await t(e,"utf8");return o.#e(a)}static parseFileSync(e){let{readFileSync:t}=require("fs"),a=t(e,"utf8");return o.#e(a)}static#e(e){let t=e.split(`
|
|
@@ -514,7 +514,13 @@ References: https://docs.datahub.com/docs/features \u2014 product context; https
|
|
|
514
514
|
- claude-3-5-sonnet-* (retired Oct 2025)
|
|
515
515
|
- claude-3-opus-20240229 (retired Jan 2026)
|
|
516
516
|
- claude-2.*, claude-3-sonnet-* (retired Jul 2025)
|
|
517
|
-
`},openrouter:{name:"openrouter",apiUrl:"https://openrouter.ai/api/v1",regex:"^.*(openrouter|openrouter\\.ai).*$",icon:"openrouter",docsUrl:"https://openrouter.ai/docs",openApiUrl:"https://openrouter.ai/openapi.json",preferredAuthType:"api_key",keywords:["chat completions","completions","generation","models","embeddings","llm","ai","model routing","openai compatible"],systemSpecificInstructions:"OpenRouter is an OpenAI-compatible routing API \u2014 set baseURL/base_url to https://openrouter.ai/api/v1 when using OpenAI SDKs. Authentication is Bearer token (Authorization: Bearer <key>). Model names must include the provider prefix (e.g. openai/gpt-4o, anthropic/claude-3-5-sonnet); a bare model name silently uses the account default instead of erroring. OpenRouter also accepts optional HTTP-Referer and X-Title headers for dashboard attribution. Per-request generation metadata (cost, tokens, latency) is available after the call via GET /api/v1/generation?id=<generation_id> using the id field from the completion response."},pinecone:{name:"pinecone",apiUrl:"https://api.pinecone.io",regex:"^(.*\\.)?pinecone\\.io(/.*)?$",icon:"/logos/pinecone.svg",docsUrl:"https://docs.pinecone.io/reference",openApiUrl:"https://raw.githubusercontent.com/sigpwned/pinecone-openapi-spec/refs/heads/main/openapi.yml",preferredAuthType:"api_key",keywords:["indexes","vectors","upsert","collections","namespaces","metadata","embeddings","dimensions","pods","replicas","shards","api key"]},zoom:{name:"zoom",apiUrl:"https://api.zoom.us",regex:"^(.*\\.)?zoom\\.us(/.*)?$",icon:"zoom",docsUrl:"https://developers.zoom.us/docs/api",preferredAuthType:"oauth2",oauth:{authUrl:"https://zoom.us/oauth/authorize",tokenUrl:"https://zoom.us/oauth/token",scopes:"user:read user:write meeting:read meeting:write meeting:master recording:read recording:write webinar:read webinar:write chat_message:read chat_message:write chat_channel:read chat_channel:write contact:read report:read report:master dashboard:read"},keywords:["meetings","webinars","users","recordings","chat","channels","messages","participants","registrants","reports","dashboards","rooms","schedule","join","oauth"]},sharepoint:{name:"sharepoint",label:"SharePoint",apiUrl:"https://graph.microsoft.com",regex:"^.*(sharepoint|graph\\.microsoft\\.com.*(sites|drives|driveItem|lists)|learn\\.microsoft\\.com.*graph.*sharepoint).*$",icon:"sharepoint",docsUrl:"https://learn.microsoft.com/en-us/graph/api/resources/sharepoint",preferredAuthType:"oauth2",oauth:{authUrl:"https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize",tokenUrl:"https://login.microsoftonline.com/organizations/oauth2/v2.0/token",scopes:"openid profile email offline_access User.Read Files.
|
|
517
|
+
`},openrouter:{name:"openrouter",apiUrl:"https://openrouter.ai/api/v1",regex:"^.*(openrouter|openrouter\\.ai).*$",icon:"openrouter",docsUrl:"https://openrouter.ai/docs",openApiUrl:"https://openrouter.ai/openapi.json",preferredAuthType:"api_key",keywords:["chat completions","completions","generation","models","embeddings","llm","ai","model routing","openai compatible"],systemSpecificInstructions:"OpenRouter is an OpenAI-compatible routing API \u2014 set baseURL/base_url to https://openrouter.ai/api/v1 when using OpenAI SDKs. Authentication is Bearer token (Authorization: Bearer <key>). Model names must include the provider prefix (e.g. openai/gpt-4o, anthropic/claude-3-5-sonnet); a bare model name silently uses the account default instead of erroring. OpenRouter also accepts optional HTTP-Referer and X-Title headers for dashboard attribution. Per-request generation metadata (cost, tokens, latency) is available after the call via GET /api/v1/generation?id=<generation_id> using the id field from the completion response."},pinecone:{name:"pinecone",apiUrl:"https://api.pinecone.io",regex:"^(.*\\.)?pinecone\\.io(/.*)?$",icon:"/logos/pinecone.svg",docsUrl:"https://docs.pinecone.io/reference",openApiUrl:"https://raw.githubusercontent.com/sigpwned/pinecone-openapi-spec/refs/heads/main/openapi.yml",preferredAuthType:"api_key",keywords:["indexes","vectors","upsert","collections","namespaces","metadata","embeddings","dimensions","pods","replicas","shards","api key"]},zoom:{name:"zoom",apiUrl:"https://api.zoom.us",regex:"^(.*\\.)?zoom\\.us(/.*)?$",icon:"zoom",docsUrl:"https://developers.zoom.us/docs/api",preferredAuthType:"oauth2",oauth:{authUrl:"https://zoom.us/oauth/authorize",tokenUrl:"https://zoom.us/oauth/token",scopes:"user:read user:write meeting:read meeting:write meeting:master recording:read recording:write webinar:read webinar:write chat_message:read chat_message:write chat_channel:read chat_channel:write contact:read report:read report:master dashboard:read"},keywords:["meetings","webinars","users","recordings","chat","channels","messages","participants","registrants","reports","dashboards","rooms","schedule","join","oauth"]},sharepoint:{name:"sharepoint",label:"SharePoint",apiUrl:"https://graph.microsoft.com",regex:"^.*(sharepoint|graph\\.microsoft\\.com.*(sites|drives|driveItem|lists)|learn\\.microsoft\\.com.*graph.*sharepoint).*$",icon:"sharepoint",docsUrl:"https://learn.microsoft.com/en-us/graph/api/resources/sharepoint",preferredAuthType:"oauth2",oauth:{authUrl:"https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize",tokenUrl:"https://login.microsoftonline.com/organizations/oauth2/v2.0/token",scopes:"openid profile email offline_access User.Read Files.ReadWrite.All Sites.ReadWrite.All Sites.Manage.All",client_id:"b4bf6bc2-5b30-4eea-b3eb-ca138d2d69fc",credentialTemplateId:"microsoft"},keywords:["sharepoint","sites","document libraries","files","folders","lists","drive items","microsoft graph","office 365","oauth"],systemSpecificInstructions:"SharePoint uses Microsoft Graph with a work or school account. Tenant policy can require administrator approval. Add the admin-consent scope Group.ReadWrite.All only when strictly needed, for example to manage group-connected sites."},microsoftTeams:{name:"microsoftTeams",label:"Microsoft Teams",apiUrl:"https://graph.microsoft.com",regex:"^.*(microsoft.*teams|teams\\.microsoft\\.com|graph\\.microsoft\\.com.*(teams|chats|channels|chatMessage)|learn\\.microsoft\\.com.*graph.*teams).*$",icon:"/logos/microsoft_teams.svg",docsUrl:"https://learn.microsoft.com/en-us/graph/teams-concept-overview",preferredAuthType:"oauth2",oauth:{authUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/token",scopes:"openid profile email offline_access User.Read User.ReadBasic.All Team.ReadBasic.All Team.Create Channel.ReadBasic.All Channel.Create ChannelMessage.Read.All ChannelMessage.Send Chat.ReadWrite TeamMember.ReadWrite.All Group.ReadWrite.All Calendars.ReadWrite",client_id:"b4bf6bc2-5b30-4eea-b3eb-ca138d2d69fc",credentialTemplateId:"microsoft"},keywords:["microsoft teams","teams","team","channel","chat","message","conversation","microsoft graph","office 365","oauth"],systemSpecificInstructions:`Teams uses delegated Microsoft Graph access for work or school accounts. The default scopes include Channel.Create, ChannelMessage.Read.All, Group.ReadWrite.All and TeamMember.ReadWrite.All, which need tenant administrator consent; remove them when the tool does not need them and consent fails.
|
|
518
|
+
|
|
519
|
+
PAGINATION: Teams endpoints ignore $skip and $count. Page only with @odata.nextLink and call it verbatim; it already encodes $top, $filter and $orderby. Max $top is 50 for chats, chat messages, channel messages and replies (channel messages default to 20). /me/joinedTeams and /teams/{id}/allChannels accept no $top; read until @odata.nextLink is absent. In superglue use pagination { type: "cursorBased", pageSize: "50", cursorPath: "@odata.nextLink" } and build the whole URL in the step url so the cursor replaces it: url: "<<(sourceData) => sourceData.cursor || 'https://graph.microsoft.com/v1.0/chats/<chat-id>/messages?$top=50'>>". Leave queryParams empty so they are not re-applied to the nextLink. Do not pass cursor as an input variable; payload values override the pagination cursor on every page.
|
|
520
|
+
|
|
521
|
+
QUERY LIMITS: Chat messages support $orderby lastModifiedDateTime or createdDateTime (desc only) and $filter on the same property; $filter is ignored without the matching $orderby. Channel messages support only $top and $expand=replies (first 200 replies inline, more via replies@odata.nextLink) and are sorted by last activity of the whole reply chain, not by creation. /chats supports $expand=members (capped at 25 members) and $expand=lastMessagePreview.
|
|
522
|
+
|
|
523
|
+
RATE LIMITS: 429 with Retry-After. Per app per tenant: 1 request per second on a given chat or channel and 4 per second on a given team. Long backfills of one channel get throttled; keep page size at 50 and retry on Retry-After.`},outlookMail:{name:"outlookMail",label:"Outlook",apiUrl:"https://graph.microsoft.com",regex:"^.*(outlook|graph\\.microsoft\\.com.*(messages|mailFolders|mailboxSettings)|learn\\.microsoft\\.com.*graph.*(mail|message)).*$",icon:"/logos/outlook.svg",docsUrl:"https://learn.microsoft.com/en-us/graph/api/resources/mail-api-overview",preferredAuthType:"oauth2",oauth:{authUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/token",scopes:"openid profile email offline_access User.Read Mail.ReadWrite Mail.Send MailboxSettings.Read Contacts.ReadWrite Calendars.ReadWrite",client_id:"b4bf6bc2-5b30-4eea-b3eb-ca138d2d69fc",credentialTemplateId:"microsoft"},keywords:["outlook","email","mail","mailbox","messages","inbox","drafts","send","attachments","microsoft graph","office 365","oauth"],systemSpecificInstructions:"Outlook uses delegated Microsoft Graph access for work or school accounts. Some permissions require tenant administrator approval. Avoid requesting scopes that need admin consent unless the tool cannot work without them."},powerAutomate:{name:"powerAutomate",label:"Power Automate",apiUrl:"https://api.flow.microsoft.com",regex:"^.*(flow\\.microsoft\\.com|powerautomate|power-automate|api\\.powerplatform\\.com.*powerautomate|learn\\.microsoft\\.com.*power-automate).*$",icon:"/logos/power_automate.svg",docsUrl:"https://learn.microsoft.com/en-us/power-automate/manage-flows-with-code",preferredAuthType:"oauth2",oauth:{authUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/token",scopes:"openid profile email offline_access Activity.Read.All Approvals.Manage.All Approvals.Read.All Flows.Install Flows.Manage.All Flows.Read.All",client_id:"b4bf6bc2-5b30-4eea-b3eb-ca138d2d69fc",credentialTemplateId:"microsoft"},keywords:["power automate","flow","cloud flow","flow run","run history","activity","approval","approvals","approve","reject","trigger","environment","power platform","oauth"],systemSpecificInstructions:"Power Automate uses the delegated Flow service API with a work or school account."},microsoft:{name:"microsoft",apiUrl:"https://graph.microsoft.com",regex:"^.*(microsoft|graph\\.microsoft|office|outlook|live\\.com|sharepoint).*$",icon:"default",docsUrl:"https://learn.microsoft.com/en-us/graph/api/overview",preferredAuthType:"oauth2",oauth:{authUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/token",scopes:"openid profile email offline_access User.Read User.ReadBasic.All Mail.ReadWrite Mail.Send MailboxSettings.Read Calendars.ReadWrite Contacts.ReadWrite Files.ReadWrite.All Sites.ReadWrite.All Sites.Manage.All Notes.ReadWrite.All Tasks.ReadWrite Team.ReadBasic.All Team.Create Channel.ReadBasic.All ChannelMessage.Send Chat.ReadWrite",client_id:"b4bf6bc2-5b30-4eea-b3eb-ca138d2d69fc"},keywords:["users","groups","mail","calendar","contacts","onedrive","sharepoint","teams","planner","tasks","drives","sites","lists","permissions","graph","oauth"],systemSpecificInstructions:"superglue provides a managed multi-tenant Microsoft app (work/school and personal accounts), so no Azure app registration is needed \u2014 authenticate directly via OAuth. The default scopes are user-consentable in most tenants. Add the admin-consent scopes Channel.Create, ChannelMessage.Read.All, Group.ReadWrite.All and TeamMember.ReadWrite.All only when strictly needed. Conditional Access policies can require administrator involvement for other permissions. Always keep offline_access in scopes to receive refresh tokens for long-term access. A custom Entra Web app registration is only needed when an organization requires single-tenant access or its own app governance: register it with the exact OAuth callback URL of the current superglue deployment, use tenant-specific authorization and token URLs instead of /common, and copy the client secret Value, not the Secret ID."},dynamics365_sales:{name:"dynamics365_sales",apiUrl:"https://<<api_host>>/api/data/v9.2",regex:"^.*(crm\\d*\\.dynamics\\.com|dynamicscrm).*$",icon:"dynamics365",docsUrl:"https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/query-data-web-api",preferredAuthType:"oauth2",connectionFields:[{key:"api_host",label:"Environment host",placeholder:"contoso.crm.dynamics.com",required:!0}],oauth:{authUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/token",scopes:"https://<<api_host>>/user_impersonation offline_access",client_id:"b4bf6bc2-5b30-4eea-b3eb-ca138d2d69fc",credentialTemplateId:"microsoft",grant_type:"authorization_code"},keywords:["accounts","contacts","leads","opportunities","quotes","salesorders","salesorderdetails","products","incidents","campaigns","invoices","competitors","teams","systemusers","businessunits","odata","dynamics","crm","dynamics 365 sales","dataverse","oauth"],systemSpecificInstructions:`Dynamics 365 Sales \u2014 Dataverse Web API v9.2
|
|
518
524
|
|
|
519
525
|
CONNECTING: superglue provides a managed multi-tenant Microsoft app, so no Azure app registration is needed \u2014 authenticate directly via OAuth. The Dataverse scope is per-environment: the template scope contains an <<api_host>> placeholder and Microsoft rejects it unresolved \u2014 ALWAYS substitute the environment host (e.g. https://contoso.crm.dynamics.com/user_impersonation offline_access) in scopes when calling authenticate_oauth. Ask the user for the host if it is unknown. The user_impersonation scope does not require Entra administrator consent, but the signed-in user needs a Dynamics 365 license and a security role in the target environment. Keep offline_access in scopes to receive refresh tokens.
|
|
520
526
|
|
|
@@ -527,7 +533,7 @@ QUERY BEHAVIOR:
|
|
|
527
533
|
- $skip is NOT supported. Use @odata.nextLink for pagination (default page size 5000, control with Prefer: odata.maxpagesize=<n>).
|
|
528
534
|
- PAGINATION IN SUPERGLUE: Use cursorBased pagination with cursorPath "@odata.nextLink":
|
|
529
535
|
pagination: { type: "cursorBased", pageSize: "5000", cursorPath: "@odata.nextLink" }
|
|
530
|
-
The cursor is a full URL \u2014
|
|
536
|
+
The cursor is a full URL \u2014 build the step url as an expression that falls back to the base query when the cursor is null: url: "<<(sourceData) => sourceData.cursor || 'https://' + sourceData.<systemId>_api_host + '/api/data/v9.2/accounts?$select=name'>>" where <systemId> is the connected system id (e.g. sourceData.dynamics365_sales_api_host). Saved credentials resolve as <systemId>_<key> inside expressions. Do not nest <<...>> placeholders inside the expression. Leave queryParams empty. Do not pass cursor as an input variable; payload values override the pagination cursor on every page.
|
|
531
537
|
- COUNTS ARE CAPPED: $count=true returns @odata.count capped at 5000 (500 for elastic tables). When the real total is higher, Dataverse sets @Microsoft.Dynamics.CRM.totalrecordcountlimitexceeded to true and @odata.count stays 5000. Always read that flag before reporting a total, or use $apply=aggregate($count as total) for an exact count.
|
|
532
538
|
- $apply is supported for aggregations.
|
|
533
539
|
- Lookup fields (foreign keys) are named _<field>_value \u2014 e.g. _parentaccountid_value, _customerid_value.
|
|
@@ -1318,11 +1324,11 @@ ${m.toString(16)}\r
|
|
|
1318
1324
|
\r
|
|
1319
1325
|
`,"latin1"),t!==null&&i!==t){if(a[Zy])throw new qr;process.emitWarning(new qr)}e[ve].timeout&&e[ve].timeoutType===Js&&e[ve].timeout.refresh&&e[ve].timeout.refresh(),a[Na]()}}destroy(e){let{socket:t,client:a,abort:i}=this;t[wi]=!1,e&&(P(a[_e]<=1,"pipeline should only contain this request"),i(e))}};Vj.exports=AK});var a8=y((Mge,t8)=>{"use strict";var wt=require("assert"),{pipeline:SK}=require("stream"),ee=K(),{RequestContentLengthMismatchError:nk,RequestAbortedError:DK,SocketError:um,InformationalError:vi,InvalidArgumentError:TK}=$(),{kUrl:lm,kReset:Id,kClient:Wo,kRunning:dm,kPending:RK,kQueue:xi,kPendingIdx:mk,kRunningIdx:Mt,kError:Jo,kSocket:Ie,kStrictContentLength:NK,kOnError:Ks,kMaxConcurrentStreams:qd,kPingInterval:Wj,kHTTP2Session:Ua,kHTTP2InitialWindowSize:UK,kHTTP2ConnectionWindowSize:OK,kResume:aa,kSize:MK,kHTTPContext:lk,kClosed:ck,kBodyTimeout:_K,kEnableConnectProtocol:cm,kRemoteSettings:mm,kHTTP2Stream:zd,kHTTP2SessionState:uk}=de(),{channels:Jj}=yi(),At=Symbol("open streams"),Kj,Ed;try{Ed=require("http2")}catch{Ed={constants:{}}}var{constants:{HTTP2_HEADER_AUTHORITY:LK,HTTP2_HEADER_METHOD:Zj,HTTP2_HEADER_PATH:Xj,HTTP2_HEADER_SCHEME:ik,HTTP2_HEADER_CONTENT_LENGTH:FK,HTTP2_HEADER_EXPECT:PK,HTTP2_HEADER_STATUS:rk,HTTP2_HEADER_PROTOCOL:HK,NGHTTP2_REFUSED_STREAM:GK,NGHTTP2_CANCEL:YK}}=Ed;function sk(o){let e=[];for(let[t,a]of Object.entries(o))if(Array.isArray(a))for(let i of a)e.push(Buffer.from(t),Buffer.from(i));else e.push(Buffer.from(t),Buffer.from(a));return e}function VK(o,e){o[Ie]=e;let t=o[UK],a=o[OK],i=Ed.connect(o[lm],{createConnection:()=>e,peerMaxConcurrentStreams:o[qd],settings:{enablePush:!1,...t!=null?{initialWindowSize:t}:null}});return o[Ie]=e,i[At]=0,i[Wo]=o,i[Ie]=e,i[uk]={ping:{interval:o[Wj]===0?null:setInterval(KK,o[Wj],i).unref()}},i[cm]=!1,i[mm]=!1,a&&ee.addListener(i,"connect",WK.bind(i,a)),ee.addListener(i,"error",ZK),ee.addListener(i,"frameError",XK),ee.addListener(i,"end",eZ),ee.addListener(i,"goaway",oZ),ee.addListener(i,"close",tZ),ee.addListener(i,"remoteSettings",JK),i.unref(),o[Ua]=i,e[Ua]=i,ee.addListener(e,"error",iZ),ee.addListener(e,"end",rZ),ee.addListener(e,"close",aZ),e[ck]=!1,e.on("close",sZ),{version:"h2",defaultPipelining:1/0,write(r){return cZ(o,r)},resume(){$K(o)},destroy(r,s){e[ck]?queueMicrotask(s):e.destroy(r).on("close",s)},get destroyed(){return e.destroyed},busy(r){if(r!=null)if(o[dm]>0){if(r.idempotent===!1||(r.upgrade==="websocket"||r.method==="CONNECT")&&i[mm]===!1||ee.bodyLength(r.body)!==0&&(ee.isStream(r.body)||ee.isAsyncIterable(r.body)||ee.isFormDataLike(r.body)))return!0}else return(r.upgrade==="websocket"||r.method==="CONNECT")&&i[mm]===!1;return!1}}}function $K(o){let e=o[Ie];e?.destroyed===!1&&(o[MK]===0||o[qd]===0?(e.unref(),o[Ua].unref()):(e.ref(),o[Ua].ref()))}function WK(o){try{typeof this.setLocalWindowSize=="function"&&this.setLocalWindowSize(o)}catch{}}function JK(o){if(this[Wo][qd]=o.maxConcurrentStreams??this[Wo][qd],this[mm]===!0&&this[cm]===!0&&o.enableConnectProtocol===!1){let e=new vi("HTTP/2: Server disabled extended CONNECT protocol against RFC-8441");this[Ie][Jo]=e,this[Wo][Ks](e);return}this[cm]=o.enableConnectProtocol??this[cm],this[mm]=!0,this[Wo][aa]()}function KK(o){let e=o[uk];if((o.closed||o.destroyed)&&e.ping.interval!=null){clearInterval(e.ping.interval),e.ping.interval=null;return}o.ping(t.bind(o));function t(a,i){let r=this[Wo],s=this[Wo];if(a!=null){let n=new vi(`HTTP/2: "PING" errored - type ${a.message}`);s[Jo]=n,r[Ks](n)}else r.emit("ping",i)}}function ZK(o){wt(o.code!=="ERR_TLS_CERT_ALTNAME_INVALID"),this[Ie][Jo]=o,this[Wo][Ks](o)}function XK(o,e,t){if(t===0){let a=new vi(`HTTP/2: "frameError" received - type ${o}, code ${e}`);this[Ie][Jo]=a,this[Wo][Ks](a)}}function eZ(){let o=new um("other side closed",ee.getSocketInfo(this[Ie]));this.destroy(o),ee.destroy(this[Ie],o)}function oZ(o){let e=this[Jo]||new um(`HTTP/2: "GOAWAY" frame received with code ${o}`,ee.getSocketInfo(this[Ie])),t=this[Wo];if(t[Ie]=null,t[lk]=null,this.close(),this[Ua]=null,ee.destroy(this[Ie],e),t[Mt]<t[xi].length){let a=t[xi][t[Mt]];t[xi][t[Mt]++]=null,ee.errorRequest(t,a,e),t[mk]=t[Mt]}wt(t[dm]===0),t.emit("disconnect",t[lm],[t],e),t.emit("connectionError",t[lm],[t],e),t[aa]()}function tZ(){let{[Wo]:o,[uk]:e}=this,{[Ie]:t}=o,a=this[Ie][Jo]||this[Jo]||new um("closed",ee.getSocketInfo(t));if(o[Ie]=null,o[lk]=null,e.ping.interval!=null&&(clearInterval(e.ping.interval),e.ping.interval=null),o.destroyed){wt(o[RK]===0);let i=o[xi].splice(o[Mt]);for(let r=0;r<i.length;r++){let s=i[r];ee.errorRequest(o,s,a)}}}function aZ(){let o=this[Jo]||new um("closed",ee.getSocketInfo(this)),e=this[Ua][Wo];e[Ie]=null,e[lk]=null,this[Ua]!==null&&this[Ua].destroy(o),e[mk]=e[Mt],wt(e[dm]===0),e.emit("disconnect",e[lm],[e],o),e[aa]()}function iZ(o){wt(o.code!=="ERR_TLS_CERT_ALTNAME_INVALID"),this[Jo]=o,this[Wo][Ks](o)}function rZ(){ee.destroy(this,new um("other side closed",ee.getSocketInfo(this)))}function sZ(){this[ck]=!0}function nZ(o){return o!=="GET"&&o!=="HEAD"&&o!=="OPTIONS"&&o!=="TRACE"&&o!=="CONNECT"}function cZ(o,e){let t=e.bodyTimeout??o[_K],a=o[Ua],{method:i,path:r,host:s,upgrade:n,expectContinue:c,signal:m,protocol:l,headers:u}=e,{body:d}=e;if(n!=null&&n!=="websocket")return ee.errorRequest(o,e,new TK(`Custom upgrade "${n}" not supported over HTTP/2`)),!1;let g={};for(let D=0;D<u.length;D+=2){let O=u[D+0],S=u[D+1];if(O==="cookie"){g[O]!=null?g[O]=Array.isArray(g[O])?(g[O].push(S),g[O]):[g[O],S]:g[O]=S;continue}if(Array.isArray(S))for(let oe=0;oe<S.length;oe++)g[O]?g[O]+=`, ${S[oe]}`:g[O]=S[oe];else g[O]?g[O]+=`, ${S}`:g[O]=S}let p=null,{hostname:b,port:A}=o[lm];g[LK]=s||`${b}${A?`:${A}`:""}`,g[Zj]=i;let k=D=>{e.aborted||e.completed||(D=D||new DK,ee.errorRequest(o,e,D),p!=null&&(p.removeAllListeners("data"),p.close(),o[Ks](D),o[aa]()),ee.destroy(d,D))};try{e.onConnect(k)}catch(D){ee.errorRequest(o,e,D)}if(e.aborted)return!1;if(n||i==="CONNECT")return a.ref(),n==="websocket"?a[cm]===!1?(ee.errorRequest(o,e,new vi("HTTP/2: Extended CONNECT protocol not supported by server")),a.unref(),!1):(g[Zj]="CONNECT",g[HK]="websocket",g[Xj]=r,l==="ws:"||l==="wss:"?g[ik]=l==="ws:"?"http":"https":g[ik]=l==="http:"?"http":"https",p=a.request(g,{endStream:!1,signal:m}),p[zd]=!0,p.once("response",(D,O)=>{let{[rk]:S,...oe}=D;e.onUpgrade(S,sk(oe),p),++a[At],o[xi][o[Mt]++]=null}),p.on("error",()=>{(p.rstCode===GK||p.rstCode===YK)&&k(new vi(`HTTP/2: "stream error" received - code ${p.rstCode}`))}),p.once("close",()=>{a[At]-=1,a[At]===0&&a.unref()}),p.setTimeout(t),!0):(p=a.request(g,{endStream:!1,signal:m}),p[zd]=!0,p.on("response",D=>{let{[rk]:O,...S}=D;e.onUpgrade(O,sk(S),p),++a[At],o[xi][o[Mt]++]=null}),p.once("close",()=>{a[At]-=1,a[At]===0&&a.unref()}),p.setTimeout(t),!0);g[Xj]=r,g[ik]=l==="http:"?"http":"https";let x=i==="PUT"||i==="POST"||i==="PATCH";d&&typeof d.read=="function"&&d.read(0);let v=ee.bodyLength(d);if(ee.isFormDataLike(d)){Kj??=$s().extractBody;let[D,O]=Kj(d);g["content-type"]=O,d=D.stream,v=D.length}if(v==null&&(v=e.contentLength),x||(v=null),nZ(i)&&v>0&&e.contentLength!=null&&e.contentLength!==v){if(o[NK])return ee.errorRequest(o,e,new nk),!1;process.emitWarning(new nk)}if(v!=null&&(wt(d||v===0,"no body must not have content length"),g[FK]=`${v}`),a.ref(),Jj.sendHeaders.hasSubscribers){let D="";for(let O in g)D+=`${O}: ${g[O]}\r
|
|
1320
1326
|
`;Jj.sendHeaders.publish({request:e,headers:D,socket:a[Ie]})}let j=i==="GET"||i==="HEAD"||d===null;c?(g[PK]="100-continue",p=a.request(g,{endStream:j,signal:m}),p[zd]=!0,p.once("continue",T)):(p=a.request(g,{endStream:j,signal:m}),p[zd]=!0,T()),++a[At],p.setTimeout(t);let I=!1;return p.once("response",D=>{let{[rk]:O,...S}=D;if(e.onResponseStarted(),I=!0,e.aborted){p.removeAllListeners("data");return}e.onHeaders(Number(O),sk(S),p.resume.bind(p),"")===!1&&p.pause(),p.on("data",oe=>{e.aborted||e.completed||e.onData(oe)===!1&&p.pause()})}),p.once("end",()=>{p.removeAllListeners("data"),I?(!e.aborted&&!e.completed&&e.onComplete({}),o[xi][o[Mt]++]=null,o[aa]()):(k(new vi("HTTP/2: stream half-closed (remote)")),o[xi][o[Mt]++]=null,o[mk]=o[Mt],o[aa]())}),p.once("close",()=>{p.removeAllListeners("data"),a[At]-=1,a[At]===0&&a.unref()}),p.once("error",function(D){p.removeAllListeners("data"),k(D)}),p.once("frameError",(D,O)=>{p.removeAllListeners("data"),k(new vi(`HTTP/2: "frameError" received - type ${D}, code ${O}`))}),p.on("aborted",()=>{p.removeAllListeners("data")}),p.on("timeout",()=>{let D=new vi(`HTTP/2: "stream timeout after ${t}"`);p.removeAllListeners("data"),a[At]-=1,a[At]===0&&a.unref(),k(D)}),p.once("trailers",D=>{e.aborted||e.completed||(p.removeAllListeners("data"),e.onComplete(D))}),!0;function T(){!d||v===0?e8(k,p,null,o,e,o[Ie],v,x):ee.isBuffer(d)?e8(k,p,d,o,e,o[Ie],v,x):ee.isBlobLike(d)?typeof d.stream=="function"?o8(k,p,d.stream(),o,e,o[Ie],v,x):lZ(k,p,d,o,e,o[Ie],v,x):ee.isStream(d)?mZ(k,o[Ie],x,p,d,o,e,v):ee.isIterable(d)?o8(k,p,d,o,e,o[Ie],v,x):wt(!1)}}function e8(o,e,t,a,i,r,s,n){try{t!=null&&ee.isBuffer(t)&&(wt(s===t.byteLength,"buffer body must have content length"),e.cork(),e.write(t),e.uncork(),e.end(),i.onBodySent(t)),n||(r[Id]=!0),i.onRequestSent(),a[aa]()}catch(c){o(c)}}function mZ(o,e,t,a,i,r,s,n){wt(n!==0||r[dm]===0,"stream body cannot be pipelined");let c=SK(i,a,l=>{l?(ee.destroy(c,l),o(l)):(ee.removeAllListeners(c),s.onRequestSent(),t||(e[Id]=!0),r[aa]())});ee.addListener(c,"data",m);function m(l){s.onBodySent(l)}}async function lZ(o,e,t,a,i,r,s,n){wt(s===t.size,"blob body must have content length");try{if(s!=null&&s!==t.size)throw new nk;let c=Buffer.from(await t.arrayBuffer());e.cork(),e.write(c),e.uncork(),e.end(),i.onBodySent(c),i.onRequestSent(),n||(r[Id]=!0),a[aa]()}catch(c){o(c)}}async function o8(o,e,t,a,i,r,s,n){wt(s!==0||a[dm]===0,"iterator body cannot be pipelined");let c=null;function m(){if(c){let u=c;c=null,u()}}let l=()=>new Promise((u,d)=>{wt(c===null),r[Jo]?d(r[Jo]):c=u});e.on("close",m).on("drain",m);try{for await(let u of t){if(r[Jo])throw r[Jo];let d=e.write(u);i.onBodySent(u),d||await l()}e.end(),i.onRequestSent(),n||(r[Id]=!0),a[aa]()}catch(u){o(u)}finally{e.off("close",m).off("drain",m)}}t8.exports=VK});var Ii=y((_ge,u8)=>{"use strict";var Oa=require("assert"),n8=require("net"),gm=require("http"),Br=K(),{ClientStats:uZ}=iy(),{channels:Zs}=yi(),dZ=wC(),gZ=Ar(),{InvalidArgumentError:xe,InformationalError:pZ,ClientDestroyedError:hZ}=$(),fZ=wr(),{kUrl:ia,kServerName:Ei,kClient:bZ,kBusy:gk,kConnect:yZ,kResuming:Qr,kRunning:bm,kPending:ym,kSize:pm,kQueue:_t,kConnected:kZ,kConnecting:Xs,kNeedDrain:qi,kKeepAliveDefaultTimeout:i8,kHostHeader:AZ,kPendingIdx:Lt,kRunningIdx:_a,kError:wZ,kPipelining:Cd,kKeepAliveTimeoutValue:vZ,kMaxHeadersSize:xZ,kKeepAliveMaxTimeout:zZ,kKeepAliveTimeoutThreshold:qZ,kHeadersTimeout:EZ,kBodyTimeout:IZ,kStrictContentLength:CZ,kConnector:hm,kMaxRequests:pk,kCounter:jZ,kClose:BZ,kDestroy:QZ,kDispatch:SZ,kLocalAddress:fm,kMaxResponseSize:DZ,kOnError:TZ,kHTTPContext:Ne,kMaxConcurrentStreams:RZ,kHTTP2InitialWindowSize:NZ,kHTTP2ConnectionWindowSize:UZ,kResume:Ma,kPingInterval:OZ}=de(),MZ=$j(),_Z=a8(),zi=Symbol("kClosedResolve"),LZ=gm&&gm.maxHeaderSize&&Number.isInteger(gm.maxHeaderSize)&&gm.maxHeaderSize>0?()=>gm.maxHeaderSize:()=>{throw new xe("http module not available or http.maxHeaderSize invalid")},r8=()=>{};function c8(o){return o[Cd]??o[Ne]?.defaultPipelining??1}var hk=class extends gZ{constructor(e,{maxHeaderSize:t,headersTimeout:a,socketTimeout:i,requestTimeout:r,connectTimeout:s,bodyTimeout:n,idleTimeout:c,keepAlive:m,keepAliveTimeout:l,maxKeepAliveTimeout:u,keepAliveMaxTimeout:d,keepAliveTimeoutThreshold:g,socketPath:p,pipelining:b,tls:A,strictContentLength:k,maxCachedSessions:x,connect:v,maxRequestsPerClient:j,localAddress:I,maxResponseSize:T,autoSelectFamily:D,autoSelectFamilyAttemptTimeout:O,maxConcurrentStreams:S,allowH2:oe,useH2c:te,initialWindowSize:ye,connectionWindowSize:po,pingInterval:Ve,webSocket:ya}={}){if(m!==void 0)throw new xe("unsupported keepAlive, use pipelining=0 instead");if(i!==void 0)throw new xe("unsupported socketTimeout, use headersTimeout & bodyTimeout instead");if(r!==void 0)throw new xe("unsupported requestTimeout, use headersTimeout & bodyTimeout instead");if(c!==void 0)throw new xe("unsupported idleTimeout, use keepAliveTimeout instead");if(u!==void 0)throw new xe("unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead");if(t!=null){if(!Number.isInteger(t)||t<1)throw new xe("invalid maxHeaderSize")}else t=LZ();if(p!=null&&typeof p!="string")throw new xe("invalid socketPath");if(s!=null&&(!Number.isFinite(s)||s<0))throw new xe("invalid connectTimeout");if(l!=null&&(!Number.isFinite(l)||l<=0))throw new xe("invalid keepAliveTimeout");if(d!=null&&(!Number.isFinite(d)||d<=0))throw new xe("invalid keepAliveMaxTimeout");if(g!=null&&!Number.isFinite(g))throw new xe("invalid keepAliveTimeoutThreshold");if(a!=null&&(!Number.isInteger(a)||a<0))throw new xe("headersTimeout must be a positive integer or zero");if(n!=null&&(!Number.isInteger(n)||n<0))throw new xe("bodyTimeout must be a positive integer or zero");if(v!=null&&typeof v!="function"&&typeof v!="object")throw new xe("connect must be a function or an object");if(j!=null&&(!Number.isInteger(j)||j<0))throw new xe("maxRequestsPerClient must be a positive number");if(I!=null&&(typeof I!="string"||n8.isIP(I)===0))throw new xe("localAddress must be valid string IP address");if(T!=null&&(!Number.isInteger(T)||T<-1))throw new xe("maxResponseSize must be a positive number");if(O!=null&&(!Number.isInteger(O)||O<-1))throw new xe("autoSelectFamilyAttemptTimeout must be a positive number");if(oe!=null&&typeof oe!="boolean")throw new xe("allowH2 must be a valid boolean value");if(S!=null&&(typeof S!="number"||S<1))throw new xe("maxConcurrentStreams must be a positive integer, greater than 0");if(te!=null&&typeof te!="boolean")throw new xe("useH2c must be a valid boolean value");if(ye!=null&&(!Number.isInteger(ye)||ye<1))throw new xe("initialWindowSize must be a positive integer, greater than 0");if(po!=null&&(!Number.isInteger(po)||po<1))throw new xe("connectionWindowSize must be a positive integer, greater than 0");if(Ve!=null&&(typeof Ve!="number"||!Number.isInteger(Ve)||Ve<0))throw new xe("pingInterval must be a positive integer, greater or equal to 0");if(super({webSocket:ya}),typeof v!="function")v=fZ({...A,maxCachedSessions:x,allowH2:oe,useH2c:te,socketPath:p,timeout:s,...typeof D=="boolean"?{autoSelectFamily:D,autoSelectFamilyAttemptTimeout:O}:void 0,...v});else{let it=v;v=(Wi,Ji)=>it({...Wi,...p!=null?{socketPath:p}:null,...oe!=null?{allowH2:oe}:null},Ji)}this[ia]=Br.parseOrigin(e),this[hm]=v,this[Cd]=b??1,this[xZ]=t,this[i8]=l??4e3,this[zZ]=d??6e5,this[qZ]=g??2e3,this[vZ]=this[i8],this[Ei]=null,this[fm]=I??null,this[Qr]=0,this[qi]=0,this[AZ]=`host: ${this[ia].hostname}${this[ia].port?`:${this[ia].port}`:""}\r
|
|
1321
|
-
`,this[IZ]=n??3e5,this[EZ]=a??3e5,this[CZ]=k??!0,this[pk]=j,this[zi]=null,this[DZ]=T>-1?T:-1,this[Ne]=null,this[RZ]=S??100,this[NZ]=ye??262144,this[UZ]=po??524288,this[OZ]=Ve??6e4,this[_t]=[],this[_a]=0,this[Lt]=0,this[Ma]=it=>fk(this,it),this[TZ]=it=>m8(this,it)}get pipelining(){return this[Cd]}set pipelining(e){this[Cd]=e,this[Ma](!0)}get stats(){return new uZ(this)}get[ym](){return this[_t].length-this[Lt]}get[bm](){return this[Lt]-this[_a]}get[pm](){return this[_t].length-this[_a]}get[kZ](){return!!this[Ne]&&!this[Xs]&&!this[Ne].destroyed}get[gk](){return!!(this[Ne]?.busy(null)||this[pm]>=(c8(this)||1)||this[ym]>0)}[yZ](e){l8(this),this.once("connect",e)}[SZ](e,t){let a=new dZ(this[ia].origin,e,t);return this[_t].push(a),this[Qr]||(Br.bodyLength(a.body)==null&&Br.isIterable(a.body)?(this[Qr]=1,queueMicrotask(()=>fk(this))):this[Ma](!0)),this[Qr]&&this[qi]!==2&&this[gk]&&(this[qi]=2),this[qi]<2}[BZ](){return new Promise(e=>{this[pm]?this[zi]=e:e(null)})}[QZ](e){return new Promise(t=>{let a=this[_t].splice(this[Lt]);for(let r=0;r<a.length;r++){let s=a[r];Br.errorRequest(this,s,e)}let i=()=>{this[zi]&&(this[zi](),this[zi]=null),t(null)};this[Ne]?(this[Ne].destroy(e,i),this[Ne]=null):queueMicrotask(i),this[Ma]()})}};function m8(o,e){if(o[bm]===0&&e.code!=="UND_ERR_INFO"&&e.code!=="UND_ERR_SOCKET"){Oa(o[Lt]===o[_a]);let t=o[_t].splice(o[_a]);for(let a=0;a<t.length;a++){let i=t[a];Br.errorRequest(o,i,e)}Oa(o[pm]===0)}}function l8(o){Oa(!o[Xs]),Oa(!o[Ne]);let{host:e,hostname:t,protocol:a,port:i}=o[ia];if(t[0]==="["){let r=t.indexOf("]");Oa(r!==-1);let s=t.substring(1,r);Oa(n8.isIPv6(s)),t=s}o[Xs]=!0,Zs.beforeConnect.hasSubscribers&&Zs.beforeConnect.publish({connectParams:{host:e,hostname:t,protocol:a,port:i,version:o[Ne]?.version,servername:o[Ei],localAddress:o[fm]},connector:o[hm]});try{o[hm]({host:e,hostname:t,protocol:a,port:i,servername:o[Ei],localAddress:o[fm]},(r,s)=>{if(r){dk(o,r,{host:e,hostname:t,protocol:a,port:i}),o[Ma]();return}if(o.destroyed){Br.destroy(s.on("error",r8),new hZ),o[Ma]();return}Oa(s);try{o[Ne]=s.alpnProtocol==="h2"?_Z(o,s):MZ(o,s)}catch(n){s.destroy().on("error",r8),dk(o,n,{host:e,hostname:t,protocol:a,port:i}),o[Ma]();return}o[Xs]=!1,s[jZ]=0,s[pk]=o[pk],s[bZ]=o,s[wZ]=null,Zs.connected.hasSubscribers&&Zs.connected.publish({connectParams:{host:e,hostname:t,protocol:a,port:i,version:o[Ne]?.version,servername:o[Ei],localAddress:o[fm]},connector:o[hm],socket:s}),o.emit("connect",o[ia],[o]),o[Ma]()})}catch(r){dk(o,r,{host:e,hostname:t,protocol:a,port:i}),o[Ma]()}}function dk(o,e,{host:t,hostname:a,protocol:i,port:r}){if(!o.destroyed){if(o[Xs]=!1,Zs.connectError.hasSubscribers&&Zs.connectError.publish({connectParams:{host:t,hostname:a,protocol:i,port:r,version:o[Ne]?.version,servername:o[Ei],localAddress:o[fm]},connector:o[hm],error:e}),e.code==="ERR_TLS_CERT_ALTNAME_INVALID")for(Oa(o[bm]===0);o[ym]>0&&o[_t][o[Lt]].servername===o[Ei];){let s=o[_t][o[Lt]++];Br.errorRequest(o,s,e)}else m8(o,e);o.emit("connectionError",o[ia],[o],e)}}function s8(o){o[qi]=0,o.emit("drain",o[ia],[o])}function fk(o,e){o[Qr]!==2&&(o[Qr]=2,FZ(o,e),o[Qr]=0,o[_a]>256&&(o[_t].splice(0,o[_a]),o[Lt]-=o[_a],o[_a]=0))}function FZ(o,e){for(;;){if(o.destroyed){Oa(o[ym]===0);return}if(o[zi]&&!o[pm]){o[zi](),o[zi]=null;return}if(o[Ne]&&o[Ne].resume(),o[gk])o[qi]=2;else if(o[qi]===2){e?(o[qi]=1,queueMicrotask(()=>s8(o))):s8(o);continue}if(o[ym]===0||o[bm]>=(c8(o)||1))return;let t=o[_t][o[Lt]];if(t===null)return;if(o[ia].protocol==="https:"&&o[Ei]!==t.servername){if(o[bm]>0)return;o[Ei]=t.servername,o[Ne]?.destroy(new pZ("servername changed"),()=>{o[Ne]=null,fk(o)})}if(o[Xs])return;if(!o[Ne]){l8(o);return}if(o[Ne].destroyed||o[Ne].busy(t))return;!t.aborted&&o[Ne].write(t)?o[Lt]++:o[_t].splice(o[Lt],1)}}u8.exports=hk});var bk=y((Fge,d8)=>{"use strict";var jd=class{bottom=0;top=0;list=new Array(2048).fill(void 0);next=null;isEmpty(){return this.top===this.bottom}isFull(){return(this.top+1&2047)===this.bottom}push(e){this.list[this.top]=e,this.top=this.top+1&2047}shift(){let e=this.list[this.bottom];return e===void 0?null:(this.list[this.bottom]=void 0,this.bottom=this.bottom+1&2047,e)}};d8.exports=class{constructor(){this.head=this.tail=new jd}isEmpty(){return this.head.isEmpty()}push(e){this.head.isFull()&&(this.head=this.head.next=new jd),this.head.push(e)}shift(){let e=this.tail,t=e.shift();return e.isEmpty()&&e.next!==null&&(this.tail=e.next,e.next=null),t}}});var Bd=y((Pge,w8)=>{"use strict";var{PoolStats:PZ}=iy(),HZ=Ar(),GZ=bk(),{kConnected:yk,kSize:g8,kRunning:p8,kPending:h8,kQueued:km,kBusy:YZ,kFree:VZ,kUrl:$Z,kClose:WZ,kDestroy:JZ,kDispatch:KZ}=de(),Ze=Symbol("clients"),Ao=Symbol("needDrain"),Am=Symbol("queue"),kk=Symbol("closed resolve"),Ak=Symbol("onDrain"),f8=Symbol("onConnect"),b8=Symbol("onDisconnect"),y8=Symbol("onConnectionError"),wk=Symbol("get dispatcher"),k8=Symbol("add client"),A8=Symbol("remove client"),vk=class extends HZ{[Am]=new GZ;[km]=0;[Ze]=[];[Ao]=!1;[Ak](e,t,a){let i=this[Am],r=!1;for(;!r;){let s=i.shift();if(!s)break;this[km]--,r=!e.dispatch(s.opts,s.handler)}if(e[Ao]=r,!r&&this[Ao]&&(this[Ao]=!1,this.emit("drain",t,[this,...a])),this[kk]&&i.isEmpty()){let s=[];for(let n=0;n<this[Ze].length;n++){let c=this[Ze][n];c.destroyed||s.push(c.close())}return Promise.all(s).then(this[kk])}}[f8]=(e,t)=>{this.emit("connect",e,[this,...t])};[b8]=(e,t,a)=>{this.emit("disconnect",e,[this,...t],a)};[y8]=(e,t,a)=>{this.emit("connectionError",e,[this,...t],a)};get[YZ](){return this[Ao]}get[yk](){let e=0;for(let{[yk]:t}of this[Ze])e+=t;return e}get[VZ](){let e=0;for(let{[yk]:t,[Ao]:a}of this[Ze])e+=t&&!a;return e}get[h8](){let e=this[km];for(let{[h8]:t}of this[Ze])e+=t;return e}get[p8](){let e=0;for(let{[p8]:t}of this[Ze])e+=t;return e}get[g8](){let e=this[km];for(let{[g8]:t}of this[Ze])e+=t;return e}get stats(){return new PZ(this)}[WZ](){if(this[Am].isEmpty()){let e=[];for(let t=0;t<this[Ze].length;t++){let a=this[Ze][t];a.destroyed||e.push(a.close())}return Promise.all(e)}else return new Promise(e=>{this[kk]=e})}[JZ](e){for(;;){let a=this[Am].shift();if(!a)break;a.handler.onError(e)}let t=new Array(this[Ze].length);for(let a=0;a<this[Ze].length;a++)t[a]=this[Ze][a].destroy(e);return Promise.all(t)}[KZ](e,t){let a=this[wk]();return a?a.dispatch(e,t)||(a[Ao]=!0,this[Ao]=!this[wk]()):(this[Ao]=!0,this[Am].push({opts:e,handler:t}),this[km]++),!this[Ao]}[k8](e){return e.on("drain",this[Ak].bind(this,e)).on("connect",this[f8]).on("disconnect",this[b8]).on("connectionError",this[y8]),this[Ze].push(e),this[Ao]&&queueMicrotask(()=>{this[Ao]&&this[Ak](e,e[$Z],[e,this])}),this}[A8](e){e.close(()=>{let t=this[Ze].indexOf(e);t!==-1&&this[Ze].splice(t,1)}),this[Ao]=this[Ze].some(t=>!t[Ao]&&t.closed!==!0&&t.destroyed!==!0)}};w8.exports={PoolBase:vk,kClients:Ze,kNeedDrain:Ao,kAddClient:k8,kRemoveClient:A8,kGetDispatcher:wk}});var Sr=y((Hge,q8)=>{"use strict";var{PoolBase:ZZ,kClients:Qd,kNeedDrain:XZ,kAddClient:eX,kGetDispatcher:oX,kRemoveClient:tX}=Bd(),aX=Ii(),{InvalidArgumentError:xk}=$(),v8=K(),{kUrl:x8}=de(),iX=wr(),Sd=Symbol("options"),zk=Symbol("connections"),z8=Symbol("factory");function rX(o,e){return new aX(o,e)}var qk=class extends ZZ{constructor(e,{connections:t,factory:a=rX,connect:i,connectTimeout:r,tls:s,maxCachedSessions:n,socketPath:c,autoSelectFamily:m,autoSelectFamilyAttemptTimeout:l,allowH2:u,clientTtl:d,...g}={}){if(t!=null&&(!Number.isFinite(t)||t<0))throw new xk("invalid connections");if(typeof a!="function")throw new xk("factory must be a function.");if(i!=null&&typeof i!="function"&&typeof i!="object")throw new xk("connect must be a function or an object");typeof i!="function"&&(i=iX({...s,maxCachedSessions:n,allowH2:u,socketPath:c,timeout:r,...typeof m=="boolean"?{autoSelectFamily:m,autoSelectFamilyAttemptTimeout:l}:void 0,...i})),super(g),this[zk]=t||null,this[x8]=v8.parseOrigin(e),this[Sd]={...v8.deepClone(g),connect:i,allowH2:u,clientTtl:d,socketPath:c},this[Sd].interceptors=g.interceptors?{...g.interceptors}:void 0,this[z8]=a,this.on("connect",(p,b)=>{if(d!=null&&d>0)for(let A of b)Object.assign(A,{ttl:Date.now()})}),this.on("connectionError",(p,b,A)=>{for(let k of b){let x=this[Qd].indexOf(k);x!==-1&&this[Qd].splice(x,1)}})}[oX](){let e=this[Sd].clientTtl;for(let t of this[Qd])if(e!=null&&e>0&&t.ttl&&Date.now()-t.ttl>e)this[tX](t);else if(!t[XZ])return t;if(!this[zk]||this[Qd].length<this[zk]){let t=this[z8](this[x8],this[Sd]);return this[eX](t),t}}};q8.exports=qk});var j8=y((Gge,C8)=>{"use strict";var{BalancedPoolMissingUpstreamError:sX,InvalidArgumentError:nX}=$(),{PoolBase:cX,kClients:ao,kNeedDrain:wm,kAddClient:mX,kRemoveClient:lX,kGetDispatcher:uX}=Bd(),dX=Sr(),{kUrl:Dd}=de(),Td=K(),E8=Symbol("factory"),vm=Symbol("options"),I8=Symbol("kGreatestCommonDivisor"),Dr=Symbol("kCurrentWeight"),Tr=Symbol("kIndex"),vt=Symbol("kWeight"),Rd=Symbol("kMaxWeightPerServer"),Nd=Symbol("kErrorPenalty");function gX(o,e){if(o===0)return e;for(;e!==0;){let t=e;e=o%e,o=t}return o}function pX(o,e){return new dX(o,e)}var Ek=class extends cX{constructor(e=[],{factory:t=pX,...a}={}){if(typeof t!="function")throw new nX("factory must be a function.");super(a),this[vm]={...Td.deepClone(a)},this[vm].interceptors=a.interceptors?{...a.interceptors}:void 0,this[Tr]=-1,this[Dr]=0,this[Rd]=this[vm].maxWeightPerServer||100,this[Nd]=this[vm].errorPenalty||15,Array.isArray(e)||(e=[e]),this[E8]=t;for(let i of e)this.addUpstream(i);this._updateBalancedPoolStats()}addUpstream(e){let t=Td.parseOrigin(e).origin;if(this[ao].find(i=>i[Dd].origin===t&&i.closed!==!0&&i.destroyed!==!0))return this;let a=this[E8](t,this[vm]);this[mX](a),a.on("connect",()=>{a[vt]=Math.min(this[Rd],a[vt]+this[Nd])}),a.on("connectionError",()=>{a[vt]=Math.max(1,a[vt]-this[Nd]),this._updateBalancedPoolStats()}),a.on("disconnect",(...i)=>{let r=i[2];r&&r.code==="UND_ERR_SOCKET"&&(a[vt]=Math.max(1,a[vt]-this[Nd]),this._updateBalancedPoolStats())});for(let i of this[ao])i[vt]=this[Rd];return this._updateBalancedPoolStats(),this}_updateBalancedPoolStats(){let e=0;for(let t=0;t<this[ao].length;t++)e=gX(this[ao][t][vt],e);this[I8]=e}removeUpstream(e){let t=Td.parseOrigin(e).origin,a=this[ao].find(i=>i[Dd].origin===t&&i.closed!==!0&&i.destroyed!==!0);return a&&this[lX](a),this}getUpstream(e){let t=Td.parseOrigin(e).origin;return this[ao].find(a=>a[Dd].origin===t&&a.closed!==!0&&a.destroyed!==!0)}get upstreams(){return this[ao].filter(e=>e.closed!==!0&&e.destroyed!==!0).map(e=>e[Dd].origin)}[uX](){if(this[ao].length===0)throw new sX;if(!this[ao].find(r=>!r[wm]&&r.closed!==!0&&r.destroyed!==!0)||this[ao].map(r=>r[wm]).reduce((r,s)=>r&&s,!0))return;let a=0,i=this[ao].findIndex(r=>!r[wm]);for(;a++<this[ao].length;){this[Tr]=(this[Tr]+1)%this[ao].length;let r=this[ao][this[Tr]];if(r[vt]>this[ao][i][vt]&&!r[wm]&&(i=this[Tr]),this[Tr]===0&&(this[Dr]=this[Dr]-this[I8],this[Dr]<=0&&(this[Dr]=this[Rd])),r[vt]>=this[Dr]&&!r[wm])return r}return this[Dr]=this[ao][i][vt],this[Tr]=i,this[ao][i]}};C8.exports=Ek});var D8=y((Yge,S8)=>{"use strict";var{PoolBase:hX,kClients:Ud,kNeedDrain:fX,kAddClient:B8,kGetDispatcher:bX,kRemoveClient:yX}=Bd(),kX=Ii(),{InvalidArgumentError:Ik}=$(),Q8=K(),{kUrl:Ck}=de(),AX=wr(),xm=Symbol("options"),jk=Symbol("connections"),Bk=Symbol("factory"),Od=Symbol("index");function wX(o,e){return new kX(o,e)}var Qk=class extends hX{constructor(e,{connections:t,factory:a=wX,connect:i,connectTimeout:r,tls:s,maxCachedSessions:n,socketPath:c,autoSelectFamily:m,autoSelectFamilyAttemptTimeout:l,allowH2:u,clientTtl:d,...g}={}){if(t!=null&&(!Number.isFinite(t)||t<0))throw new Ik("invalid connections");if(typeof a!="function")throw new Ik("factory must be a function.");if(i!=null&&typeof i!="function"&&typeof i!="object")throw new Ik("connect must be a function or an object");typeof i!="function"&&(i=AX({...s,maxCachedSessions:n,allowH2:u,socketPath:c,timeout:r,...typeof m=="boolean"?{autoSelectFamily:m,autoSelectFamilyAttemptTimeout:l}:void 0,...i})),super(),this[jk]=t||null,this[Ck]=Q8.parseOrigin(e),this[xm]={...Q8.deepClone(g),connect:i,allowH2:u,clientTtl:d,socketPath:c},this[xm].interceptors=g.interceptors?{...g.interceptors}:void 0,this[Bk]=a,this[Od]=-1,this.on("connect",(p,b)=>{if(d!=null&&d>0)for(let A of b)Object.assign(A,{ttl:Date.now()})}),this.on("connectionError",(p,b,A)=>{for(let k of b){let x=this[Ud].indexOf(k);x!==-1&&this[Ud].splice(x,1)}})}[bX](){let e=this[xm].clientTtl,t=this[Ud].length;if(t===0){let i=this[Bk](this[Ck],this[xm]);return this[B8](i),i}let a=0;for(;a<t;){this[Od]=(this[Od]+1)%t;let i=this[Ud][this[Od]];if(e!=null&&e>0&&i.ttl&&Date.now()-i.ttl>e){this[yX](i),a++;continue}if(!i[fX])return i;a++}if(!this[jk]||t<this[jk]){let i=this[Bk](this[Ck],this[xm]);return this[B8](i),i}}};S8.exports=Qk});var Rr=y((Vge,_8)=>{"use strict";var{InvalidArgumentError:Md,MaxOriginsReachedError:vX}=$(),{kClients:xt,kRunning:T8,kClose:xX,kDestroy:zX,kDispatch:qX,kUrl:EX}=de(),IX=Ar(),CX=Sr(),jX=Ii(),BX=K(),R8=Symbol("onConnect"),N8=Symbol("onDisconnect"),U8=Symbol("onConnectionError"),O8=Symbol("onDrain"),M8=Symbol("factory"),Sk=Symbol("options"),zm=Symbol("origins");function QX(o,e){return e&&e.connections===1?new jX(o,e):new CX(o,e)}var Dk=class extends IX{constructor({factory:e=QX,maxOrigins:t=1/0,connect:a,...i}={}){if(typeof e!="function")throw new Md("factory must be a function.");if(a!=null&&typeof a!="function"&&typeof a!="object")throw new Md("connect must be a function or an object");if(typeof t!="number"||Number.isNaN(t)||t<=0)throw new Md("maxOrigins must be a number greater than 0");super(i),a&&typeof a!="function"&&(a={...a}),this[Sk]={...BX.deepClone(i),maxOrigins:t,connect:a},this[M8]=e,this[xt]=new Map,this[zm]=new Set,this[O8]=(r,s)=>{this.emit("drain",r,[this,...s])},this[R8]=(r,s)=>{this.emit("connect",r,[this,...s])},this[N8]=(r,s,n)=>{this.emit("disconnect",r,[this,...s],n)},this[U8]=(r,s,n)=>{this.emit("connectionError",r,[this,...s],n)}}get[T8](){let e=0;for(let{dispatcher:t}of this[xt].values())e+=t[T8];return e}[qX](e,t){let a;if(e.origin&&(typeof e.origin=="string"||e.origin instanceof URL))a=String(e.origin);else throw new Md("opts.origin must be a non-empty string or URL.");if(this[zm].size>=this[Sk].maxOrigins&&!this[zm].has(a))throw new vX;let i=this[xt].get(a),r=i&&i.dispatcher;if(!r){let s=n=>{let c=this[xt].get(a);c&&(n&&(c.count-=1),c.count<=0&&(this[xt].delete(a),c.dispatcher.destroyed||c.dispatcher.close()),this[zm].delete(a))};r=this[M8](e.origin,this[Sk]).on("drain",this[O8]).on("connect",(n,c)=>{let m=this[xt].get(a);m&&(m.count+=1),this[R8](n,c)}).on("disconnect",(n,c,m)=>{s(!0),this[N8](n,c,m)}).on("connectionError",(n,c,m)=>{s(!1),this[U8](n,c,m)}),this[xt].set(a,{count:0,dispatcher:r}),this[zm].add(a)}return r.dispatch(e,t)}[xX](){let e=[];for(let{dispatcher:t}of this[xt].values())e.push(t.close());return this[xt].clear(),Promise.all(e)}[zX](e){let t=[];for(let{dispatcher:a}of this[xt].values())t.push(a.destroy(e));return this[xt].clear(),Promise.all(t)}get stats(){let e={};for(let{dispatcher:t}of this[xt].values())t.stats&&(e[t[EX].origin]=t.stats);return e}};_8.exports=Dk});var P8=y(($ge,F8)=>{"use strict";var{Buffer:ji}=require("buffer"),Tk=require("net"),{InvalidArgumentError:Ci}=$();function SX(o){if(Tk.isIPv4(o)){let t=o.split(".").map(Number);return{type:1,buffer:ji.from(t)}}if(Tk.isIPv6(o))return{type:4,buffer:L8(o)};let e=ji.from(o,"utf8");if(e.length>255)throw new Ci("Domain name too long (max 255 bytes)");return{type:3,buffer:ji.concat([ji.from([e.length]),e])}}function L8(o){let e=ji.alloc(16),t=o;if(o.includes(".")){let i=o.lastIndexOf(":"),r=o.slice(i+1);if(Tk.isIPv4(r)){let s=r.split(".").map(Number),n=(s[0]<<8|s[1]).toString(16),c=(s[2]<<8|s[3]).toString(16);t=`${o.slice(0,i)}:${n}:${c}`}}let a=t.indexOf("::");if(a!==-1){let i=t.slice(0,a),r=t.slice(a+2),s=i===""?[]:i.split(":"),n=r===""?[]:r.split(":"),c=0;for(let m of s)e.writeUInt16BE(parseInt(m,16),c),c+=2;c=16-n.length*2;for(let m of n)e.writeUInt16BE(parseInt(m,16),c),c+=2}else{let i=t.split(":");for(let r=0;r<i.length;r++)e.writeUInt16BE(parseInt(i[r],16),r*2)}return e}function DX(o,e,t){let a=ji.allocUnsafe(2);return a.writeUInt16BE(t,0),ji.concat([ji.from([o]),e,a])}function TX(o,e=0){if(o.length<e+1)throw new Ci("Buffer too small to contain address type");let t=o[e],a,i=e+1;switch(t){case 1:{if(o.length<i+6)throw new Ci("Buffer too small for IPv4 address");a=Array.from(o.subarray(i,i+4)).join("."),i+=4;break}case 3:{if(o.length<i+1)throw new Ci("Buffer too small for domain length");let s=o[i];if(i+=1,o.length<i+s+2)throw new Ci("Buffer too small for domain address");a=o.subarray(i,i+s).toString("utf8"),i+=s;break}case 4:{if(o.length<i+18)throw new Ci("Buffer too small for IPv6 address");let s=[];for(let n=0;n<8;n++){let c=o.readUInt16BE(i+n*2);s.push(c.toString(16))}a=s.join(":"),i+=16;break}default:throw new Ci(`Invalid address type: ${t}`)}if(o.length<i+2)throw new Ci("Buffer too small for port");let r=o.readUInt16BE(i);return i+=2,{address:a,port:r,bytesRead:i-e}}function RX(o){let t={1:"General SOCKS server failure",2:"Connection not allowed by ruleset",3:"Network unreachable",4:"Host unreachable",5:"Connection refused",6:"TTL expired",7:"Command not supported",8:"Address type not supported"}[o]||`Unknown SOCKS5 error code: ${o}`,a=new Error(t);return a.code=`SOCKS5_${o}`,a}F8.exports={parseAddress:SX,parseIPv6:L8,buildAddressBuffer:DX,parseResponseAddress:TX,createReplyError:RX}});var V8=y((Wge,Y8)=>{"use strict";var{EventEmitter:NX}=require("events"),{Buffer:Nr}=require("buffer"),{InvalidArgumentError:en,Socks5ProxyError:Bi}=$(),{debuglog:UX}=require("util"),{parseAddress:OX}=P8(),La=UX("undici:socks5"),H8=Nr.alloc(0),_d=5,on={NO_AUTH:0,GSSAPI:1,USERNAME_PASSWORD:2,NO_ACCEPTABLE:255},G8={CONNECT:1,BIND:2,UDP_ASSOCIATE:3},Ur={IPV4:1,DOMAIN:3,IPV6:4},ra={SUCCEEDED:0,GENERAL_FAILURE:1,CONNECTION_NOT_ALLOWED:2,NETWORK_UNREACHABLE:3,HOST_UNREACHABLE:4,CONNECTION_REFUSED:5,TTL_EXPIRED:6,COMMAND_NOT_SUPPORTED:7,ADDRESS_TYPE_NOT_SUPPORTED:8},mo={INITIAL:"initial",HANDSHAKING:"handshaking",AUTHENTICATING:"authenticating",AUTHENTICATED:"authenticated",CONNECTING:"connecting",CONNECTED:"connected",ERROR:"error",CLOSED:"closed"},Rk=class extends NX{constructor(e,t={}){if(super(),!e)throw new en("socket is required");this.socket=e,this.options=t,this.state=mo.INITIAL,this.buffer=H8,this.onSocketData=this.onData.bind(this),this.onSocketError=this.onError.bind(this),this.onSocketClose=this.onClose.bind(this),this.authMethods=[],t.username&&t.password&&this.authMethods.push(on.USERNAME_PASSWORD),this.authMethods.push(on.NO_AUTH),this.socket.on("data",this.onSocketData),this.socket.on("error",this.onSocketError),this.socket.on("close",this.onSocketClose)}onData(e){La("received data",e.length,"bytes in state",this.state),this.buffer=Nr.concat([this.buffer,e]);try{switch(this.state){case mo.HANDSHAKING:this.handleHandshakeResponse();break;case mo.AUTHENTICATING:this.handleAuthResponse();break;case mo.CONNECTING:this.handleConnectResponse();break}}catch(t){this.onError(t)}}onError(e){La("socket error",e),this.state=mo.ERROR,this.emit("error",e),this.destroy()}onClose(){La("socket closed"),this.state=mo.CLOSED,this.emit("close")}destroy(){this.socket&&!this.socket.destroyed&&this.socket.destroy()}markAuthenticated(){this.state=mo.AUTHENTICATED,this.emit("authenticated")}handshake(){if(this.state!==mo.INITIAL)throw new en("Handshake already started");La("starting handshake with",this.authMethods.length,"auth methods"),this.state=mo.HANDSHAKING;let e=Nr.alloc(2+this.authMethods.length);e[0]=_d,e[1]=this.authMethods.length,this.authMethods.forEach((t,a)=>{e[2+a]=t}),this.socket.write(e)}handleHandshakeResponse(){if(this.buffer.length<2)return;let e=this.buffer[0],t=this.buffer[1];if(e!==_d)throw new Bi(`Invalid SOCKS version: ${e}`,"UND_ERR_SOCKS5_VERSION");if(t===on.NO_ACCEPTABLE)throw new Bi("No acceptable authentication method","UND_ERR_SOCKS5_AUTH_REJECTED");if(this.buffer=this.buffer.subarray(2),La("server selected auth method",t),t===on.NO_AUTH)this.markAuthenticated();else if(t===on.USERNAME_PASSWORD)this.state=mo.AUTHENTICATING,this.sendAuthRequest();else throw new Bi(`Unsupported authentication method: ${t}`,"UND_ERR_SOCKS5_AUTH_METHOD")}sendAuthRequest(){let{username:e,password:t}=this.options;if(!e||!t)throw new en("Username and password required for authentication");La("sending username/password auth");let a=Nr.from(e),i=Nr.from(t);if(a.length>255||i.length>255)throw new en("Username or password too long");let r=Nr.alloc(3+a.length+i.length);r[0]=1,r[1]=a.length,a.copy(r,2),r[2+a.length]=i.length,i.copy(r,3+a.length),this.socket.write(r)}handleAuthResponse(){if(this.buffer.length<2)return;let e=this.buffer[0],t=this.buffer[1];if(e!==1)throw new Bi(`Invalid auth sub-negotiation version: ${e}`,"UND_ERR_SOCKS5_AUTH_VERSION");if(t!==0)throw new Bi("Authentication failed","UND_ERR_SOCKS5_AUTH_FAILED");this.buffer=this.buffer.subarray(2),La("authentication successful"),this.markAuthenticated()}connect(e,t){if(this.state===mo.CONNECTING||this.state===mo.CONNECTED)throw new en("Connection already in progress");if(this.state!==mo.AUTHENTICATED)throw new en("Client must be authenticated before CONNECT");La("connecting to",e,t),this.state=mo.CONNECTING;let a=this.buildConnectRequest(G8.CONNECT,e,t);this.socket.write(a)}buildConnectRequest(e,t,a){let{type:i,buffer:r}=OX(t),s=Nr.alloc(4+r.length+2);return s[0]=_d,s[1]=e,s[2]=0,s[3]=i,r.copy(s,4),s.writeUInt16BE(a,4+r.length),s}handleConnectResponse(){if(this.buffer.length<4)return;let e=this.buffer[0],t=this.buffer[1],a=this.buffer[3];if(e!==_d)throw new Bi(`Invalid SOCKS version in reply: ${e}`,"UND_ERR_SOCKS5_REPLY_VERSION");let i=4;if(a===Ur.IPV4)i+=6;else if(a===Ur.DOMAIN){if(this.buffer.length<5)return;i+=1+this.buffer[4]+2}else if(a===Ur.IPV6)i+=18;else throw new Bi(`Invalid address type in reply: ${a}`,"UND_ERR_SOCKS5_ADDR_TYPE");if(this.buffer.length<i)return;if(t!==ra.SUCCEEDED){let c=this.getReplyErrorMessage(t);throw new Bi(`SOCKS5 connection failed: ${c}`,`UND_ERR_SOCKS5_REPLY_${t}`)}let r,s=4;if(a===Ur.IPV4)r=Array.from(this.buffer.subarray(s,s+4)).join("."),s+=4;else if(a===Ur.DOMAIN){let c=this.buffer[s];s+=1,r=this.buffer.subarray(s,s+c).toString(),s+=c}else if(a===Ur.IPV6){let c=[];for(let m=0;m<8;m++){let l=this.buffer.readUInt16BE(s+m*2);c.push(l.toString(16))}r=c.join(":"),s+=16}let n=this.buffer.readUInt16BE(s);this.buffer=H8,this.state=mo.CONNECTED,this.socket.removeListener("data",this.onSocketData),La("connected, bound address:",r,"port:",n),this.emit("connected",{address:r,port:n})}getReplyErrorMessage(e){switch(e){case ra.GENERAL_FAILURE:return"General SOCKS server failure";case ra.CONNECTION_NOT_ALLOWED:return"Connection not allowed by ruleset";case ra.NETWORK_UNREACHABLE:return"Network unreachable";case ra.HOST_UNREACHABLE:return"Host unreachable";case ra.CONNECTION_REFUSED:return"Connection refused";case ra.TTL_EXPIRED:return"TTL expired";case ra.COMMAND_NOT_SUPPORTED:return"Command not supported";case ra.ADDRESS_TYPE_NOT_SUPPORTED:return"Address type not supported";default:return`Unknown error code: ${e}`}}};Y8.exports={Socks5Client:Rk,AUTH_METHODS:on,COMMANDS:G8,ADDRESS_TYPES:Ur,REPLY_CODES:ra,STATES:mo}});var _k=y((Jge,oB)=>{"use strict";var{URL:$8}=require("url"),Nk,MX=Ar(),{InvalidArgumentError:W8}=$(),{Socks5Client:_X,STATES:LX}=V8(),{kDispatch:J8,kClose:FX,kDestroy:PX}=de(),HX=Sr(),GX=wr(),{debuglog:YX}=require("util"),Qi=YX("undici:socks5-proxy"),Uk=Symbol("proxy url"),VX=Symbol("proxy headers"),K8=Symbol("proxy auth"),Z8=Symbol("proxy protocol"),Or=Symbol("pools"),X8=Symbol("connector"),Ok=Symbol("request tls settings"),eB=!1,Mk=class extends MX{constructor(e,t={}){if(super(),eB||(process.emitWarning("SOCKS5 proxy support is experimental and subject to change","ExperimentalWarning"),eB=!0),!e)throw new W8("Proxy URL is mandatory");let a=typeof e=="string"?new $8(e):e;if(a.protocol!=="socks5:"&&a.protocol!=="socks:")throw new W8("Proxy URL must use socks5:// or socks:// protocol");this[Uk]=a,this[VX]=t.headers||{},this[Z8]=t.proxyTls?"https:":"http:",this[Ok]=t.requestTls,this[K8]={username:t.username||(a.username?decodeURIComponent(a.username):null),password:t.password||(a.password?decodeURIComponent(a.password):null)},this[X8]=t.connect||GX({...t.proxyTls,servername:t.proxyTls?.servername||a.hostname}),this[Or]=new Map}async createSocks5Connection(e,t){let a=this[Uk].hostname,i=parseInt(this[Uk].port)||1080;Qi("creating SOCKS5 connection to",a,i);let r=await new Promise((n,c)=>{this[X8]({hostname:a,host:a,port:i,protocol:this[Z8]},(m,l)=>{m?c(m):n(l)})}),s=new _X(r,this[K8]);return s.on("error",n=>{Qi("SOCKS5 error:",n),r.destroy()}),await s.handshake(),await new Promise((n,c)=>{let m=setTimeout(()=>{c(new Error("SOCKS5 authentication timeout"))},5e3),l=()=>{clearTimeout(m),s.removeListener("error",u),n()},u=d=>{clearTimeout(m),s.removeListener("authenticated",l),c(d)};s.state===LX.AUTHENTICATED?(clearTimeout(m),n()):(s.once("authenticated",l),s.once("error",u))}),await s.connect(e,t),await new Promise((n,c)=>{let m=setTimeout(()=>{c(new Error("SOCKS5 connection timeout"))},5e3),l=d=>{Qi("SOCKS5 tunnel established to",e,t,"via",d),clearTimeout(m),s.removeListener("error",u),n()},u=d=>{clearTimeout(m),s.removeListener("connected",l),c(d)};s.once("connected",l),s.once("error",u)}),r}[J8](e,t){let{origin:a}=e;Qi("dispatching request to",a,"via SOCKS5");try{let i=String(a),r=this[Or].get(i);return(!r||r.destroyed||r.closed)&&(r=new HX(a,{pipelining:e.pipelining,connections:e.connections,connect:async(s,n)=>{try{let c=new $8(a),m=c.hostname,l=parseInt(c.port)||(c.protocol==="https:"?443:80);Qi("establishing SOCKS5 connection to",m,l);let u=await this.createSocks5Connection(m,l),d=u;c.protocol==="https:"&&(Nk||(Nk=require("tls")),Qi("upgrading to TLS"),d=Nk.connect({...this[Ok],socket:u,servername:this[Ok]?.servername||m}),await new Promise((g,p)=>{d.once("secureConnect",g),d.once("error",p)})),n(null,d)}catch(c){Qi("SOCKS5 connection error:",c),n(c)}}}),this[Or].set(i,r)),r[J8](e,t)}catch(i){if(Qi("dispatch error:",i),typeof t.onResponseError=="function")return t.onResponseError(null,i),!1;if(typeof t.onError=="function")return t.onError(i),!1;throw i}}async[FX](){let e=[];for(let t of this[Or].values())e.push(t.close());this[Or].clear(),await Promise.all(e)}async[PX](e){let t=[];for(let a of this[Or].values())t.push(a.destroy(e));this[Or].clear(),await Promise.all(t)}};oB.exports=Mk});var Hk=y((Kge,gB)=>{"use strict";var{kProxy:tn,kClose:cB,kDestroy:mB,kDispatch:tB}=de(),$X=Rr(),lB=Sr(),uB=Ar(),{InvalidArgumentError:Mr,RequestAbortedError:WX,SecureProxyConnectionError:JX}=$(),aB=wr(),dB=Ii(),{channels:iB}=yi(),KX=_k(),Ld=Symbol("proxy agent"),Si=Symbol("proxy client"),Fa=Symbol("proxy headers"),Lk=Symbol("request tls settings"),rB=Symbol("proxy tls settings"),sB=Symbol("connect endpoint function"),nB=Symbol("tunnel proxy");function ZX(o){return o==="https:"?443:80}function XX(o,e){return new lB(o,e)}var eee=()=>{};function oee(o,e){return e.connections===1?new dB(o,e):new lB(o,e)}var Fk=class extends uB{#e;constructor(e,{headers:t={},connect:a,factory:i}){if(!e)throw new Mr("Proxy URL is mandatory");super(),this[Fa]=t,i?this.#e=i(e,{connect:a}):this.#e=new dB(e,{connect:a})}[tB](e,t){let a=t.onHeaders;t.onHeaders=function(n,c,m){if(n===407){typeof t.onError=="function"&&t.onError(new Mr("Proxy Authentication Required (407)"));return}a&&a.call(this,n,c,m)};let{origin:i,path:r="/",headers:s={}}=e;if(e.path=i+r,!("host"in s)&&!("Host"in s)){let{host:n}=new URL(i);s.host=n}return e.headers={...this[Fa],...s},this.#e[tB](e,t)}[cB](){return this.#e.close()}[mB](e){return this.#e.destroy(e)}},Pk=class extends uB{constructor(e){if(!e||typeof e=="object"&&!(e instanceof URL)&&!e.uri)throw new Mr("Proxy uri is mandatory");let{clientFactory:t=XX}=e;if(typeof t!="function")throw new Mr("Proxy opts.clientFactory must be a function.");let{proxyTunnel:a=!0}=e;super();let i=this.#e(e),{href:r,origin:s,port:n,protocol:c,username:m,password:l,hostname:u}=i;if(this[tn]={uri:r,protocol:c},this[Lk]=e.requestTls,this[rB]=e.proxyTls,this[Fa]=e.headers||{},this[nB]=a,e.auth&&e.token)throw new Mr("opts.auth cannot be used in combination with opts.token");e.auth?this[Fa]["proxy-authorization"]=`Basic ${e.auth}`:e.token?this[Fa]["proxy-authorization"]=e.token:m&&l&&(this[Fa]["proxy-authorization"]=`Basic ${Buffer.from(`${decodeURIComponent(m)}:${decodeURIComponent(l)}`).toString("base64")}`);let d=aB({...e.proxyTls});this[sB]=aB({...e.requestTls});let g=e.factory||oee,p=(b,A)=>{let{protocol:k}=new URL(b);return this[tn].protocol==="socks5:"||this[tn].protocol==="socks:"?new KX(this[tn].uri,{headers:this[Fa],connect:d,factory:g,username:e.username||m,password:e.password||l,proxyTls:e.proxyTls,requestTls:e.requestTls}):!this[nB]&&k==="http:"&&this[tn].protocol==="http:"?new Fk(this[tn].uri,{headers:this[Fa],connect:d,factory:g}):g(b,A)};c==="socks5:"||c==="socks:"?this[Si]=null:this[Si]=t(i,{connect:d}),this[Ld]=new $X({...e,factory:p,connect:async(b,A)=>{if(!this[Si]){A(new Mr("Cannot establish tunnel connection without a proxy client"));return}let k=b.host;b.port||(k+=`:${ZX(b.protocol)}`);try{let x={origin:s,port:n,path:k,signal:b.signal,headers:{...this[Fa],host:b.host,...b.connections==null||b.connections>0?{"proxy-connection":"keep-alive"}:{}},servername:this[rB]?.servername||u},{socket:v,statusCode:j}=await this[Si].connect(x);if(j!==200){v.on("error",eee).destroy(),A(new WX(`Proxy response (${j}) !== 200 when HTTP Tunneling`));return}if(iB.proxyConnected.hasSubscribers&&iB.proxyConnected.publish({socket:v,connectParams:x}),b.protocol!=="https:"){A(null,v);return}let I;this[Lk]?I=this[Lk].servername:I=b.servername,this[sB]({...b,servername:I,httpSocket:v},A)}catch(x){x.code==="ERR_TLS_CERT_ALTNAME_INVALID"?A(new JX(x)):A(x)}}})}dispatch(e,t){let a=tee(e.headers);if(aee(a),a&&!("host"in a)&&!("Host"in a)){let{host:i}=new URL(e.origin);a.host=i}return this[Ld].dispatch({...e,headers:a},t)}#e(e){return typeof e=="string"?new URL(e):e instanceof URL?e:new URL(e.uri)}[cB](){let e=[this[Ld].close()];return this[Si]&&e.push(this[Si].close()),Promise.all(e)}[mB](){let e=[this[Ld].destroy()];return this[Si]&&e.push(this[Si].destroy()),Promise.all(e)}};function tee(o){if(Array.isArray(o)){let e={};for(let t=0;t<o.length;t+=2)e[o[t]]=o[t+1];return e}return o}function aee(o){if(o&&Object.keys(o).find(t=>t.toLowerCase()==="proxy-authorization"))throw new Mr("Proxy-Authorization should be sent in ProxyAgent constructor")}gB.exports=Pk});var yB=y((Zge,bB)=>{"use strict";var iee=Ar(),{kClose:ree,kDestroy:see,kClosed:pB,kDestroyed:hB,kDispatch:nee,kNoProxyAgent:qm,kHttpProxyAgent:Di,kHttpsProxyAgent:_r}=de(),fB=Hk(),cee=Rr(),mee={"http:":80,"https:":443},Gk=class extends iee{#e=null;#o=null;#a=null;constructor(e={}){super(),this.#a=e;let{httpProxy:t,httpsProxy:a,noProxy:i,...r}=e;this[qm]=new cee(r);let s=t??process.env.http_proxy??process.env.HTTP_PROXY;s?this[Di]=new fB({...r,uri:s}):this[Di]=this[qm];let n=a??process.env.https_proxy??process.env.HTTPS_PROXY;n?this[_r]=new fB({...r,uri:n}):this[_r]=this[Di],this.#t()}[nee](e,t){let a=new URL(e.origin);return this.#i(a).dispatch(e,t)}[ree](){return Promise.all([this[qm].close(),!this[Di][pB]&&this[Di].close(),!this[_r][pB]&&this[_r].close()])}[see](e){return Promise.all([this[qm].destroy(e),!this[Di][hB]&&this[Di].destroy(e),!this[_r][hB]&&this[_r].destroy(e)])}#i(e){let{protocol:t,host:a,port:i}=e;return a=a.replace(/:\d*$/,"").toLowerCase(),i=Number.parseInt(i,10)||mee[t]||0,this.#r(a,i)?t==="https:"?this[_r]:this[Di]:this[qm]}#r(e,t){if(this.#c&&this.#t(),this.#o.length===0)return!0;if(this.#e==="*")return!1;for(let a=0;a<this.#o.length;a++){let i=this.#o[a];if(!(i.port&&i.port!==t)&&(e===i.hostname||e.slice(-(i.hostname.length+1))===`.${i.hostname}`))return!1}return!0}#t(){let e=this.#a.noProxy??this.#s,t=e.split(/[,\s]/),a=[];for(let i=0;i<t.length;i++){let r=t[i];if(!r)continue;let s=r.match(/^(.+):(\d+)$/);a.push({hostname:(s?s[1]:r).replace(/^\*?\./,"").toLowerCase(),port:s?Number.parseInt(s[2],10):0})}this.#e=e,this.#o=a}get#c(){return this.#a.noProxy!==void 0?!1:this.#e!==this.#s}get#s(){return process.env.no_proxy??process.env.NO_PROXY??""}};bB.exports=Gk});var Fd=y((Xge,xB)=>{"use strict";var an=require("assert"),{kRetryHandlerDefaultRetry:kB}=de(),{RequestRetryError:rn}=$(),lee=Jc(),{isDisturbed:AB,parseRangeHeader:wB,wrapRequestBody:uee}=K();function dee(o){let e=new Date(o).getTime();return isNaN(e)?0:e-Date.now()}function vB(o,e,t,a){let i=o["content-length"];if(i==null||!Number.isFinite(e.start)||!Number.isFinite(e.end))return;let r=Number(i),s=e.end-e.start+1;if(!Number.isFinite(r)||r!==s)throw new rn("Content-Length mismatch",t,{headers:o,data:{count:a}})}var Yk=class o{constructor(e,{dispatch:t,handler:a}){let{retryOptions:i,...r}=e,{retry:s,maxRetries:n,maxTimeout:c,minTimeout:m,timeoutFactor:l,methods:u,errorCodes:d,retryAfter:g,statusCodes:p,throwOnError:b}=i??{};this.error=null,this.dispatch=t,this.handler=lee.wrap(a),this.opts={...r,body:uee(e.body)},this.retryOpts={throwOnError:b??!0,retry:s??o[kB],retryAfter:g??!0,maxTimeout:c??30*1e3,minTimeout:m??500,timeoutFactor:l??2,maxRetries:n??5,methods:u??["GET","HEAD","OPTIONS","PUT","DELETE","TRACE"],statusCodes:p??[500,502,503,504,429],errorCodes:d??["ECONNRESET","ECONNREFUSED","ENOTFOUND","ENETDOWN","ENETUNREACH","EHOSTDOWN","EHOSTUNREACH","EPIPE","UND_ERR_SOCKET"]},this.retryCount=0,this.retryCountCheckpoint=0,this.headersSent=!1,this.start=0,this.end=null,this.etag=null}onResponseStartWithRetry(e,t,a,i,r){if(this.retryOpts.throwOnError){this.retryOpts.statusCodes.includes(t)===!1?(this.headersSent=!0,this.handler.onResponseStart?.(e,t,a,i)):this.error=r;return}if(AB(this.opts.body)){this.headersSent=!0,this.handler.onResponseStart?.(e,t,a,i);return}function s(n){if(n){this.headersSent=!0,this.handler.onResponseStart?.(e,t,a,i),e.resume();return}this.error=r,e.resume()}e.pause(),this.retryOpts.retry(r,{state:{counter:this.retryCount},opts:{retryOptions:this.retryOpts,...this.opts}},s.bind(this))}onRequestStart(e,t){this.headersSent||this.handler.onRequestStart?.(e,t)}onRequestUpgrade(e,t,a,i){this.handler.onRequestUpgrade?.(e,t,a,i)}static[kB](e,{state:t,opts:a},i){let{statusCode:r,code:s,headers:n}=e,{method:c,retryOptions:m}=a,{maxRetries:l,minTimeout:u,maxTimeout:d,timeoutFactor:g,statusCodes:p,errorCodes:b,methods:A}=m,{counter:k}=t;if(s&&s!=="UND_ERR_REQ_RETRY"&&!b.includes(s)){i(e);return}if(Array.isArray(A)&&!A.includes(c)){i(e);return}if(r!=null&&Array.isArray(p)&&!p.includes(r)){i(e);return}if(k>l){i(e);return}let x=n?.["retry-after"];x&&(x=Number(x),x=Number.isNaN(x)?dee(n["retry-after"]):x*1e3);let v=x>0?Math.min(x,d):Math.min(u*g**(k-1),d);setTimeout(()=>i(null),v)}onResponseStart(e,t,a,i){if(this.error=null,this.retryCount+=1,t>=300){let r=new rn("Request failed",t,{headers:a,data:{count:this.retryCount}});this.onResponseStartWithRetry(e,t,a,i,r);return}if(this.headersSent){if(t!==206&&(this.start>0||t!==200))throw new rn("server does not support the range header and the payload was partially consumed",t,{headers:a,data:{count:this.retryCount}});let r=wB(a["content-range"]);if(!r)throw new rn("Content-Range mismatch",t,{headers:a,data:{count:this.retryCount}});if(this.etag!=null&&this.etag!==a.etag)throw new rn("ETag mismatch",t,{headers:a,data:{count:this.retryCount}});vB(a,r,t,this.retryCount);let{start:s,size:n,end:c=n?n-1:null}=r;an(this.start===s,"content-range mismatch"),an(this.end==null||this.end===c,"content-range mismatch");return}if(this.end==null){if(t===206){let r=wB(a["content-range"]);if(r==null){this.headersSent=!0,this.handler.onResponseStart?.(e,t,a,i);return}vB(a,r,t,this.retryCount);let{start:s,size:n,end:c=n?n-1:null}=r;an(s!=null&&Number.isFinite(s),"content-range mismatch"),an(c!=null&&Number.isFinite(c),"invalid content-length"),this.start=s,this.end=c}if(this.end==null){let r=a["content-length"];this.end=r!=null?Number(r)-1:null}an(Number.isFinite(this.start)),an(this.end==null||Number.isFinite(this.end),"invalid content-length"),this.resume=!0,this.etag=a.etag!=null?a.etag:null,this.etag!=null&&this.etag[0]==="W"&&this.etag[1]==="/"&&(this.etag=null),this.headersSent=!0,this.handler.onResponseStart?.(e,t,a,i)}else throw new rn("Request failed",t,{headers:a,data:{count:this.retryCount}})}onResponseData(e,t){this.error||(this.start+=t.length,this.handler.onResponseData?.(e,t))}onResponseEnd(e,t){if(this.error&&this.retryOpts.throwOnError)throw this.error;if(!this.error)return this.retryCount=0,this.handler.onResponseEnd?.(e,t);this.retry(e)}retry(e){if(this.start!==0){let t={range:`bytes=${this.start}-${this.end??""}`};this.etag!=null&&(t["if-match"]=this.etag),this.opts={...this.opts,headers:{...this.opts.headers,...t}}}try{this.retryCountCheckpoint=this.retryCount,this.dispatch(this.opts,this)}catch(t){this.handler.onResponseError?.(e,t)}}onResponseError(e,t){if(e?.aborted||AB(this.opts.body)){this.handler.onResponseError?.(e,t);return}function a(i){if(!i){this.retry(e);return}this.handler?.onResponseError?.(e,i)}this.retryCount-this.retryCountCheckpoint>0?this.retryCount=this.retryCountCheckpoint+(this.retryCount-this.retryCountCheckpoint):this.retryCount+=1,this.retryOpts.retry(t,{state:{counter:this.retryCount},opts:{retryOptions:this.retryOpts,...this.opts}},a.bind(this))}};xB.exports=Yk});var qB=y((epe,zB)=>{"use strict";var gee=Kc(),pee=Fd(),Vk=class extends gee{#e=null;#o=null;constructor(e,t={}){super(t),this.#e=e,this.#o=t}dispatch(e,t){let a=new pee({...e,retryOptions:this.#o},{dispatch:this.#e.dispatch.bind(this.#e),handler:t});return this.#e.dispatch(e,a)}close(){return this.#e.close()}destroy(){return this.#e.destroy()}};zB.exports=Vk});var CB=y((ope,IB)=>{"use strict";var{InvalidArgumentError:EB}=$(),hee=Ii(),$k=class extends hee{constructor(e,t){if(typeof e=="string"&&(e=new URL(e)),e.protocol!=="http:")throw new EB("h2c-client: Only h2c protocol is supported");let{maxConcurrentStreams:a,pipelining:i,...r}=t??{},s=100,n=100;if(a!=null&&Number.isInteger(a)&&a>0&&(s=a),i!=null&&Number.isInteger(i)&&i>0&&(n=i),n>s)throw new EB("h2c-client: pipelining cannot be greater than maxConcurrentStreams");super(e,{...r,maxConcurrentStreams:s,pipelining:n,allowH2:!0,useH2c:!0})}};IB.exports=$k});var UB=y((tpe,NB)=>{"use strict";var SB=require("assert"),{Readable:fee}=require("stream"),{RequestAbortedError:DB,NotSupportedError:bee,InvalidArgumentError:yee,AbortError:Pd}=$(),TB=K(),{ReadableStreamFrom:kee}=K(),Ko=Symbol("kConsume"),Hd=Symbol("kReading"),Lr=Symbol("kBody"),jB=Symbol("kAbort"),RB=Symbol("kContentType"),Wk=Symbol("kContentLength"),Jk=Symbol("kUsed"),Gd=Symbol("kBytesRead"),Aee=()=>{},Kk=class extends fee{constructor({resume:e,abort:t,contentType:a="",contentLength:i,highWaterMark:r=64*1024}){super({autoDestroy:!0,read:e,highWaterMark:r}),this._readableState.dataEmitted=!1,this[jB]=t,this[Ko]=null,this[Gd]=0,this[Lr]=null,this[Jk]=!1,this[RB]=a,this[Wk]=Number.isFinite(i)?i:null,this[Hd]=!1}_destroy(e,t){!e&&!this._readableState.endEmitted&&(e=new DB),e&&this[jB](),this[Jk]?t(e):setImmediate(t,e)}on(e,t){return(e==="data"||e==="readable")&&(this[Hd]=!0,this[Jk]=!0),super.on(e,t)}addListener(e,t){return this.on(e,t)}off(e,t){let a=super.off(e,t);return(e==="data"||e==="readable")&&(this[Hd]=this.listenerCount("data")>0||this.listenerCount("readable")>0),a}removeListener(e,t){return this.off(e,t)}push(e){return e&&(this[Gd]+=e.length,this[Ko])?(Xk(this[Ko],e),this[Hd]?super.push(e):!0):super.push(e)}text(){return Em(this,"text")}json(){return Em(this,"json")}blob(){return Em(this,"blob")}bytes(){return Em(this,"bytes")}arrayBuffer(){return Em(this,"arrayBuffer")}async formData(){throw new bee}get bodyUsed(){return TB.isDisturbed(this)}get body(){return this[Lr]||(this[Lr]=kee(this),this[Ko]&&(this[Lr].getReader(),SB(this[Lr].locked))),this[Lr]}dump(e){let t=e?.signal;if(t!=null&&(typeof t!="object"||!("aborted"in t)))return Promise.reject(new yee("signal must be an AbortSignal"));let a=e?.limit&&Number.isFinite(e.limit)?e.limit:128*1024;return t?.aborted?Promise.reject(t.reason??new Pd):this._readableState.closeEmitted?Promise.resolve(null):new Promise((i,r)=>{if((this[Wk]&&this[Wk]>a||this[Gd]>a)&&this.destroy(new Pd),t){let s=()=>{this.destroy(t.reason??new Pd)};t.addEventListener("abort",s),this.on("close",function(){t.removeEventListener("abort",s),t.aborted?r(t.reason??new Pd):i(null)})}else this.on("close",i);this.on("error",Aee).on("data",()=>{this[Gd]>a&&this.destroy()}).resume()})}setEncoding(e){return Buffer.isEncoding(e)&&(this._readableState.encoding=e),this}};function wee(o){return o[Lr]?.locked===!0||o[Ko]!==null}function vee(o){return TB.isDisturbed(o)||wee(o)}function Em(o,e){return SB(!o[Ko]),new Promise((t,a)=>{if(vee(o)){let i=o._readableState;i.destroyed&&i.closeEmitted===!1?o.on("error",a).on("close",()=>{a(new TypeError("unusable"))}):a(i.errored??new TypeError("unusable"))}else queueMicrotask(()=>{o[Ko]={type:e,stream:o,resolve:t,reject:a,length:0,body:[]},o.on("error",function(i){eA(this[Ko],i)}).on("close",function(){this[Ko].body!==null&&eA(this[Ko],new DB)}),xee(o[Ko])})})}function xee(o){if(o.body===null)return;let{_readableState:e}=o.stream;if(e.bufferIndex){let t=e.bufferIndex,a=e.buffer.length;for(let i=t;i<a;i++)Xk(o,e.buffer[i])}else for(let t of e.buffer)Xk(o,t);for(e.endEmitted?QB(this[Ko],this._readableState.encoding):o.stream.on("end",function(){QB(this[Ko],this._readableState.encoding)}),o.stream.resume();o.stream.read()!=null;);}function Zk(o,e,t){if(o.length===0||e===0)return"";let a=o.length===1?o[0]:Buffer.concat(o,e),i=a.length,r=i>2&&a[0]===239&&a[1]===187&&a[2]===191?3:0;return!t||t==="utf8"||t==="utf-8"?a.utf8Slice(r,i):a.subarray(r,i).toString(t)}function BB(o,e){if(o.length===0||e===0)return new Uint8Array(0);if(o.length===1)return new Uint8Array(o[0]);let t=new Uint8Array(Buffer.allocUnsafeSlow(e).buffer),a=0;for(let i=0;i<o.length;++i){let r=o[i];t.set(r,a),a+=r.length}return t}function QB(o,e){let{type:t,body:a,resolve:i,stream:r,length:s}=o;try{t==="text"?i(Zk(a,s,e)):t==="json"?i(JSON.parse(Zk(a,s,e))):t==="arrayBuffer"?i(BB(a,s).buffer):t==="blob"?i(new Blob(a,{type:r[RB]})):t==="bytes"&&i(BB(a,s)),eA(o)}catch(n){r.destroy(n)}}function Xk(o,e){o.length+=e.length,o.body.push(e)}function eA(o,e){o.body!==null&&(e?o.reject(e):o.resolve(),o.type=null,o.stream=null,o.resolve=null,o.reject=null,o.length=0,o.body=null)}NB.exports={Readable:Kk,chunksDecode:Zk}});var _B=y((ape,oA)=>{"use strict";var zee=require("assert"),{AsyncResource:qee}=require("async_hooks"),{Readable:Eee}=UB(),{InvalidArgumentError:sn,RequestAbortedError:OB}=$(),zt=K();function Im(){}var Yd=class extends qee{constructor(e,t){if(!e||typeof e!="object")throw new sn("invalid opts");let{signal:a,method:i,opaque:r,body:s,onInfo:n,responseHeaders:c,highWaterMark:m}=e;try{if(typeof t!="function")throw new sn("invalid callback");if(m!=null&&(!Number.isFinite(m)||m<0))throw new sn("invalid highWaterMark");if(a&&typeof a.on!="function"&&typeof a.addEventListener!="function")throw new sn("signal must be an EventEmitter or EventTarget");if(i==="CONNECT")throw new sn("invalid method");if(n&&typeof n!="function")throw new sn("invalid onInfo callback");super("UNDICI_REQUEST")}catch(l){throw zt.isStream(s)&&zt.destroy(s.on("error",Im),l),l}this.method=i,this.responseHeaders=c||null,this.opaque=r||null,this.callback=t,this.res=null,this.abort=null,this.body=s,this.trailers={},this.context=null,this.onInfo=n||null,this.highWaterMark=m,this.reason=null,this.removeAbortListener=null,a?.aborted?this.reason=a.reason??new OB:a&&(this.removeAbortListener=zt.addAbortListener(a,()=>{this.reason=a.reason??new OB,this.res?zt.destroy(this.res.on("error",Im),this.reason):this.abort&&this.abort(this.reason)}))}onConnect(e,t){if(this.reason){e(this.reason);return}zee(this.callback),this.abort=e,this.context=t}onHeaders(e,t,a,i){let{callback:r,opaque:s,abort:n,context:c,responseHeaders:m,highWaterMark:l}=this,u=m==="raw"?zt.parseRawHeaders(t):zt.parseHeaders(t);if(e<200){this.onInfo&&this.onInfo({statusCode:e,headers:u});return}let d=m==="raw"?zt.parseHeaders(t):u,g=d["content-type"],p=d["content-length"],b=new Eee({resume:a,abort:n,contentType:g,contentLength:this.method!=="HEAD"&&p?Number(p):null,highWaterMark:l});if(this.removeAbortListener&&(b.on("close",this.removeAbortListener),this.removeAbortListener=null),this.callback=null,this.res=b,r!==null)try{this.runInAsyncScope(r,null,null,{statusCode:e,statusText:i,headers:u,trailers:this.trailers,opaque:s,body:b,context:c})}catch(A){this.res=null,zt.destroy(b.on("error",Im),A),queueMicrotask(()=>{throw A})}}onData(e){return this.res.push(e)}onComplete(e){zt.parseHeaders(e,this.trailers),this.res.push(null)}onError(e){let{res:t,callback:a,body:i,opaque:r}=this;a&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(a,null,e,{opaque:r})})),t&&(this.res=null,queueMicrotask(()=>{zt.destroy(t.on("error",Im),e)})),i&&(this.body=null,zt.isStream(i)&&(i.on("error",Im),zt.destroy(i,e))),this.removeAbortListener&&(this.removeAbortListener(),this.removeAbortListener=null)}};function MB(o,e){if(e===void 0)return new Promise((t,a)=>{MB.call(this,o,(i,r)=>i?a(i):t(r))});try{let t=new Yd(o,e);this.dispatch(o,t)}catch(t){if(typeof e!="function")throw t;let a=o?.opaque;queueMicrotask(()=>e(t,{opaque:a}))}}oA.exports=MB;oA.exports.RequestHandler=Yd});var Cm=y((ipe,PB)=>{"use strict";var{addAbortListener:Iee}=K(),{RequestAbortedError:Cee}=$(),nn=Symbol("kListener"),sa=Symbol("kSignal");function LB(o){o.abort?o.abort(o[sa]?.reason):o.reason=o[sa]?.reason??new Cee,FB(o)}function jee(o,e){if(o.reason=null,o[sa]=null,o[nn]=null,!!e){if(e.aborted){LB(o);return}o[sa]=e,o[nn]=()=>{LB(o)},Iee(o[sa],o[nn])}}function FB(o){o[sa]&&("removeEventListener"in o[sa]?o[sa].removeEventListener("abort",o[nn]):o[sa].removeListener("abort",o[nn]),o[sa]=null,o[nn]=null)}PB.exports={addSignal:jee,removeSignal:FB}});var VB=y((rpe,YB)=>{"use strict";var Bee=require("assert"),{finished:Qee}=require("stream"),{AsyncResource:See}=require("async_hooks"),{InvalidArgumentError:cn,InvalidReturnValueError:Dee}=$(),Pa=K(),{addSignal:Tee,removeSignal:HB}=Cm();function Ree(){}var tA=class extends See{constructor(e,t,a){if(!e||typeof e!="object")throw new cn("invalid opts");let{signal:i,method:r,opaque:s,body:n,onInfo:c,responseHeaders:m}=e;try{if(typeof a!="function")throw new cn("invalid callback");if(typeof t!="function")throw new cn("invalid factory");if(i&&typeof i.on!="function"&&typeof i.addEventListener!="function")throw new cn("signal must be an EventEmitter or EventTarget");if(r==="CONNECT")throw new cn("invalid method");if(c&&typeof c!="function")throw new cn("invalid onInfo callback");super("UNDICI_STREAM")}catch(l){throw Pa.isStream(n)&&Pa.destroy(n.on("error",Ree),l),l}this.responseHeaders=m||null,this.opaque=s||null,this.factory=t,this.callback=a,this.res=null,this.abort=null,this.context=null,this.trailers=null,this.body=n,this.onInfo=c||null,Pa.isStream(n)&&n.on("error",l=>{this.onError(l)}),Tee(this,i)}onConnect(e,t){if(this.reason){e(this.reason);return}Bee(this.callback),this.abort=e,this.context=t}onHeaders(e,t,a,i){let{factory:r,opaque:s,context:n,responseHeaders:c}=this,m=c==="raw"?Pa.parseRawHeaders(t):Pa.parseHeaders(t);if(e<200){this.onInfo&&this.onInfo({statusCode:e,headers:m});return}if(this.factory=null,r===null)return;let l=this.runInAsyncScope(r,null,{statusCode:e,headers:m,opaque:s,context:n});if(!l||typeof l.write!="function"||typeof l.end!="function"||typeof l.on!="function")throw new Dee("expected Writable");return Qee(l,{readable:!1},d=>{let{callback:g,res:p,opaque:b,trailers:A,abort:k}=this;this.res=null,(d||!p?.readable)&&Pa.destroy(p,d),this.callback=null,this.runInAsyncScope(g,null,d||null,{opaque:b,trailers:A}),d&&k()}),l.on("drain",a),this.res=l,(l.writableNeedDrain!==void 0?l.writableNeedDrain:l._writableState?.needDrain)!==!0}onData(e){let{res:t}=this;return t?t.write(e):!0}onComplete(e){let{res:t}=this;HB(this),t&&(this.trailers=Pa.parseHeaders(e),t.end())}onError(e){let{res:t,callback:a,opaque:i,body:r}=this;HB(this),this.factory=null,t?(this.res=null,Pa.destroy(t,e)):a&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(a,null,e,{opaque:i})})),r&&(this.body=null,Pa.destroy(r,e))}};function GB(o,e,t){if(t===void 0)return new Promise((a,i)=>{GB.call(this,o,e,(r,s)=>r?i(r):a(s))});try{let a=new tA(o,e,t);this.dispatch(o,a)}catch(a){if(typeof t!="function")throw a;let i=o?.opaque;queueMicrotask(()=>t(a,{opaque:i}))}}YB.exports=GB});var KB=y((spe,JB)=>{"use strict";var{Readable:WB,Duplex:Nee,PassThrough:Uee}=require("stream"),Oee=require("assert"),{AsyncResource:Mee}=require("async_hooks"),{InvalidArgumentError:jm,InvalidReturnValueError:_ee,RequestAbortedError:aA}=$(),na=K(),{addSignal:Lee,removeSignal:Fee}=Cm();function $B(){}var mn=Symbol("resume"),iA=class extends WB{constructor(){super({autoDestroy:!0}),this[mn]=null}_read(){let{[mn]:e}=this;e&&(this[mn]=null,e())}_destroy(e,t){this._read(),t(e)}},rA=class extends WB{constructor(e){super({autoDestroy:!0}),this[mn]=e}_read(){this[mn]()}_destroy(e,t){!e&&!this._readableState.endEmitted&&(e=new aA),t(e)}},sA=class extends Mee{constructor(e,t){if(!e||typeof e!="object")throw new jm("invalid opts");if(typeof t!="function")throw new jm("invalid handler");let{signal:a,method:i,opaque:r,onInfo:s,responseHeaders:n}=e;if(a&&typeof a.on!="function"&&typeof a.addEventListener!="function")throw new jm("signal must be an EventEmitter or EventTarget");if(i==="CONNECT")throw new jm("invalid method");if(s&&typeof s!="function")throw new jm("invalid onInfo callback");super("UNDICI_PIPELINE"),this.opaque=r||null,this.responseHeaders=n||null,this.handler=t,this.abort=null,this.context=null,this.onInfo=s||null,this.req=new iA().on("error",$B),this.ret=new Nee({readableObjectMode:e.objectMode,autoDestroy:!0,read:()=>{let{body:c}=this;c?.resume&&c.resume()},write:(c,m,l)=>{let{req:u}=this;u.push(c,m)||u._readableState.destroyed?l():u[mn]=l},destroy:(c,m)=>{let{body:l,req:u,res:d,ret:g,abort:p}=this;!c&&!g._readableState.endEmitted&&(c=new aA),p&&c&&p(),na.destroy(l,c),na.destroy(u,c),na.destroy(d,c),Fee(this),m(c)}}).on("prefinish",()=>{let{req:c}=this;c.push(null)}),this.res=null,Lee(this,a)}onConnect(e,t){let{res:a}=this;if(this.reason){e(this.reason);return}Oee(!a,"pipeline cannot be retried"),this.abort=e,this.context=t}onHeaders(e,t,a){let{opaque:i,handler:r,context:s}=this;if(e<200){if(this.onInfo){let c=this.responseHeaders==="raw"?na.parseRawHeaders(t):na.parseHeaders(t);this.onInfo({statusCode:e,headers:c})}return}this.res=new rA(a);let n;try{this.handler=null;let c=this.responseHeaders==="raw"?na.parseRawHeaders(t):na.parseHeaders(t);n=this.runInAsyncScope(r,null,{statusCode:e,headers:c,opaque:i,body:this.res,context:s})}catch(c){throw this.res.on("error",$B),c}if(!n||typeof n.on!="function")throw new _ee("expected Readable");n.on("data",c=>{let{ret:m,body:l}=this;!m.push(c)&&l.pause&&l.pause()}).on("error",c=>{let{ret:m}=this;na.destroy(m,c)}).on("end",()=>{let{ret:c}=this;c.push(null)}).on("close",()=>{let{ret:c}=this;c._readableState.ended||na.destroy(c,new aA)}),this.body=n}onData(e){let{res:t}=this;return t.push(e)}onComplete(e){let{res:t}=this;t.push(null)}onError(e){let{ret:t}=this;this.handler=null,na.destroy(t,e)}};function Pee(o,e){try{let t=new sA(o,e);return this.dispatch({...o,body:t.req},t),t.ret}catch(t){return new Uee().destroy(t)}}JB.exports=Pee});var aQ=y((npe,tQ)=>{"use strict";var{InvalidArgumentError:nA,SocketError:Hee}=$(),{AsyncResource:Gee}=require("async_hooks"),ZB=require("assert"),XB=K(),{kHTTP2Stream:Yee}=de(),{addSignal:Vee,removeSignal:eQ}=Cm(),cA=class extends Gee{constructor(e,t){if(!e||typeof e!="object")throw new nA("invalid opts");if(typeof t!="function")throw new nA("invalid callback");let{signal:a,opaque:i,responseHeaders:r}=e;if(a&&typeof a.on!="function"&&typeof a.addEventListener!="function")throw new nA("signal must be an EventEmitter or EventTarget");super("UNDICI_UPGRADE"),this.responseHeaders=r||null,this.opaque=i||null,this.callback=t,this.abort=null,this.context=null,Vee(this,a)}onConnect(e,t){if(this.reason){e(this.reason);return}ZB(this.callback),this.abort=e,this.context=null}onHeaders(){throw new Hee("bad upgrade",null)}onUpgrade(e,t,a){ZB(a[Yee]===!0?e===200:e===101);let{callback:i,opaque:r,context:s}=this;eQ(this),this.callback=null;let n=this.responseHeaders==="raw"?XB.parseRawHeaders(t):XB.parseHeaders(t);this.runInAsyncScope(i,null,null,{headers:n,socket:a,opaque:r,context:s})}onError(e){let{callback:t,opaque:a}=this;eQ(this),t&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(t,null,e,{opaque:a})}))}};function oQ(o,e){if(e===void 0)return new Promise((t,a)=>{oQ.call(this,o,(i,r)=>i?a(i):t(r))});try{let t=new cA(o,e),a={...o,method:o.method||"GET",upgrade:o.protocol||"Websocket"};this.dispatch(a,t)}catch(t){if(typeof e!="function")throw t;let a=o?.opaque;queueMicrotask(()=>e(t,{opaque:a}))}}tQ.exports=oQ});var cQ=y((cpe,nQ)=>{"use strict";var $ee=require("assert"),{AsyncResource:Wee}=require("async_hooks"),{InvalidArgumentError:mA,SocketError:Jee}=$(),iQ=K(),{addSignal:Kee,removeSignal:rQ}=Cm(),lA=class extends Wee{constructor(e,t){if(!e||typeof e!="object")throw new mA("invalid opts");if(typeof t!="function")throw new mA("invalid callback");let{signal:a,opaque:i,responseHeaders:r}=e;if(a&&typeof a.on!="function"&&typeof a.addEventListener!="function")throw new mA("signal must be an EventEmitter or EventTarget");super("UNDICI_CONNECT"),this.opaque=i||null,this.responseHeaders=r||null,this.callback=t,this.abort=null,Kee(this,a)}onConnect(e,t){if(this.reason){e(this.reason);return}$ee(this.callback),this.abort=e,this.context=t}onHeaders(){throw new Jee("bad connect",null)}onUpgrade(e,t,a){let{callback:i,opaque:r,context:s}=this;rQ(this),this.callback=null;let n=t;n!=null&&(n=this.responseHeaders==="raw"?iQ.parseRawHeaders(t):iQ.parseHeaders(t)),this.runInAsyncScope(i,null,null,{statusCode:e,headers:n,socket:a,opaque:r,context:s})}onError(e){let{callback:t,opaque:a}=this;rQ(this),t&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(t,null,e,{opaque:a})}))}};function sQ(o,e){if(e===void 0)return new Promise((t,a)=>{sQ.call(this,o,(i,r)=>i?a(i):t(r))});try{let t=new lA(o,e),a={...o,method:"CONNECT"};this.dispatch(a,t)}catch(t){if(typeof e!="function")throw t;let a=o?.opaque;queueMicrotask(()=>e(t,{opaque:a}))}}nQ.exports=sQ});var mQ=y((mpe,ln)=>{"use strict";ln.exports.request=_B();ln.exports.stream=VB();ln.exports.pipeline=KB();ln.exports.upgrade=aQ();ln.exports.connect=cQ()});var dA=y((lpe,uQ)=>{"use strict";var{UndiciError:Zee}=$(),lQ=Symbol.for("undici.error.UND_MOCK_ERR_MOCK_NOT_MATCHED"),uA=class extends Zee{constructor(e){super(e),this.name="MockNotMatchedError",this.message=e||"The request does not match any registered mock dispatches",this.code="UND_MOCK_ERR_MOCK_NOT_MATCHED"}static[Symbol.hasInstance](e){return e&&e[lQ]===!0}get[lQ](){return!0}};uQ.exports={MockNotMatchedError:uA}});var Fr=y((upe,dQ)=>{"use strict";dQ.exports={kAgent:Symbol("agent"),kOptions:Symbol("options"),kFactory:Symbol("factory"),kDispatches:Symbol("dispatches"),kDispatchKey:Symbol("dispatch key"),kDefaultHeaders:Symbol("default headers"),kDefaultTrailers:Symbol("default trailers"),kContentLength:Symbol("content length"),kMockAgent:Symbol("mock agent"),kMockAgentSet:Symbol("mock agent set"),kMockAgentGet:Symbol("mock agent get"),kMockDispatch:Symbol("mock dispatch"),kClose:Symbol("close"),kOriginalClose:Symbol("original agent close"),kOriginalDispatch:Symbol("original dispatch"),kOrigin:Symbol("origin"),kIsMockActive:Symbol("is mock active"),kNetConnect:Symbol("net connect"),kGetNetConnect:Symbol("get net connect"),kConnected:Symbol("connected"),kIgnoreTrailingSlash:Symbol("ignore trailing slash"),kMockAgentMockCallHistoryInstance:Symbol("mock agent mock call history name"),kMockAgentRegisterCallHistory:Symbol("mock agent register mock call history"),kMockAgentAddCallHistoryLog:Symbol("mock agent add call history log"),kMockAgentIsCallHistoryEnabled:Symbol("mock agent is call history enabled"),kMockAgentAcceptsNonStandardSearchParameters:Symbol("mock agent accepts non standard search parameters"),kMockCallHistoryAddLog:Symbol("mock call history add log"),kTotalDispatchCount:Symbol("total dispatch count")}});var Bm=y((dpe,xQ)=>{"use strict";var{MockNotMatchedError:un}=dA(),{kDispatches:Pr,kMockAgent:Xee,kOriginalDispatch:eoe,kOrigin:ooe,kGetNetConnect:toe,kTotalDispatchCount:hA}=Fr(),{serializePathWithQuery:aoe}=K(),{STATUS_CODES:ioe}=require("http"),{types:{isPromise:roe}}=require("util"),{InvalidArgumentError:gA}=$();function ca(o,e){return typeof o=="string"?o===e:o instanceof RegExp?o.test(e):typeof o=="function"?o(e)===!0:!1}function pQ(o){return Object.fromEntries(Object.entries(o).map(([e,t])=>[e.toLocaleLowerCase(),t]))}function hQ(o,e){if(Array.isArray(o)){for(let t=0;t<o.length;t+=2)if(o[t].toLocaleLowerCase()===e.toLocaleLowerCase())return o[t+1];return}else return typeof o.get=="function"?o.get(e):pQ(o)[e.toLocaleLowerCase()]}function yA(o){let e=o.slice(),t=[];for(let a=0;a<e.length;a+=2)t.push([e[a],e[a+1]]);return Object.fromEntries(t)}function fQ(o,e){if(typeof o.headers=="function")return Array.isArray(e)&&(e=yA(e)),o.headers(e?pQ(e):{});if(typeof o.headers>"u")return!0;if(typeof e!="object"||typeof o.headers!="object")return!1;for(let[t,a]of Object.entries(o.headers)){let i=hQ(e,t);if(!ca(a,i))return!1}return!0}function soe(o){if(typeof o!="string")return o;let e=new URLSearchParams(o),t=new URLSearchParams;for(let[a,i]of e.entries()){if(a=a.replace("[]",""),/^(['"]).*\1$/.test(i)){t.append(a,i);continue}if(i.includes(",")){let s=i.split(",");for(let n of s)t.append(a,n);continue}t.append(a,i)}return t}function pA(o){if(typeof o!="string")return o;let e=o.split("?",3);if(e.length!==2)return o;let t=new URLSearchParams(e.pop());return t.sort(),[...e,t.toString()].join("?")}function noe(o,{path:e,method:t,body:a,headers:i}){let r=ca(o.path,e),s=ca(o.method,t),n=typeof o.body<"u"?ca(o.body,a):!0,c=fQ(o,i);return r&&s&&n&&c}function bQ(o){return Buffer.isBuffer(o)||o instanceof Uint8Array||o instanceof ArrayBuffer?o:typeof o=="object"?JSON.stringify(o):o?o.toString():""}function yQ(o,e){let t=e.query?aoe(e.path,e.query):e.path,a=typeof t=="string"?pA(t):t,i=gQ(a),r=o.filter(({consumed:s})=>!s).filter(({path:s,ignoreTrailingSlash:n})=>n?ca(gQ(pA(s)),i):ca(pA(s),a));if(r.length===0)throw new un(`Mock dispatch not matched for path '${a}'`);if(r=r.filter(({method:s})=>ca(s,e.method)),r.length===0)throw new un(`Mock dispatch not matched for method '${e.method}' on path '${a}'`);if(r=r.filter(({body:s})=>typeof s<"u"?ca(s,e.body):!0),r.length===0)throw new un(`Mock dispatch not matched for body '${e.body}' on path '${a}'`);if(r=r.filter(s=>fQ(s,e.headers)),r.length===0){let s=typeof e.headers=="object"?JSON.stringify(e.headers):e.headers;throw new un(`Mock dispatch not matched for headers '${s}' on path '${a}'`)}return r[0]}function coe(o,e,t,a){let i={timesInvoked:0,times:1,persist:!1,consumed:!1,...a},r=typeof t=="function"?{callback:t}:{...t},s={...i,...e,pending:!0,data:{error:null,...r}};return o.push(s),o[hA]=(o[hA]||0)+1,s}function fA(o,e){let t=o.findIndex(a=>a.consumed?noe(a,e):!1);t!==-1&&o.splice(t,1)}function gQ(o){for(;o.endsWith("/");)o=o.slice(0,-1);return o.length===0&&(o="/"),o}function kQ(o){let{path:e,method:t,body:a,headers:i,query:r}=o;return{path:e,method:t,body:a,headers:i,query:r}}function bA(o){let e=Object.keys(o),t=[];for(let a=0;a<e.length;++a){let i=e[a],r=o[i],s=Buffer.from(`${i}`);if(Array.isArray(r))for(let n=0;n<r.length;++n)t.push(s,Buffer.from(`${r[n]}`));else t.push(s,Buffer.from(`${r}`))}return t}function AQ(o){return ioe[o]||"unknown"}async function moe(o){let e=[];for await(let t of o)e.push(t);return Buffer.concat(e).toString("utf8")}function wQ(o,e){let t=kQ(o),a=yQ(this[Pr],t);a.timesInvoked++,a.data.callback&&(a.data={...a.data,...a.data.callback(o)});let{data:{statusCode:i,data:r,headers:s,trailers:n,error:c},delay:m,persist:l}=a,{timesInvoked:u,times:d}=a;if(a.consumed=!l&&u>=d,a.pending=u<d,c!==null)return fA(this[Pr],t),e.onError(c),!0;let g=!1,p=null;function b(x){g||(g=!0,p!==null&&(clearTimeout(p),p=null),e.onError(x))}e.onConnect?.(b,null),typeof m=="number"&&m>0?p=setTimeout(()=>{p=null,A(this[Pr])},m):A(this[Pr]);function A(x,v=r){if(g)return;let j=Array.isArray(o.headers)?yA(o.headers):o.headers,I=typeof v=="function"?v({...o,headers:j}):v;if(roe(I))return I.then(S=>A(x,S));if(g)return;let T=bQ(I),D=bA(s),O=bA(n);e.onHeaders?.(i,D,k,AQ(i)),e.onData?.(Buffer.from(T)),e.onComplete?.(O),fA(x,t)}function k(){}return!0}function loe(){let o=this[Xee],e=this[ooe],t=this[eoe];return function(i,r){if(o.isMockActive)try{wQ.call(this,i,r)}catch(s){if(s.code==="UND_MOCK_ERR_MOCK_NOT_MATCHED"){let n=o[toe](),c=this[Pr][hA]||this[Pr].length,l=`, ${this[Pr].filter(({consumed:u})=>!u).length} interceptor(s) remaining out of ${c} defined`;if(n===!1)throw new un(`${s.message}: subsequent request to origin ${e} was not allowed (net.connect disabled)${l}`);if(vQ(n,e))t.call(this,i,r);else throw new un(`${s.message}: subsequent request to origin ${e} was not allowed (net.connect is not enabled for this origin)${l}`)}else throw s}else t.call(this,i,r)}}function vQ(o,e){let t=new URL(e);return o===!0?!0:!!(Array.isArray(o)&&o.some(a=>ca(a,t.host)))}function uoe(o){return typeof o!="string"&&!(o instanceof URL)?o:o instanceof URL?o.origin:o.toLowerCase()}function doe(o){let{agent:e,...t}=o;if("enableCallHistory"in t&&typeof t.enableCallHistory!="boolean")throw new gA("options.enableCallHistory must to be a boolean");if("acceptNonStandardSearchParameters"in t&&typeof t.acceptNonStandardSearchParameters!="boolean")throw new gA("options.acceptNonStandardSearchParameters must to be a boolean");if("ignoreTrailingSlash"in t&&typeof t.ignoreTrailingSlash!="boolean")throw new gA("options.ignoreTrailingSlash must to be a boolean");return t}xQ.exports={getResponseData:bQ,getMockDispatch:yQ,addMockDispatch:coe,deleteMockDispatch:fA,buildKey:kQ,generateKeyValues:bA,matchValue:ca,getResponse:moe,getStatusText:AQ,mockDispatch:wQ,buildMockDispatch:loe,checkNetConnect:vQ,buildAndValidateMockOptions:doe,getHeaderByName:hQ,buildHeadersFromArray:yA,normalizeSearchParams:soe,normalizeOrigin:uoe}});var qA=y((gpe,zA)=>{"use strict";var{getResponseData:goe,buildKey:poe,addMockDispatch:kA}=Bm(),{kDispatches:Vd,kDispatchKey:$d,kDefaultHeaders:AA,kDefaultTrailers:wA,kContentLength:vA,kMockDispatch:Wd,kIgnoreTrailingSlash:Jd}=Fr(),{InvalidArgumentError:ma}=$(),{serializePathWithQuery:hoe}=K(),dn=class{constructor(e){this[Wd]=e}delay(e){if(typeof e!="number"||!Number.isInteger(e)||e<=0)throw new ma("waitInMs must be a valid integer > 0");return this[Wd].delay=e,this}persist(){return this[Wd].persist=!0,this}times(e){if(typeof e!="number"||!Number.isInteger(e)||e<=0)throw new ma("repeatTimes must be a valid integer > 0");return this[Wd].times=e,this}},xA=class{constructor(e,t){if(typeof e!="object")throw new ma("opts must be an object");if(typeof e.path>"u")throw new ma("opts.path must be defined");if(typeof e.method>"u"&&(e.method="GET"),typeof e.path=="string")if(e.query)e.path=hoe(e.path,e.query);else{let a=new URL(e.path,"data://");e.path=a.pathname+a.search}typeof e.method=="string"&&(e.method=e.method.toUpperCase()),this[$d]=poe(e),this[Vd]=t,this[Jd]=e.ignoreTrailingSlash??!1,this[AA]={},this[wA]={},this[vA]=!1}createMockScopeDispatchData({statusCode:e,data:t,responseOptions:a}){let i=goe(t),r=this[vA]?{"content-length":i.length}:{},s={...this[AA],...r,...a.headers},n={...this[wA],...a.trailers};return{statusCode:e,data:t,headers:s,trailers:n}}validateReplyParameters(e){if(typeof e.statusCode>"u")throw new ma("statusCode must be defined");if(typeof e.responseOptions!="object"||e.responseOptions===null)throw new ma("responseOptions must be an object")}reply(e){if(typeof e=="function"){let r=n=>{let c=e(n);if(typeof c!="object"||c===null)throw new ma("reply options callback must return an object");let m={data:"",responseOptions:{},...c};return this.validateReplyParameters(m),{...this.createMockScopeDispatchData(m)}},s=kA(this[Vd],this[$d],r,{ignoreTrailingSlash:this[Jd]});return new dn(s)}let t={statusCode:e,data:arguments[1]===void 0?"":arguments[1],responseOptions:arguments[2]===void 0?{}:arguments[2]};this.validateReplyParameters(t);let a=this.createMockScopeDispatchData(t),i=kA(this[Vd],this[$d],a,{ignoreTrailingSlash:this[Jd]});return new dn(i)}replyWithError(e){if(typeof e>"u")throw new ma("error must be defined");let t=kA(this[Vd],this[$d],{error:e},{ignoreTrailingSlash:this[Jd]});return new dn(t)}defaultReplyHeaders(e){if(typeof e>"u")throw new ma("headers must be defined");return this[AA]=e,this}defaultReplyTrailers(e){if(typeof e>"u")throw new ma("trailers must be defined");return this[wA]=e,this}replyContentLength(){return this[vA]=!0,this}};zA.exports.MockInterceptor=xA;zA.exports.MockScope=dn});var jA=y((ppe,BQ)=>{"use strict";var{promisify:foe}=require("util"),boe=Ii(),{buildMockDispatch:yoe}=Bm(),{kDispatches:EA,kMockAgent:zQ,kClose:qQ,kOriginalClose:EQ,kOrigin:IQ,kOriginalDispatch:koe,kConnected:IA,kIgnoreTrailingSlash:CQ}=Fr(),{MockInterceptor:Aoe}=qA(),jQ=de(),{InvalidArgumentError:woe}=$(),CA=class extends boe{constructor(e,t){if(!t||!t.agent||typeof t.agent.dispatch!="function")throw new woe("Argument opts.agent must implement Agent");super(e,t),this[zQ]=t.agent,this[IQ]=e,this[CQ]=t.ignoreTrailingSlash??!1,this[EA]=[],this[IA]=1,this[koe]=this.dispatch,this[EQ]=this.close.bind(this),this.dispatch=yoe.call(this),this.close=this[qQ]}get[jQ.kConnected](){return this[IA]}intercept(e){return new Aoe(e&&{ignoreTrailingSlash:this[CQ],...e},this[EA])}cleanMocks(){this[EA]=[]}async[qQ](){await foe(this[EQ])(),this[IA]=0,this[zQ][jQ.kClients].delete(this[IQ])}};BQ.exports=CA});var SA=y((hpe,QA)=>{"use strict";var{kMockCallHistoryAddLog:voe}=Fr(),{InvalidArgumentError:Ni}=$();function Ti(o,e,t,a,i){switch(e.operator){case"OR":return a.push(...t(o,i)),a;case"AND":return t(o,a);default:throw new Ni("options.operator must to be a case insensitive string equal to 'OR' or 'AND'")}}function xoe(o={}){let e={};if("operator"in o){if(typeof o.operator!="string"||o.operator.toUpperCase()!=="OR"&&o.operator.toUpperCase()!=="AND")throw new Ni("options.operator must to be a case insensitive string equal to 'OR' or 'AND'");return{...e,operator:o.operator.toUpperCase()}}return e}function Ri(o){return(e,t)=>{if(typeof e=="string"||e==null)return t.filter(a=>a[o]===e);if(e instanceof RegExp)return t.filter(a=>e.test(a[o]));throw new Ni(`${o} parameter should be one of string, regexp, undefined or null`)}}function zoe(o){try{let e=new URL(o.path,o.origin);return e.search.length!==0||(e.search=new URLSearchParams(o.query).toString()),e}catch(e){throw new Ni("An error occurred when computing MockCallHistoryLog.url",{cause:e})}}var Kd=class{constructor(e={}){this.body=e.body,this.headers=e.headers,this.method=e.method;let t=zoe(e);this.fullUrl=t.toString(),this.origin=t.origin,this.path=t.pathname,this.searchParams=Object.fromEntries(t.searchParams),this.protocol=t.protocol,this.host=t.host,this.port=t.port,this.hash=t.hash}toMap(){return new Map([["protocol",this.protocol],["host",this.host],["port",this.port],["origin",this.origin],["path",this.path],["hash",this.hash],["searchParams",this.searchParams],["fullUrl",this.fullUrl],["method",this.method],["body",this.body],["headers",this.headers]])}toString(){let e={betweenKeyValueSeparator:"->",betweenPairSeparator:"|"},t="";return this.toMap().forEach((a,i)=>{(typeof a=="string"||a===void 0||a===null)&&(t=`${t}${i}${e.betweenKeyValueSeparator}${a}${e.betweenPairSeparator}`),(typeof a=="object"&&a!==null||Array.isArray(a))&&(t=`${t}${i}${e.betweenKeyValueSeparator}${JSON.stringify(a)}${e.betweenPairSeparator}`)}),t.slice(0,-1)}},BA=class{logs=[];calls(){return this.logs}firstCall(){return this.logs.at(0)}lastCall(){return this.logs.at(-1)}nthCall(e){if(typeof e!="number")throw new Ni("nthCall must be called with a number");if(!Number.isInteger(e))throw new Ni("nthCall must be called with an integer");if(Math.sign(e)!==1)throw new Ni("nthCall must be called with a positive value. use firstCall or lastCall instead");return this.logs.at(e-1)}filterCalls(e,t){if(this.logs.length===0)return this.logs;if(typeof e=="function")return this.logs.filter(e);if(e instanceof RegExp)return this.logs.filter(a=>e.test(a.toString()));if(typeof e=="object"&&e!==null){if(Object.keys(e).length===0)return this.logs;let a={operator:"OR",...xoe(t)},i=a.operator==="AND"?this.logs:[];return"protocol"in e&&(i=Ti(e.protocol,a,this.filterCallsByProtocol,i,this.logs)),"host"in e&&(i=Ti(e.host,a,this.filterCallsByHost,i,this.logs)),"port"in e&&(i=Ti(e.port,a,this.filterCallsByPort,i,this.logs)),"origin"in e&&(i=Ti(e.origin,a,this.filterCallsByOrigin,i,this.logs)),"path"in e&&(i=Ti(e.path,a,this.filterCallsByPath,i,this.logs)),"hash"in e&&(i=Ti(e.hash,a,this.filterCallsByHash,i,this.logs)),"fullUrl"in e&&(i=Ti(e.fullUrl,a,this.filterCallsByFullUrl,i,this.logs)),"method"in e&&(i=Ti(e.method,a,this.filterCallsByMethod,i,this.logs)),[...new Set(i)]}throw new Ni("criteria parameter should be one of function, regexp, or object")}filterCallsByProtocol=Ri.call(this,"protocol");filterCallsByHost=Ri.call(this,"host");filterCallsByPort=Ri.call(this,"port");filterCallsByOrigin=Ri.call(this,"origin");filterCallsByPath=Ri.call(this,"path");filterCallsByHash=Ri.call(this,"hash");filterCallsByFullUrl=Ri.call(this,"fullUrl");filterCallsByMethod=Ri.call(this,"method");clear(){this.logs=[]}[voe](e){let t=new Kd(e);return this.logs.push(t),t}*[Symbol.iterator](){for(let e of this.calls())yield e}};QA.exports.MockCallHistory=BA;QA.exports.MockCallHistoryLog=Kd});var NA=y((fpe,UQ)=>{"use strict";var{promisify:qoe}=require("util"),Eoe=Sr(),{buildMockDispatch:Ioe}=Bm(),{kDispatches:DA,kMockAgent:QQ,kClose:SQ,kOriginalClose:DQ,kOrigin:TQ,kOriginalDispatch:Coe,kConnected:TA,kIgnoreTrailingSlash:RQ}=Fr(),{MockInterceptor:joe}=qA(),NQ=de(),{InvalidArgumentError:Boe}=$(),RA=class extends Eoe{constructor(e,t){if(!t||!t.agent||typeof t.agent.dispatch!="function")throw new Boe("Argument opts.agent must implement Agent");super(e,t),this[QQ]=t.agent,this[TQ]=e,this[RQ]=t.ignoreTrailingSlash??!1,this[DA]=[],this[TA]=1,this[Coe]=this.dispatch,this[DQ]=this.close.bind(this),this.dispatch=Ioe.call(this),this.close=this[SQ]}get[NQ.kConnected](){return this[TA]}intercept(e){return new joe(e&&{ignoreTrailingSlash:this[RQ],...e},this[DA])}cleanMocks(){this[DA]=[]}async[SQ](){await qoe(this[DQ])(),this[TA]=0,this[QQ][NQ.kClients].delete(this[TQ])}};UQ.exports=RA});var MQ=y((ype,OQ)=>{"use strict";var{Transform:Qoe}=require("stream"),{Console:Soe}=require("console"),Doe=process.versions.icu?"\u2705":"Y ",Toe=process.versions.icu?"\u274C":"N ";OQ.exports=class{constructor({disableColors:e}={}){this.transform=new Qoe({transform(t,a,i){i(null,t)}}),this.logger=new Soe({stdout:this.transform,inspectOptions:{colors:!e&&!process.env.CI}})}format(e){let t=e.map(({method:a,path:i,data:{statusCode:r},persist:s,times:n,timesInvoked:c,origin:m})=>({Method:a,Origin:m,Path:i,"Status code":r,Persistent:s?Doe:Toe,Invocations:c,Remaining:s?1/0:n-c}));return this.logger.table(t),this.transform.read().toString()}}});var LA=y((kpe,YQ)=>{"use strict";var{kClients:Hr}=de(),Roe=Rr(),{kAgent:UA,kMockAgentSet:Zd,kMockAgentGet:_Q,kDispatches:OA,kIsMockActive:Xd,kNetConnect:Gr,kGetNetConnect:Noe,kOptions:eg,kFactory:og,kMockAgentRegisterCallHistory:MA,kMockAgentIsCallHistoryEnabled:Qm,kMockAgentAddCallHistoryLog:LQ,kMockAgentMockCallHistoryInstance:gn,kMockAgentAcceptsNonStandardSearchParameters:FQ,kMockCallHistoryAddLog:Uoe,kIgnoreTrailingSlash:PQ}=Fr(),Ooe=jA(),Moe=NA(),{matchValue:_oe,normalizeSearchParams:Loe,buildAndValidateMockOptions:Foe,normalizeOrigin:HQ}=Bm(),{InvalidArgumentError:GQ,UndiciError:Poe}=$(),Hoe=Kc(),Goe=MQ(),{MockCallHistory:Yoe}=SA(),_A=class extends Hoe{constructor(e={}){super(e);let t=Foe(e);if(this[Gr]=!0,this[Xd]=!0,this[Qm]=t.enableCallHistory??!1,this[FQ]=t.acceptNonStandardSearchParameters??!1,this[PQ]=t.ignoreTrailingSlash??!1,e?.agent&&typeof e.agent.dispatch!="function")throw new GQ("Argument opts.agent must implement Agent");let a=e?.agent?e.agent:new Roe(e);this[UA]=a,this[Hr]=a[Hr],this[eg]=t,this[Qm]&&this[MA]()}get(e){let t=HQ(e),a=this[PQ]?t.replace(/\/$/,""):t,i=this[_Q](a);return i||(i=this[og](a),this[Zd](a,i)),i}dispatch(e,t){e.origin=HQ(e.origin),this.get(e.origin),this[LQ](e);let a=this[FQ],i={...e};if(a&&i.path){let[r,s]=i.path.split("?"),n=Loe(s,a);i.path=`${r}?${n}`}return this[UA].dispatch(i,t)}async close(){this.clearCallHistory(),await this[UA].close(),this[Hr].clear()}deactivate(){this[Xd]=!1}activate(){this[Xd]=!0}enableNetConnect(e){if(typeof e=="string"||typeof e=="function"||e instanceof RegExp)Array.isArray(this[Gr])?this[Gr].push(e):this[Gr]=[e];else if(typeof e>"u")this[Gr]=!0;else throw new GQ("Unsupported matcher. Must be one of String|Function|RegExp.")}disableNetConnect(){this[Gr]=!1}enableCallHistory(){return this[Qm]=!0,this}disableCallHistory(){return this[Qm]=!1,this}getCallHistory(){return this[gn]}clearCallHistory(){this[gn]!==void 0&&this[gn].clear()}get isMockActive(){return this[Xd]}[MA](){this[gn]===void 0&&(this[gn]=new Yoe)}[LQ](e){this[Qm]&&(this[MA](),this[gn][Uoe](e))}[Zd](e,t){this[Hr].set(e,{count:0,dispatcher:t})}[og](e){let t=Object.assign({agent:this},this[eg]);return this[eg]&&this[eg].connections===1?new Ooe(e,t):new Moe(e,t)}[_Q](e){let t=this[Hr].get(e);if(t?.dispatcher)return t.dispatcher;if(typeof e!="string"){let a=this[og]("http://localhost:9999");return this[Zd](e,a),a}for(let[a,i]of Array.from(this[Hr]))if(i&&typeof a!="string"&&_oe(a,e)){let r=this[og](e);return this[Zd](e,r),r[OA]=i.dispatcher[OA],r}}[Noe](){return this[Gr]}pendingInterceptors(){let e=this[Hr];return Array.from(e.entries()).flatMap(([t,a])=>a.dispatcher[OA].map(i=>({...i,origin:t}))).filter(({pending:t})=>t)}assertNoPendingInterceptors({pendingInterceptorsFormatter:e=new Goe}={}){let t=this.pendingInterceptors();if(t.length!==0)throw new Poe(t.length===1?`1 interceptor is pending:
|
|
1327
|
+
`,this[IZ]=n??3e5,this[EZ]=a??3e5,this[CZ]=k??!0,this[pk]=j,this[zi]=null,this[DZ]=T>-1?T:-1,this[Ne]=null,this[RZ]=S??100,this[NZ]=ye??262144,this[UZ]=po??524288,this[OZ]=Ve??6e4,this[_t]=[],this[_a]=0,this[Lt]=0,this[Ma]=it=>fk(this,it),this[TZ]=it=>m8(this,it)}get pipelining(){return this[Cd]}set pipelining(e){this[Cd]=e,this[Ma](!0)}get stats(){return new uZ(this)}get[ym](){return this[_t].length-this[Lt]}get[bm](){return this[Lt]-this[_a]}get[pm](){return this[_t].length-this[_a]}get[kZ](){return!!this[Ne]&&!this[Xs]&&!this[Ne].destroyed}get[gk](){return!!(this[Ne]?.busy(null)||this[pm]>=(c8(this)||1)||this[ym]>0)}[yZ](e){l8(this),this.once("connect",e)}[SZ](e,t){let a=new dZ(this[ia].origin,e,t);return this[_t].push(a),this[Qr]||(Br.bodyLength(a.body)==null&&Br.isIterable(a.body)?(this[Qr]=1,queueMicrotask(()=>fk(this))):this[Ma](!0)),this[Qr]&&this[qi]!==2&&this[gk]&&(this[qi]=2),this[qi]<2}[BZ](){return new Promise(e=>{this[pm]?this[zi]=e:e(null)})}[QZ](e){return new Promise(t=>{let a=this[_t].splice(this[Lt]);for(let r=0;r<a.length;r++){let s=a[r];Br.errorRequest(this,s,e)}let i=()=>{this[zi]&&(this[zi](),this[zi]=null),t(null)};this[Ne]?(this[Ne].destroy(e,i),this[Ne]=null):queueMicrotask(i),this[Ma]()})}};function m8(o,e){if(o[bm]===0&&e.code!=="UND_ERR_INFO"&&e.code!=="UND_ERR_SOCKET"){Oa(o[Lt]===o[_a]);let t=o[_t].splice(o[_a]);for(let a=0;a<t.length;a++){let i=t[a];Br.errorRequest(o,i,e)}Oa(o[pm]===0)}}function l8(o){Oa(!o[Xs]),Oa(!o[Ne]);let{host:e,hostname:t,protocol:a,port:i}=o[ia];if(t[0]==="["){let r=t.indexOf("]");Oa(r!==-1);let s=t.substring(1,r);Oa(n8.isIPv6(s)),t=s}o[Xs]=!0,Zs.beforeConnect.hasSubscribers&&Zs.beforeConnect.publish({connectParams:{host:e,hostname:t,protocol:a,port:i,version:o[Ne]?.version,servername:o[Ei],localAddress:o[fm]},connector:o[hm]});try{o[hm]({host:e,hostname:t,protocol:a,port:i,servername:o[Ei],localAddress:o[fm]},(r,s)=>{if(r){dk(o,r,{host:e,hostname:t,protocol:a,port:i}),o[Ma]();return}if(o.destroyed){Br.destroy(s.on("error",r8),new hZ),o[Ma]();return}Oa(s);try{o[Ne]=s.alpnProtocol==="h2"?_Z(o,s):MZ(o,s)}catch(n){s.destroy().on("error",r8),dk(o,n,{host:e,hostname:t,protocol:a,port:i}),o[Ma]();return}o[Xs]=!1,s[jZ]=0,s[pk]=o[pk],s[bZ]=o,s[wZ]=null,Zs.connected.hasSubscribers&&Zs.connected.publish({connectParams:{host:e,hostname:t,protocol:a,port:i,version:o[Ne]?.version,servername:o[Ei],localAddress:o[fm]},connector:o[hm],socket:s}),o.emit("connect",o[ia],[o]),o[Ma]()})}catch(r){dk(o,r,{host:e,hostname:t,protocol:a,port:i}),o[Ma]()}}function dk(o,e,{host:t,hostname:a,protocol:i,port:r}){if(!o.destroyed){if(o[Xs]=!1,Zs.connectError.hasSubscribers&&Zs.connectError.publish({connectParams:{host:t,hostname:a,protocol:i,port:r,version:o[Ne]?.version,servername:o[Ei],localAddress:o[fm]},connector:o[hm],error:e}),e.code==="ERR_TLS_CERT_ALTNAME_INVALID")for(Oa(o[bm]===0);o[ym]>0&&o[_t][o[Lt]].servername===o[Ei];){let s=o[_t][o[Lt]++];Br.errorRequest(o,s,e)}else m8(o,e);o.emit("connectionError",o[ia],[o],e)}}function s8(o){o[qi]=0,o.emit("drain",o[ia],[o])}function fk(o,e){o[Qr]!==2&&(o[Qr]=2,FZ(o,e),o[Qr]=0,o[_a]>256&&(o[_t].splice(0,o[_a]),o[Lt]-=o[_a],o[_a]=0))}function FZ(o,e){for(;;){if(o.destroyed){Oa(o[ym]===0);return}if(o[zi]&&!o[pm]){o[zi](),o[zi]=null;return}if(o[Ne]&&o[Ne].resume(),o[gk])o[qi]=2;else if(o[qi]===2){e?(o[qi]=1,queueMicrotask(()=>s8(o))):s8(o);continue}if(o[ym]===0||o[bm]>=(c8(o)||1))return;let t=o[_t][o[Lt]];if(t===null)return;if(o[ia].protocol==="https:"&&o[Ei]!==t.servername){if(o[bm]>0)return;o[Ei]=t.servername,o[Ne]?.destroy(new pZ("servername changed"),()=>{o[Ne]=null,fk(o)})}if(o[Xs])return;if(!o[Ne]){l8(o);return}if(o[Ne].destroyed||o[Ne].busy(t))return;!t.aborted&&o[Ne].write(t)?o[Lt]++:o[_t].splice(o[Lt],1)}}u8.exports=hk});var bk=y((Fge,d8)=>{"use strict";var jd=class{bottom=0;top=0;list=new Array(2048).fill(void 0);next=null;isEmpty(){return this.top===this.bottom}isFull(){return(this.top+1&2047)===this.bottom}push(e){this.list[this.top]=e,this.top=this.top+1&2047}shift(){let e=this.list[this.bottom];return e===void 0?null:(this.list[this.bottom]=void 0,this.bottom=this.bottom+1&2047,e)}};d8.exports=class{constructor(){this.head=this.tail=new jd}isEmpty(){return this.head.isEmpty()}push(e){this.head.isFull()&&(this.head=this.head.next=new jd),this.head.push(e)}shift(){let e=this.tail,t=e.shift();return e.isEmpty()&&e.next!==null&&(this.tail=e.next,e.next=null),t}}});var Bd=y((Pge,w8)=>{"use strict";var{PoolStats:PZ}=iy(),HZ=Ar(),GZ=bk(),{kConnected:yk,kSize:g8,kRunning:p8,kPending:h8,kQueued:km,kBusy:YZ,kFree:VZ,kUrl:$Z,kClose:WZ,kDestroy:JZ,kDispatch:KZ}=de(),Ze=Symbol("clients"),Ao=Symbol("needDrain"),Am=Symbol("queue"),kk=Symbol("closed resolve"),Ak=Symbol("onDrain"),f8=Symbol("onConnect"),b8=Symbol("onDisconnect"),y8=Symbol("onConnectionError"),wk=Symbol("get dispatcher"),k8=Symbol("add client"),A8=Symbol("remove client"),vk=class extends HZ{[Am]=new GZ;[km]=0;[Ze]=[];[Ao]=!1;[Ak](e,t,a){let i=this[Am],r=!1;for(;!r;){let s=i.shift();if(!s)break;this[km]--,r=!e.dispatch(s.opts,s.handler)}if(e[Ao]=r,!r&&this[Ao]&&(this[Ao]=!1,this.emit("drain",t,[this,...a])),this[kk]&&i.isEmpty()){let s=[];for(let n=0;n<this[Ze].length;n++){let c=this[Ze][n];c.destroyed||s.push(c.close())}return Promise.all(s).then(this[kk])}}[f8]=(e,t)=>{this.emit("connect",e,[this,...t])};[b8]=(e,t,a)=>{this.emit("disconnect",e,[this,...t],a)};[y8]=(e,t,a)=>{this.emit("connectionError",e,[this,...t],a)};get[YZ](){return this[Ao]}get[yk](){let e=0;for(let{[yk]:t}of this[Ze])e+=t;return e}get[VZ](){let e=0;for(let{[yk]:t,[Ao]:a}of this[Ze])e+=t&&!a;return e}get[h8](){let e=this[km];for(let{[h8]:t}of this[Ze])e+=t;return e}get[p8](){let e=0;for(let{[p8]:t}of this[Ze])e+=t;return e}get[g8](){let e=this[km];for(let{[g8]:t}of this[Ze])e+=t;return e}get stats(){return new PZ(this)}[WZ](){if(this[Am].isEmpty()){let e=[];for(let t=0;t<this[Ze].length;t++){let a=this[Ze][t];a.destroyed||e.push(a.close())}return Promise.all(e)}else return new Promise(e=>{this[kk]=e})}[JZ](e){for(;;){let a=this[Am].shift();if(!a)break;a.handler.onError(e)}let t=new Array(this[Ze].length);for(let a=0;a<this[Ze].length;a++)t[a]=this[Ze][a].destroy(e);return Promise.all(t)}[KZ](e,t){let a=this[wk]();return a?a.dispatch(e,t)||(a[Ao]=!0,this[Ao]=!this[wk]()):(this[Ao]=!0,this[Am].push({opts:e,handler:t}),this[km]++),!this[Ao]}[k8](e){return e.on("drain",this[Ak].bind(this,e)).on("connect",this[f8]).on("disconnect",this[b8]).on("connectionError",this[y8]),this[Ze].push(e),this[Ao]&&queueMicrotask(()=>{this[Ao]&&this[Ak](e,e[$Z],[e,this])}),this}[A8](e){e.close(()=>{let t=this[Ze].indexOf(e);t!==-1&&this[Ze].splice(t,1)}),this[Ao]=this[Ze].some(t=>!t[Ao]&&t.closed!==!0&&t.destroyed!==!0)}};w8.exports={PoolBase:vk,kClients:Ze,kNeedDrain:Ao,kAddClient:k8,kRemoveClient:A8,kGetDispatcher:wk}});var Sr=y((Hge,q8)=>{"use strict";var{PoolBase:ZZ,kClients:Qd,kNeedDrain:XZ,kAddClient:eX,kGetDispatcher:oX,kRemoveClient:tX}=Bd(),aX=Ii(),{InvalidArgumentError:xk}=$(),v8=K(),{kUrl:x8}=de(),iX=wr(),Sd=Symbol("options"),zk=Symbol("connections"),z8=Symbol("factory");function rX(o,e){return new aX(o,e)}var qk=class extends ZZ{constructor(e,{connections:t,factory:a=rX,connect:i,connectTimeout:r,tls:s,maxCachedSessions:n,socketPath:c,autoSelectFamily:m,autoSelectFamilyAttemptTimeout:l,allowH2:u,clientTtl:d,...g}={}){if(t!=null&&(!Number.isFinite(t)||t<0))throw new xk("invalid connections");if(typeof a!="function")throw new xk("factory must be a function.");if(i!=null&&typeof i!="function"&&typeof i!="object")throw new xk("connect must be a function or an object");typeof i!="function"&&(i=iX({...s,maxCachedSessions:n,allowH2:u,socketPath:c,timeout:r,...typeof m=="boolean"?{autoSelectFamily:m,autoSelectFamilyAttemptTimeout:l}:void 0,...i})),super(g),this[zk]=t||null,this[x8]=v8.parseOrigin(e),this[Sd]={...v8.deepClone(g),connect:i,allowH2:u,clientTtl:d,socketPath:c},this[Sd].interceptors=g.interceptors?{...g.interceptors}:void 0,this[z8]=a,this.on("connect",(p,b)=>{if(d!=null&&d>0)for(let A of b)Object.assign(A,{ttl:Date.now()})}),this.on("connectionError",(p,b,A)=>{for(let k of b){let x=this[Qd].indexOf(k);x!==-1&&this[Qd].splice(x,1)}})}[oX](){let e=this[Sd].clientTtl;for(let t of this[Qd])if(e!=null&&e>0&&t.ttl&&Date.now()-t.ttl>e)this[tX](t);else if(!t[XZ])return t;if(!this[zk]||this[Qd].length<this[zk]){let t=this[z8](this[x8],this[Sd]);return this[eX](t),t}}};q8.exports=qk});var j8=y((Gge,C8)=>{"use strict";var{BalancedPoolMissingUpstreamError:sX,InvalidArgumentError:nX}=$(),{PoolBase:cX,kClients:ao,kNeedDrain:wm,kAddClient:mX,kRemoveClient:lX,kGetDispatcher:uX}=Bd(),dX=Sr(),{kUrl:Dd}=de(),Td=K(),E8=Symbol("factory"),vm=Symbol("options"),I8=Symbol("kGreatestCommonDivisor"),Dr=Symbol("kCurrentWeight"),Tr=Symbol("kIndex"),vt=Symbol("kWeight"),Rd=Symbol("kMaxWeightPerServer"),Nd=Symbol("kErrorPenalty");function gX(o,e){if(o===0)return e;for(;e!==0;){let t=e;e=o%e,o=t}return o}function pX(o,e){return new dX(o,e)}var Ek=class extends cX{constructor(e=[],{factory:t=pX,...a}={}){if(typeof t!="function")throw new nX("factory must be a function.");super(a),this[vm]={...Td.deepClone(a)},this[vm].interceptors=a.interceptors?{...a.interceptors}:void 0,this[Tr]=-1,this[Dr]=0,this[Rd]=this[vm].maxWeightPerServer||100,this[Nd]=this[vm].errorPenalty||15,Array.isArray(e)||(e=[e]),this[E8]=t;for(let i of e)this.addUpstream(i);this._updateBalancedPoolStats()}addUpstream(e){let t=Td.parseOrigin(e).origin;if(this[ao].find(i=>i[Dd].origin===t&&i.closed!==!0&&i.destroyed!==!0))return this;let a=this[E8](t,this[vm]);this[mX](a),a.on("connect",()=>{a[vt]=Math.min(this[Rd],a[vt]+this[Nd])}),a.on("connectionError",()=>{a[vt]=Math.max(1,a[vt]-this[Nd]),this._updateBalancedPoolStats()}),a.on("disconnect",(...i)=>{let r=i[2];r&&r.code==="UND_ERR_SOCKET"&&(a[vt]=Math.max(1,a[vt]-this[Nd]),this._updateBalancedPoolStats())});for(let i of this[ao])i[vt]=this[Rd];return this._updateBalancedPoolStats(),this}_updateBalancedPoolStats(){let e=0;for(let t=0;t<this[ao].length;t++)e=gX(this[ao][t][vt],e);this[I8]=e}removeUpstream(e){let t=Td.parseOrigin(e).origin,a=this[ao].find(i=>i[Dd].origin===t&&i.closed!==!0&&i.destroyed!==!0);return a&&this[lX](a),this}getUpstream(e){let t=Td.parseOrigin(e).origin;return this[ao].find(a=>a[Dd].origin===t&&a.closed!==!0&&a.destroyed!==!0)}get upstreams(){return this[ao].filter(e=>e.closed!==!0&&e.destroyed!==!0).map(e=>e[Dd].origin)}[uX](){if(this[ao].length===0)throw new sX;if(!this[ao].find(r=>!r[wm]&&r.closed!==!0&&r.destroyed!==!0)||this[ao].map(r=>r[wm]).reduce((r,s)=>r&&s,!0))return;let a=0,i=this[ao].findIndex(r=>!r[wm]);for(;a++<this[ao].length;){this[Tr]=(this[Tr]+1)%this[ao].length;let r=this[ao][this[Tr]];if(r[vt]>this[ao][i][vt]&&!r[wm]&&(i=this[Tr]),this[Tr]===0&&(this[Dr]=this[Dr]-this[I8],this[Dr]<=0&&(this[Dr]=this[Rd])),r[vt]>=this[Dr]&&!r[wm])return r}return this[Dr]=this[ao][i][vt],this[Tr]=i,this[ao][i]}};C8.exports=Ek});var D8=y((Yge,S8)=>{"use strict";var{PoolBase:hX,kClients:Ud,kNeedDrain:fX,kAddClient:B8,kGetDispatcher:bX,kRemoveClient:yX}=Bd(),kX=Ii(),{InvalidArgumentError:Ik}=$(),Q8=K(),{kUrl:Ck}=de(),AX=wr(),xm=Symbol("options"),jk=Symbol("connections"),Bk=Symbol("factory"),Od=Symbol("index");function wX(o,e){return new kX(o,e)}var Qk=class extends hX{constructor(e,{connections:t,factory:a=wX,connect:i,connectTimeout:r,tls:s,maxCachedSessions:n,socketPath:c,autoSelectFamily:m,autoSelectFamilyAttemptTimeout:l,allowH2:u,clientTtl:d,...g}={}){if(t!=null&&(!Number.isFinite(t)||t<0))throw new Ik("invalid connections");if(typeof a!="function")throw new Ik("factory must be a function.");if(i!=null&&typeof i!="function"&&typeof i!="object")throw new Ik("connect must be a function or an object");typeof i!="function"&&(i=AX({...s,maxCachedSessions:n,allowH2:u,socketPath:c,timeout:r,...typeof m=="boolean"?{autoSelectFamily:m,autoSelectFamilyAttemptTimeout:l}:void 0,...i})),super(),this[jk]=t||null,this[Ck]=Q8.parseOrigin(e),this[xm]={...Q8.deepClone(g),connect:i,allowH2:u,clientTtl:d,socketPath:c},this[xm].interceptors=g.interceptors?{...g.interceptors}:void 0,this[Bk]=a,this[Od]=-1,this.on("connect",(p,b)=>{if(d!=null&&d>0)for(let A of b)Object.assign(A,{ttl:Date.now()})}),this.on("connectionError",(p,b,A)=>{for(let k of b){let x=this[Ud].indexOf(k);x!==-1&&this[Ud].splice(x,1)}})}[bX](){let e=this[xm].clientTtl,t=this[Ud].length;if(t===0){let i=this[Bk](this[Ck],this[xm]);return this[B8](i),i}let a=0;for(;a<t;){this[Od]=(this[Od]+1)%t;let i=this[Ud][this[Od]];if(e!=null&&e>0&&i.ttl&&Date.now()-i.ttl>e){this[yX](i),a++;continue}if(!i[fX])return i;a++}if(!this[jk]||t<this[jk]){let i=this[Bk](this[Ck],this[xm]);return this[B8](i),i}}};S8.exports=Qk});var Rr=y((Vge,_8)=>{"use strict";var{InvalidArgumentError:Md,MaxOriginsReachedError:vX}=$(),{kClients:xt,kRunning:T8,kClose:xX,kDestroy:zX,kDispatch:qX,kUrl:EX}=de(),IX=Ar(),CX=Sr(),jX=Ii(),BX=K(),R8=Symbol("onConnect"),N8=Symbol("onDisconnect"),U8=Symbol("onConnectionError"),O8=Symbol("onDrain"),M8=Symbol("factory"),Sk=Symbol("options"),zm=Symbol("origins");function QX(o,e){return e&&e.connections===1?new jX(o,e):new CX(o,e)}var Dk=class extends IX{constructor({factory:e=QX,maxOrigins:t=1/0,connect:a,...i}={}){if(typeof e!="function")throw new Md("factory must be a function.");if(a!=null&&typeof a!="function"&&typeof a!="object")throw new Md("connect must be a function or an object");if(typeof t!="number"||Number.isNaN(t)||t<=0)throw new Md("maxOrigins must be a number greater than 0");super(i),a&&typeof a!="function"&&(a={...a}),this[Sk]={...BX.deepClone(i),maxOrigins:t,connect:a},this[M8]=e,this[xt]=new Map,this[zm]=new Set,this[O8]=(r,s)=>{this.emit("drain",r,[this,...s])},this[R8]=(r,s)=>{this.emit("connect",r,[this,...s])},this[N8]=(r,s,n)=>{this.emit("disconnect",r,[this,...s],n)},this[U8]=(r,s,n)=>{this.emit("connectionError",r,[this,...s],n)}}get[T8](){let e=0;for(let{dispatcher:t}of this[xt].values())e+=t[T8];return e}[qX](e,t){let a;if(e.origin&&(typeof e.origin=="string"||e.origin instanceof URL))a=String(e.origin);else throw new Md("opts.origin must be a non-empty string or URL.");if(this[zm].size>=this[Sk].maxOrigins&&!this[zm].has(a))throw new vX;let i=this[xt].get(a),r=i&&i.dispatcher;if(!r){let s=n=>{let c=this[xt].get(a);c&&(n&&(c.count-=1),c.count<=0&&(this[xt].delete(a),c.dispatcher.destroyed||c.dispatcher.close()),this[zm].delete(a))};r=this[M8](e.origin,this[Sk]).on("drain",this[O8]).on("connect",(n,c)=>{let m=this[xt].get(a);m&&(m.count+=1),this[R8](n,c)}).on("disconnect",(n,c,m)=>{s(!0),this[N8](n,c,m)}).on("connectionError",(n,c,m)=>{s(!1),this[U8](n,c,m)}),this[xt].set(a,{count:0,dispatcher:r}),this[zm].add(a)}return r.dispatch(e,t)}[xX](){let e=[];for(let{dispatcher:t}of this[xt].values())e.push(t.close());return this[xt].clear(),Promise.all(e)}[zX](e){let t=[];for(let{dispatcher:a}of this[xt].values())t.push(a.destroy(e));return this[xt].clear(),Promise.all(t)}get stats(){let e={};for(let{dispatcher:t}of this[xt].values())t.stats&&(e[t[EX].origin]=t.stats);return e}};_8.exports=Dk});var P8=y(($ge,F8)=>{"use strict";var{Buffer:ji}=require("buffer"),Tk=require("net"),{InvalidArgumentError:Ci}=$();function SX(o){if(Tk.isIPv4(o)){let t=o.split(".").map(Number);return{type:1,buffer:ji.from(t)}}if(Tk.isIPv6(o))return{type:4,buffer:L8(o)};let e=ji.from(o,"utf8");if(e.length>255)throw new Ci("Domain name too long (max 255 bytes)");return{type:3,buffer:ji.concat([ji.from([e.length]),e])}}function L8(o){let e=ji.alloc(16),t=o;if(o.includes(".")){let i=o.lastIndexOf(":"),r=o.slice(i+1);if(Tk.isIPv4(r)){let s=r.split(".").map(Number),n=(s[0]<<8|s[1]).toString(16),c=(s[2]<<8|s[3]).toString(16);t=`${o.slice(0,i)}:${n}:${c}`}}let a=t.indexOf("::");if(a!==-1){let i=t.slice(0,a),r=t.slice(a+2),s=i===""?[]:i.split(":"),n=r===""?[]:r.split(":"),c=0;for(let m of s)e.writeUInt16BE(parseInt(m,16),c),c+=2;c=16-n.length*2;for(let m of n)e.writeUInt16BE(parseInt(m,16),c),c+=2}else{let i=t.split(":");for(let r=0;r<i.length;r++)e.writeUInt16BE(parseInt(i[r],16),r*2)}return e}function DX(o,e,t){let a=ji.allocUnsafe(2);return a.writeUInt16BE(t,0),ji.concat([ji.from([o]),e,a])}function TX(o,e=0){if(o.length<e+1)throw new Ci("Buffer too small to contain address type");let t=o[e],a,i=e+1;switch(t){case 1:{if(o.length<i+6)throw new Ci("Buffer too small for IPv4 address");a=Array.from(o.subarray(i,i+4)).join("."),i+=4;break}case 3:{if(o.length<i+1)throw new Ci("Buffer too small for domain length");let s=o[i];if(i+=1,o.length<i+s+2)throw new Ci("Buffer too small for domain address");a=o.subarray(i,i+s).toString("utf8"),i+=s;break}case 4:{if(o.length<i+18)throw new Ci("Buffer too small for IPv6 address");let s=[];for(let n=0;n<8;n++){let c=o.readUInt16BE(i+n*2);s.push(c.toString(16))}a=s.join(":"),i+=16;break}default:throw new Ci(`Invalid address type: ${t}`)}if(o.length<i+2)throw new Ci("Buffer too small for port");let r=o.readUInt16BE(i);return i+=2,{address:a,port:r,bytesRead:i-e}}function RX(o){let t={1:"General SOCKS server failure",2:"Connection not allowed by ruleset",3:"Network unreachable",4:"Host unreachable",5:"Connection refused",6:"TTL expired",7:"Command not supported",8:"Address type not supported"}[o]||`Unknown SOCKS5 error code: ${o}`,a=new Error(t);return a.code=`SOCKS5_${o}`,a}F8.exports={parseAddress:SX,parseIPv6:L8,buildAddressBuffer:DX,parseResponseAddress:TX,createReplyError:RX}});var V8=y((Wge,Y8)=>{"use strict";var{EventEmitter:NX}=require("events"),{Buffer:Nr}=require("buffer"),{InvalidArgumentError:en,Socks5ProxyError:Bi}=$(),{debuglog:UX}=require("util"),{parseAddress:OX}=P8(),La=UX("undici:socks5"),H8=Nr.alloc(0),_d=5,on={NO_AUTH:0,GSSAPI:1,USERNAME_PASSWORD:2,NO_ACCEPTABLE:255},G8={CONNECT:1,BIND:2,UDP_ASSOCIATE:3},Ur={IPV4:1,DOMAIN:3,IPV6:4},ra={SUCCEEDED:0,GENERAL_FAILURE:1,CONNECTION_NOT_ALLOWED:2,NETWORK_UNREACHABLE:3,HOST_UNREACHABLE:4,CONNECTION_REFUSED:5,TTL_EXPIRED:6,COMMAND_NOT_SUPPORTED:7,ADDRESS_TYPE_NOT_SUPPORTED:8},mo={INITIAL:"initial",HANDSHAKING:"handshaking",AUTHENTICATING:"authenticating",AUTHENTICATED:"authenticated",CONNECTING:"connecting",CONNECTED:"connected",ERROR:"error",CLOSED:"closed"},Rk=class extends NX{constructor(e,t={}){if(super(),!e)throw new en("socket is required");this.socket=e,this.options=t,this.state=mo.INITIAL,this.buffer=H8,this.onSocketData=this.onData.bind(this),this.onSocketError=this.onError.bind(this),this.onSocketClose=this.onClose.bind(this),this.authMethods=[],t.username&&t.password&&this.authMethods.push(on.USERNAME_PASSWORD),this.authMethods.push(on.NO_AUTH),this.socket.on("data",this.onSocketData),this.socket.on("error",this.onSocketError),this.socket.on("close",this.onSocketClose)}onData(e){La("received data",e.length,"bytes in state",this.state),this.buffer=Nr.concat([this.buffer,e]);try{switch(this.state){case mo.HANDSHAKING:this.handleHandshakeResponse();break;case mo.AUTHENTICATING:this.handleAuthResponse();break;case mo.CONNECTING:this.handleConnectResponse();break}}catch(t){this.onError(t)}}onError(e){La("socket error",e),this.state=mo.ERROR,this.emit("error",e),this.destroy()}onClose(){La("socket closed"),this.state=mo.CLOSED,this.emit("close")}destroy(){this.socket&&!this.socket.destroyed&&this.socket.destroy()}markAuthenticated(){this.state=mo.AUTHENTICATED,this.emit("authenticated")}handshake(){if(this.state!==mo.INITIAL)throw new en("Handshake already started");La("starting handshake with",this.authMethods.length,"auth methods"),this.state=mo.HANDSHAKING;let e=Nr.alloc(2+this.authMethods.length);e[0]=_d,e[1]=this.authMethods.length,this.authMethods.forEach((t,a)=>{e[2+a]=t}),this.socket.write(e)}handleHandshakeResponse(){if(this.buffer.length<2)return;let e=this.buffer[0],t=this.buffer[1];if(e!==_d)throw new Bi(`Invalid SOCKS version: ${e}`,"UND_ERR_SOCKS5_VERSION");if(t===on.NO_ACCEPTABLE)throw new Bi("No acceptable authentication method","UND_ERR_SOCKS5_AUTH_REJECTED");if(this.buffer=this.buffer.subarray(2),La("server selected auth method",t),t===on.NO_AUTH)this.markAuthenticated();else if(t===on.USERNAME_PASSWORD)this.state=mo.AUTHENTICATING,this.sendAuthRequest();else throw new Bi(`Unsupported authentication method: ${t}`,"UND_ERR_SOCKS5_AUTH_METHOD")}sendAuthRequest(){let{username:e,password:t}=this.options;if(!e||!t)throw new en("Username and password required for authentication");La("sending username/password auth");let a=Nr.from(e),i=Nr.from(t);if(a.length>255||i.length>255)throw new en("Username or password too long");let r=Nr.alloc(3+a.length+i.length);r[0]=1,r[1]=a.length,a.copy(r,2),r[2+a.length]=i.length,i.copy(r,3+a.length),this.socket.write(r)}handleAuthResponse(){if(this.buffer.length<2)return;let e=this.buffer[0],t=this.buffer[1];if(e!==1)throw new Bi(`Invalid auth sub-negotiation version: ${e}`,"UND_ERR_SOCKS5_AUTH_VERSION");if(t!==0)throw new Bi("Authentication failed","UND_ERR_SOCKS5_AUTH_FAILED");this.buffer=this.buffer.subarray(2),La("authentication successful"),this.markAuthenticated()}connect(e,t){if(this.state===mo.CONNECTING||this.state===mo.CONNECTED)throw new en("Connection already in progress");if(this.state!==mo.AUTHENTICATED)throw new en("Client must be authenticated before CONNECT");La("connecting to",e,t),this.state=mo.CONNECTING;let a=this.buildConnectRequest(G8.CONNECT,e,t);this.socket.write(a)}buildConnectRequest(e,t,a){let{type:i,buffer:r}=OX(t),s=Nr.alloc(4+r.length+2);return s[0]=_d,s[1]=e,s[2]=0,s[3]=i,r.copy(s,4),s.writeUInt16BE(a,4+r.length),s}handleConnectResponse(){if(this.buffer.length<4)return;let e=this.buffer[0],t=this.buffer[1],a=this.buffer[3];if(e!==_d)throw new Bi(`Invalid SOCKS version in reply: ${e}`,"UND_ERR_SOCKS5_REPLY_VERSION");let i=4;if(a===Ur.IPV4)i+=6;else if(a===Ur.DOMAIN){if(this.buffer.length<5)return;i+=1+this.buffer[4]+2}else if(a===Ur.IPV6)i+=18;else throw new Bi(`Invalid address type in reply: ${a}`,"UND_ERR_SOCKS5_ADDR_TYPE");if(this.buffer.length<i)return;if(t!==ra.SUCCEEDED){let c=this.getReplyErrorMessage(t);throw new Bi(`SOCKS5 connection failed: ${c}`,`UND_ERR_SOCKS5_REPLY_${t}`)}let r,s=4;if(a===Ur.IPV4)r=Array.from(this.buffer.subarray(s,s+4)).join("."),s+=4;else if(a===Ur.DOMAIN){let c=this.buffer[s];s+=1,r=this.buffer.subarray(s,s+c).toString(),s+=c}else if(a===Ur.IPV6){let c=[];for(let m=0;m<8;m++){let l=this.buffer.readUInt16BE(s+m*2);c.push(l.toString(16))}r=c.join(":"),s+=16}let n=this.buffer.readUInt16BE(s);this.buffer=H8,this.state=mo.CONNECTED,this.socket.removeListener("data",this.onSocketData),La("connected, bound address:",r,"port:",n),this.emit("connected",{address:r,port:n})}getReplyErrorMessage(e){switch(e){case ra.GENERAL_FAILURE:return"General SOCKS server failure";case ra.CONNECTION_NOT_ALLOWED:return"Connection not allowed by ruleset";case ra.NETWORK_UNREACHABLE:return"Network unreachable";case ra.HOST_UNREACHABLE:return"Host unreachable";case ra.CONNECTION_REFUSED:return"Connection refused";case ra.TTL_EXPIRED:return"TTL expired";case ra.COMMAND_NOT_SUPPORTED:return"Command not supported";case ra.ADDRESS_TYPE_NOT_SUPPORTED:return"Address type not supported";default:return`Unknown error code: ${e}`}}};Y8.exports={Socks5Client:Rk,AUTH_METHODS:on,COMMANDS:G8,ADDRESS_TYPES:Ur,REPLY_CODES:ra,STATES:mo}});var _k=y((Jge,oB)=>{"use strict";var{URL:$8}=require("url"),Nk,MX=Ar(),{InvalidArgumentError:W8}=$(),{Socks5Client:_X,STATES:LX}=V8(),{kDispatch:J8,kClose:FX,kDestroy:PX}=de(),HX=Sr(),GX=wr(),{debuglog:YX}=require("util"),Qi=YX("undici:socks5-proxy"),Uk=Symbol("proxy url"),VX=Symbol("proxy headers"),K8=Symbol("proxy auth"),Z8=Symbol("proxy protocol"),Or=Symbol("pools"),X8=Symbol("connector"),Ok=Symbol("request tls settings"),eB=!1,Mk=class extends MX{constructor(e,t={}){if(super(),eB||(process.emitWarning("SOCKS5 proxy support is experimental and subject to change","ExperimentalWarning"),eB=!0),!e)throw new W8("Proxy URL is mandatory");let a=typeof e=="string"?new $8(e):e;if(a.protocol!=="socks5:"&&a.protocol!=="socks:")throw new W8("Proxy URL must use socks5:// or socks:// protocol");this[Uk]=a,this[VX]=t.headers||{},this[Z8]=t.proxyTls?"https:":"http:",this[Ok]=t.requestTls,this[K8]={username:t.username||(a.username?decodeURIComponent(a.username):null),password:t.password||(a.password?decodeURIComponent(a.password):null)},this[X8]=t.connect||GX({...t.proxyTls,servername:t.proxyTls?.servername||a.hostname}),this[Or]=new Map}async createSocks5Connection(e,t){let a=this[Uk].hostname,i=parseInt(this[Uk].port)||1080;Qi("creating SOCKS5 connection to",a,i);let r=await new Promise((n,c)=>{this[X8]({hostname:a,host:a,port:i,protocol:this[Z8]},(m,l)=>{m?c(m):n(l)})}),s=new _X(r,this[K8]);return s.on("error",n=>{Qi("SOCKS5 error:",n),r.destroy()}),await s.handshake(),await new Promise((n,c)=>{let m=setTimeout(()=>{c(new Error("SOCKS5 authentication timeout"))},5e3),l=()=>{clearTimeout(m),s.removeListener("error",u),n()},u=d=>{clearTimeout(m),s.removeListener("authenticated",l),c(d)};s.state===LX.AUTHENTICATED?(clearTimeout(m),n()):(s.once("authenticated",l),s.once("error",u))}),await s.connect(e,t),await new Promise((n,c)=>{let m=setTimeout(()=>{c(new Error("SOCKS5 connection timeout"))},5e3),l=d=>{Qi("SOCKS5 tunnel established to",e,t,"via",d),clearTimeout(m),s.removeListener("error",u),n()},u=d=>{clearTimeout(m),s.removeListener("connected",l),c(d)};s.once("connected",l),s.once("error",u)}),r}[J8](e,t){let{origin:a}=e;Qi("dispatching request to",a,"via SOCKS5");try{let i=String(a),r=this[Or].get(i);return(!r||r.destroyed||r.closed)&&(r=new HX(a,{pipelining:e.pipelining,connections:e.connections,connect:async(s,n)=>{try{let c=new $8(a),m=c.hostname,l=parseInt(c.port)||(c.protocol==="https:"?443:80);Qi("establishing SOCKS5 connection to",m,l);let u=await this.createSocks5Connection(m,l),d=u;c.protocol==="https:"&&(Nk||(Nk=require("tls")),Qi("upgrading to TLS"),d=Nk.connect({...this[Ok],socket:u,servername:this[Ok]?.servername||m}),await new Promise((g,p)=>{d.once("secureConnect",g),d.once("error",p)})),n(null,d)}catch(c){Qi("SOCKS5 connection error:",c),n(c)}}}),this[Or].set(i,r)),r[J8](e,t)}catch(i){if(Qi("dispatch error:",i),typeof t.onResponseError=="function")return t.onResponseError(null,i),!1;if(typeof t.onError=="function")return t.onError(i),!1;throw i}}async[FX](){let e=[];for(let t of this[Or].values())e.push(t.close());this[Or].clear(),await Promise.all(e)}async[PX](e){let t=[];for(let a of this[Or].values())t.push(a.destroy(e));this[Or].clear(),await Promise.all(t)}};oB.exports=Mk});var Hk=y((Kge,gB)=>{"use strict";var{kProxy:tn,kClose:cB,kDestroy:mB,kDispatch:tB}=de(),$X=Rr(),lB=Sr(),uB=Ar(),{InvalidArgumentError:Mr,RequestAbortedError:WX,SecureProxyConnectionError:JX}=$(),aB=wr(),dB=Ii(),{channels:iB}=yi(),KX=_k(),Ld=Symbol("proxy agent"),Si=Symbol("proxy client"),Fa=Symbol("proxy headers"),Lk=Symbol("request tls settings"),rB=Symbol("proxy tls settings"),sB=Symbol("connect endpoint function"),nB=Symbol("tunnel proxy");function ZX(o){return o==="https:"?443:80}function XX(o,e){return new lB(o,e)}var eee=()=>{};function oee(o,e){return e.connections===1?new dB(o,e):new lB(o,e)}var Fk=class extends uB{#e;constructor(e,{headers:t={},connect:a,factory:i}){if(!e)throw new Mr("Proxy URL is mandatory");super(),this[Fa]=t,i?this.#e=i(e,{connect:a}):this.#e=new dB(e,{connect:a})}[tB](e,t){let a=t.onHeaders;t.onHeaders=function(n,c,m){if(n===407){typeof t.onError=="function"&&t.onError(new Mr("Proxy Authentication Required (407)"));return}a&&a.call(this,n,c,m)};let{origin:i,path:r="/",headers:s={}}=e;if(e.path=i+r,!("host"in s)&&!("Host"in s)){let{host:n}=new URL(i);s.host=n}return e.headers={...this[Fa],...s},this.#e[tB](e,t)}[cB](){return this.#e.close()}[mB](e){return this.#e.destroy(e)}},Pk=class extends uB{constructor(e){if(!e||typeof e=="object"&&!(e instanceof URL)&&!e.uri)throw new Mr("Proxy uri is mandatory");let{clientFactory:t=XX}=e;if(typeof t!="function")throw new Mr("Proxy opts.clientFactory must be a function.");let{proxyTunnel:a=!0}=e;super();let i=this.#e(e),{href:r,origin:s,port:n,protocol:c,username:m,password:l,hostname:u}=i;if(this[tn]={uri:r,protocol:c},this[Lk]=e.requestTls,this[rB]=e.proxyTls,this[Fa]=e.headers||{},this[nB]=a,e.auth&&e.token)throw new Mr("opts.auth cannot be used in combination with opts.token");e.auth?this[Fa]["proxy-authorization"]=`Basic ${e.auth}`:e.token?this[Fa]["proxy-authorization"]=e.token:m&&l&&(this[Fa]["proxy-authorization"]=`Basic ${Buffer.from(`${decodeURIComponent(m)}:${decodeURIComponent(l)}`).toString("base64")}`);let d=aB({...e.proxyTls});this[sB]=aB({...e.requestTls});let g=e.factory||oee,p=(b,A)=>{let{protocol:k}=new URL(b);return this[tn].protocol==="socks5:"||this[tn].protocol==="socks:"?new KX(this[tn].uri,{headers:this[Fa],connect:d,factory:g,username:e.username||m,password:e.password||l,proxyTls:e.proxyTls,requestTls:e.requestTls}):!this[nB]&&k==="http:"&&this[tn].protocol==="http:"?new Fk(this[tn].uri,{headers:this[Fa],connect:d,factory:g}):g(b,A)};c==="socks5:"||c==="socks:"?this[Si]=null:this[Si]=t(i,{connect:d}),this[Ld]=new $X({...e,factory:p,connect:async(b,A)=>{if(!this[Si]){A(new Mr("Cannot establish tunnel connection without a proxy client"));return}let k=b.host;b.port||(k+=`:${ZX(b.protocol)}`);try{let x={origin:s,port:n,path:k,signal:b.signal,headers:{...this[Fa],host:b.host,...b.connections==null||b.connections>0?{"proxy-connection":"keep-alive"}:{}},servername:this[rB]?.servername||u},{socket:v,statusCode:j}=await this[Si].connect(x);if(j!==200){v.on("error",eee).destroy(),A(new WX(`Proxy response (${j}) !== 200 when HTTP Tunneling`));return}if(iB.proxyConnected.hasSubscribers&&iB.proxyConnected.publish({socket:v,connectParams:x}),b.protocol!=="https:"){A(null,v);return}let I;this[Lk]?I=this[Lk].servername:I=b.servername,this[sB]({...b,servername:I,httpSocket:v},A)}catch(x){x.code==="ERR_TLS_CERT_ALTNAME_INVALID"?A(new JX(x)):A(x)}}})}dispatch(e,t){let a=tee(e.headers);if(aee(a),a&&!("host"in a)&&!("Host"in a)){let{host:i}=new URL(e.origin);a.host=i}return this[Ld].dispatch({...e,headers:a},t)}#e(e){return typeof e=="string"?new URL(e):e instanceof URL?e:new URL(e.uri)}[cB](){let e=[this[Ld].close()];return this[Si]&&e.push(this[Si].close()),Promise.all(e)}[mB](){let e=[this[Ld].destroy()];return this[Si]&&e.push(this[Si].destroy()),Promise.all(e)}};function tee(o){if(Array.isArray(o)){let e={};for(let t=0;t<o.length;t+=2)e[o[t]]=o[t+1];return e}return o}function aee(o){if(o&&Object.keys(o).find(t=>t.toLowerCase()==="proxy-authorization"))throw new Mr("Proxy-Authorization should be sent in ProxyAgent constructor")}gB.exports=Pk});var yB=y((Zge,bB)=>{"use strict";var iee=Ar(),{kClose:ree,kDestroy:see,kClosed:pB,kDestroyed:hB,kDispatch:nee,kNoProxyAgent:qm,kHttpProxyAgent:Di,kHttpsProxyAgent:_r}=de(),fB=Hk(),cee=Rr(),mee={"http:":80,"https:":443},Gk=class extends iee{#e=null;#o=null;#a=null;constructor(e={}){super(),this.#a=e;let{httpProxy:t,httpsProxy:a,noProxy:i,...r}=e;this[qm]=new cee(r);let s=t??process.env.http_proxy??process.env.HTTP_PROXY;s?this[Di]=new fB({...r,uri:s}):this[Di]=this[qm];let n=a??process.env.https_proxy??process.env.HTTPS_PROXY;n?this[_r]=new fB({...r,uri:n}):this[_r]=this[Di],this.#t()}[nee](e,t){let a=new URL(e.origin);return this.#i(a).dispatch(e,t)}[ree](){return Promise.all([this[qm].close(),!this[Di][pB]&&this[Di].close(),!this[_r][pB]&&this[_r].close()])}[see](e){return Promise.all([this[qm].destroy(e),!this[Di][hB]&&this[Di].destroy(e),!this[_r][hB]&&this[_r].destroy(e)])}#i(e){let{protocol:t,host:a,port:i}=e;return a=a.replace(/:\d*$/,"").toLowerCase(),i=Number.parseInt(i,10)||mee[t]||0,this.#r(a,i)?t==="https:"?this[_r]:this[Di]:this[qm]}#r(e,t){if(this.#c&&this.#t(),this.#o.length===0)return!0;if(this.#e==="*")return!1;for(let a=0;a<this.#o.length;a++){let i=this.#o[a];if(!(i.port&&i.port!==t)&&(e===i.hostname||e.slice(-(i.hostname.length+1))===`.${i.hostname}`))return!1}return!0}#t(){let e=this.#a.noProxy??this.#s,t=e.split(/[,\s]/),a=[];for(let i=0;i<t.length;i++){let r=t[i];if(!r)continue;let s=r.match(/^(.+):(\d+)$/);a.push({hostname:(s?s[1]:r).replace(/^\*?\./,"").toLowerCase(),port:s?Number.parseInt(s[2],10):0})}this.#e=e,this.#o=a}get#c(){return this.#a.noProxy!==void 0?!1:this.#e!==this.#s}get#s(){return process.env.no_proxy??process.env.NO_PROXY??""}};bB.exports=Gk});var Fd=y((Xge,xB)=>{"use strict";var an=require("assert"),{kRetryHandlerDefaultRetry:kB}=de(),{RequestRetryError:rn}=$(),lee=Jc(),{isDisturbed:AB,parseRangeHeader:wB,wrapRequestBody:uee}=K();function dee(o){let e=new Date(o).getTime();return isNaN(e)?0:e-Date.now()}function vB(o,e,t,a){let i=o["content-length"];if(i==null||!Number.isFinite(e.start)||!Number.isFinite(e.end))return;let r=Number(i),s=e.end-e.start+1;if(!Number.isFinite(r)||r!==s)throw new rn("Content-Length mismatch",t,{headers:o,data:{count:a}})}var Yk=class o{constructor(e,{dispatch:t,handler:a}){let{retryOptions:i,...r}=e,{retry:s,maxRetries:n,maxTimeout:c,minTimeout:m,timeoutFactor:l,methods:u,errorCodes:d,retryAfter:g,statusCodes:p,throwOnError:b}=i??{};this.error=null,this.dispatch=t,this.handler=lee.wrap(a),this.opts={...r,body:uee(e.body)},this.retryOpts={throwOnError:b??!0,retry:s??o[kB],retryAfter:g??!0,maxTimeout:c??30*1e3,minTimeout:m??500,timeoutFactor:l??2,maxRetries:n??5,methods:u??["GET","HEAD","OPTIONS","PUT","DELETE","TRACE"],statusCodes:p??[500,502,503,504,429],errorCodes:d??["ECONNRESET","ECONNREFUSED","ENOTFOUND","ENETDOWN","ENETUNREACH","EHOSTDOWN","EHOSTUNREACH","EPIPE","UND_ERR_SOCKET"]},this.retryCount=0,this.retryCountCheckpoint=0,this.headersSent=!1,this.start=0,this.end=null,this.etag=null}onResponseStartWithRetry(e,t,a,i,r){if(this.retryOpts.throwOnError){this.retryOpts.statusCodes.includes(t)===!1?(this.headersSent=!0,this.handler.onResponseStart?.(e,t,a,i)):this.error=r;return}if(AB(this.opts.body)){this.headersSent=!0,this.handler.onResponseStart?.(e,t,a,i);return}function s(n){if(n){this.headersSent=!0,this.handler.onResponseStart?.(e,t,a,i),e.resume();return}this.error=r,e.resume()}e.pause(),this.retryOpts.retry(r,{state:{counter:this.retryCount},opts:{retryOptions:this.retryOpts,...this.opts}},s.bind(this))}onRequestStart(e,t){this.headersSent||this.handler.onRequestStart?.(e,t)}onRequestUpgrade(e,t,a,i){this.handler.onRequestUpgrade?.(e,t,a,i)}static[kB](e,{state:t,opts:a},i){let{statusCode:r,code:s,headers:n}=e,{method:c,retryOptions:m}=a,{maxRetries:l,minTimeout:u,maxTimeout:d,timeoutFactor:g,statusCodes:p,errorCodes:b,methods:A}=m,{counter:k}=t;if(s&&s!=="UND_ERR_REQ_RETRY"&&!b.includes(s)){i(e);return}if(Array.isArray(A)&&!A.includes(c)){i(e);return}if(r!=null&&Array.isArray(p)&&!p.includes(r)){i(e);return}if(k>l){i(e);return}let x=n?.["retry-after"];x&&(x=Number(x),x=Number.isNaN(x)?dee(n["retry-after"]):x*1e3);let v=x>0?Math.min(x,d):Math.min(u*g**(k-1),d);setTimeout(()=>i(null),v)}onResponseStart(e,t,a,i){if(this.error=null,this.retryCount+=1,t>=300){let r=new rn("Request failed",t,{headers:a,data:{count:this.retryCount}});this.onResponseStartWithRetry(e,t,a,i,r);return}if(this.headersSent){if(t!==206&&(this.start>0||t!==200))throw new rn("server does not support the range header and the payload was partially consumed",t,{headers:a,data:{count:this.retryCount}});let r=wB(a["content-range"]);if(!r)throw new rn("Content-Range mismatch",t,{headers:a,data:{count:this.retryCount}});if(this.etag!=null&&this.etag!==a.etag)throw new rn("ETag mismatch",t,{headers:a,data:{count:this.retryCount}});vB(a,r,t,this.retryCount);let{start:s,size:n,end:c=n?n-1:null}=r;an(this.start===s,"content-range mismatch"),an(this.end==null||this.end===c,"content-range mismatch");return}if(this.end==null){if(t===206){let r=wB(a["content-range"]);if(r==null){this.headersSent=!0,this.handler.onResponseStart?.(e,t,a,i);return}vB(a,r,t,this.retryCount);let{start:s,size:n,end:c=n?n-1:null}=r;an(s!=null&&Number.isFinite(s),"content-range mismatch"),an(c!=null&&Number.isFinite(c),"invalid content-length"),this.start=s,this.end=c}if(this.end==null){let r=a["content-length"];this.end=r!=null?Number(r)-1:null}an(Number.isFinite(this.start)),an(this.end==null||Number.isFinite(this.end),"invalid content-length"),this.resume=!0,this.etag=a.etag!=null?a.etag:null,this.etag!=null&&this.etag[0]==="W"&&this.etag[1]==="/"&&(this.etag=null),this.headersSent=!0,this.handler.onResponseStart?.(e,t,a,i)}else throw new rn("Request failed",t,{headers:a,data:{count:this.retryCount}})}onResponseData(e,t){this.error||(this.start+=t.length,this.handler.onResponseData?.(e,t))}onResponseEnd(e,t){if(this.error&&this.retryOpts.throwOnError)throw this.error;if(!this.error)return this.retryCount=0,this.handler.onResponseEnd?.(e,t);this.retry(e)}retry(e){if(this.start!==0){let t={range:`bytes=${this.start}-${this.end??""}`};this.etag!=null&&(t["if-match"]=this.etag),this.opts={...this.opts,headers:{...this.opts.headers,...t}}}try{this.retryCountCheckpoint=this.retryCount,this.dispatch(this.opts,this)}catch(t){this.handler.onResponseError?.(e,t)}}onResponseError(e,t){if(e?.aborted||AB(this.opts.body)){this.handler.onResponseError?.(e,t);return}function a(i){if(!i){this.retry(e);return}this.handler?.onResponseError?.(e,i)}this.retryCount-this.retryCountCheckpoint>0?this.retryCount=this.retryCountCheckpoint+(this.retryCount-this.retryCountCheckpoint):this.retryCount+=1,this.retryOpts.retry(t,{state:{counter:this.retryCount},opts:{retryOptions:this.retryOpts,...this.opts}},a.bind(this))}};xB.exports=Yk});var qB=y((epe,zB)=>{"use strict";var gee=Kc(),pee=Fd(),Vk=class extends gee{#e=null;#o=null;constructor(e,t={}){super(t),this.#e=e,this.#o=t}dispatch(e,t){let a=new pee({...e,retryOptions:this.#o},{dispatch:this.#e.dispatch.bind(this.#e),handler:t});return this.#e.dispatch(e,a)}close(){return this.#e.close()}destroy(){return this.#e.destroy()}};zB.exports=Vk});var CB=y((ope,IB)=>{"use strict";var{InvalidArgumentError:EB}=$(),hee=Ii(),$k=class extends hee{constructor(e,t){if(typeof e=="string"&&(e=new URL(e)),e.protocol!=="http:")throw new EB("h2c-client: Only h2c protocol is supported");let{maxConcurrentStreams:a,pipelining:i,...r}=t??{},s=100,n=100;if(a!=null&&Number.isInteger(a)&&a>0&&(s=a),i!=null&&Number.isInteger(i)&&i>0&&(n=i),n>s)throw new EB("h2c-client: pipelining cannot be greater than maxConcurrentStreams");super(e,{...r,maxConcurrentStreams:s,pipelining:n,allowH2:!0,useH2c:!0})}};IB.exports=$k});var UB=y((tpe,NB)=>{"use strict";var SB=require("assert"),{Readable:fee}=require("stream"),{RequestAbortedError:DB,NotSupportedError:bee,InvalidArgumentError:yee,AbortError:Pd}=$(),TB=K(),{ReadableStreamFrom:kee}=K(),Ko=Symbol("kConsume"),Hd=Symbol("kReading"),Lr=Symbol("kBody"),jB=Symbol("kAbort"),RB=Symbol("kContentType"),Wk=Symbol("kContentLength"),Jk=Symbol("kUsed"),Gd=Symbol("kBytesRead"),Aee=()=>{},Kk=class extends fee{constructor({resume:e,abort:t,contentType:a="",contentLength:i,highWaterMark:r=64*1024}){super({autoDestroy:!0,read:e,highWaterMark:r}),this._readableState.dataEmitted=!1,this[jB]=t,this[Ko]=null,this[Gd]=0,this[Lr]=null,this[Jk]=!1,this[RB]=a,this[Wk]=Number.isFinite(i)?i:null,this[Hd]=!1}_destroy(e,t){!e&&!this._readableState.endEmitted&&(e=new DB),e&&this[jB](),this[Jk]?t(e):setImmediate(t,e)}on(e,t){return(e==="data"||e==="readable")&&(this[Hd]=!0,this[Jk]=!0),super.on(e,t)}addListener(e,t){return this.on(e,t)}off(e,t){let a=super.off(e,t);return(e==="data"||e==="readable")&&(this[Hd]=this.listenerCount("data")>0||this.listenerCount("readable")>0),a}removeListener(e,t){return this.off(e,t)}push(e){return e&&(this[Gd]+=e.length,this[Ko])?(Xk(this[Ko],e),this[Hd]?super.push(e):!0):super.push(e)}text(){return Em(this,"text")}json(){return Em(this,"json")}blob(){return Em(this,"blob")}bytes(){return Em(this,"bytes")}arrayBuffer(){return Em(this,"arrayBuffer")}async formData(){throw new bee}get bodyUsed(){return TB.isDisturbed(this)}get body(){return this[Lr]||(this[Lr]=kee(this),this[Ko]&&(this[Lr].getReader(),SB(this[Lr].locked))),this[Lr]}dump(e){let t=e?.signal;if(t!=null&&(typeof t!="object"||!("aborted"in t)))return Promise.reject(new yee("signal must be an AbortSignal"));let a=e?.limit&&Number.isFinite(e.limit)?e.limit:128*1024;return t?.aborted?Promise.reject(t.reason??new Pd):this._readableState.closeEmitted?Promise.resolve(null):new Promise((i,r)=>{if((this[Wk]&&this[Wk]>a||this[Gd]>a)&&this.destroy(new Pd),t){let s=()=>{this.destroy(t.reason??new Pd)};t.addEventListener("abort",s),this.on("close",function(){t.removeEventListener("abort",s),t.aborted?r(t.reason??new Pd):i(null)})}else this.on("close",i);this.on("error",Aee).on("data",()=>{this[Gd]>a&&this.destroy()}).resume()})}setEncoding(e){return Buffer.isEncoding(e)&&(this._readableState.encoding=e),this}};function wee(o){return o[Lr]?.locked===!0||o[Ko]!==null}function vee(o){return TB.isDisturbed(o)||wee(o)}function Em(o,e){return SB(!o[Ko]),new Promise((t,a)=>{if(vee(o)){let i=o._readableState;i.destroyed&&i.closeEmitted===!1?o.on("error",a).on("close",()=>{a(new TypeError("unusable"))}):a(i.errored??new TypeError("unusable"))}else queueMicrotask(()=>{o[Ko]={type:e,stream:o,resolve:t,reject:a,length:0,body:[]},o.on("error",function(i){eA(this[Ko],i)}).on("close",function(){this[Ko].body!==null&&eA(this[Ko],new DB)}),xee(o[Ko])})})}function xee(o){if(o.body===null)return;let{_readableState:e}=o.stream;if(e.bufferIndex){let t=e.bufferIndex,a=e.buffer.length;for(let i=t;i<a;i++)Xk(o,e.buffer[i])}else for(let t of e.buffer)Xk(o,t);for(e.endEmitted?QB(this[Ko],this._readableState.encoding):o.stream.on("end",function(){QB(this[Ko],this._readableState.encoding)}),o.stream.resume();o.stream.read()!=null;);}function Zk(o,e,t){if(o.length===0||e===0)return"";let a=o.length===1?o[0]:Buffer.concat(o,e),i=a.length,r=i>2&&a[0]===239&&a[1]===187&&a[2]===191?3:0;return!t||t==="utf8"||t==="utf-8"?a.utf8Slice(r,i):a.subarray(r,i).toString(t)}function BB(o,e){if(o.length===0||e===0)return new Uint8Array(0);if(o.length===1)return new Uint8Array(o[0]);let t=new Uint8Array(Buffer.allocUnsafeSlow(e).buffer),a=0;for(let i=0;i<o.length;++i){let r=o[i];t.set(r,a),a+=r.length}return t}function QB(o,e){let{type:t,body:a,resolve:i,stream:r,length:s}=o;try{t==="text"?i(Zk(a,s,e)):t==="json"?i(JSON.parse(Zk(a,s,e))):t==="arrayBuffer"?i(BB(a,s).buffer):t==="blob"?i(new Blob(a,{type:r[RB]})):t==="bytes"&&i(BB(a,s)),eA(o)}catch(n){r.destroy(n)}}function Xk(o,e){o.length+=e.length,o.body.push(e)}function eA(o,e){o.body!==null&&(e?o.reject(e):o.resolve(),o.type=null,o.stream=null,o.resolve=null,o.reject=null,o.length=0,o.body=null)}NB.exports={Readable:Kk,chunksDecode:Zk}});var _B=y((ape,oA)=>{"use strict";var zee=require("assert"),{AsyncResource:qee}=require("async_hooks"),{Readable:Eee}=UB(),{InvalidArgumentError:sn,RequestAbortedError:OB}=$(),zt=K();function Im(){}var Yd=class extends qee{constructor(e,t){if(!e||typeof e!="object")throw new sn("invalid opts");let{signal:a,method:i,opaque:r,body:s,onInfo:n,responseHeaders:c,highWaterMark:m}=e;try{if(typeof t!="function")throw new sn("invalid callback");if(m!=null&&(!Number.isFinite(m)||m<0))throw new sn("invalid highWaterMark");if(a&&typeof a.on!="function"&&typeof a.addEventListener!="function")throw new sn("signal must be an EventEmitter or EventTarget");if(i==="CONNECT")throw new sn("invalid method");if(n&&typeof n!="function")throw new sn("invalid onInfo callback");super("UNDICI_REQUEST")}catch(l){throw zt.isStream(s)&&zt.destroy(s.on("error",Im),l),l}this.method=i,this.responseHeaders=c||null,this.opaque=r||null,this.callback=t,this.res=null,this.abort=null,this.body=s,this.trailers={},this.context=null,this.onInfo=n||null,this.highWaterMark=m,this.reason=null,this.removeAbortListener=null,a?.aborted?this.reason=a.reason??new OB:a&&(this.removeAbortListener=zt.addAbortListener(a,()=>{this.reason=a.reason??new OB,this.res?zt.destroy(this.res.on("error",Im),this.reason):this.abort&&this.abort(this.reason)}))}onConnect(e,t){if(this.reason){e(this.reason);return}zee(this.callback),this.abort=e,this.context=t}onHeaders(e,t,a,i){let{callback:r,opaque:s,abort:n,context:c,responseHeaders:m,highWaterMark:l}=this,u=m==="raw"?zt.parseRawHeaders(t):zt.parseHeaders(t);if(e<200){this.onInfo&&this.onInfo({statusCode:e,headers:u});return}let d=m==="raw"?zt.parseHeaders(t):u,g=d["content-type"],p=d["content-length"],b=new Eee({resume:a,abort:n,contentType:g,contentLength:this.method!=="HEAD"&&p?Number(p):null,highWaterMark:l});if(this.removeAbortListener&&(b.on("close",this.removeAbortListener),this.removeAbortListener=null),this.callback=null,this.res=b,r!==null)try{this.runInAsyncScope(r,null,null,{statusCode:e,statusText:i,headers:u,trailers:this.trailers,opaque:s,body:b,context:c})}catch(A){this.res=null,zt.destroy(b.on("error",Im),A),queueMicrotask(()=>{throw A})}}onData(e){return this.res.push(e)}onComplete(e){zt.parseHeaders(e,this.trailers),this.res.push(null)}onError(e){let{res:t,callback:a,body:i,opaque:r}=this;a&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(a,null,e,{opaque:r})})),t&&(this.res=null,queueMicrotask(()=>{zt.destroy(t.on("error",Im),e)})),i&&(this.body=null,zt.isStream(i)&&(i.on("error",Im),zt.destroy(i,e))),this.removeAbortListener&&(this.removeAbortListener(),this.removeAbortListener=null)}};function MB(o,e){if(e===void 0)return new Promise((t,a)=>{MB.call(this,o,(i,r)=>i?a(i):t(r))});try{let t=new Yd(o,e);this.dispatch(o,t)}catch(t){if(typeof e!="function")throw t;let a=o?.opaque;queueMicrotask(()=>e(t,{opaque:a}))}}oA.exports=MB;oA.exports.RequestHandler=Yd});var Cm=y((ipe,PB)=>{"use strict";var{addAbortListener:Iee}=K(),{RequestAbortedError:Cee}=$(),nn=Symbol("kListener"),sa=Symbol("kSignal");function LB(o){o.abort?o.abort(o[sa]?.reason):o.reason=o[sa]?.reason??new Cee,FB(o)}function jee(o,e){if(o.reason=null,o[sa]=null,o[nn]=null,!!e){if(e.aborted){LB(o);return}o[sa]=e,o[nn]=()=>{LB(o)},Iee(o[sa],o[nn])}}function FB(o){o[sa]&&("removeEventListener"in o[sa]?o[sa].removeEventListener("abort",o[nn]):o[sa].removeListener("abort",o[nn]),o[sa]=null,o[nn]=null)}PB.exports={addSignal:jee,removeSignal:FB}});var VB=y((rpe,YB)=>{"use strict";var Bee=require("assert"),{finished:Qee}=require("stream"),{AsyncResource:See}=require("async_hooks"),{InvalidArgumentError:cn,InvalidReturnValueError:Dee}=$(),Pa=K(),{addSignal:Tee,removeSignal:HB}=Cm();function Ree(){}var tA=class extends See{constructor(e,t,a){if(!e||typeof e!="object")throw new cn("invalid opts");let{signal:i,method:r,opaque:s,body:n,onInfo:c,responseHeaders:m}=e;try{if(typeof a!="function")throw new cn("invalid callback");if(typeof t!="function")throw new cn("invalid factory");if(i&&typeof i.on!="function"&&typeof i.addEventListener!="function")throw new cn("signal must be an EventEmitter or EventTarget");if(r==="CONNECT")throw new cn("invalid method");if(c&&typeof c!="function")throw new cn("invalid onInfo callback");super("UNDICI_STREAM")}catch(l){throw Pa.isStream(n)&&Pa.destroy(n.on("error",Ree),l),l}this.responseHeaders=m||null,this.opaque=s||null,this.factory=t,this.callback=a,this.res=null,this.abort=null,this.context=null,this.trailers=null,this.body=n,this.onInfo=c||null,Pa.isStream(n)&&n.on("error",l=>{this.onError(l)}),Tee(this,i)}onConnect(e,t){if(this.reason){e(this.reason);return}Bee(this.callback),this.abort=e,this.context=t}onHeaders(e,t,a,i){let{factory:r,opaque:s,context:n,responseHeaders:c}=this,m=c==="raw"?Pa.parseRawHeaders(t):Pa.parseHeaders(t);if(e<200){this.onInfo&&this.onInfo({statusCode:e,headers:m});return}if(this.factory=null,r===null)return;let l=this.runInAsyncScope(r,null,{statusCode:e,headers:m,opaque:s,context:n});if(!l||typeof l.write!="function"||typeof l.end!="function"||typeof l.on!="function")throw new Dee("expected Writable");return Qee(l,{readable:!1},d=>{let{callback:g,res:p,opaque:b,trailers:A,abort:k}=this;this.res=null,(d||!p?.readable)&&Pa.destroy(p,d),this.callback=null,this.runInAsyncScope(g,null,d||null,{opaque:b,trailers:A}),d&&k()}),l.on("drain",a),this.res=l,(l.writableNeedDrain!==void 0?l.writableNeedDrain:l._writableState?.needDrain)!==!0}onData(e){let{res:t}=this;return t?t.write(e):!0}onComplete(e){let{res:t}=this;HB(this),t&&(this.trailers=Pa.parseHeaders(e),t.end())}onError(e){let{res:t,callback:a,opaque:i,body:r}=this;HB(this),this.factory=null,t?(this.res=null,Pa.destroy(t,e)):a&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(a,null,e,{opaque:i})})),r&&(this.body=null,Pa.destroy(r,e))}};function GB(o,e,t){if(t===void 0)return new Promise((a,i)=>{GB.call(this,o,e,(r,s)=>r?i(r):a(s))});try{let a=new tA(o,e,t);this.dispatch(o,a)}catch(a){if(typeof t!="function")throw a;let i=o?.opaque;queueMicrotask(()=>t(a,{opaque:i}))}}YB.exports=GB});var KB=y((spe,JB)=>{"use strict";var{Readable:WB,Duplex:Nee,PassThrough:Uee}=require("stream"),Oee=require("assert"),{AsyncResource:Mee}=require("async_hooks"),{InvalidArgumentError:jm,InvalidReturnValueError:_ee,RequestAbortedError:aA}=$(),na=K(),{addSignal:Lee,removeSignal:Fee}=Cm();function $B(){}var mn=Symbol("resume"),iA=class extends WB{constructor(){super({autoDestroy:!0}),this[mn]=null}_read(){let{[mn]:e}=this;e&&(this[mn]=null,e())}_destroy(e,t){this._read(),t(e)}},rA=class extends WB{constructor(e){super({autoDestroy:!0}),this[mn]=e}_read(){this[mn]()}_destroy(e,t){!e&&!this._readableState.endEmitted&&(e=new aA),t(e)}},sA=class extends Mee{constructor(e,t){if(!e||typeof e!="object")throw new jm("invalid opts");if(typeof t!="function")throw new jm("invalid handler");let{signal:a,method:i,opaque:r,onInfo:s,responseHeaders:n}=e;if(a&&typeof a.on!="function"&&typeof a.addEventListener!="function")throw new jm("signal must be an EventEmitter or EventTarget");if(i==="CONNECT")throw new jm("invalid method");if(s&&typeof s!="function")throw new jm("invalid onInfo callback");super("UNDICI_PIPELINE"),this.opaque=r||null,this.responseHeaders=n||null,this.handler=t,this.abort=null,this.context=null,this.onInfo=s||null,this.req=new iA().on("error",$B),this.ret=new Nee({readableObjectMode:e.objectMode,autoDestroy:!0,read:()=>{let{body:c}=this;c?.resume&&c.resume()},write:(c,m,l)=>{let{req:u}=this;u.push(c,m)||u._readableState.destroyed?l():u[mn]=l},destroy:(c,m)=>{let{body:l,req:u,res:d,ret:g,abort:p}=this;!c&&!g._readableState.endEmitted&&(c=new aA),p&&c&&p(),na.destroy(l,c),na.destroy(u,c),na.destroy(d,c),Fee(this),m(c)}}).on("prefinish",()=>{let{req:c}=this;c.push(null)}),this.res=null,Lee(this,a)}onConnect(e,t){let{res:a}=this;if(this.reason){e(this.reason);return}Oee(!a,"pipeline cannot be retried"),this.abort=e,this.context=t}onHeaders(e,t,a){let{opaque:i,handler:r,context:s}=this;if(e<200){if(this.onInfo){let c=this.responseHeaders==="raw"?na.parseRawHeaders(t):na.parseHeaders(t);this.onInfo({statusCode:e,headers:c})}return}this.res=new rA(a);let n;try{this.handler=null;let c=this.responseHeaders==="raw"?na.parseRawHeaders(t):na.parseHeaders(t);n=this.runInAsyncScope(r,null,{statusCode:e,headers:c,opaque:i,body:this.res,context:s})}catch(c){throw this.res.on("error",$B),c}if(!n||typeof n.on!="function")throw new _ee("expected Readable");n.on("data",c=>{let{ret:m,body:l}=this;!m.push(c)&&l.pause&&l.pause()}).on("error",c=>{let{ret:m}=this;na.destroy(m,c)}).on("end",()=>{let{ret:c}=this;c.push(null)}).on("close",()=>{let{ret:c}=this;c._readableState.ended||na.destroy(c,new aA)}),this.body=n}onData(e){let{res:t}=this;return t.push(e)}onComplete(e){let{res:t}=this;t.push(null)}onError(e){let{ret:t}=this;this.handler=null,na.destroy(t,e)}};function Pee(o,e){try{let t=new sA(o,e);return this.dispatch({...o,body:t.req},t),t.ret}catch(t){return new Uee().destroy(t)}}JB.exports=Pee});var a4=y((npe,t4)=>{"use strict";var{InvalidArgumentError:nA,SocketError:Hee}=$(),{AsyncResource:Gee}=require("async_hooks"),ZB=require("assert"),XB=K(),{kHTTP2Stream:Yee}=de(),{addSignal:Vee,removeSignal:e4}=Cm(),cA=class extends Gee{constructor(e,t){if(!e||typeof e!="object")throw new nA("invalid opts");if(typeof t!="function")throw new nA("invalid callback");let{signal:a,opaque:i,responseHeaders:r}=e;if(a&&typeof a.on!="function"&&typeof a.addEventListener!="function")throw new nA("signal must be an EventEmitter or EventTarget");super("UNDICI_UPGRADE"),this.responseHeaders=r||null,this.opaque=i||null,this.callback=t,this.abort=null,this.context=null,Vee(this,a)}onConnect(e,t){if(this.reason){e(this.reason);return}ZB(this.callback),this.abort=e,this.context=null}onHeaders(){throw new Hee("bad upgrade",null)}onUpgrade(e,t,a){ZB(a[Yee]===!0?e===200:e===101);let{callback:i,opaque:r,context:s}=this;e4(this),this.callback=null;let n=this.responseHeaders==="raw"?XB.parseRawHeaders(t):XB.parseHeaders(t);this.runInAsyncScope(i,null,null,{headers:n,socket:a,opaque:r,context:s})}onError(e){let{callback:t,opaque:a}=this;e4(this),t&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(t,null,e,{opaque:a})}))}};function o4(o,e){if(e===void 0)return new Promise((t,a)=>{o4.call(this,o,(i,r)=>i?a(i):t(r))});try{let t=new cA(o,e),a={...o,method:o.method||"GET",upgrade:o.protocol||"Websocket"};this.dispatch(a,t)}catch(t){if(typeof e!="function")throw t;let a=o?.opaque;queueMicrotask(()=>e(t,{opaque:a}))}}t4.exports=o4});var c4=y((cpe,n4)=>{"use strict";var $ee=require("assert"),{AsyncResource:Wee}=require("async_hooks"),{InvalidArgumentError:mA,SocketError:Jee}=$(),i4=K(),{addSignal:Kee,removeSignal:r4}=Cm(),lA=class extends Wee{constructor(e,t){if(!e||typeof e!="object")throw new mA("invalid opts");if(typeof t!="function")throw new mA("invalid callback");let{signal:a,opaque:i,responseHeaders:r}=e;if(a&&typeof a.on!="function"&&typeof a.addEventListener!="function")throw new mA("signal must be an EventEmitter or EventTarget");super("UNDICI_CONNECT"),this.opaque=i||null,this.responseHeaders=r||null,this.callback=t,this.abort=null,Kee(this,a)}onConnect(e,t){if(this.reason){e(this.reason);return}$ee(this.callback),this.abort=e,this.context=t}onHeaders(){throw new Jee("bad connect",null)}onUpgrade(e,t,a){let{callback:i,opaque:r,context:s}=this;r4(this),this.callback=null;let n=t;n!=null&&(n=this.responseHeaders==="raw"?i4.parseRawHeaders(t):i4.parseHeaders(t)),this.runInAsyncScope(i,null,null,{statusCode:e,headers:n,socket:a,opaque:r,context:s})}onError(e){let{callback:t,opaque:a}=this;r4(this),t&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(t,null,e,{opaque:a})}))}};function s4(o,e){if(e===void 0)return new Promise((t,a)=>{s4.call(this,o,(i,r)=>i?a(i):t(r))});try{let t=new lA(o,e),a={...o,method:"CONNECT"};this.dispatch(a,t)}catch(t){if(typeof e!="function")throw t;let a=o?.opaque;queueMicrotask(()=>e(t,{opaque:a}))}}n4.exports=s4});var m4=y((mpe,ln)=>{"use strict";ln.exports.request=_B();ln.exports.stream=VB();ln.exports.pipeline=KB();ln.exports.upgrade=a4();ln.exports.connect=c4()});var dA=y((lpe,u4)=>{"use strict";var{UndiciError:Zee}=$(),l4=Symbol.for("undici.error.UND_MOCK_ERR_MOCK_NOT_MATCHED"),uA=class extends Zee{constructor(e){super(e),this.name="MockNotMatchedError",this.message=e||"The request does not match any registered mock dispatches",this.code="UND_MOCK_ERR_MOCK_NOT_MATCHED"}static[Symbol.hasInstance](e){return e&&e[l4]===!0}get[l4](){return!0}};u4.exports={MockNotMatchedError:uA}});var Fr=y((upe,d4)=>{"use strict";d4.exports={kAgent:Symbol("agent"),kOptions:Symbol("options"),kFactory:Symbol("factory"),kDispatches:Symbol("dispatches"),kDispatchKey:Symbol("dispatch key"),kDefaultHeaders:Symbol("default headers"),kDefaultTrailers:Symbol("default trailers"),kContentLength:Symbol("content length"),kMockAgent:Symbol("mock agent"),kMockAgentSet:Symbol("mock agent set"),kMockAgentGet:Symbol("mock agent get"),kMockDispatch:Symbol("mock dispatch"),kClose:Symbol("close"),kOriginalClose:Symbol("original agent close"),kOriginalDispatch:Symbol("original dispatch"),kOrigin:Symbol("origin"),kIsMockActive:Symbol("is mock active"),kNetConnect:Symbol("net connect"),kGetNetConnect:Symbol("get net connect"),kConnected:Symbol("connected"),kIgnoreTrailingSlash:Symbol("ignore trailing slash"),kMockAgentMockCallHistoryInstance:Symbol("mock agent mock call history name"),kMockAgentRegisterCallHistory:Symbol("mock agent register mock call history"),kMockAgentAddCallHistoryLog:Symbol("mock agent add call history log"),kMockAgentIsCallHistoryEnabled:Symbol("mock agent is call history enabled"),kMockAgentAcceptsNonStandardSearchParameters:Symbol("mock agent accepts non standard search parameters"),kMockCallHistoryAddLog:Symbol("mock call history add log"),kTotalDispatchCount:Symbol("total dispatch count")}});var Bm=y((dpe,x4)=>{"use strict";var{MockNotMatchedError:un}=dA(),{kDispatches:Pr,kMockAgent:Xee,kOriginalDispatch:eoe,kOrigin:ooe,kGetNetConnect:toe,kTotalDispatchCount:hA}=Fr(),{serializePathWithQuery:aoe}=K(),{STATUS_CODES:ioe}=require("http"),{types:{isPromise:roe}}=require("util"),{InvalidArgumentError:gA}=$();function ca(o,e){return typeof o=="string"?o===e:o instanceof RegExp?o.test(e):typeof o=="function"?o(e)===!0:!1}function p4(o){return Object.fromEntries(Object.entries(o).map(([e,t])=>[e.toLocaleLowerCase(),t]))}function h4(o,e){if(Array.isArray(o)){for(let t=0;t<o.length;t+=2)if(o[t].toLocaleLowerCase()===e.toLocaleLowerCase())return o[t+1];return}else return typeof o.get=="function"?o.get(e):p4(o)[e.toLocaleLowerCase()]}function yA(o){let e=o.slice(),t=[];for(let a=0;a<e.length;a+=2)t.push([e[a],e[a+1]]);return Object.fromEntries(t)}function f4(o,e){if(typeof o.headers=="function")return Array.isArray(e)&&(e=yA(e)),o.headers(e?p4(e):{});if(typeof o.headers>"u")return!0;if(typeof e!="object"||typeof o.headers!="object")return!1;for(let[t,a]of Object.entries(o.headers)){let i=h4(e,t);if(!ca(a,i))return!1}return!0}function soe(o){if(typeof o!="string")return o;let e=new URLSearchParams(o),t=new URLSearchParams;for(let[a,i]of e.entries()){if(a=a.replace("[]",""),/^(['"]).*\1$/.test(i)){t.append(a,i);continue}if(i.includes(",")){let s=i.split(",");for(let n of s)t.append(a,n);continue}t.append(a,i)}return t}function pA(o){if(typeof o!="string")return o;let e=o.split("?",3);if(e.length!==2)return o;let t=new URLSearchParams(e.pop());return t.sort(),[...e,t.toString()].join("?")}function noe(o,{path:e,method:t,body:a,headers:i}){let r=ca(o.path,e),s=ca(o.method,t),n=typeof o.body<"u"?ca(o.body,a):!0,c=f4(o,i);return r&&s&&n&&c}function b4(o){return Buffer.isBuffer(o)||o instanceof Uint8Array||o instanceof ArrayBuffer?o:typeof o=="object"?JSON.stringify(o):o?o.toString():""}function y4(o,e){let t=e.query?aoe(e.path,e.query):e.path,a=typeof t=="string"?pA(t):t,i=g4(a),r=o.filter(({consumed:s})=>!s).filter(({path:s,ignoreTrailingSlash:n})=>n?ca(g4(pA(s)),i):ca(pA(s),a));if(r.length===0)throw new un(`Mock dispatch not matched for path '${a}'`);if(r=r.filter(({method:s})=>ca(s,e.method)),r.length===0)throw new un(`Mock dispatch not matched for method '${e.method}' on path '${a}'`);if(r=r.filter(({body:s})=>typeof s<"u"?ca(s,e.body):!0),r.length===0)throw new un(`Mock dispatch not matched for body '${e.body}' on path '${a}'`);if(r=r.filter(s=>f4(s,e.headers)),r.length===0){let s=typeof e.headers=="object"?JSON.stringify(e.headers):e.headers;throw new un(`Mock dispatch not matched for headers '${s}' on path '${a}'`)}return r[0]}function coe(o,e,t,a){let i={timesInvoked:0,times:1,persist:!1,consumed:!1,...a},r=typeof t=="function"?{callback:t}:{...t},s={...i,...e,pending:!0,data:{error:null,...r}};return o.push(s),o[hA]=(o[hA]||0)+1,s}function fA(o,e){let t=o.findIndex(a=>a.consumed?noe(a,e):!1);t!==-1&&o.splice(t,1)}function g4(o){for(;o.endsWith("/");)o=o.slice(0,-1);return o.length===0&&(o="/"),o}function k4(o){let{path:e,method:t,body:a,headers:i,query:r}=o;return{path:e,method:t,body:a,headers:i,query:r}}function bA(o){let e=Object.keys(o),t=[];for(let a=0;a<e.length;++a){let i=e[a],r=o[i],s=Buffer.from(`${i}`);if(Array.isArray(r))for(let n=0;n<r.length;++n)t.push(s,Buffer.from(`${r[n]}`));else t.push(s,Buffer.from(`${r}`))}return t}function A4(o){return ioe[o]||"unknown"}async function moe(o){let e=[];for await(let t of o)e.push(t);return Buffer.concat(e).toString("utf8")}function w4(o,e){let t=k4(o),a=y4(this[Pr],t);a.timesInvoked++,a.data.callback&&(a.data={...a.data,...a.data.callback(o)});let{data:{statusCode:i,data:r,headers:s,trailers:n,error:c},delay:m,persist:l}=a,{timesInvoked:u,times:d}=a;if(a.consumed=!l&&u>=d,a.pending=u<d,c!==null)return fA(this[Pr],t),e.onError(c),!0;let g=!1,p=null;function b(x){g||(g=!0,p!==null&&(clearTimeout(p),p=null),e.onError(x))}e.onConnect?.(b,null),typeof m=="number"&&m>0?p=setTimeout(()=>{p=null,A(this[Pr])},m):A(this[Pr]);function A(x,v=r){if(g)return;let j=Array.isArray(o.headers)?yA(o.headers):o.headers,I=typeof v=="function"?v({...o,headers:j}):v;if(roe(I))return I.then(S=>A(x,S));if(g)return;let T=b4(I),D=bA(s),O=bA(n);e.onHeaders?.(i,D,k,A4(i)),e.onData?.(Buffer.from(T)),e.onComplete?.(O),fA(x,t)}function k(){}return!0}function loe(){let o=this[Xee],e=this[ooe],t=this[eoe];return function(i,r){if(o.isMockActive)try{w4.call(this,i,r)}catch(s){if(s.code==="UND_MOCK_ERR_MOCK_NOT_MATCHED"){let n=o[toe](),c=this[Pr][hA]||this[Pr].length,l=`, ${this[Pr].filter(({consumed:u})=>!u).length} interceptor(s) remaining out of ${c} defined`;if(n===!1)throw new un(`${s.message}: subsequent request to origin ${e} was not allowed (net.connect disabled)${l}`);if(v4(n,e))t.call(this,i,r);else throw new un(`${s.message}: subsequent request to origin ${e} was not allowed (net.connect is not enabled for this origin)${l}`)}else throw s}else t.call(this,i,r)}}function v4(o,e){let t=new URL(e);return o===!0?!0:!!(Array.isArray(o)&&o.some(a=>ca(a,t.host)))}function uoe(o){return typeof o!="string"&&!(o instanceof URL)?o:o instanceof URL?o.origin:o.toLowerCase()}function doe(o){let{agent:e,...t}=o;if("enableCallHistory"in t&&typeof t.enableCallHistory!="boolean")throw new gA("options.enableCallHistory must to be a boolean");if("acceptNonStandardSearchParameters"in t&&typeof t.acceptNonStandardSearchParameters!="boolean")throw new gA("options.acceptNonStandardSearchParameters must to be a boolean");if("ignoreTrailingSlash"in t&&typeof t.ignoreTrailingSlash!="boolean")throw new gA("options.ignoreTrailingSlash must to be a boolean");return t}x4.exports={getResponseData:b4,getMockDispatch:y4,addMockDispatch:coe,deleteMockDispatch:fA,buildKey:k4,generateKeyValues:bA,matchValue:ca,getResponse:moe,getStatusText:A4,mockDispatch:w4,buildMockDispatch:loe,checkNetConnect:v4,buildAndValidateMockOptions:doe,getHeaderByName:h4,buildHeadersFromArray:yA,normalizeSearchParams:soe,normalizeOrigin:uoe}});var qA=y((gpe,zA)=>{"use strict";var{getResponseData:goe,buildKey:poe,addMockDispatch:kA}=Bm(),{kDispatches:Vd,kDispatchKey:$d,kDefaultHeaders:AA,kDefaultTrailers:wA,kContentLength:vA,kMockDispatch:Wd,kIgnoreTrailingSlash:Jd}=Fr(),{InvalidArgumentError:ma}=$(),{serializePathWithQuery:hoe}=K(),dn=class{constructor(e){this[Wd]=e}delay(e){if(typeof e!="number"||!Number.isInteger(e)||e<=0)throw new ma("waitInMs must be a valid integer > 0");return this[Wd].delay=e,this}persist(){return this[Wd].persist=!0,this}times(e){if(typeof e!="number"||!Number.isInteger(e)||e<=0)throw new ma("repeatTimes must be a valid integer > 0");return this[Wd].times=e,this}},xA=class{constructor(e,t){if(typeof e!="object")throw new ma("opts must be an object");if(typeof e.path>"u")throw new ma("opts.path must be defined");if(typeof e.method>"u"&&(e.method="GET"),typeof e.path=="string")if(e.query)e.path=hoe(e.path,e.query);else{let a=new URL(e.path,"data://");e.path=a.pathname+a.search}typeof e.method=="string"&&(e.method=e.method.toUpperCase()),this[$d]=poe(e),this[Vd]=t,this[Jd]=e.ignoreTrailingSlash??!1,this[AA]={},this[wA]={},this[vA]=!1}createMockScopeDispatchData({statusCode:e,data:t,responseOptions:a}){let i=goe(t),r=this[vA]?{"content-length":i.length}:{},s={...this[AA],...r,...a.headers},n={...this[wA],...a.trailers};return{statusCode:e,data:t,headers:s,trailers:n}}validateReplyParameters(e){if(typeof e.statusCode>"u")throw new ma("statusCode must be defined");if(typeof e.responseOptions!="object"||e.responseOptions===null)throw new ma("responseOptions must be an object")}reply(e){if(typeof e=="function"){let r=n=>{let c=e(n);if(typeof c!="object"||c===null)throw new ma("reply options callback must return an object");let m={data:"",responseOptions:{},...c};return this.validateReplyParameters(m),{...this.createMockScopeDispatchData(m)}},s=kA(this[Vd],this[$d],r,{ignoreTrailingSlash:this[Jd]});return new dn(s)}let t={statusCode:e,data:arguments[1]===void 0?"":arguments[1],responseOptions:arguments[2]===void 0?{}:arguments[2]};this.validateReplyParameters(t);let a=this.createMockScopeDispatchData(t),i=kA(this[Vd],this[$d],a,{ignoreTrailingSlash:this[Jd]});return new dn(i)}replyWithError(e){if(typeof e>"u")throw new ma("error must be defined");let t=kA(this[Vd],this[$d],{error:e},{ignoreTrailingSlash:this[Jd]});return new dn(t)}defaultReplyHeaders(e){if(typeof e>"u")throw new ma("headers must be defined");return this[AA]=e,this}defaultReplyTrailers(e){if(typeof e>"u")throw new ma("trailers must be defined");return this[wA]=e,this}replyContentLength(){return this[vA]=!0,this}};zA.exports.MockInterceptor=xA;zA.exports.MockScope=dn});var jA=y((ppe,B4)=>{"use strict";var{promisify:foe}=require("util"),boe=Ii(),{buildMockDispatch:yoe}=Bm(),{kDispatches:EA,kMockAgent:z4,kClose:q4,kOriginalClose:E4,kOrigin:I4,kOriginalDispatch:koe,kConnected:IA,kIgnoreTrailingSlash:C4}=Fr(),{MockInterceptor:Aoe}=qA(),j4=de(),{InvalidArgumentError:woe}=$(),CA=class extends boe{constructor(e,t){if(!t||!t.agent||typeof t.agent.dispatch!="function")throw new woe("Argument opts.agent must implement Agent");super(e,t),this[z4]=t.agent,this[I4]=e,this[C4]=t.ignoreTrailingSlash??!1,this[EA]=[],this[IA]=1,this[koe]=this.dispatch,this[E4]=this.close.bind(this),this.dispatch=yoe.call(this),this.close=this[q4]}get[j4.kConnected](){return this[IA]}intercept(e){return new Aoe(e&&{ignoreTrailingSlash:this[C4],...e},this[EA])}cleanMocks(){this[EA]=[]}async[q4](){await foe(this[E4])(),this[IA]=0,this[z4][j4.kClients].delete(this[I4])}};B4.exports=CA});var SA=y((hpe,QA)=>{"use strict";var{kMockCallHistoryAddLog:voe}=Fr(),{InvalidArgumentError:Ni}=$();function Ti(o,e,t,a,i){switch(e.operator){case"OR":return a.push(...t(o,i)),a;case"AND":return t(o,a);default:throw new Ni("options.operator must to be a case insensitive string equal to 'OR' or 'AND'")}}function xoe(o={}){let e={};if("operator"in o){if(typeof o.operator!="string"||o.operator.toUpperCase()!=="OR"&&o.operator.toUpperCase()!=="AND")throw new Ni("options.operator must to be a case insensitive string equal to 'OR' or 'AND'");return{...e,operator:o.operator.toUpperCase()}}return e}function Ri(o){return(e,t)=>{if(typeof e=="string"||e==null)return t.filter(a=>a[o]===e);if(e instanceof RegExp)return t.filter(a=>e.test(a[o]));throw new Ni(`${o} parameter should be one of string, regexp, undefined or null`)}}function zoe(o){try{let e=new URL(o.path,o.origin);return e.search.length!==0||(e.search=new URLSearchParams(o.query).toString()),e}catch(e){throw new Ni("An error occurred when computing MockCallHistoryLog.url",{cause:e})}}var Kd=class{constructor(e={}){this.body=e.body,this.headers=e.headers,this.method=e.method;let t=zoe(e);this.fullUrl=t.toString(),this.origin=t.origin,this.path=t.pathname,this.searchParams=Object.fromEntries(t.searchParams),this.protocol=t.protocol,this.host=t.host,this.port=t.port,this.hash=t.hash}toMap(){return new Map([["protocol",this.protocol],["host",this.host],["port",this.port],["origin",this.origin],["path",this.path],["hash",this.hash],["searchParams",this.searchParams],["fullUrl",this.fullUrl],["method",this.method],["body",this.body],["headers",this.headers]])}toString(){let e={betweenKeyValueSeparator:"->",betweenPairSeparator:"|"},t="";return this.toMap().forEach((a,i)=>{(typeof a=="string"||a===void 0||a===null)&&(t=`${t}${i}${e.betweenKeyValueSeparator}${a}${e.betweenPairSeparator}`),(typeof a=="object"&&a!==null||Array.isArray(a))&&(t=`${t}${i}${e.betweenKeyValueSeparator}${JSON.stringify(a)}${e.betweenPairSeparator}`)}),t.slice(0,-1)}},BA=class{logs=[];calls(){return this.logs}firstCall(){return this.logs.at(0)}lastCall(){return this.logs.at(-1)}nthCall(e){if(typeof e!="number")throw new Ni("nthCall must be called with a number");if(!Number.isInteger(e))throw new Ni("nthCall must be called with an integer");if(Math.sign(e)!==1)throw new Ni("nthCall must be called with a positive value. use firstCall or lastCall instead");return this.logs.at(e-1)}filterCalls(e,t){if(this.logs.length===0)return this.logs;if(typeof e=="function")return this.logs.filter(e);if(e instanceof RegExp)return this.logs.filter(a=>e.test(a.toString()));if(typeof e=="object"&&e!==null){if(Object.keys(e).length===0)return this.logs;let a={operator:"OR",...xoe(t)},i=a.operator==="AND"?this.logs:[];return"protocol"in e&&(i=Ti(e.protocol,a,this.filterCallsByProtocol,i,this.logs)),"host"in e&&(i=Ti(e.host,a,this.filterCallsByHost,i,this.logs)),"port"in e&&(i=Ti(e.port,a,this.filterCallsByPort,i,this.logs)),"origin"in e&&(i=Ti(e.origin,a,this.filterCallsByOrigin,i,this.logs)),"path"in e&&(i=Ti(e.path,a,this.filterCallsByPath,i,this.logs)),"hash"in e&&(i=Ti(e.hash,a,this.filterCallsByHash,i,this.logs)),"fullUrl"in e&&(i=Ti(e.fullUrl,a,this.filterCallsByFullUrl,i,this.logs)),"method"in e&&(i=Ti(e.method,a,this.filterCallsByMethod,i,this.logs)),[...new Set(i)]}throw new Ni("criteria parameter should be one of function, regexp, or object")}filterCallsByProtocol=Ri.call(this,"protocol");filterCallsByHost=Ri.call(this,"host");filterCallsByPort=Ri.call(this,"port");filterCallsByOrigin=Ri.call(this,"origin");filterCallsByPath=Ri.call(this,"path");filterCallsByHash=Ri.call(this,"hash");filterCallsByFullUrl=Ri.call(this,"fullUrl");filterCallsByMethod=Ri.call(this,"method");clear(){this.logs=[]}[voe](e){let t=new Kd(e);return this.logs.push(t),t}*[Symbol.iterator](){for(let e of this.calls())yield e}};QA.exports.MockCallHistory=BA;QA.exports.MockCallHistoryLog=Kd});var NA=y((fpe,U4)=>{"use strict";var{promisify:qoe}=require("util"),Eoe=Sr(),{buildMockDispatch:Ioe}=Bm(),{kDispatches:DA,kMockAgent:Q4,kClose:S4,kOriginalClose:D4,kOrigin:T4,kOriginalDispatch:Coe,kConnected:TA,kIgnoreTrailingSlash:R4}=Fr(),{MockInterceptor:joe}=qA(),N4=de(),{InvalidArgumentError:Boe}=$(),RA=class extends Eoe{constructor(e,t){if(!t||!t.agent||typeof t.agent.dispatch!="function")throw new Boe("Argument opts.agent must implement Agent");super(e,t),this[Q4]=t.agent,this[T4]=e,this[R4]=t.ignoreTrailingSlash??!1,this[DA]=[],this[TA]=1,this[Coe]=this.dispatch,this[D4]=this.close.bind(this),this.dispatch=Ioe.call(this),this.close=this[S4]}get[N4.kConnected](){return this[TA]}intercept(e){return new joe(e&&{ignoreTrailingSlash:this[R4],...e},this[DA])}cleanMocks(){this[DA]=[]}async[S4](){await qoe(this[D4])(),this[TA]=0,this[Q4][N4.kClients].delete(this[T4])}};U4.exports=RA});var M4=y((ype,O4)=>{"use strict";var{Transform:Qoe}=require("stream"),{Console:Soe}=require("console"),Doe=process.versions.icu?"\u2705":"Y ",Toe=process.versions.icu?"\u274C":"N ";O4.exports=class{constructor({disableColors:e}={}){this.transform=new Qoe({transform(t,a,i){i(null,t)}}),this.logger=new Soe({stdout:this.transform,inspectOptions:{colors:!e&&!process.env.CI}})}format(e){let t=e.map(({method:a,path:i,data:{statusCode:r},persist:s,times:n,timesInvoked:c,origin:m})=>({Method:a,Origin:m,Path:i,"Status code":r,Persistent:s?Doe:Toe,Invocations:c,Remaining:s?1/0:n-c}));return this.logger.table(t),this.transform.read().toString()}}});var LA=y((kpe,Y4)=>{"use strict";var{kClients:Hr}=de(),Roe=Rr(),{kAgent:UA,kMockAgentSet:Zd,kMockAgentGet:_4,kDispatches:OA,kIsMockActive:Xd,kNetConnect:Gr,kGetNetConnect:Noe,kOptions:eg,kFactory:og,kMockAgentRegisterCallHistory:MA,kMockAgentIsCallHistoryEnabled:Qm,kMockAgentAddCallHistoryLog:L4,kMockAgentMockCallHistoryInstance:gn,kMockAgentAcceptsNonStandardSearchParameters:F4,kMockCallHistoryAddLog:Uoe,kIgnoreTrailingSlash:P4}=Fr(),Ooe=jA(),Moe=NA(),{matchValue:_oe,normalizeSearchParams:Loe,buildAndValidateMockOptions:Foe,normalizeOrigin:H4}=Bm(),{InvalidArgumentError:G4,UndiciError:Poe}=$(),Hoe=Kc(),Goe=M4(),{MockCallHistory:Yoe}=SA(),_A=class extends Hoe{constructor(e={}){super(e);let t=Foe(e);if(this[Gr]=!0,this[Xd]=!0,this[Qm]=t.enableCallHistory??!1,this[F4]=t.acceptNonStandardSearchParameters??!1,this[P4]=t.ignoreTrailingSlash??!1,e?.agent&&typeof e.agent.dispatch!="function")throw new G4("Argument opts.agent must implement Agent");let a=e?.agent?e.agent:new Roe(e);this[UA]=a,this[Hr]=a[Hr],this[eg]=t,this[Qm]&&this[MA]()}get(e){let t=H4(e),a=this[P4]?t.replace(/\/$/,""):t,i=this[_4](a);return i||(i=this[og](a),this[Zd](a,i)),i}dispatch(e,t){e.origin=H4(e.origin),this.get(e.origin),this[L4](e);let a=this[F4],i={...e};if(a&&i.path){let[r,s]=i.path.split("?"),n=Loe(s,a);i.path=`${r}?${n}`}return this[UA].dispatch(i,t)}async close(){this.clearCallHistory(),await this[UA].close(),this[Hr].clear()}deactivate(){this[Xd]=!1}activate(){this[Xd]=!0}enableNetConnect(e){if(typeof e=="string"||typeof e=="function"||e instanceof RegExp)Array.isArray(this[Gr])?this[Gr].push(e):this[Gr]=[e];else if(typeof e>"u")this[Gr]=!0;else throw new G4("Unsupported matcher. Must be one of String|Function|RegExp.")}disableNetConnect(){this[Gr]=!1}enableCallHistory(){return this[Qm]=!0,this}disableCallHistory(){return this[Qm]=!1,this}getCallHistory(){return this[gn]}clearCallHistory(){this[gn]!==void 0&&this[gn].clear()}get isMockActive(){return this[Xd]}[MA](){this[gn]===void 0&&(this[gn]=new Yoe)}[L4](e){this[Qm]&&(this[MA](),this[gn][Uoe](e))}[Zd](e,t){this[Hr].set(e,{count:0,dispatcher:t})}[og](e){let t=Object.assign({agent:this},this[eg]);return this[eg]&&this[eg].connections===1?new Ooe(e,t):new Moe(e,t)}[_4](e){let t=this[Hr].get(e);if(t?.dispatcher)return t.dispatcher;if(typeof e!="string"){let a=this[og]("http://localhost:9999");return this[Zd](e,a),a}for(let[a,i]of Array.from(this[Hr]))if(i&&typeof a!="string"&&_oe(a,e)){let r=this[og](e);return this[Zd](e,r),r[OA]=i.dispatcher[OA],r}}[Noe](){return this[Gr]}pendingInterceptors(){let e=this[Hr];return Array.from(e.entries()).flatMap(([t,a])=>a.dispatcher[OA].map(i=>({...i,origin:t}))).filter(({pending:t})=>t)}assertNoPendingInterceptors({pendingInterceptorsFormatter:e=new Goe}={}){let t=this.pendingInterceptors();if(t.length!==0)throw new Poe(t.length===1?`1 interceptor is pending:
|
|
1322
1328
|
|
|
1323
1329
|
${e.format(t)}`.trim():`${t.length} interceptors are pending:
|
|
1324
1330
|
|
|
1325
|
-
${e.format(t)}`.trim())}};YQ.exports=_A});var FA=y((Ape,JQ)=>{"use strict";var{InvalidArgumentError:Voe}=$(),{runtimeFeatures:$oe}=Ta();function Woe(o={}){let{ignoreHeaders:e=[],excludeHeaders:t=[],matchHeaders:a=[],caseSensitive:i=!1}=o;return{ignore:new Set(e.map(r=>i?r:r.toLowerCase())),exclude:new Set(t.map(r=>i?r:r.toLowerCase())),match:new Set(a.map(r=>i?r:r.toLowerCase()))}}var VQ=$oe.has("crypto")?require("crypto"):null,Joe=VQ?.hash?o=>VQ.hash("sha256",o,"base64url"):o=>Buffer.from(o).toString("base64url");function WQ(o){return Array.isArray(o)&&(o.length&1)===0}function Koe(o=[]){return o.length===0?()=>!1:function(t){let a;for(let i of o)if(typeof i=="string"){if(a||(a=t.toLowerCase()),a.includes(i.toLowerCase()))return!0}else if(i instanceof RegExp&&i.test(t))return!0;return!1}}function Zoe(o){let e={};if(!o)return e;if(WQ(o)){for(let t=0;t<o.length;t+=2){let a=o[t],i=o[t+1];if(a&&i!==void 0){let r=Buffer.isBuffer(a)?a.toString():a,s=Buffer.isBuffer(i)?i.toString():i;e[r.toLowerCase()]=s}}return e}if(o&&typeof o=="object")for(let[t,a]of Object.entries(o))t&&typeof t=="string"&&(e[t.toLowerCase()]=Array.isArray(a)?a.join(", "):String(a));return e}var $Q=["record","playback","update"];function Xoe(o){if(!$Q.includes(o))throw new Voe(`Invalid snapshot mode: ${o}. Must be one of: ${$Q.join(", ")}`)}JQ.exports={createHeaderFilters:Woe,hashId:Joe,isUndiciHeaders:WQ,normalizeHeaders:Zoe,isUrlExcludedFactory:Koe,validateSnapshotMode:Xoe}});var r4=y((wpe,i4)=>{"use strict";var{writeFile:ete,readFile:ote,mkdir:tte}=require("fs/promises"),{dirname:ate,resolve:KQ}=require("path"),{setTimeout:ite,clearTimeout:ZQ}=require("timers"),{InvalidArgumentError:XQ,UndiciError:rte}=$(),{hashId:ste,isUrlExcludedFactory:nte,normalizeHeaders:e4,createHeaderFilters:o4}=FA();function Sm(o,e,t={}){let a=new URL(o.path,o.origin),i=o._normalizedHeaders||e4(o.headers);return o._normalizedHeaders||(o._normalizedHeaders=i),{method:o.method||"GET",url:t.matchQuery!==!1?a.toString():`${a.origin}${a.pathname}`,headers:t4(i,e,t),body:t.matchBody!==!1&&o.body?String(o.body):""}}function t4(o,e,t={}){if(!o||typeof o!="object")return{};let{caseSensitive:a=!1}=t,i={},{ignore:r,exclude:s,match:n}=e;for(let[c,m]of Object.entries(o)){let l=a?c:c.toLowerCase();s.has(l)||r.has(l)||n.size!==0&&!n.has(l)||(i[l]=m)}return i}function a4(o,e,t={}){if(!o||typeof o!="object")return{};let{caseSensitive:a=!1}=t,i={},{exclude:r}=e;for(let[s,n]of Object.entries(o)){let c=a?s:s.toLowerCase();r.has(c)||(i[c]=n)}return i}function Dm(o){let e=[o.method,o.url];if(o.headers&&typeof o.headers=="object"){let a=Object.keys(o.headers).sort();for(let i of a){let r=Array.isArray(o.headers[i])?o.headers[i]:[o.headers[i]];e.push(i);for(let s of r.sort())e.push(String(s))}}e.push(o.body);let t=e.join("|");return ste(t)}var PA=class{#e;#o;#a=new Map;#i;#r=1/0;#t=!1;#c;constructor(e={}){this.#i=e.snapshotPath,this.#r=e.maxSnapshots||1/0,this.#t=e.autoFlush||!1,this.flushInterval=e.flushInterval||3e4,this._flushTimer=null,this.matchOptions={matchHeaders:e.matchHeaders||[],ignoreHeaders:e.ignoreHeaders||[],excludeHeaders:e.excludeHeaders||[],matchBody:e.matchBody!==!1,matchQuery:e.matchQuery!==!1,caseSensitive:e.caseSensitive||!1},this.#c=o4(this.matchOptions),this.shouldRecord=e.shouldRecord||(()=>!0),this.shouldPlayback=e.shouldPlayback||(()=>!0),this.#o=nte(e.excludeUrls),this.#t&&this.#i&&this.#s()}async record(e,t){if(!this.shouldRecord(e)||this.isUrlExcluded(e))return;let a=Sm(e,this.#c,this.matchOptions),i=Dm(a),r=e4(t.headers),s={statusCode:t.statusCode,headers:a4(r,this.#c,this.matchOptions),body:Buffer.isBuffer(t.body)?t.body.toString("base64"):Buffer.from(String(t.body||"")).toString("base64"),trailers:t.trailers};if(this.#a.size>=this.#r&&!this.#a.has(i)){let c=this.#a.keys().next().value;this.#a.delete(c)}let n=this.#a.get(i);n&&n.responses?(n.responses.push(s),n.timestamp=new Date().toISOString()):this.#a.set(i,{request:a,responses:[s],callCount:0,timestamp:new Date().toISOString()}),this.#t&&this.#i&&this.#m()}isUrlExcluded(e){let t=new URL(e.path,e.origin).toString();return this.#o(t)}findSnapshot(e){if(!this.shouldPlayback(e)||this.isUrlExcluded(e))return;let t=Sm(e,this.#c,this.matchOptions),a=Dm(t),i=this.#a.get(a);if(!i)return;let r=i.callCount||0,s=Math.min(r,i.responses.length-1);return i.callCount=r+1,{...i,response:i.responses[s]}}async loadSnapshots(e){let t=e||this.#i;if(!t)throw new XQ("Snapshot path is required");try{let a=await ote(KQ(t),"utf8"),i=JSON.parse(a);if(Array.isArray(i)){this.#a.clear();for(let{hash:r,snapshot:s}of i)this.#a.set(r,s)}else this.#a=new Map(Object.entries(i))}catch(a){if(a.code==="ENOENT")this.#a.clear();else throw new rte(`Failed to load snapshots from ${t}`,{cause:a})}}async saveSnapshots(e){let t=e||this.#i;if(!t)throw new XQ("Snapshot path is required");let a=KQ(t);await tte(ate(a),{recursive:!0});let i=Array.from(this.#a.entries()).map(([r,s])=>({hash:r,snapshot:s}));await ete(a,JSON.stringify(i,null,2),{flush:!0})}clear(){this.#a.clear()}getSnapshots(){return Array.from(this.#a.values())}size(){return this.#a.size}resetCallCounts(){for(let e of this.#a.values())e.callCount=0}deleteSnapshot(e){let t=Sm(e,this.#c,this.matchOptions),a=Dm(t);return this.#a.delete(a)}getSnapshotInfo(e){let t=Sm(e,this.#c,this.matchOptions),a=Dm(t),i=this.#a.get(a);return i?{hash:a,request:i.request,responseCount:i.responses?i.responses.length:i.response?1:0,callCount:i.callCount||0,timestamp:i.timestamp}:null}replaceSnapshots(e){if(this.#a.clear(),Array.isArray(e))for(let{hash:t,snapshot:a}of e)this.#a.set(t,a);else e&&typeof e=="object"&&(this.#a=new Map(Object.entries(e)))}#s(){return this.#m()}#n(){this.#e&&(ZQ(this.#e),this.saveSnapshots().catch(()=>{}),this.#e=null)}#m(){this.#e=ite(()=>{this.saveSnapshots().catch(()=>{}),this.#t?this.#e?.refresh():this.#e=null},1e3)}destroy(){this.#n(),this.#e&&(ZQ(this.#e),this.#e=null)}async close(){this.#i&&this.#a.size!==0&&await this.saveSnapshots(),this.destroy()}};i4.exports={SnapshotRecorder:PA,formatRequestKey:Sm,createRequestHash:Dm,filterHeadersForMatching:t4,filterHeadersForStorage:a4,createHeaderFilters:o4}});var c4=y((vpe,n4)=>{"use strict";var cte=Rr(),mte=LA(),{SnapshotRecorder:lte}=r4(),ute=Jc(),{InvalidArgumentError:dte,UndiciError:gte}=$(),{validateSnapshotMode:pte}=FA(),Bo=Symbol("kSnapshotRecorder"),la=Symbol("kSnapshotMode"),Tm=Symbol("kSnapshotPath"),HA=Symbol("kSnapshotLoaded"),tg=Symbol("kRealAgent"),s4=!1,GA=class extends mte{constructor(e={}){s4||(process.emitWarning("SnapshotAgent is experimental and subject to change","ExperimentalWarning"),s4=!0);let{mode:t="record",snapshotPath:a=null,...i}=e;if(super(i),pte(t),(t==="playback"||t==="update")&&!a)throw new dte(`snapshotPath is required when mode is '${t}'`);this[la]=t,this[Tm]=a,this[Bo]=new lte({snapshotPath:this[Tm],mode:this[la],maxSnapshots:e.maxSnapshots,autoFlush:e.autoFlush,flushInterval:e.flushInterval,matchHeaders:e.matchHeaders,ignoreHeaders:e.ignoreHeaders,excludeHeaders:e.excludeHeaders,matchBody:e.matchBody,matchQuery:e.matchQuery,caseSensitive:e.caseSensitive,shouldRecord:e.shouldRecord,shouldPlayback:e.shouldPlayback,excludeUrls:e.excludeUrls}),this[HA]=!1,(this[la]==="record"||this[la]==="update"||this[la]==="playback"&&e.excludeUrls&&e.excludeUrls.length>0)&&(this[tg]=new cte(e)),(this[la]==="playback"||this[la]==="update")&&this[Tm]&&this.loadSnapshots().catch(()=>{})}dispatch(e,t){t=ute.wrap(t);let a=this[la];if(this[Bo].isUrlExcluded(e))return this[tg].dispatch(e,t);if(a==="playback"||a==="update"){if(!this[HA])return this.#e(e,t);let i=this[Bo].findSnapshot(e);if(i)return this.#a(i,t);if(a==="update")return this.#o(e,t);{let r=new gte(`No snapshot found for ${e.method||"GET"} ${e.path}`);if(t.onError){t.onError(r);return}throw r}}else if(a==="record")return this.#o(e,t)}async#e(e,t){return await this.loadSnapshots(),this.dispatch(e,t)}#o(e,t){let a={statusCode:null,headers:{},trailers:{},body:[]},i=this,r={onRequestStart(n,c){return t.onRequestStart(n,{...c,history:this.history})},onRequestUpgrade(n,c,m,l){return t.onRequestUpgrade(n,c,m,l)},onResponseStart(n,c,m,l){return a.statusCode=c,a.headers=m,t.onResponseStart(n,c,m,l)},onResponseData(n,c){return a.body.push(c),t.onResponseData(n,c)},onResponseEnd(n,c){a.trailers=c;let m=Buffer.concat(a.body);i[Bo].record(e,{statusCode:a.statusCode,headers:a.headers,body:m,trailers:a.trailers}).then(()=>t.onResponseEnd(n,c)).catch(l=>t.onResponseError(n,l))}};return this[tg].dispatch(e,r)}#a(e,t){try{let{response:a}=e,i={pause(){},resume(){},abort(s){this.aborted=!0,this.reason=s},aborted:!1,paused:!1};t.onRequestStart(i),t.onResponseStart(i,a.statusCode,a.headers);let r=Buffer.from(a.body,"base64");t.onResponseData(i,r),t.onResponseEnd(i,a.trailers)}catch(a){t.onError?.(a)}}async loadSnapshots(e){await this[Bo].loadSnapshots(e||this[Tm]),this[HA]=!0,this[la]==="playback"&&this.#i()}async saveSnapshots(e){return this[Bo].saveSnapshots(e||this[Tm])}#i(){for(let e of this[Bo].getSnapshots()){let{request:t,responses:a,response:i}=e,r=new URL(t.url),s=this.get(r.origin),n=a?a[0]:i;n&&s.intercept({path:r.pathname+r.search,method:t.method,headers:t.headers,body:t.body}).reply(n.statusCode,n.body,{headers:n.headers,trailers:n.trailers}).persist()}}getRecorder(){return this[Bo]}getMode(){return this[la]}clearSnapshots(){this[Bo].clear()}resetCallCounts(){this[Bo].resetCallCounts()}deleteSnapshot(e){return this[Bo].deleteSnapshot(e)}getSnapshotInfo(e){return this[Bo].getSnapshotInfo(e)}replaceSnapshots(e){this[Bo].replaceSnapshots(e)}async close(){await this[Bo].close(),await this[tg]?.close(),await super.close()}};n4.exports=GA});var ag=y((xpe,d4)=>{"use strict";var hte=Symbol.for("undici.globalDispatcher.2"),m4=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:fte}=$(),bte=Rr();u4()===void 0&&l4(new bte);function l4(o){if(!o||typeof o.dispatch!="function")throw new fte("Argument agent must implement Agent");Object.defineProperty(globalThis,hte,{value:o,writable:!0,enumerable:!1,configurable:!1}),Object.defineProperty(globalThis,m4,{value:o,writable:!0,enumerable:!1,configurable:!1})}function u4(){return globalThis[m4]}var yte=["fetch","Headers","Response","Request","FormData","WebSocket","CloseEvent","ErrorEvent","MessageEvent","EventSource"];d4.exports={setGlobalDispatcher:l4,getGlobalDispatcher:u4,installedExports:yte}});var pn=y((qpe,g4)=>{"use strict";var Ha=require("assert"),kte=Jc();g4.exports=class{#e;#o=!1;#a=!1;#i=!1;constructor(e){if(typeof e!="object"||e===null)throw new TypeError("handler must be an object");this.#e=kte.wrap(e)}onRequestStart(...e){this.#e.onRequestStart?.(...e)}onRequestUpgrade(...e){return Ha(!this.#o),Ha(!this.#a),this.#e.onRequestUpgrade?.(...e)}onResponseStart(...e){return Ha(!this.#o),Ha(!this.#a),Ha(!this.#i),this.#i=!0,this.#e.onResponseStart?.(...e)}onResponseData(...e){return Ha(!this.#o),Ha(!this.#a),this.#e.onResponseData?.(...e)}onResponseEnd(...e){return Ha(!this.#o),Ha(!this.#a),this.#o=!0,this.#e.onResponseEnd?.(...e)}onResponseError(...e){return this.#a=!0,this.#e.onResponseError?.(...e)}onBodySent(){}}});var WA=y((Epe,b4)=>{"use strict";var Qo=K(),{kBodyUsed:Rm}=de(),$A=require("assert"),{InvalidArgumentError:YA}=$(),Ate=require("events"),wte=[300,301,302,303,307,308],p4=Symbol("body"),h4=()=>{},ig=class{constructor(e){this[p4]=e,this[Rm]=!1}async*[Symbol.asyncIterator](){$A(!this[Rm],"disturbed"),this[Rm]=!0,yield*this[p4]}},VA=class o{static buildDispatch(e,t){if(t!=null&&(!Number.isInteger(t)||t<0))throw new YA("maxRedirections must be a positive number");let a=e.dispatch.bind(e);return(i,r)=>a(i,new o(a,t,i,r))}constructor(e,t,a,i){if(t!=null&&(!Number.isInteger(t)||t<0))throw new YA("maxRedirections must be a positive number");this.dispatch=e,this.location=null;let{maxRedirections:r,...s}=a;this.opts=s,this.maxRedirections=t,this.handler=i,this.history=[],Qo.isStream(this.opts.body)?(Qo.bodyLength(this.opts.body)===0&&this.opts.body.on("data",function(){$A(!1)}),typeof this.opts.body.readableDidRead!="boolean"&&(this.opts.body[Rm]=!1,Ate.prototype.on.call(this.opts.body,"data",function(){this[Rm]=!0}))):this.opts.body&&typeof this.opts.body.pipeTo=="function"?this.opts.body=new ig(this.opts.body):this.opts.body&&typeof this.opts.body!="string"&&!ArrayBuffer.isView(this.opts.body)&&Qo.isIterable(this.opts.body)&&!Qo.isFormDataLike(this.opts.body)&&(this.opts.body=new ig(this.opts.body))}onRequestStart(e,t){this.handler.onRequestStart?.(e,{...t,history:this.history})}onRequestUpgrade(e,t,a,i){this.handler.onRequestUpgrade?.(e,t,a,i)}onResponseStart(e,t,a,i){if(this.opts.throwOnMaxRedirect&&this.history.length>=this.maxRedirections)throw new Error("max redirects");if((t===301||t===302)&&this.opts.method==="POST"&&(this.opts.method="GET",Qo.isStream(this.opts.body)&&Qo.destroy(this.opts.body.on("error",h4)),this.opts.body=null),t===303&&this.opts.method!=="HEAD"&&(this.opts.method="GET",Qo.isStream(this.opts.body)&&Qo.destroy(this.opts.body.on("error",h4)),this.opts.body=null),this.location=this.history.length>=this.maxRedirections||Qo.isDisturbed(this.opts.body)||wte.indexOf(t)===-1?null:a.location,this.opts.origin&&this.history.push(new URL(this.opts.path,this.opts.origin)),!this.location){this.handler.onResponseStart?.(e,t,a,i);return}let{origin:r,pathname:s,search:n}=Qo.parseURL(new URL(this.location,this.opts.origin&&new URL(this.opts.path,this.opts.origin))),c=n?`${s}${n}`:s,m=`${r}${c}`;for(let l of this.history)if(l.toString()===m)throw new YA(`Redirect loop detected. Cannot redirect to ${r}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);this.opts.headers=vte(this.opts.headers,t===303,this.opts.origin!==r),this.opts.path=c,this.opts.origin=r,this.opts.query=null}onResponseData(e,t){this.location||this.handler.onResponseData?.(e,t)}onResponseEnd(e,t){this.location?this.dispatch(this.opts,this):this.handler.onResponseEnd(e,t)}onResponseError(e,t){this.handler.onResponseError?.(e,t)}};function f4(o,e,t){if(o.length===4)return Qo.headerNameToString(o)==="host";if(e&&Qo.headerNameToString(o).startsWith("content-"))return!0;if(t&&(o.length===13||o.length===6||o.length===19)){let a=Qo.headerNameToString(o);return a==="authorization"||a==="cookie"||a==="proxy-authorization"}return!1}function vte(o,e,t){let a=[];if(Array.isArray(o))for(let i=0;i<o.length;i+=2)f4(o[i],e,t)||a.push(o[i],o[i+1]);else if(o&&typeof o=="object"){let i=Qo.hasSafeIterator(o)?o:Object.entries(o);for(let[r,s]of i)f4(r,e,t)||a.push(r,s)}else $A(o==null,"headers must be an object or an array");return a}b4.exports=VA});var k4=y((Ipe,y4)=>{"use strict";var xte=WA();function zte({maxRedirections:o}={}){return e=>function(a,i){let{maxRedirections:r=o,...s}=a;if(r==null||r===0)return e(a,i);let n={...s},c=new xte(e,r,n,i);return e(n,c)}}y4.exports=zte});var w4=y((Cpe,A4)=>{"use strict";var qte=pn(),{ResponseError:Ete}=$(),JA=class extends qte{#e;#o;#a;#i;#r;constructor(e,{handler:t}){super(t)}#t(e){return(this.#o??"").indexOf(e)===0}onRequestStart(e,t){return this.#e=0,this.#o=null,this.#a=null,this.#i=null,this.#r="",super.onRequestStart(e,t)}onResponseStart(e,t,a,i){if(this.#e=t,this.#i=a,this.#o=a["content-type"],this.#e<400)return super.onResponseStart(e,t,a,i);(this.#t("application/json")||this.#t("text/plain"))&&(this.#a=new TextDecoder("utf-8"))}onResponseData(e,t){if(this.#e<400)return super.onResponseData(e,t);this.#r+=this.#a?.decode(t,{stream:!0})??""}onResponseEnd(e,t){if(this.#e>=400){if(this.#r+=this.#a?.decode(void 0,{stream:!1})??"",this.#t("application/json"))try{this.#r=JSON.parse(this.#r)}catch{}let a,i=Error.stackTraceLimit;Error.stackTraceLimit=0;try{a=new Ete("Response Error",this.#e,{body:this.#r,headers:this.#i})}finally{Error.stackTraceLimit=i}super.onResponseError(e,a)}else super.onResponseEnd(e,t)}onResponseError(e,t){super.onResponseError(e,t)}};A4.exports=()=>o=>function(t,a){return o(t,new JA(t,{handler:a}))}});var x4=y((jpe,v4)=>{"use strict";var Ite=Fd();v4.exports=o=>e=>function(a,i){return e(a,new Ite({...a,retryOptions:{...o,...a.retryOptions}},{handler:i,dispatch:e}))}});var q4=y((Bpe,z4)=>{"use strict";var{InvalidArgumentError:Cte,RequestAbortedError:jte}=$(),Bte=pn(),KA=class extends Bte{#e=1024*1024;#o=!1;#a=0;#i=null;aborted=!1;reason=!1;constructor({maxSize:e,signal:t},a){if(e!=null&&(!Number.isFinite(e)||e<1))throw new Cte("maxSize must be a number greater than 0");super(a),this.#e=e??this.#e}#r(e){this.aborted=!0,this.reason=e}onRequestStart(e,t){return e.abort=this.#r.bind(this),this.#i=e,super.onRequestStart(e,t)}onResponseStart(e,t,a,i){let r=a["content-length"];if(r!=null&&r>this.#e)throw new jte(`Response size (${r}) larger than maxSize (${this.#e})`);return this.aborted===!0?!0:super.onResponseStart(e,t,a,i)}onResponseError(e,t){this.#o||(t=this.#i?.reason??t,super.onResponseError(e,t))}onResponseData(e,t){return this.#a=this.#a+t.length,this.#a>=this.#e&&(this.#o=!0,this.aborted===!0?super.onResponseError(e,this.reason):super.onResponseEnd(e,{})),!0}onResponseEnd(e,t){if(!this.#o){if(this.#i.aborted===!0){super.onResponseError(e,this.reason);return}super.onResponseEnd(e,t)}}};function Qte({maxSize:o}={maxSize:1024*1024}){return e=>function(a,i){let{dumpMaxSize:r=o}=a,s=new KA({maxSize:r,signal:a.signal},i);return e(a,s)}}z4.exports=Qte});var j4=y((Qpe,C4)=>{"use strict";var{isIP:Ste}=require("net"),{lookup:Dte}=require("dns"),Tte=pn(),{InvalidArgumentError:Yr,InformationalError:Rte}=$(),ZA=Math.pow(2,31)-1;function Nte(o){let e=Object.getPrototypeOf(o);return Object.prototype.hasOwnProperty.call(o,Symbol.iterator)||e!=null&&e!==Object.prototype&&typeof o[Symbol.iterator]=="function"}function E4(o){return typeof o=="string"&&o.toLowerCase()==="host"}function Ute(o){if(o==null)return null;if(Array.isArray(o)){if(o.length===0||!Array.isArray(o[0]))return o;let e=[];for(let t of o)Array.isArray(t)&&t.length===2?e.push(t[0],t[1]):e.push(t);return e}if(typeof o=="object"&&Nte(o)){let e=[];for(let t of o)Array.isArray(t)&&t.length===2?e.push(t[0],t[1]):e.push(t);return e}return o}function Ote(o){if(o==null)return!1;if(Array.isArray(o)){if(o.length===0)return!1;for(let e=0;e<o.length;e+=2)if(E4(o[e]))return!0;return!1}if(typeof o=="object"){for(let e in o)if(E4(e))return!0}return!1}function I4(o,e){let t=Ute(e);return Ote(t)?t:Array.isArray(t)?["host",o,...t]:t&&typeof t=="object"?{host:o,...t}:{host:o}}var XA=class{#e=0;#o=new Map;constructor(e){this.#e=e.maxItems}get size(){return this.#o.size}get(e){return this.#o.get(e)??null}set(e,t){this.#o.set(e,t)}delete(e){this.#o.delete(e)}full(){return this.size>=this.#e}},ew=class{#e=0;#o=0;dualStack=!0;affinity=null;lookup=null;pick=null;storage=null;constructor(e){this.#e=e.maxTTL,this.#o=e.maxItems,this.dualStack=e.dualStack,this.affinity=e.affinity,this.lookup=e.lookup??this.#a,this.pick=e.pick??this.#i,this.storage=e.storage??new XA(e)}runLookup(e,t,a){let i=this.storage.get(e.hostname);if(i==null&&this.storage.full()){a(null,e);return}let r={affinity:this.affinity,dualStack:this.dualStack,lookup:this.lookup,pick:this.pick,...t.dns,maxTTL:this.#e,maxItems:this.#o};if(i==null)this.lookup(e,r,(s,n)=>{if(s||n==null||n.length===0){a(s??new Rte("No DNS entries found"));return}this.setRecords(e,n);let c=this.storage.get(e.hostname),m=this.pick(e,c,r.affinity),l;typeof m.port=="number"?l=`:${m.port}`:e.port!==""?l=`:${e.port}`:l="",a(null,new URL(`${e.protocol}//${m.family===6?`[${m.address}]`:m.address}${l}`))});else{let s=this.pick(e,i,r.affinity);if(s==null){this.storage.delete(e.hostname),this.runLookup(e,t,a);return}let n;typeof s.port=="number"?n=`:${s.port}`:e.port!==""?n=`:${e.port}`:n="",a(null,new URL(`${e.protocol}//${s.family===6?`[${s.address}]`:s.address}${n}`))}}#a(e,t,a){Dte(e.hostname,{all:!0,family:this.dualStack===!1?this.affinity:0,order:"ipv4first"},(i,r)=>{if(i)return a(i);let s=new Map;for(let n of r)s.set(`${n.address}:${n.family}`,n);a(null,s.values())})}#i(e,t,a){let i=null,{records:r,offset:s}=t,n;if(this.dualStack?(a==null&&(s==null||s===ZA?(t.offset=0,a=4):(t.offset++,a=(t.offset&1)===1?6:4)),r[a]!=null&&r[a].ips.length>0?n=r[a]:n=r[a===4?6:4]):n=r[a],n==null||n.ips.length===0)return i;n.offset==null||n.offset===ZA?n.offset=0:n.offset++;let c=n.offset%n.ips.length;return i=n.ips[c]??null,i==null?i:Date.now()-i.timestamp>i.ttl?(n.ips.splice(c,1),this.pick(e,t,a)):i}pickFamily(e,t){let a=this.storage.get(e.hostname)?.records;if(!a)return null;let i=a[t];if(!i)return null;i.offset==null||i.offset===ZA?i.offset=0:i.offset++;let r=i.offset%i.ips.length,s=i.ips[r]??null;return s==null||Date.now()-s.timestamp>s.ttl&&i.ips.splice(r,1),s}setRecords(e,t){let a=Date.now(),i={records:{4:null,6:null}},r=this.#e;for(let s of t){s.timestamp=a,typeof s.ttl=="number"?(s.ttl=Math.min(s.ttl,this.#e),r=Math.min(r,s.ttl)):s.ttl=this.#e;let n=i.records[s.family]??{ips:[]};n.ips.push(s),i.records[s.family]=n}this.storage.set(e.hostname,i,{ttl:r})}deleteRecords(e){this.storage.delete(e.hostname)}getHandler(e,t){return new ow(this,e,t)}},ow=class extends Tte{#e=null;#o=null;#a=null;#i=null;#r=null;#t=null;#c=!0;constructor(e,{origin:t,handler:a,dispatch:i,newOrigin:r},s){super(a),this.#i=t,this.#t=r,this.#o={...s},this.#e=e,this.#a=i}onResponseError(e,t){switch(t.code){case"ETIMEDOUT":case"ECONNREFUSED":{if(this.#e.dualStack){if(!this.#c){super.onResponseError(e,t);return}this.#c=!1;let a=this.#t.hostname[0]==="["?4:6,i=this.#e.pickFamily(this.#i,a);if(i==null){super.onResponseError(e,t);return}let r;typeof i.port=="number"?r=`:${i.port}`:this.#i.port!==""?r=`:${this.#i.port}`:r="";let s={...this.#o,origin:`${this.#i.protocol}//${i.family===6?`[${i.address}]`:i.address}${r}`,headers:I4(this.#i.host,this.#o.headers)};this.#a(s,this);return}super.onResponseError(e,t);break}case"ENOTFOUND":this.#e.deleteRecords(this.#i),super.onResponseError(e,t);break;default:super.onResponseError(e,t);break}}};C4.exports=o=>{if(o?.maxTTL!=null&&(typeof o?.maxTTL!="number"||o?.maxTTL<0))throw new Yr("Invalid maxTTL. Must be a positive number");if(o?.maxItems!=null&&(typeof o?.maxItems!="number"||o?.maxItems<1))throw new Yr("Invalid maxItems. Must be a positive number and greater than zero");if(o?.affinity!=null&&o?.affinity!==4&&o?.affinity!==6)throw new Yr("Invalid affinity. Must be either 4 or 6");if(o?.dualStack!=null&&typeof o?.dualStack!="boolean")throw new Yr("Invalid dualStack. Must be a boolean");if(o?.lookup!=null&&typeof o?.lookup!="function")throw new Yr("Invalid lookup. Must be a function");if(o?.pick!=null&&typeof o?.pick!="function")throw new Yr("Invalid pick. Must be a function");if(o?.storage!=null&&(typeof o?.storage?.get!="function"||typeof o?.storage?.set!="function"||typeof o?.storage?.full!="function"||typeof o?.storage?.delete!="function"))throw new Yr("Invalid storage. Must be a object with methods: { get, set, full, delete }");let e=o?.dualStack??!0,t;e?t=o?.affinity??null:t=o?.affinity??4;let a={maxTTL:o?.maxTTL??1e4,lookup:o?.lookup??null,pick:o?.pick??null,dualStack:e,affinity:t,maxItems:o?.maxItems??1/0,storage:o?.storage},i=new ew(a);return r=>function(n,c){let m=n.origin.constructor===URL?n.origin:new URL(n.origin);return Ste(m.hostname)!==0?r(n,c):(i.runLookup(m,n,(l,u)=>{if(l)return c.onResponseError(null,l);let d={...n,servername:m.hostname,origin:u.origin,headers:I4(m.host,n.headers)};r(d,i.getHandler({origin:m,dispatch:r,handler:c,newOrigin:u},n))}),!0)}}});var hn=y((Spe,_4)=>{"use strict";var{safeHTTPMethods:B4,pathHasQueryOrFragment:Mte,hasSafeIterator:_te,isValidHTTPToken:Nm}=K(),{serializePathWithQuery:Lte}=K(),Fte=2147483647,Q4=["no-store","private","no-cache"],tw=Symbol("invalid cache-control directives");function Vr(o){return o.replace(/^[\t ]+|[\t ]+$/g,"")}function U4(o,e){for(let t=0;t<o.length;t++)if(o[t]===e)return!0;return!1}function S4(o){return o.replace(/^[\t ]+/,"")}function D4(o){return o.replace(/[\t ]+$/,"")}function T4(o,e){let t=!1;for(let a=e;a<o.length;a++)if(t)t=!1;else if(o[a]==="\\")t=!0;else if(o[a]==='"')return a;return-1}function Pte(o){let e=[],t=0,a=-1,i=!1,r=!1;for(let m=0;m<o.length;m++)i?r?r=!1:o[m]==="\\"?r=!0:o[m]==='"'&&(i=!1,a=-1):o[m]==='"'?(i=!0,a=m):o[m]===","&&(e.push({value:o.substring(t,m),fromMalformedQuote:!1}),t=m+1);if(!i)return e.push({value:o.substring(t),fromMalformedQuote:!1}),e;let s=o.substring(t),n=a-t,c=0;for(let m=0;m<s.length;m++)s[m]===","&&(e.push({value:s.substring(c,m),fromMalformedQuote:c>n}),c=m+1);return e.push({value:s.substring(c),fromMalformedQuote:c>n}),e}function R4(o,e){let t=o[tw];t===void 0&&(t=new Set,Object.defineProperty(o,tw,{value:t})),t.add(e)}function Hte(o,e){return o[tw]?.has(e)===!0}function Gte(o){for(let a of Q4)if(o.startsWith(a)&&o.length>a.length&&!Nm(o[a.length]))return a;let e="",t=!1;for(let a=0;a<o.length;a++)Nm(o[a])?e+=o[a]:t=!0;if(t&&U4(Q4,e))return e}function Yte(o){if(!o.origin)throw new Error("opts.origin is undefined");let e=o.path||"/";return o.query&&!Mte(e)&&(e=Lte(e,o.query)),{origin:o.origin.toString(),method:o.method,path:e,headers:o.headers}}function N4(o,e,t){let a=e.toLowerCase(),i=o[a],r=Array.isArray(t)?t:[t];i===void 0?o[a]=Array.isArray(t)?t.slice():t:Array.isArray(i)?i.push(...r):o[a]=[i,...r]}function Vte(o){let e;if(o.headers==null)e={};else if(typeof o.headers=="object")if(e={},_te(o.headers))for(let t of o.headers){if(!Array.isArray(t))throw new Error("opts.headers is not a valid header map");let[a,i]=t;if(typeof a!="string"||typeof i!="string")throw new Error("opts.headers is not a valid header map");N4(e,a,i)}else for(let t of Object.keys(o.headers))N4(e,t,o.headers[t]);else throw new Error("opts.headers is not an object");return e}function $te(o){if(typeof o!="object")throw new TypeError(`expected key to be object, got ${typeof o}`);for(let e of["origin","method","path"])if(typeof o[e]!="string")throw new TypeError(`expected key.${e} to be string, got ${typeof o[e]}`);if(o.headers!==void 0&&typeof o.headers!="object")throw new TypeError(`expected headers to be object, got ${typeof o}`)}function Wte(o){if(typeof o!="object")throw new TypeError(`expected value to be object, got ${typeof o}`);for(let e of["statusCode","cachedAt","staleAt","deleteAt"])if(typeof o[e]!="number")throw new TypeError(`expected value.${e} to be number, got ${typeof o[e]}`);if(typeof o.statusMessage!="string")throw new TypeError(`expected value.statusMessage to be string, got ${typeof o.statusMessage}`);if(o.headers!=null&&typeof o.headers!="object")throw new TypeError(`expected value.rawHeaders to be object, got ${typeof o.headers}`);if(o.vary!==void 0&&typeof o.vary!="object")throw new TypeError(`expected value.vary to be object, got ${typeof o.vary}`);if(o.etag!==void 0&&typeof o.etag!="string")throw new TypeError(`expected value.etag to be string, got ${typeof o.etag}`)}function Jte(o){let e={},t=new Set,a=new Set,i=Pte(Array.isArray(o)?o.join(","):o);for(let r=0;r<i.length;r++){let s=i[r],n=s.value.toLowerCase(),c=s.fromMalformedQuote,m=n.indexOf("="),l,u,d=!1,g=!1;if(m!==-1){let b=n.substring(0,m),A=n.substring(m+1);d=D4(b)!==b,g=S4(A)!==A,l=Vr(b),u=S4(A)}else l=Vr(n);let p=Gte(l);if(p!==void 0){e[p]=!0;continue}switch(l){case"min-fresh":case"max-stale":case"max-age":case"s-maxage":case"stale-while-revalidate":case"stale-if-error":{if(c||t.has(l))continue;if(u===void 0||d||g){delete e[l],t.add(l),R4(e,l);continue}if(u.length>=2&&u[0]==='"'&&u[u.length-1]==='"'&&(u=u.substring(1,u.length-1)),!/^[0-9]+$/.test(u)){delete e[l],t.add(l),R4(e,l);continue}let b=Math.min(parseInt(u,10),Fte);l==="min-fresh"?(!(l in e)||e[l]<b)&&(e[l]=b):(!(l in e)||e[l]>b)&&(e[l]=b);break}case"private":case"no-cache":{if(c){e[l]=!0;break}if(u!==void 0&&u.length===0){e[l]=!0;break}if(u){if(u[0]==='"'){u=D4(u);let b="",A=r,k=!1,x=T4(u,1);if(x!==-1)b=u.substring(1,x),k=!0;else{let I=[u.substring(1)];for(let T=r+1;T<i.length;T++){let D=Vr(i[T].value),O=T4(D,0);if(A=T,O!==-1){I.push(D.substring(0,O)),k=!0;break}I.push(D)}b=I.join(",")}if(!k){e[l]=!0;break}r=A;let v=b.split(","),j=!0;for(let I=0;I<v.length;I++)v[I]=Vr(v[I]),Nm(v[I])||(j=!1);j?e[l]!==!0&&(l in e?e[l]=e[l].concat(v):e[l]=v):e[l]=!0}else{let b=Vr(u);Nm(b)?e[l]!==!0&&(l in e?e[l]=e[l].concat(b):e[l]=[b]):e[l]=!0}break}}case"public":case"must-revalidate":case"proxy-revalidate":case"immutable":case"no-transform":case"must-understand":case"only-if-cached":if(c||a.has(l))continue;if(u!==void 0){delete e[l],a.add(l);continue}e[l]=!0;break;case"no-store":e[l]=!0;break;default:continue}}return e}function O4(o){let e=Array.isArray(o)?o:[o],t=[];for(let a=0;a<e.length;a++){let i=e[a].split(",");for(let r=0;r<i.length;r++)t.push(i[r])}return t}function aw(o){let e=O4(o);for(let t=0;t<e.length;t++)if(Vr(e[t]).indexOf("*")!==-1)return!0;return!1}function M4(o,e){if(aw(o))return e;let t={},a=O4(o);for(let i of a){let r=Vr(i).toLowerCase();if(r.length===0)continue;if(!Nm(r))return;let s=e[r];t[r]=Array.isArray(s)?s.slice():s??null}return t}function Kte(o){return aw(o)||M4(o,{})===void 0}function Zte(o){return o.length<=2?!1:o[0]==='"'&&o[o.length-1]==='"'?!(o[1]==='"'||o.startsWith('"W/')):o.startsWith('W/"')&&o[o.length-1]==='"'?o.length!==4:!1}function Xte(o,e="CacheStore"){if(typeof o!="object"||o===null)throw new TypeError(`expected type of ${e} to be a CacheStore, got ${o===null?"null":typeof o}`);for(let t of["get","createWriteStream","delete"])if(typeof o[t]!="function")throw new TypeError(`${e} needs to have a \`${t}()\` function`)}function eae(o,e="CacheMethods"){if(!Array.isArray(o))throw new TypeError(`expected type of ${e} needs to be an array, got ${o===null?"null":typeof o}`);if(o.length===0)throw new TypeError(`${e} needs to have at least one method`);for(let t of o)if(!U4(B4,t))throw new TypeError(`element of ${e}-array needs to be one of following values: ${B4.join(", ")}, got ${t}`)}function oae(o,e){let t={};if(o.headers){let a=Object.keys(o.headers).sort();for(let i of a)e?.has(i.toLowerCase())||(t[i]=o.headers[i])}return JSON.stringify([o.origin,o.method,o.path,t])}_4.exports={makeCacheKey:Yte,normalizeHeaders:Vte,assertCacheKey:$te,assertCacheValue:Wte,parseCacheControlHeader:Jte,hasInvalidCacheControlDirective:Hte,parseVaryHeader:M4,hasVaryStar:aw,isInvalidOrWildcardVaryHeader:Kte,isEtagUsable:Zte,assertCacheMethods:eae,assertCacheStore:Xte,makeDeduplicationKey:oae}});var rw=y((Dpe,L4)=>{"use strict";function tae(o){switch(o[3]){case",":return aae(o);case" ":return iae(o);default:return rae(o)}}function iw(o,e,t,a,i,r,s){let n=new Date(Date.UTC(o,e,t,a,i,r));return o>=0&&o<=99&&n.setUTCFullYear(o),n.getUTCFullYear()===o&&n.getUTCMonth()===e&&n.getUTCDate()===t&&n.getUTCHours()===a&&n.getUTCMinutes()===i&&n.getUTCSeconds()===r&&n.getUTCDay()===s?n:void 0}function aae(o){if(o.length!==29||o[4]!==" "||o[7]!==" "||o[11]!==" "||o[16]!==" "||o[19]!==":"||o[22]!==":"||o[25]!==" "||o[26]!=="G"||o[27]!=="M"||o[28]!=="T")return;let e=-1;if(o[0]==="S"&&o[1]==="u"&&o[2]==="n")e=0;else if(o[0]==="M"&&o[1]==="o"&&o[2]==="n")e=1;else if(o[0]==="T"&&o[1]==="u"&&o[2]==="e")e=2;else if(o[0]==="W"&&o[1]==="e"&&o[2]==="d")e=3;else if(o[0]==="T"&&o[1]==="h"&&o[2]==="u")e=4;else if(o[0]==="F"&&o[1]==="r"&&o[2]==="i")e=5;else if(o[0]==="S"&&o[1]==="a"&&o[2]==="t")e=6;else return;let t=0;if(o[5]==="0"){let d=o.charCodeAt(6);if(d<49||d>57)return;t=d-48}else{let d=o.charCodeAt(5);if(d<49||d>51)return;let g=o.charCodeAt(6);if(g<48||g>57)return;t=(d-48)*10+(g-48)}let a=-1;if(o[8]==="J"&&o[9]==="a"&&o[10]==="n")a=0;else if(o[8]==="F"&&o[9]==="e"&&o[10]==="b")a=1;else if(o[8]==="M"&&o[9]==="a")if(o[10]==="r")a=2;else if(o[10]==="y")a=4;else return;else if(o[8]==="J")if(o[9]==="a"&&o[10]==="n")a=0;else if(o[9]==="u")if(o[10]==="n")a=5;else if(o[10]==="l")a=6;else return;else return;else if(o[8]==="A")if(o[9]==="p"&&o[10]==="r")a=3;else if(o[9]==="u"&&o[10]==="g")a=7;else return;else if(o[8]==="S"&&o[9]==="e"&&o[10]==="p")a=8;else if(o[8]==="O"&&o[9]==="c"&&o[10]==="t")a=9;else if(o[8]==="N"&&o[9]==="o"&&o[10]==="v")a=10;else if(o[8]==="D"&&o[9]==="e"&&o[10]==="c")a=11;else return;let i=o.charCodeAt(12);if(i<48||i>57)return;let r=o.charCodeAt(13);if(r<48||r>57)return;let s=o.charCodeAt(14);if(s<48||s>57)return;let n=o.charCodeAt(15);if(n<48||n>57)return;let c=(i-48)*1e3+(r-48)*100+(s-48)*10+(n-48),m=0;if(o[17]==="0"){let d=o.charCodeAt(18);if(d<48||d>57)return;m=d-48}else{let d=o.charCodeAt(17);if(d<48||d>50)return;let g=o.charCodeAt(18);if(g<48||g>57||d===50&&g>51)return;m=(d-48)*10+(g-48)}let l=0;if(o[20]==="0"){let d=o.charCodeAt(21);if(d<48||d>57)return;l=d-48}else{let d=o.charCodeAt(20);if(d<48||d>53)return;let g=o.charCodeAt(21);if(g<48||g>57)return;l=(d-48)*10+(g-48)}let u=0;if(o[23]==="0"){let d=o.charCodeAt(24);if(d<48||d>57)return;u=d-48}else{let d=o.charCodeAt(23);if(d<48||d>53)return;let g=o.charCodeAt(24);if(g<48||g>57)return;u=(d-48)*10+(g-48)}return iw(c,a,t,m,l,u,e)}function iae(o){if(o.length!==24||o[7]!==" "||o[10]!==" "||o[19]!==" ")return;let e=-1;if(o[0]==="S"&&o[1]==="u"&&o[2]==="n")e=0;else if(o[0]==="M"&&o[1]==="o"&&o[2]==="n")e=1;else if(o[0]==="T"&&o[1]==="u"&&o[2]==="e")e=2;else if(o[0]==="W"&&o[1]==="e"&&o[2]==="d")e=3;else if(o[0]==="T"&&o[1]==="h"&&o[2]==="u")e=4;else if(o[0]==="F"&&o[1]==="r"&&o[2]==="i")e=5;else if(o[0]==="S"&&o[1]==="a"&&o[2]==="t")e=6;else return;let t=-1;if(o[4]==="J"&&o[5]==="a"&&o[6]==="n")t=0;else if(o[4]==="F"&&o[5]==="e"&&o[6]==="b")t=1;else if(o[4]==="M"&&o[5]==="a")if(o[6]==="r")t=2;else if(o[6]==="y")t=4;else return;else if(o[4]==="J")if(o[5]==="a"&&o[6]==="n")t=0;else if(o[5]==="u")if(o[6]==="n")t=5;else if(o[6]==="l")t=6;else return;else return;else if(o[4]==="A")if(o[5]==="p"&&o[6]==="r")t=3;else if(o[5]==="u"&&o[6]==="g")t=7;else return;else if(o[4]==="S"&&o[5]==="e"&&o[6]==="p")t=8;else if(o[4]==="O"&&o[5]==="c"&&o[6]==="t")t=9;else if(o[4]==="N"&&o[5]==="o"&&o[6]==="v")t=10;else if(o[4]==="D"&&o[5]==="e"&&o[6]==="c")t=11;else return;let a=0;if(o[8]===" "){let d=o.charCodeAt(9);if(d<49||d>57)return;a=d-48}else{let d=o.charCodeAt(8);if(d<49||d>51)return;let g=o.charCodeAt(9);if(g<48||g>57)return;a=(d-48)*10+(g-48)}let i=0;if(o[11]==="0"){let d=o.charCodeAt(12);if(d<48||d>57)return;i=d-48}else{let d=o.charCodeAt(11);if(d<48||d>50)return;let g=o.charCodeAt(12);if(g<48||g>57||d===50&&g>51)return;i=(d-48)*10+(g-48)}let r=0;if(o[14]==="0"){let d=o.charCodeAt(15);if(d<48||d>57)return;r=d-48}else{let d=o.charCodeAt(14);if(d<48||d>53)return;let g=o.charCodeAt(15);if(g<48||g>57)return;r=(d-48)*10+(g-48)}let s=0;if(o[17]==="0"){let d=o.charCodeAt(18);if(d<48||d>57)return;s=d-48}else{let d=o.charCodeAt(17);if(d<48||d>53)return;let g=o.charCodeAt(18);if(g<48||g>57)return;s=(d-48)*10+(g-48)}let n=o.charCodeAt(20);if(n<48||n>57)return;let c=o.charCodeAt(21);if(c<48||c>57)return;let m=o.charCodeAt(22);if(m<48||m>57)return;let l=o.charCodeAt(23);if(l<48||l>57)return;let u=(n-48)*1e3+(c-48)*100+(m-48)*10+(l-48);return iw(u,t,a,i,r,s,e)}function rae(o){let e=-1,t=-1;if(o[0]==="S")o[1]==="u"&&o[2]==="n"&&o[3]==="d"&&o[4]==="a"&&o[5]==="y"?(t=0,e=6):o[1]==="a"&&o[2]==="t"&&o[3]==="u"&&o[4]==="r"&&o[5]==="d"&&o[6]==="a"&&o[7]==="y"&&(t=6,e=8);else if(o[0]==="M"&&o[1]==="o"&&o[2]==="n"&&o[3]==="d"&&o[4]==="a"&&o[5]==="y")t=1,e=6;else if(o[0]==="T")o[1]==="u"&&o[2]==="e"&&o[3]==="s"&&o[4]==="d"&&o[5]==="a"&&o[6]==="y"?(t=2,e=7):o[1]==="h"&&o[2]==="u"&&o[3]==="r"&&o[4]==="s"&&o[5]==="d"&&o[6]==="a"&&o[7]==="y"&&(t=4,e=8);else if(o[0]==="W"&&o[1]==="e"&&o[2]==="d"&&o[3]==="n"&&o[4]==="e"&&o[5]==="s"&&o[6]==="d"&&o[7]==="a"&&o[8]==="y")t=3,e=9;else if(o[0]==="F"&&o[1]==="r"&&o[2]==="i"&&o[3]==="d"&&o[4]==="a"&&o[5]==="y")t=5,e=6;else return;if(o[e]!==","||o.length-e-1!==23||o[e+1]!==" "||o[e+4]!=="-"||o[e+8]!=="-"||o[e+11]!==" "||o[e+14]!==":"||o[e+17]!==":"||o[e+20]!==" "||o[e+21]!=="G"||o[e+22]!=="M"||o[e+23]!=="T")return;let a=0;if(o[e+2]==="0"){let u=o.charCodeAt(e+3);if(u<49||u>57)return;a=u-48}else{let u=o.charCodeAt(e+2);if(u<49||u>51)return;let d=o.charCodeAt(e+3);if(d<48||d>57)return;a=(u-48)*10+(d-48)}let i=-1;if(o[e+5]==="J"&&o[e+6]==="a"&&o[e+7]==="n")i=0;else if(o[e+5]==="F"&&o[e+6]==="e"&&o[e+7]==="b")i=1;else if(o[e+5]==="M"&&o[e+6]==="a"&&o[e+7]==="r")i=2;else if(o[e+5]==="A"&&o[e+6]==="p"&&o[e+7]==="r")i=3;else if(o[e+5]==="M"&&o[e+6]==="a"&&o[e+7]==="y")i=4;else if(o[e+5]==="J"&&o[e+6]==="u"&&o[e+7]==="n")i=5;else if(o[e+5]==="J"&&o[e+6]==="u"&&o[e+7]==="l")i=6;else if(o[e+5]==="A"&&o[e+6]==="u"&&o[e+7]==="g")i=7;else if(o[e+5]==="S"&&o[e+6]==="e"&&o[e+7]==="p")i=8;else if(o[e+5]==="O"&&o[e+6]==="c"&&o[e+7]==="t")i=9;else if(o[e+5]==="N"&&o[e+6]==="o"&&o[e+7]==="v")i=10;else if(o[e+5]==="D"&&o[e+6]==="e"&&o[e+7]==="c")i=11;else return;let r=o.charCodeAt(e+9);if(r<48||r>57)return;let s=o.charCodeAt(e+10);if(s<48||s>57)return;let n=(r-48)*10+(s-48);n+=n<70?2e3:1900;let c=0;if(o[e+12]==="0"){let u=o.charCodeAt(e+13);if(u<48||u>57)return;c=u-48}else{let u=o.charCodeAt(e+12);if(u<48||u>50)return;let d=o.charCodeAt(e+13);if(d<48||d>57||u===50&&d>51)return;c=(u-48)*10+(d-48)}let m=0;if(o[e+15]==="0"){let u=o.charCodeAt(e+16);if(u<48||u>57)return;m=u-48}else{let u=o.charCodeAt(e+15);if(u<48||u>53)return;let d=o.charCodeAt(e+16);if(d<48||d>57)return;m=(u-48)*10+(d-48)}let l=0;if(o[e+18]==="0"){let u=o.charCodeAt(e+19);if(u<48||u>57)return;l=u-48}else{let u=o.charCodeAt(e+18);if(u<48||u>53)return;let d=o.charCodeAt(e+19);if(d<48||d>57)return;l=(u-48)*10+(d-48)}return iw(n,i,a,c,m,l,t)}L4.exports={parseHttpDate:tae}});var $4=y((Tpe,V4)=>{"use strict";var sw=K(),{parseCacheControlHeader:sae,hasInvalidCacheControlDirective:F4,parseVaryHeader:nae,hasVaryStar:cae,isInvalidOrWildcardVaryHeader:H4,isEtagUsable:mae}=hn(),{parseHttpDate:nw}=rw();function lae(){}var G4=[200,203,204,206,300,301,308,404,405,410,414,501],uae=[206],Um=2147483647e3;function dae(o){return o.replace(/^[\t ]+|[\t ]+$/g,"")}function fn(o,e){for(let t=0;t<o.length;t++)if(o[t]===e)return!0;return!1}function gae(o,e){let t=Array.isArray(e)?e:[e];for(let a=0;a<t.length;a++){let i=t[a].split(",");for(let r=0;r<i.length;r++)o.push(dae(i[r]).toLowerCase())}}function pae(o,e){if(typeof e!="string")return;let t,a,i;try{t=new URL(o.origin),a=new URL(o.path,t),i=new URL(e,a)}catch{return}if(i.origin===t.origin)return i.pathname+i.search}function Y4(o,e,t){Om(o,{...e,path:t});for(let a=0;a<sw.safeHTTPMethods.length;a++){let i=sw.safeHTTPMethods[a];i!==e.method&&Om(o,{...e,method:i,path:t})}}function P4(o,e,t){if(t===void 0)return;let a=Array.isArray(t)?t:[t];for(let i=0;i<a.length;i++){let r=pae(e,a[i]);r!==void 0&&Y4(o,e,r)}}function hae(o,e,t){Y4(o,e,e.path),P4(o,e,t.location),P4(o,e,t["content-location"])}var cw=class{#e;#o;#a;#i;#r;#t;constructor({store:e,type:t,cacheByDefault:a},i,r){this.#i=e,this.#o=t,this.#a=a,this.#e=i,this.#r=r}onRequestStart(e,t){this.#t?.destroy(),this.#t=void 0,this.#r.onRequestStart?.(e,t)}onRequestUpgrade(e,t,a,i){this.#r.onRequestUpgrade?.(e,t,a,i)}onResponseStart(e,t,a,i){let r=()=>this.#r.onResponseStart?.(e,t,a,i),s=this;if(!fn(sw.safeHTTPMethods,this.#e.method)&&t>=200&&t<=399)return hae(this.#i,this.#e,a),r();let n=a["cache-control"],c=a["last-modified"]&&fn(G4,t);if(!n&&!a.expires&&!c&&!this.#a)return t===304&&a.vary&&H4(a.vary)&&Om(this.#i,this.#e),r();let m=n?sae(n):{};if(!bae(this.#o,t,a,m,this.#e.headers))return t===304&&(n||fae(this.#o,a,m))&&Om(this.#i,this.#e),r();let l=Date.now(),u=Object.hasOwn(a,"age")?kae(a.age):void 0;if(u!==void 0&&u>=Um)return rg(t,this.#i,this.#e),r();let d=Object.hasOwn(a,"date")?yae(a.date):void 0;if(d===null)return rg(t,this.#i,this.#e),r();let g=d?Math.max(0,l-d.getTime()):0,p=Math.max(g,u??0),b=Aae(this.#o,l,u,a,d,m)??this.#a;if(b===void 0||p>=b)return(n||b!==void 0)&&rg(t,this.#i,this.#e),r();let A=l-p,k=b+A;if(l>=k)return rg(t,this.#i,this.#e),r();let x;if(this.#e.headers&&a.vary&&(x=nae(a.vary,this.#e.headers),!x))return r();let v=A,j=wae(A,l,m,k),I=vae(a,m),T={statusCode:t,statusMessage:i,headers:I,vary:x,cacheControlDirectives:m,cachedAt:v,staleAt:k,deleteAt:j};if(t===304){let D=S=>{if(!S)return r();if(T.statusCode=S.statusCode,T.statusMessage=S.statusMessage,T.etag=S.etag,T.vary=x??S.vary,T.headers={...S.headers,...I},r(),this.#t=this.#i.createWriteStream(this.#e,T),!(!this.#t||!S?.body))if(typeof S.body.values=="function"){let oe=S.body.values(),te=()=>{for(let ye of oe){let po=this.#t.write(ye)===!1;if(this.#r.onResponseData?.(e,ye),po)break}};this.#t.on("error",function(){s.#t=void 0,s.#i.delete(s.#e)}).on("drain",()=>{te()}).on("close",function(){s.#t===this&&(s.#t=void 0)}),te()}else typeof S.body.on=="function"&&(S.body.on("data",oe=>{this.#t.write(oe),this.#r.onResponseData?.(e,oe)}).on("end",()=>{this.#t.end()}).on("error",()=>{this.#t=void 0,this.#i.delete(this.#e)}),this.#t.on("error",function(){s.#t=void 0,s.#i.delete(s.#e)}).on("close",function(){s.#t===this&&(s.#t=void 0)}))},O=this.#i.get(this.#e);O&&typeof O.then=="function"?O.then(D):D(O)}else{if(typeof a.etag=="string"&&mae(a.etag)&&(T.etag=a.etag),this.#t=this.#i.createWriteStream(this.#e,T),!this.#t)return r();this.#t.on("drain",()=>e.resume()).on("error",function(){s.#t=void 0,s.#i.delete(s.#e)}).on("close",function(){s.#t===this&&(s.#t=void 0),e.resume()}),r()}}onResponseData(e,t){this.#t?.write(t)===!1&&e.pause(),this.#r.onResponseData?.(e,t)}onResponseEnd(e,t){this.#t?.end(),this.#r.onResponseEnd?.(e,t)}onResponseError(e,t){this.#t?.destroy(t),this.#t=void 0,this.#r.onResponseError?.(e,t)}};function Om(o,e){try{o.delete(e)?.catch?.(lae)}catch{}}function rg(o,e,t){o===304&&Om(e,t)}function fae(o,e,t){return t["no-store"]===!0||o==="shared"&&t.private===!0||(e.vary?H4(e.vary):!1)}function bae(o,e,t,a,i){return!(e<200||fn(uae,e)||!fn(G4,e)&&!t.expires&&!a.public&&a["max-age"]===void 0&&!(a.private&&o==="private")&&!(a["s-maxage"]!==void 0&&o==="shared")||a["no-store"]||o==="shared"&&a.private===!0||t.vary&&cae(t.vary)||i!=null&&Object.hasOwn(i,"authorization")&&(!a.public&&!a["s-maxage"]&&!a["must-revalidate"]||typeof i.authorization!="string"||Array.isArray(a["no-cache"])&&fn(a["no-cache"],"authorization")||Array.isArray(a.private)&&fn(a.private,"authorization")))}function yae(o){let e=o;if(Array.isArray(e)){if(e.length!==1)return null;e=e[0]}return typeof e!="string"?null:nw(e)}function kae(o){let e=o;if(Array.isArray(e)){if(e.length!==1)return Um;e=e[0]}if(typeof e!="string"||!/^[\t ]*[0-9]+[\t ]*$/.test(e))return Um;let t=BigInt(e.replace(/^[\t ]+|[\t ]+$/g,""));return t>=BigInt(Um/1e3)?Um:Number(t)*1e3}function Aae(o,e,t,a,i,r){if(o==="shared"){if(F4(r,"s-maxage"))return 0;let n=r["s-maxage"];if(n!==void 0)return n*1e3}if(F4(r,"max-age"))return 0;let s=r["max-age"];if(s!==void 0)return s*1e3;if(Object.hasOwn(a,"expires")){if(typeof a.expires!="string")return 0;let n=nw(a.expires);if(!n||e>=n.getTime())return 0;if(i){if(i>=n)return 0;let c=n.getTime()-i.getTime();return t!==void 0&&t>=c?0:c}return n.getTime()-e}if(typeof a["last-modified"]=="string"){let n=nw(a["last-modified"]);if(n)return n.getTime()>=e?void 0:(e-n.getTime())*.1}if(r.immutable)return 31536e6}function wae(o,e,t,a){let i=-1/0,r=-1/0,s=-1/0;if(t["stale-while-revalidate"]&&(i=a+t["stale-while-revalidate"]*1e3),t["stale-if-error"]&&(r=a+t["stale-if-error"]*1e3),t.immutable&&i===-1/0&&r===-1/0&&(s=e+31536e6),i===-1/0&&r===-1/0&&s===-1/0){let n=a-o,c=Math.min(Math.max(e-o,0),1e3);return a+n+c}return Math.max(a,i,r,s)}function vae(o,e){let t=["connection","proxy-authenticate","proxy-authentication-info","proxy-authorization","proxy-connection","te","transfer-encoding","upgrade","age"];o.connection&&gae(t,o.connection),Array.isArray(e["no-cache"])&&t.push(...e["no-cache"]),Array.isArray(e.private)&&t.push(...e.private);let a;for(let i of t)Object.hasOwn(o,i)&&(a??={...o},delete a[i]);return a??o}V4.exports=cw});var lw=y((Rpe,K4)=>{"use strict";var{Writable:xae}=require("stream"),{EventEmitter:zae}=require("events"),{assertCacheKey:W4,assertCacheValue:qae}=hn(),mw=class extends zae{#e=1024;#o=104857600;#a=5242880;#i=0;#r=0;#t=new Map;#c=!1;constructor(e){if(super(),e){if(typeof e!="object")throw new TypeError("MemoryCacheStore options must be an object");if(e.maxCount!==void 0){if(typeof e.maxCount!="number"||!Number.isInteger(e.maxCount)||e.maxCount<0)throw new TypeError("MemoryCacheStore options.maxCount must be a non-negative integer");this.#e=e.maxCount}if(e.maxSize!==void 0){if(typeof e.maxSize!="number"||!Number.isInteger(e.maxSize)||e.maxSize<0)throw new TypeError("MemoryCacheStore options.maxSize must be a non-negative integer");this.#o=e.maxSize}if(e.maxEntrySize!==void 0){if(typeof e.maxEntrySize!="number"||!Number.isInteger(e.maxEntrySize)||e.maxEntrySize<0)throw new TypeError("MemoryCacheStore options.maxEntrySize must be a non-negative integer");this.#a=e.maxEntrySize}}}get size(){return this.#i}isFull(){return this.#i>=this.#o||this.#r>=this.#e}get(e){W4(e);let t=`${e.origin}:${e.path}`,a=Date.now(),i=this.#t.get(t),r=i?J4(e,i,a):null;return r==null?void 0:{statusMessage:r.statusMessage,statusCode:r.statusCode,headers:r.headers,body:r.body,vary:r.vary?r.vary:void 0,etag:r.etag,cacheControlDirectives:r.cacheControlDirectives,cachedAt:r.cachedAt,staleAt:r.staleAt,deleteAt:r.deleteAt}}createWriteStream(e,t){W4(e),qae(t);let a=`${e.origin}:${e.path}`,i=this,r={...e,...t,body:[],size:0};return new xae({write(s,n,c){typeof s=="string"&&(s=Buffer.from(s,n)),r.size+=s.byteLength,r.size>=i.#a?this.destroy():r.body.push(s),c(null)},final(s){let n=i.#t.get(a);n||(n=[],i.#t.set(a,n));let c=J4(e,n,Date.now());if(c){let m=n.indexOf(c);n.splice(m,1,r),i.#i-=c.size}else n.push(r),i.#r+=1;if(i.#i+=r.size,i.#i>i.#o||i.#r>i.#e){i.#c||(i.emit("maxSizeExceeded",{size:i.#i,maxSize:i.#o,count:i.#r,maxCount:i.#e}),i.#c=!0);for(let[m,l]of i.#t){for(let u of l.splice(0,l.length/2))i.#i-=u.size,i.#r-=1;l.length===0&&i.#t.delete(m)}i.#i<i.#o&&i.#r<i.#e&&(i.#c=!1)}s(null)}})}delete(e){if(typeof e!="object")throw new TypeError(`expected key to be object, got ${typeof e}`);let t=`${e.origin}:${e.path}`;for(let a of this.#t.get(t)??[])this.#i-=a.size,this.#r-=1;this.#t.delete(t)}};function J4(o,e,t){for(let a=0;a<e.length;a++){let i=e[a];if(i.deleteAt>t&&i.method===o.method&&Eae(o,i))return i}}function Eae(o,e){if(e.vary==null)return!0;for(let t in e.vary)if(Object.hasOwn(e.vary,t)&&!Iae(o.headers?.[t],e.vary[t]))return!1;return!0}function Iae(o,e){if(o==null&&e==null)return!0;if(o==null&&e!=null||o!=null&&e==null)return!1;if(Array.isArray(o)&&Array.isArray(e)){if(o.length!==e.length)return!1;for(let t=0;t<o.length;t++)if(o[t]!==e[t])return!1;return!0}return o===e}K4.exports=mw});var X4=y((Npe,Z4)=>{"use strict";var Cae=require("assert"),uw=class{#e=!1;#o;#a;#i;#r;constructor(e,t,a){if(typeof e!="function")throw new TypeError("callback must be a function");this.#o=e,this.#a=t,this.#r=a}onRequestStart(e,t){this.#e=!1,this.#i=t}onRequestUpgrade(e,t,a,i){this.#a.onRequestUpgrade?.(e,t,a,i)}onResponseStart(e,t,a,i){if(Cae(this.#o!=null),this.#e=t===304||this.#r&&t>=500&&t<=504,this.#o(this.#e,this.#i,t,a),this.#o=null,this.#e)return!0;this.#a.onRequestStart?.(e,this.#i),this.#a.onResponseStart?.(e,t,a,i)}onResponseData(e,t){if(!this.#e)return this.#a.onResponseData?.(e,t)}onResponseEnd(e,t){this.#e||this.#a.onResponseEnd?.(e,t)}onResponseError(e,t){if(!this.#e)if(this.#o&&(this.#o(!1),this.#o=null),typeof this.#a.onResponseError=="function")this.#a.onResponseError(e,t);else throw t}};Z4.exports=uw});var n3=y((Upe,s3)=>{"use strict";var e3=require("assert"),{Readable:jae}=require("stream"),Ui=K(),bn=$4(),Bae=lw(),Qae=X4(),{assertCacheStore:Sae,assertCacheMethods:Dae,makeCacheKey:Tae,normalizeHeaders:Rae,parseCacheControlHeader:r3,isInvalidOrWildcardVaryHeader:Nae}=hn(),{AbortError:Uae}=$(),{parseHttpDate:Oae}=rw();function Mae(o,e){if(o!==void 0){if(!Array.isArray(o))throw new TypeError(`expected ${e} to be an array or undefined, got ${typeof o}`);for(let t=0;t<o.length;t++){let a=o[t];if(typeof a!="string"&&!(a instanceof RegExp))throw new TypeError(`expected ${e}[${t}] to be a string or RegExp, got ${typeof a}`)}}}var Mm=()=>{};function _ae(o){return o.replace(/^[\t ]+|[\t ]+$/g,"")}function o3(o,e){for(let t=0;t<o.length;t++)if(o[t]===e)return!0;return!1}function Lae(o){let e=o?.pragma;if(!e)return!1;let t=Array.isArray(e)?e:[e];for(let a=0;a<t.length;a++){let i=t[a];if(typeof i!="string")continue;let r=i.split(",");for(let s=0;s<r.length;s++)if(_ae(r[s]).toLowerCase()==="no-cache")return!0}return!1}function Fae(o,e,{headers:t={}}){return!!(e?.["no-cache"]||o.cacheControlDirectives?.["no-cache"]&&!Array.isArray(o.cacheControlDirectives["no-cache"])||t["if-modified-since"]||t["if-none-match"])}function gw(o,e){return o.cacheControlDirectives?.["must-revalidate"]===!0||e==="shared"&&(o.cacheControlDirectives?.["proxy-revalidate"]===!0||o.cacheControlDirectives?.["s-maxage"]!==void 0)}function Pae(o,e){if(e.vary&&Nae(e.vary))return!0;let t=e["cache-control"];if(!t)return!1;let a=r3(t);return a["no-store"]===!0||o==="shared"&&a.private===!0}function Hae(o){return o["cache-control"]!==void 0}function t3(o,e){try{o.delete(e)?.catch?.(Mm)}catch{}}function Gae(o){let e=o?.["last-modified"];if(typeof e=="string"&&Oae(e))return e}function a3(o,e){let t={...o.headers,"if-modified-since":Gae(e.headers)??new Date(e.cachedAt).toUTCString()};if(e.etag&&(t["if-none-match"]=e.etag),e.vary)for(let a in e.vary)e.vary[a]!=null&&(t[a]=e.vary[a]);return t}function Yae(o,e,t){let a=Date.now();if(a>o.staleAt){if(!gw(o,t)&&e?.["max-stale"]){let i=o.staleAt+e["max-stale"]*1e3;return a>i}return!0}if(e?.["min-fresh"]){let i=o.staleAt-a,r=e["min-fresh"]*1e3;return i<=r}return!1}function Vae(o,e){let t=o.cacheControlDirectives?.["stale-while-revalidate"];if(!t||gw(o,e))return!1;let a=Date.now(),i=o.staleAt+t*1e3;return a<=i}function $ae(o,e,t,a,i,r){if(r?.["only-if-cached"]){let s=!1;try{if(typeof a.onConnect=="function"&&(a.onConnect(()=>{s=!0}),s)||typeof a.onHeaders=="function"&&(a.onHeaders(504,[],Mm,"Gateway Timeout"),s))return;typeof a.onComplete=="function"&&a.onComplete([])}catch(n){typeof a.onError=="function"&&a.onError(n)}return!0}return o(i,new bn(e,t,a))}function dw(o,e,t,a,i,r){let s=Ui.isStream(t.body)?t.body:jae.from(t.body??[]);e3(!s.destroyed,"stream should not be destroyed"),e3(!s.readableDidRead,"stream should not be readableDidRead");let n={resume(){s.resume()},pause(){s.pause()},get paused(){return s.isPaused()},get aborted(){return s.destroyed},get reason(){return s.errored},abort(m){s.destroy(m??new Uae)}};if(s.on("error",function(m){if(!this.readableEnded)if(typeof o.onResponseError=="function")o.onResponseError(n,m);else throw m}).on("close",function(){this.errored||o.onResponseEnd?.(n,{})}),o.onRequestStart?.(n,i),s.destroyed)return;let c={...t.headers,age:String(a)};r&&(c.warning='110 - "response is stale"'),o.onResponseStart?.(n,t.statusCode,c,t.statusMessage),e.method==="HEAD"?s.destroy():s.on("data",function(m){o.onResponseData?.(n,m)})}function i3(o,e,t,a,i,r,s){if(!s)return $ae(o,e,t,a,i,r);let n=Date.now();if(n>s.deleteAt)return o(i,new bn(e,t,a));let c=Math.round((n-s.cachedAt)/1e3),m=r?.["max-age"]!==void 0&&c>=r["max-age"],l=m||Yae(s,r,e.type),u=m||Fae(s,r,i);if(l||u){if(Ui.isStream(i.body)&&Ui.bodyLength(i.body)!==0)return o(i,new bn(e,t,a));if(!u&&Vae(s,e.type))return dw(a,i,s,c,null,!0),queueMicrotask(()=>{let p=a3(i,s);o({...i,headers:p},new bn(e,t,{onRequestStart(){},onRequestUpgrade(){},onResponseStart(){},onResponseData(){},onResponseEnd(){},onResponseError(){}}))}),!0;let d=!1;if(!gw(s,e.type)){let p=s.cacheControlDirectives["stale-if-error"]??r?.["stale-if-error"];p&&(d=n<s.staleAt+p*1e3)}let g=a3(i,s);return o({...i,headers:g},new Qae((p,b,A,k)=>{if(p){if(A===304){if(Pae(e.type,k))return Ui.isStream(s.body)&&s.body.on("error",Mm).destroy(),t3(e.store,t),o(i,new bn(e,t,a));Hae(k)&&t3(e.store,t)}dw(a,i,s,c,b,l)}else Ui.isStream(s.body)&&s.body.on("error",Mm).destroy()},new bn(e,t,a),d))}Ui.isStream(i.body)&&i.body.on("error",Mm).destroy(),dw(a,i,s,c,null,!1)}s3.exports=(o={})=>{let{store:e=new Bae,methods:t=["GET"],cacheByDefault:a=void 0,type:i="shared",origins:r=void 0}=o;if(typeof o!="object"||o===null)throw new TypeError(`expected type of opts to be an Object, got ${o===null?"null":typeof o}`);if(Sae(e,"opts.store"),Dae(t,"opts.methods"),Mae(r,"opts.origins"),typeof a<"u"&&typeof a!="number")throw new TypeError(`expected opts.cacheByDefault to be number or undefined, got ${typeof a}`);if(typeof i<"u"&&i!=="shared"&&i!=="private")throw new TypeError(`expected opts.type to be shared, private, or undefined, got ${typeof i}`);let s={store:e,methods:t,cacheByDefault:a,type:i},n=[];for(let c=0;c<Ui.safeHTTPMethods.length;c++){let m=Ui.safeHTTPMethods[c];o3(t,m)||n.push(m)}return c=>(m,l)=>{if(!m.origin||o3(n,m.method))return c(m,l);if(r!==void 0){let p=m.origin.toString().toLowerCase(),b=!1;for(let A=0;A<r.length;A++){let k=r[A];if(typeof k=="string"){if(k.toLowerCase()===p){b=!0;break}}else if(k.test(p)){b=!0;break}}if(!b)return c(m,l)}m={...m,headers:Rae(m)};let u=m.headers?.["cache-control"]?r3(m.headers["cache-control"]):Lae(m.headers)?{"no-cache":!0}:void 0;if(u?.["no-store"])return c(m,l);let d=Tae(m),g=e.get(d);return g&&typeof g.then=="function"?g.then(p=>i3(c,s,d,l,m,u,p)):i3(c,s,d,l,m,u,g)}}});var d3=y((Ope,u3)=>{"use strict";var{createInflate:pw,createGunzip:c3,createBrotliDecompress:Wae,createZstdDecompress:Jae}=require("zlib"),{pipeline:Kae}=require("stream"),Zae=pn(),{runtimeFeatures:Xae}=Ta(),m3={gzip:c3,"x-gzip":c3,br:Wae,deflate:pw,compress:pw,"x-compress":pw,...Xae.has("zstd")?{zstd:Jae}:{}},eie=[204,304],l3=!1,hw=class extends Zae{#e=[];#o;#a;constructor(e,{skipStatusCodes:t=eie,skipErrorResponses:a=!0}={}){super(e),this.#o=t,this.#a=a}#i(e,t){return!!(!e||t<200||this.#o.includes(t)||this.#a&&t>=400)}#r(e){let t=e.split(","),a=5;if(t.length>a)throw new Error(`too many content-encodings in response: ${t.length}, maximum allowed is ${a}`);let i=[];for(let r=t.length-1;r>=0;r--){let s=t[r].trim();if(s){if(!m3[s])return i.length=0,i;i.push(m3[s]())}}return i}#t(e,t){e.on("readable",()=>{let a;for(;(a=e.read())!==null&&super.onResponseData(t,a)!==!1;);}),e.on("error",a=>{super.onResponseError(t,a)})}#c(e){let t=this.#e[0];this.#t(t,e),t.on("end",()=>{super.onResponseEnd(e,{})})}#s(e){let t=this.#e[this.#e.length-1];this.#t(t,e),Kae(this.#e,a=>{if(a){super.onResponseError(e,a);return}super.onResponseEnd(e,{})})}#n(){this.#e.length=0}onResponseStart(e,t,a,i){let r=a["content-encoding"];if(this.#i(r,t))return super.onResponseStart(e,t,a,i);let s=this.#r(r.toLowerCase());if(s.length===0)return this.#n(),super.onResponseStart(e,t,a,i);this.#e=s;let{"content-encoding":n,"content-length":c,...m}=a;return this.#e.length===1?this.#c(e):this.#s(e),super.onResponseStart(e,t,m,i)}onResponseData(e,t){if(this.#e.length>0){this.#e[0].write(t);return}super.onResponseData(e,t)}onResponseEnd(e,t){if(this.#e.length>0){this.#e[0].end(),this.#n();return}super.onResponseEnd(e,t)}onResponseError(e,t){if(this.#e.length>0){for(let a of this.#e)a.destroy(t);this.#n()}super.onResponseError(e,t)}};function oie(o={}){return l3||(process.emitWarning("DecompressInterceptor is experimental and subject to change","ExperimentalWarning"),l3=!0),e=>(t,a)=>{let i=new hw(a,o);return e(t,i)}}u3.exports=oie});var h3=y((Mpe,p3)=>{"use strict";var{RequestAbortedError:tie}=$(),g3=5*1024*1024,fw=class{#e;#o=[];#a=g3;#i=0;#r={};#t="";#c=!1;#s=!1;#n=!1;#m=!1;#u=null;#l=null;constructor(e,t,a=g3){this.#e=e,this.#l=t,this.#a=a}addWaitingHandler(e){if(this.#m||this.#n)return!1;let t=this.#d(e),a=t.controller;try{if(e.onRequestStart?.(a,null),a.aborted)return t.done=!0,!0;this.#s&&e.onResponseStart?.(a,this.#i,this.#r,this.#t)}catch{return t.done=!0,!0}return a.aborted||this.#o.push(t),!0}onRequestStart(e,t){this.#u=e,this.#e.onRequestStart?.(e,t)}onRequestUpgrade(e,t,a,i){this.#e.onRequestUpgrade?.(e,t,a,i)}onResponseStart(e,t,a,i){this.#s=!0,this.#i=t,this.#r=a,this.#t=i,this.#e.onResponseStart?.(e,t,a,i);for(let r of this.#o){let{handler:s,controller:n}=r;if(r.done||n.aborted){r.done=!0;continue}try{s.onResponseStart?.(n,t,a,i)}catch{}n.aborted&&(r.done=!0)}this.#h()}onResponseData(e,t){if(!(this.#c||this.#m)){this.#n=!0,this.#e.onResponseData?.(e,t);for(let a of this.#o){let{handler:i,controller:r}=a;if(a.done||r.aborted){a.done=!0;continue}if(r.paused){this.#p(a,t);continue}try{i.onResponseData?.(r,t)}catch{}r.aborted&&(a.done=!0,a.bufferedChunks=[],a.bufferedBytes=0)}this.#h()}}onResponseEnd(e,t){if(!(this.#c||this.#m)){this.#m=!0,this.#e.onResponseEnd?.(e,t);for(let a of this.#o){if(a.done||a.controller.aborted){a.done=!0;continue}if(this.#g(a),a.done||a.controller.aborted){a.done=!0;continue}if(a.controller.paused&&a.bufferedChunks.length>0){a.pendingTrailers=t;continue}try{a.handler.onResponseEnd?.(a.controller,t)}catch{}a.done=!0}this.#h(),this.#l?.()}}onResponseError(e,t){if(!this.#m){this.#c=!0,this.#m=!0,this.#e.onResponseError?.(e,t);for(let a of this.#o)this.#b(a,t);this.#o=[],this.#l?.()}}#d(e){let t={handler:e,controller:null,bufferedChunks:[],bufferedBytes:0,pendingTrailers:null,done:!1},a={aborted:!1,paused:!1,reason:null};return t.controller={resume:()=>{if(!a.aborted){if(a.paused=!1,this.#g(t),this.#m&&t.pendingTrailers&&t.bufferedChunks.length===0&&!a.paused&&!a.aborted){try{t.handler.onResponseEnd?.(t.controller,t.pendingTrailers)}catch{}t.pendingTrailers=null,t.done=!0}this.#h()}},pause:()=>{a.aborted||(a.paused=!0)},get paused(){return a.paused},get aborted(){return a.aborted},get reason(){return a.reason},abort:i=>{a.aborted=!0,a.reason=i??null,t.done=!0,t.pendingTrailers=null,t.bufferedChunks=[],t.bufferedBytes=0}},t}#p(e,t){if(e.done||e.controller.aborted){e.done=!0,e.bufferedChunks=[],e.bufferedBytes=0;return}let a=Buffer.from(t);if(e.bufferedChunks.push(a),e.bufferedBytes+=a.length,e.bufferedBytes>this.#a){let i=new tie(`Deduplicated waiting handler exceeded maxBufferSize (${this.#a} bytes) while paused`);this.#b(e,i)}}#g(e){let{handler:t,controller:a}=e;for(;!e.done&&!a.aborted&&!a.paused&&e.bufferedChunks.length>0;){let i=e.bufferedChunks.shift();e.bufferedBytes-=i.length;try{t.onResponseData?.(a,i)}catch{}if(a.aborted){e.done=!0,e.pendingTrailers=null,e.bufferedChunks=[],e.bufferedBytes=0;break}}}#b(e,t){if(!e.done){e.done=!0,e.pendingTrailers=null,e.bufferedChunks=[],e.bufferedBytes=0;try{e.controller.abort(t),e.handler.onResponseError?.(e.controller,t)}catch{}}}#h(){this.#o=this.#o.filter(e=>e.done===!1)}};p3.exports=fw});var b3=y((_pe,f3)=>{"use strict";var aie=require("diagnostics_channel"),iie=K(),rie=h3(),{normalizeHeaders:sie,makeCacheKey:nie,makeDeduplicationKey:cie}=hn(),sg=aie.channel("undici:request:pending-requests");f3.exports=(o={})=>{let{methods:e=["GET"],skipHeaderNames:t=[],excludeHeaderNames:a=[],maxBufferSize:i=5*1024*1024}=o;if(typeof o!="object"||o===null)throw new TypeError(`expected type of opts to be an Object, got ${o===null?"null":typeof o}`);if(!Array.isArray(e))throw new TypeError(`expected opts.methods to be an array, got ${typeof e}`);for(let c of e)if(!iie.safeHTTPMethods.includes(c))throw new TypeError(`expected opts.methods to only contain safe HTTP methods, got ${c}`);if(!Array.isArray(t))throw new TypeError(`expected opts.skipHeaderNames to be an array, got ${typeof t}`);if(!Array.isArray(a))throw new TypeError(`expected opts.excludeHeaderNames to be an array, got ${typeof a}`);if(!Number.isFinite(i)||i<=0)throw new TypeError(`expected opts.maxBufferSize to be a positive finite number, got ${i}`);let r=new Set(t.map(c=>c.toLowerCase())),s=new Set(a.map(c=>c.toLowerCase())),n=new Map;return c=>(m,l)=>{if(!m.origin||e.includes(m.method)===!1)return c(m,l);if(m={...m,headers:sie(m)},r.size>0){for(let b of Object.keys(m.headers))if(r.has(b.toLowerCase()))return c(m,l)}let u=nie(m),d=cie(u,s),g=n.get(d);if(g)return g.addWaitingHandler(l)?!0:c(m,l);let p=new rie(l,()=>{n.delete(d),sg.hasSubscribers&&sg.publish({size:n.size,key:d,type:"removed"})},i);return n.set(d,p),sg.hasSubscribers&&sg.publish({size:n.size,key:d,type:"added"}),c(m,p)}}});var A3=y((Fpe,k3)=>{"use strict";var{Writable:mie}=require("stream"),{assertCacheKey:bw,assertCacheValue:lie}=hn(),yw,Zo=3,y3=2*1e3*1e3*1e3;k3.exports=class{#e=y3;#o=1/0;#a;#i;#r;#t;#c;#s;#n;#m;constructor(e){if(e){if(typeof e!="object")throw new TypeError("SqliteCacheStore options must be an object");if(e.maxEntrySize!==void 0){if(typeof e.maxEntrySize!="number"||!Number.isInteger(e.maxEntrySize)||e.maxEntrySize<0)throw new TypeError("SqliteCacheStore options.maxEntrySize must be a non-negative integer");if(e.maxEntrySize>y3)throw new TypeError("SqliteCacheStore options.maxEntrySize must be less than 2gb");this.#e=e.maxEntrySize}if(e.maxCount!==void 0){if(typeof e.maxCount!="number"||!Number.isInteger(e.maxCount)||e.maxCount<0)throw new TypeError("SqliteCacheStore options.maxCount must be a non-negative integer");this.#o=e.maxCount}}yw||(yw=require("sqlite").DatabaseSync),this.#a=new yw(e?.location??":memory:"),this.#a.exec(`
|
|
1331
|
+
${e.format(t)}`.trim())}};Y4.exports=_A});var FA=y((Ape,J4)=>{"use strict";var{InvalidArgumentError:Voe}=$(),{runtimeFeatures:$oe}=Ta();function Woe(o={}){let{ignoreHeaders:e=[],excludeHeaders:t=[],matchHeaders:a=[],caseSensitive:i=!1}=o;return{ignore:new Set(e.map(r=>i?r:r.toLowerCase())),exclude:new Set(t.map(r=>i?r:r.toLowerCase())),match:new Set(a.map(r=>i?r:r.toLowerCase()))}}var V4=$oe.has("crypto")?require("crypto"):null,Joe=V4?.hash?o=>V4.hash("sha256",o,"base64url"):o=>Buffer.from(o).toString("base64url");function W4(o){return Array.isArray(o)&&(o.length&1)===0}function Koe(o=[]){return o.length===0?()=>!1:function(t){let a;for(let i of o)if(typeof i=="string"){if(a||(a=t.toLowerCase()),a.includes(i.toLowerCase()))return!0}else if(i instanceof RegExp&&i.test(t))return!0;return!1}}function Zoe(o){let e={};if(!o)return e;if(W4(o)){for(let t=0;t<o.length;t+=2){let a=o[t],i=o[t+1];if(a&&i!==void 0){let r=Buffer.isBuffer(a)?a.toString():a,s=Buffer.isBuffer(i)?i.toString():i;e[r.toLowerCase()]=s}}return e}if(o&&typeof o=="object")for(let[t,a]of Object.entries(o))t&&typeof t=="string"&&(e[t.toLowerCase()]=Array.isArray(a)?a.join(", "):String(a));return e}var $4=["record","playback","update"];function Xoe(o){if(!$4.includes(o))throw new Voe(`Invalid snapshot mode: ${o}. Must be one of: ${$4.join(", ")}`)}J4.exports={createHeaderFilters:Woe,hashId:Joe,isUndiciHeaders:W4,normalizeHeaders:Zoe,isUrlExcludedFactory:Koe,validateSnapshotMode:Xoe}});var rQ=y((wpe,iQ)=>{"use strict";var{writeFile:ete,readFile:ote,mkdir:tte}=require("fs/promises"),{dirname:ate,resolve:K4}=require("path"),{setTimeout:ite,clearTimeout:Z4}=require("timers"),{InvalidArgumentError:X4,UndiciError:rte}=$(),{hashId:ste,isUrlExcludedFactory:nte,normalizeHeaders:eQ,createHeaderFilters:oQ}=FA();function Sm(o,e,t={}){let a=new URL(o.path,o.origin),i=o._normalizedHeaders||eQ(o.headers);return o._normalizedHeaders||(o._normalizedHeaders=i),{method:o.method||"GET",url:t.matchQuery!==!1?a.toString():`${a.origin}${a.pathname}`,headers:tQ(i,e,t),body:t.matchBody!==!1&&o.body?String(o.body):""}}function tQ(o,e,t={}){if(!o||typeof o!="object")return{};let{caseSensitive:a=!1}=t,i={},{ignore:r,exclude:s,match:n}=e;for(let[c,m]of Object.entries(o)){let l=a?c:c.toLowerCase();s.has(l)||r.has(l)||n.size!==0&&!n.has(l)||(i[l]=m)}return i}function aQ(o,e,t={}){if(!o||typeof o!="object")return{};let{caseSensitive:a=!1}=t,i={},{exclude:r}=e;for(let[s,n]of Object.entries(o)){let c=a?s:s.toLowerCase();r.has(c)||(i[c]=n)}return i}function Dm(o){let e=[o.method,o.url];if(o.headers&&typeof o.headers=="object"){let a=Object.keys(o.headers).sort();for(let i of a){let r=Array.isArray(o.headers[i])?o.headers[i]:[o.headers[i]];e.push(i);for(let s of r.sort())e.push(String(s))}}e.push(o.body);let t=e.join("|");return ste(t)}var PA=class{#e;#o;#a=new Map;#i;#r=1/0;#t=!1;#c;constructor(e={}){this.#i=e.snapshotPath,this.#r=e.maxSnapshots||1/0,this.#t=e.autoFlush||!1,this.flushInterval=e.flushInterval||3e4,this._flushTimer=null,this.matchOptions={matchHeaders:e.matchHeaders||[],ignoreHeaders:e.ignoreHeaders||[],excludeHeaders:e.excludeHeaders||[],matchBody:e.matchBody!==!1,matchQuery:e.matchQuery!==!1,caseSensitive:e.caseSensitive||!1},this.#c=oQ(this.matchOptions),this.shouldRecord=e.shouldRecord||(()=>!0),this.shouldPlayback=e.shouldPlayback||(()=>!0),this.#o=nte(e.excludeUrls),this.#t&&this.#i&&this.#s()}async record(e,t){if(!this.shouldRecord(e)||this.isUrlExcluded(e))return;let a=Sm(e,this.#c,this.matchOptions),i=Dm(a),r=eQ(t.headers),s={statusCode:t.statusCode,headers:aQ(r,this.#c,this.matchOptions),body:Buffer.isBuffer(t.body)?t.body.toString("base64"):Buffer.from(String(t.body||"")).toString("base64"),trailers:t.trailers};if(this.#a.size>=this.#r&&!this.#a.has(i)){let c=this.#a.keys().next().value;this.#a.delete(c)}let n=this.#a.get(i);n&&n.responses?(n.responses.push(s),n.timestamp=new Date().toISOString()):this.#a.set(i,{request:a,responses:[s],callCount:0,timestamp:new Date().toISOString()}),this.#t&&this.#i&&this.#m()}isUrlExcluded(e){let t=new URL(e.path,e.origin).toString();return this.#o(t)}findSnapshot(e){if(!this.shouldPlayback(e)||this.isUrlExcluded(e))return;let t=Sm(e,this.#c,this.matchOptions),a=Dm(t),i=this.#a.get(a);if(!i)return;let r=i.callCount||0,s=Math.min(r,i.responses.length-1);return i.callCount=r+1,{...i,response:i.responses[s]}}async loadSnapshots(e){let t=e||this.#i;if(!t)throw new X4("Snapshot path is required");try{let a=await ote(K4(t),"utf8"),i=JSON.parse(a);if(Array.isArray(i)){this.#a.clear();for(let{hash:r,snapshot:s}of i)this.#a.set(r,s)}else this.#a=new Map(Object.entries(i))}catch(a){if(a.code==="ENOENT")this.#a.clear();else throw new rte(`Failed to load snapshots from ${t}`,{cause:a})}}async saveSnapshots(e){let t=e||this.#i;if(!t)throw new X4("Snapshot path is required");let a=K4(t);await tte(ate(a),{recursive:!0});let i=Array.from(this.#a.entries()).map(([r,s])=>({hash:r,snapshot:s}));await ete(a,JSON.stringify(i,null,2),{flush:!0})}clear(){this.#a.clear()}getSnapshots(){return Array.from(this.#a.values())}size(){return this.#a.size}resetCallCounts(){for(let e of this.#a.values())e.callCount=0}deleteSnapshot(e){let t=Sm(e,this.#c,this.matchOptions),a=Dm(t);return this.#a.delete(a)}getSnapshotInfo(e){let t=Sm(e,this.#c,this.matchOptions),a=Dm(t),i=this.#a.get(a);return i?{hash:a,request:i.request,responseCount:i.responses?i.responses.length:i.response?1:0,callCount:i.callCount||0,timestamp:i.timestamp}:null}replaceSnapshots(e){if(this.#a.clear(),Array.isArray(e))for(let{hash:t,snapshot:a}of e)this.#a.set(t,a);else e&&typeof e=="object"&&(this.#a=new Map(Object.entries(e)))}#s(){return this.#m()}#n(){this.#e&&(Z4(this.#e),this.saveSnapshots().catch(()=>{}),this.#e=null)}#m(){this.#e=ite(()=>{this.saveSnapshots().catch(()=>{}),this.#t?this.#e?.refresh():this.#e=null},1e3)}destroy(){this.#n(),this.#e&&(Z4(this.#e),this.#e=null)}async close(){this.#i&&this.#a.size!==0&&await this.saveSnapshots(),this.destroy()}};iQ.exports={SnapshotRecorder:PA,formatRequestKey:Sm,createRequestHash:Dm,filterHeadersForMatching:tQ,filterHeadersForStorage:aQ,createHeaderFilters:oQ}});var cQ=y((vpe,nQ)=>{"use strict";var cte=Rr(),mte=LA(),{SnapshotRecorder:lte}=rQ(),ute=Jc(),{InvalidArgumentError:dte,UndiciError:gte}=$(),{validateSnapshotMode:pte}=FA(),Bo=Symbol("kSnapshotRecorder"),la=Symbol("kSnapshotMode"),Tm=Symbol("kSnapshotPath"),HA=Symbol("kSnapshotLoaded"),tg=Symbol("kRealAgent"),sQ=!1,GA=class extends mte{constructor(e={}){sQ||(process.emitWarning("SnapshotAgent is experimental and subject to change","ExperimentalWarning"),sQ=!0);let{mode:t="record",snapshotPath:a=null,...i}=e;if(super(i),pte(t),(t==="playback"||t==="update")&&!a)throw new dte(`snapshotPath is required when mode is '${t}'`);this[la]=t,this[Tm]=a,this[Bo]=new lte({snapshotPath:this[Tm],mode:this[la],maxSnapshots:e.maxSnapshots,autoFlush:e.autoFlush,flushInterval:e.flushInterval,matchHeaders:e.matchHeaders,ignoreHeaders:e.ignoreHeaders,excludeHeaders:e.excludeHeaders,matchBody:e.matchBody,matchQuery:e.matchQuery,caseSensitive:e.caseSensitive,shouldRecord:e.shouldRecord,shouldPlayback:e.shouldPlayback,excludeUrls:e.excludeUrls}),this[HA]=!1,(this[la]==="record"||this[la]==="update"||this[la]==="playback"&&e.excludeUrls&&e.excludeUrls.length>0)&&(this[tg]=new cte(e)),(this[la]==="playback"||this[la]==="update")&&this[Tm]&&this.loadSnapshots().catch(()=>{})}dispatch(e,t){t=ute.wrap(t);let a=this[la];if(this[Bo].isUrlExcluded(e))return this[tg].dispatch(e,t);if(a==="playback"||a==="update"){if(!this[HA])return this.#e(e,t);let i=this[Bo].findSnapshot(e);if(i)return this.#a(i,t);if(a==="update")return this.#o(e,t);{let r=new gte(`No snapshot found for ${e.method||"GET"} ${e.path}`);if(t.onError){t.onError(r);return}throw r}}else if(a==="record")return this.#o(e,t)}async#e(e,t){return await this.loadSnapshots(),this.dispatch(e,t)}#o(e,t){let a={statusCode:null,headers:{},trailers:{},body:[]},i=this,r={onRequestStart(n,c){return t.onRequestStart(n,{...c,history:this.history})},onRequestUpgrade(n,c,m,l){return t.onRequestUpgrade(n,c,m,l)},onResponseStart(n,c,m,l){return a.statusCode=c,a.headers=m,t.onResponseStart(n,c,m,l)},onResponseData(n,c){return a.body.push(c),t.onResponseData(n,c)},onResponseEnd(n,c){a.trailers=c;let m=Buffer.concat(a.body);i[Bo].record(e,{statusCode:a.statusCode,headers:a.headers,body:m,trailers:a.trailers}).then(()=>t.onResponseEnd(n,c)).catch(l=>t.onResponseError(n,l))}};return this[tg].dispatch(e,r)}#a(e,t){try{let{response:a}=e,i={pause(){},resume(){},abort(s){this.aborted=!0,this.reason=s},aborted:!1,paused:!1};t.onRequestStart(i),t.onResponseStart(i,a.statusCode,a.headers);let r=Buffer.from(a.body,"base64");t.onResponseData(i,r),t.onResponseEnd(i,a.trailers)}catch(a){t.onError?.(a)}}async loadSnapshots(e){await this[Bo].loadSnapshots(e||this[Tm]),this[HA]=!0,this[la]==="playback"&&this.#i()}async saveSnapshots(e){return this[Bo].saveSnapshots(e||this[Tm])}#i(){for(let e of this[Bo].getSnapshots()){let{request:t,responses:a,response:i}=e,r=new URL(t.url),s=this.get(r.origin),n=a?a[0]:i;n&&s.intercept({path:r.pathname+r.search,method:t.method,headers:t.headers,body:t.body}).reply(n.statusCode,n.body,{headers:n.headers,trailers:n.trailers}).persist()}}getRecorder(){return this[Bo]}getMode(){return this[la]}clearSnapshots(){this[Bo].clear()}resetCallCounts(){this[Bo].resetCallCounts()}deleteSnapshot(e){return this[Bo].deleteSnapshot(e)}getSnapshotInfo(e){return this[Bo].getSnapshotInfo(e)}replaceSnapshots(e){this[Bo].replaceSnapshots(e)}async close(){await this[Bo].close(),await this[tg]?.close(),await super.close()}};nQ.exports=GA});var ag=y((xpe,dQ)=>{"use strict";var hte=Symbol.for("undici.globalDispatcher.2"),mQ=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:fte}=$(),bte=Rr();uQ()===void 0&&lQ(new bte);function lQ(o){if(!o||typeof o.dispatch!="function")throw new fte("Argument agent must implement Agent");Object.defineProperty(globalThis,hte,{value:o,writable:!0,enumerable:!1,configurable:!1}),Object.defineProperty(globalThis,mQ,{value:o,writable:!0,enumerable:!1,configurable:!1})}function uQ(){return globalThis[mQ]}var yte=["fetch","Headers","Response","Request","FormData","WebSocket","CloseEvent","ErrorEvent","MessageEvent","EventSource"];dQ.exports={setGlobalDispatcher:lQ,getGlobalDispatcher:uQ,installedExports:yte}});var pn=y((qpe,gQ)=>{"use strict";var Ha=require("assert"),kte=Jc();gQ.exports=class{#e;#o=!1;#a=!1;#i=!1;constructor(e){if(typeof e!="object"||e===null)throw new TypeError("handler must be an object");this.#e=kte.wrap(e)}onRequestStart(...e){this.#e.onRequestStart?.(...e)}onRequestUpgrade(...e){return Ha(!this.#o),Ha(!this.#a),this.#e.onRequestUpgrade?.(...e)}onResponseStart(...e){return Ha(!this.#o),Ha(!this.#a),Ha(!this.#i),this.#i=!0,this.#e.onResponseStart?.(...e)}onResponseData(...e){return Ha(!this.#o),Ha(!this.#a),this.#e.onResponseData?.(...e)}onResponseEnd(...e){return Ha(!this.#o),Ha(!this.#a),this.#o=!0,this.#e.onResponseEnd?.(...e)}onResponseError(...e){return this.#a=!0,this.#e.onResponseError?.(...e)}onBodySent(){}}});var WA=y((Epe,bQ)=>{"use strict";var Qo=K(),{kBodyUsed:Rm}=de(),$A=require("assert"),{InvalidArgumentError:YA}=$(),Ate=require("events"),wte=[300,301,302,303,307,308],pQ=Symbol("body"),hQ=()=>{},ig=class{constructor(e){this[pQ]=e,this[Rm]=!1}async*[Symbol.asyncIterator](){$A(!this[Rm],"disturbed"),this[Rm]=!0,yield*this[pQ]}},VA=class o{static buildDispatch(e,t){if(t!=null&&(!Number.isInteger(t)||t<0))throw new YA("maxRedirections must be a positive number");let a=e.dispatch.bind(e);return(i,r)=>a(i,new o(a,t,i,r))}constructor(e,t,a,i){if(t!=null&&(!Number.isInteger(t)||t<0))throw new YA("maxRedirections must be a positive number");this.dispatch=e,this.location=null;let{maxRedirections:r,...s}=a;this.opts=s,this.maxRedirections=t,this.handler=i,this.history=[],Qo.isStream(this.opts.body)?(Qo.bodyLength(this.opts.body)===0&&this.opts.body.on("data",function(){$A(!1)}),typeof this.opts.body.readableDidRead!="boolean"&&(this.opts.body[Rm]=!1,Ate.prototype.on.call(this.opts.body,"data",function(){this[Rm]=!0}))):this.opts.body&&typeof this.opts.body.pipeTo=="function"?this.opts.body=new ig(this.opts.body):this.opts.body&&typeof this.opts.body!="string"&&!ArrayBuffer.isView(this.opts.body)&&Qo.isIterable(this.opts.body)&&!Qo.isFormDataLike(this.opts.body)&&(this.opts.body=new ig(this.opts.body))}onRequestStart(e,t){this.handler.onRequestStart?.(e,{...t,history:this.history})}onRequestUpgrade(e,t,a,i){this.handler.onRequestUpgrade?.(e,t,a,i)}onResponseStart(e,t,a,i){if(this.opts.throwOnMaxRedirect&&this.history.length>=this.maxRedirections)throw new Error("max redirects");if((t===301||t===302)&&this.opts.method==="POST"&&(this.opts.method="GET",Qo.isStream(this.opts.body)&&Qo.destroy(this.opts.body.on("error",hQ)),this.opts.body=null),t===303&&this.opts.method!=="HEAD"&&(this.opts.method="GET",Qo.isStream(this.opts.body)&&Qo.destroy(this.opts.body.on("error",hQ)),this.opts.body=null),this.location=this.history.length>=this.maxRedirections||Qo.isDisturbed(this.opts.body)||wte.indexOf(t)===-1?null:a.location,this.opts.origin&&this.history.push(new URL(this.opts.path,this.opts.origin)),!this.location){this.handler.onResponseStart?.(e,t,a,i);return}let{origin:r,pathname:s,search:n}=Qo.parseURL(new URL(this.location,this.opts.origin&&new URL(this.opts.path,this.opts.origin))),c=n?`${s}${n}`:s,m=`${r}${c}`;for(let l of this.history)if(l.toString()===m)throw new YA(`Redirect loop detected. Cannot redirect to ${r}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);this.opts.headers=vte(this.opts.headers,t===303,this.opts.origin!==r),this.opts.path=c,this.opts.origin=r,this.opts.query=null}onResponseData(e,t){this.location||this.handler.onResponseData?.(e,t)}onResponseEnd(e,t){this.location?this.dispatch(this.opts,this):this.handler.onResponseEnd(e,t)}onResponseError(e,t){this.handler.onResponseError?.(e,t)}};function fQ(o,e,t){if(o.length===4)return Qo.headerNameToString(o)==="host";if(e&&Qo.headerNameToString(o).startsWith("content-"))return!0;if(t&&(o.length===13||o.length===6||o.length===19)){let a=Qo.headerNameToString(o);return a==="authorization"||a==="cookie"||a==="proxy-authorization"}return!1}function vte(o,e,t){let a=[];if(Array.isArray(o))for(let i=0;i<o.length;i+=2)fQ(o[i],e,t)||a.push(o[i],o[i+1]);else if(o&&typeof o=="object"){let i=Qo.hasSafeIterator(o)?o:Object.entries(o);for(let[r,s]of i)fQ(r,e,t)||a.push(r,s)}else $A(o==null,"headers must be an object or an array");return a}bQ.exports=VA});var kQ=y((Ipe,yQ)=>{"use strict";var xte=WA();function zte({maxRedirections:o}={}){return e=>function(a,i){let{maxRedirections:r=o,...s}=a;if(r==null||r===0)return e(a,i);let n={...s},c=new xte(e,r,n,i);return e(n,c)}}yQ.exports=zte});var wQ=y((Cpe,AQ)=>{"use strict";var qte=pn(),{ResponseError:Ete}=$(),JA=class extends qte{#e;#o;#a;#i;#r;constructor(e,{handler:t}){super(t)}#t(e){return(this.#o??"").indexOf(e)===0}onRequestStart(e,t){return this.#e=0,this.#o=null,this.#a=null,this.#i=null,this.#r="",super.onRequestStart(e,t)}onResponseStart(e,t,a,i){if(this.#e=t,this.#i=a,this.#o=a["content-type"],this.#e<400)return super.onResponseStart(e,t,a,i);(this.#t("application/json")||this.#t("text/plain"))&&(this.#a=new TextDecoder("utf-8"))}onResponseData(e,t){if(this.#e<400)return super.onResponseData(e,t);this.#r+=this.#a?.decode(t,{stream:!0})??""}onResponseEnd(e,t){if(this.#e>=400){if(this.#r+=this.#a?.decode(void 0,{stream:!1})??"",this.#t("application/json"))try{this.#r=JSON.parse(this.#r)}catch{}let a,i=Error.stackTraceLimit;Error.stackTraceLimit=0;try{a=new Ete("Response Error",this.#e,{body:this.#r,headers:this.#i})}finally{Error.stackTraceLimit=i}super.onResponseError(e,a)}else super.onResponseEnd(e,t)}onResponseError(e,t){super.onResponseError(e,t)}};AQ.exports=()=>o=>function(t,a){return o(t,new JA(t,{handler:a}))}});var xQ=y((jpe,vQ)=>{"use strict";var Ite=Fd();vQ.exports=o=>e=>function(a,i){return e(a,new Ite({...a,retryOptions:{...o,...a.retryOptions}},{handler:i,dispatch:e}))}});var qQ=y((Bpe,zQ)=>{"use strict";var{InvalidArgumentError:Cte,RequestAbortedError:jte}=$(),Bte=pn(),KA=class extends Bte{#e=1024*1024;#o=!1;#a=0;#i=null;aborted=!1;reason=!1;constructor({maxSize:e,signal:t},a){if(e!=null&&(!Number.isFinite(e)||e<1))throw new Cte("maxSize must be a number greater than 0");super(a),this.#e=e??this.#e}#r(e){this.aborted=!0,this.reason=e}onRequestStart(e,t){return e.abort=this.#r.bind(this),this.#i=e,super.onRequestStart(e,t)}onResponseStart(e,t,a,i){let r=a["content-length"];if(r!=null&&r>this.#e)throw new jte(`Response size (${r}) larger than maxSize (${this.#e})`);return this.aborted===!0?!0:super.onResponseStart(e,t,a,i)}onResponseError(e,t){this.#o||(t=this.#i?.reason??t,super.onResponseError(e,t))}onResponseData(e,t){return this.#a=this.#a+t.length,this.#a>=this.#e&&(this.#o=!0,this.aborted===!0?super.onResponseError(e,this.reason):super.onResponseEnd(e,{})),!0}onResponseEnd(e,t){if(!this.#o){if(this.#i.aborted===!0){super.onResponseError(e,this.reason);return}super.onResponseEnd(e,t)}}};function Qte({maxSize:o}={maxSize:1024*1024}){return e=>function(a,i){let{dumpMaxSize:r=o}=a,s=new KA({maxSize:r,signal:a.signal},i);return e(a,s)}}zQ.exports=Qte});var jQ=y((Qpe,CQ)=>{"use strict";var{isIP:Ste}=require("net"),{lookup:Dte}=require("dns"),Tte=pn(),{InvalidArgumentError:Yr,InformationalError:Rte}=$(),ZA=Math.pow(2,31)-1;function Nte(o){let e=Object.getPrototypeOf(o);return Object.prototype.hasOwnProperty.call(o,Symbol.iterator)||e!=null&&e!==Object.prototype&&typeof o[Symbol.iterator]=="function"}function EQ(o){return typeof o=="string"&&o.toLowerCase()==="host"}function Ute(o){if(o==null)return null;if(Array.isArray(o)){if(o.length===0||!Array.isArray(o[0]))return o;let e=[];for(let t of o)Array.isArray(t)&&t.length===2?e.push(t[0],t[1]):e.push(t);return e}if(typeof o=="object"&&Nte(o)){let e=[];for(let t of o)Array.isArray(t)&&t.length===2?e.push(t[0],t[1]):e.push(t);return e}return o}function Ote(o){if(o==null)return!1;if(Array.isArray(o)){if(o.length===0)return!1;for(let e=0;e<o.length;e+=2)if(EQ(o[e]))return!0;return!1}if(typeof o=="object"){for(let e in o)if(EQ(e))return!0}return!1}function IQ(o,e){let t=Ute(e);return Ote(t)?t:Array.isArray(t)?["host",o,...t]:t&&typeof t=="object"?{host:o,...t}:{host:o}}var XA=class{#e=0;#o=new Map;constructor(e){this.#e=e.maxItems}get size(){return this.#o.size}get(e){return this.#o.get(e)??null}set(e,t){this.#o.set(e,t)}delete(e){this.#o.delete(e)}full(){return this.size>=this.#e}},ew=class{#e=0;#o=0;dualStack=!0;affinity=null;lookup=null;pick=null;storage=null;constructor(e){this.#e=e.maxTTL,this.#o=e.maxItems,this.dualStack=e.dualStack,this.affinity=e.affinity,this.lookup=e.lookup??this.#a,this.pick=e.pick??this.#i,this.storage=e.storage??new XA(e)}runLookup(e,t,a){let i=this.storage.get(e.hostname);if(i==null&&this.storage.full()){a(null,e);return}let r={affinity:this.affinity,dualStack:this.dualStack,lookup:this.lookup,pick:this.pick,...t.dns,maxTTL:this.#e,maxItems:this.#o};if(i==null)this.lookup(e,r,(s,n)=>{if(s||n==null||n.length===0){a(s??new Rte("No DNS entries found"));return}this.setRecords(e,n);let c=this.storage.get(e.hostname),m=this.pick(e,c,r.affinity),l;typeof m.port=="number"?l=`:${m.port}`:e.port!==""?l=`:${e.port}`:l="",a(null,new URL(`${e.protocol}//${m.family===6?`[${m.address}]`:m.address}${l}`))});else{let s=this.pick(e,i,r.affinity);if(s==null){this.storage.delete(e.hostname),this.runLookup(e,t,a);return}let n;typeof s.port=="number"?n=`:${s.port}`:e.port!==""?n=`:${e.port}`:n="",a(null,new URL(`${e.protocol}//${s.family===6?`[${s.address}]`:s.address}${n}`))}}#a(e,t,a){Dte(e.hostname,{all:!0,family:this.dualStack===!1?this.affinity:0,order:"ipv4first"},(i,r)=>{if(i)return a(i);let s=new Map;for(let n of r)s.set(`${n.address}:${n.family}`,n);a(null,s.values())})}#i(e,t,a){let i=null,{records:r,offset:s}=t,n;if(this.dualStack?(a==null&&(s==null||s===ZA?(t.offset=0,a=4):(t.offset++,a=(t.offset&1)===1?6:4)),r[a]!=null&&r[a].ips.length>0?n=r[a]:n=r[a===4?6:4]):n=r[a],n==null||n.ips.length===0)return i;n.offset==null||n.offset===ZA?n.offset=0:n.offset++;let c=n.offset%n.ips.length;return i=n.ips[c]??null,i==null?i:Date.now()-i.timestamp>i.ttl?(n.ips.splice(c,1),this.pick(e,t,a)):i}pickFamily(e,t){let a=this.storage.get(e.hostname)?.records;if(!a)return null;let i=a[t];if(!i)return null;i.offset==null||i.offset===ZA?i.offset=0:i.offset++;let r=i.offset%i.ips.length,s=i.ips[r]??null;return s==null||Date.now()-s.timestamp>s.ttl&&i.ips.splice(r,1),s}setRecords(e,t){let a=Date.now(),i={records:{4:null,6:null}},r=this.#e;for(let s of t){s.timestamp=a,typeof s.ttl=="number"?(s.ttl=Math.min(s.ttl,this.#e),r=Math.min(r,s.ttl)):s.ttl=this.#e;let n=i.records[s.family]??{ips:[]};n.ips.push(s),i.records[s.family]=n}this.storage.set(e.hostname,i,{ttl:r})}deleteRecords(e){this.storage.delete(e.hostname)}getHandler(e,t){return new ow(this,e,t)}},ow=class extends Tte{#e=null;#o=null;#a=null;#i=null;#r=null;#t=null;#c=!0;constructor(e,{origin:t,handler:a,dispatch:i,newOrigin:r},s){super(a),this.#i=t,this.#t=r,this.#o={...s},this.#e=e,this.#a=i}onResponseError(e,t){switch(t.code){case"ETIMEDOUT":case"ECONNREFUSED":{if(this.#e.dualStack){if(!this.#c){super.onResponseError(e,t);return}this.#c=!1;let a=this.#t.hostname[0]==="["?4:6,i=this.#e.pickFamily(this.#i,a);if(i==null){super.onResponseError(e,t);return}let r;typeof i.port=="number"?r=`:${i.port}`:this.#i.port!==""?r=`:${this.#i.port}`:r="";let s={...this.#o,origin:`${this.#i.protocol}//${i.family===6?`[${i.address}]`:i.address}${r}`,headers:IQ(this.#i.host,this.#o.headers)};this.#a(s,this);return}super.onResponseError(e,t);break}case"ENOTFOUND":this.#e.deleteRecords(this.#i),super.onResponseError(e,t);break;default:super.onResponseError(e,t);break}}};CQ.exports=o=>{if(o?.maxTTL!=null&&(typeof o?.maxTTL!="number"||o?.maxTTL<0))throw new Yr("Invalid maxTTL. Must be a positive number");if(o?.maxItems!=null&&(typeof o?.maxItems!="number"||o?.maxItems<1))throw new Yr("Invalid maxItems. Must be a positive number and greater than zero");if(o?.affinity!=null&&o?.affinity!==4&&o?.affinity!==6)throw new Yr("Invalid affinity. Must be either 4 or 6");if(o?.dualStack!=null&&typeof o?.dualStack!="boolean")throw new Yr("Invalid dualStack. Must be a boolean");if(o?.lookup!=null&&typeof o?.lookup!="function")throw new Yr("Invalid lookup. Must be a function");if(o?.pick!=null&&typeof o?.pick!="function")throw new Yr("Invalid pick. Must be a function");if(o?.storage!=null&&(typeof o?.storage?.get!="function"||typeof o?.storage?.set!="function"||typeof o?.storage?.full!="function"||typeof o?.storage?.delete!="function"))throw new Yr("Invalid storage. Must be a object with methods: { get, set, full, delete }");let e=o?.dualStack??!0,t;e?t=o?.affinity??null:t=o?.affinity??4;let a={maxTTL:o?.maxTTL??1e4,lookup:o?.lookup??null,pick:o?.pick??null,dualStack:e,affinity:t,maxItems:o?.maxItems??1/0,storage:o?.storage},i=new ew(a);return r=>function(n,c){let m=n.origin.constructor===URL?n.origin:new URL(n.origin);return Ste(m.hostname)!==0?r(n,c):(i.runLookup(m,n,(l,u)=>{if(l)return c.onResponseError(null,l);let d={...n,servername:m.hostname,origin:u.origin,headers:IQ(m.host,n.headers)};r(d,i.getHandler({origin:m,dispatch:r,handler:c,newOrigin:u},n))}),!0)}}});var hn=y((Spe,_Q)=>{"use strict";var{safeHTTPMethods:BQ,pathHasQueryOrFragment:Mte,hasSafeIterator:_te,isValidHTTPToken:Nm}=K(),{serializePathWithQuery:Lte}=K(),Fte=2147483647,QQ=["no-store","private","no-cache"],tw=Symbol("invalid cache-control directives");function Vr(o){return o.replace(/^[\t ]+|[\t ]+$/g,"")}function UQ(o,e){for(let t=0;t<o.length;t++)if(o[t]===e)return!0;return!1}function SQ(o){return o.replace(/^[\t ]+/,"")}function DQ(o){return o.replace(/[\t ]+$/,"")}function TQ(o,e){let t=!1;for(let a=e;a<o.length;a++)if(t)t=!1;else if(o[a]==="\\")t=!0;else if(o[a]==='"')return a;return-1}function Pte(o){let e=[],t=0,a=-1,i=!1,r=!1;for(let m=0;m<o.length;m++)i?r?r=!1:o[m]==="\\"?r=!0:o[m]==='"'&&(i=!1,a=-1):o[m]==='"'?(i=!0,a=m):o[m]===","&&(e.push({value:o.substring(t,m),fromMalformedQuote:!1}),t=m+1);if(!i)return e.push({value:o.substring(t),fromMalformedQuote:!1}),e;let s=o.substring(t),n=a-t,c=0;for(let m=0;m<s.length;m++)s[m]===","&&(e.push({value:s.substring(c,m),fromMalformedQuote:c>n}),c=m+1);return e.push({value:s.substring(c),fromMalformedQuote:c>n}),e}function RQ(o,e){let t=o[tw];t===void 0&&(t=new Set,Object.defineProperty(o,tw,{value:t})),t.add(e)}function Hte(o,e){return o[tw]?.has(e)===!0}function Gte(o){for(let a of QQ)if(o.startsWith(a)&&o.length>a.length&&!Nm(o[a.length]))return a;let e="",t=!1;for(let a=0;a<o.length;a++)Nm(o[a])?e+=o[a]:t=!0;if(t&&UQ(QQ,e))return e}function Yte(o){if(!o.origin)throw new Error("opts.origin is undefined");let e=o.path||"/";return o.query&&!Mte(e)&&(e=Lte(e,o.query)),{origin:o.origin.toString(),method:o.method,path:e,headers:o.headers}}function NQ(o,e,t){let a=e.toLowerCase(),i=o[a],r=Array.isArray(t)?t:[t];i===void 0?o[a]=Array.isArray(t)?t.slice():t:Array.isArray(i)?i.push(...r):o[a]=[i,...r]}function Vte(o){let e;if(o.headers==null)e={};else if(typeof o.headers=="object")if(e={},_te(o.headers))for(let t of o.headers){if(!Array.isArray(t))throw new Error("opts.headers is not a valid header map");let[a,i]=t;if(typeof a!="string"||typeof i!="string")throw new Error("opts.headers is not a valid header map");NQ(e,a,i)}else for(let t of Object.keys(o.headers))NQ(e,t,o.headers[t]);else throw new Error("opts.headers is not an object");return e}function $te(o){if(typeof o!="object")throw new TypeError(`expected key to be object, got ${typeof o}`);for(let e of["origin","method","path"])if(typeof o[e]!="string")throw new TypeError(`expected key.${e} to be string, got ${typeof o[e]}`);if(o.headers!==void 0&&typeof o.headers!="object")throw new TypeError(`expected headers to be object, got ${typeof o}`)}function Wte(o){if(typeof o!="object")throw new TypeError(`expected value to be object, got ${typeof o}`);for(let e of["statusCode","cachedAt","staleAt","deleteAt"])if(typeof o[e]!="number")throw new TypeError(`expected value.${e} to be number, got ${typeof o[e]}`);if(typeof o.statusMessage!="string")throw new TypeError(`expected value.statusMessage to be string, got ${typeof o.statusMessage}`);if(o.headers!=null&&typeof o.headers!="object")throw new TypeError(`expected value.rawHeaders to be object, got ${typeof o.headers}`);if(o.vary!==void 0&&typeof o.vary!="object")throw new TypeError(`expected value.vary to be object, got ${typeof o.vary}`);if(o.etag!==void 0&&typeof o.etag!="string")throw new TypeError(`expected value.etag to be string, got ${typeof o.etag}`)}function Jte(o){let e={},t=new Set,a=new Set,i=Pte(Array.isArray(o)?o.join(","):o);for(let r=0;r<i.length;r++){let s=i[r],n=s.value.toLowerCase(),c=s.fromMalformedQuote,m=n.indexOf("="),l,u,d=!1,g=!1;if(m!==-1){let b=n.substring(0,m),A=n.substring(m+1);d=DQ(b)!==b,g=SQ(A)!==A,l=Vr(b),u=SQ(A)}else l=Vr(n);let p=Gte(l);if(p!==void 0){e[p]=!0;continue}switch(l){case"min-fresh":case"max-stale":case"max-age":case"s-maxage":case"stale-while-revalidate":case"stale-if-error":{if(c||t.has(l))continue;if(u===void 0||d||g){delete e[l],t.add(l),RQ(e,l);continue}if(u.length>=2&&u[0]==='"'&&u[u.length-1]==='"'&&(u=u.substring(1,u.length-1)),!/^[0-9]+$/.test(u)){delete e[l],t.add(l),RQ(e,l);continue}let b=Math.min(parseInt(u,10),Fte);l==="min-fresh"?(!(l in e)||e[l]<b)&&(e[l]=b):(!(l in e)||e[l]>b)&&(e[l]=b);break}case"private":case"no-cache":{if(c){e[l]=!0;break}if(u!==void 0&&u.length===0){e[l]=!0;break}if(u){if(u[0]==='"'){u=DQ(u);let b="",A=r,k=!1,x=TQ(u,1);if(x!==-1)b=u.substring(1,x),k=!0;else{let I=[u.substring(1)];for(let T=r+1;T<i.length;T++){let D=Vr(i[T].value),O=TQ(D,0);if(A=T,O!==-1){I.push(D.substring(0,O)),k=!0;break}I.push(D)}b=I.join(",")}if(!k){e[l]=!0;break}r=A;let v=b.split(","),j=!0;for(let I=0;I<v.length;I++)v[I]=Vr(v[I]),Nm(v[I])||(j=!1);j?e[l]!==!0&&(l in e?e[l]=e[l].concat(v):e[l]=v):e[l]=!0}else{let b=Vr(u);Nm(b)?e[l]!==!0&&(l in e?e[l]=e[l].concat(b):e[l]=[b]):e[l]=!0}break}}case"public":case"must-revalidate":case"proxy-revalidate":case"immutable":case"no-transform":case"must-understand":case"only-if-cached":if(c||a.has(l))continue;if(u!==void 0){delete e[l],a.add(l);continue}e[l]=!0;break;case"no-store":e[l]=!0;break;default:continue}}return e}function OQ(o){let e=Array.isArray(o)?o:[o],t=[];for(let a=0;a<e.length;a++){let i=e[a].split(",");for(let r=0;r<i.length;r++)t.push(i[r])}return t}function aw(o){let e=OQ(o);for(let t=0;t<e.length;t++)if(Vr(e[t]).indexOf("*")!==-1)return!0;return!1}function MQ(o,e){if(aw(o))return e;let t={},a=OQ(o);for(let i of a){let r=Vr(i).toLowerCase();if(r.length===0)continue;if(!Nm(r))return;let s=e[r];t[r]=Array.isArray(s)?s.slice():s??null}return t}function Kte(o){return aw(o)||MQ(o,{})===void 0}function Zte(o){return o.length<=2?!1:o[0]==='"'&&o[o.length-1]==='"'?!(o[1]==='"'||o.startsWith('"W/')):o.startsWith('W/"')&&o[o.length-1]==='"'?o.length!==4:!1}function Xte(o,e="CacheStore"){if(typeof o!="object"||o===null)throw new TypeError(`expected type of ${e} to be a CacheStore, got ${o===null?"null":typeof o}`);for(let t of["get","createWriteStream","delete"])if(typeof o[t]!="function")throw new TypeError(`${e} needs to have a \`${t}()\` function`)}function eae(o,e="CacheMethods"){if(!Array.isArray(o))throw new TypeError(`expected type of ${e} needs to be an array, got ${o===null?"null":typeof o}`);if(o.length===0)throw new TypeError(`${e} needs to have at least one method`);for(let t of o)if(!UQ(BQ,t))throw new TypeError(`element of ${e}-array needs to be one of following values: ${BQ.join(", ")}, got ${t}`)}function oae(o,e){let t={};if(o.headers){let a=Object.keys(o.headers).sort();for(let i of a)e?.has(i.toLowerCase())||(t[i]=o.headers[i])}return JSON.stringify([o.origin,o.method,o.path,t])}_Q.exports={makeCacheKey:Yte,normalizeHeaders:Vte,assertCacheKey:$te,assertCacheValue:Wte,parseCacheControlHeader:Jte,hasInvalidCacheControlDirective:Hte,parseVaryHeader:MQ,hasVaryStar:aw,isInvalidOrWildcardVaryHeader:Kte,isEtagUsable:Zte,assertCacheMethods:eae,assertCacheStore:Xte,makeDeduplicationKey:oae}});var rw=y((Dpe,LQ)=>{"use strict";function tae(o){switch(o[3]){case",":return aae(o);case" ":return iae(o);default:return rae(o)}}function iw(o,e,t,a,i,r,s){let n=new Date(Date.UTC(o,e,t,a,i,r));return o>=0&&o<=99&&n.setUTCFullYear(o),n.getUTCFullYear()===o&&n.getUTCMonth()===e&&n.getUTCDate()===t&&n.getUTCHours()===a&&n.getUTCMinutes()===i&&n.getUTCSeconds()===r&&n.getUTCDay()===s?n:void 0}function aae(o){if(o.length!==29||o[4]!==" "||o[7]!==" "||o[11]!==" "||o[16]!==" "||o[19]!==":"||o[22]!==":"||o[25]!==" "||o[26]!=="G"||o[27]!=="M"||o[28]!=="T")return;let e=-1;if(o[0]==="S"&&o[1]==="u"&&o[2]==="n")e=0;else if(o[0]==="M"&&o[1]==="o"&&o[2]==="n")e=1;else if(o[0]==="T"&&o[1]==="u"&&o[2]==="e")e=2;else if(o[0]==="W"&&o[1]==="e"&&o[2]==="d")e=3;else if(o[0]==="T"&&o[1]==="h"&&o[2]==="u")e=4;else if(o[0]==="F"&&o[1]==="r"&&o[2]==="i")e=5;else if(o[0]==="S"&&o[1]==="a"&&o[2]==="t")e=6;else return;let t=0;if(o[5]==="0"){let d=o.charCodeAt(6);if(d<49||d>57)return;t=d-48}else{let d=o.charCodeAt(5);if(d<49||d>51)return;let g=o.charCodeAt(6);if(g<48||g>57)return;t=(d-48)*10+(g-48)}let a=-1;if(o[8]==="J"&&o[9]==="a"&&o[10]==="n")a=0;else if(o[8]==="F"&&o[9]==="e"&&o[10]==="b")a=1;else if(o[8]==="M"&&o[9]==="a")if(o[10]==="r")a=2;else if(o[10]==="y")a=4;else return;else if(o[8]==="J")if(o[9]==="a"&&o[10]==="n")a=0;else if(o[9]==="u")if(o[10]==="n")a=5;else if(o[10]==="l")a=6;else return;else return;else if(o[8]==="A")if(o[9]==="p"&&o[10]==="r")a=3;else if(o[9]==="u"&&o[10]==="g")a=7;else return;else if(o[8]==="S"&&o[9]==="e"&&o[10]==="p")a=8;else if(o[8]==="O"&&o[9]==="c"&&o[10]==="t")a=9;else if(o[8]==="N"&&o[9]==="o"&&o[10]==="v")a=10;else if(o[8]==="D"&&o[9]==="e"&&o[10]==="c")a=11;else return;let i=o.charCodeAt(12);if(i<48||i>57)return;let r=o.charCodeAt(13);if(r<48||r>57)return;let s=o.charCodeAt(14);if(s<48||s>57)return;let n=o.charCodeAt(15);if(n<48||n>57)return;let c=(i-48)*1e3+(r-48)*100+(s-48)*10+(n-48),m=0;if(o[17]==="0"){let d=o.charCodeAt(18);if(d<48||d>57)return;m=d-48}else{let d=o.charCodeAt(17);if(d<48||d>50)return;let g=o.charCodeAt(18);if(g<48||g>57||d===50&&g>51)return;m=(d-48)*10+(g-48)}let l=0;if(o[20]==="0"){let d=o.charCodeAt(21);if(d<48||d>57)return;l=d-48}else{let d=o.charCodeAt(20);if(d<48||d>53)return;let g=o.charCodeAt(21);if(g<48||g>57)return;l=(d-48)*10+(g-48)}let u=0;if(o[23]==="0"){let d=o.charCodeAt(24);if(d<48||d>57)return;u=d-48}else{let d=o.charCodeAt(23);if(d<48||d>53)return;let g=o.charCodeAt(24);if(g<48||g>57)return;u=(d-48)*10+(g-48)}return iw(c,a,t,m,l,u,e)}function iae(o){if(o.length!==24||o[7]!==" "||o[10]!==" "||o[19]!==" ")return;let e=-1;if(o[0]==="S"&&o[1]==="u"&&o[2]==="n")e=0;else if(o[0]==="M"&&o[1]==="o"&&o[2]==="n")e=1;else if(o[0]==="T"&&o[1]==="u"&&o[2]==="e")e=2;else if(o[0]==="W"&&o[1]==="e"&&o[2]==="d")e=3;else if(o[0]==="T"&&o[1]==="h"&&o[2]==="u")e=4;else if(o[0]==="F"&&o[1]==="r"&&o[2]==="i")e=5;else if(o[0]==="S"&&o[1]==="a"&&o[2]==="t")e=6;else return;let t=-1;if(o[4]==="J"&&o[5]==="a"&&o[6]==="n")t=0;else if(o[4]==="F"&&o[5]==="e"&&o[6]==="b")t=1;else if(o[4]==="M"&&o[5]==="a")if(o[6]==="r")t=2;else if(o[6]==="y")t=4;else return;else if(o[4]==="J")if(o[5]==="a"&&o[6]==="n")t=0;else if(o[5]==="u")if(o[6]==="n")t=5;else if(o[6]==="l")t=6;else return;else return;else if(o[4]==="A")if(o[5]==="p"&&o[6]==="r")t=3;else if(o[5]==="u"&&o[6]==="g")t=7;else return;else if(o[4]==="S"&&o[5]==="e"&&o[6]==="p")t=8;else if(o[4]==="O"&&o[5]==="c"&&o[6]==="t")t=9;else if(o[4]==="N"&&o[5]==="o"&&o[6]==="v")t=10;else if(o[4]==="D"&&o[5]==="e"&&o[6]==="c")t=11;else return;let a=0;if(o[8]===" "){let d=o.charCodeAt(9);if(d<49||d>57)return;a=d-48}else{let d=o.charCodeAt(8);if(d<49||d>51)return;let g=o.charCodeAt(9);if(g<48||g>57)return;a=(d-48)*10+(g-48)}let i=0;if(o[11]==="0"){let d=o.charCodeAt(12);if(d<48||d>57)return;i=d-48}else{let d=o.charCodeAt(11);if(d<48||d>50)return;let g=o.charCodeAt(12);if(g<48||g>57||d===50&&g>51)return;i=(d-48)*10+(g-48)}let r=0;if(o[14]==="0"){let d=o.charCodeAt(15);if(d<48||d>57)return;r=d-48}else{let d=o.charCodeAt(14);if(d<48||d>53)return;let g=o.charCodeAt(15);if(g<48||g>57)return;r=(d-48)*10+(g-48)}let s=0;if(o[17]==="0"){let d=o.charCodeAt(18);if(d<48||d>57)return;s=d-48}else{let d=o.charCodeAt(17);if(d<48||d>53)return;let g=o.charCodeAt(18);if(g<48||g>57)return;s=(d-48)*10+(g-48)}let n=o.charCodeAt(20);if(n<48||n>57)return;let c=o.charCodeAt(21);if(c<48||c>57)return;let m=o.charCodeAt(22);if(m<48||m>57)return;let l=o.charCodeAt(23);if(l<48||l>57)return;let u=(n-48)*1e3+(c-48)*100+(m-48)*10+(l-48);return iw(u,t,a,i,r,s,e)}function rae(o){let e=-1,t=-1;if(o[0]==="S")o[1]==="u"&&o[2]==="n"&&o[3]==="d"&&o[4]==="a"&&o[5]==="y"?(t=0,e=6):o[1]==="a"&&o[2]==="t"&&o[3]==="u"&&o[4]==="r"&&o[5]==="d"&&o[6]==="a"&&o[7]==="y"&&(t=6,e=8);else if(o[0]==="M"&&o[1]==="o"&&o[2]==="n"&&o[3]==="d"&&o[4]==="a"&&o[5]==="y")t=1,e=6;else if(o[0]==="T")o[1]==="u"&&o[2]==="e"&&o[3]==="s"&&o[4]==="d"&&o[5]==="a"&&o[6]==="y"?(t=2,e=7):o[1]==="h"&&o[2]==="u"&&o[3]==="r"&&o[4]==="s"&&o[5]==="d"&&o[6]==="a"&&o[7]==="y"&&(t=4,e=8);else if(o[0]==="W"&&o[1]==="e"&&o[2]==="d"&&o[3]==="n"&&o[4]==="e"&&o[5]==="s"&&o[6]==="d"&&o[7]==="a"&&o[8]==="y")t=3,e=9;else if(o[0]==="F"&&o[1]==="r"&&o[2]==="i"&&o[3]==="d"&&o[4]==="a"&&o[5]==="y")t=5,e=6;else return;if(o[e]!==","||o.length-e-1!==23||o[e+1]!==" "||o[e+4]!=="-"||o[e+8]!=="-"||o[e+11]!==" "||o[e+14]!==":"||o[e+17]!==":"||o[e+20]!==" "||o[e+21]!=="G"||o[e+22]!=="M"||o[e+23]!=="T")return;let a=0;if(o[e+2]==="0"){let u=o.charCodeAt(e+3);if(u<49||u>57)return;a=u-48}else{let u=o.charCodeAt(e+2);if(u<49||u>51)return;let d=o.charCodeAt(e+3);if(d<48||d>57)return;a=(u-48)*10+(d-48)}let i=-1;if(o[e+5]==="J"&&o[e+6]==="a"&&o[e+7]==="n")i=0;else if(o[e+5]==="F"&&o[e+6]==="e"&&o[e+7]==="b")i=1;else if(o[e+5]==="M"&&o[e+6]==="a"&&o[e+7]==="r")i=2;else if(o[e+5]==="A"&&o[e+6]==="p"&&o[e+7]==="r")i=3;else if(o[e+5]==="M"&&o[e+6]==="a"&&o[e+7]==="y")i=4;else if(o[e+5]==="J"&&o[e+6]==="u"&&o[e+7]==="n")i=5;else if(o[e+5]==="J"&&o[e+6]==="u"&&o[e+7]==="l")i=6;else if(o[e+5]==="A"&&o[e+6]==="u"&&o[e+7]==="g")i=7;else if(o[e+5]==="S"&&o[e+6]==="e"&&o[e+7]==="p")i=8;else if(o[e+5]==="O"&&o[e+6]==="c"&&o[e+7]==="t")i=9;else if(o[e+5]==="N"&&o[e+6]==="o"&&o[e+7]==="v")i=10;else if(o[e+5]==="D"&&o[e+6]==="e"&&o[e+7]==="c")i=11;else return;let r=o.charCodeAt(e+9);if(r<48||r>57)return;let s=o.charCodeAt(e+10);if(s<48||s>57)return;let n=(r-48)*10+(s-48);n+=n<70?2e3:1900;let c=0;if(o[e+12]==="0"){let u=o.charCodeAt(e+13);if(u<48||u>57)return;c=u-48}else{let u=o.charCodeAt(e+12);if(u<48||u>50)return;let d=o.charCodeAt(e+13);if(d<48||d>57||u===50&&d>51)return;c=(u-48)*10+(d-48)}let m=0;if(o[e+15]==="0"){let u=o.charCodeAt(e+16);if(u<48||u>57)return;m=u-48}else{let u=o.charCodeAt(e+15);if(u<48||u>53)return;let d=o.charCodeAt(e+16);if(d<48||d>57)return;m=(u-48)*10+(d-48)}let l=0;if(o[e+18]==="0"){let u=o.charCodeAt(e+19);if(u<48||u>57)return;l=u-48}else{let u=o.charCodeAt(e+18);if(u<48||u>53)return;let d=o.charCodeAt(e+19);if(d<48||d>57)return;l=(u-48)*10+(d-48)}return iw(n,i,a,c,m,l,t)}LQ.exports={parseHttpDate:tae}});var $Q=y((Tpe,VQ)=>{"use strict";var sw=K(),{parseCacheControlHeader:sae,hasInvalidCacheControlDirective:FQ,parseVaryHeader:nae,hasVaryStar:cae,isInvalidOrWildcardVaryHeader:HQ,isEtagUsable:mae}=hn(),{parseHttpDate:nw}=rw();function lae(){}var GQ=[200,203,204,206,300,301,308,404,405,410,414,501],uae=[206],Um=2147483647e3;function dae(o){return o.replace(/^[\t ]+|[\t ]+$/g,"")}function fn(o,e){for(let t=0;t<o.length;t++)if(o[t]===e)return!0;return!1}function gae(o,e){let t=Array.isArray(e)?e:[e];for(let a=0;a<t.length;a++){let i=t[a].split(",");for(let r=0;r<i.length;r++)o.push(dae(i[r]).toLowerCase())}}function pae(o,e){if(typeof e!="string")return;let t,a,i;try{t=new URL(o.origin),a=new URL(o.path,t),i=new URL(e,a)}catch{return}if(i.origin===t.origin)return i.pathname+i.search}function YQ(o,e,t){Om(o,{...e,path:t});for(let a=0;a<sw.safeHTTPMethods.length;a++){let i=sw.safeHTTPMethods[a];i!==e.method&&Om(o,{...e,method:i,path:t})}}function PQ(o,e,t){if(t===void 0)return;let a=Array.isArray(t)?t:[t];for(let i=0;i<a.length;i++){let r=pae(e,a[i]);r!==void 0&&YQ(o,e,r)}}function hae(o,e,t){YQ(o,e,e.path),PQ(o,e,t.location),PQ(o,e,t["content-location"])}var cw=class{#e;#o;#a;#i;#r;#t;constructor({store:e,type:t,cacheByDefault:a},i,r){this.#i=e,this.#o=t,this.#a=a,this.#e=i,this.#r=r}onRequestStart(e,t){this.#t?.destroy(),this.#t=void 0,this.#r.onRequestStart?.(e,t)}onRequestUpgrade(e,t,a,i){this.#r.onRequestUpgrade?.(e,t,a,i)}onResponseStart(e,t,a,i){let r=()=>this.#r.onResponseStart?.(e,t,a,i),s=this;if(!fn(sw.safeHTTPMethods,this.#e.method)&&t>=200&&t<=399)return hae(this.#i,this.#e,a),r();let n=a["cache-control"],c=a["last-modified"]&&fn(GQ,t);if(!n&&!a.expires&&!c&&!this.#a)return t===304&&a.vary&&HQ(a.vary)&&Om(this.#i,this.#e),r();let m=n?sae(n):{};if(!bae(this.#o,t,a,m,this.#e.headers))return t===304&&(n||fae(this.#o,a,m))&&Om(this.#i,this.#e),r();let l=Date.now(),u=Object.hasOwn(a,"age")?kae(a.age):void 0;if(u!==void 0&&u>=Um)return rg(t,this.#i,this.#e),r();let d=Object.hasOwn(a,"date")?yae(a.date):void 0;if(d===null)return rg(t,this.#i,this.#e),r();let g=d?Math.max(0,l-d.getTime()):0,p=Math.max(g,u??0),b=Aae(this.#o,l,u,a,d,m)??this.#a;if(b===void 0||p>=b)return(n||b!==void 0)&&rg(t,this.#i,this.#e),r();let A=l-p,k=b+A;if(l>=k)return rg(t,this.#i,this.#e),r();let x;if(this.#e.headers&&a.vary&&(x=nae(a.vary,this.#e.headers),!x))return r();let v=A,j=wae(A,l,m,k),I=vae(a,m),T={statusCode:t,statusMessage:i,headers:I,vary:x,cacheControlDirectives:m,cachedAt:v,staleAt:k,deleteAt:j};if(t===304){let D=S=>{if(!S)return r();if(T.statusCode=S.statusCode,T.statusMessage=S.statusMessage,T.etag=S.etag,T.vary=x??S.vary,T.headers={...S.headers,...I},r(),this.#t=this.#i.createWriteStream(this.#e,T),!(!this.#t||!S?.body))if(typeof S.body.values=="function"){let oe=S.body.values(),te=()=>{for(let ye of oe){let po=this.#t.write(ye)===!1;if(this.#r.onResponseData?.(e,ye),po)break}};this.#t.on("error",function(){s.#t=void 0,s.#i.delete(s.#e)}).on("drain",()=>{te()}).on("close",function(){s.#t===this&&(s.#t=void 0)}),te()}else typeof S.body.on=="function"&&(S.body.on("data",oe=>{this.#t.write(oe),this.#r.onResponseData?.(e,oe)}).on("end",()=>{this.#t.end()}).on("error",()=>{this.#t=void 0,this.#i.delete(this.#e)}),this.#t.on("error",function(){s.#t=void 0,s.#i.delete(s.#e)}).on("close",function(){s.#t===this&&(s.#t=void 0)}))},O=this.#i.get(this.#e);O&&typeof O.then=="function"?O.then(D):D(O)}else{if(typeof a.etag=="string"&&mae(a.etag)&&(T.etag=a.etag),this.#t=this.#i.createWriteStream(this.#e,T),!this.#t)return r();this.#t.on("drain",()=>e.resume()).on("error",function(){s.#t=void 0,s.#i.delete(s.#e)}).on("close",function(){s.#t===this&&(s.#t=void 0),e.resume()}),r()}}onResponseData(e,t){this.#t?.write(t)===!1&&e.pause(),this.#r.onResponseData?.(e,t)}onResponseEnd(e,t){this.#t?.end(),this.#r.onResponseEnd?.(e,t)}onResponseError(e,t){this.#t?.destroy(t),this.#t=void 0,this.#r.onResponseError?.(e,t)}};function Om(o,e){try{o.delete(e)?.catch?.(lae)}catch{}}function rg(o,e,t){o===304&&Om(e,t)}function fae(o,e,t){return t["no-store"]===!0||o==="shared"&&t.private===!0||(e.vary?HQ(e.vary):!1)}function bae(o,e,t,a,i){return!(e<200||fn(uae,e)||!fn(GQ,e)&&!t.expires&&!a.public&&a["max-age"]===void 0&&!(a.private&&o==="private")&&!(a["s-maxage"]!==void 0&&o==="shared")||a["no-store"]||o==="shared"&&a.private===!0||t.vary&&cae(t.vary)||i!=null&&Object.hasOwn(i,"authorization")&&(!a.public&&!a["s-maxage"]&&!a["must-revalidate"]||typeof i.authorization!="string"||Array.isArray(a["no-cache"])&&fn(a["no-cache"],"authorization")||Array.isArray(a.private)&&fn(a.private,"authorization")))}function yae(o){let e=o;if(Array.isArray(e)){if(e.length!==1)return null;e=e[0]}return typeof e!="string"?null:nw(e)}function kae(o){let e=o;if(Array.isArray(e)){if(e.length!==1)return Um;e=e[0]}if(typeof e!="string"||!/^[\t ]*[0-9]+[\t ]*$/.test(e))return Um;let t=BigInt(e.replace(/^[\t ]+|[\t ]+$/g,""));return t>=BigInt(Um/1e3)?Um:Number(t)*1e3}function Aae(o,e,t,a,i,r){if(o==="shared"){if(FQ(r,"s-maxage"))return 0;let n=r["s-maxage"];if(n!==void 0)return n*1e3}if(FQ(r,"max-age"))return 0;let s=r["max-age"];if(s!==void 0)return s*1e3;if(Object.hasOwn(a,"expires")){if(typeof a.expires!="string")return 0;let n=nw(a.expires);if(!n||e>=n.getTime())return 0;if(i){if(i>=n)return 0;let c=n.getTime()-i.getTime();return t!==void 0&&t>=c?0:c}return n.getTime()-e}if(typeof a["last-modified"]=="string"){let n=nw(a["last-modified"]);if(n)return n.getTime()>=e?void 0:(e-n.getTime())*.1}if(r.immutable)return 31536e6}function wae(o,e,t,a){let i=-1/0,r=-1/0,s=-1/0;if(t["stale-while-revalidate"]&&(i=a+t["stale-while-revalidate"]*1e3),t["stale-if-error"]&&(r=a+t["stale-if-error"]*1e3),t.immutable&&i===-1/0&&r===-1/0&&(s=e+31536e6),i===-1/0&&r===-1/0&&s===-1/0){let n=a-o,c=Math.min(Math.max(e-o,0),1e3);return a+n+c}return Math.max(a,i,r,s)}function vae(o,e){let t=["connection","proxy-authenticate","proxy-authentication-info","proxy-authorization","proxy-connection","te","transfer-encoding","upgrade","age"];o.connection&&gae(t,o.connection),Array.isArray(e["no-cache"])&&t.push(...e["no-cache"]),Array.isArray(e.private)&&t.push(...e.private);let a;for(let i of t)Object.hasOwn(o,i)&&(a??={...o},delete a[i]);return a??o}VQ.exports=cw});var lw=y((Rpe,KQ)=>{"use strict";var{Writable:xae}=require("stream"),{EventEmitter:zae}=require("events"),{assertCacheKey:WQ,assertCacheValue:qae}=hn(),mw=class extends zae{#e=1024;#o=104857600;#a=5242880;#i=0;#r=0;#t=new Map;#c=!1;constructor(e){if(super(),e){if(typeof e!="object")throw new TypeError("MemoryCacheStore options must be an object");if(e.maxCount!==void 0){if(typeof e.maxCount!="number"||!Number.isInteger(e.maxCount)||e.maxCount<0)throw new TypeError("MemoryCacheStore options.maxCount must be a non-negative integer");this.#e=e.maxCount}if(e.maxSize!==void 0){if(typeof e.maxSize!="number"||!Number.isInteger(e.maxSize)||e.maxSize<0)throw new TypeError("MemoryCacheStore options.maxSize must be a non-negative integer");this.#o=e.maxSize}if(e.maxEntrySize!==void 0){if(typeof e.maxEntrySize!="number"||!Number.isInteger(e.maxEntrySize)||e.maxEntrySize<0)throw new TypeError("MemoryCacheStore options.maxEntrySize must be a non-negative integer");this.#a=e.maxEntrySize}}}get size(){return this.#i}isFull(){return this.#i>=this.#o||this.#r>=this.#e}get(e){WQ(e);let t=`${e.origin}:${e.path}`,a=Date.now(),i=this.#t.get(t),r=i?JQ(e,i,a):null;return r==null?void 0:{statusMessage:r.statusMessage,statusCode:r.statusCode,headers:r.headers,body:r.body,vary:r.vary?r.vary:void 0,etag:r.etag,cacheControlDirectives:r.cacheControlDirectives,cachedAt:r.cachedAt,staleAt:r.staleAt,deleteAt:r.deleteAt}}createWriteStream(e,t){WQ(e),qae(t);let a=`${e.origin}:${e.path}`,i=this,r={...e,...t,body:[],size:0};return new xae({write(s,n,c){typeof s=="string"&&(s=Buffer.from(s,n)),r.size+=s.byteLength,r.size>=i.#a?this.destroy():r.body.push(s),c(null)},final(s){let n=i.#t.get(a);n||(n=[],i.#t.set(a,n));let c=JQ(e,n,Date.now());if(c){let m=n.indexOf(c);n.splice(m,1,r),i.#i-=c.size}else n.push(r),i.#r+=1;if(i.#i+=r.size,i.#i>i.#o||i.#r>i.#e){i.#c||(i.emit("maxSizeExceeded",{size:i.#i,maxSize:i.#o,count:i.#r,maxCount:i.#e}),i.#c=!0);for(let[m,l]of i.#t){for(let u of l.splice(0,l.length/2))i.#i-=u.size,i.#r-=1;l.length===0&&i.#t.delete(m)}i.#i<i.#o&&i.#r<i.#e&&(i.#c=!1)}s(null)}})}delete(e){if(typeof e!="object")throw new TypeError(`expected key to be object, got ${typeof e}`);let t=`${e.origin}:${e.path}`;for(let a of this.#t.get(t)??[])this.#i-=a.size,this.#r-=1;this.#t.delete(t)}};function JQ(o,e,t){for(let a=0;a<e.length;a++){let i=e[a];if(i.deleteAt>t&&i.method===o.method&&Eae(o,i))return i}}function Eae(o,e){if(e.vary==null)return!0;for(let t in e.vary)if(Object.hasOwn(e.vary,t)&&!Iae(o.headers?.[t],e.vary[t]))return!1;return!0}function Iae(o,e){if(o==null&&e==null)return!0;if(o==null&&e!=null||o!=null&&e==null)return!1;if(Array.isArray(o)&&Array.isArray(e)){if(o.length!==e.length)return!1;for(let t=0;t<o.length;t++)if(o[t]!==e[t])return!1;return!0}return o===e}KQ.exports=mw});var XQ=y((Npe,ZQ)=>{"use strict";var Cae=require("assert"),uw=class{#e=!1;#o;#a;#i;#r;constructor(e,t,a){if(typeof e!="function")throw new TypeError("callback must be a function");this.#o=e,this.#a=t,this.#r=a}onRequestStart(e,t){this.#e=!1,this.#i=t}onRequestUpgrade(e,t,a,i){this.#a.onRequestUpgrade?.(e,t,a,i)}onResponseStart(e,t,a,i){if(Cae(this.#o!=null),this.#e=t===304||this.#r&&t>=500&&t<=504,this.#o(this.#e,this.#i,t,a),this.#o=null,this.#e)return!0;this.#a.onRequestStart?.(e,this.#i),this.#a.onResponseStart?.(e,t,a,i)}onResponseData(e,t){if(!this.#e)return this.#a.onResponseData?.(e,t)}onResponseEnd(e,t){this.#e||this.#a.onResponseEnd?.(e,t)}onResponseError(e,t){if(!this.#e)if(this.#o&&(this.#o(!1),this.#o=null),typeof this.#a.onResponseError=="function")this.#a.onResponseError(e,t);else throw t}};ZQ.exports=uw});var n3=y((Upe,s3)=>{"use strict";var e3=require("assert"),{Readable:jae}=require("stream"),Ui=K(),bn=$Q(),Bae=lw(),Qae=XQ(),{assertCacheStore:Sae,assertCacheMethods:Dae,makeCacheKey:Tae,normalizeHeaders:Rae,parseCacheControlHeader:r3,isInvalidOrWildcardVaryHeader:Nae}=hn(),{AbortError:Uae}=$(),{parseHttpDate:Oae}=rw();function Mae(o,e){if(o!==void 0){if(!Array.isArray(o))throw new TypeError(`expected ${e} to be an array or undefined, got ${typeof o}`);for(let t=0;t<o.length;t++){let a=o[t];if(typeof a!="string"&&!(a instanceof RegExp))throw new TypeError(`expected ${e}[${t}] to be a string or RegExp, got ${typeof a}`)}}}var Mm=()=>{};function _ae(o){return o.replace(/^[\t ]+|[\t ]+$/g,"")}function o3(o,e){for(let t=0;t<o.length;t++)if(o[t]===e)return!0;return!1}function Lae(o){let e=o?.pragma;if(!e)return!1;let t=Array.isArray(e)?e:[e];for(let a=0;a<t.length;a++){let i=t[a];if(typeof i!="string")continue;let r=i.split(",");for(let s=0;s<r.length;s++)if(_ae(r[s]).toLowerCase()==="no-cache")return!0}return!1}function Fae(o,e,{headers:t={}}){return!!(e?.["no-cache"]||o.cacheControlDirectives?.["no-cache"]&&!Array.isArray(o.cacheControlDirectives["no-cache"])||t["if-modified-since"]||t["if-none-match"])}function gw(o,e){return o.cacheControlDirectives?.["must-revalidate"]===!0||e==="shared"&&(o.cacheControlDirectives?.["proxy-revalidate"]===!0||o.cacheControlDirectives?.["s-maxage"]!==void 0)}function Pae(o,e){if(e.vary&&Nae(e.vary))return!0;let t=e["cache-control"];if(!t)return!1;let a=r3(t);return a["no-store"]===!0||o==="shared"&&a.private===!0}function Hae(o){return o["cache-control"]!==void 0}function t3(o,e){try{o.delete(e)?.catch?.(Mm)}catch{}}function Gae(o){let e=o?.["last-modified"];if(typeof e=="string"&&Oae(e))return e}function a3(o,e){let t={...o.headers,"if-modified-since":Gae(e.headers)??new Date(e.cachedAt).toUTCString()};if(e.etag&&(t["if-none-match"]=e.etag),e.vary)for(let a in e.vary)e.vary[a]!=null&&(t[a]=e.vary[a]);return t}function Yae(o,e,t){let a=Date.now();if(a>o.staleAt){if(!gw(o,t)&&e?.["max-stale"]){let i=o.staleAt+e["max-stale"]*1e3;return a>i}return!0}if(e?.["min-fresh"]){let i=o.staleAt-a,r=e["min-fresh"]*1e3;return i<=r}return!1}function Vae(o,e){let t=o.cacheControlDirectives?.["stale-while-revalidate"];if(!t||gw(o,e))return!1;let a=Date.now(),i=o.staleAt+t*1e3;return a<=i}function $ae(o,e,t,a,i,r){if(r?.["only-if-cached"]){let s=!1;try{if(typeof a.onConnect=="function"&&(a.onConnect(()=>{s=!0}),s)||typeof a.onHeaders=="function"&&(a.onHeaders(504,[],Mm,"Gateway Timeout"),s))return;typeof a.onComplete=="function"&&a.onComplete([])}catch(n){typeof a.onError=="function"&&a.onError(n)}return!0}return o(i,new bn(e,t,a))}function dw(o,e,t,a,i,r){let s=Ui.isStream(t.body)?t.body:jae.from(t.body??[]);e3(!s.destroyed,"stream should not be destroyed"),e3(!s.readableDidRead,"stream should not be readableDidRead");let n={resume(){s.resume()},pause(){s.pause()},get paused(){return s.isPaused()},get aborted(){return s.destroyed},get reason(){return s.errored},abort(m){s.destroy(m??new Uae)}};if(s.on("error",function(m){if(!this.readableEnded)if(typeof o.onResponseError=="function")o.onResponseError(n,m);else throw m}).on("close",function(){this.errored||o.onResponseEnd?.(n,{})}),o.onRequestStart?.(n,i),s.destroyed)return;let c={...t.headers,age:String(a)};r&&(c.warning='110 - "response is stale"'),o.onResponseStart?.(n,t.statusCode,c,t.statusMessage),e.method==="HEAD"?s.destroy():s.on("data",function(m){o.onResponseData?.(n,m)})}function i3(o,e,t,a,i,r,s){if(!s)return $ae(o,e,t,a,i,r);let n=Date.now();if(n>s.deleteAt)return o(i,new bn(e,t,a));let c=Math.round((n-s.cachedAt)/1e3),m=r?.["max-age"]!==void 0&&c>=r["max-age"],l=m||Yae(s,r,e.type),u=m||Fae(s,r,i);if(l||u){if(Ui.isStream(i.body)&&Ui.bodyLength(i.body)!==0)return o(i,new bn(e,t,a));if(!u&&Vae(s,e.type))return dw(a,i,s,c,null,!0),queueMicrotask(()=>{let p=a3(i,s);o({...i,headers:p},new bn(e,t,{onRequestStart(){},onRequestUpgrade(){},onResponseStart(){},onResponseData(){},onResponseEnd(){},onResponseError(){}}))}),!0;let d=!1;if(!gw(s,e.type)){let p=s.cacheControlDirectives["stale-if-error"]??r?.["stale-if-error"];p&&(d=n<s.staleAt+p*1e3)}let g=a3(i,s);return o({...i,headers:g},new Qae((p,b,A,k)=>{if(p){if(A===304){if(Pae(e.type,k))return Ui.isStream(s.body)&&s.body.on("error",Mm).destroy(),t3(e.store,t),o(i,new bn(e,t,a));Hae(k)&&t3(e.store,t)}dw(a,i,s,c,b,l)}else Ui.isStream(s.body)&&s.body.on("error",Mm).destroy()},new bn(e,t,a),d))}Ui.isStream(i.body)&&i.body.on("error",Mm).destroy(),dw(a,i,s,c,null,!1)}s3.exports=(o={})=>{let{store:e=new Bae,methods:t=["GET"],cacheByDefault:a=void 0,type:i="shared",origins:r=void 0}=o;if(typeof o!="object"||o===null)throw new TypeError(`expected type of opts to be an Object, got ${o===null?"null":typeof o}`);if(Sae(e,"opts.store"),Dae(t,"opts.methods"),Mae(r,"opts.origins"),typeof a<"u"&&typeof a!="number")throw new TypeError(`expected opts.cacheByDefault to be number or undefined, got ${typeof a}`);if(typeof i<"u"&&i!=="shared"&&i!=="private")throw new TypeError(`expected opts.type to be shared, private, or undefined, got ${typeof i}`);let s={store:e,methods:t,cacheByDefault:a,type:i},n=[];for(let c=0;c<Ui.safeHTTPMethods.length;c++){let m=Ui.safeHTTPMethods[c];o3(t,m)||n.push(m)}return c=>(m,l)=>{if(!m.origin||o3(n,m.method))return c(m,l);if(r!==void 0){let p=m.origin.toString().toLowerCase(),b=!1;for(let A=0;A<r.length;A++){let k=r[A];if(typeof k=="string"){if(k.toLowerCase()===p){b=!0;break}}else if(k.test(p)){b=!0;break}}if(!b)return c(m,l)}m={...m,headers:Rae(m)};let u=m.headers?.["cache-control"]?r3(m.headers["cache-control"]):Lae(m.headers)?{"no-cache":!0}:void 0;if(u?.["no-store"])return c(m,l);let d=Tae(m),g=e.get(d);return g&&typeof g.then=="function"?g.then(p=>i3(c,s,d,l,m,u,p)):i3(c,s,d,l,m,u,g)}}});var d3=y((Ope,u3)=>{"use strict";var{createInflate:pw,createGunzip:c3,createBrotliDecompress:Wae,createZstdDecompress:Jae}=require("zlib"),{pipeline:Kae}=require("stream"),Zae=pn(),{runtimeFeatures:Xae}=Ta(),m3={gzip:c3,"x-gzip":c3,br:Wae,deflate:pw,compress:pw,"x-compress":pw,...Xae.has("zstd")?{zstd:Jae}:{}},eie=[204,304],l3=!1,hw=class extends Zae{#e=[];#o;#a;constructor(e,{skipStatusCodes:t=eie,skipErrorResponses:a=!0}={}){super(e),this.#o=t,this.#a=a}#i(e,t){return!!(!e||t<200||this.#o.includes(t)||this.#a&&t>=400)}#r(e){let t=e.split(","),a=5;if(t.length>a)throw new Error(`too many content-encodings in response: ${t.length}, maximum allowed is ${a}`);let i=[];for(let r=t.length-1;r>=0;r--){let s=t[r].trim();if(s){if(!m3[s])return i.length=0,i;i.push(m3[s]())}}return i}#t(e,t){e.on("readable",()=>{let a;for(;(a=e.read())!==null&&super.onResponseData(t,a)!==!1;);}),e.on("error",a=>{super.onResponseError(t,a)})}#c(e){let t=this.#e[0];this.#t(t,e),t.on("end",()=>{super.onResponseEnd(e,{})})}#s(e){let t=this.#e[this.#e.length-1];this.#t(t,e),Kae(this.#e,a=>{if(a){super.onResponseError(e,a);return}super.onResponseEnd(e,{})})}#n(){this.#e.length=0}onResponseStart(e,t,a,i){let r=a["content-encoding"];if(this.#i(r,t))return super.onResponseStart(e,t,a,i);let s=this.#r(r.toLowerCase());if(s.length===0)return this.#n(),super.onResponseStart(e,t,a,i);this.#e=s;let{"content-encoding":n,"content-length":c,...m}=a;return this.#e.length===1?this.#c(e):this.#s(e),super.onResponseStart(e,t,m,i)}onResponseData(e,t){if(this.#e.length>0){this.#e[0].write(t);return}super.onResponseData(e,t)}onResponseEnd(e,t){if(this.#e.length>0){this.#e[0].end(),this.#n();return}super.onResponseEnd(e,t)}onResponseError(e,t){if(this.#e.length>0){for(let a of this.#e)a.destroy(t);this.#n()}super.onResponseError(e,t)}};function oie(o={}){return l3||(process.emitWarning("DecompressInterceptor is experimental and subject to change","ExperimentalWarning"),l3=!0),e=>(t,a)=>{let i=new hw(a,o);return e(t,i)}}u3.exports=oie});var h3=y((Mpe,p3)=>{"use strict";var{RequestAbortedError:tie}=$(),g3=5*1024*1024,fw=class{#e;#o=[];#a=g3;#i=0;#r={};#t="";#c=!1;#s=!1;#n=!1;#m=!1;#u=null;#l=null;constructor(e,t,a=g3){this.#e=e,this.#l=t,this.#a=a}addWaitingHandler(e){if(this.#m||this.#n)return!1;let t=this.#d(e),a=t.controller;try{if(e.onRequestStart?.(a,null),a.aborted)return t.done=!0,!0;this.#s&&e.onResponseStart?.(a,this.#i,this.#r,this.#t)}catch{return t.done=!0,!0}return a.aborted||this.#o.push(t),!0}onRequestStart(e,t){this.#u=e,this.#e.onRequestStart?.(e,t)}onRequestUpgrade(e,t,a,i){this.#e.onRequestUpgrade?.(e,t,a,i)}onResponseStart(e,t,a,i){this.#s=!0,this.#i=t,this.#r=a,this.#t=i,this.#e.onResponseStart?.(e,t,a,i);for(let r of this.#o){let{handler:s,controller:n}=r;if(r.done||n.aborted){r.done=!0;continue}try{s.onResponseStart?.(n,t,a,i)}catch{}n.aborted&&(r.done=!0)}this.#h()}onResponseData(e,t){if(!(this.#c||this.#m)){this.#n=!0,this.#e.onResponseData?.(e,t);for(let a of this.#o){let{handler:i,controller:r}=a;if(a.done||r.aborted){a.done=!0;continue}if(r.paused){this.#p(a,t);continue}try{i.onResponseData?.(r,t)}catch{}r.aborted&&(a.done=!0,a.bufferedChunks=[],a.bufferedBytes=0)}this.#h()}}onResponseEnd(e,t){if(!(this.#c||this.#m)){this.#m=!0,this.#e.onResponseEnd?.(e,t);for(let a of this.#o){if(a.done||a.controller.aborted){a.done=!0;continue}if(this.#g(a),a.done||a.controller.aborted){a.done=!0;continue}if(a.controller.paused&&a.bufferedChunks.length>0){a.pendingTrailers=t;continue}try{a.handler.onResponseEnd?.(a.controller,t)}catch{}a.done=!0}this.#h(),this.#l?.()}}onResponseError(e,t){if(!this.#m){this.#c=!0,this.#m=!0,this.#e.onResponseError?.(e,t);for(let a of this.#o)this.#b(a,t);this.#o=[],this.#l?.()}}#d(e){let t={handler:e,controller:null,bufferedChunks:[],bufferedBytes:0,pendingTrailers:null,done:!1},a={aborted:!1,paused:!1,reason:null};return t.controller={resume:()=>{if(!a.aborted){if(a.paused=!1,this.#g(t),this.#m&&t.pendingTrailers&&t.bufferedChunks.length===0&&!a.paused&&!a.aborted){try{t.handler.onResponseEnd?.(t.controller,t.pendingTrailers)}catch{}t.pendingTrailers=null,t.done=!0}this.#h()}},pause:()=>{a.aborted||(a.paused=!0)},get paused(){return a.paused},get aborted(){return a.aborted},get reason(){return a.reason},abort:i=>{a.aborted=!0,a.reason=i??null,t.done=!0,t.pendingTrailers=null,t.bufferedChunks=[],t.bufferedBytes=0}},t}#p(e,t){if(e.done||e.controller.aborted){e.done=!0,e.bufferedChunks=[],e.bufferedBytes=0;return}let a=Buffer.from(t);if(e.bufferedChunks.push(a),e.bufferedBytes+=a.length,e.bufferedBytes>this.#a){let i=new tie(`Deduplicated waiting handler exceeded maxBufferSize (${this.#a} bytes) while paused`);this.#b(e,i)}}#g(e){let{handler:t,controller:a}=e;for(;!e.done&&!a.aborted&&!a.paused&&e.bufferedChunks.length>0;){let i=e.bufferedChunks.shift();e.bufferedBytes-=i.length;try{t.onResponseData?.(a,i)}catch{}if(a.aborted){e.done=!0,e.pendingTrailers=null,e.bufferedChunks=[],e.bufferedBytes=0;break}}}#b(e,t){if(!e.done){e.done=!0,e.pendingTrailers=null,e.bufferedChunks=[],e.bufferedBytes=0;try{e.controller.abort(t),e.handler.onResponseError?.(e.controller,t)}catch{}}}#h(){this.#o=this.#o.filter(e=>e.done===!1)}};p3.exports=fw});var b3=y((_pe,f3)=>{"use strict";var aie=require("diagnostics_channel"),iie=K(),rie=h3(),{normalizeHeaders:sie,makeCacheKey:nie,makeDeduplicationKey:cie}=hn(),sg=aie.channel("undici:request:pending-requests");f3.exports=(o={})=>{let{methods:e=["GET"],skipHeaderNames:t=[],excludeHeaderNames:a=[],maxBufferSize:i=5*1024*1024}=o;if(typeof o!="object"||o===null)throw new TypeError(`expected type of opts to be an Object, got ${o===null?"null":typeof o}`);if(!Array.isArray(e))throw new TypeError(`expected opts.methods to be an array, got ${typeof e}`);for(let c of e)if(!iie.safeHTTPMethods.includes(c))throw new TypeError(`expected opts.methods to only contain safe HTTP methods, got ${c}`);if(!Array.isArray(t))throw new TypeError(`expected opts.skipHeaderNames to be an array, got ${typeof t}`);if(!Array.isArray(a))throw new TypeError(`expected opts.excludeHeaderNames to be an array, got ${typeof a}`);if(!Number.isFinite(i)||i<=0)throw new TypeError(`expected opts.maxBufferSize to be a positive finite number, got ${i}`);let r=new Set(t.map(c=>c.toLowerCase())),s=new Set(a.map(c=>c.toLowerCase())),n=new Map;return c=>(m,l)=>{if(!m.origin||e.includes(m.method)===!1)return c(m,l);if(m={...m,headers:sie(m)},r.size>0){for(let b of Object.keys(m.headers))if(r.has(b.toLowerCase()))return c(m,l)}let u=nie(m),d=cie(u,s),g=n.get(d);if(g)return g.addWaitingHandler(l)?!0:c(m,l);let p=new rie(l,()=>{n.delete(d),sg.hasSubscribers&&sg.publish({size:n.size,key:d,type:"removed"})},i);return n.set(d,p),sg.hasSubscribers&&sg.publish({size:n.size,key:d,type:"added"}),c(m,p)}}});var A3=y((Fpe,k3)=>{"use strict";var{Writable:mie}=require("stream"),{assertCacheKey:bw,assertCacheValue:lie}=hn(),yw,Zo=3,y3=2*1e3*1e3*1e3;k3.exports=class{#e=y3;#o=1/0;#a;#i;#r;#t;#c;#s;#n;#m;constructor(e){if(e){if(typeof e!="object")throw new TypeError("SqliteCacheStore options must be an object");if(e.maxEntrySize!==void 0){if(typeof e.maxEntrySize!="number"||!Number.isInteger(e.maxEntrySize)||e.maxEntrySize<0)throw new TypeError("SqliteCacheStore options.maxEntrySize must be a non-negative integer");if(e.maxEntrySize>y3)throw new TypeError("SqliteCacheStore options.maxEntrySize must be less than 2gb");this.#e=e.maxEntrySize}if(e.maxCount!==void 0){if(typeof e.maxCount!="number"||!Number.isInteger(e.maxCount)||e.maxCount<0)throw new TypeError("SqliteCacheStore options.maxCount must be a non-negative integer");this.#o=e.maxCount}}yw||(yw=require("sqlite").DatabaseSync),this.#a=new yw(e?.location??":memory:"),this.#a.exec(`
|
|
1326
1332
|
PRAGMA journal_mode = WAL;
|
|
1327
1333
|
PRAGMA synchronous = NORMAL;
|
|
1328
1334
|
PRAGMA temp_store = memory;
|
|
@@ -1406,12 +1412,12 @@ ${e.format(t)}`.trim())}};YQ.exports=_A});var FA=y((Ape,JQ)=>{"use strict";var{I
|
|
|
1406
1412
|
LIMIT ?
|
|
1407
1413
|
)
|
|
1408
1414
|
`)}close(){this.#a.close()}get(e){bw(e);let t=this.#d(e);return t?{body:t.body?Buffer.from(t.body.buffer,t.body.byteOffset,t.body.byteLength):void 0,statusCode:t.statusCode,statusMessage:t.statusMessage,headers:t.headers?JSON.parse(t.headers):void 0,etag:t.etag?t.etag:void 0,vary:t.vary?JSON.parse(t.vary):void 0,cacheControlDirectives:t.cacheControlDirectives?JSON.parse(t.cacheControlDirectives):void 0,cachedAt:t.cachedAt,staleAt:t.staleAt,deleteAt:t.deleteAt}:void 0}set(e,t){bw(e);let a=this.#l(e),i=Array.isArray(t.body)?Buffer.concat(t.body):t.body,r=i?.byteLength;if(r&&r>this.#e)return;let s=this.#d(e,!0);s?this.#r.run(i,t.deleteAt,t.statusCode,t.statusMessage,t.headers?JSON.stringify(t.headers):null,t.etag?t.etag:null,t.cacheControlDirectives?JSON.stringify(t.cacheControlDirectives):null,t.cachedAt,t.staleAt,s.id):(this.#t.run(a,e.method,i,t.deleteAt,t.statusCode,t.statusMessage,t.headers?JSON.stringify(t.headers):null,t.etag?t.etag:null,t.cacheControlDirectives?JSON.stringify(t.cacheControlDirectives):null,t.vary?JSON.stringify(t.vary):null,t.cachedAt,t.staleAt),this.#u())}createWriteStream(e,t){bw(e),lie(t);let a=0,i=[],r=this;return new mie({decodeStrings:!0,write(s,n,c){a+=s.byteLength,a<r.#e?i.push(s):this.destroy(),c()},final(s){r.set(e,{...t,body:i}),s()}})}delete(e){if(typeof e!="object")throw new TypeError(`expected key to be object, got ${typeof e}`);this.#s.run(this.#l(e))}#u(){if(Number.isFinite(this.#o)&&this.size<=this.#o)return 0;{let e=this.#c.run(Date.now()).changes;if(e)return e}{let e=this.#m?.run(Math.max(Math.floor(this.#o*.1),1)).changes;if(e)return e}return 0}get size(){let{total:e}=this.#n.get();return e}#l(e){return`${e.origin}/${e.path}`}#d(e,t=!1){let a=this.#l(e),{headers:i,method:r}=e,s=this.#i.all(a,r);if(s.length===0)return;let n=Date.now();for(let c of s){if(n>=c.deleteAt&&!t)continue;let m=!0;if(c.vary){let l=JSON.parse(c.vary);for(let u in l)if(!uie(i[u],l[u])){m=!1;break}}if(m)return c}}};function uie(o,e){if(o==null&&e==null)return!0;if(o==null&&e!=null||o!=null&&e==null)return!1;if(Array.isArray(o)&&Array.isArray(e)){if(o.length!==e.length)return!1;for(let t=0;t<o.length;t++)if(o[t]!==e[t])return!1;return!0}return o===e}});var $r=y((Ppe,I3)=>{"use strict";var{kConstruct:die}=de(),{kEnumerableProperty:yn}=K(),{iteratorMixin:gie,isValidHeaderName:_m,isValidHeaderValue:v3}=Vo(),{webidl:se}=to(),kw=require("assert"),ng=require("util");function w3(o){return o===10||o===13||o===9||o===32}function x3(o){let e=0,t=o.length;for(;t>e&&w3(o.charCodeAt(t-1));)--t;for(;t>e&&w3(o.charCodeAt(e));)++e;return e===0&&t===o.length?o:o.substring(e,t)}function z3(o,e){if(Array.isArray(e))for(let t=0;t<e.length;++t){let a=e[t];if(a.length!==2)throw se.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${a.length}.`});Aw(o,a[0],a[1])}else if(typeof e=="object"&&e!==null){let t=Object.keys(e);for(let a=0;a<t.length;++a)Aw(o,t[a],e[t[a]])}else throw se.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})}function Aw(o,e,t){if(t=x3(t),_m(e)){if(!v3(t))throw se.errors.invalidArgument({prefix:"Headers.append",value:t,type:"header value"})}else throw se.errors.invalidArgument({prefix:"Headers.append",value:e,type:"header name"});if(E3(o)==="immutable")throw new TypeError("immutable");return mg(o).append(e,t,!1)}function pie(o){let e=mg(o);if(!e)return[];if(e.sortedMap)return e.sortedMap;let t=[],a=e.toSortedArray(),i=e.cookies;if(i===null||i.length===1)return e.sortedMap=a;for(let r=0;r<a.length;++r){let{0:s,1:n}=a[r];if(s==="set-cookie")for(let c=0;c<i.length;++c)t.push([s,i[c]]);else t.push([s,n])}return e.sortedMap=t}function q3(o,e){return o[0]<e[0]?-1:1}var cg=class o{cookies=null;sortedMap;headersMap;constructor(e){e instanceof o?(this.headersMap=new Map(e.headersMap),this.sortedMap=e.sortedMap,this.cookies=e.cookies===null?null:[...e.cookies]):(this.headersMap=new Map(e),this.sortedMap=null)}contains(e,t){return this.headersMap.has(t?e:e.toLowerCase())}clear(){this.headersMap.clear(),this.sortedMap=null,this.cookies=null}append(e,t,a){this.sortedMap=null;let i=a?e:e.toLowerCase(),r=this.headersMap.get(i);if(r){let s=i==="cookie"?"; ":", ";this.headersMap.set(i,{name:r.name,value:`${r.value}${s}${t}`})}else this.headersMap.set(i,{name:e,value:t});i==="set-cookie"&&(this.cookies??=[]).push(t)}set(e,t,a){this.sortedMap=null;let i=a?e:e.toLowerCase();i==="set-cookie"&&(this.cookies=[t]),this.headersMap.set(i,{name:e,value:t})}delete(e,t){this.sortedMap=null,t||(e=e.toLowerCase()),e==="set-cookie"&&(this.cookies=null),this.headersMap.delete(e)}get(e,t){return this.headersMap.get(t?e:e.toLowerCase())?.value??null}*[Symbol.iterator](){for(let{0:e,1:{value:t}}of this.headersMap)yield[e,t]}get entries(){let e={};if(this.headersMap.size!==0)for(let{name:t,value:a}of this.headersMap.values())e[t]=a;return e}rawValues(){return this.headersMap.values()}get entriesList(){let e=[];if(this.headersMap.size!==0)for(let{0:t,1:{name:a,value:i}}of this.headersMap)if(t==="set-cookie")for(let r of this.cookies)e.push([a,r]);else e.push([a,i]);return e}toSortedArray(){let e=this.headersMap.size,t=new Array(e);if(e<=32){if(e===0)return t;let a=this.headersMap[Symbol.iterator](),i=a.next().value;t[0]=[i[0],i[1].value],kw(i[1].value!==null);for(let r=1,s=0,n=0,c=0,m=0,l,u;r<e;++r){for(u=a.next().value,l=t[r]=[u[0],u[1].value],kw(l[1]!==null),c=0,n=r;c<n;)m=c+(n-c>>1),t[m][0]<=l[0]?c=m+1:n=m;if(r!==m){for(s=r;s>c;)t[s]=t[--s];t[c]=l}}if(!a.next().done)throw new TypeError("Unreachable");return t}else{let a=0;for(let{0:i,1:{value:r}}of this.headersMap)t[a++]=[i,r],kw(r!==null);return t.sort(q3)}}},Ft=class o{#e;#o;constructor(e=void 0){se.util.markAsUncloneable(this),e!==die&&(this.#o=new cg,this.#e="none",e!==void 0&&(e=se.converters.HeadersInit(e,"Headers constructor","init"),z3(this,e)))}append(e,t){se.brandCheck(this,o),se.argumentLengthCheck(arguments,2,"Headers.append");let a="Headers.append";return e=se.converters.ByteString(e,a,"name"),t=se.converters.ByteString(t,a,"value"),Aw(this,e,t)}delete(e){if(se.brandCheck(this,o),se.argumentLengthCheck(arguments,1,"Headers.delete"),e=se.converters.ByteString(e,"Headers.delete","name"),!_m(e))throw se.errors.invalidArgument({prefix:"Headers.delete",value:e,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#o.contains(e,!1)&&this.#o.delete(e,!1)}get(e){se.brandCheck(this,o),se.argumentLengthCheck(arguments,1,"Headers.get");let t="Headers.get";if(e=se.converters.ByteString(e,t,"name"),!_m(e))throw se.errors.invalidArgument({prefix:t,value:e,type:"header name"});return this.#o.get(e,!1)}has(e){se.brandCheck(this,o),se.argumentLengthCheck(arguments,1,"Headers.has");let t="Headers.has";if(e=se.converters.ByteString(e,t,"name"),!_m(e))throw se.errors.invalidArgument({prefix:t,value:e,type:"header name"});return this.#o.contains(e,!1)}set(e,t){se.brandCheck(this,o),se.argumentLengthCheck(arguments,2,"Headers.set");let a="Headers.set";if(e=se.converters.ByteString(e,a,"name"),t=se.converters.ByteString(t,a,"value"),t=x3(t),_m(e)){if(!v3(t))throw se.errors.invalidArgument({prefix:a,value:t,type:"header value"})}else throw se.errors.invalidArgument({prefix:a,value:e,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#o.set(e,t,!1)}getSetCookie(){se.brandCheck(this,o);let e=this.#o.cookies;return e?[...e]:[]}[ng.inspect.custom](e,t){return t.depth??=e,`Headers ${ng.formatWithOptions(t,this.#o.entries)}`}static getHeadersGuard(e){return e.#e}static setHeadersGuard(e,t){e.#e=t}static getHeadersList(e){return e.#o}static setHeadersList(e,t){e.#o=t}},{getHeadersGuard:E3,setHeadersGuard:hie,getHeadersList:mg,setHeadersList:fie}=Ft;Reflect.deleteProperty(Ft,"getHeadersGuard");Reflect.deleteProperty(Ft,"setHeadersGuard");Reflect.deleteProperty(Ft,"getHeadersList");Reflect.deleteProperty(Ft,"setHeadersList");gie("Headers",Ft,pie,0,1);Object.defineProperties(Ft.prototype,{append:yn,delete:yn,get:yn,has:yn,set:yn,getSetCookie:yn,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[ng.inspect.custom]:{enumerable:!1}});se.converters.HeadersInit=function(o,e,t){if(se.util.Type(o)===se.util.Types.OBJECT){let a=Reflect.get(o,Symbol.iterator);if(!ng.types.isProxy(o)&&a===Ft.prototype.entries)try{return mg(o).entriesList}catch{}return typeof a=="function"?se.converters["sequence<sequence<ByteString>>"](o,e,t,a.bind(o)):se.converters["record<ByteString, ByteString>"](o,e,t)}throw se.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})};I3.exports={fill:z3,compareHeaderName:q3,Headers:Ft,HeadersList:cg,getHeadersGuard:E3,setHeadersGuard:hie,setHeadersList:fie,getHeadersList:mg}});var Fm=y((Hpe,M3)=>{"use strict";var{Headers:D3,HeadersList:C3,fill:bie,getHeadersGuard:yie,setHeadersGuard:T3,setHeadersList:R3}=$r(),{extractBody:j3,cloneBody:kie,mixinBody:Aie,streamRegistry:N3,bodyUnusable:wie}=$s(),U3=K(),B3=require("util"),{kEnumerableProperty:Xo}=U3,{isValidReasonPhrase:vie,isCancelled:xie,isAborted:zie,isErrorLike:qie,environmentSettingsObject:Eie}=Vo(),{redirectStatusSet:Iie,nullBodyStatus:Cie}=Xc(),{webidl:ae}=to(),{URLSerializer:Q3}=bt(),{kConstruct:ug}=de(),ww=require("assert"),{isomorphicEncode:jie,serializeJavascriptValueToJSONString:Bie}=Da(),Qie=new TextEncoder("utf-8"),et=class o{#e;#o;static error(){return Lm(dg(),"immutable")}static json(e,t=void 0){ae.argumentLengthCheck(arguments,1,"Response.json"),t!==null&&(t=ae.converters.ResponseInit(t));let a=Qie.encode(Bie(e)),i=j3(a),r=Lm(kn({}),"response");return S3(r,t,{body:i[0],type:"application/json"}),r}static redirect(e,t=302){ae.argumentLengthCheck(arguments,1,"Response.redirect"),e=ae.converters.USVString(e),t=ae.converters["unsigned short"](t);let a;try{a=new URL(e,Eie.settingsObject.baseUrl)}catch(s){throw new TypeError(`Failed to parse URL from ${e}`,{cause:s})}if(!Iie.has(t))throw new RangeError(`Invalid status code ${t}`);let i=Lm(kn({}),"immutable");i.#o.status=t;let r=jie(Q3(a));return i.#o.headersList.append("location",r,!0),i}constructor(e=null,t=void 0){if(ae.util.markAsUncloneable(this),e===ug)return;e!==null&&(e=ae.converters.BodyInit(e,"Response","body")),t=ae.converters.ResponseInit(t),this.#o=kn({}),this.#e=new D3(ug),T3(this.#e,"response"),R3(this.#e,this.#o.headersList);let a=null;if(e!=null){let[i,r]=j3(e);a={body:i,type:r}}S3(this,t,a)}get type(){return ae.brandCheck(this,o),this.#o.type}get url(){ae.brandCheck(this,o);let e=this.#o.urlList,t=e[e.length-1]??null;return t===null?"":Q3(t,!0)}get redirected(){return ae.brandCheck(this,o),this.#o.urlList.length>1}get status(){return ae.brandCheck(this,o),this.#o.status}get ok(){return ae.brandCheck(this,o),this.#o.status>=200&&this.#o.status<=299}get statusText(){return ae.brandCheck(this,o),this.#o.statusText}get headers(){return ae.brandCheck(this,o),this.#e}get body(){return ae.brandCheck(this,o),this.#o.body?this.#o.body.stream:null}get bodyUsed(){return ae.brandCheck(this,o),!!this.#o.body&&U3.isDisturbed(this.#o.body.stream)}clone(){if(ae.brandCheck(this,o),wie(this.#o))throw ae.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let e=vw(this.#o);return this.#o.urlList.length!==0&&this.#o.body?.stream&&N3.register(this,new WeakRef(this.#o.body.stream)),Lm(e,yie(this.#e))}[B3.inspect.custom](e,t){t.depth===null&&(t.depth=2),t.colors??=!0;let a={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${B3.formatWithOptions(t,a)}`}static getResponseHeaders(e){return e.#e}static setResponseHeaders(e,t){e.#e=t}static getResponseState(e){return e.#o}static setResponseState(e,t){e.#o=t}},{getResponseHeaders:Sie,setResponseHeaders:Die,getResponseState:Wr,setResponseState:Tie}=et;Reflect.deleteProperty(et,"getResponseHeaders");Reflect.deleteProperty(et,"setResponseHeaders");Reflect.deleteProperty(et,"getResponseState");Reflect.deleteProperty(et,"setResponseState");Aie(et,Wr);Object.defineProperties(et.prototype,{type:Xo,url:Xo,status:Xo,ok:Xo,redirected:Xo,statusText:Xo,headers:Xo,clone:Xo,body:Xo,bodyUsed:Xo,[Symbol.toStringTag]:{value:"Response",configurable:!0}});Object.defineProperties(et,{json:Xo,redirect:Xo,error:Xo});function vw(o){if(o.internalResponse)return O3(vw(o.internalResponse),o.type);let e=kn({...o,body:null});return o.body!=null&&(e.body=kie(o.body)),e}function kn(o){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...o,headersList:o?.headersList?new C3(o?.headersList):new C3,urlList:o?.urlList?[...o.urlList]:[]}}function dg(o){let e=qie(o);return kn({type:"error",status:0,error:e?o:new Error(o&&String(o)),aborted:o&&o.name==="AbortError"})}function Rie(o){return o.type==="error"&&o.status===0}function lg(o,e){return e={internalResponse:o,...e},new Proxy(o,{get(t,a){return a in e?e[a]:t[a]},set(t,a,i){return ww(!(a in e)),t[a]=i,!0}})}function O3(o,e){if(e==="basic")return lg(o,{type:"basic",headersList:o.headersList});if(e==="cors")return lg(o,{type:"cors",headersList:o.headersList});if(e==="opaque")return lg(o,{type:"opaque",urlList:[],status:0,statusText:"",body:null});if(e==="opaqueredirect")return lg(o,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});ww(!1)}function Nie(o,e=null){return ww(xie(o)),zie(o)?dg(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:e})):dg(Object.assign(new DOMException("Request was cancelled."),{cause:e}))}function S3(o,e,t){if(e.status!==null&&(e.status<200||e.status>599))throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in e&&e.statusText!=null&&!vie(String(e.statusText)))throw new TypeError("Invalid statusText");if("status"in e&&e.status!=null&&(Wr(o).status=e.status),"statusText"in e&&e.statusText!=null&&(Wr(o).statusText=e.statusText),"headers"in e&&e.headers!=null&&bie(Sie(o),e.headers),t){if(Cie.includes(o.status))throw ae.errors.exception({header:"Response constructor",message:`Invalid response status code ${o.status}`});Wr(o).body=t.body,t.type!=null&&!Wr(o).headersList.contains("content-type",!0)&&Wr(o).headersList.append("content-type",t.type,!0)}}function Lm(o,e){let t=new et(ug);Tie(t,o);let a=new D3(ug);return Die(t,a),R3(a,o.headersList),T3(a,e),o.urlList.length!==0&&o.body?.stream&&N3.register(t,new WeakRef(o.body.stream)),t}ae.converters.XMLHttpRequestBodyInit=function(o,e,t){return typeof o=="string"?ae.converters.USVString(o,e,t):ae.is.Blob(o)||ae.is.BufferSource(o)||ae.is.FormData(o)||ae.is.URLSearchParams(o)?o:ae.converters.DOMString(o,e,t)};ae.converters.BodyInit=function(o,e,t){return ae.is.ReadableStream(o)||o?.[Symbol.asyncIterator]?o:ae.converters.XMLHttpRequestBodyInit(o,e,t)};ae.converters.ResponseInit=ae.dictionaryConverter([{key:"status",converter:ae.converters["unsigned short"],defaultValue:()=>200},{key:"statusText",converter:ae.converters.ByteString,defaultValue:()=>""},{key:"headers",converter:ae.converters.HeadersInit}]);ae.is.Response=ae.util.MakeTypeAssertion(et);M3.exports={isNetworkError:Rie,makeNetworkError:dg,makeResponse:kn,makeAppropriateNetworkError:Nie,filterResponse:O3,Response:et,cloneResponse:vw,fromInnerResponse:Lm,getResponseState:Wr}});var An=y((Gpe,X3)=>{"use strict";var{extractBody:Uie,mixinBody:Oie,cloneBody:Mie,bodyUnusable:_3}=$s(),{Headers:Y3,fill:_ie,HeadersList:hg,setHeadersGuard:xw,getHeadersGuard:Lie,setHeadersList:V3,getHeadersList:L3}=$r(),pg=K(),F3=require("util"),{isValidHTTPToken:Fie,sameOrigin:P3,environmentSettingsObject:gg}=Vo(),{forbiddenMethodsSet:Pie,corsSafeListedMethodsSet:Hie,referrerPolicy:Gie,requestRedirect:Yie,requestMode:Vie,requestCredentials:$ie,requestCache:Wie,requestDuplex:Jie}=Xc(),{kEnumerableProperty:Le,normalizedMethodRecordsBase:Kie,normalizedMethodRecords:Zie}=pg,{webidl:H}=to(),{URLSerializer:Xie}=bt(),{kConstruct:fg}=de(),ere=require("assert"),{getMaxListeners:$3,setMaxListeners:ore,defaultMaxListeners:tre}=require("events"),are=Symbol("abortController"),W3=new FinalizationRegistry(({signal:o,abort:e})=>{o.removeEventListener("abort",e)}),bg=new WeakMap,zw;try{zw=$3(new AbortController().signal)>0}catch{zw=!1}function H3(o){return e;function e(){let t=o.deref();if(t!==void 0){W3.unregister(e),this.removeEventListener("abort",e),t.abort(this.reason);let a=bg.get(t.signal);if(a!==void 0){if(a.size!==0){for(let i of a){let r=i.deref();r!==void 0&&r.abort(this.reason)}a.clear()}bg.delete(t.signal)}}}}var G3=!1,So=class o{#e;#o;#a;#i;constructor(e,t=void 0){if(H.util.markAsUncloneable(this),e===fg)return;H.argumentLengthCheck(arguments,1,"Request constructor"),e=H.converters.RequestInfo(e),t=H.converters.RequestInit(t);let i=null,r=null,s=gg.settingsObject.baseUrl,n=null;if(typeof e=="string"){this.#o=t.dispatcher;let k;try{k=new URL(e,s)}catch(x){throw new TypeError("Failed to parse URL from "+e,{cause:x})}if(k.username||k.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+e);i=yg({urlList:[k]}),r="cors"}else ere(H.is.Request(e)),i=e.#i,n=e.#e,this.#o=t.dispatcher||e.#o;let c=gg.settingsObject.origin,m="client";if(i.window?.constructor?.name==="EnvironmentSettingsObject"&&P3(i.window,c)&&(m=i.window),t.window!=null)throw new TypeError(`'window' option '${m}' must be null`);"window"in t&&(m="no-window"),i=yg({method:i.method,headersList:i.headersList,unsafeRequest:i.unsafeRequest,client:gg.settingsObject,window:m,priority:i.priority,origin:i.origin,referrer:i.referrer,referrerPolicy:i.referrerPolicy,mode:i.mode,credentials:i.credentials,cache:i.cache,redirect:i.redirect,integrity:i.integrity,keepalive:i.keepalive,reloadNavigation:i.reloadNavigation,historyNavigation:i.historyNavigation,urlList:[...i.urlList]});let l=Object.keys(t).length!==0;if(l&&(i.mode==="navigate"&&(i.mode="same-origin"),i.reloadNavigation=!1,i.historyNavigation=!1,i.origin="client",i.referrer="client",i.referrerPolicy="",i.url=i.urlList[i.urlList.length-1],i.urlList=[i.url]),t.referrer!==void 0){let k=t.referrer;if(k==="")i.referrer="no-referrer";else{let x;try{x=new URL(k,s)}catch(v){throw new TypeError(`Referrer "${k}" is not a valid URL.`,{cause:v})}x.protocol==="about:"&&x.hostname==="client"||c&&!P3(x,gg.settingsObject.baseUrl)?i.referrer="client":i.referrer=x}}t.referrerPolicy!==void 0&&(i.referrerPolicy=t.referrerPolicy);let u;if(t.mode!==void 0?u=t.mode:u=r,u==="navigate")throw H.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(u!=null&&(i.mode=u),t.credentials!==void 0&&(i.credentials=t.credentials),t.cache!==void 0&&(i.cache=t.cache),i.cache==="only-if-cached"&&i.mode!=="same-origin")throw new TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(t.redirect!==void 0&&(i.redirect=t.redirect),t.integrity!=null&&(i.integrity=String(t.integrity)),t.keepalive!==void 0&&(i.keepalive=!!t.keepalive),t.method!==void 0){let k=t.method,x=Zie[k];if(x!==void 0)i.method=x;else{if(!Fie(k))throw new TypeError(`'${k}' is not a valid HTTP method.`);let v=k.toUpperCase();if(Pie.has(v))throw new TypeError(`'${k}' HTTP method is unsupported.`);k=Kie[v]??k,i.method=k}!G3&&i.method==="patch"&&(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),G3=!0)}t.signal!==void 0&&(n=t.signal),this.#i=i;let d=new AbortController;if(this.#e=d.signal,n!=null)if(n.aborted)d.abort(n.reason);else{this[are]=d;let k=new WeakRef(d),x=H3(k);zw&&$3(n)===tre&&ore(1500,n),pg.addAbortListener(n,x),W3.register(d,{signal:n,abort:x},x)}if(this.#a=new Y3(fg),V3(this.#a,i.headersList),xw(this.#a,"request"),u==="no-cors"){if(!Hie.has(i.method))throw new TypeError(`'${i.method} is unsupported in no-cors mode.`);xw(this.#a,"request-no-cors")}if(l){let k=L3(this.#a),x=t.headers!==void 0?t.headers:new hg(k);if(k.clear(),x instanceof hg){for(let{name:v,value:j}of x.rawValues())k.append(v,j,!1);k.cookies=x.cookies}else _ie(this.#a,x)}let g=H.is.Request(e)?e.#i.body:null;if((t.body!=null||g!=null)&&(i.method==="GET"||i.method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body.");let p=null;if(t.body!=null){let[k,x]=Uie(t.body,i.keepalive);p=k,x&&!L3(this.#a).contains("content-type",!0)&&this.#a.append("content-type",x,!0)}let b=p??g;if(b!=null&&b.source==null){if(p!=null&&t.duplex==null)throw new TypeError("RequestInit: duplex option is required when sending a body.");if(i.mode!=="same-origin"&&i.mode!=="cors")throw new TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');i.useCORSPreflightFlag=!0}let A=b;if(p==null&&g!=null){if(_3(e.#i))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");let k=new TransformStream;g.stream.pipeThrough(k),A={source:g.source,length:g.length,stream:k.readable}}this.#i.body=A}get method(){return H.brandCheck(this,o),this.#i.method}get url(){return H.brandCheck(this,o),Xie(this.#i.url)}get headers(){return H.brandCheck(this,o),this.#a}get destination(){return H.brandCheck(this,o),this.#i.destination}get referrer(){return H.brandCheck(this,o),this.#i.referrer==="no-referrer"?"":this.#i.referrer==="client"?"about:client":this.#i.referrer.toString()}get referrerPolicy(){return H.brandCheck(this,o),this.#i.referrerPolicy}get mode(){return H.brandCheck(this,o),this.#i.mode}get credentials(){return H.brandCheck(this,o),this.#i.credentials}get cache(){return H.brandCheck(this,o),this.#i.cache}get redirect(){return H.brandCheck(this,o),this.#i.redirect}get integrity(){return H.brandCheck(this,o),this.#i.integrity}get keepalive(){return H.brandCheck(this,o),this.#i.keepalive}get isReloadNavigation(){return H.brandCheck(this,o),this.#i.reloadNavigation}get isHistoryNavigation(){return H.brandCheck(this,o),this.#i.historyNavigation}get signal(){return H.brandCheck(this,o),this.#e}get body(){return H.brandCheck(this,o),this.#i.body?this.#i.body.stream:null}get bodyUsed(){return H.brandCheck(this,o),!!this.#i.body&&pg.isDisturbed(this.#i.body.stream)}get duplex(){return H.brandCheck(this,o),"half"}clone(){if(H.brandCheck(this,o),_3(this.#i))throw new TypeError("unusable");let e=K3(this.#i),t=new AbortController;if(this.signal.aborted)t.abort(this.signal.reason);else{let a=bg.get(this.signal);a===void 0&&(a=new Set,bg.set(this.signal,a));let i=new WeakRef(t);a.add(i),pg.addAbortListener(t.signal,H3(i))}return Z3(e,this.#o,t.signal,Lie(this.#a))}[F3.inspect.custom](e,t){t.depth===null&&(t.depth=2),t.colors??=!0;let a={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${F3.formatWithOptions(t,a)}`}static setRequestSignal(e,t){return e.#e=t,e}static getRequestDispatcher(e){return e.#o}static setRequestDispatcher(e,t){e.#o=t}static setRequestHeaders(e,t){e.#a=t}static getRequestState(e){return e.#i}static setRequestState(e,t){e.#i=t}},{setRequestSignal:ire,getRequestDispatcher:rre,setRequestDispatcher:sre,setRequestHeaders:nre,getRequestState:J3,setRequestState:cre}=So;Reflect.deleteProperty(So,"setRequestSignal");Reflect.deleteProperty(So,"getRequestDispatcher");Reflect.deleteProperty(So,"setRequestDispatcher");Reflect.deleteProperty(So,"setRequestHeaders");Reflect.deleteProperty(So,"getRequestState");Reflect.deleteProperty(So,"setRequestState");Oie(So,J3);function yg(o){return{method:o.method??"GET",localURLsOnly:o.localURLsOnly??!1,unsafeRequest:o.unsafeRequest??!1,body:o.body??null,client:o.client??null,reservedClient:o.reservedClient??null,replacesClientId:o.replacesClientId??"",window:o.window??"client",keepalive:o.keepalive??!1,serviceWorkers:o.serviceWorkers??"all",initiator:o.initiator??"",destination:o.destination??"",priority:o.priority??null,origin:o.origin??"client",policyContainer:o.policyContainer??"client",referrer:o.referrer??"client",referrerPolicy:o.referrerPolicy??"",mode:o.mode??"no-cors",useCORSPreflightFlag:o.useCORSPreflightFlag??!1,credentials:o.credentials??"same-origin",useCredentials:o.useCredentials??!1,cache:o.cache??"default",redirect:o.redirect??"follow",integrity:o.integrity??"",cryptoGraphicsNonceMetadata:o.cryptoGraphicsNonceMetadata??"",parserMetadata:o.parserMetadata??"",reloadNavigation:o.reloadNavigation??!1,historyNavigation:o.historyNavigation??!1,userActivation:o.userActivation??!1,taintedOrigin:o.taintedOrigin??!1,redirectCount:o.redirectCount??0,responseTainting:o.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:o.preventNoCacheCacheControlHeaderModification??!1,done:o.done??!1,timingAllowFailed:o.timingAllowFailed??!1,useURLCredentials:o.useURLCredentials??void 0,traversableForUserPrompts:o.traversableForUserPrompts??"client",urlList:o.urlList,url:o.urlList[0],headersList:o.headersList?new hg(o.headersList):new hg}}function K3(o){let e=yg({...o,body:null});return o.body!=null&&(e.body=Mie(o.body)),e}function Z3(o,e,t,a){let i=new So(fg);cre(i,o),sre(i,e),ire(i,t);let r=new Y3(fg);return nre(i,r),V3(r,o.headersList),xw(r,a),i}Object.defineProperties(So.prototype,{method:Le,url:Le,headers:Le,redirect:Le,clone:Le,signal:Le,duplex:Le,destination:Le,body:Le,bodyUsed:Le,isHistoryNavigation:Le,isReloadNavigation:Le,keepalive:Le,integrity:Le,cache:Le,credentials:Le,attribute:Le,referrerPolicy:Le,referrer:Le,mode:Le,[Symbol.toStringTag]:{value:"Request",configurable:!0}});H.is.Request=H.util.MakeTypeAssertion(So);H.converters.RequestInfo=function(o){return typeof o=="string"?H.converters.USVString(o):H.is.Request(o)?o:H.converters.USVString(o)};H.converters.RequestInit=H.dictionaryConverter([{key:"method",converter:H.converters.ByteString},{key:"headers",converter:H.converters.HeadersInit},{key:"body",converter:H.nullableConverter(H.converters.BodyInit)},{key:"referrer",converter:H.converters.USVString},{key:"referrerPolicy",converter:H.converters.DOMString,allowedValues:Gie},{key:"mode",converter:H.converters.DOMString,allowedValues:Vie},{key:"credentials",converter:H.converters.DOMString,allowedValues:$ie},{key:"cache",converter:H.converters.DOMString,allowedValues:Wie},{key:"redirect",converter:H.converters.DOMString,allowedValues:Yie},{key:"integrity",converter:H.converters.DOMString},{key:"keepalive",converter:H.converters.boolean},{key:"signal",converter:H.nullableConverter(o=>H.converters.AbortSignal(o,"RequestInit","signal"))},{key:"window",converter:H.converters.any},{key:"duplex",converter:H.converters.DOMString,allowedValues:Jie},{key:"dispatcher",converter:H.converters.any},{key:"priority",converter:H.converters.DOMString,allowedValues:["high","low","auto"],defaultValue:()=>"auto"}]);X3.exports={Request:So,makeRequest:yg,fromInnerRequest:Z3,cloneRequest:K3,getRequestDispatcher:rre,getRequestState:J3}});var n9=y((Ype,s9)=>{"use strict";var mre=require("assert"),{runtimeFeatures:o9}=Ta(),Jr=new Map([["sha256",0],["sha384",1],["sha512",2]]),qw;if(o9.has("crypto")){qw=require("crypto");let o=qw.getHashes();o.length===0&&Jr.clear();for(let e of Jr.keys())o.includes(e)===!1&&Jr.delete(e)}else Jr.clear();var e9=Map.prototype.get.bind(Jr),Ew=Map.prototype.has.bind(Jr),lre=o9.has("crypto")===!1||Jr.size===0?()=>!0:(o,e)=>{let t=a9(e);if(t.length===0)return!0;let a=t9(t);for(let i of a){let r=i.alg,s=i.val,n=i9(r,o);if(r9(n,s))return!0}return!1};function t9(o){let e=[],t=null;for(let a of o){if(mre(Ew(a.alg),"Invalid SRI hash algorithm token"),e.length===0){e.push(a),t=a;continue}let i=t.alg,r=e9(i),s=a.alg,n=e9(s);n<r||(n>r?(t=a,e[0]=a,e.length=1):e.push(a))}return e}function a9(o){let e=[];for(let t of o.split(" ")){let i=t.split("?",1)[0],r="",s=[i.slice(0,6),i.slice(7)],n=s[0];if(!Ew(n))continue;s[1]&&(r=s[1]);let c={alg:n,val:r};e.push(c)}return e}var i9=(o,e)=>qw.hash(o,e,"base64");function r9(o,e){let t=o.length;t!==0&&o[t-1]==="="&&(t-=1),t!==0&&o[t-1]==="="&&(t-=1);let a=e.length;if(a!==0&&e[a-1]==="="&&(a-=1),a!==0&&e[a-1]==="="&&(a-=1),t!==a)return!1;for(let i=0;i<t;++i)if(!(o[i]===e[i]||o[i]==="+"&&e[i]==="-"||o[i]==="/"&&e[i]==="_"))return!1;return!0}s9.exports={applyAlgorithmToBytes:i9,bytesMatch:lre,caseSensitiveMatch:r9,isValidSRIHashAlgorithm:Ew,getStrongestMetadata:t9,parseMetadata:a9}});var Gm=y((Vpe,w9)=>{"use strict";var{makeNetworkError:pe,makeAppropriateNetworkError:Pm,filterResponse:Iw,makeResponse:kg,fromInnerResponse:ure,getResponseState:dre}=Fm(),{HeadersList:Cw}=$r(),{Request:gre,cloneRequest:pre,getRequestDispatcher:hre,getRequestState:fre}=An(),Pt=require("zlib"),{makePolicyContainer:bre,clonePolicyContainer:yre,requestBadPort:kre,TAOCheck:Are,appendRequestOriginHeader:wre,responseLocationURL:vre,requestCurrentURL:ot,setRequestReferrerPolicyOnRedirect:xre,tryUpgradeRequestToAPotentiallyTrustworthyURL:zre,createOpaqueTimingInfo:Tw,appendFetchMetadata:qre,corsCheck:Ere,crossOriginResourcePolicyCheck:Ire,determineRequestsReferrer:Cre,coarsenedSharedCurrentTime:Hm,sameOrigin:Sw,isCancelled:Oi,isAborted:c9,isErrorLike:jre,fullyReadBody:Bre,readableStreamClose:Qre,urlIsLocal:Sre,urlIsHttpHttpsScheme:xg,urlHasHttpsScheme:Dre,clampAndCoarsenConnectionTimingInfo:Tre,simpleRangeHeaderValue:Rre,buildContentRange:Nre,createInflate:Ure,extractMimeType:Ore,hasAuthenticationEntry:Mre,includesCredentials:m9,isTraversableNavigable:_re}=Vo(),Kr=require("assert"),{safelyExtractBody:zg,extractBody:l9}=$s(),{redirectStatusSet:p9,nullBodyStatus:h9,safeMethodsSet:Lre,requestBodyHeader:Fre,subresourceSet:Pre}=Xc(),Hre=require("events"),{Readable:Gre,pipeline:Yre,finished:Vre,isErrored:$re,isReadable:Ag}=require("stream"),{addAbortListener:Wre,bufferToLowerCasedHeaderName:u9}=K(),{dataURLProcessor:Jre,serializeAMimeType:Kre,minimizeSupportedMimeType:Zre}=bt(),{getGlobalDispatcher:Xre}=ag(),{webidl:Rw}=to(),{STATUS_CODES:d9}=require("http"),{bytesMatch:ese}=n9(),{createDeferredPromise:ose}=im(),{isomorphicEncode:wg}=Da(),{runtimeFeatures:tse}=Ta(),ase=tse.has("zstd"),ise=["GET","HEAD"],rse=typeof __UNDICI_IS_NODE__<"u"||typeof esbuildDetection<"u"?"node":"undici",jw,vg=class extends Hre{constructor(e){super(),this.dispatcher=e,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(e){this.state==="ongoing"&&(this.state="terminated",this.connection?.destroy(e),this.emit("terminated",e))}abort(e){this.state==="ongoing"&&(this.state="aborted",e||(e=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=e,this.connection?.destroy(e),this.emit("terminated",e))}};function sse(o){f9(o,"fetch")}function nse(o,e=void 0){Rw.argumentLengthCheck(arguments,1,"globalThis.fetch");let t=ose(),a;try{a=new gre(o,e)}catch(l){return t.reject(l),t.promise}let i=fre(a);if(a.signal.aborted)return Bw(t,i,null,a.signal.reason,null),t.promise;i.client.globalObject?.constructor?.name==="ServiceWorkerGlobalScope"&&(i.serviceWorkers="none");let s=null,n=!1,c=null;return Wre(a.signal,()=>{n=!0,Kr(c!=null),c.abort(a.signal.reason);let l=s?.deref();Bw(t,i,l,a.signal.reason,c.controller)}),c=y9({request:i,processResponseEndOfBody:sse,processResponse:l=>{if(!n){if(l.aborted){Bw(t,i,s,c.serializedAbortReason,c.controller);return}if(l.type==="error"){t.reject(new TypeError("fetch failed",{cause:l.error}));return}s=new WeakRef(ure(l,"immutable")),t.resolve(s.deref()),t=null}},dispatcher:hre(a),requestObject:a}),t.promise}function f9(o,e="other"){if(o.type==="error"&&o.aborted||!o.urlList?.length)return;let t=o.urlList[0],a=o.timingInfo,i=o.cacheState;xg(t)&&a!==null&&(o.timingAllowPassed||(a=Tw({startTime:a.startTime}),i=""),a.endTime=Hm(),o.timingInfo=a,b9(a,t.href,e,globalThis,i,"",o.status))}var b9=performance.markResourceTiming;function Bw(o,e,t,a,i){if(o&&o.reject(a),e.body?.stream!=null&&Ag(e.body.stream)&&e.body.stream.cancel(a).catch(s=>{if(s.code!=="ERR_INVALID_STATE")throw s}),t==null)return;let r=dre(t);r.body?.stream!=null&&Ag(r.body.stream)&&i.error(a)}function y9({request:o,processRequestBodyChunkLength:e,processRequestEndOfBody:t,processResponse:a,processResponseEndOfBody:i,processResponseConsumeBody:r,useParallelQueue:s=!1,dispatcher:n=Xre(),requestObject:c=null}){Kr(n);let m=null,l=!1;o.client!=null&&(m=o.client.globalObject,l=o.client.crossOriginIsolatedCapability);let u=Hm(l),d=Tw({startTime:u}),g={controller:new vg(n),request:o,timingInfo:d,processRequestBodyChunkLength:e,processRequestEndOfBody:t,processResponse:a,processResponseConsumeBody:r,processResponseEndOfBody:i,taskDestination:m,crossOriginIsolatedCapability:l,requestObject:c};return Kr(!o.body||o.body.stream),o.window==="client"&&(o.window=o.client?.globalObject?.constructor?.name==="Window"?o.client:"no-window"),o.origin==="client"&&(o.origin=o.client.origin),o.policyContainer==="client"&&(o.client!=null?o.policyContainer=yre(o.client.policyContainer):o.policyContainer=bre()),o.headersList.contains("accept",!0)||o.headersList.append("accept","*/*",!0),o.headersList.contains("accept-language",!0)||o.headersList.append("accept-language","*",!0),o.priority,Pre.has(o.destination),k9(g,!1),g.controller}async function k9(o,e){try{let t=o.request,a=null;if(t.localURLsOnly&&!Sre(ot(t))&&(a=pe("local URLs only")),zre(t),kre(t)==="blocked"&&(a=pe("bad port")),t.referrerPolicy===""&&(t.referrerPolicy=t.policyContainer.referrerPolicy),t.referrer!=="no-referrer"&&(t.referrer=Cre(t)),a===null){let r=ot(t);Sw(r,t.url)&&t.responseTainting==="basic"||r.protocol==="data:"||t.mode==="navigate"||t.mode==="websocket"?(t.responseTainting="basic",a=await g9(o)):t.mode==="same-origin"?a=pe('request mode cannot be "same-origin"'):t.mode==="no-cors"?t.redirect!=="follow"?a=pe('redirect mode cannot be "follow" for "no-cors" request'):(t.responseTainting="opaque",a=await g9(o)):xg(ot(t))?(t.responseTainting="cors",a=await A9(o)):a=pe("URL scheme must be a HTTP(S) scheme")}if(e)return a;a.status!==0&&!a.internalResponse&&(t.responseTainting,t.responseTainting==="basic"?a=Iw(a,"basic"):t.responseTainting==="cors"?a=Iw(a,"cors"):t.responseTainting==="opaque"?a=Iw(a,"opaque"):Kr(!1));let i=a.status===0?a:a.internalResponse;if(i.urlList.length===0&&i.urlList.push(...t.urlList),t.timingAllowFailed||(a.timingAllowPassed=!0),a.type==="opaque"&&i.status===206&&i.rangeRequested&&!t.headers.contains("range",!0)&&(a=i=pe()),a.status!==0&&(t.method==="HEAD"||t.method==="CONNECT"||h9.includes(i.status))&&(i.body=null,o.controller.dump=!0),t.integrity){let r=n=>Qw(o,pe(n));if(t.responseTainting==="opaque"||a.body==null){r(a.error);return}let s=n=>{if(!ese(n,t.integrity)){r("integrity mismatch");return}a.body=zg(n)[0],Qw(o,a)};Bre(a.body,s,r)}else Qw(o,a)}catch(t){o.controller.terminate(t)}}function g9(o){if(Oi(o)&&o.request.redirectCount===0)return Promise.resolve(Pm(o));let{request:e}=o,{protocol:t}=ot(e);switch(t){case"about:":return Promise.resolve(pe("about scheme is not supported"));case"blob:":{jw||(jw=require("buffer").resolveObjectURL);let a=ot(e);if(a.search.length!==0)return Promise.resolve(pe("NetworkError when attempting to fetch resource."));let i=jw(a.toString());if(e.method!=="GET"||!Rw.is.Blob(i))return Promise.resolve(pe("invalid method"));let r=kg(),s=i.size,n=wg(`${s}`),c=i.type;if(e.headersList.contains("range",!0)){r.rangeRequested=!0;let m=e.headersList.get("range",!0),l=Rre(m,!0);if(l==="failure")return Promise.resolve(pe("failed to fetch the data URL"));let{rangeStartValue:u,rangeEndValue:d}=l;if(u===null)u=s-d,d=u+d-1;else{if(u>=s)return Promise.resolve(pe("Range start is greater than the blob's size."));(d===null||d>=s)&&(d=s-1)}let g=i.slice(u,d+1,c),p=l9(g);r.body=p[0];let b=wg(`${g.size}`),A=Nre(u,d,s);r.status=206,r.statusText="Partial Content",r.headersList.set("content-length",b,!0),r.headersList.set("content-type",c,!0),r.headersList.set("content-range",A,!0)}else{let m=l9(i);r.statusText="OK",r.body=m[0],r.headersList.set("content-length",n,!0),r.headersList.set("content-type",c,!0)}return Promise.resolve(r)}case"data:":{let a=ot(e),i=Jre(a);if(i==="failure")return Promise.resolve(pe("failed to fetch the data URL"));let r=Kre(i.mimeType);return Promise.resolve(kg({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:r}]],body:zg(i.body)[0]}))}case"file:":return Promise.resolve(pe("not implemented... yet..."));case"http:":case"https:":return A9(o).catch(a=>pe(a));default:return Promise.resolve(pe("unknown scheme"))}}function cse(o,e){o.request.done=!0,o.processResponseDone!=null&&queueMicrotask(()=>o.processResponseDone(e))}function Qw(o,e){let t=o.timingInfo,a=()=>{let r=Date.now();o.request.destination==="document"&&(o.controller.fullTimingInfo=t),o.controller.reportTimingSteps=()=>{if(!xg(o.request.url))return;t.endTime=r;let n=e.cacheState,c=e.bodyInfo;e.timingAllowPassed||(t=Tw(t),n="");let m=0;if(o.request.mode!=="navigate"||!e.hasCrossOriginRedirects){m=e.status;let l=Ore(e.headersList);l!=="failure"&&(c.contentType=Zre(l))}o.request.initiatorType!=null&&b9(t,o.request.url.href,o.request.initiatorType,globalThis,n,c,m)};let s=()=>{o.request.done=!0,o.processResponseEndOfBody!=null&&queueMicrotask(()=>o.processResponseEndOfBody(e)),o.request.initiatorType!=null&&o.controller.reportTimingSteps()};queueMicrotask(()=>s())};o.processResponse!=null&&queueMicrotask(()=>{o.processResponse(e),o.processResponse=null});let i=e.type==="error"?e:e.internalResponse??e;i.body==null?a():Vre(i.body.stream,()=>{a()})}async function A9(o){let e=o.request,t=null,a=null,i=o.timingInfo;if(e.serviceWorkers,t===null){if(e.redirect==="follow"&&(e.serviceWorkers="none"),a=t=await Dw(o),e.responseTainting==="cors"&&Ere(e,t)==="failure")return pe("cors failure");Are(e,t)==="failure"&&(e.timingAllowFailed=!0)}return(e.responseTainting==="opaque"||t.type==="opaque")&&Ire(e.origin,e.client,e.destination,a)==="blocked"?pe("blocked"):(p9.has(a.status)&&(e.redirect!=="manual"&&o.controller.connection.destroy(void 0,!1),e.redirect==="error"?t=pe("unexpected redirect"):e.redirect==="manual"?t=a:e.redirect==="follow"?t=await mse(o,t):Kr(!1)),t.timingInfo=i,t)}function mse(o,e){let t=o.request,a=e.internalResponse?e.internalResponse:e,i;try{if(i=vre(a,ot(t).hash),i==null)return e}catch(s){return Promise.resolve(pe(s))}if(!xg(i))return Promise.resolve(pe("URL scheme must be a HTTP(S) scheme"));if(t.redirectCount===20)return Promise.resolve(pe("redirect count exceeded"));if(t.redirectCount+=1,t.mode==="cors"&&(i.username||i.password)&&!Sw(t,i))return Promise.resolve(pe('cross origin not allowed for request mode "cors"'));if(t.responseTainting==="cors"&&(i.username||i.password))return Promise.resolve(pe('URL cannot contain credentials for request mode "cors"'));if(a.status!==303&&t.body!=null&&t.body.source==null)return Promise.resolve(pe());if([301,302].includes(a.status)&&t.method==="POST"||a.status===303&&!ise.includes(t.method)){t.method="GET",t.body=null;for(let s of Fre)t.headersList.delete(s)}Sw(ot(t),i)||(t.headersList.delete("authorization",!0),t.headersList.delete("proxy-authorization",!0),t.headersList.delete("cookie",!0),t.headersList.delete("host",!0)),t.body!=null&&(Kr(t.body.source!=null),t.body=zg(t.body.source)[0]);let r=o.timingInfo;return r.redirectEndTime=r.postRedirectStartTime=Hm(o.crossOriginIsolatedCapability),r.redirectStartTime===0&&(r.redirectStartTime=r.startTime),t.urlList.push(i),xre(t,a),k9(o,!0)}async function Dw(o,e=!1,t=!1){let a=o.request,i=null,r=null,s=null,n=null,c=!1;a.window==="no-window"&&a.redirect==="error"?(i=o,r=a):(r=pre(a),i={...o},i.request=r);let m=a.credentials==="include"||a.credentials==="same-origin"&&a.responseTainting==="basic",l=r.body?r.body.length:null,u=null;if(r.body==null&&["POST","PUT"].includes(r.method)&&(u="0"),l!=null&&(u=wg(`${l}`)),u!=null&&!r.headersList.contains("content-length",!0)&&r.headersList.append("content-length",u,!0),l!=null&&r.keepalive,Rw.is.URL(r.referrer)&&r.headersList.append("referer",wg(r.referrer.href),!0),wre(r),qre(r),r.headersList.contains("user-agent",!0)||r.headersList.append("user-agent",rse,!0),r.cache==="default"&&(r.headersList.contains("if-modified-since",!0)||r.headersList.contains("if-none-match",!0)||r.headersList.contains("if-unmodified-since",!0)||r.headersList.contains("if-match",!0)||r.headersList.contains("if-range",!0))&&(r.cache="no-store"),r.cache==="no-cache"&&!r.preventNoCacheCacheControlHeaderModification&&!r.headersList.contains("cache-control",!0)&&r.headersList.append("cache-control","max-age=0",!0),(r.cache==="no-store"||r.cache==="reload")&&(r.headersList.contains("pragma",!0)||r.headersList.append("pragma","no-cache",!0),r.headersList.contains("cache-control",!0)||r.headersList.append("cache-control","no-cache",!0)),r.headersList.contains("range",!0)&&r.headersList.append("accept-encoding","identity",!0),r.headersList.contains("accept-encoding",!0)||(Dre(ot(r))?r.headersList.append("accept-encoding","br, gzip, deflate",!0):r.headersList.append("accept-encoding","gzip, deflate",!0)),r.headersList.delete("host",!0),m&&!r.headersList.contains("authorization",!0)){let d=null;if(!(Mre(r)&&(r.useURLCredentials===void 0||!m9(ot(r))))){if(m9(ot(r))&&e){let{username:g,password:p}=ot(r);d=`Basic ${Buffer.from(`${g}:${p}`).toString("base64")}`}}d!==null&&r.headersList.append("Authorization",d,!1)}if(n==null&&(r.cache="no-store"),r.cache!=="no-store"&&r.cache,s==null){if(r.cache==="only-if-cached")return pe("only if cached");let d=await lse(i,m,t);!Lre.has(r.method)&&d.status>=200&&d.status<=399,c&&d.status,s==null&&(s=d)}if(s.urlList=[...r.urlList],r.headersList.contains("range",!0)&&(s.rangeRequested=!0),s.requestIncludesCredentials=m,s.status===401&&r.responseTainting!=="cors"&&m&&(a.useURLCredentials!==void 0||_re(a.traversableForUserPrompts))){if(a.body!=null){if(a.body.source==null)return s;a.body=zg(a.body.source)[0]}if(a.useURLCredentials===void 0||e)return Oi(o)?Pm(o):s;o.controller.connection.destroy(),s=await Dw(o,!0)}if(s.status===407)return a.window==="no-window"?pe():Oi(o)?Pm(o):pe("proxy authentication required");if(s.status===421&&!t&&(a.body==null||a.body.source!=null)){if(Oi(o))return Pm(o);o.controller.connection.destroy(),s=await Dw(o,e,!0)}return s}async function lse(o,e=!1,t=!1){Kr(!o.controller.connection||o.controller.connection.destroyed),o.controller.connection={abort:null,destroyed:!1,destroy(p,b=!0){this.destroyed||(this.destroyed=!0,b&&this.abort?.(p??new DOMException("The operation was aborted.","AbortError")))}};let a=o.request,i=null,r=o.timingInfo;null==null&&(a.cache="no-store");let n=t?"yes":"no";a.mode;let c=null;if(a.body==null&&o.processRequestEndOfBody)queueMicrotask(()=>o.processRequestEndOfBody());else if(a.body!=null){let p=async function*(k){Oi(o)||(yield k,o.processRequestBodyChunkLength?.(k.byteLength))},b=()=>{Oi(o)||o.processRequestEndOfBody&&o.processRequestEndOfBody()},A=k=>{Oi(o)||(k.name==="AbortError"?o.controller.abort():o.controller.terminate(k))};c=(async function*(){try{for await(let k of a.body.stream)yield*p(k);b()}catch(k){A(k)}})()}try{let{body:p,status:b,statusText:A,headersList:k,socket:x}=await g({body:c});if(x)i=kg({status:b,statusText:A,headersList:k,socket:x});else{let v=p[Symbol.asyncIterator]();o.controller.next=()=>v.next(),i=kg({status:b,statusText:A,headersList:k})}}catch(p){return p.name==="AbortError"?(o.controller.connection.destroy(),Pm(o,p)):pe(p)}let m=()=>o.controller.resume(),l=p=>{Oi(o)||o.controller.abort(p)},u=new ReadableStream({start(p){o.controller.controller=p},pull:m,cancel:l,type:"bytes"});i.body={stream:u,source:null,length:null},o.controller.resume||o.controller.on("terminated",d),o.controller.resume=async()=>{for(;;){let p,b;try{let{done:k,value:x}=await o.controller.next();if(c9(o))break;p=k?void 0:x}catch(k){o.controller.ended&&!r.encodedBodySize?p=void 0:(p=k,b=!0)}if(p===void 0){Qre(o.controller.controller),cse(o,i);return}if(r.decodedBodySize+=p?.byteLength??0,b){o.controller.terminate(p);return}let A=new Uint8Array(p);if(A.byteLength&&o.controller.controller.enqueue(A),$re(u)){o.controller.terminate();return}if(o.controller.controller.desiredSize<=0)return}};function d(p){c9(o)?(i.aborted=!0,Ag(u)&&o.controller.controller.error(o.controller.serializedAbortReason)):Ag(u)&&o.controller.controller.error(new TypeError("terminated",{cause:jre(p)?p:void 0})),o.controller.connection.destroy()}return i;function g({body:p}){let b=ot(a),A=o.controller.dispatcher,k=b.pathname+b.search,x=b.search.length===0&&b.href[b.href.length-b.hash.length-1]==="?";return new Promise((v,j)=>A.dispatch({path:x?`${k}?`:k,origin:b.origin,method:a.method,body:A.isMockActive?a.body&&(a.body.source||a.body.stream):p,headers:a.headersList.entries,maxRedirections:0,upgrade:a.mode==="websocket"?"websocket":void 0},{body:null,abort:null,onConnect(I){let{connection:T}=o.controller;r.finalConnectionTimingInfo=Tre(void 0,r.postRedirectStartTime,o.crossOriginIsolatedCapability),T.destroyed?I(new DOMException("The operation was aborted.","AbortError")):(o.controller.on("terminated",I),this.abort=T.abort=I),r.finalNetworkRequestStartTime=Hm(o.crossOriginIsolatedCapability)},onResponseStarted(){r.finalNetworkResponseStartTime=Hm(o.crossOriginIsolatedCapability)},onHeaders(I,T,D,O){if(I<200)return!1;let S=new Cw;for(let Ve=0;Ve<T.length;Ve+=2){let ya=u9(T[Ve]),it=T[Ve+1];if(Array.isArray(it)&&!Buffer.isBuffer(T[Ve+1]))for(let Wi of it)S.append(ya,Wi.toString("latin1"),!0);else S.append(ya,it.toString("latin1"),!0)}let oe=S.get("location",!0);this.body=new Gre({read:D});let te=oe&&a.redirect==="follow"&&p9.has(I),ye=[];if(a.method!=="HEAD"&&a.method!=="CONNECT"&&!h9.includes(I)&&!te){let Ve=S.get("content-encoding",!0),ya=Ve?Ve.toLowerCase().split(","):[],it=5;if(ya.length>it)return j(new Error(`too many content-encodings in response: ${ya.length}, maximum allowed is ${it}`)),!0;for(let Wi=ya.length-1;Wi>=0;--Wi){let Ji=ya[Wi].trim();if(Ji==="x-gzip"||Ji==="gzip")ye.push(Pt.createGunzip({flush:Pt.constants.Z_SYNC_FLUSH,finishFlush:Pt.constants.Z_SYNC_FLUSH}));else if(Ji==="deflate")ye.push(Ure({flush:Pt.constants.Z_SYNC_FLUSH,finishFlush:Pt.constants.Z_SYNC_FLUSH}));else if(Ji==="br")ye.push(Pt.createBrotliDecompress({flush:Pt.constants.BROTLI_OPERATION_FLUSH,finishFlush:Pt.constants.BROTLI_OPERATION_FLUSH}));else if(Ji==="zstd"&&ase)ye.push(Pt.createZstdDecompress({flush:Pt.constants.ZSTD_e_continue,finishFlush:Pt.constants.ZSTD_e_end}));else{ye.length=0;break}}}let po=this.onError.bind(this);return v({status:I,statusText:O,headersList:S,body:ye.length?Yre(this.body,...ye,Ve=>{Ve&&this.onError(Ve)}).on("error",po):this.body.on("error",po)}),!0},onData(I){if(o.controller.dump)return;let T=I;return r.encodedBodySize+=T.byteLength,this.body.push(T)},onComplete(){this.abort&&o.controller.off("terminated",this.abort),o.controller.ended=!0,this.body.push(null)},onError(I){this.abort&&o.controller.off("terminated",this.abort),this.body?.destroy(I),o.controller.terminate(I),j(I)},onRequestUpgrade(I,T,D,O){if(O.session!=null&&T!==200||O.session==null&&T!==101)return!1;let S=new Cw;for(let[oe,te]of Object.entries(D)){if(te==null)continue;let ye=oe.toLowerCase();if(Array.isArray(te))for(let po of te)S.append(ye,String(po),!0);else S.append(ye,String(te),!0)}return v({status:T,statusText:d9[T],headersList:S,socket:O}),!0},onUpgrade(I,T,D){if(D.session!=null&&I!==200||D.session==null&&I!==101)return!1;let O=new Cw;for(let S=0;S<T.length;S+=2){let oe=u9(T[S]),te=T[S+1];if(Array.isArray(te)&&!Buffer.isBuffer(T[S+1]))for(let ye of te)O.append(oe,ye.toString("latin1"),!0);else O.append(oe,te.toString("latin1"),!0)}return v({status:I,statusText:d9[I],headersList:O,socket:D}),!0}}))}}w9.exports={fetch:nse,Fetch:vg,fetching:y9,finalizeAndReportTiming:f9}});var z9=y(($pe,x9)=>{"use strict";var use=require("assert"),{URLSerializer:v9}=bt(),{isValidHeaderName:dse}=Vo();function gse(o,e,t=!1){let a=v9(o,t),i=v9(e,t);return a===i}function pse(o){use(o!==null);let e=[];for(let t of o.split(","))t=t.trim(),dse(t)&&e.push(t);return e}x9.exports={urlEquals:gse,getFieldValues:pse}});var C9=y((Wpe,I9)=>{"use strict";var Nw=require("assert"),{kConstruct:hse}=de(),{urlEquals:fse,getFieldValues:Uw}=z9(),{kEnumerableProperty:Zr,isDisturbed:bse}=K(),{webidl:R}=to(),{cloneResponse:q9,fromInnerResponse:yse,getResponseState:kse}=Fm(),{Request:Ym,fromInnerRequest:Ase,getRequestState:ua}=An(),{fetching:wse}=Gm(),{urlIsHttpHttpsScheme:qg,readAllBytes:vse}=Vo(),{createDeferredPromise:wn}=im(),Eg=class o{#e;constructor(){arguments[0]!==hse&&R.illegalConstructor(),R.util.markAsUncloneable(this),this.#e=arguments[1]}async match(e,t={}){R.brandCheck(this,o);let a="Cache.match";R.argumentLengthCheck(arguments,1,a),e=R.converters.RequestInfo(e),t=R.converters.CacheQueryOptions(t,a,"options");let i=this.#r(e,t,1);if(i.length!==0)return i[0]}async matchAll(e=void 0,t={}){R.brandCheck(this,o);let a="Cache.matchAll";return e!==void 0&&(e=R.converters.RequestInfo(e)),t=R.converters.CacheQueryOptions(t,a,"options"),this.#r(e,t)}async add(e){R.brandCheck(this,o),R.argumentLengthCheck(arguments,1,"Cache.add"),e=R.converters.RequestInfo(e);let a=[e];return await this.addAll(a)}async addAll(e){R.brandCheck(this,o);let t="Cache.addAll";R.argumentLengthCheck(arguments,1,t);let a=[],i=[];for(let d of e){if(d===void 0)throw R.errors.conversionFailed({prefix:t,argument:"Argument 1",types:["undefined is not allowed"]});if(d=R.converters.RequestInfo(d),typeof d=="string")continue;let g=ua(d);if(!qg(g.url)||g.method!=="GET")throw R.errors.exception({header:t,message:"Expected http/s scheme when method is not GET."})}let r=[];for(let d of e){let g=ua(new Ym(d));if(!qg(g.url))throw R.errors.exception({header:t,message:"Expected http/s scheme."});g.initiator="fetch",g.destination="subresource",i.push(g);let p=wn();r.push(wse({request:g,processResponse(b){if(b.type==="error"||b.status===206||b.status<200||b.status>299)p.reject(R.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(b.headersList.contains("vary")){let A=Uw(b.headersList.get("vary"));for(let k of A)if(k==="*"){p.reject(R.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(let x of r)x.abort();return}}},processResponseEndOfBody(b){if(b.aborted){p.reject(new DOMException("aborted","AbortError"));return}p.resolve(b)}})),a.push(p.promise)}let n=await Promise.all(a),c=[],m=0;for(let d of n){let g={type:"put",request:i[m],response:d};c.push(g),m++}let l=wn(),u=null;try{this.#o(c)}catch(d){u=d}return queueMicrotask(()=>{u===null?l.resolve(void 0):l.reject(u)}),l.promise}async put(e,t){R.brandCheck(this,o);let a="Cache.put";R.argumentLengthCheck(arguments,2,a),e=R.converters.RequestInfo(e),t=R.converters.Response(t,a,"response");let i=null;if(R.is.Request(e)?i=ua(e):i=ua(new Ym(e)),!qg(i.url)||i.method!=="GET")throw R.errors.exception({header:a,message:"Expected an http/s scheme when method is not GET"});let r=kse(t);if(r.status===206)throw R.errors.exception({header:a,message:"Got 206 status"});if(r.headersList.contains("vary")){let g=Uw(r.headersList.get("vary"));for(let p of g)if(p==="*")throw R.errors.exception({header:a,message:"Got * vary field value"})}if(r.body&&(bse(r.body.stream)||r.body.stream.locked))throw R.errors.exception({header:a,message:"Response body is locked or disturbed"});let s=q9(r),n=wn();if(r.body!=null){let p=r.body.stream.getReader();vse(p,n.resolve,n.reject)}else n.resolve(void 0);let c=[],m={type:"put",request:i,response:s};c.push(m);let l=await n.promise;s.body!=null&&(s.body.source=l);let u=wn(),d=null;try{this.#o(c)}catch(g){d=g}return queueMicrotask(()=>{d===null?u.resolve():u.reject(d)}),u.promise}async delete(e,t={}){R.brandCheck(this,o);let a="Cache.delete";R.argumentLengthCheck(arguments,1,a),e=R.converters.RequestInfo(e),t=R.converters.CacheQueryOptions(t,a,"options");let i=null;if(R.is.Request(e)){if(i=ua(e),i.method!=="GET"&&!t.ignoreMethod)return!1}else Nw(typeof e=="string"),i=ua(new Ym(e));let r=[],s={type:"delete",request:i,options:t};r.push(s);let n=wn(),c=null,m;try{m=this.#o(r)}catch(l){c=l}return queueMicrotask(()=>{c===null?n.resolve(!!m?.length):n.reject(c)}),n.promise}async keys(e=void 0,t={}){R.brandCheck(this,o);let a="Cache.keys";e!==void 0&&(e=R.converters.RequestInfo(e)),t=R.converters.CacheQueryOptions(t,a,"options");let i=null;if(e!==void 0)if(R.is.Request(e)){if(i=ua(e),i.method!=="GET"&&!t.ignoreMethod)return[]}else typeof e=="string"&&(i=ua(new Ym(e)));let r=wn(),s=[];if(e===void 0)for(let n of this.#e)s.push(n[0]);else{let n=this.#a(i,t);for(let c of n)s.push(c[0])}return queueMicrotask(()=>{let n=[];for(let c of s){let m=Ase(c,void 0,new AbortController().signal,"immutable");n.push(m)}r.resolve(Object.freeze(n))}),r.promise}#o(e){let t=this.#e,a=[...t],i=[],r=[];try{for(let s of e){if(s.type!=="delete"&&s.type!=="put")throw R.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if(s.type==="delete"&&s.response!=null)throw R.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#a(s.request,s.options,i).length)throw new DOMException("???","InvalidStateError");let n;if(s.type==="delete"){if(n=this.#a(s.request,s.options),n.length===0)return[];for(let c of n){let m=t.indexOf(c);Nw(m!==-1),t.splice(m,1)}}else if(s.type==="put"){if(s.response==null)throw R.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let c=s.request;if(!qg(c.url))throw R.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if(c.method!=="GET")throw R.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(s.options!=null)throw R.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});n=this.#a(s.request);for(let m of n){let l=t.indexOf(m);Nw(l!==-1),t.splice(l,1)}t.push([s.request,s.response]),i.push([s.request,s.response])}r.push([s.request,s.response])}return r}catch(s){throw this.#e.length=0,this.#e=a,s}}#a(e,t,a){let i=[],r=a??this.#e;for(let s of r){let[n,c]=s;this.#i(e,n,c,t)&&i.push(s)}return i}#i(e,t,a=null,i){let r=new URL(e.url),s=new URL(t.url);if(i?.ignoreSearch&&(s.search="",r.search=""),!fse(r,s,!0))return!1;if(a==null||i?.ignoreVary||!a.headersList.contains("vary"))return!0;let n=Uw(a.headersList.get("vary"));for(let c of n){if(c==="*")return!1;let m=t.headersList.get(c),l=e.headersList.get(c);if(m!==l)return!1}return!0}#r(e,t,a=1/0){let i=null;if(e!==void 0)if(R.is.Request(e)){if(i=ua(e),i.method!=="GET"&&!t.ignoreMethod)return[]}else typeof e=="string"&&(i=ua(new Ym(e)));let r=[];if(e===void 0)for(let n of this.#e)r.push(n[1]);else{let n=this.#a(i,t);for(let c of n)r.push(c[1])}let s=[];for(let n of r){let c=yse(q9(n),"immutable");if(s.push(c),s.length>=a)break}return Object.freeze(s)}};Object.defineProperties(Eg.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:Zr,matchAll:Zr,add:Zr,addAll:Zr,put:Zr,delete:Zr,keys:Zr});var E9=[{key:"ignoreSearch",converter:R.converters.boolean,defaultValue:()=>!1},{key:"ignoreMethod",converter:R.converters.boolean,defaultValue:()=>!1},{key:"ignoreVary",converter:R.converters.boolean,defaultValue:()=>!1}];R.converters.CacheQueryOptions=R.dictionaryConverter(E9);R.converters.MultiCacheQueryOptions=R.dictionaryConverter([...E9,{key:"cacheName",converter:R.converters.DOMString}]);R.converters.Response=R.interfaceConverter(R.is.Response,"Response");R.converters["sequence<RequestInfo>"]=R.sequenceConverter(R.converters.RequestInfo);I9.exports={Cache:Eg}});var B9=y((Jpe,j9)=>{"use strict";var{Cache:Ig}=C9(),{webidl:lo}=to(),{kEnumerableProperty:Vm}=K(),{kConstruct:$m}=de(),Cg=class o{#e=new Map;constructor(){arguments[0]!==$m&&lo.illegalConstructor(),lo.util.markAsUncloneable(this)}async match(e,t={}){if(lo.brandCheck(this,o),lo.argumentLengthCheck(arguments,1,"CacheStorage.match"),e=lo.converters.RequestInfo(e),t=lo.converters.MultiCacheQueryOptions(t),t.cacheName!=null){if(this.#e.has(t.cacheName)){let a=this.#e.get(t.cacheName);return await new Ig($m,a).match(e,t)}}else for(let a of this.#e.values()){let r=await new Ig($m,a).match(e,t);if(r!==void 0)return r}}async has(e){lo.brandCheck(this,o);let t="CacheStorage.has";return lo.argumentLengthCheck(arguments,1,t),e=lo.converters.DOMString(e,t,"cacheName"),this.#e.has(e)}async open(e){lo.brandCheck(this,o);let t="CacheStorage.open";if(lo.argumentLengthCheck(arguments,1,t),e=lo.converters.DOMString(e,t,"cacheName"),this.#e.has(e)){let i=this.#e.get(e);return new Ig($m,i)}let a=[];return this.#e.set(e,a),new Ig($m,a)}async delete(e){lo.brandCheck(this,o);let t="CacheStorage.delete";return lo.argumentLengthCheck(arguments,1,t),e=lo.converters.DOMString(e,t,"cacheName"),this.#e.delete(e)}async keys(){return lo.brandCheck(this,o),[...this.#e.keys()]}};Object.defineProperties(Cg.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:Vm,has:Vm,open:Vm,delete:Vm,keys:Vm});j9.exports={CacheStorage:Cg}});var S9=y((Kpe,Q9)=>{"use strict";Q9.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}});var _w=y((Zpe,N9)=>{"use strict";function xse(o){for(let e=0;e<o.length;++e){let t=o.charCodeAt(e);if(t>=0&&t<=8||t>=10&&t<=31||t===127)return!0}return!1}function Ow(o){for(let e=0;e<o.length;++e){let t=o.charCodeAt(e);if(t<33||t>126||t===34||t===40||t===41||t===60||t===62||t===64||t===44||t===59||t===58||t===92||t===47||t===91||t===93||t===63||t===61||t===123||t===125)throw new Error("Invalid cookie name")}}function Mw(o){let e=o.length,t=0;if(o[0]==='"'){if(e===1||o[e-1]!=='"')throw new Error("Invalid cookie value");--e,++t}for(;t<e;){let a=o.charCodeAt(t++);if(a<33||a>126||a===34||a===44||a===59||a===92)throw new Error("Invalid cookie value")}}function T9(o){for(let e=0;e<o.length;++e){let t=o.charCodeAt(e);if(t<32||t>126||t===59)throw new Error("Invalid cookie path")}}function D9(o){return o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122}function zse(o){if(o===" ")return;if(o.length>255)throw new Error("Invalid cookie domain");let e=0;for(let t=0;t<o.length;++t){let a=o.charCodeAt(t);if(a===46){if(e===0)throw new Error("Invalid cookie domain");if(o.charCodeAt(t-1)===45)throw new Error("Invalid cookie domain");e=0;continue}if(e===0&&!D9(a))throw new Error("Invalid cookie domain");if(!D9(a)&&a!==45)throw new Error("Invalid cookie domain");if(++e>63)throw new Error("Invalid cookie domain")}if(e===0||o.charCodeAt(o.length-1)===45)throw new Error("Invalid cookie domain")}var qse=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Ese=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],jg=Array(61).fill(0).map((o,e)=>e.toString().padStart(2,"0"));function R9(o){return typeof o=="number"&&(o=new Date(o)),`${qse[o.getUTCDay()]}, ${jg[o.getUTCDate()]} ${Ese[o.getUTCMonth()]} ${o.getUTCFullYear()} ${jg[o.getUTCHours()]}:${jg[o.getUTCMinutes()]}:${jg[o.getUTCSeconds()]} GMT`}function Ise(o){if(o<0)throw new Error("Invalid cookie max-age")}function Cse(o){if(o.name.length===0)return null;Ow(o.name),Mw(o.value);let e=[`${o.name}=${o.value}`];o.name.startsWith("__Secure-")&&(o.secure=!0),o.name.startsWith("__Host-")&&(o.secure=!0,o.domain=null,o.path="/"),o.secure&&e.push("Secure"),o.httpOnly&&e.push("HttpOnly"),typeof o.maxAge=="number"&&(Ise(o.maxAge),e.push(`Max-Age=${o.maxAge}`)),o.domain&&(zse(o.domain),e.push(`Domain=${o.domain}`)),o.path&&(T9(o.path),e.push(`Path=${o.path}`)),o.expires&&o.expires.toString()!=="Invalid Date"&&e.push(`Expires=${R9(o.expires)}`),o.sameSite&&e.push(`SameSite=${o.sameSite}`);for(let t of o.unparsed){if(!t.includes("="))throw new Error("Invalid unparsed");let[a,...i]=t.split("="),r=a.trim(),s=i.join("=");Ow(r),Mw(s),e.push(`${r}=${s}`)}return e.join("; ")}N9.exports={isCTLExcludingHtab:xse,validateCookieName:Ow,validateCookiePath:T9,validateCookieValue:Mw,toIMFDate:R9,stringify:Cse}});var O9=y((Xpe,U9)=>{"use strict";var{collectASequenceOfCodePointsFast:Bg}=Da(),{maxNameValuePairSize:jse,maxAttributeValueSize:Bse}=S9(),{isCTLExcludingHtab:Qse}=_w(),Sse=require("assert");function Dse(o){if(Qse(o))return null;let e="",t="",a="",i="";if(o.includes(";")){let r={position:0};e=Bg(";",o,r),t=o.slice(r.position)}else e=o;if(!e.includes("="))i=e;else{let r={position:0};a=Bg("=",e,r),i=e.slice(r.position+1)}return a=a.trim(),i=i.trim(),a.length+i.length>jse?null:{name:a,value:i,...vn(t)}}function vn(o,e={}){if(o.length===0)return e;Sse(o[0]===";"),o=o.slice(1);let t="";o.includes(";")?(t=Bg(";",o,{position:0}),o=o.slice(t.length)):(t=o,o="");let a="",i="";if(t.includes("=")){let s={position:0};a=Bg("=",t,s),i=t.slice(s.position+1)}else a=t;if(a=a.trim(),i=i.trim(),i.length>Bse)return vn(o,e);let r=a.toLowerCase();if(r==="expires"){let s=new Date(i);e.expires=s}else if(r==="max-age"){let s=i.charCodeAt(0);if((s<48||s>57)&&i[0]!=="-"||!/^\d+$/.test(i))return vn(o,e);let n=Number(i);e.maxAge=n}else if(r==="domain"){let s=i;s[0]==="."&&(s=s.slice(1)),s=s.toLowerCase(),e.domain=s}else if(r==="path"){let s="";i.length===0||i[0]!=="/"?s="/":s=i,e.path=s}else if(r==="secure")e.secure=!0;else if(r==="httponly")e.httpOnly=!0;else if(r==="samesite"){let s=i.toLowerCase();s==="none"?e.sameSite="None":s==="strict"?e.sameSite="Strict":s==="lax"&&(e.sameSite="Lax")}else e.unparsed??=[],e.unparsed.push(`${a}=${i}`);return vn(o,e)}U9.exports={parseSetCookie:Dse,parseUnparsedAttributes:vn}});var F9=y((ehe,L9)=>{"use strict";var{parseSetCookie:M9}=O9(),{stringify:Tse}=_w(),{webidl:ne}=to(),{Headers:Rse}=$r(),Qg=ne.brandCheckMultiple([Rse,globalThis.Headers].filter(Boolean));function Nse(o){ne.argumentLengthCheck(arguments,1,"getCookies"),Qg(o);let e=o.get("cookie"),t={};if(!e)return t;for(let a of e.split(";")){let[i,...r]=a.split("=");t[i.trim()]=r.join("=")}return t}function Use(o,e,t){Qg(o);let a="deleteCookie";ne.argumentLengthCheck(arguments,2,a),e=ne.converters.DOMString(e,a,"name"),t=ne.converters.DeleteCookieAttributes(t),_9(o,{name:e,value:"",expires:new Date(0),...t})}function Ose(o){ne.argumentLengthCheck(arguments,1,"getSetCookies"),Qg(o);let e=o.getSetCookie();return e?e.map(t=>M9(t)):[]}function Mse(o){return o=ne.converters.DOMString(o),M9(o)}function _9(o,e){ne.argumentLengthCheck(arguments,2,"setCookie"),Qg(o),e=ne.converters.Cookie(e);let t=Tse(e);t&&o.append("set-cookie",t,!0)}ne.converters.DeleteCookieAttributes=ne.dictionaryConverter([{converter:ne.nullableConverter(ne.converters.DOMString),key:"path",defaultValue:()=>null},{converter:ne.nullableConverter(ne.converters.DOMString),key:"domain",defaultValue:()=>null}]);ne.converters.Cookie=ne.dictionaryConverter([{converter:ne.converters.DOMString,key:"name"},{converter:ne.converters.DOMString,key:"value"},{converter:ne.nullableConverter(o=>typeof o=="number"?ne.converters["unsigned long long"](o):new Date(o)),key:"expires",defaultValue:()=>null},{converter:ne.nullableConverter(ne.converters["long long"]),key:"maxAge",defaultValue:()=>null},{converter:ne.nullableConverter(ne.converters.DOMString),key:"domain",defaultValue:()=>null},{converter:ne.nullableConverter(ne.converters.DOMString),key:"path",defaultValue:()=>null},{converter:ne.nullableConverter(ne.converters.boolean),key:"secure",defaultValue:()=>null},{converter:ne.nullableConverter(ne.converters.boolean),key:"httpOnly",defaultValue:()=>null},{converter:ne.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:ne.sequenceConverter(ne.converters.DOMString),key:"unparsed",defaultValue:()=>[]}]);L9.exports={getCookies:Nse,deleteCookie:Use,getSetCookies:Ose,setCookie:_9,parseCookie:Mse}});var Tg=y((ohe,H9)=>{"use strict";var{webidl:N}=to(),{kEnumerableProperty:Do}=K(),{kConstruct:P9}=de(),xn=class o extends Event{#e;constructor(e,t={}){if(e===P9){super(arguments[1],arguments[2]),N.util.markAsUncloneable(this);return}let a="MessageEvent constructor";N.argumentLengthCheck(arguments,1,a),e=N.converters.DOMString(e,a,"type"),t=N.converters.MessageEventInit(t,a,"eventInitDict"),super(e,t),this.#e=t,N.util.markAsUncloneable(this)}get data(){return N.brandCheck(this,o),this.#e.data}get origin(){return N.brandCheck(this,o),this.#e.origin}get lastEventId(){return N.brandCheck(this,o),this.#e.lastEventId}get source(){return N.brandCheck(this,o),this.#e.source}get ports(){return N.brandCheck(this,o),Object.isFrozen(this.#e.ports)||Object.freeze(this.#e.ports),this.#e.ports}initMessageEvent(e,t=!1,a=!1,i=null,r="",s="",n=null,c=[]){return N.brandCheck(this,o),N.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new o(e,{bubbles:t,cancelable:a,data:i,origin:r,lastEventId:s,source:n,ports:c})}static createFastMessageEvent(e,t){let a=new o(P9,e,t);return a.#e=t,a.#e.data??=null,a.#e.origin??="",a.#e.lastEventId??="",a.#e.source??=null,a.#e.ports??=[],a}},{createFastMessageEvent:_se}=xn;delete xn.createFastMessageEvent;var Sg=class o extends Event{#e;constructor(e,t={}){let a="CloseEvent constructor";N.argumentLengthCheck(arguments,1,a),e=N.converters.DOMString(e,a,"type"),t=N.converters.CloseEventInit(t),super(e,t),this.#e=t,N.util.markAsUncloneable(this)}get wasClean(){return N.brandCheck(this,o),this.#e.wasClean}get code(){return N.brandCheck(this,o),this.#e.code}get reason(){return N.brandCheck(this,o),this.#e.reason}},Dg=class o extends Event{#e;constructor(e,t){let a="ErrorEvent constructor";N.argumentLengthCheck(arguments,1,a),super(e,t),N.util.markAsUncloneable(this),e=N.converters.DOMString(e,a,"type"),t=N.converters.ErrorEventInit(t??{}),this.#e=t}get message(){return N.brandCheck(this,o),this.#e.message}get filename(){return N.brandCheck(this,o),this.#e.filename}get lineno(){return N.brandCheck(this,o),this.#e.lineno}get colno(){return N.brandCheck(this,o),this.#e.colno}get error(){return N.brandCheck(this,o),this.#e.error}};Object.defineProperties(xn.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:Do,origin:Do,lastEventId:Do,source:Do,ports:Do,initMessageEvent:Do});Object.defineProperties(Sg.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:Do,code:Do,wasClean:Do});Object.defineProperties(Dg.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:Do,filename:Do,lineno:Do,colno:Do,error:Do});N.converters.MessagePort=N.interfaceConverter(N.is.MessagePort,"MessagePort");N.converters["sequence<MessagePort>"]=N.sequenceConverter(N.converters.MessagePort);var Lw=[{key:"bubbles",converter:N.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:N.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:N.converters.boolean,defaultValue:()=>!1}];N.converters.MessageEventInit=N.dictionaryConverter([...Lw,{key:"data",converter:N.converters.any,defaultValue:()=>null},{key:"origin",converter:N.converters.USVString,defaultValue:()=>""},{key:"lastEventId",converter:N.converters.DOMString,defaultValue:()=>""},{key:"source",converter:N.nullableConverter(N.converters.MessagePort),defaultValue:()=>null},{key:"ports",converter:N.converters["sequence<MessagePort>"],defaultValue:()=>[]}]);N.converters.CloseEventInit=N.dictionaryConverter([...Lw,{key:"wasClean",converter:N.converters.boolean,defaultValue:()=>!1},{key:"code",converter:N.converters["unsigned short"],defaultValue:()=>0},{key:"reason",converter:N.converters.USVString,defaultValue:()=>""}]);N.converters.ErrorEventInit=N.dictionaryConverter([...Lw,{key:"message",converter:N.converters.DOMString,defaultValue:()=>""},{key:"filename",converter:N.converters.USVString,defaultValue:()=>""},{key:"lineno",converter:N.converters["unsigned long"],defaultValue:()=>0},{key:"colno",converter:N.converters["unsigned long"],defaultValue:()=>0},{key:"error",converter:N.converters.any}]);H9.exports={MessageEvent:xn,CloseEvent:Sg,ErrorEvent:Dg,createFastMessageEvent:_se}});var Mi=y((the,G9)=>{"use strict";var Lse="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",Fse={enumerable:!0,writable:!1,configurable:!1},Pse={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},Hse={SENT:1,RECEIVED:2},Gse={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},Yse=65535,Vse={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},$se=Buffer.allocUnsafe(0),Wse={text:1,typedArray:2,arrayBuffer:3,blob:4};G9.exports={uid:Lse,sentCloseFrameState:Hse,staticPropertyDescriptors:Fse,states:Pse,opcodes:Gse,maxUnsigned16Bit:Yse,parserStates:Vse,emptyBuffer:$se,sendHints:Wse}});var Xr=y((ahe,J9)=>{"use strict";var{states:Rg,opcodes:zn}=Mi(),{isUtf8:Jse}=require("buffer"),{removeHTTPWhitespace:Y9}=bt(),{collectASequenceOfCodePointsFast:Kse}=Da();function Zse(o){return o===Rg.CONNECTING}function Xse(o){return o===Rg.OPEN}function ene(o){return o===Rg.CLOSING}function one(o){return o===Rg.CLOSED}function tne(o,e,t=(i,r)=>new Event(i,r),a={}){let i=t(o,a);e.dispatchEvent(i)}function ane(o,e,t){o.onMessage(e,t)}function ine(o){return o.byteLength===o.buffer.byteLength?o.buffer:new Uint8Array(o).buffer}function rne(o){if(o.length===0)return!1;for(let e=0;e<o.length;++e){let t=o.charCodeAt(e);if(t<33||t>126||t===34||t===40||t===41||t===44||t===47||t===58||t===59||t===60||t===61||t===62||t===63||t===64||t===91||t===92||t===93||t===123||t===125)return!1}return!0}function sne(o){return o>=1e3&&o<1015?o!==1004&&o!==1005&&o!==1006:o>=3e3&&o<=4999}function V9(o){return o===zn.CLOSE||o===zn.PING||o===zn.PONG}function $9(o){return o===zn.CONTINUATION}function W9(o){return o===zn.TEXT||o===zn.BINARY}function nne(o){return W9(o)||$9(o)||V9(o)}function cne(o){let e={position:0},t=new Map;for(;e.position<o.length;){let a=Kse(";",o,e),[i,r=""]=a.split("=",2);t.set(Y9(i,!0,!1),Y9(r,!1,!0)),e.position++}return t}function mne(o){if(o.length===0)return!1;for(let t=0;t<o.length;t++){let a=o.charCodeAt(t);if(a<48||a>57)return!1}let e=Number.parseInt(o,10);return e>=8&&e<=15}function lne(o,e){let t;try{t=new URL(o,e)}catch(a){throw new DOMException(a,"SyntaxError")}if(t.protocol==="http:"?t.protocol="ws:":t.protocol==="https:"&&(t.protocol="wss:"),t.protocol!=="ws:"&&t.protocol!=="wss:")throw new DOMException("expected a ws: or wss: url","SyntaxError");if(t.hash.length||t.href.endsWith("#"))throw new DOMException("hash","SyntaxError");return t}function une(o,e){if(o!==null&&o!==1e3&&(o<3e3||o>4999))throw new DOMException("invalid code","InvalidAccessError");if(e!==null){let t=Buffer.byteLength(e);if(t>123)throw new DOMException(`Reason must be less than 123 bytes; received ${t}`,"SyntaxError")}}var dne=(()=>{if(typeof process.versions.icu=="string"){let o=new TextDecoder("utf-8",{fatal:!0});return o.decode.bind(o)}return function(o){if(Jse(o))return o.toString("utf-8");throw new TypeError("Invalid utf-8 received.")}})();J9.exports={isConnecting:Zse,isEstablished:Xse,isClosing:ene,isClosed:one,fireEvent:tne,isValidSubprotocol:rne,isValidStatusCode:sne,websocketMessageReceived:ane,utf8Decode:dne,isControlFrame:V9,isContinuationFrame:$9,isTextBinaryFrame:W9,isValidOpcode:nne,parseExtensions:cne,isValidClientWindowBits:mne,toArrayBuffer:ine,getURLRecord:lne,validateCloseCodeAndReason:une}});var En=y((ihe,Z9)=>{"use strict";var{runtimeFeatures:gne}=Ta(),{maxUnsigned16Bit:K9,opcodes:pne}=Mi(),Ng=8*1024,Wm=null,qn=Ng,hne=gne.has("crypto")?require("crypto").randomFillSync:function(e,t,a){for(let i=0;i<e.length;++i)e[i]=Math.random()*255|0;return e};function Fw(){return qn===Ng&&(qn=0,hne(Wm??=Buffer.allocUnsafeSlow(Ng),0,Ng)),[Wm[qn++],Wm[qn++],Wm[qn++],Wm[qn++]]}var Pw=class{constructor(e){this.frameData=e}createFrame(e){let t=this.frameData,a=Fw(),i=t?.byteLength??0,r=i,s=6;i>K9?(s+=8,r=127):i>125&&(s+=2,r=126);let n=Buffer.allocUnsafe(i+s);n[0]=n[1]=0,n[0]|=128,n[0]=(n[0]&240)+e;n[s-4]=a[0],n[s-3]=a[1],n[s-2]=a[2],n[s-1]=a[3],n[1]=r,r===126?n.writeUInt16BE(i,2):r===127&&(n[2]=n[3]=0,n.writeUIntBE(i,4,6)),n[1]|=128;for(let c=0;c<i;++c)n[s+c]=t[c]^a[c&3];return n}static createFastTextFrame(e){let t=Fw(),a=e.length;for(let n=0;n<a;++n)e[n]^=t[n&3];let i=a,r=6;a>K9?(r+=8,i=127):a>125&&(r+=2,i=126);let s=Buffer.allocUnsafeSlow(r);return s[0]=128|pne.TEXT,s[1]=i|128,s[r-4]=t[0],s[r-3]=t[1],s[r-2]=t[2],s[r-1]=t[3],i===126?s.writeUInt16BE(a,2):i===127&&(s[2]=s[3]=0,s.writeUIntBE(a,4,6)),[s,e]}};Z9.exports={WebsocketFrameSend:Pw,generateMask:Fw}});var Ug=y((rhe,i5)=>{"use strict";var{uid:fne,states:Hw,sentCloseFrameState:Gw,emptyBuffer:X9,opcodes:bne}=Mi(),{parseExtensions:yne,isClosed:kne,isClosing:Ane,isEstablished:t5,isConnecting:wne,validateCloseCodeAndReason:vne}=Xr(),{makeRequest:xne}=An(),{fetching:zne}=Gm(),{Headers:qne,getHeadersList:Ene}=$r(),{getDecodeSplit:Ine}=Vo(),{WebsocketFrameSend:Cne}=En(),jne=require("assert"),{runtimeFeatures:Bne}=Ta(),e5=Bne.has("crypto")?require("crypto"):null,o5=!1;function Qne(o,e,t,a,i){let r=o;r.protocol=o.protocol==="ws:"?"http:":"https:";let s=xne({urlList:[r],client:t,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error",useURLCredentials:!0});if(i.headers){let l=Ene(new qne(i.headers));s.headersList=l}let n=e5.randomBytes(16).toString("base64");s.headersList.append("sec-websocket-key",n,!0),s.headersList.append("sec-websocket-version","13",!0);for(let l of e)s.headersList.append("sec-websocket-protocol",l,!0);return s.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits",!0),zne({request:s,useParallelQueue:!0,dispatcher:i.dispatcher,processResponse(l){if(l.type==="error"||l.status!==101){if(l.socket?.session==null){da(a,1002,"Received network error or non-101 status code.",l.error);return}if(l.status!==200){da(a,1002,"Received network error or non-200 status code.",l.error);return}}if(o5===!1&&l.socket?.session!=null&&(process.emitWarning("WebSocket over HTTP2 is experimental, and subject to change.","ExperimentalWarning"),o5=!0),e.length!==0&&!l.headersList.get("Sec-WebSocket-Protocol")){da(a,1002,"Server did not respond with sent protocols.");return}if(l.socket.session==null&&l.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){da(a,1002,'Server did not set Upgrade header to "websocket".');return}if(l.socket.session==null&&l.headersList.get("Connection")?.toLowerCase()!=="upgrade"){da(a,1002,'Server did not set Connection header to "upgrade".');return}let u=l.headersList.get("Sec-WebSocket-Accept"),d=e5.hash("sha1",n+fne,"base64");if(u!==d){da(a,1002,"Incorrect hash received in Sec-WebSocket-Accept header.");return}let g=l.headersList.get("Sec-WebSocket-Extensions"),p;if(g!==null&&(p=yne(g),!p.has("permessage-deflate"))){da(a,1002,"Sec-WebSocket-Extensions header does not match.");return}let b=l.headersList.get("Sec-WebSocket-Protocol");if(b!==null&&!Ine("sec-websocket-protocol",s.headersList).includes(b)){da(a,1002,"Protocol was not set in the opening handshake.");return}l.socket.on("data",a.onSocketData),l.socket.on("close",a.onSocketClose),l.socket.on("error",a.onSocketError),a.wasEverConnected=!0,a.onConnectionEstablished(l,p)}})}function a5(o,e,t,a=!1){if(e??=null,t??="",a&&vne(e,t),!(kne(o.readyState)||Ane(o.readyState)))if(!t5(o.readyState))da(o),o.readyState=Hw.CLOSING;else if(!o.closeState.has(Gw.SENT)&&!o.closeState.has(Gw.RECEIVED)){let i=new Cne;t.length!==0&&e===null&&(e=1e3),jne(e===null||Number.isInteger(e)),e===null&&t.length===0?i.frameData=X9:e!==null&&t===null?(i.frameData=Buffer.allocUnsafe(2),i.frameData.writeUInt16BE(e,0)):e!==null&&t!==null?(i.frameData=Buffer.allocUnsafe(2+Buffer.byteLength(t)),i.frameData.writeUInt16BE(e,0),i.frameData.write(t,2,"utf-8")):i.frameData=X9,o.socket.write(i.createFrame(bne.CLOSE)),o.closeState.add(Gw.SENT),o.readyState=Hw.CLOSING}else o.readyState=Hw.CLOSING}function da(o,e,t,a){t5(o.readyState)&&a5(o,e,t,!1),o.controller.abort(),wne(o.readyState)?o.onSocketClose():o.socket?.destroyed===!1&&o.socket.destroy()}i5.exports={establishWebSocketConnection:Qne,failWebsocketConnection:da,closeWebSocketConnection:a5}});var s5=y((she,r5)=>{"use strict";var{createInflateRaw:Sne,Z_DEFAULT_WINDOWBITS:Dne}=require("zlib"),{isValidClientWindowBits:Tne}=Xr(),{MessageSizeExceededError:Rne}=$(),Nne=Buffer.from([0,0,255,255]),Og=Symbol("kBuffer"),Jm=Symbol("kLength"),Yw=class{#e;#o={};#a=0;constructor(e,t){this.#o.serverNoContextTakeover=e.has("server_no_context_takeover"),this.#o.serverMaxWindowBits=e.get("server_max_window_bits"),this.#a=t.maxPayloadSize}decompress(e,t,a){if(!this.#e){let i=Dne;if(this.#o.serverMaxWindowBits){if(!Tne(this.#o.serverMaxWindowBits)){a(new Error("Invalid server_max_window_bits"));return}i=Number.parseInt(this.#o.serverMaxWindowBits)}try{this.#e=Sne({windowBits:i})}catch(r){a(r);return}this.#e[Og]=[],this.#e[Jm]=0,this.#e.on("data",r=>{if(this.#e[Jm]+=r.length,this.#a>0&&this.#e[Jm]>this.#a){a(new Rne),this.#e.removeAllListeners(),this.#e=null;return}this.#e[Og].push(r)}),this.#e.on("error",r=>{this.#e=null,a(r)})}this.#e.write(e),t&&this.#e.write(Nne),this.#e.flush(()=>{if(!this.#e)return;let i=Buffer.concat(this.#e[Og],this.#e[Jm]);this.#e[Og].length=0,this.#e[Jm]=0,a(null,i)})}};r5.exports={PerMessageDeflate:Yw}});var Jw=y((nhe,u5)=>{"use strict";var{Writable:Une}=require("stream"),One=require("assert"),{parserStates:To,opcodes:In,states:Mne,emptyBuffer:n5,sentCloseFrameState:Km}=Mi(),{isValidStatusCode:_ne,isValidOpcode:Lne,websocketMessageReceived:c5,utf8Decode:Fne,isControlFrame:Vw,isTextBinaryFrame:$w,isContinuationFrame:Pne}=Xr(),{failWebsocketConnection:uo}=Ug(),{WebsocketFrameSend:m5}=En(),{PerMessageDeflate:Hne}=s5(),{MessageSizeExceededError:l5}=$(),Ww=class extends Une{#e=[];#o=0;#a=0;#i=!1;#r=To.INFO;#t={};#c=[];#s;#n;#m;#u;constructor(e,t,a={}){super(),this.#n=e,this.#s=t??new Map,this.#m=a.maxFragments??0,this.#u=a.maxPayloadSize??0,this.#s.has("permessage-deflate")&&this.#s.set("permessage-deflate",new Hne(t,a))}_write(e,t,a){this.#e.push(e),this.#a+=e.length,this.#i=!0,this.run(a)}#l(){return this.#u>0&&!Vw(this.#t.opcode)&&this.#t.payloadLength+this.#o>this.#u?(uo(this.#n,1009,"Payload size exceeds maximum allowed size"),!1):!0}run(e){for(;this.#i;)if(this.#r===To.INFO){if(this.#a<2)return e();let t=this.consume(2),a=(t[0]&128)!==0,i=t[0]&15,r=(t[1]&128)===128,s=!a&&i!==In.CONTINUATION,n=t[1]&127,c=t[0]&64,m=t[0]&32,l=t[0]&16;if(!Lne(i))return uo(this.#n,1002,"Invalid opcode received"),e();if(r)return uo(this.#n,1002,"Frame cannot be masked"),e();if(c!==0&&!this.#s.has("permessage-deflate")){uo(this.#n,1002,"Expected RSV1 to be clear.");return}if(m!==0||l!==0){uo(this.#n,1002,"RSV1, RSV2, RSV3 must be clear");return}if(s&&!$w(i)){uo(this.#n,1002,"Invalid frame type was fragmented.");return}if($w(i)&&this.#c.length>0){uo(this.#n,1002,"Expected continuation frame");return}if(this.#t.fragmented&&s){uo(this.#n,1002,"Fragmented frame exceeded 125 bytes.");return}if((n>125||s)&&Vw(i)){uo(this.#n,1002,"Control frame either too large or fragmented");return}if(Pne(i)&&this.#c.length===0&&!this.#t.compressed){uo(this.#n,1002,"Unexpected continuation frame");return}if(n<=125){if(this.#t.payloadLength=n,this.#r=To.READ_DATA,!this.#l())return}else n===126?this.#r=To.PAYLOADLENGTH_16:n===127&&(this.#r=To.PAYLOADLENGTH_64);$w(i)&&(this.#t.binaryType=i,this.#t.compressed=c!==0),this.#t.opcode=i,this.#t.masked=r,this.#t.fin=a,this.#t.fragmented=s}else if(this.#r===To.PAYLOADLENGTH_16){if(this.#a<2)return e();let t=this.consume(2);if(this.#t.payloadLength=t.readUInt16BE(0),this.#r=To.READ_DATA,!this.#l())return}else if(this.#r===To.PAYLOADLENGTH_64){if(this.#a<8)return e();let t=this.consume(8),a=t.readUInt32BE(0),i=t.readUInt32BE(4);if(a!==0||i>2**31-1){uo(this.#n,1009,"Received payload length > 2^31 bytes.");return}if(this.#t.payloadLength=i,this.#r=To.READ_DATA,!this.#l())return}else if(this.#r===To.READ_DATA){if(this.#a<this.#t.payloadLength)return e();let t=this.consume(this.#t.payloadLength);if(Vw(this.#t.opcode))this.#i=this.parseControlFrame(t),this.#r=To.INFO;else if(this.#t.compressed){this.#s.get("permessage-deflate").decompress(t,this.#t.fin,(a,i)=>{if(a){let r=a instanceof l5?1009:1007;uo(this.#n,r,a.message);return}if(this.writeFragments(i)){if(this.#u>0&&this.#o>this.#u){uo(this.#n,1009,new l5().message);return}if(!this.#t.fin){this.#r=To.INFO,this.#i=!0,this.run(e);return}c5(this.#n,this.#t.binaryType,this.consumeFragments()),this.#i=!0,this.#r=To.INFO,this.run(e)}},this.#o),this.#i=!1;break}else{if(!this.writeFragments(t))return;!this.#t.fragmented&&this.#t.fin&&c5(this.#n,this.#t.binaryType,this.consumeFragments()),this.#r=To.INFO}}}consume(e){if(e>this.#a)throw new Error("Called consume() before buffers satiated.");if(e===0)return n5;this.#a-=e;let t=this.#e[0];if(t.length>e)return this.#e[0]=t.subarray(e,t.length),t.subarray(0,e);if(t.length===e)return this.#e.shift();{let a=0,i=Buffer.allocUnsafeSlow(e);for(;a!==e;){let r=this.#e[0],s=r.length;if(s+a===e){i.set(this.#e.shift(),a);break}else if(s+a>e){i.set(r.subarray(0,e-a),a),this.#e[0]=r.subarray(e-a);break}else i.set(this.#e.shift(),a),a+=s}return i}}writeFragments(e){return this.#m>0&&this.#c.length===this.#m?(uo(this.#n,1008,"Too many message fragments"),!1):(this.#o+=e.length,this.#c.push(e),!0)}consumeFragments(){let e=this.#c;if(e.length===1)return this.#o=0,e.shift();let t=0,a=Buffer.allocUnsafeSlow(this.#o);for(let i=0;i<e.length;++i){let r=e[i];a.set(r,t),t+=r.length}return this.#c=[],this.#o=0,a}parseCloseBody(e){One(e.length!==1);let t;if(e.length>=2&&(t=e.readUInt16BE(0)),t!==void 0&&!_ne(t))return{code:1002,reason:"Invalid status code",error:!0};let a=e.subarray(2);a[0]===239&&a[1]===187&&a[2]===191&&(a=a.subarray(3));try{a=Fne(a)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:t,reason:a,error:!1}}parseControlFrame(e){let{opcode:t,payloadLength:a}=this.#t;if(t===In.CLOSE){if(a===1)return uo(this.#n,1002,"Received close frame with a 1-byte body."),!1;if(this.#t.closeInfo=this.parseCloseBody(e),this.#t.closeInfo.error){let{code:i,reason:r}=this.#t.closeInfo;return uo(this.#n,i,r),!1}if(!this.#n.closeState.has(Km.SENT)&&!this.#n.closeState.has(Km.RECEIVED)){let i=n5;this.#t.closeInfo.code&&(i=Buffer.allocUnsafe(2),i.writeUInt16BE(this.#t.closeInfo.code,0));let r=new m5(i);this.#n.socket.write(r.createFrame(In.CLOSE)),this.#n.closeState.add(Km.SENT)}return this.#n.readyState=Mne.CLOSING,this.#n.closeState.add(Km.RECEIVED),!1}else if(t===In.PING){if(!this.#n.closeState.has(Km.RECEIVED)){let i=new m5(e);this.#n.socket.write(i.createFrame(In.PONG)),this.#n.onPing(e)}}else t===In.PONG&&this.#n.onPong(e);return!0}get closingInfo(){return this.#t.closeInfo}};u5.exports={ByteParser:Ww}});var h5=y((che,p5)=>{"use strict";var{WebsocketFrameSend:g5}=En(),{opcodes:d5,sendHints:es}=Mi(),Gne=bk(),Zw=class{#e=new Gne;#o=!1;#a;constructor(e){this.#a=e}add(e,t,a){if(a!==es.blob){if(this.#o){let r={promise:null,callback:t,frame:Kw(e,a)};this.#e.push(r)}else if(a===es.text){let{0:r,1:s}=g5.createFastTextFrame(e);this.#a.cork(),this.#a.write(r),this.#a.write(s,t),this.#a.uncork()}else this.#a.write(Kw(e,a),t);return}let i={promise:e.arrayBuffer().then(r=>{i.promise=null,i.frame=Kw(r,a)}),callback:t,frame:null};this.#e.push(i),this.#o||this.#i()}async#i(){this.#o=!0;let e=this.#e;for(;!e.isEmpty();){let t=e.shift();t.promise!==null&&await t.promise,this.#a.write(t.frame,t.callback),t.callback=t.frame=null}this.#o=!1}};function Kw(o,e){return new g5(Yne(o,e)).createFrame(e===es.text?d5.TEXT:d5.BINARY)}function Yne(o,e){switch(e){case es.text:case es.typedArray:return new Uint8Array(o.buffer,o.byteOffset,o.byteLength);case es.arrayBuffer:case es.blob:return new Uint8Array(o)}}p5.exports={SendQueue:Zw}});var w5=y((mhe,A5)=>{"use strict";var{isArrayBuffer:Vne}=require("util/types"),{webidl:_}=to(),{URLSerializer:$ne}=bt(),{environmentSettingsObject:f5}=Vo(),{staticPropertyDescriptors:_i,states:Ga,sentCloseFrameState:Xw,sendHints:Mg,opcodes:ev}=Mi(),{isConnecting:Wne,isEstablished:b5,isClosing:y5,isClosed:Jne,isValidSubprotocol:Kne,fireEvent:_g,utf8Decode:Zne,toArrayBuffer:Xne,getURLRecord:ece}=Xr(),{establishWebSocketConnection:oce,closeWebSocketConnection:tce,failWebsocketConnection:k5}=Ug(),{ByteParser:ace}=Jw(),{kEnumerableProperty:qt}=K(),{getGlobalDispatcher:ice}=ag(),{ErrorEvent:rce,CloseEvent:sce,createFastMessageEvent:nce}=Tg(),{SendQueue:cce}=h5(),{WebsocketFrameSend:mce}=En(),{channels:ga}=yi();function lce(o){return typeof o?.address=="function"?o.address():typeof o?.session?.socket?.address=="function"?o.session.socket.address():null}var wo=class o extends EventTarget{#e={open:null,error:null,close:null,message:null};#o=0;#a="";#i="";#r;#t={onConnectionEstablished:(e,t)=>this.#m(e,t),onMessage:(e,t)=>this.#u(e,t),onParserError:e=>k5(this.#t,null,e.message),onParserDrain:()=>this.#l(),onSocketData:e=>{this.#n.write(e)||this.#t.socket.pause()},onSocketError:e=>{this.#t.readyState=Ga.CLOSING,ga.socketError.hasSubscribers&&ga.socketError.publish(e),this.#t.socket.destroy()},onSocketClose:()=>this.#d(),onPing:e=>{ga.ping.hasSubscribers&&ga.ping.publish({payload:e,websocket:this})},onPong:e=>{ga.pong.hasSubscribers&&ga.pong.publish({payload:e,websocket:this})},readyState:Ga.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#c;#s;#n;constructor(e,t=[]){super(),_.util.markAsUncloneable(this);let a="WebSocket constructor";_.argumentLengthCheck(arguments,1,a);let i=_.converters["DOMString or sequence<DOMString> or WebSocketInit"](t,a,"options");e=_.converters.USVString(e),t=i.protocols;let r=f5.settingsObject.baseUrl,s=ece(e,r);if(typeof t=="string"&&(t=[t]),t.length!==new Set(t.map(c=>c.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(t.length>0&&!t.every(c=>Kne(c)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this.#c=new URL(s.href);let n=f5.settingsObject;this.#t.controller=oce(s,t,n,this.#t,i),this.#t.readyState=o.CONNECTING,this.#s="blob"}close(e=void 0,t=void 0){_.brandCheck(this,o),e!==void 0&&(e=_.converters["unsigned short"](e,"WebSocket.close","code",_.attributes.Clamp)),t!==void 0&&(t=_.converters.USVString(t)),e??=null,t??="",tce(this.#t,e,t,!0)}send(e){_.brandCheck(this,o);let t="WebSocket.send";if(_.argumentLengthCheck(arguments,1,t),e=_.converters.WebSocketSendData(e,t,"data"),Wne(this.#t.readyState))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!b5(this.#t.readyState)||y5(this.#t.readyState)))if(typeof e=="string"){let a=Buffer.from(e);this.#o+=a.byteLength,this.#r.add(a,()=>{this.#o-=a.byteLength},Mg.text)}else Vne(e)?(this.#o+=e.byteLength,this.#r.add(e,()=>{this.#o-=e.byteLength},Mg.arrayBuffer)):ArrayBuffer.isView(e)?(this.#o+=e.byteLength,this.#r.add(e,()=>{this.#o-=e.byteLength},Mg.typedArray)):_.is.Blob(e)&&(this.#o+=e.size,this.#r.add(e,()=>{this.#o-=e.size},Mg.blob))}get readyState(){return _.brandCheck(this,o),this.#t.readyState}get bufferedAmount(){return _.brandCheck(this,o),this.#o}get url(){return _.brandCheck(this,o),$ne(this.#c)}get extensions(){return _.brandCheck(this,o),this.#i}get protocol(){return _.brandCheck(this,o),this.#a}get onopen(){return _.brandCheck(this,o),this.#e.open}set onopen(e){_.brandCheck(this,o),this.#e.open&&this.removeEventListener("open",this.#e.open);let t=_.converters.EventHandlerNonNull(e);t!==null?(this.addEventListener("open",t),this.#e.open=e):this.#e.open=null}get onerror(){return _.brandCheck(this,o),this.#e.error}set onerror(e){_.brandCheck(this,o),this.#e.error&&this.removeEventListener("error",this.#e.error);let t=_.converters.EventHandlerNonNull(e);t!==null?(this.addEventListener("error",t),this.#e.error=e):this.#e.error=null}get onclose(){return _.brandCheck(this,o),this.#e.close}set onclose(e){_.brandCheck(this,o),this.#e.close&&this.removeEventListener("close",this.#e.close);let t=_.converters.EventHandlerNonNull(e);t!==null?(this.addEventListener("close",t),this.#e.close=e):this.#e.close=null}get onmessage(){return _.brandCheck(this,o),this.#e.message}set onmessage(e){_.brandCheck(this,o),this.#e.message&&this.removeEventListener("message",this.#e.message);let t=_.converters.EventHandlerNonNull(e);t!==null?(this.addEventListener("message",t),this.#e.message=e):this.#e.message=null}get binaryType(){return _.brandCheck(this,o),this.#s}set binaryType(e){_.brandCheck(this,o),e!=="blob"&&e!=="arraybuffer"?this.#s="blob":this.#s=e}#m(e,t){this.#t.socket=e.socket;let a=this.#t.controller.dispatcher?.webSocketOptions,i=a?.maxFragments,r=a?.maxPayloadSize,s=new ace(this.#t,t,{maxFragments:i,maxPayloadSize:r});s.on("drain",()=>this.#t.onParserDrain()),s.on("error",m=>this.#t.onParserError(m)),this.#n=s,this.#r=new cce(e.socket),this.#t.readyState=Ga.OPEN;let n=e.headersList.get("sec-websocket-extensions");n!==null&&(this.#i=n);let c=e.headersList.get("sec-websocket-protocol");if(c!==null&&(this.#a=c),_g("open",this),ga.open.hasSubscribers){let m=e.headersList.entries;ga.open.publish({address:lce(e.socket),protocol:this.#a,extensions:this.#i,websocket:this,handshakeResponse:{status:e.status,statusText:e.statusText,headers:m}})}}#u(e,t){if(this.#t.readyState!==Ga.OPEN)return;let a;if(e===ev.TEXT)try{a=Zne(t)}catch{k5(this.#t,1007,"Received invalid UTF-8 in text frame.");return}else e===ev.BINARY&&(this.#s==="blob"?a=new Blob([t]):a=Xne(t));_g("message",this,nce,{origin:this.#c.origin,data:a})}#l(){this.#t.socket.resume()}#d(){let e=this.#t.closeState.has(Xw.SENT)&&this.#t.closeState.has(Xw.RECEIVED),t=1005,a="",i=this.#n?.closingInfo;i&&!i.error&&(t=i.code??1005,a=i.reason),this.#t.readyState=Ga.CLOSED,this.#t.closeState.has(Xw.RECEIVED)||(t=1006,_g("error",this,(r,s)=>new rce(r,s),{error:new TypeError(a)})),_g("close",this,(r,s)=>new sce(r,s),{wasClean:e,code:t,reason:a}),ga.close.hasSubscribers&&ga.close.publish({websocket:this,code:t,reason:a})}static ping(e,t){if(Buffer.isBuffer(t)){if(t.length>125)throw new TypeError("A PING frame cannot have a body larger than 125 bytes.")}else if(t!==void 0)throw new TypeError("Expected buffer payload");let a=e.#t.readyState;if(b5(a)&&!y5(a)&&!Jne(a)){let i=new mce(t);e.#t.socket.write(i.createFrame(ev.PING))}}},{ping:uce}=wo;Reflect.deleteProperty(wo,"ping");wo.CONNECTING=wo.prototype.CONNECTING=Ga.CONNECTING;wo.OPEN=wo.prototype.OPEN=Ga.OPEN;wo.CLOSING=wo.prototype.CLOSING=Ga.CLOSING;wo.CLOSED=wo.prototype.CLOSED=Ga.CLOSED;Object.defineProperties(wo.prototype,{CONNECTING:_i,OPEN:_i,CLOSING:_i,CLOSED:_i,url:qt,readyState:qt,bufferedAmount:qt,onopen:qt,onerror:qt,onclose:qt,close:qt,onmessage:qt,binaryType:qt,send:qt,extensions:qt,protocol:qt,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(wo,{CONNECTING:_i,OPEN:_i,CLOSING:_i,CLOSED:_i});_.converters["sequence<DOMString>"]=_.sequenceConverter(_.converters.DOMString);_.converters["DOMString or sequence<DOMString>"]=function(o,e,t){return _.util.Type(o)===_.util.Types.OBJECT&&Symbol.iterator in o?_.converters["sequence<DOMString>"](o):_.converters.DOMString(o,e,t)};_.converters.WebSocketInit=_.dictionaryConverter([{key:"protocols",converter:_.converters["DOMString or sequence<DOMString>"],defaultValue:()=>[]},{key:"dispatcher",converter:_.converters.any,defaultValue:()=>ice()},{key:"headers",converter:_.nullableConverter(_.converters.HeadersInit)}]);_.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(o){return _.util.Type(o)===_.util.Types.OBJECT&&!(Symbol.iterator in o)?_.converters.WebSocketInit(o):{protocols:_.converters["DOMString or sequence<DOMString>"](o)}};_.converters.WebSocketSendData=function(o){return _.util.Type(o)===_.util.Types.OBJECT&&(_.is.Blob(o)||_.is.BufferSource(o))?o:_.converters.USVString(o)};A5.exports={WebSocket:wo,ping:uce}});var ov=y((lhe,z5)=>{"use strict";var{webidl:Lg}=to(),{validateCloseCodeAndReason:dce}=Xr(),{kConstruct:v5}=de(),{kEnumerableProperty:x5}=K();function gce(){class o extends DOMException{get reason(){return""}}return new o().reason!==void 0?DOMException:new Proxy(DOMException,{construct(e,t,a){let i=Reflect.construct(e,t,e);return Object.setPrototypeOf(i,a.prototype),i}})}var os=class o extends gce(){#e;#o;constructor(e="",t=void 0){if(e=Lg.converters.DOMString(e,"WebSocketError","message"),super(e,"WebSocketError"),t===v5)return;t!==null&&(t=Lg.converters.WebSocketCloseInfo(t));let a=t.closeCode??null,i=t.reason??"";dce(a,i),i.length!==0&&a===null&&(a=1e3),this.#e=a,this.#o=i}get closeCode(){return this.#e}get reason(){return this.#o}static createUnvalidatedWebSocketError(e,t,a){let i=new o(e,v5);return i.#e=t,i.#o=a,i}},{createUnvalidatedWebSocketError:pce}=os;delete os.createUnvalidatedWebSocketError;Object.defineProperties(os.prototype,{closeCode:x5,reason:x5,[Symbol.toStringTag]:{value:"WebSocketError",writable:!1,enumerable:!1,configurable:!0}});Lg.is.WebSocketError=Lg.util.MakeTypeAssertion(os);z5.exports={WebSocketError:os,createUnvalidatedWebSocketError:pce}});var j5=y((uhe,C5)=>{"use strict";var{createDeferredPromise:tv}=im(),{environmentSettingsObject:q5}=Vo(),{states:Cn,opcodes:Fg,sentCloseFrameState:jn}=Mi(),{webidl:Re}=to(),{getURLRecord:hce,isValidSubprotocol:fce,isEstablished:bce,utf8Decode:yce}=Xr(),{establishWebSocketConnection:kce,failWebsocketConnection:av,closeWebSocketConnection:iv}=Ug(),{channels:E5}=yi(),{WebsocketFrameSend:Ace}=En(),{ByteParser:wce}=Jw(),{WebSocketError:vce,createUnvalidatedWebSocketError:xce}=ov(),{kEnumerableProperty:Pg}=K(),{utf8DecodeBytes:zce}=md(),I5=!1,Hg=class{#e;#o;#a;#i;#r;#t;#c=!1;#s={onConnectionEstablished:(e,t)=>this.#u(e,t),onMessage:(e,t)=>this.#l(e,t),onParserError:e=>av(this.#s,null,e.message),onParserDrain:()=>this.#s.socket.resume(),onSocketData:e=>{this.#n.write(e)||this.#s.socket.pause()},onSocketError:e=>{this.#s.readyState=Cn.CLOSING,E5.socketError.hasSubscribers&&E5.socketError.publish(e),this.#s.socket.destroy()},onSocketClose:()=>this.#d(),onPing:()=>{},onPong:()=>{},readyState:Cn.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#n;constructor(e,t=void 0){I5||(process.emitWarning("WebSocketStream is experimental! Expect it to change at any time.",{code:"UNDICI-WSS"}),I5=!0),Re.argumentLengthCheck(arguments,1,"WebSocket"),e=Re.converters.USVString(e),t!==null&&(t=Re.converters.WebSocketStreamOptions(t));let a=q5.settingsObject.baseUrl,i=hce(e,a),r=t.protocols;if(r.length!==new Set(r.map(n=>n.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(r.length>0&&!r.every(n=>fce(n)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(this.#e=i.toString(),this.#o=tv(),this.#a=tv(),t.signal!=null){let n=t.signal;if(n.aborted){this.#o.reject(n.reason),this.#a.reject(n.reason);return}n.addEventListener("abort",()=>{bce(this.#s.readyState)||(av(this.#s),this.#s.readyState=Cn.CLOSING,this.#o.reject(n.reason),this.#a.reject(n.reason),this.#c=!0)},{once:!0})}let s=q5.settingsObject;this.#s.controller=kce(i,r,s,this.#s,t)}get url(){return this.#e.toString()}get opened(){return this.#o.promise}get closed(){return this.#a.promise}close(e=void 0){e!==null&&(e=Re.converters.WebSocketCloseInfo(e));let t=e.closeCode??null,a=e.reason;iv(this.#s,t,a,!0)}#m(e){e=Re.converters.WebSocketStreamWrite(e);let t=tv(),a=null,i=null;if(Re.is.BufferSource(e))a=new Uint8Array(ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e.slice()),i=Fg.BINARY;else{let r;try{r=Re.converters.DOMString(e)}catch(s){return t.reject(s),t.promise}a=new TextEncoder().encode(r),i=Fg.TEXT}if(!this.#s.closeState.has(jn.SENT)&&!this.#s.closeState.has(jn.RECEIVED)){let r=new Ace(a);this.#s.socket.write(r.createFrame(i),()=>{t.resolve(void 0)})}return t.promise}#u(e,t){this.#s.socket=e.socket;let a=this.#s.controller.dispatcher?.webSocketOptions?.maxFragments,i=this.#s.controller.dispatcher?.webSocketOptions?.maxPayloadSize,r=new wce(this.#s,t,{maxFragments:a,maxPayloadSize:i});r.on("drain",()=>this.#s.onParserDrain()),r.on("error",l=>this.#s.onParserError(l)),this.#n=r,this.#s.readyState=Cn.OPEN;let s=t??"",n=e.headersList.get("sec-websocket-protocol")??"",c=new ReadableStream({start:l=>{this.#r=l},cancel:l=>this.#g(l)}),m=new WritableStream({write:l=>this.#m(l),close:()=>iv(this.#s,null,null),abort:l=>this.#p(l)});this.#i=c,this.#t=m,this.#o.resolve({extensions:s,protocol:n,readable:c,writable:m})}#l(e,t){if(this.#s.readyState!==Cn.OPEN)return;let a;if(e===Fg.TEXT)try{a=yce(t)}catch{av(this.#s,1007,"Received invalid UTF-8 in text frame.");return}else e===Fg.BINARY&&(a=new Uint8Array(t.buffer,t.byteOffset,t.byteLength));this.#r.enqueue(a)}#d(){let e=this.#s.closeState.has(jn.SENT)&&this.#s.closeState.has(jn.RECEIVED);if(this.#s.readyState=Cn.CLOSED,this.#c)return;this.#s.wasEverConnected||this.#o.reject(new vce("Socket never opened"));let t=this.#n?.closingInfo,a=t?.code??1005;!this.#s.closeState.has(jn.SENT)&&!this.#s.closeState.has(jn.RECEIVED)&&(a=1006);let i=t?.reason==null?"":zce(Buffer.from(t.reason));if(e)this.#r.close(),this.#t.locked||this.#t.abort(new DOMException("A closed WebSocketStream cannot be written to","InvalidStateError")),this.#a.resolve({closeCode:a,reason:i});else{let r=xce("unclean close",a,i);this.#r?.error(r),this.#t?.abort(r),this.#a.reject(r)}}#p(e){let t=null,a="";Re.is.WebSocketError(e)&&(t=e.closeCode,a=e.reason),iv(this.#s,t,a)}#g(e){this.#p(e)}};Object.defineProperties(Hg.prototype,{url:Pg,opened:Pg,closed:Pg,close:Pg,[Symbol.toStringTag]:{value:"WebSocketStream",writable:!1,enumerable:!1,configurable:!0}});Re.converters.WebSocketStreamOptions=Re.dictionaryConverter([{key:"protocols",converter:Re.sequenceConverter(Re.converters.USVString),defaultValue:()=>[]},{key:"signal",converter:Re.nullableConverter(Re.converters.AbortSignal),defaultValue:()=>null}]);Re.converters.WebSocketCloseInfo=Re.dictionaryConverter([{key:"closeCode",converter:o=>Re.converters["unsigned short"](o,Re.attributes.EnforceRange)},{key:"reason",converter:Re.converters.USVString,defaultValue:()=>""}]);Re.converters.WebSocketStreamWrite=function(o){return typeof o=="string"?Re.converters.USVString(o):Re.converters.BufferSource(o)};C5.exports={WebSocketStream:Hg}});var Q5=y((dhe,B5)=>{"use strict";function qce(o){return o.indexOf("\0")===-1}function Ece(o){if(o.length===0)return!1;for(let e=0;e<o.length;e++)if(o.charCodeAt(e)<48||o.charCodeAt(e)>57)return!1;return!0}B5.exports={isValidLastEventId:qce,isASCIINumber:Ece}});var R5=y((ghe,T5)=>{"use strict";var{Transform:Ice}=require("stream"),{isASCIINumber:S5,isValidLastEventId:D5}=Q5(),Ya=[239,187,191],rv=10,Gg=13,Cce=58,jce=32,sv=class extends Ice{state;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;buffer=null;pos=0;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(e={}){e.readableObjectMode=!0,super(e),this.state=e.eventSourceSettings||{},e.push&&(this.push=e.push)}_transform(e,t,a){if(e.length===0){a();return}if(this.buffer?this.buffer=Buffer.concat([this.buffer,e]):this.buffer=e,this.checkBOM)switch(this.buffer.length){case 1:if(this.buffer[0]===Ya[0]){a();return}this.checkBOM=!1,a();return;case 2:if(this.buffer[0]===Ya[0]&&this.buffer[1]===Ya[1]){a();return}this.checkBOM=!1;break;case 3:if(this.buffer[0]===Ya[0]&&this.buffer[1]===Ya[1]&&this.buffer[2]===Ya[2]){this.buffer=Buffer.alloc(0),this.checkBOM=!1,a();return}this.checkBOM=!1;break;default:this.buffer[0]===Ya[0]&&this.buffer[1]===Ya[1]&&this.buffer[2]===Ya[2]&&(this.buffer=this.buffer.subarray(3)),this.checkBOM=!1;break}for(;this.pos<this.buffer.length;){if(this.eventEndCheck){if(this.crlfCheck){if(this.buffer[this.pos]===rv){this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.crlfCheck=!1;continue}this.crlfCheck=!1}if(this.buffer[this.pos]===rv||this.buffer[this.pos]===Gg){this.buffer[this.pos]===Gg&&(this.crlfCheck=!0),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,(this.event.data!==void 0||this.event.event||this.event.id!==void 0||this.event.retry)&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1;continue}if(this.buffer[this.pos]===rv||this.buffer[this.pos]===Gg){this.buffer[this.pos]===Gg&&(this.crlfCheck=!0),this.parseLine(this.buffer.subarray(0,this.pos),this.event),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.eventEndCheck=!0;continue}this.pos++}a()}parseLine(e,t){if(e.length===0)return;let a=e.indexOf(Cce);if(a===0)return;let i="",r="";if(a!==-1){i=e.subarray(0,a).toString("utf8");let s=a+1;e[s]===jce&&++s,r=e.subarray(s).toString("utf8")}else i=e.toString("utf8"),r="";switch(i){case"data":t[i]===void 0?t[i]=r:t[i]+=`
|
|
1409
|
-
${r}`;break;case"retry":S5(r)&&(t[i]=r);break;case"id":D5(r)&&(t[i]=r);break;case"event":r.length>0&&(t[i]=r);break}}processEvent(e){e.retry&&S5(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id!==void 0&&D5(e.id)&&(this.state.lastEventId=e.id),e.data!==void 0&&this.push({type:e.event||"message",options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}};T5.exports={EventSourceStream:sv}});var P5=y((phe,F5)=>{"use strict";var{pipeline:Bce}=require("stream"),{fetching:Qce}=Gm(),{makeRequest:Sce}=An(),{webidl:vo}=to(),{EventSourceStream:Dce}=R5(),{parseMIMEType:Tce}=bt(),{createFastMessageEvent:Rce}=Tg(),{isNetworkError:N5}=Fm(),{kEnumerableProperty:ts}=K(),{environmentSettingsObject:U5}=Vo(),O5=!1,M5=3e3,Zm=0,_5=1,Xm=2,Nce="anonymous",Uce="use-credentials",Bn=class o extends EventTarget{#e={open:null,error:null,message:null};#o;#a=!1;#i=Zm;#r=null;#t=null;#c;#s;constructor(e,t={}){super(),vo.util.markAsUncloneable(this);let a="EventSource constructor";vo.argumentLengthCheck(arguments,1,a),O5||(O5=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=vo.converters.USVString(e),t=vo.converters.EventSourceInitDict(t,a,"eventSourceInitDict"),this.#c=t.node.dispatcher||t.dispatcher,this.#s={lastEventId:"",reconnectionTime:t.node.reconnectionTime};let i=U5,r;try{r=new URL(e,i.settingsObject.baseUrl),this.#s.origin=r.origin}catch(c){throw new DOMException(c,"SyntaxError")}this.#o=r.href;let s=Nce;t.withCredentials===!0&&(s=Uce,this.#a=!0);let n={redirect:"follow",keepalive:!0,mode:"cors",credentials:s==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};n.client=U5.settingsObject,n.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],n.cache="no-store",n.initiator="other",n.urlList=[new URL(this.#o)],this.#r=Sce(n),this.#n()}get readyState(){return this.#i}get url(){return this.#o}get withCredentials(){return this.#a}#n(){if(this.#i===Xm)return;this.#i=Zm;let e={request:this.#r,dispatcher:this.#c},t=a=>{if(!N5(a))return this.#m()};e.processResponseEndOfBody=t,e.processResponse=a=>{if(N5(a))if(a.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#m();return}let i=a.headersList.get("content-type",!0),r=i!==null?Tce(i):"failure",s=r!=="failure"&&r.essence==="text/event-stream";if(a.status!==200||s===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#i=_5,this.dispatchEvent(new Event("open")),this.#s.origin=a.urlList[a.urlList.length-1].origin;let n=new Dce({eventSourceSettings:this.#s,push:c=>{this.dispatchEvent(Rce(c.type,c.options))}});Bce(a.body.stream,n,c=>{c?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#t=Qce(e)}#m(){this.#i!==Xm&&(this.#i=Zm,this.dispatchEvent(new Event("error")),setTimeout(()=>{this.#i===Zm&&(this.#s.lastEventId.length&&this.#r.headersList.set("last-event-id",this.#s.lastEventId,!0),this.#n())},this.#s.reconnectionTime)?.unref())}close(){vo.brandCheck(this,o),this.#i!==Xm&&(this.#i=Xm,this.#t.abort(),this.#r=null)}get onopen(){return this.#e.open}set onopen(e){this.#e.open&&this.removeEventListener("open",this.#e.open);let t=vo.converters.EventHandlerNonNull(e);t!==null?(this.addEventListener("open",t),this.#e.open=e):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(e){this.#e.message&&this.removeEventListener("message",this.#e.message);let t=vo.converters.EventHandlerNonNull(e);t!==null?(this.addEventListener("message",t),this.#e.message=e):this.#e.message=null}get onerror(){return this.#e.error}set onerror(e){this.#e.error&&this.removeEventListener("error",this.#e.error);let t=vo.converters.EventHandlerNonNull(e);t!==null?(this.addEventListener("error",t),this.#e.error=e):this.#e.error=null}},L5={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:Zm,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:_5,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:Xm,writable:!1}};Object.defineProperties(Bn,L5);Object.defineProperties(Bn.prototype,L5);Object.defineProperties(Bn.prototype,{close:ts,onerror:ts,onmessage:ts,onopen:ts,readyState:ts,url:ts,withCredentials:ts});vo.converters.EventSourceInitDict=vo.dictionaryConverter([{key:"withCredentials",converter:vo.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:vo.converters.any},{key:"node",converter:vo.dictionaryConverter([{key:"reconnectionTime",converter:vo.converters["unsigned long"],defaultValue:()=>M5},{key:"dispatcher",converter:vo.converters.any}]),defaultValue:()=>({})}]);F5.exports={EventSource:Bn,defaultReconnectionTime:M5}});var W5=y((hhe,Q)=>{"use strict";var Oce=Ii(),G5=Kc(),Mce=Sr(),_ce=j8(),Lce=D8(),Fce=Rr(),Pce=Hk(),Hce=_k(),Gce=yB(),Yce=qB(),Vce=CB(),Y5=$(),Vg=K(),{InvalidArgumentError:Yg}=Y5,Qn=
|
|
1415
|
+
${r}`;break;case"retry":S5(r)&&(t[i]=r);break;case"id":D5(r)&&(t[i]=r);break;case"event":r.length>0&&(t[i]=r);break}}processEvent(e){e.retry&&S5(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id!==void 0&&D5(e.id)&&(this.state.lastEventId=e.id),e.data!==void 0&&this.push({type:e.event||"message",options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}};T5.exports={EventSourceStream:sv}});var P5=y((phe,F5)=>{"use strict";var{pipeline:Bce}=require("stream"),{fetching:Qce}=Gm(),{makeRequest:Sce}=An(),{webidl:vo}=to(),{EventSourceStream:Dce}=R5(),{parseMIMEType:Tce}=bt(),{createFastMessageEvent:Rce}=Tg(),{isNetworkError:N5}=Fm(),{kEnumerableProperty:ts}=K(),{environmentSettingsObject:U5}=Vo(),O5=!1,M5=3e3,Zm=0,_5=1,Xm=2,Nce="anonymous",Uce="use-credentials",Bn=class o extends EventTarget{#e={open:null,error:null,message:null};#o;#a=!1;#i=Zm;#r=null;#t=null;#c;#s;constructor(e,t={}){super(),vo.util.markAsUncloneable(this);let a="EventSource constructor";vo.argumentLengthCheck(arguments,1,a),O5||(O5=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=vo.converters.USVString(e),t=vo.converters.EventSourceInitDict(t,a,"eventSourceInitDict"),this.#c=t.node.dispatcher||t.dispatcher,this.#s={lastEventId:"",reconnectionTime:t.node.reconnectionTime};let i=U5,r;try{r=new URL(e,i.settingsObject.baseUrl),this.#s.origin=r.origin}catch(c){throw new DOMException(c,"SyntaxError")}this.#o=r.href;let s=Nce;t.withCredentials===!0&&(s=Uce,this.#a=!0);let n={redirect:"follow",keepalive:!0,mode:"cors",credentials:s==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};n.client=U5.settingsObject,n.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],n.cache="no-store",n.initiator="other",n.urlList=[new URL(this.#o)],this.#r=Sce(n),this.#n()}get readyState(){return this.#i}get url(){return this.#o}get withCredentials(){return this.#a}#n(){if(this.#i===Xm)return;this.#i=Zm;let e={request:this.#r,dispatcher:this.#c},t=a=>{if(!N5(a))return this.#m()};e.processResponseEndOfBody=t,e.processResponse=a=>{if(N5(a))if(a.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#m();return}let i=a.headersList.get("content-type",!0),r=i!==null?Tce(i):"failure",s=r!=="failure"&&r.essence==="text/event-stream";if(a.status!==200||s===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#i=_5,this.dispatchEvent(new Event("open")),this.#s.origin=a.urlList[a.urlList.length-1].origin;let n=new Dce({eventSourceSettings:this.#s,push:c=>{this.dispatchEvent(Rce(c.type,c.options))}});Bce(a.body.stream,n,c=>{c?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#t=Qce(e)}#m(){this.#i!==Xm&&(this.#i=Zm,this.dispatchEvent(new Event("error")),setTimeout(()=>{this.#i===Zm&&(this.#s.lastEventId.length&&this.#r.headersList.set("last-event-id",this.#s.lastEventId,!0),this.#n())},this.#s.reconnectionTime)?.unref())}close(){vo.brandCheck(this,o),this.#i!==Xm&&(this.#i=Xm,this.#t.abort(),this.#r=null)}get onopen(){return this.#e.open}set onopen(e){this.#e.open&&this.removeEventListener("open",this.#e.open);let t=vo.converters.EventHandlerNonNull(e);t!==null?(this.addEventListener("open",t),this.#e.open=e):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(e){this.#e.message&&this.removeEventListener("message",this.#e.message);let t=vo.converters.EventHandlerNonNull(e);t!==null?(this.addEventListener("message",t),this.#e.message=e):this.#e.message=null}get onerror(){return this.#e.error}set onerror(e){this.#e.error&&this.removeEventListener("error",this.#e.error);let t=vo.converters.EventHandlerNonNull(e);t!==null?(this.addEventListener("error",t),this.#e.error=e):this.#e.error=null}},L5={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:Zm,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:_5,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:Xm,writable:!1}};Object.defineProperties(Bn,L5);Object.defineProperties(Bn.prototype,L5);Object.defineProperties(Bn.prototype,{close:ts,onerror:ts,onmessage:ts,onopen:ts,readyState:ts,url:ts,withCredentials:ts});vo.converters.EventSourceInitDict=vo.dictionaryConverter([{key:"withCredentials",converter:vo.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:vo.converters.any},{key:"node",converter:vo.dictionaryConverter([{key:"reconnectionTime",converter:vo.converters["unsigned long"],defaultValue:()=>M5},{key:"dispatcher",converter:vo.converters.any}]),defaultValue:()=>({})}]);F5.exports={EventSource:Bn,defaultReconnectionTime:M5}});var W5=y((hhe,Q)=>{"use strict";var Oce=Ii(),G5=Kc(),Mce=Sr(),_ce=j8(),Lce=D8(),Fce=Rr(),Pce=Hk(),Hce=_k(),Gce=yB(),Yce=qB(),Vce=CB(),Y5=$(),Vg=K(),{InvalidArgumentError:Yg}=Y5,Qn=m4(),$ce=wr(),Wce=jA(),{MockCallHistory:Jce,MockCallHistoryLog:Kce}=SA(),Zce=LA(),Xce=NA(),eme=cQ(),ome=dA(),tme=Fd(),{getGlobalDispatcher:V5,setGlobalDispatcher:ame}=ag(),ime=pn(),rme=WA();Object.assign(G5.prototype,Qn);Q.exports.Dispatcher=G5;Q.exports.Client=Oce;Q.exports.Pool=Mce;Q.exports.BalancedPool=_ce;Q.exports.RoundRobinPool=Lce;Q.exports.Agent=Fce;Q.exports.ProxyAgent=Pce;Q.exports.Socks5ProxyAgent=Hce;Q.exports.EnvHttpProxyAgent=Gce;Q.exports.RetryAgent=Yce;Q.exports.H2CClient=Vce;Q.exports.RetryHandler=tme;Q.exports.DecoratorHandler=ime;Q.exports.RedirectHandler=rme;Q.exports.interceptors={redirect:kQ(),responseError:wQ(),retry:xQ(),dump:qQ(),dns:jQ(),cache:n3(),decompress:d3(),deduplicate:b3()};Q.exports.cacheStores={MemoryCacheStore:lw()};var sme=A3();Q.exports.cacheStores.SqliteCacheStore=sme;Q.exports.buildConnector=$ce;Q.exports.errors=Y5;Q.exports.util={parseHeaders:Vg.parseHeaders,headerNameToString:Vg.headerNameToString};function el(o){return(e,t,a)=>{if(typeof t=="function"&&(a=t,t=null),!e||typeof e!="string"&&typeof e!="object"&&!(e instanceof URL))throw new Yg("invalid url");if(t!=null&&typeof t!="object")throw new Yg("invalid opts");if(t&&t.path!=null){if(typeof t.path!="string")throw new Yg("invalid opts.path");let s=t.path;t.path.startsWith("/")||(s=`/${s}`),e=new URL(Vg.parseOrigin(e).origin+s)}else t||(t=typeof e=="object"?e:{}),e=Vg.parseURL(e);let{agent:i,dispatcher:r=V5()}=t;if(i)throw new Yg("unsupported opts.agent. Did you mean opts.client?");return o.call(r,{...t,origin:e.origin,path:e.search?`${e.pathname}${e.search}`:e.pathname,method:t.method||(t.body?"PUT":"GET")},a)}}Q.exports.setGlobalDispatcher=ame;Q.exports.getGlobalDispatcher=V5;var nme=Gm().fetch,H5=typeof __filename<"u"?__filename:void 0;function $5(o,e){if(!o||typeof o!="object")return;let t=typeof o.stack=="string"?o.stack:"",a=e.replace(/\\/g,"/");if(t&&(t.includes(e)||t.includes(a)))return;let i={};if(Error.captureStackTrace(i,$5),!i.stack)return;let r=i.stack.split(`
|
|
1410
1416
|
`).slice(1).join(`
|
|
1411
1417
|
`);o.stack=t?`${t}
|
|
1412
1418
|
${r}`:i.stack}Q.exports.fetch=function(e,t=void 0){return nme(e,t).catch(a=>{throw H5?$5(a,H5):a&&typeof a=="object"&&Error.captureStackTrace(a,Q.exports.fetch),a})};Q.exports.Headers=$r().Headers;Q.exports.Response=Fm().Response;Q.exports.Request=An().Request;Q.exports.FormData=hd().FormData;var{setGlobalOrigin:cme,getGlobalOrigin:mme}=qy();Q.exports.setGlobalOrigin=cme;Q.exports.getGlobalOrigin=mme;var{CacheStorage:lme}=B9(),{kConstruct:ume}=de();Q.exports.caches=new lme(ume);var{deleteCookie:dme,getCookies:gme,getSetCookies:pme,setCookie:hme,parseCookie:fme}=F9();Q.exports.deleteCookie=dme;Q.exports.getCookies=gme;Q.exports.getSetCookies=pme;Q.exports.setCookie=hme;Q.exports.parseCookie=fme;var{parseMIMEType:bme,serializeAMimeType:yme}=bt();Q.exports.parseMIMEType=bme;Q.exports.serializeAMimeType=yme;var{CloseEvent:kme,ErrorEvent:Ame,MessageEvent:wme}=Tg(),{WebSocket:vme,ping:xme}=w5();Q.exports.WebSocket=vme;Q.exports.CloseEvent=kme;Q.exports.ErrorEvent=Ame;Q.exports.MessageEvent=wme;Q.exports.ping=xme;Q.exports.WebSocketStream=j5().WebSocketStream;Q.exports.WebSocketError=ov().WebSocketError;Q.exports.request=el(Qn.request);Q.exports.stream=el(Qn.stream);Q.exports.pipeline=el(Qn.pipeline);Q.exports.connect=el(Qn.connect);Q.exports.upgrade=el(Qn.upgrade);Q.exports.MockClient=Wce;Q.exports.MockCallHistory=Jce;Q.exports.MockCallHistoryLog=Kce;Q.exports.MockPool=Xce;Q.exports.MockAgent=Zce;Q.exports.SnapshotAgent=eme;Q.exports.mockErrors=ome;var{EventSource:zme}=P5();Q.exports.EventSource=zme;function qme(){globalThis.fetch=Q.exports.fetch,globalThis.Headers=Q.exports.Headers,globalThis.Response=Q.exports.Response,globalThis.Request=Q.exports.Request,globalThis.FormData=Q.exports.FormData,globalThis.WebSocket=Q.exports.WebSocket,globalThis.CloseEvent=Q.exports.CloseEvent,globalThis.ErrorEvent=Q.exports.ErrorEvent,globalThis.MessageEvent=Q.exports.MessageEvent,globalThis.EventSource=Q.exports.EventSource}Q.exports.install=qme});var J5=y(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.SuperglueClient=Dn.SuperglueHttpError=void 0;var Sn=rt(),Va=Jf(),Eme=wb(),Ime=cI(),Cme=Kt(),$a=Cs(),jme=wu(),tl=14400*1e3,ol;if(typeof globalThis.process<"u"&&globalThis.process.versions?.node)try{let{Agent:o}=W5();ol=new o({headersTimeout:tl,bodyTimeout:tl})}catch{}var $g=class extends Error{constructor(e,t,a,i){super(e),this.status=t,this.code=a,this.details=i,this.name="SuperglueHttpError"}};Dn.SuperglueHttpError=$g;var nv=class{constructor({apiKey:e,apiEndpoint:t,onInfrastructureError:a,sseTokenProvider:i,tokenProvider:r}){if(!e&&!r)throw new Error("SuperglueClient requires either apiKey or tokenProvider");this.tokenProvider=r??(async()=>e),this.apiEndpoint=t??"https://api.superglue.cloud",this.sseManager=new Eme.SSELogSubscriptionManager(this.apiEndpoint,i??this.tokenProvider),this.onInfrastructureError=a}async getApiKey(){return this.tokenProvider()}isInfrastructureError(e){return(0,Cme.isAbortError)(e)?!1:!!(e instanceof TypeError&&e.message.toLowerCase().includes("fetch")||e instanceof Error&&e.name==="TimeoutError")}async restRequest(e,t,a,i,r){let n=await(await this.restResponse({method:e,path:t,body:a,extraHeaders:i,requestInit:r})).text();if(n)return JSON.parse(n)}async restResponse({method:e,path:t,body:a,extraHeaders:i,requestInit:r}){let s=`${this.apiEndpoint.replace(/\/$/,"")}${t}`,n=a!=null,c=typeof FormData<"u"&&a instanceof FormData,l={Authorization:`Bearer ${await this.getApiKey()}`,...i};n&&!c&&e!=="GET"&&(l["Content-Type"]="application/json");let u;try{u=await fetch(s,{...r,method:e,headers:l,body:n?c?a:JSON.stringify(a):void 0,signal:r?.signal??AbortSignal.timeout(tl),...ol?{dispatcher:ol}:{}})}catch(d){throw this.isInfrastructureError(d)&&this.onInfrastructureError?.(),d}if(!u.ok)throw await this.buildHttpError(u);return u}async uploadFiles(e,t){if(typeof t?.process!="boolean")throw new Error("process must be a boolean");if(e.length===0)return[];let a=e.map(l=>({...l,contentLength:l.contentLength??this.getUploadContentLength(l.content)})),r=(await this.restRequest("POST","/v1/files/uploads",{process:t.process,files:a.map(({fileName:l,contentType:u,contentLength:d})=>({fileName:l,contentLength:d,...u?{contentType:u}:{}}))})).data.files;if(r.length!==a.length)throw await Promise.all(r.map(l=>this.deleteFileUpload(l.id).catch(()=>{}))),new Error("Upload response did not match the selected files");let s=await Promise.allSettled(r.map(async(l,u)=>{let d=a[u],g=await fetch(l.uploadUrl,{method:"PUT",body:d.content,headers:d.contentType?{"Content-Type":d.contentType}:void 0,signal:AbortSignal.timeout(Math.min(tl,l.expiresIn*1e3))});if(!g.ok)throw new Error(`Upload failed for ${d.fileName}: ${g.status} ${g.statusText}`);return l.id})),n=s.flatMap(l=>l.status==="fulfilled"?[l.value]:[]),c=new Map;if(n.length>0)try{let l=await this.restRequest("POST","/v1/files/uploads/complete",{fileIds:n});c=new Map(l.data.files.map(u=>[u.id,u]))}catch(l){c=new Map(n.map(u=>[u,{id:u,fileName:a[r.findIndex(d=>d.id===u)]?.fileName||u,contentLength:a[r.findIndex(d=>d.id===u)]?.contentLength||0,status:"failed",error:l instanceof Error?l.message:String(l)}]))}let m=r.map((l,u)=>{let d=s[u],g=a[u];return d.status==="rejected"?{id:l.id,fileName:g.fileName,contentLength:g.contentLength,status:"failed",error:d.reason instanceof Error?d.reason.message:String(d.reason)}:c.get(l.id)||{id:l.id,fileName:g.fileName,contentLength:g.contentLength,status:"failed",error:"Upload completion returned no result"}});return await Promise.all(m.filter(l=>l.status==="failed").map(l=>this.deleteFileUpload(l.id).catch(()=>{}))),m}async deleteFileUpload(e){await this.restRequest("DELETE",`/v1/files/uploads/${encodeURIComponent(e)}`)}getUploadContentLength(e){return typeof e=="string"?new TextEncoder().encode(e).byteLength:e instanceof Uint8Array?e.byteLength:e.size}async buildHttpError(e){e.status>=500&&this.onInfrastructureError?.();let t=await e.text(),a=`HTTP ${e.status}: ${t}`,i,r;try{let s=JSON.parse(t);s&&typeof s=="object"&&!Array.isArray(s)&&(r=s),typeof s?.code=="string"&&(i=s.code);let n=s.error;typeof n=="string"?a=n:n&&typeof n=="object"&&(a=n.message||JSON.stringify(n))}catch{}return new $g(a,e.status,i,r)}async streamRequest(e,t,a){let i=e.includes("?")?"&":"?",r=`${this.apiEndpoint.replace(/\/$/,"")}${e}${i}stream=true`,n={Authorization:`Bearer ${await this.getApiKey()}`,Accept:"text/event-stream","Content-Type":"application/json"},c;try{c=await fetch(r,{method:"POST",headers:n,body:JSON.stringify(t),signal:a??AbortSignal.timeout(tl),...ol?{dispatcher:ol}:{}})}catch(l){throw this.isInfrastructureError(l)&&this.onInfrastructureError?.(),l}if(!c.ok)throw await this.buildHttpError(c);if(!(c.headers.get("content-type")||"").includes("text/event-stream")){let l=await c.text();return l?JSON.parse(l):void 0}try{return await(0,Ime.consumeEventStreamResult)(c)}catch(l){throw this.isInfrastructureError(l)&&this.onInfrastructureError?.(),l}}async subscribeToLogsSSE(e={}){return this.sseManager.subscribeToLogs(e)}async disconnect(){await this.sseManager.disconnect()}async getMe(){return this.restRequest("GET","/v1/me")}async completeOnboarding(){return this.restRequest("POST","/v1/me/onboarding/complete")}async runTool(e){let t=await this.restRequest("POST",`/v1/tools/${encodeURIComponent(e.toolId)}/run`,{inputs:e.payload,files:e.files,credentials:e.credentials,includeStepResultData:e.includeStepResultData,options:e.options,runId:e.runId,stateFixture:e.stateFixture},void 0,e.signal?{signal:e.signal}:void 0);return{success:t.status==="success",data:t.data,error:t.error,tool:t.tool,stepResults:t.stepResults?.map(a=>({...a}))||[],...t.fileArtifacts&&t.fileArtifacts.length>0?{fileArtifacts:t.fileArtifacts}:{},...t.metadata?.warnings?.length?{warnings:t.metadata.warnings}:{}}}async runToolConfig(e){let t=e.createRun?"/v1/tools/run?createRun=true":"/v1/tools/run",a=await this.restRequest("POST",t,{tool:e.tool,payload:e.payload,files:e.files,credentials:e.credentials,includeStepResultData:e.includeStepResultData,options:e.options,runId:e.runId,stateFixture:e.stateFixture,executionKind:e.executionKind,parentToolId:e.parentToolId,draftId:e.draftId},e.traceId?{"X-Trace-Id":e.traceId}:void 0,e.signal?{signal:e.signal}:void 0);return{success:a.status?a.status==="success":a.success??!1,data:a.data,error:a.error,tool:a.tool||e.tool,stepResults:a.stepResults?.map(r=>({...r}))||[],...a.fileArtifacts&&a.fileArtifacts.length>0?{fileArtifacts:a.fileArtifacts}:{},...a.metadata?.warnings?.length?{warnings:a.metadata.warnings}:{}}}async abortToolExecution(e){return{success:!0,runId:(await this.restRequest("POST",`/v1/runs/${encodeURIComponent(e)}/cancel`)).runId}}async executeStep({step:e,payload:t,files:a,previousResults:i,credentials:r,options:s,runId:n,systemIds:c,createRun:m,parentToolId:l,stepIndex:u,stepId:d,signal:g,stream:p}){let b={step:e,payload:t,files:a,previousResults:i,credentials:r,options:s,runId:n,systemIds:c,createRun:m,parentToolId:l,stepIndex:u,stepId:d};return p?this.streamRequest("/v1/tools/step/run",b,g):this.restRequest("POST","/v1/tools/step/run",b,void 0,g?{signal:g}:void 0)}async abortStep(e){return this.restRequest("POST","/v1/tools/step/abort",{runId:e})}async executeTransformOnly({outputTransform:e,outputSchema:t,inputSchema:a,payload:i,files:r,stepResults:s,options:n,runId:c,createRun:m,parentToolId:l,stepId:u,signal:d,stream:g}){let p={outputTransform:e,outputSchema:t,inputSchema:a,payload:i,files:r,stepResults:s,options:n,runId:c,createRun:m,parentToolId:l,stepId:u};return g?this.streamRequest("/v1/tools/transform/run",p,d):this.restRequest("POST","/v1/tools/transform/run",p,void 0,d?{signal:d}:void 0)}async createRun({toolId:e,toolConfig:t,toolResult:a,stepResults:i,toolPayload:r,status:s,error:n,startedAt:c,completedAt:m,executionKind:l,parentToolId:u,draftId:d}){return this.restRequest("POST","/v1/runs",{toolId:e,toolConfig:t,toolResult:a,stepResults:i,toolPayload:r,status:s,error:n,startedAt:(0,$a.toUTCISOString)(c,"run.startedAt"),completedAt:(0,$a.toUTCISOString)(m,"run.completedAt"),executionKind:l,parentToolId:u,draftId:d})}async checkRunLimit(){return(await this.restRequest("POST","/v1/runs/check-limit")).data}async extract({file:e,envelope:t}){if(!e)throw new Error("File must be provided for extract.");let a=new FormData;a.append("file",e);let i=t?"/v1/extract?envelope=true":"/v1/extract";return this.restRequest("POST",i,a)}mapOpenAPIRunToRun(e){let t={running:Sn.RunStatus.RUNNING,success:Sn.RunStatus.SUCCESS,failed:Sn.RunStatus.FAILED,aborted:Sn.RunStatus.ABORTED};return{runId:e.runId??e.id,toolId:e.toolId,tool:e.tool,systemIds:e.systemIds,status:t[e.status]??Sn.RunStatus.FAILED,toolPayload:e.toolPayload,data:e.data,toolResult:e.data,error:e.error,stepResults:e.stepResults,options:e.options,requestSource:e.requestSource,traceId:e.traceId,resultStorageUri:e.resultStorageUri,userId:e.userId,userEmail:e.userEmail,userName:e.userName,metadata:{...e.metadata,executionKind:e.metadata?.executionKind??Sn.RunExecutionKind.FULL},fileArtifacts:e.fileArtifacts}}mapOpenAPIScheduleToToolSchedule(e){return{...e,lastRunAt:e.lastRunAt?(0,$a.requireUTCDate)(e.lastRunAt,"schedule.lastRunAt"):void 0,nextRunAt:(0,$a.requireUTCDate)(e.nextRunAt,"schedule.nextRunAt"),createdAt:(0,$a.requireUTCDate)(e.createdAt,"schedule.createdAt"),updatedAt:(0,$a.requireUTCDate)(e.updatedAt,"schedule.updatedAt")}}async listRuns(e={}){let t=(0,Va.createSearchListQueryParams)(e);e.toolId!==void 0&&t.set("toolId",e.toolId),e.searchUserIds?.length&&t.set("searchUserIds",e.searchUserIds.join(",")),e.includeTotal!==void 0&&t.set("includeTotal",String(e.includeTotal)),e.startedAfter!==void 0&&t.set("startedAfter",e.startedAfter instanceof Date?(0,$a.toUTCISOString)(e.startedAfter,"run.startedAfter"):e.startedAfter),e.statuses!==void 0?t.set("status",e.statuses.join(",")):e.status!==void 0&&t.set("status",e.status),e.requestSources!==void 0&&t.set("requestSources",e.requestSources.join(",")),e.executionKinds!==void 0&&t.set("executionKinds",e.executionKinds.join(",")),e.userId!==void 0&&t.set("userId",e.userId),e.systemId!==void 0&&t.set("systemId",e.systemId),e.systemIds!==void 0&&t.set("systemIds",e.systemIds.join(","));let a=t.size>0?`?${t.toString()}`:"",i=await this.restRequest("GET",`/v1/runs${a}`,void 0,void 0,{signal:e.signal});return{data:i.data.map(r=>this.mapOpenAPIRunToRun(r)),total:i.total,page:i.page,limit:i.limit,hasMore:i.hasMore}}async getActivityCounts(e){let t=new URLSearchParams;e?.from&&t.set("from",e.from instanceof Date?(0,$a.toUTCISOString)(e.from,"activity.from"):e.from),e?.to&&t.set("to",e.to instanceof Date?(0,$a.toUTCISOString)(e.to,"activity.to"):e.to);let a=t.toString();return(await this.restRequest("GET",`/v1/activity/counts${a?`?${a}`:""}`,void 0,void 0,{signal:e?.signal})).counts}async getRun(e){try{let t=await this.restRequest("GET",`/v1/runs/${encodeURIComponent(e)}`);return this.mapOpenAPIRunToRun(t)}catch(t){if(t.message?.includes("404")||t.message?.includes("not found"))return null;throw t}}async getTool(e){try{return await this.restRequest("GET",`/v1/tools/${encodeURIComponent(e)}`)}catch(t){if(t.message?.includes("404")||t.message?.includes("not found")||t.message?.includes("403")||t.message?.includes("not allowed"))return null;throw t}}async getToolState(e){return(await this.restRequest("GET",`/v1/tools/${encodeURIComponent(e)}/state`)).state}async setToolState(e,t){await this.restRequest("PUT",`/v1/tools/${encodeURIComponent(e)}/state`,{state:t})}async deleteToolState(e){return(await this.restRequest("DELETE",`/v1/tools/${encodeURIComponent(e)}/state`)).deletedKeys}async archiveTool(e,t=!0){return this.updateTool(e,{archived:t})}async bulkArchiveTools(e,t=!0){return this.restRequest("POST","/v1/tools/bulk/archive",{ids:e,archived:t})}async bulkDeleteTools(e){return this.restRequest("POST","/v1/tools/bulk/delete",{ids:e})}async listTools(e={}){let t=(0,Va.createListQueryParams)(e);e.includeArchived!==void 0&&t.set("includeArchived",String(e.includeArchived));let a=t.size>0?`?${t.toString()}`:"";return this.restRequest("GET",`/v1/tools${a}`)}async listAllTools(e={}){return(0,Va.listAllPages)((t,a)=>this.listTools({...e,page:t,limit:a}))}async createTool(e,t){return this.restRequest("POST","/v1/tools",{...t,id:e})}async updateTool(e,t){return this.restRequest("PUT",`/v1/tools/${encodeURIComponent(e)}`,t)}async deleteTool(e){try{return await this.restRequest("DELETE",`/v1/tools/${encodeURIComponent(e)}`),!0}catch(t){if(t.message?.includes("404"))return!1;throw t}}async renameTool(e,t){return this.restRequest("POST",`/v1/tools/${encodeURIComponent(e)}/rename`,{newId:t})}async getWorkflow(e){return this.getTool(e)}async archiveWorkflow(e,t=!0){return this.upsertWorkflow(e,{archived:t})}async createWorkflow(e,t){return this.createTool(e,t)}async updateWorkflow(e,t){return this.updateTool(e,t)}async upsertWorkflow(e,t){return await this.getTool(e)?this.updateTool(e,t):this.createTool(e,t)}async deleteWorkflow(e){return this.deleteTool(e)}async renameWorkflow(e,t){return this.renameTool(e,t)}async listSchedules(e={}){let t=(0,Va.createListQueryParams)(e),a=t.size>0?`?${t.toString()}`:"",i=e.toolId?`/v1/tools/${encodeURIComponent(e.toolId)}/schedules${a}`:`/v1/schedules${a}`,r=await this.restRequest("GET",i);return{...r,data:r.data.map(s=>this.mapOpenAPIScheduleToToolSchedule(s))}}async listAllSchedules(e={}){return(0,Va.listAllPages)((t,a)=>this.listSchedules({...e,page:t,limit:a}))}async getToolSchedule(e,t){try{let a=await this.restRequest("GET",`/v1/tools/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t)}`);return this.mapOpenAPIScheduleToToolSchedule(a)}catch(a){if(a.message?.includes("404")||a.message?.includes("not found"))return null;throw a}}async createToolSchedule(e,t){let a=await this.restRequest("POST",`/v1/tools/${encodeURIComponent(e)}/schedules`,{...t,timezone:t.timezone||(0,jme.getRuntimeTimezone)()});return this.mapOpenAPIScheduleToToolSchedule(a)}async updateToolSchedule(e,t,a){let i=await this.restRequest("PUT",`/v1/tools/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t)}`,a);return this.mapOpenAPIScheduleToToolSchedule(i)}async deleteToolSchedule(e,t){return await this.restRequest("DELETE",`/v1/tools/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t)}`),!0}async bulkSetSchedulesEnabled(e,t){return this.restRequest("POST","/v1/schedules/bulk/enable",{ids:e,enabled:t})}async bulkDeleteSchedules(e){return this.restRequest("POST","/v1/schedules/bulk/delete",{ids:e})}async listCredentials(e={}){let t=(0,Va.createListQueryParams)(e);e.systemId!==void 0&&t.set("systemId",e.systemId);let a=t.size>0?`?${t.toString()}`:"";return this.restRequest("GET",`/v1/credentials${a}`)}async listAllCredentials(e={}){return(0,Va.listAllPages)((t,a)=>this.listCredentials({...e,page:t,limit:a}))}async createCredentials(e){return(await this.restRequest("POST","/v1/credentials",e)).data}async replaceCredentials(e,t){return(await this.restRequest("PUT",`/v1/credentials/${encodeURIComponent(e)}`,{credentials:t})).data}async updateCredentials(e,t){return(await this.restRequest("PATCH",`/v1/credentials/${encodeURIComponent(e)}`,t)).data}async deleteCredentials(e){await this.restRequest("DELETE",`/v1/credentials/${encodeURIComponent(e)}`)}async setDefaultCredentials(e){await this.restRequest("POST",`/v1/credentials/${encodeURIComponent(e)}/default`)}async listSystems(e={}){let t=(0,Va.createListQueryParams)(e),a=t.size>0?`?${t.toString()}`:"";return this.restRequest("GET",`/v1/systems${a}`)}async listAllSystems(e={}){return(0,Va.listAllPages)((t,a)=>this.listSystems({...e,page:t,limit:a}))}async getSystem(e){return(await this.restRequest("GET",`/v1/systems/${encodeURIComponent(e)}`)).data}async createSystem(e){return(await this.restRequest("POST","/v1/systems",e)).data}async updateSystem(e,t){return(await this.restRequest("PATCH",`/v1/systems/${encodeURIComponent(e)}`,t)).data}async deleteSystem(e){return await this.restRequest("DELETE",`/v1/systems/${encodeURIComponent(e)}`),!0}async bulkDeleteSystems(e){return this.restRequest("POST","/v1/systems/bulk/delete",{ids:e})}async createOAuthExchange(e){return(await this.restRequest("POST","/v1/oauth/exchanges",e)).data}async completeOAuthExchange(e,t){return(await this.restRequest("POST",`/v1/oauth/exchanges/${encodeURIComponent(e)}/complete`,t)).data}async searchSystemDocumentation(e,t){return(await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/search`,{keywords:t})).data}async triggerSystemDocumentationScrapeJob(e,t){return(await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/scrape`,t)).data}async fetchOpenApiSpec(e,t,a){return(await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/openapi`,{url:t,link:a?.link})).data}async uploadSystemDocumentationFiles(e,t,a){let i=await this.uploadFiles(t,{process:!0}),r=i.flatMap(s=>s.status==="uploaded"?[s.id]:[]);if(r.length>0)try{await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/files`,{fileIds:r,link:a?.link!==!1})}catch(s){throw await Promise.all(r.map(n=>this.deleteFileUpload(n).catch(()=>{}))),s}if(!a?.settle){let s=i.filter(n=>n.status==="failed");if(s.length>0)throw new Error(s.map(n=>n.error).join("; "))}return i}async listSystemDocumentationFiles(e,t){let a=new URLSearchParams;t?.length&&a.set("fileIds",t.join(","));let i=a.size>0?`?${a.toString()}`:"";return(await this.restRequest("GET",`/v1/systems/${encodeURIComponent(e)}/documentation/files${i}`)).data}async getSystemDocumentationFileContent(e,t,a){return(await this.restRequest("GET",`/v1/systems/${encodeURIComponent(e)}/documentation/files/${encodeURIComponent(t)}/content?processed=${a.processed}`)).data}async deleteSystemDocumentationFile(e,t){await this.restRequest("DELETE",`/v1/systems/${encodeURIComponent(e)}/documentation/files/${encodeURIComponent(t)}`)}async generateCredentialsLink(e){try{return{success:!0,credentialsUrl:(await this.restRequest("POST","/v1/authenticate",e||{})).data.credentialsUrl}}catch(t){return{success:!1,error:t.message}}}};Dn.SuperglueClient=nv});var Z5=y(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.UnquotedKeyStrategy=Ce.TripleQuoteStrategy=Ce.TrailingCommaStrategy=Ce.SingleQuoteStrategy=Ce.PythonLiteralStrategy=Ce.CommentStrategy=Ce.ResilientJsonParser=Ce.RepairStrategy=void 0;Ce.parseJsonResilient=Bme;Ce.parseJSON=Qme;Ce.isValidJson=Sme;Ce.prettyPrintJson=Dme;Ce.minifyJson=Tme;var Ht=class{validate(e){try{return JSON.parse(e),!0}catch{return!1}}};Ce.RepairStrategy=Ht;var Wg=class extends Ht{constructor(){super(...arguments),this.name="TripleQuoteRepair",this.description="Converts triple-quoted strings to proper JSON, parsing nested JSON content"}canApply(e){return/"""/.test(e)}apply(e){return e.replace(/"""([\s\S]*?)"""/g,(t,a)=>{let i=a.trim();if(i.startsWith("{")&&i.endsWith("}")||i.startsWith("[")&&i.endsWith("]"))try{let s=JSON.parse(i);return JSON.stringify(s)}catch{return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`}return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`})}};Ce.TripleQuoteStrategy=Wg;var Jg=class extends Ht{constructor(){super(...arguments),this.name="PythonLiteralRepair",this.description="Converts Python literals to JavaScript equivalents"}canApply(e){return/\b(None|True|False)\b/.test(e)}apply(e){return e.replace(/\bNone\b/g,"null").replace(/\bTrue\b/g,"true").replace(/\bFalse\b/g,"false")}};Ce.PythonLiteralStrategy=Jg;var Kg=class extends Ht{constructor(){super(...arguments),this.name="TrailingCommaRepair",this.description="Removes trailing commas from objects and arrays"}canApply(e){return/,\s*[}\]]/.test(e)}apply(e){return e.replace(/,(\s*[}\]])/g,"$1")}};Ce.TrailingCommaStrategy=Kg;var Zg=class extends Ht{constructor(){super(...arguments),this.name="SingleQuoteRepair",this.description="Converts single quotes to double quotes"}canApply(e){return/[{,]\s*'[^']*'\s*:/.test(e)||/:\s*'[^']*'/.test(e)}apply(e){let t=e.replace(/([{,]\s*)'([^']+)'(\s*:)/g,'$1"$2"$3');return t=t.replace(/(:\s*)'([^']+)'(\s*[,}])/g,'$1"$2"$3'),t}};Ce.SingleQuoteStrategy=Zg;var Xg=class extends Ht{constructor(){super(...arguments),this.name="UnquotedKeyRepair",this.description="Adds quotes to unquoted object keys"}canApply(e){return/[{,]\s*[a-zA-Z_$][a-zA-Z0-9_$]*\s*:/.test(e)}apply(e){return e.replace(/([{,]\s*)([a-zA-Z_$][a-zA-Z0-9_$]*)(\s*:)/g,'$1"$2"$3')}};Ce.UnquotedKeyStrategy=Xg;var ep=class extends Ht{constructor(){super(...arguments),this.name="CommentRemoval",this.description="Removes JavaScript-style comments"}canApply(e){return/\/\/.*$|\/\*[\s\S]*?\*\//m.test(e)}apply(e){let t=e.replace(/\/\/.*$/gm,"");return t=t.replace(/\/\*[\s\S]*?\*\//g,""),t}};Ce.CommentStrategy=ep;var cv=class extends Ht{constructor(){super(...arguments),this.name="UnescapedControlCharactersRepair",this.description="Escapes unescaped control characters (newlines, tabs, etc.) in JSON strings"}canApply(e){try{return JSON.parse(e),!1}catch(t){let a=t.message||"";return a.includes("control character")||a.includes("Bad control")||a.includes("Unexpected token")&&/[\n\r\t]/.test(e)}}apply(e){let t="",a=!1,i=!1;for(let r=0;r<e.length;r++){let s=e[r],n=r>0?e[r-1]:"";if(i){t+=s,i=!1;continue}if(s==="\\"&&a){t+=s,i=!0;continue}if(s==='"'&&n!=="\\"){a=!a,t+=s;continue}if(a)switch(s){case`
|
|
1413
1419
|
`:t+="\\n";break;case"\r":t+="\\r";break;case" ":t+="\\t";break;case"\b":t+="\\b";break;case"\f":t+="\\f";break;default:let c=s.charCodeAt(0);c<32?t+="\\u"+("0000"+c.toString(16)).slice(-4):t+=s}else t+=s}return t}},mv=class extends Ht{constructor(){super(...arguments),this.name="TrailingCharactersRepair",this.description="Removes trailing characters after valid JSON structure"}canApply(e){let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return!1;let a=0,i=0,r=!1,s=!1;for(let n=0;n<t.length;n++){let c=t[n];if(r)s?s=!1:c==="\\"?s=!0:c==='"'&&(r=!1);else if(c==='"')r=!0;else if(c==="{")a++;else if(c==="}"){if(a--,a===0&&i===0&&n>0&&n<t.length-1)return!0}else if(c==="[")i++;else if(c==="]"&&(i--,i===0&&a===0&&n>0&&n<t.length-1))return!0}return!1}apply(e){let t=e.trim(),a=0,i=0,r=!1,s=!1,n=-1;for(let c=0;c<t.length;c++){let m=t[c];if(r)s?s=!1:m==="\\"?s=!0:m==='"'&&(r=!1);else if(m==='"')r=!0;else if(m==="{")a++;else if(m==="}"){if(a--,a===0&&i===0&&c>0){n=c;break}}else if(m==="[")i++;else if(m==="]"&&(i--,i===0&&a===0&&c>0)){n=c;break}}return n>0&&n<t.length-1?t.substring(0,n+1):e}},Tn=class{constructor(e={}){this.strategies=[],this.repairLog=[],this.options={attemptRepair:!0,maxDepth:10,preserveStringsOnFailure:!1,logRepairs:!1,...e},this.initializeDefaultStrategies(),e.customStrategies&&this.strategies.push(...e.customStrategies)}initializeDefaultStrategies(){this.strategies=[new Wg,new Zg,new cv,new mv,new Jg,new Kg,new Xg,new ep]}parse(e){let t=Date.now();this.repairLog=[];let a=e instanceof Buffer?e.toString("utf8"):String(e);try{return{success:!0,data:JSON.parse(a),metadata:{parseTime:Date.now()-t,strategiesApplied:[]}}}catch(s){if(!this.options.attemptRepair)return{success:!1,error:`JSON parse error: ${s}`,metadata:{parseTime:Date.now()-t}}}let i=a,r=[];for(let s of this.strategies)if(s.canApply(i)){let n=i;if(i=s.apply(i),n!==i){r.push(s.name),this.repairLog.push(s.description),this.options.logRepairs&&console.log(`Applied ${s.name}: ${s.description}`);try{return{success:!0,data:JSON.parse(i),repairs:this.repairLog,metadata:{parseTime:Date.now()-t,strategiesApplied:r}}}catch{}}}try{return{success:!0,data:JSON.parse(i),repairs:this.repairLog,metadata:{parseTime:Date.now()-t,strategiesApplied:r}}}catch(s){let n=this.aggressiveFallback(i);return n.success?{...n,repairs:[...this.repairLog,"Applied aggressive fallback"],metadata:{parseTime:Date.now()-t,strategiesApplied:[...r,"AggressiveFallback"]}}:{success:!1,error:`Failed to parse JSON after applying ${r.length} strategies: ${s}`,repairs:this.repairLog,metadata:{parseTime:Date.now()-t,strategiesApplied:r}}}}aggressiveFallback(e){try{let t=e.indexOf("{"),a=e.indexOf("[");if(t===-1&&a===-1)return{success:!1,error:"No JSON-like structure found"};let i=t===-1?a:a===-1?t:Math.min(t,a),r=e.substring(i);for(let n of this.strategies)n.canApply(r)&&(r=n.apply(r));return{success:!0,data:JSON.parse(r)}}catch(t){return{success:!1,error:`Aggressive fallback failed: ${t}`}}}addStrategy(e){this.strategies.push(e)}removeStrategy(e){this.strategies=this.strategies.filter(t=>t.name!==e)}getStrategies(){return this.strategies.map(e=>e.name)}};Ce.ResilientJsonParser=Tn;var K5=new Tn;function Bme(o,e){return(e?new Tn(e):K5).parse(o)}function Qme(o){let e=K5.parse(o);if(e.success)return e.repairs&&e.repairs.length>0&&console.log("JSON parsed with repairs:",e.repairs),e.data;throw new Error(`Failed to parse JSON: ${e.error}`)}function Sme(o){try{return JSON.parse(o),!0}catch{return!1}}function Dme(o,e=2){return JSON.stringify(o,null,e)}function Tme(o){let t=new Tn().parse(o);if(t.success)return JSON.stringify(t.data);throw new Error("Cannot minify invalid JSON")}});var tt=y(F=>{"use strict";var Rme=F&&F.__createBinding||(Object.create?(function(o,e,t,a){a===void 0&&(a=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(o,a,i)}):(function(o,e,t,a){a===void 0&&(a=t),o[a]=e[t]})),Z=F&&F.__exportStar||function(o,e){for(var t in o)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Rme(e,o,t)};Object.defineProperty(F,"__esModule",{value:!0});F.SSELogSubscriptionManager=F.SuperglueHttpError=F.SuperglueClient=void 0;Z(r1(),F);Z(h1(),F);Z(f1(),F);Z(w1(),F);Z(q1(),F);Z(Mc(),F);Z(H1(),F);Z(G1(),F);Z(Y1(),F);Z(V1(),F);Z(Jf(),F);Z(W1(),F);Z(J1(),F);Z(K1(),F);Z(X1(),F);Z(e2(),F);Z(t2(),F);Z(Al(),F);Z(i2(),F);Z(r2(),F);Z(n2(),F);Z(l2(),F);Z(d2(),F);Z(y2(),F);Z(A2(),F);Z(v2(),F);Z(D2(),F);Z(R2(),F);Z(lb(),F);Z(W2(),F);Z(yb(),F);Z(X2(),F);Z(aI(),F);Z(rI(),F);Z(rt(),F);Z(Kt(),F);Z(sI(),F);Z(nI(),F);Z(Ru(),F);Z(Cs(),F);Z(wu(),F);var X5=J5();Object.defineProperty(F,"SuperglueClient",{enumerable:!0,get:function(){return X5.SuperglueClient}});Object.defineProperty(F,"SuperglueHttpError",{enumerable:!0,get:function(){return X5.SuperglueHttpError}});var Nme=wb();Object.defineProperty(F,"SSELogSubscriptionManager",{enumerable:!0,get:function(){return Nme.SSELogSubscriptionManager}});Z(Z5(),F)});var Tp=require("commander");var Ro=W(require("fs")),t6=W(require("os")),Wa=W(require("path")),al=W(tt()),e6=new Set(["runner","builder","admin"]),o6={output:{mode:"stdout",directory:".superglue/output"},preset:"admin"};function Ja(o){let e=Wa.join(process.cwd(),".superglue"),t=t6.homedir();if(!t)return e;let a=Wa.join(t,".superglue");return o===!0?e:o===!1?a:Ro.existsSync(Wa.join(e,"config.json"))?e:a}function lv(o){return Wa.join(Ja(o),"config.json")}function op(o){let e=lv(o);if(!Ro.existsSync(e))return{};try{return JSON.parse(Ro.readFileSync(e,"utf-8"))}catch{return{}}}function Rn(o){let e=op(),t=o.apiKey||(0,al.readProcessEnvironmentValue)("SUPERGLUE_API_KEY")||e.apiKey||"",a=o.endpoint||(0,al.readProcessEnvironmentValue)("SUPERGLUE_API_ENDPOINT")||e.endpoint||"https://api.superglue.cloud",i=(0,al.readProcessEnvironmentValue)("SUPERGLUE_WEB_ENDPOINT")||e.webEndpoint||a.replace(/:3002\b/,":3001").replace(/api\.superglue/,"app.superglue"),r=(0,al.readProcessEnvironmentValue)("SUPERGLUE_CLI_PRESET"),s=r&&e6.has(r)?r:e.preset&&e6.has(e.preset)?e.preset:"admin";return{...o6,...e,apiKey:t,endpoint:a,webEndpoint:i,preset:s,output:{...o6.output,...e.output}}}function tp(o,e){let t=Ja(e);Ro.existsSync(t)||Ro.mkdirSync(t,{recursive:!0}),Ro.writeFileSync(Wa.join(t,"config.json"),JSON.stringify(o,null,2)+`
|
|
1414
|
-
`,{mode:384})}function ap(o,e){let t=Wa.join(Ja(e),"drafts");if(Ro.existsSync(t)||Ro.mkdirSync(t,{recursive:!0}),o.output.mode==="stdout+file"){let a=Wa.resolve(o.output.directory);Ro.existsSync(a)||Ro.mkdirSync(a,{recursive:!0})}}var bv=W(tt());var uv=W(require("readline"));var r6=require("child_process"),s6=require("util");var a6={name:"@superglue/cli",version:"1.1.
|
|
1420
|
+
`,{mode:384})}function ap(o,e){let t=Wa.join(Ja(e),"drafts");if(Ro.existsSync(t)||Ro.mkdirSync(t,{recursive:!0}),o.output.mode==="stdout+file"){let a=Wa.resolve(o.output.directory);Ro.existsSync(a)||Ro.mkdirSync(a,{recursive:!0})}}var bv=W(tt());var uv=W(require("readline"));var r6=require("child_process"),s6=require("util");var a6={name:"@superglue/cli",version:"1.1.78",bin:{sg:"./dist/cli.js"},files:[".claude-plugin/","dist/","skills/","LICENSE"],dependencies:{commander:"15.0.0-0","fast-json-patch":"3.1.1"},devDependencies:{"@superglue/shared":"file:../shared","@types/node":"25.5.0",tsup:"8.5.1",typescript:"5.8.3"},scripts:{build:"tsup && (cp -r skills dist/ 2>/dev/null || true)",dev:"tsup --watch","type-check":"tsc --noEmit",prepublishOnly:"npm run build"},publishConfig:{access:"public"}};var Ome=(0,s6.promisify)(r6.exec),xo=a6.version;function i6(o){let e=o.match(/^(\d+)(?:-(.+))?$/);return e?{numeric:parseInt(e[1],10),prerelease:e[2]||null}:{numeric:0,prerelease:o}}function rp(o,e){let t=o.split("."),a=e.split("."),i=Math.max(t.length,a.length);for(let r=0;r<i;r++){let s=i6(t[r]||"0"),n=i6(a[r]||"0");if(s.numeric<n.numeric)return-1;if(s.numeric>n.numeric||s.prerelease===null&&n.prerelease!==null)return 1;if(s.prerelease!==null&&n.prerelease===null)return-1;if(s.prerelease!==null&&n.prerelease!==null){if(s.prerelease<n.prerelease)return-1;if(s.prerelease>n.prerelease)return 1}}return 0}async function sp(){try{let o=await fetch("https://registry.npmjs.org/@superglue/cli/latest",{signal:AbortSignal.timeout(5e3)});return o.ok&&(await o.json()).version||null}catch{return null}}var ip=null;function n6(){G()&&(ip=sp())}async function c6(){if(!(!G()||!ip)){try{let o=new Promise(t=>{setTimeout(()=>t(null),2e3).unref()}),e=await Promise.race([ip,o]);e&&rp(xo,e)<0&&(console.error(""),console.error(`${h.cyan}${h.bold} Update available: ${xo} \u2192 ${e}${h.reset}`),console.error(`${h.cyan} Run ${h.bold}sg update${h.reset}${h.cyan} to upgrade${h.reset}`),console.error(""))}catch{}ip=null}}async function m6(){let o=await sp();if(!o)return{success:!1,message:"Could not fetch latest version from npm"};if(rp(xo,o)>=0)return{success:!0,message:`Already on latest version (${xo})`};try{return await Ome("npm install -g @superglue/cli@latest"),{success:!0,message:`Updated from ${xo} to ${o}`}}catch(e){return{success:!1,message:`Update failed: ${e.message}. Try manually: npm install -g @superglue/cli@latest`}}}var G=()=>process.argv.includes("--table")&&process.stdout.isTTY,Et=()=>process.argv.includes("--full"),h={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m"};function l6(o,e){let t=e||o;return`\x1B]8;;${o}\x07${h.underline}${h.cyan}${t}${h.reset}\x1B]8;;\x07`}function u6(){if(!G())return;let o=h.reset,e=h.dim,t="\x1B[47;30m",a=[" #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@- "," =@@@- @@@@ "," @@@ @@% "," -@@ @@@@= @@@ @@@ @@@@@#@ @@@@@@@ @@@@@@@ @@@@@@ @@@ @@@ @@@ @@@@@@* %@@ "," @@ @@@ *@ @@@ @@@ @@@ :@@ @@@ @@@ -@@ @@@ @% @@@ @@@ @@@ @@* @@# "," #@@ @@@# @@@ @@@ @@@ :@@ @@@ @@@ -@@ @@@ @@@ @@@ @@@ @@* @@ "," @@- @@@@= @@@ @@@ @@@@@@@ @@@@@@ @@@@@@@ @@@ @@% @@@ @@@ @@@ @@@@@. @@."," #@% .@@@@ @@@ @@@ @@@ @@@ @@@ -@@ @@@ @@% @@@ @@@ @@@ @@* @@ "," @@ @ @@@ @@@ @@@ @@@ @@@ @@@ -@@ @@@ @@% @@@ @@@ @@@ @@* *@@ "," -@@ @@@@= @@@@@@ @@@ @@@@@@@ @@@ -@@ @@@@@@ @@@@@@% @@@@@@. @@@@@@* #@@ "," :@@* @@@ "," %@@@ =@@@. "," :@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@% "];console.log(""),a.forEach(i=>{let r=i.search(/\S/),s=i.length-[...i].reverse().join("").search(/\S/)-1;if(r===-1)return console.log(" "+i);let n=i.slice(0,r),c=i.slice(r,s+1).split("").map(l=>l===" "?" ":"\u2588").join(""),m=i.slice(s+1);console.log(` ${n}${t}${c}${o}${m}`)}),console.log(` ${e} CLI v${xo}${o}`),console.log("")}function Ee(o){if(!G())return{stop:()=>{},update:()=>{},log:()=>{}};let e=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],t=0,a=o,i=()=>process.stdout.write("\r\x1B[2K"),r=()=>{process.stdout.write(`\r ${h.cyan}${e[t++%e.length]}${h.reset} ${a}`)},s=setInterval(r,80);return{update:n=>{a=n},log:n=>{i(),console.log(` ${h.dim}\u2502${h.reset} ${n}`),r()},stop:n=>{clearInterval(s),i(),n&&console.log(` ${n}`)}}}function U(o){G()?np(o):console.log(JSON.stringify(o,null,2))}function re(o,e){G()?(console.log(` ${h.green}\u2713${h.reset} ${o}`),e&&np(e,4)):console.log(JSON.stringify({success:!0,message:o,...e&&typeof e=="object"?e:{data:e}}))}function z(o,e){G()?(console.error(` ${h.red}\u2717${h.reset} ${o}`),e&&np(e,4)):console.error(JSON.stringify({success:!1,error:o,details:e}))}function d6(o){G()&&console.log(` ${h.yellow}\u26A0${h.reset} ${o}`)}function go(o){G()&&console.log(` ${h.dim}${o}${h.reset}`)}function Ka(o){G()&&(console.log(`
|
|
1415
1421
|
${h.bold}${h.cyan}${o}${h.reset}`),console.log(` ${h.dim}${"\u2500".repeat(o.length)}${h.reset}`))}function pa(o,e,t){if(!G()){console.log(JSON.stringify({success:!0,total:t?.total??o.length,items:o}));return}if(o.length===0){console.log(`
|
|
1416
1422
|
${h.dim}0 results${h.reset}
|
|
1417
1423
|
`);return}let a=e||Object.keys(o[0]),i=Et()?1/0:60,r=a.map(l=>Math.min(i,Math.max(l.length,...o.map(u=>String(u[l]??"").replace(/[\n\r]+/g," ").trim().length))));console.log("");let s=a.map((l,u)=>`${h.bold}${h.cyan}${l.toUpperCase().padEnd(r[u])}${h.reset}`).join(" ");console.log(` ${s}`);let n=r.map(l=>`${h.dim}${"\u2500".repeat(l)}${h.reset}`).join(`${h.dim}\u2500\u2500${h.reset}`);console.log(` ${n}`);for(let l of o){let u=a.map((d,g)=>{let p=String(l[d]??"").replace(/[\n\r]+/g," ").trim();if(p.length>i){let A=`\u2026 (${p.length})`;p=p.slice(0,Math.max(0,i-A.length))+`${h.dim}${A}${h.reset}`}return d==="status"?`${{success:h.green,running:h.yellow,failed:h.red,aborted:h.red,error:h.red,pending:h.dim}[p.toLowerCase()]||""}${p.padEnd(r[g])}${h.reset}`:p.padEnd(r[g])}).join(" ");console.log(` ${u}`)}let c=t?.total??o.length,m=c===o.length?`${o.length} result${o.length===1?"":"s"}`:`${o.length} of ${c} result${c===1?"":"s"}`;console.log(`
|