@asgardeo/browser 0.2.8 → 0.2.9
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/__legacy__/http-client/helpers/decorators.d.ts +1 -1
- package/dist/cjs/index.js +49 -37
- package/dist/cjs/index.js.map +3 -3
- package/dist/index.js +34 -16
- package/dist/index.js.map +3 -3
- package/dist/utils/http.d.ts +3 -14
- package/dist/web.worker.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1915,7 +1915,8 @@ var require_browser = __commonJS({
|
|
|
1915
1915
|
// src/__legacy__/client.ts
|
|
1916
1916
|
import {
|
|
1917
1917
|
AsgardeoAuthClient as AsgardeoAuthClient7,
|
|
1918
|
-
AsgardeoAuthException as AsgardeoAuthException4
|
|
1918
|
+
AsgardeoAuthException as AsgardeoAuthException4,
|
|
1919
|
+
createPackageComponentLogger
|
|
1919
1920
|
} from "@asgardeo/javascript";
|
|
1920
1921
|
|
|
1921
1922
|
// inline-worker:__inline-worker
|
|
@@ -1929,7 +1930,7 @@ function inlineWorker(scriptText) {
|
|
|
1929
1930
|
|
|
1930
1931
|
// src/web.worker.ts
|
|
1931
1932
|
function Worker2() {
|
|
1932
|
-
return inlineWorker('(()=>{var zs=Object.create;var tt=Object.defineProperty;var En=Object.getOwnPropertyDescriptor;var Js=Object.getOwnPropertyNames;var Vs=Object.getPrototypeOf,Gs=Object.prototype.hasOwnProperty;var bn=t=>{throw TypeError(t)};var Xs=(t,e,r)=>e in t?tt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var fe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ys=(t,e)=>{for(var r in e)tt(t,r,{get:e[r],enumerable:!0})},Zs=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Js(e))!Gs.call(t,o)&&o!==r&&tt(t,o,{get:()=>e[o],enumerable:!(n=En(e,o))||n.enumerable});return t};var rt=(t,e,r)=>(r=t!=null?zs(Vs(t)):{},Zs(e||!t||!t.__esModule?tt(r,"default",{value:t,enumerable:!0}):r,t));var Tn=(t,e,r,n)=>{for(var o=n>1?void 0:n?En(e,r):e,s=t.length-1,i;s>=0;s--)(i=t[s])&&(o=(n?i(e,r,o):i(o))||o);return n&&o&&tt(e,r,o),o};var S=(t,e,r)=>Xs(t,typeof e!="symbol"?e+"":e,r),Rn=(t,e,r)=>e.has(t)||bn("Cannot "+r);var ke=(t,e,r)=>(Rn(t,e,"read from private field"),r?r.call(t):e.get(t)),xt=(t,e,r)=>e.has(t)?bn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),nr=(t,e,r,n)=>(Rn(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);var xn=fe(At=>{"use strict";At.byteLength=ei;At.toByteArray=ri;At.fromByteArray=si;var ne=[],X=[],Qs=typeof Uint8Array<"u"?Uint8Array:Array,or="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(_e=0,_n=or.length;_e<_n;++_e)ne[_e]=or[_e],X[or.charCodeAt(_e)]=_e;var _e,_n;X[45]=62;X[95]=63;function In(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function ei(t){var e=In(t),r=e[0],n=e[1];return(r+n)*3/4-n}function ti(t,e,r){return(e+r)*3/4-r}function ri(t){var e,r=In(t),n=r[0],o=r[1],s=new Qs(ti(t,n,o)),i=0,a=o>0?n-4:n,l;for(l=0;l<a;l+=4)e=X[t.charCodeAt(l)]<<18|X[t.charCodeAt(l+1)]<<12|X[t.charCodeAt(l+2)]<<6|X[t.charCodeAt(l+3)],s[i++]=e>>16&255,s[i++]=e>>8&255,s[i++]=e&255;return o===2&&(e=X[t.charCodeAt(l)]<<2|X[t.charCodeAt(l+1)]>>4,s[i++]=e&255),o===1&&(e=X[t.charCodeAt(l)]<<10|X[t.charCodeAt(l+1)]<<4|X[t.charCodeAt(l+2)]>>2,s[i++]=e>>8&255,s[i++]=e&255),s}function ni(t){return ne[t>>18&63]+ne[t>>12&63]+ne[t>>6&63]+ne[t&63]}function oi(t,e,r){for(var n,o=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),o.push(ni(n));return o.join("")}function si(t){for(var e,r=t.length,n=r%3,o=[],s=16383,i=0,a=r-n;i<a;i+=s)o.push(oi(t,i,i+s>a?a:i+s));return n===1?(e=t[r-1],o.push(ne[e>>2]+ne[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(ne[e>>10]+ne[e>>4&63]+ne[e<<2&63]+"=")),o.join("")}});var An=fe(sr=>{sr.read=function(t,e,r,n,o){var s,i,a=o*8-n-1,l=(1<<a)-1,c=l>>1,f=-7,u=r?o-1:0,h=r?-1:1,m=t[e+u];for(u+=h,s=m&(1<<-f)-1,m>>=-f,f+=a;f>0;s=s*256+t[e+u],u+=h,f-=8);for(i=s&(1<<-f)-1,s>>=-f,f+=n;f>0;i=i*256+t[e+u],u+=h,f-=8);if(s===0)s=1-c;else{if(s===l)return i?NaN:(m?-1:1)*(1/0);i=i+Math.pow(2,n),s=s-c}return(m?-1:1)*i*Math.pow(2,s-n)};sr.write=function(t,e,r,n,o,s){var i,a,l,c=s*8-o-1,f=(1<<c)-1,u=f>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,p=n?1:-1,w=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,i=f):(i=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+u>=1?e+=h/l:e+=h*Math.pow(2,1-u),e*l>=2&&(i++,l/=2),i+u>=f?(a=0,i=f):i+u>=1?(a=(e*l-1)*Math.pow(2,o),i=i+u):(a=e*Math.pow(2,u-1)*Math.pow(2,o),i=0));o>=8;t[r+m]=a&255,m+=p,a/=256,o-=8);for(i=i<<o|a,c+=o;c>0;t[r+m]=i&255,m+=p,i/=256,c-=8);t[r+m-p]|=w*128}});var Ct=fe(Me=>{"use strict";var ir=xn(),De=An(),vn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Me.Buffer=g;Me.SlowBuffer=fi;Me.INSPECT_MAX_BYTES=50;var vt=2147483647;Me.kMaxLength=vt;g.TYPED_ARRAY_SUPPORT=ii();!g.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 ii(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(g.prototype,"parent",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.buffer}});Object.defineProperty(g.prototype,"offset",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.byteOffset}});function de(t){if(t>vt)throw new RangeError(\'The value "\'+t+\'" is invalid for option "size"\');let e=new Uint8Array(t);return Object.setPrototypeOf(e,g.prototype),e}function g(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError(\'The "string" argument must be of type string. Received type number\');return ur(t)}return Un(t,e,r)}g.poolSize=8192;function Un(t,e,r){if(typeof t=="string")return ci(t,e);if(ArrayBuffer.isView(t))return li(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(oe(t,ArrayBuffer)||t&&oe(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(oe(t,SharedArrayBuffer)||t&&oe(t.buffer,SharedArrayBuffer)))return cr(t,e,r);if(typeof t=="number")throw new TypeError(\'The "value" argument must not be of type number. Received type number\');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return g.from(n,e,r);let o=ui(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return g.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}g.from=function(t,e,r){return Un(t,e,r)};Object.setPrototypeOf(g.prototype,Uint8Array.prototype);Object.setPrototypeOf(g,Uint8Array);function kn(t){if(typeof t!="number")throw new TypeError(\'"size" argument must be of type number\');if(t<0)throw new RangeError(\'The value "\'+t+\'" is invalid for option "size"\')}function ai(t,e,r){return kn(t),t<=0?de(t):e!==void 0?typeof r=="string"?de(t).fill(e,r):de(t).fill(e):de(t)}g.alloc=function(t,e,r){return ai(t,e,r)};function ur(t){return kn(t),de(t<0?0:fr(t)|0)}g.allocUnsafe=function(t){return ur(t)};g.allocUnsafeSlow=function(t){return ur(t)};function ci(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!g.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Nn(t,e)|0,n=de(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function ar(t){let e=t.length<0?0:fr(t.length)|0,r=de(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function li(t){if(oe(t,Uint8Array)){let e=new Uint8Array(t);return cr(e.buffer,e.byteOffset,e.byteLength)}return ar(t)}function cr(t,e,r){if(e<0||t.byteLength<e)throw new RangeError(\'"offset" is outside of buffer bounds\');if(t.byteLength<e+(r||0))throw new RangeError(\'"length" is outside of buffer bounds\');let n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,g.prototype),n}function ui(t){if(g.isBuffer(t)){let e=fr(t.length)|0,r=de(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||pr(t.length)?de(0):ar(t);if(t.type==="Buffer"&&Array.isArray(t.data))return ar(t.data)}function fr(t){if(t>=vt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+vt.toString(16)+" bytes");return t|0}function fi(t){return+t!=t&&(t=0),g.alloc(+t)}g.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==g.prototype};g.compare=function(e,r){if(oe(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),oe(r,Uint8Array)&&(r=g.from(r,r.offset,r.byteLength)),!g.isBuffer(e)||!g.isBuffer(r))throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');if(e===r)return 0;let n=e.length,o=r.length;for(let s=0,i=Math.min(n,o);s<i;++s)if(e[s]!==r[s]){n=e[s],o=r[s];break}return n<o?-1:o<n?1:0};g.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}};g.concat=function(e,r){if(!Array.isArray(e))throw new TypeError(\'"list" argument must be an Array of Buffers\');if(e.length===0)return g.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let o=g.allocUnsafe(r),s=0;for(n=0;n<e.length;++n){let i=e[n];if(oe(i,Uint8Array))s+i.length>o.length?(g.isBuffer(i)||(i=g.from(i)),i.copy(o,s)):Uint8Array.prototype.set.call(o,i,s);else if(g.isBuffer(i))i.copy(o,s);else throw new TypeError(\'"list" argument must be an Array of Buffers\');s+=i.length}return o};function Nn(t,e){if(g.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||oe(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \'+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return lr(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Wn(t).length;default:if(o)return n?-1:lr(t).length;e=(""+e).toLowerCase(),o=!0}}g.byteLength=Nn;function di(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Ti(this,e,r);case"utf8":case"utf-8":return Bn(this,e,r);case"ascii":return Ei(this,e,r);case"latin1":case"binary":return bi(this,e,r);case"base64":return wi(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ri(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}g.prototype._isBuffer=!0;function Ie(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}g.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 r=0;r<e;r+=2)Ie(this,r,r+1);return this};g.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 r=0;r<e;r+=4)Ie(this,r,r+3),Ie(this,r+1,r+2);return this};g.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 r=0;r<e;r+=8)Ie(this,r,r+7),Ie(this,r+1,r+6),Ie(this,r+2,r+5),Ie(this,r+3,r+4);return this};g.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Bn(this,0,e):di.apply(this,arguments)};g.prototype.toLocaleString=g.prototype.toString;g.prototype.equals=function(e){if(!g.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:g.compare(this,e)===0};g.prototype.inspect=function(){let e="",r=Me.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};vn&&(g.prototype[vn]=g.prototype.inspect);g.prototype.compare=function(e,r,n,o,s){if(oe(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),!g.isBuffer(e))throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \'+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),s===void 0&&(s=this.length),r<0||n>e.length||o<0||s>this.length)throw new RangeError("out of range index");if(o>=s&&r>=n)return 0;if(o>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,s>>>=0,this===e)return 0;let i=s-o,a=n-r,l=Math.min(i,a),c=this.slice(o,s),f=e.slice(r,n);for(let u=0;u<l;++u)if(c[u]!==f[u]){i=c[u],a=f[u];break}return i<a?-1:a<i?1:0};function Dn(t,e,r,n,o){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,pr(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0)if(o)r=0;else return-1;if(typeof e=="string"&&(e=g.from(e,n)),g.isBuffer(e))return e.length===0?-1:On(t,e,r,n,o);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):On(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function On(t,e,r,n,o){let s=1,i=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,i/=2,a/=2,r/=2}function l(f,u){return s===1?f[u]:f.readUInt16BE(u*s)}let c;if(o){let f=-1;for(c=r;c<i;c++)if(l(t,c)===l(e,f===-1?0:c-f)){if(f===-1&&(f=c),c-f+1===a)return f*s}else f!==-1&&(c-=c-f),f=-1}else for(r+a>i&&(r=i-a),c=r;c>=0;c--){let f=!0;for(let u=0;u<a;u++)if(l(t,c+u)!==l(e,u)){f=!1;break}if(f)return c}return-1}g.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};g.prototype.indexOf=function(e,r,n){return Dn(this,e,r,n,!0)};g.prototype.lastIndexOf=function(e,r,n){return Dn(this,e,r,n,!1)};function pi(t,e,r,n){r=Number(r)||0;let o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;let s=e.length;n>s/2&&(n=s/2);let i;for(i=0;i<n;++i){let a=parseInt(e.substr(i*2,2),16);if(pr(a))return i;t[r+i]=a}return i}function hi(t,e,r,n){return Ot(lr(e,t.length-r),t,r,n)}function gi(t,e,r,n){return Ot(Ai(e),t,r,n)}function mi(t,e,r,n){return Ot(Wn(e),t,r,n)}function yi(t,e,r,n){return Ot(vi(e,t.length-r),t,r,n)}g.prototype.write=function(e,r,n,o){if(r===void 0)o="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")o=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let i=!1;for(;;)switch(o){case"hex":return pi(this,e,r,n);case"utf8":case"utf-8":return hi(this,e,r,n);case"ascii":case"latin1":case"binary":return gi(this,e,r,n);case"base64":return mi(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yi(this,e,r,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}};g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function wi(t,e,r){return e===0&&r===t.length?ir.fromByteArray(t):ir.fromByteArray(t.slice(e,r))}function Bn(t,e,r){r=Math.min(t.length,r);let n=[],o=e;for(;o<r;){let s=t[o],i=null,a=s>239?4:s>223?3:s>191?2:1;if(o+a<=r){let l,c,f,u;switch(a){case 1:s<128&&(i=s);break;case 2:l=t[o+1],(l&192)===128&&(u=(s&31)<<6|l&63,u>127&&(i=u));break;case 3:l=t[o+1],c=t[o+2],(l&192)===128&&(c&192)===128&&(u=(s&15)<<12|(l&63)<<6|c&63,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:l=t[o+1],c=t[o+2],f=t[o+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(u=(s&15)<<18|(l&63)<<12|(c&63)<<6|f&63,u>65535&&u<1114112&&(i=u))}}i===null?(i=65533,a=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),o+=a}return Si(n)}var Cn=4096;function Si(t){let e=t.length;if(e<=Cn)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Cn));return r}function Ei(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]&127);return n}function bi(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function Ti(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let s=e;s<r;++s)o+=Oi[t[s]];return o}function Ri(t,e,r){let n=t.slice(e,r),o="";for(let s=0;s<n.length-1;s+=2)o+=String.fromCharCode(n[s]+n[s+1]*256);return o}g.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let o=this.subarray(e,r);return Object.setPrototypeOf(o,g.prototype),o};function L(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}g.prototype.readUintLE=g.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||L(e,r,this.length);let o=this[e],s=1,i=0;for(;++i<r&&(s*=256);)o+=this[e+i]*s;return o};g.prototype.readUintBE=g.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||L(e,r,this.length);let o=this[e+--r],s=1;for(;r>0&&(s*=256);)o+=this[e+--r]*s;return o};g.prototype.readUint8=g.prototype.readUInt8=function(e,r){return e=e>>>0,r||L(e,1,this.length),this[e]};g.prototype.readUint16LE=g.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||L(e,2,this.length),this[e]|this[e+1]<<8};g.prototype.readUint16BE=g.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||L(e,2,this.length),this[e]<<8|this[e+1]};g.prototype.readUint32LE=g.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};g.prototype.readUint32BE=g.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||L(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};g.prototype.readBigUInt64LE=ye(function(e){e=e>>>0,Be(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&nt(e,this.length-8);let o=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(o)+(BigInt(s)<<BigInt(32))});g.prototype.readBigUInt64BE=ye(function(e){e=e>>>0,Be(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&nt(e,this.length-8);let o=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(o)<<BigInt(32))+BigInt(s)});g.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||L(e,r,this.length);let o=this[e],s=1,i=0;for(;++i<r&&(s*=256);)o+=this[e+i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};g.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||L(e,r,this.length);let o=r,s=1,i=this[e+--o];for(;o>0&&(s*=256);)i+=this[e+--o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*r)),i};g.prototype.readInt8=function(e,r){return e=e>>>0,r||L(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};g.prototype.readInt16LE=function(e,r){e=e>>>0,r||L(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};g.prototype.readInt16BE=function(e,r){e=e>>>0,r||L(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};g.prototype.readInt32LE=function(e,r){return e=e>>>0,r||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};g.prototype.readInt32BE=function(e,r){return e=e>>>0,r||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};g.prototype.readBigInt64LE=ye(function(e){e=e>>>0,Be(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&nt(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(o)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});g.prototype.readBigInt64BE=ye(function(e){e=e>>>0,Be(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&nt(e,this.length-8);let o=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});g.prototype.readFloatLE=function(e,r){return e=e>>>0,r||L(e,4,this.length),De.read(this,e,!0,23,4)};g.prototype.readFloatBE=function(e,r){return e=e>>>0,r||L(e,4,this.length),De.read(this,e,!1,23,4)};g.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||L(e,8,this.length),De.read(this,e,!0,52,8)};g.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||L(e,8,this.length),De.read(this,e,!1,52,8)};function z(t,e,r,n,o,s){if(!g.isBuffer(t))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(e>o||e<s)throw new RangeError(\'"value" argument is out of bounds\');if(r+n>t.length)throw new RangeError("Index out of range")}g.prototype.writeUintLE=g.prototype.writeUIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){let a=Math.pow(2,8*n)-1;z(this,e,r,n,a,0)}let s=1,i=0;for(this[r]=e&255;++i<n&&(s*=256);)this[r+i]=e/s&255;return r+n};g.prototype.writeUintBE=g.prototype.writeUIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){let a=Math.pow(2,8*n)-1;z(this,e,r,n,a,0)}let s=n-1,i=1;for(this[r+s]=e&255;--s>=0&&(i*=256);)this[r+s]=e/i&255;return r+n};g.prototype.writeUint8=g.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||z(this,e,r,1,255,0),this[r]=e&255,r+1};g.prototype.writeUint16LE=g.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||z(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};g.prototype.writeUint16BE=g.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||z(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};g.prototype.writeUint32LE=g.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||z(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};g.prototype.writeUint32BE=g.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||z(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Mn(t,e,r,n,o){Kn(e,n,o,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let i=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=i,i=i>>8,t[r++]=i,i=i>>8,t[r++]=i,i=i>>8,t[r++]=i,r}function Hn(t,e,r,n,o){Kn(e,n,o,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let i=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=i,i=i>>8,t[r+2]=i,i=i>>8,t[r+1]=i,i=i>>8,t[r]=i,r+8}g.prototype.writeBigUInt64LE=ye(function(e,r=0){return Mn(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});g.prototype.writeBigUInt64BE=ye(function(e,r=0){return Hn(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});g.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let l=Math.pow(2,8*n-1);z(this,e,r,n,l-1,-l)}let s=0,i=1,a=0;for(this[r]=e&255;++s<n&&(i*=256);)e<0&&a===0&&this[r+s-1]!==0&&(a=1),this[r+s]=(e/i>>0)-a&255;return r+n};g.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let l=Math.pow(2,8*n-1);z(this,e,r,n,l-1,-l)}let s=n-1,i=1,a=0;for(this[r+s]=e&255;--s>=0&&(i*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/i>>0)-a&255;return r+n};g.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||z(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};g.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||z(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};g.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||z(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};g.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||z(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};g.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||z(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};g.prototype.writeBigInt64LE=ye(function(e,r=0){return Mn(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});g.prototype.writeBigInt64BE=ye(function(e,r=0){return Hn(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Fn(t,e,r,n,o,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Ln(t,e,r,n,o){return e=+e,r=r>>>0,o||Fn(t,e,r,4,34028234663852886e22,-34028234663852886e22),De.write(t,e,r,n,23,4),r+4}g.prototype.writeFloatLE=function(e,r,n){return Ln(this,e,r,!0,n)};g.prototype.writeFloatBE=function(e,r,n){return Ln(this,e,r,!1,n)};function $n(t,e,r,n,o){return e=+e,r=r>>>0,o||Fn(t,e,r,8,17976931348623157e292,-17976931348623157e292),De.write(t,e,r,n,52,8),r+8}g.prototype.writeDoubleLE=function(e,r,n){return $n(this,e,r,!0,n)};g.prototype.writeDoubleBE=function(e,r,n){return $n(this,e,r,!1,n)};g.prototype.copy=function(e,r,n,o){if(!g.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-r<o-n&&(o=e.length-r+n);let s=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),r),s};g.prototype.fill=function(e,r,n,o){if(typeof e=="string"){if(typeof r=="string"?(o=r,r=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!g.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let i=e.charCodeAt(0);(o==="utf8"&&i<128||o==="latin1")&&(e=i)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s<n;++s)this[s]=e;else{let i=g.isBuffer(e)?e:g.from(e,o),a=i.length;if(a===0)throw new TypeError(\'The value "\'+e+\'" is invalid for argument "value"\');for(s=0;s<n-r;++s)this[s+r]=i[s%a]}return this};var Ne={};function dr(t,e,r){Ne[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}dr("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);dr("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);dr("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=Pn(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=Pn(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function Pn(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function _i(t,e,r){Be(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&nt(e,t.length-(r+1))}function Kn(t,e,r,n,o,s){if(t>r||t<e){let i=typeof e=="bigint"?"n":"",a;throw s>3?e===0||e===BigInt(0)?a=`>= 0${i} and < 2${i} ** ${(s+1)*8}${i}`:a=`>= -(2${i} ** ${(s+1)*8-1}${i}) and < 2 ** ${(s+1)*8-1}${i}`:a=`>= ${e}${i} and <= ${r}${i}`,new Ne.ERR_OUT_OF_RANGE("value",a,t)}_i(n,o,s)}function Be(t,e){if(typeof t!="number")throw new Ne.ERR_INVALID_ARG_TYPE(e,"number",t)}function nt(t,e,r){throw Math.floor(t)!==t?(Be(t,r),new Ne.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ne.ERR_BUFFER_OUT_OF_BOUNDS:new Ne.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Ii=/[^+/0-9A-Za-z-_]/g;function xi(t){if(t=t.split("=")[0],t=t.trim().replace(Ii,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function lr(t,e){e=e||1/0;let r,n=t.length,o=null,s=[];for(let i=0;i<n;++i){if(r=t.charCodeAt(i),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(i+1===n){(e-=3)>-1&&s.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&s.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function Ai(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function vi(t,e){let r,n,o,s=[];for(let i=0;i<t.length&&!((e-=2)<0);++i)r=t.charCodeAt(i),n=r>>8,o=r%256,s.push(o),s.push(n);return s}function Wn(t){return ir.toByteArray(xi(t))}function Ot(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function oe(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function pr(t){return t!==t}var Oi=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e})();function ye(t){return typeof BigInt>"u"?Ci:t}function Ci(){throw new Error("BigInt not supported")}});var ns=fe(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});function bc(t){var e=4,r=t.length,n=r%e;if(!n)return t;var o=r,s=e-n,i=r+s,a=Buffer.alloc(i);for(a.write(t);s--;)a.write("=",o++);return a.toString()}en.default=bc});var ss=fe(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});var Tc=ns();function os(t,e){return e===void 0&&(e="utf8"),Buffer.isBuffer(t)?tn(t.toString("base64")):tn(Buffer.from(t,e).toString("base64"))}function Rc(t,e){return e===void 0&&(e="utf8"),Buffer.from(rn(t),"base64").toString(e)}function rn(t){return t=t.toString(),Tc.default(t).replace(/\\-/g,"+").replace(/_/g,"/")}function tn(t){return t.replace(/=/g,"").replace(/\\+/g,"-").replace(/\\//g,"_")}function _c(t){return Buffer.from(rn(t),"base64")}var Ve=os;Ve.encode=os;Ve.decode=Rc;Ve.toBase64=rn;Ve.fromBase64=tn;Ve.toBuffer=_c;nn.default=Ve});var is=fe((Vp,Vt)=>{Vt.exports=ss().default;Vt.exports.default=Vt.exports});var cs=fe((as,Gt)=>{(function(t,e){var r={};e(r);var n=r.default;for(var o in r)n[o]=r[o];typeof Gt=="object"&&typeof Gt.exports=="object"?Gt.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):t.sha256=n})(as,function(t){"use strict";t.__esModule=!0,t.digestLength=32,t.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 r(u,h,m,p,w){for(var y,E,T,x,A,I,H,v,k,P,ae,ce,re;w>=64;){for(y=h[0],E=h[1],T=h[2],x=h[3],A=h[4],I=h[5],H=h[6],v=h[7],P=0;P<16;P++)ae=p+P*4,u[P]=(m[ae]&255)<<24|(m[ae+1]&255)<<16|(m[ae+2]&255)<<8|m[ae+3]&255;for(P=16;P<64;P++)k=u[P-2],ce=(k>>>17|k<<15)^(k>>>19|k<<13)^k>>>10,k=u[P-15],re=(k>>>7|k<<25)^(k>>>18|k<<14)^k>>>3,u[P]=(ce+u[P-7]|0)+(re+u[P-16]|0);for(P=0;P<64;P++)ce=(((A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7))+(A&I^~A&H)|0)+(v+(e[P]+u[P]|0)|0)|0,re=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&E^y&T^E&T)|0,v=H,H=I,I=A,A=x+ce|0,x=T,T=E,E=y,y=ce+re|0;h[0]+=y,h[1]+=E,h[2]+=T,h[3]+=x,h[4]+=A,h[5]+=I,h[6]+=H,h[7]+=v,p+=64,w-=64}return p}var n=(function(){function u(){this.digestLength=t.digestLength,this.blockSize=t.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 u.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},u.prototype.clean=function(){for(var h=0;h<this.buffer.length;h++)this.buffer[h]=0;for(var h=0;h<this.temp.length;h++)this.temp[h]=0;this.reset()},u.prototype.update=function(h,m){if(m===void 0&&(m=h.length),this.finished)throw new Error("SHA256: can\'t update because hash was finished.");var p=0;if(this.bytesHashed+=m,this.bufferLength>0){for(;this.bufferLength<64&&m>0;)this.buffer[this.bufferLength++]=h[p++],m--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(m>=64&&(p=r(this.temp,this.state,h,p,m),m%=64);m>0;)this.buffer[this.bufferLength++]=h[p++],m--;return this},u.prototype.finish=function(h){if(!this.finished){var m=this.bytesHashed,p=this.bufferLength,w=m/536870912|0,y=m<<3,E=m%64<56?64:128;this.buffer[p]=128;for(var T=p+1;T<E-8;T++)this.buffer[T]=0;this.buffer[E-8]=w>>>24&255,this.buffer[E-7]=w>>>16&255,this.buffer[E-6]=w>>>8&255,this.buffer[E-5]=w>>>0&255,this.buffer[E-4]=y>>>24&255,this.buffer[E-3]=y>>>16&255,this.buffer[E-2]=y>>>8&255,this.buffer[E-1]=y>>>0&255,r(this.temp,this.state,this.buffer,0,E),this.finished=!0}for(var T=0;T<8;T++)h[T*4+0]=this.state[T]>>>24&255,h[T*4+1]=this.state[T]>>>16&255,h[T*4+2]=this.state[T]>>>8&255,h[T*4+3]=this.state[T]>>>0&255;return this},u.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},u.prototype._saveState=function(h){for(var m=0;m<this.state.length;m++)h[m]=this.state[m]},u.prototype._restoreState=function(h,m){for(var p=0;p<this.state.length;p++)this.state[p]=h[p];this.bytesHashed=m,this.finished=!1,this.bufferLength=0},u})();t.Hash=n;var o=(function(){function u(h){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var m=new Uint8Array(this.blockSize);if(h.length>this.blockSize)new n().update(h).finish(m).clean();else for(var p=0;p<h.length;p++)m[p]=h[p];for(var p=0;p<m.length;p++)m[p]^=54;this.inner.update(m);for(var p=0;p<m.length;p++)m[p]^=106;this.outer.update(m),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var p=0;p<m.length;p++)m[p]=0}return u.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},u.prototype.clean=function(){for(var h=0;h<this.istate.length;h++)this.ostate[h]=this.istate[h]=0;this.inner.clean(),this.outer.clean()},u.prototype.update=function(h){return this.inner.update(h),this},u.prototype.finish=function(h){return this.outer.finished?this.outer.finish(h):(this.inner.finish(h),this.outer.update(h,this.digestLength).finish(h)),this},u.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},u})();t.HMAC=o;function s(u){var h=new n().update(u),m=h.digest();return h.clean(),m}t.hash=s,t.default=s;function i(u,h){var m=new o(u).update(h),p=m.digest();return m.clean(),p}t.hmac=i;function a(u,h,m,p){var w=p[0];if(w===0)throw new Error("hkdf: cannot expand more");h.reset(),w>1&&h.update(u),m&&h.update(m),h.update(p),h.finish(u),p[0]++}var l=new Uint8Array(t.digestLength);function c(u,h,m,p){h===void 0&&(h=l),p===void 0&&(p=32);for(var w=new Uint8Array([1]),y=i(h,u),E=new o(y),T=new Uint8Array(E.digestLength),x=T.length,A=new Uint8Array(p),I=0;I<p;I++)x===T.length&&(a(T,E,m,w),x=0),A[I]=T[x++];return E.clean(),T.fill(0),w.fill(0),A}t.hkdf=c;function f(u,h,m,p){for(var w=new o(u),y=w.digestLength,E=new Uint8Array(4),T=new Uint8Array(y),x=new Uint8Array(y),A=new Uint8Array(p),I=0;I*y<p;I++){var H=I+1;E[0]=H>>>24&255,E[1]=H>>>16&255,E[2]=H>>>8&255,E[3]=H>>>0&255,w.reset(),w.update(h),w.update(E),w.finish(x);for(var v=0;v<y;v++)T[v]=x[v];for(var v=2;v<=m;v++){w.reset(),w.update(x).finish(x);for(var k=0;k<y;k++)T[k]^=x[k]}for(var v=0;v<y&&I*y+v<p;v++)A[I*y+v]=T[v]}for(var I=0;I<y;I++)T[I]=x[I]=0;for(var I=0;I<4;I++)E[I]=0;return w.clean(),A}t.pbkdf2=f})});var Hs=fe((gn,Ms)=>{var Yt=Ct(),ie=Yt.Buffer;function Bs(t,e){for(var r in t)e[r]=t[r]}ie.from&&ie.alloc&&ie.allocUnsafe&&ie.allocUnsafeSlow?Ms.exports=Yt:(Bs(Yt,gn),gn.Buffer=Ce);function Ce(t,e,r){return ie(t,e,r)}Ce.prototype=Object.create(ie.prototype);Bs(ie,Ce);Ce.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return ie(t,e,r)};Ce.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=ie(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Ce.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ie(t)};Ce.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Yt.SlowBuffer(t)}});var Fs=fe((Eg,yn)=>{"use strict";var mn=65536,Lc=4294967295;function $c(){throw new Error(`Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11`)}var Kc=Hs().Buffer,Zt=self.crypto||self.msCrypto;Zt&&Zt.getRandomValues?yn.exports=Wc:yn.exports=$c;function Wc(t,e){if(t>Lc)throw new RangeError("requested too many random bytes");var r=Kc.allocUnsafe(t);if(t>0)if(t>mn)for(var n=0;n<t;n+=mn)Zt.getRandomValues(r.slice(n,n+mn));else Zt.getRandomValues(r);return typeof e=="function"?process.nextTick(function(){e(null,r)}):r}});var js=rt(Ct(),1);var Pi=Object.defineProperty,Ui=(t,e,r)=>e in t?Pi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D=(t,e,r)=>Ui(t,typeof e!="symbol"?e+"":e,r),hr="asgardeo-session-active",ki=class{constructor(t,e){D(this,"_id"),D(this,"_store"),this._id=t,this._store=e}async setDataInBulk(t,e){let r=await this._store.getData(t)??null,o={...r&&JSON.parse(r),...e},s=JSON.stringify(o);await this._store.setData(t,s)}async setValue(t,e,r){let n=await this._store.getData(t)??null,s={...n&&JSON.parse(n),[e]:r},i=JSON.stringify(s);await this._store.setData(t,i)}async removeValue(t,e){let r=await this._store.getData(t)??null,o={...r&&JSON.parse(r)};delete o[e];let s=JSON.stringify(o);await this._store.setData(t,s)}_resolveKey(t,e){return e?`${t}-${this._id}-${e}`:`${t}-${this._id}`}isLocalStorageAvailable(){try{let t="__ASGARDEO_AUTH_CORE_LOCAL_STORAGE_TEST__";return localStorage.setItem(t,t),localStorage.removeItem(t),!0}catch{return!1}}async setConfigData(t){await this.setDataInBulk(this._resolveKey("config_data"),t)}async setOIDCProviderMetaData(t){this.setDataInBulk(this._resolveKey("oidc_provider_meta_data"),t)}async setTemporaryData(t,e){this.setDataInBulk(this._resolveKey("temporary_data",e),t)}async setSessionData(t,e){this.setDataInBulk(this._resolveKey("session_data",e),t)}async setCustomData(t,e,r){this.setDataInBulk(this._resolveKey(t,r),e)}async getConfigData(t){return JSON.parse(await this._store.getData(this._resolveKey("config_data",t))??null)}async loadOpenIDProviderConfiguration(){return JSON.parse(await this._store.getData(this._resolveKey("oidc_provider_meta_data"))??null)}async getTemporaryData(t){return JSON.parse(await this._store.getData(this._resolveKey("temporary_data",t))??null)}async getSessionData(t){return JSON.parse(await this._store.getData(this._resolveKey("session_data",t))??null)}async getCustomData(t,e){return JSON.parse(await this._store.getData(this._resolveKey(t,e))??null)}setSessionStatus(t){this.isLocalStorageAvailable()&&localStorage.setItem(`${hr}`,t)}getSessionStatus(){return this.isLocalStorageAvailable()?localStorage.getItem(`${hr}`)??"":""}removeSessionStatus(){this.isLocalStorageAvailable()&&localStorage.removeItem(`${hr}`)}async removeConfigData(){await this._store.removeData(this._resolveKey("config_data"))}async removeOIDCProviderMetaData(){await this._store.removeData(this._resolveKey("oidc_provider_meta_data"))}async removeTemporaryData(t){await this._store.removeData(this._resolveKey("temporary_data",t))}async removeSessionData(t){await this._store.removeData(this._resolveKey("session_data",t))}async getConfigDataParameter(t){let e=await this._store.getData(this._resolveKey("config_data"));return e&&JSON.parse(e)[t]}async getOIDCProviderMetaDataParameter(t){let e=await this._store.getData(this._resolveKey("oidc_provider_meta_data"));return e&&JSON.parse(e)[t]}async getTemporaryDataParameter(t,e){let r=await this._store.getData(this._resolveKey("temporary_data",e));return r&&JSON.parse(r)[t]}async getSessionDataParameter(t,e){let r=await this._store.getData(this._resolveKey("session_data",e));return r&&JSON.parse(r)[t]}async setConfigDataParameter(t,e){await this.setValue(this._resolveKey("config_data"),t,e)}async setOIDCProviderMetaDataParameter(t,e){await this.setValue(this._resolveKey("oidc_provider_meta_data"),t,e)}async setTemporaryDataParameter(t,e,r){await this.setValue(this._resolveKey("temporary_data",r),t,e)}async setSessionDataParameter(t,e,r){await this.setValue(this._resolveKey("session_data",r),t,e)}async removeConfigDataParameter(t){await this.removeValue(this._resolveKey("config_data"),t)}async removeOIDCProviderMetaDataParameter(t){await this.removeValue(this._resolveKey("oidc_provider_meta_data"),t)}async removeTemporaryDataParameter(t,e){await this.removeValue(this._resolveKey("temporary_data",e),t)}async removeSessionDataParameter(t,e){await this.removeValue(this._resolveKey("session_data",e),t)}},qn=ki,Ni={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"}}},O=Ni,Di={INTERNAL_LOGIN:"internal_login",OPENID:"openid",PROFILE:"profile"},gr=Di,Bi={Params:{AUTHORIZATION_CODE:"code",SESSION_STATE:"session_state",STATE:"state",SIGN_OUT_SUCCESS:"sign_out_success"},SignIn:{Payload:{DEFAULT_SCOPES:[gr.OPENID,gr.PROFILE,gr.INTERNAL_LOGIN]}},SignOut:{Storage:{StorageKeys:{SIGN_OUT_URL:"sign_out_url"}}}},$=Bi,_=class{constructor(t,e,r){D(this,"name"),D(this,"code"),D(this,"message"),this.message=r,this.name=e,this.code=t,Object.setPrototypeOf(this,new.target.prototype)}},Mi={SignatureValidation:{SUPPORTED_ALGORITHMS:["RS256","RS512","RS384","PS256"]},Storage:{StorageKeys:{REFRESH_TOKEN_TIMER:"refresh_token_timer"}}},st=Mi,Hi=class{constructor(t){D(this,"_cryptoUtils"),this._cryptoUtils=t}getCodeVerifier(){return this._cryptoUtils.base64URLEncode(this._cryptoUtils.generateRandomBytes(32))}getCodeChallenge(t){return this._cryptoUtils.base64URLEncode(this._cryptoUtils.hashSha256(t))}getJWKForTheIdToken(t,e){let r=JSON.parse(this._cryptoUtils.base64URLDecode(t));for(let n of e)if(r.kid===n.kid)return n;throw new _("JS-CRYPTO_UTIL-GJFTIT-IV01","kid not found.","Failed to find the \'kid\' specified in the id_token. \'kid\' found in the header : "+r.kid+", Expected values: "+e.map(n=>n.kid).join(", "))}isValidIdToken(t,e,r,n,o,s,i){return this._cryptoUtils.verifyJwt(t,e,st.SignatureValidation.SUPPORTED_ALGORITHMS,r,n,o,s,i).then(a=>a?Promise.resolve(!0):Promise.reject(new _("JS-CRYPTO_HELPER-IVIT-IV01","Invalid ID token.","ID token validation returned false"))).catch(a=>Promise.reject(a))}decodeJwtToken(t){try{let e=this._cryptoUtils.base64URLDecode(t?.split(".")[1]);return JSON.parse(e)}catch(e){throw new _("JS-CRYPTO_UTIL-DIT-IV02","Decoding token failed.",e)}}},Fi={DEFAULT_CODE_CHALLENGE_METHOD:"S256",Storage:{StorageKeys:{CODE_VERIFIER:"pkce_code_verifier",SEPARATOR:"#"}}},we=Fi,Li=t=>{let e=parseInt(t.split("request_")[1]);return`${we.Storage.StorageKeys.CODE_VERIFIER}${we.Storage.StorageKeys.SEPARATOR}${e}`},xe=Li,$i={Placeholders:{ACCESS_TOKEN:"{{accessToken}}",USERNAME:"{{username}}",SCOPES:"{{scopes}}",CLIENT_ID:"{{clientId}}",CLIENT_SECRET:"{{clientSecret}}"}},ot=$i;var Ki=t=>{let e={...t};return["iss","aud","exp","iat","acr","amr","azp","auth_time","nonce","c_hash","at_hash","nbf","isk","sid","jti","sub"].forEach(n=>{delete e[n]}),e},Wi=Ki,qi=class zn extends Error{constructor(e,r,n){let o=zn.resolveOrigin(n);super(e),D(this,"code"),D(this,"origin"),this.name=new.target.name,this.code=r,this.origin=o,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}")`}},Jn=class extends qi{constructor(t,e,r,n){super(t,e,r),this.details=n,Object.defineProperty(this,"name",{value:"AsgardeoRuntimeError",configurable:!0,writable:!0})}toString(){let t=this.details?`\nDetails: ${JSON.stringify(this.details,null,2)}`:"";return`[${this.name}] (code="${this.code}")${t}\nMessage: ${this.message}`}},ji=t=>{let e=[];if(t)if(Array.isArray(t))e=t;else if(typeof t=="string")e=t.split(" ");else throw new Jn("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 $.SignIn.Payload.DEFAULT_SCOPES.forEach(r=>{e.includes(r)||e.push(r)}),e.join(" ")},mr=ji,zi=class{constructor(t,e){D(this,"_storageManager"),D(this,"_config"),D(this,"_oidcProviderMetaData"),D(this,"_cryptoHelper"),this._storageManager=t,this._config=async()=>this._storageManager.getConfigData(),this._oidcProviderMetaData=async()=>this._storageManager.loadOpenIDProviderConfiguration(),this._cryptoHelper=e}async resolveEndpoints(t){let e={},r=await this._config();return r.endpoints&&Object.keys(r.endpoints).forEach(n=>{let o=n.replace(/[A-Z]/g,s=>`_${s.toLowerCase()}`);e[o]=r?.endpoints?r.endpoints[n]:""}),{...t,...e}}async resolveEndpointsExplicitly(){let t={},e=await this._config(),r=[O.Storage.StorageKeys.Endpoints.AUTHORIZATION,O.Storage.StorageKeys.Endpoints.END_SESSION,O.Storage.StorageKeys.Endpoints.JWKS,O.Storage.StorageKeys.Endpoints.SESSION_IFRAME,O.Storage.StorageKeys.Endpoints.REVOCATION,O.Storage.StorageKeys.Endpoints.TOKEN,O.Storage.StorageKeys.Endpoints.ISSUER,O.Storage.StorageKeys.Endpoints.USERINFO];if(!(e.endpoints?r.every(o=>e.endpoints?Object.keys(e.endpoints).some(s=>s.replace(/[A-Z]/g,a=>`_${a.toLowerCase()}`)===o):!1):!1))throw new _("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(o=>{let s=o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`);t[s]=e?.endpoints?e.endpoints[o]:""}),{...t}}async resolveEndpointsByBaseURL(){let t={},e=await this._config(),{baseUrl:r}=e;if(!r)throw new _("JS-AUTH_HELPER_REBO-NF01","Base URL not defined.","Base URL is not defined in AuthClient config.");e.endpoints&&Object.keys(e.endpoints).forEach(o=>{let s=o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`);t[s]=e?.endpoints?e.endpoints[o]:""});let n={[O.Storage.StorageKeys.Endpoints.AUTHORIZATION]:`${r}${O.Endpoints.AUTHORIZATION}`,[O.Storage.StorageKeys.Endpoints.END_SESSION]:`${r}${O.Endpoints.END_SESSION}`,[O.Storage.StorageKeys.Endpoints.ISSUER]:`${r}${O.Endpoints.ISSUER}`,[O.Storage.StorageKeys.Endpoints.JWKS]:`${r}${O.Endpoints.JWKS}`,[O.Storage.StorageKeys.Endpoints.SESSION_IFRAME]:`${r}${O.Endpoints.SESSION_IFRAME}`,[O.Storage.StorageKeys.Endpoints.REVOCATION]:`${r}${O.Endpoints.REVOCATION}`,[O.Storage.StorageKeys.Endpoints.TOKEN]:`${r}${O.Endpoints.TOKEN}`,[O.Storage.StorageKeys.Endpoints.USERINFO]:`${r}${O.Endpoints.USERINFO}`};return e.platform==="AsgardeoV2"&&(n[O.Storage.StorageKeys.Endpoints.ISSUER]=`${r}`),{...n,...t}}async validateIdToken(t){let e=(await this._storageManager.loadOpenIDProviderConfiguration()).jwks_uri,r=await this._config();if(!e||e.trim().length===0)throw new _("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:r.sendCookiesInRequests?"include":"same-origin"})}catch(a){throw new _("JS-AUTH_HELPER-VIT-NE02","Request to jwks endpoint failed.",a??"The request sent to get the jwks from the server failed.")}if(n.status!==200||!n.ok)throw new _("JS-AUTH_HELPER-VIT-HE03",`Invalid response status received for jwks request (${n.statusText}).`,await n.json());let{issuer:o}=await this._oidcProviderMetaData(),{keys:s}=await n.json(),i=await this._cryptoHelper.getJWKForTheIdToken(t.split(".")[0],s);return this._cryptoHelper.isValidIdToken(t,i,(await this._config()).clientId,o??"",this._cryptoHelper.decodeJwtToken(t).sub,(await this._config()).tokenValidation?.idToken?.clockTolerance,(await this._config()).tokenValidation?.idToken?.validateIssuer??!0)}getAuthenticatedUserInfo(t){let e=this._cryptoHelper.decodeJwtToken(t),r=e?.username??"",n=e?.given_name??"",o=e?.family_name??"",s=n&&o?`${n} ${o}`:n||o||"";return{displayName:e.preferred_username??s,username:r,...Wi(e)}}async replaceCustomGrantTemplateTags(t,e){let r=await this._config(),n=await this._storageManager.getSessionData(e),o=mr(r.scopes);return typeof t!="string"?t:t.replace(ot.Placeholders.ACCESS_TOKEN,n.access_token).replace(ot.Placeholders.USERNAME,this.getAuthenticatedUserInfo(n.id_token).username).replace(ot.Placeholders.SCOPES,o).replace(ot.Placeholders.CLIENT_ID,r.clientId).replace(ot.Placeholders.CLIENT_SECRET,r.clientSecret??"")}async clearSession(t){await this._storageManager.removeTemporaryData(t),await this._storageManager.removeSessionData(t)}async handleTokenResponse(t,e){if(t.status!==200||!t.ok)throw new _("JS-AUTH_HELPER-HTR-NE01",`Invalid response status received for token request (${t.statusText}).`,await t.json());let r=await t.json();if(r.created_at=new Date().getTime(),(await this._config()).tokenValidation?.idToken?.validate)return this.validateIdToken(r.id_token).then(async()=>{await this._storageManager.setSessionData(r,e);let s={accessToken:r.access_token,createdAt:r.created_at,expiresIn:r.expires_in,idToken:r.id_token,refreshToken:r.refresh_token,scope:r.scope,tokenType:r.token_type};return Promise.resolve(s)});let o={accessToken:r.access_token,createdAt:r.created_at,expiresIn:r.expires_in,idToken:r.id_token,refreshToken:r.refresh_token,scope:r.scope,tokenType:r.token_type};return await this._storageManager.setSessionData(r,e),Promise.resolve(o)}},Ji=t=>{let e=[];Object.keys(t).forEach(o=>{o.startsWith(we.Storage.StorageKeys.CODE_VERIFIER)&&e.push(o)});let r=e.sort().pop(),n=parseInt(r?.split(we.Storage.StorageKeys.SEPARATOR)[1]??"-1");return`${we.Storage.StorageKeys.CODE_VERIFIER}${we.Storage.StorageKeys.SEPARATOR}${n+1}`},Vi=Ji,Gi=(t,e)=>{let r=parseInt(t.split(we.Storage.StorageKeys.SEPARATOR)[1]);return e?`${e}_request_${r}`:`request_${r}`},Xi=Gi,Yi=(t,e,r)=>{let{redirectUri:n,clientId:o,clientSecret:s,scopes:i,responseMode:a,codeChallenge:l,codeChallengeMethod:c,prompt:f}=t,u=new Map;u.set("response_type","code"),u.set("client_id",o),u.set("scope",i),u.set("redirect_uri",n),a&&u.set("response_mode",a);let h=e?.key;if(l)if(u.set("code_challenge",l),c)u.set("code_challenge_method",c);else throw new Jn("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&&u.set("prompt",f),r)for(let[m,p]of Object.entries(r))m!==""&&p!==""&&m!==$.Params.STATE&&u.set(m,p.toString());return u.set($.Params.STATE,Xi(h,r?r[$.Params.STATE]?.toString():"")),u},Zi=Yi,Qi={tokenValidation:{idToken:{validate:!0,validateIssuer:!0,clockTolerance:300}},enablePKCE:!0,responseMode:"query",sendCookiesInRequests:!0},yr=class pe{constructor(){D(this,"_storageManager"),D(this,"_config"),D(this,"_oidcProviderMetaData"),D(this,"_authenticationHelper"),D(this,"_cryptoUtils"),D(this,"_cryptoHelper")}async initialize(e,r,n,o){let s=e.clientId;pe._instanceID?pe._instanceID+=1:pe._instanceID=0,o&&(pe._instanceID=o),s?this._storageManager=new qn(`instance_${pe._instanceID}-${s}`,r):this._storageManager=new qn(`instance_${pe._instanceID}`,r),this._cryptoUtils=n,this._cryptoHelper=new Hi(n),this._authenticationHelper=new zi(this._storageManager,this._cryptoHelper),this._config=async()=>await this._storageManager.getConfigData(),this._oidcProviderMetaData=async()=>await this._storageManager.loadOpenIDProviderConfiguration(),pe._authenticationHelper=this._authenticationHelper,await this._storageManager.setConfigData({...Qi,...e,scope:mr(e.scopes)})}getStorageManager(){return this._storageManager}getInstanceId(){return pe._instanceID}async getSignInUrl(e,r){let n={...e};delete n?.forceInit;let o=async()=>{let s=await this._storageManager.getOIDCProviderMetaDataParameter(O.Storage.StorageKeys.Endpoints.AUTHORIZATION);if(!s||s.trim().length===0)throw new _("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(s),a=await this._config(),l=await this._storageManager.getTemporaryData(r),c=await Vi(l),f,u;a.enablePKCE&&(f=this._cryptoHelper?.getCodeVerifier(),u=this._cryptoHelper?.getCodeChallenge(f),await this._storageManager.setTemporaryDataParameter(c,f,r)),n.client_secret&&(n.client_secret=a.clientSecret);let h=Zi({redirectUri:a.afterSignInUrl,clientId:a.clientId,scopes:mr(a.scopes),responseMode:a.responseMode,codeChallengeMethod:we.DEFAULT_CODE_CHALLENGE_METHOD,codeChallenge:u,prompt:a.prompt},{key:c},n);for(let[m,p]of h.entries())i.searchParams.append(m,p);return i.toString()};return await this._storageManager.getTemporaryDataParameter(O.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED)?o():this.loadOpenIDProviderConfiguration(e?.forceInit).then(()=>o())}async requestAccessToken(e,r,n,o,s){let i=async()=>{let a=(await this._oidcProviderMetaData()).token_endpoint,l=await this._config();if(!a||a.trim().length===0)throw new _("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.");r&&await this._storageManager.setSessionDataParameter($.Params.SESSION_STATE,r,o);let c=new URLSearchParams;c.set("client_id",l.clientId),l.clientSecret&&l.clientSecret.trim().length>0&&c.set("client_secret",l.clientSecret);let f=e;c.set("code",f),c.set("grant_type","authorization_code"),c.set("redirect_uri",l.afterSignInUrl),s?.params&&Object.entries(s.params).forEach(([h,m])=>{c.append(h,m)}),l.enablePKCE&&(c.set("code_verifier",`${await this._storageManager.getTemporaryDataParameter(xe(n),o)}`),await this._storageManager.removeTemporaryDataParameter(xe(n),o));let u;try{u=await fetch(a,{body:c,credentials:l.sendCookiesInRequests?"include":"same-origin",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},method:"POST"})}catch(h){throw new _("JS-AUTH_CORE-RAT1-NE02","Requesting access token failed",h??"The request to get the access token from the server failed.")}if(!u.ok)throw new _("JS-AUTH_CORE-RAT1-HE03",`Requesting access token failed with ${u.statusText}`,await u.json());return await this._authenticationHelper.handleTokenResponse(u,o)};return await this._storageManager.getTemporaryDataParameter(O.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED)?i():this.loadOpenIDProviderConfiguration(!1).then(()=>i())}async loadOpenIDProviderConfiguration(e){let r=await this._config();if(!e&&await this._storageManager.getTemporaryDataParameter(O.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED))return Promise.resolve();let n=r.wellKnownEndpoint;if(n){let o;try{if(o=await fetch(n),o.status!==200||!o.ok)throw new Error}catch{throw new _("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 o.json())),await this._storageManager.setTemporaryDataParameter(O.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,!0),Promise.resolve()}else if(r.baseUrl){try{await this._storageManager.setOIDCProviderMetaData(await this._authenticationHelper.resolveEndpointsByBaseURL())}catch(o){throw new _("JS-AUTH_CORE-GOPMD-IV02","Resolving endpoints failed.",o??"Resolving endpoints by base url failed.")}return await this._storageManager.setTemporaryDataParameter(O.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,!0),Promise.resolve()}else return await this._storageManager.setOIDCProviderMetaData(await this._authenticationHelper.resolveEndpointsExplicitly()),await this._storageManager.setTemporaryDataParameter(O.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,!0),Promise.resolve()}async getSignOutUrl(e){let r=(await this._oidcProviderMetaData())?.end_session_endpoint,n=await this._config();if(!r||r.trim().length===0)throw new _("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 o=n?.afterSignOutUrl??n?.afterSignInUrl;if(!o||o.trim().length===0)throw new _("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 s=new URLSearchParams;if(s.set("post_logout_redirect_uri",o),n.sendIdTokenInLogoutRequest){let i=(await this._storageManager.getSessionData(e))?.id_token;if(!i||i.trim().length===0)throw new _("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.");s.set("id_token_hint",i)}else s.set("client_id",n.clientId);return s.set("state",$.Params.SIGN_OUT_SUCCESS),`${r}?${s.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 decodeJwtToken(e){return this._cryptoHelper.decodeJwtToken(e)}async getDecodedIdToken(e,r){let n=(await this._storageManager.getSessionData(e)).id_token;return this._cryptoHelper.decodeJwtToken(n??r)}async getIdToken(e){return(await this._storageManager.getSessionData(e)).id_token}async getUser(e){let r=await this._storageManager.getSessionData(e),n=this._authenticationHelper.getAuthenticatedUserInfo(r?.id_token);return Object.keys(n).forEach(o=>{(n[o]===void 0||n[o]===""||n[o]===null)&&delete n[o]}),n}async getUserSession(e){let r=await this._storageManager.getSessionData(e);return{scopes:r?.scope?.split(" "),sessionState:r?.session_state??""}}async getCrypto(){return this._cryptoHelper}async revokeAccessToken(e){let r=(await this._oidcProviderMetaData()).revocation_endpoint,n=await this._config();if(!r||r.trim().length===0)throw new _("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 o=[];o.push(`client_id=${n.clientId}`),o.push(`token=${(await this._storageManager.getSessionData(e)).access_token}`),o.push("token_type_hint=access_token"),n.clientSecret&&n.clientSecret.trim().length>0&&o.push(`client_secret=${n.clientSecret}`);let s;try{s=await fetch(r,{body:o.join("&"),credentials:n.sendCookiesInRequests?"include":"same-origin",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},method:"POST"})}catch(i){throw new _("JS-AUTH_CORE-RAT3-NE02","The request to revoke access token failed.",i??"The request sent to revoke the access token failed.")}if(s.status!==200||!s.ok)throw new _("JS-AUTH_CORE-RAT3-HE03",`Invalid response status received for revoke access token request (${s.statusText}).`,await s.json());return this._authenticationHelper.clearSession(e),Promise.resolve(s)}async refreshAccessToken(e){let r=(await this._oidcProviderMetaData()).token_endpoint,n=await this._config(),o=await this._storageManager.getSessionData(e);if(!o.refresh_token)throw new _("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(!r||r.trim().length===0)throw new _("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 s=[];s.push(`client_id=${n.clientId}`),s.push(`refresh_token=${o.refresh_token}`),s.push("grant_type=refresh_token"),n.clientSecret&&n.clientSecret.trim().length>0&&s.push(`client_secret=${n.clientSecret}`);let i;try{i=await fetch(r,{body:s.join("&"),credentials:n.sendCookiesInRequests?"include":"same-origin",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},method:"POST"})}catch(a){throw new _("JS-AUTH_CORE-RAT2-NR03","Refresh access token request failed.",a??"The request to refresh the access token failed.")}if(!i.ok)throw new _("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,r){let n=await this._oidcProviderMetaData(),o=await this._config(),s;if(e.tokenEndpoint&&e.tokenEndpoint.trim().length!==0?s=e.tokenEndpoint:s=n.token_endpoint,!s||s.trim().length===0)throw new _("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,u])=>{let h=await this._authenticationHelper.replaceCustomGrantTemplateTags(u,r);return`${f}=${h}`})),a={Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"};e.attachToken&&(a={...a,Authorization:`Bearer ${(await this._storageManager.getSessionData(r)).access_token}`});let l={body:i.join("&"),credentials:o.sendCookiesInRequests?"include":"same-origin",headers:new Headers(a),method:"POST"},c;try{c=await fetch(s,l)}catch(f){throw new _("JS-AUTH_CORE-RCG-NE02","The custom grant request failed.",f??"The request sent to get the custom grant failed.")}if(c.status!==200||!c.ok)throw new _("JS-AUTH_CORE-RCG-HE03",`Invalid response status received for the custom grant request. (${c.statusText})`,await c.json());return e.returnsSession?this._authenticationHelper.handleTokenResponse(c,r):Promise.resolve(await c.json())}async isSignedIn(e){let r=!!await this.getAccessToken(e),n=(await this._storageManager.getSessionData(e))?.created_at,o=(await this._storageManager.getSessionData(e))?.expires_in;if(!o)return!1;let s=parseInt(o)*1e3,i=new Date().getTime(),a=n+s>i;return r&&a}async getPKCECode(e,r){return await this._storageManager.getTemporaryDataParameter(xe(e),r)}async setPKCECode(e,r,n){return await this._storageManager.setTemporaryDataParameter(xe(r),e,n)}static isSignOutSuccessful(e){let r=new URL(e),n=r.searchParams.get($.Params.STATE),o=!!r.searchParams.get("error");return n?n===$.Params.SIGN_OUT_SUCCESS&&!o:!1}static didSignOutFail(e){let r=new URL(e),n=r.searchParams.get($.Params.STATE),o=!!r.searchParams.get("error");return n?n===$.Params.SIGN_OUT_SUCCESS&&o:!1}async reInitialize(e){await this._storageManager.setConfigData(e),await this.loadOpenIDProviderConfiguration(!0)}static async clearSession(e){await this._authenticationHelper.clearSession(e)}};D(yr,"_instanceID");D(yr,"_authenticationHelper");var Ae=yr;var ea="\\u{1F6E1}\\uFE0F Asgardeo",ta={level:"info",prefix:`${ea}`,timestamps:!0,showLevel:!0},ra=()=>typeof window<"u"&&typeof window.document<"u",na=()=>typeof process<"u"&&process.versions&&process.versions.node,Y={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"},He={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;"},jn={debug:0,info:1,warn:2,error:3},oa=class Vn{constructor(e={}){D(this,"config"),this.config={...ta,...e}}configure(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}shouldLog(e){return jn[e]>=jn[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,r){let n=[];if(this.config.timestamps&&n.push(`${Y.gray}[${this.getTimestamp()}]${Y.reset}`),this.config.prefix&&n.push(`${Y.magenta}${this.config.prefix}${Y.reset}`),this.config.showLevel){let o=this.getLevelString(e),s;switch(e){case"debug":s=`${Y.gray}[${o}]${Y.reset}`;break;case"info":s=`${Y.blue}[${o}]${Y.reset}`;break;case"warn":s=`${Y.yellow}[${o}]${Y.reset}`;break;case"error":s=`${Y.red}[${o}]${Y.reset}`;break;default:s=`[${o}]`}n.push(s)}return n.push(r),n.join(" ")}logMessage(e,r,...n){if(this.shouldLog(e)){if(this.config.formatter){this.config.formatter(e,r,...n);return}ra()?this.logToBrowser(e,r,...n):na()?this.logToNode(e,r,...n):console.log(r,...n)}}logToBrowser(e,r,...n){let o=[],s=[];if(this.config.timestamps&&(o.push(`%c[${this.getTimestamp()}]`),s.push(He.timestamp)),this.config.prefix&&(o.push(`%c${this.config.prefix}`),s.push(He.prefix)),this.config.showLevel){let a=this.getLevelString(e);switch(o.push(`%c[${a}]`),e){case"debug":s.push(He.debug);break;case"info":s.push(He.info);break;case"warn":s.push(He.warn);break;case"error":s.push(He.error);break;default:s.push("")}}o.push(`%c${r}`),s.push("color: inherit; font-weight: normal;");let i=o.join(" ");switch(e){case"debug":console.debug(i,...s,...n);break;case"info":console.info(i,...s,...n);break;case"warn":console.warn(i,...s,...n);break;case"error":console.error(i,...s,...n);break;default:console.log(i,...s,...n)}}logToNode(e,r,...n){let o=this.formatForNode(e,r);switch(e){case"debug":console.debug(o,...n);break;case"info":console.info(o,...n);break;case"warn":console.warn(o,...n);break;case"error":console.error(o,...n);break;default:console.log(o,...n)}}debug(e,...r){this.logMessage("debug",e,...r)}info(e,...r){this.logMessage("info",e,...r)}warn(e,...r){this.logMessage("warn",e,...r)}error(e,...r){this.logMessage("error",e,...r)}child(e){let r=this.config.prefix?`${this.config.prefix} - ${e}`:e;return new Vn({...this.config,prefix:r})}setLevel(e){this.config.level=e}getLevel(){return this.config.level}},Gc=new oa;var wr="init";var Gn="sign-out",Xn="http-request",Yn="http-request-all",Zn="request-custom-grant",Qn="revoke-access-token";var eo="request-start",to="request-success";var ro="request-finish",no="get-oidc-service-endpoints",oo="get-basic-user-info",so="get-decoded-id-token";var io="get-crypto-helper",ao="enable_http_handler",co="disable_http_handler",lo="get_auth_url",uo="request_get_token",fo="is_authenticated",po="get_sign_out_url",ho="refresh_access-token",go="refresh-access-token-error",mo="set_session_state",yo="start_auto_refresh_token",wo="update_config",So="get_id_token",Sr="check_session_signed_in",Er="check_session_signed_out",Eo="get_config_data";var br="rpIFrame",Tr="promptNoneIFrame";var Rr="sign-in-silently";var _r="initialized-silent-sign-in",Ir="promptNoneRequestSent";var Fe="error",it="error_description",xr="custom_grant_config",Ar="state";var vr="Access token is invalid";var b=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 r;try{if(e instanceof Error)r=JSON.stringify({name:e.name,message:e.message,stack:e.stack,...e});else if(typeof e=="object"&&e!==null)try{r=JSON.stringify(e)}catch{r=JSON.stringify({message:e.toString?e.toString():"Unknown error",originalError:String(e)})}else r=JSON.stringify(e??"Unknown error")}catch{r=JSON.stringify({message:"Error serialization failed",originalError:String(e)})}return{error:r,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,r){sessionStorage.setItem(e,r)}static setSignOutURL(e,r,n){sessionStorage.setItem(`${$.SignOut.Storage.StorageKeys.SIGN_OUT_URL}-instance_${n}-${r}`,e)}static getSignOutUrl(e,r){return sessionStorage.getItem(`${$.SignOut.Storage.StorageKeys.SIGN_OUT_URL}-instance_${r}-${e}`)??""}static removePKCE(e){sessionStorage.removeItem(e)}static canContinueSignIn(e,r){return!(e&&!Se.hasErrorInURL()&&!Se.hasAuthSearchParamsInURL()&&!r)}static isInitializedSilentSignIn(){return Se.isSilentStatePresentInURL()}static wasSignInCalled(){return!!((Se.hasErrorInURL()||Se.hasAuthSearchParamsInURL())&&!this.isSilentStatePresentInURL())}static wasSilentSignInCalled(){let e=sessionStorage.getItem(_r);return!!(e?JSON.parse(e):null)}static async isSignOutSuccessful(){if(Ae.isSignOutSuccessful(window.location.href)){let e=window.location.href.split("?")[0];return history.pushState({},document.title,e),await Ae.clearSession(),!0}return!1}static didSignOutFail(){if(Ae.didSignOutFail(window.location.href)){let e=new URL(window.location.href),r=e.searchParams.get(Fe),n=e.searchParams.get(it),o=window.location.href.split("?")[0];return history.pushState({},document.title,o),{description:n??"",error:r??""}}return!1}static isSilentStatePresentInURL(){return new URL(window.location.href).searchParams.get("state")?.includes(Rr)??!1}static hasAuthSearchParamsInURL(e=window.location.search){return/[?&]code=[^&]+/.test(e)}static hasErrorInURL(e=window.location.href){let r=new URL(e);return!!r.searchParams.get(Fe)&&r.searchParams.get(Ar)!==$.Params.SIGN_OUT_SUCCESS}static canSendPromptNoneRequest(){let e=sessionStorage.getItem(Ir);return!(e?JSON.parse(e):null)}static setPromptNoneRequestSent(e){sessionStorage.setItem(Ir,JSON.stringify(e))}static async waitTillPageRedirect(e){let r=e??3e3;await new Promise(n=>setTimeout(n,r*1e3))}};S(Se,"until",(e,r=500)=>{let n=o=>e()?o():setTimeout(()=>n(o),r);return new Promise(n)});var Ee=Se;var Pt=class{constructor(e,r){S(this,"_authenticationClient");S(this,"_storageManager");S(this,"_spaHelper");S(this,"_instanceID");S(this,"_isTokenRefreshing");this._authenticationClient=e,this._storageManager=this._authenticationClient.getStorageManager(),this._spaHelper=r,this._instanceID=this._authenticationClient.getInstanceId(),this._isTokenRefreshing=!1}enableHttpHandler(e){e?.enableHandler&&e.enableHandler()}disableHttpHandler(e){e?.disableHandler&&e.disableHandler()}initializeSessionManger(e,r,n,o,s){s.initialize(e.clientId,r.checkSessionIframe??"",n,e.checkSessionInterval??3,e.sessionRefreshInterval??300,e.afterSignInUrl,o)}async exchangeToken(e,r){let n=await this._storageManager.getConfigData(),o=!0,s=!1;if(e?.tokenEndpoint)if(o=!1,n.storage==="webWorker"){for(let i of[...n?.allowedExternalUrls??[],e.baseUrl])if(i&&e.tokenEndpoint?.startsWith(i)){s=!0;break}}else s=!0;return e.shouldReplayAfterRefresh&&this._storageManager.setTemporaryDataParameter(xr,JSON.stringify(e)),o||s?this._authenticationClient.exchangeToken(e).then(async i=>(r&&typeof r=="function"&&r(e),e.returnsSession?(this._spaHelper.refreshAccessTokenAutomatically(this),this._authenticationClient.getUser()):i)).catch(i=>Promise.reject(i)):Promise.reject(new _("SPA-MAIN_THREAD_CLIENT-RCG-IV01","Request to the provided endpoint is prohibited.","Requests can only be sent to resource servers specified by the `allowedExternalUrls` attribute while initializing the SDK. The specified token endpoint in this request cannot be found among the `allowedExternalUrls`"))}async getCustomGrantConfigData(){let e=await this._storageManager.getTemporaryDataParameter(xr);return e?JSON.parse(e):null}async refreshAccessToken(e){try{await this._authenticationClient.refreshAccessToken();let r=await this.getCustomGrantConfigData();return r&&await this.exchangeToken(r,e),this._spaHelper.refreshAccessTokenAutomatically(this),this._authenticationClient.getUser()}catch(r){let n={type:go};return window.postMessage(n),Promise.reject(r)}}async retryFailedRequests(e){let r=e.httpClient,n=e.requestConfig,o=e.isHttpHandlerEnabled,s=e.httpErrorCallback,i=e.httpFinishCallback;await Ee.until(()=>!this._isTokenRefreshing);try{let a=await r.request(n);return Promise.resolve(a)}catch(a){return o&&(typeof s=="function"&&await s(a),typeof i=="function"&&i()),Promise.reject(a)}}async httpRequest(e,r,n,o,s,i){let a=!1,l=await this._storageManager.getConfigData();if(l.storage==="webWorker"){for(let c of[...l?.allowedExternalUrls??[],l.baseUrl])if(c&&r?.url?.startsWith(c)){a=!0;break}}else a=!0;return a?e.request(r).then(c=>Promise.resolve(c)).catch(async c=>{if(c?.response?.status===401||!c?.response){if(this._isTokenRefreshing)return this.retryFailedRequests({enableRetrievingSignOutURLFromSession:i,httpClient:e,httpErrorCallback:o,httpFinishCallback:s,isHttpHandlerEnabled:n,requestConfig:r});this._isTokenRefreshing=!0;let f;try{f=await this.refreshAccessToken(i),this._isTokenRefreshing=!1}catch(u){throw this._isTokenRefreshing=!1,n&&(typeof o=="function"&&await o({...c,code:vr}),typeof s=="function"&&s()),new _("SPA-AUTH_HELPER-HR-SE01",u?.name??"Refresh token request failed.",u?.message??"An error occurred while trying to refresh the access token following a 401 response from the server.")}if(f)try{let u=await e.request(r);return Promise.resolve(u)}catch(u){return n&&(typeof o=="function"&&await o(u),typeof s=="function"&&s()),Promise.reject(u)}}return n&&(typeof o=="function"&&await o(c),typeof s=="function"&&s()),Promise.reject(c)}):Promise.reject(new _("SPA-AUTH_HELPER-HR-IV02","Request to the provided endpoint is prohibited.","Requests can only be sent to resource servers specified by the `allowedExternalUrls` attribute while initializing the SDK. The specified endpoint in this request cannot be found among the `allowedExternalUrls`"))}async httpRequestAll(e,r,n,o,s){let i=!0,a=await this._storageManager.getConfigData();if(a.storage==="webWorker")for(let c of e){let f=!1;for(let u of[...a?.allowedExternalUrls??[],a.baseUrl])if(u&&c.url?.startsWith(u)){f=!0;break}if(!f){i=!1;break}}let l=[];if(i)return e.forEach(c=>{l.push(r.request(c))}),r?.all&&r.all(l).then(c=>Promise.resolve(c)).catch(async c=>{if(c?.response?.status===401||!c?.response){let f;try{f=await this._authenticationClient.refreshAccessToken()}catch(u){throw n&&(typeof o=="function"&&await o({...c,code:vr}),typeof s=="function"&&s()),new _("SPA-AUTH_HELPER-HRA-SE01",u?.name??"Refresh token request failed.",u?.message??"An error occurred while trying to refresh the access token following a 401 response from the server.")}if(f)return r.all&&r.all(l).then(u=>Promise.resolve(u)).catch(async u=>(n&&(typeof o=="function"&&await o(u),typeof s=="function"&&s()),Promise.reject(u)))}return n&&(typeof o=="function"&&await o(c),typeof s=="function"&&s()),Promise.reject(c)});throw new _("SPA-AUTH_HELPER-HRA-IV02","Request to the provided endpoint is prohibited.","Requests can only be sent to resource servers specified by the `allowedExternalUrls` attribute while initializing the SDK. The specified endpoint in this request cannot be found among the `allowedExternalUrls`")}async requestAccessToken(e,r,n,o,s,i){let a=await this._storageManager.getConfigData();if(a.storage==="browserMemory"&&a.enablePKCE&&r){let l=Ee.getPKCE(xe(r));await this._authenticationClient.setPKCECode(xe(r),l)}else a.storage==="webWorker"&&o&&await this._authenticationClient.setPKCECode(o,s??"");return e?this._authenticationClient.requestAccessToken(e,r??"",s??"",void 0,i).then(async()=>(a.storage!=="webWorker"?(Ee.setSignOutURL(await this._authenticationClient.getSignOutUrl(),a.clientId,this._instanceID),this._spaHelper&&(this._spaHelper.clearRefreshTokenTimeout(),this._spaHelper.refreshAccessTokenAutomatically(this)),n&&typeof n=="function"&&a.syncSession&&n()):this._spaHelper&&this._spaHelper.refreshAccessTokenAutomatically(this),this._authenticationClient.getUser())).catch(l=>Promise.reject(l)):Promise.reject(new _("SPA-AUTH_HELPER-RAT1-NF01","No authorization code.","No authorization code was found."))}async signInSilently(e,r,n,o,s){if(Ee.isInitializedSilentSignIn())return await n.receivePromptNoneResponse(),Promise.resolve({allowedScopes:"",displayName:"",email:"",sessionState:"",sub:"",tenantDomain:"",username:""});let a=document.getElementById(br)?.contentDocument?.getElementById(Tr);try{let l=await e(o);a.src=l}catch(l){return Promise.reject(l)}return new Promise((l,c)=>{let f=setTimeout(()=>{l(!1)},1e4),u=async h=>{let m=h.data;m?.type==Er&&(window.removeEventListener("message",u),clearTimeout(f),l(!1)),m?.type==Sr&&m?.data?.code&&r(m?.data?.code,m?.data?.sessionState,m?.data?.state,s).then(p=>{window.removeEventListener("message",u),l(p)}).catch(p=>{window.removeEventListener("message",u),c(p)}).finally(()=>{clearTimeout(f)})};window.addEventListener("message",u)})}async handleSignIn(e,r,n){let o=await this._storageManager.getConfigData();if(await e())return Promise.resolve({allowedScopes:"",displayName:"",email:"",sessionState:"",sub:"",tenantDomain:"",username:""});if(o.storage!=="webWorker"&&await this._authenticationClient.isSignedIn())return this._spaHelper.clearRefreshTokenTimeout(),this._spaHelper.refreshAccessTokenAutomatically(this),o.syncSession&&r(),Promise.resolve(await this._authenticationClient.getUser());let s=new URL(window.location.href).searchParams.get(Fe),i=new URL(window.location.href).searchParams.get(it);if(s){let a=new URL(window.location.href);throw a.searchParams.delete(Fe),a.searchParams.delete(it),history.pushState(null,document.title,a.toString()),new _("SPA-AUTH_HELPER-SI-SE01",s,i??"")}if(o.storage==="webWorker"&&n){let a=await n();if(a)return a}return Promise.resolve(void 0)}async attachTokenToRequestConfig(e){let r={attachToken:!0,...e};r.attachToken&&(r.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 Ut=class{constructor(e){S(this,"_authenticationClient");S(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 o=parseInt(n.expires_in),s=o<=10?o:o-10,i=setTimeout(async()=>{await e.refreshAccessToken()},s*1e3);await this._storageManager.setTemporaryDataParameter(st.Storage.StorageKeys.REFRESH_TOKEN_TIMER,JSON.stringify(i))}}async getRefreshTimeoutTimer(){return await this._storageManager.getTemporaryDataParameter(st.Storage.StorageKeys.REFRESH_TOKEN_TIMER)?JSON.parse(await this._storageManager.getTemporaryDataParameter(st.Storage.StorageKeys.REFRESH_TOKEN_TIMER)):-1}async clearRefreshTokenTimeout(e){if(e){clearTimeout(e);return}let r=await this.getRefreshTimeoutTimer();r!==-1&&clearTimeout(r)}};function at(t,e){return function(){return t.apply(e,arguments)}}var{toString:ia}=Object.prototype,{getPrototypeOf:Cr}=Object,{iterator:Nt,toStringTag:To}=Symbol,Dt=(t=>e=>{let r=ia.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Q=t=>(t=t.toLowerCase(),e=>Dt(e)===t),Bt=t=>e=>typeof e===t,{isArray:$e}=Array,Le=Bt("undefined");function ct(t){return t!==null&&!Le(t)&&t.constructor!==null&&!Le(t.constructor)&&J(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var Ro=Q("ArrayBuffer");function aa(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ro(t.buffer),e}var ca=Bt("string"),J=Bt("function"),_o=Bt("number"),lt=t=>t!==null&&typeof t=="object",la=t=>t===!0||t===!1,kt=t=>{if(Dt(t)!=="object")return!1;let e=Cr(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(To in t)&&!(Nt in t)},ua=t=>{if(!lt(t)||ct(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},fa=Q("Date"),da=Q("File"),pa=Q("Blob"),ha=Q("FileList"),ga=t=>lt(t)&&J(t.pipe),ma=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||J(t.append)&&((e=Dt(t))==="formdata"||e==="object"&&J(t.toString)&&t.toString()==="[object FormData]"))},ya=Q("URLSearchParams"),[wa,Sa,Ea,ba]=["ReadableStream","Request","Response","Headers"].map(Q),Ta=t=>t.trim?t.trim():t.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,"");function ut(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,o;if(typeof t!="object"&&(t=[t]),$e(t))for(n=0,o=t.length;n<o;n++)e.call(null,t[n],n,t);else{if(ct(t))return;let s=r?Object.getOwnPropertyNames(t):Object.keys(t),i=s.length,a;for(n=0;n<i;n++)a=s[n],e.call(null,t[a],a,t)}}function Io(t,e){if(ct(t))return null;e=e.toLowerCase();let r=Object.keys(t),n=r.length,o;for(;n-- >0;)if(o=r[n],e===o.toLowerCase())return o;return null}var ve=typeof self<"u"||typeof self<"u"?self:typeof window<"u"?window:self,xo=t=>!Le(t)&&t!==ve;function Or(){let{caseless:t,skipUndefined:e}=xo(this)&&this||{},r={},n=(o,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;let i=t&&Io(r,s)||s;kt(r[i])&&kt(o)?r[i]=Or(r[i],o):kt(o)?r[i]=Or({},o):$e(o)?r[i]=o.slice():(!e||!Le(o))&&(r[i]=o)};for(let o=0,s=arguments.length;o<s;o++)arguments[o]&&ut(arguments[o],n);return r}var Ra=(t,e,r,{allOwnKeys:n}={})=>(ut(e,(o,s)=>{r&&J(o)?Object.defineProperty(t,s,{value:at(o,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,s,{value:o,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),_a=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Ia=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},xa=(t,e,r,n)=>{let o,s,i,a={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),s=o.length;s-- >0;)i=o[s],(!n||n(i,t,e))&&!a[i]&&(e[i]=t[i],a[i]=!0);t=r!==!1&&Cr(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Aa=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let n=t.indexOf(e,r);return n!==-1&&n===r},va=t=>{if(!t)return null;if($e(t))return t;let e=t.length;if(!_o(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Oa=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Cr(Uint8Array)),Ca=(t,e)=>{let n=(t&&t[Nt]).call(t),o;for(;(o=n.next())&&!o.done;){let s=o.value;e.call(t,s[0],s[1])}},Pa=(t,e)=>{let r,n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Ua=Q("HTMLFormElement"),ka=t=>t.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,function(r,n,o){return n.toUpperCase()+o}),bo=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Na=Q("RegExp"),Ao=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),n={};ut(r,(o,s)=>{let i;(i=e(o,s,t))!==!1&&(n[s]=i||o)}),Object.defineProperties(t,n)},Da=t=>{Ao(t,(e,r)=>{if(J(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=t[r];if(J(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method \'"+r+"\'")})}})},Ba=(t,e)=>{let r={},n=o=>{o.forEach(s=>{r[s]=!0})};return $e(t)?n(t):n(String(t).split(e)),r},Ma=()=>{},Ha=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Fa(t){return!!(t&&J(t.append)&&t[To]==="FormData"&&t[Nt])}var La=t=>{let e=new Array(10),r=(n,o)=>{if(lt(n)){if(e.indexOf(n)>=0)return;if(ct(n))return n;if(!("toJSON"in n)){e[o]=n;let s=$e(n)?[]:{};return ut(n,(i,a)=>{let l=r(i,o+1);!Le(l)&&(s[a]=l)}),e[o]=void 0,s}}return n};return r(t,0)},$a=Q("AsyncFunction"),Ka=t=>t&&(lt(t)||J(t))&&J(t.then)&&J(t.catch),vo=((t,e)=>t?setImmediate:e?((r,n)=>(ve.addEventListener("message",({source:o,data:s})=>{o===ve&&s===r&&n.length&&n.shift()()},!1),o=>{n.push(o),ve.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",J(ve.postMessage)),Wa=typeof queueMicrotask<"u"?queueMicrotask.bind(ve):typeof process<"u"&&process.nextTick||vo,qa=t=>t!=null&&J(t[Nt]),d={isArray:$e,isArrayBuffer:Ro,isBuffer:ct,isFormData:ma,isArrayBufferView:aa,isString:ca,isNumber:_o,isBoolean:la,isObject:lt,isPlainObject:kt,isEmptyObject:ua,isReadableStream:wa,isRequest:Sa,isResponse:Ea,isHeaders:ba,isUndefined:Le,isDate:fa,isFile:da,isBlob:pa,isRegExp:Na,isFunction:J,isStream:ga,isURLSearchParams:ya,isTypedArray:Oa,isFileList:ha,forEach:ut,merge:Or,extend:Ra,trim:Ta,stripBOM:_a,inherits:Ia,toFlatObject:xa,kindOf:Dt,kindOfTest:Q,endsWith:Aa,toArray:va,forEachEntry:Ca,matchAll:Pa,isHTMLForm:Ua,hasOwnProperty:bo,hasOwnProp:bo,reduceDescriptors:Ao,freezeMethods:Da,toObjectSet:Ba,toCamelCase:ka,noop:Ma,toFiniteNumber:Ha,findKey:Io,global:ve,isContextDefined:xo,isSpecCompliantForm:Fa,toJSONObject:La,isAsyncFn:$a,isThenable:Ka,setImmediate:vo,asap:Wa,isIterable:qa};var j=class t extends Error{static from(e,r,n,o,s,i){let a=new t(e.message,r||e.code,n,o,s);return a.cause=e,a.name=e.name,i&&Object.assign(a,i),a}constructor(e,r,n,o,s){super(e),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),o&&(this.request=o),s&&(this.response=s,this.status=s.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:d.toJSONObject(this.config),code:this.code,status:this.status}}};j.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";j.ERR_BAD_OPTION="ERR_BAD_OPTION";j.ECONNABORTED="ECONNABORTED";j.ETIMEDOUT="ETIMEDOUT";j.ERR_NETWORK="ERR_NETWORK";j.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";j.ERR_DEPRECATED="ERR_DEPRECATED";j.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";j.ERR_BAD_REQUEST="ERR_BAD_REQUEST";j.ERR_CANCELED="ERR_CANCELED";j.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";j.ERR_INVALID_URL="ERR_INVALID_URL";var R=j;var Mt=null;function Pr(t){return d.isPlainObject(t)||d.isArray(t)}function Co(t){return d.endsWith(t,"[]")?t.slice(0,-2):t}function Oo(t,e,r){return t?t.concat(e).map(function(o,s){return o=Co(o),!r&&s?"["+o+"]":o}).join(r?".":""):e}function ja(t){return d.isArray(t)&&!t.some(Pr)}var za=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function Ja(t,e,r){if(!d.isObject(t))throw new TypeError("target must be an object");e=e||new(Mt||FormData),r=d.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,y){return!d.isUndefined(y[w])});let n=r.metaTokens,o=r.visitor||f,s=r.dots,i=r.indexes,l=(r.Blob||typeof Blob<"u"&&Blob)&&d.isSpecCompliantForm(e);if(!d.isFunction(o))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(d.isDate(p))return p.toISOString();if(d.isBoolean(p))return p.toString();if(!l&&d.isBlob(p))throw new R("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(p)||d.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function f(p,w,y){let E=p;if(p&&!y&&typeof p=="object"){if(d.endsWith(w,"{}"))w=n?w:w.slice(0,-2),p=JSON.stringify(p);else if(d.isArray(p)&&ja(p)||(d.isFileList(p)||d.endsWith(w,"[]"))&&(E=d.toArray(p)))return w=Co(w),E.forEach(function(x,A){!(d.isUndefined(x)||x===null)&&e.append(i===!0?Oo([w],A,s):i===null?w:w+"[]",c(x))}),!1}return Pr(p)?!0:(e.append(Oo(y,w,s),c(p)),!1)}let u=[],h=Object.assign(za,{defaultVisitor:f,convertValue:c,isVisitable:Pr});function m(p,w){if(!d.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+w.join("."));u.push(p),d.forEach(p,function(E,T){(!(d.isUndefined(E)||E===null)&&o.call(e,E,d.isString(T)?T.trim():T,w,h))===!0&&m(E,w?w.concat(T):[T])}),u.pop()}}if(!d.isObject(t))throw new TypeError("data must be an object");return m(t),e}var be=Ja;function Po(t){let e={"!":"%21","\'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\\0"};return encodeURIComponent(t).replace(/[!\'()~]|%20|%00/g,function(n){return e[n]})}function Uo(t,e){this._pairs=[],t&&be(t,this,e)}var ko=Uo.prototype;ko.append=function(e,r){this._pairs.push([e,r])};ko.toString=function(e){let r=e?function(n){return e.call(this,n,Po)}:Po;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};var Ht=Uo;function Va(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ft(t,e,r){if(!e)return t;let n=r&&r.encode||Va,o=d.isFunction(r)?{serialize:r}:r,s=o&&o.serialize,i;if(s?i=s(e,o):i=d.isURLSearchParams(e)?e.toString():new Ht(e,o).toString(n),i){let a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}var Ur=class{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){d.forEach(this.handlers,function(n){n!==null&&e(n)})}},kr=Ur;var Ke={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0};var No=typeof URLSearchParams<"u"?URLSearchParams:Ht;var Do=typeof FormData<"u"?FormData:null;var Bo=typeof Blob<"u"?Blob:null;var Mo={isBrowser:!0,classes:{URLSearchParams:No,FormData:Do,Blob:Bo},protocols:["http","https","file","blob","url","data"]};var Br={};Ys(Br,{hasBrowserEnv:()=>Dr,hasStandardBrowserEnv:()=>Ga,hasStandardBrowserWebWorkerEnv:()=>Xa,navigator:()=>Nr,origin:()=>Ya});var Dr=typeof window<"u"&&typeof document<"u",Nr=typeof navigator=="object"&&navigator||void 0,Ga=Dr&&(!Nr||["ReactNative","NativeScript","NS"].indexOf(Nr.product)<0),Xa=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ya=Dr&&window.location.href||"http://localhost";var U={...Br,...Mo};function Mr(t,e){return be(t,new U.classes.URLSearchParams,{visitor:function(r,n,o,s){return U.isNode&&d.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...e})}function Za(t){return d.matchAll(/\\w+|\\[(\\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Qa(t){let e={},r=Object.keys(t),n,o=r.length,s;for(n=0;n<o;n++)s=r[n],e[s]=t[s];return e}function ec(t){function e(r,n,o,s){let i=r[s++];if(i==="__proto__")return!0;let a=Number.isFinite(+i),l=s>=r.length;return i=!i&&d.isArray(o)?o.length:i,l?(d.hasOwnProp(o,i)?o[i]=[o[i],n]:o[i]=n,!a):((!o[i]||!d.isObject(o[i]))&&(o[i]=[]),e(r,n,o[i],s)&&d.isArray(o[i])&&(o[i]=Qa(o[i])),!a)}if(d.isFormData(t)&&d.isFunction(t.entries)){let r={};return d.forEachEntry(t,(n,o)=>{e(Za(n),o,r,0)}),r}return null}var Ft=ec;function tc(t,e,r){if(d.isString(t))try{return(e||JSON.parse)(t),d.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var Hr={transitional:Ke,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){let n=r.getContentType()||"",o=n.indexOf("application/json")>-1,s=d.isObject(e);if(s&&d.isHTMLForm(e)&&(e=new FormData(e)),d.isFormData(e))return o?JSON.stringify(Ft(e)):e;if(d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e)||d.isReadableStream(e))return e;if(d.isArrayBufferView(e))return e.buffer;if(d.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Mr(e,this.formSerializer).toString();if((a=d.isFileList(e))||n.indexOf("multipart/form-data")>-1){let l=this.env&&this.env.FormData;return be(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||o?(r.setContentType("application/json",!1),tc(e)):e}],transformResponse:[function(e){let r=this.transitional||Hr.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(d.isResponse(e)||d.isReadableStream(e))return e;if(e&&d.isString(e)&&(n&&!this.responseType||o)){let i=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(e,this.parseReviver)}catch(a){if(i)throw a.name==="SyntaxError"?R.from(a,R.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:U.classes.FormData,Blob:U.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],t=>{Hr.headers[t]={}});var We=Hr;var rc=d.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ho=t=>{let e={},r,n,o;return t&&t.split(`\n`).forEach(function(i){o=i.indexOf(":"),r=i.substring(0,o).trim().toLowerCase(),n=i.substring(o+1).trim(),!(!r||e[r]&&rc[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e};var Fo=Symbol("internals");function dt(t){return t&&String(t).trim().toLowerCase()}function Lt(t){return t===!1||t==null?t:d.isArray(t)?t.map(Lt):String(t)}function nc(t){let e=Object.create(null),r=/([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g,n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}var oc=t=>/^[-_a-zA-Z0-9^`|~,!#$%&\'*+.]+$/.test(t.trim());function Fr(t,e,r,n,o){if(d.isFunction(n))return n.call(this,e,r);if(o&&(e=r),!!d.isString(e)){if(d.isString(n))return e.indexOf(n)!==-1;if(d.isRegExp(n))return n.test(e)}}function sc(t){return t.trim().toLowerCase().replace(/([a-z\\d])(\\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function ic(t,e){let r=d.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(o,s,i){return this[n].call(this,e,o,s,i)},configurable:!0})})}var qe=class{constructor(e){e&&this.set(e)}set(e,r,n){let o=this;function s(a,l,c){let f=dt(l);if(!f)throw new Error("header name must be a non-empty string");let u=d.findKey(o,f);(!u||o[u]===void 0||c===!0||c===void 0&&o[u]!==!1)&&(o[u||l]=Lt(a))}let i=(a,l)=>d.forEach(a,(c,f)=>s(c,f,l));if(d.isPlainObject(e)||e instanceof this.constructor)i(e,r);else if(d.isString(e)&&(e=e.trim())&&!oc(e))i(Ho(e),r);else if(d.isObject(e)&&d.isIterable(e)){let a={},l,c;for(let f of e){if(!d.isArray(f))throw TypeError("Object iterator must return a key-value pair");a[c=f[0]]=(l=a[c])?d.isArray(l)?[...l,f[1]]:[l,f[1]]:f[1]}i(a,r)}else e!=null&&s(r,e,n);return this}get(e,r){if(e=dt(e),e){let n=d.findKey(this,e);if(n){let o=this[n];if(!r)return o;if(r===!0)return nc(o);if(d.isFunction(r))return r.call(this,o,n);if(d.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=dt(e),e){let n=d.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||Fr(this,this[n],n,r)))}return!1}delete(e,r){let n=this,o=!1;function s(i){if(i=dt(i),i){let a=d.findKey(n,i);a&&(!r||Fr(n,n[a],a,r))&&(delete n[a],o=!0)}}return d.isArray(e)?e.forEach(s):s(e),o}clear(e){let r=Object.keys(this),n=r.length,o=!1;for(;n--;){let s=r[n];(!e||Fr(this,this[s],s,e,!0))&&(delete this[s],o=!0)}return o}normalize(e){let r=this,n={};return d.forEach(this,(o,s)=>{let i=d.findKey(n,s);if(i){r[i]=Lt(o),delete r[s];return}let a=e?sc(s):String(s).trim();a!==s&&delete r[s],r[a]=Lt(o),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return d.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=e&&d.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`\n`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(o=>n.set(o)),n}static accessor(e){let n=(this[Fo]=this[Fo]={accessors:{}}).accessors,o=this.prototype;function s(i){let a=dt(i);n[a]||(ic(o,i),n[a]=!0)}return d.isArray(e)?e.forEach(s):s(e),this}};qe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);d.reduceDescriptors(qe.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});d.freezeMethods(qe);var F=qe;function pt(t,e){let r=this||We,n=e||r,o=F.from(n.headers),s=n.data;return d.forEach(t,function(a){s=a.call(r,s,o.normalize(),e?e.status:void 0)}),o.normalize(),s}function ht(t){return!!(t&&t.__CANCEL__)}var Lr=class extends R{constructor(e,r,n){super(e??"canceled",R.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}},se=Lr;function gt(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new R("Request failed with status code "+r.status,[R.ERR_BAD_REQUEST,R.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function $r(t){let e=/^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(t);return e&&e[1]||""}function ac(t,e){t=t||10;let r=new Array(t),n=new Array(t),o=0,s=0,i;return e=e!==void 0?e:1e3,function(l){let c=Date.now(),f=n[s];i||(i=c),r[o]=l,n[o]=c;let u=s,h=0;for(;u!==o;)h+=r[u++],u=u%t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),c-i<e)return;let m=f&&c-f;return m?Math.round(h*1e3/m):void 0}}var Lo=ac;function cc(t,e){let r=0,n=1e3/e,o,s,i=(c,f=Date.now())=>{r=f,o=null,s&&(clearTimeout(s),s=null),t(...c)};return[(...c)=>{let f=Date.now(),u=f-r;u>=n?i(c,f):(o=c,s||(s=setTimeout(()=>{s=null,i(o)},n-u)))},()=>o&&i(o)]}var $o=cc;var je=(t,e,r=3)=>{let n=0,o=Lo(50,250);return $o(s=>{let i=s.loaded,a=s.lengthComputable?s.total:void 0,l=i-n,c=o(l),f=i<=a;n=i;let u={loaded:i,total:a,progress:a?i/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&f?(a-i)/c:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(u)},r)},Kr=(t,e)=>{let r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},Wr=t=>(...e)=>d.asap(()=>t(...e));var Ko=U.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,U.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(U.origin),U.navigator&&/(msie|trident)/i.test(U.navigator.userAgent)):()=>!0;var Wo=U.hasStandardBrowserEnv?{write(t,e,r,n,o,s,i){if(typeof document>"u")return;let a=[`${t}=${encodeURIComponent(e)}`];d.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),d.isString(n)&&a.push(`path=${n}`),d.isString(o)&&a.push(`domain=${o}`),s===!0&&a.push("secure"),d.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(t){if(typeof document>"u")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function qr(t){return typeof t!="string"?!1:/^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(t)}function jr(t,e){return e?t.replace(/\\/?\\/$/,"")+"/"+e.replace(/^\\/+/,""):t}function mt(t,e,r){let n=!qr(e);return t&&(n||r==!1)?jr(t,e):e}var qo=t=>t instanceof F?{...t}:t;function ee(t,e){e=e||{};let r={};function n(c,f,u,h){return d.isPlainObject(c)&&d.isPlainObject(f)?d.merge.call({caseless:h},c,f):d.isPlainObject(f)?d.merge({},f):d.isArray(f)?f.slice():f}function o(c,f,u,h){if(d.isUndefined(f)){if(!d.isUndefined(c))return n(void 0,c,u,h)}else return n(c,f,u,h)}function s(c,f){if(!d.isUndefined(f))return n(void 0,f)}function i(c,f){if(d.isUndefined(f)){if(!d.isUndefined(c))return n(void 0,c)}else return n(void 0,f)}function a(c,f,u){if(u in e)return n(c,f);if(u in t)return n(void 0,c)}let l={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(c,f,u)=>o(qo(c),qo(f),u,!0)};return d.forEach(Object.keys({...t,...e}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;let u=d.hasOwnProp(l,f)?l[f]:o,h=u(t[f],e[f],f);d.isUndefined(h)&&u!==a||(r[f]=h)}),r}var $t=t=>{let e=ee({},t),{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:a}=e;if(e.headers=i=F.from(i),e.url=ft(mt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),d.isFormData(r)){if(U.hasStandardBrowserEnv||U.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(d.isFunction(r.getHeaders)){let l=r.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([f,u])=>{c.includes(f.toLowerCase())&&i.set(f,u)})}}if(U.hasStandardBrowserEnv&&(n&&d.isFunction(n)&&(n=n(e)),n||n!==!1&&Ko(e.url))){let l=o&&s&&Wo.read(s);l&&i.set(o,l)}return e};var lc=typeof XMLHttpRequest<"u",jo=lc&&function(t){return new Promise(function(r,n){let o=$t(t),s=o.data,i=F.from(o.headers).normalize(),{responseType:a,onUploadProgress:l,onDownloadProgress:c}=o,f,u,h,m,p;function w(){m&&m(),p&&p(),o.cancelToken&&o.cancelToken.unsubscribe(f),o.signal&&o.signal.removeEventListener("abort",f)}let y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,!0),y.timeout=o.timeout;function E(){if(!y)return;let x=F.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),I={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:t,request:y};gt(function(v){r(v),w()},function(v){n(v),w()},I),y=null}"onloadend"in y?y.onloadend=E:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(E)},y.onabort=function(){y&&(n(new R("Request aborted",R.ECONNABORTED,t,y)),y=null)},y.onerror=function(A){let I=A&&A.message?A.message:"Network Error",H=new R(I,R.ERR_NETWORK,t,y);H.event=A||null,n(H),y=null},y.ontimeout=function(){let A=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",I=o.transitional||Ke;o.timeoutErrorMessage&&(A=o.timeoutErrorMessage),n(new R(A,I.clarifyTimeoutError?R.ETIMEDOUT:R.ECONNABORTED,t,y)),y=null},s===void 0&&i.setContentType(null),"setRequestHeader"in y&&d.forEach(i.toJSON(),function(A,I){y.setRequestHeader(I,A)}),d.isUndefined(o.withCredentials)||(y.withCredentials=!!o.withCredentials),a&&a!=="json"&&(y.responseType=o.responseType),c&&([h,p]=je(c,!0),y.addEventListener("progress",h)),l&&y.upload&&([u,m]=je(l),y.upload.addEventListener("progress",u),y.upload.addEventListener("loadend",m)),(o.cancelToken||o.signal)&&(f=x=>{y&&(n(!x||x.type?new se(null,t,y):x),y.abort(),y=null)},o.cancelToken&&o.cancelToken.subscribe(f),o.signal&&(o.signal.aborted?f():o.signal.addEventListener("abort",f)));let T=$r(o.url);if(T&&U.protocols.indexOf(T)===-1){n(new R("Unsupported protocol "+T+":",R.ERR_BAD_REQUEST,t));return}y.send(s||null)})};var uc=(t,e)=>{let{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,o,s=function(c){if(!o){o=!0,a();let f=c instanceof Error?c:this.reason;n.abort(f instanceof R?f:new se(f instanceof Error?f.message:f))}},i=e&&setTimeout(()=>{i=null,s(new R(`timeout of ${e}ms exceeded`,R.ETIMEDOUT))},e),a=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),t=null)};t.forEach(c=>c.addEventListener("abort",s));let{signal:l}=n;return l.unsubscribe=()=>d.asap(a),l}},zo=uc;var fc=function*(t,e){let r=t.byteLength;if(!e||r<e){yield t;return}let n=0,o;for(;n<r;)o=n+e,yield t.slice(n,o),n=o},dc=async function*(t,e){for await(let r of pc(t))yield*fc(r,e)},pc=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}let e=t.getReader();try{for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},zr=(t,e,r,n)=>{let o=dc(t,e),s=0,i,a=l=>{i||(i=!0,n&&n(l))};return new ReadableStream({async pull(l){try{let{done:c,value:f}=await o.next();if(c){a(),l.close();return}let u=f.byteLength;if(r){let h=s+=u;r(h)}l.enqueue(new Uint8Array(f))}catch(c){throw a(c),c}},cancel(l){return a(l),o.return()}},{highWaterMark:2})};var Jo=64*1024,{isFunction:Kt}=d,hc=(({Request:t,Response:e})=>({Request:t,Response:e}))(d.global),{ReadableStream:Vo,TextEncoder:Go}=d.global,Xo=(t,...e)=>{try{return!!t(...e)}catch{return!1}},gc=t=>{t=d.merge.call({skipUndefined:!0},hc,t);let{fetch:e,Request:r,Response:n}=t,o=e?Kt(e):typeof fetch=="function",s=Kt(r),i=Kt(n);if(!o)return!1;let a=o&&Kt(Vo),l=o&&(typeof Go=="function"?(p=>w=>p.encode(w))(new Go):async p=>new Uint8Array(await new r(p).arrayBuffer())),c=s&&a&&Xo(()=>{let p=!1,w=new r(U.origin,{body:new Vo,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!w}),f=i&&a&&Xo(()=>d.isReadableStream(new n("").body)),u={stream:f&&(p=>p.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!u[p]&&(u[p]=(w,y)=>{let E=w&&w[p];if(E)return E.call(w);throw new R(`Response type \'${p}\' is not supported`,R.ERR_NOT_SUPPORT,y)})});let h=async p=>{if(p==null)return 0;if(d.isBlob(p))return p.size;if(d.isSpecCompliantForm(p))return(await new r(U.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(d.isArrayBufferView(p)||d.isArrayBuffer(p))return p.byteLength;if(d.isURLSearchParams(p)&&(p=p+""),d.isString(p))return(await l(p)).byteLength},m=async(p,w)=>{let y=d.toFiniteNumber(p.getContentLength());return y??h(w)};return async p=>{let{url:w,method:y,data:E,signal:T,cancelToken:x,timeout:A,onDownloadProgress:I,onUploadProgress:H,responseType:v,headers:k,withCredentials:P="same-origin",fetchOptions:ae}=$t(p),ce=e||fetch;v=v?(v+"").toLowerCase():"text";let re=zo([T,x&&x.toAbortSignal()],A),Pe=null,me=re&&re.unsubscribe&&(()=>{re.unsubscribe()}),er;try{if(H&&c&&y!=="get"&&y!=="head"&&(er=await m(k,E))!==0){let K=new r(w,{method:"POST",body:E,duplex:"half"}),ue;if(d.isFormData(E)&&(ue=K.headers.get("content-type"))&&k.setContentType(ue),K.body){let[Re,Ue]=Kr(er,je(Wr(H)));E=zr(K.body,Jo,Re,Ue)}}d.isString(P)||(P=P?"include":"omit");let q=s&&"credentials"in r.prototype,tr={...ae,signal:re,method:y.toUpperCase(),headers:k.normalize().toJSON(),body:E,duplex:"half",credentials:q?P:void 0};Pe=s&&new r(w,tr);let le=await(s?ce(Pe,ae):ce(w,tr)),rr=f&&(v==="stream"||v==="response");if(f&&(I||rr&&me)){let K={};["status","statusText","headers"].forEach(Sn=>{K[Sn]=le[Sn]});let ue=d.toFiniteNumber(le.headers.get("content-length")),[Re,Ue]=I&&Kr(ue,je(Wr(I),!0))||[];le=new n(zr(le.body,Jo,Re,()=>{Ue&&Ue(),me&&me()}),K)}v=v||"text";let C=await u[d.findKey(u,v)||"text"](le,p);return!rr&&me&&me(),await new Promise((K,ue)=>{gt(K,ue,{data:C,headers:F.from(le.headers),status:le.status,statusText:le.statusText,config:p,request:Pe})})}catch(q){throw me&&me(),q&&q.name==="TypeError"&&/Load failed|fetch/i.test(q.message)?Object.assign(new R("Network Error",R.ERR_NETWORK,p,Pe,q&&q.response),{cause:q.cause||q}):R.from(q,q&&q.code,p,Pe,q&&q.response)}}},mc=new Map,Jr=t=>{let e=t&&t.env||{},{fetch:r,Request:n,Response:o}=e,s=[n,o,r],i=s.length,a=i,l,c,f=mc;for(;a--;)l=s[a],c=f.get(l),c===void 0&&f.set(l,c=a?new Map:gc(e)),f=c;return c},cd=Jr();var Vr={http:Mt,xhr:jo,fetch:{get:Jr}};d.forEach(Vr,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var Yo=t=>`- ${t}`,wc=t=>d.isFunction(t)||t===null||t===!1;function Sc(t,e){t=d.isArray(t)?t:[t];let{length:r}=t,n,o,s={};for(let i=0;i<r;i++){n=t[i];let a;if(o=n,!wc(n)&&(o=Vr[(a=String(n)).toLowerCase()],o===void 0))throw new R(`Unknown adapter \'${a}\'`);if(o&&(d.isFunction(o)||(o=o.get(e))))break;s[a||"#"+i]=o}if(!o){let i=Object.entries(s).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build")),a=r?i.length>1?`since :\n`+i.map(Yo).join(`\n`):" "+Yo(i[0]):"as no adapter specified";throw new R("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o}var Wt={getAdapter:Sc,adapters:Vr};function Gr(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new se(null,t)}function qt(t){return Gr(t),t.headers=F.from(t.headers),t.data=pt.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Wt.getAdapter(t.adapter||We.adapter,t)(t).then(function(n){return Gr(t),n.data=pt.call(t,t.transformResponse,n),n.headers=F.from(n.headers),n},function(n){return ht(n)||(Gr(t),n&&n.response&&(n.response.data=pt.call(t,t.transformResponse,n.response),n.response.headers=F.from(n.response.headers))),Promise.reject(n)})}var jt="1.13.5";var zt={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{zt[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Zo={};zt.transitional=function(e,r,n){function o(s,i){return"[Axios v"+jt+"] Transitional option \'"+s+"\'"+i+(n?". "+n:"")}return(s,i,a)=>{if(e===!1)throw new R(o(i," has been removed"+(r?" in "+r:"")),R.ERR_DEPRECATED);return r&&!Zo[i]&&(Zo[i]=!0,console.warn(o(i," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,i,a):!0}};zt.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function Ec(t,e,r){if(typeof t!="object")throw new R("options must be an object",R.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),o=n.length;for(;o-- >0;){let s=n[o],i=e[s];if(i){let a=t[s],l=a===void 0||i(a,s,t);if(l!==!0)throw new R("option "+s+" must be "+l,R.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new R("Unknown option "+s,R.ERR_BAD_OPTION)}}var yt={assertOptions:Ec,validators:zt};var Z=yt.validators,ze=class{constructor(e){this.defaults=e||{},this.interceptors={request:new kr,response:new kr}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;let s=o.stack?o.stack.replace(/^.+\\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\\n.+\\n/,""))&&(n.stack+=`\n`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=ee(this.defaults,r);let{transitional:n,paramsSerializer:o,headers:s}=r;n!==void 0&&yt.assertOptions(n,{silentJSONParsing:Z.transitional(Z.boolean),forcedJSONParsing:Z.transitional(Z.boolean),clarifyTimeoutError:Z.transitional(Z.boolean),legacyInterceptorReqResOrdering:Z.transitional(Z.boolean)},!1),o!=null&&(d.isFunction(o)?r.paramsSerializer={serialize:o}:yt.assertOptions(o,{encode:Z.function,serialize:Z.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),yt.assertOptions(r,{baseUrl:Z.spelling("baseURL"),withXsrfToken:Z.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=s&&d.merge(s.common,s[r.method]);s&&d.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),r.headers=F.concat(i,s);let a=[],l=!0;this.interceptors.request.forEach(function(w){if(typeof w.runWhen=="function"&&w.runWhen(r)===!1)return;l=l&&w.synchronous;let y=r.transitional||Ke;y&&y.legacyInterceptorReqResOrdering?a.unshift(w.fulfilled,w.rejected):a.push(w.fulfilled,w.rejected)});let c=[];this.interceptors.response.forEach(function(w){c.push(w.fulfilled,w.rejected)});let f,u=0,h;if(!l){let p=[qt.bind(this),void 0];for(p.unshift(...a),p.push(...c),h=p.length,f=Promise.resolve(r);u<h;)f=f.then(p[u++],p[u++]);return f}h=a.length;let m=r;for(;u<h;){let p=a[u++],w=a[u++];try{m=p(m)}catch(y){w.call(this,y);break}}try{f=qt.call(this,m)}catch(p){return Promise.reject(p)}for(u=0,h=c.length;u<h;)f=f.then(c[u++],c[u++]);return f}getUri(e){e=ee(this.defaults,e);let r=mt(e.baseURL,e.url,e.allowAbsoluteUrls);return ft(r,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){ze.prototype[e]=function(r,n){return this.request(ee(n||{},{method:e,url:r,data:(n||{}).data}))}});d.forEach(["post","put","patch"],function(e){function r(n){return function(s,i,a){return this.request(ee(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}ze.prototype[e]=r(),ze.prototype[e+"Form"]=r(!0)});var wt=ze;var Xr=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});let n=this;this.promise.then(o=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](o);n._listeners=null}),this.promise.then=o=>{let s,i=new Promise(a=>{n.subscribe(a),s=a}).then(o);return i.cancel=function(){n.unsubscribe(s)},i},e(function(s,i,a){n.reason||(n.reason=new se(s,i,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new t(function(o){e=o}),cancel:e}}},Qo=Xr;function Yr(t){return function(r){return t.apply(null,r)}}function Zr(t){return d.isObject(t)&&t.isAxiosError===!0}var Qr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Qr).forEach(([t,e])=>{Qr[e]=t});var es=Qr;function ts(t){let e=new wt(t),r=at(wt.prototype.request,e);return d.extend(r,wt.prototype,e,{allOwnKeys:!0}),d.extend(r,e,null,{allOwnKeys:!0}),r.create=function(o){return ts(ee(t,o))},r}var M=ts(We);M.Axios=wt;M.CanceledError=se;M.CancelToken=Qo;M.isCancel=ht;M.VERSION=jt;M.toFormData=be;M.AxiosError=R;M.Cancel=M.CanceledError;M.all=function(e){return Promise.all(e)};M.spread=Yr;M.isAxiosError=Zr;M.mergeConfig=ee;M.AxiosHeaders=F;M.formToJSON=t=>Ft(d.isHTMLForm(t)?new FormData(t):t);M.getAdapter=Wt.getAdapter;M.HttpStatusCode=es;M.default=M;var Je=M;var{Axios:ip,AxiosError:ap,CanceledError:cp,isCancel:lp,CancelToken:up,VERSION:fp,all:dp,Cancel:pp,isAxiosError:hp,spread:gp,toFormData:mp,AxiosHeaders:yp,HttpStatusCode:wp,formToJSON:Sp,getAdapter:Ep,mergeConfig:bp}=Je;function rs(){return t=>{}}var B=class{constructor(){S(this,"attachToken",()=>Promise.resolve());S(this,"requestStartCallback",()=>null);S(this,"requestSuccessCallback",()=>null);S(this,"requestErrorCallback",()=>null);S(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=Je.create({withCredentials:!0}),this.clientInstance||(this.clientInstance=new B),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=Je.all,this.axiosInstance.spread=Je.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 r=e?.data,n=new FormData;Object.keys(r).forEach(o=>{n.append(o,r[o])}),e.data=n}return e.startTimeInMs=new Date().getTime(),B.isHandlerEnabled&&this.requestStartCallback&&typeof this.requestStartCallback=="function"&&this.requestStartCallback(e),e}errorHandler(e){throw B.isHandlerEnabled&&(this.requestErrorCallback&&typeof this.requestErrorCallback=="function"&&this.requestErrorCallback(e),this.requestFinishCallback&&typeof this.requestFinishCallback=="function"&&this.requestFinishCallback()),e}successHandler(e){return B.isHandlerEnabled&&(this.requestSuccessCallback&&typeof this.requestSuccessCallback=="function"&&this.requestSuccessCallback(e),this.requestFinishCallback&&typeof this.requestFinishCallback=="function"&&this.requestFinishCallback()),e}async init(e=!0,r){B.isHandlerEnabled=e,this.attachToken=r}enableHandler(){B.isHandlerEnabled=!0}disableHandler(){B.isHandlerEnabled=!1}disableHandlerWithTimeout(e=B.DEFAULT_HANDLER_DISABLE_TIMEOUT){B.isHandlerEnabled=!1,setTimeout(()=>{B.isHandlerEnabled=!0},e)}setHttpRequestStartCallback(e){this.requestStartCallback=e}setHttpRequestSuccessCallback(e){this.requestSuccessCallback=e}setHttpRequestErrorCallback(e){this.requestErrorCallback=e}setHttpRequestFinishCallback(e){this.requestFinishCallback=e}};S(B,"axiosInstance"),S(B,"clientInstance"),S(B,"isHandlerEnabled"),S(B,"DEFAULT_HANDLER_DISABLE_TIMEOUT",1e3),B=Tn([rs()],B);var Jt=class{constructor(){S(this,"_data");this._data=new Map}async setData(e,r){this._data.set(e,r)}async getData(e){return this._data?.get(e)??"{}"}async removeData(e){this._data.delete(e)}};var Ls=rt(Ct(),1);var wn=rt(is(),1),$s=rt(cs(),1);var Ge=new TextEncoder,he=new TextDecoder,Gp=2**32;function ls(...t){let e=t.reduce((o,{length:s})=>o+s,0),r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}function us(t){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(t);let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function Te(t){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof t=="string"?t:he.decode(t),{alphabet:"base64url"});let e=t;e instanceof Uint8Array&&(e=he.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/\\s/g,"");try{return us(e)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}var G=class extends Error{constructor(r,n){super(r,n);S(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};S(G,"code","ERR_JOSE_GENERIC");var V=class extends G{constructor(r,n,o="unspecified",s="unspecified"){super(r,{cause:{claim:o,reason:s,payload:n}});S(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");S(this,"claim");S(this,"reason");S(this,"payload");this.claim=o,this.reason=s,this.payload=n}};S(V,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");var Xe=class extends G{constructor(r,n,o="unspecified",s="unspecified"){super(r,{cause:{claim:o,reason:s,payload:n}});S(this,"code","ERR_JWT_EXPIRED");S(this,"claim");S(this,"reason");S(this,"payload");this.claim=o,this.reason=s,this.payload=n}};S(Xe,"code","ERR_JWT_EXPIRED");var St=class extends G{constructor(){super(...arguments);S(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}};S(St,"code","ERR_JOSE_ALG_NOT_ALLOWED");var W=class extends G{constructor(){super(...arguments);S(this,"code","ERR_JOSE_NOT_SUPPORTED")}};S(W,"code","ERR_JOSE_NOT_SUPPORTED");var N=class extends G{constructor(){super(...arguments);S(this,"code","ERR_JWS_INVALID")}};S(N,"code","ERR_JWS_INVALID");var Oe=class extends G{constructor(){super(...arguments);S(this,"code","ERR_JWT_INVALID")}};S(Oe,"code","ERR_JWT_INVALID");var Ye=class extends G{constructor(){super(...arguments);S(this,"code","ERR_JWKS_INVALID")}};S(Ye,"code","ERR_JWKS_INVALID");var Et=class extends G{constructor(r="no applicable key found in the JSON Web Key Set",n){super(r,n);S(this,"code","ERR_JWKS_NO_MATCHING_KEY")}};S(Et,"code","ERR_JWKS_NO_MATCHING_KEY");var fs,ds,bt=class extends(ds=G,fs=Symbol.asyncIterator,ds){constructor(r="multiple matching keys found in the JSON Web Key Set",n){super(r,n);S(this,fs);S(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}};S(bt,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");var Tt=class extends G{constructor(r="signature verification failed",n){super(r,n);S(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}};S(Tt,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function ge(t,e="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`)}function Rt(t,e){return t.name===e}function on(t){return parseInt(t.name.slice(4),10)}function Ac(t){switch(t){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function vc(t,e){if(e&&!t.usages.includes(e))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${e}.`)}function ps(t,e,r){switch(e){case"HS256":case"HS384":case"HS512":{if(!Rt(t.algorithm,"HMAC"))throw ge("HMAC");let n=parseInt(e.slice(2),10);if(on(t.algorithm.hash)!==n)throw ge(`SHA-${n}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!Rt(t.algorithm,"RSASSA-PKCS1-v1_5"))throw ge("RSASSA-PKCS1-v1_5");let n=parseInt(e.slice(2),10);if(on(t.algorithm.hash)!==n)throw ge(`SHA-${n}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!Rt(t.algorithm,"RSA-PSS"))throw ge("RSA-PSS");let n=parseInt(e.slice(2),10);if(on(t.algorithm.hash)!==n)throw ge(`SHA-${n}`,"algorithm.hash");break}case"Ed25519":case"EdDSA":{if(!Rt(t.algorithm,"Ed25519"))throw ge("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!Rt(t.algorithm,"ECDSA"))throw ge("ECDSA");let n=Ac(e);if(t.algorithm.namedCurve!==n)throw ge(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}vc(t,r)}function hs(t,e,...r){if(r=r.filter(Boolean),r.length>2){let n=r.pop();t+=`one of type ${r.join(", ")}, or ${n}.`}else r.length===2?t+=`one of type ${r[0]} or ${r[1]}.`:t+=`of type ${r[0]}.`;return e==null?t+=` Received ${e}`:typeof e=="function"&&e.name?t+=` Received function ${e.name}`:typeof e=="object"&&e!=null&&e.constructor?.name&&(t+=` Received an instance of ${e.constructor.name}`),t}var gs=(t,...e)=>hs("Key must be ",t,...e);function sn(t,e,...r){return hs(`Key for the ${t} algorithm must be `,e,...r)}function an(t){return t?.[Symbol.toStringTag]==="CryptoKey"}function cn(t){return t?.[Symbol.toStringTag]==="KeyObject"}var ln=t=>an(t)||cn(t);var ms=(...t)=>{let e=t.filter(Boolean);if(e.length===0||e.length===1)return!0;let r;for(let n of e){let o=Object.keys(n);if(!r||r.size===0){r=new Set(o);continue}for(let s of o){if(r.has(s))return!1;r.add(s)}}return!0};function Oc(t){return typeof t=="object"&&t!==null}var te=t=>{if(!Oc(t)||Object.prototype.toString.call(t)!=="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var ys=(t,e)=>{if(t.startsWith("RS")||t.startsWith("PS")){let{modulusLength:r}=e.algorithm;if(typeof r!="number"||r<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}};function Cc(t){let e,r;switch(t.kty){case"RSA":{switch(t.alg){case"PS256":case"PS384":case"PS512":e={name:"RSA-PSS",hash:`SHA-${t.alg.slice(-3)}`},r=t.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":e={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.alg.slice(-3)}`},r=t.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(t.alg.slice(-3),10)||1}`},r=t.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new W(\'Invalid or unsupported JWK "alg" (Algorithm) Parameter value\')}break}case"EC":{switch(t.alg){case"ES256":e={name:"ECDSA",namedCurve:"P-256"},r=t.d?["sign"]:["verify"];break;case"ES384":e={name:"ECDSA",namedCurve:"P-384"},r=t.d?["sign"]:["verify"];break;case"ES512":e={name:"ECDSA",namedCurve:"P-521"},r=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:"ECDH",namedCurve:t.crv},r=t.d?["deriveBits"]:[];break;default:throw new W(\'Invalid or unsupported JWK "alg" (Algorithm) Parameter value\')}break}case"OKP":{switch(t.alg){case"Ed25519":case"EdDSA":e={name:"Ed25519"},r=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:t.crv},r=t.d?["deriveBits"]:[];break;default:throw new W(\'Invalid or unsupported JWK "alg" (Algorithm) Parameter value\')}break}default:throw new W(\'Invalid or unsupported JWK "kty" (Key Type) Parameter value\')}return{algorithm:e,keyUsages:r}}var Xt=async t=>{if(!t.alg)throw new TypeError(\'"alg" argument is required when "jwk.alg" is not present\');let{algorithm:e,keyUsages:r}=Cc(t),n={...t};return delete n.alg,delete n.use,crypto.subtle.importKey("jwk",n,e,t.ext??!t.d,t.key_ops??r)};async function ws(t,e,r){if(!te(t))throw new TypeError("JWK must be an object");let n;switch(e??(e=t.alg),n??(n=r?.extractable??t.ext),t.kty){case"oct":if(typeof t.k!="string"||!t.k)throw new TypeError(\'missing "k" (Key Value) Parameter value\');return Te(t.k);case"RSA":if("oth"in t&&t.oth!==void 0)throw new W(\'RSA JWK "oth" (Other Primes Info) Parameter value is not supported\');case"EC":case"OKP":return Xt({...t,alg:e,ext:n});default:throw new W(\'Unsupported "kty" (Key Type) Parameter value\')}}var Ss=(t,e,r,n,o)=>{if(o.crit!==void 0&&n?.crit===void 0)throw new t(\'"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 t(\'"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present\');let s;r!==void 0?s=new Map([...Object.entries(r),...e.entries()]):s=e;for(let i of n.crit){if(!s.has(i))throw new W(`Extension Header Parameter "${i}" is not recognized`);if(o[i]===void 0)throw new t(`Extension Header Parameter "${i}" is missing`);if(s.get(i)&&n[i]===void 0)throw new t(`Extension Header Parameter "${i}" MUST be integrity protected`)}return new Set(n.crit)};var Es=(t,e)=>{if(e!==void 0&&(!Array.isArray(e)||e.some(r=>typeof r!="string")))throw new TypeError(`"${t}" option must be an array of strings`);if(e)return new Set(e)};function _t(t){return te(t)&&typeof t.kty=="string"}function bs(t){return t.kty!=="oct"&&typeof t.d=="string"}function Ts(t){return t.kty!=="oct"&&typeof t.d>"u"}function Rs(t){return t.kty==="oct"&&typeof t.k=="string"}var Ze,_s=async(t,e,r,n=!1)=>{Ze||(Ze=new WeakMap);let o=Ze.get(t);if(o?.[r])return o[r];let s=await Xt({...e,alg:r});return n&&Object.freeze(t),o?o[r]=s:Ze.set(t,{[r]:s}),s},Uc=(t,e)=>{Ze||(Ze=new WeakMap);let r=Ze.get(t);if(r?.[e])return r[e];let n=t.type==="public",o=!!n,s;if(t.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")}s=t.toCryptoKey(t.asymmetricKeyType,o,n?[]:["deriveBits"])}if(t.asymmetricKeyType==="ed25519"){if(e!=="EdDSA"&&e!=="Ed25519")throw new TypeError("given KeyObject instance cannot be used for this algorithm");s=t.toCryptoKey(t.asymmetricKeyType,o,[n?"verify":"sign"])}if(t.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 t.toCryptoKey({name:"RSA-OAEP",hash:i},o,n?["encrypt"]:["decrypt"]);s=t.toCryptoKey({name:e.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:i},o,[n?"verify":"sign"])}if(t.asymmetricKeyType==="ec"){let a=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(t.asymmetricKeyDetails?.namedCurve);if(!a)throw new TypeError("given KeyObject instance cannot be used for this algorithm");e==="ES256"&&a==="P-256"&&(s=t.toCryptoKey({name:"ECDSA",namedCurve:a},o,[n?"verify":"sign"])),e==="ES384"&&a==="P-384"&&(s=t.toCryptoKey({name:"ECDSA",namedCurve:a},o,[n?"verify":"sign"])),e==="ES512"&&a==="P-521"&&(s=t.toCryptoKey({name:"ECDSA",namedCurve:a},o,[n?"verify":"sign"])),e.startsWith("ECDH-ES")&&(s=t.toCryptoKey({name:"ECDH",namedCurve:a},o,n?[]:["deriveBits"]))}if(!s)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return r?r[e]=s:Ze.set(t,{[e]:s}),s},Is=async(t,e)=>{if(t instanceof Uint8Array||an(t))return t;if(cn(t)){if(t.type==="secret")return t.export();if("toCryptoKey"in t&&typeof t.toCryptoKey=="function")try{return Uc(t,e)}catch(n){if(n instanceof TypeError)throw n}let r=t.export({format:"jwk"});return _s(t,r,e)}if(_t(t))return t.k?Te(t.k):_s(t,t,e,!0);throw new Error("unreachable")};var Qe=t=>t?.[Symbol.toStringTag],un=(t,e,r)=>{if(e.use!==void 0){let n;switch(r){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!==t)throw new TypeError(`Invalid key for this operation, its "alg" must be "${t}" when present`);if(Array.isArray(e.key_ops)){let n;switch(!0){case(r==="sign"||r==="verify"):case t==="dir":case t.includes("CBC-HS"):n=r;break;case t.startsWith("PBES2"):n="deriveBits";break;case/^A\\d{3}(?:GCM)?(?:KW)?$/.test(t):!t.includes("GCM")&&t.endsWith("KW")?n=r==="encrypt"?"wrapKey":"unwrapKey":n=r;break;case(r==="encrypt"&&t.startsWith("RSA")):n="wrapKey";break;case r==="decrypt":n=t.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},kc=(t,e,r)=>{if(!(e instanceof Uint8Array)){if(_t(e)){if(Rs(e)&&un(t,e,r))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(!ln(e))throw new TypeError(sn(t,e,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(e.type!=="secret")throw new TypeError(`${Qe(e)} instances for symmetric algorithms must be of type "secret"`)}},Nc=(t,e,r)=>{if(_t(e))switch(r){case"decrypt":case"sign":if(bs(e)&&un(t,e,r))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if(Ts(e)&&un(t,e,r))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!ln(e))throw new TypeError(sn(t,e,"CryptoKey","KeyObject","JSON Web Key"));if(e.type==="secret")throw new TypeError(`${Qe(e)} instances for asymmetric algorithms must not be of type "secret"`);if(e.type==="public")switch(r){case"sign":throw new TypeError(`${Qe(e)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw new TypeError(`${Qe(e)} instances for asymmetric algorithm decryption must be of type "private"`);default:break}if(e.type==="private")switch(r){case"verify":throw new TypeError(`${Qe(e)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw new TypeError(`${Qe(e)} instances for asymmetric algorithm encryption must be of type "public"`);default:break}},xs=(t,e,r)=>{t.startsWith("HS")||t==="dir"||t.startsWith("PBES2")||/^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(t)||/^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(t)?kc(t,e,r):Nc(t,e,r)};var As=(t,e)=>{let r=`SHA-${t.slice(-3)}`;switch(t){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:parseInt(t.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:e.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};default:throw new W(`alg ${t} is not supported either by JOSE or your javascript runtime`)}};var vs=async(t,e,r)=>{if(e instanceof Uint8Array){if(!t.startsWith("HS"))throw new TypeError(gs(e,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",e,{hash:`SHA-${t.slice(-3)}`,name:"HMAC"},!1,[r])}return ps(e,t,r),e};var Os=async(t,e,r,n)=>{let o=await vs(t,e,"verify");ys(t,o);let s=As(t,o.algorithm);try{return await crypto.subtle.verify(s,o,r,n)}catch{return!1}};async function Cs(t,e,r){if(!te(t))throw new N("Flattened JWS must be an object");if(t.protected===void 0&&t.header===void 0)throw new N(\'Flattened JWS must have either of the "protected" or "header" members\');if(t.protected!==void 0&&typeof t.protected!="string")throw new N("JWS Protected Header incorrect type");if(t.payload===void 0)throw new N("JWS Payload missing");if(typeof t.signature!="string")throw new N("JWS Signature missing or incorrect type");if(t.header!==void 0&&!te(t.header))throw new N("JWS Unprotected Header incorrect type");let n={};if(t.protected)try{let y=Te(t.protected);n=JSON.parse(he.decode(y))}catch{throw new N("JWS Protected Header is invalid")}if(!ms(n,t.header))throw new N("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let o={...n,...t.header},s=Ss(N,new Map([["b64",!0]]),r?.crit,n,o),i=!0;if(s.has("b64")&&(i=n.b64,typeof i!="boolean"))throw new N(\'The "b64" (base64url-encode payload) Header Parameter must be a boolean\');let{alg:a}=o;if(typeof a!="string"||!a)throw new N(\'JWS "alg" (Algorithm) Header Parameter missing or invalid\');let l=r&&Es("algorithms",r.algorithms);if(l&&!l.has(a))throw new St(\'"alg" (Algorithm) Header Parameter value not allowed\');if(i){if(typeof t.payload!="string")throw new N("JWS Payload must be a string")}else if(typeof t.payload!="string"&&!(t.payload instanceof Uint8Array))throw new N("JWS Payload must be a string or an Uint8Array instance");let c=!1;typeof e=="function"&&(e=await e(n,t),c=!0),xs(a,e,"verify");let f=ls(Ge.encode(t.protected??""),Ge.encode("."),typeof t.payload=="string"?Ge.encode(t.payload):t.payload),u;try{u=Te(t.signature)}catch{throw new N("Failed to base64url decode the signature")}let h=await Is(e,a);if(!await Os(a,h,u,f))throw new Tt;let p;if(i)try{p=Te(t.payload)}catch{throw new N("Failed to base64url decode the payload")}else typeof t.payload=="string"?p=Ge.encode(t.payload):p=t.payload;let w={payload:p};return t.protected!==void 0&&(w.protectedHeader=n),t.header!==void 0&&(w.unprotectedHeader=t.header),c?{...w,key:h}:w}async function Ps(t,e,r){if(t instanceof Uint8Array&&(t=he.decode(t)),typeof t!="string")throw new N("Compact JWS must be a string or Uint8Array");let{0:n,1:o,2:s,length:i}=t.split(".");if(i!==3)throw new N("Invalid Compact JWS");let a=await Cs({payload:o,protected:n,signature:s},e,r),l={payload:a.payload,protectedHeader:a.protectedHeader};return typeof e=="function"?{...l,key:a.key}:l}var Us=t=>Math.floor(t.getTime()/1e3);var Dc=/^(\\+|\\-)? ?(\\d+|\\d+\\.\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,fn=t=>{let e=Dc.exec(t);if(!e||e[4]&&e[1])throw new TypeError("Invalid time period format");let r=parseFloat(e[2]),n=e[3].toLowerCase(),o;switch(n){case"sec":case"secs":case"second":case"seconds":case"s":o=Math.round(r);break;case"minute":case"minutes":case"min":case"mins":case"m":o=Math.round(r*60);break;case"hour":case"hours":case"hr":case"hrs":case"h":o=Math.round(r*3600);break;case"day":case"days":case"d":o=Math.round(r*86400);break;case"week":case"weeks":case"w":o=Math.round(r*604800);break;default:o=Math.round(r*31557600);break}return e[1]==="-"||e[4]==="ago"?-o:o};var ks=t=>t.includes("/")?t.toLowerCase():`application/${t.toLowerCase()}`,Bc=(t,e)=>typeof t=="string"?e.includes(t):Array.isArray(t)?e.some(Set.prototype.has.bind(new Set(t))):!1;function Ns(t,e,r={}){let n;try{n=JSON.parse(he.decode(e))}catch{}if(!te(n))throw new Oe("JWT Claims Set must be a top-level JSON object");let{typ:o}=r;if(o&&(typeof t.typ!="string"||ks(t.typ)!==ks(o)))throw new V(\'unexpected "typ" JWT header value\',n,"typ","check_failed");let{requiredClaims:s=[],issuer:i,subject:a,audience:l,maxTokenAge:c}=r,f=[...s];c!==void 0&&f.push("iat"),l!==void 0&&f.push("aud"),a!==void 0&&f.push("sub"),i!==void 0&&f.push("iss");for(let p of new Set(f.reverse()))if(!(p in n))throw new V(`missing required "${p}" claim`,n,p,"missing");if(i&&!(Array.isArray(i)?i:[i]).includes(n.iss))throw new V(\'unexpected "iss" claim value\',n,"iss","check_failed");if(a&&n.sub!==a)throw new V(\'unexpected "sub" claim value\',n,"sub","check_failed");if(l&&!Bc(n.aud,typeof l=="string"?[l]:l))throw new V(\'unexpected "aud" claim value\',n,"aud","check_failed");let u;switch(typeof r.clockTolerance){case"string":u=fn(r.clockTolerance);break;case"number":u=r.clockTolerance;break;case"undefined":u=0;break;default:throw new TypeError("Invalid clockTolerance option type")}let{currentDate:h}=r,m=Us(h||new Date);if((n.iat!==void 0||c)&&typeof n.iat!="number")throw new V(\'"iat" claim must be a number\',n,"iat","invalid");if(n.nbf!==void 0){if(typeof n.nbf!="number")throw new V(\'"nbf" claim must be a number\',n,"nbf","invalid");if(n.nbf>m+u)throw new V(\'"nbf" claim timestamp check failed\',n,"nbf","check_failed")}if(n.exp!==void 0){if(typeof n.exp!="number")throw new V(\'"exp" claim must be a number\',n,"exp","invalid");if(n.exp<=m-u)throw new Xe(\'"exp" claim timestamp check failed\',n,"exp","check_failed")}if(c){let p=m-n.iat,w=typeof c=="number"?c:fn(c);if(p-u>w)throw new Xe(\'"iat" claim timestamp check failed (too far in the past)\',n,"iat","check_failed");if(p<0-u)throw new V(\'"iat" claim timestamp check failed (it should be in the past)\',n,"iat","check_failed")}return n}async function dn(t,e,r){let n=await Ps(t,e,r);if(n.protectedHeader.crit?.includes("b64")&&n.protectedHeader.b64===!1)throw new Oe("JWTs MUST NOT use unencoded payload");let s={payload:Ns(n.protectedHeader,n.payload,r),protectedHeader:n.protectedHeader};return typeof e=="function"?{...s,key:n.key}:s}function Mc(t){switch(typeof t=="string"&&t.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new W(\'Unsupported "alg" value for a JSON Web Key Set\')}}function Hc(t){return t&&typeof t=="object"&&Array.isArray(t.keys)&&t.keys.every(Fc)}function Fc(t){return te(t)}var et,It,pn=class{constructor(e){xt(this,et);xt(this,It,new WeakMap);if(!Hc(e))throw new Ye("JSON Web Key Set malformed");nr(this,et,structuredClone(e))}jwks(){return ke(this,et)}async getKey(e,r){let{alg:n,kid:o}={...e,...r?.header},s=Mc(n),i=ke(this,et).keys.filter(c=>{let f=s===c.kty;if(f&&typeof o=="string"&&(f=o===c.kid),f&&typeof c.alg=="string"&&(f=n===c.alg),f&&typeof c.use=="string"&&(f=c.use==="sig"),f&&Array.isArray(c.key_ops)&&(f=c.key_ops.includes("verify")),f)switch(n){case"ES256":f=c.crv==="P-256";break;case"ES384":f=c.crv==="P-384";break;case"ES512":f=c.crv==="P-521";break;case"Ed25519":case"EdDSA":f=c.crv==="Ed25519";break}return f}),{0:a,length:l}=i;if(l===0)throw new Et;if(l!==1){let c=new bt,f=ke(this,It);throw c[Symbol.asyncIterator]=async function*(){for(let u of i)try{yield await Ds(f,u,n)}catch{}},c}return Ds(ke(this,It),a,n)}};et=new WeakMap,It=new WeakMap;async function Ds(t,e,r){let n=t.get(e)||t.set(e,{}).get(e);if(n[r]===void 0){let o=await ws({...e,ext:!0},r);if(o instanceof Uint8Array||o.type!=="public")throw new Ye("JSON Web Key Set members must be public keys");n[r]=o}return n[r]}function hn(t){let e=new pn(t),r=async(n,o)=>e.getKey(n,o);return Object.defineProperties(r,{jwks:{value:()=>structuredClone(e.jwks()),enumerable:!1,configurable:!1,writable:!1}}),r}var Ks=rt(Fs(),1),Qt=class{base64URLEncode(e){return wn.default.encode(e).replace(/\\+/g,"-").replace(/\\//g,"_").replace(/=/g,"")}base64URLDecode(e){return wn.default.decode(e).toString()}hashSha256(e){return Ls.Buffer.from((0,$s.default)(new TextEncoder().encode(e)))}generateRandomBytes(e){return(0,Ks.default)(e)}verifyJwt(e,r,n,o,s,i,a,l){let c={algorithms:n,audience:o,clockTolerance:a,subject:i};return(l??!0)&&(c.issuer=s),dn(e,hn({keys:[r]}),c).then(()=>Promise.resolve(!0)).catch(f=>Promise.reject(new _("SPA-CRYPTO-UTILS-VJ-IV01",f?.reason??JSON.stringify(f),`${f?.code} ${f?.claim}`)))}};var Ws=async(t,e)=>{let r=new Jt,n=new Qt,o=new Ae;await o.initialize(t,r,n);let s=new Ut(o),i=e(o,s),a=o.getStorageManager(),l=B.getInstance(),c=async C=>{await i.attachTokenToRequestConfig(C)};return l?.init&&await l.init(!0,c),{disableHttpHandler:()=>{i.disableHttpHandler(l)},enableHttpHandler:()=>{i.enableHttpHandler(l)},getAccessToken:()=>i.getAccessToken(),getSignInUrl:async C=>o.getSignInUrl(C).then(async K=>{let Re=new URL(K).searchParams.get($.Params.STATE)??"",Ue=await o.getPKCECode(Re);return{authorizationURL:K,pkce:Ue}}).catch(K=>Promise.reject(K)),getUser:async()=>i.getUser(),getConfigData:async()=>a.getConfigData(),getCrypto:async()=>i.getCrypto(),getDecodedIDPIDToken:async()=>i.getDecodedIDPIDToken(),getDecodedIdToken:async C=>i.getDecodedIdToken(C),getIdToken:async()=>i.getIdToken(),getOpenIDProviderEndpoints:async()=>i.getOpenIDProviderEndpoints(),getSignOutUrl:async()=>await o.getSignOutUrl(),httpRequest:async C=>await i.httpRequest(l,C),httpRequestAll:async C=>await i.httpRequestAll(C,l),isSignedIn:()=>i.isSignedIn(),refreshAccessToken:async()=>{try{return await i.refreshAccessToken()}catch(C){return Promise.reject(C)}},requestAccessToken:async(C,K,ue,Re)=>await i.requestAccessToken(C,K,void 0,ue,Re),exchangeToken:async C=>await i.exchangeToken(C),revokeAccessToken:async()=>{let C=await s.getRefreshTimeoutTimer();return o.revokeAccessToken().then(()=>(s.clearRefreshTokenTimeout(C),Promise.resolve(!0))).catch(K=>Promise.reject(K))},setHttpRequestFinishCallback:C=>{l?.setHttpRequestFinishCallback&&l.setHttpRequestFinishCallback(C)},setHttpRequestStartCallback:C=>{l?.setHttpRequestStartCallback&&l.setHttpRequestStartCallback(C)},setHttpRequestSuccessCallback:C=>{l?.setHttpRequestSuccessCallback&&l.setHttpRequestSuccessCallback(C)},setSessionState:async C=>{await a.setSessionDataParameter($.Params.SESSION_STATE,C)},signOut:async()=>(s.clearRefreshTokenTimeout(),await o.getSignOutUrl()),startAutoRefreshToken:async()=>{s.clearRefreshTokenTimeout(),s.refreshAccessTokenAutomatically(i)},reInitialize:async C=>{await o.reInitialize(C)}}};var qs=t=>{let e=self,r;e.onmessage=async({data:i,ports:a})=>{let l=a[0];if(i.type!==wr&&!r){l.postMessage(b.generateFailureMessage(new _("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 wr:try{let c={...i.data};r=await Ws(c,t),r.setHttpRequestFinishCallback(s),r.setHttpRequestStartCallback(n),r.setHttpRequestSuccessCallback(o),l.postMessage(b.generateSuccessMessage())}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case lo:r.getSignInUrl(i?.data).then(c=>{l.postMessage(b.generateSuccessMessage(c))}).catch(c=>{l.postMessage(b.generateFailureMessage(c))});break;case uo:r.requestAccessToken(i?.data?.code,i?.data?.sessionState,i?.data?.pkce,i?.data?.state).then(c=>{l.postMessage(b.generateSuccessMessage(c))}).catch(c=>{l.postMessage(b.generateFailureMessage(c))});break;case Xn:{let c=i.data,f=c?.data;if(i.data?.data?.formData===!0){let u=new FormData;for(let h in f)h!=="formData"&&u.append(h,f[h]);c.data=u}r.httpRequest(c).then(u=>{l.postMessage(b.generateSuccessMessage(u))}).catch(u=>{l.postMessage(b.generateFailureMessage(u))});break}case Yn:r.httpRequestAll(i.data).then(c=>{l.postMessage(b.generateSuccessMessage(c))}).catch(c=>{l.postMessage(b.generateFailureMessage(c))});break;case Gn:try{l.postMessage(b.generateSuccessMessage(await r.signOut()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case Zn:r.exchangeToken(i.data).then(c=>{l.postMessage(b.generateSuccessMessage(c))}).catch(c=>{l.postMessage(b.generateFailureMessage(c))});break;case Qn:r.revokeAccessToken().then(c=>{l.postMessage(b.generateSuccessMessage(c))}).catch(c=>{l.postMessage(b.generateFailureMessage(c))});break;case no:try{l.postMessage(b.generateSuccessMessage(await r.getOpenIDProviderEndpoints()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case oo:try{l.postMessage(b.generateSuccessMessage(await r.getUser()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case so:try{l.postMessage(b.generateSuccessMessage(await r.getDecodedIdToken()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case io:try{l.postMessage(b.generateSuccessMessage(await r.getCrypto()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case So:try{l.postMessage(b.generateSuccessMessage(await r.getIdToken()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case ao:r.enableHttpHandler(),l.postMessage(b.generateSuccessMessage());break;case co:r.disableHttpHandler(),l.postMessage(b.generateSuccessMessage());break;case fo:try{l.postMessage(b.generateSuccessMessage(await r.isSignedIn()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case po:try{l.postMessage(b.generateSuccessMessage(await r.getSignOutUrl()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case ho:try{l.postMessage(b.generateSuccessMessage(await r.refreshAccessToken()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case yo:try{l.postMessage(b.generateSuccessMessage(r.startAutoRefreshToken()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case mo:try{l.postMessage(b.generateSuccessMessage(await r.setSessionState(i?.data)))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case wo:try{l.postMessage(b.generateSuccessMessage(await r.reInitialize(i?.data)))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case Eo:try{l.postMessage(b.generateSuccessMessage(await r.getConfigData()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;default:l?.postMessage(b.generateFailureMessage(new _("SPA-CLIENT_WORKER-ONMSG-IV02","The message type is invalid.",`The message type provided, ${i.type}, is invalid.`)))}};let n=()=>{e.postMessage({type:eo})},o=i=>{e.postMessage({data:JSON.stringify(i??""),type:to})},s=()=>{e.postMessage({type:ro})}};typeof self<"u"&&!self.Buffer&&(self.Buffer=js.Buffer);typeof self<"u"&&(self.global||(self.global=self));qs((t,e)=>new Pt(t,e));var em={};})();\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');
|
|
1933
|
+
return inlineWorker('(()=>{var Js=Object.create;var rt=Object.defineProperty;var Tn=Object.getOwnPropertyDescriptor;var Vs=Object.getOwnPropertyNames;var Gs=Object.getPrototypeOf,Xs=Object.prototype.hasOwnProperty;var Rn=r=>{throw TypeError(r)};var Ys=(r,e,t)=>e in r?rt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var fe=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Zs=(r,e)=>{for(var t in e)rt(r,t,{get:e[t],enumerable:!0})},Qs=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Vs(e))!Xs.call(r,o)&&o!==t&&rt(r,o,{get:()=>e[o],enumerable:!(n=Tn(e,o))||n.enumerable});return r};var nt=(r,e,t)=>(t=r!=null?Js(Gs(r)):{},Qs(e||!r||!r.__esModule?rt(t,"default",{value:r,enumerable:!0}):t,r));var In=(r,e,t,n)=>{for(var o=n>1?void 0:n?Tn(e,t):e,s=r.length-1,i;s>=0;s--)(i=r[s])&&(o=(n?i(e,t,o):i(o))||o);return n&&o&&rt(e,t,o),o};var S=(r,e,t)=>Ys(r,typeof e!="symbol"?e+"":e,t),xn=(r,e,t)=>e.has(r)||Rn("Cannot "+t);var ke=(r,e,t)=>(xn(r,e,"read from private field"),t?t.call(r):e.get(r)),_t=(r,e,t)=>e.has(r)?Rn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),sr=(r,e,t,n)=>(xn(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var vn=fe(vt=>{"use strict";vt.byteLength=ti;vt.toByteArray=ni;vt.fromByteArray=ii;var ne=[],X=[],ei=typeof Uint8Array<"u"?Uint8Array:Array,ir="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ie=0,An=ir.length;Ie<An;++Ie)ne[Ie]=ir[Ie],X[ir.charCodeAt(Ie)]=Ie;var Ie,An;X[45]=62;X[95]=63;function _n(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 ti(r){var e=_n(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 ni(r){var e,t=_n(r),n=t[0],o=t[1],s=new ei(ri(r,n,o)),i=0,a=o>0?n-4:n,l;for(l=0;l<a;l+=4)e=X[r.charCodeAt(l)]<<18|X[r.charCodeAt(l+1)]<<12|X[r.charCodeAt(l+2)]<<6|X[r.charCodeAt(l+3)],s[i++]=e>>16&255,s[i++]=e>>8&255,s[i++]=e&255;return o===2&&(e=X[r.charCodeAt(l)]<<2|X[r.charCodeAt(l+1)]>>4,s[i++]=e&255),o===1&&(e=X[r.charCodeAt(l)]<<10|X[r.charCodeAt(l+1)]<<4|X[r.charCodeAt(l+2)]>>2,s[i++]=e>>8&255,s[i++]=e&255),s}function oi(r){return ne[r>>18&63]+ne[r>>12&63]+ne[r>>6&63]+ne[r&63]}function si(r,e,t){for(var n,o=[],s=e;s<t;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),o.push(oi(n));return o.join("")}function ii(r){for(var e,t=r.length,n=t%3,o=[],s=16383,i=0,a=t-n;i<a;i+=s)o.push(si(r,i,i+s>a?a:i+s));return n===1?(e=r[t-1],o.push(ne[e>>2]+ne[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],o.push(ne[e>>10]+ne[e>>4&63]+ne[e<<2&63]+"=")),o.join("")}});var On=fe(ar=>{ar.read=function(r,e,t,n,o){var s,i,a=o*8-n-1,l=(1<<a)-1,c=l>>1,u=-7,f=t?o-1:0,h=t?-1:1,m=r[e+f];for(f+=h,s=m&(1<<-u)-1,m>>=-u,u+=a;u>0;s=s*256+r[e+f],f+=h,u-=8);for(i=s&(1<<-u)-1,s>>=-u,u+=n;u>0;i=i*256+r[e+f],f+=h,u-=8);if(s===0)s=1-c;else{if(s===l)return i?NaN:(m?-1:1)*(1/0);i=i+Math.pow(2,n),s=s-c}return(m?-1:1)*i*Math.pow(2,s-n)};ar.write=function(r,e,t,n,o,s){var i,a,l,c=s*8-o-1,u=(1<<c)-1,f=u>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,p=n?1:-1,w=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,i=u):(i=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+f>=1?e+=h/l:e+=h*Math.pow(2,1-f),e*l>=2&&(i++,l/=2),i+f>=u?(a=0,i=u):i+f>=1?(a=(e*l-1)*Math.pow(2,o),i=i+f):(a=e*Math.pow(2,f-1)*Math.pow(2,o),i=0));o>=8;r[t+m]=a&255,m+=p,a/=256,o-=8);for(i=i<<o|a,c+=o;c>0;r[t+m]=i&255,m+=p,i/=256,c-=8);r[t+m-p]|=w*128}});var Pt=fe(Me=>{"use strict";var cr=vn(),De=On(),Cn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Me.Buffer=g;Me.SlowBuffer=di;Me.INSPECT_MAX_BYTES=50;var Ot=2147483647;Me.kMaxLength=Ot;g.TYPED_ARRAY_SUPPORT=ai();!g.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 ai(){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(g.prototype,"parent",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.buffer}});Object.defineProperty(g.prototype,"offset",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.byteOffset}});function de(r){if(r>Ot)throw new RangeError(\'The value "\'+r+\'" is invalid for option "size"\');let e=new Uint8Array(r);return Object.setPrototypeOf(e,g.prototype),e}function g(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 dr(r)}return Nn(r,e,t)}g.poolSize=8192;function Nn(r,e,t){if(typeof r=="string")return li(r,e);if(ArrayBuffer.isView(r))return ui(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(oe(r,ArrayBuffer)||r&&oe(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(oe(r,SharedArrayBuffer)||r&&oe(r.buffer,SharedArrayBuffer)))return ur(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 g.from(n,e,t);let o=fi(r);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return g.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)}g.from=function(r,e,t){return Nn(r,e,t)};Object.setPrototypeOf(g.prototype,Uint8Array.prototype);Object.setPrototypeOf(g,Uint8Array);function Dn(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 ci(r,e,t){return Dn(r),r<=0?de(r):e!==void 0?typeof t=="string"?de(r).fill(e,t):de(r).fill(e):de(r)}g.alloc=function(r,e,t){return ci(r,e,t)};function dr(r){return Dn(r),de(r<0?0:pr(r)|0)}g.allocUnsafe=function(r){return dr(r)};g.allocUnsafeSlow=function(r){return dr(r)};function li(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!g.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=Bn(r,e)|0,n=de(t),o=n.write(r,e);return o!==t&&(n=n.slice(0,o)),n}function lr(r){let e=r.length<0?0:pr(r.length)|0,t=de(e);for(let n=0;n<e;n+=1)t[n]=r[n]&255;return t}function ui(r){if(oe(r,Uint8Array)){let e=new Uint8Array(r);return ur(e.buffer,e.byteOffset,e.byteLength)}return lr(r)}function ur(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,g.prototype),n}function fi(r){if(g.isBuffer(r)){let e=pr(r.length)|0,t=de(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||gr(r.length)?de(0):lr(r);if(r.type==="Buffer"&&Array.isArray(r.data))return lr(r.data)}function pr(r){if(r>=Ot)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ot.toString(16)+" bytes");return r|0}function di(r){return+r!=r&&(r=0),g.alloc(+r)}g.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==g.prototype};g.compare=function(e,t){if(oe(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),oe(t,Uint8Array)&&(t=g.from(t,t.offset,t.byteLength)),!g.isBuffer(e)||!g.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,o=t.length;for(let s=0,i=Math.min(n,o);s<i;++s)if(e[s]!==t[s]){n=e[s],o=t[s];break}return n<o?-1:o<n?1:0};g.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}};g.concat=function(e,t){if(!Array.isArray(e))throw new TypeError(\'"list" argument must be an Array of Buffers\');if(e.length===0)return g.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let o=g.allocUnsafe(t),s=0;for(n=0;n<e.length;++n){let i=e[n];if(oe(i,Uint8Array))s+i.length>o.length?(g.isBuffer(i)||(i=g.from(i)),i.copy(o,s)):Uint8Array.prototype.set.call(o,i,s);else if(g.isBuffer(i))i.copy(o,s);else throw new TypeError(\'"list" argument must be an Array of Buffers\');s+=i.length}return o};function Bn(r,e){if(g.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||oe(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 o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return fr(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return jn(r).length;default:if(o)return n?-1:fr(r).length;e=(""+e).toLowerCase(),o=!0}}g.byteLength=Bn;function pi(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 Ri(this,e,t);case"utf8":case"utf-8":return Hn(this,e,t);case"ascii":return bi(this,e,t);case"latin1":case"binary":return Ti(this,e,t);case"base64":return Si(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ii(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}g.prototype._isBuffer=!0;function xe(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}g.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)xe(this,t,t+1);return this};g.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)xe(this,t,t+3),xe(this,t+1,t+2);return this};g.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)xe(this,t,t+7),xe(this,t+1,t+6),xe(this,t+2,t+5),xe(this,t+3,t+4);return this};g.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Hn(this,0,e):pi.apply(this,arguments)};g.prototype.toLocaleString=g.prototype.toString;g.prototype.equals=function(e){if(!g.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:g.compare(this,e)===0};g.prototype.inspect=function(){let e="",t=Me.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};Cn&&(g.prototype[Cn]=g.prototype.inspect);g.prototype.compare=function(e,t,n,o,s){if(oe(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),!g.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),o===void 0&&(o=0),s===void 0&&(s=this.length),t<0||n>e.length||o<0||s>this.length)throw new RangeError("out of range index");if(o>=s&&t>=n)return 0;if(o>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,o>>>=0,s>>>=0,this===e)return 0;let i=s-o,a=n-t,l=Math.min(i,a),c=this.slice(o,s),u=e.slice(t,n);for(let f=0;f<l;++f)if(c[f]!==u[f]){i=c[f],a=u[f];break}return i<a?-1:a<i?1:0};function Mn(r,e,t,n,o){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,gr(t)&&(t=o?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(o)return-1;t=r.length-1}else if(t<0)if(o)t=0;else return-1;if(typeof e=="string"&&(e=g.from(e,n)),g.isBuffer(e))return e.length===0?-1:Pn(r,e,t,n,o);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Pn(r,[e],t,n,o);throw new TypeError("val must be string, number or Buffer")}function Pn(r,e,t,n,o){let s=1,i=r.length,a=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;s=2,i/=2,a/=2,t/=2}function l(u,f){return s===1?u[f]:u.readUInt16BE(f*s)}let c;if(o){let u=-1;for(c=t;c<i;c++)if(l(r,c)===l(e,u===-1?0:c-u)){if(u===-1&&(u=c),c-u+1===a)return u*s}else u!==-1&&(c-=c-u),u=-1}else for(t+a>i&&(t=i-a),c=t;c>=0;c--){let u=!0;for(let f=0;f<a;f++)if(l(r,c+f)!==l(e,f)){u=!1;break}if(u)return c}return-1}g.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};g.prototype.indexOf=function(e,t,n){return Mn(this,e,t,n,!0)};g.prototype.lastIndexOf=function(e,t,n){return Mn(this,e,t,n,!1)};function hi(r,e,t,n){t=Number(t)||0;let o=r.length-t;n?(n=Number(n),n>o&&(n=o)):n=o;let s=e.length;n>s/2&&(n=s/2);let i;for(i=0;i<n;++i){let a=parseInt(e.substr(i*2,2),16);if(gr(a))return i;r[t+i]=a}return i}function gi(r,e,t,n){return Ct(fr(e,r.length-t),r,t,n)}function mi(r,e,t,n){return Ct(vi(e),r,t,n)}function yi(r,e,t,n){return Ct(jn(e),r,t,n)}function wi(r,e,t,n){return Ct(Oi(e,r.length-t),r,t,n)}g.prototype.write=function(e,t,n,o){if(t===void 0)o="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")o=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let i=!1;for(;;)switch(o){case"hex":return hi(this,e,t,n);case"utf8":case"utf-8":return gi(this,e,t,n);case"ascii":case"latin1":case"binary":return mi(this,e,t,n);case"base64":return yi(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wi(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}};g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Si(r,e,t){return e===0&&t===r.length?cr.fromByteArray(r):cr.fromByteArray(r.slice(e,t))}function Hn(r,e,t){t=Math.min(r.length,t);let n=[],o=e;for(;o<t;){let s=r[o],i=null,a=s>239?4:s>223?3:s>191?2:1;if(o+a<=t){let l,c,u,f;switch(a){case 1:s<128&&(i=s);break;case 2:l=r[o+1],(l&192)===128&&(f=(s&31)<<6|l&63,f>127&&(i=f));break;case 3:l=r[o+1],c=r[o+2],(l&192)===128&&(c&192)===128&&(f=(s&15)<<12|(l&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(i=f));break;case 4:l=r[o+1],c=r[o+2],u=r[o+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(f=(s&15)<<18|(l&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(i=f))}}i===null?(i=65533,a=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),o+=a}return Ei(n)}var Un=4096;function Ei(r){let e=r.length;if(e<=Un)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=Un));return t}function bi(r,e,t){let n="";t=Math.min(r.length,t);for(let o=e;o<t;++o)n+=String.fromCharCode(r[o]&127);return n}function Ti(r,e,t){let n="";t=Math.min(r.length,t);for(let o=e;o<t;++o)n+=String.fromCharCode(r[o]);return n}function Ri(r,e,t){let n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);let o="";for(let s=e;s<t;++s)o+=Ci[r[s]];return o}function Ii(r,e,t){let n=r.slice(e,t),o="";for(let s=0;s<n.length-1;s+=2)o+=String.fromCharCode(n[s]+n[s+1]*256);return o}g.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 o=this.subarray(e,t);return Object.setPrototypeOf(o,g.prototype),o};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")}g.prototype.readUintLE=g.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||F(e,t,this.length);let o=this[e],s=1,i=0;for(;++i<t&&(s*=256);)o+=this[e+i]*s;return o};g.prototype.readUintBE=g.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||F(e,t,this.length);let o=this[e+--t],s=1;for(;t>0&&(s*=256);)o+=this[e+--t]*s;return o};g.prototype.readUint8=g.prototype.readUInt8=function(e,t){return e=e>>>0,t||F(e,1,this.length),this[e]};g.prototype.readUint16LE=g.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||F(e,2,this.length),this[e]|this[e+1]<<8};g.prototype.readUint16BE=g.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||F(e,2,this.length),this[e]<<8|this[e+1]};g.prototype.readUint32LE=g.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};g.prototype.readUint32BE=g.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])};g.prototype.readBigUInt64LE=ye(function(e){e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ot(e,this.length-8);let o=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(o)+(BigInt(s)<<BigInt(32))});g.prototype.readBigUInt64BE=ye(function(e){e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ot(e,this.length-8);let o=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(o)<<BigInt(32))+BigInt(s)});g.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||F(e,t,this.length);let o=this[e],s=1,i=0;for(;++i<t&&(s*=256);)o+=this[e+i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};g.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||F(e,t,this.length);let o=t,s=1,i=this[e+--o];for(;o>0&&(s*=256);)i+=this[e+--o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i};g.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]};g.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};g.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};g.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};g.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]};g.prototype.readBigInt64LE=ye(function(e){e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ot(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(o)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});g.prototype.readBigInt64BE=ye(function(e){e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ot(e,this.length-8);let o=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});g.prototype.readFloatLE=function(e,t){return e=e>>>0,t||F(e,4,this.length),De.read(this,e,!0,23,4)};g.prototype.readFloatBE=function(e,t){return e=e>>>0,t||F(e,4,this.length),De.read(this,e,!1,23,4)};g.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||F(e,8,this.length),De.read(this,e,!0,52,8)};g.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||F(e,8,this.length),De.read(this,e,!1,52,8)};function z(r,e,t,n,o,s){if(!g.isBuffer(r))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(e>o||e<s)throw new RangeError(\'"value" argument is out of bounds\');if(t+n>r.length)throw new RangeError("Index out of range")}g.prototype.writeUintLE=g.prototype.writeUIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let a=Math.pow(2,8*n)-1;z(this,e,t,n,a,0)}let s=1,i=0;for(this[t]=e&255;++i<n&&(s*=256);)this[t+i]=e/s&255;return t+n};g.prototype.writeUintBE=g.prototype.writeUIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let a=Math.pow(2,8*n)-1;z(this,e,t,n,a,0)}let s=n-1,i=1;for(this[t+s]=e&255;--s>=0&&(i*=256);)this[t+s]=e/i&255;return t+n};g.prototype.writeUint8=g.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,1,255,0),this[t]=e&255,t+1};g.prototype.writeUint16LE=g.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};g.prototype.writeUint16BE=g.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};g.prototype.writeUint32LE=g.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||z(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};g.prototype.writeUint32BE=g.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||z(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,o){qn(e,n,o,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s;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 Ln(r,e,t,n,o){qn(e,n,o,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>>8,r[t+5]=s,s=s>>8,r[t+4]=s;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}g.prototype.writeBigUInt64LE=ye(function(e,t=0){return Fn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});g.prototype.writeBigUInt64BE=ye(function(e,t=0){return Ln(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});g.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let l=Math.pow(2,8*n-1);z(this,e,t,n,l-1,-l)}let s=0,i=1,a=0;for(this[t]=e&255;++s<n&&(i*=256);)e<0&&a===0&&this[t+s-1]!==0&&(a=1),this[t+s]=(e/i>>0)-a&255;return t+n};g.prototype.writeIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let l=Math.pow(2,8*n-1);z(this,e,t,n,l-1,-l)}let s=n-1,i=1,a=0;for(this[t+s]=e&255;--s>=0&&(i*=256);)e<0&&a===0&&this[t+s+1]!==0&&(a=1),this[t+s]=(e/i>>0)-a&255;return t+n};g.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};g.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};g.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};g.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||z(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};g.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||z(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};g.prototype.writeBigInt64LE=ye(function(e,t=0){return Fn(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});g.prototype.writeBigInt64BE=ye(function(e,t=0){return Ln(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $n(r,e,t,n,o,s){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Kn(r,e,t,n,o){return e=+e,t=t>>>0,o||$n(r,e,t,4,34028234663852886e22,-34028234663852886e22),De.write(r,e,t,n,23,4),t+4}g.prototype.writeFloatLE=function(e,t,n){return Kn(this,e,t,!0,n)};g.prototype.writeFloatBE=function(e,t,n){return Kn(this,e,t,!1,n)};function Wn(r,e,t,n,o){return e=+e,t=t>>>0,o||$n(r,e,t,8,17976931348623157e292,-17976931348623157e292),De.write(r,e,t,n,52,8),t+8}g.prototype.writeDoubleLE=function(e,t,n){return Wn(this,e,t,!0,n)};g.prototype.writeDoubleBE=function(e,t,n){return Wn(this,e,t,!1,n)};g.prototype.copy=function(e,t,n,o){if(!g.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<n&&(o=n),o===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(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);let s=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),t),s};g.prototype.fill=function(e,t,n,o){if(typeof e=="string"){if(typeof t=="string"?(o=t,t=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!g.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let i=e.charCodeAt(0);(o==="utf8"&&i<128||o==="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 s;if(typeof e=="number")for(s=t;s<n;++s)this[s]=e;else{let i=g.isBuffer(e)?e:g.from(e,o),a=i.length;if(a===0)throw new TypeError(\'The value "\'+e+\'" is invalid for argument "value"\');for(s=0;s<n-t;++s)this[s+t]=i[s%a]}return this};var Ne={};function hr(r,e,t){Ne[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(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}hr("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);hr("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);hr("ERR_OUT_OF_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range.`,o=t;return Number.isInteger(t)&&Math.abs(t)>2**32?o=kn(String(t)):typeof t=="bigint"&&(o=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(o=kn(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function kn(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 xi(r,e,t){Be(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&ot(e,r.length-(t+1))}function qn(r,e,t,n,o,s){if(r>t||r<e){let i=typeof e=="bigint"?"n":"",a;throw s>3?e===0||e===BigInt(0)?a=`>= 0${i} and < 2${i} ** ${(s+1)*8}${i}`:a=`>= -(2${i} ** ${(s+1)*8-1}${i}) and < 2 ** ${(s+1)*8-1}${i}`:a=`>= ${e}${i} and <= ${t}${i}`,new Ne.ERR_OUT_OF_RANGE("value",a,r)}xi(n,o,s)}function Be(r,e){if(typeof r!="number")throw new Ne.ERR_INVALID_ARG_TYPE(e,"number",r)}function ot(r,e,t){throw Math.floor(r)!==r?(Be(r,t),new Ne.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new Ne.ERR_BUFFER_OUT_OF_BOUNDS:new Ne.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var Ai=/[^+/0-9A-Za-z-_]/g;function _i(r){if(r=r.split("=")[0],r=r.trim().replace(Ai,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function fr(r,e){e=e||1/0;let t,n=r.length,o=null,s=[];for(let i=0;i<n;++i){if(t=r.charCodeAt(i),t>55295&&t<57344){if(!o){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(i+1===n){(e-=3)>-1&&s.push(239,191,189);continue}o=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),o=t;continue}t=(o-55296<<10|t-56320)+65536}else o&&(e-=3)>-1&&s.push(239,191,189);if(o=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function vi(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function Oi(r,e){let t,n,o,s=[];for(let i=0;i<r.length&&!((e-=2)<0);++i)t=r.charCodeAt(i),n=t>>8,o=t%256,s.push(o),s.push(n);return s}function jn(r){return cr.toByteArray(_i(r))}function Ct(r,e,t,n){let o;for(o=0;o<n&&!(o+t>=e.length||o>=r.length);++o)e[o+t]=r[o];return o}function oe(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function gr(r){return r!==r}var Ci=(function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let o=0;o<16;++o)e[n+o]=r[t]+r[o]}return e})();function ye(r){return typeof BigInt>"u"?Pi:r}function Pi(){throw new Error("BigInt not supported")}});var os=fe(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});function Tc(r){var e=4,t=r.length,n=t%e;if(!n)return r;var o=t,s=e-n,i=t+s,a=Buffer.alloc(i);for(a.write(r);s--;)a.write("=",o++);return a.toString()}rn.default=Tc});var is=fe(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});var Rc=os();function ss(r,e){return e===void 0&&(e="utf8"),Buffer.isBuffer(r)?nn(r.toString("base64")):nn(Buffer.from(r,e).toString("base64"))}function Ic(r,e){return e===void 0&&(e="utf8"),Buffer.from(on(r),"base64").toString(e)}function on(r){return r=r.toString(),Rc.default(r).replace(/\\-/g,"+").replace(/_/g,"/")}function nn(r){return r.replace(/=/g,"").replace(/\\+/g,"-").replace(/\\//g,"_")}function xc(r){return Buffer.from(on(r),"base64")}var Ge=ss;Ge.encode=ss;Ge.decode=Ic;Ge.toBase64=on;Ge.fromBase64=nn;Ge.toBuffer=xc;sn.default=Ge});var as=fe((Vp,Xt)=>{Xt.exports=is().default;Xt.exports.default=Xt.exports});var ls=fe((cs,Yt)=>{(function(r,e){var t={};e(t);var n=t.default;for(var o in t)n[o]=t[o];typeof Yt=="object"&&typeof Yt.exports=="object"?Yt.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):r.sha256=n})(cs,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(f,h,m,p,w){for(var y,E,T,A,_,x,M,v,U,C,ae,ce,re;w>=64;){for(y=h[0],E=h[1],T=h[2],A=h[3],_=h[4],x=h[5],M=h[6],v=h[7],C=0;C<16;C++)ae=p+C*4,f[C]=(m[ae]&255)<<24|(m[ae+1]&255)<<16|(m[ae+2]&255)<<8|m[ae+3]&255;for(C=16;C<64;C++)U=f[C-2],ce=(U>>>17|U<<15)^(U>>>19|U<<13)^U>>>10,U=f[C-15],re=(U>>>7|U<<25)^(U>>>18|U<<14)^U>>>3,f[C]=(ce+f[C-7]|0)+(re+f[C-16]|0);for(C=0;C<64;C++)ce=(((_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&x^~_&M)|0)+(v+(e[C]+f[C]|0)|0)|0,re=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&E^y&T^E&T)|0,v=M,M=x,x=_,_=A+ce|0,A=T,T=E,E=y,y=ce+re|0;h[0]+=y,h[1]+=E,h[2]+=T,h[3]+=A,h[4]+=_,h[5]+=x,h[6]+=M,h[7]+=v,p+=64,w-=64}return p}var n=(function(){function f(){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 f.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},f.prototype.clean=function(){for(var h=0;h<this.buffer.length;h++)this.buffer[h]=0;for(var h=0;h<this.temp.length;h++)this.temp[h]=0;this.reset()},f.prototype.update=function(h,m){if(m===void 0&&(m=h.length),this.finished)throw new Error("SHA256: can\'t update because hash was finished.");var p=0;if(this.bytesHashed+=m,this.bufferLength>0){for(;this.bufferLength<64&&m>0;)this.buffer[this.bufferLength++]=h[p++],m--;this.bufferLength===64&&(t(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(m>=64&&(p=t(this.temp,this.state,h,p,m),m%=64);m>0;)this.buffer[this.bufferLength++]=h[p++],m--;return this},f.prototype.finish=function(h){if(!this.finished){var m=this.bytesHashed,p=this.bufferLength,w=m/536870912|0,y=m<<3,E=m%64<56?64:128;this.buffer[p]=128;for(var T=p+1;T<E-8;T++)this.buffer[T]=0;this.buffer[E-8]=w>>>24&255,this.buffer[E-7]=w>>>16&255,this.buffer[E-6]=w>>>8&255,this.buffer[E-5]=w>>>0&255,this.buffer[E-4]=y>>>24&255,this.buffer[E-3]=y>>>16&255,this.buffer[E-2]=y>>>8&255,this.buffer[E-1]=y>>>0&255,t(this.temp,this.state,this.buffer,0,E),this.finished=!0}for(var T=0;T<8;T++)h[T*4+0]=this.state[T]>>>24&255,h[T*4+1]=this.state[T]>>>16&255,h[T*4+2]=this.state[T]>>>8&255,h[T*4+3]=this.state[T]>>>0&255;return this},f.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},f.prototype._saveState=function(h){for(var m=0;m<this.state.length;m++)h[m]=this.state[m]},f.prototype._restoreState=function(h,m){for(var p=0;p<this.state.length;p++)this.state[p]=h[p];this.bytesHashed=m,this.finished=!1,this.bufferLength=0},f})();r.Hash=n;var o=(function(){function f(h){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var m=new Uint8Array(this.blockSize);if(h.length>this.blockSize)new n().update(h).finish(m).clean();else for(var p=0;p<h.length;p++)m[p]=h[p];for(var p=0;p<m.length;p++)m[p]^=54;this.inner.update(m);for(var p=0;p<m.length;p++)m[p]^=106;this.outer.update(m),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var p=0;p<m.length;p++)m[p]=0}return f.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},f.prototype.clean=function(){for(var h=0;h<this.istate.length;h++)this.ostate[h]=this.istate[h]=0;this.inner.clean(),this.outer.clean()},f.prototype.update=function(h){return this.inner.update(h),this},f.prototype.finish=function(h){return this.outer.finished?this.outer.finish(h):(this.inner.finish(h),this.outer.update(h,this.digestLength).finish(h)),this},f.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},f})();r.HMAC=o;function s(f){var h=new n().update(f),m=h.digest();return h.clean(),m}r.hash=s,r.default=s;function i(f,h){var m=new o(f).update(h),p=m.digest();return m.clean(),p}r.hmac=i;function a(f,h,m,p){var w=p[0];if(w===0)throw new Error("hkdf: cannot expand more");h.reset(),w>1&&h.update(f),m&&h.update(m),h.update(p),h.finish(f),p[0]++}var l=new Uint8Array(r.digestLength);function c(f,h,m,p){h===void 0&&(h=l),p===void 0&&(p=32);for(var w=new Uint8Array([1]),y=i(h,f),E=new o(y),T=new Uint8Array(E.digestLength),A=T.length,_=new Uint8Array(p),x=0;x<p;x++)A===T.length&&(a(T,E,m,w),A=0),_[x]=T[A++];return E.clean(),T.fill(0),w.fill(0),_}r.hkdf=c;function u(f,h,m,p){for(var w=new o(f),y=w.digestLength,E=new Uint8Array(4),T=new Uint8Array(y),A=new Uint8Array(y),_=new Uint8Array(p),x=0;x*y<p;x++){var M=x+1;E[0]=M>>>24&255,E[1]=M>>>16&255,E[2]=M>>>8&255,E[3]=M>>>0&255,w.reset(),w.update(h),w.update(E),w.finish(A);for(var v=0;v<y;v++)T[v]=A[v];for(var v=2;v<=m;v++){w.reset(),w.update(A).finish(A);for(var U=0;U<y;U++)T[U]^=A[U]}for(var v=0;v<y&&x*y+v<p;v++)_[x*y+v]=T[v]}for(var x=0;x<y;x++)T[x]=A[x]=0;for(var x=0;x<4;x++)E[x]=0;return w.clean(),_}r.pbkdf2=u})});var Fs=fe((yn,Hs)=>{var Qt=Pt(),ie=Qt.Buffer;function Ms(r,e){for(var t in r)e[t]=r[t]}ie.from&&ie.alloc&&ie.allocUnsafe&&ie.allocUnsafeSlow?Hs.exports=Qt:(Ms(Qt,yn),yn.Buffer=Ce);function Ce(r,e,t){return ie(r,e,t)}Ce.prototype=Object.create(ie.prototype);Ms(ie,Ce);Ce.from=function(r,e,t){if(typeof r=="number")throw new TypeError("Argument must not be a number");return ie(r,e,t)};Ce.alloc=function(r,e,t){if(typeof r!="number")throw new TypeError("Argument must be a number");var n=ie(r);return e!==void 0?typeof t=="string"?n.fill(e,t):n.fill(e):n.fill(0),n};Ce.allocUnsafe=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return ie(r)};Ce.allocUnsafeSlow=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return Qt.SlowBuffer(r)}});var Ls=fe((Eg,Sn)=>{"use strict";var wn=65536,$c=4294967295;function Kc(){throw new Error(`Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11`)}var Wc=Fs().Buffer,er=self.crypto||self.msCrypto;er&&er.getRandomValues?Sn.exports=qc:Sn.exports=Kc;function qc(r,e){if(r>$c)throw new RangeError("requested too many random bytes");var t=Wc.allocUnsafe(r);if(r>0)if(r>wn)for(var n=0;n<r;n+=wn)er.getRandomValues(t.slice(n,n+wn));else er.getRandomValues(t);return typeof e=="function"?process.nextTick(function(){e(null,t)}):t}});var zs=nt(Pt(),1);var Ui=Object.defineProperty,ki=(r,e,t)=>e in r?Ui(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,N=(r,e,t)=>ki(r,typeof e!="symbol"?e+"":e,t),Ni={Endpoints:{AUTHORIZATION:"/oauth2/authorize",END_SESSION:"/oidc/logout",ISSUER:"/oauth2/token",JWKS:"/oauth2/jwks",REVOCATION:"/oauth2/revoke",SESSION_IFRAME:"/oidc/checksession",TOKEN:"/oauth2/token",USERINFO:"/oauth2/userinfo"},Storage:{StorageKeys:{Endpoints:{AUTHORIZATION:"authorization_endpoint",END_SESSION:"end_session_endpoint",ISSUER:"issuer",JWKS:"jwks_uri",REVOCATION:"revocation_endpoint",SESSION_IFRAME:"check_session_iframe",TOKEN:"token_endpoint",USERINFO:"userinfo_endpoint"},OPENID_PROVIDER_CONFIG_INITIATED:"op_config_initiated"}}},L=Ni,Di={Placeholders:{ACCESS_TOKEN:"{{accessToken}}",CLIENT_ID:"{{clientId}}",CLIENT_SECRET:"{{clientSecret}}",SCOPES:"{{scopes}}",USERNAME:"{{username}}"}},st=Di,I=class{constructor(r,e,t){N(this,"name"),N(this,"code"),N(this,"message"),this.message=t,this.name=e,this.code=r,Object.setPrototypeOf(this,new.target.prototype)}};var Bi=r=>{let e={...r};return["iss","aud","exp","iat","acr","amr","azp","auth_time","nonce","c_hash","at_hash","nbf","isk","sid","jti","sub"].forEach(n=>{delete e[n]}),e},Mi=Bi,Hi={INTERNAL_LOGIN:"internal_login",OPENID:"openid",PROFILE:"profile"},mr=Hi,Fi={Params:{AUTHORIZATION_CODE:"code",SESSION_STATE:"session_state",SIGN_OUT_SUCCESS:"sign_out_success",STATE:"state"},SignIn:{Payload:{DEFAULT_SCOPES:[mr.OPENID,mr.PROFILE,mr.INTERNAL_LOGIN]}},SignOut:{Storage:{StorageKeys:{SIGN_OUT_URL:"sign_out_url"}}}},$=Fi,Li=class Vn extends Error{constructor(e,t,n){let o=Vn.resolveOrigin(n);super(e),N(this,"code"),N(this,"origin"),this.name=new.target.name,this.code=t,this.origin=o,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}")`}},Gn=class extends Li{constructor(r,e,t,n){super(r,e,t),this.details=n,Object.defineProperty(this,"name",{configurable:!0,value:"AsgardeoRuntimeError",writable:!0})}toString(){let r=this.details?`\nDetails: ${JSON.stringify(this.details,null,2)}`:"";return`[${this.name}] (code="${this.code}")${r}\nMessage: ${this.message}`}},$i=r=>{let e=[];if(r)if(Array.isArray(r))e=r;else if(typeof r=="string")e=r.split(" ");else throw new Gn("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 $.SignIn.Payload.DEFAULT_SCOPES.forEach(t=>{e.includes(t)||e.push(t)}),e.join(" ")},wr=$i,Ki=class{constructor(r,e){N(this,"storageManager"),N(this,"config"),N(this,"oidcProviderMetaData"),N(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 o=n.replace(/[A-Z]/g,s=>`_${s.toLowerCase()}`);e[o]=t?.endpoints?t.endpoints[n]:""}),{...r,...e}}async resolveEndpointsExplicitly(){let r={},e=await this.config(),t=[L.Storage.StorageKeys.Endpoints.AUTHORIZATION,L.Storage.StorageKeys.Endpoints.END_SESSION,L.Storage.StorageKeys.Endpoints.JWKS,L.Storage.StorageKeys.Endpoints.SESSION_IFRAME,L.Storage.StorageKeys.Endpoints.REVOCATION,L.Storage.StorageKeys.Endpoints.TOKEN,L.Storage.StorageKeys.Endpoints.ISSUER,L.Storage.StorageKeys.Endpoints.USERINFO];if(!(e.endpoints?t.every(o=>e.endpoints?Object.keys(e.endpoints).some(s=>s.replace(/[A-Z]/g,a=>`_${a.toLowerCase()}`)===o):!1):!1))throw new I("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(o=>{let s=o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`);r[s]=e?.endpoints?e.endpoints[o]:""}),{...r}}async resolveEndpointsByBaseURL(){let r={},e=await this.config(),{baseUrl:t}=e;if(!t)throw new I("JS-AUTH_HELPER_REBO-NF01","Base URL not defined.","Base URL is not defined in AuthClient config.");e.endpoints&&Object.keys(e.endpoints).forEach(i=>{let a=i.replace(/[A-Z]/g,l=>`_${l.toLowerCase()}`);r[a]=e?.endpoints?e.endpoints[i]:""});let n=L.Storage.StorageKeys.Endpoints,o=L.Endpoints,s={[n.AUTHORIZATION]:`${t}${o.AUTHORIZATION}`,[n.END_SESSION]:`${t}${o.END_SESSION}`,[n.ISSUER]:`${t}${o.ISSUER}`,[n.JWKS]:`${t}${o.JWKS}`,[n.SESSION_IFRAME]:`${t}${o.SESSION_IFRAME}`,[n.REVOCATION]:`${t}${o.REVOCATION}`,[n.TOKEN]:`${t}${o.TOKEN}`,[n.USERINFO]:`${t}${o.USERINFO}`};return e.platform==="AsgardeoV2"&&(s[L.Storage.StorageKeys.Endpoints.ISSUER]=`${t}`),{...s,...r}}async validateIdToken(r){let e=(await this.storageManager.loadOpenIDProviderConfiguration()).jwks_uri,t=await this.config();if(!e||e.trim().length===0)throw new I("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(a){throw new I("JS-AUTH_HELPER-VIT-NE02","Request to jwks endpoint failed.",a??"The request sent to get the jwks from the server failed.")}if(n.status!==200||!n.ok)throw new I("JS-AUTH_HELPER-VIT-HE03",`Invalid response status received for jwks request (${n.statusText}).`,await n.json());let{issuer:o}=await this.oidcProviderMetaData(),{keys:s}=await n.json(),i=await this.cryptoHelper.getJWKForTheIdToken(r.split(".")[0],s);return this.cryptoHelper.isValidIdToken(r,i,(await this.config()).clientId,o??"",this.cryptoHelper.decodeJwtToken(r).sub,(await this.config()).tokenValidation?.idToken?.clockTolerance,(await this.config()).tokenValidation?.idToken?.validateIssuer??!0)}getAuthenticatedUserInfo(r){let e=this.cryptoHelper.decodeJwtToken(r),t=e?.username??"",n=e?.given_name??"",o=e?.family_name??"",s=n&&o?`${n} ${o}`:n||o||"";return{displayName:e.preferred_username??s,username:t,...Mi(e)}}async replaceCustomGrantTemplateTags(r,e){let t=await this.config(),n=await this.storageManager.getSessionData(e),o=wr(t.scopes);return typeof r!="string"?r:r.replace(st.Placeholders.ACCESS_TOKEN,n.access_token).replace(st.Placeholders.USERNAME,this.getAuthenticatedUserInfo(n.id_token).username).replace(st.Placeholders.SCOPES,o).replace(st.Placeholders.CLIENT_ID,t.clientId).replace(st.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 I("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 s={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(s)});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 await this.storageManager.setSessionData(t,e),Promise.resolve(o)}},Wi={DEFAULT_CODE_CHALLENGE_METHOD:"S256",Storage:{StorageKeys:{CODE_VERIFIER:"pkce_code_verifier",SEPARATOR:"#"}}},we=Wi,qi={SignatureValidation:{SUPPORTED_ALGORITHMS:["RS256","RS512","RS384","PS256"]},Storage:{StorageKeys:{REFRESH_TOKEN_TIMER:"refresh_token_timer"}}},it=qi,ji=class{constructor(r){N(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)),n=e.find(o=>t.kid===o.kid);if(n)return n;throw new I("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(o=>o.kid).join(", ")}`)}isValidIdToken(r,e,t,n,o,s,i){return this.cryptoUtils.verifyJwt(r,e,it.SignatureValidation.SUPPORTED_ALGORITHMS,t,n,o,s,i).then(a=>a?Promise.resolve(!0):Promise.reject(new I("JS-CRYPTO_HELPER-IVIT-IV01","Invalid ID token.","ID token validation returned false"))).catch(a=>Promise.reject(a))}decodeJwtToken(r){try{let e=this.cryptoUtils.base64URLDecode(r?.split(".")[1]);return JSON.parse(e)}catch(e){throw new I("JS-CRYPTO_UTIL-DIT-IV02","Decoding token failed.",e)}}},yr="asgardeo-session-active",zi=class Ut{constructor(e,t){N(this,"id"),N(this,"store"),this.id=e,this.store=t}async setDataInBulk(e,t){let n=await this.store.getData(e)??null,s={...n&&JSON.parse(n),...t},i=JSON.stringify(s);await this.store.setData(e,i)}async setValue(e,t,n){let o=await this.store.getData(e)??null,i={...o&&JSON.parse(o),[t]:n},a=JSON.stringify(i);await this.store.setData(e,a)}async removeValue(e,t){let n=await this.store.getData(e)??null,s={...n&&JSON.parse(n)};delete s[t];let i=JSON.stringify(s);await this.store.setData(e,i)}resolveKey(e,t){return t?`${e}-${this.id}-${t}`:`${e}-${this.id}`}static isLocalStorageAvailable(){try{let e="__ASGARDEO_AUTH_CORE_LOCAL_STORAGE_TEST__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch{return!1}}async setConfigData(e){await this.setDataInBulk(this.resolveKey("config_data"),e)}async setOIDCProviderMetaData(e){this.setDataInBulk(this.resolveKey("oidc_provider_meta_data"),e)}async setTemporaryData(e,t){this.setDataInBulk(this.resolveKey("temporary_data",t),e)}async setSessionData(e,t){this.setDataInBulk(this.resolveKey("session_data",t),e)}async setCustomData(e,t,n){this.setDataInBulk(this.resolveKey(e,n),t)}async getConfigData(e){return JSON.parse(await this.store.getData(this.resolveKey("config_data",e))??null)}async loadOpenIDProviderConfiguration(){return JSON.parse(await this.store.getData(this.resolveKey("oidc_provider_meta_data"))??null)}async getTemporaryData(e){return JSON.parse(await this.store.getData(this.resolveKey("temporary_data",e))??null)}async getSessionData(e){return JSON.parse(await this.store.getData(this.resolveKey("session_data",e))??null)}async getCustomData(e,t){return JSON.parse(await this.store.getData(this.resolveKey(e,t))??null)}setSessionStatus(e){Ut.isLocalStorageAvailable()&&localStorage.setItem(`${yr}`,e)}getSessionStatus(){return Ut.isLocalStorageAvailable()?localStorage.getItem(`${yr}`)??"":""}removeSessionStatus(){Ut.isLocalStorageAvailable()&&localStorage.removeItem(`${yr}`)}async removeConfigData(){await this.store.removeData(this.resolveKey("config_data"))}async removeOIDCProviderMetaData(){await this.store.removeData(this.resolveKey("oidc_provider_meta_data"))}async removeTemporaryData(e){await this.store.removeData(this.resolveKey("temporary_data",e))}async removeSessionData(e){await this.store.removeData(this.resolveKey("session_data",e))}async getConfigDataParameter(e){let t=await this.store.getData(this.resolveKey("config_data"));return t&&JSON.parse(t)[e]}async getOIDCProviderMetaDataParameter(e){let t=await this.store.getData(this.resolveKey("oidc_provider_meta_data"));return t&&JSON.parse(t)[e]}async getTemporaryDataParameter(e,t){let n=await this.store.getData(this.resolveKey("temporary_data",t));return n&&JSON.parse(n)[e]}async getSessionDataParameter(e,t){let n=await this.store.getData(this.resolveKey("session_data",t));return n&&JSON.parse(n)[e]}async setConfigDataParameter(e,t){await this.setValue(this.resolveKey("config_data"),e,t)}async setOIDCProviderMetaDataParameter(e,t){await this.setValue(this.resolveKey("oidc_provider_meta_data"),e,t)}async setTemporaryDataParameter(e,t,n){await this.setValue(this.resolveKey("temporary_data",n),e,t)}async setSessionDataParameter(e,t,n){await this.setValue(this.resolveKey("session_data",n),e,t)}async removeConfigDataParameter(e){await this.removeValue(this.resolveKey("config_data"),e)}async removeOIDCProviderMetaDataParameter(e){await this.removeValue(this.resolveKey("oidc_provider_meta_data"),e)}async removeTemporaryDataParameter(e,t){await this.removeValue(this.resolveKey("temporary_data",t),e)}async removeSessionDataParameter(e,t){await this.removeValue(this.resolveKey("session_data",t),e)}},zn=zi,Ji=r=>{let e=parseInt(r.split("request_")[1],10);return`${we.Storage.StorageKeys.CODE_VERIFIER}${we.Storage.StorageKeys.SEPARATOR}${e}`},Ae=Ji,Vi=r=>{let e=[];Object.keys(r).forEach(o=>{o.startsWith(we.Storage.StorageKeys.CODE_VERIFIER)&&e.push(o)});let t=e.sort().pop(),n=parseInt(t?.split(we.Storage.StorageKeys.SEPARATOR)[1]??"-1",10);return`${we.Storage.StorageKeys.CODE_VERIFIER}${we.Storage.StorageKeys.SEPARATOR}${n+1}`},Gi=Vi,Xi=(r,e)=>{let t=parseInt(r.split(we.Storage.StorageKeys.SEPARATOR)[1],10);return e?`${e}_request_${t}`:`request_${t}`},Yi=Xi,Zi=(r,e,t)=>{let{redirectUri:n,clientId:o,scopes:s,responseMode:i,codeChallenge:a,codeChallengeMethod:l,prompt:c}=r,u=new Map;u.set("response_type","code"),u.set("client_id",o),u.set("scope",s),u.set("redirect_uri",n),i&&u.set("response_mode",i);let f=e?.key;if(a)if(u.set("code_challenge",a),l)u.set("code_challenge_method",l);else throw new Gn("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.");return c&&u.set("prompt",c),t&&Object.entries(t).forEach(([h,m])=>{h!==""&&m!==""&&h!==$.Params.STATE&&u.set(h,m.toString())}),u.set($.Params.STATE,Yi(f,t?t[$.Params.STATE]?.toString():"")),u},Qi=Zi,ea={enablePKCE:!0,responseMode:"query",sendCookiesInRequests:!0,tokenValidation:{idToken:{clockTolerance:300,validate:!0,validateIssuer:!0}}},Sr=class pe{constructor(){N(this,"storageManager"),N(this,"configProvider"),N(this,"oidcProviderMetaDataProvider"),N(this,"authHelper"),N(this,"cryptoUtils"),N(this,"cryptoHelper")}async initialize(e,t,n,o){let{clientId:s}=e;pe.instanceIdValue?pe.instanceIdValue+=1:pe.instanceIdValue=0,o&&(pe.instanceIdValue=o),s?this.storageManager=new zn(`instance_${pe.instanceIdValue}-${s}`,t):this.storageManager=new zn(`instance_${pe.instanceIdValue}`,t),this.cryptoUtils=n,this.cryptoHelper=new ji(n),this.authHelper=new Ki(this.storageManager,this.cryptoHelper),this.configProvider=async()=>this.storageManager.getConfigData(),this.oidcProviderMetaDataProvider=async()=>this.storageManager.loadOpenIDProviderConfiguration(),pe.authHelperInstance=this.authHelper,await this.storageManager.setConfigData({...ea,...e,scope:wr(e.scopes)})}getStorageManager(){return this.storageManager}getInstanceId(){return pe.instanceIdValue}async getSignInUrl(e,t){let n={...e};delete n?.forceInit;let o=async()=>{let s=await this.storageManager.getOIDCProviderMetaDataParameter(L.Storage.StorageKeys.Endpoints.AUTHORIZATION);if(!s||s.trim().length===0)throw new I("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(s),a=await this.configProvider(),l=await this.storageManager.getTemporaryData(t),c=await Gi(l),u,f;a.enablePKCE&&(u=this.cryptoHelper?.getCodeVerifier(),f=this.cryptoHelper?.getCodeChallenge(u),await this.storageManager.setTemporaryDataParameter(c,u,t)),n.client_secret&&(n.client_secret=a.clientSecret);let h=Qi({clientId:a.clientId,codeChallenge:f,codeChallengeMethod:we.DEFAULT_CODE_CHALLENGE_METHOD,prompt:a.prompt,redirectUri:a.afterSignInUrl,responseMode:a.responseMode,scopes:wr(a.scopes)},{key:c},n);return Array.from(h.entries()).forEach(([m,p])=>{i.searchParams.append(m,p)}),i.toString()};return await this.storageManager.getTemporaryDataParameter(L.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED)?o():this.loadOpenIDProviderConfiguration(e?.forceInit).then(()=>o())}async requestAccessToken(e,t,n,o,s){let i=async()=>{let a=(await this.oidcProviderMetaDataProvider()).token_endpoint,l=await this.configProvider();if(!a||a.trim().length===0)throw new I("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($.Params.SESSION_STATE,t,o);let c=new URLSearchParams;c.set("client_id",l.clientId),l.clientSecret&&l.clientSecret.trim().length>0&&c.set("client_secret",l.clientSecret);let u=e;c.set("code",u),c.set("grant_type","authorization_code"),c.set("redirect_uri",l.afterSignInUrl),s?.params&&Object.entries(s.params).forEach(([h,m])=>{c.append(h,m)}),l.enablePKCE&&(c.set("code_verifier",`${await this.storageManager.getTemporaryDataParameter(Ae(n),o)}`),await this.storageManager.removeTemporaryDataParameter(Ae(n),o));let f;try{f=await fetch(a,{body:c,credentials:l.sendCookiesInRequests?"include":"same-origin",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},method:"POST"})}catch(h){throw new I("JS-AUTH_CORE-RAT1-NE02","Requesting access token failed",h??"The request to get the access token from the server failed.")}if(!f.ok)throw new I("JS-AUTH_CORE-RAT1-HE03",`Requesting access token failed with ${f.statusText}`,await f.json());return this.authHelper.handleTokenResponse(f,o)};return await this.storageManager.getTemporaryDataParameter(L.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED)?i():this.loadOpenIDProviderConfiguration(!1).then(()=>i())}async loadOpenIDProviderConfiguration(e){let t=await this.configProvider();if(!e&&await this.storageManager.getTemporaryDataParameter(L.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED))return Promise.resolve();let{wellKnownEndpoint:n}=t;if(n){let o;try{if(o=await fetch(n),o.status!==200||!o.ok)throw new Error}catch{throw new I("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.authHelper.resolveEndpoints(await o.json())),await this.storageManager.setTemporaryDataParameter(L.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,!0),Promise.resolve()}if(t.baseUrl){try{await this.storageManager.setOIDCProviderMetaData(await this.authHelper.resolveEndpointsByBaseURL())}catch(o){throw new I("JS-AUTH_CORE-GOPMD-IV02","Resolving endpoints failed.",o??"Resolving endpoints by base url failed.")}return await this.storageManager.setTemporaryDataParameter(L.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,!0),Promise.resolve()}return await this.storageManager.setOIDCProviderMetaData(await this.authHelper.resolveEndpointsExplicitly()),await this.storageManager.setTemporaryDataParameter(L.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,!0),Promise.resolve()}async getSignOutUrl(e){let t=(await this.oidcProviderMetaDataProvider())?.end_session_endpoint,n=await this.configProvider();if(!t||t.trim().length===0)throw new I("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 o=n?.afterSignOutUrl??n?.afterSignInUrl;if(!o||o.trim().length===0)throw new I("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 s=new URLSearchParams;if(s.set("post_logout_redirect_uri",o),n.sendIdTokenInLogoutRequest){let i=(await this.storageManager.getSessionData(e))?.id_token;if(!i||i.trim().length===0)throw new I("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.");s.set("id_token_hint",i)}else s.set("client_id",n.clientId);return s.set("state",$.Params.SIGN_OUT_SUCCESS),`${t}?${s.toString()}`}async getOpenIDProviderEndpoints(){let e=await this.oidcProviderMetaDataProvider();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 decodeJwtToken(e){return this.cryptoHelper.decodeJwtToken(e)}async getDecodedIdToken(e,t){let n=(await this.storageManager.getSessionData(e)).id_token;return this.cryptoHelper.decodeJwtToken(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.authHelper.getAuthenticatedUserInfo(t?.id_token);return Object.keys(n).forEach(o=>{(n[o]===void 0||n[o]===""||n[o]===null)&&delete n[o]}),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.oidcProviderMetaDataProvider()).revocation_endpoint,n=await this.configProvider();if(!t||t.trim().length===0)throw new I("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 o=[];o.push(`client_id=${n.clientId}`),o.push(`token=${(await this.storageManager.getSessionData(e)).access_token}`),o.push("token_type_hint=access_token"),n.clientSecret&&n.clientSecret.trim().length>0&&o.push(`client_secret=${n.clientSecret}`);let s;try{s=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(i){throw new I("JS-AUTH_CORE-RAT3-NE02","The request to revoke access token failed.",i??"The request sent to revoke the access token failed.")}if(s.status!==200||!s.ok)throw new I("JS-AUTH_CORE-RAT3-HE03",`Invalid response status received for revoke access token request (${s.statusText}).`,await s.json());return this.authHelper.clearSession(e),Promise.resolve(s)}async refreshAccessToken(e){let t=(await this.oidcProviderMetaDataProvider()).token_endpoint,n=await this.configProvider(),o=await this.storageManager.getSessionData(e);if(!o.refresh_token)throw new I("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 I("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 s=[];s.push(`client_id=${n.clientId}`),s.push(`refresh_token=${o.refresh_token}`),s.push("grant_type=refresh_token"),n.clientSecret&&n.clientSecret.trim().length>0&&s.push(`client_secret=${n.clientSecret}`);let i;try{i=await fetch(t,{body:s.join("&"),credentials:n.sendCookiesInRequests?"include":"same-origin",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},method:"POST"})}catch(a){throw new I("JS-AUTH_CORE-RAT2-NR03","Refresh access token request failed.",a??"The request to refresh the access token failed.")}if(!i.ok)throw new I("JS-AUTH_CORE-RAT2-HE04",`Refreshing access token failed with ${i.statusText}`,await i.json());return this.authHelper.handleTokenResponse(i,e)}async getAccessToken(e){return(await this.storageManager.getSessionData(e))?.access_token}async exchangeToken(e,t){let n=await this.oidcProviderMetaDataProvider(),o=await this.configProvider(),s;if(e.tokenEndpoint&&e.tokenEndpoint.trim().length!==0?s=e.tokenEndpoint:s=n.token_endpoint,!s||s.trim().length===0)throw new I("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([u,f])=>{let h=await this.authHelper.replaceCustomGrantTemplateTags(f,t);return`${u}=${h}`})),a={Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"};e.attachToken&&(a={...a,Authorization:`Bearer ${(await this.storageManager.getSessionData(t)).access_token}`});let l={body:i.join("&"),credentials:o.sendCookiesInRequests?"include":"same-origin",headers:new Headers(a),method:"POST"},c;try{c=await fetch(s,l)}catch(u){throw new I("JS-AUTH_CORE-RCG-NE02","The custom grant request failed.",u??"The request sent to get the custom grant failed.")}if(c.status!==200||!c.ok)throw new I("JS-AUTH_CORE-RCG-HE03",`Invalid response status received for the custom grant request. (${c.statusText})`,await c.json());return e.returnsSession?this.authHelper.handleTokenResponse(c,t):Promise.resolve(await c.json())}async isSignedIn(e){let t=!!await this.getAccessToken(e),n=(await this.storageManager.getSessionData(e))?.created_at,o=(await this.storageManager.getSessionData(e))?.expires_in;if(!o)return!1;let s=parseInt(o,10)*1e3,i=new Date().getTime(),a=n+s>i;return t&&a}async getPKCECode(e,t){return await this.storageManager.getTemporaryDataParameter(Ae(e),t)}async setPKCECode(e,t,n){return this.storageManager.setTemporaryDataParameter(Ae(t),e,n)}static isSignOutSuccessful(e){let t=new URL(e),n=t.searchParams.get($.Params.STATE),o=!!t.searchParams.get("error");return n?n===$.Params.SIGN_OUT_SUCCESS&&!o:!1}static didSignOutFail(e){let t=new URL(e),n=t.searchParams.get($.Params.STATE),o=!!t.searchParams.get("error");return n?n===$.Params.SIGN_OUT_SUCCESS&&o:!1}async reInitialize(e){await this.storageManager.setConfigData(e),await this.loadOpenIDProviderConfiguration(!0)}static async clearSession(e){await this.authHelperInstance.clearSession(e)}};N(Sr,"instanceIdValue");N(Sr,"authHelperInstance");var _e=Sr;var ta="\\u{1F6E1}\\uFE0F Asgardeo",ra={level:"info",prefix:`${ta}`,showLevel:!0,timestamps:!0},na=()=>typeof window<"u"&&typeof window.document<"u",oa=()=>typeof process<"u"&&process.versions&&process.versions.node,Y={blue:"\\x1B[34m",bright:"\\x1B[1m",cyan:"\\x1B[36m",dim:"\\x1B[2m",gray:"\\x1B[90m",green:"\\x1B[32m",magenta:"\\x1B[35m",red:"\\x1B[31m",reset:"\\x1B[0m",white:"\\x1B[37m",yellow:"\\x1B[33m"},He={debug:"color: #6b7280; font-weight: normal;",error:"color: #dc2626; font-weight: bold;",info:"color: #2563eb; font-weight: bold;",prefix:"color: #7c3aed; font-weight: bold;",timestamp:"color: #6b7280; font-size: 0.9em;",warn:"color: #d97706; font-weight: bold;"},Jn={debug:0,error:3,info:1,warn:2},sa=class Fe{constructor(e={}){N(this,"config"),this.config={...ra,...e}}configure(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}shouldLog(e){return Jn[e]>=Jn[this.config.level]}static getTimestamp(){return new Date().toISOString()}static 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(`${Y.gray}[${Fe.getTimestamp()}]${Y.reset}`),this.config.prefix&&n.push(`${Y.magenta}${this.config.prefix}${Y.reset}`),this.config.showLevel){let o=Fe.getLevelString(e),s;switch(e){case"debug":s=`${Y.gray}[${o}]${Y.reset}`;break;case"info":s=`${Y.blue}[${o}]${Y.reset}`;break;case"warn":s=`${Y.yellow}[${o}]${Y.reset}`;break;case"error":s=`${Y.red}[${o}]${Y.reset}`;break;default:s=`[${o}]`}n.push(s)}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}na()?this.logToBrowser(e,t,...n):oa()?this.logToNode(e,t,...n):console.log(t,...n)}}logToBrowser(e,t,...n){let o=[],s=[];if(this.config.timestamps&&(o.push(`%c[${Fe.getTimestamp()}]`),s.push(He.timestamp)),this.config.prefix&&(o.push(`%c${this.config.prefix}`),s.push(He.prefix)),this.config.showLevel){let a=Fe.getLevelString(e);switch(o.push(`%c[${a}]`),e){case"debug":s.push(He.debug);break;case"info":s.push(He.info);break;case"warn":s.push(He.warn);break;case"error":s.push(He.error);break;default:s.push("")}}o.push(`%c${t}`),s.push("color: inherit; font-weight: normal;");let i=o.join(" ");switch(e){case"debug":console.debug(i,...s,...n);break;case"info":console.info(i,...s,...n);break;case"warn":console.warn(i,...s,...n);break;case"error":console.error(i,...s,...n);break;default:console.log(i,...s,...n)}}logToNode(e,t,...n){let o=this.formatForNode(e,t);switch(e){case"debug":console.debug(o,...n);break;case"info":console.info(o,...n);break;case"warn":console.warn(o,...n);break;case"error":console.error(o,...n);break;default:console.log(o,...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 Fe({...this.config,prefix:t})}setLevel(e){this.config.level=e}getLevel(){return this.config.level}},Xc=new sa;var Er="init";var Xn="sign-out",Yn="http-request",Zn="http-request-all",Qn="request-custom-grant",eo="revoke-access-token";var to="request-start",ro="request-success";var no="request-finish",oo="get-oidc-service-endpoints",so="get-basic-user-info",io="get-decoded-id-token";var ao="get-crypto-helper",co="enable_http_handler",lo="disable_http_handler",uo="get_auth_url",fo="request_get_token",po="is_authenticated",ho="get_sign_out_url",go="refresh_access-token",mo="refresh-access-token-error",yo="set_session_state",wo="start_auto_refresh_token",So="update_config",Eo="get_id_token",br="check_session_signed_in",Tr="check_session_signed_out",bo="get_config_data";var Rr="rpIFrame",Ir="promptNoneIFrame";var xr="sign-in-silently";var Ar="initialized-silent-sign-in",_r="promptNoneRequestSent";var Le="error",at="error_description",vr="custom_grant_config",Or="state";var Cr="Access token is invalid";var b=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(`${$.SignOut.Storage.StorageKeys.SIGN_OUT_URL}-instance_${n}-${t}`,e)}static getSignOutUrl(e,t){return sessionStorage.getItem(`${$.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(Ar);return!!(e?JSON.parse(e):null)}static async isSignOutSuccessful(){if(_e.isSignOutSuccessful(window.location.href)){let e=window.location.href.split("?")[0];return history.pushState({},document.title,e),await _e.clearSession(),!0}return!1}static didSignOutFail(){if(_e.didSignOutFail(window.location.href)){let e=new URL(window.location.href),t=e.searchParams.get(Le),n=e.searchParams.get(at),o=window.location.href.split("?")[0];return history.pushState({},document.title,o),{description:n??"",error:t??""}}return!1}static isSilentStatePresentInURL(){return new URL(window.location.href).searchParams.get("state")?.includes(xr)??!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(Le)&&t.searchParams.get(Or)!==$.Params.SIGN_OUT_SUCCESS}static canSendPromptNoneRequest(){let e=sessionStorage.getItem(_r);return!(e?JSON.parse(e):null)}static setPromptNoneRequestSent(e){sessionStorage.setItem(_r,JSON.stringify(e))}static async waitTillPageRedirect(e){let t=e??3e3;await new Promise(n=>setTimeout(n,t*1e3))}};S(Se,"until",(e,t=500)=>{let n=o=>e()?o():setTimeout(()=>n(o),t);return new Promise(n)});var Ee=Se;var kt=class{constructor(e,t){S(this,"_authenticationClient");S(this,"_storageManager");S(this,"_spaHelper");S(this,"_instanceID");S(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,o,s){s.initialize(e.clientId,t.checkSessionIframe??"",n,e.checkSessionInterval??3,e.sessionRefreshInterval??300,e.afterSignInUrl,o)}async exchangeToken(e,t){let n=await this._storageManager.getConfigData(),o=!0,s=!1;if(e?.tokenEndpoint)if(o=!1,n.storage==="webWorker"){for(let i of[...n?.allowedExternalUrls??[],e.baseUrl])if(i&&e.tokenEndpoint?.startsWith(i)){s=!0;break}}else s=!0;return e.shouldReplayAfterRefresh&&this._storageManager.setTemporaryDataParameter(vr,JSON.stringify(e)),o||s?this._authenticationClient.exchangeToken(e).then(async i=>(t&&typeof t=="function"&&t(e),e.returnsSession?(this._spaHelper.refreshAccessTokenAutomatically(this),this._authenticationClient.getUser()):i)).catch(i=>Promise.reject(i)):Promise.reject(new I("SPA-MAIN_THREAD_CLIENT-RCG-IV01","Request to the provided endpoint is prohibited.","Requests can only be sent to resource servers specified by the `allowedExternalUrls` attribute while initializing the SDK. The specified token endpoint in this request cannot be found among the `allowedExternalUrls`"))}async getCustomGrantConfigData(){let e=await this._storageManager.getTemporaryDataParameter(vr);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:mo};return window.postMessage(n),Promise.reject(t)}}async retryFailedRequests(e){let t=e.httpClient,n=e.requestConfig,o=e.isHttpHandlerEnabled,s=e.httpErrorCallback,i=e.httpFinishCallback;await Ee.until(()=>!this._isTokenRefreshing);try{let a=await t.request(n);return Promise.resolve(a)}catch(a){return o&&(typeof s=="function"&&await s(a),typeof i=="function"&&i()),Promise.reject(a)}}async httpRequest(e,t,n,o,s,i){let a=!1,l=await this._storageManager.getConfigData();if(l.storage==="webWorker"){for(let c of[...l?.allowedExternalUrls??[],l.baseUrl])if(c&&t?.url?.startsWith(c)){a=!0;break}}else a=!0;return a?e.request(t).then(c=>Promise.resolve(c)).catch(async c=>{if(c?.response?.status===401||!c?.response){if(this._isTokenRefreshing)return this.retryFailedRequests({enableRetrievingSignOutURLFromSession:i,httpClient:e,httpErrorCallback:o,httpFinishCallback:s,isHttpHandlerEnabled:n,requestConfig:t});this._isTokenRefreshing=!0;let u;try{u=await this.refreshAccessToken(i),this._isTokenRefreshing=!1}catch(f){throw this._isTokenRefreshing=!1,n&&(typeof o=="function"&&await o({...c,code:Cr}),typeof s=="function"&&s()),new I("SPA-AUTH_HELPER-HR-SE01",f?.name??"Refresh token request failed.",f?.message??"An error occurred while trying to refresh the access token following a 401 response from the server.")}if(u)try{let f=await e.request(t);return Promise.resolve(f)}catch(f){return n&&(typeof o=="function"&&await o(f),typeof s=="function"&&s()),Promise.reject(f)}}return n&&(typeof o=="function"&&await o(c),typeof s=="function"&&s()),Promise.reject(c)}):Promise.reject(new I("SPA-AUTH_HELPER-HR-IV02","Request to the provided endpoint is prohibited.","Requests can only be sent to resource servers specified by the `allowedExternalUrls` attribute while initializing the SDK. The specified endpoint in this request cannot be found among the `allowedExternalUrls`"))}async httpRequestAll(e,t,n,o,s){let i=!0,a=await this._storageManager.getConfigData();if(a.storage==="webWorker")for(let c of e){let u=!1;for(let f of[...a?.allowedExternalUrls??[],a.baseUrl])if(f&&c.url?.startsWith(f)){u=!0;break}if(!u){i=!1;break}}let l=[];if(i)return e.forEach(c=>{l.push(t.request(c))}),t?.all&&t.all(l).then(c=>Promise.resolve(c)).catch(async c=>{if(c?.response?.status===401||!c?.response){let u;try{u=await this._authenticationClient.refreshAccessToken()}catch(f){throw n&&(typeof o=="function"&&await o({...c,code:Cr}),typeof s=="function"&&s()),new I("SPA-AUTH_HELPER-HRA-SE01",f?.name??"Refresh token request failed.",f?.message??"An error occurred while trying to refresh the access token following a 401 response from the server.")}if(u)return t.all&&t.all(l).then(f=>Promise.resolve(f)).catch(async f=>(n&&(typeof o=="function"&&await o(f),typeof s=="function"&&s()),Promise.reject(f)))}return n&&(typeof o=="function"&&await o(c),typeof s=="function"&&s()),Promise.reject(c)});throw new I("SPA-AUTH_HELPER-HRA-IV02","Request to the provided endpoint is prohibited.","Requests can only be sent to resource servers specified by the `allowedExternalUrls` attribute while initializing the SDK. The specified endpoint in this request cannot be found among the `allowedExternalUrls`")}async requestAccessToken(e,t,n,o,s,i){let a=await this._storageManager.getConfigData();if(a.storage==="browserMemory"&&a.enablePKCE&&t){let l=Ee.getPKCE(Ae(t));await this._authenticationClient.setPKCECode(Ae(t),l)}else a.storage==="webWorker"&&o&&await this._authenticationClient.setPKCECode(o,s??"");return e?this._authenticationClient.requestAccessToken(e,t??"",s??"",void 0,i).then(async()=>(a.storage!=="webWorker"?(Ee.setSignOutURL(await this._authenticationClient.getSignOutUrl(),a.clientId,this._instanceID),this._spaHelper&&(this._spaHelper.clearRefreshTokenTimeout(),this._spaHelper.refreshAccessTokenAutomatically(this)),n&&typeof n=="function"&&a.syncSession&&n()):this._spaHelper&&this._spaHelper.refreshAccessTokenAutomatically(this),this._authenticationClient.getUser())).catch(l=>Promise.reject(l)):Promise.reject(new I("SPA-AUTH_HELPER-RAT1-NF01","No authorization code.","No authorization code was found."))}async signInSilently(e,t,n,o,s){if(Ee.isInitializedSilentSignIn())return await n.receivePromptNoneResponse(),Promise.resolve({allowedScopes:"",displayName:"",email:"",sessionState:"",sub:"",tenantDomain:"",username:""});let a=document.getElementById(Rr)?.contentDocument?.getElementById(Ir);try{let l=await e(o);a.src=l}catch(l){return Promise.reject(l)}return new Promise((l,c)=>{let u=setTimeout(()=>{l(!1)},1e4),f=async h=>{let m=h.data;m?.type==Tr&&(window.removeEventListener("message",f),clearTimeout(u),l(!1)),m?.type==br&&m?.data?.code&&t(m?.data?.code,m?.data?.sessionState,m?.data?.state,s).then(p=>{window.removeEventListener("message",f),l(p)}).catch(p=>{window.removeEventListener("message",f),c(p)}).finally(()=>{clearTimeout(u)})};window.addEventListener("message",f)})}async handleSignIn(e,t,n){let o=await this._storageManager.getConfigData();if(await e())return Promise.resolve({allowedScopes:"",displayName:"",email:"",sessionState:"",sub:"",tenantDomain:"",username:""});if(o.storage!=="webWorker"&&await this._authenticationClient.isSignedIn())return this._spaHelper.clearRefreshTokenTimeout(),this._spaHelper.refreshAccessTokenAutomatically(this),o.syncSession&&t(),Promise.resolve(await this._authenticationClient.getUser());let s=new URL(window.location.href).searchParams.get(Le),i=new URL(window.location.href).searchParams.get(at);if(s){let a=new URL(window.location.href);throw a.searchParams.delete(Le),a.searchParams.delete(at),history.pushState(null,document.title,a.toString()),new I("SPA-AUTH_HELPER-SI-SE01",s,i??"")}if(o.storage==="webWorker"&&n){let a=await n();if(a)return a}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 Nt=class{constructor(e){S(this,"_authenticationClient");S(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 o=parseInt(n.expires_in),s=o<=10?o:o-10,i=setTimeout(async()=>{await e.refreshAccessToken()},s*1e3);await this._storageManager.setTemporaryDataParameter(it.Storage.StorageKeys.REFRESH_TOKEN_TIMER,JSON.stringify(i))}}async getRefreshTimeoutTimer(){return await this._storageManager.getTemporaryDataParameter(it.Storage.StorageKeys.REFRESH_TOKEN_TIMER)?JSON.parse(await this._storageManager.getTemporaryDataParameter(it.Storage.StorageKeys.REFRESH_TOKEN_TIMER)):-1}async clearRefreshTokenTimeout(e){if(e){clearTimeout(e);return}let t=await this.getRefreshTimeoutTimer();t!==-1&&clearTimeout(t)}};function ct(r,e){return function(){return r.apply(e,arguments)}}var{toString:aa}=Object.prototype,{getPrototypeOf:Ur}=Object,{iterator:Bt,toStringTag:Ro}=Symbol,Mt=(r=>e=>{let t=aa.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Q=r=>(r=r.toLowerCase(),e=>Mt(e)===r),Ht=r=>e=>typeof e===r,{isArray:Ke}=Array,$e=Ht("undefined");function lt(r){return r!==null&&!$e(r)&&r.constructor!==null&&!$e(r.constructor)&&J(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}var Io=Q("ArrayBuffer");function ca(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Io(r.buffer),e}var la=Ht("string"),J=Ht("function"),xo=Ht("number"),ut=r=>r!==null&&typeof r=="object",ua=r=>r===!0||r===!1,Dt=r=>{if(Mt(r)!=="object")return!1;let e=Ur(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Ro in r)&&!(Bt in r)},fa=r=>{if(!ut(r)||lt(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},da=Q("Date"),pa=Q("File"),ha=Q("Blob"),ga=Q("FileList"),ma=r=>ut(r)&&J(r.pipe),ya=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||J(r.append)&&((e=Mt(r))==="formdata"||e==="object"&&J(r.toString)&&r.toString()==="[object FormData]"))},wa=Q("URLSearchParams"),[Sa,Ea,ba,Ta]=["ReadableStream","Request","Response","Headers"].map(Q),Ra=r=>r.trim?r.trim():r.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,"");function ft(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,o;if(typeof r!="object"&&(r=[r]),Ke(r))for(n=0,o=r.length;n<o;n++)e.call(null,r[n],n,r);else{if(lt(r))return;let s=t?Object.getOwnPropertyNames(r):Object.keys(r),i=s.length,a;for(n=0;n<i;n++)a=s[n],e.call(null,r[a],a,r)}}function Ao(r,e){if(lt(r))return null;e=e.toLowerCase();let t=Object.keys(r),n=t.length,o;for(;n-- >0;)if(o=t[n],e===o.toLowerCase())return o;return null}var ve=typeof self<"u"||typeof self<"u"?self:typeof window<"u"?window:self,_o=r=>!$e(r)&&r!==ve;function Pr(){let{caseless:r,skipUndefined:e}=_o(this)&&this||{},t={},n=(o,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;let i=r&&Ao(t,s)||s;Dt(t[i])&&Dt(o)?t[i]=Pr(t[i],o):Dt(o)?t[i]=Pr({},o):Ke(o)?t[i]=o.slice():(!e||!$e(o))&&(t[i]=o)};for(let o=0,s=arguments.length;o<s;o++)arguments[o]&&ft(arguments[o],n);return t}var Ia=(r,e,t,{allOwnKeys:n}={})=>(ft(e,(o,s)=>{t&&J(o)?Object.defineProperty(r,s,{value:ct(o,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,s,{value:o,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),r),xa=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Aa=(r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),Object.defineProperty(r.prototype,"constructor",{value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},_a=(r,e,t,n)=>{let o,s,i,a={};if(e=e||{},r==null)return e;do{for(o=Object.getOwnPropertyNames(r),s=o.length;s-- >0;)i=o[s],(!n||n(i,r,e))&&!a[i]&&(e[i]=r[i],a[i]=!0);r=t!==!1&&Ur(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},va=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;let n=r.indexOf(e,t);return n!==-1&&n===t},Oa=r=>{if(!r)return null;if(Ke(r))return r;let e=r.length;if(!xo(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},Ca=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&Ur(Uint8Array)),Pa=(r,e)=>{let n=(r&&r[Bt]).call(r),o;for(;(o=n.next())&&!o.done;){let s=o.value;e.call(r,s[0],s[1])}},Ua=(r,e)=>{let t,n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},ka=Q("HTMLFormElement"),Na=r=>r.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,function(t,n,o){return n.toUpperCase()+o}),To=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),Da=Q("RegExp"),vo=(r,e)=>{let t=Object.getOwnPropertyDescriptors(r),n={};ft(t,(o,s)=>{let i;(i=e(o,s,r))!==!1&&(n[s]=i||o)}),Object.defineProperties(r,n)},Ba=r=>{vo(r,(e,t)=>{if(J(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let n=r[t];if(J(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method \'"+t+"\'")})}})},Ma=(r,e)=>{let t={},n=o=>{o.forEach(s=>{t[s]=!0})};return Ke(r)?n(r):n(String(r).split(e)),t},Ha=()=>{},Fa=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function La(r){return!!(r&&J(r.append)&&r[Ro]==="FormData"&&r[Bt])}var $a=r=>{let e=new Array(10),t=(n,o)=>{if(ut(n)){if(e.indexOf(n)>=0)return;if(lt(n))return n;if(!("toJSON"in n)){e[o]=n;let s=Ke(n)?[]:{};return ft(n,(i,a)=>{let l=t(i,o+1);!$e(l)&&(s[a]=l)}),e[o]=void 0,s}}return n};return t(r,0)},Ka=Q("AsyncFunction"),Wa=r=>r&&(ut(r)||J(r))&&J(r.then)&&J(r.catch),Oo=((r,e)=>r?setImmediate:e?((t,n)=>(ve.addEventListener("message",({source:o,data:s})=>{o===ve&&s===t&&n.length&&n.shift()()},!1),o=>{n.push(o),ve.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",J(ve.postMessage)),qa=typeof queueMicrotask<"u"?queueMicrotask.bind(ve):typeof process<"u"&&process.nextTick||Oo,ja=r=>r!=null&&J(r[Bt]),d={isArray:Ke,isArrayBuffer:Io,isBuffer:lt,isFormData:ya,isArrayBufferView:ca,isString:la,isNumber:xo,isBoolean:ua,isObject:ut,isPlainObject:Dt,isEmptyObject:fa,isReadableStream:Sa,isRequest:Ea,isResponse:ba,isHeaders:Ta,isUndefined:$e,isDate:da,isFile:pa,isBlob:ha,isRegExp:Da,isFunction:J,isStream:ma,isURLSearchParams:wa,isTypedArray:Ca,isFileList:ga,forEach:ft,merge:Pr,extend:Ia,trim:Ra,stripBOM:xa,inherits:Aa,toFlatObject:_a,kindOf:Mt,kindOfTest:Q,endsWith:va,toArray:Oa,forEachEntry:Pa,matchAll:Ua,isHTMLForm:ka,hasOwnProperty:To,hasOwnProp:To,reduceDescriptors:vo,freezeMethods:Ba,toObjectSet:Ma,toCamelCase:Na,noop:Ha,toFiniteNumber:Fa,findKey:Ao,global:ve,isContextDefined:_o,isSpecCompliantForm:La,toJSONObject:$a,isAsyncFn:Ka,isThenable:Wa,setImmediate:Oo,asap:qa,isIterable:ja};var j=class r extends Error{static from(e,t,n,o,s,i){let a=new r(e.message,t||e.code,n,o,s);return a.cause=e,a.name=e.name,i&&Object.assign(a,i),a}constructor(e,t,n,o,s){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),o&&(this.request=o),s&&(this.response=s,this.status=s.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:d.toJSONObject(this.config),code:this.code,status:this.status}}};j.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";j.ERR_BAD_OPTION="ERR_BAD_OPTION";j.ECONNABORTED="ECONNABORTED";j.ETIMEDOUT="ETIMEDOUT";j.ERR_NETWORK="ERR_NETWORK";j.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";j.ERR_DEPRECATED="ERR_DEPRECATED";j.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";j.ERR_BAD_REQUEST="ERR_BAD_REQUEST";j.ERR_CANCELED="ERR_CANCELED";j.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";j.ERR_INVALID_URL="ERR_INVALID_URL";var R=j;var Ft=null;function kr(r){return d.isPlainObject(r)||d.isArray(r)}function Po(r){return d.endsWith(r,"[]")?r.slice(0,-2):r}function Co(r,e,t){return r?r.concat(e).map(function(o,s){return o=Po(o),!t&&s?"["+o+"]":o}).join(t?".":""):e}function za(r){return d.isArray(r)&&!r.some(kr)}var Ja=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function Va(r,e,t){if(!d.isObject(r))throw new TypeError("target must be an object");e=e||new(Ft||FormData),t=d.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,y){return!d.isUndefined(y[w])});let n=t.metaTokens,o=t.visitor||u,s=t.dots,i=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&d.isSpecCompliantForm(e);if(!d.isFunction(o))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(d.isDate(p))return p.toISOString();if(d.isBoolean(p))return p.toString();if(!l&&d.isBlob(p))throw new R("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(p)||d.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function u(p,w,y){let E=p;if(p&&!y&&typeof p=="object"){if(d.endsWith(w,"{}"))w=n?w:w.slice(0,-2),p=JSON.stringify(p);else if(d.isArray(p)&&za(p)||(d.isFileList(p)||d.endsWith(w,"[]"))&&(E=d.toArray(p)))return w=Po(w),E.forEach(function(A,_){!(d.isUndefined(A)||A===null)&&e.append(i===!0?Co([w],_,s):i===null?w:w+"[]",c(A))}),!1}return kr(p)?!0:(e.append(Co(y,w,s),c(p)),!1)}let f=[],h=Object.assign(Ja,{defaultVisitor:u,convertValue:c,isVisitable:kr});function m(p,w){if(!d.isUndefined(p)){if(f.indexOf(p)!==-1)throw Error("Circular reference detected in "+w.join("."));f.push(p),d.forEach(p,function(E,T){(!(d.isUndefined(E)||E===null)&&o.call(e,E,d.isString(T)?T.trim():T,w,h))===!0&&m(E,w?w.concat(T):[T])}),f.pop()}}if(!d.isObject(r))throw new TypeError("data must be an object");return m(r),e}var be=Va;function Uo(r){let e={"!":"%21","\'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\\0"};return encodeURIComponent(r).replace(/[!\'()~]|%20|%00/g,function(n){return e[n]})}function ko(r,e){this._pairs=[],r&&be(r,this,e)}var No=ko.prototype;No.append=function(e,t){this._pairs.push([e,t])};No.toString=function(e){let t=e?function(n){return e.call(this,n,Uo)}:Uo;return this._pairs.map(function(o){return t(o[0])+"="+t(o[1])},"").join("&")};var Lt=ko;function Ga(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function dt(r,e,t){if(!e)return r;let n=t&&t.encode||Ga,o=d.isFunction(t)?{serialize:t}:t,s=o&&o.serialize,i;if(s?i=s(e,o):i=d.isURLSearchParams(e)?e.toString():new Lt(e,o).toString(n),i){let a=r.indexOf("#");a!==-1&&(r=r.slice(0,a)),r+=(r.indexOf("?")===-1?"?":"&")+i}return r}var Nr=class{constructor(){this.handlers=[]}use(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}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){d.forEach(this.handlers,function(n){n!==null&&e(n)})}},Dr=Nr;var We={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0};var Do=typeof URLSearchParams<"u"?URLSearchParams:Lt;var Bo=typeof FormData<"u"?FormData:null;var Mo=typeof Blob<"u"?Blob:null;var Ho={isBrowser:!0,classes:{URLSearchParams:Do,FormData:Bo,Blob:Mo},protocols:["http","https","file","blob","url","data"]};var Hr={};Zs(Hr,{hasBrowserEnv:()=>Mr,hasStandardBrowserEnv:()=>Xa,hasStandardBrowserWebWorkerEnv:()=>Ya,navigator:()=>Br,origin:()=>Za});var Mr=typeof window<"u"&&typeof document<"u",Br=typeof navigator=="object"&&navigator||void 0,Xa=Mr&&(!Br||["ReactNative","NativeScript","NS"].indexOf(Br.product)<0),Ya=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Za=Mr&&window.location.href||"http://localhost";var P={...Hr,...Ho};function Fr(r,e){return be(r,new P.classes.URLSearchParams,{visitor:function(t,n,o,s){return P.isNode&&d.isBuffer(t)?(this.append(n,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...e})}function Qa(r){return d.matchAll(/\\w+|\\[(\\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function ec(r){let e={},t=Object.keys(r),n,o=t.length,s;for(n=0;n<o;n++)s=t[n],e[s]=r[s];return e}function tc(r){function e(t,n,o,s){let i=t[s++];if(i==="__proto__")return!0;let a=Number.isFinite(+i),l=s>=t.length;return i=!i&&d.isArray(o)?o.length:i,l?(d.hasOwnProp(o,i)?o[i]=[o[i],n]:o[i]=n,!a):((!o[i]||!d.isObject(o[i]))&&(o[i]=[]),e(t,n,o[i],s)&&d.isArray(o[i])&&(o[i]=ec(o[i])),!a)}if(d.isFormData(r)&&d.isFunction(r.entries)){let t={};return d.forEachEntry(r,(n,o)=>{e(Qa(n),o,t,0)}),t}return null}var $t=tc;function rc(r,e,t){if(d.isString(r))try{return(e||JSON.parse)(r),d.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}var Lr={transitional:We,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){let n=t.getContentType()||"",o=n.indexOf("application/json")>-1,s=d.isObject(e);if(s&&d.isHTMLForm(e)&&(e=new FormData(e)),d.isFormData(e))return o?JSON.stringify($t(e)):e;if(d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e)||d.isReadableStream(e))return e;if(d.isArrayBufferView(e))return e.buffer;if(d.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Fr(e,this.formSerializer).toString();if((a=d.isFileList(e))||n.indexOf("multipart/form-data")>-1){let l=this.env&&this.env.FormData;return be(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||o?(t.setContentType("application/json",!1),rc(e)):e}],transformResponse:[function(e){let t=this.transitional||Lr.transitional,n=t&&t.forcedJSONParsing,o=this.responseType==="json";if(d.isResponse(e)||d.isReadableStream(e))return e;if(e&&d.isString(e)&&(n&&!this.responseType||o)){let i=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,this.parseReviver)}catch(a){if(i)throw a.name==="SyntaxError"?R.from(a,R.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:P.classes.FormData,Blob:P.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],r=>{Lr.headers[r]={}});var qe=Lr;var nc=d.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Fo=r=>{let e={},t,n,o;return r&&r.split(`\n`).forEach(function(i){o=i.indexOf(":"),t=i.substring(0,o).trim().toLowerCase(),n=i.substring(o+1).trim(),!(!t||e[t]&&nc[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e};var Lo=Symbol("internals");function pt(r){return r&&String(r).trim().toLowerCase()}function Kt(r){return r===!1||r==null?r:d.isArray(r)?r.map(Kt):String(r)}function oc(r){let e=Object.create(null),t=/([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g,n;for(;n=t.exec(r);)e[n[1]]=n[2];return e}var sc=r=>/^[-_a-zA-Z0-9^`|~,!#$%&\'*+.]+$/.test(r.trim());function $r(r,e,t,n,o){if(d.isFunction(n))return n.call(this,e,t);if(o&&(e=t),!!d.isString(e)){if(d.isString(n))return e.indexOf(n)!==-1;if(d.isRegExp(n))return n.test(e)}}function ic(r){return r.trim().toLowerCase().replace(/([a-z\\d])(\\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function ac(r,e){let t=d.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(r,n+t,{value:function(o,s,i){return this[n].call(this,e,o,s,i)},configurable:!0})})}var je=class{constructor(e){e&&this.set(e)}set(e,t,n){let o=this;function s(a,l,c){let u=pt(l);if(!u)throw new Error("header name must be a non-empty string");let f=d.findKey(o,u);(!f||o[f]===void 0||c===!0||c===void 0&&o[f]!==!1)&&(o[f||l]=Kt(a))}let i=(a,l)=>d.forEach(a,(c,u)=>s(c,u,l));if(d.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(d.isString(e)&&(e=e.trim())&&!sc(e))i(Fo(e),t);else if(d.isObject(e)&&d.isIterable(e)){let a={},l,c;for(let u of e){if(!d.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(l=a[c])?d.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}i(a,t)}else e!=null&&s(t,e,n);return this}get(e,t){if(e=pt(e),e){let n=d.findKey(this,e);if(n){let o=this[n];if(!t)return o;if(t===!0)return oc(o);if(d.isFunction(t))return t.call(this,o,n);if(d.isRegExp(t))return t.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=pt(e),e){let n=d.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||$r(this,this[n],n,t)))}return!1}delete(e,t){let n=this,o=!1;function s(i){if(i=pt(i),i){let a=d.findKey(n,i);a&&(!t||$r(n,n[a],a,t))&&(delete n[a],o=!0)}}return d.isArray(e)?e.forEach(s):s(e),o}clear(e){let t=Object.keys(this),n=t.length,o=!1;for(;n--;){let s=t[n];(!e||$r(this,this[s],s,e,!0))&&(delete this[s],o=!0)}return o}normalize(e){let t=this,n={};return d.forEach(this,(o,s)=>{let i=d.findKey(n,s);if(i){t[i]=Kt(o),delete t[s];return}let a=e?ic(s):String(s).trim();a!==s&&delete t[s],t[a]=Kt(o),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return d.forEach(this,(n,o)=>{n!=null&&n!==!1&&(t[o]=e&&d.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`\n`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach(o=>n.set(o)),n}static accessor(e){let n=(this[Lo]=this[Lo]={accessors:{}}).accessors,o=this.prototype;function s(i){let a=pt(i);n[a]||(ac(o,i),n[a]=!0)}return d.isArray(e)?e.forEach(s):s(e),this}};je.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);d.reduceDescriptors(je.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(n){this[t]=n}}});d.freezeMethods(je);var H=je;function ht(r,e){let t=this||qe,n=e||t,o=H.from(n.headers),s=n.data;return d.forEach(r,function(a){s=a.call(t,s,o.normalize(),e?e.status:void 0)}),o.normalize(),s}function gt(r){return!!(r&&r.__CANCEL__)}var Kr=class extends R{constructor(e,t,n){super(e??"canceled",R.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}},se=Kr;function mt(r,e,t){let n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new R("Request failed with status code "+t.status,[R.ERR_BAD_REQUEST,R.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Wr(r){let e=/^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(r);return e&&e[1]||""}function cc(r,e){r=r||10;let t=new Array(r),n=new Array(r),o=0,s=0,i;return e=e!==void 0?e:1e3,function(l){let c=Date.now(),u=n[s];i||(i=c),t[o]=l,n[o]=c;let f=s,h=0;for(;f!==o;)h+=t[f++],f=f%r;if(o=(o+1)%r,o===s&&(s=(s+1)%r),c-i<e)return;let m=u&&c-u;return m?Math.round(h*1e3/m):void 0}}var $o=cc;function lc(r,e){let t=0,n=1e3/e,o,s,i=(c,u=Date.now())=>{t=u,o=null,s&&(clearTimeout(s),s=null),r(...c)};return[(...c)=>{let u=Date.now(),f=u-t;f>=n?i(c,u):(o=c,s||(s=setTimeout(()=>{s=null,i(o)},n-f)))},()=>o&&i(o)]}var Ko=lc;var ze=(r,e,t=3)=>{let n=0,o=$o(50,250);return Ko(s=>{let i=s.loaded,a=s.lengthComputable?s.total:void 0,l=i-n,c=o(l),u=i<=a;n=i;let f={loaded:i,total:a,progress:a?i/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-i)/c:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};r(f)},t)},qr=(r,e)=>{let t=r!=null;return[n=>e[0]({lengthComputable:t,total:r,loaded:n}),e[1]]},jr=r=>(...e)=>d.asap(()=>r(...e));var Wo=P.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,P.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(P.origin),P.navigator&&/(msie|trident)/i.test(P.navigator.userAgent)):()=>!0;var qo=P.hasStandardBrowserEnv?{write(r,e,t,n,o,s,i){if(typeof document>"u")return;let a=[`${r}=${encodeURIComponent(e)}`];d.isNumber(t)&&a.push(`expires=${new Date(t).toUTCString()}`),d.isString(n)&&a.push(`path=${n}`),d.isString(o)&&a.push(`domain=${o}`),s===!0&&a.push("secure"),d.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(r){if(typeof document>"u")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+r+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(r){this.write(r,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function zr(r){return typeof r!="string"?!1:/^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(r)}function Jr(r,e){return e?r.replace(/\\/?\\/$/,"")+"/"+e.replace(/^\\/+/,""):r}function yt(r,e,t){let n=!zr(e);return r&&(n||t==!1)?Jr(r,e):e}var jo=r=>r instanceof H?{...r}:r;function ee(r,e){e=e||{};let t={};function n(c,u,f,h){return d.isPlainObject(c)&&d.isPlainObject(u)?d.merge.call({caseless:h},c,u):d.isPlainObject(u)?d.merge({},u):d.isArray(u)?u.slice():u}function o(c,u,f,h){if(d.isUndefined(u)){if(!d.isUndefined(c))return n(void 0,c,f,h)}else return n(c,u,f,h)}function s(c,u){if(!d.isUndefined(u))return n(void 0,u)}function i(c,u){if(d.isUndefined(u)){if(!d.isUndefined(c))return n(void 0,c)}else return n(void 0,u)}function a(c,u,f){if(f in e)return n(c,u);if(f in r)return n(void 0,c)}let l={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(c,u,f)=>o(jo(c),jo(u),f,!0)};return d.forEach(Object.keys({...r,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;let f=d.hasOwnProp(l,u)?l[u]:o,h=f(r[u],e[u],u);d.isUndefined(h)&&f!==a||(t[u]=h)}),t}var Wt=r=>{let e=ee({},r),{data:t,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:a}=e;if(e.headers=i=H.from(i),e.url=dt(yt(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),d.isFormData(t)){if(P.hasStandardBrowserEnv||P.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(d.isFunction(t.getHeaders)){let l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,f])=>{c.includes(u.toLowerCase())&&i.set(u,f)})}}if(P.hasStandardBrowserEnv&&(n&&d.isFunction(n)&&(n=n(e)),n||n!==!1&&Wo(e.url))){let l=o&&s&&qo.read(s);l&&i.set(o,l)}return e};var uc=typeof XMLHttpRequest<"u",zo=uc&&function(r){return new Promise(function(t,n){let o=Wt(r),s=o.data,i=H.from(o.headers).normalize(),{responseType:a,onUploadProgress:l,onDownloadProgress:c}=o,u,f,h,m,p;function w(){m&&m(),p&&p(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,!0),y.timeout=o.timeout;function E(){if(!y)return;let A=H.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:A,config:r,request:y};mt(function(v){t(v),w()},function(v){n(v),w()},x),y=null}"onloadend"in y?y.onloadend=E:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(E)},y.onabort=function(){y&&(n(new R("Request aborted",R.ECONNABORTED,r,y)),y=null)},y.onerror=function(_){let x=_&&_.message?_.message:"Network Error",M=new R(x,R.ERR_NETWORK,r,y);M.event=_||null,n(M),y=null},y.ontimeout=function(){let _=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",x=o.transitional||We;o.timeoutErrorMessage&&(_=o.timeoutErrorMessage),n(new R(_,x.clarifyTimeoutError?R.ETIMEDOUT:R.ECONNABORTED,r,y)),y=null},s===void 0&&i.setContentType(null),"setRequestHeader"in y&&d.forEach(i.toJSON(),function(_,x){y.setRequestHeader(x,_)}),d.isUndefined(o.withCredentials)||(y.withCredentials=!!o.withCredentials),a&&a!=="json"&&(y.responseType=o.responseType),c&&([h,p]=ze(c,!0),y.addEventListener("progress",h)),l&&y.upload&&([f,m]=ze(l),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",m)),(o.cancelToken||o.signal)&&(u=A=>{y&&(n(!A||A.type?new se(null,r,y):A),y.abort(),y=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));let T=Wr(o.url);if(T&&P.protocols.indexOf(T)===-1){n(new R("Unsupported protocol "+T+":",R.ERR_BAD_REQUEST,r));return}y.send(s||null)})};var fc=(r,e)=>{let{length:t}=r=r?r.filter(Boolean):[];if(e||t){let n=new AbortController,o,s=function(c){if(!o){o=!0,a();let u=c instanceof Error?c:this.reason;n.abort(u instanceof R?u:new se(u instanceof Error?u.message:u))}},i=e&&setTimeout(()=>{i=null,s(new R(`timeout of ${e}ms exceeded`,R.ETIMEDOUT))},e),a=()=>{r&&(i&&clearTimeout(i),i=null,r.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),r=null)};r.forEach(c=>c.addEventListener("abort",s));let{signal:l}=n;return l.unsubscribe=()=>d.asap(a),l}},Jo=fc;var dc=function*(r,e){let t=r.byteLength;if(!e||t<e){yield r;return}let n=0,o;for(;n<t;)o=n+e,yield r.slice(n,o),n=o},pc=async function*(r,e){for await(let t of hc(r))yield*dc(t,e)},hc=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}let e=r.getReader();try{for(;;){let{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},Vr=(r,e,t,n)=>{let o=pc(r,e),s=0,i,a=l=>{i||(i=!0,n&&n(l))};return new ReadableStream({async pull(l){try{let{done:c,value:u}=await o.next();if(c){a(),l.close();return}let f=u.byteLength;if(t){let h=s+=f;t(h)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),o.return()}},{highWaterMark:2})};var Vo=64*1024,{isFunction:qt}=d,gc=(({Request:r,Response:e})=>({Request:r,Response:e}))(d.global),{ReadableStream:Go,TextEncoder:Xo}=d.global,Yo=(r,...e)=>{try{return!!r(...e)}catch{return!1}},mc=r=>{r=d.merge.call({skipUndefined:!0},gc,r);let{fetch:e,Request:t,Response:n}=r,o=e?qt(e):typeof fetch=="function",s=qt(t),i=qt(n);if(!o)return!1;let a=o&&qt(Go),l=o&&(typeof Xo=="function"?(p=>w=>p.encode(w))(new Xo):async p=>new Uint8Array(await new t(p).arrayBuffer())),c=s&&a&&Yo(()=>{let p=!1,w=new t(P.origin,{body:new Go,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!w}),u=i&&a&&Yo(()=>d.isReadableStream(new n("").body)),f={stream:u&&(p=>p.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!f[p]&&(f[p]=(w,y)=>{let E=w&&w[p];if(E)return E.call(w);throw new R(`Response type \'${p}\' is not supported`,R.ERR_NOT_SUPPORT,y)})});let h=async p=>{if(p==null)return 0;if(d.isBlob(p))return p.size;if(d.isSpecCompliantForm(p))return(await new t(P.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(d.isArrayBufferView(p)||d.isArrayBuffer(p))return p.byteLength;if(d.isURLSearchParams(p)&&(p=p+""),d.isString(p))return(await l(p)).byteLength},m=async(p,w)=>{let y=d.toFiniteNumber(p.getContentLength());return y??h(w)};return async p=>{let{url:w,method:y,data:E,signal:T,cancelToken:A,timeout:_,onDownloadProgress:x,onUploadProgress:M,responseType:v,headers:U,withCredentials:C="same-origin",fetchOptions:ae}=Wt(p),ce=e||fetch;v=v?(v+"").toLowerCase():"text";let re=Jo([T,A&&A.toAbortSignal()],_),Pe=null,me=re&&re.unsubscribe&&(()=>{re.unsubscribe()}),rr;try{if(M&&c&&y!=="get"&&y!=="head"&&(rr=await m(U,E))!==0){let K=new t(w,{method:"POST",body:E,duplex:"half"}),ue;if(d.isFormData(E)&&(ue=K.headers.get("content-type"))&&U.setContentType(ue),K.body){let[Re,Ue]=qr(rr,ze(jr(M)));E=Vr(K.body,Vo,Re,Ue)}}d.isString(C)||(C=C?"include":"omit");let q=s&&"credentials"in t.prototype,nr={...ae,signal:re,method:y.toUpperCase(),headers:U.normalize().toJSON(),body:E,duplex:"half",credentials:q?C:void 0};Pe=s&&new t(w,nr);let le=await(s?ce(Pe,ae):ce(w,nr)),or=u&&(v==="stream"||v==="response");if(u&&(x||or&&me)){let K={};["status","statusText","headers"].forEach(bn=>{K[bn]=le[bn]});let ue=d.toFiniteNumber(le.headers.get("content-length")),[Re,Ue]=x&&qr(ue,ze(jr(x),!0))||[];le=new n(Vr(le.body,Vo,Re,()=>{Ue&&Ue(),me&&me()}),K)}v=v||"text";let O=await f[d.findKey(f,v)||"text"](le,p);return!or&&me&&me(),await new Promise((K,ue)=>{mt(K,ue,{data:O,headers:H.from(le.headers),status:le.status,statusText:le.statusText,config:p,request:Pe})})}catch(q){throw me&&me(),q&&q.name==="TypeError"&&/Load failed|fetch/i.test(q.message)?Object.assign(new R("Network Error",R.ERR_NETWORK,p,Pe,q&&q.response),{cause:q.cause||q}):R.from(q,q&&q.code,p,Pe,q&&q.response)}}},yc=new Map,Gr=r=>{let e=r&&r.env||{},{fetch:t,Request:n,Response:o}=e,s=[n,o,t],i=s.length,a=i,l,c,u=yc;for(;a--;)l=s[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:mc(e)),u=c;return c},cd=Gr();var Xr={http:Ft,xhr:zo,fetch:{get:Gr}};d.forEach(Xr,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});var Zo=r=>`- ${r}`,Sc=r=>d.isFunction(r)||r===null||r===!1;function Ec(r,e){r=d.isArray(r)?r:[r];let{length:t}=r,n,o,s={};for(let i=0;i<t;i++){n=r[i];let a;if(o=n,!Sc(n)&&(o=Xr[(a=String(n)).toLowerCase()],o===void 0))throw new R(`Unknown adapter \'${a}\'`);if(o&&(d.isFunction(o)||(o=o.get(e))))break;s[a||"#"+i]=o}if(!o){let i=Object.entries(s).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build")),a=t?i.length>1?`since :\n`+i.map(Zo).join(`\n`):" "+Zo(i[0]):"as no adapter specified";throw new R("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o}var jt={getAdapter:Ec,adapters:Xr};function Yr(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new se(null,r)}function zt(r){return Yr(r),r.headers=H.from(r.headers),r.data=ht.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),jt.getAdapter(r.adapter||qe.adapter,r)(r).then(function(n){return Yr(r),n.data=ht.call(r,r.transformResponse,n),n.headers=H.from(n.headers),n},function(n){return gt(n)||(Yr(r),n&&n.response&&(n.response.data=ht.call(r,r.transformResponse,n.response),n.response.headers=H.from(n.response.headers))),Promise.reject(n)})}var Jt="1.13.5";var Vt={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{Vt[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});var Qo={};Vt.transitional=function(e,t,n){function o(s,i){return"[Axios v"+Jt+"] Transitional option \'"+s+"\'"+i+(n?". "+n:"")}return(s,i,a)=>{if(e===!1)throw new R(o(i," has been removed"+(t?" in "+t:"")),R.ERR_DEPRECATED);return t&&!Qo[i]&&(Qo[i]=!0,console.warn(o(i," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,i,a):!0}};Vt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function bc(r,e,t){if(typeof r!="object")throw new R("options must be an object",R.ERR_BAD_OPTION_VALUE);let n=Object.keys(r),o=n.length;for(;o-- >0;){let s=n[o],i=e[s];if(i){let a=r[s],l=a===void 0||i(a,s,r);if(l!==!0)throw new R("option "+s+" must be "+l,R.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new R("Unknown option "+s,R.ERR_BAD_OPTION)}}var wt={assertOptions:bc,validators:Vt};var Z=wt.validators,Je=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Dr,response:new Dr}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;let s=o.stack?o.stack.replace(/^.+\\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\\n.+\\n/,""))&&(n.stack+=`\n`+s):n.stack=s}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=ee(this.defaults,t);let{transitional:n,paramsSerializer:o,headers:s}=t;n!==void 0&&wt.assertOptions(n,{silentJSONParsing:Z.transitional(Z.boolean),forcedJSONParsing:Z.transitional(Z.boolean),clarifyTimeoutError:Z.transitional(Z.boolean),legacyInterceptorReqResOrdering:Z.transitional(Z.boolean)},!1),o!=null&&(d.isFunction(o)?t.paramsSerializer={serialize:o}:wt.assertOptions(o,{encode:Z.function,serialize:Z.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),wt.assertOptions(t,{baseUrl:Z.spelling("baseURL"),withXsrfToken:Z.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=s&&d.merge(s.common,s[t.method]);s&&d.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),t.headers=H.concat(i,s);let a=[],l=!0;this.interceptors.request.forEach(function(w){if(typeof w.runWhen=="function"&&w.runWhen(t)===!1)return;l=l&&w.synchronous;let y=t.transitional||We;y&&y.legacyInterceptorReqResOrdering?a.unshift(w.fulfilled,w.rejected):a.push(w.fulfilled,w.rejected)});let c=[];this.interceptors.response.forEach(function(w){c.push(w.fulfilled,w.rejected)});let u,f=0,h;if(!l){let p=[zt.bind(this),void 0];for(p.unshift(...a),p.push(...c),h=p.length,u=Promise.resolve(t);f<h;)u=u.then(p[f++],p[f++]);return u}h=a.length;let m=t;for(;f<h;){let p=a[f++],w=a[f++];try{m=p(m)}catch(y){w.call(this,y);break}}try{u=zt.call(this,m)}catch(p){return Promise.reject(p)}for(f=0,h=c.length;f<h;)u=u.then(c[f++],c[f++]);return u}getUri(e){e=ee(this.defaults,e);let t=yt(e.baseURL,e.url,e.allowAbsoluteUrls);return dt(t,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){Je.prototype[e]=function(t,n){return this.request(ee(n||{},{method:e,url:t,data:(n||{}).data}))}});d.forEach(["post","put","patch"],function(e){function t(n){return function(s,i,a){return this.request(ee(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}Je.prototype[e]=t(),Je.prototype[e+"Form"]=t(!0)});var St=Je;var Zr=class r{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(s){t=s});let n=this;this.promise.then(o=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](o);n._listeners=null}),this.promise.then=o=>{let s,i=new Promise(a=>{n.subscribe(a),s=a}).then(o);return i.cancel=function(){n.unsubscribe(s)},i},e(function(s,i,a){n.reason||(n.reason=new se(s,i,a),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=n=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new r(function(o){e=o}),cancel:e}}},es=Zr;function Qr(r){return function(t){return r.apply(null,t)}}function en(r){return d.isObject(r)&&r.isAxiosError===!0}var tn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(tn).forEach(([r,e])=>{tn[e]=r});var ts=tn;function rs(r){let e=new St(r),t=ct(St.prototype.request,e);return d.extend(t,St.prototype,e,{allOwnKeys:!0}),d.extend(t,e,null,{allOwnKeys:!0}),t.create=function(o){return rs(ee(r,o))},t}var B=rs(qe);B.Axios=St;B.CanceledError=se;B.CancelToken=es;B.isCancel=gt;B.VERSION=Jt;B.toFormData=be;B.AxiosError=R;B.Cancel=B.CanceledError;B.all=function(e){return Promise.all(e)};B.spread=Qr;B.isAxiosError=en;B.mergeConfig=ee;B.AxiosHeaders=H;B.formToJSON=r=>$t(d.isHTMLForm(r)?new FormData(r):r);B.getAdapter=jt.getAdapter;B.HttpStatusCode=ts;B.default=B;var Ve=B;var{Axios:ip,AxiosError:ap,CanceledError:cp,isCancel:lp,CancelToken:up,VERSION:fp,all:dp,Cancel:pp,isAxiosError:hp,spread:gp,toFormData:mp,AxiosHeaders:yp,HttpStatusCode:wp,formToJSON:Sp,getAdapter:Ep,mergeConfig:bp}=Ve;function ns(){return r=>r}var D=class{constructor(){S(this,"attachToken",()=>Promise.resolve());S(this,"requestStartCallback",()=>null);S(this,"requestSuccessCallback",()=>null);S(this,"requestErrorCallback",()=>null);S(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=Ve.create({withCredentials:!0}),this.clientInstance||(this.clientInstance=new D),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=Ve.all,this.axiosInstance.spread=Ve.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(o=>{n.append(o,t[o])}),e.data=n}return e.startTimeInMs=new Date().getTime(),D.isHandlerEnabled&&this.requestStartCallback&&typeof this.requestStartCallback=="function"&&this.requestStartCallback(e),e}errorHandler(e){throw D.isHandlerEnabled&&(this.requestErrorCallback&&typeof this.requestErrorCallback=="function"&&this.requestErrorCallback(e),this.requestFinishCallback&&typeof this.requestFinishCallback=="function"&&this.requestFinishCallback()),e}successHandler(e){return D.isHandlerEnabled&&(this.requestSuccessCallback&&typeof this.requestSuccessCallback=="function"&&this.requestSuccessCallback(e),this.requestFinishCallback&&typeof this.requestFinishCallback=="function"&&this.requestFinishCallback()),e}async init(e=!0,t){D.isHandlerEnabled=e,this.attachToken=t}enableHandler(){D.isHandlerEnabled=!0}disableHandler(){D.isHandlerEnabled=!1}disableHandlerWithTimeout(e=D.DEFAULT_HANDLER_DISABLE_TIMEOUT){D.isHandlerEnabled=!1,setTimeout(()=>{D.isHandlerEnabled=!0},e)}setHttpRequestStartCallback(e){this.requestStartCallback=e}setHttpRequestSuccessCallback(e){this.requestSuccessCallback=e}setHttpRequestErrorCallback(e){this.requestErrorCallback=e}setHttpRequestFinishCallback(e){this.requestFinishCallback=e}};S(D,"axiosInstance"),S(D,"clientInstance"),S(D,"isHandlerEnabled"),S(D,"DEFAULT_HANDLER_DISABLE_TIMEOUT",1e3),D=In([ns()],D);var Gt=class{constructor(){S(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 $s=nt(Pt(),1);var En=nt(as(),1),Ks=nt(ls(),1);var Xe=new TextEncoder,he=new TextDecoder,Gp=2**32;function us(...r){let e=r.reduce((o,{length:s})=>o+s,0),t=new Uint8Array(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return t}function fs(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 Te(r){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof r=="string"?r:he.decode(r),{alphabet:"base64url"});let e=r;e instanceof Uint8Array&&(e=he.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/\\s/g,"");try{return fs(e)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}var G=class extends Error{constructor(t,n){super(t,n);S(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};S(G,"code","ERR_JOSE_GENERIC");var V=class extends G{constructor(t,n,o="unspecified",s="unspecified"){super(t,{cause:{claim:o,reason:s,payload:n}});S(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");S(this,"claim");S(this,"reason");S(this,"payload");this.claim=o,this.reason=s,this.payload=n}};S(V,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");var Ye=class extends G{constructor(t,n,o="unspecified",s="unspecified"){super(t,{cause:{claim:o,reason:s,payload:n}});S(this,"code","ERR_JWT_EXPIRED");S(this,"claim");S(this,"reason");S(this,"payload");this.claim=o,this.reason=s,this.payload=n}};S(Ye,"code","ERR_JWT_EXPIRED");var Et=class extends G{constructor(){super(...arguments);S(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}};S(Et,"code","ERR_JOSE_ALG_NOT_ALLOWED");var W=class extends G{constructor(){super(...arguments);S(this,"code","ERR_JOSE_NOT_SUPPORTED")}};S(W,"code","ERR_JOSE_NOT_SUPPORTED");var k=class extends G{constructor(){super(...arguments);S(this,"code","ERR_JWS_INVALID")}};S(k,"code","ERR_JWS_INVALID");var Oe=class extends G{constructor(){super(...arguments);S(this,"code","ERR_JWT_INVALID")}};S(Oe,"code","ERR_JWT_INVALID");var Ze=class extends G{constructor(){super(...arguments);S(this,"code","ERR_JWKS_INVALID")}};S(Ze,"code","ERR_JWKS_INVALID");var bt=class extends G{constructor(t="no applicable key found in the JSON Web Key Set",n){super(t,n);S(this,"code","ERR_JWKS_NO_MATCHING_KEY")}};S(bt,"code","ERR_JWKS_NO_MATCHING_KEY");var ds,ps,Tt=class extends(ps=G,ds=Symbol.asyncIterator,ps){constructor(t="multiple matching keys found in the JSON Web Key Set",n){super(t,n);S(this,ds);S(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}};S(Tt,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");var Rt=class extends G{constructor(t="signature verification failed",n){super(t,n);S(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}};S(Rt,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function ge(r,e="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${r}`)}function It(r,e){return r.name===e}function an(r){return parseInt(r.name.slice(4),10)}function vc(r){switch(r){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function Oc(r,e){if(e&&!r.usages.includes(e))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${e}.`)}function hs(r,e,t){switch(e){case"HS256":case"HS384":case"HS512":{if(!It(r.algorithm,"HMAC"))throw ge("HMAC");let n=parseInt(e.slice(2),10);if(an(r.algorithm.hash)!==n)throw ge(`SHA-${n}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!It(r.algorithm,"RSASSA-PKCS1-v1_5"))throw ge("RSASSA-PKCS1-v1_5");let n=parseInt(e.slice(2),10);if(an(r.algorithm.hash)!==n)throw ge(`SHA-${n}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!It(r.algorithm,"RSA-PSS"))throw ge("RSA-PSS");let n=parseInt(e.slice(2),10);if(an(r.algorithm.hash)!==n)throw ge(`SHA-${n}`,"algorithm.hash");break}case"Ed25519":case"EdDSA":{if(!It(r.algorithm,"Ed25519"))throw ge("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!It(r.algorithm,"ECDSA"))throw ge("ECDSA");let n=vc(e);if(r.algorithm.namedCurve!==n)throw ge(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}Oc(r,t)}function gs(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 ms=(r,...e)=>gs("Key must be ",r,...e);function cn(r,e,...t){return gs(`Key for the ${r} algorithm must be `,e,...t)}function ln(r){return r?.[Symbol.toStringTag]==="CryptoKey"}function un(r){return r?.[Symbol.toStringTag]==="KeyObject"}var fn=r=>ln(r)||un(r);var ys=(...r)=>{let e=r.filter(Boolean);if(e.length===0||e.length===1)return!0;let t;for(let n of e){let o=Object.keys(n);if(!t||t.size===0){t=new Set(o);continue}for(let s of o){if(t.has(s))return!1;t.add(s)}}return!0};function Cc(r){return typeof r=="object"&&r!==null}var te=r=>{if(!Cc(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 ws=(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 Pc(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 W(\'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 W(\'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 W(\'Invalid or unsupported JWK "alg" (Algorithm) Parameter value\')}break}default:throw new W(\'Invalid or unsupported JWK "kty" (Key Type) Parameter value\')}return{algorithm:e,keyUsages:t}}var Zt=async r=>{if(!r.alg)throw new TypeError(\'"alg" argument is required when "jwk.alg" is not present\');let{algorithm:e,keyUsages:t}=Pc(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 Ss(r,e,t){if(!te(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 Te(r.k);case"RSA":if("oth"in r&&r.oth!==void 0)throw new W(\'RSA JWK "oth" (Other Primes Info) Parameter value is not supported\');case"EC":case"OKP":return Zt({...r,alg:e,ext:n});default:throw new W(\'Unsupported "kty" (Key Type) Parameter value\')}}var Es=(r,e,t,n,o)=>{if(o.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 s;t!==void 0?s=new Map([...Object.entries(t),...e.entries()]):s=e;for(let i of n.crit){if(!s.has(i))throw new W(`Extension Header Parameter "${i}" is not recognized`);if(o[i]===void 0)throw new r(`Extension Header Parameter "${i}" is missing`);if(s.get(i)&&n[i]===void 0)throw new r(`Extension Header Parameter "${i}" MUST be integrity protected`)}return new Set(n.crit)};var bs=(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 xt(r){return te(r)&&typeof r.kty=="string"}function Ts(r){return r.kty!=="oct"&&typeof r.d=="string"}function Rs(r){return r.kty!=="oct"&&typeof r.d>"u"}function Is(r){return r.kty==="oct"&&typeof r.k=="string"}var Qe,xs=async(r,e,t,n=!1)=>{Qe||(Qe=new WeakMap);let o=Qe.get(r);if(o?.[t])return o[t];let s=await Zt({...e,alg:t});return n&&Object.freeze(r),o?o[t]=s:Qe.set(r,{[t]:s}),s},kc=(r,e)=>{Qe||(Qe=new WeakMap);let t=Qe.get(r);if(t?.[e])return t[e];let n=r.type==="public",o=!!n,s;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")}s=r.toCryptoKey(r.asymmetricKeyType,o,n?[]:["deriveBits"])}if(r.asymmetricKeyType==="ed25519"){if(e!=="EdDSA"&&e!=="Ed25519")throw new TypeError("given KeyObject instance cannot be used for this algorithm");s=r.toCryptoKey(r.asymmetricKeyType,o,[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},o,n?["encrypt"]:["decrypt"]);s=r.toCryptoKey({name:e.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:i},o,[n?"verify":"sign"])}if(r.asymmetricKeyType==="ec"){let a=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(r.asymmetricKeyDetails?.namedCurve);if(!a)throw new TypeError("given KeyObject instance cannot be used for this algorithm");e==="ES256"&&a==="P-256"&&(s=r.toCryptoKey({name:"ECDSA",namedCurve:a},o,[n?"verify":"sign"])),e==="ES384"&&a==="P-384"&&(s=r.toCryptoKey({name:"ECDSA",namedCurve:a},o,[n?"verify":"sign"])),e==="ES512"&&a==="P-521"&&(s=r.toCryptoKey({name:"ECDSA",namedCurve:a},o,[n?"verify":"sign"])),e.startsWith("ECDH-ES")&&(s=r.toCryptoKey({name:"ECDH",namedCurve:a},o,n?[]:["deriveBits"]))}if(!s)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return t?t[e]=s:Qe.set(r,{[e]:s}),s},As=async(r,e)=>{if(r instanceof Uint8Array||ln(r))return r;if(un(r)){if(r.type==="secret")return r.export();if("toCryptoKey"in r&&typeof r.toCryptoKey=="function")try{return kc(r,e)}catch(n){if(n instanceof TypeError)throw n}let t=r.export({format:"jwk"});return xs(r,t,e)}if(xt(r))return r.k?Te(r.k):xs(r,r,e,!0);throw new Error("unreachable")};var et=r=>r?.[Symbol.toStringTag],dn=(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},Nc=(r,e,t)=>{if(!(e instanceof Uint8Array)){if(xt(e)){if(Is(e)&&dn(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(!fn(e))throw new TypeError(cn(r,e,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(e.type!=="secret")throw new TypeError(`${et(e)} instances for symmetric algorithms must be of type "secret"`)}},Dc=(r,e,t)=>{if(xt(e))switch(t){case"decrypt":case"sign":if(Ts(e)&&dn(r,e,t))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if(Rs(e)&&dn(r,e,t))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!fn(e))throw new TypeError(cn(r,e,"CryptoKey","KeyObject","JSON Web Key"));if(e.type==="secret")throw new TypeError(`${et(e)} instances for asymmetric algorithms must not be of type "secret"`);if(e.type==="public")switch(t){case"sign":throw new TypeError(`${et(e)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw new TypeError(`${et(e)} instances for asymmetric algorithm decryption must be of type "private"`);default:break}if(e.type==="private")switch(t){case"verify":throw new TypeError(`${et(e)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw new TypeError(`${et(e)} instances for asymmetric algorithm encryption must be of type "public"`);default:break}},_s=(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)?Nc(r,e,t):Dc(r,e,t)};var vs=(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 W(`alg ${r} is not supported either by JOSE or your javascript runtime`)}};var Os=async(r,e,t)=>{if(e instanceof Uint8Array){if(!r.startsWith("HS"))throw new TypeError(ms(e,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",e,{hash:`SHA-${r.slice(-3)}`,name:"HMAC"},!1,[t])}return hs(e,r,t),e};var Cs=async(r,e,t,n)=>{let o=await Os(r,e,"verify");ws(r,o);let s=vs(r,o.algorithm);try{return await crypto.subtle.verify(s,o,t,n)}catch{return!1}};async function Ps(r,e,t){if(!te(r))throw new k("Flattened JWS must be an object");if(r.protected===void 0&&r.header===void 0)throw new k(\'Flattened JWS must have either of the "protected" or "header" members\');if(r.protected!==void 0&&typeof r.protected!="string")throw new k("JWS Protected Header incorrect type");if(r.payload===void 0)throw new k("JWS Payload missing");if(typeof r.signature!="string")throw new k("JWS Signature missing or incorrect type");if(r.header!==void 0&&!te(r.header))throw new k("JWS Unprotected Header incorrect type");let n={};if(r.protected)try{let y=Te(r.protected);n=JSON.parse(he.decode(y))}catch{throw new k("JWS Protected Header is invalid")}if(!ys(n,r.header))throw new k("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let o={...n,...r.header},s=Es(k,new Map([["b64",!0]]),t?.crit,n,o),i=!0;if(s.has("b64")&&(i=n.b64,typeof i!="boolean"))throw new k(\'The "b64" (base64url-encode payload) Header Parameter must be a boolean\');let{alg:a}=o;if(typeof a!="string"||!a)throw new k(\'JWS "alg" (Algorithm) Header Parameter missing or invalid\');let l=t&&bs("algorithms",t.algorithms);if(l&&!l.has(a))throw new Et(\'"alg" (Algorithm) Header Parameter value not allowed\');if(i){if(typeof r.payload!="string")throw new k("JWS Payload must be a string")}else if(typeof r.payload!="string"&&!(r.payload instanceof Uint8Array))throw new k("JWS Payload must be a string or an Uint8Array instance");let c=!1;typeof e=="function"&&(e=await e(n,r),c=!0),_s(a,e,"verify");let u=us(Xe.encode(r.protected??""),Xe.encode("."),typeof r.payload=="string"?Xe.encode(r.payload):r.payload),f;try{f=Te(r.signature)}catch{throw new k("Failed to base64url decode the signature")}let h=await As(e,a);if(!await Cs(a,h,f,u))throw new Rt;let p;if(i)try{p=Te(r.payload)}catch{throw new k("Failed to base64url decode the payload")}else typeof r.payload=="string"?p=Xe.encode(r.payload):p=r.payload;let w={payload:p};return r.protected!==void 0&&(w.protectedHeader=n),r.header!==void 0&&(w.unprotectedHeader=r.header),c?{...w,key:h}:w}async function Us(r,e,t){if(r instanceof Uint8Array&&(r=he.decode(r)),typeof r!="string")throw new k("Compact JWS must be a string or Uint8Array");let{0:n,1:o,2:s,length:i}=r.split(".");if(i!==3)throw new k("Invalid Compact JWS");let a=await Ps({payload:o,protected:n,signature:s},e,t),l={payload:a.payload,protectedHeader:a.protectedHeader};return typeof e=="function"?{...l,key:a.key}:l}var ks=r=>Math.floor(r.getTime()/1e3);var Bc=/^(\\+|\\-)? ?(\\d+|\\d+\\.\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,pn=r=>{let e=Bc.exec(r);if(!e||e[4]&&e[1])throw new TypeError("Invalid time period format");let t=parseFloat(e[2]),n=e[3].toLowerCase(),o;switch(n){case"sec":case"secs":case"second":case"seconds":case"s":o=Math.round(t);break;case"minute":case"minutes":case"min":case"mins":case"m":o=Math.round(t*60);break;case"hour":case"hours":case"hr":case"hrs":case"h":o=Math.round(t*3600);break;case"day":case"days":case"d":o=Math.round(t*86400);break;case"week":case"weeks":case"w":o=Math.round(t*604800);break;default:o=Math.round(t*31557600);break}return e[1]==="-"||e[4]==="ago"?-o:o};var Ns=r=>r.includes("/")?r.toLowerCase():`application/${r.toLowerCase()}`,Mc=(r,e)=>typeof r=="string"?e.includes(r):Array.isArray(r)?e.some(Set.prototype.has.bind(new Set(r))):!1;function Ds(r,e,t={}){let n;try{n=JSON.parse(he.decode(e))}catch{}if(!te(n))throw new Oe("JWT Claims Set must be a top-level JSON object");let{typ:o}=t;if(o&&(typeof r.typ!="string"||Ns(r.typ)!==Ns(o)))throw new V(\'unexpected "typ" JWT header value\',n,"typ","check_failed");let{requiredClaims:s=[],issuer:i,subject:a,audience:l,maxTokenAge:c}=t,u=[...s];c!==void 0&&u.push("iat"),l!==void 0&&u.push("aud"),a!==void 0&&u.push("sub"),i!==void 0&&u.push("iss");for(let p of new Set(u.reverse()))if(!(p in n))throw new V(`missing required "${p}" claim`,n,p,"missing");if(i&&!(Array.isArray(i)?i:[i]).includes(n.iss))throw new V(\'unexpected "iss" claim value\',n,"iss","check_failed");if(a&&n.sub!==a)throw new V(\'unexpected "sub" claim value\',n,"sub","check_failed");if(l&&!Mc(n.aud,typeof l=="string"?[l]:l))throw new V(\'unexpected "aud" claim value\',n,"aud","check_failed");let f;switch(typeof t.clockTolerance){case"string":f=pn(t.clockTolerance);break;case"number":f=t.clockTolerance;break;case"undefined":f=0;break;default:throw new TypeError("Invalid clockTolerance option type")}let{currentDate:h}=t,m=ks(h||new Date);if((n.iat!==void 0||c)&&typeof n.iat!="number")throw new V(\'"iat" claim must be a number\',n,"iat","invalid");if(n.nbf!==void 0){if(typeof n.nbf!="number")throw new V(\'"nbf" claim must be a number\',n,"nbf","invalid");if(n.nbf>m+f)throw new V(\'"nbf" claim timestamp check failed\',n,"nbf","check_failed")}if(n.exp!==void 0){if(typeof n.exp!="number")throw new V(\'"exp" claim must be a number\',n,"exp","invalid");if(n.exp<=m-f)throw new Ye(\'"exp" claim timestamp check failed\',n,"exp","check_failed")}if(c){let p=m-n.iat,w=typeof c=="number"?c:pn(c);if(p-f>w)throw new Ye(\'"iat" claim timestamp check failed (too far in the past)\',n,"iat","check_failed");if(p<0-f)throw new V(\'"iat" claim timestamp check failed (it should be in the past)\',n,"iat","check_failed")}return n}async function hn(r,e,t){let n=await Us(r,e,t);if(n.protectedHeader.crit?.includes("b64")&&n.protectedHeader.b64===!1)throw new Oe("JWTs MUST NOT use unencoded payload");let s={payload:Ds(n.protectedHeader,n.payload,t),protectedHeader:n.protectedHeader};return typeof e=="function"?{...s,key:n.key}:s}function Hc(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 W(\'Unsupported "alg" value for a JSON Web Key Set\')}}function Fc(r){return r&&typeof r=="object"&&Array.isArray(r.keys)&&r.keys.every(Lc)}function Lc(r){return te(r)}var tt,At,gn=class{constructor(e){_t(this,tt);_t(this,At,new WeakMap);if(!Fc(e))throw new Ze("JSON Web Key Set malformed");sr(this,tt,structuredClone(e))}jwks(){return ke(this,tt)}async getKey(e,t){let{alg:n,kid:o}={...e,...t?.header},s=Hc(n),i=ke(this,tt).keys.filter(c=>{let u=s===c.kty;if(u&&typeof o=="string"&&(u=o===c.kid),u&&typeof c.alg=="string"&&(u=n===c.alg),u&&typeof c.use=="string"&&(u=c.use==="sig"),u&&Array.isArray(c.key_ops)&&(u=c.key_ops.includes("verify")),u)switch(n){case"ES256":u=c.crv==="P-256";break;case"ES384":u=c.crv==="P-384";break;case"ES512":u=c.crv==="P-521";break;case"Ed25519":case"EdDSA":u=c.crv==="Ed25519";break}return u}),{0:a,length:l}=i;if(l===0)throw new bt;if(l!==1){let c=new Tt,u=ke(this,At);throw c[Symbol.asyncIterator]=async function*(){for(let f of i)try{yield await Bs(u,f,n)}catch{}},c}return Bs(ke(this,At),a,n)}};tt=new WeakMap,At=new WeakMap;async function Bs(r,e,t){let n=r.get(e)||r.set(e,{}).get(e);if(n[t]===void 0){let o=await Ss({...e,ext:!0},t);if(o instanceof Uint8Array||o.type!=="public")throw new Ze("JSON Web Key Set members must be public keys");n[t]=o}return n[t]}function mn(r){let e=new gn(r),t=async(n,o)=>e.getKey(n,o);return Object.defineProperties(t,{jwks:{value:()=>structuredClone(e.jwks()),enumerable:!1,configurable:!1,writable:!1}}),t}var Ws=nt(Ls(),1),tr=class{base64URLEncode(e){return En.default.encode(e).replace(/\\+/g,"-").replace(/\\//g,"_").replace(/=/g,"")}base64URLDecode(e){return En.default.decode(e).toString()}hashSha256(e){return $s.Buffer.from((0,Ks.default)(new TextEncoder().encode(e)))}generateRandomBytes(e){return(0,Ws.default)(e)}verifyJwt(e,t,n,o,s,i,a,l){let c={algorithms:n,audience:o,clockTolerance:a,subject:i};return(l??!0)&&(c.issuer=s),hn(e,mn({keys:[t]}),c).then(()=>Promise.resolve(!0)).catch(u=>Promise.reject(new I("SPA-CRYPTO-UTILS-VJ-IV01",u?.reason??JSON.stringify(u),`${u?.code} ${u?.claim}`)))}};var qs=async(r,e)=>{let t=new Gt,n=new tr,o=new _e;await o.initialize(r,t,n);let s=new Nt(o),i=e(o,s),a=o.getStorageManager(),l=D.getInstance(),c=async O=>{await i.attachTokenToRequestConfig(O)};return l?.init&&await l.init(!0,c),{disableHttpHandler:()=>{i.disableHttpHandler(l)},enableHttpHandler:()=>{i.enableHttpHandler(l)},getAccessToken:()=>i.getAccessToken(),getSignInUrl:async O=>o.getSignInUrl(O).then(async K=>{let Re=new URL(K).searchParams.get($.Params.STATE)??"",Ue=await o.getPKCECode(Re);return{authorizationURL:K,pkce:Ue}}).catch(K=>Promise.reject(K)),getUser:async()=>i.getUser(),getConfigData:async()=>a.getConfigData(),getCrypto:async()=>i.getCrypto(),getDecodedIDPIDToken:async()=>i.getDecodedIDPIDToken(),getDecodedIdToken:async O=>i.getDecodedIdToken(O),getIdToken:async()=>i.getIdToken(),getOpenIDProviderEndpoints:async()=>i.getOpenIDProviderEndpoints(),getSignOutUrl:async()=>await o.getSignOutUrl(),httpRequest:async O=>await i.httpRequest(l,O),httpRequestAll:async O=>await i.httpRequestAll(O,l),isSignedIn:()=>i.isSignedIn(),refreshAccessToken:async()=>{try{return await i.refreshAccessToken()}catch(O){return Promise.reject(O)}},requestAccessToken:async(O,K,ue,Re)=>await i.requestAccessToken(O,K,void 0,ue,Re),exchangeToken:async O=>await i.exchangeToken(O),revokeAccessToken:async()=>{let O=await s.getRefreshTimeoutTimer();return o.revokeAccessToken().then(()=>(s.clearRefreshTokenTimeout(O),Promise.resolve(!0))).catch(K=>Promise.reject(K))},setHttpRequestFinishCallback:O=>{l?.setHttpRequestFinishCallback&&l.setHttpRequestFinishCallback(O)},setHttpRequestStartCallback:O=>{l?.setHttpRequestStartCallback&&l.setHttpRequestStartCallback(O)},setHttpRequestSuccessCallback:O=>{l?.setHttpRequestSuccessCallback&&l.setHttpRequestSuccessCallback(O)},setSessionState:async O=>{await a.setSessionDataParameter($.Params.SESSION_STATE,O)},signOut:async()=>(s.clearRefreshTokenTimeout(),await o.getSignOutUrl()),startAutoRefreshToken:async()=>{s.clearRefreshTokenTimeout(),s.refreshAccessTokenAutomatically(i)},reInitialize:async O=>{await o.reInitialize(O)}}};var js=r=>{let e=self,t;e.onmessage=async({data:i,ports:a})=>{let l=a[0];if(i.type!==Er&&!t){l.postMessage(b.generateFailureMessage(new I("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 Er:try{let c={...i.data};t=await qs(c,r),t.setHttpRequestFinishCallback(s),t.setHttpRequestStartCallback(n),t.setHttpRequestSuccessCallback(o),l.postMessage(b.generateSuccessMessage())}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case uo:t.getSignInUrl(i?.data).then(c=>{l.postMessage(b.generateSuccessMessage(c))}).catch(c=>{l.postMessage(b.generateFailureMessage(c))});break;case fo:t.requestAccessToken(i?.data?.code,i?.data?.sessionState,i?.data?.pkce,i?.data?.state).then(c=>{l.postMessage(b.generateSuccessMessage(c))}).catch(c=>{l.postMessage(b.generateFailureMessage(c))});break;case Yn:{let c=i.data,u=c?.data;if(i.data?.data?.formData===!0){let f=new FormData;for(let h in u)h!=="formData"&&f.append(h,u[h]);c.data=f}t.httpRequest(c).then(f=>{l.postMessage(b.generateSuccessMessage(f))}).catch(f=>{l.postMessage(b.generateFailureMessage(f))});break}case Zn:t.httpRequestAll(i.data).then(c=>{l.postMessage(b.generateSuccessMessage(c))}).catch(c=>{l.postMessage(b.generateFailureMessage(c))});break;case Xn:try{l.postMessage(b.generateSuccessMessage(await t.signOut()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case Qn:t.exchangeToken(i.data).then(c=>{l.postMessage(b.generateSuccessMessage(c))}).catch(c=>{l.postMessage(b.generateFailureMessage(c))});break;case eo:t.revokeAccessToken().then(c=>{l.postMessage(b.generateSuccessMessage(c))}).catch(c=>{l.postMessage(b.generateFailureMessage(c))});break;case oo:try{l.postMessage(b.generateSuccessMessage(await t.getOpenIDProviderEndpoints()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case so:try{l.postMessage(b.generateSuccessMessage(await t.getUser()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case io:try{l.postMessage(b.generateSuccessMessage(await t.getDecodedIdToken()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case ao:try{l.postMessage(b.generateSuccessMessage(await t.getCrypto()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case Eo:try{l.postMessage(b.generateSuccessMessage(await t.getIdToken()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case co:t.enableHttpHandler(),l.postMessage(b.generateSuccessMessage());break;case lo:t.disableHttpHandler(),l.postMessage(b.generateSuccessMessage());break;case po:try{l.postMessage(b.generateSuccessMessage(await t.isSignedIn()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case ho:try{l.postMessage(b.generateSuccessMessage(await t.getSignOutUrl()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case go:try{l.postMessage(b.generateSuccessMessage(await t.refreshAccessToken()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case wo:try{l.postMessage(b.generateSuccessMessage(t.startAutoRefreshToken()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case yo:try{l.postMessage(b.generateSuccessMessage(await t.setSessionState(i?.data)))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case So:try{l.postMessage(b.generateSuccessMessage(await t.reInitialize(i?.data)))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;case bo:try{l.postMessage(b.generateSuccessMessage(await t.getConfigData()))}catch(c){l.postMessage(b.generateFailureMessage(c))}break;default:l?.postMessage(b.generateFailureMessage(new I("SPA-CLIENT_WORKER-ONMSG-IV02","The message type is invalid.",`The message type provided, ${i.type}, is invalid.`)))}};let n=()=>{e.postMessage({type:to})},o=i=>{e.postMessage({data:JSON.stringify(i??""),type:ro})},s=()=>{e.postMessage({type:no})}};typeof self<"u"&&!self.Buffer&&(self.Buffer=zs.Buffer);typeof self<"u"&&(self.global||(self.global=self));js((r,e)=>new kt(r,e));var em={};})();\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');
|
|
1933
1934
|
}
|
|
1934
1935
|
|
|
1935
1936
|
// src/__legacy__/clients/main-thread-client.ts
|
|
@@ -2499,8 +2500,7 @@ import axios from "axios";
|
|
|
2499
2500
|
|
|
2500
2501
|
// src/__legacy__/http-client/helpers/decorators.ts
|
|
2501
2502
|
function staticDecorator() {
|
|
2502
|
-
return (
|
|
2503
|
-
};
|
|
2503
|
+
return (constructor) => constructor;
|
|
2504
2504
|
}
|
|
2505
2505
|
|
|
2506
2506
|
// src/__legacy__/http-client/clients/axios-http-client.ts
|
|
@@ -4079,6 +4079,10 @@ var WebWorkerClient = async (instanceID, config, webWorker, getAuthHelper) => {
|
|
|
4079
4079
|
};
|
|
4080
4080
|
|
|
4081
4081
|
// src/__legacy__/client.ts
|
|
4082
|
+
var logger = createPackageComponentLogger(
|
|
4083
|
+
"@asgardeo/browser",
|
|
4084
|
+
"AsgardeoSPAClient"
|
|
4085
|
+
);
|
|
4082
4086
|
var DefaultConfig = {
|
|
4083
4087
|
autoLogoutOnTokenRefreshError: false,
|
|
4084
4088
|
checkSessionInterval: 3,
|
|
@@ -4137,7 +4141,7 @@ var _AsgardeoSPAClient = class _AsgardeoSPAClient {
|
|
|
4137
4141
|
};
|
|
4138
4142
|
while (!this._initialized) {
|
|
4139
4143
|
if (iterationToWait === 1e4) {
|
|
4140
|
-
|
|
4144
|
+
logger.warn("It is taking longer than usual for the object to be initialized");
|
|
4141
4145
|
}
|
|
4142
4146
|
await sleep();
|
|
4143
4147
|
iterationToWait++;
|
|
@@ -5462,6 +5466,11 @@ var AsgardeoBrowserClient_default = AsgardeoBrowserClient;
|
|
|
5462
5466
|
export * from "@asgardeo/javascript";
|
|
5463
5467
|
|
|
5464
5468
|
// src/theme/themeDetection.ts
|
|
5469
|
+
import { createPackageComponentLogger as createPackageComponentLogger2 } from "@asgardeo/javascript";
|
|
5470
|
+
var logger2 = createPackageComponentLogger2(
|
|
5471
|
+
"@asgardeo/browser",
|
|
5472
|
+
"ThemeDetection"
|
|
5473
|
+
);
|
|
5465
5474
|
var detectThemeMode = (mode, config = {}) => {
|
|
5466
5475
|
const {
|
|
5467
5476
|
darkClass = "dark",
|
|
@@ -5478,10 +5487,10 @@ var detectThemeMode = (mode, config = {}) => {
|
|
|
5478
5487
|
}
|
|
5479
5488
|
if (mode === "class") {
|
|
5480
5489
|
if (!targetElement) {
|
|
5481
|
-
|
|
5490
|
+
logger2.warn("ThemeDetection: targetElement is required for class-based detection, falling back to light mode");
|
|
5482
5491
|
return "light";
|
|
5483
5492
|
}
|
|
5484
|
-
const classList = targetElement
|
|
5493
|
+
const { classList } = targetElement;
|
|
5485
5494
|
if (classList.contains(darkClass)) {
|
|
5486
5495
|
return "dark";
|
|
5487
5496
|
}
|
|
@@ -5497,7 +5506,7 @@ var createClassObserver = (targetElement, callback, config = {}) => {
|
|
|
5497
5506
|
const observer = new MutationObserver((mutations) => {
|
|
5498
5507
|
mutations.forEach((mutation) => {
|
|
5499
5508
|
if (mutation.type === "attributes" && mutation.attributeName === "class") {
|
|
5500
|
-
const classList = targetElement
|
|
5509
|
+
const { classList } = targetElement;
|
|
5501
5510
|
if (classList.contains(darkClass)) {
|
|
5502
5511
|
callback(true);
|
|
5503
5512
|
} else if (classList.contains(lightClass)) {
|
|
@@ -5507,8 +5516,8 @@ var createClassObserver = (targetElement, callback, config = {}) => {
|
|
|
5507
5516
|
});
|
|
5508
5517
|
});
|
|
5509
5518
|
observer.observe(targetElement, {
|
|
5510
|
-
|
|
5511
|
-
|
|
5519
|
+
attributeFilter: ["class"],
|
|
5520
|
+
attributes: true
|
|
5512
5521
|
});
|
|
5513
5522
|
return observer;
|
|
5514
5523
|
};
|
|
@@ -5551,7 +5560,16 @@ var getActiveTheme = (mode, config = {}) => {
|
|
|
5551
5560
|
var getActiveTheme_default = getActiveTheme;
|
|
5552
5561
|
|
|
5553
5562
|
// src/utils/handleWebAuthnAuthentication.ts
|
|
5554
|
-
import {
|
|
5563
|
+
import {
|
|
5564
|
+
arrayBufferToBase64url,
|
|
5565
|
+
base64urlToArrayBuffer,
|
|
5566
|
+
AsgardeoRuntimeError,
|
|
5567
|
+
createPackageComponentLogger as createPackageComponentLogger3
|
|
5568
|
+
} from "@asgardeo/javascript";
|
|
5569
|
+
var logger3 = createPackageComponentLogger3(
|
|
5570
|
+
"@asgardeo/browser",
|
|
5571
|
+
"WebAuthn"
|
|
5572
|
+
);
|
|
5555
5573
|
var handleWebAuthnAuthentication = async (challengeData) => {
|
|
5556
5574
|
if (!window.navigator.credentials || !window.navigator.credentials.get) {
|
|
5557
5575
|
throw new AsgardeoRuntimeError(
|
|
@@ -5576,13 +5594,13 @@ var handleWebAuthnAuthentication = async (challengeData) => {
|
|
|
5576
5594
|
const challengeRpId = publicKeyCredentialRequestOptions.rpId;
|
|
5577
5595
|
let rpIdToUse = challengeRpId;
|
|
5578
5596
|
if (challengeRpId && !currentDomain.endsWith(challengeRpId) && challengeRpId !== currentDomain) {
|
|
5579
|
-
|
|
5597
|
+
logger3.warn(`RP ID mismatch detected. Challenge RP ID: ${challengeRpId}, Current domain: ${currentDomain}`);
|
|
5580
5598
|
rpIdToUse = currentDomain;
|
|
5581
5599
|
}
|
|
5582
5600
|
const adjustedOptions = {
|
|
5583
5601
|
...publicKeyCredentialRequestOptions,
|
|
5584
|
-
rpId: rpIdToUse,
|
|
5585
5602
|
challenge: base64urlToArrayBuffer(publicKeyCredentialRequestOptions.challenge),
|
|
5603
|
+
rpId: rpIdToUse,
|
|
5586
5604
|
...publicKeyCredentialRequestOptions.userVerification && {
|
|
5587
5605
|
userVerification: publicKeyCredentialRequestOptions.userVerification
|
|
5588
5606
|
},
|
|
@@ -5606,7 +5624,6 @@ var handleWebAuthnAuthentication = async (challengeData) => {
|
|
|
5606
5624
|
}
|
|
5607
5625
|
const authData = credential.response;
|
|
5608
5626
|
const tokenResponse = {
|
|
5609
|
-
requestId: decodedChallenge.requestId,
|
|
5610
5627
|
credential: {
|
|
5611
5628
|
id: credential.id,
|
|
5612
5629
|
rawId: arrayBufferToBase64url(credential.rawId),
|
|
@@ -5619,11 +5636,12 @@ var handleWebAuthnAuthentication = async (challengeData) => {
|
|
|
5619
5636
|
}
|
|
5620
5637
|
},
|
|
5621
5638
|
type: credential.type
|
|
5622
|
-
}
|
|
5639
|
+
},
|
|
5640
|
+
requestId: decodedChallenge.requestId
|
|
5623
5641
|
};
|
|
5624
5642
|
return JSON.stringify(tokenResponse);
|
|
5625
5643
|
} catch (error) {
|
|
5626
|
-
|
|
5644
|
+
logger3.error("WebAuthn authentication failed:");
|
|
5627
5645
|
if (error instanceof AsgardeoRuntimeError) {
|
|
5628
5646
|
throw error;
|
|
5629
5647
|
}
|