@liflig/cdk-cloudfront-auth 1.10.13 → 1.10.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/check-auth/index.js +9 -6
- package/dist/generate-secret/index.js +1 -1
- package/dist/http-headers/index.js +2 -2
- package/dist/lambda-config-handler/index.js +22 -22
- package/dist/parse-auth/index.js +27 -24
- package/dist/refresh-auth/index.js +27 -24
- package/dist/sign-out/index.js +9 -6
- package/lib/cloudfront-auth.d.ts +2 -2
- package/lib/cloudfront-auth.js +5 -5
- package/lib/handlers/util/axios.d.ts +1 -1
- package/lib/handlers/util/axios.js +1 -1
- package/lib/handlers/util/cloudfront.d.ts +1 -1
- package/lib/handlers/util/cloudfront.js +2 -2
- package/lib/handlers/util/config.d.ts +3 -3
- package/lib/handlers/util/config.js +2 -2
- package/lib/handlers/util/cookies.js +2 -2
- package/lib/handlers/util/logger.d.ts +8 -7
- package/lib/handlers/util/logger.js +8 -9
- package/lib/handlers/util/nonce.d.ts +1 -1
- package/lib/handlers/util/nonce.js +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +5 -5
- package/lib/lambdas.d.ts +1 -1
- package/lib/lambdas.js +2 -2
- package/package.json +14 -15
package/dist/check-auth/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Oh=Object.create;var{getPrototypeOf:kh,defineProperty:zt,getOwnPropertyNames:Vs,getOwnPropertyDescriptor:_h}=Object,Xs=Object.prototype.hasOwnProperty;function Ys(e){return this[e]}var Ph,Kh,ut=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var i=t?Ph??=new WeakMap:Kh??=new WeakMap,o=i.get(e);if(o)return o}r=e!=null?Oh(kh(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 Vs(e))if(!Xs.call(s,a))zt(s,a,{get:Ys.bind(e,a),enumerable:!0})}if(n)i.set(e,s);return s},kr=(e)=>{var t=(zs??=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 Vs(e))if(!Xs.call(t,n))zt(t,n,{get:Ys.bind(e,n),enumerable:!(r=_h(e,n))||r.enumerable})}return zs.set(e,t),t},zs,m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $h=(e)=>e;function Nh(e,t){this[e]=$h.bind(null,t)}var Vt=(e,t)=>{for(var r in t)zt(e,r,{get:t[r],enumerable:!0,configurable:!0,set:Nh.bind(t,r)})};var x=(e,t)=>()=>(e&&(t=e(e=0)),t);var lt=m(function(_i,sa){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Kr=require("buffer"),be=Kr.Buffer;function oa(e,t){for(var r in e)t[r]=e[r]}if(be.from&&be.alloc&&be.allocUnsafe&&be.allocUnsafeSlow)sa.exports=Kr;else oa(Kr,_i),_i.Buffer=Me;function Me(e,t,r){return be(e,t,r)}Me.prototype=Object.create(be.prototype);oa(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 Pi=m(function(lx,aa){var $r=lt().Buffer,Bh=require("stream"),Mh=require("util");function Nr(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=$r.alloc(0),this;if(typeof e.pipe==="function")return this.buffer=$r.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+")")}Mh.inherits(Nr,Bh);Nr.prototype.write=function(t){this.buffer=$r.concat([this.buffer,$r.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};aa.exports=Nr});var ua=m(function(dx,ca){function Ki(e){var t=(e/8|0)+(e%8===0?0:1);return t}var Gh={ES256:Ki(256),ES384:Ki(384),ES512:Ki(521)};function zh(e){var t=Gh[e];if(t)return t;throw Error('Unknown algorithm "'+e+'"')}ca.exports=zh});var ya=m(function(px,ma){var Lr=lt().Buffer,la=ua(),Jr=128,da=0,Vh=32,Xh=16,Yh=2,pa=Xh|Vh|da<<6,Wr=Yh|da<<6;function Zh(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ha(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 Qh(e,t){e=ha(e);var r=la(t),n=r+1,i=e.length,o=0;if(e[o++]!==pa)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=Zh(d),d}function fa(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 em(e,t){e=ha(e);var r=la(t),n=e.length;if(n!==r*2)throw TypeError('"'+t+'" signatures must be "'+r*2+'" bytes, saw "'+n+'"');var i=fa(e,0,r),o=fa(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++]=pa,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}ma.exports={derToJose:Qh,joseToDer:em}});var wa=m(function(hx,ga){var Xt=require("buffer").Buffer,$i=require("buffer").SlowBuffer;ga.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=$i.prototype.equal=function(t){return jr(this,t)}};var tm=Xt.prototype.equal,rm=$i.prototype.equal;jr.restore=function(){Xt.prototype.equal=tm,$i.prototype.equal=rm}});var Wi=m(function(mx,Ia){var pt=lt().Buffer,ae=require("crypto"),Sa=ya(),Ea=require("util"),nm=`"%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".`,kt="secret must be a string or buffer",Wt="key must be a string or a buffer",tJ="key must be a string, a buffer or an object",gr=typeof u1.createPublicKey==="function";if(gr)Wt+=" or a KeyObject",kt+="or a KeyObject";function Ih(t){if(Jt.isBuffer(t))return;if(typeof t==="string")return;if(!gr)throw w1(Wt);if(typeof t!=="object")throw w1(Wt);if(typeof t.type!=="string")throw w1(Wt);if(typeof t.asymmetricKeyType!=="string")throw w1(Wt);if(typeof t.export!=="function")throw w1(Wt)}function Xh(t){if(Jt.isBuffer(t))return;if(typeof t==="string")return;if(typeof t==="object")return;throw w1(tJ)}function cJ(t){if(Jt.isBuffer(t))return;if(typeof t==="string")return t;if(!gr)throw w1(kt);if(typeof t!=="object")throw w1(kt);if(t.type!=="secret")throw w1(kt);if(typeof t.export!=="function")throw w1(kt)}function Br(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Eh(t){t=t.toString();var c=4-t.length%4;if(c!==4)for(var u=0;u<c;++u)t+="=";return t.replace(/\-/g,"+").replace(/_/g,"/")}function w1(t){var c=[].slice.call(arguments,1),u=Gh.format.bind(Gh,t).apply(null,c);return TypeError(u)}function uJ(t){return Jt.isBuffer(t)||typeof t==="string"}function Ut(t){if(!uJ(t))t=JSON.stringify(t);return t}function Yh(t){return function(u,r){cJ(r),u=Ut(u);var n=u1.createHmac("sha"+t,r),f=(n.update(u),n.digest("base64"));return Br(f)}}var mr,rJ="timingSafeEqual"in u1?function(c,u){if(c.byteLength!==u.byteLength)return!1;return u1.timingSafeEqual(c,u)}:function(c,u){if(!mr)mr=Oh();return mr(c,u)};function nJ(t){return function(u,r,n){var f=Yh(t)(u,n);return rJ(Jt.from(r),Jt.from(f))}}function zh(t){return function(u,r){Xh(r),u=Ut(u);var n=u1.createSign("RSA-SHA"+t),f=(n.update(u),n.sign(r,"base64"));return Br(f)}}function Rh(t){return function(u,r,n){Ih(n),u=Ut(u),r=Eh(r);var f=u1.createVerify("RSA-SHA"+t);return f.update(u),f.verify(n,r,"base64")}}function fJ(t){return function(u,r){Xh(r),u=Ut(u);var n=u1.createSign("RSA-SHA"+t),f=(n.update(u),n.sign({key:r,padding:u1.constants.RSA_PKCS1_PSS_PADDING,saltLength:u1.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return Br(f)}}function dJ(t){return function(u,r,n){Ih(n),u=Ut(u),r=Eh(r);var f=u1.createVerify("RSA-SHA"+t);return f.update(u),f.verify({key:n,padding:u1.constants.RSA_PKCS1_PSS_PADDING,saltLength:u1.constants.RSA_PSS_SALTLEN_DIGEST},r,"base64")}}function hJ(t){var c=zh(t);return function(){var r=c.apply(null,arguments);return r=Zh.derToJose(r,"ES"+t),r}}function qJ(t){var c=Rh(t);return function(r,n,f){n=Zh.joseToDer(n,"ES"+t).toString("base64");var d=c(r,n,f);return d}}function _J(){return function(){return""}}function KJ(){return function(c,u){return u===""}}ih.exports=function(c){var u={hs:Yh,rs:zh,ps:fJ,es:hJ,none:_J},r={hs:nJ,rs:Rh,ps:dJ,es:qJ,none:KJ},n=c.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!n)throw w1(aW,c);var f=(n[1]||n[3]).toLowerCase(),d=n[2];return{sign:u[f](d),verify:r[f](d)}}});var kr=K((NI,Vh)=>{var WJ=require("buffer").Buffer;Vh.exports=function(c){if(typeof c==="string")return c;if(typeof c==="number"||WJ.isBuffer(c))return c.toString();return JSON.stringify(c)}});var eh=K((TI,bh)=>{var JJ=Kt().Buffer,Mh=xr(),wJ=Fr(),$J=require("stream"),Nh=kr(),Ur=require("util");function Th(t,c){return JJ.from(t,c).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function PJ(t,c,u){u=u||"utf8";var r=Th(Nh(t),"binary"),n=Th(Nh(c),u);return Ur.format("%s.%s",r,n)}function Dh(t){var{header:c,payload:u}=t,r=t.secret||t.privateKey,n=t.encoding,f=wJ(c.alg),d=PJ(c,u,n),h=f.sign(d,r);return Ur.format("%s.%s",d,h)}function vc(t){var c=t.secret;if(c=c==null?t.privateKey:c,c=c==null?t.key:c,/^hs/i.test(t.header.alg)===!0&&c==null)throw TypeError("secret must be a string or buffer or a KeyObject");var u=new Mh(c);this.readable=!0,this.header=t.header,this.encoding=t.encoding,this.secret=this.privateKey=this.key=u,this.payload=new Mh(t.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))}Ur.inherits(vc,$J);vc.prototype.sign=function(){try{var c=Dh({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",c),this.emit("data",c),this.emit("end"),this.readable=!1,c}catch(u){this.readable=!1,this.emit("error",u),this.emit("close")}};vc.sign=Dh;bh.exports=vc});var Fh=K((DI,Bh)=>{var ph=Kt().Buffer,jh=xr(),AJ=Fr(),SJ=require("stream"),vh=kr(),yJ=require("util"),HJ=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function CJ(t){return Object.prototype.toString.call(t)==="[object Object]"}function OJ(t){if(CJ(t))return t;try{return JSON.parse(t)}catch(c){return}}function xh(t){var c=t.split(".",1)[0];return OJ(ph.from(c,"base64").toString("binary"))}function GJ(t){return t.split(".",2).join(".")}function Lh(t){return t.split(".")[2]}function ZJ(t,c){c=c||"utf8";var u=t.split(".")[1];return ph.from(u,"base64").toString(c)}function sh(t){return HJ.test(t)&&!!xh(t)}function mh(t,c,u){if(!c){var r=Error("Missing algorithm parameter for jws.verify");throw r.code="MISSING_ALGORITHM",r}t=vh(t);var n=Lh(t),f=GJ(t),d=AJ(c);return d.verify(f,n,u)}function gh(t,c){if(c=c||{},t=vh(t),!sh(t))return null;var u=xh(t);if(!u)return null;var r=ZJ(t);if(u.typ==="JWT"||c.json)r=JSON.parse(r,c.encoding);return{header:u,payload:r,signature:Lh(t)}}function wt(t){t=t||{};var c=t.secret;if(c=c==null?t.publicKey:c,c=c==null?t.key:c,/^hs/i.test(t.algorithm)===!0&&c==null)throw TypeError("secret must be a string or buffer or a KeyObject");var u=new jh(c);this.readable=!0,this.algorithm=t.algorithm,this.encoding=t.encoding,this.secret=this.publicKey=this.key=u,this.signature=new jh(t.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))}yJ.inherits(wt,SJ);wt.prototype.verify=function(){try{var c=mh(this.signature.buffer,this.algorithm,this.key.buffer),u=gh(this.signature.buffer,this.encoding);return this.emit("done",c,u),this.emit("data",c),this.emit("end"),this.readable=!1,c}catch(r){this.readable=!1,this.emit("error",r),this.emit("close")}};wt.decode=gh;wt.isValid=sh;wt.verify=mh;Bh.exports=wt});var Lc=K((T1)=>{var kh=eh(),xc=Fh(),IJ=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];T1.ALGORITHMS=IJ;T1.sign=kh.sign;T1.verify=xc.verify;T1.decode=xc.decode;T1.isValid=xc.isValid;T1.createSign=function(c){return new kh(c)};T1.createVerify=function(c){return new xc(c)}});var or=K((eI,Uh)=>{var XJ=Lc();Uh.exports=function(t,c){c=c||{};var u=XJ.decode(t,c);if(!u)return null;var r=u.payload;if(typeof r==="string")try{var n=JSON.parse(r);if(n!==null&&typeof n==="object")r=n}catch(f){}if(c.complete===!0)return{header:u.header,payload:r,signature:u.signature};return r}});var ot=K((jI,oh)=>{var sc=function(t,c){if(Error.call(this,t),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);if(this.name="JsonWebTokenError",this.message=t,c)this.inner=c};sc.prototype=Object.create(Error.prototype);sc.prototype.constructor=sc;oh.exports=sc});var lr=K((pI,Qh)=>{var lh=ot(),mc=function(t,c){lh.call(this,t),this.name="NotBeforeError",this.date=c};mc.prototype=Object.create(lh.prototype);mc.prototype.constructor=mc;Qh.exports=mc});var Qr=K((vI,tq)=>{var ah=ot(),gc=function(t,c){ah.call(this,t),this.name="TokenExpiredError",this.expiredAt=c};gc.prototype=Object.create(ah.prototype);gc.prototype.constructor=gc;tq.exports=gc});var ar=K((xI,cq)=>{var $t=1000,Pt=$t*60,At=Pt*60,U1=At*24,EJ=U1*7,YJ=U1*365.25;cq.exports=function(t,c){c=c||{};var u=typeof t;if(u==="string"&&t.length>0)return zJ(t);else if(u==="number"&&isFinite(t))return c.long?iJ(t):RJ(t);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function zJ(t){if(t=String(t),t.length>100)return;var c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!c)return;var u=parseFloat(c[1]),r=(c[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return u*YJ;case"weeks":case"week":case"w":return u*EJ;case"days":case"day":case"d":return u*U1;case"hours":case"hour":case"hrs":case"hr":case"h":return u*At;case"minutes":case"minute":case"mins":case"min":case"m":return u*Pt;case"seconds":case"second":case"secs":case"sec":case"s":return u*$t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}function RJ(t){var c=Math.abs(t);if(c>=U1)return Math.round(t/U1)+"d";if(c>=At)return Math.round(t/At)+"h";if(c>=Pt)return Math.round(t/Pt)+"m";if(c>=$t)return Math.round(t/$t)+"s";return t+"ms"}function iJ(t){var c=Math.abs(t);if(c>=U1)return Bc(t,c,U1,"day");if(c>=At)return Bc(t,c,At,"hour");if(c>=Pt)return Bc(t,c,Pt,"minute");if(c>=$t)return Bc(t,c,$t,"second");return t+" ms"}function Bc(t,c,u,r){var n=c>=u*1.5;return Math.round(t/u)+" "+r+(n?"s":"")}});var tn=K((LI,uq)=>{var VJ=ar();uq.exports=function(t,c){var u=c||Math.floor(Date.now()/1000);if(typeof t==="string"){var r=VJ(t);if(typeof r>"u")return;return Math.floor(u+r/1000)}else if(typeof t==="number")return u+t;else return}});var St=K((sI,rq)=>{var MJ=Number.MAX_SAFE_INTEGER||9007199254740991,NJ=["major","premajor","minor","preminor","patch","prepatch","prerelease"];rq.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:MJ,RELEASE_TYPES:NJ,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var lt=K((mI,nq)=>{var TJ=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};nq.exports=TJ});var yt=K((O1,fq)=>{var{MAX_SAFE_COMPONENT_LENGTH:cn,MAX_SAFE_BUILD_LENGTH:DJ,MAX_LENGTH:bJ}=St(),eJ=lt();O1=fq.exports={};var jJ=O1.re=[],pJ=O1.safeRe=[],y=O1.src=[],vJ=O1.safeSrc=[],H=O1.t={},xJ=0,un="[a-zA-Z0-9-]",LJ=[["\\s",1],["\\d",bJ],[un,DJ]],sJ=(t)=>{for(let[c,u]of LJ)t=t.split(`${c}*`).join(`${c}{0,${u}}`).split(`${c}+`).join(`${c}{1,${u}}`);return t},Z=(t,c,u)=>{let r=sJ(c),n=xJ++;eJ(t,n,c),H[t]=n,y[n]=c,vJ[n]=r,jJ[n]=new RegExp(c,u?"g":void 0),pJ[n]=new RegExp(r,u?"g":void 0)};Z("NUMERICIDENTIFIER","0|[1-9]\\d*");Z("NUMERICIDENTIFIERLOOSE","\\d+");Z("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${un}*`);Z("MAINVERSION",`(${y[H.NUMERICIDENTIFIER]})\\.(${y[H.NUMERICIDENTIFIER]})\\.(${y[H.NUMERICIDENTIFIER]})`);Z("MAINVERSIONLOOSE",`(${y[H.NUMERICIDENTIFIERLOOSE]})\\.(${y[H.NUMERICIDENTIFIERLOOSE]})\\.(${y[H.NUMERICIDENTIFIERLOOSE]})`);Z("PRERELEASEIDENTIFIER",`(?:${y[H.NONNUMERICIDENTIFIER]}|${y[H.NUMERICIDENTIFIER]})`);Z("PRERELEASEIDENTIFIERLOOSE",`(?:${y[H.NONNUMERICIDENTIFIER]}|${y[H.NUMERICIDENTIFIERLOOSE]})`);Z("PRERELEASE",`(?:-(${y[H.PRERELEASEIDENTIFIER]}(?:\\.${y[H.PRERELEASEIDENTIFIER]})*))`);Z("PRERELEASELOOSE",`(?:-?(${y[H.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${y[H.PRERELEASEIDENTIFIERLOOSE]})*))`);Z("BUILDIDENTIFIER",`${un}+`);Z("BUILD",`(?:\\+(${y[H.BUILDIDENTIFIER]}(?:\\.${y[H.BUILDIDENTIFIER]})*))`);Z("FULLPLAIN",`v?${y[H.MAINVERSION]}${y[H.PRERELEASE]}?${y[H.BUILD]}?`);Z("FULL",`^${y[H.FULLPLAIN]}$`);Z("LOOSEPLAIN",`[v=\\s]*${y[H.MAINVERSIONLOOSE]}${y[H.PRERELEASELOOSE]}?${y[H.BUILD]}?`);Z("LOOSE",`^${y[H.LOOSEPLAIN]}$`);Z("GTLT","((?:<|>)?=?)");Z("XRANGEIDENTIFIERLOOSE",`${y[H.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Z("XRANGEIDENTIFIER",`${y[H.NUMERICIDENTIFIER]}|x|X|\\*`);Z("XRANGEPLAIN",`[v=\\s]*(${y[H.XRANGEIDENTIFIER]})(?:\\.(${y[H.XRANGEIDENTIFIER]})(?:\\.(${y[H.XRANGEIDENTIFIER]})(?:${y[H.PRERELEASE]})?${y[H.BUILD]}?)?)?`);Z("XRANGEPLAINLOOSE",`[v=\\s]*(${y[H.XRANGEIDENTIFIERLOOSE]})(?:\\.(${y[H.XRANGEIDENTIFIERLOOSE]})(?:\\.(${y[H.XRANGEIDENTIFIERLOOSE]})(?:${y[H.PRERELEASELOOSE]})?${y[H.BUILD]}?)?)?`);Z("XRANGE",`^${y[H.GTLT]}\\s*${y[H.XRANGEPLAIN]}$`);Z("XRANGELOOSE",`^${y[H.GTLT]}\\s*${y[H.XRANGEPLAINLOOSE]}$`);Z("COERCEPLAIN",`(^|[^\\d])(\\d{1,${cn}})(?:\\.(\\d{1,${cn}}))?(?:\\.(\\d{1,${cn}}))?`);Z("COERCE",`${y[H.COERCEPLAIN]}(?:$|[^\\d])`);Z("COERCEFULL",y[H.COERCEPLAIN]+`(?:${y[H.PRERELEASE]})?(?:${y[H.BUILD]})?(?:$|[^\\d])`);Z("COERCERTL",y[H.COERCE],!0);Z("COERCERTLFULL",y[H.COERCEFULL],!0);Z("LONETILDE","(?:~>?)");Z("TILDETRIM",`(\\s*)${y[H.LONETILDE]}\\s+`,!0);O1.tildeTrimReplace="$1~";Z("TILDE",`^${y[H.LONETILDE]}${y[H.XRANGEPLAIN]}$`);Z("TILDELOOSE",`^${y[H.LONETILDE]}${y[H.XRANGEPLAINLOOSE]}$`);Z("LONECARET","(?:\\^)");Z("CARETTRIM",`(\\s*)${y[H.LONECARET]}\\s+`,!0);O1.caretTrimReplace="$1^";Z("CARET",`^${y[H.LONECARET]}${y[H.XRANGEPLAIN]}$`);Z("CARETLOOSE",`^${y[H.LONECARET]}${y[H.XRANGEPLAINLOOSE]}$`);Z("COMPARATORLOOSE",`^${y[H.GTLT]}\\s*(${y[H.LOOSEPLAIN]})$|^$`);Z("COMPARATOR",`^${y[H.GTLT]}\\s*(${y[H.FULLPLAIN]})$|^$`);Z("COMPARATORTRIM",`(\\s*)${y[H.GTLT]}\\s*(${y[H.LOOSEPLAIN]}|${y[H.XRANGEPLAIN]})`,!0);O1.comparatorTrimReplace="$1$2$3";Z("HYPHENRANGE",`^\\s*(${y[H.XRANGEPLAIN]})\\s+-\\s+(${y[H.XRANGEPLAIN]})\\s*$`);Z("HYPHENRANGELOOSE",`^\\s*(${y[H.XRANGEPLAINLOOSE]})\\s+-\\s+(${y[H.XRANGEPLAINLOOSE]})\\s*$`);Z("STAR","(<|>)?=?\\s*\\*");Z("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Z("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Fc=K((gI,dq)=>{var mJ=Object.freeze({loose:!0}),gJ=Object.freeze({}),BJ=(t)=>{if(!t)return gJ;if(typeof t!=="object")return mJ;return t};dq.exports=BJ});var rn=K((BI,_q)=>{var hq=/^[0-9]+$/,qq=(t,c)=>{if(typeof t==="number"&&typeof c==="number")return t===c?0:t<c?-1:1;let u=hq.test(t),r=hq.test(c);if(u&&r)t=+t,c=+c;return t===c?0:u&&!r?-1:r&&!u?1:t<c?-1:1},FJ=(t,c)=>qq(c,t);_q.exports={compareIdentifiers:qq,rcompareIdentifiers:FJ}});var L=K((FI,Wq)=>{var kc=lt(),{MAX_LENGTH:Kq,MAX_SAFE_INTEGER:Uc}=St(),{safeRe:oc,t:lc}=yt(),kJ=Fc(),{compareIdentifiers:nn}=rn(),UJ=(t,c)=>{let u=c.split(".");if(u.length>t.length)return!1;for(let r=0;r<u.length;r++)if(nn(t[r],u[r])!==0)return!1;return!0};class $1{constructor(t,c){if(c=kJ(c),t instanceof $1)if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;else t=t.version;else if(typeof t!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Kq)throw TypeError(`version is longer than ${Kq} characters`);kc("SemVer",t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let u=t.trim().match(c.loose?oc[lc.LOOSE]:oc[lc.FULL]);if(!u)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+u[1],this.minor=+u[2],this.patch=+u[3],this.major>Uc||this.major<0)throw TypeError("Invalid major version");if(this.minor>Uc||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>Uc||this.patch<0)throw TypeError("Invalid patch version");if(!u[4])this.prerelease=[];else this.prerelease=u[4].split(".").map((r)=>{if(/^[0-9]+$/.test(r)){let n=+r;if(n>=0&&n<Uc)return n}return r});this.build=u[5]?u[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(t){if(kc("SemVer.compare",this.version,this.options,t),!(t instanceof $1)){if(typeof t==="string"&&t===this.version)return 0;t=new $1(t,this.options)}if(t.version===this.version)return 0;return this.compareMain(t)||this.comparePre(t)}compareMain(t){if(!(t instanceof $1))t=new $1(t,this.options);if(this.major<t.major)return-1;if(this.major>t.major)return 1;if(this.minor<t.minor)return-1;if(this.minor>t.minor)return 1;if(this.patch<t.patch)return-1;if(this.patch>t.patch)return 1;return 0}comparePre(t){if(!(t instanceof $1))t=new $1(t,this.options);if(this.prerelease.length&&!t.prerelease.length)return-1;else if(!this.prerelease.length&&t.prerelease.length)return 1;else if(!this.prerelease.length&&!t.prerelease.length)return 0;let c=0;do{let u=this.prerelease[c],r=t.prerelease[c];if(kc("prerelease compare",c,u,r),u===void 0&&r===void 0)return 0;else if(r===void 0)return 1;else if(u===void 0)return-1;else if(u===r)continue;else return nn(u,r)}while(++c)}compareBuild(t){if(!(t instanceof $1))t=new $1(t,this.options);let c=0;do{let u=this.build[c],r=t.build[c];if(kc("build compare",c,u,r),u===void 0&&r===void 0)return 0;else if(r===void 0)return 1;else if(u===void 0)return-1;else if(u===r)continue;else return nn(u,r)}while(++c)}inc(t,c,u){if(t.startsWith("pre")){if(!c&&u===!1)throw Error("invalid increment argument: identifier is empty");if(c){let r=`-${c}`.match(this.options.loose?oc[lc.PRERELEASELOOSE]:oc[lc.PRERELEASE]);if(!r||r[1]!==c)throw Error(`invalid identifier: ${c}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",c,u);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",c,u);break;case"prepatch":this.prerelease.length=0,this.inc("patch",c,u),this.inc("pre",c,u);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",c,u);this.inc("pre",c,u);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 r=Number(u)?1:0;if(this.prerelease.length===0)this.prerelease=[r];else{let n=this.prerelease.length;while(--n>=0)if(typeof this.prerelease[n]==="number")this.prerelease[n]++,n=-2;if(n===-1){if(c===this.prerelease.join(".")&&u===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(r)}}if(c){let n=[c,r];if(u===!1)n=[c];if(UJ(this.prerelease,c)){let f=this.prerelease[c.split(".").length];if(isNaN(f))this.prerelease=n}else this.prerelease=n}break}default:throw Error(`invalid increment argument: ${t}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}Wq.exports=$1});var D1=K((kI,wq)=>{var Jq=L(),oJ=(t,c,u=!1)=>{if(t instanceof Jq)return t;try{return new Jq(t,c)}catch(r){if(!u)return null;throw r}};wq.exports=oJ});var Pq=K((UI,$q)=>{var lJ=D1(),QJ=(t,c)=>{let u=lJ(t,c);return u?u.version:null};$q.exports=QJ});var Sq=K((oI,Aq)=>{var aJ=D1(),t5=(t,c)=>{let u=aJ(t.trim().replace(/^[=v]+/,""),c);return u?u.version:null};Aq.exports=t5});var Cq=K((lI,Hq)=>{var yq=L(),c5=(t,c,u,r,n)=>{if(typeof u==="string")n=r,r=u,u=void 0;try{return new yq(t instanceof yq?t.version:t,u).inc(c,r,n).version}catch(f){return null}};Hq.exports=c5});var Zq=K((QI,Gq)=>{var Oq=D1(),u5=(t,c)=>{let u=Oq(t,null,!0),r=Oq(c,null,!0),n=u.compare(r);if(n===0)return null;let f=n>0,d=f?u:r,h=f?r:u,_=!!d.prerelease.length;if(!!h.prerelease.length&&!_){if(!h.patch&&!h.minor)return"major";if(h.compareMain(d)===0){if(h.minor&&!h.patch)return"minor";return"patch"}}let W=_?"pre":"";if(u.major!==r.major)return W+"major";if(u.minor!==r.minor)return W+"minor";if(u.patch!==r.patch)return W+"patch";return"prerelease"};Gq.exports=u5});var Xq=K((aI,Iq)=>{var r5=L(),n5=(t,c)=>new r5(t,c).major;Iq.exports=n5});var Yq=K((tX,Eq)=>{var f5=L(),d5=(t,c)=>new f5(t,c).minor;Eq.exports=d5});var Rq=K((cX,zq)=>{var h5=L(),q5=(t,c)=>new h5(t,c).patch;zq.exports=q5});var Vq=K((uX,iq)=>{var _5=D1(),K5=(t,c)=>{let u=_5(t,c);return u&&u.prerelease.length?u.prerelease:null};iq.exports=K5});var r1=K((rX,Nq)=>{var Mq=L(),W5=(t,c,u)=>new Mq(t,u).compare(new Mq(c,u));Nq.exports=W5});var Dq=K((nX,Tq)=>{var J5=r1(),w5=(t,c,u)=>J5(c,t,u);Tq.exports=w5});var eq=K((fX,bq)=>{var $5=r1(),P5=(t,c)=>$5(t,c,!0);bq.exports=P5});var Qc=K((dX,pq)=>{var jq=L(),A5=(t,c,u)=>{let r=new jq(t,u),n=new jq(c,u);return r.compare(n)||r.compareBuild(n)};pq.exports=A5});var xq=K((hX,vq)=>{var S5=Qc(),y5=(t,c)=>t.sort((u,r)=>S5(u,r,c));vq.exports=y5});var sq=K((qX,Lq)=>{var H5=Qc(),C5=(t,c)=>t.sort((u,r)=>H5(r,u,c));Lq.exports=C5});var Qt=K((_X,mq)=>{var O5=r1(),G5=(t,c,u)=>O5(t,c,u)>0;mq.exports=G5});var ac=K((KX,gq)=>{var Z5=r1(),I5=(t,c,u)=>Z5(t,c,u)<0;gq.exports=I5});var fn=K((WX,Bq)=>{var X5=r1(),E5=(t,c,u)=>X5(t,c,u)===0;Bq.exports=E5});var dn=K((JX,Fq)=>{var Y5=r1(),z5=(t,c,u)=>Y5(t,c,u)!==0;Fq.exports=z5});var tu=K((wX,kq)=>{var R5=r1(),i5=(t,c,u)=>R5(t,c,u)>=0;kq.exports=i5});var cu=K(($X,Uq)=>{var V5=r1(),M5=(t,c,u)=>V5(t,c,u)<=0;Uq.exports=M5});var hn=K((PX,oq)=>{var N5=fn(),T5=dn(),D5=Qt(),b5=tu(),e5=ac(),j5=cu(),p5=(t,c,u,r)=>{switch(c){case"===":if(typeof t==="object")t=t.version;if(typeof u==="object")u=u.version;return t===u;case"!==":if(typeof t==="object")t=t.version;if(typeof u==="object")u=u.version;return t!==u;case"":case"=":case"==":return N5(t,u,r);case"!=":return T5(t,u,r);case">":return D5(t,u,r);case">=":return b5(t,u,r);case"<":return e5(t,u,r);case"<=":return j5(t,u,r);default:throw TypeError(`Invalid operator: ${c}`)}};oq.exports=p5});var Qq=K((AX,lq)=>{var v5=L(),x5=D1(),{safeRe:uu,t:ru}=yt(),L5=(t,c)=>{if(t instanceof v5)return t;if(typeof t==="number")t=String(t);if(typeof t!=="string")return null;c=c||{};let u=null;if(!c.rtl)u=t.match(c.includePrerelease?uu[ru.COERCEFULL]:uu[ru.COERCE]);else{let _=c.includePrerelease?uu[ru.COERCERTLFULL]:uu[ru.COERCERTL],q;while((q=_.exec(t))&&(!u||u.index+u[0].length!==t.length)){if(!u||q.index+q[0].length!==u.index+u[0].length)u=q;_.lastIndex=q.index+q[1].length+q[2].length}_.lastIndex=-1}if(u===null)return null;let r=u[2],n=u[3]||"0",f=u[4]||"0",d=c.includePrerelease&&u[5]?`-${u[5]}`:"",h=c.includePrerelease&&u[6]?`+${u[6]}`:"";return x5(`${r}.${n}.${f}${d}${h}`,c)};lq.exports=L5});var t0=K((SX,aq)=>{var s5=D1(),m5=St(),g5=L(),B5=(t,c,u)=>{if(!m5.RELEASE_TYPES.includes(c))return null;let r=F5(t,u);return r&&k5(r,c)},F5=(t,c)=>{let u=t instanceof g5?t.version:t;return s5(u,c)},k5=(t,c)=>{if(U5(c))return t.version;switch(t.prerelease=[],c){case"major":t.minor=0,t.patch=0;break;case"minor":t.patch=0;break}return t.format()},U5=(t)=>{return t.startsWith("pre")};aq.exports=B5});var r0=K((yX,u0)=>{class c0{constructor(){this.max=1000,this.map=new Map}get(t){let c=this.map.get(t);if(c===void 0)return;else return this.map.delete(t),this.map.set(t,c),c}delete(t){return this.map.delete(t)}set(t,c){if(!this.delete(t)&&c!==void 0){if(this.map.size>=this.max){let r=this.map.keys().next().value;this.delete(r)}this.map.set(t,c)}return this}}u0.exports=c0});var n1=K((HX,h0)=>{var o5=/\s+/g;class at{constructor(t,c){if(c=Q5(c),t instanceof at)if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;else return new at(t.raw,c);if(t instanceof qn)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease,this.raw=t.trim().replace(o5," "),this.set=this.raw.split("||").map((u)=>this.parseRange(u.trim())).filter((u)=>u.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let u=this.set[0];if(this.set=this.set.filter((r)=>!f0(r[0])),this.set.length===0)this.set=[u];else if(this.set.length>1){for(let r of this.set)if(r.length===1&&hw(r[0])){this.set=[r];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t<this.set.length;t++){if(t>0)this.formatted+="||";let c=this.set[t];for(let u=0;u<c.length;u++){if(u>0)this.formatted+=" ";this.formatted+=c[u].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){t=t.replace(dw,"");let u=((this.options.includePrerelease&&nw)|(this.options.loose&&fw))+":"+t,r=n0.get(u);if(r)return r;let n=this.options.loose,f=n?U[s.HYPHENRANGELOOSE]:U[s.HYPHENRANGE];t=t.replace(f,yw(this.options.includePrerelease)),V("hyphen replace",t),t=t.replace(U[s.COMPARATORTRIM],cw),V("comparator trim",t),t=t.replace(U[s.TILDETRIM],uw),V("tilde trim",t),t=t.replace(U[s.CARETTRIM],rw),V("caret trim",t);let d=t.split(" ").map((W)=>qw(W,this.options)).join(" ").split(/\s+/).map((W)=>Sw(W,this.options));if(n)d=d.filter((W)=>{return V("loose invalid filter",W,this.options),!!W.match(U[s.COMPARATORLOOSE])});V("range list",d);let h=new Map,_=d.map((W)=>new qn(W,this.options));for(let W of _){if(f0(W))return[W];h.set(W.value,W)}if(h.size>1&&h.has(""))h.delete("");let q=[...h.values()];return n0.set(u,q),q}intersects(t,c){if(!(t instanceof at))throw TypeError("a Range is required");return this.set.some((u)=>{return d0(u,c)&&t.set.some((r)=>{return d0(r,c)&&u.every((n)=>{return r.every((f)=>{return n.intersects(f,c)})})})})}test(t){if(!t)return!1;if(typeof t==="string")try{t=new a5(t,this.options)}catch(c){return!1}for(let c=0;c<this.set.length;c++)if(Hw(this.set[c],t,this.options))return!0;return!1}}h0.exports=at;var l5=r0(),n0=new l5,Q5=Fc(),qn=tc(),V=lt(),a5=L(),{safeRe:U,src:tw,t:s,comparatorTrimReplace:cw,tildeTrimReplace:uw,caretTrimReplace:rw}=yt(),{FLAG_INCLUDE_PRERELEASE:nw,FLAG_LOOSE:fw}=St(),dw=new RegExp(tw[s.BUILD],"g"),f0=(t)=>t.value==="<0.0.0-0",hw=(t)=>t.value==="",d0=(t,c)=>{let u=!0,r=t.slice(),n=r.pop();while(u&&r.length)u=r.every((f)=>{return n.intersects(f,c)}),n=r.pop();return u},qw=(t,c)=>{return t=t.replace(U[s.BUILD],""),V("comp",t,c),t=Jw(t,c),V("caret",t),t=Kw(t,c),V("tildes",t),t=$w(t,c),V("xrange",t),t=Aw(t,c),V("stars",t),t},b=(t)=>!t||t.toLowerCase()==="x"||t==="*",_w=(t,c,u)=>b(t)&&!b(c)||b(c)&&u&&!b(u),Kw=(t,c)=>{return t.trim().split(/\s+/).map((u)=>Ww(u,c)).join(" ")},Ww=(t,c)=>{let u=c.loose?U[s.TILDELOOSE]:U[s.TILDE],r=c.includePrerelease?"-0":"";return t.replace(u,(n,f,d,h,_)=>{V("tilde",t,n,f,d,h,_);let q;if(b(f))q="";else if(b(d))q=`>=${f}.0.0${r} <${+f+1}.0.0-0`;else if(b(h))q=`>=${f}.${d}.0${r} <${f}.${+d+1}.0-0`;else if(_)V("replaceTilde pr",_),q=`>=${f}.${d}.${h}-${_} <${f}.${+d+1}.0-0`;else q=`>=${f}.${d}.${h} <${f}.${+d+1}.0-0`;return V("tilde return",q),q})},Jw=(t,c)=>{return t.trim().split(/\s+/).map((u)=>ww(u,c)).join(" ")},ww=(t,c)=>{V("caret",t,c);let u=c.loose?U[s.CARETLOOSE]:U[s.CARET],r=c.includePrerelease?"-0":"";return t.replace(u,(n,f,d,h,_)=>{V("caret",t,n,f,d,h,_);let q;if(b(f))q="";else if(b(d))q=`>=${f}.0.0${r} <${+f+1}.0.0-0`;else if(b(h))if(f==="0")q=`>=${f}.${d}.0${r} <${f}.${+d+1}.0-0`;else q=`>=${f}.${d}.0${r} <${+f+1}.0.0-0`;else if(_)if(V("replaceCaret pr",_),f==="0")if(d==="0")q=`>=${f}.${d}.${h}-${_} <${f}.${d}.${+h+1}-0`;else q=`>=${f}.${d}.${h}-${_} <${f}.${+d+1}.0-0`;else q=`>=${f}.${d}.${h}-${_} <${+f+1}.0.0-0`;else if(V("no pr"),f==="0")if(d==="0")q=`>=${f}.${d}.${h} <${f}.${d}.${+h+1}-0`;else q=`>=${f}.${d}.${h} <${f}.${+d+1}.0-0`;else q=`>=${f}.${d}.${h} <${+f+1}.0.0-0`;return V("caret return",q),q})},$w=(t,c)=>{return V("replaceXRanges",t,c),t.split(/\s+/).map((u)=>Pw(u,c)).join(" ")},Pw=(t,c)=>{t=t.trim();let u=c.loose?U[s.XRANGELOOSE]:U[s.XRANGE];return t.replace(u,(r,n,f,d,h,_)=>{if(V("xRange",t,r,n,f,d,h,_),_w(f,d,h))return t;let q=b(f),W=q||b(d),J=W||b(h),$=J;if(n==="="&&$)n="";if(_=c.includePrerelease?"-0":"",q)if(n===">"||n==="<")r="<0.0.0-0";else r="*";else if(n&&$){if(W)d=0;if(h=0,n===">")if(n=">=",W)f=+f+1,d=0,h=0;else d=+d+1,h=0;else if(n==="<=")if(n="<",W)f=+f+1;else d=+d+1;if(n==="<")_="-0";r=`${n+f}.${d}.${h}${_}`}else if(W)r=`>=${f}.0.0${_} <${+f+1}.0.0-0`;else if(J)r=`>=${f}.${d}.0${_} <${f}.${+d+1}.0-0`;return V("xRange return",r),r})},Aw=(t,c)=>{return V("replaceStars",t,c),t.trim().replace(U[s.STAR],"")},Sw=(t,c)=>{return V("replaceGTE0",t,c),t.trim().replace(U[c.includePrerelease?s.GTE0PRE:s.GTE0],"")},yw=(t)=>(c,u,r,n,f,d,h,_,q,W,J,$)=>{if(b(r))u="";else if(b(n))u=`>=${r}.0.0${t?"-0":""}`;else if(b(f))u=`>=${r}.${n}.0${t?"-0":""}`;else if(d)u=`>=${u}`;else u=`>=${u}${t?"-0":""}`;if(b(q))_="";else if(b(W))_=`<${+q+1}.0.0-0`;else if(b(J))_=`<${q}.${+W+1}.0-0`;else if($)_=`<=${q}.${W}.${J}-${$}`;else if(t)_=`<${q}.${W}.${+J+1}-0`;else _=`<=${_}`;return`${u} ${_}`.trim()},Hw=(t,c,u)=>{for(let r=0;r<t.length;r++)if(!t[r].test(c))return!1;if(c.prerelease.length&&!u.includePrerelease){for(let r=0;r<t.length;r++){if(V(t[r].semver),t[r].semver===qn.ANY)continue;if(t[r].semver.prerelease.length>0){let n=t[r].semver;if(n.major===c.major&&n.minor===c.minor&&n.patch===c.patch)return!0}}return!1}return!0}});var tc=K((CX,w0)=>{var cc=Symbol("SemVer ANY");class nu{static get ANY(){return cc}constructor(t,c){if(c=q0(c),t instanceof nu)if(t.loose===!!c.loose)return t;else t=t.value;if(t=t.trim().split(/\s+/).join(" "),Kn("comparator",t,c),this.options=c,this.loose=!!c.loose,this.parse(t),this.semver===cc)this.value="";else this.value=this.operator+this.semver.version;Kn("comp",this)}parse(t){let c=this.options.loose?_0[K0.COMPARATORLOOSE]:_0[K0.COMPARATOR],u=t.match(c);if(!u)throw TypeError(`Invalid comparator: ${t}`);if(this.operator=u[1]!==void 0?u[1]:"",this.operator==="=")this.operator="";if(!u[2])this.semver=cc;else this.semver=new W0(u[2],this.options.loose)}toString(){return this.value}test(t){if(Kn("Comparator.test",t,this.options.loose),this.semver===cc||t===cc)return!0;if(typeof t==="string")try{t=new W0(t,this.options)}catch(c){return!1}return _n(t,this.operator,this.semver,this.options)}intersects(t,c){if(!(t instanceof nu))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new J0(t.value,c).test(this.value)}else if(t.operator===""){if(t.value==="")return!0;return new J0(this.value,c).test(t.semver)}if(c=q0(c),c.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0"))return!1;if(!c.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&t.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&t.operator.startsWith("<"))return!0;if(this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("="))return!0;if(_n(this.semver,"<",t.semver,c)&&this.operator.startsWith(">")&&t.operator.startsWith("<"))return!0;if(_n(this.semver,">",t.semver,c)&&this.operator.startsWith("<")&&t.operator.startsWith(">"))return!0;return!1}}w0.exports=nu;var q0=Fc(),{safeRe:_0,t:K0}=yt(),_n=hn(),Kn=lt(),W0=L(),J0=n1()});var uc=K((OX,$0)=>{var Cw=n1(),Ow=(t,c,u)=>{try{c=new Cw(c,u)}catch(r){return!1}return c.test(t)};$0.exports=Ow});var A0=K((GX,P0)=>{var Gw=n1(),Zw=(t,c)=>new Gw(t,c).set.map((u)=>u.map((r)=>r.value).join(" ").trim().split(" "));P0.exports=Zw});var y0=K((ZX,S0)=>{var Iw=L(),Xw=n1(),Ew=(t,c,u)=>{let r=null,n=null,f=null;try{f=new Xw(c,u)}catch(d){return null}return t.forEach((d)=>{if(f.test(d)){if(!r||n.compare(d)===-1)r=d,n=new Iw(r,u)}}),r};S0.exports=Ew});var C0=K((IX,H0)=>{var Yw=L(),zw=n1(),Rw=(t,c,u)=>{let r=null,n=null,f=null;try{f=new zw(c,u)}catch(d){return null}return t.forEach((d)=>{if(f.test(d)){if(!r||n.compare(d)===1)r=d,n=new Yw(r,u)}}),r};H0.exports=Rw});var Z0=K((XX,G0)=>{var Wn=L(),iw=n1(),O0=Qt(),Vw=(t,c)=>{t=new iw(t,c);let u=new Wn("0.0.0");if(t.test(u))return u;if(u=new Wn("0.0.0-0"),t.test(u))return u;u=null;for(let r=0;r<t.set.length;++r){let n=t.set[r],f=null;if(n.forEach((d)=>{let h=new Wn(d.semver.version);switch(d.operator){case">":if(h.prerelease.length===0)h.patch++;else h.prerelease.push(0);h.raw=h.format();case"":case">=":if(!f||O0(h,f))f=h;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${d.operator}`)}}),f&&(!u||O0(u,f)))u=f}if(u&&t.test(u))return u;return null};G0.exports=Vw});var X0=K((EX,I0)=>{var Mw=n1(),Nw=(t,c)=>{try{return new Mw(t,c).range||"*"}catch(u){return null}};I0.exports=Nw});var fu=K((YX,R0)=>{var Tw=L(),z0=tc(),{ANY:Dw}=z0,bw=n1(),ew=uc(),E0=Qt(),Y0=ac(),jw=cu(),pw=tu(),vw=(t,c,u,r)=>{t=new Tw(t,r),c=new bw(c,r);let n,f,d,h,_;switch(u){case">":n=E0,f=jw,d=Y0,h=">",_=">=";break;case"<":n=Y0,f=pw,d=E0,h="<",_="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(ew(t,c,r))return!1;for(let q=0;q<c.set.length;++q){let W=c.set[q],J=null,$=null;if(W.forEach((w)=>{if(w.semver===Dw)w=new z0(">=0.0.0");if(J=J||w,$=$||w,n(w.semver,J.semver,r))J=w;else if(d(w.semver,$.semver,r))$=w}),J.operator===h||J.operator===_)return!1;if((!$.operator||$.operator===h)&&f(t,$.semver))return!1;else if($.operator===_&&d(t,$.semver))return!1}return!0};R0.exports=vw});var V0=K((zX,i0)=>{var xw=fu(),Lw=(t,c,u)=>xw(t,c,">",u);i0.exports=Lw});var N0=K((RX,M0)=>{var sw=fu(),mw=(t,c,u)=>sw(t,c,"<",u);M0.exports=mw});var b0=K((iX,D0)=>{var T0=n1(),gw=(t,c,u)=>{return t=new T0(t,u),c=new T0(c,u),t.intersects(c,u)};D0.exports=gw});var j0=K((VX,e0)=>{var Bw=uc(),Fw=r1();e0.exports=(t,c,u)=>{let r=[],n=null,f=null,d=t.sort((W,J)=>Fw(W,J,u));for(let W of d)if(Bw(W,c,u)){if(f=W,!n)n=W}else{if(f)r.push([n,f]);f=null,n=null}if(n)r.push([n,null]);let h=[];for(let[W,J]of r)if(W===J)h.push(W);else if(!J&&W===d[0])h.push("*");else if(!J)h.push(`>=${W}`);else if(W===d[0])h.push(`<=${J}`);else h.push(`${W} - ${J}`);let _=h.join(" || "),q=typeof c.raw==="string"?c.raw:String(c);return _.length<q.length?_:c}});var m0=K((MX,s0)=>{var p0=n1(),$n=tc(),{ANY:Jn}=$n,wn=uc(),Pn=r1(),kw=(t,c,u={})=>{if(t===c)return!0;t=new p0(t,u),c=new p0(c,u);let r=!1;t:for(let n of t.set){for(let f of c.set){let d=ow(n,f,u);if(r=r||d!==null,d)continue t}if(r)return!1}return!0},Uw=[new $n(">=0.0.0-0")],v0=[new $n(">=0.0.0")],ow=(t,c,u)=>{if(t===c)return!0;if(t.length===1&&t[0].semver===Jn)if(c.length===1&&c[0].semver===Jn)return!0;else if(u.includePrerelease)t=Uw;else t=v0;if(c.length===1&&c[0].semver===Jn)if(u.includePrerelease)return!0;else c=v0;let r=new Set,n,f;for(let w of t)if(w.operator===">"||w.operator===">=")n=x0(n,w,u);else if(w.operator==="<"||w.operator==="<=")f=L0(f,w,u);else r.add(w.semver);if(r.size>1)return null;let d;if(n&&f){if(d=Pn(n.semver,f.semver,u),d>0)return null;else if(d===0&&(n.operator!==">="||f.operator!=="<="))return null}for(let w of r){if(n&&!wn(w,String(n),u))return null;if(f&&!wn(w,String(f),u))return null;for(let P of c)if(!wn(w,String(P),u))return!1;return!0}let h,_,q,W,J=f&&!u.includePrerelease&&f.semver.prerelease.length?f.semver:!1,$=n&&!u.includePrerelease&&n.semver.prerelease.length?n.semver:!1;if(J&&J.prerelease.length===1&&f.operator==="<"&&J.prerelease[0]===0)J=!1;for(let w of c){if(W=W||w.operator===">"||w.operator===">=",q=q||w.operator==="<"||w.operator==="<=",n){if($){if(w.semver.prerelease&&w.semver.prerelease.length&&w.semver.major===$.major&&w.semver.minor===$.minor&&w.semver.patch===$.patch)$=!1}if(w.operator===">"||w.operator===">="){if(h=x0(n,w,u),h===w&&h!==n)return!1}else if(n.operator===">="&&!w.test(n.semver))return!1}if(f){if(J){if(w.semver.prerelease&&w.semver.prerelease.length&&w.semver.major===J.major&&w.semver.minor===J.minor&&w.semver.patch===J.patch)J=!1}if(w.operator==="<"||w.operator==="<="){if(_=L0(f,w,u),_===w&&_!==f)return!1}else if(f.operator==="<="&&!w.test(f.semver))return!1}if(!w.operator&&(f||n)&&d!==0)return!1}if(n&&q&&!f&&d!==0)return!1;if(f&&W&&!n&&d!==0)return!1;if($||J)return!1;return!0},x0=(t,c,u)=>{if(!t)return c;let r=Pn(t.semver,c.semver,u);return r>0?t:r<0?c:c.operator===">"&&t.operator===">="?c:t},L0=(t,c,u)=>{if(!t)return c;let r=Pn(t.semver,c.semver,u);return r<0?t:r>0?c:c.operator==="<"&&t.operator==="<="?c:t};s0.exports=kw});var du=K((NX,F0)=>{var An=yt(),g0=St(),lw=L(),B0=rn(),Qw=D1(),aw=Pq(),t$=Sq(),c$=Cq(),u$=Zq(),r$=Xq(),n$=Yq(),f$=Rq(),d$=Vq(),h$=r1(),q$=Dq(),_$=eq(),K$=Qc(),W$=xq(),J$=sq(),w$=Qt(),$$=ac(),P$=fn(),A$=dn(),S$=tu(),y$=cu(),H$=hn(),C$=Qq(),O$=t0(),G$=tc(),Z$=n1(),I$=uc(),X$=A0(),E$=y0(),Y$=C0(),z$=Z0(),R$=X0(),i$=fu(),V$=V0(),M$=N0(),N$=b0(),T$=j0(),D$=m0();F0.exports={parse:Qw,valid:aw,clean:t$,inc:c$,diff:u$,major:r$,minor:n$,patch:f$,prerelease:d$,compare:h$,rcompare:q$,compareLoose:_$,compareBuild:K$,sort:W$,rsort:J$,gt:w$,lt:$$,eq:P$,neq:A$,gte:S$,lte:y$,cmp:H$,coerce:C$,truncate:O$,Comparator:G$,Range:Z$,satisfies:I$,toComparators:X$,maxSatisfying:E$,minSatisfying:Y$,minVersion:z$,validRange:R$,outside:i$,gtr:V$,ltr:M$,intersects:N$,simplifyRange:T$,subset:D$,SemVer:lw,re:An.re,src:An.src,tokens:An.t,SEMVER_SPEC_VERSION:g0.SEMVER_SPEC_VERSION,RELEASE_TYPES:g0.RELEASE_TYPES,compareIdentifiers:B0.compareIdentifiers,rcompareIdentifiers:B0.rcompareIdentifiers}});var U0=K((TX,k0)=>{var b$=du();k0.exports=b$.satisfies(process.version,">=15.7.0")});var l0=K((DX,o0)=>{var e$=du();o0.exports=e$.satisfies(process.version,">=16.9.0")});var Sn=K((bX,Q0)=>{var j$=U0(),p$=l0(),v$={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},x$={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};Q0.exports=function(t,c){if(!t||!c)return;let u=c.asymmetricKeyType;if(!u)return;let r=v$[u];if(!r)throw Error(`Unknown key type "${u}".`);if(!r.includes(t))throw Error(`"alg" parameter for "${u}" key type must be one of: ${r.join(", ")}.`);if(j$)switch(u){case"ec":let n=c.asymmetricKeyDetails.namedCurve,f=x$[t];if(n!==f)throw Error(`"alg" parameter "${t}" requires curve "${f}".`);break;case"rsa-pss":if(p$){let d=parseInt(t.slice(-3),10),{hashAlgorithm:h,mgf1HashAlgorithm:_,saltLength:q}=c.asymmetricKeyDetails;if(h!==`sha${d}`||_!==h)throw Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${t}.`);if(q!==void 0&&q>d>>3)throw Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${t}.`)}break}}});var yn=K((eX,a0)=>{var L$=du();a0.exports=L$.satisfies(process.version,"^6.12.0 || >=8.0.0")});var u_=K((jX,c_)=>{var z=ot(),s$=lr(),t_=Qr(),m$=or(),g$=tn(),B$=Sn(),F$=yn(),k$=Lc(),{KeyObject:U$,createSecretKey:o$,createPublicKey:l$}=require("crypto"),Hn=["RS256","RS384","RS512"],Q$=["ES256","ES384","ES512"],Cn=["RS256","RS384","RS512"],a$=["HS256","HS384","HS512"];if(F$)Hn.splice(Hn.length,0,"PS256","PS384","PS512"),Cn.splice(Cn.length,0,"PS256","PS384","PS512");c_.exports=function(t,c,u,r){if(typeof u==="function"&&!r)r=u,u={};if(!u)u={};u=Object.assign({},u);let n;if(r)n=r;else n=function(W,J){if(W)throw W;return J};if(u.clockTimestamp&&typeof u.clockTimestamp!=="number")return n(new z("clockTimestamp must be a number"));if(u.nonce!==void 0&&(typeof u.nonce!=="string"||u.nonce.trim()===""))return n(new z("nonce must be a non-empty string"));if(u.allowInvalidAsymmetricKeyTypes!==void 0&&typeof u.allowInvalidAsymmetricKeyTypes!=="boolean")return n(new z("allowInvalidAsymmetricKeyTypes must be a boolean"));let f=u.clockTimestamp||Math.floor(Date.now()/1000);if(!t)return n(new z("jwt must be provided"));if(typeof t!=="string")return n(new z("jwt must be a string"));let d=t.split(".");if(d.length!==3)return n(new z("jwt malformed"));let h;try{h=m$(t,{complete:!0})}catch(W){return n(W)}if(!h)return n(new z("invalid token"));let _=h.header,q;if(typeof c==="function"){if(!r)return n(new z("verify must be called asynchronous if secret or public key is provided as a callback"));q=c}else q=function(W,J){return J(null,c)};return q(_,function(W,J){if(W)return n(new z("error in secret or public key callback: "+W.message));let $=d[2].trim()!=="";if(!$&&J)return n(new z("jwt signature is required"));if($&&!J)return n(new z("secret or public key must be provided"));if(!$&&!u.algorithms)return n(new z('please specify "none" in "algorithms" to verify unsigned tokens'));if(J!=null&&!(J instanceof U$))try{J=l$(J)}catch(A){try{J=o$(typeof J==="string"?Buffer.from(J):J)}catch(G){return n(new z("secretOrPublicKey is not valid key material"))}}if(!u.algorithms)if(J.type==="secret")u.algorithms=a$;else if(["rsa","rsa-pss"].includes(J.asymmetricKeyType))u.algorithms=Cn;else if(J.asymmetricKeyType==="ec")u.algorithms=Q$;else u.algorithms=Hn;if(u.algorithms.indexOf(h.header.alg)===-1)return n(new z("invalid algorithm"));if(_.alg.startsWith("HS")&&J.type!=="secret")return n(new z(`secretOrPublicKey must be a symmetric key when using ${_.alg}`));else if(/^(?:RS|PS|ES)/.test(_.alg)&&J.type!=="public")return n(new z(`secretOrPublicKey must be an asymmetric key when using ${_.alg}`));if(!u.allowInvalidAsymmetricKeyTypes)try{B$(_.alg,J)}catch(A){return n(A)}let w;try{w=k$.verify(t,h.header.alg,J)}catch(A){return n(A)}if(!w)return n(new z("invalid signature"));let P=h.payload;if(typeof P.nbf<"u"&&!u.ignoreNotBefore){if(typeof P.nbf!=="number")return n(new z("invalid nbf value"));if(P.nbf>f+(u.clockTolerance||0))return n(new s$("jwt not active",new Date(P.nbf*1000)))}if(typeof P.exp<"u"&&!u.ignoreExpiration){if(typeof P.exp!=="number")return n(new z("invalid exp value"));if(f>=P.exp+(u.clockTolerance||0))return n(new t_("jwt expired",new Date(P.exp*1000)))}if(u.audience){let A=Array.isArray(u.audience)?u.audience:[u.audience];if(!(Array.isArray(P.aud)?P.aud:[P.aud]).some(function(E){return A.some(function(O){return O instanceof RegExp?O.test(E):O===E})}))return n(new z("jwt audience invalid. expected: "+A.join(" or ")))}if(u.issuer){if(typeof u.issuer==="string"&&P.iss!==u.issuer||Array.isArray(u.issuer)&&u.issuer.indexOf(P.iss)===-1)return n(new z("jwt issuer invalid. expected: "+u.issuer))}if(u.subject){if(P.sub!==u.subject)return n(new z("jwt subject invalid. expected: "+u.subject))}if(u.jwtid){if(P.jti!==u.jwtid)return n(new z("jwt jwtid invalid. expected: "+u.jwtid))}if(u.nonce){if(P.nonce!==u.nonce)return n(new z("jwt nonce invalid. expected: "+u.nonce))}if(u.maxAge){if(typeof P.iat!=="number")return n(new z("iat required when maxAge is specified"));let A=g$(u.maxAge,P.iat);if(typeof A>"u")return n(new z('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(f>=A+(u.clockTolerance||0))return n(new t_("maxAge exceeded",new Date(A*1000)))}if(u.complete===!0){let A=h.signature;return n(null,{header:_,payload:P,signature:A})}return n(null,P)})}});var q_=K((pX,h_)=>{var r_=1/0,f_=9007199254740991,tP=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,n_=NaN,cP="[object Arguments]",uP="[object Function]",rP="[object GeneratorFunction]",nP="[object String]",fP="[object Symbol]",dP=/^\s+|\s+$/g,hP=/^[-+]0x[0-9a-f]+$/i,qP=/^0b[01]+$/i,_P=/^0o[0-7]+$/i,KP=/^(?:0|[1-9]\d*)$/,WP=parseInt;function JP(t,c){var u=-1,r=t?t.length:0,n=Array(r);while(++u<r)n[u]=c(t[u],u,t);return n}function wP(t,c,u,r){var n=t.length,f=u+(r?1:-1);while(r?f--:++f<n)if(c(t[f],f,t))return f;return-1}function $P(t,c,u){if(c!==c)return wP(t,PP,u);var r=u-1,n=t.length;while(++r<n)if(t[r]===c)return r;return-1}function PP(t){return t!==t}function AP(t,c){var u=-1,r=Array(t);while(++u<t)r[u]=c(u);return r}function SP(t,c){return JP(c,function(u){return t[u]})}function yP(t,c){return function(u){return t(c(u))}}var hu=Object.prototype,Gn=hu.hasOwnProperty,qu=hu.toString,HP=hu.propertyIsEnumerable,CP=yP(Object.keys,Object),OP=Math.max;function GP(t,c){var u=d_(t)||YP(t)?AP(t.length,String):[],r=u.length,n=!!r;for(var f in t)if((c||Gn.call(t,f))&&!(n&&(f=="length"||IP(f,r))))u.push(f);return u}function ZP(t){if(!XP(t))return CP(t);var c=[];for(var u in Object(t))if(Gn.call(t,u)&&u!="constructor")c.push(u);return c}function IP(t,c){return c=c==null?f_:c,!!c&&(typeof t=="number"||KP.test(t))&&(t>-1&&t%1==0&&t<c)}function XP(t){var c=t&&t.constructor,u=typeof c=="function"&&c.prototype||hu;return t===u}function EP(t,c,u,r){t=Zn(t)?t:eP(t),u=u&&!r?TP(u):0;var n=t.length;if(u<0)u=OP(n+u,0);return VP(t)?u<=n&&t.indexOf(c,u)>-1:!!n&&$P(t,c,u)>-1}function YP(t){return zP(t)&&Gn.call(t,"callee")&&(!HP.call(t,"callee")||qu.call(t)==cP)}var d_=Array.isArray;function Zn(t){return t!=null&&iP(t.length)&&!RP(t)}function zP(t){return In(t)&&Zn(t)}function RP(t){var c=On(t)?qu.call(t):"";return c==uP||c==rP}function iP(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=f_}function On(t){var c=typeof t;return!!t&&(c=="object"||c=="function")}function In(t){return!!t&&typeof t=="object"}function VP(t){return typeof t=="string"||!d_(t)&&In(t)&&qu.call(t)==nP}function MP(t){return typeof t=="symbol"||In(t)&&qu.call(t)==fP}function NP(t){if(!t)return t===0?t:0;if(t=DP(t),t===r_||t===-r_){var c=t<0?-1:1;return c*tP}return t===t?t:0}function TP(t){var c=NP(t),u=c%1;return c===c?u?c-u:c:0}function DP(t){if(typeof t=="number")return t;if(MP(t))return n_;if(On(t)){var c=typeof t.valueOf=="function"?t.valueOf():t;t=On(c)?c+"":c}if(typeof t!="string")return t===0?t:+t;t=t.replace(dP,"");var u=qP.test(t);return u||_P.test(t)?WP(t.slice(2),u?2:8):hP.test(t)?n_:+t}function bP(t){return Zn(t)?GP(t):ZP(t)}function eP(t){return t?SP(t,bP(t)):[]}h_.exports=EP});var K_=K((vX,__)=>{var jP="[object Boolean]",pP=Object.prototype,vP=pP.toString;function xP(t){return t===!0||t===!1||LP(t)&&vP.call(t)==jP}function LP(t){return!!t&&typeof t=="object"}__.exports=xP});var P_=K((xX,$_)=>{var W_=1/0,sP=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,J_=NaN,mP="[object Symbol]",gP=/^\s+|\s+$/g,BP=/^[-+]0x[0-9a-f]+$/i,FP=/^0b[01]+$/i,kP=/^0o[0-7]+$/i,UP=parseInt,oP=Object.prototype,lP=oP.toString;function QP(t){return typeof t=="number"&&t==uA(t)}function w_(t){var c=typeof t;return!!t&&(c=="object"||c=="function")}function aP(t){return!!t&&typeof t=="object"}function tA(t){return typeof t=="symbol"||aP(t)&&lP.call(t)==mP}function cA(t){if(!t)return t===0?t:0;if(t=rA(t),t===W_||t===-W_){var c=t<0?-1:1;return c*sP}return t===t?t:0}function uA(t){var c=cA(t),u=c%1;return c===c?u?c-u:c:0}function rA(t){if(typeof t=="number")return t;if(tA(t))return J_;if(w_(t)){var c=typeof t.valueOf=="function"?t.valueOf():t;t=w_(c)?c+"":c}if(typeof t!="string")return t===0?t:+t;t=t.replace(gP,"");var u=FP.test(t);return u||kP.test(t)?UP(t.slice(2),u?2:8):BP.test(t)?J_:+t}$_.exports=QP});var S_=K((LX,A_)=>{var nA="[object Number]",fA=Object.prototype,dA=fA.toString;function hA(t){return!!t&&typeof t=="object"}function qA(t){return typeof t=="number"||hA(t)&&dA.call(t)==nA}A_.exports=qA});var O_=K((sX,C_)=>{var _A="[object Object]";function KA(t){var c=!1;if(t!=null&&typeof t.toString!="function")try{c=!!(t+"")}catch(u){}return c}function WA(t,c){return function(u){return t(c(u))}}var JA=Function.prototype,y_=Object.prototype,H_=JA.toString,wA=y_.hasOwnProperty,$A=H_.call(Object),PA=y_.toString,AA=WA(Object.getPrototypeOf,Object);function SA(t){return!!t&&typeof t=="object"}function yA(t){if(!SA(t)||PA.call(t)!=_A||KA(t))return!1;var c=AA(t);if(c===null)return!0;var u=wA.call(c,"constructor")&&c.constructor;return typeof u=="function"&&u instanceof u&&H_.call(u)==$A}C_.exports=yA});var Z_=K((mX,G_)=>{var HA="[object String]",CA=Object.prototype,OA=CA.toString,GA=Array.isArray;function ZA(t){return!!t&&typeof t=="object"}function IA(t){return typeof t=="string"||!GA(t)&&ZA(t)&&OA.call(t)==HA}G_.exports=IA});var z_=K((gX,Y_)=>{var XA="Expected a function",I_=1/0,EA=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,X_=NaN,YA="[object Symbol]",zA=/^\s+|\s+$/g,RA=/^[-+]0x[0-9a-f]+$/i,iA=/^0b[01]+$/i,VA=/^0o[0-7]+$/i,MA=parseInt,NA=Object.prototype,TA=NA.toString;function DA(t,c){var u;if(typeof c!="function")throw TypeError(XA);return t=vA(t),function(){if(--t>0)u=c.apply(this,arguments);if(t<=1)c=void 0;return u}}function bA(t){return DA(2,t)}function E_(t){var c=typeof t;return!!t&&(c=="object"||c=="function")}function eA(t){return!!t&&typeof t=="object"}function jA(t){return typeof t=="symbol"||eA(t)&&TA.call(t)==YA}function pA(t){if(!t)return t===0?t:0;if(t=xA(t),t===I_||t===-I_){var c=t<0?-1:1;return c*EA}return t===t?t:0}function vA(t){var c=pA(t),u=c%1;return c===c?u?c-u:c:0}function xA(t){if(typeof t=="number")return t;if(jA(t))return X_;if(E_(t)){var c=typeof t.valueOf=="function"?t.valueOf():t;t=E_(c)?c+"":c}if(typeof t!="string")return t===0?t:+t;t=t.replace(zA,"");var u=iA.test(t);return u||VA.test(t)?MA(t.slice(2),u?2:8):RA.test(t)?X_:+t}Y_.exports=bA});var e_=K((BX,b_)=>{var R_=tn(),LA=yn(),sA=Sn(),i_=Lc(),mA=q_(),_u=K_(),V_=P_(),Xn=S_(),N_=O_(),b1=Z_(),gA=z_(),{KeyObject:BA,createSecretKey:FA,createPrivateKey:kA}=require("crypto"),T_=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];if(LA)T_.splice(3,0,"PS256","PS384","PS512");var UA={expiresIn:{isValid:function(t){return V_(t)||b1(t)&&t},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(t){return V_(t)||b1(t)&&t},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(t){return b1(t)||Array.isArray(t)},message:'"audience" must be a string or array'},algorithm:{isValid:mA.bind(null,T_),message:'"algorithm" must be a valid string enum value'},header:{isValid:N_,message:'"header" must be an object'},encoding:{isValid:b1,message:'"encoding" must be a string'},issuer:{isValid:b1,message:'"issuer" must be a string'},subject:{isValid:b1,message:'"subject" must be a string'},jwtid:{isValid:b1,message:'"jwtid" must be a string'},noTimestamp:{isValid:_u,message:'"noTimestamp" must be a boolean'},keyid:{isValid:b1,message:'"keyid" must be a string'},mutatePayload:{isValid:_u,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:_u,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:_u,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},oA={iat:{isValid:Xn,message:'"iat" should be a number of seconds'},exp:{isValid:Xn,message:'"exp" should be a number of seconds'},nbf:{isValid:Xn,message:'"nbf" should be a number of seconds'}};function D_(t,c,u,r){if(!N_(u))throw Error('Expected "'+r+'" to be a plain object.');Object.keys(u).forEach(function(n){let f=t[n];if(!f){if(!c)throw Error('"'+n+'" is not allowed in "'+r+'"');return}if(!f.isValid(u[n]))throw Error(f.message)})}function lA(t){return D_(UA,!1,t,"options")}function QA(t){return D_(oA,!0,t,"payload")}var M_={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},aA=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];b_.exports=function(t,c,u,r){if(typeof u==="function")r=u,u={};else u=u||{};let n=typeof t==="object"&&!Buffer.isBuffer(t),f=Object.assign({alg:u.algorithm||"HS256",typ:n?"JWT":void 0,kid:u.keyid},u.header);function d(q){if(r)return r(q);throw q}if(!c&&u.algorithm!=="none")return d(Error("secretOrPrivateKey must have a value"));if(c!=null&&!(c instanceof BA))try{c=kA(c)}catch(q){try{c=FA(typeof c==="string"?Buffer.from(c):c)}catch(W){return d(Error("secretOrPrivateKey is not valid key material"))}}if(f.alg.startsWith("HS")&&c.type!=="secret")return d(Error(`secretOrPrivateKey must be a symmetric key when using ${f.alg}`));else if(/^(?:RS|PS|ES)/.test(f.alg)){if(c.type!=="private")return d(Error(`secretOrPrivateKey must be an asymmetric key when using ${f.alg}`));if(!u.allowInsecureKeySizes&&!f.alg.startsWith("ES")&&c.asymmetricKeyDetails!==void 0&&c.asymmetricKeyDetails.modulusLength<2048)return d(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${f.alg}`))}if(typeof t>"u")return d(Error("payload is required"));else if(n){try{QA(t)}catch(q){return d(q)}if(!u.mutatePayload)t=Object.assign({},t)}else{let q=aA.filter(function(W){return typeof u[W]<"u"});if(q.length>0)return d(Error("invalid "+q.join(",")+" option for "+typeof t+" payload"))}if(typeof t.exp<"u"&&typeof u.expiresIn<"u")return d(Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(typeof t.nbf<"u"&&typeof u.notBefore<"u")return d(Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{lA(u)}catch(q){return d(q)}if(!u.allowInvalidAsymmetricKeyTypes)try{sA(f.alg,c)}catch(q){return d(q)}let h=t.iat||Math.floor(Date.now()/1000);if(u.noTimestamp)delete t.iat;else if(n)t.iat=h;if(typeof u.notBefore<"u"){try{t.nbf=R_(u.notBefore,h)}catch(q){return d(q)}if(typeof t.nbf>"u")return d(Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(typeof u.expiresIn<"u"&&typeof t==="object"){try{t.exp=R_(u.expiresIn,h)}catch(q){return d(q)}if(typeof t.exp>"u")return d(Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(M_).forEach(function(q){let W=M_[q];if(typeof u[q]<"u"){if(typeof t[W]<"u")return d(Error('Bad "options.'+q+'" option. The payload already has an "'+W+'" property.'));t[W]=u[q]}});let _=u.encoding||"utf8";if(typeof r==="function")r=r&&gA(r),i_.createSign({header:f,privateKey:c,payload:t,encoding:_}).once("error",r).once("done",function(q){if(!u.allowInsecureKeySizes&&/^(?:RS|PS)/.test(f.alg)&&q.length<256)return r(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${f.alg}`));r(null,q)});else{let q=i_.sign({header:f,payload:t,secret:c,encoding:_});if(!u.allowInsecureKeySizes&&/^(?:RS|PS)/.test(f.alg)&&q.length<256)throw Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${f.alg}`);return q}}});var p_=K((FX,j_)=>{j_.exports={decode:or(),verify:u_(),sign:e_(),JsonWebTokenError:ot(),NotBeforeError:lr(),TokenExpiredError:Qr()}});var En=K((kX,v_)=>{function tS(t){u.debug=u,u.default=u,u.coerce=_,u.disable=d,u.enable=n,u.enabled=h,u.humanize=ar(),u.destroy=q,Object.keys(t).forEach((W)=>{u[W]=t[W]}),u.names=[],u.skips=[],u.formatters={};function c(W){let J=0;for(let $=0;$<W.length;$++)J=(J<<5)-J+W.charCodeAt($),J|=0;return u.colors[Math.abs(J)%u.colors.length]}u.selectColor=c;function u(W){let J,$=null,w,P;function A(...G){if(!A.enabled)return;let I=A,E=Number(new Date),O=E-(J||E);if(I.diff=O,I.prev=J,I.curr=E,J=E,G[0]=u.coerce(G[0]),typeof G[0]!=="string")G.unshift("%O");let j=0;G[0]=G[0].replace(/%([a-zA-Z%])/g,(c1,N1)=>{if(c1==="%%")return"%";j++;let F1=u.formatters[N1];if(typeof F1==="function"){let zc=G[j];c1=F1.call(I,zc),G.splice(j,1),j--}return c1}),u.formatArgs.call(I,G),(I.log||u.log).apply(I,G)}if(A.namespace=W,A.useColors=u.useColors(),A.color=u.selectColor(W),A.extend=r,A.destroy=u.destroy,Object.defineProperty(A,"enabled",{enumerable:!0,configurable:!1,get:()=>{if($!==null)return $;if(w!==u.namespaces)w=u.namespaces,P=u.enabled(W);return P},set:(G)=>{$=G}}),typeof u.init==="function")u.init(A);return A}function r(W,J){let $=u(this.namespace+(typeof J>"u"?":":J)+W);return $.log=this.log,$}function n(W){u.save(W),u.namespaces=W,u.names=[],u.skips=[];let J=(typeof W==="string"?W:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let $ of J)if($[0]==="-")u.skips.push($.slice(1));else u.names.push($)}function f(W,J){let $=0,w=0,P=-1,A=0;while($<W.length)if(w<J.length&&(J[w]===W[$]||J[w]==="*"))if(J[w]==="*")P=w,A=$,w++;else $++,w++;else if(P!==-1)w=P+1,A++,$=A;else return!1;while(w<J.length&&J[w]==="*")w++;return w===J.length}function d(){let W=[...u.names,...u.skips.map((J)=>"-"+J)].join(",");return u.enable(""),W}function h(W){for(let J of u.skips)if(f(W,J))return!1;for(let J of u.names)if(f(W,J))return!0;return!1}function _(W){if(W instanceof Error)return W.stack||W.message;return W}function q(){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 u.enable(u.load()),u}v_.exports=tS});var x_=K((o,Ku)=>{o.formatArgs=uS;o.save=rS;o.load=nS;o.useColors=cS;o.storage=fS();o.destroy=(()=>{let t=!1;return()=>{if(!t)t=!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`.")}})();o.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 cS(){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 t;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&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function uS(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Ku.exports.humanize(this.diff),!this.useColors)return;let c="color: "+this.color;t.splice(1,0,c,"color: inherit");let u=0,r=0;t[0].replace(/%[a-zA-Z%]/g,(n)=>{if(n==="%%")return;if(u++,n==="%c")r=u}),t.splice(r,0,c)}o.log=console.debug||console.log||(()=>{});function rS(t){try{if(t)o.storage.setItem("debug",t);else o.storage.removeItem("debug")}catch(c){}}function nS(){let t;try{t=o.storage.getItem("debug")||o.storage.getItem("DEBUG")}catch(c){}if(!t&&typeof process<"u"&&"env"in process)t=process.env.DEBUG;return t}function fS(){try{return localStorage}catch(t){}}Ku.exports=En()(o);var{formatters:dS}=Ku.exports;dS.j=function(t){try{return JSON.stringify(t)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}});var s_={};th(s_,{default:()=>WS,createSupportsColor:()=>zn});function f1(t,c=globalThis.Deno?globalThis.Deno.args:Ju.default.argv){let u=t.startsWith("-")?"":t.length===1?"-":"--",r=c.indexOf(u+t),n=c.indexOf("--");return r!==-1&&(n===-1||r<n)}function hS(){if(!("FORCE_COLOR"in M))return;if(M.FORCE_COLOR==="true")return 1;if(M.FORCE_COLOR==="false")return 0;if(M.FORCE_COLOR.length===0)return 1;let t=Math.min(Number.parseInt(M.FORCE_COLOR,10),3);if(![0,1,2,3].includes(t))return;return t}function qS(t){if(t===0)return!1;return{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function _S(t,{streamIsTTY:c,sniffFlags:u=!0}={}){let r=hS();if(r!==void 0)Wu=r;let n=u?Wu:r;if(n===0)return 0;if(u){if(f1("color=16m")||f1("color=full")||f1("color=truecolor"))return 3;if(f1("color=256"))return 2}if("TF_BUILD"in M&&"AGENT_NAME"in M)return 1;if(t&&!c&&n===void 0)return 0;let f=n||0;if(M.TERM==="dumb")return f;if(Ju.default.platform==="win32"){let d=L_.default.release().split(".");if(Number(d[0])>=10&&Number(d[2])>=10586)return Number(d[2])>=14931?3:2;return 1}if("CI"in M){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((d)=>(d in M)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((d)=>(d in M))||M.CI_NAME==="codeship")return 1;return f}if("TEAMCITY_VERSION"in M)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(M.TEAMCITY_VERSION)?1:0;if(M.COLORTERM==="truecolor")return 3;if(M.TERM==="xterm-kitty")return 3;if(M.TERM==="xterm-ghostty")return 3;if(M.TERM==="wezterm")return 3;if("TERM_PROGRAM"in M){let d=Number.parseInt((M.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(M.TERM_PROGRAM){case"iTerm.app":return d>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(M.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(M.TERM))return 1;if("COLORTERM"in M)return 1;return f}function zn(t,c={}){let u=_S(t,{streamIsTTY:t&&t.isTTY,...c});return qS(u)}var Ju,L_,Yn,M,Wu,KS,WS;var m_=VW(()=>{Ju=_t(require("node:process")),L_=_t(require("node:os")),Yn=_t(require("node:tty"));({env:M}=Ju.default);if(f1("no-color")||f1("no-colors")||f1("color=false")||f1("color=never"))Wu=0;else if(f1("color")||f1("colors")||f1("color=true")||f1("color=always"))Wu=1;KS={stdout:zn({isTTY:Yn.default.isatty(1)}),stderr:zn({isTTY:Yn.default.isatty(2)})},WS=KS});var B_=K((p,$u)=>{var JS=require("tty"),wu=require("util");p.init=HS;p.log=AS;p.formatArgs=$S;p.save=SS;p.load=yS;p.useColors=wS;p.destroy=wu.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");p.colors=[6,2,3,4,5,1];try{let t=(m_(),ad(s_));if(t&&(t.stderr||t).level>=2)p.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(t){}p.inspectOpts=Object.keys(process.env).filter((t)=>{return/^debug_/i.test(t)}).reduce((t,c)=>{let u=c.substring(6).toLowerCase().replace(/_([a-z])/g,(n,f)=>{return f.toUpperCase()}),r=process.env[c];if(/^(yes|on|true|enabled)$/i.test(r))r=!0;else if(/^(no|off|false|disabled)$/i.test(r))r=!1;else if(r==="null")r=null;else r=Number(r);return t[u]=r,t},{});function wS(){return"colors"in p.inspectOpts?Boolean(p.inspectOpts.colors):JS.isatty(process.stderr.fd)}function $S(t){let{namespace:c,useColors:u}=this;if(u){let r=this.color,n="\x1B[3"+(r<8?r:"8;5;"+r),f=` ${n};1m${c} \x1B[0m`;t[0]=f+t[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",im="key must be a string, a buffer or an object",Li=typeof ae.createPublicKey==="function";if(Li)dt+=" or a KeyObject",Yt+="or a KeyObject";function ba(e){if(pt.isBuffer(e))return;if(typeof e==="string")return;if(!Li)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 va(e){if(pt.isBuffer(e))return;if(typeof e==="string")return;if(typeof e==="object")return;throw he(im)}function om(e){if(pt.isBuffer(e))return;if(typeof e==="string")return e;if(!Li)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 Ji(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Aa(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=Ea.format.bind(Ea,e).apply(null,t);return TypeError(r)}function sm(e){return pt.isBuffer(e)||typeof e==="string"}function Zt(e){if(!sm(e))e=JSON.stringify(e);return e}function xa(e){return function(r,n){om(n),r=Zt(r);var i=ae.createHmac("sha"+e,n),o=(i.update(r),i.digest("base64"));return Ji(o)}}var Ni,am="timingSafeEqual"in ae?function(t,r){if(t.byteLength!==r.byteLength)return!1;return ae.timingSafeEqual(t,r)}:function(t,r){if(!Ni)Ni=wa();return Ni(t,r)};function cm(e){return function(r,n,i){var o=xa(e)(r,i);return am(pt.from(n),pt.from(o))}}function Ta(e){return function(r,n){va(n),r=Zt(r);var i=ae.createSign("RSA-SHA"+e),o=(i.update(r),i.sign(n,"base64"));return Ji(o)}}function Ca(e){return function(r,n,i){ba(i),r=Zt(r),n=Aa(n);var o=ae.createVerify("RSA-SHA"+e);return o.update(r),o.verify(i,n,"base64")}}function um(e){return function(r,n){va(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 Ji(o)}}function fm(e){return function(r,n,i){ba(i),r=Zt(r),n=Aa(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 lm(e){var t=Ta(e);return function(){var n=t.apply(null,arguments);return n=Sa.derToJose(n,"ES"+e),n}}function dm(e){var t=Ca(e);return function(n,i,o){i=Sa.joseToDer(i,"ES"+e).toString("base64");var s=t(n,i,o);return s}}function pm(){return function(){return""}}function hm(){return function(t,r){return r===""}}Ia.exports=function(t){var r={hs:xa,rs:Ta,ps:um,es:lm,none:pm},n={hs:cm,rs:Ca,ps:fm,es:dm,none:hm},i=t.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!i)throw he(nm,t);var o=(i[1]||i[3]).toLowerCase(),s=i[2];return{sign:r[o](s),verify:n[o](s)}}});var ji=m(function(yx,Ra){var mm=require("buffer").Buffer;Ra.exports=function(t){if(typeof t==="string")return t;if(typeof t==="number"||mm.isBuffer(t))return t.toString();return JSON.stringify(t)}});var $a=m(function(gx,Ka){var ym=lt().Buffer,Oa=Pi(),gm=Wi(),wm=require("stream"),ka=ji(),Di=require("util");function _a(e,t){return ym.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Em(e,t,r){r=r||"utf8";var n=_a(ka(e),"binary"),i=_a(ka(t),r);return Di.format("%s.%s",n,i)}function Pa(e){var{header:t,payload:r}=e,n=e.secret||e.privateKey,i=e.encoding,o=gm(t.alg),s=Em(t,r,i),a=o.sign(s,n);return Di.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 Oa(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new Oa(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))}Di.inherits(Dr,wm);Dr.prototype.sign=function(){try{var t=Pa({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=Pa;Ka.exports=Dr});var Ha=m(function(wx,Ua){var La=lt().Buffer,Na=Pi(),Sm=Wi(),bm=require("stream"),Ja=ji(),vm=require("util"),Am=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function xm(e){return Object.prototype.toString.call(e)==="[object Object]"}function Tm(e){if(xm(e))return e;try{return JSON.parse(e)}catch(t){return}}function Wa(e){var t=e.split(".",1)[0];return Tm(La.from(t,"base64").toString("binary"))}function Cm(e){return e.split(".",2).join(".")}function ja(e){return e.split(".")[2]}function Im(e,t){t=t||"utf8";var r=e.split(".")[1];return La.from(r,"base64").toString(t)}function Da(e){return Am.test(e)&&!!Wa(e)}function qa(e,t,r){if(!t){var n=Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}e=Ja(e);var i=ja(e),o=Cm(e),s=Sm(t);return s.verify(o,i,r)}function Fa(e,t){if(t=t||{},e=Ja(e),!Da(e))return null;var r=Wa(e);if(!r)return null;var n=Im(e);if(r.typ==="JWT"||t.json)n=JSON.parse(n,t.encoding);return{header:r,payload:n,signature:ja(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 Na(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new Na(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))}vm.inherits(ht,bm);ht.prototype.verify=function(){try{var t=qa(this.signature.buffer,this.algorithm,this.key.buffer),r=Fa(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=Fa;ht.isValid=Da;ht.verify=qa;Ua.exports=ht});var Fr=m(function(Ke){var Ba=$a(),qr=Ha(),Rm=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];Ke.ALGORITHMS=Rm;Ke.sign=Ba.sign;Ke.verify=qr.verify;Ke.decode=qr.decode;Ke.isValid=qr.isValid;Ke.createSign=function(t){return new Ba(t)};Ke.createVerify=function(t){return new qr(t)}});var qi=m(function(Sx,Ma){var Om=Fr();Ma.exports=function(e,t){t=t||{};var r=Om.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(bx,Ga){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;Ga.exports=Ur});var Fi=m(function(vx,Va){var za=Qt(),Hr=function(e,t){za.call(this,e),this.name="NotBeforeError",this.date=t};Hr.prototype=Object.create(za.prototype);Hr.prototype.constructor=Hr;Va.exports=Hr});var Ui=m(function(Ax,Ya){var Xa=Qt(),Br=function(e,t){Xa.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};Br.prototype=Object.create(Xa.prototype);Br.prototype.constructor=Br;Ya.exports=Br});var Hi=m(function(xx,Za){var mt=1000,yt=mt*60,gt=yt*60,Ge=gt*24,km=Ge*7,_m=Ge*365.25;Za.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Pm(e);else if(r==="number"&&isFinite(e))return t.long?$m(e):Km(e);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Pm(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*_m;case"weeks":case"week":case"w":return r*km;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 Km(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 $m(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 Bi=m(function(Tx,Qa){var Nm=Hi();Qa.exports=function(e,t){var r=t||Math.floor(Date.now()/1000);if(typeof e==="string"){var n=Nm(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(Cx,ec){var Lm=Number.MAX_SAFE_INTEGER||9007199254740991,Jm=["major","premajor","minor","preminor","patch","prepatch","prerelease"];ec.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Lm,RELEASE_TYPES:Jm,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var er=m(function(Ix,tc){var Wm=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};tc.exports=Wm});var Et=m(function(ve,rc){var{MAX_SAFE_COMPONENT_LENGTH:Mi,MAX_SAFE_BUILD_LENGTH:jm,MAX_LENGTH:Dm}=wt(),qm=er();ve=rc.exports={};var Fm=ve.re=[],Um=ve.safeRe=[],b=ve.src=[],Hm=ve.safeSrc=[],v=ve.t={},Bm=0,Gi="[a-zA-Z0-9-]",Mm=[["\\s",1],["\\d",Dm],[Gi,jm]],Gm=(e)=>{for(let[t,r]of Mm)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},C=(e,t,r)=>{let n=Gm(t),i=Bm++;qm(e,i,t),v[e]=i,b[i]=t,Hm[i]=n,Fm[i]=new RegExp(t,r?"g":void 0),Um[i]=new RegExp(n,r?"g":void 0)};C("NUMERICIDENTIFIER","0|[1-9]\\d*");C("NUMERICIDENTIFIERLOOSE","\\d+");C("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Gi}*`);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",`${Gi}+`);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,${Mi}})(?:\\.(\\d{1,${Mi}}))?(?:\\.(\\d{1,${Mi}}))?`);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(Rx,nc){var zm=Object.freeze({loose:!0}),Vm=Object.freeze({}),Xm=(e)=>{if(!e)return Vm;if(typeof e!=="object")return zm;return e};nc.exports=Xm});var zi=m(function(Ox,sc){var ic=/^[0-9]+$/,oc=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=ic.test(e),n=ic.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},Ym=(e,t)=>oc(t,e);sc.exports={compareIdentifiers:oc,rcompareIdentifiers:Ym}});var Y=m(function(kx,cc){var zr=er(),{MAX_LENGTH:ac,MAX_SAFE_INTEGER:Vr}=wt(),{safeRe:Xr,t:Yr}=Et(),Zm=Gr(),{compareIdentifiers:Vi}=zi(),Qm=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(Vi(e[n],r[n])!==0)return!1;return!0};class me{constructor(e,t){if(t=Zm(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>ac)throw TypeError(`version is longer than ${ac} 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 Vi(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 Vi(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(Qm(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}}cc.exports=me});var $e=m(function(_x,fc){var uc=Y(),ey=(e,t,r=!1)=>{if(e instanceof uc)return e;try{return new uc(e,t)}catch(n){if(!r)return null;throw n}};fc.exports=ey});var dc=m(function(Px,lc){var ty=$e(),ry=(e,t)=>{let r=ty(e,t);return r?r.version:null};lc.exports=ry});var hc=m(function(Kx,pc){var ny=$e(),iy=(e,t)=>{let r=ny(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};pc.exports=iy});var gc=m(function($x,yc){var mc=Y(),oy=(e,t,r,n,i)=>{if(typeof r==="string")i=n,n=r,r=void 0;try{return new mc(e instanceof mc?e.version:e,r).inc(t,n,i).version}catch(o){return null}};yc.exports=oy});var Sc=m(function(Nx,Ec){var wc=$e(),sy=(e,t)=>{let r=wc(e,null,!0),n=wc(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"};Ec.exports=sy});var vc=m(function(Lx,bc){var ay=Y(),cy=(e,t)=>new ay(e,t).major;bc.exports=cy});var xc=m(function(Jx,Ac){var uy=Y(),fy=(e,t)=>new uy(e,t).minor;Ac.exports=fy});var Cc=m(function(Wx,Tc){var ly=Y(),dy=(e,t)=>new ly(e,t).patch;Tc.exports=dy});var Rc=m(function(jx,Ic){var py=$e(),hy=(e,t)=>{let r=py(e,t);return r&&r.prerelease.length?r.prerelease:null};Ic.exports=hy});var ce=m(function(Dx,kc){var Oc=Y(),my=(e,t,r)=>new Oc(e,r).compare(new Oc(t,r));kc.exports=my});var Pc=m(function(qx,_c){var yy=ce(),gy=(e,t,r)=>yy(t,e,r);_c.exports=gy});var $c=m(function(Fx,Kc){var wy=ce(),Ey=(e,t)=>wy(e,t,!0);Kc.exports=Ey});var Zr=m(function(Ux,Lc){var Nc=Y(),Sy=(e,t,r)=>{let n=new Nc(e,r),i=new Nc(t,r);return n.compare(i)||n.compareBuild(i)};Lc.exports=Sy});var Wc=m(function(Hx,Jc){var by=Zr(),vy=(e,t)=>e.sort((r,n)=>by(r,n,t));Jc.exports=vy});var Dc=m(function(Bx,jc){var Ay=Zr(),xy=(e,t)=>e.sort((r,n)=>Ay(n,r,t));jc.exports=xy});var tr=m(function(Mx,qc){var Ty=ce(),Cy=(e,t,r)=>Ty(e,t,r)>0;qc.exports=Cy});var Qr=m(function(Gx,Fc){var Iy=ce(),Ry=(e,t,r)=>Iy(e,t,r)<0;Fc.exports=Ry});var Xi=m(function(zx,Uc){var Oy=ce(),ky=(e,t,r)=>Oy(e,t,r)===0;Uc.exports=ky});var Yi=m(function(Vx,Hc){var _y=ce(),Py=(e,t,r)=>_y(e,t,r)!==0;Hc.exports=Py});var en=m(function(Xx,Bc){var Ky=ce(),$y=(e,t,r)=>Ky(e,t,r)>=0;Bc.exports=$y});var tn=m(function(Yx,Mc){var Ny=ce(),Ly=(e,t,r)=>Ny(e,t,r)<=0;Mc.exports=Ly});var Zi=m(function(Zx,Gc){var Jy=Xi(),Wy=Yi(),jy=tr(),Dy=en(),qy=Qr(),Fy=tn(),Uy=(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 Jy(e,r,n);case"!=":return Wy(e,r,n);case">":return jy(e,r,n);case">=":return Dy(e,r,n);case"<":return qy(e,r,n);case"<=":return Fy(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};Gc.exports=Uy});var Vc=m(function(Qx,zc){var Hy=Y(),By=$e(),{safeRe:rn,t:nn}=Et(),My=(e,t)=>{if(e instanceof Hy)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 By(`${n}.${i}.${o}${s}${a}`,t)};zc.exports=My});var Yc=m(function(eT,Xc){var Gy=$e(),zy=wt(),Vy=Y(),Xy=(e,t,r)=>{if(!zy.RELEASE_TYPES.includes(t))return null;let n=Yy(e,r);return n&&Zy(n,t)},Yy=(e,t)=>{let r=e instanceof Vy?e.version:e;return Gy(r,t)},Zy=(e,t)=>{if(Qy(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()},Qy=(e)=>e.startsWith("pre");Xc.exports=Xy});var eu=m(function(tT,Qc){class Zc{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}}Qc.exports=Zc});var ue=m(function(rT,iu){var eg=/\s+/g;class rr{constructor(e,t){if(t=rg(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 Qi)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(eg," "),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)=>!ru(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&&lg(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(fg,"");let r=((this.options.includePrerelease&&cg)|(this.options.loose&&ug))+":"+e,n=tu.get(r);if(n)return n;let i=this.options.loose,o=i?te[Z.HYPHENRANGELOOSE]:te[Z.HYPHENRANGE];e=e.replace(o,vg(this.options.includePrerelease)),W("hyphen replace",e),e=e.replace(te[Z.COMPARATORTRIM],og),W("comparator trim",e),e=e.replace(te[Z.TILDETRIM],sg),W("tilde trim",e),e=e.replace(te[Z.CARETTRIM],ag),W("caret trim",e);let s=e.split(" ").map((u)=>dg(u,this.options)).join(" ").split(/\s+/).map((u)=>bg(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 Qi(u,this.options));for(let u of f){if(ru(u))return[u];a.set(u.value,u)}if(a.size>1&&a.has(""))a.delete("");let c=[...a.values()];return tu.set(r,c),c}intersects(e,t){if(!(e instanceof rr))throw TypeError("a Range is required");return this.set.some((r)=>nu(r,t)&&e.set.some((n)=>nu(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 ng(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(Ag(this.set[t],e,this.options))return!0;return!1}}iu.exports=rr;var tg=eu(),tu=new tg,rg=Gr(),Qi=nr(),W=er(),ng=Y(),{safeRe:te,src:ig,t:Z,comparatorTrimReplace:og,tildeTrimReplace:sg,caretTrimReplace:ag}=Et(),{FLAG_INCLUDE_PRERELEASE:cg,FLAG_LOOSE:ug}=wt(),fg=new RegExp(ig[Z.BUILD],"g"),ru=(e)=>e.value==="<0.0.0-0",lg=(e)=>e.value==="",nu=(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},dg=(e,t)=>(e=e.replace(te[Z.BUILD],""),W("comp",e,t),e=yg(e,t),W("caret",e),e=hg(e,t),W("tildes",e),e=wg(e,t),W("xrange",e),e=Sg(e,t),W("stars",e),e),G=(e)=>!e||e.toLowerCase()==="x"||e==="*",pg=(e,t,r)=>G(e)&&!G(t)||G(t)&&r&&!G(r),hg=(e,t)=>e.trim().split(/\s+/).map((r)=>mg(r,t)).join(" "),mg=(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})},yg=(e,t)=>e.trim().split(/\s+/).map((r)=>gg(r,t)).join(" "),gg=(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})},wg=(e,t)=>(W("replaceXRanges",e,t),e.split(/\s+/).map((r)=>Eg(r,t)).join(" ")),Eg=(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),pg(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})},Sg=(e,t)=>(W("replaceStars",e,t),e.trim().replace(te[Z.STAR],"")),bg=(e,t)=>(W("replaceGTE0",e,t),e.trim().replace(te[t.includePrerelease?Z.GTE0PRE:Z.GTE0],"")),vg=(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()},Ag=(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===Qi.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(nT,fu){var ir=Symbol("SemVer ANY");class on{static get ANY(){return ir}constructor(e,t){if(t=ou(t),e instanceof on)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),to("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;to("comp",this)}parse(e){let t=this.options.loose?su[au.COMPARATORLOOSE]:su[au.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 cu(r[2],this.options.loose)}toString(){return this.value}test(e){if(to("Comparator.test",e,this.options.loose),this.semver===ir||e===ir)return!0;if(typeof e==="string")try{e=new cu(e,this.options)}catch(t){return!1}return eo(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 uu(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new uu(this.value,t).test(e.semver)}if(t=ou(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(eo(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(eo(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}fu.exports=on;var ou=Gr(),{safeRe:su,t:au}=Et(),eo=Zi(),to=er(),cu=Y(),uu=ue()});var or=m(function(iT,lu){var xg=ue(),Tg=(e,t,r)=>{try{t=new xg(t,r)}catch(n){return!1}return t.test(e)};lu.exports=Tg});var pu=m(function(oT,du){var Cg=ue(),Ig=(e,t)=>new Cg(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));du.exports=Ig});var mu=m(function(sT,hu){var Rg=Y(),Og=ue(),kg=(e,t,r)=>{let n=null,i=null,o=null;try{o=new Og(t,r)}catch(s){return null}return e.forEach((s)=>{if(o.test(s)){if(!n||i.compare(s)===-1)n=s,i=new Rg(n,r)}}),n};hu.exports=kg});var gu=m(function(aT,yu){var _g=Y(),Pg=ue(),Kg=(e,t,r)=>{let n=null,i=null,o=null;try{o=new Pg(t,r)}catch(s){return null}return e.forEach((s)=>{if(o.test(s)){if(!n||i.compare(s)===1)n=s,i=new _g(n,r)}}),n};yu.exports=Kg});var Su=m(function(cT,Eu){var ro=Y(),$g=ue(),wu=tr(),Ng=(e,t)=>{e=new $g(e,t);let r=new ro("0.0.0");if(e.test(r))return r;if(r=new ro("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 ro(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||wu(a,o))o=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${s.operator}`)}}),o&&(!r||wu(r,o)))r=o}if(r&&e.test(r))return r;return null};Eu.exports=Ng});var vu=m(function(uT,bu){var Lg=ue(),Jg=(e,t)=>{try{return new Lg(e,t).range||"*"}catch(r){return null}};bu.exports=Jg});var sn=m(function(fT,Cu){var Wg=Y(),Tu=nr(),{ANY:jg}=Tu,Dg=ue(),qg=or(),Au=tr(),xu=Qr(),Fg=tn(),Ug=en(),Hg=(e,t,r,n)=>{e=new Wg(e,n),t=new Dg(t,n);let i,o,s,a,f;switch(r){case">":i=Au,o=Fg,s=xu,a=">",f=">=";break;case"<":i=xu,o=Ug,s=Au,a="<",f="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(qg(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===jg)d=new Tu(">=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};Cu.exports=Hg});var Ru=m(function(lT,Iu){var Bg=sn(),Mg=(e,t,r)=>Bg(e,t,">",r);Iu.exports=Mg});var ku=m(function(dT,Ou){var Gg=sn(),zg=(e,t,r)=>Gg(e,t,"<",r);Ou.exports=zg});var Ku=m(function(pT,Pu){var _u=ue(),Vg=(e,t,r)=>(e=new _u(e,r),t=new _u(t,r),e.intersects(t,r));Pu.exports=Vg});var Nu=m(function(hT,$u){var Xg=or(),Yg=ce();$u.exports=(e,t,r)=>{let n=[],i=null,o=null,s=e.sort((u,l)=>Yg(u,l,r));for(let u of s)if(Xg(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 qu=m(function(mT,Du){var Lu=ue(),oo=nr(),{ANY:no}=oo,io=or(),so=ce(),Zg=(e,t,r={})=>{if(e===t)return!0;e=new Lu(e,r),t=new Lu(t,r);let n=!1;e:for(let i of e.set){for(let o of t.set){let s=ew(i,o,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},Qg=[new oo(">=0.0.0-0")],Ju=[new oo(">=0.0.0")],ew=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===no)if(t.length===1&&t[0].semver===no)return!0;else if(r.includePrerelease)e=Qg;else e=Ju;if(t.length===1&&t[0].semver===no)if(r.includePrerelease)return!0;else t=Ju;let n=new Set,i,o;for(let d of e)if(d.operator===">"||d.operator===">=")i=Wu(i,d,r);else if(d.operator==="<"||d.operator==="<=")o=ju(o,d,r);else n.add(d.semver);if(n.size>1)return null;let s;if(i&&o){if(s=so(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&&!io(d,String(i),r))return null;if(o&&!io(d,String(o),r))return null;for(let g of t)if(!io(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=Wu(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=ju(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},Wu=(e,t,r)=>{if(!e)return t;let n=so(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},ju=(e,t,r)=>{if(!e)return t;let n=so(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};Du.exports=Zg});var an=m(function(yT,Hu){var ao=Et(),Fu=wt(),tw=Y(),Uu=zi(),rw=$e(),nw=dc(),iw=hc(),ow=gc(),sw=Sc(),aw=vc(),cw=xc(),uw=Cc(),fw=Rc(),lw=ce(),dw=Pc(),pw=$c(),hw=Zr(),mw=Wc(),yw=Dc(),gw=tr(),ww=Qr(),Ew=Xi(),Sw=Yi(),bw=en(),vw=tn(),Aw=Zi(),xw=Vc(),Tw=Yc(),Cw=nr(),Iw=ue(),Rw=or(),Ow=pu(),kw=mu(),_w=gu(),Pw=Su(),Kw=vu(),$w=sn(),Nw=Ru(),Lw=ku(),Jw=Ku(),Ww=Nu(),jw=qu();Hu.exports={parse:rw,valid:nw,clean:iw,inc:ow,diff:sw,major:aw,minor:cw,patch:uw,prerelease:fw,compare:lw,rcompare:dw,compareLoose:pw,compareBuild:hw,sort:mw,rsort:yw,gt:gw,lt:ww,eq:Ew,neq:Sw,gte:bw,lte:vw,cmp:Aw,coerce:xw,truncate:Tw,Comparator:Cw,Range:Iw,satisfies:Rw,toComparators:Ow,maxSatisfying:kw,minSatisfying:_w,minVersion:Pw,validRange:Kw,outside:$w,gtr:Nw,ltr:Lw,intersects:Jw,simplifyRange:Ww,subset:jw,SemVer:tw,re:ao.re,src:ao.src,tokens:ao.t,SEMVER_SPEC_VERSION:Fu.SEMVER_SPEC_VERSION,RELEASE_TYPES:Fu.RELEASE_TYPES,compareIdentifiers:Uu.compareIdentifiers,rcompareIdentifiers:Uu.rcompareIdentifiers}});var Mu=m(function(gT,Bu){var Dw=an();Bu.exports=Dw.satisfies(process.version,">=15.7.0")});var zu=m(function(wT,Gu){var qw=an();Gu.exports=qw.satisfies(process.version,">=16.9.0")});var co=m(function(ET,Vu){var Fw=Mu(),Uw=zu(),Hw={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},Bw={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};Vu.exports=function(e,t){if(!e||!t)return;let r=t.asymmetricKeyType;if(!r)return;let n=Hw[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(Fw)switch(r){case"ec":let i=t.asymmetricKeyDetails.namedCurve,o=Bw[e];if(i!==o)throw Error(`"alg" parameter "${e}" requires curve "${o}".`);break;case"rsa-pss":if(Uw){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 uo=m(function(ST,Xu){var Mw=an();Xu.exports=Mw.satisfies(process.version,"^6.12.0 || >=8.0.0")});var Qu=m(function(bT,Zu){var L=Qt(),Gw=Fi(),Yu=Ui(),zw=qi(),Vw=Bi(),Xw=co(),Yw=uo(),Zw=Fr(),{KeyObject:Qw,createSecretKey:eE,createPublicKey:tE}=require("crypto"),fo=["RS256","RS384","RS512"],rE=["ES256","ES384","ES512"],lo=["RS256","RS384","RS512"],nE=["HS256","HS384","HS512"];if(Yw)fo.splice(fo.length,0,"PS256","PS384","PS512"),lo.splice(lo.length,0,"PS256","PS384","PS512");Zu.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=zw(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 Qw))try{l=tE(l)}catch(h){try{l=eE(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=nE;else if(["rsa","rsa-pss"].includes(l.asymmetricKeyType))r.algorithms=lo;else if(l.asymmetricKeyType==="ec")r.algorithms=rE;else r.algorithms=fo;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{Xw(f.alg,l)}catch(h){return i(h)}let d;try{d=Zw.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 Gw("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 Yu("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=Vw(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 Yu("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 sf=m(function(vT,of){var ef=1/0,rf=9007199254740991,iE=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,tf=NaN,oE="[object Arguments]",sE="[object Function]",aE="[object GeneratorFunction]",cE="[object String]",uE="[object Symbol]",fE=/^\s+|\s+$/g,lE=/^[-+]0x[0-9a-f]+$/i,dE=/^0b[01]+$/i,pE=/^0o[0-7]+$/i,hE=/^(?:0|[1-9]\d*)$/,mE=parseInt;function yE(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 gE(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 wE(e,t,r){if(t!==t)return gE(e,EE,r);var n=r-1,i=e.length;while(++n<i)if(e[n]===t)return n;return-1}function EE(e){return e!==e}function SE(e,t){var r=-1,n=Array(e);while(++r<e)n[r]=t(r);return n}function bE(e,t){return yE(t,function(r){return e[r]})}function vE(e,t){return function(r){return e(t(r))}}var cn=Object.prototype,ho=cn.hasOwnProperty,un=cn.toString,AE=cn.propertyIsEnumerable,xE=vE(Object.keys,Object),TE=Math.max;function CE(e,t){var r=nf(e)||_E(e)?SE(e.length,String):[],n=r.length,i=!!n;for(var o in e)if((t||ho.call(e,o))&&!(i&&(o=="length"||RE(o,n))))r.push(o);return r}function IE(e){if(!OE(e))return xE(e);var t=[];for(var r in Object(e))if(ho.call(e,r)&&r!="constructor")t.push(r);return t}function RE(e,t){return t=t==null?rf:t,!!t&&(typeof e=="number"||hE.test(e))&&(e>-1&&e%1==0&&e<t)}function OE(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||cn;return e===r}function kE(e,t,r,n){e=mo(e)?e:qE(e),r=r&&!n?WE(r):0;var i=e.length;if(r<0)r=TE(i+r,0);return NE(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&wE(e,t,r)>-1}function _E(e){return PE(e)&&ho.call(e,"callee")&&(!AE.call(e,"callee")||un.call(e)==oE)}var nf=Array.isArray;function mo(e){return e!=null&&$E(e.length)&&!KE(e)}function PE(e){return yo(e)&&mo(e)}function KE(e){var t=po(e)?un.call(e):"";return t==sE||t==aE}function $E(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=rf}function po(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function yo(e){return!!e&&typeof e=="object"}function NE(e){return typeof e=="string"||!nf(e)&&yo(e)&&un.call(e)==cE}function LE(e){return typeof e=="symbol"||yo(e)&&un.call(e)==uE}function JE(e){if(!e)return e===0?e:0;if(e=jE(e),e===ef||e===-ef){var t=e<0?-1:1;return t*iE}return e===e?e:0}function WE(e){var t=JE(e),r=t%1;return t===t?r?t-r:t:0}function jE(e){if(typeof e=="number")return e;if(LE(e))return tf;if(po(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=po(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(fE,"");var r=dE.test(e);return r||pE.test(e)?mE(e.slice(2),r?2:8):lE.test(e)?tf:+e}function DE(e){return mo(e)?CE(e):IE(e)}function qE(e){return e?bE(e,DE(e)):[]}of.exports=kE});var cf=m(function(AT,af){var FE="[object Boolean]",UE=Object.prototype,HE=UE.toString;function BE(e){return e===!0||e===!1||ME(e)&&HE.call(e)==FE}function ME(e){return!!e&&typeof e=="object"}af.exports=BE});var pf=m(function(xT,df){var uf=1/0,GE=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,ff=NaN,zE="[object Symbol]",VE=/^\s+|\s+$/g,XE=/^[-+]0x[0-9a-f]+$/i,YE=/^0b[01]+$/i,ZE=/^0o[0-7]+$/i,QE=parseInt,eS=Object.prototype,tS=eS.toString;function rS(e){return typeof e=="number"&&e==sS(e)}function lf(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function nS(e){return!!e&&typeof e=="object"}function iS(e){return typeof e=="symbol"||nS(e)&&tS.call(e)==zE}function oS(e){if(!e)return e===0?e:0;if(e=aS(e),e===uf||e===-uf){var t=e<0?-1:1;return t*GE}return e===e?e:0}function sS(e){var t=oS(e),r=t%1;return t===t?r?t-r:t:0}function aS(e){if(typeof e=="number")return e;if(iS(e))return ff;if(lf(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=lf(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(VE,"");var r=YE.test(e);return r||ZE.test(e)?QE(e.slice(2),r?2:8):XE.test(e)?ff:+e}df.exports=rS});var mf=m(function(TT,hf){var cS="[object Number]",uS=Object.prototype,fS=uS.toString;function lS(e){return!!e&&typeof e=="object"}function dS(e){return typeof e=="number"||lS(e)&&fS.call(e)==cS}hf.exports=dS});var Ef=m(function(CT,wf){var pS="[object Object]";function hS(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function mS(e,t){return function(r){return e(t(r))}}var yS=Function.prototype,yf=Object.prototype,gf=yS.toString,gS=yf.hasOwnProperty,wS=gf.call(Object),ES=yf.toString,SS=mS(Object.getPrototypeOf,Object);function bS(e){return!!e&&typeof e=="object"}function vS(e){if(!bS(e)||ES.call(e)!=pS||hS(e))return!1;var t=SS(e);if(t===null)return!0;var r=gS.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&gf.call(r)==wS}wf.exports=vS});var bf=m(function(IT,Sf){var AS="[object String]",xS=Object.prototype,TS=xS.toString,CS=Array.isArray;function IS(e){return!!e&&typeof e=="object"}function RS(e){return typeof e=="string"||!CS(e)&&IS(e)&&TS.call(e)==AS}Sf.exports=RS});var Cf=m(function(RT,Tf){var OS="Expected a function",vf=1/0,kS=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,Af=NaN,_S="[object Symbol]",PS=/^\s+|\s+$/g,KS=/^[-+]0x[0-9a-f]+$/i,$S=/^0b[01]+$/i,NS=/^0o[0-7]+$/i,LS=parseInt,JS=Object.prototype,WS=JS.toString;function jS(e,t){var r;if(typeof t!="function")throw TypeError(OS);return e=HS(e),function(){if(--e>0)r=t.apply(this,arguments);if(e<=1)t=void 0;return r}}function DS(e){return jS(2,e)}function xf(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function qS(e){return!!e&&typeof e=="object"}function FS(e){return typeof e=="symbol"||qS(e)&&WS.call(e)==_S}function US(e){if(!e)return e===0?e:0;if(e=BS(e),e===vf||e===-vf){var t=e<0?-1:1;return t*kS}return e===e?e:0}function HS(e){var t=US(e),r=t%1;return t===t?r?t-r:t:0}function BS(e){if(typeof e=="number")return e;if(FS(e))return Af;if(xf(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=xf(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(PS,"");var r=$S.test(e);return r||NS.test(e)?LS(e.slice(2),r?2:8):KS.test(e)?Af:+e}Tf.exports=DS});var Nf=m(function(OT,$f){var If=Bi(),MS=uo(),GS=co(),Rf=Fr(),zS=sf(),fn=cf(),Of=pf(),go=mf(),_f=Ef(),Ne=bf(),VS=Cf(),{KeyObject:XS,createSecretKey:YS,createPrivateKey:ZS}=require("crypto"),Pf=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];if(MS)Pf.splice(3,0,"PS256","PS384","PS512");var QS={expiresIn:{isValid:function(e){return Of(e)||Ne(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return Of(e)||Ne(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return Ne(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:zS.bind(null,Pf),message:'"algorithm" must be a valid string enum value'},header:{isValid:_f,message:'"header" must be an object'},encoding:{isValid:Ne,message:'"encoding" must be a string'},issuer:{isValid:Ne,message:'"issuer" must be a string'},subject:{isValid:Ne,message:'"subject" must be a string'},jwtid:{isValid:Ne,message:'"jwtid" must be a string'},noTimestamp:{isValid:fn,message:'"noTimestamp" must be a boolean'},keyid:{isValid:Ne,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'}},eb={iat:{isValid:go,message:'"iat" should be a number of seconds'},exp:{isValid:go,message:'"exp" should be a number of seconds'},nbf:{isValid:go,message:'"nbf" should be a number of seconds'}};function Kf(e,t,r,n){if(!_f(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 tb(e){return Kf(QS,!1,e,"options")}function rb(e){return Kf(eb,!0,e,"payload")}var kf={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},nb=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];$f.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 XS))try{t=ZS(t)}catch(c){try{t=YS(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{rb(e)}catch(c){return s(c)}if(!r.mutatePayload)e=Object.assign({},e)}else{let c=nb.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{tb(r)}catch(c){return s(c)}if(!r.allowInvalidAsymmetricKeyTypes)try{GS(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=If(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=If(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(kf).forEach(function(c){let u=kf[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&&VS(n),Rf.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=Rf.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 Jf=m(function(kT,Lf){Lf.exports={decode:qi(),verify:Qu(),sign:Nf(),JsonWebTokenError:Qt(),NotBeforeError:Fi(),TokenExpiredError:Ui()}});var wo=m(function(_T,Wf){function ib(e){r.debug=r,r.default=r,r.coerce=f,r.disable=s,r.enable=i,r.enabled=a,r.humanize=Hi(),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,F)=>{if(j==="%%")return"%";I++;let V=r.formatters[F];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}Wf.exports=ib});var jf=m(function(ne,ln){ne.formatArgs=sb;ne.save=ab;ne.load=cb;ne.useColors=ob;ne.storage=ub();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 ob(){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 sb(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 ab(e){try{if(e)ne.storage.setItem("debug",e);else ne.storage.removeItem("debug")}catch(t){}}function cb(){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 ub(){try{return localStorage}catch(e){}}ln.exports=wo()(ne);var{formatters:fb}=ln.exports;fb.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var qf={};Vt(qf,{createSupportsColor:()=>So,default:()=>mb});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 lb(){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 db(e){if(e===0)return!1;return{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function pb(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=lb();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=Df.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 So(e,t={}){let r=pb(e,{streamIsTTY:e&&e.isTTY,...t});return db(r)}var pn,Df,Eo,D,dn,hb,mb;var Ff=x(()=>{pn=ut(require("node:process")),Df=ut(require("node:os")),Eo=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;hb={stdout:So({isTTY:Eo.default.isatty(1)}),stderr:So({isTTY:Eo.default.isatty(2)})},mb=hb});var Hf=m(function(X,mn){var yb=require("tty"),hn=require("util");X.init=Ab;X.log=Sb;X.formatArgs=wb;X.save=bb;X.load=vb;X.useColors=gb;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=(Ff(),kr(qf));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 gb(){return"colors"in X.inspectOpts?Boolean(X.inspectOpts.colors):yb.isatty(process.stderr.fd)}function wb(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
|
-
`+
|
|
6
|
-
`)}function
|
|
7
|
-
`).map((c)=>c.trim()).join(" ")};g_.O=function(t){return this.inspectOpts.colors=this.useColors,wu.inspect(t,this.inspectOpts)}});var Pu=K((UX,Rn)=>{if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)Rn.exports=x_();else Rn.exports=B_()});var Mn=K((Vn)=>{Object.defineProperty(Vn,"__esModule",{value:!0});var CS=require("crypto"),OS=(t,c)=>(0,CS.createHash)(t).update(c).digest();Vn.default=OS});var N=K((e)=>{Object.defineProperty(e,"__esModule",{value:!0});e.concatKdf=e.lengthAndInput=e.uint32be=e.uint64be=e.p2s=e.concat=e.decoder=e.encoder=void 0;var GS=Mn();e.encoder=new TextEncoder;e.decoder=new TextDecoder;var Au=4294967296;function Tn(...t){let c=t.reduce((n,{length:f})=>n+f,0),u=new Uint8Array(c),r=0;return t.forEach((n)=>{u.set(n,r),r+=n.length}),u}e.concat=Tn;function ZS(t,c){return Tn(e.encoder.encode(t),new Uint8Array([0]),c)}e.p2s=ZS;function Nn(t,c,u){if(c<0||c>=Au)throw RangeError(`value must be >= 0 and <= ${Au-1}. Received ${c}`);t.set([c>>>24,c>>>16,c>>>8,c&255],u)}function IS(t){let c=Math.floor(t/Au),u=t%Au,r=new Uint8Array(8);return Nn(r,c,0),Nn(r,u,4),r}e.uint64be=IS;function Dn(t){let c=new Uint8Array(4);return Nn(c,t),c}e.uint32be=Dn;function XS(t){return Tn(Dn(t.length),t)}e.lengthAndInput=XS;async function ES(t,c,u){let r=Math.ceil((c>>3)/32),n=new Uint8Array(r*32);for(let f=0;f<r;f++){let d=new Uint8Array(4+t.length+u.length);d.set(Dn(f+1)),d.set(t,4),d.set(u,4+t.length),n.set(await(0,GS.default)("sha256",d),f*32)}return n.slice(0,c>>3)}e.concatKdf=ES});var k=K((P1)=>{Object.defineProperty(P1,"__esModule",{value:!0});P1.decode=P1.encode=P1.encodeBase64=P1.decodeBase64=void 0;var Ht=require("buffer"),YS=N(),F_;function zS(t){let c=t;if(c instanceof Uint8Array)c=YS.decoder.decode(c);return c}if(Ht.Buffer.isEncoding("base64url"))P1.encode=F_=(t)=>Ht.Buffer.from(t).toString("base64url");else P1.encode=F_=(t)=>Ht.Buffer.from(t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");var RS=(t)=>Ht.Buffer.from(t,"base64");P1.decodeBase64=RS;var iS=(t)=>Ht.Buffer.from(t).toString("base64");P1.encodeBase64=iS;var VS=(t)=>Ht.Buffer.from(zS(t),"base64");P1.decode=VS});var C=K((X)=>{Object.defineProperty(X,"__esModule",{value:!0});X.JWSSignatureVerificationFailed=X.JWKSTimeout=X.JWKSMultipleMatchingKeys=X.JWKSNoMatchingKey=X.JWKSInvalid=X.JWKInvalid=X.JWTInvalid=X.JWSInvalid=X.JWEInvalid=X.JWEDecompressionFailed=X.JWEDecryptionFailed=X.JOSENotSupported=X.JOSEAlgNotAllowed=X.JWTExpired=X.JWTClaimValidationFailed=X.JOSEError=void 0;class m extends Error{static get code(){return"ERR_JOSE_GENERIC"}constructor(t){var c;super(t);this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,(c=Error.captureStackTrace)===null||c===void 0||c.call(Error,this,this.constructor)}}X.JOSEError=m;class k_ extends m{static get code(){return"ERR_JWT_CLAIM_VALIDATION_FAILED"}constructor(t,c="unspecified",u="unspecified"){super(t);this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=c,this.reason=u}}X.JWTClaimValidationFailed=k_;class U_ extends m{static get code(){return"ERR_JWT_EXPIRED"}constructor(t,c="unspecified",u="unspecified"){super(t);this.code="ERR_JWT_EXPIRED",this.claim=c,this.reason=u}}X.JWTExpired=U_;class o_ extends m{constructor(){super(...arguments);this.code="ERR_JOSE_ALG_NOT_ALLOWED"}static get code(){return"ERR_JOSE_ALG_NOT_ALLOWED"}}X.JOSEAlgNotAllowed=o_;class l_ extends m{constructor(){super(...arguments);this.code="ERR_JOSE_NOT_SUPPORTED"}static get code(){return"ERR_JOSE_NOT_SUPPORTED"}}X.JOSENotSupported=l_;class Q_ extends m{constructor(){super(...arguments);this.code="ERR_JWE_DECRYPTION_FAILED",this.message="decryption operation failed"}static get code(){return"ERR_JWE_DECRYPTION_FAILED"}}X.JWEDecryptionFailed=Q_;class a_ extends m{constructor(){super(...arguments);this.code="ERR_JWE_DECOMPRESSION_FAILED",this.message="decompression operation failed"}static get code(){return"ERR_JWE_DECOMPRESSION_FAILED"}}X.JWEDecompressionFailed=a_;class t6 extends m{constructor(){super(...arguments);this.code="ERR_JWE_INVALID"}static get code(){return"ERR_JWE_INVALID"}}X.JWEInvalid=t6;class c6 extends m{constructor(){super(...arguments);this.code="ERR_JWS_INVALID"}static get code(){return"ERR_JWS_INVALID"}}X.JWSInvalid=c6;class u6 extends m{constructor(){super(...arguments);this.code="ERR_JWT_INVALID"}static get code(){return"ERR_JWT_INVALID"}}X.JWTInvalid=u6;class r6 extends m{constructor(){super(...arguments);this.code="ERR_JWK_INVALID"}static get code(){return"ERR_JWK_INVALID"}}X.JWKInvalid=r6;class n6 extends m{constructor(){super(...arguments);this.code="ERR_JWKS_INVALID"}static get code(){return"ERR_JWKS_INVALID"}}X.JWKSInvalid=n6;class f6 extends m{constructor(){super(...arguments);this.code="ERR_JWKS_NO_MATCHING_KEY",this.message="no applicable key found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_NO_MATCHING_KEY"}}X.JWKSNoMatchingKey=f6;class d6 extends m{constructor(){super(...arguments);this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS",this.message="multiple matching keys found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}X.JWKSMultipleMatchingKeys=d6;class h6 extends m{constructor(){super(...arguments);this.code="ERR_JWKS_TIMEOUT",this.message="request timed out"}static get code(){return"ERR_JWKS_TIMEOUT"}}X.JWKSTimeout=h6;class q6 extends m{constructor(){super(...arguments);this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",this.message="signature verification failed"}static get code(){return"ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}X.JWSSignatureVerificationFailed=q6});var rc=K((Su)=>{Object.defineProperty(Su,"__esModule",{value:!0});Su.default=void 0;var MS=require("crypto");Object.defineProperty(Su,"default",{enumerable:!0,get:function(){return MS.randomFillSync}})});var yu=K((nc)=>{Object.defineProperty(nc,"__esModule",{value:!0});nc.bitLength=void 0;var NS=C(),TS=rc();function _6(t){switch(t){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new NS.JOSENotSupported(`Unsupported JWE Algorithm: ${t}`)}}nc.bitLength=_6;nc.default=(t)=>(0,TS.default)(new Uint8Array(_6(t)>>3))});var en=K((bn)=>{Object.defineProperty(bn,"__esModule",{value:!0});var DS=C(),bS=yu(),eS=(t,c)=>{if(c.length<<3!==(0,bS.bitLength)(t))throw new DS.JWEInvalid("Invalid Initialization Vector length")};bn.default=eS});var d1=K((jn)=>{Object.defineProperty(jn,"__esModule",{value:!0});var jS=require("crypto"),K6=require("util");jn.default=K6.types.isKeyObject?(t)=>K6.types.isKeyObject(t):(t)=>t!=null&&t instanceof jS.KeyObject});var xn=K((vn)=>{Object.defineProperty(vn,"__esModule",{value:!0});var pn=C(),pS=d1(),vS=(t,c)=>{let u;switch(t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":u=parseInt(t.slice(-3),10);break;case"A128GCM":case"A192GCM":case"A256GCM":u=parseInt(t.slice(1,4),10);break;default:throw new pn.JOSENotSupported(`Content Encryption Algorithm ${t} is not supported either by JOSE or your javascript runtime`)}if(c instanceof Uint8Array){let r=c.byteLength<<3;if(r!==u)throw new pn.JWEInvalid(`Invalid Content Encryption Key length. Expected ${u} bits, got ${r} bits`);return}if((0,pS.default)(c)&&c.type==="secret"){let r=c.symmetricKeySize<<3;if(r!==u)throw new pn.JWEInvalid(`Invalid Content Encryption Key length. Expected ${u} bits, got ${r} bits`);return}throw TypeError("Invalid Content Encryption Key type")};vn.default=vS});var W6=K((Ln)=>{Object.defineProperty(Ln,"__esModule",{value:!0});var xS=require("crypto"),LS=xS.timingSafeEqual;Ln.default=LS});var mn=K((sn)=>{Object.defineProperty(sn,"__esModule",{value:!0});var sS=require("crypto"),J6=N();function mS(t,c,u,r,n,f){let d=(0,J6.concat)(t,c,u,(0,J6.uint64be)(t.length<<3)),h=(0,sS.createHmac)(`sha${r}`,n);return h.update(d),h.digest().slice(0,f>>3)}sn.default=mS});var h1=K((fc)=>{Object.defineProperty(fc,"__esModule",{value:!0});fc.isCryptoKey=void 0;var gS=require("crypto"),w6=require("util"),BS=gS.webcrypto;fc.default=BS;fc.isCryptoKey=w6.types.isCryptoKey?(t)=>w6.types.isCryptoKey(t):(t)=>!1});var j1=K((Ct)=>{Object.defineProperty(Ct,"__esModule",{value:!0});Ct.checkEncCryptoKey=Ct.checkSigCryptoKey=void 0;function g(t,c="algorithm.name"){return TypeError(`CryptoKey does not support this operation, its ${c} must be ${t}`)}function e1(t,c){return t.name===c}function Hu(t){return parseInt(t.name.slice(4),10)}function FS(t){switch(t){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}function $6(t,c){if(c.length&&!c.some((u)=>t.usages.includes(u))){let u="CryptoKey does not support this operation, its usages must include ";if(c.length>2){let r=c.pop();u+=`one of ${c.join(", ")}, or ${r}.`}else if(c.length===2)u+=`one of ${c[0]} or ${c[1]}.`;else u+=`${c[0]}.`;throw TypeError(u)}}function kS(t,c,...u){switch(c){case"HS256":case"HS384":case"HS512":{if(!e1(t.algorithm,"HMAC"))throw g("HMAC");let r=parseInt(c.slice(2),10);if(Hu(t.algorithm.hash)!==r)throw g(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!e1(t.algorithm,"RSASSA-PKCS1-v1_5"))throw g("RSASSA-PKCS1-v1_5");let r=parseInt(c.slice(2),10);if(Hu(t.algorithm.hash)!==r)throw g(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!e1(t.algorithm,"RSA-PSS"))throw g("RSA-PSS");let r=parseInt(c.slice(2),10);if(Hu(t.algorithm.hash)!==r)throw g(`SHA-${r}`,"algorithm.hash");break}case"EdDSA":{if(t.algorithm.name!=="Ed25519"&&t.algorithm.name!=="Ed448")throw g("Ed25519 or Ed448");break}case"ES256":case"ES384":case"ES512":{if(!e1(t.algorithm,"ECDSA"))throw g("ECDSA");let r=FS(c);if(t.algorithm.namedCurve!==r)throw g(r,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}$6(t,u)}Ct.checkSigCryptoKey=kS;function US(t,c,...u){switch(c){case"A128GCM":case"A192GCM":case"A256GCM":{if(!e1(t.algorithm,"AES-GCM"))throw g("AES-GCM");let r=parseInt(c.slice(1,4),10);if(t.algorithm.length!==r)throw g(r,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!e1(t.algorithm,"AES-KW"))throw g("AES-KW");let r=parseInt(c.slice(1,4),10);if(t.algorithm.length!==r)throw g(r,"algorithm.length");break}case"ECDH":{switch(t.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw g("ECDH, X25519, or X448")}break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!e1(t.algorithm,"PBKDF2"))throw g("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!e1(t.algorithm,"RSA-OAEP"))throw g("RSA-OAEP");let r=parseInt(c.slice(9),10)||1;if(Hu(t.algorithm.hash)!==r)throw g(`SHA-${r}`,"algorithm.hash");break}default:throw TypeError("CryptoKey does not support this operation")}$6(t,u)}Ct.checkEncCryptoKey=US});var q1=K((dc)=>{Object.defineProperty(dc,"__esModule",{value:!0});dc.withAlg=void 0;function P6(t,c,...u){if(u.length>2){let r=u.pop();t+=`one of type ${u.join(", ")}, or ${r}.`}else if(u.length===2)t+=`one of type ${u[0]} or ${u[1]}.`;else t+=`of type ${u[0]}.`;if(c==null)t+=` Received ${c}`;else if(typeof c==="function"&&c.name)t+=` Received function ${c.name}`;else if(typeof c==="object"&&c!=null){if(c.constructor&&c.constructor.name)t+=` Received an instance of ${c.constructor.name}`}return t}dc.default=(t,...c)=>{return P6("Key must be ",t,...c)};function oS(t,c,...u){return P6(`Key for the ${t} algorithm must be `,c,...u)}dc.withAlg=oS});var Cu=K((Bn)=>{Object.defineProperty(Bn,"__esModule",{value:!0});var lS=require("crypto"),gn;Bn.default=(t)=>{return gn||(gn=new Set((0,lS.getCiphers)())),gn.has(t)}});var _1=K((hc)=>{Object.defineProperty(hc,"__esModule",{value:!0});hc.types=void 0;var Ou=h1(),QS=d1();hc.default=(t)=>(0,QS.default)(t)||(0,Ou.isCryptoKey)(t);var A6=["KeyObject"];hc.types=A6;if(globalThis.CryptoKey||(Ou.default===null||Ou.default===void 0?void 0:Ou.default.CryptoKey))A6.push("CryptoKey")});var Un=K((kn)=>{Object.defineProperty(kn,"__esModule",{value:!0});var Fn=require("crypto"),aS=en(),t3=xn(),c3=N(),Ot=C(),u3=W6(),r3=mn(),n3=h1(),f3=j1(),S6=d1(),d3=q1(),y6=Cu(),h3=_1();function q3(t,c,u,r,n,f){let d=parseInt(t.slice(1,4),10);if((0,S6.default)(c))c=c.export();let h=c.subarray(d>>3),_=c.subarray(0,d>>3),q=parseInt(t.slice(-3),10),W=`aes-${d}-cbc`;if(!(0,y6.default)(W))throw new Ot.JOSENotSupported(`alg ${t} is not supported by your javascript runtime`);let J=(0,r3.default)(f,r,u,q,_,d),$;try{$=(0,u3.default)(n,J)}catch{}if(!$)throw new Ot.JWEDecryptionFailed;let w;try{let P=(0,Fn.createDecipheriv)(W,h,r);w=(0,c3.concat)(P.update(u),P.final())}catch{}if(!w)throw new Ot.JWEDecryptionFailed;return w}function _3(t,c,u,r,n,f){let h=`aes-${parseInt(t.slice(1,4),10)}-gcm`;if(!(0,y6.default)(h))throw new Ot.JOSENotSupported(`alg ${t} is not supported by your javascript runtime`);try{let _=(0,Fn.createDecipheriv)(h,c,r,{authTagLength:16});if(_.setAuthTag(n),f.byteLength)_.setAAD(f,{plaintextLength:u.length});let q=_.update(u);return _.final(),q}catch{throw new Ot.JWEDecryptionFailed}}var K3=(t,c,u,r,n,f)=>{let d;if((0,n3.isCryptoKey)(c))(0,f3.checkEncCryptoKey)(c,t,"decrypt"),d=Fn.KeyObject.from(c);else if(c instanceof Uint8Array||(0,S6.default)(c))d=c;else throw TypeError((0,d3.default)(c,...h3.types,"Uint8Array"));switch((0,t3.default)(t,d),(0,aS.default)(t,r),t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return q3(t,d,u,r,n,f);case"A128GCM":case"A192GCM":case"A256GCM":return _3(t,d,u,r,n,f);default:throw new Ot.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}};kn.default=K3});var on=K((Gt)=>{Object.defineProperty(Gt,"__esModule",{value:!0});Gt.deflate=Gt.inflate=void 0;var H6=require("util"),C6=require("zlib"),W3=C(),J3=(0,H6.promisify)(C6.inflateRaw),w3=(0,H6.promisify)(C6.deflateRaw),$3=(t)=>J3(t,{maxOutputLength:250000}).catch(()=>{throw new W3.JWEDecompressionFailed});Gt.inflate=$3;var P3=(t)=>w3(t);Gt.deflate=P3});var Zt=K((ln)=>{Object.defineProperty(ln,"__esModule",{value:!0});var A3=(...t)=>{let c=t.filter(Boolean);if(c.length===0||c.length===1)return!0;let u;for(let r of c){let n=Object.keys(r);if(!u||u.size===0){u=new Set(n);continue}for(let f of n){if(u.has(f))return!1;u.add(f)}}return!0};ln.default=A3});var l=K((Qn)=>{Object.defineProperty(Qn,"__esModule",{value:!0});function S3(t){return typeof t==="object"&&t!==null}function y3(t){if(!S3(t)||Object.prototype.toString.call(t)!=="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let c=t;while(Object.getPrototypeOf(c)!==null)c=Object.getPrototypeOf(c);return Object.getPrototypeOf(t)===c}Qn.default=y3});var Zu=K((It)=>{Object.defineProperty(It,"__esModule",{value:!0});It.unwrap=It.wrap=void 0;var O6=require("buffer"),Gu=require("crypto"),G6=C(),Z6=N(),H3=h1(),C3=j1(),O3=d1(),G3=q1(),I6=Cu(),Z3=_1();function X6(t,c){if(t.symmetricKeySize<<3!==parseInt(c.slice(1,4),10))throw TypeError(`Invalid key size for alg: ${c}`)}function E6(t,c,u){if((0,O3.default)(t))return t;if(t instanceof Uint8Array)return(0,Gu.createSecretKey)(t);if((0,H3.isCryptoKey)(t))return(0,C3.checkEncCryptoKey)(t,c,u),Gu.KeyObject.from(t);throw TypeError((0,G3.default)(t,...Z3.types,"Uint8Array"))}var I3=(t,c,u)=>{let n=`aes${parseInt(t.slice(1,4),10)}-wrap`;if(!(0,I6.default)(n))throw new G6.JOSENotSupported(`alg ${t} is not supported either by JOSE or your javascript runtime`);let f=E6(c,t,"wrapKey");X6(f,t);let d=(0,Gu.createCipheriv)(n,f,O6.Buffer.alloc(8,166));return(0,Z6.concat)(d.update(u),d.final())};It.wrap=I3;var X3=(t,c,u)=>{let n=`aes${parseInt(t.slice(1,4),10)}-wrap`;if(!(0,I6.default)(n))throw new G6.JOSENotSupported(`alg ${t} is not supported either by JOSE or your javascript runtime`);let f=E6(c,t,"unwrapKey");X6(f,t);let d=(0,Gu.createDecipheriv)(n,f,O6.Buffer.alloc(8,166));return(0,Z6.concat)(d.update(u),d.final())};It.unwrap=X3});var qc=K((A1)=>{Object.defineProperty(A1,"__esModule",{value:!0});A1.setCurve=A1.weakMap=void 0;var Iu=require("buffer"),Y6=require("crypto"),z6=C(),E3=h1(),Y3=d1(),z3=q1(),R3=_1(),i3=Iu.Buffer.from([42,134,72,206,61,3,1,7]),V3=Iu.Buffer.from([43,129,4,0,34]),M3=Iu.Buffer.from([43,129,4,0,35]),N3=Iu.Buffer.from([43,129,4,0,10]);A1.weakMap=new WeakMap;var T3=(t)=>{switch(t){case"prime256v1":return"P-256";case"secp384r1":return"P-384";case"secp521r1":return"P-521";case"secp256k1":return"secp256k1";default:throw new z6.JOSENotSupported("Unsupported key curve for this operation")}},R6=(t,c)=>{var u;let r;if((0,E3.isCryptoKey)(t))r=Y6.KeyObject.from(t);else if((0,Y3.default)(t))r=t;else throw TypeError((0,z3.default)(t,...R3.types));if(r.type==="secret")throw TypeError('only "private" or "public" type keys can be used for this operation');switch(r.asymmetricKeyType){case"ed25519":case"ed448":return`Ed${r.asymmetricKeyType.slice(2)}`;case"x25519":case"x448":return`X${r.asymmetricKeyType.slice(1)}`;case"ec":{if(A1.weakMap.has(r))return A1.weakMap.get(r);let n=(u=r.asymmetricKeyDetails)===null||u===void 0?void 0:u.namedCurve;if(!n&&r.type==="private")n=R6((0,Y6.createPublicKey)(r),!0);else if(!n){let d=r.export({format:"der",type:"spki"}),h=d[1]<128?14:15,_=d[h],q=d.slice(h+1,h+1+_);if(q.equals(i3))n="prime256v1";else if(q.equals(V3))n="secp384r1";else if(q.equals(M3))n="secp521r1";else if(q.equals(N3))n="secp256k1";else throw new z6.JOSENotSupported("Unsupported key curve for this operation")}if(c)return n;let f=T3(n);return A1.weakMap.set(r,f),f}default:throw TypeError("Invalid asymmetric key type for this operation")}};function D3(t,c){A1.weakMap.set(t,c)}A1.setCurve=D3;A1.default=R6});var nf=K((p1)=>{Object.defineProperty(p1,"__esModule",{value:!0});p1.ecdhAllowed=p1.generateEpk=p1.deriveKey=void 0;var _c=require("crypto"),b3=require("util"),V6=qc(),o1=N(),e3=C(),tf=h1(),i6=j1(),cf=d1(),uf=q1(),rf=_1(),an=(0,b3.promisify)(_c.generateKeyPair);async function j3(t,c,u,r,n=new Uint8Array(0),f=new Uint8Array(0)){let d;if((0,tf.isCryptoKey)(t))(0,i6.checkEncCryptoKey)(t,"ECDH"),d=_c.KeyObject.from(t);else if((0,cf.default)(t))d=t;else throw TypeError((0,uf.default)(t,...rf.types));let h;if((0,tf.isCryptoKey)(c))(0,i6.checkEncCryptoKey)(c,"ECDH","deriveBits"),h=_c.KeyObject.from(c);else if((0,cf.default)(c))h=c;else throw TypeError((0,uf.default)(c,...rf.types));let _=(0,o1.concat)((0,o1.lengthAndInput)(o1.encoder.encode(u)),(0,o1.lengthAndInput)(n),(0,o1.lengthAndInput)(f),(0,o1.uint32be)(r)),q=(0,_c.diffieHellman)({privateKey:h,publicKey:d});return(0,o1.concatKdf)(q,r,_)}p1.deriveKey=j3;async function p3(t){let c;if((0,tf.isCryptoKey)(t))c=_c.KeyObject.from(t);else if((0,cf.default)(t))c=t;else throw TypeError((0,uf.default)(t,...rf.types));switch(c.asymmetricKeyType){case"x25519":return an("x25519");case"x448":return an("x448");case"ec":{let u=(0,V6.default)(c);return an("ec",{namedCurve:u})}default:throw new e3.JOSENotSupported("Invalid or unsupported EPK")}}p1.generateEpk=p3;var v3=(t)=>["P-256","P-384","P-521","X25519","X448"].includes((0,V6.default)(t));p1.ecdhAllowed=v3});var M6=K((ff)=>{Object.defineProperty(ff,"__esModule",{value:!0});var x3=C();function L3(t){if(!(t instanceof Uint8Array)||t.length<8)throw new x3.JWEInvalid("PBES2 Salt Input must be 8 or more octets")}ff.default=L3});var df=K((Xt)=>{Object.defineProperty(Xt,"__esModule",{value:!0});Xt.decrypt=Xt.encrypt=void 0;var s3=require("util"),N6=require("crypto"),m3=rc(),T6=N(),g3=k(),D6=Zu(),b6=M6(),B3=h1(),F3=j1(),k3=d1(),U3=q1(),o3=_1(),e6=(0,s3.promisify)(N6.pbkdf2);function j6(t,c){if((0,k3.default)(t))return t.export();if(t instanceof Uint8Array)return t;if((0,B3.isCryptoKey)(t))return(0,F3.checkEncCryptoKey)(t,c,"deriveBits","deriveKey"),N6.KeyObject.from(t).export();throw TypeError((0,U3.default)(t,...o3.types,"Uint8Array"))}var l3=async(t,c,u,r=2048,n=(0,m3.default)(new Uint8Array(16)))=>{(0,b6.default)(n);let f=(0,T6.p2s)(t,n),d=parseInt(t.slice(13,16),10)>>3,h=j6(c,t),_=await e6(h,f,r,d,`sha${t.slice(8,11)}`);return{encryptedKey:await(0,D6.wrap)(t.slice(-6),_,u),p2c:r,p2s:(0,g3.encode)(n)}};Xt.encrypt=l3;var Q3=async(t,c,u,r,n)=>{(0,b6.default)(n);let f=(0,T6.p2s)(t,n),d=parseInt(t.slice(13,16),10)>>3,h=j6(c,t),_=await e6(h,f,r,d,`sha${t.slice(8,11)}`);return(0,D6.unwrap)(t.slice(-6),_,u)};Xt.decrypt=Q3});var Kc=K((S1)=>{Object.defineProperty(S1,"__esModule",{value:!0});S1.setModulusLength=S1.weakMap=void 0;S1.weakMap=new WeakMap;var Xu=(t,c)=>{let u=t.readUInt8(1);if((u&128)===0){if(c===0)return u;return Xu(t.subarray(2+u),c-1)}let r=u&127;u=0;for(let n=0;n<r;n++){u<<=8;let f=t.readUInt8(2+n);u|=f}if(c===0)return u;return Xu(t.subarray(2+u),c-1)},a3=(t,c)=>{let u=t.readUInt8(1);if((u&128)===0)return Xu(t.subarray(2),c);let r=u&127;return Xu(t.subarray(2+r),c)},t9=(t)=>{var c,u;if(S1.weakMap.has(t))return S1.weakMap.get(t);let r=(u=(c=t.asymmetricKeyDetails)===null||c===void 0?void 0:c.modulusLength)!==null&&u!==void 0?u:a3(t.export({format:"der",type:"pkcs1"}),t.type==="private"?1:0)-1<<3;return S1.weakMap.set(t,r),r},c9=(t,c)=>{S1.weakMap.set(t,c)};S1.setModulusLength=c9;S1.default=(t,c)=>{if(t9(t)<2048)throw TypeError(`${c} requires key modulusLength to be 2048 bits or larger`)}});var hf=K((Et)=>{Object.defineProperty(Et,"__esModule",{value:!0});Et.decrypt=Et.encrypt=void 0;var Wc=require("crypto"),u9=Kc(),r9=h1(),n9=j1(),f9=d1(),d9=q1(),h9=_1(),p6=(t,c)=>{if(t.asymmetricKeyType!=="rsa")throw TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");(0,u9.default)(t,c)},v6=(t)=>{switch(t){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return Wc.constants.RSA_PKCS1_OAEP_PADDING;case"RSA1_5":return Wc.constants.RSA_PKCS1_PADDING;default:return}},x6=(t)=>{switch(t){case"RSA-OAEP":return"sha1";case"RSA-OAEP-256":return"sha256";case"RSA-OAEP-384":return"sha384";case"RSA-OAEP-512":return"sha512";default:return}};function L6(t,c,...u){if((0,f9.default)(t))return t;if((0,r9.isCryptoKey)(t))return(0,n9.checkEncCryptoKey)(t,c,...u),Wc.KeyObject.from(t);throw TypeError((0,d9.default)(t,...h9.types))}var q9=(t,c,u)=>{let r=v6(t),n=x6(t),f=L6(c,t,"wrapKey","encrypt");return p6(f,t),(0,Wc.publicEncrypt)({key:f,oaepHash:n,padding:r},u)};Et.encrypt=q9;var _9=(t,c,u)=>{let r=v6(t),n=x6(t),f=L6(c,t,"unwrapKey","decrypt");return p6(f,t),(0,Wc.privateDecrypt)({key:f,oaepHash:n,padding:r},u)};Et.decrypt=_9});var wc=K((Jc)=>{Object.defineProperty(Jc,"__esModule",{value:!0});Jc.bitLength=void 0;var K9=C(),W9=rc();function s6(t){switch(t){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new K9.JOSENotSupported(`Unsupported JWE Algorithm: ${t}`)}}Jc.bitLength=s6;Jc.default=(t)=>(0,W9.default)(new Uint8Array(s6(t)>>3))});var Yu=K((K1)=>{Object.defineProperty(K1,"__esModule",{value:!0});K1.fromX509=K1.fromSPKI=K1.fromPKCS8=K1.toPKCS8=K1.toSPKI=void 0;var Eu=require("crypto"),m6=require("buffer"),J9=h1(),w9=d1(),$9=q1(),P9=_1(),g6=(t,c,u)=>{let r;if((0,J9.isCryptoKey)(u)){if(!u.extractable)throw TypeError("CryptoKey is not extractable");r=Eu.KeyObject.from(u)}else if((0,w9.default)(u))r=u;else throw TypeError((0,$9.default)(u,...P9.types));if(r.type!==t)throw TypeError(`key is not a ${t} key`);return r.export({format:"pem",type:c})},A9=(t)=>{return g6("public","spki",t)};K1.toSPKI=A9;var S9=(t)=>{return g6("private","pkcs8",t)};K1.toPKCS8=S9;var y9=(t)=>(0,Eu.createPrivateKey)({key:m6.Buffer.from(t.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,""),"base64"),type:"pkcs8",format:"der"});K1.fromPKCS8=y9;var H9=(t)=>(0,Eu.createPublicKey)({key:m6.Buffer.from(t.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,""),"base64"),type:"spki",format:"der"});K1.fromSPKI=H9;var C9=(t)=>(0,Eu.createPublicKey)({key:t,type:"spki",format:"pem"});K1.fromX509=C9});var F6=K((_f)=>{Object.defineProperty(_f,"__esModule",{value:!0});var D=require("buffer"),O9=C(),G9=2,Z9=3,I9=4,X9=48,qf=D.Buffer.from([0]),zu=D.Buffer.from([G9]),E9=D.Buffer.from([Z9]),Y9=D.Buffer.from([X9]),z9=D.Buffer.from([I9]),v1=(t)=>{if(t<128)return D.Buffer.from([t]);let c=D.Buffer.alloc(5);c.writeUInt32BE(t,1);let u=1;while(c[u]===0)u++;return c[u-1]=128|5-u,c.slice(u-1)},R9=new Map([["P-256",D.Buffer.from("06 08 2A 86 48 CE 3D 03 01 07".replace(/ /g,""),"hex")],["secp256k1",D.Buffer.from("06 05 2B 81 04 00 0A".replace(/ /g,""),"hex")],["P-384",D.Buffer.from("06 05 2B 81 04 00 22".replace(/ /g,""),"hex")],["P-521",D.Buffer.from("06 05 2B 81 04 00 23".replace(/ /g,""),"hex")],["ecPublicKey",D.Buffer.from("06 07 2A 86 48 CE 3D 02 01".replace(/ /g,""),"hex")],["X25519",D.Buffer.from("06 03 2B 65 6E".replace(/ /g,""),"hex")],["X448",D.Buffer.from("06 03 2B 65 6F".replace(/ /g,""),"hex")],["Ed25519",D.Buffer.from("06 03 2B 65 70".replace(/ /g,""),"hex")],["Ed448",D.Buffer.from("06 03 2B 65 71".replace(/ /g,""),"hex")]]);class B6{constructor(){this.length=0,this.elements=[]}oidFor(t){let c=R9.get(t);if(!c)throw new O9.JOSENotSupported("Invalid or unsupported OID");this.elements.push(c),this.length+=c.length}zero(){this.elements.push(zu,D.Buffer.from([1]),qf),this.length+=3}one(){this.elements.push(zu,D.Buffer.from([1]),D.Buffer.from([1])),this.length+=3}unsignedInteger(t){if(t[0]&128){let c=v1(t.length+1);this.elements.push(zu,c,qf,t),this.length+=2+c.length+t.length}else{let c=0;while(t[c]===0&&(t[c+1]&128)===0)c++;let u=v1(t.length-c);this.elements.push(zu,v1(t.length-c),t.slice(c)),this.length+=1+u.length+t.length-c}}octStr(t){let c=v1(t.length);this.elements.push(z9,v1(t.length),t),this.length+=1+c.length+t.length}bitStr(t){let c=v1(t.length+1);this.elements.push(E9,v1(t.length+1),qf,t),this.length+=1+c.length+t.length+1}add(t){this.elements.push(t),this.length+=t.length}end(t=Y9){let c=v1(this.length);return D.Buffer.concat([t,c,...this.elements],1+c.length+this.length)}}_f.default=B6});var $c=K((G1)=>{Object.defineProperty(G1,"__esModule",{value:!0});G1.jwkImport=G1.jwkExport=G1.rsaPssParams=G1.oneShotCallback=void 0;var[x1,Ru]=process.versions.node.split(".").map((t)=>parseInt(t,10));G1.oneShotCallback=x1>=16||x1===15&&Ru>=13;G1.rsaPssParams=!("electron"in process.versions)&&(x1>=17||x1===16&&Ru>=9);G1.jwkExport=x1>=16||x1===15&&Ru>=9;G1.jwkImport=x1>=16||x1===15&&Ru>=12});var U6=K((Kf)=>{Object.defineProperty(Kf,"__esModule",{value:!0});var v=require("buffer"),z1=require("crypto"),i9=k(),V9=C(),k6=qc(),M9=Kc(),y1=F6(),N9=$c(),T9=(t)=>{if(N9.jwkImport&&t.kty!=="oct")return t.d?(0,z1.createPrivateKey)({format:"jwk",key:t}):(0,z1.createPublicKey)({format:"jwk",key:t});switch(t.kty){case"oct":return(0,z1.createSecretKey)((0,i9.decode)(t.k));case"RSA":{let c=new y1.default,u=t.d!==void 0,r=v.Buffer.from(t.n,"base64"),n=v.Buffer.from(t.e,"base64");if(u)c.zero(),c.unsignedInteger(r),c.unsignedInteger(n),c.unsignedInteger(v.Buffer.from(t.d,"base64")),c.unsignedInteger(v.Buffer.from(t.p,"base64")),c.unsignedInteger(v.Buffer.from(t.q,"base64")),c.unsignedInteger(v.Buffer.from(t.dp,"base64")),c.unsignedInteger(v.Buffer.from(t.dq,"base64")),c.unsignedInteger(v.Buffer.from(t.qi,"base64"));else c.unsignedInteger(r),c.unsignedInteger(n);let d={key:c.end(),format:"der",type:"pkcs1"},h=u?(0,z1.createPrivateKey)(d):(0,z1.createPublicKey)(d);return(0,M9.setModulusLength)(h,r.length<<3),h}case"EC":{let c=new y1.default,u=t.d!==void 0,r=v.Buffer.concat([v.Buffer.alloc(1,4),v.Buffer.from(t.x,"base64"),v.Buffer.from(t.y,"base64")]);if(u){c.zero();let h=new y1.default;h.oidFor("ecPublicKey"),h.oidFor(t.crv),c.add(h.end());let _=new y1.default;_.one(),_.octStr(v.Buffer.from(t.d,"base64"));let q=new y1.default;q.bitStr(r);let W=q.end(v.Buffer.from([161]));_.add(W);let J=_.end(),$=new y1.default;$.add(J);let w=$.end(v.Buffer.from([4]));c.add(w);let P=c.end(),A=(0,z1.createPrivateKey)({key:P,format:"der",type:"pkcs8"});return(0,k6.setCurve)(A,t.crv),A}let n=new y1.default;n.oidFor("ecPublicKey"),n.oidFor(t.crv),c.add(n.end()),c.bitStr(r);let f=c.end(),d=(0,z1.createPublicKey)({key:f,format:"der",type:"spki"});return(0,k6.setCurve)(d,t.crv),d}case"OKP":{let c=new y1.default;if(t.d!==void 0){c.zero();let f=new y1.default;f.oidFor(t.crv),c.add(f.end());let d=new y1.default;d.octStr(v.Buffer.from(t.d,"base64"));let h=d.end(v.Buffer.from([4]));c.add(h);let _=c.end();return(0,z1.createPrivateKey)({key:_,format:"der",type:"pkcs8"})}let r=new y1.default;r.oidFor(t.crv),c.add(r.end()),c.bitStr(v.Buffer.from(t.x,"base64"));let n=c.end();return(0,z1.createPublicKey)({key:n,format:"der",type:"spki"})}default:throw new V9.JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}};Kf.default=T9});var Pc=K((Z1)=>{Object.defineProperty(Z1,"__esModule",{value:!0});Z1.importJWK=Z1.importPKCS8=Z1.importX509=Z1.importSPKI=void 0;var D9=k(),Wf=Yu(),o6=U6(),l6=C(),b9=l();async function e9(t,c,u){if(typeof t!=="string"||t.indexOf("-----BEGIN PUBLIC KEY-----")!==0)throw TypeError('"spki" must be SPKI formatted string');return(0,Wf.fromSPKI)(t,c,u)}Z1.importSPKI=e9;async function j9(t,c,u){if(typeof t!=="string"||t.indexOf("-----BEGIN CERTIFICATE-----")!==0)throw TypeError('"x509" must be X.509 formatted string');return(0,Wf.fromX509)(t,c,u)}Z1.importX509=j9;async function p9(t,c,u){if(typeof t!=="string"||t.indexOf("-----BEGIN PRIVATE KEY-----")!==0)throw TypeError('"pkcs8" must be PKCS#8 formatted string');return(0,Wf.fromPKCS8)(t,c,u)}Z1.importPKCS8=p9;async function v9(t,c,u){var r;if(!(0,b9.default)(t))throw TypeError("JWK must be an object");switch(c||(c=t.alg),t.kty){case"oct":if(typeof t.k!=="string"||!t.k)throw TypeError('missing "k" (Key Value) Parameter value');if(u!==null&&u!==void 0||(u=t.ext!==!0),u)return(0,o6.default)({...t,alg:c,ext:(r=t.ext)!==null&&r!==void 0?r:!1});return(0,D9.decode)(t.k);case"RSA":if(t.oth!==void 0)throw new l6.JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return(0,o6.default)({...t,alg:c});default:throw new l6.JOSENotSupported('Unsupported "kty" (Key Type) Parameter value')}}Z1.importJWK=v9});var Ac=K((Jf)=>{Object.defineProperty(Jf,"__esModule",{value:!0});var Q6=q1(),I1=_1(),x9=(t,c)=>{if(c instanceof Uint8Array)return;if(!(0,I1.default)(c))throw TypeError((0,Q6.withAlg)(t,c,...I1.types,"Uint8Array"));if(c.type!=="secret")throw TypeError(`${I1.types.join(" or ")} instances for symmetric algorithms must be of type "secret"`)},L9=(t,c,u)=>{if(!(0,I1.default)(c))throw TypeError((0,Q6.withAlg)(t,c,...I1.types));if(c.type==="secret")throw TypeError(`${I1.types.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);if(u==="sign"&&c.type==="public")throw TypeError(`${I1.types.join(" or ")} instances for asymmetric algorithm signing must be of type "private"`);if(u==="decrypt"&&c.type==="public")throw TypeError(`${I1.types.join(" or ")} instances for asymmetric algorithm decryption must be of type "private"`);if(c.algorithm&&u==="verify"&&c.type==="private")throw TypeError(`${I1.types.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);if(c.algorithm&&u==="encrypt"&&c.type==="private")throw TypeError(`${I1.types.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`)},s9=(t,c,u)=>{if(t.startsWith("HS")||t==="dir"||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t))x9(t,c);else L9(t,c,u)};Jf.default=s9});var Af=K((Pf)=>{Object.defineProperty(Pf,"__esModule",{value:!0});var wf=require("crypto"),m9=en(),g9=xn(),B9=N(),F9=mn(),k9=h1(),U9=j1(),a6=d1(),o9=q1(),$f=C(),t4=Cu(),l9=_1();function Q9(t,c,u,r,n){let f=parseInt(t.slice(1,4),10);if((0,a6.default)(u))u=u.export();let d=u.subarray(f>>3),h=u.subarray(0,f>>3),_=`aes-${f}-cbc`;if(!(0,t4.default)(_))throw new $f.JOSENotSupported(`alg ${t} is not supported by your javascript runtime`);let q=(0,wf.createCipheriv)(_,d,r),W=(0,B9.concat)(q.update(c),q.final()),J=parseInt(t.slice(-3),10),$=(0,F9.default)(n,r,W,J,h,f);return{ciphertext:W,tag:$}}function a9(t,c,u,r,n){let d=`aes-${parseInt(t.slice(1,4),10)}-gcm`;if(!(0,t4.default)(d))throw new $f.JOSENotSupported(`alg ${t} is not supported by your javascript runtime`);let h=(0,wf.createCipheriv)(d,u,r,{authTagLength:16});if(n.byteLength)h.setAAD(n,{plaintextLength:c.length});let _=h.update(c);h.final();let q=h.getAuthTag();return{ciphertext:_,tag:q}}var ty=(t,c,u,r,n)=>{let f;if((0,k9.isCryptoKey)(u))(0,U9.checkEncCryptoKey)(u,t,"encrypt"),f=wf.KeyObject.from(u);else if(u instanceof Uint8Array||(0,a6.default)(u))f=u;else throw TypeError((0,o9.default)(u,...l9.types,"Uint8Array"));switch((0,g9.default)(t,f),(0,m9.default)(t,r),t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return Q9(t,c,f,r,n);case"A128GCM":case"A192GCM":case"A256GCM":return a9(t,c,f,r,n);default:throw new $f.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}};Pf.default=ty});var Sf=K((Yt)=>{Object.defineProperty(Yt,"__esModule",{value:!0});Yt.unwrap=Yt.wrap=void 0;var cy=Af(),uy=Un(),ry=yu(),c4=k();async function ny(t,c,u,r){let n=t.slice(0,7);r||(r=(0,ry.default)(n));let{ciphertext:f,tag:d}=await(0,cy.default)(n,u,c,r,new Uint8Array(0));return{encryptedKey:f,iv:(0,c4.encode)(r),tag:(0,c4.encode)(d)}}Yt.wrap=ny;async function fy(t,c,u,r,n){let f=t.slice(0,7);return(0,uy.default)(f,c,u,r,n,new Uint8Array(0))}Yt.unwrap=fy});var n4=K((yf)=>{Object.defineProperty(yf,"__esModule",{value:!0});var u4=Zu(),r4=nf(),dy=df(),hy=hf(),Sc=k(),T=C(),qy=wc(),_y=Pc(),Ky=Ac(),Wy=l(),Jy=Sf();async function wy(t,c,u,r,n){switch((0,Ky.default)(t,c,"decrypt"),t){case"dir":{if(u!==void 0)throw new T.JWEInvalid("Encountered unexpected JWE Encrypted Key");return c}case"ECDH-ES":if(u!==void 0)throw new T.JWEInvalid("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!(0,Wy.default)(r.epk))throw new T.JWEInvalid('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!r4.ecdhAllowed(c))throw new T.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");let f=await(0,_y.importJWK)(r.epk,t),d,h;if(r.apu!==void 0){if(typeof r.apu!=="string")throw new T.JWEInvalid('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{d=(0,Sc.decode)(r.apu)}catch{throw new T.JWEInvalid("Failed to base64url decode the apu")}}if(r.apv!==void 0){if(typeof r.apv!=="string")throw new T.JWEInvalid('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{h=(0,Sc.decode)(r.apv)}catch{throw new T.JWEInvalid("Failed to base64url decode the apv")}}let _=await r4.deriveKey(f,c,t==="ECDH-ES"?r.enc:t,t==="ECDH-ES"?(0,qy.bitLength)(r.enc):parseInt(t.slice(-5,-2),10),d,h);if(t==="ECDH-ES")return _;if(u===void 0)throw new T.JWEInvalid("JWE Encrypted Key missing");return(0,u4.unwrap)(t.slice(-6),_,u)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(u===void 0)throw new T.JWEInvalid("JWE Encrypted Key missing");return(0,hy.decrypt)(t,c,u)}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(u===void 0)throw new T.JWEInvalid("JWE Encrypted Key missing");if(typeof r.p2c!=="number")throw new T.JWEInvalid('JOSE Header "p2c" (PBES2 Count) missing or invalid');let f=(n===null||n===void 0?void 0:n.maxPBES2Count)||1e4;if(r.p2c>f)throw new T.JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof r.p2s!=="string")throw new T.JWEInvalid('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let d;try{d=(0,Sc.decode)(r.p2s)}catch{throw new T.JWEInvalid("Failed to base64url decode the p2s")}return(0,dy.decrypt)(t,c,u,r.p2c,d)}case"A128KW":case"A192KW":case"A256KW":{if(u===void 0)throw new T.JWEInvalid("JWE Encrypted Key missing");return(0,u4.unwrap)(t,c,u)}case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{if(u===void 0)throw new T.JWEInvalid("JWE Encrypted Key missing");if(typeof r.iv!=="string")throw new T.JWEInvalid('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof r.tag!=="string")throw new T.JWEInvalid('JOSE Header "tag" (Authentication Tag) missing or invalid');let f;try{f=(0,Sc.decode)(r.iv)}catch{throw new T.JWEInvalid("Failed to base64url decode the iv")}let d;try{d=(0,Sc.decode)(r.tag)}catch{throw new T.JWEInvalid("Failed to base64url decode the tag")}return(0,Jy.unwrap)(t,c,u,f,d)}default:throw new T.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}}yf.default=wy});var zt=K((Hf)=>{Object.defineProperty(Hf,"__esModule",{value:!0});var $y=C();function Py(t,c,u,r,n){if(n.crit!==void 0&&r.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some((d)=>typeof d!=="string"||d.length===0))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let f;if(u!==void 0)f=new Map([...Object.entries(u),...c.entries()]);else f=c;for(let d of r.crit){if(!f.has(d))throw new $y.JOSENotSupported(`Extension Header Parameter "${d}" is not recognized`);if(n[d]===void 0)throw new t(`Extension Header Parameter "${d}" is missing`);else if(f.get(d)&&r[d]===void 0)throw new t(`Extension Header Parameter "${d}" MUST be integrity protected`)}return new Set(r.crit)}Hf.default=Py});var Of=K((Cf)=>{Object.defineProperty(Cf,"__esModule",{value:!0});var Ay=(t,c)=>{if(c!==void 0&&(!Array.isArray(c)||c.some((u)=>typeof u!=="string")))throw TypeError(`"${t}" option must be an array of strings`);if(!c)return;return new Set(c)};Cf.default=Ay});var Vu=K((iu)=>{Object.defineProperty(iu,"__esModule",{value:!0});iu.flattenedDecrypt=void 0;var Rt=k(),Sy=Un(),yy=on(),R=C(),Hy=Zt(),Gf=l(),Cy=n4(),yc=N(),Oy=wc(),Gy=zt(),f4=Of();async function Zy(t,c,u){var r;if(!(0,Gf.default)(t))throw new R.JWEInvalid("Flattened JWE must be an object");if(t.protected===void 0&&t.header===void 0&&t.unprotected===void 0)throw new R.JWEInvalid("JOSE Header missing");if(typeof t.iv!=="string")throw new R.JWEInvalid("JWE Initialization Vector missing or incorrect type");if(typeof t.ciphertext!=="string")throw new R.JWEInvalid("JWE Ciphertext missing or incorrect type");if(typeof t.tag!=="string")throw new R.JWEInvalid("JWE Authentication Tag missing or incorrect type");if(t.protected!==void 0&&typeof t.protected!=="string")throw new R.JWEInvalid("JWE Protected Header incorrect type");if(t.encrypted_key!==void 0&&typeof t.encrypted_key!=="string")throw new R.JWEInvalid("JWE Encrypted Key incorrect type");if(t.aad!==void 0&&typeof t.aad!=="string")throw new R.JWEInvalid("JWE AAD incorrect type");if(t.header!==void 0&&!(0,Gf.default)(t.header))throw new R.JWEInvalid("JWE Shared Unprotected Header incorrect type");if(t.unprotected!==void 0&&!(0,Gf.default)(t.unprotected))throw new R.JWEInvalid("JWE Per-Recipient Unprotected Header incorrect type");let n;if(t.protected)try{let j=(0,Rt.decode)(t.protected);n=JSON.parse(yc.decoder.decode(j))}catch{throw new R.JWEInvalid("JWE Protected Header is invalid")}if(!(0,Hy.default)(n,t.header,t.unprotected))throw new R.JWEInvalid("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");let f={...n,...t.header,...t.unprotected};if((0,Gy.default)(R.JWEInvalid,new Map,u===null||u===void 0?void 0:u.crit,n,f),f.zip!==void 0){if(!n||!n.zip)throw new R.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if(f.zip!=="DEF")throw new R.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}let{alg:d,enc:h}=f;if(typeof d!=="string"||!d)throw new R.JWEInvalid("missing JWE Algorithm (alg) in JWE Header");if(typeof h!=="string"||!h)throw new R.JWEInvalid("missing JWE Encryption Algorithm (enc) in JWE Header");let _=u&&(0,f4.default)("keyManagementAlgorithms",u.keyManagementAlgorithms),q=u&&(0,f4.default)("contentEncryptionAlgorithms",u.contentEncryptionAlgorithms);if(_&&!_.has(d))throw new R.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(q&&!q.has(h))throw new R.JOSEAlgNotAllowed('"enc" (Encryption Algorithm) Header Parameter not allowed');let W;if(t.encrypted_key!==void 0)try{W=(0,Rt.decode)(t.encrypted_key)}catch{throw new R.JWEInvalid("Failed to base64url decode the encrypted_key")}let J=!1;if(typeof c==="function")c=await c(n,t),J=!0;let $;try{$=await(0,Cy.default)(d,c,W,f,u)}catch(j){if(j instanceof TypeError||j instanceof R.JWEInvalid||j instanceof R.JOSENotSupported)throw j;$=(0,Oy.default)(h)}let w,P;try{w=(0,Rt.decode)(t.iv)}catch{throw new R.JWEInvalid("Failed to base64url decode the iv")}try{P=(0,Rt.decode)(t.tag)}catch{throw new R.JWEInvalid("Failed to base64url decode the tag")}let A=yc.encoder.encode((r=t.protected)!==null&&r!==void 0?r:""),G;if(t.aad!==void 0)G=(0,yc.concat)(A,yc.encoder.encode("."),yc.encoder.encode(t.aad));else G=A;let I;try{I=(0,Rt.decode)(t.ciphertext)}catch{throw new R.JWEInvalid("Failed to base64url decode the ciphertext")}let E=await(0,Sy.default)(h,$,I,w,P,G);if(f.zip==="DEF")E=await((u===null||u===void 0?void 0:u.inflateRaw)||yy.inflate)(E);let O={plaintext:E};if(t.protected!==void 0)O.protectedHeader=n;if(t.aad!==void 0)try{O.additionalAuthenticatedData=(0,Rt.decode)(t.aad)}catch{throw new R.JWEInvalid("Failed to base64url decode the aad")}if(t.unprotected!==void 0)O.sharedUnprotectedHeader=t.unprotected;if(t.header!==void 0)O.unprotectedHeader=t.header;if(J)return{...O,key:c};return O}iu.flattenedDecrypt=Zy});var Zf=K((Mu)=>{Object.defineProperty(Mu,"__esModule",{value:!0});Mu.compactDecrypt=void 0;var Iy=Vu(),d4=C(),Xy=N();async function Ey(t,c,u){if(t instanceof Uint8Array)t=Xy.decoder.decode(t);if(typeof t!=="string")throw new d4.JWEInvalid("Compact JWE must be a string or Uint8Array");let{0:r,1:n,2:f,3:d,4:h,length:_}=t.split(".");if(_!==5)throw new d4.JWEInvalid("Invalid Compact JWE");let q=await(0,Iy.flattenedDecrypt)({ciphertext:d,iv:f||void 0,protected:r||void 0,tag:h||void 0,encrypted_key:n||void 0},c,u),W={plaintext:q.plaintext,protectedHeader:q.protectedHeader};if(typeof c==="function")return{...W,key:q.key};return W}Mu.compactDecrypt=Ey});var q4=K((Tu)=>{Object.defineProperty(Tu,"__esModule",{value:!0});Tu.generalDecrypt=void 0;var Yy=Vu(),Nu=C(),h4=l();async function zy(t,c,u){if(!(0,h4.default)(t))throw new Nu.JWEInvalid("General JWE must be an object");if(!Array.isArray(t.recipients)||!t.recipients.every(h4.default))throw new Nu.JWEInvalid("JWE Recipients missing or incorrect type");if(!t.recipients.length)throw new Nu.JWEInvalid("JWE Recipients has no members");for(let r of t.recipients)try{return await(0,Yy.flattenedDecrypt)({aad:t.aad,ciphertext:t.ciphertext,encrypted_key:r.encrypted_key,header:r.header,iv:t.iv,protected:t.protected,tag:t.tag,unprotected:t.unprotected},c,u)}catch{}throw new Nu.JWEDecryptionFailed}Tu.generalDecrypt=zy});var K4=K((If)=>{Object.defineProperty(If,"__esModule",{value:!0});var Ry=2,iy=48;class _4{constructor(t){if(t[0]!==iy)throw TypeError();if(this.buffer=t,this.offset=1,this.decodeLength()!==t.length-this.offset)throw TypeError()}decodeLength(){let t=this.buffer[this.offset++];if(t&128){let c=t&-129;t=0;for(let u=0;u<c;u++)t=t<<8|this.buffer[this.offset+u];this.offset+=c}return t}unsignedInteger(){if(this.buffer[this.offset++]!==Ry)throw TypeError();let t=this.decodeLength();if(this.buffer[this.offset]===0)this.offset++,t--;let c=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,c}end(){if(this.offset!==this.buffer.length)throw TypeError()}}If.default=_4});var W4=K((Ef)=>{Object.defineProperty(Ef,"__esModule",{value:!0});var Du=require("crypto"),B=k(),Vy=K4(),bu=C(),Xf=qc(),My=h1(),Ny=d1(),Ty=q1(),Dy=_1(),by=$c(),eu=(t)=>{let c;if((0,My.isCryptoKey)(t)){if(!t.extractable)throw TypeError("CryptoKey is not extractable");c=Du.KeyObject.from(t)}else if((0,Ny.default)(t))c=t;else if(t instanceof Uint8Array)return{kty:"oct",k:(0,B.encode)(t)};else throw TypeError((0,Ty.default)(t,...Dy.types,"Uint8Array"));if(by.jwkExport){if(c.type!=="secret"&&!["rsa","ec","ed25519","x25519","ed448","x448"].includes(c.asymmetricKeyType))throw new bu.JOSENotSupported("Unsupported key asymmetricKeyType");return c.export({format:"jwk"})}switch(c.type){case"secret":return{kty:"oct",k:(0,B.encode)(c.export())};case"private":case"public":switch(c.asymmetricKeyType){case"rsa":{let u=c.export({format:"der",type:"pkcs1"}),r=new Vy.default(u);if(c.type==="private")r.unsignedInteger();let n=(0,B.encode)(r.unsignedInteger()),f=(0,B.encode)(r.unsignedInteger()),d;if(c.type==="private")d={d:(0,B.encode)(r.unsignedInteger()),p:(0,B.encode)(r.unsignedInteger()),q:(0,B.encode)(r.unsignedInteger()),dp:(0,B.encode)(r.unsignedInteger()),dq:(0,B.encode)(r.unsignedInteger()),qi:(0,B.encode)(r.unsignedInteger())};return r.end(),{kty:"RSA",n,e:f,...d}}case"ec":{let u=(0,Xf.default)(c),r,n,f;switch(u){case"secp256k1":r=64,n=33,f=-1;break;case"P-256":r=64,n=36,f=-1;break;case"P-384":r=96,n=35,f=-3;break;case"P-521":r=132,n=35,f=-3;break;default:throw new bu.JOSENotSupported("Unsupported curve")}if(c.type==="public"){let h=c.export({type:"spki",format:"der"});return{kty:"EC",crv:u,x:(0,B.encode)(h.subarray(-r,-r/2)),y:(0,B.encode)(h.subarray(-r/2))}}let d=c.export({type:"pkcs8",format:"der"});if(d.length<100)n+=f;return{...eu((0,Du.createPublicKey)(c)),d:(0,B.encode)(d.subarray(n,n+r/2))}}case"ed25519":case"x25519":{let u=(0,Xf.default)(c);if(c.type==="public"){let n=c.export({type:"spki",format:"der"});return{kty:"OKP",crv:u,x:(0,B.encode)(n.subarray(-32))}}let r=c.export({type:"pkcs8",format:"der"});return{...eu((0,Du.createPublicKey)(c)),d:(0,B.encode)(r.subarray(-32))}}case"ed448":case"x448":{let u=(0,Xf.default)(c);if(c.type==="public"){let n=c.export({type:"spki",format:"der"});return{kty:"OKP",crv:u,x:(0,B.encode)(n.subarray(u==="Ed448"?-57:-56))}}let r=c.export({type:"pkcs8",format:"der"});return{...eu((0,Du.createPublicKey)(c)),d:(0,B.encode)(r.subarray(u==="Ed448"?-57:-56))}}default:throw new bu.JOSENotSupported("Unsupported key asymmetricKeyType")}default:throw new bu.JOSENotSupported("Unsupported key type")}};Ef.default=eu});var Yf=K((L1)=>{Object.defineProperty(L1,"__esModule",{value:!0});L1.exportJWK=L1.exportPKCS8=L1.exportSPKI=void 0;var ey=Yu(),jy=Yu(),py=W4();async function vy(t){return(0,ey.toSPKI)(t)}L1.exportSPKI=vy;async function xy(t){return(0,jy.toPKCS8)(t)}L1.exportPKCS8=xy;async function Ly(t){return(0,py.default)(t)}L1.exportJWK=Ly});var Vf=K((Rf)=>{Object.defineProperty(Rf,"__esModule",{value:!0});var J4=Zu(),zf=nf(),sy=df(),my=hf(),w4=k(),it=wc(),$4=C(),gy=Yf(),By=Ac(),Fy=Sf();async function ky(t,c,u,r,n={}){let f,d,h;switch((0,By.default)(t,u,"encrypt"),t){case"dir":{h=u;break}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!zf.ecdhAllowed(u))throw new $4.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu:_,apv:q}=n,{epk:W}=n;W||(W=(await zf.generateEpk(u)).privateKey);let{x:J,y:$,crv:w,kty:P}=await(0,gy.exportJWK)(W),A=await zf.deriveKey(u,W,t==="ECDH-ES"?c:t,t==="ECDH-ES"?(0,it.bitLength)(c):parseInt(t.slice(-5,-2),10),_,q);if(d={epk:{x:J,crv:w,kty:P}},P==="EC")d.epk.y=$;if(_)d.apu=(0,w4.encode)(_);if(q)d.apv=(0,w4.encode)(q);if(t==="ECDH-ES"){h=A;break}h=r||(0,it.default)(c);let G=t.slice(-6);f=await(0,J4.wrap)(G,A,h);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{h=r||(0,it.default)(c),f=await(0,my.encrypt)(t,u,h);break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{h=r||(0,it.default)(c);let{p2c:_,p2s:q}=n;({encryptedKey:f,...d}=await(0,sy.encrypt)(t,u,h,_,q));break}case"A128KW":case"A192KW":case"A256KW":{h=r||(0,it.default)(c),f=await(0,J4.wrap)(t,u,h);break}case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{h=r||(0,it.default)(c);let{iv:_}=n;({encryptedKey:f,...d}=await(0,Fy.wrap)(t,u,h,_));break}default:throw new $4.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:h,encryptedKey:f,parameters:d}}Rf.default=ky});var ju=K((Q1)=>{Object.defineProperty(Q1,"__esModule",{value:!0});Q1.FlattenedEncrypt=Q1.unprotected=void 0;var Vt=k(),P4=Af(),Uy=on(),oy=yu(),ly=Vf(),l1=C(),Qy=Zt(),Mt=N(),ay=zt();Q1.unprotected=Symbol();class A4{constructor(t){if(!(t instanceof Uint8Array))throw TypeError("plaintext must be an instance of Uint8Array");this._plaintext=t}setKeyManagementParameters(t){if(this._keyManagementParameters)throw TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=t,this}setProtectedHeader(t){if(this._protectedHeader)throw TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setSharedUnprotectedHeader(t){if(this._sharedUnprotectedHeader)throw TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=t,this}setUnprotectedHeader(t){if(this._unprotectedHeader)throw TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}setAdditionalAuthenticatedData(t){return this._aad=t,this}setContentEncryptionKey(t){if(this._cek)throw TypeError("setContentEncryptionKey can only be called once");return this._cek=t,this}setInitializationVector(t){if(this._iv)throw TypeError("setInitializationVector can only be called once");return this._iv=t,this}async encrypt(t,c){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new l1.JWEInvalid("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!(0,Qy.default)(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new l1.JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let u={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if((0,ay.default)(l1.JWEInvalid,new Map,c===null||c===void 0?void 0:c.crit,this._protectedHeader,u),u.zip!==void 0){if(!this._protectedHeader||!this._protectedHeader.zip)throw new l1.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if(u.zip!=="DEF")throw new l1.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}let{alg:r,enc:n}=u;if(typeof r!=="string"||!r)throw new l1.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(typeof n!=="string"||!n)throw new l1.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let f;if(r==="dir"){if(this._cek)throw TypeError("setContentEncryptionKey cannot be called when using Direct Encryption")}else if(r==="ECDH-ES"){if(this._cek)throw TypeError("setContentEncryptionKey cannot be called when using Direct Key Agreement")}let d;{let w;if({cek:d,encryptedKey:f,parameters:w}=await(0,ly.default)(r,n,t,this._cek,this._keyManagementParameters),w)if(c&&Q1.unprotected in c)if(!this._unprotectedHeader)this.setUnprotectedHeader(w);else this._unprotectedHeader={...this._unprotectedHeader,...w};else if(!this._protectedHeader)this.setProtectedHeader(w);else this._protectedHeader={...this._protectedHeader,...w}}this._iv||(this._iv=(0,oy.default)(n));let h,_,q;if(this._protectedHeader)_=Mt.encoder.encode((0,Vt.encode)(JSON.stringify(this._protectedHeader)));else _=Mt.encoder.encode("");if(this._aad)q=(0,Vt.encode)(this._aad),h=(0,Mt.concat)(_,Mt.encoder.encode("."),Mt.encoder.encode(q));else h=_;let W,J;if(u.zip==="DEF"){let w=await((c===null||c===void 0?void 0:c.deflateRaw)||Uy.deflate)(this._plaintext);({ciphertext:W,tag:J}=await(0,P4.default)(n,w,d,this._iv,h))}else({ciphertext:W,tag:J}=await(0,P4.default)(n,this._plaintext,d,this._iv,h));let $={ciphertext:(0,Vt.encode)(W),iv:(0,Vt.encode)(this._iv),tag:(0,Vt.encode)(J)};if(f)$.encrypted_key=(0,Vt.encode)(f);if(q)$.aad=q;if(this._protectedHeader)$.protected=Mt.decoder.decode(_);if(this._sharedUnprotectedHeader)$.unprotected=this._sharedUnprotectedHeader;if(this._unprotectedHeader)$.header=this._unprotectedHeader;return $}}Q1.FlattenedEncrypt=A4});var H4=K((pu)=>{Object.defineProperty(pu,"__esModule",{value:!0});pu.GeneralEncrypt=void 0;var Mf=ju(),s1=C(),tH=wc(),cH=Zt(),uH=Vf(),rH=k(),nH=zt();class S4{constructor(t,c,u){this.parent=t,this.key=c,this.options=u}setUnprotectedHeader(t){if(this.unprotectedHeader)throw TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=t,this}addRecipient(...t){return this.parent.addRecipient(...t)}encrypt(...t){return this.parent.encrypt(...t)}done(){return this.parent}}class y4{constructor(t){this._recipients=[],this._plaintext=t}addRecipient(t,c){let u=new S4(this,t,{crit:c===null||c===void 0?void 0:c.crit});return this._recipients.push(u),u}setProtectedHeader(t){if(this._protectedHeader)throw TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setSharedUnprotectedHeader(t){if(this._unprotectedHeader)throw TypeError("setSharedUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}setAdditionalAuthenticatedData(t){return this._aad=t,this}async encrypt(t){var c,u,r;if(!this._recipients.length)throw new s1.JWEInvalid("at least one recipient must be added");if(t={deflateRaw:t===null||t===void 0?void 0:t.deflateRaw},this._recipients.length===1){let[h]=this._recipients,_=await new Mf.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(h.unprotectedHeader).encrypt(h.key,{...h.options,...t}),q={ciphertext:_.ciphertext,iv:_.iv,recipients:[{}],tag:_.tag};if(_.aad)q.aad=_.aad;if(_.protected)q.protected=_.protected;if(_.unprotected)q.unprotected=_.unprotected;if(_.encrypted_key)q.recipients[0].encrypted_key=_.encrypted_key;if(_.header)q.recipients[0].header=_.header;return q}let n;for(let h=0;h<this._recipients.length;h++){let _=this._recipients[h];if(!(0,cH.default)(this._protectedHeader,this._unprotectedHeader,_.unprotectedHeader))throw new s1.JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let q={...this._protectedHeader,...this._unprotectedHeader,..._.unprotectedHeader},{alg:W}=q;if(typeof W!=="string"||!W)throw new s1.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(W==="dir"||W==="ECDH-ES")throw new s1.JWEInvalid('"dir" and "ECDH-ES" alg may only be used with a single recipient');if(typeof q.enc!=="string"||!q.enc)throw new s1.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(!n)n=q.enc;else if(n!==q.enc)throw new s1.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients');if((0,nH.default)(s1.JWEInvalid,new Map,_.options.crit,this._protectedHeader,q),q.zip!==void 0){if(!this._protectedHeader||!this._protectedHeader.zip)throw new s1.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected')}}let f=(0,tH.default)(n),d={ciphertext:"",iv:"",recipients:[],tag:""};for(let h=0;h<this._recipients.length;h++){let _=this._recipients[h],q={};d.recipients.push(q);let J={...this._protectedHeader,...this._unprotectedHeader,..._.unprotectedHeader}.alg.startsWith("PBES2")?2048+h:void 0;if(h===0){let P=await new Mf.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(f).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(_.unprotectedHeader).setKeyManagementParameters({p2c:J}).encrypt(_.key,{..._.options,...t,[Mf.unprotected]:!0});if(d.ciphertext=P.ciphertext,d.iv=P.iv,d.tag=P.tag,P.aad)d.aad=P.aad;if(P.protected)d.protected=P.protected;if(P.unprotected)d.unprotected=P.unprotected;if(q.encrypted_key=P.encrypted_key,P.header)q.header=P.header;continue}let{encryptedKey:$,parameters:w}=await(0,uH.default)(((c=_.unprotectedHeader)===null||c===void 0?void 0:c.alg)||((u=this._protectedHeader)===null||u===void 0?void 0:u.alg)||((r=this._unprotectedHeader)===null||r===void 0?void 0:r.alg),n,_.key,f,{p2c:J});if(q.encrypted_key=(0,rH.encode)($),_.unprotectedHeader||w)q.header={..._.unprotectedHeader,...w}}return d}}pu.GeneralEncrypt=y4});var Tf=K((Nf)=>{Object.defineProperty(Nf,"__esModule",{value:!0});var fH=C();function dH(t){switch(t){case"PS256":case"RS256":case"ES256":case"ES256K":return"sha256";case"PS384":case"RS384":case"ES384":return"sha384";case"PS512":case"RS512":case"ES512":return"sha512";case"EdDSA":return;default:throw new fH.JOSENotSupported(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}Nf.default=dH});var ef=K((bf)=>{Object.defineProperty(bf,"__esModule",{value:!0});var C4=require("crypto"),hH=qc(),qH=C(),Df=Kc(),Nt=$c(),O4={padding:C4.constants.RSA_PKCS1_PSS_PADDING,saltLength:C4.constants.RSA_PSS_SALTLEN_DIGEST},_H=new Map([["ES256","P-256"],["ES256K","secp256k1"],["ES384","P-384"],["ES512","P-521"]]);function KH(t,c){switch(t){case"EdDSA":if(!["ed25519","ed448"].includes(c.asymmetricKeyType))throw TypeError("Invalid key for this operation, its asymmetricKeyType must be ed25519 or ed448");return c;case"RS256":case"RS384":case"RS512":if(c.asymmetricKeyType!=="rsa")throw TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");return(0,Df.default)(c,t),c;case(Nt.rsaPssParams&&"PS256"):case(Nt.rsaPssParams&&"PS384"):case(Nt.rsaPssParams&&"PS512"):if(c.asymmetricKeyType==="rsa-pss"){let{hashAlgorithm:u,mgf1HashAlgorithm:r,saltLength:n}=c.asymmetricKeyDetails,f=parseInt(t.slice(-3),10);if(u!==void 0&&(u!==`sha${f}`||r!==u))throw TypeError(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${t}`);if(n!==void 0&&n>f>>3)throw TypeError(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${t}`)}else if(c.asymmetricKeyType!=="rsa")throw TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa or rsa-pss");return(0,Df.default)(c,t),{key:c,...O4};case(!Nt.rsaPssParams&&"PS256"):case(!Nt.rsaPssParams&&"PS384"):case(!Nt.rsaPssParams&&"PS512"):if(c.asymmetricKeyType!=="rsa")throw TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");return(0,Df.default)(c,t),{key:c,...O4};case"ES256":case"ES256K":case"ES384":case"ES512":{if(c.asymmetricKeyType!=="ec")throw TypeError("Invalid key for this operation, its asymmetricKeyType must be ec");let u=(0,hH.default)(c),r=_H.get(t);if(u!==r)throw TypeError(`Invalid key curve for the algorithm, its curve must be ${r}, got ${u}`);return{dsaEncoding:"ieee-p1363",key:c}}default:throw new qH.JOSENotSupported(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}bf.default=KH});var G4=K((jf)=>{Object.defineProperty(jf,"__esModule",{value:!0});var WH=C();function JH(t){switch(t){case"HS256":return"sha256";case"HS384":return"sha384";case"HS512":return"sha512";default:throw new WH.JOSENotSupported(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}jf.default=JH});var xf=K((vf)=>{Object.defineProperty(vf,"__esModule",{value:!0});var pf=require("crypto"),wH=h1(),$H=j1(),Z4=q1(),I4=_1();function PH(t,c,u){if(c instanceof Uint8Array){if(!t.startsWith("HS"))throw TypeError((0,Z4.default)(c,...I4.types));return(0,pf.createSecretKey)(c)}if(c instanceof pf.KeyObject)return c;if((0,wH.isCryptoKey)(c))return(0,$H.checkSigCryptoKey)(c,t,u),pf.KeyObject.from(c);throw TypeError((0,Z4.default)(c,...I4.types,"Uint8Array"))}vf.default=PH});var mf=K((sf)=>{Object.defineProperty(sf,"__esModule",{value:!0});var vu=require("crypto"),AH=require("util"),SH=Tf(),yH=G4(),HH=ef(),CH=xf(),Lf;if(vu.sign.length>3)Lf=(0,AH.promisify)(vu.sign);else Lf=vu.sign;var OH=async(t,c,u)=>{let r=(0,CH.default)(t,c,"sign");if(t.startsWith("HS")){let n=vu.createHmac((0,yH.default)(t),r);return n.update(u),n.digest()}return Lf((0,SH.default)(t),u,(0,HH.default)(t,r))};sf.default=OH});var X4=K((Bf)=>{Object.defineProperty(Bf,"__esModule",{value:!0});var xu=require("crypto"),GH=require("util"),ZH=Tf(),IH=ef(),XH=mf(),EH=xf(),YH=$c(),gf;if(xu.verify.length>4&&YH.oneShotCallback)gf=(0,GH.promisify)(xu.verify);else gf=xu.verify;var zH=async(t,c,u,r)=>{let n=(0,EH.default)(t,c,"verify");if(t.startsWith("HS")){let h=await(0,XH.default)(t,n,r),_=u;try{return xu.timingSafeEqual(_,h)}catch{return!1}}let f=(0,ZH.default)(t),d=(0,IH.default)(t,n);try{return await gf(f,r,d,u)}catch{return!1}};Bf.default=zH});var su=K((Lu)=>{Object.defineProperty(Lu,"__esModule",{value:!0});Lu.flattenedVerify=void 0;var Ff=k(),RH=X4(),F=C(),Tt=N(),iH=Zt(),E4=l(),VH=Ac(),MH=zt(),NH=Of();async function TH(t,c,u){var r;if(!(0,E4.default)(t))throw new F.JWSInvalid("Flattened JWS must be an object");if(t.protected===void 0&&t.header===void 0)throw new F.JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');if(t.protected!==void 0&&typeof t.protected!=="string")throw new F.JWSInvalid("JWS Protected Header incorrect type");if(t.payload===void 0)throw new F.JWSInvalid("JWS Payload missing");if(typeof t.signature!=="string")throw new F.JWSInvalid("JWS Signature missing or incorrect type");if(t.header!==void 0&&!(0,E4.default)(t.header))throw new F.JWSInvalid("JWS Unprotected Header incorrect type");let n={};if(t.protected)try{let G=(0,Ff.decode)(t.protected);n=JSON.parse(Tt.decoder.decode(G))}catch{throw new F.JWSInvalid("JWS Protected Header is invalid")}if(!(0,iH.default)(n,t.header))throw new F.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let f={...n,...t.header},d=(0,MH.default)(F.JWSInvalid,new Map([["b64",!0]]),u===null||u===void 0?void 0:u.crit,n,f),h=!0;if(d.has("b64")){if(h=n.b64,typeof h!=="boolean")throw new F.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean')}let{alg:_}=f;if(typeof _!=="string"||!_)throw new F.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');let q=u&&(0,NH.default)("algorithms",u.algorithms);if(q&&!q.has(_))throw new F.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(h){if(typeof t.payload!=="string")throw new F.JWSInvalid("JWS Payload must be a string")}else if(typeof t.payload!=="string"&&!(t.payload instanceof Uint8Array))throw new F.JWSInvalid("JWS Payload must be a string or an Uint8Array instance");let W=!1;if(typeof c==="function")c=await c(n,t),W=!0;(0,VH.default)(_,c,"verify");let J=(0,Tt.concat)(Tt.encoder.encode((r=t.protected)!==null&&r!==void 0?r:""),Tt.encoder.encode("."),typeof t.payload==="string"?Tt.encoder.encode(t.payload):t.payload),$;try{$=(0,Ff.decode)(t.signature)}catch{throw new F.JWSInvalid("Failed to base64url decode the signature")}if(!await(0,RH.default)(_,c,$,J))throw new F.JWSSignatureVerificationFailed;let P;if(h)try{P=(0,Ff.decode)(t.payload)}catch{throw new F.JWSInvalid("Failed to base64url decode the payload")}else if(typeof t.payload==="string")P=Tt.encoder.encode(t.payload);else P=t.payload;let A={payload:P};if(t.protected!==void 0)A.protectedHeader=n;if(t.header!==void 0)A.unprotectedHeader=t.header;if(W)return{...A,key:c};return A}Lu.flattenedVerify=TH});var kf=K((mu)=>{Object.defineProperty(mu,"__esModule",{value:!0});mu.compactVerify=void 0;var DH=su(),Y4=C(),bH=N();async function eH(t,c,u){if(t instanceof Uint8Array)t=bH.decoder.decode(t);if(typeof t!=="string")throw new Y4.JWSInvalid("Compact JWS must be a string or Uint8Array");let{0:r,1:n,2:f,length:d}=t.split(".");if(d!==3)throw new Y4.JWSInvalid("Invalid Compact JWS");let h=await(0,DH.flattenedVerify)({payload:n,protected:r,signature:f},c,u),_={payload:h.payload,protectedHeader:h.protectedHeader};if(typeof c==="function")return{..._,key:h.key};return _}mu.compactVerify=eH});var R4=K((gu)=>{Object.defineProperty(gu,"__esModule",{value:!0});gu.generalVerify=void 0;var jH=su(),Uf=C(),z4=l();async function pH(t,c,u){if(!(0,z4.default)(t))throw new Uf.JWSInvalid("General JWS must be an object");if(!Array.isArray(t.signatures)||!t.signatures.every(z4.default))throw new Uf.JWSInvalid("JWS Signatures missing or incorrect type");for(let r of t.signatures)try{return await(0,jH.flattenedVerify)({header:r.header,payload:t.payload,protected:r.protected,signature:r.signature},c,u)}catch{}throw new Uf.JWSSignatureVerificationFailed}gu.generalVerify=pH});var lf=K((of)=>{Object.defineProperty(of,"__esModule",{value:!0});of.default=(t)=>Math.floor(t.getTime()/1000)});var td=K((af)=>{Object.defineProperty(af,"__esModule",{value:!0});var i4=60,V4=i4*60,Qf=V4*24,vH=Qf*7,xH=Qf*365.25,LH=/^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i;af.default=(t)=>{let c=LH.exec(t);if(!c)throw TypeError("Invalid time period format");let u=parseFloat(c[1]);switch(c[2].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":return Math.round(u);case"minute":case"minutes":case"min":case"mins":case"m":return Math.round(u*i4);case"hour":case"hours":case"hr":case"hrs":case"h":return Math.round(u*V4);case"day":case"days":case"d":return Math.round(u*Qf);case"week":case"weeks":case"w":return Math.round(u*vH);default:return Math.round(u*xH)}}});var Bu=K((cd)=>{Object.defineProperty(cd,"__esModule",{value:!0});var t1=C(),sH=N(),mH=lf(),M4=td(),gH=l(),N4=(t)=>t.toLowerCase().replace(/^application\//,""),BH=(t,c)=>{if(typeof t==="string")return c.includes(t);if(Array.isArray(t))return c.some(Set.prototype.has.bind(new Set(t)));return!1};cd.default=(t,c,u={})=>{let{typ:r}=u;if(r&&(typeof t.typ!=="string"||N4(t.typ)!==N4(r)))throw new t1.JWTClaimValidationFailed('unexpected "typ" JWT header value',"typ","check_failed");let n;try{n=JSON.parse(sH.decoder.decode(c))}catch{}if(!(0,gH.default)(n))throw new t1.JWTInvalid("JWT Claims Set must be a top-level JSON object");let{requiredClaims:f=[],issuer:d,subject:h,audience:_,maxTokenAge:q}=u;if(q!==void 0)f.push("iat");if(_!==void 0)f.push("aud");if(h!==void 0)f.push("sub");if(d!==void 0)f.push("iss");for(let w of new Set(f.reverse()))if(!(w in n))throw new t1.JWTClaimValidationFailed(`missing required "${w}" claim`,w,"missing");if(d&&!(Array.isArray(d)?d:[d]).includes(n.iss))throw new t1.JWTClaimValidationFailed('unexpected "iss" claim value',"iss","check_failed");if(h&&n.sub!==h)throw new t1.JWTClaimValidationFailed('unexpected "sub" claim value',"sub","check_failed");if(_&&!BH(n.aud,typeof _==="string"?[_]:_))throw new t1.JWTClaimValidationFailed('unexpected "aud" claim value',"aud","check_failed");let W;switch(typeof u.clockTolerance){case"string":W=(0,M4.default)(u.clockTolerance);break;case"number":W=u.clockTolerance;break;case"undefined":W=0;break;default:throw TypeError("Invalid clockTolerance option type")}let{currentDate:J}=u,$=(0,mH.default)(J||new Date);if((n.iat!==void 0||q)&&typeof n.iat!=="number")throw new t1.JWTClaimValidationFailed('"iat" claim must be a number',"iat","invalid");if(n.nbf!==void 0){if(typeof n.nbf!=="number")throw new t1.JWTClaimValidationFailed('"nbf" claim must be a number',"nbf","invalid");if(n.nbf>$+W)throw new t1.JWTClaimValidationFailed('"nbf" claim timestamp check failed',"nbf","check_failed")}if(n.exp!==void 0){if(typeof n.exp!=="number")throw new t1.JWTClaimValidationFailed('"exp" claim must be a number',"exp","invalid");if(n.exp<=$-W)throw new t1.JWTExpired('"exp" claim timestamp check failed',"exp","check_failed")}if(q){let w=$-n.iat,P=typeof q==="number"?q:(0,M4.default)(q);if(w-W>P)throw new t1.JWTExpired('"iat" claim timestamp check failed (too far in the past)',"iat","check_failed");if(w<0-W)throw new t1.JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)',"iat","check_failed")}return n}});var T4=K((Fu)=>{Object.defineProperty(Fu,"__esModule",{value:!0});Fu.jwtVerify=void 0;var FH=kf(),kH=Bu(),UH=C();async function oH(t,c,u){var r;let n=await(0,FH.compactVerify)(t,c,u);if(((r=n.protectedHeader.crit)===null||r===void 0?void 0:r.includes("b64"))&&n.protectedHeader.b64===!1)throw new UH.JWTInvalid("JWTs MUST NOT use unencoded payload");let d={payload:(0,kH.default)(n.protectedHeader,n.payload,u),protectedHeader:n.protectedHeader};if(typeof c==="function")return{...d,key:n.key};return d}Fu.jwtVerify=oH});var D4=K((ku)=>{Object.defineProperty(ku,"__esModule",{value:!0});ku.jwtDecrypt=void 0;var lH=Zf(),QH=Bu(),ud=C();async function aH(t,c,u){let r=await(0,lH.compactDecrypt)(t,c,u),n=(0,QH.default)(r.protectedHeader,r.plaintext,u),{protectedHeader:f}=r;if(f.iss!==void 0&&f.iss!==n.iss)throw new ud.JWTClaimValidationFailed('replicated "iss" claim header parameter mismatch',"iss","mismatch");if(f.sub!==void 0&&f.sub!==n.sub)throw new ud.JWTClaimValidationFailed('replicated "sub" claim header parameter mismatch',"sub","mismatch");if(f.aud!==void 0&&JSON.stringify(f.aud)!==JSON.stringify(n.aud))throw new ud.JWTClaimValidationFailed('replicated "aud" claim header parameter mismatch',"aud","mismatch");let d={payload:n,protectedHeader:f};if(typeof c==="function")return{...d,key:r.key};return d}ku.jwtDecrypt=aH});var rd=K((Uu)=>{Object.defineProperty(Uu,"__esModule",{value:!0});Uu.CompactEncrypt=void 0;var tC=ju();class b4{constructor(t){this._flattened=new tC.FlattenedEncrypt(t)}setContentEncryptionKey(t){return this._flattened.setContentEncryptionKey(t),this}setInitializationVector(t){return this._flattened.setInitializationVector(t),this}setProtectedHeader(t){return this._flattened.setProtectedHeader(t),this}setKeyManagementParameters(t){return this._flattened.setKeyManagementParameters(t),this}async encrypt(t,c){let u=await this._flattened.encrypt(t,c);return[u.protected,u.encrypted_key,u.iv,u.ciphertext,u.tag].join(".")}}Uu.CompactEncrypt=b4});var lu=K((ou)=>{Object.defineProperty(ou,"__esModule",{value:!0});ou.FlattenedSign=void 0;var nd=k(),cC=mf(),uC=Zt(),Hc=C(),a1=N(),rC=Ac(),nC=zt();class e4{constructor(t){if(!(t instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this._payload=t}setProtectedHeader(t){if(this._protectedHeader)throw TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setUnprotectedHeader(t){if(this._unprotectedHeader)throw TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}async sign(t,c){if(!this._protectedHeader&&!this._unprotectedHeader)throw new Hc.JWSInvalid("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!(0,uC.default)(this._protectedHeader,this._unprotectedHeader))throw new Hc.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let u={...this._protectedHeader,...this._unprotectedHeader},r=(0,nC.default)(Hc.JWSInvalid,new Map([["b64",!0]]),c===null||c===void 0?void 0:c.crit,this._protectedHeader,u),n=!0;if(r.has("b64")){if(n=this._protectedHeader.b64,typeof n!=="boolean")throw new Hc.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean')}let{alg:f}=u;if(typeof f!=="string"||!f)throw new Hc.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');(0,rC.default)(f,t,"sign");let d=this._payload;if(n)d=a1.encoder.encode((0,nd.encode)(d));let h;if(this._protectedHeader)h=a1.encoder.encode((0,nd.encode)(JSON.stringify(this._protectedHeader)));else h=a1.encoder.encode("");let _=(0,a1.concat)(h,a1.encoder.encode("."),d),q=await(0,cC.default)(f,t,_),W={signature:(0,nd.encode)(q),payload:""};if(n)W.payload=a1.decoder.decode(d);if(this._unprotectedHeader)W.header=this._unprotectedHeader;if(this._protectedHeader)W.protected=a1.decoder.decode(h);return W}}ou.FlattenedSign=e4});var fd=K((Qu)=>{Object.defineProperty(Qu,"__esModule",{value:!0});Qu.CompactSign=void 0;var fC=lu();class j4{constructor(t){this._flattened=new fC.FlattenedSign(t)}setProtectedHeader(t){return this._flattened.setProtectedHeader(t),this}async sign(t,c){let u=await this._flattened.sign(t,c);if(u.payload===void 0)throw TypeError("use the flattened module for creating JWS with b64: false");return`${u.protected}.${u.payload}.${u.signature}`}}Qu.CompactSign=j4});var L4=K((au)=>{Object.defineProperty(au,"__esModule",{value:!0});au.GeneralSign=void 0;var dC=lu(),p4=C();class v4{constructor(t,c,u){this.parent=t,this.key=c,this.options=u}setProtectedHeader(t){if(this.protectedHeader)throw TypeError("setProtectedHeader can only be called once");return this.protectedHeader=t,this}setUnprotectedHeader(t){if(this.unprotectedHeader)throw TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=t,this}addSignature(...t){return this.parent.addSignature(...t)}sign(...t){return this.parent.sign(...t)}done(){return this.parent}}class x4{constructor(t){this._signatures=[],this._payload=t}addSignature(t,c){let u=new v4(this,t,c);return this._signatures.push(u),u}async sign(){if(!this._signatures.length)throw new p4.JWSInvalid("at least one signature must be added");let t={signatures:[],payload:""};for(let c=0;c<this._signatures.length;c++){let u=this._signatures[c],r=new dC.FlattenedSign(this._payload);r.setProtectedHeader(u.protectedHeader),r.setUnprotectedHeader(u.unprotectedHeader);let{payload:n,...f}=await r.sign(u.key,u.options);if(c===0)t.payload=n;else if(t.payload!==n)throw new p4.JWSInvalid("inconsistent use of JWS Unencoded Payload (RFC7797)");t.signatures.push(f)}return t}}au.GeneralSign=x4});var cr=K((tr)=>{Object.defineProperty(tr,"__esModule",{value:!0});tr.ProduceJWT=void 0;var dd=lf(),hC=l(),s4=td();class m4{constructor(t){if(!(0,hC.default)(t))throw TypeError("JWT Claims Set MUST be an object");this._payload=t}setIssuer(t){return this._payload={...this._payload,iss:t},this}setSubject(t){return this._payload={...this._payload,sub:t},this}setAudience(t){return this._payload={...this._payload,aud:t},this}setJti(t){return this._payload={...this._payload,jti:t},this}setNotBefore(t){if(typeof t==="number")this._payload={...this._payload,nbf:t};else this._payload={...this._payload,nbf:(0,dd.default)(new Date)+(0,s4.default)(t)};return this}setExpirationTime(t){if(typeof t==="number")this._payload={...this._payload,exp:t};else this._payload={...this._payload,exp:(0,dd.default)(new Date)+(0,s4.default)(t)};return this}setIssuedAt(t){if(typeof t>"u")this._payload={...this._payload,iat:(0,dd.default)(new Date)};else this._payload={...this._payload,iat:t};return this}}tr.ProduceJWT=m4});var B4=K((ur)=>{Object.defineProperty(ur,"__esModule",{value:!0});ur.SignJWT=void 0;var qC=fd(),_C=C(),KC=N(),WC=cr();class g4 extends WC.ProduceJWT{setProtectedHeader(t){return this._protectedHeader=t,this}async sign(t,c){var u;let r=new qC.CompactSign(KC.encoder.encode(JSON.stringify(this._payload)));if(r.setProtectedHeader(this._protectedHeader),Array.isArray((u=this._protectedHeader)===null||u===void 0?void 0:u.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===!1)throw new _C.JWTInvalid("JWTs MUST NOT use unencoded payload");return r.sign(t,c)}}ur.SignJWT=g4});var k4=K((rr)=>{Object.defineProperty(rr,"__esModule",{value:!0});rr.EncryptJWT=void 0;var JC=rd(),wC=N(),$C=cr();class F4 extends $C.ProduceJWT{setProtectedHeader(t){if(this._protectedHeader)throw TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setKeyManagementParameters(t){if(this._keyManagementParameters)throw TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=t,this}setContentEncryptionKey(t){if(this._cek)throw TypeError("setContentEncryptionKey can only be called once");return this._cek=t,this}setInitializationVector(t){if(this._iv)throw TypeError("setInitializationVector can only be called once");return this._iv=t,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(t,c){let u=new JC.CompactEncrypt(wC.encoder.encode(JSON.stringify(this._payload)));if(this._replicateIssuerAsHeader)this._protectedHeader={...this._protectedHeader,iss:this._payload.iss};if(this._replicateSubjectAsHeader)this._protectedHeader={...this._protectedHeader,sub:this._payload.sub};if(this._replicateAudienceAsHeader)this._protectedHeader={...this._protectedHeader,aud:this._payload.aud};if(u.setProtectedHeader(this._protectedHeader),this._iv)u.setInitializationVector(this._iv);if(this._cek)u.setContentEncryptionKey(this._cek);if(this._keyManagementParameters)u.setKeyManagementParameters(this._keyManagementParameters);return u.encrypt(t,c)}}rr.EncryptJWT=F4});var l4=K((Dt)=>{Object.defineProperty(Dt,"__esModule",{value:!0});Dt.calculateJwkThumbprintUri=Dt.calculateJwkThumbprint=void 0;var PC=Mn(),AC=k(),U4=C(),SC=N(),yC=l(),m1=(t,c)=>{if(typeof t!=="string"||!t)throw new U4.JWKInvalid(`${c} missing or invalid`)};async function o4(t,c){if(!(0,yC.default)(t))throw TypeError("JWK must be an object");if(c!==null&&c!==void 0||(c="sha256"),c!=="sha256"&&c!=="sha384"&&c!=="sha512")throw TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let u;switch(t.kty){case"EC":m1(t.crv,'"crv" (Curve) Parameter'),m1(t.x,'"x" (X Coordinate) Parameter'),m1(t.y,'"y" (Y Coordinate) Parameter'),u={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":m1(t.crv,'"crv" (Subtype of Key Pair) Parameter'),m1(t.x,'"x" (Public Key) Parameter'),u={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":m1(t.e,'"e" (Exponent) Parameter'),m1(t.n,'"n" (Modulus) Parameter'),u={e:t.e,kty:t.kty,n:t.n};break;case"oct":m1(t.k,'"k" (Key Value) Parameter'),u={k:t.k,kty:t.kty};break;default:throw new U4.JOSENotSupported('"kty" (Key Type) Parameter missing or unsupported')}let r=SC.encoder.encode(JSON.stringify(u));return(0,AC.encode)(await(0,PC.default)(c,r))}Dt.calculateJwkThumbprint=o4;async function HC(t,c){c!==null&&c!==void 0||(c="sha256");let u=await o4(t,c);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${c.slice(-3)}:${u}`}Dt.calculateJwkThumbprintUri=HC});var a4=K((nr)=>{Object.defineProperty(nr,"__esModule",{value:!0});nr.EmbeddedJWK=void 0;var CC=Pc(),OC=l(),Q4=C();async function GC(t,c){let u={...t,...c===null||c===void 0?void 0:c.header};if(!(0,OC.default)(u.jwk))throw new Q4.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object');let r=await(0,CC.importJWK)({...u.jwk,ext:!0},u.alg,!0);if(r instanceof Uint8Array||r.type!=="public")throw new Q4.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key');return r}nr.EmbeddedJWK=GC});var qd=K((g1)=>{Object.defineProperty(g1,"__esModule",{value:!0});g1.createLocalJWKSet=g1.LocalJWKSet=g1.isJWKSLike=void 0;var ZC=Pc(),Cc=C(),IC=l();function XC(t){switch(typeof t==="string"&&t.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new Cc.JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set')}}function c8(t){return t&&typeof t==="object"&&Array.isArray(t.keys)&&t.keys.every(EC)}g1.isJWKSLike=c8;function EC(t){return(0,IC.default)(t)}function YC(t){if(typeof structuredClone==="function")return structuredClone(t);return JSON.parse(JSON.stringify(t))}class hd{constructor(t){if(this._cached=new WeakMap,!c8(t))throw new Cc.JWKSInvalid("JSON Web Key Set malformed");this._jwks=YC(t)}async getKey(t,c){let{alg:u,kid:r}={...t,...c===null||c===void 0?void 0:c.header},n=XC(u),f=this._jwks.keys.filter((_)=>{let q=n===_.kty;if(q&&typeof r==="string")q=r===_.kid;if(q&&typeof _.alg==="string")q=u===_.alg;if(q&&typeof _.use==="string")q=_.use==="sig";if(q&&Array.isArray(_.key_ops))q=_.key_ops.includes("verify");if(q&&u==="EdDSA")q=_.crv==="Ed25519"||_.crv==="Ed448";if(q)switch(u){case"ES256":q=_.crv==="P-256";break;case"ES256K":q=_.crv==="secp256k1";break;case"ES384":q=_.crv==="P-384";break;case"ES512":q=_.crv==="P-521";break}return q}),{0:d,length:h}=f;if(h===0)throw new Cc.JWKSNoMatchingKey;else if(h!==1){let _=new Cc.JWKSMultipleMatchingKeys,{_cached:q}=this;throw _[Symbol.asyncIterator]=async function*(){for(let W of f)try{yield await t8(q,W,u)}catch{continue}},_}return t8(this._cached,d,u)}}g1.LocalJWKSet=hd;async function t8(t,c,u){let r=t.get(c)||t.set(c,{}).get(c);if(r[u]===void 0){let n=await(0,ZC.importJWK)({...c,ext:!0},u);if(n instanceof Uint8Array||n.type!=="public")throw new Cc.JWKSInvalid("JSON Web Key Set members must be public keys");r[u]=n}return r[u]}function zC(t){let c=new hd(t);return async function(u,r){return c.getKey(u,r)}}g1.createLocalJWKSet=zC});var n8=K((Kd)=>{Object.defineProperty(Kd,"__esModule",{value:!0});var RC=require("http"),iC=require("https"),u8=require("events"),_d=C(),r8=N(),VC=async(t,c,u)=>{let r;switch(t.protocol){case"https:":r=iC.get;break;case"http:":r=RC.get;break;default:throw TypeError("Unsupported URL protocol.")}let{agent:n,headers:f}=u,d=r(t.href,{agent:n,timeout:c,headers:f}),[h]=await Promise.race([(0,u8.once)(d,"response"),(0,u8.once)(d,"timeout")]);if(!h)throw d.destroy(),new _d.JWKSTimeout;if(h.statusCode!==200)throw new _d.JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");let _=[];for await(let q of h)_.push(q);try{return JSON.parse(r8.decoder.decode((0,r8.concat)(..._)))}catch{throw new _d.JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON")}};Kd.default=VC});var q8=K((fr)=>{Object.defineProperty(fr,"__esModule",{value:!0});fr.createRemoteJWKSet=void 0;var MC=n8(),f8=C(),d8=qd();function NC(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}class h8 extends d8.LocalJWKSet{constructor(t,c){super({keys:[]});if(this._jwks=void 0,!(t instanceof URL))throw TypeError("url must be an instance of URL");this._url=new URL(t.href),this._options={agent:c===null||c===void 0?void 0:c.agent,headers:c===null||c===void 0?void 0:c.headers},this._timeoutDuration=typeof(c===null||c===void 0?void 0:c.timeoutDuration)==="number"?c===null||c===void 0?void 0:c.timeoutDuration:5000,this._cooldownDuration=typeof(c===null||c===void 0?void 0:c.cooldownDuration)==="number"?c===null||c===void 0?void 0:c.cooldownDuration:30000,this._cacheMaxAge=typeof(c===null||c===void 0?void 0:c.cacheMaxAge)==="number"?c===null||c===void 0?void 0:c.cacheMaxAge:600000}coolingDown(){return typeof this._jwksTimestamp==="number"?Date.now()<this._jwksTimestamp+this._cooldownDuration:!1}fresh(){return typeof this._jwksTimestamp==="number"?Date.now()<this._jwksTimestamp+this._cacheMaxAge:!1}async getKey(t,c){if(!this._jwks||!this.fresh())await this.reload();try{return await super.getKey(t,c)}catch(u){if(u instanceof f8.JWKSNoMatchingKey){if(this.coolingDown()===!1)return await this.reload(),super.getKey(t,c)}throw u}}async reload(){if(this._pendingFetch&&NC())this._pendingFetch=void 0;this._pendingFetch||(this._pendingFetch=(0,MC.default)(this._url,this._timeoutDuration,this._options).then((t)=>{if(!(0,d8.isJWKSLike)(t))throw new f8.JWKSInvalid("JSON Web Key Set malformed");this._jwks={keys:t.keys},this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch((t)=>{throw this._pendingFetch=void 0,t})),await this._pendingFetch}}function TC(t,c){let u=new h8(t,c);return async function(r,n){return u.getKey(r,n)}}fr.createRemoteJWKSet=TC});var K8=K((hr)=>{Object.defineProperty(hr,"__esModule",{value:!0});hr.UnsecuredJWT=void 0;var dr=k(),DC=N(),Wd=C(),bC=Bu(),eC=cr();class _8 extends eC.ProduceJWT{encode(){let t=dr.encode(JSON.stringify({alg:"none"})),c=dr.encode(JSON.stringify(this._payload));return`${t}.${c}.`}static decode(t,c){if(typeof t!=="string")throw new Wd.JWTInvalid("Unsecured JWT must be a string");let{0:u,1:r,2:n,length:f}=t.split(".");if(f!==3||n!=="")throw new Wd.JWTInvalid("Invalid Unsecured JWT");let d;try{if(d=JSON.parse(DC.decoder.decode(dr.decode(u))),d.alg!=="none")throw Error()}catch{throw new Wd.JWTInvalid("Invalid Unsecured JWT")}return{payload:(0,bC.default)(d,dr.decode(r),c),header:d}}}hr.UnsecuredJWT=_8});var qr=K((bt)=>{Object.defineProperty(bt,"__esModule",{value:!0});bt.decode=bt.encode=void 0;var W8=k();bt.encode=W8.encode;bt.decode=W8.decode});var J8=K((_r)=>{Object.defineProperty(_r,"__esModule",{value:!0});_r.decodeProtectedHeader=void 0;var jC=qr(),pC=N(),vC=l();function xC(t){let c;if(typeof t==="string"){let u=t.split(".");if(u.length===3||u.length===5)[c]=u}else if(typeof t==="object"&&t)if("protected"in t)c=t.protected;else throw TypeError("Token does not contain a Protected Header");try{if(typeof c!=="string"||!c)throw Error();let u=JSON.parse(pC.decoder.decode((0,jC.decode)(c)));if(!(0,vC.default)(u))throw Error();return u}catch{throw TypeError("Invalid Token or Protected Header formatting")}}_r.decodeProtectedHeader=xC});var w8=K((Kr)=>{Object.defineProperty(Kr,"__esModule",{value:!0});Kr.decodeJwt=void 0;var LC=qr(),sC=N(),mC=l(),tt=C();function gC(t){if(typeof t!=="string")throw new tt.JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");let{1:c,length:u}=t.split(".");if(u===5)throw new tt.JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");if(u!==3)throw new tt.JWTInvalid("Invalid JWT");if(!c)throw new tt.JWTInvalid("JWTs must contain a payload");let r;try{r=(0,LC.decode)(c)}catch{throw new tt.JWTInvalid("Failed to base64url decode the payload")}let n;try{n=JSON.parse(sC.decoder.decode(r))}catch{throw new tt.JWTInvalid("Failed to parse the decoded payload as JSON")}if(!(0,mC.default)(n))throw new tt.JWTInvalid("Invalid JWT Claims Set");return n}Kr.decodeJwt=gC});var Jd=K((et)=>{Object.defineProperty(et,"__esModule",{value:!0});et.generateKeyPair=et.generateSecret=void 0;var P8=require("crypto"),BC=require("util"),FC=rc(),$8=Kc(),Oc=C(),X1=(0,BC.promisify)(P8.generateKeyPair);async function kC(t,c){let u;switch(t){case"HS256":case"HS384":case"HS512":case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":u=parseInt(t.slice(-3),10);break;case"A128KW":case"A192KW":case"A256KW":case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":u=parseInt(t.slice(1,4),10);break;default:throw new Oc.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return(0,P8.createSecretKey)((0,FC.default)(new Uint8Array(u>>3)))}et.generateSecret=kC;async function UC(t,c){var u,r;switch(t){case"RS256":case"RS384":case"RS512":case"PS256":case"PS384":case"PS512":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":case"RSA1_5":{let f=(u=c===null||c===void 0?void 0:c.modulusLength)!==null&&u!==void 0?u:2048;if(typeof f!=="number"||f<2048)throw new Oc.JOSENotSupported("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");let d=await X1("rsa",{modulusLength:f,publicExponent:65537});return(0,$8.setModulusLength)(d.privateKey,f),(0,$8.setModulusLength)(d.publicKey,f),d}case"ES256":return X1("ec",{namedCurve:"P-256"});case"ES256K":return X1("ec",{namedCurve:"secp256k1"});case"ES384":return X1("ec",{namedCurve:"P-384"});case"ES512":return X1("ec",{namedCurve:"P-521"});case"EdDSA":switch(c===null||c===void 0?void 0:c.crv){case void 0:case"Ed25519":return X1("ed25519");case"Ed448":return X1("ed448");default:throw new Oc.JOSENotSupported("Invalid or unsupported crv option provided, supported values are Ed25519 and Ed448")}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":let n=(r=c===null||c===void 0?void 0:c.crv)!==null&&r!==void 0?r:"P-256";switch(n){case void 0:case"P-256":case"P-384":case"P-521":return X1("ec",{namedCurve:n});case"X25519":return X1("x25519");case"X448":return X1("x448");default:throw new Oc.JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}default:throw new Oc.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}}et.generateKeyPair=UC});var A8=K((Wr)=>{Object.defineProperty(Wr,"__esModule",{value:!0});Wr.generateKeyPair=void 0;var oC=Jd();async function lC(t,c){return(0,oC.generateKeyPair)(t,c)}Wr.generateKeyPair=lC});var S8=K((Jr)=>{Object.defineProperty(Jr,"__esModule",{value:!0});Jr.generateSecret=void 0;var QC=Jd();async function aC(t,c){return(0,QC.generateSecret)(t,c)}Jr.generateSecret=aC});var y8=K((wd)=>{Object.defineProperty(wd,"__esModule",{value:!0});wd.default="node:crypto"});var H8=K(($d)=>{Object.defineProperty($d,"__esModule",{value:!0});var tO=y8();$d.default=tO.default});var Ad=K((S)=>{Object.defineProperty(S,"__esModule",{value:!0});S.cryptoRuntime=S.base64url=S.generateSecret=S.generateKeyPair=S.errors=S.decodeJwt=S.decodeProtectedHeader=S.importJWK=S.importX509=S.importPKCS8=S.importSPKI=S.exportJWK=S.exportSPKI=S.exportPKCS8=S.UnsecuredJWT=S.createRemoteJWKSet=S.createLocalJWKSet=S.EmbeddedJWK=S.calculateJwkThumbprintUri=S.calculateJwkThumbprint=S.EncryptJWT=S.SignJWT=S.GeneralSign=S.FlattenedSign=S.CompactSign=S.FlattenedEncrypt=S.CompactEncrypt=S.jwtDecrypt=S.jwtVerify=S.generalVerify=S.flattenedVerify=S.compactVerify=S.GeneralEncrypt=S.generalDecrypt=S.flattenedDecrypt=S.compactDecrypt=void 0;var cO=Zf();Object.defineProperty(S,"compactDecrypt",{enumerable:!0,get:function(){return cO.compactDecrypt}});var uO=Vu();Object.defineProperty(S,"flattenedDecrypt",{enumerable:!0,get:function(){return uO.flattenedDecrypt}});var rO=q4();Object.defineProperty(S,"generalDecrypt",{enumerable:!0,get:function(){return rO.generalDecrypt}});var nO=H4();Object.defineProperty(S,"GeneralEncrypt",{enumerable:!0,get:function(){return nO.GeneralEncrypt}});var fO=kf();Object.defineProperty(S,"compactVerify",{enumerable:!0,get:function(){return fO.compactVerify}});var dO=su();Object.defineProperty(S,"flattenedVerify",{enumerable:!0,get:function(){return dO.flattenedVerify}});var hO=R4();Object.defineProperty(S,"generalVerify",{enumerable:!0,get:function(){return hO.generalVerify}});var qO=T4();Object.defineProperty(S,"jwtVerify",{enumerable:!0,get:function(){return qO.jwtVerify}});var _O=D4();Object.defineProperty(S,"jwtDecrypt",{enumerable:!0,get:function(){return _O.jwtDecrypt}});var KO=rd();Object.defineProperty(S,"CompactEncrypt",{enumerable:!0,get:function(){return KO.CompactEncrypt}});var WO=ju();Object.defineProperty(S,"FlattenedEncrypt",{enumerable:!0,get:function(){return WO.FlattenedEncrypt}});var JO=fd();Object.defineProperty(S,"CompactSign",{enumerable:!0,get:function(){return JO.CompactSign}});var wO=lu();Object.defineProperty(S,"FlattenedSign",{enumerable:!0,get:function(){return wO.FlattenedSign}});var $O=L4();Object.defineProperty(S,"GeneralSign",{enumerable:!0,get:function(){return $O.GeneralSign}});var PO=B4();Object.defineProperty(S,"SignJWT",{enumerable:!0,get:function(){return PO.SignJWT}});var AO=k4();Object.defineProperty(S,"EncryptJWT",{enumerable:!0,get:function(){return AO.EncryptJWT}});var C8=l4();Object.defineProperty(S,"calculateJwkThumbprint",{enumerable:!0,get:function(){return C8.calculateJwkThumbprint}});Object.defineProperty(S,"calculateJwkThumbprintUri",{enumerable:!0,get:function(){return C8.calculateJwkThumbprintUri}});var SO=a4();Object.defineProperty(S,"EmbeddedJWK",{enumerable:!0,get:function(){return SO.EmbeddedJWK}});var yO=qd();Object.defineProperty(S,"createLocalJWKSet",{enumerable:!0,get:function(){return yO.createLocalJWKSet}});var HO=q8();Object.defineProperty(S,"createRemoteJWKSet",{enumerable:!0,get:function(){return HO.createRemoteJWKSet}});var CO=K8();Object.defineProperty(S,"UnsecuredJWT",{enumerable:!0,get:function(){return CO.UnsecuredJWT}});var Pd=Yf();Object.defineProperty(S,"exportPKCS8",{enumerable:!0,get:function(){return Pd.exportPKCS8}});Object.defineProperty(S,"exportSPKI",{enumerable:!0,get:function(){return Pd.exportSPKI}});Object.defineProperty(S,"exportJWK",{enumerable:!0,get:function(){return Pd.exportJWK}});var wr=Pc();Object.defineProperty(S,"importSPKI",{enumerable:!0,get:function(){return wr.importSPKI}});Object.defineProperty(S,"importPKCS8",{enumerable:!0,get:function(){return wr.importPKCS8}});Object.defineProperty(S,"importX509",{enumerable:!0,get:function(){return wr.importX509}});Object.defineProperty(S,"importJWK",{enumerable:!0,get:function(){return wr.importJWK}});var OO=J8();Object.defineProperty(S,"decodeProtectedHeader",{enumerable:!0,get:function(){return OO.decodeProtectedHeader}});var GO=w8();Object.defineProperty(S,"decodeJwt",{enumerable:!0,get:function(){return GO.decodeJwt}});S.errors=C();var ZO=A8();Object.defineProperty(S,"generateKeyPair",{enumerable:!0,get:function(){return ZO.generateKeyPair}});var IO=S8();Object.defineProperty(S,"generateSecret",{enumerable:!0,get:function(){return IO.generateSecret}});S.base64url=qr();var XO=H8();Object.defineProperty(S,"cryptoRuntime",{enumerable:!0,get:function(){return XO.default}})});var Pr=K((EY,O8)=>{function $r(t){Error.call(this,t),Error.captureStackTrace(this,this.constructor),this.name="JwksError",this.message=t}$r.prototype=Object.create(Error.prototype);$r.prototype.constructor=$r;O8.exports=$r});var Sd=K((YY,Z8)=>{var G8=Ad(),EO=Pr();function YO(t){if(t.alg)return t.alg;if(t.kty==="RSA")return"RS256";if(t.kty==="EC")switch(t.crv){case"P-256":return"ES256";case"secp256k1":return"ES256K";case"P-384":return"ES384";case"P-521":return"ES512"}if(t.kty==="OKP")switch(t.crv){case"Ed25519":case"Ed448":return"EdDSA"}throw new EO("Unsupported JWK")}async function zO(t){let c=[];t=t.filter(({use:u})=>u==="sig"||u===void 0).filter(({kty:u})=>u==="RSA"||u==="EC"||u==="OKP");for(let u of t)try{let r=await G8.importJWK({...u,ext:!0},YO(u));if(r.type!=="public")continue;let n;switch(r[Symbol.toStringTag]){case"CryptoKey":{let f=await G8.exportSPKI(r);n=()=>f;break}case"KeyObject":default:n=()=>r.export({format:"pem",type:"spki"})}c.push({get publicKey(){return n()},get rsaPublicKey(){return n()},getPublicKey(){return n()},...typeof u.kid==="string"&&u.kid?{kid:u.kid}:void 0,...typeof u.alg==="string"&&u.alg?{alg:u.alg}:void 0})}catch(r){continue}return c}Z8.exports={retrieveSigningKeys:zO}});var yd=K((zY,I8)=>{function Ar(t){Error.call(this,t),Error.captureStackTrace(this,this.constructor),this.name="ArgumentError",this.message=t}Ar.prototype=Object.create(Error.prototype);Ar.prototype.constructor=Ar;I8.exports=Ar});var E8=K((RY,X8)=>{var RO=require("http"),iO=require("https"),VO=yd();X8.exports.default=(t)=>{if(t.fetcher)return t.fetcher(t.uri);return new Promise((c,u)=>{let r;try{r=new URL(t.uri)}catch(w){throw new VO("Invalid JWKS URI: The provided URI is not a valid URL.")}let{hostname:n,port:f,protocol:d,pathname:h,search:_}=r,q=h+_,W={hostname:n,path:q,port:f,method:"GET",...t.headers&&{headers:{...t.headers}},...t.timeout&&{timeout:t.timeout},...t.agent&&{agent:t.agent}},$=(d==="https:"?iO:RO).request(W,(w)=>{let P="";w.setEncoding("utf8"),w.on("data",(A)=>{P+=A}),w.on("end",()=>{if(w.statusCode<200||w.statusCode>=300){let A=w.body&&(w.body.message||w.body)||w.statusMessage||`Http Error ${w.statusCode}`;u({errorMsg:A})}else try{c(P&&JSON.parse(P))}catch(A){u(A)}})});$.on("timeout",()=>$.destroy()).on("error",(w)=>u(w)).end()})}});var z8=K((iY,Y8)=>{Y8.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let c=this.head;c;c=c.next)yield c.value}}});var i8=K((VY,R8)=>{R8.exports=Y;Y.Node=ct;Y.create=Y;function Y(t){var c=this;if(!(c instanceof Y))c=new Y;if(c.tail=null,c.head=null,c.length=0,t&&typeof t.forEach==="function")t.forEach(function(n){c.push(n)});else if(arguments.length>0)for(var u=0,r=arguments.length;u<r;u++)c.push(arguments[u]);return c}Y.prototype.removeNode=function(t){if(t.list!==this)throw Error("removing node which does not belong to this list");var{next:c,prev:u}=t;if(c)c.prev=u;if(u)u.next=c;if(t===this.head)this.head=c;if(t===this.tail)this.tail=u;return t.list.length--,t.next=null,t.prev=null,t.list=null,c};Y.prototype.unshiftNode=function(t){if(t===this.head)return;if(t.list)t.list.removeNode(t);var c=this.head;if(t.list=this,t.next=c,c)c.prev=t;if(this.head=t,!this.tail)this.tail=t;this.length++};Y.prototype.pushNode=function(t){if(t===this.tail)return;if(t.list)t.list.removeNode(t);var c=this.tail;if(t.list=this,t.prev=c,c)c.next=t;if(this.tail=t,!this.head)this.head=t;this.length++};Y.prototype.push=function(){for(var t=0,c=arguments.length;t<c;t++)NO(this,arguments[t]);return this.length};Y.prototype.unshift=function(){for(var t=0,c=arguments.length;t<c;t++)TO(this,arguments[t]);return this.length};Y.prototype.pop=function(){if(!this.tail)return;var t=this.tail.value;if(this.tail=this.tail.prev,this.tail)this.tail.next=null;else this.head=null;return this.length--,t};Y.prototype.shift=function(){if(!this.head)return;var t=this.head.value;if(this.head=this.head.next,this.head)this.head.prev=null;else this.tail=null;return this.length--,t};Y.prototype.forEach=function(t,c){c=c||this;for(var u=this.head,r=0;u!==null;r++)t.call(c,u.value,r,this),u=u.next};Y.prototype.forEachReverse=function(t,c){c=c||this;for(var u=this.tail,r=this.length-1;u!==null;r--)t.call(c,u.value,r,this),u=u.prev};Y.prototype.get=function(t){for(var c=0,u=this.head;u!==null&&c<t;c++)u=u.next;if(c===t&&u!==null)return u.value};Y.prototype.getReverse=function(t){for(var c=0,u=this.tail;u!==null&&c<t;c++)u=u.prev;if(c===t&&u!==null)return u.value};Y.prototype.map=function(t,c){c=c||this;var u=new Y;for(var r=this.head;r!==null;)u.push(t.call(c,r.value,this)),r=r.next;return u};Y.prototype.mapReverse=function(t,c){c=c||this;var u=new Y;for(var r=this.tail;r!==null;)u.push(t.call(c,r.value,this)),r=r.prev;return u};Y.prototype.reduce=function(t,c){var u,r=this.head;if(arguments.length>1)u=c;else if(this.head)r=this.head.next,u=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var n=0;r!==null;n++)u=t(u,r.value,n),r=r.next;return u};Y.prototype.reduceReverse=function(t,c){var u,r=this.tail;if(arguments.length>1)u=c;else if(this.tail)r=this.tail.prev,u=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(var n=this.length-1;r!==null;n--)u=t(u,r.value,n),r=r.prev;return u};Y.prototype.toArray=function(){var t=Array(this.length);for(var c=0,u=this.head;u!==null;c++)t[c]=u.value,u=u.next;return t};Y.prototype.toArrayReverse=function(){var t=Array(this.length);for(var c=0,u=this.tail;u!==null;c++)t[c]=u.value,u=u.prev;return t};Y.prototype.slice=function(t,c){if(c=c||this.length,c<0)c+=this.length;if(t=t||0,t<0)t+=this.length;var u=new Y;if(c<t||c<0)return u;if(t<0)t=0;if(c>this.length)c=this.length;for(var r=0,n=this.head;n!==null&&r<t;r++)n=n.next;for(;n!==null&&r<c;r++,n=n.next)u.push(n.value);return u};Y.prototype.sliceReverse=function(t,c){if(c=c||this.length,c<0)c+=this.length;if(t=t||0,t<0)t+=this.length;var u=new Y;if(c<t||c<0)return u;if(t<0)t=0;if(c>this.length)c=this.length;for(var r=this.length,n=this.tail;n!==null&&r>c;r--)n=n.prev;for(;n!==null&&r>t;r--,n=n.prev)u.push(n.value);return u};Y.prototype.splice=function(t,c,...u){if(t>this.length)t=this.length-1;if(t<0)t=this.length+t;for(var r=0,n=this.head;n!==null&&r<t;r++)n=n.next;var f=[];for(var r=0;n&&r<c;r++)f.push(n.value),n=this.removeNode(n);if(n===null)n=this.tail;if(n!==this.head&&n!==this.tail)n=n.prev;for(var r=0;r<u.length;r++)n=MO(this,n,u[r]);return f};Y.prototype.reverse=function(){var t=this.head,c=this.tail;for(var u=t;u!==null;u=u.prev){var r=u.prev;u.prev=u.next,u.next=r}return this.head=c,this.tail=t,this};function MO(t,c,u){var r=c===t.head?new ct(u,null,c,t):new ct(u,c,c.next,t);if(r.next===null)t.tail=r;if(r.prev===null)t.head=r;return t.length++,r}function NO(t,c){if(t.tail=new ct(c,t.tail,null,t),!t.head)t.head=t.tail;t.length++}function TO(t,c){if(t.head=new ct(c,null,t.head,t),!t.tail)t.tail=t.head;t.length++}function ct(t,c,u,r){if(!(this instanceof ct))return new ct(t,c,u,r);if(this.list=r,this.value=t,c)c.next=this,this.prev=c;else this.prev=null;if(u)u.prev=this,this.next=u;else this.next=null}try{z8()(Y)}catch(t){}});var Od=K((MY,b8)=>{var DO=i8(),ut=Symbol("max"),i1=Symbol("length"),jt=Symbol("lengthCalculator"),Zc=Symbol("allowStale"),rt=Symbol("maxAge"),R1=Symbol("dispose"),V8=Symbol("noDisposeOnSet"),x=Symbol("lruList"),H1=Symbol("cache"),N8=Symbol("updateAgeOnGet"),Hd=()=>1;class T8{constructor(t){if(typeof t==="number")t={max:t};if(!t)t={};if(t.max&&(typeof t.max!=="number"||t.max<0))throw TypeError("max must be a non-negative number");let c=this[ut]=t.max||1/0,u=t.length||Hd;if(this[jt]=typeof u!=="function"?Hd:u,this[Zc]=t.stale||!1,t.maxAge&&typeof t.maxAge!=="number")throw TypeError("maxAge must be a number");this[rt]=t.maxAge||0,this[R1]=t.dispose,this[V8]=t.noDisposeOnSet||!1,this[N8]=t.updateAgeOnGet||!1,this.reset()}set max(t){if(typeof t!=="number"||t<0)throw TypeError("max must be a non-negative number");this[ut]=t||1/0,Gc(this)}get max(){return this[ut]}set allowStale(t){this[Zc]=!!t}get allowStale(){return this[Zc]}set maxAge(t){if(typeof t!=="number")throw TypeError("maxAge must be a non-negative number");this[rt]=t,Gc(this)}get maxAge(){return this[rt]}set lengthCalculator(t){if(typeof t!=="function")t=Hd;if(t!==this[jt])this[jt]=t,this[i1]=0,this[x].forEach((c)=>{c.length=this[jt](c.value,c.key),this[i1]+=c.length});Gc(this)}get lengthCalculator(){return this[jt]}get length(){return this[i1]}get itemCount(){return this[x].length}rforEach(t,c){c=c||this;for(let u=this[x].tail;u!==null;){let r=u.prev;M8(this,t,u,c),u=r}}forEach(t,c){c=c||this;for(let u=this[x].head;u!==null;){let r=u.next;M8(this,t,u,c),u=r}}keys(){return this[x].toArray().map((t)=>t.key)}values(){return this[x].toArray().map((t)=>t.value)}reset(){if(this[R1]&&this[x]&&this[x].length)this[x].forEach((t)=>this[R1](t.key,t.value));this[H1]=new Map,this[x]=new DO,this[i1]=0}dump(){return this[x].map((t)=>Sr(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter((t)=>t)}dumpLru(){return this[x]}set(t,c,u){if(u=u||this[rt],u&&typeof u!=="number")throw TypeError("maxAge must be a number");let r=u?Date.now():0,n=this[jt](c,t);if(this[H1].has(t)){if(n>this[ut])return pt(this,this[H1].get(t)),!1;let h=this[H1].get(t).value;if(this[R1]){if(!this[V8])this[R1](t,h.value)}return h.now=r,h.maxAge=u,h.value=c,this[i1]+=n-h.length,h.length=n,this.get(t),Gc(this),!0}let f=new D8(t,c,n,r,u);if(f.length>this[ut]){if(this[R1])this[R1](t,c);return!1}return this[i1]+=f.length,this[x].unshift(f),this[H1].set(t,this[x].head),Gc(this),!0}has(t){if(!this[H1].has(t))return!1;let c=this[H1].get(t).value;return!Sr(this,c)}get(t){return Cd(this,t,!0)}peek(t){return Cd(this,t,!1)}pop(){let t=this[x].tail;if(!t)return null;return pt(this,t),t.value}del(t){pt(this,this[H1].get(t))}load(t){this.reset();let c=Date.now();for(let u=t.length-1;u>=0;u--){let r=t[u],n=r.e||0;if(n===0)this.set(r.k,r.v);else{let f=n-c;if(f>0)this.set(r.k,r.v,f)}}}prune(){this[H1].forEach((t,c)=>Cd(this,c,!1))}}var Cd=(t,c,u)=>{let r=t[H1].get(c);if(r){let n=r.value;if(Sr(t,n)){if(pt(t,r),!t[Zc])return}else if(u){if(t[N8])r.value.now=Date.now();t[x].unshiftNode(r)}return n.value}},Sr=(t,c)=>{if(!c||!c.maxAge&&!t[rt])return!1;let u=Date.now()-c.now;return c.maxAge?u>c.maxAge:t[rt]&&u>t[rt]},Gc=(t)=>{if(t[i1]>t[ut])for(let c=t[x].tail;t[i1]>t[ut]&&c!==null;){let u=c.prev;pt(t,c),c=u}},pt=(t,c)=>{if(c){let u=c.value;if(t[R1])t[R1](u.key,u.value);t[i1]-=u.length,t[H1].delete(u.key),t[x].removeNode(c)}};class D8{constructor(t,c,u,r,n){this.key=t,this.value=c,this.length=u,this.now=r,this.maxAge=n||0}}var M8=(t,c,u,r)=>{let n=u.value;if(Sr(t,n)){if(pt(t,u),!t[Zc])n=void 0}if(n)c.call(r,n.value,n.key,t)};b8.exports=T8});var bd=K((Ic,vt)=>{var bO=200,k8="__lodash_hash_undefined__",U8=9007199254740991,Rd="[object Arguments]",eO="[object Array]",o8="[object Boolean]",l8="[object Date]",jO="[object Error]",id="[object Function]",Q8="[object GeneratorFunction]",yr="[object Map]",a8="[object Number]",Vd="[object Object]",e8="[object Promise]",tK="[object RegExp]",Hr="[object Set]",cK="[object String]",uK="[object Symbol]",Zd="[object WeakMap]",rK="[object ArrayBuffer]",Cr="[object DataView]",nK="[object Float32Array]",fK="[object Float64Array]",dK="[object Int8Array]",hK="[object Int16Array]",qK="[object Int32Array]",_K="[object Uint8Array]",KK="[object Uint8ClampedArray]",WK="[object Uint16Array]",JK="[object Uint32Array]",pO=/[\\^$.*+?()[\]{}|]/g,vO=/\w*$/,xO=/^\[object .+?Constructor\]$/,LO=/^(?:0|[1-9]\d*)$/,i={};i[Rd]=i[eO]=i[rK]=i[Cr]=i[o8]=i[l8]=i[nK]=i[fK]=i[dK]=i[hK]=i[qK]=i[yr]=i[a8]=i[Vd]=i[tK]=i[Hr]=i[cK]=i[uK]=i[_K]=i[KK]=i[WK]=i[JK]=!0;i[jO]=i[id]=i[Zd]=!1;var sO=typeof global=="object"&&global&&global.Object===Object&&global,mO=typeof self=="object"&&self&&self.Object===Object&&self,V1=sO||mO||Function("return this")(),wK=typeof Ic=="object"&&Ic&&!Ic.nodeType&&Ic,j8=wK&&typeof vt=="object"&&vt&&!vt.nodeType&&vt,gO=j8&&j8.exports===wK;function BO(t,c){return t.set(c[0],c[1]),t}function FO(t,c){return t.add(c),t}function kO(t,c){var u=-1,r=t?t.length:0;while(++u<r)if(c(t[u],u,t)===!1)break;return t}function UO(t,c){var u=-1,r=c.length,n=t.length;while(++u<r)t[n+u]=c[u];return t}function $K(t,c,u,r){var n=-1,f=t?t.length:0;if(r&&f)u=t[++n];while(++n<f)u=c(u,t[n],n,t);return u}function oO(t,c){var u=-1,r=Array(t);while(++u<t)r[u]=c(u);return r}function lO(t,c){return t==null?void 0:t[c]}function PK(t){var c=!1;if(t!=null&&typeof t.toString!="function")try{c=!!(t+"")}catch(u){}return c}function p8(t){var c=-1,u=Array(t.size);return t.forEach(function(r,n){u[++c]=[n,r]}),u}function Md(t,c){return function(u){return t(c(u))}}function v8(t){var c=-1,u=Array(t.size);return t.forEach(function(r){u[++c]=r}),u}var QO=Array.prototype,aO=Function.prototype,Or=Object.prototype,Gd=V1["__core-js_shared__"],x8=function(){var t=/[^.]+$/.exec(Gd&&Gd.keys&&Gd.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),AK=aO.toString,B1=Or.hasOwnProperty,Gr=Or.toString,tG=RegExp("^"+AK.call(B1).replace(pO,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),L8=gO?V1.Buffer:void 0,s8=V1.Symbol,m8=V1.Uint8Array,cG=Md(Object.getPrototypeOf,Object),uG=Object.create,rG=Or.propertyIsEnumerable,nG=QO.splice,g8=Object.getOwnPropertySymbols,fG=L8?L8.isBuffer:void 0,dG=Md(Object.keys,Object),Id=st(V1,"DataView"),Xc=st(V1,"Map"),Xd=st(V1,"Promise"),Ed=st(V1,"Set"),Yd=st(V1,"WeakMap"),Ec=st(Object,"create"),hG=dt(Id),qG=dt(Xc),_G=dt(Xd),KG=dt(Ed),WG=dt(Yd),B8=s8?s8.prototype:void 0,F8=B8?B8.valueOf:void 0;function ft(t){var c=-1,u=t?t.length:0;this.clear();while(++c<u){var r=t[c];this.set(r[0],r[1])}}function JG(){this.__data__=Ec?Ec(null):{}}function wG(t){return this.has(t)&&delete this.__data__[t]}function $G(t){var c=this.__data__;if(Ec){var u=c[t];return u===k8?void 0:u}return B1.call(c,t)?c[t]:void 0}function PG(t){var c=this.__data__;return Ec?c[t]!==void 0:B1.call(c,t)}function AG(t,c){var u=this.__data__;return u[t]=Ec&&c===void 0?k8:c,this}ft.prototype.clear=JG;ft.prototype.delete=wG;ft.prototype.get=$G;ft.prototype.has=PG;ft.prototype.set=AG;function M1(t){var c=-1,u=t?t.length:0;this.clear();while(++c<u){var r=t[c];this.set(r[0],r[1])}}function SG(){this.__data__=[]}function yG(t){var c=this.__data__,u=Zr(c,t);if(u<0)return!1;var r=c.length-1;if(u==r)c.pop();else nG.call(c,u,1);return!0}function HG(t){var c=this.__data__,u=Zr(c,t);return u<0?void 0:c[u][1]}function CG(t){return Zr(this.__data__,t)>-1}function OG(t,c){var u=this.__data__,r=Zr(u,t);if(r<0)u.push([t,c]);else u[r][1]=c;return this}M1.prototype.clear=SG;M1.prototype.delete=yG;M1.prototype.get=HG;M1.prototype.has=CG;M1.prototype.set=OG;function xt(t){var c=-1,u=t?t.length:0;this.clear();while(++c<u){var r=t[c];this.set(r[0],r[1])}}function GG(){this.__data__={hash:new ft,map:new(Xc||M1),string:new ft}}function ZG(t){return Ir(this,t).delete(t)}function IG(t){return Ir(this,t).get(t)}function XG(t){return Ir(this,t).has(t)}function EG(t,c){return Ir(this,t).set(t,c),this}xt.prototype.clear=GG;xt.prototype.delete=ZG;xt.prototype.get=IG;xt.prototype.has=XG;xt.prototype.set=EG;function Lt(t){this.__data__=new M1(t)}function YG(){this.__data__=new M1}function zG(t){return this.__data__.delete(t)}function RG(t){return this.__data__.get(t)}function iG(t){return this.__data__.has(t)}function VG(t,c){var u=this.__data__;if(u instanceof M1){var r=u.__data__;if(!Xc||r.length<bO-1)return r.push([t,c]),this;u=this.__data__=new xt(r)}return u.set(t,c),this}Lt.prototype.clear=YG;Lt.prototype.delete=zG;Lt.prototype.get=RG;Lt.prototype.has=iG;Lt.prototype.set=VG;function MG(t,c){var u=Td(t)||uZ(t)?oO(t.length,String):[],r=u.length,n=!!r;for(var f in t)if((c||B1.call(t,f))&&!(n&&(f=="length"||QG(f,r))))u.push(f);return u}function SK(t,c,u){var r=t[c];if(!(B1.call(t,c)&&OK(r,u))||u===void 0&&!(c in t))t[c]=u}function Zr(t,c){var u=t.length;while(u--)if(OK(t[u][0],c))return u;return-1}function NG(t,c){return t&&yK(c,Dd(c),t)}function zd(t,c,u,r,n,f,d){var h;if(r)h=f?r(t,n,f,d):r(t);if(h!==void 0)return h;if(!Xr(t))return t;var _=Td(t);if(_){if(h=UG(t),!c)return BG(t,h)}else{var q=nt(t),W=q==id||q==Q8;if(nZ(t))return pG(t,c);if(q==Vd||q==Rd||W&&!f){if(PK(t))return f?t:{};if(h=oG(W?{}:t),!c)return FG(t,NG(h,t))}else{if(!i[q])return f?t:{};h=lG(t,q,zd,c)}}d||(d=new Lt);var J=d.get(t);if(J)return J;if(d.set(t,h),!_)var $=u?kG(t):Dd(t);return kO($||t,function(w,P){if($)P=w,w=t[P];SK(h,P,zd(w,c,u,r,P,t,d))}),h}function TG(t){return Xr(t)?uG(t):{}}function DG(t,c,u){var r=c(t);return Td(t)?r:UO(r,u(t))}function bG(t){return Gr.call(t)}function eG(t){if(!Xr(t)||tZ(t))return!1;var c=ZK(t)||PK(t)?tG:xO;return c.test(dt(t))}function jG(t){if(!CK(t))return dG(t);var c=[];for(var u in Object(t))if(B1.call(t,u)&&u!="constructor")c.push(u);return c}function pG(t,c){if(c)return t.slice();var u=new t.constructor(t.length);return t.copy(u),u}function Nd(t){var c=new t.constructor(t.byteLength);return new m8(c).set(new m8(t)),c}function vG(t,c){var u=c?Nd(t.buffer):t.buffer;return new t.constructor(u,t.byteOffset,t.byteLength)}function xG(t,c,u){var r=c?u(p8(t),!0):p8(t);return $K(r,BO,new t.constructor)}function LG(t){var c=new t.constructor(t.source,vO.exec(t));return c.lastIndex=t.lastIndex,c}function sG(t,c,u){var r=c?u(v8(t),!0):v8(t);return $K(r,FO,new t.constructor)}function mG(t){return F8?Object(F8.call(t)):{}}function gG(t,c){var u=c?Nd(t.buffer):t.buffer;return new t.constructor(u,t.byteOffset,t.length)}function BG(t,c){var u=-1,r=t.length;c||(c=Array(r));while(++u<r)c[u]=t[u];return c}function yK(t,c,u,r){u||(u={});var n=-1,f=c.length;while(++n<f){var d=c[n],h=r?r(u[d],t[d],d,u,t):void 0;SK(u,d,h===void 0?t[d]:h)}return u}function FG(t,c){return yK(t,HK(t),c)}function kG(t){return DG(t,Dd,HK)}function Ir(t,c){var u=t.__data__;return aG(c)?u[typeof c=="string"?"string":"hash"]:u.map}function st(t,c){var u=lO(t,c);return eG(u)?u:void 0}var HK=g8?Md(g8,Object):hZ,nt=bG;if(Id&&nt(new Id(new ArrayBuffer(1)))!=Cr||Xc&&nt(new Xc)!=yr||Xd&&nt(Xd.resolve())!=e8||Ed&&nt(new Ed)!=Hr||Yd&&nt(new Yd)!=Zd)nt=function(t){var c=Gr.call(t),u=c==Vd?t.constructor:void 0,r=u?dt(u):void 0;if(r)switch(r){case hG:return Cr;case qG:return yr;case _G:return e8;case KG:return Hr;case WG:return Zd}return c};function UG(t){var c=t.length,u=t.constructor(c);if(c&&typeof t[0]=="string"&&B1.call(t,"index"))u.index=t.index,u.input=t.input;return u}function oG(t){return typeof t.constructor=="function"&&!CK(t)?TG(cG(t)):{}}function lG(t,c,u,r){var n=t.constructor;switch(c){case rK:return Nd(t);case o8:case l8:return new n(+t);case Cr:return vG(t,r);case nK:case fK:case dK:case hK:case qK:case _K:case KK:case WK:case JK:return gG(t,r);case yr:return xG(t,r,u);case a8:case cK:return new n(t);case tK:return LG(t);case Hr:return sG(t,r,u);case uK:return mG(t)}}function QG(t,c){return c=c==null?U8:c,!!c&&(typeof t=="number"||LO.test(t))&&(t>-1&&t%1==0&&t<c)}function aG(t){var c=typeof t;return c=="string"||c=="number"||c=="symbol"||c=="boolean"?t!=="__proto__":t===null}function tZ(t){return!!x8&&x8 in t}function CK(t){var c=t&&t.constructor,u=typeof c=="function"&&c.prototype||Or;return t===u}function dt(t){if(t!=null){try{return AK.call(t)}catch(c){}try{return t+""}catch(c){}}return""}function cZ(t){return zd(t,!0,!0)}function OK(t,c){return t===c||t!==t&&c!==c}function uZ(t){return rZ(t)&&B1.call(t,"callee")&&(!rG.call(t,"callee")||Gr.call(t)==Rd)}var Td=Array.isArray;function GK(t){return t!=null&&fZ(t.length)&&!ZK(t)}function rZ(t){return dZ(t)&&GK(t)}var nZ=fG||qZ;function ZK(t){var c=Xr(t)?Gr.call(t):"";return c==id||c==Q8}function fZ(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=U8}function Xr(t){var c=typeof t;return!!t&&(c=="object"||c=="function")}function dZ(t){return!!t&&typeof t=="object"}function Dd(t){return GK(t)?MG(t):jG(t)}function hZ(){return[]}function qZ(){return!1}vt.exports=cZ});var ed=K((Er)=>{Object.defineProperty(Er,"__esModule",{value:!0});Er.deepFreeze=void 0;function IK(t){if(t)Object.freeze(t),Object.getOwnPropertyNames(t).forEach(function(c){if(t.hasOwnProperty(c)&&t[c]!==null&&(typeof t[c]==="object"||typeof t[c]==="function")&&t[c].constructor!==Buffer&&!Object.isFrozen(t[c]))IK(t[c])});return t}Er.deepFreeze=IK});var zK=K((Y1)=>{var _Z=Y1&&Y1.__read||function(t,c){var u=typeof Symbol==="function"&&t[Symbol.iterator];if(!u)return t;var r=u.call(t),n,f=[],d;try{while((c===void 0||c-- >0)&&!(n=r.next()).done)f.push(n.value)}catch(h){d={error:h}}finally{try{if(n&&!n.done&&(u=r.return))u.call(r)}finally{if(d)throw d.error}}return f},E1=Y1&&Y1.__spread||function(){for(var t=[],c=0;c<arguments.length;c++)t=t.concat(_Z(arguments[c]));return t},YK=Y1&&Y1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Y1,"__esModule",{value:!0});Y1.syncMemoizer=void 0;var KZ=YK(Od()),WZ=require("events"),XK=YK(bd()),EK=ed();function JZ(t){var c=new KZ.default(t),u=t.load,r=t.hash,n=t.bypass,f=t.itemMaxAge,d=t.freeze,h=t.clone,_=new WZ.EventEmitter,q=Object.assign({del:W,reset:function(){return c.reset()},keys:c.keys.bind(c),on:_.on.bind(_),once:_.once.bind(_)},t);if(t.disable)return Object.assign(u,q);function W(){var A=r.apply(void 0,E1(arguments));c.del(A)}function J(A){var G=[];for(var I=1;I<arguments.length;I++)G[I-1]=arguments[I];_.emit.apply(_,E1([A],G))}function $(A){return A&&A.then&&typeof A.then==="function"}function w(A){var G=A;if(h)if($(G))G=G.then(XK.default);else G=XK.default(G);if(d)if($(G))G=G.then(EK.deepFreeze);else EK.deepFreeze(G);return G}var P=function(){var A=[];for(var G=0;G<arguments.length;G++)A[G]=arguments[G];if(n&&n.apply(void 0,E1(A)))return J.apply(void 0,E1(["miss"],A)),u.apply(void 0,E1(A));var I=r.apply(void 0,E1(A)),E=c.get(I);if(E)return J.apply(void 0,E1(["hit"],A)),w(E);J.apply(void 0,E1(["miss"],A));var O=u.apply(void 0,E1(A));if(f)c.set(I,O,f.apply(void 0,E1(A.concat([O]))));else c.set(I,O);return w(O)};return Object.assign(P,q)}Y1.syncMemoizer=JZ});var VK=K((W1)=>{var wZ=W1&&W1.__read||function(t,c){var u=typeof Symbol==="function"&&t[Symbol.iterator];if(!u)return t;var r=u.call(t),n,f=[],d;try{while((c===void 0||c-- >0)&&!(n=r.next()).done)f.push(n.value)}catch(h){d={error:h}}finally{try{if(n&&!n.done&&(u=r.return))u.call(r)}finally{if(d)throw d.error}}return f},Q=W1&&W1.__spread||function(){for(var t=[],c=0;c<arguments.length;c++)t=t.concat(wZ(arguments[c]));return t},$Z=W1&&W1.__values||function(t){var c=typeof Symbol==="function"&&Symbol.iterator,u=c&&t[c],r=0;if(u)return u.call(t);if(t&&typeof t.length==="number")return{next:function(){if(t&&r>=t.length)t=void 0;return{value:t&&t[r++],done:!t}}};throw TypeError(c?"Object is not iterable.":"Symbol.iterator is not defined.")},RK=W1&&W1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(W1,"__esModule",{value:!0});W1.asyncMemoizer=void 0;var PZ=RK(Od()),AZ=require("events"),SZ=RK(bd()),yZ=ed(),HZ=zK();function iK(t){var c=new PZ.default(t),u=t.load,r=t.hash,n=t.bypass,f=t.itemMaxAge,d=t.freeze,h=t.clone,_=t.queueMaxAge||1000,q=new Map,W=new AZ.EventEmitter,J=Object.assign({del:$,reset:function(){return c.reset()},keys:c.keys.bind(c),on:W.on.bind(W),once:W.once.bind(W)},t);if(t.disable)return Object.assign(u,J);function $(){var I=[];for(var E=0;E<arguments.length;E++)I[E]=arguments[E];var O=r.apply(void 0,Q(I));c.del(O)}function w(I,E,O){if(d)O.forEach(yZ.deepFreeze);if(f)c.set(I,O,f.apply(void 0,Q(E.concat(O))));else c.set(I,O)}function P(I,E){var O,j;try{for(var a=$Z(I),c1=a.next();!c1.done;c1=a.next()){var N1=c1.value;if(h)setImmediate.apply(void 0,Q([N1],E.map(SZ.default)));else setImmediate.apply(void 0,Q([N1],E))}}catch(F1){O={error:F1}}finally{try{if(c1&&!c1.done&&(j=a.return))j.call(a)}finally{if(O)throw O.error}}}function A(I){var E=[];for(var O=1;O<arguments.length;O++)E[O-1]=arguments[O];W.emit.apply(W,Q([I],E))}function G(){var I=[];for(var E=0;E<arguments.length;E++)I[E]=arguments[E];var O=I.slice(0,-1),j=I.slice(-1).pop(),a;if(n&&n.apply(void 0,Q(O)))return A.apply(void 0,Q(["miss"],O)),u.apply(void 0,Q(I));if(O.length===0&&!r)a="_";else a=r.apply(void 0,Q(O));var c1=c.get(a);if(c1)return A.apply(void 0,Q(["hit"],O)),P([j],[null].concat(c1));var N1=q.get(a);if(N1&&N1.expiresAt>Date.now()){N1.queue.push(j),A.apply(void 0,Q(["queue"],O));return}A.apply(void 0,Q(["miss"],O));var F1=Date.now(),zc=[j];q.set(a,{queue:zc,expiresAt:F1+_});var GW=function(){var Rc=[];for(var ic=0;ic<arguments.length;ic++)Rc[ic]=arguments[ic];var ZW=Rc[0];if(!ZW)w(a,O,Rc.slice(1));q.delete(a),A.apply(void 0,Q(["loaded",Date.now()-F1],O)),P(zc,Rc)};u.apply(void 0,Q(O,[GW]))}return Object.assign(G,J)}W1.asyncMemoizer=iK;iK.sync=HZ.syncMemoizer});var NK=K((bY,MK)=>{var CZ=VK();MK.exports=CZ.asyncMemoizer});var DK=K((eY,TK)=>{var OZ=Pu()("jwks"),GZ=NK(),{promisify:ZZ,callbackify:IZ}=require("util");function XZ(t,{cacheMaxEntries:c=5,cacheMaxAge:u=600000}){return OZ(`Configured caching of signing keys. Max: ${c} / Age: ${u}`),ZZ(GZ({hash:(r)=>r,load:IZ(t.getSigningKey.bind(t)),maxAge:u,max:c}))}TK.exports.default=XZ});var jd=K((jY,eK)=>{var bK=function(t,c,u,r){if(this.bucketSize=t,this.tokensPerInterval=c,typeof u==="string")switch(u){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 "+u)}else this.interval=u;this.parentBucket=r,this.content=0,this.lastDrip=+new Date};bK.prototype={bucketSize:1,tokensPerInterval:1,interval:1000,parentBucket:null,content:0,lastDrip:0,removeTokens:function(t,c){var u=this;if(!this.bucketSize)return process.nextTick(c.bind(null,null,t,Number.POSITIVE_INFINITY)),!0;if(t>this.bucketSize)return process.nextTick(c.bind(null,"Requested tokens "+t+" exceeds bucket size "+this.bucketSize,null)),!1;if(this.drip(),t>this.content)return r();if(this.parentBucket)return this.parentBucket.removeTokens(t,function(n,f){if(n)return c(n,null);if(t>u.content)return r();u.content-=t,c(null,Math.min(f,u.content))});else return this.content-=t,process.nextTick(c.bind(null,null,this.content)),!0;function r(){var n=Math.ceil((t-u.content)*(u.interval/u.tokensPerInterval));return setTimeout(function(){u.removeTokens(t,c)},n),!1}},tryRemoveTokens:function(t){if(!this.bucketSize)return!0;if(t>this.bucketSize)return!1;if(this.drip(),t>this.content)return!1;if(this.parentBucket&&!this.parentBucket.tryRemoveTokens(t))return!1;return this.content-=t,!0},drip:function(){if(!this.tokensPerInterval){this.content=this.bucketSize;return}var t=+new Date,c=Math.max(t-this.lastDrip,0);this.lastDrip=t;var u=c*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+u,this.bucketSize)}};eK.exports=bK});var pK=K((pY,jK)=>{var EZ=function(){if(typeof process<"u"&&process.hrtime){var t=process.hrtime(),c=t[0],u=t[1];return c*1000+Math.floor(u/1e6)}return new Date().getTime()};jK.exports=EZ});var LK=K((vY,xK)=>{var YZ=jd(),pd=pK(),vK=function(t,c,u){this.tokenBucket=new YZ(t,t,c,null),this.tokenBucket.content=t,this.curIntervalStart=pd(),this.tokensThisInterval=0,this.fireImmediately=u};vK.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(t,c){if(t>this.tokenBucket.bucketSize)return process.nextTick(c.bind(null,"Requested tokens "+t+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var u=this,r=pd();if(r<this.curIntervalStart||r-this.curIntervalStart>=this.tokenBucket.interval)this.curIntervalStart=r,this.tokensThisInterval=0;if(t>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)process.nextTick(c.bind(null,null,-1));else{var n=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-r);setTimeout(function(){u.tokenBucket.removeTokens(t,f)},n)}return!1}return this.tokenBucket.removeTokens(t,f);function f(d,h){if(d)return c(d,null);u.tokensThisInterval+=t,c(null,h)}},tryRemoveTokens:function(t){if(t>this.tokenBucket.bucketSize)return!1;var c=pd();if(c<this.curIntervalStart||c-this.curIntervalStart>=this.tokenBucket.interval)this.curIntervalStart=c,this.tokensThisInterval=0;if(t>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var u=this.tokenBucket.tryRemoveTokens(t);if(u)this.tokensThisInterval+=t;return u},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}};xK.exports=vK});var sK=K((vd)=>{vd.RateLimiter=LK();vd.TokenBucket=jd()});var xd=K((LY,mK)=>{function Yr(t){Error.call(this,t),Error.captureStackTrace(this,this.constructor),this.name="JwksRateLimitError",this.message=t}Yr.prototype=Object.create(Error.prototype);Yr.prototype.constructor=Yr;mK.exports=Yr});var BK=K((sY,gK)=>{var Ld=Pu()("jwks"),{RateLimiter:zZ}=sK(),RZ=xd();function iZ(t,{jwksRequestsPerMinute:c=10}){let u=t.getSigningKey.bind(t),r=new zZ(c,"minute",!0);return Ld(`Configured rate limiting to JWKS endpoint at ${c}/minute`),async(n)=>await new Promise((f,d)=>{r.removeTokens(1,async(h,_)=>{if(h)d(h);if(Ld("Requests to the JWKS endpoint available for the next minute:",_),_<0)Ld("Too many requests to the JWKS endpoint"),d(new RZ("Too many requests to the JWKS endpoint"));else try{let q=await u(n);f(q)}catch(q){d(q)}})})}gK.exports.default=iZ});var kK=K((mY,FK)=>{var VZ=Sd().retrieveSigningKeys;function MZ(t,{getKeysInterceptor:c}){let u=t.getSigningKey.bind(t);return async(r)=>{let n=await c(),f;if(n&&n.length)f=await VZ(n);if(f&&f.length){let d=f.find((h)=>!r||h.kid===r);if(d)return d}return u(r)}}FK.exports.default=MZ});var oK=K((gY,UK)=>{var{callbackify:NZ}=require("util"),TZ=(t)=>{let c=t.getSigningKey.bind(t);return(u,r)=>{if(r)return NZ(c)(u,r);return c(u)}};UK.exports.default=TZ});var QK=K((BY,lK)=>{lK.exports={request:E8().default,cacheSigningKey:DK().default,rateLimitSigningKey:BK().default,getKeysInterceptor:kK().default,callbackSupport:oK().default}});var sd=K((FY,aK)=>{function zr(t){Error.call(this,t),Error.captureStackTrace(this,this.constructor),this.name="SigningKeyNotFoundError",this.message=t}zr.prototype=Object.create(Error.prototype);zr.prototype.constructor=zr;aK.exports=zr});var mt=K((kY,uW)=>{var ht=Pu()("jwks"),{retrieveSigningKeys:DZ}=Sd(),{request:bZ,cacheSigningKey:eZ,rateLimitSigningKey:jZ,getKeysInterceptor:pZ,callbackSupport:vZ}=QK(),md=Pr(),tW=sd();class cW{constructor(t){if(this.options={rateLimit:!1,cache:!0,timeout:30000,...t},this.options.getKeysInterceptor)this.getSigningKey=pZ(this,t);if(this.options.rateLimit)this.getSigningKey=jZ(this,t);if(this.options.cache)this.getSigningKey=eZ(this,t);this.getSigningKey=vZ(this,t)}async getKeys(){ht(`Fetching keys from '${this.options.jwksUri}'`);try{let t=await bZ({uri:this.options.jwksUri,headers:this.options.requestHeaders,agent:this.options.requestAgent,timeout:this.options.timeout,fetcher:this.options.fetcher});return ht("Keys:",t.keys),t.keys}catch(t){let{errorMsg:c}=t;throw ht("Failure:",c||t),c?new md(c):t}}async getSigningKeys(){let t=await this.getKeys();if(!t||!t.length)throw new md("The JWKS endpoint did not contain any keys");let c=await DZ(t);if(!c.length)throw new md("The JWKS endpoint did not contain any signing keys");return ht("Signing Keys:",c),c}async getSigningKey(t){ht(`Fetching signing key for '${t}'`);let c=await this.getSigningKeys(),u=t!==void 0&&t!==null;if(!u&&c.length>1)throw ht("No KID specified and JWKS endpoint returned more than 1 key"),new tW("No KID specified and JWKS endpoint returned more than 1 key");let r=c.find((n)=>!u||n.kid===t);if(r)return r;else throw ht(`Unable to find a signing key that matches '${t}'`),new tW(`Unable to find a signing key that matches '${t}'`)}}uW.exports={JwksClient:cW}});var gt=K((UY,rW)=>{rW.exports={ArgumentError:yd(),JwksError:Pr(),JwksRateLimitError:xd(),SigningKeyNotFoundError:sd()}});var Yc=K((oY,nW)=>{var xZ=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES256K","ES384","ES512","EdDSA"];nW.exports=xZ});var fW=K((lY,Rr)=>{var{ArgumentError:LZ}=gt(),{JwksClient:sZ}=mt(),mZ=Yc(),gZ=(t,c)=>{if(t&&t.name==="SigningKeyNotFoundError")return c(t,null,null);if(t)return c(t,null,null)};Rr.exports.hapiJwt2KeyAsync=(t)=>{let c=Rr.exports.hapiJwt2Key(t);return function(u){return new Promise((r,n)=>{c(u,(d,h)=>{!h||d?n(d):r({key:h})})})}};Rr.exports.hapiJwt2Key=function(t){if(t===null||t===void 0)throw new LZ("An options object must be provided when initializing hapiJwt2Key");let c=new sZ(t),u=t.handleSigningKeyError||gZ;return function(n,f){if(!n||!n.header)return f(Error("Cannot find a signing certificate if there is no header"),null,null);if(!mZ.includes(n.header.alg))return f(Error("Unsupported algorithm "+n.header.alg+" supplied."),null,null);c.getSigningKey(n.header.kid).then((d)=>{return f(null,d.publicKey||d.rsaPublicKey,d)}).catch((d)=>{return u(d,(h)=>f(h,null,null))})}}});var hW=K((QY,dW)=>{var{ArgumentError:BZ}=gt(),{JwksClient:FZ}=mt(),kZ=Yc(),UZ=(t,c)=>{if(t&&t.name==="SigningKeyNotFoundError")return c(null);if(t)return c(t)};dW.exports.expressJwtSecret=function(t){if(t===null||t===void 0)throw new BZ("An options object must be provided when initializing expressJwtSecret");let c=new FZ(t),u=t.handleSigningKeyError||UZ,r=async(n,f)=>{if(!f)return;let d=f.header;if(!d||!kZ.includes(d.alg))return;try{let h=await c.getSigningKey(d.kid);return h.publicKey||h.rsaPublicKey}catch(h){return new Promise((_,q)=>{u(h,(W)=>{if(!W)return _();q(W)})})}};return function(f,d,h,_){if(arguments.length===4){r(f,{header:d}).then((q)=>{setImmediate(_,null,q)}).catch((q)=>{setImmediate(_,q)});return}return r(f,arguments[1])}}});var _W=K((aY,qW)=>{var{ArgumentError:oZ}=gt(),{JwksClient:lZ}=mt(),QZ=Yc();qW.exports.koaJwtSecret=function(t={}){if(!t.jwksUri)throw new oZ("No JWKS provided. Please provide a jwksUri");let c=new lZ(t);return function({alg:r,kid:n}={}){return new Promise((f,d)=>{if(!QZ.includes(r))return d(Error("Missing / invalid token algorithm"));c.getSigningKey(n).then((h)=>{f(h.publicKey||h.rsaPublicKey)}).catch((h)=>{if(t.handleSigningKeyError)return t.handleSigningKeyError(h).then(d);return d(h)})})}}});var wW=K((tz,JW)=>{var KW=Ad(),{ArgumentError:WW}=gt(),{JwksClient:aZ}=mt(),tI=Yc(),cI=(t,c)=>{if(t&&t.name==="SigningKeyNotFoundError")return c(null);if(t)return c(t)};JW.exports.passportJwtSecret=function(t){if(t===null||t===void 0)throw new WW("An options object must be provided when initializing passportJwtSecret");if(!t.jwksUri)throw new WW("No JWKS provided. Please provide a jwksUri");let c=new aZ(t),u=t.handleSigningKeyError||cI;return function(n,f,d){let h;try{h={payload:KW.decodeJwt(f),header:KW.decodeProtectedHeader(f)}}catch(_){h=null}if(!h||!tI.includes(h.header.alg))return d(null,null);c.getSigningKey(h.header.kid).then((_)=>{d(null,_.publicKey||_.rsaPublicKey)}).catch((_)=>{u(_,(q)=>d(q,null))})}}});var PW=K((cz,J1)=>{var{JwksClient:$W}=mt(),ir=gt(),{hapiJwt2Key:uI,hapiJwt2KeyAsync:rI}=fW(),{expressJwtSecret:nI}=hW(),{koaJwtSecret:fI}=_W(),{passportJwtSecret:dI}=wW();J1.exports=(t)=>{return new $W(t)};J1.exports.JwksClient=$W;J1.exports.ArgumentError=ir.ArgumentError;J1.exports.JwksError=ir.JwksError;J1.exports.JwksRateLimitError=ir.JwksRateLimitError;J1.exports.SigningKeyNotFoundError=ir.SigningKeyNotFoundError;J1.exports.expressJwtSecret=nI;J1.exports.hapiJwt2Key=uI;J1.exports.hapiJwt2KeyAsync=rI;J1.exports.koaJwtSecret=fI;J1.exports.passportJwtSecret=dI});var $I={};th($I,{isAuthorized:()=>OW,handler:()=>WI});module.exports=ad($I);var Tr=require("node:crypto");function Dr(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function AI(t){let c=t.replace(/-/g,"+").replace(/_/g,"/");return Buffer.from(c,"base64").toString()}var ch=`<!DOCTYPE html>
|
|
5
|
+
`+o),e.push(i+"m+"+mn.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Eb()+t+" "+e[0]}function Eb(){if(X.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function Sb(...e){return process.stderr.write(hn.formatWithOptions(X.inspectOpts,...e)+`
|
|
6
|
+
`)}function bb(e){if(e)process.env.DEBUG=e;else delete process.env.DEBUG}function vb(){return process.env.DEBUG}function Ab(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=wo()(X);var{formatters:Uf}=mn.exports;Uf.o=function(e){return this.inspectOpts.colors=this.useColors,hn.inspect(e,this.inspectOpts).split(`
|
|
7
|
+
`).map((t)=>t.trim()).join(" ")};Uf.O=function(e){return this.inspectOpts.colors=this.useColors,hn.inspect(e,this.inspectOpts)}});var yn=m(function(PT,bo){if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)bo.exports=jf();else bo.exports=Hf()});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 vo(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 Ao(e){let t=Math.floor(e/4294967296),r=e%4294967296,n=new Uint8Array(8);return vo(n,t,0),vo(n,r,4),n}function gn(e){let t=new Uint8Array(4);return vo(t,e),t}function q(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 xo(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");xo(e,r)}var wn=(e,t="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);function Bf(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)=>Bf("Key must be ",e,...t),sr=(e,t,...r)=>Bf(`Key for the ${e} algorithm must be `,t,...r);var To={};Vt(To,{JOSEAlgNotAllowed:()=>Ve,JOSEError:()=>z,JOSENotSupported:()=>k,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,k,Le,w,A,U,cr,ur,vt,Sn,bn,Xe;var _=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"};k=class k 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 Mf(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 Gf(e,t){if(t.length<<3!==e.ivBits)throw new w("Invalid Initialization Vector length")}async function zf(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 Vf(e,t,r){return new Uint8Array((await crypto.subtle.sign("HMAC",e,t)).slice(0,r>>3))}async function Tb(e,t,r,n,i){let[o,s,a]=await zf(e,r,"encrypt"),f=new Uint8Array(await crypto.subtle.encrypt({iv:n,name:"AES-CBC"},o,t)),c=B(i,n,f,Ao(i.length*8)),u=await Vf(s,c,a);return{ciphertext:f,tag:u,iv:n}}async function Cb(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 Ib(e,t,r,n,i,o){let[s,a,f]=await zf(e,t,"decrypt"),c=B(o,n,r,Ao(o.length*8)),u=await Vf(a,c,f);try{if(await Cb(i,u))return new Uint8Array(await crypto.subtle.decrypt({iv:n,name:"AES-CBC"},s,r))}catch{}throw new Le}async function Rb(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 Ob(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)Gf(e,n);else n=xb(e);if(r instanceof Uint8Array)Mf(r,e.cekBits);return e.cbc?Tb(e,t,r,n,i):Rb(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(Gf(e,n),t instanceof Uint8Array)Mf(t,e.cekBits);return e.cbc?Ib(e,t,r,n,i,o):Ob(e,t,r,n,i,o)}var Ee=(e)=>crypto.getRandomValues(new Uint8Array(e.cekBits>>3)),xb=(e)=>crypto.getRandomValues(new Uint8Array(e.ivBits>>3));var lr=x(()=>{ie();_()});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(Co,{cause:r})}let t=e;if(t instanceof Uint8Array)t=ze.decode(t);if(t.includes("+")||t.includes("/"))throw TypeError(Co);t=t.replace(/-/g,"+").replace(/_/g,"/");try{return In(t)}catch{throw TypeError(Co)}}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 Co="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 kn(e,t,r){try{return q(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(bt.decode(Ae(e)))}catch{throw new t(r)}if(!R(n))throw new t(r);return n}var Xf;var Q=x(()=>{oe();ie();Xf=Symbol()});async function Se(e,t){if(t.kty==="RSA"&&"oth"in t&&t.oth!==void 0)throw new k('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');if(!e.kty.includes(t.kty))throw new k('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(()=>{_()});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 _b(e,t,r){let{alg:n,secret:i}=e,o=r==="decrypt"||r==="sign";if(i&&t instanceof Uint8Array)return[Zf,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 kb(e,s,r),[tl,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(`${Io(t)} instances for symmetric algorithms must be of type "secret"`)}else{if(t.type==="secret")throw TypeError(`${Io(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(`${Io(t)} instances for asymmetric algorithm ${a} must be of type "${s}"`)}}return we(t)?[Qf,t]:[el,t]}function Pn(e,t,r){Ro||=new WeakMap;let n=Ro.get(e);if(r)if(n)n[t]=r;else Ro.set(e,{[t]:r});return r??n?.[t]}async function le(e,t,r){let n=_b(e,t,r);switch(n[0]){case Zf:case Qf:return n[1];case tl:{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 Yf(i,o,e)}case el:{let i=n[1];if(i.type==="secret")return i.export();if("toCryptoKey"in i&&typeof i.toCryptoKey==="function")return Kb(i,e);return Yf(i,i.export({format:"jwk"}),e)}}}var Io=(e)=>e[Symbol.toStringTag],kb=(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`)}},Zf=0,Qf=1,el=2,tl=3,Ro,Pb,Yf=async(e,t,r)=>Pn(e,r.alg)??Pn(e,r.alg,await Se(r,{...t,alg:r.alg})),Kb=(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=Pb[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();Pb={__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:$b,ops:["wrapKey","unwrapKey"]}}function $n(){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 k('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:t}},usages:Nb,ops:[void 0,"deriveBits"]}}function Ct(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 Oo(){return{kty:["oct"],secret:!0,subtle:{name:"PBKDF2"},usages:Nn,ops:["deriveBits","deriveBits"]}}function It(e,t=!1){return{kty:["oct"],secret:!0,subtle:{name:t?"AES-CBC":"AES-GCM",length:e},usages:Nn,ops:Lb,cekBits:e,ivBits:t?128:96,cbc:t}}function rl(e,t){throw new k(`Invalid or unsupported "${e}" (JWE ${t}) header value`)}function de(e){return(typeof e==="string"?ko[e]:void 0)??rl("alg","Algorithm")}function Ze(e){return(typeof e==="string"?Jb[e]:void 0)??rl("enc","Encryption Algorithm")}var $b,Nb,Nn,ko,Lb,Jb;var Rt=x(()=>{_();$b=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],Nb=[[],["deriveBits"]],Nn=[[],[]];ko=dr({dir:{kty:["oct"],secret:!0,subtle:{name:"AES-GCM"},usages:Nn,ops:["encrypt","decrypt"]},"RSA-OAEP":Kn(1),"RSA-OAEP-256":Kn(256),"RSA-OAEP-384":Kn(384),"RSA-OAEP-512":Kn(512),"ECDH-ES":$n(),"ECDH-ES+A128KW":$n(),"ECDH-ES+A192KW":$n(),"ECDH-ES+A256KW":$n(),A128KW:Ct(128),A192KW:Ct(192),A256KW:Ct(256),A128GCMKW:Ct(128,!0),A192GCMKW:Ct(192,!0),A256GCMKW:Ct(256,!0),"PBES2-HS256+A128KW":Oo(),"PBES2-HS384+A192KW":Oo(),"PBES2-HS512+A256KW":Oo()}),Lb=["encrypt","decrypt"];Jb=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 nl(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");xo(e,t)}async function ol(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 _o(e,t,r){let n=await ol(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 Po(e,t,r){let n=await ol(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 sl(e,t,r){Te(t,de(e).subtle,r),En(e,t)}function Wb(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 al(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(q(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 Wb(n,t);return new Uint8Array(await crypto.subtle.deriveBits(s,a,o))}function Ko(e){return B(gn(e.length),e)}async function jb(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(gn(a),e,r));s.set(f,(a-1)*32)}return s.slice(0,n)}async function cl(e,t,r,n,i=new Uint8Array,o=new Uint8Array){nl(e),nl(t,"deriveBits");let s=B(Ko(q(r)),Ko(i),Ko(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 jb(a,n,s)}function ul(e){vn(e);let t=e.algorithm.namedCurve;if(t!=="P-256"&&t!=="P-384"&&t!=="P-521"&&e.algorithm.name!=="X25519")throw new k("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 il(e){if(e!==void 0)throw new w("Encountered unexpected JWE Encrypted Key")}async function fl(e,t,r,n,i,o){let s=de(e);if(e==="dir")return il(n),r;switch(s.subtle.name){case"ECDH":{if(e==="ECDH-ES")il(n);if(!R(i.epk))throw new w('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');ul(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 cl(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),Po(e.slice(-6),u,n)}case"RSA-OAEP":return pr(n),vn(r),sl(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 al(f,e,i.p2c,r);return Po(e.slice(-6),c,n)}case"AES-KW":return pr(n),Po(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":{ul(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 cl(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 _o(T,y,a);break}case"RSA-OAEP":{a=n||Ee(t),vn(r),sl(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 al(u,e,c,r);o=await _o(e.slice(-6),l,a),s={p2c:c,p2s:K(u)};break}case"AES-KW":{a=n||Ee(t),o=await _o(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();_();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 k(`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 kt(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 _t=x(()=>{_();Ot={__proto__:null,b64:!0},Wn={__proto__:null}});function Dn(e,t){if(e.zip!==void 0&&e.zip!=="DEF")throw new k('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 ll(e){if(typeof globalThis[e]>"u")throw new k(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${e} API.`)}async function dl(e){ll("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 pl(e,t){ll("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 $o=x(()=>{_();ie()});function qn(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 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 No(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?q(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,q("."),kn(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 Lo(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 hl(e,t,r,n,a)}async function hl(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"),F;try{if(F=await fl(S,y,j,T,i,f),h!==void 0&&F instanceof Uint8Array&&F.byteLength<<3!==y.cekBits)F=Ee(y)}catch(N){if(N instanceof TypeError||N instanceof w||N instanceof k)throw N;F=Ee(y)}let V=await Tn(y,F,l,p,d,g);if(i.zip==="DEF"){let N=c??250000;if(N===0)throw new k('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 pl(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 ml(e,t,r){return Lo(e,No(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=q(n),p=[u,M(s,"ciphertext",w),o?M(o,"iv",w):void 0,a?M(a,"tag",w):void 0,l];return hl(c,p,t,r,u)}var mr=x(()=>{lr();Q();_();Jn();ie();_t();Ye();Rt();$o()});async function yl(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 gl=x(()=>{mr()});async function wl(e,t,r){if(!R(e))throw new w("Flattened JWE must be an object");let n=qn(e),[i,,o]=Fn(e);if(!i)throw o;let s={...n,...i};return Un(s),Hn(s,await ml(s,We(r),t))}var El=x(()=>{_();mr()});async function Sl(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=qn(e),a=No(s)}catch{throw new Le}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 Un(u),Hn(u,await Lo(u,a,o,t))}catch{}}throw new Le}var bl=x(()=>{mr();_()});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 Jo(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 Wo(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,F;if(h)j=K(JSON.stringify(h)),F=q(j);else j="",F=new Uint8Array;let V,N;if(u?.byteLength)N=K(u),V=B(F,q("."),q(N));else V=F;let ee=s;if(n.zip==="DEF")ee=await dl(ee).catch((Rh)=>{throw new w("Failed to compress plaintext",{cause:Rh})});let{ciphertext:ct,tag:Ms,iv:Gs}=await xn(o,ee,T,p,V),Pe={ciphertext:K(ct)};if(Gs)Pe.iv=K(Gs);if(Ms)Pe.tag=K(Ms);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?Xf in r:!1;return Wo(e,Jo(e),t)}var yr=x(()=>{oe();lr();Jn();_();ie();_t();Ye();Rt();$o();Q()});class Al{#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 vl(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 jo{#e;#t=[];#n;#o;#s;constructor(e){this.#e=e}addRecipient(e,t){let r=new Al(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 vl(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=Jo(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 Wo(n[0],i[0],u);s.ciphertext=y.ciphertext,s.iv=y.iv,s.tag=y.tag,l.encrypted_key=y.encrypted_key,vl(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 xl=x(()=>{Q();_();lr();Jn();oe();yr();Ye();Rt()});async function Tl(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 Cl(e,t,r){let n=await Tl(e,t,"sign"),i=await crypto.subtle.sign(e.signing,n,r);return new Uint8Array(i)}async function Il(e,t,r,n){let i=await Tl(e,t,"verify");try{return await crypto.subtle.verify(e.signing,i,r,n)}catch{return!1}}var Do=()=>{};function qo(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 Fo(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:`SHA-${t}`},usages:gr}}function Rl(){let e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:gr}}function Uo(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 k(`alg ${e} is not supported either by JOSE or your javascript runtime`);return t}var gr,wr;var $t=x(()=>{_();gr=[["verify"],["sign"]];wr=dr({HS256:qo(256),HS384:qo(384),HS512:qo(512),RS256:Pt(256),RS384:Pt(384),RS512:Pt(512),PS256:Pt(256,32),PS384:Pt(384,48),PS512:Pt(512,64),ES256:Fo("P-256",256),ES384:Fo("P-384",384),ES512:Fo("P-521",512),EdDSA:Rl(),Ed25519:Rl(),"ML-DSA-44":Uo(44),"ML-DSA-65":Uo(65),"ML-DSA-87":Uo(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 Ol(e,t,r){let n=kt(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 Db(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,...Ol(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 qb(e){try{return q(e)}catch{throw new A("JWS Compact Serialization payload must use only ASCII characters")}}async function kl(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?q(n):new Uint8Array,q("."),f?t[2]??=kn(s,"payload",A):s),l=M(e.signature,"signature",A),p=await le(c,r,"verify");if(!await Il(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]=Db(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 kl(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]=Ol(f,f,t),l=c?i:qb(i);return kl(a,t,r,n,f,u,l)}var Er=x(()=>{Do();$t();_();ie();Q();_t();Ye()});async function _l(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 Pl=x(()=>{Er()});async function Kl(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 $l=x(()=>{_();Er()});function Fb(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 Nl(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)=>Fb(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 Ll=x(()=>{Er();_()});function Ho(){throw TypeError("Invalid time period format")}function Qn(e){if(typeof e!=="string")Ho();let t=Hb.exec(e);if(!t||t[4]&&t[1])Ho();let r=parseFloat(t[2]),n=Math.round(r*Ub[t[3][0].toLowerCase()]);if(!Number.isFinite(n))Ho();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 Bo(e,t){if(typeof t!=="string")throw TypeError(`"${e}" claim must be a string`)}function Bb(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 Mo(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 Go(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 zo(e,t){throw new ge(`unexpected "${t}" claim value`,e,t,Nt)}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"||Jl(e.typ)!==Jl(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))zo(n,"iss");if(a!==void 0&&n.sub!==a)zo(n,"sub");if(f!==void 0&&!Mb(n.aud,typeof f==="string"?[f]:f))zo(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=Go(n,"iat",c!==void 0),S=Go(n,"nbf");if(S!==void 0){if(S>g+p)throw new ge('"nbf" claim timestamp check failed',n,"nbf",Nt)}let E=Go(n,"exp");if(E!==void 0){if(E<=g-p)throw new ar('"exp" claim timestamp check failed',n,"exp",Nt)}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",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 Wl.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");(Wl||=new WeakMap).set(this,structuredClone(e))}setIssuer(e){return Bo("iss",e),Ie(this).iss=e,this}setSubject(e){return Bo("sub",e),Ie(this).sub=e,this}setAudience(e){return Bb(e),Ie(this).aud=e,this}setJti(e){return Bo("jti",e),Ie(this).jti=e,this}setNotBefore(e){return Ie(this).nbf=Mo(e,"setNotBefore"),this}setExpirationTime(e){return Ie(this).exp=Mo(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=Mo(e,"setIssuedAt");return this}}var Sr=(e)=>Math.floor(e.getTime()/1000),Ub,Hb,Nt="check_failed",Jl=(e)=>{let t=e.toLowerCase();return e.includes("/")?t:`application/${t}`},Mb=(e,t)=>{if(typeof e==="string")return t.includes(e);if(Array.isArray(e))return t.some((r)=>e.includes(r));return!1},Wl;var jt=x(()=>{_();ie();Ub={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},Hb=/^(\+|\-)? ?(\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 jl(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 Dl=x(()=>{Er();jt();_()});async function ql(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 Fl=x(()=>{mr();jt();_()});class Vo{#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 Ul=x(()=>{Q();yr()});class Xo{#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 Hl=x(()=>{Q();yr()});function Bl(e){if(e===void 0)return[void 0,""];let t=Qe(A,e);return[t[0],K(t[1])]}function Ml(e,t,r){return jn(A,e),kt(e,xe(A,Ot,r,e,t))}function Gl(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 zl(e,t,r,n){let i=B(q(e),q("."),t),o=await le(r,n,"sign");return K(await Cl(r,o,i))}async function ti(e,t,r){let{protectedHeader:n,unprotectedHeader:i}=e,o;if([n,o]=Bl(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=Ml(n,s,e.crit);r?.(a);let f=Gl(s),c,u;if(a){let p=e.encoded??=[];p[0]??=K(e.payload),p[1]??=q(p[0]),c=p[0],u=p[1]}else u=e.payload,c="";let l={signature:await zl(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]=Bl(t);if(!o)throw new A("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Ml(o,o,r))i();let f=Gl(o),c=K(e),u=await zl(s,q(c),f,n);return`${s}.${c}.${u}`}var br=x(()=>{oe();Do();$t();_();ie();_t();Ye()});class Yo{#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 Vl=x(()=>{br();Q()});class Zo{#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 Xl=x(()=>{br();Q()});class Yl{#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 Qo{#e;#t=[];constructor(e){this.#e=e}addSignature(e,t){let r=new Yl(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 Zl=x(()=>{br();_();Q()});var Gb,es;var Ql=x(()=>{br();_();jt();Q();Gb=et;es=class es extends Gb{#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 zb,ts;var ed=x(()=>{yr();jt();Q();zb=et;ts=class ts extends zb{#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 k(`Invalid or unsupported ${e} value`)}function rt(e,t){return(typeof e==="string"?wr[e]??ko[e]:void 0)??tt(t)}var qe='"alg" (Algorithm)';var vr=x(()=>{_();$t();Rt()});function Fe(e){if(e!==void 0&&typeof e!=="boolean")throw TypeError('"extractable" option must be a boolean');return e}function Yb(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 Qb(e){let t=od(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)td(t,6);else td(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 Vb=(e,t)=>{let r=(e.match(/.{1,64}/g)||[]).join(`
|
|
8
|
+
`);return`-----BEGIN ${t}-----
|
|
9
|
+
${r}
|
|
10
|
+
-----END ${t}-----`},rd=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 Vb(Cn(new Uint8Array(await crypto.subtle.exportKey(t,r))),`${e.toUpperCase()} KEY`)},nd=(e)=>rd("public","spki",e),id=(e)=>rd("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},od=(e)=>({data:e,pos:0}),rs=(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=rs(e);if(t&128){let r=t&127,n=0;for(let i=0;i<r;i++)n=n<<8|rs(e);return n}return t},td=(e,t=1)=>{while(t-- >0){e.pos++;let r=Re(e);e.pos+=r}},Ue=(e,t,r)=>{if(rs(e)!==t)throw Error(r)},sd=(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},Xb=(e)=>{Ue(e,6,"Expected algorithm OID");let t=Re(e);return sd(e,t)},Zb=(e)=>{let t=Xb(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=sd(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")},ns=async(e,t,r,n)=>{let i=Fe(n?.extractable),o=rt(r,qe);if(o.secret)tt(qe);let s=e==="spki",a;if(o.resolve)try{let f=od(t);Yb(f,e),a=o.resolve({crv:Zb(f)})}catch{throw new k("Invalid or unsupported key format")}else a=o.subtle;return crypto.subtle.importKey(e,t,a,i??s,o.usages[s?0:1])},is=(e,t)=>In(e.replace(t,"")),ad=(e,t,r)=>{let n=is(e,/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g);return ns("pkcs8",n,t,r)},cd=(e,t,r)=>{let n=is(e,/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g);return ns("spki",n,t,r)},ud=(e,t,r)=>{let n;try{let i=is(e,/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g);n=Qb(i)}catch(i){throw TypeError("Failed to parse the X.509 certificate",{cause:i})}return ns("spki",n,t,r)};var os=x(()=>{_();vr()});function e0(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}async function t0(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}=e0(await crypto.subtle.exportKey("jwk",e));if(o.kty==="AKP")o.alg=n;return o}function fd(e){return nd(e)}function ld(e){return id(e)}function ni(e){return t0(e)}var ss=x(()=>{os();oe()});async function as(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 k('"kty" (Key Type) Parameter missing or unsupported')}let i=q(JSON.stringify(n));return K(await _n(t,i))}async function dd(e,t){t??="sha256";let r=await as(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 pd=x(()=>{Q();oe();_();ie();ss()});async function hd(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 md=x(()=>{At();$t();_()});function r0(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 yd(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 k('Unsupported "alg" value for a JSON Web Key Set');let c=t.keys.filter((p)=>r0(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 yd(r,d,f)}catch{}},p}return yd(r,u,f)},"jwks",{value:()=>structuredClone(t)})}var cs=x(()=>{At();$t();_()});function n0(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}async function i0(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 gd(e,t,r){if(Number.isNaN(e))throw TypeError(`"${r}" option must not be NaN`);return typeof e==="number"?e:t}function wd(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=gd(n.cooldownDuration,30000,"cooldownDuration"),a=gd(n.cacheMaxAge,600000,"cacheMaxAge"),f=new Headers(n.headers);if(us&&!f.has("User-Agent"))f.set("User-Agent",us);if(!f.has("accept"))f.set("accept","application/json, application/jwk-set+json");let c=n[fs],u=n[ls],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&&n0())p=void 0;if(!p){let y=++d,T=p=i0(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 us,fs,ls;var Ed=x(()=>{_();cs();if(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))us="jose/v6.2.10";fs=Symbol();ls=Symbol()});var o0,ds;var Sd=x(()=>{oe();Q();_();jt();_t();o0=et;ds=class ds extends o0{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=kt(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 bd(e,t,r){if(typeof e!=="string"||e.indexOf("-----BEGIN PUBLIC KEY-----")!==0)throw TypeError('"spki" must be SPKI formatted string');return cd(e,t,r)}async function vd(e,t,r){if(typeof e!=="string"||e.indexOf("-----BEGIN CERTIFICATE-----")!==0)throw TypeError('"x509" must be X.509 formatted string');return ud(e,t,r)}async function Ad(e,t,r){if(typeof e!=="string"||e.indexOf("-----BEGIN PRIVATE KEY-----")!==0)throw TypeError('"pkcs8" must be PKCS#8 formatted string');return ad(e,t,r)}async function xd(e,t,r){if(!R(e))throw TypeError("JWK must be an object");let n=Tt(e),i=Fe(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 k('Unsupported "kty" (Key Type) Parameter value')}}var Td=x(()=>{oe();os();At();vr();_()});function Cd(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 Id=x(()=>{Q()});function Rd(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 Od=x(()=>{oe();ie();_()});function s0(e){let t=e?.modulusLength??2048;if(typeof t!=="number"||!Number.isInteger(t)||t<2048)throw new k("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return t}async function kd(e,t){let r=Fe(t?.extractable),n=rt(e,qe);if(n.secret)tt(qe);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 k("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 k(`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:s0(t)}:n.subtle}return crypto.subtle.generateKey(i,r??!1,[...n.usages[1],...n.usages[0]])}var _d=x(()=>{_();vr()});async function Pd(e,t){let r=Fe(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(qe)}return crypto.subtle.generateKey(i,r??!1,o)}var Kd=x(()=>{vr()});var ps={};Vt(ps,{CompactEncrypt:()=>Vo,CompactSign:()=>Yo,EmbeddedJWK:()=>hd,EncryptJWT:()=>ts,FlattenedEncrypt:()=>Xo,FlattenedSign:()=>Zo,GeneralEncrypt:()=>jo,GeneralSign:()=>Qo,SignJWT:()=>es,UnsecuredJWT:()=>ds,base64url:()=>Rn,calculateJwkThumbprint:()=>as,calculateJwkThumbprintUri:()=>dd,compactDecrypt:()=>yl,compactVerify:()=>_l,createLocalJWKSet:()=>xr,createRemoteJWKSet:()=>wd,cryptoRuntime:()=>a0,customFetch:()=>fs,decodeJwt:()=>Rd,decodeProtectedHeader:()=>Cd,errors:()=>To,exportJWK:()=>ni,exportPKCS8:()=>ld,exportSPKI:()=>fd,flattenedDecrypt:()=>wl,flattenedVerify:()=>Kl,generalDecrypt:()=>Sl,generalVerify:()=>Nl,generateKeyPair:()=>kd,generateSecret:()=>Pd,importJWK:()=>xd,importPKCS8:()=>Ad,importSPKI:()=>bd,importX509:()=>vd,jwksCache:()=>ls,jwtDecrypt:()=>ql,jwtVerify:()=>jl});var a0="WebCryptoAPI";var hs=x(()=>{gl();El();bl();xl();Pl();$l();Ll();Dl();Fl();Ul();Hl();Vl();Xl();Zl();Ql();ed();pd();md();cs();Ed();Sd();ss();Td();Id();Od();_();_d();Kd();oe()});var oi=m(function(Ck,$d){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;$d.exports=ii});var ms=m(function(Ik,Ld){var Nd=(hs(),kr(ps)),c0=oi();function u0(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 c0("Unsupported JWK")}async function f0(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 Nd.importJWK({...r,ext:!0},u0(r));if(n.type!=="public")continue;let i;switch(n[Symbol.toStringTag]){case"CryptoKey":{let o=await Nd.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}Ld.exports={retrieveSigningKeys:f0}});var ys=m(function(Rk,Jd){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;Jd.exports=si});var jd=m(function(Ok,Wd){var l0=require("http"),d0=require("https"),p0=ys();Wd.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 p0("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:"?d0:l0).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 qd=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),h0=qd((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")}),m0=qd((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=h0(),y0=m0(),gs=()=>H.metrics.hasSubscribers||H.tracing.hasSubscribers,Fd=new Set,Dd=typeof process=="object"&&process?process:{},g0=(e,t,r,n)=>{typeof Dd.emitWarning=="function"?Dd.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},w0=(e)=>!Fd.has(e),He=(e)=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),Ud=(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)}},E0=class e{heap;length;static#e=!1;static create(t){let r=Ud(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]}},S0=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:F,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??y0.defaultPerf,r!==0&&!He(r))throw TypeError("max option must be a nonnegative integer");let ee=r?Ud(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=E0.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=!!F,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.#q()}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";w0(ct)&&(Fd.add(ct),g0("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}#q(){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.#F=(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.#k=(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=()=>{};#k=()=>{};#F=()=>{};#b=()=>!1;#z(){let t=new ai(this.#e);this.#v=0,this.#x=t,this.#$=(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)}}#$=(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.#N(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.#_(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.#_(t,r,n);return i&&H.metrics.hasSubscribers&&H.metrics.publish(i),o}#_(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.#$(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.#q(),this.#E&&(l||this.#F(d,o,s),c&&this.#k(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.#$(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.#k(i,o));else return n&&this.#K(o),i&&(i.has="hit",this.#k(i,o)),!0}else i&&(i.has="miss");return!1}peek(t,r={}){let{status:n=gs()?{}: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.#_(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.#_(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=gs()?{}: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.#N(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.#k(E,I),O;let F=this.#D(t,I,T,h),V=F.__staleWhileFetching!==void 0&&n;return E&&(E.fetch=j?"stale":"refresh",V&&j&&(E.returnedStale=!0)),V?F.__staleWhileFetching:F.__returned=F}}forceFetch(t,r={}){let n=H.tracing.hasSubscribers,{status:i=gs()?{}: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.#N(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.#_(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.#N(t,r);return n&&(i!==void 0&&(n.value=i),H.metrics.hasSubscribers&&H.metrics.publish(n)),i}#N(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.#k(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.#$(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=S0});var Ps=m(function(Cr,Dt){var b0=200,tp="__lodash_hash_undefined__",rp=9007199254740991,Ts="[object Arguments]",v0="[object Array]",np="[object Boolean]",ip="[object Date]",A0="[object Error]",Cs="[object Function]",op="[object GeneratorFunction]",fi="[object Map]",sp="[object Number]",Is="[object Object]",Hd="[object Promise]",ap="[object RegExp]",li="[object Set]",cp="[object String]",up="[object Symbol]",Es="[object WeakMap]",fp="[object ArrayBuffer]",di="[object DataView]",lp="[object Float32Array]",dp="[object Float64Array]",pp="[object Int8Array]",hp="[object Int16Array]",mp="[object Int32Array]",yp="[object Uint8Array]",gp="[object Uint8ClampedArray]",wp="[object Uint16Array]",Ep="[object Uint32Array]",x0=/[\\^$.*+?()[\]{}|]/g,T0=/\w*$/,C0=/^\[object .+?Constructor\]$/,I0=/^(?:0|[1-9]\d*)$/,J={};J[Ts]=J[v0]=J[fp]=J[di]=J[np]=J[ip]=J[lp]=J[dp]=J[pp]=J[hp]=J[mp]=J[fi]=J[sp]=J[Is]=J[ap]=J[li]=J[cp]=J[up]=J[yp]=J[gp]=J[wp]=J[Ep]=!0;J[A0]=J[Cs]=J[Es]=!1;var R0=typeof global=="object"&&global&&global.Object===Object&&global,O0=typeof self=="object"&&self&&self.Object===Object&&self,ke=R0||O0||Function("return this")(),Sp=typeof Cr=="object"&&Cr&&!Cr.nodeType&&Cr,Bd=Sp&&typeof Dt=="object"&&Dt&&!Dt.nodeType&&Dt,k0=Bd&&Bd.exports===Sp;function _0(e,t){return e.set(t[0],t[1]),e}function P0(e,t){return e.add(t),e}function K0(e,t){var r=-1,n=e?e.length:0;while(++r<n)if(t(e[r],r,e)===!1)break;return e}function $0(e,t){var r=-1,n=t.length,i=e.length;while(++r<n)e[i+r]=t[r];return e}function bp(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 N0(e,t){var r=-1,n=Array(e);while(++r<e)n[r]=t(r);return n}function L0(e,t){return e==null?void 0:e[t]}function vp(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function Md(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function Rs(e,t){return function(r){return e(t(r))}}function Gd(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var J0=Array.prototype,W0=Function.prototype,pi=Object.prototype,ws=ke["__core-js_shared__"],zd=function(){var e=/[^.]+$/.exec(ws&&ws.keys&&ws.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ap=W0.toString,Be=pi.hasOwnProperty,hi=pi.toString,j0=RegExp("^"+Ap.call(Be).replace(x0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vd=k0?ke.Buffer:void 0,Xd=ke.Symbol,Yd=ke.Uint8Array,D0=Rs(Object.getPrototypeOf,Object),q0=Object.create,F0=pi.propertyIsEnumerable,U0=J0.splice,Zd=Object.getOwnPropertySymbols,H0=Vd?Vd.isBuffer:void 0,B0=Rs(Object.keys,Object),Ss=Ut(ke,"DataView"),Ir=Ut(ke,"Map"),bs=Ut(ke,"Promise"),vs=Ut(ke,"Set"),As=Ut(ke,"WeakMap"),Rr=Ut(Object,"create"),M0=ot(Ss),G0=ot(Ir),z0=ot(bs),V0=ot(vs),X0=ot(As),Qd=Xd?Xd.prototype:void 0,ep=Qd?Qd.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 Y0(){this.__data__=Rr?Rr(null):{}}function Z0(e){return this.has(e)&&delete this.__data__[e]}function Q0(e){var t=this.__data__;if(Rr){var r=t[e];return r===tp?void 0:r}return Be.call(t,e)?t[e]:void 0}function ev(e){var t=this.__data__;return Rr?t[e]!==void 0:Be.call(t,e)}function tv(e,t){var r=this.__data__;return r[e]=Rr&&t===void 0?tp:t,this}it.prototype.clear=Y0;it.prototype.delete=Z0;it.prototype.get=Q0;it.prototype.has=ev;it.prototype.set=tv;function _e(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 rv(){this.__data__=[]}function nv(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 U0.call(t,r,1);return!0}function iv(e){var t=this.__data__,r=mi(t,e);return r<0?void 0:t[r][1]}function ov(e){return mi(this.__data__,e)>-1}function sv(e,t){var r=this.__data__,n=mi(r,e);if(n<0)r.push([e,t]);else r[n][1]=t;return this}_e.prototype.clear=rv;_e.prototype.delete=nv;_e.prototype.get=iv;_e.prototype.has=ov;_e.prototype.set=sv;function qt(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 av(){this.__data__={hash:new it,map:new(Ir||_e),string:new it}}function cv(e){return yi(this,e).delete(e)}function uv(e){return yi(this,e).get(e)}function fv(e){return yi(this,e).has(e)}function lv(e,t){return yi(this,e).set(e,t),this}qt.prototype.clear=av;qt.prototype.delete=cv;qt.prototype.get=uv;qt.prototype.has=fv;qt.prototype.set=lv;function Ft(e){this.__data__=new _e(e)}function dv(){this.__data__=new _e}function pv(e){return this.__data__.delete(e)}function hv(e){return this.__data__.get(e)}function mv(e){return this.__data__.has(e)}function yv(e,t){var r=this.__data__;if(r instanceof _e){var n=r.__data__;if(!Ir||n.length<b0-1)return n.push([e,t]),this;r=this.__data__=new qt(n)}return r.set(e,t),this}Ft.prototype.clear=dv;Ft.prototype.delete=pv;Ft.prototype.get=hv;Ft.prototype.has=mv;Ft.prototype.set=yv;function gv(e,t){var r=ks(e)||qv(e)?N0(e.length,String):[],n=r.length,i=!!n;for(var o in e)if((t||Be.call(e,o))&&!(i&&(o=="length"||Jv(o,n))))r.push(o);return r}function xp(e,t,r){var n=e[t];if(!(Be.call(e,t)&&Rp(n,r))||r===void 0&&!(t in e))e[t]=r}function mi(e,t){var r=e.length;while(r--)if(Rp(e[r][0],t))return r;return-1}function wv(e,t){return e&&Tp(t,_s(t),e)}function xs(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=ks(e);if(f){if(a=$v(e),!t)return _v(e,a)}else{var c=nt(e),u=c==Cs||c==op;if(Uv(e))return xv(e,t);if(c==Is||c==Ts||u&&!o){if(vp(e))return o?e:{};if(a=Nv(u?{}:e),!t)return Pv(e,wv(a,e))}else{if(!J[c])return o?e:{};a=Lv(e,c,xs,t)}}s||(s=new Ft);var l=s.get(e);if(l)return l;if(s.set(e,a),!f)var p=r?Kv(e):_s(e);return K0(p||e,function(d,g){if(p)g=d,d=e[g];xp(a,g,xs(d,t,r,n,g,e,s))}),a}function Ev(e){return gi(e)?q0(e):{}}function Sv(e,t,r){var n=t(e);return ks(e)?n:$0(n,r(e))}function bv(e){return hi.call(e)}function vv(e){if(!gi(e)||jv(e))return!1;var t=kp(e)||vp(e)?j0:C0;return t.test(ot(e))}function Av(e){if(!Ip(e))return B0(e);var t=[];for(var r in Object(e))if(Be.call(e,r)&&r!="constructor")t.push(r);return t}function xv(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function Os(e){var t=new e.constructor(e.byteLength);return new Yd(t).set(new Yd(e)),t}function Tv(e,t){var r=t?Os(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Cv(e,t,r){var n=t?r(Md(e),!0):Md(e);return bp(n,_0,new e.constructor)}function Iv(e){var t=new e.constructor(e.source,T0.exec(e));return t.lastIndex=e.lastIndex,t}function Rv(e,t,r){var n=t?r(Gd(e),!0):Gd(e);return bp(n,P0,new e.constructor)}function Ov(e){return ep?Object(ep.call(e)):{}}function kv(e,t){var r=t?Os(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function _v(e,t){var r=-1,n=e.length;t||(t=Array(n));while(++r<n)t[r]=e[r];return t}function Tp(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;xp(r,s,a===void 0?e[s]:a)}return r}function Pv(e,t){return Tp(e,Cp(e),t)}function Kv(e){return Sv(e,_s,Cp)}function yi(e,t){var r=e.__data__;return Wv(t)?r[typeof t=="string"?"string":"hash"]:r.map}function Ut(e,t){var r=L0(e,t);return vv(r)?r:void 0}var Cp=Zd?Rs(Zd,Object):Mv,nt=bv;if(Ss&&nt(new Ss(new ArrayBuffer(1)))!=di||Ir&&nt(new Ir)!=fi||bs&&nt(bs.resolve())!=Hd||vs&&nt(new vs)!=li||As&&nt(new As)!=Es)nt=function(e){var t=hi.call(e),r=t==Is?e.constructor:void 0,n=r?ot(r):void 0;if(n)switch(n){case M0:return di;case G0:return fi;case z0:return Hd;case V0:return li;case X0:return Es}return t};function $v(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 Nv(e){return typeof e.constructor=="function"&&!Ip(e)?Ev(D0(e)):{}}function Lv(e,t,r,n){var i=e.constructor;switch(t){case fp:return Os(e);case np:case ip:return new i(+e);case di:return Tv(e,n);case lp:case dp:case pp:case hp:case mp:case yp:case gp:case wp:case Ep:return kv(e,n);case fi:return Cv(e,n,r);case sp:case cp:return new i(e);case ap:return Iv(e);case li:return Rv(e,n,r);case up:return Ov(e)}}function Jv(e,t){return t=t==null?rp:t,!!t&&(typeof e=="number"||I0.test(e))&&(e>-1&&e%1==0&&e<t)}function Wv(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function jv(e){return!!zd&&zd in e}function Ip(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||pi;return e===r}function ot(e){if(e!=null){try{return Ap.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Dv(e){return xs(e,!0,!0)}function Rp(e,t){return e===t||e!==e&&t!==t}function qv(e){return Fv(e)&&Be.call(e,"callee")&&(!F0.call(e,"callee")||hi.call(e)==Ts)}var ks=Array.isArray;function Op(e){return e!=null&&Hv(e.length)&&!kp(e)}function Fv(e){return Bv(e)&&Op(e)}var Uv=H0||Gv;function kp(e){var t=gi(e)?hi.call(e):"";return t==Cs||t==op}function Hv(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=rp}function gi(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Bv(e){return!!e&&typeof e=="object"}function _s(e){return Op(e)?gv(e):Av(e)}function Mv(){return[]}function Gv(){return!1}Dt.exports=Dv});var Ks=m(function(wi){Object.defineProperty(wi,"__esModule",{value:!0});wi.deepFreeze=void 0;function _p(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]))_p(e[t])});return e}wi.deepFreeze=_p});var $p=m(function(Ht){var zv=Ht&&Ht.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.syncMemoizer=void 0;var Vv=ui(),Xv=require("events"),Pp=zv(Ps()),Kp=Ks();function Yv(e){let t=new Vv.LRUCache(e),r=e.load,n=e.hash,i=e.bypass,o=e.itemTTL,s=e.freeze,a=e.clone,f=new Xv.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(Pp.default);else S=(0,Pp.default)(S);if(s)if(p(S))S=S.then(Kp.deepFreeze);else(0,Kp.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=Yv});var Lp=m(function(Bt){var Zv=Bt&&Bt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bt,"__esModule",{value:!0});Bt.asyncMemoizer=void 0;var Qv=ui(),eA=require("events"),tA=Zv(Ps()),rA=Ks(),nA=$p();function Np(e){let t=new Qv.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 eA.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(rA.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(tA.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 F=Date.now(),V=[T];c.set(I,{queue:V,expiresAt:F+f});let N=(...ee)=>{if(!ee[0])d(I,y,ee.slice(1));c.delete(I),h("loaded",Date.now()-F,...y),g(V,ee)};r(...y,N)}return Object.assign(S,l)}Bt.asyncMemoizer=Np;Np.sync=nA.syncMemoizer});var Wp=m(function(Nk,Jp){var iA=Lp();Jp.exports=iA.asyncMemoizer});var qp=m(function(Lk,Dp){var $s=yn()("jwks"),oA=Wp(),{LRUCache:sA}=ui(),{promisify:aA,callbackify:jp}=require("util");function cA(e,{cacheMaxEntries:t=5,cacheMaxAge:r=600000,cacheMaxAgeFallback:n,onStaleCacheFallback:i}){$s(`Configured caching of signing keys. Max: ${t} / Age: ${r}${n?` / Fallback: ${n}`:""}`);let o;if(n){let s=new sA({max:t}),a=e.getSigningKey.bind(e);o=jp(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($s(`JWKS endpoint unavailable, serving stale signing key for '${f}': ${c.message}`),i)i(c,f,u.key);return u.key}$s(`JWKS endpoint unavailable and no valid stale entry for '${f}', fallback window expired or key never fetched`)}throw c}})}else o=jp(e.getSigningKey.bind(e));return aA(oA({hash:(s)=>s,load:o,ttl:r,max:t}))}Dp.exports.default=cA});var Ns=m(function(Jk,Up){var Fp=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};Fp.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)}};Up.exports=Fp});var Bp=m(function(Wk,Hp){var uA=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()};Hp.exports=uA});var zp=m(function(jk,Gp){var fA=Ns(),Ls=Bp(),Mp=function(e,t,r){this.tokenBucket=new fA(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=Ls(),this.tokensThisInterval=0,this.fireImmediately=r};Mp.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=Ls();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=Ls();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}};Gp.exports=Mp});var Vp=m(function(Js){Js.RateLimiter=zp();Js.TokenBucket=Ns()});var Ws=m(function(qk,Xp){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;Xp.exports=Ei});var Zp=m(function(Fk,Yp){var js=yn()("jwks"),{RateLimiter:lA}=Vp(),dA=Ws();function pA(e,{jwksRequestsPerMinute:t=10}){let r=e.getSigningKey.bind(e),n=new lA(t,"minute",!0);return js(`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(js("Requests to the JWKS endpoint available for the next minute:",f),f<0)js("Too many requests to the JWKS endpoint"),s(new dA("Too many requests to the JWKS endpoint"));else try{let c=await r(i);o(c)}catch(c){s(c)}})})}Yp.exports.default=pA});var eh=m(function(Uk,Qp){var hA=ms().retrieveSigningKeys;function mA(e,{getKeysInterceptor:t}){let r=e.getSigningKey.bind(e);return async(n)=>{let i=await t(),o;if(i&&i.length)o=await hA(i);if(o&&o.length){let s=o.find((a)=>!n||a.kid===n);if(s)return s}return r(n)}}Qp.exports.default=mA});var rh=m(function(Hk,th){var{callbackify:yA}=require("util"),gA=(e)=>{let t=e.getSigningKey.bind(e);return(r,n)=>{if(n)return yA(t)(r,n);return t(r)}};th.exports.default=gA});var ih=m(function(Bk,nh){nh.exports={request:jd().default,cacheSigningKey:qp().default,rateLimitSigningKey:Zp().default,getKeysInterceptor:eh().default,callbackSupport:rh().default}});var Ds=m(function(Mk,oh){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;oh.exports=Si});var Mt=m(function(Gk,ch){var st=yn()("jwks"),{retrieveSigningKeys:wA}=ms(),{request:EA,cacheSigningKey:SA,rateLimitSigningKey:bA,getKeysInterceptor:vA,callbackSupport:AA}=ih(),qs=oi(),sh=Ds();class ah{constructor(e){if(this.options={rateLimit:!1,cache:!0,timeout:30000,...e},this.options.getKeysInterceptor)this.getSigningKey=vA(this,e);if(this.options.rateLimit)this.getSigningKey=bA(this,e);if(this.options.cache)this.getSigningKey=SA(this,e);this.getSigningKey=AA(this,e)}async getKeys(){st(`Fetching keys from '${this.options.jwksUri}'`);try{let e=await EA({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 qs(t):e;throw r.isEndpointUnavailable=!0,r}}async getSigningKeys(){let e=await this.getKeys();if(!e||!e.length)throw new qs("The JWKS endpoint did not contain any keys");let t=await wA(e);if(!t.length)throw new qs("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 sh("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 sh(`Unable to find a signing key that matches '${e}'`)}}ch.exports={JwksClient:ah}});var Gt=m(function(zk,uh){uh.exports={ArgumentError:ys(),JwksError:oi(),JwksRateLimitError:Ws(),SigningKeyNotFoundError:Ds()}});var Or=m(function(Vk,fh){var xA=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512","EdDSA"];fh.exports=xA});var lh=m(function(Xk,bi){var{ArgumentError:TA}=Gt(),{JwksClient:CA}=Mt(),IA=Or(),RA=(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 TA("An options object must be provided when initializing hapiJwt2Key");let t=new CA(e),r=e.handleSigningKeyError||RA;return function(i,o){if(!i||!i.header)return o(Error("Cannot find a signing certificate if there is no header"),null,null);if(!IA.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 ph=m(function(Yk,dh){var{ArgumentError:OA}=Gt(),{JwksClient:kA}=Mt(),_A=Or(),PA=(e,t)=>{if(e&&e.name==="SigningKeyNotFoundError")return t(null);if(e)return t(e)};dh.exports.expressJwtSecret=function(e){if(e===null||e===void 0)throw new OA("An options object must be provided when initializing expressJwtSecret");let t=new kA(e),r=e.handleSigningKeyError||PA,n=async(i,o)=>{if(!o)return;let s=o.header;if(!s||!_A.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 mh=m(function(Zk,hh){var{ArgumentError:KA}=Gt(),{JwksClient:$A}=Mt(),NA=Or();hh.exports.koaJwtSecret=function(e={}){if(!e.jwksUri)throw new KA("No JWKS provided. Please provide a jwksUri");let t=new $A(e);return function({alg:n,kid:i}={}){return new Promise((o,s)=>{if(!NA.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 Eh=m(function(Qk,wh){var yh=(hs(),kr(ps)),{ArgumentError:gh}=Gt(),{JwksClient:LA}=Mt(),JA=Or(),WA=(e,t)=>{if(e&&e.name==="SigningKeyNotFoundError")return t(null);if(e)return t(e)};wh.exports.passportJwtSecret=function(e){if(e===null||e===void 0)throw new gh("An options object must be provided when initializing passportJwtSecret");if(!e.jwksUri)throw new gh("No JWKS provided. Please provide a jwksUri");let t=new LA(e),r=e.handleSigningKeyError||WA;return function(i,o,s){let a;try{a={payload:yh.decodeJwt(o),header:yh.decodeProtectedHeader(o)}}catch(f){a=null}if(!a||!JA.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 bh=m(function(e_,pe){var{JwksClient:Sh}=Mt(),vi=Gt(),{hapiJwt2Key:jA,hapiJwt2KeyAsync:DA}=lh(),{expressJwtSecret:qA}=ph(),{koaJwtSecret:FA}=mh(),{passportJwtSecret:UA}=Eh();pe.exports=(e)=>new Sh(e);pe.exports.JwksClient=Sh;pe.exports.ArgumentError=vi.ArgumentError;pe.exports.JwksError=vi.JwksError;pe.exports.JwksRateLimitError=vi.JwksRateLimitError;pe.exports.SigningKeyNotFoundError=vi.SigningKeyNotFoundError;pe.exports.expressJwtSecret=qA;pe.exports.hapiJwt2Key=jA;pe.exports.hapiJwt2KeyAsync=DA;pe.exports.koaJwtSecret=FA;pe.exports.passportJwtSecret=UA});var YA={};Vt(YA,{handler:()=>zA,isAuthorized:()=>Ih});module.exports=kr(YA);var Ci=require("node:crypto");function Ii(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function QA(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");return Buffer.from(t,"base64").toString()}var Zs=`<!DOCTYPE html>
|
|
8
11
|
<html lang="en">
|
|
9
12
|
<head>
|
|
10
13
|
<meta charset="utf-8" />
|
|
@@ -24,4 +27,4 @@ var IW=Object.create;var{getPrototypeOf:XW,defineProperty:Bt,getOwnPropertyNames
|
|
|
24
27
|
</p>
|
|
25
28
|
</body>
|
|
26
29
|
</html>
|
|
27
|
-
`;var
|
|
30
|
+
`;var ea=require("node:fs"),Pr=ut(require("node:path")),ta=require("node:url");var Jh=(()=>{let e=function(){};return e.prototype=Object.create(null),e})();function _r(e,t){let r=new Jh,n=e.length;if(n<2)return r;let i=t?.decode||Dh,o=0;do{let s=jh(e,o,n);if(s===n)break;let a=Wh(e,o,n);if(s>a){o=e.lastIndexOf(";",s-1)+1;continue}let f=Qs(e,o,s);if(r[f]===void 0)r[f]=i(Qs(e,s+1,a));o=a+1}while(o<n);return r}function Wh(e,t,r){let n=e.indexOf(";",t);return n===-1?r:n}function jh(e,t,r){let n=e.indexOf("=",t);return n===-1?r:n}function Qs(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 Dh(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 Ri{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 qh=ta.fileURLToPath("file:///home/runner/work/cdk-cloudfront-auth/cdk-cloudfront-auth/src/handlers/util/config.ts"),Fh=Pr.dirname(qh);function Oi(){let t=process.env.LAMBDA_TASK_ROOT||Fh,r=Pr.join(t,"config.json");console.log("Loading config from",r);let n=JSON.parse(ea.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 Ri(ft[n.logLevel])}}function Uh(e){return Object.entries(e).reduce((t,[r,n])=>Object.assign(t,{[r.toLowerCase()]:[{key:r,value:n}]}),{})}function ki(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 ra(e){return{body:Hh(e),status:e.statusCode??"500",headers:{"content-type":[{key:"Content-Type",value:"text/html; charset=UTF-8"}]}}}function Hh(e){let t={...e,region:process.env.AWS_REGION};return Zs.replace(/\${([^}]*)}/g,(r,n)=>t[n]||"")}function na(e,t){if(!t)throw Error("Expected response value");return{...t,headers:{...t.headers??{},...Uh(e.httpHeaders)}}}function ia(e){let t;return async(r)=>{if(!t)t=Oi();t.logger.debug("Handling event:",r);let n=na(t,await e(t,r));return t.logger.debug("Returning response:",n),n}}function ux(e){let t;return async(r)=>{if(!t)t=Oi();t.logger.debug("Handling event:",r);let n=na(t,await e(t,r));return t.logger.debug("Returning response:",n),n}}var Us=ut(Jf(),1),vh=ut(bh(),1),Fs;function HA(e){return"rsaPublicKey"in e}async function BA(e,t){if(!Fs)Fs=vh.default({cache:!0,rateLimit:!0,jwksUri:e});let r=await Fs.getSigningKey(t);return HA(r)?r.rsaPublicKey:r.publicKey}async function Ah(e,t,r,n){let i=Us.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 BA(t,o);if(s instanceof Error)return{validationError:s};let a={audience:n,issuer:r,ignoreExpiration:!1};return new Promise((f)=>Us.default.verify(e,s,a,(c)=>c?f({validationError:c}):f(void 0)))}function Ai(e){let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/");return JSON.parse(Buffer.from(r,"base64").toString())}function MA(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 xh(e,t){let r=MA(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 i_(e){let t=Ai(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]=Hs(p[d]));else if(e.event==="refreshFailed")p[s]=Hs(p[s]);return["spa-auth-edge-nonce","spa-auth-edge-nonce-hmac","spa-auth-edge-pkce"].forEach((d)=>{p[d]=Hs(p[d])}),Object.entries(p).map(([d,g])=>`${d}=${g}`)}function Hs(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 xi=require("node:crypto");function GA(e,t){let r=Number.parseInt(e.slice(0,e.indexOf("T")),10);if(Number.isNaN(r))return{clientError:"Invalid nonce"};if(Th()-r>t)return{clientError:`Nonce is too old (nonce is from ${new Date(r*1000).toISOString()})`}}function s_(e,t,r){let n=GA(e,r.nonceMaxAge);if(n)return n;let i=Ti(e,r);if(i!==t)return{clientError:`Nonce signature mismatch! Expected ${i} but got ${t}`}}function Bs(){let e=xi.randomBytes(16).toString("hex");return`${Th()}T${e}`}function Ti(e,t){return xi.createHmac("sha256",t.nonceSigningSecret).update(e).digest("hex")}function Th(){return Date.now()/1000|0}var zA=ia(async(e,t)=>{let r=t.Records[0].cf.request,n=r.headers.host[0].value,i=`${r.uri}${r.querystring?`?${r.querystring}`:""}`,{idToken:o,refreshToken:s,nonce:a,nonceHmac:f}=xh(r.headers,e.clientId);if(e.logger.debug("Extracted cookies:",{idToken:o,refreshToken:s,nonce:a,nonceHmac:f}),!o)return Ch({config:e,domainName:n,requestedUri:i});let c=Ai(o),{exp:u}=c;if(e.logger.debug("ID token exp:",u,new Date(u*1000).toISOString()),Date.now()/1000>u-600&&s)return VA({config:e,domainName:n,requestedUri:i});e.logger.info("Validating JWT");let l=await Ah(o,e.tokenJwksUri,e.tokenIssuer,e.clientId);if(l!==void 0)return e.logger.debug("ID token not valid:",l.validationError),Ch({config:e,domainName:n,requestedUri:i});if(e.logger.info("JWT is valid"),!Ih(e,c))return ra({title:"Not authorized",statusCode:"403",message:"You are not authorized for this resource.",details:"Your sign in was successful, but your user is not allowed to access this resource.",linkHref:`https://${n}${e.signOutPath}`,linkText:"Sign out"});return r});function Ih(e,t){if(e.requireGroupAnyOf){let r=t["cognito:groups"]||[];if(!e.requireGroupAnyOf.some((n)=>r.includes(n)))return!1}return!0}function VA({config:e,domainName:t,requestedUri:r}){e.logger.info("Redirecting to refresh endpoint");let n=Bs(),i=new URLSearchParams({requestedUri:r,nonce:n}).toString();return ki(`https://${t}${e.refreshAuthPath}?${i}`,{cookies:[`spa-auth-edge-nonce=${encodeURIComponent(n)}; ${e.cookieSettings.nonce}`,`spa-auth-edge-nonce-hmac=${encodeURIComponent(Ti(n,e))}; ${e.cookieSettings.nonce}`]})}function Ch({config:e,domainName:t,requestedUri:r}){let n=Bs(),i={nonce:n,nonceHmac:Ti(n,e),...XA(e)};e.logger.debug("Using new state:",i);let o=new URLSearchParams({redirect_uri:`https://${t}${e.callbackPath}`,response_type:"code",client_id:e.clientId,state:Ii(Buffer.from(JSON.stringify({nonce:i.nonce,requestedUri:r})).toString("base64")),scope:e.oauthScopes.join(" "),code_challenge_method:"S256",code_challenge:i.pkceHash}).toString();return ki(`https://${e.cognitoAuthDomain}/oauth2/authorize?${o}`,{cookies:[`spa-auth-edge-nonce=${encodeURIComponent(i.nonce)}; ${e.cookieSettings.nonce}`,`spa-auth-edge-nonce-hmac=${encodeURIComponent(i.nonceHmac)}; ${e.cookieSettings.nonce}`,`spa-auth-edge-pkce=${encodeURIComponent(i.pkce)}; ${e.cookieSettings.nonce}`]})}function XA(e){let t=Ci.randomBytes(26).toString("hex"),r={pkce:t,pkceHash:Ii(Ci.createHash("sha256").update(t,"utf8").digest("base64"))};return e.logger.debug("Generated PKCE verifier:",r),r}
|