@liflig/cdk-cloudfront-auth 1.10.14 → 1.10.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
- var Sh=Object.create;var{getPrototypeOf:bh,defineProperty:Gt,getOwnPropertyNames:Us,getOwnPropertyDescriptor:vh}=Object,Hs=Object.prototype.hasOwnProperty;function Bs(e){return this[e]}var Ah,xh,ut=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var i=t?Ah??=new WeakMap:xh??=new WeakMap,o=i.get(e);if(o)return o}r=e!=null?Sh(bh(e)):{};let s=t||!e||!e.__esModule?Gt(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of Us(e))if(!Hs.call(s,a))Gt(s,a,{get:Bs.bind(e,a),enumerable:!0})}if(n)i.set(e,s);return s},Or=(e)=>{var t=(qs??=new WeakMap).get(e),r;if(t)return t;if(t=Gt({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var n of Us(e))if(!Hs.call(t,n))Gt(t,n,{get:Bs.bind(e,n),enumerable:!(r=vh(e,n))||r.enumerable})}return qs.set(e,t),t},qs,m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Th=(e)=>e;function Ch(e,t){this[e]=Th.bind(null,t)}var zt=(e,t)=>{for(var r in t)Gt(e,r,{get:t[r],enumerable:!0,configurable:!0,set:Ch.bind(t,r)})};var x=(e,t)=>()=>(e&&(t=e(e=0)),t);var ft=m(function(Ci,Qs){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Pr=require("buffer"),be=Pr.Buffer;function Zs(e,t){for(var r in e)t[r]=e[r]}if(be.from&&be.alloc&&be.allocUnsafe&&be.allocUnsafeSlow)Qs.exports=Pr;else Zs(Pr,Ci),Ci.Buffer=Me;function Me(e,t,r){return be(e,t,r)}Me.prototype=Object.create(be.prototype);Zs(be,Me);Me.from=function(e,t,r){if(typeof e==="number")throw TypeError("Argument must not be a number");return be(e,t,r)};Me.alloc=function(e,t,r){if(typeof e!=="number")throw TypeError("Argument must be a number");var n=be(e);if(t!==void 0)if(typeof r==="string")n.fill(t,r);else n.fill(t);else n.fill(0);return n};Me.allocUnsafe=function(e){if(typeof e!=="number")throw TypeError("Argument must be a number");return be(e)};Me.allocUnsafeSlow=function(e){if(typeof e!=="number")throw TypeError("Argument must be a number");return Pr.SlowBuffer(e)}});var Ii=m(function(ZA,ea){var Kr=ft().Buffer,Jh=require("stream"),Lh=require("util");function Nr(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=Kr.alloc(0),this;if(typeof e.pipe==="function")return this.buffer=Kr.alloc(0),e.pipe(this),this;if(e.length||typeof e==="object")return this.buffer=e,this.writable=!1,process.nextTick(function(){this.emit("end",e),this.readable=!1,this.emit("close")}.bind(this)),this;throw TypeError("Unexpected data type ("+typeof e+")")}Lh.inherits(Nr,Jh);Nr.prototype.write=function(t){this.buffer=Kr.concat([this.buffer,Kr.from(t)]),this.emit("data",t)};Nr.prototype.end=function(t){if(t)this.write(t);this.emit("end",t),this.emit("close"),this.writable=!1,this.readable=!1};ea.exports=Nr});var ra=m(function(QA,ta){function Ri(e){var t=(e/8|0)+(e%8===0?0:1);return t}var Wh={ES256:Ri(256),ES384:Ri(384),ES512:Ri(521)};function jh(e){var t=Wh[e];if(t)return t;throw Error('Unknown algorithm "'+e+'"')}ta.exports=jh});var ua=m(function(ex,ca){var $r=ft().Buffer,ia=ra(),Jr=128,oa=0,Dh=32,Fh=16,qh=2,sa=Fh|Dh|oa<<6,Lr=qh|oa<<6;function Uh(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function aa(e){if($r.isBuffer(e))return e;else if(typeof e==="string")return $r.from(e,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function Hh(e,t){e=aa(e);var r=ia(t),n=r+1,i=e.length,o=0;if(e[o++]!==sa)throw Error('Could not find expected "seq"');var s=e[o++];if(s===(Jr|1))s=e[o++];if(i-o<s)throw Error('"seq" specified length of "'+s+'", only "'+(i-o)+'" remaining');if(e[o++]!==Lr)throw Error('Could not find expected "int" for "r"');var a=e[o++];if(i-o-2<a)throw Error('"r" specified length of "'+a+'", only "'+(i-o-2)+'" available');if(n<a)throw Error('"r" specified length of "'+a+'", max of "'+n+'" is acceptable');var f=o;if(o+=a,e[o++]!==Lr)throw Error('Could not find expected "int" for "s"');var c=e[o++];if(i-o!==c)throw Error('"s" specified length of "'+c+'", expected "'+(i-o)+'"');if(n<c)throw Error('"s" specified length of "'+c+'", max of "'+n+'" is acceptable');var u=o;if(o+=c,o!==i)throw Error('Expected to consume entire buffer, but "'+(i-o)+'" bytes remain');var l=r-a,p=r-c,d=$r.allocUnsafe(l+a+p+c);for(o=0;o<l;++o)d[o]=0;e.copy(d,o,f+Math.max(-l,0),f+a),o=r;for(var g=o;o<g+p;++o)d[o]=0;return e.copy(d,o,u+Math.max(-p,0),u+c),d=d.toString("base64"),d=Uh(d),d}function na(e,t,r){var n=0;while(t+n<r&&e[t+n]===0)++n;var i=e[t+n]>=Jr;if(i)--n;return n}function Bh(e,t){e=aa(e);var r=ia(t),n=e.length;if(n!==r*2)throw TypeError('"'+t+'" signatures must be "'+r*2+'" bytes, saw "'+n+'"');var i=na(e,0,r),o=na(e,r,e.length),s=r-i,a=r-o,f=2+s+1+1+a,c=f<Jr,u=$r.allocUnsafe((c?2:3)+f),l=0;if(u[l++]=sa,c)u[l++]=f;else u[l++]=Jr|1,u[l++]=f&255;if(u[l++]=Lr,u[l++]=s,i<0)u[l++]=0,l+=e.copy(u,l,0,r);else l+=e.copy(u,l,i,r);if(u[l++]=Lr,u[l++]=a,o<0)u[l++]=0,e.copy(u,l,r);else e.copy(u,l,r+o);return u}ca.exports={derToJose:Hh,joseToDer:Bh}});var la=m(function(tx,fa){var Vt=require("buffer").Buffer,Oi=require("buffer").SlowBuffer;fa.exports=Wr;function Wr(e,t){if(!Vt.isBuffer(e)||!Vt.isBuffer(t))return!1;if(e.length!==t.length)return!1;var r=0;for(var n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}Wr.install=function(){Vt.prototype.equal=Oi.prototype.equal=function(t){return Wr(this,t)}};var Mh=Vt.prototype.equal,Gh=Oi.prototype.equal;Wr.restore=function(){Vt.prototype.equal=Mh,Oi.prototype.equal=Gh}});var Ki=m(function(rx,Sa){var dt=ft().Buffer,ae=require("crypto"),pa=ua(),da=require("util"),zh=`"%s" is not a valid algorithm.
1
+ var Sh=Object.create;var{getPrototypeOf:bh,defineProperty:zt,getOwnPropertyNames:Us,getOwnPropertyDescriptor:vh}=Object,Hs=Object.prototype.hasOwnProperty;function Bs(e){return this[e]}var Ah,xh,ut=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var i=t?Ah??=new WeakMap:xh??=new WeakMap,o=i.get(e);if(o)return o}r=e!=null?Sh(bh(e)):{};let s=t||!e||!e.__esModule?zt(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of Us(e))if(!Hs.call(s,a))zt(s,a,{get:Bs.bind(e,a),enumerable:!0})}if(n)i.set(e,s);return s},_r=(e)=>{var t=(qs??=new WeakMap).get(e),r;if(t)return t;if(t=zt({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var n of Us(e))if(!Hs.call(t,n))zt(t,n,{get:Bs.bind(e,n),enumerable:!(r=vh(e,n))||r.enumerable})}return qs.set(e,t),t},qs,m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Th=(e)=>e;function Ch(e,t){this[e]=Th.bind(null,t)}var Vt=(e,t)=>{for(var r in t)zt(e,r,{get:t[r],enumerable:!0,configurable:!0,set:Ch.bind(t,r)})};var x=(e,t)=>()=>(e&&(t=e(e=0)),t);var lt=m(function(Ci,Qs){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Kr=require("buffer"),be=Kr.Buffer;function Zs(e,t){for(var r in e)t[r]=e[r]}if(be.from&&be.alloc&&be.allocUnsafe&&be.allocUnsafeSlow)Qs.exports=Kr;else Zs(Kr,Ci),Ci.Buffer=Me;function Me(e,t,r){return be(e,t,r)}Me.prototype=Object.create(be.prototype);Zs(be,Me);Me.from=function(e,t,r){if(typeof e==="number")throw TypeError("Argument must not be a number");return be(e,t,r)};Me.alloc=function(e,t,r){if(typeof e!=="number")throw TypeError("Argument must be a number");var n=be(e);if(t!==void 0)if(typeof r==="string")n.fill(t,r);else n.fill(t);else n.fill(0);return n};Me.allocUnsafe=function(e){if(typeof e!=="number")throw TypeError("Argument must be a number");return be(e)};Me.allocUnsafeSlow=function(e){if(typeof e!=="number")throw TypeError("Argument must be a number");return Kr.SlowBuffer(e)}});var Ii=m(function(ZA,ea){var Nr=lt().Buffer,Lh=require("stream"),Jh=require("util");function $r(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=Nr.alloc(0),this;if(typeof e.pipe==="function")return this.buffer=Nr.alloc(0),e.pipe(this),this;if(e.length||typeof e==="object")return this.buffer=e,this.writable=!1,process.nextTick(function(){this.emit("end",e),this.readable=!1,this.emit("close")}.bind(this)),this;throw TypeError("Unexpected data type ("+typeof e+")")}Jh.inherits($r,Lh);$r.prototype.write=function(t){this.buffer=Nr.concat([this.buffer,Nr.from(t)]),this.emit("data",t)};$r.prototype.end=function(t){if(t)this.write(t);this.emit("end",t),this.emit("close"),this.writable=!1,this.readable=!1};ea.exports=$r});var ra=m(function(QA,ta){function Ri(e){var t=(e/8|0)+(e%8===0?0:1);return t}var Wh={ES256:Ri(256),ES384:Ri(384),ES512:Ri(521)};function jh(e){var t=Wh[e];if(t)return t;throw Error('Unknown algorithm "'+e+'"')}ta.exports=jh});var ua=m(function(ex,ca){var Lr=lt().Buffer,ia=ra(),Jr=128,oa=0,Dh=32,Fh=16,qh=2,sa=Fh|Dh|oa<<6,Wr=qh|oa<<6;function Uh(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function aa(e){if(Lr.isBuffer(e))return e;else if(typeof e==="string")return Lr.from(e,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function Hh(e,t){e=aa(e);var r=ia(t),n=r+1,i=e.length,o=0;if(e[o++]!==sa)throw Error('Could not find expected "seq"');var s=e[o++];if(s===(Jr|1))s=e[o++];if(i-o<s)throw Error('"seq" specified length of "'+s+'", only "'+(i-o)+'" remaining');if(e[o++]!==Wr)throw Error('Could not find expected "int" for "r"');var a=e[o++];if(i-o-2<a)throw Error('"r" specified length of "'+a+'", only "'+(i-o-2)+'" available');if(n<a)throw Error('"r" specified length of "'+a+'", max of "'+n+'" is acceptable');var f=o;if(o+=a,e[o++]!==Wr)throw Error('Could not find expected "int" for "s"');var c=e[o++];if(i-o!==c)throw Error('"s" specified length of "'+c+'", expected "'+(i-o)+'"');if(n<c)throw Error('"s" specified length of "'+c+'", max of "'+n+'" is acceptable');var u=o;if(o+=c,o!==i)throw Error('Expected to consume entire buffer, but "'+(i-o)+'" bytes remain');var l=r-a,p=r-c,d=Lr.allocUnsafe(l+a+p+c);for(o=0;o<l;++o)d[o]=0;e.copy(d,o,f+Math.max(-l,0),f+a),o=r;for(var g=o;o<g+p;++o)d[o]=0;return e.copy(d,o,u+Math.max(-p,0),u+c),d=d.toString("base64"),d=Uh(d),d}function na(e,t,r){var n=0;while(t+n<r&&e[t+n]===0)++n;var i=e[t+n]>=Jr;if(i)--n;return n}function Bh(e,t){e=aa(e);var r=ia(t),n=e.length;if(n!==r*2)throw TypeError('"'+t+'" signatures must be "'+r*2+'" bytes, saw "'+n+'"');var i=na(e,0,r),o=na(e,r,e.length),s=r-i,a=r-o,f=2+s+1+1+a,c=f<Jr,u=Lr.allocUnsafe((c?2:3)+f),l=0;if(u[l++]=sa,c)u[l++]=f;else u[l++]=Jr|1,u[l++]=f&255;if(u[l++]=Wr,u[l++]=s,i<0)u[l++]=0,l+=e.copy(u,l,0,r);else l+=e.copy(u,l,i,r);if(u[l++]=Wr,u[l++]=a,o<0)u[l++]=0,e.copy(u,l,r);else e.copy(u,l,r+o);return u}ca.exports={derToJose:Hh,joseToDer:Bh}});var la=m(function(tx,fa){var Xt=require("buffer").Buffer,Oi=require("buffer").SlowBuffer;fa.exports=jr;function jr(e,t){if(!Xt.isBuffer(e)||!Xt.isBuffer(t))return!1;if(e.length!==t.length)return!1;var r=0;for(var n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}jr.install=function(){Xt.prototype.equal=Oi.prototype.equal=function(t){return jr(this,t)}};var Mh=Xt.prototype.equal,Gh=Oi.prototype.equal;jr.restore=function(){Xt.prototype.equal=Mh,Oi.prototype.equal=Gh}});var Ki=m(function(rx,Sa){var pt=lt().Buffer,ae=require("crypto"),pa=ua(),da=require("util"),zh=`"%s" is not a valid algorithm.
2
2
  Supported algorithms are:
3
- "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,Xt="secret must be a string or buffer",lt="key must be a string or a buffer",Vh="key must be a string, a buffer or an object",ki=typeof ae.createPublicKey==="function";if(ki)lt+=" or a KeyObject",Xt+="or a KeyObject";function ha(e){if(dt.isBuffer(e))return;if(typeof e==="string")return;if(!ki)throw he(lt);if(typeof e!=="object")throw he(lt);if(typeof e.type!=="string")throw he(lt);if(typeof e.asymmetricKeyType!=="string")throw he(lt);if(typeof e.export!=="function")throw he(lt)}function ma(e){if(dt.isBuffer(e))return;if(typeof e==="string")return;if(typeof e==="object")return;throw he(Vh)}function Xh(e){if(dt.isBuffer(e))return;if(typeof e==="string")return e;if(!ki)throw he(Xt);if(typeof e!=="object")throw he(Xt);if(e.type!=="secret")throw he(Xt);if(typeof e.export!=="function")throw he(Xt)}function Pi(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ya(e){e=e.toString();var t=4-e.length%4;if(t!==4)for(var r=0;r<t;++r)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function he(e){var t=[].slice.call(arguments,1),r=da.format.bind(da,e).apply(null,t);return TypeError(r)}function Yh(e){return dt.isBuffer(e)||typeof e==="string"}function Yt(e){if(!Yh(e))e=JSON.stringify(e);return e}function ga(e){return function(r,n){Xh(n),r=Yt(r);var i=ae.createHmac("sha"+e,n),o=(i.update(r),i.digest("base64"));return Pi(o)}}var _i,Zh="timingSafeEqual"in ae?function(t,r){if(t.byteLength!==r.byteLength)return!1;return ae.timingSafeEqual(t,r)}:function(t,r){if(!_i)_i=la();return _i(t,r)};function Qh(e){return function(r,n,i){var o=ga(e)(r,i);return Zh(dt.from(n),dt.from(o))}}function wa(e){return function(r,n){ma(n),r=Yt(r);var i=ae.createSign("RSA-SHA"+e),o=(i.update(r),i.sign(n,"base64"));return Pi(o)}}function Ea(e){return function(r,n,i){ha(i),r=Yt(r),n=ya(n);var o=ae.createVerify("RSA-SHA"+e);return o.update(r),o.verify(i,n,"base64")}}function em(e){return function(r,n){ma(n),r=Yt(r);var i=ae.createSign("RSA-SHA"+e),o=(i.update(r),i.sign({key:n,padding:ae.constants.RSA_PKCS1_PSS_PADDING,saltLength:ae.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return Pi(o)}}function tm(e){return function(r,n,i){ha(i),r=Yt(r),n=ya(n);var o=ae.createVerify("RSA-SHA"+e);return o.update(r),o.verify({key:i,padding:ae.constants.RSA_PKCS1_PSS_PADDING,saltLength:ae.constants.RSA_PSS_SALTLEN_DIGEST},n,"base64")}}function rm(e){var t=wa(e);return function(){var n=t.apply(null,arguments);return n=pa.derToJose(n,"ES"+e),n}}function nm(e){var t=Ea(e);return function(n,i,o){i=pa.joseToDer(i,"ES"+e).toString("base64");var s=t(n,i,o);return s}}function im(){return function(){return""}}function om(){return function(t,r){return r===""}}Sa.exports=function(t){var r={hs:ga,rs:wa,ps:em,es:rm,none:im},n={hs:Qh,rs:Ea,ps:tm,es:nm,none:om},i=t.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!i)throw he(zh,t);var o=(i[1]||i[3]).toLowerCase(),s=i[2];return{sign:r[o](s),verify:n[o](s)}}});var Ni=m(function(nx,ba){var sm=require("buffer").Buffer;ba.exports=function(t){if(typeof t==="string")return t;if(typeof t==="number"||sm.isBuffer(t))return t.toString();return JSON.stringify(t)}});var Ia=m(function(ix,Ca){var am=ft().Buffer,va=Ii(),cm=Ki(),um=require("stream"),Aa=Ni(),$i=require("util");function xa(e,t){return am.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function fm(e,t,r){r=r||"utf8";var n=xa(Aa(e),"binary"),i=xa(Aa(t),r);return $i.format("%s.%s",n,i)}function Ta(e){var{header:t,payload:r}=e,n=e.secret||e.privateKey,i=e.encoding,o=cm(t.alg),s=fm(t,r,i),a=o.sign(s,n);return $i.format("%s.%s",s,a)}function jr(e){var t=e.secret;if(t=t==null?e.privateKey:t,t=t==null?e.key:t,/^hs/i.test(e.header.alg)===!0&&t==null)throw TypeError("secret must be a string or buffer or a KeyObject");var r=new va(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new va(e.payload),this.secret.once("close",function(){if(!this.payload.writable&&this.readable)this.sign()}.bind(this)),this.payload.once("close",function(){if(!this.secret.writable&&this.readable)this.sign()}.bind(this))}$i.inherits(jr,um);jr.prototype.sign=function(){try{var t=Ta({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",t),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(r){this.readable=!1,this.emit("error",r),this.emit("close")}};jr.sign=Ta;Ca.exports=jr});var La=m(function(ox,Ja){var Oa=ft().Buffer,Ra=Ii(),lm=Ki(),dm=require("stream"),_a=Ni(),pm=require("util"),hm=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function mm(e){return Object.prototype.toString.call(e)==="[object Object]"}function ym(e){if(mm(e))return e;try{return JSON.parse(e)}catch(t){return}}function ka(e){var t=e.split(".",1)[0];return ym(Oa.from(t,"base64").toString("binary"))}function gm(e){return e.split(".",2).join(".")}function Pa(e){return e.split(".")[2]}function wm(e,t){t=t||"utf8";var r=e.split(".")[1];return Oa.from(r,"base64").toString(t)}function Ka(e){return hm.test(e)&&!!ka(e)}function Na(e,t,r){if(!t){var n=Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}e=_a(e);var i=Pa(e),o=gm(e),s=lm(t);return s.verify(o,i,r)}function $a(e,t){if(t=t||{},e=_a(e),!Ka(e))return null;var r=ka(e);if(!r)return null;var n=wm(e);if(r.typ==="JWT"||t.json)n=JSON.parse(n,t.encoding);return{header:r,payload:n,signature:Pa(e)}}function pt(e){e=e||{};var t=e.secret;if(t=t==null?e.publicKey:t,t=t==null?e.key:t,/^hs/i.test(e.algorithm)===!0&&t==null)throw TypeError("secret must be a string or buffer or a KeyObject");var r=new Ra(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new Ra(e.signature),this.secret.once("close",function(){if(!this.signature.writable&&this.readable)this.verify()}.bind(this)),this.signature.once("close",function(){if(!this.secret.writable&&this.readable)this.verify()}.bind(this))}pm.inherits(pt,dm);pt.prototype.verify=function(){try{var t=Na(this.signature.buffer,this.algorithm,this.key.buffer),r=$a(this.signature.buffer,this.encoding);return this.emit("done",t,r),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(n){this.readable=!1,this.emit("error",n),this.emit("close")}};pt.decode=$a;pt.isValid=Ka;pt.verify=Na;Ja.exports=pt});var Fr=m(function(Ke){var Wa=Ia(),Dr=La(),Em=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];Ke.ALGORITHMS=Em;Ke.sign=Wa.sign;Ke.verify=Dr.verify;Ke.decode=Dr.decode;Ke.isValid=Dr.isValid;Ke.createSign=function(t){return new Wa(t)};Ke.createVerify=function(t){return new Dr(t)}});var Ji=m(function(ax,ja){var Sm=Fr();ja.exports=function(e,t){t=t||{};var r=Sm.decode(e,t);if(!r)return null;var n=r.payload;if(typeof n==="string")try{var i=JSON.parse(n);if(i!==null&&typeof i==="object")n=i}catch(o){}if(t.complete===!0)return{header:r.header,payload:n,signature:r.signature};return n}});var Zt=m(function(cx,Da){var qr=function(e,t){if(Error.call(this,e),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);if(this.name="JsonWebTokenError",this.message=e,t)this.inner=t};qr.prototype=Object.create(Error.prototype);qr.prototype.constructor=qr;Da.exports=qr});var Li=m(function(ux,qa){var Fa=Zt(),Ur=function(e,t){Fa.call(this,e),this.name="NotBeforeError",this.date=t};Ur.prototype=Object.create(Fa.prototype);Ur.prototype.constructor=Ur;qa.exports=Ur});var Wi=m(function(fx,Ha){var Ua=Zt(),Hr=function(e,t){Ua.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};Hr.prototype=Object.create(Ua.prototype);Hr.prototype.constructor=Hr;Ha.exports=Hr});var ji=m(function(lx,Ba){var ht=1000,mt=ht*60,yt=mt*60,Ge=yt*24,bm=Ge*7,vm=Ge*365.25;Ba.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Am(e);else if(r==="number"&&isFinite(e))return t.long?Tm(e):xm(e);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Am(e){if(e=String(e),e.length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*vm;case"weeks":case"week":case"w":return r*bm;case"days":case"day":case"d":return r*Ge;case"hours":case"hour":case"hrs":case"hr":case"h":return r*yt;case"minutes":case"minute":case"mins":case"min":case"m":return r*mt;case"seconds":case"second":case"secs":case"sec":case"s":return r*ht;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}function xm(e){var t=Math.abs(e);if(t>=Ge)return Math.round(e/Ge)+"d";if(t>=yt)return Math.round(e/yt)+"h";if(t>=mt)return Math.round(e/mt)+"m";if(t>=ht)return Math.round(e/ht)+"s";return e+"ms"}function Tm(e){var t=Math.abs(e);if(t>=Ge)return Br(e,t,Ge,"day");if(t>=yt)return Br(e,t,yt,"hour");if(t>=mt)return Br(e,t,mt,"minute");if(t>=ht)return Br(e,t,ht,"second");return e+" ms"}function Br(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}});var Di=m(function(dx,Ma){var Cm=ji();Ma.exports=function(e,t){var r=t||Math.floor(Date.now()/1000);if(typeof e==="string"){var n=Cm(e);if(typeof n>"u")return;return Math.floor(r+n/1000)}else if(typeof e==="number")return r+e;else return}});var gt=m(function(px,Ga){var Im=Number.MAX_SAFE_INTEGER||9007199254740991,Rm=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Ga.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Im,RELEASE_TYPES:Rm,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Qt=m(function(hx,za){var Om=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};za.exports=Om});var wt=m(function(ve,Va){var{MAX_SAFE_COMPONENT_LENGTH:Fi,MAX_SAFE_BUILD_LENGTH:_m,MAX_LENGTH:km}=gt(),Pm=Qt();ve=Va.exports={};var Km=ve.re=[],Nm=ve.safeRe=[],b=ve.src=[],$m=ve.safeSrc=[],v=ve.t={},Jm=0,qi="[a-zA-Z0-9-]",Lm=[["\\s",1],["\\d",km],[qi,_m]],Wm=(e)=>{for(let[t,r]of Lm)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},C=(e,t,r)=>{let n=Wm(t),i=Jm++;Pm(e,i,t),v[e]=i,b[i]=t,$m[i]=n,Km[i]=new RegExp(t,r?"g":void 0),Nm[i]=new RegExp(n,r?"g":void 0)};C("NUMERICIDENTIFIER","0|[1-9]\\d*");C("NUMERICIDENTIFIERLOOSE","\\d+");C("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${qi}*`);C("MAINVERSION",`(${b[v.NUMERICIDENTIFIER]})\\.(${b[v.NUMERICIDENTIFIER]})\\.(${b[v.NUMERICIDENTIFIER]})`);C("MAINVERSIONLOOSE",`(${b[v.NUMERICIDENTIFIERLOOSE]})\\.(${b[v.NUMERICIDENTIFIERLOOSE]})\\.(${b[v.NUMERICIDENTIFIERLOOSE]})`);C("PRERELEASEIDENTIFIER",`(?:${b[v.NONNUMERICIDENTIFIER]}|${b[v.NUMERICIDENTIFIER]})`);C("PRERELEASEIDENTIFIERLOOSE",`(?:${b[v.NONNUMERICIDENTIFIER]}|${b[v.NUMERICIDENTIFIERLOOSE]})`);C("PRERELEASE",`(?:-(${b[v.PRERELEASEIDENTIFIER]}(?:\\.${b[v.PRERELEASEIDENTIFIER]})*))`);C("PRERELEASELOOSE",`(?:-?(${b[v.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[v.PRERELEASEIDENTIFIERLOOSE]})*))`);C("BUILDIDENTIFIER",`${qi}+`);C("BUILD",`(?:\\+(${b[v.BUILDIDENTIFIER]}(?:\\.${b[v.BUILDIDENTIFIER]})*))`);C("FULLPLAIN",`v?${b[v.MAINVERSION]}${b[v.PRERELEASE]}?${b[v.BUILD]}?`);C("FULL",`^${b[v.FULLPLAIN]}$`);C("LOOSEPLAIN",`[v=\\s]*${b[v.MAINVERSIONLOOSE]}${b[v.PRERELEASELOOSE]}?${b[v.BUILD]}?`);C("LOOSE",`^${b[v.LOOSEPLAIN]}$`);C("GTLT","((?:<|>)?=?)");C("XRANGEIDENTIFIERLOOSE",`${b[v.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);C("XRANGEIDENTIFIER",`${b[v.NUMERICIDENTIFIER]}|x|X|\\*`);C("XRANGEPLAIN",`[v=\\s]*(${b[v.XRANGEIDENTIFIER]})(?:\\.(${b[v.XRANGEIDENTIFIER]})(?:\\.(${b[v.XRANGEIDENTIFIER]})(?:${b[v.PRERELEASE]})?${b[v.BUILD]}?)?)?`);C("XRANGEPLAINLOOSE",`[v=\\s]*(${b[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[v.XRANGEIDENTIFIERLOOSE]})(?:${b[v.PRERELEASELOOSE]})?${b[v.BUILD]}?)?)?`);C("XRANGE",`^${b[v.GTLT]}\\s*${b[v.XRANGEPLAIN]}$`);C("XRANGELOOSE",`^${b[v.GTLT]}\\s*${b[v.XRANGEPLAINLOOSE]}$`);C("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Fi}})(?:\\.(\\d{1,${Fi}}))?(?:\\.(\\d{1,${Fi}}))?`);C("COERCE",`${b[v.COERCEPLAIN]}(?:$|[^\\d])`);C("COERCEFULL",b[v.COERCEPLAIN]+`(?:${b[v.PRERELEASE]})?(?:${b[v.BUILD]})?(?:$|[^\\d])`);C("COERCERTL",b[v.COERCE],!0);C("COERCERTLFULL",b[v.COERCEFULL],!0);C("LONETILDE","(?:~>?)");C("TILDETRIM",`(\\s*)${b[v.LONETILDE]}\\s+`,!0);ve.tildeTrimReplace="$1~";C("TILDE",`^${b[v.LONETILDE]}${b[v.XRANGEPLAIN]}$`);C("TILDELOOSE",`^${b[v.LONETILDE]}${b[v.XRANGEPLAINLOOSE]}$`);C("LONECARET","(?:\\^)");C("CARETTRIM",`(\\s*)${b[v.LONECARET]}\\s+`,!0);ve.caretTrimReplace="$1^";C("CARET",`^${b[v.LONECARET]}${b[v.XRANGEPLAIN]}$`);C("CARETLOOSE",`^${b[v.LONECARET]}${b[v.XRANGEPLAINLOOSE]}$`);C("COMPARATORLOOSE",`^${b[v.GTLT]}\\s*(${b[v.LOOSEPLAIN]})$|^$`);C("COMPARATOR",`^${b[v.GTLT]}\\s*(${b[v.FULLPLAIN]})$|^$`);C("COMPARATORTRIM",`(\\s*)${b[v.GTLT]}\\s*(${b[v.LOOSEPLAIN]}|${b[v.XRANGEPLAIN]})`,!0);ve.comparatorTrimReplace="$1$2$3";C("HYPHENRANGE",`^\\s*(${b[v.XRANGEPLAIN]})\\s+-\\s+(${b[v.XRANGEPLAIN]})\\s*$`);C("HYPHENRANGELOOSE",`^\\s*(${b[v.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[v.XRANGEPLAINLOOSE]})\\s*$`);C("STAR","(<|>)?=?\\s*\\*");C("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");C("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Mr=m(function(mx,Xa){var jm=Object.freeze({loose:!0}),Dm=Object.freeze({}),Fm=(e)=>{if(!e)return Dm;if(typeof e!=="object")return jm;return e};Xa.exports=Fm});var Ui=m(function(yx,Qa){var Ya=/^[0-9]+$/,Za=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=Ya.test(e),n=Ya.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},qm=(e,t)=>Za(t,e);Qa.exports={compareIdentifiers:Za,rcompareIdentifiers:qm}});var Y=m(function(gx,tc){var Gr=Qt(),{MAX_LENGTH:ec,MAX_SAFE_INTEGER:zr}=gt(),{safeRe:Vr,t:Xr}=wt(),Um=Mr(),{compareIdentifiers:Hi}=Ui(),Hm=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(Hi(e[n],r[n])!==0)return!1;return!0};class me{constructor(e,t){if(t=Um(t),e instanceof me)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>ec)throw TypeError(`version is longer than ${ec} characters`);Gr("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?Vr[Xr.LOOSE]:Vr[Xr.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>zr||this.major<0)throw TypeError("Invalid major version");if(this.minor>zr||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>zr||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<zr)return i}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(Gr("SemVer.compare",this.version,this.options,e),!(e instanceof me)){if(typeof e==="string"&&e===this.version)return 0;e=new me(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof me))e=new me(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof me))e=new me(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(Gr("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return Hi(r,n)}while(++t)}compareBuild(e){if(!(e instanceof me))e=new me(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(Gr("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return Hi(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?Vr[Xr.PRERELEASELOOSE]:Vr[Xr.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;while(--i>=0)if(typeof this.prerelease[i]==="number")this.prerelease[i]++,i=-2;if(i===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let i=[t,n];if(r===!1)i=[t];if(Hm(this.prerelease,t)){let o=this.prerelease[t.split(".").length];if(isNaN(o))this.prerelease=i}else this.prerelease=i}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}tc.exports=me});var Ne=m(function(wx,nc){var rc=Y(),Bm=(e,t,r=!1)=>{if(e instanceof rc)return e;try{return new rc(e,t)}catch(n){if(!r)return null;throw n}};nc.exports=Bm});var oc=m(function(Ex,ic){var Mm=Ne(),Gm=(e,t)=>{let r=Mm(e,t);return r?r.version:null};ic.exports=Gm});var ac=m(function(Sx,sc){var zm=Ne(),Vm=(e,t)=>{let r=zm(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};sc.exports=Vm});var fc=m(function(bx,uc){var cc=Y(),Xm=(e,t,r,n,i)=>{if(typeof r==="string")i=n,n=r,r=void 0;try{return new cc(e instanceof cc?e.version:e,r).inc(t,n,i).version}catch(o){return null}};uc.exports=Xm});var pc=m(function(vx,dc){var lc=Ne(),Ym=(e,t)=>{let r=lc(e,null,!0),n=lc(t,null,!0),i=r.compare(n);if(i===0)return null;let o=i>0,s=o?r:n,a=o?n:r,f=!!s.prerelease.length;if(!!a.prerelease.length&&!f){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let u=f?"pre":"";if(r.major!==n.major)return u+"major";if(r.minor!==n.minor)return u+"minor";if(r.patch!==n.patch)return u+"patch";return"prerelease"};dc.exports=Ym});var mc=m(function(Ax,hc){var Zm=Y(),Qm=(e,t)=>new Zm(e,t).major;hc.exports=Qm});var gc=m(function(xx,yc){var ey=Y(),ty=(e,t)=>new ey(e,t).minor;yc.exports=ty});var Ec=m(function(Tx,wc){var ry=Y(),ny=(e,t)=>new ry(e,t).patch;wc.exports=ny});var bc=m(function(Cx,Sc){var iy=Ne(),oy=(e,t)=>{let r=iy(e,t);return r&&r.prerelease.length?r.prerelease:null};Sc.exports=oy});var ce=m(function(Ix,Ac){var vc=Y(),sy=(e,t,r)=>new vc(e,r).compare(new vc(t,r));Ac.exports=sy});var Tc=m(function(Rx,xc){var ay=ce(),cy=(e,t,r)=>ay(t,e,r);xc.exports=cy});var Ic=m(function(Ox,Cc){var uy=ce(),fy=(e,t)=>uy(e,t,!0);Cc.exports=fy});var Yr=m(function(_x,Oc){var Rc=Y(),ly=(e,t,r)=>{let n=new Rc(e,r),i=new Rc(t,r);return n.compare(i)||n.compareBuild(i)};Oc.exports=ly});var kc=m(function(kx,_c){var dy=Yr(),py=(e,t)=>e.sort((r,n)=>dy(r,n,t));_c.exports=py});var Kc=m(function(Px,Pc){var hy=Yr(),my=(e,t)=>e.sort((r,n)=>hy(n,r,t));Pc.exports=my});var er=m(function(Kx,Nc){var yy=ce(),gy=(e,t,r)=>yy(e,t,r)>0;Nc.exports=gy});var Zr=m(function(Nx,$c){var wy=ce(),Ey=(e,t,r)=>wy(e,t,r)<0;$c.exports=Ey});var Bi=m(function($x,Jc){var Sy=ce(),by=(e,t,r)=>Sy(e,t,r)===0;Jc.exports=by});var Mi=m(function(Jx,Lc){var vy=ce(),Ay=(e,t,r)=>vy(e,t,r)!==0;Lc.exports=Ay});var Qr=m(function(Lx,Wc){var xy=ce(),Ty=(e,t,r)=>xy(e,t,r)>=0;Wc.exports=Ty});var en=m(function(Wx,jc){var Cy=ce(),Iy=(e,t,r)=>Cy(e,t,r)<=0;jc.exports=Iy});var Gi=m(function(jx,Dc){var Ry=Bi(),Oy=Mi(),_y=er(),ky=Qr(),Py=Zr(),Ky=en(),Ny=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return Ry(e,r,n);case"!=":return Oy(e,r,n);case">":return _y(e,r,n);case">=":return ky(e,r,n);case"<":return Py(e,r,n);case"<=":return Ky(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};Dc.exports=Ny});var qc=m(function(Dx,Fc){var $y=Y(),Jy=Ne(),{safeRe:tn,t:rn}=wt(),Ly=(e,t)=>{if(e instanceof $y)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?tn[rn.COERCEFULL]:tn[rn.COERCE]);else{let f=t.includePrerelease?tn[rn.COERCERTLFULL]:tn[rn.COERCERTL],c;while((c=f.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||c.index+c[0].length!==r.index+r[0].length)r=c;f.lastIndex=c.index+c[1].length+c[2].length}f.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",o=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Jy(`${n}.${i}.${o}${s}${a}`,t)};Fc.exports=Ly});var Hc=m(function(Fx,Uc){var Wy=Ne(),jy=gt(),Dy=Y(),Fy=(e,t,r)=>{if(!jy.RELEASE_TYPES.includes(t))return null;let n=qy(e,r);return n&&Uy(n,t)},qy=(e,t)=>{let r=e instanceof Dy?e.version:e;return Wy(r,t)},Uy=(e,t)=>{if(Hy(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},Hy=(e)=>e.startsWith("pre");Uc.exports=Fy});var Gc=m(function(qx,Mc){class Bc{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}Mc.exports=Bc});var ue=m(function(Ux,Yc){var By=/\s+/g;class tr{constructor(e,t){if(t=Gy(t),e instanceof tr)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new tr(e.raw,t);if(e instanceof zi)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(By," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!Vc(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&rg(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(tg,"");let r=((this.options.includePrerelease&&Qy)|(this.options.loose&&eg))+":"+e,n=zc.get(r);if(n)return n;let i=this.options.loose,o=i?te[Z.HYPHENRANGELOOSE]:te[Z.HYPHENRANGE];e=e.replace(o,pg(this.options.includePrerelease)),W("hyphen replace",e),e=e.replace(te[Z.COMPARATORTRIM],Xy),W("comparator trim",e),e=e.replace(te[Z.TILDETRIM],Yy),W("tilde trim",e),e=e.replace(te[Z.CARETTRIM],Zy),W("caret trim",e);let s=e.split(" ").map((u)=>ng(u,this.options)).join(" ").split(/\s+/).map((u)=>dg(u,this.options));if(i)s=s.filter((u)=>(W("loose invalid filter",u,this.options),!!u.match(te[Z.COMPARATORLOOSE])));W("range list",s);let a=new Map,f=s.map((u)=>new zi(u,this.options));for(let u of f){if(Vc(u))return[u];a.set(u.value,u)}if(a.size>1&&a.has(""))a.delete("");let c=[...a.values()];return zc.set(r,c),c}intersects(e,t){if(!(e instanceof tr))throw TypeError("a Range is required");return this.set.some((r)=>Xc(r,t)&&e.set.some((n)=>Xc(n,t)&&r.every((i)=>n.every((o)=>i.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new zy(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(hg(this.set[t],e,this.options))return!0;return!1}}Yc.exports=tr;var My=Gc(),zc=new My,Gy=Mr(),zi=rr(),W=Qt(),zy=Y(),{safeRe:te,src:Vy,t:Z,comparatorTrimReplace:Xy,tildeTrimReplace:Yy,caretTrimReplace:Zy}=wt(),{FLAG_INCLUDE_PRERELEASE:Qy,FLAG_LOOSE:eg}=gt(),tg=new RegExp(Vy[Z.BUILD],"g"),Vc=(e)=>e.value==="<0.0.0-0",rg=(e)=>e.value==="",Xc=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();while(r&&n.length)r=n.every((o)=>i.intersects(o,t)),i=n.pop();return r},ng=(e,t)=>(e=e.replace(te[Z.BUILD],""),W("comp",e,t),e=ag(e,t),W("caret",e),e=og(e,t),W("tildes",e),e=ug(e,t),W("xrange",e),e=lg(e,t),W("stars",e),e),G=(e)=>!e||e.toLowerCase()==="x"||e==="*",ig=(e,t,r)=>G(e)&&!G(t)||G(t)&&r&&!G(r),og=(e,t)=>e.trim().split(/\s+/).map((r)=>sg(r,t)).join(" "),sg=(e,t)=>{let r=t.loose?te[Z.TILDELOOSE]:te[Z.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(i,o,s,a,f)=>{W("tilde",e,i,o,s,a,f);let c;if(G(o))c="";else if(G(s))c=`>=${o}.0.0${n} <${+o+1}.0.0-0`;else if(G(a))c=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`;else if(f)W("replaceTilde pr",f),c=`>=${o}.${s}.${a}-${f} <${o}.${+s+1}.0-0`;else c=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`;return W("tilde return",c),c})},ag=(e,t)=>e.trim().split(/\s+/).map((r)=>cg(r,t)).join(" "),cg=(e,t)=>{W("caret",e,t);let r=t.loose?te[Z.CARETLOOSE]:te[Z.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(i,o,s,a,f)=>{W("caret",e,i,o,s,a,f);let c;if(G(o))c="";else if(G(s))c=`>=${o}.0.0${n} <${+o+1}.0.0-0`;else if(G(a))if(o==="0")c=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`;else c=`>=${o}.${s}.0${n} <${+o+1}.0.0-0`;else if(f)if(W("replaceCaret pr",f),o==="0")if(s==="0")c=`>=${o}.${s}.${a}-${f} <${o}.${s}.${+a+1}-0`;else c=`>=${o}.${s}.${a}-${f} <${o}.${+s+1}.0-0`;else c=`>=${o}.${s}.${a}-${f} <${+o+1}.0.0-0`;else if(W("no pr"),o==="0")if(s==="0")c=`>=${o}.${s}.${a} <${o}.${s}.${+a+1}-0`;else c=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`;else c=`>=${o}.${s}.${a} <${+o+1}.0.0-0`;return W("caret return",c),c})},ug=(e,t)=>(W("replaceXRanges",e,t),e.split(/\s+/).map((r)=>fg(r,t)).join(" ")),fg=(e,t)=>{e=e.trim();let r=t.loose?te[Z.XRANGELOOSE]:te[Z.XRANGE];return e.replace(r,(n,i,o,s,a,f)=>{if(W("xRange",e,n,i,o,s,a,f),ig(o,s,a))return e;let c=G(o),u=c||G(s),l=u||G(a),p=l;if(i==="="&&p)i="";if(f=t.includePrerelease?"-0":"",c)if(i===">"||i==="<")n="<0.0.0-0";else n="*";else if(i&&p){if(u)s=0;if(a=0,i===">")if(i=">=",u)o=+o+1,s=0,a=0;else s=+s+1,a=0;else if(i==="<=")if(i="<",u)o=+o+1;else s=+s+1;if(i==="<")f="-0";n=`${i+o}.${s}.${a}${f}`}else if(u)n=`>=${o}.0.0${f} <${+o+1}.0.0-0`;else if(l)n=`>=${o}.${s}.0${f} <${o}.${+s+1}.0-0`;return W("xRange return",n),n})},lg=(e,t)=>(W("replaceStars",e,t),e.trim().replace(te[Z.STAR],"")),dg=(e,t)=>(W("replaceGTE0",e,t),e.trim().replace(te[t.includePrerelease?Z.GTE0PRE:Z.GTE0],"")),pg=(e)=>(t,r,n,i,o,s,a,f,c,u,l,p)=>{if(G(n))r="";else if(G(i))r=`>=${n}.0.0${e?"-0":""}`;else if(G(o))r=`>=${n}.${i}.0${e?"-0":""}`;else if(s)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(G(c))f="";else if(G(u))f=`<${+c+1}.0.0-0`;else if(G(l))f=`<${c}.${+u+1}.0-0`;else if(p)f=`<=${c}.${u}.${l}-${p}`;else if(e)f=`<${c}.${u}.${+l+1}-0`;else f=`<=${f}`;return`${r} ${f}`.trim()},hg=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(W(e[n].semver),e[n].semver===zi.ANY)continue;if(e[n].semver.prerelease.length>0){let i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}}return!1}return!0}});var rr=m(function(Hx,nu){var nr=Symbol("SemVer ANY");class nn{static get ANY(){return nr}constructor(e,t){if(t=Zc(t),e instanceof nn)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),Xi("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===nr)this.value="";else this.value=this.operator+this.semver.version;Xi("comp",this)}parse(e){let t=this.options.loose?Qc[eu.COMPARATORLOOSE]:Qc[eu.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=nr;else this.semver=new tu(r[2],this.options.loose)}toString(){return this.value}test(e){if(Xi("Comparator.test",e,this.options.loose),this.semver===nr||e===nr)return!0;if(typeof e==="string")try{e=new tu(e,this.options)}catch(t){return!1}return Vi(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof nn))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new ru(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new ru(this.value,t).test(e.semver)}if(t=Zc(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(Vi(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(Vi(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}nu.exports=nn;var Zc=Mr(),{safeRe:Qc,t:eu}=wt(),Vi=Gi(),Xi=Qt(),tu=Y(),ru=ue()});var ir=m(function(Bx,iu){var mg=ue(),yg=(e,t,r)=>{try{t=new mg(t,r)}catch(n){return!1}return t.test(e)};iu.exports=yg});var su=m(function(Mx,ou){var gg=ue(),wg=(e,t)=>new gg(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));ou.exports=wg});var cu=m(function(Gx,au){var Eg=Y(),Sg=ue(),bg=(e,t,r)=>{let n=null,i=null,o=null;try{o=new Sg(t,r)}catch(s){return null}return e.forEach((s)=>{if(o.test(s)){if(!n||i.compare(s)===-1)n=s,i=new Eg(n,r)}}),n};au.exports=bg});var fu=m(function(zx,uu){var vg=Y(),Ag=ue(),xg=(e,t,r)=>{let n=null,i=null,o=null;try{o=new Ag(t,r)}catch(s){return null}return e.forEach((s)=>{if(o.test(s)){if(!n||i.compare(s)===1)n=s,i=new vg(n,r)}}),n};uu.exports=xg});var pu=m(function(Vx,du){var Yi=Y(),Tg=ue(),lu=er(),Cg=(e,t)=>{e=new Tg(e,t);let r=new Yi("0.0.0");if(e.test(r))return r;if(r=new Yi("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let i=e.set[n],o=null;if(i.forEach((s)=>{let a=new Yi(s.semver.version);switch(s.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!o||lu(a,o))o=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${s.operator}`)}}),o&&(!r||lu(r,o)))r=o}if(r&&e.test(r))return r;return null};du.exports=Cg});var mu=m(function(Xx,hu){var Ig=ue(),Rg=(e,t)=>{try{return new Ig(e,t).range||"*"}catch(r){return null}};hu.exports=Rg});var on=m(function(Yx,Eu){var Og=Y(),wu=rr(),{ANY:_g}=wu,kg=ue(),Pg=ir(),yu=er(),gu=Zr(),Kg=en(),Ng=Qr(),$g=(e,t,r,n)=>{e=new Og(e,n),t=new kg(t,n);let i,o,s,a,f;switch(r){case">":i=yu,o=Kg,s=gu,a=">",f=">=";break;case"<":i=gu,o=Ng,s=yu,a="<",f="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(Pg(e,t,n))return!1;for(let c=0;c<t.set.length;++c){let u=t.set[c],l=null,p=null;if(u.forEach((d)=>{if(d.semver===_g)d=new wu(">=0.0.0");if(l=l||d,p=p||d,i(d.semver,l.semver,n))l=d;else if(s(d.semver,p.semver,n))p=d}),l.operator===a||l.operator===f)return!1;if((!p.operator||p.operator===a)&&o(e,p.semver))return!1;else if(p.operator===f&&s(e,p.semver))return!1}return!0};Eu.exports=$g});var bu=m(function(Zx,Su){var Jg=on(),Lg=(e,t,r)=>Jg(e,t,">",r);Su.exports=Lg});var Au=m(function(Qx,vu){var Wg=on(),jg=(e,t,r)=>Wg(e,t,"<",r);vu.exports=jg});var Cu=m(function(eT,Tu){var xu=ue(),Dg=(e,t,r)=>(e=new xu(e,r),t=new xu(t,r),e.intersects(t,r));Tu.exports=Dg});var Ru=m(function(tT,Iu){var Fg=ir(),qg=ce();Iu.exports=(e,t,r)=>{let n=[],i=null,o=null,s=e.sort((u,l)=>qg(u,l,r));for(let u of s)if(Fg(u,t,r)){if(o=u,!i)i=u}else{if(o)n.push([i,o]);o=null,i=null}if(i)n.push([i,null]);let a=[];for(let[u,l]of n)if(u===l)a.push(u);else if(!l&&u===s[0])a.push("*");else if(!l)a.push(`>=${u}`);else if(u===s[0])a.push(`<=${l}`);else a.push(`${u} - ${l}`);let f=a.join(" || "),c=typeof t.raw==="string"?t.raw:String(t);return f.length<c.length?f:t}});var Nu=m(function(rT,Ku){var Ou=ue(),eo=rr(),{ANY:Zi}=eo,Qi=ir(),to=ce(),Ug=(e,t,r={})=>{if(e===t)return!0;e=new Ou(e,r),t=new Ou(t,r);let n=!1;e:for(let i of e.set){for(let o of t.set){let s=Bg(i,o,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},Hg=[new eo(">=0.0.0-0")],_u=[new eo(">=0.0.0")],Bg=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Zi)if(t.length===1&&t[0].semver===Zi)return!0;else if(r.includePrerelease)e=Hg;else e=_u;if(t.length===1&&t[0].semver===Zi)if(r.includePrerelease)return!0;else t=_u;let n=new Set,i,o;for(let d of e)if(d.operator===">"||d.operator===">=")i=ku(i,d,r);else if(d.operator==="<"||d.operator==="<=")o=Pu(o,d,r);else n.add(d.semver);if(n.size>1)return null;let s;if(i&&o){if(s=to(i.semver,o.semver,r),s>0)return null;else if(s===0&&(i.operator!==">="||o.operator!=="<="))return null}for(let d of n){if(i&&!Qi(d,String(i),r))return null;if(o&&!Qi(d,String(o),r))return null;for(let g of t)if(!Qi(d,String(g),r))return!1;return!0}let a,f,c,u,l=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;if(l&&l.prerelease.length===1&&o.operator==="<"&&l.prerelease[0]===0)l=!1;for(let d of t){if(u=u||d.operator===">"||d.operator===">=",c=c||d.operator==="<"||d.operator==="<=",i){if(p){if(d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===p.major&&d.semver.minor===p.minor&&d.semver.patch===p.patch)p=!1}if(d.operator===">"||d.operator===">="){if(a=ku(i,d,r),a===d&&a!==i)return!1}else if(i.operator===">="&&!d.test(i.semver))return!1}if(o){if(l){if(d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===l.major&&d.semver.minor===l.minor&&d.semver.patch===l.patch)l=!1}if(d.operator==="<"||d.operator==="<="){if(f=Pu(o,d,r),f===d&&f!==o)return!1}else if(o.operator==="<="&&!d.test(o.semver))return!1}if(!d.operator&&(o||i)&&s!==0)return!1}if(i&&c&&!o&&s!==0)return!1;if(o&&u&&!i&&s!==0)return!1;if(p||l)return!1;return!0},ku=(e,t,r)=>{if(!e)return t;let n=to(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},Pu=(e,t,r)=>{if(!e)return t;let n=to(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};Ku.exports=Ug});var sn=m(function(nT,Lu){var ro=wt(),$u=gt(),Mg=Y(),Ju=Ui(),Gg=Ne(),zg=oc(),Vg=ac(),Xg=fc(),Yg=pc(),Zg=mc(),Qg=gc(),ew=Ec(),tw=bc(),rw=ce(),nw=Tc(),iw=Ic(),ow=Yr(),sw=kc(),aw=Kc(),cw=er(),uw=Zr(),fw=Bi(),lw=Mi(),dw=Qr(),pw=en(),hw=Gi(),mw=qc(),yw=Hc(),gw=rr(),ww=ue(),Ew=ir(),Sw=su(),bw=cu(),vw=fu(),Aw=pu(),xw=mu(),Tw=on(),Cw=bu(),Iw=Au(),Rw=Cu(),Ow=Ru(),_w=Nu();Lu.exports={parse:Gg,valid:zg,clean:Vg,inc:Xg,diff:Yg,major:Zg,minor:Qg,patch:ew,prerelease:tw,compare:rw,rcompare:nw,compareLoose:iw,compareBuild:ow,sort:sw,rsort:aw,gt:cw,lt:uw,eq:fw,neq:lw,gte:dw,lte:pw,cmp:hw,coerce:mw,truncate:yw,Comparator:gw,Range:ww,satisfies:Ew,toComparators:Sw,maxSatisfying:bw,minSatisfying:vw,minVersion:Aw,validRange:xw,outside:Tw,gtr:Cw,ltr:Iw,intersects:Rw,simplifyRange:Ow,subset:_w,SemVer:Mg,re:ro.re,src:ro.src,tokens:ro.t,SEMVER_SPEC_VERSION:$u.SEMVER_SPEC_VERSION,RELEASE_TYPES:$u.RELEASE_TYPES,compareIdentifiers:Ju.compareIdentifiers,rcompareIdentifiers:Ju.rcompareIdentifiers}});var ju=m(function(iT,Wu){var kw=sn();Wu.exports=kw.satisfies(process.version,">=15.7.0")});var Fu=m(function(oT,Du){var Pw=sn();Du.exports=Pw.satisfies(process.version,">=16.9.0")});var no=m(function(sT,qu){var Kw=ju(),Nw=Fu(),$w={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},Jw={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};qu.exports=function(e,t){if(!e||!t)return;let r=t.asymmetricKeyType;if(!r)return;let n=$w[r];if(!n)throw Error(`Unknown key type "${r}".`);if(!n.includes(e))throw Error(`"alg" parameter for "${r}" key type must be one of: ${n.join(", ")}.`);if(Kw)switch(r){case"ec":let i=t.asymmetricKeyDetails.namedCurve,o=Jw[e];if(i!==o)throw Error(`"alg" parameter "${e}" requires curve "${o}".`);break;case"rsa-pss":if(Nw){let s=parseInt(e.slice(-3),10),{hashAlgorithm:a,mgf1HashAlgorithm:f,saltLength:c}=t.asymmetricKeyDetails;if(a!==`sha${s}`||f!==a)throw Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(c!==void 0&&c>s>>3)throw Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}break}}});var io=m(function(aT,Uu){var Lw=sn();Uu.exports=Lw.satisfies(process.version,"^6.12.0 || >=8.0.0")});var Mu=m(function(cT,Bu){var J=Zt(),Ww=Li(),Hu=Wi(),jw=Ji(),Dw=Di(),Fw=no(),qw=io(),Uw=Fr(),{KeyObject:Hw,createSecretKey:Bw,createPublicKey:Mw}=require("crypto"),oo=["RS256","RS384","RS512"],Gw=["ES256","ES384","ES512"],so=["RS256","RS384","RS512"],zw=["HS256","HS384","HS512"];if(qw)oo.splice(oo.length,0,"PS256","PS384","PS512"),so.splice(so.length,0,"PS256","PS384","PS512");Bu.exports=function(e,t,r,n){if(typeof r==="function"&&!n)n=r,r={};if(!r)r={};r=Object.assign({},r);let i;if(n)i=n;else i=function(u,l){if(u)throw u;return l};if(r.clockTimestamp&&typeof r.clockTimestamp!=="number")return i(new J("clockTimestamp must be a number"));if(r.nonce!==void 0&&(typeof r.nonce!=="string"||r.nonce.trim()===""))return i(new J("nonce must be a non-empty string"));if(r.allowInvalidAsymmetricKeyTypes!==void 0&&typeof r.allowInvalidAsymmetricKeyTypes!=="boolean")return i(new J("allowInvalidAsymmetricKeyTypes must be a boolean"));let o=r.clockTimestamp||Math.floor(Date.now()/1000);if(!e)return i(new J("jwt must be provided"));if(typeof e!=="string")return i(new J("jwt must be a string"));let s=e.split(".");if(s.length!==3)return i(new J("jwt malformed"));let a;try{a=jw(e,{complete:!0})}catch(u){return i(u)}if(!a)return i(new J("invalid token"));let f=a.header,c;if(typeof t==="function"){if(!n)return i(new J("verify must be called asynchronous if secret or public key is provided as a callback"));c=t}else c=function(u,l){return l(null,t)};return c(f,function(u,l){if(u)return i(new J("error in secret or public key callback: "+u.message));let p=s[2].trim()!=="";if(!p&&l)return i(new J("jwt signature is required"));if(p&&!l)return i(new J("secret or public key must be provided"));if(!p&&!r.algorithms)return i(new J('please specify "none" in "algorithms" to verify unsigned tokens'));if(l!=null&&!(l instanceof Hw))try{l=Mw(l)}catch(h){try{l=Bw(typeof l==="string"?Buffer.from(l):l)}catch(S){return i(new J("secretOrPublicKey is not valid key material"))}}if(!r.algorithms)if(l.type==="secret")r.algorithms=zw;else if(["rsa","rsa-pss"].includes(l.asymmetricKeyType))r.algorithms=so;else if(l.asymmetricKeyType==="ec")r.algorithms=Gw;else r.algorithms=oo;if(r.algorithms.indexOf(a.header.alg)===-1)return i(new J("invalid algorithm"));if(f.alg.startsWith("HS")&&l.type!=="secret")return i(new J(`secretOrPublicKey must be a symmetric key when using ${f.alg}`));else if(/^(?:RS|PS|ES)/.test(f.alg)&&l.type!=="public")return i(new J(`secretOrPublicKey must be an asymmetric key when using ${f.alg}`));if(!r.allowInvalidAsymmetricKeyTypes)try{Fw(f.alg,l)}catch(h){return i(h)}let d;try{d=Uw.verify(e,a.header.alg,l)}catch(h){return i(h)}if(!d)return i(new J("invalid signature"));let g=a.payload;if(typeof g.nbf<"u"&&!r.ignoreNotBefore){if(typeof g.nbf!=="number")return i(new J("invalid nbf value"));if(g.nbf>o+(r.clockTolerance||0))return i(new Ww("jwt not active",new Date(g.nbf*1000)))}if(typeof g.exp<"u"&&!r.ignoreExpiration){if(typeof g.exp!=="number")return i(new J("invalid exp value"));if(o>=g.exp+(r.clockTolerance||0))return i(new Hu("jwt expired",new Date(g.exp*1000)))}if(r.audience){let h=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(g.aud)?g.aud:[g.aud]).some(function(y){return h.some(function(T){return T instanceof RegExp?T.test(y):T===y})}))return i(new J("jwt audience invalid. expected: "+h.join(" or ")))}if(r.issuer){if(typeof r.issuer==="string"&&g.iss!==r.issuer||Array.isArray(r.issuer)&&r.issuer.indexOf(g.iss)===-1)return i(new J("jwt issuer invalid. expected: "+r.issuer))}if(r.subject){if(g.sub!==r.subject)return i(new J("jwt subject invalid. expected: "+r.subject))}if(r.jwtid){if(g.jti!==r.jwtid)return i(new J("jwt jwtid invalid. expected: "+r.jwtid))}if(r.nonce){if(g.nonce!==r.nonce)return i(new J("jwt nonce invalid. expected: "+r.nonce))}if(r.maxAge){if(typeof g.iat!=="number")return i(new J("iat required when maxAge is specified"));let h=Dw(r.maxAge,g.iat);if(typeof h>"u")return i(new J('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(o>=h+(r.clockTolerance||0))return i(new Hu("maxAge exceeded",new Date(h*1000)))}if(r.complete===!0){let h=a.signature;return i(null,{header:f,payload:g,signature:h})}return i(null,g)})}});var Zu=m(function(uT,Yu){var Gu=1/0,Vu=9007199254740991,Vw=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,zu=NaN,Xw="[object Arguments]",Yw="[object Function]",Zw="[object GeneratorFunction]",Qw="[object String]",eE="[object Symbol]",tE=/^\s+|\s+$/g,rE=/^[-+]0x[0-9a-f]+$/i,nE=/^0b[01]+$/i,iE=/^0o[0-7]+$/i,oE=/^(?:0|[1-9]\d*)$/,sE=parseInt;function aE(e,t){var r=-1,n=e?e.length:0,i=Array(n);while(++r<n)i[r]=t(e[r],r,e);return i}function cE(e,t,r,n){var i=e.length,o=r+(n?1:-1);while(n?o--:++o<i)if(t(e[o],o,e))return o;return-1}function uE(e,t,r){if(t!==t)return cE(e,fE,r);var n=r-1,i=e.length;while(++n<i)if(e[n]===t)return n;return-1}function fE(e){return e!==e}function lE(e,t){var r=-1,n=Array(e);while(++r<e)n[r]=t(r);return n}function dE(e,t){return aE(t,function(r){return e[r]})}function pE(e,t){return function(r){return e(t(r))}}var an=Object.prototype,co=an.hasOwnProperty,cn=an.toString,hE=an.propertyIsEnumerable,mE=pE(Object.keys,Object),yE=Math.max;function gE(e,t){var r=Xu(e)||vE(e)?lE(e.length,String):[],n=r.length,i=!!n;for(var o in e)if((t||co.call(e,o))&&!(i&&(o=="length"||EE(o,n))))r.push(o);return r}function wE(e){if(!SE(e))return mE(e);var t=[];for(var r in Object(e))if(co.call(e,r)&&r!="constructor")t.push(r);return t}function EE(e,t){return t=t==null?Vu:t,!!t&&(typeof e=="number"||oE.test(e))&&(e>-1&&e%1==0&&e<t)}function SE(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||an;return e===r}function bE(e,t,r,n){e=uo(e)?e:PE(e),r=r&&!n?OE(r):0;var i=e.length;if(r<0)r=yE(i+r,0);return CE(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&uE(e,t,r)>-1}function vE(e){return AE(e)&&co.call(e,"callee")&&(!hE.call(e,"callee")||cn.call(e)==Xw)}var Xu=Array.isArray;function uo(e){return e!=null&&TE(e.length)&&!xE(e)}function AE(e){return fo(e)&&uo(e)}function xE(e){var t=ao(e)?cn.call(e):"";return t==Yw||t==Zw}function TE(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Vu}function ao(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function fo(e){return!!e&&typeof e=="object"}function CE(e){return typeof e=="string"||!Xu(e)&&fo(e)&&cn.call(e)==Qw}function IE(e){return typeof e=="symbol"||fo(e)&&cn.call(e)==eE}function RE(e){if(!e)return e===0?e:0;if(e=_E(e),e===Gu||e===-Gu){var t=e<0?-1:1;return t*Vw}return e===e?e:0}function OE(e){var t=RE(e),r=t%1;return t===t?r?t-r:t:0}function _E(e){if(typeof e=="number")return e;if(IE(e))return zu;if(ao(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ao(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(tE,"");var r=nE.test(e);return r||iE.test(e)?sE(e.slice(2),r?2:8):rE.test(e)?zu:+e}function kE(e){return uo(e)?gE(e):wE(e)}function PE(e){return e?dE(e,kE(e)):[]}Yu.exports=bE});var ef=m(function(fT,Qu){var KE="[object Boolean]",NE=Object.prototype,$E=NE.toString;function JE(e){return e===!0||e===!1||LE(e)&&$E.call(e)==KE}function LE(e){return!!e&&typeof e=="object"}Qu.exports=JE});var sf=m(function(lT,of){var tf=1/0,WE=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,rf=NaN,jE="[object Symbol]",DE=/^\s+|\s+$/g,FE=/^[-+]0x[0-9a-f]+$/i,qE=/^0b[01]+$/i,UE=/^0o[0-7]+$/i,HE=parseInt,BE=Object.prototype,ME=BE.toString;function GE(e){return typeof e=="number"&&e==YE(e)}function nf(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function zE(e){return!!e&&typeof e=="object"}function VE(e){return typeof e=="symbol"||zE(e)&&ME.call(e)==jE}function XE(e){if(!e)return e===0?e:0;if(e=ZE(e),e===tf||e===-tf){var t=e<0?-1:1;return t*WE}return e===e?e:0}function YE(e){var t=XE(e),r=t%1;return t===t?r?t-r:t:0}function ZE(e){if(typeof e=="number")return e;if(VE(e))return rf;if(nf(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=nf(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(DE,"");var r=qE.test(e);return r||UE.test(e)?HE(e.slice(2),r?2:8):FE.test(e)?rf:+e}of.exports=GE});var cf=m(function(dT,af){var QE="[object Number]",eS=Object.prototype,tS=eS.toString;function rS(e){return!!e&&typeof e=="object"}function nS(e){return typeof e=="number"||rS(e)&&tS.call(e)==QE}af.exports=nS});var df=m(function(pT,lf){var iS="[object Object]";function oS(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function sS(e,t){return function(r){return e(t(r))}}var aS=Function.prototype,uf=Object.prototype,ff=aS.toString,cS=uf.hasOwnProperty,uS=ff.call(Object),fS=uf.toString,lS=sS(Object.getPrototypeOf,Object);function dS(e){return!!e&&typeof e=="object"}function pS(e){if(!dS(e)||fS.call(e)!=iS||oS(e))return!1;var t=lS(e);if(t===null)return!0;var r=cS.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&ff.call(r)==uS}lf.exports=pS});var hf=m(function(hT,pf){var hS="[object String]",mS=Object.prototype,yS=mS.toString,gS=Array.isArray;function wS(e){return!!e&&typeof e=="object"}function ES(e){return typeof e=="string"||!gS(e)&&wS(e)&&yS.call(e)==hS}pf.exports=ES});var Ef=m(function(mT,wf){var SS="Expected a function",mf=1/0,bS=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,yf=NaN,vS="[object Symbol]",AS=/^\s+|\s+$/g,xS=/^[-+]0x[0-9a-f]+$/i,TS=/^0b[01]+$/i,CS=/^0o[0-7]+$/i,IS=parseInt,RS=Object.prototype,OS=RS.toString;function _S(e,t){var r;if(typeof t!="function")throw TypeError(SS);return e=$S(e),function(){if(--e>0)r=t.apply(this,arguments);if(e<=1)t=void 0;return r}}function kS(e){return _S(2,e)}function gf(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function PS(e){return!!e&&typeof e=="object"}function KS(e){return typeof e=="symbol"||PS(e)&&OS.call(e)==vS}function NS(e){if(!e)return e===0?e:0;if(e=JS(e),e===mf||e===-mf){var t=e<0?-1:1;return t*bS}return e===e?e:0}function $S(e){var t=NS(e),r=t%1;return t===t?r?t-r:t:0}function JS(e){if(typeof e=="number")return e;if(KS(e))return yf;if(gf(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=gf(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(AS,"");var r=TS.test(e);return r||CS.test(e)?IS(e.slice(2),r?2:8):xS.test(e)?yf:+e}wf.exports=kS});var Rf=m(function(yT,If){var Sf=Di(),LS=io(),WS=no(),bf=Fr(),jS=Zu(),un=ef(),vf=sf(),lo=cf(),xf=df(),$e=hf(),DS=Ef(),{KeyObject:FS,createSecretKey:qS,createPrivateKey:US}=require("crypto"),Tf=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];if(LS)Tf.splice(3,0,"PS256","PS384","PS512");var HS={expiresIn:{isValid:function(e){return vf(e)||$e(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return vf(e)||$e(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return $e(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:jS.bind(null,Tf),message:'"algorithm" must be a valid string enum value'},header:{isValid:xf,message:'"header" must be an object'},encoding:{isValid:$e,message:'"encoding" must be a string'},issuer:{isValid:$e,message:'"issuer" must be a string'},subject:{isValid:$e,message:'"subject" must be a string'},jwtid:{isValid:$e,message:'"jwtid" must be a string'},noTimestamp:{isValid:un,message:'"noTimestamp" must be a boolean'},keyid:{isValid:$e,message:'"keyid" must be a string'},mutatePayload:{isValid:un,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:un,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:un,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},BS={iat:{isValid:lo,message:'"iat" should be a number of seconds'},exp:{isValid:lo,message:'"exp" should be a number of seconds'},nbf:{isValid:lo,message:'"nbf" should be a number of seconds'}};function Cf(e,t,r,n){if(!xf(r))throw Error('Expected "'+n+'" to be a plain object.');Object.keys(r).forEach(function(i){let o=e[i];if(!o){if(!t)throw Error('"'+i+'" is not allowed in "'+n+'"');return}if(!o.isValid(r[i]))throw Error(o.message)})}function MS(e){return Cf(HS,!1,e,"options")}function GS(e){return Cf(BS,!0,e,"payload")}var Af={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},zS=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];If.exports=function(e,t,r,n){if(typeof r==="function")n=r,r={};else r=r||{};let i=typeof e==="object"&&!Buffer.isBuffer(e),o=Object.assign({alg:r.algorithm||"HS256",typ:i?"JWT":void 0,kid:r.keyid},r.header);function s(c){if(n)return n(c);throw c}if(!t&&r.algorithm!=="none")return s(Error("secretOrPrivateKey must have a value"));if(t!=null&&!(t instanceof FS))try{t=US(t)}catch(c){try{t=qS(typeof t==="string"?Buffer.from(t):t)}catch(u){return s(Error("secretOrPrivateKey is not valid key material"))}}if(o.alg.startsWith("HS")&&t.type!=="secret")return s(Error(`secretOrPrivateKey must be a symmetric key when using ${o.alg}`));else if(/^(?:RS|PS|ES)/.test(o.alg)){if(t.type!=="private")return s(Error(`secretOrPrivateKey must be an asymmetric key when using ${o.alg}`));if(!r.allowInsecureKeySizes&&!o.alg.startsWith("ES")&&t.asymmetricKeyDetails!==void 0&&t.asymmetricKeyDetails.modulusLength<2048)return s(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`))}if(typeof e>"u")return s(Error("payload is required"));else if(i){try{GS(e)}catch(c){return s(c)}if(!r.mutatePayload)e=Object.assign({},e)}else{let c=zS.filter(function(u){return typeof r[u]<"u"});if(c.length>0)return s(Error("invalid "+c.join(",")+" option for "+typeof e+" payload"))}if(typeof e.exp<"u"&&typeof r.expiresIn<"u")return s(Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(typeof e.nbf<"u"&&typeof r.notBefore<"u")return s(Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{MS(r)}catch(c){return s(c)}if(!r.allowInvalidAsymmetricKeyTypes)try{WS(o.alg,t)}catch(c){return s(c)}let a=e.iat||Math.floor(Date.now()/1000);if(r.noTimestamp)delete e.iat;else if(i)e.iat=a;if(typeof r.notBefore<"u"){try{e.nbf=Sf(r.notBefore,a)}catch(c){return s(c)}if(typeof e.nbf>"u")return s(Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(typeof r.expiresIn<"u"&&typeof e==="object"){try{e.exp=Sf(r.expiresIn,a)}catch(c){return s(c)}if(typeof e.exp>"u")return s(Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(Af).forEach(function(c){let u=Af[c];if(typeof r[c]<"u"){if(typeof e[u]<"u")return s(Error('Bad "options.'+c+'" option. The payload already has an "'+u+'" property.'));e[u]=r[c]}});let f=r.encoding||"utf8";if(typeof n==="function")n=n&&DS(n),bf.createSign({header:o,privateKey:t,payload:e,encoding:f}).once("error",n).once("done",function(c){if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(o.alg)&&c.length<256)return n(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`));n(null,c)});else{let c=bf.sign({header:o,payload:e,secret:t,encoding:f});if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(o.alg)&&c.length<256)throw Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`);return c}}});var _f=m(function(gT,Of){Of.exports={decode:Ji(),verify:Mu(),sign:Rf(),JsonWebTokenError:Zt(),NotBeforeError:Li(),TokenExpiredError:Wi()}});var po=m(function(wT,kf){function VS(e){r.debug=r,r.default=r,r.coerce=f,r.disable=s,r.enable=i,r.enabled=a,r.humanize=ji(),r.destroy=c,Object.keys(e).forEach((u)=>{r[u]=e[u]}),r.names=[],r.skips=[],r.formatters={};function t(u){let l=0;for(let p=0;p<u.length;p++)l=(l<<5)-l+u.charCodeAt(p),l|=0;return r.colors[Math.abs(l)%r.colors.length]}r.selectColor=t;function r(u){let l,p=null,d,g;function h(...S){if(!h.enabled)return;let E=h,y=Number(new Date),T=y-(l||y);if(E.diff=T,E.prev=l,E.curr=y,l=y,S[0]=r.coerce(S[0]),typeof S[0]!=="string")S.unshift("%O");let I=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(j,q)=>{if(j==="%%")return"%";I++;let V=r.formatters[q];if(typeof V==="function"){let N=S[I];j=V.call(E,N),S.splice(I,1),I--}return j}),r.formatArgs.call(E,S),(E.log||r.log).apply(E,S)}if(h.namespace=u,h.useColors=r.useColors(),h.color=r.selectColor(u),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(p!==null)return p;if(d!==r.namespaces)d=r.namespaces,g=r.enabled(u);return g},set:(S)=>{p=S}}),typeof r.init==="function")r.init(h);return h}function n(u,l){let p=r(this.namespace+(typeof l>"u"?":":l)+u);return p.log=this.log,p}function i(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];let l=(typeof u==="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let p of l)if(p[0]==="-")r.skips.push(p.slice(1));else r.names.push(p)}function o(u,l){let p=0,d=0,g=-1,h=0;while(p<u.length)if(d<l.length&&(l[d]===u[p]||l[d]==="*"))if(l[d]==="*")g=d,h=p,d++;else p++,d++;else if(g!==-1)d=g+1,h++,p=h;else return!1;while(d<l.length&&l[d]==="*")d++;return d===l.length}function s(){let u=[...r.names,...r.skips.map((l)=>"-"+l)].join(",");return r.enable(""),u}function a(u){for(let l of r.skips)if(o(u,l))return!1;for(let l of r.names)if(o(u,l))return!0;return!1}function f(u){if(u instanceof Error)return u.stack||u.message;return u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}kf.exports=VS});var Pf=m(function(ne,fn){ne.formatArgs=YS;ne.save=ZS;ne.load=QS;ne.useColors=XS;ne.storage=eb();ne.destroy=(()=>{let e=!1;return()=>{if(!e)e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();ne.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function XS(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function YS(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+fn.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,(i)=>{if(i==="%%")return;if(r++,i==="%c")n=r}),e.splice(n,0,t)}ne.log=console.debug||console.log||(()=>{});function ZS(e){try{if(e)ne.storage.setItem("debug",e);else ne.storage.removeItem("debug")}catch(t){}}function QS(){let e;try{e=ne.storage.getItem("debug")||ne.storage.getItem("DEBUG")}catch(t){}if(!e&&typeof process<"u"&&"env"in process)e=process.env.DEBUG;return e}function eb(){try{return localStorage}catch(e){}}fn.exports=po()(ne);var{formatters:tb}=fn.exports;tb.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Nf={};zt(Nf,{createSupportsColor:()=>mo,default:()=>sb});function fe(e,t=globalThis.Deno?globalThis.Deno.args:dn.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),i=t.indexOf("--");return n!==-1&&(i===-1||n<i)}function rb(){if(!("FORCE_COLOR"in D))return;if(D.FORCE_COLOR==="true")return 1;if(D.FORCE_COLOR==="false")return 0;if(D.FORCE_COLOR.length===0)return 1;let e=Math.min(Number.parseInt(D.FORCE_COLOR,10),3);if(![0,1,2,3].includes(e))return;return e}function nb(e){if(e===0)return!1;return{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function ib(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=rb();if(n!==void 0)ln=n;let i=r?ln:n;if(i===0)return 0;if(r){if(fe("color=16m")||fe("color=full")||fe("color=truecolor"))return 3;if(fe("color=256"))return 2}if("TF_BUILD"in D&&"AGENT_NAME"in D)return 1;if(e&&!t&&i===void 0)return 0;let o=i||0;if(D.TERM==="dumb")return o;if(dn.default.platform==="win32"){let s=Kf.default.release().split(".");if(Number(s[0])>=10&&Number(s[2])>=10586)return Number(s[2])>=14931?3:2;return 1}if("CI"in D){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((s)=>(s in D)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((s)=>(s in D))||D.CI_NAME==="codeship")return 1;return o}if("TEAMCITY_VERSION"in D)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(D.TEAMCITY_VERSION)?1:0;if(D.COLORTERM==="truecolor")return 3;if(D.TERM==="xterm-kitty")return 3;if(D.TERM==="xterm-ghostty")return 3;if(D.TERM==="wezterm")return 3;if("TERM_PROGRAM"in D){let s=Number.parseInt((D.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(D.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(D.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(D.TERM))return 1;if("COLORTERM"in D)return 1;return o}function mo(e,t={}){let r=ib(e,{streamIsTTY:e&&e.isTTY,...t});return nb(r)}var dn,Kf,ho,D,ln,ob,sb;var $f=x(()=>{dn=ut(require("node:process")),Kf=ut(require("node:os")),ho=ut(require("node:tty"));({env:D}=dn.default);if(fe("no-color")||fe("no-colors")||fe("color=false")||fe("color=never"))ln=0;else if(fe("color")||fe("colors")||fe("color=true")||fe("color=always"))ln=1;ob={stdout:mo({isTTY:ho.default.isatty(1)}),stderr:mo({isTTY:ho.default.isatty(2)})},sb=ob});var Lf=m(function(X,hn){var ab=require("tty"),pn=require("util");X.init=hb;X.log=lb;X.formatArgs=ub;X.save=db;X.load=pb;X.useColors=cb;X.destroy=pn.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");X.colors=[6,2,3,4,5,1];try{let e=($f(),Or(Nf));if(e&&(e.stderr||e).level>=2)X.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(e){}X.inspectOpts=Object.keys(process.env).filter((e)=>/^debug_/i.test(e)).reduce((e,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(i,o)=>o.toUpperCase()),n=process.env[t];if(/^(yes|on|true|enabled)$/i.test(n))n=!0;else if(/^(no|off|false|disabled)$/i.test(n))n=!1;else if(n==="null")n=null;else n=Number(n);return e[r]=n,e},{});function cb(){return"colors"in X.inspectOpts?Boolean(X.inspectOpts.colors):ab.isatty(process.stderr.fd)}function ub(e){let{namespace:t,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${t} \x1B[0m`;e[0]=o+e[0].split(`
3
+ "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,Yt="secret must be a string or buffer",dt="key must be a string or a buffer",Vh="key must be a string, a buffer or an object",ki=typeof ae.createPublicKey==="function";if(ki)dt+=" or a KeyObject",Yt+="or a KeyObject";function ha(e){if(pt.isBuffer(e))return;if(typeof e==="string")return;if(!ki)throw he(dt);if(typeof e!=="object")throw he(dt);if(typeof e.type!=="string")throw he(dt);if(typeof e.asymmetricKeyType!=="string")throw he(dt);if(typeof e.export!=="function")throw he(dt)}function ma(e){if(pt.isBuffer(e))return;if(typeof e==="string")return;if(typeof e==="object")return;throw he(Vh)}function Xh(e){if(pt.isBuffer(e))return;if(typeof e==="string")return e;if(!ki)throw he(Yt);if(typeof e!=="object")throw he(Yt);if(e.type!=="secret")throw he(Yt);if(typeof e.export!=="function")throw he(Yt)}function Pi(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ya(e){e=e.toString();var t=4-e.length%4;if(t!==4)for(var r=0;r<t;++r)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function he(e){var t=[].slice.call(arguments,1),r=da.format.bind(da,e).apply(null,t);return TypeError(r)}function Yh(e){return pt.isBuffer(e)||typeof e==="string"}function Zt(e){if(!Yh(e))e=JSON.stringify(e);return e}function ga(e){return function(r,n){Xh(n),r=Zt(r);var i=ae.createHmac("sha"+e,n),o=(i.update(r),i.digest("base64"));return Pi(o)}}var _i,Zh="timingSafeEqual"in ae?function(t,r){if(t.byteLength!==r.byteLength)return!1;return ae.timingSafeEqual(t,r)}:function(t,r){if(!_i)_i=la();return _i(t,r)};function Qh(e){return function(r,n,i){var o=ga(e)(r,i);return Zh(pt.from(n),pt.from(o))}}function wa(e){return function(r,n){ma(n),r=Zt(r);var i=ae.createSign("RSA-SHA"+e),o=(i.update(r),i.sign(n,"base64"));return Pi(o)}}function Ea(e){return function(r,n,i){ha(i),r=Zt(r),n=ya(n);var o=ae.createVerify("RSA-SHA"+e);return o.update(r),o.verify(i,n,"base64")}}function em(e){return function(r,n){ma(n),r=Zt(r);var i=ae.createSign("RSA-SHA"+e),o=(i.update(r),i.sign({key:n,padding:ae.constants.RSA_PKCS1_PSS_PADDING,saltLength:ae.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return Pi(o)}}function tm(e){return function(r,n,i){ha(i),r=Zt(r),n=ya(n);var o=ae.createVerify("RSA-SHA"+e);return o.update(r),o.verify({key:i,padding:ae.constants.RSA_PKCS1_PSS_PADDING,saltLength:ae.constants.RSA_PSS_SALTLEN_DIGEST},n,"base64")}}function rm(e){var t=wa(e);return function(){var n=t.apply(null,arguments);return n=pa.derToJose(n,"ES"+e),n}}function nm(e){var t=Ea(e);return function(n,i,o){i=pa.joseToDer(i,"ES"+e).toString("base64");var s=t(n,i,o);return s}}function im(){return function(){return""}}function om(){return function(t,r){return r===""}}Sa.exports=function(t){var r={hs:ga,rs:wa,ps:em,es:rm,none:im},n={hs:Qh,rs:Ea,ps:tm,es:nm,none:om},i=t.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!i)throw he(zh,t);var o=(i[1]||i[3]).toLowerCase(),s=i[2];return{sign:r[o](s),verify:n[o](s)}}});var Ni=m(function(nx,ba){var sm=require("buffer").Buffer;ba.exports=function(t){if(typeof t==="string")return t;if(typeof t==="number"||sm.isBuffer(t))return t.toString();return JSON.stringify(t)}});var Ia=m(function(ix,Ca){var am=lt().Buffer,va=Ii(),cm=Ki(),um=require("stream"),Aa=Ni(),$i=require("util");function xa(e,t){return am.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function fm(e,t,r){r=r||"utf8";var n=xa(Aa(e),"binary"),i=xa(Aa(t),r);return $i.format("%s.%s",n,i)}function Ta(e){var{header:t,payload:r}=e,n=e.secret||e.privateKey,i=e.encoding,o=cm(t.alg),s=fm(t,r,i),a=o.sign(s,n);return $i.format("%s.%s",s,a)}function Dr(e){var t=e.secret;if(t=t==null?e.privateKey:t,t=t==null?e.key:t,/^hs/i.test(e.header.alg)===!0&&t==null)throw TypeError("secret must be a string or buffer or a KeyObject");var r=new va(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new va(e.payload),this.secret.once("close",function(){if(!this.payload.writable&&this.readable)this.sign()}.bind(this)),this.payload.once("close",function(){if(!this.secret.writable&&this.readable)this.sign()}.bind(this))}$i.inherits(Dr,um);Dr.prototype.sign=function(){try{var t=Ta({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",t),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(r){this.readable=!1,this.emit("error",r),this.emit("close")}};Dr.sign=Ta;Ca.exports=Dr});var Ja=m(function(ox,La){var Oa=lt().Buffer,Ra=Ii(),lm=Ki(),dm=require("stream"),_a=Ni(),pm=require("util"),hm=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function mm(e){return Object.prototype.toString.call(e)==="[object Object]"}function ym(e){if(mm(e))return e;try{return JSON.parse(e)}catch(t){return}}function ka(e){var t=e.split(".",1)[0];return ym(Oa.from(t,"base64").toString("binary"))}function gm(e){return e.split(".",2).join(".")}function Pa(e){return e.split(".")[2]}function wm(e,t){t=t||"utf8";var r=e.split(".")[1];return Oa.from(r,"base64").toString(t)}function Ka(e){return hm.test(e)&&!!ka(e)}function Na(e,t,r){if(!t){var n=Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}e=_a(e);var i=Pa(e),o=gm(e),s=lm(t);return s.verify(o,i,r)}function $a(e,t){if(t=t||{},e=_a(e),!Ka(e))return null;var r=ka(e);if(!r)return null;var n=wm(e);if(r.typ==="JWT"||t.json)n=JSON.parse(n,t.encoding);return{header:r,payload:n,signature:Pa(e)}}function ht(e){e=e||{};var t=e.secret;if(t=t==null?e.publicKey:t,t=t==null?e.key:t,/^hs/i.test(e.algorithm)===!0&&t==null)throw TypeError("secret must be a string or buffer or a KeyObject");var r=new Ra(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new Ra(e.signature),this.secret.once("close",function(){if(!this.signature.writable&&this.readable)this.verify()}.bind(this)),this.signature.once("close",function(){if(!this.secret.writable&&this.readable)this.verify()}.bind(this))}pm.inherits(ht,dm);ht.prototype.verify=function(){try{var t=Na(this.signature.buffer,this.algorithm,this.key.buffer),r=$a(this.signature.buffer,this.encoding);return this.emit("done",t,r),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(n){this.readable=!1,this.emit("error",n),this.emit("close")}};ht.decode=$a;ht.isValid=Ka;ht.verify=Na;La.exports=ht});var qr=m(function(Ke){var Wa=Ia(),Fr=Ja(),Em=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];Ke.ALGORITHMS=Em;Ke.sign=Wa.sign;Ke.verify=Fr.verify;Ke.decode=Fr.decode;Ke.isValid=Fr.isValid;Ke.createSign=function(t){return new Wa(t)};Ke.createVerify=function(t){return new Fr(t)}});var Li=m(function(ax,ja){var Sm=qr();ja.exports=function(e,t){t=t||{};var r=Sm.decode(e,t);if(!r)return null;var n=r.payload;if(typeof n==="string")try{var i=JSON.parse(n);if(i!==null&&typeof i==="object")n=i}catch(o){}if(t.complete===!0)return{header:r.header,payload:n,signature:r.signature};return n}});var Qt=m(function(cx,Da){var Ur=function(e,t){if(Error.call(this,e),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);if(this.name="JsonWebTokenError",this.message=e,t)this.inner=t};Ur.prototype=Object.create(Error.prototype);Ur.prototype.constructor=Ur;Da.exports=Ur});var Ji=m(function(ux,qa){var Fa=Qt(),Hr=function(e,t){Fa.call(this,e),this.name="NotBeforeError",this.date=t};Hr.prototype=Object.create(Fa.prototype);Hr.prototype.constructor=Hr;qa.exports=Hr});var Wi=m(function(fx,Ha){var Ua=Qt(),Br=function(e,t){Ua.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};Br.prototype=Object.create(Ua.prototype);Br.prototype.constructor=Br;Ha.exports=Br});var ji=m(function(lx,Ba){var mt=1000,yt=mt*60,gt=yt*60,Ge=gt*24,bm=Ge*7,vm=Ge*365.25;Ba.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Am(e);else if(r==="number"&&isFinite(e))return t.long?Tm(e):xm(e);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Am(e){if(e=String(e),e.length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*vm;case"weeks":case"week":case"w":return r*bm;case"days":case"day":case"d":return r*Ge;case"hours":case"hour":case"hrs":case"hr":case"h":return r*gt;case"minutes":case"minute":case"mins":case"min":case"m":return r*yt;case"seconds":case"second":case"secs":case"sec":case"s":return r*mt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}function xm(e){var t=Math.abs(e);if(t>=Ge)return Math.round(e/Ge)+"d";if(t>=gt)return Math.round(e/gt)+"h";if(t>=yt)return Math.round(e/yt)+"m";if(t>=mt)return Math.round(e/mt)+"s";return e+"ms"}function Tm(e){var t=Math.abs(e);if(t>=Ge)return Mr(e,t,Ge,"day");if(t>=gt)return Mr(e,t,gt,"hour");if(t>=yt)return Mr(e,t,yt,"minute");if(t>=mt)return Mr(e,t,mt,"second");return e+" ms"}function Mr(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}});var Di=m(function(dx,Ma){var Cm=ji();Ma.exports=function(e,t){var r=t||Math.floor(Date.now()/1000);if(typeof e==="string"){var n=Cm(e);if(typeof n>"u")return;return Math.floor(r+n/1000)}else if(typeof e==="number")return r+e;else return}});var wt=m(function(px,Ga){var Im=Number.MAX_SAFE_INTEGER||9007199254740991,Rm=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Ga.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Im,RELEASE_TYPES:Rm,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var er=m(function(hx,za){var Om=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};za.exports=Om});var Et=m(function(ve,Va){var{MAX_SAFE_COMPONENT_LENGTH:Fi,MAX_SAFE_BUILD_LENGTH:_m,MAX_LENGTH:km}=wt(),Pm=er();ve=Va.exports={};var Km=ve.re=[],Nm=ve.safeRe=[],b=ve.src=[],$m=ve.safeSrc=[],v=ve.t={},Lm=0,qi="[a-zA-Z0-9-]",Jm=[["\\s",1],["\\d",km],[qi,_m]],Wm=(e)=>{for(let[t,r]of Jm)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},C=(e,t,r)=>{let n=Wm(t),i=Lm++;Pm(e,i,t),v[e]=i,b[i]=t,$m[i]=n,Km[i]=new RegExp(t,r?"g":void 0),Nm[i]=new RegExp(n,r?"g":void 0)};C("NUMERICIDENTIFIER","0|[1-9]\\d*");C("NUMERICIDENTIFIERLOOSE","\\d+");C("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${qi}*`);C("MAINVERSION",`(${b[v.NUMERICIDENTIFIER]})\\.(${b[v.NUMERICIDENTIFIER]})\\.(${b[v.NUMERICIDENTIFIER]})`);C("MAINVERSIONLOOSE",`(${b[v.NUMERICIDENTIFIERLOOSE]})\\.(${b[v.NUMERICIDENTIFIERLOOSE]})\\.(${b[v.NUMERICIDENTIFIERLOOSE]})`);C("PRERELEASEIDENTIFIER",`(?:${b[v.NONNUMERICIDENTIFIER]}|${b[v.NUMERICIDENTIFIER]})`);C("PRERELEASEIDENTIFIERLOOSE",`(?:${b[v.NONNUMERICIDENTIFIER]}|${b[v.NUMERICIDENTIFIERLOOSE]})`);C("PRERELEASE",`(?:-(${b[v.PRERELEASEIDENTIFIER]}(?:\\.${b[v.PRERELEASEIDENTIFIER]})*))`);C("PRERELEASELOOSE",`(?:-?(${b[v.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[v.PRERELEASEIDENTIFIERLOOSE]})*))`);C("BUILDIDENTIFIER",`${qi}+`);C("BUILD",`(?:\\+(${b[v.BUILDIDENTIFIER]}(?:\\.${b[v.BUILDIDENTIFIER]})*))`);C("FULLPLAIN",`v?${b[v.MAINVERSION]}${b[v.PRERELEASE]}?${b[v.BUILD]}?`);C("FULL",`^${b[v.FULLPLAIN]}$`);C("LOOSEPLAIN",`[v=\\s]*${b[v.MAINVERSIONLOOSE]}${b[v.PRERELEASELOOSE]}?${b[v.BUILD]}?`);C("LOOSE",`^${b[v.LOOSEPLAIN]}$`);C("GTLT","((?:<|>)?=?)");C("XRANGEIDENTIFIERLOOSE",`${b[v.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);C("XRANGEIDENTIFIER",`${b[v.NUMERICIDENTIFIER]}|x|X|\\*`);C("XRANGEPLAIN",`[v=\\s]*(${b[v.XRANGEIDENTIFIER]})(?:\\.(${b[v.XRANGEIDENTIFIER]})(?:\\.(${b[v.XRANGEIDENTIFIER]})(?:${b[v.PRERELEASE]})?${b[v.BUILD]}?)?)?`);C("XRANGEPLAINLOOSE",`[v=\\s]*(${b[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[v.XRANGEIDENTIFIERLOOSE]})(?:${b[v.PRERELEASELOOSE]})?${b[v.BUILD]}?)?)?`);C("XRANGE",`^${b[v.GTLT]}\\s*${b[v.XRANGEPLAIN]}$`);C("XRANGELOOSE",`^${b[v.GTLT]}\\s*${b[v.XRANGEPLAINLOOSE]}$`);C("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Fi}})(?:\\.(\\d{1,${Fi}}))?(?:\\.(\\d{1,${Fi}}))?`);C("COERCE",`${b[v.COERCEPLAIN]}(?:$|[^\\d])`);C("COERCEFULL",b[v.COERCEPLAIN]+`(?:${b[v.PRERELEASE]})?(?:${b[v.BUILD]})?(?:$|[^\\d])`);C("COERCERTL",b[v.COERCE],!0);C("COERCERTLFULL",b[v.COERCEFULL],!0);C("LONETILDE","(?:~>?)");C("TILDETRIM",`(\\s*)${b[v.LONETILDE]}\\s+`,!0);ve.tildeTrimReplace="$1~";C("TILDE",`^${b[v.LONETILDE]}${b[v.XRANGEPLAIN]}$`);C("TILDELOOSE",`^${b[v.LONETILDE]}${b[v.XRANGEPLAINLOOSE]}$`);C("LONECARET","(?:\\^)");C("CARETTRIM",`(\\s*)${b[v.LONECARET]}\\s+`,!0);ve.caretTrimReplace="$1^";C("CARET",`^${b[v.LONECARET]}${b[v.XRANGEPLAIN]}$`);C("CARETLOOSE",`^${b[v.LONECARET]}${b[v.XRANGEPLAINLOOSE]}$`);C("COMPARATORLOOSE",`^${b[v.GTLT]}\\s*(${b[v.LOOSEPLAIN]})$|^$`);C("COMPARATOR",`^${b[v.GTLT]}\\s*(${b[v.FULLPLAIN]})$|^$`);C("COMPARATORTRIM",`(\\s*)${b[v.GTLT]}\\s*(${b[v.LOOSEPLAIN]}|${b[v.XRANGEPLAIN]})`,!0);ve.comparatorTrimReplace="$1$2$3";C("HYPHENRANGE",`^\\s*(${b[v.XRANGEPLAIN]})\\s+-\\s+(${b[v.XRANGEPLAIN]})\\s*$`);C("HYPHENRANGELOOSE",`^\\s*(${b[v.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[v.XRANGEPLAINLOOSE]})\\s*$`);C("STAR","(<|>)?=?\\s*\\*");C("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");C("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Gr=m(function(mx,Xa){var jm=Object.freeze({loose:!0}),Dm=Object.freeze({}),Fm=(e)=>{if(!e)return Dm;if(typeof e!=="object")return jm;return e};Xa.exports=Fm});var Ui=m(function(yx,Qa){var Ya=/^[0-9]+$/,Za=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=Ya.test(e),n=Ya.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},qm=(e,t)=>Za(t,e);Qa.exports={compareIdentifiers:Za,rcompareIdentifiers:qm}});var Y=m(function(gx,tc){var zr=er(),{MAX_LENGTH:ec,MAX_SAFE_INTEGER:Vr}=wt(),{safeRe:Xr,t:Yr}=Et(),Um=Gr(),{compareIdentifiers:Hi}=Ui(),Hm=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(Hi(e[n],r[n])!==0)return!1;return!0};class me{constructor(e,t){if(t=Um(t),e instanceof me)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>ec)throw TypeError(`version is longer than ${ec} characters`);zr("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?Xr[Yr.LOOSE]:Xr[Yr.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Vr||this.major<0)throw TypeError("Invalid major version");if(this.minor>Vr||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>Vr||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<Vr)return i}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(zr("SemVer.compare",this.version,this.options,e),!(e instanceof me)){if(typeof e==="string"&&e===this.version)return 0;e=new me(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof me))e=new me(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof me))e=new me(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(zr("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return Hi(r,n)}while(++t)}compareBuild(e){if(!(e instanceof me))e=new me(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(zr("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return Hi(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?Xr[Yr.PRERELEASELOOSE]:Xr[Yr.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;while(--i>=0)if(typeof this.prerelease[i]==="number")this.prerelease[i]++,i=-2;if(i===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let i=[t,n];if(r===!1)i=[t];if(Hm(this.prerelease,t)){let o=this.prerelease[t.split(".").length];if(isNaN(o))this.prerelease=i}else this.prerelease=i}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}tc.exports=me});var Ne=m(function(wx,nc){var rc=Y(),Bm=(e,t,r=!1)=>{if(e instanceof rc)return e;try{return new rc(e,t)}catch(n){if(!r)return null;throw n}};nc.exports=Bm});var oc=m(function(Ex,ic){var Mm=Ne(),Gm=(e,t)=>{let r=Mm(e,t);return r?r.version:null};ic.exports=Gm});var ac=m(function(Sx,sc){var zm=Ne(),Vm=(e,t)=>{let r=zm(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};sc.exports=Vm});var fc=m(function(bx,uc){var cc=Y(),Xm=(e,t,r,n,i)=>{if(typeof r==="string")i=n,n=r,r=void 0;try{return new cc(e instanceof cc?e.version:e,r).inc(t,n,i).version}catch(o){return null}};uc.exports=Xm});var pc=m(function(vx,dc){var lc=Ne(),Ym=(e,t)=>{let r=lc(e,null,!0),n=lc(t,null,!0),i=r.compare(n);if(i===0)return null;let o=i>0,s=o?r:n,a=o?n:r,f=!!s.prerelease.length;if(!!a.prerelease.length&&!f){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let u=f?"pre":"";if(r.major!==n.major)return u+"major";if(r.minor!==n.minor)return u+"minor";if(r.patch!==n.patch)return u+"patch";return"prerelease"};dc.exports=Ym});var mc=m(function(Ax,hc){var Zm=Y(),Qm=(e,t)=>new Zm(e,t).major;hc.exports=Qm});var gc=m(function(xx,yc){var ey=Y(),ty=(e,t)=>new ey(e,t).minor;yc.exports=ty});var Ec=m(function(Tx,wc){var ry=Y(),ny=(e,t)=>new ry(e,t).patch;wc.exports=ny});var bc=m(function(Cx,Sc){var iy=Ne(),oy=(e,t)=>{let r=iy(e,t);return r&&r.prerelease.length?r.prerelease:null};Sc.exports=oy});var ce=m(function(Ix,Ac){var vc=Y(),sy=(e,t,r)=>new vc(e,r).compare(new vc(t,r));Ac.exports=sy});var Tc=m(function(Rx,xc){var ay=ce(),cy=(e,t,r)=>ay(t,e,r);xc.exports=cy});var Ic=m(function(Ox,Cc){var uy=ce(),fy=(e,t)=>uy(e,t,!0);Cc.exports=fy});var Zr=m(function(_x,Oc){var Rc=Y(),ly=(e,t,r)=>{let n=new Rc(e,r),i=new Rc(t,r);return n.compare(i)||n.compareBuild(i)};Oc.exports=ly});var kc=m(function(kx,_c){var dy=Zr(),py=(e,t)=>e.sort((r,n)=>dy(r,n,t));_c.exports=py});var Kc=m(function(Px,Pc){var hy=Zr(),my=(e,t)=>e.sort((r,n)=>hy(n,r,t));Pc.exports=my});var tr=m(function(Kx,Nc){var yy=ce(),gy=(e,t,r)=>yy(e,t,r)>0;Nc.exports=gy});var Qr=m(function(Nx,$c){var wy=ce(),Ey=(e,t,r)=>wy(e,t,r)<0;$c.exports=Ey});var Bi=m(function($x,Lc){var Sy=ce(),by=(e,t,r)=>Sy(e,t,r)===0;Lc.exports=by});var Mi=m(function(Lx,Jc){var vy=ce(),Ay=(e,t,r)=>vy(e,t,r)!==0;Jc.exports=Ay});var en=m(function(Jx,Wc){var xy=ce(),Ty=(e,t,r)=>xy(e,t,r)>=0;Wc.exports=Ty});var tn=m(function(Wx,jc){var Cy=ce(),Iy=(e,t,r)=>Cy(e,t,r)<=0;jc.exports=Iy});var Gi=m(function(jx,Dc){var Ry=Bi(),Oy=Mi(),_y=tr(),ky=en(),Py=Qr(),Ky=tn(),Ny=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return Ry(e,r,n);case"!=":return Oy(e,r,n);case">":return _y(e,r,n);case">=":return ky(e,r,n);case"<":return Py(e,r,n);case"<=":return Ky(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};Dc.exports=Ny});var qc=m(function(Dx,Fc){var $y=Y(),Ly=Ne(),{safeRe:rn,t:nn}=Et(),Jy=(e,t)=>{if(e instanceof $y)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?rn[nn.COERCEFULL]:rn[nn.COERCE]);else{let f=t.includePrerelease?rn[nn.COERCERTLFULL]:rn[nn.COERCERTL],c;while((c=f.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||c.index+c[0].length!==r.index+r[0].length)r=c;f.lastIndex=c.index+c[1].length+c[2].length}f.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",o=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Ly(`${n}.${i}.${o}${s}${a}`,t)};Fc.exports=Jy});var Hc=m(function(Fx,Uc){var Wy=Ne(),jy=wt(),Dy=Y(),Fy=(e,t,r)=>{if(!jy.RELEASE_TYPES.includes(t))return null;let n=qy(e,r);return n&&Uy(n,t)},qy=(e,t)=>{let r=e instanceof Dy?e.version:e;return Wy(r,t)},Uy=(e,t)=>{if(Hy(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},Hy=(e)=>e.startsWith("pre");Uc.exports=Fy});var Gc=m(function(qx,Mc){class Bc{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}Mc.exports=Bc});var ue=m(function(Ux,Yc){var By=/\s+/g;class rr{constructor(e,t){if(t=Gy(t),e instanceof rr)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new rr(e.raw,t);if(e instanceof zi)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(By," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!Vc(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&rg(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(tg,"");let r=((this.options.includePrerelease&&Qy)|(this.options.loose&&eg))+":"+e,n=zc.get(r);if(n)return n;let i=this.options.loose,o=i?te[Z.HYPHENRANGELOOSE]:te[Z.HYPHENRANGE];e=e.replace(o,pg(this.options.includePrerelease)),W("hyphen replace",e),e=e.replace(te[Z.COMPARATORTRIM],Xy),W("comparator trim",e),e=e.replace(te[Z.TILDETRIM],Yy),W("tilde trim",e),e=e.replace(te[Z.CARETTRIM],Zy),W("caret trim",e);let s=e.split(" ").map((u)=>ng(u,this.options)).join(" ").split(/\s+/).map((u)=>dg(u,this.options));if(i)s=s.filter((u)=>(W("loose invalid filter",u,this.options),!!u.match(te[Z.COMPARATORLOOSE])));W("range list",s);let a=new Map,f=s.map((u)=>new zi(u,this.options));for(let u of f){if(Vc(u))return[u];a.set(u.value,u)}if(a.size>1&&a.has(""))a.delete("");let c=[...a.values()];return zc.set(r,c),c}intersects(e,t){if(!(e instanceof rr))throw TypeError("a Range is required");return this.set.some((r)=>Xc(r,t)&&e.set.some((n)=>Xc(n,t)&&r.every((i)=>n.every((o)=>i.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new zy(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(hg(this.set[t],e,this.options))return!0;return!1}}Yc.exports=rr;var My=Gc(),zc=new My,Gy=Gr(),zi=nr(),W=er(),zy=Y(),{safeRe:te,src:Vy,t:Z,comparatorTrimReplace:Xy,tildeTrimReplace:Yy,caretTrimReplace:Zy}=Et(),{FLAG_INCLUDE_PRERELEASE:Qy,FLAG_LOOSE:eg}=wt(),tg=new RegExp(Vy[Z.BUILD],"g"),Vc=(e)=>e.value==="<0.0.0-0",rg=(e)=>e.value==="",Xc=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();while(r&&n.length)r=n.every((o)=>i.intersects(o,t)),i=n.pop();return r},ng=(e,t)=>(e=e.replace(te[Z.BUILD],""),W("comp",e,t),e=ag(e,t),W("caret",e),e=og(e,t),W("tildes",e),e=ug(e,t),W("xrange",e),e=lg(e,t),W("stars",e),e),G=(e)=>!e||e.toLowerCase()==="x"||e==="*",ig=(e,t,r)=>G(e)&&!G(t)||G(t)&&r&&!G(r),og=(e,t)=>e.trim().split(/\s+/).map((r)=>sg(r,t)).join(" "),sg=(e,t)=>{let r=t.loose?te[Z.TILDELOOSE]:te[Z.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(i,o,s,a,f)=>{W("tilde",e,i,o,s,a,f);let c;if(G(o))c="";else if(G(s))c=`>=${o}.0.0${n} <${+o+1}.0.0-0`;else if(G(a))c=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`;else if(f)W("replaceTilde pr",f),c=`>=${o}.${s}.${a}-${f} <${o}.${+s+1}.0-0`;else c=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`;return W("tilde return",c),c})},ag=(e,t)=>e.trim().split(/\s+/).map((r)=>cg(r,t)).join(" "),cg=(e,t)=>{W("caret",e,t);let r=t.loose?te[Z.CARETLOOSE]:te[Z.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(i,o,s,a,f)=>{W("caret",e,i,o,s,a,f);let c;if(G(o))c="";else if(G(s))c=`>=${o}.0.0${n} <${+o+1}.0.0-0`;else if(G(a))if(o==="0")c=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`;else c=`>=${o}.${s}.0${n} <${+o+1}.0.0-0`;else if(f)if(W("replaceCaret pr",f),o==="0")if(s==="0")c=`>=${o}.${s}.${a}-${f} <${o}.${s}.${+a+1}-0`;else c=`>=${o}.${s}.${a}-${f} <${o}.${+s+1}.0-0`;else c=`>=${o}.${s}.${a}-${f} <${+o+1}.0.0-0`;else if(W("no pr"),o==="0")if(s==="0")c=`>=${o}.${s}.${a} <${o}.${s}.${+a+1}-0`;else c=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`;else c=`>=${o}.${s}.${a} <${+o+1}.0.0-0`;return W("caret return",c),c})},ug=(e,t)=>(W("replaceXRanges",e,t),e.split(/\s+/).map((r)=>fg(r,t)).join(" ")),fg=(e,t)=>{e=e.trim();let r=t.loose?te[Z.XRANGELOOSE]:te[Z.XRANGE];return e.replace(r,(n,i,o,s,a,f)=>{if(W("xRange",e,n,i,o,s,a,f),ig(o,s,a))return e;let c=G(o),u=c||G(s),l=u||G(a),p=l;if(i==="="&&p)i="";if(f=t.includePrerelease?"-0":"",c)if(i===">"||i==="<")n="<0.0.0-0";else n="*";else if(i&&p){if(u)s=0;if(a=0,i===">")if(i=">=",u)o=+o+1,s=0,a=0;else s=+s+1,a=0;else if(i==="<=")if(i="<",u)o=+o+1;else s=+s+1;if(i==="<")f="-0";n=`${i+o}.${s}.${a}${f}`}else if(u)n=`>=${o}.0.0${f} <${+o+1}.0.0-0`;else if(l)n=`>=${o}.${s}.0${f} <${o}.${+s+1}.0-0`;return W("xRange return",n),n})},lg=(e,t)=>(W("replaceStars",e,t),e.trim().replace(te[Z.STAR],"")),dg=(e,t)=>(W("replaceGTE0",e,t),e.trim().replace(te[t.includePrerelease?Z.GTE0PRE:Z.GTE0],"")),pg=(e)=>(t,r,n,i,o,s,a,f,c,u,l,p)=>{if(G(n))r="";else if(G(i))r=`>=${n}.0.0${e?"-0":""}`;else if(G(o))r=`>=${n}.${i}.0${e?"-0":""}`;else if(s)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(G(c))f="";else if(G(u))f=`<${+c+1}.0.0-0`;else if(G(l))f=`<${c}.${+u+1}.0-0`;else if(p)f=`<=${c}.${u}.${l}-${p}`;else if(e)f=`<${c}.${u}.${+l+1}-0`;else f=`<=${f}`;return`${r} ${f}`.trim()},hg=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(W(e[n].semver),e[n].semver===zi.ANY)continue;if(e[n].semver.prerelease.length>0){let i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}}return!1}return!0}});var nr=m(function(Hx,nu){var ir=Symbol("SemVer ANY");class on{static get ANY(){return ir}constructor(e,t){if(t=Zc(t),e instanceof on)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),Xi("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===ir)this.value="";else this.value=this.operator+this.semver.version;Xi("comp",this)}parse(e){let t=this.options.loose?Qc[eu.COMPARATORLOOSE]:Qc[eu.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=ir;else this.semver=new tu(r[2],this.options.loose)}toString(){return this.value}test(e){if(Xi("Comparator.test",e,this.options.loose),this.semver===ir||e===ir)return!0;if(typeof e==="string")try{e=new tu(e,this.options)}catch(t){return!1}return Vi(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof on))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new ru(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new ru(this.value,t).test(e.semver)}if(t=Zc(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(Vi(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(Vi(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}nu.exports=on;var Zc=Gr(),{safeRe:Qc,t:eu}=Et(),Vi=Gi(),Xi=er(),tu=Y(),ru=ue()});var or=m(function(Bx,iu){var mg=ue(),yg=(e,t,r)=>{try{t=new mg(t,r)}catch(n){return!1}return t.test(e)};iu.exports=yg});var su=m(function(Mx,ou){var gg=ue(),wg=(e,t)=>new gg(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));ou.exports=wg});var cu=m(function(Gx,au){var Eg=Y(),Sg=ue(),bg=(e,t,r)=>{let n=null,i=null,o=null;try{o=new Sg(t,r)}catch(s){return null}return e.forEach((s)=>{if(o.test(s)){if(!n||i.compare(s)===-1)n=s,i=new Eg(n,r)}}),n};au.exports=bg});var fu=m(function(zx,uu){var vg=Y(),Ag=ue(),xg=(e,t,r)=>{let n=null,i=null,o=null;try{o=new Ag(t,r)}catch(s){return null}return e.forEach((s)=>{if(o.test(s)){if(!n||i.compare(s)===1)n=s,i=new vg(n,r)}}),n};uu.exports=xg});var pu=m(function(Vx,du){var Yi=Y(),Tg=ue(),lu=tr(),Cg=(e,t)=>{e=new Tg(e,t);let r=new Yi("0.0.0");if(e.test(r))return r;if(r=new Yi("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let i=e.set[n],o=null;if(i.forEach((s)=>{let a=new Yi(s.semver.version);switch(s.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!o||lu(a,o))o=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${s.operator}`)}}),o&&(!r||lu(r,o)))r=o}if(r&&e.test(r))return r;return null};du.exports=Cg});var mu=m(function(Xx,hu){var Ig=ue(),Rg=(e,t)=>{try{return new Ig(e,t).range||"*"}catch(r){return null}};hu.exports=Rg});var sn=m(function(Yx,Eu){var Og=Y(),wu=nr(),{ANY:_g}=wu,kg=ue(),Pg=or(),yu=tr(),gu=Qr(),Kg=tn(),Ng=en(),$g=(e,t,r,n)=>{e=new Og(e,n),t=new kg(t,n);let i,o,s,a,f;switch(r){case">":i=yu,o=Kg,s=gu,a=">",f=">=";break;case"<":i=gu,o=Ng,s=yu,a="<",f="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(Pg(e,t,n))return!1;for(let c=0;c<t.set.length;++c){let u=t.set[c],l=null,p=null;if(u.forEach((d)=>{if(d.semver===_g)d=new wu(">=0.0.0");if(l=l||d,p=p||d,i(d.semver,l.semver,n))l=d;else if(s(d.semver,p.semver,n))p=d}),l.operator===a||l.operator===f)return!1;if((!p.operator||p.operator===a)&&o(e,p.semver))return!1;else if(p.operator===f&&s(e,p.semver))return!1}return!0};Eu.exports=$g});var bu=m(function(Zx,Su){var Lg=sn(),Jg=(e,t,r)=>Lg(e,t,">",r);Su.exports=Jg});var Au=m(function(Qx,vu){var Wg=sn(),jg=(e,t,r)=>Wg(e,t,"<",r);vu.exports=jg});var Cu=m(function(eT,Tu){var xu=ue(),Dg=(e,t,r)=>(e=new xu(e,r),t=new xu(t,r),e.intersects(t,r));Tu.exports=Dg});var Ru=m(function(tT,Iu){var Fg=or(),qg=ce();Iu.exports=(e,t,r)=>{let n=[],i=null,o=null,s=e.sort((u,l)=>qg(u,l,r));for(let u of s)if(Fg(u,t,r)){if(o=u,!i)i=u}else{if(o)n.push([i,o]);o=null,i=null}if(i)n.push([i,null]);let a=[];for(let[u,l]of n)if(u===l)a.push(u);else if(!l&&u===s[0])a.push("*");else if(!l)a.push(`>=${u}`);else if(u===s[0])a.push(`<=${l}`);else a.push(`${u} - ${l}`);let f=a.join(" || "),c=typeof t.raw==="string"?t.raw:String(t);return f.length<c.length?f:t}});var Nu=m(function(rT,Ku){var Ou=ue(),eo=nr(),{ANY:Zi}=eo,Qi=or(),to=ce(),Ug=(e,t,r={})=>{if(e===t)return!0;e=new Ou(e,r),t=new Ou(t,r);let n=!1;e:for(let i of e.set){for(let o of t.set){let s=Bg(i,o,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},Hg=[new eo(">=0.0.0-0")],_u=[new eo(">=0.0.0")],Bg=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Zi)if(t.length===1&&t[0].semver===Zi)return!0;else if(r.includePrerelease)e=Hg;else e=_u;if(t.length===1&&t[0].semver===Zi)if(r.includePrerelease)return!0;else t=_u;let n=new Set,i,o;for(let d of e)if(d.operator===">"||d.operator===">=")i=ku(i,d,r);else if(d.operator==="<"||d.operator==="<=")o=Pu(o,d,r);else n.add(d.semver);if(n.size>1)return null;let s;if(i&&o){if(s=to(i.semver,o.semver,r),s>0)return null;else if(s===0&&(i.operator!==">="||o.operator!=="<="))return null}for(let d of n){if(i&&!Qi(d,String(i),r))return null;if(o&&!Qi(d,String(o),r))return null;for(let g of t)if(!Qi(d,String(g),r))return!1;return!0}let a,f,c,u,l=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;if(l&&l.prerelease.length===1&&o.operator==="<"&&l.prerelease[0]===0)l=!1;for(let d of t){if(u=u||d.operator===">"||d.operator===">=",c=c||d.operator==="<"||d.operator==="<=",i){if(p){if(d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===p.major&&d.semver.minor===p.minor&&d.semver.patch===p.patch)p=!1}if(d.operator===">"||d.operator===">="){if(a=ku(i,d,r),a===d&&a!==i)return!1}else if(i.operator===">="&&!d.test(i.semver))return!1}if(o){if(l){if(d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===l.major&&d.semver.minor===l.minor&&d.semver.patch===l.patch)l=!1}if(d.operator==="<"||d.operator==="<="){if(f=Pu(o,d,r),f===d&&f!==o)return!1}else if(o.operator==="<="&&!d.test(o.semver))return!1}if(!d.operator&&(o||i)&&s!==0)return!1}if(i&&c&&!o&&s!==0)return!1;if(o&&u&&!i&&s!==0)return!1;if(p||l)return!1;return!0},ku=(e,t,r)=>{if(!e)return t;let n=to(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},Pu=(e,t,r)=>{if(!e)return t;let n=to(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};Ku.exports=Ug});var an=m(function(nT,Ju){var ro=Et(),$u=wt(),Mg=Y(),Lu=Ui(),Gg=Ne(),zg=oc(),Vg=ac(),Xg=fc(),Yg=pc(),Zg=mc(),Qg=gc(),ew=Ec(),tw=bc(),rw=ce(),nw=Tc(),iw=Ic(),ow=Zr(),sw=kc(),aw=Kc(),cw=tr(),uw=Qr(),fw=Bi(),lw=Mi(),dw=en(),pw=tn(),hw=Gi(),mw=qc(),yw=Hc(),gw=nr(),ww=ue(),Ew=or(),Sw=su(),bw=cu(),vw=fu(),Aw=pu(),xw=mu(),Tw=sn(),Cw=bu(),Iw=Au(),Rw=Cu(),Ow=Ru(),_w=Nu();Ju.exports={parse:Gg,valid:zg,clean:Vg,inc:Xg,diff:Yg,major:Zg,minor:Qg,patch:ew,prerelease:tw,compare:rw,rcompare:nw,compareLoose:iw,compareBuild:ow,sort:sw,rsort:aw,gt:cw,lt:uw,eq:fw,neq:lw,gte:dw,lte:pw,cmp:hw,coerce:mw,truncate:yw,Comparator:gw,Range:ww,satisfies:Ew,toComparators:Sw,maxSatisfying:bw,minSatisfying:vw,minVersion:Aw,validRange:xw,outside:Tw,gtr:Cw,ltr:Iw,intersects:Rw,simplifyRange:Ow,subset:_w,SemVer:Mg,re:ro.re,src:ro.src,tokens:ro.t,SEMVER_SPEC_VERSION:$u.SEMVER_SPEC_VERSION,RELEASE_TYPES:$u.RELEASE_TYPES,compareIdentifiers:Lu.compareIdentifiers,rcompareIdentifiers:Lu.rcompareIdentifiers}});var ju=m(function(iT,Wu){var kw=an();Wu.exports=kw.satisfies(process.version,">=15.7.0")});var Fu=m(function(oT,Du){var Pw=an();Du.exports=Pw.satisfies(process.version,">=16.9.0")});var no=m(function(sT,qu){var Kw=ju(),Nw=Fu(),$w={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},Lw={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};qu.exports=function(e,t){if(!e||!t)return;let r=t.asymmetricKeyType;if(!r)return;let n=$w[r];if(!n)throw Error(`Unknown key type "${r}".`);if(!n.includes(e))throw Error(`"alg" parameter for "${r}" key type must be one of: ${n.join(", ")}.`);if(Kw)switch(r){case"ec":let i=t.asymmetricKeyDetails.namedCurve,o=Lw[e];if(i!==o)throw Error(`"alg" parameter "${e}" requires curve "${o}".`);break;case"rsa-pss":if(Nw){let s=parseInt(e.slice(-3),10),{hashAlgorithm:a,mgf1HashAlgorithm:f,saltLength:c}=t.asymmetricKeyDetails;if(a!==`sha${s}`||f!==a)throw Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(c!==void 0&&c>s>>3)throw Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}break}}});var io=m(function(aT,Uu){var Jw=an();Uu.exports=Jw.satisfies(process.version,"^6.12.0 || >=8.0.0")});var Mu=m(function(cT,Bu){var L=Qt(),Ww=Ji(),Hu=Wi(),jw=Li(),Dw=Di(),Fw=no(),qw=io(),Uw=qr(),{KeyObject:Hw,createSecretKey:Bw,createPublicKey:Mw}=require("crypto"),oo=["RS256","RS384","RS512"],Gw=["ES256","ES384","ES512"],so=["RS256","RS384","RS512"],zw=["HS256","HS384","HS512"];if(qw)oo.splice(oo.length,0,"PS256","PS384","PS512"),so.splice(so.length,0,"PS256","PS384","PS512");Bu.exports=function(e,t,r,n){if(typeof r==="function"&&!n)n=r,r={};if(!r)r={};r=Object.assign({},r);let i;if(n)i=n;else i=function(u,l){if(u)throw u;return l};if(r.clockTimestamp&&typeof r.clockTimestamp!=="number")return i(new L("clockTimestamp must be a number"));if(r.nonce!==void 0&&(typeof r.nonce!=="string"||r.nonce.trim()===""))return i(new L("nonce must be a non-empty string"));if(r.allowInvalidAsymmetricKeyTypes!==void 0&&typeof r.allowInvalidAsymmetricKeyTypes!=="boolean")return i(new L("allowInvalidAsymmetricKeyTypes must be a boolean"));let o=r.clockTimestamp||Math.floor(Date.now()/1000);if(!e)return i(new L("jwt must be provided"));if(typeof e!=="string")return i(new L("jwt must be a string"));let s=e.split(".");if(s.length!==3)return i(new L("jwt malformed"));let a;try{a=jw(e,{complete:!0})}catch(u){return i(u)}if(!a)return i(new L("invalid token"));let f=a.header,c;if(typeof t==="function"){if(!n)return i(new L("verify must be called asynchronous if secret or public key is provided as a callback"));c=t}else c=function(u,l){return l(null,t)};return c(f,function(u,l){if(u)return i(new L("error in secret or public key callback: "+u.message));let p=s[2].trim()!=="";if(!p&&l)return i(new L("jwt signature is required"));if(p&&!l)return i(new L("secret or public key must be provided"));if(!p&&!r.algorithms)return i(new L('please specify "none" in "algorithms" to verify unsigned tokens'));if(l!=null&&!(l instanceof Hw))try{l=Mw(l)}catch(h){try{l=Bw(typeof l==="string"?Buffer.from(l):l)}catch(S){return i(new L("secretOrPublicKey is not valid key material"))}}if(!r.algorithms)if(l.type==="secret")r.algorithms=zw;else if(["rsa","rsa-pss"].includes(l.asymmetricKeyType))r.algorithms=so;else if(l.asymmetricKeyType==="ec")r.algorithms=Gw;else r.algorithms=oo;if(r.algorithms.indexOf(a.header.alg)===-1)return i(new L("invalid algorithm"));if(f.alg.startsWith("HS")&&l.type!=="secret")return i(new L(`secretOrPublicKey must be a symmetric key when using ${f.alg}`));else if(/^(?:RS|PS|ES)/.test(f.alg)&&l.type!=="public")return i(new L(`secretOrPublicKey must be an asymmetric key when using ${f.alg}`));if(!r.allowInvalidAsymmetricKeyTypes)try{Fw(f.alg,l)}catch(h){return i(h)}let d;try{d=Uw.verify(e,a.header.alg,l)}catch(h){return i(h)}if(!d)return i(new L("invalid signature"));let g=a.payload;if(typeof g.nbf<"u"&&!r.ignoreNotBefore){if(typeof g.nbf!=="number")return i(new L("invalid nbf value"));if(g.nbf>o+(r.clockTolerance||0))return i(new Ww("jwt not active",new Date(g.nbf*1000)))}if(typeof g.exp<"u"&&!r.ignoreExpiration){if(typeof g.exp!=="number")return i(new L("invalid exp value"));if(o>=g.exp+(r.clockTolerance||0))return i(new Hu("jwt expired",new Date(g.exp*1000)))}if(r.audience){let h=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(g.aud)?g.aud:[g.aud]).some(function(y){return h.some(function(T){return T instanceof RegExp?T.test(y):T===y})}))return i(new L("jwt audience invalid. expected: "+h.join(" or ")))}if(r.issuer){if(typeof r.issuer==="string"&&g.iss!==r.issuer||Array.isArray(r.issuer)&&r.issuer.indexOf(g.iss)===-1)return i(new L("jwt issuer invalid. expected: "+r.issuer))}if(r.subject){if(g.sub!==r.subject)return i(new L("jwt subject invalid. expected: "+r.subject))}if(r.jwtid){if(g.jti!==r.jwtid)return i(new L("jwt jwtid invalid. expected: "+r.jwtid))}if(r.nonce){if(g.nonce!==r.nonce)return i(new L("jwt nonce invalid. expected: "+r.nonce))}if(r.maxAge){if(typeof g.iat!=="number")return i(new L("iat required when maxAge is specified"));let h=Dw(r.maxAge,g.iat);if(typeof h>"u")return i(new L('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(o>=h+(r.clockTolerance||0))return i(new Hu("maxAge exceeded",new Date(h*1000)))}if(r.complete===!0){let h=a.signature;return i(null,{header:f,payload:g,signature:h})}return i(null,g)})}});var Zu=m(function(uT,Yu){var Gu=1/0,Vu=9007199254740991,Vw=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,zu=NaN,Xw="[object Arguments]",Yw="[object Function]",Zw="[object GeneratorFunction]",Qw="[object String]",eE="[object Symbol]",tE=/^\s+|\s+$/g,rE=/^[-+]0x[0-9a-f]+$/i,nE=/^0b[01]+$/i,iE=/^0o[0-7]+$/i,oE=/^(?:0|[1-9]\d*)$/,sE=parseInt;function aE(e,t){var r=-1,n=e?e.length:0,i=Array(n);while(++r<n)i[r]=t(e[r],r,e);return i}function cE(e,t,r,n){var i=e.length,o=r+(n?1:-1);while(n?o--:++o<i)if(t(e[o],o,e))return o;return-1}function uE(e,t,r){if(t!==t)return cE(e,fE,r);var n=r-1,i=e.length;while(++n<i)if(e[n]===t)return n;return-1}function fE(e){return e!==e}function lE(e,t){var r=-1,n=Array(e);while(++r<e)n[r]=t(r);return n}function dE(e,t){return aE(t,function(r){return e[r]})}function pE(e,t){return function(r){return e(t(r))}}var cn=Object.prototype,co=cn.hasOwnProperty,un=cn.toString,hE=cn.propertyIsEnumerable,mE=pE(Object.keys,Object),yE=Math.max;function gE(e,t){var r=Xu(e)||vE(e)?lE(e.length,String):[],n=r.length,i=!!n;for(var o in e)if((t||co.call(e,o))&&!(i&&(o=="length"||EE(o,n))))r.push(o);return r}function wE(e){if(!SE(e))return mE(e);var t=[];for(var r in Object(e))if(co.call(e,r)&&r!="constructor")t.push(r);return t}function EE(e,t){return t=t==null?Vu:t,!!t&&(typeof e=="number"||oE.test(e))&&(e>-1&&e%1==0&&e<t)}function SE(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||cn;return e===r}function bE(e,t,r,n){e=uo(e)?e:PE(e),r=r&&!n?OE(r):0;var i=e.length;if(r<0)r=yE(i+r,0);return CE(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&uE(e,t,r)>-1}function vE(e){return AE(e)&&co.call(e,"callee")&&(!hE.call(e,"callee")||un.call(e)==Xw)}var Xu=Array.isArray;function uo(e){return e!=null&&TE(e.length)&&!xE(e)}function AE(e){return fo(e)&&uo(e)}function xE(e){var t=ao(e)?un.call(e):"";return t==Yw||t==Zw}function TE(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Vu}function ao(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function fo(e){return!!e&&typeof e=="object"}function CE(e){return typeof e=="string"||!Xu(e)&&fo(e)&&un.call(e)==Qw}function IE(e){return typeof e=="symbol"||fo(e)&&un.call(e)==eE}function RE(e){if(!e)return e===0?e:0;if(e=_E(e),e===Gu||e===-Gu){var t=e<0?-1:1;return t*Vw}return e===e?e:0}function OE(e){var t=RE(e),r=t%1;return t===t?r?t-r:t:0}function _E(e){if(typeof e=="number")return e;if(IE(e))return zu;if(ao(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ao(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(tE,"");var r=nE.test(e);return r||iE.test(e)?sE(e.slice(2),r?2:8):rE.test(e)?zu:+e}function kE(e){return uo(e)?gE(e):wE(e)}function PE(e){return e?dE(e,kE(e)):[]}Yu.exports=bE});var ef=m(function(fT,Qu){var KE="[object Boolean]",NE=Object.prototype,$E=NE.toString;function LE(e){return e===!0||e===!1||JE(e)&&$E.call(e)==KE}function JE(e){return!!e&&typeof e=="object"}Qu.exports=LE});var sf=m(function(lT,of){var tf=1/0,WE=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,rf=NaN,jE="[object Symbol]",DE=/^\s+|\s+$/g,FE=/^[-+]0x[0-9a-f]+$/i,qE=/^0b[01]+$/i,UE=/^0o[0-7]+$/i,HE=parseInt,BE=Object.prototype,ME=BE.toString;function GE(e){return typeof e=="number"&&e==YE(e)}function nf(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function zE(e){return!!e&&typeof e=="object"}function VE(e){return typeof e=="symbol"||zE(e)&&ME.call(e)==jE}function XE(e){if(!e)return e===0?e:0;if(e=ZE(e),e===tf||e===-tf){var t=e<0?-1:1;return t*WE}return e===e?e:0}function YE(e){var t=XE(e),r=t%1;return t===t?r?t-r:t:0}function ZE(e){if(typeof e=="number")return e;if(VE(e))return rf;if(nf(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=nf(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(DE,"");var r=qE.test(e);return r||UE.test(e)?HE(e.slice(2),r?2:8):FE.test(e)?rf:+e}of.exports=GE});var cf=m(function(dT,af){var QE="[object Number]",eS=Object.prototype,tS=eS.toString;function rS(e){return!!e&&typeof e=="object"}function nS(e){return typeof e=="number"||rS(e)&&tS.call(e)==QE}af.exports=nS});var df=m(function(pT,lf){var iS="[object Object]";function oS(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function sS(e,t){return function(r){return e(t(r))}}var aS=Function.prototype,uf=Object.prototype,ff=aS.toString,cS=uf.hasOwnProperty,uS=ff.call(Object),fS=uf.toString,lS=sS(Object.getPrototypeOf,Object);function dS(e){return!!e&&typeof e=="object"}function pS(e){if(!dS(e)||fS.call(e)!=iS||oS(e))return!1;var t=lS(e);if(t===null)return!0;var r=cS.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&ff.call(r)==uS}lf.exports=pS});var hf=m(function(hT,pf){var hS="[object String]",mS=Object.prototype,yS=mS.toString,gS=Array.isArray;function wS(e){return!!e&&typeof e=="object"}function ES(e){return typeof e=="string"||!gS(e)&&wS(e)&&yS.call(e)==hS}pf.exports=ES});var Ef=m(function(mT,wf){var SS="Expected a function",mf=1/0,bS=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,yf=NaN,vS="[object Symbol]",AS=/^\s+|\s+$/g,xS=/^[-+]0x[0-9a-f]+$/i,TS=/^0b[01]+$/i,CS=/^0o[0-7]+$/i,IS=parseInt,RS=Object.prototype,OS=RS.toString;function _S(e,t){var r;if(typeof t!="function")throw TypeError(SS);return e=$S(e),function(){if(--e>0)r=t.apply(this,arguments);if(e<=1)t=void 0;return r}}function kS(e){return _S(2,e)}function gf(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function PS(e){return!!e&&typeof e=="object"}function KS(e){return typeof e=="symbol"||PS(e)&&OS.call(e)==vS}function NS(e){if(!e)return e===0?e:0;if(e=LS(e),e===mf||e===-mf){var t=e<0?-1:1;return t*bS}return e===e?e:0}function $S(e){var t=NS(e),r=t%1;return t===t?r?t-r:t:0}function LS(e){if(typeof e=="number")return e;if(KS(e))return yf;if(gf(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=gf(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(AS,"");var r=TS.test(e);return r||CS.test(e)?IS(e.slice(2),r?2:8):xS.test(e)?yf:+e}wf.exports=kS});var Rf=m(function(yT,If){var Sf=Di(),JS=io(),WS=no(),bf=qr(),jS=Zu(),fn=ef(),vf=sf(),lo=cf(),xf=df(),$e=hf(),DS=Ef(),{KeyObject:FS,createSecretKey:qS,createPrivateKey:US}=require("crypto"),Tf=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];if(JS)Tf.splice(3,0,"PS256","PS384","PS512");var HS={expiresIn:{isValid:function(e){return vf(e)||$e(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return vf(e)||$e(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return $e(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:jS.bind(null,Tf),message:'"algorithm" must be a valid string enum value'},header:{isValid:xf,message:'"header" must be an object'},encoding:{isValid:$e,message:'"encoding" must be a string'},issuer:{isValid:$e,message:'"issuer" must be a string'},subject:{isValid:$e,message:'"subject" must be a string'},jwtid:{isValid:$e,message:'"jwtid" must be a string'},noTimestamp:{isValid:fn,message:'"noTimestamp" must be a boolean'},keyid:{isValid:$e,message:'"keyid" must be a string'},mutatePayload:{isValid:fn,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:fn,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:fn,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},BS={iat:{isValid:lo,message:'"iat" should be a number of seconds'},exp:{isValid:lo,message:'"exp" should be a number of seconds'},nbf:{isValid:lo,message:'"nbf" should be a number of seconds'}};function Cf(e,t,r,n){if(!xf(r))throw Error('Expected "'+n+'" to be a plain object.');Object.keys(r).forEach(function(i){let o=e[i];if(!o){if(!t)throw Error('"'+i+'" is not allowed in "'+n+'"');return}if(!o.isValid(r[i]))throw Error(o.message)})}function MS(e){return Cf(HS,!1,e,"options")}function GS(e){return Cf(BS,!0,e,"payload")}var Af={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},zS=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];If.exports=function(e,t,r,n){if(typeof r==="function")n=r,r={};else r=r||{};let i=typeof e==="object"&&!Buffer.isBuffer(e),o=Object.assign({alg:r.algorithm||"HS256",typ:i?"JWT":void 0,kid:r.keyid},r.header);function s(c){if(n)return n(c);throw c}if(!t&&r.algorithm!=="none")return s(Error("secretOrPrivateKey must have a value"));if(t!=null&&!(t instanceof FS))try{t=US(t)}catch(c){try{t=qS(typeof t==="string"?Buffer.from(t):t)}catch(u){return s(Error("secretOrPrivateKey is not valid key material"))}}if(o.alg.startsWith("HS")&&t.type!=="secret")return s(Error(`secretOrPrivateKey must be a symmetric key when using ${o.alg}`));else if(/^(?:RS|PS|ES)/.test(o.alg)){if(t.type!=="private")return s(Error(`secretOrPrivateKey must be an asymmetric key when using ${o.alg}`));if(!r.allowInsecureKeySizes&&!o.alg.startsWith("ES")&&t.asymmetricKeyDetails!==void 0&&t.asymmetricKeyDetails.modulusLength<2048)return s(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`))}if(typeof e>"u")return s(Error("payload is required"));else if(i){try{GS(e)}catch(c){return s(c)}if(!r.mutatePayload)e=Object.assign({},e)}else{let c=zS.filter(function(u){return typeof r[u]<"u"});if(c.length>0)return s(Error("invalid "+c.join(",")+" option for "+typeof e+" payload"))}if(typeof e.exp<"u"&&typeof r.expiresIn<"u")return s(Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(typeof e.nbf<"u"&&typeof r.notBefore<"u")return s(Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{MS(r)}catch(c){return s(c)}if(!r.allowInvalidAsymmetricKeyTypes)try{WS(o.alg,t)}catch(c){return s(c)}let a=e.iat||Math.floor(Date.now()/1000);if(r.noTimestamp)delete e.iat;else if(i)e.iat=a;if(typeof r.notBefore<"u"){try{e.nbf=Sf(r.notBefore,a)}catch(c){return s(c)}if(typeof e.nbf>"u")return s(Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(typeof r.expiresIn<"u"&&typeof e==="object"){try{e.exp=Sf(r.expiresIn,a)}catch(c){return s(c)}if(typeof e.exp>"u")return s(Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(Af).forEach(function(c){let u=Af[c];if(typeof r[c]<"u"){if(typeof e[u]<"u")return s(Error('Bad "options.'+c+'" option. The payload already has an "'+u+'" property.'));e[u]=r[c]}});let f=r.encoding||"utf8";if(typeof n==="function")n=n&&DS(n),bf.createSign({header:o,privateKey:t,payload:e,encoding:f}).once("error",n).once("done",function(c){if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(o.alg)&&c.length<256)return n(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`));n(null,c)});else{let c=bf.sign({header:o,payload:e,secret:t,encoding:f});if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(o.alg)&&c.length<256)throw Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`);return c}}});var _f=m(function(gT,Of){Of.exports={decode:Li(),verify:Mu(),sign:Rf(),JsonWebTokenError:Qt(),NotBeforeError:Ji(),TokenExpiredError:Wi()}});var po=m(function(wT,kf){function VS(e){r.debug=r,r.default=r,r.coerce=f,r.disable=s,r.enable=i,r.enabled=a,r.humanize=ji(),r.destroy=c,Object.keys(e).forEach((u)=>{r[u]=e[u]}),r.names=[],r.skips=[],r.formatters={};function t(u){let l=0;for(let p=0;p<u.length;p++)l=(l<<5)-l+u.charCodeAt(p),l|=0;return r.colors[Math.abs(l)%r.colors.length]}r.selectColor=t;function r(u){let l,p=null,d,g;function h(...S){if(!h.enabled)return;let E=h,y=Number(new Date),T=y-(l||y);if(E.diff=T,E.prev=l,E.curr=y,l=y,S[0]=r.coerce(S[0]),typeof S[0]!=="string")S.unshift("%O");let I=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(j,q)=>{if(j==="%%")return"%";I++;let V=r.formatters[q];if(typeof V==="function"){let N=S[I];j=V.call(E,N),S.splice(I,1),I--}return j}),r.formatArgs.call(E,S),(E.log||r.log).apply(E,S)}if(h.namespace=u,h.useColors=r.useColors(),h.color=r.selectColor(u),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(p!==null)return p;if(d!==r.namespaces)d=r.namespaces,g=r.enabled(u);return g},set:(S)=>{p=S}}),typeof r.init==="function")r.init(h);return h}function n(u,l){let p=r(this.namespace+(typeof l>"u"?":":l)+u);return p.log=this.log,p}function i(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];let l=(typeof u==="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let p of l)if(p[0]==="-")r.skips.push(p.slice(1));else r.names.push(p)}function o(u,l){let p=0,d=0,g=-1,h=0;while(p<u.length)if(d<l.length&&(l[d]===u[p]||l[d]==="*"))if(l[d]==="*")g=d,h=p,d++;else p++,d++;else if(g!==-1)d=g+1,h++,p=h;else return!1;while(d<l.length&&l[d]==="*")d++;return d===l.length}function s(){let u=[...r.names,...r.skips.map((l)=>"-"+l)].join(",");return r.enable(""),u}function a(u){for(let l of r.skips)if(o(u,l))return!1;for(let l of r.names)if(o(u,l))return!0;return!1}function f(u){if(u instanceof Error)return u.stack||u.message;return u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}kf.exports=VS});var Pf=m(function(ne,ln){ne.formatArgs=YS;ne.save=ZS;ne.load=QS;ne.useColors=XS;ne.storage=eb();ne.destroy=(()=>{let e=!1;return()=>{if(!e)e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();ne.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function XS(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function YS(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+ln.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,(i)=>{if(i==="%%")return;if(r++,i==="%c")n=r}),e.splice(n,0,t)}ne.log=console.debug||console.log||(()=>{});function ZS(e){try{if(e)ne.storage.setItem("debug",e);else ne.storage.removeItem("debug")}catch(t){}}function QS(){let e;try{e=ne.storage.getItem("debug")||ne.storage.getItem("DEBUG")}catch(t){}if(!e&&typeof process<"u"&&"env"in process)e=process.env.DEBUG;return e}function eb(){try{return localStorage}catch(e){}}ln.exports=po()(ne);var{formatters:tb}=ln.exports;tb.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Nf={};Vt(Nf,{createSupportsColor:()=>mo,default:()=>sb});function fe(e,t=globalThis.Deno?globalThis.Deno.args:pn.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),i=t.indexOf("--");return n!==-1&&(i===-1||n<i)}function rb(){if(!("FORCE_COLOR"in D))return;if(D.FORCE_COLOR==="true")return 1;if(D.FORCE_COLOR==="false")return 0;if(D.FORCE_COLOR.length===0)return 1;let e=Math.min(Number.parseInt(D.FORCE_COLOR,10),3);if(![0,1,2,3].includes(e))return;return e}function nb(e){if(e===0)return!1;return{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function ib(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=rb();if(n!==void 0)dn=n;let i=r?dn:n;if(i===0)return 0;if(r){if(fe("color=16m")||fe("color=full")||fe("color=truecolor"))return 3;if(fe("color=256"))return 2}if("TF_BUILD"in D&&"AGENT_NAME"in D)return 1;if(e&&!t&&i===void 0)return 0;let o=i||0;if(D.TERM==="dumb")return o;if(pn.default.platform==="win32"){let s=Kf.default.release().split(".");if(Number(s[0])>=10&&Number(s[2])>=10586)return Number(s[2])>=14931?3:2;return 1}if("CI"in D){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((s)=>(s in D)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((s)=>(s in D))||D.CI_NAME==="codeship")return 1;return o}if("TEAMCITY_VERSION"in D)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(D.TEAMCITY_VERSION)?1:0;if(D.COLORTERM==="truecolor")return 3;if(D.TERM==="xterm-kitty")return 3;if(D.TERM==="xterm-ghostty")return 3;if(D.TERM==="wezterm")return 3;if("TERM_PROGRAM"in D){let s=Number.parseInt((D.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(D.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(D.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(D.TERM))return 1;if("COLORTERM"in D)return 1;return o}function mo(e,t={}){let r=ib(e,{streamIsTTY:e&&e.isTTY,...t});return nb(r)}var pn,Kf,ho,D,dn,ob,sb;var $f=x(()=>{pn=ut(require("node:process")),Kf=ut(require("node:os")),ho=ut(require("node:tty"));({env:D}=pn.default);if(fe("no-color")||fe("no-colors")||fe("color=false")||fe("color=never"))dn=0;else if(fe("color")||fe("colors")||fe("color=true")||fe("color=always"))dn=1;ob={stdout:mo({isTTY:ho.default.isatty(1)}),stderr:mo({isTTY:ho.default.isatty(2)})},sb=ob});var Jf=m(function(X,mn){var ab=require("tty"),hn=require("util");X.init=hb;X.log=lb;X.formatArgs=ub;X.save=db;X.load=pb;X.useColors=cb;X.destroy=hn.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");X.colors=[6,2,3,4,5,1];try{let e=($f(),_r(Nf));if(e&&(e.stderr||e).level>=2)X.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(e){}X.inspectOpts=Object.keys(process.env).filter((e)=>/^debug_/i.test(e)).reduce((e,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(i,o)=>o.toUpperCase()),n=process.env[t];if(/^(yes|on|true|enabled)$/i.test(n))n=!0;else if(/^(no|off|false|disabled)$/i.test(n))n=!1;else if(n==="null")n=null;else n=Number(n);return e[r]=n,e},{});function cb(){return"colors"in X.inspectOpts?Boolean(X.inspectOpts.colors):ab.isatty(process.stderr.fd)}function ub(e){let{namespace:t,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${t} \x1B[0m`;e[0]=o+e[0].split(`
4
4
  `).join(`
5
- `+o),e.push(i+"m+"+hn.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=fb()+t+" "+e[0]}function fb(){if(X.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function lb(...e){return process.stderr.write(pn.formatWithOptions(X.inspectOpts,...e)+`
6
- `)}function db(e){if(e)process.env.DEBUG=e;else delete process.env.DEBUG}function pb(){return process.env.DEBUG}function hb(e){e.inspectOpts={};let t=Object.keys(X.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=X.inspectOpts[t[r]]}hn.exports=po()(X);var{formatters:Jf}=hn.exports;Jf.o=function(e){return this.inspectOpts.colors=this.useColors,pn.inspect(e,this.inspectOpts).split(`
7
- `).map((t)=>t.trim()).join(" ")};Jf.O=function(e){return this.inspectOpts.colors=this.useColors,pn.inspect(e,this.inspectOpts)}});var mn=m(function(ET,yo){if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)yo.exports=Pf();else yo.exports=Lf()});function B(...e){let t=e.reduce((i,{length:o})=>i+o,0),r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}function go(e,t,r){if(t<0||t>=4294967296)throw RangeError(`value must be >= 0 and <= 4294967295. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,t&255],r)}function wo(e){let t=Math.floor(e/4294967296),r=e%4294967296,n=new Uint8Array(8);return go(n,t,0),go(n,r,4),n}function yn(e){let t=new Uint8Array(4);return go(t,e),t}function F(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>127)throw TypeError("non-ASCII string encountered in encode()");t[r]=n}return t}var Et,ze,St;var ie=x(()=>{Et=new TextEncoder,ze=new TextDecoder,St=new TextDecoder("utf-8",{fatal:!0})});function Eo(e,t){if(t&&!e.usages.includes(t))throw TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function wn(e,t){let{modulusLength:r}=t.algorithm;if(typeof r!=="number"||r<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}function Te(e,t,r){let n=e.algorithm;if(n.name!==t.name)throw gn(t.name);if(t.hash&&n.hash?.name!==t.hash)throw gn(t.hash,"algorithm.hash");if(t.namedCurve&&n.namedCurve!==t.namedCurve)throw gn(t.namedCurve,"algorithm.namedCurve");if(t.length!==void 0&&n.length!==t.length)throw gn(t.length,"algorithm.length");Eo(e,r)}var gn=(e,t="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);function Wf(e,t,...r){if(r.length>2){let n=r.pop();e+=`one of type ${r.join(", ")}, or ${n}.`}else if(r.length===2)e+=`one of type ${r[0]} or ${r[1]}.`;else e+=`of type ${r[0]}.`;if(t==null)e+=` Received ${t}`;else if(typeof t==="function"&&t.name)e+=` Received function ${t.name}`;else if(typeof t==="object"&&t!=null){if(t.constructor?.name)e+=` Received an instance of ${t.constructor.name}`}return e}var ye=(e,...t)=>Wf("Key must be ",e,...t),or=(e,t,...r)=>Wf(`Key for the ${e} algorithm must be `,t,...r);var So={};zt(So,{JOSEAlgNotAllowed:()=>Ve,JOSEError:()=>z,JOSENotSupported:()=>_,JWEDecryptionFailed:()=>Je,JWEInvalid:()=>w,JWKInvalid:()=>ar,JWKSInvalid:()=>cr,JWKSMultipleMatchingKeys:()=>En,JWKSNoMatchingKey:()=>bt,JWKSTimeout:()=>Sn,JWSInvalid:()=>A,JWSSignatureVerificationFailed:()=>Xe,JWTClaimValidationFailed:()=>ge,JWTExpired:()=>sr,JWTInvalid:()=>U});var z,ge,sr,Ve,_,Je,w,A,U,ar,cr,bt,En,Sn,Xe;var k=x(()=>{z=class z extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,t){super(e,t);this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};ge=class ge extends z{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}});this.claim=r,this.reason=n,this.payload=t}};sr=class sr extends z{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}});this.claim=r,this.reason=n,this.payload=t}};Ve=class Ve extends z{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"};_=class _ extends z{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"};Je=class Je extends z{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(e="decryption operation failed",t){super(e,t)}};w=class w extends z{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"};A=class A extends z{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"};U=class U extends z{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"};ar=class ar extends z{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"};cr=class cr extends z{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"};bt=class bt extends z{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(e="no applicable key found in the JSON Web Key Set",t){super(e,t)}};En=class En extends z{[Symbol.asyncIterator]=async function*(){};static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t)}};Sn=class Sn extends z{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(e="request timed out",t){super(e,t)}};Xe=class Xe extends z{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",t){super(e,t)}}});function bn(e){if(!we(e))throw Error("CryptoKey instance expected")}var we=(e)=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch{return!1}},ur=(e)=>e?.[Symbol.toStringTag]==="KeyObject",vn=(e)=>we(e)||ur(e);function jf(e,t){let r=e.byteLength<<3;if(r!==t)throw new w(`Invalid Content Encryption Key length. Expected ${t} bits, got ${r} bits`)}function Df(e,t){if(t.length<<3!==e.ivBits)throw new w("Invalid Initialization Vector length")}async function Ff(e,t,r){if(!(t instanceof Uint8Array))throw TypeError(ye(t,"Uint8Array"));let n=e.cekBits>>1,i=await crypto.subtle.importKey("raw",t.subarray(n>>3),"AES-CBC",!1,[r]),o=await crypto.subtle.importKey("raw",t.subarray(0,n>>3),{hash:`SHA-${n<<1}`,name:"HMAC"},!1,["sign"]);return[i,o,n]}async function qf(e,t,r){return new Uint8Array((await crypto.subtle.sign("HMAC",e,t)).slice(0,r>>3))}async function yb(e,t,r,n,i){let[o,s,a]=await Ff(e,r,"encrypt"),f=new Uint8Array(await crypto.subtle.encrypt({iv:n,name:"AES-CBC"},o,t)),c=B(i,n,f,wo(i.length*8)),u=await qf(s,c,a);return{ciphertext:f,tag:u,iv:n}}async function gb(e,t){let r={name:"HMAC",hash:"SHA-256"},n=await crypto.subtle.generateKey(r,!1,["sign","verify"]),i=await crypto.subtle.sign(r,n,e);return crypto.subtle.verify(r,n,i,t)}async function wb(e,t,r,n,i,o){let[s,a,f]=await Ff(e,t,"decrypt"),c=B(o,n,r,wo(o.length*8)),u=await qf(a,c,f);try{if(await gb(i,u))return new Uint8Array(await crypto.subtle.decrypt({iv:n,name:"AES-CBC"},s,r))}catch{}throw new Je}async function Eb(e,t,r,n,i){let o=r instanceof Uint8Array?await crypto.subtle.importKey("raw",r,"AES-GCM",!1,["encrypt"]):(Te(r,e.subtle,"encrypt"),r),s=new Uint8Array(await crypto.subtle.encrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},o,t)),a=s.slice(-16);return{ciphertext:s.slice(0,-16),tag:a,iv:n}}async function Sb(e,t,r,n,i,o){let s=t instanceof Uint8Array?await crypto.subtle.importKey("raw",t,"AES-GCM",!1,["decrypt"]):(Te(t,e.subtle,"decrypt"),t);try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:o,iv:n,name:"AES-GCM",tagLength:128},s,B(r,i)))}catch{throw new Je}}async function An(e,t,r,n,i){if(!we(r)&&!(r instanceof Uint8Array))throw TypeError(ye(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(n)Df(e,n);else n=mb(e);if(r instanceof Uint8Array)jf(r,e.cekBits);return e.cbc?yb(e,t,r,n,i):Eb(e,t,r,n,i)}async function xn(e,t,r,n,i,o){if(!we(t)&&!(t instanceof Uint8Array))throw TypeError(ye(t,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!n)throw new w("JWE Initialization Vector missing");if(!i)throw new w("JWE Authentication Tag missing");if(!e.cbc&&i.length!==16)throw new w("Invalid Authentication Tag length");if(Df(e,n),t instanceof Uint8Array)jf(t,e.cekBits);return e.cbc?wb(e,t,r,n,i,o):Sb(e,t,r,n,i,o)}var Ee=(e)=>crypto.getRandomValues(new Uint8Array(e.cekBits>>3)),mb=(e)=>crypto.getRandomValues(new Uint8Array(e.ivBits>>3));var fr=x(()=>{ie();k()});function Tn(e){if(Uint8Array.prototype.toBase64)return e.toBase64();let t=32768,r=[];for(let n=0;n<e.length;n+=t)r.push(String.fromCharCode.apply(null,e.subarray(n,n+t)));return btoa(r.join(""))}function Cn(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}var In={};zt(In,{decode:()=>Ae,encode:()=>K});function Ae(e){if(Uint8Array.fromBase64)try{return Uint8Array.fromBase64(typeof e==="string"?e:ze.decode(e),{alphabet:"base64url"})}catch(r){throw TypeError(bo,{cause:r})}let t=e;if(t instanceof Uint8Array)t=ze.decode(t);if(t.includes("+")||t.includes("/"))throw TypeError(bo);t=t.replace(/-/g,"+").replace(/_/g,"/");try{return Cn(t)}catch{throw TypeError(bo)}}function K(e){let t=e;if(typeof t==="string")t=Et.encode(t);if(Uint8Array.prototype.toBase64)return t.toBase64({alphabet:"base64url",omitPadding:!0});return Tn(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var bo="The input to be decoded is not correctly encoded.";var oe=x(()=>{ie()});function se(e,t){if(!(e instanceof Uint8Array))throw TypeError(`${t} must be an instance of Uint8Array`)}function R(e){if(typeof e!=="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Rn(e){return R(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(R)}function Le(...e){let t=new Set;for(let r of e){if(!r)continue;for(let n of Object.keys(r)){if(t.has(n))return!1;t.add(n)}}return!0}function P(e,t){if(e!==void 0)throw TypeError(`${t} can only be called once`)}function M(e,t,r){try{return Ae(e)}catch{throw new r(`Failed to base64url decode the ${t}`)}}function On(e,t,r){try{return F(e)}catch{throw new r(`The ${t} is not a valid base64url string`)}}async function _n(e,t){let r=`SHA-${e.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(r,t))}function Ce(e,t,r){let n;try{n=JSON.parse(St.decode(Ae(e)))}catch{throw new t(r)}if(!R(n))throw new t(r);return n}var Uf;var Q=x(()=>{oe();ie();Uf=Symbol()});async function Se(e,t){if(t.kty==="RSA"&&"oth"in t&&t.oth!==void 0)throw new _('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');if(!e.kty.includes(t.kty))throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');let r=e.resolve?.({kty:t.kty,crv:t.crv})??e.subtle,n=!!(t.d||t.priv),i={...t};if(i.kty!=="AKP")delete i.alg;return delete i.use,crypto.subtle.importKey("jwk",i,r,t.ext??!n,t.key_ops??e.usages[n?1:0])}var vt=x(()=>{k()});function At(e){return{__proto__:null,...e}}function xt(e){let t=At(e);if(t.ext!==void 0&&typeof t.ext!=="boolean")throw TypeError('"ext" (Extractable) Parameter must be a boolean');if(t.key_ops!==void 0){let r=t.key_ops,n=Array.isArray(r)?[...r]:void 0;if(!n||n.some((i)=>typeof i!=="string")||new Set(n).size!==n.length)throw TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');t.key_ops=n}return t}function vb(e,t,r){let{alg:n,secret:i}=e,o=r==="decrypt"||r==="sign";if(i&&t instanceof Uint8Array)return[Bf,t];if(R(t)){let s=xt(t);if(typeof s.kty!=="string")throw TypeError(i?or(n,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):or(n,t,"CryptoKey","KeyObject","JSON Web Key"));if(!(i?s.kty==="oct"&&typeof s.k==="string":s.kty!=="oct"&&(o?s.kty==="AKP"&&typeof s.priv==="string"||typeof s.d==="string":s.d===void 0&&s.priv===void 0)))throw TypeError(i?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':`JSON Web Key for this operation must be a ${o?"private":"public"} JWK`);return bb(e,s,r),[zf,t,s]}if(!vn(t))throw TypeError(i?or(n,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):or(n,t,"CryptoKey","KeyObject","JSON Web Key"));if(i){if(t.type!=="secret")throw TypeError(`${vo(t)} instances for symmetric algorithms must be of type "secret"`)}else{if(t.type==="secret")throw TypeError(`${vo(t)} instances for asymmetric algorithms must not be of type "secret"`);let s=o?"private":"public";if((t.type==="public"||t.type==="private")&&t.type!==s){let a=r==="sign"?"signing":r==="verify"?"verifying":`${r.slice(0,-1)}tion`;throw TypeError(`${vo(t)} instances for asymmetric algorithm ${a} must be of type "${s}"`)}}return we(t)?[Mf,t]:[Gf,t]}function kn(e,t,r){Ao||=new WeakMap;let n=Ao.get(e);if(r)if(n)n[t]=r;else Ao.set(e,{[t]:r});return r??n?.[t]}async function le(e,t,r){let n=vb(e,t,r);switch(n[0]){case Bf:case Mf:return n[1];case zf:{let i=n[1],o=n[2];if(o.kty==="oct")return Ae(o.k);if(!Object.isFrozen(i)){let{key_ops:s}=i;if(Array.isArray(s))Object.freeze(s);Object.freeze(i)}return Hf(i,o,e)}case Gf:{let i=n[1];if(i.type==="secret")return i.export();if("toCryptoKey"in i&&typeof i.toCryptoKey==="function")return xb(i,e);return Hf(i,i.export({format:"jwk"}),e)}}}var vo=(e)=>e[Symbol.toStringTag],bb=(e,t,r)=>{let{alg:n}=e;if(t.use!==void 0){let i=r==="sign"||r==="verify"?"sig":"enc";if(t.use!==i)throw TypeError(`Invalid key for this operation, its "use" must be "${i}" when present`)}if(t.alg!==void 0&&t.alg!==n)throw TypeError(`Invalid key for this operation, its "alg" must be "${n}" when present`);if(Array.isArray(t.key_ops)){let i=r==="encrypt"||r==="decrypt"?e.ops?.[r==="encrypt"?0:1]:r;if(i&&!t.key_ops.includes(i))throw TypeError(`Invalid key for this operation, its "key_ops" must include "${i}" when present`)}},Bf=0,Mf=1,Gf=2,zf=3,Ao,Ab,Hf=async(e,t,r)=>kn(e,r.alg)??kn(e,r.alg,await Se(r,{...t,alg:r.alg})),xb=(e,t)=>{let r=kn(e,t.alg);if(r)return r;let n=e.type==="public",i=t.usages[n?0:1],{asymmetricKeyType:o}=e,s=Ab[e.asymmetricKeyDetails?.namedCurve],a=t.resolve?.({crv:s,asymmetricKeyType:o})??t.subtle;return kn(e,t.alg,e.toCryptoKey(a,n,i))};var Ye=x(()=>{oe();vt();Ab={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"}});function lr(e){let t={__proto__:null};for(let r in e)t[r]={...e[r],alg:r};return t}function Pn(e){return{kty:["RSA"],subtle:{name:"RSA-OAEP",hash:`SHA-${e}`},usages:Tb,ops:["wrapKey","unwrapKey"]}}function Kn(){return{kty:["EC","OKP"],subtle:{name:"ECDH"},resolve:({kty:e,crv:t,asymmetricKeyType:r})=>{if(t==="X25519"||r==="x25519")return{name:"X25519"};if(e==="OKP")throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:t}},usages:Cb,ops:[void 0,"deriveBits"]}}function Tt(e,t=!1){return{kty:["oct"],secret:!0,subtle:{name:t?"AES-GCM":"AES-KW",length:e},usages:Nn,ops:t?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function xo(){return{kty:["oct"],secret:!0,subtle:{name:"PBKDF2"},usages:Nn,ops:["deriveBits","deriveBits"]}}function Ct(e,t=!1){return{kty:["oct"],secret:!0,subtle:{name:t?"AES-CBC":"AES-GCM",length:e},usages:Nn,ops:Ib,cekBits:e,ivBits:t?128:96,cbc:t}}function Vf(e,t){throw new _(`Invalid or unsupported "${e}" (JWE ${t}) header value`)}function de(e){return(typeof e==="string"?To[e]:void 0)??Vf("alg","Algorithm")}function Ze(e){return(typeof e==="string"?Rb[e]:void 0)??Vf("enc","Encryption Algorithm")}var Tb,Cb,Nn,To,Ib,Rb;var It=x(()=>{k();Tb=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],Cb=[[],["deriveBits"]],Nn=[[],[]];To=lr({dir:{kty:["oct"],secret:!0,subtle:{name:"AES-GCM"},usages:Nn,ops:["encrypt","decrypt"]},"RSA-OAEP":Pn(1),"RSA-OAEP-256":Pn(256),"RSA-OAEP-384":Pn(384),"RSA-OAEP-512":Pn(512),"ECDH-ES":Kn(),"ECDH-ES+A128KW":Kn(),"ECDH-ES+A192KW":Kn(),"ECDH-ES+A256KW":Kn(),A128KW:Tt(128),A192KW:Tt(192),A256KW:Tt(256),A128GCMKW:Tt(128,!0),A192GCMKW:Tt(192,!0),A256GCMKW:Tt(256,!0),"PBES2-HS256+A128KW":xo(),"PBES2-HS384+A192KW":xo(),"PBES2-HS512+A256KW":xo()}),Ib=["encrypt","decrypt"];Rb=lr({A128GCM:Ct(128),A192GCM:Ct(192),A256GCM:Ct(256),"A128CBC-HS256":Ct(256,!0),"A192CBC-HS384":Ct(384,!0),"A256CBC-HS512":Ct(512,!0)})});function Xf(e,t){if(e.algorithm.name!=="ECDH"&&e.algorithm.name!=="X25519")throw TypeError("CryptoKey does not support this operation, its algorithm.name must be ECDH or X25519");Eo(e,t)}async function Zf(e,t,r){let n=de(t).subtle,i=e instanceof Uint8Array?await crypto.subtle.importKey("raw",e,"AES-KW",!0,[r]):e;return Te(i,n,r),i}async function Co(e,t,r){let n=await Zf(t,e,"wrapKey"),i=await crypto.subtle.importKey("raw",r,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",i,n,"AES-KW"))}async function Io(e,t,r){let n=await Zf(t,e,"unwrapKey"),i=await crypto.subtle.unwrapKey("raw",r,n,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",i))}function Qf(e,t,r){Te(t,de(e).subtle,r),wn(e,t)}function Ob(e,t){if(e instanceof Uint8Array)return crypto.subtle.importKey("raw",e,"PBKDF2",!1,["deriveBits"]);return Te(e,de(t).subtle,"deriveBits"),e}async function el(e,t,r,n){if(!(e instanceof Uint8Array)||e.length<8)throw new w("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(r)||Math.sign(r)!==1)throw new w("PBES2 Count Input must be a positive integer");let i=B(F(t),Uint8Array.of(0),e),o=parseInt(t.slice(13,16),10),s={hash:`SHA-${t.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:i},a=await Ob(n,t);return new Uint8Array(await crypto.subtle.deriveBits(s,a,o))}function Ro(e){return B(yn(e.length),e)}async function _b(e,t,r){let n=t>>3,i=32,o=Math.ceil(n/32),s=new Uint8Array(o*32);for(let a=1;a<=o;a++){let f=await _n("sha256",B(yn(a),e,r));s.set(f,(a-1)*32)}return s.slice(0,n)}async function tl(e,t,r,n,i=new Uint8Array,o=new Uint8Array){Xf(e),Xf(t,"deriveBits");let s=B(Ro(F(r)),Ro(i),Ro(o),yn(n)),a=new Uint8Array(await crypto.subtle.deriveBits({name:e.algorithm.name,public:e},t,e.algorithm.name==="X25519"?256:Math.ceil(parseInt(e.algorithm.namedCurve.slice(-3),10)/8)<<3));return _b(a,n,s)}function rl(e){bn(e);let t=e.algorithm.namedCurve;if(t!=="P-256"&&t!=="P-384"&&t!=="P-521"&&e.algorithm.name!=="X25519")throw new _("ECDH with the provided key is not allowed or not supported by your javascript runtime")}function dr(e){if(e===void 0)throw new w("JWE Encrypted Key missing")}function Yf(e){if(e!==void 0)throw new w("Encountered unexpected JWE Encrypted Key")}async function nl(e,t,r,n,i,o){let s=de(e);if(e==="dir")return Yf(n),r;switch(s.subtle.name){case"ECDH":{if(e==="ECDH-ES")Yf(n);if(!R(i.epk))throw new w('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');rl(r);let a=await Se(s,i.epk),f,c;if(i.apu!==void 0){if(typeof i.apu!=="string")throw new w('JOSE Header "apu" (Agreement PartyUInfo) invalid');f=M(i.apu,"apu",w)}if(i.apv!==void 0){if(typeof i.apv!=="string")throw new w('JOSE Header "apv" (Agreement PartyVInfo) invalid');c=M(i.apv,"apv",w)}let u=await tl(a,r,e==="ECDH-ES"?t.alg:e,e==="ECDH-ES"?t.cekBits:parseInt(e.slice(-5,-2),10),f,c);if(e==="ECDH-ES")return u;return dr(n),Io(e.slice(-6),u,n)}case"RSA-OAEP":return dr(n),bn(r),Qf(e,r,"decrypt"),new Uint8Array(await crypto.subtle.decrypt("RSA-OAEP",r,n));case"PBKDF2":{if(dr(n),typeof i.p2c!=="number")throw new w('JOSE Header "p2c" (PBES2 Count) missing or invalid');let a=o||1e4;if(i.p2c>a)throw new w('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof i.p2s!=="string")throw new w('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let f=M(i.p2s,"p2s",w),c=await el(f,e,i.p2c,r);return Io(e.slice(-6),c,n)}case"AES-KW":return dr(n),Io(e,r,n);case"AES-GCM":{if(dr(n),typeof i.iv!=="string")throw new w('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof i.tag!=="string")throw new w('JOSE Header "tag" (Authentication Tag) missing or invalid');let a;a=M(i.iv,"iv",w);let f;return f=M(i.tag,"tag",w),xn(Ze(e.slice(0,-2)),r,n,a,f,new Uint8Array)}}}async function $n(e,t,r,n,i={}){let o,s,a,f=de(e);if(e==="dir")return[r,void 0,void 0];switch(f.subtle.name){case"ECDH":{rl(r);let{apu:c,apv:u}=i;if(c!==void 0)se(c,'"apu"');if(u!==void 0)se(u,'"apv"');let l;if(i.epk!==void 0)l=await le(f,i.epk,"decrypt");else l=(await crypto.subtle.generateKey(r.algorithm,!0,["deriveBits"])).privateKey;let p=crypto.subtle,d=l;if(!d.extractable){if(typeof p.getPublicKey!=="function")throw TypeError('CryptoKey for "epk" must be extractable');d=await p.getPublicKey(l,[])}let{x:g,y:h,crv:S,kty:E}=await p.exportKey("jwk",d),y=await tl(r,l,e==="ECDH-ES"?t.alg:e,e==="ECDH-ES"?t.cekBits:parseInt(e.slice(-5,-2),10),c,u);if(s={epk:{x:g,crv:S,kty:E}},E==="EC")s.epk.y=h;if(c)s.apu=K(c);if(u)s.apv=K(u);if(e==="ECDH-ES"){a=y;break}a=n||Ee(t);let T=e.slice(-6);o=await Co(T,y,a);break}case"RSA-OAEP":{a=n||Ee(t),bn(r),Qf(e,r,"encrypt"),o=new Uint8Array(await crypto.subtle.encrypt("RSA-OAEP",r,a));break}case"PBKDF2":{a=n||Ee(t);let{p2c:c=2048,p2s:u=crypto.getRandomValues(new Uint8Array(16))}=i,l=await el(u,e,c,r);o=await Co(e.slice(-6),l,a),s={p2c:c,p2s:K(u)};break}case"AES-KW":{a=n||Ee(t),o=await Co(e,r,a);break}case"AES-GCM":{a=n||Ee(t);let{iv:c}=i,u=await An(Ze(e.slice(0,-2)),a,r,c,new Uint8Array);o=u.ciphertext,s={iv:K(u.iv),tag:K(u.tag)};break}}return[a,o,s]}var Jn=x(()=>{oe();Ye();vt();It();k();Q();fr();ie()});function pr(e,t){if(t!==void 0&&(!Array.isArray(t)||t.some((r)=>typeof r!=="string")))throw TypeError(`"${e}" option must be an array of strings`);if(!t)return;return new Set(t)}function Wn(e,t){let{crit:r}=t??{};if(Array.isArray(r)&&new Set(r).size!==r.length)throw new e('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}function xe(e,t,r,n,i){if(i.crit!==void 0&&n?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return[];if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some((s)=>typeof s!=="string"||s.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let o=r===void 0?t:{__proto__:null,...r,...t};for(let s of n.crit){if(!(s in o))throw new _(`Extension Header Parameter "${s}" is not recognized`);if(!Object.hasOwn(i,s)||i[s]===void 0)throw new e(`Extension Header Parameter "${s}" is missing`);if(o[s]&&(!Object.hasOwn(n,s)||n[s]===void 0))throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`)}return n.crit}function Ot(e,t){if(t.includes("b64")){let r=e.b64;if(typeof r!=="boolean")throw new A('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return r}return!0}function Qe(e,t){let r,n;try{r=JSON.stringify(t),n=JSON.parse(r)}catch(i){throw new e("JOSE Header is not valid JSON",{cause:i})}if(!R(n))throw new e("JOSE Header is not a JSON object");return[n,r]}var Rt,Ln;var _t=x(()=>{k();Rt={__proto__:null,b64:!0},Ln={__proto__:null}});function jn(e,t){if(e.zip!==void 0&&e.zip!=="DEF")throw new _('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(e.zip!==void 0&&!t?.zip)throw new w('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.')}function il(e){if(typeof globalThis[e]>"u")throw new _(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${e} API.`)}async function ol(e){il("CompressionStream");let t=new CompressionStream("deflate-raw"),r=t.writable.getWriter();r.write(e).catch(()=>{}),r.close().catch(()=>{});let n=[],i=t.readable.getReader();for(;;){let{value:o,done:s}=await i.read();if(s)break;n.push(o)}return B(...n)}async function sl(e,t){il("DecompressionStream");let r=new DecompressionStream("deflate-raw"),n=r.writable.getWriter();n.write(e).catch(()=>{}),n.close().catch(()=>{});let i=[],o=0,s=r.readable.getReader();for(;;){let{value:a,done:f}=await s.read();if(f)break;if(i.push(a),o+=a.byteLength,t!==1/0&&o>t)throw new w("Decompressed plaintext exceeded the configured limit")}return B(...i)}var Oo=x(()=>{k();ie()});function Dn(e){let{aad:t,ciphertext:r,iv:n,protected:i,tag:o,unprotected:s}=e;if(n!==void 0&&typeof n!=="string")throw new w("JWE Initialization Vector incorrect type");if(typeof r!=="string")throw new w("JWE Ciphertext missing or incorrect type");if(o!==void 0&&typeof o!=="string")throw new w("JWE Authentication Tag incorrect type");if(i!==void 0&&typeof i!=="string")throw new w("JWE Protected Header incorrect type");if(t!==void 0&&(typeof t!=="string"||!t))throw new w("JWE AAD incorrect type");if(s!==void 0&&!R(s))throw new w("JWE Shared Unprotected Header incorrect type");return{aad:t,ciphertext:r,iv:n,protected:i,tag:o,unprotected:s===void 0?void 0:{...s}}}function Fn(e){let t,r;try{let{header:n}=e;if(R(n)){r=n.alg;let i=Object.keys(n);if(!i.includes("alg"))r=void 0;t=Object.fromEntries(i.map((o)=>[o,o==="alg"?r:n[o]]))}else t=n}catch(n){return[void 0,r,n]}try{let{encrypted_key:n}=e;return[{encrypted_key:n,header:t},r]}catch(n){return[void 0,r,n]}}function qn(e){let{encrypted_key:t,header:r}=e;if(t!==void 0&&typeof t!=="string")throw new w("JWE Encrypted Key incorrect type");if(r!==void 0){if(!R(r))throw new w("JWE Per-Recipient Unprotected Header incorrect type")}if(e.protected===void 0&&r===void 0&&e.unprotected===void 0)throw new w("JOSE Header missing")}function _o(e){let{protected:t,ciphertext:r,iv:n,tag:i,aad:o}=e,s;if(t!==void 0)s=Ce(t,w,"JWE Protected Header is invalid");let a=t!==void 0?F(t):new Uint8Array;return[s,M(r,"ciphertext",w),n!==void 0?M(n,"iv",w):void 0,i!==void 0?M(i,"tag",w):void 0,o!==void 0?B(a,F("."),On(o,"aad",w)):a]}function Un(e,t){let[r,n,i,o]=t,{protected:s,aad:a,unprotected:f,header:c}=e,u={plaintext:r};if(s!==void 0)u.protectedHeader=n;if(a!==void 0)u.additionalAuthenticatedData=M(a,"aad",w);if(f!==void 0)u.sharedUnprotectedHeader=f;if(c!==void 0)u.unprotectedHeader=c;if(o)return{...u,key:i};return u}function We(e){return[e&&pr("keyManagementAlgorithms",e.keyManagementAlgorithms),e&&pr("contentEncryptionAlgorithms",e.contentEncryptionAlgorithms),e?.crit,e?.maxPBES2Count,e?.maxDecompressedLength]}async function ko(e,t,r,n){let[i]=t,{header:o,unprotected:s}=e,a;if(o!==void 0||s!==void 0){if(!Le(i,o,s))throw new w("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");a={...i,...o,...s}}else a=i??{};return al(e,t,r,n,a)}async function al(e,t,r,n,i){let[o,s,a,f,c]=r,[u,l,p,d,g]=t,{encrypted_key:h}=e;xe(w,Ln,a,u,i),jn(i,u);let{alg:S,enc:E}=i;if(typeof S!=="string"||!S)throw new w("missing JWE Algorithm (alg) in JWE Header");if(typeof E!=="string"||!E)throw new w("missing JWE Encryption Algorithm (enc) in JWE Header");if(o&&!o.has(S)||!o&&S.startsWith("PBES2"))throw new Ve('"alg" (Algorithm) Header Parameter value not allowed');if(s&&!s.has(E))throw new Ve('"enc" (Encryption Algorithm) Header Parameter value not allowed');let y=Ze(E),T;if(h!==void 0)T=M(h,"encrypted_key",w);let I=!1;if(typeof n==="function")n=await n(u,e),I=!0;let O=de(S),j=await le(S==="dir"?y:O,n,"decrypt"),q;try{if(q=await nl(S,y,j,T,i,f),h!==void 0&&q instanceof Uint8Array&&q.byteLength<<3!==y.cekBits)q=Ee(y)}catch(N){if(N instanceof TypeError||N instanceof w||N instanceof _)throw N;q=Ee(y)}let V=await xn(y,q,l,p,d,g);if(i.zip==="DEF"){let N=c??250000;if(N===0)throw new _('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if(N!==1/0&&(!Number.isSafeInteger(N)||N<1))throw TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");V=await sl(V,N).catch((ee)=>{if(ee instanceof w)throw ee;throw new w("Failed to decompress plaintext",{cause:ee})})}return[V,u,j,I]}async function cl(e,t,r){return ko(e,_o(e),t,r)}async function Hn(e,t,r){if(e instanceof Uint8Array)e=ze.decode(e);if(typeof e!=="string")throw new w("Compact JWE must be a string or Uint8Array");let{0:n,1:i,2:o,3:s,4:a,length:f}=e.split(".");if(f!==5)throw new w("Invalid Compact JWE");let c={ciphertext:s,iv:o||void 0,protected:n,tag:a||void 0,encrypted_key:i||void 0},u=Ce(n,w,"JWE Protected Header is invalid"),l=F(n),p=[u,M(s,"ciphertext",w),o?M(o,"iv",w):void 0,a?M(a,"tag",w):void 0,l];return al(c,p,t,r,u)}var hr=x(()=>{fr();Q();k();Jn();ie();_t();Ye();It();Oo()});async function ul(e,t,r){let n=await Hn(e,We(r),t),i={plaintext:n[0],protectedHeader:n[1]};if(typeof t==="function")return{...i,key:n[2]};return i}var fl=x(()=>{hr()});async function ll(e,t,r){if(!R(e))throw new w("Flattened JWE must be an object");let n=Dn(e),[i,,o]=Fn(e);if(!i)throw o;let s={...n,...i};return qn(s),Un(s,await cl(s,We(r),t))}var dl=x(()=>{k();hr()});async function pl(e,t,r){if(!R(e))throw new w("General JWE must be an object");let n=e.recipients;if(!Array.isArray(n))throw new w("JWE Recipients missing or incorrect type");let i=Array.from(n);if(!i.every(R))throw new w("JWE Recipients missing or incorrect type");if(!i.length)throw new w("JWE Recipients has no members");let o,s,a;try{o=We(r),s=Dn(e),a=_o(s)}catch{throw new Je}let f=i.map((c)=>Fn(c));if(i.length>1)for(let[,c]of f){let u=a[0]?.alg??c??s.unprotected?.alg;if(u==="dir"||u==="ECDH-ES")throw new w(`"${u}" alg may only have a single recipient`)}for(let[c]of f){if(!c)continue;try{let u={...s,...c};return qn(u),Un(u,await ko(u,a,o,t))}catch{}}throw new Je}var hl=x(()=>{hr();k()});function Bn(e,t,r){if(!Le(e,t,r))throw new w("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint")}function Po(e){let[,t,r,n,i,o,s,a,f]=e;if(i!==void 0)se(i,"JWE Additional Authenticated Data");if(o!==void 0)se(o,"JWE Content Encryption Key");if(s!==void 0)se(s,"JWE Initialization Vector");if(t!==void 0)t=Qe(w,t)[0],e[1]=t;if(r!==void 0)r=Qe(w,r)[0],e[2]=r;if(n!==void 0)n=Qe(w,n)[0],e[3]=n;if(a!==void 0&&!R(a))throw TypeError("JWE Key Management Parameters must be an object");Bn(t,r,n);let c={...t,...r,...n};Wn(w,t),xe(w,Ln,f,t,c),jn(c,t);let{alg:u,enc:l}=c;if(typeof u!=="string"||!u)throw new w('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(typeof l!=="string"||!l)throw new w('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');return[c,u,l,Ze(l)]}async function Ko(e,t,r){let[n,i,,o]=t,[s,a,f,c,u,l,p,d,,g]=e,h=a,S=f;if(l&&(i==="dir"||i==="ECDH-ES"))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${i}`);let E=de(i),y=await le(i==="dir"?o:E,r,"encrypt"),[T,I,O]=await $n(i,o,y,l,d);if(O){if(g)S=S?{...S,...O}:O;else h=h?{...h,...O}:O;Bn(h,S,c)}let j,q;if(h)j=K(JSON.stringify(h)),q=F(j);else j="",q=new Uint8Array;let V,N;if(u?.byteLength)N=K(u),V=B(q,F("."),F(N));else V=q;let ee=s;if(n.zip==="DEF")ee=await ol(ee).catch((Eh)=>{throw new w("Failed to compress plaintext",{cause:Eh})});let{ciphertext:ct,tag:Ds,iv:Fs}=await An(o,ee,T,p,V),Pe={ciphertext:K(ct)};if(Fs)Pe.iv=K(Fs);if(Ds)Pe.tag=K(Ds);if(I)Pe.encrypted_key=K(I);if(N)Pe.aad=N;if(h)Pe.protected=j;if(c)Pe.unprotected=c;if(S)Pe.header=S;return Pe}async function je(e,t,r){if(!e[1]&&!e[2]&&!e[3])throw new w("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(r!==void 0)e[8]=r?.crit,e[9]=r?Uf in r:!1;return Ko(e,Po(e),t)}var mr=x(()=>{oe();fr();Jn();k();ie();_t();Ye();It();Oo();Q()});class yl{#e;state;constructor(e,t,r){this.#e=e,this.state=[void 0,void 0,t,r]}setUnprotectedHeader(e){return P(this.state[0],"setUnprotectedHeader"),this.state[0]=e,this}setKeyManagementParameters(e){return P(this.state[1],"setKeyManagementParameters"),this.state[1]=e,this}addRecipient(...e){return this.#e.addRecipient(...e)}encrypt(...e){return this.#e.encrypt(...e)}done(){return this.#e}}function ml(e,t,r){let{aad:n,protected:i,unprotected:o,header:s}=e;if(n)t.aad=n;if(i)t.protected=i;if(o)t.unprotected=o;if(s)r.header=s}class No{#e;#t=[];#n;#o;#s;constructor(e){this.#e=e}addRecipient(e,t){let r=new yl(this,e,t?.crit);return this.#t.push(r),r}setProtectedHeader(e){return P(this.#n,"setProtectedHeader"),this.#n=e,this}setSharedUnprotectedHeader(e){return P(this.#o,"setSharedUnprotectedHeader"),this.#o=e,this}setAdditionalAuthenticatedData(e){return this.#s=e,this}async encrypt(){if(!this.#t.length)throw new w("at least one recipient must be added");if(se(this.#e,"plaintext"),this.#t.length===1){let[a,f,c,u]=this.#t[0].state,l=await je([this.#e,this.#n,a,this.#o,this.#s,void 0,void 0,f,u,!1],c),p={ciphertext:l.ciphertext,iv:l.iv,recipients:[{}],tag:l.tag};if(l.encrypted_key)p.recipients[0].encrypted_key=l.encrypted_key;return ml(l,p,p.recipients[0]),p}let e,t=this.#n,r=this.#o,n=[],i=[];for(let a=0;a<this.#t.length;a++){let f=this.#t[a],[c,u,,l]=f.state,p=[this.#e,t,c,r,this.#s,void 0,void 0,u,l,!0],d=Po(p);if(n.push(p),i.push(d),a===0)t=p[1],r=p[3];if(d[1]==="dir"||d[1]==="ECDH-ES")throw new w(`"${d[1]}" alg may only have a single recipient`);if(!e)e=d[2];else if(e!==d[2])throw new w('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}let o=Ee(i[0][3]),s={ciphertext:"",recipients:[]};for(let a=0;a<this.#t.length;a++){let f=this.#t[a],[,c,u]=f.state,l={};if(s.recipients.push(l),a===0){n[0][5]=o;let y=await Ko(n[0],i[0],u);s.ciphertext=y.ciphertext,s.iv=y.iv,s.tag=y.tag,l.encrypted_key=y.encrypted_key,ml(y,s,l);continue}let[,p,,d]=i[a],g=n[a][2],h=await le(de(p),u,"encrypt"),[,S,E]=await $n(p,d,h,o,c);if(l.encrypted_key=K(S),g||E){let y={...g,...E};if(E)Bn(n[a][1],y,n[a][3]);l.header=y}}return s}}var gl=x(()=>{Q();k();fr();Jn();oe();mr();Ye();It()});async function wl(e,t,r){if(t instanceof Uint8Array)return crypto.subtle.importKey("raw",t,e.subtle,!1,[r]);if(Te(t,e.subtle,r),e.minRsaBits)wn(e.alg,t);return t}async function El(e,t,r){let n=await wl(e,t,"sign"),i=await crypto.subtle.sign(e.signing,n,r);return new Uint8Array(i)}async function Sl(e,t,r,n){let i=await wl(e,t,"verify");try{return await crypto.subtle.verify(e.signing,i,r,n)}catch{return!1}}var $o=()=>{};function Jo(e){let t={name:"HMAC",hash:`SHA-${e}`};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:yr}}function kt(e,t){let n={name:t?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:`SHA-${e}`};return{kty:["RSA"],subtle:n,signing:t?{...n,saltLength:t}:n,usages:yr,minRsaBits:2048}}function Lo(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:`SHA-${t}`},usages:yr}}function bl(){let e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:yr}}function Wo(e){let r={name:`ML-DSA-${e}`};return{kty:["AKP"],subtle:r,signing:r,usages:yr}}function Pt(e){let t=typeof e==="string"?gr[e]:void 0;if(!t)throw new _(`alg ${e} is not supported either by JOSE or your javascript runtime`);return t}var yr,gr;var Kt=x(()=>{k();yr=[["verify"],["sign"]];gr=lr({HS256:Jo(256),HS384:Jo(384),HS512:Jo(512),RS256:kt(256),RS384:kt(384),RS512:kt(512),PS256:kt(256,32),PS384:kt(384,48),PS512:kt(512,64),ES256:Lo("P-256",256),ES384:Lo("P-384",384),ES512:Lo("P-521",512),EdDSA:bl(),Ed25519:bl(),"ML-DSA-44":Wo(44),"ML-DSA-65":Wo(65),"ML-DSA-87":Wo(87)})});function Mn(e,t){let{protected:r,header:n}=e,i=R(n)?{...n}:n,o=t?t[0]:e.payload;if(!t&&o instanceof Uint8Array)o=new Uint8Array(o);let s=e.signature,a={payload:o,signature:s};if(r!==void 0)a.protected=r;if(n!==void 0)a.header=i;return a}function Gn(e,t){let[r,n,,i,o]=t,s={payload:r};if(e.protected!==void 0)s.protectedHeader=n;if(e.header!==void 0)s.unprotectedHeader=e.header;if(o)return{...s,key:i};return s}function De(e){return[e&&pr("algorithms",e.algorithms),e?.crit]}function zn(e,t=e===void 0?{}:Ce(e,A,"JWS Protected Header is invalid")){return t}function vl(e,t,r){let n=Ot(e,xe(A,Rt,r[1],e,t)),i=t.alg;if(typeof i!=="string"||!i)throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(r[0]&&!r[0].has(i))throw new Ve('"alg" (Algorithm) Header Parameter value not allowed');return[n,i]}function kb(e,t,r,n){let i=zn(e,n),o;if(t!==void 0){if(!Le(i,t))throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");o={...i,...t}}else o=i;return[i,o,...vl(i,o,r)]}function Vn(e){let t=/[\p{Cs}\p{Cn}]/u.exec(e)?.[0];if(t!==void 0)throw new A(/\p{Cs}/u.test(t)?"JWS Payload must be a well-formed Unicode string":"JWS Payload must not contain unassigned Unicode code points");return Et.encode(e)}function Pb(e){try{return F(e)}catch{throw new A("JWS Compact Serialization payload must use only ASCII characters")}}async function Al(e,t,r,n,i,o,s){let a=!1;if(typeof r==="function")r=await r(i,e),a=!0;let f=typeof s==="string",c=Pt(o),u=B(n!==void 0?F(n):new Uint8Array,F("."),f?t[2]??=On(s,"payload",A):s),l=M(e.signature,"signature",A),p=await le(c,r,"verify");if(!await Sl(c,p,l,u))throw new Xe;return[f?M(s,"payload",A):s,i,f,p,a]}async function Xn(e,t,r,n,i){let{protected:o,header:s,payload:a}=e,[f,,c,u]=kb(o,s,t,i);if(c){if(typeof a!=="string")throw new A("JWS Payload must be a string")}else if(typeof a!=="string"&&!(a instanceof Uint8Array))throw new A("JWS Payload must be a string or an Uint8Array instance");let l=c||typeof a!=="string"?a:n(a);return Al(e,t,r,o,f,u,l)}async function Yn(e,t,r){if(e instanceof Uint8Array)e=ze.decode(e);if(typeof e!=="string")throw new A("Compact JWS must be a string or Uint8Array");let{0:n,1:i,2:o,length:s}=e.split(".");if(s!==3)throw new A("Invalid Compact JWS");let a={payload:i,protected:n,signature:o},f=zn(n),[c,u]=vl(f,f,t),l=c?i:Pb(i);return Al(a,t,r,n,f,u,l)}var wr=x(()=>{$o();Kt();k();ie();Q();_t();Ye()});async function xl(e,t,r){let n=await Yn(e,De(r),t),i={payload:n[0],protectedHeader:n[1]};if(typeof t==="function")return{...i,key:n[3]};return i}var Tl=x(()=>{wr()});async function Cl(e,t,r){if(!R(e))throw new A("Flattened JWS must be an object");let n=Mn(e);if(n.protected===void 0&&n.header===void 0)throw new A('Flattened JWS must have either of the "protected" or "header" members');if(n.protected!==void 0&&typeof n.protected!=="string")throw new A("JWS Protected Header incorrect type");if(n.payload===void 0)throw new A("JWS Payload missing");if(typeof n.signature!=="string")throw new A("JWS Signature missing or incorrect type");if(n.header!==void 0&&!R(n.header))throw new A("JWS Unprotected Header incorrect type");return Gn(n,await Xn(n,De(r),t,Vn))}var Il=x(()=>{k();wr()});function Kb(e,t){try{let r=Mn(e,[t]),{protected:n,header:i,signature:o}=r;if(n===void 0&&i===void 0)return;if(n!==void 0&&typeof n!=="string")return;if(typeof o!=="string")return;if(i!==void 0&&!R(i))return;let s=zn(n),{b64:a,crit:f}=s;return[r,s,Array.isArray(f)&&f.includes("b64")?typeof a==="boolean"?a?1:2:0:1]}catch{return}}async function Rl(e,t,r){if(!R(e))throw new A("General JWS must be an object");let{signatures:n,payload:i}=e;if(!Array.isArray(n))throw new A("JWS Signatures missing or incorrect type");let o=Array.from(n);if(!o.every(R))throw new A("JWS Signatures missing or incorrect type");let s;try{if(i===void 0)throw Error();s=De(r)}catch{throw new Xe}let a=i instanceof Uint8Array?new Uint8Array(i):i,f=o.map((u)=>Kb(u,a)).filter((u)=>u!==void 0),c=0;for(let[,,u]of f)if(c|=u,c===3)throw new A("inconsistent use of JWS Unencoded Payload (RFC7797)");for(let u of f)try{return Gn(u[0],await Xn(u[0],s,t,Vn,u[1]))}catch{}throw new Xe}var Ol=x(()=>{wr();k()});function jo(){throw TypeError("Invalid time period format")}function Zn(e){if(typeof e!=="string")jo();let t=$b.exec(e);if(!t||t[4]&&t[1])jo();let r=parseFloat(t[2]),n=Math.round(r*Nb[t[3][0].toLowerCase()]);if(!Number.isFinite(n))jo();if(t[1]==="-"||t[4]==="ago")return-n;return n}function $t(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}function Do(e,t){if(typeof t!=="string")throw TypeError(`"${e}" claim must be a string`)}function Jb(e){if(typeof e!=="string"&&(!Array.isArray(e)||Array.from(e).some((t)=>typeof t!=="string")))throw TypeError('"aud" claim must be a string or an array of strings')}function Fo(e,t){if(typeof e==="number")return $t(t,e);if(e instanceof Date)return $t(t,Er(e));return Er(new Date)+Zn(e)}function qo(e,t,r=!1){let n=e[t];if(n===void 0&&!r)return;if(typeof n!=="number")throw new ge(`"${t}" claim must be a number`,e,t,"invalid");return n}function Uo(e,t){throw new ge(`unexpected "${t}" claim value`,e,t,Nt)}function Jt(e,t,r={}){let n;try{n=JSON.parse(St.decode(t))}catch{}if(!R(n))throw new U("JWT Claims Set must be a top-level JSON object");let{typ:i}=r;if(i!==void 0&&(typeof e.typ!=="string"||_l(e.typ)!==_l(i)))throw new ge('unexpected "typ" JWT header value',n,"typ",Nt);let{requiredClaims:o=[],issuer:s,subject:a,audience:f,maxTokenAge:c}=r,u=[...o];if(c!==void 0)u.push("iat");if(f!==void 0)u.push("aud");if(a!==void 0)u.push("sub");if(s!==void 0)u.push("iss");for(let y of new Set(u.reverse()))if(!Object.hasOwn(n,y))throw new ge(`missing required "${y}" claim`,n,y,"missing");if(s!==void 0&&!(Array.isArray(s)?s:[s]).includes(n.iss))Uo(n,"iss");if(a!==void 0&&n.sub!==a)Uo(n,"sub");if(f!==void 0&&!Lb(n.aud,typeof f==="string"?[f]:f))Uo(n,"aud");let{clockTolerance:l}=r,p=0;if(typeof l==="string")p=Zn(l);else if(l!==void 0){if(typeof l!=="number")throw TypeError("Invalid clockTolerance option type");p=l}$t("clockTolerance option",p);let{currentDate:d}=r,g=$t("currentDate option",Er(d===void 0?new Date:d)),h=qo(n,"iat",c!==void 0),S=qo(n,"nbf");if(S!==void 0){if(S>g+p)throw new ge('"nbf" claim timestamp check failed',n,"nbf",Nt)}let E=qo(n,"exp");if(E!==void 0){if(E<=g-p)throw new sr('"exp" claim timestamp check failed',n,"exp",Nt)}if(c!==void 0){let y=g-h,T=$t("maxTokenAge option",typeof c==="number"?c:Zn(c));if(y-p>T)throw new sr('"iat" claim timestamp check failed (too far in the past)',n,"iat",Nt);if(y<-p)throw new ge('"iat" claim timestamp check failed (it should be in the past)',n,"iat",Nt)}return n}function Ie(e){return kl.get(e)}function Lt(e){let t=Ie(e);for(let r of["iat","nbf","exp"]){let n=t[r];if(typeof n==="number"&&!Number.isFinite(n))throw TypeError(`"${r}" claim must be a finite number`)}return Et.encode(JSON.stringify(t))}function Qn(e,t){return Ie(e)[t]}class et{constructor(e={}){if(!R(e))throw TypeError("JWT Claims Set MUST be an object");(kl||=new WeakMap).set(this,structuredClone(e))}setIssuer(e){return Do("iss",e),Ie(this).iss=e,this}setSubject(e){return Do("sub",e),Ie(this).sub=e,this}setAudience(e){return Jb(e),Ie(this).aud=e,this}setJti(e){return Do("jti",e),Ie(this).jti=e,this}setNotBefore(e){return Ie(this).nbf=Fo(e,"setNotBefore"),this}setExpirationTime(e){return Ie(this).exp=Fo(e,"setExpirationTime"),this}setIssuedAt(e){let t=Ie(this);if(e===void 0)t.iat=Er(new Date);else if(typeof e==="string")t.iat=$t("setIssuedAt",Er(new Date)+Zn(e));else t.iat=Fo(e,"setIssuedAt");return this}}var Er=(e)=>Math.floor(e.getTime()/1000),Nb,$b,Nt="check_failed",_l=(e)=>{let t=e.toLowerCase();return e.includes("/")?t:`application/${t}`},Lb=(e,t)=>{if(typeof e==="string")return t.includes(e);if(Array.isArray(e))return t.some((r)=>e.includes(r));return!1},kl;var Wt=x(()=>{k();ie();Nb={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},$b=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i});async function Pl(e,t,r){let n=await Yn(e,De(r),t);if(!n[2])throw new U("JWTs MUST NOT use unencoded payload");let o={payload:Jt(n[1],n[0],r),protectedHeader:n[1]};if(typeof t==="function")return{...o,key:n[3]};return o}var Kl=x(()=>{wr();Wt();k()});async function Nl(e,t,r){let n=await Hn(e,We(r),t),i=n[1],o=Jt(i,n[0],r);for(let a of["iss","sub","aud"])if(i[a]!==void 0&&(a==="aud"?JSON.stringify(i.aud)!==JSON.stringify(o.aud):i[a]!==o[a]))throw new ge(`replicated "${a}" claim header parameter mismatch`,o,a,"mismatch");let s={payload:o,protectedHeader:i};if(typeof t==="function")return{...s,key:n[2]};return s}var $l=x(()=>{hr();Wt();k()});class Ho{#e;#t;#n;#o;#s;constructor(e){se(e,"plaintext"),this.#e=e}setContentEncryptionKey(e){return P(this.#n,"setContentEncryptionKey"),this.#n=e,this}setInitializationVector(e){return P(this.#o,"setInitializationVector"),this.#o=e,this}setProtectedHeader(e){return P(this.#t,"setProtectedHeader"),this.#t=e,this}setKeyManagementParameters(e){return P(this.#s,"setKeyManagementParameters"),this.#s=e,this}async encrypt(e,t){let r=await je([this.#e,this.#t,void 0,void 0,void 0,this.#n,this.#o,this.#s,void 0,!1],e,t);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")}}var Jl=x(()=>{Q();mr()});class Bo{#e;#t;#n;#o;#s;#y;#g;#p;constructor(e){se(e,"plaintext"),this.#e=e}setKeyManagementParameters(e){return P(this.#p,"setKeyManagementParameters"),this.#p=e,this}setProtectedHeader(e){return P(this.#t,"setProtectedHeader"),this.#t=e,this}setSharedUnprotectedHeader(e){return P(this.#n,"setSharedUnprotectedHeader"),this.#n=e,this}setUnprotectedHeader(e){return P(this.#o,"setUnprotectedHeader"),this.#o=e,this}setAdditionalAuthenticatedData(e){return this.#s=e,this}setContentEncryptionKey(e){return P(this.#y,"setContentEncryptionKey"),this.#y=e,this}setInitializationVector(e){return P(this.#g,"setInitializationVector"),this.#g=e,this}async encrypt(e,t){return je([this.#e,this.#t,this.#o,this.#n,this.#s,this.#y,this.#g,this.#p,void 0,!1],e,t)}}var Ll=x(()=>{Q();mr()});function Wl(e){if(e===void 0)return[void 0,""];let t=Qe(A,e);return[t[0],K(t[1])]}function jl(e,t,r){return Wn(A,e),Ot(e,xe(A,Rt,r,e,t))}function Dl(e){let t=e.alg;if(typeof t!=="string"||!t)throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');return Pt(t)}async function Fl(e,t,r,n){let i=B(F(e),F("."),t),o=await le(r,n,"sign");return K(await El(r,o,i))}async function ei(e,t,r){let{protectedHeader:n,unprotectedHeader:i}=e,o;if([n,o]=Wl(n),i!==void 0)i=Qe(A,i)[0];if(!n&&!i)throw new A("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Le(n,i))throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let s={...n,...i},a=jl(n,s,e.crit);r?.(a);let f=Dl(s),c,u;if(a){let p=e.encoded??=[];p[0]??=K(e.payload),p[1]??=F(p[0]),c=p[0],u=p[1]}else u=e.payload,c="";let l={signature:await Fl(o,u,f,t),payload:c};if(n)l.protected=o;if(i)l.header=i;return[l,a]}async function ti(e,t,r,n,i){let[o,s]=Wl(t);if(!o)throw new A("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!jl(o,o,r))i();let f=Dl(o),c=K(e),u=await Fl(s,F(c),f,n);return`${s}.${c}.${u}`}var Sr=x(()=>{oe();$o();Kt();k();ie();_t();Ye()});class Mo{#e;#t;constructor(e){if(!(e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#e=e}setProtectedHeader(e){return P(this.#t,"setProtectedHeader"),this.#t=e,this}async sign(e,t){return ti(this.#e,this.#t,t?.crit,e,()=>{throw TypeError("use the flattened module for creating JWS with b64: false")})}}var ql=x(()=>{Sr();Q()});class Go{#e;#t;#n;constructor(e){if(!(e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#e=e}setProtectedHeader(e){return P(this.#t,"setProtectedHeader"),this.#t=e,this}setUnprotectedHeader(e){return P(this.#n,"setUnprotectedHeader"),this.#n=e,this}async sign(e,t){let[r]=await ei({payload:this.#e,protectedHeader:this.#t,unprotectedHeader:this.#n,crit:t?.crit},e);return r}}var Ul=x(()=>{Sr();Q()});class Hl{#e;state;constructor(e,t,r){this.#e=e,this.state=[void 0,void 0,t,r?.crit]}setProtectedHeader(e){return P(this.state[0],"setProtectedHeader"),this.state[0]=e,this}setUnprotectedHeader(e){return P(this.state[1],"setUnprotectedHeader"),this.state[1]=e,this}addSignature(...e){return this.#e.addSignature(...e)}sign(...e){return this.#e.sign(...e)}done(){return this.#e}}class zo{#e;#t=[];constructor(e){this.#e=e}addSignature(e,t){let r=new Hl(this,e,t);return this.#t.push(r),r}async sign(){if(!this.#t.length)throw new A("at least one signature must be added");if(!(this.#e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");let e={signatures:[],payload:""},t=[],r;for(let n=0;n<this.#t.length;n++){let i=this.#t[n],[o,s,a,f]=i.state,[{payload:c,...u},l]=await ei({payload:this.#e,protectedHeader:o,unprotectedHeader:s,crit:f,encoded:t},a);if(r===void 0)r=l,e.payload=c;else if(r!==l)throw new A("inconsistent use of JWS Unencoded Payload (RFC7797)");e.signatures.push(u)}return e}}var Bl=x(()=>{Sr();k();Q()});var Wb,Vo;var Ml=x(()=>{Sr();k();Wt();Q();Wb=et;Vo=class Vo extends Wb{#e;setProtectedHeader(e){return P(this.#e,"setProtectedHeader"),this.#e=e,this}async sign(e,t){return ti(Lt(this),this.#e,t?.crit,e,()=>{throw new U("JWTs MUST NOT use unencoded payload")})}}});var jb,Xo;var Gl=x(()=>{mr();Wt();Q();jb=et;Xo=class Xo extends jb{#e;#t;#n;#o;#s;#y;#g;setProtectedHeader(e){return P(this.#o,"setProtectedHeader"),this.#o=e,this}setKeyManagementParameters(e){return P(this.#n,"setKeyManagementParameters"),this.#n=e,this}setContentEncryptionKey(e){return P(this.#e,"setContentEncryptionKey"),this.#e=e,this}setInitializationVector(e){return P(this.#t,"setInitializationVector"),this.#t=e,this}replicateIssuerAsHeader(){return this.#s=!0,this}replicateSubjectAsHeader(){return this.#y=!0,this}replicateAudienceAsHeader(){return this.#g=!0,this}async encrypt(e,t){let r=Lt(this);if(this.#o&&(this.#s||this.#y||this.#g))this.#o={...this.#o,iss:this.#s?Qn(this,"iss"):void 0,sub:this.#y?Qn(this,"sub"):void 0,aud:this.#g?Qn(this,"aud"):void 0};let n=await je([r,this.#o,void 0,void 0,void 0,this.#e,this.#t,this.#n,void 0,!1],e,t);return[n.protected,n.encrypted_key,n.iv,n.ciphertext,n.tag].join(".")}}});function tt(e='JWK "alg" (Algorithm) Parameter'){throw new _(`Invalid or unsupported ${e} value`)}function rt(e,t){return(typeof e==="string"?gr[e]??To[e]:void 0)??tt(t)}var Fe='"alg" (Algorithm)';var br=x(()=>{k();Kt();It()});function qe(e){if(e!==void 0&&typeof e!=="boolean")throw TypeError('"extractable" option must be a boolean');return e}function qb(e,t){if(Ue(e,48,`Invalid ${t==="spki"?"SPKI":"PKCS#8"} structure`),Re(e),t==="pkcs8"){Ue(e,2,"Expected version field");let r=Re(e);e.pos+=r}Ue(e,48,"Expected algorithm identifier"),Re(e)}function Hb(e){let t=Zl(e);Ue(t,48,"Invalid certificate structure");let r=Re(t);if(r<0||t.pos+r>t.data.length)throw Error("Unexpected end of ASN.1 input");if(Ue(t,48,"Invalid tbsCertificate structure"),Re(t),e[t.pos]===160)zl(t,6);else zl(t,5);let n=t.pos;Ue(t,48,"Invalid SPKI structure");let i=Re(t);return e.subarray(n,n+i+(t.pos-n))}var Db=(e,t)=>{let r=(e.match(/.{1,64}/g)||[]).join(`
5
+ `+o),e.push(i+"m+"+mn.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=fb()+t+" "+e[0]}function fb(){if(X.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function lb(...e){return process.stderr.write(hn.formatWithOptions(X.inspectOpts,...e)+`
6
+ `)}function db(e){if(e)process.env.DEBUG=e;else delete process.env.DEBUG}function pb(){return process.env.DEBUG}function hb(e){e.inspectOpts={};let t=Object.keys(X.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=X.inspectOpts[t[r]]}mn.exports=po()(X);var{formatters:Lf}=mn.exports;Lf.o=function(e){return this.inspectOpts.colors=this.useColors,hn.inspect(e,this.inspectOpts).split(`
7
+ `).map((t)=>t.trim()).join(" ")};Lf.O=function(e){return this.inspectOpts.colors=this.useColors,hn.inspect(e,this.inspectOpts)}});var yn=m(function(ET,yo){if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)yo.exports=Pf();else yo.exports=Jf()});function B(...e){let t=e.reduce((i,{length:o})=>i+o,0),r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}function go(e,t,r){if(t<0||t>=4294967296)throw RangeError(`value must be >= 0 and <= 4294967295. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,t&255],r)}function wo(e){let t=Math.floor(e/4294967296),r=e%4294967296,n=new Uint8Array(8);return go(n,t,0),go(n,r,4),n}function gn(e){let t=new Uint8Array(4);return go(t,e),t}function F(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>127)throw TypeError("non-ASCII string encountered in encode()");t[r]=n}return t}var St,ze,bt;var ie=x(()=>{St=new TextEncoder,ze=new TextDecoder,bt=new TextDecoder("utf-8",{fatal:!0})});function Eo(e,t){if(t&&!e.usages.includes(t))throw TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function En(e,t){let{modulusLength:r}=t.algorithm;if(typeof r!=="number"||r<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}function Te(e,t,r){let n=e.algorithm;if(n.name!==t.name)throw wn(t.name);if(t.hash&&n.hash?.name!==t.hash)throw wn(t.hash,"algorithm.hash");if(t.namedCurve&&n.namedCurve!==t.namedCurve)throw wn(t.namedCurve,"algorithm.namedCurve");if(t.length!==void 0&&n.length!==t.length)throw wn(t.length,"algorithm.length");Eo(e,r)}var wn=(e,t="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);function Wf(e,t,...r){if(r.length>2){let n=r.pop();e+=`one of type ${r.join(", ")}, or ${n}.`}else if(r.length===2)e+=`one of type ${r[0]} or ${r[1]}.`;else e+=`of type ${r[0]}.`;if(t==null)e+=` Received ${t}`;else if(typeof t==="function"&&t.name)e+=` Received function ${t.name}`;else if(typeof t==="object"&&t!=null){if(t.constructor?.name)e+=` Received an instance of ${t.constructor.name}`}return e}var ye=(e,...t)=>Wf("Key must be ",e,...t),sr=(e,t,...r)=>Wf(`Key for the ${e} algorithm must be `,t,...r);var So={};Vt(So,{JOSEAlgNotAllowed:()=>Ve,JOSEError:()=>z,JOSENotSupported:()=>_,JWEDecryptionFailed:()=>Le,JWEInvalid:()=>w,JWKInvalid:()=>cr,JWKSInvalid:()=>ur,JWKSMultipleMatchingKeys:()=>Sn,JWKSNoMatchingKey:()=>vt,JWKSTimeout:()=>bn,JWSInvalid:()=>A,JWSSignatureVerificationFailed:()=>Xe,JWTClaimValidationFailed:()=>ge,JWTExpired:()=>ar,JWTInvalid:()=>U});var z,ge,ar,Ve,_,Le,w,A,U,cr,ur,vt,Sn,bn,Xe;var k=x(()=>{z=class z extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,t){super(e,t);this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};ge=class ge extends z{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}});this.claim=r,this.reason=n,this.payload=t}};ar=class ar extends z{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}});this.claim=r,this.reason=n,this.payload=t}};Ve=class Ve extends z{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"};_=class _ extends z{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"};Le=class Le extends z{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(e="decryption operation failed",t){super(e,t)}};w=class w extends z{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"};A=class A extends z{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"};U=class U extends z{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"};cr=class cr extends z{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"};ur=class ur extends z{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"};vt=class vt extends z{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(e="no applicable key found in the JSON Web Key Set",t){super(e,t)}};Sn=class Sn extends z{[Symbol.asyncIterator]=async function*(){};static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t)}};bn=class bn extends z{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(e="request timed out",t){super(e,t)}};Xe=class Xe extends z{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",t){super(e,t)}}});function vn(e){if(!we(e))throw Error("CryptoKey instance expected")}var we=(e)=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch{return!1}},fr=(e)=>e?.[Symbol.toStringTag]==="KeyObject",An=(e)=>we(e)||fr(e);function jf(e,t){let r=e.byteLength<<3;if(r!==t)throw new w(`Invalid Content Encryption Key length. Expected ${t} bits, got ${r} bits`)}function Df(e,t){if(t.length<<3!==e.ivBits)throw new w("Invalid Initialization Vector length")}async function Ff(e,t,r){if(!(t instanceof Uint8Array))throw TypeError(ye(t,"Uint8Array"));let n=e.cekBits>>1,i=await crypto.subtle.importKey("raw",t.subarray(n>>3),"AES-CBC",!1,[r]),o=await crypto.subtle.importKey("raw",t.subarray(0,n>>3),{hash:`SHA-${n<<1}`,name:"HMAC"},!1,["sign"]);return[i,o,n]}async function qf(e,t,r){return new Uint8Array((await crypto.subtle.sign("HMAC",e,t)).slice(0,r>>3))}async function yb(e,t,r,n,i){let[o,s,a]=await Ff(e,r,"encrypt"),f=new Uint8Array(await crypto.subtle.encrypt({iv:n,name:"AES-CBC"},o,t)),c=B(i,n,f,wo(i.length*8)),u=await qf(s,c,a);return{ciphertext:f,tag:u,iv:n}}async function gb(e,t){let r={name:"HMAC",hash:"SHA-256"},n=await crypto.subtle.generateKey(r,!1,["sign","verify"]),i=await crypto.subtle.sign(r,n,e);return crypto.subtle.verify(r,n,i,t)}async function wb(e,t,r,n,i,o){let[s,a,f]=await Ff(e,t,"decrypt"),c=B(o,n,r,wo(o.length*8)),u=await qf(a,c,f);try{if(await gb(i,u))return new Uint8Array(await crypto.subtle.decrypt({iv:n,name:"AES-CBC"},s,r))}catch{}throw new Le}async function Eb(e,t,r,n,i){let o=r instanceof Uint8Array?await crypto.subtle.importKey("raw",r,"AES-GCM",!1,["encrypt"]):(Te(r,e.subtle,"encrypt"),r),s=new Uint8Array(await crypto.subtle.encrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},o,t)),a=s.slice(-16);return{ciphertext:s.slice(0,-16),tag:a,iv:n}}async function Sb(e,t,r,n,i,o){let s=t instanceof Uint8Array?await crypto.subtle.importKey("raw",t,"AES-GCM",!1,["decrypt"]):(Te(t,e.subtle,"decrypt"),t);try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:o,iv:n,name:"AES-GCM",tagLength:128},s,B(r,i)))}catch{throw new Le}}async function xn(e,t,r,n,i){if(!we(r)&&!(r instanceof Uint8Array))throw TypeError(ye(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(n)Df(e,n);else n=mb(e);if(r instanceof Uint8Array)jf(r,e.cekBits);return e.cbc?yb(e,t,r,n,i):Eb(e,t,r,n,i)}async function Tn(e,t,r,n,i,o){if(!we(t)&&!(t instanceof Uint8Array))throw TypeError(ye(t,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!n)throw new w("JWE Initialization Vector missing");if(!i)throw new w("JWE Authentication Tag missing");if(!e.cbc&&i.length!==16)throw new w("Invalid Authentication Tag length");if(Df(e,n),t instanceof Uint8Array)jf(t,e.cekBits);return e.cbc?wb(e,t,r,n,i,o):Sb(e,t,r,n,i,o)}var Ee=(e)=>crypto.getRandomValues(new Uint8Array(e.cekBits>>3)),mb=(e)=>crypto.getRandomValues(new Uint8Array(e.ivBits>>3));var lr=x(()=>{ie();k()});function Cn(e){if(Uint8Array.prototype.toBase64)return e.toBase64();let t=32768,r=[];for(let n=0;n<e.length;n+=t)r.push(String.fromCharCode.apply(null,e.subarray(n,n+t)));return btoa(r.join(""))}function In(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}var Rn={};Vt(Rn,{decode:()=>Ae,encode:()=>K});function Ae(e){if(Uint8Array.fromBase64)try{return Uint8Array.fromBase64(typeof e==="string"?e:ze.decode(e),{alphabet:"base64url"})}catch(r){throw TypeError(bo,{cause:r})}let t=e;if(t instanceof Uint8Array)t=ze.decode(t);if(t.includes("+")||t.includes("/"))throw TypeError(bo);t=t.replace(/-/g,"+").replace(/_/g,"/");try{return In(t)}catch{throw TypeError(bo)}}function K(e){let t=e;if(typeof t==="string")t=St.encode(t);if(Uint8Array.prototype.toBase64)return t.toBase64({alphabet:"base64url",omitPadding:!0});return Cn(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var bo="The input to be decoded is not correctly encoded.";var oe=x(()=>{ie()});function se(e,t){if(!(e instanceof Uint8Array))throw TypeError(`${t} must be an instance of Uint8Array`)}function R(e){if(typeof e!=="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function On(e){return R(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(R)}function Je(...e){let t=new Set;for(let r of e){if(!r)continue;for(let n of Object.keys(r)){if(t.has(n))return!1;t.add(n)}}return!0}function P(e,t){if(e!==void 0)throw TypeError(`${t} can only be called once`)}function M(e,t,r){try{return Ae(e)}catch{throw new r(`Failed to base64url decode the ${t}`)}}function _n(e,t,r){try{return F(e)}catch{throw new r(`The ${t} is not a valid base64url string`)}}async function kn(e,t){let r=`SHA-${e.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(r,t))}function Ce(e,t,r){let n;try{n=JSON.parse(bt.decode(Ae(e)))}catch{throw new t(r)}if(!R(n))throw new t(r);return n}var Uf;var Q=x(()=>{oe();ie();Uf=Symbol()});async function Se(e,t){if(t.kty==="RSA"&&"oth"in t&&t.oth!==void 0)throw new _('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');if(!e.kty.includes(t.kty))throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');let r=e.resolve?.({kty:t.kty,crv:t.crv})??e.subtle,n=!!(t.d||t.priv),i={...t};if(i.kty!=="AKP")delete i.alg;return delete i.use,crypto.subtle.importKey("jwk",i,r,t.ext??!n,t.key_ops??e.usages[n?1:0])}var At=x(()=>{k()});function xt(e){return{__proto__:null,...e}}function Tt(e){let t=xt(e);if(t.ext!==void 0&&typeof t.ext!=="boolean")throw TypeError('"ext" (Extractable) Parameter must be a boolean');if(t.key_ops!==void 0){let r=t.key_ops,n=Array.isArray(r)?[...r]:void 0;if(!n||n.some((i)=>typeof i!=="string")||new Set(n).size!==n.length)throw TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');t.key_ops=n}return t}function vb(e,t,r){let{alg:n,secret:i}=e,o=r==="decrypt"||r==="sign";if(i&&t instanceof Uint8Array)return[Bf,t];if(R(t)){let s=Tt(t);if(typeof s.kty!=="string")throw TypeError(i?sr(n,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):sr(n,t,"CryptoKey","KeyObject","JSON Web Key"));if(!(i?s.kty==="oct"&&typeof s.k==="string":s.kty!=="oct"&&(o?s.kty==="AKP"&&typeof s.priv==="string"||typeof s.d==="string":s.d===void 0&&s.priv===void 0)))throw TypeError(i?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':`JSON Web Key for this operation must be a ${o?"private":"public"} JWK`);return bb(e,s,r),[zf,t,s]}if(!An(t))throw TypeError(i?sr(n,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):sr(n,t,"CryptoKey","KeyObject","JSON Web Key"));if(i){if(t.type!=="secret")throw TypeError(`${vo(t)} instances for symmetric algorithms must be of type "secret"`)}else{if(t.type==="secret")throw TypeError(`${vo(t)} instances for asymmetric algorithms must not be of type "secret"`);let s=o?"private":"public";if((t.type==="public"||t.type==="private")&&t.type!==s){let a=r==="sign"?"signing":r==="verify"?"verifying":`${r.slice(0,-1)}tion`;throw TypeError(`${vo(t)} instances for asymmetric algorithm ${a} must be of type "${s}"`)}}return we(t)?[Mf,t]:[Gf,t]}function Pn(e,t,r){Ao||=new WeakMap;let n=Ao.get(e);if(r)if(n)n[t]=r;else Ao.set(e,{[t]:r});return r??n?.[t]}async function le(e,t,r){let n=vb(e,t,r);switch(n[0]){case Bf:case Mf:return n[1];case zf:{let i=n[1],o=n[2];if(o.kty==="oct")return Ae(o.k);if(!Object.isFrozen(i)){let{key_ops:s}=i;if(Array.isArray(s))Object.freeze(s);Object.freeze(i)}return Hf(i,o,e)}case Gf:{let i=n[1];if(i.type==="secret")return i.export();if("toCryptoKey"in i&&typeof i.toCryptoKey==="function")return xb(i,e);return Hf(i,i.export({format:"jwk"}),e)}}}var vo=(e)=>e[Symbol.toStringTag],bb=(e,t,r)=>{let{alg:n}=e;if(t.use!==void 0){let i=r==="sign"||r==="verify"?"sig":"enc";if(t.use!==i)throw TypeError(`Invalid key for this operation, its "use" must be "${i}" when present`)}if(t.alg!==void 0&&t.alg!==n)throw TypeError(`Invalid key for this operation, its "alg" must be "${n}" when present`);if(Array.isArray(t.key_ops)){let i=r==="encrypt"||r==="decrypt"?e.ops?.[r==="encrypt"?0:1]:r;if(i&&!t.key_ops.includes(i))throw TypeError(`Invalid key for this operation, its "key_ops" must include "${i}" when present`)}},Bf=0,Mf=1,Gf=2,zf=3,Ao,Ab,Hf=async(e,t,r)=>Pn(e,r.alg)??Pn(e,r.alg,await Se(r,{...t,alg:r.alg})),xb=(e,t)=>{let r=Pn(e,t.alg);if(r)return r;let n=e.type==="public",i=t.usages[n?0:1],{asymmetricKeyType:o}=e,s=Ab[e.asymmetricKeyDetails?.namedCurve],a=t.resolve?.({crv:s,asymmetricKeyType:o})??t.subtle;return Pn(e,t.alg,e.toCryptoKey(a,n,i))};var Ye=x(()=>{oe();At();Ab={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"}});function dr(e){let t={__proto__:null};for(let r in e)t[r]={...e[r],alg:r};return t}function Kn(e){return{kty:["RSA"],subtle:{name:"RSA-OAEP",hash:`SHA-${e}`},usages:Tb,ops:["wrapKey","unwrapKey"]}}function Nn(){return{kty:["EC","OKP"],subtle:{name:"ECDH"},resolve:({kty:e,crv:t,asymmetricKeyType:r})=>{if(t==="X25519"||r==="x25519")return{name:"X25519"};if(e==="OKP")throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:t}},usages:Cb,ops:[void 0,"deriveBits"]}}function Ct(e,t=!1){return{kty:["oct"],secret:!0,subtle:{name:t?"AES-GCM":"AES-KW",length:e},usages:$n,ops:t?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function xo(){return{kty:["oct"],secret:!0,subtle:{name:"PBKDF2"},usages:$n,ops:["deriveBits","deriveBits"]}}function It(e,t=!1){return{kty:["oct"],secret:!0,subtle:{name:t?"AES-CBC":"AES-GCM",length:e},usages:$n,ops:Ib,cekBits:e,ivBits:t?128:96,cbc:t}}function Vf(e,t){throw new _(`Invalid or unsupported "${e}" (JWE ${t}) header value`)}function de(e){return(typeof e==="string"?To[e]:void 0)??Vf("alg","Algorithm")}function Ze(e){return(typeof e==="string"?Rb[e]:void 0)??Vf("enc","Encryption Algorithm")}var Tb,Cb,$n,To,Ib,Rb;var Rt=x(()=>{k();Tb=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],Cb=[[],["deriveBits"]],$n=[[],[]];To=dr({dir:{kty:["oct"],secret:!0,subtle:{name:"AES-GCM"},usages:$n,ops:["encrypt","decrypt"]},"RSA-OAEP":Kn(1),"RSA-OAEP-256":Kn(256),"RSA-OAEP-384":Kn(384),"RSA-OAEP-512":Kn(512),"ECDH-ES":Nn(),"ECDH-ES+A128KW":Nn(),"ECDH-ES+A192KW":Nn(),"ECDH-ES+A256KW":Nn(),A128KW:Ct(128),A192KW:Ct(192),A256KW:Ct(256),A128GCMKW:Ct(128,!0),A192GCMKW:Ct(192,!0),A256GCMKW:Ct(256,!0),"PBES2-HS256+A128KW":xo(),"PBES2-HS384+A192KW":xo(),"PBES2-HS512+A256KW":xo()}),Ib=["encrypt","decrypt"];Rb=dr({A128GCM:It(128),A192GCM:It(192),A256GCM:It(256),"A128CBC-HS256":It(256,!0),"A192CBC-HS384":It(384,!0),"A256CBC-HS512":It(512,!0)})});function Xf(e,t){if(e.algorithm.name!=="ECDH"&&e.algorithm.name!=="X25519")throw TypeError("CryptoKey does not support this operation, its algorithm.name must be ECDH or X25519");Eo(e,t)}async function Zf(e,t,r){let n=de(t).subtle,i=e instanceof Uint8Array?await crypto.subtle.importKey("raw",e,"AES-KW",!0,[r]):e;return Te(i,n,r),i}async function Co(e,t,r){let n=await Zf(t,e,"wrapKey"),i=await crypto.subtle.importKey("raw",r,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",i,n,"AES-KW"))}async function Io(e,t,r){let n=await Zf(t,e,"unwrapKey"),i=await crypto.subtle.unwrapKey("raw",r,n,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",i))}function Qf(e,t,r){Te(t,de(e).subtle,r),En(e,t)}function Ob(e,t){if(e instanceof Uint8Array)return crypto.subtle.importKey("raw",e,"PBKDF2",!1,["deriveBits"]);return Te(e,de(t).subtle,"deriveBits"),e}async function el(e,t,r,n){if(!(e instanceof Uint8Array)||e.length<8)throw new w("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(r)||Math.sign(r)!==1)throw new w("PBES2 Count Input must be a positive integer");let i=B(F(t),Uint8Array.of(0),e),o=parseInt(t.slice(13,16),10),s={hash:`SHA-${t.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:i},a=await Ob(n,t);return new Uint8Array(await crypto.subtle.deriveBits(s,a,o))}function Ro(e){return B(gn(e.length),e)}async function _b(e,t,r){let n=t>>3,i=32,o=Math.ceil(n/32),s=new Uint8Array(o*32);for(let a=1;a<=o;a++){let f=await kn("sha256",B(gn(a),e,r));s.set(f,(a-1)*32)}return s.slice(0,n)}async function tl(e,t,r,n,i=new Uint8Array,o=new Uint8Array){Xf(e),Xf(t,"deriveBits");let s=B(Ro(F(r)),Ro(i),Ro(o),gn(n)),a=new Uint8Array(await crypto.subtle.deriveBits({name:e.algorithm.name,public:e},t,e.algorithm.name==="X25519"?256:Math.ceil(parseInt(e.algorithm.namedCurve.slice(-3),10)/8)<<3));return _b(a,n,s)}function rl(e){vn(e);let t=e.algorithm.namedCurve;if(t!=="P-256"&&t!=="P-384"&&t!=="P-521"&&e.algorithm.name!=="X25519")throw new _("ECDH with the provided key is not allowed or not supported by your javascript runtime")}function pr(e){if(e===void 0)throw new w("JWE Encrypted Key missing")}function Yf(e){if(e!==void 0)throw new w("Encountered unexpected JWE Encrypted Key")}async function nl(e,t,r,n,i,o){let s=de(e);if(e==="dir")return Yf(n),r;switch(s.subtle.name){case"ECDH":{if(e==="ECDH-ES")Yf(n);if(!R(i.epk))throw new w('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');rl(r);let a=await Se(s,i.epk),f,c;if(i.apu!==void 0){if(typeof i.apu!=="string")throw new w('JOSE Header "apu" (Agreement PartyUInfo) invalid');f=M(i.apu,"apu",w)}if(i.apv!==void 0){if(typeof i.apv!=="string")throw new w('JOSE Header "apv" (Agreement PartyVInfo) invalid');c=M(i.apv,"apv",w)}let u=await tl(a,r,e==="ECDH-ES"?t.alg:e,e==="ECDH-ES"?t.cekBits:parseInt(e.slice(-5,-2),10),f,c);if(e==="ECDH-ES")return u;return pr(n),Io(e.slice(-6),u,n)}case"RSA-OAEP":return pr(n),vn(r),Qf(e,r,"decrypt"),new Uint8Array(await crypto.subtle.decrypt("RSA-OAEP",r,n));case"PBKDF2":{if(pr(n),typeof i.p2c!=="number")throw new w('JOSE Header "p2c" (PBES2 Count) missing or invalid');let a=o||1e4;if(i.p2c>a)throw new w('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof i.p2s!=="string")throw new w('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let f=M(i.p2s,"p2s",w),c=await el(f,e,i.p2c,r);return Io(e.slice(-6),c,n)}case"AES-KW":return pr(n),Io(e,r,n);case"AES-GCM":{if(pr(n),typeof i.iv!=="string")throw new w('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof i.tag!=="string")throw new w('JOSE Header "tag" (Authentication Tag) missing or invalid');let a;a=M(i.iv,"iv",w);let f;return f=M(i.tag,"tag",w),Tn(Ze(e.slice(0,-2)),r,n,a,f,new Uint8Array)}}}async function Ln(e,t,r,n,i={}){let o,s,a,f=de(e);if(e==="dir")return[r,void 0,void 0];switch(f.subtle.name){case"ECDH":{rl(r);let{apu:c,apv:u}=i;if(c!==void 0)se(c,'"apu"');if(u!==void 0)se(u,'"apv"');let l;if(i.epk!==void 0)l=await le(f,i.epk,"decrypt");else l=(await crypto.subtle.generateKey(r.algorithm,!0,["deriveBits"])).privateKey;let p=crypto.subtle,d=l;if(!d.extractable){if(typeof p.getPublicKey!=="function")throw TypeError('CryptoKey for "epk" must be extractable');d=await p.getPublicKey(l,[])}let{x:g,y:h,crv:S,kty:E}=await p.exportKey("jwk",d),y=await tl(r,l,e==="ECDH-ES"?t.alg:e,e==="ECDH-ES"?t.cekBits:parseInt(e.slice(-5,-2),10),c,u);if(s={epk:{x:g,crv:S,kty:E}},E==="EC")s.epk.y=h;if(c)s.apu=K(c);if(u)s.apv=K(u);if(e==="ECDH-ES"){a=y;break}a=n||Ee(t);let T=e.slice(-6);o=await Co(T,y,a);break}case"RSA-OAEP":{a=n||Ee(t),vn(r),Qf(e,r,"encrypt"),o=new Uint8Array(await crypto.subtle.encrypt("RSA-OAEP",r,a));break}case"PBKDF2":{a=n||Ee(t);let{p2c:c=2048,p2s:u=crypto.getRandomValues(new Uint8Array(16))}=i,l=await el(u,e,c,r);o=await Co(e.slice(-6),l,a),s={p2c:c,p2s:K(u)};break}case"AES-KW":{a=n||Ee(t),o=await Co(e,r,a);break}case"AES-GCM":{a=n||Ee(t);let{iv:c}=i,u=await xn(Ze(e.slice(0,-2)),a,r,c,new Uint8Array);o=u.ciphertext,s={iv:K(u.iv),tag:K(u.tag)};break}}return[a,o,s]}var Jn=x(()=>{oe();Ye();At();Rt();k();Q();lr();ie()});function hr(e,t){if(t!==void 0&&(!Array.isArray(t)||t.some((r)=>typeof r!=="string")))throw TypeError(`"${e}" option must be an array of strings`);if(!t)return;return new Set(t)}function jn(e,t){let{crit:r}=t??{};if(Array.isArray(r)&&new Set(r).size!==r.length)throw new e('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}function xe(e,t,r,n,i){if(i.crit!==void 0&&n?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return[];if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some((s)=>typeof s!=="string"||s.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let o=r===void 0?t:{__proto__:null,...r,...t};for(let s of n.crit){if(!(s in o))throw new _(`Extension Header Parameter "${s}" is not recognized`);if(!Object.hasOwn(i,s)||i[s]===void 0)throw new e(`Extension Header Parameter "${s}" is missing`);if(o[s]&&(!Object.hasOwn(n,s)||n[s]===void 0))throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`)}return n.crit}function _t(e,t){if(t.includes("b64")){let r=e.b64;if(typeof r!=="boolean")throw new A('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return r}return!0}function Qe(e,t){let r,n;try{r=JSON.stringify(t),n=JSON.parse(r)}catch(i){throw new e("JOSE Header is not valid JSON",{cause:i})}if(!R(n))throw new e("JOSE Header is not a JSON object");return[n,r]}var Ot,Wn;var kt=x(()=>{k();Ot={__proto__:null,b64:!0},Wn={__proto__:null}});function Dn(e,t){if(e.zip!==void 0&&e.zip!=="DEF")throw new _('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(e.zip!==void 0&&!t?.zip)throw new w('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.')}function il(e){if(typeof globalThis[e]>"u")throw new _(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${e} API.`)}async function ol(e){il("CompressionStream");let t=new CompressionStream("deflate-raw"),r=t.writable.getWriter();r.write(e).catch(()=>{}),r.close().catch(()=>{});let n=[],i=t.readable.getReader();for(;;){let{value:o,done:s}=await i.read();if(s)break;n.push(o)}return B(...n)}async function sl(e,t){il("DecompressionStream");let r=new DecompressionStream("deflate-raw"),n=r.writable.getWriter();n.write(e).catch(()=>{}),n.close().catch(()=>{});let i=[],o=0,s=r.readable.getReader();for(;;){let{value:a,done:f}=await s.read();if(f)break;if(i.push(a),o+=a.byteLength,t!==1/0&&o>t)throw new w("Decompressed plaintext exceeded the configured limit")}return B(...i)}var Oo=x(()=>{k();ie()});function Fn(e){let{aad:t,ciphertext:r,iv:n,protected:i,tag:o,unprotected:s}=e;if(n!==void 0&&typeof n!=="string")throw new w("JWE Initialization Vector incorrect type");if(typeof r!=="string")throw new w("JWE Ciphertext missing or incorrect type");if(o!==void 0&&typeof o!=="string")throw new w("JWE Authentication Tag incorrect type");if(i!==void 0&&typeof i!=="string")throw new w("JWE Protected Header incorrect type");if(t!==void 0&&(typeof t!=="string"||!t))throw new w("JWE AAD incorrect type");if(s!==void 0&&!R(s))throw new w("JWE Shared Unprotected Header incorrect type");return{aad:t,ciphertext:r,iv:n,protected:i,tag:o,unprotected:s===void 0?void 0:{...s}}}function qn(e){let t,r;try{let{header:n}=e;if(R(n)){r=n.alg;let i=Object.keys(n);if(!i.includes("alg"))r=void 0;t=Object.fromEntries(i.map((o)=>[o,o==="alg"?r:n[o]]))}else t=n}catch(n){return[void 0,r,n]}try{let{encrypted_key:n}=e;return[{encrypted_key:n,header:t},r]}catch(n){return[void 0,r,n]}}function Un(e){let{encrypted_key:t,header:r}=e;if(t!==void 0&&typeof t!=="string")throw new w("JWE Encrypted Key incorrect type");if(r!==void 0){if(!R(r))throw new w("JWE Per-Recipient Unprotected Header incorrect type")}if(e.protected===void 0&&r===void 0&&e.unprotected===void 0)throw new w("JOSE Header missing")}function _o(e){let{protected:t,ciphertext:r,iv:n,tag:i,aad:o}=e,s;if(t!==void 0)s=Ce(t,w,"JWE Protected Header is invalid");let a=t!==void 0?F(t):new Uint8Array;return[s,M(r,"ciphertext",w),n!==void 0?M(n,"iv",w):void 0,i!==void 0?M(i,"tag",w):void 0,o!==void 0?B(a,F("."),_n(o,"aad",w)):a]}function Hn(e,t){let[r,n,i,o]=t,{protected:s,aad:a,unprotected:f,header:c}=e,u={plaintext:r};if(s!==void 0)u.protectedHeader=n;if(a!==void 0)u.additionalAuthenticatedData=M(a,"aad",w);if(f!==void 0)u.sharedUnprotectedHeader=f;if(c!==void 0)u.unprotectedHeader=c;if(o)return{...u,key:i};return u}function We(e){return[e&&hr("keyManagementAlgorithms",e.keyManagementAlgorithms),e&&hr("contentEncryptionAlgorithms",e.contentEncryptionAlgorithms),e?.crit,e?.maxPBES2Count,e?.maxDecompressedLength]}async function ko(e,t,r,n){let[i]=t,{header:o,unprotected:s}=e,a;if(o!==void 0||s!==void 0){if(!Je(i,o,s))throw new w("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");a={...i,...o,...s}}else a=i??{};return al(e,t,r,n,a)}async function al(e,t,r,n,i){let[o,s,a,f,c]=r,[u,l,p,d,g]=t,{encrypted_key:h}=e;xe(w,Wn,a,u,i),Dn(i,u);let{alg:S,enc:E}=i;if(typeof S!=="string"||!S)throw new w("missing JWE Algorithm (alg) in JWE Header");if(typeof E!=="string"||!E)throw new w("missing JWE Encryption Algorithm (enc) in JWE Header");if(o&&!o.has(S)||!o&&S.startsWith("PBES2"))throw new Ve('"alg" (Algorithm) Header Parameter value not allowed');if(s&&!s.has(E))throw new Ve('"enc" (Encryption Algorithm) Header Parameter value not allowed');let y=Ze(E),T;if(h!==void 0)T=M(h,"encrypted_key",w);let I=!1;if(typeof n==="function")n=await n(u,e),I=!0;let O=de(S),j=await le(S==="dir"?y:O,n,"decrypt"),q;try{if(q=await nl(S,y,j,T,i,f),h!==void 0&&q instanceof Uint8Array&&q.byteLength<<3!==y.cekBits)q=Ee(y)}catch(N){if(N instanceof TypeError||N instanceof w||N instanceof _)throw N;q=Ee(y)}let V=await Tn(y,q,l,p,d,g);if(i.zip==="DEF"){let N=c??250000;if(N===0)throw new _('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if(N!==1/0&&(!Number.isSafeInteger(N)||N<1))throw TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");V=await sl(V,N).catch((ee)=>{if(ee instanceof w)throw ee;throw new w("Failed to decompress plaintext",{cause:ee})})}return[V,u,j,I]}async function cl(e,t,r){return ko(e,_o(e),t,r)}async function Bn(e,t,r){if(e instanceof Uint8Array)e=ze.decode(e);if(typeof e!=="string")throw new w("Compact JWE must be a string or Uint8Array");let{0:n,1:i,2:o,3:s,4:a,length:f}=e.split(".");if(f!==5)throw new w("Invalid Compact JWE");let c={ciphertext:s,iv:o||void 0,protected:n,tag:a||void 0,encrypted_key:i||void 0},u=Ce(n,w,"JWE Protected Header is invalid"),l=F(n),p=[u,M(s,"ciphertext",w),o?M(o,"iv",w):void 0,a?M(a,"tag",w):void 0,l];return al(c,p,t,r,u)}var mr=x(()=>{lr();Q();k();Jn();ie();kt();Ye();Rt();Oo()});async function ul(e,t,r){let n=await Bn(e,We(r),t),i={plaintext:n[0],protectedHeader:n[1]};if(typeof t==="function")return{...i,key:n[2]};return i}var fl=x(()=>{mr()});async function ll(e,t,r){if(!R(e))throw new w("Flattened JWE must be an object");let n=Fn(e),[i,,o]=qn(e);if(!i)throw o;let s={...n,...i};return Un(s),Hn(s,await cl(s,We(r),t))}var dl=x(()=>{k();mr()});async function pl(e,t,r){if(!R(e))throw new w("General JWE must be an object");let n=e.recipients;if(!Array.isArray(n))throw new w("JWE Recipients missing or incorrect type");let i=Array.from(n);if(!i.every(R))throw new w("JWE Recipients missing or incorrect type");if(!i.length)throw new w("JWE Recipients has no members");let o,s,a;try{o=We(r),s=Fn(e),a=_o(s)}catch{throw new Le}let f=i.map((c)=>qn(c));if(i.length>1)for(let[,c]of f){let u=a[0]?.alg??c??s.unprotected?.alg;if(u==="dir"||u==="ECDH-ES")throw new w(`"${u}" alg may only have a single recipient`)}for(let[c]of f){if(!c)continue;try{let u={...s,...c};return Un(u),Hn(u,await ko(u,a,o,t))}catch{}}throw new Le}var hl=x(()=>{mr();k()});function Mn(e,t,r){if(!Je(e,t,r))throw new w("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint")}function Po(e){let[,t,r,n,i,o,s,a,f]=e;if(i!==void 0)se(i,"JWE Additional Authenticated Data");if(o!==void 0)se(o,"JWE Content Encryption Key");if(s!==void 0)se(s,"JWE Initialization Vector");if(t!==void 0)t=Qe(w,t)[0],e[1]=t;if(r!==void 0)r=Qe(w,r)[0],e[2]=r;if(n!==void 0)n=Qe(w,n)[0],e[3]=n;if(a!==void 0&&!R(a))throw TypeError("JWE Key Management Parameters must be an object");Mn(t,r,n);let c={...t,...r,...n};jn(w,t),xe(w,Wn,f,t,c),Dn(c,t);let{alg:u,enc:l}=c;if(typeof u!=="string"||!u)throw new w('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(typeof l!=="string"||!l)throw new w('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');return[c,u,l,Ze(l)]}async function Ko(e,t,r){let[n,i,,o]=t,[s,a,f,c,u,l,p,d,,g]=e,h=a,S=f;if(l&&(i==="dir"||i==="ECDH-ES"))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${i}`);let E=de(i),y=await le(i==="dir"?o:E,r,"encrypt"),[T,I,O]=await Ln(i,o,y,l,d);if(O){if(g)S=S?{...S,...O}:O;else h=h?{...h,...O}:O;Mn(h,S,c)}let j,q;if(h)j=K(JSON.stringify(h)),q=F(j);else j="",q=new Uint8Array;let V,N;if(u?.byteLength)N=K(u),V=B(q,F("."),F(N));else V=q;let ee=s;if(n.zip==="DEF")ee=await ol(ee).catch((Eh)=>{throw new w("Failed to compress plaintext",{cause:Eh})});let{ciphertext:ct,tag:Ds,iv:Fs}=await xn(o,ee,T,p,V),Pe={ciphertext:K(ct)};if(Fs)Pe.iv=K(Fs);if(Ds)Pe.tag=K(Ds);if(I)Pe.encrypted_key=K(I);if(N)Pe.aad=N;if(h)Pe.protected=j;if(c)Pe.unprotected=c;if(S)Pe.header=S;return Pe}async function je(e,t,r){if(!e[1]&&!e[2]&&!e[3])throw new w("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(r!==void 0)e[8]=r?.crit,e[9]=r?Uf in r:!1;return Ko(e,Po(e),t)}var yr=x(()=>{oe();lr();Jn();k();ie();kt();Ye();Rt();Oo();Q()});class yl{#e;state;constructor(e,t,r){this.#e=e,this.state=[void 0,void 0,t,r]}setUnprotectedHeader(e){return P(this.state[0],"setUnprotectedHeader"),this.state[0]=e,this}setKeyManagementParameters(e){return P(this.state[1],"setKeyManagementParameters"),this.state[1]=e,this}addRecipient(...e){return this.#e.addRecipient(...e)}encrypt(...e){return this.#e.encrypt(...e)}done(){return this.#e}}function ml(e,t,r){let{aad:n,protected:i,unprotected:o,header:s}=e;if(n)t.aad=n;if(i)t.protected=i;if(o)t.unprotected=o;if(s)r.header=s}class No{#e;#t=[];#n;#o;#s;constructor(e){this.#e=e}addRecipient(e,t){let r=new yl(this,e,t?.crit);return this.#t.push(r),r}setProtectedHeader(e){return P(this.#n,"setProtectedHeader"),this.#n=e,this}setSharedUnprotectedHeader(e){return P(this.#o,"setSharedUnprotectedHeader"),this.#o=e,this}setAdditionalAuthenticatedData(e){return this.#s=e,this}async encrypt(){if(!this.#t.length)throw new w("at least one recipient must be added");if(se(this.#e,"plaintext"),this.#t.length===1){let[a,f,c,u]=this.#t[0].state,l=await je([this.#e,this.#n,a,this.#o,this.#s,void 0,void 0,f,u,!1],c),p={ciphertext:l.ciphertext,iv:l.iv,recipients:[{}],tag:l.tag};if(l.encrypted_key)p.recipients[0].encrypted_key=l.encrypted_key;return ml(l,p,p.recipients[0]),p}let e,t=this.#n,r=this.#o,n=[],i=[];for(let a=0;a<this.#t.length;a++){let f=this.#t[a],[c,u,,l]=f.state,p=[this.#e,t,c,r,this.#s,void 0,void 0,u,l,!0],d=Po(p);if(n.push(p),i.push(d),a===0)t=p[1],r=p[3];if(d[1]==="dir"||d[1]==="ECDH-ES")throw new w(`"${d[1]}" alg may only have a single recipient`);if(!e)e=d[2];else if(e!==d[2])throw new w('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}let o=Ee(i[0][3]),s={ciphertext:"",recipients:[]};for(let a=0;a<this.#t.length;a++){let f=this.#t[a],[,c,u]=f.state,l={};if(s.recipients.push(l),a===0){n[0][5]=o;let y=await Ko(n[0],i[0],u);s.ciphertext=y.ciphertext,s.iv=y.iv,s.tag=y.tag,l.encrypted_key=y.encrypted_key,ml(y,s,l);continue}let[,p,,d]=i[a],g=n[a][2],h=await le(de(p),u,"encrypt"),[,S,E]=await Ln(p,d,h,o,c);if(l.encrypted_key=K(S),g||E){let y={...g,...E};if(E)Mn(n[a][1],y,n[a][3]);l.header=y}}return s}}var gl=x(()=>{Q();k();lr();Jn();oe();yr();Ye();Rt()});async function wl(e,t,r){if(t instanceof Uint8Array)return crypto.subtle.importKey("raw",t,e.subtle,!1,[r]);if(Te(t,e.subtle,r),e.minRsaBits)En(e.alg,t);return t}async function El(e,t,r){let n=await wl(e,t,"sign"),i=await crypto.subtle.sign(e.signing,n,r);return new Uint8Array(i)}async function Sl(e,t,r,n){let i=await wl(e,t,"verify");try{return await crypto.subtle.verify(e.signing,i,r,n)}catch{return!1}}var $o=()=>{};function Lo(e){let t={name:"HMAC",hash:`SHA-${e}`};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:gr}}function Pt(e,t){let n={name:t?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:`SHA-${e}`};return{kty:["RSA"],subtle:n,signing:t?{...n,saltLength:t}:n,usages:gr,minRsaBits:2048}}function Jo(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:`SHA-${t}`},usages:gr}}function bl(){let e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:gr}}function Wo(e){let r={name:`ML-DSA-${e}`};return{kty:["AKP"],subtle:r,signing:r,usages:gr}}function Kt(e){let t=typeof e==="string"?wr[e]:void 0;if(!t)throw new _(`alg ${e} is not supported either by JOSE or your javascript runtime`);return t}var gr,wr;var Nt=x(()=>{k();gr=[["verify"],["sign"]];wr=dr({HS256:Lo(256),HS384:Lo(384),HS512:Lo(512),RS256:Pt(256),RS384:Pt(384),RS512:Pt(512),PS256:Pt(256,32),PS384:Pt(384,48),PS512:Pt(512,64),ES256:Jo("P-256",256),ES384:Jo("P-384",384),ES512:Jo("P-521",512),EdDSA:bl(),Ed25519:bl(),"ML-DSA-44":Wo(44),"ML-DSA-65":Wo(65),"ML-DSA-87":Wo(87)})});function Gn(e,t){let{protected:r,header:n}=e,i=R(n)?{...n}:n,o=t?t[0]:e.payload;if(!t&&o instanceof Uint8Array)o=new Uint8Array(o);let s=e.signature,a={payload:o,signature:s};if(r!==void 0)a.protected=r;if(n!==void 0)a.header=i;return a}function zn(e,t){let[r,n,,i,o]=t,s={payload:r};if(e.protected!==void 0)s.protectedHeader=n;if(e.header!==void 0)s.unprotectedHeader=e.header;if(o)return{...s,key:i};return s}function De(e){return[e&&hr("algorithms",e.algorithms),e?.crit]}function Vn(e,t=e===void 0?{}:Ce(e,A,"JWS Protected Header is invalid")){return t}function vl(e,t,r){let n=_t(e,xe(A,Ot,r[1],e,t)),i=t.alg;if(typeof i!=="string"||!i)throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(r[0]&&!r[0].has(i))throw new Ve('"alg" (Algorithm) Header Parameter value not allowed');return[n,i]}function kb(e,t,r,n){let i=Vn(e,n),o;if(t!==void 0){if(!Je(i,t))throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");o={...i,...t}}else o=i;return[i,o,...vl(i,o,r)]}function Xn(e){let t=/[\p{Cs}\p{Cn}]/u.exec(e)?.[0];if(t!==void 0)throw new A(/\p{Cs}/u.test(t)?"JWS Payload must be a well-formed Unicode string":"JWS Payload must not contain unassigned Unicode code points");return St.encode(e)}function Pb(e){try{return F(e)}catch{throw new A("JWS Compact Serialization payload must use only ASCII characters")}}async function Al(e,t,r,n,i,o,s){let a=!1;if(typeof r==="function")r=await r(i,e),a=!0;let f=typeof s==="string",c=Kt(o),u=B(n!==void 0?F(n):new Uint8Array,F("."),f?t[2]??=_n(s,"payload",A):s),l=M(e.signature,"signature",A),p=await le(c,r,"verify");if(!await Sl(c,p,l,u))throw new Xe;return[f?M(s,"payload",A):s,i,f,p,a]}async function Yn(e,t,r,n,i){let{protected:o,header:s,payload:a}=e,[f,,c,u]=kb(o,s,t,i);if(c){if(typeof a!=="string")throw new A("JWS Payload must be a string")}else if(typeof a!=="string"&&!(a instanceof Uint8Array))throw new A("JWS Payload must be a string or an Uint8Array instance");let l=c||typeof a!=="string"?a:n(a);return Al(e,t,r,o,f,u,l)}async function Zn(e,t,r){if(e instanceof Uint8Array)e=ze.decode(e);if(typeof e!=="string")throw new A("Compact JWS must be a string or Uint8Array");let{0:n,1:i,2:o,length:s}=e.split(".");if(s!==3)throw new A("Invalid Compact JWS");let a={payload:i,protected:n,signature:o},f=Vn(n),[c,u]=vl(f,f,t),l=c?i:Pb(i);return Al(a,t,r,n,f,u,l)}var Er=x(()=>{$o();Nt();k();ie();Q();kt();Ye()});async function xl(e,t,r){let n=await Zn(e,De(r),t),i={payload:n[0],protectedHeader:n[1]};if(typeof t==="function")return{...i,key:n[3]};return i}var Tl=x(()=>{Er()});async function Cl(e,t,r){if(!R(e))throw new A("Flattened JWS must be an object");let n=Gn(e);if(n.protected===void 0&&n.header===void 0)throw new A('Flattened JWS must have either of the "protected" or "header" members');if(n.protected!==void 0&&typeof n.protected!=="string")throw new A("JWS Protected Header incorrect type");if(n.payload===void 0)throw new A("JWS Payload missing");if(typeof n.signature!=="string")throw new A("JWS Signature missing or incorrect type");if(n.header!==void 0&&!R(n.header))throw new A("JWS Unprotected Header incorrect type");return zn(n,await Yn(n,De(r),t,Xn))}var Il=x(()=>{k();Er()});function Kb(e,t){try{let r=Gn(e,[t]),{protected:n,header:i,signature:o}=r;if(n===void 0&&i===void 0)return;if(n!==void 0&&typeof n!=="string")return;if(typeof o!=="string")return;if(i!==void 0&&!R(i))return;let s=Vn(n),{b64:a,crit:f}=s;return[r,s,Array.isArray(f)&&f.includes("b64")?typeof a==="boolean"?a?1:2:0:1]}catch{return}}async function Rl(e,t,r){if(!R(e))throw new A("General JWS must be an object");let{signatures:n,payload:i}=e;if(!Array.isArray(n))throw new A("JWS Signatures missing or incorrect type");let o=Array.from(n);if(!o.every(R))throw new A("JWS Signatures missing or incorrect type");let s;try{if(i===void 0)throw Error();s=De(r)}catch{throw new Xe}let a=i instanceof Uint8Array?new Uint8Array(i):i,f=o.map((u)=>Kb(u,a)).filter((u)=>u!==void 0),c=0;for(let[,,u]of f)if(c|=u,c===3)throw new A("inconsistent use of JWS Unencoded Payload (RFC7797)");for(let u of f)try{return zn(u[0],await Yn(u[0],s,t,Xn,u[1]))}catch{}throw new Xe}var Ol=x(()=>{Er();k()});function jo(){throw TypeError("Invalid time period format")}function Qn(e){if(typeof e!=="string")jo();let t=$b.exec(e);if(!t||t[4]&&t[1])jo();let r=parseFloat(t[2]),n=Math.round(r*Nb[t[3][0].toLowerCase()]);if(!Number.isFinite(n))jo();if(t[1]==="-"||t[4]==="ago")return-n;return n}function Lt(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}function Do(e,t){if(typeof t!=="string")throw TypeError(`"${e}" claim must be a string`)}function Lb(e){if(typeof e!=="string"&&(!Array.isArray(e)||Array.from(e).some((t)=>typeof t!=="string")))throw TypeError('"aud" claim must be a string or an array of strings')}function Fo(e,t){if(typeof e==="number")return Lt(t,e);if(e instanceof Date)return Lt(t,Sr(e));return Sr(new Date)+Qn(e)}function qo(e,t,r=!1){let n=e[t];if(n===void 0&&!r)return;if(typeof n!=="number")throw new ge(`"${t}" claim must be a number`,e,t,"invalid");return n}function Uo(e,t){throw new ge(`unexpected "${t}" claim value`,e,t,$t)}function Jt(e,t,r={}){let n;try{n=JSON.parse(bt.decode(t))}catch{}if(!R(n))throw new U("JWT Claims Set must be a top-level JSON object");let{typ:i}=r;if(i!==void 0&&(typeof e.typ!=="string"||_l(e.typ)!==_l(i)))throw new ge('unexpected "typ" JWT header value',n,"typ",$t);let{requiredClaims:o=[],issuer:s,subject:a,audience:f,maxTokenAge:c}=r,u=[...o];if(c!==void 0)u.push("iat");if(f!==void 0)u.push("aud");if(a!==void 0)u.push("sub");if(s!==void 0)u.push("iss");for(let y of new Set(u.reverse()))if(!Object.hasOwn(n,y))throw new ge(`missing required "${y}" claim`,n,y,"missing");if(s!==void 0&&!(Array.isArray(s)?s:[s]).includes(n.iss))Uo(n,"iss");if(a!==void 0&&n.sub!==a)Uo(n,"sub");if(f!==void 0&&!Jb(n.aud,typeof f==="string"?[f]:f))Uo(n,"aud");let{clockTolerance:l}=r,p=0;if(typeof l==="string")p=Qn(l);else if(l!==void 0){if(typeof l!=="number")throw TypeError("Invalid clockTolerance option type");p=l}Lt("clockTolerance option",p);let{currentDate:d}=r,g=Lt("currentDate option",Sr(d===void 0?new Date:d)),h=qo(n,"iat",c!==void 0),S=qo(n,"nbf");if(S!==void 0){if(S>g+p)throw new ge('"nbf" claim timestamp check failed',n,"nbf",$t)}let E=qo(n,"exp");if(E!==void 0){if(E<=g-p)throw new ar('"exp" claim timestamp check failed',n,"exp",$t)}if(c!==void 0){let y=g-h,T=Lt("maxTokenAge option",typeof c==="number"?c:Qn(c));if(y-p>T)throw new ar('"iat" claim timestamp check failed (too far in the past)',n,"iat",$t);if(y<-p)throw new ge('"iat" claim timestamp check failed (it should be in the past)',n,"iat",$t)}return n}function Ie(e){return kl.get(e)}function Wt(e){let t=Ie(e);for(let r of["iat","nbf","exp"]){let n=t[r];if(typeof n==="number"&&!Number.isFinite(n))throw TypeError(`"${r}" claim must be a finite number`)}return St.encode(JSON.stringify(t))}function ei(e,t){return Ie(e)[t]}class et{constructor(e={}){if(!R(e))throw TypeError("JWT Claims Set MUST be an object");(kl||=new WeakMap).set(this,structuredClone(e))}setIssuer(e){return Do("iss",e),Ie(this).iss=e,this}setSubject(e){return Do("sub",e),Ie(this).sub=e,this}setAudience(e){return Lb(e),Ie(this).aud=e,this}setJti(e){return Do("jti",e),Ie(this).jti=e,this}setNotBefore(e){return Ie(this).nbf=Fo(e,"setNotBefore"),this}setExpirationTime(e){return Ie(this).exp=Fo(e,"setExpirationTime"),this}setIssuedAt(e){let t=Ie(this);if(e===void 0)t.iat=Sr(new Date);else if(typeof e==="string")t.iat=Lt("setIssuedAt",Sr(new Date)+Qn(e));else t.iat=Fo(e,"setIssuedAt");return this}}var Sr=(e)=>Math.floor(e.getTime()/1000),Nb,$b,$t="check_failed",_l=(e)=>{let t=e.toLowerCase();return e.includes("/")?t:`application/${t}`},Jb=(e,t)=>{if(typeof e==="string")return t.includes(e);if(Array.isArray(e))return t.some((r)=>e.includes(r));return!1},kl;var jt=x(()=>{k();ie();Nb={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},$b=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i});async function Pl(e,t,r){let n=await Zn(e,De(r),t);if(!n[2])throw new U("JWTs MUST NOT use unencoded payload");let o={payload:Jt(n[1],n[0],r),protectedHeader:n[1]};if(typeof t==="function")return{...o,key:n[3]};return o}var Kl=x(()=>{Er();jt();k()});async function Nl(e,t,r){let n=await Bn(e,We(r),t),i=n[1],o=Jt(i,n[0],r);for(let a of["iss","sub","aud"])if(i[a]!==void 0&&(a==="aud"?JSON.stringify(i.aud)!==JSON.stringify(o.aud):i[a]!==o[a]))throw new ge(`replicated "${a}" claim header parameter mismatch`,o,a,"mismatch");let s={payload:o,protectedHeader:i};if(typeof t==="function")return{...s,key:n[2]};return s}var $l=x(()=>{mr();jt();k()});class Ho{#e;#t;#n;#o;#s;constructor(e){se(e,"plaintext"),this.#e=e}setContentEncryptionKey(e){return P(this.#n,"setContentEncryptionKey"),this.#n=e,this}setInitializationVector(e){return P(this.#o,"setInitializationVector"),this.#o=e,this}setProtectedHeader(e){return P(this.#t,"setProtectedHeader"),this.#t=e,this}setKeyManagementParameters(e){return P(this.#s,"setKeyManagementParameters"),this.#s=e,this}async encrypt(e,t){let r=await je([this.#e,this.#t,void 0,void 0,void 0,this.#n,this.#o,this.#s,void 0,!1],e,t);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")}}var Ll=x(()=>{Q();yr()});class Bo{#e;#t;#n;#o;#s;#y;#g;#p;constructor(e){se(e,"plaintext"),this.#e=e}setKeyManagementParameters(e){return P(this.#p,"setKeyManagementParameters"),this.#p=e,this}setProtectedHeader(e){return P(this.#t,"setProtectedHeader"),this.#t=e,this}setSharedUnprotectedHeader(e){return P(this.#n,"setSharedUnprotectedHeader"),this.#n=e,this}setUnprotectedHeader(e){return P(this.#o,"setUnprotectedHeader"),this.#o=e,this}setAdditionalAuthenticatedData(e){return this.#s=e,this}setContentEncryptionKey(e){return P(this.#y,"setContentEncryptionKey"),this.#y=e,this}setInitializationVector(e){return P(this.#g,"setInitializationVector"),this.#g=e,this}async encrypt(e,t){return je([this.#e,this.#t,this.#o,this.#n,this.#s,this.#y,this.#g,this.#p,void 0,!1],e,t)}}var Jl=x(()=>{Q();yr()});function Wl(e){if(e===void 0)return[void 0,""];let t=Qe(A,e);return[t[0],K(t[1])]}function jl(e,t,r){return jn(A,e),_t(e,xe(A,Ot,r,e,t))}function Dl(e){let t=e.alg;if(typeof t!=="string"||!t)throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');return Kt(t)}async function Fl(e,t,r,n){let i=B(F(e),F("."),t),o=await le(r,n,"sign");return K(await El(r,o,i))}async function ti(e,t,r){let{protectedHeader:n,unprotectedHeader:i}=e,o;if([n,o]=Wl(n),i!==void 0)i=Qe(A,i)[0];if(!n&&!i)throw new A("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Je(n,i))throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let s={...n,...i},a=jl(n,s,e.crit);r?.(a);let f=Dl(s),c,u;if(a){let p=e.encoded??=[];p[0]??=K(e.payload),p[1]??=F(p[0]),c=p[0],u=p[1]}else u=e.payload,c="";let l={signature:await Fl(o,u,f,t),payload:c};if(n)l.protected=o;if(i)l.header=i;return[l,a]}async function ri(e,t,r,n,i){let[o,s]=Wl(t);if(!o)throw new A("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!jl(o,o,r))i();let f=Dl(o),c=K(e),u=await Fl(s,F(c),f,n);return`${s}.${c}.${u}`}var br=x(()=>{oe();$o();Nt();k();ie();kt();Ye()});class Mo{#e;#t;constructor(e){if(!(e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#e=e}setProtectedHeader(e){return P(this.#t,"setProtectedHeader"),this.#t=e,this}async sign(e,t){return ri(this.#e,this.#t,t?.crit,e,()=>{throw TypeError("use the flattened module for creating JWS with b64: false")})}}var ql=x(()=>{br();Q()});class Go{#e;#t;#n;constructor(e){if(!(e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#e=e}setProtectedHeader(e){return P(this.#t,"setProtectedHeader"),this.#t=e,this}setUnprotectedHeader(e){return P(this.#n,"setUnprotectedHeader"),this.#n=e,this}async sign(e,t){let[r]=await ti({payload:this.#e,protectedHeader:this.#t,unprotectedHeader:this.#n,crit:t?.crit},e);return r}}var Ul=x(()=>{br();Q()});class Hl{#e;state;constructor(e,t,r){this.#e=e,this.state=[void 0,void 0,t,r?.crit]}setProtectedHeader(e){return P(this.state[0],"setProtectedHeader"),this.state[0]=e,this}setUnprotectedHeader(e){return P(this.state[1],"setUnprotectedHeader"),this.state[1]=e,this}addSignature(...e){return this.#e.addSignature(...e)}sign(...e){return this.#e.sign(...e)}done(){return this.#e}}class zo{#e;#t=[];constructor(e){this.#e=e}addSignature(e,t){let r=new Hl(this,e,t);return this.#t.push(r),r}async sign(){if(!this.#t.length)throw new A("at least one signature must be added");if(!(this.#e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");let e={signatures:[],payload:""},t=[],r;for(let n=0;n<this.#t.length;n++){let i=this.#t[n],[o,s,a,f]=i.state,[{payload:c,...u},l]=await ti({payload:this.#e,protectedHeader:o,unprotectedHeader:s,crit:f,encoded:t},a);if(r===void 0)r=l,e.payload=c;else if(r!==l)throw new A("inconsistent use of JWS Unencoded Payload (RFC7797)");e.signatures.push(u)}return e}}var Bl=x(()=>{br();k();Q()});var Wb,Vo;var Ml=x(()=>{br();k();jt();Q();Wb=et;Vo=class Vo extends Wb{#e;setProtectedHeader(e){return P(this.#e,"setProtectedHeader"),this.#e=e,this}async sign(e,t){return ri(Wt(this),this.#e,t?.crit,e,()=>{throw new U("JWTs MUST NOT use unencoded payload")})}}});var jb,Xo;var Gl=x(()=>{yr();jt();Q();jb=et;Xo=class Xo extends jb{#e;#t;#n;#o;#s;#y;#g;setProtectedHeader(e){return P(this.#o,"setProtectedHeader"),this.#o=e,this}setKeyManagementParameters(e){return P(this.#n,"setKeyManagementParameters"),this.#n=e,this}setContentEncryptionKey(e){return P(this.#e,"setContentEncryptionKey"),this.#e=e,this}setInitializationVector(e){return P(this.#t,"setInitializationVector"),this.#t=e,this}replicateIssuerAsHeader(){return this.#s=!0,this}replicateSubjectAsHeader(){return this.#y=!0,this}replicateAudienceAsHeader(){return this.#g=!0,this}async encrypt(e,t){let r=Wt(this);if(this.#o&&(this.#s||this.#y||this.#g))this.#o={...this.#o,iss:this.#s?ei(this,"iss"):void 0,sub:this.#y?ei(this,"sub"):void 0,aud:this.#g?ei(this,"aud"):void 0};let n=await je([r,this.#o,void 0,void 0,void 0,this.#e,this.#t,this.#n,void 0,!1],e,t);return[n.protected,n.encrypted_key,n.iv,n.ciphertext,n.tag].join(".")}}});function tt(e='JWK "alg" (Algorithm) Parameter'){throw new _(`Invalid or unsupported ${e} value`)}function rt(e,t){return(typeof e==="string"?wr[e]??To[e]:void 0)??tt(t)}var Fe='"alg" (Algorithm)';var vr=x(()=>{k();Nt();Rt()});function qe(e){if(e!==void 0&&typeof e!=="boolean")throw TypeError('"extractable" option must be a boolean');return e}function qb(e,t){if(Ue(e,48,`Invalid ${t==="spki"?"SPKI":"PKCS#8"} structure`),Re(e),t==="pkcs8"){Ue(e,2,"Expected version field");let r=Re(e);e.pos+=r}Ue(e,48,"Expected algorithm identifier"),Re(e)}function Hb(e){let t=Zl(e);Ue(t,48,"Invalid certificate structure");let r=Re(t);if(r<0||t.pos+r>t.data.length)throw Error("Unexpected end of ASN.1 input");if(Ue(t,48,"Invalid tbsCertificate structure"),Re(t),e[t.pos]===160)zl(t,6);else zl(t,5);let n=t.pos;Ue(t,48,"Invalid SPKI structure");let i=Re(t);return e.subarray(n,n+i+(t.pos-n))}var Db=(e,t)=>{let r=(e.match(/.{1,64}/g)||[]).join(`
8
8
  `);return`-----BEGIN ${t}-----
9
9
  ${r}
10
- -----END ${t}-----`},Vl=async(e,t,r)=>{if(ur(r)){if(r.type!==e)throw TypeError(`key is not a ${e} key`);return r.export({format:"pem",type:t})}if(!we(r))throw TypeError(ye(r,"CryptoKey","KeyObject"));if(!r.extractable)throw TypeError("CryptoKey is not extractable");if(r.type!==e)throw TypeError(`key is not a ${e} key`);return Db(Tn(new Uint8Array(await crypto.subtle.exportKey(t,r))),`${e.toUpperCase()} KEY`)},Xl=(e)=>Vl("public","spki",e),Yl=(e)=>Vl("private","pkcs8",e),vr=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},Zl=(e)=>({data:e,pos:0}),Yo=(e)=>{let t=e.data[e.pos++];if(t===void 0)throw Error("Unexpected end of ASN.1 input");return t},Re=(e)=>{let t=Yo(e);if(t&128){let r=t&127,n=0;for(let i=0;i<r;i++)n=n<<8|Yo(e);return n}return t},zl=(e,t=1)=>{while(t-- >0){e.pos++;let r=Re(e);e.pos+=r}},Ue=(e,t,r)=>{if(Yo(e)!==t)throw Error(r)},Ql=(e,t)=>{if(t<0||e.pos+t>e.data.length)throw Error("Unexpected end of ASN.1 input");let r=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,r},Fb=(e)=>{Ue(e,6,"Expected algorithm OID");let t=Re(e);return Ql(e,t)},Ub=(e)=>{let t=Fb(e);if(vr(t,[43,101,110]))return"X25519";if(!vr(t,[42,134,72,206,61,2,1]))throw Error("Unsupported key algorithm");Ue(e,6,"Expected curve OID");let r=Re(e),n=Ql(e,r);if(vr(n,[42,134,72,206,61,3,1,7]))return"P-256";if(vr(n,[43,129,4,0,34]))return"P-384";if(vr(n,[43,129,4,0,35]))return"P-521";throw Error("Unsupported named curve")},Zo=async(e,t,r,n)=>{let i=qe(n?.extractable),o=rt(r,Fe);if(o.secret)tt(Fe);let s=e==="spki",a;if(o.resolve)try{let f=Zl(t);qb(f,e),a=o.resolve({crv:Ub(f)})}catch{throw new _("Invalid or unsupported key format")}else a=o.subtle;return crypto.subtle.importKey(e,t,a,i??s,o.usages[s?0:1])},Qo=(e,t)=>Cn(e.replace(t,"")),ed=(e,t,r)=>{let n=Qo(e,/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g);return Zo("pkcs8",n,t,r)},td=(e,t,r)=>{let n=Qo(e,/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g);return Zo("spki",n,t,r)},rd=(e,t,r)=>{let n;try{let i=Qo(e,/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g);n=Hb(i)}catch(i){throw TypeError("Failed to parse the X.509 certificate",{cause:i})}return Zo("spki",n,t,r)};var es=x(()=>{k();br()});function Bb(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}async function Mb(e){if(ur(e))if(e.type==="secret")e=e.export();else return e.export({format:"jwk"});if(e instanceof Uint8Array)return{kty:"oct",k:K(e)};if(!we(e))throw TypeError(ye(e,"CryptoKey","KeyObject","Uint8Array"));if(!e.extractable)throw TypeError("non-extractable CryptoKey cannot be exported as a JWK");let{ext:t,key_ops:r,alg:n,use:i,...o}=Bb(await crypto.subtle.exportKey("jwk",e));if(o.kty==="AKP")o.alg=n;return o}function nd(e){return Xl(e)}function id(e){return Yl(e)}function ri(e){return Mb(e)}var ts=x(()=>{es();oe()});async function rs(e,t){let r;if(R(e)){if(r=At(e),typeof r.kty!=="string")throw TypeError(ye(e,"CryptoKey","KeyObject","JSON Web Key"))}else if(vn(e))r=At(await ri(e));else throw TypeError(ye(e,"CryptoKey","KeyObject","JSON Web Key"));if(t??="sha256",t!=="sha256"&&t!=="sha384"&&t!=="sha512")throw TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let n;switch(r.kty){case"AKP":Oe(r.alg,'"alg" (Algorithm) Parameter'),Oe(r.pub,'"pub" (Public key) Parameter'),n={alg:r.alg,kty:r.kty,pub:r.pub};break;case"EC":Oe(r.crv,'"crv" (Curve) Parameter'),Oe(r.x,'"x" (X Coordinate) Parameter'),Oe(r.y,'"y" (Y Coordinate) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x,y:r.y};break;case"OKP":Oe(r.crv,'"crv" (Subtype of Key Pair) Parameter'),Oe(r.x,'"x" (Public Key) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x};break;case"RSA":Oe(r.e,'"e" (Exponent) Parameter'),Oe(r.n,'"n" (Modulus) Parameter'),n={e:r.e,kty:r.kty,n:r.n};break;case"oct":if(typeof r.k!=="string")throw new ar('"k" (Key Value) Parameter missing or invalid');n={k:r.k,kty:r.kty};break;default:throw new _('"kty" (Key Type) Parameter missing or unsupported')}let i=F(JSON.stringify(n));return K(await _n(t,i))}async function od(e,t){t??="sha256";let r=await rs(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${r}`}var Oe=(e,t)=>{if(typeof e!=="string"||!e)throw new ar(`${t} missing or invalid`)};var sd=x(()=>{Q();oe();k();ie();ts()});async function ad(e,t){let r={...e,...t?.header};if(!R(r.jwk))throw new A('"jwk" (JSON Web Key) Header Parameter must be a JSON object');let n;try{n=xt(r.jwk)}catch(s){throw new A("Invalid Embedded JWK",{cause:s})}let i=Pt(r.alg);if(n.use!==void 0&&n.use!=="sig")throw new A('Invalid Embedded JWK, its "use" must be "sig" when present');if(n.alg!==void 0&&n.alg!==i.alg)throw new A(`Invalid Embedded JWK, its "alg" must be "${i.alg}" when present`);let o=await Se(i,{...n,ext:!0});if(o.type!=="public")throw new A('"jwk" (JSON Web Key) Header Parameter must be a public key');return o}var cd=x(()=>{vt();Kt();k()});function Gb(e,t,r,n){let{kty:i,key_ops:o,ext:s,kid:a,alg:f,use:c,crv:u}=At(e),l=Array.isArray(o)?[...o]:o;return(s===void 0||typeof s==="boolean")&&(l===void 0||Array.isArray(l)&&l.every((p,d)=>typeof p==="string"&&l.indexOf(p)===d)&&l.includes("verify"))&&t.kty.includes(i)&&(n===void 0||typeof n==="string"&&n===a)&&(f===void 0?i!=="AKP":r===f)&&(c===void 0||c==="sig")&&(!t.crv||u===t.crv)}async function ud(e,t,r){let n=e.get(t)||e.set(t,{}).get(t),{alg:i}=r;if(n[i]===void 0){let o=await Se(r,{...t,alg:i,ext:!0});if(o.type!=="public")throw new cr("JSON Web Key Set members must be public keys");n[i]=o}return n[i]}function Ar(e){let t;try{t=structuredClone(e)}catch{}if(!Rn(t))throw new cr("JSON Web Key Set malformed");let r=new WeakMap;return Object.defineProperty(async(i,o)=>{let{alg:s,kid:a}={...i,...o?.header},f=typeof s==="string"?gr[s]:void 0;if(!f||f.secret)throw new _('Unsupported "alg" value for a JSON Web Key Set');let c=t.keys.filter((p)=>Gb(p,f,s,a)),{0:u,length:l}=c;if(!l)throw new bt;if(l!==1){let p=new En;throw p[Symbol.asyncIterator]=async function*(){for(let d of c)try{yield await ud(r,d,f)}catch{}},p}return ud(r,u,f)},"jwks",{value:()=>structuredClone(t)})}var ns=x(()=>{vt();Kt();k()});function zb(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}async function Vb(e,t,r,n=fetch){let i=await n(e,{method:"GET",signal:r,redirect:"manual",headers:t}).catch((o)=>{if(o.name==="TimeoutError")throw new Sn;throw o});if(i.status!==200)throw new z("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await i.json()}catch{throw new z("Failed to parse the JSON Web Key Set HTTP response as JSON")}}function xr(e,t){return Number.isFinite(e)&&Date.now()<e+t}function fd(e,t,r){if(Number.isNaN(e))throw TypeError(`"${r}" option must not be NaN`);return typeof e==="number"?e:t}function ld(e,t){if(!(e instanceof URL))throw TypeError("url must be an instance of URL");let r=new URL(e.href).href,n=t??{},i=n.timeoutDuration;if(typeof i==="number"&&(!Number.isInteger(i)||i<0))throw TypeError('"timeoutDuration" option must be a non-negative integer');let o=typeof i==="number"?i:5000,s=fd(n.cooldownDuration,30000,"cooldownDuration"),a=fd(n.cacheMaxAge,600000,"cacheMaxAge"),f=new Headers(n.headers);if(is&&!f.has("User-Agent"))f.set("User-Agent",is);if(!f.has("accept"))f.set("accept","application/json, application/jwk-set+json");let c=n[os],u=n[ss],l,p,d=0,g=0,h;if(u&&typeof u==="object"){let{uat:y,jwks:T}=u;if(xr(y,a)&&Rn(T))l=y,h=Ar(T)}let S=async()=>{if(p&&zb())p=void 0;if(!p){let y=++d,T=p=Vb(r,f,AbortSignal.timeout(o),c).then((I)=>{let O=Ar(I);if(y<=g)return;h=O;let j=Date.now();if(u)u.uat=j,u.jwks=I;l=j,g=y}).finally(()=>{if(p===T)p=void 0})}await p};return Object.defineProperties(async(y,T)=>{if(!h||!xr(l,a))await S();try{return await h(y,T)}catch(I){if(I instanceof bt&&!xr(l,s))return await S(),h(y,T);throw I}},{coolingDown:{get:()=>xr(l,s),enumerable:!0},fresh:{get:()=>xr(l,a),enumerable:!0},reload:{value:S,enumerable:!0},reloading:{get:()=>!!p,enumerable:!0},jwks:{value:()=>h?.jwks(),enumerable:!0}})}var is,os,ss;var dd=x(()=>{k();ns();if(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))is="jose/v6.2.10";os=Symbol();ss=Symbol()});var Xb,as;var pd=x(()=>{oe();Q();k();Wt();_t();Xb=et;as=class as extends Xb{encode(){let e=K(JSON.stringify({alg:"none"})),t=K(Lt(this));return`${e}.${t}.`}static decode(e,t){if(typeof e!=="string")throw new U("Unsecured JWT must be a string");let{0:r,1:n,2:i,length:o}=e.split(".");if(o!==3||i!=="")throw new U("Invalid Unsecured JWT");let s,a;try{s=Ce(r,A,"JWS Protected Header is invalid");let c=xe(A,Rt,void 0,s,s);a=Ot(s,c)}catch(c){if(!(c instanceof A))throw c;throw new U("Invalid Unsecured JWT",{cause:c})}if(s.alg!=="none")throw new U("Invalid Unsecured JWT");if(!a)throw new U("JWTs MUST NOT use unencoded payload");return{payload:Jt(s,M(n,"payload",U),t),header:s}}}});async function hd(e,t,r){if(typeof e!=="string"||e.indexOf("-----BEGIN PUBLIC KEY-----")!==0)throw TypeError('"spki" must be SPKI formatted string');return td(e,t,r)}async function md(e,t,r){if(typeof e!=="string"||e.indexOf("-----BEGIN CERTIFICATE-----")!==0)throw TypeError('"x509" must be X.509 formatted string');return rd(e,t,r)}async function yd(e,t,r){if(typeof e!=="string"||e.indexOf("-----BEGIN PRIVATE KEY-----")!==0)throw TypeError('"pkcs8" must be PKCS#8 formatted string');return ed(e,t,r)}async function gd(e,t,r){if(!R(e))throw TypeError("JWK must be an object");let n=xt(e),i=qe(r?.extractable),{alg:o}=n;t??=o;let s=i??n.ext;if(n.kty!=="oct"&&!t)throw TypeError('"alg" argument is required when "jwk.alg" is not present');switch(n.kty){case"oct":if(typeof n.k!=="string")throw TypeError('missing "k" (Key Value) Parameter value');return Ae(n.k);case"AKP":{if(typeof o!=="string"||!o)throw TypeError('missing "alg" (Algorithm) Parameter value');if(t!==o)throw TypeError("JWK alg and alg option value mismatch");return Se(rt(t),{...n,ext:s})}case"RSA":case"EC":case"OKP":return Se(rt(t),{...n,alg:t,ext:s});default:throw new _('Unsupported "kty" (Key Type) Parameter value')}}var wd=x(()=>{oe();es();vt();br();k()});function Ed(e){let t;if(typeof e==="string"){let n=e.split(".");if(n.length===3||n.length===5)[t]=n}else if(typeof e==="object"&&e)if("protected"in e)t=e.protected;else throw TypeError("Token does not contain a Protected Header");let r="Invalid Token or Protected Header formatting";if(typeof t!=="string"||!t)throw TypeError(r);return Ce(t,TypeError,r)}var Sd=x(()=>{Q()});function bd(e){if(typeof e!=="string")throw new U("JWTs must use Compact JWS serialization, JWT must be a string");let{1:t,length:r}=e.split(".");if(r===5)throw new U("Only JWTs using Compact JWS serialization can be decoded");if(r!==3)throw new U("Invalid JWT");if(!t)throw new U("JWTs must contain a payload");let n;try{n=Ae(t)}catch{throw new U("Failed to base64url decode the payload")}let i;try{i=JSON.parse(St.decode(n))}catch{throw new U("Failed to parse the decoded payload as JSON")}if(!R(i))throw new U("Invalid JWT Claims Set");return i}var vd=x(()=>{oe();ie();k()});function Yb(e){let t=e?.modulusLength??2048;if(typeof t!=="number"||!Number.isInteger(t)||t<2048)throw new _("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return t}async function Ad(e,t){let r=qe(t?.extractable),n=rt(e,Fe);if(n.secret)tt(Fe);let i;if(n.resolve){let o=t?.crv??"P-256";switch(o){case"P-256":case"P-384":case"P-521":i={name:"ECDH",namedCurve:o};break;case"X25519":i={name:"X25519"};break;default:throw new _("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, and X25519")}}else{if(n.crv!==void 0&&t?.crv!==void 0&&t.crv!==n.crv)throw new _(`Invalid or unsupported crv option provided, the only supported value for ${e} is ${n.crv}`);i=n.kty[0]==="RSA"?{...n.subtle,publicExponent:Uint8Array.of(1,0,1),modulusLength:Yb(t)}:n.subtle}return crypto.subtle.generateKey(i,r??!1,[...n.usages[1],...n.usages[0]])}var xd=x(()=>{k();br()});async function Td(e,t){let r=qe(t?.extractable),n,i,o;switch(e){case"HS256":case"HS384":case"HS512":n=+e.slice(-3),i={name:"HMAC",hash:`SHA-${n}`,length:n},o=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return crypto.getRandomValues(new Uint8Array(+e.slice(-3)>>3));case"A128KW":case"A192KW":case"A256KW":n=+e.slice(1,4),i={name:"AES-KW",length:n},o=["wrapKey","unwrapKey"];break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":n=+e.slice(1,4),i={name:"AES-GCM",length:n},o=["encrypt","decrypt"];break;default:tt(Fe)}return crypto.subtle.generateKey(i,r??!1,o)}var Cd=x(()=>{br()});var cs={};zt(cs,{CompactEncrypt:()=>Ho,CompactSign:()=>Mo,EmbeddedJWK:()=>ad,EncryptJWT:()=>Xo,FlattenedEncrypt:()=>Bo,FlattenedSign:()=>Go,GeneralEncrypt:()=>No,GeneralSign:()=>zo,SignJWT:()=>Vo,UnsecuredJWT:()=>as,base64url:()=>In,calculateJwkThumbprint:()=>rs,calculateJwkThumbprintUri:()=>od,compactDecrypt:()=>ul,compactVerify:()=>xl,createLocalJWKSet:()=>Ar,createRemoteJWKSet:()=>ld,cryptoRuntime:()=>Zb,customFetch:()=>os,decodeJwt:()=>bd,decodeProtectedHeader:()=>Ed,errors:()=>So,exportJWK:()=>ri,exportPKCS8:()=>id,exportSPKI:()=>nd,flattenedDecrypt:()=>ll,flattenedVerify:()=>Cl,generalDecrypt:()=>pl,generalVerify:()=>Rl,generateKeyPair:()=>Ad,generateSecret:()=>Td,importJWK:()=>gd,importPKCS8:()=>yd,importSPKI:()=>hd,importX509:()=>md,jwksCache:()=>ss,jwtDecrypt:()=>Nl,jwtVerify:()=>Pl});var Zb="WebCryptoAPI";var us=x(()=>{fl();dl();hl();gl();Tl();Il();Ol();Kl();$l();Jl();Ll();ql();Ul();Bl();Ml();Gl();sd();cd();ns();dd();pd();ts();wd();Sd();vd();k();xd();Cd();oe()});var ii=m(function(p_,Id){function ni(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="JwksError",this.message=e}ni.prototype=Object.create(Error.prototype);ni.prototype.constructor=ni;Id.exports=ni});var fs=m(function(h_,Od){var Rd=(us(),Or(cs)),Qb=ii();function e0(e){if(e.alg)return e.alg;if(e.kty==="RSA")return"RS256";if(e.kty==="EC")switch(e.crv){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512"}if(e.kty==="OKP")switch(e.crv){case"Ed25519":case"Ed448":return"EdDSA"}throw new Qb("Unsupported JWK")}async function t0(e){let t=[];e=e.filter(({use:r})=>r==="sig"||r===void 0).filter(({kty:r})=>r==="RSA"||r==="EC"||r==="OKP");for(let r of e)try{let n=await Rd.importJWK({...r,ext:!0},e0(r));if(n.type!=="public")continue;let i;switch(n[Symbol.toStringTag]){case"CryptoKey":{let o=await Rd.exportSPKI(n);i=()=>o;break}case"KeyObject":default:i=()=>n.export({format:"pem",type:"spki"})}t.push({get publicKey(){return i()},get rsaPublicKey(){return i()},getPublicKey(){return i()},...typeof r.kid==="string"&&r.kid?{kid:r.kid}:void 0,...typeof r.alg==="string"&&r.alg?{alg:r.alg}:void 0})}catch(n){continue}return t}Od.exports={retrieveSigningKeys:t0}});var ls=m(function(m_,_d){function oi(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="ArgumentError",this.message=e}oi.prototype=Object.create(Error.prototype);oi.prototype.constructor=oi;_d.exports=oi});var Pd=m(function(y_,kd){var r0=require("http"),n0=require("https"),i0=ls();kd.exports.default=(e)=>{if(e.fetcher)return e.fetcher(e.uri);return new Promise((t,r)=>{let n;try{n=new URL(e.uri)}catch(d){throw new i0("Invalid JWKS URI: The provided URI is not a valid URL.")}let{hostname:i,port:o,protocol:s,pathname:a,search:f}=n,c=a+f,u={hostname:i,path:c,port:o,method:"GET",...e.headers&&{headers:{...e.headers}},...e.timeout&&{timeout:e.timeout},...e.agent&&{agent:e.agent}},p=(s==="https:"?n0:r0).request(u,(d)=>{let g="";d.setEncoding("utf8"),d.on("data",(h)=>{g+=h}),d.on("end",()=>{if(d.statusCode<200||d.statusCode>=300){let h=d.body&&(d.body.message||d.body)||d.statusMessage||`Http Error ${d.statusCode}`;r({errorMsg:h})}else try{t(g&&JSON.parse(g))}catch(h){r(h)}})});p.on("timeout",()=>p.destroy()).on("error",(d)=>r(d)).end()})}});var ci=m(function(ai){var Nd=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),o0=Nd((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.tracing=e.metrics=void 0;var t=require("node:diagnostics_channel");e.metrics=(0,t.channel)("lru-cache:metrics"),e.tracing=(0,t.tracingChannel)("lru-cache")}),s0=Nd((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defaultPerf=void 0,e.defaultPerf=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date});Object.defineProperty(ai,"__esModule",{value:!0});ai.LRUCache=void 0;var H=o0(),a0=s0(),ds=()=>H.metrics.hasSubscribers||H.tracing.hasSubscribers,$d=new Set,Kd=typeof process=="object"&&process?process:{},c0=(e,t,r,n)=>{typeof Kd.emitWarning=="function"?Kd.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},u0=(e)=>!$d.has(e),He=(e)=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),Jd=(e)=>He(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?si:null:null,si=class extends Array{constructor(e){super(e),this.fill(0)}},f0=class e{heap;length;static#e=!1;static create(t){let r=Jd(t);if(!r)return[];e.#e=!0;let n=new e(t,r);return e.#e=!1,n}constructor(t,r){if(!e.#e)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},l0=class e{#e;#t;#n;#o;#s;#y;#g;#p;get perf(){return this.#p}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#u;#v;#c;#a;#r;#h;#w;#d;#f;#A;#l;#x;#T;#E;#S;#C;#L;#m;#P;static unsafeExposeInternals(t){return{starts:t.#T,ttls:t.#E,autopurgeTimers:t.#S,sizes:t.#x,keyMap:t.#c,keyList:t.#a,valList:t.#r,next:t.#h,prev:t.#w,get head(){return t.#d},get tail(){return t.#f},free:t.#A,isBackgroundFetch:(r)=>t.#i(r),backgroundFetch:(r,n,i,o)=>t.#D(r,n,i,o),moveToTail:(r)=>t.#J(r),indexes:(r)=>t.#I(r),rindexes:(r)=>t.#R(r),isStale:(r)=>t.#b(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#v}get size(){return this.#u}get fetchMethod(){return this.#y}get memoMethod(){return this.#g}get dispose(){return this.#n}get onInsert(){return this.#o}get disposeAfter(){return this.#s}constructor(t){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:a,allowStale:f,dispose:c,onInsert:u,disposeAfter:l,noDisposeOnSet:p,noUpdateTTL:d,maxSize:g=0,maxEntrySize:h=0,sizeCalculation:S,fetchMethod:E,memoMethod:y,noDeleteOnFetchRejection:T,noDeleteOnStaleGet:I,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:j,ignoreFetchAbort:q,backgroundFetchSize:V=1,perf:N}=t;if(this.backgroundFetchSize=V,N!==void 0&&typeof N?.now!="function")throw TypeError("perf option must have a now() method if specified");if(this.#p=N??a0.defaultPerf,r!==0&&!He(r))throw TypeError("max option must be a nonnegative integer");let ee=r?Jd(r):Array;if(!ee)throw Error("invalid max value: "+r);if(this.#e=r,this.#t=g,this.maxEntrySize=h||this.#t,this.sizeCalculation=S,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw TypeError("memoMethod must be a function if defined");if(this.#g=y,E!==void 0&&typeof E!="function")throw TypeError("fetchMethod must be a function if specified");if(this.#y=E,this.#L=!!E,this.#c=new Map,this.#a=Array.from({length:r}).fill(void 0),this.#r=Array.from({length:r}).fill(void 0),this.#h=new ee(r),this.#w=new ee(r),this.#d=0,this.#f=0,this.#A=f0.create(r),this.#u=0,this.#v=0,typeof c=="function"&&(this.#n=c),typeof u=="function"&&(this.#o=u),typeof l=="function"?(this.#s=l,this.#l=[]):(this.#s=void 0,this.#l=void 0),this.#C=!!this.#n,this.#P=!!this.#o,this.#m=!!this.#s,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!T,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!j,this.ignoreFetchAbort=!!q,this.maxEntrySize!==0){if(this.#t!==0&&!He(this.#t))throw TypeError("maxSize must be a positive integer if specified");if(!He(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#z()}if(this.allowStale=!!f,this.noDeleteOnStaleGet=!!I,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!a,this.ttlResolution=He(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!He(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#F()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let ct="LRU_CACHE_UNBOUNDED";u0(ct)&&($d.add(ct),c0("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ct,e))}}getRemainingTTL(t){return this.#c.has(t)?1/0:0}#F(){let t=new si(this.#e),r=new si(this.#e);this.#E=t,this.#T=r;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#S=n,this.#q=(f,c,u=this.#p.now())=>{r[f]=c!==0?u:0,t[f]=c,i(f,c)},this.#K=(f)=>{r[f]=t[f]!==0?this.#p.now():0,i(f,t[f])};let i=this.ttlAutopurge?(f,c)=>{if(n?.[f]&&(clearTimeout(n[f]),n[f]=void 0),c&&c!==0&&n){let u=setTimeout(()=>{this.#b(f)?(this.#O(this.#a[f],"expire"),n[f]=void 0):i(f,a(f))},c+1);u.unref&&u.unref(),n[f]=u}}:()=>{};this.#_=(f,c)=>{if(t[c]){let u=t[c],l=r[c];if(!u||!l)return;f.ttl=u,f.start=l,f.now=o||s();let p=f.now-l;f.remainingTTL=u-p}};let o=0,s=()=>{let f=this.#p.now();if(this.ttlResolution>0){o=f;let c=setTimeout(()=>o=0,this.ttlResolution);c.unref&&c.unref()}return f};this.getRemainingTTL=(f)=>{let c=this.#c.get(f);return c===void 0?0:a(c)};let a=(f)=>{let c=t[f],u=r[f];if(!c||!u)return 1/0;let l=(o||s())-u;return c-l};this.#b=(f)=>{let c=r[f],u=t[f];return!!u&&!!c&&(o||s())-c>u}}#K=()=>{};#_=()=>{};#q=()=>{};#b=()=>!1;#z(){let t=new si(this.#e);this.#v=0,this.#x=t,this.#N=(r)=>{this.#v-=t[r],t[r]=0},this.#U=(r,n,i,o)=>{if(!He(i)){if(this.#i(n))return this.backgroundFetchSize;if(o){if(typeof o!="function")throw TypeError("sizeCalculation must be a function");if(i=o(n,r),!He(i))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return i},this.#W=(r,n,i)=>{if(t[r]=n,this.#t){let o=this.#t-t[r];for(;this.#v>o;)this.#j(!0)}this.#v+=t[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#v)}}#N=(t)=>{};#W=(t,r,n)=>{};#U=(t,r,n,i)=>{if(n||i)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#I({allowStale:t=this.allowStale}={}){if(this.#u)for(let r=this.#f;this.#H(r)&&((t||!this.#b(r))&&(yield r),r!==this.#d);)r=this.#w[r]}*#R({allowStale:t=this.allowStale}={}){if(this.#u)for(let r=this.#d;this.#H(r)&&((t||!this.#b(r))&&(yield r),r!==this.#f);)r=this.#h[r]}#H(t){return t!==void 0&&this.#c.get(this.#a[t])===t}*entries(){for(let t of this.#I())this.#r[t]!==void 0&&this.#a[t]!==void 0&&!this.#i(this.#r[t])&&(yield[this.#a[t],this.#r[t]])}*rentries(){for(let t of this.#R())this.#r[t]!==void 0&&this.#a[t]!==void 0&&!this.#i(this.#r[t])&&(yield[this.#a[t],this.#r[t]])}*keys(){for(let t of this.#I()){let r=this.#a[t];r!==void 0&&!this.#i(this.#r[t])&&(yield r)}}*rkeys(){for(let t of this.#R()){let r=this.#a[t];r!==void 0&&!this.#i(this.#r[t])&&(yield r)}}*values(){for(let t of this.#I())this.#r[t]!==void 0&&!this.#i(this.#r[t])&&(yield this.#r[t])}*rvalues(){for(let t of this.#R())this.#r[t]!==void 0&&!this.#i(this.#r[t])&&(yield this.#r[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,r={}){for(let n of this.#I()){let i=this.#r[n],o=this.#i(i)?i.__staleWhileFetching:i;if(o!==void 0&&t(o,this.#a[n],this))return this.#$(this.#a[n],r)}}forEach(t,r=this){for(let n of this.#I()){let i=this.#r[n],o=this.#i(i)?i.__staleWhileFetching:i;o!==void 0&&t.call(r,o,this.#a[n],this)}}rforEach(t,r=this){for(let n of this.#R()){let i=this.#r[n],o=this.#i(i)?i.__staleWhileFetching:i;o!==void 0&&t.call(r,o,this.#a[n],this)}}purgeStale(){let t=!1;for(let r of this.#R({allowStale:!0}))this.#b(r)&&(this.#O(this.#a[r],"expire"),t=!0);return t}info(t){let r=this.#c.get(t);if(r===void 0)return;let n=this.#r[r],i=this.#i(n)?n.__staleWhileFetching:n;if(i===void 0)return;let o={value:i};if(this.#E&&this.#T){let s=this.#E[r],a=this.#T[r];if(s&&a){let f=s-(this.#p.now()-a);o.ttl=f,o.start=Date.now()}}return this.#x&&(o.size=this.#x[r]),o}dump(){let t=[];for(let r of this.#I({allowStale:!0})){let n=this.#a[r],i=this.#r[r],o=this.#i(i)?i.__staleWhileFetching:i;if(o===void 0||n===void 0)continue;let s={value:o};if(this.#E&&this.#T){s.ttl=this.#E[r];let a=this.#p.now()-this.#T[r];s.start=Math.floor(Date.now()-a)}this.#x&&(s.size=this.#x[r]),t.unshift([n,s])}return t}load(t){this.clear();for(let[r,n]of t){if(n.start){let i=Date.now()-n.start;n.start=this.#p.now()-i}this.#k(r,n.value,n)}}set(t,r,n={}){let{status:i=H.metrics.hasSubscribers?{}:void 0}=n;n.status=i,i&&(i.op="set",i.key=t,r!==void 0&&(i.value=r),i.cache=this);let o=this.#k(t,r,n);return i&&H.metrics.hasSubscribers&&H.metrics.publish(i),o}#k(t,r,n,i){let{ttl:o=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:f=this.sizeCalculation,status:c}=n,u=this.#i(r);if(r===void 0)return c&&(c.set="deleted"),this.delete(t),this;let{noUpdateTTL:l=this.noUpdateTTL}=n;c&&!u&&(c.value=r);let p=this.#U(t,r,n.size||0,f,c);if(this.maxEntrySize&&p>this.maxEntrySize)return this.#O(t,"set"),c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this;let d=this.#u===0?void 0:this.#c.get(t);if(d===void 0)d=this.#u===0?this.#f:this.#A.length!==0?this.#A.pop():this.#u===this.#e?this.#j(!1):this.#u,this.#a[d]=t,this.#r[d]=r,this.#c.set(t,d),this.#h[this.#f]=d,this.#w[d]=this.#f,this.#f=d,this.#u++,this.#W(d,p,c),c&&(c.set="add"),l=!1,this.#P&&!u&&this.#o?.(r,t,"add");else{this.#J(d);let g=this.#r[d];if(r!==g){if(!a)if(this.#i(g)){g!==i&&g.__abortController.abort(Error("replaced"));let{__staleWhileFetching:h}=g;h!==void 0&&h!==r&&(this.#C&&this.#n?.(h,t,"set"),this.#m&&this.#l?.push([h,t,"set"]))}else this.#C&&this.#n?.(g,t,"set"),this.#m&&this.#l?.push([g,t,"set"]);if(this.#N(d),this.#W(d,p,c),this.#r[d]=r,!u){let h=g&&this.#i(g)?g.__staleWhileFetching:g,S=h===void 0?"add":r!==h?"replace":"update";c&&(c.set=S,h!==void 0&&(c.oldValue=h)),this.#P&&this.onInsert?.(r,t,S)}}else u||(c&&(c.set="update"),this.#P&&this.onInsert?.(r,t,"update"))}if(o!==0&&!this.#E&&this.#F(),this.#E&&(l||this.#q(d,o,s),c&&this.#_(c,d)),!a&&this.#m&&this.#l){let g=this.#l,h;for(;h=g?.shift();)this.#s?.(...h)}return this}pop(){try{for(;this.#u;){let t=this.#r[this.#d];if(this.#j(!0),this.#i(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#m&&this.#l){let t=this.#l,r;for(;r=t?.shift();)this.#s?.(...r)}}}#j(t){let r=this.#d,n=this.#a[r],i=this.#r[r],o=this.#i(i);o&&i.__abortController.abort(Error("evicted"));let s=o?i.__staleWhileFetching:i;return(this.#C||this.#m)&&s!==void 0&&(this.#C&&this.#n?.(s,n,"evict"),this.#m&&this.#l?.push([s,n,"evict"])),this.#N(r),this.#S?.[r]&&(clearTimeout(this.#S[r]),this.#S[r]=void 0),t&&(this.#a[r]=void 0,this.#r[r]=void 0,this.#A.push(r)),this.#u===1?(this.#d=this.#f=0,this.#A.length=0):this.#d=this.#h[r],this.#c.delete(n),this.#u--,r}has(t,r={}){let{status:n=H.metrics.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="has",n.key=t,n.cache=this);let i=this.#V(t,r);return H.metrics.hasSubscribers&&H.metrics.publish(n),i}#V(t,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,o=this.#c.get(t);if(o!==void 0){let s=this.#r[o];if(this.#i(s)&&s.__staleWhileFetching===void 0)return!1;if(this.#b(o))i&&(i.has="stale",this.#_(i,o));else return n&&this.#K(o),i&&(i.has="hit",this.#_(i,o)),!0}else i&&(i.has="miss");return!1}peek(t,r={}){let{status:n=ds()?{}:void 0}=r;n&&(n.op="peek",n.key=t,n.cache=this),r.status=n;let i=this.#X(t,r);return H.metrics.hasSubscribers&&H.metrics.publish(n),i}#X(t,r){let{status:n,allowStale:i=this.allowStale}=r,o=this.#c.get(t);if(o===void 0||!i&&this.#b(o)){n&&(n.peek=o===void 0?"miss":"stale");return}let s=this.#r[o],a=this.#i(s)?s.__staleWhileFetching:s;return n&&(a!==void 0?(n.peek="hit",n.value=a):n.peek="miss"),a}#D(t,r,n,i){let o=r===void 0?void 0:this.#r[r];if(this.#i(o))return o;let s=new AbortController,{signal:a}=n;a?.addEventListener("abort",()=>s.abort(a.reason),{signal:s.signal});let f={signal:s.signal,options:n,context:i},c=(h,S=!1)=>{let{aborted:E}=s.signal,y=n.ignoreFetchAbort&&h!==void 0,T=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&h!==void 0);if(n.status&&(E&&!S?(n.status.fetchAborted=!0,n.status.fetchError=s.signal.reason,y&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),E&&!y&&!S)return l(s.signal.reason,T);let I=d,O=this.#r[r];return(O===d||O===void 0&&y&&S)&&(h===void 0?I.__staleWhileFetching!==void 0?this.#r[r]=I.__staleWhileFetching:this.#O(t,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.#k(t,h,f.options,I))),h},u=(h)=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=h),l(h,!1)),l=(h,S)=>{let{aborted:E}=s.signal,y=E&&n.allowStaleOnFetchAbort,T=y||n.allowStaleOnFetchRejection,I=T||n.noDeleteOnFetchRejection,O=d;if(this.#r[r]===d&&(!I||!S&&O.__staleWhileFetching===void 0?this.#O(t,"fetch"):y||(this.#r[r]=O.__staleWhileFetching)),T)return n.status&&O.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),O.__staleWhileFetching;if(O.__returned===O)throw h},p=(h,S)=>{let E=this.#y?.(t,o,f);s.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(h(void 0),n.allowStaleOnFetchAbort&&(h=(y)=>c(y,!0)))}),E&&E instanceof Promise?E.then((y)=>h(y===void 0?void 0:y),S):E!==void 0&&h(E)};n.status&&(n.status.fetchDispatched=!0);let d=new Promise(p).then(c,u),g=Object.assign(d,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.#k(t,g,{...f.options,status:void 0}),r=this.#c.get(t)):this.#r[r]=g,g}#i(t){if(!this.#L)return!1;let r=t;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof AbortController}fetch(t,r={}){let n=H.tracing.hasSubscribers,{status:i=ds()?{}:void 0}=r;r.status=i,i&&r.context&&(i.context=r.context);let o=this.#B(t,r);return i&&n&&(i.trace=!0,H.tracing.tracePromise(()=>o,i).catch(()=>{})),o}async#B(t,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:f=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:h,forceRefresh:S=!1,status:E,signal:y}=r;if(E&&(E.op="fetch",E.key=t,S&&(E.forceRefresh=!0),E.cache=this),!this.#L)return E&&(E.fetch="get"),this.#$(t,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,status:E});let T={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:a,size:f,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:g,ignoreFetchAbort:d,status:E,signal:y},I=this.#c.get(t);if(I===void 0){E&&(E.fetch="miss");let O=this.#D(t,I,T,h);return O.__returned=O}else{let O=this.#r[I];if(this.#i(O)){let N=n&&O.__staleWhileFetching!==void 0;return E&&(E.fetch="inflight",N&&(E.returnedStale=!0)),N?O.__staleWhileFetching:O.__returned=O}let j=this.#b(I);if(!S&&!j)return E&&(E.fetch="hit"),this.#J(I),i&&this.#K(I),E&&this.#_(E,I),O;let q=this.#D(t,I,T,h),V=q.__staleWhileFetching!==void 0&&n;return E&&(E.fetch=j?"stale":"refresh",V&&j&&(E.returnedStale=!0)),V?q.__staleWhileFetching:q.__returned=q}}forceFetch(t,r={}){let n=H.tracing.hasSubscribers,{status:i=ds()?{}:void 0}=r;r.status=i,i&&r.context&&(i.context=r.context);let o=this.#Y(t,r);return i&&n&&(i.trace=!0,H.tracing.tracePromise(()=>o,i).catch(()=>{})),o}async#Y(t,r={}){let n=await this.#B(t,r);if(n===void 0)throw Error("fetch() returned undefined");return n}memo(t,r={}){let{status:n=H.metrics.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="memo",n.key=t,r.context&&(n.context=r.context),n.cache=this);let i=this.#Z(t,r);return n&&(n.value=i),H.metrics.hasSubscribers&&H.metrics.publish(n),i}#Z(t,r={}){let n=this.#g;if(!n)throw Error("no memoMethod provided to constructor");let{context:i,status:o,forceRefresh:s,...a}=r;o&&s&&(o.forceRefresh=!0);let f=this.#$(t,a),c=s||f===void 0;if(o&&(o.memo=c?"miss":"hit",c||(o.value=f)),!c)return f;let u=n(t,f,{options:a,context:i});return o&&(o.value=u),this.#k(t,u,a),u}get(t,r={}){let{status:n=H.metrics.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="get",n.key=t,n.cache=this);let i=this.#$(t,r);return n&&(i!==void 0&&(n.value=i),H.metrics.hasSubscribers&&H.metrics.publish(n)),i}#$(t,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=r,a=this.#c.get(t);if(a===void 0){s&&(s.get="miss");return}let f=this.#r[a],c=this.#i(f);return s&&this.#_(s,a),this.#b(a)?c?(s&&(s.get="stale-fetching"),n&&f.__staleWhileFetching!==void 0?(s&&(s.returnedStale=!0),f.__staleWhileFetching):void 0):(o||this.#O(t,"expire"),s&&(s.get="stale"),n?(s&&(s.returnedStale=!0),f):void 0):(s&&(s.get=c?"fetching":"hit"),this.#J(a),i&&this.#K(a),c?f.__staleWhileFetching:f)}#M(t,r){this.#w[r]=t,this.#h[t]=r}#J(t){t!==this.#f&&(t===this.#d?this.#d=this.#h[t]:this.#M(this.#w[t],this.#h[t]),this.#M(this.#f,t),this.#f=t)}delete(t){return this.#O(t,"delete")}#O(t,r){H.metrics.hasSubscribers&&H.metrics.publish({op:"delete",delete:r,key:t,cache:this});let n=!1;if(this.#u!==0){let i=this.#c.get(t);if(i!==void 0)if(this.#S?.[i]&&(clearTimeout(this.#S[i]),this.#S[i]=void 0),n=!0,this.#u===1)this.#G(r);else{this.#N(i);let o=this.#r[i];if(this.#i(o)?o.__abortController.abort(Error("deleted")):(this.#C||this.#m)&&(this.#C&&this.#n?.(o,t,r),this.#m&&this.#l?.push([o,t,r])),this.#c.delete(t),this.#a[i]=void 0,this.#r[i]=void 0,i===this.#f)this.#f=this.#w[i];else if(i===this.#d)this.#d=this.#h[i];else{let s=this.#w[i];this.#h[s]=this.#h[i];let a=this.#h[i];this.#w[a]=this.#w[i]}this.#u--,this.#A.push(i)}}if(this.#m&&this.#l?.length){let i=this.#l,o;for(;o=i?.shift();)this.#s?.(...o)}return n}clear(){return this.#G("delete")}#G(t){for(let r of this.#R({allowStale:!0})){let n=this.#r[r];if(this.#i(n))n.__abortController.abort(Error("deleted"));else{let i=this.#a[r];this.#C&&this.#n?.(n,i,t),this.#m&&this.#l?.push([n,i,t])}}if(this.#c.clear(),this.#r.fill(void 0),this.#a.fill(void 0),this.#E&&this.#T){this.#E.fill(0),this.#T.fill(0);for(let r of this.#S??[])r!==void 0&&clearTimeout(r);this.#S?.fill(void 0)}if(this.#x&&this.#x.fill(0),this.#d=0,this.#f=0,this.#A.length=0,this.#v=0,this.#u=0,this.#m&&this.#l){let r=this.#l,n;for(;n=r?.shift();)this.#s?.(...n)}}};ai.LRUCache=l0});var Is=m(function(Tr,jt){var d0=200,zd="__lodash_hash_undefined__",Vd=9007199254740991,Ss="[object Arguments]",p0="[object Array]",Xd="[object Boolean]",Yd="[object Date]",h0="[object Error]",bs="[object Function]",Zd="[object GeneratorFunction]",ui="[object Map]",Qd="[object Number]",vs="[object Object]",Ld="[object Promise]",ep="[object RegExp]",fi="[object Set]",tp="[object String]",rp="[object Symbol]",hs="[object WeakMap]",np="[object ArrayBuffer]",li="[object DataView]",ip="[object Float32Array]",op="[object Float64Array]",sp="[object Int8Array]",ap="[object Int16Array]",cp="[object Int32Array]",up="[object Uint8Array]",fp="[object Uint8ClampedArray]",lp="[object Uint16Array]",dp="[object Uint32Array]",m0=/[\\^$.*+?()[\]{}|]/g,y0=/\w*$/,g0=/^\[object .+?Constructor\]$/,w0=/^(?:0|[1-9]\d*)$/,L={};L[Ss]=L[p0]=L[np]=L[li]=L[Xd]=L[Yd]=L[ip]=L[op]=L[sp]=L[ap]=L[cp]=L[ui]=L[Qd]=L[vs]=L[ep]=L[fi]=L[tp]=L[rp]=L[up]=L[fp]=L[lp]=L[dp]=!0;L[h0]=L[bs]=L[hs]=!1;var E0=typeof global=="object"&&global&&global.Object===Object&&global,S0=typeof self=="object"&&self&&self.Object===Object&&self,_e=E0||S0||Function("return this")(),pp=typeof Tr=="object"&&Tr&&!Tr.nodeType&&Tr,Wd=pp&&typeof jt=="object"&&jt&&!jt.nodeType&&jt,b0=Wd&&Wd.exports===pp;function v0(e,t){return e.set(t[0],t[1]),e}function A0(e,t){return e.add(t),e}function x0(e,t){var r=-1,n=e?e.length:0;while(++r<n)if(t(e[r],r,e)===!1)break;return e}function T0(e,t){var r=-1,n=t.length,i=e.length;while(++r<n)e[i+r]=t[r];return e}function hp(e,t,r,n){var i=-1,o=e?e.length:0;if(n&&o)r=e[++i];while(++i<o)r=t(r,e[i],i,e);return r}function C0(e,t){var r=-1,n=Array(e);while(++r<e)n[r]=t(r);return n}function I0(e,t){return e==null?void 0:e[t]}function mp(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function jd(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function As(e,t){return function(r){return e(t(r))}}function Dd(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var R0=Array.prototype,O0=Function.prototype,di=Object.prototype,ps=_e["__core-js_shared__"],Fd=function(){var e=/[^.]+$/.exec(ps&&ps.keys&&ps.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),yp=O0.toString,Be=di.hasOwnProperty,pi=di.toString,_0=RegExp("^"+yp.call(Be).replace(m0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qd=b0?_e.Buffer:void 0,Ud=_e.Symbol,Hd=_e.Uint8Array,k0=As(Object.getPrototypeOf,Object),P0=Object.create,K0=di.propertyIsEnumerable,N0=R0.splice,Bd=Object.getOwnPropertySymbols,$0=qd?qd.isBuffer:void 0,J0=As(Object.keys,Object),ms=qt(_e,"DataView"),Cr=qt(_e,"Map"),ys=qt(_e,"Promise"),gs=qt(_e,"Set"),ws=qt(_e,"WeakMap"),Ir=qt(Object,"create"),L0=ot(ms),W0=ot(Cr),j0=ot(ys),D0=ot(gs),F0=ot(ws),Md=Ud?Ud.prototype:void 0,Gd=Md?Md.valueOf:void 0;function it(e){var t=-1,r=e?e.length:0;this.clear();while(++t<r){var n=e[t];this.set(n[0],n[1])}}function q0(){this.__data__=Ir?Ir(null):{}}function U0(e){return this.has(e)&&delete this.__data__[e]}function H0(e){var t=this.__data__;if(Ir){var r=t[e];return r===zd?void 0:r}return Be.call(t,e)?t[e]:void 0}function B0(e){var t=this.__data__;return Ir?t[e]!==void 0:Be.call(t,e)}function M0(e,t){var r=this.__data__;return r[e]=Ir&&t===void 0?zd:t,this}it.prototype.clear=q0;it.prototype.delete=U0;it.prototype.get=H0;it.prototype.has=B0;it.prototype.set=M0;function ke(e){var t=-1,r=e?e.length:0;this.clear();while(++t<r){var n=e[t];this.set(n[0],n[1])}}function G0(){this.__data__=[]}function z0(e){var t=this.__data__,r=hi(t,e);if(r<0)return!1;var n=t.length-1;if(r==n)t.pop();else N0.call(t,r,1);return!0}function V0(e){var t=this.__data__,r=hi(t,e);return r<0?void 0:t[r][1]}function X0(e){return hi(this.__data__,e)>-1}function Y0(e,t){var r=this.__data__,n=hi(r,e);if(n<0)r.push([e,t]);else r[n][1]=t;return this}ke.prototype.clear=G0;ke.prototype.delete=z0;ke.prototype.get=V0;ke.prototype.has=X0;ke.prototype.set=Y0;function Dt(e){var t=-1,r=e?e.length:0;this.clear();while(++t<r){var n=e[t];this.set(n[0],n[1])}}function Z0(){this.__data__={hash:new it,map:new(Cr||ke),string:new it}}function Q0(e){return mi(this,e).delete(e)}function ev(e){return mi(this,e).get(e)}function tv(e){return mi(this,e).has(e)}function rv(e,t){return mi(this,e).set(e,t),this}Dt.prototype.clear=Z0;Dt.prototype.delete=Q0;Dt.prototype.get=ev;Dt.prototype.has=tv;Dt.prototype.set=rv;function Ft(e){this.__data__=new ke(e)}function nv(){this.__data__=new ke}function iv(e){return this.__data__.delete(e)}function ov(e){return this.__data__.get(e)}function sv(e){return this.__data__.has(e)}function av(e,t){var r=this.__data__;if(r instanceof ke){var n=r.__data__;if(!Cr||n.length<d0-1)return n.push([e,t]),this;r=this.__data__=new Dt(n)}return r.set(e,t),this}Ft.prototype.clear=nv;Ft.prototype.delete=iv;Ft.prototype.get=ov;Ft.prototype.has=sv;Ft.prototype.set=av;function cv(e,t){var r=Ts(e)||Pv(e)?C0(e.length,String):[],n=r.length,i=!!n;for(var o in e)if((t||Be.call(e,o))&&!(i&&(o=="length"||Rv(o,n))))r.push(o);return r}function gp(e,t,r){var n=e[t];if(!(Be.call(e,t)&&bp(n,r))||r===void 0&&!(t in e))e[t]=r}function hi(e,t){var r=e.length;while(r--)if(bp(e[r][0],t))return r;return-1}function uv(e,t){return e&&wp(t,Cs(t),e)}function Es(e,t,r,n,i,o,s){var a;if(n)a=o?n(e,i,o,s):n(e);if(a!==void 0)return a;if(!yi(e))return e;var f=Ts(e);if(f){if(a=Tv(e),!t)return vv(e,a)}else{var c=nt(e),u=c==bs||c==Zd;if(Nv(e))return mv(e,t);if(c==vs||c==Ss||u&&!o){if(mp(e))return o?e:{};if(a=Cv(u?{}:e),!t)return Av(e,uv(a,e))}else{if(!L[c])return o?e:{};a=Iv(e,c,Es,t)}}s||(s=new Ft);var l=s.get(e);if(l)return l;if(s.set(e,a),!f)var p=r?xv(e):Cs(e);return x0(p||e,function(d,g){if(p)g=d,d=e[g];gp(a,g,Es(d,t,r,n,g,e,s))}),a}function fv(e){return yi(e)?P0(e):{}}function lv(e,t,r){var n=t(e);return Ts(e)?n:T0(n,r(e))}function dv(e){return pi.call(e)}function pv(e){if(!yi(e)||_v(e))return!1;var t=Ap(e)||mp(e)?_0:g0;return t.test(ot(e))}function hv(e){if(!Sp(e))return J0(e);var t=[];for(var r in Object(e))if(Be.call(e,r)&&r!="constructor")t.push(r);return t}function mv(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function xs(e){var t=new e.constructor(e.byteLength);return new Hd(t).set(new Hd(e)),t}function yv(e,t){var r=t?xs(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function gv(e,t,r){var n=t?r(jd(e),!0):jd(e);return hp(n,v0,new e.constructor)}function wv(e){var t=new e.constructor(e.source,y0.exec(e));return t.lastIndex=e.lastIndex,t}function Ev(e,t,r){var n=t?r(Dd(e),!0):Dd(e);return hp(n,A0,new e.constructor)}function Sv(e){return Gd?Object(Gd.call(e)):{}}function bv(e,t){var r=t?xs(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function vv(e,t){var r=-1,n=e.length;t||(t=Array(n));while(++r<n)t[r]=e[r];return t}function wp(e,t,r,n){r||(r={});var i=-1,o=t.length;while(++i<o){var s=t[i],a=n?n(r[s],e[s],s,r,e):void 0;gp(r,s,a===void 0?e[s]:a)}return r}function Av(e,t){return wp(e,Ep(e),t)}function xv(e){return lv(e,Cs,Ep)}function mi(e,t){var r=e.__data__;return Ov(t)?r[typeof t=="string"?"string":"hash"]:r.map}function qt(e,t){var r=I0(e,t);return pv(r)?r:void 0}var Ep=Bd?As(Bd,Object):Lv,nt=dv;if(ms&&nt(new ms(new ArrayBuffer(1)))!=li||Cr&&nt(new Cr)!=ui||ys&&nt(ys.resolve())!=Ld||gs&&nt(new gs)!=fi||ws&&nt(new ws)!=hs)nt=function(e){var t=pi.call(e),r=t==vs?e.constructor:void 0,n=r?ot(r):void 0;if(n)switch(n){case L0:return li;case W0:return ui;case j0:return Ld;case D0:return fi;case F0:return hs}return t};function Tv(e){var t=e.length,r=e.constructor(t);if(t&&typeof e[0]=="string"&&Be.call(e,"index"))r.index=e.index,r.input=e.input;return r}function Cv(e){return typeof e.constructor=="function"&&!Sp(e)?fv(k0(e)):{}}function Iv(e,t,r,n){var i=e.constructor;switch(t){case np:return xs(e);case Xd:case Yd:return new i(+e);case li:return yv(e,n);case ip:case op:case sp:case ap:case cp:case up:case fp:case lp:case dp:return bv(e,n);case ui:return gv(e,n,r);case Qd:case tp:return new i(e);case ep:return wv(e);case fi:return Ev(e,n,r);case rp:return Sv(e)}}function Rv(e,t){return t=t==null?Vd:t,!!t&&(typeof e=="number"||w0.test(e))&&(e>-1&&e%1==0&&e<t)}function Ov(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function _v(e){return!!Fd&&Fd in e}function Sp(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||di;return e===r}function ot(e){if(e!=null){try{return yp.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function kv(e){return Es(e,!0,!0)}function bp(e,t){return e===t||e!==e&&t!==t}function Pv(e){return Kv(e)&&Be.call(e,"callee")&&(!K0.call(e,"callee")||pi.call(e)==Ss)}var Ts=Array.isArray;function vp(e){return e!=null&&$v(e.length)&&!Ap(e)}function Kv(e){return Jv(e)&&vp(e)}var Nv=$0||Wv;function Ap(e){var t=yi(e)?pi.call(e):"";return t==bs||t==Zd}function $v(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Vd}function yi(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Jv(e){return!!e&&typeof e=="object"}function Cs(e){return vp(e)?cv(e):hv(e)}function Lv(){return[]}function Wv(){return!1}jt.exports=kv});var Rs=m(function(gi){Object.defineProperty(gi,"__esModule",{value:!0});gi.deepFreeze=void 0;function xp(e){if(e)Object.freeze(e),Object.getOwnPropertyNames(e).forEach(function(t){if(e.hasOwnProperty(t)&&e[t]!==null&&(typeof e[t]==="object"||typeof e[t]==="function")&&e[t].constructor!==Buffer&&!Object.isFrozen(e[t]))xp(e[t])});return e}gi.deepFreeze=xp});var Ip=m(function(Ut){var jv=Ut&&Ut.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.syncMemoizer=void 0;var Dv=ci(),Fv=require("events"),Tp=jv(Is()),Cp=Rs();function qv(e){let t=new Dv.LRUCache(e),r=e.load,n=e.hash,i=e.bypass,o=e.itemTTL,s=e.freeze,a=e.clone,f=new Fv.EventEmitter,c=Object.assign({del:u,reset:()=>t.clear(),keys:()=>[...t.keys()],on:f.on.bind(f),once:f.once.bind(f)},e);if(e.disable)return Object.assign(r,c);function u(){let h=n(...arguments);t.delete(h)}function l(h,...S){f.emit(h,...S)}function p(h){return h&&h.then&&typeof h.then==="function"}function d(h){let S=h;if(a)if(p(S))S=S.then(Tp.default);else S=(0,Tp.default)(S);if(s)if(p(S))S=S.then(Cp.deepFreeze);else(0,Cp.deepFreeze)(S);return S}return Object.assign(function(...h){if(i&&i(...h))return l("miss",...h),r(...h);var S=n(...h),E=t.get(S);if(E)return l("hit",...h),d(E);l("miss",...h);let y=r(...h);if(o)t.set(S,y,{ttl:o(...h.concat([y]))});else t.set(S,y);return d(y)},c)}Ut.syncMemoizer=qv});var Op=m(function(Ht){var Uv=Ht&&Ht.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.asyncMemoizer=void 0;var Hv=ci(),Bv=require("events"),Mv=Uv(Is()),Gv=Rs(),zv=Ip();function Rp(e){let t=new Hv.LRUCache(e),r=e.load,n=e.hash,i=e.bypass,o=e.itemTTL,s=e.freeze,a=e.clone,f=e.queueTTL||1000,c=new Map,u=new Bv.EventEmitter,l=Object.assign({del:p,reset:()=>t.clear(),keys:()=>[...t.keys()],on:u.on.bind(u),once:u.once.bind(u)},e);if(e.disable)return Object.assign(r,l);function p(...E){let y=n(...E);t.delete(y)}function d(E,y,T){if(s)T.forEach(Gv.deepFreeze);if(o)t.set(E,T,{ttl:o(...y.concat(T))});else t.set(E,T)}function g(E,y){for(let T of E)if(a)setImmediate(T,...y.map(Mv.default));else setImmediate(T,...y)}function h(E,...y){u.emit(E,...y)}function S(...E){let y=E.slice(0,-1),T=E.slice(-1).pop(),I;if(i&&i(...y))return h("miss",...y),r(...E);if(y.length===0&&!n)I="_";else I=n(...y);let O=t.get(I);if(O)return h("hit",...y),g([T],[null].concat(O));let j=c.get(I);if(j&&j.expiresAt>Date.now()){j.queue.push(T),h("queue",...y);return}h("miss",...y);let q=Date.now(),V=[T];c.set(I,{queue:V,expiresAt:q+f});let N=(...ee)=>{if(!ee[0])d(I,y,ee.slice(1));c.delete(I),h("loaded",Date.now()-q,...y),g(V,ee)};r(...y,N)}return Object.assign(S,l)}Ht.asyncMemoizer=Rp;Rp.sync=zv.syncMemoizer});var kp=m(function(v_,_p){var Vv=Op();_p.exports=Vv.asyncMemoizer});var Np=m(function(A_,Kp){var Os=mn()("jwks"),Xv=kp(),{LRUCache:Yv}=ci(),{promisify:Zv,callbackify:Pp}=require("util");function Qv(e,{cacheMaxEntries:t=5,cacheMaxAge:r=600000,cacheMaxAgeFallback:n,onStaleCacheFallback:i}){Os(`Configured caching of signing keys. Max: ${t} / Age: ${r}${n?` / Fallback: ${n}`:""}`);let o;if(n){let s=new Yv({max:t}),a=e.getSigningKey.bind(e);o=Pp(async(f)=>{try{let c=await a(f);return s.set(f,{key:c,fetchedAt:Date.now()}),c}catch(c){if(c.isEndpointUnavailable){let u=s.get(f);if(u&&Date.now()-u.fetchedAt<r+n){if(Os(`JWKS endpoint unavailable, serving stale signing key for '${f}': ${c.message}`),i)i(c,f,u.key);return u.key}Os(`JWKS endpoint unavailable and no valid stale entry for '${f}', fallback window expired or key never fetched`)}throw c}})}else o=Pp(e.getSigningKey.bind(e));return Zv(Xv({hash:(s)=>s,load:o,ttl:r,max:t}))}Kp.exports.default=Qv});var _s=m(function(x_,Jp){var $p=function(e,t,r,n){if(this.bucketSize=e,this.tokensPerInterval=t,typeof r==="string")switch(r){case"sec":case"second":this.interval=1000;break;case"min":case"minute":this.interval=60000;break;case"hr":case"hour":this.interval=3600000;break;case"day":this.interval=86400000;break;default:throw Error("Invaid interval "+r)}else this.interval=r;this.parentBucket=n,this.content=0,this.lastDrip=+new Date};$p.prototype={bucketSize:1,tokensPerInterval:1,interval:1000,parentBucket:null,content:0,lastDrip:0,removeTokens:function(e,t){var r=this;if(!this.bucketSize)return process.nextTick(t.bind(null,null,e,Number.POSITIVE_INFINITY)),!0;if(e>this.bucketSize)return process.nextTick(t.bind(null,"Requested tokens "+e+" exceeds bucket size "+this.bucketSize,null)),!1;if(this.drip(),e>this.content)return n();if(this.parentBucket)return this.parentBucket.removeTokens(e,function(i,o){if(i)return t(i,null);if(e>r.content)return n();r.content-=e,t(null,Math.min(o,r.content))});else return this.content-=e,process.nextTick(t.bind(null,null,this.content)),!0;function n(){var i=Math.ceil((e-r.content)*(r.interval/r.tokensPerInterval));return setTimeout(function(){r.removeTokens(e,t)},i),!1}},tryRemoveTokens:function(e){if(!this.bucketSize)return!0;if(e>this.bucketSize)return!1;if(this.drip(),e>this.content)return!1;if(this.parentBucket&&!this.parentBucket.tryRemoveTokens(e))return!1;return this.content-=e,!0},drip:function(){if(!this.tokensPerInterval){this.content=this.bucketSize;return}var e=+new Date,t=Math.max(e-this.lastDrip,0);this.lastDrip=e;var r=t*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+r,this.bucketSize)}};Jp.exports=$p});var Wp=m(function(T_,Lp){var eA=function(){if(typeof process<"u"&&process.hrtime){var e=process.hrtime(),t=e[0],r=e[1];return t*1000+Math.floor(r/1e6)}return new Date().getTime()};Lp.exports=eA});var Fp=m(function(C_,Dp){var tA=_s(),ks=Wp(),jp=function(e,t,r){this.tokenBucket=new tA(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=ks(),this.tokensThisInterval=0,this.fireImmediately=r};jp.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(e,t){if(e>this.tokenBucket.bucketSize)return process.nextTick(t.bind(null,"Requested tokens "+e+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var r=this,n=ks();if(n<this.curIntervalStart||n-this.curIntervalStart>=this.tokenBucket.interval)this.curIntervalStart=n,this.tokensThisInterval=0;if(e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)process.nextTick(t.bind(null,null,-1));else{var i=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-n);setTimeout(function(){r.tokenBucket.removeTokens(e,o)},i)}return!1}return this.tokenBucket.removeTokens(e,o);function o(s,a){if(s)return t(s,null);r.tokensThisInterval+=e,t(null,a)}},tryRemoveTokens:function(e){if(e>this.tokenBucket.bucketSize)return!1;var t=ks();if(t<this.curIntervalStart||t-this.curIntervalStart>=this.tokenBucket.interval)this.curIntervalStart=t,this.tokensThisInterval=0;if(e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var r=this.tokenBucket.tryRemoveTokens(e);if(r)this.tokensThisInterval+=e;return r},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}};Dp.exports=jp});var qp=m(function(Ps){Ps.RateLimiter=Fp();Ps.TokenBucket=_s()});var Ks=m(function(R_,Up){function wi(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="JwksRateLimitError",this.message=e}wi.prototype=Object.create(Error.prototype);wi.prototype.constructor=wi;Up.exports=wi});var Bp=m(function(O_,Hp){var Ns=mn()("jwks"),{RateLimiter:rA}=qp(),nA=Ks();function iA(e,{jwksRequestsPerMinute:t=10}){let r=e.getSigningKey.bind(e),n=new rA(t,"minute",!0);return Ns(`Configured rate limiting to JWKS endpoint at ${t}/minute`),async(i)=>await new Promise((o,s)=>{n.removeTokens(1,async(a,f)=>{if(a)s(a);if(Ns("Requests to the JWKS endpoint available for the next minute:",f),f<0)Ns("Too many requests to the JWKS endpoint"),s(new nA("Too many requests to the JWKS endpoint"));else try{let c=await r(i);o(c)}catch(c){s(c)}})})}Hp.exports.default=iA});var Gp=m(function(__,Mp){var oA=fs().retrieveSigningKeys;function sA(e,{getKeysInterceptor:t}){let r=e.getSigningKey.bind(e);return async(n)=>{let i=await t(),o;if(i&&i.length)o=await oA(i);if(o&&o.length){let s=o.find((a)=>!n||a.kid===n);if(s)return s}return r(n)}}Mp.exports.default=sA});var Vp=m(function(k_,zp){var{callbackify:aA}=require("util"),cA=(e)=>{let t=e.getSigningKey.bind(e);return(r,n)=>{if(n)return aA(t)(r,n);return t(r)}};zp.exports.default=cA});var Yp=m(function(P_,Xp){Xp.exports={request:Pd().default,cacheSigningKey:Np().default,rateLimitSigningKey:Bp().default,getKeysInterceptor:Gp().default,callbackSupport:Vp().default}});var $s=m(function(K_,Zp){function Ei(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="SigningKeyNotFoundError",this.message=e}Ei.prototype=Object.create(Error.prototype);Ei.prototype.constructor=Ei;Zp.exports=Ei});var Bt=m(function(N_,th){var st=mn()("jwks"),{retrieveSigningKeys:uA}=fs(),{request:fA,cacheSigningKey:lA,rateLimitSigningKey:dA,getKeysInterceptor:pA,callbackSupport:hA}=Yp(),Js=ii(),Qp=$s();class eh{constructor(e){if(this.options={rateLimit:!1,cache:!0,timeout:30000,...e},this.options.getKeysInterceptor)this.getSigningKey=pA(this,e);if(this.options.rateLimit)this.getSigningKey=dA(this,e);if(this.options.cache)this.getSigningKey=lA(this,e);this.getSigningKey=hA(this,e)}async getKeys(){st(`Fetching keys from '${this.options.jwksUri}'`);try{let e=await fA({uri:this.options.jwksUri,headers:this.options.requestHeaders,agent:this.options.requestAgent,timeout:this.options.timeout,fetcher:this.options.fetcher});return st("Keys:",e.keys),e.keys}catch(e){let{errorMsg:t}=e;st("Failure:",t||e);let r=t?new Js(t):e;throw r.isEndpointUnavailable=!0,r}}async getSigningKeys(){let e=await this.getKeys();if(!e||!e.length)throw new Js("The JWKS endpoint did not contain any keys");let t=await uA(e);if(!t.length)throw new Js("The JWKS endpoint did not contain any signing keys");return st("Signing Keys:",t),t}async getSigningKey(e){st(`Fetching signing key for '${e}'`);let t=await this.getSigningKeys(),r=e!==void 0&&e!==null;if(!r&&t.length>1)throw st("No KID specified and JWKS endpoint returned more than 1 key"),new Qp("No KID specified and JWKS endpoint returned more than 1 key");let n=t.find((i)=>!r||i.kid===e);if(n)return n;else throw st(`Unable to find a signing key that matches '${e}'`),new Qp(`Unable to find a signing key that matches '${e}'`)}}th.exports={JwksClient:eh}});var Mt=m(function($_,rh){rh.exports={ArgumentError:ls(),JwksError:ii(),JwksRateLimitError:Ks(),SigningKeyNotFoundError:$s()}});var Rr=m(function(J_,nh){var mA=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512","EdDSA"];nh.exports=mA});var ih=m(function(L_,Si){var{ArgumentError:yA}=Mt(),{JwksClient:gA}=Bt(),wA=Rr(),EA=(e,t)=>{if(e&&e.name==="SigningKeyNotFoundError")return t(e,null,null);if(e)return t(e,null,null)};Si.exports.hapiJwt2KeyAsync=(e)=>{let t=Si.exports.hapiJwt2Key(e);return function(r){return new Promise((n,i)=>{t(r,(s,a)=>{!a||s?i(s):n({key:a})})})}};Si.exports.hapiJwt2Key=function(e){if(e===null||e===void 0)throw new yA("An options object must be provided when initializing hapiJwt2Key");let t=new gA(e),r=e.handleSigningKeyError||EA;return function(i,o){if(!i||!i.header)return o(Error("Cannot find a signing certificate if there is no header"),null,null);if(!wA.includes(i.header.alg))return o(Error("Unsupported algorithm "+i.header.alg+" supplied."),null,null);t.getSigningKey(i.header.kid).then((s)=>o(null,s.publicKey||s.rsaPublicKey,s)).catch((s)=>r(s,(a)=>o(a,null,null)))}}});var sh=m(function(W_,oh){var{ArgumentError:SA}=Mt(),{JwksClient:bA}=Bt(),vA=Rr(),AA=(e,t)=>{if(e&&e.name==="SigningKeyNotFoundError")return t(null);if(e)return t(e)};oh.exports.expressJwtSecret=function(e){if(e===null||e===void 0)throw new SA("An options object must be provided when initializing expressJwtSecret");let t=new bA(e),r=e.handleSigningKeyError||AA,n=async(i,o)=>{if(!o)return;let s=o.header;if(!s||!vA.includes(s.alg))return;try{let a=await t.getSigningKey(s.kid);return a.publicKey||a.rsaPublicKey}catch(a){return new Promise((f,c)=>{r(a,(u)=>{if(!u)return f();c(u)})})}};return function(o,s,a,f){if(arguments.length===4){n(o,{header:s}).then((c)=>{setImmediate(f,null,c)}).catch((c)=>{setImmediate(f,c)});return}return n(o,arguments[1])}}});var ch=m(function(j_,ah){var{ArgumentError:xA}=Mt(),{JwksClient:TA}=Bt(),CA=Rr();ah.exports.koaJwtSecret=function(e={}){if(!e.jwksUri)throw new xA("No JWKS provided. Please provide a jwksUri");let t=new TA(e);return function({alg:n,kid:i}={}){return new Promise((o,s)=>{if(!CA.includes(n))return s(Error("Missing / invalid token algorithm"));t.getSigningKey(i).then((a)=>{o(a.publicKey||a.rsaPublicKey)}).catch((a)=>{if(e.handleSigningKeyError)return e.handleSigningKeyError(a).then(s);return s(a)})})}}});var dh=m(function(D_,lh){var uh=(us(),Or(cs)),{ArgumentError:fh}=Mt(),{JwksClient:IA}=Bt(),RA=Rr(),OA=(e,t)=>{if(e&&e.name==="SigningKeyNotFoundError")return t(null);if(e)return t(e)};lh.exports.passportJwtSecret=function(e){if(e===null||e===void 0)throw new fh("An options object must be provided when initializing passportJwtSecret");if(!e.jwksUri)throw new fh("No JWKS provided. Please provide a jwksUri");let t=new IA(e),r=e.handleSigningKeyError||OA;return function(i,o,s){let a;try{a={payload:uh.decodeJwt(o),header:uh.decodeProtectedHeader(o)}}catch(f){a=null}if(!a||!RA.includes(a.header.alg))return s(null,null);t.getSigningKey(a.header.kid).then((f)=>{s(null,f.publicKey||f.rsaPublicKey)}).catch((f)=>{r(f,(c)=>s(c,null))})}}});var hh=m(function(F_,pe){var{JwksClient:ph}=Bt(),bi=Mt(),{hapiJwt2Key:_A,hapiJwt2KeyAsync:kA}=ih(),{expressJwtSecret:PA}=sh(),{koaJwtSecret:KA}=ch(),{passportJwtSecret:NA}=dh();pe.exports=(e)=>new ph(e);pe.exports.JwksClient=ph;pe.exports.ArgumentError=bi.ArgumentError;pe.exports.JwksError=bi.JwksError;pe.exports.JwksRateLimitError=bi.JwksRateLimitError;pe.exports.SigningKeyNotFoundError=bi.SigningKeyNotFoundError;pe.exports.expressJwtSecret=PA;pe.exports.hapiJwt2Key=_A;pe.exports.hapiJwt2KeyAsync=kA;pe.exports.koaJwtSecret=KA;pe.exports.passportJwtSecret=NA});var jA={};zt(jA,{handler:()=>WA});module.exports=Or(jA);var Ms=`<!DOCTYPE html>
10
+ -----END ${t}-----`},Vl=async(e,t,r)=>{if(fr(r)){if(r.type!==e)throw TypeError(`key is not a ${e} key`);return r.export({format:"pem",type:t})}if(!we(r))throw TypeError(ye(r,"CryptoKey","KeyObject"));if(!r.extractable)throw TypeError("CryptoKey is not extractable");if(r.type!==e)throw TypeError(`key is not a ${e} key`);return Db(Cn(new Uint8Array(await crypto.subtle.exportKey(t,r))),`${e.toUpperCase()} KEY`)},Xl=(e)=>Vl("public","spki",e),Yl=(e)=>Vl("private","pkcs8",e),Ar=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},Zl=(e)=>({data:e,pos:0}),Yo=(e)=>{let t=e.data[e.pos++];if(t===void 0)throw Error("Unexpected end of ASN.1 input");return t},Re=(e)=>{let t=Yo(e);if(t&128){let r=t&127,n=0;for(let i=0;i<r;i++)n=n<<8|Yo(e);return n}return t},zl=(e,t=1)=>{while(t-- >0){e.pos++;let r=Re(e);e.pos+=r}},Ue=(e,t,r)=>{if(Yo(e)!==t)throw Error(r)},Ql=(e,t)=>{if(t<0||e.pos+t>e.data.length)throw Error("Unexpected end of ASN.1 input");let r=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,r},Fb=(e)=>{Ue(e,6,"Expected algorithm OID");let t=Re(e);return Ql(e,t)},Ub=(e)=>{let t=Fb(e);if(Ar(t,[43,101,110]))return"X25519";if(!Ar(t,[42,134,72,206,61,2,1]))throw Error("Unsupported key algorithm");Ue(e,6,"Expected curve OID");let r=Re(e),n=Ql(e,r);if(Ar(n,[42,134,72,206,61,3,1,7]))return"P-256";if(Ar(n,[43,129,4,0,34]))return"P-384";if(Ar(n,[43,129,4,0,35]))return"P-521";throw Error("Unsupported named curve")},Zo=async(e,t,r,n)=>{let i=qe(n?.extractable),o=rt(r,Fe);if(o.secret)tt(Fe);let s=e==="spki",a;if(o.resolve)try{let f=Zl(t);qb(f,e),a=o.resolve({crv:Ub(f)})}catch{throw new _("Invalid or unsupported key format")}else a=o.subtle;return crypto.subtle.importKey(e,t,a,i??s,o.usages[s?0:1])},Qo=(e,t)=>In(e.replace(t,"")),ed=(e,t,r)=>{let n=Qo(e,/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g);return Zo("pkcs8",n,t,r)},td=(e,t,r)=>{let n=Qo(e,/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g);return Zo("spki",n,t,r)},rd=(e,t,r)=>{let n;try{let i=Qo(e,/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g);n=Hb(i)}catch(i){throw TypeError("Failed to parse the X.509 certificate",{cause:i})}return Zo("spki",n,t,r)};var es=x(()=>{k();vr()});function Bb(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}async function Mb(e){if(fr(e))if(e.type==="secret")e=e.export();else return e.export({format:"jwk"});if(e instanceof Uint8Array)return{kty:"oct",k:K(e)};if(!we(e))throw TypeError(ye(e,"CryptoKey","KeyObject","Uint8Array"));if(!e.extractable)throw TypeError("non-extractable CryptoKey cannot be exported as a JWK");let{ext:t,key_ops:r,alg:n,use:i,...o}=Bb(await crypto.subtle.exportKey("jwk",e));if(o.kty==="AKP")o.alg=n;return o}function nd(e){return Xl(e)}function id(e){return Yl(e)}function ni(e){return Mb(e)}var ts=x(()=>{es();oe()});async function rs(e,t){let r;if(R(e)){if(r=xt(e),typeof r.kty!=="string")throw TypeError(ye(e,"CryptoKey","KeyObject","JSON Web Key"))}else if(An(e))r=xt(await ni(e));else throw TypeError(ye(e,"CryptoKey","KeyObject","JSON Web Key"));if(t??="sha256",t!=="sha256"&&t!=="sha384"&&t!=="sha512")throw TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let n;switch(r.kty){case"AKP":Oe(r.alg,'"alg" (Algorithm) Parameter'),Oe(r.pub,'"pub" (Public key) Parameter'),n={alg:r.alg,kty:r.kty,pub:r.pub};break;case"EC":Oe(r.crv,'"crv" (Curve) Parameter'),Oe(r.x,'"x" (X Coordinate) Parameter'),Oe(r.y,'"y" (Y Coordinate) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x,y:r.y};break;case"OKP":Oe(r.crv,'"crv" (Subtype of Key Pair) Parameter'),Oe(r.x,'"x" (Public Key) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x};break;case"RSA":Oe(r.e,'"e" (Exponent) Parameter'),Oe(r.n,'"n" (Modulus) Parameter'),n={e:r.e,kty:r.kty,n:r.n};break;case"oct":if(typeof r.k!=="string")throw new cr('"k" (Key Value) Parameter missing or invalid');n={k:r.k,kty:r.kty};break;default:throw new _('"kty" (Key Type) Parameter missing or unsupported')}let i=F(JSON.stringify(n));return K(await kn(t,i))}async function od(e,t){t??="sha256";let r=await rs(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${r}`}var Oe=(e,t)=>{if(typeof e!=="string"||!e)throw new cr(`${t} missing or invalid`)};var sd=x(()=>{Q();oe();k();ie();ts()});async function ad(e,t){let r={...e,...t?.header};if(!R(r.jwk))throw new A('"jwk" (JSON Web Key) Header Parameter must be a JSON object');let n;try{n=Tt(r.jwk)}catch(s){throw new A("Invalid Embedded JWK",{cause:s})}let i=Kt(r.alg);if(n.use!==void 0&&n.use!=="sig")throw new A('Invalid Embedded JWK, its "use" must be "sig" when present');if(n.alg!==void 0&&n.alg!==i.alg)throw new A(`Invalid Embedded JWK, its "alg" must be "${i.alg}" when present`);let o=await Se(i,{...n,ext:!0});if(o.type!=="public")throw new A('"jwk" (JSON Web Key) Header Parameter must be a public key');return o}var cd=x(()=>{At();Nt();k()});function Gb(e,t,r,n){let{kty:i,key_ops:o,ext:s,kid:a,alg:f,use:c,crv:u}=xt(e),l=Array.isArray(o)?[...o]:o;return(s===void 0||typeof s==="boolean")&&(l===void 0||Array.isArray(l)&&l.every((p,d)=>typeof p==="string"&&l.indexOf(p)===d)&&l.includes("verify"))&&t.kty.includes(i)&&(n===void 0||typeof n==="string"&&n===a)&&(f===void 0?i!=="AKP":r===f)&&(c===void 0||c==="sig")&&(!t.crv||u===t.crv)}async function ud(e,t,r){let n=e.get(t)||e.set(t,{}).get(t),{alg:i}=r;if(n[i]===void 0){let o=await Se(r,{...t,alg:i,ext:!0});if(o.type!=="public")throw new ur("JSON Web Key Set members must be public keys");n[i]=o}return n[i]}function xr(e){let t;try{t=structuredClone(e)}catch{}if(!On(t))throw new ur("JSON Web Key Set malformed");let r=new WeakMap;return Object.defineProperty(async(i,o)=>{let{alg:s,kid:a}={...i,...o?.header},f=typeof s==="string"?wr[s]:void 0;if(!f||f.secret)throw new _('Unsupported "alg" value for a JSON Web Key Set');let c=t.keys.filter((p)=>Gb(p,f,s,a)),{0:u,length:l}=c;if(!l)throw new vt;if(l!==1){let p=new Sn;throw p[Symbol.asyncIterator]=async function*(){for(let d of c)try{yield await ud(r,d,f)}catch{}},p}return ud(r,u,f)},"jwks",{value:()=>structuredClone(t)})}var ns=x(()=>{At();Nt();k()});function zb(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}async function Vb(e,t,r,n=fetch){let i=await n(e,{method:"GET",signal:r,redirect:"manual",headers:t}).catch((o)=>{if(o.name==="TimeoutError")throw new bn;throw o});if(i.status!==200)throw new z("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await i.json()}catch{throw new z("Failed to parse the JSON Web Key Set HTTP response as JSON")}}function Tr(e,t){return Number.isFinite(e)&&Date.now()<e+t}function fd(e,t,r){if(Number.isNaN(e))throw TypeError(`"${r}" option must not be NaN`);return typeof e==="number"?e:t}function ld(e,t){if(!(e instanceof URL))throw TypeError("url must be an instance of URL");let r=new URL(e.href).href,n=t??{},i=n.timeoutDuration;if(typeof i==="number"&&(!Number.isInteger(i)||i<0))throw TypeError('"timeoutDuration" option must be a non-negative integer');let o=typeof i==="number"?i:5000,s=fd(n.cooldownDuration,30000,"cooldownDuration"),a=fd(n.cacheMaxAge,600000,"cacheMaxAge"),f=new Headers(n.headers);if(is&&!f.has("User-Agent"))f.set("User-Agent",is);if(!f.has("accept"))f.set("accept","application/json, application/jwk-set+json");let c=n[os],u=n[ss],l,p,d=0,g=0,h;if(u&&typeof u==="object"){let{uat:y,jwks:T}=u;if(Tr(y,a)&&On(T))l=y,h=xr(T)}let S=async()=>{if(p&&zb())p=void 0;if(!p){let y=++d,T=p=Vb(r,f,AbortSignal.timeout(o),c).then((I)=>{let O=xr(I);if(y<=g)return;h=O;let j=Date.now();if(u)u.uat=j,u.jwks=I;l=j,g=y}).finally(()=>{if(p===T)p=void 0})}await p};return Object.defineProperties(async(y,T)=>{if(!h||!Tr(l,a))await S();try{return await h(y,T)}catch(I){if(I instanceof vt&&!Tr(l,s))return await S(),h(y,T);throw I}},{coolingDown:{get:()=>Tr(l,s),enumerable:!0},fresh:{get:()=>Tr(l,a),enumerable:!0},reload:{value:S,enumerable:!0},reloading:{get:()=>!!p,enumerable:!0},jwks:{value:()=>h?.jwks(),enumerable:!0}})}var is,os,ss;var dd=x(()=>{k();ns();if(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))is="jose/v6.2.10";os=Symbol();ss=Symbol()});var Xb,as;var pd=x(()=>{oe();Q();k();jt();kt();Xb=et;as=class as extends Xb{encode(){let e=K(JSON.stringify({alg:"none"})),t=K(Wt(this));return`${e}.${t}.`}static decode(e,t){if(typeof e!=="string")throw new U("Unsecured JWT must be a string");let{0:r,1:n,2:i,length:o}=e.split(".");if(o!==3||i!=="")throw new U("Invalid Unsecured JWT");let s,a;try{s=Ce(r,A,"JWS Protected Header is invalid");let c=xe(A,Ot,void 0,s,s);a=_t(s,c)}catch(c){if(!(c instanceof A))throw c;throw new U("Invalid Unsecured JWT",{cause:c})}if(s.alg!=="none")throw new U("Invalid Unsecured JWT");if(!a)throw new U("JWTs MUST NOT use unencoded payload");return{payload:Jt(s,M(n,"payload",U),t),header:s}}}});async function hd(e,t,r){if(typeof e!=="string"||e.indexOf("-----BEGIN PUBLIC KEY-----")!==0)throw TypeError('"spki" must be SPKI formatted string');return td(e,t,r)}async function md(e,t,r){if(typeof e!=="string"||e.indexOf("-----BEGIN CERTIFICATE-----")!==0)throw TypeError('"x509" must be X.509 formatted string');return rd(e,t,r)}async function yd(e,t,r){if(typeof e!=="string"||e.indexOf("-----BEGIN PRIVATE KEY-----")!==0)throw TypeError('"pkcs8" must be PKCS#8 formatted string');return ed(e,t,r)}async function gd(e,t,r){if(!R(e))throw TypeError("JWK must be an object");let n=Tt(e),i=qe(r?.extractable),{alg:o}=n;t??=o;let s=i??n.ext;if(n.kty!=="oct"&&!t)throw TypeError('"alg" argument is required when "jwk.alg" is not present');switch(n.kty){case"oct":if(typeof n.k!=="string")throw TypeError('missing "k" (Key Value) Parameter value');return Ae(n.k);case"AKP":{if(typeof o!=="string"||!o)throw TypeError('missing "alg" (Algorithm) Parameter value');if(t!==o)throw TypeError("JWK alg and alg option value mismatch");return Se(rt(t),{...n,ext:s})}case"RSA":case"EC":case"OKP":return Se(rt(t),{...n,alg:t,ext:s});default:throw new _('Unsupported "kty" (Key Type) Parameter value')}}var wd=x(()=>{oe();es();At();vr();k()});function Ed(e){let t;if(typeof e==="string"){let n=e.split(".");if(n.length===3||n.length===5)[t]=n}else if(typeof e==="object"&&e)if("protected"in e)t=e.protected;else throw TypeError("Token does not contain a Protected Header");let r="Invalid Token or Protected Header formatting";if(typeof t!=="string"||!t)throw TypeError(r);return Ce(t,TypeError,r)}var Sd=x(()=>{Q()});function bd(e){if(typeof e!=="string")throw new U("JWTs must use Compact JWS serialization, JWT must be a string");let{1:t,length:r}=e.split(".");if(r===5)throw new U("Only JWTs using Compact JWS serialization can be decoded");if(r!==3)throw new U("Invalid JWT");if(!t)throw new U("JWTs must contain a payload");let n;try{n=Ae(t)}catch{throw new U("Failed to base64url decode the payload")}let i;try{i=JSON.parse(bt.decode(n))}catch{throw new U("Failed to parse the decoded payload as JSON")}if(!R(i))throw new U("Invalid JWT Claims Set");return i}var vd=x(()=>{oe();ie();k()});function Yb(e){let t=e?.modulusLength??2048;if(typeof t!=="number"||!Number.isInteger(t)||t<2048)throw new _("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return t}async function Ad(e,t){let r=qe(t?.extractable),n=rt(e,Fe);if(n.secret)tt(Fe);let i;if(n.resolve){let o=t?.crv??"P-256";switch(o){case"P-256":case"P-384":case"P-521":i={name:"ECDH",namedCurve:o};break;case"X25519":i={name:"X25519"};break;default:throw new _("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, and X25519")}}else{if(n.crv!==void 0&&t?.crv!==void 0&&t.crv!==n.crv)throw new _(`Invalid or unsupported crv option provided, the only supported value for ${e} is ${n.crv}`);i=n.kty[0]==="RSA"?{...n.subtle,publicExponent:Uint8Array.of(1,0,1),modulusLength:Yb(t)}:n.subtle}return crypto.subtle.generateKey(i,r??!1,[...n.usages[1],...n.usages[0]])}var xd=x(()=>{k();vr()});async function Td(e,t){let r=qe(t?.extractable),n,i,o;switch(e){case"HS256":case"HS384":case"HS512":n=+e.slice(-3),i={name:"HMAC",hash:`SHA-${n}`,length:n},o=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return crypto.getRandomValues(new Uint8Array(+e.slice(-3)>>3));case"A128KW":case"A192KW":case"A256KW":n=+e.slice(1,4),i={name:"AES-KW",length:n},o=["wrapKey","unwrapKey"];break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":n=+e.slice(1,4),i={name:"AES-GCM",length:n},o=["encrypt","decrypt"];break;default:tt(Fe)}return crypto.subtle.generateKey(i,r??!1,o)}var Cd=x(()=>{vr()});var cs={};Vt(cs,{CompactEncrypt:()=>Ho,CompactSign:()=>Mo,EmbeddedJWK:()=>ad,EncryptJWT:()=>Xo,FlattenedEncrypt:()=>Bo,FlattenedSign:()=>Go,GeneralEncrypt:()=>No,GeneralSign:()=>zo,SignJWT:()=>Vo,UnsecuredJWT:()=>as,base64url:()=>Rn,calculateJwkThumbprint:()=>rs,calculateJwkThumbprintUri:()=>od,compactDecrypt:()=>ul,compactVerify:()=>xl,createLocalJWKSet:()=>xr,createRemoteJWKSet:()=>ld,cryptoRuntime:()=>Zb,customFetch:()=>os,decodeJwt:()=>bd,decodeProtectedHeader:()=>Ed,errors:()=>So,exportJWK:()=>ni,exportPKCS8:()=>id,exportSPKI:()=>nd,flattenedDecrypt:()=>ll,flattenedVerify:()=>Cl,generalDecrypt:()=>pl,generalVerify:()=>Rl,generateKeyPair:()=>Ad,generateSecret:()=>Td,importJWK:()=>gd,importPKCS8:()=>yd,importSPKI:()=>hd,importX509:()=>md,jwksCache:()=>ss,jwtDecrypt:()=>Nl,jwtVerify:()=>Pl});var Zb="WebCryptoAPI";var us=x(()=>{fl();dl();hl();gl();Tl();Il();Ol();Kl();$l();Ll();Jl();ql();Ul();Bl();Ml();Gl();sd();cd();ns();dd();pd();ts();wd();Sd();vd();k();xd();Cd();oe()});var oi=m(function(p_,Id){function ii(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="JwksError",this.message=e}ii.prototype=Object.create(Error.prototype);ii.prototype.constructor=ii;Id.exports=ii});var fs=m(function(h_,Od){var Rd=(us(),_r(cs)),Qb=oi();function e0(e){if(e.alg)return e.alg;if(e.kty==="RSA")return"RS256";if(e.kty==="EC")switch(e.crv){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512"}if(e.kty==="OKP")switch(e.crv){case"Ed25519":case"Ed448":return"EdDSA"}throw new Qb("Unsupported JWK")}async function t0(e){let t=[];e=e.filter(({use:r})=>r==="sig"||r===void 0).filter(({kty:r})=>r==="RSA"||r==="EC"||r==="OKP");for(let r of e)try{let n=await Rd.importJWK({...r,ext:!0},e0(r));if(n.type!=="public")continue;let i;switch(n[Symbol.toStringTag]){case"CryptoKey":{let o=await Rd.exportSPKI(n);i=()=>o;break}case"KeyObject":default:i=()=>n.export({format:"pem",type:"spki"})}t.push({get publicKey(){return i()},get rsaPublicKey(){return i()},getPublicKey(){return i()},...typeof r.kid==="string"&&r.kid?{kid:r.kid}:void 0,...typeof r.alg==="string"&&r.alg?{alg:r.alg}:void 0})}catch(n){continue}return t}Od.exports={retrieveSigningKeys:t0}});var ls=m(function(m_,_d){function si(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="ArgumentError",this.message=e}si.prototype=Object.create(Error.prototype);si.prototype.constructor=si;_d.exports=si});var Pd=m(function(y_,kd){var r0=require("http"),n0=require("https"),i0=ls();kd.exports.default=(e)=>{if(e.fetcher)return e.fetcher(e.uri);return new Promise((t,r)=>{let n;try{n=new URL(e.uri)}catch(d){throw new i0("Invalid JWKS URI: The provided URI is not a valid URL.")}let{hostname:i,port:o,protocol:s,pathname:a,search:f}=n,c=a+f,u={hostname:i,path:c,port:o,method:"GET",...e.headers&&{headers:{...e.headers}},...e.timeout&&{timeout:e.timeout},...e.agent&&{agent:e.agent}},p=(s==="https:"?n0:r0).request(u,(d)=>{let g="";d.setEncoding("utf8"),d.on("data",(h)=>{g+=h}),d.on("end",()=>{if(d.statusCode<200||d.statusCode>=300){let h=d.body&&(d.body.message||d.body)||d.statusMessage||`Http Error ${d.statusCode}`;r({errorMsg:h})}else try{t(g&&JSON.parse(g))}catch(h){r(h)}})});p.on("timeout",()=>p.destroy()).on("error",(d)=>r(d)).end()})}});var ui=m(function(ci){var Nd=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),o0=Nd((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.tracing=e.metrics=void 0;var t=require("node:diagnostics_channel");e.metrics=(0,t.channel)("lru-cache:metrics"),e.tracing=(0,t.tracingChannel)("lru-cache")}),s0=Nd((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defaultPerf=void 0,e.defaultPerf=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date});Object.defineProperty(ci,"__esModule",{value:!0});ci.LRUCache=void 0;var H=o0(),a0=s0(),ds=()=>H.metrics.hasSubscribers||H.tracing.hasSubscribers,$d=new Set,Kd=typeof process=="object"&&process?process:{},c0=(e,t,r,n)=>{typeof Kd.emitWarning=="function"?Kd.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},u0=(e)=>!$d.has(e),He=(e)=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),Ld=(e)=>He(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?ai:null:null,ai=class extends Array{constructor(e){super(e),this.fill(0)}},f0=class e{heap;length;static#e=!1;static create(t){let r=Ld(t);if(!r)return[];e.#e=!0;let n=new e(t,r);return e.#e=!1,n}constructor(t,r){if(!e.#e)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},l0=class e{#e;#t;#n;#o;#s;#y;#g;#p;get perf(){return this.#p}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#u;#v;#c;#a;#r;#h;#w;#d;#f;#A;#l;#x;#T;#E;#S;#C;#J;#m;#P;static unsafeExposeInternals(t){return{starts:t.#T,ttls:t.#E,autopurgeTimers:t.#S,sizes:t.#x,keyMap:t.#c,keyList:t.#a,valList:t.#r,next:t.#h,prev:t.#w,get head(){return t.#d},get tail(){return t.#f},free:t.#A,isBackgroundFetch:(r)=>t.#i(r),backgroundFetch:(r,n,i,o)=>t.#D(r,n,i,o),moveToTail:(r)=>t.#L(r),indexes:(r)=>t.#I(r),rindexes:(r)=>t.#R(r),isStale:(r)=>t.#b(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#v}get size(){return this.#u}get fetchMethod(){return this.#y}get memoMethod(){return this.#g}get dispose(){return this.#n}get onInsert(){return this.#o}get disposeAfter(){return this.#s}constructor(t){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:a,allowStale:f,dispose:c,onInsert:u,disposeAfter:l,noDisposeOnSet:p,noUpdateTTL:d,maxSize:g=0,maxEntrySize:h=0,sizeCalculation:S,fetchMethod:E,memoMethod:y,noDeleteOnFetchRejection:T,noDeleteOnStaleGet:I,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:j,ignoreFetchAbort:q,backgroundFetchSize:V=1,perf:N}=t;if(this.backgroundFetchSize=V,N!==void 0&&typeof N?.now!="function")throw TypeError("perf option must have a now() method if specified");if(this.#p=N??a0.defaultPerf,r!==0&&!He(r))throw TypeError("max option must be a nonnegative integer");let ee=r?Ld(r):Array;if(!ee)throw Error("invalid max value: "+r);if(this.#e=r,this.#t=g,this.maxEntrySize=h||this.#t,this.sizeCalculation=S,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw TypeError("memoMethod must be a function if defined");if(this.#g=y,E!==void 0&&typeof E!="function")throw TypeError("fetchMethod must be a function if specified");if(this.#y=E,this.#J=!!E,this.#c=new Map,this.#a=Array.from({length:r}).fill(void 0),this.#r=Array.from({length:r}).fill(void 0),this.#h=new ee(r),this.#w=new ee(r),this.#d=0,this.#f=0,this.#A=f0.create(r),this.#u=0,this.#v=0,typeof c=="function"&&(this.#n=c),typeof u=="function"&&(this.#o=u),typeof l=="function"?(this.#s=l,this.#l=[]):(this.#s=void 0,this.#l=void 0),this.#C=!!this.#n,this.#P=!!this.#o,this.#m=!!this.#s,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!T,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!j,this.ignoreFetchAbort=!!q,this.maxEntrySize!==0){if(this.#t!==0&&!He(this.#t))throw TypeError("maxSize must be a positive integer if specified");if(!He(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#z()}if(this.allowStale=!!f,this.noDeleteOnStaleGet=!!I,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!a,this.ttlResolution=He(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!He(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#F()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let ct="LRU_CACHE_UNBOUNDED";u0(ct)&&($d.add(ct),c0("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ct,e))}}getRemainingTTL(t){return this.#c.has(t)?1/0:0}#F(){let t=new ai(this.#e),r=new ai(this.#e);this.#E=t,this.#T=r;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#S=n,this.#q=(f,c,u=this.#p.now())=>{r[f]=c!==0?u:0,t[f]=c,i(f,c)},this.#K=(f)=>{r[f]=t[f]!==0?this.#p.now():0,i(f,t[f])};let i=this.ttlAutopurge?(f,c)=>{if(n?.[f]&&(clearTimeout(n[f]),n[f]=void 0),c&&c!==0&&n){let u=setTimeout(()=>{this.#b(f)?(this.#O(this.#a[f],"expire"),n[f]=void 0):i(f,a(f))},c+1);u.unref&&u.unref(),n[f]=u}}:()=>{};this.#_=(f,c)=>{if(t[c]){let u=t[c],l=r[c];if(!u||!l)return;f.ttl=u,f.start=l,f.now=o||s();let p=f.now-l;f.remainingTTL=u-p}};let o=0,s=()=>{let f=this.#p.now();if(this.ttlResolution>0){o=f;let c=setTimeout(()=>o=0,this.ttlResolution);c.unref&&c.unref()}return f};this.getRemainingTTL=(f)=>{let c=this.#c.get(f);return c===void 0?0:a(c)};let a=(f)=>{let c=t[f],u=r[f];if(!c||!u)return 1/0;let l=(o||s())-u;return c-l};this.#b=(f)=>{let c=r[f],u=t[f];return!!u&&!!c&&(o||s())-c>u}}#K=()=>{};#_=()=>{};#q=()=>{};#b=()=>!1;#z(){let t=new ai(this.#e);this.#v=0,this.#x=t,this.#N=(r)=>{this.#v-=t[r],t[r]=0},this.#U=(r,n,i,o)=>{if(!He(i)){if(this.#i(n))return this.backgroundFetchSize;if(o){if(typeof o!="function")throw TypeError("sizeCalculation must be a function");if(i=o(n,r),!He(i))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return i},this.#W=(r,n,i)=>{if(t[r]=n,this.#t){let o=this.#t-t[r];for(;this.#v>o;)this.#j(!0)}this.#v+=t[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#v)}}#N=(t)=>{};#W=(t,r,n)=>{};#U=(t,r,n,i)=>{if(n||i)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#I({allowStale:t=this.allowStale}={}){if(this.#u)for(let r=this.#f;this.#H(r)&&((t||!this.#b(r))&&(yield r),r!==this.#d);)r=this.#w[r]}*#R({allowStale:t=this.allowStale}={}){if(this.#u)for(let r=this.#d;this.#H(r)&&((t||!this.#b(r))&&(yield r),r!==this.#f);)r=this.#h[r]}#H(t){return t!==void 0&&this.#c.get(this.#a[t])===t}*entries(){for(let t of this.#I())this.#r[t]!==void 0&&this.#a[t]!==void 0&&!this.#i(this.#r[t])&&(yield[this.#a[t],this.#r[t]])}*rentries(){for(let t of this.#R())this.#r[t]!==void 0&&this.#a[t]!==void 0&&!this.#i(this.#r[t])&&(yield[this.#a[t],this.#r[t]])}*keys(){for(let t of this.#I()){let r=this.#a[t];r!==void 0&&!this.#i(this.#r[t])&&(yield r)}}*rkeys(){for(let t of this.#R()){let r=this.#a[t];r!==void 0&&!this.#i(this.#r[t])&&(yield r)}}*values(){for(let t of this.#I())this.#r[t]!==void 0&&!this.#i(this.#r[t])&&(yield this.#r[t])}*rvalues(){for(let t of this.#R())this.#r[t]!==void 0&&!this.#i(this.#r[t])&&(yield this.#r[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,r={}){for(let n of this.#I()){let i=this.#r[n],o=this.#i(i)?i.__staleWhileFetching:i;if(o!==void 0&&t(o,this.#a[n],this))return this.#$(this.#a[n],r)}}forEach(t,r=this){for(let n of this.#I()){let i=this.#r[n],o=this.#i(i)?i.__staleWhileFetching:i;o!==void 0&&t.call(r,o,this.#a[n],this)}}rforEach(t,r=this){for(let n of this.#R()){let i=this.#r[n],o=this.#i(i)?i.__staleWhileFetching:i;o!==void 0&&t.call(r,o,this.#a[n],this)}}purgeStale(){let t=!1;for(let r of this.#R({allowStale:!0}))this.#b(r)&&(this.#O(this.#a[r],"expire"),t=!0);return t}info(t){let r=this.#c.get(t);if(r===void 0)return;let n=this.#r[r],i=this.#i(n)?n.__staleWhileFetching:n;if(i===void 0)return;let o={value:i};if(this.#E&&this.#T){let s=this.#E[r],a=this.#T[r];if(s&&a){let f=s-(this.#p.now()-a);o.ttl=f,o.start=Date.now()}}return this.#x&&(o.size=this.#x[r]),o}dump(){let t=[];for(let r of this.#I({allowStale:!0})){let n=this.#a[r],i=this.#r[r],o=this.#i(i)?i.__staleWhileFetching:i;if(o===void 0||n===void 0)continue;let s={value:o};if(this.#E&&this.#T){s.ttl=this.#E[r];let a=this.#p.now()-this.#T[r];s.start=Math.floor(Date.now()-a)}this.#x&&(s.size=this.#x[r]),t.unshift([n,s])}return t}load(t){this.clear();for(let[r,n]of t){if(n.start){let i=Date.now()-n.start;n.start=this.#p.now()-i}this.#k(r,n.value,n)}}set(t,r,n={}){let{status:i=H.metrics.hasSubscribers?{}:void 0}=n;n.status=i,i&&(i.op="set",i.key=t,r!==void 0&&(i.value=r),i.cache=this);let o=this.#k(t,r,n);return i&&H.metrics.hasSubscribers&&H.metrics.publish(i),o}#k(t,r,n,i){let{ttl:o=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:f=this.sizeCalculation,status:c}=n,u=this.#i(r);if(r===void 0)return c&&(c.set="deleted"),this.delete(t),this;let{noUpdateTTL:l=this.noUpdateTTL}=n;c&&!u&&(c.value=r);let p=this.#U(t,r,n.size||0,f,c);if(this.maxEntrySize&&p>this.maxEntrySize)return this.#O(t,"set"),c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this;let d=this.#u===0?void 0:this.#c.get(t);if(d===void 0)d=this.#u===0?this.#f:this.#A.length!==0?this.#A.pop():this.#u===this.#e?this.#j(!1):this.#u,this.#a[d]=t,this.#r[d]=r,this.#c.set(t,d),this.#h[this.#f]=d,this.#w[d]=this.#f,this.#f=d,this.#u++,this.#W(d,p,c),c&&(c.set="add"),l=!1,this.#P&&!u&&this.#o?.(r,t,"add");else{this.#L(d);let g=this.#r[d];if(r!==g){if(!a)if(this.#i(g)){g!==i&&g.__abortController.abort(Error("replaced"));let{__staleWhileFetching:h}=g;h!==void 0&&h!==r&&(this.#C&&this.#n?.(h,t,"set"),this.#m&&this.#l?.push([h,t,"set"]))}else this.#C&&this.#n?.(g,t,"set"),this.#m&&this.#l?.push([g,t,"set"]);if(this.#N(d),this.#W(d,p,c),this.#r[d]=r,!u){let h=g&&this.#i(g)?g.__staleWhileFetching:g,S=h===void 0?"add":r!==h?"replace":"update";c&&(c.set=S,h!==void 0&&(c.oldValue=h)),this.#P&&this.onInsert?.(r,t,S)}}else u||(c&&(c.set="update"),this.#P&&this.onInsert?.(r,t,"update"))}if(o!==0&&!this.#E&&this.#F(),this.#E&&(l||this.#q(d,o,s),c&&this.#_(c,d)),!a&&this.#m&&this.#l){let g=this.#l,h;for(;h=g?.shift();)this.#s?.(...h)}return this}pop(){try{for(;this.#u;){let t=this.#r[this.#d];if(this.#j(!0),this.#i(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#m&&this.#l){let t=this.#l,r;for(;r=t?.shift();)this.#s?.(...r)}}}#j(t){let r=this.#d,n=this.#a[r],i=this.#r[r],o=this.#i(i);o&&i.__abortController.abort(Error("evicted"));let s=o?i.__staleWhileFetching:i;return(this.#C||this.#m)&&s!==void 0&&(this.#C&&this.#n?.(s,n,"evict"),this.#m&&this.#l?.push([s,n,"evict"])),this.#N(r),this.#S?.[r]&&(clearTimeout(this.#S[r]),this.#S[r]=void 0),t&&(this.#a[r]=void 0,this.#r[r]=void 0,this.#A.push(r)),this.#u===1?(this.#d=this.#f=0,this.#A.length=0):this.#d=this.#h[r],this.#c.delete(n),this.#u--,r}has(t,r={}){let{status:n=H.metrics.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="has",n.key=t,n.cache=this);let i=this.#V(t,r);return H.metrics.hasSubscribers&&H.metrics.publish(n),i}#V(t,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,o=this.#c.get(t);if(o!==void 0){let s=this.#r[o];if(this.#i(s)&&s.__staleWhileFetching===void 0)return!1;if(this.#b(o))i&&(i.has="stale",this.#_(i,o));else return n&&this.#K(o),i&&(i.has="hit",this.#_(i,o)),!0}else i&&(i.has="miss");return!1}peek(t,r={}){let{status:n=ds()?{}:void 0}=r;n&&(n.op="peek",n.key=t,n.cache=this),r.status=n;let i=this.#X(t,r);return H.metrics.hasSubscribers&&H.metrics.publish(n),i}#X(t,r){let{status:n,allowStale:i=this.allowStale}=r,o=this.#c.get(t);if(o===void 0||!i&&this.#b(o)){n&&(n.peek=o===void 0?"miss":"stale");return}let s=this.#r[o],a=this.#i(s)?s.__staleWhileFetching:s;return n&&(a!==void 0?(n.peek="hit",n.value=a):n.peek="miss"),a}#D(t,r,n,i){let o=r===void 0?void 0:this.#r[r];if(this.#i(o))return o;let s=new AbortController,{signal:a}=n;a?.addEventListener("abort",()=>s.abort(a.reason),{signal:s.signal});let f={signal:s.signal,options:n,context:i},c=(h,S=!1)=>{let{aborted:E}=s.signal,y=n.ignoreFetchAbort&&h!==void 0,T=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&h!==void 0);if(n.status&&(E&&!S?(n.status.fetchAborted=!0,n.status.fetchError=s.signal.reason,y&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),E&&!y&&!S)return l(s.signal.reason,T);let I=d,O=this.#r[r];return(O===d||O===void 0&&y&&S)&&(h===void 0?I.__staleWhileFetching!==void 0?this.#r[r]=I.__staleWhileFetching:this.#O(t,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.#k(t,h,f.options,I))),h},u=(h)=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=h),l(h,!1)),l=(h,S)=>{let{aborted:E}=s.signal,y=E&&n.allowStaleOnFetchAbort,T=y||n.allowStaleOnFetchRejection,I=T||n.noDeleteOnFetchRejection,O=d;if(this.#r[r]===d&&(!I||!S&&O.__staleWhileFetching===void 0?this.#O(t,"fetch"):y||(this.#r[r]=O.__staleWhileFetching)),T)return n.status&&O.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),O.__staleWhileFetching;if(O.__returned===O)throw h},p=(h,S)=>{let E=this.#y?.(t,o,f);s.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(h(void 0),n.allowStaleOnFetchAbort&&(h=(y)=>c(y,!0)))}),E&&E instanceof Promise?E.then((y)=>h(y===void 0?void 0:y),S):E!==void 0&&h(E)};n.status&&(n.status.fetchDispatched=!0);let d=new Promise(p).then(c,u),g=Object.assign(d,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.#k(t,g,{...f.options,status:void 0}),r=this.#c.get(t)):this.#r[r]=g,g}#i(t){if(!this.#J)return!1;let r=t;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof AbortController}fetch(t,r={}){let n=H.tracing.hasSubscribers,{status:i=ds()?{}:void 0}=r;r.status=i,i&&r.context&&(i.context=r.context);let o=this.#B(t,r);return i&&n&&(i.trace=!0,H.tracing.tracePromise(()=>o,i).catch(()=>{})),o}async#B(t,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:f=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:h,forceRefresh:S=!1,status:E,signal:y}=r;if(E&&(E.op="fetch",E.key=t,S&&(E.forceRefresh=!0),E.cache=this),!this.#J)return E&&(E.fetch="get"),this.#$(t,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,status:E});let T={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:a,size:f,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:g,ignoreFetchAbort:d,status:E,signal:y},I=this.#c.get(t);if(I===void 0){E&&(E.fetch="miss");let O=this.#D(t,I,T,h);return O.__returned=O}else{let O=this.#r[I];if(this.#i(O)){let N=n&&O.__staleWhileFetching!==void 0;return E&&(E.fetch="inflight",N&&(E.returnedStale=!0)),N?O.__staleWhileFetching:O.__returned=O}let j=this.#b(I);if(!S&&!j)return E&&(E.fetch="hit"),this.#L(I),i&&this.#K(I),E&&this.#_(E,I),O;let q=this.#D(t,I,T,h),V=q.__staleWhileFetching!==void 0&&n;return E&&(E.fetch=j?"stale":"refresh",V&&j&&(E.returnedStale=!0)),V?q.__staleWhileFetching:q.__returned=q}}forceFetch(t,r={}){let n=H.tracing.hasSubscribers,{status:i=ds()?{}:void 0}=r;r.status=i,i&&r.context&&(i.context=r.context);let o=this.#Y(t,r);return i&&n&&(i.trace=!0,H.tracing.tracePromise(()=>o,i).catch(()=>{})),o}async#Y(t,r={}){let n=await this.#B(t,r);if(n===void 0)throw Error("fetch() returned undefined");return n}memo(t,r={}){let{status:n=H.metrics.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="memo",n.key=t,r.context&&(n.context=r.context),n.cache=this);let i=this.#Z(t,r);return n&&(n.value=i),H.metrics.hasSubscribers&&H.metrics.publish(n),i}#Z(t,r={}){let n=this.#g;if(!n)throw Error("no memoMethod provided to constructor");let{context:i,status:o,forceRefresh:s,...a}=r;o&&s&&(o.forceRefresh=!0);let f=this.#$(t,a),c=s||f===void 0;if(o&&(o.memo=c?"miss":"hit",c||(o.value=f)),!c)return f;let u=n(t,f,{options:a,context:i});return o&&(o.value=u),this.#k(t,u,a),u}get(t,r={}){let{status:n=H.metrics.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="get",n.key=t,n.cache=this);let i=this.#$(t,r);return n&&(i!==void 0&&(n.value=i),H.metrics.hasSubscribers&&H.metrics.publish(n)),i}#$(t,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=r,a=this.#c.get(t);if(a===void 0){s&&(s.get="miss");return}let f=this.#r[a],c=this.#i(f);return s&&this.#_(s,a),this.#b(a)?c?(s&&(s.get="stale-fetching"),n&&f.__staleWhileFetching!==void 0?(s&&(s.returnedStale=!0),f.__staleWhileFetching):void 0):(o||this.#O(t,"expire"),s&&(s.get="stale"),n?(s&&(s.returnedStale=!0),f):void 0):(s&&(s.get=c?"fetching":"hit"),this.#L(a),i&&this.#K(a),c?f.__staleWhileFetching:f)}#M(t,r){this.#w[r]=t,this.#h[t]=r}#L(t){t!==this.#f&&(t===this.#d?this.#d=this.#h[t]:this.#M(this.#w[t],this.#h[t]),this.#M(this.#f,t),this.#f=t)}delete(t){return this.#O(t,"delete")}#O(t,r){H.metrics.hasSubscribers&&H.metrics.publish({op:"delete",delete:r,key:t,cache:this});let n=!1;if(this.#u!==0){let i=this.#c.get(t);if(i!==void 0)if(this.#S?.[i]&&(clearTimeout(this.#S[i]),this.#S[i]=void 0),n=!0,this.#u===1)this.#G(r);else{this.#N(i);let o=this.#r[i];if(this.#i(o)?o.__abortController.abort(Error("deleted")):(this.#C||this.#m)&&(this.#C&&this.#n?.(o,t,r),this.#m&&this.#l?.push([o,t,r])),this.#c.delete(t),this.#a[i]=void 0,this.#r[i]=void 0,i===this.#f)this.#f=this.#w[i];else if(i===this.#d)this.#d=this.#h[i];else{let s=this.#w[i];this.#h[s]=this.#h[i];let a=this.#h[i];this.#w[a]=this.#w[i]}this.#u--,this.#A.push(i)}}if(this.#m&&this.#l?.length){let i=this.#l,o;for(;o=i?.shift();)this.#s?.(...o)}return n}clear(){return this.#G("delete")}#G(t){for(let r of this.#R({allowStale:!0})){let n=this.#r[r];if(this.#i(n))n.__abortController.abort(Error("deleted"));else{let i=this.#a[r];this.#C&&this.#n?.(n,i,t),this.#m&&this.#l?.push([n,i,t])}}if(this.#c.clear(),this.#r.fill(void 0),this.#a.fill(void 0),this.#E&&this.#T){this.#E.fill(0),this.#T.fill(0);for(let r of this.#S??[])r!==void 0&&clearTimeout(r);this.#S?.fill(void 0)}if(this.#x&&this.#x.fill(0),this.#d=0,this.#f=0,this.#A.length=0,this.#v=0,this.#u=0,this.#m&&this.#l){let r=this.#l,n;for(;n=r?.shift();)this.#s?.(...n)}}};ci.LRUCache=l0});var Is=m(function(Cr,Dt){var d0=200,zd="__lodash_hash_undefined__",Vd=9007199254740991,Ss="[object Arguments]",p0="[object Array]",Xd="[object Boolean]",Yd="[object Date]",h0="[object Error]",bs="[object Function]",Zd="[object GeneratorFunction]",fi="[object Map]",Qd="[object Number]",vs="[object Object]",Jd="[object Promise]",ep="[object RegExp]",li="[object Set]",tp="[object String]",rp="[object Symbol]",hs="[object WeakMap]",np="[object ArrayBuffer]",di="[object DataView]",ip="[object Float32Array]",op="[object Float64Array]",sp="[object Int8Array]",ap="[object Int16Array]",cp="[object Int32Array]",up="[object Uint8Array]",fp="[object Uint8ClampedArray]",lp="[object Uint16Array]",dp="[object Uint32Array]",m0=/[\\^$.*+?()[\]{}|]/g,y0=/\w*$/,g0=/^\[object .+?Constructor\]$/,w0=/^(?:0|[1-9]\d*)$/,J={};J[Ss]=J[p0]=J[np]=J[di]=J[Xd]=J[Yd]=J[ip]=J[op]=J[sp]=J[ap]=J[cp]=J[fi]=J[Qd]=J[vs]=J[ep]=J[li]=J[tp]=J[rp]=J[up]=J[fp]=J[lp]=J[dp]=!0;J[h0]=J[bs]=J[hs]=!1;var E0=typeof global=="object"&&global&&global.Object===Object&&global,S0=typeof self=="object"&&self&&self.Object===Object&&self,_e=E0||S0||Function("return this")(),pp=typeof Cr=="object"&&Cr&&!Cr.nodeType&&Cr,Wd=pp&&typeof Dt=="object"&&Dt&&!Dt.nodeType&&Dt,b0=Wd&&Wd.exports===pp;function v0(e,t){return e.set(t[0],t[1]),e}function A0(e,t){return e.add(t),e}function x0(e,t){var r=-1,n=e?e.length:0;while(++r<n)if(t(e[r],r,e)===!1)break;return e}function T0(e,t){var r=-1,n=t.length,i=e.length;while(++r<n)e[i+r]=t[r];return e}function hp(e,t,r,n){var i=-1,o=e?e.length:0;if(n&&o)r=e[++i];while(++i<o)r=t(r,e[i],i,e);return r}function C0(e,t){var r=-1,n=Array(e);while(++r<e)n[r]=t(r);return n}function I0(e,t){return e==null?void 0:e[t]}function mp(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function jd(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function As(e,t){return function(r){return e(t(r))}}function Dd(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var R0=Array.prototype,O0=Function.prototype,pi=Object.prototype,ps=_e["__core-js_shared__"],Fd=function(){var e=/[^.]+$/.exec(ps&&ps.keys&&ps.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),yp=O0.toString,Be=pi.hasOwnProperty,hi=pi.toString,_0=RegExp("^"+yp.call(Be).replace(m0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qd=b0?_e.Buffer:void 0,Ud=_e.Symbol,Hd=_e.Uint8Array,k0=As(Object.getPrototypeOf,Object),P0=Object.create,K0=pi.propertyIsEnumerable,N0=R0.splice,Bd=Object.getOwnPropertySymbols,$0=qd?qd.isBuffer:void 0,L0=As(Object.keys,Object),ms=Ut(_e,"DataView"),Ir=Ut(_e,"Map"),ys=Ut(_e,"Promise"),gs=Ut(_e,"Set"),ws=Ut(_e,"WeakMap"),Rr=Ut(Object,"create"),J0=ot(ms),W0=ot(Ir),j0=ot(ys),D0=ot(gs),F0=ot(ws),Md=Ud?Ud.prototype:void 0,Gd=Md?Md.valueOf:void 0;function it(e){var t=-1,r=e?e.length:0;this.clear();while(++t<r){var n=e[t];this.set(n[0],n[1])}}function q0(){this.__data__=Rr?Rr(null):{}}function U0(e){return this.has(e)&&delete this.__data__[e]}function H0(e){var t=this.__data__;if(Rr){var r=t[e];return r===zd?void 0:r}return Be.call(t,e)?t[e]:void 0}function B0(e){var t=this.__data__;return Rr?t[e]!==void 0:Be.call(t,e)}function M0(e,t){var r=this.__data__;return r[e]=Rr&&t===void 0?zd:t,this}it.prototype.clear=q0;it.prototype.delete=U0;it.prototype.get=H0;it.prototype.has=B0;it.prototype.set=M0;function ke(e){var t=-1,r=e?e.length:0;this.clear();while(++t<r){var n=e[t];this.set(n[0],n[1])}}function G0(){this.__data__=[]}function z0(e){var t=this.__data__,r=mi(t,e);if(r<0)return!1;var n=t.length-1;if(r==n)t.pop();else N0.call(t,r,1);return!0}function V0(e){var t=this.__data__,r=mi(t,e);return r<0?void 0:t[r][1]}function X0(e){return mi(this.__data__,e)>-1}function Y0(e,t){var r=this.__data__,n=mi(r,e);if(n<0)r.push([e,t]);else r[n][1]=t;return this}ke.prototype.clear=G0;ke.prototype.delete=z0;ke.prototype.get=V0;ke.prototype.has=X0;ke.prototype.set=Y0;function Ft(e){var t=-1,r=e?e.length:0;this.clear();while(++t<r){var n=e[t];this.set(n[0],n[1])}}function Z0(){this.__data__={hash:new it,map:new(Ir||ke),string:new it}}function Q0(e){return yi(this,e).delete(e)}function ev(e){return yi(this,e).get(e)}function tv(e){return yi(this,e).has(e)}function rv(e,t){return yi(this,e).set(e,t),this}Ft.prototype.clear=Z0;Ft.prototype.delete=Q0;Ft.prototype.get=ev;Ft.prototype.has=tv;Ft.prototype.set=rv;function qt(e){this.__data__=new ke(e)}function nv(){this.__data__=new ke}function iv(e){return this.__data__.delete(e)}function ov(e){return this.__data__.get(e)}function sv(e){return this.__data__.has(e)}function av(e,t){var r=this.__data__;if(r instanceof ke){var n=r.__data__;if(!Ir||n.length<d0-1)return n.push([e,t]),this;r=this.__data__=new Ft(n)}return r.set(e,t),this}qt.prototype.clear=nv;qt.prototype.delete=iv;qt.prototype.get=ov;qt.prototype.has=sv;qt.prototype.set=av;function cv(e,t){var r=Ts(e)||Pv(e)?C0(e.length,String):[],n=r.length,i=!!n;for(var o in e)if((t||Be.call(e,o))&&!(i&&(o=="length"||Rv(o,n))))r.push(o);return r}function gp(e,t,r){var n=e[t];if(!(Be.call(e,t)&&bp(n,r))||r===void 0&&!(t in e))e[t]=r}function mi(e,t){var r=e.length;while(r--)if(bp(e[r][0],t))return r;return-1}function uv(e,t){return e&&wp(t,Cs(t),e)}function Es(e,t,r,n,i,o,s){var a;if(n)a=o?n(e,i,o,s):n(e);if(a!==void 0)return a;if(!gi(e))return e;var f=Ts(e);if(f){if(a=Tv(e),!t)return vv(e,a)}else{var c=nt(e),u=c==bs||c==Zd;if(Nv(e))return mv(e,t);if(c==vs||c==Ss||u&&!o){if(mp(e))return o?e:{};if(a=Cv(u?{}:e),!t)return Av(e,uv(a,e))}else{if(!J[c])return o?e:{};a=Iv(e,c,Es,t)}}s||(s=new qt);var l=s.get(e);if(l)return l;if(s.set(e,a),!f)var p=r?xv(e):Cs(e);return x0(p||e,function(d,g){if(p)g=d,d=e[g];gp(a,g,Es(d,t,r,n,g,e,s))}),a}function fv(e){return gi(e)?P0(e):{}}function lv(e,t,r){var n=t(e);return Ts(e)?n:T0(n,r(e))}function dv(e){return hi.call(e)}function pv(e){if(!gi(e)||_v(e))return!1;var t=Ap(e)||mp(e)?_0:g0;return t.test(ot(e))}function hv(e){if(!Sp(e))return L0(e);var t=[];for(var r in Object(e))if(Be.call(e,r)&&r!="constructor")t.push(r);return t}function mv(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function xs(e){var t=new e.constructor(e.byteLength);return new Hd(t).set(new Hd(e)),t}function yv(e,t){var r=t?xs(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function gv(e,t,r){var n=t?r(jd(e),!0):jd(e);return hp(n,v0,new e.constructor)}function wv(e){var t=new e.constructor(e.source,y0.exec(e));return t.lastIndex=e.lastIndex,t}function Ev(e,t,r){var n=t?r(Dd(e),!0):Dd(e);return hp(n,A0,new e.constructor)}function Sv(e){return Gd?Object(Gd.call(e)):{}}function bv(e,t){var r=t?xs(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function vv(e,t){var r=-1,n=e.length;t||(t=Array(n));while(++r<n)t[r]=e[r];return t}function wp(e,t,r,n){r||(r={});var i=-1,o=t.length;while(++i<o){var s=t[i],a=n?n(r[s],e[s],s,r,e):void 0;gp(r,s,a===void 0?e[s]:a)}return r}function Av(e,t){return wp(e,Ep(e),t)}function xv(e){return lv(e,Cs,Ep)}function yi(e,t){var r=e.__data__;return Ov(t)?r[typeof t=="string"?"string":"hash"]:r.map}function Ut(e,t){var r=I0(e,t);return pv(r)?r:void 0}var Ep=Bd?As(Bd,Object):Jv,nt=dv;if(ms&&nt(new ms(new ArrayBuffer(1)))!=di||Ir&&nt(new Ir)!=fi||ys&&nt(ys.resolve())!=Jd||gs&&nt(new gs)!=li||ws&&nt(new ws)!=hs)nt=function(e){var t=hi.call(e),r=t==vs?e.constructor:void 0,n=r?ot(r):void 0;if(n)switch(n){case J0:return di;case W0:return fi;case j0:return Jd;case D0:return li;case F0:return hs}return t};function Tv(e){var t=e.length,r=e.constructor(t);if(t&&typeof e[0]=="string"&&Be.call(e,"index"))r.index=e.index,r.input=e.input;return r}function Cv(e){return typeof e.constructor=="function"&&!Sp(e)?fv(k0(e)):{}}function Iv(e,t,r,n){var i=e.constructor;switch(t){case np:return xs(e);case Xd:case Yd:return new i(+e);case di:return yv(e,n);case ip:case op:case sp:case ap:case cp:case up:case fp:case lp:case dp:return bv(e,n);case fi:return gv(e,n,r);case Qd:case tp:return new i(e);case ep:return wv(e);case li:return Ev(e,n,r);case rp:return Sv(e)}}function Rv(e,t){return t=t==null?Vd:t,!!t&&(typeof e=="number"||w0.test(e))&&(e>-1&&e%1==0&&e<t)}function Ov(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function _v(e){return!!Fd&&Fd in e}function Sp(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||pi;return e===r}function ot(e){if(e!=null){try{return yp.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function kv(e){return Es(e,!0,!0)}function bp(e,t){return e===t||e!==e&&t!==t}function Pv(e){return Kv(e)&&Be.call(e,"callee")&&(!K0.call(e,"callee")||hi.call(e)==Ss)}var Ts=Array.isArray;function vp(e){return e!=null&&$v(e.length)&&!Ap(e)}function Kv(e){return Lv(e)&&vp(e)}var Nv=$0||Wv;function Ap(e){var t=gi(e)?hi.call(e):"";return t==bs||t==Zd}function $v(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Vd}function gi(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Lv(e){return!!e&&typeof e=="object"}function Cs(e){return vp(e)?cv(e):hv(e)}function Jv(){return[]}function Wv(){return!1}Dt.exports=kv});var Rs=m(function(wi){Object.defineProperty(wi,"__esModule",{value:!0});wi.deepFreeze=void 0;function xp(e){if(e)Object.freeze(e),Object.getOwnPropertyNames(e).forEach(function(t){if(e.hasOwnProperty(t)&&e[t]!==null&&(typeof e[t]==="object"||typeof e[t]==="function")&&e[t].constructor!==Buffer&&!Object.isFrozen(e[t]))xp(e[t])});return e}wi.deepFreeze=xp});var Ip=m(function(Ht){var jv=Ht&&Ht.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.syncMemoizer=void 0;var Dv=ui(),Fv=require("events"),Tp=jv(Is()),Cp=Rs();function qv(e){let t=new Dv.LRUCache(e),r=e.load,n=e.hash,i=e.bypass,o=e.itemTTL,s=e.freeze,a=e.clone,f=new Fv.EventEmitter,c=Object.assign({del:u,reset:()=>t.clear(),keys:()=>[...t.keys()],on:f.on.bind(f),once:f.once.bind(f)},e);if(e.disable)return Object.assign(r,c);function u(){let h=n(...arguments);t.delete(h)}function l(h,...S){f.emit(h,...S)}function p(h){return h&&h.then&&typeof h.then==="function"}function d(h){let S=h;if(a)if(p(S))S=S.then(Tp.default);else S=(0,Tp.default)(S);if(s)if(p(S))S=S.then(Cp.deepFreeze);else(0,Cp.deepFreeze)(S);return S}return Object.assign(function(...h){if(i&&i(...h))return l("miss",...h),r(...h);var S=n(...h),E=t.get(S);if(E)return l("hit",...h),d(E);l("miss",...h);let y=r(...h);if(o)t.set(S,y,{ttl:o(...h.concat([y]))});else t.set(S,y);return d(y)},c)}Ht.syncMemoizer=qv});var Op=m(function(Bt){var Uv=Bt&&Bt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bt,"__esModule",{value:!0});Bt.asyncMemoizer=void 0;var Hv=ui(),Bv=require("events"),Mv=Uv(Is()),Gv=Rs(),zv=Ip();function Rp(e){let t=new Hv.LRUCache(e),r=e.load,n=e.hash,i=e.bypass,o=e.itemTTL,s=e.freeze,a=e.clone,f=e.queueTTL||1000,c=new Map,u=new Bv.EventEmitter,l=Object.assign({del:p,reset:()=>t.clear(),keys:()=>[...t.keys()],on:u.on.bind(u),once:u.once.bind(u)},e);if(e.disable)return Object.assign(r,l);function p(...E){let y=n(...E);t.delete(y)}function d(E,y,T){if(s)T.forEach(Gv.deepFreeze);if(o)t.set(E,T,{ttl:o(...y.concat(T))});else t.set(E,T)}function g(E,y){for(let T of E)if(a)setImmediate(T,...y.map(Mv.default));else setImmediate(T,...y)}function h(E,...y){u.emit(E,...y)}function S(...E){let y=E.slice(0,-1),T=E.slice(-1).pop(),I;if(i&&i(...y))return h("miss",...y),r(...E);if(y.length===0&&!n)I="_";else I=n(...y);let O=t.get(I);if(O)return h("hit",...y),g([T],[null].concat(O));let j=c.get(I);if(j&&j.expiresAt>Date.now()){j.queue.push(T),h("queue",...y);return}h("miss",...y);let q=Date.now(),V=[T];c.set(I,{queue:V,expiresAt:q+f});let N=(...ee)=>{if(!ee[0])d(I,y,ee.slice(1));c.delete(I),h("loaded",Date.now()-q,...y),g(V,ee)};r(...y,N)}return Object.assign(S,l)}Bt.asyncMemoizer=Rp;Rp.sync=zv.syncMemoizer});var kp=m(function(v_,_p){var Vv=Op();_p.exports=Vv.asyncMemoizer});var Np=m(function(A_,Kp){var Os=yn()("jwks"),Xv=kp(),{LRUCache:Yv}=ui(),{promisify:Zv,callbackify:Pp}=require("util");function Qv(e,{cacheMaxEntries:t=5,cacheMaxAge:r=600000,cacheMaxAgeFallback:n,onStaleCacheFallback:i}){Os(`Configured caching of signing keys. Max: ${t} / Age: ${r}${n?` / Fallback: ${n}`:""}`);let o;if(n){let s=new Yv({max:t}),a=e.getSigningKey.bind(e);o=Pp(async(f)=>{try{let c=await a(f);return s.set(f,{key:c,fetchedAt:Date.now()}),c}catch(c){if(c.isEndpointUnavailable){let u=s.get(f);if(u&&Date.now()-u.fetchedAt<r+n){if(Os(`JWKS endpoint unavailable, serving stale signing key for '${f}': ${c.message}`),i)i(c,f,u.key);return u.key}Os(`JWKS endpoint unavailable and no valid stale entry for '${f}', fallback window expired or key never fetched`)}throw c}})}else o=Pp(e.getSigningKey.bind(e));return Zv(Xv({hash:(s)=>s,load:o,ttl:r,max:t}))}Kp.exports.default=Qv});var _s=m(function(x_,Lp){var $p=function(e,t,r,n){if(this.bucketSize=e,this.tokensPerInterval=t,typeof r==="string")switch(r){case"sec":case"second":this.interval=1000;break;case"min":case"minute":this.interval=60000;break;case"hr":case"hour":this.interval=3600000;break;case"day":this.interval=86400000;break;default:throw Error("Invaid interval "+r)}else this.interval=r;this.parentBucket=n,this.content=0,this.lastDrip=+new Date};$p.prototype={bucketSize:1,tokensPerInterval:1,interval:1000,parentBucket:null,content:0,lastDrip:0,removeTokens:function(e,t){var r=this;if(!this.bucketSize)return process.nextTick(t.bind(null,null,e,Number.POSITIVE_INFINITY)),!0;if(e>this.bucketSize)return process.nextTick(t.bind(null,"Requested tokens "+e+" exceeds bucket size "+this.bucketSize,null)),!1;if(this.drip(),e>this.content)return n();if(this.parentBucket)return this.parentBucket.removeTokens(e,function(i,o){if(i)return t(i,null);if(e>r.content)return n();r.content-=e,t(null,Math.min(o,r.content))});else return this.content-=e,process.nextTick(t.bind(null,null,this.content)),!0;function n(){var i=Math.ceil((e-r.content)*(r.interval/r.tokensPerInterval));return setTimeout(function(){r.removeTokens(e,t)},i),!1}},tryRemoveTokens:function(e){if(!this.bucketSize)return!0;if(e>this.bucketSize)return!1;if(this.drip(),e>this.content)return!1;if(this.parentBucket&&!this.parentBucket.tryRemoveTokens(e))return!1;return this.content-=e,!0},drip:function(){if(!this.tokensPerInterval){this.content=this.bucketSize;return}var e=+new Date,t=Math.max(e-this.lastDrip,0);this.lastDrip=e;var r=t*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+r,this.bucketSize)}};Lp.exports=$p});var Wp=m(function(T_,Jp){var eA=function(){if(typeof process<"u"&&process.hrtime){var e=process.hrtime(),t=e[0],r=e[1];return t*1000+Math.floor(r/1e6)}return new Date().getTime()};Jp.exports=eA});var Fp=m(function(C_,Dp){var tA=_s(),ks=Wp(),jp=function(e,t,r){this.tokenBucket=new tA(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=ks(),this.tokensThisInterval=0,this.fireImmediately=r};jp.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(e,t){if(e>this.tokenBucket.bucketSize)return process.nextTick(t.bind(null,"Requested tokens "+e+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var r=this,n=ks();if(n<this.curIntervalStart||n-this.curIntervalStart>=this.tokenBucket.interval)this.curIntervalStart=n,this.tokensThisInterval=0;if(e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)process.nextTick(t.bind(null,null,-1));else{var i=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-n);setTimeout(function(){r.tokenBucket.removeTokens(e,o)},i)}return!1}return this.tokenBucket.removeTokens(e,o);function o(s,a){if(s)return t(s,null);r.tokensThisInterval+=e,t(null,a)}},tryRemoveTokens:function(e){if(e>this.tokenBucket.bucketSize)return!1;var t=ks();if(t<this.curIntervalStart||t-this.curIntervalStart>=this.tokenBucket.interval)this.curIntervalStart=t,this.tokensThisInterval=0;if(e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var r=this.tokenBucket.tryRemoveTokens(e);if(r)this.tokensThisInterval+=e;return r},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}};Dp.exports=jp});var qp=m(function(Ps){Ps.RateLimiter=Fp();Ps.TokenBucket=_s()});var Ks=m(function(R_,Up){function Ei(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="JwksRateLimitError",this.message=e}Ei.prototype=Object.create(Error.prototype);Ei.prototype.constructor=Ei;Up.exports=Ei});var Bp=m(function(O_,Hp){var Ns=yn()("jwks"),{RateLimiter:rA}=qp(),nA=Ks();function iA(e,{jwksRequestsPerMinute:t=10}){let r=e.getSigningKey.bind(e),n=new rA(t,"minute",!0);return Ns(`Configured rate limiting to JWKS endpoint at ${t}/minute`),async(i)=>await new Promise((o,s)=>{n.removeTokens(1,async(a,f)=>{if(a)s(a);if(Ns("Requests to the JWKS endpoint available for the next minute:",f),f<0)Ns("Too many requests to the JWKS endpoint"),s(new nA("Too many requests to the JWKS endpoint"));else try{let c=await r(i);o(c)}catch(c){s(c)}})})}Hp.exports.default=iA});var Gp=m(function(__,Mp){var oA=fs().retrieveSigningKeys;function sA(e,{getKeysInterceptor:t}){let r=e.getSigningKey.bind(e);return async(n)=>{let i=await t(),o;if(i&&i.length)o=await oA(i);if(o&&o.length){let s=o.find((a)=>!n||a.kid===n);if(s)return s}return r(n)}}Mp.exports.default=sA});var Vp=m(function(k_,zp){var{callbackify:aA}=require("util"),cA=(e)=>{let t=e.getSigningKey.bind(e);return(r,n)=>{if(n)return aA(t)(r,n);return t(r)}};zp.exports.default=cA});var Yp=m(function(P_,Xp){Xp.exports={request:Pd().default,cacheSigningKey:Np().default,rateLimitSigningKey:Bp().default,getKeysInterceptor:Gp().default,callbackSupport:Vp().default}});var $s=m(function(K_,Zp){function Si(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="SigningKeyNotFoundError",this.message=e}Si.prototype=Object.create(Error.prototype);Si.prototype.constructor=Si;Zp.exports=Si});var Mt=m(function(N_,th){var st=yn()("jwks"),{retrieveSigningKeys:uA}=fs(),{request:fA,cacheSigningKey:lA,rateLimitSigningKey:dA,getKeysInterceptor:pA,callbackSupport:hA}=Yp(),Ls=oi(),Qp=$s();class eh{constructor(e){if(this.options={rateLimit:!1,cache:!0,timeout:30000,...e},this.options.getKeysInterceptor)this.getSigningKey=pA(this,e);if(this.options.rateLimit)this.getSigningKey=dA(this,e);if(this.options.cache)this.getSigningKey=lA(this,e);this.getSigningKey=hA(this,e)}async getKeys(){st(`Fetching keys from '${this.options.jwksUri}'`);try{let e=await fA({uri:this.options.jwksUri,headers:this.options.requestHeaders,agent:this.options.requestAgent,timeout:this.options.timeout,fetcher:this.options.fetcher});return st("Keys:",e.keys),e.keys}catch(e){let{errorMsg:t}=e;st("Failure:",t||e);let r=t?new Ls(t):e;throw r.isEndpointUnavailable=!0,r}}async getSigningKeys(){let e=await this.getKeys();if(!e||!e.length)throw new Ls("The JWKS endpoint did not contain any keys");let t=await uA(e);if(!t.length)throw new Ls("The JWKS endpoint did not contain any signing keys");return st("Signing Keys:",t),t}async getSigningKey(e){st(`Fetching signing key for '${e}'`);let t=await this.getSigningKeys(),r=e!==void 0&&e!==null;if(!r&&t.length>1)throw st("No KID specified and JWKS endpoint returned more than 1 key"),new Qp("No KID specified and JWKS endpoint returned more than 1 key");let n=t.find((i)=>!r||i.kid===e);if(n)return n;else throw st(`Unable to find a signing key that matches '${e}'`),new Qp(`Unable to find a signing key that matches '${e}'`)}}th.exports={JwksClient:eh}});var Gt=m(function($_,rh){rh.exports={ArgumentError:ls(),JwksError:oi(),JwksRateLimitError:Ks(),SigningKeyNotFoundError:$s()}});var Or=m(function(L_,nh){var mA=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512","EdDSA"];nh.exports=mA});var ih=m(function(J_,bi){var{ArgumentError:yA}=Gt(),{JwksClient:gA}=Mt(),wA=Or(),EA=(e,t)=>{if(e&&e.name==="SigningKeyNotFoundError")return t(e,null,null);if(e)return t(e,null,null)};bi.exports.hapiJwt2KeyAsync=(e)=>{let t=bi.exports.hapiJwt2Key(e);return function(r){return new Promise((n,i)=>{t(r,(s,a)=>{!a||s?i(s):n({key:a})})})}};bi.exports.hapiJwt2Key=function(e){if(e===null||e===void 0)throw new yA("An options object must be provided when initializing hapiJwt2Key");let t=new gA(e),r=e.handleSigningKeyError||EA;return function(i,o){if(!i||!i.header)return o(Error("Cannot find a signing certificate if there is no header"),null,null);if(!wA.includes(i.header.alg))return o(Error("Unsupported algorithm "+i.header.alg+" supplied."),null,null);t.getSigningKey(i.header.kid).then((s)=>o(null,s.publicKey||s.rsaPublicKey,s)).catch((s)=>r(s,(a)=>o(a,null,null)))}}});var sh=m(function(W_,oh){var{ArgumentError:SA}=Gt(),{JwksClient:bA}=Mt(),vA=Or(),AA=(e,t)=>{if(e&&e.name==="SigningKeyNotFoundError")return t(null);if(e)return t(e)};oh.exports.expressJwtSecret=function(e){if(e===null||e===void 0)throw new SA("An options object must be provided when initializing expressJwtSecret");let t=new bA(e),r=e.handleSigningKeyError||AA,n=async(i,o)=>{if(!o)return;let s=o.header;if(!s||!vA.includes(s.alg))return;try{let a=await t.getSigningKey(s.kid);return a.publicKey||a.rsaPublicKey}catch(a){return new Promise((f,c)=>{r(a,(u)=>{if(!u)return f();c(u)})})}};return function(o,s,a,f){if(arguments.length===4){n(o,{header:s}).then((c)=>{setImmediate(f,null,c)}).catch((c)=>{setImmediate(f,c)});return}return n(o,arguments[1])}}});var ch=m(function(j_,ah){var{ArgumentError:xA}=Gt(),{JwksClient:TA}=Mt(),CA=Or();ah.exports.koaJwtSecret=function(e={}){if(!e.jwksUri)throw new xA("No JWKS provided. Please provide a jwksUri");let t=new TA(e);return function({alg:n,kid:i}={}){return new Promise((o,s)=>{if(!CA.includes(n))return s(Error("Missing / invalid token algorithm"));t.getSigningKey(i).then((a)=>{o(a.publicKey||a.rsaPublicKey)}).catch((a)=>{if(e.handleSigningKeyError)return e.handleSigningKeyError(a).then(s);return s(a)})})}}});var dh=m(function(D_,lh){var uh=(us(),_r(cs)),{ArgumentError:fh}=Gt(),{JwksClient:IA}=Mt(),RA=Or(),OA=(e,t)=>{if(e&&e.name==="SigningKeyNotFoundError")return t(null);if(e)return t(e)};lh.exports.passportJwtSecret=function(e){if(e===null||e===void 0)throw new fh("An options object must be provided when initializing passportJwtSecret");if(!e.jwksUri)throw new fh("No JWKS provided. Please provide a jwksUri");let t=new IA(e),r=e.handleSigningKeyError||OA;return function(i,o,s){let a;try{a={payload:uh.decodeJwt(o),header:uh.decodeProtectedHeader(o)}}catch(f){a=null}if(!a||!RA.includes(a.header.alg))return s(null,null);t.getSigningKey(a.header.kid).then((f)=>{s(null,f.publicKey||f.rsaPublicKey)}).catch((f)=>{r(f,(c)=>s(c,null))})}}});var hh=m(function(F_,pe){var{JwksClient:ph}=Mt(),vi=Gt(),{hapiJwt2Key:_A,hapiJwt2KeyAsync:kA}=ih(),{expressJwtSecret:PA}=sh(),{koaJwtSecret:KA}=ch(),{passportJwtSecret:NA}=dh();pe.exports=(e)=>new ph(e);pe.exports.JwksClient=ph;pe.exports.ArgumentError=vi.ArgumentError;pe.exports.JwksError=vi.JwksError;pe.exports.JwksRateLimitError=vi.JwksRateLimitError;pe.exports.SigningKeyNotFoundError=vi.SigningKeyNotFoundError;pe.exports.expressJwtSecret=PA;pe.exports.hapiJwt2Key=_A;pe.exports.hapiJwt2KeyAsync=kA;pe.exports.koaJwtSecret=KA;pe.exports.passportJwtSecret=NA});var jA={};Vt(jA,{handler:()=>WA});module.exports=_r(jA);var Ms=`<!DOCTYPE html>
11
11
  <html lang="en">
12
12
  <head>
13
13
  <meta charset="utf-8" />
@@ -27,4 +27,4 @@ ${r}
27
27
  </p>
28
28
  </body>
29
29
  </html>
30
- `;var zs=require("node:fs"),kr=ut(require("node:path")),Vs=require("node:url");var Rh=(()=>{let e=function(){};return e.prototype=Object.create(null),e})();function _r(e,t){let r=new Rh,n=e.length;if(n<2)return r;let i=t?.decode||kh,o=0;do{let s=_h(e,o,n);if(s===n)break;let a=Oh(e,o,n);if(s>a){o=e.lastIndexOf(";",s-1)+1;continue}let f=Gs(e,o,s);if(r[f]===void 0)r[f]=i(Gs(e,s+1,a));o=a+1}while(o<n);return r}function Oh(e,t,r){let n=e.indexOf(";",t);return n===-1?r:n}function _h(e,t,r){let n=e.indexOf("=",t);return n===-1?r:n}function Gs(e,t,r){if(t===r)return"";let n=t,i=r;do{let o=e.charCodeAt(n);if(o!==32&&o!==9)break}while(++n<i);while(i>n){let o=e.charCodeAt(i-1);if(o!==32&&o!==9)break;i--}return e.slice(n,i)}function kh(e){if(e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch(t){return e}}var vi;((o)=>{o[o.none=0]="none";o[o.error=10]="error";o[o.warn=20]="warn";o[o.info=30]="info";o[o.debug=40]="debug"})(vi||={});class Ai{logLevel;constructor(e){this.logLevel=e}jsonify(e){return e.map((t)=>{if(typeof t==="object")try{return JSON.stringify(t)}catch{return t}return t})}info(...e){if(this.logLevel>=30)console.log(...this.jsonify(e))}warn(...e){if(this.logLevel>=20)console.warn(...this.jsonify(e))}error(...e){if(this.logLevel>=10)console.error(...this.jsonify(e))}debug(...e){if(this.logLevel>=40)console.trace(...this.jsonify(e))}}var Ph=Vs.fileURLToPath("file:///home/runner/work/cdk-cloudfront-auth/cdk-cloudfront-auth/src/handlers/util/config.ts"),Kh=kr.dirname(Ph);function xi(){let t=process.env.LAMBDA_TASK_ROOT||Kh,r=kr.join(t,"config.json");console.log("Loading config from",r);let n=JSON.parse(zs.readFileSync(r,"utf-8")),o=`https://cognito-idp.${/^(\S+?)_\S+$/.exec(n.userPoolId)[1]}.amazonaws.com/${n.userPoolId}`,s=`${o}/.well-known/jwks.json`;return{nonceMaxAge:Number.parseInt(_r(n.cookieSettings.nonce.toLowerCase())["max-age"]??"",10)||86400,...n,tokenIssuer:o,tokenJwksUri:s,logger:new Ai(vi[n.logLevel])}}function Nh(e){return Object.entries(e).reduce((t,[r,n])=>Object.assign(t,{[r.toLowerCase()]:[{key:r,value:n}]}),{})}function Ti(e,t){let r=t?.cookies?{"set-cookie":t.cookies.map((n)=>({key:"set-cookie",value:n}))}:{};return{status:"307",statusDescription:"Temporary Redirect",headers:{location:[{key:"location",value:e}],...r}}}function VA(e){return{body:$h(e),status:e.statusCode??"500",headers:{"content-type":[{key:"Content-Type",value:"text/html; charset=UTF-8"}]}}}function $h(e){let t={...e,region:process.env.AWS_REGION};return Ms.replace(/\${([^}]*)}/g,(r,n)=>t[n]||"")}function Xs(e,t){if(!t)throw Error("Expected response value");return{...t,headers:{...t.headers??{},...Nh(e.httpHeaders)}}}function Ys(e){let t;return async(r)=>{if(!t)t=xi();t.logger.debug("Handling event:",r);let n=Xs(t,await e(t,r));return t.logger.debug("Returning response:",n),n}}function XA(e){let t;return async(r)=>{if(!t)t=xi();t.logger.debug("Handling event:",r);let n=Xs(t,await e(t,r));return t.logger.debug("Returning response:",n),n}}var Ws=ut(_f(),1),mh=ut(hh(),1),Ls;function $A(e){return"rsaPublicKey"in e}async function JA(e,t){if(!Ls)Ls=mh.default({cache:!0,rateLimit:!0,jwksUri:e});let r=await Ls.getSigningKey(t);return $A(r)?r.rsaPublicKey:r.publicKey}async function q_(e,t,r,n){let i=Ws.default.decode(e,{complete:!0});if(!i||typeof i==="string")return{validationError:Error("Cannot parse JWT token")};let o=i.header.kid;if(!o)return{validationError:Error("JWT header is missing 'kid' claim")};let s=await JA(t,o);if(s instanceof Error)return{validationError:s};let a={audience:n,issuer:r,ignoreExpiration:!1};return new Promise((f)=>Ws.default.verify(e,s,a,(c)=>c?f({validationError:c}):f(void 0)))}function yh(e){let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/");return JSON.parse(Buffer.from(r,"base64").toString())}function LA(e){if(!e.cookie)return{};return e.cookie.reduce((r,n)=>({...r,..._r(n.value)}),{})}function at(e,t){if(t.toLowerCase().indexOf("domain")===-1)return`${t}; Domain=.${e}`;return t}function gh(e,t){let r=LA(e);if(!r)return{};let n=`CognitoIdentityServiceProvider.${t}`,i=r[`${n}.LastAuthUser`];return{tokenUserName:i,idToken:r[`${n}.${i??""}.idToken`],accessToken:r[`${n}.${i??""}.accessToken`],refreshToken:r[`${n}.${i??""}.refreshToken`],scopes:r[`${n}.${i??""}.tokenScopesString`],nonce:r["spa-auth-edge-nonce"],nonceHmac:r["spa-auth-edge-nonce-hmac"],pkce:r["spa-auth-edge-pkce"]}}function wh(e){let t=yh(e.tokens.idToken),r=t["cognito:username"],n=`CognitoIdentityServiceProvider.${e.clientId}`,i=`${n}.${r}.idToken`,o=`${n}.${r}.accessToken`,s=`${n}.${r}.refreshToken`,a=`${n}.LastAuthUser`,f=`${n}.${r}.tokenScopesString`,c=e.oauthScopes.join(" "),u=`${n}.${r}.userData`,l=JSON.stringify({UserAttributes:[{Name:"sub",Value:t.sub},{Name:"email",Value:t.email}],Username:r}),p={[i]:`${e.tokens.idToken}; ${at(e.domainName,e.cookieSettings.idToken)}`,[o]:`${e.tokens.accessToken}; ${at(e.domainName,e.cookieSettings.accessToken)}`,[s]:`${e.tokens.refreshToken}; ${at(e.domainName,e.cookieSettings.refreshToken)}`,[a]:`${r}; ${at(e.domainName,e.cookieSettings.idToken)}`,[f]:`${c}; ${at(e.domainName,e.cookieSettings.accessToken)}`,[u]:`${encodeURIComponent(l)}; ${at(e.domainName,e.cookieSettings.idToken)}`,"amplify-signin-with-hostedUI":`true; ${at(e.domainName,e.cookieSettings.accessToken)}`};if(e.event==="signOut")Object.keys(p).forEach((d)=>p[d]=js(p[d]));else if(e.event==="refreshFailed")p[s]=js(p[s]);return["spa-auth-edge-nonce","spa-auth-edge-nonce-hmac","spa-auth-edge-pkce"].forEach((d)=>{p[d]=js(p[d])}),Object.entries(p).map(([d,g])=>`${d}=${g}`)}function js(e=""){let t=e.split(";").map((n)=>n.trim()).filter((n)=>!n.toLowerCase().startsWith("max-age")).filter((n)=>!n.toLowerCase().startsWith("expires")),r=`Expires=${new Date(0).toUTCString()}`;return["",...t.slice(1),r].join("; ")}var WA=Ys(async(e,t)=>{let r=t.Records[0].cf.request,n=r.headers.host[0].value,{idToken:i,accessToken:o,refreshToken:s}=gh(r.headers,e.clientId);if(!i)return Ti(`https://${n}${e.signOutRedirectTo}`);let a=new URLSearchParams({logout_uri:`https://${n}${e.signOutRedirectTo}`,client_id:e.clientId}).toString();return Ti(`https://${e.cognitoAuthDomain}/logout?${a}`,{cookies:wh({event:"signOut",tokens:{idToken:i,accessToken:o??"",refreshToken:s??""},domainName:n,...e})})});
30
+ `;var zs=require("node:fs"),Pr=ut(require("node:path")),Vs=require("node:url");var Rh=(()=>{let e=function(){};return e.prototype=Object.create(null),e})();function kr(e,t){let r=new Rh,n=e.length;if(n<2)return r;let i=t?.decode||kh,o=0;do{let s=_h(e,o,n);if(s===n)break;let a=Oh(e,o,n);if(s>a){o=e.lastIndexOf(";",s-1)+1;continue}let f=Gs(e,o,s);if(r[f]===void 0)r[f]=i(Gs(e,s+1,a));o=a+1}while(o<n);return r}function Oh(e,t,r){let n=e.indexOf(";",t);return n===-1?r:n}function _h(e,t,r){let n=e.indexOf("=",t);return n===-1?r:n}function Gs(e,t,r){if(t===r)return"";let n=t,i=r;do{let o=e.charCodeAt(n);if(o!==32&&o!==9)break}while(++n<i);while(i>n){let o=e.charCodeAt(i-1);if(o!==32&&o!==9)break;i--}return e.slice(n,i)}function kh(e){if(e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch(t){return e}}var ft={none:0,error:10,warn:20,info:30,debug:40};class Ai{logLevel;constructor(e){this.logLevel=e}jsonify(e){return e.map((t)=>{if(typeof t==="object")try{return JSON.stringify(t)}catch{return t}return t})}info(...e){if(this.logLevel>=ft.info)console.log(...this.jsonify(e))}warn(...e){if(this.logLevel>=ft.warn)console.warn(...this.jsonify(e))}error(...e){if(this.logLevel>=ft.error)console.error(...this.jsonify(e))}debug(...e){if(this.logLevel>=ft.debug)console.trace(...this.jsonify(e))}}var Ph=Vs.fileURLToPath("file:///home/runner/work/cdk-cloudfront-auth/cdk-cloudfront-auth/src/handlers/util/config.ts"),Kh=Pr.dirname(Ph);function xi(){let t=process.env.LAMBDA_TASK_ROOT||Kh,r=Pr.join(t,"config.json");console.log("Loading config from",r);let n=JSON.parse(zs.readFileSync(r,"utf-8")),o=`https://cognito-idp.${/^(\S+?)_\S+$/.exec(n.userPoolId)[1]}.amazonaws.com/${n.userPoolId}`,s=`${o}/.well-known/jwks.json`;return{nonceMaxAge:Number.parseInt(kr(n.cookieSettings.nonce.toLowerCase())["max-age"]??"",10)||86400,...n,tokenIssuer:o,tokenJwksUri:s,logger:new Ai(ft[n.logLevel])}}function Nh(e){return Object.entries(e).reduce((t,[r,n])=>Object.assign(t,{[r.toLowerCase()]:[{key:r,value:n}]}),{})}function Ti(e,t){let r=t?.cookies?{"set-cookie":t.cookies.map((n)=>({key:"set-cookie",value:n}))}:{};return{status:"307",statusDescription:"Temporary Redirect",headers:{location:[{key:"location",value:e}],...r}}}function VA(e){return{body:$h(e),status:e.statusCode??"500",headers:{"content-type":[{key:"Content-Type",value:"text/html; charset=UTF-8"}]}}}function $h(e){let t={...e,region:process.env.AWS_REGION};return Ms.replace(/\${([^}]*)}/g,(r,n)=>t[n]||"")}function Xs(e,t){if(!t)throw Error("Expected response value");return{...t,headers:{...t.headers??{},...Nh(e.httpHeaders)}}}function Ys(e){let t;return async(r)=>{if(!t)t=xi();t.logger.debug("Handling event:",r);let n=Xs(t,await e(t,r));return t.logger.debug("Returning response:",n),n}}function XA(e){let t;return async(r)=>{if(!t)t=xi();t.logger.debug("Handling event:",r);let n=Xs(t,await e(t,r));return t.logger.debug("Returning response:",n),n}}var Ws=ut(_f(),1),mh=ut(hh(),1),Js;function $A(e){return"rsaPublicKey"in e}async function LA(e,t){if(!Js)Js=mh.default({cache:!0,rateLimit:!0,jwksUri:e});let r=await Js.getSigningKey(t);return $A(r)?r.rsaPublicKey:r.publicKey}async function q_(e,t,r,n){let i=Ws.default.decode(e,{complete:!0});if(!i||typeof i==="string")return{validationError:Error("Cannot parse JWT token")};let o=i.header.kid;if(!o)return{validationError:Error("JWT header is missing 'kid' claim")};let s=await LA(t,o);if(s instanceof Error)return{validationError:s};let a={audience:n,issuer:r,ignoreExpiration:!1};return new Promise((f)=>Ws.default.verify(e,s,a,(c)=>c?f({validationError:c}):f(void 0)))}function yh(e){let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/");return JSON.parse(Buffer.from(r,"base64").toString())}function JA(e){if(!e.cookie)return{};return e.cookie.reduce((r,n)=>({...r,...kr(n.value)}),{})}function at(e,t){if(t.toLowerCase().indexOf("domain")===-1)return`${t}; Domain=.${e}`;return t}function gh(e,t){let r=JA(e);if(!r)return{};let n=`CognitoIdentityServiceProvider.${t}`,i=r[`${n}.LastAuthUser`];return{tokenUserName:i,idToken:r[`${n}.${i??""}.idToken`],accessToken:r[`${n}.${i??""}.accessToken`],refreshToken:r[`${n}.${i??""}.refreshToken`],scopes:r[`${n}.${i??""}.tokenScopesString`],nonce:r["spa-auth-edge-nonce"],nonceHmac:r["spa-auth-edge-nonce-hmac"],pkce:r["spa-auth-edge-pkce"]}}function wh(e){let t=yh(e.tokens.idToken),r=t["cognito:username"],n=`CognitoIdentityServiceProvider.${e.clientId}`,i=`${n}.${r}.idToken`,o=`${n}.${r}.accessToken`,s=`${n}.${r}.refreshToken`,a=`${n}.LastAuthUser`,f=`${n}.${r}.tokenScopesString`,c=e.oauthScopes.join(" "),u=`${n}.${r}.userData`,l=JSON.stringify({UserAttributes:[{Name:"sub",Value:t.sub},{Name:"email",Value:t.email}],Username:r}),p={[i]:`${e.tokens.idToken}; ${at(e.domainName,e.cookieSettings.idToken)}`,[o]:`${e.tokens.accessToken}; ${at(e.domainName,e.cookieSettings.accessToken)}`,[s]:`${e.tokens.refreshToken}; ${at(e.domainName,e.cookieSettings.refreshToken)}`,[a]:`${r}; ${at(e.domainName,e.cookieSettings.idToken)}`,[f]:`${c}; ${at(e.domainName,e.cookieSettings.accessToken)}`,[u]:`${encodeURIComponent(l)}; ${at(e.domainName,e.cookieSettings.idToken)}`,"amplify-signin-with-hostedUI":`true; ${at(e.domainName,e.cookieSettings.accessToken)}`};if(e.event==="signOut")Object.keys(p).forEach((d)=>p[d]=js(p[d]));else if(e.event==="refreshFailed")p[s]=js(p[s]);return["spa-auth-edge-nonce","spa-auth-edge-nonce-hmac","spa-auth-edge-pkce"].forEach((d)=>{p[d]=js(p[d])}),Object.entries(p).map(([d,g])=>`${d}=${g}`)}function js(e=""){let t=e.split(";").map((n)=>n.trim()).filter((n)=>!n.toLowerCase().startsWith("max-age")).filter((n)=>!n.toLowerCase().startsWith("expires")),r=`Expires=${new Date(0).toUTCString()}`;return["",...t.slice(1),r].join("; ")}var WA=Ys(async(e,t)=>{let r=t.Records[0].cf.request,n=r.headers.host[0].value,{idToken:i,accessToken:o,refreshToken:s}=gh(r.headers,e.clientId);if(!i)return Ti(`https://${n}${e.signOutRedirectTo}`);let a=new URLSearchParams({logout_uri:`https://${n}${e.signOutRedirectTo}`,client_id:e.clientId}).toString();return Ti(`https://${e.cognitoAuthDomain}/logout?${a}`,{cookies:wh({event:"signOut",tokens:{idToken:i,accessToken:o??"",refreshToken:s??""},domainName:n,...e})})});