magic-sdk 17.1.0-canary.497.4747818170.0 → 17.1.0-canary.497.4757057714.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 +3 -3
- package/package.json +5 -5
package/dist/magic.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
"use strict";var Magic=(()=>{var Fn=Object.create;var Fe=Object.defineProperty;var Gn=Object.getOwnPropertyDescriptor;var jn=Object.getOwnPropertyNames,Qt=Object.getOwnPropertySymbols,Kn=Object.getPrototypeOf,er=Object.prototype.hasOwnProperty,qn=Object.prototype.propertyIsEnumerable;var Zt=(e,t,n)=>t in e?Fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tr=(e,t)=>{for(var n in t||(t={}))er.call(t,n)&&Zt(e,n,t[n]);if(Qt)for(var n of Qt(t))qn.call(t,n)&&Zt(e,n,t[n]);return e};var Ge=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,n)=>(typeof require!="undefined"?require:t)[n]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var rr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),nr=(e,t)=>{for(var n in t)Fe(e,n,{get:t[n],enumerable:!0})},ir=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of jn(t))!er.call(e,s)&&s!==n&&Fe(e,s,{get:()=>t[s],enumerable:!(o=Gn(t,s))||o.enumerable});return e};var or=(e,t,n)=>(n=e!=null?Fn(Kn(e)):{},ir(t||!e||!e.__esModule?Fe(n,"default",{value:e,enumerable:!0}):n,e)),Vn=e=>ir(Fe({},"__esModule",{value:!0}),e);var Me=(e,t,n)=>new Promise((o,s)=>{var c=v=>{try{p(n.next(v))}catch(g){s(g)}},m=v=>{try{p(n.throw(v))}catch(g){s(g)}},p=v=>v.done?o(v.value):Promise.resolve(v.value).then(c,m);p((n=n.apply(e,t)).next())});var jr=rr((Gr,Lt)=>{(function(e){if(typeof Gr=="object"&&typeof Lt<"u")Lt.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,n;return function o(s,c,m){function p(y,N){if(!c[y]){if(!s[y]){var I=typeof Ge=="function"&&Ge;if(!N&&I)return I(y,!0);if(v)return v(y,!0);var M=new Error("Cannot find module '"+y+"'");throw M.code="MODULE_NOT_FOUND",M}var $=c[y]={exports:{}};s[y][0].call($.exports,function(k){var O=s[y][1][k];return p(O||k)},$,$.exports,o,s,c,m)}return c[y].exports}for(var v=typeof Ge=="function"&&Ge,g=0;g<m.length;g++)p(m[g]);return p}({1:[function(o,s,c){(function(m){"use strict";var p=m.MutationObserver||m.WebKitMutationObserver,v;if(p){var g=0,y=new p(k),N=m.document.createTextNode("");y.observe(N,{characterData:!0}),v=function(){N.data=g=++g%2}}else if(!m.setImmediate&&typeof m.MessageChannel<"u"){var I=new m.MessageChannel;I.port1.onmessage=k,v=function(){I.port2.postMessage(0)}}else"document"in m&&"onreadystatechange"in m.document.createElement("script")?v=function(){var W=m.document.createElement("script");W.onreadystatechange=function(){k(),W.onreadystatechange=null,W.parentNode.removeChild(W),W=null},m.document.documentElement.appendChild(W)}:v=function(){setTimeout(k,0)};var M,$=[];function k(){M=!0;for(var W,J,D=$.length;D;){for(J=$,$=[],W=-1;++W<D;)J[W]();D=$.length}M=!1}s.exports=O;function O(W){$.push(W)===1&&!M&&v()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(o,s,c){"use strict";var m=o(1);function p(){}var v={},g=["REJECTED"],y=["FULFILLED"],N=["PENDING"];s.exports=I;function I(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=N,this.queue=[],this.outcome=void 0,S!==p&&O(this,S)}I.prototype.catch=function(S){return this.then(null,S)},I.prototype.then=function(S,F){if(typeof S!="function"&&this.state===y||typeof F!="function"&&this.state===g)return this;var U=new this.constructor(p);if(this.state!==N){var q=this.state===y?S:F;$(U,q,this.outcome)}else this.queue.push(new M(U,S,F));return U};function M(S,F,U){this.promise=S,typeof F=="function"&&(this.onFulfilled=F,this.callFulfilled=this.otherCallFulfilled),typeof U=="function"&&(this.onRejected=U,this.callRejected=this.otherCallRejected)}M.prototype.callFulfilled=function(S){v.resolve(this.promise,S)},M.prototype.otherCallFulfilled=function(S){$(this.promise,this.onFulfilled,S)},M.prototype.callRejected=function(S){v.reject(this.promise,S)},M.prototype.otherCallRejected=function(S){$(this.promise,this.onRejected,S)};function $(S,F,U){m(function(){var q;try{q=F(U)}catch(Q){return v.reject(S,Q)}q===S?v.reject(S,new TypeError("Cannot resolve promise with itself")):v.resolve(S,q)})}v.resolve=function(S,F){var U=W(k,F);if(U.status==="error")return v.reject(S,U.value);var q=U.value;if(q)O(S,q);else{S.state=y,S.outcome=F;for(var Q=-1,ie=S.queue.length;++Q<ie;)S.queue[Q].callFulfilled(F)}return S},v.reject=function(S,F){S.state=g,S.outcome=F;for(var U=-1,q=S.queue.length;++U<q;)S.queue[U].callRejected(F);return S};function k(S){var F=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof F=="function")return function(){F.apply(S,arguments)}}function O(S,F){var U=!1;function q(le){U||(U=!0,v.reject(S,le))}function Q(le){U||(U=!0,v.resolve(S,le))}function ie(){F(Q,q)}var se=W(ie);se.status==="error"&&q(se.value)}function W(S,F){var U={};try{U.value=S(F),U.status="success"}catch(q){U.status="error",U.value=q}return U}I.resolve=J;function J(S){return S instanceof this?S:v.resolve(new this(p),S)}I.reject=D;function D(S){var F=new this(p);return v.reject(F,S)}I.all=me;function me(S){var F=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var U=S.length,q=!1;if(!U)return this.resolve([]);for(var Q=new Array(U),ie=0,se=-1,le=new this(p);++se<U;)fe(S[se],se);return le;function fe(_e,d){F.resolve(_e).then(_,function(A){q||(q=!0,v.reject(le,A))});function _(A){Q[d]=A,++ie===U&&!q&&(q=!0,v.resolve(le,Q))}}}I.race=ne;function ne(S){var F=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var U=S.length,q=!1;if(!U)return this.resolve([]);for(var Q=-1,ie=new this(p);++Q<U;)se(S[Q]);return ie;function se(le){F.resolve(le).then(function(fe){q||(q=!0,v.resolve(ie,fe))},function(fe){q||(q=!0,v.reject(ie,fe))})}}},{1:1}],3:[function(o,s,c){(function(m){"use strict";typeof m.Promise!="function"&&(m.Promise=o(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(o,s,c){"use strict";var m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r};function p(r,a){if(!(r instanceof a))throw new TypeError("Cannot call a class as a function")}function v(){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 g=v();function y(){try{if(!g||!g.open)return!1;var r=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),a=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!r||a)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function N(r,a){r=r||[],a=a||{};try{return new Blob(r,a)}catch(l){if(l.name!=="TypeError")throw l;for(var i=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,u=new i,f=0;f<r.length;f+=1)u.append(r[f]);return u.getBlob(a.type)}}typeof Promise>"u"&&o(3);var I=Promise;function M(r,a){a&&r.then(function(i){a(null,i)},function(i){a(i)})}function $(r,a,i){typeof a=="function"&&r.then(a),typeof i=="function"&&r.catch(i)}function k(r){return typeof r!="string"&&(console.warn(r+" used as a key, but it is not a string."),r=String(r)),r}function O(){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={},me=Object.prototype.toString,ne="readonly",S="readwrite";function F(r){for(var a=r.length,i=new ArrayBuffer(a),u=new Uint8Array(i),f=0;f<a;f++)u[f]=r.charCodeAt(f);return i}function U(r){return new I(function(a){var i=r.transaction(W,S),u=N([""]);i.objectStore(W).put(u,"key"),i.onabort=function(f){f.preventDefault(),f.stopPropagation(),a(!1)},i.oncomplete=function(){var f=navigator.userAgent.match(/Chrome\/(\d+)/),l=navigator.userAgent.match(/Edge\//);a(l||!f||parseInt(f[1],10)>=43)}}).catch(function(){return!1})}function q(r){return typeof J=="boolean"?I.resolve(J):U(r).then(function(a){return J=a,J})}function Q(r){var a=D[r.name],i={};i.promise=new I(function(u,f){i.resolve=u,i.reject=f}),a.deferredOperations.push(i),a.dbReady?a.dbReady=a.dbReady.then(function(){return i.promise}):a.dbReady=i.promise}function ie(r){var a=D[r.name],i=a.deferredOperations.pop();if(i)return i.resolve(),i.promise}function se(r,a){var i=D[r.name],u=i.deferredOperations.pop();if(u)return u.reject(a),u.promise}function le(r,a){return new I(function(i,u){if(D[r.name]=D[r.name]||Z(),r.db)if(a)Q(r),r.db.close();else return i(r.db);var f=[r.name];a&&f.push(r.version);var l=g.open.apply(g,f);a&&(l.onupgradeneeded=function(h){var E=l.result;try{E.createObjectStore(r.storeName),h.oldVersion<=1&&E.createObjectStore(W)}catch(b){if(b.name==="ConstraintError")console.warn('The database "'+r.name+'" has been upgraded from version '+h.oldVersion+" to version "+h.newVersion+', but the storage "'+r.storeName+'" already exists.');else throw b}}),l.onerror=function(h){h.preventDefault(),u(l.error)},l.onsuccess=function(){var h=l.result;h.onversionchange=function(E){E.target.close()},i(h),ie(r)}})}function fe(r){return le(r,!1)}function _e(r){return le(r,!0)}function d(r,a){if(!r.db)return!0;var i=!r.db.objectStoreNames.contains(r.storeName),u=r.version<r.db.version,f=r.version>r.db.version;if(u&&(r.version!==a&&console.warn('The database "'+r.name+`" can't be downgraded from version `+r.db.version+" to version "+r.version+"."),r.version=r.db.version),f||i){if(i){var l=r.db.version+1;l>r.version&&(r.version=l)}return!0}return!1}function _(r){return new I(function(a,i){var u=new FileReader;u.onerror=i,u.onloadend=function(f){var l=btoa(f.target.result||"");a({__local_forage_encoded_blob:!0,data:l,type:r.type})},u.readAsBinaryString(r)})}function A(r){var a=F(atob(r.data));return N([a],{type:r.type})}function L(r){return r&&r.__local_forage_encoded_blob}function P(r){var a=this,i=a._initReady().then(function(){var u=D[a._dbInfo.name];if(u&&u.dbReady)return u.dbReady});return $(i,r,r),i}function x(r){Q(r);for(var a=D[r.name],i=a.forages,u=0;u<i.length;u++){var f=i[u];f._dbInfo.db&&(f._dbInfo.db.close(),f._dbInfo.db=null)}return r.db=null,fe(r).then(function(l){return r.db=l,d(r)?_e(r):l}).then(function(l){r.db=a.db=l;for(var h=0;h<i.length;h++)i[h]._dbInfo.db=l}).catch(function(l){throw se(r,l),l})}function G(r,a,i,u){u===void 0&&(u=1);try{var f=r.db.transaction(r.storeName,a);i(null,f)}catch(l){if(u>0&&(!r.db||l.name==="InvalidStateError"||l.name==="NotFoundError"))return I.resolve().then(function(){if(!r.db||l.name==="NotFoundError"&&!r.db.objectStoreNames.contains(r.storeName)&&r.version<=r.db.version)return r.db&&(r.version=r.db.version+1),_e(r)}).then(function(){return x(r).then(function(){G(r,a,i,u-1)})}).catch(i);i(l)}}function Z(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Se(r){var a=this,i={db:null};if(r)for(var u in r)i[u]=r[u];var f=D[i.name];f||(f=Z(),D[i.name]=f),f.forages.push(a),a._initReady||(a._initReady=a.ready,a.ready=P);var l=[];function h(){return I.resolve()}for(var E=0;E<f.forages.length;E++){var b=f.forages[E];b!==a&&l.push(b._initReady().catch(h))}var w=f.forages.slice(0);return I.all(l).then(function(){return i.db=f.db,fe(i)}).then(function(R){return i.db=R,d(i,a._defaultConfig.version)?_e(i):R}).then(function(R){i.db=f.db=R,a._dbInfo=i;for(var T=0;T<w.length;T++){var B=w[T];B!==a&&(B._dbInfo.db=i.db,B._dbInfo.version=i.version)}})}function Ie(r,a){var i=this;r=k(r);var u=new I(function(f,l){i.ready().then(function(){G(i._dbInfo,ne,function(h,E){if(h)return l(h);try{var b=E.objectStore(i._dbInfo.storeName),w=b.get(r);w.onsuccess=function(){var R=w.result;R===void 0&&(R=null),L(R)&&(R=A(R)),f(R)},w.onerror=function(){l(w.error)}}catch(R){l(R)}})}).catch(l)});return M(u,a),u}function ke(r,a){var i=this,u=new I(function(f,l){i.ready().then(function(){G(i._dbInfo,ne,function(h,E){if(h)return l(h);try{var b=E.objectStore(i._dbInfo.storeName),w=b.openCursor(),R=1;w.onsuccess=function(){var T=w.result;if(T){var B=T.value;L(B)&&(B=A(B));var j=r(B,T.key,R++);j!==void 0?f(j):T.continue()}else f()},w.onerror=function(){l(w.error)}}catch(T){l(T)}})}).catch(l)});return M(u,a),u}function Vr(r,a,i){var u=this;r=k(r);var f=new I(function(l,h){var E;u.ready().then(function(){return E=u._dbInfo,me.call(a)==="[object Blob]"?q(E.db).then(function(b){return b?a:_(a)}):a}).then(function(b){G(u._dbInfo,S,function(w,R){if(w)return h(w);try{var T=R.objectStore(u._dbInfo.storeName);b===null&&(b=void 0);var B=T.put(b,r);R.oncomplete=function(){b===void 0&&(b=null),l(b)},R.onabort=R.onerror=function(){var j=B.error?B.error:B.transaction.error;h(j)}}catch(j){h(j)}})}).catch(h)});return M(f,i),f}function Yr(r,a){var i=this;r=k(r);var u=new I(function(f,l){i.ready().then(function(){G(i._dbInfo,S,function(h,E){if(h)return l(h);try{var b=E.objectStore(i._dbInfo.storeName),w=b.delete(r);E.oncomplete=function(){f()},E.onerror=function(){l(w.error)},E.onabort=function(){var R=w.error?w.error:w.transaction.error;l(R)}}catch(R){l(R)}})}).catch(l)});return M(u,a),u}function Hr(r){var a=this,i=new I(function(u,f){a.ready().then(function(){G(a._dbInfo,S,function(l,h){if(l)return f(l);try{var E=h.objectStore(a._dbInfo.storeName),b=E.clear();h.oncomplete=function(){u()},h.onabort=h.onerror=function(){var w=b.error?b.error:b.transaction.error;f(w)}}catch(w){f(w)}})}).catch(f)});return M(i,r),i}function Xr(r){var a=this,i=new I(function(u,f){a.ready().then(function(){G(a._dbInfo,ne,function(l,h){if(l)return f(l);try{var E=h.objectStore(a._dbInfo.storeName),b=E.count();b.onsuccess=function(){u(b.result)},b.onerror=function(){f(b.error)}}catch(w){f(w)}})}).catch(f)});return M(i,r),i}function zr(r,a){var i=this,u=new I(function(f,l){if(r<0){f(null);return}i.ready().then(function(){G(i._dbInfo,ne,function(h,E){if(h)return l(h);try{var b=E.objectStore(i._dbInfo.storeName),w=!1,R=b.openKeyCursor();R.onsuccess=function(){var T=R.result;if(!T){f(null);return}r===0||w?f(T.key):(w=!0,T.advance(r))},R.onerror=function(){l(R.error)}}catch(T){l(T)}})}).catch(l)});return M(u,a),u}function Jr(r){var a=this,i=new I(function(u,f){a.ready().then(function(){G(a._dbInfo,ne,function(l,h){if(l)return f(l);try{var E=h.objectStore(a._dbInfo.storeName),b=E.openKeyCursor(),w=[];b.onsuccess=function(){var R=b.result;if(!R){u(w);return}w.push(R.key),R.continue()},b.onerror=function(){f(b.error)}}catch(R){f(R)}})}).catch(f)});return M(i,r),i}function Qr(r,a){a=O.apply(this,arguments);var i=this.config();r=typeof r!="function"&&r||{},r.name||(r.name=r.name||i.name,r.storeName=r.storeName||i.storeName);var u=this,f;if(!r.name)f=I.reject("Invalid arguments");else{var l=r.name===i.name&&u._dbInfo.db,h=l?I.resolve(u._dbInfo.db):fe(r).then(function(E){var b=D[r.name],w=b.forages;b.db=E;for(var R=0;R<w.length;R++)w[R]._dbInfo.db=E;return E});r.storeName?f=h.then(function(E){if(!!E.objectStoreNames.contains(r.storeName)){var b=E.version+1;Q(r);var w=D[r.name],R=w.forages;E.close();for(var T=0;T<R.length;T++){var B=R[T];B._dbInfo.db=null,B._dbInfo.version=b}var j=new I(function(V,z){var X=g.open(r.name,b);X.onerror=function(ue){var We=X.result;We.close(),z(ue)},X.onupgradeneeded=function(){var ue=X.result;ue.deleteObjectStore(r.storeName)},X.onsuccess=function(){var ue=X.result;ue.close(),V(ue)}});return j.then(function(V){w.db=V;for(var z=0;z<R.length;z++){var X=R[z];X._dbInfo.db=V,ie(X._dbInfo)}}).catch(function(V){throw(se(r,V)||I.resolve()).catch(function(){}),V})}}):f=h.then(function(E){Q(r);var b=D[r.name],w=b.forages;E.close();for(var R=0;R<w.length;R++){var T=w[R];T._dbInfo.db=null}var B=new I(function(j,V){var z=g.deleteDatabase(r.name);z.onerror=function(){var X=z.result;X&&X.close(),V(z.error)},z.onblocked=function(){console.warn('dropInstance blocked for database "'+r.name+'" until all open connections are closed')},z.onsuccess=function(){var X=z.result;X&&X.close(),j(X)}});return B.then(function(j){b.db=j;for(var V=0;V<w.length;V++){var z=w[V];ie(z._dbInfo)}}).catch(function(j){throw(se(r,j)||I.resolve()).catch(function(){}),j})})}return M(f,a),f}var Zr={_driver:"asyncStorage",_initStorage:Se,_support:y(),iterate:ke,getItem:Ie,setItem:Vr,removeItem:Yr,clear:Hr,length:Xr,key:zr,keys:Jr,dropInstance:Qr};function en(){return typeof openDatabase=="function"}var ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tn="~~local_forage_type~",$t=/^~~local_forage_type~([^~]+)~/,ze="__lfsc__:",dt=ze.length,ht="arbf",pt="blob",Ct="si08",Dt="ui08",xt="uic8",Ut="si16",kt="si32",Bt="ur16",Wt="ui32",Ft="fl32",Gt="fl64",jt=dt+ht.length,Kt=Object.prototype.toString;function qt(r){var a=r.length*.75,i=r.length,u,f=0,l,h,E,b;r[r.length-1]==="="&&(a--,r[r.length-2]==="="&&a--);var w=new ArrayBuffer(a),R=new Uint8Array(w);for(u=0;u<i;u+=4)l=ve.indexOf(r[u]),h=ve.indexOf(r[u+1]),E=ve.indexOf(r[u+2]),b=ve.indexOf(r[u+3]),R[f++]=l<<2|h>>4,R[f++]=(h&15)<<4|E>>2,R[f++]=(E&3)<<6|b&63;return w}function mt(r){var a=new Uint8Array(r),i="",u;for(u=0;u<a.length;u+=3)i+=ve[a[u]>>2],i+=ve[(a[u]&3)<<4|a[u+1]>>4],i+=ve[(a[u+1]&15)<<2|a[u+2]>>6],i+=ve[a[u+2]&63];return a.length%3===2?i=i.substring(0,i.length-1)+"=":a.length%3===1&&(i=i.substring(0,i.length-2)+"=="),i}function rn(r,a){var i="";if(r&&(i=Kt.call(r)),r&&(i==="[object ArrayBuffer]"||r.buffer&&Kt.call(r.buffer)==="[object ArrayBuffer]")){var u,f=ze;r instanceof ArrayBuffer?(u=r,f+=ht):(u=r.buffer,i==="[object Int8Array]"?f+=Ct:i==="[object Uint8Array]"?f+=Dt:i==="[object Uint8ClampedArray]"?f+=xt:i==="[object Int16Array]"?f+=Ut:i==="[object Uint16Array]"?f+=Bt:i==="[object Int32Array]"?f+=kt:i==="[object Uint32Array]"?f+=Wt:i==="[object Float32Array]"?f+=Ft:i==="[object Float64Array]"?f+=Gt:a(new Error("Failed to get type for BinaryArray"))),a(f+mt(u))}else if(i==="[object Blob]"){var l=new FileReader;l.onload=function(){var h=tn+r.type+"~"+mt(this.result);a(ze+pt+h)},l.readAsArrayBuffer(r)}else try{a(JSON.stringify(r))}catch(h){console.error("Couldn't convert value into a JSON string: ",r),a(null,h)}}function nn(r){if(r.substring(0,dt)!==ze)return JSON.parse(r);var a=r.substring(jt),i=r.substring(dt,jt),u;if(i===pt&&$t.test(a)){var f=a.match($t);u=f[1],a=a.substring(f[0].length)}var l=qt(a);switch(i){case ht:return l;case pt:return N([l],{type:u});case Ct:return new Int8Array(l);case Dt:return new Uint8Array(l);case xt:return new Uint8ClampedArray(l);case Ut:return new Int16Array(l);case Bt:return new Uint16Array(l);case kt:return new Int32Array(l);case Wt:return new Uint32Array(l);case Ft:return new Float32Array(l);case Gt:return new Float64Array(l);default:throw new Error("Unkown type: "+i)}}var vt={serialize:rn,deserialize:nn,stringToBuffer:qt,bufferToString:mt};function Vt(r,a,i,u){r.executeSql("CREATE TABLE IF NOT EXISTS "+a.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,u)}function on(r){var a=this,i={db:null};if(r)for(var u in r)i[u]=typeof r[u]!="string"?r[u].toString():r[u];var f=new I(function(l,h){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(E){return h(E)}i.db.transaction(function(E){Vt(E,i,function(){a._dbInfo=i,l()},function(b,w){h(w)})},h)});return i.serializer=vt,f}function ge(r,a,i,u,f,l){r.executeSql(i,u,f,function(h,E){E.code===E.SYNTAX_ERR?h.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[a.storeName],function(b,w){w.rows.length?l(b,E):Vt(b,a,function(){b.executeSql(i,u,f,l)},l)},l):l(h,E)},l)}function an(r,a){var i=this;r=k(r);var u=new I(function(f,l){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(E){ge(E,h,"SELECT * FROM "+h.storeName+" WHERE key = ? LIMIT 1",[r],function(b,w){var R=w.rows.length?w.rows.item(0).value:null;R&&(R=h.serializer.deserialize(R)),f(R)},function(b,w){l(w)})})}).catch(l)});return M(u,a),u}function sn(r,a){var i=this,u=new I(function(f,l){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(E){ge(E,h,"SELECT * FROM "+h.storeName,[],function(b,w){for(var R=w.rows,T=R.length,B=0;B<T;B++){var j=R.item(B),V=j.value;if(V&&(V=h.serializer.deserialize(V)),V=r(V,j.key,B+1),V!==void 0){f(V);return}}f()},function(b,w){l(w)})})}).catch(l)});return M(u,a),u}function Yt(r,a,i,u){var f=this;r=k(r);var l=new I(function(h,E){f.ready().then(function(){a===void 0&&(a=null);var b=a,w=f._dbInfo;w.serializer.serialize(a,function(R,T){T?E(T):w.db.transaction(function(B){ge(B,w,"INSERT OR REPLACE INTO "+w.storeName+" (key, value) VALUES (?, ?)",[r,R],function(){h(b)},function(j,V){E(V)})},function(B){if(B.code===B.QUOTA_ERR){if(u>0){h(Yt.apply(f,[r,b,i,u-1]));return}E(B)}})})}).catch(E)});return M(l,i),l}function ln(r,a,i){return Yt.apply(this,[r,a,i,1])}function cn(r,a){var i=this;r=k(r);var u=new I(function(f,l){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(E){ge(E,h,"DELETE FROM "+h.storeName+" WHERE key = ?",[r],function(){f()},function(b,w){l(w)})})}).catch(l)});return M(u,a),u}function un(r){var a=this,i=new I(function(u,f){a.ready().then(function(){var l=a._dbInfo;l.db.transaction(function(h){ge(h,l,"DELETE FROM "+l.storeName,[],function(){u()},function(E,b){f(b)})})}).catch(f)});return M(i,r),i}function fn(r){var a=this,i=new I(function(u,f){a.ready().then(function(){var l=a._dbInfo;l.db.transaction(function(h){ge(h,l,"SELECT COUNT(key) as c FROM "+l.storeName,[],function(E,b){var w=b.rows.item(0).c;u(w)},function(E,b){f(b)})})}).catch(f)});return M(i,r),i}function dn(r,a){var i=this,u=new I(function(f,l){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(E){ge(E,h,"SELECT key FROM "+h.storeName+" WHERE id = ? LIMIT 1",[r+1],function(b,w){var R=w.rows.length?w.rows.item(0).key:null;f(R)},function(b,w){l(w)})})}).catch(l)});return M(u,a),u}function hn(r){var a=this,i=new I(function(u,f){a.ready().then(function(){var l=a._dbInfo;l.db.transaction(function(h){ge(h,l,"SELECT key FROM "+l.storeName,[],function(E,b){for(var w=[],R=0;R<b.rows.length;R++)w.push(b.rows.item(R).key);u(w)},function(E,b){f(b)})})}).catch(f)});return M(i,r),i}function pn(r){return new I(function(a,i){r.transaction(function(u){u.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(f,l){for(var h=[],E=0;E<l.rows.length;E++)h.push(l.rows.item(E).name);a({db:r,storeNames:h})},function(f,l){i(l)})},function(u){i(u)})})}function mn(r,a){a=O.apply(this,arguments);var i=this.config();r=typeof r!="function"&&r||{},r.name||(r.name=r.name||i.name,r.storeName=r.storeName||i.storeName);var u=this,f;return r.name?f=new I(function(l){var h;r.name===i.name?h=u._dbInfo.db:h=openDatabase(r.name,"","",0),r.storeName?l({db:h,storeNames:[r.storeName]}):l(pn(h))}).then(function(l){return new I(function(h,E){l.db.transaction(function(b){function w(j){return new I(function(V,z){b.executeSql("DROP TABLE IF EXISTS "+j,[],function(){V()},function(X,ue){z(ue)})})}for(var R=[],T=0,B=l.storeNames.length;T<B;T++)R.push(w(l.storeNames[T]));I.all(R).then(function(){h()}).catch(function(j){E(j)})},function(b){E(b)})})}):f=I.reject("Invalid arguments"),M(f,a),f}var vn={_driver:"webSQLStorage",_initStorage:on,_support:en(),iterate:sn,getItem:an,setItem:ln,removeItem:cn,clear:un,length:fn,key:dn,keys:hn,dropInstance:mn};function gn(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Ht(r,a){var i=r.name+"/";return r.storeName!==a.storeName&&(i+=r.storeName+"/"),i}function yn(){var r="_localforage_support_test";try{return localStorage.setItem(r,!0),localStorage.removeItem(r),!1}catch{return!0}}function En(){return!yn()||localStorage.length>0}function _n(r){var a=this,i={};if(r)for(var u in r)i[u]=r[u];return i.keyPrefix=Ht(r,a._defaultConfig),En()?(a._dbInfo=i,i.serializer=vt,I.resolve()):I.reject()}function In(r){var a=this,i=a.ready().then(function(){for(var u=a._dbInfo.keyPrefix,f=localStorage.length-1;f>=0;f--){var l=localStorage.key(f);l.indexOf(u)===0&&localStorage.removeItem(l)}});return M(i,r),i}function bn(r,a){var i=this;r=k(r);var u=i.ready().then(function(){var f=i._dbInfo,l=localStorage.getItem(f.keyPrefix+r);return l&&(l=f.serializer.deserialize(l)),l});return M(u,a),u}function wn(r,a){var i=this,u=i.ready().then(function(){for(var f=i._dbInfo,l=f.keyPrefix,h=l.length,E=localStorage.length,b=1,w=0;w<E;w++){var R=localStorage.key(w);if(R.indexOf(l)===0){var T=localStorage.getItem(R);if(T&&(T=f.serializer.deserialize(T)),T=r(T,R.substring(h),b++),T!==void 0)return T}}});return M(u,a),u}function Rn(r,a){var i=this,u=i.ready().then(function(){var f=i._dbInfo,l;try{l=localStorage.key(r)}catch{l=null}return l&&(l=l.substring(f.keyPrefix.length)),l});return M(u,a),u}function An(r){var a=this,i=a.ready().then(function(){for(var u=a._dbInfo,f=localStorage.length,l=[],h=0;h<f;h++){var E=localStorage.key(h);E.indexOf(u.keyPrefix)===0&&l.push(E.substring(u.keyPrefix.length))}return l});return M(i,r),i}function Sn(r){var a=this,i=a.keys().then(function(u){return u.length});return M(i,r),i}function Nn(r,a){var i=this;r=k(r);var u=i.ready().then(function(){var f=i._dbInfo;localStorage.removeItem(f.keyPrefix+r)});return M(u,a),u}function Mn(r,a,i){var u=this;r=k(r);var f=u.ready().then(function(){a===void 0&&(a=null);var l=a;return new I(function(h,E){var b=u._dbInfo;b.serializer.serialize(a,function(w,R){if(R)E(R);else try{localStorage.setItem(b.keyPrefix+r,w),h(l)}catch(T){(T.name==="QuotaExceededError"||T.name==="NS_ERROR_DOM_QUOTA_REACHED")&&E(T),E(T)}})})});return M(f,i),f}function Tn(r,a){if(a=O.apply(this,arguments),r=typeof r!="function"&&r||{},!r.name){var i=this.config();r.name=r.name||i.name,r.storeName=r.storeName||i.storeName}var u=this,f;return r.name?f=new I(function(l){r.storeName?l(Ht(r,u._defaultConfig)):l(r.name+"/")}).then(function(l){for(var h=localStorage.length-1;h>=0;h--){var E=localStorage.key(h);E.indexOf(l)===0&&localStorage.removeItem(E)}}):f=I.reject("Invalid arguments"),M(f,a),f}var On={_driver:"localStorageWrapper",_initStorage:_n,_support:gn(),iterate:wn,getItem:bn,setItem:Mn,removeItem:Nn,clear:In,length:Sn,key:Rn,keys:An,dropInstance:Tn},Ln=function(a,i){return a===i||typeof a=="number"&&typeof i=="number"&&isNaN(a)&&isNaN(i)},Pn=function(a,i){for(var u=a.length,f=0;f<u;){if(Ln(a[f],i))return!0;f++}return!1},Xt=Array.isArray||function(r){return Object.prototype.toString.call(r)==="[object Array]"},Be={},zt={},Ne={INDEXEDDB:Zr,WEBSQL:vn,LOCALSTORAGE:On},$n=[Ne.INDEXEDDB._driver,Ne.WEBSQL._driver,Ne.LOCALSTORAGE._driver],Je=["dropInstance"],gt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Je),Cn={description:"",driver:$n.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Dn(r,a){r[a]=function(){var i=arguments;return r.ready().then(function(){return r[a].apply(r,i)})}}function yt(){for(var r=1;r<arguments.length;r++){var a=arguments[r];if(a)for(var i in a)a.hasOwnProperty(i)&&(Xt(a[i])?arguments[0][i]=a[i].slice():arguments[0][i]=a[i])}return arguments[0]}var xn=function(){function r(a){p(this,r);for(var i in Ne)if(Ne.hasOwnProperty(i)){var u=Ne[i],f=u._driver;this[i]=f,Be[f]||this.defineDriver(u)}this._defaultConfig=yt({},Cn),this._config=yt({},this._defaultConfig,a),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return r.prototype.config=function(i){if((typeof i>"u"?"undefined":m(i))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var u in i){if(u==="storeName"&&(i[u]=i[u].replace(/\W/g,"_")),u==="version"&&typeof i[u]!="number")return new Error("Database version must be a number.");this._config[u]=i[u]}return"driver"in i&&i.driver?this.setDriver(this._config.driver):!0}else return typeof i=="string"?this._config[i]:this._config},r.prototype.defineDriver=function(i,u,f){var l=new I(function(h,E){try{var b=i._driver,w=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!i._driver){E(w);return}for(var R=gt.concat("_initStorage"),T=0,B=R.length;T<B;T++){var j=R[T],V=!Pn(Je,j);if((V||i[j])&&typeof i[j]!="function"){E(w);return}}var z=function(){for(var We=function(Bn){return function(){var Wn=new Error("Method "+Bn+" is not implemented by the current driver"),Jt=I.reject(Wn);return M(Jt,arguments[arguments.length-1]),Jt}},Et=0,kn=Je.length;Et<kn;Et++){var _t=Je[Et];i[_t]||(i[_t]=We(_t))}};z();var X=function(We){Be[b]&&console.info("Redefining LocalForage driver: "+b),Be[b]=i,zt[b]=We,h()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(X,E):X(!!i._support):X(!0)}catch(ue){E(ue)}});return $(l,u,f),l},r.prototype.driver=function(){return this._driver||null},r.prototype.getDriver=function(i,u,f){var l=Be[i]?I.resolve(Be[i]):I.reject(new Error("Driver not found."));return $(l,u,f),l},r.prototype.getSerializer=function(i){var u=I.resolve(vt);return $(u,i),u},r.prototype.ready=function(i){var u=this,f=u._driverSet.then(function(){return u._ready===null&&(u._ready=u._initDriver()),u._ready});return $(f,i,i),f},r.prototype.setDriver=function(i,u,f){var l=this;Xt(i)||(i=[i]);var h=this._getSupportedDrivers(i);function E(){l._config.driver=l.driver()}function b(T){return l._extend(T),E(),l._ready=l._initStorage(l._config),l._ready}function w(T){return function(){var B=0;function j(){for(;B<T.length;){var V=T[B];return B++,l._dbInfo=null,l._ready=null,l.getDriver(V).then(b).catch(j)}E();var z=new Error("No available storage method found.");return l._driverSet=I.reject(z),l._driverSet}return j()}}var R=this._driverSet!==null?this._driverSet.catch(function(){return I.resolve()}):I.resolve();return this._driverSet=R.then(function(){var T=h[0];return l._dbInfo=null,l._ready=null,l.getDriver(T).then(function(B){l._driver=B._driver,E(),l._wrapLibraryMethodsWithReady(),l._initDriver=w(h)})}).catch(function(){E();var T=new Error("No available storage method found.");return l._driverSet=I.reject(T),l._driverSet}),$(this._driverSet,u,f),this._driverSet},r.prototype.supports=function(i){return!!zt[i]},r.prototype._extend=function(i){yt(this,i)},r.prototype._getSupportedDrivers=function(i){for(var u=[],f=0,l=i.length;f<l;f++){var h=i[f];this.supports(h)&&u.push(h)}return u},r.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,u=gt.length;i<u;i++)Dn(this,gt[i])},r.prototype.createInstance=function(i){return new r(i)},r}(),Un=new xn;s.exports=Un},{3:3}]},{},[4])(4)})});var qr=rr((ct,Kr)=>{(function(e,t){typeof ct=="object"&&typeof Kr<"u"?t(ct):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],t):t(e.LocalforageDriverMemory={})})(typeof self<"u"?self:ct,function(e){"use strict";var t="localforage-driver-memory";function n(d){var _=typeof Symbol=="function"&&d[Symbol.iterator],A=0;return _?_.call(d):{next:function(){return d&&A>=d.length&&(d=void 0),{value:d&&d[A++],done:!d}}}}function o(d,_){d=d||[],_=_||{};try{return new Blob(d,_)}catch(x){if(x.name!=="TypeError")throw x;for(var A=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,L=new A,P=0;P<d.length;P+=1)L.append(d[P]);return L.getBlob(_.type)}}var s=/^~~local_forage_type~([^~]+)~/,c=9,m=c+4,p=Object.prototype.toString;function v(d){var _=d.length*.75,A=d.length;d[d.length-1]==="="&&(_--,d[d.length-2]==="="&&_--);for(var L=new ArrayBuffer(_),P=new Uint8Array(L),x=0,G=0;x<A;x+=4){var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x]),Se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x+1]),Ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x+2]),ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x+3]);P[G++]=Z<<2|Se>>4,P[G++]=(Se&15)<<4|Ie>>2,P[G++]=(Ie&3)<<6|ke&63}return L}function g(d){for(var _=new Uint8Array(d),A="",L=0;L<_.length;L+=3)A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[_[L]>>2],A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(_[L]&3)<<4|_[L+1]>>4],A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(_[L+1]&15)<<2|_[L+2]>>6],A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[_[L+2]&63];return _.length%3===2?A=A.substring(0,A.length-1)+"=":_.length%3===1&&(A=A.substring(0,A.length-2)+"=="),A}function y(d,_){var A="";if(d&&(A=p.call(d)),d&&(A==="[object ArrayBuffer]"||d.buffer&&p.call(d.buffer)==="[object ArrayBuffer]")){var L=void 0,P="__lfsc__:";d instanceof ArrayBuffer?(L=d,P+="arbf"):(L=d.buffer,A==="[object Int8Array]"?P+="si08":A==="[object Uint8Array]"?P+="ui08":A==="[object Uint8ClampedArray]"?P+="uic8":A==="[object Int16Array]"?P+="si16":A==="[object Uint16Array]"?P+="ur16":A==="[object Int32Array]"?P+="si32":A==="[object Uint32Array]"?P+="ui32":A==="[object Float32Array]"?P+="fl32":A==="[object Float64Array]"?P+="fl64":_(new Error("Failed to get type for BinaryArray"))),_(P+g(L))}else if(A==="[object Blob]"){var x=new FileReader;x.onload=function(){var G="~~local_forage_type~"+d.type+"~"+g(this.result);_("__lfsc__:blob"+G)},x.readAsArrayBuffer(d)}else try{_(JSON.stringify(d))}catch(G){console.error("Couldn't convert value into a JSON string: ",d),_(null,G)}}function N(d){if(d.substring(0,c)!=="__lfsc__:")return JSON.parse(d);var _=d.substring(m),A=d.substring(c,m),L;if(A==="blob"&&s.test(_)){var P=_.match(s);L=P[1],_=_.substring(P[0].length)}var x=v(_);switch(A){case"arbf":return x;case"blob":return o([x],{type:L});case"si08":return new Int8Array(x);case"ui08":return new Uint8Array(x);case"uic8":return new Uint8ClampedArray(x);case"si16":return new Int16Array(x);case"ur16":return new Uint16Array(x);case"si32":return new Int32Array(x);case"ui32":return new Uint32Array(x);case"fl32":return new Float32Array(x);case"fl64":return new Float64Array(x);default:throw new Error("Unkown type: "+A)}}function I(d){var _,A;if(d===null||typeof d!="object"||"isActiveClone"in d)return d;var L=d instanceof Date?new Date(d):d.constructor();try{for(var P=n(Object.keys(d)),x=P.next();!x.done;x=P.next()){var G=x.value;Object.prototype.hasOwnProperty.call(d,G)&&(d.isActiveClone=null,L[G]=I(d[G]),delete d.isActiveClone)}}catch(Z){_={error:Z}}finally{try{x&&!x.done&&(A=P.return)&&A.call(P)}finally{if(_)throw _.error}}return L}function M(d,_){return(d.name||_.name)+"/"+(d.storeName||_.storeName)+"/"}function $(d,_){_&&d.then(function(A){_(null,A)},function(A){_(A)})}function k(){for(var d=[],_=0;_<arguments.length;_++)d[_]=arguments[_];if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}function O(d,_){var A=this;if(_=k.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var L=this.config();d.name=d.name||L.name,d.storeName=d.storeName||L.storeName}var P;return d.name?P=new Promise(function(x){d.storeName?x(M(d,A._defaultConfig)):x(d.name+"/")}):P=Promise.reject("Invalid arguments"),{promise:P,callback:_}}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:g,deserialize:N,serialize:y,stringToBuffer:v},D={},me=function(){function d(_){this.kp=_,this.data={}}return d.resolve=function(_){return D[_]||(D[_]=new d(_)),D[_]},d.prototype.clear=function(){this.data={}},d.prototype.drop=function(){this.clear(),delete D[this.kp]},d.prototype.get=function(_){return this.data[_]},d.prototype.key=function(_){return this.keys()[_]},d.prototype.keys=function(){return Object.keys(this.data)},d.prototype.rm=function(_){delete this.data[_]},d.prototype.set=function(_,A){this.data[_]=A},d}();function ne(d){var _=d?I(d):{},A=M(_,this._defaultConfig),L=me.resolve(A);return this._dbInfo=_,this._dbInfo.serializer=J,this._dbInfo.keyPrefix=A,this._dbInfo.mStore=L,Promise.resolve()}function S(d){var _=this,A=this.ready().then(function(){_._dbInfo.mStore.clear()});return $(A,d),A}function F(d,_){var A=O.apply(this,arguments),L=A.promise,P=A.callback,x=L.then(function(G){me.resolve(G).drop()});return $(x,P),L}function U(d,_){var A=this;d=W(d);var L=this.ready().then(function(){var P=A._dbInfo.mStore.get(d);return P==null?null:A._dbInfo.serializer.deserialize(P)});return $(L,_),L}function q(d,_){var A=this,L=this.ready().then(function(){for(var P=A._dbInfo.mStore,x=P.keys(),G=0;G<x.length;G++){var Z=P.get(x[G]);if(Z&&(Z=A._dbInfo.serializer.deserialize(Z)),Z=d(Z,x[G],G+1),Z!==void 0)return Z}});return $(L,_),L}function Q(d,_){var A=this,L=this.ready().then(function(){var P;try{P=A._dbInfo.mStore.key(d),P===void 0&&(P=null)}catch{P=null}return P});return $(L,_),L}function ie(d){var _=this,A=this.ready().then(function(){return _._dbInfo.mStore.keys()});return $(A,d),A}function se(d){var _=this.keys().then(function(A){return A.length});return $(_,d),_}function le(d,_){var A=this;d=W(d);var L=this.ready().then(function(){A._dbInfo.mStore.rm(d)});return $(L,_),L}function fe(d,_,A){var L=this;d=W(d);var P=this.ready().then(function(){_===void 0&&(_=null);var x=_;return new Promise(function(G,Z){L._dbInfo.serializer.serialize(_,function(Se,Ie){if(Ie)Z(Ie);else try{L._dbInfo.mStore.set(d,Se),G(x)}catch(ke){Z(ke)}})})});return $(P,A),P}var _e=!0;e._support=_e,e._driver=t,e._initStorage=ne,e.clear=S,e.dropInstance=F,e.getItem=U,e.iterate=q,e.key=Q,e.keys=ie,e.length=se,e.removeItem=le,e.setItem=fe,Object.defineProperty(e,"__esModule",{value:!0})})});var jo={};nr(jo,{default:()=>Go});var de=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(de||{}),be=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e))(be||{}),Te=(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))(Te||{}),ce=(e=>(e.MetaMask="metamask",e.CoinbaseWallet="coinbase_wallet",e))(ce||{}),Oe=(e=>(e.WalletSelected="wallet_selected",e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e))(Oe||{}),C=(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.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.UpdatePhoneNumber="magic_auth_update_phone_number",e.UpdatePhoneNumberTestMode="magic_auth_update_phone_number_testing_mode",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))(C||{}),he=(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))(he||{}),we=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(we||{}),ar=(e=>(e.Harmony="HARMONY",e))(ar||{});var Yn=Object.create,st=Object.defineProperty,Hn=Object.defineProperties,Xn=Object.getOwnPropertyDescriptor,zn=Object.getOwnPropertyDescriptors,Jn=Object.getOwnPropertyNames,sr=Object.getOwnPropertySymbols,Qn=Object.getPrototypeOf,Ir=Object.prototype.hasOwnProperty,Zn=Object.prototype.propertyIsEnumerable,lr=(e,t,n)=>t in e?st(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wt=(e,t)=>{for(var n in t||(t={}))Ir.call(t,n)&&lr(e,n,t[n]);if(sr)for(var n of sr(t))Zn.call(t,n)&&lr(e,n,t[n]);return e},br=(e,t)=>Hn(e,zn(t)),ei=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ti=(e,t)=>{for(var n in t)st(e,n,{get:t[n],enumerable:!0})},ri=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Jn(t))!Ir.call(e,s)&&s!==n&&st(e,s,{get:()=>t[s],enumerable:!(o=Xn(t,s))||o.enumerable});return e},ni=(e,t,n)=>(n=e!=null?Yn(Qn(e)):{},ri(t||!e||!e.__esModule?st(n,"default",{value:e,enumerable:!0}):n,e)),ae=(e,t,n)=>new Promise((o,s)=>{var c=v=>{try{p(n.next(v))}catch(g){s(g)}},m=v=>{try{p(n.throw(v))}catch(g){s(g)}},p=v=>v.done?o(v.value):Promise.resolve(v.value).then(c,m);p((n=n.apply(e,t)).next())}),ii=ei((e,t)=>{"use strict";var n=Object.prototype.hasOwnProperty,o="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(o=!1));function c(g,y,N){this.fn=g,this.context=y,this.once=N||!1}function m(g,y,N,I,M){if(typeof N!="function")throw new TypeError("The listener must be a function");var $=new c(N,I||g,M),k=o?o+y:y;return g._events[k]?g._events[k].fn?g._events[k]=[g._events[k],$]:g._events[k].push($):(g._events[k]=$,g._eventsCount++),g}function p(g,y){--g._eventsCount===0?g._events=new s:delete g._events[y]}function v(){this._events=new s,this._eventsCount=0}v.prototype.eventNames=function(){var g=[],y,N;if(this._eventsCount===0)return g;for(N in y=this._events)n.call(y,N)&&g.push(o?N.slice(1):N);return Object.getOwnPropertySymbols?g.concat(Object.getOwnPropertySymbols(y)):g},v.prototype.listeners=function(g){var y=o?o+g:g,N=this._events[y];if(!N)return[];if(N.fn)return[N.fn];for(var I=0,M=N.length,$=new Array(M);I<M;I++)$[I]=N[I].fn;return $},v.prototype.listenerCount=function(g){var y=o?o+g:g,N=this._events[y];return N?N.fn?1:N.length:0},v.prototype.emit=function(g,y,N,I,M,$){var k=o?o+g:g;if(!this._events[k])return!1;var O=this._events[k],W=arguments.length,J,D;if(O.fn){switch(O.once&&this.removeListener(g,O.fn,void 0,!0),W){case 1:return O.fn.call(O.context),!0;case 2:return O.fn.call(O.context,y),!0;case 3:return O.fn.call(O.context,y,N),!0;case 4:return O.fn.call(O.context,y,N,I),!0;case 5:return O.fn.call(O.context,y,N,I,M),!0;case 6:return O.fn.call(O.context,y,N,I,M,$),!0}for(D=1,J=new Array(W-1);D<W;D++)J[D-1]=arguments[D];O.fn.apply(O.context,J)}else{var me=O.length,ne;for(D=0;D<me;D++)switch(O[D].once&&this.removeListener(g,O[D].fn,void 0,!0),W){case 1:O[D].fn.call(O[D].context);break;case 2:O[D].fn.call(O[D].context,y);break;case 3:O[D].fn.call(O[D].context,y,N);break;case 4:O[D].fn.call(O[D].context,y,N,I);break;default:if(!J)for(ne=1,J=new Array(W-1);ne<W;ne++)J[ne-1]=arguments[ne];O[D].fn.apply(O[D].context,J)}}return!0},v.prototype.on=function(g,y,N){return m(this,g,y,N,!1)},v.prototype.once=function(g,y,N){return m(this,g,y,N,!0)},v.prototype.removeListener=function(g,y,N,I){var M=o?o+g:g;if(!this._events[M])return this;if(!y)return p(this,M),this;var $=this._events[M];if($.fn)$.fn===y&&(!I||$.once)&&(!N||$.context===N)&&p(this,M);else{for(var k=0,O=[],W=$.length;k<W;k++)($[k].fn!==y||I&&!$[k].once||N&&$[k].context!==N)&&O.push($[k]);O.length?this._events[M]=O.length===1?O[0]:O:p(this,M)}return this},v.prototype.removeAllListeners=function(g){var y;return g?(y=o?o+g:g,this._events[y]&&p(this,y)):(this._events=new s,this._eventsCount=0),this},v.prototype.off=v.prototype.removeListener,v.prototype.addListener=v.prototype.on,v.prefixed=o,v.EventEmitter=v,typeof t<"u"&&(t.exports=v)});function oi(e){let t={exports:{}};return e(t,t.exports),t.exports}var ai=Number.MAX_SAFE_INTEGER||9007199254740991,Rt={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:ai,MAX_SAFE_COMPONENT_LENGTH:16},si=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},Y=si,Xe=oi(function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:n}=Rt,o=(t=e.exports={}).re=[],s=t.src=[],c=t.t={},m=0,p=(v,g,y)=>{let N=m++;Y(N,g),c[v]=N,s[N]=g,o[N]=new RegExp(g,y?"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",`(${s[c.NUMERICIDENTIFIER]})\\.(${s[c.NUMERICIDENTIFIER]})\\.(${s[c.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${s[c.NUMERICIDENTIFIERLOOSE]})\\.(${s[c.NUMERICIDENTIFIERLOOSE]})\\.(${s[c.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${s[c.NUMERICIDENTIFIER]}|${s[c.NONNUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${s[c.NUMERICIDENTIFIERLOOSE]}|${s[c.NONNUMERICIDENTIFIER]})`),p("PRERELEASE",`(?:-(${s[c.PRERELEASEIDENTIFIER]}(?:\\.${s[c.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${s[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${s[c.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER","[0-9A-Za-z-]+"),p("BUILD",`(?:\\+(${s[c.BUILDIDENTIFIER]}(?:\\.${s[c.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${s[c.MAINVERSION]}${s[c.PRERELEASE]}?${s[c.BUILD]}?`),p("FULL",`^${s[c.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${s[c.MAINVERSIONLOOSE]}${s[c.PRERELEASELOOSE]}?${s[c.BUILD]}?`),p("LOOSE",`^${s[c.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${s[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${s[c.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${s[c.XRANGEIDENTIFIER]})(?:\\.(${s[c.XRANGEIDENTIFIER]})(?:\\.(${s[c.XRANGEIDENTIFIER]})(?:${s[c.PRERELEASE]})?${s[c.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${s[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[c.XRANGEIDENTIFIERLOOSE]})(?:${s[c.PRERELEASELOOSE]})?${s[c.BUILD]}?)?)?`),p("XRANGE",`^${s[c.GTLT]}\\s*${s[c.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${s[c.GTLT]}\\s*${s[c.XRANGEPLAINLOOSE]}$`),p("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),p("COERCERTL",s[c.COERCE],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${s[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",p("TILDE",`^${s[c.LONETILDE]}${s[c.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${s[c.LONETILDE]}${s[c.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${s[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",p("CARET",`^${s[c.LONECARET]}${s[c.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${s[c.LONECARET]}${s[c.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${s[c.GTLT]}\\s*(${s[c.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${s[c.GTLT]}\\s*(${s[c.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${s[c.GTLT]}\\s*(${s[c.LOOSEPLAIN]}|${s[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${s[c.XRANGEPLAIN]})\\s+-\\s+(${s[c.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${s[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${s[c.XRANGEPLAINLOOSE]})\\s*$`),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0.0.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}),cr=/^[0-9]+$/,wr=(e,t)=>{let n=cr.test(e),o=cr.test(t);return n&&o&&(e=+e,t=+t),e===t?0:n&&!o?-1:o&&!n?1:e<t?-1:1},li=(e,t)=>wr(t,e),ci={compareIdentifiers:wr,rcompareIdentifiers:li},{MAX_LENGTH:ur,MAX_SAFE_INTEGER:Qe}=Rt,{re:fr,t:dr}=Xe,{compareIdentifiers:je}=ci,ee=class{constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof ee){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>ur)throw new TypeError(`version is longer than ${ur} characters`);Y("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let n=e.trim().match(t.loose?fr[dr.LOOSE]:fr[dr.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>Qe||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Qe||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Qe||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<Qe)return s}return o}):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(Y("SemVer.compare",this.version,this.options,e),!(e instanceof ee)){if(typeof e=="string"&&e===this.version)return 0;e=new ee(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof ee||(e=new ee(e,this.options)),je(this.major,e.major)||je(this.minor,e.minor)||je(this.patch,e.patch)}comparePre(e){if(e instanceof ee||(e=new ee(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],o=e.prerelease[t];if(Y("prerelease compare",t,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n!==o)return je(n,o)}while(++t)}compareBuild(e){e instanceof ee||(e=new ee(e,this.options));let t=0;do{let n=this.build[t],o=e.build[t];if(Y("prerelease compare",t,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n!==o)return je(n,o)}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}},ui=(e,t,n)=>new ee(e,n).compare(new ee(t,n)),xe=ui,fi=(e,t,n)=>xe(e,t,n)===0,di=fi,hi=(e,t,n)=>xe(e,t,n)!==0,pi=hi,mi=(e,t,n)=>xe(e,t,n)>0,vi=mi,gi=(e,t,n)=>xe(e,t,n)>=0,yi=gi,Ei=(e,t,n)=>xe(e,t,n)<0,_i=Ei,Ii=(e,t,n)=>xe(e,t,n)<=0,bi=Ii,wi=(e,t,n,o)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e===n;case"!==":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e!==n;case"":case"=":case"==":return di(e,n,o);case"!=":return pi(e,n,o);case">":return vi(e,n,o);case">=":return yi(e,n,o);case"<":return _i(e,n,o);case"<=":return bi(e,n,o);default:throw new TypeError(`Invalid operator: ${t}`)}},It=wi,Ke=Symbol("SemVer ANY"),Ve=class{static get ANY(){return Ke}constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof Ve){if(e.loose===!!t.loose)return e;e=e.value}Y("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Ke?this.value="":this.value=this.operator+this.semver.version,Y("comp",this)}parse(e){let t=this.options.loose?hr[pr.COMPARATORLOOSE]:hr[pr.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 ee(n[2],this.options.loose):this.semver=Ke}toString(){return this.value}test(e){if(Y("Comparator.test",e,this.options.loose),this.semver===Ke||e===Ke)return!0;if(typeof e=="string")try{e=new ee(e,this.options)}catch(t){return!1}return It(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof Ve))throw new TypeError("a Comparator is required");if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),this.operator==="")return this.value===""||new Pe(e.value,t).test(this.value);if(e.operator==="")return e.value===""||new Pe(this.value,t).test(e.semver);let n=!(this.operator!==">="&&this.operator!==">"||e.operator!==">="&&e.operator!==">"),o=!(this.operator!=="<="&&this.operator!=="<"||e.operator!=="<="&&e.operator!=="<"),s=this.semver.version===e.semver.version,c=!(this.operator!==">="&&this.operator!=="<="||e.operator!==">="&&e.operator!=="<="),m=It(this.semver,"<",e.semver,t)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),p=It(this.semver,">",e.semver,t)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return n||o||s&&c||m||p}},{re:hr,t:pr}=Xe,Pe=class{constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof Pe)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new Pe(e.raw,t);if(e instanceof Ve)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?re[te.HYPHENRANGELOOSE]:re[te.HYPHENRANGE];e=e.replace(n,xi(this.options.includePrerelease)),Y("hyphen replace",e),e=e.replace(re[te.COMPARATORTRIM],Ri),Y("comparator trim",e,re[te.COMPARATORTRIM]),e=(e=(e=e.replace(re[te.TILDETRIM],Ai)).replace(re[te.CARETTRIM],Si)).split(/\s+/).join(" ");let o=t?re[te.COMPARATORLOOSE]:re[te.COMPARATOR];return e.split(" ").map(s=>Ni(s,this.options)).join(" ").split(/\s+/).map(s=>Di(s,this.options)).filter(this.options.loose?s=>!!s.match(o):()=>!0).map(s=>new Ve(s,this.options))}intersects(e,t){if(!(e instanceof Pe))throw new TypeError("a Range is required");return this.set.some(n=>mr(n,t)&&e.set.some(o=>mr(o,t)&&n.every(s=>o.every(c=>s.intersects(c,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new ee(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(Ui(this.set[t],e,this.options))return!0;return!1}},{re,t:te,comparatorTrimReplace:Ri,tildeTrimReplace:Ai,caretTrimReplace:Si}=Xe,mr=(e,t)=>{let n=!0,o=e.slice(),s=o.pop();for(;n&&o.length;)n=o.every(c=>s.intersects(c,t)),s=o.pop();return n},Ni=(e,t)=>(Y("comp",e,t),e=Oi(e,t),Y("caret",e),e=Mi(e,t),Y("tildes",e),e=Pi(e,t),Y("xrange",e),e=Ci(e,t),Y("stars",e),e),oe=e=>!e||e.toLowerCase()==="x"||e==="*",Mi=(e,t)=>e.trim().split(/\s+/).map(n=>Ti(n,t)).join(" "),Ti=(e,t)=>{let n=t.loose?re[te.TILDELOOSE]:re[te.TILDE];return e.replace(n,(o,s,c,m,p)=>{let v;return Y("tilde",e,o,s,c,m,p),oe(s)?v="":oe(c)?v=`>=${s}.0.0 <${+s+1}.0.0-0`:oe(m)?v=`>=${s}.${c}.0 <${s}.${+c+1}.0-0`:p?(Y("replaceTilde pr",p),v=`>=${s}.${c}.${m}-${p} <${s}.${+c+1}.0-0`):v=`>=${s}.${c}.${m} <${s}.${+c+1}.0-0`,Y("tilde return",v),v})},Oi=(e,t)=>e.trim().split(/\s+/).map(n=>Li(n,t)).join(" "),Li=(e,t)=>{Y("caret",e,t);let n=t.loose?re[te.CARETLOOSE]:re[te.CARET],o=t.includePrerelease?"-0":"";return e.replace(n,(s,c,m,p,v)=>{let g;return Y("caret",e,s,c,m,p,v),oe(c)?g="":oe(m)?g=`>=${c}.0.0${o} <${+c+1}.0.0-0`:oe(p)?g=c==="0"?`>=${c}.${m}.0${o} <${c}.${+m+1}.0-0`:`>=${c}.${m}.0${o} <${+c+1}.0.0-0`:v?(Y("replaceCaret pr",v),g=c==="0"?m==="0"?`>=${c}.${m}.${p}-${v} <${c}.${m}.${+p+1}-0`:`>=${c}.${m}.${p}-${v} <${c}.${+m+1}.0-0`:`>=${c}.${m}.${p}-${v} <${+c+1}.0.0-0`):(Y("no pr"),g=c==="0"?m==="0"?`>=${c}.${m}.${p}${o} <${c}.${m}.${+p+1}-0`:`>=${c}.${m}.${p}${o} <${c}.${+m+1}.0-0`:`>=${c}.${m}.${p} <${+c+1}.0.0-0`),Y("caret return",g),g})},Pi=(e,t)=>(Y("replaceXRanges",e,t),e.split(/\s+/).map(n=>$i(n,t)).join(" ")),$i=(e,t)=>{e=e.trim();let n=t.loose?re[te.XRANGELOOSE]:re[te.XRANGE];return e.replace(n,(o,s,c,m,p,v)=>{Y("xRange",e,o,s,c,m,p,v);let g=oe(c),y=g||oe(m),N=y||oe(p),I=N;return s==="="&&I&&(s=""),v=t.includePrerelease?"-0":"",g?o=s===">"||s==="<"?"<0.0.0-0":"*":s&&I?(y&&(m=0),p=0,s===">"?(s=">=",y?(c=+c+1,m=0,p=0):(m=+m+1,p=0)):s==="<="&&(s="<",y?c=+c+1:m=+m+1),s==="<"&&(v="-0"),o=`${s+c}.${m}.${p}${v}`):y?o=`>=${c}.0.0${v} <${+c+1}.0.0-0`:N&&(o=`>=${c}.${m}.0${v} <${c}.${+m+1}.0-0`),Y("xRange return",o),o})},Ci=(e,t)=>(Y("replaceStars",e,t),e.trim().replace(re[te.STAR],"")),Di=(e,t)=>(Y("replaceGTE0",e,t),e.trim().replace(re[t.includePrerelease?te.GTE0PRE:te.GTE0],"")),xi=e=>(t,n,o,s,c,m,p,v,g,y,N,I,M)=>`${n=oe(o)?"":oe(s)?`>=${o}.0.0${e?"-0":""}`:oe(c)?`>=${o}.${s}.0${e?"-0":""}`:m?`>=${n}`:`>=${n}${e?"-0":""}`} ${v=oe(g)?"":oe(y)?`<${+g+1}.0.0-0`:oe(N)?`<${g}.${+y+1}.0-0`:I?`<=${g}.${y}.${N}-${I}`:e?`<${g}.${y}.${+N+1}-0`:`<=${v}`}`.trim(),Ui=(e,t,n)=>{for(let o=0;o<e.length;o++)if(!e[o].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let o=0;o<e.length;o++)if(Y(e[o].semver),e[o].semver!==Ve.ANY&&e[o].semver.prerelease.length>0){let s=e[o].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0},ki=(e,t,n)=>{try{t=new Pe(t,n)}catch(o){return!1}return t.test(e)},{MAX_LENGTH:Bi}=Rt,{re:vr,t:gr}=Xe,Wi=(e,t)=>{if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof ee)return e;if(typeof e!="string"||e.length>Bi||!(t.loose?vr[gr.LOOSE]:vr[gr.FULL]).test(e))return null;try{return new ee(e,t)}catch(n){return null}},Fi=Wi,{re:Ze,t:et}=Xe,Gi=(e,t)=>{if(e instanceof ee)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;let n=null;if((t=t||{}).rtl){let o;for(;(o=Ze[et.COERCERTL].exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&o.index+o[0].length===n.index+n[0].length||(n=o),Ze[et.COERCERTL].lastIndex=o.index+o[1].length+o[2].length;Ze[et.COERCERTL].lastIndex=-1}else n=e.match(Ze[et.COERCE]);return n===null?null:Fi(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};function ji(e){return String.fromCharCode(parseInt(e.slice(1),16))}function Ki(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function qi(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,ji))}function Vi(e){return decodeURIComponent(Array.from(atob(e),Ki).join(""))}function Rr(e){return qi(JSON.stringify(e))}function Yi(e){return JSON.parse(Vi(e))}function qe(e){return typeof e=="undefined"}function Hi(e){return e===null}function Ar(e){return Hi(e)||qe(e)}function Xi(e){return Ar(e)?!1:!qe(e.jsonrpc)&&!qe(e.id)&&(!qe(e.result)||!qe(e.error))}function zi(e){return Ar(e)?!1:typeof e=="number"&&Object.values(Te).includes(e)}function bt(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var H={};function Sr(e,t){return Object.assign(H,t),e}var Ji={"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"},pe=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,pe.prototype)}},Ce=class extends Error{constructor(e){super(),this.__proto__=Error;let t=Number(e==null?void 0:e.code);this.rawMessage=(e==null?void 0:e.message)||"Internal error",this.code=zi(t)?t:Te.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(e==null?void 0:e.data)||void 0,Object.setPrototypeOf(this,Ce.prototype)}},Ue=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},lt=class extends Error{constructor(e,t,n,o){super(`Magic Extension Error (${e.name}): [${t}] ${n}`),this.code=t,this.rawMessage=n,this.data=o,this.__proto__=Error,Object.setPrototypeOf(this,lt.prototype)}},it=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 Qi(){return new pe(de.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function Nr(){return new pe(de.ModalNotReady,"Modal is not ready.")}function Zi(){return new pe(de.MalformedResponse,"Response from the Magic iframe is malformed.")}function eo(e){return new pe(de.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 to(e){let t=`Some extensions are incompatible with \`${H.sdkName}@${H.version}\`:`;return e.filter(n=>typeof n.compat!="undefined"&&n.compat!==null).forEach(n=>{let o=n.compat[H.sdkName];typeof o=="string"?t+=`
|
1
|
+
"use strict";var Magic=(()=>{var Fn=Object.create;var Fe=Object.defineProperty;var Gn=Object.getOwnPropertyDescriptor;var jn=Object.getOwnPropertyNames,Qt=Object.getOwnPropertySymbols,Vn=Object.getPrototypeOf,er=Object.prototype.hasOwnProperty,Kn=Object.prototype.propertyIsEnumerable;var Zt=(e,t,n)=>t in e?Fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tr=(e,t)=>{for(var n in t||(t={}))er.call(t,n)&&Zt(e,n,t[n]);if(Qt)for(var n of Qt(t))Kn.call(t,n)&&Zt(e,n,t[n]);return e};var Ge=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,n)=>(typeof require!="undefined"?require:t)[n]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var rr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),nr=(e,t)=>{for(var n in t)Fe(e,n,{get:t[n],enumerable:!0})},ir=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of jn(t))!er.call(e,s)&&s!==n&&Fe(e,s,{get:()=>t[s],enumerable:!(o=Gn(t,s))||o.enumerable});return e};var or=(e,t,n)=>(n=e!=null?Fn(Vn(e)):{},ir(t||!e||!e.__esModule?Fe(n,"default",{value:e,enumerable:!0}):n,e)),qn=e=>ir(Fe({},"__esModule",{value:!0}),e);var Te=(e,t,n)=>new Promise((o,s)=>{var u=p=>{try{m(n.next(p))}catch(g){s(g)}},v=p=>{try{m(n.throw(p))}catch(g){s(g)}},m=p=>p.done?o(p.value):Promise.resolve(p.value).then(u,v);m((n=n.apply(e,t)).next())});var jr=rr((Gr,Lt)=>{(function(e){if(typeof Gr=="object"&&typeof Lt<"u")Lt.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,n;return function o(s,u,v){function m(y,N){if(!u[y]){if(!s[y]){var I=typeof Ge=="function"&&Ge;if(!N&&I)return I(y,!0);if(p)return p(y,!0);var M=new Error("Cannot find module '"+y+"'");throw M.code="MODULE_NOT_FOUND",M}var C=u[y]={exports:{}};s[y][0].call(C.exports,function(U){var O=s[y][1][U];return m(O||U)},C,C.exports,o,s,u,v)}return u[y].exports}for(var p=typeof Ge=="function"&&Ge,g=0;g<v.length;g++)m(v[g]);return m}({1:[function(o,s,u){(function(v){"use strict";var m=v.MutationObserver||v.WebKitMutationObserver,p;if(m){var g=0,y=new m(U),N=v.document.createTextNode("");y.observe(N,{characterData:!0}),p=function(){N.data=g=++g%2}}else if(!v.setImmediate&&typeof v.MessageChannel<"u"){var I=new v.MessageChannel;I.port1.onmessage=U,p=function(){I.port2.postMessage(0)}}else"document"in v&&"onreadystatechange"in v.document.createElement("script")?p=function(){var B=v.document.createElement("script");B.onreadystatechange=function(){U(),B.onreadystatechange=null,B.parentNode.removeChild(B),B=null},v.document.documentElement.appendChild(B)}:p=function(){setTimeout(U,0)};var M,C=[];function U(){M=!0;for(var B,J,D=C.length;D;){for(J=C,C=[],B=-1;++B<D;)J[B]();D=C.length}M=!1}s.exports=O;function O(B){C.push(B)===1&&!M&&p()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(o,s,u){"use strict";var v=o(1);function m(){}var p={},g=["REJECTED"],y=["FULFILLED"],N=["PENDING"];s.exports=I;function I(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=N,this.queue=[],this.outcome=void 0,S!==m&&O(this,S)}I.prototype.catch=function(S){return this.then(null,S)},I.prototype.then=function(S,F){if(typeof S!="function"&&this.state===y||typeof F!="function"&&this.state===g)return this;var k=new this.constructor(m);if(this.state!==N){var K=this.state===y?S:F;C(k,K,this.outcome)}else this.queue.push(new M(k,S,F));return k};function M(S,F,k){this.promise=S,typeof F=="function"&&(this.onFulfilled=F,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}M.prototype.callFulfilled=function(S){p.resolve(this.promise,S)},M.prototype.otherCallFulfilled=function(S){C(this.promise,this.onFulfilled,S)},M.prototype.callRejected=function(S){p.reject(this.promise,S)},M.prototype.otherCallRejected=function(S){C(this.promise,this.onRejected,S)};function C(S,F,k){v(function(){var K;try{K=F(k)}catch(Q){return p.reject(S,Q)}K===S?p.reject(S,new TypeError("Cannot resolve promise with itself")):p.resolve(S,K)})}p.resolve=function(S,F){var k=B(U,F);if(k.status==="error")return p.reject(S,k.value);var K=k.value;if(K)O(S,K);else{S.state=y,S.outcome=F;for(var Q=-1,ie=S.queue.length;++Q<ie;)S.queue[Q].callFulfilled(F)}return S},p.reject=function(S,F){S.state=g,S.outcome=F;for(var k=-1,K=S.queue.length;++k<K;)S.queue[k].callRejected(F);return S};function U(S){var F=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof F=="function")return function(){F.apply(S,arguments)}}function O(S,F){var k=!1;function K(ce){k||(k=!0,p.reject(S,ce))}function Q(ce){k||(k=!0,p.resolve(S,ce))}function ie(){F(Q,K)}var se=B(ie);se.status==="error"&&K(se.value)}function B(S,F){var k={};try{k.value=S(F),k.status="success"}catch(K){k.status="error",k.value=K}return k}I.resolve=J;function J(S){return S instanceof this?S:p.resolve(new this(m),S)}I.reject=D;function D(S){var F=new this(m);return p.reject(F,S)}I.all=pe;function pe(S){var F=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=S.length,K=!1;if(!k)return this.resolve([]);for(var Q=new Array(k),ie=0,se=-1,ce=new this(m);++se<k;)de(S[se],se);return ce;function de(Ie,d){F.resolve(Ie).then(_,function(A){K||(K=!0,p.reject(ce,A))});function _(A){Q[d]=A,++ie===k&&!K&&(K=!0,p.resolve(ce,Q))}}}I.race=ne;function ne(S){var F=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=S.length,K=!1;if(!k)return this.resolve([]);for(var Q=-1,ie=new this(m);++Q<k;)se(S[Q]);return ie;function se(ce){F.resolve(ce).then(function(de){K||(K=!0,p.resolve(ie,de))},function(de){K||(K=!0,p.reject(ie,de))})}}},{1:1}],3:[function(o,s,u){(function(v){"use strict";typeof v.Promise!="function"&&(v.Promise=o(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(o,s,u){"use strict";var v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r};function m(r,a){if(!(r instanceof a))throw new TypeError("Cannot call a class as a function")}function p(){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 g=p();function y(){try{if(!g||!g.open)return!1;var r=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),a=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!r||a)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function N(r,a){r=r||[],a=a||{};try{return new Blob(r,a)}catch(c){if(c.name!=="TypeError")throw c;for(var i=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,l=new i,f=0;f<r.length;f+=1)l.append(r[f]);return l.getBlob(a.type)}}typeof Promise>"u"&&o(3);var I=Promise;function M(r,a){a&&r.then(function(i){a(null,i)},function(i){a(i)})}function C(r,a,i){typeof a=="function"&&r.then(a),typeof i=="function"&&r.catch(i)}function U(r){return typeof r!="string"&&(console.warn(r+" used as a key, but it is not a string."),r=String(r)),r}function O(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var B="local-forage-detect-blob-support",J=void 0,D={},pe=Object.prototype.toString,ne="readonly",S="readwrite";function F(r){for(var a=r.length,i=new ArrayBuffer(a),l=new Uint8Array(i),f=0;f<a;f++)l[f]=r.charCodeAt(f);return i}function k(r){return new I(function(a){var i=r.transaction(B,S),l=N([""]);i.objectStore(B).put(l,"key"),i.onabort=function(f){f.preventDefault(),f.stopPropagation(),a(!1)},i.oncomplete=function(){var f=navigator.userAgent.match(/Chrome\/(\d+)/),c=navigator.userAgent.match(/Edge\//);a(c||!f||parseInt(f[1],10)>=43)}}).catch(function(){return!1})}function K(r){return typeof J=="boolean"?I.resolve(J):k(r).then(function(a){return J=a,J})}function Q(r){var a=D[r.name],i={};i.promise=new I(function(l,f){i.resolve=l,i.reject=f}),a.deferredOperations.push(i),a.dbReady?a.dbReady=a.dbReady.then(function(){return i.promise}):a.dbReady=i.promise}function ie(r){var a=D[r.name],i=a.deferredOperations.pop();if(i)return i.resolve(),i.promise}function se(r,a){var i=D[r.name],l=i.deferredOperations.pop();if(l)return l.reject(a),l.promise}function ce(r,a){return new I(function(i,l){if(D[r.name]=D[r.name]||Z(),r.db)if(a)Q(r),r.db.close();else return i(r.db);var f=[r.name];a&&f.push(r.version);var c=g.open.apply(g,f);a&&(c.onupgradeneeded=function(h){var E=c.result;try{E.createObjectStore(r.storeName),h.oldVersion<=1&&E.createObjectStore(B)}catch(b){if(b.name==="ConstraintError")console.warn('The database "'+r.name+'" has been upgraded from version '+h.oldVersion+" to version "+h.newVersion+', but the storage "'+r.storeName+'" already exists.');else throw b}}),c.onerror=function(h){h.preventDefault(),l(c.error)},c.onsuccess=function(){var h=c.result;h.onversionchange=function(E){E.target.close()},i(h),ie(r)}})}function de(r){return ce(r,!1)}function Ie(r){return ce(r,!0)}function d(r,a){if(!r.db)return!0;var i=!r.db.objectStoreNames.contains(r.storeName),l=r.version<r.db.version,f=r.version>r.db.version;if(l&&(r.version!==a&&console.warn('The database "'+r.name+`" can't be downgraded from version `+r.db.version+" to version "+r.version+"."),r.version=r.db.version),f||i){if(i){var c=r.db.version+1;c>r.version&&(r.version=c)}return!0}return!1}function _(r){return new I(function(a,i){var l=new FileReader;l.onerror=i,l.onloadend=function(f){var c=btoa(f.target.result||"");a({__local_forage_encoded_blob:!0,data:c,type:r.type})},l.readAsBinaryString(r)})}function A(r){var a=F(atob(r.data));return N([a],{type:r.type})}function L(r){return r&&r.__local_forage_encoded_blob}function P(r){var a=this,i=a._initReady().then(function(){var l=D[a._dbInfo.name];if(l&&l.dbReady)return l.dbReady});return C(i,r,r),i}function x(r){Q(r);for(var a=D[r.name],i=a.forages,l=0;l<i.length;l++){var f=i[l];f._dbInfo.db&&(f._dbInfo.db.close(),f._dbInfo.db=null)}return r.db=null,de(r).then(function(c){return r.db=c,d(r)?Ie(r):c}).then(function(c){r.db=a.db=c;for(var h=0;h<i.length;h++)i[h]._dbInfo.db=c}).catch(function(c){throw se(r,c),c})}function G(r,a,i,l){l===void 0&&(l=1);try{var f=r.db.transaction(r.storeName,a);i(null,f)}catch(c){if(l>0&&(!r.db||c.name==="InvalidStateError"||c.name==="NotFoundError"))return I.resolve().then(function(){if(!r.db||c.name==="NotFoundError"&&!r.db.objectStoreNames.contains(r.storeName)&&r.version<=r.db.version)return r.db&&(r.version=r.db.version+1),Ie(r)}).then(function(){return x(r).then(function(){G(r,a,i,l-1)})}).catch(i);i(c)}}function Z(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ne(r){var a=this,i={db:null};if(r)for(var l in r)i[l]=r[l];var f=D[i.name];f||(f=Z(),D[i.name]=f),f.forages.push(a),a._initReady||(a._initReady=a.ready,a.ready=P);var c=[];function h(){return I.resolve()}for(var E=0;E<f.forages.length;E++){var b=f.forages[E];b!==a&&c.push(b._initReady().catch(h))}var w=f.forages.slice(0);return I.all(c).then(function(){return i.db=f.db,de(i)}).then(function(R){return i.db=R,d(i,a._defaultConfig.version)?Ie(i):R}).then(function(R){i.db=f.db=R,a._dbInfo=i;for(var T=0;T<w.length;T++){var W=w[T];W!==a&&(W._dbInfo.db=i.db,W._dbInfo.version=i.version)}})}function be(r,a){var i=this;r=U(r);var l=new I(function(f,c){i.ready().then(function(){G(i._dbInfo,ne,function(h,E){if(h)return c(h);try{var b=E.objectStore(i._dbInfo.storeName),w=b.get(r);w.onsuccess=function(){var R=w.result;R===void 0&&(R=null),L(R)&&(R=A(R)),f(R)},w.onerror=function(){c(w.error)}}catch(R){c(R)}})}).catch(c)});return M(l,a),l}function Ue(r,a){var i=this,l=new I(function(f,c){i.ready().then(function(){G(i._dbInfo,ne,function(h,E){if(h)return c(h);try{var b=E.objectStore(i._dbInfo.storeName),w=b.openCursor(),R=1;w.onsuccess=function(){var T=w.result;if(T){var W=T.value;L(W)&&(W=A(W));var j=r(W,T.key,R++);j!==void 0?f(j):T.continue()}else f()},w.onerror=function(){c(w.error)}}catch(T){c(T)}})}).catch(c)});return M(l,a),l}function qr(r,a,i){var l=this;r=U(r);var f=new I(function(c,h){var E;l.ready().then(function(){return E=l._dbInfo,pe.call(a)==="[object Blob]"?K(E.db).then(function(b){return b?a:_(a)}):a}).then(function(b){G(l._dbInfo,S,function(w,R){if(w)return h(w);try{var T=R.objectStore(l._dbInfo.storeName);b===null&&(b=void 0);var W=T.put(b,r);R.oncomplete=function(){b===void 0&&(b=null),c(b)},R.onabort=R.onerror=function(){var j=W.error?W.error:W.transaction.error;h(j)}}catch(j){h(j)}})}).catch(h)});return M(f,i),f}function Yr(r,a){var i=this;r=U(r);var l=new I(function(f,c){i.ready().then(function(){G(i._dbInfo,S,function(h,E){if(h)return c(h);try{var b=E.objectStore(i._dbInfo.storeName),w=b.delete(r);E.oncomplete=function(){f()},E.onerror=function(){c(w.error)},E.onabort=function(){var R=w.error?w.error:w.transaction.error;c(R)}}catch(R){c(R)}})}).catch(c)});return M(l,a),l}function Hr(r){var a=this,i=new I(function(l,f){a.ready().then(function(){G(a._dbInfo,S,function(c,h){if(c)return f(c);try{var E=h.objectStore(a._dbInfo.storeName),b=E.clear();h.oncomplete=function(){l()},h.onabort=h.onerror=function(){var w=b.error?b.error:b.transaction.error;f(w)}}catch(w){f(w)}})}).catch(f)});return M(i,r),i}function Xr(r){var a=this,i=new I(function(l,f){a.ready().then(function(){G(a._dbInfo,ne,function(c,h){if(c)return f(c);try{var E=h.objectStore(a._dbInfo.storeName),b=E.count();b.onsuccess=function(){l(b.result)},b.onerror=function(){f(b.error)}}catch(w){f(w)}})}).catch(f)});return M(i,r),i}function zr(r,a){var i=this,l=new I(function(f,c){if(r<0){f(null);return}i.ready().then(function(){G(i._dbInfo,ne,function(h,E){if(h)return c(h);try{var b=E.objectStore(i._dbInfo.storeName),w=!1,R=b.openKeyCursor();R.onsuccess=function(){var T=R.result;if(!T){f(null);return}r===0||w?f(T.key):(w=!0,T.advance(r))},R.onerror=function(){c(R.error)}}catch(T){c(T)}})}).catch(c)});return M(l,a),l}function Jr(r){var a=this,i=new I(function(l,f){a.ready().then(function(){G(a._dbInfo,ne,function(c,h){if(c)return f(c);try{var E=h.objectStore(a._dbInfo.storeName),b=E.openKeyCursor(),w=[];b.onsuccess=function(){var R=b.result;if(!R){l(w);return}w.push(R.key),R.continue()},b.onerror=function(){f(b.error)}}catch(R){f(R)}})}).catch(f)});return M(i,r),i}function Qr(r,a){a=O.apply(this,arguments);var i=this.config();r=typeof r!="function"&&r||{},r.name||(r.name=r.name||i.name,r.storeName=r.storeName||i.storeName);var l=this,f;if(!r.name)f=I.reject("Invalid arguments");else{var c=r.name===i.name&&l._dbInfo.db,h=c?I.resolve(l._dbInfo.db):de(r).then(function(E){var b=D[r.name],w=b.forages;b.db=E;for(var R=0;R<w.length;R++)w[R]._dbInfo.db=E;return E});r.storeName?f=h.then(function(E){if(!!E.objectStoreNames.contains(r.storeName)){var b=E.version+1;Q(r);var w=D[r.name],R=w.forages;E.close();for(var T=0;T<R.length;T++){var W=R[T];W._dbInfo.db=null,W._dbInfo.version=b}var j=new I(function(q,z){var X=g.open(r.name,b);X.onerror=function(fe){var Be=X.result;Be.close(),z(fe)},X.onupgradeneeded=function(){var fe=X.result;fe.deleteObjectStore(r.storeName)},X.onsuccess=function(){var fe=X.result;fe.close(),q(fe)}});return j.then(function(q){w.db=q;for(var z=0;z<R.length;z++){var X=R[z];X._dbInfo.db=q,ie(X._dbInfo)}}).catch(function(q){throw(se(r,q)||I.resolve()).catch(function(){}),q})}}):f=h.then(function(E){Q(r);var b=D[r.name],w=b.forages;E.close();for(var R=0;R<w.length;R++){var T=w[R];T._dbInfo.db=null}var W=new I(function(j,q){var z=g.deleteDatabase(r.name);z.onerror=function(){var X=z.result;X&&X.close(),q(z.error)},z.onblocked=function(){console.warn('dropInstance blocked for database "'+r.name+'" until all open connections are closed')},z.onsuccess=function(){var X=z.result;X&&X.close(),j(X)}});return W.then(function(j){b.db=j;for(var q=0;q<w.length;q++){var z=w[q];ie(z._dbInfo)}}).catch(function(j){throw(se(r,j)||I.resolve()).catch(function(){}),j})})}return M(f,a),f}var Zr={_driver:"asyncStorage",_initStorage:Ne,_support:y(),iterate:Ue,getItem:be,setItem:qr,removeItem:Yr,clear:Hr,length:Xr,key:zr,keys:Jr,dropInstance:Qr};function en(){return typeof openDatabase=="function"}var ge="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tn="~~local_forage_type~",Ct=/^~~local_forage_type~([^~]+)~/,ze="__lfsc__:",dt=ze.length,ht="arbf",mt="blob",$t="si08",Dt="ui08",xt="uic8",kt="si16",Ut="si32",Wt="ur16",Bt="ui32",Ft="fl32",Gt="fl64",jt=dt+ht.length,Vt=Object.prototype.toString;function Kt(r){var a=r.length*.75,i=r.length,l,f=0,c,h,E,b;r[r.length-1]==="="&&(a--,r[r.length-2]==="="&&a--);var w=new ArrayBuffer(a),R=new Uint8Array(w);for(l=0;l<i;l+=4)c=ge.indexOf(r[l]),h=ge.indexOf(r[l+1]),E=ge.indexOf(r[l+2]),b=ge.indexOf(r[l+3]),R[f++]=c<<2|h>>4,R[f++]=(h&15)<<4|E>>2,R[f++]=(E&3)<<6|b&63;return w}function vt(r){var a=new Uint8Array(r),i="",l;for(l=0;l<a.length;l+=3)i+=ge[a[l]>>2],i+=ge[(a[l]&3)<<4|a[l+1]>>4],i+=ge[(a[l+1]&15)<<2|a[l+2]>>6],i+=ge[a[l+2]&63];return a.length%3===2?i=i.substring(0,i.length-1)+"=":a.length%3===1&&(i=i.substring(0,i.length-2)+"=="),i}function rn(r,a){var i="";if(r&&(i=Vt.call(r)),r&&(i==="[object ArrayBuffer]"||r.buffer&&Vt.call(r.buffer)==="[object ArrayBuffer]")){var l,f=ze;r instanceof ArrayBuffer?(l=r,f+=ht):(l=r.buffer,i==="[object Int8Array]"?f+=$t:i==="[object Uint8Array]"?f+=Dt:i==="[object Uint8ClampedArray]"?f+=xt:i==="[object Int16Array]"?f+=kt:i==="[object Uint16Array]"?f+=Wt:i==="[object Int32Array]"?f+=Ut:i==="[object Uint32Array]"?f+=Bt:i==="[object Float32Array]"?f+=Ft:i==="[object Float64Array]"?f+=Gt:a(new Error("Failed to get type for BinaryArray"))),a(f+vt(l))}else if(i==="[object Blob]"){var c=new FileReader;c.onload=function(){var h=tn+r.type+"~"+vt(this.result);a(ze+mt+h)},c.readAsArrayBuffer(r)}else try{a(JSON.stringify(r))}catch(h){console.error("Couldn't convert value into a JSON string: ",r),a(null,h)}}function nn(r){if(r.substring(0,dt)!==ze)return JSON.parse(r);var a=r.substring(jt),i=r.substring(dt,jt),l;if(i===mt&&Ct.test(a)){var f=a.match(Ct);l=f[1],a=a.substring(f[0].length)}var c=Kt(a);switch(i){case ht:return c;case mt:return N([c],{type:l});case $t:return new Int8Array(c);case Dt:return new Uint8Array(c);case xt:return new Uint8ClampedArray(c);case kt:return new Int16Array(c);case Wt:return new Uint16Array(c);case Ut:return new Int32Array(c);case Bt:return new Uint32Array(c);case Ft:return new Float32Array(c);case Gt:return new Float64Array(c);default:throw new Error("Unkown type: "+i)}}var pt={serialize:rn,deserialize:nn,stringToBuffer:Kt,bufferToString:vt};function qt(r,a,i,l){r.executeSql("CREATE TABLE IF NOT EXISTS "+a.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,l)}function on(r){var a=this,i={db:null};if(r)for(var l in r)i[l]=typeof r[l]!="string"?r[l].toString():r[l];var f=new I(function(c,h){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(E){return h(E)}i.db.transaction(function(E){qt(E,i,function(){a._dbInfo=i,c()},function(b,w){h(w)})},h)});return i.serializer=pt,f}function ye(r,a,i,l,f,c){r.executeSql(i,l,f,function(h,E){E.code===E.SYNTAX_ERR?h.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[a.storeName],function(b,w){w.rows.length?c(b,E):qt(b,a,function(){b.executeSql(i,l,f,c)},c)},c):c(h,E)},c)}function an(r,a){var i=this;r=U(r);var l=new I(function(f,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(E){ye(E,h,"SELECT * FROM "+h.storeName+" WHERE key = ? LIMIT 1",[r],function(b,w){var R=w.rows.length?w.rows.item(0).value:null;R&&(R=h.serializer.deserialize(R)),f(R)},function(b,w){c(w)})})}).catch(c)});return M(l,a),l}function sn(r,a){var i=this,l=new I(function(f,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(E){ye(E,h,"SELECT * FROM "+h.storeName,[],function(b,w){for(var R=w.rows,T=R.length,W=0;W<T;W++){var j=R.item(W),q=j.value;if(q&&(q=h.serializer.deserialize(q)),q=r(q,j.key,W+1),q!==void 0){f(q);return}}f()},function(b,w){c(w)})})}).catch(c)});return M(l,a),l}function Yt(r,a,i,l){var f=this;r=U(r);var c=new I(function(h,E){f.ready().then(function(){a===void 0&&(a=null);var b=a,w=f._dbInfo;w.serializer.serialize(a,function(R,T){T?E(T):w.db.transaction(function(W){ye(W,w,"INSERT OR REPLACE INTO "+w.storeName+" (key, value) VALUES (?, ?)",[r,R],function(){h(b)},function(j,q){E(q)})},function(W){if(W.code===W.QUOTA_ERR){if(l>0){h(Yt.apply(f,[r,b,i,l-1]));return}E(W)}})})}).catch(E)});return M(c,i),c}function cn(r,a,i){return Yt.apply(this,[r,a,i,1])}function un(r,a){var i=this;r=U(r);var l=new I(function(f,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(E){ye(E,h,"DELETE FROM "+h.storeName+" WHERE key = ?",[r],function(){f()},function(b,w){c(w)})})}).catch(c)});return M(l,a),l}function ln(r){var a=this,i=new I(function(l,f){a.ready().then(function(){var c=a._dbInfo;c.db.transaction(function(h){ye(h,c,"DELETE FROM "+c.storeName,[],function(){l()},function(E,b){f(b)})})}).catch(f)});return M(i,r),i}function fn(r){var a=this,i=new I(function(l,f){a.ready().then(function(){var c=a._dbInfo;c.db.transaction(function(h){ye(h,c,"SELECT COUNT(key) as c FROM "+c.storeName,[],function(E,b){var w=b.rows.item(0).c;l(w)},function(E,b){f(b)})})}).catch(f)});return M(i,r),i}function dn(r,a){var i=this,l=new I(function(f,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(E){ye(E,h,"SELECT key FROM "+h.storeName+" WHERE id = ? LIMIT 1",[r+1],function(b,w){var R=w.rows.length?w.rows.item(0).key:null;f(R)},function(b,w){c(w)})})}).catch(c)});return M(l,a),l}function hn(r){var a=this,i=new I(function(l,f){a.ready().then(function(){var c=a._dbInfo;c.db.transaction(function(h){ye(h,c,"SELECT key FROM "+c.storeName,[],function(E,b){for(var w=[],R=0;R<b.rows.length;R++)w.push(b.rows.item(R).key);l(w)},function(E,b){f(b)})})}).catch(f)});return M(i,r),i}function mn(r){return new I(function(a,i){r.transaction(function(l){l.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(f,c){for(var h=[],E=0;E<c.rows.length;E++)h.push(c.rows.item(E).name);a({db:r,storeNames:h})},function(f,c){i(c)})},function(l){i(l)})})}function vn(r,a){a=O.apply(this,arguments);var i=this.config();r=typeof r!="function"&&r||{},r.name||(r.name=r.name||i.name,r.storeName=r.storeName||i.storeName);var l=this,f;return r.name?f=new I(function(c){var h;r.name===i.name?h=l._dbInfo.db:h=openDatabase(r.name,"","",0),r.storeName?c({db:h,storeNames:[r.storeName]}):c(mn(h))}).then(function(c){return new I(function(h,E){c.db.transaction(function(b){function w(j){return new I(function(q,z){b.executeSql("DROP TABLE IF EXISTS "+j,[],function(){q()},function(X,fe){z(fe)})})}for(var R=[],T=0,W=c.storeNames.length;T<W;T++)R.push(w(c.storeNames[T]));I.all(R).then(function(){h()}).catch(function(j){E(j)})},function(b){E(b)})})}):f=I.reject("Invalid arguments"),M(f,a),f}var pn={_driver:"webSQLStorage",_initStorage:on,_support:en(),iterate:sn,getItem:an,setItem:cn,removeItem:un,clear:ln,length:fn,key:dn,keys:hn,dropInstance:vn};function gn(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Ht(r,a){var i=r.name+"/";return r.storeName!==a.storeName&&(i+=r.storeName+"/"),i}function yn(){var r="_localforage_support_test";try{return localStorage.setItem(r,!0),localStorage.removeItem(r),!1}catch{return!0}}function En(){return!yn()||localStorage.length>0}function _n(r){var a=this,i={};if(r)for(var l in r)i[l]=r[l];return i.keyPrefix=Ht(r,a._defaultConfig),En()?(a._dbInfo=i,i.serializer=pt,I.resolve()):I.reject()}function In(r){var a=this,i=a.ready().then(function(){for(var l=a._dbInfo.keyPrefix,f=localStorage.length-1;f>=0;f--){var c=localStorage.key(f);c.indexOf(l)===0&&localStorage.removeItem(c)}});return M(i,r),i}function bn(r,a){var i=this;r=U(r);var l=i.ready().then(function(){var f=i._dbInfo,c=localStorage.getItem(f.keyPrefix+r);return c&&(c=f.serializer.deserialize(c)),c});return M(l,a),l}function wn(r,a){var i=this,l=i.ready().then(function(){for(var f=i._dbInfo,c=f.keyPrefix,h=c.length,E=localStorage.length,b=1,w=0;w<E;w++){var R=localStorage.key(w);if(R.indexOf(c)===0){var T=localStorage.getItem(R);if(T&&(T=f.serializer.deserialize(T)),T=r(T,R.substring(h),b++),T!==void 0)return T}}});return M(l,a),l}function Rn(r,a){var i=this,l=i.ready().then(function(){var f=i._dbInfo,c;try{c=localStorage.key(r)}catch{c=null}return c&&(c=c.substring(f.keyPrefix.length)),c});return M(l,a),l}function An(r){var a=this,i=a.ready().then(function(){for(var l=a._dbInfo,f=localStorage.length,c=[],h=0;h<f;h++){var E=localStorage.key(h);E.indexOf(l.keyPrefix)===0&&c.push(E.substring(l.keyPrefix.length))}return c});return M(i,r),i}function Sn(r){var a=this,i=a.keys().then(function(l){return l.length});return M(i,r),i}function Nn(r,a){var i=this;r=U(r);var l=i.ready().then(function(){var f=i._dbInfo;localStorage.removeItem(f.keyPrefix+r)});return M(l,a),l}function Mn(r,a,i){var l=this;r=U(r);var f=l.ready().then(function(){a===void 0&&(a=null);var c=a;return new I(function(h,E){var b=l._dbInfo;b.serializer.serialize(a,function(w,R){if(R)E(R);else try{localStorage.setItem(b.keyPrefix+r,w),h(c)}catch(T){(T.name==="QuotaExceededError"||T.name==="NS_ERROR_DOM_QUOTA_REACHED")&&E(T),E(T)}})})});return M(f,i),f}function Tn(r,a){if(a=O.apply(this,arguments),r=typeof r!="function"&&r||{},!r.name){var i=this.config();r.name=r.name||i.name,r.storeName=r.storeName||i.storeName}var l=this,f;return r.name?f=new I(function(c){r.storeName?c(Ht(r,l._defaultConfig)):c(r.name+"/")}).then(function(c){for(var h=localStorage.length-1;h>=0;h--){var E=localStorage.key(h);E.indexOf(c)===0&&localStorage.removeItem(E)}}):f=I.reject("Invalid arguments"),M(f,a),f}var On={_driver:"localStorageWrapper",_initStorage:_n,_support:gn(),iterate:wn,getItem:bn,setItem:Mn,removeItem:Nn,clear:In,length:Sn,key:Rn,keys:An,dropInstance:Tn},Ln=function(a,i){return a===i||typeof a=="number"&&typeof i=="number"&&isNaN(a)&&isNaN(i)},Pn=function(a,i){for(var l=a.length,f=0;f<l;){if(Ln(a[f],i))return!0;f++}return!1},Xt=Array.isArray||function(r){return Object.prototype.toString.call(r)==="[object Array]"},We={},zt={},Me={INDEXEDDB:Zr,WEBSQL:pn,LOCALSTORAGE:On},Cn=[Me.INDEXEDDB._driver,Me.WEBSQL._driver,Me.LOCALSTORAGE._driver],Je=["dropInstance"],gt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Je),$n={description:"",driver:Cn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Dn(r,a){r[a]=function(){var i=arguments;return r.ready().then(function(){return r[a].apply(r,i)})}}function yt(){for(var r=1;r<arguments.length;r++){var a=arguments[r];if(a)for(var i in a)a.hasOwnProperty(i)&&(Xt(a[i])?arguments[0][i]=a[i].slice():arguments[0][i]=a[i])}return arguments[0]}var xn=function(){function r(a){m(this,r);for(var i in Me)if(Me.hasOwnProperty(i)){var l=Me[i],f=l._driver;this[i]=f,We[f]||this.defineDriver(l)}this._defaultConfig=yt({},$n),this._config=yt({},this._defaultConfig,a),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return r.prototype.config=function(i){if((typeof i>"u"?"undefined":v(i))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var l in i){if(l==="storeName"&&(i[l]=i[l].replace(/\W/g,"_")),l==="version"&&typeof i[l]!="number")return new Error("Database version must be a number.");this._config[l]=i[l]}return"driver"in i&&i.driver?this.setDriver(this._config.driver):!0}else return typeof i=="string"?this._config[i]:this._config},r.prototype.defineDriver=function(i,l,f){var c=new I(function(h,E){try{var b=i._driver,w=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!i._driver){E(w);return}for(var R=gt.concat("_initStorage"),T=0,W=R.length;T<W;T++){var j=R[T],q=!Pn(Je,j);if((q||i[j])&&typeof i[j]!="function"){E(w);return}}var z=function(){for(var Be=function(Wn){return function(){var Bn=new Error("Method "+Wn+" is not implemented by the current driver"),Jt=I.reject(Bn);return M(Jt,arguments[arguments.length-1]),Jt}},Et=0,Un=Je.length;Et<Un;Et++){var _t=Je[Et];i[_t]||(i[_t]=Be(_t))}};z();var X=function(Be){We[b]&&console.info("Redefining LocalForage driver: "+b),We[b]=i,zt[b]=Be,h()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(X,E):X(!!i._support):X(!0)}catch(fe){E(fe)}});return C(c,l,f),c},r.prototype.driver=function(){return this._driver||null},r.prototype.getDriver=function(i,l,f){var c=We[i]?I.resolve(We[i]):I.reject(new Error("Driver not found."));return C(c,l,f),c},r.prototype.getSerializer=function(i){var l=I.resolve(pt);return C(l,i),l},r.prototype.ready=function(i){var l=this,f=l._driverSet.then(function(){return l._ready===null&&(l._ready=l._initDriver()),l._ready});return C(f,i,i),f},r.prototype.setDriver=function(i,l,f){var c=this;Xt(i)||(i=[i]);var h=this._getSupportedDrivers(i);function E(){c._config.driver=c.driver()}function b(T){return c._extend(T),E(),c._ready=c._initStorage(c._config),c._ready}function w(T){return function(){var W=0;function j(){for(;W<T.length;){var q=T[W];return W++,c._dbInfo=null,c._ready=null,c.getDriver(q).then(b).catch(j)}E();var z=new Error("No available storage method found.");return c._driverSet=I.reject(z),c._driverSet}return j()}}var R=this._driverSet!==null?this._driverSet.catch(function(){return I.resolve()}):I.resolve();return this._driverSet=R.then(function(){var T=h[0];return c._dbInfo=null,c._ready=null,c.getDriver(T).then(function(W){c._driver=W._driver,E(),c._wrapLibraryMethodsWithReady(),c._initDriver=w(h)})}).catch(function(){E();var T=new Error("No available storage method found.");return c._driverSet=I.reject(T),c._driverSet}),C(this._driverSet,l,f),this._driverSet},r.prototype.supports=function(i){return!!zt[i]},r.prototype._extend=function(i){yt(this,i)},r.prototype._getSupportedDrivers=function(i){for(var l=[],f=0,c=i.length;f<c;f++){var h=i[f];this.supports(h)&&l.push(h)}return l},r.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,l=gt.length;i<l;i++)Dn(this,gt[i])},r.prototype.createInstance=function(i){return new r(i)},r}(),kn=new xn;s.exports=kn},{3:3}]},{},[4])(4)})});var Kr=rr((ut,Vr)=>{(function(e,t){typeof ut=="object"&&typeof Vr<"u"?t(ut):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],t):t(e.LocalforageDriverMemory={})})(typeof self<"u"?self:ut,function(e){"use strict";var t="localforage-driver-memory";function n(d){var _=typeof Symbol=="function"&&d[Symbol.iterator],A=0;return _?_.call(d):{next:function(){return d&&A>=d.length&&(d=void 0),{value:d&&d[A++],done:!d}}}}function o(d,_){d=d||[],_=_||{};try{return new Blob(d,_)}catch(x){if(x.name!=="TypeError")throw x;for(var A=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,L=new A,P=0;P<d.length;P+=1)L.append(d[P]);return L.getBlob(_.type)}}var s=/^~~local_forage_type~([^~]+)~/,u=9,v=u+4,m=Object.prototype.toString;function p(d){var _=d.length*.75,A=d.length;d[d.length-1]==="="&&(_--,d[d.length-2]==="="&&_--);for(var L=new ArrayBuffer(_),P=new Uint8Array(L),x=0,G=0;x<A;x+=4){var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x]),Ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x+1]),be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x+2]),Ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x+3]);P[G++]=Z<<2|Ne>>4,P[G++]=(Ne&15)<<4|be>>2,P[G++]=(be&3)<<6|Ue&63}return L}function g(d){for(var _=new Uint8Array(d),A="",L=0;L<_.length;L+=3)A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[_[L]>>2],A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(_[L]&3)<<4|_[L+1]>>4],A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(_[L+1]&15)<<2|_[L+2]>>6],A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[_[L+2]&63];return _.length%3===2?A=A.substring(0,A.length-1)+"=":_.length%3===1&&(A=A.substring(0,A.length-2)+"=="),A}function y(d,_){var A="";if(d&&(A=m.call(d)),d&&(A==="[object ArrayBuffer]"||d.buffer&&m.call(d.buffer)==="[object ArrayBuffer]")){var L=void 0,P="__lfsc__:";d instanceof ArrayBuffer?(L=d,P+="arbf"):(L=d.buffer,A==="[object Int8Array]"?P+="si08":A==="[object Uint8Array]"?P+="ui08":A==="[object Uint8ClampedArray]"?P+="uic8":A==="[object Int16Array]"?P+="si16":A==="[object Uint16Array]"?P+="ur16":A==="[object Int32Array]"?P+="si32":A==="[object Uint32Array]"?P+="ui32":A==="[object Float32Array]"?P+="fl32":A==="[object Float64Array]"?P+="fl64":_(new Error("Failed to get type for BinaryArray"))),_(P+g(L))}else if(A==="[object Blob]"){var x=new FileReader;x.onload=function(){var G="~~local_forage_type~"+d.type+"~"+g(this.result);_("__lfsc__:blob"+G)},x.readAsArrayBuffer(d)}else try{_(JSON.stringify(d))}catch(G){console.error("Couldn't convert value into a JSON string: ",d),_(null,G)}}function N(d){if(d.substring(0,u)!=="__lfsc__:")return JSON.parse(d);var _=d.substring(v),A=d.substring(u,v),L;if(A==="blob"&&s.test(_)){var P=_.match(s);L=P[1],_=_.substring(P[0].length)}var x=p(_);switch(A){case"arbf":return x;case"blob":return o([x],{type:L});case"si08":return new Int8Array(x);case"ui08":return new Uint8Array(x);case"uic8":return new Uint8ClampedArray(x);case"si16":return new Int16Array(x);case"ur16":return new Uint16Array(x);case"si32":return new Int32Array(x);case"ui32":return new Uint32Array(x);case"fl32":return new Float32Array(x);case"fl64":return new Float64Array(x);default:throw new Error("Unkown type: "+A)}}function I(d){var _,A;if(d===null||typeof d!="object"||"isActiveClone"in d)return d;var L=d instanceof Date?new Date(d):d.constructor();try{for(var P=n(Object.keys(d)),x=P.next();!x.done;x=P.next()){var G=x.value;Object.prototype.hasOwnProperty.call(d,G)&&(d.isActiveClone=null,L[G]=I(d[G]),delete d.isActiveClone)}}catch(Z){_={error:Z}}finally{try{x&&!x.done&&(A=P.return)&&A.call(P)}finally{if(_)throw _.error}}return L}function M(d,_){return(d.name||_.name)+"/"+(d.storeName||_.storeName)+"/"}function C(d,_){_&&d.then(function(A){_(null,A)},function(A){_(A)})}function U(){for(var d=[],_=0;_<arguments.length;_++)d[_]=arguments[_];if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}function O(d,_){var A=this;if(_=U.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var L=this.config();d.name=d.name||L.name,d.storeName=d.storeName||L.storeName}var P;return d.name?P=new Promise(function(x){d.storeName?x(M(d,A._defaultConfig)):x(d.name+"/")}):P=Promise.reject("Invalid arguments"),{promise:P,callback:_}}function B(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:g,deserialize:N,serialize:y,stringToBuffer:p},D={},pe=function(){function d(_){this.kp=_,this.data={}}return d.resolve=function(_){return D[_]||(D[_]=new d(_)),D[_]},d.prototype.clear=function(){this.data={}},d.prototype.drop=function(){this.clear(),delete D[this.kp]},d.prototype.get=function(_){return this.data[_]},d.prototype.key=function(_){return this.keys()[_]},d.prototype.keys=function(){return Object.keys(this.data)},d.prototype.rm=function(_){delete this.data[_]},d.prototype.set=function(_,A){this.data[_]=A},d}();function ne(d){var _=d?I(d):{},A=M(_,this._defaultConfig),L=pe.resolve(A);return this._dbInfo=_,this._dbInfo.serializer=J,this._dbInfo.keyPrefix=A,this._dbInfo.mStore=L,Promise.resolve()}function S(d){var _=this,A=this.ready().then(function(){_._dbInfo.mStore.clear()});return C(A,d),A}function F(d,_){var A=O.apply(this,arguments),L=A.promise,P=A.callback,x=L.then(function(G){pe.resolve(G).drop()});return C(x,P),L}function k(d,_){var A=this;d=B(d);var L=this.ready().then(function(){var P=A._dbInfo.mStore.get(d);return P==null?null:A._dbInfo.serializer.deserialize(P)});return C(L,_),L}function K(d,_){var A=this,L=this.ready().then(function(){for(var P=A._dbInfo.mStore,x=P.keys(),G=0;G<x.length;G++){var Z=P.get(x[G]);if(Z&&(Z=A._dbInfo.serializer.deserialize(Z)),Z=d(Z,x[G],G+1),Z!==void 0)return Z}});return C(L,_),L}function Q(d,_){var A=this,L=this.ready().then(function(){var P;try{P=A._dbInfo.mStore.key(d),P===void 0&&(P=null)}catch{P=null}return P});return C(L,_),L}function ie(d){var _=this,A=this.ready().then(function(){return _._dbInfo.mStore.keys()});return C(A,d),A}function se(d){var _=this.keys().then(function(A){return A.length});return C(_,d),_}function ce(d,_){var A=this;d=B(d);var L=this.ready().then(function(){A._dbInfo.mStore.rm(d)});return C(L,_),L}function de(d,_,A){var L=this;d=B(d);var P=this.ready().then(function(){_===void 0&&(_=null);var x=_;return new Promise(function(G,Z){L._dbInfo.serializer.serialize(_,function(Ne,be){if(be)Z(be);else try{L._dbInfo.mStore.set(d,Ne),G(x)}catch(Ue){Z(Ue)}})})});return C(P,A),P}var Ie=!0;e._support=Ie,e._driver=t,e._initStorage=ne,e.clear=S,e.dropInstance=F,e.getItem=k,e.iterate=K,e.key=Q,e.keys=ie,e.length=se,e.removeItem=ce,e.setItem=de,Object.defineProperty(e,"__esModule",{value:!0})})});var jo={};nr(jo,{default:()=>Go});var he=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(he||{}),we=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e))(we||{}),Oe=(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))(Oe||{}),ue=(e=>(e.MetaMask="metamask",e.CoinbaseWallet="coinbase_wallet",e))(ue||{}),Le=(e=>(e.WalletSelected="wallet_selected",e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e))(Le||{}),$=(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.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.UpdatePhoneNumber="magic_auth_update_phone_number",e.UpdatePhoneNumberTestMode="magic_auth_update_phone_number_testing_mode",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))($||{}),me=(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))(me||{}),Re=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(Re||{}),ar=(e=>(e.Harmony="HARMONY",e))(ar||{});var Yn=Object.create,st=Object.defineProperty,Hn=Object.defineProperties,Xn=Object.getOwnPropertyDescriptor,zn=Object.getOwnPropertyDescriptors,Jn=Object.getOwnPropertyNames,sr=Object.getOwnPropertySymbols,Qn=Object.getPrototypeOf,Ir=Object.prototype.hasOwnProperty,Zn=Object.prototype.propertyIsEnumerable,cr=(e,t,n)=>t in e?st(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wt=(e,t)=>{for(var n in t||(t={}))Ir.call(t,n)&&cr(e,n,t[n]);if(sr)for(var n of sr(t))Zn.call(t,n)&&cr(e,n,t[n]);return e},br=(e,t)=>Hn(e,zn(t)),ei=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ti=(e,t)=>{for(var n in t)st(e,n,{get:t[n],enumerable:!0})},ri=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Jn(t))!Ir.call(e,s)&&s!==n&&st(e,s,{get:()=>t[s],enumerable:!(o=Xn(t,s))||o.enumerable});return e},ni=(e,t,n)=>(n=e!=null?Yn(Qn(e)):{},ri(t||!e||!e.__esModule?st(n,"default",{value:e,enumerable:!0}):n,e)),ae=(e,t,n)=>new Promise((o,s)=>{var u=p=>{try{m(n.next(p))}catch(g){s(g)}},v=p=>{try{m(n.throw(p))}catch(g){s(g)}},m=p=>p.done?o(p.value):Promise.resolve(p.value).then(u,v);m((n=n.apply(e,t)).next())}),ii=ei((e,t)=>{"use strict";var n=Object.prototype.hasOwnProperty,o="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(o=!1));function u(g,y,N){this.fn=g,this.context=y,this.once=N||!1}function v(g,y,N,I,M){if(typeof N!="function")throw new TypeError("The listener must be a function");var C=new u(N,I||g,M),U=o?o+y:y;return g._events[U]?g._events[U].fn?g._events[U]=[g._events[U],C]:g._events[U].push(C):(g._events[U]=C,g._eventsCount++),g}function m(g,y){--g._eventsCount===0?g._events=new s:delete g._events[y]}function p(){this._events=new s,this._eventsCount=0}p.prototype.eventNames=function(){var g=[],y,N;if(this._eventsCount===0)return g;for(N in y=this._events)n.call(y,N)&&g.push(o?N.slice(1):N);return Object.getOwnPropertySymbols?g.concat(Object.getOwnPropertySymbols(y)):g},p.prototype.listeners=function(g){var y=o?o+g:g,N=this._events[y];if(!N)return[];if(N.fn)return[N.fn];for(var I=0,M=N.length,C=new Array(M);I<M;I++)C[I]=N[I].fn;return C},p.prototype.listenerCount=function(g){var y=o?o+g:g,N=this._events[y];return N?N.fn?1:N.length:0},p.prototype.emit=function(g,y,N,I,M,C){var U=o?o+g:g;if(!this._events[U])return!1;var O=this._events[U],B=arguments.length,J,D;if(O.fn){switch(O.once&&this.removeListener(g,O.fn,void 0,!0),B){case 1:return O.fn.call(O.context),!0;case 2:return O.fn.call(O.context,y),!0;case 3:return O.fn.call(O.context,y,N),!0;case 4:return O.fn.call(O.context,y,N,I),!0;case 5:return O.fn.call(O.context,y,N,I,M),!0;case 6:return O.fn.call(O.context,y,N,I,M,C),!0}for(D=1,J=new Array(B-1);D<B;D++)J[D-1]=arguments[D];O.fn.apply(O.context,J)}else{var pe=O.length,ne;for(D=0;D<pe;D++)switch(O[D].once&&this.removeListener(g,O[D].fn,void 0,!0),B){case 1:O[D].fn.call(O[D].context);break;case 2:O[D].fn.call(O[D].context,y);break;case 3:O[D].fn.call(O[D].context,y,N);break;case 4:O[D].fn.call(O[D].context,y,N,I);break;default:if(!J)for(ne=1,J=new Array(B-1);ne<B;ne++)J[ne-1]=arguments[ne];O[D].fn.apply(O[D].context,J)}}return!0},p.prototype.on=function(g,y,N){return v(this,g,y,N,!1)},p.prototype.once=function(g,y,N){return v(this,g,y,N,!0)},p.prototype.removeListener=function(g,y,N,I){var M=o?o+g:g;if(!this._events[M])return this;if(!y)return m(this,M),this;var C=this._events[M];if(C.fn)C.fn===y&&(!I||C.once)&&(!N||C.context===N)&&m(this,M);else{for(var U=0,O=[],B=C.length;U<B;U++)(C[U].fn!==y||I&&!C[U].once||N&&C[U].context!==N)&&O.push(C[U]);O.length?this._events[M]=O.length===1?O[0]:O:m(this,M)}return this},p.prototype.removeAllListeners=function(g){var y;return g?(y=o?o+g:g,this._events[y]&&m(this,y)):(this._events=new s,this._eventsCount=0),this},p.prototype.off=p.prototype.removeListener,p.prototype.addListener=p.prototype.on,p.prefixed=o,p.EventEmitter=p,typeof t<"u"&&(t.exports=p)});function oi(e){let t={exports:{}};return e(t,t.exports),t.exports}var ai=Number.MAX_SAFE_INTEGER||9007199254740991,Rt={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:ai,MAX_SAFE_COMPONENT_LENGTH:16},si=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},Y=si,Xe=oi(function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:n}=Rt,o=(t=e.exports={}).re=[],s=t.src=[],u=t.t={},v=0,m=(p,g,y)=>{let N=v++;Y(N,g),u[p]=N,s[N]=g,o[N]=new RegExp(g,y?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","[0-9]+"),m("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),m("MAINVERSION",`(${s[u.NUMERICIDENTIFIER]})\\.(${s[u.NUMERICIDENTIFIER]})\\.(${s[u.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${s[u.NUMERICIDENTIFIERLOOSE]})\\.(${s[u.NUMERICIDENTIFIERLOOSE]})\\.(${s[u.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${s[u.NUMERICIDENTIFIER]}|${s[u.NONNUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${s[u.NUMERICIDENTIFIERLOOSE]}|${s[u.NONNUMERICIDENTIFIER]})`),m("PRERELEASE",`(?:-(${s[u.PRERELEASEIDENTIFIER]}(?:\\.${s[u.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${s[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${s[u.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER","[0-9A-Za-z-]+"),m("BUILD",`(?:\\+(${s[u.BUILDIDENTIFIER]}(?:\\.${s[u.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${s[u.MAINVERSION]}${s[u.PRERELEASE]}?${s[u.BUILD]}?`),m("FULL",`^${s[u.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${s[u.MAINVERSIONLOOSE]}${s[u.PRERELEASELOOSE]}?${s[u.BUILD]}?`),m("LOOSE",`^${s[u.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${s[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${s[u.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${s[u.XRANGEIDENTIFIER]})(?:\\.(${s[u.XRANGEIDENTIFIER]})(?:\\.(${s[u.XRANGEIDENTIFIER]})(?:${s[u.PRERELEASE]})?${s[u.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${s[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[u.XRANGEIDENTIFIERLOOSE]})(?:${s[u.PRERELEASELOOSE]})?${s[u.BUILD]}?)?)?`),m("XRANGE",`^${s[u.GTLT]}\\s*${s[u.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${s[u.GTLT]}\\s*${s[u.XRANGEPLAINLOOSE]}$`),m("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),m("COERCERTL",s[u.COERCE],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${s[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",m("TILDE",`^${s[u.LONETILDE]}${s[u.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${s[u.LONETILDE]}${s[u.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${s[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",m("CARET",`^${s[u.LONECARET]}${s[u.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${s[u.LONECARET]}${s[u.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${s[u.GTLT]}\\s*(${s[u.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${s[u.GTLT]}\\s*(${s[u.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${s[u.GTLT]}\\s*(${s[u.LOOSEPLAIN]}|${s[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${s[u.XRANGEPLAIN]})\\s+-\\s+(${s[u.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${s[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${s[u.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0.0.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}),ur=/^[0-9]+$/,wr=(e,t)=>{let n=ur.test(e),o=ur.test(t);return n&&o&&(e=+e,t=+t),e===t?0:n&&!o?-1:o&&!n?1:e<t?-1:1},ci=(e,t)=>wr(t,e),ui={compareIdentifiers:wr,rcompareIdentifiers:ci},{MAX_LENGTH:lr,MAX_SAFE_INTEGER:Qe}=Rt,{re:fr,t:dr}=Xe,{compareIdentifiers:je}=ui,ee=class{constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof ee){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>lr)throw new TypeError(`version is longer than ${lr} characters`);Y("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let n=e.trim().match(t.loose?fr[dr.LOOSE]:fr[dr.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>Qe||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Qe||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Qe||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<Qe)return s}return o}):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(Y("SemVer.compare",this.version,this.options,e),!(e instanceof ee)){if(typeof e=="string"&&e===this.version)return 0;e=new ee(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof ee||(e=new ee(e,this.options)),je(this.major,e.major)||je(this.minor,e.minor)||je(this.patch,e.patch)}comparePre(e){if(e instanceof ee||(e=new ee(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],o=e.prerelease[t];if(Y("prerelease compare",t,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n!==o)return je(n,o)}while(++t)}compareBuild(e){e instanceof ee||(e=new ee(e,this.options));let t=0;do{let n=this.build[t],o=e.build[t];if(Y("prerelease compare",t,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n!==o)return je(n,o)}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}},li=(e,t,n)=>new ee(e,n).compare(new ee(t,n)),xe=li,fi=(e,t,n)=>xe(e,t,n)===0,di=fi,hi=(e,t,n)=>xe(e,t,n)!==0,mi=hi,vi=(e,t,n)=>xe(e,t,n)>0,pi=vi,gi=(e,t,n)=>xe(e,t,n)>=0,yi=gi,Ei=(e,t,n)=>xe(e,t,n)<0,_i=Ei,Ii=(e,t,n)=>xe(e,t,n)<=0,bi=Ii,wi=(e,t,n,o)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e===n;case"!==":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e!==n;case"":case"=":case"==":return di(e,n,o);case"!=":return mi(e,n,o);case">":return pi(e,n,o);case">=":return yi(e,n,o);case"<":return _i(e,n,o);case"<=":return bi(e,n,o);default:throw new TypeError(`Invalid operator: ${t}`)}},It=wi,Ve=Symbol("SemVer ANY"),qe=class{static get ANY(){return Ve}constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof qe){if(e.loose===!!t.loose)return e;e=e.value}Y("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Ve?this.value="":this.value=this.operator+this.semver.version,Y("comp",this)}parse(e){let t=this.options.loose?hr[mr.COMPARATORLOOSE]:hr[mr.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 ee(n[2],this.options.loose):this.semver=Ve}toString(){return this.value}test(e){if(Y("Comparator.test",e,this.options.loose),this.semver===Ve||e===Ve)return!0;if(typeof e=="string")try{e=new ee(e,this.options)}catch(t){return!1}return It(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof qe))throw new TypeError("a Comparator is required");if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),this.operator==="")return this.value===""||new Ce(e.value,t).test(this.value);if(e.operator==="")return e.value===""||new Ce(this.value,t).test(e.semver);let n=!(this.operator!==">="&&this.operator!==">"||e.operator!==">="&&e.operator!==">"),o=!(this.operator!=="<="&&this.operator!=="<"||e.operator!=="<="&&e.operator!=="<"),s=this.semver.version===e.semver.version,u=!(this.operator!==">="&&this.operator!=="<="||e.operator!==">="&&e.operator!=="<="),v=It(this.semver,"<",e.semver,t)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),m=It(this.semver,">",e.semver,t)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return n||o||s&&u||v||m}},{re:hr,t:mr}=Xe,Ce=class{constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof Ce)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new Ce(e.raw,t);if(e instanceof qe)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?re[te.HYPHENRANGELOOSE]:re[te.HYPHENRANGE];e=e.replace(n,xi(this.options.includePrerelease)),Y("hyphen replace",e),e=e.replace(re[te.COMPARATORTRIM],Ri),Y("comparator trim",e,re[te.COMPARATORTRIM]),e=(e=(e=e.replace(re[te.TILDETRIM],Ai)).replace(re[te.CARETTRIM],Si)).split(/\s+/).join(" ");let o=t?re[te.COMPARATORLOOSE]:re[te.COMPARATOR];return e.split(" ").map(s=>Ni(s,this.options)).join(" ").split(/\s+/).map(s=>Di(s,this.options)).filter(this.options.loose?s=>!!s.match(o):()=>!0).map(s=>new qe(s,this.options))}intersects(e,t){if(!(e instanceof Ce))throw new TypeError("a Range is required");return this.set.some(n=>vr(n,t)&&e.set.some(o=>vr(o,t)&&n.every(s=>o.every(u=>s.intersects(u,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new ee(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(ki(this.set[t],e,this.options))return!0;return!1}},{re,t:te,comparatorTrimReplace:Ri,tildeTrimReplace:Ai,caretTrimReplace:Si}=Xe,vr=(e,t)=>{let n=!0,o=e.slice(),s=o.pop();for(;n&&o.length;)n=o.every(u=>s.intersects(u,t)),s=o.pop();return n},Ni=(e,t)=>(Y("comp",e,t),e=Oi(e,t),Y("caret",e),e=Mi(e,t),Y("tildes",e),e=Pi(e,t),Y("xrange",e),e=$i(e,t),Y("stars",e),e),oe=e=>!e||e.toLowerCase()==="x"||e==="*",Mi=(e,t)=>e.trim().split(/\s+/).map(n=>Ti(n,t)).join(" "),Ti=(e,t)=>{let n=t.loose?re[te.TILDELOOSE]:re[te.TILDE];return e.replace(n,(o,s,u,v,m)=>{let p;return Y("tilde",e,o,s,u,v,m),oe(s)?p="":oe(u)?p=`>=${s}.0.0 <${+s+1}.0.0-0`:oe(v)?p=`>=${s}.${u}.0 <${s}.${+u+1}.0-0`:m?(Y("replaceTilde pr",m),p=`>=${s}.${u}.${v}-${m} <${s}.${+u+1}.0-0`):p=`>=${s}.${u}.${v} <${s}.${+u+1}.0-0`,Y("tilde return",p),p})},Oi=(e,t)=>e.trim().split(/\s+/).map(n=>Li(n,t)).join(" "),Li=(e,t)=>{Y("caret",e,t);let n=t.loose?re[te.CARETLOOSE]:re[te.CARET],o=t.includePrerelease?"-0":"";return e.replace(n,(s,u,v,m,p)=>{let g;return Y("caret",e,s,u,v,m,p),oe(u)?g="":oe(v)?g=`>=${u}.0.0${o} <${+u+1}.0.0-0`:oe(m)?g=u==="0"?`>=${u}.${v}.0${o} <${u}.${+v+1}.0-0`:`>=${u}.${v}.0${o} <${+u+1}.0.0-0`:p?(Y("replaceCaret pr",p),g=u==="0"?v==="0"?`>=${u}.${v}.${m}-${p} <${u}.${v}.${+m+1}-0`:`>=${u}.${v}.${m}-${p} <${u}.${+v+1}.0-0`:`>=${u}.${v}.${m}-${p} <${+u+1}.0.0-0`):(Y("no pr"),g=u==="0"?v==="0"?`>=${u}.${v}.${m}${o} <${u}.${v}.${+m+1}-0`:`>=${u}.${v}.${m}${o} <${u}.${+v+1}.0-0`:`>=${u}.${v}.${m} <${+u+1}.0.0-0`),Y("caret return",g),g})},Pi=(e,t)=>(Y("replaceXRanges",e,t),e.split(/\s+/).map(n=>Ci(n,t)).join(" ")),Ci=(e,t)=>{e=e.trim();let n=t.loose?re[te.XRANGELOOSE]:re[te.XRANGE];return e.replace(n,(o,s,u,v,m,p)=>{Y("xRange",e,o,s,u,v,m,p);let g=oe(u),y=g||oe(v),N=y||oe(m),I=N;return s==="="&&I&&(s=""),p=t.includePrerelease?"-0":"",g?o=s===">"||s==="<"?"<0.0.0-0":"*":s&&I?(y&&(v=0),m=0,s===">"?(s=">=",y?(u=+u+1,v=0,m=0):(v=+v+1,m=0)):s==="<="&&(s="<",y?u=+u+1:v=+v+1),s==="<"&&(p="-0"),o=`${s+u}.${v}.${m}${p}`):y?o=`>=${u}.0.0${p} <${+u+1}.0.0-0`:N&&(o=`>=${u}.${v}.0${p} <${u}.${+v+1}.0-0`),Y("xRange return",o),o})},$i=(e,t)=>(Y("replaceStars",e,t),e.trim().replace(re[te.STAR],"")),Di=(e,t)=>(Y("replaceGTE0",e,t),e.trim().replace(re[t.includePrerelease?te.GTE0PRE:te.GTE0],"")),xi=e=>(t,n,o,s,u,v,m,p,g,y,N,I,M)=>`${n=oe(o)?"":oe(s)?`>=${o}.0.0${e?"-0":""}`:oe(u)?`>=${o}.${s}.0${e?"-0":""}`:v?`>=${n}`:`>=${n}${e?"-0":""}`} ${p=oe(g)?"":oe(y)?`<${+g+1}.0.0-0`:oe(N)?`<${g}.${+y+1}.0-0`:I?`<=${g}.${y}.${N}-${I}`:e?`<${g}.${y}.${+N+1}-0`:`<=${p}`}`.trim(),ki=(e,t,n)=>{for(let o=0;o<e.length;o++)if(!e[o].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let o=0;o<e.length;o++)if(Y(e[o].semver),e[o].semver!==qe.ANY&&e[o].semver.prerelease.length>0){let s=e[o].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0},Ui=(e,t,n)=>{try{t=new Ce(t,n)}catch(o){return!1}return t.test(e)},{MAX_LENGTH:Wi}=Rt,{re:pr,t:gr}=Xe,Bi=(e,t)=>{if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof ee)return e;if(typeof e!="string"||e.length>Wi||!(t.loose?pr[gr.LOOSE]:pr[gr.FULL]).test(e))return null;try{return new ee(e,t)}catch(n){return null}},Fi=Bi,{re:Ze,t:et}=Xe,Gi=(e,t)=>{if(e instanceof ee)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;let n=null;if((t=t||{}).rtl){let o;for(;(o=Ze[et.COERCERTL].exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&o.index+o[0].length===n.index+n[0].length||(n=o),Ze[et.COERCERTL].lastIndex=o.index+o[1].length+o[2].length;Ze[et.COERCERTL].lastIndex=-1}else n=e.match(Ze[et.COERCE]);return n===null?null:Fi(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};function ji(e){return String.fromCharCode(parseInt(e.slice(1),16))}function Vi(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function Ki(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,ji))}function qi(e){return decodeURIComponent(Array.from(atob(e),Vi).join(""))}function Rr(e){return Ki(JSON.stringify(e))}function Yi(e){return JSON.parse(qi(e))}function Ke(e){return typeof e=="undefined"}function Hi(e){return e===null}function Ar(e){return Hi(e)||Ke(e)}function Xi(e){return Ar(e)?!1:!Ke(e.jsonrpc)&&!Ke(e.id)&&(!Ke(e.result)||!Ke(e.error))}function zi(e){return Ar(e)?!1:typeof e=="number"&&Object.values(Oe).includes(e)}function bt(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var H={};function Sr(e,t){return Object.assign(H,t),e}var Ji={"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"},ve=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,ve.prototype)}},$e=class extends Error{constructor(e){super(),this.__proto__=Error;let t=Number(e==null?void 0:e.code);this.rawMessage=(e==null?void 0:e.message)||"Internal error",this.code=zi(t)?t:Oe.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(e==null?void 0:e.data)||void 0,Object.setPrototypeOf(this,$e.prototype)}},ke=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},ct=class extends Error{constructor(e,t,n,o){super(`Magic Extension Error (${e.name}): [${t}] ${n}`),this.code=t,this.rawMessage=n,this.data=o,this.__proto__=Error,Object.setPrototypeOf(this,ct.prototype)}},it=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 Qi(){return new ve(he.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function Nr(){return new ve(he.ModalNotReady,"Modal is not ready.")}function Zi(){return new ve(he.MalformedResponse,"Response from the Magic iframe is malformed.")}function eo(e){return new ve(he.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 to(e){let t=`Some extensions are incompatible with \`${H.sdkName}@${H.version}\`:`;return e.filter(n=>typeof n.compat!="undefined"&&n.compat!==null).forEach(n=>{let o=n.compat[H.sdkName];typeof o=="string"?t+=`
|
2
2
|
- Extension \`${n.name}\` supports version(s) \`${o}\``:o||(t+=`
|
3
|
-
- Extension \`${n.name}\` does not support ${H.platform} environments.`)}),new
|
3
|
+
- Extension \`${n.name}\` does not support ${H.platform} environments.`)}),new ve(he.IncompatibleExtensions,t)}function ro(e){let t=n=>{let o=n+1,s=o%10,u=o%100;return s===1&&u!==11?`${o}st`:s===2&&u!==12?`${o}nd`:s===3&&u!==13?`${o}rd`:`${o}th`};return new ve(he.InvalidArgument,`Invalid ${t(e.argument)} argument given to \`${e.procedure}\`.
|
4
4
|
Expected: \`${e.expected}\`
|
5
|
-
Received: \`${e.received}\``)}function Mr(){return new Ue(be.DuplicateIframe,"Duplicate iframes found.")}function no(){return new Ue(be.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 io(){return new Ue(be.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 \`${H.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}function $e(e){let{method:t,removalVersions:n,useInstead:o}=e,s=n[H.sdkName],c=o?` Use \`${o}\` instead.`:"",m=`\`${t}\` will be removed from \`${H.sdkName}\` in version \`${s}\`.${c}`;return new Ue(be.DeprecationNotice,m)}function*oo(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}var ao=oo();function Tr(){return ao.next().value}var Or=Symbol("Payload pre-processed by Magic SDK");function Lr(e){return Object.defineProperty(e,Or,{value:!0,enumerable:!1}),e}function so(e){return!!e[Or]}function ot(e){var t,n,o;return so(e)||(e.jsonrpc=(t=e.jsonrpc)!=null?t:"2.0",e.id=Tr(),e.method=(n=e.method)!=null?n:"noop",e.params=(o=e.params)!=null?o:[],Lr(e)),e}function K(e,t=[]){return Lr({params:t,method:e,jsonrpc:"2.0",id:Tr()})}var At=class{constructor(e){e instanceof At?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):Xi(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=void 0,this._error=void 0)}applyError(e){return this._error=e,this}applyResult(e){return this._result=e,this}get hasError(){return typeof this._error!="undefined"&&this._error!==null}get hasResult(){return typeof this._result!="undefined"}get payload(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}}},lo=ni(ii()),co=class extends lo.default{};function Pr(){let e=new co;return{emitter:e,createChainingEmitterMethod:(t,n)=>(...o)=>(e[t].apply(e,o),n),createBoundEmitterMethod:t=>(...n)=>e[t].apply(e,n)}}var $r=Symbol("isPromiEvent");function St(e){return!!e[$r]}function Cr(e){let t=Dr(e),{createBoundEmitterMethod:n,createChainingEmitterMethod:o}=Pr(),s=Symbol("Promise.then"),c=Symbol("Promise.catch"),m=Symbol("Promise.finally"),p=(y,N)=>(...I)=>{let M=N[y].apply(N,I);return v(M)},v=y=>Object.assign(y,{[$r]:!0,[s]:y[s]||y.then,[c]:y[c]||y.catch,[m]:y[m]||y.finally,then:p(s,y),catch:p(c,y),finally:p(m,y),on:o("on",y),once:o("once",y),addListener:o("addListener",y),off:o("off",y),removeListener:o("removeListener",y),removeAllListeners:o("removeAllListeners",y),emit:n("emit"),eventNames:n("eventNames"),listeners:n("listeners"),listenerCount:n("listenerCount")}),g=v(t.then(y=>(g.emit("done",y),g.emit("settled"),y),y=>{throw g.emit("error",y),g.emit("settled"),y}));return g}function Dr(e){return new Promise((t,n)=>{let o=e(t,n);Promise.resolve(o).catch(n)})}var Ae=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(we.MAGIC_HANDLE_REQUEST,ot(e)),n=Cr((s,c)=>{t.then(m=>{if(o(),m.hasError)c(new Ce(m.payload.error));else if(m.hasResult)s(m.payload.result);else throw Zi()}).catch(m=>{o(),c(m)})}),o=this.overlay.on(he.MAGIC_HANDLE_EVENT,s=>{var c;let{response:m}=s.data;if(m.id===e.id&&((c=m.result)==null?void 0:c.event)){let{event:p,params:v=[]}=m.result;n.emit(p,...v)}});return n}createIntermediaryEvent(e,t){return n=>{let o=K(C.IntermediaryEvent,[{payloadId:t,eventType:e,args:n}]);this.request(o)}}},uo=class extends Ae{loginWithMagicLink(e){let{email:t,showUI:n=!0,redirectURI:o}=e,s=K(this.sdk.testMode?C.LoginWithMagicLinkTestMode:C.LoginWithMagicLink,[{email:t,showUI:n,redirectURI:o}]);return this.request(s)}loginWithSMS(e){let{phoneNumber:t}=e,n=K(this.sdk.testMode?C.LoginWithSmsTestMode:C.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(n)}loginWithEmailOTP(e){let{email:t,showUI:n}=e,o=K(this.sdk.testMode?C.LoginWithEmailOTPTestMode:C.LoginWithEmailOTP,[{email:t,showUI:n}]);if(!n){let s=this.request(o);return s&&(s.on("verify-email-otp",c=>{this.createIntermediaryEvent("verify-email-otp",o.id)(c)}),s.on("cancel",()=>{this.createIntermediaryEvent("cancel",o.id)()})),s}return this.request(o)}loginWithCredential(e){let t=e!=null?e:"";if(!e&&H.platform==="web"){t=window.location.search;let o=window.location.origin+window.location.pathname;window.history.replaceState(null,"",o)}let n=K(this.sdk.testMode?C.LoginWithCredentialTestMode:C.LoginWithCredential,[t]);return this.request(n)}setAuthorizationToken(){let e=K(C.SetAuthorizationToken);return this.request(e)}updateEmailWithUI(e){let{email:t,showUI:n=!0}=e,o=K(this.sdk.testMode?C.UpdateEmailTestMode:C.UpdateEmail,[{email:t,showUI:n}]);return this.request(o)}updatePhoneNumberWithUI(){let e=K(this.sdk.testMode?C.UpdatePhoneNumberTestMode:C.UpdatePhoneNumber);return this.request(e)}},xr={};ti(xr,{clear:()=>fo,getItem:()=>ye,iterate:()=>vo,key:()=>po,keys:()=>mo,length:()=>ho,removeItem:()=>Ye,setItem:()=>De});var tt;function Ee(e){return(...t)=>ae(this,null,function*(){return tt||(tt=yield H.configureStorage()),yield tt.ready(),tt[e](...t)})}var ye=Ee("getItem"),De=Ee("setItem"),Ye=Ee("removeItem"),fo=Ee("clear"),ho=Ee("length"),po=Ee("key"),mo=Ee("keys"),vo=Ee("iterate");function go(){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 Nt="STORE_KEY_PRIVATE_KEY",at="STORE_KEY_PUBLIC_JWK",Mt="ECDSA",Ur="P-256",yo={name:Mt,namedCurve:Ur},Eo={name:Mt,namedCurve:Ur};function kr(){Ye(at),Ye(Nt)}function _o(){return ae(this,null,function*(){let e=yield Io();if(!e){console.info("unable to create public key or webcrypto is unsupported");return}let{subtle:t}=window.crypto,n=yield ye(Nt);if(!n||!t){console.info("unable to find private key or webcrypto unsupported");return}let o={iat:Math.floor(new Date().getTime()/1e3),jti:go()},s={typ:"dpop+jwt",alg:"ES256",jwk:e},c={protected:yr(JSON.stringify(s)),claims:yr(JSON.stringify(o))},m=Ro(`${c.protected}.${c.claims}`),p={name:Mt,hash:{name:"SHA-256"}},v=So(new Uint8Array(yield t.sign(p,n,m)));return`${c.protected}.${c.claims}.${v}`})}function Io(){return ae(this,null,function*(){if(!wo()){console.info("webcrypto is not supported");return}return(yield ye(at))||(yield bo()),ye(at)})}function bo(){return ae(this,null,function*(){let e=null,{subtle:t}=window.crypto,n=yield t.generateKey(yo,!0,["sign"]),o=yield t.exportKey("jwk",n.privateKey);e=yield t.exportKey("jwk",n.publicKey);let s=yield t.importKey("jwk",o,Eo,!1,["sign"]);yield De(Nt,s),yield De(at,e)})}function wo(){let e=typeof window!="undefined"&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}function yr(e){return Br(Ao(e))}function Ro(e){return new TextEncoder().encode(e)}function Br(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}function Ao(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(t,n)=>String.fromCharCode(parseInt(n,16)))}function So(e){let t="";return e.forEach(n=>{t+=String.fromCharCode(n)}),Br(t)}var No=class extends Ae{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}getIdToken(e){let t=K(this.sdk.testMode?C.GetIdTokenTestMode:C.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=K(this.sdk.testMode?C.GenerateIdTokenTestMode:C.GenerateIdToken,[e]);return this.request(t)}getInfo(){return ae(this,null,function*(){let e=yield ye(this.localForageKey),t=K(C.GetInfo,[{walletType:e}]);return this.request(t)})}isLoggedIn(){let e=K(this.sdk.testMode?C.IsLoggedInTestMode:C.IsLoggedIn);return this.request(e)}logout(){kr(),Ye(this.localForageKey);let e=K(this.sdk.testMode?C.LogoutTestMode:C.Logout);return this.request(e)}requestUserInfoWithUI(e){let t=K(C.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}showSettings(){let e=K(this.sdk.testMode?C.UserSettingsTestMode:C.UserSettings);return this.request(e)}recoverAccount(e){let t=K(this.sdk.testMode?C.RecoverAccountTestMode:C.RecoverAccount,[e]);return this.request(t)}getMetadata(){$e({method:"user.getMetadata()",removalVersions:{"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"},useInstead:"user.getInfo()"}).log();let e=K(this.sdk.testMode?C.GetMetadataTestMode:C.GetMetadata);return this.request(e)}updateEmail(e){$e({method:"user.updateEmail()",removalVersions:{"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"},useInstead:"auth.updateEmailWithUI()"}).log();let{email:t,showUI:n=!0}=e,o=K(this.sdk.testMode?C.UpdateEmailTestMode:C.UpdateEmail,[{email:t,showUI:n}]);return this.request(o)}updatePhoneNumber(){$e({method:"user.updatePhoneNumber()",removalVersions:{"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"},useInstead:"auth.updatePhoneNumberWithUI()"}).log();let e=K(this.sdk.testMode?C.UpdatePhoneNumberTestMode:C.UpdatePhoneNumber);return this.request(e)}},Mo=class extends Ae{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}connectWithUI(){return ae(this,null,function*(){if(this.isMetaMaskBrowser())try{if(yield this.isWalletEnabled(ce.MetaMask))return this.autoConnectIfWalletBrowser(ce.MetaMask)}catch(o){console.error(o)}if(this.isCoinbaseWalletBrowser())try{if(yield this.isWalletEnabled(ce.CoinbaseWallet))return this.autoConnectIfWalletBrowser(ce.CoinbaseWallet)}catch(o){console.error(o)}let e=this.getUserEnv(),t=K(C.Login,[e]),n=this.request(t);return n.on(Oe.WalletSelected,o=>this.handleWalletSelected(br(wt({},o),{payloadId:t.id}))),n})}showUI(){let e=K(C.ShowUI);return this.request(e)}getInfo(){return ae(this,null,function*(){$e({method:"wallet.getInfo()",removalVersions:{"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"},useInstead:"user.getInfo()"}).log();let e=yield ye(this.localForageKey),t=K(C.GetInfo,[{walletType:e}]);return this.request(t)})}disconnect(){$e({method:"wallet.disconnect()",removalVersions:{"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"},useInstead:"user.logout()"}).log(),kr(),Ye(this.localForageKey);let e=K(C.Disconnect);return this.request(e)}requestUserInfoWithUI(e){$e({method:"wallet.requestUserInfoWithUI()",removalVersions:{"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"},useInstead:"user.requestUserInfoWithUI()"}).log();let t=K(C.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}getProvider(){return ae(this,null,function*(){switch(yield ye(this.localForageKey)){case ce.MetaMask:return this.getMetaMaskProvider();case ce.CoinbaseWallet:return this.getCoinbaseProvider();default:return this.sdk.rpcProvider}})}isMetaMaskInstalled(){var e,t,n;return((e=window.ethereum)==null?void 0:e.isMetaMask)||!!((n=(t=window.ethereum)==null?void 0:t.providers)!=null&&n.find(o=>o==null?void 0:o.isMetaMask))}isMetaMaskBrowser(){return this.isMobile()&&this.isMetaMaskInstalled()}getMetaMaskProvider(){var e,t;return((t=(e=window.ethereum)==null?void 0:e.providers)==null?void 0:t.find(n=>n==null?void 0:n.isMetaMask))||window.ethereum}connectToMetaMask(){if(this.isMobile()&&!this.isMetaMaskInstalled()){let e=`https://metamask.app.link/dapp/${window.location.href.replace(/(^\w+:|^)\/\//,"")}`;window.location.href=e}return this.getMetaMaskProvider().request({method:"eth_requestAccounts"})}isCoinbaseWalletInstalled(){var e,t,n;return((e=window.ethereum)==null?void 0:e.isCoinbaseWallet)||!!((n=(t=window.ethereum)==null?void 0:t.providers)!=null&&n.find(o=>o==null?void 0:o.isCoinbaseWallet))}isCoinbaseWalletBrowser(){var e;return!!((e=window.ethereum)!=null&&e.isCoinbaseBrowser)}getCoinbaseProvider(){var e,t;return((t=(e=window.ethereum)==null?void 0:e.providers)==null?void 0:t.find(n=>n==null?void 0:n.isCoinbaseWallet))||window.ethereum}connectToCoinbaseWallet(){if(this.isMobile()&&!this.isCoinbaseWalletBrowser()){let e=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(window.location.href)}`;window.location.href=e}return this.getCoinbaseProvider().request({method:"eth_requestAccounts"})}isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Silk|Opera Mini/i.test(navigator.userAgent)}getUserEnv(){return{env:{isMetaMaskInstalled:this.isMetaMaskInstalled(),isCoinbaseWalletInstalled:this.isCoinbaseWalletInstalled()}}}connectToThirdPartyWallet(e){switch(e){case ce.MetaMask:return this.connectToMetaMask();case ce.CoinbaseWallet:return this.connectToCoinbaseWallet();default:throw new Error(`Invalid provider: ${e}. Must be one of "metamask" or "coinbase_wallet".`)}}isWalletEnabled(e){let t=K("mc_is_wallet_enabled",[{wallet:e}]);return this.request(t)}handleWalletSelected(e){return ae(this,null,function*(){try{let t=yield this.connectToThirdPartyWallet(e.wallet);yield De(this.localForageKey,e.wallet),this.createIntermediaryEvent(Oe.WalletConnected,e.payloadId)(t)}catch(t){console.error(t),this.createIntermediaryEvent(Oe.WalletRejected,e.payloadId)()}})}autoConnectIfWalletBrowser(e){return ae(this,null,function*(){let t;e===ce.MetaMask&&(t=yield this.getMetaMaskProvider().request({method:"eth_requestAccounts"})),e===ce.CoinbaseWallet&&(t=yield this.getCoinbaseProvider().request({method:"eth_requestAccounts"})),yield De(this.localForageKey,e);let n=K(C.AutoConnect,[{wallet:e,address:t}]);return this.request(n)})}},{createBoundEmitterMethod:rt,createChainingEmitterMethod:Le}=Pr(),To=class extends Ae{constructor(){super(...arguments),this.isMagic=!0,this.on=Le("on",this),this.once=Le("once",this),this.addListener=Le("addListener",this),this.off=Le("off",this),this.removeListener=Le("removeListener",this),this.removeAllListeners=Le("removeAllListeners",this),this.emit=rt("emit"),this.eventNames=rt("eventNames"),this.listeners=rt("listeners"),this.listenerCount=rt("listenerCount")}sendAsync(e,t){if(!t)throw ro({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(n=>{let o=ot(n);return this.prefixPayloadMethodForTestMode(o),o})).then(n=>{t(null,n.map(o=>br(wt({},o.payload),{error:o.hasError?new Ce(o.payload.error):null})))});else{let n=ot(e);this.prefixPayloadMethodForTestMode(n),this.overlay.post(we.MAGIC_HANDLE_REQUEST,n).then(o=>{t(o.hasError?new Ce(o.payload.error):null,o.payload)})}}send(e,t){if(typeof e=="string"){let o=K(e,Array.isArray(t)?t:[]);return this.request(o)}if(Array.isArray(e)||!!t){this.sendAsync(e,t);return}let n=no();return n.log(),new At(e).applyError({code:-32603,message:n.rawMessage}).payload}enable(){let e=K("eth_accounts");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}`)}};function He(e,t){return t?new URL(e,t):new URL(e)}var Er=["request","overlay","sdk"];function Oo(e){let t=Object.getPrototypeOf(e),n=[t];for(;t!==Ae.prototype;)t=Object.getPrototypeOf(t),n.push(t);return n}var Wr=class extends Ae{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:Cr,isPromiEvent:St,encodeJSON:Rr,decodeJSON:Yi,createJsonRpcRequestPayload:K,standardizeJsonRpcRequestPayload:ot,storage:xr};let e=[this,...Oo(this)];Er.forEach(t=>{let n=e.map(m=>Object.getOwnPropertyDescriptor(m,t)),o=n.findIndex(m=>!!m),s=o>0,c=n[o];c&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:c,isPrototypeField:s}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw eo(t)}}))})}init(e){this.__is_initialized__||(Er.forEach(t=>{if(this.__sdk_access_field_descriptors__.has(t)){let{descriptor:n,isPrototypeField:o}=this.__sdk_access_field_descriptors__.get(t);o?delete this[t]:Object.defineProperty(this,t,n)}}),this.sdk=e,this.__is_initialized__=!0)}createDeprecationWarning(e){let{method:t,removalVersion:n,useInstead:o}=e,s=o?` Use \`${o}\` instead.`:"",c=`\`${t}\` will be removed from this Extension in version \`${n}\`.${s}`;return new it(this,"DEPRECATION_NOTICE",c)}createWarning(e,t){return new it(this,e,t)}createError(e,t,n){return new lt(this,e,t,n)}},Lo=class extends Wr{},Re=class extends Wr{};Re.Internal=Lo,Re.Anonymous="anonymous extension";var Po=class extends Ae{purchase(e){let t=K(C.NFTPurchase,[e]);return this.request(t)}};function _r(e){return e.compat&&e.compat[H.sdkName]!=null?typeof e.compat[H.sdkName]=="string"?ki(Gi(H.version),e.compat[H.sdkName]):!!e.compat[H.sdkName]:!0}function $o(e){var t;let n=(t=e==null?void 0:e.extensions)!=null?t:[],o={},s=[];if(Array.isArray(n)?n.forEach(c=>{_r(c)?(c.init(this),(c.name||c.name!==Re.Anonymous)&&(this[c.name]=c),c instanceof Re.Internal&&(bt(c.config)||(o[c.name]=c.config))):s.push(c)}):Object.keys(n).forEach(c=>{if(_r(n[c])){n[c].init(this);let m=n[c];this[c]=m,m instanceof Re.Internal&&(bt(m.config)||(o[n[c].name]=m.config))}else s.push(n[c])}),s.length)throw to(s);return o}var nt=class{constructor(e,t){this.apiKey=e;var n;if(!e)throw Qi();H.platform==="react-native"&&(t==null?void 0:t.endpoint)&&io().log();let{defaultEndpoint:o,version:s}=H;this.testMode=!!(t!=null&&t.testMode),this.endpoint=He((n=t==null?void 0:t.endpoint)!=null?n:o).origin,this.auth=new uo(this),this.user=new No(this),this.wallet=new Mo(this),this.nft=new Po(this),this.rpcProvider=new To(this);let c=$o.call(this,t);this.parameters=Rr(wt({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:t==null?void 0:t.network,host:He(this.endpoint).host,sdk:Ji[H.sdkName],version:s,ext:bt(c)?void 0:c,locale:(t==null?void 0:t.locale)||"en_US"},H.bundleId?{bundleId:H.bundleId}:{}))}get overlay(){if(!nt.__overlays__.has(this.parameters)){let e=new H.ViewController(this.endpoint,this.parameters);e.init(),nt.__overlays__.set(this.parameters,e)}return nt.__overlays__.get(this.parameters)}preload(){return ae(this,null,function*(){yield this.overlay.ready})}},Tt=nt;Tt.__overlays__=new Map;function Co(e,t){return t&&Array.isArray(e)?e.find(n=>n.id===t):e}function Do(e,t){var n;let o=(n=t.data.response)==null?void 0:n.id,s=Co(e,o);if(o&&s){let c=new At(s).applyResult(t.data.response.result).applyError(t.data.response.error);return{id:o,response:c}}return{}}function xo(e,t){return ae(this,null,function*(){let n=yield ye("rt"),o;if(H.platform==="web")try{o=yield _o()}catch(s){console.error("webcrypto error",s)}return o?n?{msgType:e,payload:t,jwt:o,rt:n}:{msgType:e,payload:t,jwt:o}:{msgType:e,payload:t}})}function Uo(e){return ae(this,null,function*(){!e.data.rt||(yield De("rt",e.data.rt))})}var Fr=class{constructor(e,t){this.endpoint=e,this.parameters=t,this.messageHandlers=new Set,this.ready=this.waitForReady(),this.listen()}post(e,t){return ae(this,null,function*(){return Dr(n=>ae(this,null,function*(){yield this.ready;let o=[],s=Array.isArray(t)?t.map(v=>v.id):[],c=yield xo(`${e}-${this.parameters}`,t);yield this._post(c);let m=v=>g=>{let{id:y,response:N}=Do(t,g);Uo(g),y&&N&&Array.isArray(t)&&s.includes(y)?(o.push(N),o.length===t.length&&(v(),n(o))):y&&N&&!Array.isArray(t)&&y===t.id&&(v(),n(N))},p=this.on(he.MAGIC_HANDLE_RESPONSE,m(()=>p()))}))})}on(e,t){let n=t.bind(window),o=s=>{s.data.msgType===`${e}-${this.parameters}`&&n(s)};return this.messageHandlers.add(o),()=>this.messageHandlers.delete(o)}waitForReady(){return new Promise(e=>{this.on(he.MAGIC_OVERLAY_READY,()=>e())})}listen(){this.on(he.MAGIC_HIDE_OVERLAY,()=>{this.hideOverlay()}),this.on(he.MAGIC_SHOW_OVERLAY,()=>{this.showOverlay()})}};var Ot={};nr(Ot,{EthChainType:()=>ar,Events:()=>Oe,Extension:()=>Re,ExtensionError:()=>lt,ExtensionWarning:()=>it,MagicIncomingWindowMessage:()=>he,MagicOutgoingWindowMessage:()=>we,MagicPayloadMethod:()=>C,RPCError:()=>Ce,RPCErrorCode:()=>Te,SDKError:()=>pe,SDKErrorCode:()=>de,SDKWarning:()=>Ue,SDKWarningCode:()=>be,Wallets:()=>ce,isPromiEvent:()=>St});var ft=or(jr()),Pt=or(qr());var ko={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};function Bo(e){for(let[t,n]of Object.entries(ko))e.style[t]=n}function Wo(e){let t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find(n=>n.src.includes(e)))}var ut=class extends Fr{constructor(){super(...arguments);this.activeElement=null}init(){this.test="hello",this.iframe=new Promise(n=>{let o=()=>{if(Wo(encodeURIComponent(this.parameters)))Mr().log();else{let s=document.createElement("iframe");s.classList.add("magic-iframe"),s.dataset.magicIframeLabel=He(this.endpoint).host,s.title="Secure Modal",s.src=He(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,Bo(s),document.body.appendChild(s),n(s)}};["loaded","interactive","complete"].includes(document.readyState)?o():window.addEventListener("load",o,!1)}),window.addEventListener("message",n=>{var o;if(n.origin===this.endpoint&&n.data&&n.data.msgType&&this.messageHandlers.size){n.data.response=(o=n.data.response)!=null?o:{};for(let s of this.messageHandlers.values())s(n)}})}showOverlay(){return Me(this,null,function*(){let n=yield this.iframe;n.style.display="block",this.activeElement=document.activeElement,n.focus()})}hideOverlay(){return Me(this,null,function*(){var o;let n=yield this.iframe;n.style.display="none",(o=this.activeElement)!=null&&o.focus&&this.activeElement.focus(),this.activeElement=null})}_post(n){return Me(this,null,function*(){let o=yield this.iframe;if(o&&o.contentWindow)o.contentWindow.postMessage(n,this.endpoint);else throw Nr()})}};var Fo=Object.assign(Sr(Tt,{platform:"web",sdkName:"magic-sdk",version:"17.0.0",defaultEndpoint:"https://auth.magic.link/",ViewController:ut,configureStorage:()=>Me(void 0,null,function*(){let e=ft.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(Pt),yield e.setDriver([ft.default.INDEXEDDB,ft.default.LOCALSTORAGE,Pt._driver]),e})}),tr({},Ot)),Go=Fo;return Vn(jo);})();
|
5
|
+
Received: \`${e.received}\``)}function Mr(){return new ke(we.DuplicateIframe,"Duplicate iframes found.")}function no(){return new ke(we.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 io(){return new ke(we.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 \`${H.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}function le(e){let{method:t,removalVersions:n,useInstead:o}=e,s=n[H.sdkName],u=o?` Use \`${o}\` instead.`:"",v=`\`${t}\` will be removed from \`${H.sdkName}\` in version \`${s}\`.${u}`;return new ke(we.DeprecationNotice,v)}function*oo(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}var ao=oo();function Tr(){return ao.next().value}var Or=Symbol("Payload pre-processed by Magic SDK");function Lr(e){return Object.defineProperty(e,Or,{value:!0,enumerable:!1}),e}function so(e){return!!e[Or]}function ot(e){var t,n,o;return so(e)||(e.jsonrpc=(t=e.jsonrpc)!=null?t:"2.0",e.id=Tr(),e.method=(n=e.method)!=null?n:"noop",e.params=(o=e.params)!=null?o:[],Lr(e)),e}function V(e,t=[]){return Lr({params:t,method:e,jsonrpc:"2.0",id:Tr()})}var At=class{constructor(e){e instanceof At?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):Xi(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=void 0,this._error=void 0)}applyError(e){return this._error=e,this}applyResult(e){return this._result=e,this}get hasError(){return typeof this._error!="undefined"&&this._error!==null}get hasResult(){return typeof this._result!="undefined"}get payload(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}}},co=ni(ii()),uo=class extends co.default{};function Pr(){let e=new uo;return{emitter:e,createChainingEmitterMethod:(t,n)=>(...o)=>(e[t].apply(e,o),n),createBoundEmitterMethod:t=>(...n)=>e[t].apply(e,n)}}var Cr=Symbol("isPromiEvent");function St(e){return!!e[Cr]}function $r(e){let t=Dr(e),{createBoundEmitterMethod:n,createChainingEmitterMethod:o}=Pr(),s=Symbol("Promise.then"),u=Symbol("Promise.catch"),v=Symbol("Promise.finally"),m=(y,N)=>(...I)=>{let M=N[y].apply(N,I);return p(M)},p=y=>Object.assign(y,{[Cr]:!0,[s]:y[s]||y.then,[u]:y[u]||y.catch,[v]:y[v]||y.finally,then:m(s,y),catch:m(u,y),finally:m(v,y),on:o("on",y),once:o("once",y),addListener:o("addListener",y),off:o("off",y),removeListener:o("removeListener",y),removeAllListeners:o("removeAllListeners",y),emit:n("emit"),eventNames:n("eventNames"),listeners:n("listeners"),listenerCount:n("listenerCount")}),g=p(t.then(y=>(g.emit("done",y),g.emit("settled"),y),y=>{throw g.emit("error",y),g.emit("settled"),y}));return g}function Dr(e){return new Promise((t,n)=>{let o=e(t,n);Promise.resolve(o).catch(n)})}var Se=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(Re.MAGIC_HANDLE_REQUEST,ot(e)),n=$r((s,u)=>{t.then(v=>{if(o(),v.hasError)u(new $e(v.payload.error));else if(v.hasResult)s(v.payload.result);else throw Zi()}).catch(v=>{o(),u(v)})}),o=this.overlay.on(me.MAGIC_HANDLE_EVENT,s=>{var u;let{response:v}=s.data;if(v.id===e.id&&((u=v.result)==null?void 0:u.event)){let{event:m,params:p=[]}=v.result;n.emit(m,...p)}});return n}createIntermediaryEvent(e,t){return n=>{let o=V($.IntermediaryEvent,[{payloadId:t,eventType:e,args:n}]);this.request(o)}}},lo=class extends Se{loginWithMagicLink(e){le({method:"auth.loginWithMagicLink()",removalVersions:{"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"},useInstead:"@magic-ext/auth auth.loginWithMagicLink()"}).log();let{email:t,showUI:n=!0,redirectURI:o}=e,s=V(this.sdk.testMode?$.LoginWithMagicLinkTestMode:$.LoginWithMagicLink,[{email:t,showUI:n,redirectURI:o}]);return this.request(s)}loginWithSMS(e){le({method:"auth.loginWithSMS()",removalVersions:{"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"},useInstead:"@magic-ext/auth auth.loginWithSMS()"}).log();let{phoneNumber:t}=e,n=V(this.sdk.testMode?$.LoginWithSmsTestMode:$.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(n)}loginWithEmailOTP(e){le({method:"auth.loginWithEmailOTP()",removalVersions:{"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"},useInstead:"@magic-ext/auth auth.loginWithEmailOTP()"}).log();let{email:t,showUI:n}=e,o=V(this.sdk.testMode?$.LoginWithEmailOTPTestMode:$.LoginWithEmailOTP,[{email:t,showUI:n}]);if(!n){let s=this.request(o);return s&&(s.on("verify-email-otp",u=>{this.createIntermediaryEvent("verify-email-otp",o.id)(u)}),s.on("cancel",()=>{this.createIntermediaryEvent("cancel",o.id)()})),s}return this.request(o)}loginWithCredential(e){le({method:"auth.loginWithCredential()",removalVersions:{"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"},useInstead:"@magic-ext/auth auth.loginWithCredential()"}).log();let t=e!=null?e:"";if(!e&&H.platform==="web"){t=window.location.search;let o=window.location.origin+window.location.pathname;window.history.replaceState(null,"",o)}let n=V(this.sdk.testMode?$.LoginWithCredentialTestMode:$.LoginWithCredential,[t]);return this.request(n)}setAuthorizationToken(){le({method:"auth.setAuthorizationToken()",removalVersions:{"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"},useInstead:"@magic-ext/auth auth.setAuthorizationToken()"}).log();let e=V($.SetAuthorizationToken);return this.request(e)}updateEmailWithUI(e){le({method:"auth.updateEmailWithUI()",removalVersions:{"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"},useInstead:"@magic-ext/auth auth.updateEmailWithUI()"}).log();let{email:t,showUI:n=!0}=e,o=V(this.sdk.testMode?$.UpdateEmailTestMode:$.UpdateEmail,[{email:t,showUI:n}]);return this.request(o)}updatePhoneNumberWithUI(){le({method:"auth.updatePhoneNumberWithUI()",removalVersions:{"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"},useInstead:"@magic-ext/auth auth.updatePhoneNumberWithUI()"}).log();let e=V(this.sdk.testMode?$.UpdatePhoneNumberTestMode:$.UpdatePhoneNumber);return this.request(e)}},xr={};ti(xr,{clear:()=>fo,getItem:()=>Ee,iterate:()=>po,key:()=>mo,keys:()=>vo,length:()=>ho,removeItem:()=>Ye,setItem:()=>De});var tt;function _e(e){return(...t)=>ae(this,null,function*(){return tt||(tt=yield H.configureStorage()),yield tt.ready(),tt[e](...t)})}var Ee=_e("getItem"),De=_e("setItem"),Ye=_e("removeItem"),fo=_e("clear"),ho=_e("length"),mo=_e("key"),vo=_e("keys"),po=_e("iterate");function go(){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 Nt="STORE_KEY_PRIVATE_KEY",at="STORE_KEY_PUBLIC_JWK",Mt="ECDSA",kr="P-256",yo={name:Mt,namedCurve:kr},Eo={name:Mt,namedCurve:kr};function Ur(){Ye(at),Ye(Nt)}function _o(){return ae(this,null,function*(){let e=yield Io();if(!e){console.info("unable to create public key or webcrypto is unsupported");return}let{subtle:t}=window.crypto,n=yield Ee(Nt);if(!n||!t){console.info("unable to find private key or webcrypto unsupported");return}let o={iat:Math.floor(new Date().getTime()/1e3),jti:go()},s={typ:"dpop+jwt",alg:"ES256",jwk:e},u={protected:yr(JSON.stringify(s)),claims:yr(JSON.stringify(o))},v=Ro(`${u.protected}.${u.claims}`),m={name:Mt,hash:{name:"SHA-256"}},p=So(new Uint8Array(yield t.sign(m,n,v)));return`${u.protected}.${u.claims}.${p}`})}function Io(){return ae(this,null,function*(){if(!wo()){console.info("webcrypto is not supported");return}return(yield Ee(at))||(yield bo()),Ee(at)})}function bo(){return ae(this,null,function*(){let e=null,{subtle:t}=window.crypto,n=yield t.generateKey(yo,!0,["sign"]),o=yield t.exportKey("jwk",n.privateKey);e=yield t.exportKey("jwk",n.publicKey);let s=yield t.importKey("jwk",o,Eo,!1,["sign"]);yield De(Nt,s),yield De(at,e)})}function wo(){let e=typeof window!="undefined"&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}function yr(e){return Wr(Ao(e))}function Ro(e){return new TextEncoder().encode(e)}function Wr(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}function Ao(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(t,n)=>String.fromCharCode(parseInt(n,16)))}function So(e){let t="";return e.forEach(n=>{t+=String.fromCharCode(n)}),Wr(t)}var No=class extends Se{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}getIdToken(e){let t=V(this.sdk.testMode?$.GetIdTokenTestMode:$.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=V(this.sdk.testMode?$.GenerateIdTokenTestMode:$.GenerateIdToken,[e]);return this.request(t)}getInfo(){return ae(this,null,function*(){let e=yield Ee(this.localForageKey),t=V($.GetInfo,[{walletType:e}]);return this.request(t)})}isLoggedIn(){let e=V(this.sdk.testMode?$.IsLoggedInTestMode:$.IsLoggedIn);return this.request(e)}logout(){Ur(),Ye(this.localForageKey);let e=V(this.sdk.testMode?$.LogoutTestMode:$.Logout);return this.request(e)}requestInfoWithUI(e){let t=V($.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}showSettings(){let e=V(this.sdk.testMode?$.UserSettingsTestMode:$.UserSettings);return this.request(e)}recoverAccount(e){let t=V(this.sdk.testMode?$.RecoverAccountTestMode:$.RecoverAccount,[e]);return this.request(t)}getMetadata(){le({method:"user.getMetadata()",removalVersions:{"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"},useInstead:"user.getInfo()"}).log();let e=V(this.sdk.testMode?$.GetMetadataTestMode:$.GetMetadata);return this.request(e)}updateEmail(e){le({method:"user.updateEmail()",removalVersions:{"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"},useInstead:"auth.updateEmailWithUI()"}).log();let{email:t,showUI:n=!0}=e,o=V(this.sdk.testMode?$.UpdateEmailTestMode:$.UpdateEmail,[{email:t,showUI:n}]);return this.request(o)}updatePhoneNumber(){le({method:"user.updatePhoneNumber()",removalVersions:{"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"},useInstead:"auth.updatePhoneNumberWithUI()"}).log();let e=V(this.sdk.testMode?$.UpdatePhoneNumberTestMode:$.UpdatePhoneNumber);return this.request(e)}},Mo=class extends Se{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}connectWithUI(){return ae(this,null,function*(){if(this.isMetaMaskBrowser())try{if(yield this.isWalletEnabled(ue.MetaMask))return this.autoConnectIfWalletBrowser(ue.MetaMask)}catch(o){console.error(o)}if(this.isCoinbaseWalletBrowser())try{if(yield this.isWalletEnabled(ue.CoinbaseWallet))return this.autoConnectIfWalletBrowser(ue.CoinbaseWallet)}catch(o){console.error(o)}let e=this.getUserEnv(),t=V($.Login,[e]),n=this.request(t);return n.on(Le.WalletSelected,o=>this.handleWalletSelected(br(wt({},o),{payloadId:t.id}))),n})}showUI(){let e=V($.ShowUI);return this.request(e)}getInfo(){return ae(this,null,function*(){le({method:"wallet.getInfo()",removalVersions:{"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"},useInstead:"user.getInfo()"}).log();let e=yield Ee(this.localForageKey),t=V($.GetInfo,[{walletType:e}]);return this.request(t)})}disconnect(){le({method:"wallet.disconnect()",removalVersions:{"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"},useInstead:"user.logout()"}).log(),Ur(),Ye(this.localForageKey);let e=V($.Disconnect);return this.request(e)}requestUserInfoWithUI(e){le({method:"wallet.requestUserInfoWithUI()",removalVersions:{"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"},useInstead:"user.requestUserInfoWithUI()"}).log();let t=V($.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}getProvider(){return ae(this,null,function*(){switch(yield Ee(this.localForageKey)){case ue.MetaMask:return this.getMetaMaskProvider();case ue.CoinbaseWallet:return this.getCoinbaseProvider();default:return this.sdk.rpcProvider}})}isMetaMaskInstalled(){var e,t,n;return((e=window.ethereum)==null?void 0:e.isMetaMask)||!!((n=(t=window.ethereum)==null?void 0:t.providers)!=null&&n.find(o=>o==null?void 0:o.isMetaMask))}isMetaMaskBrowser(){return this.isMobile()&&this.isMetaMaskInstalled()}getMetaMaskProvider(){var e,t;return((t=(e=window.ethereum)==null?void 0:e.providers)==null?void 0:t.find(n=>n==null?void 0:n.isMetaMask))||window.ethereum}connectToMetaMask(){if(this.isMobile()&&!this.isMetaMaskInstalled()){let e=`https://metamask.app.link/dapp/${window.location.href.replace(/(^\w+:|^)\/\//,"")}`;window.location.href=e}return this.getMetaMaskProvider().request({method:"eth_requestAccounts"})}isCoinbaseWalletInstalled(){var e,t,n;return((e=window.ethereum)==null?void 0:e.isCoinbaseWallet)||!!((n=(t=window.ethereum)==null?void 0:t.providers)!=null&&n.find(o=>o==null?void 0:o.isCoinbaseWallet))}isCoinbaseWalletBrowser(){var e;return!!((e=window.ethereum)!=null&&e.isCoinbaseBrowser)}getCoinbaseProvider(){var e,t;return((t=(e=window.ethereum)==null?void 0:e.providers)==null?void 0:t.find(n=>n==null?void 0:n.isCoinbaseWallet))||window.ethereum}connectToCoinbaseWallet(){if(this.isMobile()&&!this.isCoinbaseWalletBrowser()){let e=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(window.location.href)}`;window.location.href=e}return this.getCoinbaseProvider().request({method:"eth_requestAccounts"})}isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Silk|Opera Mini/i.test(navigator.userAgent)}getUserEnv(){return{env:{isMetaMaskInstalled:this.isMetaMaskInstalled(),isCoinbaseWalletInstalled:this.isCoinbaseWalletInstalled()}}}connectToThirdPartyWallet(e){switch(e){case ue.MetaMask:return this.connectToMetaMask();case ue.CoinbaseWallet:return this.connectToCoinbaseWallet();default:throw new Error(`Invalid provider: ${e}. Must be one of "metamask" or "coinbase_wallet".`)}}isWalletEnabled(e){let t=V("mc_is_wallet_enabled",[{wallet:e}]);return this.request(t)}handleWalletSelected(e){return ae(this,null,function*(){try{let t=yield this.connectToThirdPartyWallet(e.wallet);yield De(this.localForageKey,e.wallet),this.createIntermediaryEvent(Le.WalletConnected,e.payloadId)(t)}catch(t){console.error(t),this.createIntermediaryEvent(Le.WalletRejected,e.payloadId)()}})}autoConnectIfWalletBrowser(e){return ae(this,null,function*(){let t;e===ue.MetaMask&&(t=yield this.getMetaMaskProvider().request({method:"eth_requestAccounts"})),e===ue.CoinbaseWallet&&(t=yield this.getCoinbaseProvider().request({method:"eth_requestAccounts"})),yield De(this.localForageKey,e);let n=V($.AutoConnect,[{wallet:e,address:t}]);return this.request(n)})}},{createBoundEmitterMethod:rt,createChainingEmitterMethod:Pe}=Pr(),To=class extends Se{constructor(){super(...arguments),this.isMagic=!0,this.on=Pe("on",this),this.once=Pe("once",this),this.addListener=Pe("addListener",this),this.off=Pe("off",this),this.removeListener=Pe("removeListener",this),this.removeAllListeners=Pe("removeAllListeners",this),this.emit=rt("emit"),this.eventNames=rt("eventNames"),this.listeners=rt("listeners"),this.listenerCount=rt("listenerCount")}sendAsync(e,t){if(!t)throw ro({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:t===null?"null":typeof t});if(Array.isArray(e))this.overlay.post(Re.MAGIC_HANDLE_REQUEST,e.map(n=>{let o=ot(n);return this.prefixPayloadMethodForTestMode(o),o})).then(n=>{t(null,n.map(o=>br(wt({},o.payload),{error:o.hasError?new $e(o.payload.error):null})))});else{let n=ot(e);this.prefixPayloadMethodForTestMode(n),this.overlay.post(Re.MAGIC_HANDLE_REQUEST,n).then(o=>{t(o.hasError?new $e(o.payload.error):null,o.payload)})}}send(e,t){if(typeof e=="string"){let o=V(e,Array.isArray(t)?t:[]);return this.request(o)}if(Array.isArray(e)||!!t){this.sendAsync(e,t);return}let n=no();return n.log(),new At(e).applyError({code:-32603,message:n.rawMessage}).payload}enable(){let e=V("eth_accounts");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}`)}};function He(e,t){return t?new URL(e,t):new URL(e)}var Er=["request","overlay","sdk"];function Oo(e){let t=Object.getPrototypeOf(e),n=[t];for(;t!==Se.prototype;)t=Object.getPrototypeOf(t),n.push(t);return n}var Br=class extends Se{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:$r,isPromiEvent:St,encodeJSON:Rr,decodeJSON:Yi,createJsonRpcRequestPayload:V,standardizeJsonRpcRequestPayload:ot,storage:xr};let e=[this,...Oo(this)];Er.forEach(t=>{let n=e.map(v=>Object.getOwnPropertyDescriptor(v,t)),o=n.findIndex(v=>!!v),s=o>0,u=n[o];u&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:u,isPrototypeField:s}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw eo(t)}}))})}init(e){this.__is_initialized__||(Er.forEach(t=>{if(this.__sdk_access_field_descriptors__.has(t)){let{descriptor:n,isPrototypeField:o}=this.__sdk_access_field_descriptors__.get(t);o?delete this[t]:Object.defineProperty(this,t,n)}}),this.sdk=e,this.__is_initialized__=!0)}createDeprecationWarning(e){let{method:t,removalVersion:n,useInstead:o}=e,s=o?` Use \`${o}\` instead.`:"",u=`\`${t}\` will be removed from this Extension in version \`${n}\`.${s}`;return new it(this,"DEPRECATION_NOTICE",u)}createWarning(e,t){return new it(this,e,t)}createError(e,t,n){return new ct(this,e,t,n)}},Lo=class extends Br{},Ae=class extends Br{};Ae.Internal=Lo,Ae.Anonymous="anonymous extension";var Po=class extends Se{purchase(e){let t=V($.NFTPurchase,[e]);return this.request(t)}};function _r(e){return e.compat&&e.compat[H.sdkName]!=null?typeof e.compat[H.sdkName]=="string"?Ui(Gi(H.version),e.compat[H.sdkName]):!!e.compat[H.sdkName]:!0}function Co(e){var t;let n=(t=e==null?void 0:e.extensions)!=null?t:[],o={},s=[];if(Array.isArray(n)?n.forEach(u=>{_r(u)?(u.init(this),(u.name||u.name!==Ae.Anonymous)&&(this[u.name]=u),u instanceof Ae.Internal&&(bt(u.config)||(o[u.name]=u.config))):s.push(u)}):Object.keys(n).forEach(u=>{if(_r(n[u])){n[u].init(this);let v=n[u];this[u]=v,v instanceof Ae.Internal&&(bt(v.config)||(o[n[u].name]=v.config))}else s.push(n[u])}),s.length)throw to(s);return o}var nt=class{constructor(e,t){this.apiKey=e;var n;if(!e)throw Qi();H.platform==="react-native"&&(t==null?void 0:t.endpoint)&&io().log();let{defaultEndpoint:o,version:s}=H;this.testMode=!!(t!=null&&t.testMode),this.endpoint=He((n=t==null?void 0:t.endpoint)!=null?n:o).origin,this.auth=new lo(this),this.user=new No(this),this.wallet=new Mo(this),this.nft=new Po(this),this.rpcProvider=new To(this);let u=Co.call(this,t);this.parameters=Rr(wt({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:t==null?void 0:t.network,host:He(this.endpoint).host,sdk:Ji[H.sdkName],version:s,ext:bt(u)?void 0:u,locale:(t==null?void 0:t.locale)||"en_US"},H.bundleId?{bundleId:H.bundleId}:{}))}get overlay(){if(!nt.__overlays__.has(this.parameters)){let e=new H.ViewController(this.endpoint,this.parameters);e.init(),nt.__overlays__.set(this.parameters,e)}return nt.__overlays__.get(this.parameters)}preload(){return ae(this,null,function*(){yield this.overlay.ready})}},Tt=nt;Tt.__overlays__=new Map;function $o(e,t){return t&&Array.isArray(e)?e.find(n=>n.id===t):e}function Do(e,t){var n;let o=(n=t.data.response)==null?void 0:n.id,s=$o(e,o);if(o&&s){let u=new At(s).applyResult(t.data.response.result).applyError(t.data.response.error);return{id:o,response:u}}return{}}function xo(e,t){return ae(this,null,function*(){let n=yield Ee("rt"),o;if(H.platform==="web")try{o=yield _o()}catch(s){console.error("webcrypto error",s)}return o?n?{msgType:e,payload:t,jwt:o,rt:n}:{msgType:e,payload:t,jwt:o}:{msgType:e,payload:t}})}function ko(e){return ae(this,null,function*(){!e.data.rt||(yield De("rt",e.data.rt))})}var Fr=class{constructor(e,t){this.endpoint=e,this.parameters=t,this.messageHandlers=new Set,this.ready=this.waitForReady(),this.listen()}post(e,t){return ae(this,null,function*(){return Dr(n=>ae(this,null,function*(){yield this.ready;let o=[],s=Array.isArray(t)?t.map(p=>p.id):[],u=yield xo(`${e}-${this.parameters}`,t);yield this._post(u);let v=p=>g=>{let{id:y,response:N}=Do(t,g);ko(g),y&&N&&Array.isArray(t)&&s.includes(y)?(o.push(N),o.length===t.length&&(p(),n(o))):y&&N&&!Array.isArray(t)&&y===t.id&&(p(),n(N))},m=this.on(me.MAGIC_HANDLE_RESPONSE,v(()=>m()))}))})}on(e,t){let n=t.bind(window),o=s=>{s.data.msgType===`${e}-${this.parameters}`&&n(s)};return this.messageHandlers.add(o),()=>this.messageHandlers.delete(o)}waitForReady(){return new Promise(e=>{this.on(me.MAGIC_OVERLAY_READY,()=>e())})}listen(){this.on(me.MAGIC_HIDE_OVERLAY,()=>{this.hideOverlay()}),this.on(me.MAGIC_SHOW_OVERLAY,()=>{this.showOverlay()})}};var Ot={};nr(Ot,{EthChainType:()=>ar,Events:()=>Le,Extension:()=>Ae,ExtensionError:()=>ct,ExtensionWarning:()=>it,MagicIncomingWindowMessage:()=>me,MagicOutgoingWindowMessage:()=>Re,MagicPayloadMethod:()=>$,RPCError:()=>$e,RPCErrorCode:()=>Oe,SDKError:()=>ve,SDKErrorCode:()=>he,SDKWarning:()=>ke,SDKWarningCode:()=>we,Wallets:()=>ue,isPromiEvent:()=>St});var ft=or(jr()),Pt=or(Kr());var Uo={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};function Wo(e){for(let[t,n]of Object.entries(Uo))e.style[t]=n}function Bo(e){let t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find(n=>n.src.includes(e)))}var lt=class extends Fr{constructor(){super(...arguments);this.activeElement=null}init(){this.test="hello",this.iframe=new Promise(n=>{let o=()=>{if(Bo(encodeURIComponent(this.parameters)))Mr().log();else{let s=document.createElement("iframe");s.classList.add("magic-iframe"),s.dataset.magicIframeLabel=He(this.endpoint).host,s.title="Secure Modal",s.src=He(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,Wo(s),document.body.appendChild(s),n(s)}};["loaded","interactive","complete"].includes(document.readyState)?o():window.addEventListener("load",o,!1)}),window.addEventListener("message",n=>{var o;if(n.origin===this.endpoint&&n.data&&n.data.msgType&&this.messageHandlers.size){n.data.response=(o=n.data.response)!=null?o:{};for(let s of this.messageHandlers.values())s(n)}})}showOverlay(){return Te(this,null,function*(){let n=yield this.iframe;n.style.display="block",this.activeElement=document.activeElement,n.focus()})}hideOverlay(){return Te(this,null,function*(){var o;let n=yield this.iframe;n.style.display="none",(o=this.activeElement)!=null&&o.focus&&this.activeElement.focus(),this.activeElement=null})}_post(n){return Te(this,null,function*(){let o=yield this.iframe;if(o&&o.contentWindow)o.contentWindow.postMessage(n,this.endpoint);else throw Nr()})}};var Fo=Object.assign(Sr(Tt,{platform:"web",sdkName:"magic-sdk",version:"17.0.0",defaultEndpoint:"https://auth.magic.link/",ViewController:lt,configureStorage:()=>Te(void 0,null,function*(){let e=ft.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(Pt),yield e.setDriver([ft.default.INDEXEDDB,ft.default.LOCALSTORAGE,Pt._driver]),e})}),tr({},Ot)),Go=Fo;return qn(jo);})();
|
6
6
|
if (Magic && Magic.default != null) { Magic = Object.assign(Magic.default, Magic); delete Magic.default; }
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "magic-sdk",
|
3
|
-
"version": "17.1.0-canary.497.
|
3
|
+
"version": "17.1.0-canary.497.4757057714.0",
|
4
4
|
"description": "Passwordless authentication for the web.",
|
5
5
|
"author": "Magic Labs <team@magic.link> (https://magic.link/)",
|
6
6
|
"license": "MIT",
|
@@ -28,9 +28,9 @@
|
|
28
28
|
]
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@magic-sdk/commons": "13.1.0-canary.497.
|
32
|
-
"@magic-sdk/provider": "17.1.0-canary.497.
|
33
|
-
"@magic-sdk/types": "15.1.0-canary.497.
|
31
|
+
"@magic-sdk/commons": "13.1.0-canary.497.4757057714.0",
|
32
|
+
"@magic-sdk/provider": "17.1.0-canary.497.4757057714.0",
|
33
|
+
"@magic-sdk/types": "15.1.0-canary.497.4757057714.0",
|
34
34
|
"localforage": "^1.7.4"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
@@ -39,5 +39,5 @@
|
|
39
39
|
"@babel/runtime": "^7.9.6",
|
40
40
|
"localforage-driver-memory": "^1.0.5"
|
41
41
|
},
|
42
|
-
"gitHead": "
|
42
|
+
"gitHead": "3d4b287ab5ca9cd72469ad0ac5e023ff9ccfff11"
|
43
43
|
}
|