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