magic-sdk 29.0.6-canary.879.14607005869.0 → 29.0.6-canary.882.14610528151.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/magic.js CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";var Magic=(()=>{var zi=Object.create;var nt=Object.defineProperty;var Qi=Object.getOwnPropertyDescriptor;var Zi=Object.getOwnPropertyNames;var eo=Object.getPrototypeOf,to=Object.prototype.hasOwnProperty;var qe=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var kt=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ft=(r,e)=>{for(var t in e)nt(r,t,{get:e[t],enumerable:!0})},Dr=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Zi(e))!to.call(r,i)&&i!==t&&nt(r,i,{get:()=>e[i],enumerable:!(n=Qi(e,i))||n.enumerable});return r};var Ut=(r,e,t)=>(t=r!=null?zi(eo(r)):{},Dr(e||!r||!r.__esModule?nt(t,"default",{value:r,enumerable:!0}):t,r)),ro=r=>Dr(nt({},"__esModule",{value:!0}),r);var Cn=kt((da,nr)=>{"use strict";var jo=Object.prototype.hasOwnProperty,oe="~";function ze(){}Object.create&&(ze.prototype=Object.create(null),new ze().__proto__||(oe=!1));function Yo(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function _n(r,e,t,n,i){if(typeof t!="function")throw new TypeError("The listener must be a function");var s=new Yo(t,n||r,i),u=oe?oe+e:e;return r.r[u]?r.r[u].fn?r.r[u]=[r.r[u],s]:r.r[u].push(s):(r.r[u]=s,r.m++),r}function ft(r,e){--r.m===0?r.r=new ze:delete r.r[e]}function te(){this.r=new ze,this.m=0}te.prototype.eventNames=function(){var e=[],t,n;if(this.m===0)return e;for(n in t=this.r)jo.call(t,n)&&e.push(oe?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};te.prototype.listeners=function(e){var t=oe?oe+e:e,n=this.r[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,u=new Array(s);i<s;i++)u[i]=n[i].fn;return u};te.prototype.listenerCount=function(e){var t=oe?oe+e:e,n=this.r[t];return n?n.fn?1:n.length:0};te.prototype.emit=function(e,t,n,i,s,u){var p=oe?oe+e:e;if(!this.r[p])return!1;var m=this.r[p],A=arguments.length,b,P;if(m.fn){switch(m.once&&this.removeListener(e,m.fn,void 0,!0),A){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,t),!0;case 3:return m.fn.call(m.context,t,n),!0;case 4:return m.fn.call(m.context,t,n,i),!0;case 5:return m.fn.call(m.context,t,n,i,s),!0;case 6:return m.fn.call(m.context,t,n,i,s,u),!0}for(P=1,b=new Array(A-1);P<A;P++)b[P-1]=arguments[P];m.fn.apply(m.context,b)}else{var I=m.length,N;for(P=0;P<I;P++)switch(m[P].once&&this.removeListener(e,m[P].fn,void 0,!0),A){case 1:m[P].fn.call(m[P].context);break;case 2:m[P].fn.call(m[P].context,t);break;case 3:m[P].fn.call(m[P].context,t,n);break;case 4:m[P].fn.call(m[P].context,t,n,i);break;default:if(!b)for(N=1,b=new Array(A-1);N<A;N++)b[N-1]=arguments[N];m[P].fn.apply(m[P].context,b)}}return!0};te.prototype.on=function(e,t,n){return _n(this,e,t,n,!1)};te.prototype.once=function(e,t,n){return _n(this,e,t,n,!0)};te.prototype.removeListener=function(e,t,n,i){var s=oe?oe+e:e;if(!this.r[s])return this;if(!t)return ft(this,s),this;var u=this.r[s];if(u.fn)u.fn===t&&(!i||u.once)&&(!n||u.context===n)&&ft(this,s);else{for(var p=0,m=[],A=u.length;p<A;p++)(u[p].fn!==t||i&&!u[p].once||n&&u[p].context!==n)&&m.push(u[p]);m.length?this.r[s]=m.length===1?m[0]:m:ft(this,s)}return this};te.prototype.removeAllListeners=function(e){var t;return e?(t=oe?oe+e:e,this.r[t]&&ft(this,t)):(this.r=new ze,this.m=0),this};te.prototype.off=te.prototype.removeListener;te.prototype.addListener=te.prototype.on;te.prefixed=oe;te.EventEmitter=te;typeof nr<"u"&&(nr.exports=te)});var ei=kt((Zn,hr)=>{"use strict";(function(r){if(typeof Zn=="object"&&typeof hr<"u")hr.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=r()}})(function(){var r,e,t;return function n(i,s,u){function p(b,P){if(!s[b]){if(!i[b]){var I=typeof qe=="function"&&qe;if(!P&&I)return I(b,!0);if(m)return m(b,!0);var N=new Error("Cannot find module '"+b+"'");throw N.code="MODULE_NOT_FOUND",N}var F=s[b]={exports:{}};i[b][0].call(F.exports,function(_){var le=i[b][1][_];return p(le||_)},F,F.exports,n,i,s,u)}return s[b].exports}for(var m=typeof qe=="function"&&qe,A=0;A<u.length;A++)p(u[A]);return p}({1:[function(n,i,s){(function(u){"use strict";var p=u.MutationObserver||u.WebKitMutationObserver,m;if(p){var A=0,b=new p(_),P=u.document.createTextNode("");b.observe(P,{characterData:!0}),m=function(){P.data=A=++A%2}}else if(!u.setImmediate&&typeof u.MessageChannel<"u"){var I=new u.MessageChannel;I.port1.onmessage=_,m=function(){I.port2.postMessage(0)}}else"document"in u&&"onreadystatechange"in u.document.createElement("script")?m=function(){var H=u.document.createElement("script");H.onreadystatechange=function(){_(),H.onreadystatechange=null,H.parentNode.removeChild(H),H=null},u.document.documentElement.appendChild(H)}:m=function(){setTimeout(_,0)};var N,F=[];function _(){N=!0;for(var H,fe,K=F.length;K;){for(fe=F,F=[],H=-1;++H<K;)fe[H]();K=F.length}N=!1}i.exports=le;function le(H){F.push(H)===1&&!N&&m()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,i,s){"use strict";var u=n(1);function p(){}var m={},A=["REJECTED"],b=["FULFILLED"],P=["PENDING"];i.exports=I;function I(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=P,this.queue=[],this.outcome=void 0,S!==p&&le(this,S)}I.prototype.catch=function(S){return this.then(null,S)},I.prototype.then=function(S,U){if(typeof S!="function"&&this.state===b||typeof U!="function"&&this.state===A)return this;var D=new this.constructor(p);if(this.state!==P){var G=this.state===b?S:U;F(D,G,this.outcome)}else this.queue.push(new N(D,S,U));return D};function N(S,U,D){this.promise=S,typeof U=="function"&&(this.onFulfilled=U,this.callFulfilled=this.otherCallFulfilled),typeof D=="function"&&(this.onRejected=D,this.callRejected=this.otherCallRejected)}N.prototype.callFulfilled=function(S){m.resolve(this.promise,S)},N.prototype.otherCallFulfilled=function(S){F(this.promise,this.onFulfilled,S)},N.prototype.callRejected=function(S){m.reject(this.promise,S)},N.prototype.otherCallRejected=function(S){F(this.promise,this.onRejected,S)};function F(S,U,D){u(function(){var G;try{G=U(D)}catch(X){return m.reject(S,X)}G===S?m.reject(S,new TypeError("Cannot resolve promise with itself")):m.resolve(S,G)})}m.resolve=function(S,U){var D=H(_,U);if(D.status==="error")return m.reject(S,D.value);var G=D.value;if(G)le(S,G);else{S.state=b,S.outcome=U;for(var X=-1,ne=S.queue.length;++X<ne;)S.queue[X].callFulfilled(U)}return S},m.reject=function(S,U){S.state=A,S.outcome=U;for(var D=-1,G=S.queue.length;++D<G;)S.queue[D].callRejected(U);return S};function _(S){var U=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof U=="function")return function(){U.apply(S,arguments)}}function le(S,U){var D=!1;function G(ce){D||(D=!0,m.reject(S,ce))}function X(ce){D||(D=!0,m.resolve(S,ce))}function ne(){U(X,G)}var ae=H(ne);ae.status==="error"&&G(ae.value)}function H(S,U){var D={};try{D.value=S(U),D.status="success"}catch(G){D.status="error",D.value=G}return D}I.resolve=fe;function fe(S){return S instanceof this?S:m.resolve(new this(p),S)}I.reject=K;function K(S){var U=new this(p);return m.reject(U,S)}I.all=Pe;function Pe(S){var U=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var D=S.length,G=!1;if(!D)return this.resolve([]);for(var X=new Array(D),ne=0,ae=-1,ce=new this(p);++ae<D;)pe(S[ae],ae);return ce;function pe(we,h){U.resolve(we).then(y,function(w){G||(G=!0,m.reject(ce,w))});function y(w){X[h]=w,++ne===D&&!G&&(G=!0,m.resolve(ce,X))}}}I.race=ye;function ye(S){var U=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var D=S.length,G=!1;if(!D)return this.resolve([]);for(var X=-1,ne=new this(p);++X<D;)ae(S[X]);return ne;function ae(ce){U.resolve(ce).then(function(pe){G||(G=!0,m.resolve(ne,pe))},function(pe){G||(G=!0,m.reject(ne,pe))})}}},{1:1}],3:[function(n,i,s){(function(u){"use strict";typeof u.Promise!="function"&&(u.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,i,s){"use strict";var u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o};function p(o,c){if(!(o instanceof c))throw new TypeError("Cannot call a class as a function")}function m(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var A=m();function b(){try{if(!A||!A.open)return!1;var o=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),c=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!o||c)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function P(o,c){o=o||[],c=c||{};try{return new Blob(o,c)}catch(l){if(l.name!=="TypeError")throw l;for(var a=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,d=new a,f=0;f<o.length;f+=1)d.append(o[f]);return d.getBlob(c.type)}}typeof Promise>"u"&&n(3);var I=Promise;function N(o,c){c&&o.then(function(a){c(null,a)},function(a){c(a)})}function F(o,c,a){typeof c=="function"&&o.then(c),typeof a=="function"&&o.catch(a)}function _(o){return typeof o!="string"&&(console.warn(o+" used as a key, but it is not a string."),o=String(o)),o}function le(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var H="local-forage-detect-blob-support",fe=void 0,K={},Pe=Object.prototype.toString,ye="readonly",S="readwrite";function U(o){for(var c=o.length,a=new ArrayBuffer(c),d=new Uint8Array(a),f=0;f<c;f++)d[f]=o.charCodeAt(f);return a}function D(o){return new I(function(c){var a=o.transaction(H,S),d=P([""]);a.objectStore(H).put(d,"key"),a.onabort=function(f){f.preventDefault(),f.stopPropagation(),c(!1)},a.oncomplete=function(){var f=navigator.userAgent.match(/Chrome\/(\d+)/),l=navigator.userAgent.match(/Edge\//);c(l||!f||parseInt(f[1],10)>=43)}}).catch(function(){return!1})}function G(o){return typeof fe=="boolean"?I.resolve(fe):D(o).then(function(c){return fe=c,fe})}function X(o){var c=K[o.name],a={};a.promise=new I(function(d,f){a.resolve=d,a.reject=f}),c.deferredOperations.push(a),c.dbReady?c.dbReady=c.dbReady.then(function(){return a.promise}):c.dbReady=a.promise}function ne(o){var c=K[o.name],a=c.deferredOperations.pop();if(a)return a.resolve(),a.promise}function ae(o,c){var a=K[o.name],d=a.deferredOperations.pop();if(d)return d.reject(c),d.promise}function ce(o,c){return new I(function(a,d){if(K[o.name]=K[o.name]||z(),o.db)if(c)X(o),o.db.close();else return a(o.db);var f=[o.name];c&&f.push(o.version);var l=A.open.apply(A,f);c&&(l.onupgradeneeded=function(v){var g=l.result;try{g.createObjectStore(o.storeName),v.oldVersion<=1&&g.createObjectStore(H)}catch(E){if(E.name==="ConstraintError")console.warn('The database "'+o.name+'" has been upgraded from version '+v.oldVersion+" to version "+v.newVersion+', but the storage "'+o.storeName+'" already exists.');else throw E}}),l.onerror=function(v){v.preventDefault(),d(l.error)},l.onsuccess=function(){var v=l.result;v.onversionchange=function(g){g.target.close()},a(v),ne(o)}})}function pe(o){return ce(o,!1)}function we(o){return ce(o,!0)}function h(o,c){if(!o.db)return!0;var a=!o.db.objectStoreNames.contains(o.storeName),d=o.version<o.db.version,f=o.version>o.db.version;if(d&&(o.version!==c&&console.warn('The database "'+o.name+`" can't be downgraded from version `+o.db.version+" to version "+o.version+"."),o.version=o.db.version),f||a){if(a){var l=o.db.version+1;l>o.version&&(o.version=l)}return!0}return!1}function y(o){return new I(function(c,a){var d=new FileReader;d.onerror=a,d.onloadend=function(f){var l=btoa(f.target.result||"");c({I:!0,data:l,type:o.type})},d.readAsBinaryString(o)})}function w(o){var c=U(atob(o.data));return P([c],{type:o.type})}function C(o){return o&&o.I}function O(o){var c=this,a=c.g().then(function(){var d=K[c.e.name];if(d&&d.dbReady)return d.dbReady});return F(a,o,o),a}function M(o){X(o);for(var c=K[o.name],a=c.forages,d=0;d<a.length;d++){var f=a[d];f.e.db&&(f.e.db.close(),f.e.db=null)}return o.db=null,pe(o).then(function(l){return o.db=l,h(o)?we(o):l}).then(function(l){o.db=c.db=l;for(var v=0;v<a.length;v++)a[v].e.db=l}).catch(function(l){throw ae(o,l),l})}function q(o,c,a,d){d===void 0&&(d=1);try{var f=o.db.transaction(o.storeName,c);a(null,f)}catch(l){if(d>0&&(!o.db||l.name==="InvalidStateError"||l.name==="NotFoundError"))return I.resolve().then(function(){if(!o.db||l.name==="NotFoundError"&&!o.db.objectStoreNames.contains(o.storeName)&&o.version<=o.db.version)return o.db&&(o.version=o.db.version+1),we(o)}).then(function(){return M(o).then(function(){q(o,c,a,d-1)})}).catch(a);a(l)}}function z(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function _e(o){var c=this,a={db:null};if(o)for(var d in o)a[d]=o[d];var f=K[a.name];f||(f=z(),K[a.name]=f),f.forages.push(c),c.g||(c.g=c.ready,c.ready=O);var l=[];function v(){return I.resolve()}for(var g=0;g<f.forages.length;g++){var E=f.forages[g];E!==c&&l.push(E.g().catch(v))}var R=f.forages.slice(0);return I.all(l).then(function(){return a.db=f.db,pe(a)}).then(function(T){return a.db=T,h(a,c.d.version)?we(a):T}).then(function(T){a.db=f.db=T,c.e=a;for(var x=0;x<R.length;x++){var k=R[x];k!==c&&(k.e.db=a.db,k.e.version=a.version)}})}function Se(o,c){var a=this;o=_(o);var d=new I(function(f,l){a.ready().then(function(){q(a.e,ye,function(v,g){if(v)return l(v);try{var E=g.objectStore(a.e.storeName),R=E.get(o);R.onsuccess=function(){var T=R.result;T===void 0&&(T=null),C(T)&&(T=w(T)),f(T)},R.onerror=function(){l(R.error)}}catch(T){l(T)}})}).catch(l)});return N(d,c),d}function ke(o,c){var a=this,d=new I(function(f,l){a.ready().then(function(){q(a.e,ye,function(v,g){if(v)return l(v);try{var E=g.objectStore(a.e.storeName),R=E.openCursor(),T=1;R.onsuccess=function(){var x=R.result;if(x){var k=x.value;C(k)&&(k=w(k));var W=o(k,x.key,T++);W!==void 0?f(W):x.continue()}else f()},R.onerror=function(){l(R.error)}}catch(x){l(x)}})}).catch(l)});return N(d,c),d}function ii(o,c,a){var d=this;o=_(o);var f=new I(function(l,v){var g;d.ready().then(function(){return g=d.e,Pe.call(c)==="[object Blob]"?G(g.db).then(function(E){return E?c:y(c)}):c}).then(function(E){q(d.e,S,function(R,T){if(R)return v(R);try{var x=T.objectStore(d.e.storeName);E===null&&(E=void 0);var k=x.put(E,o);T.oncomplete=function(){E===void 0&&(E=null),l(E)},T.onabort=T.onerror=function(){var W=k.error?k.error:k.transaction.error;v(W)}}catch(W){v(W)}})}).catch(v)});return N(f,a),f}function oi(o,c){var a=this;o=_(o);var d=new I(function(f,l){a.ready().then(function(){q(a.e,S,function(v,g){if(v)return l(v);try{var E=g.objectStore(a.e.storeName),R=E.delete(o);g.oncomplete=function(){f()},g.onerror=function(){l(R.error)},g.onabort=function(){var T=R.error?R.error:R.transaction.error;l(T)}}catch(T){l(T)}})}).catch(l)});return N(d,c),d}function si(o){var c=this,a=new I(function(d,f){c.ready().then(function(){q(c.e,S,function(l,v){if(l)return f(l);try{var g=v.objectStore(c.e.storeName),E=g.clear();v.oncomplete=function(){d()},v.onabort=v.onerror=function(){var R=E.error?E.error:E.transaction.error;f(R)}}catch(R){f(R)}})}).catch(f)});return N(a,o),a}function ai(o){var c=this,a=new I(function(d,f){c.ready().then(function(){q(c.e,ye,function(l,v){if(l)return f(l);try{var g=v.objectStore(c.e.storeName),E=g.count();E.onsuccess=function(){d(E.result)},E.onerror=function(){f(E.error)}}catch(R){f(R)}})}).catch(f)});return N(a,o),a}function ci(o,c){var a=this,d=new I(function(f,l){if(o<0){f(null);return}a.ready().then(function(){q(a.e,ye,function(v,g){if(v)return l(v);try{var E=g.objectStore(a.e.storeName),R=!1,T=E.openKeyCursor();T.onsuccess=function(){var x=T.result;if(!x){f(null);return}o===0||R?f(x.key):(R=!0,x.advance(o))},T.onerror=function(){l(T.error)}}catch(x){l(x)}})}).catch(l)});return N(d,c),d}function L(o){var c=this,a=new I(function(d,f){c.ready().then(function(){q(c.e,ye,function(l,v){if(l)return f(l);try{var g=v.objectStore(c.e.storeName),E=g.openKeyCursor(),R=[];E.onsuccess=function(){var T=E.result;if(!T){d(R);return}R.push(T.key),T.continue()},E.onerror=function(){f(E.error)}}catch(T){f(T)}})}).catch(f)});return N(a,o),a}function li(o,c){c=le.apply(this,arguments);var a=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||a.name,o.storeName=o.storeName||a.storeName);var d=this,f;if(!o.name)f=I.reject("Invalid arguments");else{var l=o.name===a.name&&d.e.db,v=l?I.resolve(d.e.db):pe(o).then(function(g){var E=K[o.name],R=E.forages;E.db=g;for(var T=0;T<R.length;T++)R[T].e.db=g;return g});o.storeName?f=v.then(function(g){if(g.objectStoreNames.contains(o.storeName)){var E=g.version+1;X(o);var R=K[o.name],T=R.forages;g.close();for(var x=0;x<T.length;x++){var k=T[x];k.e.db=null,k.e.version=E}var W=new I(function(V,Y){var j=A.open(o.name,E);j.onerror=function(ue){var Ue=j.result;Ue.close(),Y(ue)},j.onupgradeneeded=function(){var ue=j.result;ue.deleteObjectStore(o.storeName)},j.onsuccess=function(){var ue=j.result;ue.close(),V(ue)}});return W.then(function(V){R.db=V;for(var Y=0;Y<T.length;Y++){var j=T[Y];j.e.db=V,ne(j.e)}}).catch(function(V){throw(ae(o,V)||I.resolve()).catch(function(){}),V})}}):f=v.then(function(g){X(o);var E=K[o.name],R=E.forages;g.close();for(var T=0;T<R.length;T++){var x=R[T];x.e.db=null}var k=new I(function(W,V){var Y=A.deleteDatabase(o.name);Y.onerror=function(){var j=Y.result;j&&j.close(),V(Y.error)},Y.onblocked=function(){console.warn('dropInstance blocked for database "'+o.name+'" until all open connections are closed')},Y.onsuccess=function(){var j=Y.result;j&&j.close(),W(j)}});return k.then(function(W){E.db=W;for(var V=0;V<R.length;V++){var Y=R[V];ne(Y.e)}}).catch(function(W){throw(ae(o,W)||I.resolve()).catch(function(){}),W})})}return N(f,c),f}var ui={n:"asyncStorage",h:_e,a:b(),iterate:ke,getItem:Se,setItem:ii,removeItem:oi,clear:si,length:ai,key:ci,keys:L,dropInstance:li};function di(){return typeof openDatabase=="function"}var Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fi="~~local_forage_type~",vr=/^~~local_forage_type~([^~]+)~/,tt="__lfsc__:",Nt=tt.length,Pt="arbf",_t="blob",gr="si08",yr="ui08",Er="uic8",Rr="si16",br="si32",Ir="ur16",Tr="ui32",wr="fl32",Sr="fl64",Ar=Nt+Pt.length,xr=Object.prototype.toString;function Nr(o){var c=o.length*.75,a=o.length,d,f=0,l,v,g,E;o[o.length-1]==="="&&(c--,o[o.length-2]==="="&&c--);var R=new ArrayBuffer(c),T=new Uint8Array(R);for(d=0;d<a;d+=4)l=Re.indexOf(o[d]),v=Re.indexOf(o[d+1]),g=Re.indexOf(o[d+2]),E=Re.indexOf(o[d+3]),T[f++]=l<<2|v>>4,T[f++]=(v&15)<<4|g>>2,T[f++]=(g&3)<<6|E&63;return R}function Ct(o){var c=new Uint8Array(o),a="",d;for(d=0;d<c.length;d+=3)a+=Re[c[d]>>2],a+=Re[(c[d]&3)<<4|c[d+1]>>4],a+=Re[(c[d+1]&15)<<2|c[d+2]>>6],a+=Re[c[d+2]&63];return c.length%3===2?a=a.substring(0,a.length-1)+"=":c.length%3===1&&(a=a.substring(0,a.length-2)+"=="),a}function pi(o,c){var a="";if(o&&(a=xr.call(o)),o&&(a==="[object ArrayBuffer]"||o.buffer&&xr.call(o.buffer)==="[object ArrayBuffer]")){var d,f=tt;o instanceof ArrayBuffer?(d=o,f+=Pt):(d=o.buffer,a==="[object Int8Array]"?f+=gr:a==="[object Uint8Array]"?f+=yr:a==="[object Uint8ClampedArray]"?f+=Er:a==="[object Int16Array]"?f+=Rr:a==="[object Uint16Array]"?f+=Ir:a==="[object Int32Array]"?f+=br:a==="[object Uint32Array]"?f+=Tr:a==="[object Float32Array]"?f+=wr:a==="[object Float64Array]"?f+=Sr:c(new Error("Failed to get type for BinaryArray"))),c(f+Ct(d))}else if(a==="[object Blob]"){var l=new FileReader;l.onload=function(){var v=fi+o.type+"~"+Ct(this.result);c(tt+_t+v)},l.readAsArrayBuffer(o)}else try{c(JSON.stringify(o))}catch(v){console.error("Couldn't convert value into a JSON string: ",o),c(null,v)}}function mi(o){if(o.substring(0,Nt)!==tt)return JSON.parse(o);var c=o.substring(Ar),a=o.substring(Nt,Ar),d;if(a===_t&&vr.test(c)){var f=c.match(vr);d=f[1],c=c.substring(f[0].length)}var l=Nr(c);switch(a){case Pt:return l;case _t:return P([l],{type:d});case gr:return new Int8Array(l);case yr:return new Uint8Array(l);case Er:return new Uint8ClampedArray(l);case Rr:return new Int16Array(l);case Ir:return new Uint16Array(l);case br:return new Int32Array(l);case Tr:return new Uint32Array(l);case wr:return new Float32Array(l);case Sr:return new Float64Array(l);default:throw new Error("Unkown type: "+a)}}var Ot={serialize:pi,deserialize:mi,stringToBuffer:Nr,bufferToString:Ct};function Pr(o,c,a,d){o.executeSql("CREATE TABLE IF NOT EXISTS "+c.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],a,d)}function hi(o){var c=this,a={db:null};if(o)for(var d in o)a[d]=typeof o[d]!="string"?o[d].toString():o[d];var f=new I(function(l,v){try{a.db=openDatabase(a.name,String(a.version),a.description,a.size)}catch(g){return v(g)}a.db.transaction(function(g){Pr(g,a,function(){c.e=a,l()},function(E,R){v(R)})},v)});return a.serializer=Ot,f}function be(o,c,a,d,f,l){o.executeSql(a,d,f,function(v,g){g.code===g.SYNTAX_ERR?v.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[c.storeName],function(E,R){R.rows.length?l(E,g):Pr(E,c,function(){E.executeSql(a,d,f,l)},l)},l):l(v,g)},l)}function vi(o,c){var a=this;o=_(o);var d=new I(function(f,l){a.ready().then(function(){var v=a.e;v.db.transaction(function(g){be(g,v,"SELECT * FROM "+v.storeName+" WHERE key = ? LIMIT 1",[o],function(E,R){var T=R.rows.length?R.rows.item(0).value:null;T&&(T=v.serializer.deserialize(T)),f(T)},function(E,R){l(R)})})}).catch(l)});return N(d,c),d}function gi(o,c){var a=this,d=new I(function(f,l){a.ready().then(function(){var v=a.e;v.db.transaction(function(g){be(g,v,"SELECT * FROM "+v.storeName,[],function(E,R){for(var T=R.rows,x=T.length,k=0;k<x;k++){var W=T.item(k),V=W.value;if(V&&(V=v.serializer.deserialize(V)),V=o(V,W.key,k+1),V!==void 0){f(V);return}}f()},function(E,R){l(R)})})}).catch(l)});return N(d,c),d}function _r(o,c,a,d){var f=this;o=_(o);var l=new I(function(v,g){f.ready().then(function(){c===void 0&&(c=null);var E=c,R=f.e;R.serializer.serialize(c,function(T,x){x?g(x):R.db.transaction(function(k){be(k,R,"INSERT OR REPLACE INTO "+R.storeName+" (key, value) VALUES (?, ?)",[o,T],function(){v(E)},function(W,V){g(V)})},function(k){if(k.code===k.QUOTA_ERR){if(d>0){v(_r.apply(f,[o,E,a,d-1]));return}g(k)}})})}).catch(g)});return N(l,a),l}function yi(o,c,a){return _r.apply(this,[o,c,a,1])}function Ei(o,c){var a=this;o=_(o);var d=new I(function(f,l){a.ready().then(function(){var v=a.e;v.db.transaction(function(g){be(g,v,"DELETE FROM "+v.storeName+" WHERE key = ?",[o],function(){f()},function(E,R){l(R)})})}).catch(l)});return N(d,c),d}function Ri(o){var c=this,a=new I(function(d,f){c.ready().then(function(){var l=c.e;l.db.transaction(function(v){be(v,l,"DELETE FROM "+l.storeName,[],function(){d()},function(g,E){f(E)})})}).catch(f)});return N(a,o),a}function bi(o){var c=this,a=new I(function(d,f){c.ready().then(function(){var l=c.e;l.db.transaction(function(v){be(v,l,"SELECT COUNT(key) as c FROM "+l.storeName,[],function(g,E){var R=E.rows.item(0).c;d(R)},function(g,E){f(E)})})}).catch(f)});return N(a,o),a}function Ii(o,c){var a=this,d=new I(function(f,l){a.ready().then(function(){var v=a.e;v.db.transaction(function(g){be(g,v,"SELECT key FROM "+v.storeName+" WHERE id = ? LIMIT 1",[o+1],function(E,R){var T=R.rows.length?R.rows.item(0).key:null;f(T)},function(E,R){l(R)})})}).catch(l)});return N(d,c),d}function Ti(o){var c=this,a=new I(function(d,f){c.ready().then(function(){var l=c.e;l.db.transaction(function(v){be(v,l,"SELECT key FROM "+l.storeName,[],function(g,E){for(var R=[],T=0;T<E.rows.length;T++)R.push(E.rows.item(T).key);d(R)},function(g,E){f(E)})})}).catch(f)});return N(a,o),a}function wi(o){return new I(function(c,a){o.transaction(function(d){d.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(f,l){for(var v=[],g=0;g<l.rows.length;g++)v.push(l.rows.item(g).name);c({db:o,storeNames:v})},function(f,l){a(l)})},function(d){a(d)})})}function Si(o,c){c=le.apply(this,arguments);var a=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||a.name,o.storeName=o.storeName||a.storeName);var d=this,f;return o.name?f=new I(function(l){var v;o.name===a.name?v=d.e.db:v=openDatabase(o.name,"","",0),o.storeName?l({db:v,storeNames:[o.storeName]}):l(wi(v))}).then(function(l){return new I(function(v,g){l.db.transaction(function(E){function R(W){return new I(function(V,Y){E.executeSql("DROP TABLE IF EXISTS "+W,[],function(){V()},function(j,ue){Y(ue)})})}for(var T=[],x=0,k=l.storeNames.length;x<k;x++)T.push(R(l.storeNames[x]));I.all(T).then(function(){v()}).catch(function(W){g(W)})},function(E){g(E)})})}):f=I.reject("Invalid arguments"),N(f,c),f}var Ai={n:"webSQLStorage",h:hi,a:di(),iterate:gi,getItem:vi,setItem:yi,removeItem:Ei,clear:Ri,length:bi,key:Ii,keys:Ti,dropInstance:Si};function xi(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Cr(o,c){var a=o.name+"/";return o.storeName!==c.storeName&&(a+=o.storeName+"/"),a}function Ni(){var o="_localforage_support_test";try{return localStorage.setItem(o,!0),localStorage.removeItem(o),!1}catch{return!0}}function Pi(){return!Ni()||localStorage.length>0}function _i(o){var c=this,a={};if(o)for(var d in o)a[d]=o[d];return a.keyPrefix=Cr(o,c.d),Pi()?(c.e=a,a.serializer=Ot,I.resolve()):I.reject()}function Ci(o){var c=this,a=c.ready().then(function(){for(var d=c.e.keyPrefix,f=localStorage.length-1;f>=0;f--){var l=localStorage.key(f);l.indexOf(d)===0&&localStorage.removeItem(l)}});return N(a,o),a}function Oi(o,c){var a=this;o=_(o);var d=a.ready().then(function(){var f=a.e,l=localStorage.getItem(f.keyPrefix+o);return l&&(l=f.serializer.deserialize(l)),l});return N(d,c),d}function Li(o,c){var a=this,d=a.ready().then(function(){for(var f=a.e,l=f.keyPrefix,v=l.length,g=localStorage.length,E=1,R=0;R<g;R++){var T=localStorage.key(R);if(T.indexOf(l)===0){var x=localStorage.getItem(T);if(x&&(x=f.serializer.deserialize(x)),x=o(x,T.substring(v),E++),x!==void 0)return x}}});return N(d,c),d}function Mi(o,c){var a=this,d=a.ready().then(function(){var f=a.e,l;try{l=localStorage.key(o)}catch{l=null}return l&&(l=l.substring(f.keyPrefix.length)),l});return N(d,c),d}function Di(o){var c=this,a=c.ready().then(function(){for(var d=c.e,f=localStorage.length,l=[],v=0;v<f;v++){var g=localStorage.key(v);g.indexOf(d.keyPrefix)===0&&l.push(g.substring(d.keyPrefix.length))}return l});return N(a,o),a}function $i(o){var c=this,a=c.keys().then(function(d){return d.length});return N(a,o),a}function ki(o,c){var a=this;o=_(o);var d=a.ready().then(function(){var f=a.e;localStorage.removeItem(f.keyPrefix+o)});return N(d,c),d}function Fi(o,c,a){var d=this;o=_(o);var f=d.ready().then(function(){c===void 0&&(c=null);var l=c;return new I(function(v,g){var E=d.e;E.serializer.serialize(c,function(R,T){if(T)g(T);else try{localStorage.setItem(E.keyPrefix+o,R),v(l)}catch(x){(x.name==="QuotaExceededError"||x.name==="NS_ERROR_DOM_QUOTA_REACHED")&&g(x),g(x)}})})});return N(f,a),f}function Ui(o,c){if(c=le.apply(this,arguments),o=typeof o!="function"&&o||{},!o.name){var a=this.config();o.name=o.name||a.name,o.storeName=o.storeName||a.storeName}var d=this,f;return o.name?f=new I(function(l){o.storeName?l(Cr(o,d.d)):l(o.name+"/")}).then(function(l){for(var v=localStorage.length-1;v>=0;v--){var g=localStorage.key(v);g.indexOf(l)===0&&localStorage.removeItem(g)}}):f=I.reject("Invalid arguments"),N(f,c),f}var qi={n:"localStorageWrapper",h:_i,a:xi(),iterate:Li,getItem:Oi,setItem:Fi,removeItem:ki,clear:Ci,length:$i,key:Mi,keys:Di,dropInstance:Ui},Bi=function(c,a){return c===a||typeof c=="number"&&typeof a=="number"&&isNaN(c)&&isNaN(a)},Wi=function(c,a){for(var d=c.length,f=0;f<d;){if(Bi(c[f],a))return!0;f++}return!1},Or=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"},Fe={},Lr={},Ce={INDEXEDDB:ui,WEBSQL:Ai,LOCALSTORAGE:qi},Gi=[Ce.INDEXEDDB.n,Ce.WEBSQL.n,Ce.LOCALSTORAGE.n],rt=["dropInstance"],Lt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(rt),Vi={description:"",driver:Gi.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Ji(o,c){o[c]=function(){var a=arguments;return o.ready().then(function(){return o[c].apply(o,a)})}}function Mt(){for(var o=1;o<arguments.length;o++){var c=arguments[o];if(c)for(var a in c)c.hasOwnProperty(a)&&(Or(c[a])?arguments[0][a]=c[a].slice():arguments[0][a]=c[a])}return arguments[0]}var Hi=function(){function o(c){p(this,o);for(var a in Ce)if(Ce.hasOwnProperty(a)){var d=Ce[a],f=d.n;this[a]=f,Fe[f]||this.defineDriver(d)}this.d=Mt({},Vi),this.l=Mt({},this.d,c),this.i=null,this.R=null,this.o=!1,this.e=null,this.b(),this.setDriver(this.l.driver).catch(function(){})}return o.prototype.config=function(a){if((typeof a>"u"?"undefined":u(a))==="object"){if(this.o)return new Error("Can't call config() after localforage has been used.");for(var d in a){if(d==="storeName"&&(a[d]=a[d].replace(/\W/g,"_")),d==="version"&&typeof a[d]!="number")return new Error("Database version must be a number.");this.l[d]=a[d]}return"driver"in a&&a.driver?this.setDriver(this.l.driver):!0}else return typeof a=="string"?this.l[a]:this.l},o.prototype.defineDriver=function(a,d,f){var l=new I(function(v,g){try{var E=a.n,R=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!a.n){g(R);return}for(var T=Lt.concat("_initStorage"),x=0,k=T.length;x<k;x++){var W=T[x],V=!Wi(rt,W);if((V||a[W])&&typeof a[W]!="function"){g(R);return}}var Y=function(){for(var Ue=function(Yi){return function(){var Xi=new Error("Method "+Yi+" is not implemented by the current driver"),Mr=I.reject(Xi);return N(Mr,arguments[arguments.length-1]),Mr}},Dt=0,ji=rt.length;Dt<ji;Dt++){var $t=rt[Dt];a[$t]||(a[$t]=Ue($t))}};Y();var j=function(Ue){Fe[E]&&console.info("Redefining LocalForage driver: "+E),Fe[E]=a,Lr[E]=Ue,v()};"_support"in a?a.a&&typeof a.a=="function"?a.a().then(j,g):j(!!a.a):j(!0)}catch(ue){g(ue)}});return F(l,d,f),l},o.prototype.driver=function(){return this.n||null},o.prototype.getDriver=function(a,d,f){var l=Fe[a]?I.resolve(Fe[a]):I.reject(new Error("Driver not found."));return F(l,d,f),l},o.prototype.getSerializer=function(a){var d=I.resolve(Ot);return F(d,a),d},o.prototype.ready=function(a){var d=this,f=d.i.then(function(){return d.o===null&&(d.o=d.R()),d.o});return F(f,a,a),f},o.prototype.setDriver=function(a,d,f){var l=this;Or(a)||(a=[a]);var v=this.T(a);function g(){l.l.driver=l.driver()}function E(x){return l.w(x),g(),l.o=l.h(l.l),l.o}function R(x){return function(){var k=0;function W(){for(;k<x.length;){var V=x[k];return k++,l.e=null,l.o=null,l.getDriver(V).then(E).catch(W)}g();var Y=new Error("No available storage method found.");return l.i=I.reject(Y),l.i}return W()}}var T=this.i!==null?this.i.catch(function(){return I.resolve()}):I.resolve();return this.i=T.then(function(){var x=v[0];return l.e=null,l.o=null,l.getDriver(x).then(function(k){l.n=k.n,g(),l.b(),l.R=R(v)})}).catch(function(){g();var x=new Error("No available storage method found.");return l.i=I.reject(x),l.i}),F(this.i,d,f),this.i},o.prototype.supports=function(a){return!!Lr[a]},o.prototype.w=function(a){Mt(this,a)},o.prototype.T=function(a){for(var d=[],f=0,l=a.length;f<l;f++){var v=a[f];this.supports(v)&&d.push(v)}return d},o.prototype.b=function(){for(var a=0,d=Lt.length;a<d;a++)Ji(this,Lt[a])},o.prototype.createInstance=function(a){return new o(a)},o}(),Ki=new Hi;i.exports=Ki},{3:3}]},{},[4])(4)})});var ri=kt((St,ti)=>{"use strict";(function(r,e){typeof St=="object"&&typeof ti<"u"?e(St):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],e):e(r.LocalforageDriverMemory={})})(typeof self<"u"?self:St,function(r){"use strict";var e="localforage-driver-memory";function t(h){var y=typeof Symbol=="function"&&h[Symbol.iterator],w=0;return y?y.call(h):{next:function(){return h&&w>=h.length&&(h=void 0),{value:h&&h[w++],done:!h}}}}function n(h,y){h=h||[],y=y||{};try{return new Blob(h,y)}catch(M){if(M.name!=="TypeError")throw M;for(var w=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new w,O=0;O<h.length;O+=1)C.append(h[O]);return C.getBlob(y.type)}}var i=/^~~local_forage_type~([^~]+)~/,s=9,u=s+4,p=Object.prototype.toString;function m(h){var y=h.length*.75,w=h.length;h[h.length-1]==="="&&(y--,h[h.length-2]==="="&&y--);for(var C=new ArrayBuffer(y),O=new Uint8Array(C),M=0,q=0;M<w;M+=4){var z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(h[M]),_e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(h[M+1]),Se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(h[M+2]),ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(h[M+3]);O[q++]=z<<2|_e>>4,O[q++]=(_e&15)<<4|Se>>2,O[q++]=(Se&3)<<6|ke&63}return C}function A(h){for(var y=new Uint8Array(h),w="",C=0;C<y.length;C+=3)w+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[y[C]>>2],w+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(y[C]&3)<<4|y[C+1]>>4],w+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(y[C+1]&15)<<2|y[C+2]>>6],w+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[y[C+2]&63];return y.length%3===2?w=w.substring(0,w.length-1)+"=":y.length%3===1&&(w=w.substring(0,w.length-2)+"=="),w}function b(h,y){var w="";if(h&&(w=p.call(h)),h&&(w==="[object ArrayBuffer]"||h.buffer&&p.call(h.buffer)==="[object ArrayBuffer]")){var C=void 0,O="__lfsc__:";h instanceof ArrayBuffer?(C=h,O+="arbf"):(C=h.buffer,w==="[object Int8Array]"?O+="si08":w==="[object Uint8Array]"?O+="ui08":w==="[object Uint8ClampedArray]"?O+="uic8":w==="[object Int16Array]"?O+="si16":w==="[object Uint16Array]"?O+="ur16":w==="[object Int32Array]"?O+="si32":w==="[object Uint32Array]"?O+="ui32":w==="[object Float32Array]"?O+="fl32":w==="[object Float64Array]"?O+="fl64":y(new Error("Failed to get type for BinaryArray"))),y(O+A(C))}else if(w==="[object Blob]"){var M=new FileReader;M.onload=function(){var q="~~local_forage_type~"+h.type+"~"+A(this.result);y("__lfsc__:blob"+q)},M.readAsArrayBuffer(h)}else try{y(JSON.stringify(h))}catch(q){console.error("Couldn't convert value into a JSON string: ",h),y(null,q)}}function P(h){if(h.substring(0,s)!=="__lfsc__:")return JSON.parse(h);var y=h.substring(u),w=h.substring(s,u),C;if(w==="blob"&&i.test(y)){var O=y.match(i);C=O[1],y=y.substring(O[0].length)}var M=m(y);switch(w){case"arbf":return M;case"blob":return n([M],{type:C});case"si08":return new Int8Array(M);case"ui08":return new Uint8Array(M);case"uic8":return new Uint8ClampedArray(M);case"si16":return new Int16Array(M);case"ur16":return new Uint16Array(M);case"si32":return new Int32Array(M);case"ui32":return new Uint32Array(M);case"fl32":return new Float32Array(M);case"fl64":return new Float64Array(M);default:throw new Error("Unkown type: "+w)}}function I(h){var y,w;if(h===null||typeof h!="object"||"isActiveClone"in h)return h;var C=h instanceof Date?new Date(h):h.constructor();try{for(var O=t(Object.keys(h)),M=O.next();!M.done;M=O.next()){var q=M.value;Object.prototype.hasOwnProperty.call(h,q)&&(h.isActiveClone=null,C[q]=I(h[q]),delete h.isActiveClone)}}catch(z){y={error:z}}finally{try{M&&!M.done&&(w=O.return)&&w.call(O)}finally{if(y)throw y.error}}return C}function N(h,y){return(h.name||y.name)+"/"+(h.storeName||y.storeName)+"/"}function F(h,y){y&&h.then(function(w){y(null,w)},function(w){y(w)})}function _(){for(var h=[],y=0;y<arguments.length;y++)h[y]=arguments[y];if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}function le(h,y){var w=this;if(y=_.apply(this,arguments),h=typeof h!="function"&&h||{},!h.name){var C=this.config();h.name=h.name||C.name,h.storeName=h.storeName||C.storeName}var O;return h.name?O=new Promise(function(M){h.storeName?M(N(h,w.d)):M(h.name+"/")}):O=Promise.reject("Invalid arguments"),{promise:O,callback:y}}function H(h){return typeof h!="string"&&(console.warn(h+" used as a key, but it is not a string."),h=String(h)),h}var fe={bufferToString:A,deserialize:P,serialize:b,stringToBuffer:m},K={},Pe=function(){function h(y){this.kp=y,this.data={}}return h.resolve=function(y){return K[y]||(K[y]=new h(y)),K[y]},h.prototype.clear=function(){this.data={}},h.prototype.drop=function(){this.clear(),delete K[this.kp]},h.prototype.get=function(y){return this.data[y]},h.prototype.key=function(y){return this.keys()[y]},h.prototype.keys=function(){return Object.keys(this.data)},h.prototype.rm=function(y){delete this.data[y]},h.prototype.set=function(y,w){this.data[y]=w},h}();function ye(h){var y=h?I(h):{},w=N(y,this.d),C=Pe.resolve(w);return this.e=y,this.e.serializer=fe,this.e.keyPrefix=w,this.e.mStore=C,Promise.resolve()}function S(h){var y=this,w=this.ready().then(function(){y.e.mStore.clear()});return F(w,h),w}function U(h,y){var w=le.apply(this,arguments),C=w.promise,O=w.callback,M=C.then(function(q){Pe.resolve(q).drop()});return F(M,O),C}function D(h,y){var w=this;h=H(h);var C=this.ready().then(function(){var O=w.e.mStore.get(h);return O==null?null:w.e.serializer.deserialize(O)});return F(C,y),C}function G(h,y){var w=this,C=this.ready().then(function(){for(var O=w.e.mStore,M=O.keys(),q=0;q<M.length;q++){var z=O.get(M[q]);if(z&&(z=w.e.serializer.deserialize(z)),z=h(z,M[q],q+1),z!==void 0)return z}});return F(C,y),C}function X(h,y){var w=this,C=this.ready().then(function(){var O;try{O=w.e.mStore.key(h),O===void 0&&(O=null)}catch{O=null}return O});return F(C,y),C}function ne(h){var y=this,w=this.ready().then(function(){return y.e.mStore.keys()});return F(w,h),w}function ae(h){var y=this.keys().then(function(w){return w.length});return F(y,h),y}function ce(h,y){var w=this;h=H(h);var C=this.ready().then(function(){w.e.mStore.rm(h)});return F(C,y),C}function pe(h,y,w){var C=this;h=H(h);var O=this.ready().then(function(){y===void 0&&(y=null);var M=y;return new Promise(function(q,z){C.e.serializer.serialize(y,function(_e,Se){if(Se)z(Se);else try{C.e.mStore.set(h,_e),q(M)}catch(ke){z(ke)}})})});return F(O,w),O}var we=!0;r.a=we,r.n=e,r.h=ye,r.clear=S,r.dropInstance=U,r.getItem=D,r.iterate=G,r.key=X,r.keys=ne,r.length=ae,r.removeItem=ce,r.setItem=pe,Object.defineProperty(r,"__esModule",{value:!0})})});var Is={};Ft(Is,{default:()=>bs});function no(r){let e={exports:{}};return r(e,e.exports),e.exports}var io=Number.MAX_SAFE_INTEGER||9007199254740991;var Bt={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:io,MAX_SAFE_COMPONENT_LENGTH:16},oo=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{},J=oo,Je=no(function(r,e){let{MAX_SAFE_COMPONENT_LENGTH:t}=Bt,n=(e=r.exports={}).re=[],i=e.src=[],s=e.t={},u=0,p=(m,A,b)=>{let P=u++;J(P,A),s[m]=P,i[P]=A,n[P]=new RegExp(A,b?"g":void 0)};p("NUMERICIDENTIFIER","0|[1-9]\\d*"),p("NUMERICIDENTIFIERLOOSE","[0-9]+"),p("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),p("MAINVERSION",`(${i[s.NUMERICIDENTIFIER]})\\.(${i[s.NUMERICIDENTIFIER]})\\.(${i[s.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${i[s.NUMERICIDENTIFIERLOOSE]})\\.(${i[s.NUMERICIDENTIFIERLOOSE]})\\.(${i[s.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${i[s.NUMERICIDENTIFIER]}|${i[s.NONNUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${i[s.NUMERICIDENTIFIERLOOSE]}|${i[s.NONNUMERICIDENTIFIER]})`),p("PRERELEASE",`(?:-(${i[s.PRERELEASEIDENTIFIER]}(?:\\.${i[s.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${i[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${i[s.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER","[0-9A-Za-z-]+"),p("BUILD",`(?:\\+(${i[s.BUILDIDENTIFIER]}(?:\\.${i[s.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${i[s.MAINVERSION]}${i[s.PRERELEASE]}?${i[s.BUILD]}?`),p("FULL",`^${i[s.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${i[s.MAINVERSIONLOOSE]}${i[s.PRERELEASELOOSE]}?${i[s.BUILD]}?`),p("LOOSE",`^${i[s.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${i[s.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${i[s.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${i[s.XRANGEIDENTIFIER]})(?:\\.(${i[s.XRANGEIDENTIFIER]})(?:\\.(${i[s.XRANGEIDENTIFIER]})(?:${i[s.PRERELEASE]})?${i[s.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${i[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[s.XRANGEIDENTIFIERLOOSE]})(?:${i[s.PRERELEASELOOSE]})?${i[s.BUILD]}?)?)?`),p("XRANGE",`^${i[s.GTLT]}\\s*${i[s.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${i[s.GTLT]}\\s*${i[s.XRANGEPLAINLOOSE]}$`),p("COERCE",`(^|[^\\d])(\\d{1,${t}})(?:\\.(\\d{1,${t}}))?(?:\\.(\\d{1,${t}}))?(?:$|[^\\d])`),p("COERCERTL",i[s.COERCE],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${i[s.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",p("TILDE",`^${i[s.LONETILDE]}${i[s.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${i[s.LONETILDE]}${i[s.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${i[s.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",p("CARET",`^${i[s.LONECARET]}${i[s.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${i[s.LONECARET]}${i[s.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${i[s.GTLT]}\\s*(${i[s.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${i[s.GTLT]}\\s*(${i[s.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${i[s.GTLT]}\\s*(${i[s.LOOSEPLAIN]}|${i[s.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${i[s.XRANGEPLAIN]})\\s+-\\s+(${i[s.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${i[s.XRANGEPLAINLOOSE]})\\s+-\\s+(${i[s.XRANGEPLAINLOOSE]})\\s*$`),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0.0.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}),$r=/^[0-9]+$/,Jr=(r,e)=>{let t=$r.test(r),n=$r.test(e);return t&&n&&(r=+r,e=+e),r===e?0:t&&!n?-1:n&&!t?1:r<e?-1:1},so=(r,e)=>Jr(e,r),ao={compareIdentifiers:Jr,rcompareIdentifiers:so},{MAX_LENGTH:kr,MAX_SAFE_INTEGER:it}=Bt,{re:Fr,t:Ur}=Je,{compareIdentifiers:Be}=ao,me=class r{constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof r){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid Version: ${e}`);if(e.length>kr)throw new TypeError(`version is longer than ${kr} characters`);J("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let n=e.trim().match(t.loose?Fr[Ur.LOOSE]:Fr[Ur.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>it||this.major<0)throw new TypeError("Invalid major version");if(this.minor>it||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>it||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<it)return s}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(J("SemVer.compare",this.version,this.options,e),!(e instanceof r)){if(typeof e=="string"&&e===this.version)return 0;e=new r(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof r||(e=new r(e,this.options)),Be(this.major,e.major)||Be(this.minor,e.minor)||Be(this.patch,e.patch)}comparePre(e){if(e instanceof r||(e=new r(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let n=this.prerelease[t],i=e.prerelease[t];if(J("prerelease compare",t,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n!==i)return Be(n,i)}while(++t)}compareBuild(e){e instanceof r||(e=new r(e,this.options));let t=0;do{let n=this.build[t],i=e.build[t];if(J("prerelease compare",t,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n!==i)return Be(n,i)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t),this.inc("pre",t);break;case"major":this.minor===0&&this.patch===0&&this.prerelease.length!==0||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":this.patch===0&&this.prerelease.length!==0||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{let n=this.prerelease.length;for(;--n>=0;)typeof this.prerelease[n]=="number"&&(this.prerelease[n]++,n=-2);n===-1&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}},co=(r,e,t)=>new me(r,t).compare(new me(e,t)),Oe=co,lo=(r,e,t)=>Oe(r,e,t)===0,uo=lo,fo=(r,e,t)=>Oe(r,e,t)!==0,po=fo,mo=(r,e,t)=>Oe(r,e,t)>0,ho=mo,vo=(r,e,t)=>Oe(r,e,t)>=0,go=vo,yo=(r,e,t)=>Oe(r,e,t)<0,Eo=yo,Ro=(r,e,t)=>Oe(r,e,t)<=0,bo=Ro,Io=(r,e,t,n)=>{switch(e){case"===":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r===t;case"!==":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r!==t;case"":case"=":case"==":return uo(r,t,n);case"!=":return po(r,t,n);case">":return ho(r,t,n);case">=":return go(r,t,n);case"<":return Eo(r,t,n);case"<=":return bo(r,t,n);default:throw new TypeError(`Invalid operator: ${e}`)}},qt=Io,We=Symbol("SemVer ANY"),Ge=class r{static get ANY(){return We}constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof r){if(e.loose===!!t.loose)return e;e=e.value}J("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===We?this.value="":this.value=this.operator+this.semver.version,J("comp",this)}parse(e){let t=this.options.loose?qr[Br.COMPARATORLOOSE]:qr[Br.COMPARATOR],n=e.match(t);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new me(n[2],this.options.loose):this.semver=We}toString(){return this.value}test(e){if(J("Comparator.test",e,this.options.loose),this.semver===We||e===We)return!0;if(typeof e=="string")try{e=new me(e,this.options)}catch{return!1}return qt(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Comparator is required");if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),this.operator==="")return this.value===""||new Ve(e.value,t).test(this.value);if(e.operator==="")return e.value===""||new Ve(this.value,t).test(e.semver);let n=!(this.operator!==">="&&this.operator!==">"||e.operator!==">="&&e.operator!==">"),i=!(this.operator!=="<="&&this.operator!=="<"||e.operator!=="<="&&e.operator!=="<"),s=this.semver.version===e.semver.version,u=!(this.operator!==">="&&this.operator!=="<="||e.operator!==">="&&e.operator!=="<="),p=qt(this.semver,"<",e.semver,t)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),m=qt(this.semver,">",e.semver,t)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return n||i||s&&u||p||m}},{re:qr,t:Br}=Je,Ve=class r{constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof r)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new r(e.raw,t);if(e instanceof Ge)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let{loose:t}=this.options;e=e.trim();let n=t?ee[Q.HYPHENRANGELOOSE]:ee[Q.HYPHENRANGE];e=e.replace(n,Do(this.options.includePrerelease)),J("hyphen replace",e),e=e.replace(ee[Q.COMPARATORTRIM],To),J("comparator trim",e,ee[Q.COMPARATORTRIM]),e=(e=(e=e.replace(ee[Q.TILDETRIM],wo)).replace(ee[Q.CARETTRIM],So)).split(/\s+/).join(" ");let i=t?ee[Q.COMPARATORLOOSE]:ee[Q.COMPARATOR];return e.split(" ").map(s=>Ao(s,this.options)).join(" ").split(/\s+/).map(s=>Mo(s,this.options)).filter(this.options.loose?s=>!!s.match(i):()=>!0).map(s=>new Ge(s,this.options))}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Range is required");return this.set.some(n=>Wr(n,t)&&e.set.some(i=>Wr(i,t)&&n.every(s=>i.every(u=>s.intersects(u,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new me(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if($o(this.set[t],e,this.options))return!0;return!1}},{re:ee,t:Q,comparatorTrimReplace:To,tildeTrimReplace:wo,caretTrimReplace:So}=Je,Wr=(r,e)=>{let t=!0,n=r.slice(),i=n.pop();for(;t&&n.length;)t=n.every(s=>i.intersects(s,e)),i=n.pop();return t},Ao=(r,e)=>(J("comp",r,e),r=Po(r,e),J("caret",r),r=xo(r,e),J("tildes",r),r=Co(r,e),J("xrange",r),r=Lo(r,e),J("stars",r),r),ie=r=>!r||r.toLowerCase()==="x"||r==="*",xo=(r,e)=>r.trim().split(/\s+/).map(t=>No(t,e)).join(" "),No=(r,e)=>{let t=e.loose?ee[Q.TILDELOOSE]:ee[Q.TILDE];return r.replace(t,(n,i,s,u,p)=>{let m;return J("tilde",r,n,i,s,u,p),ie(i)?m="":ie(s)?m=`>=${i}.0.0 <${+i+1}.0.0-0`:ie(u)?m=`>=${i}.${s}.0 <${i}.${+s+1}.0-0`:p?(J("replaceTilde pr",p),m=`>=${i}.${s}.${u}-${p} <${i}.${+s+1}.0-0`):m=`>=${i}.${s}.${u} <${i}.${+s+1}.0-0`,J("tilde return",m),m})},Po=(r,e)=>r.trim().split(/\s+/).map(t=>_o(t,e)).join(" "),_o=(r,e)=>{J("caret",r,e);let t=e.loose?ee[Q.CARETLOOSE]:ee[Q.CARET],n=e.includePrerelease?"-0":"";return r.replace(t,(i,s,u,p,m)=>{let A;return J("caret",r,i,s,u,p,m),ie(s)?A="":ie(u)?A=`>=${s}.0.0${n} <${+s+1}.0.0-0`:ie(p)?A=s==="0"?`>=${s}.${u}.0${n} <${s}.${+u+1}.0-0`:`>=${s}.${u}.0${n} <${+s+1}.0.0-0`:m?(J("replaceCaret pr",m),A=s==="0"?u==="0"?`>=${s}.${u}.${p}-${m} <${s}.${u}.${+p+1}-0`:`>=${s}.${u}.${p}-${m} <${s}.${+u+1}.0-0`:`>=${s}.${u}.${p}-${m} <${+s+1}.0.0-0`):(J("no pr"),A=s==="0"?u==="0"?`>=${s}.${u}.${p}${n} <${s}.${u}.${+p+1}-0`:`>=${s}.${u}.${p}${n} <${s}.${+u+1}.0-0`:`>=${s}.${u}.${p} <${+s+1}.0.0-0`),J("caret return",A),A})},Co=(r,e)=>(J("replaceXRanges",r,e),r.split(/\s+/).map(t=>Oo(t,e)).join(" ")),Oo=(r,e)=>{r=r.trim();let t=e.loose?ee[Q.XRANGELOOSE]:ee[Q.XRANGE];return r.replace(t,(n,i,s,u,p,m)=>{J("xRange",r,n,i,s,u,p,m);let A=ie(s),b=A||ie(u),P=b||ie(p),I=P;return i==="="&&I&&(i=""),m=e.includePrerelease?"-0":"",A?n=i===">"||i==="<"?"<0.0.0-0":"*":i&&I?(b&&(u=0),p=0,i===">"?(i=">=",b?(s=+s+1,u=0,p=0):(u=+u+1,p=0)):i==="<="&&(i="<",b?s=+s+1:u=+u+1),i==="<"&&(m="-0"),n=`${i+s}.${u}.${p}${m}`):b?n=`>=${s}.0.0${m} <${+s+1}.0.0-0`:P&&(n=`>=${s}.${u}.0${m} <${s}.${+u+1}.0-0`),J("xRange return",n),n})},Lo=(r,e)=>(J("replaceStars",r,e),r.trim().replace(ee[Q.STAR],"")),Mo=(r,e)=>(J("replaceGTE0",r,e),r.trim().replace(ee[e.includePrerelease?Q.GTE0PRE:Q.GTE0],"")),Do=r=>(e,t,n,i,s,u,p,m,A,b,P,I,N)=>`${t=ie(n)?"":ie(i)?`>=${n}.0.0${r?"-0":""}`:ie(s)?`>=${n}.${i}.0${r?"-0":""}`:u?`>=${t}`:`>=${t}${r?"-0":""}`} ${m=ie(A)?"":ie(b)?`<${+A+1}.0.0-0`:ie(P)?`<${A}.${+b+1}.0-0`:I?`<=${A}.${b}.${P}-${I}`:r?`<${A}.${b}.${+P+1}-0`:`<=${m}`}`.trim(),$o=(r,e,t)=>{for(let n=0;n<r.length;n++)if(!r[n].test(e))return!1;if(e.prerelease.length&&!t.includePrerelease){for(let n=0;n<r.length;n++)if(J(r[n].semver),r[n].semver!==Ge.ANY&&r[n].semver.prerelease.length>0){let i=r[n].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0},Hr=(r,e,t)=>{try{e=new Ve(e,t)}catch{return!1}return e.test(r)};var{MAX_LENGTH:ko}=Bt,{re:Gr,t:Vr}=Je,Fo=(r,e)=>{if(e&&typeof e=="object"||(e={loose:!!e,includePrerelease:!1}),r instanceof me)return r;if(typeof r!="string"||r.length>ko||!(e.loose?Gr[Vr.LOOSE]:Gr[Vr.FULL]).test(r))return null;try{return new me(r,e)}catch{return null}},Uo=Fo,{re:ot,t:st}=Je,Kr=(r,e)=>{if(r instanceof me)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;let t=null;if((e=e||{}).rtl){let n;for(;(n=ot[st.COERCERTL].exec(r))&&(!t||t.index+t[0].length!==r.length);)t&&n.index+n[0].length===t.index+t[0].length||(t=n),ot[st.COERCERTL].lastIndex=n.index+n[1].length+n[2].length;ot[st.COERCERTL].lastIndex=-1}else t=r.match(ot[st.COERCE]);return t===null?null:Uo(`${t[2]}.${t[3]||"0"}.${t[4]||"0"}`,e)};function qo(r){return String.fromCharCode(parseInt(r.slice(1),16))}function Bo(r){return`%${`00${r.charCodeAt(0).toString(16)}`.slice(-2)}`}function Wo(r){return btoa(encodeURIComponent(r).replace(/%[0-9A-F]{2}/g,qo))}function Go(r){return decodeURIComponent(Array.from(atob(r),Bo).join(""))}function at(r){return Wo(JSON.stringify(r))}function jr(r){return JSON.parse(Go(r))}var Wt=(p=>(p.MissingApiKey="MISSING_API_KEY",p.ModalNotReady="MODAL_NOT_READY",p.ConnectionLost="CONNECTION_WAS_LOST",p.MalformedResponse="MALFORMED_RESPONSE",p.InvalidArgument="INVALID_ARGUMENT",p.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",p.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",p))(Wt||{}),ct=(s=>(s.SyncWeb3Method="SYNC_WEB3_METHOD",s.DuplicateIframe="DUPLICATE_IFRAME",s.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",s.DeprecationNotice="DEPRECATION_NOTICE",s.ProductAnnouncement="ANNOUNCEMENT",s))(ct||{}),He=(_=>(_[_.ParseError=-32700]="ParseError",_[_.InvalidRequest=-32600]="InvalidRequest",_[_.MethodNotFound=-32601]="MethodNotFound",_[_.InvalidParams=-32602]="InvalidParams",_[_.InternalError=-32603]="InternalError",_[_.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",_[_.MagicLinkExpired=-10001]="MagicLinkExpired",_[_.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",_[_.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",_[_.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",_[_.UpdateEmailFailed=-10004]="UpdateEmailFailed",_[_.UserRequestEditEmail=-10005]="UserRequestEditEmail",_[_.InactiveRecipient=-10010]="InactiveRecipient",_[_.AccessDeniedToUser=-10011]="AccessDeniedToUser",_[_.RedirectLoginComplete=-10015]="RedirectLoginComplete",_))(He||{});var Gt=(n=>(n.PROVIDER="magic_3pw_provider",n.ADDRESS="magic_3pw_address",n.CHAIN_ID="magic_3pw_chainId",n))(Gt||{}),Yr=(n=>(n.WalletConnected="wallet_connected",n.WalletRejected="wallet_rejected",n.Web3ModalSelected="web3modal_selected",n))(Yr||{}),he=(L=>(L.LoginWithSms="magic_auth_login_with_sms",L.LoginWithEmailOTP="magic_auth_login_with_email_otp",L.LoginWithMagicLink="magic_auth_login_with_magic_link",L.LoginWithCredential="magic_auth_login_with_credential",L.SetAuthorizationToken="magic_auth_set_authorization_token",L.GetIdToken="magic_auth_get_id_token",L.GenerateIdToken="magic_auth_generate_id_token",L.GetMetadata="magic_auth_get_metadata",L.IsLoggedIn="magic_is_logged_in",L.Logout="magic_auth_logout",L.UpdateEmail="magic_auth_update_email",L.UserSettings="magic_auth_settings",L.UserSettingsTestMode="magic_auth_settings_testing_mode",L.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",L.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",L.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",L.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",L.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",L.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",L.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",L.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",L.LogoutTestMode="magic_auth_logout_testing_mode",L.UpdateEmailTestMode="magic_auth_update_email_testing_mode",L.IntermediaryEvent="magic_intermediary_event",L.RequestAccounts="eth_requestAccounts",L.GetInfo="magic_get_info",L.ShowUI="magic_wallet",L.NFTPurchase="magic_nft_purchase",L.NFTCheckout="magic_nft_checkout",L.NFTTransfer="magic_nft_transfer",L.RequestUserInfoWithUI="mc_request_user_info",L.Disconnect="mc_disconnect",L.RecoverAccount="magic_auth_recover_account",L.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",L.MagicBoxHeartBeat="magic_box_heart_beat",L.AutoConnect="mc_auto_connect",L.Login="mc_login",L.EncryptV1="magic_auth_encrypt_v1",L.DecryptV1="magic_auth_decrypt_v1",L.ShowNFTs="magic_show_nfts",L.ShowOnRamp="magic_show_fiat_onramp",L.ShowSendTokensUI="magic_show_send_tokens_ui",L.ShowAddress="magic_show_address",L.ShowBalances="magic_show_balances",L.SendGaslessTransaction="eth_sendGaslessTransaction",L.RevealPK="magic_reveal_key",L.EnableMFA="magic_auth_enable_mfa_flow",L.DisableMFA="magic_auth_disable_mfa_flow",L))(he||{}),Vt=["magic_intermediary_event","magic_nft_checkout","mc_login"];var Ke=(b=>(b.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",b.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",b.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",b.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",b.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",b.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",b.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",b.MAGIC_PONG="MAGIC_PONG",b.MAGIC_POPUP_RESPONSE="MAGIC_POPUP_RESPONSE",b.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE="MAGIC_POPUP_OAUTH_VERIFY_RESPONSE",b))(Ke||{}),je=(t=>(t.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",t.MAGIC_PING="MAGIC_PING",t))(je||{});var Xr=(n=>(n.UpdateEmail="update-email",n.MFA="mfa",n.Recovery="recovery",n))(Xr||{});var zr=(e=>(e.Retry="retry",e))(zr||{}),Qr=(t=>(t.EmailSent="email-sent",t.EmailNotDeliverable="email-not-deliverable",t))(Qr||{}),Jt=(s=>(s.VerifyEmailOtp="verify-email-otp",s.VerifyMFACode="verify-mfa-code",s.LostDevice="lost-device",s.VerifyRecoveryCode="verify-recovery-code",s.Cancel="cancel",s))(Jt||{}),Ht=(n=>(n.VerifySmsOtp="verify-sms-otp",n.Cancel="cancel",n.Retry="retry",n))(Ht||{}),Zr=(n=>(n.SmsOTPSent="sms-otp-sent",n.InvalidSmsOtp="invalid-sms-otp",n.ExpiredSmsOtp="expired-sms-otp",n))(Zr||{}),en=(m=>(m.EmailOTPSent="email-otp-sent",m.InvalidEmailOtp="invalid-email-otp",m.InvalidMfaOtp="invalid-mfa-otp",m.ExpiredEmailOtp="expired-email-otp",m.MfaSentHandle="mfa-sent-handle",m.RecoveryCodeSentHandle="recovery-code-sent-handle",m.InvalidRecoveryCode="invalid-recovery-code",m.RecoveryCodeSuccess="recovery-code-success",m))(en||{}),Kt=(e=>(e.Retry="device-retry",e))(Kt||{}),tn=(i=>(i.DeviceApproved="device-approved",i.DeviceNeedsApproval="device-needs-approval",i.DeviceVerificationLinkExpired="device-verification-link-expired",i.DeviceVerificationEmailSent="device-verification-email-sent",i))(tn||{}),lt=(i=>(i.Retry="Recency/auth-factor-retry",i.Cancel="Recency/auth-factor-verification-cancel",i.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",i.VerifyMFACode="Recency/verify-mfa-code",i))(lt||{}),rn=(u=>(u.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",u.PrimaryAuthFactorVerified="Recency/auth-factor-verified",u.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",u.EmailExpired="Recency/auth-factor-verification-email-expired",u.EmailSent="Recency/auth-factor-verification-email-sent",u.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",u))(rn||{}),ut=(n=>(n.RetryWithNewEmail="UpdateEmail/retry-with-new-email",n.Cancel="UpdateEmail/new-email-verification-cancel",n.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",n))(ut||{}),nn=(m=>(m.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",m.EmailUpdated="UpdateEmail/email-updated",m.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",m.EmailExpired="UpdateEmail/new-email-verification-email-expired",m.EmailSent="UpdateEmail/new-email-verification-email-sent",m.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",m.InvalidEmail="UpdateEmail/new-email-invalid",m.EmailAlreadyExists="UpdateEmail/new-email-already-exists",m))(nn||{}),on=(e=>(e.IDTokenCreated="Auth/id-token-created",e))(on||{}),sn=(e=>(e.Cancel="Farcaster/cancel",e))(sn||{}),an=(n=>(n.MFASecretGenerated="mfa-secret-generated",n.InvalidMFAOtp="invalid-mfa-otp",n.MFARecoveryCodes="mfa-recovery-codes",n))(an||{}),jt=(t=>(t.VerifyMFACode="verify-mfa-code",t.Cancel="cancel-mfa-setup",t))(jt||{}),cn=(n=>(n.MFACodeRequested="mfa-code-requested",n.InvalidMFAOtp="invalid-mfa-otp",n.InvalidRecoveryCode="invalid-recovery-code",n))(cn||{}),Yt=(n=>(n.VerifyMFACode="verify-mfa-code",n.LostDevice="lost-device",n.Cancel="cancel-mfa-disable",n))(Yt||{});var ln=(e=>(e.Harmony="HARMONY",e))(ln||{});var Xt=(e=>(e.ClosedByUser="closed-by-user",e))(Xt||{}),zt=(e=>(e.ClosedByUser="closed-by-user-on-received",e))(zt||{}),un=(s=>(s.EnterNewPhoneNumber="enter-new-phone-number",s.EnterOtpCode="enter-otp-code",s.RecoveryFactorAlreadyExists="recovery-factor-already-exists",s.MalformedPhoneNumber="malformed-phone-number",s.InvalidOtpCode="invalid-otp-code",s))(un||{}),Qt=(i=>(i.SendNewPhoneNumber="send-new-phone-number",i.SendOtpCode="send-otp-code",i.Cancel="cancel",i.StartEditPhoneNumber="start-edit-phone-number",i))(Qt||{}),dn=(e=>(e.PhoneNumber="phone_number",e))(dn||{}),fn=(u=>(u.SmsOtpSent="sms-otp-sent",u.LoginThrottled="login-throttled",u.InvalidSmsOtp="invalid-sms-otp",u.SmsVerified="sms-verified",u.AccountRecovered="account-recovered",u.UpdateEmailRequired="update-email-required",u))(fn||{}),Zt=(i=>(i.Cancel="cancel",i.VerifyOtp="verify-otp-code",i.ResendSms="resend-sms-otp",i.UpdateEmail="update-email",i))(Zt||{});var er=(i=>(i.Success="nft-checkout-success",i.Failure="nft-checkout-failure",i.Initiated="nft-checkout-initiated",i.Disconnect="disconnect",i))(er||{});var pn=(e=>(e.WalletInfoFetched="Wallet/wallet-info-fetched",e))(pn||{});var mn=(e=>(e.CloseMagicWindow="close-magic-window",e))(mn||{});function Ye(r){return typeof r>"u"}function Vo(r){return r===null}function hn(r){return Vo(r)||Ye(r)}function vn(r){return hn(r)?!1:!Ye(r.jsonrpc)&&!Ye(r.id)&&(!Ye(r.result)||!Ye(r.error))}function gn(r){return hn(r)?!1:typeof r=="number"&&Object.values(He).includes(r)}function Xe(r){if(!r)return!0;for(let e in r)if(Object.hasOwnProperty.call(r,e))return!1;return!0}var B={};function tr(r,e){return Object.assign(B,e),r}var yn={"magic-sdk":"magic-sdk","@magic-sdk/react-native":"magic-sdk-rn","@magic-sdk/react-native-bare":"magic-sdk-rn-bare","@magic-sdk/react-native-expo":"magic-sdk-rn-expo"};var ve=class r extends Error{constructor(t,n){super(`Magic SDK Error: [${t}] ${n}`);this.code=t;this.rawMessage=n;this.__proto__=Error;Object.setPrototypeOf(this,r.prototype)}},Ee=class r extends Error{constructor(t){super();this.__proto__=Error;let n=Number(t?.code);this.rawMessage=t?.message||"Internal error",this.code=gn(n)?n:-32603,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=t?.data||void 0,Object.setPrototypeOf(this,r.prototype)}},ge=class{constructor(e,t){this.code=e;this.rawMessage=t;this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},Le=class r extends Error{constructor(t,n,i,s){super(`Magic Extension Error (${t.name}): [${n}] ${i}`);this.code=n;this.rawMessage=i;this.data=s;this.__proto__=Error;Object.setPrototypeOf(this,r.prototype)}},Ae=class{constructor(e,t,n){this.code=t;this.rawMessage=n;this.message=`Magic Extension Warning (${e.name}): [${t}] ${n}`}log(){console.warn(this.message)}};function En(){return new ve("MISSING_API_KEY","Please provide an API key that you acquired from the Magic developer dashboard.")}function dt(){return new ve("MODAL_NOT_READY","Modal is not ready")}function Rn(){return new ve("MALFORMED_RESPONSE","Response from the Magic iframe is malformed.")}function bn(r){return new ve("EXTENSION_NOT_INITIALIZED",`Extensions must be initialized with a Magic SDK instance before \`Extension.${r}\` can be accessed. Do not invoke \`Extension.${r}\` inside an extension constructor.`)}function In(r){let e=`Some extensions are incompatible with \`${B.sdkName}@${B.version}\`:`;return r.filter(t=>typeof t.compat<"u"&&t.compat!==null).forEach(t=>{let n=t.compat[B.sdkName];typeof n=="string"?e+=`
2
- - Extension \`${t.name}\` supports version(s) \`${n}\``:n||(e+=`
3
- - Extension \`${t.name}\` does not support ${B.platform} environments.`)}),new ve("INCOMPATIBLE_EXTENSIONS",e)}function Tn(r){let e=t=>{let n=t+1,i=n%10,s=n%100;return i===1&&s!==11?`${n}st`:i===2&&s!==12?`${n}nd`:i===3&&s!==13?`${n}rd`:`${n}th`};return new ve("INVALID_ARGUMENT",`Invalid ${e(r.argument)} argument given to \`${r.procedure}\`.
4
- Expected: \`${r.expected}\`
5
- Received: \`${r.received}\``)}function wn(){return new ge("DUPLICATE_IFRAME","Duplicate iframes found.")}function Sn(){return new ge("SYNC_WEB3_METHOD","Non-async web3 methods are deprecated in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.")}function An(){return new ge("REACT_NATIVE_ENDPOINT_CONFIGURATION",`CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The \`endpoint\` parameter SHOULD NOT be provided. The Magic \`<iframe>\` is automatically wrapped by a WebView pointed at \`${B.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}function xn(r){let{method:e,removalVersions:t,useInstead:n}=r,i=t[B.sdkName],s=n?` Use \`${n}\` instead.`:"",u=`\`${e}\` will be removed from \`${B.sdkName}\` in version \`${i}\`.${s}`;return new ge("DEPRECATION_NOTICE",u)}function*Jo(){let r=0;for(;;)r<Number.MAX_SAFE_INTEGER?yield++r:r=0}var Ho=Jo();function rr(){return Ho.next().value}var Nn=Symbol("Payload pre-processed by Magic SDK");function Pn(r){return Object.defineProperty(r,Nn,{value:!0,enumerable:!1}),r}function Ko(r){return!!r[Nn]}function xe(r){return Ko(r)||(r.jsonrpc=r.jsonrpc??"2.0",r.id=rr(),r.method=r.method??"noop",r.params=r.params??[],Pn(r)),r}function $(r,e=[]){return Pn({params:e,method:r,jsonrpc:"2.0",id:rr()})}var Me=class r{constructor(e){e instanceof r?(this.f=e.payload.jsonrpc,this.p=e.payload.id,this.u=e.payload.result,this.s=e.payload.error):vn(e)?(this.f=e.jsonrpc,this.p=e.id,this.u=e.result,this.s=e.error):(this.f=e.jsonrpc,this.p=e.id,this.u=void 0,this.s=void 0)}applyError(e){return this.s=e,this}applyResult(e){return this.u=e,this}get hasError(){return typeof this.s<"u"&&this.s!==null}get hasResult(){return typeof this.u<"u"}get payload(){return{jsonrpc:this.f,id:this.p,result:this.u,error:this.s}}};var On=Ut(Cn()),ir=class extends On.default{};function pt(){let r=new ir;return{emitter:r,createChainingEmitterMethod:(n,i)=>(...s)=>(r[n].apply(r,s),i),createBoundEmitterMethod:n=>(...i)=>r[n].apply(r,i)}}var Ln=Symbol("isPromiEvent");function mt(r){return!!r[Ln]}function se(r){let e=or(r),{createBoundEmitterMethod:t,createChainingEmitterMethod:n}=pt(),i=Symbol("Promise.then"),s=Symbol("Promise.catch"),u=Symbol("Promise.finally"),p=(b,P)=>(...I)=>{let N=P[b].apply(P,I);return m(N)},m=b=>Object.assign(b,{[Ln]:!0,[i]:b[i]||b.then,[s]:b[s]||b.catch,[u]:b[u]||b.finally,then:p(i,b),catch:p(s,b),finally:p(u,b),on:n("on",b),once:n("once",b),addListener:n("addListener",b),off:n("off",b),removeListener:n("removeListener",b),removeAllListeners:n("removeAllListeners",b),emit:t("emit"),eventNames:t("eventNames"),listeners:t("listeners"),listenerCount:t("listenerCount")}),A=m(e.then(b=>(A.emit("done",b),A.emit("settled"),b),b=>{throw A.emit("error",b),A.emit("settled"),b}));return A.on("closed-by-user-on-received",()=>{A.emit("closed-by-user")}),A}function or(r){return new Promise((e,t)=>{let n=r(e,t);Promise.resolve(n).catch(t)})}var Z=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){if(this.sdk.thirdPartyWallets.isConnected&&!Vt.includes(e.method))return se((u,p)=>{this.sdk.thirdPartyWallets.requestOverride(e).then(u).catch(p)});let t=this.overlay.post("MAGIC_HANDLE_REQUEST",xe(e)),n=se((s,u)=>{t.then(p=>{if(i(),p.hasError)u(new Ee(p.payload.error));else if(p.hasResult)s(p.payload.result);else throw Rn()}).catch(p=>{i(),u(p)})}),i=this.overlay.on("MAGIC_HANDLE_EVENT",s=>{let{response:u}=s.data;if(u.id===e.id&&u.result?.event){let{event:p,params:m=[]}=u.result;n.emit(p,...m)}});return n}createIntermediaryEvent(e,t){return i=>{let s=$("magic_intermediary_event",[{payloadId:t,eventType:e,args:i}]);this.request(s)}}};function Mn(r,e){let[t]=r.split(".").map(Number);return t>=e}var Xo={"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},ht=class extends Z{loginWithMagicLink(e){let t=B.sdkName==="@magic-sdk/react-native"||B.sdkName==="@magic-sdk/react-native-bare"||B.sdkName==="@magic-sdk/react-native-expo";if(t&&Mn(B.version,19))throw new Error("loginWithMagicLink() is deprecated for this package, please utlize a passcode method like loginWithSMS or loginWithEmailOTP instead.");t&&xn({method:"auth.loginWithMagicLink()",removalVersions:Xo,useInstead:"auth.loginWithEmailOTP()"}).log();let{email:n,showUI:i=!0,redirectURI:s,overrides:u,lifespan:p}=e,m=$(this.sdk.testMode?"magic_login_with_magic_link_testing_mode":"magic_auth_login_with_magic_link",[{email:n,showUI:i,redirectURI:s,overrides:u,lifespan:p}]);return this.request(m)}loginWithSMS(e){let{phoneNumber:t,showUI:n=!0,lifespan:i}=e,s=$(this.sdk.testMode?"magic_auth_login_with_sms_testing_mode":"magic_auth_login_with_sms",[{phoneNumber:t,showUI:n,lifespan:i}]),u=this.request(s);return!n&&u&&(u.on("verify-sms-otp",p=>{this.createIntermediaryEvent("verify-sms-otp",s.id)(p)}),u.on("cancel",()=>{this.createIntermediaryEvent("cancel",s.id)()})),u}loginWithEmailOTP(e){let{email:t,showUI:n,deviceCheckUI:i,overrides:s,lifespan:u}=e,p=$(this.sdk.testMode?"magic_auth_login_with_email_otp_testing_mode":"magic_auth_login_with_email_otp",[{email:t,showUI:n,deviceCheckUI:i,overrides:s,lifespan:u}]),m=this.request(p);return!i&&m&&m.on("device-retry",()=>{this.createIntermediaryEvent("device-retry",p.id)()}),!n&&m&&(m.on("verify-email-otp",A=>{this.createIntermediaryEvent("verify-email-otp",p.id)(A)}),m.on("verify-mfa-code",A=>{this.createIntermediaryEvent("verify-mfa-code",p.id)(A)}),m.on("lost-device",()=>{this.createIntermediaryEvent("lost-device",p.id)()}),m.on("verify-recovery-code",A=>{this.createIntermediaryEvent("verify-recovery-code",p.id)(A)}),m.on("cancel",()=>{this.createIntermediaryEvent("cancel",p.id)()})),m}loginWithCredential(e){let{credentialOrQueryString:t,lifespan:n}=e||{},i=t??"";if(!t&&B.platform==="web"){i=window.location.search;let u=window.location.origin+window.location.pathname;window.history.replaceState(null,"",u)}let s=$(this.sdk.testMode?"magic_auth_login_with_credential_testing_mode":"magic_auth_login_with_credential",[i,n]);return this.request(s)}setAuthorizationToken(e){let t=$("magic_auth_set_authorization_token",[{jwt:e}]);return this.request(t)}updateEmailWithUI(e){let{email:t,showUI:n=!0}=e,i=$(this.sdk.testMode?"magic_auth_update_email_testing_mode":"magic_auth_update_email",[{email:t,showUI:n}]),s=this.request(i);return n||(s.on("Recency/auth-factor-retry",()=>{this.createIntermediaryEvent("Recency/auth-factor-retry",i.id)()}),s.on("Recency/auth-factor-verification-cancel",()=>{this.createIntermediaryEvent("Recency/auth-factor-verification-cancel",i.id)()}),s.on("Recency/auth-factor-verify-email-otp",u=>{this.createIntermediaryEvent("Recency/auth-factor-verify-email-otp",i.id)(u)}),s.on("Recency/verify-mfa-code",u=>{this.createIntermediaryEvent("Recency/verify-mfa-code",i.id)(u)}),s.on("UpdateEmail/retry-with-new-email",u=>{this.createIntermediaryEvent("UpdateEmail/retry-with-new-email",i.id)(u)}),s.on("UpdateEmail/new-email-verification-cancel",()=>{this.createIntermediaryEvent("UpdateEmail/new-email-verification-cancel",i.id)()}),s.on("UpdateEmail/new-email-verify-otp",u=>{this.createIntermediaryEvent("UpdateEmail/new-email-verify-otp",i.id)(u)})),s}};var gt={};Ft(gt,{clear:()=>zo,getItem:()=>re,iterate:()=>sr,key:()=>Zo,keys:()=>es,length:()=>Qo,removeItem:()=>Ne,setItem:()=>de});var vt;function Ie(r){return async(...e)=>(vt||(vt=await B.configureStorage()),await vt.ready(),vt[r](...e))}var re=Ie("getItem"),de=Ie("setItem"),Ne=Ie("removeItem"),zo=Ie("clear"),Qo=Ie("length"),Zo=Ie("key"),es=Ie("keys"),sr=Ie("iterate");function Dn(){let r=window.crypto.getRandomValues(new Uint8Array(16));r[6]=r[6]&15|64,r[8]=r[8]&191|128;let e="";return e+=r[0].toString(16),e+=r[1].toString(16),e+=r[2].toString(16),e+=r[3].toString(16),e+="-",e+=r[4].toString(16),e+=r[5].toString(16),e+="-",e+=r[6].toString(16),e+=r[7].toString(16),e+="-",e+=r[8].toString(16),e+=r[9].toString(16),e+="-",e+=r[10].toString(16),e+=r[11].toString(16),e+=r[12].toString(16),e+=r[13].toString(16),e+=r[14].toString(16),e+=r[15].toString(16),e}var kn="STORE_KEY_PRIVATE_KEY",ar="STORE_KEY_PUBLIC_JWK",Fn="ECDSA",ts="P-256",rs={name:Fn,namedCurve:ts};function Qe(){let r=typeof window<"u"&&!!window.crypto,e=r&&!!window.crypto.subtle;return r&&e}async function Un(){let r=await ns();if(!r){console.info("unable to create public key or webcrypto is unsupported");return}let{subtle:e}=window.crypto,t=await re(kn);if(!t||!e){console.info("unable to find private key or webcrypto unsupported");return}let n={iat:Math.floor(new Date().getTime()/1e3),jti:Dn()},s={protected:$n(JSON.stringify({typ:"dpop+jwt",alg:"ES256",jwk:r})),claims:$n(JSON.stringify(n))},u=os(`${s.protected}.${s.claims}`),p={name:Fn,hash:{name:"SHA-256"}},m=as(new Uint8Array(await e.sign(p,t,u)));return`${s.protected}.${s.claims}.${m}`}async function ns(){if(!Qe()){console.info("webcrypto is not supported");return}return await re(ar)||await is(),re(ar)}async function is(){let{subtle:r}=window.crypto,e=await r.generateKey(rs,!1,["sign"]),t=await r.exportKey("jwk",e.publicKey);await de(kn,e.privateKey),await de(ar,t)}function $n(r){return qn(ss(r))}function os(r){return new TextEncoder().encode(r)}function qn(r){return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}function ss(r){return encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(t,n)=>String.fromCharCode(parseInt(n,16)))}function as(r){let e="";return r.forEach(t=>{e+=String.fromCharCode(t)}),qn(e)}var cr="ds",lr="ek",ur="iv",dr="AES-GCM",cs=256;async function yt(){let r=[];await sr((e,t,n)=>{t.startsWith(`${cr}_`)&&r.push(t)});for(let e of r)await Ne(e)}function Bn(r){let e="",t=new Uint8Array(r),n=t.byteLength;for(let i=0;i<n;i++)e+=String.fromCharCode(t[i]);return window.btoa(e)}function Wn(r){let e=window.atob(r),t=e.length,n=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);return n.buffer}async function ls(){if(!Qe()){console.info("webcrypto is not supported");return}let{crypto:r}=window,e=await re(ur);return e||r.getRandomValues(new Uint8Array(12))}async function us(){if(!Qe()){console.info("webcrypto is not supported");return}let{subtle:r}=window.crypto,e=await re(lr);return e||await r.generateKey({name:dr,length:cs},!1,["encrypt","decrypt"])}async function Gn(r,e){let t=await ls(),n=await us();if(!t||!n||!r)return;let i=Wn(r),{subtle:s}=window.crypto,u=await s.encrypt({name:dr,iv:t},n,i),p=Bn(u);await de(`${cr}_${e}`,p),await de(lr,n),await de(ur,t)}async function Vn(r){let e=await re(`${cr}_${r}`),t=await re(ur),n=await re(lr);if(!t||!e||!n||!Qe())return;let{subtle:i}=window.crypto,s=await i.decrypt({name:dr,iv:t},n,Wn(e));return Bn(s)}function De(r,e){return e?new URL(r,e):new URL(r)}var Et=class extends Z{constructor(){super(...arguments);this.localForageIsLoggedInKey="magic_auth_is_logged_in";this.userLoggedOutCallbacks=[]}getIdToken(t){let n=$(this.sdk.testMode?"magic_auth_get_id_token_testing_mode":"magic_auth_get_id_token",[t]);return this.request(n)}generateIdToken(t){let n=$(this.sdk.testMode?"magic_auth_generate_id_token_testing_mode":"magic_auth_generate_id_token",[t]);return this.request(n)}getInfo(){let t=$("magic_get_info",[]);return this.request(t)}isLoggedIn(){return se(async(t,n)=>{try{let i=!1;this.sdk.useStorageCache&&(i=await re(this.localForageIsLoggedInKey)==="true",i&&t(!0));let s=$(this.sdk.testMode?"magic_auth_is_logged_in_testing_mode":"magic_is_logged_in"),u=await this.request(s);this.sdk.useStorageCache&&(u?de(this.localForageIsLoggedInKey,!0):Ne(this.localForageIsLoggedInKey),i&&!u&&this.emitUserLoggedOut(!0)),t(u)}catch(i){n(i)}})}logout(){return Ne(this.localForageIsLoggedInKey),yt(),se(async(t,n)=>{try{let i=$(this.sdk.testMode?"magic_auth_logout_testing_mode":"magic_auth_logout"),s=await this.request(i);this.sdk.useStorageCache&&this.emitUserLoggedOut(s),t(s)}catch(i){n(i)}})}requestInfoWithUI(t){let n=$("mc_request_user_info",t?[t]:[]);return this.request(n)}showSettings(t){let{showUI:n=!0}=t||{},i=$(this.sdk.testMode?"magic_auth_settings_testing_mode":"magic_auth_settings",[t]),s=this.request(i);return!n&&s&&(s.on("send-new-phone-number",u=>{this.createIntermediaryEvent("send-new-phone-number",i.id)(u)}),s.on("send-otp-code",u=>{this.createIntermediaryEvent("send-otp-code",i.id)(u)}),s.on("start-edit-phone-number",()=>{this.createIntermediaryEvent("start-edit-phone-number",i.id)()}),s.on("cancel",()=>{this.createIntermediaryEvent("cancel",i.id)()}),s.on("Recency/auth-factor-verify-email-otp",u=>{this.createIntermediaryEvent("Recency/auth-factor-verify-email-otp",i.id)(u)})),s}recoverAccount(t){let{email:n,showUI:i}=t,s=$(this.sdk.testMode?"magic_auth_recover_account_testing_mode":"magic_auth_recover_account",[{email:n,showUI:i}]),u=this.request(s);return!i&&u&&(u.on("cancel",()=>{this.createIntermediaryEvent("cancel",s.id)()}),u.on("resend-sms-otp",()=>{this.createIntermediaryEvent("resend-sms-otp",s.id)()}),u.on("verify-otp-code",p=>{this.createIntermediaryEvent("verify-otp-code",s.id)(p)}),u.on("update-email",p=>{this.createIntermediaryEvent("update-email",s.id)(p)}),u.on("UpdateEmail/new-email-verification-cancel",()=>{this.createIntermediaryEvent("UpdateEmail/new-email-verification-cancel",s.id)()}),u.on("UpdateEmail/retry-with-new-email",p=>{this.createIntermediaryEvent("UpdateEmail/retry-with-new-email",s.id)(p)}),u.on("UpdateEmail/new-email-verify-otp",p=>{this.createIntermediaryEvent("UpdateEmail/new-email-verify-otp",s.id)(p)})),u}revealPrivateKey(){let t=$("magic_reveal_key");return this.request(t)}onUserLoggedOut(t){this.userLoggedOutCallbacks.push(t)}enableMFA(t){let{showUI:n=!0}=t,i=$("magic_auth_enable_mfa_flow",[{showUI:n}]),s=this.request(i);return!n&&s&&(s.on("verify-mfa-code",u=>{this.createIntermediaryEvent("verify-mfa-code",i.id)(u)}),s.on("cancel-mfa-setup",()=>{this.createIntermediaryEvent("cancel-mfa-setup",i.id)()})),s}disableMFA(t){let{showUI:n=!0}=t,i=$("magic_auth_disable_mfa_flow",[{showUI:n}]),s=this.request(i);return!n&&s&&(s.on("verify-mfa-code",u=>{this.createIntermediaryEvent("verify-mfa-code",i.id)(u)}),s.on("lost-device",u=>{this.createIntermediaryEvent("lost-device",i.id)(u)}),s.on("cancel-mfa-disable",()=>{this.createIntermediaryEvent("cancel-mfa-disable",i.id)()})),s}emitUserLoggedOut(t){this.userLoggedOutCallbacks.forEach(n=>{n(t)})}};var Rt=class extends Z{connectWithUI(e){let t=se(async(n,i)=>{try{let s=$("mc_login",[{enabledWallets:this.sdk.thirdPartyWallets.enabledWallets,...e}]),u=this.request(s);this.sdk.thirdPartyWallets.eventListeners.forEach(({event:m,callback:A})=>{u.on(m,()=>A(s.id))}),u.on("id-token-created",m=>{t.emit("id-token-created",m)});let p=await u;p.error&&i(p),n(p)}catch(s){i(s)}});return t}showUI(e){return this.request($("magic_wallet",[e]))}showAddress(){return this.request($("magic_show_address"))}showSendTokensUI(){return this.request($("magic_show_send_tokens_ui"))}showOnRamp(){return this.request($("magic_show_fiat_onramp"))}showNFTs(){return this.request($("magic_show_nfts"))}showBalances(){return this.request($("magic_show_balances"))}sendGaslessTransaction(e,t){return this.request($("eth_sendGaslessTransaction",[e,t]))}};var bt=class extends Z{constructor(){super(...arguments);this.eventListeners=[];this.enabledWallets={};this.isConnected=!1}resetThirdPartyWalletState(){localStorage.removeItem("magic_3pw_provider"),localStorage.removeItem("magic_3pw_address"),localStorage.removeItem("magic_3pw_chainId"),this.isConnected=!1}requestOverride(t){if(t.method==="mc_login")return this.resetThirdPartyWalletState(),super.request(t);if(t.method==="magic_get_info")return this.getInfo(t);if(t.method==="magic_is_logged_in")return this.isLoggedIn(t);if(t.method==="magic_auth_logout")return this.logout(t);switch(localStorage.getItem("magic_3pw_provider")){case"web3modal":return this.web3modalRequest(t);default:return this.resetThirdPartyWalletState(),super.request(t)}}isLoggedIn(t){switch(localStorage.getItem("magic_3pw_provider")){case"web3modal":return this.web3modalIsLoggedIn();default:return this.resetThirdPartyWalletState(),super.request(t)}}getInfo(t){switch(localStorage.getItem("magic_3pw_provider")){case"web3modal":return this.web3modalGetInfo();default:return this.resetThirdPartyWalletState(),super.request(t)}}logout(t){let n=localStorage.getItem("magic_3pw_provider");switch(this.resetThirdPartyWalletState(),n){case"web3modal":return this.web3modalLogout();default:return super.request(t)}}web3modalRequest(t){return se((n,i)=>{this.sdk.web3modal.modal.getWalletProvider().request(t).then(n).catch(i)})}web3modalIsLoggedIn(){return se(t=>{let n=this.sdk.web3modal.modal.getStatus();if(n==="connected"&&t(!0),n==="disconnected"&&(this.resetThirdPartyWalletState(),t(!1)),n==="reconnecting"){let i=this.sdk.web3modal.modal.subscribeProvider(({status:s})=>{s==="connected"&&(i(),t(!0)),s==="disconnected"&&(i(),this.resetThirdPartyWalletState(),t(!1))})}})}formatWeb3modalGetInfoResponse(){let t=this.sdk.web3modal.modal.getWalletInfo()?.name,n=this.sdk.web3modal.modal.getAddress();return{publicAddress:n,email:null,issuer:`did:ethr:${n}`,phoneNumber:null,isMfaEnabled:!1,recoveryFactors:[],walletType:t||"web3modal"}}web3modalGetInfo(){return se((t,n)=>{let i=this.sdk.web3modal.modal.getStatus();if(i==="connected"&&t(this.formatWeb3modalGetInfoResponse()),i==="disconnected"&&(this.resetThirdPartyWalletState(),n("Magic RPC Error: [-32603] Internal error: User denied account access.")),i==="reconnecting"){let s=this.sdk.web3modal.modal.subscribeProvider(({status:u})=>{u==="connected"&&(s(),t(this.formatWeb3modalGetInfoResponse())),u==="disconnected"&&(s(),this.resetThirdPartyWalletState(),n("Magic RPC Error: [-32603] Internal error: User denied account access."))})}})}web3modalLogout(){return se(async t=>{try{await this.sdk.web3modal.modal.disconnect()}catch(n){console.error(n)}t(!0)})}};var{createBoundEmitterMethod:It,createChainingEmitterMethod:$e}=pt(),Tt=class extends Z{constructor(){super(...arguments);this.isMagic=!0;this.on=$e("on",this);this.once=$e("once",this);this.addListener=$e("addListener",this);this.off=$e("off",this);this.removeListener=$e("removeListener",this);this.removeAllListeners=$e("removeAllListeners",this);this.emit=It("emit");this.eventNames=It("eventNames");this.listeners=It("listeners");this.listenerCount=It("listenerCount")}sendAsync(t,n){if(!n)throw Tn({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:n===null?"null":typeof n});if(Array.isArray(t))this.overlay.post("MAGIC_HANDLE_REQUEST",t.map(i=>{let s=xe(i);return this.prefixPayloadMethodForTestMode(s),s})).then(i=>{n(null,i.map(s=>({...s.payload,error:s.hasError?new Ee(s.payload.error):null})))});else{let i=xe(t);this.prefixPayloadMethodForTestMode(i),this.overlay.post("MAGIC_HANDLE_REQUEST",i).then(s=>{n(s.hasError?new Ee(s.payload.error):null,s.payload)})}}send(t,n){if(typeof t=="string"){let s=$(t,Array.isArray(n)?n:[]);return this.request(s)}if(Array.isArray(t)||n){this.sendAsync(t,n);return}let i=Sn();return i.log(),new Me(t).applyError({code:-32603,message:i.rawMessage}).payload}enable(){let t=$("mc_login");return this.request(t)}request(t){return this.prefixPayloadMethodForTestMode(t),super.request(t)}prefixPayloadMethodForTestMode(t){let n="testMode/eth/";this.sdk.testMode&&(t.method=`${n}${t.method}`)}};var Jn=["request","overlay","sdk"];function ds(r){let e=Object.getPrototypeOf(r),t=[e];for(;e!==Z.prototype;)e=Object.getPrototypeOf(e),t.push(e);return t}var fr=class extends Z{constructor(){super(void 0);this.v=new Map;this.y=!1;this.utils={createPromiEvent:se,isPromiEvent:mt,encodeJSON:at,decodeJSON:jr,createJsonRpcRequestPayload:$,standardizeJsonRpcRequestPayload:xe,storage:gt};let t=[this,...ds(this)];Jn.forEach(n=>{let i=t.map(m=>Object.getOwnPropertyDescriptor(m,n)),s=i.findIndex(m=>!!m),u=s>0,p=i[s];p&&(this.v.set(n,{descriptor:p,isPrototypeField:u}),Object.defineProperty(this,n,{configurable:!0,get:()=>{throw bn(n)}}))})}init(t){this.y||(Jn.forEach(n=>{if(this.v.has(n)){let{descriptor:i,isPrototypeField:s}=this.v.get(n);s?delete this[n]:Object.defineProperty(this,n,i)}}),this.sdk=t,this.y=!0)}createDeprecationWarning(t){let{method:n,removalVersion:i,useInstead:s}=t,u=s?` Use \`${s}\` instead.`:"",p=`\`${n}\` will be removed from this Extension in version \`${i}\`.${u}`;return new Ae(this,"DEPRECATION_NOTICE",p)}createWarning(t,n){return new Ae(this,t,n)}createError(t,n,i){return new Le(this,t,n,i)}},Te=class extends fr{};var wt=class extends Z{purchase(e){let t=$("magic_nft_purchase",[e]);return this.request(t)}checkout(e){let t=this.sdk.thirdPartyWallets.isConnected,n=$("magic_nft_checkout",[{...e,walletProvider:t?"web3modal":"magic"}]),i=this.request(n);return t&&(i.on("nft-checkout-initiated",async s=>{try{let u=await this.request({method:"eth_sendTransaction",params:[s]});this.createIntermediaryEvent("nft-checkout-success",n.id)(u)}catch{this.createIntermediaryEvent("nft-checkout-failure",n.id)()}}),i.on("disconnect",()=>{this.sdk.thirdPartyWallets.resetThirdPartyWalletState(),i.emit("disconnect")})),i}transfer(e){let t=$("magic_nft_transfer",[e]);return this.request(t)}};function Hn(r){return r.compat&&r.compat[B.sdkName]!=null?typeof r.compat[B.sdkName]=="string"?Hr(Kr(B.version),r.compat[B.sdkName]):!!r.compat[B.sdkName]:!0}function fs(r,e,t){return!e&&!t?`${r}_eth_mainnet`:t?`${r}_${JSON.stringify(t)}`:e?typeof e=="string"?`${r}_eth_${e}`:`${r}_${e.rpcUrl}_${e.chainId}_${e.chainType}`:`${r}_unknown`}function ps(r){let e=r?.extensions??[],t={},n=[];if(Array.isArray(e)?e.forEach(i=>{Hn(i)?(i.init(this),i.name&&(this[i.name]=i),i instanceof Te&&(Xe(i.config)||(t[i.name]=i.config))):n.push(i)}):Object.keys(e).forEach(i=>{if(Hn(e[i])){e[i].init(this);let s=e[i];this[i]=s,s instanceof Te&&(Xe(s.config)||(t[e[i].name]=s.config))}else n.push(e[i])}),n.length)throw In(n);return t}var pr=new Map,Ze=class{constructor(e,t){this.apiKey=e;if(!e)throw En();B.platform==="react-native"&&t?.endpoint&&An().log();let{defaultEndpoint:n,version:i}=B;this.testMode=!!t?.testMode,this.useStorageCache=!!t?.useStorageCache,this.endpoint=De(t?.endpoint??n).origin,this.auth=new ht(this),this.user=new Et(this),this.wallet=new Rt(this),this.nft=new wt(this),this.thirdPartyWallets=new bt(this),this.rpcProvider=new Tt(this);let s=ps.call(this,t);this.parameters=at({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:t?.network,host:De(this.endpoint).host,sdk:yn[B.sdkName],version:i,ext:Xe(s)?void 0:s,locale:t?.locale||"en_US",...B.bundleId?{bundleId:B.bundleId}:{},meta:t?.meta}),this.networkHash=fs(this.apiKey,t?.network,Xe(s)?void 0:s),t?.deferPreload||this.preload()}get overlay(){if(!pr.has(this.parameters)){let e=new B.ViewController(this.endpoint,this.parameters,this.networkHash);e.init(),pr.set(this.parameters,e)}return pr.get(this.parameters)}async preload(){await this.overlay.waitForReady()}};function ms(r,e){return e&&Array.isArray(r)?r.find(t=>t.id===e):r}function Kn(r,e){let t=e.data.response?.id,n=ms(r,t);if(t&&n){let i=new Me(n).applyResult(e.data.response.result).applyError(e.data.response.error);return{id:t,response:i}}return{}}async function jn(r,e,t){let n=await re("rt"),i;if(B.platform==="web")try{i=await re("jwt")??await Un()}catch(p){console.error("webcrypto error",p)}let s={msgType:r,payload:e};i&&(s.jwt=i),i&&n&&(s.rt=n);let u=await Vn(t);return u&&(s.deviceShare=u),s}async function Yn(r){r.data.rt&&await de("rt",r.data.rt)}function Xn(r,e){let t=null;return function(...n){t&&clearTimeout(t),t=setTimeout(()=>{r(...n)},e)}}var hs=1e3,Qn=60*hs,zn=5*Qn,vs=60*Qn,et=class{constructor(e,t,n){this.endpoint=e;this.parameters=t;this.networkHash=n;this.isReadyForRequest=!1;this.messageHandlers=new Set;this.isConnectedToInternet=!0;this.lastPongTime=null;this.heartbeatIntervalTimer=null;this.heartbeatDebounce=Xn(()=>{this.endpoint==="https://auth.magic.link/"&&this.heartBeatCheck()},vs);this.listen()}async post(e,t){return or(async(n,i)=>{if(!this.isConnectedToInternet){let b=dt();i(b)}await this.checkRelayerExistsInDOM()||(this.isReadyForRequest=!1,await this.reloadRelayer()),this.isReadyForRequest||await this.waitForReady();let s=[],u=Array.isArray(t)?t.map(b=>b.id):[],p=await jn(`${e}-${this.parameters}`,t,this.networkHash);await this.E(p);let m=b=>P=>{let{id:I,response:N}=Kn(t,P);if(Yn(P),N?.payload.error?.message==="User denied account access.")yt();else if(P.data.deviceShare){let{deviceShare:F}=P.data;Gn(F,this.networkHash)}I&&N&&Array.isArray(t)&&u.includes(I)?(s.push(N),s.length===t.length&&(b(),n(s))):I&&N&&!Array.isArray(t)&&I===t.id&&(b(),n(N))},A=this.on("MAGIC_HANDLE_RESPONSE",m(()=>A()))})}on(e,t){let n=t.bind(window),i=s=>{s.data.msgType===`${e}-${this.parameters}`&&n(s)};return this.messageHandlers.add(i),()=>this.messageHandlers.delete(i)}waitForReady(){return new Promise(e=>{let t=this.on("MAGIC_OVERLAY_READY",()=>{this.isReadyForRequest=!0,e(),t()})})}listen(){this.on("MAGIC_HIDE_OVERLAY",()=>{this.hideOverlay()}),this.on("MAGIC_SHOW_OVERLAY",()=>{this.showOverlay()}),this.on("MAGIC_SEND_PRODUCT_ANNOUNCEMENT",e=>{e.data.response.result.product_announcement&&new ge("ANNOUNCEMENT",e.data.response.result.product_announcement).log()})}heartBeatCheck(){let e=!0,t=async()=>{let n={msgType:`MAGIC_PING-${this.parameters}`,payload:[]};await this.E(n)};this.heartbeatIntervalTimer=setInterval(async()=>{if(this.lastPongTime){if(Date.now()-this.lastPongTime>zn*2){this.reloadRelayer(),e=!0;return}}else if(!e){this.reloadRelayer(),e=!0;return}await t(),e=!1},zn)}stopHeartBeat(){this.heartbeatDebounce(),this.lastPongTime=null,this.heartbeatIntervalTimer&&(clearInterval(this.heartbeatIntervalTimer),this.heartbeatIntervalTimer=null)}};var mr={};Ft(mr,{AuthEventOnReceived:()=>on,DeepLinkPage:()=>Xr,DeviceVerificationEventEmit:()=>Kt,DeviceVerificationEventOnReceived:()=>tn,DisableMFAEventEmit:()=>Yt,DisableMFAEventOnReceived:()=>cn,EnableMFAEventEmit:()=>jt,EnableMFAEventOnReceived:()=>an,EthChainType:()=>ln,ExtensionError:()=>Le,ExtensionWarning:()=>Ae,FarcasterLoginEventEmit:()=>sn,LocalStorageKeys:()=>Gt,LoginWithEmailOTPEventEmit:()=>Jt,LoginWithEmailOTPEventOnReceived:()=>en,LoginWithMagicLinkEventEmit:()=>zr,LoginWithMagicLinkEventOnReceived:()=>Qr,LoginWithSmsOTPEventEmit:()=>Ht,LoginWithSmsOTPEventOnReceived:()=>Zr,MagicExtension:()=>Te,MagicIncomingWindowMessage:()=>Ke,MagicOutgoingWindowMessage:()=>je,MagicPayloadMethod:()=>he,NftCheckoutIntermediaryEvents:()=>er,RPCError:()=>Ee,RPCErrorCode:()=>He,RecencyCheckEventEmit:()=>lt,RecencyCheckEventOnReceived:()=>rn,RecoverAccountEventEmit:()=>Zt,RecoverAccountEventOnReceived:()=>fn,RecoveryFactorEventEmit:()=>Qt,RecoveryFactorEventOnReceived:()=>un,RecoveryMethodType:()=>dn,SDKError:()=>ve,SDKErrorCode:()=>Wt,SDKWarning:()=>ge,SDKWarningCode:()=>ct,ThirdPartyWalletEvents:()=>Yr,UiEventsEmit:()=>mn,UpdateEmailEventEmit:()=>ut,UpdateEmailEventOnReceived:()=>nn,UserEventsEmit:()=>Xt,UserEventsOnReceived:()=>zt,WalletEventOnReceived:()=>pn,isPromiEvent:()=>mt,routeToMagicMethods:()=>Vt});var xt=Ut(ei()),ni=Ut(ri());var gs={display:"block",visibility:"hidden",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",opacity:"0",zIndex:"-1"};function ys(r){for(let[e,t]of Object.entries(gs))r.style[e]=t}function Es(r){return!![].slice.call(document.querySelectorAll(".magic-iframe")).find(t=>t.src.includes(r))}var At=class extends et{constructor(){super(...arguments);this.activeElement=null;this.relayerSrc=De(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href}init(){this.test="hello",this.iframe=new Promise(t=>{let n=()=>{if(Es(encodeURIComponent(this.parameters)))wn().log();else{let i=document.createElement("iframe");i.classList.add("magic-iframe"),i.dataset.magicIframeLabel=De(this.endpoint).host,i.title="Secure Modal",i.src=this.relayerSrc,i.allow="clipboard-read; clipboard-write",ys(i),document.body.appendChild(i),t(i)}};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)}),this.iframe.then(t=>{t instanceof HTMLIFrameElement&&t.addEventListener("load",async()=>{this.heartbeatDebounce()})}),window.addEventListener("message",t=>{if(t.origin===this.endpoint&&t.data.msgType&&(t.data.msgType.includes("MAGIC_PONG")&&(this.lastPongTime=Date.now()),t.data&&this.messageHandlers.size)){t.data.response=t.data.response??{},this.stopHeartBeat();for(let n of this.messageHandlers.values())n(t)}}),window.addEventListener("beforeunload",()=>{this.stopHeartBeat()})}async showOverlay(){let t=await this.iframe;t.style.visibility="visible",t.style.zIndex="2147483647",t.style.opacity="1",this.activeElement=document.activeElement,t.focus()}async hideOverlay(){let t=await this.iframe;t.style.visibility="hidden",t.style.zIndex="-1",t.style.opacity="0",this.activeElement?.focus&&this.activeElement.focus(),this.activeElement=null}async E(t){let n=await this.iframe;if(n&&n.contentWindow)n.contentWindow.postMessage(t,this.endpoint);else throw dt()}async checkRelayerExistsInDOM(){let t=await this.iframe;return!t||!t.contentWindow?!1:!![].slice.call(document.querySelectorAll(".magic-iframe")).find(i=>i.src.includes(encodeURIComponent(this.parameters)))}async reloadRelayer(){let t=await this.iframe;if(this.stopHeartBeat(),!t){this.init(),console.warn("Magic SDK: Modal lost, re-initiating");return}if(!t.contentWindow){document.body.appendChild(t),console.warn("Magic SDK: Modal did not append in the iframe, re-initiating");return}t&&(t.src=this.relayerSrc)}};var Rs=Object.assign(tr(Ze,{platform:"web",sdkName:"magic-sdk",version:"29.0.5",defaultEndpoint:"https://auth.magic.link/",ViewController:At,configureStorage:async()=>{let r=xt.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return await r.defineDriver(ni),await r.setDriver([xt.default.INDEXEDDB,xt.default.LOCALSTORAGE,ni.n]),r}}),{...mr}),bs=Rs;return ro(Is);})();
1
+ "use strict";var Magic=(()=>{var Ii=Object.create;var tt=Object.defineProperty;var wi=Object.getOwnPropertyDescriptor;var Ri=Object.getOwnPropertyNames;var Ai=Object.getPrototypeOf,Si=Object.prototype.hasOwnProperty;var He=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var fr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),dr=(e,t)=>{for(var r in t)tt(e,r,{get:t[r],enumerable:!0})},hr=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ri(t))!Si.call(e,a)&&a!==r&&tt(e,a,{get:()=>t[a],enumerable:!(i=wi(t,a))||i.enumerable});return e};var mr=(e,t,r)=>(r=e!=null?Ii(Ai(e)):{},hr(t||!e||!e.__esModule?tt(r,"default",{value:e,enumerable:!0}):r,e)),bi=e=>hr(tt({},"__esModule",{value:!0}),e);var Rn=fr((wn,Ht)=>{"use strict";(function(e){if(typeof wn=="object"&&typeof Ht<"u")Ht.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return function i(a,s,p){function h(E,O){if(!s[E]){if(!a[E]){var g=typeof He=="function"&&He;if(!O&&g)return g(E,!0);if(R)return R(E,!0);var N=new Error("Cannot find module '"+E+"'");throw N.code="MODULE_NOT_FOUND",N}var $=s[E]={exports:{}};a[E][0].call($.exports,function(F){var L=a[E][1][F];return h(L||F)},$,$.exports,i,a,s,p)}return s[E].exports}for(var R=typeof He=="function"&&He,v=0;v<p.length;v++)h(p[v]);return h}({1:[function(i,a,s){(function(p){"use strict";var h=p.MutationObserver||p.WebKitMutationObserver,R;if(h){var v=0,E=new h(F),O=p.document.createTextNode("");E.observe(O,{characterData:!0}),R=function(){O.data=v=++v%2}}else if(!p.setImmediate&&typeof p.MessageChannel<"u"){var g=new p.MessageChannel;g.port1.onmessage=F,R=function(){g.port2.postMessage(0)}}else"document"in p&&"onreadystatechange"in p.document.createElement("script")?R=function(){var W=p.document.createElement("script");W.onreadystatechange=function(){F(),W.onreadystatechange=null,W.parentNode.removeChild(W),W=null},p.document.documentElement.appendChild(W)}:R=function(){setTimeout(F,0)};var N,$=[];function F(){N=!0;for(var W,J,D=$.length;D;){for(J=$,$=[],W=-1;++W<D;)J[W]();D=$.length}N=!1}a.exports=L;function L(W){$.push(W)===1&&!N&&R()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(i,a,s){"use strict";var p=i(1);function h(){}var R={},v=["REJECTED"],E=["FULFILLED"],O=["PENDING"];a.exports=g;function g(_){if(typeof _!="function")throw new TypeError("resolver must be a function");this.state=O,this.queue=[],this.outcome=void 0,_!==h&&L(this,_)}g.prototype.catch=function(_){return this.then(null,_)},g.prototype.then=function(_,B){if(typeof _!="function"&&this.state===E||typeof B!="function"&&this.state===v)return this;var x=new this.constructor(h);if(this.state!==O){var H=this.state===E?_:B;$(x,H,this.outcome)}else this.queue.push(new N(x,_,B));return x};function N(_,B,x){this.promise=_,typeof B=="function"&&(this.onFulfilled=B,this.callFulfilled=this.otherCallFulfilled),typeof x=="function"&&(this.onRejected=x,this.callRejected=this.otherCallRejected)}N.prototype.callFulfilled=function(_){R.resolve(this.promise,_)},N.prototype.otherCallFulfilled=function(_){$(this.promise,this.onFulfilled,_)},N.prototype.callRejected=function(_){R.reject(this.promise,_)},N.prototype.otherCallRejected=function(_){$(this.promise,this.onRejected,_)};function $(_,B,x){p(function(){var H;try{H=B(x)}catch(Q){return R.reject(_,Q)}H===_?R.reject(_,new TypeError("Cannot resolve promise with itself")):R.resolve(_,H)})}R.resolve=function(_,B){var x=W(F,B);if(x.status==="error")return R.reject(_,x.value);var H=x.value;if(H)L(_,H);else{_.state=E,_.outcome=B;for(var Q=-1,ie=_.queue.length;++Q<ie;)_.queue[Q].callFulfilled(B)}return _},R.reject=function(_,B){_.state=v,_.outcome=B;for(var x=-1,H=_.queue.length;++x<H;)_.queue[x].callRejected(B);return _};function F(_){var B=_&&_.then;if(_&&(typeof _=="object"||typeof _=="function")&&typeof B=="function")return function(){B.apply(_,arguments)}}function L(_,B){var x=!1;function H(se){x||(x=!0,R.reject(_,se))}function Q(se){x||(x=!0,R.resolve(_,se))}function ie(){B(Q,H)}var oe=W(ie);oe.status==="error"&&H(oe.value)}function W(_,B){var x={};try{x.value=_(B),x.status="success"}catch(H){x.status="error",x.value=H}return x}g.resolve=J;function J(_){return _ instanceof this?_:R.resolve(new this(h),_)}g.reject=D;function D(_){var B=new this(h);return R.reject(B,_)}g.all=Ae;function Ae(_){var B=this;if(Object.prototype.toString.call(_)!=="[object Array]")return this.reject(new TypeError("must be an array"));var x=_.length,H=!1;if(!x)return this.resolve([]);for(var Q=new Array(x),ie=0,oe=-1,se=new this(h);++oe<x;)he(_[oe],oe);return se;function he(Le,d){B.resolve(Le).then(I,function(b){H||(H=!0,R.reject(se,b))});function I(b){Q[d]=b,++ie===x&&!H&&(H=!0,R.resolve(se,Q))}}}g.race=ne;function ne(_){var B=this;if(Object.prototype.toString.call(_)!=="[object Array]")return this.reject(new TypeError("must be an array"));var x=_.length,H=!1;if(!x)return this.resolve([]);for(var Q=-1,ie=new this(h);++Q<x;)oe(_[Q]);return ie;function oe(se){B.resolve(se).then(function(he){H||(H=!0,R.resolve(ie,he))},function(he){H||(H=!0,R.reject(ie,he))})}}},{1:1}],3:[function(i,a,s){(function(p){"use strict";typeof p.Promise!="function"&&(p.Promise=i(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(i,a,s){"use strict";var p=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function h(n,c){if(!(n instanceof c))throw new TypeError("Cannot call a class as a function")}function R(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var v=R();function E(){try{if(!v||!v.open)return!1;var n=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),c=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!n||c)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function O(n,c){n=n||[],c=c||{};try{return new Blob(n,c)}catch(l){if(l.name!=="TypeError")throw l;for(var o=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,u=new o,f=0;f<n.length;f+=1)u.append(n[f]);return u.getBlob(c.type)}}typeof Promise>"u"&&i(3);var g=Promise;function N(n,c){c&&n.then(function(o){c(null,o)},function(o){c(o)})}function $(n,c,o){typeof c=="function"&&n.then(c),typeof o=="function"&&n.catch(o)}function F(n){return typeof n!="string"&&(console.warn(n+" used as a key, but it is not a string."),n=String(n)),n}function L(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var W="local-forage-detect-blob-support",J=void 0,D={},Ae=Object.prototype.toString,ne="readonly",_="readwrite";function B(n){for(var c=n.length,o=new ArrayBuffer(c),u=new Uint8Array(o),f=0;f<c;f++)u[f]=n.charCodeAt(f);return o}function x(n){return new g(function(c){var o=n.transaction(W,_),u=O([""]);o.objectStore(W).put(u,"key"),o.onabort=function(f){f.preventDefault(),f.stopPropagation(),c(!1)},o.oncomplete=function(){var f=navigator.userAgent.match(/Chrome\/(\d+)/),l=navigator.userAgent.match(/Edge\//);c(l||!f||parseInt(f[1],10)>=43)}}).catch(function(){return!1})}function H(n){return typeof J=="boolean"?g.resolve(J):x(n).then(function(c){return J=c,J})}function Q(n){var c=D[n.name],o={};o.promise=new g(function(u,f){o.resolve=u,o.reject=f}),c.deferredOperations.push(o),c.dbReady?c.dbReady=c.dbReady.then(function(){return o.promise}):c.dbReady=o.promise}function ie(n){var c=D[n.name],o=c.deferredOperations.pop();if(o)return o.resolve(),o.promise}function oe(n,c){var o=D[n.name],u=o.deferredOperations.pop();if(u)return u.reject(c),u.promise}function se(n,c){return new g(function(o,u){if(D[n.name]=D[n.name]||Z(),n.db)if(c)Q(n),n.db.close();else return o(n.db);var f=[n.name];c&&f.push(n.version);var l=v.open.apply(v,f);c&&(l.onupgradeneeded=function(m){var y=l.result;try{y.createObjectStore(n.storeName),m.oldVersion<=1&&y.createObjectStore(W)}catch(w){if(w.name==="ConstraintError")console.warn('The database "'+n.name+'" has been upgraded from version '+m.oldVersion+" to version "+m.newVersion+', but the storage "'+n.storeName+'" already exists.');else throw w}}),l.onerror=function(m){m.preventDefault(),u(l.error)},l.onsuccess=function(){var m=l.result;m.onversionchange=function(y){y.target.close()},o(m),ie(n)}})}function he(n){return se(n,!1)}function Le(n){return se(n,!0)}function d(n,c){if(!n.db)return!0;var o=!n.db.objectStoreNames.contains(n.storeName),u=n.version<n.db.version,f=n.version>n.db.version;if(u&&(n.version!==c&&console.warn('The database "'+n.name+`" can't be downgraded from version `+n.db.version+" to version "+n.version+"."),n.version=n.db.version),f||o){if(o){var l=n.db.version+1;l>n.version&&(n.version=l)}return!0}return!1}function I(n){return new g(function(c,o){var u=new FileReader;u.onerror=o,u.onloadend=function(f){var l=btoa(f.target.result||"");c({R:!0,data:l,type:n.type})},u.readAsBinaryString(n)})}function b(n){var c=B(atob(n.data));return O([c],{type:n.type})}function C(n){return n&&n.R}function P(n){var c=this,o=c.g().then(function(){var u=D[c.u.name];if(u&&u.dbReady)return u.dbReady});return $(o,n,n),o}function U(n){Q(n);for(var c=D[n.name],o=c.forages,u=0;u<o.length;u++){var f=o[u];f.u.db&&(f.u.db.close(),f.u.db=null)}return n.db=null,he(n).then(function(l){return n.db=l,d(n)?Le(n):l}).then(function(l){n.db=c.db=l;for(var m=0;m<o.length;m++)o[m].u.db=l}).catch(function(l){throw oe(n,l),l})}function V(n,c,o,u){u===void 0&&(u=1);try{var f=n.db.transaction(n.storeName,c);o(null,f)}catch(l){if(u>0&&(!n.db||l.name==="InvalidStateError"||l.name==="NotFoundError"))return g.resolve().then(function(){if(!n.db||l.name==="NotFoundError"&&!n.db.objectStoreNames.contains(n.storeName)&&n.version<=n.db.version)return n.db&&(n.version=n.db.version+1),Le(n)}).then(function(){return U(n).then(function(){V(n,c,o,u-1)})}).catch(o);o(l)}}function Z(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function xe(n){var c=this,o={db:null};if(n)for(var u in n)o[u]=n[u];var f=D[o.name];f||(f=Z(),D[o.name]=f),f.forages.push(c),c.g||(c.g=c.ready,c.ready=P);var l=[];function m(){return g.resolve()}for(var y=0;y<f.forages.length;y++){var w=f.forages[y];w!==c&&l.push(w.g().catch(m))}var A=f.forages.slice(0);return g.all(l).then(function(){return o.db=f.db,he(o)}).then(function(S){return o.db=S,d(o,c.E.version)?Le(o):S}).then(function(S){o.db=f.db=S,c.u=o;for(var T=0;T<A.length;T++){var k=A[T];k!==c&&(k.u.db=o.db,k.u.version=o.version)}})}function Ce(n,c){var o=this;n=F(n);var u=new g(function(f,l){o.ready().then(function(){V(o.u,ne,function(m,y){if(m)return l(m);try{var w=y.objectStore(o.u.storeName),A=w.get(n);A.onsuccess=function(){var S=A.result;S===void 0&&(S=null),C(S)&&(S=b(S)),f(S)},A.onerror=function(){l(A.error)}}catch(S){l(S)}})}).catch(l)});return N(u,c),u}function Ge(n,c){var o=this,u=new g(function(f,l){o.ready().then(function(){V(o.u,ne,function(m,y){if(m)return l(m);try{var w=y.objectStore(o.u.storeName),A=w.openCursor(),S=1;A.onsuccess=function(){var T=A.result;if(T){var k=T.value;C(k)&&(k=b(k));var j=n(k,T.key,S++);j!==void 0?f(j):T.continue()}else f()},A.onerror=function(){l(A.error)}}catch(T){l(T)}})}).catch(l)});return N(u,c),u}function _n(n,c,o){var u=this;n=F(n);var f=new g(function(l,m){var y;u.ready().then(function(){return y=u.u,Ae.call(c)==="[object Blob]"?H(y.db).then(function(w){return w?c:I(c)}):c}).then(function(w){V(u.u,_,function(A,S){if(A)return m(A);try{var T=S.objectStore(u.u.storeName);w===null&&(w=void 0);var k=T.put(w,n);S.oncomplete=function(){w===void 0&&(w=null),l(w)},S.onabort=S.onerror=function(){var j=k.error?k.error:k.transaction.error;m(j)}}catch(j){m(j)}})}).catch(m)});return N(f,o),f}function On(n,c){var o=this;n=F(n);var u=new g(function(f,l){o.ready().then(function(){V(o.u,_,function(m,y){if(m)return l(m);try{var w=y.objectStore(o.u.storeName),A=w.delete(n);y.oncomplete=function(){f()},y.onerror=function(){l(A.error)},y.onabort=function(){var S=A.error?A.error:A.transaction.error;l(S)}}catch(S){l(S)}})}).catch(l)});return N(u,c),u}function Nn(n){var c=this,o=new g(function(u,f){c.ready().then(function(){V(c.u,_,function(l,m){if(l)return f(l);try{var y=m.objectStore(c.u.storeName),w=y.clear();m.oncomplete=function(){u()},m.onabort=m.onerror=function(){var A=w.error?w.error:w.transaction.error;f(A)}}catch(A){f(A)}})}).catch(f)});return N(o,n),o}function Tn(n){var c=this,o=new g(function(u,f){c.ready().then(function(){V(c.u,ne,function(l,m){if(l)return f(l);try{var y=m.objectStore(c.u.storeName),w=y.count();w.onsuccess=function(){u(w.result)},w.onerror=function(){f(w.error)}}catch(A){f(A)}})}).catch(f)});return N(o,n),o}function Mn(n,c){var o=this,u=new g(function(f,l){if(n<0){f(null);return}o.ready().then(function(){V(o.u,ne,function(m,y){if(m)return l(m);try{var w=y.objectStore(o.u.storeName),A=!1,S=w.openKeyCursor();S.onsuccess=function(){var T=S.result;if(!T){f(null);return}n===0||A?f(T.key):(A=!0,T.advance(n))},S.onerror=function(){l(S.error)}}catch(T){l(T)}})}).catch(l)});return N(u,c),u}function Ln(n){var c=this,o=new g(function(u,f){c.ready().then(function(){V(c.u,ne,function(l,m){if(l)return f(l);try{var y=m.objectStore(c.u.storeName),w=y.openKeyCursor(),A=[];w.onsuccess=function(){var S=w.result;if(!S){u(A);return}A.push(S.key),S.continue()},w.onerror=function(){f(w.error)}}catch(S){f(S)}})}).catch(f)});return N(o,n),o}function Cn(n,c){c=L.apply(this,arguments);var o=this.config();n=typeof n!="function"&&n||{},n.name||(n.name=n.name||o.name,n.storeName=n.storeName||o.storeName);var u=this,f;if(!n.name)f=g.reject("Invalid arguments");else{var l=n.name===o.name&&u.u.db,m=l?g.resolve(u.u.db):he(n).then(function(y){var w=D[n.name],A=w.forages;w.db=y;for(var S=0;S<A.length;S++)A[S].u.db=y;return y});n.storeName?f=m.then(function(y){if(y.objectStoreNames.contains(n.storeName)){var w=y.version+1;Q(n);var A=D[n.name],S=A.forages;y.close();for(var T=0;T<S.length;T++){var k=S[T];k.u.db=null,k.u.version=w}var j=new g(function(q,z){var X=v.open(n.name,w);X.onerror=function(ue){var je=X.result;je.close(),z(ue)},X.onupgradeneeded=function(){var ue=X.result;ue.deleteObjectStore(n.storeName)},X.onsuccess=function(){var ue=X.result;ue.close(),q(ue)}});return j.then(function(q){A.db=q;for(var z=0;z<S.length;z++){var X=S[z];X.u.db=q,ie(X.u)}}).catch(function(q){throw(oe(n,q)||g.resolve()).catch(function(){}),q})}}):f=m.then(function(y){Q(n);var w=D[n.name],A=w.forages;y.close();for(var S=0;S<A.length;S++){var T=A[S];T.u.db=null}var k=new g(function(j,q){var z=v.deleteDatabase(n.name);z.onerror=function(){var X=z.result;X&&X.close(),q(z.error)},z.onblocked=function(){console.warn('dropInstance blocked for database "'+n.name+'" until all open connections are closed')},z.onsuccess=function(){var X=z.result;X&&X.close(),j(X)}});return k.then(function(j){w.db=j;for(var q=0;q<A.length;q++){var z=A[q];ie(z.u)}}).catch(function(j){throw(oe(n,j)||g.resolve()).catch(function(){}),j})})}return N(f,c),f}var Pn={f:"asyncStorage",y:xe,p:E(),iterate:Ge,getItem:Ce,setItem:_n,removeItem:On,clear:Nn,length:Tn,key:Mn,keys:Ln,dropInstance:Cn};function $n(){return typeof openDatabase=="function"}var Se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Dn="~~local_forage_type~",qt=/^~~local_forage_type~([^~]+)~/,Ze="__lfsc__:",It=Ze.length,wt="arbf",Rt="blob",Kt="si08",Yt="ui08",Xt="uic8",zt="si16",Jt="si32",Qt="ur16",Zt="ui32",er="fl32",tr="fl64",rr=It+wt.length,nr=Object.prototype.toString;function ir(n){var c=n.length*.75,o=n.length,u,f=0,l,m,y,w;n[n.length-1]==="="&&(c--,n[n.length-2]==="="&&c--);var A=new ArrayBuffer(c),S=new Uint8Array(A);for(u=0;u<o;u+=4)l=Se.indexOf(n[u]),m=Se.indexOf(n[u+1]),y=Se.indexOf(n[u+2]),w=Se.indexOf(n[u+3]),S[f++]=l<<2|m>>4,S[f++]=(m&15)<<4|y>>2,S[f++]=(y&3)<<6|w&63;return A}function At(n){var c=new Uint8Array(n),o="",u;for(u=0;u<c.length;u+=3)o+=Se[c[u]>>2],o+=Se[(c[u]&3)<<4|c[u+1]>>4],o+=Se[(c[u+1]&15)<<2|c[u+2]>>6],o+=Se[c[u+2]&63];return c.length%3===2?o=o.substring(0,o.length-1)+"=":c.length%3===1&&(o=o.substring(0,o.length-2)+"=="),o}function Un(n,c){var o="";if(n&&(o=nr.call(n)),n&&(o==="[object ArrayBuffer]"||n.buffer&&nr.call(n.buffer)==="[object ArrayBuffer]")){var u,f=Ze;n instanceof ArrayBuffer?(u=n,f+=wt):(u=n.buffer,o==="[object Int8Array]"?f+=Kt:o==="[object Uint8Array]"?f+=Yt:o==="[object Uint8ClampedArray]"?f+=Xt:o==="[object Int16Array]"?f+=zt:o==="[object Uint16Array]"?f+=Qt:o==="[object Int32Array]"?f+=Jt:o==="[object Uint32Array]"?f+=Zt:o==="[object Float32Array]"?f+=er:o==="[object Float64Array]"?f+=tr:c(new Error("Failed to get type for BinaryArray"))),c(f+At(u))}else if(o==="[object Blob]"){var l=new FileReader;l.onload=function(){var m=Dn+n.type+"~"+At(this.result);c(Ze+Rt+m)},l.readAsArrayBuffer(n)}else try{c(JSON.stringify(n))}catch(m){console.error("Couldn't convert value into a JSON string: ",n),c(null,m)}}function xn(n){if(n.substring(0,It)!==Ze)return JSON.parse(n);var c=n.substring(rr),o=n.substring(It,rr),u;if(o===Rt&&qt.test(c)){var f=c.match(qt);u=f[1],c=c.substring(f[0].length)}var l=ir(c);switch(o){case wt:return l;case Rt:return O([l],{type:u});case Kt:return new Int8Array(l);case Yt:return new Uint8Array(l);case Xt:return new Uint8ClampedArray(l);case zt:return new Int16Array(l);case Qt:return new Uint16Array(l);case Jt:return new Int32Array(l);case Zt:return new Uint32Array(l);case er:return new Float32Array(l);case tr:return new Float64Array(l);default:throw new Error("Unkown type: "+o)}}var St={serialize:Un,deserialize:xn,stringToBuffer:ir,bufferToString:At};function ar(n,c,o,u){n.executeSql("CREATE TABLE IF NOT EXISTS "+c.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],o,u)}function Fn(n){var c=this,o={db:null};if(n)for(var u in n)o[u]=typeof n[u]!="string"?n[u].toString():n[u];var f=new g(function(l,m){try{o.db=openDatabase(o.name,String(o.version),o.description,o.size)}catch(y){return m(y)}o.db.transaction(function(y){ar(y,o,function(){c.u=o,l()},function(w,A){m(A)})},m)});return o.serializer=St,f}function be(n,c,o,u,f,l){n.executeSql(o,u,f,function(m,y){y.code===y.SYNTAX_ERR?m.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[c.storeName],function(w,A){A.rows.length?l(w,y):ar(w,c,function(){w.executeSql(o,u,f,l)},l)},l):l(m,y)},l)}function kn(n,c){var o=this;n=F(n);var u=new g(function(f,l){o.ready().then(function(){var m=o.u;m.db.transaction(function(y){be(y,m,"SELECT * FROM "+m.storeName+" WHERE key = ? LIMIT 1",[n],function(w,A){var S=A.rows.length?A.rows.item(0).value:null;S&&(S=m.serializer.deserialize(S)),f(S)},function(w,A){l(A)})})}).catch(l)});return N(u,c),u}function Wn(n,c){var o=this,u=new g(function(f,l){o.ready().then(function(){var m=o.u;m.db.transaction(function(y){be(y,m,"SELECT * FROM "+m.storeName,[],function(w,A){for(var S=A.rows,T=S.length,k=0;k<T;k++){var j=S.item(k),q=j.value;if(q&&(q=m.serializer.deserialize(q)),q=n(q,j.key,k+1),q!==void 0){f(q);return}}f()},function(w,A){l(A)})})}).catch(l)});return N(u,c),u}function or(n,c,o,u){var f=this;n=F(n);var l=new g(function(m,y){f.ready().then(function(){c===void 0&&(c=null);var w=c,A=f.u;A.serializer.serialize(c,function(S,T){T?y(T):A.db.transaction(function(k){be(k,A,"INSERT OR REPLACE INTO "+A.storeName+" (key, value) VALUES (?, ?)",[n,S],function(){m(w)},function(j,q){y(q)})},function(k){if(k.code===k.QUOTA_ERR){if(u>0){m(or.apply(f,[n,w,o,u-1]));return}y(k)}})})}).catch(y)});return N(l,o),l}function Bn(n,c,o){return or.apply(this,[n,c,o,1])}function Gn(n,c){var o=this;n=F(n);var u=new g(function(f,l){o.ready().then(function(){var m=o.u;m.db.transaction(function(y){be(y,m,"DELETE FROM "+m.storeName+" WHERE key = ?",[n],function(){f()},function(w,A){l(A)})})}).catch(l)});return N(u,c),u}function Vn(n){var c=this,o=new g(function(u,f){c.ready().then(function(){var l=c.u;l.db.transaction(function(m){be(m,l,"DELETE FROM "+l.storeName,[],function(){u()},function(y,w){f(w)})})}).catch(f)});return N(o,n),o}function jn(n){var c=this,o=new g(function(u,f){c.ready().then(function(){var l=c.u;l.db.transaction(function(m){be(m,l,"SELECT COUNT(key) as c FROM "+l.storeName,[],function(y,w){var A=w.rows.item(0).c;u(A)},function(y,w){f(w)})})}).catch(f)});return N(o,n),o}function Hn(n,c){var o=this,u=new g(function(f,l){o.ready().then(function(){var m=o.u;m.db.transaction(function(y){be(y,m,"SELECT key FROM "+m.storeName+" WHERE id = ? LIMIT 1",[n+1],function(w,A){var S=A.rows.length?A.rows.item(0).key:null;f(S)},function(w,A){l(A)})})}).catch(l)});return N(u,c),u}function qn(n){var c=this,o=new g(function(u,f){c.ready().then(function(){var l=c.u;l.db.transaction(function(m){be(m,l,"SELECT key FROM "+l.storeName,[],function(y,w){for(var A=[],S=0;S<w.rows.length;S++)A.push(w.rows.item(S).key);u(A)},function(y,w){f(w)})})}).catch(f)});return N(o,n),o}function Kn(n){return new g(function(c,o){n.transaction(function(u){u.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(f,l){for(var m=[],y=0;y<l.rows.length;y++)m.push(l.rows.item(y).name);c({db:n,storeNames:m})},function(f,l){o(l)})},function(u){o(u)})})}function Yn(n,c){c=L.apply(this,arguments);var o=this.config();n=typeof n!="function"&&n||{},n.name||(n.name=n.name||o.name,n.storeName=n.storeName||o.storeName);var u=this,f;return n.name?f=new g(function(l){var m;n.name===o.name?m=u.u.db:m=openDatabase(n.name,"","",0),n.storeName?l({db:m,storeNames:[n.storeName]}):l(Kn(m))}).then(function(l){return new g(function(m,y){l.db.transaction(function(w){function A(j){return new g(function(q,z){w.executeSql("DROP TABLE IF EXISTS "+j,[],function(){q()},function(X,ue){z(ue)})})}for(var S=[],T=0,k=l.storeNames.length;T<k;T++)S.push(A(l.storeNames[T]));g.all(S).then(function(){m()}).catch(function(j){y(j)})},function(w){y(w)})})}):f=g.reject("Invalid arguments"),N(f,c),f}var Xn={f:"webSQLStorage",y:Fn,p:$n(),iterate:Wn,getItem:kn,setItem:Bn,removeItem:Gn,clear:Vn,length:jn,key:Hn,keys:qn,dropInstance:Yn};function zn(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function sr(n,c){var o=n.name+"/";return n.storeName!==c.storeName&&(o+=n.storeName+"/"),o}function Jn(){var n="_localforage_support_test";try{return localStorage.setItem(n,!0),localStorage.removeItem(n),!1}catch{return!0}}function Qn(){return!Jn()||localStorage.length>0}function Zn(n){var c=this,o={};if(n)for(var u in n)o[u]=n[u];return o.keyPrefix=sr(n,c.E),Qn()?(c.u=o,o.serializer=St,g.resolve()):g.reject()}function ei(n){var c=this,o=c.ready().then(function(){for(var u=c.u.keyPrefix,f=localStorage.length-1;f>=0;f--){var l=localStorage.key(f);l.indexOf(u)===0&&localStorage.removeItem(l)}});return N(o,n),o}function ti(n,c){var o=this;n=F(n);var u=o.ready().then(function(){var f=o.u,l=localStorage.getItem(f.keyPrefix+n);return l&&(l=f.serializer.deserialize(l)),l});return N(u,c),u}function ri(n,c){var o=this,u=o.ready().then(function(){for(var f=o.u,l=f.keyPrefix,m=l.length,y=localStorage.length,w=1,A=0;A<y;A++){var S=localStorage.key(A);if(S.indexOf(l)===0){var T=localStorage.getItem(S);if(T&&(T=f.serializer.deserialize(T)),T=n(T,S.substring(m),w++),T!==void 0)return T}}});return N(u,c),u}function ni(n,c){var o=this,u=o.ready().then(function(){var f=o.u,l;try{l=localStorage.key(n)}catch{l=null}return l&&(l=l.substring(f.keyPrefix.length)),l});return N(u,c),u}function ii(n){var c=this,o=c.ready().then(function(){for(var u=c.u,f=localStorage.length,l=[],m=0;m<f;m++){var y=localStorage.key(m);y.indexOf(u.keyPrefix)===0&&l.push(y.substring(u.keyPrefix.length))}return l});return N(o,n),o}function ai(n){var c=this,o=c.keys().then(function(u){return u.length});return N(o,n),o}function oi(n,c){var o=this;n=F(n);var u=o.ready().then(function(){var f=o.u;localStorage.removeItem(f.keyPrefix+n)});return N(u,c),u}function si(n,c,o){var u=this;n=F(n);var f=u.ready().then(function(){c===void 0&&(c=null);var l=c;return new g(function(m,y){var w=u.u;w.serializer.serialize(c,function(A,S){if(S)y(S);else try{localStorage.setItem(w.keyPrefix+n,A),m(l)}catch(T){(T.name==="QuotaExceededError"||T.name==="NS_ERROR_DOM_QUOTA_REACHED")&&y(T),y(T)}})})});return N(f,o),f}function ci(n,c){if(c=L.apply(this,arguments),n=typeof n!="function"&&n||{},!n.name){var o=this.config();n.name=n.name||o.name,n.storeName=n.storeName||o.storeName}var u=this,f;return n.name?f=new g(function(l){n.storeName?l(sr(n,u.E)):l(n.name+"/")}).then(function(l){for(var m=localStorage.length-1;m>=0;m--){var y=localStorage.key(m);y.indexOf(l)===0&&localStorage.removeItem(y)}}):f=g.reject("Invalid arguments"),N(f,c),f}var li={f:"localStorageWrapper",y:Zn,p:zn(),iterate:ri,getItem:ti,setItem:si,removeItem:oi,clear:ei,length:ai,key:ni,keys:ii,dropInstance:ci},ui=function(c,o){return c===o||typeof c=="number"&&typeof o=="number"&&isNaN(c)&&isNaN(o)},fi=function(c,o){for(var u=c.length,f=0;f<u;){if(ui(c[f],o))return!0;f++}return!1},cr=Array.isArray||function(n){return Object.prototype.toString.call(n)==="[object Array]"},Ve={},lr={},Fe={INDEXEDDB:Pn,WEBSQL:Xn,LOCALSTORAGE:li},di=[Fe.INDEXEDDB.f,Fe.WEBSQL.f,Fe.LOCALSTORAGE.f],et=["dropInstance"],bt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(et),hi={description:"",driver:di.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function mi(n,c){n[c]=function(){var o=arguments;return n.ready().then(function(){return n[c].apply(n,o)})}}function _t(){for(var n=1;n<arguments.length;n++){var c=arguments[n];if(c)for(var o in c)c.hasOwnProperty(o)&&(cr(c[o])?arguments[0][o]=c[o].slice():arguments[0][o]=c[o])}return arguments[0]}var pi=function(){function n(c){h(this,n);for(var o in Fe)if(Fe.hasOwnProperty(o)){var u=Fe[o],f=u.f;this[o]=f,Ve[f]||this.defineDriver(u)}this.E=_t({},hi),this.v=_t({},this.E,c),this.h=null,this.I=null,this.m=!1,this.u=null,this.w(),this.setDriver(this.v.driver).catch(function(){})}return n.prototype.config=function(o){if((typeof o>"u"?"undefined":p(o))==="object"){if(this.m)return new Error("Can't call config() after localforage has been used.");for(var u in o){if(u==="storeName"&&(o[u]=o[u].replace(/\W/g,"_")),u==="version"&&typeof o[u]!="number")return new Error("Database version must be a number.");this.v[u]=o[u]}return"driver"in o&&o.driver?this.setDriver(this.v.driver):!0}else return typeof o=="string"?this.v[o]:this.v},n.prototype.defineDriver=function(o,u,f){var l=new g(function(m,y){try{var w=o.f,A=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!o.f){y(A);return}for(var S=bt.concat("_initStorage"),T=0,k=S.length;T<k;T++){var j=S[T],q=!fi(et,j);if((q||o[j])&&typeof o[j]!="function"){y(A);return}}var z=function(){for(var je=function(yi){return function(){var gi=new Error("Method "+yi+" is not implemented by the current driver"),ur=g.reject(gi);return N(ur,arguments[arguments.length-1]),ur}},Ot=0,Ei=et.length;Ot<Ei;Ot++){var Nt=et[Ot];o[Nt]||(o[Nt]=je(Nt))}};z();var X=function(je){Ve[w]&&console.info("Redefining LocalForage driver: "+w),Ve[w]=o,lr[w]=je,m()};"_support"in o?o.p&&typeof o.p=="function"?o.p().then(X,y):X(!!o.p):X(!0)}catch(ue){y(ue)}});return $(l,u,f),l},n.prototype.driver=function(){return this.f||null},n.prototype.getDriver=function(o,u,f){var l=Ve[o]?g.resolve(Ve[o]):g.reject(new Error("Driver not found."));return $(l,u,f),l},n.prototype.getSerializer=function(o){var u=g.resolve(St);return $(u,o),u},n.prototype.ready=function(o){var u=this,f=u.h.then(function(){return u.m===null&&(u.m=u.I()),u.m});return $(f,o,o),f},n.prototype.setDriver=function(o,u,f){var l=this;cr(o)||(o=[o]);var m=this.A(o);function y(){l.v.driver=l.driver()}function w(T){return l.S(T),y(),l.m=l.y(l.v),l.m}function A(T){return function(){var k=0;function j(){for(;k<T.length;){var q=T[k];return k++,l.u=null,l.m=null,l.getDriver(q).then(w).catch(j)}y();var z=new Error("No available storage method found.");return l.h=g.reject(z),l.h}return j()}}var S=this.h!==null?this.h.catch(function(){return g.resolve()}):g.resolve();return this.h=S.then(function(){var T=m[0];return l.u=null,l.m=null,l.getDriver(T).then(function(k){l.f=k.f,y(),l.w(),l.I=A(m)})}).catch(function(){y();var T=new Error("No available storage method found.");return l.h=g.reject(T),l.h}),$(this.h,u,f),this.h},n.prototype.supports=function(o){return!!lr[o]},n.prototype.S=function(o){_t(this,o)},n.prototype.A=function(o){for(var u=[],f=0,l=o.length;f<l;f++){var m=o[f];this.supports(m)&&u.push(m)}return u},n.prototype.w=function(){for(var o=0,u=bt.length;o<u;o++)mi(this,bt[o])},n.prototype.createInstance=function(o){return new n(o)},n}(),vi=new pi;a.exports=vi},{3:3}]},{},[4])(4)})});var Sn=fr((Et,An)=>{"use strict";(function(e,t){typeof Et=="object"&&typeof An<"u"?t(Et):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],t):t(e.LocalforageDriverMemory={})})(typeof self<"u"?self:Et,function(e){"use strict";var t="localforage-driver-memory";function r(d){var I=typeof Symbol=="function"&&d[Symbol.iterator],b=0;return I?I.call(d):{next:function(){return d&&b>=d.length&&(d=void 0),{value:d&&d[b++],done:!d}}}}function i(d,I){d=d||[],I=I||{};try{return new Blob(d,I)}catch(U){if(U.name!=="TypeError")throw U;for(var b=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new b,P=0;P<d.length;P+=1)C.append(d[P]);return C.getBlob(I.type)}}var a=/^~~local_forage_type~([^~]+)~/,s=9,p=s+4,h=Object.prototype.toString;function R(d){var I=d.length*.75,b=d.length;d[d.length-1]==="="&&(I--,d[d.length-2]==="="&&I--);for(var C=new ArrayBuffer(I),P=new Uint8Array(C),U=0,V=0;U<b;U+=4){var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[U]),xe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[U+1]),Ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[U+2]),Ge="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[U+3]);P[V++]=Z<<2|xe>>4,P[V++]=(xe&15)<<4|Ce>>2,P[V++]=(Ce&3)<<6|Ge&63}return C}function v(d){for(var I=new Uint8Array(d),b="",C=0;C<I.length;C+=3)b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[I[C]>>2],b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(I[C]&3)<<4|I[C+1]>>4],b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(I[C+1]&15)<<2|I[C+2]>>6],b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[I[C+2]&63];return I.length%3===2?b=b.substring(0,b.length-1)+"=":I.length%3===1&&(b=b.substring(0,b.length-2)+"=="),b}function E(d,I){var b="";if(d&&(b=h.call(d)),d&&(b==="[object ArrayBuffer]"||d.buffer&&h.call(d.buffer)==="[object ArrayBuffer]")){var C=void 0,P="__lfsc__:";d instanceof ArrayBuffer?(C=d,P+="arbf"):(C=d.buffer,b==="[object Int8Array]"?P+="si08":b==="[object Uint8Array]"?P+="ui08":b==="[object Uint8ClampedArray]"?P+="uic8":b==="[object Int16Array]"?P+="si16":b==="[object Uint16Array]"?P+="ur16":b==="[object Int32Array]"?P+="si32":b==="[object Uint32Array]"?P+="ui32":b==="[object Float32Array]"?P+="fl32":b==="[object Float64Array]"?P+="fl64":I(new Error("Failed to get type for BinaryArray"))),I(P+v(C))}else if(b==="[object Blob]"){var U=new FileReader;U.onload=function(){var V="~~local_forage_type~"+d.type+"~"+v(this.result);I("__lfsc__:blob"+V)},U.readAsArrayBuffer(d)}else try{I(JSON.stringify(d))}catch(V){console.error("Couldn't convert value into a JSON string: ",d),I(null,V)}}function O(d){if(d.substring(0,s)!=="__lfsc__:")return JSON.parse(d);var I=d.substring(p),b=d.substring(s,p),C;if(b==="blob"&&a.test(I)){var P=I.match(a);C=P[1],I=I.substring(P[0].length)}var U=R(I);switch(b){case"arbf":return U;case"blob":return i([U],{type:C});case"si08":return new Int8Array(U);case"ui08":return new Uint8Array(U);case"uic8":return new Uint8ClampedArray(U);case"si16":return new Int16Array(U);case"ur16":return new Uint16Array(U);case"si32":return new Int32Array(U);case"ui32":return new Uint32Array(U);case"fl32":return new Float32Array(U);case"fl64":return new Float64Array(U);default:throw new Error("Unkown type: "+b)}}function g(d){var I,b;if(d===null||typeof d!="object"||"isActiveClone"in d)return d;var C=d instanceof Date?new Date(d):d.constructor();try{for(var P=r(Object.keys(d)),U=P.next();!U.done;U=P.next()){var V=U.value;Object.prototype.hasOwnProperty.call(d,V)&&(d.isActiveClone=null,C[V]=g(d[V]),delete d.isActiveClone)}}catch(Z){I={error:Z}}finally{try{U&&!U.done&&(b=P.return)&&b.call(P)}finally{if(I)throw I.error}}return C}function N(d,I){return(d.name||I.name)+"/"+(d.storeName||I.storeName)+"/"}function $(d,I){I&&d.then(function(b){I(null,b)},function(b){I(b)})}function F(){for(var d=[],I=0;I<arguments.length;I++)d[I]=arguments[I];if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}function L(d,I){var b=this;if(I=F.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var C=this.config();d.name=d.name||C.name,d.storeName=d.storeName||C.storeName}var P;return d.name?P=new Promise(function(U){d.storeName?U(N(d,b.E)):U(d.name+"/")}):P=Promise.reject("Invalid arguments"),{promise:P,callback:I}}function W(d){return typeof d!="string"&&(console.warn(d+" used as a key, but it is not a string."),d=String(d)),d}var J={bufferToString:v,deserialize:O,serialize:E,stringToBuffer:R},D={},Ae=function(){function d(I){this.kp=I,this.data={}}return d.resolve=function(I){return D[I]||(D[I]=new d(I)),D[I]},d.prototype.clear=function(){this.data={}},d.prototype.drop=function(){this.clear(),delete D[this.kp]},d.prototype.get=function(I){return this.data[I]},d.prototype.key=function(I){return this.keys()[I]},d.prototype.keys=function(){return Object.keys(this.data)},d.prototype.rm=function(I){delete this.data[I]},d.prototype.set=function(I,b){this.data[I]=b},d}();function ne(d){var I=d?g(d):{},b=N(I,this.E),C=Ae.resolve(b);return this.u=I,this.u.serializer=J,this.u.keyPrefix=b,this.u.mStore=C,Promise.resolve()}function _(d){var I=this,b=this.ready().then(function(){I.u.mStore.clear()});return $(b,d),b}function B(d,I){var b=L.apply(this,arguments),C=b.promise,P=b.callback,U=C.then(function(V){Ae.resolve(V).drop()});return $(U,P),C}function x(d,I){var b=this;d=W(d);var C=this.ready().then(function(){var P=b.u.mStore.get(d);return P==null?null:b.u.serializer.deserialize(P)});return $(C,I),C}function H(d,I){var b=this,C=this.ready().then(function(){for(var P=b.u.mStore,U=P.keys(),V=0;V<U.length;V++){var Z=P.get(U[V]);if(Z&&(Z=b.u.serializer.deserialize(Z)),Z=d(Z,U[V],V+1),Z!==void 0)return Z}});return $(C,I),C}function Q(d,I){var b=this,C=this.ready().then(function(){var P;try{P=b.u.mStore.key(d),P===void 0&&(P=null)}catch{P=null}return P});return $(C,I),C}function ie(d){var I=this,b=this.ready().then(function(){return I.u.mStore.keys()});return $(b,d),b}function oe(d){var I=this.keys().then(function(b){return b.length});return $(I,d),I}function se(d,I){var b=this;d=W(d);var C=this.ready().then(function(){b.u.mStore.rm(d)});return $(C,I),C}function he(d,I,b){var C=this;d=W(d);var P=this.ready().then(function(){I===void 0&&(I=null);var U=I;return new Promise(function(V,Z){C.u.serializer.serialize(I,function(xe,Ce){if(Ce)Z(Ce);else try{C.u.mStore.set(d,xe),V(U)}catch(Ge){Z(Ge)}})})});return $(P,b),P}var Le=!0;e.p=Le,e.f=t,e.y=ne,e.clear=_,e.dropInstance=B,e.getItem=x,e.iterate=H,e.key=Q,e.keys=ie,e.length=oe,e.removeItem=se,e.setItem=he,Object.defineProperty(e,"__esModule",{value:!0})})});var Co={};dr(Co,{default:()=>Lo});var ge=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.ConnectionLost="CONNECTION_WAS_LOST",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(ge||{}),Ie=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e.ProductAnnouncement="ANNOUNCEMENT",e))(Ie||{}),ke=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e[e.RedirectLoginComplete=-10015]="RedirectLoginComplete",e))(ke||{}),ve=(e=>(e.PROVIDER="magic_3pw_provider",e.ADDRESS="magic_3pw_address",e.CHAIN_ID="magic_3pw_chainId",e))(ve||{}),pr=(e=>(e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e.Web3ModalSelected="web3modal_selected",e))(pr||{}),M=(e=>(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.SetAuthorizationToken="magic_auth_set_authorization_token",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="magic_get_info",e.ShowUI="magic_wallet",e.NFTPurchase="magic_nft_purchase",e.NFTCheckout="magic_nft_checkout",e.NFTTransfer="magic_nft_transfer",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e.MagicBoxHeartBeat="magic_box_heart_beat",e.AutoConnect="mc_auto_connect",e.Login="mc_login",e.EncryptV1="magic_auth_encrypt_v1",e.DecryptV1="magic_auth_decrypt_v1",e.ShowNFTs="magic_show_nfts",e.ShowOnRamp="magic_show_fiat_onramp",e.ShowSendTokensUI="magic_show_send_tokens_ui",e.ShowAddress="magic_show_address",e.ShowBalances="magic_show_balances",e.SendGaslessTransaction="eth_sendGaslessTransaction",e.RevealPK="magic_reveal_key",e.EnableMFA="magic_auth_enable_mfa_flow",e.DisableMFA="magic_auth_disable_mfa_flow",e))(M||{}),Tt=["magic_intermediary_event","magic_nft_checkout","mc_login"],fe=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",e.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",e.MAGIC_PONG="MAGIC_PONG",e.MAGIC_POPUP_RESPONSE="MAGIC_POPUP_RESPONSE",e.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE="MAGIC_POPUP_OAUTH_VERIFY_RESPONSE",e))(fe||{}),we=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e.MAGIC_PING="MAGIC_PING",e))(we||{}),vr=(e=>(e.UpdateEmail="update-email",e.MFA="mfa",e.Recovery="recovery",e))(vr||{}),Er=(e=>(e.Retry="retry",e))(Er||{}),yr=(e=>(e.EmailSent="email-sent",e.EmailNotDeliverable="email-not-deliverable",e))(yr||{}),le=(e=>(e.VerifyEmailOtp="verify-email-otp",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e.Cancel="cancel",e))(le||{}),Pe=(e=>(e.VerifySmsOtp="verify-sms-otp",e.Cancel="cancel",e.Retry="retry",e))(Pe||{}),gr=(e=>(e.SmsOTPSent="sms-otp-sent",e.InvalidSmsOtp="invalid-sms-otp",e.ExpiredSmsOtp="expired-sms-otp",e))(gr||{}),Ir=(e=>(e.EmailOTPSent="email-otp-sent",e.InvalidEmailOtp="invalid-email-otp",e.InvalidMfaOtp="invalid-mfa-otp",e.ExpiredEmailOtp="expired-email-otp",e.MfaSentHandle="mfa-sent-handle",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(Ir||{}),qe=(e=>(e.Retry="device-retry",e))(qe||{}),wr=(e=>(e.DeviceApproved="device-approved",e.DeviceNeedsApproval="device-needs-approval",e.DeviceVerificationLinkExpired="device-verification-link-expired",e.DeviceVerificationEmailSent="device-verification-email-sent",e))(wr||{}),ce=(e=>(e.Retry="Recency/auth-factor-retry",e.Cancel="Recency/auth-factor-verification-cancel",e.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",e.VerifyMFACode="Recency/verify-mfa-code",e))(ce||{}),Rr=(e=>(e.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",e.PrimaryAuthFactorVerified="Recency/auth-factor-verified",e.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",e.EmailExpired="Recency/auth-factor-verification-email-expired",e.EmailSent="Recency/auth-factor-verification-email-sent",e.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",e))(Rr||{}),te=(e=>(e.RetryWithNewEmail="UpdateEmail/retry-with-new-email",e.Cancel="UpdateEmail/new-email-verification-cancel",e.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",e))(te||{}),Ar=(e=>(e.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",e.EmailUpdated="UpdateEmail/email-updated",e.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",e.EmailExpired="UpdateEmail/new-email-verification-email-expired",e.EmailSent="UpdateEmail/new-email-verification-email-sent",e.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",e.InvalidEmail="UpdateEmail/new-email-invalid",e.EmailAlreadyExists="UpdateEmail/new-email-already-exists",e))(Ar||{}),Sr=(e=>(e.IDTokenCreated="Auth/id-token-created",e))(Sr||{}),br=(e=>(e.Cancel="Farcaster/cancel",e))(br||{}),_r=(e=>(e.MFASecretGenerated="mfa-secret-generated",e.InvalidMFAOtp="invalid-mfa-otp",e.MFARecoveryCodes="mfa-recovery-codes",e))(_r||{}),$e=(e=>(e.VerifyMFACode="verify-mfa-code",e.Cancel="cancel-mfa-setup",e))($e||{}),Or=(e=>(e.MFACodeRequested="mfa-code-requested",e.InvalidMFAOtp="invalid-mfa-otp",e.InvalidRecoveryCode="invalid-recovery-code",e))(Or||{}),Re=(e=>(e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.Cancel="cancel-mfa-disable",e))(Re||{}),Nr=(e=>(e.Harmony="HARMONY",e))(Nr||{}),rt=(e=>(e.ClosedByUser="closed-by-user",e))(rt||{}),nt=(e=>(e.ClosedByUser="closed-by-user-on-received",e))(nt||{}),Tr=(e=>(e.EnterNewPhoneNumber="enter-new-phone-number",e.EnterOtpCode="enter-otp-code",e.RecoveryFactorAlreadyExists="recovery-factor-already-exists",e.MalformedPhoneNumber="malformed-phone-number",e.InvalidOtpCode="invalid-otp-code",e))(Tr||{}),me=(e=>(e.SendNewPhoneNumber="send-new-phone-number",e.SendOtpCode="send-otp-code",e.Cancel="cancel",e.StartEditPhoneNumber="start-edit-phone-number",e))(me||{}),Mr=(e=>(e.PhoneNumber="phone_number",e))(Mr||{}),Lr=(e=>(e.SmsOtpSent="sms-otp-sent",e.LoginThrottled="login-throttled",e.InvalidSmsOtp="invalid-sms-otp",e.SmsVerified="sms-verified",e.AccountRecovered="account-recovered",e.UpdateEmailRequired="update-email-required",e))(Lr||{}),pe=(e=>(e.Cancel="cancel",e.VerifyOtp="verify-otp-code",e.ResendSms="resend-sms-otp",e.UpdateEmail="update-email",e))(pe||{}),De=(e=>(e.Success="nft-checkout-success",e.Failure="nft-checkout-failure",e.Initiated="nft-checkout-initiated",e.Disconnect="disconnect",e))(De||{}),Cr=(e=>(e.WalletInfoFetched="Wallet/wallet-info-fetched",e))(Cr||{}),Pr=(e=>(e.CloseMagicWindow="close-magic-window",e))(Pr||{});var _i=Object.create,Dt=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,Ni=Object.getOwnPropertyNames,Ti=Object.getPrototypeOf,Mi=Object.prototype.hasOwnProperty,Li=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ci=(e,t)=>{for(var r in t)Dt(e,r,{get:t[r],enumerable:!0})},Pi=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ni(t))!Mi.call(e,a)&&a!==r&&Dt(e,a,{get:()=>t[a],enumerable:!(i=Oi(t,a))||i.enumerable});return e},$i=(e,t,r)=>(r=e!=null?_i(Ti(e)):{},Pi(t||!e||!e.b?Dt(r,"default",{value:e,enumerable:!0}):r,e)),Di=Li((e,t)=>{"use strict";var r=Object.prototype.hasOwnProperty,i="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(i=!1));function s(v,E,O){this.fn=v,this.context=E,this.once=O||!1}function p(v,E,O,g,N){if(typeof O!="function")throw new TypeError("The listener must be a function");var $=new s(O,g||v,N),F=i?i+E:E;return v.e[F]?v.e[F].fn?v.e[F]=[v.e[F],$]:v.e[F].push($):(v.e[F]=$,v.i++),v}function h(v,E){--v.i===0?v.e=new a:delete v.e[E]}function R(){this.e=new a,this.i=0}R.prototype.eventNames=function(){var v=[],E,O;if(this.i===0)return v;for(O in E=this.e)r.call(E,O)&&v.push(i?O.slice(1):O);return Object.getOwnPropertySymbols?v.concat(Object.getOwnPropertySymbols(E)):v},R.prototype.listeners=function(v){var E=i?i+v:v,O=this.e[E];if(!O)return[];if(O.fn)return[O.fn];for(var g=0,N=O.length,$=new Array(N);g<N;g++)$[g]=O[g].fn;return $},R.prototype.listenerCount=function(v){var E=i?i+v:v,O=this.e[E];return O?O.fn?1:O.length:0},R.prototype.emit=function(v,E,O,g,N,$){var F=i?i+v:v;if(!this.e[F])return!1;var L=this.e[F],W=arguments.length,J,D;if(L.fn){switch(L.once&&this.removeListener(v,L.fn,void 0,!0),W){case 1:return L.fn.call(L.context),!0;case 2:return L.fn.call(L.context,E),!0;case 3:return L.fn.call(L.context,E,O),!0;case 4:return L.fn.call(L.context,E,O,g),!0;case 5:return L.fn.call(L.context,E,O,g,N),!0;case 6:return L.fn.call(L.context,E,O,g,N,$),!0}for(D=1,J=new Array(W-1);D<W;D++)J[D-1]=arguments[D];L.fn.apply(L.context,J)}else{var Ae=L.length,ne;for(D=0;D<Ae;D++)switch(L[D].once&&this.removeListener(v,L[D].fn,void 0,!0),W){case 1:L[D].fn.call(L[D].context);break;case 2:L[D].fn.call(L[D].context,E);break;case 3:L[D].fn.call(L[D].context,E,O);break;case 4:L[D].fn.call(L[D].context,E,O,g);break;default:if(!J)for(ne=1,J=new Array(W-1);ne<W;ne++)J[ne-1]=arguments[ne];L[D].fn.apply(L[D].context,J)}}return!0},R.prototype.on=function(v,E,O){return p(this,v,E,O,!1)},R.prototype.once=function(v,E,O){return p(this,v,E,O,!0)},R.prototype.removeListener=function(v,E,O,g){var N=i?i+v:v;if(!this.e[N])return this;if(!E)return h(this,N),this;var $=this.e[N];if($.fn)$.fn===E&&(!g||$.once)&&(!O||$.context===O)&&h(this,N);else{for(var F=0,L=[],W=$.length;F<W;F++)($[F].fn!==E||g&&!$[F].once||O&&$[F].context!==O)&&L.push($[F]);L.length?this.e[N]=L.length===1?L[0]:L:h(this,N)}return this},R.prototype.removeAllListeners=function(v){var E;return v?(E=i?i+v:v,this.e[E]&&h(this,E)):(this.e=new a,this.i=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=i,R.EventEmitter=R,typeof t<"u"&&(t.exports=R)});function Ui(e){let t={exports:{}};return e(t,t.exports),t.exports}var xi=Number.MAX_SAFE_INTEGER||9007199254740991,Ut={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:xi,MAX_SAFE_COMPONENT_LENGTH:16},Fi=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},K=Fi,Qe=Ui(function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=Ut,i=(t=e.exports={}).re=[],a=t.src=[],s=t.t={},p=0,h=(R,v,E)=>{let O=p++;K(O,v),s[R]=O,a[O]=v,i[O]=new RegExp(v,E?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","[0-9]+"),h("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),h("MAINVERSION",`(${a[s.NUMERICIDENTIFIER]})\\.(${a[s.NUMERICIDENTIFIER]})\\.(${a[s.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${a[s.NUMERICIDENTIFIERLOOSE]})\\.(${a[s.NUMERICIDENTIFIERLOOSE]})\\.(${a[s.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${a[s.NUMERICIDENTIFIER]}|${a[s.NONNUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${a[s.NUMERICIDENTIFIERLOOSE]}|${a[s.NONNUMERICIDENTIFIER]})`),h("PRERELEASE",`(?:-(${a[s.PRERELEASEIDENTIFIER]}(?:\\.${a[s.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${a[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${a[s.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER","[0-9A-Za-z-]+"),h("BUILD",`(?:\\+(${a[s.BUILDIDENTIFIER]}(?:\\.${a[s.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${a[s.MAINVERSION]}${a[s.PRERELEASE]}?${a[s.BUILD]}?`),h("FULL",`^${a[s.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${a[s.MAINVERSIONLOOSE]}${a[s.PRERELEASELOOSE]}?${a[s.BUILD]}?`),h("LOOSE",`^${a[s.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${a[s.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${a[s.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${a[s.XRANGEIDENTIFIER]})(?:\\.(${a[s.XRANGEIDENTIFIER]})(?:\\.(${a[s.XRANGEIDENTIFIER]})(?:${a[s.PRERELEASE]})?${a[s.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${a[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${a[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${a[s.XRANGEIDENTIFIERLOOSE]})(?:${a[s.PRERELEASELOOSE]})?${a[s.BUILD]}?)?)?`),h("XRANGE",`^${a[s.GTLT]}\\s*${a[s.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${a[s.GTLT]}\\s*${a[s.XRANGEPLAINLOOSE]}$`),h("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),h("COERCERTL",a[s.COERCE],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${a[s.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${a[s.LONETILDE]}${a[s.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${a[s.LONETILDE]}${a[s.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${a[s.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${a[s.LONECARET]}${a[s.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${a[s.LONECARET]}${a[s.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${a[s.GTLT]}\\s*(${a[s.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${a[s.GTLT]}\\s*(${a[s.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${a[s.GTLT]}\\s*(${a[s.LOOSEPLAIN]}|${a[s.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${a[s.XRANGEPLAIN]})\\s+-\\s+(${a[s.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${a[s.XRANGEPLAINLOOSE]})\\s+-\\s+(${a[s.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0.0.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}),$r=/^[0-9]+$/,Kr=(e,t)=>{let r=$r.test(e),i=$r.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1},ki=(e,t)=>Kr(t,e),Wi={compareIdentifiers:Kr,rcompareIdentifiers:ki},{MAX_LENGTH:Dr,MAX_SAFE_INTEGER:it}=Ut,{re:Ur,t:xr}=Qe,{compareIdentifiers:Ke}=Wi,Oe=class Ee{constructor(t,r){if(r&&typeof r=="object"||(r={loose:!!r,includePrerelease:!1}),t instanceof Ee){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid Version: ${t}`);if(t.length>Dr)throw new TypeError(`version is longer than ${Dr} characters`);K("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let i=t.trim().match(r.loose?Ur[xr.LOOSE]:Ur[xr.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>it||this.major<0)throw new TypeError("Invalid major version");if(this.minor>it||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>it||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(a=>{if(/^[0-9]+$/.test(a)){let s=+a;if(s>=0&&s<it)return s}return a}):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(K("SemVer.compare",this.version,this.options,t),!(t instanceof Ee)){if(typeof t=="string"&&t===this.version)return 0;t=new Ee(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof Ee||(t=new Ee(t,this.options)),Ke(this.major,t.major)||Ke(this.minor,t.minor)||Ke(this.patch,t.patch)}comparePre(t){if(t instanceof Ee||(t=new Ee(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let i=this.prerelease[r],a=t.prerelease[r];if(K("prerelease compare",r,i,a),i===void 0&&a===void 0)return 0;if(a===void 0)return 1;if(i===void 0)return-1;if(i!==a)return Ke(i,a)}while(++r)}compareBuild(t){t instanceof Ee||(t=new Ee(t,this.options));let r=0;do{let i=this.build[r],a=t.build[r];if(K("prerelease compare",r,i,a),i===void 0&&a===void 0)return 0;if(a===void 0)return 1;if(i===void 0)return-1;if(i!==a)return Ke(i,a)}while(++r)}inc(t,r){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r),this.inc("pre",r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r),this.inc("pre",r);break;case"major":this.minor===0&&this.patch===0&&this.prerelease.length!==0||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":this.patch===0&&this.prerelease.length!==0||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);i===-1&&this.prerelease.push(0)}r&&(this.prerelease[0]===r?isNaN(this.prerelease[1])&&(this.prerelease=[r,0]):this.prerelease=[r,0]);break;default:throw new Error(`invalid increment argument: ${t}`)}return this.format(),this.raw=this.version,this}},Bi=(e,t,r)=>new Oe(e,r).compare(new Oe(t,r)),Be=Bi,Gi=(e,t,r)=>Be(e,t,r)===0,Vi=Gi,ji=(e,t,r)=>Be(e,t,r)!==0,Hi=ji,qi=(e,t,r)=>Be(e,t,r)>0,Ki=qi,Yi=(e,t,r)=>Be(e,t,r)>=0,Xi=Yi,zi=(e,t,r)=>Be(e,t,r)<0,Ji=zi,Qi=(e,t,r)=>Be(e,t,r)<=0,Zi=Qi,ea=(e,t,r,i)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Vi(e,r,i);case"!=":return Hi(e,r,i);case">":return Ki(e,r,i);case">=":return Xi(e,r,i);case"<":return Ji(e,r,i);case"<=":return Zi(e,r,i);default:throw new TypeError(`Invalid operator: ${t}`)}},Mt=ea,Ye=Symbol("SemVer ANY"),Lt=class Ct{static get ANY(){return Ye}constructor(t,r){if(r&&typeof r=="object"||(r={loose:!!r,includePrerelease:!1}),t instanceof Ct){if(t.loose===!!r.loose)return t;t=t.value}K("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===Ye?this.value="":this.value=this.operator+this.semver.version,K("comp",this)}parse(t){let r=this.options.loose?Fr[kr.COMPARATORLOOSE]:Fr[kr.COMPARATOR],i=t.match(r);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new Oe(i[2],this.options.loose):this.semver=Ye}toString(){return this.value}test(t){if(K("Comparator.test",t,this.options.loose),this.semver===Ye||t===Ye)return!0;if(typeof t=="string")try{t=new Oe(t,this.options)}catch{return!1}return Mt(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof Ct))throw new TypeError("a Comparator is required");if(r&&typeof r=="object"||(r={loose:!!r,includePrerelease:!1}),this.operator==="")return this.value===""||new Pt(t.value,r).test(this.value);if(t.operator==="")return t.value===""||new Pt(this.value,r).test(t.semver);let i=!(this.operator!==">="&&this.operator!==">"||t.operator!==">="&&t.operator!==">"),a=!(this.operator!=="<="&&this.operator!=="<"||t.operator!=="<="&&t.operator!=="<"),s=this.semver.version===t.semver.version,p=!(this.operator!==">="&&this.operator!=="<="||t.operator!==">="&&t.operator!=="<="),h=Mt(this.semver,"<",t.semver,r)&&(this.operator===">="||this.operator===">")&&(t.operator==="<="||t.operator==="<"),R=Mt(this.semver,">",t.semver,r)&&(this.operator==="<="||this.operator==="<")&&(t.operator===">="||t.operator===">");return i||a||s&&p||h||R}},{re:Fr,t:kr}=Qe,Pt=class lt{constructor(t,r){if(r&&typeof r=="object"||(r={loose:!!r,includePrerelease:!1}),t instanceof lt)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new lt(t.raw,r);if(t instanceof Lt)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t,this.set=t.split(/\s*\|\|\s*/).map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${t}`);this.format()}format(){return this.range=this.set.map(t=>t.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(t){let{loose:r}=this.options;t=t.trim();let i=r?re[ee.HYPHENRANGELOOSE]:re[ee.HYPHENRANGE];t=t.replace(i,ha(this.options.includePrerelease)),K("hyphen replace",t),t=t.replace(re[ee.COMPARATORTRIM],ta),K("comparator trim",t,re[ee.COMPARATORTRIM]),t=(t=(t=t.replace(re[ee.TILDETRIM],ra)).replace(re[ee.CARETTRIM],na)).split(/\s+/).join(" ");let a=r?re[ee.COMPARATORLOOSE]:re[ee.COMPARATOR];return t.split(" ").map(s=>ia(s,this.options)).join(" ").split(/\s+/).map(s=>da(s,this.options)).filter(this.options.loose?s=>!!s.match(a):()=>!0).map(s=>new Lt(s,this.options))}intersects(t,r){if(!(t instanceof lt))throw new TypeError("a Range is required");return this.set.some(i=>Wr(i,r)&&t.set.some(a=>Wr(a,r)&&i.every(s=>a.every(p=>s.intersects(p,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new Oe(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(ma(this.set[r],t,this.options))return!0;return!1}},{re,t:ee,comparatorTrimReplace:ta,tildeTrimReplace:ra,caretTrimReplace:na}=Qe,Wr=(e,t)=>{let r=!0,i=e.slice(),a=i.pop();for(;r&&i.length;)r=i.every(s=>a.intersects(s,t)),a=i.pop();return r},ia=(e,t)=>(K("comp",e,t),e=sa(e,t),K("caret",e),e=aa(e,t),K("tildes",e),e=la(e,t),K("xrange",e),e=fa(e,t),K("stars",e),e),ae=e=>!e||e.toLowerCase()==="x"||e==="*",aa=(e,t)=>e.trim().split(/\s+/).map(r=>oa(r,t)).join(" "),oa=(e,t)=>{let r=t.loose?re[ee.TILDELOOSE]:re[ee.TILDE];return e.replace(r,(i,a,s,p,h)=>{let R;return K("tilde",e,i,a,s,p,h),ae(a)?R="":ae(s)?R=`>=${a}.0.0 <${+a+1}.0.0-0`:ae(p)?R=`>=${a}.${s}.0 <${a}.${+s+1}.0-0`:h?(K("replaceTilde pr",h),R=`>=${a}.${s}.${p}-${h} <${a}.${+s+1}.0-0`):R=`>=${a}.${s}.${p} <${a}.${+s+1}.0-0`,K("tilde return",R),R})},sa=(e,t)=>e.trim().split(/\s+/).map(r=>ca(r,t)).join(" "),ca=(e,t)=>{K("caret",e,t);let r=t.loose?re[ee.CARETLOOSE]:re[ee.CARET],i=t.includePrerelease?"-0":"";return e.replace(r,(a,s,p,h,R)=>{let v;return K("caret",e,a,s,p,h,R),ae(s)?v="":ae(p)?v=`>=${s}.0.0${i} <${+s+1}.0.0-0`:ae(h)?v=s==="0"?`>=${s}.${p}.0${i} <${s}.${+p+1}.0-0`:`>=${s}.${p}.0${i} <${+s+1}.0.0-0`:R?(K("replaceCaret pr",R),v=s==="0"?p==="0"?`>=${s}.${p}.${h}-${R} <${s}.${p}.${+h+1}-0`:`>=${s}.${p}.${h}-${R} <${s}.${+p+1}.0-0`:`>=${s}.${p}.${h}-${R} <${+s+1}.0.0-0`):(K("no pr"),v=s==="0"?p==="0"?`>=${s}.${p}.${h}${i} <${s}.${p}.${+h+1}-0`:`>=${s}.${p}.${h}${i} <${s}.${+p+1}.0-0`:`>=${s}.${p}.${h} <${+s+1}.0.0-0`),K("caret return",v),v})},la=(e,t)=>(K("replaceXRanges",e,t),e.split(/\s+/).map(r=>ua(r,t)).join(" ")),ua=(e,t)=>{e=e.trim();let r=t.loose?re[ee.XRANGELOOSE]:re[ee.XRANGE];return e.replace(r,(i,a,s,p,h,R)=>{K("xRange",e,i,a,s,p,h,R);let v=ae(s),E=v||ae(p),O=E||ae(h),g=O;return a==="="&&g&&(a=""),R=t.includePrerelease?"-0":"",v?i=a===">"||a==="<"?"<0.0.0-0":"*":a&&g?(E&&(p=0),h=0,a===">"?(a=">=",E?(s=+s+1,p=0,h=0):(p=+p+1,h=0)):a==="<="&&(a="<",E?s=+s+1:p=+p+1),a==="<"&&(R="-0"),i=`${a+s}.${p}.${h}${R}`):E?i=`>=${s}.0.0${R} <${+s+1}.0.0-0`:O&&(i=`>=${s}.${p}.0${R} <${s}.${+p+1}.0-0`),K("xRange return",i),i})},fa=(e,t)=>(K("replaceStars",e,t),e.trim().replace(re[ee.STAR],"")),da=(e,t)=>(K("replaceGTE0",e,t),e.trim().replace(re[t.includePrerelease?ee.GTE0PRE:ee.GTE0],"")),ha=e=>(t,r,i,a,s,p,h,R,v,E,O,g,N)=>`${r=ae(i)?"":ae(a)?`>=${i}.0.0${e?"-0":""}`:ae(s)?`>=${i}.${a}.0${e?"-0":""}`:p?`>=${r}`:`>=${r}${e?"-0":""}`} ${R=ae(v)?"":ae(E)?`<${+v+1}.0.0-0`:ae(O)?`<${v}.${+E+1}.0-0`:g?`<=${v}.${E}.${O}-${g}`:e?`<${v}.${E}.${+O+1}-0`:`<=${R}`}`.trim(),ma=(e,t,r)=>{for(let i=0;i<e.length;i++)if(!e[i].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let i=0;i<e.length;i++)if(K(e[i].semver),e[i].semver!==Lt.ANY&&e[i].semver.prerelease.length>0){let a=e[i].semver;if(a.major===t.major&&a.minor===t.minor&&a.patch===t.patch)return!0}return!1}return!0},pa=(e,t,r)=>{try{t=new Pt(t,r)}catch{return!1}return t.test(e)},{MAX_LENGTH:va}=Ut,{re:Br,t:Gr}=Qe,Ea=(e,t)=>{if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof Oe)return e;if(typeof e!="string"||e.length>va||!(t.loose?Br[Gr.LOOSE]:Br[Gr.FULL]).test(e))return null;try{return new Oe(e,t)}catch{return null}},ya=Ea,{re:at,t:ot}=Qe,ga=(e,t)=>{if(e instanceof Oe)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;let r=null;if((t=t||{}).rtl){let i;for(;(i=at[ot.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&i.index+i[0].length===r.index+r[0].length||(r=i),at[ot.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;at[ot.COERCERTL].lastIndex=-1}else r=e.match(at[ot.COERCE]);return r===null?null:ya(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function Ia(e){return String.fromCharCode(parseInt(e.slice(1),16))}function wa(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function Ra(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,Ia))}function Aa(e){return decodeURIComponent(Array.from(atob(e),wa).join(""))}function Yr(e){return Ra(JSON.stringify(e))}function Sa(e){return JSON.parse(Aa(e))}function Xe(e){return typeof e>"u"}function ba(e){return e===null}function Xr(e){return ba(e)||Xe(e)}function _a(e){return Xr(e)?!1:!Xe(e.jsonrpc)&&!Xe(e.id)&&(!Xe(e.result)||!Xe(e.error))}function Oa(e){return Xr(e)?!1:typeof e=="number"&&Object.values(ke).includes(e)}function ft(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var Y={};function zr(e,t){return Object.assign(Y,t),e}var Na={"magic-sdk":"magic-sdk","@magic-sdk/react-native":"magic-sdk-rn","@magic-sdk/react-native-bare":"magic-sdk-rn-bare","@magic-sdk/react-native-expo":"magic-sdk-rn-expo"},Ne=class Jr extends Error{constructor(t,r){super(`Magic SDK Error: [${t}] ${r}`),this.code=t,this.rawMessage=r,this.__proto__=Error,Object.setPrototypeOf(this,Jr.prototype)}},ze=class Qr extends Error{constructor(t){super(),this.__proto__=Error;let r=Number(t?.code);this.rawMessage=t?.message||"Internal error",this.code=Oa(r)?r:ke.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=t?.data||void 0,Object.setPrototypeOf(this,Qr.prototype)}},Ue=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},xt=class Zr extends Error{constructor(t,r,i,a){super(`Magic Extension Error (${t.name}): [${r}] ${i}`),this.code=r,this.rawMessage=i,this.data=a,this.__proto__=Error,Object.setPrototypeOf(this,Zr.prototype)}},dt=class{constructor(e,t,r){this.code=t,this.rawMessage=r,this.message=`Magic Extension Warning (${e.name}): [${t}] ${r}`}log(){console.warn(this.message)}};function Ta(){return new Ne(ge.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function Ft(){return new Ne(ge.ModalNotReady,"Modal is not ready")}function Ma(){return new Ne(ge.MalformedResponse,"Response from the Magic iframe is malformed.")}function La(e){return new Ne(ge.ExtensionNotInitialized,`Extensions must be initialized with a Magic SDK instance before \`Extension.${e}\` can be accessed. Do not invoke \`Extension.${e}\` inside an extension constructor.`)}function Ca(e){let t=`Some extensions are incompatible with \`${Y.sdkName}@${Y.version}\`:`;return e.filter(r=>typeof r.compat<"u"&&r.compat!==null).forEach(r=>{let i=r.compat[Y.sdkName];typeof i=="string"?t+=`
2
+ - Extension \`${r.name}\` supports version(s) \`${i}\``:i||(t+=`
3
+ - Extension \`${r.name}\` does not support ${Y.platform} environments.`)}),new Ne(ge.IncompatibleExtensions,t)}function Pa(e){let t=r=>{let i=r+1,a=i%10,s=i%100;return a===1&&s!==11?`${i}st`:a===2&&s!==12?`${i}nd`:a===3&&s!==13?`${i}rd`:`${i}th`};return new Ne(ge.InvalidArgument,`Invalid ${t(e.argument)} argument given to \`${e.procedure}\`.
4
+ Expected: \`${e.expected}\`
5
+ Received: \`${e.received}\``)}function en(){return new Ue(Ie.DuplicateIframe,"Duplicate iframes found.")}function $a(){return new Ue(Ie.SyncWeb3Method,"Non-async web3 methods are deprecated in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.")}function Da(){return new Ue(Ie.ReactNativeEndpointConfiguration,`CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The \`endpoint\` parameter SHOULD NOT be provided. The Magic \`<iframe>\` is automatically wrapped by a WebView pointed at \`${Y.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}function Ua(e){let{method:t,removalVersions:r,useInstead:i}=e,a=r[Y.sdkName],s=i?` Use \`${i}\` instead.`:"",p=`\`${t}\` will be removed from \`${Y.sdkName}\` in version \`${a}\`.${s}`;return new Ue(Ie.DeprecationNotice,p)}function*xa(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}var Fa=xa();function tn(){return Fa.next().value}var rn=Symbol("Payload pre-processed by Magic SDK");function nn(e){return Object.defineProperty(e,rn,{value:!0,enumerable:!1}),e}function ka(e){return!!e[rn]}function ht(e){return ka(e)||(e.jsonrpc=e.jsonrpc??"2.0",e.id=tn(),e.method=e.method??"noop",e.params=e.params??[],nn(e)),e}function G(e,t=[]){return nn({params:t,method:e,jsonrpc:"2.0",id:tn()})}var an=class on{constructor(t){t instanceof on?(this.s=t.payload.jsonrpc,this.o=t.payload.id,this.n=t.payload.result,this.r=t.payload.error):_a(t)?(this.s=t.jsonrpc,this.o=t.id,this.n=t.result,this.r=t.error):(this.s=t.jsonrpc,this.o=t.id,this.n=void 0,this.r=void 0)}applyError(t){return this.r=t,this}applyResult(t){return this.n=t,this}get hasError(){return typeof this.r<"u"&&this.r!==null}get hasResult(){return typeof this.n<"u"}get payload(){return{jsonrpc:this.s,id:this.o,result:this.n,error:this.r}}},Wa=$i(Di()),Ba=class extends Wa.default{};function sn(){let e=new Ba;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...i)=>(e[t].apply(e,i),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var cn=Symbol("isPromiEvent");function kt(e){return!!e[cn]}function ye(e){let t=ln(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:i}=sn(),a=Symbol("Promise.then"),s=Symbol("Promise.catch"),p=Symbol("Promise.finally"),h=(E,O)=>(...g)=>{let N=O[E].apply(O,g);return R(N)},R=E=>Object.assign(E,{[cn]:!0,[a]:E[a]||E.then,[s]:E[s]||E.catch,[p]:E[p]||E.finally,then:h(a,E),catch:h(s,E),finally:h(p,E),on:i("on",E),once:i("once",E),addListener:i("addListener",E),off:i("off",E),removeListener:i("removeListener",E),removeAllListeners:i("removeAllListeners",E),emit:r("emit"),eventNames:r("eventNames"),listeners:r("listeners"),listenerCount:r("listenerCount")}),v=R(t.then(E=>(v.emit("done",E),v.emit("settled"),E),E=>{throw v.emit("error",E),v.emit("settled"),E}));return v.on(nt.ClosedByUser,()=>{v.emit(rt.ClosedByUser)}),v}function ln(e){return new Promise((t,r)=>{let i=e(t,r);Promise.resolve(i).catch(r)})}var Te=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){if(this.sdk.thirdPartyWallets.isConnected&&!Tt.includes(e.method))return ye((a,s)=>{this.sdk.thirdPartyWallets.requestOverride(e).then(a).catch(s)});let t=this.overlay.post(we.MAGIC_HANDLE_REQUEST,ht(e)),r=ye((a,s)=>{t.then(p=>{if(i(),p.hasError)s(new ze(p.payload.error));else if(p.hasResult)a(p.payload.result);else throw Ma()}).catch(p=>{i(),s(p)})}),i=this.overlay.on(fe.MAGIC_HANDLE_EVENT,a=>{let{response:s}=a.data;if(s.id===e.id&&s.result?.event){let{event:p,params:h=[]}=s.result;r.emit(p,...h)}});return r}createIntermediaryEvent(e,t){return r=>{let i=G(M.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(i)}}};function Ga(e,t){let[r]=e.split(".").map(Number);return r>=t}var Va={"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},ja=class extends Te{loginWithMagicLink(e){let t=Y.sdkName==="@magic-sdk/react-native"||Y.sdkName==="@magic-sdk/react-native-bare"||Y.sdkName==="@magic-sdk/react-native-expo";if(t&&Ga(Y.version,19))throw new Error("loginWithMagicLink() is deprecated for this package, please utlize a passcode method like loginWithSMS or loginWithEmailOTP instead.");t&&Ua({method:"auth.loginWithMagicLink()",removalVersions:Va,useInstead:"auth.loginWithEmailOTP()"}).log();let{email:r,showUI:i=!0,redirectURI:a,overrides:s,lifespan:p}=e,h=G(this.sdk.testMode?M.LoginWithMagicLinkTestMode:M.LoginWithMagicLink,[{email:r,showUI:i,redirectURI:a,overrides:s,lifespan:p}]);return this.request(h)}loginWithSMS(e){let{phoneNumber:t,showUI:r=!0,lifespan:i}=e,a=G(this.sdk.testMode?M.LoginWithSmsTestMode:M.LoginWithSms,[{phoneNumber:t,showUI:r,lifespan:i}]),s=this.request(a);return!r&&s&&(s.on(Pe.VerifySmsOtp,p=>{this.createIntermediaryEvent(Pe.VerifySmsOtp,a.id)(p)}),s.on(Pe.Cancel,()=>{this.createIntermediaryEvent(Pe.Cancel,a.id)()})),s}loginWithEmailOTP(e){let{email:t,showUI:r,deviceCheckUI:i,overrides:a,lifespan:s}=e,p=G(this.sdk.testMode?M.LoginWithEmailOTPTestMode:M.LoginWithEmailOTP,[{email:t,showUI:r,deviceCheckUI:i,overrides:a,lifespan:s}]),h=this.request(p);return!i&&h&&h.on(qe.Retry,()=>{this.createIntermediaryEvent(qe.Retry,p.id)()}),!r&&h&&(h.on(le.VerifyEmailOtp,R=>{this.createIntermediaryEvent(le.VerifyEmailOtp,p.id)(R)}),h.on(le.VerifyMFACode,R=>{this.createIntermediaryEvent(le.VerifyMFACode,p.id)(R)}),h.on(le.LostDevice,()=>{this.createIntermediaryEvent(le.LostDevice,p.id)()}),h.on(le.VerifyRecoveryCode,R=>{this.createIntermediaryEvent(le.VerifyRecoveryCode,p.id)(R)}),h.on(le.Cancel,()=>{this.createIntermediaryEvent(le.Cancel,p.id)()})),h}loginWithCredential(e){let{credentialOrQueryString:t,lifespan:r}=e||{},i=t??"";if(!t&&Y.platform==="web"){i=window.location.search;let s=window.location.origin+window.location.pathname;window.history.replaceState(null,"",s)}let a=G(this.sdk.testMode?M.LoginWithCredentialTestMode:M.LoginWithCredential,[i,r]);return this.request(a)}setAuthorizationToken(e){let t=G(M.SetAuthorizationToken,[{jwt:e}]);return this.request(t)}updateEmailWithUI(e){let{email:t,showUI:r=!0}=e,i=G(this.sdk.testMode?M.UpdateEmailTestMode:M.UpdateEmail,[{email:t,showUI:r}]),a=this.request(i);return r||(a.on(ce.Retry,()=>{this.createIntermediaryEvent(ce.Retry,i.id)()}),a.on(ce.Cancel,()=>{this.createIntermediaryEvent(ce.Cancel,i.id)()}),a.on(ce.VerifyEmailOtp,s=>{this.createIntermediaryEvent(ce.VerifyEmailOtp,i.id)(s)}),a.on(ce.VerifyMFACode,s=>{this.createIntermediaryEvent(ce.VerifyMFACode,i.id)(s)}),a.on(te.RetryWithNewEmail,s=>{this.createIntermediaryEvent(te.RetryWithNewEmail,i.id)(s)}),a.on(te.Cancel,()=>{this.createIntermediaryEvent(te.Cancel,i.id)()}),a.on(te.VerifyEmailOtp,s=>{this.createIntermediaryEvent(te.VerifyEmailOtp,i.id)(s)})),a}},un={};Ci(un,{clear:()=>Ha,getItem:()=>de,iterate:()=>fn,key:()=>Ka,keys:()=>Ya,length:()=>qa,removeItem:()=>mt,setItem:()=>_e});var st;function Me(e){return async(...t)=>(st||(st=await Y.configureStorage()),await st.ready(),st[e](...t))}var de=Me("getItem"),_e=Me("setItem"),mt=Me("removeItem"),Ha=Me("clear"),qa=Me("length"),Ka=Me("key"),Ya=Me("keys"),fn=Me("iterate");function Xa(){let e=window.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&191|128;let t="";return t+=e[0].toString(16),t+=e[1].toString(16),t+=e[2].toString(16),t+=e[3].toString(16),t+="-",t+=e[4].toString(16),t+=e[5].toString(16),t+="-",t+=e[6].toString(16),t+=e[7].toString(16),t+="-",t+=e[8].toString(16),t+=e[9].toString(16),t+="-",t+=e[10].toString(16),t+=e[11].toString(16),t+=e[12].toString(16),t+=e[13].toString(16),t+=e[14].toString(16),t+=e[15].toString(16),t}var dn="STORE_KEY_PRIVATE_KEY",$t="STORE_KEY_PUBLIC_JWK",hn="ECDSA",za="P-256",Ja={name:hn,namedCurve:za};function vt(){let e=typeof window<"u"&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}async function Qa(){let e=await Za();if(!e){console.info("unable to create public key or webcrypto is unsupported");return}let{subtle:t}=window.crypto,r=await de(dn);if(!r||!t){console.info("unable to find private key or webcrypto unsupported");return}let i={iat:Math.floor(new Date().getTime()/1e3),jti:Xa()},a={protected:Vr(JSON.stringify({typ:"dpop+jwt",alg:"ES256",jwk:e})),claims:Vr(JSON.stringify(i))},s=to(`${a.protected}.${a.claims}`),p={name:hn,hash:{name:"SHA-256"}},h=no(new Uint8Array(await t.sign(p,r,s)));return`${a.protected}.${a.claims}.${h}`}async function Za(){if(!vt()){console.info("webcrypto is not supported");return}return await de($t)||await eo(),de($t)}async function eo(){let{subtle:e}=window.crypto,t=await e.generateKey(Ja,!1,["sign"]),r=await e.exportKey("jwk",t.publicKey);await _e(dn,t.privateKey),await _e($t,r)}function Vr(e){return mn(ro(e))}function to(e){return new TextEncoder().encode(e)}function mn(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}function ro(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(t,r)=>String.fromCharCode(parseInt(r,16)))}function no(e){let t="";return e.forEach(r=>{t+=String.fromCharCode(r)}),mn(t)}var Wt="ds",Bt="ek",Gt="iv",Vt="AES-GCM",io=256;async function pn(){let e=[];await fn((t,r,i)=>{r.startsWith(`${Wt}_`)&&e.push(r)});for(let t of e)await mt(t)}function vn(e){let t="",r=new Uint8Array(e),i=r.byteLength;for(let a=0;a<i;a++)t+=String.fromCharCode(r[a]);return window.btoa(t)}function En(e){let t=window.atob(e),r=t.length,i=new Uint8Array(r);for(let a=0;a<r;a++)i[a]=t.charCodeAt(a);return i.buffer}async function ao(){if(!vt()){console.info("webcrypto is not supported");return}let{crypto:e}=window;return await de(Gt)||e.getRandomValues(new Uint8Array(12))}async function oo(){if(!vt()){console.info("webcrypto is not supported");return}let{subtle:e}=window.crypto;return await de(Bt)||await e.generateKey({name:Vt,length:io},!1,["encrypt","decrypt"])}async function so(e,t){let r=await ao(),i=await oo();if(!r||!i||!e)return;let a=En(e),{subtle:s}=window.crypto,p=await s.encrypt({name:Vt,iv:r},i,a),h=vn(p);await _e(`${Wt}_${t}`,h),await _e(Bt,i),await _e(Gt,r)}async function co(e){let t=await de(`${Wt}_${e}`),r=await de(Gt),i=await de(Bt);if(!r||!t||!i||!vt())return;let{subtle:a}=window.crypto,s=await a.decrypt({name:Vt,iv:r},i,En(t));return vn(s)}function Je(e,t){return t?new URL(e,t):new URL(e)}var lo=class extends Te{constructor(){super(...arguments),this.localForageIsLoggedInKey="magic_auth_is_logged_in",this.userLoggedOutCallbacks=[]}getIdToken(e){let t=G(this.sdk.testMode?M.GetIdTokenTestMode:M.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=G(this.sdk.testMode?M.GenerateIdTokenTestMode:M.GenerateIdToken,[e]);return this.request(t)}getInfo(){let e=G(M.GetInfo,[]);return this.request(e)}isLoggedIn(){return ye(async(e,t)=>{try{let r=!1;this.sdk.useStorageCache&&(r=await de(this.localForageIsLoggedInKey)==="true",r&&e(!0));let i=G(this.sdk.testMode?M.IsLoggedInTestMode:M.IsLoggedIn),a=await this.request(i);this.sdk.useStorageCache&&(a?_e(this.localForageIsLoggedInKey,!0):mt(this.localForageIsLoggedInKey),r&&!a&&this.emitUserLoggedOut(!0)),e(a)}catch(r){t(r)}})}logout(){return mt(this.localForageIsLoggedInKey),pn(),ye(async(e,t)=>{try{let r=G(this.sdk.testMode?M.LogoutTestMode:M.Logout),i=await this.request(r);this.sdk.useStorageCache&&this.emitUserLoggedOut(i),e(i)}catch(r){t(r)}})}requestInfoWithUI(e){let t=G(M.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}showSettings(e){let{showUI:t=!0}=e||{},r=G(this.sdk.testMode?M.UserSettingsTestMode:M.UserSettings,[e]),i=this.request(r);return!t&&i&&(i.on(me.SendNewPhoneNumber,a=>{this.createIntermediaryEvent(me.SendNewPhoneNumber,r.id)(a)}),i.on(me.SendOtpCode,a=>{this.createIntermediaryEvent(me.SendOtpCode,r.id)(a)}),i.on(me.StartEditPhoneNumber,()=>{this.createIntermediaryEvent(me.StartEditPhoneNumber,r.id)()}),i.on(me.Cancel,()=>{this.createIntermediaryEvent(me.Cancel,r.id)()}),i.on(ce.VerifyEmailOtp,a=>{this.createIntermediaryEvent(ce.VerifyEmailOtp,r.id)(a)})),i}recoverAccount(e){let{email:t,showUI:r}=e,i=G(this.sdk.testMode?M.RecoverAccountTestMode:M.RecoverAccount,[{email:t,showUI:r}]),a=this.request(i);return!r&&a&&(a.on(pe.Cancel,()=>{this.createIntermediaryEvent(pe.Cancel,i.id)()}),a.on(pe.ResendSms,()=>{this.createIntermediaryEvent(pe.ResendSms,i.id)()}),a.on(pe.VerifyOtp,s=>{this.createIntermediaryEvent(pe.VerifyOtp,i.id)(s)}),a.on(pe.UpdateEmail,s=>{this.createIntermediaryEvent(pe.UpdateEmail,i.id)(s)}),a.on(te.Cancel,()=>{this.createIntermediaryEvent(te.Cancel,i.id)()}),a.on(te.RetryWithNewEmail,s=>{this.createIntermediaryEvent(te.RetryWithNewEmail,i.id)(s)}),a.on(te.VerifyEmailOtp,s=>{this.createIntermediaryEvent(te.VerifyEmailOtp,i.id)(s)})),a}revealPrivateKey(){let e=G(M.RevealPK);return this.request(e)}onUserLoggedOut(e){this.userLoggedOutCallbacks.push(e)}enableMFA(e){let{showUI:t=!0}=e,r=G(M.EnableMFA,[{showUI:t}]),i=this.request(r);return!t&&i&&(i.on($e.VerifyMFACode,a=>{this.createIntermediaryEvent($e.VerifyMFACode,r.id)(a)}),i.on($e.Cancel,()=>{this.createIntermediaryEvent($e.Cancel,r.id)()})),i}disableMFA(e){let{showUI:t=!0}=e,r=G(M.DisableMFA,[{showUI:t}]),i=this.request(r);return!t&&i&&(i.on(Re.VerifyMFACode,a=>{this.createIntermediaryEvent(Re.VerifyMFACode,r.id)(a)}),i.on(Re.LostDevice,a=>{this.createIntermediaryEvent(Re.LostDevice,r.id)(a)}),i.on(Re.Cancel,()=>{this.createIntermediaryEvent(Re.Cancel,r.id)()})),i}emitUserLoggedOut(e){this.userLoggedOutCallbacks.forEach(t=>{t(e)})}},uo=class extends Te{connectWithUI(e){let t=ye(async(r,i)=>{try{let a=G(M.Login,[{enabledWallets:this.sdk.thirdPartyWallets.enabledWallets,...e}]),s=this.request(a);this.sdk.thirdPartyWallets.eventListeners.forEach(({event:h,callback:R})=>{s.on(h,()=>R(a.id))}),s.on("id-token-created",h=>{t.emit("id-token-created",h)});let p=await s;p.error&&i(p),r(p)}catch(a){i(a)}});return t}showUI(e){return this.request(G(M.ShowUI,[e]))}showAddress(){return this.request(G(M.ShowAddress))}showSendTokensUI(){return this.request(G(M.ShowSendTokensUI))}showOnRamp(){return this.request(G(M.ShowOnRamp))}showNFTs(){return this.request(G(M.ShowNFTs))}showBalances(){return this.request(G(M.ShowBalances))}sendGaslessTransaction(e,t){return this.request(G(M.SendGaslessTransaction,[e,t]))}},fo=class extends Te{constructor(){super(...arguments),this.eventListeners=[],this.enabledWallets={},this.isConnected=!1}resetThirdPartyWalletState(){localStorage.removeItem(ve.PROVIDER),localStorage.removeItem(ve.ADDRESS),localStorage.removeItem(ve.CHAIN_ID),this.isConnected=!1}requestOverride(e){if(e.method===M.Login)return this.resetThirdPartyWalletState(),super.request(e);if(e.method===M.GetInfo)return this.getInfo(e);if(e.method===M.IsLoggedIn)return this.isLoggedIn(e);if(e.method===M.Logout)return this.logout(e);switch(localStorage.getItem(ve.PROVIDER)){case"web3modal":return this.web3modalRequest(e);default:return this.resetThirdPartyWalletState(),super.request(e)}}isLoggedIn(e){switch(localStorage.getItem(ve.PROVIDER)){case"web3modal":return this.web3modalIsLoggedIn();default:return this.resetThirdPartyWalletState(),super.request(e)}}getInfo(e){switch(localStorage.getItem(ve.PROVIDER)){case"web3modal":return this.web3modalGetInfo();default:return this.resetThirdPartyWalletState(),super.request(e)}}logout(e){let t=localStorage.getItem(ve.PROVIDER);switch(this.resetThirdPartyWalletState(),t){case"web3modal":return this.web3modalLogout();default:return super.request(e)}}web3modalRequest(e){return ye((t,r)=>{this.sdk.web3modal.modal.getWalletProvider().request(e).then(t).catch(r)})}web3modalIsLoggedIn(){return ye(e=>{let t=this.sdk.web3modal.modal.getStatus();if(t==="connected"&&e(!0),t==="disconnected"&&(this.resetThirdPartyWalletState(),e(!1)),t==="reconnecting"){let r=this.sdk.web3modal.modal.subscribeProvider(({status:i})=>{i==="connected"&&(r(),e(!0)),i==="disconnected"&&(r(),this.resetThirdPartyWalletState(),e(!1))})}})}formatWeb3modalGetInfoResponse(){let e=this.sdk.web3modal.modal.getWalletInfo()?.name,t=this.sdk.web3modal.modal.getAddress();return{publicAddress:t,email:null,issuer:`did:ethr:${t}`,phoneNumber:null,isMfaEnabled:!1,recoveryFactors:[],walletType:e||"web3modal"}}web3modalGetInfo(){return ye((e,t)=>{let r=this.sdk.web3modal.modal.getStatus();if(r==="connected"&&e(this.formatWeb3modalGetInfoResponse()),r==="disconnected"&&(this.resetThirdPartyWalletState(),t("Magic RPC Error: [-32603] Internal error: User denied account access.")),r==="reconnecting"){let i=this.sdk.web3modal.modal.subscribeProvider(({status:a})=>{a==="connected"&&(i(),e(this.formatWeb3modalGetInfoResponse())),a==="disconnected"&&(i(),this.resetThirdPartyWalletState(),t("Magic RPC Error: [-32603] Internal error: User denied account access."))})}})}web3modalLogout(){return ye(async e=>{try{await this.sdk.web3modal.modal.disconnect()}catch(t){console.error(t)}e(!0)})}},{createBoundEmitterMethod:ct,createChainingEmitterMethod:We}=sn(),ho=class extends Te{constructor(){super(...arguments),this.isMagic=!0,this.on=We("on",this),this.once=We("once",this),this.addListener=We("addListener",this),this.off=We("off",this),this.removeListener=We("removeListener",this),this.removeAllListeners=We("removeAllListeners",this),this.emit=ct("emit"),this.eventNames=ct("eventNames"),this.listeners=ct("listeners"),this.listenerCount=ct("listenerCount")}sendAsync(e,t){if(!t)throw Pa({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:t===null?"null":typeof t});if(Array.isArray(e))this.overlay.post(we.MAGIC_HANDLE_REQUEST,e.map(r=>{let i=ht(r);return this.prefixPayloadMethodForTestMode(i),i})).then(r=>{t(null,r.map(i=>({...i.payload,error:i.hasError?new ze(i.payload.error):null})))});else{let r=ht(e);this.prefixPayloadMethodForTestMode(r),this.overlay.post(we.MAGIC_HANDLE_REQUEST,r).then(i=>{t(i.hasError?new ze(i.payload.error):null,i.payload)})}}send(e,t){if(typeof e=="string"){let i=G(e,Array.isArray(t)?t:[]);return this.request(i)}if(Array.isArray(e)||t){this.sendAsync(e,t);return}let r=$a();return r.log(),new an(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=G(M.Login);return this.request(e)}request(e){return this.prefixPayloadMethodForTestMode(e),super.request(e)}prefixPayloadMethodForTestMode(e){let t="testMode/eth/";this.sdk.testMode&&(e.method=`${t}${e.method}`)}},jr=["request","overlay","sdk"];function mo(e){let t=Object.getPrototypeOf(e),r=[t];for(;t!==Te.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}var po=class extends Te{constructor(){super(void 0),this.a=new Map,this.l=!1,this.utils={createPromiEvent:ye,isPromiEvent:kt,encodeJSON:Yr,decodeJSON:Sa,createJsonRpcRequestPayload:G,standardizeJsonRpcRequestPayload:ht,storage:un};let e=[this,...mo(this)];jr.forEach(t=>{let r=e.map(p=>Object.getOwnPropertyDescriptor(p,t)),i=r.findIndex(p=>!!p),a=i>0,s=r[i];s&&(this.a.set(t,{descriptor:s,isPrototypeField:a}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw La(t)}}))})}init(e){this.l||(jr.forEach(t=>{if(this.a.has(t)){let{descriptor:r,isPrototypeField:i}=this.a.get(t);i?delete this[t]:Object.defineProperty(this,t,r)}}),this.sdk=e,this.l=!0)}createDeprecationWarning(e){let{method:t,removalVersion:r,useInstead:i}=e,a=i?` Use \`${i}\` instead.`:"",s=`\`${t}\` will be removed from this Extension in version \`${r}\`.${a}`;return new dt(this,"DEPRECATION_NOTICE",s)}createWarning(e,t){return new dt(this,e,t)}createError(e,t,r){return new xt(this,e,t,r)}},vo=class extends po{},pt=class{static{this.Internal=vo}},Eo=class extends Te{purchase(e){let t=G(M.NFTPurchase,[e]);return this.request(t)}checkout(e){let t=this.sdk.thirdPartyWallets.isConnected,r=G(M.NFTCheckout,[{...e,walletProvider:t?"web3modal":"magic"}]),i=this.request(r);return t&&(i.on(De.Initiated,async a=>{try{let s=await this.request({method:"eth_sendTransaction",params:[a]});this.createIntermediaryEvent(De.Success,r.id)(s)}catch{this.createIntermediaryEvent(De.Failure,r.id)()}}),i.on(De.Disconnect,()=>{this.sdk.thirdPartyWallets.resetThirdPartyWalletState(),i.emit("disconnect")})),i}transfer(e){let t=G(M.NFTTransfer,[e]);return this.request(t)}};function Hr(e){return e.compat&&e.compat[Y.sdkName]!=null?typeof e.compat[Y.sdkName]=="string"?pa(ga(Y.version),e.compat[Y.sdkName]):!!e.compat[Y.sdkName]:!0}function yo(e,t,r){return!t&&!r?`${e}_eth_mainnet`:r?`${e}_${JSON.stringify(r)}`:t?typeof t=="string"?`${e}_eth_${t}`:`${e}_${t.rpcUrl}_${t.chainId}_${t.chainType}`:`${e}_unknown`}function go(e){let t=e?.extensions??[],r={},i=[];if(Array.isArray(t)?t.forEach(a=>{Hr(a)?(a.init(this),a.name&&(this[a.name]=a),a instanceof pt.Internal&&(ft(a.config)||(r[a.name]=a.config))):i.push(a)}):Object.keys(t).forEach(a=>{if(Hr(t[a])){t[a].init(this);let s=t[a];this[a]=s,s instanceof pt.Internal&&(ft(s.config)||(r[t[a].name]=s.config))}else i.push(t[a])}),i.length)throw Ca(i);return r}var yn=class ut{constructor(t,r){if(this.apiKey=t,!t)throw Ta();Y.platform==="react-native"&&r?.endpoint&&Da().log();let{defaultEndpoint:i,version:a}=Y;this.testMode=!!r?.testMode,this.useStorageCache=!!r?.useStorageCache,this.endpoint=Je(r?.endpoint??i).origin,this.auth=new ja(this),this.user=new lo(this),this.wallet=new uo(this),this.nft=new Eo(this),this.thirdPartyWallets=new fo(this),this.rpcProvider=new ho(this);let s=go.call(this,r);this.parameters=Yr({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:r?.network,host:Je(this.endpoint).host,sdk:Na[Y.sdkName],version:a,ext:ft(s)?void 0:s,locale:r?.locale||"en_US",...Y.bundleId?{bundleId:Y.bundleId}:{},meta:r?.meta}),this.networkHash=yo(this.apiKey,r?.network,ft(s)?void 0:s),r?.deferPreload||this.preload()}static{this.c=new Map}get overlay(){if(!ut.c.has(this.parameters)){let t=new Y.ViewController(this.endpoint,this.parameters,this.networkHash);t.init(),ut.c.set(this.parameters,t)}return ut.c.get(this.parameters)}async preload(){await this.overlay.waitForReady()}};function Io(e,t){return t&&Array.isArray(e)?e.find(r=>r.id===t):e}function wo(e,t){let r=t.data.response?.id,i=Io(e,r);if(r&&i){let a=new an(i).applyResult(t.data.response.result).applyError(t.data.response.error);return{id:r,response:a}}return{}}async function Ro(e,t,r){let i=await de("rt"),a;if(Y.platform==="web")try{a=await de("jwt")??await Qa()}catch(h){console.error("webcrypto error",h)}let s={msgType:e,payload:t};a&&(s.jwt=a),a&&i&&(s.rt=i);let p=await co(r);return p&&(s.deviceShare=p),s}async function Ao(e){e.data.rt&&await _e("rt",e.data.rt)}function So(e,t){let r=null;return function(...i){r&&clearTimeout(r),r=setTimeout(()=>{e(...i)},t)}}var bo=1e3,gn=60*bo,qr=5*gn,_o=60*gn,In=class{constructor(e,t,r){this.endpoint=e,this.parameters=t,this.networkHash=r,this.isReadyForRequest=!1,this.messageHandlers=new Set,this.isConnectedToInternet=!0,this.lastPongTime=null,this.heartbeatIntervalTimer=null,this.heartbeatDebounce=So(()=>{this.endpoint==="https://auth.magic.link/"&&this.heartBeatCheck()},_o),this.listen()}async post(e,t){return ln(async(r,i)=>{if(!this.isConnectedToInternet){let v=Ft();i(v)}await this.checkRelayerExistsInDOM()||(this.isReadyForRequest=!1,await this.reloadRelayer()),this.isReadyForRequest||await this.waitForReady();let a=[],s=Array.isArray(t)?t.map(v=>v.id):[],p=await Ro(`${e}-${this.parameters}`,t,this.networkHash);await this.d(p);let h=v=>E=>{let{id:O,response:g}=wo(t,E);if(Ao(E),g?.payload.error?.message==="User denied account access.")pn();else if(E.data.deviceShare){let{deviceShare:N}=E.data;so(N,this.networkHash)}O&&g&&Array.isArray(t)&&s.includes(O)?(a.push(g),a.length===t.length&&(v(),r(a))):O&&g&&!Array.isArray(t)&&O===t.id&&(v(),r(g))},R=this.on(fe.MAGIC_HANDLE_RESPONSE,h(()=>R()))})}on(e,t){let r=t.bind(window),i=a=>{a.data.msgType===`${e}-${this.parameters}`&&r(a)};return this.messageHandlers.add(i),()=>this.messageHandlers.delete(i)}waitForReady(){return new Promise(e=>{let t=this.on(fe.MAGIC_OVERLAY_READY,()=>{this.isReadyForRequest=!0,e(),t()})})}listen(){this.on(fe.MAGIC_HIDE_OVERLAY,()=>{this.hideOverlay()}),this.on(fe.MAGIC_SHOW_OVERLAY,()=>{this.showOverlay()}),this.on(fe.MAGIC_SEND_PRODUCT_ANNOUNCEMENT,e=>{e.data.response.result.product_announcement&&new Ue(Ie.ProductAnnouncement,e.data.response.result.product_announcement).log()})}heartBeatCheck(){let e=!0,t=async()=>{let r={msgType:`${we.MAGIC_PING}-${this.parameters}`,payload:[]};await this.d(r)};this.heartbeatIntervalTimer=setInterval(async()=>{if(this.lastPongTime){if(Date.now()-this.lastPongTime>qr*2){this.reloadRelayer(),e=!0;return}}else if(!e){this.reloadRelayer(),e=!0;return}await t(),e=!1},qr)}stopHeartBeat(){this.heartbeatDebounce(),this.lastPongTime=null,this.heartbeatIntervalTimer&&(clearInterval(this.heartbeatIntervalTimer),this.heartbeatIntervalTimer=null)}};var jt={};dr(jt,{AuthEventOnReceived:()=>Sr,DeepLinkPage:()=>vr,DeviceVerificationEventEmit:()=>qe,DeviceVerificationEventOnReceived:()=>wr,DisableMFAEventEmit:()=>Re,DisableMFAEventOnReceived:()=>Or,EnableMFAEventEmit:()=>$e,EnableMFAEventOnReceived:()=>_r,EthChainType:()=>Nr,Extension:()=>pt,ExtensionError:()=>xt,ExtensionWarning:()=>dt,FarcasterLoginEventEmit:()=>br,LocalStorageKeys:()=>ve,LoginWithEmailOTPEventEmit:()=>le,LoginWithEmailOTPEventOnReceived:()=>Ir,LoginWithMagicLinkEventEmit:()=>Er,LoginWithMagicLinkEventOnReceived:()=>yr,LoginWithSmsOTPEventEmit:()=>Pe,LoginWithSmsOTPEventOnReceived:()=>gr,MagicIncomingWindowMessage:()=>fe,MagicOutgoingWindowMessage:()=>we,MagicPayloadMethod:()=>M,NftCheckoutIntermediaryEvents:()=>De,RPCError:()=>ze,RPCErrorCode:()=>ke,RecencyCheckEventEmit:()=>ce,RecencyCheckEventOnReceived:()=>Rr,RecoverAccountEventEmit:()=>pe,RecoverAccountEventOnReceived:()=>Lr,RecoveryFactorEventEmit:()=>me,RecoveryFactorEventOnReceived:()=>Tr,RecoveryMethodType:()=>Mr,SDKError:()=>Ne,SDKErrorCode:()=>ge,SDKWarning:()=>Ue,SDKWarningCode:()=>Ie,ThirdPartyWalletEvents:()=>pr,UiEventsEmit:()=>Pr,UpdateEmailEventEmit:()=>te,UpdateEmailEventOnReceived:()=>Ar,UserEventsEmit:()=>rt,UserEventsOnReceived:()=>nt,WalletEventOnReceived:()=>Cr,isPromiEvent:()=>kt,routeToMagicMethods:()=>Tt});var gt=mr(Rn()),bn=mr(Sn());var Oo={display:"block",visibility:"hidden",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",opacity:"0",zIndex:"-1"};function No(e){for(let[t,r]of Object.entries(Oo))e.style[t]=r}function To(e){return!![].slice.call(document.querySelectorAll(".magic-iframe")).find(r=>r.src.includes(e))}var yt=class extends In{constructor(){super(...arguments);this.activeElement=null;this.relayerSrc=Je(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href}init(){this.test="hello",this.iframe=new Promise(r=>{let i=()=>{if(To(encodeURIComponent(this.parameters)))en().log();else{let a=document.createElement("iframe");a.classList.add("magic-iframe"),a.dataset.magicIframeLabel=Je(this.endpoint).host,a.title="Secure Modal",a.src=this.relayerSrc,a.allow="clipboard-read; clipboard-write",No(a),document.body.appendChild(a),r(a)}};["loaded","interactive","complete"].includes(document.readyState)?i():window.addEventListener("load",i,!1)}),this.iframe.then(r=>{r instanceof HTMLIFrameElement&&r.addEventListener("load",async()=>{this.heartbeatDebounce()})}),window.addEventListener("message",r=>{if(r.origin===this.endpoint&&r.data.msgType&&(r.data.msgType.includes(fe.MAGIC_PONG)&&(this.lastPongTime=Date.now()),r.data&&this.messageHandlers.size)){r.data.response=r.data.response??{},this.stopHeartBeat();for(let i of this.messageHandlers.values())i(r)}}),window.addEventListener("beforeunload",()=>{this.stopHeartBeat()})}async showOverlay(){let r=await this.iframe;r.style.visibility="visible",r.style.zIndex="2147483647",r.style.opacity="1",this.activeElement=document.activeElement,r.focus()}async hideOverlay(){let r=await this.iframe;r.style.visibility="hidden",r.style.zIndex="-1",r.style.opacity="0",this.activeElement?.focus&&this.activeElement.focus(),this.activeElement=null}async _(r){let i=await this.iframe;if(i&&i.contentWindow)i.contentWindow.postMessage(r,this.endpoint);else throw Ft()}async checkRelayerExistsInDOM(){let r=await this.iframe;return!r||!r.contentWindow?!1:!![].slice.call(document.querySelectorAll(".magic-iframe")).find(a=>a.src.includes(encodeURIComponent(this.parameters)))}async reloadRelayer(){let r=await this.iframe;if(this.stopHeartBeat(),!r){this.init(),console.warn("Magic SDK: Modal lost, re-initiating");return}if(!r.contentWindow){document.body.appendChild(r),console.warn("Magic SDK: Modal did not append in the iframe, re-initiating");return}r&&(r.src=this.relayerSrc)}};var Mo=Object.assign(zr(yn,{platform:"web",sdkName:"magic-sdk",version:"29.0.5",defaultEndpoint:"https://auth.magic.link/",ViewController:yt,configureStorage:async()=>{let e=gt.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return await e.defineDriver(bn),await e.setDriver([gt.default.INDEXEDDB,gt.default.LOCALSTORAGE,bn.f]),e}}),{...jt}),Lo=Mo;return bi(Co);})();
6
6
  if (Magic && Magic.default != null) { Magic = Object.assign(Magic.default, Magic); delete Magic.default; }
@@ -1,7 +1,7 @@
1
1
  import { SDKBase } from '@magic-sdk/provider';
2
2
  import * as publicAPI from '@magic-sdk/commons';
3
3
  declare const Magic: import("@magic-sdk/provider").WithExtensions<SDKBase> & {
4
- MagicExtension: typeof publicAPI.MagicExtension;
4
+ Extension: typeof publicAPI.Extension;
5
5
  SDKError: typeof publicAPI.SDKError;
6
6
  ExtensionError: typeof publicAPI.ExtensionError;
7
7
  ExtensionWarning: typeof publicAPI.ExtensionWarning;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magic-sdk",
3
- "version": "29.0.6-canary.879.14607005869.0",
3
+ "version": "29.0.6-canary.882.14610528151.0",
4
4
  "description": "Passwordless authentication for the web.",
5
5
  "author": "Magic Labs <team@magic.link> (https://magic.link/)",
6
6
  "license": "MIT",
@@ -29,10 +29,10 @@
29
29
  ]
30
30
  },
31
31
  "dependencies": {
32
- "@magic-sdk/commons": "25.0.6-canary.879.14607005869.0",
33
- "@magic-sdk/provider": "29.0.6-canary.879.14607005869.0",
32
+ "@magic-sdk/commons": "25.0.6-canary.882.14610528151.0",
33
+ "@magic-sdk/provider": "29.0.6-canary.882.14610528151.0",
34
34
  "@magic-sdk/types": "^24.18.1",
35
35
  "localforage": "^1.7.4"
36
36
  },
37
- "gitHead": "55f7f25f30ee73abaf3c27d2c07d6bd9caae310a"
37
+ "gitHead": "e4a4622f6dc10ec41402739d6a22b207f3fbf081"
38
38
  }