/*! For license information please see mng-digisubs.main.bundle.js.LICENSE.txt */ (()=>{var e={7526(e,t){"use strict";t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,c=r-o;sc?c:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function u(e,t,n){for(var r,o=[],i=t;ia)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|m(e,t);let r=s(n);const o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|f(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||Z(e.length)?s(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|f(e))}function h(e){const t=e.length<0?0:0|f(e.length),n=s(t);for(let r=0;r=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function m(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(e).length;default:if(o)return r?-1:V(e).length;t=(""+t).toLowerCase(),o=!0}}function y(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,n);case"utf8":case"utf-8":return R(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return k(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function w(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){let i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;is&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;ro&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function R(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return A(this,e,t,n);case"ascii":case"latin1":case"binary":return E(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function I(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;or)&&(n=r);let o="";for(let r=t;rn)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function x(e,t,n,r,o){H(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function U(e,t,n,r,o){H(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function D(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],o=1,i=0;for(;++i>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q(function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],o=1,i=0;for(;++i=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q(function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||L(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){P(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i>>=0,n>>>=0,!r){P(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Q(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);P(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o>>=0,!r){const r=Math.pow(2,8*n-1);P(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Q(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,n){return M(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return M(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function H(e,t,n,r,o,i){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||F(t,e.length-(n+1))}(r,o,i)}function W(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function F(e,t,n){if(Math.floor(e)!==e)throw W(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}G("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),G("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=K(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=K(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function V(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function J(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<>1,l=-7,d=n?o-1:0,h=n?-1:1,p=e[t+d];for(d+=h,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=u}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&s,p+=f,s/=256,o-=8);for(a=a<0;e[n+p]=255&a,p+=f,a/=256,u-=8);e[n+p-f]|=128*m}},5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function o(){var t,n,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function c(e,o,i,a){var s=o&&o.prototype instanceof l?o:l,c=Object.create(s.prototype);return r(c,"_invoke",function(e,r,o){var i,a,s,c=0,l=o||[],d=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,a=0,s=t,h.n=n,u}};function p(e,r){for(a=e,s=r,n=0;!d&&c&&!o&&n3?(o=f===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=e<2&&pr||r>f)&&(i[4]=e,i[5]=r,h.n=f,a=0))}if(o||e>1)return u;throw d=!0,r}return function(o,l,f){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&p(l,f),a=l,s=f;(n=a<2?t:s)||!d;){i||(a?a<3?(a>1&&(h.n=-1),p(a,s)):h.n=s:h.v=s);try{if(c=2,i){if(a||(o="next"),n=i[o]){if(!(n=n.call(i,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=i.return)&&n.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((n=(d=h.n<0)?s:e.call(r,h))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:n,done:d}}}(e,i,a),!0),c}var u={};function l(){}function d(){}function h(){}n=Object.getPrototypeOf;var p=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),f=h.prototype=l.prototype=Object.create(p);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,r(e,s,"GeneratorFunction")),e.prototype=Object.create(f),e}return d.prototype=h,r(f,"constructor",h),r(h,"constructor",d),d.displayName="GeneratorFunction",r(h,s,"GeneratorFunction"),r(f),r(f,s,"Generator"),r(f,a,function(){return this}),r(f,"toString",function(){return"[object Generator]"}),(e.exports=o=function(){return{w:c,m}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,o,i){var a=r(e,t,n,o,i);return a.next().then(function(e){return e.done?e.value:a.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),o=n(1791);e.exports=function(e,t,n,i,a){return new o(r().w(e,t,n,i),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var r=n(5172),o=n(5546);e.exports=function e(t,n){function i(e,o,a,s){try{var c=t[e](o),u=c.value;return u instanceof r?n.resolve(u.v).then(function(e){i("next",e,a,s)},function(e){i("throw",e,a,s)}):n.resolve(u).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,s)})}catch(e){s(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),o(this,"_invoke",function(e,t,r){function o(){return new n(function(t,n){i(e,r,t,n)})}return a=a?a.then(o,o):o()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,o,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,r,o){function i(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?a?a(e,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[n]=r:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,o,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),o=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=o(),n=t.m(l),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function h(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var p={throw:1,return:2,break:3,continue:3};function f(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,p[e],t)},delegateYield:function(e,o,i){return t.resultName=o,n(r.d,u(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,r,o){return t.w(f(e),n,r,o&&o.reverse())},isGeneratorFunction:h,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:s,async:function(e,t,n,r,o){return(h(t)?a:i)(f(e),t,n,r,o)},keys:c,values:u}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},3612(e,t,n){"use strict";var r,o,i,a,s;n.d(t,{A:()=>c}),window.authentication_config.sessionManagementEnabled="1"===window.authentication_config.sessionManagement;const c={debug:!!window.authentication_config.debug,sessionServer:window.authentication_config?window.authentication_config.sessionServer:"",entitlementsEnabled:!!window.authentication_config&&"1"===window.authentication_config.entitlementsEnabled,dropdownEnabled:!!window.authentication_config&&"1"===window.authentication_config.dropdownEnabled,enableReaderDashboardLink:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardLink,enableDashboardCancel:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardCancel,enableDashboardBenefitHub:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardBenefitHub,enableEngageArticleGifting:"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.articleSharingEnabled)&&"1"===(null===(o=window.authentication_config)||void 0===o?void 0:o.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(a=window.authentication_config)||void 0===a?void 0:a.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(s=window.authentication_config)||void 0===s?void 0:s.articleSavingEnabled),prosperstackClientid:window.authentication_config?window.authentication_config.prosperstackClientid:"",enableUpgradeSubscription:!!window.authentication_config&&"1"===window.authentication_config.enableUpgradeSubscription,oneTapEnabled:!!window.authentication_config&&"1"===window.authentication_config.oneTapEnabled,useTribMainGoogle:!!window.authentication_config&&"1"===window.authentication_config.useTribMainGoogle,isAdfreeArticle:!!window.authentication_config&&"1"===window.authentication_config.isAdfreeArticle,auth0Domain:window.authentication_config?window.authentication_config.auth0Domain:"",auth0ClientId:window.authentication_config?window.authentication_config.auth0ClientId:"",entitlementsEndpoint:window.authentication_config?window.authentication_config.entitlementsEndpoint:"",entitlementsApiKey:window.authentication_config?window.authentication_config.entitlementsAPIKey:"",linaCheckOnArticles:!!window.authentication_config&&window.authentication_config.linaCheckOnArticles,serverEntitlements:!!window.authentication_config&&window.authentication_config.serverEntitlements,googleClientId:window.authentication_config?window.authentication_config.googleClientId:"",newsletterId:window.authentication_config?window.authentication_config.newsletterId:0,connextStorageKey:"",auth0SubKey:"auth0_sub",auth0Authenticated:"auth0.is.authenticated",secret:window.authentication_config?window.authentication_config.pluginSecret:"",newslettersEnabled:!!window.authentication_config&&"1"===window.authentication_config.newslettersEnabled,bcLowaSegements:!!window.authentication_config.bcLowaSegements&&"1"===window.authentication_config.bcLowaSegements,blueconicEnabled:!!window.authentication_config.blueconicEnabled&&"1"===window.authentication_config.blueconicEnabled,datadogEnabled:!!window.authentication_config.enableDatadog&&"1"===window.authentication_config.enableDatadog}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};function t(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function r(e){return function(){var n=this,r=arguments;return new Promise(function(o,i){var a=e.apply(n,r);function s(e){t(a,o,i,s,c,"next",e)}function c(e){t(a,o,i,s,c,"throw",e)}s(void 0)})}}n.r(e),n.d(e,{hasBrowserEnv:()=>Ja,hasStandardBrowserEnv:()=>Ya,hasStandardBrowserWebWorkerEnv:()=>Za,navigator:()=>za,origin:()=>qa});var o=n(4756),i=n(3612);const a=function(){if(i.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;re.length)&&(t=e.length);for(var n=0,r=Array(t);n{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return atob(t)}}function w(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?setTimeout(n,t):n(null)}}window.addEventListener("storage",a),e.addToWaiting(a);var s=setTimeout(a,Math.max(0,t-Date.now()))})];case 1:return n.sent(),[2]}})})},e.addToWaiting=function(t){this.removeFromWaiting(t),void 0!==e.waiters&&e.waiters.push(t)},e.removeFromWaiting=function(t){void 0!==e.waiters&&(e.waiters=e.waiters.filter(function(e){return e!==t}))},e.notifyWaiters=function(){void 0!==e.waiters&&e.waiters.slice().forEach(function(e){return e()})},e.prototype.releaseLock=function(e){return E(this,void 0,void 0,function(){return S(this,function(t){switch(t.label){case 0:return[4,this.releaseLock__private__(e)];case 1:return[2,t.sent()]}})})},e.prototype.releaseLock__private__=function(t){return E(this,void 0,void 0,function(){var n,r,o,i;return S(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?R:this.storageHandler,r="browser-tabs-lock-key-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,_.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),_.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,o=[],i=0;;){var a=r.keySync(i);if(null===a)break;o.push(a),i++}for(var s=!1,c=0;cDate.now();class x extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,x.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new x(t,n)}}class U extends x{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super(e,t),this.state=n,this.appState=r,Object.setPrototypeOf(this,U.prototype)}}class D extends x{constructor(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(e,t),this.connection=n,this.state=r,this.appState=o,Object.setPrototypeOf(this,D.prototype)}}class M extends x{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,M.prototype)}}class B extends M{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,B.prototype)}}class j extends x{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,j.prototype)}}class G extends x{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,G.prototype)}}class K extends x{constructor(e,t,n,r){super(e,t),this.mfa_token=n,this.mfa_requirements=r,Object.setPrototypeOf(this,K.prototype)}}class H extends x{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(X(e,["default"]),"', scope: '").concat(X(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,H.prototype)}}class W extends x{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(X(e,["default"]),"', missing scope: '").concat(X(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,W.prototype)}}class F extends x{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,F.prototype)}}function X(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const V=()=>window.crypto,J=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return Array.from(V().getRandomValues(new Uint8Array(43))).forEach(n=>t+=e[n%66]),t},z=e=>btoa(e),Y=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],Z=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object.keys(e).reduce((n,r)=>{if(t&&"env"===r)return n;const o=Y.find(e=>e.key===r);return o&&o.type.includes(typeof e[r])&&(n[r]=e[r]),n},{})},q=e=>{var{clientId:t}=e,n=w(e,["clientId"]);return new URLSearchParams((e=>Object.keys(e).filter(t=>void 0!==e[t]).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:e[n]}),{}))(Object.assign({client_id:t},n))).toString()},Q=async e=>{const t=V().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},$=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),ee=e=>{const t=new Uint8Array(e);return(e=>{const t={"+":"-","/":"_","=":""};return e.replace(/[+/=]/g,e=>t[e])})(window.btoa(String.fromCharCode(...Array.from(t))))},te=new TextEncoder,ne=new TextDecoder;function re(e){return"string"==typeof e?te.encode(e):ne.decode(e)}function oe(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new ce(`${e.name} modulusLength must be at least 2048 bits`)}let ie;if(Uint8Array.prototype.toBase64)ie=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;ie=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r{const n=await fetch(e,t);return{ok:n.ok,json:await n.json(),headers:(r=n.headers,[...r].reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{}))};var r},ye=async function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e4;return o?(async(e,t,n,r,o,i,a,s)=>((e,t)=>new Promise(function(n,r){const o=new MessageChannel;o.port1.onmessage=function(e){e.data.error?r(new Error(e.data.error)):n(e.data),o.port1.close()},t.postMessage(e,[o.port2])}))({auth:{audience:t,scope:n},timeout:o,fetchUrl:e,fetchOptions:r,useFormData:a,useMrrt:s},i))(e,t,n,r,a,o,i,arguments.length>7?arguments[7]:void 0):(async(e,t,n)=>{const r=new AbortController;let o;return t.signal=r.signal,Promise.race([me(e,t),new Promise((e,t)=>{o=setTimeout(()=>{r.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(o)})})(e,r,a)};async function we(e,t,n,r,o,i,a,s,c,u){if(c){const t=await c.generateProof({url:e,method:o.method||"GET",nonce:await c.getNonce()});o.headers=Object.assign(Object.assign({},o.headers),{dpop:t})}let l,d=null;for(let c=0;c<3;c++)try{l=await ye(e,n,r,o,i,a,t,s),d=null;break}catch(e){d=e}if(d)throw d;const h=l.json,{error:p,error_description:f}=h,m=w(h,["error","error_description"]),{headers:y,ok:g}=l;let b;if(c&&(b=y["dpop-nonce"],b&&await c.setNonce(b)),!g){const l=f||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===p)throw new K(p,l,m.mfa_token,m.mfa_requirements);if("missing_refresh_token"===p)throw new H(n,r);if("use_dpop_nonce"===p){if(!c||!b||u)throw new F(b);return we(e,t,n,r,o,i,a,s,c,!0)}throw new x(p||"request_error",l)}return m}async function ge(e,t){var{baseUrl:n,timeout:r,audience:o,scope:i,auth0Client:a,useFormData:s,useMrrt:c,dpop:u}=e,l=w(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"]);const d="urn:ietf:params:oauth:grant-type:token-exchange"===l.grant_type,h="refresh_token"===l.grant_type&&c,p=Object.assign(Object.assign(Object.assign(Object.assign({},l),d&&o&&{audience:o}),d&&i&&{scope:i}),h&&{audience:o,scope:i}),f=s?q(p):JSON.stringify(p),m=(y=l.grant_type,fe.includes(y));var y;return await we("".concat(n,"/oauth/token"),r,o||"default",i,{method:"POST",body:f,headers:{"Content-Type":s?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(Z(a||L)))}},t,s,c,m?u:void 0)}const be=function(){for(var e=arguments.length,t=new Array(e),n=0;nArray.from(new Set(e)))(t.filter(Boolean).join(" ").trim().split(/\s+/)).join(" ")},ve=(e,t,n)=>{let r;return n&&(r=e[n]),r||(r=e.default),be(r,t)};class Ae{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"@@auth0spajs@@",n=arguments.length>2?arguments[2]:void 0;this.prefix=t,this.suffix=n,this.clientId=e.clientId,this.scope=e.scope,this.audience=e.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(e){const[t,n,r,o]=e.split("::");return new Ae({clientId:n,scope:o,audience:r},t)}static fromCacheEntry(e){const{scope:t,audience:n,client_id:r}=e;return new Ae({scope:t,audience:n,clientId:r})}}class Ee{set(e,t){localStorage.setItem(e,JSON.stringify(t))}get(e){const t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter(e=>e.startsWith("@@auth0spajs@@"))}}class Se{constructor(){this.enclosedCache=function(){let e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class Te{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||P}async setIdToken(e,t,n){var r;const o=this.getIdTokenCacheKey(e);await this.cache.set(o,{id_token:t,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(o))}async getIdToken(e){const t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){const t=await this.get(e);if(!t)return;if(!t.id_token||!t.decodedToken)return;return{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;var o;let i=await this.cache.get(e.toKey());if(!i){const t=await this.getCacheKeys();if(!t)return;const o=this.matchExistingCacheKey(e,t);if(o&&(i=await this.cache.get(o)),!i&&n&&"cache-only"!==r)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const a=await this.nowProvider(),s=Math.floor(a/1e3);return i.expiresAt-t!e||t.includes(e)).reduce(async(e,t)=>{await e,await this.cache.remove(t)},Promise.resolve()),await(null===(t=this.keyManifest)||void 0===t?void 0:t.clear()))}async wrapCacheEntry(e){const t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?null===(e=await this.keyManifest.get())||void 0===e?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new Ae({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const r=Ae.fromKey(t),o=new Set(r.scope&&r.scope.split(" ")),i=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],a=r.scope&&i.reduce((e,t)=>e&&o.has(t),!0);return"@@auth0spajs@@"===r.prefix&&r.clientId===e.clientId&&r.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(const r of t){const t=Ae.fromKey(r);if("@@auth0spajs@@"===t.prefix&&t.clientId===e.clientId){const t=await this.cache.get(r);if(null===(n=null==t?void 0:t.body)||void 0===n?void 0:n.refresh_token)return this.modifiedCachedEntry(t,e)}}}async updateEntry(e,t){var n;const r=await this.getCacheKeys();if(r)for(const o of r){const r=await this.cache.get(o);if((null===(n=null==r?void 0:r.body)||void 0===n?void 0:n.refresh_token)===e){const e=Object.assign(Object.assign({},r.body),{refresh_token:t});await this.set(e)}}}}class _e{constructor(e,t,n){this.storage=e,this.clientId=t,this.cookieDomain=n,this.storageKey="".concat("a0.spajs.txs",".").concat(this.clientId)}create(e){this.storage.save(this.storageKey,e,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}}const Re=e=>"number"==typeof e,Oe=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"];var Ie=g&&g.__assign||function(){return Ie=Object.assign||function(e){for(var t,n=1,r=arguments.length;nxe.get(e)||xe.get("".concat("_legacy_").concat(e)),save(e,t,n){let r={};"https:"===window.location.protocol&&(r={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),Le("".concat("_legacy_").concat(e),JSON.stringify(t),r),xe.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),Pe(e,n),xe.remove(e,t),xe.remove("".concat("_legacy_").concat(e),t)}},De={get(e){if("undefined"==typeof sessionStorage)return;const t=sessionStorage.getItem(e);return null!=t?JSON.parse(t):void 0},save(e,t){sessionStorage.setItem(e,JSON.stringify(t))},remove(e){sessionStorage.removeItem(e)}};var Me;!function(e){e.Code="code",e.ConnectCode="connect_code"}(Me||(Me={}));var Be,je=function(e){return Be=Be||function(e,t,n){var r=void 0===t?null:t,o=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),o=0,i=n.length;o(new Se).enclosedCache,localstorage:()=>new Ee},Fe=e=>We[e],Xe=e=>{const{openUrl:t,onRedirect:n}=e,r=w(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},Ve=(e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))},Je={NONCE:"nonce",KEYPAIR:"keypair"};class ze{constructor(e){this.clientId=e}getVersion(){return 1}createDbHandle(){const e=window.indexedDB.open("auth0-spa-js",this.getVersion());return new Promise((t,n)=>{e.onupgradeneeded=()=>Object.values(Je).forEach(t=>e.result.createObjectStore(t)),e.onerror=()=>n(e.error),e.onsuccess=()=>t(e.result)})}async getDbHandle(){return this.dbHandle||(this.dbHandle=await this.createDbHandle()),this.dbHandle}async executeDbRequest(e,t,n){const r=n((await this.getDbHandle()).transaction(e,t).objectStore(e));return new Promise((e,t)=>{r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)})}buildKey(e){const t=e?"_".concat(e):"auth0";return"".concat(this.clientId,"::").concat(t)}setNonce(e,t){return this.save(Je.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(Je.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(Je.NONCE,this.buildKey(e))}findKeyPair(){return this.find(Je.KEYPAIR,this.buildKey())}find(e,t){return this.executeDbRequest(e,"readonly",e=>e.get(t))}async deleteBy(e,t){const n=await this.executeDbRequest(e,"readonly",e=>e.getAllKeys());null==n||n.filter(t).map(t=>this.executeDbRequest(e,"readwrite",e=>e.delete(t)))}deleteByClientId(e,t){return this.deleteBy(e,e=>"string"==typeof e&&e.startsWith("".concat(t,"::")))}clearNonces(){return this.deleteByClientId(Je.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(Je.KEYPAIR,this.clientId)}}class Ye{constructor(e){this.storage=new ze(e)}getNonce(e){return this.storage.findNonce(e)}setNonce(e,t){return this.storage.setNonce(e,t)}async getOrGenerateKeyPair(){let e=await this.storage.findKeyPair();return e||(e=await async function(e,t){var n;let r;return r={name:"ECDSA",namedCurve:"P-256"},crypto.subtle.generateKey(r,null!==(n=null==t?void 0:t.extractable)&&void 0!==n&&n,["sign","verify"])}(0,{extractable:!1}),await this.storage.setKeyPair(e)),e}async generateProof(e){const t=await this.getOrGenerateKeyPair();return function(e){let{keyPair:t,url:n,method:r,nonce:o,accessToken:i}=e;const a=function(e){const t=new URL(e);return t.search="",t.hash="",t.href}(n);return he(t,a,r,o,i)}(Object.assign({keyPair:t},e))}async calculateThumbprint(){return function(e){return async function(e){if(!de(e))throw new TypeError('"publicKey" must be a public CryptoKey');if(!0!==e.extractable)throw new TypeError('"publicKey.extractable" must be true');const t=await pe(e);let n;switch(t.kty){case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;default:throw new se("unsupported JWK kty")}return ae(await crypto.subtle.digest({name:"SHA-256"},re(JSON.stringify(n))))}(e.publicKey)}(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}var Ze;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(Ze||(Ze={}));class qe{constructor(e,t){this.hooks=t,this.config=Object.assign(Object.assign({},e),{fetch:e.fetch||("undefined"==typeof window?fetch:window.fetch.bind(window))})}isAbsoluteUrl(e){return/^(https?:)?\/\//i.test(e)}buildUrl(e,t){if(t){if(this.isAbsoluteUrl(t))return t;if(e)return"".concat(e.replace(/\/?\/$/,""),"/").concat(t.replace(/^\/+/,""))}throw new TypeError("`url` must be absolute or `baseUrl` non-empty.")}getAccessToken(e){return this.config.getAccessToken?this.config.getAccessToken(e):this.hooks.getAccessToken(e)}extractUrl(e){return"string"==typeof e?e:e instanceof URL?e.href:e.url}buildBaseRequest(e,t){if(!this.config.baseUrl)return new Request(e,t);const n=this.buildUrl(this.config.baseUrl,this.extractUrl(e)),r=e instanceof Request?new Request(n,e):n;return new Request(r,t)}setAuthorizationHeader(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ze.Bearer;e.headers.set("authorization","".concat(n," ").concat(t))}async setDpopProofHeader(e,t){if(!this.config.dpopNonceId)return;const n=await this.hooks.getDpopNonce(),r=await this.hooks.generateDpopProof({accessToken:t,method:e.method,nonce:n,url:e.url});e.headers.set("dpop",r)}async prepareRequest(e,t){const n=await this.getAccessToken(t);let r,o;"string"==typeof n?(r=this.config.dpopNonceId?Ze.DPoP:Ze.Bearer,o=n):(r=n.token_type,o=n.access_token),this.setAuthorizationHeader(e,o,r),r===Ze.DPoP&&await this.setDpopProofHeader(e,o)}getHeader(e,t){return Array.isArray(e)?new Headers(e).get(t)||"":"function"==typeof e.get?e.get(t)||"":e[t]||""}hasUseDpopNonceError(e){if(401!==e.status)return!1;const t=this.getHeader(e.headers,"www-authenticate");return t.includes("invalid_dpop_nonce")||t.includes("use_dpop_nonce")}async handleResponse(e,t){const n=this.getHeader(e.headers,"dpop-nonce");if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new F(n);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,n,r){const o=this.buildBaseRequest(e,t);await this.prepareRequest(o,r);const i=await this.config.fetch(o);return this.handleResponse(i,n)}fetchWithAuth(e,t,n){const r={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,Object.assign(Object.assign({},r),{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,t,r,n)}}class Qe{constructor(e,t){this.myAccountFetcher=e,this.apiBase=t}async connectAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async completeAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/complete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(n){throw new $e({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new $e(t)}}class $e extends Error{constructor(e){let{type:t,status:n,title:r,detail:o,validation_errors:i}=e;super(o),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=r,this.detail=o,this.validation_errors=i,Object.setPrototypeOf(this,$e.prototype)}}const et={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};function tt(e,t){this.v=e,this.k=t}function nt(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function rt(e){return new tt(e,0)}function ot(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function it(e,t){return e.get(nt(e,t))}function at(e,t,n){ot(e,t),t.set(e,n)}function st(e,t,n){return e.set(nt(e,t),n),n}function ct(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function lt(e){for(var t=1;t(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Ot=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw wt("The input to be decoded is not correctly encoded.","ERR_INVALID_ARG_VALUE",e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e0)return;if(t){if(0!==e)throw wt("".concat(n," must be a non-negative number"),"ERR_INVALID_ARG_VALUE",o);return}throw wt("".concat(n," must be a positive number"),"ERR_INVALID_ARG_VALUE",o)}catch(e){if(r)throw Lt(e.message,r,o);throw e}}function Bt(e,t,n,r){try{if("string"!=typeof e)throw wt("".concat(t," must be a string"),"ERR_INVALID_ARG_TYPE",r);if(0===e.length)throw wt("".concat(t," must not be empty"),"ERR_INVALID_ARG_VALUE",r)}catch(e){if(n)throw Lt(e.message,n,r);throw e}}function jt(e){!function(e,t){if(un(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o2){const e=r.pop();t+="".concat(r.join(", "),", or ").concat(e)}else 2===r.length?t+="".concat(r[0]," or ").concat(r[1]):t+=r[0];return Lt(t,Nn,e)}(e,t)}(e,"application/json")}function Gt(){return kt(crypto.getRandomValues(new Uint8Array(32)))}function Kt(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new Nt("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"RSASSA-PKCS1-v1_5":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new Nt("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"ECDSA":return function(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new Nt("unsupported EcKeyAlgorithm namedCurve",{cause:e})}}(e);case"Ed25519":case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return e.algorithm.name;case"EdDSA":return"Ed25519";default:throw new Nt("unsupported CryptoKey algorithm name",{cause:e})}}function Ht(e){const t=null==e?void 0:e[bt];return"number"==typeof t&&Number.isFinite(t)?t:0}function Wt(e){const t=null==e?void 0:e[vt];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function Ft(){return Math.floor(Date.now()/1e3)}function Xt(e){if("object"!=typeof e||null===e)throw wt('"as" must be an object',"ERR_INVALID_ARG_TYPE");Bt(e.issuer,'"as.issuer"')}function Vt(e){if("object"!=typeof e||null===e)throw wt('"client" must be an object',"ERR_INVALID_ARG_TYPE");Bt(e.client_id,'"client.client_id"')}function Jt(e){return Bt(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function zt(e,t){const{key:n,kid:r}=(o=e)instanceof CryptoKey?{key:o}:(null==o?void 0:o.key)instanceof CryptoKey?(void 0!==o.kid&&Bt(o.kid,'"kid"'),{key:o.key,kid:o.kid}):{};var o;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw wt("".concat(t," must be a CryptoKey"),"ERR_INVALID_ARG_TYPE")}(e,t),"private"!==e.type)throw wt("".concat(t," must be a private CryptoKey"),"ERR_INVALID_ARG_VALUE")}(n,'"clientPrivateKey.key"'),async(e,o,i,a)=>{var s;const c={alg:Kt(n),kid:r},u=function(e,t){const n=Ft()+Ht(t);return{jti:Gt(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,o);null==t||null===(s=t[Et])||void 0===s||s.call(t,c,u),i.set("client_id",o.client_id),i.set("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),i.set("client_assertion",await async function(e,t,n){if(!n.usages.includes("sign"))throw wt('CryptoKey instances used for signing assertions must include "sign" in their "usages"',"ERR_INVALID_ARG_VALUE");const r="".concat(kt(Rt(JSON.stringify(e))),".").concat(kt(Rt(JSON.stringify(t)))),o=kt(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:Kn(e)};case"RSA-PSS":switch(Gn(e),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new Nt("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return Gn(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Nt("unsupported CryptoKey algorithm name",{cause:e})}(n),n,Rt(r)));return"".concat(r,".").concat(o)}(c,u,n))}}const Yt=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function Zt(e,t){if(t&&"https:"!==e.protocol)throw Lt("only requests to HTTPS are allowed",Ln,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw Lt("only HTTP and HTTPS requests are allowed",Pn,e)}function qt(e,t,n,r){let o;if("string"!=typeof e||!(o=Yt(e)))throw Lt("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?Mn:Bn,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return Zt(o,r),o}function Qt(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?qt(e.mtls_endpoint_aliases[t],t,n,r):qt(e[t],t,n,r)}class $t extends Error{constructor(e,t){var n;super(e,t),ct(this,"cause",void 0),ct(this,"code",void 0),ct(this,"error",void 0),ct(this,"status",void 0),ct(this,"error_description",void 0),ct(this,"response",void 0),this.name=this.constructor.name,this.code=_n,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:t.response}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class en extends Error{constructor(e,t){var n,r;super(e,t),ct(this,"cause",void 0),ct(this,"code",void 0),ct(this,"error",void 0),ct(this,"error_description",void 0),this.name=this.constructor.name,this.code=On,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=null!==(n=t.cause.get("error_description"))&&void 0!==n?n:void 0,null===(r=Error.captureStackTrace)||void 0===r||r.call(Error,this,this.constructor)}}class tn extends Error{constructor(e,t){var n;super(e,t),ct(this,"cause",void 0),ct(this,"code",void 0),ct(this,"response",void 0),ct(this,"status",void 0),this.name=this.constructor.name,this.code=Tn,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}const nn=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)"),rn=new RegExp('^[,\\s]*([a-zA-Z0-9!#$%&\\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"[,\\s]*(.*)'),on=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)[,\\s]*(.*)"),an=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function sn(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(t=function(e){if(!yt(e,Response))throw wt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(nn);const i=null===(o=t)||void 0===o?void 0:o[1].toLowerCase();if(!i)return;const a=r.substring(t[0].length);if(a&&!a.match(/^[\s,]/))return;const s=a.match(/^\s+(.*)$/),c=!!s;r=s?s[1]:void 0;const u={};let l;if(c)for(;r;){let n,o;if(t=r.match(rn)){if([,n,o,r]=t,o.includes("\\"))try{o=JSON.parse('"'.concat(o,'"'))}catch(e){}u[n.toLowerCase()]=o}else{if(!(t=r.match(on))){if(t=r.match(an)){if(Object.keys(u).length)break;[,l,r]=t;break}return}[,n,o,r]=t,u[n.toLowerCase()]=o}}else r=a||void 0;const d={scheme:i,parameters:u};l&&(d.token68=l),n.push(d)}return n.length?n:void 0}(e))throw new tn("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}(e),t=await async function(e){if(e.status>399&&e.status<500){jn(e),jt(e);try{const t=await e.clone().json();if(Pt(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(r=e.body)||void 0===r?void 0:r.cancel()),new $t("server responded with an error in the response body",{cause:t,response:e});throw Lt('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),Cn,e)}}function cn(e){if(!gn.has(e))throw wt('"options.DPoP" is not a valid DPoPHandle',"ERR_INVALID_ARG_VALUE")}function un(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function ln(e,t,n,r,o,i,a){return await n(e,t,o,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[At])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:Ut(r,null==a?void 0:a.signal)})}async function dn(e,t,n,r,o,i){var a;const s=Qt(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[gt]));o.set("grant_type",r);const c=xt(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(cn(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await ln(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const hn=new WeakMap,pn=new WeakMap;function fn(e){if(!e.id_token)return;const t=hn.get(e);if(!t)throw wt('"ref" was already garbage collected or did not resolve from the proper sources',"ERR_INVALID_ARG_VALUE");return t}async function mn(e,t,n,r,o,i){if(Xt(e),Vt(t),!yt(n,Response))throw wt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await sn(n,200,"Token Endpoint"),jn(n);const a=await Vn(n);if(Bt(a.access_token,'"response" body "access_token" property',kn,{body:a}),Bt(a.token_type,'"response" body "token_type" property',kn,{body:a}),a.token_type=a.token_type.toLowerCase(),void 0!==a.expires_in){let e="number"!=typeof a.expires_in?parseFloat(a.expires_in):a.expires_in;Mt(e,!0,'"response" body "expires_in" property',kn,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&Bt(a.refresh_token,'"response" body "refresh_token" property',kn,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw Lt('"response" body "scope" property must be a string',kn,{body:a});if(void 0!==a.id_token){Bt(a.id_token,'"response" body "id_token" property',kn,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(Mt(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const{claims:s,jwt:c}=await async function(e,t,n,r,o){let i,a,{0:s,1:c,length:u}=e.split(".");if(5===u){if(void 0===o)throw new Nt("JWE decryption is not configured",{cause:e});e=await o(e),({0:s,1:c,length:u}=e.split("."))}if(3!==u)throw Lt("Invalid JWT",kn,e);try{i=JSON.parse(Rt(kt(s)))}catch(e){throw Lt("failed to parse JWT Header body as base64url encoded JSON",In,e)}if(!Pt(i))throw Lt("JWT Header must be a top level object",kn,e);if(t(i),void 0!==i.crit)throw new Nt('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(Rt(kt(c)))}catch(e){throw Lt("failed to parse JWT Payload body as base64url encoded JSON",In,e)}if(!Pt(a))throw Lt("JWT Payload must be a top level object",kn,e);const l=Ft()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw Lt('unexpected JWT "exp" (expiration time) claim type',kn,{claims:a});if(a.exp<=l-r)throw Lt('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',xn,{claims:a,now:l,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw Lt('unexpected JWT "iat" (issued at) claim type',kn,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw Lt('unexpected JWT "iss" (issuer) claim type',kn,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw Lt('unexpected JWT "nbf" (not before) claim type',kn,{claims:a});if(a.nbf>l+r)throw Lt('unexpected JWT "nbf" (not before) claim value',xn,{claims:a,now:l,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw Lt('unexpected JWT "aud" (audience) claim type',kn,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,Hn.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Ht(t),Wt(t),o).then(An.bind(void 0,i)).then(wn.bind(void 0,e)).then(yn.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw Lt('ID Token "aud" (audience) claim includes additional untrusted audiences',Un,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw Lt('unexpected ID Token "azp" (authorized party) claim value',Un,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&Mt(s.auth_time,!0,'ID Token "auth_time" (authentication time)',kn,{claims:s}),pn.set(n,c),hn.set(a,s)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new Nt("unsupported `token_type` value",{cause:{body:a}});return a}function yn(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw Lt('unexpected JWT "aud" (audience) claim value',Un,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw Lt('unexpected JWT "aud" (audience) claim value',Un,{expected:e,claims:t.claims,claim:"aud"});return t}function wn(e,t){var n,r;const o=null!==(n=null===(r=e[zn])||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw Lt('unexpected JWT "iss" (issuer) claim value',Un,{expected:o,claims:t.claims,claim:"iss"});return t}const gn=new WeakSet,bn=Symbol(),vn={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function An(e,t){for(const n of e)if(void 0===t.claims[n])throw Lt('JWT "'.concat(n,'" (').concat(vn[n],") claim missing"),kn,{claims:t.claims});return t}const En=Symbol(),Sn=Symbol();const Tn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",_n="OAUTH_RESPONSE_BODY_ERROR",Rn="OAUTH_UNSUPPORTED_OPERATION",On="OAUTH_AUTHORIZATION_RESPONSE_ERROR",In="OAUTH_PARSE_ERROR",kn="OAUTH_INVALID_RESPONSE",Nn="OAUTH_RESPONSE_IS_NOT_JSON",Cn="OAUTH_RESPONSE_IS_NOT_CONFORM",Ln="OAUTH_HTTP_REQUEST_FORBIDDEN",Pn="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",xn="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",Un="OAUTH_JWT_CLAIM_COMPARISON_FAILED",Dn="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",Mn="OAUTH_MISSING_SERVER_METADATA",Bn="OAUTH_INVALID_SERVER_METADATA";function jn(e){if(e.bodyUsed)throw wt('"response" body has been used already',"ERR_INVALID_ARG_VALUE")}function Gn(e){const{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Nt("unsupported ".concat(t.name," modulusLength"),{cause:e})}function Kn(e){const{algorithm:t}=e;switch(t.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Nt("unsupported ECDSA namedCurve",{cause:e})}}function Hn(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw Lt('unexpected JWT "alg" header parameter',kn,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw Lt('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?r.alg!==n:"function"==typeof n?!n(r.alg):!n.includes(r.alg))throw Lt('unexpected JWT "alg" header parameter',kn,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw Lt('unexpected JWT "alg" header parameter',kn,{header:r,expected:e,reason:"client configuration"})}function Wn(e,t){const{0:n,length:r}=e.getAll(t);if(r>1)throw Lt('"'.concat(t,'" parameter must be provided only once'),kn);return n}const Fn=Symbol(),Xn=Symbol();async function Vn(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jt;try{t=await e.json()}catch(t){throw n(e),Lt('failed to parse "response" body as JSON',In,t)}if(!Pt(t))throw Lt('"response" body must be a top level object',kn,{body:t});return t}const Jn=Symbol(),zn=Symbol(),Yn=new TextEncoder,Zn=new TextDecoder;function qn(e){const t=new Uint8Array(e.length);for(let n=0;n127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=r}return t}function Qn(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),ct(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),ct(this,"claim",void 0),ct(this,"reason",void 0),ct(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}ct(tr,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class nr extends er{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),ct(this,"code","ERR_JWT_EXPIRED"),ct(this,"claim",void 0),ct(this,"reason",void 0),ct(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}ct(nr,"code","ERR_JWT_EXPIRED");class rr extends er{constructor(){super(...arguments),ct(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}ct(rr,"code","ERR_JOSE_ALG_NOT_ALLOWED");class or extends er{constructor(){super(...arguments),ct(this,"code","ERR_JOSE_NOT_SUPPORTED")}}ct(or,"code","ERR_JOSE_NOT_SUPPORTED"),ct(class extends er{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),ct(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),ct(class extends er{constructor(){super(...arguments),ct(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class ir extends er{constructor(){super(...arguments),ct(this,"code","ERR_JWS_INVALID")}}ct(ir,"code","ERR_JWS_INVALID");class ar extends er{constructor(){super(...arguments),ct(this,"code","ERR_JWT_INVALID")}}ct(ar,"code","ERR_JWT_INVALID"),ct(class extends er{constructor(){super(...arguments),ct(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class sr extends er{constructor(){super(...arguments),ct(this,"code","ERR_JWKS_INVALID")}}ct(sr,"code","ERR_JWKS_INVALID");class cr extends er{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no applicable key found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),ct(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}ct(cr,"code","ERR_JWKS_NO_MATCHING_KEY");class ur extends er{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"multiple matching keys found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),ct(this,Symbol.asyncIterator,void 0),ct(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}ct(ur,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class lr extends er{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),ct(this,"code","ERR_JWKS_TIMEOUT")}}ct(lr,"code","ERR_JWKS_TIMEOUT");class dr extends er{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),ct(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}ct(dr,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const hr=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},pr=(e,t)=>e.name===t;function fr(e){return parseInt(e.name.slice(4),10)}function mr(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2){const t=r.pop();e+="one of type ".concat(r.join(", "),", or ").concat(t,".")}else 2===r.length?e+="one of type ".concat(r[0]," or ").concat(r[1],"."):e+="of type ".concat(r[0],".");if(null==t)e+=" Received ".concat(t);else if("function"==typeof t&&t.name)e+=" Received function ".concat(t.name);else if("object"==typeof t&&null!=t){var i;null!==(i=t.constructor)&&void 0!==i&&i.name&&(e+=" Received an instance of ".concat(t.constructor.name))}return e}const yr=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},gr=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),br=e=>wr(e)||gr(e);function vr(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 n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}const Ar=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n{const t=e.data[e.pos++];if(128&t){const n=127&t;let r=0;for(let t=0;t{if(e.data[e.pos++]!==t)throw new Error(n)},Tr=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},_r=(e,t,n)=>{var r;const o=(e=>Qn(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);let i=n;return null!=t&&null!==(r=t.startsWith)&&void 0!==r&&r.call(t,"ECDH-ES")&&(i||(i={}),i.getNamedCurve=e=>{const t={data:e,pos:0};return function(e){Sr(e,48,"Invalid PKCS#8 structure"),Er(e),Sr(e,2,"Expected version field");const t=Er(e);e.pos+=t,Sr(e,48,"Expected algorithm identifier");Er(e);e.pos}(t),(e=>{const t=(e=>{Sr(e,6,"Expected algorithm OID");const t=Er(e);return Tr(e,t)})(e);if(Ar(t,[43,101,110]))return"X25519";if(!Ar(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");Sr(e,6,"Expected curve OID");const n=Er(e),r=Tr(e,n);for(const{name:e,oid:t}of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}])if(Ar(r,t))return e;throw new Error("Unsupported named curve")})(t)}),(async(e,t,n,r)=>{var o;let i,a;const s="spki"===e,c=()=>s?["verify"]:["sign"];switch(n){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(n.slice(-3),10)||1)},a=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":i={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[n]},a=c();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{const e=r.getNamedCurve(t);i="X25519"===e?{name:"X25519"}:{name:"ECDH",namedCurve:e}}catch(e){throw new or("Invalid or unsupported key format")}a=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":i={name:"Ed25519"},a=c();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":i={name:n},a=c();break;default:throw new or('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(e,t,i,null!==(o=null==r?void 0:r.extractable)&&void 0!==o?o:!!s,a)})("pkcs8",o,t,i)};async function Rr(e){var t,n;if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:r,keyUsages:o}=function(e){let t,n;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},n=e.priv?["sign"]:["verify"];break;default:throw new or('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(e.alg.slice(-3),10)||1)},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new or('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new or('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new or('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new or('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}(e),i=lt({},e);return"AKP"!==i.kty&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,r,null!==(t=e.ext)&&void 0!==t?t:!e.d&&!e.priv,null!==(n=e.key_ops)&&void 0!==n?n:o)}const Or=e=>vr(e)&&"string"==typeof e.kty;let Ir;const kr=async function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Ir||(Ir=new WeakMap);let o=Ir.get(e);if(null!=o&&o[n])return o[n];const i=await Rr(lt(lt({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:Ir.set(e,{[n]:i}),i};const Nr=e=>null==e?void 0:e[Symbol.toStringTag],Cr=(e,t,n)=>{if(void 0!==t.use){let e;switch(n){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==e)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(e,'" when present'));if(Array.isArray(t.key_ops)){var r,o;let i;switch(!0){case"sign"===n||"verify"===n:case"dir"===e:case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):i=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===n?"wrapKey":"unwrapKey":n;break;case"encrypt"===n&&e.startsWith("RSA"):i="wrapKey";break;case"decrypt"===n:i=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&!1===(null===(r=t.key_ops)||void 0===r||null===(o=r.includes)||void 0===o?void 0:o.call(r,i)))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(i,'" when present'))}return!0};var Lr,Pr;let xr,Ur;if("undefined"==typeof navigator||null===(Lr=navigator.userAgent)||void 0===Lr||null===(Pr=Lr.startsWith)||void 0===Pr||!Pr.call(Lr,"Mozilla/5.0 ")){const e="v6.8.1";Ur="".concat("openid-client","/").concat(e),xr={"user-agent":Ur}}const Dr=e=>Mr.get(e);let Mr,Br;function jr(e){return void 0!==e?Jt(e):(Br||(Br=new WeakMap),(e,t,n,r)=>{let o;return(o=Br.get(t))||(function(e,t){if("string"!=typeof e)throw Wr("".concat(t," must be a string"),Hr);if(0===e.length)throw Wr("".concat(t," must not be empty"),Kr)}(t.client_secret,'"metadata.client_secret"'),o=Jt(t.client_secret),Br.set(t,o)),o(e,t,n,r)})}const Gr=At,Kr="ERR_INVALID_ARG_VALUE",Hr="ERR_INVALID_ARG_TYPE";function Wr(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class Fr extends Error{constructor(e,t){var n;super(e,t),ct(this,"code",void 0),this.name=this.constructor.name,this.code=null==t?void 0:t.code,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function Xr(e,t,n){return new Fr(e,{cause:t,code:n})}function Vr(e){if(e instanceof TypeError||e instanceof Fr||e instanceof $t||e instanceof en||e instanceof tn)throw e;if(e instanceof Ct)switch(e.code){case Ln:throw Xr("only requests to HTTPS are allowed",e,e.code);case Pn:throw Xr("only requests to HTTP or HTTPS are allowed",e,e.code);case Cn:throw Xr("unexpected HTTP response status code",e.cause,e.code);case Nn:throw Xr("unexpected response content-type",e.cause,e.code);case In:throw Xr("parsing error occured",e,e.code);case kn:throw Xr("invalid response encountered",e,e.code);case Un:throw Xr("unexpected JWT claim value encountered",e,e.code);case Dn:throw Xr("unexpected JSON attribute value encountered",e,e.code);case xn:throw Xr("JWT timestamp claim value failed validation",e,e.code);default:throw Xr(e.message,e,e.code)}if(e instanceof Nt)throw Xr("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw Xr("runtime operation error",e,Rn);case"NotSupportedError":throw Xr("runtime unsupported operation",e,Rn);case"TimeoutError":throw Xr("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw Xr("operation aborted",e,"OAUTH_ABORT")}throw new Fr("something went wrong",{cause:e})}async function Jr(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw Wr('"server" must be an instance of URL',Hr);const o=!e.href.includes("/.well-known/"),i=null!==(n=null==t?void 0:t.timeout)&&void 0!==n?n:30,a=AbortSignal.timeout(1e3*i),s=await(o?async function(e,t){return async function(e,t,n,r){if(!(e instanceof URL))throw wt('"'.concat("issuerIdentifier",'" must be an instance of URL'),"ERR_INVALID_ARG_TYPE");Zt(e,!0!==(null==r?void 0:r[gt]));const o=n(new URL(e.href)),i=xt(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[At])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:Ut(o,null==r?void 0:r.signal)})}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=Dt("".concat(e.pathname,"/").concat(".well-known/openid-configuration"))}(e);break;case"oauth2":!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"/"===e.pathname?e.pathname=t:e.pathname=Dt("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw wt('"options.algorithm" must be "oidc" (default), or "oauth2"',"ERR_INVALID_ARG_VALUE")}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[At]:null==t?void 0:t[Gr],[gt]:null==t||null===(r=t.execute)||void 0===r?void 0:r.includes(to),signal:a,headers:new Headers(xr)}):((null==t?void 0:t[Gr])||fetch)((Zt(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(to)),e.href),{headers:Object.fromEntries(new Headers(lt({accept:"application/json"},xr)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Jn)throw wt('"expectedIssuerIdentifier" must be an instance of URL',"ERR_INVALID_ARG_TYPE");if(!yt(t,Response))throw wt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");if(200!==t.status)throw Lt('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',Cn,t);jn(t);const r=await Vn(t);if(Bt(r.issuer,'"response" body "issuer" property',kn,{body:r}),n!==Jn&&new URL(r.issuer).href!==n.href)throw Lt('"response" body "issuer" property does not match the expected value',Dn,{expected:n.href,body:r,attribute:"issuer"});return r}(Jn,e)).catch(Vr);var c;return o&&new URL(s.issuer).href!==e.href&&(function(e,t,n){return!("https://login.microsoftonline.com"!==e.origin||null!=n&&n.algorithm&&"oidc"!==n.algorithm||(t[zr]=!0,0))}(e,s,t)||function(e,t){return!(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)}(e,t)||(()=>{throw new Fr("discovered metadata issuer does not match the expected issuer",{code:Dn,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new Yr(i,t,n,r);let s=Dr(a);if(null!=o&&o[Gr]&&(s.fetch=o[Gr]),null!=o&&o.timeout&&(s.timeout=o.timeout),null!=o&&o.execute)for(const e of o.execute)e(a);return a}new TextDecoder;const zr=Symbol();class Yr{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw Wr('"clientId" must be a non-empty string',Hr);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(o=n)||void 0===o?void 0:o.client_id)&&t!==n.client_id)throw Wr('"clientId" and "metadata.client_id" must be the same',Kr);const u=lt(lt({},structuredClone(n)),{},{client_id:t});let l;u[bt]=null!==(i=null===(a=n)||void 0===a?void 0:a[bt])&&void 0!==i?i:0,u[vt]=null!==(s=null===(c=n)||void 0===c?void 0:c[vt])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?jr(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);zr in e&&(h[zn]=t=>{let{claims:{tid:n}}=t;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);Mr||(Mr=new WeakMap),Mr.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(Dr(this).as);return function(e){Object.defineProperties(e,function(e){return{supportsPKCE:{__proto__:null,value(){var t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"S256";return!0===(null===(t=e.code_challenge_methods_supported)||void 0===t?void 0:t.includes(n))}}}}(e))}(e),e}clientMetadata(){return structuredClone(Dr(this).c)}get timeout(){return Dr(this).timeout}set timeout(e){Dr(this).timeout=e}get[Gr](){return Dr(this).fetch}set[Gr](e){Dr(this).fetch=e}}function Zr(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}return{expiresIn:{__proto__:null,value(){if(t){const e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return fn(this)}catch(e){return}}}}}(e))}async function qr(e,t,n){var r;let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===(r=e.headers.get("retry-after"))||void 0===r?void 0:r.trim();if(void 0===i)return;let a;if(/^\d+$/.test(i))a=parseInt(i,10);else{const e=new Date(i);if(Number.isFinite(e.getTime())){const t=new Date,n=e.getTime()-t.getTime();n>0&&(a=Math.ceil(n/1e3))}}if(o&&!Number.isFinite(a))throw new Ct("invalid Retry-After header value",{cause:e});a>t&&await Qr(a-t,n)}function Qr(e,t){return new Promise((n,r)=>{const o=e=>{try{t.throwIfAborted()}catch(e){return void r(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>o(e-i),1e3*i)};o(e)})}async function $r(e,t){so(e);const{as:n,c:r,auth:o,fetch:i,tlsOnly:a,timeout:s}=Dr(e);return async function(e,t,n,r,o){Xt(e),Vt(t);const i=Qt(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[gt])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=xt(null==o?void 0:o.headers);return s.set("accept","application/json"),ln(e,t,n,i,a,s,o)}(n,r,o,t,{[At]:i,[gt]:!a,headers:new Headers(xr),signal:co(s)}).then(e=>async function(e,t,n){if(Xt(e),Vt(t),!yt(n,Response))throw wt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await sn(n,200,"Backchannel Authentication Endpoint"),jn(n);const r=await Vn(n);Bt(r.auth_req_id,'"response" body "auth_req_id" property',kn,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return Mt(o,!0,'"response" body "expires_in" property',kn,{body:r}),r.expires_in=o,void 0!==r.interval&&Mt(r.interval,!1,'"response" body "interval" property',kn,{body:r}),r}(n,r,e)).catch(Vr)}async function eo(e,t,n,r){var o,i;so(e),n=new URLSearchParams(n);let a=null!==(o=t.interval)&&void 0!==o?o:5;const s=null!==(i=null==r?void 0:r.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await Qr(a,s)}catch(e){Vr(e)}const{as:c,c:u,auth:l,fetch:d,tlsOnly:h,nonRepudiation:p,timeout:f,decrypt:m}=Dr(e),y=(o,i)=>eo(e,lt(lt({},t),{},{interval:o}),n,lt(lt({},r),{},{signal:s,flag:i})),w=await async function(e,t,n,r,o){Xt(e),Vt(t),Bt(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),dn(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(c,u,l,t.auth_req_id,{[At]:d,[gt]:!h,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(xr),signal:s.aborted?s:co(f)}).catch(Vr);var g;if(503===w.status&&w.headers.has("retry-after"))return await qr(w,a,s,!0),await(null===(g=w.body)||void 0===g?void 0:g.cancel()),y(a);const b=async function(e,t,n,r){return mn(e,t,n,void 0,null==r?void 0:r[St],null==r?void 0:r.recognizedTokenTypes)}(c,u,w,{[St]:m});let v;try{v=await b}catch(e){if(uo(e,r))return y(a,lo);if(e instanceof $t)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await qr(e.response,a,s),y(a)}Vr(e)}return v.id_token&&await(null==p?void 0:p(w)),Zr(v),v}function to(e){Dr(e).tlsOnly=!1}async function no(e,t,n,r,o){if(so(e),!((null==o?void 0:o.flag)===lo||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw Wr('"currentUrl" must be an instance of URL, or Request',Hr);let i,a;const{as:s,c,auth:u,fetch:l,tlsOnly:d,jarm:h,hybrid:p,nonRepudiation:f,timeout:m,decrypt:y,implicit:w}=Dr(e);if((null==o?void 0:o.flag)===lo)i=o.authResponse,a=o.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(t=new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await async function(e){if("POST"!==e.method)throw wt("form_post responses are expected to use the POST method","ERR_INVALID_ARG_VALUE",{cause:e});if("application/x-www-form-urlencoded"!==un(e))throw wt("form_post responses are expected to use the application/x-www-form-urlencoded content-type","ERR_INVALID_ARG_VALUE",{cause:e});return async function(e){if(e.bodyUsed)throw wt("form_post Request instances must contain a readable body","ERR_INVALID_ARG_VALUE",{cause:e});return e.text()}(e)}(e));if(p)t.hash=n.toString();else for(const[e,r]of n.entries())t.searchParams.append(e,r);break;default:throw Wr("unexpected Request HTTP method",Kr)}}switch(a=function(e){return(e=new URL(e)).search="",e.hash="",e.href}(t),!0){case!!h:i=await h(t,null==n?void 0:n.expectedState);break;case!!p:i=await p(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!w:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{i=function(e,t,n,r){if(Xt(e),Vt(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw wt('"parameters" must be an instance of URLSearchParams, or URL',"ERR_INVALID_ARG_TYPE");if(Wn(n,"response"))throw Lt('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',kn,{parameters:n});const o=Wn(n,"iss"),i=Wn(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw Lt('response parameter "iss" (issuer) missing',kn,{parameters:n});if(o&&o!==e.issuer)throw Lt('unexpected "iss" (issuer) response parameter value',kn,{expected:e.issuer,parameters:n});switch(r){case void 0:case Xn:if(void 0!==i)throw Lt('unexpected "state" response parameter encountered',kn,{expected:void 0,parameters:n});break;case Fn:break;default:if(Bt(r,'"expectedState" argument'),i!==r)throw Lt(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',kn,{expected:r,parameters:n})}if(Wn(n,"error"))throw new en("authorization response from the server is an error",{cause:n});const a=Wn(n,"id_token"),s=Wn(n,"token");if(void 0!==a||void 0!==s)throw new Nt("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),gn.add(c),c;var c}(s,c,t.searchParams,null==n?void 0:n.expectedState)}catch(e){Vr(e)}}}const g=await async function(e,t,n,r,o,i,a){if(Xt(e),Vt(t),!gn.has(r))throw wt('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',"ERR_INVALID_ARG_VALUE");Bt(o,'"redirectUri"');const s=Wn(r,"code");if(!s)throw Lt('no authorization code in "callbackParameters"',kn);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==bn&&(Bt(i,'"codeVerifier"'),c.set("code_verifier",i)),dn(e,t,n,"authorization_code",c,a)}(s,c,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||bn,{additionalParameters:r,[At]:l,[gt]:!d,DPoP:null==o?void 0:o.DPoP,headers:new Headers(xr),signal:co(m)}).catch(Vr);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const b=async function(e,t,n,r){return"string"==typeof(null==r?void 0:r.expectedNonce)||"number"==typeof(null==r?void 0:r.maxAge)||null!=r&&r.requireIdToken?async function(e,t,n,r,o,i,a){const s=[];switch(r){case void 0:r=En;break;case En:break;default:Bt(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||(o=t.default_max_age),o){case void 0:o=Sn;break;case Sn:break;default:Mt(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await mn(e,t,n,s,i,a);Bt(c.id_token,'"response" body "id_token" property',kn,{body:c});const u=fn(c);if(o!==Sn){const e=Ft()+Ht(t),n=Wt(t);if(u.auth_time+o{let n;return"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(n={n_a:()=>{}}),async function(e,t,n,r){return mn(e,t,n,void 0,null==r?void 0:r[St],null==r?void 0:r.recognizedTokenTypes)}(o,i,e,{[St]:l,recognizedTokenTypes:n})}).catch(Vr);return Zr(d),d}async function po(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;i=void 0!==n?new Map([...Object.entries(n),...t.entries()]):t;for(const t of r.crit){if(!i.has(t))throw new or('Extension Header Parameter "'.concat(t,'" is not recognized'));if(void 0===o[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i.get(t)&&void 0===r[t])throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return new Set(r.crit)}(ir,new Map([["b64",!0]]),null==n?void 0:n.crit,r,o);let a=!0;if(i.has("b64")&&(a=r.b64,"boolean"!=typeof a))throw new ir('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=o;if("string"!=typeof s||!s)throw new ir('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=n&&function(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat("algorithms",'" option must be an array of strings'));if(t)return new Set(t)}(0,n.algorithms);if(c&&!c.has(s))throw new rr('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof e.payload)throw new ir("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new ir("JWS Payload must be a string or an Uint8Array instance");let u=!1;"function"==typeof t&&(t=await t(r,e),u=!0),function(e,t,n){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((e,t,n)=>{if(!(t instanceof Uint8Array)){if(Or(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&Cr(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!br(t))throw new TypeError(yr(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(Nr(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(Or(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&Cr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if((e=>"oct"!==e.kty&&void 0===e.d&&void 0===e.priv)(t)&&Cr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!br(t))throw new TypeError(yr(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(Nr(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(Nr(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(Nr(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(Nr(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(Nr(t),' instances for asymmetric algorithm encryption must be of type "public"'))}})(e,t,n)}}(s,t,"verify");const l=function(){for(var e=arguments.length,t=new Array(e),n=0;n{let{length:n}=t;return e+n},0),o=new Uint8Array(r);let i=0;for(const e of t)o.set(e,i),i+=e.length;return o}(void 0!==e.protected?qn(e.protected):new Uint8Array,qn("."),"string"==typeof e.payload?a?qn(e.payload):Yn.encode(e.payload):e.payload);let d;try{d=$n(e.signature)}catch(e){throw new ir("Failed to base64url decode the signature")}const h=await async function(e,t){if(e instanceof Uint8Array)return e;if(wr(e))return e;if(gr(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{Ir||(Ir=new WeakMap);let n=Ir.get(e);if(null!=n&&n[t])return n[t];const r="public"===e.type,o=!!r;let i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError("given KeyObject instance cannot be used for this algorithm");i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError("given KeyObject instance cannot be used for this algorithm");i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let n;switch(t){case"RSA-OAEP":n="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":n="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":n="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":n="SHA-512";break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:n},o,r?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:n},o,[r?"verify":"sign"])}if("ec"===e.asymmetricKeyType){var a;const n=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(null===(a=e.asymmetricKeyDetails)||void 0===a?void 0:a.namedCurve);if(!n)throw new TypeError("given KeyObject instance cannot be used for this algorithm");"ES256"===t&&"P-256"===n&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),"ES384"===t&&"P-384"===n&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),"ES512"===t&&"P-521"===n&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:n},o,r?[]:["deriveBits"]))}if(!i)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return n?n[t]=i:Ir.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return kr(e,n,t)}if(Or(e))return e.k?$n(e.k):kr(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await po(e,t,"verify");!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if("number"!=typeof n||n<2048)throw new TypeError("".concat(e," requires key modulusLength to be 2048 bits or larger"))}}(e,o);const i=function(e,t){const n="SHA-".concat(e.slice(-3));switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new or("alg ".concat(e," is not supported either by JOSE or your javascript runtime"))}}(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch(e){return!1}}(s,h,d,l))throw new dr;let p;if(a)try{p=$n(e.payload)}catch(e){throw new ir("Failed to base64url decode the payload")}else p="string"==typeof e.payload?Yn.encode(e.payload):e.payload;const f={payload:p};return void 0!==e.protected&&(f.protectedHeader=r),void 0!==e.header&&(f.unprotectedHeader=e.header),u?lt(lt({},f),{},{key:h}):f}const mo=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function yo(e){const t=mo.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]);let r;switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":r=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":r=Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":r=Math.round(3600*n);break;case"day":case"days":case"d":r=Math.round(86400*n);break;case"week":case"weeks":case"w":r=Math.round(604800*n);break;default:r=Math.round(31557600*n)}return"-"===t[1]||"ago"===t[4]?-r:r}const wo=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());async function go(e,t,n){var r;const o=await async function(e,t,n){if(e instanceof Uint8Array&&(e=Zn.decode(e)),"string"!=typeof e)throw new ir("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:i,length:a}=e.split(".");if(3!==a)throw new ir("Invalid Compact JWS");const s=await fo({payload:o,protected:r,signature:i},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?lt(lt({},c),{},{key:s.key}):c}(e,t,n);if(null!==(r=o.protectedHeader.crit)&&void 0!==r&&r.includes("b64")&&!1===o.protectedHeader.b64)throw new ar("JWTs MUST NOT use unencoded payload");const i=function(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(Zn.decode(t))}catch(e){}if(!vr(n))throw new ar("JWT Claims Set must be a top-level JSON object");const{typ:o}=r;if(o&&("string"!=typeof e.typ||wo(e.typ)!==wo(o)))throw new tr('unexpected "typ" JWT header value',n,"typ","check_failed");const{requiredClaims:i=[],issuer:a,subject:s,audience:c,maxTokenAge:u}=r,l=[...i];void 0!==u&&l.push("iat"),void 0!==c&&l.push("aud"),void 0!==s&&l.push("sub"),void 0!==a&&l.push("iss");for(const e of new Set(l.reverse()))if(!(e in n))throw new tr('missing required "'.concat(e,'" claim'),n,e,"missing");if(a&&!(Array.isArray(a)?a:[a]).includes(n.iss))throw new tr('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new tr('unexpected "sub" claim value',n,"sub","check_failed");if(c&&!((e,t)=>"string"==typeof e?t.includes(e):!!Array.isArray(e)&&t.some(Set.prototype.has.bind(new Set(e))))(n.aud,"string"==typeof c?[c]:c))throw new tr('unexpected "aud" claim value',n,"aud","check_failed");let d;switch(typeof r.clockTolerance){case"string":d=yo(r.clockTolerance);break;case"number":d=r.clockTolerance;break;case"undefined":d=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:h}=r,p=(e=>Math.floor(e.getTime()/1e3))(h||new Date);if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new tr('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new tr('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>p+d)throw new tr('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new tr('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=p-d)throw new nr('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){const e=p-n.iat;if(e-d>("number"==typeof u?u:yo(u)))throw new nr('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-d)throw new tr('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}(o.protectedHeader,o.payload,n),a={payload:i,protectedHeader:o.protectedHeader};return"function"==typeof t?lt(lt({},a),{},{key:o.key}):a}function bo(e){return vr(e)}var vo,Ao,Eo=new WeakMap,So=new WeakMap;class To{constructor(e){if(at(this,Eo,void 0),at(this,So,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(bo)}(e))throw new sr("JSON Web Key Set malformed");st(Eo,this,structuredClone(e))}jwks(){return it(Eo,this)}async getKey(e,t){const{alg:n,kid:r}=lt(lt({},e),null==t?void 0:t.header),o=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new or('Unsupported "alg" value for a JSON Web Key Set')}}(n),i=it(Eo,this).keys.filter(e=>{let t=o===e.kty;if(t&&"string"==typeof r&&(t=r===e.kid),!t||"string"!=typeof e.alg&&"AKP"!==o||(t=n===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t)switch(n){case"ES256":t="P-256"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv;break;case"Ed25519":case"EdDSA":t="Ed25519"===e.crv}return t}),{0:a,length:s}=i;if(0===s)throw new cr;if(1!==s){const e=new ur,t=it(So,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new ht(e.apply(this,arguments))}}(function*(){for(const e of i)try{yield yield rt(_o(t,e,n))}catch(e){}}),e}return _o(it(So,this),a,n)}}async function _o(e,t,n){const r=e.get(t)||e.set(t,{}).get(t);if(void 0===r[n]){const e=await async function(e,t){if(!vr(e))throw new TypeError("JWK must be an object");let n;switch(null!=t||(t=e.alg),null!=n||(n=e.ext),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return $n(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new or('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return Rr(lt(lt({},e),{},{alg:t,ext:n}));case"AKP":if("string"!=typeof e.alg||!e.alg)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw new TypeError("JWK alg and alg option value mismatch");return Rr(lt(lt({},e),{},{ext:n}));case"EC":case"OKP":return Rr(lt(lt({},e),{},{alg:t,ext:n}));default:throw new or('Unsupported "kty" (Key Type) Parameter value')}}(lt(lt({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new sr("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function Ro(e){const t=new To(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>structuredClone(t.jwks()),enumerable:!1,configurable:!1,writable:!1}}),n}let Oo;if("undefined"==typeof navigator||null===(vo=navigator.userAgent)||void 0===vo||null===(Ao=vo.startsWith)||void 0===Ao||!Ao.call(vo,"Mozilla/5.0 ")){const e="v6.1.3";Oo="".concat("jose","/").concat(e)}const Io=Symbol(),ko=Symbol();var No=new WeakMap,Co=new WeakMap,Lo=new WeakMap,Po=new WeakMap,xo=new WeakMap,Uo=new WeakMap,Do=new WeakMap,Mo=new WeakMap,Bo=new WeakMap,jo=new WeakMap;class Go{constructor(e,t){if(at(this,No,void 0),at(this,Co,void 0),at(this,Lo,void 0),at(this,Po,void 0),at(this,xo,void 0),at(this,Uo,void 0),at(this,Do,void 0),at(this,Mo,void 0),at(this,Bo,void 0),at(this,jo,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;st(No,this,new URL(e.href)),st(Co,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),st(Lo,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),st(Po,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),st(Do,this,new Headers(null==t?void 0:t.headers)),Oo&&!it(Do,this).has("User-Agent")&&it(Do,this).set("User-Agent",Oo),it(Do,this).has("accept")||(it(Do,this).set("accept","application/json"),it(Do,this).append("accept","application/jwk-set+json")),st(Mo,this,null==t?void 0:t[Io]),void 0!==(null==t?void 0:t[ko])&&(st(jo,this,null==t?void 0:t[ko]),n=null==t?void 0:t[ko],r=it(Po,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&vr(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,vr)&&(st(xo,this,it(jo,this).uat),st(Bo,this,Ro(it(jo,this).jwks))))}pendingFetch(){return!!it(Uo,this)}coolingDown(){return"number"==typeof it(xo,this)&&Date.now()3&&void 0!==arguments[3]?arguments[3]:fetch;const o=await r(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new lr;throw e});if(200!==o.status)throw new er("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new er("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(it(No,this).href,it(Do,this),AbortSignal.timeout(it(Co,this)),it(Mo,this)).then(e=>{st(Bo,this,Ro(e)),it(jo,this)&&(it(jo,this).uat=Date.now(),it(jo,this).jwks=e),st(xo,this,Date.now()),st(Uo,this,void 0)}).catch(e=>{throw st(Uo,this,void 0),e})),await it(Uo,this)}}const Ko=["mfaToken"],Ho=["mfaToken"];var Wo,Fo,Xo,Vo,Jo,zo,Yo,Zo,qo=class extends Error{constructor(e,t){super(t),ct(this,"code",void 0),this.name="NotSupportedError",this.code=e}},Qo=class extends Error{constructor(e,t,n){super(t),ct(this,"cause",void 0),ct(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},$o=class extends Qo{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},ei=class extends Qo{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},ti=class extends Qo{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},ni=class extends Qo{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},ri=class extends Qo{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},oi=class extends Error{constructor(e){super(e),ct(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},ii=class extends Qo{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),ct(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},ai=class extends Qo{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},si=class extends Qo{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},ci=class extends Qo{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},ui=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),ct(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function li(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).reduce((e,t)=>lt(lt({},e),{},{[t[0]]:t[1]}),{})}var di=class extends Error{constructor(e,t,n){super(t),ct(this,"cause",void 0),ct(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},hi=class extends di{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},pi=class extends di{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},fi=class extends di{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},mi=class extends di{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function yi(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var wi=(Wo=new WeakMap,Fo=new WeakMap,Xo=new WeakMap,class{constructor(e){var t;at(this,Wo,void 0),at(this,Fo,void 0),at(this,Xo,void 0),st(Wo,this,"https://".concat(e.domain)),st(Fo,this,e.clientId),st(Xo,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(it(Wo,this),"/mfa/authenticators"),{mfaToken:n}=e,r=await it(Xo,this).call(this,t,{method:"GET",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!r.ok){const e=await r.json();throw new hi(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(yi)}async enrollAuthenticator(e){const t="".concat(it(Wo,this),"/mfa/associate"),{mfaToken:n}=e,r=dt(e,Ko),o={authenticator_types:r.authenticatorTypes};"oobChannels"in r&&(o.oob_channels=r.oobChannels),"phoneNumber"in r&&r.phoneNumber&&(o.phone_number=r.phoneNumber),"email"in r&&r.email&&(o.email=r.email);const i=await it(Xo,this).call(this,t,{method:"POST",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new pi(e.error_description||"Failed to enroll authenticator",e)}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const{authenticatorId:t,mfaToken:n}=e,r="".concat(it(Wo,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await it(Xo,this).call(this,r,{method:"DELETE",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!o.ok){const e=await o.json();throw new fi(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(it(Wo,this),"/mfa/challenge"),{mfaToken:n}=e,r=dt(e,Ho),o={mfa_token:n,client_id:it(Fo,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await it(Xo,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new mi(e.error_description||"Failed to challenge authenticator",e)}return function(e){const t={challengeType:e.challenge_type};return void 0!==e.oob_code&&(t.oobCode=e.oob_code),void 0!==e.binding_method&&(t.bindingMethod=e.binding_method),t}(await i.json())}}),gi=class e{constructor(e,t,n,r,o,i,a){ct(this,"accessToken",void 0),ct(this,"idToken",void 0),ct(this,"refreshToken",void 0),ct(this,"expiresAt",void 0),ct(this,"scope",void 0),ct(this,"claims",void 0),ct(this,"authorizationDetails",void 0),ct(this,"tokenType",void 0),ct(this,"issuedTokenType",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=r,this.expiresAt=t,this.scope=o,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,r=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return r.tokenType=t.token_type,r.issuedTokenType=t.issued_token_type,r}},bi="openid profile email offline_access",vi=Object.freeze(new Set(["grant_type","client_id","client_secret","client_assertion","client_assertion_type","subject_token","subject_token_type","requested_token_type","actor_token","actor_token_type","audience","aud","resource","resources","resource_indicator","scope","connection","login_hint","organization","assertion"]));function Ai(e){if(null==e)throw new ri("subject_token is required");if("string"!=typeof e)throw new ri("subject_token must be a string");if(0===e.trim().length)throw new ri("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new ri("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new ri("subject_token must not include the 'Bearer ' prefix")}function Ei(e,t){if(t)for(const[n,r]of Object.entries(t))if(!vi.has(n))if(Array.isArray(r)){if(r.length>20)throw new ri("Parameter '".concat(n,"' exceeds maximum array size of ").concat(20));r.forEach(t=>{e.append(n,t)})}else e.append(n,r)}var Si=(Vo=new WeakMap,Jo=new WeakMap,zo=new WeakMap,Yo=new WeakMap,Zo=new WeakSet,class{constructor(e){if(function(e,t){ot(e,t),t.add(e)}(this,Zo),at(this,Vo,void 0),at(this,Jo,void 0),at(this,zo,void 0),at(this,Yo,void 0),ct(this,"mfa",void 0),st(zo,this,e),e.useMtls&&!e.customFetch)throw new qo("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");this.mfa=new wi({domain:it(zo,this).domain,clientId:it(zo,this).clientId,customFetch:it(zo,this).customFetch})}async buildAuthorizationUrl(e){const{serverMetadata:t}=await nt(Zo,this,Ti).call(this);if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new qo("par_not_supported_error","The Auth0 tenant does not have pushed authorization requests enabled. Learn how to enable it here: https://auth0.com/docs/get-started/applications/configure-par");try{return await nt(Zo,this,Ii).call(this,e)}catch(e){throw new ai(e)}}async buildLinkUserUrl(e){try{const t=await nt(Zo,this,Ii).call(this,{authorizationParams:lt(lt({},e.authorizationParams),{},{requested_connection:e.connection,requested_connection_scope:e.connectionScope,scope:"openid link_account offline_access",id_token_hint:e.idToken})});return{linkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new si(e)}}async buildUnlinkUserUrl(e){try{const t=await nt(Zo,this,Ii).call(this,{authorizationParams:lt(lt({},e.authorizationParams),{},{requested_connection:e.connection,scope:"openid unlink_account",id_token_hint:e.idToken})});return{unlinkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new ci(e)}}async backchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await nt(Zo,this,Ti).call(this),r=li(lt(lt({},it(zo,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(lt(lt({scope:bi},r),{},{client_id:it(zo,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:n.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&o.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&o.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await $r(t,o),n=await eo(t,e);return gi.fromTokenEndpointResponse(n)}catch(e){throw new ii(e)}}async initiateBackchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await nt(Zo,this,Ti).call(this),r=li(lt(lt({},it(zo,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(lt(lt({scope:bi},r),{},{client_id:it(zo,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:n.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&o.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&o.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await $r(t,o);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new ii(e)}}async backchannelAuthenticationGrant(e){let{authReqId:t}=e;const{configuration:n}=await nt(Zo,this,Ti).call(this),r=new URLSearchParams({auth_req_id:t});try{const e=await ho(n,"urn:openid:params:grant-type:ciba",r);return gi.fromTokenEndpointResponse(e)}catch(e){throw new ii(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new ni("Either a refresh or access token should be specified, but not both.");const n=null!==(t=e.accessToken)&&void 0!==t?t:e.refreshToken;if(!n)throw new ni("Either a refresh or access token must be specified.");try{return await this.exchangeToken({connection:e.connection,subjectToken:n,subjectTokenType:e.accessToken?"urn:ietf:params:oauth:token-type:access_token":"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof ri)throw new ni(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?nt(Zo,this,_i).call(this,e):nt(Zo,this,Ri).call(this,e)}async getTokenByCode(e,t){const{configuration:n}=await nt(Zo,this,Ti).call(this);try{const r=await no(n,e,{pkceCodeVerifier:t.codeVerifier});return gi.fromTokenEndpointResponse(r)}catch(e){throw new $o("There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){const{configuration:t}=await nt(Zo,this,Ti).call(this);try{const n=await ro(t,e.refreshToken);return gi.fromTokenEndpointResponse(n)}catch(e){throw new ti("The access token has expired and there was an error while trying to refresh it.",e)}}async getTokenByClientCredentials(e){const{configuration:t}=await nt(Zo,this,Ti).call(this);try{const n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);const r=await oo(t,n);return gi.fromTokenEndpointResponse(r)}catch(e){throw new ei("There was an error while trying to request a token.",e)}}async buildLogoutUrl(e){const{configuration:t,serverMetadata:n}=await nt(Zo,this,Ti).call(this);if(!n.end_session_endpoint){const t=new URL("https://".concat(it(zo,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",it(zo,this).clientId),t}return function(e,t){so(e);const{as:n,c:r,tlsOnly:o}=Dr(e),i=Qt(n,"end_session_endpoint",!1,o);(t=new URLSearchParams(t)).has("client_id")||t.set("client_id",r.client_id);for(const[e,n]of t.entries())i.searchParams.append(e,n);return i}(t,{post_logout_redirect_uri:e.returnTo})}async verifyLogoutToken(e){const{serverMetadata:t}=await nt(Zo,this,Ti).call(this);it(Yo,this)||st(Yo,this,function(e,t){const n=new Go(e,t),r=async(e,t)=>n.getKey(e,t);return Object.defineProperties(r,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>n.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>n.jwks(),enumerable:!0,configurable:!1,writable:!1}}),r}(new URL(t.jwks_uri),{[Io]:it(zo,this).customFetch}));const{payload:n}=await go(e.logoutToken,it(Yo,this),{issuer:t.issuer,audience:it(zo,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]});if(!("sid"in n)&&!("sub"in n))throw new oi('either "sid" or "sub" (or both) claims must be present');if("sid"in n&&"string"!=typeof n.sid)throw new oi('"sid" claim must be a string');if("sub"in n&&"string"!=typeof n.sub)throw new oi('"sub" claim must be a string');if("nonce"in n)throw new oi('"nonce" claim is prohibited');if(!("events"in n))throw new oi('"events" claim is missing');if("object"!=typeof n.events||null===n.events)throw new oi('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in n.events))throw new oi('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof n.events["http://schemas.openid.net/event/backchannel-logout"])throw new oi('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:n.sid,sub:n.sub}}});async function Ti(){if(it(Vo,this)&&it(Jo,this))return{configuration:it(Vo,this),serverMetadata:it(Jo,this)};const e=await nt(Zo,this,Oi).call(this);return st(Vo,this,await Jr(new URL("https://".concat(it(zo,this).domain)),it(zo,this).clientId,{use_mtls_endpoint_aliases:it(zo,this).useMtls},e,{[Gr]:it(zo,this).customFetch})),st(Jo,this,it(Vo,this).serverMetadata()),it(Vo,this)[Gr]=it(zo,this).customFetch||fetch,{configuration:it(Vo,this),serverMetadata:it(Jo,this)}}async function _i(e){var t,n;const{configuration:r}=await nt(Zo,this,Ti).call(this);if("audience"in e||"resource"in e)throw new ri("audience and resource parameters are not supported for Token Vault exchanges");Ai(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(t=e.subjectTokenType)&&void 0!==t?t:"urn:ietf:params:oauth:token-type:access_token",requested_token_type:null!==(n=e.requestedTokenType)&&void 0!==n?n:"http://auth0.com/oauth/token-type/federated-connection-access-token"});e.loginHint&&o.append("login_hint",e.loginHint),e.scope&&o.append("scope",e.scope),Ei(o,e.extra);try{const e=await ho(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return gi.fromTokenEndpointResponse(e)}catch(t){throw new ri("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function Ri(e){const{configuration:t}=await nt(Zo,this,Ti).call(this);Ai(e.subjectToken);const n=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.requestedTokenType&&n.append("requested_token_type",e.requestedTokenType),e.organization&&n.append("organization",e.organization),Ei(n,e.extra);try{const e=await ho(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return gi.fromTokenEndpointResponse(e)}catch(t){throw new ri("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function Oi(){if(!it(zo,this).clientSecret&&!it(zo,this).clientAssertionSigningKey&&!it(zo,this).useMtls)throw new ui;if(it(zo,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=it(zo,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||(e=await async function(e,t){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return _r(e,t,void 0)}(e,it(zo,this).clientAssertionSigningAlg||"RS256")),e?function(e){return zt(e,void 0)}(e):jr(it(zo,this).clientSecret)}async function Ii(e){const{configuration:t}=await nt(Zo,this,Ti).call(this),n=Gt(),r=await function(e){return async function(e){return Bt(e,"codeVerifier"),kt(await crypto.subtle.digest("SHA-256",Rt(e)))}(e)}(n),o=li(lt(lt({},it(zo,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(lt(lt({scope:bi},o),{},{client_id:it(zo,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await ao(t,i):await io(t,i),codeVerifier:n}}class ki extends x{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ki.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new ki(t,n)}}class Ni extends ki{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ni.prototype)}}class Ci extends ki{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ci.prototype)}}class Li extends ki{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Li.prototype)}}class Pi extends ki{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Pi.prototype)}}class xi extends ki{constructor(e,t){super(e,t),Object.setPrototypeOf(this,xi.prototype)}}class Ui{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e5;this.contexts=new Map,this.ttlMs=e}set(e,t){this.cleanup(),this.contexts.set(e,Object.assign(Object.assign({},t),{createdAt:Date.now()}))}get(e){const t=this.contexts.get(e);if(t){if(!(Date.now()-t.createdAt>this.ttlMs))return t;this.contexts.delete(e)}}remove(e){this.contexts.delete(e)}cleanup(){const e=Date.now();for(const[t,n]of this.contexts)e-n.createdAt>this.ttlMs&&this.contexts.delete(t)}get size(){return this.contexts.size}}class Di{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new Ui}setMFAAuthDetails(e,t,n,r){this.contextManager.set(e,{scope:t,audience:n,mfaRequirements:r})}async getAuthenticators(e){var t,n;const r=this.contextManager.get(e);if(!(null===(t=null==r?void 0:r.mfaRequirements)||void 0===t?void 0:t.challenge)||0===r.mfaRequirements.challenge.length)throw new Ni("invalid_request","challengeType is required and must contain at least one challenge type, please check mfa_required error payload");const o=r.mfaRequirements.challenge.map(e=>e.type);try{return(await this.authJsMfaClient.listAuthenticators({mfaToken:e})).filter(e=>!!e.type&&o.includes(e.type))}catch(e){if(e instanceof hi)throw new Ni(null===(n=e.cause)||void 0===n?void 0:n.error,e.message);throw e}}async enroll(e){var t;const n=function(e){const t=et[e.factorType];return Object.assign(Object.assign(Object.assign({mfaToken:e.mfaToken,authenticatorTypes:t.authenticatorTypes},t.oobChannels&&{oobChannels:t.oobChannels}),"phoneNumber"in e&&{phoneNumber:e.phoneNumber}),"email"in e&&{email:e.email})}(e);try{return await this.authJsMfaClient.enrollAuthenticator(n)}catch(e){if(e instanceof pi)throw new Ci(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async challenge(e){var t;try{const t={challengeType:e.challengeType,mfaToken:e.mfaToken};return e.authenticatorId&&(t.authenticatorId=e.authenticatorId),await this.authJsMfaClient.challengeAuthenticator(t)}catch(e){if(e instanceof mi)throw new Li(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async getEnrollmentFactors(e){const t=this.contextManager.get(e);if(!t||!t.mfaRequirements)throw new xi("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");return t.mfaRequirements.enroll&&0!==t.mfaRequirements.enroll.length?t.mfaRequirements.enroll:[]}async verify(e){const t=this.contextManager.get(e.mfaToken);if(!t)throw new Pi("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");const n=function(e){return"otp"in e&&e.otp?"http://auth0.com/oauth/grant-type/mfa-otp":"oobCode"in e&&e.oobCode?"http://auth0.com/oauth/grant-type/mfa-oob":"recoveryCode"in e&&e.recoveryCode?"http://auth0.com/oauth/grant-type/mfa-recovery-code":void 0}(e);if(!n)throw new Pi("invalid_request","Unable to determine grant type. Provide one of: otp, oobCode, or recoveryCode.");const r=t.scope,o=t.audience;try{const t=await this.auth0Client._requestTokenForMfa({grant_type:n,mfaToken:e.mfaToken,scope:r,audience:o,otp:e.otp,oob_code:e.oobCode,binding_code:e.bindingCode,recovery_code:e.recoveryCode});return this.contextManager.remove(e.mfaToken),t}catch(e){if(e instanceof K)this.setMFAAuthDetails(e.mfa_token,r,o,e.mfa_requirements);else if(e instanceof Pi)throw new Pi(e.error,e.error_description);throw e}}}const Mi=new N;class Bi{constructor(e){let t,n;if(this.userCache=(new Se).enclosedCache,this.activeLockKeys=new Set,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{const e=Array.from(this.activeLockKeys);for(const t of e)await Mi.releaseLock(t);this.activeLockKeys.clear(),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),"undefined"!=typeof window&&(()=>{if(!V())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===V().subtle)throw new Error("\n auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.\n ")})(),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(t=e.cacheLocation||"memory",!Fe(t))throw new Error('Invalid cache location "'.concat(t,'"'));n=Fe(t)()}var r;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===e.legacySameSiteCookie?xe:Ue,this.orgHintCookieName=(r=this.options.clientId,"auth0.".concat(r,".organization_hint")),this.isAuthenticatedCookieName=(e=>"auth0.".concat(e,".is.authenticated"))(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const o=e.useCookiesForTransactions?this.cookieStorage:De;var i;this.scope=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o{const o=e[n];i[n]=be(t,o,...r)}),i}(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new _e(o,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||P,this.cacheManager=new Te(n,n.allKeys?void 0:new He(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new Ye(this.options.clientId):void 0,this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:"https://".concat(i)),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:"https://".concat(e,"/"):"".concat(t,"/"))(this.options.issuer,this.domainUrl);const a="".concat(this.domainUrl,"/me/"),s=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{getAccessToken:()=>this.getTokenSilently({authorizationParams:{scope:"create:me:connected_accounts",audience:a},detailedResponse:!0})}));this.myAccountApi=new Qe(s,a),this.authJsClient=new Si({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new Di(this.authJsClient.mfa,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&"memory"===t&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new je)}getConfiguration(){return Object.freeze({domain:this.options.domain,clientId:this.options.clientId})}_url(e){const t=this.options.auth0Client||L,n=Z(t,!0),r=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(r)}_authorizeUrl(e){return this._url("/authorize?".concat(q(e)))}async _verifyIdToken(e,t,n){const r=await this.nowProvider();return(e=>{if(!e.id_token)throw new Error("ID token is required but missing");const t=(e=>{const t=e.split("."),[n,r,o]=t;if(3!==t.length||!n||!r||!o)throw new Error("ID token could not be decoded");const i=JSON.parse($(r)),a={__raw:e},s={};return Object.keys(i).forEach(e=>{a[e]=i[e],Oe.includes(e)||(s[e]=i[e])}),{encoded:{header:n,payload:r,signature:o},header:JSON.parse($(n)),claims:a,user:s}})(e.id_token);if(!t.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(t.claims.iss!==e.iss)throw new Error('Issuer (iss) claim mismatch in the ID token; expected "'.concat(e.iss,'", found "').concat(t.claims.iss,'"'));if(!t.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if("RS256"!==t.header.alg)throw new Error('Signature algorithm of "'.concat(t.header.alg,'" is not supported. Expected the ID token to be signed with "RS256".'));if(!t.claims.aud||"string"!=typeof t.claims.aud&&!Array.isArray(t.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e.aud))throw new Error('Audience (aud) claim mismatch in the ID token; expected "'.concat(e.aud,'" but was not one of "').concat(t.claims.aud.join(", "),'"'));if(t.claims.aud.length>1){if(!t.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(t.claims.azp!==e.aud)throw new Error('Authorized Party (azp) claim mismatch in the ID token; expected "'.concat(e.aud,'", found "').concat(t.claims.azp,'"'))}}else if(t.claims.aud!==e.aud)throw new Error('Audience (aud) claim mismatch in the ID token; expected "'.concat(e.aud,'" but found "').concat(t.claims.aud,'"'));if(e.nonce){if(!t.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(t.claims.nonce!==e.nonce)throw new Error('Nonce (nonce) claim mismatch in the ID token; expected "'.concat(e.nonce,'", found "').concat(t.claims.nonce,'"'))}if(e.max_age&&!Re(t.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(null==t.claims.exp||!Re(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Re(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=e.leeway||60,r=new Date(e.now||Date.now()),o=new Date(0);if(o.setUTCSeconds(t.claims.exp+n),r>o)throw new Error("Expiration Time (exp) claim error in the ID token; current time (".concat(r,") is after expiration time (").concat(o,")"));if(null!=t.claims.nbf&&Re(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),ro)throw new Error("Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (".concat(r,") is after last auth at ").concat(o))}if(e.organization){const n=e.organization.trim();if(n.startsWith("org_")){const e=n;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(e!==t.claims.org_id)throw new Error('Organization ID (org_id) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_id,'"'))}else{const e=n.toLowerCase();if(!t.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(e!==t.claims.org_name)throw new Error('Organization Name (org_name) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_name,'"'))}}return t})({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:t,organization:n,leeway:this.options.leeway,max_age:(o=this.options.authorizationParams.max_age,"string"!=typeof o?o:parseInt(o,10)||void 0),now:r});var o}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(e,t,n){var r;const o=z(J()),i=z(J()),a=J(),s=await Q(a),c=ee(s),u=await(null===(r=this.dpop)||void 0===r?void 0:r.calculateThumbprint()),l=((e,t,n,r,o,i,a,s,c)=>Object.assign(Object.assign(Object.assign({client_id:e.clientId},e.authorizationParams),n),{scope:ve(t,n.scope,n.audience),response_type:"code",response_mode:s||"query",state:r,nonce:o,redirect_uri:a||e.authorizationParams.redirect_uri,code_challenge:i,code_challenge_method:"S256",dpop_jkt:c}))(this.options,this.scope,e,o,i,c,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==t?void 0:t.response_mode,u),d=this._authorizeUrl(l);return{nonce:i,code_verifier:a,scope:l.scope,audience:l.audience||"default",redirect_uri:l.redirect_uri,state:o,url:d}}async loginWithPopup(e,t){var n;if(e=e||{},!(t=t||{}).popup&&(t.popup=(()=>{const e=window.screenX+(window.innerWidth-400)/2,t=window.screenY+(window.innerHeight-600)/2;return window.open("","auth0:authorize:popup","left=".concat(e,",top=").concat(t,",width=").concat(400,",height=").concat(600,",resizable,scrollbars=yes,status=1"))})(),!t.popup))throw new G;const r=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);t.popup.location.href=r.url;const o=await(e=>new Promise((t,n)=>{let r;const o=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(o),clearTimeout(i),window.removeEventListener("message",r,!1),n(new j(e.popup)))},1e3),i=setTimeout(()=>{clearInterval(o),n(new B(e.popup)),window.removeEventListener("message",r,!1)},1e3*(e.timeoutInSeconds||60));r=function(a){if(a.data&&"authorization_response"===a.data.type){if(clearTimeout(i),clearInterval(o),window.removeEventListener("message",r,!1),!1!==e.closePopup&&e.popup.close(),a.data.response.error)return n(x.fromPayload(a.data.response));t(a.data.response)}},window.addEventListener("message",r)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(r.state!==o.state)throw new x("state_mismatch","Invalid state");const i=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:o.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:i})}async getUser(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.user}async getIdTokenClaims(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.claims}async loginWithRedirect(){var e;const t=Xe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{openUrl:n,fragment:r,appState:o}=t,i=w(t,["openUrl","fragment","appState"]),a=(null===(e=i.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,s=await this._prepareAuthorizeUrl(i.authorizationParams||{}),{url:c}=s,u=w(s,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},u),{appState:o,response_type:Me.Code}),a&&{organization:a}));const l=r?"".concat(c,"#").concat(r):c;n?await n(l):window.location.assign(l)}async handleRedirectCallback(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.href).split("?").slice(1);if(0===e.length)throw new Error("There are no query params available for parsing.");const t=this.transactionManager.get();if(!t)throw new x("missing_transaction","Invalid state");this.transactionManager.remove();const n=(e=>{e.indexOf("#")>-1&&(e=e.substring(0,e.indexOf("#")));const t=new URLSearchParams(e);return{state:t.get("state"),code:t.get("code")||void 0,connect_code:t.get("connect_code")||void 0,error:t.get("error")||void 0,error_description:t.get("error_description")||void 0}})(e.join(""));return t.response_type===Me.ConnectCode?this._handleConnectAccountRedirectCallback(n,t):this._handleLoginRedirectCallback(n,t)}async _handleLoginRedirectCallback(e,t){const{code:n,state:r,error:o,error_description:i}=e;if(o)throw new U(o,i||o,r,t.appState);if(!t.code_verifier||t.state&&t.state!==r)throw new x("state_mismatch","Invalid state");const a=t.organization,s=t.nonce,c=t.redirect_uri;return await this._requestToken(Object.assign({audience:t.audience,scope:t.scope,code_verifier:t.code_verifier,grant_type:"authorization_code",code:n},c?{redirect_uri:c}:{}),{nonceIn:s,organization:a}),{appState:t.appState,response_type:Me.Code}}async _handleConnectAccountRedirectCallback(e,t){const{connect_code:n,state:r,error:o,error_description:i}=e;if(o)throw new D(o,i||o,t.connection,r,t.appState);if(!n)throw new x("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===r))throw new x("state_mismatch","Invalid state");const a=await this.myAccountApi.completeAccount({auth_session:t.auth_session,connect_code:n,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier});return Object.assign(Object.assign({},a),{appState:t.appState,response_type:Me.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch(e){}}async getTokenSilently(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t,n;const r=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:ve(this.scope,null===(t=e.authorizationParams)||void 0===t?void 0:t.scope,(null===(n=e.authorizationParams)||void 0===n?void 0:n.audience)||this.options.authorizationParams.audience)})}),o=await((e,t)=>{let n=Ge[t];return n||(n=e().finally(()=>{delete Ge[t],n=null}),Ge[t]=n),n})(()=>this._getTokenSilently(r),"".concat(this.options.clientId,"::").concat(r.authorizationParams.audience,"::").concat(r.authorizationParams.scope));return e.detailedResponse?o:null==o?void 0:o.access_token}async _getTokenSilently(e){const{cacheMode:t}=e,n=w(e,["cacheMode"]);if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId,cacheMode:t});if(e)return e}if("cache-only"===t)return;const r=(o=this.options.clientId,i=n.authorizationParams.audience||"default","".concat("auth0.lock.getTokenSilently",".").concat(o,".").concat(i));var o,i;if(!await Ke(()=>Mi.acquireLock(r,5e3),10))throw new M;this.activeLockKeys.add(r),1===this.activeLockKeys.size&&window.addEventListener("pagehide",this._releaseLockOnPageHide);try{if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:r,token_type:o,access_token:i,oauthTokenScope:a,expires_in:s}=e;return Object.assign(Object.assign({id_token:r,token_type:o,access_token:i},a?{scope:a}:null),{expires_in:s})}finally{await Mi.releaseLock(r),this.activeLockKeys.delete(r),0===this.activeLockKeys.size&&window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}async getTokenWithPopup(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n,r;const o=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:ve(this.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.scope,(null===(r=e.authorizationParams)||void 0===r?void 0:r.audience)||this.options.authorizationParams.audience)})});return t=Object.assign(Object.assign({},C),t),await this.loginWithPopup(o,t),(await this.cacheManager.get(new Ae({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||"default",clientId:this.options.clientId}),void 0,this.options.useMrrt)).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){null!==e.clientId?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const t=e.logoutParams||{},{federated:n}=t,r=w(t,["federated"]),o=n?"&federated":"";return this._url("/v2/logout?".concat(q(Object.assign({clientId:e.clientId},r))))+o}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const n=Xe(e),{openUrl:r}=n,o=w(n,["openUrl"]);null===e.clientId?await this.cacheManager.clear():await this.cacheManager.clear(e.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@"),await(null===(t=this.dpop)||void 0===t?void 0:t.clear());const i=this._buildLogoutUrl(o);r?await r(i):!1!==r&&window.location.assign(i)}async _getTokenFromIFrame(e){const t=(n=this.options.clientId,"".concat("auth0.lock.getTokenFromIFrame",".").concat(n));var n;if(!await Ke(()=>Mi.acquireLock(t,5e3),10))throw new M;try{const t=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);const{url:r,state:o,nonce:i,code_verifier:a,redirect_uri:s,scope:c,audience:u}=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin);if(window.crossOriginIsolated)throw new x("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const l=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;let d;try{d=new URL(this.domainUrl).origin}catch(e){d=this.domainUrl}const h=await function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60;return new Promise((r,o)=>{const i=window.document.createElement("iframe");i.setAttribute("width","0"),i.setAttribute("height","0"),i.style.display="none";const a=()=>{window.document.body.contains(i)&&(window.document.body.removeChild(i),window.removeEventListener("message",s,!1))};let s;const c=setTimeout(()=>{o(new M),a()},1e3*n);s=function(e){if(e.origin!=t)return;if(!e.data||"authorization_response"!==e.data.type)return;const n=e.source;n&&n.close(),e.data.response.error?o(x.fromPayload(e.data.response)):r(e.data.response),clearTimeout(c),window.removeEventListener("message",s,!1),setTimeout(a,2e3)},window.addEventListener("message",s,!1),window.document.body.appendChild(i),i.setAttribute("src",e)})}(r,d,l);if(o!==h.state)throw new x("state_mismatch","Invalid state");const p=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:a,code:h.code,grant_type:"authorization_code",redirect_uri:s,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:i,organization:t.organization});return Object.assign(Object.assign({},p),{scope:c,oauthTokenScope:p.scope,audience:u})}catch(e){throw"login_required"===e.error&&this.logout({openUrl:!1}),e}finally{await Mi.releaseLock(t)}}async _getTokenUsingRefreshToken(e){var t,n;const r=await this.cacheManager.get(new Ae({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(r&&r.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new H(e.authorizationParams.audience||"default",e.authorizationParams.scope)}const o=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,i="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null,a=((e,t,n,r)=>{var o;if(e&&n&&r){if(t.audience!==n)return t.scope;const e=r.split(" "),i=(null===(o=t.scope)||void 0===o?void 0:o.split(" "))||[],a=i.every(t=>e.includes(t));return e.length>=i.length&&a?r:t.scope}return t.scope})(this.options.useMrrt,e.authorizationParams,null==r?void 0:r.audience,null==r?void 0:r.scope);try{const t=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:r&&r.refresh_token,redirect_uri:o}),i&&{timeout:i}),{scopesToRequest:a});if(t.refresh_token&&(null==r?void 0:r.refresh_token)&&await this.cacheManager.updateEntry(r.refresh_token,t.refresh_token),this.options.useMrrt&&!(s=null==r?void 0:r.audience,c=null==r?void 0:r.scope,u=e.authorizationParams.audience,l=e.authorizationParams.scope,s===u&&Ve(l,c)||Ve(a,t.scope))){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);await this.cacheManager.remove(this.options.clientId,e.authorizationParams.audience,e.authorizationParams.scope);const n=((e,t)=>{const n=(null==e?void 0:e.split(" "))||[],r=(null==t?void 0:t.split(" "))||[];return n.filter(e=>-1==r.indexOf(e)).join(",")})(a,t.scope);throw new W(e.authorizationParams.audience||"default",n)}return Object.assign(Object.assign({},t),{scope:e.authorizationParams.scope,oauthTokenScope:t.scope,audience:e.authorizationParams.audience||"default"})}catch(r){if(r.message){if(r.message.includes("user is blocked"))throw await this.logout({openUrl:!1}),r;if((r.message.includes("Missing Refresh Token")||r.message.includes("invalid refresh token"))&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e)}throw r instanceof K&&this.mfa.setMFAAuthDetails(r.mfa_token,null===(t=e.authorizationParams)||void 0===t?void 0:t.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.audience,r.mfa_requirements),r}var s,c,u,l}async _saveEntryInCache(e){const{id_token:t,decodedToken:n}=e,r=w(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:t,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(r)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||"default",t=this.scope[e],n=await this.cacheManager.getIdToken(new Ae({clientId:this.options.clientId,audience:e,scope:t})),r=this.userCache.get("@@user@@");return n&&n.id_token===(null==r?void 0:r.id_token)?r:(this.userCache.set("@@user@@",n),n)}async _getEntryFromCache(e){let{scope:t,audience:n,clientId:r,cacheMode:o}=e;const i=await this.cacheManager.get(new Ae({scope:t,audience:n,clientId:r}),60,this.options.useMrrt,o);if(i&&i.access_token){const{token_type:e,access_token:t,oauthTokenScope:n,expires_in:r}=i,o=await this._getIdTokenFromCache();return o&&Object.assign(Object.assign({id_token:o.id_token,token_type:e||"Bearer",access_token:t},n?{scope:n}:null),{expires_in:r})}}async _requestToken(e,t){var n,r;const{nonceIn:o,organization:i,scopesToRequest:a}=t||{},s=await ge(Object.assign(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,useMrrt:this.options.useMrrt,dpop:this.dpop},e),{scope:a||e.scope}),this.worker),c=await this._verifyIdToken(s.id_token,o,i);if("authorization_code"===e.grant_type){const e=await this._getIdTokenFromCache();(null===(r=null===(n=null==e?void 0:e.decodedToken)||void 0===n?void 0:n.claims)||void 0===r?void 0:r.sub)&&e.decodedToken.claims.sub!==c.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove("@@user@@"))}return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},s),{decodedToken:c,scope:e.scope,audience:e.audience||"default"}),s.scope?{oauthTokenScope:s.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(i||c.claims.org_id),Object.assign(Object.assign({},s),{decodedToken:c})}async loginWithCustomTokenExchange(e){return this._requestToken(Object.assign(Object.assign({},e),{grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:e.subject_token,subject_token_type:e.subject_token_type,scope:ve(this.scope,e.scope,e.audience||this.options.authorizationParams.audience),audience:e.audience||this.options.authorizationParams.audience,organization:e.organization||this.options.authorizationParams.organization}))}async exchangeToken(e){return this.loginWithCustomTokenExchange(e)}_assertDpop(e){if(!e)throw new Error("`useDpop` option must be enabled before using DPoP.")}getDpopNonce(e){return this._assertDpop(this.dpop),this.dpop.getNonce(e)}setDpopNonce(e,t){return this._assertDpop(this.dpop),this.dpop.setNonce(e,t)}generateDpopProof(e){return this._assertDpop(this.dpop),this.dpop.generateProof(e)}createFetcher(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new qe(e,{isDpopEnabled:()=>!!this.options.useDpop,getAccessToken:e=>{var t;return this.getTokenSilently({authorizationParams:{scope:null===(t=null==e?void 0:e.scope)||void 0===t?void 0:t.join(" "),audience:null==e?void 0:e.audience},detailedResponse:!0})},getDpopNonce:()=>this.getDpopNonce(e.dpopNonceId),setDpopNonce:t=>this.setDpopNonce(t,e.dpopNonceId),generateDpopProof:e=>this.generateDpopProof(e)})}async connectAccountWithRedirect(e){const{openUrl:t,appState:n,connection:r,scopes:o,authorization_params:i,redirectUri:a=this.options.authorizationParams.redirect_uri||window.location.origin}=e;if(!r)throw new Error("connection is required");const s=z(J()),c=J(),u=await Q(c),l=ee(u),{connect_uri:d,connect_params:h,auth_session:p}=await this.myAccountApi.connectAccount({connection:r,scopes:o,redirect_uri:a,state:s,code_challenge:l,code_challenge_method:"S256",authorization_params:i});this.transactionManager.create({state:s,code_verifier:c,auth_session:p,redirect_uri:a,appState:n,connection:r,response_type:Me.ConnectCode});const f=new URL(d);f.searchParams.set("ticket",h.ticket),t?await t(f.toString()):window.location.assign(f)}async _requestTokenForMfa(e,t){const{mfaToken:n}=e,r=w(e,["mfaToken"]);return this._requestToken(Object.assign(Object.assign({},r),{mfa_token:n}),t)}}function ji(e,t){return function(){return e.apply(t,arguments)}}const{toString:Gi}=Object.prototype,{getPrototypeOf:Ki}=Object,{iterator:Hi,toStringTag:Wi}=Symbol,Fi=(Xi=Object.create(null),e=>{const t=Gi.call(e);return Xi[t]||(Xi[t]=t.slice(8,-1).toLowerCase())});var Xi;const Vi=e=>(e=e.toLowerCase(),t=>Fi(t)===e),Ji=e=>t=>typeof t===e,{isArray:zi}=Array,Yi=Ji("undefined");function Zi(e){return null!==e&&!Yi(e)&&null!==e.constructor&&!Yi(e.constructor)&&$i(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const qi=Vi("ArrayBuffer");const Qi=Ji("string"),$i=Ji("function"),ea=Ji("number"),ta=e=>null!==e&&"object"==typeof e,na=e=>{if("object"!==Fi(e))return!1;const t=Ki(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Wi in e||Hi in e)},ra=Vi("Date"),oa=Vi("File"),ia=Vi("Blob"),aa=Vi("FileList"),sa=Vi("URLSearchParams"),[ca,ua,la,da]=["ReadableStream","Request","Response","Headers"].map(Vi);function ha(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),zi(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const fa="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,ma=e=>!Yi(e)&&e!==fa;const ya=(wa="undefined"!=typeof Uint8Array&&Ki(Uint8Array),e=>wa&&e instanceof wa);var wa;const ga=Vi("HTMLFormElement"),ba=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),va=Vi("RegExp"),Aa=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ha(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Ea=Vi("AsyncFunction"),Sa=(Ta="function"==typeof setImmediate,_a=$i(fa.postMessage),Ta?setImmediate:_a?(Ra=`axios@${Math.random()}`,Oa=[],fa.addEventListener("message",({source:e,data:t})=>{e===fa&&t===Ra&&Oa.length&&Oa.shift()()},!1),e=>{Oa.push(e),fa.postMessage(Ra,"*")}):e=>setTimeout(e));var Ta,_a,Ra,Oa;const Ia="undefined"!=typeof queueMicrotask?queueMicrotask.bind(fa):"undefined"!=typeof process&&process.nextTick||Sa,ka={isArray:zi,isArrayBuffer:qi,isBuffer:Zi,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||$i(e.append)&&("formdata"===(t=Fi(e))||"object"===t&&$i(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&qi(e.buffer),t},isString:Qi,isNumber:ea,isBoolean:e=>!0===e||!1===e,isObject:ta,isPlainObject:na,isEmptyObject:e=>{if(!ta(e)||Zi(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:ca,isRequest:ua,isResponse:la,isHeaders:da,isUndefined:Yi,isDate:ra,isFile:oa,isBlob:ia,isRegExp:va,isFunction:$i,isStream:e=>ta(e)&&$i(e.pipe),isURLSearchParams:sa,isTypedArray:ya,isFileList:aa,forEach:ha,merge:function e(){const{caseless:t,skipUndefined:n}=ma(this)&&this||{},r={},o=(o,i)=>{const a=t&&pa(r,i)||i;na(r[a])&&na(o)?r[a]=e(r[a],o):na(o)?r[a]=e({},o):zi(o)?r[a]=o.slice():n&&Yi(o)||(r[a]=o)};for(let e=0,t=arguments.length;e(ha(t,(t,r)=>{n&&$i(t)?Object.defineProperty(e,r,{value:ji(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&Ki(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Fi,kindOfTest:Vi,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(zi(e))return e;let t=e.length;if(!ea(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Hi]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:ga,hasOwnProperty:ba,hasOwnProp:ba,reduceDescriptors:Aa,freezeMethods:e=>{Aa(e,(t,n)=>{if($i(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];$i(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return zi(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:pa,global:fa,isContextDefined:ma,isSpecCompliantForm:function(e){return!!(e&&$i(e.append)&&"FormData"===e[Wi]&&e[Hi])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(ta(e)){if(t.indexOf(e)>=0)return;if(Zi(e))return e;if(!("toJSON"in e)){t[r]=e;const o=zi(e)?[]:{};return ha(e,(e,t)=>{const i=n(e,r+1);!Yi(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Ea,isThenable:e=>e&&(ta(e)||$i(e))&&$i(e.then)&&$i(e.catch),setImmediate:Sa,asap:Ia,isIterable:e=>null!=e&&$i(e[Hi])};class Na extends Error{static from(e,t,n,r,o,i){const a=new Na(e.message,t||e.code,n,r,o);return a.cause=e,a.name=e.name,i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ka.toJSONObject(this.config),code:this.code,status:this.status}}}Na.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Na.ERR_BAD_OPTION="ERR_BAD_OPTION",Na.ECONNABORTED="ECONNABORTED",Na.ETIMEDOUT="ETIMEDOUT",Na.ERR_NETWORK="ERR_NETWORK",Na.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Na.ERR_DEPRECATED="ERR_DEPRECATED",Na.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Na.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Na.ERR_CANCELED="ERR_CANCELED",Na.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Na.ERR_INVALID_URL="ERR_INVALID_URL";const Ca=Na;var La=n(8287).hp;function Pa(e){return ka.isPlainObject(e)||ka.isArray(e)}function xa(e){return ka.endsWith(e,"[]")?e.slice(0,-2):e}function Ua(e,t,n){return e?e.concat(t).map(function(e,t){return e=xa(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Da=ka.toFlatObject(ka,{},null,function(e){return/^is[A-Z]/.test(e)});const Ma=function(e,t,n){if(!ka.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=ka.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!ka.isUndefined(t[e])})).metaTokens,o=n.visitor||u,i=n.dots,a=n.indexes,s=(n.Blob||"undefined"!=typeof Blob&&Blob)&&ka.isSpecCompliantForm(t);if(!ka.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(ka.isDate(e))return e.toISOString();if(ka.isBoolean(e))return e.toString();if(!s&&ka.isBlob(e))throw new Ca("Blob is not supported. Use a Buffer instead.");return ka.isArrayBuffer(e)||ka.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):La.from(e):e}function u(e,n,o){let s=e;if(e&&!o&&"object"==typeof e)if(ka.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(ka.isArray(e)&&function(e){return ka.isArray(e)&&!e.some(Pa)}(e)||(ka.isFileList(e)||ka.endsWith(n,"[]"))&&(s=ka.toArray(e)))return n=xa(n),s.forEach(function(e,r){!ka.isUndefined(e)&&null!==e&&t.append(!0===a?Ua([n],r,i):null===a?n:n+"[]",c(e))}),!1;return!!Pa(e)||(t.append(Ua(o,n,i),c(e)),!1)}const l=[],d=Object.assign(Da,{defaultVisitor:u,convertValue:c,isVisitable:Pa});if(!ka.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!ka.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),ka.forEach(n,function(n,i){!0===(!(ka.isUndefined(n)||null===n)&&o.call(t,n,ka.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),l.pop()}}(e),t};function Ba(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ja(e,t){this._pairs=[],e&&Ma(e,this,t)}const Ga=ja.prototype;Ga.append=function(e,t){this._pairs.push([e,t])},Ga.toString=function(e){const t=e?function(t){return e.call(this,t,Ba)}:Ba;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Ka=ja;function Ha(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Wa(e,t,n){if(!t)return e;const r=n&&n.encode||Ha,o=ka.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):ka.isURLSearchParams(t)?t.toString():new Ka(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const Fa=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ka.forEach(this.handlers,function(t){null!==t&&e(t)})}},Xa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Va={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ka,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Ja="undefined"!=typeof window&&"undefined"!=typeof document,za="object"==typeof navigator&&navigator||void 0,Ya=Ja&&(!za||["ReactNative","NativeScript","NS"].indexOf(za.product)<0),Za="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,qa=Ja&&window.location.href||"http://localhost",Qa={...e,...Va};const $a=function(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=o>=e.length;if(i=!i&&ka.isArray(r)?r.length:i,s)return ka.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a;r[i]&&ka.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&ka.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r{t(function(e){return ka.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null};const es={transitional:Xa,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=ka.isObject(e);o&&ka.isHTMLForm(e)&&(e=new FormData(e));if(ka.isFormData(e))return r?JSON.stringify($a(e)):e;if(ka.isArrayBuffer(e)||ka.isBuffer(e)||ka.isStream(e)||ka.isFile(e)||ka.isBlob(e)||ka.isReadableStream(e))return e;if(ka.isArrayBufferView(e))return e.buffer;if(ka.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Ma(e,new Qa.classes.URLSearchParams,{visitor:function(e,t,n,r){return Qa.isNode&&ka.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=ka.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Ma(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(ka.isString(e))try{return(t||JSON.parse)(e),ka.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||es.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(ka.isResponse(e)||ka.isReadableStream(e))return e;if(e&&ka.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw Ca.from(e,Ca.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Qa.classes.FormData,Blob:Qa.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ka.forEach(["delete","get","head","post","put","patch"],e=>{es.headers[e]={}});const ts=es,ns=ka.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),rs=Symbol("internals");function os(e){return e&&String(e).trim().toLowerCase()}function is(e){return!1===e||null==e?e:ka.isArray(e)?e.map(is):String(e)}function as(e,t,n,r,o){return ka.isFunction(r)?r.call(this,t,n):(o&&(t=n),ka.isString(t)?ka.isString(r)?-1!==t.indexOf(r):ka.isRegExp(r)?r.test(t):void 0:void 0)}class ss{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=os(t);if(!o)throw new Error("header name must be a non-empty string");const i=ka.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=is(e))}const i=(e,t)=>ka.forEach(e,(e,n)=>o(e,n,t));if(ka.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(ka.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ns[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(ka.isObject(e)&&ka.isIterable(e)){let n,r,o={};for(const t of e){if(!ka.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?ka.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=os(e)){const n=ka.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(ka.isFunction(t))return t.call(this,e,n);if(ka.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=os(e)){const n=ka.findKey(this,e);return!(!n||void 0===this[n]||t&&!as(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=os(e)){const o=ka.findKey(n,e);!o||t&&!as(0,n[o],o,t)||(delete n[o],r=!0)}}return ka.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!as(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return ka.forEach(this,(r,o)=>{const i=ka.findKey(n,o);if(i)return t[i]=is(r),void delete t[o];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();a!==o&&delete t[o],t[a]=is(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ka.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&ka.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[rs]=this[rs]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=os(e);t[r]||(!function(e,t){const n=ka.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return ka.isArray(e)?e.forEach(r):r(e),this}}ss.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ka.reduceDescriptors(ss.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),ka.freezeMethods(ss);const cs=ss;function us(e,t){const n=this||ts,r=t||n,o=cs.from(r.headers);let i=r.data;return ka.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ls(e){return!(!e||!e.__CANCEL__)}const ds=class extends Ca{constructor(e,t,n){super(null==e?"canceled":e,Ca.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function hs(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Ca("Request failed with status code "+n.status,[Ca.ERR_BAD_REQUEST,Ca.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const ps=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=r[a];o||(o=c),n[i]=s,r[i]=c;let l=a,d=0;for(;l!==i;)d+=n[l++],l%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-o;s>=i?a(e,t):(n=e,r||(r=setTimeout(()=>{r=null,a(n)},i-s)))},()=>n&&a(n)]},ms=(e,t,n=3)=>{let r=0;const o=ps(50,250);return fs(n=>{const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=i-r,c=o(s);r=i;e({loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&i<=a?(a-i)/c:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},ys=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ws=e=>(...t)=>ka.asap(()=>e(...t)),gs=Qa.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Qa.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Qa.origin),Qa.navigator&&/(msie|trident)/i.test(Qa.navigator.userAgent)):()=>!0,bs=Qa.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];ka.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),ka.isString(r)&&s.push(`path=${r}`),ka.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),ka.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function vs(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const As=e=>e instanceof cs?{...e}:e;function Es(e,t){t=t||{};const n={};function r(e,t,n,r){return ka.isPlainObject(e)&&ka.isPlainObject(t)?ka.merge.call({caseless:r},e,t):ka.isPlainObject(t)?ka.merge({},t):ka.isArray(t)?t.slice():t}function o(e,t,n,o){return ka.isUndefined(t)?ka.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!ka.isUndefined(t))return r(void 0,t)}function a(e,t){return ka.isUndefined(t)?ka.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(As(e),As(t),0,!0)};return ka.forEach(Object.keys({...e,...t}),function(r){const i=c[r]||o,a=i(e[r],t[r],r);ka.isUndefined(a)&&i!==s||(n[r]=a)}),n}const Ss=e=>{const t=Es({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:s}=t;if(t.headers=a=cs.from(a),t.url=Wa(vs(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&a.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),ka.isFormData(n))if(Qa.hasStandardBrowserEnv||Qa.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(ka.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&a.set(e,n)})}if(Qa.hasStandardBrowserEnv&&(r&&ka.isFunction(r)&&(r=r(t)),r||!1!==r&&gs(t.url))){const e=o&&i&&bs.read(i);e&&a.set(o,e)}return t},Ts="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Ss(e);let o=r.data;const i=cs.from(r.headers).normalize();let a,s,c,u,l,{responseType:d,onUploadProgress:h,onDownloadProgress:p}=r;function f(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(a),r.signal&&r.signal.removeEventListener("abort",a)}let m=new XMLHttpRequest;function y(){if(!m)return;const r=cs.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());hs(function(e){t(e),f()},function(e){n(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(n(new Ca("Request aborted",Ca.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new Ca(r,Ca.ERR_NETWORK,e,m);o.event=t||null,n(o),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Xa;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Ca(t,o.clarifyTimeoutError?Ca.ETIMEDOUT:Ca.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&ka.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),ka.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=ms(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([s,u]=ms(h),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{m&&(n(!t||t.type?new ds(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const w=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);w&&-1===Qa.protocols.indexOf(w)?n(new Ca("Unsupported protocol "+w+":",Ca.ERR_BAD_REQUEST,e)):m.send(o||null)})},_s=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,a();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Ca?t:new ds(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new Ca(`timeout of ${t}ms exceeded`,Ca.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:s}=r;return s.unsubscribe=()=>ka.asap(a),s}},Rs=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of Os(e))yield*Rs(n,t)}(e,t);let i,a=0,s=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return s(),void e.close();let i=r.byteLength;if(n){let e=a+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel:e=>(s(e),o.return())},{highWaterMark:2})},{isFunction:ks}=ka,Ns=(({Request:e,Response:t})=>({Request:e,Response:t}))(ka.global),{ReadableStream:Cs,TextEncoder:Ls}=ka.global,Ps=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},xs=e=>{e=ka.merge.call({skipUndefined:!0},Ns,e);const{fetch:t,Request:n,Response:r}=e,o=t?ks(t):"function"==typeof fetch,i=ks(n),a=ks(r);if(!o)return!1;const s=o&&ks(Cs),c=o&&("function"==typeof Ls?(u=new Ls,e=>u.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var u;const l=i&&s&&Ps(()=>{let e=!1;const t=new n(Qa.origin,{body:new Cs,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=a&&s&&Ps(()=>ka.isReadableStream(new r("").body)),h={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!h[e]&&(h[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Ca(`Response type '${e}' is not supported`,Ca.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=ka.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(ka.isBlob(e))return e.size;if(ka.isSpecCompliantForm(e)){const t=new n(Qa.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ka.isArrayBufferView(e)||ka.isArrayBuffer(e)?e.byteLength:(ka.isURLSearchParams(e)&&(e+=""),ka.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:a,data:s,signal:c,cancelToken:u,timeout:f,onDownloadProgress:m,onUploadProgress:y,responseType:w,headers:g,withCredentials:b="same-origin",fetchOptions:v}=Ss(e),A=t||fetch;w=w?(w+"").toLowerCase():"text";let E=_s([c,u&&u.toAbortSignal()],f),S=null;const T=E&&E.unsubscribe&&(()=>{E.unsubscribe()});let _;try{if(y&&l&&"get"!==a&&"head"!==a&&0!==(_=await p(g,s))){let e,t=new n(o,{method:"POST",body:s,duplex:"half"});if(ka.isFormData(s)&&(e=t.headers.get("content-type"))&&g.setContentType(e),t.body){const[e,n]=ys(_,ms(ws(y)));s=Is(t.body,65536,e,n)}}ka.isString(b)||(b=b?"include":"omit");const t=i&&"credentials"in n.prototype,c={...v,signal:E,method:a.toUpperCase(),headers:g.normalize().toJSON(),body:s,duplex:"half",credentials:t?b:void 0};S=i&&new n(o,c);let u=await(i?A(S,v):A(o,c));const f=d&&("stream"===w||"response"===w);if(d&&(m||f&&T)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=u[t]});const t=ka.toFiniteNumber(u.headers.get("content-length")),[n,o]=m&&ys(t,ms(ws(m),!0))||[];u=new r(Is(u.body,65536,n,()=>{o&&o(),T&&T()}),e)}w=w||"text";let R=await h[ka.findKey(h,w)||"text"](u,e);return!f&&T&&T(),await new Promise((t,n)=>{hs(t,n,{data:R,headers:cs.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:S})})}catch(t){if(T&&T(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Ca("Network Error",Ca.ERR_NETWORK,e,S),{cause:t.cause||t});throw Ca.from(t,t&&t.code,e,S)}}},Us=new Map,Ds=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let a,s,c=i.length,u=Us;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:xs(t)),u=s;return s},Ms=(Ds(),{http:null,xhr:Ts,fetch:{get:Ds}});ka.forEach(Ms,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Bs=e=>`- ${e}`,js=e=>ka.isFunction(e)||null===e||!1===e;const Gs={getAdapter:function(e,t){e=ka.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let a=0;a`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(Bs).join("\n"):" "+Bs(e[0]):"as no adapter specified";throw new Ca("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:Ms};function Ks(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ds(null,e)}function Hs(e){Ks(e),e.headers=cs.from(e.headers),e.data=us.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Gs.getAdapter(e.adapter||ts.adapter,e)(e).then(function(t){return Ks(e),t.data=us.call(e,e.transformResponse,t),t.headers=cs.from(t.headers),t},function(t){return ls(t)||(Ks(e),t&&t.response&&(t.response.data=us.call(e,e.transformResponse,t.response),t.response.headers=cs.from(t.response.headers))),Promise.reject(t)})}const Ws="1.13.4",Fs={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Fs[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Xs={};Fs.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Ws+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new Ca(r(o," has been removed"+(t?" in "+t:"")),Ca.ERR_DEPRECATED);return t&&!Xs[o]&&(Xs[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},Fs.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Vs={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Ca("options must be an object",Ca.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=t[i];if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new Ca("option "+i+" must be "+n,Ca.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Ca("Unknown option "+i,Ca.ERR_BAD_OPTION)}},validators:Fs},Js=Vs.validators;class zs{constructor(e){this.defaults=e||{},this.interceptors={request:new Fa,response:new Fa}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Es(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Vs.assertOptions(n,{silentJSONParsing:Js.transitional(Js.boolean),forcedJSONParsing:Js.transitional(Js.boolean),clarifyTimeoutError:Js.transitional(Js.boolean)},!1),null!=r&&(ka.isFunction(r)?t.paramsSerializer={serialize:r}:Vs.assertOptions(r,{encode:Js.function,serialize:Js.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Vs.assertOptions(t,{baseUrl:Js.spelling("baseURL"),withXsrfToken:Js.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&ka.merge(o.common,o[t.method]);o&&ka.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=cs.concat(i,o);const a=[];let s=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,a.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!s){const e=[Hs.bind(this),void 0];for(e.unshift(...a),e.push(...c),l=e.length,u=Promise.resolve(t);d{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new ds(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;const t=new Zs(function(t){e=t});return{token:t,cancel:e}}}const qs=Zs;const Qs={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Qs).forEach(([e,t])=>{Qs[t]=e});const $s=Qs;const ec=function e(t){const n=new Ys(t),r=ji(Ys.prototype.request,n);return ka.extend(r,Ys.prototype,n,{allOwnKeys:!0}),ka.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Es(t,n))},r}(ts);ec.Axios=Ys,ec.CanceledError=ds,ec.CancelToken=qs,ec.isCancel=ls,ec.VERSION=Ws,ec.toFormData=Ma,ec.AxiosError=Ca,ec.Cancel=ec.CanceledError,ec.all=function(e){return Promise.all(e)},ec.spread=function(e){return function(t){return e.apply(null,t)}},ec.isAxiosError=function(e){return ka.isObject(e)&&!0===e.isAxiosError},ec.mergeConfig=Es,ec.AxiosHeaders=cs,ec.formToJSON=e=>$a(ka.isHTMLForm(e)?new FormData(e):e),ec.getAdapter=Gs.getAdapter,ec.HttpStatusCode=$s,ec.default=ec;const tc=ec,nc={AUTH0_SUB_COOKIE_KEY:"auth0_sub",ENTITLEMENT_COOKIE_KEY:"mng-entitlements",LOCAL_STORAGE_SESSION_KEY:"__MNG_Session",REGWALL_USER_IS_SUBSCRIBED:"regwallUserIsSubscribed",USER_IS_LOWA:"entitled",SLO_FLAG:"slo_flag",AB_TESTING_COOKIE:"_matheriSegs",ARTICLES_REMAINING_KEY:"articlesRemaining",USER_PROFILE_HASH:"user-profile"};var rc,oc;function ic(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ac(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=sc().hostname;if(e&&"string"==typeof e&&e.length>0&&(t=e,e.includes("vipdev.lndo.site")))return"".concat(e.split(".")[0],".com");var n=t.split(".");return"".concat(n[n.length-2],".").concat(n[n.length-1])},lc=function(){var e=uc();return".".concat(e)},dc=function(e,t,n){var r="".concat(e,"=").concat(t,";");void 0!==n?(a("Setting cookie with options: ",n),Object.entries(n).forEach(function(e){var t=f(e,2),n=t[0],o=t[1];if("expires"===n){var i=new Date;i.setTime(i.getTime()+24*o*60*60*1e3),r+="expires=".concat(i.toUTCString(),";")}else r+="".concat(n,"=").concat(o,";")})):r+="path=/;",document.cookie=r},hc=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r="".concat(e,"= ;expires= Thu, 01 Jan 1970 00:00:00 GMT;"),o=uc(),i=[o,"www".concat(o),".www".concat(o)];n&&i.push(n),Object.entries(t).forEach(function(e){var t=f(e,2),n=t[0],o=t[1];r+="".concat(n,"=").concat(o,";")}),0===Object.keys(t).length&&(r+="path=/;"),document.cookie=r,i.forEach(function(e){document.cookie=r.concat("domain=",e,";")})},pc=function(){return sc().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},fc=function(e){return function(e,t){if("string"!=typeof e)throw new m("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new m(`Invalid token specified: missing part #${n+1}`);let o;try{o=y(r)}catch(e){throw new m(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(o)}catch(e){throw new m(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(e)},mc=function(){var e=r(o.mark(function e(t){var n,r,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=uc().split(".")[0],e.prev=1,e.next=2,tc({method:"get",url:"".concat(i.A.entitlementsEndpoint,"apple/subscription-check/").concat(n),params:{access_token:t}});case 2:if(!(r=e.sent).data){e.next=3;break}return a("Apple Sub Check: Request successful: ",r.data),e.abrupt("return","subscribed"===r.data.status);case 3:return e.abrupt("return",!1);case 4:return e.prev=4,s=e.catch(1),a("Apple Sub Check: Request Failure: ",s),e.abrupt("return",!1);case 5:case"end":return e.stop()}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}(),yc=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,tc({method:"get",url:"".concat(i.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(pc())),headers:{"X-Api-Key":i.A.entitlementsApiKey}});case 1:return n=e.sent,e.abrupt("return",n.data.encryptedUuid);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),wc=function(){return"complete"===document.readyState},gc=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){var n=!0;if(wc())t();else{a("UIHandler: ","Waiting for the body to load...");var i=setInterval(r(o.mark(function r(){return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:e&&(n=wc()),document.querySelector("body")&&n&&(clearInterval(i),t(!0));case 1:case"end":return r.stop()}},r)})),200)}})},bc=function(){return new Promise(function(e){if(("interactive"===document.readyState||wc())&&window.dataLayer)a("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{a("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var t=setInterval(r(o.mark(function n(){return o.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:window.dataLayer&&window.dataLayer.length>2&&(clearInterval(t),e(!0));case 1:case"end":return n.stop()}},n)})),50)}})},vc=function(){return new Promise(function(e){if("interactive"!==document.readyState&&"complete"!==document.readyState||!window.MG2DL){a("Utils mg2DataLayerLoaded:","Waiting for MG2DL to load...");var t=setInterval(function(){window.MG2DL&&window.MG2DL.length>0&&(clearInterval(t),e(!0))},50)}else a("Utils mg2DataLayerLoaded:","Document is in interactive state, resolving."),e()})},Ac=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,bc();case 1:return a("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",a("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),r=function(e){return a("Utils dataLayerLoop: look for this element ",e),e[t]?(a("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(a("Utils dataLayerLoop: dataLayer search ",!1),!1)},i=window.dataLayer.some(r),e.abrupt("return",i?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),Ec=function(){var e=r(o.mark(function e(){var t,n,r,i=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:[],e.next=1,bc();case 1:if(a("Utils getMultipleDataLayerObjects: looking for these keys ",t),window.dataLayer=window.dataLayer||[],n={},a("Utils getDataLayerObjects: dataLayer length",window.dataLayer.length),r=function(e){a("Utils dataLayerLoop: look for this element ",e);var r=!1;return t.forEach(function(t){void 0!==e[t]?(a("Utils dataLayerLoop: found ".concat(t,":"),e[t]),n[t]=e[t],r=!0):a("Utils dataLayerLoop: ".concat(t," not found in this element"))}),t.every(function(e){return void 0!==n[e]})?(a("Utils dataLayerLoop: all requested keys found, stopping search"),!0):r},!(window.dataLayer.some(r)&&Object.keys(n).length>0)){e.next=2;break}return a("Utils getDataLayerObjects: final result",n),e.abrupt("return",n);case 2:return a("Utils getDataLayerObjects: none of the keys were found"),e.abrupt("return",!1);case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Sc=function(){var e=r(o.mark(function e(){var t,n,r=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"Page Type",e.next=1,Ac(t);case 1:return n=e.sent,a("utils | pageType: page type is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Tc=function(){return new Promise(function(e){a("blueConicReady | Waiting for BC to be ready."),window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){a("blueConicReady | onReady fired, BC profile is ready."),e(!0)});var t=setTimeout(function(){clearTimeout(t),a("blueConicReady | onReady timeout, BC onReady unknown."),e(!1)},3e3)})},_c=function(){return new Promise(function(e){a("blueConicProfileReady | Waiting for BC Profile to be ready."),window.blueConicClient&&(window.blueConicClient.getSegments||window.blueConicClient.profile)&&(a("blueConicProfileReady | BC getSegments is ready."),e(!0)),window.blueConicClient.event.subscribe(window.blueConicClient.event.onBeforeInteractions,{},function(){a("blueConicProfileReady | onBeforeInteractions fired, BC profile is ready."),e(!0)});var t=setTimeout(function(){clearTimeout(t),a("blueConicProfileReady | onBeforeInteractions timeout, BC profile readiness unknown"),e(!1)},3e3)})},Rc=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){a("blueConicLoaded | waitTillBCReady is ".concat(e));var n=setTimeout(function(){clearTimeout(n),a("blueConicLoaded | onBlueConicLoaded timeout, resolving false for load status."),t(!1)},1e4);void 0!==window.blueConicClient&&void 0!==window.blueConicClient.event&&void 0!==window.blueConicClient.event.subscribe?(a("blueConicLoaded | BC object already loaded"),e?t(Tc()):(clearTimeout(n),t())):(a('blueConicLoaded | BC not loaded, waiting for "onBlueConicLoaded" event'),window.addEventListener("onBlueConicLoaded",r(o.mark(function r(){var i;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(a("blueConicLoaded | onBlueConicLoaded event fired."),!e){r.next=2;break}return a("blueConicLoaded | waiting for blueConicReady..."),r.next=1,Tc();case 1:i=r.sent,clearTimeout(n),t(i),r.next=3;break;case 2:clearTimeout(n),t();case 3:case"end":return r.stop()}},r)})),!1))})},Oc=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Rc(!0);case 1:if(!e.sent){e.next=4;break}return e.next=2,_c();case 2:if(e.sent){e.next=3;break}return e.abrupt("return",!1);case 3:return e.abrupt("return",blueConicClient.profile.getProfile().getValue("Auth0_ID"));case 4:return e.abrupt("return",!1);case 5:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Ic=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c,u,l=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]&&l[0],n=!1,i=["MICH LOWA","OHIO LOWA","PENN LOWA","NY LOWA","BOSTON LOWA","NORCAL LOWA","TWIN CITIES LOWA","DENV/PMP LOWA","SCNG LOWA","BANG LOWA","AMC LOWA","HC LOWA","GS LOWA","ORL LOWA","SS LOWA","NNDP LOWA","VP LOWA","NYDN LOWA","BAL LOWA","CG LOWA","CHI LOWA"],e.next=1,Rc(!0);case 1:if(!e.sent){e.next=3;break}if(s=window.blueConicClient.getSegments(),a("bcLowaCheck | BC segments for users: ",s),!(s.filter(function(e){return i.includes(e.name)}).length>0)){e.next=3;break}return e.next=2,Oc();case 2:(c=e.sent)&&(n=!0,r=c);case 3:return t&&n&&kc(),u={isSub:n},r&&(u.uuid=r),e.abrupt("return",u);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),kc=function(){dc("bc_lowa_status",1,{path:"/",domain:lc(),expires:7,secure:!0})},Nc=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(a("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(a("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};a("utils | Event: authentication ready: ",r),e(r)}catch(e){a(e),t(e)}},!1))})},Cc=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){return i.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(a("Entitlements already present:",window.MNGAuthentication.entitlementsReady),void e(window.MNGAuthentication.entitlementsReady)):void window.addEventListener("entitlementsReady",function(n){try{var r=n.detail||{};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=r,a("Received entitlementsReady event:",r),e(r)}catch(e){s("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(a("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Lc=function(){hc(nc.AUTH0_SUB_COOKIE_KEY),hc("mng-jwt-decoded"),localStorage.removeItem(nc.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),function(){a("Clearing entitlements...");try{hc(nc.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){a("Failed to delete legacy cookie: ",e)}try{hc(nc.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:uc(),expires:365,secure:!0})}catch(e){a("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(nc.LOCAL_STORAGE_SESSION_KEY)}catch(e){a("Failed to remove local storage: ",e)}}()},Pc=function(){var e=sc();return!["local","develop","preprod","trbdev"].some(function(t){return e.origin.includes(t)})},xc=function(e){a("Removing storageObject : ",e),void 0!==window.localStorage.getItem(e)&&(window.localStorage.removeItem(e),a("Storage Object removed : ",e))},Uc=function(e){a("starting simpleEmailValidation");if(!e)return{valid:!1,message:"Please enter an email."};if(!/^(([^<>()[\]\\.,;:\s@']+(\.[^<>()[\]\\.,;:\s@']+)*)|('.+'))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i.test(e))return{valid:!1,message:"Please enter a valid email."};var t=e.match(/\.([^.\n\s]*)$/)[1].toUpperCase(),n=["AAA","AARP","ABARTH","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALFAROMEO","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOKINGCHANNEL","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIAT","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOODNETWORK","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HGTV","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELES","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LANCIA","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINDE","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOFT","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MACYS","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MASERATI","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MUTUAL","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTHWESTERNMUTUAL","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PASSAGENS","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIFFANY","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELCHANNEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","VUELOS","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"].includes(t);return a("simpleEmailValidation: ","TLD search ".concat(n)),!1===n?{valid:!1,message:"Please enter a valid email domain."}:-1===["zzz.pl"].findIndex(function(t){return t===e.split("@")[1]})?{valid:!0,message:"Valid"}:{valid:!1,message:"Please enter a valid email."}};window.simpleEmailValidation=Uc;var Dc;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Mc=function(){var e=r(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===Dc){e.next=1;break}return e.abrupt("return",Dc);case 1:return t=i.A.auth0Domain,n=i.A.auth0ClientId,Dc=new Bi({domain:t,clientId:n,cacheLocation:"localstorage",useRefreshTokens:!0,useRefreshTokensFallback:!0,authorizationParams:{audience:"access-extension",scope:"openid email profile user_metadata app_metadata offline_access"}}),e.abrupt("return",Dc);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Bc=function(e){a("utils | auth event dispathed");var t=new CustomEvent("authenticationReady",{detail:e});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.authenticationReady=e,a("utils | Dispatching authenticationReady Event: ",t),window.dispatchEvent(t),a("utils | Dispatched authenticationReady event"),oc=new CustomEvent("mng-auth-check-complete",{detail:e}),rc?(a("utils | Dispatching mng-auth-complete event (islands were ready): ",t),window.dispatchEvent(oc)):a("Islands not ready")},jc=function(e){if(void 0!==window.authentication_config){var t=window.authentication_config,n=Object.keys(t).filter(function(n){return n.includes(e)&&"1"===t[n]});return a("checkOneTapOptions: enabled options",n),n.length>0}return!1},Gc=function(e){return Number.isInteger(Number(e))};var Kc=function(e){i.A.datadogEnabled&&window.DD_RUM.addTiming(e)},Hc=function(){var e=r(o.mark(function e(t){var n,r,s,u,l,d;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,a("deleteUserCache","Setting up cache deletion for ".concat(t)),n=pc(),a("deleteUSerCache","Domain is: ".concat(n)),r={publication:n,uuid:t},e.next=1,tc({method:"DELETE",url:"".concat(i.A.entitlementsEndpoint,"session/create"),data:r,headers:{"X-Api-Key":i.A.entitlementsApiKey}});case 1:if(s=e.sent,u=s.data,l=/Succesfully deleted/i,!("object"===c(u)&&Object.prototype.hasOwnProperty.call(u,"message"))||!l.test(u.message)){e.next=2;break}return a("deleteUserCache","Cache deletion successful for ".concat(t)),e.abrupt("return",{success:!0});case 2:return a("deleteUserCache","Cache deletion failed for ".concat(t,": ").concat(u)),e.abrupt("return",{success:!1});case 3:return e.prev=3,d=e.catch(0),a("deleteUserCache","Cache deletion error for ".concat(t,": ").concat(d)),e.abrupt("return",{success:!1});case 4:case"end":return e.stop()}},e,null,[[0,3]])}));return function(t){return e.apply(this,arguments)}}(),Wc=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(t,n){var i={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},s=function(){var s=r(o.mark(function r(){var s,c,u,l,d,h,p,f,m,y,w;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,"1"!==(null===(s=window.sophi_config)||void 0===s?void 0:s.enableSophiSSPW)){r.next=1;break}if(!document.getElementById("server-paywall")){r.next=1;break}return i.sspw=!0,r.abrupt("return",t({paywall:!0,details:ac({},i)}));case 1:return r.next=2,Sc();case 2:return u=r.sent,r.next=3,Ac("Paywall_Level");case 3:if(l=r.sent,"article"===u&&"free"!==l){r.next=4;break}return r.abrupt("return",t({paywall:!1,details:"article"!==u?"Page type is not an article":"Free article"}));case 4:return r.next=5,Cc();case 5:if(!(d=r.sent)||!d.isEntitled){r.next=6;break}return r.abrupt("return",t({paywall:!1,details:"Entitled User"}));case 6:if("premium"!==l){r.next=7;break}return r.abrupt("return",t({paywall:!0,details:"Premium article"}));case 7:if(h=null===(c=window.ConnextUtils)||void 0===c?void 0:c.runningSophi,a("checkPaywallStatus - Sophi is running: ",h),!h){r.next=8;break}window.ConnextUtils.connextAlreadyRan&&window.sophiWallConfig&&!window.sophiWallConfig.error&&"paywall"===window.sophiWallConfig.wallType?(i.sophiClient=!0,i.engageStatus=!0,i.engagePaywall=!0):window.addEventListener("onPaywallShown",function(){return"paywall"===window.sophiWallConfig.wallType&&(i.sophiClient=!0),t({paywall:!0,details:ac({},i)})},{once:!0}),r.next=12;break;case 8:if(h){r.next=12;break}return p=window.ConnextUtils.connextReady("onPaywallShown",!1),f=new Promise(function(t,n){return setTimeout(function(){return n(new Error("No Engage paywall within 10 seconds, resolving as no paywall."))},e)}),r.prev=9,r.next=10,Promise.race([p,f]);case 10:!0===(m=r.sent)?(i.engagePaywall=!0,i.engageStatus="Engage paywall detected"):(i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(m)),r.next=12;break;case 11:r.prev=11,y=r.catch(9),i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(y);case 12:return r.abrupt("return",t({paywall:Object.values(i).some(function(e){return e}),details:ac({},i)}));case 13:r.prev=13,w=r.catch(0),n(w);case 14:case"end":return r.stop()}},r,null,[[0,13],[9,11]])}));return function(){return s.apply(this,arguments)}}();s()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=Wc);var Fc=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Rc();case 1:return e.next=2,Nc();case 2:return e.abrupt("return",new Promise(function(e){a("ANALYTICS: inside BCregwall events");var t=sc();t.searchParams.delete("regwall");var n=blueConicClient.profile.getProfile();localStorage.setItem("regwallSuccess","yes"),localStorage.setItem("regwallEvent","yes"),n.setValue("bang_reg_wall_status","Y"),n.setValue("regwall_newspaper",t.host),n.setValue("regwall_success_date",new Date),n.setValue("regwall_success","yes"),blueConicClient.profile.updateProfile(),e(!0)}));case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Xc=function(){var e=r(o.mark(function e(t){var n,r,i,s,c;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:try{void 0!==(n=fc(t))&&n&&(a("ANALYTICS: Partner Access: JWT found"),r=n.entitlement_entitled,i=n.entitlement_source,s=n.entitlement_organizationTrackingId,c=n.entitlement_organizationType,a("ANALYTICS: Partner Access Event: Entitled: ".concat(r," and source: ").concat(i)),r&&"partner-access"===i&&(a("ANALYTICS: GA event for partner access"),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"partnerAccess",partner:"".concat(s,"|").concat(c)})))}catch(e){a("ANALYTICS: Failed to send Partner Access event: ",e)}case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),Vc=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:try{"yes"===localStorage.getItem("regwallEvent")&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"regwall_success"}),a("ANALYTICS: GA/ datalayer ",window.dataLayer),localStorage.removeItem("regwallEvent"))}catch(e){a("ANALYTICS: Failed to send Regwall Succuss Event: ",e)}case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Jc=function(){var e=r(o.mark(function e(t,n){var r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n.entitlements&&(r=fc(n.entitlements.token)),a("ANALYTICS: user state variables are: ",t,n.userState),i="known"===t&&n.userState?r&&r.entitlement_entitled?"comp"===r.entitlement_level||"freeTrial"===r.entitlement_level?"subscriber-".concat(r.entitlement_level):"".concat(n.userState).concat(r.entitlement_serviceCode?"-".concat(r.entitlement_serviceCode):""):n.userState:"known"!==t||n.userState?"unknown"===t||"unknown-default"===t||"unknown-fail"===t&&"noEntitlements"===n.userState?t:t&&n.userState?r&&r.entitlement_entitled?"".concat(n.userState).concat(r.entitlement_serviceCode?"-".concat(r.entitlement_serviceCode):""):n.userState:"noState":"known-entitlements-failed",a("ANALYTICS: user state is ",i),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"Auth0State_event",Auth0State:i});case 1:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),zc=function(){var e=r(o.mark(function e(){var t,n,r,i,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,Nc();case 1:n=e.sent,r=n.isAuthenticated,i=r,e.next=!0===i?2:!1===i?3:i===nc.USER_IS_LOWA?4:5;break;case 2:return t="known",e.abrupt("continue",6);case 3:return t="unknown",e.abrupt("continue",6);case 4:return t=nc.USER_IS_LOWA,e.abrupt("continue",6);case 5:return t="unknown-default",e.abrupt("continue",6);case 6:return e.abrupt("return",t);case 7:return e.prev=7,s=e.catch(0),a("ANALYTICS: Error during onAuthReadyAnalytics: ",s),e.abrupt("return","unknown-fail");case 8:case"end":return e.stop()}},e,null,[[0,7]])}));return function(){return e.apply(this,arguments)}}(),Yc=function(e){try{window.dataLayer.push({event:e}),a("ANALYTICS: ".concat(e," event")),a("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){a("ANALYTICS: Failed to send ".concat(e," event: "),t)}},Zc=function(e){try{var t={};Object.keys(e).forEach(function(n){t[n]=e[n]}),0!==Object.keys(t).length&&window.dataLayer.push(t),a("ANALYTICS: ".concat(e.event," event")),a("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){a("ANALYTICS: Failed to send ".concat(e.event," event: "),t)}},qc=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={event:"one_tap_login",gotGroup:t,gotExperiment:e};switch(e){case"placement":n.gotDisplayPosition=window.authentication_config["got".concat(t,"ModalPosition")];break;case"scrolling":n.gotScrollDepthPercentage=window.authentication_config["got".concat(t,"GroupDepth")],n.gotDisplayPosition=window.authentication_config["got".concat(t,"GroupDelayPosition")];break;case"delayTime":n.gotTimeUntilDisplay=Math.floor(Gc(window.authentication_config["got".concat(t,"GroupTime")])?parseInt(window.authentication_config["got".concat(t,"GroupTime")],10):1);break;default:return n.event}return n},Qc=function(e){try{var t={googleonetap:"one_tap_login",viafoura_signup:"viafoura_signup_success",viafoura_login:"viafoura_login_success"}[e];"one_tap_login"===t?(n=localStorage.getItem("abcdLocal"),r=localStorage.getItem("abcdeLocal"),o=jc("GroupEnabled"),i=jc("GroupDelayEnabled"),s=jc("GroupTimeDelayEnabled"),c=jc("got".concat(n,"GroupEnabled")),u=jc("got".concat(r,"GroupDelayEnabled")),l=jc("got".concat(n,"GroupTimeDelayEnabled")),d=/Windows|Macintosh|Mac OS X|Linux/.test(navigator.userAgent),n&&o&&c&&!i&&d&&!s?(a("ANALYTICS: Position event enabled"),Zc(qc("placement",n))):r&&!o&&i&&u&&!s?(a("ANALYTICS: Scroll delay enabled"),Zc(qc("scrolling",r))):n&&!o&&!i&&s&&l?(a("ANALYTICS: Time delay enabled"),Zc(qc("delayTime",n))):(a("ANALYTICS: No custom event detected"),Yc(qc("default")))):Yc(t)}catch(e){a("ANALYTICS: Event not setup",e)}var n,r,o,i,s,c,u,l,d},$c=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=!1,e.next=1,Cc();case 1:if(!(n=e.sent)||!n.token){e.next=2;break}return r=n.token,i=n.isEntitled,s=n.adfree,a("ANALYTICS: entitlements options: ",i,s),!0===s&&a("ANALYTICS: user state: found ad free",s),!0===i?(a("ANALYTICS: user state: found subscriber"),t="subscriber"):(a("ANALYTICS: user state: LINA"),t="lina"),Xc(r),e.abrupt("return",{userState:t,entitlements:n});case 2:return e.abrupt("return","noEntitlements");case 3:return e.prev=3,c=e.catch(0),a("ANALYTICS:",c),e.abrupt("return","entitlementError");case 4:case"end":return e.stop()}},e,null,[[0,3]])}));return function(){return e.apply(this,arguments)}}(),eu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Rc();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),tu=function(){var e=r(o.mark(function e(){var t,n,r,i,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("sspwG2iMeterEvent: initializing sspwG2iMeterEvent function"),e.next=1,Sc();case 1:if("article"===e.sent){e.next=2;break}return a("sspwG2iMeterEvent: not an article page"),e.abrupt("return");case 2:return e.next=3,Ec(["Byline","Page Title","Section","Paywall_Level"]);case 3:if(!("free"!==(t=e.sent).Paywall_Level&&"1"===window.sophi_config.enableSophiSSPW||"premium"===t.Paywall_Level&&"1"===window.authentication_config.serverEntitlements)){e.next=5;break}return n="NOWALL",(r=document.querySelector("#server-paywall, #server-regwall"))&&(a("sspwG2iMeterEvent: paywall element found: ",r.id),"server-paywall"===r.id?n="SSPW":"server-regwall"===r.id&&(n="SSRW")),i="1"===window.sophi_config.enableSophiSSPW?"sophi":"sspw",s={event:"meterStop",author:t.Byline||"",title:t["Page Title"]||"",section:t.Section||"",actionType:"sophi"===i?"Sophi_SSPW":"SSPWV1",actionName:n},a("sspwG2iMeterEvent: article data found on dataLayer: ",t),e.next=4,vc();case 4:window.MG2DL=window.MG2DL||[],window.MG2DL.push(s),a("sspwG2iMeterEvent: event pushed to MG2DL: ",window.MG2DL),e.next=6;break;case 5:a("sspwG2iMeterEvent: event not pushed, criteria not met");case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();const nu={onLoadAnalytics:function(){var e=r(o.mark(function e(){var t,n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("ANALYTICS: Start Analytics"),Vc(),window.MNGAuthentication.postAuthEvents=[],window.MNGAuthentication.preAuthGTMEvents=[],window.MNGAuthentication.postAuthEvents.push(Qc),!((n=sc()).pathname.startsWith("/logout")||n.pathname.startsWith("/login")||n.pathname.startsWith("/callback"))){e.next=1;break}return e.abrupt("return");case 1:return eu(),e.next=2,zc();case 2:return r=e.sent,e.next=3,$c();case 3:i=e.sent,Jc(r,i),"1"!==window.authentication_config.serverEntitlements&&"1"!==(null===(t=window.sophi_config)||void 0===t?void 0:t.enableSophiSSPW)||(a("ANALYTICS: SSPW is active, setting up analytics events."),tu());case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),blueConicRegwallEvents:Fc,callPreparedGTMEvent:Yc,callCustomGTMEvent:Zc};var ru=function(){try{var e=localStorage.getItem(nc.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){a("Unable to get session from local storage: ",e)}return"{}"},ou=function(e){try{a("Setting local storage session",e),localStorage.setItem(nc.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){a("Unable to save session from local storage: ",e)}},iu=function(e){try{dc(nc.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:lc(),expires:365,secure:!0})}catch(e){a("Unable to save session to cookie storage: ",e)}},au=function(){var e=r(o.mark(function e(){var t,n,r,s,c,u,l,d,h,p,f,m,y,w,g,b,v,A;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.A.sessionServer,n="".concat(t,"/api/session"),a("Checking server session: ",n),e.next=1,tc.get(n,{withCredentials:!0});case 1:if(!(r=e.sent).data){e.next=2;break}return h=r.data.entitlementTokenDecoded,p=r.data,f=p.accessToken,m=p.idToken,y=p.entitlementToken,w=null!==(s=null==h?void 0:h.entitlement_expiry)&&void 0!==s?s:null,g=null!==(c=null==h?void 0:h.entitlement_source)&&void 0!==c?c:null,b=null!==(u=null==h?void 0:h.entitlement_entitled)&&void 0!==u?u:null,v=null!==(l=null==h?void 0:h.entitlement_extras_adfree)&&void 0!==l?l:null,A=null!==(d=null==h?void 0:h.entitlement_level)&&void 0!==d?d:null,ou(JSON.stringify({accessToken:f,idToken:m,entitlementToken:y,expiration:w,entitlementSource:g,isEntitled:b,adFree:v,entitlementLevel:A})),""!==y&&"string"==typeof y&&iu(y),e.abrupt("return",{accessToken:f,idToken:m,entitlementToken:y,expiration:w,entitlementSource:g,isEntitled:b,adFree:v,entitlementLevel:A});case 2:return e.abrupt("return",{accessToken:null,idToken:null,entitlementToken:null,expiration:null,entitlementSource:null,isEntitled:null,adFree:null,entitlementLevel:null});case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),su=function(){var e=r(o.mark(function e(t){var n,r,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=i.A.sessionServer,r="".concat(n,"/api/session"),a("Updating server session: ",r),e.next=1,tc.post(r,t,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,s=e.catch(0),a("Failed to update session server: ",s);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),cu=function(){var e=r(o.mark(function e(){var t,n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=i.A.sessionServer,n="".concat(t,"/api/session"),a("Deleting server session: ",n),e.next=1,tc.delete(n,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,r=e.catch(0),a("Failed to delete server session: ",r);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),uu=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c,u,l,d,h,p,f,m,y,w,g,b,v,A,E,S,T,_,R,O,I,k,N;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("Inside getSession"),e.prev=1,d=ru(),a("Session: __MNG_Session = ",d),h=JSON.parse(d),p=h.accessToken,f=h.idToken,m=h.entitlementToken,y=h.expiration,w=h.entitlementSource,g=h.isEntitled,b=h.adFree,v=h.entitlementLevel,n=p,i=y,s=w,c=g,u=b,l=v,a("Session: check both tokens: ",t=f,r=m),void 0!==f&&void 0!==m&&null!==f&&null!==m){e.next=3;break}return a("Session: missing id or entitlements, try session server"),e.next=2,au();case 2:A=e.sent,E=A.accessToken,S=A.idToken,T=A.entitlementToken,_=A.expiration,R=A.entitlementSource,O=A.isEntitled,I=A.adFree,k=A.entitlementLevel,n=E,t=S,r=T,i=_,s=R,c=O,u=I,l=k;case 3:e.next=5;break;case 4:e.prev=4,N=e.catch(1),a("Failed to get session: ",N);case 5:return a("Returning session: ",t,n,r),e.abrupt("return",{accessToken:n,idToken:t,entitlementToken:r,expiration:i,entitlementSource:s,isEntitled:c,adFree:u,entitlementLevel:l});case 6:case"end":return e.stop()}},e,null,[[1,4]])}));return function(){return e.apply(this,arguments)}}(),lu=function(){var e=r(o.mark(function e(t){var n,r,i,s,c,u,l,d,h,p,f,m,y,w,g,b,v,A,E,S,T,_,R,O,I,k,N,C,L;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=ru(),r=JSON.parse(n),i=r.accessToken,s=void 0===i?null:i,c=r.idToken,u=void 0===c?null:c,l=r.entitlementToken,d=void 0===l?null:l,h=r.expiration,p=void 0===h?null:h,f=r.entitlementSource,m=void 0===f?null:f,y=r.isEntitled,w=void 0===y?null:y,g=r.adFree,b=void 0===g?null:g,v=r.entitlementLevel,A=void 0===v?null:v,E=t.accessToken,S=t.idToken,T=t.entitlementToken,_=t.expiration,R=t.entitlementSource,O=t.isEntitled,I=t.adFree,k=t.entitlementLevel,N={accessToken:null==E?s:E,idToken:null==S?u:S,entitlementToken:null==T?d:T,expiration:null==_?p:_,entitlementSource:null==R?m:R,isEntitled:null==O?w:O,adFree:null==I?b:I,entitlementLevel:null==k?A:k},a("Current session data: ",r),a("New session data: ",t),a("Updated session data:",N),C=JSON.stringify(N),ou(C),""!==N.entitlementToken&&"string"==typeof N.entitlementToken&&iu(N.entitlementToken),n===C){e.next=1;break}return e.next=1,su(N);case 1:e.next=3;break;case 2:e.prev=2,L=e.catch(0),a("Unable to save session: ",L);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),du=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("Ending session..."),Lc(),e.next=1,cu();case 1:localStorage.removeItem(nc.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),hu=function(){return"logout"===(sc().searchParams.get("state")||"").toLowerCase()};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[];var pu=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Mc();case 1:n=e.sent,a("Calling Auth0 logout..."),n.logout({returnTo:t});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),fu=function(){return"undefined"==typeof CnnXt?(a("Connext was not loaded."),!1):Connext.Storage.GetUserState()},mu=function(){a("Check for SS paywall Cookie");var e=window.location.hostname,t=document.cookie.split(";").find(function(e){return e.trim().startsWith("vip-go-seg=vc-v1__has_access")});if(/^(?!:\/\/)([a-zA-Z0-9-_]{1,63}\.?)+[a-zA-Z]{2,6}$/.test(e)&&t){a("SS paywall Cookie found, removing it");var n=t.split("=")[0].trim();document.cookie="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=").concat(e),document.cookie="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}},yu=function(){var e=r(o.mark(function e(){var t,n,i,s,c,u,l,d,h,p;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("Attempting to logout..."),mu(),a("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(nc.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(i=n?fc(n):"")){e.next=2;break}return s=i.auth0Id,e.next=1,Hc(s);case 1:e.sent.success?a("User cache cleared."):a("User cache deletion failed.");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=4;break}return e.next=3,du();case 3:e.next=5;break;case 4:Lc();case 5:return e.prev=5,a("Cycling through logout callbacks..."),c=window.MNGAuthentication.logoutCallbacks.map(function(e){return e()}),e.next=6,Promise.all(c);case 6:a("Finished cycling through logout callbacks."),e.next=8;break;case 7:e.prev=7,p=e.catch(5),a("Failed to cycle through logout callbacks: ",p);case 8:Object.keys(window.localStorage).filter(function(e){return e.includes("auth0")}).forEach(function(e){window.localStorage.removeItem(e),a("Removed Auth0 storage object...")}),xc("hhsl"),xc("userNewsLetterData"),xc(nc.REGWALL_USER_IS_SUBSCRIBED),xc(nc.USER_PROFILE_HASH),u=sc(),l=window.location.origin;try{u.searchParams.get("returnURL")&&(d=decodeURIComponent(u.searchParams.get("returnURL")),l=d)}catch(e){a(e),l=window.location.origin}return l=new URL(l),e.next=9,window.ConnextUtils.connextReady("onInit",!1);case 9:if(!e.sent){e.next=16;break}if(a("Auth | Silent mode enabled ",Connext.GetOptions().Silentmode),a("Auth | Run connext manually if Silent Mode is on."),window.ConnextUtils.rerunConnextEntitlements(!0),h=l,l.origin!==window.location.origin&&(h=new URL(window.location.origin)).searchParams.append("returnAfterLogout",l),window.history.replaceState({additionalInformation:"Updated the URL to prevent another login cycle"},"Home",h),!Pc()){e.next=10;break}a("About to call Connext Logout..."),setTimeout(function(){Connext.Logout()},500),e.next=15;break;case 10:if("Logged In"!==fu()){e.next=14;break}if(a("Connext user state is logged in, setting timeout..."),setTimeout(r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("Connext took too long to logout, calling auth0 logout..."),e.next=1,pu(l);case 1:case"end":return e.stop()}},e)})),8e3),"function"!=typeof Connext._logout){e.next=12;break}return a("About to call Connext _logout..."),e.next=11,Connext._logout();case 11:e.next=13;break;case 12:return a("About to call Connext Logout..."),e.next=13,Connext.Logout();case 13:e.next=15;break;case 14:return a("Connext user state is logged out, not calling it, going to auth0 logout."),e.next=15,pu(l);case 15:e.next=17;break;case 16:return a("Connext Logout was NOT called"),e.next=17,pu(l);case 17:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),wu=function(){var e=0;for(var t in window.localStorage){var n=2*window.localStorage[t].length/1024/1024;!Number.isNaN(n)&&window.localStorage.hasOwnProperty(t)&&(e+=n)}return e},gu=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return Yc(e)}),a("Cycled through preauth GTM events.")},bu=function(){var e=r(o.mark(function e(t,n,r,i,s){var c,u,l,h,p,f,m,y,w,g,b,v,A;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("Attempting to login..."),wu()>4.5&&window.localStorage.clear(),gu(),i&&(c=[],u=window.localStorage.getItem("callbackEvents"),l=JSON.parse(u),c=l&&l.length>0?d(new Set([].concat(d(i),d(l)))):i,window.localStorage.setItem("callbackEvents",JSON.stringify(c))),h=null,e.next=1,Mc();case 1:if(p=e.sent,f=sc(),m=f.origin,y=new URL("".concat(m,"/callback")),w={},f.searchParams.get("regwall")&&(f.searchParams.get("returnUrl")&&(g=f.searchParams.get("returnUrl")),f.searchParams.get("auth_redirect")&&(g=f.searchParams.get("auth_redirect"))),f.pathname.startsWith("/login")||f.pathname.startsWith("/callback")?f.searchParams.get("returnUrl")?y.searchParams.set("auth_redirect",f.searchParams.get("returnUrl")):s&&y.searchParams.set("auth_redirect",s):y.searchParams.set("auth_redirect",f.toString()),g&&"regwall"!==t&&y.searchParams.set("auth_redirect",g),"true"===f.searchParams.get("close-after-finish")&&y.searchParams.set("close-after-finish","true"),"true"!==f.searchParams.get("ssl")){e.next=4;break}if(!window.authentication_config.sessionManagementEnabled){e.next=3;break}return e.next=2,du();case 2:e.next=4;break;case 3:Lc();case 4:return null!==(h=f.searchParams.get("login-with"))?w.connection=h:n&&(w.connection=n),b="none",t&&"regwall"===t&&(y.searchParams.set("regwall","true"),b="signUp",a("Logging in with regwall")),t&&(y.searchParams.set("loginsource",t),a("Logging in with ".concat(t))),r&&(w.login_hint=r),w.redirect_uri=y.toString(),w.initialScreen=b,"googleonetap"!==t&&(w.prompt="select_account"),null!==(v=f.searchParams.get("ampRegiWall"))&&(A=window.location.hostname,w.ampRegiWall=v,w.sourceDomain=A.replace("www.","").replace("preprod.","").replace("develop.","").replace("staging.",""),w.initialScreen="signUp",w.preferenceId=f.searchParams.get("prefId")),e.next=5,p.loginWithRedirect({authorizationParams:w});case 5:case"end":return e.stop()}},e)}));return function(t,n,r,o,i){return e.apply(this,arguments)}}(),vu=function(){return new Promise(function(e){var t=setTimeout(function(){e()},8e3);try{var n=window.localStorage.getItem("callbackEvents"),r=JSON.parse(n);if(!r||0===r.length)return void e();a("Adding listeners to events we need to wait for...");var o=r.map(function(e){return t=e,new Promise(function(e){a("Adding event to wait for: ",t),window.addEventListener(t,function(n){try{var r=n.detail||{};a("Event: ".concat(t,"} ready: "),r),e(r)}catch(t){a(t),e()}},!1)});var t});Promise.all(o).then(function(){clearTimeout(t),e()})}catch(t){a("Failed to wait for callback events",t),e()}})};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.oidcLoginCallbacks=[];var Au=function(){var e=r(o.mark(function e(){var t,n,i,s,c,u,l,d,h,p,f,m,y,w,g,b,v,A,E,S,T,_;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(mu(),t=sc(),n=!1,i=t.searchParams.get("auth_redirect")||"https://".concat(window.location.host),s=t.searchParams.get("redirect_uri")||"",s.includes("applenews")?(a("This is Apple prelogin flow."),(c=new URL(s))?(c.searchParams.append("post-apple-login","true"),a("Post callback Apple redirect URL is ".concat(c)),bu(!1,!1,!1,[],c)):bu()):i.includes("post-apple-login")&&(a("This is Apple Callback flow."),n=!0,(u=new URL(decodeURIComponent(i))).searchParams.delete("post-apple-login"),i=u),a("Handling post login callback..."),!(l=t.searchParams.get("error_description"))){e.next=2;break}if("shouldAutoLogin"!==l){e.next=1;break}return e.abrupt("return",bu(!1,!1,!1,!1,i));case 1:n&&alert("There was an error in logging you in, please try again.");case 2:return e.next=3,Mc();case 3:return d=e.sent,e.next=4,d.handleRedirectCallback();case 4:return e.next=5,d.getIdTokenClaims();case 5:return h=e.sent,e.next=6,d.getUser();case 6:return p=e.sent,a("Auth0 user profile: ",p),f=h.__raw,e.next=7,d.getTokenSilently();case 7:return m=e.sent,e.prev=8,a("Cycling through login callbacks..."),e.next=9,vu();case 9:return y=window.MNGAuthentication.oidcLoginCallbacks.map(function(){var e=r(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(f));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=10,Promise.all(y);case 10:a("Finished cycling through login callbacks."),e.next=12;break;case 11:e.prev=11,S=e.catch(8),a("Failed to cycle through login callbacks: ",S);case 12:if(w={accessToken:m,userId:p.sub,email:p.email,picture:p.picture},g=!1,b="",!n){e.next=17;break}return e.prev=13,e.next=14,yc(w.userId);case 14:return b=e.sent,a("Encrypted apple uuid is: ".concat(b)),e.next=15,mc(b);case 15:g=e.sent,a("Apple sub status is: ".concat(g)),e.next=17;break;case 16:e.prev=16,T=e.catch(13),a("Apple sub check error: ".concat(T)),alert("There was an error in logging you in, please try again.");case 17:if(xc(nc.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}return a("Saving idToken to session server"),e.next=18,lu({idToken:f,accessToken:m});case 18:if(!t.searchParams.get("close-after-finish")){e.next=19;break}return e.abrupt("return",window.close());case 19:if(!t.search.includes("loginsource")){e.next=20;break}return v=t.searchParams.get("loginsource"),A=window.MNGAuthentication.postAuthEvents.map(function(){var e=r(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(v));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=20,Promise.all(A);case 20:return e.prev=20,E=new URL(i),n&&g&&E.searchParams.append("access_token",b),a("Apple redirect URL:",E),e.abrupt("return",window.location.assign(E));case 21:return e.prev=21,_=e.catch(20),a("Failed to redirect after authentication: ",_),window.location.assign(new URL(window.location.origin)),e.abrupt("return","Finished execution, please await result...");case 22:case"end":return e.stop()}},e,null,[[8,11],[13,16],[20,21]])}));return function(){return e.apply(this,arguments)}}(),Eu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("ANALYTICS: fireBC events"),e.next=1,Fc();case 1:a("ANALYTICS: bc values should be filled");case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Su=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c,u,l,d,h,p,f,m;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Nc();case 1:if(t=e.sent,n=t.idToken,r=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,s=fc(n),c=s.email,u=s.picture,l=s.sub,d=s.name,h=s.nickname,p=s.connection_source,f=null===(i=s.user_metadata)||void 0===i||null===(i=i.customProfile)||void 0===i?void 0:i.nickname,l.split("|").pop(),e.abrupt("return",{authenticated:r,nickname:f||h||d,email:c,picture:u,userId:l,connectionSource:p});case 3:e.prev=3,m=e.catch(2),a("Unable to parse idToken: ",n," Error: ",m);case 4:return e.abrupt("return",{authenticated:r});case 5:case"end":return e.stop()}},e,null,[[2,3]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.login=bu,window.MNGAuthentication.logout=yu,window.MNGAuthentication.getUserInfo=Su;var Tu=function(){var e=r(o.mark(function e(){var t,n,s,u,l,d,h,p,f,m,y,w,g;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=sc(),n=!1,s="",u=!1,l={},hu()&&window.ConnextUtils.rerunConnextEntitlements(!0),t.searchParams.get("returnAfterLogout")&&(d=decodeURIComponent(t.searchParams.get("returnAfterLogout")),window.location.assign(d)),t.searchParams.has("entitlement_jwt")&&(window.authentication_config.sessionManagementEnabled=!1),h=function(){var e=r(o.mark(function e(){var t,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,Mc();case 1:return t=e.sent,e.next=2,t.getIdTokenClaims();case 2:return l=e.sent,e.next=3,t.isAuthenticated();case 3:if(n=e.sent,s="object"===c(l)?l.__raw:"",r=cc(nc.ENTITLEMENT_COOKIE_KEY),n||!r){e.next=5;break}return e.next=4,t.getTokenSilently();case 4:u=e.sent;case 5:e.next=7;break;case 6:e.prev=6,i=e.catch(0),a("Unable to verify user has active auth0 session: ",i);case 7:case"end":return e.stop()}},e,null,[[0,6]])}));return function(){return e.apply(this,arguments)}}(),!t.pathname.startsWith("/logout")){e.next=2;break}return a("Page is logout. Routing to logout function..."),e.next=1,yu();case 1:return e.abrupt("return");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=9;break}return e.next=3,h();case 3:if(""===s){e.next=5;break}if(p=null,f=JSON.parse(window.localStorage.getItem(nc.LOCAL_STORAGE_SESSION_KEY)),"{}"!==ru()){e.next=4;break}return f&&(p=f.jwt),e.next=4,lu({idToken:s,entitlementToken:p});case 4:e.next=8;break;case 5:return e.prev=5,e.next=6,uu();case 6:m=e.sent,s=m.idToken,(n="string"==typeof s)&&(l=fc(s)),e.next=8;break;case 7:e.prev=7,g=e.catch(5),a("Unable to initialize session: ",g);case 8:e.next=10;break;case 9:return e.next=10,h();case 10:if(n||u||!i.A.blueconicEnabled||!i.A.bcLowaSegements){e.next=12;break}return e.next=11,Ic(!0);case 11:(y=e.sent).isSub&&(n=nc.USER_IS_LOWA,l={sub:y.uuid});case 12:if(Bc({isAuthenticated:n,idToken:s,accessToken:u,claims:l}),Kc("authenticationReady"),!0===n?(a("User is authenticated."),t.searchParams.get("auth_redirect")&&(a("Auth Redirect is present, sending user to auth redirect..."),(w=t.searchParams.get("auth_redirect")).endsWith("#")&&(w=w.slice(0,w.length)),window.location.assign(w)),t.pathname.startsWith("/login")&&!hu()&&(a("Page is login. The user is already logged in and Connext Logout param is not present... Redirecting..."),window.location.assign(t.origin))):a("User is not authenticated."),t.pathname.startsWith("/login")&&!hu()?(a("Page is login. Attempting to log user in..."),bu()):a("Page is not login or Connext state is present"),!t.pathname.startsWith("/callback")||!t.searchParams.get("regwall")){e.next=14;break}return a("Page is callback with regwall param. Routing to regwall receiver..."),e.next=13,Eu();case 13:a("Now login from regwall"),bu(),e.next=15;break;case 14:if(!t.pathname.startsWith("/callback")){e.next=15;break}return a("Page is callback without regwall param. Routing to callback receiver..."),e.next=15,Au();case 15:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=Tu;const _u={init:Tu};var Ru=function(e,t){return new Promise(function(n){try{"undefined"==typeof CnnXt&&(a("Connext was not loaded."),n(!1)),a("connext subscribeToNewsletter","about to call Cnnxt NewsletterSubscribe with pref id ".concat(t," and email ").concat(e)),CnnXt.API.NewsletterSubscribe({email:e,id:t,onSuccess:function(){a("Signed user up to newsletter: ",t),n(!0)},onError:function(e){a("subscribeToNewsletter error: ",e),n(!1)}})}catch(e){a("subscribeToNewsletter Error:",e),n(!1)}})};var Ou=function(){var e=r(o.mark(function e(t){var n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("Google token ",t),n=fc(t.credential),e.prev=1,Yc("one_tap_click"),localStorage.setItem("regwallSuccess","yes"),!i.A.newsletterId){e.next=2;break}return a("About to call Connext's subscribeToNewsletter function"),e.next=2,Ru(n.email,i.A.newsletterId);case 2:e.next=4;break;case 3:e.prev=3,r=e.catch(1),a("Error: ",r);case 4:return a("About to login with onetap flow..."),e.next=5,window.MNGAuthentication.login("googleonetap",i.A.useTribMainGoogle?"Trib-Google":"google-oauth2",n.email);case 5:case"end":return e.stop()}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),Iu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:google.accounts.id.initialize({client_id:i.A.googleClientId,callback:Ou,auto_select:!1,cancel_on_tap_outside:!1}),a("Showing the onetap modal..."),google.accounts.id.prompt(function(e){var t;e.isDisplayed()?t="one_tap_displayed":e.isSkippedMoment()?t="one_tap_cancel":e.isNotDisplayed()&&"suppressed_by_user"===e.j&&(t="one_tap_auto_hide"),Yc(t)});case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();const ku={init:function(){var e=r(o.mark(function e(){var t,n,r,s,c;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.A.oneTapEnabled){e.next=1;break}return e.abrupt("return");case 1:return e.next=2,Nc();case 2:if(t=e.sent,n=t.isAuthenticated,r=sc(),n!==nc.USER_IS_LOWA){e.next=5;break}return e.next=3,Oc();case 3:if(!(s=e.sent)||s.includes("google")){e.next=4;break}return e.abrupt("return");case 4:e.next=6;break;case 5:if(!(n||r.pathname.startsWith("/login")||r.pathname.startsWith("/logout")||r.pathname.startsWith("/callback"))){e.next=6;break}return e.abrupt("return");case 6:return e.next=7,gc();case 7:return a("onetap loading..."),c=new Date,e.next=8,Iu(c);case 8:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()};(function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("Settings: ",i.A),_u.init(),nu.onLoadAnalytics(),e.next=1,ku.init();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}})()()})()})(); //# sourceMappingURL=mng-digisubs.main.bundle.js.map; /*! For license information please see mng-digisubs.connext.bundle.js.LICENSE.txt */ (()=>{var e={7526(e,t){"use strict";t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,c=r-o;sc?c:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function u(e,t,n){for(var r,o=[],i=t;ia)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|m(e,t);let r=s(n);const o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|f(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||Z(e.length)?s(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|f(e))}function h(e){const t=e.length<0?0:0|f(e.length),n=s(t);for(let r=0;r=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function m(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(e).length;default:if(o)return r?-1:V(e).length;t=(""+t).toLowerCase(),o=!0}}function y(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return R(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return k(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function w(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){let i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;is&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;ro&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function R(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return E(this,e,t,n);case"ascii":case"latin1":case"binary":return A(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function I(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;or)&&(n=r);let o="";for(let r=t;rn)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function x(e,t,n,r,o){G(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function U(e,t,n,r,o){G(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function D(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],o=1,i=0;for(;++i>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q(function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],o=1,i=0;for(;++i=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q(function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||P(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){L(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i>>=0,n>>>=0,!r){L(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Q(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o>>=0,!r){const r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Q(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,n){return M(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return M(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function G(e,t,n,r,o,i){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new K.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||F(t,e.length-(n+1))}(r,o,i)}function W(e,t){if("number"!=typeof e)throw new K.ERR_INVALID_ARG_TYPE(t,"number",e)}function F(e,t,n){if(Math.floor(e)!==e)throw W(e,n),new K.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new K.ERR_BUFFER_OUT_OF_BOUNDS;throw new K.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}j("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),j("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),j("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=H(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=H(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function V(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function J(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<>1,l=-7,d=n?o-1:0,h=n?-1:1,p=e[t+d];for(d+=h,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=u}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&s,p+=f,s/=256,o-=8);for(a=a<0;e[n+p]=255&a,p+=f,a/=256,u-=8);e[n+p-f]|=128*m}},5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function o(){var t,n,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function c(e,o,i,a){var s=o&&o.prototype instanceof l?o:l,c=Object.create(s.prototype);return r(c,"_invoke",function(e,r,o){var i,a,s,c=0,l=o||[],d=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,a=0,s=t,h.n=n,u}};function p(e,r){for(a=e,s=r,n=0;!d&&c&&!o&&n3?(o=f===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=e<2&&pr||r>f)&&(i[4]=e,i[5]=r,h.n=f,a=0))}if(o||e>1)return u;throw d=!0,r}return function(o,l,f){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&p(l,f),a=l,s=f;(n=a<2?t:s)||!d;){i||(a?a<3?(a>1&&(h.n=-1),p(a,s)):h.n=s:h.v=s);try{if(c=2,i){if(a||(o="next"),n=i[o]){if(!(n=n.call(i,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=i.return)&&n.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((n=(d=h.n<0)?s:e.call(r,h))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:n,done:d}}}(e,i,a),!0),c}var u={};function l(){}function d(){}function h(){}n=Object.getPrototypeOf;var p=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),f=h.prototype=l.prototype=Object.create(p);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,r(e,s,"GeneratorFunction")),e.prototype=Object.create(f),e}return d.prototype=h,r(f,"constructor",h),r(h,"constructor",d),d.displayName="GeneratorFunction",r(h,s,"GeneratorFunction"),r(f),r(f,s,"Generator"),r(f,a,function(){return this}),r(f,"toString",function(){return"[object Generator]"}),(e.exports=o=function(){return{w:c,m}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,o,i){var a=r(e,t,n,o,i);return a.next().then(function(e){return e.done?e.value:a.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),o=n(1791);e.exports=function(e,t,n,i,a){return new o(r().w(e,t,n,i),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var r=n(5172),o=n(5546);e.exports=function e(t,n){function i(e,o,a,s){try{var c=t[e](o),u=c.value;return u instanceof r?n.resolve(u.v).then(function(e){i("next",e,a,s)},function(e){i("throw",e,a,s)}):n.resolve(u).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,s)})}catch(e){s(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),o(this,"_invoke",function(e,t,r){function o(){return new n(function(t,n){i(e,r,t,n)})}return a=a?a.then(o,o):o()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,o,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,r,o){function i(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?a?a(e,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[n]=r:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,o,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),o=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=o(),n=t.m(l),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function h(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var p={throw:1,return:2,break:3,continue:3};function f(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,p[e],t)},delegateYield:function(e,o,i){return t.resultName=o,n(r.d,u(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,r,o){return t.w(f(e),n,r,o&&o.reverse())},isGeneratorFunction:h,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:s,async:function(e,t,n,r,o){return(h(t)?a:i)(f(e),t,n,r,o)},keys:c,values:u}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},3612(e,t,n){"use strict";var r,o,i,a,s;n.d(t,{A:()=>c}),window.authentication_config.sessionManagementEnabled="1"===window.authentication_config.sessionManagement;const c={debug:!!window.authentication_config.debug,sessionServer:window.authentication_config?window.authentication_config.sessionServer:"",entitlementsEnabled:!!window.authentication_config&&"1"===window.authentication_config.entitlementsEnabled,dropdownEnabled:!!window.authentication_config&&"1"===window.authentication_config.dropdownEnabled,enableReaderDashboardLink:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardLink,enableDashboardCancel:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardCancel,enableDashboardBenefitHub:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardBenefitHub,enableEngageArticleGifting:"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.articleSharingEnabled)&&"1"===(null===(o=window.authentication_config)||void 0===o?void 0:o.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(a=window.authentication_config)||void 0===a?void 0:a.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(s=window.authentication_config)||void 0===s?void 0:s.articleSavingEnabled),prosperstackClientid:window.authentication_config?window.authentication_config.prosperstackClientid:"",enableUpgradeSubscription:!!window.authentication_config&&"1"===window.authentication_config.enableUpgradeSubscription,oneTapEnabled:!!window.authentication_config&&"1"===window.authentication_config.oneTapEnabled,useTribMainGoogle:!!window.authentication_config&&"1"===window.authentication_config.useTribMainGoogle,isAdfreeArticle:!!window.authentication_config&&"1"===window.authentication_config.isAdfreeArticle,auth0Domain:window.authentication_config?window.authentication_config.auth0Domain:"",auth0ClientId:window.authentication_config?window.authentication_config.auth0ClientId:"",entitlementsEndpoint:window.authentication_config?window.authentication_config.entitlementsEndpoint:"",entitlementsApiKey:window.authentication_config?window.authentication_config.entitlementsAPIKey:"",linaCheckOnArticles:!!window.authentication_config&&window.authentication_config.linaCheckOnArticles,serverEntitlements:!!window.authentication_config&&window.authentication_config.serverEntitlements,googleClientId:window.authentication_config?window.authentication_config.googleClientId:"",newsletterId:window.authentication_config?window.authentication_config.newsletterId:0,connextStorageKey:"",auth0SubKey:"auth0_sub",auth0Authenticated:"auth0.is.authenticated",secret:window.authentication_config?window.authentication_config.pluginSecret:"",newslettersEnabled:!!window.authentication_config&&"1"===window.authentication_config.newslettersEnabled,bcLowaSegements:!!window.authentication_config.bcLowaSegements&&"1"===window.authentication_config.bcLowaSegements,blueconicEnabled:!!window.authentication_config.blueconicEnabled&&"1"===window.authentication_config.blueconicEnabled,datadogEnabled:!!window.authentication_config.enableDatadog&&"1"===window.authentication_config.enableDatadog}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};function t(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function r(e){return function(){var n=this,r=arguments;return new Promise(function(o,i){var a=e.apply(n,r);function s(e){t(a,o,i,s,c,"next",e)}function c(e){t(a,o,i,s,c,"throw",e)}s(void 0)})}}n.r(e),n.d(e,{hasBrowserEnv:()=>Wa,hasStandardBrowserEnv:()=>Xa,hasStandardBrowserWebWorkerEnv:()=>Va,navigator:()=>Fa,origin:()=>Ja});var o=n(4756);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function a(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==i(t)?t:t+""}function s(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return atob(t)}}function p(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?setTimeout(n,t):n(null)}}window.addEventListener("storage",a),e.addToWaiting(a);var s=setTimeout(a,Math.max(0,t-Date.now()))})];case 1:return n.sent(),[2]}})})},e.addToWaiting=function(t){this.removeFromWaiting(t),void 0!==e.waiters&&e.waiters.push(t)},e.removeFromWaiting=function(t){void 0!==e.waiters&&(e.waiters=e.waiters.filter(function(e){return e!==t}))},e.notifyWaiters=function(){void 0!==e.waiters&&e.waiters.slice().forEach(function(e){return e()})},e.prototype.releaseLock=function(e){return g(this,void 0,void 0,function(){return b(this,function(t){switch(t.label){case 0:return[4,this.releaseLock__private__(e)];case 1:return[2,t.sent()]}})})},e.prototype.releaseLock__private__=function(t){return g(this,void 0,void 0,function(){var n,r,o,i;return b(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?A:this.storageHandler,r="browser-tabs-lock-key-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,E.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),E.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,o=[],i=0;;){var a=r.keySync(i);if(null===a)break;o.push(a),i++}for(var s=!1,c=0;cDate.now();class C extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,C.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new C(t,n)}}class N extends C{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super(e,t),this.state=n,this.appState=r,Object.setPrototypeOf(this,N.prototype)}}class P extends C{constructor(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(e,t),this.connection=n,this.state=r,this.appState=o,Object.setPrototypeOf(this,P.prototype)}}class L extends C{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,L.prototype)}}class x extends L{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,x.prototype)}}class U extends C{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,U.prototype)}}class D extends C{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,D.prototype)}}class M extends C{constructor(e,t,n,r){super(e,t),this.mfa_token=n,this.mfa_requirements=r,Object.setPrototypeOf(this,M.prototype)}}class B extends C{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(H(e,["default"]),"', scope: '").concat(H(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,B.prototype)}}class K extends C{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(H(e,["default"]),"', missing scope: '").concat(H(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,K.prototype)}}class j extends C{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,j.prototype)}}function H(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const G=()=>window.crypto,W=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return Array.from(G().getRandomValues(new Uint8Array(43))).forEach(n=>t+=e[n%66]),t},F=e=>btoa(e),X=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],V=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object.keys(e).reduce((n,r)=>{if(t&&"env"===r)return n;const o=X.find(e=>e.key===r);return o&&o.type.includes(typeof e[r])&&(n[r]=e[r]),n},{})},J=e=>{var{clientId:t}=e,n=p(e,["clientId"]);return new URLSearchParams((e=>Object.keys(e).filter(t=>void 0!==e[t]).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:e[n]}),{}))(Object.assign({client_id:t},n))).toString()},z=async e=>{const t=G().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},Y=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),Z=e=>{const t=new Uint8Array(e);return(e=>{const t={"+":"-","/":"_","=":""};return e.replace(/[+/=]/g,e=>t[e])})(window.btoa(String.fromCharCode(...Array.from(t))))},q=new TextEncoder,Q=new TextDecoder;function $(e){return"string"==typeof e?q.encode(e):Q.decode(e)}function ee(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new oe(`${e.name} modulusLength must be at least 2048 bits`)}let te;if(Uint8Array.prototype.toBase64)te=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;te=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r{const n=await fetch(e,t);return{ok:n.ok,json:await n.json(),headers:(r=n.headers,[...r].reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{}))};var r},he=async function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e4;return o?(async(e,t,n,r,o,i,a,s)=>((e,t)=>new Promise(function(n,r){const o=new MessageChannel;o.port1.onmessage=function(e){e.data.error?r(new Error(e.data.error)):n(e.data),o.port1.close()},t.postMessage(e,[o.port2])}))({auth:{audience:t,scope:n},timeout:o,fetchUrl:e,fetchOptions:r,useFormData:a,useMrrt:s},i))(e,t,n,r,a,o,i,arguments.length>7?arguments[7]:void 0):(async(e,t,n)=>{const r=new AbortController;let o;return t.signal=r.signal,Promise.race([de(e,t),new Promise((e,t)=>{o=setTimeout(()=>{r.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(o)})})(e,r,a)};async function pe(e,t,n,r,o,i,a,s,c,u){if(c){const t=await c.generateProof({url:e,method:o.method||"GET",nonce:await c.getNonce()});o.headers=Object.assign(Object.assign({},o.headers),{dpop:t})}let l,d=null;for(let c=0;c<3;c++)try{l=await he(e,n,r,o,i,a,t,s),d=null;break}catch(e){d=e}if(d)throw d;const h=l.json,{error:f,error_description:m}=h,y=p(h,["error","error_description"]),{headers:w,ok:g}=l;let b;if(c&&(b=w["dpop-nonce"],b&&await c.setNonce(b)),!g){const l=m||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===f)throw new M(f,l,y.mfa_token,y.mfa_requirements);if("missing_refresh_token"===f)throw new B(n,r);if("use_dpop_nonce"===f){if(!c||!b||u)throw new j(b);return pe(e,t,n,r,o,i,a,s,c,!0)}throw new C(f||"request_error",l)}return y}async function fe(e,t){var{baseUrl:n,timeout:r,audience:o,scope:i,auth0Client:a,useFormData:s,useMrrt:c,dpop:u}=e,l=p(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"]);const d="urn:ietf:params:oauth:grant-type:token-exchange"===l.grant_type,h="refresh_token"===l.grant_type&&c,f=Object.assign(Object.assign(Object.assign(Object.assign({},l),d&&o&&{audience:o}),d&&i&&{scope:i}),h&&{audience:o,scope:i}),m=s?J(f):JSON.stringify(f),y=(w=l.grant_type,le.includes(w));var w;return await pe("".concat(n,"/oauth/token"),r,o||"default",i,{method:"POST",body:m,headers:{"Content-Type":s?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(V(a||I)))}},t,s,c,y?u:void 0)}const me=function(){for(var e=arguments.length,t=new Array(e),n=0;nArray.from(new Set(e)))(t.filter(Boolean).join(" ").trim().split(/\s+/)).join(" ")},ye=(e,t,n)=>{let r;return n&&(r=e[n]),r||(r=e.default),me(r,t)};class we{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"@@auth0spajs@@",n=arguments.length>2?arguments[2]:void 0;this.prefix=t,this.suffix=n,this.clientId=e.clientId,this.scope=e.scope,this.audience=e.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(e){const[t,n,r,o]=e.split("::");return new we({clientId:n,scope:o,audience:r},t)}static fromCacheEntry(e){const{scope:t,audience:n,client_id:r}=e;return new we({scope:t,audience:n,clientId:r})}}class ge{set(e,t){localStorage.setItem(e,JSON.stringify(t))}get(e){const t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter(e=>e.startsWith("@@auth0spajs@@"))}}class be{constructor(){this.enclosedCache=function(){let e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class ve{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||k}async setIdToken(e,t,n){var r;const o=this.getIdTokenCacheKey(e);await this.cache.set(o,{id_token:t,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(o))}async getIdToken(e){const t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){const t=await this.get(e);if(!t)return;if(!t.id_token||!t.decodedToken)return;return{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;var o;let i=await this.cache.get(e.toKey());if(!i){const t=await this.getCacheKeys();if(!t)return;const o=this.matchExistingCacheKey(e,t);if(o&&(i=await this.cache.get(o)),!i&&n&&"cache-only"!==r)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const a=await this.nowProvider(),s=Math.floor(a/1e3);return i.expiresAt-t!e||t.includes(e)).reduce(async(e,t)=>{await e,await this.cache.remove(t)},Promise.resolve()),await(null===(t=this.keyManifest)||void 0===t?void 0:t.clear()))}async wrapCacheEntry(e){const t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?null===(e=await this.keyManifest.get())||void 0===e?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new we({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const r=we.fromKey(t),o=new Set(r.scope&&r.scope.split(" ")),i=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],a=r.scope&&i.reduce((e,t)=>e&&o.has(t),!0);return"@@auth0spajs@@"===r.prefix&&r.clientId===e.clientId&&r.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(const r of t){const t=we.fromKey(r);if("@@auth0spajs@@"===t.prefix&&t.clientId===e.clientId){const t=await this.cache.get(r);if(null===(n=null==t?void 0:t.body)||void 0===n?void 0:n.refresh_token)return this.modifiedCachedEntry(t,e)}}}async updateEntry(e,t){var n;const r=await this.getCacheKeys();if(r)for(const o of r){const r=await this.cache.get(o);if((null===(n=null==r?void 0:r.body)||void 0===n?void 0:n.refresh_token)===e){const e=Object.assign(Object.assign({},r.body),{refresh_token:t});await this.set(e)}}}}class Ee{constructor(e,t,n){this.storage=e,this.clientId=t,this.cookieDomain=n,this.storageKey="".concat("a0.spajs.txs",".").concat(this.clientId)}create(e){this.storage.save(this.storageKey,e,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}}const Ae=e=>"number"==typeof e,Se=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"];var Te=f&&f.__assign||function(){return Te=Object.assign||function(e){for(var t,n=1,r=arguments.length;nCe.get(e)||Ce.get("".concat("_legacy_").concat(e)),save(e,t,n){let r={};"https:"===window.location.protocol&&(r={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),Ie("".concat("_legacy_").concat(e),JSON.stringify(t),r),Ce.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),ke(e,n),Ce.remove(e,t),Ce.remove("".concat("_legacy_").concat(e),t)}},Pe={get(e){if("undefined"==typeof sessionStorage)return;const t=sessionStorage.getItem(e);return null!=t?JSON.parse(t):void 0},save(e,t){sessionStorage.setItem(e,JSON.stringify(t))},remove(e){sessionStorage.removeItem(e)}};var Le;!function(e){e.Code="code",e.ConnectCode="connect_code"}(Le||(Le={}));var xe,Ue=function(e){return xe=xe||function(e,t,n){var r=void 0===t?null:t,o=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),o=0,i=n.length;o(new be).enclosedCache,localstorage:()=>new ge},je=e=>Ke[e],He=e=>{const{openUrl:t,onRedirect:n}=e,r=p(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},Ge=(e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))},We={NONCE:"nonce",KEYPAIR:"keypair"};class Fe{constructor(e){this.clientId=e}getVersion(){return 1}createDbHandle(){const e=window.indexedDB.open("auth0-spa-js",this.getVersion());return new Promise((t,n)=>{e.onupgradeneeded=()=>Object.values(We).forEach(t=>e.result.createObjectStore(t)),e.onerror=()=>n(e.error),e.onsuccess=()=>t(e.result)})}async getDbHandle(){return this.dbHandle||(this.dbHandle=await this.createDbHandle()),this.dbHandle}async executeDbRequest(e,t,n){const r=n((await this.getDbHandle()).transaction(e,t).objectStore(e));return new Promise((e,t)=>{r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)})}buildKey(e){const t=e?"_".concat(e):"auth0";return"".concat(this.clientId,"::").concat(t)}setNonce(e,t){return this.save(We.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(We.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(We.NONCE,this.buildKey(e))}findKeyPair(){return this.find(We.KEYPAIR,this.buildKey())}find(e,t){return this.executeDbRequest(e,"readonly",e=>e.get(t))}async deleteBy(e,t){const n=await this.executeDbRequest(e,"readonly",e=>e.getAllKeys());null==n||n.filter(t).map(t=>this.executeDbRequest(e,"readwrite",e=>e.delete(t)))}deleteByClientId(e,t){return this.deleteBy(e,e=>"string"==typeof e&&e.startsWith("".concat(t,"::")))}clearNonces(){return this.deleteByClientId(We.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(We.KEYPAIR,this.clientId)}}class Xe{constructor(e){this.storage=new Fe(e)}getNonce(e){return this.storage.findNonce(e)}setNonce(e,t){return this.storage.setNonce(e,t)}async getOrGenerateKeyPair(){let e=await this.storage.findKeyPair();return e||(e=await async function(e,t){var n;let r;return r={name:"ECDSA",namedCurve:"P-256"},crypto.subtle.generateKey(r,null!==(n=null==t?void 0:t.extractable)&&void 0!==n&&n,["sign","verify"])}(0,{extractable:!1}),await this.storage.setKeyPair(e)),e}async generateProof(e){const t=await this.getOrGenerateKeyPair();return function(e){let{keyPair:t,url:n,method:r,nonce:o,accessToken:i}=e;const a=function(e){const t=new URL(e);return t.search="",t.hash="",t.href}(n);return ce(t,a,r,o,i)}(Object.assign({keyPair:t},e))}async calculateThumbprint(){return function(e){return async function(e){if(!se(e))throw new TypeError('"publicKey" must be a public CryptoKey');if(!0!==e.extractable)throw new TypeError('"publicKey.extractable" must be true');const t=await ue(e);let n;switch(t.kty){case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;default:throw new re("unsupported JWK kty")}return ne(await crypto.subtle.digest({name:"SHA-256"},$(JSON.stringify(n))))}(e.publicKey)}(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}var Ve;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(Ve||(Ve={}));class Je{constructor(e,t){this.hooks=t,this.config=Object.assign(Object.assign({},e),{fetch:e.fetch||("undefined"==typeof window?fetch:window.fetch.bind(window))})}isAbsoluteUrl(e){return/^(https?:)?\/\//i.test(e)}buildUrl(e,t){if(t){if(this.isAbsoluteUrl(t))return t;if(e)return"".concat(e.replace(/\/?\/$/,""),"/").concat(t.replace(/^\/+/,""))}throw new TypeError("`url` must be absolute or `baseUrl` non-empty.")}getAccessToken(e){return this.config.getAccessToken?this.config.getAccessToken(e):this.hooks.getAccessToken(e)}extractUrl(e){return"string"==typeof e?e:e instanceof URL?e.href:e.url}buildBaseRequest(e,t){if(!this.config.baseUrl)return new Request(e,t);const n=this.buildUrl(this.config.baseUrl,this.extractUrl(e)),r=e instanceof Request?new Request(n,e):n;return new Request(r,t)}setAuthorizationHeader(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ve.Bearer;e.headers.set("authorization","".concat(n," ").concat(t))}async setDpopProofHeader(e,t){if(!this.config.dpopNonceId)return;const n=await this.hooks.getDpopNonce(),r=await this.hooks.generateDpopProof({accessToken:t,method:e.method,nonce:n,url:e.url});e.headers.set("dpop",r)}async prepareRequest(e,t){const n=await this.getAccessToken(t);let r,o;"string"==typeof n?(r=this.config.dpopNonceId?Ve.DPoP:Ve.Bearer,o=n):(r=n.token_type,o=n.access_token),this.setAuthorizationHeader(e,o,r),r===Ve.DPoP&&await this.setDpopProofHeader(e,o)}getHeader(e,t){return Array.isArray(e)?new Headers(e).get(t)||"":"function"==typeof e.get?e.get(t)||"":e[t]||""}hasUseDpopNonceError(e){if(401!==e.status)return!1;const t=this.getHeader(e.headers,"www-authenticate");return t.includes("invalid_dpop_nonce")||t.includes("use_dpop_nonce")}async handleResponse(e,t){const n=this.getHeader(e.headers,"dpop-nonce");if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new j(n);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,n,r){const o=this.buildBaseRequest(e,t);await this.prepareRequest(o,r);const i=await this.config.fetch(o);return this.handleResponse(i,n)}fetchWithAuth(e,t,n){const r={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,Object.assign(Object.assign({},r),{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,t,r,n)}}class ze{constructor(e,t){this.myAccountFetcher=e,this.apiBase=t}async connectAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async completeAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/complete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(n){throw new Ye({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new Ye(t)}}class Ye extends Error{constructor(e){let{type:t,status:n,title:r,detail:o,validation_errors:i}=e;super(o),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=r,this.detail=o,this.validation_errors=i,Object.setPrototypeOf(this,Ye.prototype)}}const Ze={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};function qe(e,t){this.v=e,this.k=t}function Qe(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function $e(e){return new qe(e,0)}function et(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function tt(e,t){return e.get(Qe(e,t))}function nt(e,t,n){et(e,t),t.set(e,n)}function rt(e,t,n){return e.set(Qe(e,t),n),n}function ot(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function it(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function at(e){for(var t=1;t(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;St=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw pt("The input to be decoded is not correctly encoded.","ERR_INVALID_ARG_VALUE",e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e0)return;if(t){if(0!==e)throw pt("".concat(n," must be a non-negative number"),"ERR_INVALID_ARG_VALUE",o);return}throw pt("".concat(n," must be a positive number"),"ERR_INVALID_ARG_VALUE",o)}catch(e){if(r)throw It(e.message,r,o);throw e}}function xt(e,t,n,r){try{if("string"!=typeof e)throw pt("".concat(t," must be a string"),"ERR_INVALID_ARG_TYPE",r);if(0===e.length)throw pt("".concat(t," must not be empty"),"ERR_INVALID_ARG_VALUE",r)}catch(e){if(n)throw It(e.message,n,r);throw e}}function Ut(e){!function(e,t){if(on(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o2){const e=r.pop();t+="".concat(r.join(", "),", or ").concat(e)}else 2===r.length?t+="".concat(r[0]," or ").concat(r[1]):t+=r[0];return It(t,Rn,e)}(e,t)}(e,"application/json")}function Dt(){return _t(crypto.getRandomValues(new Uint8Array(32)))}function Mt(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new Rt("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"RSASSA-PKCS1-v1_5":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new Rt("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"ECDSA":return function(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new Rt("unsupported EcKeyAlgorithm namedCurve",{cause:e})}}(e);case"Ed25519":case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return e.algorithm.name;case"EdDSA":return"Ed25519";default:throw new Rt("unsupported CryptoKey algorithm name",{cause:e})}}function Bt(e){const t=null==e?void 0:e[mt];return"number"==typeof t&&Number.isFinite(t)?t:0}function Kt(e){const t=null==e?void 0:e[yt];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function jt(){return Math.floor(Date.now()/1e3)}function Ht(e){if("object"!=typeof e||null===e)throw pt('"as" must be an object',"ERR_INVALID_ARG_TYPE");xt(e.issuer,'"as.issuer"')}function Gt(e){if("object"!=typeof e||null===e)throw pt('"client" must be an object',"ERR_INVALID_ARG_TYPE");xt(e.client_id,'"client.client_id"')}function Wt(e){return xt(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function Ft(e,t){const{key:n,kid:r}=(o=e)instanceof CryptoKey?{key:o}:(null==o?void 0:o.key)instanceof CryptoKey?(void 0!==o.kid&&xt(o.kid,'"kid"'),{key:o.key,kid:o.kid}):{};var o;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw pt("".concat(t," must be a CryptoKey"),"ERR_INVALID_ARG_TYPE")}(e,t),"private"!==e.type)throw pt("".concat(t," must be a private CryptoKey"),"ERR_INVALID_ARG_VALUE")}(n,'"clientPrivateKey.key"'),async(e,o,i,a)=>{var s;const c={alg:Mt(n),kid:r},u=function(e,t){const n=jt()+Bt(t);return{jti:Dt(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,o);null==t||null===(s=t[gt])||void 0===s||s.call(t,c,u),i.set("client_id",o.client_id),i.set("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),i.set("client_assertion",await async function(e,t,n){if(!n.usages.includes("sign"))throw pt('CryptoKey instances used for signing assertions must include "sign" in their "usages"',"ERR_INVALID_ARG_VALUE");const r="".concat(_t(At(JSON.stringify(e))),".").concat(_t(At(JSON.stringify(t)))),o=_t(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:Mn(e)};case"RSA-PSS":switch(Dn(e),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new Rt("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return Dn(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Rt("unsupported CryptoKey algorithm name",{cause:e})}(n),n,At(r)));return"".concat(r,".").concat(o)}(c,u,n))}}const Xt=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function Vt(e,t){if(t&&"https:"!==e.protocol)throw It("only requests to HTTPS are allowed",In,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw It("only HTTP and HTTPS requests are allowed",kn,e)}function Jt(e,t,n,r){let o;if("string"!=typeof e||!(o=Xt(e)))throw It("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?Ln:xn,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return Vt(o,r),o}function zt(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?Jt(e.mtls_endpoint_aliases[t],t,n,r):Jt(e[t],t,n,r)}class Yt extends Error{constructor(e,t){var n;super(e,t),ot(this,"cause",void 0),ot(this,"code",void 0),ot(this,"error",void 0),ot(this,"status",void 0),ot(this,"error_description",void 0),ot(this,"response",void 0),this.name=this.constructor.name,this.code=En,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:t.response}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class Zt extends Error{constructor(e,t){var n,r;super(e,t),ot(this,"cause",void 0),ot(this,"code",void 0),ot(this,"error",void 0),ot(this,"error_description",void 0),this.name=this.constructor.name,this.code=Sn,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=null!==(n=t.cause.get("error_description"))&&void 0!==n?n:void 0,null===(r=Error.captureStackTrace)||void 0===r||r.call(Error,this,this.constructor)}}class qt extends Error{constructor(e,t){var n;super(e,t),ot(this,"cause",void 0),ot(this,"code",void 0),ot(this,"response",void 0),ot(this,"status",void 0),this.name=this.constructor.name,this.code=vn,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}const Qt=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)"),$t=new RegExp('^[,\\s]*([a-zA-Z0-9!#$%&\\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"[,\\s]*(.*)'),en=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)[,\\s]*(.*)"),tn=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function nn(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(t=function(e){if(!ht(e,Response))throw pt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(Qt);const i=null===(o=t)||void 0===o?void 0:o[1].toLowerCase();if(!i)return;const a=r.substring(t[0].length);if(a&&!a.match(/^[\s,]/))return;const s=a.match(/^\s+(.*)$/),c=!!s;r=s?s[1]:void 0;const u={};let l;if(c)for(;r;){let n,o;if(t=r.match($t)){if([,n,o,r]=t,o.includes("\\"))try{o=JSON.parse('"'.concat(o,'"'))}catch(e){}u[n.toLowerCase()]=o}else{if(!(t=r.match(en))){if(t=r.match(tn)){if(Object.keys(u).length)break;[,l,r]=t;break}return}[,n,o,r]=t,u[n.toLowerCase()]=o}}else r=a||void 0;const d={scheme:i,parameters:u};l&&(d.token68=l),n.push(d)}return n.length?n:void 0}(e))throw new qt("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}(e),t=await async function(e){if(e.status>399&&e.status<500){Un(e),Ut(e);try{const t=await e.clone().json();if(kt(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(r=e.body)||void 0===r?void 0:r.cancel()),new Yt("server responded with an error in the response body",{cause:t,response:e});throw It('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),On,e)}}function rn(e){if(!fn.has(e))throw pt('"options.DPoP" is not a valid DPoPHandle',"ERR_INVALID_ARG_VALUE")}function on(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function an(e,t,n,r,o,i,a){return await n(e,t,o,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[wt])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:Nt(r,null==a?void 0:a.signal)})}async function sn(e,t,n,r,o,i){var a;const s=zt(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[ft]));o.set("grant_type",r);const c=Ct(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(rn(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await an(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const cn=new WeakMap,un=new WeakMap;function ln(e){if(!e.id_token)return;const t=cn.get(e);if(!t)throw pt('"ref" was already garbage collected or did not resolve from the proper sources',"ERR_INVALID_ARG_VALUE");return t}async function dn(e,t,n,r,o,i){if(Ht(e),Gt(t),!ht(n,Response))throw pt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await nn(n,200,"Token Endpoint"),Un(n);const a=await Gn(n);if(xt(a.access_token,'"response" body "access_token" property',_n,{body:a}),xt(a.token_type,'"response" body "token_type" property',_n,{body:a}),a.token_type=a.token_type.toLowerCase(),void 0!==a.expires_in){let e="number"!=typeof a.expires_in?parseFloat(a.expires_in):a.expires_in;Lt(e,!0,'"response" body "expires_in" property',_n,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&xt(a.refresh_token,'"response" body "refresh_token" property',_n,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw It('"response" body "scope" property must be a string',_n,{body:a});if(void 0!==a.id_token){xt(a.id_token,'"response" body "id_token" property',_n,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(Lt(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const{claims:s,jwt:c}=await async function(e,t,n,r,o){let i,a,{0:s,1:c,length:u}=e.split(".");if(5===u){if(void 0===o)throw new Rt("JWE decryption is not configured",{cause:e});e=await o(e),({0:s,1:c,length:u}=e.split("."))}if(3!==u)throw It("Invalid JWT",_n,e);try{i=JSON.parse(At(_t(s)))}catch(e){throw It("failed to parse JWT Header body as base64url encoded JSON",Tn,e)}if(!kt(i))throw It("JWT Header must be a top level object",_n,e);if(t(i),void 0!==i.crit)throw new Rt('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(At(_t(c)))}catch(e){throw It("failed to parse JWT Payload body as base64url encoded JSON",Tn,e)}if(!kt(a))throw It("JWT Payload must be a top level object",_n,e);const l=jt()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw It('unexpected JWT "exp" (expiration time) claim type',_n,{claims:a});if(a.exp<=l-r)throw It('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',Cn,{claims:a,now:l,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw It('unexpected JWT "iat" (issued at) claim type',_n,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw It('unexpected JWT "iss" (issuer) claim type',_n,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw It('unexpected JWT "nbf" (not before) claim type',_n,{claims:a});if(a.nbf>l+r)throw It('unexpected JWT "nbf" (not before) claim value',Cn,{claims:a,now:l,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw It('unexpected JWT "aud" (audience) claim type',_n,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,Bn.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Bt(t),Kt(t),o).then(wn.bind(void 0,i)).then(pn.bind(void 0,e)).then(hn.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw It('ID Token "aud" (audience) claim includes additional untrusted audiences',Nn,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw It('unexpected ID Token "azp" (authorized party) claim value',Nn,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&Lt(s.auth_time,!0,'ID Token "auth_time" (authentication time)',_n,{claims:s}),un.set(n,c),cn.set(a,s)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new Rt("unsupported `token_type` value",{cause:{body:a}});return a}function hn(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw It('unexpected JWT "aud" (audience) claim value',Nn,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw It('unexpected JWT "aud" (audience) claim value',Nn,{expected:e,claims:t.claims,claim:"aud"});return t}function pn(e,t){var n,r;const o=null!==(n=null===(r=e[Fn])||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw It('unexpected JWT "iss" (issuer) claim value',Nn,{expected:o,claims:t.claims,claim:"iss"});return t}const fn=new WeakSet,mn=Symbol(),yn={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function wn(e,t){for(const n of e)if(void 0===t.claims[n])throw It('JWT "'.concat(n,'" (').concat(yn[n],") claim missing"),_n,{claims:t.claims});return t}const gn=Symbol(),bn=Symbol();const vn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",En="OAUTH_RESPONSE_BODY_ERROR",An="OAUTH_UNSUPPORTED_OPERATION",Sn="OAUTH_AUTHORIZATION_RESPONSE_ERROR",Tn="OAUTH_PARSE_ERROR",_n="OAUTH_INVALID_RESPONSE",Rn="OAUTH_RESPONSE_IS_NOT_JSON",On="OAUTH_RESPONSE_IS_NOT_CONFORM",In="OAUTH_HTTP_REQUEST_FORBIDDEN",kn="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",Cn="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",Nn="OAUTH_JWT_CLAIM_COMPARISON_FAILED",Pn="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",Ln="OAUTH_MISSING_SERVER_METADATA",xn="OAUTH_INVALID_SERVER_METADATA";function Un(e){if(e.bodyUsed)throw pt('"response" body has been used already',"ERR_INVALID_ARG_VALUE")}function Dn(e){const{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Rt("unsupported ".concat(t.name," modulusLength"),{cause:e})}function Mn(e){const{algorithm:t}=e;switch(t.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Rt("unsupported ECDSA namedCurve",{cause:e})}}function Bn(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw It('unexpected JWT "alg" header parameter',_n,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw It('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?r.alg!==n:"function"==typeof n?!n(r.alg):!n.includes(r.alg))throw It('unexpected JWT "alg" header parameter',_n,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw It('unexpected JWT "alg" header parameter',_n,{header:r,expected:e,reason:"client configuration"})}function Kn(e,t){const{0:n,length:r}=e.getAll(t);if(r>1)throw It('"'.concat(t,'" parameter must be provided only once'),_n);return n}const jn=Symbol(),Hn=Symbol();async function Gn(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ut;try{t=await e.json()}catch(t){throw n(e),It('failed to parse "response" body as JSON',Tn,t)}if(!kt(t))throw It('"response" body must be a top level object',_n,{body:t});return t}const Wn=Symbol(),Fn=Symbol(),Xn=new TextEncoder,Vn=new TextDecoder;function Jn(e){const t=new Uint8Array(e.length);for(let n=0;n127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=r}return t}function zn(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),ot(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),ot(this,"claim",void 0),ot(this,"reason",void 0),ot(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}ot(qn,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Qn extends Zn{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),ot(this,"code","ERR_JWT_EXPIRED"),ot(this,"claim",void 0),ot(this,"reason",void 0),ot(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}ot(Qn,"code","ERR_JWT_EXPIRED");class $n extends Zn{constructor(){super(...arguments),ot(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}ot($n,"code","ERR_JOSE_ALG_NOT_ALLOWED");class er extends Zn{constructor(){super(...arguments),ot(this,"code","ERR_JOSE_NOT_SUPPORTED")}}ot(er,"code","ERR_JOSE_NOT_SUPPORTED"),ot(class extends Zn{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),ot(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),ot(class extends Zn{constructor(){super(...arguments),ot(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class tr extends Zn{constructor(){super(...arguments),ot(this,"code","ERR_JWS_INVALID")}}ot(tr,"code","ERR_JWS_INVALID");class nr extends Zn{constructor(){super(...arguments),ot(this,"code","ERR_JWT_INVALID")}}ot(nr,"code","ERR_JWT_INVALID"),ot(class extends Zn{constructor(){super(...arguments),ot(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class rr extends Zn{constructor(){super(...arguments),ot(this,"code","ERR_JWKS_INVALID")}}ot(rr,"code","ERR_JWKS_INVALID");class or extends Zn{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no applicable key found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),ot(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}ot(or,"code","ERR_JWKS_NO_MATCHING_KEY");class ir extends Zn{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"multiple matching keys found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),ot(this,Symbol.asyncIterator,void 0),ot(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}ot(ir,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class ar extends Zn{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),ot(this,"code","ERR_JWKS_TIMEOUT")}}ot(ar,"code","ERR_JWKS_TIMEOUT");class sr extends Zn{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),ot(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}ot(sr,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const cr=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},ur=(e,t)=>e.name===t;function lr(e){return parseInt(e.name.slice(4),10)}function dr(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2){const t=r.pop();e+="one of type ".concat(r.join(", "),", or ").concat(t,".")}else 2===r.length?e+="one of type ".concat(r[0]," or ").concat(r[1],"."):e+="of type ".concat(r[0],".");if(null==t)e+=" Received ".concat(t);else if("function"==typeof t&&t.name)e+=" Received function ".concat(t.name);else if("object"==typeof t&&null!=t){var i;null!==(i=t.constructor)&&void 0!==i&&i.name&&(e+=" Received an instance of ".concat(t.constructor.name))}return e}const hr=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},fr=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),mr=e=>pr(e)||fr(e);function yr(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 n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}const wr=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n{const t=e.data[e.pos++];if(128&t){const n=127&t;let r=0;for(let t=0;t{if(e.data[e.pos++]!==t)throw new Error(n)},vr=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},Er=(e,t,n)=>{var r;const o=(e=>zn(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);let i=n;return null!=t&&null!==(r=t.startsWith)&&void 0!==r&&r.call(t,"ECDH-ES")&&(i||(i={}),i.getNamedCurve=e=>{const t={data:e,pos:0};return function(e){br(e,48,"Invalid PKCS#8 structure"),gr(e),br(e,2,"Expected version field");const t=gr(e);e.pos+=t,br(e,48,"Expected algorithm identifier");gr(e);e.pos}(t),(e=>{const t=(e=>{br(e,6,"Expected algorithm OID");const t=gr(e);return vr(e,t)})(e);if(wr(t,[43,101,110]))return"X25519";if(!wr(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");br(e,6,"Expected curve OID");const n=gr(e),r=vr(e,n);for(const{name:e,oid:t}of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}])if(wr(r,t))return e;throw new Error("Unsupported named curve")})(t)}),(async(e,t,n,r)=>{var o;let i,a;const s="spki"===e,c=()=>s?["verify"]:["sign"];switch(n){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(n.slice(-3),10)||1)},a=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":i={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[n]},a=c();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{const e=r.getNamedCurve(t);i="X25519"===e?{name:"X25519"}:{name:"ECDH",namedCurve:e}}catch(e){throw new er("Invalid or unsupported key format")}a=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":i={name:"Ed25519"},a=c();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":i={name:n},a=c();break;default:throw new er('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(e,t,i,null!==(o=null==r?void 0:r.extractable)&&void 0!==o?o:!!s,a)})("pkcs8",o,t,i)};async function Ar(e){var t,n;if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:r,keyUsages:o}=function(e){let t,n;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},n=e.priv?["sign"]:["verify"];break;default:throw new er('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(e.alg.slice(-3),10)||1)},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new er('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new er('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new er('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new er('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}(e),i=at({},e);return"AKP"!==i.kty&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,r,null!==(t=e.ext)&&void 0!==t?t:!e.d&&!e.priv,null!==(n=e.key_ops)&&void 0!==n?n:o)}const Sr=e=>yr(e)&&"string"==typeof e.kty;let Tr;const _r=async function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Tr||(Tr=new WeakMap);let o=Tr.get(e);if(null!=o&&o[n])return o[n];const i=await Ar(at(at({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:Tr.set(e,{[n]:i}),i};const Rr=e=>null==e?void 0:e[Symbol.toStringTag],Or=(e,t,n)=>{if(void 0!==t.use){let e;switch(n){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==e)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(e,'" when present'));if(Array.isArray(t.key_ops)){var r,o;let i;switch(!0){case"sign"===n||"verify"===n:case"dir"===e:case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):i=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===n?"wrapKey":"unwrapKey":n;break;case"encrypt"===n&&e.startsWith("RSA"):i="wrapKey";break;case"decrypt"===n:i=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&!1===(null===(r=t.key_ops)||void 0===r||null===(o=r.includes)||void 0===o?void 0:o.call(r,i)))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(i,'" when present'))}return!0};var Ir,kr;let Cr,Nr;if("undefined"==typeof navigator||null===(Ir=navigator.userAgent)||void 0===Ir||null===(kr=Ir.startsWith)||void 0===kr||!kr.call(Ir,"Mozilla/5.0 ")){const e="v6.8.1";Nr="".concat("openid-client","/").concat(e),Cr={"user-agent":Nr}}const Pr=e=>Lr.get(e);let Lr,xr;function Ur(e){return void 0!==e?Wt(e):(xr||(xr=new WeakMap),(e,t,n,r)=>{let o;return(o=xr.get(t))||(function(e,t){if("string"!=typeof e)throw Kr("".concat(t," must be a string"),Br);if(0===e.length)throw Kr("".concat(t," must not be empty"),Mr)}(t.client_secret,'"metadata.client_secret"'),o=Wt(t.client_secret),xr.set(t,o)),o(e,t,n,r)})}const Dr=wt,Mr="ERR_INVALID_ARG_VALUE",Br="ERR_INVALID_ARG_TYPE";function Kr(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class jr extends Error{constructor(e,t){var n;super(e,t),ot(this,"code",void 0),this.name=this.constructor.name,this.code=null==t?void 0:t.code,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function Hr(e,t,n){return new jr(e,{cause:t,code:n})}function Gr(e){if(e instanceof TypeError||e instanceof jr||e instanceof Yt||e instanceof Zt||e instanceof qt)throw e;if(e instanceof Ot)switch(e.code){case In:throw Hr("only requests to HTTPS are allowed",e,e.code);case kn:throw Hr("only requests to HTTP or HTTPS are allowed",e,e.code);case On:throw Hr("unexpected HTTP response status code",e.cause,e.code);case Rn:throw Hr("unexpected response content-type",e.cause,e.code);case Tn:throw Hr("parsing error occured",e,e.code);case _n:throw Hr("invalid response encountered",e,e.code);case Nn:throw Hr("unexpected JWT claim value encountered",e,e.code);case Pn:throw Hr("unexpected JSON attribute value encountered",e,e.code);case Cn:throw Hr("JWT timestamp claim value failed validation",e,e.code);default:throw Hr(e.message,e,e.code)}if(e instanceof Rt)throw Hr("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw Hr("runtime operation error",e,An);case"NotSupportedError":throw Hr("runtime unsupported operation",e,An);case"TimeoutError":throw Hr("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw Hr("operation aborted",e,"OAUTH_ABORT")}throw new jr("something went wrong",{cause:e})}async function Wr(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw Kr('"server" must be an instance of URL',Br);const o=!e.href.includes("/.well-known/"),i=null!==(n=null==t?void 0:t.timeout)&&void 0!==n?n:30,a=AbortSignal.timeout(1e3*i),s=await(o?async function(e,t){return async function(e,t,n,r){if(!(e instanceof URL))throw pt('"'.concat("issuerIdentifier",'" must be an instance of URL'),"ERR_INVALID_ARG_TYPE");Vt(e,!0!==(null==r?void 0:r[ft]));const o=n(new URL(e.href)),i=Ct(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[wt])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:Nt(o,null==r?void 0:r.signal)})}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=Pt("".concat(e.pathname,"/").concat(".well-known/openid-configuration"))}(e);break;case"oauth2":!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"/"===e.pathname?e.pathname=t:e.pathname=Pt("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw pt('"options.algorithm" must be "oidc" (default), or "oauth2"',"ERR_INVALID_ARG_VALUE")}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[wt]:null==t?void 0:t[Dr],[ft]:null==t||null===(r=t.execute)||void 0===r?void 0:r.includes(qr),signal:a,headers:new Headers(Cr)}):((null==t?void 0:t[Dr])||fetch)((Vt(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(qr)),e.href),{headers:Object.fromEntries(new Headers(at({accept:"application/json"},Cr)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Wn)throw pt('"expectedIssuerIdentifier" must be an instance of URL',"ERR_INVALID_ARG_TYPE");if(!ht(t,Response))throw pt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");if(200!==t.status)throw It('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',On,t);Un(t);const r=await Gn(t);if(xt(r.issuer,'"response" body "issuer" property',_n,{body:r}),n!==Wn&&new URL(r.issuer).href!==n.href)throw It('"response" body "issuer" property does not match the expected value',Pn,{expected:n.href,body:r,attribute:"issuer"});return r}(Wn,e)).catch(Gr);var c;return o&&new URL(s.issuer).href!==e.href&&(function(e,t,n){return!("https://login.microsoftonline.com"!==e.origin||null!=n&&n.algorithm&&"oidc"!==n.algorithm||(t[Fr]=!0,0))}(e,s,t)||function(e,t){return!(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)}(e,t)||(()=>{throw new jr("discovered metadata issuer does not match the expected issuer",{code:Pn,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new Xr(i,t,n,r);let s=Pr(a);if(null!=o&&o[Dr]&&(s.fetch=o[Dr]),null!=o&&o.timeout&&(s.timeout=o.timeout),null!=o&&o.execute)for(const e of o.execute)e(a);return a}new TextDecoder;const Fr=Symbol();class Xr{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw Kr('"clientId" must be a non-empty string',Br);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(o=n)||void 0===o?void 0:o.client_id)&&t!==n.client_id)throw Kr('"clientId" and "metadata.client_id" must be the same',Mr);const u=at(at({},structuredClone(n)),{},{client_id:t});let l;u[mt]=null!==(i=null===(a=n)||void 0===a?void 0:a[mt])&&void 0!==i?i:0,u[yt]=null!==(s=null===(c=n)||void 0===c?void 0:c[yt])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?Ur(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);Fr in e&&(h[Fn]=t=>{let{claims:{tid:n}}=t;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);Lr||(Lr=new WeakMap),Lr.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(Pr(this).as);return function(e){Object.defineProperties(e,function(e){return{supportsPKCE:{__proto__:null,value(){var t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"S256";return!0===(null===(t=e.code_challenge_methods_supported)||void 0===t?void 0:t.includes(n))}}}}(e))}(e),e}clientMetadata(){return structuredClone(Pr(this).c)}get timeout(){return Pr(this).timeout}set timeout(e){Pr(this).timeout=e}get[Dr](){return Pr(this).fetch}set[Dr](e){Pr(this).fetch=e}}function Vr(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}return{expiresIn:{__proto__:null,value(){if(t){const e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return ln(this)}catch(e){return}}}}}(e))}async function Jr(e,t,n){var r;let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===(r=e.headers.get("retry-after"))||void 0===r?void 0:r.trim();if(void 0===i)return;let a;if(/^\d+$/.test(i))a=parseInt(i,10);else{const e=new Date(i);if(Number.isFinite(e.getTime())){const t=new Date,n=e.getTime()-t.getTime();n>0&&(a=Math.ceil(n/1e3))}}if(o&&!Number.isFinite(a))throw new Ot("invalid Retry-After header value",{cause:e});a>t&&await zr(a-t,n)}function zr(e,t){return new Promise((n,r)=>{const o=e=>{try{t.throwIfAborted()}catch(e){return void r(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>o(e-i),1e3*i)};o(e)})}async function Yr(e,t){ro(e);const{as:n,c:r,auth:o,fetch:i,tlsOnly:a,timeout:s}=Pr(e);return async function(e,t,n,r,o){Ht(e),Gt(t);const i=zt(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[ft])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=Ct(null==o?void 0:o.headers);return s.set("accept","application/json"),an(e,t,n,i,a,s,o)}(n,r,o,t,{[wt]:i,[ft]:!a,headers:new Headers(Cr),signal:oo(s)}).then(e=>async function(e,t,n){if(Ht(e),Gt(t),!ht(n,Response))throw pt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await nn(n,200,"Backchannel Authentication Endpoint"),Un(n);const r=await Gn(n);xt(r.auth_req_id,'"response" body "auth_req_id" property',_n,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return Lt(o,!0,'"response" body "expires_in" property',_n,{body:r}),r.expires_in=o,void 0!==r.interval&&Lt(r.interval,!1,'"response" body "interval" property',_n,{body:r}),r}(n,r,e)).catch(Gr)}async function Zr(e,t,n,r){var o,i;ro(e),n=new URLSearchParams(n);let a=null!==(o=t.interval)&&void 0!==o?o:5;const s=null!==(i=null==r?void 0:r.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await zr(a,s)}catch(e){Gr(e)}const{as:c,c:u,auth:l,fetch:d,tlsOnly:h,nonRepudiation:p,timeout:f,decrypt:m}=Pr(e),y=(o,i)=>Zr(e,at(at({},t),{},{interval:o}),n,at(at({},r),{},{signal:s,flag:i})),w=await async function(e,t,n,r,o){Ht(e),Gt(t),xt(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),sn(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(c,u,l,t.auth_req_id,{[wt]:d,[ft]:!h,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(Cr),signal:s.aborted?s:oo(f)}).catch(Gr);var g;if(503===w.status&&w.headers.has("retry-after"))return await Jr(w,a,s,!0),await(null===(g=w.body)||void 0===g?void 0:g.cancel()),y(a);const b=async function(e,t,n,r){return dn(e,t,n,void 0,null==r?void 0:r[bt],null==r?void 0:r.recognizedTokenTypes)}(c,u,w,{[bt]:m});let v;try{v=await b}catch(e){if(io(e,r))return y(a,ao);if(e instanceof Yt)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await Jr(e.response,a,s),y(a)}Gr(e)}return v.id_token&&await(null==p?void 0:p(w)),Vr(v),v}function qr(e){Pr(e).tlsOnly=!1}async function Qr(e,t,n,r,o){if(ro(e),!((null==o?void 0:o.flag)===ao||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw Kr('"currentUrl" must be an instance of URL, or Request',Br);let i,a;const{as:s,c,auth:u,fetch:l,tlsOnly:d,jarm:h,hybrid:p,nonRepudiation:f,timeout:m,decrypt:y,implicit:w}=Pr(e);if((null==o?void 0:o.flag)===ao)i=o.authResponse,a=o.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(t=new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await async function(e){if("POST"!==e.method)throw pt("form_post responses are expected to use the POST method","ERR_INVALID_ARG_VALUE",{cause:e});if("application/x-www-form-urlencoded"!==on(e))throw pt("form_post responses are expected to use the application/x-www-form-urlencoded content-type","ERR_INVALID_ARG_VALUE",{cause:e});return async function(e){if(e.bodyUsed)throw pt("form_post Request instances must contain a readable body","ERR_INVALID_ARG_VALUE",{cause:e});return e.text()}(e)}(e));if(p)t.hash=n.toString();else for(const[e,r]of n.entries())t.searchParams.append(e,r);break;default:throw Kr("unexpected Request HTTP method",Mr)}}switch(a=function(e){return(e=new URL(e)).search="",e.hash="",e.href}(t),!0){case!!h:i=await h(t,null==n?void 0:n.expectedState);break;case!!p:i=await p(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!w:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{i=function(e,t,n,r){if(Ht(e),Gt(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw pt('"parameters" must be an instance of URLSearchParams, or URL',"ERR_INVALID_ARG_TYPE");if(Kn(n,"response"))throw It('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',_n,{parameters:n});const o=Kn(n,"iss"),i=Kn(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw It('response parameter "iss" (issuer) missing',_n,{parameters:n});if(o&&o!==e.issuer)throw It('unexpected "iss" (issuer) response parameter value',_n,{expected:e.issuer,parameters:n});switch(r){case void 0:case Hn:if(void 0!==i)throw It('unexpected "state" response parameter encountered',_n,{expected:void 0,parameters:n});break;case jn:break;default:if(xt(r,'"expectedState" argument'),i!==r)throw It(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',_n,{expected:r,parameters:n})}if(Kn(n,"error"))throw new Zt("authorization response from the server is an error",{cause:n});const a=Kn(n,"id_token"),s=Kn(n,"token");if(void 0!==a||void 0!==s)throw new Rt("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),fn.add(c),c;var c}(s,c,t.searchParams,null==n?void 0:n.expectedState)}catch(e){Gr(e)}}}const g=await async function(e,t,n,r,o,i,a){if(Ht(e),Gt(t),!fn.has(r))throw pt('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',"ERR_INVALID_ARG_VALUE");xt(o,'"redirectUri"');const s=Kn(r,"code");if(!s)throw It('no authorization code in "callbackParameters"',_n);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==mn&&(xt(i,'"codeVerifier"'),c.set("code_verifier",i)),sn(e,t,n,"authorization_code",c,a)}(s,c,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||mn,{additionalParameters:r,[wt]:l,[ft]:!d,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Cr),signal:oo(m)}).catch(Gr);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const b=async function(e,t,n,r){return"string"==typeof(null==r?void 0:r.expectedNonce)||"number"==typeof(null==r?void 0:r.maxAge)||null!=r&&r.requireIdToken?async function(e,t,n,r,o,i,a){const s=[];switch(r){case void 0:r=gn;break;case gn:break;default:xt(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||(o=t.default_max_age),o){case void 0:o=bn;break;case bn:break;default:Lt(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await dn(e,t,n,s,i,a);xt(c.id_token,'"response" body "id_token" property',_n,{body:c});const u=ln(c);if(o!==bn){const e=jt()+Bt(t),n=Kt(t);if(u.auth_time+o{let n;return"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(n={n_a:()=>{}}),async function(e,t,n,r){return dn(e,t,n,void 0,null==r?void 0:r[bt],null==r?void 0:r.recognizedTokenTypes)}(o,i,e,{[bt]:l,recognizedTokenTypes:n})}).catch(Gr);return Vr(d),d}async function co(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;i=void 0!==n?new Map([...Object.entries(n),...t.entries()]):t;for(const t of r.crit){if(!i.has(t))throw new er('Extension Header Parameter "'.concat(t,'" is not recognized'));if(void 0===o[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i.get(t)&&void 0===r[t])throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return new Set(r.crit)}(tr,new Map([["b64",!0]]),null==n?void 0:n.crit,r,o);let a=!0;if(i.has("b64")&&(a=r.b64,"boolean"!=typeof a))throw new tr('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=o;if("string"!=typeof s||!s)throw new tr('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=n&&function(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat("algorithms",'" option must be an array of strings'));if(t)return new Set(t)}(0,n.algorithms);if(c&&!c.has(s))throw new $n('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof e.payload)throw new tr("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new tr("JWS Payload must be a string or an Uint8Array instance");let u=!1;"function"==typeof t&&(t=await t(r,e),u=!0),function(e,t,n){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((e,t,n)=>{if(!(t instanceof Uint8Array)){if(Sr(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&Or(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!mr(t))throw new TypeError(hr(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(Rr(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(Sr(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&Or(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if((e=>"oct"!==e.kty&&void 0===e.d&&void 0===e.priv)(t)&&Or(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!mr(t))throw new TypeError(hr(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(Rr(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(Rr(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(Rr(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(Rr(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(Rr(t),' instances for asymmetric algorithm encryption must be of type "public"'))}})(e,t,n)}}(s,t,"verify");const l=function(){for(var e=arguments.length,t=new Array(e),n=0;n{let{length:n}=t;return e+n},0),o=new Uint8Array(r);let i=0;for(const e of t)o.set(e,i),i+=e.length;return o}(void 0!==e.protected?Jn(e.protected):new Uint8Array,Jn("."),"string"==typeof e.payload?a?Jn(e.payload):Xn.encode(e.payload):e.payload);let d;try{d=Yn(e.signature)}catch(e){throw new tr("Failed to base64url decode the signature")}const h=await async function(e,t){if(e instanceof Uint8Array)return e;if(pr(e))return e;if(fr(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{Tr||(Tr=new WeakMap);let n=Tr.get(e);if(null!=n&&n[t])return n[t];const r="public"===e.type,o=!!r;let i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError("given KeyObject instance cannot be used for this algorithm");i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError("given KeyObject instance cannot be used for this algorithm");i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let n;switch(t){case"RSA-OAEP":n="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":n="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":n="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":n="SHA-512";break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:n},o,r?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:n},o,[r?"verify":"sign"])}if("ec"===e.asymmetricKeyType){var a;const n=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(null===(a=e.asymmetricKeyDetails)||void 0===a?void 0:a.namedCurve);if(!n)throw new TypeError("given KeyObject instance cannot be used for this algorithm");"ES256"===t&&"P-256"===n&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),"ES384"===t&&"P-384"===n&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),"ES512"===t&&"P-521"===n&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:n},o,r?[]:["deriveBits"]))}if(!i)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return n?n[t]=i:Tr.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return _r(e,n,t)}if(Sr(e))return e.k?Yn(e.k):_r(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await co(e,t,"verify");!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if("number"!=typeof n||n<2048)throw new TypeError("".concat(e," requires key modulusLength to be 2048 bits or larger"))}}(e,o);const i=function(e,t){const n="SHA-".concat(e.slice(-3));switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new er("alg ".concat(e," is not supported either by JOSE or your javascript runtime"))}}(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch(e){return!1}}(s,h,d,l))throw new sr;let p;if(a)try{p=Yn(e.payload)}catch(e){throw new tr("Failed to base64url decode the payload")}else p="string"==typeof e.payload?Xn.encode(e.payload):e.payload;const f={payload:p};return void 0!==e.protected&&(f.protectedHeader=r),void 0!==e.header&&(f.unprotectedHeader=e.header),u?at(at({},f),{},{key:h}):f}const lo=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function ho(e){const t=lo.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]);let r;switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":r=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":r=Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":r=Math.round(3600*n);break;case"day":case"days":case"d":r=Math.round(86400*n);break;case"week":case"weeks":case"w":r=Math.round(604800*n);break;default:r=Math.round(31557600*n)}return"-"===t[1]||"ago"===t[4]?-r:r}const po=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());async function fo(e,t,n){var r;const o=await async function(e,t,n){if(e instanceof Uint8Array&&(e=Vn.decode(e)),"string"!=typeof e)throw new tr("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:i,length:a}=e.split(".");if(3!==a)throw new tr("Invalid Compact JWS");const s=await uo({payload:o,protected:r,signature:i},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?at(at({},c),{},{key:s.key}):c}(e,t,n);if(null!==(r=o.protectedHeader.crit)&&void 0!==r&&r.includes("b64")&&!1===o.protectedHeader.b64)throw new nr("JWTs MUST NOT use unencoded payload");const i=function(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(Vn.decode(t))}catch(e){}if(!yr(n))throw new nr("JWT Claims Set must be a top-level JSON object");const{typ:o}=r;if(o&&("string"!=typeof e.typ||po(e.typ)!==po(o)))throw new qn('unexpected "typ" JWT header value',n,"typ","check_failed");const{requiredClaims:i=[],issuer:a,subject:s,audience:c,maxTokenAge:u}=r,l=[...i];void 0!==u&&l.push("iat"),void 0!==c&&l.push("aud"),void 0!==s&&l.push("sub"),void 0!==a&&l.push("iss");for(const e of new Set(l.reverse()))if(!(e in n))throw new qn('missing required "'.concat(e,'" claim'),n,e,"missing");if(a&&!(Array.isArray(a)?a:[a]).includes(n.iss))throw new qn('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new qn('unexpected "sub" claim value',n,"sub","check_failed");if(c&&!((e,t)=>"string"==typeof e?t.includes(e):!!Array.isArray(e)&&t.some(Set.prototype.has.bind(new Set(e))))(n.aud,"string"==typeof c?[c]:c))throw new qn('unexpected "aud" claim value',n,"aud","check_failed");let d;switch(typeof r.clockTolerance){case"string":d=ho(r.clockTolerance);break;case"number":d=r.clockTolerance;break;case"undefined":d=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:h}=r,p=(e=>Math.floor(e.getTime()/1e3))(h||new Date);if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new qn('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new qn('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>p+d)throw new qn('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new qn('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=p-d)throw new Qn('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){const e=p-n.iat;if(e-d>("number"==typeof u?u:ho(u)))throw new Qn('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-d)throw new qn('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}(o.protectedHeader,o.payload,n),a={payload:i,protectedHeader:o.protectedHeader};return"function"==typeof t?at(at({},a),{},{key:o.key}):a}function mo(e){return yr(e)}var yo,wo,go=new WeakMap,bo=new WeakMap;class vo{constructor(e){if(nt(this,go,void 0),nt(this,bo,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(mo)}(e))throw new rr("JSON Web Key Set malformed");rt(go,this,structuredClone(e))}jwks(){return tt(go,this)}async getKey(e,t){const{alg:n,kid:r}=at(at({},e),null==t?void 0:t.header),o=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new er('Unsupported "alg" value for a JSON Web Key Set')}}(n),i=tt(go,this).keys.filter(e=>{let t=o===e.kty;if(t&&"string"==typeof r&&(t=r===e.kid),!t||"string"!=typeof e.alg&&"AKP"!==o||(t=n===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t)switch(n){case"ES256":t="P-256"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv;break;case"Ed25519":case"EdDSA":t="Ed25519"===e.crv}return t}),{0:a,length:s}=i;if(0===s)throw new or;if(1!==s){const e=new ir,t=tt(bo,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new ct(e.apply(this,arguments))}}(function*(){for(const e of i)try{yield yield $e(Eo(t,e,n))}catch(e){}}),e}return Eo(tt(bo,this),a,n)}}async function Eo(e,t,n){const r=e.get(t)||e.set(t,{}).get(t);if(void 0===r[n]){const e=await async function(e,t){if(!yr(e))throw new TypeError("JWK must be an object");let n;switch(null!=t||(t=e.alg),null!=n||(n=e.ext),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return Yn(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new er('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return Ar(at(at({},e),{},{alg:t,ext:n}));case"AKP":if("string"!=typeof e.alg||!e.alg)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw new TypeError("JWK alg and alg option value mismatch");return Ar(at(at({},e),{},{ext:n}));case"EC":case"OKP":return Ar(at(at({},e),{},{alg:t,ext:n}));default:throw new er('Unsupported "kty" (Key Type) Parameter value')}}(at(at({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new rr("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function Ao(e){const t=new vo(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>structuredClone(t.jwks()),enumerable:!1,configurable:!1,writable:!1}}),n}let So;if("undefined"==typeof navigator||null===(yo=navigator.userAgent)||void 0===yo||null===(wo=yo.startsWith)||void 0===wo||!wo.call(yo,"Mozilla/5.0 ")){const e="v6.1.3";So="".concat("jose","/").concat(e)}const To=Symbol(),_o=Symbol();var Ro=new WeakMap,Oo=new WeakMap,Io=new WeakMap,ko=new WeakMap,Co=new WeakMap,No=new WeakMap,Po=new WeakMap,Lo=new WeakMap,xo=new WeakMap,Uo=new WeakMap;class Do{constructor(e,t){if(nt(this,Ro,void 0),nt(this,Oo,void 0),nt(this,Io,void 0),nt(this,ko,void 0),nt(this,Co,void 0),nt(this,No,void 0),nt(this,Po,void 0),nt(this,Lo,void 0),nt(this,xo,void 0),nt(this,Uo,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;rt(Ro,this,new URL(e.href)),rt(Oo,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),rt(Io,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),rt(ko,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),rt(Po,this,new Headers(null==t?void 0:t.headers)),So&&!tt(Po,this).has("User-Agent")&&tt(Po,this).set("User-Agent",So),tt(Po,this).has("accept")||(tt(Po,this).set("accept","application/json"),tt(Po,this).append("accept","application/jwk-set+json")),rt(Lo,this,null==t?void 0:t[To]),void 0!==(null==t?void 0:t[_o])&&(rt(Uo,this,null==t?void 0:t[_o]),n=null==t?void 0:t[_o],r=tt(ko,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&yr(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,yr)&&(rt(Co,this,tt(Uo,this).uat),rt(xo,this,Ao(tt(Uo,this).jwks))))}pendingFetch(){return!!tt(No,this)}coolingDown(){return"number"==typeof tt(Co,this)&&Date.now()3&&void 0!==arguments[3]?arguments[3]:fetch;const o=await r(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new ar;throw e});if(200!==o.status)throw new Zn("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new Zn("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(tt(Ro,this).href,tt(Po,this),AbortSignal.timeout(tt(Oo,this)),tt(Lo,this)).then(e=>{rt(xo,this,Ao(e)),tt(Uo,this)&&(tt(Uo,this).uat=Date.now(),tt(Uo,this).jwks=e),rt(Co,this,Date.now()),rt(No,this,void 0)}).catch(e=>{throw rt(No,this,void 0),e})),await tt(No,this)}}const Mo=["mfaToken"],Bo=["mfaToken"];var Ko,jo,Ho,Go,Wo,Fo,Xo,Vo,Jo=class extends Error{constructor(e,t){super(t),ot(this,"code",void 0),this.name="NotSupportedError",this.code=e}},zo=class extends Error{constructor(e,t,n){super(t),ot(this,"cause",void 0),ot(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Yo=class extends zo{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},Zo=class extends zo{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},qo=class extends zo{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Qo=class extends zo{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},$o=class extends zo{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},ei=class extends Error{constructor(e){super(e),ot(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},ti=class extends zo{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),ot(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},ni=class extends zo{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},ri=class extends zo{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},oi=class extends zo{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},ii=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),ot(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function ai(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).reduce((e,t)=>at(at({},e),{},{[t[0]]:t[1]}),{})}var si=class extends Error{constructor(e,t,n){super(t),ot(this,"cause",void 0),ot(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},ci=class extends si{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},ui=class extends si{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},li=class extends si{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},di=class extends si{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function hi(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var pi=(Ko=new WeakMap,jo=new WeakMap,Ho=new WeakMap,class{constructor(e){var t;nt(this,Ko,void 0),nt(this,jo,void 0),nt(this,Ho,void 0),rt(Ko,this,"https://".concat(e.domain)),rt(jo,this,e.clientId),rt(Ho,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(tt(Ko,this),"/mfa/authenticators"),{mfaToken:n}=e,r=await tt(Ho,this).call(this,t,{method:"GET",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!r.ok){const e=await r.json();throw new ci(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(hi)}async enrollAuthenticator(e){const t="".concat(tt(Ko,this),"/mfa/associate"),{mfaToken:n}=e,r=st(e,Mo),o={authenticator_types:r.authenticatorTypes};"oobChannels"in r&&(o.oob_channels=r.oobChannels),"phoneNumber"in r&&r.phoneNumber&&(o.phone_number=r.phoneNumber),"email"in r&&r.email&&(o.email=r.email);const i=await tt(Ho,this).call(this,t,{method:"POST",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new ui(e.error_description||"Failed to enroll authenticator",e)}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const{authenticatorId:t,mfaToken:n}=e,r="".concat(tt(Ko,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await tt(Ho,this).call(this,r,{method:"DELETE",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!o.ok){const e=await o.json();throw new li(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(tt(Ko,this),"/mfa/challenge"),{mfaToken:n}=e,r=st(e,Bo),o={mfa_token:n,client_id:tt(jo,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await tt(Ho,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new di(e.error_description||"Failed to challenge authenticator",e)}return function(e){const t={challengeType:e.challenge_type};return void 0!==e.oob_code&&(t.oobCode=e.oob_code),void 0!==e.binding_method&&(t.bindingMethod=e.binding_method),t}(await i.json())}}),fi=class e{constructor(e,t,n,r,o,i,a){ot(this,"accessToken",void 0),ot(this,"idToken",void 0),ot(this,"refreshToken",void 0),ot(this,"expiresAt",void 0),ot(this,"scope",void 0),ot(this,"claims",void 0),ot(this,"authorizationDetails",void 0),ot(this,"tokenType",void 0),ot(this,"issuedTokenType",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=r,this.expiresAt=t,this.scope=o,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,r=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return r.tokenType=t.token_type,r.issuedTokenType=t.issued_token_type,r}},mi="openid profile email offline_access",yi=Object.freeze(new Set(["grant_type","client_id","client_secret","client_assertion","client_assertion_type","subject_token","subject_token_type","requested_token_type","actor_token","actor_token_type","audience","aud","resource","resources","resource_indicator","scope","connection","login_hint","organization","assertion"]));function wi(e){if(null==e)throw new $o("subject_token is required");if("string"!=typeof e)throw new $o("subject_token must be a string");if(0===e.trim().length)throw new $o("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new $o("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new $o("subject_token must not include the 'Bearer ' prefix")}function gi(e,t){if(t)for(const[n,r]of Object.entries(t))if(!yi.has(n))if(Array.isArray(r)){if(r.length>20)throw new $o("Parameter '".concat(n,"' exceeds maximum array size of ").concat(20));r.forEach(t=>{e.append(n,t)})}else e.append(n,r)}var bi=(Go=new WeakMap,Wo=new WeakMap,Fo=new WeakMap,Xo=new WeakMap,Vo=new WeakSet,class{constructor(e){if(function(e,t){et(e,t),t.add(e)}(this,Vo),nt(this,Go,void 0),nt(this,Wo,void 0),nt(this,Fo,void 0),nt(this,Xo,void 0),ot(this,"mfa",void 0),rt(Fo,this,e),e.useMtls&&!e.customFetch)throw new Jo("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");this.mfa=new pi({domain:tt(Fo,this).domain,clientId:tt(Fo,this).clientId,customFetch:tt(Fo,this).customFetch})}async buildAuthorizationUrl(e){const{serverMetadata:t}=await Qe(Vo,this,vi).call(this);if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new Jo("par_not_supported_error","The Auth0 tenant does not have pushed authorization requests enabled. Learn how to enable it here: https://auth0.com/docs/get-started/applications/configure-par");try{return await Qe(Vo,this,Ti).call(this,e)}catch(e){throw new ni(e)}}async buildLinkUserUrl(e){try{const t=await Qe(Vo,this,Ti).call(this,{authorizationParams:at(at({},e.authorizationParams),{},{requested_connection:e.connection,requested_connection_scope:e.connectionScope,scope:"openid link_account offline_access",id_token_hint:e.idToken})});return{linkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new ri(e)}}async buildUnlinkUserUrl(e){try{const t=await Qe(Vo,this,Ti).call(this,{authorizationParams:at(at({},e.authorizationParams),{},{requested_connection:e.connection,scope:"openid unlink_account",id_token_hint:e.idToken})});return{unlinkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new oi(e)}}async backchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await Qe(Vo,this,vi).call(this),r=ai(at(at({},tt(Fo,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(at(at({scope:mi},r),{},{client_id:tt(Fo,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:n.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&o.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&o.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await Yr(t,o),n=await Zr(t,e);return fi.fromTokenEndpointResponse(n)}catch(e){throw new ti(e)}}async initiateBackchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await Qe(Vo,this,vi).call(this),r=ai(at(at({},tt(Fo,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(at(at({scope:mi},r),{},{client_id:tt(Fo,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:n.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&o.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&o.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await Yr(t,o);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new ti(e)}}async backchannelAuthenticationGrant(e){let{authReqId:t}=e;const{configuration:n}=await Qe(Vo,this,vi).call(this),r=new URLSearchParams({auth_req_id:t});try{const e=await so(n,"urn:openid:params:grant-type:ciba",r);return fi.fromTokenEndpointResponse(e)}catch(e){throw new ti(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new Qo("Either a refresh or access token should be specified, but not both.");const n=null!==(t=e.accessToken)&&void 0!==t?t:e.refreshToken;if(!n)throw new Qo("Either a refresh or access token must be specified.");try{return await this.exchangeToken({connection:e.connection,subjectToken:n,subjectTokenType:e.accessToken?"urn:ietf:params:oauth:token-type:access_token":"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof $o)throw new Qo(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?Qe(Vo,this,Ei).call(this,e):Qe(Vo,this,Ai).call(this,e)}async getTokenByCode(e,t){const{configuration:n}=await Qe(Vo,this,vi).call(this);try{const r=await Qr(n,e,{pkceCodeVerifier:t.codeVerifier});return fi.fromTokenEndpointResponse(r)}catch(e){throw new Yo("There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){const{configuration:t}=await Qe(Vo,this,vi).call(this);try{const n=await $r(t,e.refreshToken);return fi.fromTokenEndpointResponse(n)}catch(e){throw new qo("The access token has expired and there was an error while trying to refresh it.",e)}}async getTokenByClientCredentials(e){const{configuration:t}=await Qe(Vo,this,vi).call(this);try{const n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);const r=await eo(t,n);return fi.fromTokenEndpointResponse(r)}catch(e){throw new Zo("There was an error while trying to request a token.",e)}}async buildLogoutUrl(e){const{configuration:t,serverMetadata:n}=await Qe(Vo,this,vi).call(this);if(!n.end_session_endpoint){const t=new URL("https://".concat(tt(Fo,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",tt(Fo,this).clientId),t}return function(e,t){ro(e);const{as:n,c:r,tlsOnly:o}=Pr(e),i=zt(n,"end_session_endpoint",!1,o);(t=new URLSearchParams(t)).has("client_id")||t.set("client_id",r.client_id);for(const[e,n]of t.entries())i.searchParams.append(e,n);return i}(t,{post_logout_redirect_uri:e.returnTo})}async verifyLogoutToken(e){const{serverMetadata:t}=await Qe(Vo,this,vi).call(this);tt(Xo,this)||rt(Xo,this,function(e,t){const n=new Do(e,t),r=async(e,t)=>n.getKey(e,t);return Object.defineProperties(r,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>n.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>n.jwks(),enumerable:!0,configurable:!1,writable:!1}}),r}(new URL(t.jwks_uri),{[To]:tt(Fo,this).customFetch}));const{payload:n}=await fo(e.logoutToken,tt(Xo,this),{issuer:t.issuer,audience:tt(Fo,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]});if(!("sid"in n)&&!("sub"in n))throw new ei('either "sid" or "sub" (or both) claims must be present');if("sid"in n&&"string"!=typeof n.sid)throw new ei('"sid" claim must be a string');if("sub"in n&&"string"!=typeof n.sub)throw new ei('"sub" claim must be a string');if("nonce"in n)throw new ei('"nonce" claim is prohibited');if(!("events"in n))throw new ei('"events" claim is missing');if("object"!=typeof n.events||null===n.events)throw new ei('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in n.events))throw new ei('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof n.events["http://schemas.openid.net/event/backchannel-logout"])throw new ei('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:n.sid,sub:n.sub}}});async function vi(){if(tt(Go,this)&&tt(Wo,this))return{configuration:tt(Go,this),serverMetadata:tt(Wo,this)};const e=await Qe(Vo,this,Si).call(this);return rt(Go,this,await Wr(new URL("https://".concat(tt(Fo,this).domain)),tt(Fo,this).clientId,{use_mtls_endpoint_aliases:tt(Fo,this).useMtls},e,{[Dr]:tt(Fo,this).customFetch})),rt(Wo,this,tt(Go,this).serverMetadata()),tt(Go,this)[Dr]=tt(Fo,this).customFetch||fetch,{configuration:tt(Go,this),serverMetadata:tt(Wo,this)}}async function Ei(e){var t,n;const{configuration:r}=await Qe(Vo,this,vi).call(this);if("audience"in e||"resource"in e)throw new $o("audience and resource parameters are not supported for Token Vault exchanges");wi(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(t=e.subjectTokenType)&&void 0!==t?t:"urn:ietf:params:oauth:token-type:access_token",requested_token_type:null!==(n=e.requestedTokenType)&&void 0!==n?n:"http://auth0.com/oauth/token-type/federated-connection-access-token"});e.loginHint&&o.append("login_hint",e.loginHint),e.scope&&o.append("scope",e.scope),gi(o,e.extra);try{const e=await so(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return fi.fromTokenEndpointResponse(e)}catch(t){throw new $o("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function Ai(e){const{configuration:t}=await Qe(Vo,this,vi).call(this);wi(e.subjectToken);const n=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.requestedTokenType&&n.append("requested_token_type",e.requestedTokenType),e.organization&&n.append("organization",e.organization),gi(n,e.extra);try{const e=await so(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return fi.fromTokenEndpointResponse(e)}catch(t){throw new $o("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function Si(){if(!tt(Fo,this).clientSecret&&!tt(Fo,this).clientAssertionSigningKey&&!tt(Fo,this).useMtls)throw new ii;if(tt(Fo,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=tt(Fo,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||(e=await async function(e,t){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return Er(e,t,void 0)}(e,tt(Fo,this).clientAssertionSigningAlg||"RS256")),e?function(e){return Ft(e,void 0)}(e):Ur(tt(Fo,this).clientSecret)}async function Ti(e){const{configuration:t}=await Qe(Vo,this,vi).call(this),n=Dt(),r=await function(e){return async function(e){return xt(e,"codeVerifier"),_t(await crypto.subtle.digest("SHA-256",At(e)))}(e)}(n),o=ai(at(at({},tt(Fo,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(at(at({scope:mi},o),{},{client_id:tt(Fo,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await no(t,i):await to(t,i),codeVerifier:n}}class _i extends C{constructor(e,t){super(e,t),Object.setPrototypeOf(this,_i.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new _i(t,n)}}class Ri extends _i{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ri.prototype)}}class Oi extends _i{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Oi.prototype)}}class Ii extends _i{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ii.prototype)}}class ki extends _i{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ki.prototype)}}class Ci extends _i{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ci.prototype)}}class Ni{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e5;this.contexts=new Map,this.ttlMs=e}set(e,t){this.cleanup(),this.contexts.set(e,Object.assign(Object.assign({},t),{createdAt:Date.now()}))}get(e){const t=this.contexts.get(e);if(t){if(!(Date.now()-t.createdAt>this.ttlMs))return t;this.contexts.delete(e)}}remove(e){this.contexts.delete(e)}cleanup(){const e=Date.now();for(const[t,n]of this.contexts)e-n.createdAt>this.ttlMs&&this.contexts.delete(t)}get size(){return this.contexts.size}}class Pi{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new Ni}setMFAAuthDetails(e,t,n,r){this.contextManager.set(e,{scope:t,audience:n,mfaRequirements:r})}async getAuthenticators(e){var t,n;const r=this.contextManager.get(e);if(!(null===(t=null==r?void 0:r.mfaRequirements)||void 0===t?void 0:t.challenge)||0===r.mfaRequirements.challenge.length)throw new Ri("invalid_request","challengeType is required and must contain at least one challenge type, please check mfa_required error payload");const o=r.mfaRequirements.challenge.map(e=>e.type);try{return(await this.authJsMfaClient.listAuthenticators({mfaToken:e})).filter(e=>!!e.type&&o.includes(e.type))}catch(e){if(e instanceof ci)throw new Ri(null===(n=e.cause)||void 0===n?void 0:n.error,e.message);throw e}}async enroll(e){var t;const n=function(e){const t=Ze[e.factorType];return Object.assign(Object.assign(Object.assign({mfaToken:e.mfaToken,authenticatorTypes:t.authenticatorTypes},t.oobChannels&&{oobChannels:t.oobChannels}),"phoneNumber"in e&&{phoneNumber:e.phoneNumber}),"email"in e&&{email:e.email})}(e);try{return await this.authJsMfaClient.enrollAuthenticator(n)}catch(e){if(e instanceof ui)throw new Oi(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async challenge(e){var t;try{const t={challengeType:e.challengeType,mfaToken:e.mfaToken};return e.authenticatorId&&(t.authenticatorId=e.authenticatorId),await this.authJsMfaClient.challengeAuthenticator(t)}catch(e){if(e instanceof di)throw new Ii(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async getEnrollmentFactors(e){const t=this.contextManager.get(e);if(!t||!t.mfaRequirements)throw new Ci("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");return t.mfaRequirements.enroll&&0!==t.mfaRequirements.enroll.length?t.mfaRequirements.enroll:[]}async verify(e){const t=this.contextManager.get(e.mfaToken);if(!t)throw new ki("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");const n=function(e){return"otp"in e&&e.otp?"http://auth0.com/oauth/grant-type/mfa-otp":"oobCode"in e&&e.oobCode?"http://auth0.com/oauth/grant-type/mfa-oob":"recoveryCode"in e&&e.recoveryCode?"http://auth0.com/oauth/grant-type/mfa-recovery-code":void 0}(e);if(!n)throw new ki("invalid_request","Unable to determine grant type. Provide one of: otp, oobCode, or recoveryCode.");const r=t.scope,o=t.audience;try{const t=await this.auth0Client._requestTokenForMfa({grant_type:n,mfaToken:e.mfaToken,scope:r,audience:o,otp:e.otp,oob_code:e.oobCode,binding_code:e.bindingCode,recovery_code:e.recoveryCode});return this.contextManager.remove(e.mfaToken),t}catch(e){if(e instanceof M)this.setMFAAuthDetails(e.mfa_token,r,o,e.mfa_requirements);else if(e instanceof ki)throw new ki(e.error,e.error_description);throw e}}}const Li=new R;class xi{constructor(e){let t,n;if(this.userCache=(new be).enclosedCache,this.activeLockKeys=new Set,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{const e=Array.from(this.activeLockKeys);for(const t of e)await Li.releaseLock(t);this.activeLockKeys.clear(),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),"undefined"!=typeof window&&(()=>{if(!G())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===G().subtle)throw new Error("\n auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.\n ")})(),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(t=e.cacheLocation||"memory",!je(t))throw new Error('Invalid cache location "'.concat(t,'"'));n=je(t)()}var r;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===e.legacySameSiteCookie?Ce:Ne,this.orgHintCookieName=(r=this.options.clientId,"auth0.".concat(r,".organization_hint")),this.isAuthenticatedCookieName=(e=>"auth0.".concat(e,".is.authenticated"))(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const o=e.useCookiesForTransactions?this.cookieStorage:Pe;var i;this.scope=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o{const o=e[n];i[n]=me(t,o,...r)}),i}(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new Ee(o,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||k,this.cacheManager=new ve(n,n.allKeys?void 0:new Be(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new Xe(this.options.clientId):void 0,this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:"https://".concat(i)),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:"https://".concat(e,"/"):"".concat(t,"/"))(this.options.issuer,this.domainUrl);const a="".concat(this.domainUrl,"/me/"),s=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{getAccessToken:()=>this.getTokenSilently({authorizationParams:{scope:"create:me:connected_accounts",audience:a},detailedResponse:!0})}));this.myAccountApi=new ze(s,a),this.authJsClient=new bi({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new Pi(this.authJsClient.mfa,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&"memory"===t&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new Ue)}getConfiguration(){return Object.freeze({domain:this.options.domain,clientId:this.options.clientId})}_url(e){const t=this.options.auth0Client||I,n=V(t,!0),r=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(r)}_authorizeUrl(e){return this._url("/authorize?".concat(J(e)))}async _verifyIdToken(e,t,n){const r=await this.nowProvider();return(e=>{if(!e.id_token)throw new Error("ID token is required but missing");const t=(e=>{const t=e.split("."),[n,r,o]=t;if(3!==t.length||!n||!r||!o)throw new Error("ID token could not be decoded");const i=JSON.parse(Y(r)),a={__raw:e},s={};return Object.keys(i).forEach(e=>{a[e]=i[e],Se.includes(e)||(s[e]=i[e])}),{encoded:{header:n,payload:r,signature:o},header:JSON.parse(Y(n)),claims:a,user:s}})(e.id_token);if(!t.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(t.claims.iss!==e.iss)throw new Error('Issuer (iss) claim mismatch in the ID token; expected "'.concat(e.iss,'", found "').concat(t.claims.iss,'"'));if(!t.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if("RS256"!==t.header.alg)throw new Error('Signature algorithm of "'.concat(t.header.alg,'" is not supported. Expected the ID token to be signed with "RS256".'));if(!t.claims.aud||"string"!=typeof t.claims.aud&&!Array.isArray(t.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e.aud))throw new Error('Audience (aud) claim mismatch in the ID token; expected "'.concat(e.aud,'" but was not one of "').concat(t.claims.aud.join(", "),'"'));if(t.claims.aud.length>1){if(!t.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(t.claims.azp!==e.aud)throw new Error('Authorized Party (azp) claim mismatch in the ID token; expected "'.concat(e.aud,'", found "').concat(t.claims.azp,'"'))}}else if(t.claims.aud!==e.aud)throw new Error('Audience (aud) claim mismatch in the ID token; expected "'.concat(e.aud,'" but found "').concat(t.claims.aud,'"'));if(e.nonce){if(!t.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(t.claims.nonce!==e.nonce)throw new Error('Nonce (nonce) claim mismatch in the ID token; expected "'.concat(e.nonce,'", found "').concat(t.claims.nonce,'"'))}if(e.max_age&&!Ae(t.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(null==t.claims.exp||!Ae(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Ae(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=e.leeway||60,r=new Date(e.now||Date.now()),o=new Date(0);if(o.setUTCSeconds(t.claims.exp+n),r>o)throw new Error("Expiration Time (exp) claim error in the ID token; current time (".concat(r,") is after expiration time (").concat(o,")"));if(null!=t.claims.nbf&&Ae(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),ro)throw new Error("Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (".concat(r,") is after last auth at ").concat(o))}if(e.organization){const n=e.organization.trim();if(n.startsWith("org_")){const e=n;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(e!==t.claims.org_id)throw new Error('Organization ID (org_id) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_id,'"'))}else{const e=n.toLowerCase();if(!t.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(e!==t.claims.org_name)throw new Error('Organization Name (org_name) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_name,'"'))}}return t})({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:t,organization:n,leeway:this.options.leeway,max_age:(o=this.options.authorizationParams.max_age,"string"!=typeof o?o:parseInt(o,10)||void 0),now:r});var o}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(e,t,n){var r;const o=F(W()),i=F(W()),a=W(),s=await z(a),c=Z(s),u=await(null===(r=this.dpop)||void 0===r?void 0:r.calculateThumbprint()),l=((e,t,n,r,o,i,a,s,c)=>Object.assign(Object.assign(Object.assign({client_id:e.clientId},e.authorizationParams),n),{scope:ye(t,n.scope,n.audience),response_type:"code",response_mode:s||"query",state:r,nonce:o,redirect_uri:a||e.authorizationParams.redirect_uri,code_challenge:i,code_challenge_method:"S256",dpop_jkt:c}))(this.options,this.scope,e,o,i,c,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==t?void 0:t.response_mode,u),d=this._authorizeUrl(l);return{nonce:i,code_verifier:a,scope:l.scope,audience:l.audience||"default",redirect_uri:l.redirect_uri,state:o,url:d}}async loginWithPopup(e,t){var n;if(e=e||{},!(t=t||{}).popup&&(t.popup=(()=>{const e=window.screenX+(window.innerWidth-400)/2,t=window.screenY+(window.innerHeight-600)/2;return window.open("","auth0:authorize:popup","left=".concat(e,",top=").concat(t,",width=").concat(400,",height=").concat(600,",resizable,scrollbars=yes,status=1"))})(),!t.popup))throw new D;const r=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);t.popup.location.href=r.url;const o=await(e=>new Promise((t,n)=>{let r;const o=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(o),clearTimeout(i),window.removeEventListener("message",r,!1),n(new U(e.popup)))},1e3),i=setTimeout(()=>{clearInterval(o),n(new x(e.popup)),window.removeEventListener("message",r,!1)},1e3*(e.timeoutInSeconds||60));r=function(a){if(a.data&&"authorization_response"===a.data.type){if(clearTimeout(i),clearInterval(o),window.removeEventListener("message",r,!1),!1!==e.closePopup&&e.popup.close(),a.data.response.error)return n(C.fromPayload(a.data.response));t(a.data.response)}},window.addEventListener("message",r)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(r.state!==o.state)throw new C("state_mismatch","Invalid state");const i=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:o.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:i})}async getUser(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.user}async getIdTokenClaims(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.claims}async loginWithRedirect(){var e;const t=He(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{openUrl:n,fragment:r,appState:o}=t,i=p(t,["openUrl","fragment","appState"]),a=(null===(e=i.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,s=await this._prepareAuthorizeUrl(i.authorizationParams||{}),{url:c}=s,u=p(s,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},u),{appState:o,response_type:Le.Code}),a&&{organization:a}));const l=r?"".concat(c,"#").concat(r):c;n?await n(l):window.location.assign(l)}async handleRedirectCallback(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.href).split("?").slice(1);if(0===e.length)throw new Error("There are no query params available for parsing.");const t=this.transactionManager.get();if(!t)throw new C("missing_transaction","Invalid state");this.transactionManager.remove();const n=(e=>{e.indexOf("#")>-1&&(e=e.substring(0,e.indexOf("#")));const t=new URLSearchParams(e);return{state:t.get("state"),code:t.get("code")||void 0,connect_code:t.get("connect_code")||void 0,error:t.get("error")||void 0,error_description:t.get("error_description")||void 0}})(e.join(""));return t.response_type===Le.ConnectCode?this._handleConnectAccountRedirectCallback(n,t):this._handleLoginRedirectCallback(n,t)}async _handleLoginRedirectCallback(e,t){const{code:n,state:r,error:o,error_description:i}=e;if(o)throw new N(o,i||o,r,t.appState);if(!t.code_verifier||t.state&&t.state!==r)throw new C("state_mismatch","Invalid state");const a=t.organization,s=t.nonce,c=t.redirect_uri;return await this._requestToken(Object.assign({audience:t.audience,scope:t.scope,code_verifier:t.code_verifier,grant_type:"authorization_code",code:n},c?{redirect_uri:c}:{}),{nonceIn:s,organization:a}),{appState:t.appState,response_type:Le.Code}}async _handleConnectAccountRedirectCallback(e,t){const{connect_code:n,state:r,error:o,error_description:i}=e;if(o)throw new P(o,i||o,t.connection,r,t.appState);if(!n)throw new C("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===r))throw new C("state_mismatch","Invalid state");const a=await this.myAccountApi.completeAccount({auth_session:t.auth_session,connect_code:n,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier});return Object.assign(Object.assign({},a),{appState:t.appState,response_type:Le.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch(e){}}async getTokenSilently(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t,n;const r=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:ye(this.scope,null===(t=e.authorizationParams)||void 0===t?void 0:t.scope,(null===(n=e.authorizationParams)||void 0===n?void 0:n.audience)||this.options.authorizationParams.audience)})}),o=await((e,t)=>{let n=De[t];return n||(n=e().finally(()=>{delete De[t],n=null}),De[t]=n),n})(()=>this._getTokenSilently(r),"".concat(this.options.clientId,"::").concat(r.authorizationParams.audience,"::").concat(r.authorizationParams.scope));return e.detailedResponse?o:null==o?void 0:o.access_token}async _getTokenSilently(e){const{cacheMode:t}=e,n=p(e,["cacheMode"]);if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId,cacheMode:t});if(e)return e}if("cache-only"===t)return;const r=(o=this.options.clientId,i=n.authorizationParams.audience||"default","".concat("auth0.lock.getTokenSilently",".").concat(o,".").concat(i));var o,i;if(!await Me(()=>Li.acquireLock(r,5e3),10))throw new L;this.activeLockKeys.add(r),1===this.activeLockKeys.size&&window.addEventListener("pagehide",this._releaseLockOnPageHide);try{if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:r,token_type:o,access_token:i,oauthTokenScope:a,expires_in:s}=e;return Object.assign(Object.assign({id_token:r,token_type:o,access_token:i},a?{scope:a}:null),{expires_in:s})}finally{await Li.releaseLock(r),this.activeLockKeys.delete(r),0===this.activeLockKeys.size&&window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}async getTokenWithPopup(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n,r;const o=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:ye(this.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.scope,(null===(r=e.authorizationParams)||void 0===r?void 0:r.audience)||this.options.authorizationParams.audience)})});return t=Object.assign(Object.assign({},O),t),await this.loginWithPopup(o,t),(await this.cacheManager.get(new we({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||"default",clientId:this.options.clientId}),void 0,this.options.useMrrt)).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){null!==e.clientId?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const t=e.logoutParams||{},{federated:n}=t,r=p(t,["federated"]),o=n?"&federated":"";return this._url("/v2/logout?".concat(J(Object.assign({clientId:e.clientId},r))))+o}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const n=He(e),{openUrl:r}=n,o=p(n,["openUrl"]);null===e.clientId?await this.cacheManager.clear():await this.cacheManager.clear(e.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@"),await(null===(t=this.dpop)||void 0===t?void 0:t.clear());const i=this._buildLogoutUrl(o);r?await r(i):!1!==r&&window.location.assign(i)}async _getTokenFromIFrame(e){const t=(n=this.options.clientId,"".concat("auth0.lock.getTokenFromIFrame",".").concat(n));var n;if(!await Me(()=>Li.acquireLock(t,5e3),10))throw new L;try{const t=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);const{url:r,state:o,nonce:i,code_verifier:a,redirect_uri:s,scope:c,audience:u}=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin);if(window.crossOriginIsolated)throw new C("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const l=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;let d;try{d=new URL(this.domainUrl).origin}catch(e){d=this.domainUrl}const h=await function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60;return new Promise((r,o)=>{const i=window.document.createElement("iframe");i.setAttribute("width","0"),i.setAttribute("height","0"),i.style.display="none";const a=()=>{window.document.body.contains(i)&&(window.document.body.removeChild(i),window.removeEventListener("message",s,!1))};let s;const c=setTimeout(()=>{o(new L),a()},1e3*n);s=function(e){if(e.origin!=t)return;if(!e.data||"authorization_response"!==e.data.type)return;const n=e.source;n&&n.close(),e.data.response.error?o(C.fromPayload(e.data.response)):r(e.data.response),clearTimeout(c),window.removeEventListener("message",s,!1),setTimeout(a,2e3)},window.addEventListener("message",s,!1),window.document.body.appendChild(i),i.setAttribute("src",e)})}(r,d,l);if(o!==h.state)throw new C("state_mismatch","Invalid state");const p=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:a,code:h.code,grant_type:"authorization_code",redirect_uri:s,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:i,organization:t.organization});return Object.assign(Object.assign({},p),{scope:c,oauthTokenScope:p.scope,audience:u})}catch(e){throw"login_required"===e.error&&this.logout({openUrl:!1}),e}finally{await Li.releaseLock(t)}}async _getTokenUsingRefreshToken(e){var t,n;const r=await this.cacheManager.get(new we({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(r&&r.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new B(e.authorizationParams.audience||"default",e.authorizationParams.scope)}const o=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,i="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null,a=((e,t,n,r)=>{var o;if(e&&n&&r){if(t.audience!==n)return t.scope;const e=r.split(" "),i=(null===(o=t.scope)||void 0===o?void 0:o.split(" "))||[],a=i.every(t=>e.includes(t));return e.length>=i.length&&a?r:t.scope}return t.scope})(this.options.useMrrt,e.authorizationParams,null==r?void 0:r.audience,null==r?void 0:r.scope);try{const t=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:r&&r.refresh_token,redirect_uri:o}),i&&{timeout:i}),{scopesToRequest:a});if(t.refresh_token&&(null==r?void 0:r.refresh_token)&&await this.cacheManager.updateEntry(r.refresh_token,t.refresh_token),this.options.useMrrt&&!(s=null==r?void 0:r.audience,c=null==r?void 0:r.scope,u=e.authorizationParams.audience,l=e.authorizationParams.scope,s===u&&Ge(l,c)||Ge(a,t.scope))){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);await this.cacheManager.remove(this.options.clientId,e.authorizationParams.audience,e.authorizationParams.scope);const n=((e,t)=>{const n=(null==e?void 0:e.split(" "))||[],r=(null==t?void 0:t.split(" "))||[];return n.filter(e=>-1==r.indexOf(e)).join(",")})(a,t.scope);throw new K(e.authorizationParams.audience||"default",n)}return Object.assign(Object.assign({},t),{scope:e.authorizationParams.scope,oauthTokenScope:t.scope,audience:e.authorizationParams.audience||"default"})}catch(r){if(r.message){if(r.message.includes("user is blocked"))throw await this.logout({openUrl:!1}),r;if((r.message.includes("Missing Refresh Token")||r.message.includes("invalid refresh token"))&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e)}throw r instanceof M&&this.mfa.setMFAAuthDetails(r.mfa_token,null===(t=e.authorizationParams)||void 0===t?void 0:t.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.audience,r.mfa_requirements),r}var s,c,u,l}async _saveEntryInCache(e){const{id_token:t,decodedToken:n}=e,r=p(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:t,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(r)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||"default",t=this.scope[e],n=await this.cacheManager.getIdToken(new we({clientId:this.options.clientId,audience:e,scope:t})),r=this.userCache.get("@@user@@");return n&&n.id_token===(null==r?void 0:r.id_token)?r:(this.userCache.set("@@user@@",n),n)}async _getEntryFromCache(e){let{scope:t,audience:n,clientId:r,cacheMode:o}=e;const i=await this.cacheManager.get(new we({scope:t,audience:n,clientId:r}),60,this.options.useMrrt,o);if(i&&i.access_token){const{token_type:e,access_token:t,oauthTokenScope:n,expires_in:r}=i,o=await this._getIdTokenFromCache();return o&&Object.assign(Object.assign({id_token:o.id_token,token_type:e||"Bearer",access_token:t},n?{scope:n}:null),{expires_in:r})}}async _requestToken(e,t){var n,r;const{nonceIn:o,organization:i,scopesToRequest:a}=t||{},s=await fe(Object.assign(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,useMrrt:this.options.useMrrt,dpop:this.dpop},e),{scope:a||e.scope}),this.worker),c=await this._verifyIdToken(s.id_token,o,i);if("authorization_code"===e.grant_type){const e=await this._getIdTokenFromCache();(null===(r=null===(n=null==e?void 0:e.decodedToken)||void 0===n?void 0:n.claims)||void 0===r?void 0:r.sub)&&e.decodedToken.claims.sub!==c.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove("@@user@@"))}return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},s),{decodedToken:c,scope:e.scope,audience:e.audience||"default"}),s.scope?{oauthTokenScope:s.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(i||c.claims.org_id),Object.assign(Object.assign({},s),{decodedToken:c})}async loginWithCustomTokenExchange(e){return this._requestToken(Object.assign(Object.assign({},e),{grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:e.subject_token,subject_token_type:e.subject_token_type,scope:ye(this.scope,e.scope,e.audience||this.options.authorizationParams.audience),audience:e.audience||this.options.authorizationParams.audience,organization:e.organization||this.options.authorizationParams.organization}))}async exchangeToken(e){return this.loginWithCustomTokenExchange(e)}_assertDpop(e){if(!e)throw new Error("`useDpop` option must be enabled before using DPoP.")}getDpopNonce(e){return this._assertDpop(this.dpop),this.dpop.getNonce(e)}setDpopNonce(e,t){return this._assertDpop(this.dpop),this.dpop.setNonce(e,t)}generateDpopProof(e){return this._assertDpop(this.dpop),this.dpop.generateProof(e)}createFetcher(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Je(e,{isDpopEnabled:()=>!!this.options.useDpop,getAccessToken:e=>{var t;return this.getTokenSilently({authorizationParams:{scope:null===(t=null==e?void 0:e.scope)||void 0===t?void 0:t.join(" "),audience:null==e?void 0:e.audience},detailedResponse:!0})},getDpopNonce:()=>this.getDpopNonce(e.dpopNonceId),setDpopNonce:t=>this.setDpopNonce(t,e.dpopNonceId),generateDpopProof:e=>this.generateDpopProof(e)})}async connectAccountWithRedirect(e){const{openUrl:t,appState:n,connection:r,scopes:o,authorization_params:i,redirectUri:a=this.options.authorizationParams.redirect_uri||window.location.origin}=e;if(!r)throw new Error("connection is required");const s=F(W()),c=W(),u=await z(c),l=Z(u),{connect_uri:d,connect_params:h,auth_session:p}=await this.myAccountApi.connectAccount({connection:r,scopes:o,redirect_uri:a,state:s,code_challenge:l,code_challenge_method:"S256",authorization_params:i});this.transactionManager.create({state:s,code_verifier:c,auth_session:p,redirect_uri:a,appState:n,connection:r,response_type:Le.ConnectCode});const f=new URL(d);f.searchParams.set("ticket",h.ticket),t?await t(f.toString()):window.location.assign(f)}async _requestTokenForMfa(e,t){const{mfaToken:n}=e,r=p(e,["mfaToken"]);return this._requestToken(Object.assign(Object.assign({},r),{mfa_token:n}),t)}}function Ui(e,t){return function(){return e.apply(t,arguments)}}const{toString:Di}=Object.prototype,{getPrototypeOf:Mi}=Object,{iterator:Bi,toStringTag:Ki}=Symbol,ji=(Hi=Object.create(null),e=>{const t=Di.call(e);return Hi[t]||(Hi[t]=t.slice(8,-1).toLowerCase())});var Hi;const Gi=e=>(e=e.toLowerCase(),t=>ji(t)===e),Wi=e=>t=>typeof t===e,{isArray:Fi}=Array,Xi=Wi("undefined");function Vi(e){return null!==e&&!Xi(e)&&null!==e.constructor&&!Xi(e.constructor)&&Yi(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ji=Gi("ArrayBuffer");const zi=Wi("string"),Yi=Wi("function"),Zi=Wi("number"),qi=e=>null!==e&&"object"==typeof e,Qi=e=>{if("object"!==ji(e))return!1;const t=Mi(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Ki in e||Bi in e)},$i=Gi("Date"),ea=Gi("File"),ta=Gi("Blob"),na=Gi("FileList"),ra=Gi("URLSearchParams"),[oa,ia,aa,sa]=["ReadableStream","Request","Response","Headers"].map(Gi);function ca(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Fi(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const la="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,da=e=>!Xi(e)&&e!==la;const ha=(pa="undefined"!=typeof Uint8Array&&Mi(Uint8Array),e=>pa&&e instanceof pa);var pa;const fa=Gi("HTMLFormElement"),ma=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ya=Gi("RegExp"),wa=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ca(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const ga=Gi("AsyncFunction"),ba=(va="function"==typeof setImmediate,Ea=Yi(la.postMessage),va?setImmediate:Ea?(Aa=`axios@${Math.random()}`,Sa=[],la.addEventListener("message",({source:e,data:t})=>{e===la&&t===Aa&&Sa.length&&Sa.shift()()},!1),e=>{Sa.push(e),la.postMessage(Aa,"*")}):e=>setTimeout(e));var va,Ea,Aa,Sa;const Ta="undefined"!=typeof queueMicrotask?queueMicrotask.bind(la):"undefined"!=typeof process&&process.nextTick||ba,_a={isArray:Fi,isArrayBuffer:Ji,isBuffer:Vi,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Yi(e.append)&&("formdata"===(t=ji(e))||"object"===t&&Yi(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Ji(e.buffer),t},isString:zi,isNumber:Zi,isBoolean:e=>!0===e||!1===e,isObject:qi,isPlainObject:Qi,isEmptyObject:e=>{if(!qi(e)||Vi(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:oa,isRequest:ia,isResponse:aa,isHeaders:sa,isUndefined:Xi,isDate:$i,isFile:ea,isBlob:ta,isRegExp:ya,isFunction:Yi,isStream:e=>qi(e)&&Yi(e.pipe),isURLSearchParams:ra,isTypedArray:ha,isFileList:na,forEach:ca,merge:function e(){const{caseless:t,skipUndefined:n}=da(this)&&this||{},r={},o=(o,i)=>{const a=t&&ua(r,i)||i;Qi(r[a])&&Qi(o)?r[a]=e(r[a],o):Qi(o)?r[a]=e({},o):Fi(o)?r[a]=o.slice():n&&Xi(o)||(r[a]=o)};for(let e=0,t=arguments.length;e(ca(t,(t,r)=>{n&&Yi(t)?Object.defineProperty(e,r,{value:Ui(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&Mi(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:ji,kindOfTest:Gi,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(Fi(e))return e;let t=e.length;if(!Zi(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Bi]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:fa,hasOwnProperty:ma,hasOwnProp:ma,reduceDescriptors:wa,freezeMethods:e=>{wa(e,(t,n)=>{if(Yi(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Yi(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return Fi(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:ua,global:la,isContextDefined:da,isSpecCompliantForm:function(e){return!!(e&&Yi(e.append)&&"FormData"===e[Ki]&&e[Bi])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(qi(e)){if(t.indexOf(e)>=0)return;if(Vi(e))return e;if(!("toJSON"in e)){t[r]=e;const o=Fi(e)?[]:{};return ca(e,(e,t)=>{const i=n(e,r+1);!Xi(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:ga,isThenable:e=>e&&(qi(e)||Yi(e))&&Yi(e.then)&&Yi(e.catch),setImmediate:ba,asap:Ta,isIterable:e=>null!=e&&Yi(e[Bi])};class Ra extends Error{static from(e,t,n,r,o,i){const a=new Ra(e.message,t||e.code,n,r,o);return a.cause=e,a.name=e.name,i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:_a.toJSONObject(this.config),code:this.code,status:this.status}}}Ra.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Ra.ERR_BAD_OPTION="ERR_BAD_OPTION",Ra.ECONNABORTED="ECONNABORTED",Ra.ETIMEDOUT="ETIMEDOUT",Ra.ERR_NETWORK="ERR_NETWORK",Ra.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Ra.ERR_DEPRECATED="ERR_DEPRECATED",Ra.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Ra.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Ra.ERR_CANCELED="ERR_CANCELED",Ra.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Ra.ERR_INVALID_URL="ERR_INVALID_URL";const Oa=Ra;var Ia=n(8287).hp;function ka(e){return _a.isPlainObject(e)||_a.isArray(e)}function Ca(e){return _a.endsWith(e,"[]")?e.slice(0,-2):e}function Na(e,t,n){return e?e.concat(t).map(function(e,t){return e=Ca(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Pa=_a.toFlatObject(_a,{},null,function(e){return/^is[A-Z]/.test(e)});const La=function(e,t,n){if(!_a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=_a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!_a.isUndefined(t[e])})).metaTokens,o=n.visitor||u,i=n.dots,a=n.indexes,s=(n.Blob||"undefined"!=typeof Blob&&Blob)&&_a.isSpecCompliantForm(t);if(!_a.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(_a.isDate(e))return e.toISOString();if(_a.isBoolean(e))return e.toString();if(!s&&_a.isBlob(e))throw new Oa("Blob is not supported. Use a Buffer instead.");return _a.isArrayBuffer(e)||_a.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Ia.from(e):e}function u(e,n,o){let s=e;if(e&&!o&&"object"==typeof e)if(_a.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(_a.isArray(e)&&function(e){return _a.isArray(e)&&!e.some(ka)}(e)||(_a.isFileList(e)||_a.endsWith(n,"[]"))&&(s=_a.toArray(e)))return n=Ca(n),s.forEach(function(e,r){!_a.isUndefined(e)&&null!==e&&t.append(!0===a?Na([n],r,i):null===a?n:n+"[]",c(e))}),!1;return!!ka(e)||(t.append(Na(o,n,i),c(e)),!1)}const l=[],d=Object.assign(Pa,{defaultVisitor:u,convertValue:c,isVisitable:ka});if(!_a.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!_a.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),_a.forEach(n,function(n,i){!0===(!(_a.isUndefined(n)||null===n)&&o.call(t,n,_a.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),l.pop()}}(e),t};function xa(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Ua(e,t){this._pairs=[],e&&La(e,this,t)}const Da=Ua.prototype;Da.append=function(e,t){this._pairs.push([e,t])},Da.toString=function(e){const t=e?function(t){return e.call(this,t,xa)}:xa;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Ma=Ua;function Ba(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ka(e,t,n){if(!t)return e;const r=n&&n.encode||Ba,o=_a.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):_a.isURLSearchParams(t)?t.toString():new Ma(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const ja=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){_a.forEach(this.handlers,function(t){null!==t&&e(t)})}},Ha={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ga={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ma,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Wa="undefined"!=typeof window&&"undefined"!=typeof document,Fa="object"==typeof navigator&&navigator||void 0,Xa=Wa&&(!Fa||["ReactNative","NativeScript","NS"].indexOf(Fa.product)<0),Va="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ja=Wa&&window.location.href||"http://localhost",za={...e,...Ga};const Ya=function(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=o>=e.length;if(i=!i&&_a.isArray(r)?r.length:i,s)return _a.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a;r[i]&&_a.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&_a.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r{t(function(e){return _a.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null};const Za={transitional:Ha,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=_a.isObject(e);o&&_a.isHTMLForm(e)&&(e=new FormData(e));if(_a.isFormData(e))return r?JSON.stringify(Ya(e)):e;if(_a.isArrayBuffer(e)||_a.isBuffer(e)||_a.isStream(e)||_a.isFile(e)||_a.isBlob(e)||_a.isReadableStream(e))return e;if(_a.isArrayBufferView(e))return e.buffer;if(_a.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return La(e,new za.classes.URLSearchParams,{visitor:function(e,t,n,r){return za.isNode&&_a.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=_a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return La(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(_a.isString(e))try{return(t||JSON.parse)(e),_a.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Za.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(_a.isResponse(e)||_a.isReadableStream(e))return e;if(e&&_a.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw Oa.from(e,Oa.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:za.classes.FormData,Blob:za.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_a.forEach(["delete","get","head","post","put","patch"],e=>{Za.headers[e]={}});const qa=Za,Qa=_a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),$a=Symbol("internals");function es(e){return e&&String(e).trim().toLowerCase()}function ts(e){return!1===e||null==e?e:_a.isArray(e)?e.map(ts):String(e)}function ns(e,t,n,r,o){return _a.isFunction(r)?r.call(this,t,n):(o&&(t=n),_a.isString(t)?_a.isString(r)?-1!==t.indexOf(r):_a.isRegExp(r)?r.test(t):void 0:void 0)}class rs{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=es(t);if(!o)throw new Error("header name must be a non-empty string");const i=_a.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=ts(e))}const i=(e,t)=>_a.forEach(e,(e,n)=>o(e,n,t));if(_a.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(_a.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&Qa[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(_a.isObject(e)&&_a.isIterable(e)){let n,r,o={};for(const t of e){if(!_a.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?_a.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=es(e)){const n=_a.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(_a.isFunction(t))return t.call(this,e,n);if(_a.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=es(e)){const n=_a.findKey(this,e);return!(!n||void 0===this[n]||t&&!ns(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=es(e)){const o=_a.findKey(n,e);!o||t&&!ns(0,n[o],o,t)||(delete n[o],r=!0)}}return _a.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!ns(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return _a.forEach(this,(r,o)=>{const i=_a.findKey(n,o);if(i)return t[i]=ts(r),void delete t[o];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();a!==o&&delete t[o],t[a]=ts(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return _a.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&_a.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[$a]=this[$a]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=es(e);t[r]||(!function(e,t){const n=_a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return _a.isArray(e)?e.forEach(r):r(e),this}}rs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),_a.reduceDescriptors(rs.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),_a.freezeMethods(rs);const os=rs;function is(e,t){const n=this||qa,r=t||n,o=os.from(r.headers);let i=r.data;return _a.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function as(e){return!(!e||!e.__CANCEL__)}const ss=class extends Oa{constructor(e,t,n){super(null==e?"canceled":e,Oa.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function cs(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Oa("Request failed with status code "+n.status,[Oa.ERR_BAD_REQUEST,Oa.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const us=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=r[a];o||(o=c),n[i]=s,r[i]=c;let l=a,d=0;for(;l!==i;)d+=n[l++],l%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-o;s>=i?a(e,t):(n=e,r||(r=setTimeout(()=>{r=null,a(n)},i-s)))},()=>n&&a(n)]},ds=(e,t,n=3)=>{let r=0;const o=us(50,250);return ls(n=>{const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=i-r,c=o(s);r=i;e({loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&i<=a?(a-i)/c:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},hs=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ps=e=>(...t)=>_a.asap(()=>e(...t)),fs=za.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,za.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(za.origin),za.navigator&&/(msie|trident)/i.test(za.navigator.userAgent)):()=>!0,ms=za.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];_a.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),_a.isString(r)&&s.push(`path=${r}`),_a.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),_a.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function ys(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const ws=e=>e instanceof os?{...e}:e;function gs(e,t){t=t||{};const n={};function r(e,t,n,r){return _a.isPlainObject(e)&&_a.isPlainObject(t)?_a.merge.call({caseless:r},e,t):_a.isPlainObject(t)?_a.merge({},t):_a.isArray(t)?t.slice():t}function o(e,t,n,o){return _a.isUndefined(t)?_a.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!_a.isUndefined(t))return r(void 0,t)}function a(e,t){return _a.isUndefined(t)?_a.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(ws(e),ws(t),0,!0)};return _a.forEach(Object.keys({...e,...t}),function(r){const i=c[r]||o,a=i(e[r],t[r],r);_a.isUndefined(a)&&i!==s||(n[r]=a)}),n}const bs=e=>{const t=gs({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:s}=t;if(t.headers=a=os.from(a),t.url=Ka(ys(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&a.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),_a.isFormData(n))if(za.hasStandardBrowserEnv||za.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(_a.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&a.set(e,n)})}if(za.hasStandardBrowserEnv&&(r&&_a.isFunction(r)&&(r=r(t)),r||!1!==r&&fs(t.url))){const e=o&&i&&ms.read(i);e&&a.set(o,e)}return t},vs="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=bs(e);let o=r.data;const i=os.from(r.headers).normalize();let a,s,c,u,l,{responseType:d,onUploadProgress:h,onDownloadProgress:p}=r;function f(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(a),r.signal&&r.signal.removeEventListener("abort",a)}let m=new XMLHttpRequest;function y(){if(!m)return;const r=os.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());cs(function(e){t(e),f()},function(e){n(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(n(new Oa("Request aborted",Oa.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new Oa(r,Oa.ERR_NETWORK,e,m);o.event=t||null,n(o),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Ha;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Oa(t,o.clarifyTimeoutError?Oa.ETIMEDOUT:Oa.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&_a.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),_a.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=ds(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([s,u]=ds(h),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{m&&(n(!t||t.type?new ss(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const w=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);w&&-1===za.protocols.indexOf(w)?n(new Oa("Unsupported protocol "+w+":",Oa.ERR_BAD_REQUEST,e)):m.send(o||null)})},Es=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,a();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Oa?t:new ss(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new Oa(`timeout of ${t}ms exceeded`,Oa.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:s}=r;return s.unsubscribe=()=>_a.asap(a),s}},As=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of Ss(e))yield*As(n,t)}(e,t);let i,a=0,s=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return s(),void e.close();let i=r.byteLength;if(n){let e=a+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel:e=>(s(e),o.return())},{highWaterMark:2})},{isFunction:_s}=_a,Rs=(({Request:e,Response:t})=>({Request:e,Response:t}))(_a.global),{ReadableStream:Os,TextEncoder:Is}=_a.global,ks=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Cs=e=>{e=_a.merge.call({skipUndefined:!0},Rs,e);const{fetch:t,Request:n,Response:r}=e,o=t?_s(t):"function"==typeof fetch,i=_s(n),a=_s(r);if(!o)return!1;const s=o&&_s(Os),c=o&&("function"==typeof Is?(u=new Is,e=>u.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var u;const l=i&&s&&ks(()=>{let e=!1;const t=new n(za.origin,{body:new Os,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=a&&s&&ks(()=>_a.isReadableStream(new r("").body)),h={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!h[e]&&(h[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Oa(`Response type '${e}' is not supported`,Oa.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=_a.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(_a.isBlob(e))return e.size;if(_a.isSpecCompliantForm(e)){const t=new n(za.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return _a.isArrayBufferView(e)||_a.isArrayBuffer(e)?e.byteLength:(_a.isURLSearchParams(e)&&(e+=""),_a.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:a,data:s,signal:c,cancelToken:u,timeout:f,onDownloadProgress:m,onUploadProgress:y,responseType:w,headers:g,withCredentials:b="same-origin",fetchOptions:v}=bs(e),E=t||fetch;w=w?(w+"").toLowerCase():"text";let A=Es([c,u&&u.toAbortSignal()],f),S=null;const T=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let _;try{if(y&&l&&"get"!==a&&"head"!==a&&0!==(_=await p(g,s))){let e,t=new n(o,{method:"POST",body:s,duplex:"half"});if(_a.isFormData(s)&&(e=t.headers.get("content-type"))&&g.setContentType(e),t.body){const[e,n]=hs(_,ds(ps(y)));s=Ts(t.body,65536,e,n)}}_a.isString(b)||(b=b?"include":"omit");const t=i&&"credentials"in n.prototype,c={...v,signal:A,method:a.toUpperCase(),headers:g.normalize().toJSON(),body:s,duplex:"half",credentials:t?b:void 0};S=i&&new n(o,c);let u=await(i?E(S,v):E(o,c));const f=d&&("stream"===w||"response"===w);if(d&&(m||f&&T)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=u[t]});const t=_a.toFiniteNumber(u.headers.get("content-length")),[n,o]=m&&hs(t,ds(ps(m),!0))||[];u=new r(Ts(u.body,65536,n,()=>{o&&o(),T&&T()}),e)}w=w||"text";let R=await h[_a.findKey(h,w)||"text"](u,e);return!f&&T&&T(),await new Promise((t,n)=>{cs(t,n,{data:R,headers:os.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:S})})}catch(t){if(T&&T(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Oa("Network Error",Oa.ERR_NETWORK,e,S),{cause:t.cause||t});throw Oa.from(t,t&&t.code,e,S)}}},Ns=new Map,Ps=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let a,s,c=i.length,u=Ns;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:Cs(t)),u=s;return s},Ls=(Ps(),{http:null,xhr:vs,fetch:{get:Ps}});_a.forEach(Ls,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const xs=e=>`- ${e}`,Us=e=>_a.isFunction(e)||null===e||!1===e;const Ds={getAdapter:function(e,t){e=_a.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let a=0;a`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(xs).join("\n"):" "+xs(e[0]):"as no adapter specified";throw new Oa("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:Ls};function Ms(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ss(null,e)}function Bs(e){Ms(e),e.headers=os.from(e.headers),e.data=is.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Ds.getAdapter(e.adapter||qa.adapter,e)(e).then(function(t){return Ms(e),t.data=is.call(e,e.transformResponse,t),t.headers=os.from(t.headers),t},function(t){return as(t)||(Ms(e),t&&t.response&&(t.response.data=is.call(e,e.transformResponse,t.response),t.response.headers=os.from(t.response.headers))),Promise.reject(t)})}const Ks="1.13.4",js={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{js[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Hs={};js.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Ks+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new Oa(r(o," has been removed"+(t?" in "+t:"")),Oa.ERR_DEPRECATED);return t&&!Hs[o]&&(Hs[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},js.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Gs={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Oa("options must be an object",Oa.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=t[i];if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new Oa("option "+i+" must be "+n,Oa.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Oa("Unknown option "+i,Oa.ERR_BAD_OPTION)}},validators:js},Ws=Gs.validators;class Fs{constructor(e){this.defaults=e||{},this.interceptors={request:new ja,response:new ja}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=gs(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Gs.assertOptions(n,{silentJSONParsing:Ws.transitional(Ws.boolean),forcedJSONParsing:Ws.transitional(Ws.boolean),clarifyTimeoutError:Ws.transitional(Ws.boolean)},!1),null!=r&&(_a.isFunction(r)?t.paramsSerializer={serialize:r}:Gs.assertOptions(r,{encode:Ws.function,serialize:Ws.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Gs.assertOptions(t,{baseUrl:Ws.spelling("baseURL"),withXsrfToken:Ws.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&_a.merge(o.common,o[t.method]);o&&_a.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=os.concat(i,o);const a=[];let s=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,a.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!s){const e=[Bs.bind(this),void 0];for(e.unshift(...a),e.push(...c),l=e.length,u=Promise.resolve(t);d{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new ss(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;const t=new Vs(function(t){e=t});return{token:t,cancel:e}}}const Js=Vs;const zs={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(zs).forEach(([e,t])=>{zs[t]=e});const Ys=zs;const Zs=function e(t){const n=new Xs(t),r=Ui(Xs.prototype.request,n);return _a.extend(r,Xs.prototype,n,{allOwnKeys:!0}),_a.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(gs(t,n))},r}(qa);Zs.Axios=Xs,Zs.CanceledError=ss,Zs.CancelToken=Js,Zs.isCancel=as,Zs.VERSION=Ks,Zs.toFormData=La,Zs.AxiosError=Oa,Zs.Cancel=Zs.CanceledError,Zs.all=function(e){return Promise.all(e)},Zs.spread=function(e){return function(t){return e.apply(null,t)}},Zs.isAxiosError=function(e){return _a.isObject(e)&&!0===e.isAxiosError},Zs.mergeConfig=gs,Zs.AxiosHeaders=os,Zs.formToJSON=e=>Ya(_a.isHTMLForm(e)?new FormData(e):e),Zs.getAdapter=Ds.getAdapter,Zs.HttpStatusCode=Ys,Zs.default=Zs;const qs=Zs;var Qs=n(3612);const $s=function(){if(Qs.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r0&&void 0!==arguments[0]?arguments[0]:"",t=ac().hostname;if(e&&"string"==typeof e&&e.length>0&&(t=e,e.includes("vipdev.lndo.site")))return"".concat(e.split(".")[0],".com");var n=t.split(".");return"".concat(n[n.length-2],".").concat(n[n.length-1])},uc=function(){var e=cc();return".".concat(e)},lc=function(e,t,n){var r="".concat(e,"=").concat(t,";");void 0!==n?($s("Setting cookie with options: ",n),Object.entries(n).forEach(function(e){var t=l(e,2),n=t[0],o=t[1];if("expires"===n){var i=new Date;i.setTime(i.getTime()+24*o*60*60*1e3),r+="expires=".concat(i.toUTCString(),";")}else r+="".concat(n,"=").concat(o,";")})):r+="path=/;",document.cookie=r},dc=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r="".concat(e,"= ;expires= Thu, 01 Jan 1970 00:00:00 GMT;"),o=cc(),i=[o,"www".concat(o),".www".concat(o)];n&&i.push(n),Object.entries(t).forEach(function(e){var t=l(e,2),n=t[0],o=t[1];r+="".concat(n,"=").concat(o,";")}),0===Object.keys(t).length&&(r+="path=/;"),document.cookie=r,i.forEach(function(e){document.cookie=r.concat("domain=",e,";")})},hc=function(){return ac().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},pc=function(e){return function(e,t){if("string"!=typeof e)throw new d("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new d(`Invalid token specified: missing part #${n+1}`);let o;try{o=h(r)}catch(e){throw new d(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(o)}catch(e){throw new d(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(e)},fc=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=cc().split(".")[0],e.prev=1,e.next=2,qs({method:"get",url:"".concat(Qs.A.entitlementsEndpoint,"apple/subscription-check/").concat(n),params:{access_token:t}});case 2:if(!(r=e.sent).data){e.next=3;break}return $s("Apple Sub Check: Request successful: ",r.data),e.abrupt("return","subscribed"===r.data.status);case 3:return e.abrupt("return",!1);case 4:return e.prev=4,i=e.catch(1),$s("Apple Sub Check: Request Failure: ",i),e.abrupt("return",!1);case 5:case"end":return e.stop()}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}(),mc=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,qs({method:"get",url:"".concat(Qs.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(hc())),headers:{"X-Api-Key":Qs.A.entitlementsApiKey}});case 1:return n=e.sent,e.abrupt("return",n.data.encryptedUuid);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),yc=function(){return"complete"===document.readyState},wc=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){var n=!0;if(yc())t();else{$s("UIHandler: ","Waiting for the body to load...");var i=setInterval(r(o.mark(function r(){return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:e&&(n=yc()),document.querySelector("body")&&n&&(clearInterval(i),t(!0));case 1:case"end":return r.stop()}},r)})),200)}})},gc=function(){return new Promise(function(e){if(("interactive"===document.readyState||yc())&&window.dataLayer)$s("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{$s("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var t=setInterval(r(o.mark(function n(){return o.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:window.dataLayer&&window.dataLayer.length>2&&(clearInterval(t),e(!0));case 1:case"end":return n.stop()}},n)})),50)}})},bc=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,gc();case 1:return $s("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",$s("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),r=function(e){return $s("Utils dataLayerLoop: look for this element ",e),e[t]?($s("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):($s("Utils dataLayerLoop: dataLayer search ",!1),!1)},i=window.dataLayer.some(r),e.abrupt("return",i?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),vc=function(){var e=r(o.mark(function e(){var t,n,r=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"Page Type",e.next=1,bc(t);case 1:return n=e.sent,$s("utils | pageType: page type is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Ec=function(){return new Promise(function(e){$s("blueConicReady | Waiting for BC to be ready."),window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){$s("blueConicReady | onReady fired, BC profile is ready."),e(!0)});var t=setTimeout(function(){clearTimeout(t),$s("blueConicReady | onReady timeout, BC onReady unknown."),e(!1)},3e3)})},Ac=function(){return new Promise(function(e){$s("blueConicProfileReady | Waiting for BC Profile to be ready."),window.blueConicClient&&(window.blueConicClient.getSegments||window.blueConicClient.profile)&&($s("blueConicProfileReady | BC getSegments is ready."),e(!0)),window.blueConicClient.event.subscribe(window.blueConicClient.event.onBeforeInteractions,{},function(){$s("blueConicProfileReady | onBeforeInteractions fired, BC profile is ready."),e(!0)});var t=setTimeout(function(){clearTimeout(t),$s("blueConicProfileReady | onBeforeInteractions timeout, BC profile readiness unknown"),e(!1)},3e3)})},Sc=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){$s("blueConicLoaded | waitTillBCReady is ".concat(e));var n=setTimeout(function(){clearTimeout(n),$s("blueConicLoaded | onBlueConicLoaded timeout, resolving false for load status."),t(!1)},1e4);void 0!==window.blueConicClient&&void 0!==window.blueConicClient.event&&void 0!==window.blueConicClient.event.subscribe?($s("blueConicLoaded | BC object already loaded"),e?t(Ec()):(clearTimeout(n),t())):($s('blueConicLoaded | BC not loaded, waiting for "onBlueConicLoaded" event'),window.addEventListener("onBlueConicLoaded",r(o.mark(function r(){var i;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if($s("blueConicLoaded | onBlueConicLoaded event fired."),!e){r.next=2;break}return $s("blueConicLoaded | waiting for blueConicReady..."),r.next=1,Ec();case 1:i=r.sent,clearTimeout(n),t(i),r.next=3;break;case 2:clearTimeout(n),t();case 3:case"end":return r.stop()}},r)})),!1))})},Tc=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Sc(!0);case 1:if(!e.sent){e.next=4;break}return e.next=2,Ac();case 2:if(e.sent){e.next=3;break}return e.abrupt("return",!1);case 3:return e.abrupt("return",blueConicClient.profile.getProfile().getValue("Auth0_ID"));case 4:return e.abrupt("return",!1);case 5:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),_c=function(){var e=r(o.mark(function e(){var t,n,r,i,a,s,c,u=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=u.length>0&&void 0!==u[0]&&u[0],n=!1,i=["MICH LOWA","OHIO LOWA","PENN LOWA","NY LOWA","BOSTON LOWA","NORCAL LOWA","TWIN CITIES LOWA","DENV/PMP LOWA","SCNG LOWA","BANG LOWA","AMC LOWA","HC LOWA","GS LOWA","ORL LOWA","SS LOWA","NNDP LOWA","VP LOWA","NYDN LOWA","BAL LOWA","CG LOWA","CHI LOWA"],e.next=1,Sc(!0);case 1:if(!e.sent){e.next=3;break}if(a=window.blueConicClient.getSegments(),$s("bcLowaCheck | BC segments for users: ",a),!(a.filter(function(e){return i.includes(e.name)}).length>0)){e.next=3;break}return e.next=2,Tc();case 2:(s=e.sent)&&(n=!0,r=s);case 3:return t&&n&&Rc(),c={isSub:n},r&&(c.uuid=r),e.abrupt("return",c);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Rc=function(){lc("bc_lowa_status",1,{path:"/",domain:uc(),expires:7,secure:!0})},Oc=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?($s("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):($s("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};$s("utils | Event: authentication ready: ",r),e(r)}catch(e){$s(e),t(e)}},!1))})},Ic=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){return Qs.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?($s("Entitlements already present:",window.MNGAuthentication.entitlementsReady),void e(window.MNGAuthentication.entitlementsReady)):void window.addEventListener("entitlementsReady",function(n){try{var r=n.detail||{};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=r,$s("Received entitlementsReady event:",r),e(r)}catch(e){ec("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):($s("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),kc=function(){dc(tc.AUTH0_SUB_COOKIE_KEY),dc("mng-jwt-decoded"),localStorage.removeItem(tc.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),function(){$s("Clearing entitlements...");try{dc(tc.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){$s("Failed to delete legacy cookie: ",e)}try{dc(tc.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:cc(),expires:365,secure:!0})}catch(e){$s("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(tc.LOCAL_STORAGE_SESSION_KEY)}catch(e){$s("Failed to remove local storage: ",e)}}()},Cc=function(){var e=ac();return!["local","develop","preprod","trbdev"].some(function(t){return e.origin.includes(t)})},Nc=function(e){$s("Removing storageObject : ",e),void 0!==window.localStorage.getItem(e)&&(window.localStorage.removeItem(e),$s("Storage Object removed : ",e))},Pc=function(e){$s("starting simpleEmailValidation");if(!e)return{valid:!1,message:"Please enter an email."};if(!/^(([^<>()[\]\\.,;:\s@']+(\.[^<>()[\]\\.,;:\s@']+)*)|('.+'))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i.test(e))return{valid:!1,message:"Please enter a valid email."};var t=e.match(/\.([^.\n\s]*)$/)[1].toUpperCase(),n=["AAA","AARP","ABARTH","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALFAROMEO","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOKINGCHANNEL","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIAT","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOODNETWORK","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HGTV","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELES","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LANCIA","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINDE","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOFT","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MACYS","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MASERATI","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MUTUAL","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTHWESTERNMUTUAL","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PASSAGENS","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIFFANY","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELCHANNEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","VUELOS","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"].includes(t);return $s("simpleEmailValidation: ","TLD search ".concat(n)),!1===n?{valid:!1,message:"Please enter a valid email domain."}:-1===["zzz.pl"].findIndex(function(t){return t===e.split("@")[1]})?{valid:!0,message:"Valid"}:{valid:!1,message:"Please enter a valid email."}};window.simpleEmailValidation=Pc;var Lc;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var xc=function(){var e=r(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===Lc){e.next=1;break}return e.abrupt("return",Lc);case 1:return t=Qs.A.auth0Domain,n=Qs.A.auth0ClientId,Lc=new xi({domain:t,clientId:n,cacheLocation:"localstorage",useRefreshTokens:!0,useRefreshTokensFallback:!0,authorizationParams:{audience:"access-extension",scope:"openid email profile user_metadata app_metadata offline_access"}}),e.abrupt("return",Lc);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Uc=function(e){$s("utils | auth event dispathed");var t=new CustomEvent("authenticationReady",{detail:e});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.authenticationReady=e,$s("utils | Dispatching authenticationReady Event: ",t),window.dispatchEvent(t),$s("utils | Dispatched authenticationReady event"),rc=new CustomEvent("mng-auth-check-complete",{detail:e}),nc?($s("utils | Dispatching mng-auth-complete event (islands were ready): ",t),window.dispatchEvent(rc)):$s("Islands not ready")};var Dc=function(e){Qs.A.datadogEnabled&&window.DD_RUM.addTiming(e)},Mc=function(){var e=r(o.mark(function e(t){var n,r,a,s,c,u;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,$s("deleteUserCache","Setting up cache deletion for ".concat(t)),n=hc(),$s("deleteUSerCache","Domain is: ".concat(n)),r={publication:n,uuid:t},e.next=1,qs({method:"DELETE",url:"".concat(Qs.A.entitlementsEndpoint,"session/create"),data:r,headers:{"X-Api-Key":Qs.A.entitlementsApiKey}});case 1:if(a=e.sent,s=a.data,c=/Succesfully deleted/i,!("object"===i(s)&&Object.prototype.hasOwnProperty.call(s,"message"))||!c.test(s.message)){e.next=2;break}return $s("deleteUserCache","Cache deletion successful for ".concat(t)),e.abrupt("return",{success:!0});case 2:return $s("deleteUserCache","Cache deletion failed for ".concat(t,": ").concat(s)),e.abrupt("return",{success:!1});case 3:return e.prev=3,u=e.catch(0),$s("deleteUserCache","Cache deletion error for ".concat(t,": ").concat(u)),e.abrupt("return",{success:!1});case 4:case"end":return e.stop()}},e,null,[[0,3]])}));return function(t){return e.apply(this,arguments)}}(),Bc=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(t,n){var i={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},a=function(){var a=r(o.mark(function r(){var a,s,c,u,l,d,h,p,f,m,y;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,"1"!==(null===(a=window.sophi_config)||void 0===a?void 0:a.enableSophiSSPW)){r.next=1;break}if(!document.getElementById("server-paywall")){r.next=1;break}return i.sspw=!0,r.abrupt("return",t({paywall:!0,details:ic({},i)}));case 1:return r.next=2,vc();case 2:return c=r.sent,r.next=3,bc("Paywall_Level");case 3:if(u=r.sent,"article"===c&&"free"!==u){r.next=4;break}return r.abrupt("return",t({paywall:!1,details:"article"!==c?"Page type is not an article":"Free article"}));case 4:return r.next=5,Ic();case 5:if(!(l=r.sent)||!l.isEntitled){r.next=6;break}return r.abrupt("return",t({paywall:!1,details:"Entitled User"}));case 6:if("premium"!==u){r.next=7;break}return r.abrupt("return",t({paywall:!0,details:"Premium article"}));case 7:if(d=null===(s=window.ConnextUtils)||void 0===s?void 0:s.runningSophi,$s("checkPaywallStatus - Sophi is running: ",d),!d){r.next=8;break}window.ConnextUtils.connextAlreadyRan&&window.sophiWallConfig&&!window.sophiWallConfig.error&&"paywall"===window.sophiWallConfig.wallType?(i.sophiClient=!0,i.engageStatus=!0,i.engagePaywall=!0):window.addEventListener("onPaywallShown",function(){return"paywall"===window.sophiWallConfig.wallType&&(i.sophiClient=!0),t({paywall:!0,details:ic({},i)})},{once:!0}),r.next=12;break;case 8:if(d){r.next=12;break}return h=window.ConnextUtils.connextReady("onPaywallShown",!1),p=new Promise(function(t,n){return setTimeout(function(){return n(new Error("No Engage paywall within 10 seconds, resolving as no paywall."))},e)}),r.prev=9,r.next=10,Promise.race([h,p]);case 10:!0===(f=r.sent)?(i.engagePaywall=!0,i.engageStatus="Engage paywall detected"):(i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(f)),r.next=12;break;case 11:r.prev=11,m=r.catch(9),i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(m);case 12:return r.abrupt("return",t({paywall:Object.values(i).some(function(e){return e}),details:ic({},i)}));case 13:r.prev=13,y=r.catch(0),n(y);case 14:case"end":return r.stop()}},r,null,[[0,13],[9,11]])}));return function(){return a.apply(this,arguments)}}();a()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=Bc);function Kc(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var jc=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Sc();case 1:return e.next=2,Oc();case 2:return e.abrupt("return",new Promise(function(e){$s("ANALYTICS: inside BCregwall events");var t=ac();t.searchParams.delete("regwall");var n=blueConicClient.profile.getProfile();localStorage.setItem("regwallSuccess","yes"),localStorage.setItem("regwallEvent","yes"),n.setValue("bang_reg_wall_status","Y"),n.setValue("regwall_newspaper",t.host),n.setValue("regwall_success_date",new Date),n.setValue("regwall_success","yes"),blueConicClient.profile.updateProfile(),e(!0)}));case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Hc=function(e){try{window.dataLayer.push({event:e}),$s("ANALYTICS: ".concat(e," event")),$s("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){$s("ANALYTICS: Failed to send ".concat(e," event: "),t)}};var Gc=function(){try{var e=localStorage.getItem(tc.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){$s("Unable to get session from local storage: ",e)}return"{}"},Wc=function(e){try{$s("Setting local storage session",e),localStorage.setItem(tc.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){$s("Unable to save session from local storage: ",e)}},Fc=function(e){try{lc(tc.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:uc(),expires:365,secure:!0})}catch(e){$s("Unable to save session to cookie storage: ",e)}},Xc=function(){var e=r(o.mark(function e(){var t,n,r,i,a,s,c,u,l,d,h,p,f,m,y,w,g,b;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=Qs.A.sessionServer,n="".concat(t,"/api/session"),$s("Checking server session: ",n),e.next=1,qs.get(n,{withCredentials:!0});case 1:if(!(r=e.sent).data){e.next=2;break}return l=r.data.entitlementTokenDecoded,d=r.data,h=d.accessToken,p=d.idToken,f=d.entitlementToken,m=null!==(i=null==l?void 0:l.entitlement_expiry)&&void 0!==i?i:null,y=null!==(a=null==l?void 0:l.entitlement_source)&&void 0!==a?a:null,w=null!==(s=null==l?void 0:l.entitlement_entitled)&&void 0!==s?s:null,g=null!==(c=null==l?void 0:l.entitlement_extras_adfree)&&void 0!==c?c:null,b=null!==(u=null==l?void 0:l.entitlement_level)&&void 0!==u?u:null,Wc(JSON.stringify({accessToken:h,idToken:p,entitlementToken:f,expiration:m,entitlementSource:y,isEntitled:w,adFree:g,entitlementLevel:b})),""!==f&&"string"==typeof f&&Fc(f),e.abrupt("return",{accessToken:h,idToken:p,entitlementToken:f,expiration:m,entitlementSource:y,isEntitled:w,adFree:g,entitlementLevel:b});case 2:return e.abrupt("return",{accessToken:null,idToken:null,entitlementToken:null,expiration:null,entitlementSource:null,isEntitled:null,adFree:null,entitlementLevel:null});case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Vc=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=Qs.A.sessionServer,r="".concat(n,"/api/session"),$s("Updating server session: ",r),e.next=1,qs.post(r,t,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,i=e.catch(0),$s("Failed to update session server: ",i);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),Jc=function(){var e=r(o.mark(function e(){var t,n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=Qs.A.sessionServer,n="".concat(t,"/api/session"),$s("Deleting server session: ",n),e.next=1,qs.delete(n,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,r=e.catch(0),$s("Failed to delete server session: ",r);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),zc=function(){var e=r(o.mark(function e(){var t,n,r,i,a,s,c,u,l,d,h,p,f,m,y,w,g,b,v,E,A,S,T,_,R,O,I,k;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if($s("Inside getSession"),e.prev=1,l=Gc(),$s("Session: __MNG_Session = ",l),d=JSON.parse(l),h=d.accessToken,p=d.idToken,f=d.entitlementToken,m=d.expiration,y=d.entitlementSource,w=d.isEntitled,g=d.adFree,b=d.entitlementLevel,n=h,i=m,a=y,s=w,c=g,u=b,$s("Session: check both tokens: ",t=p,r=f),void 0!==p&&void 0!==f&&null!==p&&null!==f){e.next=3;break}return $s("Session: missing id or entitlements, try session server"),e.next=2,Xc();case 2:v=e.sent,E=v.accessToken,A=v.idToken,S=v.entitlementToken,T=v.expiration,_=v.entitlementSource,R=v.isEntitled,O=v.adFree,I=v.entitlementLevel,n=E,t=A,r=S,i=T,a=_,s=R,c=O,u=I;case 3:e.next=5;break;case 4:e.prev=4,k=e.catch(1),$s("Failed to get session: ",k);case 5:return $s("Returning session: ",t,n,r),e.abrupt("return",{accessToken:n,idToken:t,entitlementToken:r,expiration:i,entitlementSource:a,isEntitled:s,adFree:c,entitlementLevel:u});case 6:case"end":return e.stop()}},e,null,[[1,4]])}));return function(){return e.apply(this,arguments)}}(),Yc=function(){var e=r(o.mark(function e(t){var n,r,i,a,s,c,u,l,d,h,p,f,m,y,w,g,b,v,E,A,S,T,_,R,O,I,k,C,N;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=Gc(),r=JSON.parse(n),i=r.accessToken,a=void 0===i?null:i,s=r.idToken,c=void 0===s?null:s,u=r.entitlementToken,l=void 0===u?null:u,d=r.expiration,h=void 0===d?null:d,p=r.entitlementSource,f=void 0===p?null:p,m=r.isEntitled,y=void 0===m?null:m,w=r.adFree,g=void 0===w?null:w,b=r.entitlementLevel,v=void 0===b?null:b,E=t.accessToken,A=t.idToken,S=t.entitlementToken,T=t.expiration,_=t.entitlementSource,R=t.isEntitled,O=t.adFree,I=t.entitlementLevel,k={accessToken:null==E?a:E,idToken:null==A?c:A,entitlementToken:null==S?l:S,expiration:null==T?h:T,entitlementSource:null==_?f:_,isEntitled:null==R?y:R,adFree:null==O?g:O,entitlementLevel:null==I?v:I},$s("Current session data: ",r),$s("New session data: ",t),$s("Updated session data:",k),C=JSON.stringify(k),Wc(C),""!==k.entitlementToken&&"string"==typeof k.entitlementToken&&Fc(k.entitlementToken),n===C){e.next=1;break}return e.next=1,Vc(k);case 1:e.next=3;break;case 2:e.prev=2,N=e.catch(0),$s("Unable to save session: ",N);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),Zc=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return $s("Ending session..."),kc(),e.next=1,Jc();case 1:localStorage.removeItem(tc.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),qc=function(){return"logout"===(ac().searchParams.get("state")||"").toLowerCase()};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[];var Qc=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,xc();case 1:n=e.sent,$s("Calling Auth0 logout..."),n.logout({returnTo:t});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),$c=function(){return"undefined"==typeof CnnXt?($s("Connext was not loaded."),!1):Connext.Storage.GetUserState()},eu=function(){$s("Check for SS paywall Cookie");var e=window.location.hostname,t=document.cookie.split(";").find(function(e){return e.trim().startsWith("vip-go-seg=vc-v1__has_access")});if(/^(?!:\/\/)([a-zA-Z0-9-_]{1,63}\.?)+[a-zA-Z]{2,6}$/.test(e)&&t){$s("SS paywall Cookie found, removing it");var n=t.split("=")[0].trim();document.cookie="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=").concat(e),document.cookie="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}},tu=function(){var e=r(o.mark(function e(){var t,n,i,a,s,c,u,l,d,h;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if($s("Attempting to logout..."),eu(),$s("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(tc.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(i=n?pc(n):"")){e.next=2;break}return a=i.auth0Id,e.next=1,Mc(a);case 1:e.sent.success?$s("User cache cleared."):$s("User cache deletion failed.");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=4;break}return e.next=3,Zc();case 3:e.next=5;break;case 4:kc();case 5:return e.prev=5,$s("Cycling through logout callbacks..."),s=window.MNGAuthentication.logoutCallbacks.map(function(e){return e()}),e.next=6,Promise.all(s);case 6:$s("Finished cycling through logout callbacks."),e.next=8;break;case 7:e.prev=7,h=e.catch(5),$s("Failed to cycle through logout callbacks: ",h);case 8:Object.keys(window.localStorage).filter(function(e){return e.includes("auth0")}).forEach(function(e){window.localStorage.removeItem(e),$s("Removed Auth0 storage object...")}),Nc("hhsl"),Nc("userNewsLetterData"),Nc(tc.REGWALL_USER_IS_SUBSCRIBED),Nc(tc.USER_PROFILE_HASH),c=ac(),u=window.location.origin;try{c.searchParams.get("returnURL")&&(l=decodeURIComponent(c.searchParams.get("returnURL")),u=l)}catch(e){$s(e),u=window.location.origin}return u=new URL(u),e.next=9,window.ConnextUtils.connextReady("onInit",!1);case 9:if(!e.sent){e.next=16;break}if($s("Auth | Silent mode enabled ",Connext.GetOptions().Silentmode),$s("Auth | Run connext manually if Silent Mode is on."),window.ConnextUtils.rerunConnextEntitlements(!0),d=u,u.origin!==window.location.origin&&(d=new URL(window.location.origin)).searchParams.append("returnAfterLogout",u),window.history.replaceState({additionalInformation:"Updated the URL to prevent another login cycle"},"Home",d),!Cc()){e.next=10;break}$s("About to call Connext Logout..."),setTimeout(function(){Connext.Logout()},500),e.next=15;break;case 10:if("Logged In"!==$c()){e.next=14;break}if($s("Connext user state is logged in, setting timeout..."),setTimeout(r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return $s("Connext took too long to logout, calling auth0 logout..."),e.next=1,Qc(u);case 1:case"end":return e.stop()}},e)})),8e3),"function"!=typeof Connext._logout){e.next=12;break}return $s("About to call Connext _logout..."),e.next=11,Connext._logout();case 11:e.next=13;break;case 12:return $s("About to call Connext Logout..."),e.next=13,Connext.Logout();case 13:e.next=15;break;case 14:return $s("Connext user state is logged out, not calling it, going to auth0 logout."),e.next=15,Qc(u);case 15:e.next=17;break;case 16:return $s("Connext Logout was NOT called"),e.next=17,Qc(u);case 17:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),nu=function(){var e=0;for(var t in window.localStorage){var n=2*window.localStorage[t].length/1024/1024;!Number.isNaN(n)&&window.localStorage.hasOwnProperty(t)&&(e+=n)}return e},ru=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return Hc(e)}),$s("Cycled through preauth GTM events.")},ou=function(){var e=r(o.mark(function e(t,n,r,i,a){var s,c,u,l,d,h,p,f,m,y,w,g,b;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return $s("Attempting to login..."),nu()>4.5&&window.localStorage.clear(),ru(),i&&(s=[],c=window.localStorage.getItem("callbackEvents"),u=JSON.parse(c),s=u&&u.length>0?Kc(new Set([].concat(Kc(i),Kc(u)))):i,window.localStorage.setItem("callbackEvents",JSON.stringify(s))),l=null,e.next=1,xc();case 1:if(d=e.sent,h=ac(),p=h.origin,f=new URL("".concat(p,"/callback")),m={},h.searchParams.get("regwall")&&(h.searchParams.get("returnUrl")&&(y=h.searchParams.get("returnUrl")),h.searchParams.get("auth_redirect")&&(y=h.searchParams.get("auth_redirect"))),h.pathname.startsWith("/login")||h.pathname.startsWith("/callback")?h.searchParams.get("returnUrl")?f.searchParams.set("auth_redirect",h.searchParams.get("returnUrl")):a&&f.searchParams.set("auth_redirect",a):f.searchParams.set("auth_redirect",h.toString()),y&&"regwall"!==t&&f.searchParams.set("auth_redirect",y),"true"===h.searchParams.get("close-after-finish")&&f.searchParams.set("close-after-finish","true"),"true"!==h.searchParams.get("ssl")){e.next=4;break}if(!window.authentication_config.sessionManagementEnabled){e.next=3;break}return e.next=2,Zc();case 2:e.next=4;break;case 3:kc();case 4:return null!==(l=h.searchParams.get("login-with"))?m.connection=l:n&&(m.connection=n),w="none",t&&"regwall"===t&&(f.searchParams.set("regwall","true"),w="signUp",$s("Logging in with regwall")),t&&(f.searchParams.set("loginsource",t),$s("Logging in with ".concat(t))),r&&(m.login_hint=r),m.redirect_uri=f.toString(),m.initialScreen=w,"googleonetap"!==t&&(m.prompt="select_account"),null!==(g=h.searchParams.get("ampRegiWall"))&&(b=window.location.hostname,m.ampRegiWall=g,m.sourceDomain=b.replace("www.","").replace("preprod.","").replace("develop.","").replace("staging.",""),m.initialScreen="signUp",m.preferenceId=h.searchParams.get("prefId")),e.next=5,d.loginWithRedirect({authorizationParams:m});case 5:case"end":return e.stop()}},e)}));return function(t,n,r,o,i){return e.apply(this,arguments)}}(),iu=function(){return new Promise(function(e){var t=setTimeout(function(){e()},8e3);try{var n=window.localStorage.getItem("callbackEvents"),r=JSON.parse(n);if(!r||0===r.length)return void e();$s("Adding listeners to events we need to wait for...");var o=r.map(function(e){return t=e,new Promise(function(e){$s("Adding event to wait for: ",t),window.addEventListener(t,function(n){try{var r=n.detail||{};$s("Event: ".concat(t,"} ready: "),r),e(r)}catch(t){$s(t),e()}},!1)});var t});Promise.all(o).then(function(){clearTimeout(t),e()})}catch(t){$s("Failed to wait for callback events",t),e()}})};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.oidcLoginCallbacks=[];var au=function(){var e=r(o.mark(function e(){var t,n,i,a,s,c,u,l,d,h,p,f,m,y,w,g,b,v,E,A,S,T;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(eu(),t=ac(),n=!1,i=t.searchParams.get("auth_redirect")||"https://".concat(window.location.host),a=t.searchParams.get("redirect_uri")||"",a.includes("applenews")?($s("This is Apple prelogin flow."),(s=new URL(a))?(s.searchParams.append("post-apple-login","true"),$s("Post callback Apple redirect URL is ".concat(s)),ou(!1,!1,!1,[],s)):ou()):i.includes("post-apple-login")&&($s("This is Apple Callback flow."),n=!0,(c=new URL(decodeURIComponent(i))).searchParams.delete("post-apple-login"),i=c),$s("Handling post login callback..."),!(u=t.searchParams.get("error_description"))){e.next=2;break}if("shouldAutoLogin"!==u){e.next=1;break}return e.abrupt("return",ou(!1,!1,!1,!1,i));case 1:n&&alert("There was an error in logging you in, please try again.");case 2:return e.next=3,xc();case 3:return l=e.sent,e.next=4,l.handleRedirectCallback();case 4:return e.next=5,l.getIdTokenClaims();case 5:return d=e.sent,e.next=6,l.getUser();case 6:return h=e.sent,$s("Auth0 user profile: ",h),p=d.__raw,e.next=7,l.getTokenSilently();case 7:return f=e.sent,e.prev=8,$s("Cycling through login callbacks..."),e.next=9,iu();case 9:return m=window.MNGAuthentication.oidcLoginCallbacks.map(function(){var e=r(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(p));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=10,Promise.all(m);case 10:$s("Finished cycling through login callbacks."),e.next=12;break;case 11:e.prev=11,A=e.catch(8),$s("Failed to cycle through login callbacks: ",A);case 12:if(y={accessToken:f,userId:h.sub,email:h.email,picture:h.picture},w=!1,g="",!n){e.next=17;break}return e.prev=13,e.next=14,mc(y.userId);case 14:return g=e.sent,$s("Encrypted apple uuid is: ".concat(g)),e.next=15,fc(g);case 15:w=e.sent,$s("Apple sub status is: ".concat(w)),e.next=17;break;case 16:e.prev=16,S=e.catch(13),$s("Apple sub check error: ".concat(S)),alert("There was an error in logging you in, please try again.");case 17:if(Nc(tc.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}return $s("Saving idToken to session server"),e.next=18,Yc({idToken:p,accessToken:f});case 18:if(!t.searchParams.get("close-after-finish")){e.next=19;break}return e.abrupt("return",window.close());case 19:if(!t.search.includes("loginsource")){e.next=20;break}return b=t.searchParams.get("loginsource"),v=window.MNGAuthentication.postAuthEvents.map(function(){var e=r(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(b));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=20,Promise.all(v);case 20:return e.prev=20,E=new URL(i),n&&w&&E.searchParams.append("access_token",g),$s("Apple redirect URL:",E),e.abrupt("return",window.location.assign(E));case 21:return e.prev=21,T=e.catch(20),$s("Failed to redirect after authentication: ",T),window.location.assign(new URL(window.location.origin)),e.abrupt("return","Finished execution, please await result...");case 22:case"end":return e.stop()}},e,null,[[8,11],[13,16],[20,21]])}));return function(){return e.apply(this,arguments)}}(),su=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return $s("ANALYTICS: fireBC events"),e.next=1,jc();case 1:$s("ANALYTICS: bc values should be filled");case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),cu=function(){var e=r(o.mark(function e(){var t,n,r,i,a,s,c,u,l,d,h,p,f;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Oc();case 1:if(t=e.sent,n=t.idToken,r=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,a=pc(n),s=a.email,c=a.picture,u=a.sub,l=a.name,d=a.nickname,h=a.connection_source,p=null===(i=a.user_metadata)||void 0===i||null===(i=i.customProfile)||void 0===i?void 0:i.nickname,u.split("|").pop(),e.abrupt("return",{authenticated:r,nickname:p||d||l,email:s,picture:c,userId:u,connectionSource:h});case 3:e.prev=3,f=e.catch(2),$s("Unable to parse idToken: ",n," Error: ",f);case 4:return e.abrupt("return",{authenticated:r});case 5:case"end":return e.stop()}},e,null,[[2,3]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.login=ou,window.MNGAuthentication.logout=tu,window.MNGAuthentication.getUserInfo=cu;var uu=function(){var e=r(o.mark(function e(){var t,n,a,s,c,u,l,d,h,p,f,m,y;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=ac(),n=!1,a="",s=!1,c={},qc()&&window.ConnextUtils.rerunConnextEntitlements(!0),t.searchParams.get("returnAfterLogout")&&(u=decodeURIComponent(t.searchParams.get("returnAfterLogout")),window.location.assign(u)),t.searchParams.has("entitlement_jwt")&&(window.authentication_config.sessionManagementEnabled=!1),l=function(){var e=r(o.mark(function e(){var t,r,u;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,xc();case 1:return t=e.sent,e.next=2,t.getIdTokenClaims();case 2:return c=e.sent,e.next=3,t.isAuthenticated();case 3:if(n=e.sent,a="object"===i(c)?c.__raw:"",r=sc(tc.ENTITLEMENT_COOKIE_KEY),n||!r){e.next=5;break}return e.next=4,t.getTokenSilently();case 4:s=e.sent;case 5:e.next=7;break;case 6:e.prev=6,u=e.catch(0),$s("Unable to verify user has active auth0 session: ",u);case 7:case"end":return e.stop()}},e,null,[[0,6]])}));return function(){return e.apply(this,arguments)}}(),!t.pathname.startsWith("/logout")){e.next=2;break}return $s("Page is logout. Routing to logout function..."),e.next=1,tu();case 1:return e.abrupt("return");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=9;break}return e.next=3,l();case 3:if(""===a){e.next=5;break}if(d=null,h=JSON.parse(window.localStorage.getItem(tc.LOCAL_STORAGE_SESSION_KEY)),"{}"!==Gc()){e.next=4;break}return h&&(d=h.jwt),e.next=4,Yc({idToken:a,entitlementToken:d});case 4:e.next=8;break;case 5:return e.prev=5,e.next=6,zc();case 6:p=e.sent,a=p.idToken,(n="string"==typeof a)&&(c=pc(a)),e.next=8;break;case 7:e.prev=7,y=e.catch(5),$s("Unable to initialize session: ",y);case 8:e.next=10;break;case 9:return e.next=10,l();case 10:if(n||s||!Qs.A.blueconicEnabled||!Qs.A.bcLowaSegements){e.next=12;break}return e.next=11,_c(!0);case 11:(f=e.sent).isSub&&(n=tc.USER_IS_LOWA,c={sub:f.uuid});case 12:if(Uc({isAuthenticated:n,idToken:a,accessToken:s,claims:c}),Dc("authenticationReady"),!0===n?($s("User is authenticated."),t.searchParams.get("auth_redirect")&&($s("Auth Redirect is present, sending user to auth redirect..."),(m=t.searchParams.get("auth_redirect")).endsWith("#")&&(m=m.slice(0,m.length)),window.location.assign(m)),t.pathname.startsWith("/login")&&!qc()&&($s("Page is login. The user is already logged in and Connext Logout param is not present... Redirecting..."),window.location.assign(t.origin))):$s("User is not authenticated."),t.pathname.startsWith("/login")&&!qc()?($s("Page is login. Attempting to log user in..."),ou()):$s("Page is not login or Connext state is present"),!t.pathname.startsWith("/callback")||!t.searchParams.get("regwall")){e.next=14;break}return $s("Page is callback with regwall param. Routing to regwall receiver..."),e.next=13,su();case 13:$s("Now login from regwall"),ou(),e.next=15;break;case 14:if(!t.pathname.startsWith("/callback")){e.next=15;break}return $s("Page is callback without regwall param. Routing to callback receiver..."),e.next=15,au();case 15:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=uu;var lu=function(e,t){return new Promise(function(n){try{"undefined"==typeof CnnXt&&($s("Connext was not loaded."),n(!1)),$s("connext subscribeToNewsletter","about to call Cnnxt NewsletterSubscribe with pref id ".concat(t," and email ").concat(e)),CnnXt.API.NewsletterSubscribe({email:e,id:t,onSuccess:function(){$s("Signed user up to newsletter: ",t),n(!0)},onError:function(e){$s("subscribeToNewsletter error: ",e),n(!1)}})}catch(e){$s("subscribeToNewsletter Error:",e),n(!1)}})},du=function(){document.addEventListener("click",function(e){if(e.target.classList.contains("connext-login")){var t=window.location.href,n=new URL(t),r=n.origin,o=new URL("".concat(r,"/login"));o.searchParams.set("returnUrl",n.toString()),window.location.assign(o)}})},hu=function(){Cc()||document.addEventListener("onInit",function(){if("undefined"!=typeof Connext){var e,t,n,r=Connext;t="Logout",n=function(){return function(){alert("Warning! You called Connext.Logout() directly! Calling MNGAuthentication.logout() next."),window.MNGAuthentication.logout()}},(e=r)._logout=Connext.Logout,e[t]=n(e[t])}})},pu=function(e){try{"string"==typeof e&&lc(tc.AUTH0_SUB_COOKIE_KEY,e,{domain:uc(),path:"/",expires:365,secure:!0})}catch(e){$s("Failed to set auth0_sub cookie: ",e)}},fu=function(e){if(!sc(tc.AUTH0_SUB_COOKIE_KEY))try{var t=e.claims;if(null==t||"object"!==i(t)&&!Object.keys(t).includes("sub"))return;var n=t.sub;pu(n)}catch(e){$s("Failed to set auth0_sub: ",e)}},mu=function(e){try{if("string"==typeof e){var t=pc(e).sub;pu(t)}else $s("Could not set auth0_sub on login, idToken was not available.")}catch(e){$s("Failed to set auth0_sub on login: ",e)}},yu=function(){var e=r(o.mark(function e(){var t,n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=window.localStorage.getItem("newsletter_to_subscribe"))){e.next=4;break}return e.next=1,window.ConnextUtils.connextReady("onFinish");case 1:return e.next=2,cu();case 2:return n=e.sent,r=n.email,$s("CONNEXT: about to sign up ".concat(r," to ").concat(t)),e.next=3,lu(r,t);case 3:window.localStorage.removeItem("newsletter_to_subscribe"),$s("CONNEXT: newsletter_to_subscribe value removed from local storage.");case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();const wu={init:function(){var e=r(o.mark(function e(){var t;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return du(),hu(),yu(),MNGAuthentication.oidcLoginCallbacks.push(mu),window.ConnextUtils.runConnextIfSilent(),e.next=1,Oc();case 1:t=e.sent,fu(t);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()};(function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return wu.init(),e.next=1,wc(!0);case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}})()()})()})(); //# sourceMappingURL=mng-digisubs.connext.bundle.js.map; /*! For license information please see mng-digisubs.entitlements.bundle.js.LICENSE.txt */ (()=>{var e={7526(e,t){"use strict";t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,c=r-o;sc?c:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function u(e,t,n){for(var r,o=[],i=t;ia)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|y(e,t);let r=s(n);const o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(z(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(z(e,ArrayBuffer)||e&&z(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(z(e,SharedArrayBuffer)||e&&z(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||q(e.length)?s(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=s(t);for(let r=0;r=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||z(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(e).length;default:if(o)return r?-1:J(e).length;t=(""+t).toLowerCase(),o=!0}}function w(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return _(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function E(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:g(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):g(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function g(e,t,n,r,o){let i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;is&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;ro&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function T(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function O(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return A(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return v(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const N=4096;function _(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;or)&&(n=r);let o="";for(let r=t;rn)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function U(e,t,n,r,o){K(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function x(e,t,n,r,o){K(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function D(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function M(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],o=1,i=0;for(;++i>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Z(function(e){j(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],o=1,i=0;for(;++i=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Z(function(e){j(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||L(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){P(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i>>=0,n>>>=0,!r){P(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Z(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Z(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);P(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o>>=0,!r){const r=Math.pow(2,8*n-1);P(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Z(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Z(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return M(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return M(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function K(e,t,n,r,o,i){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new H.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){j(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||W(t,e.length-(n+1))}(r,o,i)}function j(e,t){if("number"!=typeof e)throw new H.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,n){if(Math.floor(e)!==e)throw j(e,n),new H.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new H.ERR_BUFFER_OUT_OF_BOUNDS;throw new H.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}G("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),G("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=F(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=F(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function J(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function V(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,n,r){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function q(e){return e!=e}const $=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Z(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<>1,l=-7,d=n?o-1:0,f=n?-1:1,h=e[t+d];for(d+=f,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=f,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),i-=u}return(h?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+h]=255&s,h+=p,s/=256,o-=8);for(a=a<0;e[n+h]=255&a,h+=p,a/=256,u-=8);e[n+h-p]|=128*y}},5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function o(){var t,n,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function c(e,o,i,a){var s=o&&o.prototype instanceof l?o:l,c=Object.create(s.prototype);return r(c,"_invoke",function(e,r,o){var i,a,s,c=0,l=o||[],d=!1,f={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(e,n){return i=e,a=0,s=t,f.n=n,u}};function h(e,r){for(a=e,s=r,n=0;!d&&c&&!o&&n3?(o=p===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=h&&((o=e<2&&hr||r>p)&&(i[4]=e,i[5]=r,f.n=p,a=0))}if(o||e>1)return u;throw d=!0,r}return function(o,l,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&h(l,p),a=l,s=p;(n=a<2?t:s)||!d;){i||(a?a<3?(a>1&&(f.n=-1),h(a,s)):f.n=s:f.v=s);try{if(c=2,i){if(a||(o="next"),n=i[o]){if(!(n=n.call(i,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=i.return)&&n.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((n=(d=f.n<0)?s:e.call(r,f))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:n,done:d}}}(e,i,a),!0),c}var u={};function l(){}function d(){}function f(){}n=Object.getPrototypeOf;var h=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),p=f.prototype=l.prototype=Object.create(h);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,r(e,s,"GeneratorFunction")),e.prototype=Object.create(p),e}return d.prototype=f,r(p,"constructor",f),r(f,"constructor",d),d.displayName="GeneratorFunction",r(f,s,"GeneratorFunction"),r(p),r(p,s,"Generator"),r(p,a,function(){return this}),r(p,"toString",function(){return"[object Generator]"}),(e.exports=o=function(){return{w:c,m:y}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,o,i){var a=r(e,t,n,o,i);return a.next().then(function(e){return e.done?e.value:a.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),o=n(1791);e.exports=function(e,t,n,i,a){return new o(r().w(e,t,n,i),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var r=n(5172),o=n(5546);e.exports=function e(t,n){function i(e,o,a,s){try{var c=t[e](o),u=c.value;return u instanceof r?n.resolve(u.v).then(function(e){i("next",e,a,s)},function(e){i("throw",e,a,s)}):n.resolve(u).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,s)})}catch(e){s(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),o(this,"_invoke",function(e,t,r){function o(){return new n(function(t,n){i(e,r,t,n)})}return a=a?a.then(o,o):o()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,o,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,r,o){function i(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?a?a(e,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[n]=r:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,o,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),o=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=o(),n=t.m(l),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function f(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var h={throw:1,return:2,break:3,continue:3};function p(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,h[e],t)},delegateYield:function(e,o,i){return t.resultName=o,n(r.d,u(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,r,o){return t.w(p(e),n,r,o&&o.reverse())},isGeneratorFunction:f,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:s,async:function(e,t,n,r,o){return(f(t)?a:i)(p(e),t,n,r,o)},keys:c,values:u}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},3612(e,t,n){"use strict";var r,o,i,a,s;n.d(t,{A:()=>c}),window.authentication_config.sessionManagementEnabled="1"===window.authentication_config.sessionManagement;const c={debug:!!window.authentication_config.debug,sessionServer:window.authentication_config?window.authentication_config.sessionServer:"",entitlementsEnabled:!!window.authentication_config&&"1"===window.authentication_config.entitlementsEnabled,dropdownEnabled:!!window.authentication_config&&"1"===window.authentication_config.dropdownEnabled,enableReaderDashboardLink:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardLink,enableDashboardCancel:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardCancel,enableDashboardBenefitHub:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardBenefitHub,enableEngageArticleGifting:"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.articleSharingEnabled)&&"1"===(null===(o=window.authentication_config)||void 0===o?void 0:o.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(a=window.authentication_config)||void 0===a?void 0:a.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(s=window.authentication_config)||void 0===s?void 0:s.articleSavingEnabled),prosperstackClientid:window.authentication_config?window.authentication_config.prosperstackClientid:"",enableUpgradeSubscription:!!window.authentication_config&&"1"===window.authentication_config.enableUpgradeSubscription,oneTapEnabled:!!window.authentication_config&&"1"===window.authentication_config.oneTapEnabled,useTribMainGoogle:!!window.authentication_config&&"1"===window.authentication_config.useTribMainGoogle,isAdfreeArticle:!!window.authentication_config&&"1"===window.authentication_config.isAdfreeArticle,auth0Domain:window.authentication_config?window.authentication_config.auth0Domain:"",auth0ClientId:window.authentication_config?window.authentication_config.auth0ClientId:"",entitlementsEndpoint:window.authentication_config?window.authentication_config.entitlementsEndpoint:"",entitlementsApiKey:window.authentication_config?window.authentication_config.entitlementsAPIKey:"",linaCheckOnArticles:!!window.authentication_config&&window.authentication_config.linaCheckOnArticles,serverEntitlements:!!window.authentication_config&&window.authentication_config.serverEntitlements,googleClientId:window.authentication_config?window.authentication_config.googleClientId:"",newsletterId:window.authentication_config?window.authentication_config.newsletterId:0,connextStorageKey:"",auth0SubKey:"auth0_sub",auth0Authenticated:"auth0.is.authenticated",secret:window.authentication_config?window.authentication_config.pluginSecret:"",newslettersEnabled:!!window.authentication_config&&"1"===window.authentication_config.newslettersEnabled,bcLowaSegements:!!window.authentication_config.bcLowaSegements&&"1"===window.authentication_config.bcLowaSegements,blueconicEnabled:!!window.authentication_config.blueconicEnabled&&"1"===window.authentication_config.blueconicEnabled,datadogEnabled:!!window.authentication_config.enableDatadog&&"1"===window.authentication_config.enableDatadog}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};function t(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function r(e){return function(){var n=this,r=arguments;return new Promise(function(o,i){var a=e.apply(n,r);function s(e){t(a,o,i,s,c,"next",e)}function c(e){t(a,o,i,s,c,"throw",e)}s(void 0)})}}n.r(e),n.d(e,{hasBrowserEnv:()=>yi,hasStandardBrowserEnv:()=>mi,hasStandardBrowserWebWorkerEnv:()=>Ei,navigator:()=>wi,origin:()=>gi});var o=n(4756);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var a=n(3612);const s=function(){if(a.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;re.length)&&(t=e.length);for(var n=0,r=Array(t);n{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return atob(t)}}h.prototype.name="InvalidTokenError","function"==typeof SuppressedError&&SuppressedError;var y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},w={},m={};Object.defineProperty(m,"__esModule",{value:!0});var E=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var r=e.locked.get(t);void 0===r?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(r.unshift(n),e.locked.set(t,r))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,r){e.isLocked(t)?e.addToLocked(t,n):(e.addToLocked(t),n())})},this.unlock=function(t){var n=e.locked.get(t);if(void 0!==n&&0!==n.length){var r=n.pop();e.locked.set(t,n),void 0!==r&&setTimeout(r,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();m.default=function(){return E.getInstance()};var g=y&&y.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}c((r=r.apply(e,t||[])).next())})},A=y&&y.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?setTimeout(n,t):n(null)}}window.addEventListener("storage",a),e.addToWaiting(a);var s=setTimeout(a,Math.max(0,t-Date.now()))})];case 1:return n.sent(),[2]}})})},e.addToWaiting=function(t){this.removeFromWaiting(t),void 0!==e.waiters&&e.waiters.push(t)},e.removeFromWaiting=function(t){void 0!==e.waiters&&(e.waiters=e.waiters.filter(function(e){return e!==t}))},e.notifyWaiters=function(){void 0!==e.waiters&&e.waiters.slice().forEach(function(e){return e()})},e.prototype.releaseLock=function(e){return g(this,void 0,void 0,function(){return A(this,function(t){switch(t.label){case 0:return[4,this.releaseLock__private__(e)];case 1:return[2,t.sent()]}})})},e.prototype.releaseLock__private__=function(t){return g(this,void 0,void 0,function(){var n,r,o,i;return A(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?v:this.storageHandler,r="browser-tabs-lock-key-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,S.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),S.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,o=[],i=0;;){var a=r.keySync(i);if(null===a)break;o.push(a),i++}for(var s=!1,c=0;c(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;_=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;ae=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw z("The input to be decoded is not correctly encoded.","ERR_INVALID_ARG_VALUE",e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e0)return;if(t){if(0!==e)throw z("".concat(n," must be a non-negative number"),"ERR_INVALID_ARG_VALUE",o);return}throw z("".concat(n," must be a positive number"),"ERR_INVALID_ARG_VALUE",o)}catch(e){if(r)throw de(e.message,r,o);throw e}}function me(e,t,n,r){try{if("string"!=typeof e)throw z("".concat(t," must be a string"),"ERR_INVALID_ARG_TYPE",r);if(0===e.length)throw z("".concat(t," must not be empty"),"ERR_INVALID_ARG_VALUE",r)}catch(e){if(n)throw de(e.message,n,r);throw e}}function Ee(e){!function(e,t){if(Fe(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o2){const e=r.pop();"".concat(r.join(", "),", or ").concat(e)}else 2===r.length?"".concat(r[0]," or ").concat(r[1]):r[0];return de(t,ct,e)}(e,t)}(e,"application/json")}function ge(){return ce(crypto.getRandomValues(new Uint8Array(32)))}function Ae(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new ue("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"RSASSA-PKCS1-v1_5":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new ue("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"ECDSA":return function(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new ue("unsupported EcKeyAlgorithm namedCurve",{cause:e})}}(e);case"Ed25519":case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return e.algorithm.name;case"EdDSA":return"Ed25519";default:throw new ue("unsupported CryptoKey algorithm name",{cause:e})}}function be(e){const t=null==e?void 0:e[Z];return"number"==typeof t&&Number.isFinite(t)?t:0}function Se(e){const t=null==e?void 0:e[Q];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function ve(){return Math.floor(Date.now()/1e3)}function Re(e){if("object"!=typeof e||null===e)throw z('"as" must be an object',"ERR_INVALID_ARG_TYPE");me(e.issuer,'"as.issuer"')}function Te(e){if("object"!=typeof e||null===e)throw z('"client" must be an object',"ERR_INVALID_ARG_TYPE");me(e.client_id,'"client.client_id"')}function Oe(e){return me(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function Ne(e,t){const{key:n,kid:r}=e instanceof CryptoKey?{key:o}:(null==o?void 0:o.key)instanceof CryptoKey?(void 0!==o.kid&&me(o.kid,'"kid"'),{key:o.key,kid:o.kid}):{};var o;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw z("".concat(t," must be a CryptoKey"),"ERR_INVALID_ARG_TYPE")}(e,t),"private"!==e.type)throw z("".concat(t," must be a private CryptoKey"),"ERR_INVALID_ARG_VALUE")}(n,'"clientPrivateKey.key"'),async(e,o,i,a)=>{var s;const c={alg:Ae(n),kid:r},u=function(e,t){const n=ve()+be(t);return{jti:ge(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,o);null==t||null===t[te]||void 0===s||s.call(t,c,u),i.set("client_id",o.client_id),i.set("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),i.set("client_assertion",await async function(e,t,n){if(!n.usages.includes("sign"))throw z('CryptoKey instances used for signing assertions must include "sign" in their "usages"',"ERR_INVALID_ARG_VALUE");const r="".concat(ce(ie(JSON.stringify(e))),".").concat(ce(ie(JSON.stringify(t)))),o=ce(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:gt(e)};case"RSA-PSS":switch(Et(e),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new ue("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return Et(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new ue("unsupported CryptoKey algorithm name",{cause:e})}(n),n,ie(r)));return"".concat(r,".").concat(o)}(c,u,n))}}const _e=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function Ie(e,t){if(t&&"https:"!==e.protocol)throw de("only requests to HTTPS are allowed",lt,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw de("only HTTP and HTTPS requests are allowed",dt,e)}function Ce(e,t,n,r){let o;if("string"!=typeof e||!_e(e))throw de("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?yt:wt,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return Ie(o,r),o}function ke(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?Ce(e.mtls_endpoint_aliases[t],t,n,r):Ce(e[t],t,n,r)}class Le extends Error{constructor(e,t){var n;super(e,t),G(this,"cause",void 0),G(this,"code",void 0),G(this,"error",void 0),G(this,"status",void 0),G(this,"error_description",void 0),G(this,"response",void 0),this.name=this.constructor.name,this.code=rt,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:t.response}),null===Error.captureStackTrace||void 0===n||n.call(Error,this,this.constructor)}}class Pe extends Error{constructor(e,t){var n,r;super(e,t),G(this,"cause",void 0),G(this,"code",void 0),G(this,"error",void 0),G(this,"error_description",void 0),this.name=this.constructor.name,this.code=it,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=null!==t.cause.get("error_description")&&void 0!==n?n:void 0,null===Error.captureStackTrace||void 0===r||r.call(Error,this,this.constructor)}}class Ue extends Error{constructor(e,t){var n;super(e,t),G(this,"cause",void 0),G(this,"code",void 0),G(this,"response",void 0),G(this,"status",void 0),this.name=this.constructor.name,this.code=nt,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null===Error.captureStackTrace||void 0===n||n.call(Error,this,this.constructor)}}const xe=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)"),De=new RegExp('^[,\\s]*([a-zA-Z0-9!#$%&\\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"[,\\s]*(.*)'),Be=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)[,\\s]*(.*)"),Me=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function He(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(function(e){if(!Y(e,Response))throw z('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(xe);const i=null===t||void 0===o?void 0:o[1].toLowerCase();if(!i)return;const a=r.substring(t[0].length);if(a&&!a.match(/^[\s,]/))return;const s=a.match(/^\s+(.*)$/),c=!!s;s?s[1]:void 0;const u={};let l;if(c)for(;r;){let n,o;if(r.match(De)){if([,n,o,r]=t,o.includes("\\"))try{JSON.parse('"'.concat(o,'"'))}catch(e){}u[n.toLowerCase()]=o}else{if(!r.match(Be)){if(r.match(Me)){if(Object.keys(u).length)break;[,l,r]=t;break}return}[,n,o,r]=t,u[n.toLowerCase()]=o}}else 0;const d={scheme:i,parameters:u};l&&(d.token68=l),n.push(d)}return n.length?n:void 0}(e))throw new Ue("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}(e),await async function(e){if(e.status>399&&e.status<500){mt(e),Ee(e);try{const t=await e.clone().json();if(fe(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===e.body||void 0===r?void 0:r.cancel()),new Le("server responded with an error in the response body",{cause:t,response:e});throw de('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),ut,e)}}function Ge(e){if(!qe.has(e))throw z('"options.DPoP" is not a valid DPoPHandle',"ERR_INVALID_ARG_VALUE")}function Fe(e){var t;return null===e.headers.get("content-type")||void 0===t?void 0:t.split(";")[0]}async function Ke(e,t,n,r,o,i,a){return await n(e,t,o,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[ee])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:pe(r,null==a?void 0:a.signal)})}async function je(e,t,n,r,o,i){var a;const s=ke(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[q]));o.set("grant_type",r);const c=he(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(Ge(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await Ke(e,t,n,s,o,c,i);return null==i||null===i.DPoP||void 0===a||a.cacheNonce(u,s),u}const We=new WeakMap,Xe=new WeakMap;function Je(e){if(!e.id_token)return;const t=We.get(e);if(!t)throw z('"ref" was already garbage collected or did not resolve from the proper sources',"ERR_INVALID_ARG_VALUE");return t}async function Ve(e,t,n,r,o,i){if(Re(e),Te(t),!Y(n,Response))throw z('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await He(n,200,"Token Endpoint"),mt(n);const a=await Rt(n);if(me(a.access_token,'"response" body "access_token" property',st,{body:a}),me(a.token_type,'"response" body "token_type" property',st,{body:a}),a.token_type=a.token_type.toLowerCase(),void 0!==a.expires_in){let e="number"!=typeof a.expires_in?parseFloat(a.expires_in):a.expires_in;we(e,!0,'"response" body "expires_in" property',st,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&me(a.refresh_token,'"response" body "refresh_token" property',st,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw de('"response" body "scope" property must be a string',st,{body:a});if(void 0!==a.id_token){me(a.id_token,'"response" body "id_token" property',st,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(we(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const{claims:s,jwt:c}=await async function(e,t,n,r,o){let i,a,{0:s,1:c,length:u}=e.split(".");if(5===u){if(void 0===o)throw new ue("JWE decryption is not configured",{cause:e});await o(e),({0:s,1:c,length:u}=e.split("."))}if(3!==u)throw de("Invalid JWT",st,e);try{JSON.parse(ie(ce(s)))}catch(e){throw de("failed to parse JWT Header body as base64url encoded JSON",at,e)}if(!fe(i))throw de("JWT Header must be a top level object",st,e);if(t(i),void 0!==i.crit)throw new ue('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{JSON.parse(ie(ce(c)))}catch(e){throw de("failed to parse JWT Payload body as base64url encoded JSON",at,e)}if(!fe(a))throw de("JWT Payload must be a top level object",st,e);const l=ve()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw de('unexpected JWT "exp" (expiration time) claim type',st,{claims:a});if(a.exp<=l-r)throw de('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',ft,{claims:a,now:l,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw de('unexpected JWT "iat" (issued at) claim type',st,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw de('unexpected JWT "iss" (issuer) claim type',st,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw de('unexpected JWT "nbf" (not before) claim type',st,{claims:a});if(a.nbf>l+r)throw de('unexpected JWT "nbf" (not before) claim value',ft,{claims:a,now:l,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw de('unexpected JWT "aud" (audience) claim type',st,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,At.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),be(t),Se(t),o).then(Qe.bind(void 0,i)).then(ze.bind(void 0,e)).then(Ye.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw de('ID Token "aud" (audience) claim includes additional untrusted audiences',ht,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw de('unexpected ID Token "azp" (authorized party) claim value',ht,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&we(s.auth_time,!0,'ID Token "auth_time" (authentication time)',st,{claims:s}),Xe.set(n,c),We.set(a,s)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new ue("unsupported `token_type` value",{cause:{body:a}});return a}function Ye(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw de('unexpected JWT "aud" (audience) claim value',ht,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw de('unexpected JWT "aud" (audience) claim value',ht,{expected:e,claims:t.claims,claim:"aud"});return t}function ze(e,t){var n,r;const o=null!==(null===e[Ot]||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw de('unexpected JWT "iss" (issuer) claim value',ht,{expected:o,claims:t.claims,claim:"iss"});return t}const qe=new WeakSet,$e=Symbol(),Ze={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function Qe(e,t){for(const n of e)if(void 0===t.claims[n])throw de('JWT "'.concat(n,'" (').concat(Ze[n],") claim missing"),st,{claims:t.claims});return t}const et=Symbol(),tt=Symbol();const nt="OAUTH_WWW_AUTHENTICATE_CHALLENGE",rt="OAUTH_RESPONSE_BODY_ERROR",ot="OAUTH_UNSUPPORTED_OPERATION",it="OAUTH_AUTHORIZATION_RESPONSE_ERROR",at="OAUTH_PARSE_ERROR",st="OAUTH_INVALID_RESPONSE",ct="OAUTH_RESPONSE_IS_NOT_JSON",ut="OAUTH_RESPONSE_IS_NOT_CONFORM",lt="OAUTH_HTTP_REQUEST_FORBIDDEN",dt="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",ft="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",ht="OAUTH_JWT_CLAIM_COMPARISON_FAILED",pt="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",yt="OAUTH_MISSING_SERVER_METADATA",wt="OAUTH_INVALID_SERVER_METADATA";function mt(e){if(e.bodyUsed)throw z('"response" body has been used already',"ERR_INVALID_ARG_VALUE")}function Et(e){const{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new ue("unsupported ".concat(t.name," modulusLength"),{cause:e})}function gt(e){const{algorithm:t}=e;switch(t.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new ue("unsupported ECDSA namedCurve",{cause:e})}}function At(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw de('unexpected JWT "alg" header parameter',st,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw de('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?r.alg!==n:"function"==typeof n?!n(r.alg):!n.includes(r.alg))throw de('unexpected JWT "alg" header parameter',st,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw de('unexpected JWT "alg" header parameter',st,{header:r,expected:e,reason:"client configuration"})}function bt(e,t){const{0:n,length:r}=e.getAll(t);if(r>1)throw de('"'.concat(t,'" parameter must be provided only once'),st);return n}const St=Symbol(),vt=Symbol();async function Rt(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ee;try{await e.json()}catch(t){throw n(e),de('failed to parse "response" body as JSON',at,t)}if(!fe(t))throw de('"response" body must be a top level object',st,{body:t});return t}const Tt=Symbol(),Ot=Symbol(),Nt=new TextEncoder,_t=new TextDecoder;function It(e){const t=new Uint8Array(e.length);for(let n=0;n127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=r}return t}function Ct(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),G(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),G(this,"claim",void 0),G(this,"reason",void 0),G(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}G(Pt,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Ut extends Lt{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),G(this,"code","ERR_JWT_EXPIRED"),G(this,"claim",void 0),G(this,"reason",void 0),G(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}G(Ut,"code","ERR_JWT_EXPIRED");class xt extends Lt{constructor(){super(...arguments),G(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}G(xt,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Dt extends Lt{constructor(){super(...arguments),G(this,"code","ERR_JOSE_NOT_SUPPORTED")}}G(Dt,"code","ERR_JOSE_NOT_SUPPORTED"),G(class extends Lt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),G(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),G(class extends Lt{constructor(){super(...arguments),G(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class Bt extends Lt{constructor(){super(...arguments),G(this,"code","ERR_JWS_INVALID")}}G(Bt,"code","ERR_JWS_INVALID");class Mt extends Lt{constructor(){super(...arguments),G(this,"code","ERR_JWT_INVALID")}}G(Mt,"code","ERR_JWT_INVALID"),G(class extends Lt{constructor(){super(...arguments),G(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class Ht extends Lt{constructor(){super(...arguments),G(this,"code","ERR_JWKS_INVALID")}}G(Ht,"code","ERR_JWKS_INVALID");class Gt extends Lt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no applicable key found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),G(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}G(Gt,"code","ERR_JWKS_NO_MATCHING_KEY");class Ft extends Lt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"multiple matching keys found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),G(this,Symbol.asyncIterator,void 0),G(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}G(Ft,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class Kt extends Lt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),G(this,"code","ERR_JWKS_TIMEOUT")}}G(Kt,"code","ERR_JWKS_TIMEOUT");class jt extends Lt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),G(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}G(jt,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const Wt=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},Xt=(e,t)=>e.name===t;function Jt(e){return parseInt(e.name.slice(4),10)}function Vt(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2){const t=r.pop();e+="one of type ".concat(r.join(", "),", or ").concat(t,".")}else 2===r.length?e+="one of type ".concat(r[0]," or ").concat(r[1],"."):e+="of type ".concat(r[0],".");if(null==t)e+=" Received ".concat(t);else if("function"==typeof t&&t.name)e+=" Received function ".concat(t.name);else if("object"==typeof t&&null!=t){var i;null!==(i=t.constructor)&&void 0!==i&&i.name&&(e+=" Received an instance of ".concat(t.constructor.name))}return e}const Yt=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},qt=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),$t=e=>zt(e)||qt(e);function Zt(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 n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}const Qt=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n{const t=e.data[e.pos++];if(128&t){const n=127&t;let r=0;for(let t=0;t{if(e.data[e.pos++]!==t)throw new Error(n)},nn=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},rn=(e,t,n)=>{var r;const o=(e=>Ct(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);let i=n;return null!=t&&null!==(r=t.startsWith)&&void 0!==r&&r.call(t,"ECDH-ES")&&(i||(i={}),i.getNamedCurve=e=>{const t={data:e,pos:0};return function(e){tn(e,48,"Invalid PKCS#8 structure"),en(e),tn(e,2,"Expected version field");const t=en(e);e.pos+=t,tn(e,48,"Expected algorithm identifier");en(e);e.pos}(t),(e=>{const t=(e=>{tn(e,6,"Expected algorithm OID");const t=en(e);return nn(e,t)})(e);if(Qt(t,[43,101,110]))return"X25519";if(!Qt(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");tn(e,6,"Expected curve OID");const n=en(e),r=nn(e,n);for(const{name:e,oid:t}of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}])if(Qt(r,t))return e;throw new Error("Unsupported named curve")})(t)}),(async(e,t,n,r)=>{var o;let i,a;const s="spki"===e,c=()=>s?["verify"]:["sign"];switch(n){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(n.slice(-3),10)||1)},a=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":i={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[n]},a=c();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{const e=r.getNamedCurve(t);i="X25519"===e?{name:"X25519"}:{name:"ECDH",namedCurve:e}}catch(e){throw new Dt("Invalid or unsupported key format")}a=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":i={name:"Ed25519"},a=c();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":i={name:n},a=c();break;default:throw new Dt('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(e,t,i,null!==(o=null==r?void 0:r.extractable)&&void 0!==o?o:!!s,a)})("pkcs8",o,t,i)};async function on(e){var t,n;if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:r,keyUsages:o}=function(e){let t,n;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},n=e.priv?["sign"]:["verify"];break;default:throw new Dt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(e.alg.slice(-3),10)||1)},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new Dt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new Dt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new Dt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new Dt('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}(e),i=K({},e);return"AKP"!==i.kty&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,r,null!==(t=e.ext)&&void 0!==t?t:!e.d&&!e.priv,null!==(n=e.key_ops)&&void 0!==n?n:o)}const an=e=>Zt(e)&&"string"==typeof e.kty;let sn;const cn=async function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];sn||(sn=new WeakMap);let o=sn.get(e);if(null!=o&&o[n])return o[n];const i=await on(K(K({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:sn.set(e,{[n]:i}),i};const un=e=>null==e?void 0:e[Symbol.toStringTag],ln=(e,t,n)=>{if(void 0!==t.use){let e;switch(n){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==e)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(e,'" when present'));if(Array.isArray(t.key_ops)){var r,o;let i;switch(!0){case"sign"===n||"verify"===n:case"dir"===e:case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):i=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===n?"wrapKey":"unwrapKey":n;break;case"encrypt"===n&&e.startsWith("RSA"):i="wrapKey";break;case"decrypt"===n:i=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&!1===(null===(r=t.key_ops)||void 0===r||null===(o=r.includes)||void 0===o?void 0:o.call(r,i)))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(i,'" when present'))}return!0};var dn,fn;let hn,pn;if("undefined"==typeof navigator||null===(dn=navigator.userAgent)||void 0===dn||null===(fn=dn.startsWith)||void 0===fn||!fn.call(dn,"Mozilla/5.0 ")){const e="v6.8.1";pn="".concat("openid-client","/").concat(e),hn={"user-agent":pn}}const yn=e=>wn.get(e);let wn,mn;function En(e){return void 0!==e?Oe(e):(mn||(mn=new WeakMap),(e,t,n,r)=>{let o;return(o=mn.get(t))||(function(e,t){if("string"!=typeof e)throw Sn("".concat(t," must be a string"),bn);if(0===e.length)throw Sn("".concat(t," must not be empty"),An)}(t.client_secret,'"metadata.client_secret"'),o=Oe(t.client_secret),mn.set(t,o)),o(e,t,n,r)})}const gn=ee,An="ERR_INVALID_ARG_VALUE",bn="ERR_INVALID_ARG_TYPE";function Sn(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class vn extends Error{constructor(e,t){var n;super(e,t),G(this,"code",void 0),this.name=this.constructor.name,this.code=null==t?void 0:t.code,null===Error.captureStackTrace||void 0===n||n.call(Error,this,this.constructor)}}function Rn(e,t,n){return new vn(e,{cause:t,code:n})}function Tn(e){if(e instanceof TypeError||e instanceof vn||e instanceof Le||e instanceof Pe||e instanceof Ue)throw e;if(e instanceof le)switch(e.code){case lt:throw Rn("only requests to HTTPS are allowed",e,e.code);case dt:throw Rn("only requests to HTTP or HTTPS are allowed",e,e.code);case ut:throw Rn("unexpected HTTP response status code",e.cause,e.code);case ct:throw Rn("unexpected response content-type",e.cause,e.code);case at:throw Rn("parsing error occured",e,e.code);case st:throw Rn("invalid response encountered",e,e.code);case ht:throw Rn("unexpected JWT claim value encountered",e,e.code);case pt:throw Rn("unexpected JSON attribute value encountered",e,e.code);case ft:throw Rn("JWT timestamp claim value failed validation",e,e.code);default:throw Rn(e.message,e,e.code)}if(e instanceof ue)throw Rn("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw Rn("runtime operation error",e,ot);case"NotSupportedError":throw Rn("runtime unsupported operation",e,ot);case"TimeoutError":throw Rn("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw Rn("operation aborted",e,"OAUTH_ABORT")}throw new vn("something went wrong",{cause:e})}async function On(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw Sn('"server" must be an instance of URL',bn);const o=!e.href.includes("/.well-known/"),i=null!==(null==t?void 0:t.timeout)&&void 0!==n?n:30,a=AbortSignal.timeout(1e3*i),s=await(o?async function(e,t){return async function(e,t,n,r){if(!(e instanceof URL))throw z('"'.concat("issuerIdentifier",'" must be an instance of URL'),"ERR_INVALID_ARG_TYPE");Ie(e,!0!==(null==r?void 0:r[q]));const o=n(new URL(e.href)),i=he(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[ee])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:pe(o,null==r?void 0:r.signal)})}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=ye("".concat(e.pathname,"/").concat(".well-known/openid-configuration"))}(e);break;case"oauth2":!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"/"===e.pathname?e.pathname=t:e.pathname=ye("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw z('"options.algorithm" must be "oidc" (default), or "oauth2"',"ERR_INVALID_ARG_VALUE")}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[ee]:null==t?void 0:t[gn],[q]:null==t||null===t.execute||void 0===r?void 0:r.includes(Un),signal:a,headers:new Headers(hn)}):((null==t?void 0:t[gn])||fetch)((Ie(e,null==t||null===t.execute||void 0===c||!c.includes(Un)),e.href),{headers:Object.fromEntries(new Headers(K({accept:"application/json"},hn)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Tt)throw z('"expectedIssuerIdentifier" must be an instance of URL',"ERR_INVALID_ARG_TYPE");if(!Y(t,Response))throw z('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");if(200!==t.status)throw de('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',ut,t);mt(t);const r=await Rt(t);if(me(r.issuer,'"response" body "issuer" property',st,{body:r}),n!==Tt&&new URL(r.issuer).href!==n.href)throw de('"response" body "issuer" property does not match the expected value',pt,{expected:n.href,body:r,attribute:"issuer"});return r}(Tt,e)).catch(Tn);var c;return o&&new URL(s.issuer).href!==e.href&&(function(e,t,n){return!("https://login.microsoftonline.com"!==e.origin||null!=n&&n.algorithm&&"oidc"!==n.algorithm||(t[Nn]=!0,0))}(e,s,t)||function(e,t){return!(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)}(e,t)||(()=>{throw new vn("discovered metadata issuer does not match the expected issuer",{code:pt,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new _n(i,t,n,r);let s=yn(a);if(null!=o&&o[gn]&&(s.fetch=o[gn]),null!=o&&o.timeout&&(s.timeout=o.timeout),null!=o&&o.execute)for(const e of o.execute)e(a);return a}new TextDecoder;const Nn=Symbol();class _n{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw Sn('"clientId" must be a non-empty string',bn);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(o=n)||void 0===o?void 0:o.client_id)&&t!==n.client_id)throw Sn('"clientId" and "metadata.client_id" must be the same',An);const u=K(K({},structuredClone(n)),{},{client_id:t});let l;u[Z]=null!==(i=null===(a=n)||void 0===a?void 0:a[Z])&&void 0!==i?i:0,u[Q]=null!==(s=null===(c=n)||void 0===c?void 0:c[Q])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?En(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const f=structuredClone(e);Nn in e&&(f[Ot]=t=>{let{claims:{tid:n}}=t;return e.issuer.replace("{tenantid}",n)});let h=Object.freeze(f);wn||(wn=new WeakMap),wn.set(this,{__proto__:null,as:h,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(yn(this).as);return function(e){Object.defineProperties(e,function(e){return{supportsPKCE:{__proto__:null,value(){var t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"S256";return!0===(null===(t=e.code_challenge_methods_supported)||void 0===t?void 0:t.includes(n))}}}}(e))}(e),e}clientMetadata(){return structuredClone(yn(this).c)}get timeout(){return yn(this).timeout}set timeout(e){yn(this).timeout=e}get[gn](){return yn(this).fetch}set[gn](e){yn(this).fetch=e}}function In(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const t=new Date;t.setSeconds(t.getSeconds()+e.expires_in),t.getTime()}return{expiresIn:{__proto__:null,value(){if(t){const e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return Je(this)}catch(e){return}}}}}(e))}async function Cn(e,t,n){var r;let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===e.headers.get("retry-after")||void 0===r?void 0:r.trim();if(void 0===i)return;let a;if(/^\d+$/.test(i))parseInt(i,10);else{const e=new Date(i);if(Number.isFinite(e.getTime())){const t=new Date,n=e.getTime()-t.getTime();n>0&&Math.ceil(n/1e3)}}if(o&&!Number.isFinite(a))throw new le("invalid Retry-After header value",{cause:e});a>t&&await kn(a-t,n)}function kn(e,t){return new Promise((n,r)=>{const o=e=>{try{t.throwIfAborted()}catch(e){return void r(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>o(e-i),1e3*i)};o(e)})}async function Ln(e,t){Gn(e);const{as:n,c:r,auth:o,fetch:i,tlsOnly:a,timeout:s}=yn(e);return async function(e,t,n,r,o){Re(e),Te(t);const i=ke(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[q])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=he(null==o?void 0:o.headers);return s.set("accept","application/json"),Ke(e,t,n,i,a,s,o)}(n,r,o,t,{[ee]:i,[q]:!a,headers:new Headers(hn),signal:Fn(s)}).then(e=>async function(e,t,n){if(Re(e),Te(t),!Y(n,Response))throw z('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await He(n,200,"Backchannel Authentication Endpoint"),mt(n);const r=await Rt(n);me(r.auth_req_id,'"response" body "auth_req_id" property',st,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return we(o,!0,'"response" body "expires_in" property',st,{body:r}),r.expires_in=o,void 0!==r.interval&&we(r.interval,!1,'"response" body "interval" property',st,{body:r}),r}(n,r,e)).catch(Tn)}async function Pn(e,t,n,r){var o,i;Gn(e),new URLSearchParams(n);let a=null!==t.interval&&void 0!==o?o:5;const s=null!==(null==r?void 0:r.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await kn(a,s)}catch(e){Tn(e)}const{as:c,c:u,auth:l,fetch:d,tlsOnly:f,nonRepudiation:h,timeout:p,decrypt:y}=yn(e),w=(o,i)=>Pn(e,K(K({},t),{},{interval:o}),n,K(K({},r),{},{signal:s,flag:i})),m=await async function(e,t,n,r,o){Re(e),Te(t),me(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),je(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(c,u,l,t.auth_req_id,{[ee]:d,[q]:!f,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(hn),signal:s.aborted?s:Fn(p)}).catch(Tn);var E;if(503===m.status&&m.headers.has("retry-after"))return await Cn(m,a,s,!0),await(null===m.body||void 0===E?void 0:E.cancel()),w(a);const g=async function(e,t,n,r){return Ve(e,t,n,void 0,null==r?void 0:r[ne],null==r?void 0:r.recognizedTokenTypes)}(c,u,m,{[ne]:y});let A;try{await g}catch(e){if(Kn(e,r))return w(a,jn);if(e instanceof Le)switch(e.error){case"slow_down":0;case"authorization_pending":return await Cn(e.response,a,s),w(a)}Tn(e)}return A.id_token&&await(null==h?void 0:h(m)),In(A),A}function Un(e){yn(e).tlsOnly=!1}async function xn(e,t,n,r,o){if(Gn(e),!((null==o?void 0:o.flag)===jn||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw Sn('"currentUrl" must be an instance of URL, or Request',bn);let i,a;const{as:s,c,auth:u,fetch:l,tlsOnly:d,jarm:f,hybrid:h,nonRepudiation:p,timeout:y,decrypt:w,implicit:m}=yn(e);if((null==o?void 0:o.flag)===jn)o.authResponse,o.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await async function(e){if("POST"!==e.method)throw z("form_post responses are expected to use the POST method","ERR_INVALID_ARG_VALUE",{cause:e});if("application/x-www-form-urlencoded"!==Fe(e))throw z("form_post responses are expected to use the application/x-www-form-urlencoded content-type","ERR_INVALID_ARG_VALUE",{cause:e});return async function(e){if(e.bodyUsed)throw z("form_post Request instances must contain a readable body","ERR_INVALID_ARG_VALUE",{cause:e});return e.text()}(e)}(e));if(h)t.hash=n.toString();else for(const[e,r]of n.entries())t.searchParams.append(e,r);break;default:throw Sn("unexpected Request HTTP method",An)}}switch(function(e){return new URL(e).search="",e.hash="",e.href}(t),!0){case!!f:await f(t,null==n?void 0:n.expectedState);break;case!!h:await h(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!m:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{(function(e,t,n,r){if(Re(e),Te(t),n instanceof URL&&n.searchParams,!(n instanceof URLSearchParams))throw z('"parameters" must be an instance of URLSearchParams, or URL',"ERR_INVALID_ARG_TYPE");if(bt(n,"response"))throw de('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',st,{parameters:n});const o=bt(n,"iss"),i=bt(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw de('response parameter "iss" (issuer) missing',st,{parameters:n});if(o&&o!==e.issuer)throw de('unexpected "iss" (issuer) response parameter value',st,{expected:e.issuer,parameters:n});switch(r){case void 0:case vt:if(void 0!==i)throw de('unexpected "state" response parameter encountered',st,{expected:void 0,parameters:n});break;case St:break;default:if(me(r,'"expectedState" argument'),i!==r)throw de(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',st,{expected:r,parameters:n})}if(bt(n,"error"))throw new Pe("authorization response from the server is an error",{cause:n});const a=bt(n,"id_token"),s=bt(n,"token");if(void 0!==a||void 0!==s)throw new ue("implicit and hybrid flows are not supported");return new URLSearchParams(n),qe.add(c),c;var c})(s,c,t.searchParams,null==n?void 0:n.expectedState)}catch(e){Tn(e)}}}const E=await async function(e,t,n,r,o,i,a){if(Re(e),Te(t),!qe.has(r))throw z('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',"ERR_INVALID_ARG_VALUE");me(o,'"redirectUri"');const s=bt(r,"code");if(!s)throw de('no authorization code in "callbackParameters"',st);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==$e&&(me(i,'"codeVerifier"'),c.set("code_verifier",i)),je(e,t,n,"authorization_code",c,a)}(s,c,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||$e,{additionalParameters:r,[ee]:l,[q]:!d,DPoP:null==o?void 0:o.DPoP,headers:new Headers(hn),signal:Fn(y)}).catch(Tn);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const g=async function(e,t,n,r){return"string"==typeof(null==r?void 0:r.expectedNonce)||"number"==typeof(null==r?void 0:r.maxAge)||null!=r&&r.requireIdToken?async function(e,t,n,r,o,i,a){const s=[];switch(r){case void 0:0;break;case et:break;default:me(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||t.default_max_age,o){case void 0:0;break;case tt:break;default:we(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await Ve(e,t,n,s,i,a);me(c.id_token,'"response" body "id_token" property',st,{body:c});const u=Je(c);if(o!==tt){const e=ve()+be(t),n=Se(t);if(u.auth_time+o{let n;return"urn:ietf:params:oauth:grant-type:token-exchange"===t&&{n_a:()=>{}},async function(e,t,n,r){return Ve(e,t,n,void 0,null==r?void 0:r[ne],null==r?void 0:r.recognizedTokenTypes)}(o,i,e,{[ne]:l,recognizedTokenTypes:n})}).catch(Tn);return In(d),d}async function Xn(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;void 0!==n?new Map([...Object.entries(n),...t.entries()]):t;for(const t of r.crit){if(!i.has(t))throw new Dt('Extension Header Parameter "'.concat(t,'" is not recognized'));if(void 0===o[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i.get(t)&&void 0===r[t])throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return new Set(r.crit)}(Bt,new Map([["b64",!0]]),null==n?void 0:n.crit,r,o);let a=!0;if(i.has("b64")&&(r.b64,"boolean"!=typeof a))throw new Bt('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=o;if("string"!=typeof s||!s)throw new Bt('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=n&&function(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat("algorithms",'" option must be an array of strings'));if(t)return new Set(t)}(0,n.algorithms);if(c&&!c.has(s))throw new xt('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof e.payload)throw new Bt("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new Bt("JWS Payload must be a string or an Uint8Array instance");let u=!1;"function"==typeof t&&(await t(r,e),!0),function(e,t,n){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((e,t,n)=>{if(!(t instanceof Uint8Array)){if(an(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&ln(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!$t(t))throw new TypeError(Yt(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(un(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(an(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&ln(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if((e=>"oct"!==e.kty&&void 0===e.d&&void 0===e.priv)(t)&&ln(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!$t(t))throw new TypeError(Yt(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(un(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(un(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(un(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(un(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(un(t),' instances for asymmetric algorithm encryption must be of type "public"'))}})(e,t,n)}}(s,t,"verify");const l=function(){for(var e=arguments.length,t=new Array(e),n=0;n{let{length:n}=t;return e+n},0),o=new Uint8Array(r);let i=0;for(const e of t)o.set(e,i),e.length;return o}(void 0!==e.protected?It(e.protected):new Uint8Array,It("."),"string"==typeof e.payload?a?It(e.payload):Nt.encode(e.payload):e.payload);let d;try{kt(e.signature)}catch(e){throw new Bt("Failed to base64url decode the signature")}const f=await async function(e,t){if(e instanceof Uint8Array)return e;if(zt(e))return e;if(qt(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{sn||(sn=new WeakMap);let n=sn.get(e);if(null!=n&&n[t])return n[t];const r="public"===e.type,o=!!r;let i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError("given KeyObject instance cannot be used for this algorithm");e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError("given KeyObject instance cannot be used for this algorithm");e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let n;switch(t){case"RSA-OAEP":0;break;case"RS256":case"PS256":case"RSA-OAEP-256":0;break;case"RS384":case"PS384":case"RSA-OAEP-384":0;break;case"RS512":case"PS512":case"RSA-OAEP-512":0;break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:n},o,r?["encrypt"]:["decrypt"]);e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:n},o,[r?"verify":"sign"])}if("ec"===e.asymmetricKeyType){var a;const n=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(null===e.asymmetricKeyDetails||void 0===a?void 0:a.namedCurve);if(!n)throw new TypeError("given KeyObject instance cannot be used for this algorithm");"ES256"===t&&"P-256"===n&&e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"]),"ES384"===t&&"P-384"===n&&e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"]),"ES512"===t&&"P-521"===n&&e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"]),t.startsWith("ECDH-ES")&&e.toCryptoKey({name:"ECDH",namedCurve:n},o,r?[]:["deriveBits"])}if(!i)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return n?n[t]=i:sn.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return cn(e,n,t)}if(an(e))return e.k?kt(e.k):cn(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await Xn(e,t,"verify");!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if("number"!=typeof n||n<2048)throw new TypeError("".concat(e," requires key modulusLength to be 2048 bits or larger"))}}(e,o);const i=function(e,t){const n="SHA-".concat(e.slice(-3));switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new Dt("alg ".concat(e," is not supported either by JOSE or your javascript runtime"))}}(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch(e){return!1}}(s,f,d,l))throw new jt;let h;if(a)try{kt(e.payload)}catch(e){throw new Bt("Failed to base64url decode the payload")}else"string"==typeof e.payload?Nt.encode(e.payload):e.payload;const p={payload:h};return void 0!==e.protected&&(p.protectedHeader=r),void 0!==e.header&&(p.unprotectedHeader=e.header),u?K(K({},p),{},{key:f}):p}const Vn=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function Yn(e){const t=Vn.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]);let r;switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":Math.round(3600*n);break;case"day":case"days":case"d":Math.round(86400*n);break;case"week":case"weeks":case"w":Math.round(604800*n);break;default:Math.round(31557600*n)}return"-"===t[1]||"ago"===t[4]?-r:r}const zn=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());async function qn(e,t,n){var r;const o=await async function(e,t,n){if(e instanceof Uint8Array&&_t.decode(e),"string"!=typeof e)throw new Bt("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:i,length:a}=e.split(".");if(3!==a)throw new Bt("Invalid Compact JWS");const s=await Jn({payload:o,protected:r,signature:i},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?K(K({},c),{},{key:s.key}):c}(e,t,n);if(null!==o.protectedHeader.crit&&void 0!==r&&r.includes("b64")&&!1===o.protectedHeader.b64)throw new Mt("JWTs MUST NOT use unencoded payload");const i=function(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{JSON.parse(_t.decode(t))}catch(e){}if(!Zt(n))throw new Mt("JWT Claims Set must be a top-level JSON object");const{typ:o}=r;if(o&&("string"!=typeof e.typ||zn(e.typ)!==zn(o)))throw new Pt('unexpected "typ" JWT header value',n,"typ","check_failed");const{requiredClaims:i=[],issuer:a,subject:s,audience:c,maxTokenAge:u}=r,l=[...i];void 0!==u&&l.push("iat"),void 0!==c&&l.push("aud"),void 0!==s&&l.push("sub"),void 0!==a&&l.push("iss");for(const e of new Set(l.reverse()))if(!(e in n))throw new Pt('missing required "'.concat(e,'" claim'),n,e,"missing");if(a&&!(Array.isArray(a)?a:[a]).includes(n.iss))throw new Pt('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new Pt('unexpected "sub" claim value',n,"sub","check_failed");if(c&&!((e,t)=>"string"==typeof e?t.includes(e):!!Array.isArray(e)&&t.some(Set.prototype.has.bind(new Set(e))))(n.aud,"string"==typeof c?[c]:c))throw new Pt('unexpected "aud" claim value',n,"aud","check_failed");let d;switch(typeof r.clockTolerance){case"string":Yn(r.clockTolerance);break;case"number":r.clockTolerance;break;case"undefined":0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:f}=r,h=(e=>Math.floor(e.getTime()/1e3))(f||new Date);if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new Pt('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new Pt('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>h+d)throw new Pt('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new Pt('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=h-d)throw new Ut('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){const e=h-n.iat;if(e-d>("number"==typeof u?u:Yn(u)))throw new Ut('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-d)throw new Pt('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}(o.protectedHeader,o.payload,n),a={payload:i,protectedHeader:o.protectedHeader};return"function"==typeof t?K(K({},a),{},{key:o.key}):a}function $n(e){return Zt(e)}var Zn,Qn,er=new WeakMap,tr=new WeakMap;class nr{constructor(e){if(M(this,er,void 0),M(this,tr,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every($n)}(e))throw new Ht("JSON Web Key Set malformed");H(er,this,structuredClone(e))}jwks(){return B(er,this)}async getKey(e,t){const{alg:n,kid:r}=K(K({},e),null==t?void 0:t.header),o=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new Dt('Unsupported "alg" value for a JSON Web Key Set')}}(n),i=B(er,this).keys.filter(e=>{let t=o===e.kty;if(t&&"string"==typeof r&&r===e.kid,!t||"string"!=typeof e.alg&&"AKP"!==o||n===e.alg,t&&"string"==typeof e.use&&"sig"===e.use,t&&Array.isArray(e.key_ops)&&e.key_ops.includes("verify"),t)switch(n){case"ES256":"P-256"===e.crv;break;case"ES384":"P-384"===e.crv;break;case"ES512":"P-521"===e.crv;break;case"Ed25519":case"EdDSA":"Ed25519"===e.crv}return t}),{0:a,length:s}=i;if(0===s)throw new Gt;if(1!==s){const e=new Ft,t=B(tr,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new W(e.apply(this,arguments))}}(function*(){for(const e of i)try{yield yield x(rr(t,e,n))}catch(e){}}),e}return rr(B(tr,this),a,n)}}async function rr(e,t,n){const r=e.get(t)||e.set(t,{}).get(t);if(void 0===r[n]){const e=await async function(e,t){if(!Zt(e))throw new TypeError("JWK must be an object");let n;switch(null!=t||e.alg,null!=n||e.ext,e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return kt(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new Dt('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return on(K(K({},e),{},{alg:t,ext:n}));case"AKP":if("string"!=typeof e.alg||!e.alg)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw new TypeError("JWK alg and alg option value mismatch");return on(K(K({},e),{},{ext:n}));case"EC":case"OKP":return on(K(K({},e),{},{alg:t,ext:n}));default:throw new Dt('Unsupported "kty" (Key Type) Parameter value')}}(K(K({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new Ht("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function or(e){const t=new nr(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>structuredClone(t.jwks()),enumerable:!1,configurable:!1,writable:!1}}),n}let ir;if("undefined"==typeof navigator||null===(Zn=navigator.userAgent)||void 0===Zn||null===(Qn=Zn.startsWith)||void 0===Qn||!Qn.call(Zn,"Mozilla/5.0 ")){const e="v6.1.3";ir="".concat("jose","/").concat(e)}const ar=Symbol(),sr=Symbol();var cr=new WeakMap,ur=new WeakMap,lr=new WeakMap,dr=new WeakMap,fr=new WeakMap,hr=new WeakMap,pr=new WeakMap,yr=new WeakMap,wr=new WeakMap,mr=new WeakMap;class Er{constructor(e,t){if(M(this,cr,void 0),M(this,ur,void 0),M(this,lr,void 0),M(this,dr,void 0),M(this,fr,void 0),M(this,hr,void 0),M(this,pr,void 0),M(this,yr,void 0),M(this,wr,void 0),M(this,mr,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;H(cr,this,new URL(e.href)),H(ur,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),H(lr,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),H(dr,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),H(pr,this,new Headers(null==t?void 0:t.headers)),ir&&!B(pr,this).has("User-Agent")&&B(pr,this).set("User-Agent",ir),B(pr,this).has("accept")||(B(pr,this).set("accept","application/json"),B(pr,this).append("accept","application/jwk-set+json")),H(yr,this,null==t?void 0:t[ar]),void 0!==(null==t?void 0:t[sr])&&(H(mr,this,null==t?void 0:t[sr]),null==t?void 0:t[sr],B(dr,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&Zt(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,Zt)&&(H(fr,this,B(mr,this).uat),H(wr,this,or(B(mr,this).jwks))))}pendingFetch(){return!!B(hr,this)}coolingDown(){return"number"==typeof B(fr,this)&&Date.now()3&&void 0!==arguments[3]?arguments[3]:fetch;const o=await r(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new Kt;throw e});if(200!==o.status)throw new Lt("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new Lt("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(B(cr,this).href,B(pr,this),AbortSignal.timeout(B(ur,this)),B(yr,this)).then(e=>{H(wr,this,or(e)),B(mr,this)&&(B(mr,this).uat=Date.now(),B(mr,this).jwks=e),H(fr,this,Date.now()),H(hr,this,void 0)}).catch(e=>{throw H(hr,this,void 0),e})),await B(hr,this)}}const gr=["mfaToken"],Ar=["mfaToken"];var br,Sr,vr,Rr,Tr,Or,Nr,_r,Ir=class extends Error{constructor(e,t){super(t),G(this,"code",void 0),this.name="NotSupportedError",this.code=e}},Cr=class extends Error{constructor(e,t,n){super(t),G(this,"cause",void 0),G(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},kr=class extends Cr{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},Lr=class extends Cr{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},Pr=class extends Cr{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Ur=class extends Cr{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},xr=class extends Cr{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},Dr=class extends Error{constructor(e){super(e),G(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},Br=class extends Cr{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),G(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},Mr=class extends Cr{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},Hr=class extends Cr{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},Gr=class extends Cr{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},Fr=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),G(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function Kr(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).reduce((e,t)=>K(K({},e),{},{[t[0]]:t[1]}),{})}var jr=class extends Error{constructor(e,t,n){super(t),G(this,"cause",void 0),G(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Wr=class extends jr{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},Xr=class extends jr{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},Jr=class extends jr{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},Vr=class extends jr{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function Yr(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var zr=(br=new WeakMap,Sr=new WeakMap,vr=new WeakMap,class{constructor(e){var t;M(this,br,void 0),M(this,Sr,void 0),M(this,vr,void 0),H(br,this,"https://".concat(e.domain)),H(Sr,this,e.clientId),H(vr,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(B(br,this),"/mfa/authenticators"),{mfaToken:n}=e,r=await B(vr,this).call(this,t,{method:"GET",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!r.ok){const e=await r.json();throw new Wr(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(Yr)}async enrollAuthenticator(e){const t="".concat(B(br,this),"/mfa/associate"),{mfaToken:n}=e,r=j(e,gr),o={authenticator_types:r.authenticatorTypes};"oobChannels"in r&&(o.oob_channels=r.oobChannels),"phoneNumber"in r&&r.phoneNumber&&(o.phone_number=r.phoneNumber),"email"in r&&r.email&&(o.email=r.email);const i=await B(vr,this).call(this,t,{method:"POST",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new Xr(e.error_description||"Failed to enroll authenticator",e)}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const{authenticatorId:t,mfaToken:n}=e,r="".concat(B(br,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await B(vr,this).call(this,r,{method:"DELETE",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!o.ok){const e=await o.json();throw new Jr(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(B(br,this),"/mfa/challenge"),{mfaToken:n}=e,r=j(e,Ar),o={mfa_token:n,client_id:B(Sr,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await B(vr,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new Vr(e.error_description||"Failed to challenge authenticator",e)}return function(e){const t={challengeType:e.challenge_type};return void 0!==e.oob_code&&(t.oobCode=e.oob_code),void 0!==e.binding_method&&(t.bindingMethod=e.binding_method),t}(await i.json())}}),qr=class e{constructor(e,t,n,r,o,i,a){G(this,"accessToken",void 0),G(this,"idToken",void 0),G(this,"refreshToken",void 0),G(this,"expiresAt",void 0),G(this,"scope",void 0),G(this,"claims",void 0),G(this,"authorizationDetails",void 0),G(this,"tokenType",void 0),G(this,"issuedTokenType",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=r,this.expiresAt=t,this.scope=o,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,r=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return r.tokenType=t.token_type,r.issuedTokenType=t.issued_token_type,r}},$r="openid profile email offline_access",Zr=Object.freeze(new Set(["grant_type","client_id","client_secret","client_assertion","client_assertion_type","subject_token","subject_token_type","requested_token_type","actor_token","actor_token_type","audience","aud","resource","resources","resource_indicator","scope","connection","login_hint","organization","assertion"]));function Qr(e){if(null==e)throw new xr("subject_token is required");if("string"!=typeof e)throw new xr("subject_token must be a string");if(0===e.trim().length)throw new xr("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new xr("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new xr("subject_token must not include the 'Bearer ' prefix")}function eo(e,t){if(t)for(const[n,r]of Object.entries(t))if(!Zr.has(n))if(Array.isArray(r)){if(r.length>20)throw new xr("Parameter '".concat(n,"' exceeds maximum array size of ").concat(20));r.forEach(t=>{e.append(n,t)})}else e.append(n,r)}Rr=new WeakMap,Tr=new WeakMap,Or=new WeakMap,Nr=new WeakMap,_r=new WeakSet;async function to(){if(B(Rr,this)&&B(Tr,this))return{configuration:B(Rr,this),serverMetadata:B(Tr,this)};const e=await U(_r,this,oo).call(this);return H(Rr,this,await On(new URL("https://".concat(B(Or,this).domain)),B(Or,this).clientId,{use_mtls_endpoint_aliases:B(Or,this).useMtls},e,{[gn]:B(Or,this).customFetch})),H(Tr,this,B(Rr,this).serverMetadata()),B(Rr,this)[gn]=B(Or,this).customFetch||fetch,{configuration:B(Rr,this),serverMetadata:B(Tr,this)}}async function no(e){var t,n;const{configuration:r}=await U(_r,this,to).call(this);if("audience"in e||"resource"in e)throw new xr("audience and resource parameters are not supported for Token Vault exchanges");Qr(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==e.subjectTokenType&&void 0!==t?t:"urn:ietf:params:oauth:token-type:access_token",requested_token_type:null!==e.requestedTokenType&&void 0!==n?n:"http://auth0.com/oauth/token-type/federated-connection-access-token"});e.loginHint&&o.append("login_hint",e.loginHint),e.scope&&o.append("scope",e.scope),eo(o,e.extra);try{const e=await Wn(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return qr.fromTokenEndpointResponse(e)}catch(t){throw new xr("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function ro(e){const{configuration:t}=await U(_r,this,to).call(this);Qr(e.subjectToken);const n=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.requestedTokenType&&n.append("requested_token_type",e.requestedTokenType),e.organization&&n.append("organization",e.organization),eo(n,e.extra);try{const e=await Wn(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return qr.fromTokenEndpointResponse(e)}catch(t){throw new xr("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function oo(){if(!B(Or,this).clientSecret&&!B(Or,this).clientAssertionSigningKey&&!B(Or,this).useMtls)throw new Fr;if(B(Or,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=B(Or,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||await async function(e,t){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return rn(e,t,void 0)}(e,B(Or,this).clientAssertionSigningAlg||"RS256"),e?function(e){return Ne(e,void 0)}(e):En(B(Or,this).clientSecret)}async function io(e){const{configuration:t}=await U(_r,this,to).call(this),n=ge(),r=await function(e){return async function(e){return me(e,"codeVerifier"),ce(await crypto.subtle.digest("SHA-256",ie(e)))}(e)}(n),o=Kr(K(K({},B(Or,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(K(K({scope:$r},o),{},{client_id:B(Or,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await Hn(t,i):await Mn(t,i),codeVerifier:n}}new N;function ao(e,t){return function(){return e.apply(t,arguments)}}const{toString:so}=Object.prototype,{getPrototypeOf:co}=Object,{iterator:uo,toStringTag:lo}=Symbol,fo=(ho=Object.create(null),e=>{const t=so.call(e);return ho[t]||(ho[t]=t.slice(8,-1).toLowerCase())});var ho;const po=e=>(e=e.toLowerCase(),t=>fo(t)===e),yo=e=>t=>typeof t===e,{isArray:wo}=Array,mo=yo("undefined");function Eo(e){return null!==e&&!mo(e)&&null!==e.constructor&&!mo(e.constructor)&&bo(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const go=po("ArrayBuffer");const Ao=yo("string"),bo=yo("function"),So=yo("number"),vo=e=>null!==e&&"object"==typeof e,Ro=e=>{if("object"!==fo(e))return!1;const t=co(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||lo in e||uo in e)},To=po("Date"),Oo=po("File"),No=po("Blob"),_o=po("FileList"),Io=po("URLSearchParams"),[Co,ko,Lo,Po]=["ReadableStream","Request","Response","Headers"].map(po);function Uo(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),wo(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const Do="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,Bo=e=>!mo(e)&&e!==Do;const Mo=(Ho="undefined"!=typeof Uint8Array&&co(Uint8Array),e=>Ho&&e instanceof Ho);var Ho;const Go=po("HTMLFormElement"),Fo=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Ko=po("RegExp"),jo=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Uo(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Wo=po("AsyncFunction"),Xo=(Jo="function"==typeof setImmediate,Vo=bo(Do.postMessage),Jo?setImmediate:Vo?(Yo=`axios@${Math.random()}`,zo=[],Do.addEventListener("message",({source:e,data:t})=>{e===Do&&t===Yo&&zo.length&&zo.shift()()},!1),e=>{zo.push(e),Do.postMessage(Yo,"*")}):e=>setTimeout(e));var Jo,Vo,Yo,zo;const qo="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Do):"undefined"!=typeof process&&process.nextTick||Xo,$o={isArray:wo,isArrayBuffer:go,isBuffer:Eo,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||bo(e.append)&&("formdata"===(t=fo(e))||"object"===t&&bo(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&go(e.buffer),t},isString:Ao,isNumber:So,isBoolean:e=>!0===e||!1===e,isObject:vo,isPlainObject:Ro,isEmptyObject:e=>{if(!vo(e)||Eo(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Co,isRequest:ko,isResponse:Lo,isHeaders:Po,isUndefined:mo,isDate:To,isFile:Oo,isBlob:No,isRegExp:Ko,isFunction:bo,isStream:e=>vo(e)&&bo(e.pipe),isURLSearchParams:Io,isTypedArray:Mo,isFileList:_o,forEach:Uo,merge:function e(){const{caseless:t,skipUndefined:n}=Bo(this)&&this||{},r={},o=(o,i)=>{const a=t&&xo(r,i)||i;Ro(r[a])&&Ro(o)?r[a]=e(r[a],o):Ro(o)?r[a]=e({},o):wo(o)?r[a]=o.slice():n&&mo(o)||(r[a]=o)};for(let e=0,t=arguments.length;e(Uo(t,(t,r)=>{n&&bo(t)?Object.defineProperty(e,r,{value:ao(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&co(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:fo,kindOfTest:po,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(wo(e))return e;let t=e.length;if(!So(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[uo]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:Go,hasOwnProperty:Fo,hasOwnProp:Fo,reduceDescriptors:jo,freezeMethods:e=>{jo(e,(t,n)=>{if(bo(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];bo(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return wo(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:xo,global:Do,isContextDefined:Bo,isSpecCompliantForm:function(e){return!!(e&&bo(e.append)&&"FormData"===e[lo]&&e[uo])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(vo(e)){if(t.indexOf(e)>=0)return;if(Eo(e))return e;if(!("toJSON"in e)){t[r]=e;const o=wo(e)?[]:{};return Uo(e,(e,t)=>{const i=n(e,r+1);!mo(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Wo,isThenable:e=>e&&(vo(e)||bo(e))&&bo(e.then)&&bo(e.catch),setImmediate:Xo,asap:qo,isIterable:e=>null!=e&&bo(e[uo])};class Zo extends Error{static from(e,t,n,r,o,i){const a=new Zo(e.message,t||e.code,n,r,o);return a.cause=e,a.name=e.name,i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:$o.toJSONObject(this.config),code:this.code,status:this.status}}}Zo.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Zo.ERR_BAD_OPTION="ERR_BAD_OPTION",Zo.ECONNABORTED="ECONNABORTED",Zo.ETIMEDOUT="ETIMEDOUT",Zo.ERR_NETWORK="ERR_NETWORK",Zo.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Zo.ERR_DEPRECATED="ERR_DEPRECATED",Zo.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Zo.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Zo.ERR_CANCELED="ERR_CANCELED",Zo.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Zo.ERR_INVALID_URL="ERR_INVALID_URL";const Qo=Zo;var ei=n(8287).hp;function ti(e){return $o.isPlainObject(e)||$o.isArray(e)}function ni(e){return $o.endsWith(e,"[]")?e.slice(0,-2):e}function ri(e,t,n){return e?e.concat(t).map(function(e,t){return e=ni(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const oi=$o.toFlatObject($o,{},null,function(e){return/^is[A-Z]/.test(e)});const ii=function(e,t,n){if(!$o.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=$o.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!$o.isUndefined(t[e])})).metaTokens,o=n.visitor||u,i=n.dots,a=n.indexes,s=(n.Blob||"undefined"!=typeof Blob&&Blob)&&$o.isSpecCompliantForm(t);if(!$o.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if($o.isDate(e))return e.toISOString();if($o.isBoolean(e))return e.toString();if(!s&&$o.isBlob(e))throw new Qo("Blob is not supported. Use a Buffer instead.");return $o.isArrayBuffer(e)||$o.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):ei.from(e):e}function u(e,n,o){let s=e;if(e&&!o&&"object"==typeof e)if($o.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if($o.isArray(e)&&function(e){return $o.isArray(e)&&!e.some(ti)}(e)||($o.isFileList(e)||$o.endsWith(n,"[]"))&&(s=$o.toArray(e)))return n=ni(n),s.forEach(function(e,r){!$o.isUndefined(e)&&null!==e&&t.append(!0===a?ri([n],r,i):null===a?n:n+"[]",c(e))}),!1;return!!ti(e)||(t.append(ri(o,n,i),c(e)),!1)}const l=[],d=Object.assign(oi,{defaultVisitor:u,convertValue:c,isVisitable:ti});if(!$o.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!$o.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),$o.forEach(n,function(n,i){!0===(!($o.isUndefined(n)||null===n)&&o.call(t,n,$o.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),l.pop()}}(e),t};function ai(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function si(e,t){this._pairs=[],e&&ii(e,this,t)}const ci=si.prototype;ci.append=function(e,t){this._pairs.push([e,t])},ci.toString=function(e){const t=e?function(t){return e.call(this,t,ai)}:ai;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const ui=si;function li(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function di(e,t,n){if(!t)return e;const r=n&&n.encode||li,o=$o.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):$o.isURLSearchParams(t)?t.toString():new ui(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const fi=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){$o.forEach(this.handlers,function(t){null!==t&&e(t)})}},hi={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},pi={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ui,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},yi="undefined"!=typeof window&&"undefined"!=typeof document,wi="object"==typeof navigator&&navigator||void 0,mi=yi&&(!wi||["ReactNative","NativeScript","NS"].indexOf(wi.product)<0),Ei="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,gi=yi&&window.location.href||"http://localhost",Ai={...e,...pi};const bi=function(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=o>=e.length;if(i=!i&&$o.isArray(r)?r.length:i,s)return $o.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a;r[i]&&$o.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&$o.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r{t(function(e){return $o.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null};const Si={transitional:hi,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=$o.isObject(e);o&&$o.isHTMLForm(e)&&(e=new FormData(e));if($o.isFormData(e))return r?JSON.stringify(bi(e)):e;if($o.isArrayBuffer(e)||$o.isBuffer(e)||$o.isStream(e)||$o.isFile(e)||$o.isBlob(e)||$o.isReadableStream(e))return e;if($o.isArrayBufferView(e))return e.buffer;if($o.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ii(e,new Ai.classes.URLSearchParams,{visitor:function(e,t,n,r){return Ai.isNode&&$o.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=$o.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ii(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if($o.isString(e))try{return(t||JSON.parse)(e),$o.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Si.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if($o.isResponse(e)||$o.isReadableStream(e))return e;if(e&&$o.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw Qo.from(e,Qo.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ai.classes.FormData,Blob:Ai.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};$o.forEach(["delete","get","head","post","put","patch"],e=>{Si.headers[e]={}});const vi=Si,Ri=$o.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ti=Symbol("internals");function Oi(e){return e&&String(e).trim().toLowerCase()}function Ni(e){return!1===e||null==e?e:$o.isArray(e)?e.map(Ni):String(e)}function _i(e,t,n,r,o){return $o.isFunction(r)?r.call(this,t,n):(o&&(t=n),$o.isString(t)?$o.isString(r)?-1!==t.indexOf(r):$o.isRegExp(r)?r.test(t):void 0:void 0)}class Ii{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Oi(t);if(!o)throw new Error("header name must be a non-empty string");const i=$o.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Ni(e))}const i=(e,t)=>$o.forEach(e,(e,n)=>o(e,n,t));if($o.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if($o.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&Ri[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if($o.isObject(e)&&$o.isIterable(e)){let n,r,o={};for(const t of e){if(!$o.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?$o.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=Oi(e)){const n=$o.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if($o.isFunction(t))return t.call(this,e,n);if($o.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Oi(e)){const n=$o.findKey(this,e);return!(!n||void 0===this[n]||t&&!_i(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Oi(e)){const o=$o.findKey(n,e);!o||t&&!_i(0,n[o],o,t)||(delete n[o],r=!0)}}return $o.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!_i(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return $o.forEach(this,(r,o)=>{const i=$o.findKey(n,o);if(i)return t[i]=Ni(r),void delete t[o];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();a!==o&&delete t[o],t[a]=Ni(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return $o.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&$o.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Ti]=this[Ti]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Oi(e);t[r]||(!function(e,t){const n=$o.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return $o.isArray(e)?e.forEach(r):r(e),this}}Ii.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),$o.reduceDescriptors(Ii.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),$o.freezeMethods(Ii);const Ci=Ii;function ki(e,t){const n=this||vi,r=t||n,o=Ci.from(r.headers);let i=r.data;return $o.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Li(e){return!(!e||!e.__CANCEL__)}const Pi=class extends Qo{constructor(e,t,n){super(null==e?"canceled":e,Qo.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function Ui(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Qo("Request failed with status code "+n.status,[Qo.ERR_BAD_REQUEST,Qo.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const xi=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=r[a];o||(o=c),n[i]=s,r[i]=c;let l=a,d=0;for(;l!==i;)d+=n[l++],l%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-o;s>=i?a(e,t):(n=e,r||(r=setTimeout(()=>{r=null,a(n)},i-s)))},()=>n&&a(n)]},Bi=(e,t,n=3)=>{let r=0;const o=xi(50,250);return Di(n=>{const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=i-r,c=o(s);r=i;e({loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&i<=a?(a-i)/c:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},Mi=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Hi=e=>(...t)=>$o.asap(()=>e(...t)),Gi=Ai.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ai.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ai.origin),Ai.navigator&&/(msie|trident)/i.test(Ai.navigator.userAgent)):()=>!0,Fi=Ai.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];$o.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),$o.isString(r)&&s.push(`path=${r}`),$o.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),$o.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Ki(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const ji=e=>e instanceof Ci?{...e}:e;function Wi(e,t){t=t||{};const n={};function r(e,t,n,r){return $o.isPlainObject(e)&&$o.isPlainObject(t)?$o.merge.call({caseless:r},e,t):$o.isPlainObject(t)?$o.merge({},t):$o.isArray(t)?t.slice():t}function o(e,t,n,o){return $o.isUndefined(t)?$o.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!$o.isUndefined(t))return r(void 0,t)}function a(e,t){return $o.isUndefined(t)?$o.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(ji(e),ji(t),0,!0)};return $o.forEach(Object.keys({...e,...t}),function(r){const i=c[r]||o,a=i(e[r],t[r],r);$o.isUndefined(a)&&i!==s||(n[r]=a)}),n}const Xi=e=>{const t=Wi({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:s}=t;if(t.headers=a=Ci.from(a),t.url=di(Ki(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&a.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),$o.isFormData(n))if(Ai.hasStandardBrowserEnv||Ai.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if($o.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&a.set(e,n)})}if(Ai.hasStandardBrowserEnv&&(r&&$o.isFunction(r)&&(r=r(t)),r||!1!==r&&Gi(t.url))){const e=o&&i&&Fi.read(i);e&&a.set(o,e)}return t},Ji="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Xi(e);let o=r.data;const i=Ci.from(r.headers).normalize();let a,s,c,u,l,{responseType:d,onUploadProgress:f,onDownloadProgress:h}=r;function p(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(a),r.signal&&r.signal.removeEventListener("abort",a)}let y=new XMLHttpRequest;function w(){if(!y)return;const r=Ci.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders());Ui(function(e){t(e),p()},function(e){n(e),p()},{data:d&&"text"!==d&&"json"!==d?y.response:y.responseText,status:y.status,statusText:y.statusText,headers:r,config:e,request:y}),y=null}y.open(r.method.toUpperCase(),r.url,!0),y.timeout=r.timeout,"onloadend"in y?y.onloadend=w:y.onreadystatechange=function(){y&&4===y.readyState&&(0!==y.status||y.responseURL&&0===y.responseURL.indexOf("file:"))&&setTimeout(w)},y.onabort=function(){y&&(n(new Qo("Request aborted",Qo.ECONNABORTED,e,y)),y=null)},y.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new Qo(r,Qo.ERR_NETWORK,e,y);o.event=t||null,n(o),y=null},y.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||hi;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Qo(t,o.clarifyTimeoutError?Qo.ETIMEDOUT:Qo.ECONNABORTED,e,y)),y=null},void 0===o&&i.setContentType(null),"setRequestHeader"in y&&$o.forEach(i.toJSON(),function(e,t){y.setRequestHeader(t,e)}),$o.isUndefined(r.withCredentials)||(y.withCredentials=!!r.withCredentials),d&&"json"!==d&&(y.responseType=r.responseType),h&&([c,l]=Bi(h,!0),y.addEventListener("progress",c)),f&&y.upload&&([s,u]=Bi(f),y.upload.addEventListener("progress",s),y.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{y&&(n(!t||t.type?new Pi(null,e,y):t),y.abort(),y=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const m=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);m&&-1===Ai.protocols.indexOf(m)?n(new Qo("Unsupported protocol "+m+":",Qo.ERR_BAD_REQUEST,e)):y.send(o||null)})},Vi=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,a();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Qo?t:new Pi(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new Qo(`timeout of ${t}ms exceeded`,Qo.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:s}=r;return s.unsubscribe=()=>$o.asap(a),s}},Yi=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of zi(e))yield*Yi(n,t)}(e,t);let i,a=0,s=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return s(),void e.close();let i=r.byteLength;if(n){let e=a+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel:e=>(s(e),o.return())},{highWaterMark:2})},{isFunction:$i}=$o,Zi=(({Request:e,Response:t})=>({Request:e,Response:t}))($o.global),{ReadableStream:Qi,TextEncoder:ea}=$o.global,ta=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},na=e=>{e=$o.merge.call({skipUndefined:!0},Zi,e);const{fetch:t,Request:n,Response:r}=e,o=t?$i(t):"function"==typeof fetch,i=$i(n),a=$i(r);if(!o)return!1;const s=o&&$i(Qi),c=o&&("function"==typeof ea?(u=new ea,e=>u.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var u;const l=i&&s&&ta(()=>{let e=!1;const t=new n(Ai.origin,{body:new Qi,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=a&&s&&ta(()=>$o.isReadableStream(new r("").body)),f={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Qo(`Response type '${e}' is not supported`,Qo.ERR_NOT_SUPPORT,n)})});const h=async(e,t)=>{const r=$o.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if($o.isBlob(e))return e.size;if($o.isSpecCompliantForm(e)){const t=new n(Ai.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return $o.isArrayBufferView(e)||$o.isArrayBuffer(e)?e.byteLength:($o.isURLSearchParams(e)&&(e+=""),$o.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:a,data:s,signal:c,cancelToken:u,timeout:p,onDownloadProgress:y,onUploadProgress:w,responseType:m,headers:E,withCredentials:g="same-origin",fetchOptions:A}=Xi(e),b=t||fetch;m=m?(m+"").toLowerCase():"text";let S=Vi([c,u&&u.toAbortSignal()],p),v=null;const R=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let T;try{if(w&&l&&"get"!==a&&"head"!==a&&0!==(T=await h(E,s))){let e,t=new n(o,{method:"POST",body:s,duplex:"half"});if($o.isFormData(s)&&(e=t.headers.get("content-type"))&&E.setContentType(e),t.body){const[e,n]=Mi(T,Bi(Hi(w)));s=qi(t.body,65536,e,n)}}$o.isString(g)||(g=g?"include":"omit");const t=i&&"credentials"in n.prototype,c={...A,signal:S,method:a.toUpperCase(),headers:E.normalize().toJSON(),body:s,duplex:"half",credentials:t?g:void 0};v=i&&new n(o,c);let u=await(i?b(v,A):b(o,c));const p=d&&("stream"===m||"response"===m);if(d&&(y||p&&R)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=u[t]});const t=$o.toFiniteNumber(u.headers.get("content-length")),[n,o]=y&&Mi(t,Bi(Hi(y),!0))||[];u=new r(qi(u.body,65536,n,()=>{o&&o(),R&&R()}),e)}m=m||"text";let O=await f[$o.findKey(f,m)||"text"](u,e);return!p&&R&&R(),await new Promise((t,n)=>{Ui(t,n,{data:O,headers:Ci.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:v})})}catch(t){if(R&&R(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Qo("Network Error",Qo.ERR_NETWORK,e,v),{cause:t.cause||t});throw Qo.from(t,t&&t.code,e,v)}}},ra=new Map,oa=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let a,s,c=i.length,u=ra;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:na(t)),u=s;return s},ia=(oa(),{http:null,xhr:Ji,fetch:{get:oa}});$o.forEach(ia,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const aa=e=>`- ${e}`,sa=e=>$o.isFunction(e)||null===e||!1===e;const ca={getAdapter:function(e,t){e=$o.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let a=0;a`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(aa).join("\n"):" "+aa(e[0]):"as no adapter specified";throw new Qo("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:ia};function ua(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Pi(null,e)}function la(e){ua(e),e.headers=Ci.from(e.headers),e.data=ki.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ca.getAdapter(e.adapter||vi.adapter,e)(e).then(function(t){return ua(e),t.data=ki.call(e,e.transformResponse,t),t.headers=Ci.from(t.headers),t},function(t){return Li(t)||(ua(e),t&&t.response&&(t.response.data=ki.call(e,e.transformResponse,t.response),t.response.headers=Ci.from(t.response.headers))),Promise.reject(t)})}const da="1.13.4",fa={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{fa[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const ha={};fa.transitional=function(e,t,n){function r(e,t){return"[Axios v"+da+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new Qo(r(o," has been removed"+(t?" in "+t:"")),Qo.ERR_DEPRECATED);return t&&!ha[o]&&(ha[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},fa.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const pa={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Qo("options must be an object",Qo.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=t[i];if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new Qo("option "+i+" must be "+n,Qo.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Qo("Unknown option "+i,Qo.ERR_BAD_OPTION)}},validators:fa},ya=pa.validators;class wa{constructor(e){this.defaults=e||{},this.interceptors={request:new fi,response:new fi}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Wi(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&pa.assertOptions(n,{silentJSONParsing:ya.transitional(ya.boolean),forcedJSONParsing:ya.transitional(ya.boolean),clarifyTimeoutError:ya.transitional(ya.boolean)},!1),null!=r&&($o.isFunction(r)?t.paramsSerializer={serialize:r}:pa.assertOptions(r,{encode:ya.function,serialize:ya.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),pa.assertOptions(t,{baseUrl:ya.spelling("baseURL"),withXsrfToken:ya.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&$o.merge(o.common,o[t.method]);o&&$o.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=Ci.concat(i,o);const a=[];let s=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,a.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!s){const e=[la.bind(this),void 0];for(e.unshift(...a),e.push(...c),l=e.length,u=Promise.resolve(t);d{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new Pi(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;const t=new Ea(function(t){e=t});return{token:t,cancel:e}}}const ga=Ea;const Aa={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Aa).forEach(([e,t])=>{Aa[t]=e});const ba=Aa;const Sa=function e(t){const n=new ma(t),r=ao(ma.prototype.request,n);return $o.extend(r,ma.prototype,n,{allOwnKeys:!0}),$o.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Wi(t,n))},r}(vi);Sa.Axios=ma,Sa.CanceledError=Pi,Sa.CancelToken=ga,Sa.isCancel=Li,Sa.VERSION=da,Sa.toFormData=ii,Sa.AxiosError=Qo,Sa.Cancel=Sa.CanceledError,Sa.all=function(e){return Promise.all(e)},Sa.spread=function(e){return function(t){return e.apply(null,t)}},Sa.isAxiosError=function(e){return $o.isObject(e)&&!0===e.isAxiosError},Sa.mergeConfig=Wi,Sa.AxiosHeaders=Ci,Sa.formToJSON=e=>bi($o.isHTMLForm(e)?new FormData(e):e),Sa.getAdapter=ca.getAdapter,Sa.HttpStatusCode=ba,Sa.default=Sa;const va=Sa,Ra="auth0_sub",Ta="mng-entitlements",Oa="__MNG_Session",Na="regwallUserIsSubscribed";var _a,Ia;function Ca(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ka(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=La().hostname;if(e&&"string"==typeof e&&e.length>0&&(t=e,e.includes("vipdev.lndo.site")))return"".concat(e.split(".")[0],".com");var n=t.split(".");return"".concat(n[n.length-2],".").concat(n[n.length-1])},xa=function(){var e=Ua();return".".concat(e)},Da=function(e,t,n){var r="".concat(e,"=").concat(t,";");void 0!==n?(s("Setting cookie with options: ",n),Object.entries(n).forEach(function(e){var t=f(e,2),n=t[0],o=t[1];if("expires"===n){var i=new Date;i.setTime(i.getTime()+24*o*60*60*1e3),r+="expires=".concat(i.toUTCString(),";")}else r+="".concat(n,"=").concat(o,";")})):r+="path=/;",document.cookie=r},Ba=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r="".concat(e,"= ;expires= Thu, 01 Jan 1970 00:00:00 GMT;"),o=Ua(),i=[o,"www".concat(o),".www".concat(o)];n&&i.push(n),Object.entries(t).forEach(function(e){var t=f(e,2),n=t[0],o=t[1];r+="".concat(n,"=").concat(o,";")}),0===Object.keys(t).length&&(r+="path=/;"),document.cookie=r,i.forEach(function(e){document.cookie=r.concat("domain=",e,";")})},Ma=function(){return La().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},Ha=function(e){return function(e,t){if("string"!=typeof e)throw new h("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new h(`Invalid token specified: missing part #${n+1}`);let o;try{o=p(r)}catch(e){throw new h(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(o)}catch(e){throw new h(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(e)},Ga=function(){return"complete"===document.readyState},Fa=function(){return new Promise(function(e){if(("interactive"===document.readyState||Ga())&&window.dataLayer)s("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{s("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var t=setInterval(r(o.mark(function n(){return o.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:window.dataLayer&&window.dataLayer.length>2&&(clearInterval(t),e(!0));case 1:case"end":return n.stop()}},n)})),50)}})},Ka=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Fa();case 1:return s("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",s("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),r=function(e){return s("Utils dataLayerLoop: look for this element ",e),e[t]?(s("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(s("Utils dataLayerLoop: dataLayer search ",!1),!1)},i=window.dataLayer.some(r),e.abrupt("return",i?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),ja=function(){var e=r(o.mark(function e(){var t,n,r=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"Page Type",e.next=1,Ka(t);case 1:return n=e.sent,s("utils | pageType: page type is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Wa=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(s("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(s("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};s("utils | Event: authentication ready: ",r),e(r)}catch(e){s(e),t(e)}},!1))})},Xa=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){return a.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(s("Entitlements already present:",window.MNGAuthentication.entitlementsReady),void e(window.MNGAuthentication.entitlementsReady)):void window.addEventListener("entitlementsReady",function(n){try{var r=n.detail||{};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=r,s("Received entitlementsReady event:",r),e(r)}catch(e){c("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(s("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Ja=function(){s("Clearing entitlements...");try{Ba(Ta,{path:"/"})}catch(e){s("Failed to delete legacy cookie: ",e)}try{Ba(Ta,{path:"/",domain:Ua(),expires:365,secure:!0})}catch(e){s("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(Oa)}catch(e){s("Failed to remove local storage: ",e)}},Va=function(e){s("starting simpleEmailValidation");if(!e)return{valid:!1,message:"Please enter an email."};if(!/^(([^<>()[\]\\.,;:\s@']+(\.[^<>()[\]\\.,;:\s@']+)*)|('.+'))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i.test(e))return{valid:!1,message:"Please enter a valid email."};var t=e.match(/\.([^.\n\s]*)$/)[1].toUpperCase(),n=["AAA","AARP","ABARTH","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALFAROMEO","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOKINGCHANNEL","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIAT","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOODNETWORK","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HGTV","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELES","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LANCIA","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINDE","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOFT","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MACYS","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MASERATI","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MUTUAL","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTHWESTERNMUTUAL","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PASSAGENS","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIFFANY","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELCHANNEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","VUELOS","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"].includes(t);return s("simpleEmailValidation: ","TLD search ".concat(n)),!1===n?{valid:!1,message:"Please enter a valid email domain."}:-1===["zzz.pl"].findIndex(function(t){return t===e.split("@")[1]})?{valid:!0,message:"Valid"}:{valid:!1,message:"Please enter a valid email."}};window.simpleEmailValidation=Va;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Ya=function(e){a.A.datadogEnabled&&window.DD_RUM.addTiming(e)},za=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(t,n){var i={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},a=function(){var a=r(o.mark(function r(){var a,c,u,l,d,f,h,p,y,w,m;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,"1"!==(null===(a=window.sophi_config)||void 0===a?void 0:a.enableSophiSSPW)){r.next=1;break}if(!document.getElementById("server-paywall")){r.next=1;break}return i.sspw=!0,r.abrupt("return",t({paywall:!0,details:ka({},i)}));case 1:return r.next=2,ja();case 2:return u=r.sent,r.next=3,Ka("Paywall_Level");case 3:if(l=r.sent,"article"===u&&"free"!==l){r.next=4;break}return r.abrupt("return",t({paywall:!1,details:"article"!==u?"Page type is not an article":"Free article"}));case 4:return r.next=5,Xa();case 5:if(!(d=r.sent)||!d.isEntitled){r.next=6;break}return r.abrupt("return",t({paywall:!1,details:"Entitled User"}));case 6:if("premium"!==l){r.next=7;break}return r.abrupt("return",t({paywall:!0,details:"Premium article"}));case 7:if(f=null===(c=window.ConnextUtils)||void 0===c?void 0:c.runningSophi,s("checkPaywallStatus - Sophi is running: ",f),!f){r.next=8;break}window.ConnextUtils.connextAlreadyRan&&window.sophiWallConfig&&!window.sophiWallConfig.error&&"paywall"===window.sophiWallConfig.wallType?(i.sophiClient=!0,i.engageStatus=!0,i.engagePaywall=!0):window.addEventListener("onPaywallShown",function(){return"paywall"===window.sophiWallConfig.wallType&&(i.sophiClient=!0),t({paywall:!0,details:ka({},i)})},{once:!0}),r.next=12;break;case 8:if(f){r.next=12;break}return h=window.ConnextUtils.connextReady("onPaywallShown",!1),p=new Promise(function(t,n){return setTimeout(function(){return n(new Error("No Engage paywall within 10 seconds, resolving as no paywall."))},e)}),r.prev=9,r.next=10,Promise.race([h,p]);case 10:!0===(y=r.sent)?(i.engagePaywall=!0,i.engageStatus="Engage paywall detected"):(i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(y)),r.next=12;break;case 11:r.prev=11,w=r.catch(9),i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(w);case 12:return r.abrupt("return",t({paywall:Object.values(i).some(function(e){return e}),details:ka({},i)}));case 13:r.prev=13,m=r.catch(0),n(m);case 14:case"end":return r.stop()}},r,null,[[0,13],[9,11]])}));return function(){return a.apply(this,arguments)}}();a()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=za);var qa,$a,Za=function(){try{var e=localStorage.getItem(Oa);return"string"==typeof e?e:"{}"}catch(e){s("Unable to get session from local storage: ",e)}return"{}"},Qa=function(e){try{s("Setting local storage session",e),localStorage.setItem(Oa,e)}catch(e){s("Unable to save session from local storage: ",e)}},es=function(e){try{Da(Ta,e,{path:"/",domain:xa(),expires:365,secure:!0})}catch(e){s("Unable to save session to cookie storage: ",e)}},ts=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,f,h,p,y,w,m,E,g,A,b;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.A.sessionServer,n="".concat(t,"/api/session"),s("Checking server session: ",n),e.next=1,va.get(n,{withCredentials:!0});case 1:if(!(r=e.sent).data){e.next=2;break}return f=r.data.entitlementTokenDecoded,h=r.data,p=h.accessToken,y=h.idToken,w=h.entitlementToken,m=null!==(i=null==f?void 0:f.entitlement_expiry)&&void 0!==i?i:null,E=null!==(c=null==f?void 0:f.entitlement_source)&&void 0!==c?c:null,g=null!==(u=null==f?void 0:f.entitlement_entitled)&&void 0!==u?u:null,A=null!==(l=null==f?void 0:f.entitlement_extras_adfree)&&void 0!==l?l:null,b=null!==(d=null==f?void 0:f.entitlement_level)&&void 0!==d?d:null,Qa(JSON.stringify({accessToken:p,idToken:y,entitlementToken:w,expiration:m,entitlementSource:E,isEntitled:g,adFree:A,entitlementLevel:b})),""!==w&&"string"==typeof w&&es(w),e.abrupt("return",{accessToken:p,idToken:y,entitlementToken:w,expiration:m,entitlementSource:E,isEntitled:g,adFree:A,entitlementLevel:b});case 2:return e.abrupt("return",{accessToken:null,idToken:null,entitlementToken:null,expiration:null,entitlementSource:null,isEntitled:null,adFree:null,entitlementLevel:null});case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),ns=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=a.A.sessionServer,r="".concat(n,"/api/session"),s("Updating server session: ",r),e.next=1,va.post(r,t,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,i=e.catch(0),s("Failed to update session server: ",i);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),rs=function(){var e=r(o.mark(function e(){var t,n,r,i,a,c,u,l,d,f,h,p,y,w,m,E,g,A,b,S,v,R,T,O,N,_,I,C;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(s("Inside getSession"),e.prev=1,d=Za(),s("Session: __MNG_Session = ",d),f=JSON.parse(d),h=f.accessToken,p=f.idToken,y=f.entitlementToken,w=f.expiration,m=f.entitlementSource,E=f.isEntitled,g=f.adFree,A=f.entitlementLevel,n=h,i=w,a=m,c=E,u=g,l=A,s("Session: check both tokens: ",t=p,r=y),void 0!==p&&void 0!==y&&null!==p&&null!==y){e.next=3;break}return s("Session: missing id or entitlements, try session server"),e.next=2,ts();case 2:b=e.sent,S=b.accessToken,v=b.idToken,R=b.entitlementToken,T=b.expiration,O=b.entitlementSource,N=b.isEntitled,_=b.adFree,I=b.entitlementLevel,n=S,t=v,r=R,i=T,a=O,c=N,u=_,l=I;case 3:e.next=5;break;case 4:e.prev=4,C=e.catch(1),s("Failed to get session: ",C);case 5:return s("Returning session: ",t,n,r),e.abrupt("return",{accessToken:n,idToken:t,entitlementToken:r,expiration:i,entitlementSource:a,isEntitled:c,adFree:u,entitlementLevel:l});case 6:case"end":return e.stop()}},e,null,[[1,4]])}));return function(){return e.apply(this,arguments)}}(),os=function(){var e=r(o.mark(function e(t){var n,r,i,a,c,u,l,d,f,h,p,y,w,m,E,g,A,b,S,v,R,T,O,N,_,I,C,k,L;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=Za(),r=JSON.parse(n),i=r.accessToken,a=void 0===i?null:i,c=r.idToken,u=void 0===c?null:c,l=r.entitlementToken,d=void 0===l?null:l,f=r.expiration,h=void 0===f?null:f,p=r.entitlementSource,y=void 0===p?null:p,w=r.isEntitled,m=void 0===w?null:w,E=r.adFree,g=void 0===E?null:E,A=r.entitlementLevel,b=void 0===A?null:A,S=t.accessToken,v=t.idToken,R=t.entitlementToken,T=t.expiration,O=t.entitlementSource,N=t.isEntitled,_=t.adFree,I=t.entitlementLevel,C={accessToken:null==S?a:S,idToken:null==v?u:v,entitlementToken:null==R?d:R,expiration:null==T?h:T,entitlementSource:null==O?y:O,isEntitled:null==N?m:N,adFree:null==_?g:_,entitlementLevel:null==I?b:I},s("Current session data: ",r),s("New session data: ",t),s("Updated session data:",C),k=JSON.stringify(C),Qa(k),""!==C.entitlementToken&&"string"==typeof C.entitlementToken&&es(C.entitlementToken),n===k){e.next=1;break}return e.next=1,ns(C);case 1:e.next=3;break;case 2:e.prev=2,L=e.catch(0),s("Unable to save session: ",L);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}();window.addEventListener("mng-all-islands-ready",function(e){qa||(qa=e,$a&&(s("utils | Dispatching mng-entitlement-check-complete event (islands were not ready): ",$a),window.dispatchEvent($a)))});var is=function(){var e=window.localStorage.getItem(Oa);return JSON.parse(e)},as=function(){var e=r(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!window.authentication_config.sessionManagementEnabled){e.next=2;break}return e.next=1,rs();case 1:return t=e.sent,e.abrupt("return",t);case 2:return n=is(),e.abrupt("return",n);case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),ss=function(e){Da(Ta,e,{path:"/",domain:xa(),expires:365,secure:!0})},cs=function(){var e=r(o.mark(function e(t){var n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,ss(t),s("About to decode token before saving: ",t),n=Ha(t),!window.authentication_config.sessionManagementEnabled){e.next=2;break}return e.next=1,os({entitlementToken:t,expiration:n.entitlement_expiry,entitlementSource:n.entitlement_source,isEntitled:n.entitlement_entitled,adFree:n.entitlement_extras_adfree||!1,entitlementLevel:n.entitlement_level});case 1:e.next=3;break;case 2:window.localStorage.setItem(Oa,JSON.stringify({entitlementToken:t,expiration:n.entitlement_expiry,entitlementSource:n.entitlement_source,isEntitled:n.entitlement_entitled,adFree:n.entitlement_extras_adfree||!1,entitlementLevel:n.entitlement_level}));case 3:e.next=5;break;case 4:e.prev=4,r=e.catch(0),s("Entitlements: Failed to save token: ",r);case 5:case"end":return e.stop()}},e,null,[[0,4]])}));return function(t){return e.apply(this,arguments)}}(),us=function(){var e=r(o.mark(function e(t){var n,r,i,u,l,d,f,h,p,y,w,m,E,g;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!1,!window.authentication_config.sessionManagementEnabled){e.next=2;break}return e.next=1,rs();case 1:"string"==typeof(r=e.sent).idToken&&""!==r.idToken&&(i=Ha(r.idToken),n=void 0!==i&&i.email_verified),e.next=4;break;case 2:return e.next=3,Wa();case 3:u=e.sent,(l=u.idToken)&&""!==l&&(n=Ha(l).email_verified);case 4:if(s("Entitlements: refresh JWT start..."),t){e.next=5;break}return e.abrupt("return",new Error("No token to refresh"));case 5:return s("Entitlements refresh: entitlement token: ",t),s("Entitlements refresh: auth0 verified: ",n),d={jwt:t,verified:n},f="".concat(a.A.entitlementsEndpoint,"session/refresh"),e.prev=6,e.next=7,$.ajax({type:"POST",url:f,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":a.A.entitlementsApiKey},data:JSON.stringify(d)});case 7:if("boolean"!=typeof(h=e.sent).success){e.next=10;break}if(!h.success){e.next=8;break}p=null===(y=h.data)||void 0===y?void 0:y.jwt,e.next=9;break;case 8:throw w=h.error||{},m=w.message||w.error||"Entitlements API returned an unknown error",new Error("API error: ".concat(m));case 9:e.next=11;break;case 10:p=h.jwt;case 11:return s("Entitlements: Request successful: ",p),e.next=12,cs(p);case 12:return e.abrupt("return",p);case 13:if(e.prev=13,E=e.catch(6),c("Entitlements: Create Token Failure: ",E),Ja(),!window.authentication_config.sessionManagementEnabled){e.next=17;break}return e.prev=14,e.next=15,os({entitlementToken:null});case 15:e.next=17;break;case 16:e.prev=16,g=e.catch(14),c("Entitlements: Save Session Failure during error handling: ",g);case 17:throw new Error("Entitlements Refresh failure");case 18:case"end":return e.stop()}},e,null,[[6,13],[14,16]])}));return function(t){return e.apply(this,arguments)}}(),ls=function(){var e=r(o.mark(function e(t){var n,r,u,l,d,f,h,p,y,w;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(s("Entitlements: create token start..."),s("Entitlements: createToken payload with ",t),"object"===i(t)||"string"==typeof t.sub){e.next=1;break}throw new Error("No user info to create token");case 1:if(n=window.location.hostname,r=Ua(n),t.sub&&(u=t.sub),t.idToken&&(l=t.idToken),l||u){e.next=2;break}throw new Error("No idToken or uuid provided.");case 2:return d={publication:r.replace("vipdev.lndo.site","com"),requestSource:"website"},l?d.idToken=l:u&&(d.uuid=u),f="".concat(a.A.entitlementsEndpoint,"session/create"),s("Entitlements: create payload",d),e.prev=3,e.next=4,$.ajax({type:"POST",url:f,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":a.A.entitlementsApiKey},data:JSON.stringify(d)});case 4:if("boolean"!=typeof(h=e.sent).success){e.next=6;break}if(h.success){e.next=5;break}return e.abrupt("return",new Error("Entitlements | API returned no JWT"));case 5:p=h.data.jwt,s("Entitlements: Token Created: ",p),e.next=7;break;case 6:p=h.jwt;case 7:return e.next=8,cs(p);case 8:return e.abrupt("return",p);case 9:if(e.prev=9,y=e.catch(3),s("Entitlements: Create Token Failure: ",y),Ja(),!window.authentication_config.sessionManagementEnabled){e.next=13;break}return e.prev=10,e.next=11,os({entitlementToken:null});case 11:e.next=13;break;case 12:e.prev=12,w=e.catch(10),c("Entitlements: Save Session Failure during error handling: ",w);case 13:throw new Error("Entitlements Refresh failure");case 14:case"end":return e.stop()}},e,null,[[3,9],[10,12]])}));return function(t){return e.apply(this,arguments)}}(),ds=function(){var e=r(o.mark(function e(){var t,n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,as();case 1:if((t=e.sent)&&t.entitlementToken){e.next=2;break}return e.abrupt("return",!1);case 2:if(!((n=Date.now()/1e3) ").concat(t.expiration)),e.abrupt("return",us(t.entitlementToken));case 4:return e.prev=4,r=e.catch(0),s("Entitlements: Local Storage: Error processing token: ",r.message),e.abrupt("return",!1);case 5:case"end":return e.stop()}},e,null,[[0,4]])}));return function(){return e.apply(this,arguments)}}(),fs=function(){var e=r(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,t=Pa(Ta)){e.next=1;break}return e.abrupt("return",!1);case 1:return s("checkCookiesForToken, Refreshing token, ".concat(t)),e.next=2,us(t);case 2:return e.abrupt("return",e.sent);case 3:return e.prev=3,n=e.catch(0),s("Entitlements: Cookie: Error processing token: ",n.message),e.abrupt("return",!1);case 4:case"end":return e.stop()}},e,null,[[0,3]])}));return function(){return e.apply(this,arguments)}}(),hs=function(e){s("Attempting to broadcast entitlements ready...",e);try{var t={token:e};if(e){s("About to decode token before broadcasting: ",e);var n=Ha(e);!function(e){var t=Pa("mng-jwt-decoded");t&&t===e||Da("mng-jwt-decoded",JSON.stringify(e),{path:"/",domain:xa(),expires:365,secure:!0})}(n),t=Object.assign(t,{isEntitled:n.entitlement_entitled,adfree:n.entitlement_extras_adfree||!1,subscriptionLevel:n.entitlement_level})}var r=new CustomEvent("entitlementsReady",{detail:t});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=t,s("Dispatching entitlementsReady Event: ",r),window.dispatchEvent(r),s("Dispatched entitlementsReady event"),Ya("entitlementsReady"),$a=new CustomEvent("mng-entitlement-check-complete",{detail:t}),qa?(s("utils | Dispatching mng-entitlement-check-complete event (islands were ready): ",r),window.dispatchEvent($a)):s("Islands not ready")}catch(e){var o={token:""};o=Object.assign(o,{isEntitled:"unknown",adfree:"unknown",subscriptionLevel:"unknown"});var i=new CustomEvent("entitlementsReady",{detail:o});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=o,s("Dispatching entitlementsReady EMPTY Event: ",i),window.dispatchEvent(i),s("Dispatched entitlementsReady EMPTY event"),s("Error: ",e)}},ps=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,ls({idToken:t});case 1:e.next=3;break;case 2:e.prev=2,n=e.catch(0),s("Entitlements error during oidc login callback: ",n);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),ys=function(){void 0!==window.MNGAuthentication&&Array.isArray(window.MNGAuthentication.oidcLoginCallbacks)&&window.MNGAuthentication.oidcLoginCallbacks.push(ps)},ws=function(e){var t=e.searchParams.get("entitlement_jwt");s("Webview JWT param provided: ",t),ss(t);var n=Ha(t);window.localStorage.setItem(Oa,JSON.stringify({entitlementToken:t,expiration:n.entitlement_expiry,entitlementSource:n.entitlement_source,isEntitled:n.entitlement_entitled,adFree:n.entitlement_extras_adfree||!1,entitlementLevel:n.entitlement_level}))},ms=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,f,h,p,y,w,m,E;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,t=window.localStorage.getItem(Na),n=Pa(Ra),r=La(),i=Ma(),!(c=Pa("clearEntCache"))&&!r.searchParams.has("newUser")){e.next=6;break}return u="".concat(a.A.entitlementsEndpoint,"session/create"),e.next=1,Wa();case 1:return l=e.sent,d={uuid:l.claims.auth0Id,publication:i},e.prev=2,e.next=3,$.ajax({type:"DELETE",url:u,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":a.A.entitlementsApiKey},data:JSON.stringify(d)});case 3:e.sent&&(s("loggedOutNewSubscriberActions","Entitlements: Cache cleared"),Ba("clearEntCache")),e.next=5;break;case 4:e.prev=4,m=e.catch(2),s("loggedOutNewSubscriberActions","Entitlements: Cache clear Failure - ".concat(m.message));case 5:e.next=7;break;case 6:s("loggedOutNewSubscriberActions","There is no clearEntCache cookie");case 7:if(s("loggedOutNewSubscriberActions","Checking if this is a new regwall subscriber"),!(c||"false"===t&&r.searchParams.has("newUser")&&n)){e.next=10;break}return f=!1,h={sub:n,email_verified:!0},e.next=8,ls(h);case 8:if((p=e.sent)&&""!==p&&(y=Ha(p),w=y.entitlement_entitled,f=w),s("loggedOutNewSubscriberActions","New regwall user is entitled: ".concat(f)),!f){e.next=9;break}return window.localStorage.setItem(Na,"true"),window.ConnextUtils.rerunConnextEntitlements(),e.abrupt("return",!0);case 9:case 10:return e.abrupt("return",!1);case 11:return e.prev=11,E=e.catch(0),s("loggedOutNewSubscriberActions error",E),e.abrupt("return",!1);case 12:case"end":return e.stop()}},e,null,[[0,11],[2,4]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.isUserAdFree=function(){var e,t=JSON.parse(window.localStorage.getItem(Oa));return null!=t?(s("Ad Free Check: : ",t.adFree),(t.idToken||null!==(e=window.MNGAuthentication)&&void 0!==e&&null!==(e=e.authenticationReady)&&void 0!==e&&e.idToken)&&t.adFree||a.A.isAdfreeArticle):a.A.isAdfreeArticle},window.MNGAuthentication.isUserSubscriber=function(){var e=JSON.parse(window.localStorage.getItem(Oa));return null!=e&&(s("Subscriber Check: : ",e.isEntitled),e.isEntitled)};var Es=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,f,h,p,y,w,m,E,g,A,b,S,v;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.A.entitlementsEnabled){e.next=39;break}return e.next=1,ms();case 1:if(!e.sent){e.next=2;break}return e.abrupt("return",hs(!1));case 2:return t=window.location,n=new URL(t.href),e.next=3,Wa();case 3:if(r=e.sent,i=r.idToken,c=r.accessToken,u=r.isAuthenticated,l=r.claims,ys(),e.prev=4,!n.searchParams.has("newUser")){e.next=8;break}if("string"!=typeof i||""===i){e.next=7;break}return e.next=5,ls({idToken:i});case 5:if(!(d=e.sent)){e.next=6;break}return s("Entitlements Init: Created new token for new subscriber"),e.abrupt("return",hs(d));case 6:e.next=8;break;case 7:s("New subscription, no idToken.");case 8:e.next=10;break;case 9:e.prev=9,e.catch(4),s("Not a new subscriber.");case 10:try{n.searchParams.has("entitlement_jwt")&&ws(n)}catch(e){s("Error during webview JWT retrieval: ",e)}return e.prev=11,e.next=12,ds();case 12:if(!((f=e.sent)instanceof Error)){e.next=13;break}throw f;case 13:f&&(d=f,s("Entitlements Init: Local Storage Token exists")),e.next=15;break;case 14:e.prev=14,g=e.catch(11),s("Error during Local Storage Token check: ",g);case 15:if(e.prev=15,d){e.next=18;break}return e.next=16,fs();case 16:if(!((h=e.sent)instanceof Error)){e.next=17;break}throw h;case 17:h&&(d=h,s("Entitlements Init: Cookie Token exists"));case 18:e.next=20;break;case 19:e.prev=19,A=e.catch(15),s("Error during Cookie Token check: ",A);case 20:if(!u&&d&&(s("Entitled-only flow: User is not authenticated but entitlement token exists."),Ha(d).entitlement_entitled?(s("PageSuite flow: User is not authenticated but is subscriber. Access token is ".concat(c)),c?MNGAuthentication.login():s("PageSuite flow: No Access token.")):s("Entitled-only flow: User is not entitled.")),u){e.next=21;break}return s("User is not logged in, skipping entitlement flow."),e.abrupt("return",hs(!1));case 21:if(!a.A.bcLowaSegements||u!==a.A.USER_IS_LOWA||d){e.next=25;break}return e.prev=22,s("About to check entitlements based on BC"),p={sub:l.sub},e.next=23,ls(p);case 23:d=e.sent,!window.authentication_config.sessionManagementEnabled&&a.A.serverEntitlements&&d&&(s("Entitlements fetched, about to reload to refresh entitlement cookie for server."),window.location.reload()),e.next=25;break;case 24:e.prev=24,b=e.catch(22),s("BC sub segment check failed: ",b);case 25:if(e.prev=25,!d){e.next=31;break}if(!a.A.linaCheckOnArticles){e.next=30;break}if(y=Ha(d),w=y.entitlement_entitled,m=y.iat,s("LINA check: isEntitled: ".concat(w,", token created at: ").concat(m)),!(a.A.linaCheckOnArticles&&!w&&Date.now()/1e3-new Date(m)>45)){e.next=30;break}if(s("Checking entitlements again for LINA user."),""===i){e.next=29;break}return e.next=26,ls({idToken:i});case 26:if(!(E=e.sent)){e.next=28;break}return s("Entitlements Init: Created new token for LINA user"),e.next=27,ja();case 27:return"article"===e.sent&&window.ConnextUtils.rerunConnextEntitlements(),e.abrupt("return",hs(E));case 28:e.next=30;break;case 29:s("LINA check, no idToken.");case 30:return e.abrupt("return",hs(d));case 31:e.next=33;break;case 32:e.prev=32,S=e.catch(25),s("LINA check error: ",S);case 33:if(e.prev=33,"string"!=typeof i||""===i){e.next=36;break}return e.next=34,ls({idToken:i});case 34:if(!(d=e.sent)){e.next=35;break}return s("Entitlements Init: Created new token"),e.abrupt("return",hs(d));case 35:e.next=37;break;case 36:s("No OIDC ID Token. Not creating a new entitlements token.");case 37:e.next=39;break;case 38:e.prev=38,v=e.catch(33),s("Unable to create token during initialize: ",v);case 39:return e.abrupt("return",hs(!1));case 40:case"end":return e.stop()}},e,null,[[4,9],[11,14],[15,19],[22,24],[25,32],[33,38]])}));return function(){return e.apply(this,arguments)}}();const gs={init:Es};(function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,gs.init();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}})()()})()})(); //# sourceMappingURL=mng-digisubs.entitlements.bundle.js.map;