@asgardeo/browser 0.1.21 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1947,6 +1947,7 @@ __export(index_exports, {
1947
1947
  createMediaQueryListener: () => createMediaQueryListener,
1948
1948
  detectThemeMode: () => detectThemeMode,
1949
1949
  getActiveTheme: () => getActiveTheme_default,
1950
+ handleWebAuthnAuthentication: () => handleWebAuthnAuthentication_default,
1950
1951
  hasAuthParamsInUrl: () => hasAuthParamsInUrl_default,
1951
1952
  http: () => http_default,
1952
1953
  navigate: () => navigate_default,
@@ -1968,7 +1969,7 @@ function inlineWorker(scriptText) {
1968
1969
 
1969
1970
  // src/web.worker.ts
1970
1971
  function Worker2() {
1971
- return inlineWorker('(()=>{var yo=Object.create;var nt=Object.defineProperty;var Jr=Object.getOwnPropertyDescriptor;var So=Object.getOwnPropertyNames;var Eo=Object.getPrototypeOf,wo=Object.prototype.hasOwnProperty;var Vr=r=>{throw TypeError(r)};var bo=(r,e,t)=>e in r?nt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var E=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var To=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of So(e))!wo.call(r,i)&&i!==t&&nt(r,i,{get:()=>e[i],enumerable:!(n=Jr(e,i))||n.enumerable});return r};var ve=(r,e,t)=>(t=r!=null?yo(Eo(r)):{},To(e||!r||!r.__esModule?nt(t,"default",{value:r,enumerable:!0}):t,r));var Gr=(r,e,t,n)=>{for(var i=n>1?void 0:n?Jr(e,t):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&nt(e,t,i),i};var y=(r,e,t)=>bo(r,typeof e!="symbol"?e+"":e,t),Xr=(r,e,t)=>e.has(r)||Vr("Cannot "+t);var _e=(r,e,t)=>(Xr(r,e,"read from private field"),t?t.call(r):e.get(r)),it=(r,e,t)=>e.has(r)?Vr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),At=(r,e,t,n)=>(Xr(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var Zr=E(at=>{"use strict";at.byteLength=_o;at.toByteArray=Io;at.fromByteArray=Co;var X=[],J=[],vo=typeof Uint8Array<"u"?Uint8Array:Array,Ct="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ge=0,Yr=Ct.length;ge<Yr;++ge)X[ge]=Ct[ge],J[Ct.charCodeAt(ge)]=ge;var ge,Yr;J[45]=62;J[95]=63;function Qr(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function _o(r){var e=Qr(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Ro(r,e,t){return(e+t)*3/4-t}function Io(r){var e,t=Qr(r),n=t[0],i=t[1],a=new vo(Ro(r,n,i)),o=0,s=i>0?n-4:n,u;for(u=0;u<s;u+=4)e=J[r.charCodeAt(u)]<<18|J[r.charCodeAt(u+1)]<<12|J[r.charCodeAt(u+2)]<<6|J[r.charCodeAt(u+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=J[r.charCodeAt(u)]<<2|J[r.charCodeAt(u+1)]>>4,a[o++]=e&255),i===1&&(e=J[r.charCodeAt(u)]<<10|J[r.charCodeAt(u+1)]<<4|J[r.charCodeAt(u+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function xo(r){return X[r>>18&63]+X[r>>12&63]+X[r>>6&63]+X[r&63]}function Ao(r,e,t){for(var n,i=[],a=e;a<t;a+=3)n=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255),i.push(xo(n));return i.join("")}function Co(r){for(var e,t=r.length,n=t%3,i=[],a=16383,o=0,s=t-n;o<s;o+=a)i.push(Ao(r,o,o+a>s?s:o+a));return n===1?(e=r[t-1],i.push(X[e>>2]+X[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(X[e>>10]+X[e>>4&63]+X[e<<2&63]+"=")),i.join("")}});var en=E(Ot=>{Ot.read=function(r,e,t,n,i){var a,o,s=i*8-n-1,u=(1<<s)-1,l=u>>1,f=-7,c=t?i-1:0,p=t?-1:1,g=r[e+c];for(c+=p,a=g&(1<<-f)-1,g>>=-f,f+=s;f>0;a=a*256+r[e+c],c+=p,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=n;f>0;o=o*256+r[e+c],c+=p,f-=8);if(a===0)a=1-l;else{if(a===u)return o?NaN:(g?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-l}return(g?-1:1)*o*Math.pow(2,a-n)};Ot.write=function(r,e,t,n,i,a){var o,s,u,l=a*8-i-1,f=(1<<l)-1,c=f>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:a-1,h=n?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+c>=1?e+=p/u:e+=p*Math.pow(2,1-c),e*u>=2&&(o++,u/=2),o+c>=f?(s=0,o=f):o+c>=1?(s=(e*u-1)*Math.pow(2,i),o=o+c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;r[t+g]=s&255,g+=h,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;r[t+g]=o&255,g+=h,o/=256,l-=8);r[t+g-h]|=m*128}});var ct=E(Ae=>{"use strict";var Pt=Zr(),Ie=en(),tn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ae.Buffer=d;Ae.SlowBuffer=No;Ae.INSPECT_MAX_BYTES=50;var ot=2147483647;Ae.kMaxLength=ot;d.TYPED_ARRAY_SUPPORT=Oo();!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Oo(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}});Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function Z(r){if(r>ot)throw new RangeError(\'The value "\'+r+\'" is invalid for option "size"\');let e=new Uint8Array(r);return Object.setPrototypeOf(e,d.prototype),e}function d(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError(\'The "string" argument must be of type string. Received type number\');return Nt(r)}return on(r,e,t)}d.poolSize=8192;function on(r,e,t){if(typeof r=="string")return Uo(r,e);if(ArrayBuffer.isView(r))return ko(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(Y(r,ArrayBuffer)||r&&Y(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Y(r,SharedArrayBuffer)||r&&Y(r.buffer,SharedArrayBuffer)))return kt(r,e,t);if(typeof r=="number")throw new TypeError(\'The "value" argument must not be of type number. Received type number\');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return d.from(n,e,t);let i=Do(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return d.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}d.from=function(r,e,t){return on(r,e,t)};Object.setPrototypeOf(d.prototype,Uint8Array.prototype);Object.setPrototypeOf(d,Uint8Array);function sn(r){if(typeof r!="number")throw new TypeError(\'"size" argument must be of type number\');if(r<0)throw new RangeError(\'The value "\'+r+\'" is invalid for option "size"\')}function Po(r,e,t){return sn(r),r<=0?Z(r):e!==void 0?typeof t=="string"?Z(r).fill(e,t):Z(r).fill(e):Z(r)}d.alloc=function(r,e,t){return Po(r,e,t)};function Nt(r){return sn(r),Z(r<0?0:Mt(r)|0)}d.allocUnsafe=function(r){return Nt(r)};d.allocUnsafeSlow=function(r){return Nt(r)};function Uo(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!d.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=cn(r,e)|0,n=Z(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}function Ut(r){let e=r.length<0?0:Mt(r.length)|0,t=Z(e);for(let n=0;n<e;n+=1)t[n]=r[n]&255;return t}function ko(r){if(Y(r,Uint8Array)){let e=new Uint8Array(r);return kt(e.buffer,e.byteOffset,e.byteLength)}return Ut(r)}function kt(r,e,t){if(e<0||r.byteLength<e)throw new RangeError(\'"offset" is outside of buffer bounds\');if(r.byteLength<e+(t||0))throw new RangeError(\'"length" is outside of buffer bounds\');let n;return e===void 0&&t===void 0?n=new Uint8Array(r):t===void 0?n=new Uint8Array(r,e):n=new Uint8Array(r,e,t),Object.setPrototypeOf(n,d.prototype),n}function Do(r){if(d.isBuffer(r)){let e=Mt(r.length)|0,t=Z(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||Bt(r.length)?Z(0):Ut(r);if(r.type==="Buffer"&&Array.isArray(r.data))return Ut(r.data)}function Mt(r){if(r>=ot)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ot.toString(16)+" bytes");return r|0}function No(r){return+r!=r&&(r=0),d.alloc(+r)}d.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==d.prototype};d.compare=function(e,t){if(Y(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(e)||!d.isBuffer(t))throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');if(e===t)return 0;let n=e.length,i=t.length;for(let a=0,o=Math.min(n,i);a<o;++a)if(e[a]!==t[a]){n=e[a],i=t[a];break}return n<i?-1:i<n?1:0};d.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};d.concat=function(e,t){if(!Array.isArray(e))throw new TypeError(\'"list" argument must be an Array of Buffers\');if(e.length===0)return d.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let i=d.allocUnsafe(t),a=0;for(n=0;n<e.length;++n){let o=e[n];if(Y(o,Uint8Array))a+o.length>i.length?(d.isBuffer(o)||(o=d.from(o)),o.copy(i,a)):Uint8Array.prototype.set.call(i,o,a);else if(d.isBuffer(o))o.copy(i,a);else throw new TypeError(\'"list" argument must be an Array of Buffers\');a+=o.length}return i};function cn(r,e){if(d.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||Y(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \'+typeof r);let t=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Dt(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return yn(r).length;default:if(i)return n?-1:Dt(r).length;e=(""+e).toLowerCase(),i=!0}}d.byteLength=cn;function Mo(r,e,t){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return zo(this,e,t);case"utf8":case"utf-8":return ln(this,e,t);case"ascii":return Wo(this,e,t);case"latin1":case"binary":return jo(this,e,t);case"base64":return qo(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Jo(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}d.prototype._isBuffer=!0;function me(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}d.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)me(this,t,t+1);return this};d.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)me(this,t,t+3),me(this,t+1,t+2);return this};d.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)me(this,t,t+7),me(this,t+1,t+6),me(this,t+2,t+5),me(this,t+3,t+4);return this};d.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?ln(this,0,e):Mo.apply(this,arguments)};d.prototype.toLocaleString=d.prototype.toString;d.prototype.equals=function(e){if(!d.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:d.compare(this,e)===0};d.prototype.inspect=function(){let e="",t=Ae.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};tn&&(d.prototype[tn]=d.prototype.inspect);d.prototype.compare=function(e,t,n,i,a){if(Y(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \'+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),t<0||n>e.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&t>=n)return 0;if(i>=a)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,a>>>=0,this===e)return 0;let o=a-i,s=n-t,u=Math.min(o,s),l=this.slice(i,a),f=e.slice(t,n);for(let c=0;c<u;++c)if(l[c]!==f[c]){o=l[c],s=f[c];break}return o<s?-1:s<o?1:0};function un(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,Bt(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=d.from(e,n)),d.isBuffer(e))return e.length===0?-1:rn(r,e,t,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):rn(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function rn(r,e,t,n,i){let a=1,o=r.length,s=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;a=2,o/=2,s/=2,t/=2}function u(f,c){return a===1?f[c]:f.readUInt16BE(c*a)}let l;if(i){let f=-1;for(l=t;l<o;l++)if(u(r,l)===u(e,f===-1?0:l-f)){if(f===-1&&(f=l),l-f+1===s)return f*a}else f!==-1&&(l-=l-f),f=-1}else for(t+s>o&&(t=o-s),l=t;l>=0;l--){let f=!0;for(let c=0;c<s;c++)if(u(r,l+c)!==u(e,c)){f=!1;break}if(f)return l}return-1}d.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};d.prototype.indexOf=function(e,t,n){return un(this,e,t,n,!0)};d.prototype.lastIndexOf=function(e,t,n){return un(this,e,t,n,!1)};function Fo(r,e,t,n){t=Number(t)||0;let i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let a=e.length;n>a/2&&(n=a/2);let o;for(o=0;o<n;++o){let s=parseInt(e.substr(o*2,2),16);if(Bt(s))return o;r[t+o]=s}return o}function Bo(r,e,t,n){return st(Dt(e,r.length-t),r,t,n)}function Ho(r,e,t,n){return st(Yo(e),r,t,n)}function Lo(r,e,t,n){return st(yn(e),r,t,n)}function $o(r,e,t,n){return st(Qo(e,r.length-t),r,t,n)}d.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let a=this.length-t;if((n===void 0||n>a)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return Fo(this,e,t,n);case"utf8":case"utf-8":return Bo(this,e,t,n);case"ascii":case"latin1":case"binary":return Ho(this,e,t,n);case"base64":return Lo(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $o(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function qo(r,e,t){return e===0&&t===r.length?Pt.fromByteArray(r):Pt.fromByteArray(r.slice(e,t))}function ln(r,e,t){t=Math.min(r.length,t);let n=[],i=e;for(;i<t;){let a=r[i],o=null,s=a>239?4:a>223?3:a>191?2:1;if(i+s<=t){let u,l,f,c;switch(s){case 1:a<128&&(o=a);break;case 2:u=r[i+1],(u&192)===128&&(c=(a&31)<<6|u&63,c>127&&(o=c));break;case 3:u=r[i+1],l=r[i+2],(u&192)===128&&(l&192)===128&&(c=(a&15)<<12|(u&63)<<6|l&63,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:u=r[i+1],l=r[i+2],f=r[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(c=(a&15)<<18|(u&63)<<12|(l&63)<<6|f&63,c>65535&&c<1114112&&(o=c))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=s}return Ko(n)}var nn=4096;function Ko(r){let e=r.length;if(e<=nn)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=nn));return t}function Wo(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function jo(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function zo(r,e,t){let n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);let i="";for(let a=e;a<t;++a)i+=Zo[r[a]];return i}function Jo(r,e,t){let n=r.slice(e,t),i="";for(let a=0;a<n.length-1;a+=2)i+=String.fromCharCode(n[a]+n[a+1]*256);return i}d.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let i=this.subarray(e,t);return Object.setPrototypeOf(i,d.prototype),i};function B(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||B(e,t,this.length);let i=this[e],a=1,o=0;for(;++o<t&&(a*=256);)i+=this[e+o]*a;return i};d.prototype.readUintBE=d.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||B(e,t,this.length);let i=this[e+--t],a=1;for(;t>0&&(a*=256);)i+=this[e+--t]*a;return i};d.prototype.readUint8=d.prototype.readUInt8=function(e,t){return e=e>>>0,t||B(e,1,this.length),this[e]};d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||B(e,2,this.length),this[e]|this[e+1]<<8};d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||B(e,2,this.length),this[e]<<8|this[e+1]};d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||B(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};d.prototype.readBigUInt64LE=ae(function(e){e=e>>>0,xe(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Ke(e,this.length-8);let i=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,a=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(a)<<BigInt(32))});d.prototype.readBigUInt64BE=ae(function(e){e=e>>>0,xe(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Ke(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],a=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(a)});d.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||B(e,t,this.length);let i=this[e],a=1,o=0;for(;++o<t&&(a*=256);)i+=this[e+o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*t)),i};d.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||B(e,t,this.length);let i=t,a=1,o=this[e+--i];for(;i>0&&(a*=256);)o+=this[e+--i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*t)),o};d.prototype.readInt8=function(e,t){return e=e>>>0,t||B(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};d.prototype.readInt16LE=function(e,t){e=e>>>0,t||B(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};d.prototype.readInt16BE=function(e,t){e=e>>>0,t||B(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};d.prototype.readInt32LE=function(e,t){return e=e>>>0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};d.prototype.readInt32BE=function(e,t){return e=e>>>0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};d.prototype.readBigInt64LE=ae(function(e){e=e>>>0,xe(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Ke(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});d.prototype.readBigInt64BE=ae(function(e){e=e>>>0,xe(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Ke(e,this.length-8);let i=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});d.prototype.readFloatLE=function(e,t){return e=e>>>0,t||B(e,4,this.length),Ie.read(this,e,!0,23,4)};d.prototype.readFloatBE=function(e,t){return e=e>>>0,t||B(e,4,this.length),Ie.read(this,e,!1,23,4)};d.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||B(e,8,this.length),Ie.read(this,e,!0,52,8)};d.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||B(e,8,this.length),Ie.read(this,e,!1,52,8)};function W(r,e,t,n,i,a){if(!d.isBuffer(r))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(e>i||e<a)throw new RangeError(\'"value" argument is out of bounds\');if(t+n>r.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let s=Math.pow(2,8*n)-1;W(this,e,t,n,s,0)}let a=1,o=0;for(this[t]=e&255;++o<n&&(a*=256);)this[t+o]=e/a&255;return t+n};d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let s=Math.pow(2,8*n)-1;W(this,e,t,n,s,0)}let a=n-1,o=1;for(this[t+a]=e&255;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+n};d.prototype.writeUint8=d.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,1,255,0),this[t]=e&255,t+1};d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function fn(r,e,t,n,i){mn(e,n,i,r,t,7);let a=Number(e&BigInt(4294967295));r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]=a;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}function dn(r,e,t,n,i){mn(e,n,i,r,t,7);let a=Number(e&BigInt(4294967295));r[t+7]=a,a=a>>8,r[t+6]=a,a=a>>8,r[t+5]=a,a=a>>8,r[t+4]=a;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}d.prototype.writeBigUInt64LE=ae(function(e,t=0){return fn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});d.prototype.writeBigUInt64BE=ae(function(e,t=0){return dn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});d.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let u=Math.pow(2,8*n-1);W(this,e,t,n,u-1,-u)}let a=0,o=1,s=0;for(this[t]=e&255;++a<n&&(o*=256);)e<0&&s===0&&this[t+a-1]!==0&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n};d.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let u=Math.pow(2,8*n-1);W(this,e,t,n,u-1,-u)}let a=n-1,o=1,s=0;for(this[t+a]=e&255;--a>=0&&(o*=256);)e<0&&s===0&&this[t+a+1]!==0&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n};d.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};d.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};d.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};d.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};d.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||W(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]=e&255,t+4};d.prototype.writeBigInt64LE=ae(function(e,t=0){return fn(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});d.prototype.writeBigInt64BE=ae(function(e,t=0){return dn(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function pn(r,e,t,n,i,a){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function hn(r,e,t,n,i){return e=+e,t=t>>>0,i||pn(r,e,t,4,34028234663852886e22,-34028234663852886e22),Ie.write(r,e,t,n,23,4),t+4}d.prototype.writeFloatLE=function(e,t,n){return hn(this,e,t,!0,n)};d.prototype.writeFloatBE=function(e,t,n){return hn(this,e,t,!1,n)};function gn(r,e,t,n,i){return e=+e,t=t>>>0,i||pn(r,e,t,8,17976931348623157e292,-17976931348623157e292),Ie.write(r,e,t,n,52,8),t+8}d.prototype.writeDoubleLE=function(e,t,n){return gn(this,e,t,!0,n)};d.prototype.writeDoubleBE=function(e,t,n){return gn(this,e,t,!1,n)};d.prototype.copy=function(e,t,n,i){if(!d.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);let a=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),a};d.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!d.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let a;if(typeof e=="number")for(a=t;a<n;++a)this[a]=e;else{let o=d.isBuffer(e)?e:d.from(e,i),s=o.length;if(s===0)throw new TypeError(\'The value "\'+e+\'" is invalid for argument "value"\');for(a=0;a<n-t;++a)this[a+t]=o[a%s]}return this};var Re={};function Ft(r,e,t){Re[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}Ft("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Ft("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);Ft("ERR_OUT_OF_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=an(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=an(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function an(r){let e="",t=r.length,n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function Vo(r,e,t){xe(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&Ke(e,r.length-(t+1))}function mn(r,e,t,n,i,a){if(r>t||r<e){let o=typeof e=="bigint"?"n":"",s;throw a>3?e===0||e===BigInt(0)?s=`>= 0${o} and < 2${o} ** ${(a+1)*8}${o}`:s=`>= -(2${o} ** ${(a+1)*8-1}${o}) and < 2 ** ${(a+1)*8-1}${o}`:s=`>= ${e}${o} and <= ${t}${o}`,new Re.ERR_OUT_OF_RANGE("value",s,r)}Vo(n,i,a)}function xe(r,e){if(typeof r!="number")throw new Re.ERR_INVALID_ARG_TYPE(e,"number",r)}function Ke(r,e,t){throw Math.floor(r)!==r?(xe(r,t),new Re.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new Re.ERR_BUFFER_OUT_OF_BOUNDS:new Re.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var Go=/[^+/0-9A-Za-z-_]/g;function Xo(r){if(r=r.split("=")[0],r=r.trim().replace(Go,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Dt(r,e){e=e||1/0;let t,n=r.length,i=null,a=[];for(let o=0;o<n;++o){if(t=r.charCodeAt(o),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&a.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&a.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;a.push(t)}else if(t<2048){if((e-=2)<0)break;a.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;a.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;a.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return a}function Yo(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function Qo(r,e){let t,n,i,a=[];for(let o=0;o<r.length&&!((e-=2)<0);++o)t=r.charCodeAt(o),n=t>>8,i=t%256,a.push(i),a.push(n);return a}function yn(r){return Pt.toByteArray(Xo(r))}function st(r,e,t,n){let i;for(i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function Y(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function Bt(r){return r!==r}var Zo=(function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)e[n+i]=r[t]+r[i]}return e})();function ae(r){return typeof BigInt>"u"?es:r}function es(){throw new Error("BigInt not supported")}});var er=E((jl,Jn)=>{"use strict";Jn.exports=function(e,t){return function(){return e.apply(t,arguments)}}});var k=E((zl,Yn)=>{"use strict";var Os=er(),nr=Object.prototype.toString,ir=(function(r){return function(e){var t=nr.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())}})(Object.create(null));function ue(r){return r=r.toLowerCase(),function(t){return ir(t)===r}}function dt(r){return Array.isArray(r)}function tr(r){return typeof r>"u"}function Ps(r){return r!==null&&!tr(r)&&r.constructor!==null&&!tr(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}var Vn=ue("ArrayBuffer");function Us(r){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Vn(r.buffer),e}function ks(r){return typeof r=="string"}function Gn(r){return typeof r=="number"}function Xn(r){return r!==null&&typeof r=="object"}function ft(r){if(ir(r)!=="object")return!1;var e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}function Ds(r){return r&&Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}var Ns=ue("Date"),Ms=ue("File"),Fs=ue("Blob"),Bs=ue("FileList");function ar(r){return nr.call(r)==="[object Function]"}function Hs(r){return Xn(r)&&ar(r.pipe)}function Ls(r){var e="[object FormData]";return r&&(typeof FormData=="function"&&r instanceof FormData||nr.call(r)===e||ar(r.toString)&&r.toString()===e)}var $s=ue("URLSearchParams");function qs(r){return r.trim?r.trim():r.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,"")}function Ks(){var r;return typeof navigator<"u"&&((r=navigator.product)==="ReactNative"||r==="NativeScript"||r==="NS")?!1:typeof window<"u"&&typeof document<"u"}function or(r,e){if(!(r===null||typeof r>"u"))if(typeof r!="object"&&(r=[r]),dt(r))for(var t=0,n=r.length;t<n;t++)e.call(null,r[t],t,r);else for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.call(null,r[i],i,r)}function rr(){var r={};function e(i,a){ft(r[a])&&ft(i)?r[a]=rr(r[a],i):ft(i)?r[a]=rr({},i):dt(i)?r[a]=i.slice():r[a]=i}for(var t=0,n=arguments.length;t<n;t++)or(arguments[t],e);return r}function Ws(r,e,t){return or(e,function(i,a){t&&typeof i=="function"?r[a]=Os(i,t):r[a]=i}),r}function js(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}function zs(r,e,t,n){r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,t&&Object.assign(r.prototype,t)}function Js(r,e,t,n){var i,a,o,s={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),a=i.length;a-- >0;)o=i[a],(!n||n(o,r,e))&&!s[o]&&(e[o]=r[o],s[o]=!0);r=t!==!1&&Object.getPrototypeOf(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e}function Vs(r,e,t){r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;var n=r.indexOf(e,t);return n!==-1&&n===t}function Gs(r){if(!r)return null;if(dt(r))return r;var e=r.length;if(!Gn(e))return null;for(var t=new Array(e);e-- >0;)t[e]=r[e];return t}var Xs=(function(r){return function(e){return r&&e instanceof r}})(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array));function Ys(r,e){for(var t=r&&r[Symbol.iterator],n=t.call(r),i;(i=n.next())&&!i.done;){var a=i.value;e.call(r,a[0],a[1])}}function Qs(r,e){for(var t,n=[];(t=r.exec(e))!==null;)n.push(t);return n}var Zs=ue("HTMLFormElement"),ec=(function(e){return function(t,n){return e.call(t,n)}})(Object.prototype.hasOwnProperty);Yn.exports={isArray:dt,isArrayBuffer:Vn,isBuffer:Ps,isFormData:Ls,isArrayBufferView:Us,isString:ks,isNumber:Gn,isObject:Xn,isPlainObject:ft,isEmptyObject:Ds,isUndefined:tr,isDate:Ns,isFile:Ms,isBlob:Fs,isFunction:ar,isStream:Hs,isURLSearchParams:$s,isStandardBrowserEnv:Ks,forEach:or,merge:rr,extend:Ws,trim:qs,stripBOM:js,inherits:zs,toFlatObject:Js,kindOf:ir,kindOfTest:ue,endsWith:Vs,toArray:Gs,isTypedArray:Xs,isFileList:Bs,forEachEntry:Ys,matchAll:Qs,isHTMLForm:Zs,hasOwnProperty:ec}});var le=E((Jl,ti)=>{"use strict";var Qn=k();function Pe(r,e,t,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),i&&(this.response=i)}Qn.inherits(Pe,Error,{toJSON:function(){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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var Zn=Pe.prototype,ei={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(function(r){ei[r]={value:r}});Object.defineProperties(Pe,ei);Object.defineProperty(Zn,"isAxiosError",{value:!0});Pe.from=function(r,e,t,n,i,a){var o=Object.create(Zn);return Qn.toFlatObject(r,o,function(u){return u!==Error.prototype}),Pe.call(o,r.message,e,t,n,i),o.cause=r,o.name=r.name,a&&Object.assign(o,a),o};ti.exports=Pe});var ni=E((Vl,ri)=>{"use strict";ri.exports=typeof self=="object"?self.FormData:window.FormData});var ai=E((Gl,ii)=>{ii.exports=ni()});var Je=E((Xl,ci)=>{"use strict";var C=k(),tc=le(),rc=ai();function sr(r){return C.isPlainObject(r)||C.isArray(r)}function si(r){return C.endsWith(r,"[]")?r.slice(0,-2):r}function oi(r,e,t){return r?r.concat(e).map(function(i,a){return i=si(i),!t&&a?"["+i+"]":i}).join(t?".":""):e}function nc(r){return C.isArray(r)&&!r.some(sr)}var ic=C.toFlatObject(C,{},null,function(e){return/^is[A-Z]/.test(e)});function ac(r){return r&&C.isFunction(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator]}function oc(r,e,t){if(!C.isObject(r))throw new TypeError("target must be an object");e=e||new(rc||FormData),t=C.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,b){return!C.isUndefined(b[m])});var n=t.metaTokens,i=t.visitor||f,a=t.dots,o=t.indexes,s=t.Blob||typeof Blob<"u"&&Blob,u=s&&ac(e);if(!C.isFunction(i))throw new TypeError("visitor must be a function");function l(h){if(h===null)return"";if(C.isDate(h))return h.toISOString();if(!u&&C.isBlob(h))throw new tc("Blob is not supported. Use a Buffer instead.");return C.isArrayBuffer(h)||C.isTypedArray(h)?u&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function f(h,m,b){var T=h;if(h&&!b&&typeof h=="object"){if(C.endsWith(m,"{}"))m=n?m:m.slice(0,-2),h=JSON.stringify(h);else if(C.isArray(h)&&nc(h)||C.isFileList(h)||C.endsWith(m,"[]")&&(T=C.toArray(h)))return m=si(m),T.forEach(function(R,I){!(C.isUndefined(R)||R===null)&&e.append(o===!0?oi([m],I,a):o===null?m:m+"[]",l(R))}),!1}return sr(h)?!0:(e.append(oi(b,m,a),l(h)),!1)}var c=[],p=Object.assign(ic,{defaultVisitor:f,convertValue:l,isVisitable:sr});function g(h,m){if(!C.isUndefined(h)){if(c.indexOf(h)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(h),C.forEach(h,function(T,S){var R=!(C.isUndefined(T)||T===null)&&i.call(e,T,C.isString(S)?S.trim():S,m,p);R===!0&&g(T,m?m.concat(S):[S])}),c.pop()}}if(!C.isObject(r))throw new TypeError("data must be an object");return g(r),e}ci.exports=oc});var cr=E((Yl,di)=>{"use strict";var sc=Je();function ui(r){var e={"!":"%21","\'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\\0"};return encodeURIComponent(r).replace(/[!\'\\(\\)~]|%20|%00/g,function(n){return e[n]})}function li(r,e){this._pairs=[],r&&sc(r,this,e)}var fi=li.prototype;fi.append=function(e,t){this._pairs.push([e,t])};fi.toString=function(e){var t=e?function(n){return e.call(this,n,ui)}:ui;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};di.exports=li});var ur=E((Ql,pi)=>{"use strict";var cc=k(),uc=cr();function lc(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}pi.exports=function(e,t,n){if(!t)return e;var i=e.indexOf("#");i!==-1&&(e=e.slice(0,i));var a=n&&n.encode||lc,o=n&&n.serialize,s;return o?s=o(t,n):s=cc.isURLSearchParams(t)?t.toString():new uc(t,n).toString(a),s&&(e+=(e.indexOf("?")===-1?"?":"&")+s),e}});var gi=E((Zl,hi)=>{"use strict";var fc=k();function Ve(){this.handlers=[]}Ve.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};Ve.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Ve.prototype.clear=function(){this.handlers&&(this.handlers=[])};Ve.prototype.forEach=function(e){fc.forEach(this.handlers,function(n){n!==null&&e(n)})};hi.exports=Ve});var lr=E((ef,mi)=>{"use strict";var dc=k();mi.exports=function(e,t){dc.forEach(e,function(i,a){a!==t&&a.toUpperCase()===t.toUpperCase()&&(e[t]=i,delete e[a])})}});var fr=E((tf,yi)=>{"use strict";yi.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var Ei=E((rf,Si)=>{"use strict";var pc=cr();Si.exports=typeof URLSearchParams<"u"?URLSearchParams:pc});var bi=E((nf,wi)=>{"use strict";wi.exports=FormData});var vi=E((af,Ti)=>{"use strict";Ti.exports={isBrowser:!0,classes:{URLSearchParams:Ei(),FormData:bi(),Blob},protocols:["http","https","file","blob","url","data"]}});var pt=E((of,_i)=>{"use strict";_i.exports=vi()});var xi=E((sf,Ii)=>{"use strict";var hc=k(),gc=Je(),Ri=pt();Ii.exports=function(e,t){return gc(e,new Ri.classes.URLSearchParams,Object.assign({visitor:function(n,i,a,o){return Ri.isNode&&hc.isBuffer(n)?(this.append(i,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}});var dr=E((cf,Ai)=>{"use strict";var fe=k();function mc(r){return fe.matchAll(/\\w+|\\[(\\w*)]/g,r).map(function(e){return e[0]==="[]"?"":e[1]||e[0]})}function yc(r){var e={},t=Object.keys(r),n,i=t.length,a;for(n=0;n<i;n++)a=t[n],e[a]=r[a];return e}function Sc(r){function e(n,i,a,o){var s=n[o++];if(s==="__proto__")return!0;var u=Number.isFinite(+s),l=o>=n.length;if(s=!s&&fe.isArray(a)?a.length:s,l)return fe.hasOwnProperty(a,s)?a[s]=[a[s],i]:a[s]=i,!u;(!a[s]||!fe.isObject(a[s]))&&(a[s]=[]);var f=e(n,i,a[s],o);return f&&fe.isArray(a[s])&&(a[s]=yc(a[s])),!u}if(fe.isFormData(r)&&fe.isFunction(r.entries)){var t={};return fe.forEachEntry(r,function(n,i){e(mc(n),i,t,0)}),t}return null}Ai.exports=Sc});var Oi=E((uf,Ci)=>{"use strict";var pr=le();Ci.exports=function(e,t,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):t(new pr("Request failed with status code "+n.status,[pr.ERR_BAD_REQUEST,pr.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}});var Ui=E((lf,Pi)=>{"use strict";var ht=k();Pi.exports=ht.isStandardBrowserEnv()?(function(){return{write:function(t,n,i,a,o,s){var u=[];u.push(t+"="+encodeURIComponent(n)),ht.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),ht.isString(a)&&u.push("path="+a),ht.isString(o)&&u.push("domain="+o),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(t){var n=document.cookie.match(new RegExp("(^|;\\\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}})():(function(){return{write:function(){},read:function(){return null},remove:function(){}}})()});var Di=E((ff,ki)=>{"use strict";ki.exports=function(e){return/^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(e)}});var Mi=E((df,Ni)=>{"use strict";Ni.exports=function(e,t){return t?e.replace(/\\/?\\/$/,"")+"/"+t.replace(/^\\/+/,""):e}});var hr=E((pf,Fi)=>{"use strict";var Ec=Di(),wc=Mi();Fi.exports=function(e,t,n){var i=!Ec(t);return e&&(i||n===!1)?wc(e,t):t}});var Hi=E((hf,Bi)=>{"use strict";var gr=k(),bc=["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"];Bi.exports=function(e){var t={},n,i,a;return e&&gr.forEach(e.split(`\n`),function(s){if(a=s.indexOf(":"),n=gr.trim(s.slice(0,a)).toLowerCase(),i=gr.trim(s.slice(a+1)),n){if(t[n]&&bc.indexOf(n)>=0)return;n==="set-cookie"?t[n]=(t[n]?t[n]:[]).concat([i]):t[n]=t[n]?t[n]+", "+i:i}}),t}});var qi=E((gf,$i)=>{"use strict";var Li=k();$i.exports=Li.isStandardBrowserEnv()?(function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),n;function i(a){var o=a;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return n=i(window.location.href),function(o){var s=Li.isString(o)?i(o):o;return s.protocol===n.protocol&&s.host===n.host}})():(function(){return function(){return!0}})()});var Ge=E((mf,Wi)=>{"use strict";var mr=le(),Tc=k();function Ki(r,e,t){mr.call(this,r??"canceled",mr.ERR_CANCELED,e,t),this.name="CanceledError"}Tc.inherits(Ki,mr,{__CANCEL__:!0});Wi.exports=Ki});var zi=E((yf,ji)=>{"use strict";ji.exports=function(e){var t=/^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(e);return t&&t[1]||""}});var yr=E((Sf,Ji)=>{"use strict";var Ue=k(),vc=Oi(),_c=Ui(),Rc=ur(),Ic=hr(),xc=Hi(),Ac=qi(),Cc=fr(),te=le(),Oc=Ge(),Pc=zi(),Uc=pt();Ji.exports=function(e){return new Promise(function(n,i){var a=e.data,o=e.headers,s=e.responseType,u=e.withXSRFToken,l;function f(){e.cancelToken&&e.cancelToken.unsubscribe(l),e.signal&&e.signal.removeEventListener("abort",l)}Ue.isFormData(a)&&Ue.isStandardBrowserEnv()&&delete o["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var p=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(p+":"+g)}var h=Ic(e.baseURL,e.url,e.allowAbsoluteUrls);c.open(e.method.toUpperCase(),Rc(h,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function m(){if(c){var S="getAllResponseHeaders"in c?xc(c.getAllResponseHeaders()):null,R=!s||s==="text"||s==="json"?c.responseText:c.response,I={data:R,status:c.status,statusText:c.statusText,headers:S,config:e,request:c};vc(function($){n($),f()},function($){i($),f()},I),c=null}}if("onloadend"in c?c.onloadend=m:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(m)},c.onabort=function(){c&&(i(new te("Request aborted",te.ECONNABORTED,e,c)),c=null)},c.onerror=function(){i(new te("Network Error",te.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){var R=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",I=e.transitional||Cc;e.timeoutErrorMessage&&(R=e.timeoutErrorMessage),i(new te(R,I.clarifyTimeoutError?te.ETIMEDOUT:te.ECONNABORTED,e,c)),c=null},Ue.isStandardBrowserEnv()&&(u&&Ue.isFunction(u)&&(u=u(e)),u||u!==!1&&Ac(h))){var b=e.xsrfHeaderName&&e.xsrfCookieName&&_c.read(e.xsrfCookieName);b&&(o[e.xsrfHeaderName]=b)}"setRequestHeader"in c&&Ue.forEach(o,function(R,I){typeof a>"u"&&I.toLowerCase()==="content-type"?delete o[I]:c.setRequestHeader(I,R)}),Ue.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),s&&s!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(l=function(S){c&&(i(!S||S.type?new Oc(null,e,c):S),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(l),e.signal&&(e.signal.aborted?l():e.signal.addEventListener("abort",l))),!a&&a!==!1&&a!==0&&a!==""&&(a=null);var T=Pc(h);if(T&&Uc.protocols.indexOf(T)===-1){i(new te("Unsupported protocol "+T+":",te.ERR_BAD_REQUEST,e));return}c.send(a)})}});var mt=E((Ef,Qi)=>{"use strict";var M=k(),Vi=lr(),Gi=le(),kc=fr(),Dc=Je(),Nc=xi(),Xi=pt(),Mc=dr(),Fc={"Content-Type":"application/x-www-form-urlencoded"};function Yi(r,e){!M.isUndefined(r)&&M.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function Bc(){var r;return typeof XMLHttpRequest<"u"?r=yr():typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(r=yr()),r}function Hc(r,e,t){if(M.isString(r))try{return(e||JSON.parse)(r),M.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}var gt={transitional:kc,adapter:Bc(),transformRequest:[function(e,t){Vi(t,"Accept"),Vi(t,"Content-Type");var n=t&&t["Content-Type"]||"",i=n.indexOf("application/json")>-1,a=M.isObject(e);a&&M.isHTMLForm(e)&&(e=new FormData(e));var o=M.isFormData(e);if(o)return i?JSON.stringify(Mc(e)):e;if(M.isArrayBuffer(e)||M.isBuffer(e)||M.isStream(e)||M.isFile(e)||M.isBlob(e))return e;if(M.isArrayBufferView(e))return e.buffer;if(M.isURLSearchParams(e))return Yi(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var s;if(a){if(n.indexOf("application/x-www-form-urlencoded")!==-1)return Nc(e,this.formSerializer).toString();if((s=M.isFileList(e))||n.indexOf("multipart/form-data")>-1){var u=this.env&&this.env.FormData;return Dc(s?{"files[]":e}:e,u&&new u,this.formSerializer)}}return a||i?(Yi(t,"application/json"),Hc(e)):e}],transformResponse:[function(e){var t=this.transitional||gt.transitional,n=t&&t.forcedJSONParsing,i=this.responseType==="json";if(e&&M.isString(e)&&(n&&!this.responseType||i)){var a=t&&t.silentJSONParsing,o=!a&&i;try{return JSON.parse(e)}catch(s){if(o)throw s.name==="SyntaxError"?Gi.from(s,Gi.ERR_BAD_RESPONSE,this,null,this.response):s}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xi.classes.FormData,Blob:Xi.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};M.forEach(["delete","get","head"],function(e){gt.headers[e]={}});M.forEach(["post","put","patch"],function(e){gt.headers[e]=M.merge(Fc)});Qi.exports=gt});var ea=E((wf,Zi)=>{"use strict";var Lc=k(),$c=mt();Zi.exports=function(e,t,n,i){var a=this||$c;return Lc.forEach(i,function(s){e=s.call(a,e,t,n)}),e}});var Sr=E((bf,ta)=>{"use strict";ta.exports=function(e){return!!(e&&e.__CANCEL__)}});var aa=E((Tf,ia)=>{"use strict";var ra=k(),Er=ea(),qc=Sr(),Kc=mt(),Wc=Ge(),na=lr();function wr(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Wc}ia.exports=function(e){wr(e),e.headers=e.headers||{},e.data=Er.call(e,e.data,e.headers,null,e.transformRequest),na(e.headers,"Accept"),na(e.headers,"Content-Type"),e.headers=ra.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ra.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var t=e.adapter||Kc.adapter;return t(e).then(function(i){return wr(e),i.data=Er.call(e,i.data,i.headers,i.status,e.transformResponse),i},function(i){return qc(i)||(wr(e),i&&i.response&&(i.response.data=Er.call(e,i.response.data,i.response.headers,i.response.status,e.transformResponse))),Promise.reject(i)})}});var br=E((vf,oa)=>{"use strict";var q=k();oa.exports=function(e,t){t=t||{};var n={};function i(f,c){return q.isPlainObject(f)&&q.isPlainObject(c)?q.merge(f,c):q.isEmptyObject(c)?q.merge({},f):q.isPlainObject(c)?q.merge({},c):q.isArray(c)?c.slice():c}function a(f){if(q.isUndefined(t[f])){if(!q.isUndefined(e[f]))return i(void 0,e[f])}else return i(e[f],t[f])}function o(f){if(!q.isUndefined(t[f]))return i(void 0,t[f])}function s(f){if(q.isUndefined(t[f])){if(!q.isUndefined(e[f]))return i(void 0,e[f])}else return i(void 0,t[f])}function u(f){if(f in t)return i(e[f],t[f]);if(f in e)return i(void 0,e[f])}var l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:u};return q.forEach(Object.keys(e).concat(Object.keys(t)),function(c){var p=l[c]||a,g=p(c);q.isUndefined(g)&&p!==u||(n[c]=g)}),n}});var Tr=E((_f,sa)=>{sa.exports={version:"0.30.1"}});var la=E((Rf,ua)=>{"use strict";var jc=Tr().version,de=le(),vr={};["object","boolean","number","function","string","symbol"].forEach(function(r,e){vr[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});var ca={};vr.transitional=function(e,t,n){function i(a,o){return"[Axios v"+jc+"] Transitional option \'"+a+"\'"+o+(n?". "+n:"")}return function(a,o,s){if(e===!1)throw new de(i(o," has been removed"+(t?" in "+t:"")),de.ERR_DEPRECATED);return t&&!ca[o]&&(ca[o]=!0,console.warn(i(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(a,o,s):!0}};function zc(r,e,t){if(typeof r!="object")throw new de("options must be an object",de.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(r),i=n.length;i-- >0;){var a=n[i],o=e[a];if(o){var s=r[a],u=s===void 0||o(s,a,r);if(u!==!0)throw new de("option "+a+" must be "+u,de.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new de("Unknown option "+a,de.ERR_BAD_OPTION)}}ua.exports={assertOptions:zc,validators:vr}});var ha=E((If,pa)=>{"use strict";var Rr=k(),Jc=ur(),fa=gi(),da=aa(),yt=br(),Vc=hr(),_r=la(),pe=_r.validators;function ke(r){this.defaults=r,this.interceptors={request:new fa,response:new fa}}ke.prototype.request=function(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=yt(this.defaults,t),t.method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;n!==void 0&&_r.assertOptions(n,{silentJSONParsing:pe.transitional(pe.boolean),forcedJSONParsing:pe.transitional(pe.boolean),clarifyTimeoutError:pe.transitional(pe.boolean)},!1);var i=t.paramsSerializer;i!=null&&(Rr.isFunction(i)?t.paramsSerializer={serialize:i}:_r.assertOptions(i,{encode:pe.function,serialize:pe.function},!0));var a=[],o=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(t)===!1||(o=o&&h.synchronous,a.unshift(h.fulfilled,h.rejected))});var s=[];this.interceptors.response.forEach(function(h){s.push(h.fulfilled,h.rejected)});var u;if(!o){var l=[da,void 0];for(Array.prototype.unshift.apply(l,a),l=l.concat(s),u=Promise.resolve(t);l.length;)u=u.then(l.shift(),l.shift());return u}for(var f=t;a.length;){var c=a.shift(),p=a.shift();try{f=c(f)}catch(g){p(g);break}}try{u=da(f)}catch(g){return Promise.reject(g)}for(;s.length;)u=u.then(s.shift(),s.shift());return u};ke.prototype.getUri=function(e){e=yt(this.defaults,e);var t=Vc(e.baseURL,e.url,e.allowAbsoluteUrls);return Jc(t,e.params,e.paramsSerializer)};Rr.forEach(["delete","get","head","options"],function(e){ke.prototype[e]=function(t,n){return this.request(yt(n||{},{method:e,url:t,data:(n||{}).data}))}});Rr.forEach(["post","put","patch"],function(e){function t(n){return function(a,o,s){return this.request(yt(s||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:a,data:o}))}}ke.prototype[e]=t(),ke.prototype[e+"Form"]=t(!0)});pa.exports=ke});var ma=E((xf,ga)=>{"use strict";var Gc=Ge();function De(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var t=this;this.promise.then(function(n){if(t._listeners){for(var i=t._listeners.length;i-- >0;)t._listeners[i](n);t._listeners=null}}),this.promise.then=function(n){var i,a=new Promise(function(o){t.subscribe(o),i=o}).then(n);return a.cancel=function(){t.unsubscribe(i)},a},r(function(i,a,o){t.reason||(t.reason=new Gc(i,a,o),e(t.reason))})}De.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};De.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};De.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};De.source=function(){var e,t=new De(function(i){e=i});return{token:t,cancel:e}};ga.exports=De});var Sa=E((Af,ya)=>{"use strict";ya.exports=function(e){return function(n){return e.apply(null,n)}}});var wa=E((Cf,Ea)=>{"use strict";var Xc=k();Ea.exports=function(e){return Xc.isObject(e)&&e.isAxiosError===!0}});var Ta=E((Of,xr)=>{"use strict";var Ir=k(),Yc=er(),St=ha(),Qc=br(),Zc=mt(),eu=dr();function ba(r){var e=new St(r),t=Yc(St.prototype.request,e);return Ir.extend(t,St.prototype,e),Ir.extend(t,e),t.create=function(i){return ba(Qc(r,i))},t}var K=ba(Zc);K.Axios=St;K.CanceledError=Ge();K.CancelToken=ma();K.isCancel=Sr();K.VERSION=Tr().version;K.toFormData=Je();K.AxiosError=le();K.Cancel=K.CanceledError;K.all=function(e){return Promise.all(e)};K.spread=Sa();K.isAxiosError=wa();K.formToJSON=function(r){return eu(Ir.isHTMLForm(r)?new FormData(r):r)};xr.exports=K;xr.exports.default=K});var _a=E((Pf,va)=>{va.exports=Ta()});var Ia=E(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});function tu(r){var e=4,t=r.length,n=t%e;if(!n)return r;var i=t,a=e-n,o=t+a,s=Buffer.alloc(o);for(s.write(r);a--;)s.write("=",i++);return s.toString()}Ar.default=tu});var Aa=E(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});var ru=Ia();function xa(r,e){return e===void 0&&(e="utf8"),Buffer.isBuffer(r)?Cr(r.toString("base64")):Cr(Buffer.from(r,e).toString("base64"))}function nu(r,e){return e===void 0&&(e="utf8"),Buffer.from(Or(r),"base64").toString(e)}function Or(r){return r=r.toString(),ru.default(r).replace(/\\-/g,"+").replace(/_/g,"/")}function Cr(r){return r.replace(/=/g,"").replace(/\\+/g,"-").replace(/\\//g,"_")}function iu(r){return Buffer.from(Or(r),"base64")}var Ne=xa;Ne.encode=xa;Ne.decode=nu;Ne.toBase64=Or;Ne.fromBase64=Cr;Ne.toBuffer=iu;Pr.default=Ne});var Ca=E((td,bt)=>{bt.exports=Aa().default;bt.exports.default=bt.exports});var Pa=E((Oa,Tt)=>{(function(r,e){var t={};e(t);var n=t.default;for(var i in t)n[i]=t[i];typeof Tt=="object"&&typeof Tt.exports=="object"?Tt.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):r.sha256=n})(Oa,function(r){"use strict";r.__esModule=!0,r.digestLength=32,r.blockSize=64;var e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function t(c,p,g,h,m){for(var b,T,S,R,I,x,$,D,F,N,be,Te,qe;m>=64;){for(b=p[0],T=p[1],S=p[2],R=p[3],I=p[4],x=p[5],$=p[6],D=p[7],N=0;N<16;N++)be=h+N*4,c[N]=(g[be]&255)<<24|(g[be+1]&255)<<16|(g[be+2]&255)<<8|g[be+3]&255;for(N=16;N<64;N++)F=c[N-2],Te=(F>>>17|F<<15)^(F>>>19|F<<13)^F>>>10,F=c[N-15],qe=(F>>>7|F<<25)^(F>>>18|F<<14)^F>>>3,c[N]=(Te+c[N-7]|0)+(qe+c[N-16]|0);for(N=0;N<64;N++)Te=(((I>>>6|I<<26)^(I>>>11|I<<21)^(I>>>25|I<<7))+(I&x^~I&$)|0)+(D+(e[N]+c[N]|0)|0)|0,qe=((b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10))+(b&T^b&S^T&S)|0,D=$,$=x,x=I,I=R+Te|0,R=S,S=T,T=b,b=Te+qe|0;p[0]+=b,p[1]+=T,p[2]+=S,p[3]+=R,p[4]+=I,p[5]+=x,p[6]+=$,p[7]+=D,h+=64,m-=64}return h}var n=(function(){function c(){this.digestLength=r.digestLength,this.blockSize=r.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return c.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},c.prototype.clean=function(){for(var p=0;p<this.buffer.length;p++)this.buffer[p]=0;for(var p=0;p<this.temp.length;p++)this.temp[p]=0;this.reset()},c.prototype.update=function(p,g){if(g===void 0&&(g=p.length),this.finished)throw new Error("SHA256: can\'t update because hash was finished.");var h=0;if(this.bytesHashed+=g,this.bufferLength>0){for(;this.bufferLength<64&&g>0;)this.buffer[this.bufferLength++]=p[h++],g--;this.bufferLength===64&&(t(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(g>=64&&(h=t(this.temp,this.state,p,h,g),g%=64);g>0;)this.buffer[this.bufferLength++]=p[h++],g--;return this},c.prototype.finish=function(p){if(!this.finished){var g=this.bytesHashed,h=this.bufferLength,m=g/536870912|0,b=g<<3,T=g%64<56?64:128;this.buffer[h]=128;for(var S=h+1;S<T-8;S++)this.buffer[S]=0;this.buffer[T-8]=m>>>24&255,this.buffer[T-7]=m>>>16&255,this.buffer[T-6]=m>>>8&255,this.buffer[T-5]=m>>>0&255,this.buffer[T-4]=b>>>24&255,this.buffer[T-3]=b>>>16&255,this.buffer[T-2]=b>>>8&255,this.buffer[T-1]=b>>>0&255,t(this.temp,this.state,this.buffer,0,T),this.finished=!0}for(var S=0;S<8;S++)p[S*4+0]=this.state[S]>>>24&255,p[S*4+1]=this.state[S]>>>16&255,p[S*4+2]=this.state[S]>>>8&255,p[S*4+3]=this.state[S]>>>0&255;return this},c.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},c.prototype._saveState=function(p){for(var g=0;g<this.state.length;g++)p[g]=this.state[g]},c.prototype._restoreState=function(p,g){for(var h=0;h<this.state.length;h++)this.state[h]=p[h];this.bytesHashed=g,this.finished=!1,this.bufferLength=0},c})();r.Hash=n;var i=(function(){function c(p){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var g=new Uint8Array(this.blockSize);if(p.length>this.blockSize)new n().update(p).finish(g).clean();else for(var h=0;h<p.length;h++)g[h]=p[h];for(var h=0;h<g.length;h++)g[h]^=54;this.inner.update(g);for(var h=0;h<g.length;h++)g[h]^=106;this.outer.update(g),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var h=0;h<g.length;h++)g[h]=0}return c.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},c.prototype.clean=function(){for(var p=0;p<this.istate.length;p++)this.ostate[p]=this.istate[p]=0;this.inner.clean(),this.outer.clean()},c.prototype.update=function(p){return this.inner.update(p),this},c.prototype.finish=function(p){return this.outer.finished?this.outer.finish(p):(this.inner.finish(p),this.outer.update(p,this.digestLength).finish(p)),this},c.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},c})();r.HMAC=i;function a(c){var p=new n().update(c),g=p.digest();return p.clean(),g}r.hash=a,r.default=a;function o(c,p){var g=new i(c).update(p),h=g.digest();return g.clean(),h}r.hmac=o;function s(c,p,g,h){var m=h[0];if(m===0)throw new Error("hkdf: cannot expand more");p.reset(),m>1&&p.update(c),g&&p.update(g),p.update(h),p.finish(c),h[0]++}var u=new Uint8Array(r.digestLength);function l(c,p,g,h){p===void 0&&(p=u),h===void 0&&(h=32);for(var m=new Uint8Array([1]),b=o(p,c),T=new i(b),S=new Uint8Array(T.digestLength),R=S.length,I=new Uint8Array(h),x=0;x<h;x++)R===S.length&&(s(S,T,g,m),R=0),I[x]=S[R++];return T.clean(),S.fill(0),m.fill(0),I}r.hkdf=l;function f(c,p,g,h){for(var m=new i(c),b=m.digestLength,T=new Uint8Array(4),S=new Uint8Array(b),R=new Uint8Array(b),I=new Uint8Array(h),x=0;x*b<h;x++){var $=x+1;T[0]=$>>>24&255,T[1]=$>>>16&255,T[2]=$>>>8&255,T[3]=$>>>0&255,m.reset(),m.update(p),m.update(T),m.finish(R);for(var D=0;D<b;D++)S[D]=R[D];for(var D=2;D<=g;D++){m.reset(),m.update(R).finish(R);for(var F=0;F<b;F++)S[F]^=R[F]}for(var D=0;D<b&&x*b+D<h;D++)I[x*b+D]=S[D]}for(var x=0;x<b;x++)S[x]=R[x]=0;for(var x=0;x<4;x++)T[x]=0;return m.clean(),I}r.pbkdf2=f})});var so=E((qr,oo)=>{var _t=ct(),Q=_t.Buffer;function ao(r,e){for(var t in r)e[t]=r[t]}Q.from&&Q.alloc&&Q.allocUnsafe&&Q.allocUnsafeSlow?oo.exports=_t:(ao(_t,qr),qr.Buffer=we);function we(r,e,t){return Q(r,e,t)}we.prototype=Object.create(Q.prototype);ao(Q,we);we.from=function(r,e,t){if(typeof r=="number")throw new TypeError("Argument must not be a number");return Q(r,e,t)};we.alloc=function(r,e,t){if(typeof r!="number")throw new TypeError("Argument must be a number");var n=Q(r);return e!==void 0?typeof t=="string"?n.fill(e,t):n.fill(e):n.fill(0),n};we.allocUnsafe=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return Q(r)};we.allocUnsafeSlow=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return _t.SlowBuffer(r)}});var co=E((xp,Wr)=>{"use strict";var Kr=65536,wu=4294967295;function bu(){throw new Error(`Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11`)}var Tu=so().Buffer,Rt=self.crypto||self.msCrypto;Rt&&Rt.getRandomValues?Wr.exports=vu:Wr.exports=bu;function vu(r,e){if(r>wu)throw new RangeError("requested too many random bytes");var t=Tu.allocUnsafe(r);if(r>0)if(r>Kr)for(var n=0;n<r;n+=Kr)Rt.getRandomValues(t.slice(n,n+Kr));else Rt.getRandomValues(t);return typeof e=="function"?process.nextTick(function(){e(null,t)}):t}});var go=ve(ct(),1);var ts=Object.defineProperty,rs=(r,e,t)=>e in r?ts(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,P=(r,e,t)=>rs(r,typeof e!="symbol"?e+"":e,t),Ht="asgardeo-session-active",ns=class{constructor(r,e){P(this,"_id"),P(this,"_store"),this._id=r,this._store=e}async setDataInBulk(r,e){let t=await this._store.getData(r)??null,i={...t&&JSON.parse(t),...e},a=JSON.stringify(i);await this._store.setData(r,a)}async setValue(r,e,t){let n=await this._store.getData(r)??null,a={...n&&JSON.parse(n),[e]:t},o=JSON.stringify(a);await this._store.setData(r,o)}async removeValue(r,e){let t=await this._store.getData(r)??null,i={...t&&JSON.parse(t)};delete i[e];let a=JSON.stringify(i);await this._store.setData(r,a)}_resolveKey(r,e){return e?`${r}-${this._id}-${e}`:`${r}-${this._id}`}isLocalStorageAvailable(){try{let r="__ASGARDEO_AUTH_CORE_LOCAL_STORAGE_TEST__";return localStorage.setItem(r,r),localStorage.removeItem(r),!0}catch{return!1}}async setConfigData(r){await this.setDataInBulk(this._resolveKey("config_data"),r)}async setOIDCProviderMetaData(r){this.setDataInBulk(this._resolveKey("oidc_provider_meta_data"),r)}async setTemporaryData(r,e){this.setDataInBulk(this._resolveKey("temporary_data",e),r)}async setSessionData(r,e){this.setDataInBulk(this._resolveKey("session_data",e),r)}async setCustomData(r,e,t){this.setDataInBulk(this._resolveKey(r,t),e)}async getConfigData(r){return JSON.parse(await this._store.getData(this._resolveKey("config_data",r))??null)}async loadOpenIDProviderConfiguration(){return JSON.parse(await this._store.getData(this._resolveKey("oidc_provider_meta_data"))??null)}async getTemporaryData(r){return JSON.parse(await this._store.getData(this._resolveKey("temporary_data",r))??null)}async getSessionData(r){return JSON.parse(await this._store.getData(this._resolveKey("session_data",r))??null)}async getCustomData(r,e){return JSON.parse(await this._store.getData(this._resolveKey(r,e))??null)}setSessionStatus(r){this.isLocalStorageAvailable()&&localStorage.setItem(`${Ht}`,r)}getSessionStatus(){return this.isLocalStorageAvailable()?localStorage.getItem(`${Ht}`)??"":""}removeSessionStatus(){this.isLocalStorageAvailable()&&localStorage.removeItem(`${Ht}`)}async removeConfigData(){await this._store.removeData(this._resolveKey("config_data"))}async removeOIDCProviderMetaData(){await this._store.removeData(this._resolveKey("oidc_provider_meta_data"))}async removeTemporaryData(r){await this._store.removeData(this._resolveKey("temporary_data",r))}async removeSessionData(r){await this._store.removeData(this._resolveKey("session_data",r))}async getConfigDataParameter(r){let e=await this._store.getData(this._resolveKey("config_data"));return e&&JSON.parse(e)[r]}async getOIDCProviderMetaDataParameter(r){let e=await this._store.getData(this._resolveKey("oidc_provider_meta_data"));return e&&JSON.parse(e)[r]}async getTemporaryDataParameter(r,e){let t=await this._store.getData(this._resolveKey("temporary_data",e));return t&&JSON.parse(t)[r]}async getSessionDataParameter(r,e){let t=await this._store.getData(this._resolveKey("session_data",e));return t&&JSON.parse(t)[r]}async setConfigDataParameter(r,e){await this.setValue(this._resolveKey("config_data"),r,e)}async setOIDCProviderMetaDataParameter(r,e){await this.setValue(this._resolveKey("oidc_provider_meta_data"),r,e)}async setTemporaryDataParameter(r,e,t){await this.setValue(this._resolveKey("temporary_data",t),r,e)}async setSessionDataParameter(r,e,t){await this.setValue(this._resolveKey("session_data",t),r,e)}async removeConfigDataParameter(r){await this.removeValue(this._resolveKey("config_data"),r)}async removeOIDCProviderMetaDataParameter(r){await this.removeValue(this._resolveKey("oidc_provider_meta_data"),r)}async removeTemporaryDataParameter(r,e){await this.removeValue(this._resolveKey("temporary_data",e),r)}async removeSessionDataParameter(r,e){await this.removeValue(this._resolveKey("session_data",e),r)}},Sn=ns,is={Endpoints:{AUTHORIZATION:"/oauth2/authorize",SESSION_IFRAME:"/oidc/checksession",END_SESSION:"/oidc/logout",ISSUER:"/oauth2/token",JWKS:"/oauth2/jwks",REVOCATION:"/oauth2/revoke",TOKEN:"/oauth2/token",USERINFO:"/oauth2/userinfo"},Storage:{StorageKeys:{Endpoints:{AUTHORIZATION:"authorization_endpoint",TOKEN:"token_endpoint",REVOCATION:"revocation_endpoint",END_SESSION:"end_session_endpoint",JWKS:"jwks_uri",SESSION_IFRAME:"check_session_iframe",ISSUER:"issuer",USERINFO:"userinfo_endpoint"},OPENID_PROVIDER_CONFIG_INITIATED:"op_config_initiated"}}},_=is,as={INTERNAL_LOGIN:"internal_login",OPENID:"openid",PROFILE:"profile"},Lt=as,os={Params:{AUTHORIZATION_CODE:"code",SESSION_STATE:"session_state",STATE:"state",SIGN_OUT_SUCCESS:"sign_out_success"},SignIn:{Payload:{DEFAULT_SCOPES:[Lt.OPENID,Lt.PROFILE,Lt.INTERNAL_LOGIN]}},SignOut:{Storage:{StorageKeys:{SIGN_OUT_URL:"sign_out_url"}}}},H=os,v=class{constructor(r,e,t){P(this,"name"),P(this,"code"),P(this,"message"),this.message=t,this.name=e,this.code=r,Object.setPrototypeOf(this,new.target.prototype)}},ss={SignatureValidation:{SUPPORTED_ALGORITHMS:["RS256","RS512","RS384","PS256"]},Storage:{StorageKeys:{REFRESH_TOKEN_TIMER:"refresh_token_timer"}}},je=ss,cs=class{constructor(r){P(this,"_cryptoUtils"),this._cryptoUtils=r}getCodeVerifier(){return this._cryptoUtils.base64URLEncode(this._cryptoUtils.generateRandomBytes(32))}getCodeChallenge(r){return this._cryptoUtils.base64URLEncode(this._cryptoUtils.hashSha256(r))}getJWKForTheIdToken(r,e){let t=JSON.parse(this._cryptoUtils.base64URLDecode(r));for(let n of e)if(t.kid===n.kid)return n;throw new v("JS-CRYPTO_UTIL-GJFTIT-IV01","kid not found.","Failed to find the \'kid\' specified in the id_token. \'kid\' found in the header : "+t.kid+", Expected values: "+e.map(n=>n.kid).join(", "))}isValidIdToken(r,e,t,n,i,a,o){return this._cryptoUtils.verifyJwt(r,e,je.SignatureValidation.SUPPORTED_ALGORITHMS,t,n,i,a,o).then(s=>s?Promise.resolve(!0):Promise.reject(new v("JS-CRYPTO_HELPER-IVIT-IV01","Invalid ID token.","ID token validation returned false")))}decodeIdToken(r){try{let e=this._cryptoUtils.base64URLDecode(r?.split(".")[1]);return JSON.parse(e)}catch(e){throw new v("JS-CRYPTO_UTIL-DIT-IV01","Decoding ID token failed.",e)}}},us={DEFAULT_CODE_CHALLENGE_METHOD:"S256",Storage:{StorageKeys:{CODE_VERIFIER:"pkce_code_verifier",SEPARATOR:"#"}}},oe=us,ls=r=>{let e=parseInt(r.split("request_")[1]);return`${oe.Storage.StorageKeys.CODE_VERIFIER}${oe.Storage.StorageKeys.SEPARATOR}${e}`},ye=ls,fs={Placeholders:{ACCESS_TOKEN:"{{accessToken}}",USERNAME:"{{username}}",SCOPES:"{{scopes}}",CLIENT_ID:"{{clientId}}",CLIENT_SECRET:"{{clientSecret}}"}},We=fs,ds=r=>{let e={...r};["iss","aud","exp","iat","acr","amr","azp","auth_time","nonce","c_hash","at_hash","nbf","isk","sid","jti","sub"].forEach(i=>{delete e[i]});let n={};return Object.entries(e).forEach(([i,a])=>{let o=i.split("_").map((s,u)=>u===0?s:s[0].toUpperCase()+s.slice(1)).join("");n[o]=a}),n},ps=ds,hs=class En extends Error{constructor(e,t,n){let i=En.resolveOrigin(n);super(e),P(this,"code"),P(this,"origin"),this.name=new.target.name,this.code=t,this.origin=i,Error.captureStackTrace&&Error.captureStackTrace(this,new.target)}static resolveOrigin(e){return e?`@asgardeo/${e}`:"@asgardeo/javascript"}toString(){let e=`\\u{1F6E1}\\uFE0F Asgardeo - ${this.origin}:`;return`[${this.name}]\n${e} ${this.message}\n(code="${this.code}")`}},wn=class extends hs{constructor(r,e,t,n){super(r,e,t),this.details=n,Object.defineProperty(this,"name",{value:"AsgardeoRuntimeError",configurable:!0,writable:!0})}toString(){let r=this.details?`\nDetails: ${JSON.stringify(this.details,null,2)}`:"";return`[${this.name}] (code="${this.code}")${r}\nMessage: ${this.message}`}},gs=r=>{let e=[];if(r)if(Array.isArray(r))e=r;else if(typeof r=="string")e=r.split(" ");else throw new wn("Scopes must be a string or an array of strings.","processOpenIDScopes-Invalid-001","javascript","The provided scopes are not in the expected format. Please provide a string or an array of strings.");return H.SignIn.Payload.DEFAULT_SCOPES.forEach(t=>{e.includes(t)||e.push(t)}),e.join(" ")},$t=gs,ms=class{constructor(r,e){P(this,"_storageManager"),P(this,"_config"),P(this,"_oidcProviderMetaData"),P(this,"_cryptoHelper"),this._storageManager=r,this._config=async()=>this._storageManager.getConfigData(),this._oidcProviderMetaData=async()=>this._storageManager.loadOpenIDProviderConfiguration(),this._cryptoHelper=e}async resolveEndpoints(r){let e={},t=await this._config();return t.endpoints&&Object.keys(t.endpoints).forEach(n=>{let i=n.replace(/[A-Z]/g,a=>`_${a.toLowerCase()}`);e[i]=t?.endpoints?t.endpoints[n]:""}),{...r,...e}}async resolveEndpointsExplicitly(){let r={},e=await this._config(),t=[_.Storage.StorageKeys.Endpoints.AUTHORIZATION,_.Storage.StorageKeys.Endpoints.END_SESSION,_.Storage.StorageKeys.Endpoints.JWKS,_.Storage.StorageKeys.Endpoints.SESSION_IFRAME,_.Storage.StorageKeys.Endpoints.REVOCATION,_.Storage.StorageKeys.Endpoints.TOKEN,_.Storage.StorageKeys.Endpoints.ISSUER,_.Storage.StorageKeys.Endpoints.USERINFO];if(!(e.endpoints?t.every(i=>e.endpoints?Object.keys(e.endpoints).some(a=>a.replace(/[A-Z]/g,s=>`_${s.toLowerCase()}`)===i):!1):!1))throw new v("JS-AUTH_HELPER-REE-NF01","Required endpoints missing","Some or all of the required endpoints are missing in the object passed to the `endpoints` attribute of the`AuthConfig` object.");return e.endpoints&&Object.keys(e.endpoints).forEach(i=>{let a=i.replace(/[A-Z]/g,o=>`_${o.toLowerCase()}`);r[a]=e?.endpoints?e.endpoints[i]:""}),{...r}}async resolveEndpointsByBaseURL(){let r={},e=await this._config(),{baseUrl:t}=e;if(!t)throw new v("JS-AUTH_HELPER_REBO-NF01","Base URL not defined.","Base URL is not defined in AuthClient config.");return e.endpoints&&Object.keys(e.endpoints).forEach(i=>{let a=i.replace(/[A-Z]/g,o=>`_${o.toLowerCase()}`);r[a]=e?.endpoints?e.endpoints[i]:""}),{...{[_.Storage.StorageKeys.Endpoints.AUTHORIZATION]:`${t}${_.Endpoints.AUTHORIZATION}`,[_.Storage.StorageKeys.Endpoints.END_SESSION]:`${t}${_.Endpoints.END_SESSION}`,[_.Storage.StorageKeys.Endpoints.ISSUER]:`${t}${_.Endpoints.ISSUER}`,[_.Storage.StorageKeys.Endpoints.JWKS]:`${t}${_.Endpoints.JWKS}`,[_.Storage.StorageKeys.Endpoints.SESSION_IFRAME]:`${t}${_.Endpoints.SESSION_IFRAME}`,[_.Storage.StorageKeys.Endpoints.REVOCATION]:`${t}${_.Endpoints.REVOCATION}`,[_.Storage.StorageKeys.Endpoints.TOKEN]:`${t}${_.Endpoints.TOKEN}`,[_.Storage.StorageKeys.Endpoints.USERINFO]:`${t}${_.Endpoints.USERINFO}`},...r}}async validateIdToken(r){let e=(await this._storageManager.loadOpenIDProviderConfiguration()).jwks_uri,t=await this._config();if(!e||e.trim().length===0)throw new v("JS_AUTH_HELPER-VIT-NF01","JWKS endpoint not found.","No JWKS endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the JWKS endpoint passed to the SDK is empty.");let n;try{n=await fetch(e,{credentials:t.sendCookiesInRequests?"include":"same-origin"})}catch(s){throw new v("JS-AUTH_HELPER-VIT-NE02","Request to jwks endpoint failed.",s??"The request sent to get the jwks from the server failed.")}if(n.status!==200||!n.ok)throw new v("JS-AUTH_HELPER-VIT-HE03",`Invalid response status received for jwks request (${n.statusText}).`,await n.json());let{issuer:i}=await this._oidcProviderMetaData(),{keys:a}=await n.json(),o=await this._cryptoHelper.getJWKForTheIdToken(r.split(".")[0],a);return this._cryptoHelper.isValidIdToken(r,o,(await this._config()).clientId,i??"",this._cryptoHelper.decodeIdToken(r).sub,(await this._config()).tokenValidation?.idToken?.clockTolerance,(await this._config()).tokenValidation?.idToken?.validateIssuer??!0)}getAuthenticatedUserInfo(r){let e=this._cryptoHelper.decodeIdToken(r),t=e?.username??"",n=e?.given_name??"",i=e?.family_name??"",a=n&&i?`${n} ${i}`:n||i||"";return{displayName:e.preferred_username??a,username:t,...ps(e)}}async replaceCustomGrantTemplateTags(r,e){let t=await this._config(),n=await this._storageManager.getSessionData(e),i=$t(t.scopes);return typeof r!="string"?r:r.replace(We.Placeholders.ACCESS_TOKEN,n.access_token).replace(We.Placeholders.USERNAME,this.getAuthenticatedUserInfo(n.id_token).username).replace(We.Placeholders.SCOPES,i).replace(We.Placeholders.CLIENT_ID,t.clientId).replace(We.Placeholders.CLIENT_SECRET,t.clientSecret??"")}async clearSession(r){await this._storageManager.removeTemporaryData(r),await this._storageManager.removeSessionData(r)}async handleTokenResponse(r,e){if(r.status!==200||!r.ok)throw new v("JS-AUTH_HELPER-HTR-NE01",`Invalid response status received for token request (${r.statusText}).`,await r.json());let t=await r.json();if(t.created_at=new Date().getTime(),(await this._config()).tokenValidation?.idToken?.validate)return this.validateIdToken(t.id_token).then(async()=>{await this._storageManager.setSessionData(t,e);let a={accessToken:t.access_token,createdAt:t.created_at,expiresIn:t.expires_in,idToken:t.id_token,refreshToken:t.refresh_token,scope:t.scope,tokenType:t.token_type};return Promise.resolve(a)});let i={accessToken:t.access_token,createdAt:t.created_at,expiresIn:t.expires_in,idToken:t.id_token,refreshToken:t.refresh_token,scope:t.scope,tokenType:t.token_type};return await this._storageManager.setSessionData(t,e),Promise.resolve(i)}},ys=r=>{let e=[];Object.keys(r).forEach(i=>{i.startsWith(oe.Storage.StorageKeys.CODE_VERIFIER)&&e.push(i)});let t=e.sort().pop(),n=parseInt(t?.split(oe.Storage.StorageKeys.SEPARATOR)[1]??"-1");return`${oe.Storage.StorageKeys.CODE_VERIFIER}${oe.Storage.StorageKeys.SEPARATOR}${n+1}`},Ss=ys,Es=(r,e)=>{let t=parseInt(r.split(oe.Storage.StorageKeys.SEPARATOR)[1]);return e?`${e}_request_${t}`:`request_${t}`},ws=Es,bs=(r,e,t)=>{let{redirectUri:n,clientId:i,clientSecret:a,scopes:o,responseMode:s,codeChallenge:u,codeChallengeMethod:l,prompt:f}=r,c=new Map;c.set("response_type","code"),c.set("client_id",i),c.set("scope",o),c.set("redirect_uri",n),s&&c.set("response_mode",s);let p=e?.key;if(u)if(c.set("code_challenge",u),l)c.set("code_challenge_method",l);else throw new wn("Code challenge method is required when code challenge is provided.","getAuthorizeRequestUrlParams-ValidationError-001","javascript","When PKCE is enabled, the code challenge method must be provided along with the code challenge.");if(f&&c.set("prompt",f),t)for(let[g,h]of Object.entries(t))g!==""&&h!==""&&g!==H.Params.STATE&&c.set(g,h.toString());return c.set(H.Params.STATE,ws(p,t?t[H.Params.STATE]?.toString():"")),c},Ts=bs,vs={tokenValidation:{idToken:{validate:!0,validateIssuer:!0,clockTolerance:300}},enablePKCE:!0,responseMode:"query",sendCookiesInRequests:!0},qt=class ee{constructor(){P(this,"_storageManager"),P(this,"_config"),P(this,"_oidcProviderMetaData"),P(this,"_authenticationHelper"),P(this,"_cryptoUtils"),P(this,"_cryptoHelper")}async initialize(e,t,n,i){let a=e.clientId;ee._instanceID?ee._instanceID+=1:ee._instanceID=0,i&&(ee._instanceID=i),a?this._storageManager=new Sn(`instance_${ee._instanceID}-${a}`,t):this._storageManager=new Sn(`instance_${ee._instanceID}`,t),this._cryptoUtils=n,this._cryptoHelper=new cs(n),this._authenticationHelper=new ms(this._storageManager,this._cryptoHelper),this._config=async()=>await this._storageManager.getConfigData(),this._oidcProviderMetaData=async()=>await this._storageManager.loadOpenIDProviderConfiguration(),ee._authenticationHelper=this._authenticationHelper,await this._storageManager.setConfigData({...vs,...e,scope:$t(e.scopes)})}getStorageManager(){return this._storageManager}getInstanceId(){return ee._instanceID}async getSignInUrl(e,t){let n={...e};delete n?.forceInit;let i=async()=>{let a=await this._storageManager.getOIDCProviderMetaDataParameter(_.Storage.StorageKeys.Endpoints.AUTHORIZATION);if(!a||a.trim().length===0)throw new v("JS-AUTH_CORE-GAU-NF01","No authorization endpoint found.","No authorization endpoint was found in the OIDC provider meta data from the well-known endpoint or the authorization endpoint passed to the SDK is empty.");let o=new URL(a),s=await this._config(),u=await this._storageManager.getTemporaryData(t),l=await Ss(u),f,c;s.enablePKCE&&(f=this._cryptoHelper?.getCodeVerifier(),c=this._cryptoHelper?.getCodeChallenge(f),await this._storageManager.setTemporaryDataParameter(l,f,t)),n.client_secret&&(n.client_secret=s.clientSecret);let p=Ts({redirectUri:s.afterSignInUrl,clientId:s.clientId,scopes:$t(s.scopes),responseMode:s.responseMode,codeChallengeMethod:oe.DEFAULT_CODE_CHALLENGE_METHOD,codeChallenge:c,prompt:s.prompt},{key:l},n);for(let[g,h]of p.entries())o.searchParams.append(g,h);return o.toString()};return await this._storageManager.getTemporaryDataParameter(_.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED)?i():this.loadOpenIDProviderConfiguration(e?.forceInit).then(()=>i())}async requestAccessToken(e,t,n,i,a){let o=async()=>{let s=(await this._oidcProviderMetaData()).token_endpoint,u=await this._config();if(!s||s.trim().length===0)throw new v("JS-AUTH_CORE-RAT1-NF01","Token endpoint not found.","No token endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the token endpoint passed to the SDK is empty.");t&&await this._storageManager.setSessionDataParameter(H.Params.SESSION_STATE,t,i);let l=new URLSearchParams;l.set("client_id",u.clientId),u.clientSecret&&u.clientSecret.trim().length>0&&l.set("client_secret",u.clientSecret);let f=e;l.set("code",f),l.set("grant_type","authorization_code"),l.set("redirect_uri",u.afterSignInUrl),a?.params&&Object.entries(a.params).forEach(([p,g])=>{l.append(p,g)}),u.enablePKCE&&(l.set("code_verifier",`${await this._storageManager.getTemporaryDataParameter(ye(n),i)}`),await this._storageManager.removeTemporaryDataParameter(ye(n),i));let c;try{c=await fetch(s,{body:l,credentials:u.sendCookiesInRequests?"include":"same-origin",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},method:"POST"})}catch(p){throw new v("JS-AUTH_CORE-RAT1-NE02","Requesting access token failed",p??"The request to get the access token from the server failed.")}if(!c.ok)throw new v("JS-AUTH_CORE-RAT1-HE03",`Requesting access token failed with ${c.statusText}`,await c.json());return await this._authenticationHelper.handleTokenResponse(c,i)};return await this._storageManager.getTemporaryDataParameter(_.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED)?o():this.loadOpenIDProviderConfiguration(!1).then(()=>o())}async loadOpenIDProviderConfiguration(e){let t=await this._config();if(!e&&await this._storageManager.getTemporaryDataParameter(_.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED))return Promise.resolve();let n=t.wellKnownEndpoint;if(n){let i;try{if(i=await fetch(n),i.status!==200||!i.ok)throw new Error}catch{throw new v("JS-AUTH_CORE-GOPMD-HE01","Invalid well-known response","The well known endpoint response has been failed with an error.")}return await this._storageManager.setOIDCProviderMetaData(await this._authenticationHelper.resolveEndpoints(await i.json())),await this._storageManager.setTemporaryDataParameter(_.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,!0),Promise.resolve()}else if(t.baseUrl){try{await this._storageManager.setOIDCProviderMetaData(await this._authenticationHelper.resolveEndpointsByBaseURL())}catch(i){throw new v("JS-AUTH_CORE-GOPMD-IV02","Resolving endpoints failed.",i??"Resolving endpoints by base url failed.")}return await this._storageManager.setTemporaryDataParameter(_.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,!0),Promise.resolve()}else return await this._storageManager.setOIDCProviderMetaData(await this._authenticationHelper.resolveEndpointsExplicitly()),await this._storageManager.setTemporaryDataParameter(_.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,!0),Promise.resolve()}async getSignOutUrl(e){let t=(await this._oidcProviderMetaData())?.end_session_endpoint,n=await this._config();if(!t||t.trim().length===0)throw new v("JS-AUTH_CORE-GSOU-NF01","Sign-out endpoint not found.","No sign-out endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the sign-out endpoint passed to the SDK is empty.");let i=n?.afterSignOutUrl??n?.afterSignInUrl;if(!i||i.trim().length===0)throw new v("JS-AUTH_CORE-GSOU-NF03","No sign-out redirect URL found.","The sign-out redirect URL cannot be found or the URL passed to the SDK is empty. No sign-in redirect URL has been found either. ");let a=new URLSearchParams;if(a.set("post_logout_redirect_uri",i),n.sendIdTokenInLogoutRequest){let o=(await this._storageManager.getSessionData(e))?.id_token;if(!o||o.trim().length===0)throw new v("JS-AUTH_CORE-GSOU-NF02","ID token not found.","No ID token could be found. Either the session information is lost or you have not signed in.");a.set("id_token_hint",o)}else a.set("client_id",n.clientId);return a.set("state",H.Params.SIGN_OUT_SUCCESS),`${t}?${a.toString()}`}async getOpenIDProviderEndpoints(){let e=await this._oidcProviderMetaData();return{authorizationEndpoint:e.authorization_endpoint??"",checkSessionIframe:e.check_session_iframe??"",endSessionEndpoint:e.end_session_endpoint??"",introspectionEndpoint:e.introspection_endpoint??"",issuer:e.issuer??"",jwksUri:e.jwks_uri??"",registrationEndpoint:e.registration_endpoint??"",revocationEndpoint:e.revocation_endpoint??"",tokenEndpoint:e.token_endpoint??"",userinfoEndpoint:e.userinfo_endpoint??""}}async getDecodedIdToken(e,t){let n=(await this._storageManager.getSessionData(e)).id_token;return this._cryptoHelper.decodeIdToken(n??t)}async getIdToken(e){return(await this._storageManager.getSessionData(e)).id_token}async getUser(e){let t=await this._storageManager.getSessionData(e),n=this._authenticationHelper.getAuthenticatedUserInfo(t?.id_token);return Object.keys(n).forEach(i=>{(n[i]===void 0||n[i]===""||n[i]===null)&&delete n[i]}),n}async getUserSession(e){let t=await this._storageManager.getSessionData(e);return{scopes:t?.scope?.split(" "),sessionState:t?.session_state??""}}async getCrypto(){return this._cryptoHelper}async revokeAccessToken(e){let t=(await this._oidcProviderMetaData()).revocation_endpoint,n=await this._config();if(!t||t.trim().length===0)throw new v("JS-AUTH_CORE-RAT3-NF01","No revoke access token endpoint found.","No revoke access token endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the revoke access token endpoint passed to the SDK is empty.");let i=[];i.push(`client_id=${n.clientId}`),i.push(`token=${(await this._storageManager.getSessionData(e)).access_token}`),i.push("token_type_hint=access_token"),n.clientSecret&&n.clientSecret.trim().length>0&&i.push(`client_secret=${n.clientSecret}`);let a;try{a=await fetch(t,{body:i.join("&"),credentials:n.sendCookiesInRequests?"include":"same-origin",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},method:"POST"})}catch(o){throw new v("JS-AUTH_CORE-RAT3-NE02","The request to revoke access token failed.",o??"The request sent to revoke the access token failed.")}if(a.status!==200||!a.ok)throw new v("JS-AUTH_CORE-RAT3-HE03",`Invalid response status received for revoke access token request (${a.statusText}).`,await a.json());return this._authenticationHelper.clearSession(e),Promise.resolve(a)}async refreshAccessToken(e){let t=(await this._oidcProviderMetaData()).token_endpoint,n=await this._config(),i=await this._storageManager.getSessionData(e);if(!i.refresh_token)throw new v("JS-AUTH_CORE-RAT2-NF01","No refresh token found.","There was no refresh token found. Asgardeo doesn\'t return a refresh token if the refresh token grant is not enabled.");if(!t||t.trim().length===0)throw new v("JS-AUTH_CORE-RAT2-NF02","No refresh token endpoint found.","No refresh token endpoint was in the OIDC provider meta data returned by the well-known endpoint or the refresh token endpoint passed to the SDK is empty.");let a=[];a.push(`client_id=${n.clientId}`),a.push(`refresh_token=${i.refresh_token}`),a.push("grant_type=refresh_token"),n.clientSecret&&n.clientSecret.trim().length>0&&a.push(`client_secret=${n.clientSecret}`);let o;try{o=await fetch(t,{body:a.join("&"),credentials:n.sendCookiesInRequests?"include":"same-origin",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},method:"POST"})}catch(s){throw new v("JS-AUTH_CORE-RAT2-NR03","Refresh access token request failed.",s??"The request to refresh the access token failed.")}if(!o.ok)throw new v("JS-AUTH_CORE-RAT2-HE04",`Refreshing access token failed with ${o.statusText}`,await o.json());return this._authenticationHelper.handleTokenResponse(o,e)}async getAccessToken(e){return(await this._storageManager.getSessionData(e))?.access_token}async exchangeToken(e,t){let n=await this._oidcProviderMetaData(),i=await this._config(),a;if(e.tokenEndpoint&&e.tokenEndpoint.trim().length!==0?a=e.tokenEndpoint:a=n.token_endpoint,!a||a.trim().length===0)throw new v("JS-AUTH_CORE-RCG-NF01","Token endpoint not found.","No token endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the token endpoint passed to the SDK is empty.");let o=await Promise.all(Object.entries(e.data).map(async([f,c])=>{let p=await this._authenticationHelper.replaceCustomGrantTemplateTags(c,t);return`${f}=${p}`})),s={Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"};e.attachToken&&(s={...s,Authorization:`Bearer ${(await this._storageManager.getSessionData(t)).access_token}`});let u={body:o.join("&"),credentials:i.sendCookiesInRequests?"include":"same-origin",headers:new Headers(s),method:"POST"},l;try{l=await fetch(a,u)}catch(f){throw new v("JS-AUTH_CORE-RCG-NE02","The custom grant request failed.",f??"The request sent to get the custom grant failed.")}if(l.status!==200||!l.ok)throw new v("JS-AUTH_CORE-RCG-HE03",`Invalid response status received for the custom grant request. (${l.statusText})`,await l.json());return e.returnsSession?this._authenticationHelper.handleTokenResponse(l,t):Promise.resolve(await l.json())}async isSignedIn(e){let t=!!await this.getAccessToken(e),n=(await this._storageManager.getSessionData(e))?.created_at,i=(await this._storageManager.getSessionData(e))?.expires_in;if(!i)return!1;let a=parseInt(i)*1e3,o=new Date().getTime(),s=n+a>o;return t&&s}async getPKCECode(e,t){return await this._storageManager.getTemporaryDataParameter(ye(e),t)}async setPKCECode(e,t,n){return await this._storageManager.setTemporaryDataParameter(ye(t),e,n)}static isSignOutSuccessful(e){let t=new URL(e),n=t.searchParams.get(H.Params.STATE),i=!!t.searchParams.get("error");return n?n===H.Params.SIGN_OUT_SUCCESS&&!i:!1}static didSignOutFail(e){let t=new URL(e),n=t.searchParams.get(H.Params.STATE),i=!!t.searchParams.get("error");return n?n===H.Params.SIGN_OUT_SUCCESS&&i:!1}async reInitialize(e){await this._storageManager.setConfigData(e),await this.loadOpenIDProviderConfiguration(!0)}static async clearSession(e){await this._authenticationHelper.clearSession(e)}};P(qt,"_instanceID");P(qt,"_authenticationHelper");var Se=qt;var _s="\\u{1F6E1}\\uFE0F Asgardeo",Rs={level:"info",prefix:`${_s}`,timestamps:!0,showLevel:!0},Is=()=>typeof window<"u"&&typeof window.document<"u",xs=()=>typeof process<"u"&&process.versions&&process.versions.node,V={reset:"\\x1B[0m",bright:"\\x1B[1m",dim:"\\x1B[2m",red:"\\x1B[31m",green:"\\x1B[32m",yellow:"\\x1B[33m",blue:"\\x1B[34m",magenta:"\\x1B[35m",cyan:"\\x1B[36m",white:"\\x1B[37m",gray:"\\x1B[90m"},Ce={debug:"color: #6b7280; font-weight: normal;",info:"color: #2563eb; font-weight: bold;",warn:"color: #d97706; font-weight: bold;",error:"color: #dc2626; font-weight: bold;",prefix:"color: #7c3aed; font-weight: bold;",timestamp:"color: #6b7280; font-size: 0.9em;"},As=class bn{constructor(e={}){P(this,"config"),this.config={...Rs,...e}}configure(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}shouldLog(e){return e>=this.config.level}getTimestamp(){return new Date().toISOString()}getLevelString(e){switch(e){case"debug":return"DEBUG";case"info":return"INFO";case"warn":return"WARN";case"error":return"ERROR";default:return"UNKNOWN"}}formatForNode(e,t){let n=[];if(this.config.timestamps&&n.push(`${V.gray}[${this.getTimestamp()}]${V.reset}`),this.config.prefix&&n.push(`${V.magenta}${this.config.prefix}${V.reset}`),this.config.showLevel){let i=this.getLevelString(e),a;switch(e){case"debug":a=`${V.gray}[${i}]${V.reset}`;break;case"info":a=`${V.blue}[${i}]${V.reset}`;break;case"warn":a=`${V.yellow}[${i}]${V.reset}`;break;case"error":a=`${V.red}[${i}]${V.reset}`;break;default:a=`[${i}]`}n.push(a)}return n.push(t),n.join(" ")}logMessage(e,t,...n){if(this.shouldLog(e)){if(this.config.formatter){this.config.formatter(e,t,...n);return}Is()?this.logToBrowser(e,t,...n):xs()?this.logToNode(e,t,...n):console.log(t,...n)}}logToBrowser(e,t,...n){let i=[],a=[];if(this.config.timestamps&&(i.push(`%c[${this.getTimestamp()}]`),a.push(Ce.timestamp)),this.config.prefix&&(i.push(`%c${this.config.prefix}`),a.push(Ce.prefix)),this.config.showLevel){let s=this.getLevelString(e);switch(i.push(`%c[${s}]`),e){case"debug":a.push(Ce.debug);break;case"info":a.push(Ce.info);break;case"warn":a.push(Ce.warn);break;case"error":a.push(Ce.error);break;default:a.push("")}}i.push(`%c${t}`),a.push("color: inherit; font-weight: normal;");let o=i.join(" ");switch(e){case"debug":console.debug(o,...a,...n);break;case"info":console.info(o,...a,...n);break;case"warn":console.warn(o,...a,...n);break;case"error":console.error(o,...a,...n);break;default:console.log(o,...a,...n)}}logToNode(e,t,...n){let i=this.formatForNode(e,t);switch(e){case"debug":console.debug(i,...n);break;case"info":console.info(i,...n);break;case"warn":console.warn(i,...n);break;case"error":console.error(i,...n);break;default:console.log(i,...n)}}debug(e,...t){this.logMessage("debug",e,...t)}info(e,...t){this.logMessage("info",e,...t)}warn(e,...t){this.logMessage("warn",e,...t)}error(e,...t){this.logMessage("error",e,...t)}child(e){let t=this.config.prefix?`${this.config.prefix} - ${e}`:e;return new bn({...this.config,prefix:t})}setLevel(e){this.config.level=e}getLevel(){return this.config.level}},Mu=new As;var Kt="init";var Tn="sign-out",vn="http-request",_n="http-request-all",Rn="request-custom-grant",In="revoke-access-token";var xn="request-start",An="request-success";var Cn="request-finish",On="get-oidc-service-endpoints",Pn="get-basic-user-info",Un="get-decoded-id-token";var kn="get-crypto-helper",Dn="enable_http_handler",Nn="disable_http_handler",Mn="get_auth_url",Fn="request_get_token",Bn="is_authenticated",Hn="get_sign_out_url",Ln="refresh_access-token",$n="refresh-access-token-error",qn="set_session_state",Kn="start_auto_refresh_token",Wn="update_config",jn="get_id_token",Wt="check_session_signed_in",jt="check_session_signed_out",zn="get_config_data";var zt="rpIFrame",Jt="promptNoneIFrame";var Vt="sign-in-silently";var Gt="initialized-silent-sign-in",Xt="promptNoneRequestSent";var Oe="error",ze="error_description",Yt="custom_grant_config",Qt="state";var Zt="Access token is invalid";var w=class{constructor(){}static generateSuccessMessage(e){return{blob:e?.data instanceof Blob?e?.data:null,data:JSON.stringify(e??""),success:!0}}static generateFailureMessage(e){e?.toJSON&&delete e.toJSON;let t;try{if(e instanceof Error)t=JSON.stringify({name:e.name,message:e.message,stack:e.stack,...e});else if(typeof e=="object"&&e!==null)try{t=JSON.stringify(e)}catch{t=JSON.stringify({message:e.toString?e.toString():"Unknown error",originalError:String(e)})}else t=JSON.stringify(e??"Unknown error")}catch{t=JSON.stringify({message:"Error serialization failed",originalError:String(e)})}return{error:t,success:!1}}};var se=class se{constructor(){}static removeAuthorizationCode(){let e=location.href;history.pushState({},document.title,e.replace(/\\?code=.*$/,""))}static getPKCE(e){return sessionStorage.getItem(e)??""}static setPKCE(e,t){sessionStorage.setItem(e,t)}static setSignOutURL(e,t,n){sessionStorage.setItem(`${H.SignOut.Storage.StorageKeys.SIGN_OUT_URL}-instance_${n}-${t}`,e)}static getSignOutUrl(e,t){return sessionStorage.getItem(`${H.SignOut.Storage.StorageKeys.SIGN_OUT_URL}-instance_${t}-${e}`)??""}static removePKCE(e){sessionStorage.removeItem(e)}static canContinueSignIn(e,t){return!(e&&!se.hasErrorInURL()&&!se.hasAuthSearchParamsInURL()&&!t)}static isInitializedSilentSignIn(){return se.isSilentStatePresentInURL()}static wasSignInCalled(){return!!((se.hasErrorInURL()||se.hasAuthSearchParamsInURL())&&!this.isSilentStatePresentInURL())}static wasSilentSignInCalled(){let e=sessionStorage.getItem(Gt);return!!(e?JSON.parse(e):null)}static async isSignOutSuccessful(){if(Se.isSignOutSuccessful(window.location.href)){let e=window.location.href.split("?")[0];return history.pushState({},document.title,e),await Se.clearSession(),!0}return!1}static didSignOutFail(){if(Se.didSignOutFail(window.location.href)){let e=new URL(window.location.href),t=e.searchParams.get(Oe),n=e.searchParams.get(ze),i=window.location.href.split("?")[0];return history.pushState({},document.title,i),{description:n??"",error:t??""}}return!1}static isSilentStatePresentInURL(){return new URL(window.location.href).searchParams.get("state")?.includes(Vt)??!1}static hasAuthSearchParamsInURL(e=window.location.search){return/[?&]code=[^&]+/.test(e)}static hasErrorInURL(e=window.location.href){let t=new URL(e);return!!t.searchParams.get(Oe)&&t.searchParams.get(Qt)!==H.Params.SIGN_OUT_SUCCESS}static canSendPromptNoneRequest(){let e=sessionStorage.getItem(Xt);return!(e?JSON.parse(e):null)}static setPromptNoneRequestSent(e){sessionStorage.setItem(Xt,JSON.stringify(e))}static async waitTillPageRedirect(e){let t=e??3e3;await new Promise(n=>setTimeout(n,t*1e3))}};y(se,"until",(e,t=500)=>{let n=i=>e()?i():setTimeout(()=>n(i),t);return new Promise(n)});var ce=se;var ut=class{constructor(e,t){y(this,"_authenticationClient");y(this,"_storageManager");y(this,"_spaHelper");y(this,"_instanceID");y(this,"_isTokenRefreshing");this._authenticationClient=e,this._storageManager=this._authenticationClient.getStorageManager(),this._spaHelper=t,this._instanceID=this._authenticationClient.getInstanceId(),this._isTokenRefreshing=!1}enableHttpHandler(e){e?.enableHandler&&e.enableHandler()}disableHttpHandler(e){e?.disableHandler&&e.disableHandler()}initializeSessionManger(e,t,n,i,a){a.initialize(e.clientId,t.checkSessionIframe??"",n,e.checkSessionInterval??3,e.sessionRefreshInterval??300,e.afterSignInUrl,i)}async exchangeToken(e,t){let n=!0,i=!1;if(e?.tokenEndpoint){n=!1;for(let a of[...(await this._storageManager.getConfigData())?.resourceServerURLs??[],e.baseUrl])if(a&&e.tokenEndpoint?.startsWith(a)){i=!0;break}}return e.shouldReplayAfterRefresh&&this._storageManager.setTemporaryDataParameter(Yt,JSON.stringify(e)),n||i?this._authenticationClient.exchangeToken(e).then(async a=>(t&&typeof t=="function"&&t(e),e.returnsSession?(this._spaHelper.refreshAccessTokenAutomatically(this),this._authenticationClient.getUser()):a)).catch(a=>Promise.reject(a)):Promise.reject(new v("SPA-MAIN_THREAD_CLIENT-RCG-IV01","Request to the provided endpoint is prohibited.","Requests can only be sent to resource servers specified by the `resourceServerURLs` attribute while initializing the SDK. The specified token endpoint in this request cannot be found among the `resourceServerURLs`"))}async getCustomGrantConfigData(){let e=await this._storageManager.getTemporaryDataParameter(Yt);return e?JSON.parse(e):null}async refreshAccessToken(e){try{await this._authenticationClient.refreshAccessToken();let t=await this.getCustomGrantConfigData();return t&&await this.exchangeToken(t,e),this._spaHelper.refreshAccessTokenAutomatically(this),this._authenticationClient.getUser()}catch(t){let n={type:$n};return window.postMessage(n),Promise.reject(t)}}async retryFailedRequests(e){let t=e.httpClient,n=e.requestConfig,i=e.isHttpHandlerEnabled,a=e.httpErrorCallback,o=e.httpFinishCallback;await ce.until(()=>!this._isTokenRefreshing);try{let s=await t.request(n);return Promise.resolve(s)}catch(s){return i&&(typeof a=="function"&&await a(s),typeof o=="function"&&o()),Promise.reject(s)}}async httpRequest(e,t,n,i,a,o){let s=!1,u=await this._storageManager.getConfigData();for(let l of[...await u?.resourceServerURLs??[],u.baseUrl])if(l&&t?.url?.startsWith(l)){s=!0;break}return s?e.request(t).then(l=>Promise.resolve(l)).catch(async l=>{if(l?.response?.status===401||!l?.response){if(this._isTokenRefreshing)return this.retryFailedRequests({enableRetrievingSignOutURLFromSession:o,httpClient:e,httpErrorCallback:i,httpFinishCallback:a,isHttpHandlerEnabled:n,requestConfig:t});this._isTokenRefreshing=!0;let f;try{f=await this.refreshAccessToken(o),this._isTokenRefreshing=!1}catch(c){throw this._isTokenRefreshing=!1,n&&(typeof i=="function"&&await i({...l,code:Zt}),typeof a=="function"&&a()),new v("SPA-AUTH_HELPER-HR-SE01",c?.name??"Refresh token request failed.",c?.message??"An error occurred while trying to refresh the access token following a 401 response from the server.")}if(f)try{let c=await e.request(t);return Promise.resolve(c)}catch(c){return n&&(typeof i=="function"&&await i(c),typeof a=="function"&&a()),Promise.reject(c)}}return n&&(typeof i=="function"&&await i(l),typeof a=="function"&&a()),Promise.reject(l)}):Promise.reject(new v("SPA-AUTH_HELPER-HR-IV02","Request to the provided endpoint is prohibited.","Requests can only be sent to resource servers specified by the `resourceServerURLs` attribute while initializing the SDK. The specified endpoint in this request cannot be found among the `resourceServerURLs`"))}async httpRequestAll(e,t,n,i,a){let o=!0,s=await this._storageManager.getConfigData();for(let l of e){let f=!1;for(let c of[...(await s)?.resourceServerURLs??[],s.baseUrl])if(c&&l.url?.startsWith(c)){f=!0;break}if(!f){o=!1;break}}let u=[];if(o)return e.forEach(l=>{u.push(t.request(l))}),t?.all&&t.all(u).then(l=>Promise.resolve(l)).catch(async l=>{if(l?.response?.status===401||!l?.response){let f;try{f=await this._authenticationClient.refreshAccessToken()}catch(c){throw n&&(typeof i=="function"&&await i({...l,code:Zt}),typeof a=="function"&&a()),new v("SPA-AUTH_HELPER-HRA-SE01",c?.name??"Refresh token request failed.",c?.message??"An error occurred while trying to refresh the access token following a 401 response from the server.")}if(f)return t.all&&t.all(u).then(c=>Promise.resolve(c)).catch(async c=>(n&&(typeof i=="function"&&await i(c),typeof a=="function"&&a()),Promise.reject(c)))}return n&&(typeof i=="function"&&await i(l),typeof a=="function"&&a()),Promise.reject(l)});throw new v("SPA-AUTH_HELPER-HRA-IV02","Request to the provided endpoint is prohibited.","Requests can only be sent to resource servers specified by the `resourceServerURLs` attribute while initializing the SDK. The specified endpoint in this request cannot be found among the `resourceServerURLs`")}async requestAccessToken(e,t,n,i,a,o){let s=await this._storageManager.getConfigData();if(s.storage==="browserMemory"&&s.enablePKCE&&t){let u=ce.getPKCE(ye(t));await this._authenticationClient.setPKCECode(ye(t),u)}else s.storage==="webWorker"&&i&&await this._authenticationClient.setPKCECode(i,a??"");return e?this._authenticationClient.requestAccessToken(e,t??"",a??"",void 0,o).then(async()=>(s.storage!=="webWorker"?(ce.setSignOutURL(await this._authenticationClient.getSignOutUrl(),s.clientId,this._instanceID),this._spaHelper&&(this._spaHelper.clearRefreshTokenTimeout(),this._spaHelper.refreshAccessTokenAutomatically(this)),n&&typeof n=="function"&&s.syncSession&&n()):this._spaHelper&&this._spaHelper.refreshAccessTokenAutomatically(this),this._authenticationClient.getUser())).catch(u=>Promise.reject(u)):Promise.reject(new v("SPA-AUTH_HELPER-RAT1-NF01","No authorization code.","No authorization code was found."))}async signInSilently(e,t,n,i,a){if(ce.isInitializedSilentSignIn())return await n.receivePromptNoneResponse(),Promise.resolve({allowedScopes:"",displayName:"",email:"",sessionState:"",sub:"",tenantDomain:"",username:""});let s=document.getElementById(zt)?.contentDocument?.getElementById(Jt);try{let u=await e(i);s.src=u}catch(u){return Promise.reject(u)}return new Promise((u,l)=>{let f=setTimeout(()=>{u(!1)},1e4),c=async p=>{let g=p.data;g?.type==jt&&(window.removeEventListener("message",c),clearTimeout(f),u(!1)),g?.type==Wt&&g?.data?.code&&t(g?.data?.code,g?.data?.sessionState,g?.data?.state,a).then(h=>{window.removeEventListener("message",c),u(h)}).catch(h=>{window.removeEventListener("message",c),l(h)}).finally(()=>{clearTimeout(f)})};window.addEventListener("message",c)})}async handleSignIn(e,t,n){let i=await this._storageManager.getConfigData();if(await e())return Promise.resolve({allowedScopes:"",displayName:"",email:"",sessionState:"",sub:"",tenantDomain:"",username:""});if(i.storage!=="webWorker"&&await this._authenticationClient.isSignedIn())return this._spaHelper.clearRefreshTokenTimeout(),this._spaHelper.refreshAccessTokenAutomatically(this),i.syncSession&&t(),Promise.resolve(await this._authenticationClient.getUser());let a=new URL(window.location.href).searchParams.get(Oe),o=new URL(window.location.href).searchParams.get(ze);if(a){let s=new URL(window.location.href);throw s.searchParams.delete(Oe),s.searchParams.delete(ze),history.pushState(null,document.title,s.toString()),new v("SPA-AUTH_HELPER-SI-SE01",a,o??"")}if(i.storage==="webWorker"&&n){let s=await n();if(s)return s}return Promise.resolve(void 0)}async attachTokenToRequestConfig(e){let t={attachToken:!0,...e};t.attachToken&&(t.shouldAttachIDPAccessToken?e.headers={...e.headers,Authorization:`Bearer ${await this.getIDPAccessToken()}`}:e.headers={...e.headers,Authorization:`Bearer ${await this.getAccessToken()}`})}async getUser(){return this._authenticationClient.getUser()}async getDecodedIdToken(e){return this._authenticationClient.getDecodedIdToken(e)}async getDecodedIDPIDToken(){return this._authenticationClient.getDecodedIdToken()}async getCrypto(){return this._authenticationClient.getCrypto()}async getIdToken(){return this._authenticationClient.getIdToken()}async getOpenIDProviderEndpoints(){return this._authenticationClient.getOpenIDProviderEndpoints()}async getAccessToken(e){return this._authenticationClient.getAccessToken(e)}async getIDPAccessToken(){return(await this._storageManager.getSessionData())?.access_token}getStorageManager(){return this._storageManager}async isSignedIn(){return this._authenticationClient.isSignedIn()}};var lt=class{constructor(e){y(this,"_authenticationClient");y(this,"_storageManager");this._authenticationClient=e,this._storageManager=this._authenticationClient.getStorageManager()}async refreshAccessTokenAutomatically(e){if(!((await this._storageManager.getConfigData())?.periodicTokenRefresh??!1))return;let n=await this._storageManager.getSessionData();if(n.refresh_token){let i=parseInt(n.expires_in),a=i<=10?i:i-10,o=setTimeout(async()=>{await e.refreshAccessToken()},a*1e3);await this._storageManager.setTemporaryDataParameter(je.Storage.StorageKeys.REFRESH_TOKEN_TIMER,JSON.stringify(o))}}async getRefreshTimeoutTimer(){return await this._storageManager.getTemporaryDataParameter(je.Storage.StorageKeys.REFRESH_TOKEN_TIMER)?JSON.parse(await this._storageManager.getTemporaryDataParameter(je.Storage.StorageKeys.REFRESH_TOKEN_TIMER)):-1}async clearRefreshTokenTimeout(e){if(e){clearTimeout(e);return}let t=await this.getRefreshTimeoutTimer();t!==-1&&clearTimeout(t)}};var Et=ve(_a(),1);function Ra(){return r=>{}}var U=class{constructor(){y(this,"attachToken",()=>Promise.resolve());y(this,"requestStartCallback",()=>null);y(this,"requestSuccessCallback",()=>null);y(this,"requestErrorCallback",()=>null);y(this,"requestFinishCallback",()=>null);this.init=this.init.bind(this),this.setHttpRequestErrorCallback=this.setHttpRequestErrorCallback.bind(this),this.setHttpRequestFinishCallback=this.setHttpRequestFinishCallback.bind(this),this.setHttpRequestStartCallback=this.setHttpRequestStartCallback.bind(this),this.setHttpRequestSuccessCallback=this.setHttpRequestSuccessCallback.bind(this)}static getInstance(){return this.axiosInstance?this.axiosInstance:(this.axiosInstance=Et.default.create({withCredentials:!0}),this.clientInstance||(this.clientInstance=new U),this.axiosInstance.interceptors.request.use(async e=>await this.clientInstance.requestHandler(e)),this.axiosInstance.interceptors.response.use(e=>this.clientInstance.successHandler(e),e=>this.clientInstance.errorHandler(e)),this.axiosInstance.all=Et.default.all,this.axiosInstance.spread=Et.default.spread,this.axiosInstance.init=this.clientInstance.init,this.axiosInstance.enableHandler=this.clientInstance.enableHandler,this.axiosInstance.disableHandler=this.clientInstance.disableHandler,this.axiosInstance.disableHandlerWithTimeout=this.clientInstance.disableHandlerWithTimeout,this.axiosInstance.setHttpRequestStartCallback=this.clientInstance.setHttpRequestStartCallback,this.axiosInstance.setHttpRequestSuccessCallback=this.clientInstance.setHttpRequestSuccessCallback,this.axiosInstance.setHttpRequestErrorCallback=this.clientInstance.setHttpRequestErrorCallback,this.axiosInstance.setHttpRequestFinishCallback=this.clientInstance.setHttpRequestFinishCallback,this.axiosInstance)}async requestHandler(e){if(await this.attachToken(e),e?.shouldEncodeToFormData){let t=e?.data,n=new FormData;Object.keys(t).forEach(i=>{n.append(i,t[i])}),e.data=n}return e.startTimeInMs=new Date().getTime(),U.isHandlerEnabled&&this.requestStartCallback&&typeof this.requestStartCallback=="function"&&this.requestStartCallback(e),e}errorHandler(e){throw U.isHandlerEnabled&&(this.requestErrorCallback&&typeof this.requestErrorCallback=="function"&&this.requestErrorCallback(e),this.requestFinishCallback&&typeof this.requestFinishCallback=="function"&&this.requestFinishCallback()),e}successHandler(e){return U.isHandlerEnabled&&(this.requestSuccessCallback&&typeof this.requestSuccessCallback=="function"&&this.requestSuccessCallback(e),this.requestFinishCallback&&typeof this.requestFinishCallback=="function"&&this.requestFinishCallback()),e}async init(e=!0,t){U.isHandlerEnabled=e,this.attachToken=t}enableHandler(){U.isHandlerEnabled=!0}disableHandler(){U.isHandlerEnabled=!1}disableHandlerWithTimeout(e=U.DEFAULT_HANDLER_DISABLE_TIMEOUT){U.isHandlerEnabled=!1,setTimeout(()=>{U.isHandlerEnabled=!0},e)}setHttpRequestStartCallback(e){this.requestStartCallback=e}setHttpRequestSuccessCallback(e){this.requestSuccessCallback=e}setHttpRequestErrorCallback(e){this.requestErrorCallback=e}setHttpRequestFinishCallback(e){this.requestFinishCallback=e}};y(U,"axiosInstance"),y(U,"clientInstance"),y(U,"isHandlerEnabled"),y(U,"DEFAULT_HANDLER_DISABLE_TIMEOUT",1e3),U=Gr([Ra()],U);var wt=class{constructor(){y(this,"_data");this._data=new Map}async setData(e,t){this._data.set(e,t)}async getData(e){return this._data?.get(e)??"{}"}async removeData(e){this._data.delete(e)}};var uo=ve(ct(),1);var jr=ve(Ca(),1),lo=ve(Pa(),1);var Me=new TextEncoder,re=new TextDecoder,rd=2**32;function Ua(...r){let e=r.reduce((i,{length:a})=>i+a,0),t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+=i.length;return t}function ka(r){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(r);let e=atob(r),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function he(r){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof r=="string"?r:re.decode(r),{alphabet:"base64url"});let e=r;e instanceof Uint8Array&&(e=re.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/\\s/g,"");try{return ka(e)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}var z=class extends Error{constructor(t,n){super(t,n);y(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};y(z,"code","ERR_JOSE_GENERIC");var j=class extends z{constructor(t,n,i="unspecified",a="unspecified"){super(t,{cause:{claim:i,reason:a,payload:n}});y(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");y(this,"claim");y(this,"reason");y(this,"payload");this.claim=i,this.reason=a,this.payload=n}};y(j,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");var Fe=class extends z{constructor(t,n,i="unspecified",a="unspecified"){super(t,{cause:{claim:i,reason:a,payload:n}});y(this,"code","ERR_JWT_EXPIRED");y(this,"claim");y(this,"reason");y(this,"payload");this.claim=i,this.reason=a,this.payload=n}};y(Fe,"code","ERR_JWT_EXPIRED");var Xe=class extends z{constructor(){super(...arguments);y(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}};y(Xe,"code","ERR_JOSE_ALG_NOT_ALLOWED");var L=class extends z{constructor(){super(...arguments);y(this,"code","ERR_JOSE_NOT_SUPPORTED")}};y(L,"code","ERR_JOSE_NOT_SUPPORTED");var O=class extends z{constructor(){super(...arguments);y(this,"code","ERR_JWS_INVALID")}};y(O,"code","ERR_JWS_INVALID");var Ee=class extends z{constructor(){super(...arguments);y(this,"code","ERR_JWT_INVALID")}};y(Ee,"code","ERR_JWT_INVALID");var Be=class extends z{constructor(){super(...arguments);y(this,"code","ERR_JWKS_INVALID")}};y(Be,"code","ERR_JWKS_INVALID");var Ye=class extends z{constructor(t="no applicable key found in the JSON Web Key Set",n){super(t,n);y(this,"code","ERR_JWKS_NO_MATCHING_KEY")}};y(Ye,"code","ERR_JWKS_NO_MATCHING_KEY");var Da,Na,Qe=class extends(Na=z,Da=Symbol.asyncIterator,Na){constructor(t="multiple matching keys found in the JSON Web Key Set",n){super(t,n);y(this,Da);y(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}};y(Qe,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");var Ze=class extends z{constructor(t="signature verification failed",n){super(t,n);y(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}};y(Ze,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function ne(r,e="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${r}`)}function et(r,e){return r.name===e}function Ur(r){return parseInt(r.name.slice(4),10)}function su(r){switch(r){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function cu(r,e){if(e&&!r.usages.includes(e))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${e}.`)}function Ma(r,e,t){switch(e){case"HS256":case"HS384":case"HS512":{if(!et(r.algorithm,"HMAC"))throw ne("HMAC");let n=parseInt(e.slice(2),10);if(Ur(r.algorithm.hash)!==n)throw ne(`SHA-${n}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!et(r.algorithm,"RSASSA-PKCS1-v1_5"))throw ne("RSASSA-PKCS1-v1_5");let n=parseInt(e.slice(2),10);if(Ur(r.algorithm.hash)!==n)throw ne(`SHA-${n}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!et(r.algorithm,"RSA-PSS"))throw ne("RSA-PSS");let n=parseInt(e.slice(2),10);if(Ur(r.algorithm.hash)!==n)throw ne(`SHA-${n}`,"algorithm.hash");break}case"Ed25519":case"EdDSA":{if(!et(r.algorithm,"Ed25519"))throw ne("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!et(r.algorithm,"ECDSA"))throw ne("ECDSA");let n=su(e);if(r.algorithm.namedCurve!==n)throw ne(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}cu(r,t)}function Fa(r,e,...t){if(t=t.filter(Boolean),t.length>2){let n=t.pop();r+=`one of type ${t.join(", ")}, or ${n}.`}else t.length===2?r+=`one of type ${t[0]} or ${t[1]}.`:r+=`of type ${t[0]}.`;return e==null?r+=` Received ${e}`:typeof e=="function"&&e.name?r+=` Received function ${e.name}`:typeof e=="object"&&e!=null&&e.constructor?.name&&(r+=` Received an instance of ${e.constructor.name}`),r}var Ba=(r,...e)=>Fa("Key must be ",r,...e);function kr(r,e,...t){return Fa(`Key for the ${r} algorithm must be `,e,...t)}function Dr(r){return r?.[Symbol.toStringTag]==="CryptoKey"}function Nr(r){return r?.[Symbol.toStringTag]==="KeyObject"}var Mr=r=>Dr(r)||Nr(r);var Ha=(...r)=>{let e=r.filter(Boolean);if(e.length===0||e.length===1)return!0;let t;for(let n of e){let i=Object.keys(n);if(!t||t.size===0){t=new Set(i);continue}for(let a of i){if(t.has(a))return!1;t.add(a)}}return!0};function uu(r){return typeof r=="object"&&r!==null}var G=r=>{if(!uu(r)||Object.prototype.toString.call(r)!=="[object Object]")return!1;if(Object.getPrototypeOf(r)===null)return!0;let e=r;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e};var La=(r,e)=>{if(r.startsWith("RS")||r.startsWith("PS")){let{modulusLength:t}=e.algorithm;if(typeof t!="number"||t<2048)throw new TypeError(`${r} requires key modulusLength to be 2048 bits or larger`)}};function lu(r){let e,t;switch(r.kty){case"RSA":{switch(r.alg){case"PS256":case"PS384":case"PS512":e={name:"RSA-PSS",hash:`SHA-${r.alg.slice(-3)}`},t=r.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":e={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${r.alg.slice(-3)}`},t=r.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":e={name:"RSA-OAEP",hash:`SHA-${parseInt(r.alg.slice(-3),10)||1}`},t=r.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new L(\'Invalid or unsupported JWK "alg" (Algorithm) Parameter value\')}break}case"EC":{switch(r.alg){case"ES256":e={name:"ECDSA",namedCurve:"P-256"},t=r.d?["sign"]:["verify"];break;case"ES384":e={name:"ECDSA",namedCurve:"P-384"},t=r.d?["sign"]:["verify"];break;case"ES512":e={name:"ECDSA",namedCurve:"P-521"},t=r.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:"ECDH",namedCurve:r.crv},t=r.d?["deriveBits"]:[];break;default:throw new L(\'Invalid or unsupported JWK "alg" (Algorithm) Parameter value\')}break}case"OKP":{switch(r.alg){case"Ed25519":case"EdDSA":e={name:"Ed25519"},t=r.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:r.crv},t=r.d?["deriveBits"]:[];break;default:throw new L(\'Invalid or unsupported JWK "alg" (Algorithm) Parameter value\')}break}default:throw new L(\'Invalid or unsupported JWK "kty" (Key Type) Parameter value\')}return{algorithm:e,keyUsages:t}}var vt=async r=>{if(!r.alg)throw new TypeError(\'"alg" argument is required when "jwk.alg" is not present\');let{algorithm:e,keyUsages:t}=lu(r),n={...r};return delete n.alg,delete n.use,crypto.subtle.importKey("jwk",n,e,r.ext??!r.d,r.key_ops??t)};async function $a(r,e,t){if(!G(r))throw new TypeError("JWK must be an object");let n;switch(e??(e=r.alg),n??(n=t?.extractable??r.ext),r.kty){case"oct":if(typeof r.k!="string"||!r.k)throw new TypeError(\'missing "k" (Key Value) Parameter value\');return he(r.k);case"RSA":if("oth"in r&&r.oth!==void 0)throw new L(\'RSA JWK "oth" (Other Primes Info) Parameter value is not supported\');case"EC":case"OKP":return vt({...r,alg:e,ext:n});default:throw new L(\'Unsupported "kty" (Key Type) Parameter value\')}}var qa=(r,e,t,n,i)=>{if(i.crit!==void 0&&n?.crit===void 0)throw new r(\'"crit" (Critical) Header Parameter MUST be integrity protected\');if(!n||n.crit===void 0)return new Set;if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(o=>typeof o!="string"||o.length===0))throw new r(\'"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present\');let a;t!==void 0?a=new Map([...Object.entries(t),...e.entries()]):a=e;for(let o of n.crit){if(!a.has(o))throw new L(`Extension Header Parameter "${o}" is not recognized`);if(i[o]===void 0)throw new r(`Extension Header Parameter "${o}" is missing`);if(a.get(o)&&n[o]===void 0)throw new r(`Extension Header Parameter "${o}" MUST be integrity protected`)}return new Set(n.crit)};var Ka=(r,e)=>{if(e!==void 0&&(!Array.isArray(e)||e.some(t=>typeof t!="string")))throw new TypeError(`"${r}" option must be an array of strings`);if(e)return new Set(e)};function tt(r){return G(r)&&typeof r.kty=="string"}function Wa(r){return r.kty!=="oct"&&typeof r.d=="string"}function ja(r){return r.kty!=="oct"&&typeof r.d>"u"}function za(r){return r.kty==="oct"&&typeof r.k=="string"}var He,Ja=async(r,e,t,n=!1)=>{He||(He=new WeakMap);let i=He.get(r);if(i?.[t])return i[t];let a=await vt({...e,alg:t});return n&&Object.freeze(r),i?i[t]=a:He.set(r,{[t]:a}),a},du=(r,e)=>{He||(He=new WeakMap);let t=He.get(r);if(t?.[e])return t[e];let n=r.type==="public",i=!!n,a;if(r.asymmetricKeyType==="x25519"){switch(e){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")}a=r.toCryptoKey(r.asymmetricKeyType,i,n?[]:["deriveBits"])}if(r.asymmetricKeyType==="ed25519"){if(e!=="EdDSA"&&e!=="Ed25519")throw new TypeError("given KeyObject instance cannot be used for this algorithm");a=r.toCryptoKey(r.asymmetricKeyType,i,[n?"verify":"sign"])}if(r.asymmetricKeyType==="rsa"){let o;switch(e){case"RSA-OAEP":o="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":o="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":o="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":o="SHA-512";break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}if(e.startsWith("RSA-OAEP"))return r.toCryptoKey({name:"RSA-OAEP",hash:o},i,n?["encrypt"]:["decrypt"]);a=r.toCryptoKey({name:e.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:o},i,[n?"verify":"sign"])}if(r.asymmetricKeyType==="ec"){let s=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(r.asymmetricKeyDetails?.namedCurve);if(!s)throw new TypeError("given KeyObject instance cannot be used for this algorithm");e==="ES256"&&s==="P-256"&&(a=r.toCryptoKey({name:"ECDSA",namedCurve:s},i,[n?"verify":"sign"])),e==="ES384"&&s==="P-384"&&(a=r.toCryptoKey({name:"ECDSA",namedCurve:s},i,[n?"verify":"sign"])),e==="ES512"&&s==="P-521"&&(a=r.toCryptoKey({name:"ECDSA",namedCurve:s},i,[n?"verify":"sign"])),e.startsWith("ECDH-ES")&&(a=r.toCryptoKey({name:"ECDH",namedCurve:s},i,n?[]:["deriveBits"]))}if(!a)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return t?t[e]=a:He.set(r,{[e]:a}),a},Va=async(r,e)=>{if(r instanceof Uint8Array||Dr(r))return r;if(Nr(r)){if(r.type==="secret")return r.export();if("toCryptoKey"in r&&typeof r.toCryptoKey=="function")try{return du(r,e)}catch(n){if(n instanceof TypeError)throw n}let t=r.export({format:"jwk"});return Ja(r,t,e)}if(tt(r))return r.k?he(r.k):Ja(r,r,e,!0);throw new Error("unreachable")};var Le=r=>r?.[Symbol.toStringTag],Fr=(r,e,t)=>{if(e.use!==void 0){let n;switch(t){case"sign":case"verify":n="sig";break;case"encrypt":case"decrypt":n="enc";break}if(e.use!==n)throw new TypeError(`Invalid key for this operation, its "use" must be "${n}" when present`)}if(e.alg!==void 0&&e.alg!==r)throw new TypeError(`Invalid key for this operation, its "alg" must be "${r}" when present`);if(Array.isArray(e.key_ops)){let n;switch(!0){case(t==="sign"||t==="verify"):case r==="dir":case r.includes("CBC-HS"):n=t;break;case r.startsWith("PBES2"):n="deriveBits";break;case/^A\\d{3}(?:GCM)?(?:KW)?$/.test(r):!r.includes("GCM")&&r.endsWith("KW")?n=t==="encrypt"?"wrapKey":"unwrapKey":n=t;break;case(t==="encrypt"&&r.startsWith("RSA")):n="wrapKey";break;case t==="decrypt":n=r.startsWith("RSA")?"unwrapKey":"deriveBits";break}if(n&&e.key_ops?.includes?.(n)===!1)throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${n}" when present`)}return!0},pu=(r,e,t)=>{if(!(e instanceof Uint8Array)){if(tt(e)){if(za(e)&&Fr(r,e,t))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(e))throw new TypeError(kr(r,e,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(e.type!=="secret")throw new TypeError(`${Le(e)} instances for symmetric algorithms must be of type "secret"`)}},hu=(r,e,t)=>{if(tt(e))switch(t){case"decrypt":case"sign":if(Wa(e)&&Fr(r,e,t))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if(ja(e)&&Fr(r,e,t))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!Mr(e))throw new TypeError(kr(r,e,"CryptoKey","KeyObject","JSON Web Key"));if(e.type==="secret")throw new TypeError(`${Le(e)} instances for asymmetric algorithms must not be of type "secret"`);if(e.type==="public")switch(t){case"sign":throw new TypeError(`${Le(e)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw new TypeError(`${Le(e)} instances for asymmetric algorithm decryption must be of type "private"`);default:break}if(e.type==="private")switch(t){case"verify":throw new TypeError(`${Le(e)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw new TypeError(`${Le(e)} instances for asymmetric algorithm encryption must be of type "public"`);default:break}},Ga=(r,e,t)=>{r.startsWith("HS")||r==="dir"||r.startsWith("PBES2")||/^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(r)||/^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(r)?pu(r,e,t):hu(r,e,t)};var Xa=(r,e)=>{let t=`SHA-${r.slice(-3)}`;switch(r){case"HS256":case"HS384":case"HS512":return{hash:t,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:t,name:"RSA-PSS",saltLength:parseInt(r.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:t,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:t,name:"ECDSA",namedCurve:e.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};default:throw new L(`alg ${r} is not supported either by JOSE or your javascript runtime`)}};var Ya=async(r,e,t)=>{if(e instanceof Uint8Array){if(!r.startsWith("HS"))throw new TypeError(Ba(e,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",e,{hash:`SHA-${r.slice(-3)}`,name:"HMAC"},!1,[t])}return Ma(e,r,t),e};var Qa=async(r,e,t,n)=>{let i=await Ya(r,e,"verify");La(r,i);let a=Xa(r,i.algorithm);try{return await crypto.subtle.verify(a,i,t,n)}catch{return!1}};async function Za(r,e,t){if(!G(r))throw new O("Flattened JWS must be an object");if(r.protected===void 0&&r.header===void 0)throw new O(\'Flattened JWS must have either of the "protected" or "header" members\');if(r.protected!==void 0&&typeof r.protected!="string")throw new O("JWS Protected Header incorrect type");if(r.payload===void 0)throw new O("JWS Payload missing");if(typeof r.signature!="string")throw new O("JWS Signature missing or incorrect type");if(r.header!==void 0&&!G(r.header))throw new O("JWS Unprotected Header incorrect type");let n={};if(r.protected)try{let b=he(r.protected);n=JSON.parse(re.decode(b))}catch{throw new O("JWS Protected Header is invalid")}if(!Ha(n,r.header))throw new O("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let i={...n,...r.header},a=qa(O,new Map([["b64",!0]]),t?.crit,n,i),o=!0;if(a.has("b64")&&(o=n.b64,typeof o!="boolean"))throw new O(\'The "b64" (base64url-encode payload) Header Parameter must be a boolean\');let{alg:s}=i;if(typeof s!="string"||!s)throw new O(\'JWS "alg" (Algorithm) Header Parameter missing or invalid\');let u=t&&Ka("algorithms",t.algorithms);if(u&&!u.has(s))throw new Xe(\'"alg" (Algorithm) Header Parameter value not allowed\');if(o){if(typeof r.payload!="string")throw new O("JWS Payload must be a string")}else if(typeof r.payload!="string"&&!(r.payload instanceof Uint8Array))throw new O("JWS Payload must be a string or an Uint8Array instance");let l=!1;typeof e=="function"&&(e=await e(n,r),l=!0),Ga(s,e,"verify");let f=Ua(Me.encode(r.protected??""),Me.encode("."),typeof r.payload=="string"?Me.encode(r.payload):r.payload),c;try{c=he(r.signature)}catch{throw new O("Failed to base64url decode the signature")}let p=await Va(e,s);if(!await Qa(s,p,c,f))throw new Ze;let h;if(o)try{h=he(r.payload)}catch{throw new O("Failed to base64url decode the payload")}else typeof r.payload=="string"?h=Me.encode(r.payload):h=r.payload;let m={payload:h};return r.protected!==void 0&&(m.protectedHeader=n),r.header!==void 0&&(m.unprotectedHeader=r.header),l?{...m,key:p}:m}async function eo(r,e,t){if(r instanceof Uint8Array&&(r=re.decode(r)),typeof r!="string")throw new O("Compact JWS must be a string or Uint8Array");let{0:n,1:i,2:a,length:o}=r.split(".");if(o!==3)throw new O("Invalid Compact JWS");let s=await Za({payload:i,protected:n,signature:a},e,t),u={payload:s.payload,protectedHeader:s.protectedHeader};return typeof e=="function"?{...u,key:s.key}:u}var to=r=>Math.floor(r.getTime()/1e3);var gu=/^(\\+|\\-)? ?(\\d+|\\d+\\.\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Br=r=>{let e=gu.exec(r);if(!e||e[4]&&e[1])throw new TypeError("Invalid time period format");let t=parseFloat(e[2]),n=e[3].toLowerCase(),i;switch(n){case"sec":case"secs":case"second":case"seconds":case"s":i=Math.round(t);break;case"minute":case"minutes":case"min":case"mins":case"m":i=Math.round(t*60);break;case"hour":case"hours":case"hr":case"hrs":case"h":i=Math.round(t*3600);break;case"day":case"days":case"d":i=Math.round(t*86400);break;case"week":case"weeks":case"w":i=Math.round(t*604800);break;default:i=Math.round(t*31557600);break}return e[1]==="-"||e[4]==="ago"?-i:i};var ro=r=>r.includes("/")?r.toLowerCase():`application/${r.toLowerCase()}`,mu=(r,e)=>typeof r=="string"?e.includes(r):Array.isArray(r)?e.some(Set.prototype.has.bind(new Set(r))):!1;function no(r,e,t={}){let n;try{n=JSON.parse(re.decode(e))}catch{}if(!G(n))throw new Ee("JWT Claims Set must be a top-level JSON object");let{typ:i}=t;if(i&&(typeof r.typ!="string"||ro(r.typ)!==ro(i)))throw new j(\'unexpected "typ" JWT header value\',n,"typ","check_failed");let{requiredClaims:a=[],issuer:o,subject:s,audience:u,maxTokenAge:l}=t,f=[...a];l!==void 0&&f.push("iat"),u!==void 0&&f.push("aud"),s!==void 0&&f.push("sub"),o!==void 0&&f.push("iss");for(let h of new Set(f.reverse()))if(!(h in n))throw new j(`missing required "${h}" claim`,n,h,"missing");if(o&&!(Array.isArray(o)?o:[o]).includes(n.iss))throw new j(\'unexpected "iss" claim value\',n,"iss","check_failed");if(s&&n.sub!==s)throw new j(\'unexpected "sub" claim value\',n,"sub","check_failed");if(u&&!mu(n.aud,typeof u=="string"?[u]:u))throw new j(\'unexpected "aud" claim value\',n,"aud","check_failed");let c;switch(typeof t.clockTolerance){case"string":c=Br(t.clockTolerance);break;case"number":c=t.clockTolerance;break;case"undefined":c=0;break;default:throw new TypeError("Invalid clockTolerance option type")}let{currentDate:p}=t,g=to(p||new Date);if((n.iat!==void 0||l)&&typeof n.iat!="number")throw new j(\'"iat" claim must be a number\',n,"iat","invalid");if(n.nbf!==void 0){if(typeof n.nbf!="number")throw new j(\'"nbf" claim must be a number\',n,"nbf","invalid");if(n.nbf>g+c)throw new j(\'"nbf" claim timestamp check failed\',n,"nbf","check_failed")}if(n.exp!==void 0){if(typeof n.exp!="number")throw new j(\'"exp" claim must be a number\',n,"exp","invalid");if(n.exp<=g-c)throw new Fe(\'"exp" claim timestamp check failed\',n,"exp","check_failed")}if(l){let h=g-n.iat,m=typeof l=="number"?l:Br(l);if(h-c>m)throw new Fe(\'"iat" claim timestamp check failed (too far in the past)\',n,"iat","check_failed");if(h<0-c)throw new j(\'"iat" claim timestamp check failed (it should be in the past)\',n,"iat","check_failed")}return n}async function Hr(r,e,t){let n=await eo(r,e,t);if(n.protectedHeader.crit?.includes("b64")&&n.protectedHeader.b64===!1)throw new Ee("JWTs MUST NOT use unencoded payload");let a={payload:no(n.protectedHeader,n.payload,t),protectedHeader:n.protectedHeader};return typeof e=="function"?{...a,key:n.key}:a}function yu(r){switch(typeof r=="string"&&r.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new L(\'Unsupported "alg" value for a JSON Web Key Set\')}}function Su(r){return r&&typeof r=="object"&&Array.isArray(r.keys)&&r.keys.every(Eu)}function Eu(r){return G(r)}var $e,rt,Lr=class{constructor(e){it(this,$e);it(this,rt,new WeakMap);if(!Su(e))throw new Be("JSON Web Key Set malformed");At(this,$e,structuredClone(e))}jwks(){return _e(this,$e)}async getKey(e,t){let{alg:n,kid:i}={...e,...t?.header},a=yu(n),o=_e(this,$e).keys.filter(l=>{let f=a===l.kty;if(f&&typeof i=="string"&&(f=i===l.kid),f&&typeof l.alg=="string"&&(f=n===l.alg),f&&typeof l.use=="string"&&(f=l.use==="sig"),f&&Array.isArray(l.key_ops)&&(f=l.key_ops.includes("verify")),f)switch(n){case"ES256":f=l.crv==="P-256";break;case"ES384":f=l.crv==="P-384";break;case"ES512":f=l.crv==="P-521";break;case"Ed25519":case"EdDSA":f=l.crv==="Ed25519";break}return f}),{0:s,length:u}=o;if(u===0)throw new Ye;if(u!==1){let l=new Qe,f=_e(this,rt);throw l[Symbol.asyncIterator]=async function*(){for(let c of o)try{yield await io(f,c,n)}catch{}},l}return io(_e(this,rt),s,n)}};$e=new WeakMap,rt=new WeakMap;async function io(r,e,t){let n=r.get(e)||r.set(e,{}).get(e);if(n[t]===void 0){let i=await $a({...e,ext:!0},t);if(i instanceof Uint8Array||i.type!=="public")throw new Be("JSON Web Key Set members must be public keys");n[t]=i}return n[t]}function $r(r){let e=new Lr(r),t=async(n,i)=>e.getKey(n,i);return Object.defineProperties(t,{jwks:{value:()=>structuredClone(e.jwks()),enumerable:!1,configurable:!1,writable:!1}}),t}var fo=ve(co(),1),It=class{base64URLEncode(e){return jr.default.encode(e).replace(/\\+/g,"-").replace(/\\//g,"_").replace(/=/g,"")}base64URLDecode(e){return jr.default.decode(e).toString()}hashSha256(e){return uo.Buffer.from((0,lo.default)(new TextEncoder().encode(e)))}generateRandomBytes(e){return(0,fo.default)(e)}verifyJwt(e,t,n,i,a,o,s,u){let l={algorithms:n,audience:i,clockTolerance:s,subject:o};return(u??!0)&&(l.issuer=a),Hr(e,$r({keys:[t]}),l).then(()=>Promise.resolve(!0)).catch(f=>Promise.reject(new v("SPA-CRYPTO-UTILS-VJ-IV01",f?.reason??JSON.stringify(f),`${f?.code} ${f?.claim}`)))}};var po=async(r,e)=>{let t=new wt,n=new It,i=new Se;await i.initialize(r,t,n);let a=new lt(i),o=e(i,a),s=i.getStorageManager(),u=U.getInstance(),l=async A=>{await o.attachTokenToRequestConfig(A)};return u?.init&&await u.init(!0,l),{disableHttpHandler:()=>{o.disableHttpHandler(u)},enableHttpHandler:()=>{o.enableHttpHandler(u)},getAccessToken:()=>o.getAccessToken(),getSignInUrl:async A=>i.getSignInUrl(A).then(async ie=>{let xt=new URL(ie).searchParams.get(H.Params.STATE)??"",mo=await i.getPKCECode(xt);return{authorizationURL:ie,pkce:mo}}).catch(ie=>Promise.reject(ie)),getUser:async()=>o.getUser(),getConfigData:async()=>s.getConfigData(),getCrypto:async()=>o.getCrypto(),getDecodedIDPIDToken:async()=>o.getDecodedIDPIDToken(),getDecodedIdToken:async A=>o.getDecodedIdToken(A),getIdToken:async()=>o.getIdToken(),getOpenIDProviderEndpoints:async()=>o.getOpenIDProviderEndpoints(),getSignOutUrl:async()=>await i.getSignOutUrl(),httpRequest:async A=>await o.httpRequest(u,A),httpRequestAll:async A=>await o.httpRequestAll(A,u),isSignedIn:()=>o.isSignedIn(),refreshAccessToken:async()=>{try{return await o.refreshAccessToken()}catch(A){return Promise.reject(A)}},requestAccessToken:async(A,ie,zr,xt)=>await o.requestAccessToken(A,ie,void 0,zr,xt),exchangeToken:async A=>await o.exchangeToken(A),revokeAccessToken:async()=>{let A=await a.getRefreshTimeoutTimer();return i.revokeAccessToken().then(()=>(a.clearRefreshTokenTimeout(A),Promise.resolve(!0))).catch(ie=>Promise.reject(ie))},setHttpRequestFinishCallback:A=>{u?.setHttpRequestFinishCallback&&u.setHttpRequestFinishCallback(A)},setHttpRequestStartCallback:A=>{u?.setHttpRequestStartCallback&&u.setHttpRequestStartCallback(A)},setHttpRequestSuccessCallback:A=>{u?.setHttpRequestSuccessCallback&&u.setHttpRequestSuccessCallback(A)},setSessionState:async A=>{await s.setSessionDataParameter(H.Params.SESSION_STATE,A)},signOut:async()=>(a.clearRefreshTokenTimeout(),await i.getSignOutUrl()),startAutoRefreshToken:async()=>{a.clearRefreshTokenTimeout(),a.refreshAccessTokenAutomatically(o)},reInitialize:async A=>{await i.reInitialize(A)}}};var ho=r=>{let e=self,t;e.onmessage=async({data:o,ports:s})=>{let u=s[0];if(o.type!==Kt&&!t){u.postMessage(w.generateFailureMessage(new v("SPA-CLIENT_WORKER-ONMSG-NF01","The web worker has not been initialized yet.","The initialize method needs to be called before the specified operation can be carried out.")));return}switch(o.type){case Kt:try{let l={...o.data};t=await po(l,r),t.setHttpRequestFinishCallback(a),t.setHttpRequestStartCallback(n),t.setHttpRequestSuccessCallback(i),u.postMessage(w.generateSuccessMessage())}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Mn:t.getSignInUrl(o?.data).then(l=>{u.postMessage(w.generateSuccessMessage(l))}).catch(l=>{u.postMessage(w.generateFailureMessage(l))});break;case Fn:t.requestAccessToken(o?.data?.code,o?.data?.sessionState,o?.data?.pkce,o?.data?.state).then(l=>{u.postMessage(w.generateSuccessMessage(l))}).catch(l=>{u.postMessage(w.generateFailureMessage(l))});break;case vn:{let l=o.data,f=l?.data;if(o.data?.data?.formData===!0){let c=new FormData;for(let p in f)p!=="formData"&&c.append(p,f[p]);l.data=c}t.httpRequest(l).then(c=>{u.postMessage(w.generateSuccessMessage(c))}).catch(c=>{u.postMessage(w.generateFailureMessage(c))});break}case _n:t.httpRequestAll(o.data).then(l=>{u.postMessage(w.generateSuccessMessage(l))}).catch(l=>{u.postMessage(w.generateFailureMessage(l))});break;case Tn:try{u.postMessage(w.generateSuccessMessage(await t.signOut()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Rn:t.exchangeToken(o.data).then(l=>{u.postMessage(w.generateSuccessMessage(l))}).catch(l=>{u.postMessage(w.generateFailureMessage(l))});break;case In:t.revokeAccessToken().then(l=>{u.postMessage(w.generateSuccessMessage(l))}).catch(l=>{u.postMessage(w.generateFailureMessage(l))});break;case On:try{u.postMessage(w.generateSuccessMessage(await t.getOpenIDProviderEndpoints()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Pn:try{u.postMessage(w.generateSuccessMessage(await t.getUser()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Un:try{u.postMessage(w.generateSuccessMessage(await t.getDecodedIdToken()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case kn:try{u.postMessage(w.generateSuccessMessage(await t.getCrypto()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case jn:try{u.postMessage(w.generateSuccessMessage(await t.getIdToken()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Dn:t.enableHttpHandler(),u.postMessage(w.generateSuccessMessage());break;case Nn:t.disableHttpHandler(),u.postMessage(w.generateSuccessMessage());break;case Bn:try{u.postMessage(w.generateSuccessMessage(await t.isSignedIn()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Hn:try{u.postMessage(w.generateSuccessMessage(await t.getSignOutUrl()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Ln:try{u.postMessage(w.generateSuccessMessage(await t.refreshAccessToken()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Kn:try{u.postMessage(w.generateSuccessMessage(t.startAutoRefreshToken()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case qn:try{u.postMessage(w.generateSuccessMessage(await t.setSessionState(o?.data)))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Wn:try{u.postMessage(w.generateSuccessMessage(await t.reInitialize(o?.data)))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case zn:try{u.postMessage(w.generateSuccessMessage(await t.getConfigData()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;default:u?.postMessage(w.generateFailureMessage(new v("SPA-CLIENT_WORKER-ONMSG-IV02","The message type is invalid.",`The message type provided, ${o.type}, is invalid.`)))}};let n=()=>{e.postMessage({type:xn})},i=o=>{e.postMessage({data:JSON.stringify(o??""),type:An})},a=()=>{e.postMessage({type:Cn})}};typeof self<"u"&&!self.Buffer&&(self.Buffer=go.Buffer);typeof self<"u"&&(self.global||(self.global=self));ho((r,e)=>new ut(r,e));var sh={};})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n\nbuffer/index.js:\n (*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n *)\n\nsafe-buffer/index.js:\n (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n');
1972
+ return inlineWorker('(()=>{var yi=Object.create;var nt=Object.defineProperty;var Jr=Object.getOwnPropertyDescriptor;var Si=Object.getOwnPropertyNames;var Ei=Object.getPrototypeOf,wi=Object.prototype.hasOwnProperty;var Vr=r=>{throw TypeError(r)};var bi=(r,e,t)=>e in r?nt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var E=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Ti=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Si(e))!wi.call(r,a)&&a!==t&&nt(r,a,{get:()=>e[a],enumerable:!(n=Jr(e,a))||n.enumerable});return r};var ve=(r,e,t)=>(t=r!=null?yi(Ei(r)):{},Ti(e||!r||!r.__esModule?nt(t,"default",{value:r,enumerable:!0}):t,r));var Gr=(r,e,t,n)=>{for(var a=n>1?void 0:n?Jr(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(a=(n?i(e,t,a):i(a))||a);return n&&a&&nt(e,t,a),a};var y=(r,e,t)=>bi(r,typeof e!="symbol"?e+"":e,t),Xr=(r,e,t)=>e.has(r)||Vr("Cannot "+t);var _e=(r,e,t)=>(Xr(r,e,"read from private field"),t?t.call(r):e.get(r)),at=(r,e,t)=>e.has(r)?Vr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),At=(r,e,t,n)=>(Xr(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var Zr=E(ot=>{"use strict";ot.byteLength=_i;ot.toByteArray=Ii;ot.fromByteArray=Ci;var X=[],J=[],vi=typeof Uint8Array<"u"?Uint8Array:Array,Ct="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ge=0,Yr=Ct.length;ge<Yr;++ge)X[ge]=Ct[ge],J[Ct.charCodeAt(ge)]=ge;var ge,Yr;J[45]=62;J[95]=63;function Qr(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function _i(r){var e=Qr(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Ri(r,e,t){return(e+t)*3/4-t}function Ii(r){var e,t=Qr(r),n=t[0],a=t[1],o=new vi(Ri(r,n,a)),i=0,s=a>0?n-4:n,u;for(u=0;u<s;u+=4)e=J[r.charCodeAt(u)]<<18|J[r.charCodeAt(u+1)]<<12|J[r.charCodeAt(u+2)]<<6|J[r.charCodeAt(u+3)],o[i++]=e>>16&255,o[i++]=e>>8&255,o[i++]=e&255;return a===2&&(e=J[r.charCodeAt(u)]<<2|J[r.charCodeAt(u+1)]>>4,o[i++]=e&255),a===1&&(e=J[r.charCodeAt(u)]<<10|J[r.charCodeAt(u+1)]<<4|J[r.charCodeAt(u+2)]>>2,o[i++]=e>>8&255,o[i++]=e&255),o}function xi(r){return X[r>>18&63]+X[r>>12&63]+X[r>>6&63]+X[r&63]}function Ai(r,e,t){for(var n,a=[],o=e;o<t;o+=3)n=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),a.push(xi(n));return a.join("")}function Ci(r){for(var e,t=r.length,n=t%3,a=[],o=16383,i=0,s=t-n;i<s;i+=o)a.push(Ai(r,i,i+o>s?s:i+o));return n===1?(e=r[t-1],a.push(X[e>>2]+X[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],a.push(X[e>>10]+X[e>>4&63]+X[e<<2&63]+"=")),a.join("")}});var en=E(Ot=>{Ot.read=function(r,e,t,n,a){var o,i,s=a*8-n-1,u=(1<<s)-1,l=u>>1,f=-7,c=t?a-1:0,p=t?-1:1,g=r[e+c];for(c+=p,o=g&(1<<-f)-1,g>>=-f,f+=s;f>0;o=o*256+r[e+c],c+=p,f-=8);for(i=o&(1<<-f)-1,o>>=-f,f+=n;f>0;i=i*256+r[e+c],c+=p,f-=8);if(o===0)o=1-l;else{if(o===u)return i?NaN:(g?-1:1)*(1/0);i=i+Math.pow(2,n),o=o-l}return(g?-1:1)*i*Math.pow(2,o-n)};Ot.write=function(r,e,t,n,a,o){var i,s,u,l=o*8-a-1,f=(1<<l)-1,c=f>>1,p=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:o-1,h=n?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,i=f):(i=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-i))<1&&(i--,u*=2),i+c>=1?e+=p/u:e+=p*Math.pow(2,1-c),e*u>=2&&(i++,u/=2),i+c>=f?(s=0,i=f):i+c>=1?(s=(e*u-1)*Math.pow(2,a),i=i+c):(s=e*Math.pow(2,c-1)*Math.pow(2,a),i=0));a>=8;r[t+g]=s&255,g+=h,s/=256,a-=8);for(i=i<<a|s,l+=a;l>0;r[t+g]=i&255,g+=h,i/=256,l-=8);r[t+g-h]|=m*128}});var ct=E(Ae=>{"use strict";var Pt=Zr(),Ie=en(),tn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ae.Buffer=d;Ae.SlowBuffer=Ni;Ae.INSPECT_MAX_BYTES=50;var it=2147483647;Ae.kMaxLength=it;d.TYPED_ARRAY_SUPPORT=Oi();!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Oi(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}});Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function Z(r){if(r>it)throw new RangeError(\'The value "\'+r+\'" is invalid for option "size"\');let e=new Uint8Array(r);return Object.setPrototypeOf(e,d.prototype),e}function d(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError(\'The "string" argument must be of type string. Received type number\');return Nt(r)}return on(r,e,t)}d.poolSize=8192;function on(r,e,t){if(typeof r=="string")return Ui(r,e);if(ArrayBuffer.isView(r))return ki(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(Y(r,ArrayBuffer)||r&&Y(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Y(r,SharedArrayBuffer)||r&&Y(r.buffer,SharedArrayBuffer)))return kt(r,e,t);if(typeof r=="number")throw new TypeError(\'The "value" argument must not be of type number. Received type number\');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return d.from(n,e,t);let a=Di(r);if(a)return a;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return d.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}d.from=function(r,e,t){return on(r,e,t)};Object.setPrototypeOf(d.prototype,Uint8Array.prototype);Object.setPrototypeOf(d,Uint8Array);function sn(r){if(typeof r!="number")throw new TypeError(\'"size" argument must be of type number\');if(r<0)throw new RangeError(\'The value "\'+r+\'" is invalid for option "size"\')}function Pi(r,e,t){return sn(r),r<=0?Z(r):e!==void 0?typeof t=="string"?Z(r).fill(e,t):Z(r).fill(e):Z(r)}d.alloc=function(r,e,t){return Pi(r,e,t)};function Nt(r){return sn(r),Z(r<0?0:Mt(r)|0)}d.allocUnsafe=function(r){return Nt(r)};d.allocUnsafeSlow=function(r){return Nt(r)};function Ui(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!d.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=cn(r,e)|0,n=Z(t),a=n.write(r,e);return a!==t&&(n=n.slice(0,a)),n}function Ut(r){let e=r.length<0?0:Mt(r.length)|0,t=Z(e);for(let n=0;n<e;n+=1)t[n]=r[n]&255;return t}function ki(r){if(Y(r,Uint8Array)){let e=new Uint8Array(r);return kt(e.buffer,e.byteOffset,e.byteLength)}return Ut(r)}function kt(r,e,t){if(e<0||r.byteLength<e)throw new RangeError(\'"offset" is outside of buffer bounds\');if(r.byteLength<e+(t||0))throw new RangeError(\'"length" is outside of buffer bounds\');let n;return e===void 0&&t===void 0?n=new Uint8Array(r):t===void 0?n=new Uint8Array(r,e):n=new Uint8Array(r,e,t),Object.setPrototypeOf(n,d.prototype),n}function Di(r){if(d.isBuffer(r)){let e=Mt(r.length)|0,t=Z(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||Ft(r.length)?Z(0):Ut(r);if(r.type==="Buffer"&&Array.isArray(r.data))return Ut(r.data)}function Mt(r){if(r>=it)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+it.toString(16)+" bytes");return r|0}function Ni(r){return+r!=r&&(r=0),d.alloc(+r)}d.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==d.prototype};d.compare=function(e,t){if(Y(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(e)||!d.isBuffer(t))throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');if(e===t)return 0;let n=e.length,a=t.length;for(let o=0,i=Math.min(n,a);o<i;++o)if(e[o]!==t[o]){n=e[o],a=t[o];break}return n<a?-1:a<n?1:0};d.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};d.concat=function(e,t){if(!Array.isArray(e))throw new TypeError(\'"list" argument must be an Array of Buffers\');if(e.length===0)return d.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let a=d.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){let i=e[n];if(Y(i,Uint8Array))o+i.length>a.length?(d.isBuffer(i)||(i=d.from(i)),i.copy(a,o)):Uint8Array.prototype.set.call(a,i,o);else if(d.isBuffer(i))i.copy(a,o);else throw new TypeError(\'"list" argument must be an Array of Buffers\');o+=i.length}return a};function cn(r,e){if(d.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||Y(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \'+typeof r);let t=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let a=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Dt(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return yn(r).length;default:if(a)return n?-1:Dt(r).length;e=(""+e).toLowerCase(),a=!0}}d.byteLength=cn;function Mi(r,e,t){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return zi(this,e,t);case"utf8":case"utf-8":return ln(this,e,t);case"ascii":return Wi(this,e,t);case"latin1":case"binary":return ji(this,e,t);case"base64":return qi(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ji(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}d.prototype._isBuffer=!0;function me(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}d.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)me(this,t,t+1);return this};d.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)me(this,t,t+3),me(this,t+1,t+2);return this};d.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)me(this,t,t+7),me(this,t+1,t+6),me(this,t+2,t+5),me(this,t+3,t+4);return this};d.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?ln(this,0,e):Mi.apply(this,arguments)};d.prototype.toLocaleString=d.prototype.toString;d.prototype.equals=function(e){if(!d.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:d.compare(this,e)===0};d.prototype.inspect=function(){let e="",t=Ae.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};tn&&(d.prototype[tn]=d.prototype.inspect);d.prototype.compare=function(e,t,n,a,o){if(Y(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \'+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),a===void 0&&(a=0),o===void 0&&(o=this.length),t<0||n>e.length||a<0||o>this.length)throw new RangeError("out of range index");if(a>=o&&t>=n)return 0;if(a>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,a>>>=0,o>>>=0,this===e)return 0;let i=o-a,s=n-t,u=Math.min(i,s),l=this.slice(a,o),f=e.slice(t,n);for(let c=0;c<u;++c)if(l[c]!==f[c]){i=l[c],s=f[c];break}return i<s?-1:s<i?1:0};function un(r,e,t,n,a){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,Ft(t)&&(t=a?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(a)return-1;t=r.length-1}else if(t<0)if(a)t=0;else return-1;if(typeof e=="string"&&(e=d.from(e,n)),d.isBuffer(e))return e.length===0?-1:rn(r,e,t,n,a);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):rn(r,[e],t,n,a);throw new TypeError("val must be string, number or Buffer")}function rn(r,e,t,n,a){let o=1,i=r.length,s=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;o=2,i/=2,s/=2,t/=2}function u(f,c){return o===1?f[c]:f.readUInt16BE(c*o)}let l;if(a){let f=-1;for(l=t;l<i;l++)if(u(r,l)===u(e,f===-1?0:l-f)){if(f===-1&&(f=l),l-f+1===s)return f*o}else f!==-1&&(l-=l-f),f=-1}else for(t+s>i&&(t=i-s),l=t;l>=0;l--){let f=!0;for(let c=0;c<s;c++)if(u(r,l+c)!==u(e,c)){f=!1;break}if(f)return l}return-1}d.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};d.prototype.indexOf=function(e,t,n){return un(this,e,t,n,!0)};d.prototype.lastIndexOf=function(e,t,n){return un(this,e,t,n,!1)};function Bi(r,e,t,n){t=Number(t)||0;let a=r.length-t;n?(n=Number(n),n>a&&(n=a)):n=a;let o=e.length;n>o/2&&(n=o/2);let i;for(i=0;i<n;++i){let s=parseInt(e.substr(i*2,2),16);if(Ft(s))return i;r[t+i]=s}return i}function Fi(r,e,t,n){return st(Dt(e,r.length-t),r,t,n)}function Hi(r,e,t,n){return st(Yi(e),r,t,n)}function Li(r,e,t,n){return st(yn(e),r,t,n)}function $i(r,e,t,n){return st(Qi(e,r.length-t),r,t,n)}d.prototype.write=function(e,t,n,a){if(t===void 0)a="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")a=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,a===void 0&&(a="utf8")):(a=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");let i=!1;for(;;)switch(a){case"hex":return Bi(this,e,t,n);case"utf8":case"utf-8":return Fi(this,e,t,n);case"ascii":case"latin1":case"binary":return Hi(this,e,t,n);case"base64":return Li(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $i(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),i=!0}};d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function qi(r,e,t){return e===0&&t===r.length?Pt.fromByteArray(r):Pt.fromByteArray(r.slice(e,t))}function ln(r,e,t){t=Math.min(r.length,t);let n=[],a=e;for(;a<t;){let o=r[a],i=null,s=o>239?4:o>223?3:o>191?2:1;if(a+s<=t){let u,l,f,c;switch(s){case 1:o<128&&(i=o);break;case 2:u=r[a+1],(u&192)===128&&(c=(o&31)<<6|u&63,c>127&&(i=c));break;case 3:u=r[a+1],l=r[a+2],(u&192)===128&&(l&192)===128&&(c=(o&15)<<12|(u&63)<<6|l&63,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:u=r[a+1],l=r[a+2],f=r[a+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(c=(o&15)<<18|(u&63)<<12|(l&63)<<6|f&63,c>65535&&c<1114112&&(i=c))}}i===null?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),a+=s}return Ki(n)}var nn=4096;function Ki(r){let e=r.length;if(e<=nn)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=nn));return t}function Wi(r,e,t){let n="";t=Math.min(r.length,t);for(let a=e;a<t;++a)n+=String.fromCharCode(r[a]&127);return n}function ji(r,e,t){let n="";t=Math.min(r.length,t);for(let a=e;a<t;++a)n+=String.fromCharCode(r[a]);return n}function zi(r,e,t){let n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);let a="";for(let o=e;o<t;++o)a+=Zi[r[o]];return a}function Ji(r,e,t){let n=r.slice(e,t),a="";for(let o=0;o<n.length-1;o+=2)a+=String.fromCharCode(n[o]+n[o+1]*256);return a}d.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let a=this.subarray(e,t);return Object.setPrototypeOf(a,d.prototype),a};function F(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||F(e,t,this.length);let a=this[e],o=1,i=0;for(;++i<t&&(o*=256);)a+=this[e+i]*o;return a};d.prototype.readUintBE=d.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||F(e,t,this.length);let a=this[e+--t],o=1;for(;t>0&&(o*=256);)a+=this[e+--t]*o;return a};d.prototype.readUint8=d.prototype.readUInt8=function(e,t){return e=e>>>0,t||F(e,1,this.length),this[e]};d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||F(e,2,this.length),this[e]|this[e+1]<<8};d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||F(e,2,this.length),this[e]<<8|this[e+1]};d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||F(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};d.prototype.readBigUInt64LE=oe(function(e){e=e>>>0,xe(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Ke(e,this.length-8);let a=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(a)+(BigInt(o)<<BigInt(32))});d.prototype.readBigUInt64BE=oe(function(e){e=e>>>0,xe(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Ke(e,this.length-8);let a=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(a)<<BigInt(32))+BigInt(o)});d.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||F(e,t,this.length);let a=this[e],o=1,i=0;for(;++i<t&&(o*=256);)a+=this[e+i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*t)),a};d.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||F(e,t,this.length);let a=t,o=1,i=this[e+--a];for(;a>0&&(o*=256);)i+=this[e+--a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i};d.prototype.readInt8=function(e,t){return e=e>>>0,t||F(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};d.prototype.readInt16LE=function(e,t){e=e>>>0,t||F(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};d.prototype.readInt16BE=function(e,t){e=e>>>0,t||F(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};d.prototype.readInt32LE=function(e,t){return e=e>>>0,t||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};d.prototype.readInt32BE=function(e,t){return e=e>>>0,t||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};d.prototype.readBigInt64LE=oe(function(e){e=e>>>0,xe(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Ke(e,this.length-8);let a=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(a)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});d.prototype.readBigInt64BE=oe(function(e){e=e>>>0,xe(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Ke(e,this.length-8);let a=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(a)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});d.prototype.readFloatLE=function(e,t){return e=e>>>0,t||F(e,4,this.length),Ie.read(this,e,!0,23,4)};d.prototype.readFloatBE=function(e,t){return e=e>>>0,t||F(e,4,this.length),Ie.read(this,e,!1,23,4)};d.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||F(e,8,this.length),Ie.read(this,e,!0,52,8)};d.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||F(e,8,this.length),Ie.read(this,e,!1,52,8)};function W(r,e,t,n,a,o){if(!d.isBuffer(r))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(e>a||e<o)throw new RangeError(\'"value" argument is out of bounds\');if(t+n>r.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,t,n,a){if(e=+e,t=t>>>0,n=n>>>0,!a){let s=Math.pow(2,8*n)-1;W(this,e,t,n,s,0)}let o=1,i=0;for(this[t]=e&255;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n};d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,t,n,a){if(e=+e,t=t>>>0,n=n>>>0,!a){let s=Math.pow(2,8*n)-1;W(this,e,t,n,s,0)}let o=n-1,i=1;for(this[t+o]=e&255;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n};d.prototype.writeUint8=d.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,1,255,0),this[t]=e&255,t+1};d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function fn(r,e,t,n,a){mn(e,n,a,r,t,7);let o=Number(e&BigInt(4294967295));r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o;let i=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=i,i=i>>8,r[t++]=i,i=i>>8,r[t++]=i,i=i>>8,r[t++]=i,t}function dn(r,e,t,n,a){mn(e,n,a,r,t,7);let o=Number(e&BigInt(4294967295));r[t+7]=o,o=o>>8,r[t+6]=o,o=o>>8,r[t+5]=o,o=o>>8,r[t+4]=o;let i=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=i,i=i>>8,r[t+2]=i,i=i>>8,r[t+1]=i,i=i>>8,r[t]=i,t+8}d.prototype.writeBigUInt64LE=oe(function(e,t=0){return fn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});d.prototype.writeBigUInt64BE=oe(function(e,t=0){return dn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});d.prototype.writeIntLE=function(e,t,n,a){if(e=+e,t=t>>>0,!a){let u=Math.pow(2,8*n-1);W(this,e,t,n,u-1,-u)}let o=0,i=1,s=0;for(this[t]=e&255;++o<n&&(i*=256);)e<0&&s===0&&this[t+o-1]!==0&&(s=1),this[t+o]=(e/i>>0)-s&255;return t+n};d.prototype.writeIntBE=function(e,t,n,a){if(e=+e,t=t>>>0,!a){let u=Math.pow(2,8*n-1);W(this,e,t,n,u-1,-u)}let o=n-1,i=1,s=0;for(this[t+o]=e&255;--o>=0&&(i*=256);)e<0&&s===0&&this[t+o+1]!==0&&(s=1),this[t+o]=(e/i>>0)-s&255;return t+n};d.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};d.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};d.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};d.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||W(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};d.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||W(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]=e&255,t+4};d.prototype.writeBigInt64LE=oe(function(e,t=0){return fn(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});d.prototype.writeBigInt64BE=oe(function(e,t=0){return dn(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function pn(r,e,t,n,a,o){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function hn(r,e,t,n,a){return e=+e,t=t>>>0,a||pn(r,e,t,4,34028234663852886e22,-34028234663852886e22),Ie.write(r,e,t,n,23,4),t+4}d.prototype.writeFloatLE=function(e,t,n){return hn(this,e,t,!0,n)};d.prototype.writeFloatBE=function(e,t,n){return hn(this,e,t,!1,n)};function gn(r,e,t,n,a){return e=+e,t=t>>>0,a||pn(r,e,t,8,17976931348623157e292,-17976931348623157e292),Ie.write(r,e,t,n,52,8),t+8}d.prototype.writeDoubleLE=function(e,t,n){return gn(this,e,t,!0,n)};d.prototype.writeDoubleBE=function(e,t,n){return gn(this,e,t,!1,n)};d.prototype.copy=function(e,t,n,a){if(!d.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!a&&a!==0&&(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a<n&&(a=n),a===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t<a-n&&(a=e.length-t+n);let o=a-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,a):Uint8Array.prototype.set.call(e,this.subarray(n,a),t),o};d.prototype.fill=function(e,t,n,a){if(typeof e=="string"){if(typeof t=="string"?(a=t,t=0,n=this.length):typeof n=="string"&&(a=n,n=this.length),a!==void 0&&typeof a!="string")throw new TypeError("encoding must be a string");if(typeof a=="string"&&!d.isEncoding(a))throw new TypeError("Unknown encoding: "+a);if(e.length===1){let i=e.charCodeAt(0);(a==="utf8"&&i<128||a==="latin1")&&(e=i)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let o;if(typeof e=="number")for(o=t;o<n;++o)this[o]=e;else{let i=d.isBuffer(e)?e:d.from(e,a),s=i.length;if(s===0)throw new TypeError(\'The value "\'+e+\'" is invalid for argument "value"\');for(o=0;o<n-t;++o)this[o+t]=i[o%s]}return this};var Re={};function Bt(r,e,t){Re[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(a){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:a,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}Bt("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Bt("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);Bt("ERR_OUT_OF_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range.`,a=t;return Number.isInteger(t)&&Math.abs(t)>2**32?a=an(String(t)):typeof t=="bigint"&&(a=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(a=an(a)),a+="n"),n+=` It must be ${e}. Received ${a}`,n},RangeError);function an(r){let e="",t=r.length,n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function Vi(r,e,t){xe(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&Ke(e,r.length-(t+1))}function mn(r,e,t,n,a,o){if(r>t||r<e){let i=typeof e=="bigint"?"n":"",s;throw o>3?e===0||e===BigInt(0)?s=`>= 0${i} and < 2${i} ** ${(o+1)*8}${i}`:s=`>= -(2${i} ** ${(o+1)*8-1}${i}) and < 2 ** ${(o+1)*8-1}${i}`:s=`>= ${e}${i} and <= ${t}${i}`,new Re.ERR_OUT_OF_RANGE("value",s,r)}Vi(n,a,o)}function xe(r,e){if(typeof r!="number")throw new Re.ERR_INVALID_ARG_TYPE(e,"number",r)}function Ke(r,e,t){throw Math.floor(r)!==r?(xe(r,t),new Re.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new Re.ERR_BUFFER_OUT_OF_BOUNDS:new Re.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var Gi=/[^+/0-9A-Za-z-_]/g;function Xi(r){if(r=r.split("=")[0],r=r.trim().replace(Gi,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Dt(r,e){e=e||1/0;let t,n=r.length,a=null,o=[];for(let i=0;i<n;++i){if(t=r.charCodeAt(i),t>55295&&t<57344){if(!a){if(t>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(i+1===n){(e-=3)>-1&&o.push(239,191,189);continue}a=t;continue}if(t<56320){(e-=3)>-1&&o.push(239,191,189),a=t;continue}t=(a-55296<<10|t-56320)+65536}else a&&(e-=3)>-1&&o.push(239,191,189);if(a=null,t<128){if((e-=1)<0)break;o.push(t)}else if(t<2048){if((e-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function Yi(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function Qi(r,e){let t,n,a,o=[];for(let i=0;i<r.length&&!((e-=2)<0);++i)t=r.charCodeAt(i),n=t>>8,a=t%256,o.push(a),o.push(n);return o}function yn(r){return Pt.toByteArray(Xi(r))}function st(r,e,t,n){let a;for(a=0;a<n&&!(a+t>=e.length||a>=r.length);++a)e[a+t]=r[a];return a}function Y(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function Ft(r){return r!==r}var Zi=(function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let a=0;a<16;++a)e[n+a]=r[t]+r[a]}return e})();function oe(r){return typeof BigInt>"u"?es:r}function es(){throw new Error("BigInt not supported")}});var er=E((jl,Jn)=>{"use strict";Jn.exports=function(e,t){return function(){return e.apply(t,arguments)}}});var k=E((zl,Yn)=>{"use strict";var Os=er(),nr=Object.prototype.toString,ar=(function(r){return function(e){var t=nr.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())}})(Object.create(null));function ue(r){return r=r.toLowerCase(),function(t){return ar(t)===r}}function dt(r){return Array.isArray(r)}function tr(r){return typeof r>"u"}function Ps(r){return r!==null&&!tr(r)&&r.constructor!==null&&!tr(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}var Vn=ue("ArrayBuffer");function Us(r){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Vn(r.buffer),e}function ks(r){return typeof r=="string"}function Gn(r){return typeof r=="number"}function Xn(r){return r!==null&&typeof r=="object"}function ft(r){if(ar(r)!=="object")return!1;var e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}function Ds(r){return r&&Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}var Ns=ue("Date"),Ms=ue("File"),Bs=ue("Blob"),Fs=ue("FileList");function or(r){return nr.call(r)==="[object Function]"}function Hs(r){return Xn(r)&&or(r.pipe)}function Ls(r){var e="[object FormData]";return r&&(typeof FormData=="function"&&r instanceof FormData||nr.call(r)===e||or(r.toString)&&r.toString()===e)}var $s=ue("URLSearchParams");function qs(r){return r.trim?r.trim():r.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,"")}function Ks(){var r;return typeof navigator<"u"&&((r=navigator.product)==="ReactNative"||r==="NativeScript"||r==="NS")?!1:typeof window<"u"&&typeof document<"u"}function ir(r,e){if(!(r===null||typeof r>"u"))if(typeof r!="object"&&(r=[r]),dt(r))for(var t=0,n=r.length;t<n;t++)e.call(null,r[t],t,r);else for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&e.call(null,r[a],a,r)}function rr(){var r={};function e(a,o){ft(r[o])&&ft(a)?r[o]=rr(r[o],a):ft(a)?r[o]=rr({},a):dt(a)?r[o]=a.slice():r[o]=a}for(var t=0,n=arguments.length;t<n;t++)ir(arguments[t],e);return r}function Ws(r,e,t){return ir(e,function(a,o){t&&typeof a=="function"?r[o]=Os(a,t):r[o]=a}),r}function js(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}function zs(r,e,t,n){r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,t&&Object.assign(r.prototype,t)}function Js(r,e,t,n){var a,o,i,s={};if(e=e||{},r==null)return e;do{for(a=Object.getOwnPropertyNames(r),o=a.length;o-- >0;)i=a[o],(!n||n(i,r,e))&&!s[i]&&(e[i]=r[i],s[i]=!0);r=t!==!1&&Object.getPrototypeOf(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e}function Vs(r,e,t){r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;var n=r.indexOf(e,t);return n!==-1&&n===t}function Gs(r){if(!r)return null;if(dt(r))return r;var e=r.length;if(!Gn(e))return null;for(var t=new Array(e);e-- >0;)t[e]=r[e];return t}var Xs=(function(r){return function(e){return r&&e instanceof r}})(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array));function Ys(r,e){for(var t=r&&r[Symbol.iterator],n=t.call(r),a;(a=n.next())&&!a.done;){var o=a.value;e.call(r,o[0],o[1])}}function Qs(r,e){for(var t,n=[];(t=r.exec(e))!==null;)n.push(t);return n}var Zs=ue("HTMLFormElement"),ec=(function(e){return function(t,n){return e.call(t,n)}})(Object.prototype.hasOwnProperty);Yn.exports={isArray:dt,isArrayBuffer:Vn,isBuffer:Ps,isFormData:Ls,isArrayBufferView:Us,isString:ks,isNumber:Gn,isObject:Xn,isPlainObject:ft,isEmptyObject:Ds,isUndefined:tr,isDate:Ns,isFile:Ms,isBlob:Bs,isFunction:or,isStream:Hs,isURLSearchParams:$s,isStandardBrowserEnv:Ks,forEach:ir,merge:rr,extend:Ws,trim:qs,stripBOM:js,inherits:zs,toFlatObject:Js,kindOf:ar,kindOfTest:ue,endsWith:Vs,toArray:Gs,isTypedArray:Xs,isFileList:Fs,forEachEntry:Ys,matchAll:Qs,isHTMLForm:Zs,hasOwnProperty:ec}});var le=E((Jl,ta)=>{"use strict";var Qn=k();function Pe(r,e,t,n,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),a&&(this.response=a)}Qn.inherits(Pe,Error,{toJSON:function(){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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var Zn=Pe.prototype,ea={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(function(r){ea[r]={value:r}});Object.defineProperties(Pe,ea);Object.defineProperty(Zn,"isAxiosError",{value:!0});Pe.from=function(r,e,t,n,a,o){var i=Object.create(Zn);return Qn.toFlatObject(r,i,function(u){return u!==Error.prototype}),Pe.call(i,r.message,e,t,n,a),i.cause=r,i.name=r.name,o&&Object.assign(i,o),i};ta.exports=Pe});var na=E((Vl,ra)=>{"use strict";ra.exports=typeof self=="object"?self.FormData:window.FormData});var oa=E((Gl,aa)=>{aa.exports=na()});var Je=E((Xl,ca)=>{"use strict";var C=k(),tc=le(),rc=oa();function sr(r){return C.isPlainObject(r)||C.isArray(r)}function sa(r){return C.endsWith(r,"[]")?r.slice(0,-2):r}function ia(r,e,t){return r?r.concat(e).map(function(a,o){return a=sa(a),!t&&o?"["+a+"]":a}).join(t?".":""):e}function nc(r){return C.isArray(r)&&!r.some(sr)}var ac=C.toFlatObject(C,{},null,function(e){return/^is[A-Z]/.test(e)});function oc(r){return r&&C.isFunction(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator]}function ic(r,e,t){if(!C.isObject(r))throw new TypeError("target must be an object");e=e||new(rc||FormData),t=C.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,b){return!C.isUndefined(b[m])});var n=t.metaTokens,a=t.visitor||f,o=t.dots,i=t.indexes,s=t.Blob||typeof Blob<"u"&&Blob,u=s&&oc(e);if(!C.isFunction(a))throw new TypeError("visitor must be a function");function l(h){if(h===null)return"";if(C.isDate(h))return h.toISOString();if(!u&&C.isBlob(h))throw new tc("Blob is not supported. Use a Buffer instead.");return C.isArrayBuffer(h)||C.isTypedArray(h)?u&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function f(h,m,b){var T=h;if(h&&!b&&typeof h=="object"){if(C.endsWith(m,"{}"))m=n?m:m.slice(0,-2),h=JSON.stringify(h);else if(C.isArray(h)&&nc(h)||C.isFileList(h)||C.endsWith(m,"[]")&&(T=C.toArray(h)))return m=sa(m),T.forEach(function(R,I){!(C.isUndefined(R)||R===null)&&e.append(i===!0?ia([m],I,o):i===null?m:m+"[]",l(R))}),!1}return sr(h)?!0:(e.append(ia(b,m,o),l(h)),!1)}var c=[],p=Object.assign(ac,{defaultVisitor:f,convertValue:l,isVisitable:sr});function g(h,m){if(!C.isUndefined(h)){if(c.indexOf(h)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(h),C.forEach(h,function(T,S){var R=!(C.isUndefined(T)||T===null)&&a.call(e,T,C.isString(S)?S.trim():S,m,p);R===!0&&g(T,m?m.concat(S):[S])}),c.pop()}}if(!C.isObject(r))throw new TypeError("data must be an object");return g(r),e}ca.exports=ic});var cr=E((Yl,da)=>{"use strict";var sc=Je();function ua(r){var e={"!":"%21","\'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\\0"};return encodeURIComponent(r).replace(/[!\'\\(\\)~]|%20|%00/g,function(n){return e[n]})}function la(r,e){this._pairs=[],r&&sc(r,this,e)}var fa=la.prototype;fa.append=function(e,t){this._pairs.push([e,t])};fa.toString=function(e){var t=e?function(n){return e.call(this,n,ua)}:ua;return this._pairs.map(function(a){return t(a[0])+"="+t(a[1])},"").join("&")};da.exports=la});var ur=E((Ql,pa)=>{"use strict";var cc=k(),uc=cr();function lc(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}pa.exports=function(e,t,n){if(!t)return e;var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a));var o=n&&n.encode||lc,i=n&&n.serialize,s;return i?s=i(t,n):s=cc.isURLSearchParams(t)?t.toString():new uc(t,n).toString(o),s&&(e+=(e.indexOf("?")===-1?"?":"&")+s),e}});var ga=E((Zl,ha)=>{"use strict";var fc=k();function Ve(){this.handlers=[]}Ve.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};Ve.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Ve.prototype.clear=function(){this.handlers&&(this.handlers=[])};Ve.prototype.forEach=function(e){fc.forEach(this.handlers,function(n){n!==null&&e(n)})};ha.exports=Ve});var lr=E((ef,ma)=>{"use strict";var dc=k();ma.exports=function(e,t){dc.forEach(e,function(a,o){o!==t&&o.toUpperCase()===t.toUpperCase()&&(e[t]=a,delete e[o])})}});var fr=E((tf,ya)=>{"use strict";ya.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var Ea=E((rf,Sa)=>{"use strict";var pc=cr();Sa.exports=typeof URLSearchParams<"u"?URLSearchParams:pc});var ba=E((nf,wa)=>{"use strict";wa.exports=FormData});var va=E((af,Ta)=>{"use strict";Ta.exports={isBrowser:!0,classes:{URLSearchParams:Ea(),FormData:ba(),Blob},protocols:["http","https","file","blob","url","data"]}});var pt=E((of,_a)=>{"use strict";_a.exports=va()});var xa=E((sf,Ia)=>{"use strict";var hc=k(),gc=Je(),Ra=pt();Ia.exports=function(e,t){return gc(e,new Ra.classes.URLSearchParams,Object.assign({visitor:function(n,a,o,i){return Ra.isNode&&hc.isBuffer(n)?(this.append(a,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}});var dr=E((cf,Aa)=>{"use strict";var fe=k();function mc(r){return fe.matchAll(/\\w+|\\[(\\w*)]/g,r).map(function(e){return e[0]==="[]"?"":e[1]||e[0]})}function yc(r){var e={},t=Object.keys(r),n,a=t.length,o;for(n=0;n<a;n++)o=t[n],e[o]=r[o];return e}function Sc(r){function e(n,a,o,i){var s=n[i++];if(s==="__proto__")return!0;var u=Number.isFinite(+s),l=i>=n.length;if(s=!s&&fe.isArray(o)?o.length:s,l)return fe.hasOwnProperty(o,s)?o[s]=[o[s],a]:o[s]=a,!u;(!o[s]||!fe.isObject(o[s]))&&(o[s]=[]);var f=e(n,a,o[s],i);return f&&fe.isArray(o[s])&&(o[s]=yc(o[s])),!u}if(fe.isFormData(r)&&fe.isFunction(r.entries)){var t={};return fe.forEachEntry(r,function(n,a){e(mc(n),a,t,0)}),t}return null}Aa.exports=Sc});var Oa=E((uf,Ca)=>{"use strict";var pr=le();Ca.exports=function(e,t,n){var a=n.config.validateStatus;!n.status||!a||a(n.status)?e(n):t(new pr("Request failed with status code "+n.status,[pr.ERR_BAD_REQUEST,pr.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}});var Ua=E((lf,Pa)=>{"use strict";var ht=k();Pa.exports=ht.isStandardBrowserEnv()?(function(){return{write:function(t,n,a,o,i,s){var u=[];u.push(t+"="+encodeURIComponent(n)),ht.isNumber(a)&&u.push("expires="+new Date(a).toGMTString()),ht.isString(o)&&u.push("path="+o),ht.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(t){var n=document.cookie.match(new RegExp("(^|;\\\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}})():(function(){return{write:function(){},read:function(){return null},remove:function(){}}})()});var Da=E((ff,ka)=>{"use strict";ka.exports=function(e){return/^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(e)}});var Ma=E((df,Na)=>{"use strict";Na.exports=function(e,t){return t?e.replace(/\\/?\\/$/,"")+"/"+t.replace(/^\\/+/,""):e}});var hr=E((pf,Ba)=>{"use strict";var Ec=Da(),wc=Ma();Ba.exports=function(e,t,n){var a=!Ec(t);return e&&(a||n===!1)?wc(e,t):t}});var Ha=E((hf,Fa)=>{"use strict";var gr=k(),bc=["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"];Fa.exports=function(e){var t={},n,a,o;return e&&gr.forEach(e.split(`\n`),function(s){if(o=s.indexOf(":"),n=gr.trim(s.slice(0,o)).toLowerCase(),a=gr.trim(s.slice(o+1)),n){if(t[n]&&bc.indexOf(n)>=0)return;n==="set-cookie"?t[n]=(t[n]?t[n]:[]).concat([a]):t[n]=t[n]?t[n]+", "+a:a}}),t}});var qa=E((gf,$a)=>{"use strict";var La=k();$a.exports=La.isStandardBrowserEnv()?(function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),n;function a(o){var i=o;return e&&(t.setAttribute("href",i),i=t.href),t.setAttribute("href",i),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return n=a(window.location.href),function(i){var s=La.isString(i)?a(i):i;return s.protocol===n.protocol&&s.host===n.host}})():(function(){return function(){return!0}})()});var Ge=E((mf,Wa)=>{"use strict";var mr=le(),Tc=k();function Ka(r,e,t){mr.call(this,r??"canceled",mr.ERR_CANCELED,e,t),this.name="CanceledError"}Tc.inherits(Ka,mr,{__CANCEL__:!0});Wa.exports=Ka});var za=E((yf,ja)=>{"use strict";ja.exports=function(e){var t=/^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(e);return t&&t[1]||""}});var yr=E((Sf,Ja)=>{"use strict";var Ue=k(),vc=Oa(),_c=Ua(),Rc=ur(),Ic=hr(),xc=Ha(),Ac=qa(),Cc=fr(),te=le(),Oc=Ge(),Pc=za(),Uc=pt();Ja.exports=function(e){return new Promise(function(n,a){var o=e.data,i=e.headers,s=e.responseType,u=e.withXSRFToken,l;function f(){e.cancelToken&&e.cancelToken.unsubscribe(l),e.signal&&e.signal.removeEventListener("abort",l)}Ue.isFormData(o)&&Ue.isStandardBrowserEnv()&&delete i["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var p=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.Authorization="Basic "+btoa(p+":"+g)}var h=Ic(e.baseURL,e.url,e.allowAbsoluteUrls);c.open(e.method.toUpperCase(),Rc(h,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function m(){if(c){var S="getAllResponseHeaders"in c?xc(c.getAllResponseHeaders()):null,R=!s||s==="text"||s==="json"?c.responseText:c.response,I={data:R,status:c.status,statusText:c.statusText,headers:S,config:e,request:c};vc(function($){n($),f()},function($){a($),f()},I),c=null}}if("onloadend"in c?c.onloadend=m:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(m)},c.onabort=function(){c&&(a(new te("Request aborted",te.ECONNABORTED,e,c)),c=null)},c.onerror=function(){a(new te("Network Error",te.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){var R=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",I=e.transitional||Cc;e.timeoutErrorMessage&&(R=e.timeoutErrorMessage),a(new te(R,I.clarifyTimeoutError?te.ETIMEDOUT:te.ECONNABORTED,e,c)),c=null},Ue.isStandardBrowserEnv()&&(u&&Ue.isFunction(u)&&(u=u(e)),u||u!==!1&&Ac(h))){var b=e.xsrfHeaderName&&e.xsrfCookieName&&_c.read(e.xsrfCookieName);b&&(i[e.xsrfHeaderName]=b)}"setRequestHeader"in c&&Ue.forEach(i,function(R,I){typeof o>"u"&&I.toLowerCase()==="content-type"?delete i[I]:c.setRequestHeader(I,R)}),Ue.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),s&&s!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(l=function(S){c&&(a(!S||S.type?new Oc(null,e,c):S),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(l),e.signal&&(e.signal.aborted?l():e.signal.addEventListener("abort",l))),!o&&o!==!1&&o!==0&&o!==""&&(o=null);var T=Pc(h);if(T&&Uc.protocols.indexOf(T)===-1){a(new te("Unsupported protocol "+T+":",te.ERR_BAD_REQUEST,e));return}c.send(o)})}});var mt=E((Ef,Qa)=>{"use strict";var M=k(),Va=lr(),Ga=le(),kc=fr(),Dc=Je(),Nc=xa(),Xa=pt(),Mc=dr(),Bc={"Content-Type":"application/x-www-form-urlencoded"};function Ya(r,e){!M.isUndefined(r)&&M.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function Fc(){var r;return typeof XMLHttpRequest<"u"?r=yr():typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(r=yr()),r}function Hc(r,e,t){if(M.isString(r))try{return(e||JSON.parse)(r),M.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}var gt={transitional:kc,adapter:Fc(),transformRequest:[function(e,t){Va(t,"Accept"),Va(t,"Content-Type");var n=t&&t["Content-Type"]||"",a=n.indexOf("application/json")>-1,o=M.isObject(e);o&&M.isHTMLForm(e)&&(e=new FormData(e));var i=M.isFormData(e);if(i)return a?JSON.stringify(Mc(e)):e;if(M.isArrayBuffer(e)||M.isBuffer(e)||M.isStream(e)||M.isFile(e)||M.isBlob(e))return e;if(M.isArrayBufferView(e))return e.buffer;if(M.isURLSearchParams(e))return Ya(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var s;if(o){if(n.indexOf("application/x-www-form-urlencoded")!==-1)return Nc(e,this.formSerializer).toString();if((s=M.isFileList(e))||n.indexOf("multipart/form-data")>-1){var u=this.env&&this.env.FormData;return Dc(s?{"files[]":e}:e,u&&new u,this.formSerializer)}}return o||a?(Ya(t,"application/json"),Hc(e)):e}],transformResponse:[function(e){var t=this.transitional||gt.transitional,n=t&&t.forcedJSONParsing,a=this.responseType==="json";if(e&&M.isString(e)&&(n&&!this.responseType||a)){var o=t&&t.silentJSONParsing,i=!o&&a;try{return JSON.parse(e)}catch(s){if(i)throw s.name==="SyntaxError"?Ga.from(s,Ga.ERR_BAD_RESPONSE,this,null,this.response):s}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xa.classes.FormData,Blob:Xa.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};M.forEach(["delete","get","head"],function(e){gt.headers[e]={}});M.forEach(["post","put","patch"],function(e){gt.headers[e]=M.merge(Bc)});Qa.exports=gt});var eo=E((wf,Za)=>{"use strict";var Lc=k(),$c=mt();Za.exports=function(e,t,n,a){var o=this||$c;return Lc.forEach(a,function(s){e=s.call(o,e,t,n)}),e}});var Sr=E((bf,to)=>{"use strict";to.exports=function(e){return!!(e&&e.__CANCEL__)}});var oo=E((Tf,ao)=>{"use strict";var ro=k(),Er=eo(),qc=Sr(),Kc=mt(),Wc=Ge(),no=lr();function wr(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Wc}ao.exports=function(e){wr(e),e.headers=e.headers||{},e.data=Er.call(e,e.data,e.headers,null,e.transformRequest),no(e.headers,"Accept"),no(e.headers,"Content-Type"),e.headers=ro.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ro.forEach(["delete","get","head","post","put","patch","common"],function(a){delete e.headers[a]});var t=e.adapter||Kc.adapter;return t(e).then(function(a){return wr(e),a.data=Er.call(e,a.data,a.headers,a.status,e.transformResponse),a},function(a){return qc(a)||(wr(e),a&&a.response&&(a.response.data=Er.call(e,a.response.data,a.response.headers,a.response.status,e.transformResponse))),Promise.reject(a)})}});var br=E((vf,io)=>{"use strict";var q=k();io.exports=function(e,t){t=t||{};var n={};function a(f,c){return q.isPlainObject(f)&&q.isPlainObject(c)?q.merge(f,c):q.isEmptyObject(c)?q.merge({},f):q.isPlainObject(c)?q.merge({},c):q.isArray(c)?c.slice():c}function o(f){if(q.isUndefined(t[f])){if(!q.isUndefined(e[f]))return a(void 0,e[f])}else return a(e[f],t[f])}function i(f){if(!q.isUndefined(t[f]))return a(void 0,t[f])}function s(f){if(q.isUndefined(t[f])){if(!q.isUndefined(e[f]))return a(void 0,e[f])}else return a(void 0,t[f])}function u(f){if(f in t)return a(e[f],t[f]);if(f in e)return a(void 0,e[f])}var l={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:u};return q.forEach(Object.keys(e).concat(Object.keys(t)),function(c){var p=l[c]||o,g=p(c);q.isUndefined(g)&&p!==u||(n[c]=g)}),n}});var Tr=E((_f,so)=>{so.exports={version:"0.30.1"}});var lo=E((Rf,uo)=>{"use strict";var jc=Tr().version,de=le(),vr={};["object","boolean","number","function","string","symbol"].forEach(function(r,e){vr[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});var co={};vr.transitional=function(e,t,n){function a(o,i){return"[Axios v"+jc+"] Transitional option \'"+o+"\'"+i+(n?". "+n:"")}return function(o,i,s){if(e===!1)throw new de(a(i," has been removed"+(t?" in "+t:"")),de.ERR_DEPRECATED);return t&&!co[i]&&(co[i]=!0,console.warn(a(i," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(o,i,s):!0}};function zc(r,e,t){if(typeof r!="object")throw new de("options must be an object",de.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(r),a=n.length;a-- >0;){var o=n[a],i=e[o];if(i){var s=r[o],u=s===void 0||i(s,o,r);if(u!==!0)throw new de("option "+o+" must be "+u,de.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new de("Unknown option "+o,de.ERR_BAD_OPTION)}}uo.exports={assertOptions:zc,validators:vr}});var go=E((If,ho)=>{"use strict";var Rr=k(),Jc=ur(),fo=ga(),po=oo(),yt=br(),Vc=hr(),_r=lo(),pe=_r.validators;function ke(r){this.defaults=r,this.interceptors={request:new fo,response:new fo}}ke.prototype.request=function(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=yt(this.defaults,t),t.method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;n!==void 0&&_r.assertOptions(n,{silentJSONParsing:pe.transitional(pe.boolean),forcedJSONParsing:pe.transitional(pe.boolean),clarifyTimeoutError:pe.transitional(pe.boolean)},!1);var a=t.paramsSerializer;a!=null&&(Rr.isFunction(a)?t.paramsSerializer={serialize:a}:_r.assertOptions(a,{encode:pe.function,serialize:pe.function},!0));var o=[],i=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(t)===!1||(i=i&&h.synchronous,o.unshift(h.fulfilled,h.rejected))});var s=[];this.interceptors.response.forEach(function(h){s.push(h.fulfilled,h.rejected)});var u;if(!i){var l=[po,void 0];for(Array.prototype.unshift.apply(l,o),l=l.concat(s),u=Promise.resolve(t);l.length;)u=u.then(l.shift(),l.shift());return u}for(var f=t;o.length;){var c=o.shift(),p=o.shift();try{f=c(f)}catch(g){p(g);break}}try{u=po(f)}catch(g){return Promise.reject(g)}for(;s.length;)u=u.then(s.shift(),s.shift());return u};ke.prototype.getUri=function(e){e=yt(this.defaults,e);var t=Vc(e.baseURL,e.url,e.allowAbsoluteUrls);return Jc(t,e.params,e.paramsSerializer)};Rr.forEach(["delete","get","head","options"],function(e){ke.prototype[e]=function(t,n){return this.request(yt(n||{},{method:e,url:t,data:(n||{}).data}))}});Rr.forEach(["post","put","patch"],function(e){function t(n){return function(o,i,s){return this.request(yt(s||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}ke.prototype[e]=t(),ke.prototype[e+"Form"]=t(!0)});ho.exports=ke});var yo=E((xf,mo)=>{"use strict";var Gc=Ge();function De(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(a){e=a});var t=this;this.promise.then(function(n){if(t._listeners){for(var a=t._listeners.length;a-- >0;)t._listeners[a](n);t._listeners=null}}),this.promise.then=function(n){var a,o=new Promise(function(i){t.subscribe(i),a=i}).then(n);return o.cancel=function(){t.unsubscribe(a)},o},r(function(a,o,i){t.reason||(t.reason=new Gc(a,o,i),e(t.reason))})}De.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};De.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};De.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};De.source=function(){var e,t=new De(function(a){e=a});return{token:t,cancel:e}};mo.exports=De});var Eo=E((Af,So)=>{"use strict";So.exports=function(e){return function(n){return e.apply(null,n)}}});var bo=E((Cf,wo)=>{"use strict";var Xc=k();wo.exports=function(e){return Xc.isObject(e)&&e.isAxiosError===!0}});var vo=E((Of,xr)=>{"use strict";var Ir=k(),Yc=er(),St=go(),Qc=br(),Zc=mt(),eu=dr();function To(r){var e=new St(r),t=Yc(St.prototype.request,e);return Ir.extend(t,St.prototype,e),Ir.extend(t,e),t.create=function(a){return To(Qc(r,a))},t}var K=To(Zc);K.Axios=St;K.CanceledError=Ge();K.CancelToken=yo();K.isCancel=Sr();K.VERSION=Tr().version;K.toFormData=Je();K.AxiosError=le();K.Cancel=K.CanceledError;K.all=function(e){return Promise.all(e)};K.spread=Eo();K.isAxiosError=bo();K.formToJSON=function(r){return eu(Ir.isHTMLForm(r)?new FormData(r):r)};xr.exports=K;xr.exports.default=K});var Ro=E((Pf,_o)=>{_o.exports=vo()});var xo=E(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});function tu(r){var e=4,t=r.length,n=t%e;if(!n)return r;var a=t,o=e-n,i=t+o,s=Buffer.alloc(i);for(s.write(r);o--;)s.write("=",a++);return s.toString()}Ar.default=tu});var Co=E(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});var ru=xo();function Ao(r,e){return e===void 0&&(e="utf8"),Buffer.isBuffer(r)?Cr(r.toString("base64")):Cr(Buffer.from(r,e).toString("base64"))}function nu(r,e){return e===void 0&&(e="utf8"),Buffer.from(Or(r),"base64").toString(e)}function Or(r){return r=r.toString(),ru.default(r).replace(/\\-/g,"+").replace(/_/g,"/")}function Cr(r){return r.replace(/=/g,"").replace(/\\+/g,"-").replace(/\\//g,"_")}function au(r){return Buffer.from(Or(r),"base64")}var Ne=Ao;Ne.encode=Ao;Ne.decode=nu;Ne.toBase64=Or;Ne.fromBase64=Cr;Ne.toBuffer=au;Pr.default=Ne});var Oo=E((td,bt)=>{bt.exports=Co().default;bt.exports.default=bt.exports});var Uo=E((Po,Tt)=>{(function(r,e){var t={};e(t);var n=t.default;for(var a in t)n[a]=t[a];typeof Tt=="object"&&typeof Tt.exports=="object"?Tt.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):r.sha256=n})(Po,function(r){"use strict";r.__esModule=!0,r.digestLength=32,r.blockSize=64;var e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function t(c,p,g,h,m){for(var b,T,S,R,I,x,$,D,B,N,be,Te,qe;m>=64;){for(b=p[0],T=p[1],S=p[2],R=p[3],I=p[4],x=p[5],$=p[6],D=p[7],N=0;N<16;N++)be=h+N*4,c[N]=(g[be]&255)<<24|(g[be+1]&255)<<16|(g[be+2]&255)<<8|g[be+3]&255;for(N=16;N<64;N++)B=c[N-2],Te=(B>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,B=c[N-15],qe=(B>>>7|B<<25)^(B>>>18|B<<14)^B>>>3,c[N]=(Te+c[N-7]|0)+(qe+c[N-16]|0);for(N=0;N<64;N++)Te=(((I>>>6|I<<26)^(I>>>11|I<<21)^(I>>>25|I<<7))+(I&x^~I&$)|0)+(D+(e[N]+c[N]|0)|0)|0,qe=((b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10))+(b&T^b&S^T&S)|0,D=$,$=x,x=I,I=R+Te|0,R=S,S=T,T=b,b=Te+qe|0;p[0]+=b,p[1]+=T,p[2]+=S,p[3]+=R,p[4]+=I,p[5]+=x,p[6]+=$,p[7]+=D,h+=64,m-=64}return h}var n=(function(){function c(){this.digestLength=r.digestLength,this.blockSize=r.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return c.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},c.prototype.clean=function(){for(var p=0;p<this.buffer.length;p++)this.buffer[p]=0;for(var p=0;p<this.temp.length;p++)this.temp[p]=0;this.reset()},c.prototype.update=function(p,g){if(g===void 0&&(g=p.length),this.finished)throw new Error("SHA256: can\'t update because hash was finished.");var h=0;if(this.bytesHashed+=g,this.bufferLength>0){for(;this.bufferLength<64&&g>0;)this.buffer[this.bufferLength++]=p[h++],g--;this.bufferLength===64&&(t(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(g>=64&&(h=t(this.temp,this.state,p,h,g),g%=64);g>0;)this.buffer[this.bufferLength++]=p[h++],g--;return this},c.prototype.finish=function(p){if(!this.finished){var g=this.bytesHashed,h=this.bufferLength,m=g/536870912|0,b=g<<3,T=g%64<56?64:128;this.buffer[h]=128;for(var S=h+1;S<T-8;S++)this.buffer[S]=0;this.buffer[T-8]=m>>>24&255,this.buffer[T-7]=m>>>16&255,this.buffer[T-6]=m>>>8&255,this.buffer[T-5]=m>>>0&255,this.buffer[T-4]=b>>>24&255,this.buffer[T-3]=b>>>16&255,this.buffer[T-2]=b>>>8&255,this.buffer[T-1]=b>>>0&255,t(this.temp,this.state,this.buffer,0,T),this.finished=!0}for(var S=0;S<8;S++)p[S*4+0]=this.state[S]>>>24&255,p[S*4+1]=this.state[S]>>>16&255,p[S*4+2]=this.state[S]>>>8&255,p[S*4+3]=this.state[S]>>>0&255;return this},c.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},c.prototype._saveState=function(p){for(var g=0;g<this.state.length;g++)p[g]=this.state[g]},c.prototype._restoreState=function(p,g){for(var h=0;h<this.state.length;h++)this.state[h]=p[h];this.bytesHashed=g,this.finished=!1,this.bufferLength=0},c})();r.Hash=n;var a=(function(){function c(p){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var g=new Uint8Array(this.blockSize);if(p.length>this.blockSize)new n().update(p).finish(g).clean();else for(var h=0;h<p.length;h++)g[h]=p[h];for(var h=0;h<g.length;h++)g[h]^=54;this.inner.update(g);for(var h=0;h<g.length;h++)g[h]^=106;this.outer.update(g),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var h=0;h<g.length;h++)g[h]=0}return c.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},c.prototype.clean=function(){for(var p=0;p<this.istate.length;p++)this.ostate[p]=this.istate[p]=0;this.inner.clean(),this.outer.clean()},c.prototype.update=function(p){return this.inner.update(p),this},c.prototype.finish=function(p){return this.outer.finished?this.outer.finish(p):(this.inner.finish(p),this.outer.update(p,this.digestLength).finish(p)),this},c.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},c})();r.HMAC=a;function o(c){var p=new n().update(c),g=p.digest();return p.clean(),g}r.hash=o,r.default=o;function i(c,p){var g=new a(c).update(p),h=g.digest();return g.clean(),h}r.hmac=i;function s(c,p,g,h){var m=h[0];if(m===0)throw new Error("hkdf: cannot expand more");p.reset(),m>1&&p.update(c),g&&p.update(g),p.update(h),p.finish(c),h[0]++}var u=new Uint8Array(r.digestLength);function l(c,p,g,h){p===void 0&&(p=u),h===void 0&&(h=32);for(var m=new Uint8Array([1]),b=i(p,c),T=new a(b),S=new Uint8Array(T.digestLength),R=S.length,I=new Uint8Array(h),x=0;x<h;x++)R===S.length&&(s(S,T,g,m),R=0),I[x]=S[R++];return T.clean(),S.fill(0),m.fill(0),I}r.hkdf=l;function f(c,p,g,h){for(var m=new a(c),b=m.digestLength,T=new Uint8Array(4),S=new Uint8Array(b),R=new Uint8Array(b),I=new Uint8Array(h),x=0;x*b<h;x++){var $=x+1;T[0]=$>>>24&255,T[1]=$>>>16&255,T[2]=$>>>8&255,T[3]=$>>>0&255,m.reset(),m.update(p),m.update(T),m.finish(R);for(var D=0;D<b;D++)S[D]=R[D];for(var D=2;D<=g;D++){m.reset(),m.update(R).finish(R);for(var B=0;B<b;B++)S[B]^=R[B]}for(var D=0;D<b&&x*b+D<h;D++)I[x*b+D]=S[D]}for(var x=0;x<b;x++)S[x]=R[x]=0;for(var x=0;x<4;x++)T[x]=0;return m.clean(),I}r.pbkdf2=f})});var ci=E((qr,si)=>{var _t=ct(),Q=_t.Buffer;function ii(r,e){for(var t in r)e[t]=r[t]}Q.from&&Q.alloc&&Q.allocUnsafe&&Q.allocUnsafeSlow?si.exports=_t:(ii(_t,qr),qr.Buffer=we);function we(r,e,t){return Q(r,e,t)}we.prototype=Object.create(Q.prototype);ii(Q,we);we.from=function(r,e,t){if(typeof r=="number")throw new TypeError("Argument must not be a number");return Q(r,e,t)};we.alloc=function(r,e,t){if(typeof r!="number")throw new TypeError("Argument must be a number");var n=Q(r);return e!==void 0?typeof t=="string"?n.fill(e,t):n.fill(e):n.fill(0),n};we.allocUnsafe=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return Q(r)};we.allocUnsafeSlow=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return _t.SlowBuffer(r)}});var ui=E((xp,Wr)=>{"use strict";var Kr=65536,wu=4294967295;function bu(){throw new Error(`Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11`)}var Tu=ci().Buffer,Rt=self.crypto||self.msCrypto;Rt&&Rt.getRandomValues?Wr.exports=vu:Wr.exports=bu;function vu(r,e){if(r>wu)throw new RangeError("requested too many random bytes");var t=Tu.allocUnsafe(r);if(r>0)if(r>Kr)for(var n=0;n<r;n+=Kr)Rt.getRandomValues(t.slice(n,n+Kr));else Rt.getRandomValues(t);return typeof e=="function"?process.nextTick(function(){e(null,t)}):t}});var gi=ve(ct(),1);var ts=Object.defineProperty,rs=(r,e,t)=>e in r?ts(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,P=(r,e,t)=>rs(r,typeof e!="symbol"?e+"":e,t),Ht="asgardeo-session-active",ns=class{constructor(r,e){P(this,"_id"),P(this,"_store"),this._id=r,this._store=e}async setDataInBulk(r,e){let t=await this._store.getData(r)??null,a={...t&&JSON.parse(t),...e},o=JSON.stringify(a);await this._store.setData(r,o)}async setValue(r,e,t){let n=await this._store.getData(r)??null,o={...n&&JSON.parse(n),[e]:t},i=JSON.stringify(o);await this._store.setData(r,i)}async removeValue(r,e){let t=await this._store.getData(r)??null,a={...t&&JSON.parse(t)};delete a[e];let o=JSON.stringify(a);await this._store.setData(r,o)}_resolveKey(r,e){return e?`${r}-${this._id}-${e}`:`${r}-${this._id}`}isLocalStorageAvailable(){try{let r="__ASGARDEO_AUTH_CORE_LOCAL_STORAGE_TEST__";return localStorage.setItem(r,r),localStorage.removeItem(r),!0}catch{return!1}}async setConfigData(r){await this.setDataInBulk(this._resolveKey("config_data"),r)}async setOIDCProviderMetaData(r){this.setDataInBulk(this._resolveKey("oidc_provider_meta_data"),r)}async setTemporaryData(r,e){this.setDataInBulk(this._resolveKey("temporary_data",e),r)}async setSessionData(r,e){this.setDataInBulk(this._resolveKey("session_data",e),r)}async setCustomData(r,e,t){this.setDataInBulk(this._resolveKey(r,t),e)}async getConfigData(r){return JSON.parse(await this._store.getData(this._resolveKey("config_data",r))??null)}async loadOpenIDProviderConfiguration(){return JSON.parse(await this._store.getData(this._resolveKey("oidc_provider_meta_data"))??null)}async getTemporaryData(r){return JSON.parse(await this._store.getData(this._resolveKey("temporary_data",r))??null)}async getSessionData(r){return JSON.parse(await this._store.getData(this._resolveKey("session_data",r))??null)}async getCustomData(r,e){return JSON.parse(await this._store.getData(this._resolveKey(r,e))??null)}setSessionStatus(r){this.isLocalStorageAvailable()&&localStorage.setItem(`${Ht}`,r)}getSessionStatus(){return this.isLocalStorageAvailable()?localStorage.getItem(`${Ht}`)??"":""}removeSessionStatus(){this.isLocalStorageAvailable()&&localStorage.removeItem(`${Ht}`)}async removeConfigData(){await this._store.removeData(this._resolveKey("config_data"))}async removeOIDCProviderMetaData(){await this._store.removeData(this._resolveKey("oidc_provider_meta_data"))}async removeTemporaryData(r){await this._store.removeData(this._resolveKey("temporary_data",r))}async removeSessionData(r){await this._store.removeData(this._resolveKey("session_data",r))}async getConfigDataParameter(r){let e=await this._store.getData(this._resolveKey("config_data"));return e&&JSON.parse(e)[r]}async getOIDCProviderMetaDataParameter(r){let e=await this._store.getData(this._resolveKey("oidc_provider_meta_data"));return e&&JSON.parse(e)[r]}async getTemporaryDataParameter(r,e){let t=await this._store.getData(this._resolveKey("temporary_data",e));return t&&JSON.parse(t)[r]}async getSessionDataParameter(r,e){let t=await this._store.getData(this._resolveKey("session_data",e));return t&&JSON.parse(t)[r]}async setConfigDataParameter(r,e){await this.setValue(this._resolveKey("config_data"),r,e)}async setOIDCProviderMetaDataParameter(r,e){await this.setValue(this._resolveKey("oidc_provider_meta_data"),r,e)}async setTemporaryDataParameter(r,e,t){await this.setValue(this._resolveKey("temporary_data",t),r,e)}async setSessionDataParameter(r,e,t){await this.setValue(this._resolveKey("session_data",t),r,e)}async removeConfigDataParameter(r){await this.removeValue(this._resolveKey("config_data"),r)}async removeOIDCProviderMetaDataParameter(r){await this.removeValue(this._resolveKey("oidc_provider_meta_data"),r)}async removeTemporaryDataParameter(r,e){await this.removeValue(this._resolveKey("temporary_data",e),r)}async removeSessionDataParameter(r,e){await this.removeValue(this._resolveKey("session_data",e),r)}},Sn=ns,as={Endpoints:{AUTHORIZATION:"/oauth2/authorize",SESSION_IFRAME:"/oidc/checksession",END_SESSION:"/oidc/logout",ISSUER:"/oauth2/token",JWKS:"/oauth2/jwks",REVOCATION:"/oauth2/revoke",TOKEN:"/oauth2/token",USERINFO:"/oauth2/userinfo"},Storage:{StorageKeys:{Endpoints:{AUTHORIZATION:"authorization_endpoint",TOKEN:"token_endpoint",REVOCATION:"revocation_endpoint",END_SESSION:"end_session_endpoint",JWKS:"jwks_uri",SESSION_IFRAME:"check_session_iframe",ISSUER:"issuer",USERINFO:"userinfo_endpoint"},OPENID_PROVIDER_CONFIG_INITIATED:"op_config_initiated"}}},_=as,os={INTERNAL_LOGIN:"internal_login",OPENID:"openid",PROFILE:"profile"},Lt=os,is={Params:{AUTHORIZATION_CODE:"code",SESSION_STATE:"session_state",STATE:"state",SIGN_OUT_SUCCESS:"sign_out_success"},SignIn:{Payload:{DEFAULT_SCOPES:[Lt.OPENID,Lt.PROFILE,Lt.INTERNAL_LOGIN]}},SignOut:{Storage:{StorageKeys:{SIGN_OUT_URL:"sign_out_url"}}}},H=is,v=class{constructor(r,e,t){P(this,"name"),P(this,"code"),P(this,"message"),this.message=t,this.name=e,this.code=r,Object.setPrototypeOf(this,new.target.prototype)}},ss={SignatureValidation:{SUPPORTED_ALGORITHMS:["RS256","RS512","RS384","PS256"]},Storage:{StorageKeys:{REFRESH_TOKEN_TIMER:"refresh_token_timer"}}},je=ss,cs=class{constructor(r){P(this,"_cryptoUtils"),this._cryptoUtils=r}getCodeVerifier(){return this._cryptoUtils.base64URLEncode(this._cryptoUtils.generateRandomBytes(32))}getCodeChallenge(r){return this._cryptoUtils.base64URLEncode(this._cryptoUtils.hashSha256(r))}getJWKForTheIdToken(r,e){let t=JSON.parse(this._cryptoUtils.base64URLDecode(r));for(let n of e)if(t.kid===n.kid)return n;throw new v("JS-CRYPTO_UTIL-GJFTIT-IV01","kid not found.","Failed to find the \'kid\' specified in the id_token. \'kid\' found in the header : "+t.kid+", Expected values: "+e.map(n=>n.kid).join(", "))}isValidIdToken(r,e,t,n,a,o,i){return this._cryptoUtils.verifyJwt(r,e,je.SignatureValidation.SUPPORTED_ALGORITHMS,t,n,a,o,i).then(s=>s?Promise.resolve(!0):Promise.reject(new v("JS-CRYPTO_HELPER-IVIT-IV01","Invalid ID token.","ID token validation returned false")))}decodeIdToken(r){try{let e=this._cryptoUtils.base64URLDecode(r?.split(".")[1]);return JSON.parse(e)}catch(e){throw new v("JS-CRYPTO_UTIL-DIT-IV01","Decoding ID token failed.",e)}}},us={DEFAULT_CODE_CHALLENGE_METHOD:"S256",Storage:{StorageKeys:{CODE_VERIFIER:"pkce_code_verifier",SEPARATOR:"#"}}},ie=us,ls=r=>{let e=parseInt(r.split("request_")[1]);return`${ie.Storage.StorageKeys.CODE_VERIFIER}${ie.Storage.StorageKeys.SEPARATOR}${e}`},ye=ls,fs={Placeholders:{ACCESS_TOKEN:"{{accessToken}}",USERNAME:"{{username}}",SCOPES:"{{scopes}}",CLIENT_ID:"{{clientId}}",CLIENT_SECRET:"{{clientSecret}}"}},We=fs,ds=r=>{let e={...r};["iss","aud","exp","iat","acr","amr","azp","auth_time","nonce","c_hash","at_hash","nbf","isk","sid","jti","sub"].forEach(a=>{delete e[a]});let n={};return Object.entries(e).forEach(([a,o])=>{let i=a.split("_").map((s,u)=>u===0?s:s[0].toUpperCase()+s.slice(1)).join("");n[i]=o}),n},ps=ds,hs=class En extends Error{constructor(e,t,n){let a=En.resolveOrigin(n);super(e),P(this,"code"),P(this,"origin"),this.name=new.target.name,this.code=t,this.origin=a,Error.captureStackTrace&&Error.captureStackTrace(this,new.target)}static resolveOrigin(e){return e?`@asgardeo/${e}`:"@asgardeo/javascript"}toString(){let e=`\\u{1F6E1}\\uFE0F Asgardeo - ${this.origin}:`;return`[${this.name}]\n${e} ${this.message}\n(code="${this.code}")`}},wn=class extends hs{constructor(r,e,t,n){super(r,e,t),this.details=n,Object.defineProperty(this,"name",{value:"AsgardeoRuntimeError",configurable:!0,writable:!0})}toString(){let r=this.details?`\nDetails: ${JSON.stringify(this.details,null,2)}`:"";return`[${this.name}] (code="${this.code}")${r}\nMessage: ${this.message}`}},gs=r=>{let e=[];if(r)if(Array.isArray(r))e=r;else if(typeof r=="string")e=r.split(" ");else throw new wn("Scopes must be a string or an array of strings.","processOpenIDScopes-Invalid-001","javascript","The provided scopes are not in the expected format. Please provide a string or an array of strings.");return H.SignIn.Payload.DEFAULT_SCOPES.forEach(t=>{e.includes(t)||e.push(t)}),e.join(" ")},$t=gs,ms=class{constructor(r,e){P(this,"_storageManager"),P(this,"_config"),P(this,"_oidcProviderMetaData"),P(this,"_cryptoHelper"),this._storageManager=r,this._config=async()=>this._storageManager.getConfigData(),this._oidcProviderMetaData=async()=>this._storageManager.loadOpenIDProviderConfiguration(),this._cryptoHelper=e}async resolveEndpoints(r){let e={},t=await this._config();return t.endpoints&&Object.keys(t.endpoints).forEach(n=>{let a=n.replace(/[A-Z]/g,o=>`_${o.toLowerCase()}`);e[a]=t?.endpoints?t.endpoints[n]:""}),{...r,...e}}async resolveEndpointsExplicitly(){let r={},e=await this._config(),t=[_.Storage.StorageKeys.Endpoints.AUTHORIZATION,_.Storage.StorageKeys.Endpoints.END_SESSION,_.Storage.StorageKeys.Endpoints.JWKS,_.Storage.StorageKeys.Endpoints.SESSION_IFRAME,_.Storage.StorageKeys.Endpoints.REVOCATION,_.Storage.StorageKeys.Endpoints.TOKEN,_.Storage.StorageKeys.Endpoints.ISSUER,_.Storage.StorageKeys.Endpoints.USERINFO];if(!(e.endpoints?t.every(a=>e.endpoints?Object.keys(e.endpoints).some(o=>o.replace(/[A-Z]/g,s=>`_${s.toLowerCase()}`)===a):!1):!1))throw new v("JS-AUTH_HELPER-REE-NF01","Required endpoints missing","Some or all of the required endpoints are missing in the object passed to the `endpoints` attribute of the`AuthConfig` object.");return e.endpoints&&Object.keys(e.endpoints).forEach(a=>{let o=a.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`);r[o]=e?.endpoints?e.endpoints[a]:""}),{...r}}async resolveEndpointsByBaseURL(){let r={},e=await this._config(),{baseUrl:t}=e;if(!t)throw new v("JS-AUTH_HELPER_REBO-NF01","Base URL not defined.","Base URL is not defined in AuthClient config.");return e.endpoints&&Object.keys(e.endpoints).forEach(a=>{let o=a.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`);r[o]=e?.endpoints?e.endpoints[a]:""}),{...{[_.Storage.StorageKeys.Endpoints.AUTHORIZATION]:`${t}${_.Endpoints.AUTHORIZATION}`,[_.Storage.StorageKeys.Endpoints.END_SESSION]:`${t}${_.Endpoints.END_SESSION}`,[_.Storage.StorageKeys.Endpoints.ISSUER]:`${t}${_.Endpoints.ISSUER}`,[_.Storage.StorageKeys.Endpoints.JWKS]:`${t}${_.Endpoints.JWKS}`,[_.Storage.StorageKeys.Endpoints.SESSION_IFRAME]:`${t}${_.Endpoints.SESSION_IFRAME}`,[_.Storage.StorageKeys.Endpoints.REVOCATION]:`${t}${_.Endpoints.REVOCATION}`,[_.Storage.StorageKeys.Endpoints.TOKEN]:`${t}${_.Endpoints.TOKEN}`,[_.Storage.StorageKeys.Endpoints.USERINFO]:`${t}${_.Endpoints.USERINFO}`},...r}}async validateIdToken(r){let e=(await this._storageManager.loadOpenIDProviderConfiguration()).jwks_uri,t=await this._config();if(!e||e.trim().length===0)throw new v("JS_AUTH_HELPER-VIT-NF01","JWKS endpoint not found.","No JWKS endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the JWKS endpoint passed to the SDK is empty.");let n;try{n=await fetch(e,{credentials:t.sendCookiesInRequests?"include":"same-origin"})}catch(s){throw new v("JS-AUTH_HELPER-VIT-NE02","Request to jwks endpoint failed.",s??"The request sent to get the jwks from the server failed.")}if(n.status!==200||!n.ok)throw new v("JS-AUTH_HELPER-VIT-HE03",`Invalid response status received for jwks request (${n.statusText}).`,await n.json());let{issuer:a}=await this._oidcProviderMetaData(),{keys:o}=await n.json(),i=await this._cryptoHelper.getJWKForTheIdToken(r.split(".")[0],o);return this._cryptoHelper.isValidIdToken(r,i,(await this._config()).clientId,a??"",this._cryptoHelper.decodeIdToken(r).sub,(await this._config()).tokenValidation?.idToken?.clockTolerance,(await this._config()).tokenValidation?.idToken?.validateIssuer??!0)}getAuthenticatedUserInfo(r){let e=this._cryptoHelper.decodeIdToken(r),t=e?.username??"",n=e?.given_name??"",a=e?.family_name??"",o=n&&a?`${n} ${a}`:n||a||"";return{displayName:e.preferred_username??o,username:t,...ps(e)}}async replaceCustomGrantTemplateTags(r,e){let t=await this._config(),n=await this._storageManager.getSessionData(e),a=$t(t.scopes);return typeof r!="string"?r:r.replace(We.Placeholders.ACCESS_TOKEN,n.access_token).replace(We.Placeholders.USERNAME,this.getAuthenticatedUserInfo(n.id_token).username).replace(We.Placeholders.SCOPES,a).replace(We.Placeholders.CLIENT_ID,t.clientId).replace(We.Placeholders.CLIENT_SECRET,t.clientSecret??"")}async clearSession(r){await this._storageManager.removeTemporaryData(r),await this._storageManager.removeSessionData(r)}async handleTokenResponse(r,e){if(r.status!==200||!r.ok)throw new v("JS-AUTH_HELPER-HTR-NE01",`Invalid response status received for token request (${r.statusText}).`,await r.json());let t=await r.json();if(t.created_at=new Date().getTime(),(await this._config()).tokenValidation?.idToken?.validate)return this.validateIdToken(t.id_token).then(async()=>{await this._storageManager.setSessionData(t,e);let o={accessToken:t.access_token,createdAt:t.created_at,expiresIn:t.expires_in,idToken:t.id_token,refreshToken:t.refresh_token,scope:t.scope,tokenType:t.token_type};return Promise.resolve(o)});let a={accessToken:t.access_token,createdAt:t.created_at,expiresIn:t.expires_in,idToken:t.id_token,refreshToken:t.refresh_token,scope:t.scope,tokenType:t.token_type};return await this._storageManager.setSessionData(t,e),Promise.resolve(a)}},ys=r=>{let e=[];Object.keys(r).forEach(a=>{a.startsWith(ie.Storage.StorageKeys.CODE_VERIFIER)&&e.push(a)});let t=e.sort().pop(),n=parseInt(t?.split(ie.Storage.StorageKeys.SEPARATOR)[1]??"-1");return`${ie.Storage.StorageKeys.CODE_VERIFIER}${ie.Storage.StorageKeys.SEPARATOR}${n+1}`},Ss=ys,Es=(r,e)=>{let t=parseInt(r.split(ie.Storage.StorageKeys.SEPARATOR)[1]);return e?`${e}_request_${t}`:`request_${t}`},ws=Es,bs=(r,e,t)=>{let{redirectUri:n,clientId:a,clientSecret:o,scopes:i,responseMode:s,codeChallenge:u,codeChallengeMethod:l,prompt:f}=r,c=new Map;c.set("response_type","code"),c.set("client_id",a),c.set("scope",i),c.set("redirect_uri",n),s&&c.set("response_mode",s);let p=e?.key;if(u)if(c.set("code_challenge",u),l)c.set("code_challenge_method",l);else throw new wn("Code challenge method is required when code challenge is provided.","getAuthorizeRequestUrlParams-ValidationError-001","javascript","When PKCE is enabled, the code challenge method must be provided along with the code challenge.");if(f&&c.set("prompt",f),t)for(let[g,h]of Object.entries(t))g!==""&&h!==""&&g!==H.Params.STATE&&c.set(g,h.toString());return c.set(H.Params.STATE,ws(p,t?t[H.Params.STATE]?.toString():"")),c},Ts=bs,vs={tokenValidation:{idToken:{validate:!0,validateIssuer:!0,clockTolerance:300}},enablePKCE:!0,responseMode:"query",sendCookiesInRequests:!0},qt=class ee{constructor(){P(this,"_storageManager"),P(this,"_config"),P(this,"_oidcProviderMetaData"),P(this,"_authenticationHelper"),P(this,"_cryptoUtils"),P(this,"_cryptoHelper")}async initialize(e,t,n,a){let o=e.clientId;ee._instanceID?ee._instanceID+=1:ee._instanceID=0,a&&(ee._instanceID=a),o?this._storageManager=new Sn(`instance_${ee._instanceID}-${o}`,t):this._storageManager=new Sn(`instance_${ee._instanceID}`,t),this._cryptoUtils=n,this._cryptoHelper=new cs(n),this._authenticationHelper=new ms(this._storageManager,this._cryptoHelper),this._config=async()=>await this._storageManager.getConfigData(),this._oidcProviderMetaData=async()=>await this._storageManager.loadOpenIDProviderConfiguration(),ee._authenticationHelper=this._authenticationHelper,await this._storageManager.setConfigData({...vs,...e,scope:$t(e.scopes)})}getStorageManager(){return this._storageManager}getInstanceId(){return ee._instanceID}async getSignInUrl(e,t){let n={...e};delete n?.forceInit;let a=async()=>{let o=await this._storageManager.getOIDCProviderMetaDataParameter(_.Storage.StorageKeys.Endpoints.AUTHORIZATION);if(!o||o.trim().length===0)throw new v("JS-AUTH_CORE-GAU-NF01","No authorization endpoint found.","No authorization endpoint was found in the OIDC provider meta data from the well-known endpoint or the authorization endpoint passed to the SDK is empty.");let i=new URL(o),s=await this._config(),u=await this._storageManager.getTemporaryData(t),l=await Ss(u),f,c;s.enablePKCE&&(f=this._cryptoHelper?.getCodeVerifier(),c=this._cryptoHelper?.getCodeChallenge(f),await this._storageManager.setTemporaryDataParameter(l,f,t)),n.client_secret&&(n.client_secret=s.clientSecret);let p=Ts({redirectUri:s.afterSignInUrl,clientId:s.clientId,scopes:$t(s.scopes),responseMode:s.responseMode,codeChallengeMethod:ie.DEFAULT_CODE_CHALLENGE_METHOD,codeChallenge:c,prompt:s.prompt},{key:l},n);for(let[g,h]of p.entries())i.searchParams.append(g,h);return i.toString()};return await this._storageManager.getTemporaryDataParameter(_.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED)?a():this.loadOpenIDProviderConfiguration(e?.forceInit).then(()=>a())}async requestAccessToken(e,t,n,a,o){let i=async()=>{let s=(await this._oidcProviderMetaData()).token_endpoint,u=await this._config();if(!s||s.trim().length===0)throw new v("JS-AUTH_CORE-RAT1-NF01","Token endpoint not found.","No token endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the token endpoint passed to the SDK is empty.");t&&await this._storageManager.setSessionDataParameter(H.Params.SESSION_STATE,t,a);let l=new URLSearchParams;l.set("client_id",u.clientId),u.clientSecret&&u.clientSecret.trim().length>0&&l.set("client_secret",u.clientSecret);let f=e;l.set("code",f),l.set("grant_type","authorization_code"),l.set("redirect_uri",u.afterSignInUrl),o?.params&&Object.entries(o.params).forEach(([p,g])=>{l.append(p,g)}),u.enablePKCE&&(l.set("code_verifier",`${await this._storageManager.getTemporaryDataParameter(ye(n),a)}`),await this._storageManager.removeTemporaryDataParameter(ye(n),a));let c;try{c=await fetch(s,{body:l,credentials:u.sendCookiesInRequests?"include":"same-origin",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},method:"POST"})}catch(p){throw new v("JS-AUTH_CORE-RAT1-NE02","Requesting access token failed",p??"The request to get the access token from the server failed.")}if(!c.ok)throw new v("JS-AUTH_CORE-RAT1-HE03",`Requesting access token failed with ${c.statusText}`,await c.json());return await this._authenticationHelper.handleTokenResponse(c,a)};return await this._storageManager.getTemporaryDataParameter(_.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED)?i():this.loadOpenIDProviderConfiguration(!1).then(()=>i())}async loadOpenIDProviderConfiguration(e){let t=await this._config();if(!e&&await this._storageManager.getTemporaryDataParameter(_.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED))return Promise.resolve();let n=t.wellKnownEndpoint;if(n){let a;try{if(a=await fetch(n),a.status!==200||!a.ok)throw new Error}catch{throw new v("JS-AUTH_CORE-GOPMD-HE01","Invalid well-known response","The well known endpoint response has been failed with an error.")}return await this._storageManager.setOIDCProviderMetaData(await this._authenticationHelper.resolveEndpoints(await a.json())),await this._storageManager.setTemporaryDataParameter(_.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,!0),Promise.resolve()}else if(t.baseUrl){try{await this._storageManager.setOIDCProviderMetaData(await this._authenticationHelper.resolveEndpointsByBaseURL())}catch(a){throw new v("JS-AUTH_CORE-GOPMD-IV02","Resolving endpoints failed.",a??"Resolving endpoints by base url failed.")}return await this._storageManager.setTemporaryDataParameter(_.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,!0),Promise.resolve()}else return await this._storageManager.setOIDCProviderMetaData(await this._authenticationHelper.resolveEndpointsExplicitly()),await this._storageManager.setTemporaryDataParameter(_.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,!0),Promise.resolve()}async getSignOutUrl(e){let t=(await this._oidcProviderMetaData())?.end_session_endpoint,n=await this._config();if(!t||t.trim().length===0)throw new v("JS-AUTH_CORE-GSOU-NF01","Sign-out endpoint not found.","No sign-out endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the sign-out endpoint passed to the SDK is empty.");let a=n?.afterSignOutUrl??n?.afterSignInUrl;if(!a||a.trim().length===0)throw new v("JS-AUTH_CORE-GSOU-NF03","No sign-out redirect URL found.","The sign-out redirect URL cannot be found or the URL passed to the SDK is empty. No sign-in redirect URL has been found either. ");let o=new URLSearchParams;if(o.set("post_logout_redirect_uri",a),n.sendIdTokenInLogoutRequest){let i=(await this._storageManager.getSessionData(e))?.id_token;if(!i||i.trim().length===0)throw new v("JS-AUTH_CORE-GSOU-NF02","ID token not found.","No ID token could be found. Either the session information is lost or you have not signed in.");o.set("id_token_hint",i)}else o.set("client_id",n.clientId);return o.set("state",H.Params.SIGN_OUT_SUCCESS),`${t}?${o.toString()}`}async getOpenIDProviderEndpoints(){let e=await this._oidcProviderMetaData();return{authorizationEndpoint:e.authorization_endpoint??"",checkSessionIframe:e.check_session_iframe??"",endSessionEndpoint:e.end_session_endpoint??"",introspectionEndpoint:e.introspection_endpoint??"",issuer:e.issuer??"",jwksUri:e.jwks_uri??"",registrationEndpoint:e.registration_endpoint??"",revocationEndpoint:e.revocation_endpoint??"",tokenEndpoint:e.token_endpoint??"",userinfoEndpoint:e.userinfo_endpoint??""}}async getDecodedIdToken(e,t){let n=(await this._storageManager.getSessionData(e)).id_token;return this._cryptoHelper.decodeIdToken(n??t)}async getIdToken(e){return(await this._storageManager.getSessionData(e)).id_token}async getUser(e){let t=await this._storageManager.getSessionData(e),n=this._authenticationHelper.getAuthenticatedUserInfo(t?.id_token);return Object.keys(n).forEach(a=>{(n[a]===void 0||n[a]===""||n[a]===null)&&delete n[a]}),n}async getUserSession(e){let t=await this._storageManager.getSessionData(e);return{scopes:t?.scope?.split(" "),sessionState:t?.session_state??""}}async getCrypto(){return this._cryptoHelper}async revokeAccessToken(e){let t=(await this._oidcProviderMetaData()).revocation_endpoint,n=await this._config();if(!t||t.trim().length===0)throw new v("JS-AUTH_CORE-RAT3-NF01","No revoke access token endpoint found.","No revoke access token endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the revoke access token endpoint passed to the SDK is empty.");let a=[];a.push(`client_id=${n.clientId}`),a.push(`token=${(await this._storageManager.getSessionData(e)).access_token}`),a.push("token_type_hint=access_token"),n.clientSecret&&n.clientSecret.trim().length>0&&a.push(`client_secret=${n.clientSecret}`);let o;try{o=await fetch(t,{body:a.join("&"),credentials:n.sendCookiesInRequests?"include":"same-origin",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},method:"POST"})}catch(i){throw new v("JS-AUTH_CORE-RAT3-NE02","The request to revoke access token failed.",i??"The request sent to revoke the access token failed.")}if(o.status!==200||!o.ok)throw new v("JS-AUTH_CORE-RAT3-HE03",`Invalid response status received for revoke access token request (${o.statusText}).`,await o.json());return this._authenticationHelper.clearSession(e),Promise.resolve(o)}async refreshAccessToken(e){let t=(await this._oidcProviderMetaData()).token_endpoint,n=await this._config(),a=await this._storageManager.getSessionData(e);if(!a.refresh_token)throw new v("JS-AUTH_CORE-RAT2-NF01","No refresh token found.","There was no refresh token found. Asgardeo doesn\'t return a refresh token if the refresh token grant is not enabled.");if(!t||t.trim().length===0)throw new v("JS-AUTH_CORE-RAT2-NF02","No refresh token endpoint found.","No refresh token endpoint was in the OIDC provider meta data returned by the well-known endpoint or the refresh token endpoint passed to the SDK is empty.");let o=[];o.push(`client_id=${n.clientId}`),o.push(`refresh_token=${a.refresh_token}`),o.push("grant_type=refresh_token"),n.clientSecret&&n.clientSecret.trim().length>0&&o.push(`client_secret=${n.clientSecret}`);let i;try{i=await fetch(t,{body:o.join("&"),credentials:n.sendCookiesInRequests?"include":"same-origin",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},method:"POST"})}catch(s){throw new v("JS-AUTH_CORE-RAT2-NR03","Refresh access token request failed.",s??"The request to refresh the access token failed.")}if(!i.ok)throw new v("JS-AUTH_CORE-RAT2-HE04",`Refreshing access token failed with ${i.statusText}`,await i.json());return this._authenticationHelper.handleTokenResponse(i,e)}async getAccessToken(e){return(await this._storageManager.getSessionData(e))?.access_token}async exchangeToken(e,t){let n=await this._oidcProviderMetaData(),a=await this._config(),o;if(e.tokenEndpoint&&e.tokenEndpoint.trim().length!==0?o=e.tokenEndpoint:o=n.token_endpoint,!o||o.trim().length===0)throw new v("JS-AUTH_CORE-RCG-NF01","Token endpoint not found.","No token endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the token endpoint passed to the SDK is empty.");let i=await Promise.all(Object.entries(e.data).map(async([f,c])=>{let p=await this._authenticationHelper.replaceCustomGrantTemplateTags(c,t);return`${f}=${p}`})),s={Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"};e.attachToken&&(s={...s,Authorization:`Bearer ${(await this._storageManager.getSessionData(t)).access_token}`});let u={body:i.join("&"),credentials:a.sendCookiesInRequests?"include":"same-origin",headers:new Headers(s),method:"POST"},l;try{l=await fetch(o,u)}catch(f){throw new v("JS-AUTH_CORE-RCG-NE02","The custom grant request failed.",f??"The request sent to get the custom grant failed.")}if(l.status!==200||!l.ok)throw new v("JS-AUTH_CORE-RCG-HE03",`Invalid response status received for the custom grant request. (${l.statusText})`,await l.json());return e.returnsSession?this._authenticationHelper.handleTokenResponse(l,t):Promise.resolve(await l.json())}async isSignedIn(e){let t=!!await this.getAccessToken(e),n=(await this._storageManager.getSessionData(e))?.created_at,a=(await this._storageManager.getSessionData(e))?.expires_in;if(!a)return!1;let o=parseInt(a)*1e3,i=new Date().getTime(),s=n+o>i;return t&&s}async getPKCECode(e,t){return await this._storageManager.getTemporaryDataParameter(ye(e),t)}async setPKCECode(e,t,n){return await this._storageManager.setTemporaryDataParameter(ye(t),e,n)}static isSignOutSuccessful(e){let t=new URL(e),n=t.searchParams.get(H.Params.STATE),a=!!t.searchParams.get("error");return n?n===H.Params.SIGN_OUT_SUCCESS&&!a:!1}static didSignOutFail(e){let t=new URL(e),n=t.searchParams.get(H.Params.STATE),a=!!t.searchParams.get("error");return n?n===H.Params.SIGN_OUT_SUCCESS&&a:!1}async reInitialize(e){await this._storageManager.setConfigData(e),await this.loadOpenIDProviderConfiguration(!0)}static async clearSession(e){await this._authenticationHelper.clearSession(e)}};P(qt,"_instanceID");P(qt,"_authenticationHelper");var Se=qt;var _s="\\u{1F6E1}\\uFE0F Asgardeo",Rs={level:"info",prefix:`${_s}`,timestamps:!0,showLevel:!0},Is=()=>typeof window<"u"&&typeof window.document<"u",xs=()=>typeof process<"u"&&process.versions&&process.versions.node,V={reset:"\\x1B[0m",bright:"\\x1B[1m",dim:"\\x1B[2m",red:"\\x1B[31m",green:"\\x1B[32m",yellow:"\\x1B[33m",blue:"\\x1B[34m",magenta:"\\x1B[35m",cyan:"\\x1B[36m",white:"\\x1B[37m",gray:"\\x1B[90m"},Ce={debug:"color: #6b7280; font-weight: normal;",info:"color: #2563eb; font-weight: bold;",warn:"color: #d97706; font-weight: bold;",error:"color: #dc2626; font-weight: bold;",prefix:"color: #7c3aed; font-weight: bold;",timestamp:"color: #6b7280; font-size: 0.9em;"},As=class bn{constructor(e={}){P(this,"config"),this.config={...Rs,...e}}configure(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}shouldLog(e){return e>=this.config.level}getTimestamp(){return new Date().toISOString()}getLevelString(e){switch(e){case"debug":return"DEBUG";case"info":return"INFO";case"warn":return"WARN";case"error":return"ERROR";default:return"UNKNOWN"}}formatForNode(e,t){let n=[];if(this.config.timestamps&&n.push(`${V.gray}[${this.getTimestamp()}]${V.reset}`),this.config.prefix&&n.push(`${V.magenta}${this.config.prefix}${V.reset}`),this.config.showLevel){let a=this.getLevelString(e),o;switch(e){case"debug":o=`${V.gray}[${a}]${V.reset}`;break;case"info":o=`${V.blue}[${a}]${V.reset}`;break;case"warn":o=`${V.yellow}[${a}]${V.reset}`;break;case"error":o=`${V.red}[${a}]${V.reset}`;break;default:o=`[${a}]`}n.push(o)}return n.push(t),n.join(" ")}logMessage(e,t,...n){if(this.shouldLog(e)){if(this.config.formatter){this.config.formatter(e,t,...n);return}Is()?this.logToBrowser(e,t,...n):xs()?this.logToNode(e,t,...n):console.log(t,...n)}}logToBrowser(e,t,...n){let a=[],o=[];if(this.config.timestamps&&(a.push(`%c[${this.getTimestamp()}]`),o.push(Ce.timestamp)),this.config.prefix&&(a.push(`%c${this.config.prefix}`),o.push(Ce.prefix)),this.config.showLevel){let s=this.getLevelString(e);switch(a.push(`%c[${s}]`),e){case"debug":o.push(Ce.debug);break;case"info":o.push(Ce.info);break;case"warn":o.push(Ce.warn);break;case"error":o.push(Ce.error);break;default:o.push("")}}a.push(`%c${t}`),o.push("color: inherit; font-weight: normal;");let i=a.join(" ");switch(e){case"debug":console.debug(i,...o,...n);break;case"info":console.info(i,...o,...n);break;case"warn":console.warn(i,...o,...n);break;case"error":console.error(i,...o,...n);break;default:console.log(i,...o,...n)}}logToNode(e,t,...n){let a=this.formatForNode(e,t);switch(e){case"debug":console.debug(a,...n);break;case"info":console.info(a,...n);break;case"warn":console.warn(a,...n);break;case"error":console.error(a,...n);break;default:console.log(a,...n)}}debug(e,...t){this.logMessage("debug",e,...t)}info(e,...t){this.logMessage("info",e,...t)}warn(e,...t){this.logMessage("warn",e,...t)}error(e,...t){this.logMessage("error",e,...t)}child(e){let t=this.config.prefix?`${this.config.prefix} - ${e}`:e;return new bn({...this.config,prefix:t})}setLevel(e){this.config.level=e}getLevel(){return this.config.level}},Mu=new As;var Kt="init";var Tn="sign-out",vn="http-request",_n="http-request-all",Rn="request-custom-grant",In="revoke-access-token";var xn="request-start",An="request-success";var Cn="request-finish",On="get-oidc-service-endpoints",Pn="get-basic-user-info",Un="get-decoded-id-token";var kn="get-crypto-helper",Dn="enable_http_handler",Nn="disable_http_handler",Mn="get_auth_url",Bn="request_get_token",Fn="is_authenticated",Hn="get_sign_out_url",Ln="refresh_access-token",$n="refresh-access-token-error",qn="set_session_state",Kn="start_auto_refresh_token",Wn="update_config",jn="get_id_token",Wt="check_session_signed_in",jt="check_session_signed_out",zn="get_config_data";var zt="rpIFrame",Jt="promptNoneIFrame";var Vt="sign-in-silently";var Gt="initialized-silent-sign-in",Xt="promptNoneRequestSent";var Oe="error",ze="error_description",Yt="custom_grant_config",Qt="state";var Zt="Access token is invalid";var w=class{constructor(){}static generateSuccessMessage(e){return{blob:e?.data instanceof Blob?e?.data:null,data:JSON.stringify(e??""),success:!0}}static generateFailureMessage(e){e?.toJSON&&delete e.toJSON;let t;try{if(e instanceof Error)t=JSON.stringify({name:e.name,message:e.message,stack:e.stack,...e});else if(typeof e=="object"&&e!==null)try{t=JSON.stringify(e)}catch{t=JSON.stringify({message:e.toString?e.toString():"Unknown error",originalError:String(e)})}else t=JSON.stringify(e??"Unknown error")}catch{t=JSON.stringify({message:"Error serialization failed",originalError:String(e)})}return{error:t,success:!1}}};var se=class se{constructor(){}static removeAuthorizationCode(){let e=location.href;history.pushState({},document.title,e.replace(/\\?code=.*$/,""))}static getPKCE(e){return sessionStorage.getItem(e)??""}static setPKCE(e,t){sessionStorage.setItem(e,t)}static setSignOutURL(e,t,n){sessionStorage.setItem(`${H.SignOut.Storage.StorageKeys.SIGN_OUT_URL}-instance_${n}-${t}`,e)}static getSignOutUrl(e,t){return sessionStorage.getItem(`${H.SignOut.Storage.StorageKeys.SIGN_OUT_URL}-instance_${t}-${e}`)??""}static removePKCE(e){sessionStorage.removeItem(e)}static canContinueSignIn(e,t){return!(e&&!se.hasErrorInURL()&&!se.hasAuthSearchParamsInURL()&&!t)}static isInitializedSilentSignIn(){return se.isSilentStatePresentInURL()}static wasSignInCalled(){return!!((se.hasErrorInURL()||se.hasAuthSearchParamsInURL())&&!this.isSilentStatePresentInURL())}static wasSilentSignInCalled(){let e=sessionStorage.getItem(Gt);return!!(e?JSON.parse(e):null)}static async isSignOutSuccessful(){if(Se.isSignOutSuccessful(window.location.href)){let e=window.location.href.split("?")[0];return history.pushState({},document.title,e),await Se.clearSession(),!0}return!1}static didSignOutFail(){if(Se.didSignOutFail(window.location.href)){let e=new URL(window.location.href),t=e.searchParams.get(Oe),n=e.searchParams.get(ze),a=window.location.href.split("?")[0];return history.pushState({},document.title,a),{description:n??"",error:t??""}}return!1}static isSilentStatePresentInURL(){return new URL(window.location.href).searchParams.get("state")?.includes(Vt)??!1}static hasAuthSearchParamsInURL(e=window.location.search){return/[?&]code=[^&]+/.test(e)}static hasErrorInURL(e=window.location.href){let t=new URL(e);return!!t.searchParams.get(Oe)&&t.searchParams.get(Qt)!==H.Params.SIGN_OUT_SUCCESS}static canSendPromptNoneRequest(){let e=sessionStorage.getItem(Xt);return!(e?JSON.parse(e):null)}static setPromptNoneRequestSent(e){sessionStorage.setItem(Xt,JSON.stringify(e))}static async waitTillPageRedirect(e){let t=e??3e3;await new Promise(n=>setTimeout(n,t*1e3))}};y(se,"until",(e,t=500)=>{let n=a=>e()?a():setTimeout(()=>n(a),t);return new Promise(n)});var ce=se;var ut=class{constructor(e,t){y(this,"_authenticationClient");y(this,"_storageManager");y(this,"_spaHelper");y(this,"_instanceID");y(this,"_isTokenRefreshing");this._authenticationClient=e,this._storageManager=this._authenticationClient.getStorageManager(),this._spaHelper=t,this._instanceID=this._authenticationClient.getInstanceId(),this._isTokenRefreshing=!1}enableHttpHandler(e){e?.enableHandler&&e.enableHandler()}disableHttpHandler(e){e?.disableHandler&&e.disableHandler()}initializeSessionManger(e,t,n,a,o){o.initialize(e.clientId,t.checkSessionIframe??"",n,e.checkSessionInterval??3,e.sessionRefreshInterval??300,e.afterSignInUrl,a)}async exchangeToken(e,t){let n=!0,a=!1;if(e?.tokenEndpoint){n=!1;for(let o of[...(await this._storageManager.getConfigData())?.resourceServerURLs??[],e.baseUrl])if(o&&e.tokenEndpoint?.startsWith(o)){a=!0;break}}return e.shouldReplayAfterRefresh&&this._storageManager.setTemporaryDataParameter(Yt,JSON.stringify(e)),n||a?this._authenticationClient.exchangeToken(e).then(async o=>(t&&typeof t=="function"&&t(e),e.returnsSession?(this._spaHelper.refreshAccessTokenAutomatically(this),this._authenticationClient.getUser()):o)).catch(o=>Promise.reject(o)):Promise.reject(new v("SPA-MAIN_THREAD_CLIENT-RCG-IV01","Request to the provided endpoint is prohibited.","Requests can only be sent to resource servers specified by the `resourceServerURLs` attribute while initializing the SDK. The specified token endpoint in this request cannot be found among the `resourceServerURLs`"))}async getCustomGrantConfigData(){let e=await this._storageManager.getTemporaryDataParameter(Yt);return e?JSON.parse(e):null}async refreshAccessToken(e){try{await this._authenticationClient.refreshAccessToken();let t=await this.getCustomGrantConfigData();return t&&await this.exchangeToken(t,e),this._spaHelper.refreshAccessTokenAutomatically(this),this._authenticationClient.getUser()}catch(t){let n={type:$n};return window.postMessage(n),Promise.reject(t)}}async retryFailedRequests(e){let t=e.httpClient,n=e.requestConfig,a=e.isHttpHandlerEnabled,o=e.httpErrorCallback,i=e.httpFinishCallback;await ce.until(()=>!this._isTokenRefreshing);try{let s=await t.request(n);return Promise.resolve(s)}catch(s){return a&&(typeof o=="function"&&await o(s),typeof i=="function"&&i()),Promise.reject(s)}}async httpRequest(e,t,n,a,o,i){let s=!1,u=await this._storageManager.getConfigData();for(let l of[...await u?.resourceServerURLs??[],u.baseUrl])if(l&&t?.url?.startsWith(l)){s=!0;break}return s?e.request(t).then(l=>Promise.resolve(l)).catch(async l=>{if(l?.response?.status===401||!l?.response){if(this._isTokenRefreshing)return this.retryFailedRequests({enableRetrievingSignOutURLFromSession:i,httpClient:e,httpErrorCallback:a,httpFinishCallback:o,isHttpHandlerEnabled:n,requestConfig:t});this._isTokenRefreshing=!0;let f;try{f=await this.refreshAccessToken(i),this._isTokenRefreshing=!1}catch(c){throw this._isTokenRefreshing=!1,n&&(typeof a=="function"&&await a({...l,code:Zt}),typeof o=="function"&&o()),new v("SPA-AUTH_HELPER-HR-SE01",c?.name??"Refresh token request failed.",c?.message??"An error occurred while trying to refresh the access token following a 401 response from the server.")}if(f)try{let c=await e.request(t);return Promise.resolve(c)}catch(c){return n&&(typeof a=="function"&&await a(c),typeof o=="function"&&o()),Promise.reject(c)}}return n&&(typeof a=="function"&&await a(l),typeof o=="function"&&o()),Promise.reject(l)}):Promise.reject(new v("SPA-AUTH_HELPER-HR-IV02","Request to the provided endpoint is prohibited.","Requests can only be sent to resource servers specified by the `resourceServerURLs` attribute while initializing the SDK. The specified endpoint in this request cannot be found among the `resourceServerURLs`"))}async httpRequestAll(e,t,n,a,o){let i=!0,s=await this._storageManager.getConfigData();for(let l of e){let f=!1;for(let c of[...(await s)?.resourceServerURLs??[],s.baseUrl])if(c&&l.url?.startsWith(c)){f=!0;break}if(!f){i=!1;break}}let u=[];if(i)return e.forEach(l=>{u.push(t.request(l))}),t?.all&&t.all(u).then(l=>Promise.resolve(l)).catch(async l=>{if(l?.response?.status===401||!l?.response){let f;try{f=await this._authenticationClient.refreshAccessToken()}catch(c){throw n&&(typeof a=="function"&&await a({...l,code:Zt}),typeof o=="function"&&o()),new v("SPA-AUTH_HELPER-HRA-SE01",c?.name??"Refresh token request failed.",c?.message??"An error occurred while trying to refresh the access token following a 401 response from the server.")}if(f)return t.all&&t.all(u).then(c=>Promise.resolve(c)).catch(async c=>(n&&(typeof a=="function"&&await a(c),typeof o=="function"&&o()),Promise.reject(c)))}return n&&(typeof a=="function"&&await a(l),typeof o=="function"&&o()),Promise.reject(l)});throw new v("SPA-AUTH_HELPER-HRA-IV02","Request to the provided endpoint is prohibited.","Requests can only be sent to resource servers specified by the `resourceServerURLs` attribute while initializing the SDK. The specified endpoint in this request cannot be found among the `resourceServerURLs`")}async requestAccessToken(e,t,n,a,o,i){let s=await this._storageManager.getConfigData();if(s.storage==="browserMemory"&&s.enablePKCE&&t){let u=ce.getPKCE(ye(t));await this._authenticationClient.setPKCECode(ye(t),u)}else s.storage==="webWorker"&&a&&await this._authenticationClient.setPKCECode(a,o??"");return e?this._authenticationClient.requestAccessToken(e,t??"",o??"",void 0,i).then(async()=>(s.storage!=="webWorker"?(ce.setSignOutURL(await this._authenticationClient.getSignOutUrl(),s.clientId,this._instanceID),this._spaHelper&&(this._spaHelper.clearRefreshTokenTimeout(),this._spaHelper.refreshAccessTokenAutomatically(this)),n&&typeof n=="function"&&s.syncSession&&n()):this._spaHelper&&this._spaHelper.refreshAccessTokenAutomatically(this),this._authenticationClient.getUser())).catch(u=>Promise.reject(u)):Promise.reject(new v("SPA-AUTH_HELPER-RAT1-NF01","No authorization code.","No authorization code was found."))}async signInSilently(e,t,n,a,o){if(ce.isInitializedSilentSignIn())return await n.receivePromptNoneResponse(),Promise.resolve({allowedScopes:"",displayName:"",email:"",sessionState:"",sub:"",tenantDomain:"",username:""});let s=document.getElementById(zt)?.contentDocument?.getElementById(Jt);try{let u=await e(a);s.src=u}catch(u){return Promise.reject(u)}return new Promise((u,l)=>{let f=setTimeout(()=>{u(!1)},1e4),c=async p=>{let g=p.data;g?.type==jt&&(window.removeEventListener("message",c),clearTimeout(f),u(!1)),g?.type==Wt&&g?.data?.code&&t(g?.data?.code,g?.data?.sessionState,g?.data?.state,o).then(h=>{window.removeEventListener("message",c),u(h)}).catch(h=>{window.removeEventListener("message",c),l(h)}).finally(()=>{clearTimeout(f)})};window.addEventListener("message",c)})}async handleSignIn(e,t,n){let a=await this._storageManager.getConfigData();if(await e())return Promise.resolve({allowedScopes:"",displayName:"",email:"",sessionState:"",sub:"",tenantDomain:"",username:""});if(a.storage!=="webWorker"&&await this._authenticationClient.isSignedIn())return this._spaHelper.clearRefreshTokenTimeout(),this._spaHelper.refreshAccessTokenAutomatically(this),a.syncSession&&t(),Promise.resolve(await this._authenticationClient.getUser());let o=new URL(window.location.href).searchParams.get(Oe),i=new URL(window.location.href).searchParams.get(ze);if(o){let s=new URL(window.location.href);throw s.searchParams.delete(Oe),s.searchParams.delete(ze),history.pushState(null,document.title,s.toString()),new v("SPA-AUTH_HELPER-SI-SE01",o,i??"")}if(a.storage==="webWorker"&&n){let s=await n();if(s)return s}return Promise.resolve(void 0)}async attachTokenToRequestConfig(e){let t={attachToken:!0,...e};t.attachToken&&(t.shouldAttachIDPAccessToken?e.headers={...e.headers,Authorization:`Bearer ${await this.getIDPAccessToken()}`}:e.headers={...e.headers,Authorization:`Bearer ${await this.getAccessToken()}`})}async getUser(){return this._authenticationClient.getUser()}async getDecodedIdToken(e){return this._authenticationClient.getDecodedIdToken(e)}async getDecodedIDPIDToken(){return this._authenticationClient.getDecodedIdToken()}async getCrypto(){return this._authenticationClient.getCrypto()}async getIdToken(){return this._authenticationClient.getIdToken()}async getOpenIDProviderEndpoints(){return this._authenticationClient.getOpenIDProviderEndpoints()}async getAccessToken(e){return this._authenticationClient.getAccessToken(e)}async getIDPAccessToken(){return(await this._storageManager.getSessionData())?.access_token}getStorageManager(){return this._storageManager}async isSignedIn(){return this._authenticationClient.isSignedIn()}};var lt=class{constructor(e){y(this,"_authenticationClient");y(this,"_storageManager");this._authenticationClient=e,this._storageManager=this._authenticationClient.getStorageManager()}async refreshAccessTokenAutomatically(e){if(!((await this._storageManager.getConfigData())?.periodicTokenRefresh??!1))return;let n=await this._storageManager.getSessionData();if(n.refresh_token){let a=parseInt(n.expires_in),o=a<=10?a:a-10,i=setTimeout(async()=>{await e.refreshAccessToken()},o*1e3);await this._storageManager.setTemporaryDataParameter(je.Storage.StorageKeys.REFRESH_TOKEN_TIMER,JSON.stringify(i))}}async getRefreshTimeoutTimer(){return await this._storageManager.getTemporaryDataParameter(je.Storage.StorageKeys.REFRESH_TOKEN_TIMER)?JSON.parse(await this._storageManager.getTemporaryDataParameter(je.Storage.StorageKeys.REFRESH_TOKEN_TIMER)):-1}async clearRefreshTokenTimeout(e){if(e){clearTimeout(e);return}let t=await this.getRefreshTimeoutTimer();t!==-1&&clearTimeout(t)}};var Et=ve(Ro(),1);function Io(){return r=>{}}var U=class{constructor(){y(this,"attachToken",()=>Promise.resolve());y(this,"requestStartCallback",()=>null);y(this,"requestSuccessCallback",()=>null);y(this,"requestErrorCallback",()=>null);y(this,"requestFinishCallback",()=>null);this.init=this.init.bind(this),this.setHttpRequestErrorCallback=this.setHttpRequestErrorCallback.bind(this),this.setHttpRequestFinishCallback=this.setHttpRequestFinishCallback.bind(this),this.setHttpRequestStartCallback=this.setHttpRequestStartCallback.bind(this),this.setHttpRequestSuccessCallback=this.setHttpRequestSuccessCallback.bind(this)}static getInstance(){return this.axiosInstance?this.axiosInstance:(this.axiosInstance=Et.default.create({withCredentials:!0}),this.clientInstance||(this.clientInstance=new U),this.axiosInstance.interceptors.request.use(async e=>await this.clientInstance.requestHandler(e)),this.axiosInstance.interceptors.response.use(e=>this.clientInstance.successHandler(e),e=>this.clientInstance.errorHandler(e)),this.axiosInstance.all=Et.default.all,this.axiosInstance.spread=Et.default.spread,this.axiosInstance.init=this.clientInstance.init,this.axiosInstance.enableHandler=this.clientInstance.enableHandler,this.axiosInstance.disableHandler=this.clientInstance.disableHandler,this.axiosInstance.disableHandlerWithTimeout=this.clientInstance.disableHandlerWithTimeout,this.axiosInstance.setHttpRequestStartCallback=this.clientInstance.setHttpRequestStartCallback,this.axiosInstance.setHttpRequestSuccessCallback=this.clientInstance.setHttpRequestSuccessCallback,this.axiosInstance.setHttpRequestErrorCallback=this.clientInstance.setHttpRequestErrorCallback,this.axiosInstance.setHttpRequestFinishCallback=this.clientInstance.setHttpRequestFinishCallback,this.axiosInstance)}async requestHandler(e){if(await this.attachToken(e),e?.shouldEncodeToFormData){let t=e?.data,n=new FormData;Object.keys(t).forEach(a=>{n.append(a,t[a])}),e.data=n}return e.startTimeInMs=new Date().getTime(),U.isHandlerEnabled&&this.requestStartCallback&&typeof this.requestStartCallback=="function"&&this.requestStartCallback(e),e}errorHandler(e){throw U.isHandlerEnabled&&(this.requestErrorCallback&&typeof this.requestErrorCallback=="function"&&this.requestErrorCallback(e),this.requestFinishCallback&&typeof this.requestFinishCallback=="function"&&this.requestFinishCallback()),e}successHandler(e){return U.isHandlerEnabled&&(this.requestSuccessCallback&&typeof this.requestSuccessCallback=="function"&&this.requestSuccessCallback(e),this.requestFinishCallback&&typeof this.requestFinishCallback=="function"&&this.requestFinishCallback()),e}async init(e=!0,t){U.isHandlerEnabled=e,this.attachToken=t}enableHandler(){U.isHandlerEnabled=!0}disableHandler(){U.isHandlerEnabled=!1}disableHandlerWithTimeout(e=U.DEFAULT_HANDLER_DISABLE_TIMEOUT){U.isHandlerEnabled=!1,setTimeout(()=>{U.isHandlerEnabled=!0},e)}setHttpRequestStartCallback(e){this.requestStartCallback=e}setHttpRequestSuccessCallback(e){this.requestSuccessCallback=e}setHttpRequestErrorCallback(e){this.requestErrorCallback=e}setHttpRequestFinishCallback(e){this.requestFinishCallback=e}};y(U,"axiosInstance"),y(U,"clientInstance"),y(U,"isHandlerEnabled"),y(U,"DEFAULT_HANDLER_DISABLE_TIMEOUT",1e3),U=Gr([Io()],U);var wt=class{constructor(){y(this,"_data");this._data=new Map}async setData(e,t){this._data.set(e,t)}async getData(e){return this._data?.get(e)??"{}"}async removeData(e){this._data.delete(e)}};var li=ve(ct(),1);var jr=ve(Oo(),1),fi=ve(Uo(),1);var Me=new TextEncoder,re=new TextDecoder,rd=2**32;function ko(...r){let e=r.reduce((a,{length:o})=>a+o,0),t=new Uint8Array(e),n=0;for(let a of r)t.set(a,n),n+=a.length;return t}function Do(r){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(r);let e=atob(r),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function he(r){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof r=="string"?r:re.decode(r),{alphabet:"base64url"});let e=r;e instanceof Uint8Array&&(e=re.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/\\s/g,"");try{return Do(e)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}var z=class extends Error{constructor(t,n){super(t,n);y(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};y(z,"code","ERR_JOSE_GENERIC");var j=class extends z{constructor(t,n,a="unspecified",o="unspecified"){super(t,{cause:{claim:a,reason:o,payload:n}});y(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");y(this,"claim");y(this,"reason");y(this,"payload");this.claim=a,this.reason=o,this.payload=n}};y(j,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");var Be=class extends z{constructor(t,n,a="unspecified",o="unspecified"){super(t,{cause:{claim:a,reason:o,payload:n}});y(this,"code","ERR_JWT_EXPIRED");y(this,"claim");y(this,"reason");y(this,"payload");this.claim=a,this.reason=o,this.payload=n}};y(Be,"code","ERR_JWT_EXPIRED");var Xe=class extends z{constructor(){super(...arguments);y(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}};y(Xe,"code","ERR_JOSE_ALG_NOT_ALLOWED");var L=class extends z{constructor(){super(...arguments);y(this,"code","ERR_JOSE_NOT_SUPPORTED")}};y(L,"code","ERR_JOSE_NOT_SUPPORTED");var O=class extends z{constructor(){super(...arguments);y(this,"code","ERR_JWS_INVALID")}};y(O,"code","ERR_JWS_INVALID");var Ee=class extends z{constructor(){super(...arguments);y(this,"code","ERR_JWT_INVALID")}};y(Ee,"code","ERR_JWT_INVALID");var Fe=class extends z{constructor(){super(...arguments);y(this,"code","ERR_JWKS_INVALID")}};y(Fe,"code","ERR_JWKS_INVALID");var Ye=class extends z{constructor(t="no applicable key found in the JSON Web Key Set",n){super(t,n);y(this,"code","ERR_JWKS_NO_MATCHING_KEY")}};y(Ye,"code","ERR_JWKS_NO_MATCHING_KEY");var No,Mo,Qe=class extends(Mo=z,No=Symbol.asyncIterator,Mo){constructor(t="multiple matching keys found in the JSON Web Key Set",n){super(t,n);y(this,No);y(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}};y(Qe,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");var Ze=class extends z{constructor(t="signature verification failed",n){super(t,n);y(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}};y(Ze,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function ne(r,e="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${r}`)}function et(r,e){return r.name===e}function Ur(r){return parseInt(r.name.slice(4),10)}function su(r){switch(r){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function cu(r,e){if(e&&!r.usages.includes(e))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${e}.`)}function Bo(r,e,t){switch(e){case"HS256":case"HS384":case"HS512":{if(!et(r.algorithm,"HMAC"))throw ne("HMAC");let n=parseInt(e.slice(2),10);if(Ur(r.algorithm.hash)!==n)throw ne(`SHA-${n}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!et(r.algorithm,"RSASSA-PKCS1-v1_5"))throw ne("RSASSA-PKCS1-v1_5");let n=parseInt(e.slice(2),10);if(Ur(r.algorithm.hash)!==n)throw ne(`SHA-${n}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!et(r.algorithm,"RSA-PSS"))throw ne("RSA-PSS");let n=parseInt(e.slice(2),10);if(Ur(r.algorithm.hash)!==n)throw ne(`SHA-${n}`,"algorithm.hash");break}case"Ed25519":case"EdDSA":{if(!et(r.algorithm,"Ed25519"))throw ne("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!et(r.algorithm,"ECDSA"))throw ne("ECDSA");let n=su(e);if(r.algorithm.namedCurve!==n)throw ne(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}cu(r,t)}function Fo(r,e,...t){if(t=t.filter(Boolean),t.length>2){let n=t.pop();r+=`one of type ${t.join(", ")}, or ${n}.`}else t.length===2?r+=`one of type ${t[0]} or ${t[1]}.`:r+=`of type ${t[0]}.`;return e==null?r+=` Received ${e}`:typeof e=="function"&&e.name?r+=` Received function ${e.name}`:typeof e=="object"&&e!=null&&e.constructor?.name&&(r+=` Received an instance of ${e.constructor.name}`),r}var Ho=(r,...e)=>Fo("Key must be ",r,...e);function kr(r,e,...t){return Fo(`Key for the ${r} algorithm must be `,e,...t)}function Dr(r){return r?.[Symbol.toStringTag]==="CryptoKey"}function Nr(r){return r?.[Symbol.toStringTag]==="KeyObject"}var Mr=r=>Dr(r)||Nr(r);var Lo=(...r)=>{let e=r.filter(Boolean);if(e.length===0||e.length===1)return!0;let t;for(let n of e){let a=Object.keys(n);if(!t||t.size===0){t=new Set(a);continue}for(let o of a){if(t.has(o))return!1;t.add(o)}}return!0};function uu(r){return typeof r=="object"&&r!==null}var G=r=>{if(!uu(r)||Object.prototype.toString.call(r)!=="[object Object]")return!1;if(Object.getPrototypeOf(r)===null)return!0;let e=r;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e};var $o=(r,e)=>{if(r.startsWith("RS")||r.startsWith("PS")){let{modulusLength:t}=e.algorithm;if(typeof t!="number"||t<2048)throw new TypeError(`${r} requires key modulusLength to be 2048 bits or larger`)}};function lu(r){let e,t;switch(r.kty){case"RSA":{switch(r.alg){case"PS256":case"PS384":case"PS512":e={name:"RSA-PSS",hash:`SHA-${r.alg.slice(-3)}`},t=r.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":e={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${r.alg.slice(-3)}`},t=r.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":e={name:"RSA-OAEP",hash:`SHA-${parseInt(r.alg.slice(-3),10)||1}`},t=r.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new L(\'Invalid or unsupported JWK "alg" (Algorithm) Parameter value\')}break}case"EC":{switch(r.alg){case"ES256":e={name:"ECDSA",namedCurve:"P-256"},t=r.d?["sign"]:["verify"];break;case"ES384":e={name:"ECDSA",namedCurve:"P-384"},t=r.d?["sign"]:["verify"];break;case"ES512":e={name:"ECDSA",namedCurve:"P-521"},t=r.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:"ECDH",namedCurve:r.crv},t=r.d?["deriveBits"]:[];break;default:throw new L(\'Invalid or unsupported JWK "alg" (Algorithm) Parameter value\')}break}case"OKP":{switch(r.alg){case"Ed25519":case"EdDSA":e={name:"Ed25519"},t=r.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:r.crv},t=r.d?["deriveBits"]:[];break;default:throw new L(\'Invalid or unsupported JWK "alg" (Algorithm) Parameter value\')}break}default:throw new L(\'Invalid or unsupported JWK "kty" (Key Type) Parameter value\')}return{algorithm:e,keyUsages:t}}var vt=async r=>{if(!r.alg)throw new TypeError(\'"alg" argument is required when "jwk.alg" is not present\');let{algorithm:e,keyUsages:t}=lu(r),n={...r};return delete n.alg,delete n.use,crypto.subtle.importKey("jwk",n,e,r.ext??!r.d,r.key_ops??t)};async function qo(r,e,t){if(!G(r))throw new TypeError("JWK must be an object");let n;switch(e??(e=r.alg),n??(n=t?.extractable??r.ext),r.kty){case"oct":if(typeof r.k!="string"||!r.k)throw new TypeError(\'missing "k" (Key Value) Parameter value\');return he(r.k);case"RSA":if("oth"in r&&r.oth!==void 0)throw new L(\'RSA JWK "oth" (Other Primes Info) Parameter value is not supported\');case"EC":case"OKP":return vt({...r,alg:e,ext:n});default:throw new L(\'Unsupported "kty" (Key Type) Parameter value\')}}var Ko=(r,e,t,n,a)=>{if(a.crit!==void 0&&n?.crit===void 0)throw new r(\'"crit" (Critical) Header Parameter MUST be integrity protected\');if(!n||n.crit===void 0)return new Set;if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(i=>typeof i!="string"||i.length===0))throw new r(\'"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present\');let o;t!==void 0?o=new Map([...Object.entries(t),...e.entries()]):o=e;for(let i of n.crit){if(!o.has(i))throw new L(`Extension Header Parameter "${i}" is not recognized`);if(a[i]===void 0)throw new r(`Extension Header Parameter "${i}" is missing`);if(o.get(i)&&n[i]===void 0)throw new r(`Extension Header Parameter "${i}" MUST be integrity protected`)}return new Set(n.crit)};var Wo=(r,e)=>{if(e!==void 0&&(!Array.isArray(e)||e.some(t=>typeof t!="string")))throw new TypeError(`"${r}" option must be an array of strings`);if(e)return new Set(e)};function tt(r){return G(r)&&typeof r.kty=="string"}function jo(r){return r.kty!=="oct"&&typeof r.d=="string"}function zo(r){return r.kty!=="oct"&&typeof r.d>"u"}function Jo(r){return r.kty==="oct"&&typeof r.k=="string"}var He,Vo=async(r,e,t,n=!1)=>{He||(He=new WeakMap);let a=He.get(r);if(a?.[t])return a[t];let o=await vt({...e,alg:t});return n&&Object.freeze(r),a?a[t]=o:He.set(r,{[t]:o}),o},du=(r,e)=>{He||(He=new WeakMap);let t=He.get(r);if(t?.[e])return t[e];let n=r.type==="public",a=!!n,o;if(r.asymmetricKeyType==="x25519"){switch(e){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")}o=r.toCryptoKey(r.asymmetricKeyType,a,n?[]:["deriveBits"])}if(r.asymmetricKeyType==="ed25519"){if(e!=="EdDSA"&&e!=="Ed25519")throw new TypeError("given KeyObject instance cannot be used for this algorithm");o=r.toCryptoKey(r.asymmetricKeyType,a,[n?"verify":"sign"])}if(r.asymmetricKeyType==="rsa"){let i;switch(e){case"RSA-OAEP":i="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":i="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":i="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":i="SHA-512";break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}if(e.startsWith("RSA-OAEP"))return r.toCryptoKey({name:"RSA-OAEP",hash:i},a,n?["encrypt"]:["decrypt"]);o=r.toCryptoKey({name:e.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:i},a,[n?"verify":"sign"])}if(r.asymmetricKeyType==="ec"){let s=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(r.asymmetricKeyDetails?.namedCurve);if(!s)throw new TypeError("given KeyObject instance cannot be used for this algorithm");e==="ES256"&&s==="P-256"&&(o=r.toCryptoKey({name:"ECDSA",namedCurve:s},a,[n?"verify":"sign"])),e==="ES384"&&s==="P-384"&&(o=r.toCryptoKey({name:"ECDSA",namedCurve:s},a,[n?"verify":"sign"])),e==="ES512"&&s==="P-521"&&(o=r.toCryptoKey({name:"ECDSA",namedCurve:s},a,[n?"verify":"sign"])),e.startsWith("ECDH-ES")&&(o=r.toCryptoKey({name:"ECDH",namedCurve:s},a,n?[]:["deriveBits"]))}if(!o)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return t?t[e]=o:He.set(r,{[e]:o}),o},Go=async(r,e)=>{if(r instanceof Uint8Array||Dr(r))return r;if(Nr(r)){if(r.type==="secret")return r.export();if("toCryptoKey"in r&&typeof r.toCryptoKey=="function")try{return du(r,e)}catch(n){if(n instanceof TypeError)throw n}let t=r.export({format:"jwk"});return Vo(r,t,e)}if(tt(r))return r.k?he(r.k):Vo(r,r,e,!0);throw new Error("unreachable")};var Le=r=>r?.[Symbol.toStringTag],Br=(r,e,t)=>{if(e.use!==void 0){let n;switch(t){case"sign":case"verify":n="sig";break;case"encrypt":case"decrypt":n="enc";break}if(e.use!==n)throw new TypeError(`Invalid key for this operation, its "use" must be "${n}" when present`)}if(e.alg!==void 0&&e.alg!==r)throw new TypeError(`Invalid key for this operation, its "alg" must be "${r}" when present`);if(Array.isArray(e.key_ops)){let n;switch(!0){case(t==="sign"||t==="verify"):case r==="dir":case r.includes("CBC-HS"):n=t;break;case r.startsWith("PBES2"):n="deriveBits";break;case/^A\\d{3}(?:GCM)?(?:KW)?$/.test(r):!r.includes("GCM")&&r.endsWith("KW")?n=t==="encrypt"?"wrapKey":"unwrapKey":n=t;break;case(t==="encrypt"&&r.startsWith("RSA")):n="wrapKey";break;case t==="decrypt":n=r.startsWith("RSA")?"unwrapKey":"deriveBits";break}if(n&&e.key_ops?.includes?.(n)===!1)throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${n}" when present`)}return!0},pu=(r,e,t)=>{if(!(e instanceof Uint8Array)){if(tt(e)){if(Jo(e)&&Br(r,e,t))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(e))throw new TypeError(kr(r,e,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(e.type!=="secret")throw new TypeError(`${Le(e)} instances for symmetric algorithms must be of type "secret"`)}},hu=(r,e,t)=>{if(tt(e))switch(t){case"decrypt":case"sign":if(jo(e)&&Br(r,e,t))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if(zo(e)&&Br(r,e,t))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!Mr(e))throw new TypeError(kr(r,e,"CryptoKey","KeyObject","JSON Web Key"));if(e.type==="secret")throw new TypeError(`${Le(e)} instances for asymmetric algorithms must not be of type "secret"`);if(e.type==="public")switch(t){case"sign":throw new TypeError(`${Le(e)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw new TypeError(`${Le(e)} instances for asymmetric algorithm decryption must be of type "private"`);default:break}if(e.type==="private")switch(t){case"verify":throw new TypeError(`${Le(e)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw new TypeError(`${Le(e)} instances for asymmetric algorithm encryption must be of type "public"`);default:break}},Xo=(r,e,t)=>{r.startsWith("HS")||r==="dir"||r.startsWith("PBES2")||/^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(r)||/^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(r)?pu(r,e,t):hu(r,e,t)};var Yo=(r,e)=>{let t=`SHA-${r.slice(-3)}`;switch(r){case"HS256":case"HS384":case"HS512":return{hash:t,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:t,name:"RSA-PSS",saltLength:parseInt(r.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:t,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:t,name:"ECDSA",namedCurve:e.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};default:throw new L(`alg ${r} is not supported either by JOSE or your javascript runtime`)}};var Qo=async(r,e,t)=>{if(e instanceof Uint8Array){if(!r.startsWith("HS"))throw new TypeError(Ho(e,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",e,{hash:`SHA-${r.slice(-3)}`,name:"HMAC"},!1,[t])}return Bo(e,r,t),e};var Zo=async(r,e,t,n)=>{let a=await Qo(r,e,"verify");$o(r,a);let o=Yo(r,a.algorithm);try{return await crypto.subtle.verify(o,a,t,n)}catch{return!1}};async function ei(r,e,t){if(!G(r))throw new O("Flattened JWS must be an object");if(r.protected===void 0&&r.header===void 0)throw new O(\'Flattened JWS must have either of the "protected" or "header" members\');if(r.protected!==void 0&&typeof r.protected!="string")throw new O("JWS Protected Header incorrect type");if(r.payload===void 0)throw new O("JWS Payload missing");if(typeof r.signature!="string")throw new O("JWS Signature missing or incorrect type");if(r.header!==void 0&&!G(r.header))throw new O("JWS Unprotected Header incorrect type");let n={};if(r.protected)try{let b=he(r.protected);n=JSON.parse(re.decode(b))}catch{throw new O("JWS Protected Header is invalid")}if(!Lo(n,r.header))throw new O("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let a={...n,...r.header},o=Ko(O,new Map([["b64",!0]]),t?.crit,n,a),i=!0;if(o.has("b64")&&(i=n.b64,typeof i!="boolean"))throw new O(\'The "b64" (base64url-encode payload) Header Parameter must be a boolean\');let{alg:s}=a;if(typeof s!="string"||!s)throw new O(\'JWS "alg" (Algorithm) Header Parameter missing or invalid\');let u=t&&Wo("algorithms",t.algorithms);if(u&&!u.has(s))throw new Xe(\'"alg" (Algorithm) Header Parameter value not allowed\');if(i){if(typeof r.payload!="string")throw new O("JWS Payload must be a string")}else if(typeof r.payload!="string"&&!(r.payload instanceof Uint8Array))throw new O("JWS Payload must be a string or an Uint8Array instance");let l=!1;typeof e=="function"&&(e=await e(n,r),l=!0),Xo(s,e,"verify");let f=ko(Me.encode(r.protected??""),Me.encode("."),typeof r.payload=="string"?Me.encode(r.payload):r.payload),c;try{c=he(r.signature)}catch{throw new O("Failed to base64url decode the signature")}let p=await Go(e,s);if(!await Zo(s,p,c,f))throw new Ze;let h;if(i)try{h=he(r.payload)}catch{throw new O("Failed to base64url decode the payload")}else typeof r.payload=="string"?h=Me.encode(r.payload):h=r.payload;let m={payload:h};return r.protected!==void 0&&(m.protectedHeader=n),r.header!==void 0&&(m.unprotectedHeader=r.header),l?{...m,key:p}:m}async function ti(r,e,t){if(r instanceof Uint8Array&&(r=re.decode(r)),typeof r!="string")throw new O("Compact JWS must be a string or Uint8Array");let{0:n,1:a,2:o,length:i}=r.split(".");if(i!==3)throw new O("Invalid Compact JWS");let s=await ei({payload:a,protected:n,signature:o},e,t),u={payload:s.payload,protectedHeader:s.protectedHeader};return typeof e=="function"?{...u,key:s.key}:u}var ri=r=>Math.floor(r.getTime()/1e3);var gu=/^(\\+|\\-)? ?(\\d+|\\d+\\.\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Fr=r=>{let e=gu.exec(r);if(!e||e[4]&&e[1])throw new TypeError("Invalid time period format");let t=parseFloat(e[2]),n=e[3].toLowerCase(),a;switch(n){case"sec":case"secs":case"second":case"seconds":case"s":a=Math.round(t);break;case"minute":case"minutes":case"min":case"mins":case"m":a=Math.round(t*60);break;case"hour":case"hours":case"hr":case"hrs":case"h":a=Math.round(t*3600);break;case"day":case"days":case"d":a=Math.round(t*86400);break;case"week":case"weeks":case"w":a=Math.round(t*604800);break;default:a=Math.round(t*31557600);break}return e[1]==="-"||e[4]==="ago"?-a:a};var ni=r=>r.includes("/")?r.toLowerCase():`application/${r.toLowerCase()}`,mu=(r,e)=>typeof r=="string"?e.includes(r):Array.isArray(r)?e.some(Set.prototype.has.bind(new Set(r))):!1;function ai(r,e,t={}){let n;try{n=JSON.parse(re.decode(e))}catch{}if(!G(n))throw new Ee("JWT Claims Set must be a top-level JSON object");let{typ:a}=t;if(a&&(typeof r.typ!="string"||ni(r.typ)!==ni(a)))throw new j(\'unexpected "typ" JWT header value\',n,"typ","check_failed");let{requiredClaims:o=[],issuer:i,subject:s,audience:u,maxTokenAge:l}=t,f=[...o];l!==void 0&&f.push("iat"),u!==void 0&&f.push("aud"),s!==void 0&&f.push("sub"),i!==void 0&&f.push("iss");for(let h of new Set(f.reverse()))if(!(h in n))throw new j(`missing required "${h}" claim`,n,h,"missing");if(i&&!(Array.isArray(i)?i:[i]).includes(n.iss))throw new j(\'unexpected "iss" claim value\',n,"iss","check_failed");if(s&&n.sub!==s)throw new j(\'unexpected "sub" claim value\',n,"sub","check_failed");if(u&&!mu(n.aud,typeof u=="string"?[u]:u))throw new j(\'unexpected "aud" claim value\',n,"aud","check_failed");let c;switch(typeof t.clockTolerance){case"string":c=Fr(t.clockTolerance);break;case"number":c=t.clockTolerance;break;case"undefined":c=0;break;default:throw new TypeError("Invalid clockTolerance option type")}let{currentDate:p}=t,g=ri(p||new Date);if((n.iat!==void 0||l)&&typeof n.iat!="number")throw new j(\'"iat" claim must be a number\',n,"iat","invalid");if(n.nbf!==void 0){if(typeof n.nbf!="number")throw new j(\'"nbf" claim must be a number\',n,"nbf","invalid");if(n.nbf>g+c)throw new j(\'"nbf" claim timestamp check failed\',n,"nbf","check_failed")}if(n.exp!==void 0){if(typeof n.exp!="number")throw new j(\'"exp" claim must be a number\',n,"exp","invalid");if(n.exp<=g-c)throw new Be(\'"exp" claim timestamp check failed\',n,"exp","check_failed")}if(l){let h=g-n.iat,m=typeof l=="number"?l:Fr(l);if(h-c>m)throw new Be(\'"iat" claim timestamp check failed (too far in the past)\',n,"iat","check_failed");if(h<0-c)throw new j(\'"iat" claim timestamp check failed (it should be in the past)\',n,"iat","check_failed")}return n}async function Hr(r,e,t){let n=await ti(r,e,t);if(n.protectedHeader.crit?.includes("b64")&&n.protectedHeader.b64===!1)throw new Ee("JWTs MUST NOT use unencoded payload");let o={payload:ai(n.protectedHeader,n.payload,t),protectedHeader:n.protectedHeader};return typeof e=="function"?{...o,key:n.key}:o}function yu(r){switch(typeof r=="string"&&r.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new L(\'Unsupported "alg" value for a JSON Web Key Set\')}}function Su(r){return r&&typeof r=="object"&&Array.isArray(r.keys)&&r.keys.every(Eu)}function Eu(r){return G(r)}var $e,rt,Lr=class{constructor(e){at(this,$e);at(this,rt,new WeakMap);if(!Su(e))throw new Fe("JSON Web Key Set malformed");At(this,$e,structuredClone(e))}jwks(){return _e(this,$e)}async getKey(e,t){let{alg:n,kid:a}={...e,...t?.header},o=yu(n),i=_e(this,$e).keys.filter(l=>{let f=o===l.kty;if(f&&typeof a=="string"&&(f=a===l.kid),f&&typeof l.alg=="string"&&(f=n===l.alg),f&&typeof l.use=="string"&&(f=l.use==="sig"),f&&Array.isArray(l.key_ops)&&(f=l.key_ops.includes("verify")),f)switch(n){case"ES256":f=l.crv==="P-256";break;case"ES384":f=l.crv==="P-384";break;case"ES512":f=l.crv==="P-521";break;case"Ed25519":case"EdDSA":f=l.crv==="Ed25519";break}return f}),{0:s,length:u}=i;if(u===0)throw new Ye;if(u!==1){let l=new Qe,f=_e(this,rt);throw l[Symbol.asyncIterator]=async function*(){for(let c of i)try{yield await oi(f,c,n)}catch{}},l}return oi(_e(this,rt),s,n)}};$e=new WeakMap,rt=new WeakMap;async function oi(r,e,t){let n=r.get(e)||r.set(e,{}).get(e);if(n[t]===void 0){let a=await qo({...e,ext:!0},t);if(a instanceof Uint8Array||a.type!=="public")throw new Fe("JSON Web Key Set members must be public keys");n[t]=a}return n[t]}function $r(r){let e=new Lr(r),t=async(n,a)=>e.getKey(n,a);return Object.defineProperties(t,{jwks:{value:()=>structuredClone(e.jwks()),enumerable:!1,configurable:!1,writable:!1}}),t}var di=ve(ui(),1),It=class{base64URLEncode(e){return jr.default.encode(e).replace(/\\+/g,"-").replace(/\\//g,"_").replace(/=/g,"")}base64URLDecode(e){return jr.default.decode(e).toString()}hashSha256(e){return li.Buffer.from((0,fi.default)(new TextEncoder().encode(e)))}generateRandomBytes(e){return(0,di.default)(e)}verifyJwt(e,t,n,a,o,i,s,u){let l={algorithms:n,audience:a,clockTolerance:s,subject:i};return(u??!0)&&(l.issuer=o),Hr(e,$r({keys:[t]}),l).then(()=>Promise.resolve(!0)).catch(f=>Promise.reject(new v("SPA-CRYPTO-UTILS-VJ-IV01",f?.reason??JSON.stringify(f),`${f?.code} ${f?.claim}`)))}};var pi=async(r,e)=>{let t=new wt,n=new It,a=new Se;await a.initialize(r,t,n);let o=new lt(a),i=e(a,o),s=a.getStorageManager(),u=U.getInstance(),l=async A=>{await i.attachTokenToRequestConfig(A)};return u?.init&&await u.init(!0,l),{disableHttpHandler:()=>{i.disableHttpHandler(u)},enableHttpHandler:()=>{i.enableHttpHandler(u)},getAccessToken:()=>i.getAccessToken(),getSignInUrl:async A=>a.getSignInUrl(A).then(async ae=>{let xt=new URL(ae).searchParams.get(H.Params.STATE)??"",mi=await a.getPKCECode(xt);return{authorizationURL:ae,pkce:mi}}).catch(ae=>Promise.reject(ae)),getUser:async()=>i.getUser(),getConfigData:async()=>s.getConfigData(),getCrypto:async()=>i.getCrypto(),getDecodedIDPIDToken:async()=>i.getDecodedIDPIDToken(),getDecodedIdToken:async A=>i.getDecodedIdToken(A),getIdToken:async()=>i.getIdToken(),getOpenIDProviderEndpoints:async()=>i.getOpenIDProviderEndpoints(),getSignOutUrl:async()=>await a.getSignOutUrl(),httpRequest:async A=>await i.httpRequest(u,A),httpRequestAll:async A=>await i.httpRequestAll(A,u),isSignedIn:()=>i.isSignedIn(),refreshAccessToken:async()=>{try{return await i.refreshAccessToken()}catch(A){return Promise.reject(A)}},requestAccessToken:async(A,ae,zr,xt)=>await i.requestAccessToken(A,ae,void 0,zr,xt),exchangeToken:async A=>await i.exchangeToken(A),revokeAccessToken:async()=>{let A=await o.getRefreshTimeoutTimer();return a.revokeAccessToken().then(()=>(o.clearRefreshTokenTimeout(A),Promise.resolve(!0))).catch(ae=>Promise.reject(ae))},setHttpRequestFinishCallback:A=>{u?.setHttpRequestFinishCallback&&u.setHttpRequestFinishCallback(A)},setHttpRequestStartCallback:A=>{u?.setHttpRequestStartCallback&&u.setHttpRequestStartCallback(A)},setHttpRequestSuccessCallback:A=>{u?.setHttpRequestSuccessCallback&&u.setHttpRequestSuccessCallback(A)},setSessionState:async A=>{await s.setSessionDataParameter(H.Params.SESSION_STATE,A)},signOut:async()=>(o.clearRefreshTokenTimeout(),await a.getSignOutUrl()),startAutoRefreshToken:async()=>{o.clearRefreshTokenTimeout(),o.refreshAccessTokenAutomatically(i)},reInitialize:async A=>{await a.reInitialize(A)}}};var hi=r=>{let e=self,t;e.onmessage=async({data:i,ports:s})=>{let u=s[0];if(i.type!==Kt&&!t){u.postMessage(w.generateFailureMessage(new v("SPA-CLIENT_WORKER-ONMSG-NF01","The web worker has not been initialized yet.","The initialize method needs to be called before the specified operation can be carried out.")));return}switch(i.type){case Kt:try{let l={...i.data};t=await pi(l,r),t.setHttpRequestFinishCallback(o),t.setHttpRequestStartCallback(n),t.setHttpRequestSuccessCallback(a),u.postMessage(w.generateSuccessMessage())}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Mn:t.getSignInUrl(i?.data).then(l=>{u.postMessage(w.generateSuccessMessage(l))}).catch(l=>{u.postMessage(w.generateFailureMessage(l))});break;case Bn:t.requestAccessToken(i?.data?.code,i?.data?.sessionState,i?.data?.pkce,i?.data?.state).then(l=>{u.postMessage(w.generateSuccessMessage(l))}).catch(l=>{u.postMessage(w.generateFailureMessage(l))});break;case vn:{let l=i.data,f=l?.data;if(i.data?.data?.formData===!0){let c=new FormData;for(let p in f)p!=="formData"&&c.append(p,f[p]);l.data=c}t.httpRequest(l).then(c=>{u.postMessage(w.generateSuccessMessage(c))}).catch(c=>{u.postMessage(w.generateFailureMessage(c))});break}case _n:t.httpRequestAll(i.data).then(l=>{u.postMessage(w.generateSuccessMessage(l))}).catch(l=>{u.postMessage(w.generateFailureMessage(l))});break;case Tn:try{u.postMessage(w.generateSuccessMessage(await t.signOut()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Rn:t.exchangeToken(i.data).then(l=>{u.postMessage(w.generateSuccessMessage(l))}).catch(l=>{u.postMessage(w.generateFailureMessage(l))});break;case In:t.revokeAccessToken().then(l=>{u.postMessage(w.generateSuccessMessage(l))}).catch(l=>{u.postMessage(w.generateFailureMessage(l))});break;case On:try{u.postMessage(w.generateSuccessMessage(await t.getOpenIDProviderEndpoints()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Pn:try{u.postMessage(w.generateSuccessMessage(await t.getUser()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Un:try{u.postMessage(w.generateSuccessMessage(await t.getDecodedIdToken()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case kn:try{u.postMessage(w.generateSuccessMessage(await t.getCrypto()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case jn:try{u.postMessage(w.generateSuccessMessage(await t.getIdToken()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Dn:t.enableHttpHandler(),u.postMessage(w.generateSuccessMessage());break;case Nn:t.disableHttpHandler(),u.postMessage(w.generateSuccessMessage());break;case Fn:try{u.postMessage(w.generateSuccessMessage(await t.isSignedIn()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Hn:try{u.postMessage(w.generateSuccessMessage(await t.getSignOutUrl()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Ln:try{u.postMessage(w.generateSuccessMessage(await t.refreshAccessToken()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Kn:try{u.postMessage(w.generateSuccessMessage(t.startAutoRefreshToken()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case qn:try{u.postMessage(w.generateSuccessMessage(await t.setSessionState(i?.data)))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case Wn:try{u.postMessage(w.generateSuccessMessage(await t.reInitialize(i?.data)))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;case zn:try{u.postMessage(w.generateSuccessMessage(await t.getConfigData()))}catch(l){u.postMessage(w.generateFailureMessage(l))}break;default:u?.postMessage(w.generateFailureMessage(new v("SPA-CLIENT_WORKER-ONMSG-IV02","The message type is invalid.",`The message type provided, ${i.type}, is invalid.`)))}};let n=()=>{e.postMessage({type:xn})},a=i=>{e.postMessage({data:JSON.stringify(i??""),type:An})},o=()=>{e.postMessage({type:Cn})}};typeof self<"u"&&!self.Buffer&&(self.Buffer=gi.Buffer);typeof self<"u"&&(self.global||(self.global=self));hi((r,e)=>new ut(r,e));var sh={};})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n\nbuffer/index.js:\n (*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n *)\n\nsafe-buffer/index.js:\n (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n');
1972
1973
  }
1973
1974
 
1974
1975
  // src/__legacy__/clients/main-thread-client.ts
@@ -5035,6 +5036,13 @@ var _AsgardeoSPAClient = class _AsgardeoSPAClient {
5035
5036
  }
5036
5037
  return;
5037
5038
  }
