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