@liflig/cdk-cloudfront-auth 1.8.41 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/check-auth/index.js +27 -2
- package/dist/generate-secret/index.js +1 -1
- package/dist/http-headers/index.js +21 -1
- package/dist/parse-auth/index.js +44 -2
- package/dist/refresh-auth/index.js +44 -2
- package/dist/sign-out/index.js +27 -2
- package/package.json +12 -18
- package/dist/check-auth/index.js.LICENSE.txt +0 -1
- package/dist/parse-auth/index.js.LICENSE.txt +0 -15
- package/dist/refresh-auth/index.js.LICENSE.txt +0 -15
- package/dist/sign-out/index.js.LICENSE.txt +0 -1
- package/lib/handlers/check-auth.d.ts +0 -7
- package/lib/handlers/generate-secret.d.ts +0 -9
- package/lib/handlers/http-headers.d.ts +0 -1
- package/lib/handlers/parse-auth.d.ts +0 -1
- package/lib/handlers/refresh-auth.d.ts +0 -1
- package/lib/handlers/sign-out.d.ts +0 -1
package/dist/sign-out/index.js
CHANGED
|
@@ -1,2 +1,27 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
(()=>{var e={1045(e,t,r){"use strict";var n=r(181).Buffer,o=r(181).SlowBuffer;function i(e,t){if(!n.isBuffer(e)||!n.isBuffer(t))return!1;if(e.length!==t.length)return!1;for(var r=0,o=0;o<e.length;o++)r|=e[o]^t[o];return 0===r}e.exports=i,i.install=function(){n.prototype.equal=o.prototype.equal=function(e){return i(this,e)}};var s=n.prototype.equal,a=o.prototype.equal;i.restore=function(){n.prototype.equal=s,o.prototype.equal=a}},8232(e,t){"use strict";t.qg=function(e,t){const a=new r,c=e.length;if(c<2)return a;const u=t?.decode||s;let l=0;do{const t=o(e,l,c);if(-1===t)break;const r=n(e,l,c);if(t>r){l=e.lastIndexOf(";",t-1)+1;continue}const s=i(e,l,t);void 0===a[s]&&(a[s]=u(i(e,t+1,r))),l=r+1}while(l<c);return a};Object.prototype.toString;const r=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function n(e,t,r){const n=e.indexOf(";",t);return-1===n?r:n}function o(e,t,r){const n=e.indexOf("=",t);return n<r?n:-1}function i(e,t,r){let n=t,o=r;do{const t=e.charCodeAt(n);if(32!==t&&9!==t)break}while(++n<o);for(;o>n;){const t=e.charCodeAt(o-1);if(32!==t&&9!==t)break;o--}return e.slice(n,o)}function s(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(t){return e}}},7833(e,t,r){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))}),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{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`."))}})(),t.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"],t.log=console.debug||console.log||(()=>{}),e.exports=r(736)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},736(e,t,r){e.exports=function(e){function t(e){let r,o,i,s=null;function a(...e){if(!a.enabled)return;const n=a,o=Number(new Date),i=o-(r||o);n.diff=i,n.prev=r,n.curr=o,r=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,o)=>{if("%%"===r)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];r=i.call(n,t),e.splice(s,1),s--}return r}),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function o(e,t){let r=0,n=0,o=-1,i=0;for(;r<e.length;)if(n<t.length&&(t[n]===e[r]||"*"===t[n]))"*"===t[n]?(o=n,i=r,n++):(r++,n++);else{if(-1===o)return!1;n=o+1,i++,r=i}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of r)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const r of t.skips)if(o(e,r))return!1;for(const r of t.names)if(o(e,r))return!0;return!1},t.humanize=r(6585),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},5753(e,t,r){"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=r(7833):e.exports=r(6033)},6033(e,t,r){const n=r(2018),o=r(9023);t.init=function(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let n=0;n<r.length;n++)e.inspectOpts[r[n]]=t.inspectOpts[r[n]]},t.log=function(...e){return process.stderr.write(o.formatWithOptions(t.inspectOpts,...e)+"\n")},t.formatArgs=function(r){const{namespace:n,useColors:o}=this;if(o){const t=this.color,o="[3"+(t<8?t:"8;5;"+t),i=` ${o};1m${n} [0m`;r[0]=i+r[0].split("\n").join("\n"+i),r.push(o+"m+"+e.exports.humanize(this.diff)+"[0m")}else r[0]=(t.inspectOpts.hideDate?"":(new Date).toISOString()+" ")+n+" "+r[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):n.isatty(process.stderr.fd)},t.destroy=o.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=r(7687);e&&(e.stderr||e).level>=2&&(t.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){}t.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase());let n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e},{}),e.exports=r(736)(t);const{formatters:i}=e.exports;i.o=function(e){return this.inspectOpts.colors=this.useColors,o.inspect(e,this.inspectOpts).split("\n").map(e=>e.trim()).join(" ")},i.O=function(e){return this.inspectOpts.colors=this.useColors,o.inspect(e,this.inspectOpts)}},2010(e,t,r){"use strict";var n=r(2861).Buffer,o=r(3527);function i(e){if(n.isBuffer(e))return e;if("string"==typeof e)return n.from(e,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function s(e,t,r){for(var n=0;t+n<r&&0===e[t+n];)++n;return e[t+n]>=128&&--n,n}e.exports={derToJose:function(e,t){e=i(e);var r=o(t),s=r+1,a=e.length,c=0;if(48!==e[c++])throw new Error('Could not find expected "seq"');var u=e[c++];if(129===u&&(u=e[c++]),a-c<u)throw new Error('"seq" specified length of "'+u+'", only "'+(a-c)+'" remaining');if(2!==e[c++])throw new Error('Could not find expected "int" for "r"');var l=e[c++];if(a-c-2<l)throw new Error('"r" specified length of "'+l+'", only "'+(a-c-2)+'" available');if(s<l)throw new Error('"r" specified length of "'+l+'", max of "'+s+'" is acceptable');var d=c;if(c+=l,2!==e[c++])throw new Error('Could not find expected "int" for "s"');var p=e[c++];if(a-c!==p)throw new Error('"s" specified length of "'+p+'", expected "'+(a-c)+'"');if(s<p)throw new Error('"s" specified length of "'+p+'", max of "'+s+'" is acceptable');var f=c;if((c+=p)!==a)throw new Error('Expected to consume entire buffer, but "'+(a-c)+'" bytes remain');var h=r-l,y=r-p,m=n.allocUnsafe(h+l+y+p);for(c=0;c<h;++c)m[c]=0;e.copy(m,c,d+Math.max(-h,0),d+l);for(var g=c=r;c<g+y;++c)m[c]=0;return e.copy(m,c,f+Math.max(-y,0),f+p),(m=m.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(e,t){e=i(e);var r=o(t),a=e.length;if(a!==2*r)throw new TypeError('"'+t+'" signatures must be "'+2*r+'" bytes, saw "'+a+'"');var c=s(e,0,r),u=s(e,r,e.length),l=r-c,d=r-u,p=2+l+1+1+d,f=p<128,h=n.allocUnsafe((f?2:3)+p),y=0;return h[y++]=48,f?h[y++]=p:(h[y++]=129,h[y++]=255&p),h[y++]=2,h[y++]=l,c<0?(h[y++]=0,y+=e.copy(h,y,0,r)):y+=e.copy(h,y,c,r),h[y++]=2,h[y++]=d,u<0?(h[y++]=0,e.copy(h,y,r)):e.copy(h,y,r+u),h}}},3527(e){"use strict";function t(e){return(e/8|0)+(e%8==0?0:1)}var r={ES256:t(256),ES384:t(384),ES512:t(521)};e.exports=function(e){var t=r[e];if(t)return t;throw new Error('Unknown algorithm "'+e+'"')}},5884(e){"use strict";e.exports=(e,t=process.argv)=>{const r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return-1!==n&&(-1===o||n<o)}},257(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cryptoRuntime=t.base64url=t.generateSecret=t.generateKeyPair=t.errors=t.decodeJwt=t.decodeProtectedHeader=t.importJWK=t.importX509=t.importPKCS8=t.importSPKI=t.exportJWK=t.exportSPKI=t.exportPKCS8=t.UnsecuredJWT=t.createRemoteJWKSet=t.createLocalJWKSet=t.EmbeddedJWK=t.calculateJwkThumbprintUri=t.calculateJwkThumbprint=t.EncryptJWT=t.SignJWT=t.GeneralSign=t.FlattenedSign=t.CompactSign=t.FlattenedEncrypt=t.CompactEncrypt=t.jwtDecrypt=t.jwtVerify=t.generalVerify=t.flattenedVerify=t.compactVerify=t.GeneralEncrypt=t.generalDecrypt=t.flattenedDecrypt=t.compactDecrypt=void 0;var n=r(6923);Object.defineProperty(t,"compactDecrypt",{enumerable:!0,get:function(){return n.compactDecrypt}});var o=r(4533);Object.defineProperty(t,"flattenedDecrypt",{enumerable:!0,get:function(){return o.flattenedDecrypt}});var i=r(774);Object.defineProperty(t,"generalDecrypt",{enumerable:!0,get:function(){return i.generalDecrypt}});var s=r(782);Object.defineProperty(t,"GeneralEncrypt",{enumerable:!0,get:function(){return s.GeneralEncrypt}});var a=r(1427);Object.defineProperty(t,"compactVerify",{enumerable:!0,get:function(){return a.compactVerify}});var c=r(6833);Object.defineProperty(t,"flattenedVerify",{enumerable:!0,get:function(){return c.flattenedVerify}});var u=r(9060);Object.defineProperty(t,"generalVerify",{enumerable:!0,get:function(){return u.generalVerify}});var l=r(3082);Object.defineProperty(t,"jwtVerify",{enumerable:!0,get:function(){return l.jwtVerify}});var d=r(3814);Object.defineProperty(t,"jwtDecrypt",{enumerable:!0,get:function(){return d.jwtDecrypt}});var p=r(7815);Object.defineProperty(t,"CompactEncrypt",{enumerable:!0,get:function(){return p.CompactEncrypt}});var f=r(9805);Object.defineProperty(t,"FlattenedEncrypt",{enumerable:!0,get:function(){return f.FlattenedEncrypt}});var h=r(9851);Object.defineProperty(t,"CompactSign",{enumerable:!0,get:function(){return h.CompactSign}});var y=r(4329);Object.defineProperty(t,"FlattenedSign",{enumerable:!0,get:function(){return y.FlattenedSign}});var m=r(7440);Object.defineProperty(t,"GeneralSign",{enumerable:!0,get:function(){return m.GeneralSign}});var g=r(2230);Object.defineProperty(t,"SignJWT",{enumerable:!0,get:function(){return g.SignJWT}});var v=r(6638);Object.defineProperty(t,"EncryptJWT",{enumerable:!0,get:function(){return v.EncryptJWT}});var w=r(2599);Object.defineProperty(t,"calculateJwkThumbprint",{enumerable:!0,get:function(){return w.calculateJwkThumbprint}}),Object.defineProperty(t,"calculateJwkThumbprintUri",{enumerable:!0,get:function(){return w.calculateJwkThumbprintUri}});var E=r(278);Object.defineProperty(t,"EmbeddedJWK",{enumerable:!0,get:function(){return E.EmbeddedJWK}});var b=r(6980);Object.defineProperty(t,"createLocalJWKSet",{enumerable:!0,get:function(){return b.createLocalJWKSet}});var S=r(9877);Object.defineProperty(t,"createRemoteJWKSet",{enumerable:!0,get:function(){return S.createRemoteJWKSet}});var _=r(49);Object.defineProperty(t,"UnsecuredJWT",{enumerable:!0,get:function(){return _.UnsecuredJWT}});var A=r(68);Object.defineProperty(t,"exportPKCS8",{enumerable:!0,get:function(){return A.exportPKCS8}}),Object.defineProperty(t,"exportSPKI",{enumerable:!0,get:function(){return A.exportSPKI}}),Object.defineProperty(t,"exportJWK",{enumerable:!0,get:function(){return A.exportJWK}});var I=r(7364);Object.defineProperty(t,"importSPKI",{enumerable:!0,get:function(){return I.importSPKI}}),Object.defineProperty(t,"importPKCS8",{enumerable:!0,get:function(){return I.importPKCS8}}),Object.defineProperty(t,"importX509",{enumerable:!0,get:function(){return I.importX509}}),Object.defineProperty(t,"importJWK",{enumerable:!0,get:function(){return I.importJWK}});var P=r(4443);Object.defineProperty(t,"decodeProtectedHeader",{enumerable:!0,get:function(){return P.decodeProtectedHeader}});var O=r(8396);Object.defineProperty(t,"decodeJwt",{enumerable:!0,get:function(){return O.decodeJwt}}),t.errors=r(6247);var k=r(409);Object.defineProperty(t,"generateKeyPair",{enumerable:!0,get:function(){return k.generateKeyPair}});var C=r(4121);Object.defineProperty(t,"generateSecret",{enumerable:!0,get:function(){return C.generateSecret}}),t.base64url=r(8462);var T=r(4166);Object.defineProperty(t,"cryptoRuntime",{enumerable:!0,get:function(){return T.default}})},6923(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compactDecrypt=void 0;const n=r(4533),o=r(6247),i=r(5821);t.compactDecrypt=async function(e,t,r){if(e instanceof Uint8Array&&(e=i.decoder.decode(e)),"string"!=typeof e)throw new o.JWEInvalid("Compact JWE must be a string or Uint8Array");const{0:s,1:a,2:c,3:u,4:l,length:d}=e.split(".");if(5!==d)throw new o.JWEInvalid("Invalid Compact JWE");const p=await(0,n.flattenedDecrypt)({ciphertext:u,iv:c||void 0,protected:s||void 0,tag:l||void 0,encrypted_key:a||void 0},t,r),f={plaintext:p.plaintext,protectedHeader:p.protectedHeader};return"function"==typeof t?{...f,key:p.key}:f}},7815(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CompactEncrypt=void 0;const n=r(9805);t.CompactEncrypt=class{constructor(e){this._flattened=new n.FlattenedEncrypt(e)}setContentEncryptionKey(e){return this._flattened.setContentEncryptionKey(e),this}setInitializationVector(e){return this._flattened.setInitializationVector(e),this}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}setKeyManagementParameters(e){return this._flattened.setKeyManagementParameters(e),this}async encrypt(e,t){const r=await this._flattened.encrypt(e,t);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")}}},4533(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.flattenedDecrypt=void 0;const n=r(82),o=r(4799),i=r(7609),s=r(6247),a=r(9476),c=r(1855),u=r(4760),l=r(5821),d=r(1784),p=r(2458),f=r(8604);t.flattenedDecrypt=async function(e,t,r){var h;if(!(0,c.default)(e))throw new s.JWEInvalid("Flattened JWE must be an object");if(void 0===e.protected&&void 0===e.header&&void 0===e.unprotected)throw new s.JWEInvalid("JOSE Header missing");if("string"!=typeof e.iv)throw new s.JWEInvalid("JWE Initialization Vector missing or incorrect type");if("string"!=typeof e.ciphertext)throw new s.JWEInvalid("JWE Ciphertext missing or incorrect type");if("string"!=typeof e.tag)throw new s.JWEInvalid("JWE Authentication Tag missing or incorrect type");if(void 0!==e.protected&&"string"!=typeof e.protected)throw new s.JWEInvalid("JWE Protected Header incorrect type");if(void 0!==e.encrypted_key&&"string"!=typeof e.encrypted_key)throw new s.JWEInvalid("JWE Encrypted Key incorrect type");if(void 0!==e.aad&&"string"!=typeof e.aad)throw new s.JWEInvalid("JWE AAD incorrect type");if(void 0!==e.header&&!(0,c.default)(e.header))throw new s.JWEInvalid("JWE Shared Unprotected Header incorrect type");if(void 0!==e.unprotected&&!(0,c.default)(e.unprotected))throw new s.JWEInvalid("JWE Per-Recipient Unprotected Header incorrect type");let y;if(e.protected)try{const t=(0,n.decode)(e.protected);y=JSON.parse(l.decoder.decode(t))}catch{throw new s.JWEInvalid("JWE Protected Header is invalid")}if(!(0,a.default)(y,e.header,e.unprotected))throw new s.JWEInvalid("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");const m={...y,...e.header,...e.unprotected};if((0,p.default)(s.JWEInvalid,new Map,null==r?void 0:r.crit,y,m),void 0!==m.zip){if(!y||!y.zip)throw new s.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==m.zip)throw new s.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:g,enc:v}=m;if("string"!=typeof g||!g)throw new s.JWEInvalid("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof v||!v)throw new s.JWEInvalid("missing JWE Encryption Algorithm (enc) in JWE Header");const w=r&&(0,f.default)("keyManagementAlgorithms",r.keyManagementAlgorithms),E=r&&(0,f.default)("contentEncryptionAlgorithms",r.contentEncryptionAlgorithms);if(w&&!w.has(g))throw new s.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(E&&!E.has(v))throw new s.JOSEAlgNotAllowed('"enc" (Encryption Algorithm) Header Parameter not allowed');let b;if(void 0!==e.encrypted_key)try{b=(0,n.decode)(e.encrypted_key)}catch{throw new s.JWEInvalid("Failed to base64url decode the encrypted_key")}let S,_,A,I=!1;"function"==typeof t&&(t=await t(y,e),I=!0);try{S=await(0,u.default)(g,t,b,m,r)}catch(e){if(e instanceof TypeError||e instanceof s.JWEInvalid||e instanceof s.JOSENotSupported)throw e;S=(0,d.default)(v)}try{_=(0,n.decode)(e.iv)}catch{throw new s.JWEInvalid("Failed to base64url decode the iv")}try{A=(0,n.decode)(e.tag)}catch{throw new s.JWEInvalid("Failed to base64url decode the tag")}const P=l.encoder.encode(null!==(h=e.protected)&&void 0!==h?h:"");let O,k;O=void 0!==e.aad?(0,l.concat)(P,l.encoder.encode("."),l.encoder.encode(e.aad)):P;try{k=(0,n.decode)(e.ciphertext)}catch{throw new s.JWEInvalid("Failed to base64url decode the ciphertext")}let C=await(0,o.default)(v,S,k,_,A,O);"DEF"===m.zip&&(C=await((null==r?void 0:r.inflateRaw)||i.inflate)(C));const T={plaintext:C};if(void 0!==e.protected&&(T.protectedHeader=y),void 0!==e.aad)try{T.additionalAuthenticatedData=(0,n.decode)(e.aad)}catch{throw new s.JWEInvalid("Failed to base64url decode the aad")}return void 0!==e.unprotected&&(T.sharedUnprotectedHeader=e.unprotected),void 0!==e.header&&(T.unprotectedHeader=e.header),I?{...T,key:t}:T}},9805(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FlattenedEncrypt=t.unprotected=void 0;const n=r(82),o=r(2027),i=r(7609),s=r(7974),a=r(508),c=r(6247),u=r(9476),l=r(5821),d=r(2458);t.unprotected=Symbol(),t.FlattenedEncrypt=class{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=e,this}async encrypt(e,r){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new c.JWEInvalid("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!(0,u.default)(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new c.JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const p={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if((0,d.default)(c.JWEInvalid,new Map,null==r?void 0:r.crit,this._protectedHeader,p),void 0!==p.zip){if(!this._protectedHeader||!this._protectedHeader.zip)throw new c.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==p.zip)throw new c.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:f,enc:h}=p;if("string"!=typeof f||!f)throw new c.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof h||!h)throw new c.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let y,m,g,v,w,E,b;if("dir"===f){if(this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Encryption")}else if("ECDH-ES"===f&&this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Key Agreement");{let n;({cek:m,encryptedKey:y,parameters:n}=await(0,a.default)(f,h,e,this._cek,this._keyManagementParameters)),n&&(r&&t.unprotected in r?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...n}:this.setUnprotectedHeader(n):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...n}:this.setProtectedHeader(n))}if(this._iv||(this._iv=(0,s.default)(h)),v=this._protectedHeader?l.encoder.encode((0,n.encode)(JSON.stringify(this._protectedHeader))):l.encoder.encode(""),this._aad?(w=(0,n.encode)(this._aad),g=(0,l.concat)(v,l.encoder.encode("."),l.encoder.encode(w))):g=v,"DEF"===p.zip){const e=await((null==r?void 0:r.deflateRaw)||i.deflate)(this._plaintext);({ciphertext:E,tag:b}=await(0,o.default)(h,e,m,this._iv,g))}else({ciphertext:E,tag:b}=await(0,o.default)(h,this._plaintext,m,this._iv,g));const S={ciphertext:(0,n.encode)(E),iv:(0,n.encode)(this._iv),tag:(0,n.encode)(b)};return y&&(S.encrypted_key=(0,n.encode)(y)),w&&(S.aad=w),this._protectedHeader&&(S.protected=l.decoder.decode(v)),this._sharedUnprotectedHeader&&(S.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(S.header=this._unprotectedHeader),S}}},774(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generalDecrypt=void 0;const n=r(4533),o=r(6247),i=r(1855);t.generalDecrypt=async function(e,t,r){if(!(0,i.default)(e))throw new o.JWEInvalid("General JWE must be an object");if(!Array.isArray(e.recipients)||!e.recipients.every(i.default))throw new o.JWEInvalid("JWE Recipients missing or incorrect type");if(!e.recipients.length)throw new o.JWEInvalid("JWE Recipients has no members");for(const o of e.recipients)try{return await(0,n.flattenedDecrypt)({aad:e.aad,ciphertext:e.ciphertext,encrypted_key:o.encrypted_key,header:o.header,iv:e.iv,protected:e.protected,tag:e.tag,unprotected:e.unprotected},t,r)}catch{}throw new o.JWEDecryptionFailed}},782(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GeneralEncrypt=void 0;const n=r(9805),o=r(6247),i=r(1784),s=r(9476),a=r(508),c=r(82),u=r(2458);class l{constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setUnprotectedHeader(e){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addRecipient(...e){return this.parent.addRecipient(...e)}encrypt(...e){return this.parent.encrypt(...e)}done(){return this.parent}}t.GeneralEncrypt=class{constructor(e){this._recipients=[],this._plaintext=e}addRecipient(e,t){const r=new l(this,e,{crit:null==t?void 0:t.crit});return this._recipients.push(r),r}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}async encrypt(e){var t,r,l;if(!this._recipients.length)throw new o.JWEInvalid("at least one recipient must be added");if(e={deflateRaw:null==e?void 0:e.deflateRaw},1===this._recipients.length){const[t]=this._recipients,r=await new n.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(t.unprotectedHeader).encrypt(t.key,{...t.options,...e});let o={ciphertext:r.ciphertext,iv:r.iv,recipients:[{}],tag:r.tag};return r.aad&&(o.aad=r.aad),r.protected&&(o.protected=r.protected),r.unprotected&&(o.unprotected=r.unprotected),r.encrypted_key&&(o.recipients[0].encrypted_key=r.encrypted_key),r.header&&(o.recipients[0].header=r.header),o}let d;for(let e=0;e<this._recipients.length;e++){const t=this._recipients[e];if(!(0,s.default)(this._protectedHeader,this._unprotectedHeader,t.unprotectedHeader))throw new o.JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader,...t.unprotectedHeader},{alg:n}=r;if("string"!=typeof n||!n)throw new o.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("dir"===n||"ECDH-ES"===n)throw new o.JWEInvalid('"dir" and "ECDH-ES" alg may only be used with a single recipient');if("string"!=typeof r.enc||!r.enc)throw new o.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(d){if(d!==r.enc)throw new o.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}else d=r.enc;if((0,u.default)(o.JWEInvalid,new Map,t.options.crit,this._protectedHeader,r),!(void 0===r.zip||this._protectedHeader&&this._protectedHeader.zip))throw new o.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected')}const p=(0,i.default)(d);let f={ciphertext:"",iv:"",recipients:[],tag:""};for(let o=0;o<this._recipients.length;o++){const i=this._recipients[o],s={};f.recipients.push(s);const u={...this._protectedHeader,...this._unprotectedHeader,...i.unprotectedHeader}.alg.startsWith("PBES2")?2048+o:void 0;if(0===o){const t=await new n.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(p).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(i.unprotectedHeader).setKeyManagementParameters({p2c:u}).encrypt(i.key,{...i.options,...e,[n.unprotected]:!0});f.ciphertext=t.ciphertext,f.iv=t.iv,f.tag=t.tag,t.aad&&(f.aad=t.aad),t.protected&&(f.protected=t.protected),t.unprotected&&(f.unprotected=t.unprotected),s.encrypted_key=t.encrypted_key,t.header&&(s.header=t.header);continue}const{encryptedKey:h,parameters:y}=await(0,a.default)((null===(t=i.unprotectedHeader)||void 0===t?void 0:t.alg)||(null===(r=this._protectedHeader)||void 0===r?void 0:r.alg)||(null===(l=this._unprotectedHeader)||void 0===l?void 0:l.alg),d,i.key,p,{p2c:u});s.encrypted_key=(0,c.encode)(h),(i.unprotectedHeader||y)&&(s.header={...i.unprotectedHeader,...y})}return f}}},278(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmbeddedJWK=void 0;const n=r(7364),o=r(1855),i=r(6247);t.EmbeddedJWK=async function(e,t){const r={...e,...null==t?void 0:t.header};if(!(0,o.default)(r.jwk))throw new i.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object');const s=await(0,n.importJWK)({...r.jwk,ext:!0},r.alg,!0);if(s instanceof Uint8Array||"public"!==s.type)throw new i.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key');return s}},2599(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.calculateJwkThumbprintUri=t.calculateJwkThumbprint=void 0;const n=r(6332),o=r(82),i=r(6247),s=r(5821),a=r(1855),c=(e,t)=>{if("string"!=typeof e||!e)throw new i.JWKInvalid(`${t} missing or invalid`)};async function u(e,t){if(!(0,a.default)(e))throw new TypeError("JWK must be an object");if(null!=t||(t="sha256"),"sha256"!==t&&"sha384"!==t&&"sha512"!==t)throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let r;switch(e.kty){case"EC":c(e.crv,'"crv" (Curve) Parameter'),c(e.x,'"x" (X Coordinate) Parameter'),c(e.y,'"y" (Y Coordinate) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case"OKP":c(e.crv,'"crv" (Subtype of Key Pair) Parameter'),c(e.x,'"x" (Public Key) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x};break;case"RSA":c(e.e,'"e" (Exponent) Parameter'),c(e.n,'"n" (Modulus) Parameter'),r={e:e.e,kty:e.kty,n:e.n};break;case"oct":c(e.k,'"k" (Key Value) Parameter'),r={k:e.k,kty:e.kty};break;default:throw new i.JOSENotSupported('"kty" (Key Type) Parameter missing or unsupported')}const u=s.encoder.encode(JSON.stringify(r));return(0,o.encode)(await(0,n.default)(t,u))}t.calculateJwkThumbprint=u,t.calculateJwkThumbprintUri=async function(e,t){null!=t||(t="sha256");const r=await u(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${r}`}},6980(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createLocalJWKSet=t.LocalJWKSet=t.isJWKSLike=void 0;const n=r(7364),o=r(6247),i=r(1855);function s(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(a)}function a(e){return(0,i.default)(e)}t.isJWKSLike=s;class c{constructor(e){if(this._cached=new WeakMap,!s(e))throw new o.JWKSInvalid("JSON Web Key Set malformed");var t;this._jwks=(t=e,"function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t)))}async getKey(e,t){const{alg:r,kid:n}={...e,...null==t?void 0:t.header},i=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new o.JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set')}}(r),s=this._jwks.keys.filter(e=>{let t=i===e.kty;if(t&&"string"==typeof n&&(t=n===e.kid),t&&"string"==typeof e.alg&&(t=r===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t&&"EdDSA"===r&&(t="Ed25519"===e.crv||"Ed448"===e.crv),t)switch(r){case"ES256":t="P-256"===e.crv;break;case"ES256K":t="secp256k1"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv}return t}),{0:a,length:c}=s;if(0===c)throw new o.JWKSNoMatchingKey;if(1!==c){const e=new o.JWKSMultipleMatchingKeys,{_cached:t}=this;throw e[Symbol.asyncIterator]=async function*(){for(const e of s)try{yield await u(t,e,r)}catch{continue}},e}return u(this._cached,a,r)}}async function u(e,t,r){const i=e.get(t)||e.set(t,{}).get(t);if(void 0===i[r]){const e=await(0,n.importJWK)({...t,ext:!0},r);if(e instanceof Uint8Array||"public"!==e.type)throw new o.JWKSInvalid("JSON Web Key Set members must be public keys");i[r]=e}return i[r]}t.LocalJWKSet=c,t.createLocalJWKSet=function(e){const t=new c(e);return async function(e,r){return t.getKey(e,r)}}},9877(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createRemoteJWKSet=void 0;const n=r(8832),o=r(6247),i=r(6980);class s extends i.LocalJWKSet{constructor(e,t){if(super({keys:[]}),this._jwks=void 0,!(e instanceof URL))throw new TypeError("url must be an instance of URL");this._url=new URL(e.href),this._options={agent:null==t?void 0:t.agent,headers:null==t?void 0:t.headers},this._timeoutDuration="number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3,this._cooldownDuration="number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4,this._cacheMaxAge="number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5}coolingDown(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cooldownDuration}fresh(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cacheMaxAge}async getKey(e,t){this._jwks&&this.fresh()||await this.reload();try{return await super.getKey(e,t)}catch(r){if(r instanceof o.JWKSNoMatchingKey&&!1===this.coolingDown())return await this.reload(),super.getKey(e,t);throw r}}async reload(){this._pendingFetch&&("undefined"!=typeof WebSocketPair||"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"undefined"!=typeof EdgeRuntime&&"vercel"===EdgeRuntime)&&(this._pendingFetch=void 0),this._pendingFetch||(this._pendingFetch=(0,n.default)(this._url,this._timeoutDuration,this._options).then(e=>{if(!(0,i.isJWKSLike)(e))throw new o.JWKSInvalid("JSON Web Key Set malformed");this._jwks={keys:e.keys},this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(e=>{throw this._pendingFetch=void 0,e})),await this._pendingFetch}}t.createRemoteJWKSet=function(e,t){const r=new s(e,t);return async function(e,t){return r.getKey(e,t)}}},9851(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CompactSign=void 0;const n=r(4329);t.CompactSign=class{constructor(e){this._flattened=new n.FlattenedSign(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){const r=await this._flattened.sign(e,t);if(void 0===r.payload)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}},1427(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compactVerify=void 0;const n=r(6833),o=r(6247),i=r(5821);t.compactVerify=async function(e,t,r){if(e instanceof Uint8Array&&(e=i.decoder.decode(e)),"string"!=typeof e)throw new o.JWSInvalid("Compact JWS must be a string or Uint8Array");const{0:s,1:a,2:c,length:u}=e.split(".");if(3!==u)throw new o.JWSInvalid("Invalid Compact JWS");const l=await(0,n.flattenedVerify)({payload:a,protected:s,signature:c},t,r),d={payload:l.payload,protectedHeader:l.protectedHeader};return"function"==typeof t?{...d,key:l.key}:d}},4329(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FlattenedSign=void 0;const n=r(82),o=r(7965),i=r(9476),s=r(6247),a=r(5821),c=r(1688),u=r(2458);t.FlattenedSign=class{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,t){if(!this._protectedHeader&&!this._unprotectedHeader)throw new s.JWSInvalid("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!(0,i.default)(this._protectedHeader,this._unprotectedHeader))throw new s.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader};let l=!0;if((0,u.default)(s.JWSInvalid,new Map([["b64",!0]]),null==t?void 0:t.crit,this._protectedHeader,r).has("b64")&&(l=this._protectedHeader.b64,"boolean"!=typeof l))throw new s.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:d}=r;if("string"!=typeof d||!d)throw new s.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');(0,c.default)(d,e,"sign");let p,f=this._payload;l&&(f=a.encoder.encode((0,n.encode)(f))),p=this._protectedHeader?a.encoder.encode((0,n.encode)(JSON.stringify(this._protectedHeader))):a.encoder.encode("");const h=(0,a.concat)(p,a.encoder.encode("."),f),y=await(0,o.default)(d,e,h),m={signature:(0,n.encode)(y),payload:""};return l&&(m.payload=a.decoder.decode(f)),this._unprotectedHeader&&(m.header=this._unprotectedHeader),this._protectedHeader&&(m.protected=a.decoder.decode(p)),m}}},6833(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.flattenedVerify=void 0;const n=r(82),o=r(3117),i=r(6247),s=r(5821),a=r(9476),c=r(1855),u=r(1688),l=r(2458),d=r(8604);t.flattenedVerify=async function(e,t,r){var p;if(!(0,c.default)(e))throw new i.JWSInvalid("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new i.JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new i.JWSInvalid("JWS Protected Header incorrect type");if(void 0===e.payload)throw new i.JWSInvalid("JWS Payload missing");if("string"!=typeof e.signature)throw new i.JWSInvalid("JWS Signature missing or incorrect type");if(void 0!==e.header&&!(0,c.default)(e.header))throw new i.JWSInvalid("JWS Unprotected Header incorrect type");let f={};if(e.protected)try{const t=(0,n.decode)(e.protected);f=JSON.parse(s.decoder.decode(t))}catch{throw new i.JWSInvalid("JWS Protected Header is invalid")}if(!(0,a.default)(f,e.header))throw new i.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const h={...f,...e.header};let y=!0;if((0,l.default)(i.JWSInvalid,new Map([["b64",!0]]),null==r?void 0:r.crit,f,h).has("b64")&&(y=f.b64,"boolean"!=typeof y))throw new i.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:m}=h;if("string"!=typeof m||!m)throw new i.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');const g=r&&(0,d.default)("algorithms",r.algorithms);if(g&&!g.has(m))throw new i.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(y){if("string"!=typeof e.payload)throw new i.JWSInvalid("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new i.JWSInvalid("JWS Payload must be a string or an Uint8Array instance");let v=!1;"function"==typeof t&&(t=await t(f,e),v=!0),(0,u.default)(m,t,"verify");const w=(0,s.concat)(s.encoder.encode(null!==(p=e.protected)&&void 0!==p?p:""),s.encoder.encode("."),"string"==typeof e.payload?s.encoder.encode(e.payload):e.payload);let E,b;try{E=(0,n.decode)(e.signature)}catch{throw new i.JWSInvalid("Failed to base64url decode the signature")}if(!await(0,o.default)(m,t,E,w))throw new i.JWSSignatureVerificationFailed;if(y)try{b=(0,n.decode)(e.payload)}catch{throw new i.JWSInvalid("Failed to base64url decode the payload")}else b="string"==typeof e.payload?s.encoder.encode(e.payload):e.payload;const S={payload:b};return void 0!==e.protected&&(S.protectedHeader=f),void 0!==e.header&&(S.unprotectedHeader=e.header),v?{...S,key:t}:S}},7440(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GeneralSign=void 0;const n=r(4329),o=r(6247);class i{constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setProtectedHeader(e){if(this.protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this.protectedHeader=e,this}setUnprotectedHeader(e){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addSignature(...e){return this.parent.addSignature(...e)}sign(...e){return this.parent.sign(...e)}done(){return this.parent}}t.GeneralSign=class{constructor(e){this._signatures=[],this._payload=e}addSignature(e,t){const r=new i(this,e,t);return this._signatures.push(r),r}async sign(){if(!this._signatures.length)throw new o.JWSInvalid("at least one signature must be added");const e={signatures:[],payload:""};for(let t=0;t<this._signatures.length;t++){const r=this._signatures[t],i=new n.FlattenedSign(this._payload);i.setProtectedHeader(r.protectedHeader),i.setUnprotectedHeader(r.unprotectedHeader);const{payload:s,...a}=await i.sign(r.key,r.options);if(0===t)e.payload=s;else if(e.payload!==s)throw new o.JWSInvalid("inconsistent use of JWS Unencoded Payload (RFC7797)");e.signatures.push(a)}return e}}},9060(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generalVerify=void 0;const n=r(6833),o=r(6247),i=r(1855);t.generalVerify=async function(e,t,r){if(!(0,i.default)(e))throw new o.JWSInvalid("General JWS must be an object");if(!Array.isArray(e.signatures)||!e.signatures.every(i.default))throw new o.JWSInvalid("JWS Signatures missing or incorrect type");for(const o of e.signatures)try{return await(0,n.flattenedVerify)({header:o.header,payload:e.payload,protected:o.protected,signature:o.signature},t,r)}catch{}throw new o.JWSSignatureVerificationFailed}},3814(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.jwtDecrypt=void 0;const n=r(6923),o=r(493),i=r(6247);t.jwtDecrypt=async function(e,t,r){const s=await(0,n.compactDecrypt)(e,t,r),a=(0,o.default)(s.protectedHeader,s.plaintext,r),{protectedHeader:c}=s;if(void 0!==c.iss&&c.iss!==a.iss)throw new i.JWTClaimValidationFailed('replicated "iss" claim header parameter mismatch',"iss","mismatch");if(void 0!==c.sub&&c.sub!==a.sub)throw new i.JWTClaimValidationFailed('replicated "sub" claim header parameter mismatch',"sub","mismatch");if(void 0!==c.aud&&JSON.stringify(c.aud)!==JSON.stringify(a.aud))throw new i.JWTClaimValidationFailed('replicated "aud" claim header parameter mismatch',"aud","mismatch");const u={payload:a,protectedHeader:c};return"function"==typeof t?{...u,key:s.key}:u}},6638(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EncryptJWT=void 0;const n=r(7815),o=r(5821),i=r(751);class s extends i.ProduceJWT{setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setKeyManagementParameters(e){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setContentEncryptionKey(e){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=e,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(e,t){const r=new n.CompactEncrypt(o.encoder.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),r.setProtectedHeader(this._protectedHeader),this._iv&&r.setInitializationVector(this._iv),this._cek&&r.setContentEncryptionKey(this._cek),this._keyManagementParameters&&r.setKeyManagementParameters(this._keyManagementParameters),r.encrypt(e,t)}}t.EncryptJWT=s},751(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProduceJWT=void 0;const n=r(936),o=r(1855),i=r(9743);t.ProduceJWT=class{constructor(e){if(!(0,o.default)(e))throw new TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return this._payload="number"==typeof e?{...this._payload,nbf:e}:{...this._payload,nbf:(0,n.default)(new Date)+(0,i.default)(e)},this}setExpirationTime(e){return this._payload="number"==typeof e?{...this._payload,exp:e}:{...this._payload,exp:(0,n.default)(new Date)+(0,i.default)(e)},this}setIssuedAt(e){return this._payload=void 0===e?{...this._payload,iat:(0,n.default)(new Date)}:{...this._payload,iat:e},this}}},2230(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SignJWT=void 0;const n=r(9851),o=r(6247),i=r(5821),s=r(751);class a extends s.ProduceJWT{setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,t){var r;const s=new n.CompactSign(i.encoder.encode(JSON.stringify(this._payload)));if(s.setProtectedHeader(this._protectedHeader),Array.isArray(null===(r=this._protectedHeader)||void 0===r?void 0:r.crit)&&this._protectedHeader.crit.includes("b64")&&!1===this._protectedHeader.b64)throw new o.JWTInvalid("JWTs MUST NOT use unencoded payload");return s.sign(e,t)}}t.SignJWT=a},49(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnsecuredJWT=void 0;const n=r(82),o=r(5821),i=r(6247),s=r(493),a=r(751);class c extends a.ProduceJWT{encode(){return`${n.encode(JSON.stringify({alg:"none"}))}.${n.encode(JSON.stringify(this._payload))}.`}static decode(e,t){if("string"!=typeof e)throw new i.JWTInvalid("Unsecured JWT must be a string");const{0:r,1:a,2:c,length:u}=e.split(".");if(3!==u||""!==c)throw new i.JWTInvalid("Invalid Unsecured JWT");let l;try{if(l=JSON.parse(o.decoder.decode(n.decode(r))),"none"!==l.alg)throw new Error}catch{throw new i.JWTInvalid("Invalid Unsecured JWT")}return{payload:(0,s.default)(l,n.decode(a),t),header:l}}}t.UnsecuredJWT=c},3082(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.jwtVerify=void 0;const n=r(1427),o=r(493),i=r(6247);t.jwtVerify=async function(e,t,r){var s;const a=await(0,n.compactVerify)(e,t,r);if((null===(s=a.protectedHeader.crit)||void 0===s?void 0:s.includes("b64"))&&!1===a.protectedHeader.b64)throw new i.JWTInvalid("JWTs MUST NOT use unencoded payload");const c={payload:(0,o.default)(a.protectedHeader,a.payload,r),protectedHeader:a.protectedHeader};return"function"==typeof t?{...c,key:a.key}:c}},68(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exportJWK=t.exportPKCS8=t.exportSPKI=void 0;const n=r(293),o=r(293),i=r(9590);t.exportSPKI=async function(e){return(0,n.toSPKI)(e)},t.exportPKCS8=async function(e){return(0,o.toPKCS8)(e)},t.exportJWK=async function(e){return(0,i.default)(e)}},409(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateKeyPair=void 0;const n=r(7975);t.generateKeyPair=async function(e,t){return(0,n.generateKeyPair)(e,t)}},4121(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateSecret=void 0;const n=r(7975);t.generateSecret=async function(e,t){return(0,n.generateSecret)(e,t)}},7364(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.importJWK=t.importPKCS8=t.importX509=t.importSPKI=void 0;const n=r(82),o=r(293),i=r(4660),s=r(6247),a=r(1855);t.importSPKI=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PUBLIC KEY-----"))throw new TypeError('"spki" must be SPKI formatted string');return(0,o.fromSPKI)(e,t,r)},t.importX509=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN CERTIFICATE-----"))throw new TypeError('"x509" must be X.509 formatted string');return(0,o.fromX509)(e,t,r)},t.importPKCS8=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return(0,o.fromPKCS8)(e,t,r)},t.importJWK=async function(e,t,r){var o;if(!(0,a.default)(e))throw new TypeError("JWK must be an object");switch(t||(t=e.alg),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return null!=r||(r=!0!==e.ext),r?(0,i.default)({...e,alg:t,ext:null!==(o=e.ext)&&void 0!==o&&o}):(0,n.decode)(e.k);case"RSA":if(void 0!==e.oth)throw new s.JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return(0,i.default)({...e,alg:t});default:throw new s.JOSENotSupported('Unsupported "kty" (Key Type) Parameter value')}}},7031(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unwrap=t.wrap=void 0;const n=r(2027),o=r(4799),i=r(7974),s=r(82);t.wrap=async function(e,t,r,o){const a=e.slice(0,7);o||(o=(0,i.default)(a));const{ciphertext:c,tag:u}=await(0,n.default)(a,r,t,o,new Uint8Array(0));return{encryptedKey:c,iv:(0,s.encode)(o),tag:(0,s.encode)(u)}},t.unwrap=async function(e,t,r,n,i){const s=e.slice(0,7);return(0,o.default)(s,t,r,n,i,new Uint8Array(0))}},5821(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatKdf=t.lengthAndInput=t.uint32be=t.uint64be=t.p2s=t.concat=t.decoder=t.encoder=void 0;const n=r(6332);t.encoder=new TextEncoder,t.decoder=new TextDecoder;const o=2**32;function i(...e){const t=e.reduce((e,{length:t})=>e+t,0),r=new Uint8Array(t);let n=0;return e.forEach(e=>{r.set(e,n),n+=e.length}),r}function s(e,t,r){if(t<0||t>=o)throw new RangeError(`value must be >= 0 and <= 4294967295. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,255&t],r)}function a(e){const t=new Uint8Array(4);return s(t,e),t}t.concat=i,t.p2s=function(e,r){return i(t.encoder.encode(e),new Uint8Array([0]),r)},t.uint64be=function(e){const t=Math.floor(e/o),r=e%o,n=new Uint8Array(8);return s(n,t,0),s(n,r,4),n},t.uint32be=a,t.lengthAndInput=function(e){return i(a(e.length),e)},t.concatKdf=async function(e,t,r){const o=Math.ceil((t>>3)/32),i=new Uint8Array(32*o);for(let t=0;t<o;t++){const o=new Uint8Array(4+e.length+r.length);o.set(a(t+1)),o.set(e,4),o.set(r,4+e.length),i.set(await(0,n.default)("sha256",o),32*t)}return i.slice(0,t>>3)}},1784(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bitLength=void 0;const n=r(6247),o=r(927);function i(e){switch(e){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 n.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}t.bitLength=i,t.default=e=>(0,o.default)(new Uint8Array(i(e)>>3))},1146(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6247),o=r(7974);t.default=(e,t)=>{if(t.length<<3!==(0,o.bitLength)(e))throw new n.JWEInvalid("Invalid Initialization Vector length")}},1688(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8737),o=r(740);t.default=(e,t,r)=>{e.startsWith("HS")||"dir"===e||e.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(e)?((e,t)=>{if(!(t instanceof Uint8Array)){if(!(0,o.default)(t))throw new TypeError((0,n.withAlg)(e,t,...o.types,"Uint8Array"));if("secret"!==t.type)throw new TypeError(`${o.types.join(" or ")} instances for symmetric algorithms must be of type "secret"`)}})(e,t):((e,t,r)=>{if(!(0,o.default)(t))throw new TypeError((0,n.withAlg)(e,t,...o.types));if("secret"===t.type)throw new TypeError(`${o.types.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===r&&"public"===t.type)throw new TypeError(`${o.types.join(" or ")} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===r&&"public"===t.type)throw new TypeError(`${o.types.join(" or ")} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&"verify"===r&&"private"===t.type)throw new TypeError(`${o.types.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&"encrypt"===r&&"private"===t.type)throw new TypeError(`${o.types.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`)})(e,t,r)}},8405(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6247);t.default=function(e){if(!(e instanceof Uint8Array)||e.length<8)throw new n.JWEInvalid("PBES2 Salt Input must be 8 or more octets")}},2484(e,t){"use strict";function r(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function n(e,t){return e.name===t}function o(e){return parseInt(e.name.slice(4),10)}function i(e,t){if(t.length&&!t.some(t=>e.usages.includes(t))){let e="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();e+=`one of ${t.join(", ")}, or ${r}.`}else 2===t.length?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw new TypeError(e)}}Object.defineProperty(t,"__esModule",{value:!0}),t.checkEncCryptoKey=t.checkSigCryptoKey=void 0,t.checkSigCryptoKey=function(e,t,...s){switch(t){case"HS256":case"HS384":case"HS512":{if(!n(e.algorithm,"HMAC"))throw r("HMAC");const i=parseInt(t.slice(2),10);if(o(e.algorithm.hash)!==i)throw r(`SHA-${i}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!n(e.algorithm,"RSASSA-PKCS1-v1_5"))throw r("RSASSA-PKCS1-v1_5");const i=parseInt(t.slice(2),10);if(o(e.algorithm.hash)!==i)throw r(`SHA-${i}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!n(e.algorithm,"RSA-PSS"))throw r("RSA-PSS");const i=parseInt(t.slice(2),10);if(o(e.algorithm.hash)!==i)throw r(`SHA-${i}`,"algorithm.hash");break}case"EdDSA":if("Ed25519"!==e.algorithm.name&&"Ed448"!==e.algorithm.name)throw r("Ed25519 or Ed448");break;case"ES256":case"ES384":case"ES512":{if(!n(e.algorithm,"ECDSA"))throw r("ECDSA");const o=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(t);if(e.algorithm.namedCurve!==o)throw r(o,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}i(e,s)},t.checkEncCryptoKey=function(e,t,...s){switch(t){case"A128GCM":case"A192GCM":case"A256GCM":{if(!n(e.algorithm,"AES-GCM"))throw r("AES-GCM");const o=parseInt(t.slice(1,4),10);if(e.algorithm.length!==o)throw r(o,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!n(e.algorithm,"AES-KW"))throw r("AES-KW");const o=parseInt(t.slice(1,4),10);if(e.algorithm.length!==o)throw r(o,"algorithm.length");break}case"ECDH":switch(e.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw r("ECDH, X25519, or X448")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!n(e.algorithm,"PBKDF2"))throw r("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!n(e.algorithm,"RSA-OAEP"))throw r("RSA-OAEP");const i=parseInt(t.slice(9),10)||1;if(o(e.algorithm.hash)!==i)throw r(`SHA-${i}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}i(e,s)}},4760(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2395),o=r(6112),i=r(5904),s=r(3020),a=r(82),c=r(6247),u=r(1784),l=r(7364),d=r(1688),p=r(1855),f=r(7031);t.default=async function(e,t,r,h,y){switch((0,d.default)(e,t,"decrypt"),e){case"dir":if(void 0!==r)throw new c.JWEInvalid("Encountered unexpected JWE Encrypted Key");return t;case"ECDH-ES":if(void 0!==r)throw new c.JWEInvalid("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!(0,p.default)(h.epk))throw new c.JWEInvalid('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!o.ecdhAllowed(t))throw new c.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");const i=await(0,l.importJWK)(h.epk,e);let s,d;if(void 0!==h.apu){if("string"!=typeof h.apu)throw new c.JWEInvalid('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{s=(0,a.decode)(h.apu)}catch{throw new c.JWEInvalid("Failed to base64url decode the apu")}}if(void 0!==h.apv){if("string"!=typeof h.apv)throw new c.JWEInvalid('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{d=(0,a.decode)(h.apv)}catch{throw new c.JWEInvalid("Failed to base64url decode the apv")}}const f=await o.deriveKey(i,t,"ECDH-ES"===e?h.enc:e,"ECDH-ES"===e?(0,u.bitLength)(h.enc):parseInt(e.slice(-5,-2),10),s,d);if("ECDH-ES"===e)return f;if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");return(0,n.unwrap)(e.slice(-6),f,r)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");return(0,s.decrypt)(e,t,r);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");if("number"!=typeof h.p2c)throw new c.JWEInvalid('JOSE Header "p2c" (PBES2 Count) missing or invalid');const n=(null==y?void 0:y.maxPBES2Count)||1e4;if(h.p2c>n)throw new c.JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof h.p2s)throw new c.JWEInvalid('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let o;try{o=(0,a.decode)(h.p2s)}catch{throw new c.JWEInvalid("Failed to base64url decode the p2s")}return(0,i.decrypt)(e,t,r,h.p2c,o)}case"A128KW":case"A192KW":case"A256KW":if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");return(0,n.unwrap)(e,t,r);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");if("string"!=typeof h.iv)throw new c.JWEInvalid('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof h.tag)throw new c.JWEInvalid('JOSE Header "tag" (Authentication Tag) missing or invalid');let n,o;try{n=(0,a.decode)(h.iv)}catch{throw new c.JWEInvalid("Failed to base64url decode the iv")}try{o=(0,a.decode)(h.tag)}catch{throw new c.JWEInvalid("Failed to base64url decode the tag")}return(0,f.unwrap)(e,t,r,n,o)}default:throw new c.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}}},508(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2395),o=r(6112),i=r(5904),s=r(3020),a=r(82),c=r(1784),u=r(6247),l=r(68),d=r(1688),p=r(7031);t.default=async function(e,t,r,f,h={}){let y,m,g;switch((0,d.default)(e,r,"encrypt"),e){case"dir":g=r;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!o.ecdhAllowed(r))throw new u.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");const{apu:i,apv:s}=h;let{epk:d}=h;d||(d=(await o.generateEpk(r)).privateKey);const{x:p,y:v,crv:w,kty:E}=await(0,l.exportJWK)(d),b=await o.deriveKey(r,d,"ECDH-ES"===e?t:e,"ECDH-ES"===e?(0,c.bitLength)(t):parseInt(e.slice(-5,-2),10),i,s);if(m={epk:{x:p,crv:w,kty:E}},"EC"===E&&(m.epk.y=v),i&&(m.apu=(0,a.encode)(i)),s&&(m.apv=(0,a.encode)(s)),"ECDH-ES"===e){g=b;break}g=f||(0,c.default)(t);const S=e.slice(-6);y=await(0,n.wrap)(S,b,g);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":g=f||(0,c.default)(t),y=await(0,s.encrypt)(e,r,g);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{g=f||(0,c.default)(t);const{p2c:n,p2s:o}=h;({encryptedKey:y,...m}=await(0,i.encrypt)(e,r,g,n,o));break}case"A128KW":case"A192KW":case"A256KW":g=f||(0,c.default)(t),y=await(0,n.wrap)(e,r,g);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{g=f||(0,c.default)(t);const{iv:n}=h;({encryptedKey:y,...m}=await(0,p.wrap)(e,r,g,n));break}default:throw new u.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:g,encryptedKey:y,parameters:m}}},936(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=e=>Math.floor(e.getTime()/1e3)},8737(e,t){"use strict";function r(e,t,...r){if(r.length>2){const t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor&&t.constructor.name&&(e+=` Received an instance of ${t.constructor.name}`),e}Object.defineProperty(t,"__esModule",{value:!0}),t.withAlg=void 0,t.default=(e,...t)=>r("Key must be ",e,...t),t.withAlg=function(e,t,...n){return r(`Key for the ${e} algorithm must be `,t,...n)}},9476(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=(...e)=>{const t=e.filter(Boolean);if(0===t.length||1===t.length)return!0;let r;for(const e of t){const t=Object.keys(e);if(r&&0!==r.size)for(const e of t){if(r.has(e))return!1;r.add(e)}else r=new Set(t)}return!0}},1855(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let r=e;for(;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}},7974(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bitLength=void 0;const n=r(6247),o=r(927);function i(e){switch(e){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 n.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}t.bitLength=i,t.default=e=>(0,o.default)(new Uint8Array(i(e)>>3))},493(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6247),o=r(5821),i=r(936),s=r(9743),a=r(1855),c=e=>e.toLowerCase().replace(/^application\//,"");t.default=(e,t,r={})=>{const{typ:u}=r;if(u&&("string"!=typeof e.typ||c(e.typ)!==c(u)))throw new n.JWTClaimValidationFailed('unexpected "typ" JWT header value',"typ","check_failed");let l;try{l=JSON.parse(o.decoder.decode(t))}catch{}if(!(0,a.default)(l))throw new n.JWTInvalid("JWT Claims Set must be a top-level JSON object");const{requiredClaims:d=[],issuer:p,subject:f,audience:h,maxTokenAge:y}=r;void 0!==y&&d.push("iat"),void 0!==h&&d.push("aud"),void 0!==f&&d.push("sub"),void 0!==p&&d.push("iss");for(const e of new Set(d.reverse()))if(!(e in l))throw new n.JWTClaimValidationFailed(`missing required "${e}" claim`,e,"missing");if(p&&!(Array.isArray(p)?p:[p]).includes(l.iss))throw new n.JWTClaimValidationFailed('unexpected "iss" claim value',"iss","check_failed");if(f&&l.sub!==f)throw new n.JWTClaimValidationFailed('unexpected "sub" claim value',"sub","check_failed");if(h&&(g="string"==typeof h?[h]:h,!("string"==typeof(m=l.aud)?g.includes(m):Array.isArray(m)&&g.some(Set.prototype.has.bind(new Set(m))))))throw new n.JWTClaimValidationFailed('unexpected "aud" claim value',"aud","check_failed");var m,g;let v;switch(typeof r.clockTolerance){case"string":v=(0,s.default)(r.clockTolerance);break;case"number":v=r.clockTolerance;break;case"undefined":v=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:w}=r,E=(0,i.default)(w||new Date);if((void 0!==l.iat||y)&&"number"!=typeof l.iat)throw new n.JWTClaimValidationFailed('"iat" claim must be a number',"iat","invalid");if(void 0!==l.nbf){if("number"!=typeof l.nbf)throw new n.JWTClaimValidationFailed('"nbf" claim must be a number',"nbf","invalid");if(l.nbf>E+v)throw new n.JWTClaimValidationFailed('"nbf" claim timestamp check failed',"nbf","check_failed")}if(void 0!==l.exp){if("number"!=typeof l.exp)throw new n.JWTClaimValidationFailed('"exp" claim must be a number',"exp","invalid");if(l.exp<=E-v)throw new n.JWTExpired('"exp" claim timestamp check failed',"exp","check_failed")}if(y){const e=E-l.iat;if(e-v>("number"==typeof y?y:(0,s.default)(y)))throw new n.JWTExpired('"iat" claim timestamp check failed (too far in the past)',"iat","check_failed");if(e<0-v)throw new n.JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)',"iat","check_failed")}return l}},9743(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=/^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i;t.default=e=>{const t=r.exec(e);if(!t)throw new TypeError("Invalid time period format");const n=parseFloat(t[1]);switch(t[2].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":return Math.round(n);case"minute":case"minutes":case"min":case"mins":case"m":return Math.round(60*n);case"hour":case"hours":case"hr":case"hrs":case"h":return Math.round(3600*n);case"day":case"days":case"d":return Math.round(86400*n);case"week":case"weeks":case"w":return Math.round(604800*n);default:return Math.round(31557600*n)}}},8604(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=(e,t)=>{if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}},2458(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6247);t.default=function(e,t,r,o,i){if(void 0!==i.crit&&void 0===o.crit)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!o||void 0===o.crit)return new Set;if(!Array.isArray(o.crit)||0===o.crit.length||o.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let s;s=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t;for(const t of o.crit){if(!s.has(t))throw new n.JOSENotSupported(`Extension Header Parameter "${t}" is not recognized`);if(void 0===i[t])throw new e(`Extension Header Parameter "${t}" is missing`);if(s.get(t)&&void 0===o[t])throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}return new Set(o.crit)}},2395(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unwrap=t.wrap=void 0;const n=r(181),o=r(6982),i=r(6247),s=r(5821),a=r(8993),c=r(2484),u=r(4512),l=r(8737),d=r(3022),p=r(740);function f(e,t){if(e.symmetricKeySize<<3!==parseInt(t.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${t}`)}function h(e,t,r){if((0,u.default)(e))return e;if(e instanceof Uint8Array)return(0,o.createSecretKey)(e);if((0,a.isCryptoKey)(e))return(0,c.checkEncCryptoKey)(e,t,r),o.KeyObject.from(e);throw new TypeError((0,l.default)(e,...p.types,"Uint8Array"))}t.wrap=(e,t,r)=>{const a=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,d.default)(a))throw new i.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);const c=h(t,e,"wrapKey");f(c,e);const u=(0,o.createCipheriv)(a,c,n.Buffer.alloc(8,166));return(0,s.concat)(u.update(r),u.final())},t.unwrap=(e,t,r)=>{const a=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,d.default)(a))throw new i.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);const c=h(t,e,"unwrapKey");f(c,e);const u=(0,o.createDecipheriv)(a,c,n.Buffer.alloc(8,166));return(0,s.concat)(u.update(r),u.final())}},293(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromX509=t.fromSPKI=t.fromPKCS8=t.toPKCS8=t.toSPKI=void 0;const n=r(6982),o=r(181),i=r(8993),s=r(4512),a=r(8737),c=r(740),u=(e,t,r)=>{let o;if((0,i.isCryptoKey)(r)){if(!r.extractable)throw new TypeError("CryptoKey is not extractable");o=n.KeyObject.from(r)}else{if(!(0,s.default)(r))throw new TypeError((0,a.default)(r,...c.types));o=r}if(o.type!==e)throw new TypeError(`key is not a ${e} key`);return o.export({format:"pem",type:t})};t.toSPKI=e=>u("public","spki",e),t.toPKCS8=e=>u("private","pkcs8",e),t.fromPKCS8=e=>(0,n.createPrivateKey)({key:o.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,""),"base64"),type:"pkcs8",format:"der"}),t.fromSPKI=e=>(0,n.createPublicKey)({key:o.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,""),"base64"),type:"spki",format:"der"}),t.fromX509=e=>(0,n.createPublicKey)({key:e,type:"spki",format:"pem"})},1326(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){if(48!==e[0])throw new TypeError;if(this.buffer=e,this.offset=1,this.decodeLength()!==e.length-this.offset)throw new TypeError}decodeLength(){let e=this.buffer[this.offset++];if(128&e){const t=-129&e;e=0;for(let r=0;r<t;r++)e=e<<8|this.buffer[this.offset+r];this.offset+=t}return e}unsignedInteger(){if(2!==this.buffer[this.offset++])throw new TypeError;let e=this.decodeLength();0===this.buffer[this.offset]&&(this.offset++,e--);const t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}end(){if(this.offset!==this.buffer.length)throw new TypeError}}},4138(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(181),o=r(6247),i=n.Buffer.from([0]),s=n.Buffer.from([2]),a=n.Buffer.from([3]),c=n.Buffer.from([48]),u=n.Buffer.from([4]),l=e=>{if(e<128)return n.Buffer.from([e]);const t=n.Buffer.alloc(5);t.writeUInt32BE(e,1);let r=1;for(;0===t[r];)r++;return t[r-1]=128|5-r,t.slice(r-1)},d=new Map([["P-256",n.Buffer.from("06 08 2A 86 48 CE 3D 03 01 07".replace(/ /g,""),"hex")],["secp256k1",n.Buffer.from("06 05 2B 81 04 00 0A".replace(/ /g,""),"hex")],["P-384",n.Buffer.from("06 05 2B 81 04 00 22".replace(/ /g,""),"hex")],["P-521",n.Buffer.from("06 05 2B 81 04 00 23".replace(/ /g,""),"hex")],["ecPublicKey",n.Buffer.from("06 07 2A 86 48 CE 3D 02 01".replace(/ /g,""),"hex")],["X25519",n.Buffer.from("06 03 2B 65 6E".replace(/ /g,""),"hex")],["X448",n.Buffer.from("06 03 2B 65 6F".replace(/ /g,""),"hex")],["Ed25519",n.Buffer.from("06 03 2B 65 70".replace(/ /g,""),"hex")],["Ed448",n.Buffer.from("06 03 2B 65 71".replace(/ /g,""),"hex")]]);t.default=class{constructor(){this.length=0,this.elements=[]}oidFor(e){const t=d.get(e);if(!t)throw new o.JOSENotSupported("Invalid or unsupported OID");this.elements.push(t),this.length+=t.length}zero(){this.elements.push(s,n.Buffer.from([1]),i),this.length+=3}one(){this.elements.push(s,n.Buffer.from([1]),n.Buffer.from([1])),this.length+=3}unsignedInteger(e){if(128&e[0]){const t=l(e.length+1);this.elements.push(s,t,i,e),this.length+=2+t.length+e.length}else{let t=0;for(;0===e[t]&&!(128&e[t+1]);)t++;const r=l(e.length-t);this.elements.push(s,l(e.length-t),e.slice(t)),this.length+=1+r.length+e.length-t}}octStr(e){const t=l(e.length);this.elements.push(u,l(e.length),e),this.length+=1+t.length+e.length}bitStr(e){const t=l(e.length+1);this.elements.push(a,l(e.length+1),i,e),this.length+=1+t.length+e.length+1}add(e){this.elements.push(e),this.length+=e.length}end(e=c){const t=l(this.length);return n.Buffer.concat([e,t,...this.elements],1+t.length+this.length)}}},82(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=t.encodeBase64=t.decodeBase64=void 0;const n=r(181),o=r(5821);let i;n.Buffer.isEncoding("base64url")?t.encode=i=e=>n.Buffer.from(e).toString("base64url"):t.encode=i=e=>n.Buffer.from(e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),t.decodeBase64=e=>n.Buffer.from(e,"base64"),t.encodeBase64=e=>n.Buffer.from(e).toString("base64"),t.decode=e=>n.Buffer.from(function(e){let t=e;return t instanceof Uint8Array&&(t=o.decoder.decode(t)),t}(e),"base64")},4803(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6982),o=r(5821);t.default=function(e,t,r,i,s,a){const c=(0,o.concat)(e,t,r,(0,o.uint64be)(e.length<<3)),u=(0,n.createHmac)(`sha${i}`,s);return u.update(c),u.digest().slice(0,a>>3)}},2319(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6247),o=r(4512);t.default=(e,t)=>{let r;switch(e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":r=parseInt(e.slice(-3),10);break;case"A128GCM":case"A192GCM":case"A256GCM":r=parseInt(e.slice(1,4),10);break;default:throw new n.JOSENotSupported(`Content Encryption Algorithm ${e} is not supported either by JOSE or your javascript runtime`)}if(t instanceof Uint8Array){const e=t.byteLength<<3;if(e!==r)throw new n.JWEInvalid(`Invalid Content Encryption Key length. Expected ${r} bits, got ${e} bits`);return}if((0,o.default)(t)&&"secret"===t.type){const e=t.symmetricKeySize<<3;if(e!==r)throw new n.JWEInvalid(`Invalid Content Encryption Key length. Expected ${r} bits, got ${e} bits`);return}throw new TypeError("Invalid Content Encryption Key type")}},5363(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setModulusLength=t.weakMap=void 0,t.weakMap=new WeakMap;const r=(e,t)=>{let n=e.readUInt8(1);if(!(128&n))return 0===t?n:r(e.subarray(2+n),t-1);const o=127&n;n=0;for(let t=0;t<o;t++)n<<=8,n|=e.readUInt8(2+t);return 0===t?n:r(e.subarray(2+n),t-1)};t.setModulusLength=(e,r)=>{t.weakMap.set(e,r)},t.default=(e,n)=>{if((e=>{var n,o;if(t.weakMap.has(e))return t.weakMap.get(e);const i=null!==(o=null===(n=e.asymmetricKeyDetails)||void 0===n?void 0:n.modulusLength)&&void 0!==o?o:((e,t)=>{const n=e.readUInt8(1);if(!(128&n))return r(e.subarray(2),t);const o=127&n;return r(e.subarray(2+o),t)})(e.export({format:"der",type:"pkcs1"}),"private"===e.type?1:0)-1<<3;return t.weakMap.set(e,i),i})(e)<2048)throw new TypeError(`${n} requires key modulusLength to be 2048 bits or larger`)}},3022(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6982);let o;t.default=e=>(o||(o=new Set((0,n.getCiphers)())),o.has(e))},4799(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6982),o=r(1146),i=r(2319),s=r(5821),a=r(6247),c=r(2167),u=r(4803),l=r(8993),d=r(2484),p=r(4512),f=r(8737),h=r(3022),y=r(740);t.default=(e,t,r,m,g,v)=>{let w;if((0,l.isCryptoKey)(t))(0,d.checkEncCryptoKey)(t,e,"decrypt"),w=n.KeyObject.from(t);else{if(!(t instanceof Uint8Array||(0,p.default)(t)))throw new TypeError((0,f.default)(t,...y.types,"Uint8Array"));w=t}switch((0,i.default)(e,w),(0,o.default)(e,m),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return function(e,t,r,o,i,l){const d=parseInt(e.slice(1,4),10);(0,p.default)(t)&&(t=t.export());const f=t.subarray(d>>3),y=t.subarray(0,d>>3),m=parseInt(e.slice(-3),10),g=`aes-${d}-cbc`;if(!(0,h.default)(g))throw new a.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const v=(0,u.default)(l,o,r,m,y,d);let w,E;try{w=(0,c.default)(i,v)}catch{}if(!w)throw new a.JWEDecryptionFailed;try{const e=(0,n.createDecipheriv)(g,f,o);E=(0,s.concat)(e.update(r),e.final())}catch{}if(!E)throw new a.JWEDecryptionFailed;return E}(e,w,r,m,g,v);case"A128GCM":case"A192GCM":case"A256GCM":return function(e,t,r,o,i,s){const c=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,h.default)(c))throw new a.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);try{const e=(0,n.createDecipheriv)(c,t,o,{authTagLength:16});e.setAuthTag(i),s.byteLength&&e.setAAD(s,{plaintextLength:r.length});const a=e.update(r);return e.final(),a}catch{throw new a.JWEDecryptionFailed}}(e,w,r,m,g,v);default:throw new a.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}}},6332(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6982);t.default=(e,t)=>(0,n.createHash)(e).update(t).digest()},5945(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6247);t.default=function(e){switch(e){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 n.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}},6112(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ecdhAllowed=t.generateEpk=t.deriveKey=void 0;const n=r(6982),o=r(9023),i=r(8960),s=r(5821),a=r(6247),c=r(8993),u=r(2484),l=r(4512),d=r(8737),p=r(740),f=(0,o.promisify)(n.generateKeyPair);t.deriveKey=async function(e,t,r,o,i=new Uint8Array(0),a=new Uint8Array(0)){let f,h;if((0,c.isCryptoKey)(e))(0,u.checkEncCryptoKey)(e,"ECDH"),f=n.KeyObject.from(e);else{if(!(0,l.default)(e))throw new TypeError((0,d.default)(e,...p.types));f=e}if((0,c.isCryptoKey)(t))(0,u.checkEncCryptoKey)(t,"ECDH","deriveBits"),h=n.KeyObject.from(t);else{if(!(0,l.default)(t))throw new TypeError((0,d.default)(t,...p.types));h=t}const y=(0,s.concat)((0,s.lengthAndInput)(s.encoder.encode(r)),(0,s.lengthAndInput)(i),(0,s.lengthAndInput)(a),(0,s.uint32be)(o)),m=(0,n.diffieHellman)({privateKey:h,publicKey:f});return(0,s.concatKdf)(m,o,y)},t.generateEpk=async function(e){let t;if((0,c.isCryptoKey)(e))t=n.KeyObject.from(e);else{if(!(0,l.default)(e))throw new TypeError((0,d.default)(e,...p.types));t=e}switch(t.asymmetricKeyType){case"x25519":return f("x25519");case"x448":return f("x448");case"ec":{const e=(0,i.default)(t);return f("ec",{namedCurve:e})}default:throw new a.JOSENotSupported("Invalid or unsupported EPK")}},t.ecdhAllowed=e=>["P-256","P-384","P-521","X25519","X448"].includes((0,i.default)(e))},2027(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6982),o=r(1146),i=r(2319),s=r(5821),a=r(4803),c=r(8993),u=r(2484),l=r(4512),d=r(8737),p=r(6247),f=r(3022),h=r(740);t.default=(e,t,r,y,m)=>{let g;if((0,c.isCryptoKey)(r))(0,u.checkEncCryptoKey)(r,e,"encrypt"),g=n.KeyObject.from(r);else{if(!(r instanceof Uint8Array||(0,l.default)(r)))throw new TypeError((0,d.default)(r,...h.types,"Uint8Array"));g=r}switch((0,i.default)(e,g),(0,o.default)(e,y),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return function(e,t,r,o,i){const c=parseInt(e.slice(1,4),10);(0,l.default)(r)&&(r=r.export());const u=r.subarray(c>>3),d=r.subarray(0,c>>3),h=`aes-${c}-cbc`;if(!(0,f.default)(h))throw new p.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const y=(0,n.createCipheriv)(h,u,o),m=(0,s.concat)(y.update(t),y.final()),g=parseInt(e.slice(-3),10);return{ciphertext:m,tag:(0,a.default)(i,o,m,g,d,c)}}(e,t,g,y,m);case"A128GCM":case"A192GCM":case"A256GCM":return function(e,t,r,o,i){const s=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,f.default)(s))throw new p.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const a=(0,n.createCipheriv)(s,r,o,{authTagLength:16});i.byteLength&&a.setAAD(i,{plaintextLength:t.length});const c=a.update(t);return a.final(),{ciphertext:c,tag:a.getAuthTag()}}(e,t,g,y,m);default:throw new p.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}}},8832(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8611),o=r(5692),i=r(4434),s=r(6247),a=r(5821);t.default=async(e,t,r)=>{let c;switch(e.protocol){case"https:":c=o.get;break;case"http:":c=n.get;break;default:throw new TypeError("Unsupported URL protocol.")}const{agent:u,headers:l}=r,d=c(e.href,{agent:u,timeout:t,headers:l}),[p]=await Promise.race([(0,i.once)(d,"response"),(0,i.once)(d,"timeout")]);if(!p)throw d.destroy(),new s.JWKSTimeout;if(200!==p.statusCode)throw new s.JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");const f=[];for await(const e of p)f.push(e);try{return JSON.parse(a.decoder.decode((0,a.concat)(...f)))}catch{throw new s.JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON")}}},1185(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.jwkImport=t.jwkExport=t.rsaPssParams=t.oneShotCallback=void 0;const[r,n]=process.versions.node.split(".").map(e=>parseInt(e,10));t.oneShotCallback=r>=16||15===r&&n>=13,t.rsaPssParams=!("electron"in process.versions)&&(r>=17||16===r&&n>=9),t.jwkExport=r>=16||15===r&&n>=9,t.jwkImport=r>=16||15===r&&n>=12},7975(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateKeyPair=t.generateSecret=void 0;const n=r(6982),o=r(9023),i=r(927),s=r(5363),a=r(6247),c=(0,o.promisify)(n.generateKeyPair);t.generateSecret=async function(e,t){let r;switch(e){case"HS256":case"HS384":case"HS512":case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":r=parseInt(e.slice(-3),10);break;case"A128KW":case"A192KW":case"A256KW":case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":r=parseInt(e.slice(1,4),10);break;default:throw new a.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return(0,n.createSecretKey)((0,i.default)(new Uint8Array(r>>3)))},t.generateKeyPair=async function(e,t){var r,n;switch(e){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":{const e=null!==(r=null==t?void 0:t.modulusLength)&&void 0!==r?r:2048;if("number"!=typeof e||e<2048)throw new a.JOSENotSupported("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");const n=await c("rsa",{modulusLength:e,publicExponent:65537});return(0,s.setModulusLength)(n.privateKey,e),(0,s.setModulusLength)(n.publicKey,e),n}case"ES256":return c("ec",{namedCurve:"P-256"});case"ES256K":return c("ec",{namedCurve:"secp256k1"});case"ES384":return c("ec",{namedCurve:"P-384"});case"ES512":return c("ec",{namedCurve:"P-521"});case"EdDSA":switch(null==t?void 0:t.crv){case void 0:case"Ed25519":return c("ed25519");case"Ed448":return c("ed448");default:throw new a.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":const e=null!==(n=null==t?void 0:t.crv)&&void 0!==n?n:"P-256";switch(e){case void 0:case"P-256":case"P-384":case"P-521":return c("ec",{namedCurve:e});case"X25519":return c("x25519");case"X448":return c("x448");default:throw new a.JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}default:throw new a.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}}},8960(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setCurve=t.weakMap=void 0;const n=r(181),o=r(6982),i=r(6247),s=r(8993),a=r(4512),c=r(8737),u=r(740),l=n.Buffer.from([42,134,72,206,61,3,1,7]),d=n.Buffer.from([43,129,4,0,34]),p=n.Buffer.from([43,129,4,0,35]),f=n.Buffer.from([43,129,4,0,10]);t.weakMap=new WeakMap;const h=(e,r)=>{var n;let y;if((0,s.isCryptoKey)(e))y=o.KeyObject.from(e);else{if(!(0,a.default)(e))throw new TypeError((0,c.default)(e,...u.types));y=e}if("secret"===y.type)throw new TypeError('only "private" or "public" type keys can be used for this operation');switch(y.asymmetricKeyType){case"ed25519":case"ed448":return`Ed${y.asymmetricKeyType.slice(2)}`;case"x25519":case"x448":return`X${y.asymmetricKeyType.slice(1)}`;case"ec":{if(t.weakMap.has(y))return t.weakMap.get(y);let e=null===(n=y.asymmetricKeyDetails)||void 0===n?void 0:n.namedCurve;if(e||"private"!==y.type){if(!e){const t=y.export({format:"der",type:"spki"}),r=t[1]<128?14:15,n=t[r],o=t.slice(r+1,r+1+n);if(o.equals(l))e="prime256v1";else if(o.equals(d))e="secp384r1";else if(o.equals(p))e="secp521r1";else{if(!o.equals(f))throw new i.JOSENotSupported("Unsupported key curve for this operation");e="secp256k1"}}}else e=h((0,o.createPublicKey)(y),!0);if(r)return e;const s=(e=>{switch(e){case"prime256v1":return"P-256";case"secp384r1":return"P-384";case"secp521r1":return"P-521";case"secp256k1":return"secp256k1";default:throw new i.JOSENotSupported("Unsupported key curve for this operation")}})(e);return t.weakMap.set(y,s),s}default:throw new TypeError("Invalid asymmetric key type for this operation")}};t.setCurve=function(e,r){t.weakMap.set(e,r)},t.default=h},5206(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6982),o=r(8993),i=r(2484),s=r(8737),a=r(740);t.default=function(e,t,r){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError((0,s.default)(t,...a.types));return(0,n.createSecretKey)(t)}if(t instanceof n.KeyObject)return t;if((0,o.isCryptoKey)(t))return(0,i.checkSigCryptoKey)(t,e,r),n.KeyObject.from(t);throw new TypeError((0,s.default)(t,...a.types,"Uint8Array"))}},3254(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6247);t.default=function(e){switch(e){case"HS256":return"sha256";case"HS384":return"sha384";case"HS512":return"sha512";default:throw new n.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}},740(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.types=void 0;const n=r(8993),o=r(4512);t.default=e=>(0,o.default)(e)||(0,n.isCryptoKey)(e);const i=["KeyObject"];t.types=i,(globalThis.CryptoKey||(null===n.default||void 0===n.default?void 0:n.default.CryptoKey))&&i.push("CryptoKey")},4512(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6982),o=r(9023);t.default=o.types.isKeyObject?e=>o.types.isKeyObject(e):e=>null!=e&&e instanceof n.KeyObject},4660(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(181),o=r(6982),i=r(82),s=r(6247),a=r(8960),c=r(5363),u=r(4138),l=r(1185);t.default=e=>{if(l.jwkImport&&"oct"!==e.kty)return e.d?(0,o.createPrivateKey)({format:"jwk",key:e}):(0,o.createPublicKey)({format:"jwk",key:e});switch(e.kty){case"oct":return(0,o.createSecretKey)((0,i.decode)(e.k));case"RSA":{const t=new u.default,r=void 0!==e.d,i=n.Buffer.from(e.n,"base64"),s=n.Buffer.from(e.e,"base64");r?(t.zero(),t.unsignedInteger(i),t.unsignedInteger(s),t.unsignedInteger(n.Buffer.from(e.d,"base64")),t.unsignedInteger(n.Buffer.from(e.p,"base64")),t.unsignedInteger(n.Buffer.from(e.q,"base64")),t.unsignedInteger(n.Buffer.from(e.dp,"base64")),t.unsignedInteger(n.Buffer.from(e.dq,"base64")),t.unsignedInteger(n.Buffer.from(e.qi,"base64"))):(t.unsignedInteger(i),t.unsignedInteger(s));const a={key:t.end(),format:"der",type:"pkcs1"},l=r?(0,o.createPrivateKey)(a):(0,o.createPublicKey)(a);return(0,c.setModulusLength)(l,i.length<<3),l}case"EC":{const t=new u.default,r=void 0!==e.d,i=n.Buffer.concat([n.Buffer.alloc(1,4),n.Buffer.from(e.x,"base64"),n.Buffer.from(e.y,"base64")]);if(r){t.zero();const r=new u.default;r.oidFor("ecPublicKey"),r.oidFor(e.crv),t.add(r.end());const s=new u.default;s.one(),s.octStr(n.Buffer.from(e.d,"base64"));const c=new u.default;c.bitStr(i);const l=c.end(n.Buffer.from([161]));s.add(l);const d=s.end(),p=new u.default;p.add(d);const f=p.end(n.Buffer.from([4]));t.add(f);const h=t.end(),y=(0,o.createPrivateKey)({key:h,format:"der",type:"pkcs8"});return(0,a.setCurve)(y,e.crv),y}const s=new u.default;s.oidFor("ecPublicKey"),s.oidFor(e.crv),t.add(s.end()),t.bitStr(i);const c=t.end(),l=(0,o.createPublicKey)({key:c,format:"der",type:"spki"});return(0,a.setCurve)(l,e.crv),l}case"OKP":{const t=new u.default;if(void 0!==e.d){t.zero();const r=new u.default;r.oidFor(e.crv),t.add(r.end());const i=new u.default;i.octStr(n.Buffer.from(e.d,"base64"));const s=i.end(n.Buffer.from([4]));t.add(s);const a=t.end();return(0,o.createPrivateKey)({key:a,format:"der",type:"pkcs8"})}const r=new u.default;r.oidFor(e.crv),t.add(r.end()),t.bitStr(n.Buffer.from(e.x,"base64"));const i=t.end();return(0,o.createPublicKey)({key:i,format:"der",type:"spki"})}default:throw new s.JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}}},9590(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6982),o=r(82),i=r(1326),s=r(6247),a=r(8960),c=r(8993),u=r(4512),l=r(8737),d=r(740),p=r(1185),f=e=>{let t;if((0,c.isCryptoKey)(e)){if(!e.extractable)throw new TypeError("CryptoKey is not extractable");t=n.KeyObject.from(e)}else{if(!(0,u.default)(e)){if(e instanceof Uint8Array)return{kty:"oct",k:(0,o.encode)(e)};throw new TypeError((0,l.default)(e,...d.types,"Uint8Array"))}t=e}if(p.jwkExport){if("secret"!==t.type&&!["rsa","ec","ed25519","x25519","ed448","x448"].includes(t.asymmetricKeyType))throw new s.JOSENotSupported("Unsupported key asymmetricKeyType");return t.export({format:"jwk"})}switch(t.type){case"secret":return{kty:"oct",k:(0,o.encode)(t.export())};case"private":case"public":switch(t.asymmetricKeyType){case"rsa":{const e=t.export({format:"der",type:"pkcs1"}),r=new i.default(e);"private"===t.type&&r.unsignedInteger();const n=(0,o.encode)(r.unsignedInteger()),s=(0,o.encode)(r.unsignedInteger());let a;return"private"===t.type&&(a={d:(0,o.encode)(r.unsignedInteger()),p:(0,o.encode)(r.unsignedInteger()),q:(0,o.encode)(r.unsignedInteger()),dp:(0,o.encode)(r.unsignedInteger()),dq:(0,o.encode)(r.unsignedInteger()),qi:(0,o.encode)(r.unsignedInteger())}),r.end(),{kty:"RSA",n,e:s,...a}}case"ec":{const e=(0,a.default)(t);let r,i,c;switch(e){case"secp256k1":r=64,i=33,c=-1;break;case"P-256":r=64,i=36,c=-1;break;case"P-384":r=96,i=35,c=-3;break;case"P-521":r=132,i=35,c=-3;break;default:throw new s.JOSENotSupported("Unsupported curve")}if("public"===t.type){const n=t.export({type:"spki",format:"der"});return{kty:"EC",crv:e,x:(0,o.encode)(n.subarray(-r,-r/2)),y:(0,o.encode)(n.subarray(-r/2))}}const u=t.export({type:"pkcs8",format:"der"});return u.length<100&&(i+=c),{...f((0,n.createPublicKey)(t)),d:(0,o.encode)(u.subarray(i,i+r/2))}}case"ed25519":case"x25519":{const e=(0,a.default)(t);if("public"===t.type){const r=t.export({type:"spki",format:"der"});return{kty:"OKP",crv:e,x:(0,o.encode)(r.subarray(-32))}}const r=t.export({type:"pkcs8",format:"der"});return{...f((0,n.createPublicKey)(t)),d:(0,o.encode)(r.subarray(-32))}}case"ed448":case"x448":{const e=(0,a.default)(t);if("public"===t.type){const r=t.export({type:"spki",format:"der"});return{kty:"OKP",crv:e,x:(0,o.encode)(r.subarray("Ed448"===e?-57:-56))}}const r=t.export({type:"pkcs8",format:"der"});return{...f((0,n.createPublicKey)(t)),d:(0,o.encode)(r.subarray("Ed448"===e?-57:-56))}}default:throw new s.JOSENotSupported("Unsupported key asymmetricKeyType")}default:throw new s.JOSENotSupported("Unsupported key type")}};t.default=f},7980(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6982),o=r(8960),i=r(6247),s=r(5363),a=r(1185),c={padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST},u=new Map([["ES256","P-256"],["ES256K","secp256k1"],["ES384","P-384"],["ES512","P-521"]]);t.default=function(e,t){switch(e){case"EdDSA":if(!["ed25519","ed448"].includes(t.asymmetricKeyType))throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ed25519 or ed448");return t;case"RS256":case"RS384":case"RS512":if("rsa"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");return(0,s.default)(t,e),t;case a.rsaPssParams&&"PS256":case a.rsaPssParams&&"PS384":case a.rsaPssParams&&"PS512":if("rsa-pss"===t.asymmetricKeyType){const{hashAlgorithm:r,mgf1HashAlgorithm:n,saltLength:o}=t.asymmetricKeyDetails,i=parseInt(e.slice(-3),10);if(void 0!==r&&(r!==`sha${i}`||n!==r))throw new TypeError(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}`);if(void 0!==o&&o>i>>3)throw new TypeError(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}`)}else if("rsa"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa or rsa-pss");return(0,s.default)(t,e),{key:t,...c};case!a.rsaPssParams&&"PS256":case!a.rsaPssParams&&"PS384":case!a.rsaPssParams&&"PS512":if("rsa"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");return(0,s.default)(t,e),{key:t,...c};case"ES256":case"ES256K":case"ES384":case"ES512":{if("ec"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ec");const r=(0,o.default)(t),n=u.get(e);if(r!==n)throw new TypeError(`Invalid key curve for the algorithm, its curve must be ${n}, got ${r}`);return{dsaEncoding:"ieee-p1363",key:t}}default:throw new i.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}},5904(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=void 0;const n=r(9023),o=r(6982),i=r(927),s=r(5821),a=r(82),c=r(2395),u=r(8405),l=r(8993),d=r(2484),p=r(4512),f=r(8737),h=r(740),y=(0,n.promisify)(o.pbkdf2);function m(e,t){if((0,p.default)(e))return e.export();if(e instanceof Uint8Array)return e;if((0,l.isCryptoKey)(e))return(0,d.checkEncCryptoKey)(e,t,"deriveBits","deriveKey"),o.KeyObject.from(e).export();throw new TypeError((0,f.default)(e,...h.types,"Uint8Array"))}t.encrypt=async(e,t,r,n=2048,o=(0,i.default)(new Uint8Array(16)))=>{(0,u.default)(o);const l=(0,s.p2s)(e,o),d=parseInt(e.slice(13,16),10)>>3,p=m(t,e),f=await y(p,l,n,d,`sha${e.slice(8,11)}`);return{encryptedKey:await(0,c.wrap)(e.slice(-6),f,r),p2c:n,p2s:(0,a.encode)(o)}},t.decrypt=async(e,t,r,n,o)=>{(0,u.default)(o);const i=(0,s.p2s)(e,o),a=parseInt(e.slice(13,16),10)>>3,l=m(t,e),d=await y(l,i,n,a,`sha${e.slice(8,11)}`);return(0,c.unwrap)(e.slice(-6),d,r)}},927(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r(6982);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n.randomFillSync}})},3020(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=void 0;const n=r(6982),o=r(5363),i=r(8993),s=r(2484),a=r(4512),c=r(8737),u=r(740),l=(e,t)=>{if("rsa"!==e.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");(0,o.default)(e,t)},d=e=>{switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return n.constants.RSA_PKCS1_OAEP_PADDING;case"RSA1_5":return n.constants.RSA_PKCS1_PADDING;default:return}},p=e=>{switch(e){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 f(e,t,...r){if((0,a.default)(e))return e;if((0,i.isCryptoKey)(e))return(0,s.checkEncCryptoKey)(e,t,...r),n.KeyObject.from(e);throw new TypeError((0,c.default)(e,...u.types))}t.encrypt=(e,t,r)=>{const o=d(e),i=p(e),s=f(t,e,"wrapKey","encrypt");return l(s,e),(0,n.publicEncrypt)({key:s,oaepHash:i,padding:o},r)},t.decrypt=(e,t,r)=>{const o=d(e),i=p(e),s=f(t,e,"unwrapKey","decrypt");return l(s,e),(0,n.privateDecrypt)({key:s,oaepHash:i,padding:o},r)}},9754(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default="node:crypto"},7965(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6982),o=r(9023),i=r(5945),s=r(3254),a=r(7980),c=r(5206);let u;u=n.sign.length>3?(0,o.promisify)(n.sign):n.sign,t.default=async(e,t,r)=>{const o=(0,c.default)(e,t,"sign");if(e.startsWith("HS")){const t=n.createHmac((0,s.default)(e),o);return t.update(r),t.digest()}return u((0,i.default)(e),r,(0,a.default)(e,o))}},2167(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6982).timingSafeEqual;t.default=n},3117(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6982),o=r(9023),i=r(5945),s=r(7980),a=r(7965),c=r(5206),u=r(1185);let l;l=n.verify.length>4&&u.oneShotCallback?(0,o.promisify)(n.verify):n.verify,t.default=async(e,t,r,o)=>{const u=(0,c.default)(e,t,"verify");if(e.startsWith("HS")){const t=await(0,a.default)(e,u,o),i=r;try{return n.timingSafeEqual(i,t)}catch{return!1}}const d=(0,i.default)(e),p=(0,s.default)(e,u);try{return await l(d,o,p,r)}catch{return!1}}},8993(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isCryptoKey=void 0;const n=r(6982),o=r(9023),i=n.webcrypto;t.default=i,t.isCryptoKey=o.types.isCryptoKey?e=>o.types.isCryptoKey(e):e=>!1},7609(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deflate=t.inflate=void 0;const n=r(9023),o=r(3106),i=r(6247),s=(0,n.promisify)(o.inflateRaw),a=(0,n.promisify)(o.deflateRaw);t.inflate=e=>s(e,{maxOutputLength:25e4}).catch(()=>{throw new i.JWEDecompressionFailed}),t.deflate=e=>a(e)},8462(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=void 0;const n=r(82);t.encode=n.encode,t.decode=n.decode},8396(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeJwt=void 0;const n=r(8462),o=r(5821),i=r(1855),s=r(6247);t.decodeJwt=function(e){if("string"!=typeof e)throw new s.JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:r}=e.split(".");if(5===r)throw new s.JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");if(3!==r)throw new s.JWTInvalid("Invalid JWT");if(!t)throw new s.JWTInvalid("JWTs must contain a payload");let a,c;try{a=(0,n.decode)(t)}catch{throw new s.JWTInvalid("Failed to base64url decode the payload")}try{c=JSON.parse(o.decoder.decode(a))}catch{throw new s.JWTInvalid("Failed to parse the decoded payload as JSON")}if(!(0,i.default)(c))throw new s.JWTInvalid("Invalid JWT Claims Set");return c}},4443(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeProtectedHeader=void 0;const n=r(8462),o=r(5821),i=r(1855);t.decodeProtectedHeader=function(e){let t;if("string"==typeof e){const r=e.split(".");3!==r.length&&5!==r.length||([t]=r)}else if("object"==typeof e&&e){if(!("protected"in e))throw new TypeError("Token does not contain a Protected Header");t=e.protected}try{if("string"!=typeof t||!t)throw new Error;const e=JSON.parse(o.decoder.decode((0,n.decode)(t)));if(!(0,i.default)(e))throw new Error;return e}catch{throw new TypeError("Invalid Token or Protected Header formatting")}}},6247(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JWSSignatureVerificationFailed=t.JWKSTimeout=t.JWKSMultipleMatchingKeys=t.JWKSNoMatchingKey=t.JWKSInvalid=t.JWKInvalid=t.JWTInvalid=t.JWSInvalid=t.JWEInvalid=t.JWEDecompressionFailed=t.JWEDecryptionFailed=t.JOSENotSupported=t.JOSEAlgNotAllowed=t.JWTExpired=t.JWTClaimValidationFailed=t.JOSEError=void 0;class r extends Error{static get code(){return"ERR_JOSE_GENERIC"}constructor(e){var t;super(e),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}t.JOSEError=r,t.JWTClaimValidationFailed=class extends r{static get code(){return"ERR_JWT_CLAIM_VALIDATION_FAILED"}constructor(e,t="unspecified",r="unspecified"){super(e),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=t,this.reason=r}},t.JWTExpired=class extends r{static get code(){return"ERR_JWT_EXPIRED"}constructor(e,t="unspecified",r="unspecified"){super(e),this.code="ERR_JWT_EXPIRED",this.claim=t,this.reason=r}},t.JOSEAlgNotAllowed=class extends r{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}static get code(){return"ERR_JOSE_ALG_NOT_ALLOWED"}},t.JOSENotSupported=class extends r{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}static get code(){return"ERR_JOSE_NOT_SUPPORTED"}},t.JWEDecryptionFailed=class extends r{constructor(){super(...arguments),this.code="ERR_JWE_DECRYPTION_FAILED",this.message="decryption operation failed"}static get code(){return"ERR_JWE_DECRYPTION_FAILED"}},t.JWEDecompressionFailed=class extends r{constructor(){super(...arguments),this.code="ERR_JWE_DECOMPRESSION_FAILED",this.message="decompression operation failed"}static get code(){return"ERR_JWE_DECOMPRESSION_FAILED"}},t.JWEInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}static get code(){return"ERR_JWE_INVALID"}},t.JWSInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}static get code(){return"ERR_JWS_INVALID"}},t.JWTInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}static get code(){return"ERR_JWT_INVALID"}},t.JWKInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}static get code(){return"ERR_JWK_INVALID"}},t.JWKSInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}static get code(){return"ERR_JWKS_INVALID"}},t.JWKSNoMatchingKey=class extends r{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"}},t.JWKSMultipleMatchingKeys=class extends r{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"}},Symbol.asyncIterator,t.JWKSTimeout=class extends r{constructor(){super(...arguments),this.code="ERR_JWKS_TIMEOUT",this.message="request timed out"}static get code(){return"ERR_JWKS_TIMEOUT"}},t.JWSSignatureVerificationFailed=class extends r{constructor(){super(...arguments),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",this.message="signature verification failed"}static get code(){return"ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}},4166(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(9754);t.default=n.default},7260(e,t,r){var n=r(5747);e.exports=function(e,t){t=t||{};var r=n.decode(e,t);if(!r)return null;var o=r.payload;if("string"==typeof o)try{var i=JSON.parse(o);null!==i&&"object"==typeof i&&(o=i)}catch(e){}return!0===t.complete?{header:r.header,payload:o,signature:r.signature}:o}},4040(e,t,r){e.exports={decode:r(7260),verify:r(1691),sign:r(7651),JsonWebTokenError:r(1741),NotBeforeError:r(3726),TokenExpiredError:r(8980)}},1741(e){var t=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};(t.prototype=Object.create(Error.prototype)).constructor=t,e.exports=t},3726(e,t,r){var n=r(1741),o=function(e,t){n.call(this,e),this.name="NotBeforeError",this.date=t};(o.prototype=Object.create(n.prototype)).constructor=o,e.exports=o},8980(e,t,r){var n=r(1741),o=function(e,t){n.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};(o.prototype=Object.create(n.prototype)).constructor=o,e.exports=o},1977(e,t,r){const n=r(9589);e.exports=n.satisfies(process.version,">=15.7.0")},4977(e,t,r){var n=r(9589);e.exports=n.satisfies(process.version,"^6.12.0 || >=8.0.0")},4623(e,t,r){const n=r(9589);e.exports=n.satisfies(process.version,">=16.9.0")},855(e,t,r){var n=r(6585);e.exports=function(e,t){var r=t||Math.floor(Date.now()/1e3);if("string"==typeof e){var o=n(e);if(void 0===o)return;return Math.floor(r+o/1e3)}return"number"==typeof e?r+e:void 0}},7019(e,t,r){const n=r(1977),o=r(4623),i={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},s={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};e.exports=function(e,t){if(!e||!t)return;const r=t.asymmetricKeyType;if(!r)return;const a=i[r];if(!a)throw new Error(`Unknown key type "${r}".`);if(!a.includes(e))throw new Error(`"alg" parameter for "${r}" key type must be one of: ${a.join(", ")}.`);if(n)switch(r){case"ec":const r=t.asymmetricKeyDetails.namedCurve,n=s[e];if(r!==n)throw new Error(`"alg" parameter "${e}" requires curve "${n}".`);break;case"rsa-pss":if(o){const r=parseInt(e.slice(-3),10),{hashAlgorithm:n,mgf1HashAlgorithm:o,saltLength:i}=t.asymmetricKeyDetails;if(n!==`sha${r}`||o!==n)throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(void 0!==i&&i>r>>3)throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}}}},7651(e,t,r){const n=r(855),o=r(4977),i=r(7019),s=r(5747),a=r(6111),c=r(7914),u=r(8928),l=r(3639),d=r(9001),p=r(5931),f=r(7083),{KeyObject:h,createSecretKey:y,createPrivateKey:m}=r(6982),g=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];o&&g.splice(3,0,"PS256","PS384","PS512");const v={expiresIn:{isValid:function(e){return u(e)||p(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return u(e)||p(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return p(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:a.bind(null,g),message:'"algorithm" must be a valid string enum value'},header:{isValid:d,message:'"header" must be an object'},encoding:{isValid:p,message:'"encoding" must be a string'},issuer:{isValid:p,message:'"issuer" must be a string'},subject:{isValid:p,message:'"subject" must be a string'},jwtid:{isValid:p,message:'"jwtid" must be a string'},noTimestamp:{isValid:c,message:'"noTimestamp" must be a boolean'},keyid:{isValid:p,message:'"keyid" must be a string'},mutatePayload:{isValid:c,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:c,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:c,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},w={iat:{isValid:l,message:'"iat" should be a number of seconds'},exp:{isValid:l,message:'"exp" should be a number of seconds'},nbf:{isValid:l,message:'"nbf" should be a number of seconds'}};function E(e,t,r,n){if(!d(r))throw new Error('Expected "'+n+'" to be a plain object.');Object.keys(r).forEach(function(o){const i=e[o];if(i){if(!i.isValid(r[o]))throw new Error(i.message)}else if(!t)throw new Error('"'+o+'" is not allowed in "'+n+'"')})}const b={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},S=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];e.exports=function(e,t,r,o){"function"==typeof r?(o=r,r={}):r=r||{};const a="object"==typeof e&&!Buffer.isBuffer(e),c=Object.assign({alg:r.algorithm||"HS256",typ:a?"JWT":void 0,kid:r.keyid},r.header);function u(e){if(o)return o(e);throw e}if(!t&&"none"!==r.algorithm)return u(new Error("secretOrPrivateKey must have a value"));if(null!=t&&!(t instanceof h))try{t=m(t)}catch(e){try{t=y("string"==typeof t?Buffer.from(t):t)}catch(e){return u(new Error("secretOrPrivateKey is not valid key material"))}}if(c.alg.startsWith("HS")&&"secret"!==t.type)return u(new Error(`secretOrPrivateKey must be a symmetric key when using ${c.alg}`));if(/^(?:RS|PS|ES)/.test(c.alg)){if("private"!==t.type)return u(new Error(`secretOrPrivateKey must be an asymmetric key when using ${c.alg}`));if(!r.allowInsecureKeySizes&&!c.alg.startsWith("ES")&&void 0!==t.asymmetricKeyDetails&&t.asymmetricKeyDetails.modulusLength<2048)return u(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`))}if(void 0===e)return u(new Error("payload is required"));if(a){try{!function(e){E(w,!0,e,"payload")}(e)}catch(e){return u(e)}r.mutatePayload||(e=Object.assign({},e))}else{const t=S.filter(function(e){return void 0!==r[e]});if(t.length>0)return u(new Error("invalid "+t.join(",")+" option for "+typeof e+" payload"))}if(void 0!==e.exp&&void 0!==r.expiresIn)return u(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==e.nbf&&void 0!==r.notBefore)return u(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{!function(e){E(v,!1,e,"options")}(r)}catch(e){return u(e)}if(!r.allowInvalidAsymmetricKeyTypes)try{i(c.alg,t)}catch(e){return u(e)}const l=e.iat||Math.floor(Date.now()/1e3);if(r.noTimestamp?delete e.iat:a&&(e.iat=l),void 0!==r.notBefore){try{e.nbf=n(r.notBefore,l)}catch(e){return u(e)}if(void 0===e.nbf)return u(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==r.expiresIn&&"object"==typeof e){try{e.exp=n(r.expiresIn,l)}catch(e){return u(e)}if(void 0===e.exp)return u(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(b).forEach(function(t){const n=b[t];if(void 0!==r[t]){if(void 0!==e[n])return u(new Error('Bad "options.'+t+'" option. The payload already has an "'+n+'" property.'));e[n]=r[t]}});const d=r.encoding||"utf8";if("function"!=typeof o){let n=s.sign({header:c,payload:e,secret:t,encoding:d});if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&n.length<256)throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`);return n}o=o&&f(o),s.createSign({header:c,privateKey:t,payload:e,encoding:d}).once("error",o).once("done",function(e){if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&e.length<256)return o(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`));o(null,e)})}},1691(e,t,r){const n=r(1741),o=r(3726),i=r(8980),s=r(7260),a=r(855),c=r(7019),u=r(4977),l=r(5747),{KeyObject:d,createSecretKey:p,createPublicKey:f}=r(6982),h=["RS256","RS384","RS512"],y=["ES256","ES384","ES512"],m=["RS256","RS384","RS512"],g=["HS256","HS384","HS512"];u&&(h.splice(h.length,0,"PS256","PS384","PS512"),m.splice(m.length,0,"PS256","PS384","PS512")),e.exports=function(e,t,r,u){let v;if("function"!=typeof r||u||(u=r,r={}),r||(r={}),r=Object.assign({},r),v=u||function(e,t){if(e)throw e;return t},r.clockTimestamp&&"number"!=typeof r.clockTimestamp)return v(new n("clockTimestamp must be a number"));if(void 0!==r.nonce&&("string"!=typeof r.nonce||""===r.nonce.trim()))return v(new n("nonce must be a non-empty string"));if(void 0!==r.allowInvalidAsymmetricKeyTypes&&"boolean"!=typeof r.allowInvalidAsymmetricKeyTypes)return v(new n("allowInvalidAsymmetricKeyTypes must be a boolean"));const w=r.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return v(new n("jwt must be provided"));if("string"!=typeof e)return v(new n("jwt must be a string"));const E=e.split(".");if(3!==E.length)return v(new n("jwt malformed"));let b;try{b=s(e,{complete:!0})}catch(e){return v(e)}if(!b)return v(new n("invalid token"));const S=b.header;let _;if("function"==typeof t){if(!u)return v(new n("verify must be called asynchronous if secret or public key is provided as a callback"));_=t}else _=function(e,r){return r(null,t)};return _(S,function(t,s){if(t)return v(new n("error in secret or public key callback: "+t.message));const u=""!==E[2].trim();if(!u&&s)return v(new n("jwt signature is required"));if(u&&!s)return v(new n("secret or public key must be provided"));if(!u&&!r.algorithms)return v(new n('please specify "none" in "algorithms" to verify unsigned tokens'));if(null!=s&&!(s instanceof d))try{s=f(s)}catch(e){try{s=p("string"==typeof s?Buffer.from(s):s)}catch(e){return v(new n("secretOrPublicKey is not valid key material"))}}if(r.algorithms||("secret"===s.type?r.algorithms=g:["rsa","rsa-pss"].includes(s.asymmetricKeyType)?r.algorithms=m:"ec"===s.asymmetricKeyType?r.algorithms=y:r.algorithms=h),-1===r.algorithms.indexOf(b.header.alg))return v(new n("invalid algorithm"));if(S.alg.startsWith("HS")&&"secret"!==s.type)return v(new n(`secretOrPublicKey must be a symmetric key when using ${S.alg}`));if(/^(?:RS|PS|ES)/.test(S.alg)&&"public"!==s.type)return v(new n(`secretOrPublicKey must be an asymmetric key when using ${S.alg}`));if(!r.allowInvalidAsymmetricKeyTypes)try{c(S.alg,s)}catch(e){return v(e)}let _;try{_=l.verify(e,b.header.alg,s)}catch(e){return v(e)}if(!_)return v(new n("invalid signature"));const A=b.payload;if(void 0!==A.nbf&&!r.ignoreNotBefore){if("number"!=typeof A.nbf)return v(new n("invalid nbf value"));if(A.nbf>w+(r.clockTolerance||0))return v(new o("jwt not active",new Date(1e3*A.nbf)))}if(void 0!==A.exp&&!r.ignoreExpiration){if("number"!=typeof A.exp)return v(new n("invalid exp value"));if(w>=A.exp+(r.clockTolerance||0))return v(new i("jwt expired",new Date(1e3*A.exp)))}if(r.audience){const e=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(A.aud)?A.aud:[A.aud]).some(function(t){return e.some(function(e){return e instanceof RegExp?e.test(t):e===t})}))return v(new n("jwt audience invalid. expected: "+e.join(" or ")))}if(r.issuer&&("string"==typeof r.issuer&&A.iss!==r.issuer||Array.isArray(r.issuer)&&-1===r.issuer.indexOf(A.iss)))return v(new n("jwt issuer invalid. expected: "+r.issuer));if(r.subject&&A.sub!==r.subject)return v(new n("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&A.jti!==r.jwtid)return v(new n("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&A.nonce!==r.nonce)return v(new n("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if("number"!=typeof A.iat)return v(new n("iat required when maxAge is specified"));const e=a(r.maxAge,A.iat);if(void 0===e)return v(new n('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(w>=e+(r.clockTolerance||0))return v(new i("maxAge exceeded",new Date(1e3*e)))}if(!0===r.complete){const e=b.signature;return v(null,{header:S,payload:A,signature:e})}return v(null,A)})}},8789(e,t,r){var n,o=r(2861).Buffer,i=r(6982),s=r(2010),a=r(9023),c="secret must be a string or buffer",u="key must be a string or a buffer",l="function"==typeof i.createPublicKey;function d(e){if(!o.isBuffer(e)&&"string"!=typeof e){if(!l)throw y(u);if("object"!=typeof e)throw y(u);if("string"!=typeof e.type)throw y(u);if("string"!=typeof e.asymmetricKeyType)throw y(u);if("function"!=typeof e.export)throw y(u)}}function p(e){if(!o.isBuffer(e)&&"string"!=typeof e&&"object"!=typeof e)throw y("key must be a string, a buffer or an object")}function f(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function h(e){var t=4-(e=e.toString()).length%4;if(4!==t)for(var r=0;r<t;++r)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function y(e){var t=[].slice.call(arguments,1),r=a.format.bind(a,e).apply(null,t);return new TypeError(r)}function m(e){var t;return t=e,o.isBuffer(t)||"string"==typeof t||(e=JSON.stringify(e)),e}function g(e){return function(t,r){!function(e){if(!o.isBuffer(e)){if("string"==typeof e)return e;if(!l)throw y(c);if("object"!=typeof e)throw y(c);if("secret"!==e.type)throw y(c);if("function"!=typeof e.export)throw y(c)}}(r),t=m(t);var n=i.createHmac("sha"+e,r);return f((n.update(t),n.digest("base64")))}}l&&(u+=" or a KeyObject",c+="or a KeyObject");var v="timingSafeEqual"in i?function(e,t){return e.byteLength===t.byteLength&&i.timingSafeEqual(e,t)}:function(e,t){return n||(n=r(1045)),n(e,t)};function w(e){return function(t,r,n){var i=g(e)(t,n);return v(o.from(r),o.from(i))}}function E(e){return function(t,r){p(r),t=m(t);var n=i.createSign("RSA-SHA"+e);return f((n.update(t),n.sign(r,"base64")))}}function b(e){return function(t,r,n){d(n),t=m(t),r=h(r);var o=i.createVerify("RSA-SHA"+e);return o.update(t),o.verify(n,r,"base64")}}function S(e){return function(t,r){p(r),t=m(t);var n=i.createSign("RSA-SHA"+e);return f((n.update(t),n.sign({key:r,padding:i.constants.RSA_PKCS1_PSS_PADDING,saltLength:i.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function _(e){return function(t,r,n){d(n),t=m(t),r=h(r);var o=i.createVerify("RSA-SHA"+e);return o.update(t),o.verify({key:n,padding:i.constants.RSA_PKCS1_PSS_PADDING,saltLength:i.constants.RSA_PSS_SALTLEN_DIGEST},r,"base64")}}function A(e){var t=E(e);return function(){var r=t.apply(null,arguments);return s.derToJose(r,"ES"+e)}}function I(e){var t=b(e);return function(r,n,o){return n=s.joseToDer(n,"ES"+e).toString("base64"),t(r,n,o)}}function P(){return function(){return""}}function O(){return function(e,t){return""===t}}e.exports=function(e){var t={hs:g,rs:E,ps:S,es:A,none:P},r={hs:w,rs:b,ps:_,es:I,none:O},n=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!n)throw y('"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".',e);var o=(n[1]||n[3]).toLowerCase(),i=n[2];return{sign:t[o](i),verify:r[o](i)}}},3110(e,t,r){const n=r(5753)("jwks"),{retrieveSigningKeys:o}=r(4263),{request:i,cacheSigningKey:s,rateLimitSigningKey:a,getKeysInterceptor:c,callbackSupport:u}=r(3171),l=r(1161),d=r(2813);e.exports={JwksClient:class{constructor(e){this.options={rateLimit:!1,cache:!0,timeout:3e4,...e},this.options.getKeysInterceptor&&(this.getSigningKey=c(this,e)),this.options.rateLimit&&(this.getSigningKey=a(this,e)),this.options.cache&&(this.getSigningKey=s(this,e)),this.getSigningKey=u(this,e)}async getKeys(){n(`Fetching keys from '${this.options.jwksUri}'`);try{const e=await i({uri:this.options.jwksUri,headers:this.options.requestHeaders,agent:this.options.requestAgent,timeout:this.options.timeout,fetcher:this.options.fetcher});return n("Keys:",e.keys),e.keys}catch(e){const{errorMsg:t}=e;throw n("Failure:",t||e),t?new l(t):e}}async getSigningKeys(){const e=await this.getKeys();if(!e||!e.length)throw new l("The JWKS endpoint did not contain any keys");const t=await o(e);if(!t.length)throw new l("The JWKS endpoint did not contain any signing keys");return n("Signing Keys:",t),t}async getSigningKey(e){n(`Fetching signing key for '${e}'`);const t=await this.getSigningKeys(),r=null!=e;if(!r&&t.length>1)throw n("No KID specified and JWKS endpoint returned more than 1 key"),new d("No KID specified and JWKS endpoint returned more than 1 key");const o=t.find(t=>!r||t.kid===e);if(o)return o;throw n(`Unable to find a signing key that matches '${e}'`),new d(`Unable to find a signing key that matches '${e}'`)}}}},947(e){function t(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="ArgumentError",this.message=e}t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,e.exports=t},1161(e){function t(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="JwksError",this.message=e}t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,e.exports=t},9950(e){function t(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="JwksRateLimitError",this.message=e}t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,e.exports=t},2813(e){function t(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="SigningKeyNotFoundError",this.message=e}t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,e.exports=t},3780(e,t,r){e.exports={ArgumentError:r(947),JwksError:r(1161),JwksRateLimitError:r(9950),SigningKeyNotFoundError:r(2813)}},4601(e,t,r){const{JwksClient:n}=r(3110),o=r(3780),{hapiJwt2Key:i,hapiJwt2KeyAsync:s}=r(4698),{expressJwtSecret:a}=r(5064),{koaJwtSecret:c}=r(7897),{passportJwtSecret:u}=r(4388);e.exports=e=>new n(e),e.exports.JwksClient=n,e.exports.ArgumentError=o.ArgumentError,e.exports.JwksError=o.JwksError,e.exports.JwksRateLimitError=o.JwksRateLimitError,e.exports.SigningKeyNotFoundError=o.SigningKeyNotFoundError,e.exports.expressJwtSecret=a,e.exports.hapiJwt2Key=i,e.exports.hapiJwt2KeyAsync=s,e.exports.koaJwtSecret=c,e.exports.passportJwtSecret=u},3552(e){e.exports=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES256K","ES384","ES512","EdDSA"]},5064(e,t,r){const{ArgumentError:n}=r(3780),{JwksClient:o}=r(3110),i=r(3552),s=(e,t)=>e&&"SigningKeyNotFoundError"===e.name?t(null):e?t(e):void 0;e.exports.expressJwtSecret=function(e){if(null==e)throw new n("An options object must be provided when initializing expressJwtSecret");const t=new o(e),r=e.handleSigningKeyError||s,a=async(e,n)=>{if(!n)return;const o=n.header;if(o&&i.includes(o.alg))try{const e=await t.getSigningKey(o.kid);return e.publicKey||e.rsaPublicKey}catch(e){return new Promise((t,n)=>{r(e,e=>{if(!e)return t();n(e)})})}};return function(e,t,r,n){if(4!==arguments.length)return a(0,arguments[1]);a(0,{header:t}).then(e=>{setImmediate(n,null,e)}).catch(e=>{setImmediate(n,e)})}}},4698(e,t,r){const{ArgumentError:n}=r(3780),{JwksClient:o}=r(3110),i=r(3552),s=(e,t)=>e&&"SigningKeyNotFoundError"===e.name||e?t(e,null,null):void 0;e.exports.hapiJwt2KeyAsync=t=>{const r=e.exports.hapiJwt2Key(t);return function(e){return new Promise((t,n)=>{r(e,(e,r)=>{!r||e?n(e):t({key:r})})})}},e.exports.hapiJwt2Key=function(e){if(null==e)throw new n("An options object must be provided when initializing hapiJwt2Key");const t=new o(e),r=e.handleSigningKeyError||s;return function(e,n){return e&&e.header?i.includes(e.header.alg)?void t.getSigningKey(e.header.kid).then(e=>n(null,e.publicKey||e.rsaPublicKey,e)).catch(e=>r(e,e=>n(e,null,null))):n(new Error("Unsupported algorithm "+e.header.alg+" supplied."),null,null):n(new Error("Cannot find a signing certificate if there is no header"),null,null)}}},7897(e,t,r){const{ArgumentError:n}=r(3780),{JwksClient:o}=r(3110),i=r(3552);e.exports.koaJwtSecret=function(e={}){if(!e.jwksUri)throw new n("No JWKS provided. Please provide a jwksUri");const t=new o(e);return function({alg:r,kid:n}={}){return new Promise((o,s)=>{if(!i.includes(r))return s(new Error("Missing / invalid token algorithm"));t.getSigningKey(n).then(e=>{o(e.publicKey||e.rsaPublicKey)}).catch(t=>e.handleSigningKeyError?e.handleSigningKeyError(t).then(s):s(t))})}}},4388(e,t,r){const n=r(257),{ArgumentError:o}=r(3780),{JwksClient:i}=r(3110),s=r(3552),a=(e,t)=>e&&"SigningKeyNotFoundError"===e.name?t(null):e?t(e):void 0;e.exports.passportJwtSecret=function(e){if(null==e)throw new o("An options object must be provided when initializing passportJwtSecret");if(!e.jwksUri)throw new o("No JWKS provided. Please provide a jwksUri");const t=new i(e),r=e.handleSigningKeyError||a;return function(e,o,i){let a;try{a={payload:n.decodeJwt(o),header:n.decodeProtectedHeader(o)}}catch(e){a=null}if(!a||!s.includes(a.header.alg))return i(null,null);t.getSigningKey(a.header.kid).then(e=>{i(null,e.publicKey||e.rsaPublicKey)}).catch(e=>{r(e,e=>i(e,null))})}}},4263(e,t,r){const n=r(257),o=r(1161);function i(e){if(e.alg)return e.alg;if("RSA"===e.kty)return"RS256";if("EC"===e.kty)switch(e.crv){case"P-256":return"ES256";case"secp256k1":return"ES256K";case"P-384":return"ES384";case"P-521":return"ES512"}if("OKP"===e.kty)switch(e.crv){case"Ed25519":case"Ed448":return"EdDSA"}throw new o("Unsupported JWK")}e.exports={retrieveSigningKeys:async function(e){const t=[];e=e.filter(({use:e})=>"sig"===e||void 0===e).filter(({kty:e})=>"RSA"===e||"EC"===e||"OKP"===e);for(const r of e)try{const e=await n.importJWK({...r,ext:!0},i(r));if("public"!==e.type)continue;let o;switch(e[Symbol.toStringTag]){case"CryptoKey":{const t=await n.exportSPKI(e);o=()=>t;break}default:o=()=>e.export({format:"pem",type:"spki"})}t.push({get publicKey(){return o()},get rsaPublicKey(){return o()},getPublicKey:()=>o(),..."string"==typeof r.kid&&r.kid?{kid:r.kid}:void 0,..."string"==typeof r.alg&&r.alg?{alg:r.alg}:void 0})}catch(e){continue}return t}}},1389(e,t,r){const n=r(5753)("jwks"),o=r(8639),{promisify:i,callbackify:s}=r(9023);e.exports.A=function(e,{cacheMaxEntries:t=5,cacheMaxAge:r=6e5}){return n(`Configured caching of signing keys. Max: ${t} / Age: ${r}`),i(o({hash:e=>e,load:s(e.getSigningKey.bind(e)),maxAge:r,max:t}))}},6545(e,t,r){const{callbackify:n}=r(9023);e.exports.A=e=>{const t=e.getSigningKey.bind(e);return(e,r)=>r?n(t)(e,r):t(e)}},3171(e,t,r){e.exports={request:r(3858).A,cacheSigningKey:r(1389).A,rateLimitSigningKey:r(8730).A,getKeysInterceptor:r(2912).A,callbackSupport:r(6545).A}},2912(e,t,r){const n=r(4263).retrieveSigningKeys;e.exports.A=function(e,{getKeysInterceptor:t}){const r=e.getSigningKey.bind(e);return async e=>{const o=await t();let i;if(o&&o.length&&(i=await n(o)),i&&i.length){const t=i.find(t=>!e||t.kid===e);if(t)return t}return r(e)}}},8730(e,t,r){const n=r(5753)("jwks"),{RateLimiter:o}=r(9439),i=r(9950);e.exports.A=function(e,{jwksRequestsPerMinute:t=10}){const r=e.getSigningKey.bind(e),s=new o(t,"minute",!0);return n(`Configured rate limiting to JWKS endpoint at ${t}/minute`),async e=>await new Promise((t,o)=>{s.removeTokens(1,async(s,a)=>{if(s&&o(s),n("Requests to the JWKS endpoint available for the next minute:",a),a<0)n("Too many requests to the JWKS endpoint"),o(new i("Too many requests to the JWKS endpoint"));else try{const n=await r(e);t(n)}catch(e){o(e)}})})}},3858(e,t,r){const n=r(8611),o=r(5692),i=r(947);e.exports.A=e=>e.fetcher?e.fetcher(e.uri):new Promise((t,r)=>{let s;try{s=new URL(e.uri)}catch(e){throw new i("Invalid JWKS URI: The provided URI is not a valid URL.")}const{hostname:a,port:c,protocol:u,pathname:l,search:d}=s,p={hostname:a,path:l+d,port:c,method:"GET",...e.headers&&{headers:{...e.headers}},...e.timeout&&{timeout:e.timeout},...e.agent&&{agent:e.agent}},f=("https:"===u?o:n).request(p,e=>{let n="";e.setEncoding("utf8"),e.on("data",e=>{n+=e}),e.on("end",()=>{if(e.statusCode<200||e.statusCode>=300){const t=e.body&&(e.body.message||e.body)||e.statusMessage||`Http Error ${e.statusCode}`;r({errorMsg:t})}else try{t(n&&JSON.parse(n))}catch(e){r(e)}})});f.on("timeout",()=>f.destroy()).on("error",e=>r(e)).end()})},5747(e,t,r){var n=r(3387),o=r(7599);t.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],t.sign=n.sign,t.verify=o.verify,t.decode=o.decode,t.isValid=o.isValid,t.createSign=function(e){return new n(e)},t.createVerify=function(e){return new o(e)}},8948(e,t,r){var n=r(2861).Buffer,o=r(2203);function i(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=n.alloc(0),this;if("function"==typeof e.pipe)return this.buffer=n.alloc(0),e.pipe(this),this;if(e.length||"object"==typeof e)return this.buffer=e,this.writable=!1,process.nextTick(function(){this.emit("end",e),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof e+")")}r(9023).inherits(i,o),i.prototype.write=function(e){this.buffer=n.concat([this.buffer,n.from(e)]),this.emit("data",e)},i.prototype.end=function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1},e.exports=i},3387(e,t,r){var n=r(2861).Buffer,o=r(8948),i=r(8789),s=r(2203),a=r(2851),c=r(9023);function u(e,t){return n.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function l(e){var t=e.header,r=e.payload,n=e.secret||e.privateKey,o=e.encoding,s=i(t.alg),l=function(e,t,r){r=r||"utf8";var n=u(a(e),"binary"),o=u(a(t),r);return c.format("%s.%s",n,o)}(t,r,o),d=s.sign(l,n);return c.format("%s.%s",l,d)}function d(e){var t=e.secret;if(t=null==(t=null==t?e.privateKey:t)?e.key:t,!0===/^hs/i.test(e.header.alg)&&null==t)throw new TypeError("secret must be a string or buffer or a KeyObject");var r=new o(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new o(e.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}c.inherits(d,s),d.prototype.sign=function(){try{var e=l({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},d.sign=l,e.exports=d},2851(e,t,r){var n=r(181).Buffer;e.exports=function(e){return"string"==typeof e?e:"number"==typeof e||n.isBuffer(e)?e.toString():JSON.stringify(e)}},7599(e,t,r){var n=r(2861).Buffer,o=r(8948),i=r(8789),s=r(2203),a=r(2851),c=r(9023),u=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function l(e){var t=e.split(".",1)[0];return function(e){if(function(e){return"[object Object]"===Object.prototype.toString.call(e)}(e))return e;try{return JSON.parse(e)}catch(e){return}}(n.from(t,"base64").toString("binary"))}function d(e){return e.split(".")[2]}function p(e){return u.test(e)&&!!l(e)}function f(e,t,r){if(!t){var n=new Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}var o=d(e=a(e)),s=function(e){return e.split(".",2).join(".")}(e);return i(t).verify(s,o,r)}function h(e,t){if(t=t||{},!p(e=a(e)))return null;var r=l(e);if(!r)return null;var o=function(e,t){t=t||"utf8";var r=e.split(".")[1];return n.from(r,"base64").toString(t)}(e);return("JWT"===r.typ||t.json)&&(o=JSON.parse(o,t.encoding)),{header:r,payload:o,signature:d(e)}}function y(e){var t=(e=e||{}).secret;if(t=null==(t=null==t?e.publicKey:t)?e.key:t,!0===/^hs/i.test(e.algorithm)&&null==t)throw new TypeError("secret must be a string or buffer or a KeyObject");var r=new o(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new o(e.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}c.inherits(y,s),y.prototype.verify=function(){try{var e=f(this.signature.buffer,this.algorithm,this.key.buffer),t=h(this.signature.buffer,this.encoding);return this.emit("done",e,t),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},y.decode=h,y.isValid=p,y.verify=f,e.exports=y},9439(e,t,r){t.RateLimiter=r(3065),t.TokenBucket=r(5472)},3085(e){e.exports=function(){if("undefined"!=typeof process&&process.hrtime){var e=process.hrtime(),t=e[0],r=e[1];return 1e3*t+Math.floor(r/1e6)}return(new Date).getTime()}},3065(e,t,r){var n=r(5472),o=r(3085),i=function(e,t,r){this.tokenBucket=new n(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=o(),this.tokensThisInterval=0,this.fireImmediately=r};i.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=o();if((n<this.curIntervalStart||n-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=n,this.tokensThisInterval=0),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,s)},i)}return!1}return this.tokenBucket.removeTokens(e,s);function s(n,o){if(n)return t(n,null);r.tokensThisInterval+=e,t(null,o)}},tryRemoveTokens:function(e){if(e>this.tokenBucket.bucketSize)return!1;var t=o();if((t<this.curIntervalStart||t-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=t,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var r=this.tokenBucket.tryRemoveTokens(e);return r&&(this.tokensThisInterval+=e),r},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},e.exports=i},5472(e){var t=function(e,t,r,n){if(this.bucketSize=e,this.tokensPerInterval=t,"string"==typeof r)switch(r){case"sec":case"second":this.interval=1e3;break;case"min":case"minute":this.interval=6e4;break;case"hr":case"hour":this.interval=36e5;break;case"day":this.interval=864e5;break;default:throw new Error("Invaid interval "+r)}else this.interval=r;this.parentBucket=n,this.content=0,this.lastDrip=+new Date};t.prototype={bucketSize:1,tokensPerInterval:1,interval:1e3,parentBucket:null,content:0,lastDrip:0,removeTokens:function(e,t){var r=this;return this.bucketSize?e>this.bucketSize?(process.nextTick(t.bind(null,"Requested tokens "+e+" exceeds bucket size "+this.bucketSize,null)),!1):(this.drip(),e>this.content?n():this.parentBucket?this.parentBucket.removeTokens(e,function(o,i){return o?t(o,null):e>r.content?n():(r.content-=e,void t(null,Math.min(i,r.content)))}):(this.content-=e,process.nextTick(t.bind(null,null,this.content)),!0)):(process.nextTick(t.bind(null,null,e,Number.POSITIVE_INFINITY)),!0);function n(){var n=Math.ceil((e-r.content)*(r.interval/r.tokensPerInterval));return setTimeout(function(){r.removeTokens(e,t)},n),!1}},tryRemoveTokens:function(e){return!(this.bucketSize&&(e>this.bucketSize||(this.drip(),e>this.content||this.parentBucket&&!this.parentBucket.tryRemoveTokens(e)||(this.content-=e,0))))},drip:function(){if(this.tokensPerInterval){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)}else this.content=this.bucketSize}},e.exports=t},7193(e,t,r){e=r.nmd(e);var n="__lodash_hash_undefined__",o=9007199254740991,i="[object Arguments]",s="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",l="[object Map]",d="[object Number]",p="[object Object]",f="[object Promise]",h="[object RegExp]",y="[object Set]",m="[object String]",g="[object Symbol]",v="[object WeakMap]",w="[object ArrayBuffer]",E="[object DataView]",b="[object Float32Array]",S="[object Float64Array]",_="[object Int8Array]",A="[object Int16Array]",I="[object Int32Array]",P="[object Uint8Array]",O="[object Uint8ClampedArray]",k="[object Uint16Array]",C="[object Uint32Array]",T=/\w*$/,J=/^\[object .+?Constructor\]$/,x=/^(?:0|[1-9]\d*)$/,K={};K[i]=K["[object Array]"]=K[w]=K[E]=K[s]=K[a]=K[b]=K[S]=K[_]=K[A]=K[I]=K[l]=K[d]=K[p]=K[h]=K[y]=K[m]=K[g]=K[P]=K[O]=K[k]=K[C]=!0,K["[object Error]"]=K[c]=K[v]=!1;var R="object"==typeof global&&global&&global.Object===Object&&global,j="object"==typeof self&&self&&self.Object===Object&&self,W=R||j||Function("return this")(),$=t&&!t.nodeType&&t,N=$&&e&&!e.nodeType&&e,H=N&&N.exports===$;function M(e,t){return e.set(t[0],t[1]),e}function L(e,t){return e.add(t),e}function D(e,t,r,n){var o=-1,i=e?e.length:0;for(n&&i&&(r=e[++o]);++o<i;)r=t(r,e[o],o,e);return r}function F(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function U(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function B(e,t){return function(r){return e(t(r))}}function G(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var V,z=Array.prototype,q=Function.prototype,X=Object.prototype,Y=W["__core-js_shared__"],Z=(V=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"",Q=q.toString,ee=X.hasOwnProperty,te=X.toString,re=RegExp("^"+Q.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=H?W.Buffer:void 0,oe=W.Symbol,ie=W.Uint8Array,se=B(Object.getPrototypeOf,Object),ae=Object.create,ce=X.propertyIsEnumerable,ue=z.splice,le=Object.getOwnPropertySymbols,de=ne?ne.isBuffer:void 0,pe=B(Object.keys,Object),fe=We(W,"DataView"),he=We(W,"Map"),ye=We(W,"Promise"),me=We(W,"Set"),ge=We(W,"WeakMap"),ve=We(Object,"create"),we=Le(fe),Ee=Le(he),be=Le(ye),Se=Le(me),_e=Le(ge),Ae=oe?oe.prototype:void 0,Ie=Ae?Ae.valueOf:void 0;function Pe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Oe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ke(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ce(e){this.__data__=new Oe(e)}function Te(e,t,r){var n=e[t];ee.call(e,t)&&De(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function Je(e,t){for(var r=e.length;r--;)if(De(e[r][0],t))return r;return-1}function xe(e,t,r,n,o,f,v){var J;if(n&&(J=f?n(e,o,f,v):n(e)),void 0!==J)return J;if(!Ve(e))return e;var x=Fe(e);if(x){if(J=function(e){var t=e.length,r=e.constructor(t);return t&&"string"==typeof e[0]&&ee.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!t)return function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}(e,J)}else{var R=Ne(e),j=R==c||R==u;if(Be(e))return function(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if(R==p||R==i||j&&!f){if(F(e))return f?e:{};if(J=function(e){return"function"!=typeof e.constructor||Me(e)?{}:Ve(t=se(e))?ae(t):{};var t}(j?{}:e),!t)return function(e,t){return Re(e,$e(e),t)}(e,function(e,t){return e&&Re(t,ze(t),e)}(J,e))}else{if(!K[R])return f?e:{};J=function(e,t,r,n){var o,i=e.constructor;switch(t){case w:return Ke(e);case s:case a:return new i(+e);case E:return function(e,t){var r=t?Ke(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,n);case b:case S:case _:case A:case I:case P:case O:case k:case C:return function(e,t){var r=t?Ke(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,n);case l:return function(e,t,r){return D(t?r(U(e),!0):U(e),M,new e.constructor)}(e,n,r);case d:case m:return new i(e);case h:return function(e){var t=new e.constructor(e.source,T.exec(e));return t.lastIndex=e.lastIndex,t}(e);case y:return function(e,t,r){return D(t?r(G(e),!0):G(e),L,new e.constructor)}(e,n,r);case g:return o=e,Ie?Object(Ie.call(o)):{}}}(e,R,xe,t)}}v||(v=new Ce);var W=v.get(e);if(W)return W;if(v.set(e,J),!x)var $=r?function(e){return function(e,t,r){var n=t(e);return Fe(e)?n:function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}(n,r(e))}(e,ze,$e)}(e):ze(e);return function(e,t){for(var r=-1,n=e?e.length:0;++r<n&&!1!==t(e[r],r););}($||e,function(o,i){$&&(o=e[i=o]),Te(J,i,xe(o,t,r,n,i,e,v))}),J}function Ke(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Re(e,t,r,n){r||(r={});for(var o=-1,i=t.length;++o<i;){var s=t[o],a=n?n(r[s],e[s],s,r,e):void 0;Te(r,s,void 0===a?e[s]:a)}return r}function je(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function We(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Ve(e)||(t=e,Z&&Z in t))&&(Ge(e)||F(e)?re:J).test(Le(e));var t}(r)?r:void 0}Pe.prototype.clear=function(){this.__data__=ve?ve(null):{}},Pe.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Pe.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===n?void 0:r}return ee.call(t,e)?t[e]:void 0},Pe.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:ee.call(t,e)},Pe.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?n:t,this},Oe.prototype.clear=function(){this.__data__=[]},Oe.prototype.delete=function(e){var t=this.__data__,r=Je(t,e);return!(r<0||(r==t.length-1?t.pop():ue.call(t,r,1),0))},Oe.prototype.get=function(e){var t=this.__data__,r=Je(t,e);return r<0?void 0:t[r][1]},Oe.prototype.has=function(e){return Je(this.__data__,e)>-1},Oe.prototype.set=function(e,t){var r=this.__data__,n=Je(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},ke.prototype.clear=function(){this.__data__={hash:new Pe,map:new(he||Oe),string:new Pe}},ke.prototype.delete=function(e){return je(this,e).delete(e)},ke.prototype.get=function(e){return je(this,e).get(e)},ke.prototype.has=function(e){return je(this,e).has(e)},ke.prototype.set=function(e,t){return je(this,e).set(e,t),this},Ce.prototype.clear=function(){this.__data__=new Oe},Ce.prototype.delete=function(e){return this.__data__.delete(e)},Ce.prototype.get=function(e){return this.__data__.get(e)},Ce.prototype.has=function(e){return this.__data__.has(e)},Ce.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Oe){var n=r.__data__;if(!he||n.length<199)return n.push([e,t]),this;r=this.__data__=new ke(n)}return r.set(e,t),this};var $e=le?B(le,Object):function(){return[]},Ne=function(e){return te.call(e)};function He(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||x.test(e))&&e>-1&&e%1==0&&e<t}function Me(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Le(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function De(e,t){return e===t||e!=e&&t!=t}(fe&&Ne(new fe(new ArrayBuffer(1)))!=E||he&&Ne(new he)!=l||ye&&Ne(ye.resolve())!=f||me&&Ne(new me)!=y||ge&&Ne(new ge)!=v)&&(Ne=function(e){var t=te.call(e),r=t==p?e.constructor:void 0,n=r?Le(r):void 0;if(n)switch(n){case we:return E;case Ee:return l;case be:return f;case Se:return y;case _e:return v}return t});var Fe=Array.isArray;function Ue(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}(e.length)&&!Ge(e)}var Be=de||function(){return!1};function Ge(e){var t=Ve(e)?te.call(e):"";return t==c||t==u}function Ve(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ze(e){return Ue(e)?function(e,t){var r=Fe(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ue(e)}(e)&&ee.call(e,"callee")&&(!ce.call(e,"callee")||te.call(e)==i)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,o=!!n;for(var s in e)!t&&!ee.call(e,s)||o&&("length"==s||He(s,n))||r.push(s);return r}(e):function(e){if(!Me(e))return pe(e);var t=[];for(var r in Object(e))ee.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return xe(e,!0,!0)}},6111(e){var t=1/0,r=9007199254740991,n=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,a=/^(?:0|[1-9]\d*)$/,c=parseInt;function u(e){return e!=e}var l,d,p=Object.prototype,f=p.hasOwnProperty,h=p.toString,y=p.propertyIsEnumerable,m=(l=Object.keys,d=Object,function(e){return l(d(e))}),g=Math.max;function v(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||a.test(e))&&e>-1&&e%1==0&&e<t}var w=Array.isArray;function E(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!function(e){var t=b(e)?h.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}(e)}function b(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function S(e){return!!e&&"object"==typeof e}e.exports=function(e,r,a,l){var d;e=E(e)?e:(d=e)?function(e,t){return function(e,t){for(var r=-1,n=e?e.length:0,o=Array(n);++r<n;)o[r]=t(e[r]);return o}(t,function(t){return e[t]})}(d,function(e){return E(e)?function(e,t){var r=w(e)||function(e){return function(e){return S(e)&&E(e)}(e)&&f.call(e,"callee")&&(!y.call(e,"callee")||"[object Arguments]"==h.call(e))}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,o=!!n;for(var i in e)!t&&!f.call(e,i)||o&&("length"==i||v(i,n))||r.push(i);return r}(e):function(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||p))return m(e);var t,r,n=[];for(var o in Object(e))f.call(e,o)&&"constructor"!=o&&n.push(o);return n}(e)}(d)):[],a=a&&!l?function(e){var r=function(e){return e?(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||S(e)&&"[object Symbol]"==h.call(e)}(e))return NaN;if(b(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=b(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var r=i.test(e);return r||s.test(e)?c(e.slice(2),r?2:8):o.test(e)?NaN:+e}(e))===t||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}(e),a=r%1;return r==r?a?r-a:r:0}(a):0;var _=e.length;return a<0&&(a=g(_+a,0)),function(e){return"string"==typeof e||!w(e)&&S(e)&&"[object String]"==h.call(e)}(e)?a<=_&&e.indexOf(r,a)>-1:!!_&&function(e,t,r){if(t!=t)return function(e,t,r){for(var n=e.length,o=r+-1;++o<n;)if(t(e[o],o,e))return o;return-1}(e,u,r);for(var n=r-1,o=e.length;++n<o;)if(e[n]===t)return n;return-1}(e,r,a)>-1}},7914(e){var t=Object.prototype.toString;e.exports=function(e){return!0===e||!1===e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Boolean]"==t.call(e)}},8928(e){var t=1/0,r=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,s=parseInt,a=Object.prototype.toString;function c(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){return"number"==typeof e&&e==function(e){var u=function(e){return e?(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==a.call(e)}(e))return NaN;if(c(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=c(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var u=o.test(e);return u||i.test(e)?s(e.slice(2),u?2:8):n.test(e)?NaN:+e}(e))===t||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}(e),l=u%1;return u==u?l?u-l:u:0}(e)}},3639(e){var t=Object.prototype.toString;e.exports=function(e){return"number"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Number]"==t.call(e)}},9001(e){var t,r,n=Function.prototype,o=Object.prototype,i=n.toString,s=o.hasOwnProperty,a=i.call(Object),c=o.toString,u=(t=Object.getPrototypeOf,r=Object,function(e){return t(r(e))});e.exports=function(e){if(!function(e){return!!e&&"object"==typeof e}(e)||"[object Object]"!=c.call(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e))return!1;var t=u(e);if(null===t)return!0;var r=s.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&i.call(r)==a}},5931(e){var t=Object.prototype.toString,r=Array.isArray;e.exports=function(e){return"string"==typeof e||!r(e)&&function(e){return!!e&&"object"==typeof e}(e)&&"[object String]"==t.call(e)}},7083(e){var t=1/0,r=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,s=parseInt,a=Object.prototype.toString;function c(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){return function(e,u){var l;if("function"!=typeof u)throw new TypeError("Expected a function");return e=function(e){var u=function(e){return e?(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==a.call(e)}(e))return NaN;if(c(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=c(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var u=o.test(e);return u||i.test(e)?s(e.slice(2),u?2:8):n.test(e)?NaN:+e}(e))===t||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}(e),l=u%1;return u==u?l?u-l:u:0}(e),function(){return--e>0&&(l=u.apply(this,arguments)),e<=1&&(u=void 0),l}}(2,e)}},9831(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},o=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(n(arguments[t]));return e},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.asyncMemoizer=void 0;var a=s(r(1603)),c=r(4434),u=s(r(7193)),l=r(7644),d=r(3503);function p(e){var t=new a.default(e),r=e.load,n=e.hash,s=e.bypass,d=e.itemMaxAge,p=e.freeze,f=e.clone,h=e.queueMaxAge||1e3,y=new Map,m=new c.EventEmitter,g=Object.assign({del:function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=n.apply(void 0,o(e));t.del(i)},reset:function(){return t.reset()},keys:t.keys.bind(t),on:m.on.bind(m),once:m.once.bind(m)},e);if(e.disable)return Object.assign(r,g);function v(e,t){var r,n;try{for(var s=i(e),a=s.next();!a.done;a=s.next()){var c=a.value;f?setImmediate.apply(void 0,o([c],t.map(u.default))):setImmediate.apply(void 0,o([c],t))}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}}function w(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];m.emit.apply(m,o([e],t))}return Object.assign(function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var a,c=e.slice(0,-1),u=e.slice(-1).pop();if(s&&s.apply(void 0,o(c)))return w.apply(void 0,o(["miss"],c)),r.apply(void 0,o(e));a=0!==c.length||n?n.apply(void 0,o(c)):"_";var f=t.get(a);if(f)return w.apply(void 0,o(["hit"],c)),v([u],[null].concat(f));var m=y.get(a);if(m&&m.expiresAt>Date.now())return m.queue.push(u),void w.apply(void 0,o(["queue"],c));w.apply(void 0,o(["miss"],c));var g=Date.now(),E=[u];y.set(a,{queue:E,expiresAt:g+h}),r.apply(void 0,o(c,[function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];e[0]||function(e,r,n){p&&n.forEach(l.deepFreeze),d?t.set(e,n,d.apply(void 0,o(r.concat(n)))):t.set(e,n)}(a,c,e.slice(1)),y.delete(a),w.apply(void 0,o(["loaded",Date.now()-g],c)),v(E,e)}]))},g)}t.asyncMemoizer=p,p.sync=d.syncMemoizer},7644(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deepFreeze=void 0,t.deepFreeze=function e(t){return t&&(Object.freeze(t),Object.getOwnPropertyNames(t).forEach(function(r){!t.hasOwnProperty(r)||null===t[r]||"object"!=typeof t[r]&&"function"!=typeof t[r]||t[r].constructor===Buffer||Object.isFrozen(t[r])||e(t[r])})),t}},8639(e,t,r){"use strict";var n=r(9831);e.exports=n.asyncMemoizer},3503(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},o=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(n(arguments[t]));return e},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.syncMemoizer=void 0;var s=i(r(1603)),a=r(4434),c=i(r(7193)),u=r(7644);t.syncMemoizer=function(e){var t=new s.default(e),r=e.load,n=e.hash,i=e.bypass,l=e.itemMaxAge,d=e.freeze,p=e.clone,f=new a.EventEmitter,h=Object.assign({del:function(){var e=n.apply(void 0,o(arguments));t.del(e)},reset:function(){return t.reset()},keys:t.keys.bind(t),on:f.on.bind(f),once:f.once.bind(f)},e);if(e.disable)return Object.assign(r,h);function y(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];f.emit.apply(f,o([e],t))}function m(e){return e&&e.then&&"function"==typeof e.then}function g(e){var t=e;return p&&(t=m(t)?t.then(c.default):c.default(t)),d&&(m(t)?t=t.then(u.deepFreeze):u.deepFreeze(t)),t}return Object.assign(function(){for(var e=[],s=0;s<arguments.length;s++)e[s]=arguments[s];if(i&&i.apply(void 0,o(e)))return y.apply(void 0,o(["miss"],e)),r.apply(void 0,o(e));var a=n.apply(void 0,o(e)),c=t.get(a);if(c)return y.apply(void 0,o(["hit"],e)),g(c);y.apply(void 0,o(["miss"],e));var u=r.apply(void 0,o(e));return l?t.set(a,u,l.apply(void 0,o(e.concat([u])))):t.set(a,u),g(u)},h)}},1603(e,t,r){"use strict";const n=r(349),o=Symbol("max"),i=Symbol("length"),s=Symbol("lengthCalculator"),a=Symbol("allowStale"),c=Symbol("maxAge"),u=Symbol("dispose"),l=Symbol("noDisposeOnSet"),d=Symbol("lruList"),p=Symbol("cache"),f=Symbol("updateAgeOnGet"),h=()=>1,y=(e,t,r)=>{const n=e[p].get(t);if(n){const t=n.value;if(m(e,t)){if(v(e,n),!e[a])return}else r&&(e[f]&&(n.value.now=Date.now()),e[d].unshiftNode(n));return t.value}},m=(e,t)=>{if(!t||!t.maxAge&&!e[c])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[c]&&r>e[c]},g=e=>{if(e[i]>e[o])for(let t=e[d].tail;e[i]>e[o]&&null!==t;){const r=t.prev;v(e,t),t=r}},v=(e,t)=>{if(t){const r=t.value;e[u]&&e[u](r.key,r.value),e[i]-=r.length,e[p].delete(r.key),e[d].removeNode(t)}};class w{constructor(e,t,r,n,o){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=o||0}}const E=(e,t,r,n)=>{let o=r.value;m(e,o)&&(v(e,r),e[a]||(o=void 0)),o&&t.call(n,o.value,o.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[o]=e.max||1/0;const t=e.length||h;if(this[s]="function"!=typeof t?h:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[c]=e.maxAge||0,this[u]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[o]=e||1/0,g(this)}get max(){return this[o]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[c]=e,g(this)}get maxAge(){return this[c]}set lengthCalculator(e){"function"!=typeof e&&(e=h),e!==this[s]&&(this[s]=e,this[i]=0,this[d].forEach(e=>{e.length=this[s](e.value,e.key),this[i]+=e.length})),g(this)}get lengthCalculator(){return this[s]}get length(){return this[i]}get itemCount(){return this[d].length}rforEach(e,t){t=t||this;for(let r=this[d].tail;null!==r;){const n=r.prev;E(this,e,r,t),r=n}}forEach(e,t){t=t||this;for(let r=this[d].head;null!==r;){const n=r.next;E(this,e,r,t),r=n}}keys(){return this[d].toArray().map(e=>e.key)}values(){return this[d].toArray().map(e=>e.value)}reset(){this[u]&&this[d]&&this[d].length&&this[d].forEach(e=>this[u](e.key,e.value)),this[p]=new Map,this[d]=new n,this[i]=0}dump(){return this[d].map(e=>!m(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[d]}set(e,t,r){if((r=r||this[c])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,a=this[s](t,e);if(this[p].has(e)){if(a>this[o])return v(this,this[p].get(e)),!1;const s=this[p].get(e).value;return this[u]&&(this[l]||this[u](e,s.value)),s.now=n,s.maxAge=r,s.value=t,this[i]+=a-s.length,s.length=a,this.get(e),g(this),!0}const f=new w(e,t,a,n,r);return f.length>this[o]?(this[u]&&this[u](e,t),!1):(this[i]+=f.length,this[d].unshift(f),this[p].set(e,this[d].head),g(this),!0)}has(e){if(!this[p].has(e))return!1;const t=this[p].get(e).value;return!m(this,t)}get(e){return y(this,e,!0)}peek(e){return y(this,e,!1)}pop(){const e=this[d].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[p].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const n=e[r],o=n.e||0;if(0===o)this.set(n.k,n.v);else{const e=o-t;e>0&&this.set(n.k,n.v,e)}}}prune(){this[p].forEach((e,t)=>y(this,t,!1))}}},9669(e){"use strict";e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},349(e,t,r){"use strict";function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,o=arguments.length;r<o;r++)t.push(arguments[r]);return t}function o(e,t,r){var n=t===e.head?new a(r,null,t,e):new a(r,t,t.next,e);return null===n.next&&(e.tail=n),null===n.prev&&(e.head=n),e.length++,n}function i(e,t){e.tail=new a(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function s(e,t){e.head=new a(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function a(e,t,r,n){if(!(this instanceof a))return new a(e,t,r,n);this.list=n,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}e.exports=n,n.Node=a,n.create=n,n.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)s(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},n.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,n=0;null!==r;n++)e.call(t,r.value,n,this),r=r.next},n.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,n=this.length-1;null!==r;n--)e.call(t,r.value,n,this),r=r.prev},n.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},n.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},n.prototype.map=function(e,t){t=t||this;for(var r=new n,o=this.head;null!==o;)r.push(e.call(t,o.value,this)),o=o.next;return r},n.prototype.mapReverse=function(e,t){t=t||this;for(var r=new n,o=this.tail;null!==o;)r.push(e.call(t,o.value,this)),o=o.prev;return r},n.prototype.reduce=function(e,t){var r,n=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var o=0;null!==n;o++)r=e(r,n.value,o),n=n.next;return r},n.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var o=this.length-1;null!==n;o--)r=e(r,n.value,o),n=n.prev;return r},n.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},n.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},n.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var o=0,i=this.head;null!==i&&o<e;o++)i=i.next;for(;null!==i&&o<t;o++,i=i.next)r.push(i.value);return r},n.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var o=this.length,i=this.tail;null!==i&&o>t;o--)i=i.prev;for(;null!==i&&o>e;o--,i=i.prev)r.push(i.value);return r},n.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,i=this.head;null!==i&&n<e;n++)i=i.next;var s=[];for(n=0;i&&n<t;n++)s.push(i.value),i=this.removeNode(i);for(null===i&&(i=this.tail),i!==this.head&&i!==this.tail&&(i=i.prev),n=0;n<r.length;n++)i=o(this,i,r[n]);return s},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=t,this.tail=e,this};try{r(9669)(n)}catch(e){}},6585(e){var t=1e3,r=60*t,n=60*r,o=24*n,i=7*o;function s(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}e.exports=function(e,a){a=a||{};var c,u,l=typeof e;if("string"===l&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var s=/^(-?(?:\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(s){var a=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*i;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*n;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===l&&isFinite(e))return a.long?(c=e,(u=Math.abs(c))>=o?s(c,u,o,"day"):u>=n?s(c,u,n,"hour"):u>=r?s(c,u,r,"minute"):u>=t?s(c,u,t,"second"):c+" ms"):function(e){var i=Math.abs(e);return i>=o?Math.round(e/o)+"d":i>=n?Math.round(e/n)+"h":i>=r?Math.round(e/r)+"m":i>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},2861(e,t,r){var n=r(181),o=n.Buffer;function i(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return o(e,t,r)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=s),s.prototype=Object.create(o.prototype),i(o,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=o(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},3904(e,t,r){"use strict";const n=Symbol("SemVer ANY");class o{static get ANY(){return n}constructor(e,t){if(t=i(t),e instanceof o){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),u("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===n?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){const t=this.options.loose?s[a.COMPARATORLOOSE]:s[a.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new l(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===n||e===n)return!0;if("string"==typeof e)try{e=new l(e,this.options)}catch(e){return!1}return c(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof o))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):!((t=i(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(c(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(c(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}e.exports=o;const i=r(8587),{safeRe:s,t:a}=r(9718),c=r(2111),u=r(7272),l=r(3908),d=r(8311)},8311(e,t,r){"use strict";const n=/\s+/g;class o{constructor(e,t){if(t=s(t),e instanceof o)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new o(e.raw,t);if(e instanceof a)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(n," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!g(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&v(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&y)|(this.options.loose&&m))+":"+e,r=i.get(t);if(r)return r;const n=this.options.loose,o=n?l[d.HYPHENRANGELOOSE]:l[d.HYPHENRANGE];e=e.replace(o,T(this.options.includePrerelease)),c("hyphen replace",e),e=e.replace(l[d.COMPARATORTRIM],p),c("comparator trim",e),e=e.replace(l[d.TILDETRIM],f),c("tilde trim",e),e=e.replace(l[d.CARETTRIM],h),c("caret trim",e);let s=e.split(" ").map(e=>E(e,this.options)).join(" ").split(/\s+/).map(e=>C(e,this.options));n&&(s=s.filter(e=>(c("loose invalid filter",e,this.options),!!e.match(l[d.COMPARATORLOOSE])))),c("range list",s);const u=new Map,v=s.map(e=>new a(e,this.options));for(const e of v){if(g(e))return[e];u.set(e.value,e)}u.size>1&&u.has("")&&u.delete("");const w=[...u.values()];return i.set(t,w),w}intersects(e,t){if(!(e instanceof o))throw new TypeError("a Range is required");return this.set.some(r=>w(r,t)&&e.set.some(e=>w(e,t)&&r.every(r=>e.every(e=>r.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(J(this.set[t],e,this.options))return!0;return!1}}e.exports=o;const i=new(r(8794)),s=r(8587),a=r(3904),c=r(7272),u=r(3908),{safeRe:l,t:d,comparatorTrimReplace:p,tildeTrimReplace:f,caretTrimReplace:h}=r(9718),{FLAG_INCLUDE_PRERELEASE:y,FLAG_LOOSE:m}=r(6874),g=e=>"<0.0.0-0"===e.value,v=e=>""===e.value,w=(e,t)=>{let r=!0;const n=e.slice();let o=n.pop();for(;r&&n.length;)r=n.every(e=>o.intersects(e,t)),o=n.pop();return r},E=(e,t)=>(e=e.replace(l[d.BUILD],""),c("comp",e,t),e=A(e,t),c("caret",e),e=S(e,t),c("tildes",e),e=P(e,t),c("xrange",e),e=k(e,t),c("stars",e),e),b=e=>!e||"x"===e.toLowerCase()||"*"===e,S=(e,t)=>e.trim().split(/\s+/).map(e=>_(e,t)).join(" "),_=(e,t)=>{const r=t.loose?l[d.TILDELOOSE]:l[d.TILDE];return e.replace(r,(t,r,n,o,i)=>{let s;return c("tilde",e,t,r,n,o,i),b(r)?s="":b(n)?s=`>=${r}.0.0 <${+r+1}.0.0-0`:b(o)?s=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:i?(c("replaceTilde pr",i),s=`>=${r}.${n}.${o}-${i} <${r}.${+n+1}.0-0`):s=`>=${r}.${n}.${o} <${r}.${+n+1}.0-0`,c("tilde return",s),s})},A=(e,t)=>e.trim().split(/\s+/).map(e=>I(e,t)).join(" "),I=(e,t)=>{c("caret",e,t);const r=t.loose?l[d.CARETLOOSE]:l[d.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(t,r,o,i,s)=>{let a;return c("caret",e,t,r,o,i,s),b(r)?a="":b(o)?a=`>=${r}.0.0${n} <${+r+1}.0.0-0`:b(i)?a="0"===r?`>=${r}.${o}.0${n} <${r}.${+o+1}.0-0`:`>=${r}.${o}.0${n} <${+r+1}.0.0-0`:s?(c("replaceCaret pr",s),a="0"===r?"0"===o?`>=${r}.${o}.${i}-${s} <${r}.${o}.${+i+1}-0`:`>=${r}.${o}.${i}-${s} <${r}.${+o+1}.0-0`:`>=${r}.${o}.${i}-${s} <${+r+1}.0.0-0`):(c("no pr"),a="0"===r?"0"===o?`>=${r}.${o}.${i}${n} <${r}.${o}.${+i+1}-0`:`>=${r}.${o}.${i}${n} <${r}.${+o+1}.0-0`:`>=${r}.${o}.${i} <${+r+1}.0.0-0`),c("caret return",a),a})},P=(e,t)=>(c("replaceXRanges",e,t),e.split(/\s+/).map(e=>O(e,t)).join(" ")),O=(e,t)=>{e=e.trim();const r=t.loose?l[d.XRANGELOOSE]:l[d.XRANGE];return e.replace(r,(r,n,o,i,s,a)=>{c("xRange",e,r,n,o,i,s,a);const u=b(o),l=u||b(i),d=l||b(s),p=d;return"="===n&&p&&(n=""),a=t.includePrerelease?"-0":"",u?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&p?(l&&(i=0),s=0,">"===n?(n=">=",l?(o=+o+1,i=0,s=0):(i=+i+1,s=0)):"<="===n&&(n="<",l?o=+o+1:i=+i+1),"<"===n&&(a="-0"),r=`${n+o}.${i}.${s}${a}`):l?r=`>=${o}.0.0${a} <${+o+1}.0.0-0`:d&&(r=`>=${o}.${i}.0${a} <${o}.${+i+1}.0-0`),c("xRange return",r),r})},k=(e,t)=>(c("replaceStars",e,t),e.trim().replace(l[d.STAR],"")),C=(e,t)=>(c("replaceGTE0",e,t),e.trim().replace(l[t.includePrerelease?d.GTE0PRE:d.GTE0],"")),T=e=>(t,r,n,o,i,s,a,c,u,l,d,p)=>`${r=b(n)?"":b(o)?`>=${n}.0.0${e?"-0":""}`:b(i)?`>=${n}.${o}.0${e?"-0":""}`:s?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=b(u)?"":b(l)?`<${+u+1}.0.0-0`:b(d)?`<${u}.${+l+1}.0-0`:p?`<=${u}.${l}.${d}-${p}`:e?`<${u}.${l}.${+d+1}-0`:`<=${c}`}`.trim(),J=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(c(e[r].semver),e[r].semver!==a.ANY&&e[r].semver.prerelease.length>0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}},3908(e,t,r){"use strict";const n=r(7272),{MAX_LENGTH:o,MAX_SAFE_INTEGER:i}=r(6874),{safeRe:s,t:a}=r(9718),c=r(8587),{compareIdentifiers:u}=r(1123);class l{constructor(e,t){if(t=c(t),e instanceof l){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>o)throw new TypeError(`version is longer than ${o} characters`);n("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?s[a.LOOSE]:s[a.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>i||this.major<0)throw new TypeError("Invalid major version");if(this.minor>i||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>i||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(n("SemVer.compare",this.version,this.options,e),!(e instanceof l)){if("string"==typeof e&&e===this.version)return 0;e=new l(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof l||(e=new l(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof l||(e=new l(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const r=this.prerelease[t],o=e.prerelease[t];if(n("prerelease compare",t,r,o),void 0===r&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===r)return-1;if(r!==o)return u(r,o)}while(++t)}compareBuild(e){e instanceof l||(e=new l(e,this.options));let t=0;do{const r=this.build[t],o=e.build[t];if(n("build compare",t,r,o),void 0===r&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===r)return-1;if(r!==o)return u(r,o)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?s[a.PRERELEASELOOSE]:s[a.PRERELEASE]);if(!e||e[1]!==t)throw new 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":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=l},7414(e,t,r){"use strict";const n=r(144);e.exports=(e,t)=>{const r=n(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},2111(e,t,r){"use strict";const n=r(4641),o=r(3999),i=r(5580),s=r(4089),a=r(7059),c=r(5200);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return n(e,r,u);case"!=":return o(e,r,u);case">":return i(e,r,u);case">=":return s(e,r,u);case"<":return a(e,r,u);case"<=":return c(e,r,u);default:throw new TypeError(`Invalid operator: ${t}`)}}},6170(e,t,r){"use strict";const n=r(3908),o=r(144),{safeRe:i,t:s}=r(9718);e.exports=(e,t)=>{if(e instanceof n)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){const n=t.includePrerelease?i[s.COERCERTLFULL]:i[s.COERCERTL];let o;for(;(o=n.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&o.index+o[0].length===r.index+r[0].length||(r=o),n.lastIndex=o.index+o[1].length+o[2].length;n.lastIndex=-1}else r=e.match(t.includePrerelease?i[s.COERCEFULL]:i[s.COERCE]);if(null===r)return null;const a=r[2],c=r[3]||"0",u=r[4]||"0",l=t.includePrerelease&&r[5]?`-${r[5]}`:"",d=t.includePrerelease&&r[6]?`+${r[6]}`:"";return o(`${a}.${c}.${u}${l}${d}`,t)}},909(e,t,r){"use strict";const n=r(3908);e.exports=(e,t,r)=>{const o=new n(e,r),i=new n(t,r);return o.compare(i)||o.compareBuild(i)}},1763(e,t,r){"use strict";const n=r(560);e.exports=(e,t)=>n(e,t,!0)},560(e,t,r){"use strict";const n=r(3908);e.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))},1832(e,t,r){"use strict";const n=r(144);e.exports=(e,t)=>{const r=n(e,null,!0),o=n(t,null,!0),i=r.compare(o);if(0===i)return null;const s=i>0,a=s?r:o,c=s?o:r,u=!!a.prerelease.length;if(c.prerelease.length&&!u){if(!c.patch&&!c.minor)return"major";if(0===c.compareMain(a))return c.minor&&!c.patch?"minor":"patch"}const l=u?"pre":"";return r.major!==o.major?l+"major":r.minor!==o.minor?l+"minor":r.patch!==o.patch?l+"patch":"prerelease"}},4641(e,t,r){"use strict";const n=r(560);e.exports=(e,t,r)=>0===n(e,t,r)},5580(e,t,r){"use strict";const n=r(560);e.exports=(e,t,r)=>n(e,t,r)>0},4089(e,t,r){"use strict";const n=r(560);e.exports=(e,t,r)=>n(e,t,r)>=0},3007(e,t,r){"use strict";const n=r(3908);e.exports=(e,t,r,o,i)=>{"string"==typeof r&&(i=o,o=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,o,i).version}catch(e){return null}}},7059(e,t,r){"use strict";const n=r(560);e.exports=(e,t,r)=>n(e,t,r)<0},5200(e,t,r){"use strict";const n=r(560);e.exports=(e,t,r)=>n(e,t,r)<=0},2938(e,t,r){"use strict";const n=r(3908);e.exports=(e,t)=>new n(e,t).major},6254(e,t,r){"use strict";const n=r(3908);e.exports=(e,t)=>new n(e,t).minor},3999(e,t,r){"use strict";const n=r(560);e.exports=(e,t,r)=>0!==n(e,t,r)},144(e,t,r){"use strict";const n=r(3908);e.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}},4493(e,t,r){"use strict";const n=r(3908);e.exports=(e,t)=>new n(e,t).patch},1729(e,t,r){"use strict";const n=r(144);e.exports=(e,t)=>{const r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}},9970(e,t,r){"use strict";const n=r(560);e.exports=(e,t,r)=>n(t,e,r)},4277(e,t,r){"use strict";const n=r(909);e.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))},7638(e,t,r){"use strict";const n=r(8311);e.exports=(e,t,r)=>{try{t=new n(t,r)}catch(e){return!1}return t.test(e)}},3927(e,t,r){"use strict";const n=r(909);e.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))},6953(e,t,r){"use strict";const n=r(144);e.exports=(e,t)=>{const r=n(e,t);return r?r.version:null}},9589(e,t,r){"use strict";const n=r(9718),o=r(6874),i=r(3908),s=r(1123),a=r(144),c=r(6953),u=r(7414),l=r(3007),d=r(1832),p=r(2938),f=r(6254),h=r(4493),y=r(1729),m=r(560),g=r(9970),v=r(1763),w=r(909),E=r(3927),b=r(4277),S=r(5580),_=r(7059),A=r(4641),I=r(3999),P=r(4089),O=r(5200),k=r(2111),C=r(6170),T=r(3904),J=r(8311),x=r(7638),K=r(7631),R=r(9628),j=r(270),W=r(1261),$=r(3874),N=r(7075),H=r(5571),M=r(5342),L=r(6780),D=r(2525),F=r(5032);e.exports={parse:a,valid:c,clean:u,inc:l,diff:d,major:p,minor:f,patch:h,prerelease:y,compare:m,rcompare:g,compareLoose:v,compareBuild:w,sort:E,rsort:b,gt:S,lt:_,eq:A,neq:I,gte:P,lte:O,cmp:k,coerce:C,Comparator:T,Range:J,satisfies:x,toComparators:K,maxSatisfying:R,minSatisfying:j,minVersion:W,validRange:$,outside:N,gtr:H,ltr:M,intersects:L,simplifyRange:D,subset:F,SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:o.SEMVER_SPEC_VERSION,RELEASE_TYPES:o.RELEASE_TYPES,compareIdentifiers:s.compareIdentifiers,rcompareIdentifiers:s.rcompareIdentifiers}},6874(e){"use strict";const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},7272(e){"use strict";const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},1123(e){"use strict";const t=/^[0-9]+$/,r=(e,r)=>{if("number"==typeof e&&"number"==typeof r)return e===r?0:e<r?-1:1;const n=t.test(e),o=t.test(r);return n&&o&&(e=+e,r=+r),e===r?0:n&&!o?-1:o&&!n?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},8794(e){"use strict";e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},8587(e){"use strict";const t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},9718(e,t,r){"use strict";const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:o,MAX_LENGTH:i}=r(6874),s=r(7272),a=(t=e.exports={}).re=[],c=t.safeRe=[],u=t.src=[],l=t.safeSrc=[],d=t.t={};let p=0;const f="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",i],[f,o]],y=(e,t,r)=>{const n=(e=>{for(const[t,r]of h)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),o=p++;s(e,o,t),d[e]=o,u[o]=t,l[o]=n,a[o]=new RegExp(t,r?"g":void 0),c[o]=new RegExp(n,r?"g":void 0)};y("NUMERICIDENTIFIER","0|[1-9]\\d*"),y("NUMERICIDENTIFIERLOOSE","\\d+"),y("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),y("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),y("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),y("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),y("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),y("BUILDIDENTIFIER",`${f}+`),y("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),y("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),y("FULL",`^${u[d.FULLPLAIN]}$`),y("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),y("LOOSE",`^${u[d.LOOSEPLAIN]}$`),y("GTLT","((?:<|>)?=?)"),y("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),y("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),y("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),y("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),y("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),y("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),y("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),y("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),y("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?`+`(?:${u[d.BUILD]})?(?:$|[^\\d])`),y("COERCERTL",u[d.COERCE],!0),y("COERCERTLFULL",u[d.COERCEFULL],!0),y("LONETILDE","(?:~>?)"),y("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",y("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),y("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),y("LONECARET","(?:\\^)"),y("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",y("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),y("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),y("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),y("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),y("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",y("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),y("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),y("STAR","(<|>)?=?\\s*\\*"),y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},5571(e,t,r){"use strict";const n=r(7075);e.exports=(e,t,r)=>n(e,t,">",r)},6780(e,t,r){"use strict";const n=r(8311);e.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))},5342(e,t,r){"use strict";const n=r(7075);e.exports=(e,t,r)=>n(e,t,"<",r)},9628(e,t,r){"use strict";const n=r(3908),o=r(8311);e.exports=(e,t,r)=>{let i=null,s=null,a=null;try{a=new o(t,r)}catch(e){return null}return e.forEach(e=>{a.test(e)&&(i&&-1!==s.compare(e)||(i=e,s=new n(i,r)))}),i}},270(e,t,r){"use strict";const n=r(3908),o=r(8311);e.exports=(e,t,r)=>{let i=null,s=null,a=null;try{a=new o(t,r)}catch(e){return null}return e.forEach(e=>{a.test(e)&&(i&&1!==s.compare(e)||(i=e,s=new n(i,r)))}),i}},1261(e,t,r){"use strict";const n=r(3908),o=r(8311),i=r(5580);e.exports=(e,t)=>{e=new o(e,t);let r=new n("0.0.0");if(e.test(r))return r;if(r=new n("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const o=e.set[t];let s=null;o.forEach(e=>{const t=new n(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":s&&!i(t,s)||(s=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),!s||r&&!i(r,s)||(r=s)}return r&&e.test(r)?r:null}},7075(e,t,r){"use strict";const n=r(3908),o=r(3904),{ANY:i}=o,s=r(8311),a=r(7638),c=r(5580),u=r(7059),l=r(5200),d=r(4089);e.exports=(e,t,r,p)=>{let f,h,y,m,g;switch(e=new n(e,p),t=new s(t,p),r){case">":f=c,h=l,y=u,m=">",g=">=";break;case"<":f=u,h=d,y=c,m="<",g="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(e,t,p))return!1;for(let r=0;r<t.set.length;++r){const n=t.set[r];let s=null,a=null;if(n.forEach(e=>{e.semver===i&&(e=new o(">=0.0.0")),s=s||e,a=a||e,f(e.semver,s.semver,p)?s=e:y(e.semver,a.semver,p)&&(a=e)}),s.operator===m||s.operator===g)return!1;if((!a.operator||a.operator===m)&&h(e,a.semver))return!1;if(a.operator===g&&y(e,a.semver))return!1}return!0}},2525(e,t,r){"use strict";const n=r(7638),o=r(560);e.exports=(e,t,r)=>{const i=[];let s=null,a=null;const c=e.sort((e,t)=>o(e,t,r));for(const e of c)n(e,t,r)?(a=e,s||(s=e)):(a&&i.push([s,a]),a=null,s=null);s&&i.push([s,null]);const u=[];for(const[e,t]of i)e===t?u.push(e):t||e!==c[0]?t?e===c[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");const l=u.join(" || "),d="string"==typeof t.raw?t.raw:String(t);return l.length<d.length?l:t}},5032(e,t,r){"use strict";const n=r(8311),o=r(3904),{ANY:i}=o,s=r(7638),a=r(560),c=[new o(">=0.0.0-0")],u=[new o(">=0.0.0")],l=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===i){if(1===t.length&&t[0].semver===i)return!0;e=r.includePrerelease?c:u}if(1===t.length&&t[0].semver===i){if(r.includePrerelease)return!0;t=u}const n=new Set;let o,l,f,h,y,m,g;for(const t of e)">"===t.operator||">="===t.operator?o=d(o,t,r):"<"===t.operator||"<="===t.operator?l=p(l,t,r):n.add(t.semver);if(n.size>1)return null;if(o&&l){if(f=a(o.semver,l.semver,r),f>0)return null;if(0===f&&(">="!==o.operator||"<="!==l.operator))return null}for(const e of n){if(o&&!s(e,String(o),r))return null;if(l&&!s(e,String(l),r))return null;for(const n of t)if(!s(e,String(n),r))return!1;return!0}let v=!(!l||r.includePrerelease||!l.semver.prerelease.length)&&l.semver,w=!(!o||r.includePrerelease||!o.semver.prerelease.length)&&o.semver;v&&1===v.prerelease.length&&"<"===l.operator&&0===v.prerelease[0]&&(v=!1);for(const e of t){if(g=g||">"===e.operator||">="===e.operator,m=m||"<"===e.operator||"<="===e.operator,o)if(w&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===w.major&&e.semver.minor===w.minor&&e.semver.patch===w.patch&&(w=!1),">"===e.operator||">="===e.operator){if(h=d(o,e,r),h===e&&h!==o)return!1}else if(">="===o.operator&&!s(o.semver,String(e),r))return!1;if(l)if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),"<"===e.operator||"<="===e.operator){if(y=p(l,e,r),y===e&&y!==l)return!1}else if("<="===l.operator&&!s(l.semver,String(e),r))return!1;if(!e.operator&&(l||o)&&0!==f)return!1}return!(o&&m&&!l&&0!==f||l&&g&&!o&&0!==f||w||v)},d=(e,t,r)=>{if(!e)return t;const n=a(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},p=(e,t,r)=>{if(!e)return t;const n=a(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let o=!1;e:for(const n of e.set){for(const e of t.set){const t=l(n,e,r);if(o=o||null!==t,t)continue e}if(o)return!1}return!0}},7631(e,t,r){"use strict";const n=r(8311);e.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "))},3874(e,t,r){"use strict";const n=r(8311);e.exports=(e,t)=>{try{return new n(e,t).range||"*"}catch(e){return null}}},7687(e,t,r){"use strict";const n=r(857),o=r(2018),i=r(5884),{env:s}=process;let a;function c(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function u(e,t){if(0===a)return 0;if(i("color=16m")||i("color=full")||i("color=truecolor"))return 3;if(i("color=256"))return 2;if(e&&!t&&void 0===a)return 0;const r=a||0;if("dumb"===s.TERM)return r;if("win32"===process.platform){const e=n.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in s)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(e=>e in s)||"codeship"===s.CI_NAME?1:r;if("TEAMCITY_VERSION"in s)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(s.TEAMCITY_VERSION)?1:0;if("truecolor"===s.COLORTERM)return 3;if("TERM_PROGRAM"in s){const e=parseInt((s.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(s.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(s.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(s.TERM)||"COLORTERM"in s?1:r}i("no-color")||i("no-colors")||i("color=false")||i("color=never")?a=0:(i("color")||i("colors")||i("color=true")||i("color=always"))&&(a=1),"FORCE_COLOR"in s&&(a="true"===s.FORCE_COLOR?1:"false"===s.FORCE_COLOR?0:0===s.FORCE_COLOR.length?1:Math.min(parseInt(s.FORCE_COLOR,10),3)),e.exports={supportsColor:function(e){return c(u(e,e&&e.isTTY))},stdout:c(u(!0,o.isatty(1))),stderr:c(u(!0,o.isatty(2)))}},181(e){"use strict";e.exports=require("buffer")},6982(e){"use strict";e.exports=require("crypto")},4434(e){"use strict";e.exports=require("events")},8611(e){"use strict";e.exports=require("http")},5692(e){"use strict";e.exports=require("https")},857(e){"use strict";e.exports=require("os")},2203(e){"use strict";e.exports=require("stream")},2018(e){"use strict";e.exports=require("tty")},9023(e){"use strict";e.exports=require("util")},3106(e){"use strict";e.exports=require("zlib")}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};(()=>{"use strict";r.r(n),r.d(n,{handler:()=>h});const e=require("node:fs"),t=require("node:path"),o=require("node:url");var i,s=r(8232);!function(e){e[e.none=0]="none",e[e.error=10]="error",e[e.warn=20]="warn",e[e.info=30]="info",e[e.debug=40]="debug"}(i||(i={}));class a{logLevel;constructor(e){this.logLevel=e}jsonify(e){return e.map(e=>{if("object"==typeof e)try{return JSON.stringify(e)}catch{return e}return e})}info(...e){this.logLevel>=i.info&&console.log(...this.jsonify(e))}warn(...e){this.logLevel>=i.warn&&console.warn(...this.jsonify(e))}error(...e){this.logLevel>=i.error&&console.error(...this.jsonify(e))}debug(...e){this.logLevel>=i.debug&&console.trace(...this.jsonify(e))}}const c=(0,o.fileURLToPath)("file:///home/runner/work/cdk-cloudfront-auth/cdk-cloudfront-auth/src/handlers/util/config.ts"),u=t.dirname(c);function l(e,t){return{status:"307",statusDescription:"Temporary Redirect",headers:{location:[{key:"location",value:e}],...t?.cookies?{"set-cookie":t.cookies.map(e=>({key:"set-cookie",value:e}))}:{}}}}function d(e,t){return-1===t.toLowerCase().indexOf("domain")?`${t}; Domain=.${e}`:t}function p(e){const t=function(e){const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/");return JSON.parse(Buffer.from(t,"base64").toString())}(e.tokens.idToken),r=t["cognito:username"],n=`CognitoIdentityServiceProvider.${e.clientId}`,o=`${n}.${r}.idToken`,i=`${n}.${r}.accessToken`,s=`${n}.${r}.refreshToken`,a=`${n}.LastAuthUser`,c=`${n}.${r}.tokenScopesString`,u=e.oauthScopes.join(" "),l=`${n}.${r}.userData`,p=JSON.stringify({UserAttributes:[{Name:"sub",Value:t.sub},{Name:"email",Value:t.email}],Username:r}),h={[o]:`${e.tokens.idToken}; ${d(e.domainName,e.cookieSettings.idToken)}`,[i]:`${e.tokens.accessToken}; ${d(e.domainName,e.cookieSettings.accessToken)}`,[s]:`${e.tokens.refreshToken}; ${d(e.domainName,e.cookieSettings.refreshToken)}`,[a]:`${r}; ${d(e.domainName,e.cookieSettings.idToken)}`,[c]:`${u}; ${d(e.domainName,e.cookieSettings.accessToken)}`,[l]:`${encodeURIComponent(p)}; ${d(e.domainName,e.cookieSettings.idToken)}`,"amplify-signin-with-hostedUI":`true; ${d(e.domainName,e.cookieSettings.accessToken)}`};return"signOut"===e.event?Object.keys(h).forEach(e=>h[e]=f(h[e])):"refreshFailed"===e.event&&(h[s]=f(h[s])),["spa-auth-edge-nonce","spa-auth-edge-nonce-hmac","spa-auth-edge-pkce"].forEach(e=>{h[e]=f(h[e])}),Object.entries(h).map(([e,t])=>`${e}=${t}`)}function f(e=""){const t=e.split(";").map(e=>e.trim()).filter(e=>!e.toLowerCase().startsWith("max-age")).filter(e=>!e.toLowerCase().startsWith("expires")),r=`Expires=${new Date(0).toUTCString()}`;return["",...t.slice(1),r].join("; ")}r(4040),r(4601);const h=function(){let r;return async n=>{r||(r=function(){const r=process.env.LAMBDA_TASK_ROOT||u,n=t.join(r,"config.json");console.log("Loading config from",n);const o=JSON.parse((0,e.readFileSync)(n,"utf-8")),c=`https://cognito-idp.${/^(\S+?)_\S+$/.exec(o.userPoolId)[1]}.amazonaws.com/${o.userPoolId}`,l=`${c}/.well-known/jwks.json`;return{nonceMaxAge:Number.parseInt((0,s.qg)(o.cookieSettings.nonce.toLowerCase())["max-age"],10)||86400,...o,tokenIssuer:c,tokenJwksUri:l,logger:new a(i[o.logLevel])}}()),r.logger.debug("Handling event:",n);const o=function(e,t){if(!t)throw new Error("Expected response value");return{...t,headers:{...t.headers??{},...(r=e.httpHeaders,Object.entries(r).reduce((e,[t,r])=>Object.assign(e,{[t.toLowerCase()]:[{key:t,value:r}]}),{}))}};var r}(r,await(async(e,t)=>{const r=t.Records[0].cf.request,n=r.headers.host[0].value,{idToken:o,accessToken:i,refreshToken:a}=function(e,t){const r=function(e){return e.cookie?e.cookie.reduce((e,t)=>({...e,...(0,s.qg)(t.value)}),{}):{}}(e);if(!r)return{};const n=`CognitoIdentityServiceProvider.${t}`,o=r[`${n}.LastAuthUser`];return{tokenUserName:o,idToken:r[`${n}.${o??""}.idToken`],accessToken:r[`${n}.${o??""}.accessToken`],refreshToken:r[`${n}.${o??""}.refreshToken`],scopes:r[`${n}.${o??""}.tokenScopesString`],nonce:r["spa-auth-edge-nonce"],nonceHmac:r["spa-auth-edge-nonce-hmac"],pkce:r["spa-auth-edge-pkce"]}}(r.headers,e.clientId);if(!o)return l(`https://${n}${e.signOutRedirectTo}`);const c=new URLSearchParams({logout_uri:`https://${n}${e.signOutRedirectTo}`,client_id:e.clientId}).toString();return l(`https://${e.cognitoAuthDomain}/logout?${c}`,{cookies:p({event:"signOut",tokens:{idToken:o,accessToken:i??"",refreshToken:a??""},domainName:n,...e})})})(r,n));return r.logger.debug("Returning response:",o),o}}()})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
|
|
1
|
+
var GW=Object.create;var{getPrototypeOf:ZW,defineProperty:Ft,getOwnPropertyNames:kd,getOwnPropertyDescriptor:IW}=Object,od=Object.prototype.hasOwnProperty;function Ud(t){return this[t]}var iW,XW,kt=(t,c,u)=>{var r=t!=null&&typeof t==="object";if(r){var n=c?iW??=new WeakMap:XW??=new WeakMap,f=n.get(t);if(f)return f}u=t!=null?GW(ZW(t)):{};let d=c||!t||!t.__esModule?Ft(u,"default",{value:t,enumerable:!0}):u;for(let h of kd(t))if(!od.call(d,h))Ft(d,h,{get:Ud.bind(t,h),enumerable:!0});if(r)n.set(t,d);return d},EW=(t)=>{var c=(Fd??=new WeakMap).get(t),u;if(c)return c;if(c=Ft({},"__esModule",{value:!0}),t&&typeof t==="object"||typeof t==="function"){for(var r of kd(t))if(!od.call(c,r))Ft(c,r,{get:Ud.bind(t,r),enumerable:!(u=IW(t,r))||u.enumerable})}return Fd.set(t,c),c},Fd,K=(t,c)=>()=>(c||t((c={exports:{}}).exports,c),c.exports);var YW=(t)=>t;function zW(t,c){this[t]=YW.bind(null,c)}var RW=(t,c)=>{for(var u in c)Ft(t,u,{get:c[u],enumerable:!0,configurable:!0,set:zW.bind(c,u)})};var Tr=K((O1)=>{Object.defineProperty(O1,"__esModule",{value:!0});O1.parseCookie=th;O1.parse=th;O1.stringifyCookie=bW;O1.stringifySetCookie=Tc;O1.serialize=Tc;O1.parseSetCookie=jW;O1.stringifySetCookie=Tc;O1.serialize=Tc;var Qd=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,ad=/^[\u0021-\u003A\u003C-\u007E]*$/,MW=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,eW=/^[\u0020-\u003A\u003D-\u007E]*$/,NW=/^-?\d+$/,TW=Object.prototype.toString,DW=(()=>{let t=function(){};return t.prototype=Object.create(null),t})();function th(t,c){let u=new DW,r=t.length;if(r<2)return u;let n=c?.decode||ch,f=0;do{let d=Nr(t,f,r);if(d===-1)break;let h=er(t,f,r);if(d>h){f=t.lastIndexOf(";",d-1)+1;continue}let q=T1(t,f,d);if(u[q]===void 0)u[q]=n(T1(t,d+1,h));f=h+1}while(f<r);return u}function bW(t,c){let u=c?.encode||encodeURIComponent,r=[];for(let n of Object.keys(t)){let f=t[n];if(f===void 0)continue;if(!Qd.test(n))throw TypeError(`cookie name is invalid: ${n}`);let d=u(f);if(!ad.test(d))throw TypeError(`cookie val is invalid: ${f}`);r.push(`${n}=${d}`)}return r.join("; ")}function Tc(t,c,u){let r=typeof t==="object"?t:{...u,name:t,value:String(c)},f=(typeof c==="object"?c:u)?.encode||encodeURIComponent;if(!Qd.test(r.name))throw TypeError(`argument name is invalid: ${r.name}`);let d=r.value?f(r.value):"";if(!ad.test(d))throw TypeError(`argument val is invalid: ${r.value}`);let h=r.name+"="+d;if(r.maxAge!==void 0){if(!Number.isInteger(r.maxAge))throw TypeError(`option maxAge is invalid: ${r.maxAge}`);h+="; Max-Age="+r.maxAge}if(r.domain){if(!MW.test(r.domain))throw TypeError(`option domain is invalid: ${r.domain}`);h+="; Domain="+r.domain}if(r.path){if(!eW.test(r.path))throw TypeError(`option path is invalid: ${r.path}`);h+="; Path="+r.path}if(r.expires){if(!pW(r.expires)||!Number.isFinite(r.expires.valueOf()))throw TypeError(`option expires is invalid: ${r.expires}`);h+="; Expires="+r.expires.toUTCString()}if(r.httpOnly)h+="; HttpOnly";if(r.secure)h+="; Secure";if(r.partitioned)h+="; Partitioned";if(r.priority)switch(typeof r.priority==="string"?r.priority.toLowerCase():void 0){case"low":h+="; Priority=Low";break;case"medium":h+="; Priority=Medium";break;case"high":h+="; Priority=High";break;default:throw TypeError(`option priority is invalid: ${r.priority}`)}if(r.sameSite)switch(typeof r.sameSite==="string"?r.sameSite.toLowerCase():r.sameSite){case!0:case"strict":h+="; SameSite=Strict";break;case"lax":h+="; SameSite=Lax";break;case"none":h+="; SameSite=None";break;default:throw TypeError(`option sameSite is invalid: ${r.sameSite}`)}return h}function jW(t,c){let u=c?.decode||ch,r=t.length,n=er(t,0,r),f=Nr(t,0,n),d=f===-1?{name:"",value:u(T1(t,0,n))}:{name:T1(t,0,f),value:u(T1(t,f+1,n))},h=n+1;while(h<r){let q=er(t,h,r),_=Nr(t,h,q),W=_===-1?T1(t,h,q):T1(t,h,_),J=_===-1?void 0:T1(t,_+1,q);switch(W.toLowerCase()){case"httponly":d.httpOnly=!0;break;case"secure":d.secure=!0;break;case"partitioned":d.partitioned=!0;break;case"domain":d.domain=J;break;case"path":d.path=J;break;case"max-age":if(J&&NW.test(J))d.maxAge=Number(J);break;case"expires":if(!J)break;let $=new Date(J);if(Number.isFinite($.valueOf()))d.expires=$;break;case"priority":if(!J)break;let w=J.toLowerCase();if(w==="low"||w==="medium"||w==="high")d.priority=w;break;case"samesite":if(!J)break;let P=J.toLowerCase();if(P==="lax"||P==="strict"||P==="none")d.sameSite=P;break}h=q+1}return d}function er(t,c,u){let r=t.indexOf(";",c);return r===-1?u:r}function Nr(t,c,u){let r=t.indexOf("=",c);return r<u?r:-1}function T1(t,c,u){let r=c,n=u;do{let f=t.charCodeAt(r);if(f!==32&&f!==9)break}while(++r<n);while(n>r){let f=t.charCodeAt(n-1);if(f!==32&&f!==9)break;n--}return t.slice(r,n)}function ch(t){if(t.indexOf("%")===-1)return t;try{return decodeURIComponent(t)}catch(c){return t}}function pW(t){return TW.call(t)==="[object Date]"}});var Jt=K((vr,qh)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var bc=require("buffer"),C1=bc.Buffer;function hh(t,c){for(var u in t)c[u]=t[u]}if(C1.from&&C1.alloc&&C1.allocUnsafe&&C1.allocUnsafeSlow)qh.exports=bc;else hh(bc,vr),vr.Buffer=U1;function U1(t,c,u){return C1(t,c,u)}U1.prototype=Object.create(C1.prototype);hh(C1,U1);U1.from=function(t,c,u){if(typeof t==="number")throw TypeError("Argument must not be a number");return C1(t,c,u)};U1.alloc=function(t,c,u){if(typeof t!=="number")throw TypeError("Argument must be a number");var r=C1(t);if(c!==void 0)if(typeof u==="string")r.fill(c,u);else r.fill(c);else r.fill(0);return r};U1.allocUnsafe=function(t){if(typeof t!=="number")throw TypeError("Argument must be a number");return C1(t)};U1.allocUnsafeSlow=function(t){if(typeof t!=="number")throw TypeError("Argument must be a number");return bc.SlowBuffer(t)}});var xr=K((WI,_h)=>{var jc=Jt().Buffer,gW=require("stream"),mW=require("util");function pc(t){if(this.buffer=null,this.writable=!0,this.readable=!0,!t)return this.buffer=jc.alloc(0),this;if(typeof t.pipe==="function")return this.buffer=jc.alloc(0),t.pipe(this),this;if(t.length||typeof t==="object")return this.buffer=t,this.writable=!1,process.nextTick(function(){this.emit("end",t),this.readable=!1,this.emit("close")}.bind(this)),this;throw TypeError("Unexpected data type ("+typeof t+")")}mW.inherits(pc,gW);pc.prototype.write=function(c){this.buffer=jc.concat([this.buffer,jc.from(c)]),this.emit("data",c)};pc.prototype.end=function(c){if(c)this.write(c);this.emit("end",c),this.emit("close"),this.writable=!1,this.readable=!1};_h.exports=pc});var Wh=K((JI,Kh)=>{function Lr(t){var c=(t/8|0)+(t%8===0?0:1);return c}var BW={ES256:Lr(256),ES384:Lr(384),ES512:Lr(521)};function FW(t){var c=BW[t];if(c)return c;throw Error('Unknown algorithm "'+t+'"')}Kh.exports=FW});var Sh=K((wI,yh)=>{var vc=Jt().Buffer,wh=Wh(),xc=128,$h=0,kW=32,oW=16,UW=2,Ph=oW|kW|$h<<6,Lc=UW|$h<<6;function lW(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Ah(t){if(vc.isBuffer(t))return t;else if(typeof t==="string")return vc.from(t,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function QW(t,c){t=Ah(t);var u=wh(c),r=u+1,n=t.length,f=0;if(t[f++]!==Ph)throw Error('Could not find expected "seq"');var d=t[f++];if(d===(xc|1))d=t[f++];if(n-f<d)throw Error('"seq" specified length of "'+d+'", only "'+(n-f)+'" remaining');if(t[f++]!==Lc)throw Error('Could not find expected "int" for "r"');var h=t[f++];if(n-f-2<h)throw Error('"r" specified length of "'+h+'", only "'+(n-f-2)+'" available');if(r<h)throw Error('"r" specified length of "'+h+'", max of "'+r+'" is acceptable');var q=f;if(f+=h,t[f++]!==Lc)throw Error('Could not find expected "int" for "s"');var _=t[f++];if(n-f!==_)throw Error('"s" specified length of "'+_+'", expected "'+(n-f)+'"');if(r<_)throw Error('"s" specified length of "'+_+'", max of "'+r+'" is acceptable');var W=f;if(f+=_,f!==n)throw Error('Expected to consume entire buffer, but "'+(n-f)+'" bytes remain');var J=u-h,$=u-_,w=vc.allocUnsafe(J+h+$+_);for(f=0;f<J;++f)w[f]=0;t.copy(w,f,q+Math.max(-J,0),q+h),f=u;for(var P=f;f<P+$;++f)w[f]=0;return t.copy(w,f,W+Math.max(-$,0),W+_),w=w.toString("base64"),w=lW(w),w}function Jh(t,c,u){var r=0;while(c+r<u&&t[c+r]===0)++r;var n=t[c+r]>=xc;if(n)--r;return r}function aW(t,c){t=Ah(t);var u=wh(c),r=t.length;if(r!==u*2)throw TypeError('"'+c+'" signatures must be "'+u*2+'" bytes, saw "'+r+'"');var n=Jh(t,0,u),f=Jh(t,u,t.length),d=u-n,h=u-f,q=2+d+1+1+h,_=q<xc,W=vc.allocUnsafe((_?2:3)+q),J=0;if(W[J++]=Ph,_)W[J++]=q;else W[J++]=xc|1,W[J++]=q&255;if(W[J++]=Lc,W[J++]=d,n<0)W[J++]=0,J+=t.copy(W,J,0,u);else J+=t.copy(W,J,n,u);if(W[J++]=Lc,W[J++]=h,f<0)W[J++]=0,t.copy(W,J,u);else t.copy(W,J,u+f);return W}yh.exports={derToJose:QW,joseToDer:aW}});var Oh=K(($I,Hh)=>{var ot=require("buffer").Buffer,sr=require("buffer").SlowBuffer;Hh.exports=sc;function sc(t,c){if(!ot.isBuffer(t)||!ot.isBuffer(c))return!1;if(t.length!==c.length)return!1;var u=0;for(var r=0;r<t.length;r++)u|=t[r]^c[r];return u===0}sc.install=function(){ot.prototype.equal=sr.prototype.equal=function(c){return sc(this,c)}};var tJ=ot.prototype.equal,cJ=sr.prototype.equal;sc.restore=function(){ot.prototype.equal=tJ,sr.prototype.equal=cJ}});var Fr=K((PI,zh)=>{var $t=Jt().Buffer,u1=require("crypto"),Gh=Sh(),Ch=require("util"),uJ=`"%s" is not a valid algorithm.
|
|
2
|
+
Supported algorithms are:
|
|
3
|
+
"HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,Ut="secret must be a string or buffer",wt="key must be a string or a buffer",rJ="key must be a string, a buffer or an object",mr=typeof u1.createPublicKey==="function";if(mr)wt+=" or a KeyObject",Ut+="or a KeyObject";function Zh(t){if($t.isBuffer(t))return;if(typeof t==="string")return;if(!mr)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 Ih(t){if($t.isBuffer(t))return;if(typeof t==="string")return;if(typeof t==="object")return;throw w1(rJ)}function nJ(t){if($t.isBuffer(t))return;if(typeof t==="string")return t;if(!mr)throw w1(Ut);if(typeof t!=="object")throw w1(Ut);if(t.type!=="secret")throw w1(Ut);if(typeof t.export!=="function")throw w1(Ut)}function Br(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ih(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=Ch.format.bind(Ch,t).apply(null,c);return TypeError(u)}function fJ(t){return $t.isBuffer(t)||typeof t==="string"}function lt(t){if(!fJ(t))t=JSON.stringify(t);return t}function Xh(t){return function(u,r){nJ(r),u=lt(u);var n=u1.createHmac("sha"+t,r),f=(n.update(u),n.digest("base64"));return Br(f)}}var gr,dJ="timingSafeEqual"in u1?function(c,u){if(c.byteLength!==u.byteLength)return!1;return u1.timingSafeEqual(c,u)}:function(c,u){if(!gr)gr=Oh();return gr(c,u)};function hJ(t){return function(u,r,n){var f=Xh(t)(u,n);return dJ($t.from(r),$t.from(f))}}function Eh(t){return function(u,r){Ih(r),u=lt(u);var n=u1.createSign("RSA-SHA"+t),f=(n.update(u),n.sign(r,"base64"));return Br(f)}}function Yh(t){return function(u,r,n){Zh(n),u=lt(u),r=ih(r);var f=u1.createVerify("RSA-SHA"+t);return f.update(u),f.verify(n,r,"base64")}}function qJ(t){return function(u,r){Ih(r),u=lt(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 _J(t){return function(u,r,n){Zh(n),u=lt(u),r=ih(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 KJ(t){var c=Eh(t);return function(){var r=c.apply(null,arguments);return r=Gh.derToJose(r,"ES"+t),r}}function WJ(t){var c=Yh(t);return function(r,n,f){n=Gh.joseToDer(n,"ES"+t).toString("base64");var d=c(r,n,f);return d}}function JJ(){return function(){return""}}function wJ(){return function(c,u){return u===""}}zh.exports=function(c){var u={hs:Xh,rs:Eh,ps:qJ,es:KJ,none:JJ},r={hs:hJ,rs:Yh,ps:_J,es:WJ,none:wJ},n=c.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!n)throw w1(uJ,c);var f=(n[1]||n[3]).toLowerCase(),d=n[2];return{sign:u[f](d),verify:r[f](d)}}});var kr=K((AI,Rh)=>{var $J=require("buffer").Buffer;Rh.exports=function(c){if(typeof c==="string")return c;if(typeof c==="number"||$J.isBuffer(c))return c.toString();return JSON.stringify(c)}});var Dh=K((yI,Th)=>{var PJ=Jt().Buffer,Vh=xr(),AJ=Fr(),yJ=require("stream"),Mh=kr(),or=require("util");function eh(t,c){return PJ.from(t,c).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function SJ(t,c,u){u=u||"utf8";var r=eh(Mh(t),"binary"),n=eh(Mh(c),u);return or.format("%s.%s",r,n)}function Nh(t){var{header:c,payload:u}=t,r=t.secret||t.privateKey,n=t.encoding,f=AJ(c.alg),d=SJ(c,u,n),h=f.sign(d,r);return or.format("%s.%s",d,h)}function gc(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 Vh(c);this.readable=!0,this.header=t.header,this.encoding=t.encoding,this.secret=this.privateKey=this.key=u,this.payload=new Vh(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))}or.inherits(gc,yJ);gc.prototype.sign=function(){try{var c=Nh({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")}};gc.sign=Nh;Th.exports=gc});var Bh=K((SI,mh)=>{var jh=Jt().Buffer,bh=xr(),HJ=Fr(),OJ=require("stream"),ph=kr(),CJ=require("util"),GJ=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function ZJ(t){return Object.prototype.toString.call(t)==="[object Object]"}function IJ(t){if(ZJ(t))return t;try{return JSON.parse(t)}catch(c){return}}function vh(t){var c=t.split(".",1)[0];return IJ(jh.from(c,"base64").toString("binary"))}function iJ(t){return t.split(".",2).join(".")}function xh(t){return t.split(".")[2]}function XJ(t,c){c=c||"utf8";var u=t.split(".")[1];return jh.from(u,"base64").toString(c)}function Lh(t){return GJ.test(t)&&!!vh(t)}function sh(t,c,u){if(!c){var r=Error("Missing algorithm parameter for jws.verify");throw r.code="MISSING_ALGORITHM",r}t=ph(t);var n=xh(t),f=iJ(t),d=HJ(c);return d.verify(f,n,u)}function gh(t,c){if(c=c||{},t=ph(t),!Lh(t))return null;var u=vh(t);if(!u)return null;var r=XJ(t);if(u.typ==="JWT"||c.json)r=JSON.parse(r,c.encoding);return{header:u,payload:r,signature:xh(t)}}function Pt(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 bh(c);this.readable=!0,this.algorithm=t.algorithm,this.encoding=t.encoding,this.secret=this.publicKey=this.key=u,this.signature=new bh(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))}CJ.inherits(Pt,OJ);Pt.prototype.verify=function(){try{var c=sh(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")}};Pt.decode=gh;Pt.isValid=Lh;Pt.verify=sh;mh.exports=Pt});var Bc=K((D1)=>{var Fh=Dh(),mc=Bh(),EJ=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];D1.ALGORITHMS=EJ;D1.sign=Fh.sign;D1.verify=mc.verify;D1.decode=mc.decode;D1.isValid=mc.isValid;D1.createSign=function(c){return new Fh(c)};D1.createVerify=function(c){return new mc(c)}});var Ur=K((OI,kh)=>{var YJ=Bc();kh.exports=function(t,c){c=c||{};var u=YJ.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 Qt=K((CI,oh)=>{var Fc=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};Fc.prototype=Object.create(Error.prototype);Fc.prototype.constructor=Fc;oh.exports=Fc});var lr=K((GI,lh)=>{var Uh=Qt(),kc=function(t,c){Uh.call(this,t),this.name="NotBeforeError",this.date=c};kc.prototype=Object.create(Uh.prototype);kc.prototype.constructor=kc;lh.exports=kc});var Qr=K((ZI,ah)=>{var Qh=Qt(),oc=function(t,c){Qh.call(this,t),this.name="TokenExpiredError",this.expiredAt=c};oc.prototype=Object.create(Qh.prototype);oc.prototype.constructor=oc;ah.exports=oc});var ar=K((II,tq)=>{var At=1000,yt=At*60,St=yt*60,l1=St*24,zJ=l1*7,RJ=l1*365.25;tq.exports=function(t,c){c=c||{};var u=typeof t;if(u==="string"&&t.length>0)return VJ(t);else if(u==="number"&&isFinite(t))return c.long?eJ(t):MJ(t);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function VJ(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*RJ;case"weeks":case"week":case"w":return u*zJ;case"days":case"day":case"d":return u*l1;case"hours":case"hour":case"hrs":case"hr":case"h":return u*St;case"minutes":case"minute":case"mins":case"min":case"m":return u*yt;case"seconds":case"second":case"secs":case"sec":case"s":return u*At;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}function MJ(t){var c=Math.abs(t);if(c>=l1)return Math.round(t/l1)+"d";if(c>=St)return Math.round(t/St)+"h";if(c>=yt)return Math.round(t/yt)+"m";if(c>=At)return Math.round(t/At)+"s";return t+"ms"}function eJ(t){var c=Math.abs(t);if(c>=l1)return Uc(t,c,l1,"day");if(c>=St)return Uc(t,c,St,"hour");if(c>=yt)return Uc(t,c,yt,"minute");if(c>=At)return Uc(t,c,At,"second");return t+" ms"}function Uc(t,c,u,r){var n=c>=u*1.5;return Math.round(t/u)+" "+r+(n?"s":"")}});var tn=K((iI,cq)=>{var NJ=ar();cq.exports=function(t,c){var u=c||Math.floor(Date.now()/1000);if(typeof t==="string"){var r=NJ(t);if(typeof r>"u")return;return Math.floor(u+r/1000)}else if(typeof t==="number")return u+t;else return}});var at=K((XI,uq)=>{var TJ=Number.MAX_SAFE_INTEGER||9007199254740991,DJ=["major","premajor","minor","preminor","patch","prepatch","prerelease"];uq.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:TJ,RELEASE_TYPES:DJ,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var tc=K((EI,rq)=>{var bJ=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};rq.exports=bJ});var Ht=K((G1,nq)=>{var{MAX_SAFE_COMPONENT_LENGTH:cn,MAX_SAFE_BUILD_LENGTH:jJ,MAX_LENGTH:pJ}=at(),vJ=tc();G1=nq.exports={};var xJ=G1.re=[],LJ=G1.safeRe=[],S=G1.src=[],sJ=G1.safeSrc=[],H=G1.t={},gJ=0,un="[a-zA-Z0-9-]",mJ=[["\\s",1],["\\d",pJ],[un,jJ]],BJ=(t)=>{for(let[c,u]of mJ)t=t.split(`${c}*`).join(`${c}{0,${u}}`).split(`${c}+`).join(`${c}{1,${u}}`);return t},Z=(t,c,u)=>{let r=BJ(c),n=gJ++;vJ(t,n,c),H[t]=n,S[n]=c,sJ[n]=r,xJ[n]=new RegExp(c,u?"g":void 0),LJ[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",`(${S[H.NUMERICIDENTIFIER]})\\.(${S[H.NUMERICIDENTIFIER]})\\.(${S[H.NUMERICIDENTIFIER]})`);Z("MAINVERSIONLOOSE",`(${S[H.NUMERICIDENTIFIERLOOSE]})\\.(${S[H.NUMERICIDENTIFIERLOOSE]})\\.(${S[H.NUMERICIDENTIFIERLOOSE]})`);Z("PRERELEASEIDENTIFIER",`(?:${S[H.NONNUMERICIDENTIFIER]}|${S[H.NUMERICIDENTIFIER]})`);Z("PRERELEASEIDENTIFIERLOOSE",`(?:${S[H.NONNUMERICIDENTIFIER]}|${S[H.NUMERICIDENTIFIERLOOSE]})`);Z("PRERELEASE",`(?:-(${S[H.PRERELEASEIDENTIFIER]}(?:\\.${S[H.PRERELEASEIDENTIFIER]})*))`);Z("PRERELEASELOOSE",`(?:-?(${S[H.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${S[H.PRERELEASEIDENTIFIERLOOSE]})*))`);Z("BUILDIDENTIFIER",`${un}+`);Z("BUILD",`(?:\\+(${S[H.BUILDIDENTIFIER]}(?:\\.${S[H.BUILDIDENTIFIER]})*))`);Z("FULLPLAIN",`v?${S[H.MAINVERSION]}${S[H.PRERELEASE]}?${S[H.BUILD]}?`);Z("FULL",`^${S[H.FULLPLAIN]}$`);Z("LOOSEPLAIN",`[v=\\s]*${S[H.MAINVERSIONLOOSE]}${S[H.PRERELEASELOOSE]}?${S[H.BUILD]}?`);Z("LOOSE",`^${S[H.LOOSEPLAIN]}$`);Z("GTLT","((?:<|>)?=?)");Z("XRANGEIDENTIFIERLOOSE",`${S[H.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Z("XRANGEIDENTIFIER",`${S[H.NUMERICIDENTIFIER]}|x|X|\\*`);Z("XRANGEPLAIN",`[v=\\s]*(${S[H.XRANGEIDENTIFIER]})(?:\\.(${S[H.XRANGEIDENTIFIER]})(?:\\.(${S[H.XRANGEIDENTIFIER]})(?:${S[H.PRERELEASE]})?${S[H.BUILD]}?)?)?`);Z("XRANGEPLAINLOOSE",`[v=\\s]*(${S[H.XRANGEIDENTIFIERLOOSE]})(?:\\.(${S[H.XRANGEIDENTIFIERLOOSE]})(?:\\.(${S[H.XRANGEIDENTIFIERLOOSE]})(?:${S[H.PRERELEASELOOSE]})?${S[H.BUILD]}?)?)?`);Z("XRANGE",`^${S[H.GTLT]}\\s*${S[H.XRANGEPLAIN]}$`);Z("XRANGELOOSE",`^${S[H.GTLT]}\\s*${S[H.XRANGEPLAINLOOSE]}$`);Z("COERCEPLAIN",`(^|[^\\d])(\\d{1,${cn}})(?:\\.(\\d{1,${cn}}))?(?:\\.(\\d{1,${cn}}))?`);Z("COERCE",`${S[H.COERCEPLAIN]}(?:$|[^\\d])`);Z("COERCEFULL",S[H.COERCEPLAIN]+`(?:${S[H.PRERELEASE]})?(?:${S[H.BUILD]})?(?:$|[^\\d])`);Z("COERCERTL",S[H.COERCE],!0);Z("COERCERTLFULL",S[H.COERCEFULL],!0);Z("LONETILDE","(?:~>?)");Z("TILDETRIM",`(\\s*)${S[H.LONETILDE]}\\s+`,!0);G1.tildeTrimReplace="$1~";Z("TILDE",`^${S[H.LONETILDE]}${S[H.XRANGEPLAIN]}$`);Z("TILDELOOSE",`^${S[H.LONETILDE]}${S[H.XRANGEPLAINLOOSE]}$`);Z("LONECARET","(?:\\^)");Z("CARETTRIM",`(\\s*)${S[H.LONECARET]}\\s+`,!0);G1.caretTrimReplace="$1^";Z("CARET",`^${S[H.LONECARET]}${S[H.XRANGEPLAIN]}$`);Z("CARETLOOSE",`^${S[H.LONECARET]}${S[H.XRANGEPLAINLOOSE]}$`);Z("COMPARATORLOOSE",`^${S[H.GTLT]}\\s*(${S[H.LOOSEPLAIN]})$|^$`);Z("COMPARATOR",`^${S[H.GTLT]}\\s*(${S[H.FULLPLAIN]})$|^$`);Z("COMPARATORTRIM",`(\\s*)${S[H.GTLT]}\\s*(${S[H.LOOSEPLAIN]}|${S[H.XRANGEPLAIN]})`,!0);G1.comparatorTrimReplace="$1$2$3";Z("HYPHENRANGE",`^\\s*(${S[H.XRANGEPLAIN]})\\s+-\\s+(${S[H.XRANGEPLAIN]})\\s*$`);Z("HYPHENRANGELOOSE",`^\\s*(${S[H.XRANGEPLAINLOOSE]})\\s+-\\s+(${S[H.XRANGEPLAINLOOSE]})\\s*$`);Z("STAR","(<|>)?=?\\s*\\*");Z("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Z("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var lc=K((YI,fq)=>{var FJ=Object.freeze({loose:!0}),kJ=Object.freeze({}),oJ=(t)=>{if(!t)return kJ;if(typeof t!=="object")return FJ;return t};fq.exports=oJ});var rn=K((zI,qq)=>{var dq=/^[0-9]+$/,hq=(t,c)=>{if(typeof t==="number"&&typeof c==="number")return t===c?0:t<c?-1:1;let u=dq.test(t),r=dq.test(c);if(u&&r)t=+t,c=+c;return t===c?0:u&&!r?-1:r&&!u?1:t<c?-1:1},UJ=(t,c)=>hq(c,t);qq.exports={compareIdentifiers:hq,rcompareIdentifiers:UJ}});var m=K((RI,Kq)=>{var Qc=tc(),{MAX_LENGTH:_q,MAX_SAFE_INTEGER:ac}=at(),{safeRe:tu,t:cu}=Ht(),lJ=lc(),{compareIdentifiers:nn}=rn();class $1{constructor(t,c){if(c=lJ(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>_q)throw TypeError(`version is longer than ${_q} characters`);Qc("SemVer",t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let u=t.trim().match(c.loose?tu[cu.LOOSE]:tu[cu.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>ac||this.major<0)throw TypeError("Invalid major version");if(this.minor>ac||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>ac||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<ac)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(Qc("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(Qc("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(Qc("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?tu[cu.PRERELEASELOOSE]:tu[cu.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(nn(this.prerelease[0],c)===0){if(isNaN(this.prerelease[1]))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}}Kq.exports=$1});var Q1=K((VI,Jq)=>{var Wq=m(),QJ=(t,c,u=!1)=>{if(t instanceof Wq)return t;try{return new Wq(t,c)}catch(r){if(!u)return null;throw r}};Jq.exports=QJ});var $q=K((MI,wq)=>{var aJ=Q1(),t5=(t,c)=>{let u=aJ(t,c);return u?u.version:null};wq.exports=t5});var Aq=K((eI,Pq)=>{var c5=Q1(),u5=(t,c)=>{let u=c5(t.trim().replace(/^[=v]+/,""),c);return u?u.version:null};Pq.exports=u5});var Hq=K((NI,Sq)=>{var yq=m(),r5=(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}};Sq.exports=r5});var Gq=K((TI,Cq)=>{var Oq=Q1(),n5=(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,q=!!d.prerelease.length;if(!!h.prerelease.length&&!q){if(!h.patch&&!h.minor)return"major";if(h.compareMain(d)===0){if(h.minor&&!h.patch)return"minor";return"patch"}}let W=q?"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"};Cq.exports=n5});var Iq=K((DI,Zq)=>{var f5=m(),d5=(t,c)=>new f5(t,c).major;Zq.exports=d5});var Xq=K((bI,iq)=>{var h5=m(),q5=(t,c)=>new h5(t,c).minor;iq.exports=q5});var Yq=K((jI,Eq)=>{var _5=m(),K5=(t,c)=>new _5(t,c).patch;Eq.exports=K5});var Rq=K((pI,zq)=>{var W5=Q1(),J5=(t,c)=>{let u=W5(t,c);return u&&u.prerelease.length?u.prerelease:null};zq.exports=J5});var r1=K((vI,Mq)=>{var Vq=m(),w5=(t,c,u)=>new Vq(t,u).compare(new Vq(c,u));Mq.exports=w5});var Nq=K((xI,eq)=>{var $5=r1(),P5=(t,c,u)=>$5(c,t,u);eq.exports=P5});var Dq=K((LI,Tq)=>{var A5=r1(),y5=(t,c)=>A5(t,c,!0);Tq.exports=y5});var uu=K((sI,jq)=>{var bq=m(),S5=(t,c,u)=>{let r=new bq(t,u),n=new bq(c,u);return r.compare(n)||r.compareBuild(n)};jq.exports=S5});var vq=K((gI,pq)=>{var H5=uu(),O5=(t,c)=>t.sort((u,r)=>H5(u,r,c));pq.exports=O5});var Lq=K((mI,xq)=>{var C5=uu(),G5=(t,c)=>t.sort((u,r)=>C5(r,u,c));xq.exports=G5});var cc=K((BI,sq)=>{var Z5=r1(),I5=(t,c,u)=>Z5(t,c,u)>0;sq.exports=I5});var ru=K((FI,gq)=>{var i5=r1(),X5=(t,c,u)=>i5(t,c,u)<0;gq.exports=X5});var fn=K((kI,mq)=>{var E5=r1(),Y5=(t,c,u)=>E5(t,c,u)===0;mq.exports=Y5});var dn=K((oI,Bq)=>{var z5=r1(),R5=(t,c,u)=>z5(t,c,u)!==0;Bq.exports=R5});var nu=K((UI,Fq)=>{var V5=r1(),M5=(t,c,u)=>V5(t,c,u)>=0;Fq.exports=M5});var fu=K((lI,kq)=>{var e5=r1(),N5=(t,c,u)=>e5(t,c,u)<=0;kq.exports=N5});var hn=K((QI,oq)=>{var T5=fn(),D5=dn(),b5=cc(),j5=nu(),p5=ru(),v5=fu(),x5=(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 T5(t,u,r);case"!=":return D5(t,u,r);case">":return b5(t,u,r);case">=":return j5(t,u,r);case"<":return p5(t,u,r);case"<=":return v5(t,u,r);default:throw TypeError(`Invalid operator: ${c}`)}};oq.exports=x5});var lq=K((aI,Uq)=>{var L5=m(),s5=Q1(),{safeRe:du,t:hu}=Ht(),g5=(t,c)=>{if(t instanceof L5)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?du[hu.COERCEFULL]:du[hu.COERCE]);else{let q=c.includePrerelease?du[hu.COERCERTLFULL]:du[hu.COERCERTL],_;while((_=q.exec(t))&&(!u||u.index+u[0].length!==t.length)){if(!u||_.index+_[0].length!==u.index+u[0].length)u=_;q.lastIndex=_.index+_[1].length+_[2].length}q.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 s5(`${r}.${n}.${f}${d}${h}`,c)};Uq.exports=g5});var t0=K((ti,aq)=>{class Qq{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}}aq.exports=Qq});var n1=K((ci,n0)=>{var m5=/\s+/g;class uc{constructor(t,c){if(c=F5(c),t instanceof uc)if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;else return new uc(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(m5," "),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)=>!u0(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&&tw(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){let u=((this.options.includePrerelease&&Q5)|(this.options.loose&&a5))+":"+t,r=c0.get(u);if(r)return r;let n=this.options.loose,f=n?k[B.HYPHENRANGELOOSE]:k[B.HYPHENRANGE];t=t.replace(f,Kw(this.options.includePrerelease)),V("hyphen replace",t),t=t.replace(k[B.COMPARATORTRIM],o5),V("comparator trim",t),t=t.replace(k[B.TILDETRIM],U5),V("tilde trim",t),t=t.replace(k[B.CARETTRIM],l5),V("caret trim",t);let d=t.split(" ").map((W)=>cw(W,this.options)).join(" ").split(/\s+/).map((W)=>_w(W,this.options));if(n)d=d.filter((W)=>{return V("loose invalid filter",W,this.options),!!W.match(k[B.COMPARATORLOOSE])});V("range list",d);let h=new Map,q=d.map((W)=>new qn(W,this.options));for(let W of q){if(u0(W))return[W];h.set(W.value,W)}if(h.size>1&&h.has(""))h.delete("");let _=[...h.values()];return c0.set(u,_),_}intersects(t,c){if(!(t instanceof uc))throw TypeError("a Range is required");return this.set.some((u)=>{return r0(u,c)&&t.set.some((r)=>{return r0(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 k5(t,this.options)}catch(c){return!1}for(let c=0;c<this.set.length;c++)if(Ww(this.set[c],t,this.options))return!0;return!1}}n0.exports=uc;var B5=t0(),c0=new B5,F5=lc(),qn=rc(),V=tc(),k5=m(),{safeRe:k,t:B,comparatorTrimReplace:o5,tildeTrimReplace:U5,caretTrimReplace:l5}=Ht(),{FLAG_INCLUDE_PRERELEASE:Q5,FLAG_LOOSE:a5}=at(),u0=(t)=>t.value==="<0.0.0-0",tw=(t)=>t.value==="",r0=(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},cw=(t,c)=>{return t=t.replace(k[B.BUILD],""),V("comp",t,c),t=nw(t,c),V("caret",t),t=uw(t,c),V("tildes",t),t=dw(t,c),V("xrange",t),t=qw(t,c),V("stars",t),t},o=(t)=>!t||t.toLowerCase()==="x"||t==="*",uw=(t,c)=>{return t.trim().split(/\s+/).map((u)=>rw(u,c)).join(" ")},rw=(t,c)=>{let u=c.loose?k[B.TILDELOOSE]:k[B.TILDE];return t.replace(u,(r,n,f,d,h)=>{V("tilde",t,r,n,f,d,h);let q;if(o(n))q="";else if(o(f))q=`>=${n}.0.0 <${+n+1}.0.0-0`;else if(o(d))q=`>=${n}.${f}.0 <${n}.${+f+1}.0-0`;else if(h)V("replaceTilde pr",h),q=`>=${n}.${f}.${d}-${h} <${n}.${+f+1}.0-0`;else q=`>=${n}.${f}.${d} <${n}.${+f+1}.0-0`;return V("tilde return",q),q})},nw=(t,c)=>{return t.trim().split(/\s+/).map((u)=>fw(u,c)).join(" ")},fw=(t,c)=>{V("caret",t,c);let u=c.loose?k[B.CARETLOOSE]:k[B.CARET],r=c.includePrerelease?"-0":"";return t.replace(u,(n,f,d,h,q)=>{V("caret",t,n,f,d,h,q);let _;if(o(f))_="";else if(o(d))_=`>=${f}.0.0${r} <${+f+1}.0.0-0`;else if(o(h))if(f==="0")_=`>=${f}.${d}.0${r} <${f}.${+d+1}.0-0`;else _=`>=${f}.${d}.0${r} <${+f+1}.0.0-0`;else if(q)if(V("replaceCaret pr",q),f==="0")if(d==="0")_=`>=${f}.${d}.${h}-${q} <${f}.${d}.${+h+1}-0`;else _=`>=${f}.${d}.${h}-${q} <${f}.${+d+1}.0-0`;else _=`>=${f}.${d}.${h}-${q} <${+f+1}.0.0-0`;else if(V("no pr"),f==="0")if(d==="0")_=`>=${f}.${d}.${h}${r} <${f}.${d}.${+h+1}-0`;else _=`>=${f}.${d}.${h}${r} <${f}.${+d+1}.0-0`;else _=`>=${f}.${d}.${h} <${+f+1}.0.0-0`;return V("caret return",_),_})},dw=(t,c)=>{return V("replaceXRanges",t,c),t.split(/\s+/).map((u)=>hw(u,c)).join(" ")},hw=(t,c)=>{t=t.trim();let u=c.loose?k[B.XRANGELOOSE]:k[B.XRANGE];return t.replace(u,(r,n,f,d,h,q)=>{V("xRange",t,r,n,f,d,h,q);let _=o(f),W=_||o(d),J=W||o(h),$=J;if(n==="="&&$)n="";if(q=c.includePrerelease?"-0":"",_)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==="<")q="-0";r=`${n+f}.${d}.${h}${q}`}else if(W)r=`>=${f}.0.0${q} <${+f+1}.0.0-0`;else if(J)r=`>=${f}.${d}.0${q} <${f}.${+d+1}.0-0`;return V("xRange return",r),r})},qw=(t,c)=>{return V("replaceStars",t,c),t.trim().replace(k[B.STAR],"")},_w=(t,c)=>{return V("replaceGTE0",t,c),t.trim().replace(k[c.includePrerelease?B.GTE0PRE:B.GTE0],"")},Kw=(t)=>(c,u,r,n,f,d,h,q,_,W,J,$)=>{if(o(r))u="";else if(o(n))u=`>=${r}.0.0${t?"-0":""}`;else if(o(f))u=`>=${r}.${n}.0${t?"-0":""}`;else if(d)u=`>=${u}`;else u=`>=${u}${t?"-0":""}`;if(o(_))q="";else if(o(W))q=`<${+_+1}.0.0-0`;else if(o(J))q=`<${_}.${+W+1}.0-0`;else if($)q=`<=${_}.${W}.${J}-${$}`;else if(t)q=`<${_}.${W}.${+J+1}-0`;else q=`<=${q}`;return`${u} ${q}`.trim()},Ww=(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 rc=K((ui,K0)=>{var nc=Symbol("SemVer ANY");class qu{static get ANY(){return nc}constructor(t,c){if(c=f0(c),t instanceof qu)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===nc)this.value="";else this.value=this.operator+this.semver.version;Kn("comp",this)}parse(t){let c=this.options.loose?d0[h0.COMPARATORLOOSE]:d0[h0.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=nc;else this.semver=new q0(u[2],this.options.loose)}toString(){return this.value}test(t){if(Kn("Comparator.test",t,this.options.loose),this.semver===nc||t===nc)return!0;if(typeof t==="string")try{t=new q0(t,this.options)}catch(c){return!1}return _n(t,this.operator,this.semver,this.options)}intersects(t,c){if(!(t instanceof qu))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new _0(t.value,c).test(this.value)}else if(t.operator===""){if(t.value==="")return!0;return new _0(this.value,c).test(t.semver)}if(c=f0(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}}K0.exports=qu;var f0=lc(),{safeRe:d0,t:h0}=Ht(),_n=hn(),Kn=tc(),q0=m(),_0=n1()});var fc=K((ri,W0)=>{var Jw=n1(),ww=(t,c,u)=>{try{c=new Jw(c,u)}catch(r){return!1}return c.test(t)};W0.exports=ww});var w0=K((ni,J0)=>{var $w=n1(),Pw=(t,c)=>new $w(t,c).set.map((u)=>u.map((r)=>r.value).join(" ").trim().split(" "));J0.exports=Pw});var P0=K((fi,$0)=>{var Aw=m(),yw=n1(),Sw=(t,c,u)=>{let r=null,n=null,f=null;try{f=new yw(c,u)}catch(d){return null}return t.forEach((d)=>{if(f.test(d)){if(!r||n.compare(d)===-1)r=d,n=new Aw(r,u)}}),r};$0.exports=Sw});var y0=K((di,A0)=>{var Hw=m(),Ow=n1(),Cw=(t,c,u)=>{let r=null,n=null,f=null;try{f=new Ow(c,u)}catch(d){return null}return t.forEach((d)=>{if(f.test(d)){if(!r||n.compare(d)===1)r=d,n=new Hw(r,u)}}),r};A0.exports=Cw});var O0=K((hi,H0)=>{var Wn=m(),Gw=n1(),S0=cc(),Zw=(t,c)=>{t=new Gw(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||S0(h,f))f=h;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${d.operator}`)}}),f&&(!u||S0(u,f)))u=f}if(u&&t.test(u))return u;return null};H0.exports=Zw});var G0=K((qi,C0)=>{var Iw=n1(),iw=(t,c)=>{try{return new Iw(t,c).range||"*"}catch(u){return null}};C0.exports=iw});var _u=K((_i,X0)=>{var Xw=m(),i0=rc(),{ANY:Ew}=i0,Yw=n1(),zw=fc(),Z0=cc(),I0=ru(),Rw=fu(),Vw=nu(),Mw=(t,c,u,r)=>{t=new Xw(t,r),c=new Yw(c,r);let n,f,d,h,q;switch(u){case">":n=Z0,f=Rw,d=I0,h=">",q=">=";break;case"<":n=I0,f=Vw,d=Z0,h="<",q="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(zw(t,c,r))return!1;for(let _=0;_<c.set.length;++_){let W=c.set[_],J=null,$=null;if(W.forEach((w)=>{if(w.semver===Ew)w=new i0(">=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===q)return!1;if((!$.operator||$.operator===h)&&f(t,$.semver))return!1;else if($.operator===q&&d(t,$.semver))return!1}return!0};X0.exports=Mw});var Y0=K((Ki,E0)=>{var ew=_u(),Nw=(t,c,u)=>ew(t,c,">",u);E0.exports=Nw});var R0=K((Wi,z0)=>{var Tw=_u(),Dw=(t,c,u)=>Tw(t,c,"<",u);z0.exports=Dw});var e0=K((Ji,M0)=>{var V0=n1(),bw=(t,c,u)=>{return t=new V0(t,u),c=new V0(c,u),t.intersects(c,u)};M0.exports=bw});var T0=K((wi,N0)=>{var jw=fc(),pw=r1();N0.exports=(t,c,u)=>{let r=[],n=null,f=null,d=t.sort((W,J)=>pw(W,J,u));for(let W of d)if(jw(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 q=h.join(" || "),_=typeof c.raw==="string"?c.raw:String(c);return q.length<_.length?q:c}});var x0=K(($i,v0)=>{var D0=n1(),wn=rc(),{ANY:Jn}=wn,dc=fc(),$n=r1(),vw=(t,c,u={})=>{if(t===c)return!0;t=new D0(t,u),c=new D0(c,u);let r=!1;t:for(let n of t.set){for(let f of c.set){let d=Lw(n,f,u);if(r=r||d!==null,d)continue t}if(r)return!1}return!0},xw=[new wn(">=0.0.0-0")],b0=[new wn(">=0.0.0")],Lw=(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=xw;else t=b0;if(c.length===1&&c[0].semver===Jn)if(u.includePrerelease)return!0;else c=b0;let r=new Set,n,f;for(let w of t)if(w.operator===">"||w.operator===">=")n=j0(n,w,u);else if(w.operator==="<"||w.operator==="<=")f=p0(f,w,u);else r.add(w.semver);if(r.size>1)return null;let d;if(n&&f){if(d=$n(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&&!dc(w,String(n),u))return null;if(f&&!dc(w,String(f),u))return null;for(let P of c)if(!dc(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===">=",_=_||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=j0(n,w,u),h===w&&h!==n)return!1}else if(n.operator===">="&&!dc(n.semver,String(w),u))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(q=p0(f,w,u),q===w&&q!==f)return!1}else if(f.operator==="<="&&!dc(f.semver,String(w),u))return!1}if(!w.operator&&(f||n)&&d!==0)return!1}if(n&&_&&!f&&d!==0)return!1;if(f&&W&&!n&&d!==0)return!1;if($||J)return!1;return!0},j0=(t,c,u)=>{if(!t)return c;let r=$n(t.semver,c.semver,u);return r>0?t:r<0?c:c.operator===">"&&t.operator===">="?c:t},p0=(t,c,u)=>{if(!t)return c;let r=$n(t.semver,c.semver,u);return r<0?t:r>0?c:c.operator==="<"&&t.operator==="<="?c:t};v0.exports=vw});var Ku=K((Pi,g0)=>{var Pn=Ht(),L0=at(),sw=m(),s0=rn(),gw=Q1(),mw=$q(),Bw=Aq(),Fw=Hq(),kw=Gq(),ow=Iq(),Uw=Xq(),lw=Yq(),Qw=Rq(),aw=r1(),t$=Nq(),c$=Dq(),u$=uu(),r$=vq(),n$=Lq(),f$=cc(),d$=ru(),h$=fn(),q$=dn(),_$=nu(),K$=fu(),W$=hn(),J$=lq(),w$=rc(),$$=n1(),P$=fc(),A$=w0(),y$=P0(),S$=y0(),H$=O0(),O$=G0(),C$=_u(),G$=Y0(),Z$=R0(),I$=e0(),i$=T0(),X$=x0();g0.exports={parse:gw,valid:mw,clean:Bw,inc:Fw,diff:kw,major:ow,minor:Uw,patch:lw,prerelease:Qw,compare:aw,rcompare:t$,compareLoose:c$,compareBuild:u$,sort:r$,rsort:n$,gt:f$,lt:d$,eq:h$,neq:q$,gte:_$,lte:K$,cmp:W$,coerce:J$,Comparator:w$,Range:$$,satisfies:P$,toComparators:A$,maxSatisfying:y$,minSatisfying:S$,minVersion:H$,validRange:O$,outside:C$,gtr:G$,ltr:Z$,intersects:I$,simplifyRange:i$,subset:X$,SemVer:sw,re:Pn.re,src:Pn.src,tokens:Pn.t,SEMVER_SPEC_VERSION:L0.SEMVER_SPEC_VERSION,RELEASE_TYPES:L0.RELEASE_TYPES,compareIdentifiers:s0.compareIdentifiers,rcompareIdentifiers:s0.rcompareIdentifiers}});var B0=K((Ai,m0)=>{var E$=Ku();m0.exports=E$.satisfies(process.version,">=15.7.0")});var k0=K((yi,F0)=>{var Y$=Ku();F0.exports=Y$.satisfies(process.version,">=16.9.0")});var An=K((Si,o0)=>{var z$=B0(),R$=k0(),V$={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},M$={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};o0.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(z$)switch(u){case"ec":let n=c.asymmetricKeyDetails.namedCurve,f=M$[t];if(n!==f)throw Error(`"alg" parameter "${t}" requires curve "${f}".`);break;case"rsa-pss":if(R$){let d=parseInt(t.slice(-3),10),{hashAlgorithm:h,mgf1HashAlgorithm:q,saltLength:_}=c.asymmetricKeyDetails;if(h!==`sha${d}`||q!==h)throw Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${t}.`);if(_!==void 0&&_>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((Hi,U0)=>{var e$=Ku();U0.exports=e$.satisfies(process.version,"^6.12.0 || >=8.0.0")});var a0=K((Oi,Q0)=>{var Y=Qt(),N$=lr(),l0=Qr(),T$=Ur(),D$=tn(),b$=An(),j$=yn(),p$=Bc(),{KeyObject:v$,createSecretKey:x$,createPublicKey:L$}=require("crypto"),Sn=["RS256","RS384","RS512"],s$=["ES256","ES384","ES512"],Hn=["RS256","RS384","RS512"],g$=["HS256","HS384","HS512"];if(j$)Sn.splice(Sn.length,0,"PS256","PS384","PS512"),Hn.splice(Hn.length,0,"PS256","PS384","PS512");Q0.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 Y("clockTimestamp must be a number"));if(u.nonce!==void 0&&(typeof u.nonce!=="string"||u.nonce.trim()===""))return n(new Y("nonce must be a non-empty string"));if(u.allowInvalidAsymmetricKeyTypes!==void 0&&typeof u.allowInvalidAsymmetricKeyTypes!=="boolean")return n(new Y("allowInvalidAsymmetricKeyTypes must be a boolean"));let f=u.clockTimestamp||Math.floor(Date.now()/1000);if(!t)return n(new Y("jwt must be provided"));if(typeof t!=="string")return n(new Y("jwt must be a string"));let d=t.split(".");if(d.length!==3)return n(new Y("jwt malformed"));let h;try{h=T$(t,{complete:!0})}catch(W){return n(W)}if(!h)return n(new Y("invalid token"));let q=h.header,_;if(typeof c==="function"){if(!r)return n(new Y("verify must be called asynchronous if secret or public key is provided as a callback"));_=c}else _=function(W,J){return J(null,c)};return _(q,function(W,J){if(W)return n(new Y("error in secret or public key callback: "+W.message));let $=d[2].trim()!=="";if(!$&&J)return n(new Y("jwt signature is required"));if($&&!J)return n(new Y("secret or public key must be provided"));if(!$&&!u.algorithms)return n(new Y('please specify "none" in "algorithms" to verify unsigned tokens'));if(J!=null&&!(J instanceof v$))try{J=L$(J)}catch(A){try{J=x$(typeof J==="string"?Buffer.from(J):J)}catch(G){return n(new Y("secretOrPublicKey is not valid key material"))}}if(!u.algorithms)if(J.type==="secret")u.algorithms=g$;else if(["rsa","rsa-pss"].includes(J.asymmetricKeyType))u.algorithms=Hn;else if(J.asymmetricKeyType==="ec")u.algorithms=s$;else u.algorithms=Sn;if(u.algorithms.indexOf(h.header.alg)===-1)return n(new Y("invalid algorithm"));if(q.alg.startsWith("HS")&&J.type!=="secret")return n(new Y(`secretOrPublicKey must be a symmetric key when using ${q.alg}`));else if(/^(?:RS|PS|ES)/.test(q.alg)&&J.type!=="public")return n(new Y(`secretOrPublicKey must be an asymmetric key when using ${q.alg}`));if(!u.allowInvalidAsymmetricKeyTypes)try{b$(q.alg,J)}catch(A){return n(A)}let w;try{w=p$.verify(t,h.header.alg,J)}catch(A){return n(A)}if(!w)return n(new Y("invalid signature"));let P=h.payload;if(typeof P.nbf<"u"&&!u.ignoreNotBefore){if(typeof P.nbf!=="number")return n(new Y("invalid nbf value"));if(P.nbf>f+(u.clockTolerance||0))return n(new N$("jwt not active",new Date(P.nbf*1000)))}if(typeof P.exp<"u"&&!u.ignoreExpiration){if(typeof P.exp!=="number")return n(new Y("invalid exp value"));if(f>=P.exp+(u.clockTolerance||0))return n(new l0("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(X){return A.some(function(C){return C instanceof RegExp?C.test(X):C===X})}))return n(new Y("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 Y("jwt issuer invalid. expected: "+u.issuer))}if(u.subject){if(P.sub!==u.subject)return n(new Y("jwt subject invalid. expected: "+u.subject))}if(u.jwtid){if(P.jti!==u.jwtid)return n(new Y("jwt jwtid invalid. expected: "+u.jwtid))}if(u.nonce){if(P.nonce!==u.nonce)return n(new Y("jwt nonce invalid. expected: "+u.nonce))}if(u.maxAge){if(typeof P.iat!=="number")return n(new Y("iat required when maxAge is specified"));let A=D$(u.maxAge,P.iat);if(typeof A>"u")return n(new Y('"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 l0("maxAge exceeded",new Date(A*1000)))}if(u.complete===!0){let A=h.signature;return n(null,{header:q,payload:P,signature:A})}return n(null,P)})}});var f6=K((Ci,n6)=>{var t6=1/0,u6=9007199254740991,m$=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,c6=NaN,B$="[object Arguments]",F$="[object Function]",k$="[object GeneratorFunction]",o$="[object String]",U$="[object Symbol]",l$=/^\s+|\s+$/g,Q$=/^[-+]0x[0-9a-f]+$/i,a$=/^0b[01]+$/i,tP=/^0o[0-7]+$/i,cP=/^(?:0|[1-9]\d*)$/,uP=parseInt;function rP(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 nP(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 fP(t,c,u){if(c!==c)return nP(t,dP,u);var r=u-1,n=t.length;while(++r<n)if(t[r]===c)return r;return-1}function dP(t){return t!==t}function hP(t,c){var u=-1,r=Array(t);while(++u<t)r[u]=c(u);return r}function qP(t,c){return rP(c,function(u){return t[u]})}function _P(t,c){return function(u){return t(c(u))}}var Wu=Object.prototype,Cn=Wu.hasOwnProperty,Ju=Wu.toString,KP=Wu.propertyIsEnumerable,WP=_P(Object.keys,Object),JP=Math.max;function wP(t,c){var u=r6(t)||SP(t)?hP(t.length,String):[],r=u.length,n=!!r;for(var f in t)if((c||Cn.call(t,f))&&!(n&&(f=="length"||PP(f,r))))u.push(f);return u}function $P(t){if(!AP(t))return WP(t);var c=[];for(var u in Object(t))if(Cn.call(t,u)&&u!="constructor")c.push(u);return c}function PP(t,c){return c=c==null?u6:c,!!c&&(typeof t=="number"||cP.test(t))&&(t>-1&&t%1==0&&t<c)}function AP(t){var c=t&&t.constructor,u=typeof c=="function"&&c.prototype||Wu;return t===u}function yP(t,c,u,r){t=Gn(t)?t:YP(t),u=u&&!r?iP(u):0;var n=t.length;if(u<0)u=JP(n+u,0);return GP(t)?u<=n&&t.indexOf(c,u)>-1:!!n&&fP(t,c,u)>-1}function SP(t){return HP(t)&&Cn.call(t,"callee")&&(!KP.call(t,"callee")||Ju.call(t)==B$)}var r6=Array.isArray;function Gn(t){return t!=null&&CP(t.length)&&!OP(t)}function HP(t){return Zn(t)&&Gn(t)}function OP(t){var c=On(t)?Ju.call(t):"";return c==F$||c==k$}function CP(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=u6}function On(t){var c=typeof t;return!!t&&(c=="object"||c=="function")}function Zn(t){return!!t&&typeof t=="object"}function GP(t){return typeof t=="string"||!r6(t)&&Zn(t)&&Ju.call(t)==o$}function ZP(t){return typeof t=="symbol"||Zn(t)&&Ju.call(t)==U$}function IP(t){if(!t)return t===0?t:0;if(t=XP(t),t===t6||t===-t6){var c=t<0?-1:1;return c*m$}return t===t?t:0}function iP(t){var c=IP(t),u=c%1;return c===c?u?c-u:c:0}function XP(t){if(typeof t=="number")return t;if(ZP(t))return c6;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(l$,"");var u=a$.test(t);return u||tP.test(t)?uP(t.slice(2),u?2:8):Q$.test(t)?c6:+t}function EP(t){return Gn(t)?wP(t):$P(t)}function YP(t){return t?qP(t,EP(t)):[]}n6.exports=yP});var h6=K((Gi,d6)=>{var zP="[object Boolean]",RP=Object.prototype,VP=RP.toString;function MP(t){return t===!0||t===!1||eP(t)&&VP.call(t)==zP}function eP(t){return!!t&&typeof t=="object"}d6.exports=MP});var J6=K((Zi,W6)=>{var q6=1/0,NP=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,_6=NaN,TP="[object Symbol]",DP=/^\s+|\s+$/g,bP=/^[-+]0x[0-9a-f]+$/i,jP=/^0b[01]+$/i,pP=/^0o[0-7]+$/i,vP=parseInt,xP=Object.prototype,LP=xP.toString;function sP(t){return typeof t=="number"&&t==FP(t)}function K6(t){var c=typeof t;return!!t&&(c=="object"||c=="function")}function gP(t){return!!t&&typeof t=="object"}function mP(t){return typeof t=="symbol"||gP(t)&&LP.call(t)==TP}function BP(t){if(!t)return t===0?t:0;if(t=kP(t),t===q6||t===-q6){var c=t<0?-1:1;return c*NP}return t===t?t:0}function FP(t){var c=BP(t),u=c%1;return c===c?u?c-u:c:0}function kP(t){if(typeof t=="number")return t;if(mP(t))return _6;if(K6(t)){var c=typeof t.valueOf=="function"?t.valueOf():t;t=K6(c)?c+"":c}if(typeof t!="string")return t===0?t:+t;t=t.replace(DP,"");var u=jP.test(t);return u||pP.test(t)?vP(t.slice(2),u?2:8):bP.test(t)?_6:+t}W6.exports=sP});var $6=K((Ii,w6)=>{var oP="[object Number]",UP=Object.prototype,lP=UP.toString;function QP(t){return!!t&&typeof t=="object"}function aP(t){return typeof t=="number"||QP(t)&&lP.call(t)==oP}w6.exports=aP});var S6=K((ii,y6)=>{var tA="[object Object]";function cA(t){var c=!1;if(t!=null&&typeof t.toString!="function")try{c=!!(t+"")}catch(u){}return c}function uA(t,c){return function(u){return t(c(u))}}var rA=Function.prototype,P6=Object.prototype,A6=rA.toString,nA=P6.hasOwnProperty,fA=A6.call(Object),dA=P6.toString,hA=uA(Object.getPrototypeOf,Object);function qA(t){return!!t&&typeof t=="object"}function _A(t){if(!qA(t)||dA.call(t)!=tA||cA(t))return!1;var c=hA(t);if(c===null)return!0;var u=nA.call(c,"constructor")&&c.constructor;return typeof u=="function"&&u instanceof u&&A6.call(u)==fA}y6.exports=_A});var O6=K((Xi,H6)=>{var KA="[object String]",WA=Object.prototype,JA=WA.toString,wA=Array.isArray;function $A(t){return!!t&&typeof t=="object"}function PA(t){return typeof t=="string"||!wA(t)&&$A(t)&&JA.call(t)==KA}H6.exports=PA});var i6=K((Ei,I6)=>{var AA="Expected a function",C6=1/0,yA=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,G6=NaN,SA="[object Symbol]",HA=/^\s+|\s+$/g,OA=/^[-+]0x[0-9a-f]+$/i,CA=/^0b[01]+$/i,GA=/^0o[0-7]+$/i,ZA=parseInt,IA=Object.prototype,iA=IA.toString;function XA(t,c){var u;if(typeof c!="function")throw TypeError(AA);return t=VA(t),function(){if(--t>0)u=c.apply(this,arguments);if(t<=1)c=void 0;return u}}function EA(t){return XA(2,t)}function Z6(t){var c=typeof t;return!!t&&(c=="object"||c=="function")}function YA(t){return!!t&&typeof t=="object"}function zA(t){return typeof t=="symbol"||YA(t)&&iA.call(t)==SA}function RA(t){if(!t)return t===0?t:0;if(t=MA(t),t===C6||t===-C6){var c=t<0?-1:1;return c*yA}return t===t?t:0}function VA(t){var c=RA(t),u=c%1;return c===c?u?c-u:c:0}function MA(t){if(typeof t=="number")return t;if(zA(t))return G6;if(Z6(t)){var c=typeof t.valueOf=="function"?t.valueOf():t;t=Z6(c)?c+"":c}if(typeof t!="string")return t===0?t:+t;t=t.replace(HA,"");var u=CA.test(t);return u||GA.test(t)?ZA(t.slice(2),u?2:8):OA.test(t)?G6:+t}I6.exports=EA});var N6=K((Yi,e6)=>{var X6=tn(),eA=yn(),NA=An(),E6=Bc(),TA=f6(),wu=h6(),Y6=J6(),In=$6(),R6=S6(),b1=O6(),DA=i6(),{KeyObject:bA,createSecretKey:jA,createPrivateKey:pA}=require("crypto"),V6=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];if(eA)V6.splice(3,0,"PS256","PS384","PS512");var vA={expiresIn:{isValid:function(t){return Y6(t)||b1(t)&&t},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(t){return Y6(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:TA.bind(null,V6),message:'"algorithm" must be a valid string enum value'},header:{isValid:R6,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:wu,message:'"noTimestamp" must be a boolean'},keyid:{isValid:b1,message:'"keyid" must be a string'},mutatePayload:{isValid:wu,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:wu,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:wu,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},xA={iat:{isValid:In,message:'"iat" should be a number of seconds'},exp:{isValid:In,message:'"exp" should be a number of seconds'},nbf:{isValid:In,message:'"nbf" should be a number of seconds'}};function M6(t,c,u,r){if(!R6(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 M6(vA,!1,t,"options")}function sA(t){return M6(xA,!0,t,"payload")}var z6={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},gA=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];e6.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(_){if(r)return r(_);throw _}if(!c&&u.algorithm!=="none")return d(Error("secretOrPrivateKey must have a value"));if(c!=null&&!(c instanceof bA))try{c=pA(c)}catch(_){try{c=jA(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{sA(t)}catch(_){return d(_)}if(!u.mutatePayload)t=Object.assign({},t)}else{let _=gA.filter(function(W){return typeof u[W]<"u"});if(_.length>0)return d(Error("invalid "+_.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(_){return d(_)}if(!u.allowInvalidAsymmetricKeyTypes)try{NA(f.alg,c)}catch(_){return d(_)}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=X6(u.notBefore,h)}catch(_){return d(_)}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=X6(u.expiresIn,h)}catch(_){return d(_)}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(z6).forEach(function(_){let W=z6[_];if(typeof u[_]<"u"){if(typeof t[W]<"u")return d(Error('Bad "options.'+_+'" option. The payload already has an "'+W+'" property.'));t[W]=u[_]}});let q=u.encoding||"utf8";if(typeof r==="function")r=r&&DA(r),E6.createSign({header:f,privateKey:c,payload:t,encoding:q}).once("error",r).once("done",function(_){if(!u.allowInsecureKeySizes&&/^(?:RS|PS)/.test(f.alg)&&_.length<256)return r(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${f.alg}`));r(null,_)});else{let _=E6.sign({header:f,payload:t,secret:c,encoding:q});if(!u.allowInsecureKeySizes&&/^(?:RS|PS)/.test(f.alg)&&_.length<256)throw Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${f.alg}`);return _}}});var D6=K((zi,T6)=>{T6.exports={decode:Ur(),verify:a0(),sign:N6(),JsonWebTokenError:Qt(),NotBeforeError:lr(),TokenExpiredError:Qr()}});var Xn=K((Ri,b6)=>{function mA(t){u.debug=u,u.default=u,u.coerce=q,u.disable=d,u.enable=n,u.enabled=h,u.humanize=ar(),u.destroy=_,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,X=Number(new Date),C=X-(J||X);if(I.diff=C,I.prev=J,I.curr=X,J=X,G[0]=u.coerce(G[0]),typeof G[0]!=="string")G.unshift("%O");let D=0;G[0]=G[0].replace(/%([a-zA-Z%])/g,(c1,N1)=>{if(c1==="%%")return"%";D++;let o1=u.formatters[N1];if(typeof o1==="function"){let Mc=G[D];c1=o1.call(I,Mc),G.splice(D,1),D--}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 q(W){if(W instanceof Error)return W.stack||W.message;return W}function _(){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}b6.exports=mA});var j6=K((U,$u)=>{U.formatArgs=FA;U.save=kA;U.load=oA;U.useColors=BA;U.storage=UA();U.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`.")}})();U.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 BA(){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 FA(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+$u.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)}U.log=console.debug||console.log||(()=>{});function kA(t){try{if(t)U.storage.setItem("debug",t);else U.storage.removeItem("debug")}catch(c){}}function oA(){let t;try{t=U.storage.getItem("debug")||U.storage.getItem("DEBUG")}catch(c){}if(!t&&typeof process<"u"&&"env"in process)t=process.env.DEBUG;return t}function UA(){try{return localStorage}catch(t){}}$u.exports=Xn()(U);var{formatters:lA}=$u.exports;lA.j=function(t){try{return JSON.stringify(t)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}});var v6=K((Vi,p6)=>{p6.exports=(t,c=process.argv)=>{let u=t.startsWith("-")?"":t.length===1?"-":"--",r=c.indexOf(u+t),n=c.indexOf("--");return r!==-1&&(n===-1||r<n)}});var s6=K((Mi,L6)=>{var QA=require("os"),x6=require("tty"),f1=v6(),{env:b}=process,j1;if(f1("no-color")||f1("no-colors")||f1("color=false")||f1("color=never"))j1=0;else if(f1("color")||f1("colors")||f1("color=true")||f1("color=always"))j1=1;if("FORCE_COLOR"in b)if(b.FORCE_COLOR==="true")j1=1;else if(b.FORCE_COLOR==="false")j1=0;else j1=b.FORCE_COLOR.length===0?1:Math.min(parseInt(b.FORCE_COLOR,10),3);function En(t){if(t===0)return!1;return{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Yn(t,c){if(j1===0)return 0;if(f1("color=16m")||f1("color=full")||f1("color=truecolor"))return 3;if(f1("color=256"))return 2;if(t&&!c&&j1===void 0)return 0;let u=j1||0;if(b.TERM==="dumb")return u;if(process.platform==="win32"){let r=QA.release().split(".");if(Number(r[0])>=10&&Number(r[2])>=10586)return Number(r[2])>=14931?3:2;return 1}if("CI"in b){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((r)=>(r in b))||b.CI_NAME==="codeship")return 1;return u}if("TEAMCITY_VERSION"in b)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(b.TEAMCITY_VERSION)?1:0;if(b.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in b){let r=parseInt((b.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(b.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(b.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(b.TERM))return 1;if("COLORTERM"in b)return 1;return u}function aA(t){let c=Yn(t,t&&t.isTTY);return En(c)}L6.exports={supportsColor:aA,stdout:En(Yn(!0,x6.isatty(1))),stderr:En(Yn(!0,x6.isatty(2)))}});var m6=K((j,Au)=>{var ty=require("tty"),Pu=require("util");j.init=hy;j.log=ny;j.formatArgs=uy;j.save=fy;j.load=dy;j.useColors=cy;j.destroy=Pu.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");j.colors=[6,2,3,4,5,1];try{let t=s6();if(t&&(t.stderr||t).level>=2)j.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){}j.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 cy(){return"colors"in j.inspectOpts?Boolean(j.inspectOpts.colors):ty.isatty(process.stderr.fd)}function uy(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(`
|
|
4
|
+
`).join(`
|
|
5
|
+
`+f),t.push(n+"m+"+Au.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=ry()+c+" "+t[0]}function ry(){if(j.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function ny(...t){return process.stderr.write(Pu.formatWithOptions(j.inspectOpts,...t)+`
|
|
6
|
+
`)}function fy(t){if(t)process.env.DEBUG=t;else delete process.env.DEBUG}function dy(){return process.env.DEBUG}function hy(t){t.inspectOpts={};let c=Object.keys(j.inspectOpts);for(let u=0;u<c.length;u++)t.inspectOpts[c[u]]=j.inspectOpts[c[u]]}Au.exports=Xn()(j);var{formatters:g6}=Au.exports;g6.o=function(t){return this.inspectOpts.colors=this.useColors,Pu.inspect(t,this.inspectOpts).split(`
|
|
7
|
+
`).map((c)=>c.trim()).join(" ")};g6.O=function(t){return this.inspectOpts.colors=this.useColors,Pu.inspect(t,this.inspectOpts)}});var yu=K((ei,zn)=>{if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)zn.exports=j6();else zn.exports=m6()});var Vn=K((Rn)=>{Object.defineProperty(Rn,"__esModule",{value:!0});var qy=require("crypto"),_y=(t,c)=>(0,qy.createHash)(t).update(c).digest();Rn.default=_y});var M=K((T)=>{Object.defineProperty(T,"__esModule",{value:!0});T.concatKdf=T.lengthAndInput=T.uint32be=T.uint64be=T.p2s=T.concat=T.decoder=T.encoder=void 0;var Ky=Vn();T.encoder=new TextEncoder;T.decoder=new TextDecoder;var Su=4294967296;function en(...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}T.concat=en;function Wy(t,c){return en(T.encoder.encode(t),new Uint8Array([0]),c)}T.p2s=Wy;function Mn(t,c,u){if(c<0||c>=Su)throw RangeError(`value must be >= 0 and <= ${Su-1}. Received ${c}`);t.set([c>>>24,c>>>16,c>>>8,c&255],u)}function Jy(t){let c=Math.floor(t/Su),u=t%Su,r=new Uint8Array(8);return Mn(r,c,0),Mn(r,u,4),r}T.uint64be=Jy;function Nn(t){let c=new Uint8Array(4);return Mn(c,t),c}T.uint32be=Nn;function wy(t){return en(Nn(t.length),t)}T.lengthAndInput=wy;async function $y(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(Nn(f+1)),d.set(t,4),d.set(u,4+t.length),n.set(await(0,Ky.default)("sha256",d),f*32)}return n.slice(0,c>>3)}T.concatKdf=$y});var F=K((P1)=>{Object.defineProperty(P1,"__esModule",{value:!0});P1.decode=P1.encode=P1.encodeBase64=P1.decodeBase64=void 0;var Ot=require("buffer"),Py=M(),B6;function Ay(t){let c=t;if(c instanceof Uint8Array)c=Py.decoder.decode(c);return c}if(Ot.Buffer.isEncoding("base64url"))P1.encode=B6=(t)=>Ot.Buffer.from(t).toString("base64url");else P1.encode=B6=(t)=>Ot.Buffer.from(t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");var yy=(t)=>Ot.Buffer.from(t,"base64");P1.decodeBase64=yy;var Sy=(t)=>Ot.Buffer.from(t).toString("base64");P1.encodeBase64=Sy;var Hy=(t)=>Ot.Buffer.from(Ay(t),"base64");P1.decode=Hy});var O=K((i)=>{Object.defineProperty(i,"__esModule",{value:!0});i.JWSSignatureVerificationFailed=i.JWKSTimeout=i.JWKSMultipleMatchingKeys=i.JWKSNoMatchingKey=i.JWKSInvalid=i.JWKInvalid=i.JWTInvalid=i.JWSInvalid=i.JWEInvalid=i.JWEDecompressionFailed=i.JWEDecryptionFailed=i.JOSENotSupported=i.JOSEAlgNotAllowed=i.JWTExpired=i.JWTClaimValidationFailed=i.JOSEError=void 0;class x 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)}}i.JOSEError=x;class F6 extends x{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}}i.JWTClaimValidationFailed=F6;class k6 extends x{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}}i.JWTExpired=k6;class o6 extends x{constructor(){super(...arguments);this.code="ERR_JOSE_ALG_NOT_ALLOWED"}static get code(){return"ERR_JOSE_ALG_NOT_ALLOWED"}}i.JOSEAlgNotAllowed=o6;class U6 extends x{constructor(){super(...arguments);this.code="ERR_JOSE_NOT_SUPPORTED"}static get code(){return"ERR_JOSE_NOT_SUPPORTED"}}i.JOSENotSupported=U6;class l6 extends x{constructor(){super(...arguments);this.code="ERR_JWE_DECRYPTION_FAILED",this.message="decryption operation failed"}static get code(){return"ERR_JWE_DECRYPTION_FAILED"}}i.JWEDecryptionFailed=l6;class Q6 extends x{constructor(){super(...arguments);this.code="ERR_JWE_DECOMPRESSION_FAILED",this.message="decompression operation failed"}static get code(){return"ERR_JWE_DECOMPRESSION_FAILED"}}i.JWEDecompressionFailed=Q6;class a6 extends x{constructor(){super(...arguments);this.code="ERR_JWE_INVALID"}static get code(){return"ERR_JWE_INVALID"}}i.JWEInvalid=a6;class t4 extends x{constructor(){super(...arguments);this.code="ERR_JWS_INVALID"}static get code(){return"ERR_JWS_INVALID"}}i.JWSInvalid=t4;class c4 extends x{constructor(){super(...arguments);this.code="ERR_JWT_INVALID"}static get code(){return"ERR_JWT_INVALID"}}i.JWTInvalid=c4;class u4 extends x{constructor(){super(...arguments);this.code="ERR_JWK_INVALID"}static get code(){return"ERR_JWK_INVALID"}}i.JWKInvalid=u4;class r4 extends x{constructor(){super(...arguments);this.code="ERR_JWKS_INVALID"}static get code(){return"ERR_JWKS_INVALID"}}i.JWKSInvalid=r4;class n4 extends x{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"}}i.JWKSNoMatchingKey=n4;class f4 extends x{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"}}i.JWKSMultipleMatchingKeys=f4;class d4 extends x{constructor(){super(...arguments);this.code="ERR_JWKS_TIMEOUT",this.message="request timed out"}static get code(){return"ERR_JWKS_TIMEOUT"}}i.JWKSTimeout=d4;class h4 extends x{constructor(){super(...arguments);this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",this.message="signature verification failed"}static get code(){return"ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}i.JWSSignatureVerificationFailed=h4});var hc=K((Hu)=>{Object.defineProperty(Hu,"__esModule",{value:!0});Hu.default=void 0;var Oy=require("crypto");Object.defineProperty(Hu,"default",{enumerable:!0,get:function(){return Oy.randomFillSync}})});var Ou=K((qc)=>{Object.defineProperty(qc,"__esModule",{value:!0});qc.bitLength=void 0;var Cy=O(),Gy=hc();function q4(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 Cy.JOSENotSupported(`Unsupported JWE Algorithm: ${t}`)}}qc.bitLength=q4;qc.default=(t)=>(0,Gy.default)(new Uint8Array(q4(t)>>3))});var Dn=K((Tn)=>{Object.defineProperty(Tn,"__esModule",{value:!0});var Zy=O(),Iy=Ou(),iy=(t,c)=>{if(c.length<<3!==(0,Iy.bitLength)(t))throw new Zy.JWEInvalid("Invalid Initialization Vector length")};Tn.default=iy});var d1=K((bn)=>{Object.defineProperty(bn,"__esModule",{value:!0});var Xy=require("crypto"),_4=require("util");bn.default=_4.types.isKeyObject?(t)=>_4.types.isKeyObject(t):(t)=>t!=null&&t instanceof Xy.KeyObject});var vn=K((pn)=>{Object.defineProperty(pn,"__esModule",{value:!0});var jn=O(),Ey=d1(),Yy=(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 jn.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 jn.JWEInvalid(`Invalid Content Encryption Key length. Expected ${u} bits, got ${r} bits`);return}if((0,Ey.default)(c)&&c.type==="secret"){let r=c.symmetricKeySize<<3;if(r!==u)throw new jn.JWEInvalid(`Invalid Content Encryption Key length. Expected ${u} bits, got ${r} bits`);return}throw TypeError("Invalid Content Encryption Key type")};pn.default=Yy});var K4=K((xn)=>{Object.defineProperty(xn,"__esModule",{value:!0});var zy=require("crypto"),Ry=zy.timingSafeEqual;xn.default=Ry});var sn=K((Ln)=>{Object.defineProperty(Ln,"__esModule",{value:!0});var Vy=require("crypto"),W4=M();function My(t,c,u,r,n,f){let d=(0,W4.concat)(t,c,u,(0,W4.uint64be)(t.length<<3)),h=(0,Vy.createHmac)(`sha${r}`,n);return h.update(d),h.digest().slice(0,f>>3)}Ln.default=My});var h1=K((_c)=>{Object.defineProperty(_c,"__esModule",{value:!0});_c.isCryptoKey=void 0;var ey=require("crypto"),J4=require("util"),Ny=ey.webcrypto;_c.default=Ny;_c.isCryptoKey=J4.types.isCryptoKey?(t)=>J4.types.isCryptoKey(t):(t)=>!1});var v1=K((Ct)=>{Object.defineProperty(Ct,"__esModule",{value:!0});Ct.checkEncCryptoKey=Ct.checkSigCryptoKey=void 0;function L(t,c="algorithm.name"){return TypeError(`CryptoKey does not support this operation, its ${c} must be ${t}`)}function p1(t,c){return t.name===c}function Cu(t){return parseInt(t.name.slice(4),10)}function Ty(t){switch(t){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}function w4(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 Dy(t,c,...u){switch(c){case"HS256":case"HS384":case"HS512":{if(!p1(t.algorithm,"HMAC"))throw L("HMAC");let r=parseInt(c.slice(2),10);if(Cu(t.algorithm.hash)!==r)throw L(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!p1(t.algorithm,"RSASSA-PKCS1-v1_5"))throw L("RSASSA-PKCS1-v1_5");let r=parseInt(c.slice(2),10);if(Cu(t.algorithm.hash)!==r)throw L(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!p1(t.algorithm,"RSA-PSS"))throw L("RSA-PSS");let r=parseInt(c.slice(2),10);if(Cu(t.algorithm.hash)!==r)throw L(`SHA-${r}`,"algorithm.hash");break}case"EdDSA":{if(t.algorithm.name!=="Ed25519"&&t.algorithm.name!=="Ed448")throw L("Ed25519 or Ed448");break}case"ES256":case"ES384":case"ES512":{if(!p1(t.algorithm,"ECDSA"))throw L("ECDSA");let r=Ty(c);if(t.algorithm.namedCurve!==r)throw L(r,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}w4(t,u)}Ct.checkSigCryptoKey=Dy;function by(t,c,...u){switch(c){case"A128GCM":case"A192GCM":case"A256GCM":{if(!p1(t.algorithm,"AES-GCM"))throw L("AES-GCM");let r=parseInt(c.slice(1,4),10);if(t.algorithm.length!==r)throw L(r,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!p1(t.algorithm,"AES-KW"))throw L("AES-KW");let r=parseInt(c.slice(1,4),10);if(t.algorithm.length!==r)throw L(r,"algorithm.length");break}case"ECDH":{switch(t.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw L("ECDH, X25519, or X448")}break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!p1(t.algorithm,"PBKDF2"))throw L("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!p1(t.algorithm,"RSA-OAEP"))throw L("RSA-OAEP");let r=parseInt(c.slice(9),10)||1;if(Cu(t.algorithm.hash)!==r)throw L(`SHA-${r}`,"algorithm.hash");break}default:throw TypeError("CryptoKey does not support this operation")}w4(t,u)}Ct.checkEncCryptoKey=by});var q1=K((Kc)=>{Object.defineProperty(Kc,"__esModule",{value:!0});Kc.withAlg=void 0;function $4(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}Kc.default=(t,...c)=>{return $4("Key must be ",t,...c)};function jy(t,c,...u){return $4(`Key for the ${t} algorithm must be `,c,...u)}Kc.withAlg=jy});var Gu=K((mn)=>{Object.defineProperty(mn,"__esModule",{value:!0});var py=require("crypto"),gn;mn.default=(t)=>{return gn||(gn=new Set((0,py.getCiphers)())),gn.has(t)}});var _1=K((Wc)=>{Object.defineProperty(Wc,"__esModule",{value:!0});Wc.types=void 0;var Zu=h1(),vy=d1();Wc.default=(t)=>(0,vy.default)(t)||(0,Zu.isCryptoKey)(t);var P4=["KeyObject"];Wc.types=P4;if(globalThis.CryptoKey||(Zu.default===null||Zu.default===void 0?void 0:Zu.default.CryptoKey))P4.push("CryptoKey")});var kn=K((Fn)=>{Object.defineProperty(Fn,"__esModule",{value:!0});var Bn=require("crypto"),xy=Dn(),Ly=vn(),sy=M(),Gt=O(),gy=K4(),my=sn(),By=h1(),Fy=v1(),A4=d1(),ky=q1(),y4=Gu(),oy=_1();function Uy(t,c,u,r,n,f){let d=parseInt(t.slice(1,4),10);if((0,A4.default)(c))c=c.export();let h=c.subarray(d>>3),q=c.subarray(0,d>>3),_=parseInt(t.slice(-3),10),W=`aes-${d}-cbc`;if(!(0,y4.default)(W))throw new Gt.JOSENotSupported(`alg ${t} is not supported by your javascript runtime`);let J=(0,my.default)(f,r,u,_,q,d),$;try{$=(0,gy.default)(n,J)}catch{}if(!$)throw new Gt.JWEDecryptionFailed;let w;try{let P=(0,Bn.createDecipheriv)(W,h,r);w=(0,sy.concat)(P.update(u),P.final())}catch{}if(!w)throw new Gt.JWEDecryptionFailed;return w}function ly(t,c,u,r,n,f){let h=`aes-${parseInt(t.slice(1,4),10)}-gcm`;if(!(0,y4.default)(h))throw new Gt.JOSENotSupported(`alg ${t} is not supported by your javascript runtime`);try{let q=(0,Bn.createDecipheriv)(h,c,r,{authTagLength:16});if(q.setAuthTag(n),f.byteLength)q.setAAD(f,{plaintextLength:u.length});let _=q.update(u);return q.final(),_}catch{throw new Gt.JWEDecryptionFailed}}var Qy=(t,c,u,r,n,f)=>{let d;if((0,By.isCryptoKey)(c))(0,Fy.checkEncCryptoKey)(c,t,"decrypt"),d=Bn.KeyObject.from(c);else if(c instanceof Uint8Array||(0,A4.default)(c))d=c;else throw TypeError((0,ky.default)(c,...oy.types,"Uint8Array"));switch((0,Ly.default)(t,d),(0,xy.default)(t,r),t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return Uy(t,d,u,r,n,f);case"A128GCM":case"A192GCM":case"A256GCM":return ly(t,d,u,r,n,f);default:throw new Gt.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}};Fn.default=Qy});var on=K((Zt)=>{Object.defineProperty(Zt,"__esModule",{value:!0});Zt.deflate=Zt.inflate=void 0;var S4=require("util"),H4=require("zlib"),ay=O(),t3=(0,S4.promisify)(H4.inflateRaw),c3=(0,S4.promisify)(H4.deflateRaw),u3=(t)=>t3(t,{maxOutputLength:250000}).catch(()=>{throw new ay.JWEDecompressionFailed});Zt.inflate=u3;var r3=(t)=>c3(t);Zt.deflate=r3});var It=K((Un)=>{Object.defineProperty(Un,"__esModule",{value:!0});var n3=(...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};Un.default=n3});var l=K((ln)=>{Object.defineProperty(ln,"__esModule",{value:!0});function f3(t){return typeof t==="object"&&t!==null}function d3(t){if(!f3(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}ln.default=d3});var iu=K((it)=>{Object.defineProperty(it,"__esModule",{value:!0});it.unwrap=it.wrap=void 0;var O4=require("buffer"),Iu=require("crypto"),C4=O(),G4=M(),h3=h1(),q3=v1(),_3=d1(),K3=q1(),Z4=Gu(),W3=_1();function I4(t,c){if(t.symmetricKeySize<<3!==parseInt(c.slice(1,4),10))throw TypeError(`Invalid key size for alg: ${c}`)}function i4(t,c,u){if((0,_3.default)(t))return t;if(t instanceof Uint8Array)return(0,Iu.createSecretKey)(t);if((0,h3.isCryptoKey)(t))return(0,q3.checkEncCryptoKey)(t,c,u),Iu.KeyObject.from(t);throw TypeError((0,K3.default)(t,...W3.types,"Uint8Array"))}var J3=(t,c,u)=>{let n=`aes${parseInt(t.slice(1,4),10)}-wrap`;if(!(0,Z4.default)(n))throw new C4.JOSENotSupported(`alg ${t} is not supported either by JOSE or your javascript runtime`);let f=i4(c,t,"wrapKey");I4(f,t);let d=(0,Iu.createCipheriv)(n,f,O4.Buffer.alloc(8,166));return(0,G4.concat)(d.update(u),d.final())};it.wrap=J3;var w3=(t,c,u)=>{let n=`aes${parseInt(t.slice(1,4),10)}-wrap`;if(!(0,Z4.default)(n))throw new C4.JOSENotSupported(`alg ${t} is not supported either by JOSE or your javascript runtime`);let f=i4(c,t,"unwrapKey");I4(f,t);let d=(0,Iu.createDecipheriv)(n,f,O4.Buffer.alloc(8,166));return(0,G4.concat)(d.update(u),d.final())};it.unwrap=w3});var Jc=K((A1)=>{Object.defineProperty(A1,"__esModule",{value:!0});A1.setCurve=A1.weakMap=void 0;var Xu=require("buffer"),X4=require("crypto"),E4=O(),$3=h1(),P3=d1(),A3=q1(),y3=_1(),S3=Xu.Buffer.from([42,134,72,206,61,3,1,7]),H3=Xu.Buffer.from([43,129,4,0,34]),O3=Xu.Buffer.from([43,129,4,0,35]),C3=Xu.Buffer.from([43,129,4,0,10]);A1.weakMap=new WeakMap;var G3=(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 E4.JOSENotSupported("Unsupported key curve for this operation")}},Y4=(t,c)=>{var u;let r;if((0,$3.isCryptoKey)(t))r=X4.KeyObject.from(t);else if((0,P3.default)(t))r=t;else throw TypeError((0,A3.default)(t,...y3.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=Y4((0,X4.createPublicKey)(r),!0);else if(!n){let d=r.export({format:"der",type:"spki"}),h=d[1]<128?14:15,q=d[h],_=d.slice(h+1,h+1+q);if(_.equals(S3))n="prime256v1";else if(_.equals(H3))n="secp384r1";else if(_.equals(O3))n="secp521r1";else if(_.equals(C3))n="secp256k1";else throw new E4.JOSENotSupported("Unsupported key curve for this operation")}if(c)return n;let f=G3(n);return A1.weakMap.set(r,f),f}default:throw TypeError("Invalid asymmetric key type for this operation")}};function Z3(t,c){A1.weakMap.set(t,c)}A1.setCurve=Z3;A1.default=Y4});var rf=K((x1)=>{Object.defineProperty(x1,"__esModule",{value:!0});x1.ecdhAllowed=x1.generateEpk=x1.deriveKey=void 0;var wc=require("crypto"),I3=require("util"),R4=Jc(),a1=M(),i3=O(),an=h1(),z4=v1(),tf=d1(),cf=q1(),uf=_1(),Qn=(0,I3.promisify)(wc.generateKeyPair);async function X3(t,c,u,r,n=new Uint8Array(0),f=new Uint8Array(0)){let d;if((0,an.isCryptoKey)(t))(0,z4.checkEncCryptoKey)(t,"ECDH"),d=wc.KeyObject.from(t);else if((0,tf.default)(t))d=t;else throw TypeError((0,cf.default)(t,...uf.types));let h;if((0,an.isCryptoKey)(c))(0,z4.checkEncCryptoKey)(c,"ECDH","deriveBits"),h=wc.KeyObject.from(c);else if((0,tf.default)(c))h=c;else throw TypeError((0,cf.default)(c,...uf.types));let q=(0,a1.concat)((0,a1.lengthAndInput)(a1.encoder.encode(u)),(0,a1.lengthAndInput)(n),(0,a1.lengthAndInput)(f),(0,a1.uint32be)(r)),_=(0,wc.diffieHellman)({privateKey:h,publicKey:d});return(0,a1.concatKdf)(_,r,q)}x1.deriveKey=X3;async function E3(t){let c;if((0,an.isCryptoKey)(t))c=wc.KeyObject.from(t);else if((0,tf.default)(t))c=t;else throw TypeError((0,cf.default)(t,...uf.types));switch(c.asymmetricKeyType){case"x25519":return Qn("x25519");case"x448":return Qn("x448");case"ec":{let u=(0,R4.default)(c);return Qn("ec",{namedCurve:u})}default:throw new i3.JOSENotSupported("Invalid or unsupported EPK")}}x1.generateEpk=E3;var Y3=(t)=>["P-256","P-384","P-521","X25519","X448"].includes((0,R4.default)(t));x1.ecdhAllowed=Y3});var V4=K((nf)=>{Object.defineProperty(nf,"__esModule",{value:!0});var z3=O();function R3(t){if(!(t instanceof Uint8Array)||t.length<8)throw new z3.JWEInvalid("PBES2 Salt Input must be 8 or more octets")}nf.default=R3});var ff=K((Xt)=>{Object.defineProperty(Xt,"__esModule",{value:!0});Xt.decrypt=Xt.encrypt=void 0;var V3=require("util"),M4=require("crypto"),M3=hc(),e4=M(),e3=F(),N4=iu(),T4=V4(),N3=h1(),T3=v1(),D3=d1(),b3=q1(),j3=_1(),D4=(0,V3.promisify)(M4.pbkdf2);function b4(t,c){if((0,D3.default)(t))return t.export();if(t instanceof Uint8Array)return t;if((0,N3.isCryptoKey)(t))return(0,T3.checkEncCryptoKey)(t,c,"deriveBits","deriveKey"),M4.KeyObject.from(t).export();throw TypeError((0,b3.default)(t,...j3.types,"Uint8Array"))}var p3=async(t,c,u,r=2048,n=(0,M3.default)(new Uint8Array(16)))=>{(0,T4.default)(n);let f=(0,e4.p2s)(t,n),d=parseInt(t.slice(13,16),10)>>3,h=b4(c,t),q=await D4(h,f,r,d,`sha${t.slice(8,11)}`);return{encryptedKey:await(0,N4.wrap)(t.slice(-6),q,u),p2c:r,p2s:(0,e3.encode)(n)}};Xt.encrypt=p3;var v3=async(t,c,u,r,n)=>{(0,T4.default)(n);let f=(0,e4.p2s)(t,n),d=parseInt(t.slice(13,16),10)>>3,h=b4(c,t),q=await D4(h,f,r,d,`sha${t.slice(8,11)}`);return(0,N4.unwrap)(t.slice(-6),q,u)};Xt.decrypt=v3});var $c=K((y1)=>{Object.defineProperty(y1,"__esModule",{value:!0});y1.setModulusLength=y1.weakMap=void 0;y1.weakMap=new WeakMap;var Eu=(t,c)=>{let u=t.readUInt8(1);if((u&128)===0){if(c===0)return u;return Eu(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 Eu(t.subarray(2+u),c-1)},x3=(t,c)=>{let u=t.readUInt8(1);if((u&128)===0)return Eu(t.subarray(2),c);let r=u&127;return Eu(t.subarray(2+r),c)},L3=(t)=>{var c,u;if(y1.weakMap.has(t))return y1.weakMap.get(t);let r=(u=(c=t.asymmetricKeyDetails)===null||c===void 0?void 0:c.modulusLength)!==null&&u!==void 0?u:x3(t.export({format:"der",type:"pkcs1"}),t.type==="private"?1:0)-1<<3;return y1.weakMap.set(t,r),r},s3=(t,c)=>{y1.weakMap.set(t,c)};y1.setModulusLength=s3;y1.default=(t,c)=>{if(L3(t)<2048)throw TypeError(`${c} requires key modulusLength to be 2048 bits or larger`)}});var df=K((Et)=>{Object.defineProperty(Et,"__esModule",{value:!0});Et.decrypt=Et.encrypt=void 0;var Pc=require("crypto"),g3=$c(),m3=h1(),B3=v1(),F3=d1(),k3=q1(),o3=_1(),j4=(t,c)=>{if(t.asymmetricKeyType!=="rsa")throw TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");(0,g3.default)(t,c)},p4=(t)=>{switch(t){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return Pc.constants.RSA_PKCS1_OAEP_PADDING;case"RSA1_5":return Pc.constants.RSA_PKCS1_PADDING;default:return}},v4=(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 x4(t,c,...u){if((0,F3.default)(t))return t;if((0,m3.isCryptoKey)(t))return(0,B3.checkEncCryptoKey)(t,c,...u),Pc.KeyObject.from(t);throw TypeError((0,k3.default)(t,...o3.types))}var U3=(t,c,u)=>{let r=p4(t),n=v4(t),f=x4(c,t,"wrapKey","encrypt");return j4(f,t),(0,Pc.publicEncrypt)({key:f,oaepHash:n,padding:r},u)};Et.encrypt=U3;var l3=(t,c,u)=>{let r=p4(t),n=v4(t),f=x4(c,t,"unwrapKey","decrypt");return j4(f,t),(0,Pc.privateDecrypt)({key:f,oaepHash:n,padding:r},u)};Et.decrypt=l3});var yc=K((Ac)=>{Object.defineProperty(Ac,"__esModule",{value:!0});Ac.bitLength=void 0;var Q3=O(),a3=hc();function L4(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 Q3.JOSENotSupported(`Unsupported JWE Algorithm: ${t}`)}}Ac.bitLength=L4;Ac.default=(t)=>(0,a3.default)(new Uint8Array(L4(t)>>3))});var zu=K((K1)=>{Object.defineProperty(K1,"__esModule",{value:!0});K1.fromX509=K1.fromSPKI=K1.fromPKCS8=K1.toPKCS8=K1.toSPKI=void 0;var Yu=require("crypto"),s4=require("buffer"),t9=h1(),c9=d1(),u9=q1(),r9=_1(),g4=(t,c,u)=>{let r;if((0,t9.isCryptoKey)(u)){if(!u.extractable)throw TypeError("CryptoKey is not extractable");r=Yu.KeyObject.from(u)}else if((0,c9.default)(u))r=u;else throw TypeError((0,u9.default)(u,...r9.types));if(r.type!==t)throw TypeError(`key is not a ${t} key`);return r.export({format:"pem",type:c})},n9=(t)=>{return g4("public","spki",t)};K1.toSPKI=n9;var f9=(t)=>{return g4("private","pkcs8",t)};K1.toPKCS8=f9;var d9=(t)=>(0,Yu.createPrivateKey)({key:s4.Buffer.from(t.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,""),"base64"),type:"pkcs8",format:"der"});K1.fromPKCS8=d9;var h9=(t)=>(0,Yu.createPublicKey)({key:s4.Buffer.from(t.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,""),"base64"),type:"spki",format:"der"});K1.fromSPKI=h9;var q9=(t)=>(0,Yu.createPublicKey)({key:t,type:"spki",format:"pem"});K1.fromX509=q9});var B4=K((qf)=>{Object.defineProperty(qf,"__esModule",{value:!0});var N=require("buffer"),_9=O(),K9=2,W9=3,J9=4,w9=48,hf=N.Buffer.from([0]),Ru=N.Buffer.from([K9]),$9=N.Buffer.from([W9]),P9=N.Buffer.from([w9]),A9=N.Buffer.from([J9]),L1=(t)=>{if(t<128)return N.Buffer.from([t]);let c=N.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)},y9=new Map([["P-256",N.Buffer.from("06 08 2A 86 48 CE 3D 03 01 07".replace(/ /g,""),"hex")],["secp256k1",N.Buffer.from("06 05 2B 81 04 00 0A".replace(/ /g,""),"hex")],["P-384",N.Buffer.from("06 05 2B 81 04 00 22".replace(/ /g,""),"hex")],["P-521",N.Buffer.from("06 05 2B 81 04 00 23".replace(/ /g,""),"hex")],["ecPublicKey",N.Buffer.from("06 07 2A 86 48 CE 3D 02 01".replace(/ /g,""),"hex")],["X25519",N.Buffer.from("06 03 2B 65 6E".replace(/ /g,""),"hex")],["X448",N.Buffer.from("06 03 2B 65 6F".replace(/ /g,""),"hex")],["Ed25519",N.Buffer.from("06 03 2B 65 70".replace(/ /g,""),"hex")],["Ed448",N.Buffer.from("06 03 2B 65 71".replace(/ /g,""),"hex")]]);class m4{constructor(){this.length=0,this.elements=[]}oidFor(t){let c=y9.get(t);if(!c)throw new _9.JOSENotSupported("Invalid or unsupported OID");this.elements.push(c),this.length+=c.length}zero(){this.elements.push(Ru,N.Buffer.from([1]),hf),this.length+=3}one(){this.elements.push(Ru,N.Buffer.from([1]),N.Buffer.from([1])),this.length+=3}unsignedInteger(t){if(t[0]&128){let c=L1(t.length+1);this.elements.push(Ru,c,hf,t),this.length+=2+c.length+t.length}else{let c=0;while(t[c]===0&&(t[c+1]&128)===0)c++;let u=L1(t.length-c);this.elements.push(Ru,L1(t.length-c),t.slice(c)),this.length+=1+u.length+t.length-c}}octStr(t){let c=L1(t.length);this.elements.push(A9,L1(t.length),t),this.length+=1+c.length+t.length}bitStr(t){let c=L1(t.length+1);this.elements.push($9,L1(t.length+1),hf,t),this.length+=1+c.length+t.length+1}add(t){this.elements.push(t),this.length+=t.length}end(t=P9){let c=L1(this.length);return N.Buffer.concat([t,c,...this.elements],1+c.length+this.length)}}qf.default=m4});var Sc=K((Z1)=>{Object.defineProperty(Z1,"__esModule",{value:!0});Z1.jwkImport=Z1.jwkExport=Z1.rsaPssParams=Z1.oneShotCallback=void 0;var[s1,Vu]=process.versions.node.split(".").map((t)=>parseInt(t,10));Z1.oneShotCallback=s1>=16||s1===15&&Vu>=13;Z1.rsaPssParams=!("electron"in process.versions)&&(s1>=17||s1===16&&Vu>=9);Z1.jwkExport=s1>=16||s1===15&&Vu>=9;Z1.jwkImport=s1>=16||s1===15&&Vu>=12});var k4=K((_f)=>{Object.defineProperty(_f,"__esModule",{value:!0});var p=require("buffer"),z1=require("crypto"),S9=F(),H9=O(),F4=Jc(),O9=$c(),S1=B4(),C9=Sc(),G9=(t)=>{if(C9.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,S9.decode)(t.k));case"RSA":{let c=new S1.default,u=t.d!==void 0,r=p.Buffer.from(t.n,"base64"),n=p.Buffer.from(t.e,"base64");if(u)c.zero(),c.unsignedInteger(r),c.unsignedInteger(n),c.unsignedInteger(p.Buffer.from(t.d,"base64")),c.unsignedInteger(p.Buffer.from(t.p,"base64")),c.unsignedInteger(p.Buffer.from(t.q,"base64")),c.unsignedInteger(p.Buffer.from(t.dp,"base64")),c.unsignedInteger(p.Buffer.from(t.dq,"base64")),c.unsignedInteger(p.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,O9.setModulusLength)(h,r.length<<3),h}case"EC":{let c=new S1.default,u=t.d!==void 0,r=p.Buffer.concat([p.Buffer.alloc(1,4),p.Buffer.from(t.x,"base64"),p.Buffer.from(t.y,"base64")]);if(u){c.zero();let h=new S1.default;h.oidFor("ecPublicKey"),h.oidFor(t.crv),c.add(h.end());let q=new S1.default;q.one(),q.octStr(p.Buffer.from(t.d,"base64"));let _=new S1.default;_.bitStr(r);let W=_.end(p.Buffer.from([161]));q.add(W);let J=q.end(),$=new S1.default;$.add(J);let w=$.end(p.Buffer.from([4]));c.add(w);let P=c.end(),A=(0,z1.createPrivateKey)({key:P,format:"der",type:"pkcs8"});return(0,F4.setCurve)(A,t.crv),A}let n=new S1.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,F4.setCurve)(d,t.crv),d}case"OKP":{let c=new S1.default;if(t.d!==void 0){c.zero();let f=new S1.default;f.oidFor(t.crv),c.add(f.end());let d=new S1.default;d.octStr(p.Buffer.from(t.d,"base64"));let h=d.end(p.Buffer.from([4]));c.add(h);let q=c.end();return(0,z1.createPrivateKey)({key:q,format:"der",type:"pkcs8"})}let r=new S1.default;r.oidFor(t.crv),c.add(r.end()),c.bitStr(p.Buffer.from(t.x,"base64"));let n=c.end();return(0,z1.createPublicKey)({key:n,format:"der",type:"spki"})}default:throw new H9.JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}};_f.default=G9});var Hc=K((I1)=>{Object.defineProperty(I1,"__esModule",{value:!0});I1.importJWK=I1.importPKCS8=I1.importX509=I1.importSPKI=void 0;var Z9=F(),Kf=zu(),o4=k4(),U4=O(),I9=l();async function i9(t,c,u){if(typeof t!=="string"||t.indexOf("-----BEGIN PUBLIC KEY-----")!==0)throw TypeError('"spki" must be SPKI formatted string');return(0,Kf.fromSPKI)(t,c,u)}I1.importSPKI=i9;async function X9(t,c,u){if(typeof t!=="string"||t.indexOf("-----BEGIN CERTIFICATE-----")!==0)throw TypeError('"x509" must be X.509 formatted string');return(0,Kf.fromX509)(t,c,u)}I1.importX509=X9;async function E9(t,c,u){if(typeof t!=="string"||t.indexOf("-----BEGIN PRIVATE KEY-----")!==0)throw TypeError('"pkcs8" must be PKCS#8 formatted string');return(0,Kf.fromPKCS8)(t,c,u)}I1.importPKCS8=E9;async function Y9(t,c,u){var r;if(!(0,I9.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,o4.default)({...t,alg:c,ext:(r=t.ext)!==null&&r!==void 0?r:!1});return(0,Z9.decode)(t.k);case"RSA":if(t.oth!==void 0)throw new U4.JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return(0,o4.default)({...t,alg:c});default:throw new U4.JOSENotSupported('Unsupported "kty" (Key Type) Parameter value')}}I1.importJWK=Y9});var Oc=K((Wf)=>{Object.defineProperty(Wf,"__esModule",{value:!0});var l4=q1(),i1=_1(),z9=(t,c)=>{if(c instanceof Uint8Array)return;if(!(0,i1.default)(c))throw TypeError((0,l4.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"`)},R9=(t,c,u)=>{if(!(0,i1.default)(c))throw TypeError((0,l4.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"`)},V9=(t,c,u)=>{if(t.startsWith("HS")||t==="dir"||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t))z9(t,c);else R9(t,c,u)};Wf.default=V9});var Pf=K(($f)=>{Object.defineProperty($f,"__esModule",{value:!0});var Jf=require("crypto"),M9=Dn(),e9=vn(),N9=M(),T9=sn(),D9=h1(),b9=v1(),Q4=d1(),j9=q1(),wf=O(),a4=Gu(),p9=_1();function v9(t,c,u,r,n){let f=parseInt(t.slice(1,4),10);if((0,Q4.default)(u))u=u.export();let d=u.subarray(f>>3),h=u.subarray(0,f>>3),q=`aes-${f}-cbc`;if(!(0,a4.default)(q))throw new wf.JOSENotSupported(`alg ${t} is not supported by your javascript runtime`);let _=(0,Jf.createCipheriv)(q,d,r),W=(0,N9.concat)(_.update(c),_.final()),J=parseInt(t.slice(-3),10),$=(0,T9.default)(n,r,W,J,h,f);return{ciphertext:W,tag:$}}function x9(t,c,u,r,n){let d=`aes-${parseInt(t.slice(1,4),10)}-gcm`;if(!(0,a4.default)(d))throw new wf.JOSENotSupported(`alg ${t} is not supported by your javascript runtime`);let h=(0,Jf.createCipheriv)(d,u,r,{authTagLength:16});if(n.byteLength)h.setAAD(n,{plaintextLength:c.length});let q=h.update(c);h.final();let _=h.getAuthTag();return{ciphertext:q,tag:_}}var L9=(t,c,u,r,n)=>{let f;if((0,D9.isCryptoKey)(u))(0,b9.checkEncCryptoKey)(u,t,"encrypt"),f=Jf.KeyObject.from(u);else if(u instanceof Uint8Array||(0,Q4.default)(u))f=u;else throw TypeError((0,j9.default)(u,...p9.types,"Uint8Array"));switch((0,e9.default)(t,f),(0,M9.default)(t,r),t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return v9(t,c,f,r,n);case"A128GCM":case"A192GCM":case"A256GCM":return x9(t,c,f,r,n);default:throw new wf.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}};$f.default=L9});var Af=K((Yt)=>{Object.defineProperty(Yt,"__esModule",{value:!0});Yt.unwrap=Yt.wrap=void 0;var s9=Pf(),g9=kn(),m9=Ou(),t_=F();async function B9(t,c,u,r){let n=t.slice(0,7);r||(r=(0,m9.default)(n));let{ciphertext:f,tag:d}=await(0,s9.default)(n,u,c,r,new Uint8Array(0));return{encryptedKey:f,iv:(0,t_.encode)(r),tag:(0,t_.encode)(d)}}Yt.wrap=B9;async function F9(t,c,u,r,n){let f=t.slice(0,7);return(0,g9.default)(f,c,u,r,n,new Uint8Array(0))}Yt.unwrap=F9});var r_=K((yf)=>{Object.defineProperty(yf,"__esModule",{value:!0});var c_=iu(),u_=rf(),k9=ff(),o9=df(),Cc=F(),e=O(),U9=yc(),l9=Hc(),Q9=Oc(),a9=l(),tS=Af();async function cS(t,c,u,r,n){switch((0,Q9.default)(t,c,"decrypt"),t){case"dir":{if(u!==void 0)throw new e.JWEInvalid("Encountered unexpected JWE Encrypted Key");return c}case"ECDH-ES":if(u!==void 0)throw new e.JWEInvalid("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!(0,a9.default)(r.epk))throw new e.JWEInvalid('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!u_.ecdhAllowed(c))throw new e.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");let f=await(0,l9.importJWK)(r.epk,t),d,h;if(r.apu!==void 0){if(typeof r.apu!=="string")throw new e.JWEInvalid('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{d=(0,Cc.decode)(r.apu)}catch{throw new e.JWEInvalid("Failed to base64url decode the apu")}}if(r.apv!==void 0){if(typeof r.apv!=="string")throw new e.JWEInvalid('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{h=(0,Cc.decode)(r.apv)}catch{throw new e.JWEInvalid("Failed to base64url decode the apv")}}let q=await u_.deriveKey(f,c,t==="ECDH-ES"?r.enc:t,t==="ECDH-ES"?(0,U9.bitLength)(r.enc):parseInt(t.slice(-5,-2),10),d,h);if(t==="ECDH-ES")return q;if(u===void 0)throw new e.JWEInvalid("JWE Encrypted Key missing");return(0,c_.unwrap)(t.slice(-6),q,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 e.JWEInvalid("JWE Encrypted Key missing");return(0,o9.decrypt)(t,c,u)}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(u===void 0)throw new e.JWEInvalid("JWE Encrypted Key missing");if(typeof r.p2c!=="number")throw new e.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 e.JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof r.p2s!=="string")throw new e.JWEInvalid('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let d;try{d=(0,Cc.decode)(r.p2s)}catch{throw new e.JWEInvalid("Failed to base64url decode the p2s")}return(0,k9.decrypt)(t,c,u,r.p2c,d)}case"A128KW":case"A192KW":case"A256KW":{if(u===void 0)throw new e.JWEInvalid("JWE Encrypted Key missing");return(0,c_.unwrap)(t,c,u)}case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{if(u===void 0)throw new e.JWEInvalid("JWE Encrypted Key missing");if(typeof r.iv!=="string")throw new e.JWEInvalid('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof r.tag!=="string")throw new e.JWEInvalid('JOSE Header "tag" (Authentication Tag) missing or invalid');let f;try{f=(0,Cc.decode)(r.iv)}catch{throw new e.JWEInvalid("Failed to base64url decode the iv")}let d;try{d=(0,Cc.decode)(r.tag)}catch{throw new e.JWEInvalid("Failed to base64url decode the tag")}return(0,tS.unwrap)(t,c,u,f,d)}default:throw new e.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}}yf.default=cS});var zt=K((Sf)=>{Object.defineProperty(Sf,"__esModule",{value:!0});var uS=O();function rS(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 uS.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)}Sf.default=rS});var Of=K((Hf)=>{Object.defineProperty(Hf,"__esModule",{value:!0});var nS=(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)};Hf.default=nS});var eu=K((Mu)=>{Object.defineProperty(Mu,"__esModule",{value:!0});Mu.flattenedDecrypt=void 0;var Rt=F(),fS=kn(),dS=on(),z=O(),hS=It(),Cf=l(),qS=r_(),Gc=M(),_S=yc(),KS=zt(),n_=Of();async function WS(t,c,u){var r;if(!(0,Cf.default)(t))throw new z.JWEInvalid("Flattened JWE must be an object");if(t.protected===void 0&&t.header===void 0&&t.unprotected===void 0)throw new z.JWEInvalid("JOSE Header missing");if(typeof t.iv!=="string")throw new z.JWEInvalid("JWE Initialization Vector missing or incorrect type");if(typeof t.ciphertext!=="string")throw new z.JWEInvalid("JWE Ciphertext missing or incorrect type");if(typeof t.tag!=="string")throw new z.JWEInvalid("JWE Authentication Tag missing or incorrect type");if(t.protected!==void 0&&typeof t.protected!=="string")throw new z.JWEInvalid("JWE Protected Header incorrect type");if(t.encrypted_key!==void 0&&typeof t.encrypted_key!=="string")throw new z.JWEInvalid("JWE Encrypted Key incorrect type");if(t.aad!==void 0&&typeof t.aad!=="string")throw new z.JWEInvalid("JWE AAD incorrect type");if(t.header!==void 0&&!(0,Cf.default)(t.header))throw new z.JWEInvalid("JWE Shared Unprotected Header incorrect type");if(t.unprotected!==void 0&&!(0,Cf.default)(t.unprotected))throw new z.JWEInvalid("JWE Per-Recipient Unprotected Header incorrect type");let n;if(t.protected)try{let D=(0,Rt.decode)(t.protected);n=JSON.parse(Gc.decoder.decode(D))}catch{throw new z.JWEInvalid("JWE Protected Header is invalid")}if(!(0,hS.default)(n,t.header,t.unprotected))throw new z.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,KS.default)(z.JWEInvalid,new Map,u===null||u===void 0?void 0:u.crit,n,f),f.zip!==void 0){if(!n||!n.zip)throw new z.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if(f.zip!=="DEF")throw new z.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}let{alg:d,enc:h}=f;if(typeof d!=="string"||!d)throw new z.JWEInvalid("missing JWE Algorithm (alg) in JWE Header");if(typeof h!=="string"||!h)throw new z.JWEInvalid("missing JWE Encryption Algorithm (enc) in JWE Header");let q=u&&(0,n_.default)("keyManagementAlgorithms",u.keyManagementAlgorithms),_=u&&(0,n_.default)("contentEncryptionAlgorithms",u.contentEncryptionAlgorithms);if(q&&!q.has(d))throw new z.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(_&&!_.has(h))throw new z.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 z.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,qS.default)(d,c,W,f,u)}catch(D){if(D instanceof TypeError||D instanceof z.JWEInvalid||D instanceof z.JOSENotSupported)throw D;$=(0,_S.default)(h)}let w,P;try{w=(0,Rt.decode)(t.iv)}catch{throw new z.JWEInvalid("Failed to base64url decode the iv")}try{P=(0,Rt.decode)(t.tag)}catch{throw new z.JWEInvalid("Failed to base64url decode the tag")}let A=Gc.encoder.encode((r=t.protected)!==null&&r!==void 0?r:""),G;if(t.aad!==void 0)G=(0,Gc.concat)(A,Gc.encoder.encode("."),Gc.encoder.encode(t.aad));else G=A;let I;try{I=(0,Rt.decode)(t.ciphertext)}catch{throw new z.JWEInvalid("Failed to base64url decode the ciphertext")}let X=await(0,fS.default)(h,$,I,w,P,G);if(f.zip==="DEF")X=await((u===null||u===void 0?void 0:u.inflateRaw)||dS.inflate)(X);let C={plaintext:X};if(t.protected!==void 0)C.protectedHeader=n;if(t.aad!==void 0)try{C.additionalAuthenticatedData=(0,Rt.decode)(t.aad)}catch{throw new z.JWEInvalid("Failed to base64url decode the aad")}if(t.unprotected!==void 0)C.sharedUnprotectedHeader=t.unprotected;if(t.header!==void 0)C.unprotectedHeader=t.header;if(J)return{...C,key:c};return C}Mu.flattenedDecrypt=WS});var Gf=K((Nu)=>{Object.defineProperty(Nu,"__esModule",{value:!0});Nu.compactDecrypt=void 0;var JS=eu(),f_=O(),wS=M();async function $S(t,c,u){if(t instanceof Uint8Array)t=wS.decoder.decode(t);if(typeof t!=="string")throw new f_.JWEInvalid("Compact JWE must be a string or Uint8Array");let{0:r,1:n,2:f,3:d,4:h,length:q}=t.split(".");if(q!==5)throw new f_.JWEInvalid("Invalid Compact JWE");let _=await(0,JS.flattenedDecrypt)({ciphertext:d,iv:f||void 0,protected:r||void 0,tag:h||void 0,encrypted_key:n||void 0},c,u),W={plaintext:_.plaintext,protectedHeader:_.protectedHeader};if(typeof c==="function")return{...W,key:_.key};return W}Nu.compactDecrypt=$S});var h_=K((Du)=>{Object.defineProperty(Du,"__esModule",{value:!0});Du.generalDecrypt=void 0;var PS=eu(),Tu=O(),d_=l();async function AS(t,c,u){if(!(0,d_.default)(t))throw new Tu.JWEInvalid("General JWE must be an object");if(!Array.isArray(t.recipients)||!t.recipients.every(d_.default))throw new Tu.JWEInvalid("JWE Recipients missing or incorrect type");if(!t.recipients.length)throw new Tu.JWEInvalid("JWE Recipients has no members");for(let r of t.recipients)try{return await(0,PS.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 Tu.JWEDecryptionFailed}Du.generalDecrypt=AS});var __=K((Zf)=>{Object.defineProperty(Zf,"__esModule",{value:!0});var yS=2,SS=48;class q_{constructor(t){if(t[0]!==SS)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++]!==yS)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()}}Zf.default=q_});var K_=K((Xf)=>{Object.defineProperty(Xf,"__esModule",{value:!0});var bu=require("crypto"),s=F(),HS=__(),ju=O(),If=Jc(),OS=h1(),CS=d1(),GS=q1(),ZS=_1(),IS=Sc(),pu=(t)=>{let c;if((0,OS.isCryptoKey)(t)){if(!t.extractable)throw TypeError("CryptoKey is not extractable");c=bu.KeyObject.from(t)}else if((0,CS.default)(t))c=t;else if(t instanceof Uint8Array)return{kty:"oct",k:(0,s.encode)(t)};else throw TypeError((0,GS.default)(t,...ZS.types,"Uint8Array"));if(IS.jwkExport){if(c.type!=="secret"&&!["rsa","ec","ed25519","x25519","ed448","x448"].includes(c.asymmetricKeyType))throw new ju.JOSENotSupported("Unsupported key asymmetricKeyType");return c.export({format:"jwk"})}switch(c.type){case"secret":return{kty:"oct",k:(0,s.encode)(c.export())};case"private":case"public":switch(c.asymmetricKeyType){case"rsa":{let u=c.export({format:"der",type:"pkcs1"}),r=new HS.default(u);if(c.type==="private")r.unsignedInteger();let n=(0,s.encode)(r.unsignedInteger()),f=(0,s.encode)(r.unsignedInteger()),d;if(c.type==="private")d={d:(0,s.encode)(r.unsignedInteger()),p:(0,s.encode)(r.unsignedInteger()),q:(0,s.encode)(r.unsignedInteger()),dp:(0,s.encode)(r.unsignedInteger()),dq:(0,s.encode)(r.unsignedInteger()),qi:(0,s.encode)(r.unsignedInteger())};return r.end(),{kty:"RSA",n,e:f,...d}}case"ec":{let u=(0,If.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 ju.JOSENotSupported("Unsupported curve")}if(c.type==="public"){let h=c.export({type:"spki",format:"der"});return{kty:"EC",crv:u,x:(0,s.encode)(h.subarray(-r,-r/2)),y:(0,s.encode)(h.subarray(-r/2))}}let d=c.export({type:"pkcs8",format:"der"});if(d.length<100)n+=f;return{...pu((0,bu.createPublicKey)(c)),d:(0,s.encode)(d.subarray(n,n+r/2))}}case"ed25519":case"x25519":{let u=(0,If.default)(c);if(c.type==="public"){let n=c.export({type:"spki",format:"der"});return{kty:"OKP",crv:u,x:(0,s.encode)(n.subarray(-32))}}let r=c.export({type:"pkcs8",format:"der"});return{...pu((0,bu.createPublicKey)(c)),d:(0,s.encode)(r.subarray(-32))}}case"ed448":case"x448":{let u=(0,If.default)(c);if(c.type==="public"){let n=c.export({type:"spki",format:"der"});return{kty:"OKP",crv:u,x:(0,s.encode)(n.subarray(u==="Ed448"?-57:-56))}}let r=c.export({type:"pkcs8",format:"der"});return{...pu((0,bu.createPublicKey)(c)),d:(0,s.encode)(r.subarray(u==="Ed448"?-57:-56))}}default:throw new ju.JOSENotSupported("Unsupported key asymmetricKeyType")}default:throw new ju.JOSENotSupported("Unsupported key type")}};Xf.default=pu});var Ef=K((g1)=>{Object.defineProperty(g1,"__esModule",{value:!0});g1.exportJWK=g1.exportPKCS8=g1.exportSPKI=void 0;var iS=zu(),XS=zu(),ES=K_();async function YS(t){return(0,iS.toSPKI)(t)}g1.exportSPKI=YS;async function zS(t){return(0,XS.toPKCS8)(t)}g1.exportPKCS8=zS;async function RS(t){return(0,ES.default)(t)}g1.exportJWK=RS});var Rf=K((zf)=>{Object.defineProperty(zf,"__esModule",{value:!0});var W_=iu(),Yf=rf(),VS=ff(),MS=df(),J_=F(),Vt=yc(),w_=O(),eS=Ef(),NS=Oc(),TS=Af();async function DS(t,c,u,r,n={}){let f,d,h;switch((0,NS.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(!Yf.ecdhAllowed(u))throw new w_.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu:q,apv:_}=n,{epk:W}=n;W||(W=(await Yf.generateEpk(u)).privateKey);let{x:J,y:$,crv:w,kty:P}=await(0,eS.exportJWK)(W),A=await Yf.deriveKey(u,W,t==="ECDH-ES"?c:t,t==="ECDH-ES"?(0,Vt.bitLength)(c):parseInt(t.slice(-5,-2),10),q,_);if(d={epk:{x:J,crv:w,kty:P}},P==="EC")d.epk.y=$;if(q)d.apu=(0,J_.encode)(q);if(_)d.apv=(0,J_.encode)(_);if(t==="ECDH-ES"){h=A;break}h=r||(0,Vt.default)(c);let G=t.slice(-6);f=await(0,W_.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,Vt.default)(c),f=await(0,MS.encrypt)(t,u,h);break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{h=r||(0,Vt.default)(c);let{p2c:q,p2s:_}=n;({encryptedKey:f,...d}=await(0,VS.encrypt)(t,u,h,q,_));break}case"A128KW":case"A192KW":case"A256KW":{h=r||(0,Vt.default)(c),f=await(0,W_.wrap)(t,u,h);break}case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{h=r||(0,Vt.default)(c);let{iv:q}=n;({encryptedKey:f,...d}=await(0,TS.wrap)(t,u,h,q));break}default:throw new w_.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:h,encryptedKey:f,parameters:d}}zf.default=DS});var vu=K((ct)=>{Object.defineProperty(ct,"__esModule",{value:!0});ct.FlattenedEncrypt=ct.unprotected=void 0;var Mt=F(),$_=Pf(),bS=on(),jS=Ou(),pS=Rf(),tt=O(),vS=It(),et=M(),xS=zt();ct.unprotected=Symbol();class P_{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 tt.JWEInvalid("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!(0,vS.default)(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new tt.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,xS.default)(tt.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 tt.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if(u.zip!=="DEF")throw new tt.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}let{alg:r,enc:n}=u;if(typeof r!=="string"||!r)throw new tt.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(typeof n!=="string"||!n)throw new tt.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,pS.default)(r,n,t,this._cek,this._keyManagementParameters),w)if(c&&ct.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,jS.default)(n));let h,q,_;if(this._protectedHeader)q=et.encoder.encode((0,Mt.encode)(JSON.stringify(this._protectedHeader)));else q=et.encoder.encode("");if(this._aad)_=(0,Mt.encode)(this._aad),h=(0,et.concat)(q,et.encoder.encode("."),et.encoder.encode(_));else h=q;let W,J;if(u.zip==="DEF"){let w=await((c===null||c===void 0?void 0:c.deflateRaw)||bS.deflate)(this._plaintext);({ciphertext:W,tag:J}=await(0,$_.default)(n,w,d,this._iv,h))}else({ciphertext:W,tag:J}=await(0,$_.default)(n,this._plaintext,d,this._iv,h));let $={ciphertext:(0,Mt.encode)(W),iv:(0,Mt.encode)(this._iv),tag:(0,Mt.encode)(J)};if(f)$.encrypted_key=(0,Mt.encode)(f);if(_)$.aad=_;if(this._protectedHeader)$.protected=et.decoder.decode(q);if(this._sharedUnprotectedHeader)$.unprotected=this._sharedUnprotectedHeader;if(this._unprotectedHeader)$.header=this._unprotectedHeader;return $}}ct.FlattenedEncrypt=P_});var S_=K((xu)=>{Object.defineProperty(xu,"__esModule",{value:!0});xu.GeneralEncrypt=void 0;var Vf=vu(),m1=O(),LS=yc(),sS=It(),gS=Rf(),mS=F(),BS=zt();class A_{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 y_{constructor(t){this._recipients=[],this._plaintext=t}addRecipient(t,c){let u=new A_(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 m1.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,q=await new Vf.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(h.unprotectedHeader).encrypt(h.key,{...h.options,...t}),_={ciphertext:q.ciphertext,iv:q.iv,recipients:[{}],tag:q.tag};if(q.aad)_.aad=q.aad;if(q.protected)_.protected=q.protected;if(q.unprotected)_.unprotected=q.unprotected;if(q.encrypted_key)_.recipients[0].encrypted_key=q.encrypted_key;if(q.header)_.recipients[0].header=q.header;return _}let n;for(let h=0;h<this._recipients.length;h++){let q=this._recipients[h];if(!(0,sS.default)(this._protectedHeader,this._unprotectedHeader,q.unprotectedHeader))throw new m1.JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let _={...this._protectedHeader,...this._unprotectedHeader,...q.unprotectedHeader},{alg:W}=_;if(typeof W!=="string"||!W)throw new m1.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(W==="dir"||W==="ECDH-ES")throw new m1.JWEInvalid('"dir" and "ECDH-ES" alg may only be used with a single recipient');if(typeof _.enc!=="string"||!_.enc)throw new m1.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(!n)n=_.enc;else if(n!==_.enc)throw new m1.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients');if((0,BS.default)(m1.JWEInvalid,new Map,q.options.crit,this._protectedHeader,_),_.zip!==void 0){if(!this._protectedHeader||!this._protectedHeader.zip)throw new m1.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected')}}let f=(0,LS.default)(n),d={ciphertext:"",iv:"",recipients:[],tag:""};for(let h=0;h<this._recipients.length;h++){let q=this._recipients[h],_={};d.recipients.push(_);let J={...this._protectedHeader,...this._unprotectedHeader,...q.unprotectedHeader}.alg.startsWith("PBES2")?2048+h:void 0;if(h===0){let P=await new Vf.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(f).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(q.unprotectedHeader).setKeyManagementParameters({p2c:J}).encrypt(q.key,{...q.options,...t,[Vf.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(_.encrypted_key=P.encrypted_key,P.header)_.header=P.header;continue}let{encryptedKey:$,parameters:w}=await(0,gS.default)(((c=q.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,q.key,f,{p2c:J});if(_.encrypted_key=(0,mS.encode)($),q.unprotectedHeader||w)_.header={...q.unprotectedHeader,...w}}return d}}xu.GeneralEncrypt=y_});var ef=K((Mf)=>{Object.defineProperty(Mf,"__esModule",{value:!0});var FS=O();function kS(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 FS.JOSENotSupported(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}Mf.default=kS});var Df=K((Tf)=>{Object.defineProperty(Tf,"__esModule",{value:!0});var H_=require("crypto"),oS=Jc(),US=O(),Nf=$c(),Nt=Sc(),O_={padding:H_.constants.RSA_PKCS1_PSS_PADDING,saltLength:H_.constants.RSA_PSS_SALTLEN_DIGEST},lS=new Map([["ES256","P-256"],["ES256K","secp256k1"],["ES384","P-384"],["ES512","P-521"]]);function QS(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,Nf.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,Nf.default)(c,t),{key:c,...O_};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,Nf.default)(c,t),{key:c,...O_};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,oS.default)(c),r=lS.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 US.JOSENotSupported(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}Tf.default=QS});var C_=K((bf)=>{Object.defineProperty(bf,"__esModule",{value:!0});var aS=O();function tH(t){switch(t){case"HS256":return"sha256";case"HS384":return"sha384";case"HS512":return"sha512";default:throw new aS.JOSENotSupported(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}bf.default=tH});var vf=K((pf)=>{Object.defineProperty(pf,"__esModule",{value:!0});var jf=require("crypto"),cH=h1(),uH=v1(),G_=q1(),Z_=_1();function rH(t,c,u){if(c instanceof Uint8Array){if(!t.startsWith("HS"))throw TypeError((0,G_.default)(c,...Z_.types));return(0,jf.createSecretKey)(c)}if(c instanceof jf.KeyObject)return c;if((0,cH.isCryptoKey)(c))return(0,uH.checkSigCryptoKey)(c,t,u),jf.KeyObject.from(c);throw TypeError((0,G_.default)(c,...Z_.types,"Uint8Array"))}pf.default=rH});var sf=K((Lf)=>{Object.defineProperty(Lf,"__esModule",{value:!0});var Lu=require("crypto"),nH=require("util"),fH=ef(),dH=C_(),hH=Df(),qH=vf(),xf;if(Lu.sign.length>3)xf=(0,nH.promisify)(Lu.sign);else xf=Lu.sign;var _H=async(t,c,u)=>{let r=(0,qH.default)(t,c,"sign");if(t.startsWith("HS")){let n=Lu.createHmac((0,dH.default)(t),r);return n.update(u),n.digest()}return xf((0,fH.default)(t),u,(0,hH.default)(t,r))};Lf.default=_H});var I_=K((mf)=>{Object.defineProperty(mf,"__esModule",{value:!0});var su=require("crypto"),KH=require("util"),WH=ef(),JH=Df(),wH=sf(),$H=vf(),PH=Sc(),gf;if(su.verify.length>4&&PH.oneShotCallback)gf=(0,KH.promisify)(su.verify);else gf=su.verify;var AH=async(t,c,u,r)=>{let n=(0,$H.default)(t,c,"verify");if(t.startsWith("HS")){let h=await(0,wH.default)(t,n,r),q=u;try{return su.timingSafeEqual(q,h)}catch{return!1}}let f=(0,WH.default)(t),d=(0,JH.default)(t,n);try{return await gf(f,r,d,u)}catch{return!1}};mf.default=AH});var mu=K((gu)=>{Object.defineProperty(gu,"__esModule",{value:!0});gu.flattenedVerify=void 0;var Bf=F(),yH=I_(),g=O(),Tt=M(),SH=It(),i_=l(),HH=Oc(),OH=zt(),CH=Of();async function GH(t,c,u){var r;if(!(0,i_.default)(t))throw new g.JWSInvalid("Flattened JWS must be an object");if(t.protected===void 0&&t.header===void 0)throw new g.JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');if(t.protected!==void 0&&typeof t.protected!=="string")throw new g.JWSInvalid("JWS Protected Header incorrect type");if(t.payload===void 0)throw new g.JWSInvalid("JWS Payload missing");if(typeof t.signature!=="string")throw new g.JWSInvalid("JWS Signature missing or incorrect type");if(t.header!==void 0&&!(0,i_.default)(t.header))throw new g.JWSInvalid("JWS Unprotected Header incorrect type");let n={};if(t.protected)try{let G=(0,Bf.decode)(t.protected);n=JSON.parse(Tt.decoder.decode(G))}catch{throw new g.JWSInvalid("JWS Protected Header is invalid")}if(!(0,SH.default)(n,t.header))throw new g.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let f={...n,...t.header},d=(0,OH.default)(g.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 g.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean')}let{alg:q}=f;if(typeof q!=="string"||!q)throw new g.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');let _=u&&(0,CH.default)("algorithms",u.algorithms);if(_&&!_.has(q))throw new g.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(h){if(typeof t.payload!=="string")throw new g.JWSInvalid("JWS Payload must be a string")}else if(typeof t.payload!=="string"&&!(t.payload instanceof Uint8Array))throw new g.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,HH.default)(q,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,Bf.decode)(t.signature)}catch{throw new g.JWSInvalid("Failed to base64url decode the signature")}if(!await(0,yH.default)(q,c,$,J))throw new g.JWSSignatureVerificationFailed;let P;if(h)try{P=(0,Bf.decode)(t.payload)}catch{throw new g.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}gu.flattenedVerify=GH});var Ff=K((Bu)=>{Object.defineProperty(Bu,"__esModule",{value:!0});Bu.compactVerify=void 0;var ZH=mu(),X_=O(),IH=M();async function iH(t,c,u){if(t instanceof Uint8Array)t=IH.decoder.decode(t);if(typeof t!=="string")throw new X_.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 X_.JWSInvalid("Invalid Compact JWS");let h=await(0,ZH.flattenedVerify)({payload:n,protected:r,signature:f},c,u),q={payload:h.payload,protectedHeader:h.protectedHeader};if(typeof c==="function")return{...q,key:h.key};return q}Bu.compactVerify=iH});var Y_=K((Fu)=>{Object.defineProperty(Fu,"__esModule",{value:!0});Fu.generalVerify=void 0;var XH=mu(),kf=O(),E_=l();async function EH(t,c,u){if(!(0,E_.default)(t))throw new kf.JWSInvalid("General JWS must be an object");if(!Array.isArray(t.signatures)||!t.signatures.every(E_.default))throw new kf.JWSInvalid("JWS Signatures missing or incorrect type");for(let r of t.signatures)try{return await(0,XH.flattenedVerify)({header:r.header,payload:t.payload,protected:r.protected,signature:r.signature},c,u)}catch{}throw new kf.JWSSignatureVerificationFailed}Fu.generalVerify=EH});var Uf=K((of)=>{Object.defineProperty(of,"__esModule",{value:!0});of.default=(t)=>Math.floor(t.getTime()/1000)});var af=K((Qf)=>{Object.defineProperty(Qf,"__esModule",{value:!0});var z_=60,R_=z_*60,lf=R_*24,YH=lf*7,zH=lf*365.25,RH=/^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i;Qf.default=(t)=>{let c=RH.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*z_);case"hour":case"hours":case"hr":case"hrs":case"h":return Math.round(u*R_);case"day":case"days":case"d":return Math.round(u*lf);case"week":case"weeks":case"w":return Math.round(u*YH);default:return Math.round(u*zH)}}});var ku=K((td)=>{Object.defineProperty(td,"__esModule",{value:!0});var t1=O(),VH=M(),MH=Uf(),V_=af(),eH=l(),M_=(t)=>t.toLowerCase().replace(/^application\//,""),NH=(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};td.default=(t,c,u={})=>{let{typ:r}=u;if(r&&(typeof t.typ!=="string"||M_(t.typ)!==M_(r)))throw new t1.JWTClaimValidationFailed('unexpected "typ" JWT header value',"typ","check_failed");let n;try{n=JSON.parse(VH.decoder.decode(c))}catch{}if(!(0,eH.default)(n))throw new t1.JWTInvalid("JWT Claims Set must be a top-level JSON object");let{requiredClaims:f=[],issuer:d,subject:h,audience:q,maxTokenAge:_}=u;if(_!==void 0)f.push("iat");if(q!==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(q&&!NH(n.aud,typeof q==="string"?[q]:q))throw new t1.JWTClaimValidationFailed('unexpected "aud" claim value',"aud","check_failed");let W;switch(typeof u.clockTolerance){case"string":W=(0,V_.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||_)&&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(_){let w=$-n.iat,P=typeof _==="number"?_:(0,V_.default)(_);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 e_=K((ou)=>{Object.defineProperty(ou,"__esModule",{value:!0});ou.jwtVerify=void 0;var TH=Ff(),DH=ku(),bH=O();async function jH(t,c,u){var r;let n=await(0,TH.compactVerify)(t,c,u);if(((r=n.protectedHeader.crit)===null||r===void 0?void 0:r.includes("b64"))&&n.protectedHeader.b64===!1)throw new bH.JWTInvalid("JWTs MUST NOT use unencoded payload");let d={payload:(0,DH.default)(n.protectedHeader,n.payload,u),protectedHeader:n.protectedHeader};if(typeof c==="function")return{...d,key:n.key};return d}ou.jwtVerify=jH});var N_=K((Uu)=>{Object.defineProperty(Uu,"__esModule",{value:!0});Uu.jwtDecrypt=void 0;var pH=Gf(),vH=ku(),cd=O();async function xH(t,c,u){let r=await(0,pH.compactDecrypt)(t,c,u),n=(0,vH.default)(r.protectedHeader,r.plaintext,u),{protectedHeader:f}=r;if(f.iss!==void 0&&f.iss!==n.iss)throw new cd.JWTClaimValidationFailed('replicated "iss" claim header parameter mismatch',"iss","mismatch");if(f.sub!==void 0&&f.sub!==n.sub)throw new cd.JWTClaimValidationFailed('replicated "sub" claim header parameter mismatch',"sub","mismatch");if(f.aud!==void 0&&JSON.stringify(f.aud)!==JSON.stringify(n.aud))throw new cd.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}Uu.jwtDecrypt=xH});var ud=K((lu)=>{Object.defineProperty(lu,"__esModule",{value:!0});lu.CompactEncrypt=void 0;var LH=vu();class T_{constructor(t){this._flattened=new LH.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(".")}}lu.CompactEncrypt=T_});var au=K((Qu)=>{Object.defineProperty(Qu,"__esModule",{value:!0});Qu.FlattenedSign=void 0;var rd=F(),sH=sf(),gH=It(),Zc=O(),ut=M(),mH=Oc(),BH=zt();class D_{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 Zc.JWSInvalid("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!(0,gH.default)(this._protectedHeader,this._unprotectedHeader))throw new Zc.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let u={...this._protectedHeader,...this._unprotectedHeader},r=(0,BH.default)(Zc.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 Zc.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean')}let{alg:f}=u;if(typeof f!=="string"||!f)throw new Zc.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');(0,mH.default)(f,t,"sign");let d=this._payload;if(n)d=ut.encoder.encode((0,rd.encode)(d));let h;if(this._protectedHeader)h=ut.encoder.encode((0,rd.encode)(JSON.stringify(this._protectedHeader)));else h=ut.encoder.encode("");let q=(0,ut.concat)(h,ut.encoder.encode("."),d),_=await(0,sH.default)(f,t,q),W={signature:(0,rd.encode)(_),payload:""};if(n)W.payload=ut.decoder.decode(d);if(this._unprotectedHeader)W.header=this._unprotectedHeader;if(this._protectedHeader)W.protected=ut.decoder.decode(h);return W}}Qu.FlattenedSign=D_});var nd=K((tr)=>{Object.defineProperty(tr,"__esModule",{value:!0});tr.CompactSign=void 0;var FH=au();class b_{constructor(t){this._flattened=new FH.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}`}}tr.CompactSign=b_});var x_=K((cr)=>{Object.defineProperty(cr,"__esModule",{value:!0});cr.GeneralSign=void 0;var kH=au(),j_=O();class p_{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 v_{constructor(t){this._signatures=[],this._payload=t}addSignature(t,c){let u=new p_(this,t,c);return this._signatures.push(u),u}async sign(){if(!this._signatures.length)throw new j_.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 kH.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 j_.JWSInvalid("inconsistent use of JWS Unencoded Payload (RFC7797)");t.signatures.push(f)}return t}}cr.GeneralSign=v_});var rr=K((ur)=>{Object.defineProperty(ur,"__esModule",{value:!0});ur.ProduceJWT=void 0;var fd=Uf(),oH=l(),L_=af();class s_{constructor(t){if(!(0,oH.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,fd.default)(new Date)+(0,L_.default)(t)};return this}setExpirationTime(t){if(typeof t==="number")this._payload={...this._payload,exp:t};else this._payload={...this._payload,exp:(0,fd.default)(new Date)+(0,L_.default)(t)};return this}setIssuedAt(t){if(typeof t>"u")this._payload={...this._payload,iat:(0,fd.default)(new Date)};else this._payload={...this._payload,iat:t};return this}}ur.ProduceJWT=s_});var m_=K((nr)=>{Object.defineProperty(nr,"__esModule",{value:!0});nr.SignJWT=void 0;var UH=nd(),lH=O(),QH=M(),aH=rr();class g_ extends aH.ProduceJWT{setProtectedHeader(t){return this._protectedHeader=t,this}async sign(t,c){var u;let r=new UH.CompactSign(QH.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 lH.JWTInvalid("JWTs MUST NOT use unencoded payload");return r.sign(t,c)}}nr.SignJWT=g_});var F_=K((fr)=>{Object.defineProperty(fr,"__esModule",{value:!0});fr.EncryptJWT=void 0;var tO=ud(),cO=M(),uO=rr();class B_ extends uO.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 tO.CompactEncrypt(cO.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)}}fr.EncryptJWT=B_});var U_=K((Dt)=>{Object.defineProperty(Dt,"__esModule",{value:!0});Dt.calculateJwkThumbprintUri=Dt.calculateJwkThumbprint=void 0;var rO=Vn(),nO=F(),k_=O(),fO=M(),dO=l(),B1=(t,c)=>{if(typeof t!=="string"||!t)throw new k_.JWKInvalid(`${c} missing or invalid`)};async function o_(t,c){if(!(0,dO.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":B1(t.crv,'"crv" (Curve) Parameter'),B1(t.x,'"x" (X Coordinate) Parameter'),B1(t.y,'"y" (Y Coordinate) Parameter'),u={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":B1(t.crv,'"crv" (Subtype of Key Pair) Parameter'),B1(t.x,'"x" (Public Key) Parameter'),u={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":B1(t.e,'"e" (Exponent) Parameter'),B1(t.n,'"n" (Modulus) Parameter'),u={e:t.e,kty:t.kty,n:t.n};break;case"oct":B1(t.k,'"k" (Key Value) Parameter'),u={k:t.k,kty:t.kty};break;default:throw new k_.JOSENotSupported('"kty" (Key Type) Parameter missing or unsupported')}let r=fO.encoder.encode(JSON.stringify(u));return(0,nO.encode)(await(0,rO.default)(c,r))}Dt.calculateJwkThumbprint=o_;async function hO(t,c){c!==null&&c!==void 0||(c="sha256");let u=await o_(t,c);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${c.slice(-3)}:${u}`}Dt.calculateJwkThumbprintUri=hO});var Q_=K((dr)=>{Object.defineProperty(dr,"__esModule",{value:!0});dr.EmbeddedJWK=void 0;var qO=Hc(),_O=l(),l_=O();async function KO(t,c){let u={...t,...c===null||c===void 0?void 0:c.header};if(!(0,_O.default)(u.jwk))throw new l_.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object');let r=await(0,qO.importJWK)({...u.jwk,ext:!0},u.alg,!0);if(r instanceof Uint8Array||r.type!=="public")throw new l_.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key');return r}dr.EmbeddedJWK=KO});var hd=K((F1)=>{Object.defineProperty(F1,"__esModule",{value:!0});F1.createLocalJWKSet=F1.LocalJWKSet=F1.isJWKSLike=void 0;var WO=Hc(),Ic=O(),JO=l();function wO(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 Ic.JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set')}}function t8(t){return t&&typeof t==="object"&&Array.isArray(t.keys)&&t.keys.every($O)}F1.isJWKSLike=t8;function $O(t){return(0,JO.default)(t)}function PO(t){if(typeof structuredClone==="function")return structuredClone(t);return JSON.parse(JSON.stringify(t))}class dd{constructor(t){if(this._cached=new WeakMap,!t8(t))throw new Ic.JWKSInvalid("JSON Web Key Set malformed");this._jwks=PO(t)}async getKey(t,c){let{alg:u,kid:r}={...t,...c===null||c===void 0?void 0:c.header},n=wO(u),f=this._jwks.keys.filter((q)=>{let _=n===q.kty;if(_&&typeof r==="string")_=r===q.kid;if(_&&typeof q.alg==="string")_=u===q.alg;if(_&&typeof q.use==="string")_=q.use==="sig";if(_&&Array.isArray(q.key_ops))_=q.key_ops.includes("verify");if(_&&u==="EdDSA")_=q.crv==="Ed25519"||q.crv==="Ed448";if(_)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 _}),{0:d,length:h}=f;if(h===0)throw new Ic.JWKSNoMatchingKey;else if(h!==1){let q=new Ic.JWKSMultipleMatchingKeys,{_cached:_}=this;throw q[Symbol.asyncIterator]=async function*(){for(let W of f)try{yield await a_(_,W,u)}catch{continue}},q}return a_(this._cached,d,u)}}F1.LocalJWKSet=dd;async function a_(t,c,u){let r=t.get(c)||t.set(c,{}).get(c);if(r[u]===void 0){let n=await(0,WO.importJWK)({...c,ext:!0},u);if(n instanceof Uint8Array||n.type!=="public")throw new Ic.JWKSInvalid("JSON Web Key Set members must be public keys");r[u]=n}return r[u]}function AO(t){let c=new dd(t);return async function(u,r){return c.getKey(u,r)}}F1.createLocalJWKSet=AO});var r8=K((_d)=>{Object.defineProperty(_d,"__esModule",{value:!0});var yO=require("http"),SO=require("https"),c8=require("events"),qd=O(),u8=M(),HO=async(t,c,u)=>{let r;switch(t.protocol){case"https:":r=SO.get;break;case"http:":r=yO.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,c8.once)(d,"response"),(0,c8.once)(d,"timeout")]);if(!h)throw d.destroy(),new qd.JWKSTimeout;if(h.statusCode!==200)throw new qd.JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");let q=[];for await(let _ of h)q.push(_);try{return JSON.parse(u8.decoder.decode((0,u8.concat)(...q)))}catch{throw new qd.JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON")}};_d.default=HO});var h8=K((hr)=>{Object.defineProperty(hr,"__esModule",{value:!0});hr.createRemoteJWKSet=void 0;var OO=r8(),n8=O(),f8=hd();function CO(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}class d8 extends f8.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 n8.JWKSNoMatchingKey){if(this.coolingDown()===!1)return await this.reload(),super.getKey(t,c)}throw u}}async reload(){if(this._pendingFetch&&CO())this._pendingFetch=void 0;this._pendingFetch||(this._pendingFetch=(0,OO.default)(this._url,this._timeoutDuration,this._options).then((t)=>{if(!(0,f8.isJWKSLike)(t))throw new n8.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 GO(t,c){let u=new d8(t,c);return async function(r,n){return u.getKey(r,n)}}hr.createRemoteJWKSet=GO});var _8=K((_r)=>{Object.defineProperty(_r,"__esModule",{value:!0});_r.UnsecuredJWT=void 0;var qr=F(),ZO=M(),Kd=O(),IO=ku(),iO=rr();class q8 extends iO.ProduceJWT{encode(){let t=qr.encode(JSON.stringify({alg:"none"})),c=qr.encode(JSON.stringify(this._payload));return`${t}.${c}.`}static decode(t,c){if(typeof t!=="string")throw new Kd.JWTInvalid("Unsecured JWT must be a string");let{0:u,1:r,2:n,length:f}=t.split(".");if(f!==3||n!=="")throw new Kd.JWTInvalid("Invalid Unsecured JWT");let d;try{if(d=JSON.parse(ZO.decoder.decode(qr.decode(u))),d.alg!=="none")throw Error()}catch{throw new Kd.JWTInvalid("Invalid Unsecured JWT")}return{payload:(0,IO.default)(d,qr.decode(r),c),header:d}}}_r.UnsecuredJWT=q8});var Kr=K((bt)=>{Object.defineProperty(bt,"__esModule",{value:!0});bt.decode=bt.encode=void 0;var K8=F();bt.encode=K8.encode;bt.decode=K8.decode});var W8=K((Wr)=>{Object.defineProperty(Wr,"__esModule",{value:!0});Wr.decodeProtectedHeader=void 0;var XO=Kr(),EO=M(),YO=l();function zO(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(EO.decoder.decode((0,XO.decode)(c)));if(!(0,YO.default)(u))throw Error();return u}catch{throw TypeError("Invalid Token or Protected Header formatting")}}Wr.decodeProtectedHeader=zO});var J8=K((Jr)=>{Object.defineProperty(Jr,"__esModule",{value:!0});Jr.decodeJwt=void 0;var RO=Kr(),VO=M(),MO=l(),rt=O();function eO(t){if(typeof t!=="string")throw new rt.JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");let{1:c,length:u}=t.split(".");if(u===5)throw new rt.JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");if(u!==3)throw new rt.JWTInvalid("Invalid JWT");if(!c)throw new rt.JWTInvalid("JWTs must contain a payload");let r;try{r=(0,RO.decode)(c)}catch{throw new rt.JWTInvalid("Failed to base64url decode the payload")}let n;try{n=JSON.parse(VO.decoder.decode(r))}catch{throw new rt.JWTInvalid("Failed to parse the decoded payload as JSON")}if(!(0,MO.default)(n))throw new rt.JWTInvalid("Invalid JWT Claims Set");return n}Jr.decodeJwt=eO});var Wd=K((jt)=>{Object.defineProperty(jt,"__esModule",{value:!0});jt.generateKeyPair=jt.generateSecret=void 0;var $8=require("crypto"),NO=require("util"),TO=hc(),w8=$c(),ic=O(),X1=(0,NO.promisify)($8.generateKeyPair);async function DO(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 ic.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return(0,$8.createSecretKey)((0,TO.default)(new Uint8Array(u>>3)))}jt.generateSecret=DO;async function bO(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 ic.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,w8.setModulusLength)(d.privateKey,f),(0,w8.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 ic.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 ic.JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}default:throw new ic.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}}jt.generateKeyPair=bO});var P8=K((wr)=>{Object.defineProperty(wr,"__esModule",{value:!0});wr.generateKeyPair=void 0;var jO=Wd();async function pO(t,c){return(0,jO.generateKeyPair)(t,c)}wr.generateKeyPair=pO});var A8=K(($r)=>{Object.defineProperty($r,"__esModule",{value:!0});$r.generateSecret=void 0;var vO=Wd();async function xO(t,c){return(0,vO.generateSecret)(t,c)}$r.generateSecret=xO});var y8=K((Jd)=>{Object.defineProperty(Jd,"__esModule",{value:!0});Jd.default="node:crypto"});var S8=K((wd)=>{Object.defineProperty(wd,"__esModule",{value:!0});var LO=y8();wd.default=LO.default});var Pd=K((y)=>{Object.defineProperty(y,"__esModule",{value:!0});y.cryptoRuntime=y.base64url=y.generateSecret=y.generateKeyPair=y.errors=y.decodeJwt=y.decodeProtectedHeader=y.importJWK=y.importX509=y.importPKCS8=y.importSPKI=y.exportJWK=y.exportSPKI=y.exportPKCS8=y.UnsecuredJWT=y.createRemoteJWKSet=y.createLocalJWKSet=y.EmbeddedJWK=y.calculateJwkThumbprintUri=y.calculateJwkThumbprint=y.EncryptJWT=y.SignJWT=y.GeneralSign=y.FlattenedSign=y.CompactSign=y.FlattenedEncrypt=y.CompactEncrypt=y.jwtDecrypt=y.jwtVerify=y.generalVerify=y.flattenedVerify=y.compactVerify=y.GeneralEncrypt=y.generalDecrypt=y.flattenedDecrypt=y.compactDecrypt=void 0;var sO=Gf();Object.defineProperty(y,"compactDecrypt",{enumerable:!0,get:function(){return sO.compactDecrypt}});var gO=eu();Object.defineProperty(y,"flattenedDecrypt",{enumerable:!0,get:function(){return gO.flattenedDecrypt}});var mO=h_();Object.defineProperty(y,"generalDecrypt",{enumerable:!0,get:function(){return mO.generalDecrypt}});var BO=S_();Object.defineProperty(y,"GeneralEncrypt",{enumerable:!0,get:function(){return BO.GeneralEncrypt}});var FO=Ff();Object.defineProperty(y,"compactVerify",{enumerable:!0,get:function(){return FO.compactVerify}});var kO=mu();Object.defineProperty(y,"flattenedVerify",{enumerable:!0,get:function(){return kO.flattenedVerify}});var oO=Y_();Object.defineProperty(y,"generalVerify",{enumerable:!0,get:function(){return oO.generalVerify}});var UO=e_();Object.defineProperty(y,"jwtVerify",{enumerable:!0,get:function(){return UO.jwtVerify}});var lO=N_();Object.defineProperty(y,"jwtDecrypt",{enumerable:!0,get:function(){return lO.jwtDecrypt}});var QO=ud();Object.defineProperty(y,"CompactEncrypt",{enumerable:!0,get:function(){return QO.CompactEncrypt}});var aO=vu();Object.defineProperty(y,"FlattenedEncrypt",{enumerable:!0,get:function(){return aO.FlattenedEncrypt}});var tC=nd();Object.defineProperty(y,"CompactSign",{enumerable:!0,get:function(){return tC.CompactSign}});var cC=au();Object.defineProperty(y,"FlattenedSign",{enumerable:!0,get:function(){return cC.FlattenedSign}});var uC=x_();Object.defineProperty(y,"GeneralSign",{enumerable:!0,get:function(){return uC.GeneralSign}});var rC=m_();Object.defineProperty(y,"SignJWT",{enumerable:!0,get:function(){return rC.SignJWT}});var nC=F_();Object.defineProperty(y,"EncryptJWT",{enumerable:!0,get:function(){return nC.EncryptJWT}});var H8=U_();Object.defineProperty(y,"calculateJwkThumbprint",{enumerable:!0,get:function(){return H8.calculateJwkThumbprint}});Object.defineProperty(y,"calculateJwkThumbprintUri",{enumerable:!0,get:function(){return H8.calculateJwkThumbprintUri}});var fC=Q_();Object.defineProperty(y,"EmbeddedJWK",{enumerable:!0,get:function(){return fC.EmbeddedJWK}});var dC=hd();Object.defineProperty(y,"createLocalJWKSet",{enumerable:!0,get:function(){return dC.createLocalJWKSet}});var hC=h8();Object.defineProperty(y,"createRemoteJWKSet",{enumerable:!0,get:function(){return hC.createRemoteJWKSet}});var qC=_8();Object.defineProperty(y,"UnsecuredJWT",{enumerable:!0,get:function(){return qC.UnsecuredJWT}});var $d=Ef();Object.defineProperty(y,"exportPKCS8",{enumerable:!0,get:function(){return $d.exportPKCS8}});Object.defineProperty(y,"exportSPKI",{enumerable:!0,get:function(){return $d.exportSPKI}});Object.defineProperty(y,"exportJWK",{enumerable:!0,get:function(){return $d.exportJWK}});var Pr=Hc();Object.defineProperty(y,"importSPKI",{enumerable:!0,get:function(){return Pr.importSPKI}});Object.defineProperty(y,"importPKCS8",{enumerable:!0,get:function(){return Pr.importPKCS8}});Object.defineProperty(y,"importX509",{enumerable:!0,get:function(){return Pr.importX509}});Object.defineProperty(y,"importJWK",{enumerable:!0,get:function(){return Pr.importJWK}});var _C=W8();Object.defineProperty(y,"decodeProtectedHeader",{enumerable:!0,get:function(){return _C.decodeProtectedHeader}});var KC=J8();Object.defineProperty(y,"decodeJwt",{enumerable:!0,get:function(){return KC.decodeJwt}});y.errors=O();var WC=P8();Object.defineProperty(y,"generateKeyPair",{enumerable:!0,get:function(){return WC.generateKeyPair}});var JC=A8();Object.defineProperty(y,"generateSecret",{enumerable:!0,get:function(){return JC.generateSecret}});y.base64url=Kr();var wC=S8();Object.defineProperty(y,"cryptoRuntime",{enumerable:!0,get:function(){return wC.default}})});var yr=K((KE,O8)=>{function Ar(t){Error.call(this,t),Error.captureStackTrace(this,this.constructor),this.name="JwksError",this.message=t}Ar.prototype=Object.create(Error.prototype);Ar.prototype.constructor=Ar;O8.exports=Ar});var Ad=K((WE,G8)=>{var C8=Pd(),$C=yr();function PC(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 $C("Unsupported JWK")}async function AC(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 C8.importJWK({...u,ext:!0},PC(u));if(r.type!=="public")continue;let n;switch(r[Symbol.toStringTag]){case"CryptoKey":{let f=await C8.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}G8.exports={retrieveSigningKeys:AC}});var yd=K((JE,Z8)=>{function Sr(t){Error.call(this,t),Error.captureStackTrace(this,this.constructor),this.name="ArgumentError",this.message=t}Sr.prototype=Object.create(Error.prototype);Sr.prototype.constructor=Sr;Z8.exports=Sr});var i8=K((wE,I8)=>{var yC=require("http"),SC=require("https"),HC=yd();I8.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 HC("Invalid JWKS URI: The provided URI is not a valid URL.")}let{hostname:n,port:f,protocol:d,pathname:h,search:q}=r,_=h+q,W={hostname:n,path:_,port:f,method:"GET",...t.headers&&{headers:{...t.headers}},...t.timeout&&{timeout:t.timeout},...t.agent&&{agent:t.agent}},$=(d==="https:"?SC:yC).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 E8=K(($E,X8)=>{X8.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let c=this.head;c;c=c.next)yield c.value}}});var z8=K((PE,Y8)=>{Y8.exports=E;E.Node=nt;E.create=E;function E(t){var c=this;if(!(c instanceof E))c=new E;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}E.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};E.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++};E.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++};E.prototype.push=function(){for(var t=0,c=arguments.length;t<c;t++)CC(this,arguments[t]);return this.length};E.prototype.unshift=function(){for(var t=0,c=arguments.length;t<c;t++)GC(this,arguments[t]);return this.length};E.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};E.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};E.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};E.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};E.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};E.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};E.prototype.map=function(t,c){c=c||this;var u=new E;for(var r=this.head;r!==null;)u.push(t.call(c,r.value,this)),r=r.next;return u};E.prototype.mapReverse=function(t,c){c=c||this;var u=new E;for(var r=this.tail;r!==null;)u.push(t.call(c,r.value,this)),r=r.prev;return u};E.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};E.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};E.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};E.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};E.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 E;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};E.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 E;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};E.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=OC(this,n,u[r]);return f};E.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 OC(t,c,u){var r=c===t.head?new nt(u,null,c,t):new nt(u,c,c.next,t);if(r.next===null)t.tail=r;if(r.prev===null)t.head=r;return t.length++,r}function CC(t,c){if(t.tail=new nt(c,t.tail,null,t),!t.head)t.head=t.tail;t.length++}function GC(t,c){if(t.head=new nt(c,null,t.head,t),!t.tail)t.tail=t.head;t.length++}function nt(t,c,u,r){if(!(this instanceof nt))return new nt(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{E8()(E)}catch(t){}});var Od=K((AE,T8)=>{var ZC=z8(),ft=Symbol("max"),V1=Symbol("length"),pt=Symbol("lengthCalculator"),Ec=Symbol("allowStale"),dt=Symbol("maxAge"),R1=Symbol("dispose"),R8=Symbol("noDisposeOnSet"),v=Symbol("lruList"),H1=Symbol("cache"),M8=Symbol("updateAgeOnGet"),Sd=()=>1;class e8{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[ft]=t.max||1/0,u=t.length||Sd;if(this[pt]=typeof u!=="function"?Sd:u,this[Ec]=t.stale||!1,t.maxAge&&typeof t.maxAge!=="number")throw TypeError("maxAge must be a number");this[dt]=t.maxAge||0,this[R1]=t.dispose,this[R8]=t.noDisposeOnSet||!1,this[M8]=t.updateAgeOnGet||!1,this.reset()}set max(t){if(typeof t!=="number"||t<0)throw TypeError("max must be a non-negative number");this[ft]=t||1/0,Xc(this)}get max(){return this[ft]}set allowStale(t){this[Ec]=!!t}get allowStale(){return this[Ec]}set maxAge(t){if(typeof t!=="number")throw TypeError("maxAge must be a non-negative number");this[dt]=t,Xc(this)}get maxAge(){return this[dt]}set lengthCalculator(t){if(typeof t!=="function")t=Sd;if(t!==this[pt])this[pt]=t,this[V1]=0,this[v].forEach((c)=>{c.length=this[pt](c.value,c.key),this[V1]+=c.length});Xc(this)}get lengthCalculator(){return this[pt]}get length(){return this[V1]}get itemCount(){return this[v].length}rforEach(t,c){c=c||this;for(let u=this[v].tail;u!==null;){let r=u.prev;V8(this,t,u,c),u=r}}forEach(t,c){c=c||this;for(let u=this[v].head;u!==null;){let r=u.next;V8(this,t,u,c),u=r}}keys(){return this[v].toArray().map((t)=>t.key)}values(){return this[v].toArray().map((t)=>t.value)}reset(){if(this[R1]&&this[v]&&this[v].length)this[v].forEach((t)=>this[R1](t.key,t.value));this[H1]=new Map,this[v]=new ZC,this[V1]=0}dump(){return this[v].map((t)=>Hr(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter((t)=>t)}dumpLru(){return this[v]}set(t,c,u){if(u=u||this[dt],u&&typeof u!=="number")throw TypeError("maxAge must be a number");let r=u?Date.now():0,n=this[pt](c,t);if(this[H1].has(t)){if(n>this[ft])return vt(this,this[H1].get(t)),!1;let h=this[H1].get(t).value;if(this[R1]){if(!this[R8])this[R1](t,h.value)}return h.now=r,h.maxAge=u,h.value=c,this[V1]+=n-h.length,h.length=n,this.get(t),Xc(this),!0}let f=new N8(t,c,n,r,u);if(f.length>this[ft]){if(this[R1])this[R1](t,c);return!1}return this[V1]+=f.length,this[v].unshift(f),this[H1].set(t,this[v].head),Xc(this),!0}has(t){if(!this[H1].has(t))return!1;let c=this[H1].get(t).value;return!Hr(this,c)}get(t){return Hd(this,t,!0)}peek(t){return Hd(this,t,!1)}pop(){let t=this[v].tail;if(!t)return null;return vt(this,t),t.value}del(t){vt(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)=>Hd(this,c,!1))}}var Hd=(t,c,u)=>{let r=t[H1].get(c);if(r){let n=r.value;if(Hr(t,n)){if(vt(t,r),!t[Ec])return}else if(u){if(t[M8])r.value.now=Date.now();t[v].unshiftNode(r)}return n.value}},Hr=(t,c)=>{if(!c||!c.maxAge&&!t[dt])return!1;let u=Date.now()-c.now;return c.maxAge?u>c.maxAge:t[dt]&&u>t[dt]},Xc=(t)=>{if(t[V1]>t[ft])for(let c=t[v].tail;t[V1]>t[ft]&&c!==null;){let u=c.prev;vt(t,c),c=u}},vt=(t,c)=>{if(c){let u=c.value;if(t[R1])t[R1](u.key,u.value);t[V1]-=u.length,t[H1].delete(u.key),t[v].removeNode(c)}};class N8{constructor(t,c,u,r,n){this.key=t,this.value=c,this.length=u,this.now=r,this.maxAge=n||0}}var V8=(t,c,u,r)=>{let n=u.value;if(Hr(t,n)){if(vt(t,u),!t[Ec])n=void 0}if(n)c.call(r,n.value,n.key,t)};T8.exports=e8});var Td=K((Yc,xt)=>{var IC=200,F8="__lodash_hash_undefined__",k8=9007199254740991,Yd="[object Arguments]",iC="[object Array]",o8="[object Boolean]",U8="[object Date]",XC="[object Error]",zd="[object Function]",l8="[object GeneratorFunction]",Or="[object Map]",Q8="[object Number]",Rd="[object Object]",D8="[object Promise]",a8="[object RegExp]",Cr="[object Set]",tK="[object String]",cK="[object Symbol]",Gd="[object WeakMap]",uK="[object ArrayBuffer]",Gr="[object DataView]",rK="[object Float32Array]",nK="[object Float64Array]",fK="[object Int8Array]",dK="[object Int16Array]",hK="[object Int32Array]",qK="[object Uint8Array]",_K="[object Uint8ClampedArray]",KK="[object Uint16Array]",WK="[object Uint32Array]",EC=/[\\^$.*+?()[\]{}|]/g,YC=/\w*$/,zC=/^\[object .+?Constructor\]$/,RC=/^(?:0|[1-9]\d*)$/,R={};R[Yd]=R[iC]=R[uK]=R[Gr]=R[o8]=R[U8]=R[rK]=R[nK]=R[fK]=R[dK]=R[hK]=R[Or]=R[Q8]=R[Rd]=R[a8]=R[Cr]=R[tK]=R[cK]=R[qK]=R[_K]=R[KK]=R[WK]=!0;R[XC]=R[zd]=R[Gd]=!1;var VC=typeof global=="object"&&global&&global.Object===Object&&global,MC=typeof self=="object"&&self&&self.Object===Object&&self,M1=VC||MC||Function("return this")(),JK=typeof Yc=="object"&&Yc&&!Yc.nodeType&&Yc,b8=JK&&typeof xt=="object"&&xt&&!xt.nodeType&&xt,eC=b8&&b8.exports===JK;function NC(t,c){return t.set(c[0],c[1]),t}function TC(t,c){return t.add(c),t}function DC(t,c){var u=-1,r=t?t.length:0;while(++u<r)if(c(t[u],u,t)===!1)break;return t}function bC(t,c){var u=-1,r=c.length,n=t.length;while(++u<r)t[n+u]=c[u];return t}function wK(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 jC(t,c){var u=-1,r=Array(t);while(++u<t)r[u]=c(u);return r}function pC(t,c){return t==null?void 0:t[c]}function $K(t){var c=!1;if(t!=null&&typeof t.toString!="function")try{c=!!(t+"")}catch(u){}return c}function j8(t){var c=-1,u=Array(t.size);return t.forEach(function(r,n){u[++c]=[n,r]}),u}function Vd(t,c){return function(u){return t(c(u))}}function p8(t){var c=-1,u=Array(t.size);return t.forEach(function(r){u[++c]=r}),u}var vC=Array.prototype,xC=Function.prototype,Zr=Object.prototype,Cd=M1["__core-js_shared__"],v8=function(){var t=/[^.]+$/.exec(Cd&&Cd.keys&&Cd.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),PK=xC.toString,k1=Zr.hasOwnProperty,Ir=Zr.toString,LC=RegExp("^"+PK.call(k1).replace(EC,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),x8=eC?M1.Buffer:void 0,L8=M1.Symbol,s8=M1.Uint8Array,sC=Vd(Object.getPrototypeOf,Object),gC=Object.create,mC=Zr.propertyIsEnumerable,BC=vC.splice,g8=Object.getOwnPropertySymbols,FC=x8?x8.isBuffer:void 0,kC=Vd(Object.keys,Object),Zd=gt(M1,"DataView"),zc=gt(M1,"Map"),Id=gt(M1,"Promise"),id=gt(M1,"Set"),Xd=gt(M1,"WeakMap"),Rc=gt(Object,"create"),oC=_t(Zd),UC=_t(zc),lC=_t(Id),QC=_t(id),aC=_t(Xd),m8=L8?L8.prototype:void 0,B8=m8?m8.valueOf:void 0;function qt(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 tG(){this.__data__=Rc?Rc(null):{}}function cG(t){return this.has(t)&&delete this.__data__[t]}function uG(t){var c=this.__data__;if(Rc){var u=c[t];return u===F8?void 0:u}return k1.call(c,t)?c[t]:void 0}function rG(t){var c=this.__data__;return Rc?c[t]!==void 0:k1.call(c,t)}function nG(t,c){var u=this.__data__;return u[t]=Rc&&c===void 0?F8:c,this}qt.prototype.clear=tG;qt.prototype.delete=cG;qt.prototype.get=uG;qt.prototype.has=rG;qt.prototype.set=nG;function e1(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 fG(){this.__data__=[]}function dG(t){var c=this.__data__,u=ir(c,t);if(u<0)return!1;var r=c.length-1;if(u==r)c.pop();else BC.call(c,u,1);return!0}function hG(t){var c=this.__data__,u=ir(c,t);return u<0?void 0:c[u][1]}function qG(t){return ir(this.__data__,t)>-1}function _G(t,c){var u=this.__data__,r=ir(u,t);if(r<0)u.push([t,c]);else u[r][1]=c;return this}e1.prototype.clear=fG;e1.prototype.delete=dG;e1.prototype.get=hG;e1.prototype.has=qG;e1.prototype.set=_G;function Lt(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 KG(){this.__data__={hash:new qt,map:new(zc||e1),string:new qt}}function WG(t){return Xr(this,t).delete(t)}function JG(t){return Xr(this,t).get(t)}function wG(t){return Xr(this,t).has(t)}function $G(t,c){return Xr(this,t).set(t,c),this}Lt.prototype.clear=KG;Lt.prototype.delete=WG;Lt.prototype.get=JG;Lt.prototype.has=wG;Lt.prototype.set=$G;function st(t){this.__data__=new e1(t)}function PG(){this.__data__=new e1}function AG(t){return this.__data__.delete(t)}function yG(t){return this.__data__.get(t)}function SG(t){return this.__data__.has(t)}function HG(t,c){var u=this.__data__;if(u instanceof e1){var r=u.__data__;if(!zc||r.length<IC-1)return r.push([t,c]),this;u=this.__data__=new Lt(r)}return u.set(t,c),this}st.prototype.clear=PG;st.prototype.delete=AG;st.prototype.get=yG;st.prototype.has=SG;st.prototype.set=HG;function OG(t,c){var u=ed(t)||gG(t)?jC(t.length,String):[],r=u.length,n=!!r;for(var f in t)if((c||k1.call(t,f))&&!(n&&(f=="length"||vG(f,r))))u.push(f);return u}function AK(t,c,u){var r=t[c];if(!(k1.call(t,c)&&OK(r,u))||u===void 0&&!(c in t))t[c]=u}function ir(t,c){var u=t.length;while(u--)if(OK(t[u][0],c))return u;return-1}function CG(t,c){return t&&yK(c,Nd(c),t)}function Ed(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(!Er(t))return t;var q=ed(t);if(q){if(h=bG(t),!c)return NG(t,h)}else{var _=ht(t),W=_==zd||_==l8;if(BG(t))return EG(t,c);if(_==Rd||_==Yd||W&&!f){if($K(t))return f?t:{};if(h=jG(W?{}:t),!c)return TG(t,CG(h,t))}else{if(!R[_])return f?t:{};h=pG(t,_,Ed,c)}}d||(d=new st);var J=d.get(t);if(J)return J;if(d.set(t,h),!q)var $=u?DG(t):Nd(t);return DC($||t,function(w,P){if($)P=w,w=t[P];AK(h,P,Ed(w,c,u,r,P,t,d))}),h}function GG(t){return Er(t)?gC(t):{}}function ZG(t,c,u){var r=c(t);return ed(t)?r:bC(r,u(t))}function IG(t){return Ir.call(t)}function iG(t){if(!Er(t)||LG(t))return!1;var c=GK(t)||$K(t)?LC:zC;return c.test(_t(t))}function XG(t){if(!HK(t))return kC(t);var c=[];for(var u in Object(t))if(k1.call(t,u)&&u!="constructor")c.push(u);return c}function EG(t,c){if(c)return t.slice();var u=new t.constructor(t.length);return t.copy(u),u}function Md(t){var c=new t.constructor(t.byteLength);return new s8(c).set(new s8(t)),c}function YG(t,c){var u=c?Md(t.buffer):t.buffer;return new t.constructor(u,t.byteOffset,t.byteLength)}function zG(t,c,u){var r=c?u(j8(t),!0):j8(t);return wK(r,NC,new t.constructor)}function RG(t){var c=new t.constructor(t.source,YC.exec(t));return c.lastIndex=t.lastIndex,c}function VG(t,c,u){var r=c?u(p8(t),!0):p8(t);return wK(r,TC,new t.constructor)}function MG(t){return B8?Object(B8.call(t)):{}}function eG(t,c){var u=c?Md(t.buffer):t.buffer;return new t.constructor(u,t.byteOffset,t.length)}function NG(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;AK(u,d,h===void 0?t[d]:h)}return u}function TG(t,c){return yK(t,SK(t),c)}function DG(t){return ZG(t,Nd,SK)}function Xr(t,c){var u=t.__data__;return xG(c)?u[typeof c=="string"?"string":"hash"]:u.map}function gt(t,c){var u=pC(t,c);return iG(u)?u:void 0}var SK=g8?Vd(g8,Object):oG,ht=IG;if(Zd&&ht(new Zd(new ArrayBuffer(1)))!=Gr||zc&&ht(new zc)!=Or||Id&&ht(Id.resolve())!=D8||id&&ht(new id)!=Cr||Xd&&ht(new Xd)!=Gd)ht=function(t){var c=Ir.call(t),u=c==Rd?t.constructor:void 0,r=u?_t(u):void 0;if(r)switch(r){case oC:return Gr;case UC:return Or;case lC:return D8;case QC:return Cr;case aC:return Gd}return c};function bG(t){var c=t.length,u=t.constructor(c);if(c&&typeof t[0]=="string"&&k1.call(t,"index"))u.index=t.index,u.input=t.input;return u}function jG(t){return typeof t.constructor=="function"&&!HK(t)?GG(sC(t)):{}}function pG(t,c,u,r){var n=t.constructor;switch(c){case uK:return Md(t);case o8:case U8:return new n(+t);case Gr:return YG(t,r);case rK:case nK:case fK:case dK:case hK:case qK:case _K:case KK:case WK:return eG(t,r);case Or:return zG(t,r,u);case Q8:case tK:return new n(t);case a8:return RG(t);case Cr:return VG(t,r,u);case cK:return MG(t)}}function vG(t,c){return c=c==null?k8:c,!!c&&(typeof t=="number"||RC.test(t))&&(t>-1&&t%1==0&&t<c)}function xG(t){var c=typeof t;return c=="string"||c=="number"||c=="symbol"||c=="boolean"?t!=="__proto__":t===null}function LG(t){return!!v8&&v8 in t}function HK(t){var c=t&&t.constructor,u=typeof c=="function"&&c.prototype||Zr;return t===u}function _t(t){if(t!=null){try{return PK.call(t)}catch(c){}try{return t+""}catch(c){}}return""}function sG(t){return Ed(t,!0,!0)}function OK(t,c){return t===c||t!==t&&c!==c}function gG(t){return mG(t)&&k1.call(t,"callee")&&(!mC.call(t,"callee")||Ir.call(t)==Yd)}var ed=Array.isArray;function CK(t){return t!=null&&FG(t.length)&&!GK(t)}function mG(t){return kG(t)&&CK(t)}var BG=FC||UG;function GK(t){var c=Er(t)?Ir.call(t):"";return c==zd||c==l8}function FG(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=k8}function Er(t){var c=typeof t;return!!t&&(c=="object"||c=="function")}function kG(t){return!!t&&typeof t=="object"}function Nd(t){return CK(t)?OG(t):XG(t)}function oG(){return[]}function UG(){return!1}xt.exports=sG});var Dd=K((Yr)=>{Object.defineProperty(Yr,"__esModule",{value:!0});Yr.deepFreeze=void 0;function ZK(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]))ZK(t[c])});return t}Yr.deepFreeze=ZK});var EK=K((Y1)=>{var lG=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(lG(arguments[c]));return t},XK=Y1&&Y1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Y1,"__esModule",{value:!0});Y1.syncMemoizer=void 0;var QG=XK(Od()),aG=require("events"),IK=XK(Td()),iK=Dd();function tZ(t){var c=new QG.default(t),u=t.load,r=t.hash,n=t.bypass,f=t.itemMaxAge,d=t.freeze,h=t.clone,q=new aG.EventEmitter,_=Object.assign({del:W,reset:function(){return c.reset()},keys:c.keys.bind(c),on:q.on.bind(q),once:q.once.bind(q)},t);if(t.disable)return Object.assign(u,_);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];q.emit.apply(q,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(IK.default);else G=IK.default(G);if(d)if($(G))G=G.then(iK.deepFreeze);else iK.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)),X=c.get(I);if(X)return J.apply(void 0,E1(["hit"],A)),w(X);J.apply(void 0,E1(["miss"],A));var C=u.apply(void 0,E1(A));if(f)c.set(I,C,f.apply(void 0,E1(A.concat([C]))));else c.set(I,C);return w(C)};return Object.assign(P,_)}Y1.syncMemoizer=tZ});var RK=K((W1)=>{var cZ=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(cZ(arguments[c]));return t},uZ=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.")},YK=W1&&W1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(W1,"__esModule",{value:!0});W1.asyncMemoizer=void 0;var rZ=YK(Od()),nZ=require("events"),fZ=YK(Td()),dZ=Dd(),hZ=EK();function zK(t){var c=new rZ.default(t),u=t.load,r=t.hash,n=t.bypass,f=t.itemMaxAge,d=t.freeze,h=t.clone,q=t.queueMaxAge||1000,_=new Map,W=new nZ.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 X=0;X<arguments.length;X++)I[X]=arguments[X];var C=r.apply(void 0,Q(I));c.del(C)}function w(I,X,C){if(d)C.forEach(dZ.deepFreeze);if(f)c.set(I,C,f.apply(void 0,Q(X.concat(C))));else c.set(I,C)}function P(I,X){var C,D;try{for(var a=uZ(I),c1=a.next();!c1.done;c1=a.next()){var N1=c1.value;if(h)setImmediate.apply(void 0,Q([N1],X.map(fZ.default)));else setImmediate.apply(void 0,Q([N1],X))}}catch(o1){C={error:o1}}finally{try{if(c1&&!c1.done&&(D=a.return))D.call(a)}finally{if(C)throw C.error}}}function A(I){var X=[];for(var C=1;C<arguments.length;C++)X[C-1]=arguments[C];W.emit.apply(W,Q([I],X))}function G(){var I=[];for(var X=0;X<arguments.length;X++)I[X]=arguments[X];var C=I.slice(0,-1),D=I.slice(-1).pop(),a;if(n&&n.apply(void 0,Q(C)))return A.apply(void 0,Q(["miss"],C)),u.apply(void 0,Q(I));if(C.length===0&&!r)a="_";else a=r.apply(void 0,Q(C));var c1=c.get(a);if(c1)return A.apply(void 0,Q(["hit"],C)),P([D],[null].concat(c1));var N1=_.get(a);if(N1&&N1.expiresAt>Date.now()){N1.queue.push(D),A.apply(void 0,Q(["queue"],C));return}A.apply(void 0,Q(["miss"],C));var o1=Date.now(),Mc=[D];_.set(a,{queue:Mc,expiresAt:o1+q});var OW=function(){var ec=[];for(var Nc=0;Nc<arguments.length;Nc++)ec[Nc]=arguments[Nc];var CW=ec[0];if(!CW)w(a,C,ec.slice(1));_.delete(a),A.apply(void 0,Q(["loaded",Date.now()-o1],C)),P(Mc,ec)};u.apply(void 0,Q(C,[OW]))}return Object.assign(G,J)}W1.asyncMemoizer=zK;zK.sync=hZ.syncMemoizer});var MK=K((OE,VK)=>{var qZ=RK();VK.exports=qZ.asyncMemoizer});var NK=K((CE,eK)=>{var _Z=yu()("jwks"),KZ=MK(),{promisify:WZ,callbackify:JZ}=require("util");function wZ(t,{cacheMaxEntries:c=5,cacheMaxAge:u=600000}){return _Z(`Configured caching of signing keys. Max: ${c} / Age: ${u}`),WZ(KZ({hash:(r)=>r,load:JZ(t.getSigningKey.bind(t)),maxAge:u,max:c}))}eK.exports.default=wZ});var bd=K((GE,DK)=>{var TK=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};TK.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)}};DK.exports=TK});var jK=K((ZE,bK)=>{var $Z=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()};bK.exports=$Z});var xK=K((IE,vK)=>{var PZ=bd(),jd=jK(),pK=function(t,c,u){this.tokenBucket=new PZ(t,t,c,null),this.tokenBucket.content=t,this.curIntervalStart=jd(),this.tokensThisInterval=0,this.fireImmediately=u};pK.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=jd();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=jd();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}};vK.exports=pK});var LK=K((pd)=>{pd.RateLimiter=xK();pd.TokenBucket=bd()});var vd=K((XE,sK)=>{function zr(t){Error.call(this,t),Error.captureStackTrace(this,this.constructor),this.name="JwksRateLimitError",this.message=t}zr.prototype=Object.create(Error.prototype);zr.prototype.constructor=zr;sK.exports=zr});var mK=K((EE,gK)=>{var xd=yu()("jwks"),{RateLimiter:AZ}=LK(),yZ=vd();function SZ(t,{jwksRequestsPerMinute:c=10}){let u=t.getSigningKey.bind(t),r=new AZ(c,"minute",!0);return xd(`Configured rate limiting to JWKS endpoint at ${c}/minute`),async(n)=>await new Promise((f,d)=>{r.removeTokens(1,async(h,q)=>{if(h)d(h);if(xd("Requests to the JWKS endpoint available for the next minute:",q),q<0)xd("Too many requests to the JWKS endpoint"),d(new yZ("Too many requests to the JWKS endpoint"));else try{let _=await u(n);f(_)}catch(_){d(_)}})})}gK.exports.default=SZ});var FK=K((YE,BK)=>{var HZ=Ad().retrieveSigningKeys;function OZ(t,{getKeysInterceptor:c}){let u=t.getSigningKey.bind(t);return async(r)=>{let n=await c(),f;if(n&&n.length)f=await HZ(n);if(f&&f.length){let d=f.find((h)=>!r||h.kid===r);if(d)return d}return u(r)}}BK.exports.default=OZ});var oK=K((zE,kK)=>{var{callbackify:CZ}=require("util"),GZ=(t)=>{let c=t.getSigningKey.bind(t);return(u,r)=>{if(r)return CZ(c)(u,r);return c(u)}};kK.exports.default=GZ});var lK=K((RE,UK)=>{UK.exports={request:i8().default,cacheSigningKey:NK().default,rateLimitSigningKey:mK().default,getKeysInterceptor:FK().default,callbackSupport:oK().default}});var Ld=K((VE,QK)=>{function Rr(t){Error.call(this,t),Error.captureStackTrace(this,this.constructor),this.name="SigningKeyNotFoundError",this.message=t}Rr.prototype=Object.create(Error.prototype);Rr.prototype.constructor=Rr;QK.exports=Rr});var mt=K((ME,cW)=>{var Kt=yu()("jwks"),{retrieveSigningKeys:ZZ}=Ad(),{request:IZ,cacheSigningKey:iZ,rateLimitSigningKey:XZ,getKeysInterceptor:EZ,callbackSupport:YZ}=lK(),sd=yr(),aK=Ld();class tW{constructor(t){if(this.options={rateLimit:!1,cache:!0,timeout:30000,...t},this.options.getKeysInterceptor)this.getSigningKey=EZ(this,t);if(this.options.rateLimit)this.getSigningKey=XZ(this,t);if(this.options.cache)this.getSigningKey=iZ(this,t);this.getSigningKey=YZ(this,t)}async getKeys(){Kt(`Fetching keys from '${this.options.jwksUri}'`);try{let t=await IZ({uri:this.options.jwksUri,headers:this.options.requestHeaders,agent:this.options.requestAgent,timeout:this.options.timeout,fetcher:this.options.fetcher});return Kt("Keys:",t.keys),t.keys}catch(t){let{errorMsg:c}=t;throw Kt("Failure:",c||t),c?new sd(c):t}}async getSigningKeys(){let t=await this.getKeys();if(!t||!t.length)throw new sd("The JWKS endpoint did not contain any keys");let c=await ZZ(t);if(!c.length)throw new sd("The JWKS endpoint did not contain any signing keys");return Kt("Signing Keys:",c),c}async getSigningKey(t){Kt(`Fetching signing key for '${t}'`);let c=await this.getSigningKeys(),u=t!==void 0&&t!==null;if(!u&&c.length>1)throw Kt("No KID specified and JWKS endpoint returned more than 1 key"),new aK("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 Kt(`Unable to find a signing key that matches '${t}'`),new aK(`Unable to find a signing key that matches '${t}'`)}}cW.exports={JwksClient:tW}});var Bt=K((eE,uW)=>{uW.exports={ArgumentError:yd(),JwksError:yr(),JwksRateLimitError:vd(),SigningKeyNotFoundError:Ld()}});var Vc=K((NE,rW)=>{var zZ=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES256K","ES384","ES512","EdDSA"];rW.exports=zZ});var nW=K((TE,Vr)=>{var{ArgumentError:RZ}=Bt(),{JwksClient:VZ}=mt(),MZ=Vc(),eZ=(t,c)=>{if(t&&t.name==="SigningKeyNotFoundError")return c(t,null,null);if(t)return c(t,null,null)};Vr.exports.hapiJwt2KeyAsync=(t)=>{let c=Vr.exports.hapiJwt2Key(t);return function(u){return new Promise((r,n)=>{c(u,(d,h)=>{!h||d?n(d):r({key:h})})})}};Vr.exports.hapiJwt2Key=function(t){if(t===null||t===void 0)throw new RZ("An options object must be provided when initializing hapiJwt2Key");let c=new VZ(t),u=t.handleSigningKeyError||eZ;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 dW=K((DE,fW)=>{var{ArgumentError:NZ}=Bt(),{JwksClient:TZ}=mt(),DZ=Vc(),bZ=(t,c)=>{if(t&&t.name==="SigningKeyNotFoundError")return c(null);if(t)return c(t)};fW.exports.expressJwtSecret=function(t){if(t===null||t===void 0)throw new NZ("An options object must be provided when initializing expressJwtSecret");let c=new TZ(t),u=t.handleSigningKeyError||bZ,r=async(n,f)=>{if(!f)return;let d=f.header;if(!d||!DZ.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,q){if(arguments.length===4){r(f,{header:d}).then((_)=>{setImmediate(q,null,_)}).catch((_)=>{setImmediate(q,_)});return}return r(f,arguments[1])}}});var qW=K((bE,hW)=>{var{ArgumentError:jZ}=Bt(),{JwksClient:pZ}=mt(),vZ=Vc();hW.exports.koaJwtSecret=function(t={}){if(!t.jwksUri)throw new jZ("No JWKS provided. Please provide a jwksUri");let c=new pZ(t);return function({alg:r,kid:n}={}){return new Promise((f,d)=>{if(!vZ.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 JW=K((jE,WW)=>{var _W=Pd(),{ArgumentError:KW}=Bt(),{JwksClient:xZ}=mt(),LZ=Vc(),sZ=(t,c)=>{if(t&&t.name==="SigningKeyNotFoundError")return c(null);if(t)return c(t)};WW.exports.passportJwtSecret=function(t){if(t===null||t===void 0)throw new KW("An options object must be provided when initializing passportJwtSecret");if(!t.jwksUri)throw new KW("No JWKS provided. Please provide a jwksUri");let c=new xZ(t),u=t.handleSigningKeyError||sZ;return function(n,f,d){let h;try{h={payload:_W.decodeJwt(f),header:_W.decodeProtectedHeader(f)}}catch(q){h=null}if(!h||!LZ.includes(h.header.alg))return d(null,null);c.getSigningKey(h.header.kid).then((q)=>{d(null,q.publicKey||q.rsaPublicKey)}).catch((q)=>{u(q,(_)=>d(_,null))})}}});var $W=K((pE,J1)=>{var{JwksClient:wW}=mt(),Mr=Bt(),{hapiJwt2Key:gZ,hapiJwt2KeyAsync:mZ}=nW(),{expressJwtSecret:BZ}=dW(),{koaJwtSecret:FZ}=qW(),{passportJwtSecret:kZ}=JW();J1.exports=(t)=>{return new wW(t)};J1.exports.JwksClient=wW;J1.exports.ArgumentError=Mr.ArgumentError;J1.exports.JwksError=Mr.JwksError;J1.exports.JwksRateLimitError=Mr.JwksRateLimitError;J1.exports.SigningKeyNotFoundError=Mr.SigningKeyNotFoundError;J1.exports.expressJwtSecret=BZ;J1.exports.hapiJwt2Key=gZ;J1.exports.hapiJwt2KeyAsync=mZ;J1.exports.koaJwtSecret=FZ;J1.exports.passportJwtSecret=kZ});var aZ={};RW(aZ,{handler:()=>QZ});module.exports=EW(aZ);var ld=`<!DOCTYPE html>
|
|
8
|
+
<html lang="en">
|
|
9
|
+
<head>
|
|
10
|
+
<meta charset="utf-8" />
|
|
11
|
+
<meta
|
|
12
|
+
name="viewport"
|
|
13
|
+
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
|
14
|
+
/>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<h1>\${title}</h1>
|
|
18
|
+
<p>\${message}</p>
|
|
19
|
+
<p>
|
|
20
|
+
\${details} [log region: \${region}]
|
|
21
|
+
</p>
|
|
22
|
+
<p>
|
|
23
|
+
<a href="\${linkHref}">\${linkText}</a>
|
|
24
|
+
</p>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
27
|
+
`;var uh=require("node:fs"),Dc=kt(require("node:path")),rh=require("node:url"),nh=kt(Tr(),1);var Dr;((f)=>{f[f.none=0]="none";f[f.error=10]="error";f[f.warn=20]="warn";f[f.info=30]="info";f[f.debug=40]="debug"})(Dr||={});class br{logLevel;constructor(t){this.logLevel=t}jsonify(t){return t.map((c)=>{if(typeof c==="object")try{return JSON.stringify(c)}catch{return c}return c})}info(...t){if(this.logLevel>=30)console.log(...this.jsonify(t))}warn(...t){if(this.logLevel>=20)console.warn(...this.jsonify(t))}error(...t){if(this.logLevel>=10)console.error(...this.jsonify(t))}debug(...t){if(this.logLevel>=40)console.trace(...this.jsonify(t))}}var vW=rh.fileURLToPath("file:///home/runner/work/cdk-cloudfront-auth/cdk-cloudfront-auth/src/handlers/util/config.ts"),xW=Dc.dirname(vW);function jr(){let c=process.env.LAMBDA_TASK_ROOT||xW,u=Dc.join(c,"config.json");console.log("Loading config from",u);let r=JSON.parse(uh.readFileSync(u,"utf-8")),f=`https://cognito-idp.${/^(\S+?)_\S+$/.exec(r.userPoolId)[1]}.amazonaws.com/${r.userPoolId}`,d=`${f}/.well-known/jwks.json`;return{nonceMaxAge:Number.parseInt(nh.parse(r.cookieSettings.nonce.toLowerCase())["max-age"],10)||86400,...r,tokenIssuer:f,tokenJwksUri:d,logger:new br(Dr[r.logLevel])}}function LW(t){return Object.entries(t).reduce((c,[u,r])=>Object.assign(c,{[u.toLowerCase()]:[{key:u,value:r}]}),{})}function pr(t,c){let u=c?.cookies?{"set-cookie":c.cookies.map((r)=>({key:"set-cookie",value:r}))}:{};return{status:"307",statusDescription:"Temporary Redirect",headers:{location:[{key:"location",value:t}],...u}}}function qI(t){return{body:sW(t),status:t.statusCode??"500",headers:{"content-type":[{key:"Content-Type",value:"text/html; charset=UTF-8"}]}}}function sW(t){let c={...t,region:process.env.AWS_REGION};return ld.replace(/\${([^}]*)}/g,(u,r)=>c[r]||"")}function fh(t,c){if(!c)throw Error("Expected response value");return{...c,headers:{...c.headers??{},...LW(t.httpHeaders)}}}function dh(t){let c;return async(u)=>{if(!c)c=jr();c.logger.debug("Handling event:",u);let r=fh(c,await t(c,u));return c.logger.debug("Returning response:",r),r}}function _I(t){let c;return async(u)=>{if(!c)c=jr();c.logger.debug("Handling event:",u);let r=fh(c,await t(c,u));return c.logger.debug("Returning response:",r),r}}var yW=kt(Tr(),1);var md=kt(D6(),1),PW=kt($W(),1),gd;function oZ(t){return"rsaPublicKey"in t}async function UZ(t,c){if(!gd)gd=PW.default({cache:!0,rateLimit:!0,jwksUri:t});let u=await gd.getSigningKey(c);return oZ(u)?u.rsaPublicKey:u.publicKey}async function vE(t,c,u,r){let n=md.default.decode(t,{complete:!0});if(!n||typeof n==="string")return{validationError:Error("Cannot parse JWT token")};let f=n.header.kid,d=await UZ(c,f);if(d instanceof Error)return{validationError:d};let h={audience:r,issuer:u,ignoreExpiration:!1};return new Promise((q)=>md.default.verify(t,d,h,(_)=>_?q({validationError:_}):q(void 0)))}function AW(t){let u=t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/");return JSON.parse(Buffer.from(u,"base64").toString())}function lZ(t){if(!t.cookie)return{};return t.cookie.reduce((u,r)=>({...u,...yW.parse(r.value)}),{})}function Wt(t,c){if(c.toLowerCase().indexOf("domain")===-1)return`${c}; Domain=.${t}`;return c}function SW(t,c){let u=lZ(t);if(!u)return{};let r=`CognitoIdentityServiceProvider.${c}`,n=u[`${r}.LastAuthUser`];return{tokenUserName:n,idToken:u[`${r}.${n??""}.idToken`],accessToken:u[`${r}.${n??""}.accessToken`],refreshToken:u[`${r}.${n??""}.refreshToken`],scopes:u[`${r}.${n??""}.tokenScopesString`],nonce:u["spa-auth-edge-nonce"],nonceHmac:u["spa-auth-edge-nonce-hmac"],pkce:u["spa-auth-edge-pkce"]}}function HW(t){let c=AW(t.tokens.idToken),u=c["cognito:username"],r=`CognitoIdentityServiceProvider.${t.clientId}`,n=`${r}.${u}.idToken`,f=`${r}.${u}.accessToken`,d=`${r}.${u}.refreshToken`,h=`${r}.LastAuthUser`,q=`${r}.${u}.tokenScopesString`,_=t.oauthScopes.join(" "),W=`${r}.${u}.userData`,J=JSON.stringify({UserAttributes:[{Name:"sub",Value:c.sub},{Name:"email",Value:c.email}],Username:u}),$={[n]:`${t.tokens.idToken}; ${Wt(t.domainName,t.cookieSettings.idToken)}`,[f]:`${t.tokens.accessToken}; ${Wt(t.domainName,t.cookieSettings.accessToken)}`,[d]:`${t.tokens.refreshToken}; ${Wt(t.domainName,t.cookieSettings.refreshToken)}`,[h]:`${u}; ${Wt(t.domainName,t.cookieSettings.idToken)}`,[q]:`${_}; ${Wt(t.domainName,t.cookieSettings.accessToken)}`,[W]:`${encodeURIComponent(J)}; ${Wt(t.domainName,t.cookieSettings.idToken)}`,"amplify-signin-with-hostedUI":`true; ${Wt(t.domainName,t.cookieSettings.accessToken)}`};if(t.event==="signOut")Object.keys($).forEach((w)=>$[w]=Bd($[w]));else if(t.event==="refreshFailed")$[d]=Bd($[d]);return["spa-auth-edge-nonce","spa-auth-edge-nonce-hmac","spa-auth-edge-pkce"].forEach((w)=>{$[w]=Bd($[w])}),Object.entries($).map(([w,P])=>`${w}=${P}`)}function Bd(t=""){let c=t.split(";").map((r)=>r.trim()).filter((r)=>!r.toLowerCase().startsWith("max-age")).filter((r)=>!r.toLowerCase().startsWith("expires")),u=`Expires=${new Date(0).toUTCString()}`;return["",...c.slice(1),u].join("; ")}var QZ=dh(async(t,c)=>{let u=c.Records[0].cf.request,r=u.headers.host[0].value,{idToken:n,accessToken:f,refreshToken:d}=SW(u.headers,t.clientId);if(!n)return pr(`https://${r}${t.signOutRedirectTo}`);let h=new URLSearchParams({logout_uri:`https://${r}${t.signOutRedirectTo}`,client_id:t.clientId}).toString();return pr(`https://${t.cognitoAuthDomain}/logout?${h}`,{cookies:HW({event:"signOut",tokens:{idToken:n,accessToken:f??"",refreshToken:d??""},domainName:r,...t})})});
|