5039
+ /**
5040
+ * This method clears the session information from the storage.
5041
+ * @param sessionId - The session ID of the session to be cleared. If not provided, the current session will be cleared.
5042
+ */
5043
+ clearSession(sessionId) {
5044
+ import_javascript8.AsgardeoAuthClient.clearSession(sessionId);
5045
+ }
5038
5046
  };
5039
5047
  __publicField(_AsgardeoSPAClient, "_instances", /* @__PURE__ */ new Map());
5040
5048
  var AsgardeoSPAClient = _AsgardeoSPAClient;
@@ -5529,6 +5537,154 @@ var getActiveTheme = (mode, config = {}) => {
5529
5537
  };
5530
5538
  var getActiveTheme_default = getActiveTheme;
5531
5539
 
5540
+ // src/utils/handleWebAuthnAuthentication.ts
5541
+ var import_javascript13 = require("@asgardeo/javascript");
5542
+ var handleWebAuthnAuthentication = async (challengeData) => {
5543
+ if (!window.navigator.credentials || !window.navigator.credentials.get) {
5544
+ throw new import_javascript13.AsgardeoRuntimeError(
5545
+ "WebAuthn is not supported in this browser. Please use a modern browser or try a different authentication method.",
5546
+ "browser-webauthn-not-supported",
5547
+ "browser",
5548
+ "WebAuthn/Passkey authentication requires a browser that supports the Web Authentication API."
5549
+ );
5550
+ }
5551
+ if (window.location.protocol !== "https:" && window.location.hostname !== "localhost") {
5552
+ throw new import_javascript13.AsgardeoRuntimeError(
5553
+ "Passkey authentication requires a secure connection (HTTPS). Please ensure you are accessing this site over HTTPS.",
5554
+ "browser-webauthn-insecure-connection",
5555
+ "browser",
5556
+ "WebAuthn authentication requires HTTPS for security reasons, except when running on localhost for development."
5557
+ );
5558
+ }
5559
+ try {
5560
+ const decodedChallenge = JSON.parse(atob(challengeData));
5561
+ const { publicKeyCredentialRequestOptions } = decodedChallenge;
5562
+ const currentDomain = window.location.hostname;
5563
+ const challengeRpId = publicKeyCredentialRequestOptions.rpId;
5564
+ let rpIdToUse = challengeRpId;
5565
+ if (challengeRpId && !currentDomain.endsWith(challengeRpId) && challengeRpId !== currentDomain) {
5566
+ console.warn(`RP ID mismatch detected. Challenge RP ID: ${challengeRpId}, Current domain: ${currentDomain}`);
5567
+ rpIdToUse = currentDomain;
5568
+ }
5569
+ const adjustedOptions = {
5570
+ ...publicKeyCredentialRequestOptions,
5571
+ rpId: rpIdToUse,
5572
+ challenge: (0, import_javascript13.base64urlToArrayBuffer)(publicKeyCredentialRequestOptions.challenge),
5573
+ ...publicKeyCredentialRequestOptions.userVerification && {
5574
+ userVerification: publicKeyCredentialRequestOptions.userVerification
5575
+ },
5576
+ ...publicKeyCredentialRequestOptions.allowCredentials && {
5577
+ allowCredentials: publicKeyCredentialRequestOptions.allowCredentials.map((cred) => ({
5578
+ ...cred,
5579
+ id: (0, import_javascript13.base64urlToArrayBuffer)(cred.id)
5580
+ }))
5581
+ }
5582
+ };
5583
+ const credential = await navigator.credentials.get({
5584
+ publicKey: adjustedOptions
5585
+ });
5586
+ if (!credential) {
5587
+ throw new import_javascript13.AsgardeoRuntimeError(
5588
+ "No credential returned from WebAuthn authentication",
5589
+ "browser-webauthn-no-credential",
5590
+ "browser",
5591
+ "The WebAuthn authentication ceremony completed but did not return a valid credential."
5592
+ );
5593
+ }
5594
+ const authData = credential.response;
5595
+ const tokenResponse = {
5596
+ requestId: decodedChallenge.requestId,
5597
+ credential: {
5598
+ id: credential.id,
5599
+ rawId: (0, import_javascript13.arrayBufferToBase64url)(credential.rawId),
5600
+ response: {
5601
+ authenticatorData: (0, import_javascript13.arrayBufferToBase64url)(authData.authenticatorData),
5602
+ clientDataJSON: (0, import_javascript13.arrayBufferToBase64url)(authData.clientDataJSON),
5603
+ signature: (0, import_javascript13.arrayBufferToBase64url)(authData.signature),
5604
+ ...authData.userHandle && {
5605
+ userHandle: (0, import_javascript13.arrayBufferToBase64url)(authData.userHandle)
5606
+ }
5607
+ },
5608
+ type: credential.type
5609
+ }
5610
+ };
5611
+ return JSON.stringify(tokenResponse);
5612
+ } catch (error) {
5613
+ console.error("WebAuthn authentication failed:", error);
5614
+ if (error instanceof import_javascript13.AsgardeoRuntimeError) {
5615
+ throw error;
5616
+ }
5617
+ if (error instanceof Error) {
5618
+ switch (error.name) {
5619
+ case "NotAllowedError":
5620
+ throw new import_javascript13.AsgardeoRuntimeError(
5621
+ "Passkey authentication was cancelled or timed out. Please try again.",
5622
+ "browser-webauthn-user-cancelled",
5623
+ "browser",
5624
+ "The user cancelled the WebAuthn authentication request or the request timed out."
5625
+ );
5626
+ case "SecurityError":
5627
+ if (error.message.includes("relying party ID") || error.message.includes("RP ID")) {
5628
+ throw new import_javascript13.AsgardeoRuntimeError(
5629
+ "Domain mismatch error. The passkey was registered for a different domain. Please contact support or try a different authentication method.",
5630
+ "browser-webauthn-domain-mismatch",
5631
+ "browser",
5632
+ "The WebAuthn relying party ID does not match the current domain."
5633
+ );
5634
+ }
5635
+ throw new import_javascript13.AsgardeoRuntimeError(
5636
+ "Passkey authentication failed due to a security error. Please ensure you are using HTTPS and that your browser supports passkeys.",
5637
+ "browser-webauthn-security-error",
5638
+ "browser",
5639
+ "A security error occurred during WebAuthn authentication."
5640
+ );
5641
+ case "InvalidStateError":
5642
+ throw new import_javascript13.AsgardeoRuntimeError(
5643
+ "No valid passkey found for this account. Please register a passkey first or use a different authentication method.",
5644
+ "browser-webauthn-no-passkey",
5645
+ "browser",
5646
+ "No registered passkey credentials were found for the current user account."
5647
+ );
5648
+ case "NotSupportedError":
5649
+ throw new import_javascript13.AsgardeoRuntimeError(
5650
+ "Passkey authentication is not supported on this device or browser. Please use a different authentication method.",
5651
+ "browser-webauthn-not-supported",
5652
+ "browser",
5653
+ "WebAuthn is not supported on the current device or browser configuration."
5654
+ );
5655
+ case "NetworkError":
5656
+ throw new import_javascript13.AsgardeoRuntimeError(
5657
+ "Network error during passkey authentication. Please check your connection and try again.",
5658
+ "browser-webauthn-network-error",
5659
+ "browser",
5660
+ "A network error occurred while communicating with the authenticator."
5661
+ );
5662
+ case "UnknownError":
5663
+ throw new import_javascript13.AsgardeoRuntimeError(
5664
+ "An unknown error occurred during passkey authentication. Please try again or use a different authentication method.",
5665
+ "browser-webauthn-unknown-error",
5666
+ "browser",
5667
+ "An unidentified error occurred during the WebAuthn authentication process."
5668
+ );
5669
+ default:
5670
+ throw new import_javascript13.AsgardeoRuntimeError(
5671
+ `Passkey authentication failed: ${error.message}`,
5672
+ "browser-webauthn-general-error",
5673
+ "browser",
5674
+ `WebAuthn authentication failed with error: ${error.name}`
5675
+ );
5676
+ }
5677
+ }
5678
+ throw new import_javascript13.AsgardeoRuntimeError(
5679
+ "Passkey authentication failed due to an unexpected error.",
5680
+ "browser-webauthn-unexpected-error",
5681
+ "browser",
5682
+ "An unexpected error occurred during WebAuthn authentication."
5683
+ );
5684
+ }
5685
+ };
5686
+ var handleWebAuthnAuthentication_default = handleWebAuthnAuthentication;
5687
+
5532
5688
  // src/utils/http.ts
5533
5689
  var http = {
5534
5690
  /**