magic-sdk 29.0.6-canary.879.14602550867.0 → 29.0.6-canary.879.14604764484.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/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/index.js.map +1 -1
- package/dist/es/index.mjs +1 -1
- package/dist/es/index.mjs.map +1 -1
- package/dist/magic.js +2 -2
- package/package.json +4 -4
package/dist/es/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
var $r=Object.create;var Xe=Object.defineProperty;var Zr=Object.getOwnPropertyDescriptor;var qr=Object.getOwnPropertyNames;var kr=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty;var ve=(w=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(w,{get:(y,O)=>(typeof require<"u"?require:y)[O]}):w)(function(w){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+w+'" is not supported')});var Qe=(w,y)=>()=>(y||w((y={exports:{}}).exports,y),y.exports);var rt=(w,y,O,L)=>{if(y&&typeof y=="object"||typeof y=="function")for(let z of qr(y))!et.call(w,z)&&z!==O&&Xe(w,z,{get:()=>y[z],enumerable:!(L=Zr(y,z))||L.enumerable});return w};var Je=(w,y,O)=>(O=w!=null?$r(kr(w)):{},rt(y||!w||!w.__esModule?Xe(O,"default",{value:w,enumerable:!0}):O,w));var Ze=Qe(($e,Te)=>{"use strict";(function(w){if(typeof $e=="object"&&typeof Te<"u")Te.exports=w();else if(typeof define=="function"&&define.amd)define([],w);else{var y;typeof window<"u"?y=window:typeof global<"u"?y=global:typeof self<"u"?y=self:y=this,y.localforage=w()}})(function(){var w,y,O;return function L(z,Z,C){function V(K,J){if(!Z[K]){if(!z[K]){var m=typeof ve=="function"&&ve;if(!J&&m)return m(K,!0);if(T)return T(K,!0);var E=new Error("Cannot find module '"+K+"'");throw E.code="MODULE_NOT_FOUND",E}var D=Z[K]={exports:{}};z[K][0].call(D.exports,function(F){var $=z[K][1][F];return V($||F)},D,D.exports,L,z,Z,C)}return Z[K].exports}for(var T=typeof ve=="function"&&ve,Y=0;Y<C.length;Y++)V(C[Y]);return V}({1:[function(L,z,Z){(function(C){"use strict";var V=C.MutationObserver||C.WebKitMutationObserver,T;if(V){var Y=0,K=new V(F),J=C.document.createTextNode("");K.observe(J,{characterData:!0}),T=function(){J.data=Y=++Y%2}}else if(!C.setImmediate&&typeof C.MessageChannel<"u"){var m=new C.MessageChannel;m.port1.onmessage=F,T=function(){m.port2.postMessage(0)}}else"document"in C&&"onreadystatechange"in C.document.createElement("script")?T=function(){var P=C.document.createElement("script");P.onreadystatechange=function(){F(),P.onreadystatechange=null,P.parentNode.removeChild(P),P=null},C.document.documentElement.appendChild(P)}:T=function(){setTimeout(F,0)};var E,D=[];function F(){E=!0;for(var P,k,M=D.length;M;){for(k=D,D=[],P=-1;++P<M;)k[P]();M=D.length}E=!1}z.exports=$;function $(P){D.push(P)===1&&!E&&T()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(L,z,Z){"use strict";var C=L(1);function V(){}var T={},Y=["REJECTED"],K=["FULFILLED"],J=["PENDING"];z.exports=m;function m(h){if(typeof h!="function")throw new TypeError("resolver must be a function");this.state=J,this.queue=[],this.outcome=void 0,h!==V&&$(this,h)}m.prototype.catch=function(h){return this.then(null,h)},m.prototype.then=function(h,I){if(typeof h!="function"&&this.state===K||typeof I!="function"&&this.state===Y)return this;var A=new this.constructor(V);if(this.state!==J){var N=this.state===K?h:I;D(A,N,this.outcome)}else this.queue.push(new E(A,h,I));return A};function E(h,I,A){this.promise=h,typeof I=="function"&&(this.onFulfilled=I,this.callFulfilled=this.otherCallFulfilled),typeof A=="function"&&(this.onRejected=A,this.callRejected=this.otherCallRejected)}E.prototype.callFulfilled=function(h){T.resolve(this.promise,h)},E.prototype.otherCallFulfilled=function(h){D(this.promise,this.onFulfilled,h)},E.prototype.callRejected=function(h){T.reject(this.promise,h)},E.prototype.otherCallRejected=function(h){D(this.promise,this.onRejected,h)};function D(h,I,A){C(function(){var N;try{N=I(A)}catch(H){return T.reject(h,H)}N===h?T.reject(h,new TypeError("Cannot resolve promise with itself")):T.resolve(h,N)})}T.resolve=function(h,I){var A=P(F,I);if(A.status==="error")return T.reject(h,A.value);var N=A.value;if(N)$(h,N);else{h.state=K,h.outcome=I;for(var H=-1,j=h.queue.length;++H<j;)h.queue[H].callFulfilled(I)}return h},T.reject=function(h,I){h.state=Y,h.outcome=I;for(var A=-1,N=h.queue.length;++A<N;)h.queue[A].callRejected(I);return h};function F(h){var I=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof I=="function")return function(){I.apply(h,arguments)}}function $(h,I){var A=!1;function N(Q){A||(A=!0,T.reject(h,Q))}function H(Q){A||(A=!0,T.resolve(h,Q))}function j(){I(H,N)}var X=P(j);X.status==="error"&&N(X.value)}function P(h,I){var A={};try{A.value=h(I),A.status="success"}catch(N){A.status="error",A.value=N}return A}m.resolve=k;function k(h){return h instanceof this?h:T.resolve(new this(V),h)}m.reject=M;function M(h){var I=new this(V);return T.reject(I,h)}m.all=oe;function oe(h){var I=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var A=h.length,N=!1;if(!A)return this.resolve([]);for(var H=new Array(A),j=0,X=-1,Q=new this(V);++X<A;)ee(h[X],X);return Q;function ee(ae,o){I.resolve(ae).then(u,function(d){N||(N=!0,T.reject(Q,d))});function u(d){H[o]=d,++j===A&&!N&&(N=!0,T.resolve(Q,H))}}}m.race=re;function re(h){var I=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var A=h.length,N=!1;if(!A)return this.resolve([]);for(var H=-1,j=new this(V);++H<A;)X(h[H]);return j;function X(Q){I.resolve(Q).then(function(ee){N||(N=!0,T.resolve(j,ee))},function(ee){N||(N=!0,T.reject(j,ee))})}}},{1:1}],3:[function(L,z,Z){(function(C){"use strict";typeof C.Promise!="function"&&(C.Promise=L(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(L,z,Z){"use strict";var C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T(){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 Y=T();function K(){try{if(!Y||!Y.open)return!1;var e=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!e||t)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function J(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(n){if(n.name!=="TypeError")throw n;for(var r=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,a=new r,i=0;i<e.length;i+=1)a.append(e[i]);return a.getBlob(t.type)}}typeof Promise>"u"&&L(3);var m=Promise;function E(e,t){t&&e.then(function(r){t(null,r)},function(r){t(r)})}function D(e,t,r){typeof t=="function"&&e.then(t),typeof r=="function"&&e.catch(r)}function F(e){return typeof e!="string"&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function $(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var P="local-forage-detect-blob-support",k=void 0,M={},oe=Object.prototype.toString,re="readonly",h="readwrite";function I(e){for(var t=e.length,r=new ArrayBuffer(t),a=new Uint8Array(r),i=0;i<t;i++)a[i]=e.charCodeAt(i);return r}function A(e){return new m(function(t){var r=e.transaction(P,h),a=J([""]);r.objectStore(P).put(a,"key"),r.onabort=function(i){i.preventDefault(),i.stopPropagation(),t(!1)},r.oncomplete=function(){var i=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!i||parseInt(i[1],10)>=43)}}).catch(function(){return!1})}function N(e){return typeof k=="boolean"?m.resolve(k):A(e).then(function(t){return k=t,k})}function H(e){var t=M[e.name],r={};r.promise=new m(function(a,i){r.resolve=a,r.reject=i}),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then(function(){return r.promise}):t.dbReady=r.promise}function j(e){var t=M[e.name],r=t.deferredOperations.pop();if(r)return r.resolve(),r.promise}function X(e,t){var r=M[e.name],a=r.deferredOperations.pop();if(a)return a.reject(t),a.promise}function Q(e,t){return new m(function(r,a){if(M[e.name]=M[e.name]||G(),e.db)if(t)H(e),e.db.close();else return r(e.db);var i=[e.name];t&&i.push(e.version);var n=Y.open.apply(Y,i);t&&(n.onupgradeneeded=function(f){var s=n.result;try{s.createObjectStore(e.storeName),f.oldVersion<=1&&s.createObjectStore(P)}catch(c){if(c.name==="ConstraintError")console.warn('The database "'+e.name+'" has been upgraded from version '+f.oldVersion+" to version "+f.newVersion+', but the storage "'+e.storeName+'" already exists.');else throw c}}),n.onerror=function(f){f.preventDefault(),a(n.error)},n.onsuccess=function(){var f=n.result;f.onversionchange=function(s){s.target.close()},r(f),j(e)}})}function ee(e){return Q(e,!1)}function ae(e){return Q(e,!0)}function o(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),a=e.version<e.db.version,i=e.version>e.db.version;if(a&&(e.version!==t&&console.warn('The database "'+e.name+`" can't be downgraded from version `+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var n=e.db.version+1;n>e.version&&(e.version=n)}return!0}return!1}function u(e){return new m(function(t,r){var a=new FileReader;a.onerror=r,a.onloadend=function(i){var n=btoa(i.target.result||"");t({v:!0,data:n,type:e.type})},a.readAsBinaryString(e)})}function d(e){var t=I(atob(e.data));return J([t],{type:e.type})}function g(e){return e&&e.v}function b(e){var t=this,r=t.s().then(function(){var a=M[t.e.name];if(a&&a.dbReady)return a.dbReady});return D(r,e,e),r}function S(e){H(e);for(var t=M[e.name],r=t.forages,a=0;a<r.length;a++){var i=r[a];i.e.db&&(i.e.db.close(),i.e.db=null)}return e.db=null,ee(e).then(function(n){return e.db=n,o(e)?ae(e):n}).then(function(n){e.db=t.db=n;for(var f=0;f<r.length;f++)r[f].e.db=n}).catch(function(n){throw X(e,n),n})}function _(e,t,r,a){a===void 0&&(a=1);try{var i=e.db.transaction(e.storeName,t);r(null,i)}catch(n){if(a>0&&(!e.db||n.name==="InvalidStateError"||n.name==="NotFoundError"))return m.resolve().then(function(){if(!e.db||n.name==="NotFoundError"&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),ae(e)}).then(function(){return S(e).then(function(){_(e,t,r,a-1)})}).catch(r);r(n)}}function G(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function fe(e){var t=this,r={db:null};if(e)for(var a in e)r[a]=e[a];var i=M[r.name];i||(i=G(),M[r.name]=i),i.forages.push(t),t.s||(t.s=t.ready,t.ready=b);var n=[];function f(){return m.resolve()}for(var s=0;s<i.forages.length;s++){var c=i.forages[s];c!==t&&n.push(c.s().catch(f))}var l=i.forages.slice(0);return m.all(n).then(function(){return r.db=i.db,ee(r)}).then(function(v){return r.db=v,o(r,t.o.version)?ae(r):v}).then(function(v){r.db=i.db=v,t.e=r;for(var p=0;p<l.length;p++){var R=l[p];R!==t&&(R.e.db=r.db,R.e.version=r.version)}})}function ie(e,t){var r=this;e=F(e);var a=new m(function(i,n){r.ready().then(function(){_(r.e,re,function(f,s){if(f)return n(f);try{var c=s.objectStore(r.e.storeName),l=c.get(e);l.onsuccess=function(){var v=l.result;v===void 0&&(v=null),g(v)&&(v=d(v)),i(v)},l.onerror=function(){n(l.error)}}catch(v){n(v)}})}).catch(n)});return E(a,t),a}function ue(e,t){var r=this,a=new m(function(i,n){r.ready().then(function(){_(r.e,re,function(f,s){if(f)return n(f);try{var c=s.objectStore(r.e.storeName),l=c.openCursor(),v=1;l.onsuccess=function(){var p=l.result;if(p){var R=p.value;g(R)&&(R=d(R));var B=e(R,p.key,v++);B!==void 0?i(B):p.continue()}else i()},l.onerror=function(){n(l.error)}}catch(p){n(p)}})}).catch(n)});return E(a,t),a}function tr(e,t,r){var a=this;e=F(e);var i=new m(function(n,f){var s;a.ready().then(function(){return s=a.e,oe.call(t)==="[object Blob]"?N(s.db).then(function(c){return c?t:u(t)}):t}).then(function(c){_(a.e,h,function(l,v){if(l)return f(l);try{var p=v.objectStore(a.e.storeName);c===null&&(c=void 0);var R=p.put(c,e);v.oncomplete=function(){c===void 0&&(c=null),n(c)},v.onabort=v.onerror=function(){var B=R.error?R.error:R.transaction.error;f(B)}}catch(B){f(B)}})}).catch(f)});return E(i,r),i}function nr(e,t){var r=this;e=F(e);var a=new m(function(i,n){r.ready().then(function(){_(r.e,h,function(f,s){if(f)return n(f);try{var c=s.objectStore(r.e.storeName),l=c.delete(e);s.oncomplete=function(){i()},s.onerror=function(){n(l.error)},s.onabort=function(){var v=l.error?l.error:l.transaction.error;n(v)}}catch(v){n(v)}})}).catch(n)});return E(a,t),a}function ar(e){var t=this,r=new m(function(a,i){t.ready().then(function(){_(t.e,h,function(n,f){if(n)return i(n);try{var s=f.objectStore(t.e.storeName),c=s.clear();f.oncomplete=function(){a()},f.onabort=f.onerror=function(){var l=c.error?c.error:c.transaction.error;i(l)}}catch(l){i(l)}})}).catch(i)});return E(r,e),r}function ir(e){var t=this,r=new m(function(a,i){t.ready().then(function(){_(t.e,re,function(n,f){if(n)return i(n);try{var s=f.objectStore(t.e.storeName),c=s.count();c.onsuccess=function(){a(c.result)},c.onerror=function(){i(c.error)}}catch(l){i(l)}})}).catch(i)});return E(r,e),r}function or(e,t){var r=this,a=new m(function(i,n){if(e<0){i(null);return}r.ready().then(function(){_(r.e,re,function(f,s){if(f)return n(f);try{var c=s.objectStore(r.e.storeName),l=!1,v=c.openKeyCursor();v.onsuccess=function(){var p=v.result;if(!p){i(null);return}e===0||l?i(p.key):(l=!0,p.advance(e))},v.onerror=function(){n(v.error)}}catch(p){n(p)}})}).catch(n)});return E(a,t),a}function fr(e){var t=this,r=new m(function(a,i){t.ready().then(function(){_(t.e,re,function(n,f){if(n)return i(n);try{var s=f.objectStore(t.e.storeName),c=s.openKeyCursor(),l=[];c.onsuccess=function(){var v=c.result;if(!v){a(l);return}l.push(v.key),v.continue()},c.onerror=function(){i(c.error)}}catch(v){i(v)}})}).catch(i)});return E(r,e),r}function sr(e,t){t=$.apply(this,arguments);var r=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var a=this,i;if(!e.name)i=m.reject("Invalid arguments");else{var n=e.name===r.name&&a.e.db,f=n?m.resolve(a.e.db):ee(e).then(function(s){var c=M[e.name],l=c.forages;c.db=s;for(var v=0;v<l.length;v++)l[v].e.db=s;return s});e.storeName?i=f.then(function(s){if(s.objectStoreNames.contains(e.storeName)){var c=s.version+1;H(e);var l=M[e.name],v=l.forages;s.close();for(var p=0;p<v.length;p++){var R=v[p];R.e.db=null,R.e.version=c}var B=new m(function(x,W){var U=Y.open(e.name,c);U.onerror=function(q){var le=U.result;le.close(),W(q)},U.onupgradeneeded=function(){var q=U.result;q.deleteObjectStore(e.storeName)},U.onsuccess=function(){var q=U.result;q.close(),x(q)}});return B.then(function(x){l.db=x;for(var W=0;W<v.length;W++){var U=v[W];U.e.db=x,j(U.e)}}).catch(function(x){throw(X(e,x)||m.resolve()).catch(function(){}),x})}}):i=f.then(function(s){H(e);var c=M[e.name],l=c.forages;s.close();for(var v=0;v<l.length;v++){var p=l[v];p.e.db=null}var R=new m(function(B,x){var W=Y.deleteDatabase(e.name);W.onerror=function(){var U=W.result;U&&U.close(),x(W.error)},W.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},W.onsuccess=function(){var U=W.result;U&&U.close(),B(U)}});return R.then(function(B){c.db=B;for(var x=0;x<l.length;x++){var W=l[x];j(W.e)}}).catch(function(B){throw(X(e,B)||m.resolve()).catch(function(){}),B})})}return E(i,t),i}var ur={r:"asyncStorage",f:fe,a:K(),iterate:ue,getItem:ie,setItem:tr,removeItem:nr,clear:ar,length:ir,key:or,keys:fr,dropInstance:sr};function cr(){return typeof openDatabase=="function"}var te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lr="~~local_forage_type~",De=/^~~local_forage_type~([^~]+)~/,de="__lfsc__:",ge=de.length,be="arbf",we="blob",Be="si08",Ne="ui08",xe="uic8",Oe="si16",Le="si32",Ce="ur16",Pe="ui32",Me="fl32",Fe="fl64",Ue=ge+be.length,ze=Object.prototype.toString;function Ye(e){var t=e.length*.75,r=e.length,a,i=0,n,f,s,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var l=new ArrayBuffer(t),v=new Uint8Array(l);for(a=0;a<r;a+=4)n=te.indexOf(e[a]),f=te.indexOf(e[a+1]),s=te.indexOf(e[a+2]),c=te.indexOf(e[a+3]),v[i++]=n<<2|f>>4,v[i++]=(f&15)<<4|s>>2,v[i++]=(s&3)<<6|c&63;return l}function Ee(e){var t=new Uint8Array(e),r="",a;for(a=0;a<t.length;a+=3)r+=te[t[a]>>2],r+=te[(t[a]&3)<<4|t[a+1]>>4],r+=te[(t[a+1]&15)<<2|t[a+2]>>6],r+=te[t[a+2]&63];return t.length%3===2?r=r.substring(0,r.length-1)+"=":t.length%3===1&&(r=r.substring(0,r.length-2)+"=="),r}function vr(e,t){var r="";if(e&&(r=ze.call(e)),e&&(r==="[object ArrayBuffer]"||e.buffer&&ze.call(e.buffer)==="[object ArrayBuffer]")){var a,i=de;e instanceof ArrayBuffer?(a=e,i+=be):(a=e.buffer,r==="[object Int8Array]"?i+=Be:r==="[object Uint8Array]"?i+=Ne:r==="[object Uint8ClampedArray]"?i+=xe:r==="[object Int16Array]"?i+=Oe:r==="[object Uint16Array]"?i+=Ce:r==="[object Int32Array]"?i+=Le:r==="[object Uint32Array]"?i+=Pe:r==="[object Float32Array]"?i+=Me:r==="[object Float64Array]"?i+=Fe:t(new Error("Failed to get type for BinaryArray"))),t(i+Ee(a))}else if(r==="[object Blob]"){var n=new FileReader;n.onload=function(){var f=lr+e.type+"~"+Ee(this.result);t(de+we+f)},n.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(f){console.error("Couldn't convert value into a JSON string: ",e),t(null,f)}}function dr(e){if(e.substring(0,ge)!==de)return JSON.parse(e);var t=e.substring(Ue),r=e.substring(ge,Ue),a;if(r===we&&De.test(t)){var i=t.match(De);a=i[1],t=t.substring(i[0].length)}var n=Ye(t);switch(r){case be:return n;case we:return J([n],{type:a});case Be:return new Int8Array(n);case Ne:return new Uint8Array(n);case xe:return new Uint8ClampedArray(n);case Oe:return new Int16Array(n);case Ce:return new Uint16Array(n);case Le:return new Int32Array(n);case Pe:return new Uint32Array(n);case Me:return new Float32Array(n);case Fe:return new Float64Array(n);default:throw new Error("Unkown type: "+r)}}var Se={serialize:vr,deserialize:dr,stringToBuffer:Ye,bufferToString:Ee};function We(e,t,r,a){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,a)}function hr(e){var t=this,r={db:null};if(e)for(var a in e)r[a]=typeof e[a]!="string"?e[a].toString():e[a];var i=new m(function(n,f){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(s){return f(s)}r.db.transaction(function(s){We(s,r,function(){t.e=r,n()},function(c,l){f(l)})},f)});return r.serializer=Se,i}function ne(e,t,r,a,i,n){e.executeSql(r,a,i,function(f,s){s.code===s.SYNTAX_ERR?f.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(c,l){l.rows.length?n(c,s):We(c,t,function(){c.executeSql(r,a,i,n)},n)},n):n(f,s)},n)}function mr(e,t){var r=this;e=F(e);var a=new m(function(i,n){r.ready().then(function(){var f=r.e;f.db.transaction(function(s){ne(s,f,"SELECT * FROM "+f.storeName+" WHERE key = ? LIMIT 1",[e],function(c,l){var v=l.rows.length?l.rows.item(0).value:null;v&&(v=f.serializer.deserialize(v)),i(v)},function(c,l){n(l)})})}).catch(n)});return E(a,t),a}function yr(e,t){var r=this,a=new m(function(i,n){r.ready().then(function(){var f=r.e;f.db.transaction(function(s){ne(s,f,"SELECT * FROM "+f.storeName,[],function(c,l){for(var v=l.rows,p=v.length,R=0;R<p;R++){var B=v.item(R),x=B.value;if(x&&(x=f.serializer.deserialize(x)),x=e(x,B.key,R+1),x!==void 0){i(x);return}}i()},function(c,l){n(l)})})}).catch(n)});return E(a,t),a}function Ke(e,t,r,a){var i=this;e=F(e);var n=new m(function(f,s){i.ready().then(function(){t===void 0&&(t=null);var c=t,l=i.e;l.serializer.serialize(t,function(v,p){p?s(p):l.db.transaction(function(R){ne(R,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,v],function(){f(c)},function(B,x){s(x)})},function(R){if(R.code===R.QUOTA_ERR){if(a>0){f(Ke.apply(i,[e,c,r,a-1]));return}s(R)}})})}).catch(s)});return E(n,r),n}function pr(e,t,r){return Ke.apply(this,[e,t,r,1])}function gr(e,t){var r=this;e=F(e);var a=new m(function(i,n){r.ready().then(function(){var f=r.e;f.db.transaction(function(s){ne(s,f,"DELETE FROM "+f.storeName+" WHERE key = ?",[e],function(){i()},function(c,l){n(l)})})}).catch(n)});return E(a,t),a}function br(e){var t=this,r=new m(function(a,i){t.ready().then(function(){var n=t.e;n.db.transaction(function(f){ne(f,n,"DELETE FROM "+n.storeName,[],function(){a()},function(s,c){i(c)})})}).catch(i)});return E(r,e),r}function wr(e){var t=this,r=new m(function(a,i){t.ready().then(function(){var n=t.e;n.db.transaction(function(f){ne(f,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(s,c){var l=c.rows.item(0).c;a(l)},function(s,c){i(c)})})}).catch(i)});return E(r,e),r}function Er(e,t){var r=this,a=new m(function(i,n){r.ready().then(function(){var f=r.e;f.db.transaction(function(s){ne(s,f,"SELECT key FROM "+f.storeName+" WHERE id = ? LIMIT 1",[e+1],function(c,l){var v=l.rows.length?l.rows.item(0).key:null;i(v)},function(c,l){n(l)})})}).catch(n)});return E(a,t),a}function Sr(e){var t=this,r=new m(function(a,i){t.ready().then(function(){var n=t.e;n.db.transaction(function(f){ne(f,n,"SELECT key FROM "+n.storeName,[],function(s,c){for(var l=[],v=0;v<c.rows.length;v++)l.push(c.rows.item(v).key);a(l)},function(s,c){i(c)})})}).catch(i)});return E(r,e),r}function Ar(e){return new m(function(t,r){e.transaction(function(a){a.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(i,n){for(var f=[],s=0;s<n.rows.length;s++)f.push(n.rows.item(s).name);t({db:e,storeNames:f})},function(i,n){r(n)})},function(a){r(a)})})}function Rr(e,t){t=$.apply(this,arguments);var r=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var a=this,i;return e.name?i=new m(function(n){var f;e.name===r.name?f=a.e.db:f=openDatabase(e.name,"","",0),e.storeName?n({db:f,storeNames:[e.storeName]}):n(Ar(f))}).then(function(n){return new m(function(f,s){n.db.transaction(function(c){function l(B){return new m(function(x,W){c.executeSql("DROP TABLE IF EXISTS "+B,[],function(){x()},function(U,q){W(q)})})}for(var v=[],p=0,R=n.storeNames.length;p<R;p++)v.push(l(n.storeNames[p]));m.all(v).then(function(){f()}).catch(function(B){s(B)})},function(c){s(c)})})}):i=m.reject("Invalid arguments"),E(i,t),i}var Ir={r:"webSQLStorage",f:hr,a:cr(),iterate:yr,getItem:mr,setItem:pr,removeItem:gr,clear:br,length:wr,key:Er,keys:Sr,dropInstance:Rr};function _r(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function He(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function Tr(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}function Dr(){return!Tr()||localStorage.length>0}function Br(e){var t=this,r={};if(e)for(var a in e)r[a]=e[a];return r.keyPrefix=He(e,t.o),Dr()?(t.e=r,r.serializer=Se,m.resolve()):m.reject()}function Nr(e){var t=this,r=t.ready().then(function(){for(var a=t.e.keyPrefix,i=localStorage.length-1;i>=0;i--){var n=localStorage.key(i);n.indexOf(a)===0&&localStorage.removeItem(n)}});return E(r,e),r}function xr(e,t){var r=this;e=F(e);var a=r.ready().then(function(){var i=r.e,n=localStorage.getItem(i.keyPrefix+e);return n&&(n=i.serializer.deserialize(n)),n});return E(a,t),a}function Or(e,t){var r=this,a=r.ready().then(function(){for(var i=r.e,n=i.keyPrefix,f=n.length,s=localStorage.length,c=1,l=0;l<s;l++){var v=localStorage.key(l);if(v.indexOf(n)===0){var p=localStorage.getItem(v);if(p&&(p=i.serializer.deserialize(p)),p=e(p,v.substring(f),c++),p!==void 0)return p}}});return E(a,t),a}function Lr(e,t){var r=this,a=r.ready().then(function(){var i=r.e,n;try{n=localStorage.key(e)}catch{n=null}return n&&(n=n.substring(i.keyPrefix.length)),n});return E(a,t),a}function Cr(e){var t=this,r=t.ready().then(function(){for(var a=t.e,i=localStorage.length,n=[],f=0;f<i;f++){var s=localStorage.key(f);s.indexOf(a.keyPrefix)===0&&n.push(s.substring(a.keyPrefix.length))}return n});return E(r,e),r}function Pr(e){var t=this,r=t.keys().then(function(a){return a.length});return E(r,e),r}function Mr(e,t){var r=this;e=F(e);var a=r.ready().then(function(){var i=r.e;localStorage.removeItem(i.keyPrefix+e)});return E(a,t),a}function Fr(e,t,r){var a=this;e=F(e);var i=a.ready().then(function(){t===void 0&&(t=null);var n=t;return new m(function(f,s){var c=a.e;c.serializer.serialize(t,function(l,v){if(v)s(v);else try{localStorage.setItem(c.keyPrefix+e,l),f(n)}catch(p){(p.name==="QuotaExceededError"||p.name==="NS_ERROR_DOM_QUOTA_REACHED")&&s(p),s(p)}})})});return E(i,r),i}function Ur(e,t){if(t=$.apply(this,arguments),e=typeof e!="function"&&e||{},!e.name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var a=this,i;return e.name?i=new m(function(n){e.storeName?n(He(e,a.o)):n(e.name+"/")}).then(function(n){for(var f=localStorage.length-1;f>=0;f--){var s=localStorage.key(f);s.indexOf(n)===0&&localStorage.removeItem(s)}}):i=m.reject("Invalid arguments"),E(i,t),i}var zr={r:"localStorageWrapper",f:Br,a:_r(),iterate:Or,getItem:xr,setItem:Fr,removeItem:Mr,clear:Nr,length:Pr,key:Lr,keys:Cr,dropInstance:Ur},Yr=function(t,r){return t===r||typeof t=="number"&&typeof r=="number"&&isNaN(t)&&isNaN(r)},Wr=function(t,r){for(var a=t.length,i=0;i<a;){if(Yr(t[i],r))return!0;i++}return!1},Ve=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},ce={},Ge={},se={INDEXEDDB:ur,WEBSQL:Ir,LOCALSTORAGE:zr},Kr=[se.INDEXEDDB.r,se.WEBSQL.r,se.LOCALSTORAGE.r],he=["dropInstance"],Ae=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(he),Hr={description:"",driver:Kr.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Vr(e,t){e[t]=function(){var r=arguments;return e.ready().then(function(){return e[t].apply(e,r)})}}function Re(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(Ve(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var Gr=function(){function e(t){V(this,e);for(var r in se)if(se.hasOwnProperty(r)){var a=se[r],i=a.r;this[r]=i,ce[i]||this.defineDriver(a)}this.o=Re({},Hr),this.i=Re({},this.o,t),this.t=null,this.u=null,this.n=!1,this.e=null,this.l(),this.setDriver(this.i.driver).catch(function(){})}return e.prototype.config=function(r){if((typeof r>"u"?"undefined":C(r))==="object"){if(this.n)return new Error("Can't call config() after localforage has been used.");for(var a in r){if(a==="storeName"&&(r[a]=r[a].replace(/\W/g,"_")),a==="version"&&typeof r[a]!="number")return new Error("Database version must be a number.");this.i[a]=r[a]}return"driver"in r&&r.driver?this.setDriver(this.i.driver):!0}else return typeof r=="string"?this.i[r]:this.i},e.prototype.defineDriver=function(r,a,i){var n=new m(function(f,s){try{var c=r.r,l=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!r.r){s(l);return}for(var v=Ae.concat("_initStorage"),p=0,R=v.length;p<R;p++){var B=v[p],x=!Wr(he,B);if((x||r[B])&&typeof r[B]!="function"){s(l);return}}var W=function(){for(var le=function(Qr){return function(){var Jr=new Error("Method "+Qr+" is not implemented by the current driver"),je=m.reject(Jr);return E(je,arguments[arguments.length-1]),je}},Ie=0,Xr=he.length;Ie<Xr;Ie++){var _e=he[Ie];r[_e]||(r[_e]=le(_e))}};W();var U=function(le){ce[c]&&console.info("Redefining LocalForage driver: "+c),ce[c]=r,Ge[c]=le,f()};"_support"in r?r.a&&typeof r.a=="function"?r.a().then(U,s):U(!!r.a):U(!0)}catch(q){s(q)}});return D(n,a,i),n},e.prototype.driver=function(){return this.r||null},e.prototype.getDriver=function(r,a,i){var n=ce[r]?m.resolve(ce[r]):m.reject(new Error("Driver not found."));return D(n,a,i),n},e.prototype.getSerializer=function(r){var a=m.resolve(Se);return D(a,r),a},e.prototype.ready=function(r){var a=this,i=a.t.then(function(){return a.n===null&&(a.n=a.u()),a.n});return D(i,r,r),i},e.prototype.setDriver=function(r,a,i){var n=this;Ve(r)||(r=[r]);var f=this.d(r);function s(){n.i.driver=n.driver()}function c(p){return n.h(p),s(),n.n=n.f(n.i),n.n}function l(p){return function(){var R=0;function B(){for(;R<p.length;){var x=p[R];return R++,n.e=null,n.n=null,n.getDriver(x).then(c).catch(B)}s();var W=new Error("No available storage method found.");return n.t=m.reject(W),n.t}return B()}}var v=this.t!==null?this.t.catch(function(){return m.resolve()}):m.resolve();return this.t=v.then(function(){var p=f[0];return n.e=null,n.n=null,n.getDriver(p).then(function(R){n.r=R.r,s(),n.l(),n.u=l(f)})}).catch(function(){s();var p=new Error("No available storage method found.");return n.t=m.reject(p),n.t}),D(this.t,a,i),this.t},e.prototype.supports=function(r){return!!Ge[r]},e.prototype.h=function(r){Re(this,r)},e.prototype.d=function(r){for(var a=[],i=0,n=r.length;i<n;i++){var f=r[i];this.supports(f)&&a.push(f)}return a},e.prototype.l=function(){for(var r=0,a=Ae.length;r<a;r++)Vr(this,Ae[r])},e.prototype.createInstance=function(r){return new e(r)},e}(),jr=new Gr;z.exports=jr},{3:3}]},{},[4])(4)})});var ke=Qe((me,qe)=>{"use strict";(function(w,y){typeof me=="object"&&typeof qe<"u"?y(me):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],y):y(w.LocalforageDriverMemory={})})(typeof self<"u"?self:me,function(w){"use strict";var y="localforage-driver-memory";function O(o){var u=typeof Symbol=="function"&&o[Symbol.iterator],d=0;return u?u.call(o):{next:function(){return o&&d>=o.length&&(o=void 0),{value:o&&o[d++],done:!o}}}}function L(o,u){o=o||[],u=u||{};try{return new Blob(o,u)}catch(S){if(S.name!=="TypeError")throw S;for(var d=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,g=new d,b=0;b<o.length;b+=1)g.append(o[b]);return g.getBlob(u.type)}}var z=/^~~local_forage_type~([^~]+)~/,Z=9,C=Z+4,V=Object.prototype.toString;function T(o){var u=o.length*.75,d=o.length;o[o.length-1]==="="&&(u--,o[o.length-2]==="="&&u--);for(var g=new ArrayBuffer(u),b=new Uint8Array(g),S=0,_=0;S<d;S+=4){var G="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(o[S]),fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(o[S+1]),ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(o[S+2]),ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(o[S+3]);b[_++]=G<<2|fe>>4,b[_++]=(fe&15)<<4|ie>>2,b[_++]=(ie&3)<<6|ue&63}return g}function Y(o){for(var u=new Uint8Array(o),d="",g=0;g<u.length;g+=3)d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[u[g]>>2],d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(u[g]&3)<<4|u[g+1]>>4],d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(u[g+1]&15)<<2|u[g+2]>>6],d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[u[g+2]&63];return u.length%3===2?d=d.substring(0,d.length-1)+"=":u.length%3===1&&(d=d.substring(0,d.length-2)+"=="),d}function K(o,u){var d="";if(o&&(d=V.call(o)),o&&(d==="[object ArrayBuffer]"||o.buffer&&V.call(o.buffer)==="[object ArrayBuffer]")){var g=void 0,b="__lfsc__:";o instanceof ArrayBuffer?(g=o,b+="arbf"):(g=o.buffer,d==="[object Int8Array]"?b+="si08":d==="[object Uint8Array]"?b+="ui08":d==="[object Uint8ClampedArray]"?b+="uic8":d==="[object Int16Array]"?b+="si16":d==="[object Uint16Array]"?b+="ur16":d==="[object Int32Array]"?b+="si32":d==="[object Uint32Array]"?b+="ui32":d==="[object Float32Array]"?b+="fl32":d==="[object Float64Array]"?b+="fl64":u(new Error("Failed to get type for BinaryArray"))),u(b+Y(g))}else if(d==="[object Blob]"){var S=new FileReader;S.onload=function(){var _="~~local_forage_type~"+o.type+"~"+Y(this.result);u("__lfsc__:blob"+_)},S.readAsArrayBuffer(o)}else try{u(JSON.stringify(o))}catch(_){console.error("Couldn't convert value into a JSON string: ",o),u(null,_)}}function J(o){if(o.substring(0,Z)!=="__lfsc__:")return JSON.parse(o);var u=o.substring(C),d=o.substring(Z,C),g;if(d==="blob"&&z.test(u)){var b=u.match(z);g=b[1],u=u.substring(b[0].length)}var S=T(u);switch(d){case"arbf":return S;case"blob":return L([S],{type:g});case"si08":return new Int8Array(S);case"ui08":return new Uint8Array(S);case"uic8":return new Uint8ClampedArray(S);case"si16":return new Int16Array(S);case"ur16":return new Uint16Array(S);case"si32":return new Int32Array(S);case"ui32":return new Uint32Array(S);case"fl32":return new Float32Array(S);case"fl64":return new Float64Array(S);default:throw new Error("Unkown type: "+d)}}function m(o){var u,d;if(o===null||typeof o!="object"||"isActiveClone"in o)return o;var g=o instanceof Date?new Date(o):o.constructor();try{for(var b=O(Object.keys(o)),S=b.next();!S.done;S=b.next()){var _=S.value;Object.prototype.hasOwnProperty.call(o,_)&&(o.isActiveClone=null,g[_]=m(o[_]),delete o.isActiveClone)}}catch(G){u={error:G}}finally{try{S&&!S.done&&(d=b.return)&&d.call(b)}finally{if(u)throw u.error}}return g}function E(o,u){return(o.name||u.name)+"/"+(o.storeName||u.storeName)+"/"}function D(o,u){u&&o.then(function(d){u(null,d)},function(d){u(d)})}function F(){for(var o=[],u=0;u<arguments.length;u++)o[u]=arguments[u];if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}function $(o,u){var d=this;if(u=F.apply(this,arguments),o=typeof o!="function"&&o||{},!o.name){var g=this.config();o.name=o.name||g.name,o.storeName=o.storeName||g.storeName}var b;return o.name?b=new Promise(function(S){o.storeName?S(E(o,d.o)):S(o.name+"/")}):b=Promise.reject("Invalid arguments"),{promise:b,callback:u}}function P(o){return typeof o!="string"&&(console.warn(o+" used as a key, but it is not a string."),o=String(o)),o}var k={bufferToString:Y,deserialize:J,serialize:K,stringToBuffer:T},M={},oe=function(){function o(u){this.kp=u,this.data={}}return o.resolve=function(u){return M[u]||(M[u]=new o(u)),M[u]},o.prototype.clear=function(){this.data={}},o.prototype.drop=function(){this.clear(),delete M[this.kp]},o.prototype.get=function(u){return this.data[u]},o.prototype.key=function(u){return this.keys()[u]},o.prototype.keys=function(){return Object.keys(this.data)},o.prototype.rm=function(u){delete this.data[u]},o.prototype.set=function(u,d){this.data[u]=d},o}();function re(o){var u=o?m(o):{},d=E(u,this.o),g=oe.resolve(d);return this.e=u,this.e.serializer=k,this.e.keyPrefix=d,this.e.mStore=g,Promise.resolve()}function h(o){var u=this,d=this.ready().then(function(){u.e.mStore.clear()});return D(d,o),d}function I(o,u){var d=$.apply(this,arguments),g=d.promise,b=d.callback,S=g.then(function(_){oe.resolve(_).drop()});return D(S,b),g}function A(o,u){var d=this;o=P(o);var g=this.ready().then(function(){var b=d.e.mStore.get(o);return b==null?null:d.e.serializer.deserialize(b)});return D(g,u),g}function N(o,u){var d=this,g=this.ready().then(function(){for(var b=d.e.mStore,S=b.keys(),_=0;_<S.length;_++){var G=b.get(S[_]);if(G&&(G=d.e.serializer.deserialize(G)),G=o(G,S[_],_+1),G!==void 0)return G}});return D(g,u),g}function H(o,u){var d=this,g=this.ready().then(function(){var b;try{b=d.e.mStore.key(o),b===void 0&&(b=null)}catch{b=null}return b});return D(g,u),g}function j(o){var u=this,d=this.ready().then(function(){return u.e.mStore.keys()});return D(d,o),d}function X(o){var u=this.keys().then(function(d){return d.length});return D(u,o),u}function Q(o,u){var d=this;o=P(o);var g=this.ready().then(function(){d.e.mStore.rm(o)});return D(g,u),g}function ee(o,u,d){var g=this;o=P(o);var b=this.ready().then(function(){u===void 0&&(u=null);var S=u;return new Promise(function(_,G){g.e.serializer.serialize(u,function(fe,ie){if(ie)G(ie);else try{g.e.mStore.set(o,fe),_(S)}catch(ue){G(ue)}})})});return D(b,d),b}var ae=!0;w.a=ae,w.r=y,w.f=re,w.clear=h,w.dropInstance=I,w.getItem=A,w.iterate=N,w.key=H,w.keys=j,w.length=X,w.removeItem=Q,w.setItem=ee,Object.defineProperty(w,"__esModule",{value:!0})})});var pe=Je(Ze()),rr=Je(ke());import{SDKBase as ut,createSDK as ct}from"@magic-sdk/provider";import{createDuplicateIframeWarning as tt,createModalNotReadyError as nt,createURL as er,ViewController as at}from"@magic-sdk/provider";import{MagicIncomingWindowMessage as it}from"@magic-sdk/types";var ot={display:"block",visibility:"hidden",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",opacity:"0",zIndex:"-1"};function ft(w){for(let[y,O]of Object.entries(ot))w.style[y]=O}function st(w){return!![].slice.call(document.querySelectorAll(".magic-iframe")).find(O=>O.src.includes(w))}var ye=class extends at{activeElement=null;iframe;relayerSrc=er(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href;init(){this.test="hello",this.iframe=new Promise(y=>{let O=()=>{if(st(encodeURIComponent(this.parameters)))tt().log();else{let L=document.createElement("iframe");L.classList.add("magic-iframe"),L.dataset.magicIframeLabel=er(this.endpoint).host,L.title="Secure Modal",L.src=this.relayerSrc,L.allow="clipboard-read; clipboard-write",ft(L),document.body.appendChild(L),y(L)}};["loaded","interactive","complete"].includes(document.readyState)?O():window.addEventListener("load",O,!1)}),this.iframe.then(y=>{y instanceof HTMLIFrameElement&&y.addEventListener("load",async()=>{this.heartbeatDebounce()})}),window.addEventListener("message",y=>{if(y.origin===this.endpoint&&y.data.msgType&&(y.data.msgType.includes(it.MAGIC_PONG)&&(this.lastPongTime=Date.now()),y.data&&this.messageHandlers.size)){y.data.response=y.data.response??{},this.stopHeartBeat();for(let O of this.messageHandlers.values())O(y)}}),window.addEventListener("beforeunload",()=>{this.stopHeartBeat()})}async showOverlay(){let y=await this.iframe;y.style.visibility="visible",y.style.zIndex="2147483647",y.style.opacity="1",this.activeElement=document.activeElement,y.focus()}async hideOverlay(){let y=await this.iframe;y.style.visibility="hidden",y.style.zIndex="-1",y.style.opacity="0",this.activeElement?.focus&&this.activeElement.focus(),this.activeElement=null}async m(y){let O=await this.iframe;if(O&&O.contentWindow)O.contentWindow.postMessage(y,this.endpoint);else throw nt()}async checkRelayerExistsInDOM(){let y=await this.iframe;return!y||!y.contentWindow?!1:!![].slice.call(document.querySelectorAll(".magic-iframe")).find(L=>L.src.includes(encodeURIComponent(this.parameters)))}async reloadRelayer(){let y=await this.iframe;if(this.stopHeartBeat(),!y){this.init(),console.warn("Magic SDK: Modal lost, re-initiating");return}if(!y.contentWindow){document.body.appendChild(y),console.warn("Magic SDK: Modal did not append in the iframe, re-initiating");return}y&&(y.src=this.relayerSrc)}};export*from"@magic-sdk/commons";var Et=ct(ut,{platform:"web",sdkName:"magic-sdk",version:"29.0.5",defaultEndpoint:"https://auth.magic.link/",ViewController:ye,configureStorage:async()=>{let w=pe.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return await w.defineDriver(rr),await w.setDriver([pe.default.INDEXEDDB,pe.default.LOCALSTORAGE,rr.r]),w}});export{Et as Magic};
|
1
|
+
var $r=Object.create;var Xe=Object.defineProperty;var Zr=Object.getOwnPropertyDescriptor;var qr=Object.getOwnPropertyNames;var kr=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty;var ve=(b=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(b,{get:(I,w)=>(typeof require<"u"?require:I)[w]}):b)(function(b){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+b+'" is not supported')});var Qe=(b,I)=>()=>(I||b((I={exports:{}}).exports,I),I.exports);var rt=(b,I,w,P)=>{if(I&&typeof I=="object"||typeof I=="function")for(let T of qr(I))!et.call(b,T)&&T!==w&&Xe(b,T,{get:()=>I[T],enumerable:!(P=Zr(I,T))||P.enumerable});return b};var Je=(b,I,w)=>(w=b!=null?$r(kr(b)):{},rt(I||!b||!b.__esModule?Xe(w,"default",{value:b,enumerable:!0}):w,b));var Ze=Qe(($e,Te)=>{"use strict";(function(b){if(typeof $e=="object"&&typeof Te<"u")Te.exports=b();else if(typeof define=="function"&&define.amd)define([],b);else{var I;typeof window<"u"?I=window:typeof global<"u"?I=global:typeof self<"u"?I=self:I=this,I.localforage=b()}})(function(){var b,I,w;return function P(T,Z,C){function V(K,J){if(!Z[K]){if(!T[K]){var m=typeof ve=="function"&&ve;if(!J&&m)return m(K,!0);if(B)return B(K,!0);var E=new Error("Cannot find module '"+K+"'");throw E.code="MODULE_NOT_FOUND",E}var N=Z[K]={exports:{}};T[K][0].call(N.exports,function(U){var $=T[K][1][U];return V($||U)},N,N.exports,P,T,Z,C)}return Z[K].exports}for(var B=typeof ve=="function"&&ve,Y=0;Y<C.length;Y++)V(C[Y]);return V}({1:[function(P,T,Z){(function(C){"use strict";var V=C.MutationObserver||C.WebKitMutationObserver,B;if(V){var Y=0,K=new V(U),J=C.document.createTextNode("");K.observe(J,{characterData:!0}),B=function(){J.data=Y=++Y%2}}else if(!C.setImmediate&&typeof C.MessageChannel<"u"){var m=new C.MessageChannel;m.port1.onmessage=U,B=function(){m.port2.postMessage(0)}}else"document"in C&&"onreadystatechange"in C.document.createElement("script")?B=function(){var M=C.document.createElement("script");M.onreadystatechange=function(){U(),M.onreadystatechange=null,M.parentNode.removeChild(M),M=null},C.document.documentElement.appendChild(M)}:B=function(){setTimeout(U,0)};var E,N=[];function U(){E=!0;for(var M,k,F=N.length;F;){for(k=N,N=[],M=-1;++M<F;)k[M]();F=N.length}E=!1}T.exports=$;function $(M){N.push(M)===1&&!E&&B()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(P,T,Z){"use strict";var C=P(1);function V(){}var B={},Y=["REJECTED"],K=["FULFILLED"],J=["PENDING"];T.exports=m;function m(h){if(typeof h!="function")throw new TypeError("resolver must be a function");this.state=J,this.queue=[],this.outcome=void 0,h!==V&&$(this,h)}m.prototype.catch=function(h){return this.then(null,h)},m.prototype.then=function(h,_){if(typeof h!="function"&&this.state===K||typeof _!="function"&&this.state===Y)return this;var A=new this.constructor(V);if(this.state!==J){var O=this.state===K?h:_;N(A,O,this.outcome)}else this.queue.push(new E(A,h,_));return A};function E(h,_,A){this.promise=h,typeof _=="function"&&(this.onFulfilled=_,this.callFulfilled=this.otherCallFulfilled),typeof A=="function"&&(this.onRejected=A,this.callRejected=this.otherCallRejected)}E.prototype.callFulfilled=function(h){B.resolve(this.promise,h)},E.prototype.otherCallFulfilled=function(h){N(this.promise,this.onFulfilled,h)},E.prototype.callRejected=function(h){B.reject(this.promise,h)},E.prototype.otherCallRejected=function(h){N(this.promise,this.onRejected,h)};function N(h,_,A){C(function(){var O;try{O=_(A)}catch(H){return B.reject(h,H)}O===h?B.reject(h,new TypeError("Cannot resolve promise with itself")):B.resolve(h,O)})}B.resolve=function(h,_){var A=M(U,_);if(A.status==="error")return B.reject(h,A.value);var O=A.value;if(O)$(h,O);else{h.state=K,h.outcome=_;for(var H=-1,j=h.queue.length;++H<j;)h.queue[H].callFulfilled(_)}return h},B.reject=function(h,_){h.state=Y,h.outcome=_;for(var A=-1,O=h.queue.length;++A<O;)h.queue[A].callRejected(_);return h};function U(h){var _=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof _=="function")return function(){_.apply(h,arguments)}}function $(h,_){var A=!1;function O(Q){A||(A=!0,B.reject(h,Q))}function H(Q){A||(A=!0,B.resolve(h,Q))}function j(){_(H,O)}var X=M(j);X.status==="error"&&O(X.value)}function M(h,_){var A={};try{A.value=h(_),A.status="success"}catch(O){A.status="error",A.value=O}return A}m.resolve=k;function k(h){return h instanceof this?h:B.resolve(new this(V),h)}m.reject=F;function F(h){var _=new this(V);return B.reject(_,h)}m.all=oe;function oe(h){var _=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var A=h.length,O=!1;if(!A)return this.resolve([]);for(var H=new Array(A),j=0,X=-1,Q=new this(V);++X<A;)ee(h[X],X);return Q;function ee(ae,o){_.resolve(ae).then(u,function(d){O||(O=!0,B.reject(Q,d))});function u(d){H[o]=d,++j===A&&!O&&(O=!0,B.resolve(Q,H))}}}m.race=re;function re(h){var _=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var A=h.length,O=!1;if(!A)return this.resolve([]);for(var H=-1,j=new this(V);++H<A;)X(h[H]);return j;function X(Q){_.resolve(Q).then(function(ee){O||(O=!0,B.resolve(j,ee))},function(ee){O||(O=!0,B.reject(j,ee))})}}},{1:1}],3:[function(P,T,Z){(function(C){"use strict";typeof C.Promise!="function"&&(C.Promise=P(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(P,T,Z){"use strict";var C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B(){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 Y=B();function K(){try{if(!Y||!Y.open)return!1;var e=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!e||t)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function J(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(n){if(n.name!=="TypeError")throw n;for(var r=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,a=new r,i=0;i<e.length;i+=1)a.append(e[i]);return a.getBlob(t.type)}}typeof Promise>"u"&&P(3);var m=Promise;function E(e,t){t&&e.then(function(r){t(null,r)},function(r){t(r)})}function N(e,t,r){typeof t=="function"&&e.then(t),typeof r=="function"&&e.catch(r)}function U(e){return typeof e!="string"&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function $(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var M="local-forage-detect-blob-support",k=void 0,F={},oe=Object.prototype.toString,re="readonly",h="readwrite";function _(e){for(var t=e.length,r=new ArrayBuffer(t),a=new Uint8Array(r),i=0;i<t;i++)a[i]=e.charCodeAt(i);return r}function A(e){return new m(function(t){var r=e.transaction(M,h),a=J([""]);r.objectStore(M).put(a,"key"),r.onabort=function(i){i.preventDefault(),i.stopPropagation(),t(!1)},r.oncomplete=function(){var i=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!i||parseInt(i[1],10)>=43)}}).catch(function(){return!1})}function O(e){return typeof k=="boolean"?m.resolve(k):A(e).then(function(t){return k=t,k})}function H(e){var t=F[e.name],r={};r.promise=new m(function(a,i){r.resolve=a,r.reject=i}),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then(function(){return r.promise}):t.dbReady=r.promise}function j(e){var t=F[e.name],r=t.deferredOperations.pop();if(r)return r.resolve(),r.promise}function X(e,t){var r=F[e.name],a=r.deferredOperations.pop();if(a)return a.reject(t),a.promise}function Q(e,t){return new m(function(r,a){if(F[e.name]=F[e.name]||G(),e.db)if(t)H(e),e.db.close();else return r(e.db);var i=[e.name];t&&i.push(e.version);var n=Y.open.apply(Y,i);t&&(n.onupgradeneeded=function(f){var s=n.result;try{s.createObjectStore(e.storeName),f.oldVersion<=1&&s.createObjectStore(M)}catch(c){if(c.name==="ConstraintError")console.warn('The database "'+e.name+'" has been upgraded from version '+f.oldVersion+" to version "+f.newVersion+', but the storage "'+e.storeName+'" already exists.');else throw c}}),n.onerror=function(f){f.preventDefault(),a(n.error)},n.onsuccess=function(){var f=n.result;f.onversionchange=function(s){s.target.close()},r(f),j(e)}})}function ee(e){return Q(e,!1)}function ae(e){return Q(e,!0)}function o(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),a=e.version<e.db.version,i=e.version>e.db.version;if(a&&(e.version!==t&&console.warn('The database "'+e.name+`" can't be downgraded from version `+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var n=e.db.version+1;n>e.version&&(e.version=n)}return!0}return!1}function u(e){return new m(function(t,r){var a=new FileReader;a.onerror=r,a.onloadend=function(i){var n=btoa(i.target.result||"");t({v:!0,data:n,type:e.type})},a.readAsBinaryString(e)})}function d(e){var t=_(atob(e.data));return J([t],{type:e.type})}function p(e){return e&&e.v}function g(e){var t=this,r=t.s().then(function(){var a=F[t.e.name];if(a&&a.dbReady)return a.dbReady});return N(r,e,e),r}function S(e){H(e);for(var t=F[e.name],r=t.forages,a=0;a<r.length;a++){var i=r[a];i.e.db&&(i.e.db.close(),i.e.db=null)}return e.db=null,ee(e).then(function(n){return e.db=n,o(e)?ae(e):n}).then(function(n){e.db=t.db=n;for(var f=0;f<r.length;f++)r[f].e.db=n}).catch(function(n){throw X(e,n),n})}function D(e,t,r,a){a===void 0&&(a=1);try{var i=e.db.transaction(e.storeName,t);r(null,i)}catch(n){if(a>0&&(!e.db||n.name==="InvalidStateError"||n.name==="NotFoundError"))return m.resolve().then(function(){if(!e.db||n.name==="NotFoundError"&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),ae(e)}).then(function(){return S(e).then(function(){D(e,t,r,a-1)})}).catch(r);r(n)}}function G(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function fe(e){var t=this,r={db:null};if(e)for(var a in e)r[a]=e[a];var i=F[r.name];i||(i=G(),F[r.name]=i),i.forages.push(t),t.s||(t.s=t.ready,t.ready=g);var n=[];function f(){return m.resolve()}for(var s=0;s<i.forages.length;s++){var c=i.forages[s];c!==t&&n.push(c.s().catch(f))}var l=i.forages.slice(0);return m.all(n).then(function(){return r.db=i.db,ee(r)}).then(function(v){return r.db=v,o(r,t.o.version)?ae(r):v}).then(function(v){r.db=i.db=v,t.e=r;for(var y=0;y<l.length;y++){var R=l[y];R!==t&&(R.e.db=r.db,R.e.version=r.version)}})}function ie(e,t){var r=this;e=U(e);var a=new m(function(i,n){r.ready().then(function(){D(r.e,re,function(f,s){if(f)return n(f);try{var c=s.objectStore(r.e.storeName),l=c.get(e);l.onsuccess=function(){var v=l.result;v===void 0&&(v=null),p(v)&&(v=d(v)),i(v)},l.onerror=function(){n(l.error)}}catch(v){n(v)}})}).catch(n)});return E(a,t),a}function ue(e,t){var r=this,a=new m(function(i,n){r.ready().then(function(){D(r.e,re,function(f,s){if(f)return n(f);try{var c=s.objectStore(r.e.storeName),l=c.openCursor(),v=1;l.onsuccess=function(){var y=l.result;if(y){var R=y.value;p(R)&&(R=d(R));var x=e(R,y.key,v++);x!==void 0?i(x):y.continue()}else i()},l.onerror=function(){n(l.error)}}catch(y){n(y)}})}).catch(n)});return E(a,t),a}function tr(e,t,r){var a=this;e=U(e);var i=new m(function(n,f){var s;a.ready().then(function(){return s=a.e,oe.call(t)==="[object Blob]"?O(s.db).then(function(c){return c?t:u(t)}):t}).then(function(c){D(a.e,h,function(l,v){if(l)return f(l);try{var y=v.objectStore(a.e.storeName);c===null&&(c=void 0);var R=y.put(c,e);v.oncomplete=function(){c===void 0&&(c=null),n(c)},v.onabort=v.onerror=function(){var x=R.error?R.error:R.transaction.error;f(x)}}catch(x){f(x)}})}).catch(f)});return E(i,r),i}function nr(e,t){var r=this;e=U(e);var a=new m(function(i,n){r.ready().then(function(){D(r.e,h,function(f,s){if(f)return n(f);try{var c=s.objectStore(r.e.storeName),l=c.delete(e);s.oncomplete=function(){i()},s.onerror=function(){n(l.error)},s.onabort=function(){var v=l.error?l.error:l.transaction.error;n(v)}}catch(v){n(v)}})}).catch(n)});return E(a,t),a}function ar(e){var t=this,r=new m(function(a,i){t.ready().then(function(){D(t.e,h,function(n,f){if(n)return i(n);try{var s=f.objectStore(t.e.storeName),c=s.clear();f.oncomplete=function(){a()},f.onabort=f.onerror=function(){var l=c.error?c.error:c.transaction.error;i(l)}}catch(l){i(l)}})}).catch(i)});return E(r,e),r}function ir(e){var t=this,r=new m(function(a,i){t.ready().then(function(){D(t.e,re,function(n,f){if(n)return i(n);try{var s=f.objectStore(t.e.storeName),c=s.count();c.onsuccess=function(){a(c.result)},c.onerror=function(){i(c.error)}}catch(l){i(l)}})}).catch(i)});return E(r,e),r}function or(e,t){var r=this,a=new m(function(i,n){if(e<0){i(null);return}r.ready().then(function(){D(r.e,re,function(f,s){if(f)return n(f);try{var c=s.objectStore(r.e.storeName),l=!1,v=c.openKeyCursor();v.onsuccess=function(){var y=v.result;if(!y){i(null);return}e===0||l?i(y.key):(l=!0,y.advance(e))},v.onerror=function(){n(v.error)}}catch(y){n(y)}})}).catch(n)});return E(a,t),a}function fr(e){var t=this,r=new m(function(a,i){t.ready().then(function(){D(t.e,re,function(n,f){if(n)return i(n);try{var s=f.objectStore(t.e.storeName),c=s.openKeyCursor(),l=[];c.onsuccess=function(){var v=c.result;if(!v){a(l);return}l.push(v.key),v.continue()},c.onerror=function(){i(c.error)}}catch(v){i(v)}})}).catch(i)});return E(r,e),r}function sr(e,t){t=$.apply(this,arguments);var r=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var a=this,i;if(!e.name)i=m.reject("Invalid arguments");else{var n=e.name===r.name&&a.e.db,f=n?m.resolve(a.e.db):ee(e).then(function(s){var c=F[e.name],l=c.forages;c.db=s;for(var v=0;v<l.length;v++)l[v].e.db=s;return s});e.storeName?i=f.then(function(s){if(s.objectStoreNames.contains(e.storeName)){var c=s.version+1;H(e);var l=F[e.name],v=l.forages;s.close();for(var y=0;y<v.length;y++){var R=v[y];R.e.db=null,R.e.version=c}var x=new m(function(L,W){var z=Y.open(e.name,c);z.onerror=function(q){var le=z.result;le.close(),W(q)},z.onupgradeneeded=function(){var q=z.result;q.deleteObjectStore(e.storeName)},z.onsuccess=function(){var q=z.result;q.close(),L(q)}});return x.then(function(L){l.db=L;for(var W=0;W<v.length;W++){var z=v[W];z.e.db=L,j(z.e)}}).catch(function(L){throw(X(e,L)||m.resolve()).catch(function(){}),L})}}):i=f.then(function(s){H(e);var c=F[e.name],l=c.forages;s.close();for(var v=0;v<l.length;v++){var y=l[v];y.e.db=null}var R=new m(function(x,L){var W=Y.deleteDatabase(e.name);W.onerror=function(){var z=W.result;z&&z.close(),L(W.error)},W.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},W.onsuccess=function(){var z=W.result;z&&z.close(),x(z)}});return R.then(function(x){c.db=x;for(var L=0;L<l.length;L++){var W=l[L];j(W.e)}}).catch(function(x){throw(X(e,x)||m.resolve()).catch(function(){}),x})})}return E(i,t),i}var ur={r:"asyncStorage",f:fe,a:K(),iterate:ue,getItem:ie,setItem:tr,removeItem:nr,clear:ar,length:ir,key:or,keys:fr,dropInstance:sr};function cr(){return typeof openDatabase=="function"}var te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lr="~~local_forage_type~",De=/^~~local_forage_type~([^~]+)~/,de="__lfsc__:",ge=de.length,be="arbf",we="blob",Be="si08",Ne="ui08",xe="uic8",Oe="si16",Le="si32",Ce="ur16",Pe="ui32",Me="fl32",Fe="fl64",Ue=ge+be.length,ze=Object.prototype.toString;function Ye(e){var t=e.length*.75,r=e.length,a,i=0,n,f,s,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var l=new ArrayBuffer(t),v=new Uint8Array(l);for(a=0;a<r;a+=4)n=te.indexOf(e[a]),f=te.indexOf(e[a+1]),s=te.indexOf(e[a+2]),c=te.indexOf(e[a+3]),v[i++]=n<<2|f>>4,v[i++]=(f&15)<<4|s>>2,v[i++]=(s&3)<<6|c&63;return l}function Ee(e){var t=new Uint8Array(e),r="",a;for(a=0;a<t.length;a+=3)r+=te[t[a]>>2],r+=te[(t[a]&3)<<4|t[a+1]>>4],r+=te[(t[a+1]&15)<<2|t[a+2]>>6],r+=te[t[a+2]&63];return t.length%3===2?r=r.substring(0,r.length-1)+"=":t.length%3===1&&(r=r.substring(0,r.length-2)+"=="),r}function vr(e,t){var r="";if(e&&(r=ze.call(e)),e&&(r==="[object ArrayBuffer]"||e.buffer&&ze.call(e.buffer)==="[object ArrayBuffer]")){var a,i=de;e instanceof ArrayBuffer?(a=e,i+=be):(a=e.buffer,r==="[object Int8Array]"?i+=Be:r==="[object Uint8Array]"?i+=Ne:r==="[object Uint8ClampedArray]"?i+=xe:r==="[object Int16Array]"?i+=Oe:r==="[object Uint16Array]"?i+=Ce:r==="[object Int32Array]"?i+=Le:r==="[object Uint32Array]"?i+=Pe:r==="[object Float32Array]"?i+=Me:r==="[object Float64Array]"?i+=Fe:t(new Error("Failed to get type for BinaryArray"))),t(i+Ee(a))}else if(r==="[object Blob]"){var n=new FileReader;n.onload=function(){var f=lr+e.type+"~"+Ee(this.result);t(de+we+f)},n.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(f){console.error("Couldn't convert value into a JSON string: ",e),t(null,f)}}function dr(e){if(e.substring(0,ge)!==de)return JSON.parse(e);var t=e.substring(Ue),r=e.substring(ge,Ue),a;if(r===we&&De.test(t)){var i=t.match(De);a=i[1],t=t.substring(i[0].length)}var n=Ye(t);switch(r){case be:return n;case we:return J([n],{type:a});case Be:return new Int8Array(n);case Ne:return new Uint8Array(n);case xe:return new Uint8ClampedArray(n);case Oe:return new Int16Array(n);case Ce:return new Uint16Array(n);case Le:return new Int32Array(n);case Pe:return new Uint32Array(n);case Me:return new Float32Array(n);case Fe:return new Float64Array(n);default:throw new Error("Unkown type: "+r)}}var Se={serialize:vr,deserialize:dr,stringToBuffer:Ye,bufferToString:Ee};function We(e,t,r,a){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,a)}function hr(e){var t=this,r={db:null};if(e)for(var a in e)r[a]=typeof e[a]!="string"?e[a].toString():e[a];var i=new m(function(n,f){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(s){return f(s)}r.db.transaction(function(s){We(s,r,function(){t.e=r,n()},function(c,l){f(l)})},f)});return r.serializer=Se,i}function ne(e,t,r,a,i,n){e.executeSql(r,a,i,function(f,s){s.code===s.SYNTAX_ERR?f.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(c,l){l.rows.length?n(c,s):We(c,t,function(){c.executeSql(r,a,i,n)},n)},n):n(f,s)},n)}function mr(e,t){var r=this;e=U(e);var a=new m(function(i,n){r.ready().then(function(){var f=r.e;f.db.transaction(function(s){ne(s,f,"SELECT * FROM "+f.storeName+" WHERE key = ? LIMIT 1",[e],function(c,l){var v=l.rows.length?l.rows.item(0).value:null;v&&(v=f.serializer.deserialize(v)),i(v)},function(c,l){n(l)})})}).catch(n)});return E(a,t),a}function yr(e,t){var r=this,a=new m(function(i,n){r.ready().then(function(){var f=r.e;f.db.transaction(function(s){ne(s,f,"SELECT * FROM "+f.storeName,[],function(c,l){for(var v=l.rows,y=v.length,R=0;R<y;R++){var x=v.item(R),L=x.value;if(L&&(L=f.serializer.deserialize(L)),L=e(L,x.key,R+1),L!==void 0){i(L);return}}i()},function(c,l){n(l)})})}).catch(n)});return E(a,t),a}function Ke(e,t,r,a){var i=this;e=U(e);var n=new m(function(f,s){i.ready().then(function(){t===void 0&&(t=null);var c=t,l=i.e;l.serializer.serialize(t,function(v,y){y?s(y):l.db.transaction(function(R){ne(R,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,v],function(){f(c)},function(x,L){s(L)})},function(R){if(R.code===R.QUOTA_ERR){if(a>0){f(Ke.apply(i,[e,c,r,a-1]));return}s(R)}})})}).catch(s)});return E(n,r),n}function pr(e,t,r){return Ke.apply(this,[e,t,r,1])}function gr(e,t){var r=this;e=U(e);var a=new m(function(i,n){r.ready().then(function(){var f=r.e;f.db.transaction(function(s){ne(s,f,"DELETE FROM "+f.storeName+" WHERE key = ?",[e],function(){i()},function(c,l){n(l)})})}).catch(n)});return E(a,t),a}function br(e){var t=this,r=new m(function(a,i){t.ready().then(function(){var n=t.e;n.db.transaction(function(f){ne(f,n,"DELETE FROM "+n.storeName,[],function(){a()},function(s,c){i(c)})})}).catch(i)});return E(r,e),r}function wr(e){var t=this,r=new m(function(a,i){t.ready().then(function(){var n=t.e;n.db.transaction(function(f){ne(f,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(s,c){var l=c.rows.item(0).c;a(l)},function(s,c){i(c)})})}).catch(i)});return E(r,e),r}function Er(e,t){var r=this,a=new m(function(i,n){r.ready().then(function(){var f=r.e;f.db.transaction(function(s){ne(s,f,"SELECT key FROM "+f.storeName+" WHERE id = ? LIMIT 1",[e+1],function(c,l){var v=l.rows.length?l.rows.item(0).key:null;i(v)},function(c,l){n(l)})})}).catch(n)});return E(a,t),a}function Sr(e){var t=this,r=new m(function(a,i){t.ready().then(function(){var n=t.e;n.db.transaction(function(f){ne(f,n,"SELECT key FROM "+n.storeName,[],function(s,c){for(var l=[],v=0;v<c.rows.length;v++)l.push(c.rows.item(v).key);a(l)},function(s,c){i(c)})})}).catch(i)});return E(r,e),r}function Ar(e){return new m(function(t,r){e.transaction(function(a){a.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(i,n){for(var f=[],s=0;s<n.rows.length;s++)f.push(n.rows.item(s).name);t({db:e,storeNames:f})},function(i,n){r(n)})},function(a){r(a)})})}function Rr(e,t){t=$.apply(this,arguments);var r=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var a=this,i;return e.name?i=new m(function(n){var f;e.name===r.name?f=a.e.db:f=openDatabase(e.name,"","",0),e.storeName?n({db:f,storeNames:[e.storeName]}):n(Ar(f))}).then(function(n){return new m(function(f,s){n.db.transaction(function(c){function l(x){return new m(function(L,W){c.executeSql("DROP TABLE IF EXISTS "+x,[],function(){L()},function(z,q){W(q)})})}for(var v=[],y=0,R=n.storeNames.length;y<R;y++)v.push(l(n.storeNames[y]));m.all(v).then(function(){f()}).catch(function(x){s(x)})},function(c){s(c)})})}):i=m.reject("Invalid arguments"),E(i,t),i}var Ir={r:"webSQLStorage",f:hr,a:cr(),iterate:yr,getItem:mr,setItem:pr,removeItem:gr,clear:br,length:wr,key:Er,keys:Sr,dropInstance:Rr};function _r(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function He(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function Tr(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}function Dr(){return!Tr()||localStorage.length>0}function Br(e){var t=this,r={};if(e)for(var a in e)r[a]=e[a];return r.keyPrefix=He(e,t.o),Dr()?(t.e=r,r.serializer=Se,m.resolve()):m.reject()}function Nr(e){var t=this,r=t.ready().then(function(){for(var a=t.e.keyPrefix,i=localStorage.length-1;i>=0;i--){var n=localStorage.key(i);n.indexOf(a)===0&&localStorage.removeItem(n)}});return E(r,e),r}function xr(e,t){var r=this;e=U(e);var a=r.ready().then(function(){var i=r.e,n=localStorage.getItem(i.keyPrefix+e);return n&&(n=i.serializer.deserialize(n)),n});return E(a,t),a}function Or(e,t){var r=this,a=r.ready().then(function(){for(var i=r.e,n=i.keyPrefix,f=n.length,s=localStorage.length,c=1,l=0;l<s;l++){var v=localStorage.key(l);if(v.indexOf(n)===0){var y=localStorage.getItem(v);if(y&&(y=i.serializer.deserialize(y)),y=e(y,v.substring(f),c++),y!==void 0)return y}}});return E(a,t),a}function Lr(e,t){var r=this,a=r.ready().then(function(){var i=r.e,n;try{n=localStorage.key(e)}catch{n=null}return n&&(n=n.substring(i.keyPrefix.length)),n});return E(a,t),a}function Cr(e){var t=this,r=t.ready().then(function(){for(var a=t.e,i=localStorage.length,n=[],f=0;f<i;f++){var s=localStorage.key(f);s.indexOf(a.keyPrefix)===0&&n.push(s.substring(a.keyPrefix.length))}return n});return E(r,e),r}function Pr(e){var t=this,r=t.keys().then(function(a){return a.length});return E(r,e),r}function Mr(e,t){var r=this;e=U(e);var a=r.ready().then(function(){var i=r.e;localStorage.removeItem(i.keyPrefix+e)});return E(a,t),a}function Fr(e,t,r){var a=this;e=U(e);var i=a.ready().then(function(){t===void 0&&(t=null);var n=t;return new m(function(f,s){var c=a.e;c.serializer.serialize(t,function(l,v){if(v)s(v);else try{localStorage.setItem(c.keyPrefix+e,l),f(n)}catch(y){(y.name==="QuotaExceededError"||y.name==="NS_ERROR_DOM_QUOTA_REACHED")&&s(y),s(y)}})})});return E(i,r),i}function Ur(e,t){if(t=$.apply(this,arguments),e=typeof e!="function"&&e||{},!e.name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var a=this,i;return e.name?i=new m(function(n){e.storeName?n(He(e,a.o)):n(e.name+"/")}).then(function(n){for(var f=localStorage.length-1;f>=0;f--){var s=localStorage.key(f);s.indexOf(n)===0&&localStorage.removeItem(s)}}):i=m.reject("Invalid arguments"),E(i,t),i}var zr={r:"localStorageWrapper",f:Br,a:_r(),iterate:Or,getItem:xr,setItem:Fr,removeItem:Mr,clear:Nr,length:Pr,key:Lr,keys:Cr,dropInstance:Ur},Yr=function(t,r){return t===r||typeof t=="number"&&typeof r=="number"&&isNaN(t)&&isNaN(r)},Wr=function(t,r){for(var a=t.length,i=0;i<a;){if(Yr(t[i],r))return!0;i++}return!1},Ve=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},ce={},Ge={},se={INDEXEDDB:ur,WEBSQL:Ir,LOCALSTORAGE:zr},Kr=[se.INDEXEDDB.r,se.WEBSQL.r,se.LOCALSTORAGE.r],he=["dropInstance"],Ae=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(he),Hr={description:"",driver:Kr.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Vr(e,t){e[t]=function(){var r=arguments;return e.ready().then(function(){return e[t].apply(e,r)})}}function Re(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(Ve(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var Gr=function(){function e(t){V(this,e);for(var r in se)if(se.hasOwnProperty(r)){var a=se[r],i=a.r;this[r]=i,ce[i]||this.defineDriver(a)}this.o=Re({},Hr),this.i=Re({},this.o,t),this.t=null,this.u=null,this.n=!1,this.e=null,this.l(),this.setDriver(this.i.driver).catch(function(){})}return e.prototype.config=function(r){if((typeof r>"u"?"undefined":C(r))==="object"){if(this.n)return new Error("Can't call config() after localforage has been used.");for(var a in r){if(a==="storeName"&&(r[a]=r[a].replace(/\W/g,"_")),a==="version"&&typeof r[a]!="number")return new Error("Database version must be a number.");this.i[a]=r[a]}return"driver"in r&&r.driver?this.setDriver(this.i.driver):!0}else return typeof r=="string"?this.i[r]:this.i},e.prototype.defineDriver=function(r,a,i){var n=new m(function(f,s){try{var c=r.r,l=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!r.r){s(l);return}for(var v=Ae.concat("_initStorage"),y=0,R=v.length;y<R;y++){var x=v[y],L=!Wr(he,x);if((L||r[x])&&typeof r[x]!="function"){s(l);return}}var W=function(){for(var le=function(Qr){return function(){var Jr=new Error("Method "+Qr+" is not implemented by the current driver"),je=m.reject(Jr);return E(je,arguments[arguments.length-1]),je}},Ie=0,Xr=he.length;Ie<Xr;Ie++){var _e=he[Ie];r[_e]||(r[_e]=le(_e))}};W();var z=function(le){ce[c]&&console.info("Redefining LocalForage driver: "+c),ce[c]=r,Ge[c]=le,f()};"_support"in r?r.a&&typeof r.a=="function"?r.a().then(z,s):z(!!r.a):z(!0)}catch(q){s(q)}});return N(n,a,i),n},e.prototype.driver=function(){return this.r||null},e.prototype.getDriver=function(r,a,i){var n=ce[r]?m.resolve(ce[r]):m.reject(new Error("Driver not found."));return N(n,a,i),n},e.prototype.getSerializer=function(r){var a=m.resolve(Se);return N(a,r),a},e.prototype.ready=function(r){var a=this,i=a.t.then(function(){return a.n===null&&(a.n=a.u()),a.n});return N(i,r,r),i},e.prototype.setDriver=function(r,a,i){var n=this;Ve(r)||(r=[r]);var f=this.d(r);function s(){n.i.driver=n.driver()}function c(y){return n.h(y),s(),n.n=n.f(n.i),n.n}function l(y){return function(){var R=0;function x(){for(;R<y.length;){var L=y[R];return R++,n.e=null,n.n=null,n.getDriver(L).then(c).catch(x)}s();var W=new Error("No available storage method found.");return n.t=m.reject(W),n.t}return x()}}var v=this.t!==null?this.t.catch(function(){return m.resolve()}):m.resolve();return this.t=v.then(function(){var y=f[0];return n.e=null,n.n=null,n.getDriver(y).then(function(R){n.r=R.r,s(),n.l(),n.u=l(f)})}).catch(function(){s();var y=new Error("No available storage method found.");return n.t=m.reject(y),n.t}),N(this.t,a,i),this.t},e.prototype.supports=function(r){return!!Ge[r]},e.prototype.h=function(r){Re(this,r)},e.prototype.d=function(r){for(var a=[],i=0,n=r.length;i<n;i++){var f=r[i];this.supports(f)&&a.push(f)}return a},e.prototype.l=function(){for(var r=0,a=Ae.length;r<a;r++)Vr(this,Ae[r])},e.prototype.createInstance=function(r){return new e(r)},e}(),jr=new Gr;T.exports=jr},{3:3}]},{},[4])(4)})});var ke=Qe((me,qe)=>{"use strict";(function(b,I){typeof me=="object"&&typeof qe<"u"?I(me):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],I):I(b.LocalforageDriverMemory={})})(typeof self<"u"?self:me,function(b){"use strict";var I="localforage-driver-memory";function w(o){var u=typeof Symbol=="function"&&o[Symbol.iterator],d=0;return u?u.call(o):{next:function(){return o&&d>=o.length&&(o=void 0),{value:o&&o[d++],done:!o}}}}function P(o,u){o=o||[],u=u||{};try{return new Blob(o,u)}catch(S){if(S.name!=="TypeError")throw S;for(var d=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,p=new d,g=0;g<o.length;g+=1)p.append(o[g]);return p.getBlob(u.type)}}var T=/^~~local_forage_type~([^~]+)~/,Z=9,C=Z+4,V=Object.prototype.toString;function B(o){var u=o.length*.75,d=o.length;o[o.length-1]==="="&&(u--,o[o.length-2]==="="&&u--);for(var p=new ArrayBuffer(u),g=new Uint8Array(p),S=0,D=0;S<d;S+=4){var G="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(o[S]),fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(o[S+1]),ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(o[S+2]),ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(o[S+3]);g[D++]=G<<2|fe>>4,g[D++]=(fe&15)<<4|ie>>2,g[D++]=(ie&3)<<6|ue&63}return p}function Y(o){for(var u=new Uint8Array(o),d="",p=0;p<u.length;p+=3)d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[u[p]>>2],d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(u[p]&3)<<4|u[p+1]>>4],d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(u[p+1]&15)<<2|u[p+2]>>6],d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[u[p+2]&63];return u.length%3===2?d=d.substring(0,d.length-1)+"=":u.length%3===1&&(d=d.substring(0,d.length-2)+"=="),d}function K(o,u){var d="";if(o&&(d=V.call(o)),o&&(d==="[object ArrayBuffer]"||o.buffer&&V.call(o.buffer)==="[object ArrayBuffer]")){var p=void 0,g="__lfsc__:";o instanceof ArrayBuffer?(p=o,g+="arbf"):(p=o.buffer,d==="[object Int8Array]"?g+="si08":d==="[object Uint8Array]"?g+="ui08":d==="[object Uint8ClampedArray]"?g+="uic8":d==="[object Int16Array]"?g+="si16":d==="[object Uint16Array]"?g+="ur16":d==="[object Int32Array]"?g+="si32":d==="[object Uint32Array]"?g+="ui32":d==="[object Float32Array]"?g+="fl32":d==="[object Float64Array]"?g+="fl64":u(new Error("Failed to get type for BinaryArray"))),u(g+Y(p))}else if(d==="[object Blob]"){var S=new FileReader;S.onload=function(){var D="~~local_forage_type~"+o.type+"~"+Y(this.result);u("__lfsc__:blob"+D)},S.readAsArrayBuffer(o)}else try{u(JSON.stringify(o))}catch(D){console.error("Couldn't convert value into a JSON string: ",o),u(null,D)}}function J(o){if(o.substring(0,Z)!=="__lfsc__:")return JSON.parse(o);var u=o.substring(C),d=o.substring(Z,C),p;if(d==="blob"&&T.test(u)){var g=u.match(T);p=g[1],u=u.substring(g[0].length)}var S=B(u);switch(d){case"arbf":return S;case"blob":return P([S],{type:p});case"si08":return new Int8Array(S);case"ui08":return new Uint8Array(S);case"uic8":return new Uint8ClampedArray(S);case"si16":return new Int16Array(S);case"ur16":return new Uint16Array(S);case"si32":return new Int32Array(S);case"ui32":return new Uint32Array(S);case"fl32":return new Float32Array(S);case"fl64":return new Float64Array(S);default:throw new Error("Unkown type: "+d)}}function m(o){var u,d;if(o===null||typeof o!="object"||"isActiveClone"in o)return o;var p=o instanceof Date?new Date(o):o.constructor();try{for(var g=w(Object.keys(o)),S=g.next();!S.done;S=g.next()){var D=S.value;Object.prototype.hasOwnProperty.call(o,D)&&(o.isActiveClone=null,p[D]=m(o[D]),delete o.isActiveClone)}}catch(G){u={error:G}}finally{try{S&&!S.done&&(d=g.return)&&d.call(g)}finally{if(u)throw u.error}}return p}function E(o,u){return(o.name||u.name)+"/"+(o.storeName||u.storeName)+"/"}function N(o,u){u&&o.then(function(d){u(null,d)},function(d){u(d)})}function U(){for(var o=[],u=0;u<arguments.length;u++)o[u]=arguments[u];if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}function $(o,u){var d=this;if(u=U.apply(this,arguments),o=typeof o!="function"&&o||{},!o.name){var p=this.config();o.name=o.name||p.name,o.storeName=o.storeName||p.storeName}var g;return o.name?g=new Promise(function(S){o.storeName?S(E(o,d.o)):S(o.name+"/")}):g=Promise.reject("Invalid arguments"),{promise:g,callback:u}}function M(o){return typeof o!="string"&&(console.warn(o+" used as a key, but it is not a string."),o=String(o)),o}var k={bufferToString:Y,deserialize:J,serialize:K,stringToBuffer:B},F={},oe=function(){function o(u){this.kp=u,this.data={}}return o.resolve=function(u){return F[u]||(F[u]=new o(u)),F[u]},o.prototype.clear=function(){this.data={}},o.prototype.drop=function(){this.clear(),delete F[this.kp]},o.prototype.get=function(u){return this.data[u]},o.prototype.key=function(u){return this.keys()[u]},o.prototype.keys=function(){return Object.keys(this.data)},o.prototype.rm=function(u){delete this.data[u]},o.prototype.set=function(u,d){this.data[u]=d},o}();function re(o){var u=o?m(o):{},d=E(u,this.o),p=oe.resolve(d);return this.e=u,this.e.serializer=k,this.e.keyPrefix=d,this.e.mStore=p,Promise.resolve()}function h(o){var u=this,d=this.ready().then(function(){u.e.mStore.clear()});return N(d,o),d}function _(o,u){var d=$.apply(this,arguments),p=d.promise,g=d.callback,S=p.then(function(D){oe.resolve(D).drop()});return N(S,g),p}function A(o,u){var d=this;o=M(o);var p=this.ready().then(function(){var g=d.e.mStore.get(o);return g==null?null:d.e.serializer.deserialize(g)});return N(p,u),p}function O(o,u){var d=this,p=this.ready().then(function(){for(var g=d.e.mStore,S=g.keys(),D=0;D<S.length;D++){var G=g.get(S[D]);if(G&&(G=d.e.serializer.deserialize(G)),G=o(G,S[D],D+1),G!==void 0)return G}});return N(p,u),p}function H(o,u){var d=this,p=this.ready().then(function(){var g;try{g=d.e.mStore.key(o),g===void 0&&(g=null)}catch{g=null}return g});return N(p,u),p}function j(o){var u=this,d=this.ready().then(function(){return u.e.mStore.keys()});return N(d,o),d}function X(o){var u=this.keys().then(function(d){return d.length});return N(u,o),u}function Q(o,u){var d=this;o=M(o);var p=this.ready().then(function(){d.e.mStore.rm(o)});return N(p,u),p}function ee(o,u,d){var p=this;o=M(o);var g=this.ready().then(function(){u===void 0&&(u=null);var S=u;return new Promise(function(D,G){p.e.serializer.serialize(u,function(fe,ie){if(ie)G(ie);else try{p.e.mStore.set(o,fe),D(S)}catch(ue){G(ue)}})})});return N(g,d),g}var ae=!0;b.a=ae,b.r=I,b.f=re,b.clear=h,b.dropInstance=_,b.getItem=A,b.iterate=O,b.key=H,b.keys=j,b.length=X,b.removeItem=Q,b.setItem=ee,Object.defineProperty(b,"__esModule",{value:!0})})});var pe=Je(Ze()),rr=Je(ke());import{SDKBase as ut,createSDK as ct}from"@magic-sdk/provider";import{createDuplicateIframeWarning as tt,createModalNotReadyError as nt,createURL as er,ViewController as at}from"@magic-sdk/provider";import{MagicIncomingWindowMessage as it}from"@magic-sdk/types";var ot={display:"block",visibility:"hidden",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",opacity:"0",zIndex:"-1"};function ft(b){for(let[I,w]of Object.entries(ot))b.style[I]=w}function st(b){return!![].slice.call(document.querySelectorAll(".magic-iframe")).find(w=>w.src.includes(b))}var ye=class extends at{constructor(){super(...arguments);this.activeElement=null;this.relayerSrc=er(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href}init(){this.test="hello",this.iframe=new Promise(w=>{let P=()=>{if(st(encodeURIComponent(this.parameters)))tt().log();else{let T=document.createElement("iframe");T.classList.add("magic-iframe"),T.dataset.magicIframeLabel=er(this.endpoint).host,T.title="Secure Modal",T.src=this.relayerSrc,T.allow="clipboard-read; clipboard-write",ft(T),document.body.appendChild(T),w(T)}};["loaded","interactive","complete"].includes(document.readyState)?P():window.addEventListener("load",P,!1)}),this.iframe.then(w=>{w instanceof HTMLIFrameElement&&w.addEventListener("load",async()=>{this.heartbeatDebounce()})}),window.addEventListener("message",w=>{if(w.origin===this.endpoint&&w.data.msgType&&(w.data.msgType.includes(it.MAGIC_PONG)&&(this.lastPongTime=Date.now()),w.data&&this.messageHandlers.size)){w.data.response=w.data.response??{},this.stopHeartBeat();for(let P of this.messageHandlers.values())P(w)}}),window.addEventListener("beforeunload",()=>{this.stopHeartBeat()})}async showOverlay(){let w=await this.iframe;w.style.visibility="visible",w.style.zIndex="2147483647",w.style.opacity="1",this.activeElement=document.activeElement,w.focus()}async hideOverlay(){let w=await this.iframe;w.style.visibility="hidden",w.style.zIndex="-1",w.style.opacity="0",this.activeElement?.focus&&this.activeElement.focus(),this.activeElement=null}async m(w){let P=await this.iframe;if(P&&P.contentWindow)P.contentWindow.postMessage(w,this.endpoint);else throw nt()}async checkRelayerExistsInDOM(){let w=await this.iframe;return!w||!w.contentWindow?!1:!![].slice.call(document.querySelectorAll(".magic-iframe")).find(T=>T.src.includes(encodeURIComponent(this.parameters)))}async reloadRelayer(){let w=await this.iframe;if(this.stopHeartBeat(),!w){this.init(),console.warn("Magic SDK: Modal lost, re-initiating");return}if(!w.contentWindow){document.body.appendChild(w),console.warn("Magic SDK: Modal did not append in the iframe, re-initiating");return}w&&(w.src=this.relayerSrc)}};export*from"@magic-sdk/commons";var Et=ct(ut,{platform:"web",sdkName:"magic-sdk",version:"29.0.5",defaultEndpoint:"https://auth.magic.link/",ViewController:ye,configureStorage:async()=>{let b=pe.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return await b.defineDriver(rr),await b.setDriver([pe.default.INDEXEDDB,pe.default.LOCALSTORAGE,rr.r]),b}});export{Et as Magic};
|
2
2
|
//# sourceMappingURL=index.js.map
|