@imtbl/auth 2.12.7-alpha.1 → 2.12.7-alpha.10

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.
@@ -1,8 +1,8 @@
1
1
  import { UserManager, User, ErrorTimeout, ErrorResponse, InMemoryWebStorage, WebStorageStateStore } from 'oidc-client-ts';
2
- import On from 'localforage';
2
+ import vn from 'localforage';
3
3
  import { track, identify, getDetail, Detail, trackFlow, trackError } from '@imtbl/metrics';
4
4
 
5
- function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM core outside of Node.js")}var W=[],re=!1,X,me=-1;function Wt(){!re||!X||(re=!1,X.length?W=X.concat(W):me=-1,W.length&&Xe());}function Xe(){if(!re){var a=setTimeout(Wt,0);re=!0;for(var n=W.length;n;){for(X=W,W=[];++me<n;)X&&X[me].run();me=-1,n=W.length;}X=null,re=!1,clearTimeout(a);}}function Zt(a){var n=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)n[s-1]=arguments[s];W.push(new je(a,n)),W.length===1&&!re&&setTimeout(Xe,0);}function je(a,n){this.fun=a,this.array=n;}je.prototype.run=function(){this.fun.apply(null,this.array);};var Yt="browser",zt="x64",Jt="browser",qt={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Xt=["/usr/bin/node"],jt=[],Qt="v16.8.0",er={},tr=function(a,n){console.warn((n?n+": ":"")+a);},rr=function(a){Ue("binding");},nr=function(a){return 0},ir=function(){return "/"},or=function(a){},sr={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function B(){}var ar=B,cr=[];function lr(a){Ue("_linkedBinding");}var ur={},dr=!1,pr={};function hr(a){Ue("dlopen");}function fr(){return []}function mr(){return []}var gr=B,Er=B,ke=function(){return {}},yr=ke,wr=ke,_r=B,Cr=B,Rr=B,Tr={};function Ir(a,n){if(!a)throw new Error(n||"assertion error")}var vr={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Lr=B,Or=B;function Pr(){return !1}var Ar=B,Ur=B,kr=B,br=B,xr=B,Sr=void 0,Br=void 0,Mr=void 0,Dr=B,Nr=2,Fr=1,Hr="/bin/usr/node",Vr=9229,$r="node",Gr=[],Kr=B,Y={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Y.now===void 0&&(Oe=Date.now(),Y.timing&&Y.timing.navigationStart&&(Oe=Y.timing.navigationStart),Y.now=()=>Date.now()-Oe);var Oe;function Wr(){return Y.now()/1e3}var Pe=1e9;function Ae(a){var n=Math.floor((Date.now()-Y.now())*.001),s=Y.now()*.001,l=Math.floor(s)+n,d=Math.floor(s%1*1e9);return a&&(l=l-a[0],d=d-a[1],d<0&&(l--,d+=Pe)),[l,d]}Ae.bigint=function(a){var n=Ae(a);return typeof BigInt>"u"?n[0]*Pe+n[1]:BigInt(n[0]*Pe)+BigInt(n[1])};var Zr=10,Yr={},zr=0;function z(){return v}var Jr=z,qr=z,Xr=z,jr=z,Qr=z,en=B,tn=z,rn=z;function nn(a){return []}var v={version:Qt,versions:er,arch:zt,platform:Jt,release:sr,_rawDebug:ar,moduleLoadList:cr,binding:rr,_linkedBinding:lr,_events:Yr,_eventsCount:zr,_maxListeners:Zr,on:z,addListener:Jr,once:qr,off:Xr,removeListener:jr,removeAllListeners:Qr,emit:en,prependListener:tn,prependOnceListener:rn,listeners:nn,domain:ur,_exiting:dr,config:pr,dlopen:hr,uptime:Wr,_getActiveRequests:fr,_getActiveHandles:mr,reallyExit:gr,_kill:Er,cpuUsage:ke,resourceUsage:yr,memoryUsage:wr,kill:_r,exit:Cr,openStdin:Rr,allowedNodeEnvironmentFlags:Tr,assert:Ir,features:vr,_fatalExceptions:Lr,setUncaughtExceptionCaptureCallback:Or,hasUncaughtExceptionCaptureCallback:Pr,emitWarning:tr,nextTick:Zt,_tickCallback:Ar,_debugProcess:Ur,_debugEnd:kr,_startProfilerIdleNotifier:br,_stopProfilerIdleNotifier:xr,stdout:Sr,stdin:Mr,stderr:Br,abort:Dr,umask:nr,chdir:or,cwd:ir,env:qt,title:Yt,argv:Xt,execArgv:jt,pid:Nr,ppid:Fr,execPath:Hr,debugPort:Vr,hrtime:Ae,argv0:$r,_preload_modules:Gr,setSourceMapsEnabled:Kr};var ce={},Qe=!1;function on(){if(Qe)return ce;Qe=!0,ce.byteLength=f,ce.toByteArray=_,ce.fromByteArray=N;for(var a=[],n=[],s=typeof Uint8Array<"u"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=l.length;d<p;++d)a[d]=l[d],n[l.charCodeAt(d)]=d;n[45]=62,n[95]=63;function o(m){var y=m.length;if(y%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var C=m.indexOf("=");C===-1&&(C=y);var L=C===y?0:4-C%4;return [C,L]}function f(m){var y=o(m),C=y[0],L=y[1];return (C+L)*3/4-L}function E(m,y,C){return (y+C)*3/4-C}function _(m){var y,C=o(m),L=C[0],x=C[1],A=new s(E(m,L,x)),S=0,M=x>0?L-4:L,D;for(D=0;D<M;D+=4)y=n[m.charCodeAt(D)]<<18|n[m.charCodeAt(D+1)]<<12|n[m.charCodeAt(D+2)]<<6|n[m.charCodeAt(D+3)],A[S++]=y>>16&255,A[S++]=y>>8&255,A[S++]=y&255;return x===2&&(y=n[m.charCodeAt(D)]<<2|n[m.charCodeAt(D+1)]>>4,A[S++]=y&255),x===1&&(y=n[m.charCodeAt(D)]<<10|n[m.charCodeAt(D+1)]<<4|n[m.charCodeAt(D+2)]>>2,A[S++]=y>>8&255,A[S++]=y&255),A}function g(m){return a[m>>18&63]+a[m>>12&63]+a[m>>6&63]+a[m&63]}function R(m,y,C){for(var L,x=[],A=y;A<C;A+=3)L=(m[A]<<16&16711680)+(m[A+1]<<8&65280)+(m[A+2]&255),x.push(g(L));return x.join("")}function N(m){for(var y,C=m.length,L=C%3,x=[],A=16383,S=0,M=C-L;S<M;S+=A)x.push(R(m,S,S+A>M?M:S+A));return L===1?(y=m[C-1],x.push(a[y>>2]+a[y<<4&63]+"==")):L===2&&(y=(m[C-2]<<8)+m[C-1],x.push(a[y>>10]+a[y>>4&63]+a[y<<2&63]+"=")),x.join("")}return ce}var ge={},et=!1;function sn(){if(et)return ge;et=!0;return ge.read=function(a,n,s,l,d){var p,o,f=d*8-l-1,E=(1<<f)-1,_=E>>1,g=-7,R=s?d-1:0,N=s?-1:1,m=a[n+R];for(R+=N,p=m&(1<<-g)-1,m>>=-g,g+=f;g>0;p=p*256+a[n+R],R+=N,g-=8);for(o=p&(1<<-g)-1,p>>=-g,g+=l;g>0;o=o*256+a[n+R],R+=N,g-=8);if(p===0)p=1-_;else {if(p===E)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,l),p=p-_;}return (m?-1:1)*o*Math.pow(2,p-l)},ge.write=function(a,n,s,l,d,p){var o,f,E,_=p*8-d-1,g=(1<<_)-1,R=g>>1,N=d===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=l?0:p-1,y=l?1:-1,C=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(f=isNaN(n)?1:0,o=g):(o=Math.floor(Math.log(n)/Math.LN2),n*(E=Math.pow(2,-o))<1&&(o--,E*=2),o+R>=1?n+=N/E:n+=N*Math.pow(2,1-R),n*E>=2&&(o++,E/=2),o+R>=g?(f=0,o=g):o+R>=1?(f=(n*E-1)*Math.pow(2,d),o=o+R):(f=n*Math.pow(2,R-1)*Math.pow(2,d),o=0));d>=8;a[s+m]=f&255,m+=y,f/=256,d-=8);for(o=o<<d|f,_+=d;_>0;a[s+m]=o&255,m+=y,o/=256,_-=8);a[s+m-y]|=C*128;},ge}var j={},tt=!1;function an(){if(tt)return j;tt=!0;let a=on(),n=sn(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;j.Buffer=o,j.SlowBuffer=x,j.INSPECT_MAX_BYTES=50;let l=2147483647;j.kMaxLength=l,o.TYPED_ARRAY_SUPPORT=d(),!o.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 d(){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(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function p(r){if(r>l)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,o.prototype),e}function o(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 g(r)}return f(r,e,t)}o.poolSize=8192;function f(r,e,t){if(typeof r=="string")return R(r,e);if(ArrayBuffer.isView(r))return m(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($(r,ArrayBuffer)||r&&$(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($(r,SharedArrayBuffer)||r&&$(r.buffer,SharedArrayBuffer)))return y(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return o.from(i,e,t);let c=C(r);if(c)return c;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return o.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)}o.from=function(r,e,t){return f(r,e,t)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function E(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 _(r,e,t){return E(r),r<=0?p(r):e!==void 0?typeof t=="string"?p(r).fill(e,t):p(r).fill(e):p(r)}o.alloc=function(r,e,t){return _(r,e,t)};function g(r){return E(r),p(r<0?0:L(r)|0)}o.allocUnsafe=function(r){return g(r)},o.allocUnsafeSlow=function(r){return g(r)};function R(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=A(r,e)|0,i=p(t),c=i.write(r,e);return c!==t&&(i=i.slice(0,c)),i}function N(r){let e=r.length<0?0:L(r.length)|0,t=p(e);for(let i=0;i<e;i+=1)t[i]=r[i]&255;return t}function m(r){if($(r,Uint8Array)){let e=new Uint8Array(r);return y(e.buffer,e.byteOffset,e.byteLength)}return N(r)}function y(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 i;return e===void 0&&t===void 0?i=new Uint8Array(r):t===void 0?i=new Uint8Array(r,e):i=new Uint8Array(r,e,t),Object.setPrototypeOf(i,o.prototype),i}function C(r){if(o.isBuffer(r)){let e=L(r.length)|0,t=p(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||Le(r.length)?p(0):N(r);if(r.type==="Buffer"&&Array.isArray(r.data))return N(r.data)}function L(r){if(r>=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return r|0}function x(r){return +r!=r&&(r=0),o.alloc(+r)}o.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==o.prototype},o.compare=function(e,t){if($(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),$(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,c=t.length;for(let u=0,h=Math.min(i,c);u<h;++u)if(e[u]!==t[u]){i=e[u],c=t[u];break}return i<c?-1:c<i?1:0},o.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}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return o.alloc(0);let i;if(t===void 0)for(t=0,i=0;i<e.length;++i)t+=e[i].length;let c=o.allocUnsafe(t),u=0;for(i=0;i<e.length;++i){let h=e[i];if($(h,Uint8Array))u+h.length>c.length?(o.isBuffer(h)||(h=o.from(h)),h.copy(c,u)):Uint8Array.prototype.set.call(c,h,u);else if(o.isBuffer(h))h.copy(c,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=h.length;}return c};function A(r,e){if(o.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||$(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,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let c=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return ve(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return qe(r).length;default:if(c)return i?-1:ve(r).length;e=(""+e).toLowerCase(),c=!0;}}o.byteLength=A;function S(r,e,t){let i=!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 Mt(this,e,t);case"utf8":case"utf-8":return Ve(this,e,t);case"ascii":return St(this,e,t);case"latin1":case"binary":return Bt(this,e,t);case"base64":return bt(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Dt(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0;}}o.prototype._isBuffer=!0;function M(r,e,t){let i=r[e];r[e]=r[t],r[t]=i;}o.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)M(this,t,t+1);return this},o.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)M(this,t,t+3),M(this,t+1,t+2);return this},o.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)M(this,t,t+7),M(this,t+1,t+6),M(this,t+2,t+5),M(this,t+3,t+4);return this},o.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Ve(this,0,e):S.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:o.compare(this,e)===0},o.prototype.inspect=function(){let e="",t=j.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(o.prototype[s]=o.prototype.inspect),o.prototype.compare=function(e,t,i,c,u){if($(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.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),i===void 0&&(i=e?e.length:0),c===void 0&&(c=0),u===void 0&&(u=this.length),t<0||i>e.length||c<0||u>this.length)throw new RangeError("out of range index");if(c>=u&&t>=i)return 0;if(c>=u)return -1;if(t>=i)return 1;if(t>>>=0,i>>>=0,c>>>=0,u>>>=0,this===e)return 0;let h=u-c,w=i-t,U=Math.min(h,w),O=this.slice(c,u),k=e.slice(t,i);for(let T=0;T<U;++T)if(O[T]!==k[T]){h=O[T],w=k[T];break}return h<w?-1:w<h?1:0};function D(r,e,t,i,c){if(r.length===0)return -1;if(typeof t=="string"?(i=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,Le(t)&&(t=c?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(c)return -1;t=r.length-1;}else if(t<0)if(c)t=0;else return -1;if(typeof e=="string"&&(e=o.from(e,i)),o.isBuffer(e))return e.length===0?-1:I(r,e,t,i,c);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?c?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):I(r,[e],t,i,c);throw new TypeError("val must be string, number or Buffer")}function I(r,e,t,i,c){let u=1,h=r.length,w=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return -1;u=2,h/=2,w/=2,t/=2;}function U(k,T){return u===1?k[T]:k.readUInt16BE(T*u)}let O;if(c){let k=-1;for(O=t;O<h;O++)if(U(r,O)===U(e,k===-1?0:O-k)){if(k===-1&&(k=O),O-k+1===w)return k*u}else k!==-1&&(O-=O-k),k=-1;}else for(t+w>h&&(t=h-w),O=t;O>=0;O--){let k=!0;for(let T=0;T<w;T++)if(U(r,O+T)!==U(e,T)){k=!1;break}if(k)return O}return -1}o.prototype.includes=function(e,t,i){return this.indexOf(e,t,i)!==-1},o.prototype.indexOf=function(e,t,i){return D(this,e,t,i,!0)},o.prototype.lastIndexOf=function(e,t,i){return D(this,e,t,i,!1)};function Ot(r,e,t,i){t=Number(t)||0;let c=r.length-t;i?(i=Number(i),i>c&&(i=c)):i=c;let u=e.length;i>u/2&&(i=u/2);let h;for(h=0;h<i;++h){let w=parseInt(e.substr(h*2,2),16);if(Le(w))return h;r[t+h]=w;}return h}function Pt(r,e,t,i){return fe(ve(e,r.length-t),r,t,i)}function At(r,e,t,i){return fe(Vt(e),r,t,i)}function Ut(r,e,t,i){return fe(qe(e),r,t,i)}function kt(r,e,t,i){return fe($t(e,r.length-t),r,t,i)}o.prototype.write=function(e,t,i,c){if(t===void 0)c="utf8",i=this.length,t=0;else if(i===void 0&&typeof t=="string")c=t,i=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(i)?(i=i>>>0,c===void 0&&(c="utf8")):(c=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let u=this.length-t;if((i===void 0||i>u)&&(i=u),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");let h=!1;for(;;)switch(c){case"hex":return Ot(this,e,t,i);case"utf8":case"utf-8":return Pt(this,e,t,i);case"ascii":case"latin1":case"binary":return At(this,e,t,i);case"base64":return Ut(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return kt(this,e,t,i);default:if(h)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),h=!0;}},o.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function bt(r,e,t){return e===0&&t===r.length?a.fromByteArray(r):a.fromByteArray(r.slice(e,t))}function Ve(r,e,t){t=Math.min(r.length,t);let i=[],c=e;for(;c<t;){let u=r[c],h=null,w=u>239?4:u>223?3:u>191?2:1;if(c+w<=t){let U,O,k,T;switch(w){case 1:u<128&&(h=u);break;case 2:U=r[c+1],(U&192)===128&&(T=(u&31)<<6|U&63,T>127&&(h=T));break;case 3:U=r[c+1],O=r[c+2],(U&192)===128&&(O&192)===128&&(T=(u&15)<<12|(U&63)<<6|O&63,T>2047&&(T<55296||T>57343)&&(h=T));break;case 4:U=r[c+1],O=r[c+2],k=r[c+3],(U&192)===128&&(O&192)===128&&(k&192)===128&&(T=(u&15)<<18|(U&63)<<12|(O&63)<<6|k&63,T>65535&&T<1114112&&(h=T));}}h===null?(h=65533,w=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|h&1023),i.push(h),c+=w;}return xt(i)}let $e=4096;function xt(r){let e=r.length;if(e<=$e)return String.fromCharCode.apply(String,r);let t="",i=0;for(;i<e;)t+=String.fromCharCode.apply(String,r.slice(i,i+=$e));return t}function St(r,e,t){let i="";t=Math.min(r.length,t);for(let c=e;c<t;++c)i+=String.fromCharCode(r[c]&127);return i}function Bt(r,e,t){let i="";t=Math.min(r.length,t);for(let c=e;c<t;++c)i+=String.fromCharCode(r[c]);return i}function Mt(r,e,t){let i=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>i)&&(t=i);let c="";for(let u=e;u<t;++u)c+=Gt[r[u]];return c}function Dt(r,e,t){let i=r.slice(e,t),c="";for(let u=0;u<i.length-1;u+=2)c+=String.fromCharCode(i[u]+i[u+1]*256);return c}o.prototype.slice=function(e,t){let i=this.length;e=~~e,t=t===void 0?i:~~t,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),t<e&&(t=e);let c=this.subarray(e,t);return Object.setPrototypeOf(c,o.prototype),c};function b(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||b(e,t,this.length);let c=this[e],u=1,h=0;for(;++h<t&&(u*=256);)c+=this[e+h]*u;return c},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||b(e,t,this.length);let c=this[e+--t],u=1;for(;t>0&&(u*=256);)c+=this[e+--t]*u;return c},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e=e>>>0,t||b(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||b(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||b(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||b(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Z(function(e){e=e>>>0,te(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&ae(e,this.length-8);let c=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,u=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(c)+(BigInt(u)<<BigInt(32))}),o.prototype.readBigUInt64BE=Z(function(e){e=e>>>0,te(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&ae(e,this.length-8);let c=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],u=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return (BigInt(c)<<BigInt(32))+BigInt(u)}),o.prototype.readIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||b(e,t,this.length);let c=this[e],u=1,h=0;for(;++h<t&&(u*=256);)c+=this[e+h]*u;return u*=128,c>=u&&(c-=Math.pow(2,8*t)),c},o.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||b(e,t,this.length);let c=t,u=1,h=this[e+--c];for(;c>0&&(u*=256);)h+=this[e+--c]*u;return u*=128,h>=u&&(h-=Math.pow(2,8*t)),h},o.prototype.readInt8=function(e,t){return e=e>>>0,t||b(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},o.prototype.readInt16LE=function(e,t){e=e>>>0,t||b(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i},o.prototype.readInt16BE=function(e,t){e=e>>>0,t||b(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i},o.prototype.readInt32LE=function(e,t){return e=e>>>0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e=e>>>0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Z(function(e){e=e>>>0,te(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&ae(e,this.length-8);let c=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return (BigInt(c)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),o.prototype.readBigInt64BE=Z(function(e){e=e>>>0,te(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&ae(e,this.length-8);let c=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(c)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i)}),o.prototype.readFloatLE=function(e,t){return e=e>>>0,t||b(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e=e>>>0,t||b(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||b(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||b(e,8,this.length),n.read(this,e,!1,52,8)};function F(r,e,t,i,c,u){if(!o.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>c||e<u)throw new RangeError('"value" argument is out of bounds');if(t+i>r.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,i,c){if(e=+e,t=t>>>0,i=i>>>0,!c){let w=Math.pow(2,8*i)-1;F(this,e,t,i,w,0);}let u=1,h=0;for(this[t]=e&255;++h<i&&(u*=256);)this[t+h]=e/u&255;return t+i},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,i,c){if(e=+e,t=t>>>0,i=i>>>0,!c){let w=Math.pow(2,8*i)-1;F(this,e,t,i,w,0);}let u=i-1,h=1;for(this[t+u]=e&255;--u>=0&&(h*=256);)this[t+u]=e/h&255;return t+i},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||F(this,e,t,1,255,0),this[t]=e&255,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||F(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||F(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||F(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},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||F(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 Ge(r,e,t,i,c){Je(e,i,c,r,t,7);let u=Number(e&BigInt(4294967295));r[t++]=u,u=u>>8,r[t++]=u,u=u>>8,r[t++]=u,u=u>>8,r[t++]=u;let h=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=h,h=h>>8,r[t++]=h,h=h>>8,r[t++]=h,h=h>>8,r[t++]=h,t}function Ke(r,e,t,i,c){Je(e,i,c,r,t,7);let u=Number(e&BigInt(4294967295));r[t+7]=u,u=u>>8,r[t+6]=u,u=u>>8,r[t+5]=u,u=u>>8,r[t+4]=u;let h=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=h,h=h>>8,r[t+2]=h,h=h>>8,r[t+1]=h,h=h>>8,r[t]=h,t+8}o.prototype.writeBigUInt64LE=Z(function(e,t=0){return Ge(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Z(function(e,t=0){return Ke(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(e,t,i,c){if(e=+e,t=t>>>0,!c){let U=Math.pow(2,8*i-1);F(this,e,t,i,U-1,-U);}let u=0,h=1,w=0;for(this[t]=e&255;++u<i&&(h*=256);)e<0&&w===0&&this[t+u-1]!==0&&(w=1),this[t+u]=(e/h>>0)-w&255;return t+i},o.prototype.writeIntBE=function(e,t,i,c){if(e=+e,t=t>>>0,!c){let U=Math.pow(2,8*i-1);F(this,e,t,i,U-1,-U);}let u=i-1,h=1,w=0;for(this[t+u]=e&255;--u>=0&&(h*=256);)e<0&&w===0&&this[t+u+1]!==0&&(w=1),this[t+u]=(e/h>>0)-w&255;return t+i},o.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||F(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},o.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||F(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||F(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},o.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||F(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},o.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||F(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},o.prototype.writeBigInt64LE=Z(function(e,t=0){return Ge(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Z(function(e,t=0){return Ke(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function We(r,e,t,i,c,u){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Ze(r,e,t,i,c){return e=+e,t=t>>>0,c||We(r,e,t,4),n.write(r,e,t,i,23,4),t+4}o.prototype.writeFloatLE=function(e,t,i){return Ze(this,e,t,!0,i)},o.prototype.writeFloatBE=function(e,t,i){return Ze(this,e,t,!1,i)};function Ye(r,e,t,i,c){return e=+e,t=t>>>0,c||We(r,e,t,8),n.write(r,e,t,i,52,8),t+8}o.prototype.writeDoubleLE=function(e,t,i){return Ye(this,e,t,!0,i)},o.prototype.writeDoubleBE=function(e,t,i){return Ye(this,e,t,!1,i)},o.prototype.copy=function(e,t,i,c){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!c&&c!==0&&(c=this.length),t>=e.length&&(t=e.length),t||(t=0),c>0&&c<i&&(c=i),c===i||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("sourceEnd out of bounds");c>this.length&&(c=this.length),e.length-t<c-i&&(c=e.length-t+i);let u=c-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,i,c):Uint8Array.prototype.set.call(e,this.subarray(i,c),t),u},o.prototype.fill=function(e,t,i,c){if(typeof e=="string"){if(typeof t=="string"?(c=t,t=0,i=this.length):typeof i=="string"&&(c=i,i=this.length),c!==void 0&&typeof c!="string")throw new TypeError("encoding must be a string");if(typeof c=="string"&&!o.isEncoding(c))throw new TypeError("Unknown encoding: "+c);if(e.length===1){let h=e.charCodeAt(0);(c==="utf8"&&h<128||c==="latin1")&&(e=h);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;t=t>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let u;if(typeof e=="number")for(u=t;u<i;++u)this[u]=e;else {let h=o.isBuffer(e)?e:o.from(e,c),w=h.length;if(w===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(u=0;u<i-t;++u)this[u+t]=h[u%w];}return this};let ee={};function Ie(r,e,t){ee[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(c){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:c,writable:!0});}toString(){return `${this.name} [${r}]: ${this.message}`}};}Ie("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ie("ERR_INVALID_ARG_TYPE",function(r,e){return `The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError),Ie("ERR_OUT_OF_RANGE",function(r,e,t){let i=`The value of "${r}" is out of range.`,c=t;return Number.isInteger(t)&&Math.abs(t)>2**32?c=ze(String(t)):typeof t=="bigint"&&(c=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(c=ze(c)),c+="n"),i+=` It must be ${e}. Received ${c}`,i},RangeError);function ze(r){let e="",t=r.length,i=r[0]==="-"?1:0;for(;t>=i+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return `${r.slice(0,t)}${e}`}function Nt(r,e,t){te(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&ae(e,r.length-(t+1));}function Je(r,e,t,i,c,u){if(r>t||r<e){let h=typeof e=="bigint"?"n":"",w;throw e===0||e===BigInt(0)?w=`>= 0${h} and < 2${h} ** ${(u+1)*8}${h}`:w=`>= -(2${h} ** ${(u+1)*8-1}${h}) and < 2 ** ${(u+1)*8-1}${h}`,new ee.ERR_OUT_OF_RANGE("value",w,r)}Nt(i,c,u);}function te(r,e){if(typeof r!="number")throw new ee.ERR_INVALID_ARG_TYPE(e,"number",r)}function ae(r,e,t){throw Math.floor(r)!==r?(te(r,t),new ee.ERR_OUT_OF_RANGE("offset","an integer",r)):e<0?new ee.ERR_BUFFER_OUT_OF_BOUNDS:new ee.ERR_OUT_OF_RANGE("offset",`>= ${0} and <= ${e}`,r)}let Ft=/[^+/0-9A-Za-z-_]/g;function Ht(r){if(r=r.split("=")[0],r=r.trim().replace(Ft,""),r.length<2)return "";for(;r.length%4!==0;)r=r+"=";return r}function ve(r,e){e=e||1/0;let t,i=r.length,c=null,u=[];for(let h=0;h<i;++h){if(t=r.charCodeAt(h),t>55295&&t<57344){if(!c){if(t>56319){(e-=3)>-1&&u.push(239,191,189);continue}else if(h+1===i){(e-=3)>-1&&u.push(239,191,189);continue}c=t;continue}if(t<56320){(e-=3)>-1&&u.push(239,191,189),c=t;continue}t=(c-55296<<10|t-56320)+65536;}else c&&(e-=3)>-1&&u.push(239,191,189);if(c=null,t<128){if((e-=1)<0)break;u.push(t);}else if(t<2048){if((e-=2)<0)break;u.push(t>>6|192,t&63|128);}else if(t<65536){if((e-=3)<0)break;u.push(t>>12|224,t>>6&63|128,t&63|128);}else if(t<1114112){if((e-=4)<0)break;u.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128);}else throw new Error("Invalid code point")}return u}function Vt(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function $t(r,e){let t,i,c,u=[];for(let h=0;h<r.length&&!((e-=2)<0);++h)t=r.charCodeAt(h),i=t>>8,c=t%256,u.push(c),u.push(i);return u}function qe(r){return a.toByteArray(Ht(r))}function fe(r,e,t,i){let c;for(c=0;c<i&&!(c+t>=e.length||c>=r.length);++c)e[c+t]=r[c];return c}function $(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function Le(r){return r!==r}let Gt=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let c=0;c<16;++c)e[i+c]=r[t]+r[c];}return e}();function Z(r){return typeof BigInt>"u"?Kt:r}function Kt(){throw new Error("BigInt not supported")}return j}var Q=an();Q.Buffer;Q.SlowBuffer;Q.INSPECT_MAX_BYTES;Q.kMaxLength;var P=Q.Buffer;Q.INSPECT_MAX_BYTES;Q.kMaxLength;var Ee=(I=>(I.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",I.INVALID_CONFIGURATION="INVALID_CONFIGURATION",I.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR",I.NOT_LOGGED_IN_ERROR="NOT_LOGGED_IN_ERROR",I.SILENT_LOGIN_ERROR="SILENT_LOGIN_ERROR",I.REFRESH_TOKEN_ERROR="REFRESH_TOKEN_ERROR",I.USER_REGISTRATION_ERROR="USER_REGISTRATION_ERROR",I.USER_NOT_REGISTERED_ERROR="USER_NOT_REGISTERED_ERROR",I.LOGOUT_ERROR="LOGOUT_ERROR",I.TRANSFER_ERROR="TRANSFER_ERROR",I.CREATE_ORDER_ERROR="CREATE_ORDER_ERROR",I.CANCEL_ORDER_ERROR="CANCEL_ORDER_ERROR",I.EXCHANGE_TRANSFER_ERROR="EXCHANGE_TRANSFER_ERROR",I.CREATE_TRADE_ERROR="CREATE_TRADE_ERROR",I.OPERATION_NOT_SUPPORTED_ERROR="OPERATION_NOT_SUPPORTED_ERROR",I.LINK_WALLET_ALREADY_LINKED_ERROR="LINK_WALLET_ALREADY_LINKED_ERROR",I.LINK_WALLET_MAX_WALLETS_LINKED_ERROR="LINK_WALLET_MAX_WALLETS_LINKED_ERROR",I.LINK_WALLET_VALIDATION_ERROR="LINK_WALLET_VALIDATION_ERROR",I.LINK_WALLET_DUPLICATE_NONCE_ERROR="LINK_WALLET_DUPLICATE_NONCE_ERROR",I.LINK_WALLET_GENERIC_ERROR="LINK_WALLET_GENERIC_ERROR",I.SERVICE_UNAVAILABLE_ERROR="SERVICE_UNAVAILABLE_ERROR",I.TRANSACTION_REJECTED="TRANSACTION_REJECTED",I))(Ee||{});function be(a){return typeof a=="object"&&a!==null&&"code"in a&&"message"in a}var cn=a=>{if(be(a))return a;if(typeof a=="object"&&a!==null&&"response"in a){let{response:n}=a;if(n?.data&&be(n.data))return n.data}},ln=(a,n)=>{let s=n,l=s?.response?.status,d=s?.config?.url,p=s?.config?.baseURL,o=typeof d=="string"&&typeof p=="string"&&!/^https?:\/\//i.test(d)?`${p}${d}`:d;return l==null&&o==null||a.includes("[httpStatus=")?a:`${a} [httpStatus=${l??"unknown"} url=${o??"unknown"}]`},G=class extends Error{type;constructor(n,s){super(n),this.type=s;}},J=async(a,n)=>{try{return await a()}catch(s){let l;if(s instanceof G&&s.type==="SERVICE_UNAVAILABLE_ERROR")throw new G(s.message,s.type);let d=cn(s);throw d?l=d.message:l=s.message,n==="USER_REGISTRATION_ERROR"&&(l=ln(l,s)),new G(l,n)}};var un=(a,n,s)=>{let l=n.map(d=>!a[d]&&d).filter(d=>d).join(", ");if(l!==""){let d=`${l} cannot be null`;throw new G(d,"INVALID_CONFIGURATION")}},le=class{authenticationDomain;passportDomain;oidcConfiguration;crossSdkBridgeEnabled;popupOverlayOptions;constructor({authenticationDomain:n,passportDomain:s,crossSdkBridgeEnabled:l,popupOverlayOptions:d,...p}){un(p,["clientId","redirectUri"]),this.oidcConfiguration=p,this.crossSdkBridgeEnabled=l||!1,this.popupOverlayOptions=d,this.authenticationDomain=n||"https://auth.immutable.com",this.passportDomain=s||"https://passport.immutable.com";}};var rt=(n=>(n.ZKEVM="zkEvm",n))(rt||{}),ye=(s=>(s.ZKEVM="zkevm",s.ARBITRUM_ONE="arbitrum_one",s))(ye||{}),xe=a=>!!a.zkEvm,nt=(l=>(l.OptedIn="opted_in",l.Unsubscribed="unsubscribed",l.Subscribed="subscribed",l))(nt||{}),Se=(d=>(d.LOGGED_OUT="loggedOut",d.LOGGED_IN="loggedIn",d.TOKEN_REFRESHED="tokenRefreshed",d.USER_REMOVED="userRemoved",d))(Se||{});var it="im_passport_embedded_login_prompt";var ne="passport-overlay",q="passport-overlay-contents",we=`${ne}-close`,_e=`${ne}-try-again`,ot=`
5
+ function Ae(a){throw new Error("Node.js process "+a+" is not supported by JSPM core outside of Node.js")}var W=[],re=!1,X,me=-1;function Gt(){!re||!X||(re=!1,X.length?W=X.concat(W):me=-1,W.length&&qe());}function qe(){if(!re){var a=setTimeout(Gt,0);re=!0;for(var n=W.length;n;){for(X=W,W=[];++me<n;)X&&X[me].run();me=-1,n=W.length;}X=null,re=!1,clearTimeout(a);}}function Kt(a){var n=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)n[s-1]=arguments[s];W.push(new Xe(a,n)),W.length===1&&!re&&setTimeout(qe,0);}function Xe(a,n){this.fun=a,this.array=n;}Xe.prototype.run=function(){this.fun.apply(null,this.array);};var Wt="browser",Zt="x64",Yt="browser",zt={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Jt=["/usr/bin/node"],qt=[],Xt="v16.8.0",jt={},Qt=function(a,n){console.warn((n?n+": ":"")+a);},er=function(a){Ae("binding");},tr=function(a){return 0},rr=function(){return "/"},nr=function(a){},ir={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function B(){}var or=B,sr=[];function ar(a){Ae("_linkedBinding");}var cr={},lr=!1,ur={};function dr(a){Ae("dlopen");}function pr(){return []}function hr(){return []}var fr=B,mr=B,Ue=function(){return {}},gr=Ue,Er=Ue,yr=B,wr=B,_r=B,Cr={};function Rr(a,n){if(!a)throw new Error(n||"assertion error")}var Tr={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Ir=B,vr=B;function Lr(){return !1}var Or=B,Pr=B,Ar=B,Ur=B,kr=B,br=void 0,xr=void 0,Sr=void 0,Br=B,Dr=2,Mr=1,Nr="/bin/usr/node",Fr=9229,Hr="node",Vr=[],$r=B,Y={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Y.now===void 0&&(Le=Date.now(),Y.timing&&Y.timing.navigationStart&&(Le=Y.timing.navigationStart),Y.now=()=>Date.now()-Le);var Le;function Gr(){return Y.now()/1e3}var Oe=1e9;function Pe(a){var n=Math.floor((Date.now()-Y.now())*.001),s=Y.now()*.001,l=Math.floor(s)+n,d=Math.floor(s%1*1e9);return a&&(l=l-a[0],d=d-a[1],d<0&&(l--,d+=Oe)),[l,d]}Pe.bigint=function(a){var n=Pe(a);return typeof BigInt>"u"?n[0]*Oe+n[1]:BigInt(n[0]*Oe)+BigInt(n[1])};var Kr=10,Wr={},Zr=0;function z(){return v}var Yr=z,zr=z,Jr=z,qr=z,Xr=z,jr=B,Qr=z,en=z;function tn(a){return []}var v={version:Xt,versions:jt,arch:Zt,platform:Yt,release:ir,_rawDebug:or,moduleLoadList:sr,binding:er,_linkedBinding:ar,_events:Wr,_eventsCount:Zr,_maxListeners:Kr,on:z,addListener:Yr,once:zr,off:Jr,removeListener:qr,removeAllListeners:Xr,emit:jr,prependListener:Qr,prependOnceListener:en,listeners:tn,domain:cr,_exiting:lr,config:ur,dlopen:dr,uptime:Gr,_getActiveRequests:pr,_getActiveHandles:hr,reallyExit:fr,_kill:mr,cpuUsage:Ue,resourceUsage:gr,memoryUsage:Er,kill:yr,exit:wr,openStdin:_r,allowedNodeEnvironmentFlags:Cr,assert:Rr,features:Tr,_fatalExceptions:Ir,setUncaughtExceptionCaptureCallback:vr,hasUncaughtExceptionCaptureCallback:Lr,emitWarning:Qt,nextTick:Kt,_tickCallback:Or,_debugProcess:Pr,_debugEnd:Ar,_startProfilerIdleNotifier:Ur,_stopProfilerIdleNotifier:kr,stdout:br,stdin:Sr,stderr:xr,abort:Br,umask:tr,chdir:nr,cwd:rr,env:zt,title:Wt,argv:Jt,execArgv:qt,pid:Dr,ppid:Mr,execPath:Nr,debugPort:Fr,hrtime:Pe,argv0:Hr,_preload_modules:Vr,setSourceMapsEnabled:$r};var ce={},je=!1;function rn(){if(je)return ce;je=!0,ce.byteLength=f,ce.toByteArray=_,ce.fromByteArray=N;for(var a=[],n=[],s=typeof Uint8Array<"u"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=l.length;d<p;++d)a[d]=l[d],n[l.charCodeAt(d)]=d;n[45]=62,n[95]=63;function o(m){var y=m.length;if(y%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var C=m.indexOf("=");C===-1&&(C=y);var L=C===y?0:4-C%4;return [C,L]}function f(m){var y=o(m),C=y[0],L=y[1];return (C+L)*3/4-L}function E(m,y,C){return (y+C)*3/4-C}function _(m){var y,C=o(m),L=C[0],x=C[1],A=new s(E(m,L,x)),S=0,D=x>0?L-4:L,M;for(M=0;M<D;M+=4)y=n[m.charCodeAt(M)]<<18|n[m.charCodeAt(M+1)]<<12|n[m.charCodeAt(M+2)]<<6|n[m.charCodeAt(M+3)],A[S++]=y>>16&255,A[S++]=y>>8&255,A[S++]=y&255;return x===2&&(y=n[m.charCodeAt(M)]<<2|n[m.charCodeAt(M+1)]>>4,A[S++]=y&255),x===1&&(y=n[m.charCodeAt(M)]<<10|n[m.charCodeAt(M+1)]<<4|n[m.charCodeAt(M+2)]>>2,A[S++]=y>>8&255,A[S++]=y&255),A}function g(m){return a[m>>18&63]+a[m>>12&63]+a[m>>6&63]+a[m&63]}function R(m,y,C){for(var L,x=[],A=y;A<C;A+=3)L=(m[A]<<16&16711680)+(m[A+1]<<8&65280)+(m[A+2]&255),x.push(g(L));return x.join("")}function N(m){for(var y,C=m.length,L=C%3,x=[],A=16383,S=0,D=C-L;S<D;S+=A)x.push(R(m,S,S+A>D?D:S+A));return L===1?(y=m[C-1],x.push(a[y>>2]+a[y<<4&63]+"==")):L===2&&(y=(m[C-2]<<8)+m[C-1],x.push(a[y>>10]+a[y>>4&63]+a[y<<2&63]+"=")),x.join("")}return ce}var ge={},Qe=!1;function nn(){if(Qe)return ge;Qe=!0;return ge.read=function(a,n,s,l,d){var p,o,f=d*8-l-1,E=(1<<f)-1,_=E>>1,g=-7,R=s?d-1:0,N=s?-1:1,m=a[n+R];for(R+=N,p=m&(1<<-g)-1,m>>=-g,g+=f;g>0;p=p*256+a[n+R],R+=N,g-=8);for(o=p&(1<<-g)-1,p>>=-g,g+=l;g>0;o=o*256+a[n+R],R+=N,g-=8);if(p===0)p=1-_;else {if(p===E)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,l),p=p-_;}return (m?-1:1)*o*Math.pow(2,p-l)},ge.write=function(a,n,s,l,d,p){var o,f,E,_=p*8-d-1,g=(1<<_)-1,R=g>>1,N=d===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=l?0:p-1,y=l?1:-1,C=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(f=isNaN(n)?1:0,o=g):(o=Math.floor(Math.log(n)/Math.LN2),n*(E=Math.pow(2,-o))<1&&(o--,E*=2),o+R>=1?n+=N/E:n+=N*Math.pow(2,1-R),n*E>=2&&(o++,E/=2),o+R>=g?(f=0,o=g):o+R>=1?(f=(n*E-1)*Math.pow(2,d),o=o+R):(f=n*Math.pow(2,R-1)*Math.pow(2,d),o=0));d>=8;a[s+m]=f&255,m+=y,f/=256,d-=8);for(o=o<<d|f,_+=d;_>0;a[s+m]=o&255,m+=y,o/=256,_-=8);a[s+m-y]|=C*128;},ge}var j={},et=!1;function on(){if(et)return j;et=!0;let a=rn(),n=nn(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;j.Buffer=o,j.SlowBuffer=x,j.INSPECT_MAX_BYTES=50;let l=2147483647;j.kMaxLength=l,o.TYPED_ARRAY_SUPPORT=d(),!o.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 d(){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(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function p(r){if(r>l)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,o.prototype),e}function o(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 g(r)}return f(r,e,t)}o.poolSize=8192;function f(r,e,t){if(typeof r=="string")return R(r,e);if(ArrayBuffer.isView(r))return m(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($(r,ArrayBuffer)||r&&$(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($(r,SharedArrayBuffer)||r&&$(r.buffer,SharedArrayBuffer)))return y(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return o.from(i,e,t);let c=C(r);if(c)return c;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return o.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)}o.from=function(r,e,t){return f(r,e,t)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function E(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 _(r,e,t){return E(r),r<=0?p(r):e!==void 0?typeof t=="string"?p(r).fill(e,t):p(r).fill(e):p(r)}o.alloc=function(r,e,t){return _(r,e,t)};function g(r){return E(r),p(r<0?0:L(r)|0)}o.allocUnsafe=function(r){return g(r)},o.allocUnsafeSlow=function(r){return g(r)};function R(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=A(r,e)|0,i=p(t),c=i.write(r,e);return c!==t&&(i=i.slice(0,c)),i}function N(r){let e=r.length<0?0:L(r.length)|0,t=p(e);for(let i=0;i<e;i+=1)t[i]=r[i]&255;return t}function m(r){if($(r,Uint8Array)){let e=new Uint8Array(r);return y(e.buffer,e.byteOffset,e.byteLength)}return N(r)}function y(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 i;return e===void 0&&t===void 0?i=new Uint8Array(r):t===void 0?i=new Uint8Array(r,e):i=new Uint8Array(r,e,t),Object.setPrototypeOf(i,o.prototype),i}function C(r){if(o.isBuffer(r)){let e=L(r.length)|0,t=p(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||ve(r.length)?p(0):N(r);if(r.type==="Buffer"&&Array.isArray(r.data))return N(r.data)}function L(r){if(r>=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return r|0}function x(r){return +r!=r&&(r=0),o.alloc(+r)}o.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==o.prototype},o.compare=function(e,t){if($(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),$(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,c=t.length;for(let u=0,h=Math.min(i,c);u<h;++u)if(e[u]!==t[u]){i=e[u],c=t[u];break}return i<c?-1:c<i?1:0},o.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}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return o.alloc(0);let i;if(t===void 0)for(t=0,i=0;i<e.length;++i)t+=e[i].length;let c=o.allocUnsafe(t),u=0;for(i=0;i<e.length;++i){let h=e[i];if($(h,Uint8Array))u+h.length>c.length?(o.isBuffer(h)||(h=o.from(h)),h.copy(c,u)):Uint8Array.prototype.set.call(c,h,u);else if(o.isBuffer(h))h.copy(c,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=h.length;}return c};function A(r,e){if(o.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||$(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,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let c=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Ie(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Je(r).length;default:if(c)return i?-1:Ie(r).length;e=(""+e).toLowerCase(),c=!0;}}o.byteLength=A;function S(r,e,t){let i=!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 St(this,e,t);case"utf8":case"utf-8":return He(this,e,t);case"ascii":return bt(this,e,t);case"latin1":case"binary":return xt(this,e,t);case"base64":return Ut(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Bt(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0;}}o.prototype._isBuffer=!0;function D(r,e,t){let i=r[e];r[e]=r[t],r[t]=i;}o.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)D(this,t,t+1);return this},o.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)D(this,t,t+3),D(this,t+1,t+2);return this},o.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)D(this,t,t+7),D(this,t+1,t+6),D(this,t+2,t+5),D(this,t+3,t+4);return this},o.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?He(this,0,e):S.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:o.compare(this,e)===0},o.prototype.inspect=function(){let e="",t=j.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(o.prototype[s]=o.prototype.inspect),o.prototype.compare=function(e,t,i,c,u){if($(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.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),i===void 0&&(i=e?e.length:0),c===void 0&&(c=0),u===void 0&&(u=this.length),t<0||i>e.length||c<0||u>this.length)throw new RangeError("out of range index");if(c>=u&&t>=i)return 0;if(c>=u)return -1;if(t>=i)return 1;if(t>>>=0,i>>>=0,c>>>=0,u>>>=0,this===e)return 0;let h=u-c,w=i-t,U=Math.min(h,w),O=this.slice(c,u),k=e.slice(t,i);for(let T=0;T<U;++T)if(O[T]!==k[T]){h=O[T],w=k[T];break}return h<w?-1:w<h?1:0};function M(r,e,t,i,c){if(r.length===0)return -1;if(typeof t=="string"?(i=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,ve(t)&&(t=c?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(c)return -1;t=r.length-1;}else if(t<0)if(c)t=0;else return -1;if(typeof e=="string"&&(e=o.from(e,i)),o.isBuffer(e))return e.length===0?-1:I(r,e,t,i,c);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?c?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):I(r,[e],t,i,c);throw new TypeError("val must be string, number or Buffer")}function I(r,e,t,i,c){let u=1,h=r.length,w=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return -1;u=2,h/=2,w/=2,t/=2;}function U(k,T){return u===1?k[T]:k.readUInt16BE(T*u)}let O;if(c){let k=-1;for(O=t;O<h;O++)if(U(r,O)===U(e,k===-1?0:O-k)){if(k===-1&&(k=O),O-k+1===w)return k*u}else k!==-1&&(O-=O-k),k=-1;}else for(t+w>h&&(t=h-w),O=t;O>=0;O--){let k=!0;for(let T=0;T<w;T++)if(U(r,O+T)!==U(e,T)){k=!1;break}if(k)return O}return -1}o.prototype.includes=function(e,t,i){return this.indexOf(e,t,i)!==-1},o.prototype.indexOf=function(e,t,i){return M(this,e,t,i,!0)},o.prototype.lastIndexOf=function(e,t,i){return M(this,e,t,i,!1)};function vt(r,e,t,i){t=Number(t)||0;let c=r.length-t;i?(i=Number(i),i>c&&(i=c)):i=c;let u=e.length;i>u/2&&(i=u/2);let h;for(h=0;h<i;++h){let w=parseInt(e.substr(h*2,2),16);if(ve(w))return h;r[t+h]=w;}return h}function Lt(r,e,t,i){return fe(Ie(e,r.length-t),r,t,i)}function Ot(r,e,t,i){return fe(Ft(e),r,t,i)}function Pt(r,e,t,i){return fe(Je(e),r,t,i)}function At(r,e,t,i){return fe(Ht(e,r.length-t),r,t,i)}o.prototype.write=function(e,t,i,c){if(t===void 0)c="utf8",i=this.length,t=0;else if(i===void 0&&typeof t=="string")c=t,i=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(i)?(i=i>>>0,c===void 0&&(c="utf8")):(c=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let u=this.length-t;if((i===void 0||i>u)&&(i=u),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");let h=!1;for(;;)switch(c){case"hex":return vt(this,e,t,i);case"utf8":case"utf-8":return Lt(this,e,t,i);case"ascii":case"latin1":case"binary":return Ot(this,e,t,i);case"base64":return Pt(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return At(this,e,t,i);default:if(h)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),h=!0;}},o.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ut(r,e,t){return e===0&&t===r.length?a.fromByteArray(r):a.fromByteArray(r.slice(e,t))}function He(r,e,t){t=Math.min(r.length,t);let i=[],c=e;for(;c<t;){let u=r[c],h=null,w=u>239?4:u>223?3:u>191?2:1;if(c+w<=t){let U,O,k,T;switch(w){case 1:u<128&&(h=u);break;case 2:U=r[c+1],(U&192)===128&&(T=(u&31)<<6|U&63,T>127&&(h=T));break;case 3:U=r[c+1],O=r[c+2],(U&192)===128&&(O&192)===128&&(T=(u&15)<<12|(U&63)<<6|O&63,T>2047&&(T<55296||T>57343)&&(h=T));break;case 4:U=r[c+1],O=r[c+2],k=r[c+3],(U&192)===128&&(O&192)===128&&(k&192)===128&&(T=(u&15)<<18|(U&63)<<12|(O&63)<<6|k&63,T>65535&&T<1114112&&(h=T));}}h===null?(h=65533,w=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|h&1023),i.push(h),c+=w;}return kt(i)}let Ve=4096;function kt(r){let e=r.length;if(e<=Ve)return String.fromCharCode.apply(String,r);let t="",i=0;for(;i<e;)t+=String.fromCharCode.apply(String,r.slice(i,i+=Ve));return t}function bt(r,e,t){let i="";t=Math.min(r.length,t);for(let c=e;c<t;++c)i+=String.fromCharCode(r[c]&127);return i}function xt(r,e,t){let i="";t=Math.min(r.length,t);for(let c=e;c<t;++c)i+=String.fromCharCode(r[c]);return i}function St(r,e,t){let i=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>i)&&(t=i);let c="";for(let u=e;u<t;++u)c+=Vt[r[u]];return c}function Bt(r,e,t){let i=r.slice(e,t),c="";for(let u=0;u<i.length-1;u+=2)c+=String.fromCharCode(i[u]+i[u+1]*256);return c}o.prototype.slice=function(e,t){let i=this.length;e=~~e,t=t===void 0?i:~~t,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),t<e&&(t=e);let c=this.subarray(e,t);return Object.setPrototypeOf(c,o.prototype),c};function b(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||b(e,t,this.length);let c=this[e],u=1,h=0;for(;++h<t&&(u*=256);)c+=this[e+h]*u;return c},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||b(e,t,this.length);let c=this[e+--t],u=1;for(;t>0&&(u*=256);)c+=this[e+--t]*u;return c},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e=e>>>0,t||b(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||b(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||b(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||b(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Z(function(e){e=e>>>0,te(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&ae(e,this.length-8);let c=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,u=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(c)+(BigInt(u)<<BigInt(32))}),o.prototype.readBigUInt64BE=Z(function(e){e=e>>>0,te(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&ae(e,this.length-8);let c=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],u=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return (BigInt(c)<<BigInt(32))+BigInt(u)}),o.prototype.readIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||b(e,t,this.length);let c=this[e],u=1,h=0;for(;++h<t&&(u*=256);)c+=this[e+h]*u;return u*=128,c>=u&&(c-=Math.pow(2,8*t)),c},o.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||b(e,t,this.length);let c=t,u=1,h=this[e+--c];for(;c>0&&(u*=256);)h+=this[e+--c]*u;return u*=128,h>=u&&(h-=Math.pow(2,8*t)),h},o.prototype.readInt8=function(e,t){return e=e>>>0,t||b(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},o.prototype.readInt16LE=function(e,t){e=e>>>0,t||b(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i},o.prototype.readInt16BE=function(e,t){e=e>>>0,t||b(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i},o.prototype.readInt32LE=function(e,t){return e=e>>>0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e=e>>>0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Z(function(e){e=e>>>0,te(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&ae(e,this.length-8);let c=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return (BigInt(c)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),o.prototype.readBigInt64BE=Z(function(e){e=e>>>0,te(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&ae(e,this.length-8);let c=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(c)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i)}),o.prototype.readFloatLE=function(e,t){return e=e>>>0,t||b(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e=e>>>0,t||b(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||b(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||b(e,8,this.length),n.read(this,e,!1,52,8)};function F(r,e,t,i,c,u){if(!o.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>c||e<u)throw new RangeError('"value" argument is out of bounds');if(t+i>r.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,i,c){if(e=+e,t=t>>>0,i=i>>>0,!c){let w=Math.pow(2,8*i)-1;F(this,e,t,i,w,0);}let u=1,h=0;for(this[t]=e&255;++h<i&&(u*=256);)this[t+h]=e/u&255;return t+i},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,i,c){if(e=+e,t=t>>>0,i=i>>>0,!c){let w=Math.pow(2,8*i)-1;F(this,e,t,i,w,0);}let u=i-1,h=1;for(this[t+u]=e&255;--u>=0&&(h*=256);)this[t+u]=e/h&255;return t+i},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||F(this,e,t,1,255,0),this[t]=e&255,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||F(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||F(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||F(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},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||F(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 $e(r,e,t,i,c){ze(e,i,c,r,t,7);let u=Number(e&BigInt(4294967295));r[t++]=u,u=u>>8,r[t++]=u,u=u>>8,r[t++]=u,u=u>>8,r[t++]=u;let h=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=h,h=h>>8,r[t++]=h,h=h>>8,r[t++]=h,h=h>>8,r[t++]=h,t}function Ge(r,e,t,i,c){ze(e,i,c,r,t,7);let u=Number(e&BigInt(4294967295));r[t+7]=u,u=u>>8,r[t+6]=u,u=u>>8,r[t+5]=u,u=u>>8,r[t+4]=u;let h=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=h,h=h>>8,r[t+2]=h,h=h>>8,r[t+1]=h,h=h>>8,r[t]=h,t+8}o.prototype.writeBigUInt64LE=Z(function(e,t=0){return $e(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Z(function(e,t=0){return Ge(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(e,t,i,c){if(e=+e,t=t>>>0,!c){let U=Math.pow(2,8*i-1);F(this,e,t,i,U-1,-U);}let u=0,h=1,w=0;for(this[t]=e&255;++u<i&&(h*=256);)e<0&&w===0&&this[t+u-1]!==0&&(w=1),this[t+u]=(e/h>>0)-w&255;return t+i},o.prototype.writeIntBE=function(e,t,i,c){if(e=+e,t=t>>>0,!c){let U=Math.pow(2,8*i-1);F(this,e,t,i,U-1,-U);}let u=i-1,h=1,w=0;for(this[t+u]=e&255;--u>=0&&(h*=256);)e<0&&w===0&&this[t+u+1]!==0&&(w=1),this[t+u]=(e/h>>0)-w&255;return t+i},o.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||F(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},o.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||F(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||F(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},o.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||F(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},o.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||F(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},o.prototype.writeBigInt64LE=Z(function(e,t=0){return $e(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Z(function(e,t=0){return Ge(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ke(r,e,t,i,c,u){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function We(r,e,t,i,c){return e=+e,t=t>>>0,c||Ke(r,e,t,4),n.write(r,e,t,i,23,4),t+4}o.prototype.writeFloatLE=function(e,t,i){return We(this,e,t,!0,i)},o.prototype.writeFloatBE=function(e,t,i){return We(this,e,t,!1,i)};function Ze(r,e,t,i,c){return e=+e,t=t>>>0,c||Ke(r,e,t,8),n.write(r,e,t,i,52,8),t+8}o.prototype.writeDoubleLE=function(e,t,i){return Ze(this,e,t,!0,i)},o.prototype.writeDoubleBE=function(e,t,i){return Ze(this,e,t,!1,i)},o.prototype.copy=function(e,t,i,c){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!c&&c!==0&&(c=this.length),t>=e.length&&(t=e.length),t||(t=0),c>0&&c<i&&(c=i),c===i||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("sourceEnd out of bounds");c>this.length&&(c=this.length),e.length-t<c-i&&(c=e.length-t+i);let u=c-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,i,c):Uint8Array.prototype.set.call(e,this.subarray(i,c),t),u},o.prototype.fill=function(e,t,i,c){if(typeof e=="string"){if(typeof t=="string"?(c=t,t=0,i=this.length):typeof i=="string"&&(c=i,i=this.length),c!==void 0&&typeof c!="string")throw new TypeError("encoding must be a string");if(typeof c=="string"&&!o.isEncoding(c))throw new TypeError("Unknown encoding: "+c);if(e.length===1){let h=e.charCodeAt(0);(c==="utf8"&&h<128||c==="latin1")&&(e=h);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;t=t>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let u;if(typeof e=="number")for(u=t;u<i;++u)this[u]=e;else {let h=o.isBuffer(e)?e:o.from(e,c),w=h.length;if(w===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(u=0;u<i-t;++u)this[u+t]=h[u%w];}return this};let ee={};function Te(r,e,t){ee[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(c){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:c,writable:!0});}toString(){return `${this.name} [${r}]: ${this.message}`}};}Te("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Te("ERR_INVALID_ARG_TYPE",function(r,e){return `The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError),Te("ERR_OUT_OF_RANGE",function(r,e,t){let i=`The value of "${r}" is out of range.`,c=t;return Number.isInteger(t)&&Math.abs(t)>2**32?c=Ye(String(t)):typeof t=="bigint"&&(c=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(c=Ye(c)),c+="n"),i+=` It must be ${e}. Received ${c}`,i},RangeError);function Ye(r){let e="",t=r.length,i=r[0]==="-"?1:0;for(;t>=i+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return `${r.slice(0,t)}${e}`}function Dt(r,e,t){te(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&ae(e,r.length-(t+1));}function ze(r,e,t,i,c,u){if(r>t||r<e){let h=typeof e=="bigint"?"n":"",w;throw e===0||e===BigInt(0)?w=`>= 0${h} and < 2${h} ** ${(u+1)*8}${h}`:w=`>= -(2${h} ** ${(u+1)*8-1}${h}) and < 2 ** ${(u+1)*8-1}${h}`,new ee.ERR_OUT_OF_RANGE("value",w,r)}Dt(i,c,u);}function te(r,e){if(typeof r!="number")throw new ee.ERR_INVALID_ARG_TYPE(e,"number",r)}function ae(r,e,t){throw Math.floor(r)!==r?(te(r,t),new ee.ERR_OUT_OF_RANGE("offset","an integer",r)):e<0?new ee.ERR_BUFFER_OUT_OF_BOUNDS:new ee.ERR_OUT_OF_RANGE("offset",`>= ${0} and <= ${e}`,r)}let Mt=/[^+/0-9A-Za-z-_]/g;function Nt(r){if(r=r.split("=")[0],r=r.trim().replace(Mt,""),r.length<2)return "";for(;r.length%4!==0;)r=r+"=";return r}function Ie(r,e){e=e||1/0;let t,i=r.length,c=null,u=[];for(let h=0;h<i;++h){if(t=r.charCodeAt(h),t>55295&&t<57344){if(!c){if(t>56319){(e-=3)>-1&&u.push(239,191,189);continue}else if(h+1===i){(e-=3)>-1&&u.push(239,191,189);continue}c=t;continue}if(t<56320){(e-=3)>-1&&u.push(239,191,189),c=t;continue}t=(c-55296<<10|t-56320)+65536;}else c&&(e-=3)>-1&&u.push(239,191,189);if(c=null,t<128){if((e-=1)<0)break;u.push(t);}else if(t<2048){if((e-=2)<0)break;u.push(t>>6|192,t&63|128);}else if(t<65536){if((e-=3)<0)break;u.push(t>>12|224,t>>6&63|128,t&63|128);}else if(t<1114112){if((e-=4)<0)break;u.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128);}else throw new Error("Invalid code point")}return u}function Ft(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function Ht(r,e){let t,i,c,u=[];for(let h=0;h<r.length&&!((e-=2)<0);++h)t=r.charCodeAt(h),i=t>>8,c=t%256,u.push(c),u.push(i);return u}function Je(r){return a.toByteArray(Nt(r))}function fe(r,e,t,i){let c;for(c=0;c<i&&!(c+t>=e.length||c>=r.length);++c)e[c+t]=r[c];return c}function $(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function ve(r){return r!==r}let Vt=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let c=0;c<16;++c)e[i+c]=r[t]+r[c];}return e}();function Z(r){return typeof BigInt>"u"?$t:r}function $t(){throw new Error("BigInt not supported")}return j}var Q=on();Q.Buffer;Q.SlowBuffer;Q.INSPECT_MAX_BYTES;Q.kMaxLength;var P=Q.Buffer;Q.INSPECT_MAX_BYTES;Q.kMaxLength;var Ee=(I=>(I.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",I.INVALID_CONFIGURATION="INVALID_CONFIGURATION",I.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR",I.NOT_LOGGED_IN_ERROR="NOT_LOGGED_IN_ERROR",I.SILENT_LOGIN_ERROR="SILENT_LOGIN_ERROR",I.REFRESH_TOKEN_ERROR="REFRESH_TOKEN_ERROR",I.USER_REGISTRATION_ERROR="USER_REGISTRATION_ERROR",I.USER_NOT_REGISTERED_ERROR="USER_NOT_REGISTERED_ERROR",I.LOGOUT_ERROR="LOGOUT_ERROR",I.TRANSFER_ERROR="TRANSFER_ERROR",I.CREATE_ORDER_ERROR="CREATE_ORDER_ERROR",I.CANCEL_ORDER_ERROR="CANCEL_ORDER_ERROR",I.EXCHANGE_TRANSFER_ERROR="EXCHANGE_TRANSFER_ERROR",I.CREATE_TRADE_ERROR="CREATE_TRADE_ERROR",I.OPERATION_NOT_SUPPORTED_ERROR="OPERATION_NOT_SUPPORTED_ERROR",I.LINK_WALLET_ALREADY_LINKED_ERROR="LINK_WALLET_ALREADY_LINKED_ERROR",I.LINK_WALLET_MAX_WALLETS_LINKED_ERROR="LINK_WALLET_MAX_WALLETS_LINKED_ERROR",I.LINK_WALLET_VALIDATION_ERROR="LINK_WALLET_VALIDATION_ERROR",I.LINK_WALLET_DUPLICATE_NONCE_ERROR="LINK_WALLET_DUPLICATE_NONCE_ERROR",I.LINK_WALLET_GENERIC_ERROR="LINK_WALLET_GENERIC_ERROR",I.SERVICE_UNAVAILABLE_ERROR="SERVICE_UNAVAILABLE_ERROR",I.TRANSACTION_REJECTED="TRANSACTION_REJECTED",I))(Ee||{});function ke(a){return typeof a=="object"&&a!==null&&"code"in a&&"message"in a}var sn=a=>{if(ke(a))return a;if(typeof a=="object"&&a!==null&&"response"in a){let{response:n}=a;if(n?.data&&ke(n.data))return n.data}},an=(a,n)=>{let s=n,l=s?.response?.status,d=s?.config?.url,p=s?.config?.baseURL,o=typeof d=="string"&&typeof p=="string"&&!/^https?:\/\//i.test(d)?`${p}${d}`:d;return l==null&&o==null||a.includes("[httpStatus=")?a:`${a} [httpStatus=${l??"unknown"} url=${o??"unknown"}]`},G=class extends Error{type;constructor(n,s){super(n),this.type=s;}},J=async(a,n)=>{try{return await a()}catch(s){let l;if(s instanceof G&&s.type==="SERVICE_UNAVAILABLE_ERROR")throw new G(s.message,s.type);let d=sn(s);throw d?l=d.message:l=s.message,n==="USER_REGISTRATION_ERROR"&&(l=an(l,s)),new G(l,n)}};var cn=(a,n,s)=>{let l=n.map(d=>!a[d]&&d).filter(d=>d).join(", ");if(l!==""){let d=`${l} cannot be null`;throw new G(d,"INVALID_CONFIGURATION")}},le=class{authenticationDomain;passportDomain;oidcConfiguration;crossSdkBridgeEnabled;popupOverlayOptions;constructor({authenticationDomain:n,passportDomain:s,crossSdkBridgeEnabled:l,popupOverlayOptions:d,...p}){cn(p,["clientId","redirectUri"]),this.oidcConfiguration=p,this.crossSdkBridgeEnabled=l||!1,this.popupOverlayOptions=d,this.authenticationDomain=n||"https://auth.immutable.com",this.passportDomain=s||"https://passport.immutable.com";}};var tt=(n=>(n.ZKEVM="zkEvm",n))(tt||{}),be=a=>!!a.zkEvm,rt=(l=>(l.OptedIn="opted_in",l.Unsubscribed="unsubscribed",l.Subscribed="subscribed",l))(rt||{}),xe=(d=>(d.LOGGED_OUT="loggedOut",d.LOGGED_IN="loggedIn",d.TOKEN_REFRESHED="tokenRefreshed",d.USER_REMOVED="userRemoved",d))(xe||{});var nt="im_passport_embedded_login_prompt";var ne="passport-overlay",q="passport-overlay-contents",ye=`${ne}-close`,we=`${ne}-try-again`,it=`
6
6
  <svg
7
7
  viewBox="0 0 20 20"
8
8
  fill="none"
@@ -14,7 +14,7 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
14
14
  fill="#F3F3F3"
15
15
  />
16
16
  </svg>
17
- `,st=`
17
+ `,ot=`
18
18
  <svg
19
19
  viewBox="0 0 17 16"
20
20
  fill="none"
@@ -28,7 +28,7 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
28
28
  fill="#E01A3D"
29
29
  />
30
30
  </svg>
31
- `,Be=`
31
+ `,Se=`
32
32
  <svg
33
33
  style="
34
34
  max-width: 123px !important;
@@ -211,9 +211,9 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
211
211
  </clipPath>
212
212
  </defs>
213
213
  </svg>
214
- `;var dn=()=>`
214
+ `;var ln=()=>`
215
215
  <button
216
- id="${we}"
216
+ id="${ye}"
217
217
  style="
218
218
  background: #f3f3f326 !important;
219
219
  border: none !important;
@@ -229,11 +229,11 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
229
229
  justify-content: center !important;
230
230
  "
231
231
  >
232
- ${ot}
232
+ ${it}
233
233
  </button>
234
- `,at=()=>`
234
+ `,st=()=>`
235
235
  <button
236
- id="${_e}"
236
+ id="${we}"
237
237
  style="
238
238
  margin-top: 27px !important;
239
239
  color: #f3f3f3 !important;
@@ -248,8 +248,8 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
248
248
  >
249
249
  Try again
250
250
  </button>
251
- `,pn=()=>`
252
- ${Be}
251
+ `,un=()=>`
252
+ ${Se}
253
253
  <div
254
254
  style="
255
255
  color: #e01a3d !important;
@@ -259,7 +259,7 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
259
259
  margin-bottom: 10px !important;
260
260
  "
261
261
  >
262
- ${st}
262
+ ${ot}
263
263
  Pop-up blocked
264
264
  </div>
265
265
  <p style="
@@ -272,9 +272,9 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
272
272
  If the problem continues, adjust your<br />
273
273
  browser settings.
274
274
  </p>
275
- ${at()}
276
- `,hn=()=>`
277
- ${Be}
275
+ ${st()}
276
+ `,dn=()=>`
277
+ ${Se}
278
278
  <p style="
279
279
  color: #b6b6b6 !important;
280
280
  text-align: center !important;
@@ -283,8 +283,8 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
283
283
  >
284
284
  Secure pop-up not showing?<br />We'll help you re-launch
285
285
  </p>
286
- ${at()}
287
- `,ct=a=>`
286
+ ${st()}
287
+ `,at=a=>`
288
288
  <div
289
289
  id="${ne}"
290
290
  style="
@@ -309,7 +309,7 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
309
309
  z-index: 2147483647 !important;
310
310
  "
311
311
  >
312
- ${dn()}
312
+ ${ln()}
313
313
  <div
314
314
  id="${q}"
315
315
  style="
@@ -322,7 +322,7 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
322
322
  ${a??""}
323
323
  </div>
324
324
  </div>
325
- `,lt=()=>`
325
+ `,ct=()=>`
326
326
  <div
327
327
  id="${ne}"
328
328
  style="
@@ -351,7 +351,7 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
351
351
  "
352
352
  />
353
353
  </div>
354
- `;function Ce({id:a,href:n,rel:s,crossOrigin:l}){let d=`${ne}-${a}`;if(!document.getElementById(d)){let p=document.createElement("link");p.id=d,p.href=n,s&&(p.rel=s),l&&(p.crossOrigin=l),document.head.appendChild(p);}}var ut=()=>ct(pn()),dt=()=>ct(hn());var K=class{static overlay;static onCloseListener;static closeButton;static remove(){this.onCloseListener&&this.closeButton?.removeEventListener?.("click",this.onCloseListener),this.overlay?.remove(),this.closeButton=void 0,this.onCloseListener=void 0,this.overlay=void 0;}static appendOverlay(n,s){if(!this.overlay){let l=document.createElement("div");l.innerHTML=lt(),document.body.insertAdjacentElement("beforeend",l);let d=document.querySelector(`#${q}`);d&&d.appendChild(n),l.addEventListener("click",s),this.overlay=l;}}};var gn=660,En=440,yn="16px",pt="passport-embedded-login-keyframes",ht="passport-embedded-login-iframe",ue=class a{config;constructor(n){this.config=n;}getHref=()=>`${this.config.authenticationDomain}/im-embedded-login-prompt?client_id=${this.config.oidcConfiguration.clientId}&rid=${getDetail(Detail.RUNTIME_ID)}`;static appendIFrameStylesIfNeeded=()=>{if(document.getElementById(pt))return;let n=document.createElement("style");n.id=pt,n.textContent=`
354
+ `;function _e({id:a,href:n,rel:s,crossOrigin:l}){let d=`${ne}-${a}`;if(!document.getElementById(d)){let p=document.createElement("link");p.id=d,p.href=n,s&&(p.rel=s),l&&(p.crossOrigin=l),document.head.appendChild(p);}}var lt=()=>at(un()),ut=()=>at(dn());var K=class{static overlay;static onCloseListener;static closeButton;static remove(){this.onCloseListener&&this.closeButton?.removeEventListener?.("click",this.onCloseListener),this.overlay?.remove(),this.closeButton=void 0,this.onCloseListener=void 0,this.overlay=void 0;}static appendOverlay(n,s){if(!this.overlay){let l=document.createElement("div");l.innerHTML=ct(),document.body.insertAdjacentElement("beforeend",l);let d=document.querySelector(`#${q}`);d&&d.appendChild(n),l.addEventListener("click",s),this.overlay=l;}}};var fn=660,mn=440,gn="16px",dt="passport-embedded-login-keyframes",pt="passport-embedded-login-iframe",ue=class a{config;constructor(n){this.config=n;}getHref=()=>`${this.config.authenticationDomain}/im-embedded-login-prompt?client_id=${this.config.oidcConfiguration.clientId}&rid=${getDetail(Detail.RUNTIME_ID)}`;static appendIFrameStylesIfNeeded=()=>{if(document.getElementById(dt))return;let n=document.createElement("style");n.id=dt,n.textContent=`
355
355
  @keyframes passportEmbeddedLoginPromptPopBounceIn {
356
356
  0% {
357
357
  opacity: 0.5;
@@ -370,7 +370,7 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
370
370
  }
371
371
 
372
372
  @media (max-height: 400px) {
373
- #${ht} {
373
+ #${pt} {
374
374
  width: 100% !important;
375
375
  max-width: none !important;
376
376
  }
@@ -384,7 +384,7 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
384
384
  opacity: 1;
385
385
  }
386
386
  }
387
- `,document.head.appendChild(n);};getEmbeddedLoginIFrame=()=>{let n=document.createElement("iframe");return n.id=ht,n.src=this.getHref(),n.style.height="100vh",n.style.width="100vw",n.style.maxHeight=`${gn}px`,n.style.maxWidth=`${En}px`,n.style.borderRadius=yn,n.style.opacity="0",n.style.transform="scale(0.6)",n.style.animation="passportEmbeddedLoginPromptPopBounceIn 1s ease forwards",a.appendIFrameStylesIfNeeded(),n};displayEmbeddedLoginPrompt(){return new Promise((n,s)=>{let l=this.getEmbeddedLoginIFrame(),d=({data:p,origin:o})=>{if(!(o!==this.config.authenticationDomain||p.eventType!==it))switch(p.messageType){case"login_method_selected":{let f=p.payload;window.removeEventListener("message",d),K.remove(),n(f);break}case"login_prompt_error":{window.removeEventListener("message",d),K.remove(),s(new Error("Error during embedded login prompt",{cause:p.payload}));break}case"login_prompt_closed":{window.removeEventListener("message",d),K.remove(),s(new Error("Popup closed by user"));break}default:window.removeEventListener("message",d),K.remove(),s(new Error(`Unsupported message type: ${p.messageType}`));break}};window.addEventListener("message",d),K.appendOverlay(l,()=>{window.removeEventListener("message",d),K.remove(),s(new Error("Popup closed by user"));});})}};var ie=class{listeners=new Map;emit(n,...s){let l=this.listeners.get(n);!l||l.size===0||[...l].forEach(d=>{d(...s);});}on(n,s){let l=this.listeners.get(n)??new Set;l.add(s),this.listeners.set(n,l);}removeListener(n,s){let l=this.listeners.get(n);l&&(l.delete(s),l.size===0&&this.listeners.delete(n));}};var H=async(a,n,s=!0,l=!0)=>{let d=trackFlow("passport",n,s);try{return await a(d)}catch(p){throw p instanceof Error?trackError("passport",n,p,{flowId:d.details.flowId}):d.addEvent("errored"),p}finally{l&&d.addEvent("End");}};var Cn=()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof globalThis<"u"?globalThis:{},Rn=a=>{let n=a.replace(/-/g,"+").replace(/_/g,"/"),s=n.length%4===0?"":"=".repeat(4-n.length%4);return n+s},Tn=a=>{let n=Cn();if(typeof n.atob!="function")return null;let s=n.atob(a),l=new Uint8Array(s.length);for(let p=0;p<s.length;p+=1)l[p]=s.charCodeAt(p);if(typeof n.TextDecoder=="function")return new n.TextDecoder("utf-8").decode(l);let d="";for(let p=0;p<l.length;p+=1)d+=String.fromCharCode(l[p]);return d},In=a=>{if(typeof P<"u")return P.from(a,"base64").toString("utf-8");let n=Tn(a);if(n===null)throw new Error("Base64 decoding is not supported in this environment");return n},V=a=>{if(typeof a!="string")throw new Error("JWT must be a string");let n=a.split(".");if(n.length<2)throw new Error("Invalid JWT: payload segment is missing");let s=n[1],l=In(Rn(s));try{return JSON.parse(l)}catch{throw new Error("Invalid JWT payload: unable to parse JSON")}};var ft="pkce_state",mt="pkce_verifier",vn=3600,de=class{isTokenValid(n){try{let l=V(n).exp??0,d=Date.now()/1e3+vn;return l>d}catch{return !1}}savePKCEData(n){localStorage.setItem(ft,n.state),localStorage.setItem(mt,n.verifier);}getPKCEData(){let n=localStorage.getItem(ft),s=localStorage.getItem(mt);return n&&s?{state:n,verifier:s}:null}};var Ln=(...a)=>{if(typeof v>"u")return;v?.env?.JEST_WORKER_ID===void 0&&console.warn(...a);},oe={warn:Ln};function gt(a){try{let n=V(a),s=Math.floor(Date.now()/1e3);return n.exp?n.exp<=s+30:!0}catch{return !0}}function Et(a){let{id_token:n,access_token:s}=a;return !s||!n?!0:gt(s)||gt(n)}var pe=class{disableGenericPopupOverlay;disableBlockedPopupOverlay;overlay;isBlockedOverlay;tryAgainListener;onCloseListener;constructor(n,s=!1){this.disableBlockedPopupOverlay=n.disableBlockedPopupOverlay||!1,this.disableGenericPopupOverlay=n.disableGenericPopupOverlay||!1,this.isBlockedOverlay=s;}append(n,s){this.shouldAppendOverlay()&&(this.appendOverlay(),this.updateTryAgainButton(n),this.updateCloseButton(s));}update(n){this.updateTryAgainButton(n);}remove(){this.overlay&&this.overlay.remove();}shouldAppendOverlay(){return !(this.disableGenericPopupOverlay&&this.disableBlockedPopupOverlay||this.disableGenericPopupOverlay&&!this.isBlockedOverlay||this.disableBlockedPopupOverlay&&this.isBlockedOverlay)}appendOverlay(){if(!this.overlay){Ce({id:"link-googleapis",href:"https://fonts.googleapis.com"}),Ce({id:"link-gstatic",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),Ce({id:"link-roboto",href:"https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap",rel:"stylesheet"});let s=document.createElement("div");s.innerHTML=this.isBlockedOverlay?ut():dt(),document.body.insertAdjacentElement("beforeend",s),this.overlay=s;}}updateTryAgainButton(n){let s=document.getElementById(_e);s&&(this.tryAgainListener&&s.removeEventListener("click",this.tryAgainListener),this.tryAgainListener=n,s.addEventListener("click",n));}updateCloseButton(n){let s=document.getElementById(we);s&&(this.onCloseListener&&s.removeEventListener("click",this.onCloseListener),this.onCloseListener=n,s.addEventListener("click",n));}};var Re=class{storage;constructor(n,s){this.storage=On.createInstance({name:n,driver:s});}get length(){return this.storage.length()}clear(){return this.storage.clear()}getItem(n){return this.storage.getItem(n)}key(n){return this.storage.key(n)}async removeItem(n){await this.storage.removeItem(n);}async setItem(n,s){await this.storage.setItem(n,s);}};var Pn="/v2/logout",An="/im-logged-out",Un="https://auth.immutable.com";function kn(a){return a.replace(/^(?:https?:\/\/)?(.*)/,"https://$1")}function Te(a){let n=kn(a.authenticationDomain||Un),s=a.crossSdkBridgeEnabled?An:Pn,l=new URL(s,n);return l.searchParams.set("client_id",a.clientId),a.logoutRedirectUri&&l.searchParams.set("returnTo",a.logoutRedirectUri),l.toString()}var Kn={"Content-Type":"application/x-www-form-urlencoded"},Wn=a=>{if(a)try{return JSON.parse(a)}catch{return}},Zn=(a,n,s)=>{if(a&&typeof a=="object"){let l=a,d=l.error_description??l.message??l.error;if(typeof d=="string"&&d.trim().length>0)return d}return n.trim().length>0?n:`Token request failed with status ${s}`},yt=(a,n)=>({ethAddress:a,userAdminAddress:n}),Yn="/authorize",zn=a=>{let{authenticationDomain:n,oidcConfiguration:s}=a,l;a.crossSdkBridgeEnabled?l=new Re("ImmutableSDKPassport",On.INDEXEDDB):typeof window<"u"?l=window.localStorage:l=new InMemoryWebStorage;let d=new WebStorageStateStore({store:l}),p=Te({clientId:s.clientId,authenticationDomain:n,logoutRedirectUri:s.logoutRedirectUri,crossSdkBridgeEnabled:a.crossSdkBridgeEnabled});return {authority:n,redirect_uri:s.redirectUri,popup_redirect_uri:s.popupRedirectUri||s.redirectUri,client_id:s.clientId,metadata:{authorization_endpoint:`${n}/authorize`,token_endpoint:`${n}/oauth/token`,userinfo_endpoint:`${n}/userinfo`,end_session_endpoint:p,revocation_endpoint:`${n}/oauth/revoke`},automaticSilentRenew:!1,scope:s.scope,userStore:d,revokeTokenTypes:["refresh_token"],extraQueryParams:{...s.audience?{audience:s.audience}:{}}}};function Me(a){return btoa(String.fromCharCode(...new Uint8Array(a))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function Jn(a){let s=new TextEncoder().encode(a);return window.crypto.subtle.digest("SHA-256",s)}var De=class a{config;userManager;deviceCredentialsManager;embeddedLoginPrompt;logoutMode;refreshingPromise=null;eventEmitter;constructor(n){this.config=new le(n),this.embeddedLoginPrompt=new ue(this.config),this.userManager=new UserManager(zn(this.config)),this.deviceCredentialsManager=new de,this.logoutMode=this.config.oidcConfiguration.logoutMode||"redirect",this.eventEmitter=new ie,track("passport","initialise");}async login(n){return H(async()=>{let{useCachedSession:s=!1,useSilentLogin:l}=n||{},d=null;try{d=await this.getUserInternal();}catch(p){if(p instanceof Error&&!p.message.includes("Unknown or invalid refresh token")&&trackError("passport","login",p),s)throw p;oe.warn("Failed to retrieve a cached user session",p);}if(!d&&l)d=await this.forceUserRefreshInternal();else if(!d&&!s){if(n?.useRedirectFlow)return await this.loginWithRedirectInternal(n?.directLoginOptions),null;d=await this.loginWithPopup(n?.directLoginOptions);}return d&&this.handleSuccessfulLogin(d),d},"login")}async loginWithRedirect(n){await this.loginWithRedirectInternal(n);}async loginCallback(){return H(async()=>{let n=await this.loginCallbackInternal();return n&&this.handleSuccessfulLogin(n),n},"loginCallback")}async logout(){await H(async()=>{await this.logoutInternal(),this.eventEmitter.emit("loggedOut");},"logout");}async getUser(){return this.getUserInternal()}async getUserOrLogin(){let n=null;try{n=await this.getUserInternal();}catch(l){oe.warn("Failed to retrieve a cached user session",l);}if(n)return n;let s=await this.loginWithPopup();return this.handleSuccessfulLogin(s),s}async getUserZkEvm(){return this.getUserZkEvmInternal()}async getIdToken(){return H(async()=>(await this.getUserInternal())?.idToken,"getIdToken",!1)}async getAccessToken(){return H(async()=>(await this.getUserInternal())?.accessToken,"getAccessToken",!1,!1)}async isLoggedIn(){return await this.getUser()!==null}async forceUserRefresh(){return this.forceUserRefreshInternal()}forceUserRefreshInBackground(){this.forceUserRefreshInBackgroundInternal();}async loginWithPKCEFlow(n,s){return H(async()=>this.getPKCEAuthorizationUrl(n,s),"loginWithPKCEFlow")}async loginWithPKCEFlowCallback(n,s){return H(async()=>{let l=await this.loginWithPKCEFlowCallbackInternal(n,s);return this.handleSuccessfulLogin(l),l},"loginWithPKCEFlowCallback")}async storeTokens(n){return H(async()=>{let s=await this.storeTokensInternal(n);return this.handleSuccessfulLogin(s),s},"storeTokens")}async getLogoutUrl(){return H(async()=>(await this.userManager.removeUser(),this.eventEmitter.emit("loggedOut"),await this.getLogoutUrlInternal()||void 0),"getLogoutUrl")}async logoutSilentCallback(n){return H(()=>this.userManager.signoutSilentCallback(n),"logoutSilentCallback")}getConfig(){return this.config}async getClientId(){return this.config.oidcConfiguration.clientId}handleSuccessfulLogin(n){this.eventEmitter.emit("loggedIn",n),identify({passportId:n.profile.sub});}buildExtraQueryParams(n,s){let l={...this.userManager.settings?.extraQueryParams??{},rid:getDetail(Detail.RUNTIME_ID)||""};if(n){if(n.directLoginMethod==="email"){let d=n.email;d&&(l.direct=n.directLoginMethod,l.email=d);}else l.direct=n.directLoginMethod;n.marketingConsentStatus&&(l.marketingConsent=n.marketingConsentStatus);}return s&&(l.im_passport_trace_id=s),l}async loginWithRedirectInternal(n){await this.userManager.clearStaleState(),await J(async()=>{let s=this.buildExtraQueryParams(n);await this.userManager.signinRedirect({extraQueryParams:s});},"AUTHENTICATION_ERROR");}async loginWithPopup(n){return J(async()=>{let s,l;if(n)s=n;else if(!this.config.popupOverlayOptions?.disableHeadlessLoginPromptOverlay){let{imPassportTraceId:o,...f}=await this.embeddedLoginPrompt.displayEmbeddedLoginPrompt();s=f,l=o;}let d=window.crypto.randomUUID(),p=async()=>{let o=this.buildExtraQueryParams(s,l);return this.userManager.signinPopup({extraQueryParams:o,popupWindowFeatures:{width:410,height:450},popupWindowTarget:d,popupAbortOnClose:!0})};return new Promise((o,f)=>{p().then(E=>o(a.mapOidcUserToDomainModel(E))).catch(E=>{if(!(E instanceof Error)||E.message!=="Attempted to navigate on a disposed window"){f(E);return}let _=!1,g=new pe(this.config.popupOverlayOptions||{},!0);g.append(async()=>{try{if(_)window.open("",d);else {_=!0;let R=await p();g.remove(),o(a.mapOidcUserToDomainModel(R));}}catch(R){g.remove(),f(R);}},()=>{g.remove(),f(new Error("Popup closed by user"));});});})},"AUTHENTICATION_ERROR")}static mapOidcUserToDomainModel=n=>{let s,l;if(n.id_token){let o=V(n.id_token);s=o?.passport,o?.username&&(l=o?.username);}let d={expired:n.expired,idToken:n.id_token,accessToken:n.access_token,refreshToken:n.refresh_token,profile:{sub:n.profile.sub,email:n.profile.email,nickname:n.profile.nickname,username:l}};s?.zkevm_eth_address&&s?.zkevm_user_admin_address&&(d.zkEvm=yt(s.zkevm_eth_address,s.zkevm_user_admin_address));let p=Object.values(ye).filter(o=>o!=="zkevm");for(let o of p){let f=s?.[o];f?.eth_address&&f?.user_admin_address&&(d[o]=yt(f.eth_address,f.user_admin_address));}return d};static mapDeviceTokenResponseToOidcUser=n=>{let s=V(n.id_token);return new User({id_token:n.id_token,access_token:n.access_token,refresh_token:n.refresh_token,token_type:n.token_type,profile:{sub:s.sub,iss:s.iss,aud:s.aud,exp:s.exp,iat:s.iat,email:s.email,nickname:s.nickname,passport:s.passport,...s.username?{username:s.username}:{}}})};async loginCallbackInternal(){return J(async()=>{let n=await this.userManager.signinCallback();if(n)return a.mapOidcUserToDomainModel(n)},"AUTHENTICATION_ERROR")}async getPKCEAuthorizationUrl(n,s){let l=Me(window.crypto.getRandomValues(new Uint8Array(32))),d=Me(await Jn(l)),p=Me(window.crypto.getRandomValues(new Uint8Array(32))),{redirectUri:o,scope:f,audience:E,clientId:_}=this.config.oidcConfiguration;this.deviceCredentialsManager.savePKCEData({state:p,verifier:l});let g=new URL(Yn,this.config.authenticationDomain);if(g.searchParams.set("response_type","code"),g.searchParams.set("code_challenge",d),g.searchParams.set("code_challenge_method","S256"),g.searchParams.set("client_id",_),g.searchParams.set("redirect_uri",o),g.searchParams.set("state",p),f&&g.searchParams.set("scope",f),E&&g.searchParams.set("audience",E),n){if(n.directLoginMethod==="email"){let R=n.email;R&&(g.searchParams.set("direct",n.directLoginMethod),g.searchParams.set("email",R));}else g.searchParams.set("direct",n.directLoginMethod);n.marketingConsentStatus&&g.searchParams.set("marketingConsent",n.marketingConsentStatus);}return s&&g.searchParams.set("im_passport_trace_id",s),g.toString()}async loginWithPKCEFlowCallbackInternal(n,s){return J(async()=>{let l=this.deviceCredentialsManager.getPKCEData();if(!l)throw new Error("No code verifier or state for PKCE");if(s!==l.state)throw new Error("Provided state does not match stored state");let d=await this.getPKCEToken(n,l.verifier),p=a.mapDeviceTokenResponseToOidcUser(d),o=a.mapOidcUserToDomainModel(p);return await this.userManager.storeUser(p),o},"AUTHENTICATION_ERROR")}async getPKCEToken(n,s){let l=await fetch(`${this.config.authenticationDomain}/oauth/token`,{method:"POST",headers:Kn,body:new URLSearchParams({client_id:this.config.oidcConfiguration.clientId,grant_type:"authorization_code",code_verifier:s,code:n,redirect_uri:this.config.oidcConfiguration.redirectUri})}),d=await l.text(),p=Wn(d);if(!l.ok)throw new Error(Zn(p,d,l.status));if(!p||typeof p!="object")throw new Error("Token endpoint returned an invalid response");return p}async storeTokensInternal(n){return J(async()=>{let s=a.mapDeviceTokenResponseToOidcUser(n),l=a.mapOidcUserToDomainModel(s);return await this.userManager.storeUser(s),l},"AUTHENTICATION_ERROR")}async logoutInternal(){await J(async()=>{await this.userManager.revokeTokens(["refresh_token"]),this.logoutMode==="silent"?await this.userManager.signoutSilent():await this.userManager.signoutRedirect();},"LOGOUT_ERROR");}async getLogoutUrlInternal(){let n=this.userManager.settings?.metadata?.end_session_endpoint;return n||(oe.warn("Failed to get logout URL"),null)}forceUserRefreshInBackgroundInternal(){this.refreshTokenAndUpdatePromise().catch(n=>{oe.warn("Failed to refresh user token",n);});}async forceUserRefreshInternal(){return this.refreshTokenAndUpdatePromise().catch(n=>(oe.warn("Failed to refresh user token",n),null))}async refreshTokenAndUpdatePromise(){return this.refreshingPromise?this.refreshingPromise:(this.refreshingPromise=new Promise((n,s)=>{(async()=>{try{let l=await this.userManager.signinSilent();if(l){let d=a.mapOidcUserToDomainModel(l);this.eventEmitter.emit("tokenRefreshed",d),n(d);return}n(null);}catch(l){let d="AUTHENTICATION_ERROR",p="Failed to refresh token",o=!0;if(l instanceof ErrorTimeout?(d="SILENT_LOGIN_ERROR",p=`${p}: ${l.message}`,o=!1):l instanceof ErrorResponse?(d="NOT_LOGGED_IN_ERROR",p=`${p}: ${l.message||l.error_description}`):l instanceof Error?p=`${p}: ${l.message}`:typeof l=="string"&&(p=`${p}: ${l}`),o){this.eventEmitter.emit("userRemoved",{reason:"refresh_failed",error:p});try{await this.userManager.removeUser();}catch(f){f instanceof Error&&(p=`${p}: Failed to remove user: ${f.message}`);}}s(new G(p,d));}finally{this.refreshingPromise=null;}})();}),this.refreshingPromise)}async getUserInternal(n=s=>!0){if(this.refreshingPromise){let l=await this.refreshingPromise;return l&&n(l)?l:null}let s=await this.userManager.getUser();if(!s)return null;if(!Et(s)){let l=a.mapOidcUserToDomainModel(s);if(l&&n(l))return l}if(s.refresh_token){let l=await this.refreshTokenAndUpdatePromise();if(l&&n(l))return l}return null}async getUserZkEvmInternal(){let n=await this.getUserInternal(xe);if(!n)throw new Error("Failed to obtain a User with the required ZkEvm attributes");return n}};var jn="im_passport_embedded_login_prompt",Ct="passport-embedded-login-iframe",Rt="passport-overlay";var Qn="https://auth.immutable.com",ei="platform_api",ti="openid profile email offline_access transact",ri="/authorize",ni="/oauth/token",Ne="imtbl_pkce_data";function Tt(a){return btoa(String.fromCharCode(...new Uint8Array(a))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function ii(a){let s=new TextEncoder().encode(a);return window.crypto.subtle.digest("SHA-256",s)}function wt(){return Tt(window.crypto.getRandomValues(new Uint8Array(32)))}function Fe(a){return a.authenticationDomain||Qn}function oi(a){try{let n=V(a);if(n.exp)return n.exp*1e3}catch{}return Date.now()+3600*1e3}function si(a){let{access_token:n,refresh_token:s,id_token:l}=a,d={sub:""},p;if(l)try{let{sub:o,email:f,nickname:E,passport:_}=V(l);d={sub:o,email:f,nickname:E},_?.zkevm_eth_address&&_?.zkevm_user_admin_address&&(p={ethAddress:_.zkevm_eth_address,userAdminAddress:_.zkevm_user_admin_address});}catch{}return {accessToken:n,refreshToken:s,idToken:l,accessTokenExpires:oi(n),profile:d,zkEvm:p}}function ai(a){typeof window<"u"&&window.sessionStorage&&window.sessionStorage.setItem(Ne,JSON.stringify(a));}function ci(){if(typeof window<"u"&&window.sessionStorage){let a=window.sessionStorage.getItem(Ne);if(a)try{return JSON.parse(a)}catch{return null}}return null}function _t(){typeof window<"u"&&window.sessionStorage&&window.sessionStorage.removeItem(Ne);}function li(){let a="passport-embedded-login-keyframes";if(document.getElementById(a))return;let n=document.createElement("style");n.id=a,n.textContent=`
387
+ `,document.head.appendChild(n);};getEmbeddedLoginIFrame=()=>{let n=document.createElement("iframe");return n.id=pt,n.src=this.getHref(),n.style.height="100vh",n.style.width="100vw",n.style.maxHeight=`${fn}px`,n.style.maxWidth=`${mn}px`,n.style.borderRadius=gn,n.style.opacity="0",n.style.transform="scale(0.6)",n.style.animation="passportEmbeddedLoginPromptPopBounceIn 1s ease forwards",a.appendIFrameStylesIfNeeded(),n};displayEmbeddedLoginPrompt(){return new Promise((n,s)=>{let l=this.getEmbeddedLoginIFrame(),d=({data:p,origin:o})=>{if(!(o!==this.config.authenticationDomain||p.eventType!==nt))switch(p.messageType){case"login_method_selected":{let f=p.payload;window.removeEventListener("message",d),K.remove(),n(f);break}case"login_prompt_error":{window.removeEventListener("message",d),K.remove(),s(new Error("Error during embedded login prompt",{cause:p.payload}));break}case"login_prompt_closed":{window.removeEventListener("message",d),K.remove(),s(new Error("Popup closed by user"));break}default:window.removeEventListener("message",d),K.remove(),s(new Error(`Unsupported message type: ${p.messageType}`));break}};window.addEventListener("message",d),K.appendOverlay(l,()=>{window.removeEventListener("message",d),K.remove(),s(new Error("Popup closed by user"));});})}};var ie=class{listeners=new Map;emit(n,...s){let l=this.listeners.get(n);!l||l.size===0||[...l].forEach(d=>{d(...s);});}on(n,s){let l=this.listeners.get(n)??new Set;l.add(s),this.listeners.set(n,l);}removeListener(n,s){let l=this.listeners.get(n);l&&(l.delete(s),l.size===0&&this.listeners.delete(n));}};var H=async(a,n,s=!0,l=!0)=>{let d=trackFlow("passport",n,s);try{return await a(d)}catch(p){throw p instanceof Error?trackError("passport",n,p,{flowId:d.details.flowId}):d.addEvent("errored"),p}finally{l&&d.addEvent("End");}};var wn=()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof globalThis<"u"?globalThis:{},_n=a=>{let n=a.replace(/-/g,"+").replace(/_/g,"/"),s=n.length%4===0?"":"=".repeat(4-n.length%4);return n+s},Cn=a=>{let n=wn();if(typeof n.atob!="function")return null;let s=n.atob(a),l=new Uint8Array(s.length);for(let p=0;p<s.length;p+=1)l[p]=s.charCodeAt(p);if(typeof n.TextDecoder=="function")return new n.TextDecoder("utf-8").decode(l);let d="";for(let p=0;p<l.length;p+=1)d+=String.fromCharCode(l[p]);return d},Rn=a=>{if(typeof P<"u")return P.from(a,"base64").toString("utf-8");let n=Cn(a);if(n===null)throw new Error("Base64 decoding is not supported in this environment");return n},V=a=>{if(typeof a!="string")throw new Error("JWT must be a string");let n=a.split(".");if(n.length<2)throw new Error("Invalid JWT: payload segment is missing");let s=n[1],l=Rn(_n(s));try{return JSON.parse(l)}catch{throw new Error("Invalid JWT payload: unable to parse JSON")}};var ht="pkce_state",ft="pkce_verifier",Tn=3600,de=class{isTokenValid(n){try{let l=V(n).exp??0,d=Date.now()/1e3+Tn;return l>d}catch{return !1}}savePKCEData(n){localStorage.setItem(ht,n.state),localStorage.setItem(ft,n.verifier);}getPKCEData(){let n=localStorage.getItem(ht),s=localStorage.getItem(ft);return n&&s?{state:n,verifier:s}:null}};var In=(...a)=>{if(typeof v>"u")return;v?.env?.JEST_WORKER_ID===void 0&&console.warn(...a);},oe={warn:In};function mt(a){try{let n=V(a),s=Math.floor(Date.now()/1e3);return n.exp?n.exp<=s+30:!0}catch{return !0}}function gt(a){let{id_token:n,access_token:s}=a;return !s||!n?!0:mt(s)||mt(n)}var pe=class{disableGenericPopupOverlay;disableBlockedPopupOverlay;overlay;isBlockedOverlay;tryAgainListener;onCloseListener;constructor(n,s=!1){this.disableBlockedPopupOverlay=n.disableBlockedPopupOverlay||!1,this.disableGenericPopupOverlay=n.disableGenericPopupOverlay||!1,this.isBlockedOverlay=s;}append(n,s){this.shouldAppendOverlay()&&(this.appendOverlay(),this.updateTryAgainButton(n),this.updateCloseButton(s));}update(n){this.updateTryAgainButton(n);}remove(){this.overlay&&this.overlay.remove();}shouldAppendOverlay(){return !(this.disableGenericPopupOverlay&&this.disableBlockedPopupOverlay||this.disableGenericPopupOverlay&&!this.isBlockedOverlay||this.disableBlockedPopupOverlay&&this.isBlockedOverlay)}appendOverlay(){if(!this.overlay){_e({id:"link-googleapis",href:"https://fonts.googleapis.com"}),_e({id:"link-gstatic",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),_e({id:"link-roboto",href:"https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap",rel:"stylesheet"});let s=document.createElement("div");s.innerHTML=this.isBlockedOverlay?lt():ut(),document.body.insertAdjacentElement("beforeend",s),this.overlay=s;}}updateTryAgainButton(n){let s=document.getElementById(we);s&&(this.tryAgainListener&&s.removeEventListener("click",this.tryAgainListener),this.tryAgainListener=n,s.addEventListener("click",n));}updateCloseButton(n){let s=document.getElementById(ye);s&&(this.onCloseListener&&s.removeEventListener("click",this.onCloseListener),this.onCloseListener=n,s.addEventListener("click",n));}};var Ce=class{storage;constructor(n,s){this.storage=vn.createInstance({name:n,driver:s});}get length(){return this.storage.length()}clear(){return this.storage.clear()}getItem(n){return this.storage.getItem(n)}key(n){return this.storage.key(n)}async removeItem(n){await this.storage.removeItem(n);}async setItem(n,s){await this.storage.setItem(n,s);}};var Ln="/v2/logout",On="/im-logged-out",Pn="https://auth.immutable.com";function An(a){return a.replace(/^(?:https?:\/\/)?(.*)/,"https://$1")}function Re(a){let n=An(a.authenticationDomain||Pn),s=a.crossSdkBridgeEnabled?On:Ln,l=new URL(s,n);return l.searchParams.set("client_id",a.clientId),a.logoutRedirectUri&&l.searchParams.set("returnTo",a.logoutRedirectUri),l.toString()}var $n={"Content-Type":"application/x-www-form-urlencoded"},Gn=a=>{if(a)try{return JSON.parse(a)}catch{return}},Kn=(a,n,s)=>{if(a&&typeof a=="object"){let l=a,d=l.error_description??l.message??l.error;if(typeof d=="string"&&d.trim().length>0)return d}return n.trim().length>0?n:`Token request failed with status ${s}`},Wn=(a,n)=>({ethAddress:a,userAdminAddress:n}),Zn="/authorize",Yn=a=>{let{authenticationDomain:n,oidcConfiguration:s}=a,l;a.crossSdkBridgeEnabled?l=new Ce("ImmutableSDKPassport",vn.INDEXEDDB):typeof window<"u"?l=window.localStorage:l=new InMemoryWebStorage;let d=new WebStorageStateStore({store:l}),p=Re({clientId:s.clientId,authenticationDomain:n,logoutRedirectUri:s.logoutRedirectUri,crossSdkBridgeEnabled:a.crossSdkBridgeEnabled});return {authority:n,redirect_uri:s.redirectUri,popup_redirect_uri:s.popupRedirectUri||s.redirectUri,client_id:s.clientId,metadata:{authorization_endpoint:`${n}/authorize`,token_endpoint:`${n}/oauth/token`,userinfo_endpoint:`${n}/userinfo`,end_session_endpoint:p,revocation_endpoint:`${n}/oauth/revoke`},automaticSilentRenew:!1,scope:s.scope,userStore:d,revokeTokenTypes:["refresh_token"],extraQueryParams:{...s.audience?{audience:s.audience}:{}}}};function Be(a){return btoa(String.fromCharCode(...new Uint8Array(a))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function zn(a){let s=new TextEncoder().encode(a);return window.crypto.subtle.digest("SHA-256",s)}var De=class a{config;userManager;deviceCredentialsManager;embeddedLoginPrompt;logoutMode;refreshingPromise=null;eventEmitter;constructor(n){this.config=new le(n),this.embeddedLoginPrompt=new ue(this.config),this.userManager=new UserManager(Yn(this.config)),this.deviceCredentialsManager=new de,this.logoutMode=this.config.oidcConfiguration.logoutMode||"redirect",this.eventEmitter=new ie,track("passport","initialise");}async login(n){return H(async()=>{let{useCachedSession:s=!1,useSilentLogin:l}=n||{},d=null;try{d=await this.getUserInternal();}catch(p){if(p instanceof Error&&!p.message.includes("Unknown or invalid refresh token")&&trackError("passport","login",p),s)throw p;oe.warn("Failed to retrieve a cached user session",p);}if(!d&&l)d=await this.forceUserRefreshInternal();else if(!d&&!s){if(n?.useRedirectFlow)return await this.loginWithRedirectInternal(n?.directLoginOptions),null;d=await this.loginWithPopup(n?.directLoginOptions);}return d&&this.handleSuccessfulLogin(d),d},"login")}async loginWithRedirect(n){await this.loginWithRedirectInternal(n);}async loginCallback(){return H(async()=>{let n=await this.loginCallbackInternal();return n&&this.handleSuccessfulLogin(n),n},"loginCallback")}async logout(){await H(async()=>{await this.logoutInternal(),this.eventEmitter.emit("loggedOut");},"logout");}async getUser(){return this.getUserInternal()}async getUserOrLogin(){let n=null;try{n=await this.getUserInternal();}catch(l){oe.warn("Failed to retrieve a cached user session",l);}if(n)return n;let s=await this.loginWithPopup();return this.handleSuccessfulLogin(s),s}async getUserZkEvm(){return this.getUserZkEvmInternal()}async getIdToken(){return H(async()=>(await this.getUserInternal())?.idToken,"getIdToken",!1)}async getAccessToken(){return H(async()=>(await this.getUserInternal())?.accessToken,"getAccessToken",!1,!1)}async isLoggedIn(){return await this.getUser()!==null}async forceUserRefresh(){return this.forceUserRefreshInternal()}forceUserRefreshInBackground(){this.forceUserRefreshInBackgroundInternal();}async loginWithPKCEFlow(n,s){return H(async()=>this.getPKCEAuthorizationUrl(n,s),"loginWithPKCEFlow")}async loginWithPKCEFlowCallback(n,s){return H(async()=>{let l=await this.loginWithPKCEFlowCallbackInternal(n,s);return this.handleSuccessfulLogin(l),l},"loginWithPKCEFlowCallback")}async storeTokens(n){return H(async()=>{let s=await this.storeTokensInternal(n);return this.handleSuccessfulLogin(s),s},"storeTokens")}async getLogoutUrl(){return H(async()=>(await this.userManager.removeUser(),this.eventEmitter.emit("loggedOut"),await this.getLogoutUrlInternal()||void 0),"getLogoutUrl")}async logoutSilentCallback(n){return H(()=>this.userManager.signoutSilentCallback(n),"logoutSilentCallback")}getConfig(){return this.config}async getClientId(){return this.config.oidcConfiguration.clientId}handleSuccessfulLogin(n){this.eventEmitter.emit("loggedIn",n),identify({passportId:n.profile.sub});}buildExtraQueryParams(n,s){let l={...this.userManager.settings?.extraQueryParams??{},rid:getDetail(Detail.RUNTIME_ID)||""};if(n){if(n.directLoginMethod==="email"){let d=n.email;d&&(l.direct=n.directLoginMethod,l.email=d);}else l.direct=n.directLoginMethod;n.marketingConsentStatus&&(l.marketingConsent=n.marketingConsentStatus);}return s&&(l.im_passport_trace_id=s),l}async loginWithRedirectInternal(n){await this.userManager.clearStaleState(),await J(async()=>{let s=this.buildExtraQueryParams(n);await this.userManager.signinRedirect({extraQueryParams:s});},"AUTHENTICATION_ERROR");}async loginWithPopup(n){return J(async()=>{let s,l;if(n)s=n;else if(!this.config.popupOverlayOptions?.disableHeadlessLoginPromptOverlay){let{imPassportTraceId:o,...f}=await this.embeddedLoginPrompt.displayEmbeddedLoginPrompt();s=f,l=o;}let d=window.crypto.randomUUID(),p=async()=>{let o=this.buildExtraQueryParams(s,l);return this.userManager.signinPopup({extraQueryParams:o,popupWindowFeatures:{width:410,height:450},popupWindowTarget:d,popupAbortOnClose:!0})};return new Promise((o,f)=>{p().then(E=>o(a.mapOidcUserToDomainModel(E))).catch(E=>{if(!(E instanceof Error)||E.message!=="Attempted to navigate on a disposed window"){f(E);return}let _=!1,g=new pe(this.config.popupOverlayOptions||{},!0);g.append(async()=>{try{if(_)window.open("",d);else {_=!0;let R=await p();g.remove(),o(a.mapOidcUserToDomainModel(R));}}catch(R){g.remove(),f(R);}},()=>{g.remove(),f(new Error("Popup closed by user"));});});})},"AUTHENTICATION_ERROR")}static mapOidcUserToDomainModel=n=>{let s,l;if(n.id_token){let p=V(n.id_token);s=p?.passport,p?.username&&(l=p?.username);}let d={expired:n.expired,idToken:n.id_token,accessToken:n.access_token,refreshToken:n.refresh_token,profile:{sub:n.profile.sub,email:n.profile.email,nickname:n.profile.nickname,username:l}};return s?.zkevm_eth_address&&s?.zkevm_user_admin_address&&(d.zkEvm=Wn(s.zkevm_eth_address,s.zkevm_user_admin_address)),d};static mapDeviceTokenResponseToOidcUser=n=>{let s=V(n.id_token);return new User({id_token:n.id_token,access_token:n.access_token,refresh_token:n.refresh_token,token_type:n.token_type,profile:{sub:s.sub,iss:s.iss,aud:s.aud,exp:s.exp,iat:s.iat,email:s.email,nickname:s.nickname,passport:s.passport,...s.username?{username:s.username}:{}}})};async loginCallbackInternal(){return J(async()=>{let n=await this.userManager.signinCallback();if(n)return a.mapOidcUserToDomainModel(n)},"AUTHENTICATION_ERROR")}async getPKCEAuthorizationUrl(n,s){let l=Be(window.crypto.getRandomValues(new Uint8Array(32))),d=Be(await zn(l)),p=Be(window.crypto.getRandomValues(new Uint8Array(32))),{redirectUri:o,scope:f,audience:E,clientId:_}=this.config.oidcConfiguration;this.deviceCredentialsManager.savePKCEData({state:p,verifier:l});let g=new URL(Zn,this.config.authenticationDomain);if(g.searchParams.set("response_type","code"),g.searchParams.set("code_challenge",d),g.searchParams.set("code_challenge_method","S256"),g.searchParams.set("client_id",_),g.searchParams.set("redirect_uri",o),g.searchParams.set("state",p),f&&g.searchParams.set("scope",f),E&&g.searchParams.set("audience",E),n){if(n.directLoginMethod==="email"){let R=n.email;R&&(g.searchParams.set("direct",n.directLoginMethod),g.searchParams.set("email",R));}else g.searchParams.set("direct",n.directLoginMethod);n.marketingConsentStatus&&g.searchParams.set("marketingConsent",n.marketingConsentStatus);}return s&&g.searchParams.set("im_passport_trace_id",s),g.toString()}async loginWithPKCEFlowCallbackInternal(n,s){return J(async()=>{let l=this.deviceCredentialsManager.getPKCEData();if(!l)throw new Error("No code verifier or state for PKCE");if(s!==l.state)throw new Error("Provided state does not match stored state");let d=await this.getPKCEToken(n,l.verifier),p=a.mapDeviceTokenResponseToOidcUser(d),o=a.mapOidcUserToDomainModel(p);return await this.userManager.storeUser(p),o},"AUTHENTICATION_ERROR")}async getPKCEToken(n,s){let l=await fetch(`${this.config.authenticationDomain}/oauth/token`,{method:"POST",headers:$n,body:new URLSearchParams({client_id:this.config.oidcConfiguration.clientId,grant_type:"authorization_code",code_verifier:s,code:n,redirect_uri:this.config.oidcConfiguration.redirectUri})}),d=await l.text(),p=Gn(d);if(!l.ok)throw new Error(Kn(p,d,l.status));if(!p||typeof p!="object")throw new Error("Token endpoint returned an invalid response");return p}async storeTokensInternal(n){return J(async()=>{let s=a.mapDeviceTokenResponseToOidcUser(n),l=a.mapOidcUserToDomainModel(s);return await this.userManager.storeUser(s),l},"AUTHENTICATION_ERROR")}async logoutInternal(){await J(async()=>{await this.userManager.revokeTokens(["refresh_token"]),this.logoutMode==="silent"?await this.userManager.signoutSilent():await this.userManager.signoutRedirect();},"LOGOUT_ERROR");}async getLogoutUrlInternal(){let n=this.userManager.settings?.metadata?.end_session_endpoint;return n||(oe.warn("Failed to get logout URL"),null)}forceUserRefreshInBackgroundInternal(){this.refreshTokenAndUpdatePromise().catch(n=>{oe.warn("Failed to refresh user token",n);});}async forceUserRefreshInternal(){return this.refreshTokenAndUpdatePromise().catch(n=>(oe.warn("Failed to refresh user token",n),null))}async refreshTokenAndUpdatePromise(){return this.refreshingPromise?this.refreshingPromise:(this.refreshingPromise=new Promise((n,s)=>{(async()=>{try{let l=await this.userManager.signinSilent();if(l){let d=a.mapOidcUserToDomainModel(l);this.eventEmitter.emit("tokenRefreshed",d),n(d);return}n(null);}catch(l){let d="AUTHENTICATION_ERROR",p="Failed to refresh token",o=!0;if(l instanceof ErrorTimeout?(d="SILENT_LOGIN_ERROR",p=`${p}: ${l.message}`,o=!1):l instanceof ErrorResponse?(d="NOT_LOGGED_IN_ERROR",p=`${p}: ${l.message||l.error_description}`):l instanceof Error?p=`${p}: ${l.message}`:typeof l=="string"&&(p=`${p}: ${l}`),o){this.eventEmitter.emit("userRemoved",{reason:"refresh_failed",error:p});try{await this.userManager.removeUser();}catch(f){f instanceof Error&&(p=`${p}: Failed to remove user: ${f.message}`);}}s(new G(p,d));}finally{this.refreshingPromise=null;}})();}),this.refreshingPromise)}async getUserInternal(n=s=>!0){if(this.refreshingPromise){let l=await this.refreshingPromise;return l&&n(l)?l:null}let s=await this.userManager.getUser();if(!s)return null;if(!gt(s)){let l=a.mapOidcUserToDomainModel(s);if(l&&n(l))return l}if(s.refresh_token){let l=await this.refreshTokenAndUpdatePromise();if(l&&n(l))return l}return null}async getUserZkEvmInternal(){let n=await this.getUserInternal(be);if(!n)throw new Error("Failed to obtain a User with the required ZkEvm attributes");return n}};var Xn="im_passport_embedded_login_prompt",wt="passport-embedded-login-iframe",_t="passport-overlay";var jn="https://auth.immutable.com",Qn="platform_api",ei="openid profile email offline_access transact",ti="/authorize",ri="/oauth/token",Me="imtbl_pkce_data";function Ct(a){return btoa(String.fromCharCode(...new Uint8Array(a))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function ni(a){let s=new TextEncoder().encode(a);return window.crypto.subtle.digest("SHA-256",s)}function Et(){return Ct(window.crypto.getRandomValues(new Uint8Array(32)))}function Ne(a){return a.authenticationDomain||jn}function ii(a){try{let n=V(a);if(n.exp)return n.exp*1e3}catch{}return Date.now()+3600*1e3}function oi(a){let{access_token:n,refresh_token:s,id_token:l}=a,d={sub:""},p;if(l)try{let{sub:o,email:f,nickname:E,passport:_}=V(l);d={sub:o,email:f,nickname:E},_?.zkevm_eth_address&&_?.zkevm_user_admin_address&&(p={ethAddress:_.zkevm_eth_address,userAdminAddress:_.zkevm_user_admin_address});}catch{}return {accessToken:n,refreshToken:s,idToken:l,accessTokenExpires:ii(n),profile:d,zkEvm:p}}function si(a){typeof window<"u"&&window.sessionStorage&&window.sessionStorage.setItem(Me,JSON.stringify(a));}function ai(){if(typeof window<"u"&&window.sessionStorage){let a=window.sessionStorage.getItem(Me);if(a)try{return JSON.parse(a)}catch{return null}}return null}function yt(){typeof window<"u"&&window.sessionStorage&&window.sessionStorage.removeItem(Me);}function ci(){let a="passport-embedded-login-keyframes";if(document.getElementById(a))return;let n=document.createElement("style");n.id=a,n.textContent=`
388
388
  @keyframes passportEmbeddedLoginPromptPopBounceIn {
389
389
  0% {
390
390
  opacity: 0.5;
@@ -403,7 +403,7 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
403
403
  }
404
404
 
405
405
  @media (max-height: 400px) {
406
- #${Ct} {
406
+ #${wt} {
407
407
  width: 100% !important;
408
408
  max-width: none !important;
409
409
  }
@@ -417,7 +417,7 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
417
417
  opacity: 1;
418
418
  }
419
419
  }
420
- `,document.head.appendChild(n);}function ui(a,n){let s=getDetail(Detail.RUNTIME_ID),l=document.createElement("iframe");return l.id=Ct,l.src=`${a}/im-embedded-login-prompt?client_id=${n}&rid=${s}`,l.style.height="100vh",l.style.width="100vw",l.style.maxHeight="660px",l.style.maxWidth="440px",l.style.borderRadius="16px",l.style.border="none",l.style.opacity="0",l.style.transform="scale(0.6)",l.style.animation="passportEmbeddedLoginPromptPopBounceIn 1s ease forwards",li(),l}function di(){let a=document.createElement("div");a.id=Rt,a.style.cssText=`
420
+ `,document.head.appendChild(n);}function li(a,n){let s=getDetail(Detail.RUNTIME_ID),l=document.createElement("iframe");return l.id=wt,l.src=`${a}/im-embedded-login-prompt?client_id=${n}&rid=${s}`,l.style.height="100vh",l.style.width="100vw",l.style.maxHeight="660px",l.style.maxWidth="440px",l.style.borderRadius="16px",l.style.border="none",l.style.opacity="0",l.style.transform="scale(0.6)",l.style.animation="passportEmbeddedLoginPromptPopBounceIn 1s ease forwards",ci(),l}function ui(){let a=document.createElement("div");a.id=_t,a.style.cssText=`
421
421
  position: fixed;
422
422
  top: 0;
423
423
  left: 0;
@@ -436,6 +436,6 @@ function Ue(a){throw new Error("Node.js process "+a+" is not supported by JSPM c
436
436
  flex-direction: column;
437
437
  align-items: center;
438
438
  width: 100%;
439
- `,a.appendChild(n),a}function he(){document.getElementById(Rt)?.remove();}function pi(a,n){return new Promise((s,l)=>{let d=ui(a,n),p=di(),o=({data:_,origin:g})=>{if(!(g!==a||_.eventType!==jn))switch(_.messageType){case"login_method_selected":{let R=_.payload;window.removeEventListener("message",o),he(),s(R);break}case"login_prompt_error":{window.removeEventListener("message",o),he(),l(new Error("Error during embedded login prompt",{cause:_.payload}));break}case"login_prompt_closed":{window.removeEventListener("message",o),he(),l(new Error("Login closed by user"));break}default:window.removeEventListener("message",o),he(),l(new Error(`Unsupported message type: ${_.messageType}`));break}},f=_=>{_.target===p&&(window.removeEventListener("message",o),p.removeEventListener("click",f),he(),l(new Error("Login closed by user")));};window.addEventListener("message",o),p.addEventListener("click",f);let E=p.querySelector(`#${q}`);E&&E.appendChild(d),document.body.appendChild(p);})}async function It(a,n){let s=Fe(a),l=wt(),d=Tt(await ii(l)),p=wt(),o=new URL(ri,s);o.searchParams.set("response_type","code"),o.searchParams.set("code_challenge",d),o.searchParams.set("code_challenge_method","S256"),o.searchParams.set("client_id",a.clientId),o.searchParams.set("redirect_uri",a.redirectUri),o.searchParams.set("state",p),o.searchParams.set("scope",a.scope||ti),a.audience?o.searchParams.set("audience",a.audience):o.searchParams.set("audience",ei);let f=n?.directLoginOptions;return f&&(f.directLoginMethod==="email"?f.email&&(o.searchParams.set("direct","email"),o.searchParams.set("email",f.email)):o.searchParams.set("direct",f.directLoginMethod),f.marketingConsentStatus&&o.searchParams.set("marketingConsent",f.marketingConsentStatus)),{url:o.toString(),verifier:l,state:p}}async function vt(a,n,s,l){let p=`${Fe(a)}${ni}`,o=await fetch(p,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:a.clientId,code_verifier:s,code:n,redirect_uri:l})});if(!o.ok){let E=await o.text(),_=`Token exchange failed with status ${o.status}`;try{let g=JSON.parse(E);g.error_description?_=g.error_description:g.error&&(_=g.error);}catch{E&&(_=E);}throw new Error(_)}let f=await o.json();return si(f)}async function Lt(a,n){track("passport","standaloneLoginWithPopup");let s=a.popupRedirectUri||a.redirectUri,l={...a,redirectUri:s},{url:d,verifier:p,state:o}=await It(l,n);return new Promise((f,E)=>{let R=window.screenX+(window.outerWidth-500)/2,N=window.screenY+(window.outerHeight-600)/2,m=window.open(d,"immutable_login",`width=500,height=600,left=${R},top=${N},toolbar=no,menubar=no`);if(!m){E(new Error("Popup was blocked. Please allow popups for this site."));return}let y=setInterval(()=>{try{if(m.closed){clearInterval(y),E(new Error("Login popup was closed"));return}let C=m.location.href;if(C&&C.startsWith(s)){clearInterval(y),m.close();let L=new URL(C),x=L.searchParams.get("code"),A=L.searchParams.get("state"),S=L.searchParams.get("error"),M=L.searchParams.get("error_description");if(S){E(new Error(M||S));return}if(!x){E(new Error("No authorization code received"));return}if(A!==o){E(new Error("State mismatch - possible CSRF attack"));return}vt(l,x,p,s).then(f).catch(E);}}catch{}},100);setTimeout(()=>{clearInterval(y),m.closed||m.close(),E(new Error("Login timed out"));},5*60*1e3);})}async function hi(a){track("passport","standaloneLoginWithEmbedded");let n=Fe(a),s=await pi(n,a.clientId),l={directLoginOptions:{directLoginMethod:s.directLoginMethod,marketingConsentStatus:s.marketingConsentStatus,...s.directLoginMethod==="email"&&s.email?{email:s.email}:{}}};return Lt(a,l)}async function fi(a,n){track("passport","standaloneLoginWithRedirect");let{url:s,verifier:l,state:d}=await It(a,n);ai({state:d,verifier:l,redirectUri:a.redirectUri}),window.location.href=s;}async function mi(a){if(track("passport","standaloneHandleCallback"),typeof window>"u")return;let n=new URLSearchParams(window.location.search),s=n.get("code"),l=n.get("state"),d=n.get("error"),p=n.get("error_description");if(d)throw new Error(p||d);if(!s)return;let o=ci();if(!o)throw new Error("No PKCE data found. Login may have been initiated in a different session.");if(l!==o.state)throw _t(),new Error("State mismatch - possible CSRF attack");let f=await vt(a,s,o.verifier,o.redirectUri);return _t(),f}function He(a){return Te(a)}function gi(a){track("passport","standaloneLogoutWithRedirect");let n=He(a);window.location.href=n;}async function Ei(a,n=5e3){return track("passport","standaloneLogoutSilent"),new Promise((s,l)=>{let d=He(a),p=document.createElement("iframe");p.style.display="none",p.setAttribute("aria-hidden","true");let o,f=!1,E=()=>{o&&clearTimeout(o),p.remove();},_=()=>{f||(f=!0,E(),s());},g=()=>{f||(f=!0,E(),l(new Error("Silent logout failed: iframe load error")));};p.addEventListener("load",_),p.addEventListener("error",g),o=setTimeout(()=>{f||(f=!0,E(),s());},n),p.src=d,document.body.appendChild(p);})}/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
439
+ `,a.appendChild(n),a}function he(){document.getElementById(_t)?.remove();}function di(a,n){return new Promise((s,l)=>{let d=li(a,n),p=ui(),o=({data:_,origin:g})=>{if(!(g!==a||_.eventType!==Xn))switch(_.messageType){case"login_method_selected":{let R=_.payload;window.removeEventListener("message",o),he(),s(R);break}case"login_prompt_error":{window.removeEventListener("message",o),he(),l(new Error("Error during embedded login prompt",{cause:_.payload}));break}case"login_prompt_closed":{window.removeEventListener("message",o),he(),l(new Error("Login closed by user"));break}default:window.removeEventListener("message",o),he(),l(new Error(`Unsupported message type: ${_.messageType}`));break}},f=_=>{_.target===p&&(window.removeEventListener("message",o),p.removeEventListener("click",f),he(),l(new Error("Login closed by user")));};window.addEventListener("message",o),p.addEventListener("click",f);let E=p.querySelector(`#${q}`);E&&E.appendChild(d),document.body.appendChild(p);})}async function Rt(a,n){let s=Ne(a),l=Et(),d=Ct(await ni(l)),p=Et(),o=new URL(ti,s);o.searchParams.set("response_type","code"),o.searchParams.set("code_challenge",d),o.searchParams.set("code_challenge_method","S256"),o.searchParams.set("client_id",a.clientId),o.searchParams.set("redirect_uri",a.redirectUri),o.searchParams.set("state",p),o.searchParams.set("scope",a.scope||ei),a.audience?o.searchParams.set("audience",a.audience):o.searchParams.set("audience",Qn);let f=n?.directLoginOptions;return f&&(f.directLoginMethod==="email"?f.email&&(o.searchParams.set("direct","email"),o.searchParams.set("email",f.email)):o.searchParams.set("direct",f.directLoginMethod),f.marketingConsentStatus&&o.searchParams.set("marketingConsent",f.marketingConsentStatus)),{url:o.toString(),verifier:l,state:p}}async function Tt(a,n,s,l){let p=`${Ne(a)}${ri}`,o=await fetch(p,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:a.clientId,code_verifier:s,code:n,redirect_uri:l})});if(!o.ok){let E=await o.text(),_=`Token exchange failed with status ${o.status}`;try{let g=JSON.parse(E);g.error_description?_=g.error_description:g.error&&(_=g.error);}catch{E&&(_=E);}throw new Error(_)}let f=await o.json();return oi(f)}async function It(a,n){track("passport","standaloneLoginWithPopup");let s=a.popupRedirectUri||a.redirectUri,l={...a,redirectUri:s},{url:d,verifier:p,state:o}=await Rt(l,n);return new Promise((f,E)=>{let R=window.screenX+(window.outerWidth-500)/2,N=window.screenY+(window.outerHeight-600)/2,m=window.open(d,"immutable_login",`width=500,height=600,left=${R},top=${N},toolbar=no,menubar=no`);if(!m){E(new Error("Popup was blocked. Please allow popups for this site."));return}let y=setInterval(()=>{try{if(m.closed){clearInterval(y),E(new Error("Login popup was closed"));return}let C=m.location.href;if(C&&C.startsWith(s)){clearInterval(y),m.close();let L=new URL(C),x=L.searchParams.get("code"),A=L.searchParams.get("state"),S=L.searchParams.get("error"),D=L.searchParams.get("error_description");if(S){E(new Error(D||S));return}if(!x){E(new Error("No authorization code received"));return}if(A!==o){E(new Error("State mismatch - possible CSRF attack"));return}Tt(l,x,p,s).then(f).catch(E);}}catch{}},100);setTimeout(()=>{clearInterval(y),m.closed||m.close(),E(new Error("Login timed out"));},5*60*1e3);})}async function pi(a){track("passport","standaloneLoginWithEmbedded");let n=Ne(a),s=await di(n,a.clientId),l={directLoginOptions:{directLoginMethod:s.directLoginMethod,marketingConsentStatus:s.marketingConsentStatus,...s.directLoginMethod==="email"&&s.email?{email:s.email}:{}}};return It(a,l)}async function hi(a,n){track("passport","standaloneLoginWithRedirect");let{url:s,verifier:l,state:d}=await Rt(a,n);si({state:d,verifier:l,redirectUri:a.redirectUri}),window.location.href=s;}async function fi(a){if(track("passport","standaloneHandleCallback"),typeof window>"u")return;let n=new URLSearchParams(window.location.search),s=n.get("code"),l=n.get("state"),d=n.get("error"),p=n.get("error_description");if(d)throw new Error(p||d);if(!s)return;let o=ai();if(!o)throw new Error("No PKCE data found. Login may have been initiated in a different session.");if(l!==o.state)throw yt(),new Error("State mismatch - possible CSRF attack");let f=await Tt(a,s,o.verifier,o.redirectUri);return yt(),f}function Fe(a){return Re(a)}function mi(a){track("passport","standaloneLogoutWithRedirect");let n=Fe(a);window.location.href=n;}async function gi(a,n=5e3){return track("passport","standaloneLogoutSilent"),new Promise((s,l)=>{let d=Fe(a),p=document.createElement("iframe");p.style.display="none",p.setAttribute("aria-hidden","true");let o,f=!1,E=()=>{o&&clearTimeout(o),p.remove();},_=()=>{f||(f=!0,E(),s());},g=()=>{f||(f=!0,E(),l(new Error("Silent logout failed: iframe load error")));};p.addEventListener("load",_),p.addEventListener("error",g),o=setTimeout(()=>{f||(f=!0,E(),s());},n),p.src=d,document.body.appendChild(p);})}/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
440
440
 
441
- export { De as Auth, le as AuthConfiguration, Se as AuthEvents, ye as EvmChain, nt as MarketingConsentStatus, G as PassportError, Ee as PassportErrorType, rt as RollupType, ie as TypedEventEmitter, He as buildLogoutUrl, V as decodeJwtPayload, mi as handleLoginCallback, be as isAPIError, xe as isUserZkEvm, hi as loginWithEmbedded, Lt as loginWithPopup, fi as loginWithRedirect, Ei as logoutSilent, gi as logoutWithRedirect, J as withPassportError };
441
+ export { De as Auth, le as AuthConfiguration, xe as AuthEvents, rt as MarketingConsentStatus, G as PassportError, Ee as PassportErrorType, tt as RollupType, ie as TypedEventEmitter, Fe as buildLogoutUrl, V as decodeJwtPayload, fi as handleLoginCallback, ke as isAPIError, be as isUserZkEvm, pi as loginWithEmbedded, It as loginWithPopup, hi as loginWithRedirect, gi as logoutSilent, mi as logoutWithRedirect, J as withPassportError };